当前位置: 首页>>代码示例>>C#>>正文


C# GSPacketIn.ReadInt方法代码示例

本文整理汇总了C#中GSPacketIn.ReadInt方法的典型用法代码示例。如果您正苦于以下问题:C# GSPacketIn.ReadInt方法的具体用法?C# GSPacketIn.ReadInt怎么用?C# GSPacketIn.ReadInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GSPacketIn的用法示例。


在下文中一共展示了GSPacketIn.ReadInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            uint x = packet.ReadInt();
            uint y = packet.ReadInt();
            ushort id = packet.ReadShort();
            ushort item_slot = packet.ReadShort();

            if (client.Player.TargetObject == null)
            {
                client.Out.SendMessage("You must select an NPC to sell to.", eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
                return;
            }

            lock (client.Player.Inventory)
            {
                InventoryItem item = client.Player.Inventory.GetItem((eInventorySlot)item_slot);
                if (item == null)
                    return;

                int itemCount = Math.Max(1, item.Count);
                int packSize = Math.Max(1, item.PackSize);

                if (client.Player.TargetObject is GameMerchant)
                {
                    //Let the merchant choos how to handle the trade.
                    ((GameMerchant)client.Player.TargetObject).OnPlayerSell(client.Player, item);
                }
                else if (client.Player.TargetObject is GameLotMarker)
                {
                    ((GameLotMarker)client.Player.TargetObject).OnPlayerSell(client.Player, item);
                }
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:33,代码来源:PlayerSellRequestHandler.cs

示例2: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			uint X = packet.ReadInt();
			uint Y = packet.ReadInt();
			ushort id = packet.ReadShort();
			ushort item_slot = packet.ReadShort();

			new AppraiseActionHandler(client.Player, item_slot).Start(1);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:9,代码来源:PlayerAppraiseItemRequestHandler.cs

示例3: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			var groundX = (int) packet.ReadInt();
			var groundY = (int) packet.ReadInt();
			var groundZ = (int) packet.ReadInt();
			ushort flag = packet.ReadShort();
//			ushort unk2 = packet.ReadShort();

			new ChangeGroundTargetHandler(client.Player, groundX, groundY, groundZ, flag).Start(1);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:10,代码来源:PlayerGroundTargetHandler.cs

示例4: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			// packet.Skip(10);
			uint playerX = packet.ReadInt();
			uint playerY = packet.ReadInt();
			int sessionId = packet.ReadShort();
			ushort targetOid = packet.ReadShort();

            //TODO: utilize these client-sent coordinates to possibly check for exploits which are spoofing position packets but not spoofing them everywhere
			new InteractActionHandler(client.Player, targetOid).Start(1);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:11,代码来源:ObjectInteractRequestHandler.cs

示例5: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player == null)
                return;

            int slot = packet.ReadByte();
            int unk1 = packet.ReadByte();
            ushort unk2 = packet.ReadShort();
            uint price = packet.ReadInt();
            GameConsignmentMerchant con = client.Player.ActiveConMerchant;
            House house = HouseMgr.GetHouse(con.HouseNumber);
            if (house == null)
                return;
            if (!house.HasOwnerPermissions(client.Player))
                return;
            int dbSlot = (int)eInventorySlot.Consignment_First + slot;
            InventoryItem item = GameServer.Database.SelectObject<InventoryItem>("OwnerID = '" + client.Player.DBCharacter.ObjectId + "' AND SlotPosition = '" + dbSlot.ToString() + "'");
            if (item != null)
            {
                item.SellPrice = (int)price;
                GameServer.Database.SaveObject(item);
            }
            else
            {
                client.Player.TempProperties.setProperty(NEW_PRICE, (int)price);
            }

            // another update required here,currently the player needs to reopen the window to see the price, thats why we msg him
            client.Out.SendMessage("New price set! (open the merchant window again to see the price)", eChatType.CT_System, eChatLoc.CL_SystemWindow);
        }
开发者ID:boscorillium,项目名称:dol,代码行数:30,代码来源:PlayerSetMarketPrice.cs

