Beispiel #1
0
        public void upgradeitemScroll(Item item, Player player, int scrollLevel)
        {
            UpgradeInfo   info      = item.GetGlobalItem <UpgradeInfo>(mod);
            UpgradePlayer thePlayer = player.GetModPlayer <UpgradePlayer>(mod);

            if (item.magic || item.melee || item.summon || item.ranged)
            {
                if (!info.upgraded)
                {
                    info.upgraded   = true;
                    info.baseCrit   = item.crit;
                    info.baseDamage = item.damage;
                    info.baseName   = item.Name;
                }

                info.level    = scrollLevel;
                info.modifier = getDamageModifier(info.level);
                item.damage   = (int)Math.Round((Convert.ToDouble(info.baseDamage * info.modifier) / 100));
                item.crit     = (int)Math.Round((Convert.ToDouble(info.baseCrit * info.modifier) / 100));
                item.SetNameOverride(info.baseName + " +" + info.level);
                if (info.elemented)
                {
                    info.elementDamage = (int)Math.Round(Convert.ToDouble(item.damage * 0.10));
                }
            }
            else
            {
                if (!info.upgraded)
                {
                    info.upgraded  = true;
                    info.baseArmor = item.defense;
                    info.baseName  = item.Name;
                }

                info.level    = scrollLevel;
                info.modifier = getDamageModifier(info.level);
                item.SetNameOverride(info.baseName + " +" + info.level);
                item.defense = (int)Math.Round((Convert.ToDouble(info.baseArmor * info.modifier) / 100));
            }
            if (info.level >= 10 && info.elemented == false)
            {
                enchantItemElement(item, info);
            }
        }
Beispiel #2
0
        public override void LoadLegacy(BinaryReader reader)
        {
            try {
                UpgradePlayer thePlayer       = player.GetModPlayer <UpgradePlayer>(mod);
                bool          protectingStone = reader.ReadBoolean();
                String        modName         = reader.ReadString();

                if (ModLoader.GetMod(modName) != null)
                {
                    thePlayer.SetProperties(protectingStone);
                }
                else
                {
                    thePlayer.ResetProperties();
                }
            }
            catch (Exception e) {
                ErrorLogger.Log(e.ToString());
            }
        }