Aura.Channel.World.Shops.PersonalShop.GetBagLayout C# (CSharp) Метод

GetBagLayout() публичный Метод

Returns the layout of the bag, used in the shop open packet.
public GetBagLayout ( ) : string
Результат string
		public string GetBagLayout()
		{
			if (this.Bag == null)
			{
				Log.Debug("PersonalShop.GetBagLayout: Bag not set.");
				return null;
			}

			var linkedPocket = this.Bag.OptionInfo.LinkedPocketId;
			var pocket = this.Owner.Inventory.GetPocket(linkedPocket);
			if (pocket == null)
			{
				Log.Debug("PersonalShop.GetBagLayout: Pocket '{0}' not found.", linkedPocket);
				return null;
			}

			var normalPocket = pocket as InventoryPocketNormal;
			if (normalPocket == null)
			{
				Log.Debug("PersonalShop.GetBagLayout: Invalid pocket type '{0}'.", pocket.GetType().Name);
				return null;
			}

			// TODO: Non-rectangular bag layouts.

			return string.Format("{0}/{1}", normalPocket.Width, normalPocket.Height);
		}

Usage Example

Пример #1
0
		/// <summary>
		/// Sends PersonalShopOpenR to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="shop">Null for negative response</param>
		public static void PersonalShopOpenR(Creature creature, PersonalShop shop)
		{
			var items = shop.GetPricedItems();

			var packet = new Packet(Op.PersonalShopOpenR, creature.EntityId);
			packet.PutByte(shop != null);
			if (shop != null)
			{
				packet.PutLong(shop.Owner.EntityId);
				packet.PutString(shop.Owner.Name);
				packet.PutString(shop.Description);
				packet.PutString(shop.GetBagLayout());
				packet.PutByte(0);

				foreach (var item in items)
				{
					packet.AddItemInfo(item, ItemPacketType.Private);
					packet.PutInt(item.PersonalShopPrice);
				}
			}

			creature.Client.Send(packet);
		}