• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GSPacketIn类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string localIP = packet.ReadString(22);
			ushort localPort = packet.ReadShort();
			client.LocalIP = localIP;
			client.Out.SendUDPInitReply();
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:7,代码来源:UDPInitRequestHandler.cs


示例2: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int flagSpeedData = packet.ReadShort();
			int heading = packet.ReadShort();

			if (client.Version > GameClient.eClientVersion.Version171)
			{
				int xOffsetInZone = packet.ReadShort();
				int yOffsetInZone = packet.ReadShort();
				int currentZoneID = packet.ReadShort();
				int realZ = packet.ReadShort();

				Zone newZone = WorldMgr.GetZone((ushort) currentZoneID);
				if (newZone == null)
				{
					if (Log.IsWarnEnabled)
						Log.Warn("Unknown zone in UseSpellHandler: " + currentZoneID + " player: " + client.Player.Name);
				}
				else
				{
					client.Player.X = newZone.XOffset + xOffsetInZone;
					client.Player.Y = newZone.YOffset + yOffsetInZone;
					client.Player.Z = realZ;
					client.Player.MovementStartTick = Environment.TickCount;
				}
			}

			int spellLevel = packet.ReadByte();
			int spellLineIndex = packet.ReadByte();

			client.Player.Heading = (ushort) (heading & 0xfff);

			new UseSpellAction(client.Player, flagSpeedData, spellLevel, spellLineIndex).Start(1);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:34,代码来源:UseSpellHandler.cs


