Trade Class to help with Tracking Net Change

KeldoranKeldoran Member Posts: 7
edited February 2013 in Scripting
I thought I'd share my system for Zmud to help with tracking trade sales and changes in commodities.  I haven't been able to spend the amount of time I wanted on this and it's vastly unfinished, however I wanted to share it.

#CLASS {trade}
#ALIAS checkcomms {#t+ trade|Capture;city mat summary;city comms;funds trade;previousmaterialvalues = @totalmaterialsvalue;totalmaterialsvalue = %null;previouscommoditiesvalue = @totalcommoditiesvalue;totalcommoditiesvalue = %null}
#ALIAS tradesummary {#math tradefundsdifference @tradefunds-@previousfunds;#echo %ansi( yellow)Current Funds: @tradefunds Net Change: @tradefundsdifference @grosstradevalue Gross Value. Change in Gross Value: @grosstradechange;#echo %ansi( yellow)@totalcommoditiesvalue Total Commodities Value, @totalcommoditieschange Change in Value of Commodities;#echo %ansi( yellow)@totalmaterialsvalue Total Material Value, @totalmaterialschange Change in Value of Materials;#echo Steel: @steel Stock, @steeltotal Total Stock. Buying @steelbuyprice, Selling @steelsellprice. @steeltotalchange Net Change;#echo Wood: @wood Stock, @woodtotal Total Stock. Buying @woodbuyprice, Selling @woodsellprice. @woodtotalchange Net Change;#echo Iron: @Iron Stock, @Irontotal Total Stock. Buying @Ironbuyprice, Selling @Ironsellprice. @Irontotalchange Net Change;#echo Leather: @Leather Stock, @Leathertotal Total Stock. Buying @Leatherbuyprice, Selling @Leathersellprice. @Leathertotalchange Net Change;#echo Coal: @Coal Stock, @Coaltotal Total Stock. Buying @Coalbuyprice, Selling @Coalsellprice. @Coaltotalchange Net Change;#echo Obsidian: @Obsidian Stock, @Obsidiantotal Total Stock. Buying @Obsidianbuyprice, Selling @Obsidiansellprice. @Obsidiantotalchange Net Change;#echo Cloth: @Cloth Stock, @Clothtotal Total Stock. Buying @Clothbuyprice, Selling @Clothsellprice. @Clothtotalchange Net Change;#echo Gold: @Gold Stock, @Goldtotal Total Stock. Buying @Goldbuyprice, Selling @Goldsellprice. @Goldtotalchange Net Change;#echo Rope: @Rope Stock, @Ropetotal Total Stock. Buying @Ropebuyprice, Selling @Ropesellprice. @Ropetotalchange Net Change;#echo Ice: @Ice Stock, @Icetotal Total Stock. Buying @Icebuyprice, Selling @Icesellprice. @Icetotalchange Net Change;#echo Silver: @Silver Stock, @Silvertotal Total Stock. Buying @Silverbuyprice, Selling @Silversellprice. @Silvertotalchange Net Change;#echo Platinum: @Platinum Stock, @Platinumtotal Total Stock. Buying @Platinumbuyprice, Selling @Platinumsellprice. @Platinumtotalchange Net Change;#echo Ruby: @Ruby Stock, @Rubytotal Total Stock. Buying @Rubybuyprice, Selling @Rubysellprice. @Rubytotalchange Net Change;#echo Diamond: @Diamond Stock, @Diamondtotal Total Stock. Buying @Diamondbuyprice, Selling @Diamondsellprice. @Diamondtotalchange Net Change;#echo Emerald: @Emerald Stock, @Emeraldtotal Total Stock. Buying @Emeraldbuyprice, Selling @Emeraldsellprice. @Emeraldtotalchange Net Change;#echo Sapphire: @Sapphire Stock, @Sapphiretotal Total Stock. Buying @Sapphirebuyprice, Selling @Sapphiresellprice. @Sapphiretotalchange Net Change;#echo Stone: @Stone Stock, @Stonetotal Total Stock. Buying @Stonebuyprice, Selling @Stonesellprice. @Stonetotalchange Net Change;#echo Fruit: @Fruit Stock, @Fruittotal Total Stock. Buying @Fruitbuyprice, Selling @Fruitsellprice. @Fruittotalchange Net Change;#echo Vegetable: @Vegetable Stock, @Vegetabletotal Total Stock. Buying @Vegetablebuyprice, Selling @Vegetablesellprice. @Vegetabletotalchange Net Change;#echo Grain: @Grain Stock, @Graintotal Total Stock. Buying @Grainbuyprice, Selling @Grainsellprice. @Graintotalchange Net Change;#echo Meat: @Meat Stock, @Meattotal Total Stock. Buying @Meatbuyprice, Selling @Meatsellprice. @Meattotalchange Net Change;#echo Dairy: @Dairy Stock, @Dairytotal Total Stock. Buying @Dairybuyprice, Selling @Dairysellprice. @Dairytotalchange Net Change;#echo Gemstone: @Gemstone Stock, @Gemstonetotal Total Stock. Buying @Gemstonebuyprice, Selling @Gemstonesellprice. @Gemstonetotalchange Net Change;#echo Sinn: @Sinn Stock, @Sinntotal Total Stock. Buying @Sinnbuyprice, Selling @Sinnsellprice. @Sinntotalchange Net Change;#echo Cuhpfehr: @Cuhpfehr Stock, @Cuhpfehrtotal Total Stock. Buying @Cuhpfehrbuyprice, Selling @Cuhpfehrsellprice. @Cuhpfehrtotalchange Net Change;#echo Rahnse: @Rahnse Stock, @Rahnsetotal Total Stock. Buying @Rahnsebuyprice, Selling @Rahnsesellprice. @Rahnsetotalchange Net Change;#echo Isan: @Isan Stock, @Isantotal Total Stock. Buying @Isanbuyprice, Selling @Isansellprice. @Isantotalchange Net Change;#echo Stehl: @Stehl Stock, @Stehltotal Total Stock. Buying @Stehlbuyprice, Selling @Stehlsellprice. @Stehltotalchange Net Change;#echo Orichalcum: @Orichalcum Stock, @Orichalcumtotal Total Stock. Buying @Orichalcumbuyprice, Selling @Orichalcumsellprice. @Orichalcumtotalchange Net Change;#echo Veritum: @Veritum Stock, @Veritumtotal Total Stock. Buying @Veritumbuyprice, Selling @Veritumsellprice. @Veritumtotalchange Net Change;#echo Bone: @Bone Stock, @Bonetotal Total Stock. Buying @Bonebuyprice, Selling @Bonesellprice. @Bonetotalchange Net Change;#echo Glass: @Glass Stock, @Glasstotal Total Stock. Buying @Glassbuyprice, Selling @Glasssellprice. @Glasstotalchange Net Change;#echo Blackpowder: @Blackpowder Stock, @Blackpowdertotal Total Stock. Buying @Blackpowderbuyprice, Selling @Blackpowdersellprice. @Blackpowdertotalchange Net Change;#echo Crystehl: @Crystehl Stock, @Crystehltotal Total Stock. Buying @Crystehlbuyprice, Selling @Crystehlsellprice. @Crystehltotalchange Net Change;#echo Materials:;#echo Crop: @Crop, Change @Cropstockchange, Price @Cropprice. Value of Materials @Cropvalue;#echo Livestock: @Livestock, Change @Livestockstockchange, Price @Livestockprice. Value of Materials @Livestockvalue;#echo Ore: @Ore, Change @Orestockchange, Price @Oreprice. Value of Materials @Orevalue;#echo Rock: @Rock, Change @Rockstockchange, Price @Rockprice. Value of Materials @Rockvalue;#echo Water: @Water, Change @Waterstockchange, Price @Waterprice. Value of Materials @Watervalue;#echo Fish: @Fish, Change @Fishstockchange, Price @Fishprice. Value of Materials @Fishvalue;#echo Lumber: @Lumber, Change @Lumberstockchange, Price @Lumberprice. Value of Materials @Lumbervalue}
#CLASS 0

