コード例 #1
0
        public void UnEquipItem()
        {
            //Character bob = CreateCharacter();
            //Bag b = CreateBag3();
            //Dictionary<InventorySlotId, Item> _items = new Dictionary<InventorySlotId, Item>();
            //bob.Bag.

            var   equipped = new EquippedItems();
            Armor junk     = new Armor(
                Guid.NewGuid(),
                "Leather Scraps",
                null,
                false,
                .5f,
                InventorySlotId.UNEQUIPPABLE,
                1,
                1);

            Assert.IsNull(equipped[InventorySlotId.HELMET]);

            equipped.Equip(InventorySlotId.HELMET, junk);
            Assert.AreEqual(junk, equipped[InventorySlotId.HELMET]);
            equipped.Unequip(InventorySlotId.HELMET);
            Assert.AreEqual(null, equipped[InventorySlotId.HELMET]);
        }
コード例 #2
0
    /// <summary>
    /// Read currently equipped item by the user from the database.
    /// </summary>
    /// <param name="studentUsername">Student's username used as the key for JSON.</param>
    /// <param name="callback">The callback method to be called after obtaining the data from database due to coroutine.</param>
    public static void GetEquippedItem(string studentUsername, GetEquippedItemCallback callback)
    {
        EquippedItems equippedItems = new EquippedItems();
        // set up instance of equipped weapon item object
        Item equippedItem = new Item();

        equippedItem.quantity        = 1;
        equippedItem.studentUsername = studentUsername;

        // get weapon item into list of equipped items
        equippedItems.weapon = equippedItem;

        // get equipped item from from database
        RestClient.Get($"{databaseURL}equipment/{studentUsername}.json").Then(res =>
        {
            // without using serializer, res1.Text will include '\"' on both ends of the string so need to Trim them away
            equippedItem.name = res.Text.Trim('\"');


            RestClient.Get($"{databaseURL}shop/{equippedItem.name}/property.json").Then(res1 =>
            {
                // without using serializer, res1.Text will include '\"' on both ends of the string so need to Trim them away
                equippedItem.property = res1.Text.Trim('\"');

                callback(equippedItems);
            });
        });
    }
コード例 #3
0
ファイル: EquipCard.cs プロジェクト: YinJayson/SeniorDesign
    //public EquipmentList list;

    void Awake()
    {
        charDict      = GameObject.FindObjectOfType <CharacterDictionary>();
        charStats     = charDict.dictionary[id];
        equipped      = GameObject.FindObjectOfType <EquipDictionary>().dictionary[id];
        equipmentDict = GameObject.FindObjectOfType <EquipmentDictionary>();
    }
コード例 #4
0
ファイル: Druid_Feral.cs プロジェクト: Lillecarl/FightClass1
        public void RemoveItems()
        {
            if (player.InCombat)
            {
                return;
            }

            foreach (var i in EquippedItems.GetEquippedItems())
            {
            }

            foreach (var i in Bag.GetBagItem())
            {
                var item = Database.Get <item_template, int>(i.Entry);

                bool remove = true;

                if (item.entry == 6948 || item.name.ToLower().Contains("hearthstone"))
                {
                    remove = false;
                }

                if (!((item.Quality == 0 /* || item.Quality == 1*/) && item.bonding != 4 && item.spellid_1 == 0 && item.spellid_2 == 0 && item.spellid_3 == 0 && item.spellid_4 == 0 && item.spellid_5 == 0))
                {
                    remove = false;
                }

                if (remove)
                {
                    RemoveItem(item);
                }
            }
        }
コード例 #5
0
    // public void verify(){
    //     loginControllerScript.ShowSuccessfulLogin();
    // }
    /// <summary>
    /// Function which is used to create a starting account in the database with default information and items
    /// </summary>
    /// <param name="verified"></param>
    /// <param name="username"></param>
    /// <param name="email"></param>
    private void PostToDatabase(bool verified = false, string username = null, string email = null)
    {
        UserData userData = new UserData();

        Debug.Log("1");
        if (verified)
        {
            userData.email         = email;
            userData.localId       = localId;
            userData.userName      = username;
            userData.level         = 1;
            userData.experience    = 0;
            userData.maxExperience = 100;
            userData.hp            = 100;
            userData.coin          = 0;
            userData.verified      = true;
        }
        Debug.Log("2");
        //verify();

        RestClient.Put(databaseURL + "/" + localId + ".json?auth=" + idToken, userData);
        Item          item         = new Item("Bronze Daggger", "Damage", 1, username);
        EquippedItems equippedItem = new EquippedItems();

        equippedItem.weapon = item;
        InventoryDBHandler.PutEquippedItem(username, equippedItem);
    }
コード例 #6
0
ファイル: Hero.cs プロジェクト: joshuaburton2/Kingsbane
 public void EquipItem(Item item)
 {
     if (EquippedItems.Count < ItemCapacity)
     {
         EquippedItems.Add(item);
     }
 }
コード例 #7
0
ファイル: Character.cs プロジェクト: bjthompson17/CS246-Team
/******************** Items **********************/
    public bool Equip(Item item)
    {
        if (FreeHands < item.Hands)
        {
            return(false);
        }

        ExpressionResult requierment = item.Requirement.Evaluate(this);

        if (!requierment.Success)
        {
            //ERROR
            Debug.LogError($"Error evaluating item \"{item.Name}\" requirement:\n{requierment.Message}");
            return(false);
        }
        if (requierment.Value == 0)
        {
            return(false);
        }

        EquippedItems.Add(item);
        FreeHands -= item.Hands;
        RefreshModifiers();
        return(true);
    }
コード例 #8
0
ファイル: InventoryForm.cs プロジェクト: Neonixxx/SomeName
 public void UpdateEquippedItems(EquippedItems equippedItems)
 {
     _equippedItems = equippedItems;
     SetEquippedSlot(MainHandSlot, equippedItems.Weapon);
     SetEquippedSlot(ChestSlot, equippedItems.Chest);
     SetEquippedSlot(GlovesSlot, equippedItems.Gloves);
 }
コード例 #9
0
ファイル: Main.cs プロジェクト: zneel/TheNoobBot
    public void Initialize()
    {
        try
        {
            Directory.CreateDirectory(Application.StartupPath + "\\Profiles\\Fisherbot\\");
            FisherbotSetting.Load();

            if (string.IsNullOrWhiteSpace(FisherbotSetting.CurrentSetting.FishingPoleName))
            {
                FisherbotSetting.CurrentSetting.FishingPoleName = Fishing.FishingPolesName();
            }
            if (string.IsNullOrWhiteSpace(FisherbotSetting.CurrentSetting.WeaponName))
            {
                FisherbotSetting.CurrentSetting.WeaponName = EquippedItems.GetEquippedItem(WoWInventorySlot.INVTYPE_WEAPONMAINHAND).Name;
                FisherbotSetting.CurrentSetting.ShieldName = EquippedItems.GetEquippedItem(WoWInventorySlot.INVTYPE_SHIELD).Name;
                if (FisherbotSetting.CurrentSetting.WeaponName == FisherbotSetting.CurrentSetting.ShieldName)
                {
                    FisherbotSetting.CurrentSetting.ShieldName = "";
                }
            }

            Others.ProductStatusLog(Products.ProductName, 1);
        }
        catch (Exception e)
        {
            Logging.WriteError("Fisherbot > Main > Initialize(): " + e);
        }
    }
コード例 #10
0
        public Element GetElementSlot(InventoryIndex inventoryIndex)
        {
            switch (inventoryIndex)
            {
            case InventoryIndex.None:
                throw new ArgumentOutOfRangeException(nameof(inventoryIndex));

            case InventoryIndex.Helm:
                return(EquippedItems.GetChildAtIndex(10));

            case InventoryIndex.Amulet:
                return(EquippedItems.GetChildAtIndex(11));

            case InventoryIndex.Chest:
                return(EquippedItems.GetChildAtIndex(12));

            case InventoryIndex.LWeapon:
                return(EquippedItems.GetChildAtIndex(14));

            case InventoryIndex.RWeapon:
                return(EquippedItems.GetChildAtIndex(13));

            case InventoryIndex.LWeaponSwap:
                return(EquippedItems.GetChildAtIndex(3));

            case InventoryIndex.RWeaponSwap:
                return(EquippedItems.GetChildAtIndex(2));

            case InventoryIndex.LRing:
                return(EquippedItems.GetChildAtIndex(17));

            case InventoryIndex.RRing:
                return(EquippedItems.GetChildAtIndex(18));

            case InventoryIndex.Gloves:
                return(EquippedItems.GetChildAtIndex(19));

            case InventoryIndex.Belt:
                return(EquippedItems.GetChildAtIndex(20));

            case InventoryIndex.Boots:
                return(EquippedItems.GetChildAtIndex(21));

            case InventoryIndex.PlayerInventory:
                return(EquippedItems.GetChildAtIndex(22));

            case InventoryIndex.Flask:
                return(EquippedItems.GetChildAtIndex(23));

            case InventoryIndex.Trinket:
                return(EquippedItems.GetChildAtIndex(24));

            case InventoryIndex.BloodCrucible:
                return(EquippedItems.GetChildAtIndex(1));

            default:
                throw new ArgumentOutOfRangeException(nameof(inventoryIndex));
            }
        }
