📄 localdb.pas
字号:
sFileName:String;
List28:TStringList;
begin
Result:= -1;
sFileName:=g_Config.sEnvirDir + 'MakeItem.txt';
if FileExists(sFileName) then begin
LoadList:=TStringList.Create;
LoadList.LoadFromFile(sFileName);
List28:=nil;
s24:='';
for I := 0 to LoadList.Count - 1 do begin
s18:=Trim(LoadList.Strings[I]);
if (s18 <> '') and (s18[1] <> ';') then begin
if s18[1] = '[' then begin
if List28 <> nil then
g_MakeItemList.AddObject(s24,List28);
List28:=TStringList.Create;
ArrestStringEx(s18,'[',']',s24);
end else begin
if List28 <> nil then begin
s18:=GetValidStr3(s18,s20,[' ',#9]);
n14:=Str_ToInt(Trim(s18),1);
List28.AddObject(s20,TObject(n14));
end;
end;
end;
end; // for
if List28 <> nil then
g_MakeItemList.AddObject(s24,List28);
LoadList.Free;
Result:=1;
end;
end;
function TFrmDB.LoadMapInfo: Integer;
function LoadMapQuest(sName:String):TMerchant;
var
QuestNPC:TMerchant;
begin
QuestNPC:=TMerchant.Create;
QuestNPC.m_sMapName:='0';
QuestNPC.m_nCurrX:=0;
QuestNPC.m_nCurrY:=0;
QuestNPC.m_sCharName:=sName;
QuestNPC.m_nFlag:=0;
QuestNPC.m_wAppr:=0;
QuestNPC.m_sFilePath:='MapQuest_def\';
QuestNPC.m_boIsHide:=True;
QuestNPC.m_boIsQuest:=False;
UserEngine.QuestNPCList.Add(QuestNPC);
Result:=QuestNPC;
end;
procedure LoadSubMapInfo(LoadList: TStringList; sFileName: string);
var
i: Integer;
sFilePatchName, sFileDir: string;
LoadMapList: TStringList;
begin
sFileDir := g_Config.sEnvirDir + 'MapInfo\';
if not DirectoryExists(sFileDir) then
begin
CreateDir(sFileDir);
end;
sFilePatchName := sFileDir + sFileName;
if FileExists(sFilePatchName) then
begin
LoadMapList := TStringList.Create;
LoadMapList.LoadFromFile(sFilePatchName);
for i := 0 to LoadMapList.Count - 1 do
begin
LoadList.Add(LoadMapList.Strings[i]);
end;
LoadMapList.Free;
end;
end;
var
sFileName: string;
LoadList: TStringList;
i, ii: Integer;
s30, s34, s38, sMapName, s44, sMapDesc, s4C, sReConnectMap: string;
n14, n18, n1C, n20: Integer;
nServerIndex: Integer;
MapFlag: TMapFlag;
QuestNPC: TMerchant;
sMapInfoFile: string;
sNewName: string;
sOldItemName: string;
begin
Result := -1;
sFileName := g_Config.sEnvirDir + 'MapInfo.txt';
if FileExists(sFileName) then
begin
LoadList := TStringList.Create;
LoadList.LoadFromFile(sFileName);
if LoadList.Count < 0 then
begin
LoadList.Free;
Exit;
end;
i := 0;
while (True) do
begin
if i >= LoadList.Count then
Break;
if CompareLStr('loadmapinfo', LoadList.Strings[i], Length('loadmapinfo'))
then
begin
sMapInfoFile := GetValidStr3(LoadList.Strings[i], s30, [' ', #9]);
LoadList.Delete(i);
if sMapInfoFile <> '' then
begin
LoadSubMapInfo(LoadList, sMapInfoFile);
end;
end;
Inc(i);
end;
Result := 1;
//加载地图设置
for i := 0 to LoadList.Count - 1 do
begin
s30 := LoadList.Strings[i];
if (s30 <> '') and (s30[1] = '[') then
begin
sMapName := '';
MapFlag.boSAFE := False;
s30 := ArrestStringEx(s30, '[', ']', sMapName);
for ii := 0 to Length(sMapName) - 1 do
begin
if sMapName[ii] = '|' then
begin
sNewName := Copy(sMapName, 0, ii - 1);
sMapName := GetValidStr3(sMapName, sMapName, ['|', ' ', #9]); //获取重复利用地图
Break;
end;
end;
sMapDesc := GetValidStrCap(sMapName, sMapName, [' ', ',', #9]);
if (sMapDesc <> '') and (sMapDesc[1] = '"') then
ArrestStringEx(sMapDesc, '"', '"', sMapDesc);
s4C := Trim(GetValidStr3(sMapDesc, sMapDesc, [' ', ',', #9]));
nServerIndex := Str_ToInt(s4C, 0);
if sMapName = '' then
Continue;
FillChar(MapFlag, SizeOf(TMapFlag), #0);
MapFlag.nL := 1;
QuestNPC := nil;
MapFlag.nNEEDSETONFlag := -1;
MapFlag.nNeedONOFF := -1;
while (True) do
begin
if s30 = '' then
Break;
s30 := GetValidStr3(s30, s34, [' ', ',', #9]);
if s34 = '' then
Break;
MapFlag.nMUSICID := -1;
if CompareText(s34, 'SAFE') = 0 then
begin
MapFlag.boSAFE := True;
Continue;
end;
if CompareText(s34, 'DARK') = 0 then
begin
MapFlag.boDARKness := True;
Continue;
end;
if CompareText(s34, 'FIGHT') = 0 then
begin
MapFlag.boFIGHTZone := True;
Continue;
end;
if CompareText(s34, 'FIGHT3') = 0 then
begin
MapFlag.boFIGHT3Zone := True;
Continue;
end;
if CompareText(s34, 'DAY') = 0 then
begin
MapFlag.boDAYLIGHT := True;
Continue;
end;
if CompareText(s34, 'QUIZ') = 0 then
begin
MapFlag.boQUIZ := True;
Continue;
end;
if CompareLStr(s34, 'NORECONNECT', Length('NORECONNECT')) then
begin
MapFlag.boNORECONNECT := True;
ArrestStringEx(s34, '(', ')', sReConnectMap);
MapFlag.sNOReConnectMap := sReConnectMap;
if MapFlag.sNOReConnectMap = '' then
Result := -11;
Continue;
end;
if CompareLStr(s34, 'CHECKQUEST', Length('CHECKQUEST')) then
begin
ArrestStringEx(s34, '(', ')', s38);
QuestNPC := LoadMapQuest(s38);
Continue;
end;
if CompareLStr(s34, 'NEEDSET_ON', Length('NEEDSET_ON')) then
begin
MapFlag.nNeedONOFF := 1;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nNEEDSETONFlag := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'NEEDSET_OFF', Length('NEEDSET_OFF')) then
begin
MapFlag.nNeedONOFF := 0;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nNEEDSETONFlag := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'MUSIC', Length('MUSIC')) then
begin
MapFlag.boMUSIC := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nMUSICID := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'EXPRATE', Length('EXPRATE')) then
begin
MapFlag.boEXPRATE := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nEXPRATE := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'PKWINLEVEL', Length('PKWINLEVEL')) then
begin
MapFlag.boPKWINLEVEL := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nPKWINLEVEL := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'PKWINEXP', Length('PKWINEXP')) then
begin
MapFlag.boPKWINEXP := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nPKWINEXP := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'PKLOSTLEVEL', Length('PKLOSTLEVEL')) then
begin
MapFlag.boPKLOSTLEVEL := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nPKLOSTLEVEL := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'PKLOSTEXP', Length('PKLOSTEXP')) then
begin
MapFlag.boPKLOSTEXP := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nPKLOSTEXP := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'DECHP', Length('DECHP')) then
begin
MapFlag.boDECHP := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nDECHPPOINT := Str_ToInt(GetValidStr3(s38, s38, ['/']), -1);
MapFlag.nDECHPTIME := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'INCHP', Length('INCHP')) then
begin
MapFlag.boINCHP := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nINCHPPOINT := Str_ToInt(GetValidStr3(s38, s38, ['/']), -1);
MapFlag.nINCHPTIME := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'DECGAMEGOLD', Length('DECGAMEGOLD')) then
begin
MapFlag.boDECGAMEGOLD := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nDECGAMEGOLD := Str_ToInt(GetValidStr3(s38, s38, ['/']),
-1);
MapFlag.nDECGAMEGOLDTIME := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'DECGAMEPOINT', Length('DECGAMEPOINT')) then
begin
MapFlag.boDECGAMEPOINT := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nDECGAMEPOINT := Str_ToInt(GetValidStr3(s38, s38, ['/']),
-1);
MapFlag.nDECGAMEPOINTTIME := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'INCGAMEGOLD', Length('INCGAMEGOLD')) then
begin
MapFlag.boINCGAMEGOLD := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nINCGAMEGOLD := Str_ToInt(GetValidStr3(s38, s38, ['/']),
-1);
MapFlag.nINCGAMEGOLDTIME := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'INCGAMEPOINT', Length('INCGAMEPOINT')) then
begin
MapFlag.boINCGAMEPOINT := True;
ArrestStringEx(s34, '(', ')', s38);
MapFlag.nINCGAMEPOINT := Str_ToInt(GetValidStr3(s38, s38, ['/']),
-1);
MapFlag.nINCGAMEPOINTTIME := Str_ToInt(s38, -1);
Continue;
end;
if CompareLStr(s34, 'RUNHUMAN', Length('RUNHUMAN')) then
begin
MapFlag.boRUNHUMAN := True;
Continue;
end;
if CompareLStr(s34, 'RUNMON', Length('RUNMON')) then
begin
MapFlag.boRUNMON := True;
Continue;
end;
if CompareLStr(s34, 'NEEDHOLE', Length('NEEDHOLE')) then
begin
MapFlag.boNEEDHOLE := True;
Continue;
end;
if CompareLStr(s34, 'NORECALL', Length('NORECALL')) then
begin
MapFlag.boNORECALL := True;
Continue;
end;
if CompareLStr(s34, 'NOGUILDRECALL', Length('NOGUILDRECALL')) then
begin
MapFlag.boNOGUILDRECALL := True;
Continue;
end;
if CompareLStr(s34, 'NODEARRECALL', Length('NODEARRECALL')) then
begin
MapFlag.boNODEARRECALL := True;
Continue;
end;
if CompareLStr(s34, 'NOMASTERRECALL', Length('NOMASTERRECALL')) then
begin
MapFlag.boNOMASTERRECALL := True;
Continue;
end;
if CompareLStr(s34, 'NORANDOMMOVE', Length('NORANDOMMOVE')) then
begin
MapFlag.boNORANDOMMOVE := True;
Continue;
end;
if CompareLStr(s34, 'NODRUG', Length('NODRUG')) then
begin
MapFlag.boNODRUG := True;
Continue;
end;
if CompareLStr(s34, 'MINE', Length('MINE')) then
begin
MapFlag.boMINE := True;
Continue;
end;
if CompareLStr(s34, 'MINE2', Length('MINE2')) then
begin
MapFlag.boMINE2 := True;
Continue;
end;
if CompareLStr(s34, 'NOTHROWITEM', Length('NOTHROWITEM')) then
begin
MapFlag.boNOTHROWITEM := True;
Continue;
end;
if CompareLStr(s34, 'NODROPITEM', Length('NODROPITEM')) then
begin
MapFlag.boNODROPITEM := True;
Continue;
end;
if CompareLStr(s34, 'NOPOSITIONMOVE', Length('NOPOSITIONMOVE')) then
begin
MapFlag.boNOPOSITIONMOVE := True;
Continue;
end;
if CompareLStr(s34, 'NOHORSE', Length('NOHORSE')) then
begin
MapFlag.boNOPOSITIONMOVE := True;
Continue;
end;
if CompareLStr(s34, 'NOCHAT', Length('NOCHAT')) then
begin
MapFlag.boNOCHAT := True;
Continue;
end;
if (s34[1] = 'L') then
begin
MapFlag.nL := Str_ToInt(Copy(s34, 2, Length(s34) - 1), 1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -