//Removes an item from a characters equipment public static void CharacterRemoveItem(string CharacterName, EquipmentSlot EquipmentSlot) { //Define a new query, execute it in a command to update the characters equipment table to remove what item is in the specified equipment slot string Query = "UPDATE equipments SET " + EquipmentSlot.ToString() + "ItemNumber='0' WHERE Charactername='" + CharacterName + "'"; CommandManager.ExecuteNonQuery(Query, "Unequipping item from " + CharacterName + "s " + EquipmentSlot + " equipment slot"); }
private static string GetSlotDescription(EquipmentSlotDetails slot, EquipmentSlot slotName) { var equipmentString = slotName.ToString(); var indexString = slot.Index == 0 ? "" : $" {slot.Index + 1}"; return(equipmentString + indexString); }
//Returns an ItemData object detailing the current state of one of a characters equipment slots public static ItemData GetEquipmentSlot(string CharacterName, EquipmentSlot EquipmentSlot) { //Create a new ItemData object to store all the items information ItemData EquippedItem = new ItemData(); EquippedItem.ItemEquipmentSlot = EquipmentSlot; //Fetch the ItemNumber and ItemID values from the database and store these within the new ItemData object string ItemNumberQuery = "SELECT " + EquipmentSlot.ToString() + "ItemNumber FROM equipments WHERE CharacterName='" + CharacterName + "'"; EquippedItem.ItemNumber = CommandManager.ExecuteScalar(ItemNumberQuery, "Fetching ItemNumber value in " + CharacterName + "s " + EquipmentSlot + " equipment slot"); string ItemIDQuery = "SELECT " + EquipmentSlot.ToString() + "ItemID FROM equipments WHERE CharacterName='" + CharacterName + "'"; EquippedItem.ItemID = CommandManager.ExecuteScalar(ItemIDQuery, "Fetching ItemID value in " + CharacterName + "s " + EquipmentSlot + " equipment slot"); //Return the final ItemData object with all the equipped items information return(EquippedItem); }
public override void Use() { Debug.Log("equiping " + name); var spawnPoint = GameObject.FindGameObjectWithTag(equipSlot.ToString()).transform; var newObject = Instantiate(mesh, spawnPoint.position, spawnPoint.rotation, spawnPoint); InventoryManager.Instance.RemoveItem(this); EquipmentManager.Instance.Equip(this); }
public void EquipFromHand() { Equipment curr = null; if (Item.transform.root.Find(Slot.ToString()).childCount > 0) { curr = Item.transform.root.Find(Slot.ToString()).GetChild(0).GetComponent("Equipment") as Equipment; } Item.transform.parent = Item.transform.root.Find(Slot.ToString()).transform; Item.transform.localPosition = Vector3.zero; Item.transform.rotation = this.transform.rotation; equiped = true; Item.Holder.ActionPerformed = true; Item.Holder.Holding = null; if (curr != null) { UnequipToHand(curr); } }
private void UpdateEquipped() { if (IsEquipped) { statuses[1] = string.Format("<equipped {0}>", equipmentType == EquipmentType.twoHanded ? "both hands" : Naming.SpaceOutCamelCase(slot.ToString())); } else { statuses[1] = string.Empty; } }
private IEntity GiveTestItem(uint entityId, EquipmentSlot slot) { var item = new Entity(entityId, "Test" + slot.ToString(), new IEntityComponent[] { new Equipment() { EquipmentSlot = slot } }); entityEngine.Get(entityId).Returns(item); entity.Get <Inventory>().Contents.Add(item); return(item); }
//Returns an equipment slot with the matching EquipmentSlot type public DraggableUIComponent GetEquipmentSlot(EquipmentSlot EquipmentSlotType) { //Check all of the characters equipment slots foreach (DraggableUIComponent EquipmentSlot in EquipmentSlots) { //Return the equipment slot which has the matching EquipmentSlot type if (EquipmentSlot.EquipSlotType == EquipmentSlotType) { return(EquipmentSlot); } } //Couldnt find the matching equipment slot Debug.Log("couldnt find " + EquipmentSlotType.ToString() + " UI equipment slot"); return(null); }
public void PrintComparison(EquipmentSlot slot) { /////////////////////////// ///Label Data slotLabel.text = slot.ToString(); ///////////////////////////////////// ///Calculate and store change Dictionary <StatTypes, int> change = new Dictionary <StatTypes, int>(); Item currItem; string currItemKey = actor.equipment.GetItemEquipped(slot); currItem = Globals.campaign.GetItemData(currItemKey); currWepLabel.text = currItem.Name; foreach (StatTypes st in Enum.GetValues(typeof(StatTypes))) { //A negative delta represnts the new item being weaker than the current ones int i = -currItem.GetEquippedItem().bonusStats.GetValue(st) + item.GetEquippedItem().bonusStats.GetValue(st); if (i != 0) //if I is zero then there is no change in stats { change.Add(st, i); } } //////////////////////////// /// Print the change statChange.text = ""; foreach (StatTypes st in change.Keys.ToArray()) { statChange.text = st.ToString() + ": " + change[st] + "\n"; } }
public EquipmentSlotUi(EquipmentSlot slot, IPlayerManager playerManager, IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager) { _playerManager = playerManager; _resourceManager = resourceManager; _userInterfaceManager = userInterfaceManager; _color = Color.White; AssignedSlot = slot; _buttonSprite = _resourceManager.GetSprite("slot"); _textSprite = new TextSprite(slot + "UIElementSlot", slot.ToString(), _resourceManager.GetFont("CALIBRI")) { ShadowColor = Color.Black, ShadowOffset = new Vector2f(1, 1), Shadowed = true, Color = Color.White }; Update(0); }
public EquipmentSlotUi(EquipmentSlot slot, IPlayerManager playerManager, IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager) { _playerManager = playerManager; _resourceManager = resourceManager; _userInterfaceManager = userInterfaceManager; _color = Color.White; AssignedSlot = slot; _buttonSprite = _resourceManager.GetSprite("slot"); _textSprite = new TextSprite(slot + "UIElementSlot", slot.ToString(), _resourceManager.GetFont("CALIBRI")) { ShadowColor = Color.Black, ShadowOffset = new Vector2D(1, 1), Shadowed = true, Color = Color.White }; Update(0); }
public void RemoveEquipment(EquipmentSlot slot) { if (Equipment[(int)slot] != null) { var success = Backpack.TryAddItem((Equipment[(int)slot])); if (success) { Equipment[(int)slot] = null; Logger.Instance.Info("{0} has remove an item from the slot {1}.", Name, slot.ToString()); OnEquipmentChanged(null, this, slot); } } }
public RPGMessageBuilder EquipmentSlot(EquipmentSlot slot) { return(Color(AdventureColors.Slot).Text(slot.ToString()).Reset()); }
public void SetIndex(int index) { equipmentSlot = (EquipmentSlot)index; itemSlotName.text = equipmentSlot.ToString(); }