📄 fusionsql.pas
字号:
tc.Head2 := StrToInt(SQLDataSet.FieldValues['Head2']);
tc.Head3 := StrToInt(SQLDataSet.FieldValues['Head3']);
tc.HairColor := StrToInt(SQLDataSet.FieldValues['HairColor']);
tc.ClothesColor := StrToInt(SQLDataSet.FieldValues['ClothesColor']);
tc.ParamBase[0] := StrToInt(SQLDataSet.FieldValues['STR']);
tc.ParamBase[1] := StrToInt(SQLDataSet.FieldValues['AGI']);
tc.ParamBase[2] := StrToInt(SQLDataSet.FieldValues['VIT']);
tc.ParamBase[3] := StrToInt(SQLDataSet.FieldValues['INTS']);
tc.ParamBase[4] := StrToInt(SQLDataSet.FieldValues['DEX']);
tc.ParamBase[5] := StrToInt(SQLDataSet.FieldValues['LUK']);
tc.CharaNumber := StrToInt(SQLDataSet.FieldValues['CharaNumber']);
tc.Map := (SQLDataSet.FieldValues['Map']);
tc.Point.X := StrToInt(SQLDataSet.FieldValues['X']);
tc.Point.Y := StrToInt(SQLDataSet.FieldValues['Y']);
tc.SaveMap := (SQLDataSet.FieldValues['SaveMap']);
tc.SavePoint.X := StrToInt(SQLDataSet.FieldValues['SX']);
tc.SavePoint.Y := StrToInt(SQLDataSet.FieldValues['SY']);
tc.Plag := StrToInt(SQLDataSet.FieldValues['Plag']);
tc.PLv := StrToInt(SQLDataSet.FieldValues['PLv']);
tc.PartyName := '';
tc.ID := StrToInt(SQLDataSet.FieldValues['AID']);
for i := 0 to 2 do begin
if (SQLDataSet.FieldByName('mapName' + inttostr(i)).IsNull) then continue;
tc.MemoMap[i] := (SQLDataSet.FieldValues['mapName' + IntToStr(i)]);
tc.MemoPoint[i].X := StrToInt(SQLDataSet.FieldValues['xPos' + IntToStr(i)]);
tc.MemoPoint[i].Y := StrToInt(SQLDataSet.FieldValues['yPos' + IntToStr(i)]);
if (tc.MemoMap[i] <> '') and (MapList.IndexOf(tc.MemoMap[i]) = -1) then begin
debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('%s : Invalid MemoMap%d "%s"', [tc.Name, i, tc.MemoMap[i]]));
tc.MemoMap[i] := '';
tc.MemoPoint[i].X := 0;
tc.MemoPoint[i].Y := 0;
end else if (tc.MemoMap[i] <> '') then begin
ta := MapList.Objects[MapList.IndexOf(tc.MemoMap[i])] as TMapList;
if (tc.MemoPoint[i].X < 0) or (tc.MemoPoint[i].X >= ta.Size.X) or (tc.MemoPoint[i].Y < 0) or (tc.MemoPoint[i].Y >= ta.Size.Y) then begin
debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('%s : Invalid MemoMap%d Point "%s"[%dx%d] (%d,%d)', [tc.Name, i, tc.MemoMap[i], ta.Size.X, ta.Size.Y, tc.MemoPoint[i].X, tc.MemoPoint[i].Y]));
tc.MemoMap[i] := '';
tc.MemoPoint[i].X := 0;
tc.MemoPoint[i].Y := 0;
end;
end;
end;
if (tc.CID < 100001) then tc.CID := tc.CID + 100001;
if MapList.IndexOf(tc.Map) = -1 then begin
debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('%s : Invalid Map "%s"', [tc.Name, tc.Map]));
tc.Map := 'prontera';
tc.Point.X := 158;
tc.Point.Y := 189;
end;
ta := MapList.Objects[MapList.IndexOf(tc.Map)] as TMapList;
if (tc.Point.X < 0) or (tc.Point.X >= ta.Size.X) or (tc.Point.Y < 0) or (tc.Point.Y >= ta.Size.Y) then begin
debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('%s : Invalid Map Point "%s"[%dx%d] (%d,%d)',[tc.Name, tc.Map, ta.Size.X, ta.Size.Y, tc.Point.X, tc.Point.Y]));
tc.Map := 'prontera';
tc.Point.X := 158;
tc.Point.Y := 189;
end;
if MapList.IndexOf(tc.SaveMap) = -1 then begin
debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('%s : Invalid SaveMap "%s"', [tc.Name, tc.SaveMap]));
tc.SaveMap := 'prontera';
tc.SavePoint.X := 158;
tc.SavePoint.Y := 189;
end;
ta := MapList.Objects[MapList.IndexOf(tc.SaveMap)] as TMapList;
if (tc.SavePoint.X < 0) or (tc.SavePoint.X >= ta.Size.X) or (tc.SavePoint.Y < 0) or (tc.SavePoint.Y >= ta.Size.Y) then begin
debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('%s : Invalid SaveMap Point "%s"[%dx%d] (%d,%d)', [tc.Name, tc.SaveMap, ta.Size.X, ta.Size.Y, tc.SavePoint.X, tc.SavePoint.Y]));
tc.SaveMap := 'prontera';
tc.SavePoint.X := 158;
tc.SavePoint.Y := 189;
end;
for i := 0 to MAX_SKILL_NUMBER do begin
if SkillDB.IndexOf(i) <> -1 then begin
tc.Skill[i].Data := SkillDB.IndexOfObject(i) as TSkillDB;
end;
end;
if (tc.Plag <> 0) then begin
tc.Skill[tc.Plag].Plag := true;
end;
sl.Clear;
sl.DelimitedText := SQLDataSet.FieldValues['skillInfo'];
for i := 0 to ((sl.Count div 2) - 1) do begin
if (SkillDB.IndexOf(strtoint(sl.Strings[0+i*2])) <> -1) then begin
tc.Skill[strtoint(sl.Strings[0+i*2])].Lv := strtoint(sl.Strings[1+i*2]);
tc.Skill[strtoint(sl.Strings[0+i*2])].Card := false;
tc.Skill[strtoint(sl.Strings[0+i*2])].Plag := false;
end;
end;
sl.Clear;
sl.DelimitedText := SQLDataSet.FieldValues['equipItem'];
for i := 0 to ((sl.Count div 10) - 1) do begin
tc.Item[i+1].ID := strtoint(sl.Strings[0+i*10]);
tc.Item[i+1].Amount := strtoint(sl.Strings[1+i*10]);
tc.Item[i+1].Equip := strtoint(sl.Strings[2+i*10]);
tc.Item[i+1].Identify := strtoint(sl.Strings[3+i*10]);
tc.Item[i+1].Refine := strtoint(sl.Strings[4+i*10]);
tc.Item[i+1].Attr := strtoint(sl.Strings[5+i*10]);
tc.Item[i+1].Card[0] := strtoint(sl.Strings[6+i*10]);
tc.Item[i+1].Card[1] := strtoint(sl.Strings[7+i*10]);
tc.Item[i+1].Card[2] := strtoint(sl.Strings[8+i*10]);
tc.Item[i+1].Card[3] := strtoint(sl.Strings[9+i*10]);
tc.Item[i+1].Data := ItemDB.Objects[ItemDB.IndexOf(tc.Item[i+1].ID)] as TItemDB;
end;
sl.Clear;
sl.DelimitedText := SQLDataSet.FieldValues['cartitem'];
for i := 0 to ((sl.Count div 10) - 1) do begin
tc.Cart.Item[i+1].ID := strtoint(sl.Strings[0+i*10]);
tc.Cart.Item[i+1].Amount := strtoint(sl.Strings[1+i*10]);
tc.Cart.Item[i+1].Equip := strtoint(sl.Strings[2+i*10]);
tc.Cart.Item[i+1].Identify := strtoint(sl.Strings[3+i*10]);
tc.Cart.Item[i+1].Refine := strtoint(sl.Strings[4+i*10]);
tc.Cart.Item[i+1].Attr := strtoint(sl.Strings[5+i*10]);
tc.Cart.Item[i+1].Card[0] := strtoint(sl.Strings[6+i*10]);
tc.Cart.Item[i+1].Card[1] := strtoint(sl.Strings[7+i*10]);
tc.Cart.Item[i+1].Card[2] := strtoint(sl.Strings[8+i*10]);
tc.Cart.Item[i+1].Card[3] := strtoint(sl.Strings[9+i*10]);
tc.Cart.Item[i+1].Data := ItemDB.Objects[ItemDB.IndexOf(tc.Cart.Item[i+1].ID)] as TItemDB;
end;
sl.Clear;
sl.DelimitedText := SQLDataSet.FieldValues['flagdata'];
for i := 0 to (sl.Count - 1) do begin
tc.Flag.Add(sl.Strings[i]);
end;
if (addkey) then begin
CharaName.AddObject(tc.Name, tc);
Chara.AddObject(tc.CID, tc);
end;
Load_Accounts('', tc.ID);
if (Player.IndexOf(tc.ID) <> -1) then begin
tp := Player.Objects[Player.IndexOf(tc.ID)] as TPlayer;
tp.CID[tc.CharaNumber] := tc.CID;
tp.CName[tc.CharaNumber] := tc.Name;
tp.CData[tc.CharaNumber] := tc;
tp.CData[tc.CharaNumber].Gender := tp.Gender;
end;
end;
end;
sl.Free;
end;
function Load_Parties(GID: cardinal) : Boolean;
const
MEMBERID_OFFSET = 4;
var
i : Integer;
MIdx : Integer; //MemberID Iterator
query : string;
tpa : TParty;
tc : TChara;
addkey : Boolean;
begin
Result := False;
addkey := True;
query := 'SELECT * FROM party where MemberID0 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID1= '+ '''' + inttostr(GID) + '''' + ' OR MemberID2 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID3 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID4 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID5 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID6 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID7 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID8 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID9 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID10 = '+ '''' + inttostr(GID) + '''' + ' OR MemberID11 = '+ '''' + inttostr(GID) + '''';
if (MySQL_Query (query)) then begin
if SQLDataSet.FieldByName('Name').IsNull then begin
end else begin
tpa := TParty.Create;
with tpa do begin
Name := (SQLDataSet.FieldValues['Name']);
if assigned (PartyNameList) then begin
if (PartyNameList.IndexOf(tpa.Name) <> -1) then begin
tpa := PartyNameList.Objects[PartyNameList.IndexOf(tpa.Name)] as TParty;
addkey := False;
end;
end;
EXPShare := StrToBool(SQLDataSet.FieldValues['EXPShare']);
ITEMShare := StrToBool(SQLDataSet.FieldValues['ITEMShare']);
{ChrstphrR 2004/05/31 - changing code here to avoid using variants,
since FieldValues[] returns a variant type, which is much slower to use
and access vs more direct methods - esp. when we're querying a larger
list...}
for MIdx := Low(MemberID) to High(MemberID) do
begin
MemberID[MIdx] := SQLDataSet.Fields[MIdx+MEMBERID_OFFSET].AsInteger;
end;
// MemberID[0] := StrToInt(SQLDataSet.FieldValues['MemberID0']);
end;
if (addkey) then begin
PartyNameList.AddObject(tpa.Name, tpa);
debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('Add Party Name : %s.', [tpa.Name]));
end;
tc := Chara.Objects[Chara.IndexOf(GID)] as TChara;
for i := 0 to 11 do begin
if (tpa.MemberID[i] <> 0) AND (tpa.MemberID[i] = tc.CID) then begin
tpa := PartyNameList.Objects[PartyNameList.IndexOf(tpa.Name)] as TParty;
tc.PartyName := tpa.Name;
tpa.Member[i] := tc;
break;
end;
end;
end;
end;
Result := True;
end;
function Load_Pets(AID: cardinal) : Boolean;
var
tpe : TPet;
tp : TPlayer;
tc : TChara;
query : string;
i : integer;
addkey : Boolean;
begin
Result := False;
addkey := True;
query := 'SELECT * FROM pet WHERE PlayerID = '' '+inttostr(AID)+'''';
if (MySQL_Query(query)) then begin
while not SQLDataSet.Eof do begin
i := PetDB.IndexOf(strtoint(SQLDataSet.FieldValues['JID']));
if (i <> -1) then begin
tpe := TPet.Create;
with tpe do begin
if assigned (PetList) then begin
if (PetList.IndexOf(StrToInt(SQLDataSet.FieldValues['PID'])) <> -1) then begin
tpe := PetList.Objects[PetList.IndexOf(StrToInt(SQLDataSet.FieldValues['PID']))] as TPet;
addkey := False;
end;
end;
PlayerID := StrToInt(SQLDataSet.FieldValues['PlayerID']);
CharaID := StrToInt(SQLDataSet.FieldValues['CharaID']);
Cart := StrToInt(SQLDataSet.FieldValues['Cart']);
Index := StrToInt(SQLDataSet.FieldValues['PIndex']);
Incubated := StrToInt(SQLDataSet.FieldValues['Incubated']);
PetID := StrToInt(SQLDataSet.FieldValues['PID']);
JID := StrToInt(SQLDataSet.FieldValues['JID']);
Name := (SQLDataSet.FieldValues['Name']);
Renamed := StrToInt(SQLDataSet.FieldValues['Renamed']);
LV := StrToInt(SQLDataSet.FieldValues['LV']);
Relation := StrToInt(SQLDataSet.FieldValues['Relation']);
Fullness := StrToInt(SQLDataSet.FieldValues['Fullness']);
Accessory := StrToInt(SQLDataSet.FieldValues['Accessory']);
Data := PetDB.Objects[i] as TPetDB;
end;
if (addkey) then begin
PetList.AddObject(tpe.PetID, tpe);
end;
if (tpe.PlayerID <> 0) then begin
if (tpe.CharaID = 0) then begin
try
tp := Player.IndexOfObject(tpe.PlayerID) as TPlayer;
with tp.Kafra.Item[tpe.Index] do begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -