Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- code]{
- ZRPG EVOLVED by Hacktank
- /-------------------\
- | Version 1.8.0 |
- \-------------------/
- Explode By CurryWurst and DorkeyDear
- }
- const
- accdir = 'scripts/zrpgevolved/accounts/';
- botdir = 'scripts/zrpgevolved/bots/';
- botlvlmod = 3;
- maxcalclvl = 1000;
- startmaxbots = 20;
- acclen=12;
- aname=0;
- apass=1;
- alvl=2;
- axp=3;
- aspts=4;
- amana=5;
- amaxmana=6;
- aextrahp=7;
- admg=8;
- afatalstate=9;
- akazistl=10;
- asouls=11;
- skilllen = 29;
- sheal = 0;
- snade = 1;
- scluster = 2;
- svanish = 3;
- sturret = 4;
- swave = 5;
- sshield = 6;
- sflamer = 7;
- scrit = 8;
- sfatalh = 9;
- svamp = 10;
- slootammo = 11;
- slootitems = 12;
- srage = 13;
- sbarret = 14;
- spush = 15;
- sruger = 16;
- smine = 17;
- sbulletvortex = 18;
- skazi = 19;
- swarp = 20;
- spsg = 21;
- ssonicburst = 22;
- ssoulshield = 23;
- sbacklash = 24;
- sreload = 25;
- smissile = 26;
- svulture = 27;
- sfogshield = 28;
- sdamage = 0;
- sfireinterval = 1;
- sammo = 2;
- sreloadtime = 3;
- sspeed = 4;
- sbulletstyle = 5;
- sstartuptime = 6;
- sbink = 7;
- smovementacc = 8;
- srecoil = 9;
- sbotlen = 15;
- sbothealth = 0;
- sbothealthreg = 1;
- sbotweapon = 2;
- sbotbonus = 3;
- sbotdmg = 4;
- sbotmana = 5;
- sbotspts = 6;
- sbotspc = 7;
- sbotminxp = 8;
- sbotmaxxp = 9;
- sbotkind = 10;
- sbotwaveammount = 11;
- sbotwavestl = 12;
- sbotwavespeed = 13;
- sbotsouls = 14;
- snormal = 0;
- ssdmg = 1;
- smirror = 2;
- skamakazi = 3;
- scopycat = 4;
- totalbots = 17;
- sbcopycat = 0;
- sbdemon = 1;
- sbdoppleganger = 2;
- sbeliteslicerzombie = 3;
- sbelitezombie = 4;
- sbghoul = 5;
- sbgrimreaper = 6;
- sbkamakazi = 7;
- sbmirror = 8;
- sbmummy = 9;
- sbnitrokamakazi = 10;
- sbrocketzombie = 11;
- sbslicerzombie = 12;
- sbturncoat = 13;
- sbvortex = 14;
- sbzombie = 15;
- sbxpbank = 16;
- smessages = 7;
- shelp = 0;
- snotloggedin = 1;
- scommands = 2;
- stimedinfo = 3;
- sjoininfo = 4;
- sadmincommands = 5;
- srules = 6;
- type vect = record
- x,y,thea,radius: single;
- end;
- type minetype = record
- x,y: single;
- end;
- type missiletype = record
- active: boolean;
- vec: vect;
- target: byte;
- end;
- type psgtype = record
- active: boolean;
- vec: vect;
- target: byte;
- flame,ammo: integer;
- end;
- type plr = record
- pass: string;
- accname: string;
- accountfileindex: integer;
- autosavecountdown: integer;
- logged: boolean;
- allowbravo: boolean;
- lastcommand: string;
- lvl: integer;
- xp: integer;
- spts: integer;
- mana: single;
- maxmana: integer;
- souls: single;
- maxsouls: single;
- extrahp: integer;
- tempextrahp: integer;
- dmg: single;
- raging: boolean;
- fatalstate: string;
- kazistl: string;
- soulshield: boolean;
- turretid: integer;
- turrettime: integer;
- flamertime: integer;
- hptimer: integer;
- hptarget: byte;
- missile: missiletype;
- fogshield: boolean;
- fogshieldchance: single;
- secondarybuffer: byte;
- canbacklash: boolean;
- backlash: boolean;
- inground: integer;
- psg: psgtype;
- skills: array[0..skilllen-1] of integer;
- cooldown: array[0..skilllen-1] of integer;
- mine: array of minetype;
- end;
- type sbottype = record
- assigned: boolean;
- heal: boolean;
- flatdamage: integer;
- lastshooter: byte;
- infigun: boolean;
- health: integer;
- maxhealth: integer;
- healthreg: integer;
- weapon: byte;
- bonus: byte;
- dmg: single;
- mana: single;
- souls: single;
- spts: integer;
- spc: single;
- minxp: integer;
- maxxp: integer;
- kind: byte;
- waveammount: integer;
- wavestl: byte;
- wavespeed: single;
- end;
- type skilltype = record
- cost: integer;
- mcost: single;
- scost: single;
- minlvl: integer;
- specint1: integer;
- specint2: integer;
- specfloat1: single;
- specfloat2: single;
- cooldown: integer;
- end;
- var
- accounts: array of string;
- player: array[1..32] of plr;
- skills: array[0..skilllen] of array of skilltype;
- weapons: array[0..16] of array[0..9] of integer;
- bots: array[1..16] of array[1..16] of string;
- sbot: array[1..32] of sbottype;
- botstatics: array[0..totalbots] of sbottype;
- botcost: array[0..totalbots-1] of integer;
- botorder: array of integer;
- messages: array[0..smessages-1] of string;
- compiled,threadrunning,checkbots,accountfilechanged: boolean;
- threadrestart,maxbots,totalaccounts,runningbotvalue: integer;
- function Explode(Source: string; const Delimiter: string): array of string;
- var
- Position, DelLength, ResLength: integer;
- begin
- DelLength := Length(Delimiter);
- Source := Source + Delimiter;
- repeat
- Position := Pos(Delimiter, Source);
- SetArrayLength(Result, ResLength + 1);
- Result[ResLength] := Copy(Source, 1, Position - 1);
- ResLength := ResLength + 1;
- Delete(Source, 1, Position + DelLength - 1);
- until (Position = 0);
- SetArrayLength(Result, ResLength - 1);
- end;
- function XJoin(ary: array of string; splitter: string): string;
- var i: integer;
- begin
- result := ary[0];
- for i := 1 to getarraylength(ary)-1 do begin
- result := result+splitter+ary[i];
- end;
- end;
- function sprintf(Mask: string; Input: array of variant): string;
- var cur,add: string; i,ii: integer;
- begin
- result := '';
- i := 0;
- ii := 0;
- cur := getpiece(mask,'%',i);
- while (cur <> nil) do begin
- if i mod 2 = 0 then begin
- add := cur;
- end else begin
- cur := lowercase(cur);
- add := 'ERROR';
- case cur of
- 's': add := input[ii];
- 'i': add := inttostr(input[ii]);
- 'd': add := floattostr(input[ii]);
- 'f': add := floattostr(input[ii]);
- end;
- ii := ii + 1;
- end;
- i := i + 1;
- cur := getpiece(mask,'%',i);
- result := result + add;
- end;
- end;
- function GetSequentialFilename(Mask: string; Max: integer): string;
- var i: integer; newname: string;
- begin
- result := '';
- i := 0;
- while true do begin
- newname := sprintf(mask,[i]);
- if not fileexists(newname) then break;
- if i >= max-1 then exit;
- i := i + 1;
- end;
- result := newname;
- end;
- function CheckSum(const str: string): int64;
- var i: integer;
- begin
- result := 0;
- for i := 0 to length(str)-1 do result := result + ord(str[i]);
- end;
- function StrComp(const s1,s2: string): integer;
- begin
- result := checksum(s2) - checksum(s1);
- end;
- //The two functions below have been created by Curt (DorkeyDear), thanks for sharing!
- //#1
- function MonthDays(const Month: byte): byte;
- begin
- case (Month) of
- 1, 3, 5, 7, 9, 11: Result := 31;
- 4, 6, 8, 10, 12: Result := 30;
- 2: Result := 28;
- end;
- end;
- //#2
- function GetMiniTime(): int64;
- begin
- Result :=
- 31536000000 * (StrtoInt(FormatDate('y')) - 2010) +
- 86400000 * MonthDays(StrtoInt(FormatDate('m'))) * StrtoInt(FormatDate('m')) +
- 86400000 * StrtoInt(FormatDate('d')) + 3600000 * StrtoInt(FormatDate('h')) +
- 60000 * StrtoInt(FormatDate('n')) +
- 1000 * StrtoInt(FormatDate('s')) +
- StrtoInt(FormatDate('zzz'));
- end;
- //
- function IntToFloat(Num: integer): single;
- begin
- result := strtofloat(inttostr(num));
- end;
- function CharMultiply(char: string; times: variant): string;
- var u: integer;
- begin
- result := '';
- for u := 1 to round(times) do begin
- result := (result + char);
- end;
- end;
- function WrapValue(ValueRaw,Min,Max: variant; Flatten: boolean): variant;
- begin
- result := valueraw;
- if valueraw < min then result := iif(flatten=true,min,(max-(min-valueraw)));
- if valueraw > max then result := iif(flatten=true,max,(min+(valueraw-max)));
- end;
- function Average(Values: array of variant): variant;
- var i,len: integer; total: variant;
- begin
- len := getarraylength(values);
- total := 0;
- for i := 0 to len - 1 do total := total + values[i];
- if len > 0 then result := total / len else result := 0;
- end;
- function ContainsNum(Source,Test: string): integer;
- var temp: integer;
- begin
- repeat
- temp := pos(test,source);
- result := result + 1;
- delete(source,1,temp);
- until temp = 0;
- end;
- function ToStr(Input: variant): string;
- begin
- case vartype(input) of
- 3: result := inttostr(input);
- 5: result := floattostr(input);
- 11: result := iif(input=true,'true','false');
- 256: result := input;
- end;
- end;
- function ParseNum(Input: string): string;
- var i,ii: integer; cur: string; sign,dot: boolean;
- begin
- result := '';
- for i := 1 to length(input) do begin
- cur := copy(input,i,1);
- if not sign then if cur = '-' then begin
- result := result + cur;
- sign := true;
- end;
- if not dot then if cur = '.' then begin
- result := result + cur;
- dot := true;
- sign := true;
- end;
- for ii := 0 to 9 do if cur = inttostr(ii) then begin
- result := result + cur;
- sign := true;
- end;
- end;
- end;
- function Choose(Input: array of variant): variant;
- var i,len: integer;
- begin
- len := getarraylength(input);
- i := random(0,len);
- if i < 0 then i := 0;
- if i > len-1 then i := len-1;
- result := input[i];
- end;
- function Chance(Perc: single): boolean;
- begin
- result := (inttofloat(random(0,1000001))/1000000 < perc);
- end;
- function Min(Input: array of variant): variant;
- var i: integer;
- begin
- result := input[0];
- for i := 1 to getarraylength(input)-1 do if input[i] < result then result := input[i];
- end;
- function Maxnum(Input: array of variant): variant;
- var i: integer;
- begin
- result := input[0];
- for i := 1 to getarraylength(input)-1 do if input[i] > result then result := input[i];
- end;
- function Frac(X: single): single;
- var delta: integer;
- begin
- result := 0;
- if x = 0 then exit;
- delta := iif(x<0,-1,1);
- x := x * delta;
- while(x>1) do begin
- x := x - 1;
- end;
- result := x * delta;
- end;
- function Normalize(Value,Max: single): single;
- begin
- result := value;
- value := (value - max) / max;
- end;
- function Atan2(Y,X: single): single;
- begin
- if y <> 0.0 then result := 2.0 * arctan(y/(x+sqrt(x*x+y*y)))
- else if x < 0.0 then result := pi else result := 0.0;
- end;
- function addpolarspeed(Vec: vect; thea,radius: single): vect;
- var x,y,s,c: single;
- begin
- s := sin(vec.thea);
- c := cos(vec.thea);
- y := vec.radius * s;
- x := vec.radius * c;
- s := sin(thea);
- c := cos(thea);
- x := x + radius * c;
- y := y + radius * s;
- result.x := vec.x;
- result.y := vec.y;
- result.thea := atan2(y,x);
- result.radius := sqrt(x*x+y*y);
- end;
- function CastRay(X1,Y1,X2,Y2,Accuracy: single; Maxdist: integer): single;
- var dst,dx,dy,h,d: single;
- begin
- result := 0;
- if accuracy <= 0 then exit;
- if raycast(x1,y1,x2,y2,d,maxdist) then begin
- result := maxdist;
- exit;
- end;
- dst := accuracy;
- h := distance(x1,y1,x2,y2);
- dx := (x2 - x1);
- dy := (y2 - y1);
- while((raycast(x1+((dst-accuracy)/h)*dx,y1+((dst-accuracy)/h)*dy,x1+dst/h*dx,y1+dst/h*dy,d,maxdist)) AND (dst < maxdist)) do dst := dst + accuracy;
- if dst > maxdist then dst := maxdist;
- result := dst;
- end;
- function Sort(input: array of integer): array of integer;
- // function Sort, by Hacktank, input an array of integers and it will output them in ascending order.
- var i,ii,first,last,len,cur: integer; used: array of boolean;
- begin
- len := getarraylength(input);
- setarraylength(result,len);
- setarraylength(used,len);
- for i := 0 to len-1 do begin
- for ii := 0 to len-1 do if not used[ii] then begin
- cur := input[ii];
- first := ii;
- break;
- end;
- last := first;
- for ii := first to len-1 do if not used[ii] then if input[ii] < cur then begin
- cur := input[ii];
- last := ii;
- end;
- result[i] := cur;
- used[last] := true;
- end;
- end;
- function Columnize(input: array of string; padding: string; maxrows: integer): array of string;
- var i,ci,clmax,cmax,columns,len,curcol: integer;
- begin
- len := getarraylength(input);
- if len = 0 then begin
- setarraylength(result,1);
- result[0] := '';
- exit;
- end;
- columns := (len div maxrows) + iif(len mod maxrows>0,1,0);
- if columns = 1 then begin
- result := input;
- exit;
- end;
- ci := 0;
- curcol := 0;
- setarraylength(result,maxrows);
- while(curcol < columns) do begin
- cmax := min([maxrows-1,len-ci-1]);
- clmax := length(input[ci]);
- for i := ci to ci+cmax do if length(input[i]) > clmax then clmax := length(input[i]);
- for i := ci to ci+cmax do begin
- result[i-ci] := result[i-ci] + input[i] + charmultiply(' ',clmax-length(input[i])) + iif(curcol<columns-1=true,padding,'');
- end;
- ci := i;
- curcol := curcol + 1;
- end;
- end;
- procedure TextBoxOLD(ID: byte; inputraw: array of string; headline,ychar,xchar,corner: string; color: longint);
- var i,max,allignlength: byte; ii,len: integer; alligncontent,alligntype: string; input: array of string;
- begin
- max := length(headline);
- setarraylength(input,0);
- ii := 0;
- for i := 0 to getarraylength(inputraw)-1 do begin
- if inputraw[i] <> '' then begin
- ii := ii+1;
- setarraylength(input,ii);
- input[ii-1] := inputraw[i];
- if length(input[ii-1]) > max then max := length(input[ii-1]);
- end;
- end;
- len := getarraylength(input);
- for i := 0 to len-1 do begin
- if ((getpiece(input[i],' ',0) = 'center') OR (getpiece(input[i],' ',0) = 'right') OR (getpiece(input[i],' ',0) = 'left')) then begin
- alligntype := getpiece(input[i],' ',0);
- alligncontent := getpiece(input[i],alligntype+' ',1);
- allignlength := length(alligncontent);
- if alligntype = 'center' then input[i] := charmultiply(' ',(max-allignlength) div 2)+alligncontent;
- if alligntype = 'right' then input[i] := charmultiply(' ',(max-allignlength))+alligncontent;
- if alligntype = 'left' then input[i] := alligncontent+charmultiply(' ',(max-allignlength));
- end;
- if length(input[i]) > max then max := length(input[i]);
- end;
- if ((ID >= 0) AND (ID <= 32)) then begin
- writeconsole(ID,corner+charmultiply(xchar,(max-length(headline)) div 2)+headline+charmultiply(xchar,(max-length(headline)+0.4) div 2)+corner,color);
- for i := 0 to len-1 do if input[i] <> '' then writeconsole(ID,ychar+input[i]+charmultiply(' ',max-length(input[i]))+ychar,color);
- writeconsole(ID,corner+charmultiply(xchar,max)+corner,color);
- end else begin
- writeln(corner+charmultiply(xchar,(max-length(headline)) div 2)+headline+charmultiply(xchar,(max-length(headline)+0.4) div 2)+corner);
- for i := 0 to len-1 do if input[i] <> '' then writeln(ychar+input[i]+charmultiply(' ',max-length(input[i]))+ychar);
- writeln(corner+charmultiply(xchar,max)+corner);
- end;
- end;
- procedure TextBox(ID: byte; title,input,delim: string; wallx,wally,corner: char; color: longint);
- var i,lines,lines2,max,tempint,delimlen: integer; output,tempstr: string;
- begin
- output := '';
- max := length(title);
- delimlen := length(delim);
- i := 0;
- lines := 1;
- for i := 1 to length(input) do if copy(input,i,delimlen) = delim then lines := lines + 1;
- lines2 := lines;
- for i := 0 to lines-1 do begin
- tempstr := getpiece(input,delim,i);
- tempint := length(tempstr);
- if tempint > max then max := tempint;
- end;
- tempint := ((max-length(title)) div 2);
- output := output + corner + replicate(wallx,tempint) + title + replicate(wallx,max-(tempint+length(title))) + corner + delim;
- for i := 0 to lines-1 do begin
- tempstr := getpiece(input,delim,i);
- if tempstr = nil then begin
- lines2 := lines2 - 1;
- continue;
- end;
- tempint := length(tempstr);
- output := output + wally;
- case copy(tempstr,1,2) of
- '\r': output := output + replicate(' ',max-(tempint-3)) + copy(tempstr,4,tempint-2);
- '\l': output := output + copy(tempstr,4,tempint-3) + replicate(' ',max-(tempint-2));
- '\c': output := output + replicate(' ',(max-(tempint-3)) div 2) + copy(tempstr,4,tempint-2) + replicate(' ',max-(tempint-3+(max-(tempint-3)) div 2));
- else output := output + tempstr + replicate(' ',max-tempint);
- end;
- output := output + wally + delim;
- end;
- output := output + corner + replicate(wallx,max) + corner;
- for i := 0 to lines2+1 do begin
- tempstr := getpiece(output,delim,i);
- if ((ID >= 0) AND (ID <= 32)) then
- writeconsole(ID,tempstr,color)
- else
- writeln(tempstr);
- end;
- end;
- function GetAccountIndex(Account: string): integer;
- var i: integer; curcheck: string;
- begin
- result := -1;
- for i := 0 to totalaccounts-1 do begin
- curcheck := getpiece(accounts[i],'*',0);
- if ((curcheck <> '') AND (curcheck = account)) then begin
- result := i;
- break;
- end else result := -1;
- end;
- end;
- procedure LoadAccounts();
- var i,prevaccs: integer; accountindexfile: array of string;
- begin
- writeln('Loading account file');
- accountindexfile := explode(readfile('scripts/'+scriptname+'/accountindex.txt'),#13+#10);
- prevaccs := strtoint(accountindexfile[0]);
- writeln('Previous accounts: ' + inttostr(prevaccs));
- if not fileexists('scripts/'+scriptname+'/accounts.txt') then begin
- writeln('account file could not be found!');
- exit;
- end;
- accounts := explode(readfile('scripts/'+scriptname+'/accounts.txt'),'|');
- totalaccounts := getarraylength(accounts);
- writeln('Accounts: ' + inttostr(totalaccounts));
- if totalaccounts + 10 < prevaccs then begin
- writeln('Account file corruption detected! Attempting auto backup restoration');
- accounts := explode(readfile('scripts/'+scriptname+'/backup_prev_accounts.txt'),'|');
- totalaccounts := getarraylength(accounts);
- writeln('New total: ' + inttostr(totalaccounts));
- end;
- accounts[totalaccounts-1] := copy(accounts[totalaccounts-1],0,length(accounts[totalaccounts-1])-3);
- for i := 1 to 32 do if player[i].logged then begin
- player[i].accountfileindex := getaccountindex(player[i].accname);
- if player[i].accountfileindex < 0 then player[i].logged := false;
- end;
- writeln('Account file successfully loaded!');
- end;
- procedure SaveAccounts();
- begin
- writeln('Saving account file');
- //movefile('scripts/'+scriptname+'/accounts.txt','scripts/'+scriptname+'/bac_prev_accounts.txt');
- writefile('scripts/'+scriptname+'/accounts.txt',xjoin(accounts,'|'));
- writefile('scripts/'+scriptname+'/accountindex.txt',inttostr(totalaccounts));
- writefile('scripts/'+scriptname+'/backup_prev_accounts.txt',xjoin(accounts,'|'));
- accountfilechanged := false;
- writeln('Account file saved successfully! Total: ' + inttostr(totalaccounts));
- end;
- procedure BackupAccounts();
- var fname: string;
- begin
- {fname := getsequentialfilename('scripts/'+scriptname+'/backups/backup_'+formatdate('mm-dd')+'_%i%.txt',2);
- if fname = nil then fname := 'scripts/'+scriptname+'/backups/backup_'+formatdate('mm-dd')+'_CAP.txt';
- writefile(fname,readfile('scripts/'+scriptname+'/accounts.txt'));}
- fname := 'scripts/'+scriptname+'/backups/backup_'+formatdate('mm-dd-yy')+'.txt';
- if not fileexists(fname) then writefile(fname,readfile('scripts/'+scriptname+'/accounts.txt'));
- end;
- function GetSafeName(Input: string): string;
- begin
- result := regexpreplace('[/\///|/?/</>/:/*/"]',input,'_',true)
- end;
- procedure FixSkills(ID: byte);
- var i: byte;
- begin
- for i := 0 to skilllen-1 do begin
- if player[ID].skills[i] > getarraylength(skills[i])-1 then player[ID].skills[i] := getarraylength(skills[i])-1;
- end;
- end;
- procedure SetAccStatics(ID: byte);
- begin
- player[ID].maxmana := 10+player[ID].lvl*3;
- player[ID].maxsouls := 10+player[ID].lvl*1;
- player[ID].extrahp := player[ID].lvl*10;
- player[ID].dmg := 1+player[ID].lvl*0.05;
- end;
- function Login(ID: byte; Name,Password: string): byte;
- var accountdata,skilldata: array of string; safename: string; i,index: integer;
- begin
- result := 0;
- safename := getsafename(name);
- index := getaccountindex(safename);
- if index >= 0 then begin
- accountdata := explode(getpiece(accounts[index],':',0),'*');
- setarraylength(accountdata,acclen);
- skilldata := explode(getpiece(accounts[index],':',1),'*');
- setarraylength(skilldata,skilllen);
- if copy(httpencode(md5string(Password)),0,25) = copy(httpencode(accountdata[apass]),0,25) then begin
- player[ID].accountfileindex := index;
- writeln(getplayerstat(ID,'name') + ' hesaba giris yapildi: ' + name); // added by Pablo
- for i := 0 to acclen-1 do begin
- if accountdata[i] = '' then accountdata[i] := '0';
- end;
- for i := 0 to skilllen-1 do begin
- if skilldata[i] = '' then skilldata[i] := '0';
- end;
- player[ID].pass := accountdata[apass];
- player[ID].accname := safename;
- player[ID].logged := true;
- player[ID].lvl := strtoint(accountdata[alvl]);
- player[ID].xp := strtoint(accountdata[axp]);
- player[ID].spts := strtoint(accountdata[aspts]);
- player[ID].mana := strtofloat(accountdata[amana]);
- player[ID].maxmana := strtoint(accountdata[amaxmana]);
- player[ID].souls := strtofloat(accountdata[asouls]);
- player[ID].extrahp := strtoint(accountdata[aextrahp]);
- player[ID].dmg := strtofloat(accountdata[admg]);
- player[ID].fatalstate := accountdata[afatalstate];
- player[ID].kazistl := accountdata[akazistl];
- player[ID].soulshield := false;
- for i := 0 to skilllen-1 do begin
- player[ID].skills[i] := strtoint(skilldata[i]);
- end;
- fixskills(ID);
- setaccstatics(ID);
- player[ID].autosavecountdown := 60;
- result := ID;
- checkbots := true;
- end else writeconsole(ID,'Parola yanlis',$ffff0000);
- end else writeconsole(ID,'Hesap mevcut degil!',$ffff0000);
- end;
- function Save(ID: byte): byte;
- var tempaccountdata,tempskilldata: array of string; tempaccount: string; i: integer;
- begin
- result := 0;
- if player[ID].logged then begin
- setarraylength(tempaccountdata,acclen);
- tempaccountdata[aname] := player[ID].accname;
- tempaccountdata[apass] := player[ID].pass;
- tempaccountdata[alvl] := inttostr(player[ID].lvl);
- tempaccountdata[axp] := inttostr(player[ID].xp);
- tempaccountdata[aspts] := inttostr(player[ID].spts);
- tempaccountdata[amana] := floattostr(player[ID].mana);
- tempaccountdata[amaxmana] := inttostr(player[ID].maxmana);
- tempaccountdata[asouls] := floattostr(player[ID].souls);
- tempaccountdata[aextrahp] := inttostr(player[ID].extrahp);
- tempaccountdata[admg] := floattostr(player[ID].dmg);
- tempaccountdata[afatalstate] := player[ID].fatalstate;
- tempaccountdata[akazistl] := player[ID].kazistl;
- setarraylength(tempskilldata,skilllen);
- for i := 0 to skilllen-1 do begin
- tempskilldata[i] := inttostr(player[ID].skills[i]);
- end;
- result := ID;
- tempaccount := '';
- tempaccount := tempaccount + xjoin(tempaccountdata,'*');
- tempaccount := tempaccount + ':';
- tempaccount := tempaccount + xjoin(tempskilldata,'*');
- accounts[player[ID].accountfileindex] := tempaccount;
- accountfilechanged := true;
- end else writeconsole(ID,'Giris yapmadin!',$ffff0000);
- end;
- procedure manager_getaccount(account: string);
- var accountdata,skilldata: array of string; safename: string; i,index: integer;
- begin
- safename := getsafename(account);
- index := getaccountindex(safename);
- if index >= 0 then begin
- writeln(#2 + 'sen' + inttostr(length(accounts[index])) + #31 + accounts[index] + #4);
- end else begin
- writeln(#2 + 'mes' + inttostr(length('cannot find account')) + #31 + 'cannot find account' + #4);
- end;
- end;
- procedure manager_saveaccount(accountstr: string);
- var accname: string; index: integer;
- begin
- accname := getpiece(accountstr,'*',0);
- index := getaccountindex(accname);
- if index >= 0 then begin
- accounts[index] := accountstr;
- writeln(#2 + 'mes' + inttostr(length('saved')) + #31 + 'saved' + #4);
- end else begin
- writeln(#2 + 'mes' + inttostr(length('cannot find account')) + #31 + 'cannot find account' + #4);
- end;
- end;
- procedure Logout(ID: byte);
- var i: integer;
- begin
- player[ID].accountfileindex := -1;
- player[ID].pass := '';
- player[ID].accname := '';
- player[ID].logged := false;
- player[ID].allowbravo := false;
- player[ID].lastcommand := '';
- player[ID].lvl := 1;
- player[ID].xp := 0;
- player[ID].spts := 0;
- player[ID].mana := 0;
- player[ID].maxmana := 10;
- player[ID].souls := 1;
- player[ID].maxsouls := 10;
- player[ID].hptarget := ID;
- player[ID].hptimer := 0;
- player[ID].tempextrahp := 0;
- player[ID].soulshield := false;
- player[ID].extrahp := 0;
- player[ID].dmg := 1;
- player[ID].fatalstate := 'off';
- player[ID].kazistl := 'none';
- player[ID].turretid := -1;
- player[ID].turrettime := 0;
- player[ID].raging := false;
- player[ID].fogshield := false;
- player[ID].flamertime := 0;
- player[ID].psg.ammo := 0;
- setarraylength(player[ID].mine,0);
- for i := 0 to skilllen-1 do begin
- player[ID].skills[i] := 0;
- end;
- checkbots := true;
- end;
- procedure ChangePass(ID: byte; Newpass: string);
- begin
- if player[ID].logged then begin
- if (containsstring(player[ID].accname,'public') = false) AND (containsstring(player[ID].accname,'neg') = false) then begin
- player[ID].pass := md5string(newpass);
- save(ID);
- writeconsole(ID,'Parola suna degistirildi '+newpass,$ff00ff00);
- end else writeconsole(ID,'Hesabin sifresini degistiremezsin!',$ffff0000);
- end else writeconsole(ID,'Giris yapmadin!',$ffff0000);
- end;
- procedure Create(ID: byte; Name,Pass: string);
- var safename: string;
- begin
- safename := getsafename(name);
- if getaccountindex(safename) = -1 then begin
- logout(ID);
- player[ID].accountfileindex := totalaccounts;
- totalaccounts := totalaccounts + 1;
- setarraylength(accounts,totalaccounts);
- player[ID].accname := safename;
- player[ID].pass := md5string(pass);
- player[ID].logged := true;
- save(ID);
- end else writeconsole(ID,'Bu isim kullaniliyor, baska bir tane dene!',$ffff0000);
- end;
- function GetLvlXp(CurLvl: integer): integer;
- begin
- result := 200+(643*curlvl)+(curlvl*curlvl*18);
- end;
- procedure LevelUp(ID: byte);
- var lvlinfo: string;
- begin
- dec(player[ID].xp,getlvlxp(player[ID].lvl));
- inc(player[ID].lvl,1);
- inc(player[ID].spts,8);
- player[ID].maxmana := player[ID].maxmana + 3;
- player[ID].maxsouls := player[ID].maxsouls + 1;
- if getplayerstat(ID,'human') then begin
- inc(player[ID].extrahp,10);
- player[ID].dmg := player[ID].dmg+0.05;
- end;
- lvlinfo := '';
- lvlinfo := lvlinfo + 'Level atladin, yeni levelin '+inttostr(player[ID].lvl)+#6;
- lvlinfo := lvlinfo + '8 SP kazandin, mana ve soul duzenlendi'#6;
- lvlinfo := lvlinfo + 'Kullanilabilir beceriler icin /skills yazabilirsin';
- textbox(ID,'Level Up',lvlinfo,#6,'_','|','+',$ff339933);
- if player[ID].xp >= getlvlxp(player[ID].lvl) then levelup(ID);
- checkbots := true;
- end;
- procedure AddXp(ID: byte; Ammount: integer);
- begin
- ammount := round(inttofloat(ammount) * (1+(player[ID].souls/player[ID].maxsouls)));
- inc(player[ID].xp,ammount);
- if player[ID].xp >= getlvlxp(player[ID].lvl) then levelup(ID);
- end;
- procedure AddMana(ID: byte; Ammount: single);
- begin
- ammount := ammount * (1+(player[ID].souls/player[ID].maxsouls));
- player[ID].mana := player[ID].mana + ammount;
- if player[ID].mana > player[ID].maxmana then player[ID].mana := player[ID].maxmana;
- if player[ID].mana < 0 then player[ID].mana := 0;
- end;
- procedure AddSouls(ID: byte; Ammount: single);
- begin
- player[ID].souls := player[ID].souls + ammount;
- if player[ID].souls > player[ID].maxsouls then player[ID].souls := player[ID].maxsouls;
- if player[ID].souls < 0 then player[ID].souls := 0;
- end;
- procedure GiveSP(ID,Target: byte; Ammount: integer);
- var cursp: integer;
- begin
- cursp := player[ID].spts;
- if ID <> target then begin
- if ammount > 0 then begin
- if cursp - ammount >= 0 then begin
- if getplayerstat(target,'active') then begin
- player[target].spts := player[target].spts + ammount;
- player[ID].spts := player[ID].spts - ammount;
- textbox(ID,' SP Transfer ','You give '+tostr(ammount)+' SP to '+getplayerstat(target,'name')+#6+'You have '+tostr(player[ID].spts)+' SP left',#6,'_','|','+',$ff55aa55);
- textbox(target,' SP Transfer ',getplayerstat(ID,'name')+'gave you '+tostr(ammount)+' SP'#6'You now have '+tostr(player[target].spts)+' SP',#6,'_','|','+',$ff55aa55);
- end else writeconsole(ID,'Player ID '+tostr(target)+' is not active',$ffaa5555);
- end else writeconsole(ID,'You dont have '+tostr(ammount)+' SP',$ffaa5555);
- end else writeconsole(ID,'You cannot give negative SP',$ffaa5555);
- end else writeconsole(ID,'You cannot give SP to yourself...',$ffaa5555);
- end;
- function SkillNameByNum(Number: integer; Long: boolean): string;
- begin
- result := '';
- if number = sheal then result := 'Heal' else
- if number = snade then result := 'Nade' else
- if number = scluster then result := 'Cluster' else
- if number = svanish then result := 'Vanish' else
- if number = sturret then result := 'Turret' else
- if number = swave then result := 'Wave' else
- if number = sshield then result := 'Shield' else
- if number = sflamer then result := 'Flamer' else
- if number = scrit then if long then result := 'Critical Hit' else result := 'Crit' else
- if number = sfatalh then if long then result := 'Fatal Hit' else result := 'FatalHit' else
- if number = svamp then if long then result := 'Vampirism' else result := 'Vamp' else
- if number = slootammo then if long then result := 'Loot Ammo' else result := 'LootAmmo' else
- if number = slootitems then if long then result := 'Loot Items' else result := 'LootItems' else
- if number = ssonicburst then if long then result := 'Sonic Burst' else result := 'SonicBurst' else
- if number = ssoulshield then if long then result := 'Soul Shield' else result := 'SoulShield' else
- if number = sbulletvortex then result := 'Bulletvortex' else
- if number = srage then result := 'Rage' else
- if number = sbarret then result := 'Barret' else
- if number = spush then result := 'Push' else
- if number = sruger then result := 'Ruger' else
- if number = smine then result := 'Mine' else
- if number = spsg then result := 'PSG' else
- if number = swarp then result := 'Warp' else
- if number = sbacklash then result := 'Backlash' else
- if number = skazi then if long then result := 'Kamakazi' else result := 'Kazi' else
- if number = svulture then if long then result := 'Vulture' else result := 'Vulture' else
- if number = sfogshield then if long then result := 'Fog Shield' else result := 'FogShield' else
- if number = sreload then result := 'Reload' else
- if number = smissile then result := 'Missile';
- end;
- function SkillNumByName(Inputraw: string): integer;
- var input: string; i: byte;
- begin
- result := -1;
- input := lowercase(inputraw);
- for i := 0 to skilllen-1 do begin
- if (lowercase(skillnamebynum(i,false))=input) OR (lowercase(skillnamebynum(i,true))=input) then result := i;
- end;
- end;
- function BotNameByNum(Number: integer): string;
- begin
- result := '';
- if number = sbcopycat then result := 'Copycat';
- if number = sbdemon then result := 'Demon';
- if number = sbdoppleganger then result := 'Doppleganger';
- if number = sbeliteslicerzombie then result := 'Elite Slicer Zombie';
- if number = sbelitezombie then result := 'Elite Zombie';
- if number = sbghoul then result := 'Ghoul';
- if number = sbgrimreaper then result := 'Grim Reaper';
- if number = sbkamakazi then result := 'Kamakazi';
- if number = sbmirror then result := 'Mirror';
- if number = sbmummy then result := 'Mummy';
- if number = sbnitrokamakazi then result := 'Nitro Kamakazi';
- if number = sbrocketzombie then result := 'Rocket Zombie';
- if number = sbslicerzombie then result := 'Slicer Zombie';
- if number = sbturncoat then result := 'Turncoat';
- if number = sbvortex then result := 'Vortex';
- if number = sbzombie then result := 'Zombie';
- if number = sbxpbank then result := 'xpbank';
- end;
- function BotNumByName(Inputraw: string): integer;
- var input: string; i: byte;
- begin
- result := -1;
- input := lowercase(inputraw);
- for i := 0 to totalbots-1 do begin
- if lowercase(botnamebynum(i)) = input then result := i;
- end;
- end;
- function BotStatNameByNum(Number: integer; Long: boolean): string;
- begin
- result := '';
- if number = sbothealth then result := 'Health';
- if number = sbothealthreg then if long then result := 'Health Regen' else result := 'HPRegen';
- if number = sbotweapon then result := 'Weapon';
- if number = sbotbonus then result := 'Bonus';
- if number = sbotdmg then if long then result := 'Damage Multiplyer' else result := 'DmgM';
- if number = sbotmana then result := 'Mana';
- if number = sbotspts then result := 'SP';
- if number = sbotspc then if long then result := 'SP Chance' else result := 'SPC';
- if number = sbotminxp then if long then result := 'Minimum Xp' else result := 'MinXP';
- if number = sbotmaxxp then if long then result := 'Maximum Xp' else result := 'MaxXp';
- if number = sbotkind then result := 'Kind';
- if number = sbotwaveammount then if long then result := 'Wave Ammount' else result := 'WaveNum';
- if number = sbotwavestl then if long then result := 'Wave Style' else result := 'WaveSTL';
- if number = sbotwavespeed then if long then result := 'Wave Speed' else result := 'WaveSpeed';
- end;
- function BotStatNumByName(Inputraw: string): integer;
- var input: string; i: byte;
- begin
- result := -1;
- input := lowercase(inputraw);
- for i := 0 to sbotlen-1 do begin
- if (botstatnamebynum(i,false)=input) OR (botstatnamebynum(i,true)=input) then result := i;
- end;
- end;
- function CheckSkillName(Name: string): string;
- var i: byte; curskill: string;
- begin
- result := '';
- if (name <> '') then begin
- curskill := lowercase(name);
- for i := 0 to skilllen do if curskill = lowercase(skillnamebynum(i,false)) then result := curskill;
- end;
- end;
- function CheckBotName(Name: string): string;
- begin
- result := '';
- if (name <> '') AND (getpiece(name,'[',1) = '') then begin
- if fileexists('bots/'+name+'.bot') then result := name else result := 'Zombie';
- end;
- end;
- function FloatRandom(Min,Max: single): single;
- begin
- result := random(round(min*100000),round(max*100000))/100000;
- end;
- function Aim(const X1,Y1,X2,Y2: single) : single;
- begin if (X2 - X1)<>0 then begin if X1 > X2 then result:= arctan((y2 - y1) / (x2 - x1)) + Pi
- else result:= arctan((y2 - y1) / (x2 - x1)); end else begin if Y2 > Y1 then result:= Pi/2 + Pi/4;
- if Y2 < Y1 then result:= -Pi/2 + Pi/4; end;
- end;
- function GPH(ID: byte): integer;
- begin
- result := round(inttofloat(getplayerstat(ID,'health'))*(inttofloat(sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp)/150));
- end;
- function player_raycast(ID: byte): boolean;
- var x,y,dist: single;
- begin
- result := true;
- x := getplayerstat(ID,'x') + iif(getplayerstat(ID,'direction') = '>', 3, -3);
- y := getplayerstat(ID,'y') - 11;
- if (raycast(x,y-0.1,x,y+0.1,dist,1)=false) AND (raycast(x,y+10.5,x,y+11.5,dist,1)=false) AND (raycast(x-0.1,y,x+0.1,y,dist,1)=false) then result := false;
- end;
- procedure ShowConsumables(ID,ToShow: byte);
- var times1,maxtimes1,times2,maxtimes2: integer; manastr,soulstr: string;
- begin
- maxtimes1 := 15;
- times1 := round(maxtimes1/(player[ID].maxmana/player[ID].mana));
- maxtimes2 := 5;
- times2 := round(maxtimes2/(player[ID].maxsouls/player[ID].souls));
- if (toshow=0) OR (toshow=1) then manastr := 'Mana - ('+charmultiply('/',times1)+charmultiply('-',maxtimes1-times1)+') - '+tostr(roundto(player[ID].mana,2))+'/'+tostr(roundto(player[ID].maxmana,2));
- if (toshow=0) OR (toshow=2) then soulstr := ' Souls - ('+charmultiply('/',times2)+charmultiply('-',maxtimes2-times2)+') - '+tostr(roundto(player[ID].souls,2))+'/'+tostr(roundto(player[ID].maxsouls,2));
- writeconsole(ID,manastr+soulstr,$ff808080);
- end;
- procedure AddAmmo(ID: byte; ammo: integer);
- var fammo, buff1: integer; curwep: byte;
- begin
- curwep := getplayerstat(ID,'primary');
- if curwep <> 255 then begin
- fammo := ammo;
- buff1 := weapons[curwep][sammo];
- if fammo = 0 then fammo := 1;
- if (getplayerstat(ID,'ammo') + ammo) > buff1 then fammo := (buff1 - getplayerstat(ID,'ammo'));
- if (curwep = 5) then dec(fammo,1);
- if (getplayerstat(ID,'alive')=true) AND (fammo > 0) AND (getplayerstat(ID,'ammo') < buff1) then begin
- forceweapon(ID,curwep,getplayerstat(ID,'secondary'),getplayerstat(ID,'ammo')+fammo);
- writeconsole(ID,'Elde edildi -:- ' + inttostr(fammo) + ' mermi',$ff5555ff);
- end;
- end;
- end;
- function ScaleNumber(Value,Max,Tmax: integer): integer;
- begin
- result := round((inttofloat(value)*(max/inttofloat(tmax))));
- end;
- procedure AllDraw(ID: byte);
- var hp,hp2,hpam,flamerdraw,turretdraw,ragedraw,psgdraw: string; times,timesvest,maxtimes: integer;
- begin
- hp := '';
- hp2 := '';
- if player[ID].hptimer > 0 then if sbot[player[ID].hptarget].health > 0 then begin
- maxtimes := 15;
- times := round(inttofloat(maxtimes)/(inttofloat((sbot[player[ID].hptarget].maxhealth+player[player[ID].hptarget].extrahp+player[player[ID].hptarget].tempextrahp))/inttofloat(sbot[player[ID].hptarget].health)));
- if getplayerstat(player[ID].hptarget,'vest') > 0 then timesvest := round((maxtimes div 2)/(100/inttofloat(getplayerstat(player[ID].hptarget,'vest'))));
- hp := ' '+(getplayerstat(player[ID].hptarget,'name')+' : ('+charmultiply('/',times)+charmultiply('-',maxtimes-times)+')'+iif(timesvest>0,' - ('+charmultiply('/',timesvest)+charmultiply('-',(maxtimes div 2)-timesvest)+')',''));
- hpam := inttostr(sbot[player[ID].hptarget].health)+'/'+inttostr(player[player[ID].hptarget].extrahp+player[player[ID].hptarget].tempextrahp+sbot[player[ID].hptarget].maxhealth);
- hp2 := ' '+charmultiply(' ',(inttofloat(length(hp)) div 2)-(inttofloat(length(hpam)) div 2))+hpam;
- end;
- if player[ID].psg.ammo > 0 then psgdraw := ('PSG: ' + inttostr(player[ID].psg.ammo)) else psgdraw := '';
- if player[ID].turrettime > 0 then turretdraw := ('Turret: ' + inttostr(player[ID].turrettime)) else turretdraw := '';
- if player[ID].flamertime > 0 then flamerdraw := ('Flamer: ' + inttostr(player[ID].flamertime)) else flamerdraw := '';
- DrawText(ID,' Level: '+inttostr(player[ID].lvl)+chr(10)+' XP: '+inttostr(player[ID].xp)+'/'+inttostr(getlvlxp(player[ID].lvl))+hp+chr(13)+chr(10)+' Mana: '+tostr(roundto(player[ID].mana,2))+'/'+tostr(roundto(player[ID].maxmana,2))+hp2+chr(13)+chr(10)+' Souls: '+tostr(roundto(player[ID].souls,2))+'/'+tostr(roundto(player[ID].maxsouls,2))+chr(13)+chr(10)+charmultiply(' ',5)+flamerdraw+charmultiply(' ',18-length(flamerdraw))+turretdraw+charmultiply(' ',18-length(psgdraw))+psgdraw,300,$ffffffff,0.06,15,350);
- end;
- procedure SetPlayerHealth(ID: byte; Health,Vest: integer; RecalcHealth: boolean);
- var chealth,cvest,delta,failsafe: integer;
- begin
- chealth := getplayerstat(ID,'health');
- cvest := getplayerstat(ID,'vest');
- if recalchealth then sbot[ID].health := round(health*(inttofloat(sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp)/150));
- if (chealth=health) AND (cvest=vest) then exit;
- if chealth = 0 then dodamage(ID,1000);
- if vest = 0 then begin
- failsafe := 0;
- while(cvest > 0) do begin
- sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
- dodamage(ID,2);
- cvest := cvest - 1;
- failsafe := failsafe + 1;
- if failsafe > 300 then break;
- end;
- sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
- dodamage(ID,chealth-health);
- exit;
- end else begin
- if cvest = 0 then begin
- givebonus(ID,3);
- cvest := 100;
- end;
- failsafe := 0;
- while(chealth <> health) do begin
- sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
- if chealth < health then delta := -1 else delta := 1;
- dodamage(ID,3*delta);
- chealth := chealth - delta;
- cvest := wrapvalue(cvest - delta,0,100,true);
- if cvest = 0 then begin
- givebonus(ID,3);
- cvest := 100;
- end;
- if cvest <> vest then begin
- sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
- if cvest < vest then delta := -1 else delta := 1;
- dodamage(ID,2*delta);
- cvest := cvest - delta;
- end;
- failsafe := failsafe + 1;
- if failsafe > 300 then break;
- end;
- failsafe := 0;
- while(cvest <> vest) do begin
- sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
- if cvest < vest then delta := -1 else delta := 1;
- dodamage(ID,2*delta);
- cvest := cvest - delta;
- failsafe := failsafe + 1;
- if failsafe > 300 then break;
- end;
- exit;
- end;
- givebonus(ID,3);
- cvest := 100;
- failsafe := 0;
- while(cvest > vest) do begin
- sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
- dodamage(ID,2);
- cvest := cvest - 1;
- if failsafe > 600 then break;
- end;
- end;
- procedure SyncHealth(ID: byte);
- var chealth,rhealth: integer;
- begin
- if getplayerstat(ID,'human') then begin
- chealth := getplayerstat(ID,'health');
- if chealth <= 0 then exit;
- if sbot[ID].health <= 0 then begin
- sbot[ID].flatdamage := sbot[ID].flatdamage + 1;
- dodamageby(ID,sbot[ID].lastshooter,chealth);
- exit;
- end;
- rhealth := scalenumber(sbot[ID].health,150,player[ID].extrahp+player[ID].tempextrahp+sbot[ID].maxhealth);
- if chealth = rhealth then exit;
- if rhealth = 0 then rhealth := 1;
- setplayerhealth(ID,rhealth,getplayerstat(ID,'vest'),false);
- end;
- end;
- procedure AddHealth(ID,Shooter: byte; Ammount: integer);
- begin
- sbot[ID].lastshooter := shooter;
- sbot[ID].health := min([sbot[ID].health+ammount,sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp]);
- synchealth(ID);
- end;
- procedure TimeHeal(ID: byte);
- var health: byte;
- begin
- if getplayerstat(ID,'alive') then begin
- if getplayerstat(ID,'human') then begin
- health := getplayerstat(ID,'health');
- if health = 150 then begin
- sbot[ID].health := sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp;
- end;
- end else addhealth(ID,ID,sbot[ID].healthreg);
- end;
- end;
- procedure DeathExplode(ID: byte);
- var i: integer;
- begin
- if sbot[ID].waveammount > 0 then for i := 1 to sbot[ID].waveammount do createbullet(getplayerstat(ID,'x'),getplayerstat(ID,'y')-11,floatrandom(-sbot[ID].wavespeed,sbot[ID].wavespeed),floatrandom(-sbot[ID].wavespeed,sbot[ID].wavespeed),100,sbot[ID].wavestl,ID);
- end;
- procedure BWave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
- var i: integer; angle,centerX,centerY: single;
- begin centerX:=X-cos(Direction)*Radius; centerY:=Y-sin(Direction)*Radius; angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
- for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
- end;
- procedure BulletCircle(X,Y,Radius,Speed: single; Bullets: integer; BulletStyle,Owner: byte);
- var i: integer; thea,s,c,xm,ym,xspeed,yspeed: single;
- begin
- for i := 1 to bullets do begin
- thea := i*(pi*2.0/bullets);
- c := cos(thea);
- s := sin(thea);
- xm := radius * c;
- ym := radius * s;
- xspeed := speed * c;
- yspeed := speed * s;
- createbullet(x-xm,y-ym,xspeed,yspeed,5,bulletstyle,owner);
- end;
- end;
- procedure DirBullet(sx,sy,dx,dy,speed,damage: single; bulletstyle,owner: byte);
- var dist,xx,yy,vx,vy,k: single;
- begin
- xx := sx - dx;
- yy := sy - dy;
- dist := sqrt((xx*xx)+(yy*yy));
- if dist > 0 then begin
- k := speed / dist;
- vx := (dx - sx) * k;
- vy := (dy - sy) * k;
- createbullet(sx,sy,vx,vy,damage,bulletstyle,owner);
- end;
- end;
- procedure DoSdmg(BotID,HumanID: byte; Damage: integer);
- var dmgtd: integer; wep: byte;
- begin
- wep := getplayerstat(humanid,'primary');
- if (wep = 7) OR (wep = 16) then exit;
- dmgtd := round(damage*0.1*sbot[botid].dmg);
- if sbot[humanid].health-dmgtd <= 0 then dmgtd := sbot[humanid].health - 1;
- addhealth(humanid,botid,-dmgtd);
- end;
- procedure DoCopyCat(Killer,Victim: byte);
- var wep: byte;
- begin
- wep := getplayerstat(victim,'primary');
- if (wep <> 255) then sbot[killer].weapon := wep;
- end;
- procedure DoVamp(ID: byte; Damage: integer);
- var heal: integer; mult: single;
- begin
- if damage <= 0 then exit;
- mult := skills[svamp][player[ID].skills[svamp]].specfloat1;
- heal := round((damage*mult)+0.6);
- addhealth(ID,ID,heal);
- end;
- procedure MirrorBullet(ID, Target: byte);
- var bulstl,tarwep: byte; bulspeed,damage,x1,y1,x2,y2: single;
- begin
- tarwep := getplayerstat(target,'primary');
- if (tarwep >= 0) AND (tarwep <= 16) then begin
- bulstl := weapons[tarwep][sbulletstyle];
- x1 := getplayerstat(ID,'x');
- y1 := getplayerstat(ID,'y')-11;
- x2 := getplayerstat(target,'x');
- y2 := getplayerstat(target,'y')-11;
- damage := 3;
- if bulstl = 12 then begin
- //damage := damage * 5;
- bulspeed := bulspeed * 3;
- end;
- if bulstl = 1 then bulstl := 14;
- bulspeed := inttofloat(weapons[tarwep][sspeed])*0.06;
- dirbullet(x1,y1,x2,y2,bulspeed,damage,bulstl,ID);
- end;
- end;
- procedure DoLootAmmo(ID: byte);
- var maxam,ammo: integer; curwep: byte;
- begin
- curwep := getplayerstat(ID,'primary');
- if (curwep >= 0) AND (curwep <= 16) then if chance(skills[slootammo][player[ID].skills[slootammo]].specfloat1) then begin
- maxam := weapons[curwep][sammo];
- ammo := round(maxam/5)+random(1,round(maxam/4));
- addammo(ID,ammo);
- end;
- end;
- procedure DoBacklash(ID,Target: byte);
- begin
- if player[ID].mana >= skills[sbacklash][player[ID].skills[sbacklash]].mcost then if player[ID].souls >= skills[sbacklash][player[ID].skills[sbacklash]].scost then begin
- bwave(getplayerstat(ID,'x'),getplayerstat(ID,'y'),aim(getplayerstat(ID,'x'),getplayerstat(ID,'y'),getplayerstat(target,'x'),getplayerstat(target,'y')),3,1,8,2,0.5,1,14,skills[sbacklash][player[ID].skills[sbacklash]].specint1,ID);
- dirbullet(getplayerstat(ID,'x'),getplayerstat(ID,'y')-11,getplayerstat(target,'x'),getplayerstat(target,'y')-11,25,6,14,ID);
- writeconsole(ID,'Backlash',$ffff0000);
- player[ID].mana := player[ID].mana - skills[sbacklash][player[ID].skills[sbacklash]].mcost;
- player[ID].souls := player[ID].souls - skills[sbacklash][player[ID].skills[sbacklash]].scost;
- player[ID].canbacklash := false;
- end;
- end;
- function DoSoulShield(ID: byte; Dmg: integer): boolean;
- var scost: single;
- begin
- result := false;
- dmg := round(inttofloat(dmg)*(inttofloat(sbot[ID].maxhealth+player[ID].extrahp+player[ID].tempextrahp)/150));
- scost := inttofloat(dmg)*skills[ssoulshield][player[ID].skills[ssoulshield]].specfloat1;
- if player[ID].souls > scost then begin
- result := true;
- player[ID].souls := player[ID].souls - scost;
- showconsumables(ID,2);
- end else begin
- player[ID].soulshield := false;
- writeconsole(ID,'You have run out of souls to bear your damage',$ff5555ff);
- end;
- end;
- function DoFogShield(ID: byte; Dmg: integer): boolean;
- var scost: single;
- begin
- result := false;
- result := chance(player[ID].fogshieldchance);
- if result then begin
- player[ID].fogshieldchance := player[ID].fogshieldchance - skills[sfogshield][player[ID].skills[sfogshield]].specfloat2;
- writeconsole(ID,'You have been missed due to your etherial form',$ff5555ff);
- writeconsole(ID,'Your miss chance is now ' + floattostr(roundto(player[ID].fogshieldchance*100.0,2)) + '%',$ff5555ff);
- end;
- end;
- procedure GivePower(ID: byte);
- var power: byte; hp: integer;
- begin
- try
- power := sbot[ID].bonus;
- if power = 1 then hp := getplayerstat(ID,'health');
- if power <> 255 then begin
- givebonus(ID,power);
- //if power = 1 then setplayerhealth(ID,hp,getplayerstat(ID,'vest'),false);
- end;
- except end;
- end;
- function RangePlayer(Team: byte; X1,Y1,MinDist,MaxDist: single; TypeState: byte; UseRaycast: boolean): byte;
- var i: byte; cands: array of byte; dst, raydist, x2,y2: single;
- begin
- for i := 1 to 32 do if getplayerstat(i,'active')=true then begin
- x2 := getplayerstat(i,'x');
- y2 := getplayerstat(i,'y');
- dst:=distance(X1,Y1,X2,Y2);
- if (dst>=mindist) AND (dst<=maxdist) AND (getplayerstat(i,'alive')=true) AND ((getplayerstat(i,'team')<>team) OR (team=0) OR (team=5)) AND ((((useraycast=true) AND (raycast(x1,y1,x2,y2,raydist,round(maxdist))=true)) OR (useraycast=false))) AND (((typestate=1) AND (getplayerstat(i,'human')=true)) OR ((typestate=2) AND (getplayerstat(i,'human')=false)) OR (typestate=0)) then begin
- setarraylength(cands,getarraylength(cands)+1);
- cands[getarraylength(cands)-1] := i;
- end;
- end;
- if getarraylength(cands)>1 then result := cands[random(0,getarraylength(cands))] else result := 0
- end;
- function NearestPlayer(Team: byte; X1,Y1,MinDist,MaxDist: single; TypeState: byte; UseRaycast: boolean): byte;
- var i,curlow: byte; x2, y2, curdst, lowdist, raydist: single;
- begin
- lowdist := maxdist+1;
- result := 0;
- for i := 1 to 32 do if getplayerstat(i,'active')=true then begin
- x2 := getplayerstat(i,'x');
- y2 := getplayerstat(i,'y');
- curdst:=distance(X1,Y1,X2,Y2);
- if (curdst>=mindist) AND (curdst<=maxdist) AND (getplayerstat(i,'alive')=true) AND ((getplayerstat(i,'team')<>team) OR (team=0) OR (team=5)) AND ((((useraycast=true) AND (raycast(x1,y1,x2,y2,raydist,round(maxdist))=true)) OR (useraycast=false))) AND (((typestate=1) AND (getplayerstat(i,'human')=true)) OR ((typestate=2) AND (getplayerstat(i,'human')=false)) OR (typestate=0)) then begin
- if curdst < lowdist then begin
- curlow := i;
- lowdist := curdst;
- end;
- end;
- end;
- result := curlow;
- end;
- function GetInfo(Filename, Key: string): array of string;
- var infofile: array of string; curstr: string; i,l,endln,startln: integer;
- begin
- infofile := explode(readfile('scripts/zrpgevolved/'+filename),(chr(13)+chr(10)));
- startln := getstringindex('['+key+']',infofile);
- if startln >= 0 then begin
- l := startln+1;
- repeat
- inc(l,1);
- until (getpiece(getpiece(infofile[l],'[',1),']',0) <> '') OR (l = (getarraylength(infofile)-1));
- endln := l;
- setarraylength(result,endln-startln+2);
- for i := startln to endln-1 do begin
- curstr := getpiece(getpiece(infofile[i],'[',1),']',0);
- if curstr = '' then begin
- result[i-startln] := infofile[i];
- end;
- end;
- end;
- end;
- procedure ShowSkillInfo(ID: byte; SkillStrRaw: string);
- var skill,arylen,i,ii,maxlvl,col,max,head,vars,curpos: integer; skillinfo,output: array of string; str,val: string; rows: array of array of string;
- begin
- skill := skillnumbyname(skillstrraw);
- if skill >= 0 then begin
- maxlvl := getarraylength(skills[skill])-1;
- skillinfo := getinfo('info/skillinfo.txt',lowercase(skillnamebynum(skill,false)));
- arylen := getarraylength(skillinfo);
- setarraylength(rows,maxlvl);
- setarraylength(output,arylen+6+maxlvl);
- head := -1;
- for i := 0 to arylen-1 do begin
- if getpiece(skillinfo[i],'@head',1) <> '' then begin
- skillinfo[i] := getpiece(skillinfo[i],'@head',1);
- head := i;
- end;
- if getpiece(skillinfo[i],'@vars',1) <> '' then begin
- skillinfo[i] := getpiece(skillinfo[i],'@vars',1);
- vars := i;
- end;
- if ((i < head) OR (head = -1)) AND (skillinfo[i] <> '') then begin
- output[curpos] := '|'+skillinfo[i]; inc(curpos,1);
- end;
- end;
- for i := 0 to curpos do begin
- if max < length(output[i]) then max := length(output[i]);
- end;
- for i := 0 to curpos do begin
- output[i] := output[i]+charmultiply(' ',max-length(output[i]))+'|';
- end;
- col := containsnum(skillinfo[head],'|');
- output[curpos] := '+'+charmultiply('_',max-1)+'/'; inc(curpos,1);
- output[curpos] := '+'+charmultiply('-',length(skillinfo[head]))+'+'; inc(curpos,1);
- output[curpos] := '|'+skillinfo[head]+'|'; inc(curpos,1);
- for i := 0 to maxlvl-1 do begin
- setarraylength(rows[i],col+1);
- end;
- for i := 0 to maxlvl-1 do begin
- for ii := 0 to col do begin
- str := getpiece(getpiece(skillinfo[vars],'|',ii),'%',1);
- if str <> '' then begin
- if str = 'SP' then val := tostr(skills[skill][i+1].cost);
- if str = 'MANA' then val := tostr(roundto(skills[skill][i+1].mcost,3));
- if str = 'SOUL' then val := tostr(roundto(skills[skill][i+1].scost,3));
- if str = 'SI1' then val := tostr(skills[skill][i+1].specint1);
- if str = 'SI2' then val := tostr(skills[skill][i+1].specint2);
- if str = 'SF1' then val := tostr(roundto(skills[skill][i+1].specfloat1,3));
- if str = 'SF2' then val := tostr(roundto(skills[skill][i+1].specfloat2,3));
- if str = 'ML' then val := tostr(skills[skill][i+1].minlvl);
- if str = 'CD' then val := tostr(skills[skill][i+1].cooldown);
- if str = 'LVL' then val := tostr(i+1);
- rows[i][ii] := val;
- end
- end;
- end;
- for i := 0 to maxlvl-1 do begin
- output[i+curpos] := '|';
- for ii := 0 to col do begin
- max := length(getpiece(skillinfo[head],'|',ii));
- if max > 0 then begin
- output[i+curpos] := output[i+curpos]+charmultiply(' ',(max-length(rows[i][ii])) div 2)+rows[i][ii]+charmultiply(' ',((max-length(rows[i][ii]))+0.4) div 2)+'|';
- end
- end;
- end;
- inc(curpos,maxlvl);
- output[curpos] := '+'+charmultiply('-',length(skillinfo[head]))+'+'; inc(curpos,1);
- textbox(ID,' '+skillnamebynum(skill,true)+' ',xjoin(output,#6),#6,'_','|','+',$ff44cc44);
- end else textbox(ID,' Error ','You must enter a skill to get info'#6'For example /skillinfo heal would give info on the skill heal',#6,'_','|','+',$ffcc4444);
- end;
- procedure LearnSkill(ID: byte; SkillStrRaw: string);
- var output: string; skill,curlvl: integer; color: longint;
- begin
- skill := skillnumbyname(skillstrraw);
- if skill = smissile then begin
- writeconsole(ID,'Sorry, missile is disabled at the moment',$ffffffff);
- exit;
- end;
- output := '';
- color := $ffcc4444;
- if skill >= 0 then begin
- curlvl := player[ID].skills[skill];
- if curlvl < getarraylength(skills[skill])-1 then begin
- if player[ID].lvl >= skills[skill][curlvl+1].minlvl then begin
- if player[ID].spts >= skills[skill][curlvl+1].cost then begin
- dec(player[ID].spts,skills[skill][curlvl+1].cost);
- inc(player[ID].skills[skill],1);
- color := $ff44cc44;
- output := output + 'Ogrendin '+skillnamebynum(skill,true)+', level '+inttostr(curlvl+1) + #6;
- output := output + 'Skillpoints left - '+inttostr(player[ID].spts) + #6;
- end else output := output + 'You do not have enough SP, needed have '+inttostr(skills[skill][curlvl+1].cost)+', you have '+inttostr(player[ID].spts) + #6;
- end else output := output + 'Yeterli seviyede degilsin, en az - '+inttostr(skills[skill][curlvl+1].minlvl) + #6;
- end else output := output + skillnamebynum(skill,true)+' becerin maksimum seviyede' + #6;
- textbox(ID,' Learn Skill ',output,#6,'_','|','+',color);
- end;
- end;
- procedure UseSkill(ID: byte; SkillStrRaw: string);
- var output: string; skill, curlvl: integer; oldmana,oldsouls: single; color: longint;
- begin
- skill := skillnumbyname(skillstrraw);
- output := '';
- color := $ffcc4444;
- if skill >= 0 then begin
- curlvl := player[ID].skills[skill];
- if curlvl > 0 then begin
- if getplayerstat(I
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement