struct tester extends array
private static method save takes nothing returns string
local Base encryptKey = Base["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
local BigInt int = BigInt.create(encryptKey)
local string s
//storing values of
//501 out of a max of 1000000 (gold) (d1)
//1938 out of a max of 1000000 (d2)
//5821 out of a max of 28392 (super powers) (d3)
//1 out of a max of 1 (bool) (d4)
//0 out of a max of 1 (bool) (d5)
//11 out of a max of 11 (player id?) (d6)
//19 out of a max of 1000 (unit level) (d7)
//12 out of a max of 16 (flags) (d8)
call int.add(501,0) //encode 501 (max doesn't matter, put biggest value here)
call int.multiply(1000000+1)
call int.add(1938,0) //encode 1938
call int.multiply(28392+1)
call int.add(5821,0) //encode 5821
call int.multiply(1+1)
call int.add(1,0) //encode 1
call int.multiply(1+1)
call int.add(0,0) //encode 0
call int.multiply(11+1)
call int.add(11,0) //encode 11
call int.multiply(1000+1)
call int.add(19,0) //encode 19
call int.multiply(16+1)
call int.add(12,0) //encode 12
set s = int.toString()
call int.destroy()
//display the code ^_^
return s
endmethod
private static method load takes string s returns nothing
local Base encryptKey = Base["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
local string loadCode = s
local BigInt int = BigInt.convertString(loadCode, encryptKey)
local integer d8 = int.divide(16+1) //12
local integer d7 = int.divide(1000+1) //19
local integer d6 = int.divide(11+1) //11
local integer d5 = int.divide(1+1) //0
local integer d4 = int.divide(1+1) //1
local integer d3 = int.divide(28392+1) //5821
local integer d2 = int.divide(1000000+1) //1938
local integer d1 = int.toInt() //501
call int.destroy()
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d1: " + I2S(d1) + "==" + "501")
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d2: " + I2S(d2) + "==" + "1938")
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d3: " + I2S(d3) + "==" + "5821")
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d4: " + I2S(d4) + "==" + "1")
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d5: " + I2S(d5) + "==" + "0")
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d6: " + I2S(d6) + "==" + "11")
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d7: " + I2S(d7) + "==" + "19")
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "d8: " + I2S(d8) + "==" + "12")
endmethod
private static method onInit takes nothing returns nothing
local string s = save()
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "2G9Z2EVGV87IY\n" + s)
call load(s)
endmethod
endstruct