Changeset b72b78844ce1632d3f525227861f9c64dffaf5de
- Timestamp:
- 08/08/09 17:43:10 (3 years ago)
- Children:
- 867160cce99744a7e64db9ac0de6bb741ada3087
- Parents:
- df6b2f294e72732aa332cc603206dec1576c9577, a59347fe3cc3a7fb05360bf2952952fb9cf01d28
- git-committer:
- Flupke <luper.rouch@…> (08/08/09 17:43:10)
- Files:
-
- 2 added
- 1 edited
-
wow/CashControl/CashControl.lua (modified) (11 diffs)
-
pyflu/pyflu/qt/widgets/__init__.py (added)
-
pyflu/pyflu/qt/widgets/base_type_widgets.py (added)
Legend:
- Unmodified
- Added
- Removed
-
wow/CashControl/CashControl.lua
r7d3bd04 ra59347f 54 54 type = "input", 55 55 name = "fixedcost", 56 desc = "Specify the fixed cost of components needed for a recipe: /cc fixed [recipe index] [[x]g] [[y]s] [[z]c]",56 desc = "Specify the fixed cost of components needed for a recipe: /cc fixedcost [recipe index] [[x]g] [[y]s] [[z]c]", 57 57 set = "SetRecipeFixedCost", 58 },59 numitems = {60 type = "input",61 name = "numitems",62 desc = "Specify the number of items produced by a recipe: /cc numitems [recipe index] [num items] (default: 1)",63 set = "SetRecipeNumItems",64 58 }, 65 59 reset = { 66 60 type = "execute", 67 61 name = "reset", 68 desc = "Reset database ",62 desc = "Reset database - All recipes and history is lost, this cannot be undone !", 69 63 func = "Reset", 70 64 }, … … 128 122 129 123 function CashControl:OnEnable() 130 CashControl:Print("CashControl loaded, type /cc or /cash infofor info")124 CashControl:Print("CashControl loaded, type /cc or /cashcontrol for info") 131 125 end 132 126 … … 149 143 count = tonumber(count) 150 144 local cost = self:ParseMoneyString(cost_string) 145 if cost == nil then 146 CashControl:Print("Invalid money string: ", cost_string) 147 return 148 end 151 149 local reagent_name = db.reagents[reagent_index] 152 150 if reagent_name == nil then … … 193 191 CashControl:Print("Minimum prices:") 194 192 for recipe_name, info in pairs(db.craft_stock) do 195 CashControl:Print(string.format("%s: %s", recipe_name, 196 GetCoinTextureString(info.cost / info.count))) 193 local base_price = info.cost / info.count 194 local ah_cut = base_price * 5 / 100 195 local price = base_price + ah_cut 196 CashControl:Print(string.format("%s: %s (+5%% cut: %s)", 197 recipe_name, 198 GetCoinTextureString(price), 199 GetCoinTextureString(ah_cut) 200 ) 201 ) 197 202 end 198 203 end … … 317 322 end 318 323 319 function CashControl:SetRecipeNumItems(info, input)320 local db = self.db.factionrealm321 local i1, i2, recipe_index, count = string.find(input, "^ *(%d+) +(%d+) *$")322 if i1 == nil then323 CashControl:Print(string.format("You must specify a recipe index and an items count: /cc numitems [recipe index] [count]"))324 return325 end326 recipe_index = tonumber(recipe_index)327 count = tonumber(count)328 local recipe_name = db.recipes[recipe_index]329 db.recipes_specs[recipe_name].num_items = count330 CashControl:Print(string.format("%s produces %d items", recipe_name,331 count))332 end333 334 324 function CashControl:Reset() 335 325 -- Reset database to defaults … … 388 378 -- 389 379 local db = self.db.factionrealm 390 local i1, i2, recipe_index, cost = string.find(input, "^ *(%d+) +(.+)$")380 local i1, i2, recipe_index, cost_string = string.find(input, "^ *(%d+) +(.+)$") 391 381 if i1 == nil then 392 382 CashControl:Print(string.format( … … 395 385 end 396 386 recipe_index = tonumber(recipe_index) 397 cost = self:ParseMoneyString(cost)387 local cost = self:ParseMoneyString(cost_string) 398 388 if cost == nil then 389 CashControl:Print("Invalid money string: ", cost_string) 399 390 return 400 391 end … … 421 412 CashControl:Print(" Recipe:") 422 413 for reagent, count in pairs(specs.comps) do 423 CashControl:Print(string.format(" %s*%d", reagent, count)) 424 end 425 CashControl:Print(" Items per craft: "..specs.num_items) 414 CashControl:Print(string.format(" %s x %d", reagent, count)) 415 end 426 416 CashControl:Print(" Fixed cost: "..GetCoinTextureString(specs.fixed_cost)) 427 417 end … … 438 428 comps = {}, 439 429 fixed_cost = 0, 440 num_items = 1,441 430 } 442 431 end … … 548 537 local stock = db.stock[reagent] 549 538 local needed_count = count 550 CashControl:Print("taking", count, reagent, "for", recipe_name)539 -- CashControl:Print("taking", count, reagent, "for", recipe_name) 551 540 while needed_count ~= 0 and #stock ~= 0 do 552 541 if stock[1].count <= needed_count then 553 542 -- Fully remove this stock entry 554 543 local stock_entry = table.remove(stock, 1) 555 CashControl:Print("full", stock_entry.cost, stock_entry.count)544 --CashControl:Print("full", stock_entry.cost, stock_entry.count) 556 545 cost = cost + stock_entry.cost 557 546 needed_count = needed_count - stock_entry.count … … 562 551 stock[1].count = stock[1].count - needed_count 563 552 stock[1].cost = stock[1].cost - taken_cost 564 CashControl:Print("partial", taken_cost, needed_count)553 --CashControl:Print("partial", taken_cost, needed_count) 565 554 cost = cost + taken_cost 566 555 needed_count = 0 567 556 end 568 557 end 569 CashControl:Print("finished taking", count, #stock)558 --CashControl:Print("finished taking", count, #stock) 570 559 if needed_count ~= 0 then 571 560 CashControl:Print(string.format(
Note: See TracChangeset
for help on using the changeset viewer.
