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


C# GSTCPPacketOut.Fill方法代码示例

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


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

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

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

		public override void SendRegions()
		{
			if (m_gameClient.Player != null)
			{
				if (!m_gameClient.Socket.Connected)
					return;
				Region region = WorldMgr.GetRegion((ushort)m_gameClient.Player.CurrentRegionID);
				if (region == null)
					return;
				using (GSTCPPacketOut pak = new GSTCPPacketOut(0xB1))
				{
					//				pak.WriteByte((byte)((region.Expansion + 1) << 4)); // Must be expansion
					pak.WriteByte(0); // but this packet sended when client in old region. but this field must show expanstion for jump destanation region
					//Dinberg - trying to get instances to work.
	                pak.WriteByte((byte)region.Skin); // This was pak.WriteByte((byte)region.ID);
					pak.Fill(0, 20);
					pak.FillString(region.ServerPort.ToString(), 5);
					pak.FillString(region.ServerPort.ToString(), 5);
					string ip = region.ServerIP;
					if (ip == "any" || ip == "0.0.0.0" || ip == "127.0.0.1" || ip.StartsWith("10.13.") || ip.StartsWith("192.168."))
						ip = ((IPEndPoint)m_gameClient.Socket.LocalEndPoint).Address.ToString();
					pak.FillString(ip, 20);
					SendTCP(pak);
				}
			}
			else
			{
				RegionEntry[] entries = WorldMgr.GetRegionList();

				if (entries == null) return;
				int index = 0;
				int num = 0;
				int count = entries.Length;
				while (entries != null && count > index)
				{
					using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.ClientRegions)))
					{
						for (int i = 0; i < 4; i++)
						{
							while (index < count && (int)m_gameClient.ClientType <= entries[index].expansion)
							{
								index++;
							}
	
							if (index >= count)
							{	//If we have no more entries
								pak.Fill(0x0, 52);
							}
							else
							{
								pak.WriteByte((byte)(++num));
								pak.WriteByte((byte)entries[index].id);
								pak.FillString(entries[index].name, 20);
								pak.FillString(entries[index].fromPort, 5);
								pak.FillString(entries[index].toPort, 5);
								//Try to fix the region ip so UDP is enabled!
								string ip = entries[index].ip;
								if (ip == "any" || ip == "0.0.0.0" || ip == "127.0.0.1" || ip.StartsWith("10.13.") || ip.StartsWith("192.168."))
									ip = ((IPEndPoint)m_gameClient.Socket.LocalEndPoint).Address.ToString();
								pak.FillString(ip, 20);
	
								//							DOLConsole.WriteLine(string.Format(" ip={3}; fromPort={1}; toPort={2}; num={4}; id={0}; region name={5}", entries[index].id, entries[index].fromPort, entries[index].toPort, entries[index].ip, num, entries[index].name));
								index++;
							}
						}
						SendTCP(pak);
					}
				}
			}
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:70,代码来源:PacketLib173.cs

示例4: SendCharacterOverview

		public override void SendCharacterOverview(eRealm realm)
		{
			if (realm < eRealm.Albion || realm > eRealm.Hibernia)
			{
				throw new Exception("CharacterOverview requested for unknown realm " + realm);
			}

			int firstSlot = (byte)realm * 100;

			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterOverview));
			pak.FillString(m_gameClient.Account.Name, 28); //extra 4 in 1.104

			if (m_gameClient.Account.Characters == null)
			{
				pak.Fill(0x0, 1880);
			}
			else
			{
				Dictionary<int, DOLCharacters> charsBySlot = new Dictionary<int, DOLCharacters>();
				string itemQuery = "(";
				foreach (DOLCharacters c in m_gameClient.Account.Characters)
				{
					try
					{
						charsBySlot.Add(c.AccountSlot, c);
						itemQuery += "OwnerID = '" + c.ObjectId + "' OR ";
					}
					catch (Exception ex)
					{
						log.Error("SendCharacterOverview - Duplicate char in slot? Slot: " + c.AccountSlot + ", Account: " + c.AccountName, ex);
					}
				}
				itemQuery = itemQuery.Substring(0, itemQuery.Length - 4); //remove last OR
				itemQuery += ") AND SlotPosition >= " + ((int)eInventorySlot.MinEquipable) + " AND SlotPosition <= " + ((int)eInventorySlot.MaxEquipable);

				var itemsByOwnerID = new Dictionary<string, Dictionary<eInventorySlot, InventoryItem>>();
				var allItems = (InventoryItem[])GameServer.Database.SelectObjects<InventoryItem>(itemQuery);
				foreach (InventoryItem item in allItems)
				{
                    try
                    {
                        if (!itemsByOwnerID.ContainsKey(item.OwnerID))
                            itemsByOwnerID.Add(item.OwnerID, new Dictionary<eInventorySlot, InventoryItem>());

                        itemsByOwnerID[item.OwnerID].Add((eInventorySlot)item.SlotPosition, item);
                    }
                    catch (Exception ex)
                    {
                        log.Error("SendCharacterOverview - Duplicate item on character? OwnerID: " + item.OwnerID + ", SlotPosition: " + item.SlotPosition + ", Account: " + m_gameClient.Account.Name, ex);
                    }
				}

				for (int i = firstSlot; i < (firstSlot + 10); i++)
				{
					DOLCharacters c = null;
					if (!charsBySlot.TryGetValue(i, out c))
					{
						pak.Fill(0x0, 188);
					}
					else
					{
						Dictionary<eInventorySlot, InventoryItem> charItems = null;

						if (!itemsByOwnerID.TryGetValue(c.ObjectId, out charItems))
							charItems = new Dictionary<eInventorySlot, InventoryItem>();

						byte extensionTorso = 0;
						byte extensionGloves = 0;
						byte extensionBoots = 0;

						InventoryItem item = null;

						if (charItems.TryGetValue(eInventorySlot.TorsoArmor, out item))
							extensionTorso = item.Extension;

						if (charItems.TryGetValue(eInventorySlot.HandsArmor, out item))
							extensionGloves = item.Extension;

						if (charItems.TryGetValue(eInventorySlot.FeetArmor, out item))
							extensionBoots = item.Extension;

						pak.FillString(c.Name, 24);
						pak.WriteByte(0x01);
						pak.WriteByte((byte)c.EyeSize);
						pak.WriteByte((byte)c.LipSize);
						pak.WriteByte((byte)c.EyeColor);
						pak.WriteByte((byte)c.HairColor);
						pak.WriteByte((byte)c.FaceType);
						pak.WriteByte((byte)c.HairStyle);
						pak.WriteByte((byte)((extensionBoots << 4) | extensionGloves));
						pak.WriteByte((byte)((extensionTorso << 4) | (c.IsCloakHoodUp ? 0x1 : 0x0)));
						pak.WriteByte((byte)c.CustomisationStep); //1 = auto generate config, 2= config ended by player, 3= enable config to player
						pak.WriteByte((byte)c.MoodType);
						pak.Fill(0x0, 13); //0 String

						string locationDescription = "";
						Region region = WorldMgr.GetRegion((ushort)c.Region);
						if (region != null)
						{
							Zone zone = null;
//.........这里部分代码省略.........
开发者ID:boscorillium,项目名称:dol,代码行数:101,代码来源:PacketLib1104.cs

示例5: SendSiegeWeaponCloseInterface

		public virtual void SendSiegeWeaponCloseInterface()
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.SiegeWeaponInterface)))
			{
				pak.WriteShort(0);
				pak.WriteShort(1);
				pak.Fill(0, 13);
				SendTCP(pak);
			}
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:10,代码来源:PacketLib168.cs

示例6: WriteItemData

        /// <summary>
        /// New Item Packet Data in v1.115
        /// </summary>
        /// <param name="pak"></param>
        /// <param name="item"></param>
        protected override void WriteItemData(GSTCPPacketOut pak, InventoryItem item)
        {
        	if (item == null)
			{
				pak.Fill(0x00, 23); // added one short in front of item data, v1.115
				return;
			}

        	
        	// Unknown
        	pak.WriteShort((ushort)0);
        	base.WriteItemData(pak, item);
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:18,代码来源:PacketLib1115.cs

示例7: SendUpdateIcons

		public override void SendUpdateIcons(IList changedEffects, ref int lastUpdateEffectsCount)
		{
			if (m_gameClient.Player == null)
			{
				return;
			}
			
			IList<int> tooltipids = new List<int>();
			
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.UpdateIcons)))
			{
				long initPos = pak.Position;
	
				int fxcount = 0;
				int entriesCount = 0;
	
				pak.WriteByte(0); // effects count set in the end
				pak.WriteByte(0); // unknown
				pak.WriteByte(Icons); // unknown
				pak.WriteByte(0); // unknown
	
				foreach (IGameEffect effect in m_gameClient.Player.EffectList)
				{
					if (effect.Icon != 0)
					{
						fxcount++;
						if (changedEffects != null && !changedEffects.Contains(effect))
						{
							continue;
						}
						
						// store tooltip update for gamespelleffect.
						if (ForceTooltipUpdate && (effect is GameSpellEffect))
						{
							Spell spell = ((GameSpellEffect)effect).Spell;
							tooltipids.Add(spell.InternalID);
						}
	
						//						log.DebugFormat("adding [{0}] '{1}'", fxcount-1, effect.Name);
						pak.WriteByte((byte)(fxcount - 1)); // icon index
						pak.WriteByte((effect is GameSpellEffect || effect.Icon > 5000) ? (byte)(fxcount - 1) : (byte)0xff);
						byte ImmunByte = 0;
						if (effect is GameSpellEffect)
						{
							//if (((GameSpellEffect)effect).ImmunityState)
							if (effect is GameSpellAndImmunityEffect && ((GameSpellAndImmunityEffect)effect).ImmunityState)
							{
								ImmunByte = 1;
							}
						}
						pak.WriteByte(ImmunByte);
						// bit 0x08 adds "more..." to right click info
						pak.WriteShort(effect.Icon);
						//pak.WriteShort(effect.IsFading ? (ushort)1 : (ushort)(effect.RemainingTime / 1000));
						pak.WriteShort((ushort)(effect.RemainingTime / 1000));
						if (effect is GameSpellEffect)
							pak.WriteShort((ushort)((GameSpellEffect)effect).Spell.InternalID); //v1.110+ send the spell ID for delve info in active icon
						else
							pak.WriteShort(0);//don't override existing tooltip ids
	
						byte flagNegativeEffect = 0;
						if (effect is StaticEffect)
						{
							if (((StaticEffect)effect).HasNegativeEffect)
							{
								flagNegativeEffect = 1;
							}
						}
						else if (effect is GameSpellEffect)
						{
							if (!((GameSpellEffect)effect).SpellHandler.HasPositiveEffect)
							{
								flagNegativeEffect = 1;
							}
						}
						pak.WriteByte(flagNegativeEffect);
	
						pak.WritePascalString(effect.Name);
						entriesCount++;
					}
				}
	
				int oldCount = lastUpdateEffectsCount;
				lastUpdateEffectsCount = fxcount;
	
				while (oldCount > fxcount)
				{
					pak.WriteByte((byte)(fxcount++));
					pak.Fill(0, 10);
					entriesCount++;
					//					log.DebugFormat("adding [{0}] (empty)", fxcount-1);
				}
	
				if (changedEffects != null)
				{
					changedEffects.Clear();
				}
	
				if (entriesCount == 0)
				{
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:PacketLib1110.cs

示例8: SendSiegeWeaponInterface

		public override void SendSiegeWeaponInterface(GameSiegeWeapon siegeWeapon, int time)
		{
			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.SiegeWeaponInterface)))
			{
				ushort flag = (ushort)((siegeWeapon.EnableToMove ? 1 : 0) | siegeWeapon.AmmoType << 8);
				pak.WriteShort(flag); //byte Ammo,  byte SiegeMoving(1/0)
				pak.WriteByte(0);
				pak.WriteByte(0); // Close interface(1/0)
				pak.WriteByte((byte)(time));//time in 100ms
				pak.WriteByte((byte)siegeWeapon.Ammo.Count); // external ammo count
				pak.WriteByte((byte)siegeWeapon.SiegeWeaponTimer.CurrentAction);
				pak.WriteByte((byte)siegeWeapon.AmmoSlot);
				pak.WriteShort(siegeWeapon.Effect);
				pak.WriteShort(0); // SiegeHelperTimer ?
				pak.WriteShort(0); // SiegeTimer ?
				pak.WriteShort((ushort)siegeWeapon.ObjectID);
	
	            string name = siegeWeapon.Name;
	
	            LanguageDataObject translation = LanguageMgr.GetTranslation(m_gameClient, siegeWeapon);
	            if (translation != null)
	            {
	                if (!Util.IsEmpty(((DBLanguageNPC)translation).Name))
	                    name = ((DBLanguageNPC)translation).Name;
	            }
	
	            pak.WritePascalString(name + " (" + siegeWeapon.CurrentState.ToString() + ")");
				foreach (InventoryItem item in siegeWeapon.Ammo)
				{
					pak.WriteByte((byte)item.SlotPosition);
					if (item == null)
					{
						pak.Fill(0x00, 18);
						continue;
					}
					pak.WriteByte((byte)item.Level);
					pak.WriteByte((byte)item.DPS_AF);
					pak.WriteByte((byte)item.SPD_ABS);
					pak.WriteByte((byte)(item.Hand * 64));
					pak.WriteByte((byte)((item.Type_Damage * 64) + item.Object_Type));
					pak.WriteShort((ushort)item.Weight);
					pak.WriteByte(item.ConditionPercent); // % of con
					pak.WriteByte(item.DurabilityPercent); // % of dur
					pak.WriteByte((byte)item.Quality); // % of qua
					pak.WriteByte((byte)item.Bonus); // % bonus
					pak.WriteShort((ushort)item.Model);
					if (item.Emblem != 0)
						pak.WriteShort((ushort)item.Emblem);
					else
						pak.WriteShort((ushort)item.Color);
					pak.WriteShort((ushort)item.Effect);
					if (item.Count > 1)
						pak.WritePascalString(item.Count + " " + item.Name);
					else
						pak.WritePascalString(item.Name);
				}
				SendTCP(pak);
			}
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:59,代码来源:PacketLib173.cs

示例9: SendInventorySlotsUpdateRange

		protected override void SendInventorySlotsUpdateRange(ICollection<int> slots, byte preAction)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.InventoryUpdate));
			pak.WriteByte((byte)(slots == null ? 0 : slots.Count));
			pak.WriteByte((byte)((m_gameClient.Player.IsCloakHoodUp ? 0x01 : 0x00) | (int)m_gameClient.Player.ActiveQuiverSlot)); //bit0 is hood up bit4 to 7 is active quiver
			pak.WriteByte((byte)m_gameClient.Player.VisibleActiveWeaponSlots);
			pak.WriteByte(preAction); //preAction (0x00 - Do nothing)
			if (slots != null)
			{
				foreach (int updatedSlot in slots)
				{
					if (updatedSlot >= (int)eInventorySlot.Consignment_First && updatedSlot <= (int)eInventorySlot.Consignment_Last)
						pak.WriteByte((byte)(updatedSlot - (int)eInventorySlot.Consignment_First + (int)eInventorySlot.HousingInventory_First));
					else
						pak.WriteByte((byte)(updatedSlot));

					InventoryItem item = null;
					item = m_gameClient.Player.Inventory.GetItem((eInventorySlot)updatedSlot);

					if (item == null)
					{
						pak.Fill(0x00, 19);
						continue;
					}
					pak.WriteByte((byte)item.Level);

					int value1; // some object types use this field to display count
					int value2; // some object types use this field to display count
					switch (item.Object_Type)
					{
						case (int)eObjectType.Arrow:
						case (int)eObjectType.Bolt:
						case (int)eObjectType.Poison:
						case (int)eObjectType.GenericItem:
							value1 = item.Count;
							value2 = item.SPD_ABS;
							break;
						case (int)eObjectType.Thrown:
							value1 = item.DPS_AF;
							value2 = item.Count;
							break;
						case (int)eObjectType.Instrument:
							value1 = (item.DPS_AF == 2 ? 0 : item.DPS_AF);
							value2 = 0;
							break; // unused
						case (int)eObjectType.Shield:
							value1 = item.Type_Damage;
							value2 = item.DPS_AF;
							break;
						case (int)eObjectType.AlchemyTincture:
						case (int)eObjectType.SpellcraftGem:
							value1 = 0;
							value2 = 0;
							/*
							must contain the quality of gem for spell craft and think same for tincture
							*/
							break;
						case (int)eObjectType.HouseWallObject:
						case (int)eObjectType.HouseFloorObject:
						case (int)eObjectType.GardenObject:
							value1 = 0;
							value2 = item.SPD_ABS;
							/*
							Value2 byte sets the width, only lower 4 bits 'seem' to be used (so 1-15 only)

							The byte used for "Hand" (IE: Mini-delve showing a weapon as Left-Hand
							usabe/TwoHanded), the lower 4 bits store the height (1-15 only)
							*/
							break;

						default:
							value1 = item.DPS_AF;
							value2 = item.SPD_ABS;
							break;
					}
					pak.WriteByte((byte)value1);
					pak.WriteByte((byte)value2);

					if (item.Object_Type == (int)eObjectType.GardenObject)
						pak.WriteByte((byte)(item.DPS_AF));
					else
						pak.WriteByte((byte)(item.Hand << 6));
					pak.WriteByte((byte)((item.Type_Damage > 3 ? 0 : item.Type_Damage << 6) | item.Object_Type));
					pak.WriteShort((ushort)item.Weight);
					pak.WriteByte(item.ConditionPercent); // % of con
					pak.WriteByte(item.DurabilityPercent); // % of dur
					pak.WriteByte((byte)item.Quality); // % of qua
					pak.WriteByte((byte)item.Bonus); // % bonus
					pak.WriteShort((ushort)item.Model);
					pak.WriteByte((byte)item.Extension);
					int flag = 0;
					if (item.Emblem != 0)
					{
						pak.WriteShort((ushort)item.Emblem);
						flag |= (item.Emblem & 0x010000) >> 16; // = 1 for newGuildEmblem
					}
					else
						pak.WriteShort((ushort)item.Color);
//						flag |= 0x01; // newGuildEmblem
						flag |= 0x02; // enable salvage button
//.........这里部分代码省略.........
开发者ID:boscorillium,项目名称:dol,代码行数:101,代码来源:PacketLib182.cs

示例10: SendAttackMode

		public virtual void SendAttackMode(bool attackState)
		{
			if (m_gameClient.Player == null)
				return;

			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.AttackMode)))
			{
				pak.WriteByte((byte) (attackState ? 0x01 : 0x00));
				pak.Fill(0x00, 3);

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

示例11: SendRegions

		public virtual void SendRegions()
		{
			RegionEntry[] entries = WorldMgr.GetRegionList();

			if (entries == null)
				return;

			int index = 0;
			int num = 0;
			int count = entries.Length;
			while (count > index)
			{
				using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.ClientRegions)))
				{
					for (int i = 0; i < 4; i++)
					{
						while (index < count &&
						       (entries[index].id > byte.MaxValue || (int) m_gameClient.ClientType <= entries[index].expansion))
						{
							//skip high ID regions added with catacombs
							index++;
						}

						if (index >= count)
						{
							//If we have no more entries
							pak.Fill(0x0, 52);
						}
						else
						{
							pak.WriteByte((byte) (++num));
							pak.WriteByte((byte) entries[index].id);
							pak.FillString(entries[index].name, 20);
							pak.FillString(entries[index].fromPort, 5);
							pak.FillString(entries[index].toPort, 5);

							//Try to fix the region ip so UDP is enabled!
							string ip = entries[index].ip;
							if (ip == "any" || ip == "0.0.0.0" || ip == "127.0.0.1" || ip.StartsWith("10.13.") || ip.StartsWith("192.168."))
								ip = ((IPEndPoint) m_gameClient.Socket.LocalEndPoint).Address.ToString();
							pak.FillString(ip, 20);
							//						DOLConsole.WriteLine(string.Format(" ip={3}; fromPort={1}; toPort={2}; num={4}; id={0}; region name={5}", (byte)entries[index].id, entries[index].fromPort, entries[index].toPort, entries[index].ip, num, entries[index].name));
							index++;
						}
					}
					SendTCP(pak);
				}
			}
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:49,代码来源:PacketLib168.cs

示例12: SendInventorySlotsUpdateRange

		protected virtual void SendInventorySlotsUpdateRange(ICollection<int> slots, byte preAction)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.InventoryUpdate)))
			{
				pak.WriteByte((byte) (slots == null ? 0 : slots.Count));
				pak.WriteByte(
					(byte) ((m_gameClient.Player.IsCloakHoodUp ? 0x01 : 0x00) | (int) m_gameClient.Player.ActiveQuiverSlot));
				//bit0 is hood up bit4 to 7 is active quiver
				pak.WriteByte(m_gameClient.Player.VisibleActiveWeaponSlots);
				pak.WriteByte(preAction); //preAction (0x00 - Do nothing)
				if (slots != null)
				{
					foreach (int updatedSlot in slots)
					{
						if (updatedSlot >= (int) eInventorySlot.Consignment_First && updatedSlot <= (int) eInventorySlot.Consignment_Last)
							pak.WriteByte(
								(byte) (updatedSlot - (int) eInventorySlot.Consignment_First + (int) eInventorySlot.HousingInventory_First));
						else
							pak.WriteByte((byte) (updatedSlot));
						InventoryItem item = m_gameClient.Player.Inventory.GetItem((eInventorySlot) updatedSlot);

						if (item == null)
						{
							pak.Fill(0x00, 18);
							continue;
						}

						pak.WriteByte((byte) item.Level);

						int value1; // some object types use this field to display count
						int value2; // some object types use this field to display count
						switch (item.Object_Type)
						{
							case (int) eObjectType.Arrow:
							case (int) eObjectType.Bolt:
							case (int) eObjectType.Poison:
							case (int) eObjectType.GenericItem:
								value1 = item.Count;
								value2 = item.SPD_ABS;
								break;
							case (int) eObjectType.Thrown:
								value1 = item.DPS_AF;
								value2 = item.Count;
								break;
							case (int) eObjectType.Instrument:
								value1 = (item.DPS_AF == 2 ? 0 : item.DPS_AF); // 0x00 = Lute ; 0x01 = Drum ; 0x03 = Flute
								value2 = 0;
								break; // unused
							case (int) eObjectType.Shield:
								value1 = item.Type_Damage;
								value2 = item.DPS_AF;
								break;
							case (int) eObjectType.GardenObject:
								value1 = 0;
								value2 = item.SPD_ABS;
								break;
							default:
								value1 = item.DPS_AF;
								value2 = item.SPD_ABS;
								break;
						}
						pak.WriteByte((byte) value1);
						pak.WriteByte((byte) value2);

						if (item.Object_Type == (int) eObjectType.GardenObject)
							pak.WriteByte((byte) (item.DPS_AF));
						else
							pak.WriteByte((byte) (item.Hand << 6));
						pak.WriteByte((byte) ((item.Type_Damage > 3 ? 0 : item.Type_Damage << 6) | item.Object_Type));
						pak.WriteShort((ushort) item.Weight);
						pak.WriteByte(item.ConditionPercent); // % of con
						pak.WriteByte(item.DurabilityPercent); // % of dur
						pak.WriteByte((byte) item.Quality); // % of qua
						pak.WriteByte((byte) item.Bonus); // % bonus
						pak.WriteShort((ushort) item.Model);
						if (item.Emblem != 0)
							pak.WriteShort((ushort) item.Emblem);
						else
							pak.WriteShort((ushort) item.Color);
						pak.WriteShort((ushort) item.Effect);
						string name = item.Name;
						if (item.Count > 1)
							name = item.Count + " " + name;
						if (item.SellPrice > 0)
						{
							if (ConsignmentMoney.UseBP)
								name += "[" + item.SellPrice + " BP]";
							else
								name += "[" + Money.GetString(item.SellPrice) + "]";
						}
						pak.WritePascalString(name);
					}
				}
				SendTCP(pak);
			}
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:96,代码来源:PacketLib168.cs

示例13: SendBadNameCheckReply

		public virtual void SendBadNameCheckReply(string name, bool bad)
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.BadNameCheckReply)))
			{
				pak.FillString(name, 30);
				pak.FillString(m_gameClient.Account.Name, 20);
				pak.WriteByte((byte) (bad ? 0x0 : 0x1));
				pak.Fill(0x0, 3);
				SendTCP(pak);
			}
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:11,代码来源:PacketLib168.cs

示例14: SendDupNameCheckReply

		public virtual void SendDupNameCheckReply(string name, bool nameExists)
		{
			if (m_gameClient == null || m_gameClient.Account == null)
				return;

			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DupNameCheckReply)))
			{
				pak.FillString(name, 30);
				pak.FillString(m_gameClient.Account.Name, 20);
				pak.WriteByte((byte) (nameExists ? 0x1 : 0x0));
				pak.Fill(0x0, 3);
				SendTCP(pak);
			}
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:14,代码来源:PacketLib168.cs

示例15: SendMarketExplorerWindow

		public virtual void SendMarketExplorerWindow()
		{
			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.MarketExplorerWindow)))
			{
				pak.WriteByte(255);
				pak.Fill(0, 3);
				SendTCP(pak);
			}
		}
开发者ID:SkyFire,项目名称:Dawn-of-Light-core,代码行数:9,代码来源:PacketLib168.cs


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