📄 game.pas
字号:
//僽儘僢僋張棟
for j := tc.Point.Y div 8 - 2 to tc.Point.Y div 8 + 2 do begin
for i := tc.Point.X div 8 - 2 to tc.Point.X div 8 + 2 do begin
// Notify about nearby NPCs
for k := 0 to tm.Block[i][j].NPC.Count - 1 do begin
tn := tm.Block[i][j].NPC.Objects[k] as TNPC;
if (abs(tc.Point.X - tn.Point.X) < 16) and (abs(tc.Point.Y - tn.Point.Y) < 16) then begin
//SendNData(Socket, tn, tc.ver2);
if (tn.Enable = true) then begin
SendNData(Socket, tn,tc.ver2);
if (tn.ScriptInitS <> -1) and (tn.ScriptInitD = false) then begin
//OnInit processing
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('OnInit Event(%d)', [tn.ID]));
tc1 := TChara.Create;
tc1.TalkNPCID := tn.ID;
tc1.ScriptStep := tn.ScriptInitS;
tc1.AMode := 3;
tc1.AData := tn;
tc1.Login := 0;
NPCScript(tc1,0,1);
tn.ScriptInitD := true;
tc1.Free;
end;
if (tn.ChatRoomID <> 0) then begin
// Show NPC chatrooms
ii := ChatRoomList.IndexOf(tn.ChatRoomID);
if (ii <> -1) then begin
tcr := ChatRoomList.Objects[ii] as TChatRoom;
if (tn.ID = tcr.MemberID[0]) then begin
w := Length(tcr.Title);
WFIFOW(0, $00d7);
WFIFOW(2, w + 17);
WFIFOL(4, tcr.MemberID[0]);
WFIFOL(8, tcr.ID);
WFIFOW(12, tcr.Limit);
WFIFOW(14, tcr.Users);
WFIFOB(16, tcr.Pub);
WFIFOS(17, tcr.Title, w);
if tc.Socket <> nil then begin
tc.Socket.SendBuf(buf, w + 17);
end;
end;
end;
end;
end;
end;
end;
// Notify nearby players about you (and you about them)
for k := 0 to tm.Block[i][j].CList.Count - 1 do begin
tc1 := tm.Block[i][j].CList.Objects[k] as TChara;
if (tc <> tc1) and (abs(tc.Point.X - tc1.Point.X) < 16) and (abs(tc.Point.Y - tc1.Point.Y) < 16) then begin
SendCData(tc, tc1);
SendCData(tc1, tc);
// Remove any chats or vends you may have had displayed (after death, perhaps...)
ChatRoomDisp(tc.Socket, tc1);
VenderDisp(tc.Socket, tc1);
end;
end;
// Update about mobs in your range of vision
for k := 0 to tm.Block[i][j].Mob.Count - 1 do begin
ts := tm.Block[i][j].Mob.Objects[k] as TMob;
if (abs(tc.Point.X - ts.Point.X) < 16) and (abs(tc.Point.Y - ts.Point.Y) < 16) then begin
SendMData(Socket, ts);
end;
end;
end;
end;
// Update skill list
SendCSkillList(tc);
// Update character stats
CalcStat(tc);
SendCStat(tc, true);
// Update inventory data
WFIFOW(0, $00a3);
j := 0;
for i := 1 to 100 do begin
if (tc.Item[i].ID <> 0) and (not tc.Item[i].Data.IEquip) then begin
WFIFOW( 4 +j*10, i);
WFIFOW( 6 +j*10, tc.Item[i].Data.ID);
WFIFOB( 8 +j*10, tc.Item[i].Data.IType);
WFIFOB( 9 +j*10, tc.Item[i].Identify);
WFIFOW(10 +j*10, tc.Item[i].Amount);
if tc.Item[i].Data.IType = 10 then
WFIFOW(12 +j*10, 32768)
else
WFIFOW(12 +j*10, 0);
Inc(j);
end;
end;
WFIFOW(2, 4+j*10);
Socket.SendBuf(buf, 4+j*10);
// Update equipment data
WFIFOW(0, $00a4);
j := 0;
for i := 1 to 100 do begin
if (tc.Item[i].ID <> 0) and tc.Item[i].Data.IEquip then begin
WFIFOW( 4 +j*20, i);
WFIFOW( 6 +j*20, tc.Item[i].Data.ID);
WFIFOB( 8 +j*20, tc.Item[i].Data.IType);
WFIFOB( 9 +j*20, tc.Item[i].Identify);
with tc.Item[i].Data do begin
if (tc.JID = 12) and (IType = 4) and (Loc = 2) and
((View = 1) or (View = 2) or (View = 6)) then
WFIFOW(10 +j*20, 34)
else
WFIFOW(10 +j*20, Loc);
end;
WFIFOW(12 +j*20, tc.Item[i].Equip);
WFIFOB(14 +j*20, tc.Item[i].Attr);
WFIFOB(15 +j*20, tc.Item[i].Refine);
WFIFOW(16 +j*20, tc.Item[i].Card[0]);
WFIFOW(18 +j*20, tc.Item[i].Card[1]);
WFIFOW(20 +j*20, tc.Item[i].Card[2]);
WFIFOW(22 +j*20, tc.Item[i].Card[3]);
Inc(j);
end;
end;
WFIFOW(2, 4+j*20);
Socket.SendBuf(buf, 4+j*20);
// Update arrow equipment status
j := 0;
for i := 1 to 100 do begin
if (tc.Item[i].ID <> 0) and (tc.Item[i].Equip = 32768) then begin
j := i;
break;
end;
end;
WFIFOW(0, $013c);
WFIFOW(2, j);
Socket.SendBuf(buf, 4);
// Transmit cart data
// Colus, 20040123: Other carts weren't getting checked.
w3 := tc.Option and $0788;
if (w3 <> 0) then begin
SendCart(tc);
end;
// Reset regen/recovery ticks and combat status
tc.HPTick := timeGetTime();
tc.SPTick := timeGetTime();
tc.HPRTick := timeGetTime() - 500;
tc.SPRTick := timeGetTime();
tc.Sit := 3;
tc.AMode := 0;
tc.DmgTick := 0;
// Set login data and send party info
tc.Login := 2;
SendPartyList(tc);
// Find and show your active pet
j := 0;
for i := 1 to 100 do begin
if ( tc.Item[i].ID <> 0 ) and ( tc.Item[i].Amount > 0 ) and
( tc.Item[i].Card[0] = $FF00 ) and ( tc.Item[i].Attr <> 0 ) then begin
j := i;
break;
end;
end;
if j > 0 then begin
i := PetList.IndexOf( tc.Item[j].Card[2] + tc.Item[j].Card[3] * $10000 );
if i <> -1 then begin
SendPetRelocation(tm, tc, i);
end;
end;
// Get and display the guild news
j := GuildList.IndexOf(tc.GuildID);
if (j <> -1) then begin
tg := GuildList.Objects[j] as TGuild;
WFIFOW( 0, $016f);
WFIFOS( 2, tg.Notice[0], 60);
WFIFOS(62, tg.Notice[1], 120);
Socket.SendBuf(buf, 182);
end;
// Is this map PvP? Then set that mode and ladder status.
if (mi.Pvp = true) then begin
for j := 0 to tm.CList.Count - 1 do begin
tc1 := tm.CList.Objects[j] as TChara;
WFIFOW( 0, $0199);
WFIFOW( 2, 1);
tc1.Socket.SendBuf(buf, 4);
k := j + 1;
i := tm.CList.Count;
WFIFOW( 0, $019a);
WFIFOL( 2, tc1.ID);
WFIFOL( 6, k);
WFIFOL( 10, i);
tc1.Socket.SendBuf(buf, 14);
end;
end;
// Is this map GvG? Then set that mode.
if (mi.PvPG = true) then begin
for j := 0 to tm.CList.Count - 1 do begin
tc1 := tm.CList.Objects[j] as TChara;
WFIFOW( 0, $0199);
WFIFOW( 2, 3);
tc1.Socket.SendBuf(buf, 4);
end;
end;
// Colus, 20040118: Update Spirit Spheres for monks
if (tc.spiritSpheres > 0) then UpdateSpiritSpheres(tm, tc, tc.spiritSpheres);
{if (mi.noDay = true) {or (tc.noDay = true) then begin
WFIFOW(0, $0119);
WFIFOL(2, tc1.ID);
WFIFOW(6, 00);
WFIFOW(8, 16);
WFIFOW(10, 00);
WFIFOB(12, 0); // attack animation
Socket.SendBuf(buf, 13)
end;}
//修改的地方
// Colus, 20040409: Gave the option to enable lower class dyes.
// This should be removed when Gravity reenables them.
UpdateLook(tm, tc, 7, tc.ClothesColor, 0, true);
//修改的地方
end;
end;
end;//$007d
//--------------------------------------------------------------------------
$007e: //tick
begin
WFIFOW(0, $007f);
WFIFOL(2, timeGetTime());
Socket.SendBuf(buf, 6);
end;
//--------------------------------------------------------------------------
$0085: //堏摦梫媮 (嵗偭偰傞偲偒傗僠儍僢僩側偳偱偼堏摦偱偒側偄傛偆偵偡傞偙偲)
begin
{僠儍僢僩儖乕儉婡擻捛壛} {Lit. "Chat room functional addition"}
if tc.Sit = 1 then continue;
if tc.ChatRoomID <> 0 then continue; //僠儍僢僩拞偺堏摦嬛巭
{僠儍僢僩儖乕儉婡擻捛壛僐僐傑偱} {Lit. "To Chat room functional additional coconut}
{業揦僗僉儖捛壛} {Lit. "Street stall skill addition"}
if tc.VenderID <> 0 then continue; //業揦拞偺堏摦嬛巭 Lit. "Movement prohibition in street stall"
{業揦僗僉儖捛壛僐僐傑偱} {Lit. "To street stall skill additional coconut"}
RFIFOM1(2, xy);
tc.NextFlag := true;
tc.NextPoint := xy;
{僷乕僥傿乕婡擻捛壛} {Lit. "Party functional addition"}
//摨堦儅僢僾撪PTM偵強嵼傪抦傜偣傞 Lit. "It informs about location inside PTM the identical map"
if tc.PartyName <> '' then begin
WFIFOW( 0, $0107);
WFIFOL( 2, tc.ID);
WFIFOW( 6, tc.NextPoint.X);
WFIFOW( 8, tc.NextPoint.Y);
SendPCmd(tc,10,true,true);
end;
{僷乕僥傿乕婡擻捛壛僐僐傑偱} {Lit. "To party functional additional coconut"}
end;
//--------------------------------------------------------------------------
$0089: //峌寕丄嵗傝
begin
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + IntToStr(tc.ID));
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + IntToStr(tc.AMode));
if (tc.AMode > 2) and (tc.Skill[278].Lv = 0) then continue;
if (tc.MMode <> 0) and (tc.Skill[278].Lv = 0) then continue;
tc.Delay := 0;
tc.Skill[272].Tick := 0;
RFIFOB(6, b);
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + 'Inside Attack Command');
if (b = 0) or (b = 7) then begin
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + IntToStr(b));
//峌寕
RFIFOL(2, l);
tm := tc.MData;
{ Alex: reverting to 007d requires a weapon sprite fix. }
if (tc.Shield <> 0) then begin
UpdateLook(tc.MData, tc, 2, tc.WeaponSprite[0], tc.Shield);
end else begin
UpdateLook(tc.MData, tc, 2, tc.WeaponSprite[0], tc.WeaponSprite[1]);
end;
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + IntToStr(l));
////////////////////////////////////
//儌儞僗僞乕宆NPC乮峌寕偟傛偆偲偡傞偲奐巒乯
if tm.NPC.IndexOf(l) <> -1 then begin
tn := tm.NPC.IndexOfObject(l) as TNPC;
//嫍棧僠僃僢僋
if (tc.Map <> tn.Map) OR (abs(tc.Point.X - tn.Point.X) > 15) OR
(abs(tc.Point.Y - tn.Point.Y) > 15) then begin
Continue;
end;
case tn.CType of
1: //shop
begin
WFIFOW(0, $00c4);
WFIFOL(2, l);
Socket.SendBuf(buf, 6);
end;
2: //script
begin
tc.TalkNPCID := tn.ID;
tc.ScriptStep := 0;
tc.AMode := 3;
// Option Reset
// Colus, 20040204: WHY? You will lose your peco/falcon when
// talking/shopping...you want to unhide, perhaps, but not
// completely reset your options.
if (tc.Option and 6 <> 0) then begin
tc.Option := tc.Option and $FFF9;
//尒偨栚曄峏 Lit. "The eye modification which you saw"
UpdateOption(tm, tc);
end;
tc.AData := tn;
NPCScript(tc);
end;
{ 4: // Skillunit
begin
if (tn.JID = $8d) then begin
if tc.pcnt <> 0 then xy := tc.tgtPoint else xy := tc.Point;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -