示例#1
0
        //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");
        }
示例#2
0
        private static string GetSlotDescription(EquipmentSlotDetails slot, EquipmentSlot slotName)
        {
            var equipmentString = slotName.ToString();
            var indexString     = slot.Index == 0 ? "" : $" {slot.Index + 1}";

            return(equipmentString + indexString);
        }
示例#3
0
        //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);
        }
示例#4
0
    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);
    }
示例#5
0
    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);
        }
    }
示例#6
0
 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);
        }
示例#8
0
    //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);
    }
示例#9
0
    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";
        }
    }
示例#10
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 Vector2f(1, 1),
                Shadowed     = true,
                Color        = Color.White
            };

            Update(0);
        }
示例#11
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);
        }
示例#12
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);
                }
            }
        }
示例#13
0
 public RPGMessageBuilder EquipmentSlot(EquipmentSlot slot)
 {
     return(Color(AdventureColors.Slot).Text(slot.ToString()).Reset());
 }
示例#14
0
 public void SetIndex(int index)
 {
     equipmentSlot     = (EquipmentSlot)index;
     itemSlotName.text = equipmentSlot.ToString();
 }