/// <summary> /// Create a new inventory artifact from an existing inventory item. /// </summary> /// <param name="item"></param> public InventoryArtifact(InventoryItem item) : base(item) { if (item != null) { // We want a new copy from the DB to avoid everyone sharing the same template var template = item.Template != null?item.Template.Clone() as ItemTemplate : item.Template; if (template == null) { log.ErrorFormat("Artifact: Error loading artifact for owner {0} holding item {1} with an id_nb of {2}", item.OwnerID, item.Name, item.Id_nb); return; } Template = template; ObjectId = item.ObjectId; // This is the key for the 'inventoryitem' table OwnerID = item.OwnerID; CanUseEvery = ArtifactMgr.GetReuseTimer(this); ArtifactID = ArtifactMgr.GetArtifactIDFromItemID(Id_nb); ArtifactLevel = ArtifactMgr.GetCurrentLevel(this); m_levelRequirements = ArtifactMgr.GetLevelRequirements(ArtifactID); UpdateAbilities(template); } }
/// <summary> /// Artifact delve information. /// </summary> public override void Delve(List <string> delve, GamePlayer player) { if (player == null) { return; } // Artifact specific information. if (ArtifactLevel < 10) { delve.Add(string.Format("Artifact (Current level: {0})", ArtifactLevel)); delve.Add(string.Format( "- {0}% exp earned towards level {1}", ArtifactMgr.GetXPGainedForLevel(this), ArtifactLevel + 1)); delve.Add(string.Format( "- Artifact will gain new abilities at level {0}", GainsNewAbilityAtLevel())); delve.Add(string.Format( "(Earns exp: {0})", ArtifactMgr.GetEarnsXP(this))); } else { delve.Add("Artifact:"); delve.Add("Current level: 10"); } // Item bonuses. delve.Add(string.Empty); delve.Add("Magical Bonuses:"); for (ArtifactBonus.ID bonusID = ArtifactBonus.ID.MinStat; bonusID <= ArtifactBonus.ID.MaxStat; ++bonusID) { DelveMagicalBonus(delve, Template.GetBonusAmount(bonusID), Template.GetBonusType(bonusID), m_levelRequirements[(int)bonusID]); } for (ArtifactBonus.ID bonusID = ArtifactBonus.ID.MinStat; bonusID <= ArtifactBonus.ID.MaxStat; ++bonusID) { DelveFocusBonus(delve, Template.GetBonusAmount(bonusID), Template.GetBonusType(bonusID), m_levelRequirements[(int)bonusID]); } delve.Add(string.Empty); for (ArtifactBonus.ID bonusID = ArtifactBonus.ID.MinStat; bonusID <= ArtifactBonus.ID.MaxStat; ++bonusID) { DelveBonus(delve, Template.GetBonusAmount(bonusID), Template.GetBonusType(bonusID), m_levelRequirements[(int)bonusID]); } // Spells & Procs DelveMagicalAbility(delve, ArtifactBonus.ID.Spell, m_levelRequirements[(int)ArtifactBonus.ID.Spell]); DelveMagicalAbility(delve, ArtifactBonus.ID.ProcSpell, m_levelRequirements[(int)ArtifactBonus.ID.ProcSpell]); DelveMagicalAbility(delve, ArtifactBonus.ID.Spell1, m_levelRequirements[(int)ArtifactBonus.ID.Spell1]); DelveMagicalAbility(delve, ArtifactBonus.ID.ProcSpell1, m_levelRequirements[(int)ArtifactBonus.ID.ProcSpell1]); delve.Add(string.Empty); // Weapon & Armor Stats. if ((Object_Type >= (int)eObjectType.GenericWeapon) && (Object_Type <= (int)eObjectType.MaulerStaff) || (Object_Type == (int)eObjectType.Instrument)) { DelveWeaponStats(delve, player); } else if (Object_Type >= (int)eObjectType.Cloth && Object_Type <= (int)eObjectType.Scale) { DelveArmorStats(delve, player); } // Reuse Timer int reuseTimer = ArtifactMgr.GetReuseTimer(this); if (reuseTimer > 0) { TimeSpan reuseTimeSpan = new TimeSpan(0, 0, reuseTimer); delve.Add(string.Empty); delve.Add(string.Format( "Can use item every {0} min", reuseTimeSpan.ToString().Substring(3))); } if (player.Client.Account.PrivLevel > 1) { WriteTechnicalInfo(delve, player.Client); } }