コード例 #11
0
ファイル: Player.cs プロジェクト: arxae/Realm-Rpg
        public EquipmentBonusses GetEquipmentBonusses()
        {
            var eqBonus = EquippedItems.GetCurrentBonusses();

            return(new EquipmentBonusses(
                       Attributes.Strength + eqBonus.AttackBonus,
                       Attributes.Stamina + eqBonus.DefenceBonus));
        }
コード例 #12
0
        private InventorySlot FindBestEquipmentSlot(IEnumerable <InventorySlot> equipSlots, out float lowestItemScore)
        {
            InventorySlot bestSlot = InventorySlot.None;

            float lowestEquippedItemScore = float.MaxValue;

            foreach (InventorySlot inventorySlot in equipSlots)
            {
                if (AutoEquipSettings.Instance.ProtectedSlots.Contains(inventorySlot))
                {
                    //Log(true, "I'm not equipping into equipment slot {0} as it is protected", inventorySlot);
                    continue;
                }

                if (!EquippedItems.ContainsKey(inventorySlot))
                {
                    Log(true, "InventorySlot {0} is unknown! Please report this to MaiN.", inventorySlot);
                    continue;
                }

                WoWItem equippedItem = EquippedItems[inventorySlot];
                if (equippedItem == null)
                {
                    lowestItemScore = float.MinValue;
                    return(inventorySlot);
                }

                if (!AutoEquipSettings.Instance.ReplaceHeirlooms && equippedItem.Quality == WoWItemQuality.Heirloom)
                {
                    //Log(false, "I'm not equipping anything into {0} as I can't replace heirloom items!", inventorySlot);
                    continue;
                }

                // Compute the score for the current equipped item.
                float itemScore = _weightSet.EvaluateItem(equippedItem, AutoEquipSettings.Instance.IncludeEnchants);

                // Set the score to zero if the item is a two hand weapon and the weapon style doesn't match, kinda hackish but it works ;p.
                if (AutoEquipSettings.Instance.WeaponStyle != WeaponStyle.TwoHander && equippedItem.ItemInfo.InventoryType == InventoryType.TwoHandWeapon)
                {
                    itemScore = 0;
                }

                // Set the score to zero if the item is a shield and the weapon style doesn't match, kinda hackish but it works ;p.
                if (AutoEquipSettings.Instance.WeaponStyle != WeaponStyle.OneHanderAndShield && equippedItem.ItemInfo.InventoryType == InventoryType.Shield)
                {
                    itemScore = 0;
                }

                if (itemScore < lowestEquippedItemScore)
                {
                    bestSlot = inventorySlot;
                    lowestEquippedItemScore = itemScore;
                }
            }

            lowestItemScore = lowestEquippedItemScore;
            return(bestSlot);
        }
コード例 #13
0
 // Konstruktor som tilskriver intans variablene samt køre methoden RunInvList
 public AddToInventoryForm(List <Item> MyList, CharacterAttributes Attri, EquippedItems EQ)
 {
     myInventoryList = MyList;
     myAttributes    = Attri;
     myEquippedItems = EQ;
     InitializeComponent();
     this.BackColor = ColorTranslator.FromHtml("#D2D6D7");
     RunInvList();
 }
コード例 #14
0
 // Konstruktor som tilskriver intans variablene samt Initialisering baggroundsfarven til EquipSlotCheck form Design
 public EquipSlotCheck(Weapon Weapon, EquippedItems EquipmentChoice, string message, string Slot1, string Slot2, string Slot3)
 {
     InitializeComponent();
     this.BackColor       = ColorTranslator.FromHtml("#D2D6D7");
     label1.Text          = message;
     WeaponSlotOne.Text   = Slot1;
     WeaponSlotTwo.Text   = Slot2;
     WeaponSlotThree.Text = Slot3;
     myEquippedItems      = EquipmentChoice;
     myWeapon             = Weapon;
 }
コード例 #15
0
        public static EquippedItems Load(EquippedItemsSave save)
        {
            EquippedItems items = new EquippedItems();

            items.Helmet     = ItemSave.Load(save.Helmet);
            items.Chestplate = ItemSave.Load(save.Chestplate);
            items.Leggings   = ItemSave.Load(save.Leggings);
            items.Boots      = ItemSave.Load(save.Boots);
            items.Weapon     = ItemSave.Load(save.Weapon);
            return(items);
        }
コード例 #16
0
ファイル: Character.cs プロジェクト: bjthompson17/CS246-Team
    public bool Unequip(Item item)
    {
        if (!EquippedItems.Contains(item))
        {
            return(false);
        }
        EquippedItems.Remove(item);

        FreeHands += item.Hands;
        RefreshModifiers();
        return(true);
    }
コード例 #17
0
        public ushort GetEquippedBySlot(ItemSlot pSlot)
        {
            //double check if found
            var equip = EquippedItems.Find(d => d.Slot == (sbyte)pSlot && d.IsEquipped);

            if (equip == null)
            {
                return(0xffff);
            }

            return(equip.ID);
        }
コード例 #18
0
        public static EquippedItemsSave Save(EquippedItems items)
        {
            EquippedItemsSave save = new EquippedItemsSave();

            save.Helmet     = ItemSave.Save(items.Helmet);
            save.Chestplate = ItemSave.Save(items.Chestplate);
            save.Leggings   = ItemSave.Save(items.Leggings);
            save.Boots      = ItemSave.Save(items.Boots);
            save.Weapon     = ItemSave.Save(items.Weapon);

            return(save);
        }
コード例 #19
0
 /* Konstruktor som tilskriver intans variablene og de forskellige initialiseret værdier
  * samt Initialisering kontstructoren baggroundsfarven til EquipWeaponFromSheet form Design og initialisere forskellige værdier */
 public EquipWeaponFromSheet(int AttributesPlacement, EquippedItems Equipped, int ID, ListView ListToTakeFrom, string LabelText, string ButtonOne, string ButtonTwo, string ButtonThree)
 {
     InitializeComponent();
     FormLabelText.Text   = LabelText;
     SlotOneButton.Text   = ButtonOne;
     SlotTwoButton.Text   = ButtonTwo;
     SlotThreeButton.Text = ButtonThree;
     myEquippedItems      = Equipped;
     myListView           = ListToTakeFrom;
     WeaponID             = ID;
     AttributeLocation    = AttributesPlacement;
     this.BackColor       = ColorTranslator.FromHtml("#D2D6D7");
 }
コード例 #20
0
        private void Inventory_WearingItemsChanged(object?sender, ItemEventArgs eventArgs)
        {
            var item = eventArgs.Item;

            if (!item.HasSkill || item.Definition?.Skill is null)
            {
                return;
            }

            var inventory = this.player.Inventory;

            if (inventory !.EquippedItems.Contains(item))
            {
                this.AddItemSkill(item.Definition.Skill);
            }
コード例 #21
0
        public bool TryUnequipItem(ItemInstance i, bool force = false)
        {
            if (EquippedItems.Where(a => a.Value == i).Count() == 0)
            {
                MainViewModel.WriteText("ERROR: Item not equipped!", null);
            }
            if (!force)
            {
                foreach (var slot in i.item.EquipmentRef.OccupiesSlots)
                {
                    foreach (var a in EquippedItems.Where(b => b.Value != null && b.Value != i).Select(b => b.Value).Distinct())
                    {
                        var equip = a.item.EquipmentRef;
                        if (equip.CoversSlots.Contains(slot))
                        {
                            var result = new ScriptWrapper(equip.OnUnequip)
                            {
                                ItemBase = a
                            }.Execute();
                            if (result == false)
                            {
                                MainViewModel.WriteText("Unable to unequip " + i.CurrentName + " because " + a.CurrentName + " is covering it and could not be removed!", null);
                                return(false);
                            }
                        }
                    }
                }
                {
                    var result = new ScriptWrapper(i.item.EquipmentRef.OnUnequip)
                    {
                        ItemBase = i
                    }.Execute();
                    if (result == false)
                    {
                        MainViewModel.WriteText("Unable to unequip " + i.CurrentName + " because it is currently unable to be removed!", null);
                        return(false);
                    }
                }
            }

            List <EquipmentSlot> slots = EquippedItems.Where(a => a.Value == i).Select(a => a.Key).ToList();

            foreach (var a in slots)
            {
                EquippedItems[a] = null;
            }
            return(true);
        }
コード例 #22
0
        /// <inheritdoc />
        public override bool ConsumeItem(Player player, Item item, Item?targetItem, FruitUsage fruitUsage)
        {
            if (!this.CheckPreconditions(player, item))
            {
                return(false);
            }

            var isAdding      = fruitUsage != FruitUsage.RemovePoints;
            var statAttribute = this.GetStatAttribute(item);

            if (player.Level < 10 || item.Level > 4)
            {
                player.ViewPlugIns.GetPlugIn <IFruitConsumptionResponsePlugIn>()?
                .ShowResponse(isAdding ? FruitConsumptionResult.PlusPrevented : FruitConsumptionResult.MinusPrevented, 0, statAttribute);
                return(false);
            }

            var statAttributeDefinition = player.SelectedCharacter !.CharacterClass?.StatAttributes.FirstOrDefault(a =>
                                                                                                                   a.IncreasableByPlayer && a.Attribute == statAttribute);

            if (statAttributeDefinition is null)
            {
                player.ViewPlugIns.GetPlugIn <IFruitConsumptionResponsePlugIn>()?
                .ShowResponse(isAdding ? FruitConsumptionResult.PlusPrevented : FruitConsumptionResult.MinusPrevented, 0, statAttribute);
                return(false);
            }

            if (player.Inventory !.EquippedItems.Any())
            {
                player.ViewPlugIns.GetPlugIn <IFruitConsumptionResponsePlugIn>()?.ShowResponse(FruitConsumptionResult.PreventedByEquippedItems, 0, statAttribute);
                return(false);
            }

            var maximumRemainingPoints = player.SelectedCharacter.GetMaximumFruitPoints()
                                         - (isAdding
                                             ? player.SelectedCharacter.UsedFruitPoints
                                             : player.SelectedCharacter.UsedNegFruitPoints);

            if (maximumRemainingPoints <= 0)
            {
                player.ViewPlugIns.GetPlugIn <IFruitConsumptionResponsePlugIn>()?
                .ShowResponse(isAdding ? FruitConsumptionResult.PlusPreventedByMaximum : FruitConsumptionResult.MinusPreventedByMaximum, 0, statAttribute);
                return(false);
            }

            if (!isAdding && player.Attributes ![statAttribute] <= statAttributeDefinition.BaseValue)
コード例 #23
0
    /// <summary>
    /// Fetch required data from database and set the values on the UI.
    /// </summary>
    public void Init()
    {
        // StartCoroutine(inventoryInt.getInventoryDetails((success, allResults) => {
        //     if (success)
        //     {
        //         this.inBagList = allResults;
        //         this.populateInBagItems();
        //     }
        // }));

        // StartCoroutine(inventoryInt.getEquippedItemsDetails((success, allResults) => {
        //     if (success)
        //     {
        //         this.equippedItems = allResults;
        //     }
        // }));

        // get userdata from mainmenu
        this.userData = this.mainMenuControllerScript.getUserData();

        // incase server have issues and never fetch the user data entity
        if (this.userData == null)
        {
            return;
        }

        // get items list
        InventoryDBHandler.GetInventory(userData.getName(), itemsDict => {
            // set to local dictionary of items in inventory
            this.inBagList = itemsDict;
            // display list of items in inventory on the UI
            this.populateInBagItems();
        });

        InventoryDBHandler.GetEquippedItem(userData.getName(), equippedObj => {
            // set to local object of equipped items
            this.equippedItems = equippedObj;

            // set weapon name on the UI
            this.equippedWeapon.GetComponent <Text>().text = equippedObj.weapon.name;
        });

        // set the gold amount to the UI
        goldAmount.GetComponent <Text>().text = this.userData.getCoin().ToString();
    }
コード例 #24
0
        public void TC15EquipPotionTest()
        {
            UserData userData = new UserData();

            userData.userName = "******";
            GameObject         inventoryGameObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/InventoryCanvas"));
            InventoryViewModel inventoryViewModel  = inventoryGameObject.transform.Find("InventoryUI").Find("Inbag ScrollView").Find("Viewport").Find("In-bagContent").GetComponent <InventoryViewModel>();

            inventoryViewModel.setUserData(userData);

            // create only one item to be stored in the inventory
            Item inBagWeapon = new Item();

            inBagWeapon.name            = "Healing Potion";
            inBagWeapon.studentUsername = "******";
            inBagWeapon.quantity        = 1;
            inBagWeapon.property        = Item.HEALINGPOTION;

            // set one item which is "Healing Potion" to inventory items
            Dictionary <string, Item> inBagList = new Dictionary <string, Item>();

            inBagList.Add(inBagWeapon.studentUsername + inBagWeapon.name, inBagWeapon);
            inventoryViewModel.setInBagList(inBagList);

            // generate an item to be equipped which is "Bronze Dagger"
            Item equippedWeapon = new Item();

            equippedWeapon.name            = "Bronze Dagger";
            equippedWeapon.studentUsername = "******";
            equippedWeapon.quantity        = 1;
            equippedWeapon.property        = Item.WEAPON;

            EquippedItems equippedItems = new EquippedItems();

            equippedItems.weapon = equippedWeapon;
            inventoryViewModel.setEquippedItems(equippedItems);

            // stimulate click on the first item as there are only one item in the inventory and check if it is fails to be equipped
            inventoryViewModel.onInBagItemClick(inventoryViewModel.getInstantiatedUI()[0]);
            // check if "Healing Potion" is not being equipped as a weapon
            Assert.AreNotEqual("Healing Potion", inventoryViewModel.equippedWeapon.GetComponent <Text>().text);;
            // check if "Healing Potion" is still in the inventory
            Assert.AreEqual("Healing Potion", inventoryViewModel.getInstantiatedUI()[0].transform.GetChild(0).GetComponent <Text>().text);
        }
コード例 #25
0
ファイル: Inventory.cs プロジェクト: topblast/Estrella
 public void AddToEquipped(Item pEquip)
 {
     try
     {
         locker.WaitOne();
         Item old = EquippedItems.Find(equip => equip.Slot == pEquip.Slot);
         if (old != null)
         {
             old.IsEquipped = false;
             AddToInventory(old);
             EquippedItems.Remove(old);
         }
         EquippedItems.Add(pEquip);
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
コード例 #26
0
    public void EquipTwoHand()
    {
        var weapon = EquippedItems.GetEquippedItems();

        foreach (var th in weapon)
        {
            if (th.Name == WarriorHelperSettings.CurrentSetting.twoHand)
            {
                return;
            }
        }
        try
        {
            ItemsManager.EquipItemByName(WarriorHelperSettings.CurrentSetting.twoHand);
        }
        catch (Exception e)
        {
            Logging.WriteDebug("WarriorHelper.WeaponManager.Battle: " + e);
            throw;
        }
    }
コード例 #27
0
ファイル: Account.cs プロジェクト: Lindet/DiabloClickerWiP
    private void RecalculateStats()
    {
        double mainStatFromItems;

        if (Class == GameClasses.Barbarian || Class == GameClasses.Crusader)
        {
            mainStatFromItems = EquippedItems.Where(z => z != null).Sum(z => z.itemStats.Where(x => x.stat == CharacterStat.Strength).Sum(x => x.StatAmount));
        }
        else if (Class == GameClasses.Monk || Class == GameClasses.DemonHunter)
        {
            mainStatFromItems = EquippedItems.Where(z => z != null).Sum(z => z.itemStats.Where(x => x.stat == CharacterStat.Dexterity).Sum(x => x.StatAmount));
        }
        else
        {
            mainStatFromItems = EquippedItems.Where(z => z != null).Sum(z => z.itemStats.Where(x => x.stat == CharacterStat.Intelligence).Sum(x => x.StatAmount));
        }
        Stats.mainStat  = 1 + (Stats.coreTalentsArray[1] * 5) + Convert.ToInt32(mainStatFromItems);
        Stats.vitality  = 1 + (Stats.coreTalentsArray[2] * 5);
        Stats.damage    = 1 * Stats.mainStat * (level != 1 ? level / 2 : 1);
        Stats.botDamage = Convert.ToInt32(EquippedItems.Where(z => z != null).Sum(z => z.itemStats.Where(x => x.stat == CharacterStat.BotDamage).Sum(x => x.StatAmount)) + (Stats.botTalentsArray[1] * 0.1 * Stats.damage));
    }
コード例 #28
0
    public void EquipOneHand()
    {
        var weapon = EquippedItems.GetEquippedItems();

        foreach (var oh in weapon)
        {
            if (oh.Name == WarriorHelperSettings.CurrentSetting.oneHand)
            {
                return;
            }
        }
        try
        {
            ItemsManager.EquipItemByName(WarriorHelperSettings.CurrentSetting.oneHand);
            ItemsManager.EquipItemByName(WarriorHelperSettings.CurrentSetting.shield);
        }
        catch (Exception e)
        {
            Logging.WriteDebug("WarriorHelper.WeaponManager.Defensive: " + e);
            throw;
        }
    }
コード例 #29
0
 public static void Craft(string skillName, Item item, int quantity)
 {
     OpenProfessionFrame(skillName);
     if (item.IsAnEnchant)
     {
         UseProfessionSkill(item, 1);
         WoWItem itemToEnchant = EquippedItems.GetEquippedItems().Find(i => i.GetItemInfo.ItemEquipLoc == item.EnchantGearType);
         for (var i = 0; i < quantity; i++)
         {
             int itemSlot = GetGearSlot(itemToEnchant);
             Logger.Log($"Enchanting {itemToEnchant.Name}");
             Lua.RunMacroText($"/use {itemSlot}");
             Lua.LuaDoString("ReplaceEnchant()");
             Usefuls.WaitIsCasting();
         }
     }
     else
     {
         UseProfessionSkill(item, quantity);
     }
     Usefuls.WaitIsCasting();
 }
コード例 #30
0
 public Element GetElementSlot(InventoryIndex inventoryIndex)
 {
     return(inventoryIndex switch
     {
         InventoryIndex.None => throw new ArgumentOutOfRangeException(nameof(inventoryIndex)),
         InventoryIndex.Helm => EquippedItems.GetChildAtIndex(6),
         InventoryIndex.Amulet => EquippedItems.GetChildAtIndex(7),
         InventoryIndex.Chest => EquippedItems.GetChildAtIndex(8),
         InventoryIndex.LWeapon => EquippedItems.GetChildAtIndex(10),
         InventoryIndex.RWeapon => EquippedItems.GetChildAtIndex(9),
         InventoryIndex.LWeaponSwap => EquippedItems.GetChildAtIndex(12),
         InventoryIndex.RWeaponSwap => EquippedItems.GetChildAtIndex(11),
         InventoryIndex.LRing => EquippedItems.GetChildAtIndex(13),
         InventoryIndex.RRing => EquippedItems.GetChildAtIndex(14),
         InventoryIndex.Gloves => EquippedItems.GetChildAtIndex(15),
         InventoryIndex.Belt => EquippedItems.GetChildAtIndex(16),
         InventoryIndex.Boots => EquippedItems.GetChildAtIndex(17),
         InventoryIndex.PlayerInventory => EquippedItems.GetChildAtIndex(18),
         InventoryIndex.Flask => EquippedItems.GetChildAtIndex(19),
         InventoryIndex.Trinket => EquippedItems.GetChildAtIndex(20),
         InventoryIndex.BloodCrucible => EquippedItems.GetChildAtIndex(1),
         _ => throw new ArgumentOutOfRangeException(nameof(inventoryIndex))
     });