📄 game.pas
字号:
if (abs(xy.X - tn.Point.X) > tc.Range) or (abs(xy.Y - tn.Point.Y) > tc.Range) then begin
//嫍棧偑墦偡偓傞
WFIFOW( 0, $0139);
WFIFOL( 2, tn.ID);
WFIFOW( 6, tn.Point.X);
WFIFOW( 8, tn.Point.Y);
WFIFOW(10, tc.Point.X);
WFIFOW(12, tc.Point.Y);
WFIFOW(14, tc.Range); //幩掱
Socket.SendBuf(buf, 16);
end else begin
//峌寕壜擻
if b = 7 then tc.AMode := 2 else tc.AMode := 1;
tc.ATarget := tn.ID;
tc.AData := tn;
if tc.ATick + tc.ADelay - 200 < timeGetTime() then
tc.ATick := timeGetTime() - tc.ADelay + 200;
end;//if (tn.JID) else
end;//case-4
end;}
end;//case tn.CType
end;//if tm.NPC.IndexOf(l)
//儌儞僗僞乕宆NPC丂偙偙傑偱
////////////////////////////////////
if tm.Mob.IndexOf(l) <> -1 then begin
//懳儌儞僗僞乕
ts := tm.Mob.IndexOfObject(l) as TMob;
if tc.pcnt <> 0 then xy := tc.tgtPoint else xy := tc.Point;
if (abs(xy.X - ts.Point.X) > tc.Range) or (abs(xy.Y - ts.Point.Y) > tc.Range) then begin
//嫍棧偑墦偡偓傞
WFIFOW( 0, $0139);
WFIFOL( 2, ts.ID);
WFIFOW( 6, ts.Point.X);
WFIFOW( 8, ts.Point.Y);
WFIFOW(10, tc.Point.X);
WFIFOW(12, tc.Point.Y);
WFIFOW(14, tc.Range); //幩掱
Socket.SendBuf(buf, 16);
end else begin
//峌寕壜擻
if b = 7 then tc.AMode := 2 else tc.AMode := 1;
tc.ATarget := ts.ID;
tc.AData := ts;
if tc.ATick + (tc.ADelay - 200) < timeGetTime() then
tc.ATick := timeGetTime() - tc.ADelay + 200;
end;
end else begin
//儌儞僗僞乕偱側偄
end;
if tm.CList.IndexOf(l) <> -1 then begin
tc1 := tm.CList.IndexOfObject(l) as TChara;
if tc.pcnt <> 0 then xy := tc.tgtPoint else xy := tc.Point;
if (abs(xy.X - tc1.Point.X) > tc.Range) or (abs(xy.Y - tc1.Point.Y) > tc.Range) then begin
//嫍棧偑墦偡偓傞
WFIFOW( 0, $0139);
WFIFOL( 2, tc1.ID);
WFIFOW( 6, tc1.Point.X);
WFIFOW( 8, tc1.Point.Y);
WFIFOW(10, tc.Point.X);
WFIFOW(12, tc.Point.Y);
WFIFOW(14, tc.Range); //幩掱
Socket.SendBuf(buf, 16);
end else begin
//峌寕壜擻
if b = 7 then tc.AMode := 2 else tc.AMode := 1;
tc.ATarget := tc1.ID;
tc.AData := tc1;
if tc.ATick + (tc.ADelay - 200) < timeGetTime() then
tc.ATick := timeGetTime() - tc.ADelay + 200;
end;
end;//if tm.CList.IndexOf(l)
end else if (b = 2) or (b = 3) then begin
if (tc.Skill[1].Lv >= 3) then begin
//嵗傝
tc.Sit := b;
tm := tc.MData;
WFIFOW(0, $008a);
WFIFOL(2, tc.ID);
WFIFOB(26, b);
SendBCmd(tm, tc.Point, 29);
end else begin
w := tc.MSkill;
tc.MSkill := 1;
SendSkillError(tc, 0, 2);
tc.MSkill := w;
end;//if-else
end;
end;//$0089
//--------------------------------------------------------------------------
$008c: { Text is received from client. Check for GM commands. }
begin
RFIFOW(2, w);
str := RFIFOS(4, w - 4);
// ALBGM - Accesss Level Based GM System. Finally, nice and clean.
if (Pos(' : ', str) <> 0) and ( (Copy(str, Pos(' : ', str) + 3, 1) = '#') or (Copy(str, Pos(' : ', str) + 3, 1) = '@') )then begin
str2 := str;
parse_commands (tc, str2);
str := '';
end;
// ALBGM - Accesss Level Based GM System. Finally, nice and clean.
if (length(str) > 0) then begin
tm := tc.MData;
WFIFOW(0, $008e);
WFIFOW(2, w);
WFIFOS(4, str, w - 4);
Socket.SendBuf(buf, w);
WFIFOW(0, $008d);
WFIFOW(2, w + 4);
WFIFOL(4, tc.ID);
WFIFOS(8, str, w - 4);
if (tc.ChatRoomID <> 0) then begin
SendCrCmd(tc, w + 4, true);
end else begin
SendNCrCmd(tm, tc.Point, w + 4, tc, true, true);
end;
end;
end;
//--------------------------------------------------------------------------
$0090: //NPC偵榖偟偐偗傞
begin
if tc.AMode <> 0 then continue;
tm := tc.MData;
RFIFOL(2, l);
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;
tc.AData := tn;
NPCScript(tc);
end;
end;
end;
end;
//--------------------------------------------------------------------------
$0094: //巜掕ID偺僉儍儔丄NPC偺柤慜傪梫媮
begin
tm := tc.MData;
RFIFOL(2, l);
//accountid := IntToStr(l);
if CharaPID.IndexOf(l) <> -1 then begin
tc := CharaPID.IndexOfObject(l) as TChara;
{僊儖僪婡擻捛壛}
if (tc.GuildID = 0) then begin
WFIFOW(0, $0095);
WFIFOL( 2, l);
WFIFOS( 6, tc.Name, 24);
Socket.SendBuf(buf, 30);
end else begin
WFIFOW(0, $0195);
WFIFOL( 2, l);
WFIFOS( 6, tc.Name, 24);
WFIFOS(30, tc.PartyName, 24);
WFIFOS(54, tc.GuildName, 24);
WFIFOS(78, tc.ClassName, 24);
Socket.SendBuf(buf, 102);
end;
{僊儖僪婡擻捛壛僐僐傑偱}
end else if tm.Mob.IndexOf(l) <> -1 then begin
ts := tm.Mob.IndexOfObject(l) as TMob;
WFIFOW(0, $0095);
WFIFOL( 2, l);
WFIFOS( 6, ts.Name, 24);
Socket.SendBuf(buf, 30);
end else if tm.NPC.IndexOf(l) <> -1 then begin
tn := tm.NPC.IndexOfObject(l) as TNPC;
WFIFOW( 0, $0095);
WFIFOL( 2, l);
WFIFOS( 6, tn.Name, 24);
Socket.SendBuf(buf, 30);
end;
end;
//--------------------------------------------------------------------------
$0096: //wis憲怣
begin
RFIFOW(2, w);
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + IntToStr(w));
str := RFIFOS(4, 24);
i := CharaName.IndexOf(str);
if i = -1 then begin
//巜掕偝傟偨柤慜偺僉儍儔偑嫃側偄
WFIFOW( 0, $0098);
WFIFOB( 2, 1);
Socket.SendBuf(buf, 3);
continue;
end;
tc1 := CharaName.Objects[i] as TChara;
if tc1.Login <> 2 then begin
//憡庤偑儘僌僀儞偟偰偄側偄
WFIFOW( 0, $0098);
WFIFOB( 2, 1);
Socket.SendBuf(buf, 3);
continue;
end;
//wis憲怣
WFIFOW( 0, $0097);
WFIFOS( 4, tc.Name, 24);
tc1.Socket.SendBuf(buf, w);
WFIFOW( 0, $0098);
WFIFOB( 2, 0);
Socket.SendBuf(buf, 3);
end;
//--------------------------------------------------------------------------
$0099: // GM BROADCASTS
begin
RFIFOW(2, w);
str := RFIFOS(4, w - 4);
parse_commands (tc, '/B'+str);
end;
//--------------------------------------------------------------------------
$009b: //岦偒曄峏
begin
tm := tc.MData;
RFIFOW(2, tc.HeadDir);
RFIFOB(4, tc.Dir);
WFIFOW(0, $009c);
WFIFOL(2, tc.ID);
WFIFOW(6, tc.HeadDir);
WFIFOB(8, tc.Dir);
//僽儘僢僋張棟
SendBCmd(tm, tc.Point, 9, tc);
end;
//--------------------------------------------------------------------------
$009f: //傾僀僥儉傪廍偆
begin
RFIFOL(2, l);
PickUpItem(tc,l);
end;
//--------------------------------------------------------------------------
$00a2: //傾僀僥儉僪儘僢僾
begin
tm := tc.MData;
RFIFOW(2, w1);
RFIFOW(4, w2);
if (tc.Item[w1].ID <> 0) and (tc.Item[w1].Amount >= w2) then begin
tn := TNPC.Create;
tn.ID := NowItemID;
Inc(NowItemID);
tn.Name := 'item';
tn.JID := tc.Item[w1].ID;
tn.Map := tc.Map;
tn.Point.X := tc.Point.X - 1 + Random(3);
tn.Point.Y := tc.Point.Y - 1 + Random(3);
tn.CType := 3;
tn.Enable := true;
tn.Item := TItem.Create;
tn.Item.ID := tc.Item[w1].ID;
tn.Item.Amount := w2;
tn.Item.Identify := tc.Item[w1].Identify;
tn.Item.Refine := tc.Item[w1].Refine;
tn.Item.Attr := tc.Item[w1].Attr;
tn.Item.Card[0] := tc.Item[w1].Card[0];
tn.Item.Card[1] := tc.Item[w1].Card[1];
tn.Item.Card[2] := tc.Item[w1].Card[2];
tn.Item.Card[3] := tc.Item[w1].Card[3];
tn.Item.Data := tc.Item[w1].Data;
tn.SubX := Random(8);
tn.SubY := Random(8);
tn.Tick := timeGetTime() + 60000;
tm.NPC.AddObject(tn.ID, tn);
tm.Block[tn.Point.X div 8][tn.Point.Y div 8].NPC.AddObject(tn.ID, tn);
//傾僀僥儉悢尭彮
WFIFOW( 0, $00af);
WFIFOW( 2, w1);
WFIFOW( 4, w2);
Socket.SendBuf(buf, 6);
tc.Item[w1].Amount := tc.Item[w1].Amount - w2;
if tc.Item[w1].Amount = 0 then tc.Item[w1].ID := 0;
tc.Weight := tc.Weight - tc.Item[w1].Data.Weight * w2;
//Update weight
SendCStat1(tc, 0, $0018, tc.Weight);
//廃傝偵捠抦
WFIFOW( 0, $009e);
WFIFOL( 2, tn.ID);
WFIFOW( 6, tn.JID);
WFIFOB( 8, tn.Item.Identify);
WFIFOW( 9, tn.Point.X);
WFIFOW(11, tn.Point.Y);
WFIFOB(13, tn.SubX);
WFIFOB(14, tn.SubY);
WFIFOW(15, tn.Item.Amount);
SendBCmd(tm, tn.Point, 17);
end;
end;
//--------------------------------------------------------------------------
$00a7: //Item Use
begin
tm := Map.Objects[Map.IndexOf(tc.Map)] as TMap;
{僠儍僢僩儖乕儉婡擻捛壛}
//擖幒拞偺傾僀僥儉巊梡柍岠
if (tc.ChatRoomID <> 0) then continue;
{僠儍僢僩儖乕儉婡擻捛壛僐僐傑偱}
{業揦僗僉儖捛壛}
//業揦拞偺傾僀僥儉巊梡柍岠
{傾僕僩婡擻捛壛}
i := MapInfo.IndexOf(tc.Map);
if (i <> -1) then begin
mi := MapInfo.Objects[i] as MapTbl;
end else begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -