📄 localdb.pas
字号:
// tSaveList.Add(';CANGETEXP 1 10');
SaveList.Add('#say');
SaveList.Add('游戏登录脚本运行成功,欢迎进入本游戏!!!\ \');
SaveList.Add('<关闭/@exit> \ \');
SaveList.Add('登录脚本文件位于: \');
SaveList.Add(sShowFile + '\');
SaveList.Add('脚本内容请自行按自己的要求修改。');
SaveList.SaveToFile(sScriptFile);
SaveList.Free;
end;
if FileExists(sScriptFile) then begin
g_ManageNPC:=TMerchant.Create;
g_ManageNPC.m_sMapName:='0';
g_ManageNPC.m_nCurrX:=0;
g_ManageNPC.m_nCurrY:=0;
g_ManageNPC.m_sCharName:='QManage';
g_ManageNPC.m_nFlag:=0;
g_ManageNPC.m_wAppr:=0;
g_ManageNPC.m_sFilePath:='MapQuest_def\';
g_ManageNPC.m_boIsHide:=True;
g_ManageNPC.m_boIsQuest:=False;
UserEngine.QuestNPCList.Add(g_ManageNPC);
end else begin
g_ManageNPC:=nil;
end;
except
g_ManageNPC:=nil;
end;
end;
procedure TFrmDB.RobotNPC();
var
sScriptFile:String;
sScritpDir :String;
tSaveList:TStringList;
begin
try
sScriptFile:=g_Config.sEnvirDir + 'Robot_def\' + 'RobotManage.txt';
sScritpDir:=g_Config.sEnvirDir + 'Robot_def\';
if not DirectoryExists(sScritpDir) then
mkdir(Pchar(sScritpDir));
if not FileExists(sScriptFile) then begin
tSaveList:=TStringList.Create;
tSaveList.Add(';此脚为机器人专用脚本,用于机器人处理功能用的脚本。');
tSaveList.SaveToFile(sScriptFile);
tSaveList.Free;
end;
if FileExists(sScriptFile) then begin
g_RobotNPC:=TMerchant.Create;
g_RobotNPC.m_sMapName:='0';
g_RobotNPC.m_nCurrX:=0;
g_RobotNPC.m_nCurrY:=0;
g_RobotNPC.m_sCharName:='RobotManage';
g_RobotNPC.m_nFlag:=0;
g_RobotNPC.m_wAppr:=0;
g_RobotNPC.m_sFilePath:='Robot_def\';
g_RobotNPC.m_boIsHide:=True;
g_RobotNPC.m_boIsQuest:=False;
UserEngine.QuestNPCList.Add(g_RobotNPC);
end else begin
g_RobotNPC:=nil;
end;
except
g_RobotNPC:=nil;
end;
end;
//00489414
function TFrmDB.LoadMapQuest(): Integer;
var
sFileName,tStr:String;
tMapQuestList:TStringList;
i:Integer;
s18,s1C,s20,s24,s28,s2C,s30,s34:String;
n38,n3C:Integer;
boGrouped:Boolean;
Map:TEnvirnoment;
begin
Result:=1;
sFileName:=g_Config.sEnvirDir + 'MapQuest.txt';
if FileExists(sFileName) then begin
tMapQuestList:=TStringList.Create;
tMapQuestList.LoadFromFile(sFileName);
for i:=0 to tMapQuestList.Count -1 do begin
tStr:=tMapQuestList.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 (s24 <> '') and (s24[1] = '"') then
ArrestStringEx(s24,'"','"',s24);
tStr:=GetValidStr3(tStr, s28, [' ', #9]);
if (s28 <> '') and (s28[1] = '"') then
ArrestStringEx(s28,'"','"',s28);
tStr:=GetValidStr3(tStr, s2C, [' ', #9]);
tStr:=GetValidStr3(tStr, s30, [' ', #9]);
if (s18 <> '') and (s24 <> '') and (s2C <> '') then begin
Map:=g_MapManager.FindMap(s18);
if Map <> nil then begin
ArrestStringEx(s1C,'[',']',s34);
n38:=Str_ToInt(s34,0);
n3C:=Str_ToInt(s20,0);
if CompareLStr(s30,'GROUP',length('GROUP')) then boGrouped:=True
else boGrouped:=False;
if not Map.CreateQuest(n38,n3C,s24,s28,s2C,boGrouped) then Result:= -i;
//nFlag,boFlag,Monster,Item,Quest,boGrouped
end else Result:= -i;
end else Result:= -i;
end;
end;
tMapQuestList.Free;
end;
QMangeNPC();
QFunctionNPC();
QSHOPNPC();
RobotNPC();
end;
//0048784C
function gettopname(sname:string;var bnpc:byte;var appr:integer):string;
var rs:string;
begin
if topfile=nil then exit;
bnpc:=0;
if sname='<top1>' then begin
rs:=topfile.readString('top','1','');
if (rs<>'') then begin // (topnpcarr[1].sname='') and
rs:=GetValidStrCap(rs, topnpcarr[1].sname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[1].sguildname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[1].slevel, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[1].sdate, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[1].npcappr, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[1].job, ['/']);
bnpc:=1;
result:='天下第一男战士\'+topnpcarr[1].sname+'\';
end else
result:='天下第一男战士\暂无\';
end;
if sname='<top2>' then begin
rs:=topfile.readString('top','2','');
if (rs<>'') then begin // (topnpcarr[2].sname='') and
rs:=GetValidStrCap(rs, topnpcarr[2].sname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[2].sguildname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[2].slevel, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[2].sdate, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[2].npcappr, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[2].job, ['/']);
bnpc:=2;
result:='天下第一女战士\'+topnpcarr[2].sname+'\';
end else
result:='天下第一女战士\暂无\';
end;
if sname='<top3>' then begin
rs:=topfile.readString('top','3','');
if (rs<>'') then begin // (topnpcarr[3].sname='') and
rs:=GetValidStrCap(rs, topnpcarr[3].sname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[3].sguildname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[3].slevel, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[3].sdate, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[3].npcappr, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[3].job, ['/']);
bnpc:=3;
result:='天下第一男法师\'+topnpcarr[3].sname+'\';
end else
result:='天下第一男法师\暂无\';
end;
if sname='<top4>' then begin
rs:=topfile.readString('top','4','');
if (rs<>'') then begin // (topnpcarr[4].sname='') and
rs:=GetValidStrCap(rs, topnpcarr[4].sname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[4].sguildname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[4].slevel, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[4].sdate, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[4].npcappr, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[4].job, ['/']);
bnpc:=4;
result:='天下第一女法师\'+topnpcarr[4].sname+'\';
end else
result:='天下第一女法师\暂无\';
end;
if sname='<top5>' then begin
rs:=topfile.readString('top','5','');
if (rs<>'') then begin // (topnpcarr[5].sname='') and
rs:=GetValidStrCap(rs, topnpcarr[5].sname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[5].sguildname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[5].slevel, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[5].sdate, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[5].npcappr, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[5].job, ['/']);
bnpc:=5;
result:='天下第一男道士\'+topnpcarr[5].sname+'\';
end else
result:='天下第一男道士\暂无\';
end;
if sname='<top6>' then begin
rs:=topfile.readString('top','6','');
if (rs<>'') then begin // (topnpcarr[6].sname='') and
rs:=GetValidStrCap(rs, topnpcarr[6].sname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[6].sguildname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[6].slevel, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[6].sdate, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[6].npcappr, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[6].job, ['/']);
bnpc:=6;
result:='天下第一女道士\'+topnpcarr[6].sname+'\';
end else
result:='天下第一女道士\暂无\';
end;
if sname='<master>' then begin
rs:=topfile.readString('top','7','');
if (rs<>'') then begin // (topnpcarr[7].sname='') and
rs:=GetValidStrCap(rs, topnpcarr[7].sname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[7].sguildname, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[7].slevel, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[7].sdate, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[7].npcappr, ['/']);
rs:=GetValidStrCap(rs, topnpcarr[7].job, ['/']);
bnpc:=7;
appr:=strtoint(topnpcarr[7].npcappr);
result:='沙城霸主\'+topnpcarr[7].sguildname+'\'+topnpcarr[7].sname+'\';
end else
result:='沙城霸主\暂无\';
end;
end;
function TFrmDB.LoadMerchant(): Integer;
var
sFileName,sLineText,sScript,sMapName,sX,sY,sName,sFlag,sAppr,sIsCalste,sCanMove,sMoveTime:String;
tMerchantList:TStringList;
tMerchantNPC:TMerchant;
i,appr:Integer;
mirrorname:string;
begin
sFileName:=g_Config.sEnvirDir + 'Merchant.txt';
if FileExists(sFileName) then begin
tMerchantList:=TStringList.Create;
tMerchantList.LoadFromFile(sFileName);
for i:=0 to tMerchantList.Count -1 do begin
sLineText:=Trim(tMerchantList.Strings[i]);
if (sLineText <> '') and (sLineText[1] <> ';') then begin
sLineText:=GetValidStr3(sLineText, sScript, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sMapName, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sX, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sY, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sName, [' ', #9]);
if (sName <> '') and (sName[1] = '"') then
ArrestStringEx(sName,'"','"',sName);
sLineText:=GetValidStr3(sLineText, sFlag, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sAppr, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sIsCalste, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sCanMove, [' ', #9]);
sLineText:=GetValidStr3(sLineText, sMoveTime, [' ', #9]);
mirrorname:='';
if pos('>',sMapName) >0 then
sMapName:= ArrestStringEx(sMapName,'<','>',mirrorname);
if (sScript <> '') and (sMapName <> '') and (sAppr <> '') then begin
tMerchantNPC:=TMerchant.Create;
tMerchantNPC.m_sScript:=sScript;
tMerchantNPC.m_sMapName:=sMapName;
tMerchantNPC.m_nCurrX:=Str_ToInt(sX,0);
tMerchantNPC.m_nCurrY:=Str_ToInt(sY,0);
// tMerchantNPC.byistopnpc :=0;
if pos('<',sname)>0 then begin
tMerchantNPC.m_sCharName:=gettopname(sName,tMerchantNPC.byistopnpc,appr); //这里初识化 top npc 名字 脚本读取时的设置。
end
else tMerchantNPC.m_sCharName:=sName;
tMerchantNPC.m_nFlag:=Str_ToInt(sFlag,0);
if tMerchantNPC.byistopnpc=7 then tMerchantNPC.m_wAppr:=appr
else tMerchantNPC.m_wAppr:=Str_ToInt(sAppr,0);
tMerchantNPC.m_dwMoveTime:=Str_ToInt(sMoveTime,0);
tMerchantNPC.mirrorname:=mirrorname;
if Str_ToInt(sIsCalste,0) <> 0 then
tMerchantNPC.m_boCastle:=True;
if (Str_ToInt(sCanMove,0) <> 0) and (tMerchantNPC.m_dwMoveTime > 0) then
tMerchantNPC.m_boCanMove:=True;
UserEngine.AddMerchant(tMerchantNPC); //00487B4D
end;
end;
end;
tMerchantList.Free;
end;
Result:= 1;
end;
//004890C0
function TFrmDB.LoadMinMap: Integer;
var
sFileName,tStr,sMapNO,sMapIdx:String;
tMapList:TStringList;
i,nIdx:Integer;
begin
Result:=0;
sFileName:=g_Config.sEnvirDir + 'MiniMap.txt';
if FileExists(sFileName) then begin
MiniMapList.Clear;
tMapList:=TStringList.Create;
tMapList.LoadFromFile(sFileName);
for i:=0 to tMapList.Count -1 do begin
tStr:=tMapList.Strings[i];
if (tStr <> '') and (tStr[1] <> ';') then begin
tStr:=GetValidStr3(tStr, sMapNO, [' ', #9]);
tStr:=GetValidStr3(tStr, sMapIdx, [' ', #9]);
nIdx:=Str_ToInt(sMapIdx,0);
if nIdx > 0 then
MiniMapList.AddObject(sMapNO,TObject(nIdx));
end;
end;
tMapList.Free;
end;
end;
//004867F4
function TFrmDB.LoadMonGen(): Integer;
procedure LoadMapGen(MonGenList:TStringList;sFileName:String);
var
I: Integer;
sFilePatchName:String;
sFileDir:String;
LoadList:TStringList;
begin
sFileDir:=g_Config.sEnvirDir + 'MonGen\';
if not DirectoryExists(sFileDir) then begin
CreateDir(sFileDir);
end;
sFilePatchName:=sFileDir + sFileName;
if FileExists(sFilePatchName) then begin
LoadList:=TStringList.Create;
LoadList.LoadFromFile(sFilePatchName);
for I := 0 to LoadList.Count - 1 do begin
MonGenList.Add(LoadList.Strings[I]);
end;
LoadList.Free;
end;
end;
var
sFileName,sLineText,sData:String;
MonGenInfo:pTMonGenInfo;
LoadList:TStringList;
sMapGenFile:String;
i:Integer;
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -