📄 usrengn.pas
字号:
end; //004B1C3C
if Integer(dwCurrTick - MerchantNPC.m_dwRunTick) >
MerchantNPC.m_nRunTime then
begin
MerchantNPC.m_dwRunTick := dwCurrTick;
MerchantNPC.Run; {FFFFB}
end;
end; //004B1C6B
end
else
begin //004B1C6B
if (GetTickCount - MerchantNPC.m_dwGhostTick) > 60 * 1000 then
begin
MerchantNPC.Free;
m_MerchantList.Delete(i);
break;
end;
end;
if (GetTickCount - dwRunTick) > g_dwNpcLimit then
begin
nMerchantPosition := i;
boProcessLimit := True;
break;
end; //004B1C8C
end; //004B1C98
finally
m_MerchantList.UnLock;
end;
if not boProcessLimit then
begin
nMerchantPosition := 0;
end; //004B1CA6
except
MainOutMessage(sExceptionMsg);
end;
dwProcessMerchantTimeMin := GetTickCount - dwRunTick;
if dwProcessMerchantTimeMin > dwProcessMerchantTimeMax then
dwProcessMerchantTimeMax := dwProcessMerchantTimeMin;
if dwProcessNpcTimeMin > dwProcessNpcTimeMax then
dwProcessNpcTimeMax := dwProcessNpcTimeMin;
end;
procedure TUserEngine.ProcessMissions;
begin
end;
procedure TUserEngine.ProcessMonsters;
function GetZenTime(dwTime: LongWord): LongWord;
var
d10 : Double;
begin
if dwTime < 30 * 60 * 1000 then
begin
d10 := (GetUserCount - g_Config.nUserFull) / g_Config.nZenFastStep;
if d10 > 0 then
begin
if d10 > 6 then
d10 := 6;
Result := dwTime - ROUND((dwTime / 10) * d10)
end
else
begin //4B1616
Result := dwTime;
end;
end
else
begin
Result := dwTime;
end;
end;
//004B1638
var
dwCurrentTick : LongWord;
dwRunTick : LongWord;
dwMonProcTick : LongWord;
MonGen : pTMonGenInfo;
nGenCount : Integer;
nGenModCount : Integer;
boProcessLimit : Boolean;
boRegened : Boolean;
boCanCreate : Boolean;
i : Integer;
nProcessPosition : Integer;
Monster : TAnimalObject;
tCode : Integer;
dd : array[0..1] of Integer;
Map : TEnvirnoment;
MonCount : Integer;
nTemp : LongWord;
hid : String;
resourcestring
sExceptionMsg =
'[Exception] TUserEngine::ProcessMonsters %d';
begin
tCode := 0;
dwRunTick := GetTickCount();
try
tCode := 0;
boProcessLimit := False;
dwCurrentTick := GetTickCount();
MonGen := nil;
//刷新怪物开始
//如果注册码不对则退出
{$IF SoftVersion <> VERFREE}
{$I License.inc}
{$I License.inc}
// if MyHardId<>HardNumber then Exit;
{$I License.inc}
{$IFEND}
{$I License.inc}
if NotRegenMonsters then exit;
{$I License.inc}
//判断是否超过刷怪的间隔
if ((GetTickCount - dwRegenMonstersTick) > g_Config.dwRegenMonstersTime)
then
begin
dwRegenMonstersTick := GetTickCount();
//取得当前刷怪的索引
if m_nCurrMonGen < m_MonGenList.Count then
begin
MonGen := m_MonGenList.Items[m_nCurrMonGen];
end
else
MonGen := m_MonGenList.Items[0];
if m_nCurrMonGen < m_MonGenList.Count - 1 then
begin
Inc(m_nCurrMonGen);
end
else
begin
m_nCurrMonGen := 0;
end; //004B1718
// g_sMonGenInfo1:='开始';
if (MonGen <> nil) and (MonGen.sMonName <> '') and not
g_Config.boVentureServer then
begin
nTemp := GetTickCount - MonGen.dwStartTick;
if (MonGen.dwStartTick = 0) or (nTemp > GetZenTime(MonGen.dwZenTime))
then
begin
g_sMonGenInfo1 := '开始' + MonGen.sMonName + IntToStr(nGenModCount) +
'/'
+ IntToStr(nGenCount);
;
nGenCount := GetGenMonCount(MonGen);
boRegened := True;
//if MonGen.nCount > tGenCount then begin
//if (MonGen.nCount <= g_nMonGenRate) or (MonGen.nCount div g_nMonGenRate > tGenCount) then begin //0806 增加 控制刷怪数量比例
nGenModCount := MonGen.nCount; // _MAX(1, ROUND(_MAX(1, MonGen.nCount) / (g_Config.nMonGenRate / 10)));
Map := g_MapManager.FindMap(MonGen.sMapName);
if (Map.m_boNoManNoMon) and (Map.HumCount = 0) then
boCanCreate := False
else
boCanCreate := True;
if (nGenModCount > nGenCount) and (boCanCreate) then
begin //0806 增加 控制刷怪数量比例
boRegened := RegenMonsters(MonGen, nGenModCount - nGenCount);
//g_sMonGenInfo1:='刷失败';
end; //004B1798
if boRegened then
begin
MonGen.dwStartTick := GetTickCount();
g_sMonGenInfo1 := MonGen.sMonName + ',' + IntToStr(m_nCurrMonGen) +
'/'
+ IntToStr(m_MonGenList.Count);
end;
end; //004B17A9
// g_sMonGenInfo1 := MonGen.sMonName + ',' + IntToStr(m_nCurrMonGen) + '/'
// + IntToStr(m_MonGenList.Count);
end; //004B1851
end; //004B1851
g_nMonGenTime := GetTickCount - dwCurrentTick;
if g_nMonGenTime > g_nMonGenTimeMin then
g_nMonGenTimeMin := g_nMonGenTime;
if g_nMonGenTime > g_nMonGenTimeMax then
g_nMonGenTimeMax := g_nMonGenTime;
//刷新怪物结束
dwMonProcTick := GetTickCount();
nMonsterProcessCount := 0;
tCode := 1;
//004B187B
MonCount := 0;
for i := m_nMonGenListPosition to m_MonGenList.Count - 1 do
begin
MonGen := m_MonGenList.Items[i];
MonCount := MonCount + GetGenMonCount(MonGen);
tCode := 11;
if m_nMonGenCertListPosition < MonGen.CertList.Count then
begin
nProcessPosition := m_nMonGenCertListPosition;
end
else
begin //4B18A8
nProcessPosition := 0;
end;
m_nMonGenCertListPosition := 0;
//4B18B5
while (True) do
begin
if nProcessPosition >= MonGen.CertList.Count then
break;
Monster := MonGen.CertList.Items[nProcessPosition];
tCode := 12;
if not Monster.m_boGhost then
begin
if Integer(dwCurrentTick - Monster.m_dwRunTick) > Monster.m_nRunTime
then
begin
Monster.m_dwRunTick := dwRunTick;
if (dwCurrentTick - Monster.m_dwSearchTick) > Monster.m_dwSearchTime
then
begin
Monster.m_dwSearchTick := GetTickCount();
tCode := 13;
Monster.SearchViewRange();
end;
tCode := 14;
{$IF PROCESSMONSTMODE = OLDMONSTERMODE}
Monster.Run;
{$ELSE}
if not Monster.m_boIsVisibleActive and (Monster.m_nProcessRunCount <
g_Config.nProcessMonsterInterval) then
begin
Inc(Monster.m_nProcessRunCount);
end
else
begin
Monster.m_nProcessRunCount := 0;
Monster.Run;
end;
{$IFEND}
Inc(nMonsterProcessCount);
end;
Inc(nMonsterProcessPostion);
end
else
begin
if (GetTickCount - Monster.m_dwGhostTick) > 5 * 60 * 1000 then
begin
MonGen.CertList.Delete(nProcessPosition);
Monster.Free;
Continue;
end;
end;
Inc(nProcessPosition);
if (GetTickCount - dwMonProcTick) > g_dwMonLimit then
begin
g_sMonGenInfo2 := Monster.m_sCharName + '/' + IntToStr(i) + '/' +
IntToStr(nProcessPosition);
boProcessLimit := True;
m_nMonGenCertListPosition := nProcessPosition;
break;
end;
end; //while (True) do begin
if boProcessLimit then
break;
end;
//for I:= m_nMonGenListPosition to MonGenList.Count -1 do begin
//004B1A5D
tCode := 2;
if m_MonGenList.Count <= i then
begin
m_nMonGenListPosition := 0;
nMonsterCount := nMonsterProcessPostion;
nMonsterProcessPostion := 0;
n84 := (n84 + nMonsterProcessCount) div 2;
end; //4B1AAF
//nMonsterCount:=MonCount;
if not boProcessLimit then
begin
m_nMonGenListPosition := 0;
end
else
begin
m_nMonGenListPosition := i;
end;
g_nMonProcTime := GetTickCount - dwMonProcTick;
if g_nMonProcTime > g_nMonProcTimeMin then
g_nMonProcTimeMin := g_nMonProcTime;
if g_nMonProcTime > g_nMonProcTimeMax then
g_nMonProcTimeMax := g_nMonProcTime;
except
on E: Exception do
begin
MainOutMessage(format(sExceptionMsg, [tCode]));
{$IF SHowErr = 1}
MainOutMessage(E.Message);
{$IFEND}
end;
end;
g_nMonTimeMin := GetTickCount - dwRunTick;
if g_nMonTimeMax < g_nMonTimeMin then
g_nMonTimeMax := g_nMonTimeMin;
end;
function TUserEngine.GetGenMonCount(MonGen: pTMonGenInfo): Integer; //4AE19C
var
i : Integer;
nCount : Integer;
BaseObject : TBaseObject;
begin
nCount := 0;
for i := 0 to MonGen.CertList.Count - 1 do
begin
BaseObject := TBaseObject(MonGen.CertList.Items[i]);
if not BaseObject.m_boDeath and not BaseObject.m_boGhost then
Inc(nCount);
end;
Result := nCount;
end;
procedure TUserEngine.ProcessNpcs;
var
dwRunTick, dwCurrTick : LongWord;
i : Integer;
NPC : TNormNpc;
boProcessLimit : Boolean;
begin
dwRunTick := GetTickCount();
boProcessLimit := False;
try
dwCurrTick := GetTickCount();
for i := nNpcPosition to QuestNPCList.Count - 1 do
begin
NPC := QuestNPCList.Items[i];
if not NPC.m_boGhost then
begin
if Integer(dwCurrTick - NPC.m_dwRunTick) > NPC.m_nRunTime then
begin
if (GetTickCount - NPC.m_dwSearchTick) > NPC.m_dwSearchTime then
begin
NPC.m_dwSearchTick := GetTickCount();
NPC.SearchViewRange();
end;
if Integer(dwCurrTick - NPC.m_dwRunTick) > NPC.m_nRunTime then
begin
NPC.m_dwRunTick := dwCurrTick;
NPC.Run; {FFFFB}
end;
end;
end
else
begin
if (GetTickCount - NPC.m_dwGhostTick) > 60 * 1000 then
begin
NPC.Free;
QuestNPCList.Delete(i);
break;
end;
end;
if (GetTickCount - dwRunTick) > g_dwNpcLimit then
begin
nNpcPosition := i;
boProcessLimit := True;
break;
end;
end;
if not boProcessLimit then
begin
nNpcPosition := 0;
end;
except
MainOutMessage('[Exceptioin] TUserEngine.ProcessNpcs');
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -