QLoad is easy scrambler to convert all numbers in your string to symbols
Why 'Q' Load? Because i use 'q' integer in all methods
Why Load? Before, I used it for my old SaveLoad.
And for bonus my nobug struct. This easy struct realy help me in the search for bugs. I think it is useful to you.
Required: cj_types.j and cj_types_priv.j library
Why 'Q' Load? Because i use 'q' integer in all methods
Why Load? Before, I used it for my old SaveLoad.
JASS:
library QLoad // Just add in you lib - uses QLoad and in function write local qload 'name' = qload.create()
private constant string Alph = "%$#@!*)(^=" // You can adjust the process
private constant string Numb = "0123456789" // It can not change
struct qload
private static method Encode takes string s returns string // numbers to symbols
int q=0
string full=""
whilenot(q>9)
{if s==SubString(Numb,q,q+1)
{full=SubString(Alph,q,q+1)
return full}
q++}
return s
endmethod
private static method Decode takes string s returns string // symbols to numbers
int q=0
string full=""
whilenot(q>9)
{if s==SubString(Alph,q,q+1)
{full=SubString(Numb,q,v+1)
return full}
q++}
return s
endmethod
static method encryption takes string s,boolean encode returns string // if encode flag = true you will encode else decode
int q=0
int lng=StringLength(s)
string GenCode=""
string array GenX2
whilenot(q>lng)
{if encode==true
{GenX2[q]=Encode(SubString(s,q,q+1))
}else{
GenX2[q]=Decode(SubString(s,q,q+1))}
GenCode=GenCode+GenX2[q]
q++}
return GenCode
endmethod
endstruct
endlibrary
And for bonus my nobug struct. This easy struct realy help me in the search for bugs. I think it is useful to you.
JASS:
struct nobug
string Debug=""
static method bug takes string s,string info returns nothing
call DisplayTimedTextToPlayer(Player(0),0,0,60,"|cFFFFCD00[No-bug]|r "+"{"+"|cFFFF0000"+info+"|r} |"+s)
endmethod
static method lbl takes string info returns nothing
call DisplayTimedTextToPlayer(Player(0),0,0,60,"|cFFFFCD00[label]|r "+"|cFFFF0000"+info+"|r")
endmethod
method dbg takes nothing returns nothing
call DisplayTimedTextToPlayer(Player(0),0,0,60,"|cFFFFCD00[Debug]|r |"+Debug)
endmethod
endstruct
Required: cj_types.j and cj_types_priv.j library