Ejemplo n.º 1
0
            private int GetStat(ulong handle, int index, ItemStatistic stat)
            {
                ulong val = 0;

                if (!workshop.ugc.GetQueryUGCStatistic(handle, (uint)index, (SteamNative.ItemStatistic)(uint) stat, out val))
                {
                    return(0);
                }

                return((int)val);
            }
Ejemplo n.º 2
0
        private ulong GetStat(uint index, ItemStatistic stat)
        {
            ulong val = 0;

            if (!SteamUGC.Internal.GetQueryUGCStatistic(Handle, index, stat, ref val))
            {
                return(0);
            }

            return(val);
        }
Ejemplo n.º 3
0
        private ulong GetStat(uint index, ItemStatistic stat)
        {
            ulong num;
            ulong num1 = (ulong)0;

            if (SteamUGC.Internal.GetQueryUGCStatistic(this.Handle, index, stat, ref num1))
            {
                num = num1;
            }
            else
            {
                num = (ulong)0;
            }
            return(num);
        }
Ejemplo n.º 4
0
        public Item GetItem(EBungieMembershipType membershipType, long membershipId, long itemHash, long itemInstance)
        {
            var itemDescInstance = Destiny2RestApi.Instance.GetItem(membershipType, membershipId, itemInstance, new int[] { 300 });
            var itemDefinition   = Destiny2RestApi.Instance.GetDefinition <DestinyInventoryItemDefinition>(itemHash);

            var itemModel      = new Item(itemDefinition);
            var statisticsList = new List <ItemStatistic>();
            var primaryStat    = itemDescInstance.Instance.Data.PrimaryStat;


            foreach (var stat in itemDefinition.Stats.Stats)
            {
                if (stat.Value.StatHash == null)
                {
                    continue;
                }
                var statDescription = Destiny2RestApi.Instance.GetDefinition <DestinyStatDefinition>(stat.Value.StatHash);

                if (string.IsNullOrEmpty(statDescription.DisplayProperties.Name))
                {
                    continue;
                }

                var statElement = new ItemStatistic(statDescription, stat.Value);
                if (statElement.Hash == primaryStat.StatHash)
                {
                    statElement.Value = primaryStat.Value;
                    statElement.IsPrimaryStatistic = true;
                }

                statisticsList.Add(statElement);
            }

            itemModel.Statistics = statisticsList.OrderBy(elt => elt.Name);
            return(itemModel);
        }
 // bool
 public bool GetQueryUGCStatistic(UGCQueryHandle_t handle /*UGCQueryHandle_t*/, uint index /*uint32*/, ItemStatistic eStatType /*EItemStatistic*/, out ulong pStatValue /*uint64 **/)
 {
     return(platform.ISteamUGC_GetQueryUGCStatistic(handle.Value, index, eStatType, out pStatValue));
 }
Ejemplo n.º 6
0
        public Item(TCODRandom rnd, ItemType desiredItemType, ItemQuality desiredItemQuality, int desiredItemLevel, ItemStatus desiredItemStatus)
        {
            // Set defaults
            type         = desiredItemType;
            status       = desiredItemStatus;
            itemLevel    = desiredItemLevel;
            itemLevel    = 0;
            attackBonus  = 0;
            defenseBonus = 0;
            bodyBonus    = 0;
            mindBonus    = 0;
            finesseBonus = 0;
            charges      = 0;
            quality      = desiredItemQuality;
            potionType   = ItemPotionType.None;
            scrollType   = ItemScrollType.None;
            wandType     = ItemWandType.None;
            itemGraphic  = ' ';
            itemColour   = new TCODColor(0, 0, 0);

            // Generate random numbers in case we need to use it later
            ItemStatistic randomStatistic1 = (ItemStatistic)rnd.getInt(0, 2);
            ItemStatistic randomStatistic2 = (ItemStatistic)rnd.getInt(0, 2);

            StringBuilder nameBuilder = new StringBuilder(string.Empty);

            // Generate items based upon their specified type, quality and level
            switch (desiredItemType)
            {
            case ItemType.Weapon:
            {
                int typeOfWeapon = rnd.getInt(1, 6);
                switch (typeOfWeapon)
                {
                case 1:
                    nameBuilder.Append("Longsword ");
                    break;

                case 2:
                    nameBuilder.Append("Polearm ");
                    break;

                case 3:
                    nameBuilder.Append("Spear ");
                    break;

                case 4:
                    nameBuilder.Append("Mace ");
                    break;

                case 5:
                    nameBuilder.Append("Warhammer ");
                    break;

                case 6:
                    nameBuilder.Append("Halberd ");
                    break;
                }
                itemGraphic = ')';
                switch (desiredItemQuality)
                {
                case ItemQuality.Common:
                    attackBonus = BaseWeaponDamage;
                    nameBuilder.Append("+0");
                    itemColour = TCODColor.lightestGrey;
                    break;

                case ItemQuality.Uncommon:
                    attackBonus = BaseWeaponDamage + desiredItemLevel;
                    nameBuilder.Append("+");
                    nameBuilder.Append(desiredItemLevel.ToString());
                    itemColour = TCODColor.green;
                    break;

                case ItemQuality.Superior:
                    attackBonus = BaseWeaponDamage + desiredItemLevel;
                    nameBuilder.Append("+");
                    nameBuilder.Append(desiredItemLevel.ToString());
                    itemColour = TCODColor.blue;
                    switch (randomStatistic1)
                    {
                    case ItemStatistic.Body:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("B)");
                        bodyBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Mind:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("M)");
                        mindBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Finesse:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("F)");
                        finesseBonus = desiredItemLevel;
                        break;
                    }
                    break;

                case ItemQuality.Epic:
                    attackBonus = BaseWeaponDamage + desiredItemLevel;
                    nameBuilder.Append("+");
                    nameBuilder.Append(desiredItemLevel.ToString());
                    itemColour = TCODColor.purple;
                    switch (randomStatistic1)
                    {
                    case ItemStatistic.Body:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("B)");
                        bodyBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Mind:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("M)");
                        mindBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Finesse:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("F)");
                        finesseBonus = desiredItemLevel;
                        break;
                    }
                    switch (randomStatistic2)
                    {
                    case ItemStatistic.Body:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("B)");
                        bodyBonus += desiredItemLevel;
                        break;

                    case ItemStatistic.Mind:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("M)");
                        mindBonus += desiredItemLevel;
                        break;

                    case ItemStatistic.Finesse:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("F)");
                        finesseBonus += desiredItemLevel;
                        break;
                    }
                    break;
                }
            }
            break;

            case ItemType.Armour:
            {
                int typeOfArmour = rnd.getInt(1, 4);
                switch (typeOfArmour)
                {
                case 1:
                    nameBuilder.Append("Chainmail ");
                    break;

                case 2:
                    nameBuilder.Append("Plate Armour ");
                    break;

                case 3:
                    nameBuilder.Append("Leather Armour ");
                    break;

                case 4:
                    nameBuilder.Append("Scale Armour ");
                    break;
                }
                itemGraphic = '[';
                switch (desiredItemQuality)
                {
                case ItemQuality.Common:
                    defenseBonus = BaseArmourClass;
                    nameBuilder.Append("+0");
                    itemColour = TCODColor.grey;
                    break;

                case ItemQuality.Uncommon:
                    defenseBonus = BaseArmourClass + desiredItemLevel;
                    nameBuilder.Append("+");
                    nameBuilder.Append(desiredItemLevel.ToString());
                    itemColour = TCODColor.green;
                    break;

                case ItemQuality.Superior:
                    defenseBonus = BaseArmourClass + desiredItemLevel;
                    nameBuilder.Append("+");
                    nameBuilder.Append(desiredItemLevel.ToString());
                    itemColour = TCODColor.blue;
                    switch (randomStatistic1)
                    {
                    case ItemStatistic.Body:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("B)");
                        bodyBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Mind:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("M)");
                        mindBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Finesse:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("F)");
                        finesseBonus = desiredItemLevel;
                        break;
                    }
                    break;

                case ItemQuality.Epic:
                    defenseBonus = BaseArmourClass + desiredItemLevel;
                    nameBuilder.Append("+");
                    nameBuilder.Append(desiredItemLevel.ToString());
                    itemColour = TCODColor.purple;
                    switch (randomStatistic1)
                    {
                    case ItemStatistic.Body:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("B)");
                        bodyBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Mind:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("M)");
                        mindBonus = desiredItemLevel;
                        break;

                    case ItemStatistic.Finesse:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("F)");
                        finesseBonus = desiredItemLevel;
                        break;
                    }
                    switch (randomStatistic2)
                    {
                    case ItemStatistic.Body:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("B)");
                        bodyBonus += desiredItemLevel;
                        break;

                    case ItemStatistic.Mind:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("M)");
                        mindBonus += desiredItemLevel;
                        break;

                    case ItemStatistic.Finesse:
                        nameBuilder.Append(" (+");
                        nameBuilder.Append(desiredItemLevel.ToString());
                        nameBuilder.Append("F)");
                        finesseBonus += desiredItemLevel;
                        break;
                    }
                    break;
                }
            }
            break;

            case ItemType.Potion:
                nameBuilder.Append("Potion of ");
                itemGraphic = '!';
                ItemPotionType randomPotionType = (ItemPotionType)rnd.getInt(0, 2);
                potionType = randomPotionType;
                nameBuilder.Append(randomPotionType.ToString());
                itemColour = TCODColor.white;
                break;

            case ItemType.Scroll:
                nameBuilder.Append("Scroll of ");
                itemGraphic = '?';
                ItemScrollType randomScrollType = (ItemScrollType)rnd.getInt(0, 3);
                scrollType = randomScrollType;
                nameBuilder.Append(randomScrollType.ToString());
                itemColour = TCODColor.white;
                break;

            case ItemType.Wand:
                nameBuilder.Append("Wand of ");
                itemGraphic = '/';
                ItemWandType randomWandType = (ItemWandType)rnd.getInt(0, 4);
                wandType = randomWandType;
                nameBuilder.Append(randomWandType.ToString());
                charges    = rnd.getInt(10, 20);
                itemColour = TCODColor.brass;
                break;

            case ItemType.Corpse:
                nameBuilder.Append("frozen corpse");
                itemGraphic = '%';
                itemColour  = TCODColor.grey;
                break;
            }

            name = nameBuilder.ToString().TrimEnd();
        }