- Joined
- Jun 17, 2007
- Messages
- 1,433
JASS:
set udg_AlphaNumbers[0] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set udg_AlphaNumbers[1] = "1IN3S4VR5DLAXP06UCTBM7EJGH9FW8OKZ2YQ"
set udg_AlphaNumbers[2] = "398QXLK15IZPT7OJHVYMAR0W46E2BGCNFUSD"
set udg_AlphaNumbers[3] = "W71XYB4FMO8V2UZHDTQCK35LREAS6JI90NPG"
set udg_AlphaNumbers[4] = "ZRW8KA2Q4PG6F3S0IYVTJUOB57HMLXNDC91E"
set udg_AlphaNumbers[5] = "FGQMY3UV17BANHOC4P5I89RXL26JDE0ZSWTK"
set udg_AlphaNumbers[6] = "94R3EBK5IL0UNPG8VW2MA1XHTJYD7FSO6CZQ"
set udg_AlphaNumbers[7] = "CX57FPJR10VM6BEGSKYWU8Z9LDONT24HAQI3"
set udg_AlphaNumbers[8] = "UNBZ126HXQ5O7DMGVSAK30YWFIR4P8TCE9LJ"
set udg_AlphaNumbers[9] = "0EQBLXGM9RZ8S2P31K4AJ5HCVIDNWYFO7T6U"
set udg_AlphaNumbers[10] = "YQETJ0BNRCSDX3FLM8UK746VGIW21ZPOA59H"
set udg_AlphaNumbers[11] = "C03P8Y4BG2E7AINS6KOZRTUHJLDQXFVWM519"
set udg_AlphaNumbers[12] = "U651ZSF8YN2XVKJIQPTBEM4C9HWRGA0D3LO7"
set udg_AlphaNumbers[13] = "KG45JQZ10FHY9SV83DXEOI6LMCPN2B7RATUW"
set udg_AlphaNumbers[14] = "70IORPY8M5NWGAHD13ETKC92XUVLJ4S6BZFQ"
set udg_AlphaNumbers[15] = "51P4IW2MTNADYF3LJ9ERGH8SCB70V6XQKUOZ"
set udg_AlphaNumbers[16] = "UQ1ZFJ2VXHPA376CL4KMDN85SOB9EYW0GTIR"
set udg_AlphaNumbers[17] = "YEXKHCUP5TIL3NR4GVM9SB6A7ODQZJ2W8F10"
set udg_AlphaNumbers[18] = "O56AFZTKI0CSMRDX7JNEY4Q82WU31G9LBPVH"
set udg_AlphaNumbers[19] = "FDR5E1KVWIL6HY893UQXZMN47OPACGJSB2T0"
set udg_AlphaNumbers[20] = "S1VMZCH85JKNXTIQ3W297A4GDROBYPL0EU6F"
set udg_AlphaNumbers[21] = "9PXNFZLJHGS23754QYWKIO861DRCBEV0UTMA"
set udg_AlphaNumbers[22] = "V3E1UXCA74RL9MBGOQPY6N5F0HSJ2ITK8ZWD"
set udg_AlphaNumbers[23] = "8VZWRNTYJ1K2FMHG4XAO5CQSP9U6B73L0EID"
set udg_AlphaNumbers[24] = "0KCF4Q1XLM6W8JBI25H9GVTE7P3SZDRAUNYO"
set udg_AlphaNumbers[25] = "2F5NAT6BD0KCOSEQWIG8R1U34HYJ7PXLVZM9"
set udg_AlphaNumbers[26] = "MZSAJNCOX52HF1Y4PRGT8QL3WEK7VB6D9U0I"
set udg_AlphaNumbers[27] = "TLJ46XZNIDCPE5AWUVKRF7OHG9QY1832B0MS"
set udg_AlphaNumbers[28] = "QGJ4C71X6B2IV0H8S3DP9LTRNFKZOAWMEY5U"
set udg_AlphaNumbers[29] = "DR18GKNYLXMB6AISQJWCH92PUT0VF3EO574Z"
set udg_AlphaNumbers[30] = "T38ZJ10F54KAVXB9DOEWNUI7CLGRHQ2PSY6M"
set udg_AlphaNumbers[31] = "KIAZVONTF48Q7DY3UHEXJ5SLCWBG210RP69M"
set udg_AlphaNumbers[32] = "PJ67YUDW18EH2SNRFZB4XVMOTCL5IG30AKQ9"
set udg_AlphaNumbers[33] = "UWR7ZBDFX6Y5GI8MJO3SH2AQECNKT4VP10L9"
set udg_AlphaNumbers[34] = "S89HGMF1D2ECTBUWLP7VNJIZ04RAKY6X5QO3"
set udg_AlphaNumbers[35] = "7KDOST1HVCFNRGE839W2PUAL65MXQZJYB4I0"
set udg_HeroId[0] = 44
set udg_HeroId[1] = 'Hamg'
set udg_HeroId[2] = 'Hblm'
set udg_HeroId[3] = 'Nfir'
set udg_HeroId[4] = 'Hmkg'
set udg_HeroId[5] = 'Nngs'
set udg_HeroId[6] = 'Hpal'
set udg_HeroId[7] = 'Npbm'
set udg_HeroId[8] = 'Nalc'
set udg_HeroId[9] = 'Nbst'
set udg_HeroId[10] = 'Obla'
set udg_HeroId[11] = 'Ofar'
set udg_HeroId[12] = 'Oshd'
set udg_HeroId[13] = 'Otch'
set udg_HeroId[14] = 'Ntin'
set udg_HeroId[15] = 'Ucrl'
set udg_HeroId[16] = 'Nbrn'
set udg_HeroId[17] = 'Udea'
set udg_HeroId[18] = 'Udre'
set udg_HeroId[19] = 'Ulic'
set udg_HeroId[20] = 'Nplh'
set udg_HeroId[21] = 'Edem'
set udg_HeroId[22] = 'Ekee'
set udg_HeroId[23] = 'Emoo'
set udg_HeroId[24] = 'Ewar'
set udg_HeroId[25] = 'H002'
set udg_HeroId[26] = 'N00T'
set udg_HeroId[27] = 'H00F'
set udg_HeroId[28] = 'H014'
set udg_HeroId[29] = 'E000'
set udg_HeroId[30] = 'H00E'
set udg_HeroId[31] = 'H001'
set udg_HeroId[32] = 'O00D'
set udg_HeroId[33] = 'O00U'
set udg_HeroId[34] = 'U006'
set udg_HeroId[35] = 'U00H'
set udg_HeroId[36] = 'O00S'
set udg_HeroId[37] = 'E001'
set udg_HeroId[38] = 'H015'
set udg_HeroId[39] = 'H018'
set udg_HeroId[40] = 'H019'
set udg_HeroId[41] = 'H01A'
set udg_HeroId[42] = 'O00Z'
set udg_HeroId[43] = 'UOOl'
set udg_HeroId[44] = 'E005'
set udg_weapons[0] = 41
set udg_weapons[1]='I00E'
set udg_weapons[2]='I00F'
set udg_weapons[3]='I00G'
set udg_weapons[4]='I00H'
set udg_weapons[5]='I00I'
set udg_weapons[6]='I00J'
set udg_weapons[7]='I00K'
set udg_weapons[8]='I00L'
set udg_weapons[9]='I00M'
set udg_weapons[10]='I00N'
set udg_weapons[11]='I004'
set udg_weapons[12]='I005'
set udg_weapons[13]='I006'
set udg_weapons[14]='I007'
set udg_weapons[15]='I008'
set udg_weapons[16]='I009'
set udg_weapons[17]='I00A'
set udg_weapons[18]='I00B'
set udg_weapons[19]='I00C'
set udg_weapons[20]='I00D'
set udg_weapons[21]='I00S'
set udg_weapons[22]='I00T'
set udg_weapons[23]='I00U'
set udg_weapons[24]='I00V'
set udg_weapons[25]='I00W'
set udg_weapons[26]='I00X'
set udg_weapons[27]='I00Y'
set udg_weapons[28]='I00Z'
set udg_weapons[29]='I010'
set udg_weapons[30]='I011'
set udg_weapons[31]='I017'
set udg_weapons[32]='I019'
set udg_weapons[33]='I01A'
set udg_weapons[34]='I01B'
set udg_weapons[35]='I018'
set udg_weapons[36]='I01C'
set udg_weapons[37]='I01D'
set udg_weapons[38]='I01E'
set udg_weapons[39]='I01F'
set udg_weapons[40]='I01G'
set udg_weapons[41]='I016'
set udg_S2RAW[s2i("-")]=45
set udg_S2RAW[s2i("_")]=95
set udg_S2RAW[s2i("(")]=40
set udg_S2RAW[s2i(")")]=41
set udg_S2RAW[s2i("[")]=91
set udg_S2RAW[s2i("]")]=93
set udg_S2RAW[s2i(".")]=46
set udg_S2RAW[s2i("0")]=48
set udg_S2RAW[s2i("1")]=49
set udg_S2RAW[s2i("2")]=50
set udg_S2RAW[s2i("3")]=51
set udg_S2RAW[s2i("4")]=52
set udg_S2RAW[s2i("5")]=53
set udg_S2RAW[s2i("6")]=54
set udg_S2RAW[s2i("7")]=55
set udg_S2RAW[s2i("8")]=56
set udg_S2RAW[s2i("9")]=57
set udg_S2RAW[s2i("b")]=98
set udg_S2RAW[s2i("c")]=99
set udg_S2RAW[s2i("d")]=100
set udg_S2RAW[s2i("e")]=101
set udg_S2RAW[s2i("f")]=102
set udg_S2RAW[s2i("g")]=103
set udg_S2RAW[s2i("h")]=104
set udg_S2RAW[s2i("i")]=105
set udg_S2RAW[s2i("j")]=106
set udg_S2RAW[s2i("k")]=107
set udg_S2RAW[s2i("l")]=108
set udg_S2RAW[s2i("m")]=109
set udg_S2RAW[s2i("n")]=110
set udg_S2RAW[s2i("o")]=111
set udg_S2RAW[s2i("p")]=112
set udg_S2RAW[s2i("q")]=113
set udg_S2RAW[s2i("r")]=114
set udg_S2RAW[s2i("s")]=115
set udg_S2RAW[s2i("t")]=116
set udg_S2RAW[s2i("u")]=117
set udg_S2RAW[s2i("v")]=118
set udg_S2RAW[s2i("w")]=119
set udg_S2RAW[s2i("x")]=120
set udg_S2RAW[s2i("y")]=121
set udg_S2RAW[s2i("z")]=122
JASS:
function Name2Integer takes string s returns integer
local integer i=StringLength(s)
local integer end=0
loop
exitwhen i<1
set end=end+udg_S2RAW[s2i(SubString(s,i-1,i))]
set i=i-1
endloop
return end
endfunction
function HeroAllocate takes integer i returns integer
local integer q=1
if i=='Edmm'then
return 21
elseif (i=='H00H')or(i=='H00L')or(i=='H00M')then
return 27
elseif (i=='Nalm')or(i=='Nal2')or(i=='Nal3')then
return 8
elseif i=='Nrob'then
return 14
endif
loop
exitwhen q>udg_HeroId[0]
if i==udg_HeroId[q]then
return q
endif
set q=q+1
endloop
return 0
endfunction
function ItemAllocate takes integer i returns integer
local integer q=1
loop
exitwhen q>udg_weapons[0]
if i==udg_weapons[q]then
return q
endif
set q=q+1
endloop
return 0
endfunction
function CodeColor takes string s returns string
local integer i=0
local integer l=0
local string a=""
local string f=""
loop
exitwhen i>15
set a=SubString(s,i,i+1)
loop
if l==10then
set f=f+"|cffcc0000"+a+"|r"
set l=0
exitwhen true
elseif a==SubString(udg_AlphaNumbers[0],l,l+1)then
set f=f+"|cffffcc00"+a+"|r"
set l=0
exitwhen true
endif
exitwhen l>9
set l=l+1
endloop
set i=i+1
endloop
return f
endfunction
function Trig_Save_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local player p=GetOwningPlayer(u)
local integer i=GetRandomInt(1,35)
local integer r=GetRandomInt(40,1000)
local integer a=GetItemTypeId(UnitItemInSlot(u,0))
local integer b=Name2Integer(StringCase(GetPlayerName(p),false))
local integer c=GetUnitTypeId(u)
local integer d=GetHeroLevel(u)
local integer cs=a/3+c/2+b+d+r
local string sc=""
call RemoveUnit(u)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",2875,-1400))
set a=ItemAllocate(a)+r
set c=HeroAllocate(c)+r
set d=d+r
set b=a/36
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set a=a-b*36
set sc=sc+SubString(udg_AlphaNumbers[i],a,a+1)
set b=c/36
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set c=c-b*36
set sc=sc+SubString(udg_AlphaNumbers[i],c,c+1)
set b=d/36
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set d=d-b*36
set sc=sc+SubString(udg_AlphaNumbers[i],d,d+1)
set b=cs/60466176
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set cs=cs-b*60466176
set b=cs/1679616
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set cs=cs-b*1679616
set b=cs/46656
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set cs=cs-b*46656
set b=cs/1296
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set cs=cs-b*1296
set b=cs/36
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set cs=cs-b*36
set sc=sc+SubString(udg_AlphaNumbers[i],cs,cs+1)
set b=r/36
set sc=sc+SubString(udg_AlphaNumbers[i],b,b+1)
set r=r-b*36
set sc=sc+SubString(udg_AlphaNumbers[i],r,r+1)
set sc=sc+SubString(udg_AlphaNumbers[0],i,i+1)
call DisplayTimedTextToPlayer(p,0,0,300,"|cff00ff00Code is lower case. |r|cffffcc00Numbers|r|cff00ff00 are gold; |r|cffcc0000letters|r|cff00ff00 are red.")
call DisplayTimedTextToPlayer(p,0,0,300,"|cff000000-----------------------------------------------------------------")
call DisplayTimedTextToPlayer(p,0,0,300,"|cff00ff00Your load code is:|r "+CodeColor(StringCase(sc,false)))
set u=null
set p=null
endfunction
JASS:
function Trig_Load_Actions takes nothing returns nothing
local player p=GetTriggerPlayer()
local string s=StringCase(SubString(GetEventPlayerChatString(),6,21),true)
local integer i=1
local integer l=0
local integer a=0
local integer c=0
local integer d=0
local integer cs=0
local integer r=0
if StringLength(s)!=15 then
call DisplayTimedTextToPlayer(p,0,0,3.00,"|cffff0000Invalid Code")
set p=null
return
endif
loop
exitwhen i>35
if SubString(s,14,15)==SubString(udg_AlphaNumbers[0],i,i+1) then
exitwhen true
endif
set i=i+1
endloop
if i>35 then
call DisplayTimedTextToPlayer(p,0,0,5.00,"|cffff0000Invalid Code")
set p=null
return
endif
loop
exitwhen l>35
if SubString(s,0,1)==SubString(udg_AlphaNumbers[i],l,l+1)then
set a=l*36
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,1,2)==SubString(udg_AlphaNumbers[i],l,l+1)then
set a=a+l
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,2,3)==SubString(udg_AlphaNumbers[i],l,l+1)then
set c=l*36
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,3,4)==SubString(udg_AlphaNumbers[i],l,l+1)then
set c=c+l
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,4,5)==SubString(udg_AlphaNumbers[i],l,l+1)then
set d=l*36
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,5,6)==SubString(udg_AlphaNumbers[i],l,l+1)then
set d=d+l
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,6,7)==SubString(udg_AlphaNumbers[i],l,l+1)then
set cs=l*60466176
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,7,8)==SubString(udg_AlphaNumbers[i],l,l+1)then
set cs=cs+l*1679616
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,8,9)==SubString(udg_AlphaNumbers[i],l,l+1)then
set cs=cs+l*46656
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,9,10)==SubString(udg_AlphaNumbers[i],l,l+1)then
set cs=cs+l*1296
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,10,11)==SubString(udg_AlphaNumbers[i],l,l+1)then
set cs=cs+l*36
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,11,12)==SubString(udg_AlphaNumbers[i],l,l+1)then
set cs=cs+l
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,12,13)==SubString(udg_AlphaNumbers[i],l,l+1)then
set r=l*36
set l=0
exitwhen true
endif
set l=l+1
endloop
loop
exitwhen l>35
if SubString(s,13,14)==SubString(udg_AlphaNumbers[i],l,l+1)then
set r=r+l
set l=0
exitwhen true
endif
set l=l+1
endloop
set a=a-r
set c=c-r
set d=d-r
if cs!=udg_weapons[a]/3+udg_HeroId[c]/2+Name2Integer(StringCase(GetPlayerName(p),false))+d+r then
call DisplayTimedTextToPlayer(p,0,0,5.00,"|cffff0000Invalid Code")
set p=null
return
else
if udg_FactorCleared[100+GetPlayerId(p)]==true then
call DisplayTimedTextToPlayer(p,0,0,7,"|cff00ff00Use '-repick' before trying to load again.|r")
else
set udg_FactorCleared[100+GetPlayerId(p)]=true
set udg_LoadedUnit=CreateUnit(p,udg_HeroId[c],3950.8,-671.9,512.0)
if d>1then
call SetHeroLevel(udg_LoadedUnit,d,true)
endif
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"|cff33ff33A Player Loaded a Level "+I2S(d)+ " Hero.|r")
call UnitAddItem(udg_LoadedUnit,CreateItem(udg_weapons[a],0,0))
call DisableTrigger(gg_trg_Load)
call PolledWait(0.3)
call EnableTrigger(gg_trg_Load)
endif
endif
set p=null
endfunction
Last edited by a moderator: