public async Task <List <ItemModel> > AddItemsListAsync(string inventoryType, Item[] items, MemberModel member,
                                                                ItemsManifestService manifest, APIAccessor accessor)
        {
            var itemList = new List <ItemModel>();

            foreach (var item in items)
            {
                try
                {
                    ItemManifestModel info = manifest.GetManifestItemData(item);
                    BucketModel       type = info != null?manifest.GetManifestBucketData(info, item) : null;

                    PrimaryStat instance = item.ItemInstanceId != null && type != null ? await GetInstanceAsync(item, member, accessor) : null;

                    //DamageModel damage = new DamageModel();
                    //if (info != null && type.DisplayProperties.Name == "Energy Weapons")
                    //{
                    //    damage = manifest.GetDamageTypeData(info);
                    //}
                    //DamageModel damage = info != null && type.DisplayProperties.Name == "Energy Weapons" ? manifest.GetDamageTypeData(info) : null;

                    if (info != null && type != null)
                    {
                        itemList.Add(AddModelItem(inventoryType, item, type, info, instance));
                    }
                }
                catch (Exception e) { }
            }
            return(itemList);
        }
Exemple #2
0
        private List <KeyValuePair <string, int> > GetStatsData(PrimaryStat stats)
        {
            var data = new List <KeyValuePair <string, int> >();

            if (stats.Strength != 0)
            {
                data.Add(new KeyValuePair <string, int>("Strength", stats.Strength));
            }
            if (stats.Stamina != 0)
            {
                data.Add(new KeyValuePair <string, int>("Stamina", stats.Stamina));
            }
            if (stats.Intellect != 0)
            {
                data.Add(new KeyValuePair <string, int>("Intellect", stats.Intellect));
            }
            if (stats.Agility != 0)
            {
                data.Add(new KeyValuePair <string, int>("Agility", stats.Agility));
            }
            if (stats.Speed != 0)
            {
                data.Add(new KeyValuePair <string, int>("Speed", stats.Speed));
            }

            return(data);
        }
Exemple #3
0
 public Database.API.Dto.PrimaryStat MapToDb(PrimaryStat svcPrimaryStat)
 {
     return(new Database.API.Dto.PrimaryStat
     {
         Id = (Database.API.Dto.AbilityType)svcPrimaryStat.Id,
         Name = svcPrimaryStat.Name,
         AbilityScore = svcPrimaryStat.AbilityScore,
     });
 }
Exemple #4
0
        public UiPrimaryStat MapToUi(PrimaryStat svcPrimaryStat)
        {
            var result = new UiPrimaryStat
            {
                Name            = svcPrimaryStat.Name,
                ShortName       = IdToStringMapping[svcPrimaryStat.Id],
                AbilityScore    = svcPrimaryStat.AbilityScore.ToString(),
                AbilityModifier = CreateUiAbilityModifier(svcPrimaryStat.AbilityModifier),
            };

            return(result);
        }
 public void UpdateDamageBonusFromStats(int bonus, PrimaryStat stat)
 {
     if ((int)weapon.scaling == (int)stat)
     {
         minDamage += bonus / 2;
         maxDamage += bonus / 2;
     }
     else
     {
         minDamage += bonus / 4;
         maxDamage += bonus / 4;
     }
 }
Exemple #6
0
 public override void TriggerEvent()
 {
     if (CanTriggerEvent())
     {
         // Play animation of playing with the blocks
         stats.IncreaseStat(PrimaryStat);
         GetComponent <Animator>().SetBool("Build", true);
         Debug.Log(PrimaryStat.ToString());
         base.TriggerEvent();
     }
     else
     {
         Debug.LogWarning($"Already triggered event {EventName}");
     }
 }
 public bool DeepEquals(DestinyItemInstanceComponent?other)
 {
     return(other is not null &&
            DamageType == other.DamageType &&
            DamageTypeHash == other.DamageTypeHash &&
            (PrimaryStat is not null ? PrimaryStat.DeepEquals(other.PrimaryStat) : other.PrimaryStat is null) &&
            ItemLevel == other.ItemLevel &&
            Quality == other.Quality &&
            IsEquipped == other.IsEquipped &&
            CanEquip == other.CanEquip &&
            EquipRequiredLevel == other.EquipRequiredLevel &&
            UnlockHashesRequiredToEquip.DeepEqualsListNaive(other.UnlockHashesRequiredToEquip) &&
            CannotEquipReason == other.CannotEquipReason &&
            BreakerType == other.BreakerType &&
            BreakerTypeHash == other.BreakerTypeHash &&
            (Energy is not null ? Energy.DeepEquals(other.Energy) : other.Energy is null));
 }
    public Character()
    {
        name = "";

        gender = Constants.Gender.Male;

        agility    = new PrimaryStat(Constants.StatType.Agility, 10, 0, 20);
        might      = new PrimaryStat(Constants.StatType.Might, 10, 0, 20);
        stamina    = new PrimaryStat(Constants.StatType.Stamina, 10, 0, 20);
        knowledge  = new PrimaryStat(Constants.StatType.Knowledge, 10, 0, 20);
        perception = new PrimaryStat(Constants.StatType.Perception, 10, 0, 20);
        willpower  = new PrimaryStat(Constants.StatType.Willpower, 10, 0, 20);

        unspentPoints = 0;

        calculateDerivedStats();
        initializeSkills();
    }
 public void Update(DestinyItemInstanceComponent?other)
 {
     if (other is null)
     {
         return;
     }
     if (DamageType != other.DamageType)
     {
         DamageType = other.DamageType;
         OnPropertyChanged(nameof(DamageType));
     }
     if (DamageTypeHash != other.DamageTypeHash)
     {
         DamageTypeHash = other.DamageTypeHash;
         OnPropertyChanged(nameof(DamageTypeHash));
     }
     if (!PrimaryStat.DeepEquals(other.PrimaryStat))
     {
         PrimaryStat.Update(other.PrimaryStat);
         OnPropertyChanged(nameof(PrimaryStat));
     }
     if (ItemLevel != other.ItemLevel)
     {
         ItemLevel = other.ItemLevel;
         OnPropertyChanged(nameof(ItemLevel));
     }
     if (Quality != other.Quality)
     {
         Quality = other.Quality;
         OnPropertyChanged(nameof(Quality));
     }
     if (IsEquipped != other.IsEquipped)
     {
         IsEquipped = other.IsEquipped;
         OnPropertyChanged(nameof(IsEquipped));
     }
     if (CanEquip != other.CanEquip)
     {
         CanEquip = other.CanEquip;
         OnPropertyChanged(nameof(CanEquip));
     }
     if (EquipRequiredLevel != other.EquipRequiredLevel)
     {
         EquipRequiredLevel = other.EquipRequiredLevel;
         OnPropertyChanged(nameof(EquipRequiredLevel));
     }
     if (!UnlockHashesRequiredToEquip.DeepEqualsListNaive(other.UnlockHashesRequiredToEquip))
     {
         UnlockHashesRequiredToEquip = other.UnlockHashesRequiredToEquip;
         OnPropertyChanged(nameof(UnlockHashesRequiredToEquip));
     }
     if (CannotEquipReason != other.CannotEquipReason)
     {
         CannotEquipReason = other.CannotEquipReason;
         OnPropertyChanged(nameof(CannotEquipReason));
     }
     if (BreakerType != other.BreakerType)
     {
         BreakerType = other.BreakerType;
         OnPropertyChanged(nameof(BreakerType));
     }
     if (BreakerTypeHash != other.BreakerTypeHash)
     {
         BreakerTypeHash = other.BreakerTypeHash;
         OnPropertyChanged(nameof(BreakerTypeHash));
     }
     if (!Energy.DeepEquals(other.Energy))
     {
         Energy.Update(other.Energy);
         OnPropertyChanged(nameof(Energy));
     }
 }
 private void Start()
 {
     playerPrimaryStat = PlayerStats.instance.character.primaryStat;
     shoot             = GetComponent <ShootProjectile>();
     UpdateWeaponDamage();
 }
Exemple #11
0
 public static byte[] UpdatePrimaryStat(PrimaryStat stat, bool itemReaction = false, Character chr = null)
 {
     var dict = new Dictionary<PrimaryStat, int>();
     dict.Add(stat, 0);
     return UpdatePrimaryStat(dict, itemReaction, chr);
 }
        public ItemModel AddModelItem(string inventoryType, Item item, BucketModel type, ItemManifestModel info, PrimaryStat instancePath)
        {
            ItemModel Item = new ItemModel
            {
                ItemHashId    = item.ItemHash,
                BucketHash    = item.BucketHash,
                BucketType    = type.DisplayProperties.Name,
                ItemDesc      = info.DisplayProperties.Description,
                ItemIcon      = "https://www.bungie.net" + info.DisplayProperties.Icon,
                ItemName      = info.DisplayProperties.Name,
                ItemType      = info.ItemTypeDisplayName,
                IconWM        = "https://www.bungie.net",
                TierType      = info.Inventory.TierTypeName,
                ScreenShot    = "https://www.bungie.net" + info.Screenshot,
                InventoryType = inventoryType
            };

            //Item.DamageType = damage != null ? "https://www.bungie.net" + damage.DisplayProperties.Icon : "";
            Item.IconWM      += info.IconWatermark == null ? info.IconWatermarkShelved : info.IconWatermark;
            Item.ItemLight    = instancePath != null && instancePath.Value > 200 ? instancePath.Value.ToString() : "";
            Item.ItemInstance = item.ItemInstanceId != null?Convert.ToInt64(item.ItemInstanceId) : 0;

            return(Item);
        }
        public bool Equals(DestinyItemInstanceComponent input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     DamageType == input.DamageType ||
                     (DamageType != null && DamageType.Equals(input.DamageType))
                     ) &&
                 (
                     DamageTypeHash == input.DamageTypeHash ||
                     (DamageTypeHash.Equals(input.DamageTypeHash))
                 ) &&
                 (
                     PrimaryStat == input.PrimaryStat ||
                     (PrimaryStat != null && PrimaryStat.Equals(input.PrimaryStat))
                 ) &&
                 (
                     ItemLevel == input.ItemLevel ||
                     (ItemLevel.Equals(input.ItemLevel))
                 ) &&
                 (
                     Quality == input.Quality ||
                     (Quality.Equals(input.Quality))
                 ) &&
                 (
                     IsEquipped == input.IsEquipped ||
                     (IsEquipped != null && IsEquipped.Equals(input.IsEquipped))
                 ) &&
                 (
                     CanEquip == input.CanEquip ||
                     (CanEquip != null && CanEquip.Equals(input.CanEquip))
                 ) &&
                 (
                     EquipRequiredLevel == input.EquipRequiredLevel ||
                     (EquipRequiredLevel.Equals(input.EquipRequiredLevel))
                 ) &&
                 (
                     UnlockHashesRequiredToEquip == input.UnlockHashesRequiredToEquip ||
                     (UnlockHashesRequiredToEquip != null && UnlockHashesRequiredToEquip.SequenceEqual(input.UnlockHashesRequiredToEquip))
                 ) &&
                 (
                     CannotEquipReason == input.CannotEquipReason ||
                     (CannotEquipReason != null && CannotEquipReason.Equals(input.CannotEquipReason))
                 ) &&
                 (
                     BreakerType == input.BreakerType ||
                     (BreakerType.Equals(input.BreakerType))
                 ) &&
                 (
                     BreakerTypeHash == input.BreakerTypeHash ||
                     (BreakerTypeHash.Equals(input.BreakerTypeHash))
                 ) &&
                 (
                     Energy == input.Energy ||
                     (Energy != null && Energy.Equals(input.Energy))
                 ));
        }
Exemple #14
0
 private int CalculateAbilityModifier(PrimaryStat primaryStat)
 {
     return((primaryStat.AbilityScore / 2) - 5);
 }
Exemple #15
0
 private PrimaryStat AddModifierToPrimaryStat(PrimaryStat primaryStat)
 {
     primaryStat.AbilityModifier = CalculateAbilityModifier(primaryStat);
     return(primaryStat);
 }