示例3: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int rc4 = packet.ReadByte();
			byte clientType = (byte)packet.ReadByte();
			client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
			client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
			byte major = (byte)packet.ReadByte();
			byte minor = (byte)packet.ReadByte();
			byte build = (byte)packet.ReadByte();
			if(rc4==1)
			{
				//DOLConsole.Log("SBox=\n");
				//DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
				packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256);
				((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
				//DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
				//DOLConsole.Log("SBox=\n");
				//DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
			}
			else
			{
			  //Send the crypt key to the client
				client.Out.SendVersionAndCryptKey();
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:25,代码来源:CryptKeyRequestHandler.cs


示例4: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			ushort id = packet.ReadShort();
//			GameNPC npc = (GameNPC)WorldMgr.GetObjectTypeByIDFromRegion(client.Player.CurrentRegionID, id, typeof(GameNPC));
			if(client.Player==null) return;
			Region region = client.Player.CurrentRegion;
			if (region == null) return;
			GameNPC npc = region.GetObject(id) as GameNPC;

			if(npc != null)
			{
				Tuple<ushort, ushort> key = new Tuple<ushort, ushort>(npc.CurrentRegionID, (ushort)npc.ObjectID);
				
				long updatetime;
				if (!client.GameObjectUpdateArray.TryGetValue(key, out updatetime))
				{
					updatetime = 0;
				}
				
				client.Out.SendNPCCreate(npc);
				// override update from npc create as this is a client request !
				if (updatetime > 0)
					client.GameObjectUpdateArray[key] = updatetime;
				
				if(npc.Inventory != null)
					client.Out.SendLivingEquipmentUpdate(npc);
				
				//DO NOT SEND A NPC UPDATE, it is done in Create anyway
				//Sending a Update causes a UDP packet to be sent and
				//the client will get the UDP packet before the TCP Create packet
				//Causing the client to issue another NPC CREATION REQUEST!
				//client.Out.SendNPCUpdate(npc); <-- BIG NO NO
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:34,代码来源:NPCCreationRequestHandler.cs


示例5: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string name=packet.ReadString(30);
			//TODO do bad name checks here from some database with
			//bad names, this is just a temp testthing here
			bool bad = false;

			ArrayList names = GameServer.Instance.InvalidNames;

			foreach(string s in names)
			{
				if(name.ToLower().IndexOf(s) != -1)
				{
					bad = true;
					break;
				}
			}

			//if(bad)
			//DOLConsole.WriteLine(String.Format("Name {0} is bad!",name));
			//else
			//DOLConsole.WriteLine(String.Format("Name {0} seems to be a good name!",name));

			client.Out.SendBadNameCheckReply(name,bad);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:25,代码来源:BadNameCheckRequestHandler.cs


示例6: 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


示例7: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            ushort unk1 = packet.ReadShort();
            ushort questIndex = packet.ReadShort();
            ushort unk2 = packet.ReadShort();
            ushort unk3 = packet.ReadShort();

            AbstractQuest quest = null;

            int index = 0;
            lock (client.Player.QuestList)
            {
                foreach (AbstractQuest q in client.Player.QuestList)
                {
                    // ignore completed quests
                    if (q.Step == -1)
                        continue;

                    if (index == questIndex)
                    {
                        quest = q;
                        break;
                    }

                    index++;
                }
            }

            if (quest != null)
                quest.AbortQuest();
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:31,代码来源:QuestRemoveRequestHandler.cs


示例8: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int permissionSlot = packet.ReadByte();
			int newPermissionLevel = packet.ReadByte();
			ushort houseNumber = packet.ReadShort();

			// house is null, return
			var house = HouseMgr.GetHouse(houseNumber);
			if (house == null)
				return;

			// player is null, return
			if (client.Player == null)
				return;

			// can't set permissions unless you're the owner.
			if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1)
				return;

			// check if we're setting or removing permissions
			if (newPermissionLevel == 100)
			{
				house.RemovePermission(permissionSlot);
			}
			else
			{
				house.AdjustPermissionSlot(permissionSlot, newPermissionLevel);
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:29,代码来源:HouseUsersPermissionsSetHandler.cs


示例9: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			var aggroState = (byte) packet.ReadByte(); // 1-Aggressive, 2-Deffensive, 3-Passive
			var walkState = (byte) packet.ReadByte(); // 1-Follow, 2-Stay, 3-GoTarg, 4-Here
			var command = (byte) packet.ReadByte(); // 1-Attack, 2-Release

			//[Ganrod] Nidel: Animist can removed his TurretFnF without MainPet.
			if (client.Player.TargetObject != null && command == 2 && client.Player.ControlledBrain == null &&
			    client.Player.CharacterClass.ID == (int) eCharacterClass.Animist)
			{
				var turret = client.Player.TargetObject as TurretPet;
				if (turret != null && turret.Brain is TurretFNFBrain && client.Player.IsControlledNPC(turret))
				{
					//release
					new HandlePetCommandAction(client.Player, 0, 0, 2).Start(1);
					return;
				}
			}

			//[Ganrod] Nidel: Call only if player has controllednpc
			if (client.Player.ControlledBrain != null)
			{
				new HandlePetCommandAction(client.Player, aggroState, walkState, command).Start(1);
				return;
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:26,代码来源:PetWindowHandler.cs


示例10: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            ushort keepId = packet.ReadShort();
            ushort wallId = packet.ReadShort();
            ushort responce = packet.ReadShort();
            int HPindex = packet.ReadShort();

            AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId);

            if (keep == null || !(GameServer.ServerRules.IsSameRealm(client.Player, (GameKeepComponent)keep.KeepComponents[wallId], true) || client.Account.PrivLevel > 1))
                return;

            if (responce == 0x00)//show info
                client.Out.SendKeepComponentInteract(((GameKeepComponent)keep.KeepComponents[wallId]));
            else if (responce == 0x01)// click on hookpoint button
                client.Out.SendKeepComponentHookPoint(((GameKeepComponent)keep.KeepComponents[wallId]), HPindex);
            else if (responce == 0x02)//select an hookpoint
            {
                if (client.Account.PrivLevel > 1)
                    client.Out.SendMessage("DEBUG : selected hookpoint id " + HPindex, eChatType.CT_Say, eChatLoc.CL_SystemWindow);

                GameKeepComponent hp = keep.KeepComponents[wallId] as GameKeepComponent;
                client.Out.SendClearKeepComponentHookPoint(hp, HPindex);
                client.Out.SendHookPointStore(hp.HookPoints[HPindex] as GameKeepHookPoint);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:26,代码来源:KeepComponentInteractHandler.cs


示例11: HandlePacket

		//rewritten by Corillian so if it doesn't work you know who to yell at ;)
		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			byte grouped = (byte)packet.ReadByte();
			ArrayList list = new ArrayList();
			if (grouped != 0x00)
			{
				ArrayList groups = GroupMgr.ListGroupByStatus(0x00);
				if (groups != null)
				{
					foreach (Group group in groups)
						if (GameServer.ServerRules.IsAllowedToGroup(group.Leader, client.Player, true))
						{
							list.Add(group.Leader);
						}
				}
			}

			ArrayList Lfg = GroupMgr.LookingForGroupPlayers();

			if (Lfg != null)
			{
				foreach (GamePlayer player in Lfg)
				{
					if (player != client.Player && GameServer.ServerRules.IsAllowedToGroup(client.Player, player, true))
					{
						list.Add(player);
					}
				}
			}

			client.Out.SendFindGroupWindowUpdate((GamePlayer[])list.ToArray(typeof(GamePlayer)));
		}
开发者ID:boscorillium,项目名称:dol,代码行数:33,代码来源:LookingForAGroupHandler.cs


示例12: 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


示例13: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			ushort keepId = packet.ReadShort();
			ushort wallId = packet.ReadShort();
			int hookpointID = packet.ReadShort();
            ushort itemslot = packet.ReadShort();
			int payType = packet.ReadByte();//gold RP BP contrat???
			int unk2 = packet.ReadByte();
			int unk3 = packet.ReadByte();
			int unk4 = packet.ReadByte();
//			client.Player.Out.SendMessage("x="+unk2+"y="+unk3+"z="+unk4,eChatType.CT_Say,eChatLoc.CL_SystemWindow);
			AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId);
			if (keep == null) return;
			GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent;
			if (component == null) return;
			/*GameKeepHookPoint hookpoint = component.HookPoints[hookpointID] as GameKeepHookPoint;
			if (hookpoint == null) return 1;
			*/
			HookPointInventory inventory = null;
			if(hookpointID > 0x80) inventory = HookPointInventory.YellowHPInventory; //oil
			else if(hookpointID > 0x60) inventory = HookPointInventory.GreenHPInventory;//big siege
			else if(hookpointID > 0x40) inventory = HookPointInventory.LightGreenHPInventory; //small siege
			else if (hookpointID > 0x20) inventory = HookPointInventory.BlueHPInventory;//npc
			else inventory = HookPointInventory.RedHPInventory;//guard

			if (inventory != null)
			{
				HookPointItem item = inventory.GetItem(itemslot);
				if (item != null)
					item.Invoke(client.Player, payType, component.HookPoints[hookpointID] as GameKeepHookPoint, component);
			}
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:32,代码来源:BuyHookPointHandler.cs


示例14: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			ushort housenumber = packet.ReadShort();
			var index = (byte) packet.ReadByte();
			var unk1 = (byte) packet.ReadByte();

			// house is null, return
			var house = HouseMgr.GetHouse(housenumber);
			if (house == null)
				return;

			// player is null, return
			if (client.Player == null)
				return;

			// rotation only works for inside items
			if (!client.Player.InHouse)
				return;

			// no permission to change the interior, return
			if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add))
				return;

			var pak = new GSTCPPacketOut(client.Out.GetPacketCode(eServerPackets.HouseDecorationRotate));
			pak.WriteShort(housenumber);
			pak.WriteByte(index);
			pak.WriteByte(0x01);
			client.Out.SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:29,代码来源:HousingDecorationRotateRequestHandler.cs


