📄 localdb.~pas
字号:
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
Result:=0;
sFileName:=g_Config.sEnvirDir + 'MonGen.txt';
if FileExists(sFileName) then begin
LoadList:=TStringList.Create;
LoadList.LoadFromFile(sFileName);
I:=0;
while (True) do begin
if I >= LoadList.Count then break;
if CompareLStr('loadgen',LoadList.Strings[I],Length('loadgen')) then begin
sMapGenFile:=GetValidStr3(LoadList.Strings[I], sLineText, [' ', #9]);
LoadList.Delete(I);
if sMapGenFile <> '' then begin
LoadMapGen(LoadList,sMapGenFile);
end;
end;
Inc(I);
end;
for i:=0 to LoadList.Count -1 do begin
sLineText:=LoadList.Strings[i];
if (sLineText <> '') and (sLineText[1] <> ';') then begin
New(MonGenInfo);
sLineText:=GetValidStr3(sLineText, sData, [' ', #9]);
MonGenInfo.sMapName:=sData;
sLineText:=GetValidStr3(sLineText, sData, [' ', #9]);
MonGenInfo.nX:=Str_ToInt(sData,0);
sLineText:=GetValidStr3(sLineText, sData, [' ', #9]);
MonGenInfo.nY:=Str_ToInt(sData,0);
sLineText:=GetValidStrCap(sLineText, sData, [' ', #9]);
if (sData <> '') and (sData[1] = '"') then
ArrestStringEx(sData,'"','"',sData);
MonGenInfo.sMonName:=sData;
sLineText:=GetValidStr3(sLineText, sData, [' ', #9]);
MonGenInfo.nRange:=Str_ToInt(sData,0);
sLineText:=GetValidStr3(sLineText, sData, [' ', #9]);
MonGenInfo.nCount:=Str_ToInt(sData,0);
sLineText:=GetValidStr3(sLineText, sData, [' ', #9]);
MonGenInfo.dwZenTime:=Str_ToInt(sData, 1) * 60 * 1000;
sLineText:=GetValidStr3(sLineText, sData, [' ', #9]);
MonGenInfo.nMissionGenRate:=Str_ToInt(sData,0); //集中座标刷新机率 1 -100
if (MonGenInfo.sMapName <> '') and
(MonGenInfo.sMonName <> '') and
(MonGenInfo.dwZenTime <> 0) and
(g_MapManager.GetMapInfo(nServerIndex,MonGenInfo.sMapName) <> nil) then begin
MonGenInfo.CertList:=TList.Create;
MonGenInfo.Envir:=g_MapManager.FindMap(MonGenInfo.sMapName);
if MonGenInfo.Envir <> nil then begin
// MonGenInfo.dwStartTick:=0;
UserEngine.m_MonGenList.Add(MonGenInfo);
// MainOutMessage(format('序号=%d:怪物%s:数量%d',[UserEngine.m_MonGenList.count,MonGenInfo.sMonName,MonGenInfo.nCount]));
end else begin
Dispose(MonGenInfo);
end;
end else Dispose(MonGenInfo); //hint 泄露
//tMonGenInfo.nRace:=UserEngine.GetMonRace(tMonGenInfo.sMonName);
end;//00486B5B
end;//00486B67
//00486B67
New(MonGenInfo);
MonGenInfo.sMapName:='';
MonGenInfo.sMonName:='';
MonGenInfo.CertList:=TList.Create;
MonGenInfo.Envir:=nil;
UserEngine.m_MonGenList.Add(MonGenInfo);
LoadList.Free;
Result:=1;
end;
end;
//00485E04
function TFrmDB.LoadMonsterDB():Integer;
var
i:Integer;
Monster:pTMonInfo;
ResourceString
sSQLString = 'select * from Monster';
begin
Result:=0;
EnterCriticalSection(ProcessHumanCriticalSection);
try
for I := 0 to UserEngine.MonsterList.Count - 1 do begin
Dispose(pTMonInfo(UserEngine.MonsterList.Items[I]));
end;
UserEngine.MonsterList.Clear;
Query.SQL.Clear;
Query.SQL.Add(sSQLString);
try
Query.Open;
finally
Result:= -1;
end;
for i:=0 to Query.RecordCount -1 do begin
New(Monster);
Monster.ItemList := TList.Create; //这里创建
Monster.sName := Trim(Query.FieldByName('NAME').AsString);
Monster.btRace := Query.FieldByName('Race').AsInteger;
Monster.btRaceImg := Query.FieldByName('RaceImg').AsInteger;
Monster.wAppr := Query.FieldByName('Appr').AsInteger;
Monster.wLevel := Query.FieldByName('Lvl').AsInteger;
Monster.btLifeAttrib := Query.FieldByName('Undead').AsInteger;
Monster.wCoolEye := Query.FieldByName('CoolEye').AsInteger;
Monster.dwExp := Query.FieldByName('Exp').AsInteger;
//城门或城墙的状态跟HP值有关,如果HP异常,将导致城墙显示不了
if Monster.btRace in [110,111] then begin //如果为城墙或城门由HP不加倍
Monster.wHP := Query.FieldByName('HP').AsInteger;
end else begin
Monster.wHP := ROUND(Query.FieldByName('HP').AsInteger * (g_Config.nMonsterPowerRate / 10));
end;
Monster.wMP := ROUND(Query.FieldByName('MP').AsInteger * (g_Config.nMonsterPowerRate / 10));
Monster.wAC := ROUND(Query.FieldByName('AC').AsInteger * (g_Config.nMonsterPowerRate / 10));
Monster.wMAC := ROUND(Query.FieldByName('MAC').AsInteger * (g_Config.nMonsterPowerRate / 10));
Monster.wDC := ROUND(Query.FieldByName('DC').AsInteger * (g_Config.nMonsterPowerRate / 10));
Monster.wMaxDC := ROUND(Query.FieldByName('DCMAX').AsInteger * (g_Config.nMonsterPowerRate / 10));
Monster.wMC := ROUND(Query.FieldByName('MC').AsInteger * (g_Config.nMonsterPowerRate / 10));
Monster.wSC := ROUND(Query.FieldByName('SC').AsInteger * (g_Config.nMonsterPowerRate / 10));
Monster.wSpeed := Query.FieldByName('SPEED').AsInteger;
Monster.wHitPoint := Query.FieldByName('HIT').AsInteger;
Monster.wWalkSpeed := _MAX(200,Query.FieldByName('WALK_SPD').AsInteger);
Monster.wWalkStep := _MAX(1,Query.FieldByName('WalkStep').AsInteger);
Monster.wWalkWait := Query.FieldByName('WalkWait').AsInteger;
Monster.wAttackSpeed := Query.FieldByName('ATTACK_SPD').AsInteger;
if Monster.wWalkSpeed < 200 then Monster.wWalkSpeed:= 200;
if Monster.wAttackSpeed < 200 then Monster.wAttackSpeed:= 200;
// Monster.ItemList:=nil; 这里泄露 上面的 Monster.ItemList := TList.Create; //这里创建
LoadMonitems(Monster.sName,Monster.ItemList); //读取怪物暴物数据
UserEngine.MonsterList.Add(Monster);
Result := 1;
Query.Next;
end;
Query.Close;
finally
LeaveCriticalSection(ProcessHumanCriticalSection);
end;
end;
function TFrmDB.LoadMonitems(MonName: string; var ItemList: TList): Integer;
//00485ABC
var
i : Integer;
s24 : string;
LoadList : TStringList;
MonItem : pTMonItemInfo;
s28, s2C, s30 : string;
n18, n1C, n20 : Integer;
begin
Result := 0;
s24 := g_Config.sEnvirDir + 'MonItems\' + MonName + '.txt';
if FileExists(s24) then begin
if ItemList <> nil then begin
for i := 0 to ItemList.Count - 1 do
begin
DisPose(pTMonItemInfo(ItemList.Items[i]));
end;
ItemList.Clear;
end
else
ItemList:=TList.Create; //00485B81
LoadList := TStringList.Create;
LoadList.LoadFromFile(s24);
for i := 0 to LoadList.Count - 1 do
begin
s28 := LoadList.Strings[i];
if (s28 <> '') and (s28[1] <> ';') then
begin
s28 := GetValidStr3(s28, s30, [' ', '/', #9]);
n18 := Str_ToInt(s30, -1);
s28 := GetValidStr3(s28, s30, [' ', '/', #9]);
n1C := Str_ToInt(s30, -1);
s28 := GetValidStr3(s28, s30, [' ', #9]);
if s30 <> '' then
begin
if s30[1] = '"' then
ArrestStringEx(s30, '"', '"', s30);
end;
s2C := s30;
s28 := GetValidStr3(s28, s30, [' ', #9]);
n20 := Str_ToInt(s30, 1);
if (n18 > 0) and (n1C > 0) and (s2C <> '') then
begin
if ItemList = nil then
ItemList := TList.Create;
New(MonItem);
MonItem.SelPoint := n18 - 1;
MonItem.MaxPoint := n1C;
MonItem.ItemName:= s2C;
MonItem.Count:= n20;
ItemList.Add(MonItem);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -