⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 game.pas

📁 RO模拟器!!适合玩仙境传说的玩家们呦~
💻 PAS
📖 第 1 页 / 共 4 页
字号:
					mi := MapTbl.Create;
				end;
				if mi.noItem 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('[' + TimeToStr(Now) + '] ' + 'UsedItem:' + IntToStr(w));
					td := tc.Item[w].Data;
					b := 0;
                                        if tc.item[w].Amount <= 0 then exit;
          if tc.BaseLV < td.eLV then exit;
                                    case td.IType of
          			10: // Arrows (added care cuase its a mess sorry)
                    	begin
							if tc.Item[w1].Data.IType = 10 then begin
								//arrow equip
								WFIFOW(0, $013c);
								WFIFOW(2, 0);
								Socket.SendBuf(buf, 4);
                            end;
                        end;
					0: //Recovery item
						begin
                                                        {Concentration Potion, Awakening Potion, Beserk Potion}
                                                        if (td.ID = 645) then SendItemSkill(tc, 291, 1);
                                                        if (td.ID = 656) then SendItemSkill(tc, 291, 2);
                                                        if (td.ID = 657) then SendItemSkill(tc, 291, 3);

							if tc.Item[w].Amount > 0 then begin
                                                                if td.ID = 607 then begin  {Yggasberry}
                                                                        tc.HP := tc.MAXHP;
                                                                        tc.SP := tc.MAXSP;
                                                                        SendCStat1(tc, 0, 5, tc.HP);
                                                                        SendCStat1(tc, 0, 7, tc.SP);
                                                                end else if td.ID = 608 then begin      {Seed of Yggassdril}
                                                                        tc.HP := tc.HP + (tc.MAXHP div 2);
                                                                        tc.SP := tc.SP + (tc.MAXSP div 2);
                                                                        if tc.HP > tc.MAXHP then tc.HP := tc.MAXHP;
                                                                        if tc.SP > tc.MAXSP then tc.SP := tc.MAXSP;
                                                                        SendCStat1(tc, 0, 5, tc.HP);
                                                                        SendCStat1(tc, 0, 7, tc.SP);
                                                                end;

                                                                if td.Effect = 1 then begin
                                                                        tc.isPoisoned := False;
                                                                        tc.PoisonTick := timeGetTime();
                                                                        tc.Stat2 := 0;
                                                                        UpdateStatus(tm, tc, timeGetTime);
                                                                end;

								if td.HP2 <> 0 then begin
                                                                        if tc.Skill[227].Lv <> 0 then begin
                                                                                tc.HP := tc.HP + ((td.HP1 + Random(td.HP2 - td.HP1 + 1)) * (100 + tc.Param[2]) div 100) * tc.Skill[227].Data.Data1[tc.Skill[227].Lv] div 100;  //Learning Potion
                                                                        end else begin
                                                                                // Added HP Recovery skill's power to the recovery calc
                                                                                if (tc.Skill[4].Lv <> 0) then begin
                                                                                  tc.HP := tc.HP + (td.HP1 + Random(td.HP2 - td.HP1 + 1)) * (100 + tc.Param[2]) div 100 * (100 + (tc.Skill[4].Lv * 10)) div 100;
                                                                                end else begin
                                                                                  tc.HP := tc.HP + (td.HP1 + Random(td.HP2 - td.HP1 + 1)) * (100 + tc.Param[2]) div 100;
                                                                                end;
                                                                        end;
									//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;
   // Tumy
   Dec(tc.Item[w].Amount);
   if tc.Item[w].Amount = 0 then tc.Item[w].ID := 0; 
   tc.Weight := tc.Weight - td.Weight; 

   // {Alex: Reduce Number of Items}
   WFIFOW( 0, $00af); 
   WFIFOW( 2, w);
   WFIFOW( 4, 1);
                     Socket.SendBuf(buf, 6);

   // {Alex: Update Weight Display}
   SendCStat1(tc, 0, $0018, tc.Weight);

   // {Alex: Displays Effect}
   WFIFOW( 0, $01c8);
   WFIFOW( 2, w);
   WFIFOW( 4, td.ID);
   WFIFOL( 6, l);
   WFIFOW( 10, tc.Item[w].Amount);
   WFIFOB( 12, 1);
   //Socket.SendBuf(buf, 13);
   SendBCmd(tm, tc.Point, 13);

                     b := 1;
                     // Tumy
							end;
						end;
					2: //巊梡傾僀僥儉
						begin
							case td.Effect of
                                                                0:
                                                                begin

                                                                        UseUsableItem(tc, w);

                                                                        { Worn out scroll }
                                                                        if (td.ID = 618) then begin
                                                                        	tc.BaseEXP := tc.BaseEXP + Round(tc.BaseNextEXP div 100);
                                                                            SendCStat1(tc, 1, $0001, tc.BaseEXP);
                                                                        end;

                                                                        {Yggasdril Leaf}
                                                                        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: // Fly Wings - Rewritten by AlexKreuz
								begin
                  if ((tc.item[w].Amount <= 0) or (tc.Sit = 1) or (tc.Option and 6 <> 0)) then exit;
									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

                                        tm := tc.MData;

                                        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] <> 1) and (tm.gat[xy.X, xy.Y] <> 5)) or (j = 100) );

									        if j <> 100 then begin
										        UseUsableItem(tc, w);
										        b := 1;
                                                SendCLeave(tc, 3);
										        tc.Point := xy;
                                                MapMove(Socket, tc.Map, tc.Point);
									        end;
                                                                        end;
                                                                end;
							3: //挶偺塇
								begin

{NPC僀儀儞僩捛壛}                                                       if tc.item[w].Amount <= 0 then exit;
									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僀儀儞僩捛壛僐僐傑偱}
									UseUsableItem(tc, w);

									b := 1;
									SendCLeave(tc, 0);
									tc.Map := tc.SaveMap;
									tc.Point := tc.SavePoint;
									MapMove(Socket, tc.Map, tc.Point);
{NPC僀儀儞僩捛壛}
									end;
{NPC僀儀儞僩捛壛僐僐傑偱}
								end;

{巵{敔捛壛}
							10, 201: //Dead Branch
								begin
									if not mi.noBranch then begin
										UseUsableItem(tc, w);

										//Use MobList or MobListMVP
										if (SummonMobList.Count > 0) then begin
											tm := tc.MData;
											ts := TMob.Create;
											if td.Effect = 10 then begin
												{ChrstphrR - 2004/04/20 - design change}
												// L = ID of
												L := SummonMobList.RandomChoice;
												str := (MobDB.Objects[MobDB.IndexOf(L)] AS TMobDB).Name;
												//Fill Mob Data.
												ts.Data := MobDBName.Objects[MobDBName.IndexOf(str)] as TMobDB;
												ts.ID := NowMobID;
												Inc(NowMobID);
											end else begin //MVP list
												{ChrstphrR - Fixed in format of other Summon???Lists}
												if SummonMobListMVP.Count > 0 then begin
													L := Random(SummonMobListMVP.Count);
													str := SummonMobListMVP[L];
													//Fill Mob Data.
													ts.Data := MobDBName.Objects[MobDBName.IndexOf(str)] as TMobDB;
													ts.ID := NowMobID;
													Inc(NowMobID);
												end;
											end;

											if (SummonMonsterName = true) then begin
												ts.Name := ts.Data.JName;
											end else begin
												ts.Name := 'Summon Monster';
											end;

											if (SummonMonsterAgo = true) then begin
												ts.isActive := true;
											end else begin
												ts.isActive := ts.Data.isActive;
											end;

											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] <> 1) and (tm.gat[ts.Point.X, ts.Point.Y] <> 5))  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.isActive := true;

											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;
												end;
												ts.MVPDist[0].Dmg := ts.Data.HP * 30 div 100; //FA偵30%壛嶼
											end;

											// Link monster to Map it's now on.
											tm.Mob.AddObject(ts.ID, ts); //Owned here.
											tm.Block[ts.Point.X div 8][ts.Point.Y div 8].Mob.AddObject(ts.ID, ts);

											ts.isSummon := True;
											ts.EmperiumID := 0;

											SendMData(tc.Socket, ts);
											//廃埻偵憲怣
											SendBCmd(tm,ts.Point,41,tc,False);
											b := 1;
										end;
									end;
								end;
							11,12,13,14: //惵敔丄巼敔丄僇乕僪挓丄僾儗敔
								begin
									UseUsableItem(tc, w);

									str := '';
									case td.Effect of
									11: //惵敔
										begin
											if (SummonIOBList.Count > 0) then begin
												str := SummonIOBList[Random(SummonIOBList.Count)];
											end;
										end;
									12: //巼敔
										begin
											if (SummonIOVList.Count > 0) then begin
												str := SummonIOVList[Random(SummonIOVList.Count)];
											end;
										end;
									13: //僇乕僪挓
										begin
											if (SummonICAList.Count > 0) then begin
												str := SummonICAList[Random(SummonICAList.Count)];
											end;
										end;
									14: //僾儗敔
										begin
											if (SummonIGBList.Count > 0) then begin
												str := SummonIGBList[Random(SummonIGBList.Count)];
											end;
										end;
									200:  //New --- Old Weapon Box

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -