Exp/Gold Needed for Next Level Script(wintin.net)

Scripts for wintin.

Exp/Gold Needed for Next Level Script(wintin.net)

Postby islq » Fri Jun 19, 2009 10:26 am

data from norks and Rigwarl's post
usage:
xp
xp 1
xp 2 33
[code]
#defgroup prompt

#action {^Your levels: %1} {#var levelsStr %1;splitLevels} {G|prompt} {T|WT}
#alias {splitLevels} {using System;\r\nusing System.Windows.Forms;\r\nusing ScriptEngine;\r\n//css_reference ScriptEngine.dll;\r\npublic class Script : WintinScript\r\n{\r\n string lvStr = "";\r\n int [] levels = new int [9] ;\r\n string [] lvNames = new string[9];\r\n\r\n public override void Init()\r\n {\r\n splitLevels();\r\n showTotal();\r\n }\r\n private void splitLevels()\r\n {\r\n lvStr = wintin.GetVariable("levelsStr");\r\n string [] split = null;\r\n split = lvStr.Split(' ');\r\n int len = split.Length;\r\n for(int i=0;i<9;i++){\r\n if(len>(i*2+1)){\r\n levels[i] = Convert.ToInt32(split[i*2+1]);\r\n lvNames[i] = split[i*2];\r\n }else{\r\n levels[i] = 0;\r\n lvNames[i] = (i+1).ToString();\r\n }\r\n }\r\n }\r\n private void showTotal()\r\n {\r\n int totalLevels = 0;\r\n for(int i=0;i<9;i++){\r\n totalLevels += levels[i];\r\n }\r\n msg("Total Levels: [" + totalLevels.ToString() + "]");\r\n }\r\n private void msg(string str)\r\n {\r\n wintin.SendToScreen(str + "\\n");\r\n }\r\n}} {G|prompt} {T|CS}
#alias {xp} {using System;\r\nusing System.Windows.Forms;\r\nusing ScriptEngine;\r\n//css_reference ScriptEngine.dll;\r\n\r\npublic class Script : WintinScript\r\n{\r\n private long xp = 0;\r\n private long gold = 0;\r\n private long bank = 0;\r\n private long tmp = 0;\r\n private string blank = "-------------------------------------------------------------------";\r\n private string head = " | level | experience | gold";\r\n\r\n private string[] indexName = new string[] {"pri", "sec", "ter", "qua", "qui", "hex", "sep", "oct", "ava"};\r\n private string[] className = new string[9];\r\n private int[] levels = new int[9];\r\n private string lvStr = "";\r\n private long[,] xptable = new long[,] {\r\n //xp1\r\n {0, 2000, 4000, 9000, 15000, 20000, 30000, 40000, 80000, 120000, 150000, 200000, 250000, 300000, 400000, 450000, 500000, 550000, 600000, 700000, 800000, 1000000, 1500000, 2000000, 2500000, 3500000, 4700000, 6000000, 7300000, 8600000, 9900000, 11000000, 13000000, 15000000, 18300000, 21500000, 25000000, 30000000, 35000000, 40000000},\r\n //gold1\r\n {0, 150, 200, 250, 300, 540, 780, 1020, 1260, 1500, 2400, 3300, 4200, 5100, 6000, 8400, 10800, 13200, 15600, 18000, 21600, 25200, 28800, 32400, 36000, 43200, 50400, 57600, 64800, 72000, 100800, 129600, 158400, 187200, 216000, 302400, 388800, 475200, 561600, 648000},\r\n //xp2\r\n {4000, 8000, 16000, 32000, 45000, 70000, 100000, 140000, 280000, 360000, 550000, 800000, 1000000, 1200000, 1600000, 1800000, 2000000, 2200000, 2400000, 2800000, 3200000, 4000000, 6000000, 8000000, 10000000, 12000000, 14800000, 18000000, 21000000, 28000000, 32000000, 36000000, 39000000, 45000000, 50800000, 60500000, 65000000, 70000000, 85000000, 90000000},\r\n //gold2\r\n {200, 300, 400, 500, 600, 1200, 1800, 2040, 2520, 3000, 4800, 6600, 8400, 10200, 12000, 16800, 21660, 26400, 31200, 36000, 43200, 50400, 57600, 64800, 72000, 86400, 100800, 115200, 129600, 144000, 201600, 259200, 316800, 374400, 432000, 604800, 777600, 950400, 1123200, 1296000},\r\n //xp3\r\n {12000, 24000, 48000, 96000, 135000, 210000, 300000, 420000, 840000, 1080000, 1650000, 2400000, 3000000, 3600000, 4800000, 5400000, 6000000, 6600000, 7200000, 8400000, 9600000, 12000000, 18000000, 24000000, 30000000, 36000000, 44400000, 54000000, 63000000, 84000000, 96000000, 108000000, 117000000, 135000000, 152400000, 181500000, 195000000, 210000000, 255000000, 270000000},\r\n //gold3\r\n {300, 450, 600, 750, 900, 1620, 2340, 3060, 3780, 4500, 9600, 13200, 12600, 15300, 18000, 25500, 32400, 39600, 46800, 54000, 64800, 75600, 86400, 97200, 108000, 129600, 151200, 172800, 194400, 216000, 302400, 388800, 475200, 561600, 648000, 907200, 1166400, 1425600, 1684800, 1944000},\r\n //xp4\r\n {40000, 80000, 160000, 320000, 450000, 700000, 1000000, 1400000, 2800000, 3600000, 5500000, 8000000, 10000000, 12000000, 16000000, 18000000, 20000000, 22000000, 24000000, 28000000, 32000000, 40000000, 60000000, 80000000, 100000000, 120000000, 148000000, 180000000, 210000000, 280000000, 320000000, 360000000, 390000000, 450000000, 508000000, 605000000, 650000000, 700000000, 850000000, 900000000},\r\n //gold4\r\n {400, 600, 800, 1000, 1200, 2160, 3120, 4080, 5040, 6000, 9600, 13200, 16800, 20400, 24000, 33600, 43200, 52800, 62400, 72000, 86400, 100800, 115200, 129600, 144000, 172800, 201600, 230400, 259200, 288000, 403200, 518400, 633600, 748800, 864000, 1209600, 1555200, 1900800, 2246400, 2592000},\r\n //xp5\r\n {80000, 160000, 320000, 640000, 900000, 1400000, 2000000, 2800000, 5600000, 7200000, 11000000, 16000000, 20000000, 24000000, 32000000, 36000000, 40000000, 44000000, 48000000, 56000000, 64000000, 80000000, 120000000, 160000000, 200000000, 240000000, 296000000, 360000000, 420000000, 560000000, 640000000, 720000000, 780000000, 900000000, 1016000000, 1210000000, 1300000000, 1400000000, 1700000000, 1800000000},\r\n //gold5\r\n {500, 750, 1000, 1250, 1500, 2700, 3900, 5100, 6300, 7500, 12000, 16500, 21000, 25500, 30000, 42000, 54000, 66000, 78000, 90000, 108000, 126000, 144000, 162000, 180000, 216000, 252000, 288000, 324000, 360000, 504000, 648000, 792000, 936000, 1080000, 1512000, 1944000, 2376000, 2808000, 3240000},\r\n //xp6\r\n {120000, 240000, 480000, 960000, 1350000, 2100000, 3000000, 4200000, 8400000, 10800000, 16500000, 24000000, 30000000, 36000000, 48000000, 54000000, 60000000, 66000000, 72000000, 84000000, 96000000, 120000000, 180000000, 240000000, 300000000, 360000000, 444000000, 540000000, 630000000, 840000000, 960000000, 1080000000, 1170000000, 1350000000, 1524000000, 1815000000, 1950000000, 2100000000, 2550000000, 2700000000},\r\n //gold6\r\n {1200, 1800, 2400, 3000, 3600, 6480, 9360, 12240, 15120, 18000, 28800, 39600, 50400, 61200, 72000, 100800, 129600, 158400, 187200, 216000, 259200, 302400, 345600, 388800, 432000, 518400, 604800, 691200, 777600, 864000, 1209600, 1555200, 1900800, 2246400, 2592000, 3628800, 4665600, 5702400, 6739200, 7776000},\r\n //xp7\r\n {240000, 480000, 960000, 1920000, 2700000, 4200000, 6000000, 8400000, 16800000, 21600000, 33000000, 48000000, 60000000, 72000000, 96000000, 108000000, 120000000, 132000000, 144000000, 168000000, 192000000, 240000000, 360000000, 480000000, 600000000, 720000000, 888000000, 1080000000, 1260000000, 1680000000, 1920000000, 2160000000, 2340000000, 2700000000, 3048000000, 3630000000, 3900000000, 4200000000, 5100000000, 5400000000},\r\n //gold7\r\n {1400, 2100, 2800, 3500, 4200, 7560, 10920, 14280, 17640, 21000, 33600, 46200, 58800, 71400, 84000, 117600, 151200, 184800, 218400, 252000, 302400, 352800, 403200, 453600, 504000, 604800, 705600, 806400, 907200, 1008000, 1411200, 1814400, 2217600, 2620800, 3024000, 4233600, 5443200, 6652800, 7862400, 9072000},\r\n //xp8\r\n {320000, 640000, 1280000, 2560000, 3600000, 5600000, 8000000, 11200000, 22400000, 28800000, 44000000, 64000000, 80000000, 96000000, 128000000, 144000000, 160000000, 176000000, 192000000, 224000000, 256000000, 320000000, 480000000, 640000000, 800000000, 960000000, 1184000000, 1440000000, 1680000000, 2240000000, 2560000000, 2880000000, 3120000000, 3600000000, 4064000000, 4840000000, 5200000000, 5600000000, 6800000000, 7200000000},\r\n //gold8\r\n {1600, 2400, 3200, 4000, 4800, 8640, 12480, 16320, 20160, 24000, 38400, 52800, 67200, 81600, 96000, 134400, 172800, 211200, 249600, 288000, 345600, 403200, 460800, 518400, 576000, 691200, 806400, 921600, 1036800, 1152000, 1612800, 2073600, 2534400, 2995200, 3456000, 4838400, 6220800, 7603200, 8985600, 10368000},\r\n //xp9\r\n {110000000, 140000000, 180000000, 220000000, 260000000, 300000000, 340000000, 380000000, 420000000, 460000000, 500000000, 550000000, 600000000, 650000000, 700000000, 750000000, 800000000, 850000000, 900000000, 950000000, 1050000000, 1100000000, 1200000000, 1300000000, 1400000000, 1500000000, 1600000000, 1700000000, 1800000000, 1900000000, 2000000000, 2100000000, 2100000000, 2100000000, 2100000000, 2100000000, 2100000000, 2100000000, 2100000000, 2100000000},\r\n //gold9\r\n {1000000, 1075000, 1150000, 1225000, 1300000, 1375000, 1450000, 1525000, 1600000, 1675000, 1750000, 1825000, 1900000, 1975000, 2050000, 2125000, 2200000, 2275000, 2350000, 2425000, 2500000, 2575000, 2650000, 2725000, 2800000, 2875000, 2950000, 3025000, 3100000, 3175000, 3250000, 3325000, 3400000, 3475000, 3550000, 3625000, 3700000, 3775000, 3850000, 3925000}\r\n };\r\n \r\n public override void Init()\r\n {\r\n string cmdline = wintin.Line.Trim();\r\n \r\n getVars();\r\n \r\n if(cmdline.Length>0) {\r\n showTable(cmdline);\r\n return;\r\n }else{\r\n showXp();\r\n }\r\n }\r\n\r\n private void getVars(){\r\n xp = Convert.ToInt64(wintin.GetVariable("CurrentXP").Trim());\r\n gold = Convert.ToInt64(wintin.GetVariable("Gold").Trim());\r\n bank = Convert.ToInt64(wintin.GetVariable("Bank").Trim());\r\n lvStr = wintin.GetVariable("levelsStr");\r\n splitLevels();\r\n }\r\n\r\n private void splitLevels()\r\n {\r\n string [] split = null;\r\n split = lvStr.Split(' ');\r\n int len = split.Length;\r\n for(int i=0;i<9;i++){\r\n if(len>(i*2+1)){\r\n levels[i] = Convert.ToInt32(split[i*2+1]);\r\n className[i] = split[i*2];\r\n }else{\r\n levels[i] = 0;\r\n className[i] = indexName[i];\r\n }\r\n }\r\n }\r\n \r\n private void showXp(){\r\n string str = "";\r\n string line = "";\r\n int totalLv = 0;\r\n\r\n int clv = 0;//current level\r\n int nlv = 0;//next level\r\n long nxp = 0;//next level xp\r\n long txp = 0;//temp xp to caculate xp progress\r\n long tnxp = 0;//temp nxp to caculate xp progress\r\n int tlv = 0;//temp level to caculate xp progress\r\n long ngold = 0;//next level gold\r\n\r\n msg(blank);\r\n\r\n for( int i=0;i<9;i++) totalLv += levels[i];\r\n\r\n line = "Total Levels: [" + fmt(totalLv,1) + "]";\r\n msg(line);\r\n line = "Unused XP: [" + fmt(xp,1) +"]";\r\n msg(line);\r\n line = "Cash: [" + fmt(gold,1) + "],Bank: [" + fmt(bank,1) + "],Total: [" +fmt(gold+bank,1) +"]";\r\n msg(line);\r\n\r\n msg(blank);\r\n msg(head);\r\n msg(blank);\r\n for( int i=1;i<9;i++){\r\n line = " ";\r\n\r\n line = line + className[i-1] + " | ";\r\n clv = levels[i-1];\r\n\r\n line = line + fmt(clv,2);\r\n\r\n if(clv > 39) {\r\n nxp = 0;\r\n tmp = 0;\r\n ngold = 0;\r\n } else {\r\n nxp = xptable[(i-1)*2,clv];\r\n //tmp = (xp*100/nxp);\r\n txp = xp;\r\n tnxp = nxp;\r\n tlv = clv;\r\n tmp = 0;\r\n while(txp>tnxp){\r\n tmp = tmp + 100;\r\n tlv++;\r\n txp = txp - tnxp;\r\n tnxp = xptable[(i-1)*2,tlv];\r\n };\r\n tmp = tmp + (txp*100/tnxp);\r\n\r\n ngold = xptable[(i-1)*2+1,clv];\r\n }\r\n if(tmp>99){\r\n str = "(" + tmp.ToString() + "%)";\r\n str = str.PadRight(10+14,' ');\r\n } else if(tmp>90){\r\n str = "(" + tmp.ToString() + "%)";\r\n str = str.PadRight(10+14,' ');\r\n } else {\r\n str = "(" + tmp.ToString() + "%)";\r\n str = str.PadRight(10,' ');\r\n }\r\n\r\n line = line + str+ " | ";\r\n\r\n line = line + fmt(nxp,20)+ " | " + fmt(ngold,20);\r\n\r\n msg(line);\r\n msg(blank);\r\n }\r\n }\r\n \r\n private string fmt(long n,int len){\r\n string str;\r\n str = string.Format("{0:n0}", n);\r\n str = str.PadRight(len,' ');\r\n return str;\r\n }\r\n private void msg(string str){\r\n wintin.SendToScreen(""+ str + "\\n");\r\n }\r\n private void showTable(string cmdline){\r\n int index = 0;\r\n int endLv = 0;\r\n string [] split = null;\r\n string line = "";\r\n int lv = 0;\r\n\r\n split = cmdline.Split(' ');\r\n index = Convert.ToInt32(split[0]);\r\n if (split.Length > 1) {\r\n endLv = Convert.ToInt32(split[1]);\r\n } else {\r\n endLv = 40;\r\n }\r\n\r\n long xp40 = 0;\r\n long gold40 = 0;\r\n\r\n index--;\r\n lv = levels[index];\r\n line = "level experience gold";\r\n msg(line);\r\n\r\n for(int i=0;i<40;i++){ \r\n line = "";\r\n if(i==lv) {\r\n line = "";\r\n } else if(( i > lv ) && ( i < endLv )) {\r\n line = "";\r\n }\r\n line = line + fmt(i+1,7) + fmt(xptable[index*2,i],20) + fmt(xptable[index*2+1,i],1);\r\n if((( i >= lv ) && ( i < endLv ))||(lv==40)) {\r\n xp40 += xptable[index*2,i];\r\n gold40 += xptable[index*2+1,i];\r\n }\r\n line = line + "";\r\n msg(line);\r\n }\r\n if(lv == 40){\r\n line = "total xp : " + fmt(xp40,1);\r\n msg(line);\r\n line = "total gold: " + fmt(gold40,1);\r\n msg(line);\r\n }else{\r\n line = "total xp : " + fmt(xp40,1) + " (" + string.Format("{0:n4}",xp*100.0/xp40 ) + "%)";\r\n msg(line);\r\n line = "total gold: " + fmt(gold40,1) + " (" + string.Format("{0:n4}", (gold+bank)*100.0/gold40 ) + "%)";\r\n msg(line);\r\n }\r\n }\r\n}} {G|prompt} {T|CS}
#variable {levelsStr} {Mo: 40 Cl: 33 Dr: 21 Ne: 16 Ba: 12 Ma: 8 Th: 7 Wa: 6} {G|prompt}
[/code]
islq
 
Posts: 6
Joined: Fri Sep 21, 2007 9:57 am
Status: Offline

Return to WinTin Scripts

Who is online

Users browsing this forum: No registered users and 0 guests