📄 localdb.~pas
字号:
Inc(Result);
end;
end;
end;
LoadList.Free;
end;
end;
//00488178
function TFrmDB.LoadNpcs(): Integer;
var
sFileName,s10,s18,s1C,s20,s24,s28,s2C,s30,s34,s38:String;
LoadList:TStringList;
NPC:TNormNpc;
i:Integer;
begin
sFileName:=g_Config.sEnvirDir + 'Npcs.txt';
if FileExists(sFileName) then begin
LoadList:=TStringList.Create;
LoadList.LoadFromFile(sFileName);
for i:=0 to LoadList.Count -1 do begin
s18:=Trim(LoadList.Strings[i]);
if (s18 <> '') and (s18[1] <> ';') then begin
s18:=GetValidStrCap(s18, s20, [' ', #9]);
if (s20 <> '') and (s20[1] = '"') then
ArrestStringEx(s20,'"','"',s20);
s18:=GetValidStr3(s18, s24, [' ', #9]);
s18:=GetValidStr3(s18, s28, [' ', #9]);
s18:=GetValidStr3(s18, s2C, [' ', #9]);
s18:=GetValidStr3(s18, s30, [' ', #9]);
s18:=GetValidStr3(s18, s34, [' ', #9]);
s18:=GetValidStr3(s18, s38, [' ', #9]);
if (s20 <> '') and (s28 <> '') and (s38 <> '') then begin
NPC:=nil;
case Str_ToInt(s24,0) of
0: NPC:=TMerchant.Create;
1: NPC:=TGuildOfficial.Create;
2: NPC:=TCastleOfficial.Create;
end;
if NPC <> nil then begin
NPC.m_sMapName:=s28;
NPC.m_nCurrX:=Str_ToInt(s2C,0);
NPC.m_nCurrY:=Str_ToInt(s30,0);
NPC.m_sCharName:=s20;
NPC.m_nFlag:=Str_ToInt(s34,0);
NPC.m_wAppr:=Str_ToInt(s38,0);
UserEngine.QuestNPCList.Add(NPC); //0048847D
end;
end;
end;
end;
LoadList.Free;
end;
Result:= 1;
end;
//00489840
function TFrmDB.LoadQuestDiary(): Integer;
function sub_48978C(nIndex:Integer):String;
begin
if nIndex >= 1000 then begin
Result:=IntToStr(nIndex);
exit;
end;
if nIndex >= 100 then begin
Result:=IntToStr(nIndex) + '0';
exit;
end;
Result:=IntToStr(nIndex) + '00';
end;
var
i,ii:Integer;
QDDinfoList:TList;
QDDinfo:pTQDDinfo;
s14,s18,s1C,s20:String;
bo2D:Boolean;
nC:Integer;
LoadList:TStringList;
begin
Result:=1;
for i:=0 to QuestDiaryList.Count -1 do begin
QDDinfoList:=QuestDiaryList.Items[i];
for ii:=0 to QDDinfoList.Count -1 do begin
QDDinfo:=QDDinfoList.Items[ii];
QDDinfo.sList.Free;
Dispose(QDDinfo);
end;
QDDinfoList.Free;
end;
QuestDiaryList.Clear;
bo2D:=False;
nC:=1;
while (True) do begin
QDDinfoList:=nil;
s14:='QuestDiary\' + sub_48978C(nC) + '.txt';
if FileExists(s14) then begin
s18:='';
QDDinfo:=nil;
LoadList:=TStringList.Create;
LoadList.LoadFromFile(s14);
for i:=0 to LoadList.Count -1 do begin
s1C:=LoadList.Strings[i];
if (s1C <> '') and (s1C[1] <> ';') then begin
if (s1C[1] = '[') and (length(s1C) > 2) then begin
if s18 = '' then begin
ArrestStringEx(s1C,'[',']',s18);
QDDinfoList:=TList.Create;
New(QDDinfo);
QDDinfo.n00:=nC;
QDDinfo.s04:=s18;
QDDinfo.sList:=TStringList.Create;
QDDinfoList.Add(QDDinfo);
bo2D:=True;
end else begin
if s1C[1] <> '@' then begin
s1C:=GetValidStr3(s1C,s20,[' ',#9]);
ArrestStringEx(s20,'[',']',s20);
New(QDDinfo);
QDDinfo.n00:=Str_ToInt(s20,0);
QDDinfo.s04:=s1C;
QDDinfo.sList:=TStringList.Create;
QDDinfoList.Add(QDDinfo);
bo2D:=True;
end else bo2D:=False;
end;
end else begin //00489AFD
if bo2D then QDDinfo.sList.Add(s1C);
end;
end;//00489B11
end;
LoadList.Free;
end;//00489B25
if QDDinfoList <> nil then QuestDiaryList.Add(QDDinfoList) ;
// else QuestDiaryList.Add(nil); //hint 导致抱错。//hint
Inc(nC);
if nC >= 105 then break;
end;
end;
//00488EF0
function TFrmDB.LoadStartPoint(): Integer;
var
sFileName,tStr,s18,s1C,s20 :String;
LoadList:TStringList;
i:Integer;
begin
Result:=0;
sFileName:=g_Config.sEnvirDir + 'StartPoint.txt';
if FileExists(sFileName) then begin
try
g_StartPointList.Lock;
g_StartPointList.Clear;
LoadList:=TStringList.Create;
LoadList.LoadFromFile(sFileName);
for i:=0 to LoadList.Count -1 do begin
tStr:=Trim(LoadList.Strings[i]);
if (tStr <> '') and (tStr[1] <> ';') then begin
tStr:=GetValidStr3(tStr, s18, [' ', #9]);
tStr:=GetValidStr3(tStr, s1C, [' ', #9]);
tStr:=GetValidStr3(tStr, s20, [' ', #9]);
// tStr:=GetValidStr3(tStr, s24, [' ', #9]);
if (s18 <> '') and (s1C <> '') and (s20 <> '')then begin
g_StartPointList.AddObject(s18,TObject(MakeLong(Str_ToInt(s1C,0),Str_ToInt(s20,0))));
Result:=1;
end;
end;
end;
LoadList.Free;
finally
g_StartPointList.UnLock;
end;
end;
end;
//00489240
function TFrmDB.LoadUnbindList(): Integer;
var
sFileName,tStr,sData,s20:String;
tUnbind:pTUnbindInfo;
LoadList:TStringList;
i:Integer;
n10:Integer;
begin
Result:=0;
sFileName:=g_Config.sEnvirDir + 'UnbindList.txt';
if FileExists(sFileName) then begin
LoadList:=TStringList.Create;
LoadList.LoadFromFile(sFileName);
for i:=0 to LoadList.Count -1 do begin
tStr:=LoadList.Strings[i];
if (tStr <> '') and (tStr[1] <> ';') then begin
//New(tUnbind);
tStr:=GetValidStr3(tStr, sData, [' ', #9]);
tStr:=GetValidStrCap(tStr, s20, [' ', #9]);
if (s20 <> '') and (s20[1] = '"') then
ArrestStringEx(s20,'"','"',s20);
n10:=Str_ToInt(sData,0);
if n10 > 0 then g_UnbindList.AddObject(s20,TObject(n10))
else begin
Result:=-i; //需要取负数
break;
end;
end;
end;
LoadList.Free;
end;
end;
function TFrmDB.LoadbindList(): Integer;
var
sFileName,tStr,sData,s20:String;
tUnbind:pTUnbindInfo;
LoadList:TStringList;
i:Integer;
n10:Integer;
begin
Result:=0;
sFileName:=g_Config.sEnvirDir + 'bindList.txt';
if FileExists(sFileName) then begin
LoadList:=TStringList.Create;
LoadList.LoadFromFile(sFileName);
for i:=0 to LoadList.Count -1 do begin
tStr:=LoadList.Strings[i];
if (tStr <> '') and (tStr[1] <> ';') then begin
//New(tUnbind);
tStr:=GetValidStr3(tStr, sData, [' ', #9]);
tStr:=GetValidStrCap(tStr, s20, [' ', #9]);
if (s20 <> '') and (s20[1] = '"') then
ArrestStringEx(s20,'"','"',s20);
n10:=Str_ToInt(sData,0);
if n10 > 0 then g_bindList.AddObject(s20,TObject(n10))
else begin
Result:=-i; //需要取负数
break;
end;
end;
end;
LoadList.Free;
end;
end;
function TFrmDB.LoadNpcScript(NPC: TNormNpc; sPatch,
sScritpName: String): Integer; //0048C4D8
begin
if sPatch = '' then sPatch:=sNpc_def;
Result:=LoadScriptFile(NPC,sPatch,sScritpName,False);
end;
function TFrmDB.LoadScriptFile(NPC: TNormNpc; sPatch, sScritpName: String;
boFlag: Boolean): Integer; //0048B684
var
nQuestIdx,I,n1C,n20,n24,nItemType,nPriceRate: Integer;
n6C,n70:Integer;
sScritpFileName,s30,s34,s38,s3C,s40,s44,s48,s4C,s50:String;
LoadList:TStringList;
DefineList:TList;
s54,s58,s5C,s74:String;
DefineInfo:pTDefineInfo;
bo8D:Boolean;
Script:pTScript;
SayingRecord:pTSayingRecord;
SayingProcedure:pTSayingProcedure;
QuestConditionInfo:pTQuestConditionInfo;
QuestActionInfo:pTQuestActionInfo;
Goods:pTGoods;
Merchant:TMerchant;
function LoadCallScript(sFileName,sLabel:String;List:TStringList):Boolean; //00489BD4
var
I: Integer;
LoadStrList:TStringList;
bo1D:Boolean;
s18:String;
begin
Result:=False;
if FileExists(sFileName) then begin
LoadStrList:=TStringList.Create;
LoadStrList.LoadFromFile(sFileName);
DeCodeStringList(LoadStrList);
sLabel:='[' + sLabel + ']';
bo1D:=False;
for I := 0 to LoadStrList.Count - 1 do begin
s18:=Trim(LoadStrList.Strings[i]);
if s18 <> '' then begin
if not bo1D then begin
if (s18[1] = '[') and (CompareText(s18,sLabel) = 0) then begin
bo1D:=True;
List.Add(s18);
end;
end else begin //00489CBF
if s18[1] <> '{' then begin
if s18[1] = '}' then begin
bo1D:=False;
Result:=True;
break;
end else begin //00489CD9
List.Add(s18);
end;
end;
end;
end; //00489CE4 if s18 <> '' then begin
end; // for I := 0 to LoadStrList.Count - 1 do begin
LoadStrList.Free;
end;
end;
function LoadScriptcall(LoadList:TStringList):boolean; //0048B138
var
I: Integer;
s14,s18,s1C,s20,s34:String;
begin
result:=false;
for I := 0 to LoadList.Count - 1 do begin
s14:=Trim(LoadList.Strings[i]);
if (s14 <> '') and (s14[1] = '#') and (CompareLStr(s14,'#CALL',length('#CALL'))) then begin
s14:=ArrestStringEx(s14,'[',']',s1C);
s20:=Trim(s1C);
s18:=Trim(s14);
s34:=g_Config.sEnvirDir + 'QuestDiary\' + s20;
if LoadCallScript(s34,s18,LoadList) then begin
LoadList.Strings[i]:='#ACT';
LoadList.Insert(i + 1,'goto ' + s18);
result:=true;
end else begin
MainOutMessage('script error, load fail: ' + s20 + s18);
end;
end;
end;
end;
function LoadDefineInfo(LoadList:TStringList;List:TList):String; //0048B35C
var
I: Integer;
s14,s28,s1C,s20,s24:String;
DefineInfo:pTDefineInfo;
LoadStrList:TStringList;
begin
for I := 0 to LoadList.Count - 1 do begin
s14:=Trim(LoadList.Strings[i]);
if (s14 <> '') and (s14[1] = '#') then begin
if CompareLStr(s14,'#SETHOME',length('#SETHOME')) then begin
Result:=Trim(GetValidStr3(s14,s1C,[' ',#9]));
LoadList.Strings[i]:='';
end;
if CompareLStr(s14,'#DEFINE',length('#DEFINE')) then begin
s14:=(GetValidStr3(s14,s1C,[' ',#9]));
s14:=(GetValidStr3(s14,s20,[' ',#9]));
s14:=(GetValidStr3(s14,s24,[' ',#9]));
New(DefineInfo);
DefineInfo.sName:=UpperCase(s20);
DefineInfo.sText:=s24;
List.Add(DefineInfo);
LoadList.Strings[i]:='';
end; //0048B505
if CompareLStr(s14,'#INCLUDE',length('#INCLUDE')) then begin
s28:=Tri
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -