public PaperdollDialogItem(PacketAPI api, Rectangle location, EOPaperdollDialog parent, ItemRecord info, EquipLocation locationEnum)
			: base(null, null, parent)
		{
			m_api = api;
			SetInfo(location, info);
			EquipLoc = locationEnum;
		}
Exemplo n.º 2
0
		private void _removeItem(ItemRecord item, int amount)
		{
			if (!EOGame.Instance.Hud.InventoryFits((short)item.ID))
			{
				EOMessageBox.Show(World.GetString(DATCONST2.STATUS_LABEL_ITEM_PICKUP_NO_SPACE_LEFT),
					World.GetString(DATCONST2.STATUS_LABEL_TYPE_WARNING),
					XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
				return;
			}

			if (World.Instance.MainPlayer.ActiveCharacter.Weight + item.Weight * amount > World.Instance.MainPlayer.ActiveCharacter.MaxWeight)
			{
				EOMessageBox.Show(World.GetString(DATCONST2.DIALOG_ITS_TOO_HEAVY_WEIGHT),
					World.GetString(DATCONST2.STATUS_LABEL_TYPE_WARNING),
					XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
				return;
			}

			if (!m_api.LockerTakeItem(X, Y, (short)item.ID))
				EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
		}
Exemplo n.º 3
0
		public EOInventoryItem(PacketAPI api, int slot, ItemRecord itemData, InventoryItem itemInventoryInfo, EOInventory inventory)
			: base(null, null, inventory)
		{
			m_api = api;
			m_itemData = itemData;
			m_inventory = itemInventoryInfo;
			Slot = slot;

			UpdateItemLocation(Slot);

			m_itemgfx = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.Items, 2 * itemData.Graphic, true);

			m_highlightBG = new Texture2D(Game.GraphicsDevice, DrawArea.Width - 3, DrawArea.Height - 3);
			Color[] highlight = new Color[(drawArea.Width - 3) * (drawArea.Height - 3)];
			for (int i = 0; i < highlight.Length; ++i) { highlight[i] = Color.FromNonPremultiplied(200, 200, 200, 60); }
			m_highlightBG.SetData(highlight);

			_initItemLabel();

			m_recentClickTimer = new Timer(
				_state => { if (m_recentClickCount > 0) Interlocked.Decrement(ref m_recentClickCount); }, null, 0, 1000);
		}
Exemplo n.º 4
0
		public void SetItem(EquipLocation loc, ItemRecord info)
		{
			PaperdollDialogItem itemToUpdate = (PaperdollDialogItem)children.Find(_ctrl =>
			{
				PaperdollDialogItem item = _ctrl as PaperdollDialogItem;
				if (item == null) return false;
				return item.EquipLoc == loc;
			});
			if (itemToUpdate != null)
				itemToUpdate.SetInfo(_getEquipLocRectangle(loc), info);
		}
Exemplo n.º 5
0
		private void _updateDisplayDataSprites()
		{
			if (Data.shield != 0)
			{
				if (World.Instance.EIF != null)
				{
					shieldInfo = World.Instance.EIF.GetItemRecordByDollGraphic(ItemType.Shield, Data.shield);
					if(shieldInfo != null)
						shield = spriteSheet.GetShield(shieldInfo.Name == "Bag" || shieldInfo.SubType == ItemSubType.Arrows || shieldInfo.SubType == ItemSubType.Wings);
				}
			}
			else
			{
				shield = null;
				shieldInfo = null;
			}

			if (Data.weapon != 0)
			{
				if (World.Instance.EIF != null)
				{
					weaponInfo = World.Instance.EIF.GetItemRecordByDollGraphic(ItemType.Weapon, Data.weapon);
					if(weaponInfo != null)
						weapon = spriteSheet.GetWeapon(weaponInfo.SubType == ItemSubType.Ranged);
				}
			}
			else
			{
				weapon = null;
				weaponInfo = null;
			}

			bool isBow = weaponInfo != null && weaponInfo.SubType == ItemSubType.Ranged;
			characterSkin = spriteSheet.GetSkin(isBow, out m_skinSourceRect);
			boots = Data.boots != 0 ? spriteSheet.GetBoots(isBow) : null;
			armor = Data.armor != 0 ? spriteSheet.GetArmor(isBow) : null;
			lock (hatHairLock)
				hair = Data.hairstyle != 0 ? spriteSheet.GetHair(Data.hairNeedRefresh) : null;
			if (Data.hat != 0)
			{
				lock (hatHairLock)
					hat = spriteSheet.GetHat();
				if (World.Instance.EIF != null)
					hatInfo = World.Instance.EIF.GetItemRecordByDollGraphic(ItemType.Hat, Data.hat);
			}
			else
			{
				lock (hatHairLock)
				{
					hat = null;
					hatInfo = null;
				}
			}

			maskTheHair(); //this will set the combined hat/hair texture with proper data.

			_drawCharToRenderTarget();

			Data.SetUpdate(false);
			Data.SetHairNeedRefresh(false);
		}
Exemplo n.º 6
0
		private bool _addItemToSlot(bool[,] filledSlots, int slot, ItemRecord item, int count = 1)
		{
			//this is ADD item - don't allow adding items that have been added already
			if (slot < 0 || m_childItems.Count(_item => _item.Slot == slot) > 0) return false;
			
			List<Tuple<int, int>> points;
			if (!_fitsInSlot(filledSlots, slot, item.Size, out points)) return false;
			points.ForEach(point => filledSlots[point.Item1, point.Item2] = true); //flag that the spaces are taken

			m_inventoryKey.SetValue(string.Format("item{0}", slot), item.ID, RegistryValueKind.String); //update the registry
			m_childItems.Add(new EOInventoryItem(m_api, slot, item, new InventoryItem { amount = count, id = (short)item.ID }, this)); //add the control wrapper for the item
			m_childItems[m_childItems.Count - 1].DrawOrder = (int) ControlDrawLayer.DialogLayer - (2 + slot%INVENTORY_ROW_LENGTH);
			return true;
		}
Exemplo n.º 7
0
		private bool _addItemToSlot(int slot, ItemRecord item, int count = 1)
		{
			return _addItemToSlot(m_filledSlots, slot, item, count);
		}
		public override void Update(GameTime gameTime)
		{
			if (!Game.IsActive) return;

			MouseState currentState = Mouse.GetState();

			if (MouseOver && !MouseOverPreviously)
			{
				DATCONST2 msg;
				switch (EquipLoc)
				{
					case EquipLocation.Boots: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_BOOTS_EQUIPMENT; break;
					case EquipLocation.Accessory: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_MISC_EQUIPMENT; break;
					case EquipLocation.Gloves: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_GLOVES_EQUIPMENT; break;
					case EquipLocation.Belt: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_BELT_EQUIPMENT; break;
					case EquipLocation.Armor: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_ARMOR_EQUIPMENT; break;
					case EquipLocation.Necklace: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_NECKLACE_EQUIPMENT; break;
					case EquipLocation.Hat: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_HAT_EQUIPMENT; break;
					case EquipLocation.Shield: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_SHIELD_EQUIPMENT; break;
					case EquipLocation.Weapon: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_WEAPON_EQUIPMENT; break;
					case EquipLocation.Ring1:
					case EquipLocation.Ring2: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_RING_EQUIPMENT; break;
					case EquipLocation.Armlet1:
					case EquipLocation.Armlet2: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_ARMLET_EQUIPMENT; break;
					case EquipLocation.Bracer1:
					case EquipLocation.Bracer2: msg = DATCONST2.STATUS_LABEL_PAPERDOLL_BRACER_EQUIPMENT; break;
					default: throw new ArgumentOutOfRangeException();
				}

				if (m_info != null)
					EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_INFORMATION, msg, ", " + m_info.Name);
				else
					EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_INFORMATION, msg);
			}

			//unequipping an item via right-click
			if (m_info != null && MouseOver && currentState.RightButton == ButtonState.Released &&
				PreviousMouseState.RightButton == ButtonState.Pressed)
			{
				if (((EOPaperdollDialog)parent).CharRef == World.Instance.MainPlayer.ActiveCharacter)
				{ //the parent dialog must show equipment for mainplayer
					if (m_info.Special == ItemSpecial.Cursed)
					{
						EOMessageBox.Show(DATCONST1.ITEM_IS_CURSED_ITEM, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					}
					else if (!((EOGame)Game).Hud.InventoryFits((short)m_info.ID))
					{
						((EOGame)Game).Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING, DATCONST2.STATUS_LABEL_ITEM_UNEQUIP_NO_SPACE_LEFT);
					}
					else
					{
						_setSize(m_area.Width, m_area.Height);
						DrawLocation = new Vector2(m_area.X + (m_area.Width / 2 - DrawArea.Width / 2),
							m_area.Y + (m_area.Height / 2 - DrawArea.Height / 2));

						//put back in the inventory by the packet handler response
						string locName = Enum.GetName(typeof(EquipLocation), EquipLoc);
						if (!string.IsNullOrEmpty(locName))
							m_api.UnequipItem((short)m_info.ID, (byte)(locName.Contains("2") ? 1 : 0));

						m_info = null;
						m_gfx = null;
					}
				}
			}

			base.Update(gameTime);
		}
		public void SetInfo(Rectangle location, ItemRecord info)
		{
			m_info = info;
			if (info != null)
			{
				m_gfx = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.Items, 2 * info.Graphic, true);
			}
			m_area = location;

			if (m_gfx != null)
				_setSize(m_gfx.Width, m_gfx.Height);
			else
				_setSize(location.Width, location.Height);

			DrawLocation = new Vector2(location.X + (m_area.Width / 2 - DrawArea.Width / 2), location.Y + (m_area.Height / 2 - DrawArea.Height / 2));
		}