📄 game.pas
字号:
//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; //-------------------------------------------------------------------------- //030316/030317 Cardinal $0099: //GM begin //tp := tc.PData; h := IDTableDB.IndexOf(tc.ID); if (h <> -1) then begin tid := IDTableDB.Objects[h] as TIDTbl; if (tid.BroadCast = 1) then begin RFIFOW(2, w); str := RFIFOS(4, w - 4); WFIFOW(0, $009a); if (Copy(str, 1, 4) = 'blue') then begin for k := 0 to CharaName.Count - 1 do begin tc1 := CharaName.Objects[k] as TChara; if (tc1.Login = 2) and (tc1.Map = tc.Map) then tc1.Socket.SendBuf(buf, w); end; end else begin for k := 0 to CharaName.Count - 1 do begin tc1 := CharaName.Objects[k] as TChara; if tc1.Login = 2 then tc1.Socket.SendBuf(buf, w); end; end; DebugOut.Lines.Add('GM:'+str); end; end; 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; //廳検曄峏 WFIFOW( 0, $00b0); WFIFOW( 2, $0018); WFIFOL( 4, tc.Weight); Socket.SendBuf(buf, 8); //廃傝偵捠抦 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{僠儍僢僩儖乕儉婡擻捛壛} //擖幒拞偺傾僀僥儉巊梡柍岠 if (tc.ChatRoomID <> 0) then continue;{僠儍僢僩儖乕儉婡擻捛壛僐僐傑偱}{業揦僗僉儖捛壛} //業揦拞偺傾僀僥儉巊梡柍岠 if (tc.VenderID <> 0) then continue; //if (tc.Sit <> 1) then continue;{業揦僗僉儖捛壛僐僐傑偱} RFIFOW(2, w); RFIFOL(4, l); if (l = tc.ID) and (w >= 1) and (w <= 100) then begin //DebugOut.Lines.Add('UsedItem:' + IntToStr(w)); td := tc.Item[w].Data; b := 0; case td.IType of 0: //Recovery item begin if tc.Item[w].Amount > 0 then begin if td.HP2 <> 0 then begin tc.HP := tc.HP + (td.HP1 + Random(td.HP2 - td.HP1 + 1)) * (100 + tc.Param[2]) div 100; //030316捛壛 Cardinal if tc.HP > tc.MAXHP then tc.HP := tc.MAXHP; SendCStat1(tc, 0, 5, tc.HP); end; if td.SP2 <> 0 then begin tc.SP := tc.SP + (td.SP1 + Random(td.SP2 - td.SP1 + 1)) * (100 + tc.Param[3]) div 100; //030316捛壛 Cardinal if tc.SP > tc.MAXSP then tc.SP := tc.MAXSP; SendCStat1(tc, 0, 7, tc.SP); end; Dec(tc.Item[w].Amount); //WFIFOW( 0, $00a8); //WFIFOW( 2, w); //WFIFOW( 4, tc.Item[w].Amount); //WFIFOB( 6, 1); //Socket.SendBuf(buf, 7); //030316捛壛 Cardinal if tc.Item[w].Amount = 0 then tc.Item[w].ID := 0; tc.Weight := tc.Weight - td.Weight; //傾僀僥儉悢尭彮 WFIFOW( 0, $00af); WFIFOW( 2, w); WFIFOW( 4, 1); Socket.SendBuf(buf, 6);
WFIFOW( 0, $00b0);
WFIFOW( 2, $0018);
WFIFOL( 4, tc.Weight);
Socket.SendBuf(buf, 8);
//tm := Map.Objects[Map.IndexOf(tc.Map)] as TMap;
WFIFOW( 0, $01c8);
WFIFOW( 2, 15);
WFIFOW( 4, td.ID);
WFIFOL( 6, l);
WFIFOB( 10, 35);
WFIFOL( 11,1);
Socket.SendBuf(buf, 15); //SendBCmd(tm,tc.Point,15,tc,false); b := 1; end; end; 2: //巊梡傾僀僥儉 begin case td.Effect of 0: begin Dec(tc.Item[w].Amount); WFIFOW( 0, $00a8); WFIFOW( 2, w); WFIFOW( 4, tc.Item[w].Amount); WFIFOB( 6, 1); Socket.SendBuf(buf, 7); if tc.Item[w].Amount = 0 then tc.Item[w].ID := 0; tc.Weight := tc.Weight - td.Weight; WFIFOW( 0, $00af); WFIFOW( 2, w); WFIFOW( 4, 1); WFIFOW( 0, $00b0); WFIFOW( 2, $0018); WFIFOL( 4, tc.Weight); Socket.SendBuf(buf, 8); if (td.ID = 610) then begin SendItemSkill(tc, 54, 1); end; end; 1: //奼戝嬀 begin WFIFOW(0, $0177); j := 4; for i := 1 to 100 do begin if (tc.Item[i].ID <> 0) and (tc.Item[i].Amount > 0) and (tc.Item[i].Identify = 0) then begin WFIFOW(j, i); j := j + 2; end; end; if j <> 4 then begin //枹娪掕傾僀僥儉偑偁傞応崌 WFIFOW(2, j); Socket.SendBuf(buf, j); tc.UseItemID := w; b := 1; end; end; 2: //澧偺塇 begin tm := tc.MData;{NPC僀儀儞僩捛壛} i := MapInfo.IndexOf(tc.Map); j := -1; if (i <> -1) then begin mi := MapInfo.Objects[i] as MapTbl; if (mi.noTele = true) then j := 0; end; if (j <> 0) then begin{NPC僀儀儞僩捛壛僐僐傑偱} //嵗昗堏摦 j := 0; repeat xy.X := Random(tm.Size.X - 2) + 1; //夋柺抂偺寗娫偵偼旘偽側偄傛偆偵 xy.Y := Random(tm.Size.Y - 2) + 1; Inc(j); until (tm.gat[xy.X, xy.Y] and 1 <> 0) or (j = 100); //旘傋側偄偲偄偆偙偲偼側偄偲巚偆偗偳堦墳丄僼僃僀儖僙乕僼 if j <> 100 then begin Dec(tc.Item[w].Amount); WFIFOW( 0, $00a8); WFIFOW( 2, w); WFIFOW( 4, tc.Item[w].Amount); WFIFOB( 6, 1); Socket.SendBuf(buf, 7); //030316捛壛 Cardinal if tc.Item[w].Amount = 0 then tc.Item[w].ID := 0; tc.Weight := tc.Weight - tc.Item[w].Data.Weight; //傾僀僥儉悢尭彮 WFIFOW( 0, $00af); WFIFOW( 2, w); WFIFOW( 4, 1); //廳検尭彮 WFIFOW( 0, $00b0); WFIFOW( 2, $0018); WFIFOL( 4, tc.Weight); Socket.SendBuf(buf, 8); b := 1; //儅僢僾堏摦 SendCLeave(tc, 3); tc.Point := xy; MapMove(Socket, tc.Map, tc.Point); end;{NPC僀儀儞僩捛壛} end;{NPC僀儀儞僩捛壛僐僐傑偱} end; 3: //挶偺塇 begin{NPC僀儀儞僩捛壛} i := MapInfo.IndexOf(tc.Map); j := -1; if (i <> -1) then begin mi := MapInfo.Objects[i] as MapTbl; if (mi.noTele = true) then j := 0; end; if (j <> 0) then begin{NPC僀儀儞僩捛壛僐僐傑偱} Dec(tc.Item[w].Amount); WFIFOW( 0, $00a8); WFIFOW( 2, w); WFIFOW( 4, tc.Item[w].Amount); WFIFOB( 6, 1); Socket.SendBuf(buf, 7); //030316捛壛 Cardinal if tc.Item[w].Amount = 0 then tc.Item[w].ID := 0; tc.Weight := tc.Weight - tc.Item[w].Data.Weight; //傾僀僥儉悢尭彮 WFIFOW( 0, $00af); WFIFOW( 2, w); WFIFOW( 4, 1); //廳検尭彮 WFIFOW( 0, $00b0); WFIFOW( 2, $0018); WFIFOL( 4, tc.Weight); Socket.SendBuf(buf, 8); b := 1; SendCLeave(tc, 0); tc.Map := tc.SaveMap; tc.Point := tc.SavePoint; MapMove(Socket, tc.Map, tc.Point);{NPC僀儀儞僩捛壛} end;{NPC僀儀儞僩捛壛僐僐傑偱} end;{巵{敔捛壛} 10: //屆栘偺巬 begin //傾僀僥儉巊梡 Dec(tc.Item[w].Amount); WFIFOW( 0, $00a8); WFIFOW( 2, w); WFIFOW( 4, tc.Item[w].Amount); WFIFOB( 6, 1); Socket.SendBuf(buf, 7); if tc.Item[w].Amount = 0 then tc.Item[w].ID := 0; tc.Weight := tc.Weight - tc.Item[w].Data.Weight; //傾僀僥儉悢尭彮 WFIFOW( 0, $00af); WFIFOW( 2, w); WFIFOW( 4, 1); //廳検尭彮 WFIFOW( 0, $00b0); WFIFOW( 2, $0018); WFIFOL( 4, tc.Weight); Socket.SendBuf(buf, 8); if (SummonMobList.Count > 0) then begin tm := tc.MData; ts := TMob.Create; l := Random(SummonMobList.Count); tsmn := SummonMobList.Objects[l] as TSummon; str := tsmn.Name; ts.Data := MobDBName.Objects[MobDBName.IndexOf(str)] as TMobDB; ts.ID := NowMobID; Inc(NowMobID); if (SummonMonsterName = true) then begin ts.Name := ts.Data.JName; end else begin ts.Name := 'Summon Monster'; end; ts.isActive := true; ts.JID := ts.Data.ID; ts.Map := tc.Map; j := 0; repeat ts.Point.X := tc.Point.X + Random(11) - 5; ts.Point.Y := tc.Point.Y + Random(11) - 5; Inc(j); until (tm.gat[ts.Point.X, ts.Point.Y] and 1 <> 0) or (j = 10); if (j = 10) then begin ts.Point.X := tc.Point.X; ts.Point.Y := tc.Point.Y; end; ts.Dir := Random(8); ts.HP := ts.Data.HP; ts.Speed := ts.Data.Speed; ts.SpawnDelay1 := $7FFFFFFF; ts.SpawnDelay2 := 0; ts.SpawnType := 0; ts.SpawnTick := 0; ts.MoveWait := timeGetTime(); ts.ATarget := 0; ts.ATKPer := 100; ts.DEFPer := 100; ts.DmgTick := 0; ts.Element := ts.Data.Element; for j := 0 to 31 do begin ts.EXPDist[j].CData := nil; ts.EXPDist[j].Dmg := 0; end; if ts.Data.MEXP <> 0 then begin for j := 0 to 31 do begin ts.MVPDist[j].CData := nil; ts.MVPDist[j].Dmg := 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -