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


C# PacketHandler.GSTCPPacketOut类代码示例

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


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

示例1: SendKeepRemove

		public override void SendKeepRemove(AbstractGameKeep keep)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepRemove));

			pak.WriteShort((ushort)keep.KeepID);
			SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:7,代码来源:PacketLib170.cs

示例2: SendSetControlledHorse

        public override void SendSetControlledHorse(GamePlayer player)
        {
            if (player == null || player.ObjectState != GameObject.eObjectState.Active)
                return;

            GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.ControlledHorse));

            if (player.HasHorse)
            {
                pak.WriteShort(0); // for set self horse OID must be zero
                pak.WriteByte(player.ActiveHorse.ID);
                if (player.ActiveHorse.BardingColor == 0 && player.ActiveHorse.Barding != 0 && player.Guild != null)
                {
                    int newGuildBitMask = (player.Guild.Emblem & 0x010000) >> 9;
                    pak.WriteByte((byte)(player.ActiveHorse.Barding | newGuildBitMask));
                    pak.WriteShort((ushort)player.Guild.Emblem);
                }
                else
                {
                    pak.WriteByte(player.ActiveHorse.Barding);
                    pak.WriteShort(player.ActiveHorse.BardingColor);
                }
                pak.WriteByte(player.ActiveHorse.Saddle);
                pak.WriteByte(player.ActiveHorse.SaddleColor);
                pak.WriteByte(player.ActiveHorse.Slots);
                pak.WriteByte(player.ActiveHorse.Armor);
                pak.WritePascalString(player.ActiveHorse.Name == null ? "" : player.ActiveHorse.Name);
            }
            else
            {
                pak.Fill(0x00, 8);
            }
            SendTCP(pak);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:34,代码来源:PacketLib180.cs

示例3: SendVersionAndCryptKey

		//Packets

		#region IPacketLib Members

		public virtual void SendVersionAndCryptKey()
		{
			//Construct the new packet
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CryptKey)))
			{
				//Enable encryption
				#if !NOENCRYPTION
				pak.WriteByte(0x01);
				#else
				pak.WriteByte(0x00);
				#endif

				//if(is_si)
				pak.WriteByte(0x32);
				//else
				//	pak.WriteByte(0x31);
				pak.WriteByte(ParseVersion((int) m_gameClient.Version, true));
				pak.WriteByte(ParseVersion((int) m_gameClient.Version, false));
				//pak.WriteByte(build);
				pak.WriteByte(0x00);

				#if !NOENCRYPTION
				byte[] publicKey = new byte[500];
				UInt32 keyLen = CryptLib168.ExportRSAKey(publicKey, (UInt32) 500, false);
				pak.WriteShort((ushort) keyLen);
				pak.Write(publicKey, 0, (int) keyLen);
				//From now on we expect RSA!
				((PacketEncoding168) m_gameClient.PacketProcessor.Encoding).EncryptionState = PacketEncoding168.eEncryptionState.RSAEncrypted;
				#endif

				SendTCP(pak);
			}
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:37,代码来源:PacketLib168.cs

示例4: SendPlayerTitles

		public override void SendPlayerTitles()
		{
			IList titles = m_gameClient.Player.Titles;
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DetailWindow));

			pak.WriteByte(1); // new in 1.75
			pak.WritePascalString("Player Statistics"); //window caption

			byte line = 1;
			foreach (string str in m_gameClient.Player.FormatStatistics())
			{
				pak.WriteByte(line++);
				pak.WritePascalString(str);
			}

			pak.WriteByte(200);
			long titlesCountPos = pak.Position;
			pak.WriteByte(0); // length of all titles part
			pak.WriteByte((byte)titles.Count);
			line = 0;
			foreach (IPlayerTitle title in titles)
			{
				pak.WriteByte(line++);
				pak.WritePascalString(title.GetDescription(m_gameClient.Player));
			}
			long titlesLen = (pak.Position - titlesCountPos - 1); // include titles count
			if (titlesLen > byte.MaxValue)
				log.WarnFormat("Titles block is too long! {0} (player: {1})", titlesLen, m_gameClient.Player);
			//Trailing Zero!
			pak.WriteByte(0);
			//Set titles length
			pak.Position = titlesCountPos;
			pak.WriteByte((byte)titlesLen); // length of all titles part
			SendTCP(pak);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:35,代码来源:PacketLib175.cs

示例5: SendTradeWindow

		public override void SendTradeWindow()
		{
			if (m_gameClient.Player == null)
				return;
			if (m_gameClient.Player.TradeWindow == null)
				return;

			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TradeWindow)))
			{
				lock (m_gameClient.Player.TradeWindow.Sync)
				{
					foreach (InventoryItem item in m_gameClient.Player.TradeWindow.TradeItems)
					{
						pak.WriteByte((byte)item.SlotPosition);
					}
					pak.Fill(0x00, 10 - m_gameClient.Player.TradeWindow.TradeItems.Count);
	
					pak.WriteShort(0x0000);
					pak.WriteShort((ushort)Money.GetMithril(m_gameClient.Player.TradeWindow.TradeMoney));
					pak.WriteShort((ushort)Money.GetPlatinum(m_gameClient.Player.TradeWindow.TradeMoney));
					pak.WriteShort((ushort)Money.GetGold(m_gameClient.Player.TradeWindow.TradeMoney));
					pak.WriteShort((ushort)Money.GetSilver(m_gameClient.Player.TradeWindow.TradeMoney));
					pak.WriteShort((ushort)Money.GetCopper(m_gameClient.Player.TradeWindow.TradeMoney));
	
					pak.WriteShort(0x0000);
					pak.WriteShort((ushort)Money.GetMithril(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
					pak.WriteShort((ushort)Money.GetPlatinum(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
					pak.WriteShort((ushort)Money.GetGold(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
					pak.WriteShort((ushort)Money.GetSilver(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
					pak.WriteShort((ushort)Money.GetCopper(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
	
					pak.WriteShort(0x0000);
					ArrayList items = m_gameClient.Player.TradeWindow.PartnerTradeItems;
					if (items != null)
					{
						pak.WriteByte((byte)items.Count);
						pak.WriteByte(0x01);
					}
					else
					{
						pak.WriteShort(0x0000);
					}
					pak.WriteByte((byte)(m_gameClient.Player.TradeWindow.Repairing ? 0x01 : 0x00));
					pak.WriteByte((byte)(m_gameClient.Player.TradeWindow.Combine ? 0x01 : 0x00));
					if (items != null)
					{
						foreach (InventoryItem item in items)
						{
							pak.WriteByte((byte)item.SlotPosition);
							WriteItemData(pak, item);
						}
					}
					if (m_gameClient.Player.TradeWindow.Partner != null)
						pak.WritePascalString("Trading with " + m_gameClient.Player.GetName(m_gameClient.Player.TradeWindow.Partner)); // transaction with ...
					else
						pak.WritePascalString("Selfcrafting"); // transaction with ...
					SendTCP(pak);
				}
			}
		}
开发者ID:andyhebear,项目名称:DOLSharp,代码行数:60,代码来源:PacketLib1109.cs

示例6: SendDelveInfo

		/// <summary>
		/// New system in v1.110+ for delve info. delve is cached by client in extra file, stored locally.
		/// </summary>
		/// <param name="info"></param>
		public override void SendDelveInfo(string info)
		{
			var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DelveInfo));
			pak.WriteString(info, 2048);
			pak.WriteByte(0); // 0-terminated
			SendTCP(pak);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:11,代码来源:PacketLib1110.cs

示例7: SendPlayerPositionAndObjectID

		public override void SendPlayerPositionAndObjectID()
		{
			if (m_gameClient.Player == null) return;

			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PositionAndObjectID)))
			{
				pak.WriteShort((ushort)m_gameClient.Player.ObjectID); //This is the player's objectid not Sessionid!!!
				pak.WriteShort((ushort)m_gameClient.Player.Z);
				pak.WriteInt((uint)m_gameClient.Player.X);
				pak.WriteInt((uint)m_gameClient.Player.Y);
				pak.WriteShort(m_gameClient.Player.Heading);
	
				int flags = 0;
				if (m_gameClient.Player.CurrentZone.IsDivingEnabled)
					flags = 0x80 | (m_gameClient.Player.IsUnderwater ? 0x01 : 0x00);
				pak.WriteByte((byte)(flags));
	
				pak.WriteByte(0x00);	//TODO Unknown
				Zone zone = m_gameClient.Player.CurrentZone;
				if (zone == null) return;
				pak.WriteShort((ushort)(zone.XOffset / 0x2000));
				pak.WriteShort((ushort)(zone.YOffset / 0x2000));
				//Dinberg - Changing to allow instances...
				pak.WriteShort(m_gameClient.Player.CurrentRegion.Skin);
				pak.WriteShort(0x00); //TODO: unknown, new in 1.71
				SendTCP(pak);
			}
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:28,代码来源:PacketLib171.cs

示例8: SendPlayerCreate

		public override void SendPlayerCreate(GamePlayer playerToCreate)
		{
			Region playerRegion = playerToCreate.CurrentRegion;
			if (playerRegion == null)
			{
				if (log.IsWarnEnabled)
					log.Warn("SendPlayerCreate: playerRegion == null");
				return;
			}

			Zone playerZone = playerToCreate.CurrentZone;
			if (playerZone == null)
			{
				if (log.IsWarnEnabled)
					log.Warn("SendPlayerCreate: playerZone == null");
				return;
			}

			if (m_gameClient.Player == null || playerToCreate.IsVisibleTo(m_gameClient.Player) == false)
				return;

			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PlayerCreate172));
			pak.WriteShort((ushort)playerToCreate.Client.SessionID);
			pak.WriteShort((ushort)playerToCreate.ObjectID);
			pak.WriteShort(playerToCreate.Model);
			pak.WriteShort((ushort)playerToCreate.Z);
            //Dinberg:Instances - Zoneskin ID for clientside positioning 'bluff'.
			pak.WriteShort(playerZone.ZoneSkinID);
			pak.WriteShort((ushort)playerRegion.GetXOffInZone(playerToCreate.X, playerToCreate.Y));
			pak.WriteShort((ushort)playerRegion.GetYOffInZone(playerToCreate.X, playerToCreate.Y));
			pak.WriteShort(playerToCreate.Heading);

			pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.EyeSize)); //1-4 = Eye Size / 5-8 = Nose Size
			pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.LipSize)); //1-4 = Ear size / 5-8 = Kin size
			pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.EyeColor)); //1-4 = Skin Color / 5-8 = Eye Color
			pak.WriteByte(playerToCreate.GetDisplayLevel(m_gameClient.Player));
			pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.HairColor)); //Hair: 1-4 = Color / 5-8 = unknown
			pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.FaceType)); //1-4 = Unknown / 5-8 = Face type
			pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.HairStyle)); //1-4 = Unknown / 5-8 = Hair Style

			int flags = (GameServer.ServerRules.GetLivingRealm(m_gameClient.Player, playerToCreate) & 0x03) << 2;
			if (playerToCreate.IsAlive == false)
				flags |= 0x01;
			if (playerToCreate.IsUnderwater)
				flags |= 0x02; //swimming
			if (playerToCreate.IsStealthed)
				flags |= 0x10;
			if (playerToCreate.IsWireframe)
				flags |= 0x20;
			pak.WriteByte((byte)flags);

			pak.WritePascalString(GameServer.ServerRules.GetPlayerName(m_gameClient.Player, playerToCreate));
			pak.WritePascalString(GameServer.ServerRules.GetPlayerGuildName(m_gameClient.Player, playerToCreate));
			pak.WritePascalString(GameServer.ServerRules.GetPlayerLastName(m_gameClient.Player, playerToCreate));
			pak.WriteByte(0x00); //Trialing 0 ... needed!
			SendTCP(pak);

			//if (GameServer.ServerRules.GetColorHandling(m_gameClient) == 1) // PvP
			SendObjectGuildID(playerToCreate, playerToCreate.Guild); //used for nearest friendly/enemy object buttons and name colors on PvP server
		}
开发者ID:boscorillium,项目名称:dol,代码行数:60,代码来源:PacketLib172.cs

示例9: SendCombatAnimation

		public override void SendCombatAnimation(GameObject attacker, GameObject defender, ushort weaponID, ushort shieldID, int style, byte stance, byte result, byte targetHealthPercent)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CombatAnimation)))
			{
				if (attacker != null)
					pak.WriteShort((ushort)attacker.ObjectID);
				else
					pak.WriteShort(0x00);
				
				if (defender != null)
					pak.WriteShort((ushort)defender.ObjectID);
				else
					pak.WriteShort(0x00);
				
				pak.WriteShort(weaponID);
				pak.WriteShort(shieldID);
				pak.WriteShortLowEndian((ushort)style);
				pak.WriteByte(stance);
				pak.WriteByte(result);
				
				// If Health Percent is invalid get the living Health.
				if (defender is GameLiving && targetHealthPercent > 100)
				{
					targetHealthPercent = (defender as GameLiving).HealthPercent;
				}
				
				pak.WriteByte(targetHealthPercent);
				pak.WriteByte(0);//unk
				SendTCP(pak);
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:31,代码来源:PacketLib186.cs

示例10: SendKeepRealmUpdate

		public override void SendKeepRealmUpdate(AbstractGameKeep keep)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepRealmUpdate));

			pak.WriteShort((ushort)keep.KeepID);
			pak.WriteByte((byte)keep.Realm);
			pak.WriteByte((byte)keep.Level);
			SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:9,代码来源:PacketLib170.cs