示例15: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            packet.Skip(4);
            int slot = packet.ReadShort();
            InventoryItem item = client.Player.Inventory.GetItem((eInventorySlot)slot);
            if (item != null)
            {
                if (item.IsIndestructible)
                {
                    client.Out.SendMessage(String.Format("You can't destroy {0}!",
                        item.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (item.Id_nb == "ARelic")
                {
                    client.Out.SendMessage("You cannot destroy a relic!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (client.Player.Inventory.EquippedItems.Contains(item))
                {
                    client.Out.SendMessage("You cannot destroy an equipped item!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (client.Player.Inventory.RemoveItem(item))
                {
                    client.Out.SendMessage("You destroy the " + item.Name + ".", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    InventoryLogging.LogInventoryAction(client.Player, "(destroy)", eInventoryActionType.Other, item.Template, item.Count);
                }
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:33,代码来源:DestroyItemRequestHandler.cs


示例16: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			ushort playerID = packet.ReadShort(); // no use for that.

			// house is null, return
			var house = client.Player.CurrentHouse;
			if(house == null)
				return;

			// grab all valid changes
			var changes = new List<int>();
			for (int i = 0; i < 10; i++)
			{
				int swtch = packet.ReadByte();
				int change = packet.ReadByte();

				if (swtch != 255)
				{
					changes.Add(change);
				}
			}

			// apply changes
			if (changes.Count > 0)
			{
				house.Edit(client.Player, changes);
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:28,代码来源:HouseEditHandler.cs


示例17: 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


示例18: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int unk1 = packet.ReadByte();
			int position = packet.ReadByte();
			ushort housenumber = packet.ReadShort();
			ushort angle = packet.ReadShort();
			ushort unk2 = packet.ReadShort();

			// rotation only works for inside items
			if (!client.Player.InHouse)
				return;

			// house is null, return
			var house = HouseMgr.GetHouse(housenumber);
			if (house == null)
				return;

			// player is null, return
			if (client.Player == null)
				return;

			// no permission to change the interior, return
			if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add))
				return;

			if (house.IndoorItems.ContainsKey(position) == false)
				return;

			// grab the item in question
			IndoorItem iitem = house.IndoorItems[position];
			if (iitem == null)
			{
				client.Player.Out.SendMessage("error: id was null", eChatType.CT_Help, eChatLoc.CL_SystemWindow);
				return;
			} //should this ever happen?

			// adjust the item's roation
			int old = iitem.Rotation;
			iitem.Rotation = (iitem.Rotation + angle)%360;

			if (iitem.Rotation < 0)
			{
				iitem.Rotation = 360 + iitem.Rotation;
			}

			iitem.DatabaseItem.Rotation = iitem.Rotation;

			// save item
			GameServer.Database.SaveObject(iitem.DatabaseItem);

			ChatUtil.SendSystemMessage(client,
			                           string.Format("Interior decoration rotated from {0} degrees to {1}", old, iitem.Rotation));

			// update all players in the house.
			foreach (GamePlayer plr in house.GetAllPlayersInHouse())
			{
				plr.Client.Out.SendFurniture(house, position);
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:59,代码来源:HousingDecorationRotate.cs


示例19: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			var mode = (byte) packet.ReadByte();
			bool userAction = packet.ReadByte() == 0;
				// set to 0 if user pressed the button, set to 1 if client decided to stop attack

			new AttackRequestHandler(client.Player, mode != 0, userAction).Start(1);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:8,代码来源:PlayerAttackRequestHandler.cs


示例20: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int flagSpeedData = packet.ReadShort();
			int index = packet.ReadByte();
			int type = packet.ReadByte();

			new UseSkillAction(client.Player, flagSpeedData, index, type).Start(1);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:8,代码来源:UseSkillHandler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GThread类代码示例发布时间:2022-05-24
下一篇:
C# GSM类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap