Ignore:
Timestamp:
08/01/09 17:33:57 (3 years ago)
Author:
unknown <Administrator@…>
Children:
b72b78844ce1632d3f525227861f9c64dffaf5de
Parents:
8fde61c725a377c23540eb34f741f1555596a414
git-committer:
unknown <Administrator@…> (08/01/09 17:33:57)
Message:

CashControl:

  • cosmetic changes
  • removed 'numitems' option
File:
1 edited

Legend:

Unmodified
Added
Removed
  • wow/CashControl/CashControl.lua

    r8cf6e41 ra59347f  
    5454            type = "input", 
    5555            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]", 
    5757            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", 
    6458        }, 
    6559        reset = { 
    6660            type = "execute", 
    6761            name = "reset", 
    68             desc = "Reset database", 
     62            desc = "Reset database - All recipes and history is lost, this cannot be undone !", 
    6963            func = "Reset", 
    7064        }, 
     
    149143    count = tonumber(count) 
    150144    local cost = self:ParseMoneyString(cost_string) 
     145    if cost == nil then 
     146        CashControl:Print("Invalid money string: ", cost_string) 
     147        return 
     148    end 
    151149    local reagent_name = db.reagents[reagent_index] 
    152150    if reagent_name == nil then 
     
    324322end 
    325323 
    326 function CashControl:SetRecipeNumItems(info, input) 
    327     local db = self.db.factionrealm 
    328     local i1, i2, recipe_index, count = string.find(input, "^ *(%d+) +(%d+) *$") 
    329     if i1 == nil then 
    330         CashControl:Print(string.format("You must specify a recipe index and an items count: /cc numitems [recipe index] [count]")) 
    331         return 
    332     end 
    333     recipe_index = tonumber(recipe_index) 
    334     count = tonumber(count) 
    335     local recipe_name = db.recipes[recipe_index] 
    336     db.recipes_specs[recipe_name].num_items = count 
    337     CashControl:Print(string.format("%s produces %d items", recipe_name,  
    338         count)) 
    339 end 
    340  
    341324function CashControl:Reset() 
    342325    -- Reset database to defaults 
     
    395378    -- 
    396379    local db = self.db.factionrealm 
    397     local i1, i2, recipe_index, cost = string.find(input, "^ *(%d+) +(.+)$") 
     380    local i1, i2, recipe_index, cost_string = string.find(input, "^ *(%d+) +(.+)$") 
    398381    if i1 == nil then 
    399382        CashControl:Print(string.format( 
     
    402385    end 
    403386    recipe_index = tonumber(recipe_index) 
    404     cost = self:ParseMoneyString(cost) 
     387    local cost = self:ParseMoneyString(cost_string) 
    405388    if cost == nil then 
     389        CashControl:Print("Invalid money string: ", cost_string) 
    406390        return 
    407391    end 
     
    428412    CashControl:Print("    Recipe:") 
    429413    for reagent, count in pairs(specs.comps) do 
    430         CashControl:Print(string.format("        %s*%d", reagent, count)) 
    431     end 
    432     CashControl:Print("    Items per craft: "..specs.num_items) 
     414        CashControl:Print(string.format("        %s x %d", reagent, count)) 
     415    end 
    433416    CashControl:Print("    Fixed cost: "..GetCoinTextureString(specs.fixed_cost)) 
    434417end 
     
    445428            comps = {}, 
    446429            fixed_cost = 0, 
    447             num_items = 1, 
    448430        } 
    449431    end 
Note: See TracChangeset for help on using the changeset viewer.