示例11: SendQuestWindow

		protected override void SendQuestWindow(GameNPC questNPC, GamePlayer player, DataQuest quest, bool offer)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog));
			ushort QuestID = quest.ClientQuestID;
			pak.WriteShort((offer) ? (byte)0x22 : (byte)0x21); // Dialog
			pak.WriteShort(QuestID);
			pak.WriteShort((ushort)questNPC.ObjectID);
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte((offer) ? (byte)0x02 : (byte)0x01); // Accept/Decline or Finish/Not Yet
			pak.WriteByte(0x01); // Wrap
			pak.WritePascalString(quest.Name);

			String personalizedSummary = BehaviourUtils.GetPersonalizedMessage(quest.Description, player);
			if (personalizedSummary.Length > 255)
			{
				pak.WritePascalString(personalizedSummary.Substring(0, 255)); // Summary is max 255 bytes !
			}
			else
			{
				pak.WritePascalString(personalizedSummary);
			}

			if (offer)
			{
				//String personalizedStory = BehaviourUtils.GetPersonalizedMessage(quest.Story, player);
				pak.WriteShort((ushort)quest.Story.Length);
				pak.WriteStringBytes(quest.Story);
			}
			else
			{
				pak.WriteShort((ushort)quest.FinishText.Length);
				pak.WriteStringBytes(quest.FinishText);
			}
			pak.WriteShort(QuestID);
			pak.WriteByte((byte)quest.StepTexts.Count); // #goals count
			foreach (string text in quest.StepTexts)
			{
				pak.WritePascalString(String.Format("{0}\r", text));
			}
			pak.WriteInt((uint)(0));
			pak.WriteByte((byte)0);
			pak.WriteByte((byte)quest.FinalRewards.Count);
			foreach (ItemTemplate reward in quest.FinalRewards)
			{
				WriteItemData(pak, GameInventoryItem.Create<ItemTemplate>(reward));
			}
			pak.WriteByte((byte)quest.NumOptionalRewardsChoice);
			pak.WriteByte((byte)quest.OptionalRewards.Count);
			foreach (ItemTemplate reward in quest.OptionalRewards)
			{
				WriteItemData(pak, GameInventoryItem.Create<ItemTemplate>(reward));
			}
			SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:57,代码来源:PacketLib194.cs