示例6: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			lock (this)
			{
				string dllName = packet.ReadString(16);
				packet.Position = 0x50;
				uint upTime = packet.ReadInt();
				string text = string.Format("Client crash ({0}) dll:{1} clientUptime:{2}sec", client.ToString(), dllName, upTime);
				if (log.IsInfoEnabled)
					log.Info(text);

				if (log.IsDebugEnabled)
				{
					log.Debug("Last client sent/received packets (from older to newer):");
					
					foreach (IPacket prevPak in client.PacketProcessor.GetLastPackets())
					{
						log.Info(prevPak.ToHumanReadable());
					}
				}
					
				//Eden
				if(client.Player!=null)
				{
					GamePlayer player = client.Player;
					client.Out.SendPlayerQuit(true);
					client.Player.SaveIntoDatabase();
					client.Player.Quit(true);
					client.Disconnect();
				}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:32,代码来源:ClientCrashPacketHandler.cs

示例7: HandlePacket

		/// <summary>
		/// Called when the packet has been received
		/// </summary>
		/// <param name="client">Client that sent the packet</param>
		/// <param name="packet">Packet data</param>
		/// <returns>Non zero if function was successfull</returns>
		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			packet.Skip(4); //Skip the first 4 bytes
			long pingDiff = (DateTime.Now.Ticks - client.PingTime)/1000;
			client.PingTime = DateTime.Now.Ticks;
			ulong timestamp = packet.ReadInt();

			client.Out.SendPingReply(timestamp,packet.Sequence);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:15,代码来源:PingRequestHandler.cs

示例8: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			if (client.Player == null)
				return;

			uint X = packet.ReadInt();
			uint Y = packet.ReadInt();
			ushort id = packet.ReadShort();
			ushort item_slot = packet.ReadShort();
			byte item_count = (byte)packet.ReadByte();
			byte menu_id = (byte)packet.ReadByte();

			switch ((eMerchantWindowType)menu_id)
			{
				case eMerchantWindowType.HousingInsideShop:
				case eMerchantWindowType.HousingOutsideShop:
				case eMerchantWindowType.HousingBindstoneHookpoint:
				case eMerchantWindowType.HousingCraftingHookpoint:
				case eMerchantWindowType.HousingNPCHookpoint:
				case eMerchantWindowType.HousingVaultHookpoint:
					{
						HouseMgr.BuyHousingItem(client.Player, item_slot, item_count, (eMerchantWindowType)menu_id);
						break;
					}
				default:
					{
						if (client.Player.TargetObject == null)
							return;

						//Forward the buy process to the merchant
						if (client.Player.TargetObject is GameMerchant)
						{
							//Let merchant choose what happens
							((GameMerchant)client.Player.TargetObject).OnPlayerBuy(client.Player, item_slot, item_count);
						}
						else if (client.Player.TargetObject is GameLotMarker)
						{
							((GameLotMarker)client.Player.TargetObject).OnPlayerBuy(client.Player, item_slot, item_count);
						}
						break;
					}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:43,代码来源:PlayerBuyRequestHandler.cs

示例9: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player == null)
                return;
            uint X = packet.ReadInt();
            uint Y = packet.ReadInt();
            ushort id = (ushort)packet.ReadShort();
            ushort obj = (ushort)packet.ReadShort();

            GameObject target = client.Player.TargetObject;
            if (target == null)
            {
                client.Out.SendMessage(LanguageMgr.GetTranslation(client, "PlayerPickUpRequestHandler.HandlePacket.Target"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            if (target.ObjectState != GameObject.eObjectState.Active)
            {
                client.Out.SendMessage(LanguageMgr.GetTranslation(client, "PlayerPickUpRequestHandler.HandlePacket.InvalidTarget"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            client.Player.PickupObject(target, false);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:23,代码来源:PlayerPickUpRequestHandler.cs

示例10: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client == null || client.Player == null)
                return;

            int slot = packet.ReadByte();
            int unk1 = packet.ReadByte();
            ushort unk2 = packet.ReadShort();
            uint price = packet.ReadInt();

            // ChatUtil.SendDebugMessage(client.Player, "PlayerSetMarketPriceHandler");

            // only IGameInventoryObjects can handle set price commands
            if (client.Player.TargetObject == null || (client.Player.TargetObject is IGameInventoryObject) == false)
                return;

            (client.Player.TargetObject as IGameInventoryObject).SetSellPrice(client.Player, (ushort)slot, price);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:18,代码来源:PlayerSetMarketPrice.cs

示例11: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            // A trainer of the appropriate class must be around (or global trainer, with TrainedClass = eCharacterClass.Unknow
            GameTrainer trainer = client.Player.TargetObject as DOL.GS.GameTrainer;
            if (trainer == null || (trainer.CanTrain(client.Player) == false && trainer.CanTrainChampionLevels(client.Player) == false))
            {
                client.Out.SendMessage("You must select a valid trainer for your class.", eChatType.CT_Important, eChatLoc.CL_ChatWindow);
                return;
            }

            //Specializations - 8 trainable specs max
            uint size = 8;
            long position = packet.Position;
            IList<uint> skills = new List<uint>();
            Dictionary<uint, uint> amounts = new Dictionary<uint, uint>();
            bool stop = false;
            for (uint i = 0; i < size; i++)
            {
                uint code = packet.ReadInt();
                if (!stop)
                {
                    if (code == 0xFFFFFFFF) stop = true;
                    else
                    {
                        if (!skills.Contains(code))
                            skills.Add(code);
                    }
                }
            }

            foreach (uint code in skills)
            {
                uint val = packet.ReadInt();

                if (!amounts.ContainsKey(code) && val > 1)
                    amounts.Add(code, val);
            }

            IList specs = client.Player.GetSpecList();
            uint skillcount = 0;
            IList<string> done = new List<string>();
            bool trained = false;

            // Graveen: the trainline command is called
            foreach (Specialization spec in specs)
            {
                if (amounts.ContainsKey(skillcount))
                {
                    if (spec.Level < amounts[skillcount])
                    {
                        TrainCommandHandler train = new TrainCommandHandler(true);
                        train.OnCommand(client, new string[] { "&trainline", spec.KeyName, amounts[skillcount].ToString() });
                        trained = true;
                    }
                }
                skillcount++;
            }

            //RealmAbilities
            packet.Seek(position + 64, System.IO.SeekOrigin.Begin);
            size = 50;//50 RA's max?
            amounts.Clear();
            for (uint i = 0; i < size; i++)
            {
                uint val = packet.ReadInt();

                if (val > 0 && !amounts.ContainsKey(i))
                {
                    amounts.Add(i, val);
                }
            }
            uint index = 0;
            if (amounts != null && amounts.Count > 0)
            {
                List<RealmAbility> ras = SkillBase.GetClassRealmAbilities(client.Player.CharacterClass.ID);
                foreach (RealmAbility ra in ras)
                {
                    if (ra is RR5RealmAbility)
                        continue;

                    if (amounts.ContainsKey(index))
                    {
                        RealmAbility playerRA = (RealmAbility)client.Player.GetAbility(ra.KeyName);
                        if (playerRA != null
                            && (playerRA.Level >= ra.MaxLevel || playerRA.Level >= amounts[index]))
                        {
                            index++;
                            continue;
                        }

                        int cost = 0;
                        for (int i = playerRA != null ? playerRA.Level : 0; i < amounts[index]; i++)
                            cost += ra.CostForUpgrade(i);
                        if (client.Player.RealmSpecialtyPoints < cost)
                        {
                            client.Out.SendMessage(ra.Name + " costs " + (cost) + " realm ability points!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                            client.Out.SendMessage("You don't have that many realm ability points left to get this.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                            index++;
                            continue;
                        }
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:101,代码来源:PlayerTrainRequestHandler.cs

示例12: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
            if (client.Account.PrivLevel == (int)ePrivLevel.Player)
            {
                GameTrainer trainer = client.Player.TargetObject as DOL.GS.GameTrainer;
                if (trainer == null || (trainer.CanTrain(client.Player) == false && trainer.CanTrainChampionLevels(client.Player) == false))
                {
                    client.Out.SendMessage("You must select a valid trainer for your class.", eChatType.CT_Important, eChatLoc.CL_ChatWindow);
                    return;
                }
            }

			uint x = packet.ReadInt();
			uint y = packet.ReadInt();
			int idLine = packet.ReadByte();
			int unk = packet.ReadByte();
			int row = packet.ReadByte();
			int skillIndex = packet.ReadByte();

			// idline not null so this is a Champion level training window
			if (idLine > 0)
			{
				if (row > 0 && skillIndex > 0)
				{
					// Get Player CL Spec
					var clspec = client.Player.GetSpecList().Where(sp => sp is LiveChampionsSpecialization).Cast<LiveChampionsSpecialization>().FirstOrDefault();
					
					// check if the tree can be used
					List<Tuple<MiniLineSpecialization, List<Tuple<Skill, byte>>>> tree = null;
					if (clspec != null)
					{
						tree = clspec.GetTrainerTreeDisplay(client.Player, clspec.RetrieveTypeForIndex(idLine));
					}
					
					if (tree != null)
					{
						Tuple<byte, MiniLineSpecialization> skillstatus = clspec.GetSkillStatus(tree, row-1, skillIndex-1);

						if (skillstatus.Item1 == 1)
						{
							client.Out.SendMessage("You already have that ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
							return;
						}
						if (skillstatus.Item1 != 2)
						{
							client.Out.SendMessage("You do not meet the requirements for that ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
							return;
						}
						if (client.Player.ChampionSpecialtyPoints < 1)
						{
							client.Out.SendMessage("You do not have enough champion specialty points for that ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
							return;
						}
						
						skillstatus.Item2.Level++;
						client.Player.AddSpecialization(skillstatus.Item2);
						client.Player.RefreshSpecDependantSkills(false);
						client.Player.Out.SendUpdatePlayer();
						client.Player.Out.SendUpdatePoints();
						client.Player.Out.SendUpdatePlayerSkills();
						client.Player.UpdatePlayerStatus();
						client.Player.Out.SendChampionTrainerWindow(idLine);

						return;
					}
					else
					{
						client.Out.SendMessage("Could not find Champion Spec!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
						log.ErrorFormat("Could not find Champion Spec idline {0}, row {1}, skillindex {2}", idLine, row, skillIndex);
					}
				}
			}
			else
			{
				// Trainable Specs or RA's
				IList<Specialization> speclist = client.Player.GetSpecList().Where(e => e.Trainable).ToList();

				if (skillIndex < speclist.Count)
				{
					Specialization spec = (Specialization)speclist[skillIndex];
					if (spec.Level >= client.Player.BaseLevel)
					{
						client.Out.SendMessage("You can't train in this specialization again this level!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
						return;
					}

					// Graveen - autotrain 1.87 - allow players to train their AT specs even if no pts left
					int temp = client.Player.SkillSpecialtyPoints + client.Player.GetAutoTrainPoints(spec, 2);

					if (temp >= spec.Level + 1)
					{
						spec.Level++;
						client.Player.OnSkillTrained(spec);

						client.Out.SendUpdatePoints();
						client.Out.SendTrainerWindow();
						return;
					}
					else
					{
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:PlayerTrainRequestHandler.cs

示例13: HandlePacket

        /// <summary>
        /// door index which is unique
        /// </summary>
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            var doorID = (int)packet.ReadInt();
            m_handlerDoorID = doorID;
            var doorState = (byte)packet.ReadByte();
            int doorType = doorID / 100000000;

            int radius = ServerProperties.Properties.WORLD_PICKUP_DISTANCE * 2;
            int zoneDoor = (int)(doorID / 1000000);

            string debugText = "";

            // For ToA the client always sends the same ID so we need to construct an id using the current zone
            if (client.Player.CurrentRegion.Expansion == (int)eClientExpansion.TrialsOfAtlantis)
            {
                debugText = "ToA DoorID: " + doorID + " ";

                doorID -= zoneDoor * 1000000;
                zoneDoor = client.Player.CurrentZone.ID;
                doorID += zoneDoor * 1000000;
                m_handlerDoorID = doorID;

                // experimental to handle a few odd TOA door issues
                if (client.Player.CurrentRegion.IsDungeon)
                    radius *= 4;
            }

            // debug text
            if (client.Account.PrivLevel > 1 || Properties.ENABLE_DEBUG)
            {
                if (doorType == 7)
                {
                    int ownerKeepId = (doorID / 100000) % 1000;
                    int towerNum = (doorID / 10000) % 10;
                    int keepID = ownerKeepId + towerNum * 256;
                    int componentID = (doorID / 100) % 100;
                    int doorIndex = doorID % 10;
                    client.Out.SendDebugMessage(
                        "Keep Door ID: {0} state:{1} (Owner Keep: {6} KeepID:{2} ComponentID:{3} DoorIndex:{4} TowerNumber:{5})", doorID,
                        doorState, keepID, componentID, doorIndex, towerNum, ownerKeepId);
                }
                else if (doorType == 9)
                {
                    int doorIndex = doorID - doorType * 10000000;
                    client.Out.SendDebugMessage("House DoorID:{0} state:{1} (doorType:{2} doorIndex:{3})", doorID, doorState, doorType,
                                                doorIndex);
                }
                else
                {
                    int fixture = (doorID - zoneDoor * 1000000);
                    int fixturePiece = fixture;
                    fixture /= 100;
                    fixturePiece = fixturePiece - fixture * 100;

                    client.Out.SendDebugMessage("{6}DoorID:{0} state:{1} zone:{2} fixture:{3} fixturePiece:{4} Type:{5}",
                                                doorID, doorState, zoneDoor, fixture, fixturePiece, doorType, debugText);
                }
            }

            var target = client.Player.TargetObject as GameDoor;

            if (target != null && !client.Player.IsWithinRadius(target, radius))
            {
                client.Player.Out.SendMessage("You are too far to open this door", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                return;
            }

            var door = GameServer.Database.SelectObject<DBDoor>("InternalID = '" + doorID + "'");

            if (door != null)
            {
                if (doorType == 7 || doorType == 9)
                {
                    new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1);
                    return;
                }

                if (client.Account.PrivLevel == 1)
                {
                    if (door.Locked == 0)
                    {
                        if (door.Health == 0)
                        {
                            new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1);
                            return;
                        }

                        if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_PvP)
                        {
                            if (door.Realm != 0)
                            {
                                new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1);
                                return;
                            }
                        }

                        if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_Normal)
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:101,代码来源:DoorRequestHandler.cs

示例14: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			if (client == null || client.Player == null)
				return;

			if ((client.Player.TargetObject is IGameInventoryObject) == false)
				return;

			MarketSearch.SearchData search = new MarketSearch.SearchData();

			search.name = packet.ReadString(64);
			search.slot = (int)packet.ReadInt();
			search.skill = (int)packet.ReadInt();
			search.resist = (int)packet.ReadInt();
			search.bonus = (int)packet.ReadInt();
			search.hp = (int)packet.ReadInt();
			search.power = (int)packet.ReadInt();
			search.proc = (int)packet.ReadInt();
			search.qtyMin = (int)packet.ReadInt();
			search.qtyMax = (int)packet.ReadInt();
			search.levelMin = (int)packet.ReadInt();
			search.levelMax = (int)packet.ReadInt();
			search.priceMin = (int)packet.ReadInt();
			search.priceMax = (int)packet.ReadInt();
			search.visual = (int)packet.ReadInt();
			search.page = (byte)packet.ReadByte();
			byte unk1 = (byte)packet.ReadByte();
			short unk2 = (short)packet.ReadShort();
			byte unk3 = 0;
			byte unk4 = 0;
			byte unk5 = 0;
			byte unk6 = 0;
			byte unk7 = 0;
			byte unk8 = 0;

			if (client.Version >= GameClient.eClientVersion.Version198)
			{
				// Dunnerholl 2009-07-28 Version 1.98 introduced new options to Market search. 12 Bytes were added, but only 7 are in usage so far in my findings.
				// update this, when packets change and keep in mind, that this code reflects only the 1.98 changes
				search.armorType = search.page; // page is now used for the armorType (still has to be logged, i just checked that 2 means leather, 0 = standard
				search.damageType = (byte)packet.ReadByte(); // 1=crush, 2=slash, 3=thrust
				unk3 = (byte)packet.ReadByte();
				unk4 = (byte)packet.ReadByte();
				unk5 = (byte)packet.ReadByte();
				search.playerCrafted = (byte)packet.ReadByte(); // 1 = show only Player crafted, 0 = all
				// 3 bytes unused
				packet.Skip(3);
				search.page = (byte)packet.ReadByte(); // page is now sent here
				unk6 = (byte)packet.ReadByte();
				unk7 = (byte)packet.ReadByte();
				unk8 = (byte)packet.ReadByte();
			}

			search.clientVersion = client.Version.ToString();

			(client.Player.TargetObject as IGameInventoryObject).SearchInventory(client.Player, search);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:57,代码来源:PlayerMarketSearchRequestHandler.cs

示例15: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			if (client == null || client.Player == null) 
				return;

			ushort objectType = packet.ReadShort();

			uint extraID = 0;
			if (client.Version >= GameClient.eClientVersion.Version186)
			{
				extraID = packet.ReadInt();
			}

			ushort objectID = packet.ReadShort();

			string caption = "";
			var objectInfo = new List<string>();

			/*
			Type    Description         Id
			1       Inventory item      Slot (ie. 0xC for 2 handed weapon)
			2       Spell               spell level + spell line ID * 100 (starting from 0)
			3       ???
			4       Merchant item       Slot (divide by 30 to get page)
			5       Buff/effect         The buff id (each buff has a unique id)
			6       Style               style list index = ID-100-abilities count
			7       Trade window        position in trade window (starting form 0)
			8       Ability             100+position in players abilities list (?)
			9       Trainers skill      position in trainers window list
			10		Market Search		slot?
			19		Reward Quest
			 */

			ChatUtil.SendDebugMessage(client, string.Format("Delve objectType={0}, objectID={1}, extraID={2}", objectType, objectID, extraID));

			ItemTemplate item = null;
			InventoryItem invItem = null;

			var snapSkills = client.Player.GetAllUsableSkills();
			var snapLists = client.Player.GetAllUsableListSpells();
			// find the first non-specialization index.
			int indexAtSpecOid = Math.Max(0, snapSkills.FindIndex(it => (it.Item1 is Specialization) == false)) + (objectID - 100);
			
			switch (objectType)
			{
					#region Inventory Item
				case 1: //Display Infos on inventory item
				case 10: // market search
					{
						if (objectType == 1)
						{
							IGameInventoryObject invObject = client.Player.TargetObject as IGameInventoryObject;

							// first try any active inventory object
							if (invItem == null)
							{
								if (client.Player.ActiveInventoryObject != null)
								{
									invObject = client.Player.ActiveInventoryObject;

									if (invObject != null && invObject.GetClientInventory(client.Player) != null)
									{
										invObject.GetClientInventory(client.Player).TryGetValue(objectID, out invItem);
									}
								}
							}

							// finally try direct inventory access
							if (invItem == null)
							{
								invItem = client.Player.Inventory.GetItem((eInventorySlot)objectID);
							}

							// Failed to get any inventory
							if (invItem == null)
								return;

						}
						else if (objectType == 10)
						{
							List<InventoryItem> list = client.Player.TempProperties.getProperty<object>(MarketExplorer.EXPLORER_ITEM_LIST, null) as List<InventoryItem>;
							if (list == null)
							{
								list = client.Player.TempProperties.getProperty<object>("TempSearchKey", null) as List<InventoryItem>;
								if (list == null)
									return;
							}

							if (objectID >= list.Count)
								return;

							invItem = list[objectID];

							if (invItem == null)
								return;
						}

						// Aredhel: Start of a more sophisticated item delve system.
						// The idea is to have every item inherit from an item base class,
						// this base class will provide a method
//.........这里部分代码省略.........
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:101,代码来源:DetailDisplayHandler.cs


注:本文中的GSPacketIn.ReadInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。