#CLASS {trade|Capture}
#TRIGGER {(%w)%s(%d)%s(%d)} {%1previousstock = %2;#math %1stockchange %2-@%1previousstock;%1 = %2;%1price = %3;#math totalmaterialsvalue @%1*@%1value+@totalmaterialsvalues}
#TRIGGER {(%w)~:%s(%d)%s~+%s(%d)%s~=%s(%d)%s(%d)%s(%d)%s(%d)} {%1previousstock = @%1;%1previousreserves = @%1reserve;%1previoustotal = @%1total;#math %1stockchange @%1-@%1previousstock;#math %1reservechange @%1reserve-@%1previousreserves;#math %1totalchange @%1total-@%1previoustotal;%1 = %2;%1reserve = %3;%1total = %4;%1buyprice = %6;%1sellprice = %7;#math totalcommoditiesvalue @%1total*@%1sellprice+@totalcommoditiesvalue}
#TRIGGER {The trade budget currently has (%d) gold.} {previousfunds = @tradefunds;tradefunds = %1;previousgrosstradevalue = @grosstradevalue;#math totalcommoditieschange @totalcommoditiesvalue-@previouscommoditiesvalue;#math totalmaterialschange @totalmaterialsvalue-@previousmaterialvalues;#math grosstradevalue @tradefunds+@totalmaterialvalue+@totalcommoditiesvalue;#math grosstradechange @grosstradevalue-@grossprevioustradevalue;#t- trade|Capture;#math cropvalue @clothsellprice+@ropesellprice+@fruitsellprice/2+@vegetablesellprice/2+@grainsellprice;#math orevalue @isansellprice+@sinnsellprice+@cuhpfehrsellprice/2+@goldsellprice/2+@silversellprice/2+@ironsellprice/4+@steelsellprice/5+@platinumsellprice/60;#math rockvalue @stonesellprice+@coalsellprice/4+@obsidiansellprice/6+@rubysellprice/200+@diamondsellprice/100+@emeraldsellprice/200+@sapphiresellprice/100+@gemstonesellprice/50+@glasssellprice/8;#math livestockvalue @leathersellprice+@meatsellprice+@dairysellprice+@bonesellprice/5;#math lumbervalue @woodsellprice;#math fishvalue @meatsellprice+@bonesellprice/3;watervalue = @icesellprice;#math Steeltotalchange @Steeltotal-@Steelprevioustotal;#math Woodtotalchange @Woodtotal-@Woodprevioustotal;#math Irontotalchange @Irontotal-@Ironprevioustotal;#math Leathertotalchange @Leathertotal-@Leatherprevioustotal;#math Coaltotalchange @Coaltotal-@Coalprevioustotal;#math Obsidiantotalchange @Obsidiantotal-@Obsidianprevioustotal;#math Clothtotalchange @Clothtotal-@Clothprevioustotal;#math Goldtotalchange @Goldtotal-@Goldprevioustotal;#math Ropetotalchange @Ropetotal-@Ropeprevioustotal;#math Icetotalchange @Icetotal-@Iceprevioustotal;#math Silvertotalchange @Silvertotal-@Silverprevioustotal;#math Platinumtotalchange @Platinumtotal-@Platinumprevioustotal;#math Rubytotalchange @Rubytotal-@Rubyprevioustotal;#math Diamondtotalchange @Diamondtotal-@Diamondprevioustotal;#math Emeraldtotalchange @Emeraldtotal-@Emeraldprevioustotal;#math Sapphiretotalchange @Sapphiretotal-@Sapphireprevioustotal;#math Stonetotalchange @Stonetotal-@Stoneprevioustotal;#math Fruittotalchange @Fruittotal-@Fruitprevioustotal;#math Vegetabletotalchange @Vegetabletotal-@Vegetableprevioustotal;#math Graintotalchange @Graintotal-@Grainprevioustotal;#math Meattotalchange @Meattotal-@Meatprevioustotal;#math Dairytotalchange @Dairytotal-@Dairyprevioustotal;#math Gemstonetotalchange @Gemstonetotal-@Gemstoneprevioustotal;#math Sinntotalchange @Sinntotal-@Sinnprevioustotal;#math Cuhpfehrtotalchange @Cuhpfehrtotal-@Cuhpfehrprevioustotal;#math Rahnsetotalchange @Rahnsetotal-@Rahnseprevioustotal;#math Isantotalchange @Isantotal-@Isanprevioustotal;#math Stehltotalchange @Stehltotal-@Stehlprevioustotal;#math Orichalcumtotalchange @Orichalcumtotal-@Orichalcumprevioustotal;#math Veritumtotalchange @Veritumtotal-@Veritumprevioustotal;#math Bonetotalchange @Bonetotal-@Boneprevioustotal;#math Glasstotalchange @Glasstotal-@Glassprevioustotal;#math Blackpowdertotalchange @Blackpowdertotal-@Blackpowderprevioustotal;#math Crystehltotalchange @Crystehltotal-@Crystehlprevioustotal;tradesummary}
#CLASS 0
Aulani
Sign In or Register to comment.