Esempio n. 1
0
        public override void HandleActionUseOnTarget(Player player, WorldObject target)
        {
            if (PetDevice.IsEncapsulatedSpirit(this) && target is PetDevice petDevice)
            {
                petDevice.Refill(player, this);
                return;
            }

            if (Aetheria.IsAetheriaManaStone(this) && Aetheria.IsAetheria(target.WeenieClassId))
            {
                Aetheria.UseObjectOnTarget(player, this, target);
                return;
            }

            // fallback on recipe manager
            base.HandleActionUseOnTarget(player, target);
        }
Esempio n. 2
0
        /// <summary>
        /// Tries to proc any relevant items for the attack
        /// </summary>
        public void TryProcEquippedItems(WorldObject attacker, Creature target, bool selfTarget, WorldObject weapon)
        {
            // handle procs directly on this item -- ie. phials
            // this could also be monsters with the proc spell directly on the creature
            if (HasProc && ProcSpellSelfTargeted == selfTarget)
            {
                // projectile
                // monster
                TryProcItem(attacker, target);
            }

            // handle proc spells for weapon
            // this could be a melee weapon, or a missile launcher
            if (weapon != null && weapon.HasProc && weapon.ProcSpellSelfTargeted == selfTarget)
            {
                // weapon
                weapon.TryProcItem(attacker, target);
            }

            if (attacker != this && attacker.HasProc && attacker.ProcSpellSelfTargeted == selfTarget)
            {
                // handle special case -- missile projectiles from monsters w/ a proc directly on the mob
                // monster
                attacker.TryProcItem(attacker, target);
            }

            // handle aetheria procs
            if (attacker is Creature wielder)
            {
                var equippedAetheria = wielder.EquippedObjects.Values.Where(i => Aetheria.IsAetheria(i.WeenieClassId) && i.HasProc && i.ProcSpellSelfTargeted == selfTarget);

                // aetheria
                foreach (var aetheria in equippedAetheria)
                {
                    aetheria.TryProcItem(attacker, target);
                }
            }
        }
Esempio n. 3
0
        public static LootStats LootStats(WorldObject wo, LootStats ls, bool logstats)
        {
            // Weapon Properties
            double missileDefMod = 0.00f;
            double magicDefMod   = 0.00f;
            double wield         = 0.00f;
            int    value         = 0;

            ls.TotalItems++;

            // Loop depending on how many items you are creating
            for (int i = 0; i < 1; i++)
            {
                var testItem = wo;
                if (testItem == null)
                {
                    ls.NullCount++;
                    continue;
                }

                switch (testItem.ItemType)
                {
                case ItemType.None:
                    break;

                case ItemType.MeleeWeapon:
                    ls.MeleeWeaponCount++;

                    bool cantrip = false;
                    if (testItem.EpicCantrips.Count > 0)
                    {
                        cantrip = true;
                    }
                    if (testItem.LegendaryCantrips.Count > 0)
                    {
                        cantrip = true;
                    }

                    string strikeType = "N";
                    if (testItem.WeaponMagicDefense != null)
                    {
                        magicDefMod = testItem.WeaponMagicDefense.Value;
                    }
                    if (testItem.Value != null)
                    {
                        value = testItem.Value.Value;
                    }
                    if (testItem.WeaponMissileDefense != null)
                    {
                        missileDefMod = testItem.WeaponMissileDefense.Value;
                    }
                    if (testItem.WieldDifficulty != null)
                    {
                        wield = testItem.WieldDifficulty.Value;
                    }
                    if (testItem.WeaponSkill == Skill.TwoHandedCombat)
                    {
                        if (logstats)
                        {
                            ls.MeleeWeapons.Add($"{testItem.WeaponSkill},{wield},{testItem.Damage.Value},{strikeType},{testItem.DamageVariance.Value},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{cantrip},{value},{testItem.EncumbranceVal},{testItem.Name}");
                        }
                        else
                        {
                            ls.MeleeWeapons.Add($"{testItem.WeaponSkill}\t {wield}\t {testItem.Damage.Value}\t\t {strikeType} \t\t {testItem.DamageVariance.Value}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {cantrip}\t{value}\t{testItem.EncumbranceVal} \t {testItem.Name}");
                        }
                    }
                    else
                    {
                        if ((testItem.W_AttackType & AttackType.TripleStrike) != 0)
                        {
                            strikeType = "3x";
                        }
                        else if ((testItem.W_AttackType & AttackType.DoubleStrike) != 0)
                        {
                            strikeType = "2x";
                        }
                        if (logstats)
                        {
                            ls.MeleeWeapons.Add($"{testItem.WeaponSkill},{wield},{testItem.Damage.Value},{strikeType},{testItem.DamageVariance.Value},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{cantrip},{value},{testItem.EncumbranceVal},{testItem.Name}");
                        }
                        else
                        {
                            ls.MeleeWeapons.Add($" {testItem.WeaponSkill}\t\t {wield}\t {testItem.Damage.Value}\t\t {strikeType}\t\t {testItem.DamageVariance.Value}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {cantrip}\t{value}\t{testItem.EncumbranceVal} \t {testItem.Name}");
                        }
                    }
                    break;

                case ItemType.Armor:
                    ls.ArmorCount++;
                    string equipmentSet = "None    ";
                    cantrip = false;
                    // float cantripSpells = 0;
                    var epicCantripSpells = testItem.EpicCantrips.Keys;

                    if (testItem.EpicCantrips.Count > 0)
                    {
                        cantrip = true;
                    }

                    if (testItem.LegendaryCantrips.Count > 0)
                    {
                        cantrip = true;
                    }

                    if (testItem.EquipmentSetId != null)
                    {
                        equipmentSet = testItem.EquipmentSetId.ToString();
                    }
                    if (logstats)
                    {
                        ls.Armor.Add($"{testItem.ArmorLevel},{testItem.ItemDifficulty},{testItem.Value.Value},{testItem.EncumbranceVal},{testItem.EpicCantrips.Count},{testItem.LegendaryCantrips.Count},{equipmentSet},{testItem.Name}");
                    }
                    else
                    {
                        ls.Armor.Add($" {testItem.ArmorLevel}\t{testItem.ItemDifficulty}\t{testItem.Value.Value}\t{testItem.EncumbranceVal}\t{testItem.EpicCantrips.Count}\t{testItem.LegendaryCantrips.Count}\t{equipmentSet}\t\t\t{testItem.Name}");
                    }
                    if (testItem.Name.Contains("Sheild"))       // typo?
                    {
                        break;
                    }
                    if (testItem.ArmorLevel > ls.MaxAL)
                    {
                        ls.MaxAL     = testItem.ArmorLevel.Value;
                        ls.MaxALItem = testItem.Name;
                    }
                    if (testItem.ArmorLevel < ls.MinAL)
                    {
                        ls.MinAL     = testItem.ArmorLevel.Value;
                        ls.MinALItem = testItem.Name;
                    }
                    break;

                case ItemType.Clothing:
                    if (testItem.Name.Contains("Cloak"))
                    {
                        string cloakSet = "None ";
                        if (testItem.EquipmentSetId != null)
                        {
                            cloakSet = testItem.EquipmentSetId.ToString();
                        }
                        ls.CloakCount++;
                        if (logstats)
                        {
                            ls.Cloaks.Add($"{testItem.ItemMaxLevel},{testItem.WieldDifficulty},{testItem.CloakWeaveProc.Value},{testItem.Value.Value},{cloakSet}");
                        }
                        else
                        {
                            ls.Cloaks.Add($" {testItem.ItemMaxLevel}\t {testItem.WieldDifficulty}\t {testItem.CloakWeaveProc.Value}\t {testItem.Value.Value}\t {cloakSet}");
                        }
                    }
                    else
                    {
                        ls.ClothingCount++;
                    }
                    break;

                case ItemType.Jewelry:
                    ls.JewelryCount++;
                    string jewelrySlot = "";
                    switch (testItem.ValidLocations)
                    {
                    case EquipMask.NeckWear:
                        ls.JewelryNecklaceCount++;
                        jewelrySlot = "Neck";
                        break;

                    case EquipMask.WristWear:
                        ls.JewelryBraceletCount++;
                        jewelrySlot = "Brace";
                        break;

                    case EquipMask.FingerWear:
                        ls.JewelryRingCount++;
                        jewelrySlot = "Ring";
                        break;

                    case EquipMask.TrinketOne:
                        ls.JewelryTrinketCount++;
                        jewelrySlot = "Trink";
                        break;

                    default:
                        // Console.WriteLine(testItem.Name);
                        break;
                    }
                    if (logstats)
                    {
                        ls.Jewelry.Add($"{jewelrySlot},{testItem.ItemDifficulty},{testItem.Value}");
                    }
                    else
                    {
                        ls.Jewelry.Add($" {jewelrySlot}\t {testItem.ItemDifficulty}\t {testItem.Value}");
                    }


                    break;

                case ItemType.Creature:
                    break;

                case ItemType.Food:
                    ls.Food++;
                    break;

                case ItemType.Money:
                    break;

                case ItemType.Misc:

                    string spirit  = "Spirit";
                    string potionA = "Philtre";
                    string potionB = "Elixir";
                    string potionC = "Tonic";
                    string potionD = "Brew";
                    string potionE = "Potion";
                    string potionF = "Draught";
                    string potionG = "Tincture";

                    string healingKits    = "Kit";
                    string spellcompGlyph = "Glyph";
                    string spellcompInk   = "Ink";
                    string spellcompQuill = "Quill";

                    if (testItem.Name.Contains(spirit))
                    {
                        ls.Spirits++;
                    }
                    else if (testItem is PetDevice petDevice)
                    {
                        ls.PetsCount++;
                        int totalRatings     = 0;
                        int damage           = 0;
                        int damageResist     = 0;
                        int crit             = 0;
                        int critDamage       = 0;
                        int critDamageResist = 0;
                        int critResist       = 0;
                        int petLevel         = 0;

                        if (petDevice.UseRequiresSkillLevel == 570)
                        {
                            petLevel = 200;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 530)
                        {
                            petLevel = 180;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 475)
                        {
                            petLevel = 150;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 430)
                        {
                            petLevel = 125;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 400)
                        {
                            petLevel = 100;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 370)
                        {
                            petLevel = 80;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 310)
                        {
                            petLevel = 50;
                        }

                        if (petDevice.GearDamage != null)
                        {
                            totalRatings += petDevice.GearDamage.Value;
                            damage        = petDevice.GearDamage.Value;
                        }
                        if (petDevice.GearDamageResist != null)
                        {
                            totalRatings += petDevice.GearDamageResist.Value;
                            damageResist  = petDevice.GearDamageResist.Value;
                        }
                        if (petDevice.GearCrit != null)
                        {
                            totalRatings += petDevice.GearCrit.Value;
                            crit          = petDevice.GearCrit.Value;
                        }
                        if (petDevice.GearCritDamage != null)
                        {
                            totalRatings += petDevice.GearCritDamage.Value;
                            critDamage    = petDevice.GearCritDamage.Value;
                        }
                        if (petDevice.GearCritDamageResist != null)
                        {
                            totalRatings    += petDevice.GearCritDamageResist.Value;
                            critDamageResist = petDevice.GearCritDamageResist.Value;
                        }
                        if (petDevice.GearCritResist != null)
                        {
                            totalRatings += petDevice.GearCritResist.Value;
                            critResist    = petDevice.GearCritResist.Value;
                        }
                        if (logstats)
                        {
                            ls.Pets.Add($"{petLevel},{damage},{damageResist},{crit},{critDamage},{critDamageResist},{critResist},{totalRatings}");
                        }
                        else
                        {
                            ls.Pets.Add($" {petLevel}\t {damage}\t {damageResist}\t {crit}\t {critDamage}\t {critDamageResist}\t {critResist}\t {totalRatings}");
                        }

                        if (totalRatings > 99)
                        {
                            ls.PetRatingsOverHundred++;
                        }
                        else if (totalRatings > 89)
                        {
                            ls.PetRatingsOverNinety++;
                        }
                        else if (totalRatings > 79)
                        {
                            ls.PetRatingsOverEighty++;
                        }
                        else if (totalRatings > 69)
                        {
                            ls.PetRatingsOverSeventy++;
                        }
                        else if (totalRatings > 59)
                        {
                            ls.PetRatingsOverSixty++;
                        }
                        else if (totalRatings > 49)
                        {
                            ls.PetRatingsOverFifty++;
                        }
                        else if (totalRatings > 39)
                        {
                            ls.PetRatingsOverForty++;
                        }
                        else if (totalRatings > 29)
                        {
                            ls.PetRatingsOverThirty++;
                        }
                        else if (totalRatings > 19)
                        {
                            ls.PetRatingsOverTwenty++;
                        }
                        else if (totalRatings > 9)
                        {
                            ls.PetRatingsOverTen++;
                        }
                        else if (totalRatings > 0)
                        {
                            ls.PetRatingsEqualOne++;
                        }
                        else if (totalRatings < 1)
                        {
                            ls.PetRatingsEqualZero++;
                        }
                    }
                    else if (testItem.Name.Contains(potionA) || testItem.Name.Contains(potionB) || testItem.Name.Contains(potionC) || testItem.Name.Contains(potionD) || testItem.Name.Contains(potionE) || testItem.Name.Contains(potionF) || testItem.Name.Contains(potionG))
                    {
                        ls.Potions++;
                    }
                    else if (testItem.Name.Contains(spellcompGlyph) || testItem.Name.Contains(spellcompInk) || testItem.Name.Contains(spellcompQuill))
                    {
                        ls.LevelEightComp++;
                    }
                    else if (testItem.Name.Contains(healingKits))
                    {
                        ls.HealingKit++;
                    }
                    else
                    {
                        // Console.WriteLine($"ItemType.Misc Name={testItem.Name}");
                        ls.Misc++;
                    }
                    break;

                case ItemType.MissileWeapon:
                    double eleBonus    = 0.00f;
                    double damageMod   = 0.00f;
                    string missileType = "Other";
                    if (testItem.AmmoType != null)
                    {
                        switch (testItem.AmmoType.Value)
                        {
                        case AmmoType.None:
                            break;

                        case AmmoType.Arrow:
                            missileType = "Bow";
                            ls.MissileWeaponCount++;
                            break;

                        case AmmoType.Bolt:
                            missileType = "X Bow";
                            ls.MissileWeaponCount++;
                            break;

                        case AmmoType.Atlatl:
                            missileType = "Thrown";
                            ls.MissileWeaponCount++;
                            break;

                        case AmmoType.ArrowCrystal:
                            break;

                        case AmmoType.BoltCrystal:
                            break;

                        case AmmoType.AtlatlCrystal:
                            break;

                        case AmmoType.ArrowChorizite:
                            break;

                        case AmmoType.BoltChorizite:
                            break;

                        case AmmoType.AtlatlChorizite:
                            break;

                        default:
                            break;
                        }
                    }
                    if (testItem.WeaponMagicDefense != null)
                    {
                        magicDefMod = testItem.WeaponMagicDefense.Value;
                    }
                    if (testItem.Value != null)
                    {
                        value = testItem.Value.Value;
                    }
                    if (testItem.WeaponMissileDefense != null)
                    {
                        missileDefMod = testItem.WeaponMissileDefense.Value;
                    }
                    if (testItem.WieldDifficulty != null)
                    {
                        wield = testItem.WieldDifficulty.Value;
                    }
                    if (testItem.ElementalDamageBonus != null)
                    {
                        eleBonus = testItem.ElementalDamageBonus.Value;
                    }
                    if (testItem.DamageMod != null)
                    {
                        damageMod = testItem.DamageMod.Value;
                    }

                    if (missileType == "Other")
                    {
                        ls.DinnerWare++;
                    }
                    else
                    {
                        if (logstats)
                        {
                            ls.MissileWeapons.Add($"{missileType},{wield},{damageMod},{eleBonus},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value},{testItem.EncumbranceVal}");
                        }
                        else
                        {
                            ls.MissileWeapons.Add($"{missileType}\t {wield}\t {damageMod}\t\t{eleBonus}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {value}\t {testItem.EncumbranceVal}");
                        }
                    }

                    break;

                case ItemType.Container:
                    break;

                case ItemType.Useless:
                    // Console.WriteLine($"ItemType.Useless Name={testItem.Name}");
                    break;

                case ItemType.Gem:
                    string aetheriaColor = "None";
                    if (Aetheria.IsAetheria(testItem.WeenieClassId))
                    {
                        ls.AetheriaCount++;
                        if (testItem.WieldDifficulty == 75)
                        {
                            aetheriaColor = "Blue  ";
                        }
                        else if (testItem.WieldDifficulty == 150)
                        {
                            aetheriaColor = "Yellow";
                        }
                        else if (testItem.WieldDifficulty == 225)
                        {
                            aetheriaColor = "Red   ";
                        }
                        if (logstats)
                        {
                            ls.Aetheria.Add($"{aetheriaColor},{testItem.ItemMaxLevel}");
                        }
                        else
                        {
                            ls.Aetheria.Add($" {aetheriaColor}\t {testItem.ItemMaxLevel}");
                        }
                    }
                    else
                    {
                        ls.GemCount++;
                    }
                    break;

                case ItemType.SpellComponents:
                    ls.SpellComponents++;
                    break;

                case ItemType.Writable:
                    string scrolls = "Scroll";

                    if (testItem.Name.Contains(scrolls))
                    {
                        ls.Scrolls++;
                    }
                    else
                    {
                        Console.WriteLine($"ItemType.Writeable Name={testItem.Name}");
                    }
                    break;

                case ItemType.Key:
                    ls.Key++;
                    break;

                case ItemType.Caster:
                    ls.CasterCount++;
                    double eleMod = 0.00f;
                    if (testItem.WeaponMagicDefense != null)
                    {
                        magicDefMod = testItem.WeaponMagicDefense.Value;
                    }
                    if (testItem.Value != null)
                    {
                        value = testItem.Value.Value;
                    }
                    if (testItem.WeaponMissileDefense != null)
                    {
                        missileDefMod = testItem.WeaponMissileDefense.Value;
                    }
                    if (testItem.WieldDifficulty != null)
                    {
                        wield = testItem.WieldDifficulty.Value;
                    }
                    if (testItem.ElementalDamageMod != null)
                    {
                        eleMod = testItem.ElementalDamageMod.Value;
                    }
                    if (testItem.ItemMaxMana != null)
                    {
                        ls.ItemMaxMana = testItem.ItemMaxMana.Value;
                    }
                    if (logstats)
                    {
                        ls.CasterWeapons.Add($"{wield},{eleMod},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value},{testItem.EncumbranceVal},{ls.ItemMaxMana}");
                    }
                    else
                    {
                        ls.CasterWeapons.Add($" {wield}\t {eleMod}\t\t {testItem.WeaponDefense.Value}\t\t  {magicDefMod}\t\t {missileDefMod}\t\t {value}\t {testItem.EncumbranceVal} \t {ls.ItemMaxMana}");
                    }
                    break;

                case ItemType.Portal:
                    break;

                case ItemType.Lockable:
                    break;

                case ItemType.PromissoryNote:
                    break;

                case ItemType.ManaStone:
                    ls.ManaStone++;
                    break;

                case ItemType.Service:
                    break;

                case ItemType.MagicWieldable:
                    break;

                case ItemType.CraftCookingBase:
                    ls.OtherCount++;
                    break;

                case ItemType.CraftAlchemyBase:
                    ls.OtherCount++;
                    break;

                case ItemType.CraftFletchingBase:
                    ls.OtherCount++;
                    break;

                case ItemType.CraftAlchemyIntermediate:
                    ls.OtherCount++;
                    break;

                case ItemType.CraftFletchingIntermediate:
                    ls.OtherCount++;
                    break;

                case ItemType.LifeStone:
                    break;

                case ItemType.TinkeringTool:
                    ls.OtherCount++;
                    break;

                case ItemType.TinkeringMaterial:
                    ls.OtherCount++;
                    break;

                case ItemType.Gameboard:
                    break;

                case ItemType.PortalMagicTarget:
                    break;

                case ItemType.LockableMagicTarget:
                    break;

                case ItemType.Vestements:
                    break;

                case ItemType.Weapon:
                    break;

                case ItemType.WeaponOrCaster:
                    break;

                case ItemType.Item:
                    Console.WriteLine($"ItemType.item Name={testItem.Name}");
                    break;

                case ItemType.RedirectableItemEnchantmentTarget:
                    break;

                case ItemType.ItemEnchantableTarget:
                    break;

                case ItemType.VendorShopKeep:
                    break;

                case ItemType.VendorGrocer:
                    break;

                default:
                    ls.OtherCount++;
                    break;
                }

                /*switch (testItem.ItemType)
                 * {
                 *  case ItemType.Armor:
                 *      break;
                 *  case ItemType.MeleeWeapon:
                 *      break;
                 *  case ItemType.Caster:
                 *      break;
                 *  case ItemType.MissileWeapon:
                 *      break;
                 *  case ItemType.Jewelry:
                 *      break;
                 *  case ItemType.Gem:
                 *      break;
                 *  case ItemType.Clothing:
                 *      break;
                 *  default:
                 *      break;
                 * }*/
                if (testItem.ItemMaxMana != null)
                {
                    if (testItem.ItemMaxMana > ls.MaxMana)
                    {
                        ls.MaxMana = testItem.ItemMaxMana.Value;
                    }
                    if (testItem.ItemMaxMana < ls.MinMana)
                    {
                        ls.MinMana = testItem.ItemMaxMana.Value;
                    }
                    ls.HasManaCount++;
                    ls.TotalMaxMana += testItem.ItemMaxMana.Value;
                }
                if (testItem.Name == null)
                {
                    Console.WriteLine("*Name is Null*");
                    continue;
                }
                if (testItem.EpicCantrips.Count > 0)
                {
                    ls.EpicCantripCount++;
                }
                if (testItem.LegendaryCantrips.Count > 0)
                {
                    ls.LegendaryCantripCount++;
                }
            }
            return(ls);
        }