示例12: SendKeepRemove

		public override void SendKeepRemove(IGameKeep keep)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepRemove)))
			{

				pak.WriteShort((ushort)keep.KeepID);
				SendTCP(pak);
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:9,代码来源:PacketLib170.cs

示例13: SendXFireInfo

 public override void SendXFireInfo(byte flag)
 {
     if (m_gameClient == null || m_gameClient.Player == null)
         return;
     GSTCPPacketOut pak = new GSTCPPacketOut((byte)eServerPackets.XFire);
     pak.WriteShort((ushort)m_gameClient.Player.ObjectID);
     pak.WriteByte(flag);
     pak.WriteByte(0x00);
     SendTCP(pak);
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:10,代码来源:PacketLib188.cs

示例14: SendLivingEquipmentUpdate

		public override void SendLivingEquipmentUpdate(GameLiving living)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.EquipmentUpdate)))
			{

				ICollection<InventoryItem> items = null;
				if (living.Inventory != null)
					items = living.Inventory.VisibleItems;
	
				pak.WriteShort((ushort)living.ObjectID);
				pak.WriteByte((byte)living.VisibleActiveWeaponSlots);
				pak.WriteByte((byte)living.CurrentSpeed); // new in 189b+, speed
				pak.WriteByte((byte)((living.IsCloakInvisible ? 0x01 : 0x00) | (living.IsHelmInvisible ? 0x02 : 0x00))); // new in 189b+, cloack/helm visibility
				pak.WriteByte((byte)((living.IsCloakHoodUp ? 0x01 : 0x00) | (int)living.ActiveQuiverSlot)); //bit0 is hood up bit4 to 7 is active quiver
	
				if (items != null)
				{
					pak.WriteByte((byte)items.Count);
					foreach (InventoryItem item in items)
					{
						ushort model = (ushort)(item.Model & 0x1FFF);
						int slot = item.SlotPosition;
						//model = GetModifiedModel(model);
						int texture = item.Emblem != 0 ? item.Emblem : item.Color;
						if (item.SlotPosition == Slot.LEFTHAND || item.SlotPosition == Slot.CLOAK) // for test only cloack and shield
							slot = slot | ((texture & 0x010000) >> 9); // slot & 0x80 if new emblem
						pak.WriteByte((byte)slot);
						if ((texture & ~0xFF) != 0)
							model |= 0x8000;
						else if ((texture & 0xFF) != 0)
							model |= 0x4000;
						if (item.Effect != 0)
							model |= 0x2000;
	
						pak.WriteShort(model);
	
						if (item.SlotPosition > Slot.RANGED || item.SlotPosition < Slot.RIGHTHAND)
							pak.WriteByte((byte)item.Extension);
	
						if ((texture & ~0xFF) != 0)
							pak.WriteShort((ushort)texture);
						else if ((texture & 0xFF) != 0)
							pak.WriteByte((byte)texture);
						if (item.Effect != 0)
							pak.WriteByte((byte)item.Effect);
					}
				}
				else
				{
					pak.WriteByte(0x00);
				}
				SendTCP(pak);
			}
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:54,代码来源:PacketLib189.cs

示例15: SendLoginGranted

		public override void SendLoginGranted(byte color)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.LoginGranted));
			pak.WritePascalString(m_gameClient.Account.Name);
			pak.WritePascalString(GameServer.Instance.Configuration.ServerNameShort); //server name
			pak.WriteByte(0x0C); //Server ID
			pak.WriteByte(color);
			pak.WriteByte(0x00);
			pak.WriteByte(0x00);
			SendTCP(pak);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:11,代码来源:PacketLib1111.cs


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