unit Uutils;
interface
uses
Inifiles,Classes,SysUtils,ComCtrls,
JobCommon,Misc,Dialogs,Math;
const
StrIniJobDataIdent : array[0..8] of string = ('JDHp','JDAp','JDAttack',
'JDMagic','JDHit','JDEvasion','JDCritical',
'JDRhp','JDRap');
function Lvcheck(Lv : integer):boolean;
function CommaTexttoArray(CText : String) : TDoubleDynArray;
procedure WriteIniFormStatus(TargetIni : TMemIniFile; frTop,frLeft:integer;
opLvI:boolean);
procedure ReadIniFormStatus(TargetIni : TMemIniFile; var frTop,frLeft:integer;
var opLvI:boolean);
procedure WriteIniJobClassData(TargetIni : TMemIniFile; Jobclass : TjobClass);
procedure WriteSectionValues(TargetIni : TMemIniFile;const Section: String; Strings: TStrings);
procedure ReadIniJobClassData(TargetIni : TMemIniFile; Jobclass : TjobClass);
implementation
procedure WriteIniJobClassData(TargetIni : TMemIniFile; jobclass : TjobClass);
begin
end;
procedure WriteSectionValues(TargetIni : TMemIniFile;const Section: String; Strings: TStrings);
begin
end;
procedure ReadIniJobClassData(TargetIni : TMemIniFile; Jobclass : TjobClass);
var
IniTmp : TStringList;
i : integer;
arraytmp : TDoubleDynArray;
valueTmp : string;
begin
IniTmp := TStringList.Create;
SetLength(arraytmp,5);
try
TargetIni.ReadSectionValues(Jobclass.ClassName,IniTmp);
for i:=Low(StrIniJobDataIdent) to High(StrIniJobDataIdent) do
begin
valueTmp := IniTmp.Values[StrIniJobDataIdent[i]];
if valueTmp <> '' then
begin
arraytmp := CommaTexttoArray(valueTmp);
Jobclass.SetJobDatas(TJobOption(i),
arraytmp[0],arraytmp[1],arraytmp[2],arraytmp[3],arraytmp[4]);
end;
arraytmp := nil;
end;
finally
IniTmp.Free;
end;
end;
procedure ReadIniFormStatus(TargetIni : TMemIniFile; var frTop,frLeft:integer;
var opLvI:boolean);
begin
frTop := TargetIni.ReadInteger('Form','Top',-1);
frLeft := TargetIni.ReadInteger('Form','Left',-1);
opLvI := TargetIni.ReadBool('Form','opLvI',True);
end;
procedure WriteIniFormStatus(TargetIni : TMemIniFile; frTop,frLeft:integer;
opLvI:boolean);
begin
TargetIni.WriteInteger('Form','Top',frTop);
TargetIni.WriteInteger('Form','Left',frLeft);
TargetIni.WriteBool('Form','opLvI',opLvI);
end;
function CommaTexttoArray(CText : String) : TDoubleDynArray;
var
StrList : TStringlist;
i : integer;
begin
StrList := TStringlist.Create;
try
StrList.CommaText := CText;
SetLength(Result,StrList.Count);
for i:=Low(Result) to High(Result) do
begin
try
if Trim(StrList.Strings[i]) <> '' then
begin
if CompareText(Trim(StrList.Strings[i]),'null')=0 then
Result[i] := -1
else
Result[i] := StrToFloat(Trim(StrList.Strings[i]));
end;
except
Result[i] := -255;
end;
end;
finally
StrList.Free;
end;
end;
function Lvcheck(Lv : integer):boolean;
begin
Result := True;
if Lv < 10 then
begin
Result := False;
end;
end;
end.