/// <summary> /// The merchant received an item from another GameLiving. /// </summary> /// <param name="source"></param> /// <param name="item"></param> /// <returns></returns> public override bool ReceiveItem(GameLiving source, InventoryItem item) { GamePlayer player = source as GamePlayer; if (player != null && item != null && item.Name.EndsWith("Credit")) { if (ArtifactMgr.GrantArtifactBountyCredit(player, item.Name)) { player.Inventory.RemoveItem(item); InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, item.Template, item.Count); return(true); } else { // refund bounty points player.Inventory.RemoveItem(item); InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, item.Template, item.Count); long totalValue = item.Price; player.BountyPoints += totalValue; player.Out.SendUpdatePoints(); player.Out.SendMessage(totalValue + " Bounty Points refunded", eChatType.CT_ScreenCenterSmaller, eChatLoc.CL_SystemWindow); player.Out.SendMessage("You already have this credit or your class is not eligible to receive this artifact. " + totalValue + " Bounty Points refunded!", eChatType.CT_Merchant, eChatLoc.CL_SystemWindow); return(true); } } return(base.ReceiveItem(source, item)); }
/// <summary> /// Create a new inventory artifact from an item template. /// </summary> /// <param name="template"></param> public InventoryArtifact(ItemTemplate template) : base(template) { ArtifactID = ArtifactMgr.GetArtifactIDFromItemID(template.Id_nb); ArtifactLevel = 0; m_levelRequirements = ArtifactMgr.GetLevelRequirements(ArtifactID); for (ArtifactBonus.ID bonusID = ArtifactBonus.ID.Min; bonusID <= ArtifactBonus.ID.Max; ++bonusID) { // Clear all bonuses except the base (L0) bonuses. if (m_levelRequirements[(int)bonusID] > 0) { Template.SetBonusType(bonusID, 0); Template.SetBonusAmount(bonusID, 0); } } }
/// <summary> /// When someone interacts with this scholar /// </summary> /// <param name="player"></param> /// <returns></returns> public override bool Interact(GamePlayer player) { if (player != null) { lock (QuestListToGive.SyncRoot) { // See if they player has the quest first foreach (AbstractQuest quest in player.QuestList) { if (quest is ArtifactTurnInQuest && HasQuest(quest.GetType()) != null) { if ((quest as ArtifactTurnInQuest).Interact(player, this)) { return(true); } } } // Give the intro text foreach (ArtifactTurnInQuest quest in QuestListToGive) { List <string> arts = ArtifactMgr.GetArtifacts(player); foreach (string art in arts) { Dictionary <string, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions( art, (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm); if (versions.Count > 1) { SayTo(player, string.Format("{0}, I see that you carry {1}. If you are interested, I will exchange yours for you but there is a price to pay for the change. Any experience or levels your artifact has gained will be lost when the change occurs. Are you still [interested]?", player.CharacterClass.Name, art)); } } return(true); } } } return(base.Interact(player)); }
/// <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); } }
public override LootList GenerateLoot(GameNPC mob, GameObject killer) { LootList lootList = new LootList(); // check to see if we are in ToA if (mob.CurrentRegion.Expansion == (int)eClientExpansion.TrialsOfAtlantis && killer.CurrentRegion.Expansion == (int)eClientExpansion.TrialsOfAtlantis) { if (mob.Level >= 45 && Util.Chance(ServerProperties.Properties.SCROLL_DROP_RATE)) { List <Artifact> artifacts = new List <Artifact>(); if (mob.CurrentRegion.IsDungeon && Util.Chance((int)(ServerProperties.Properties.SCROLL_DROP_RATE * 1.5))) { artifacts = ArtifactMgr.GetArtifacts(); } else { switch (mob.CurrentZone.Description) { case "Oceanus Hesperos": case "Mesothalassa": case "Oceanus Notos": case "Oceanus Boreal": case "Oceanus Anatole": artifacts = ArtifactMgr.GetArtifacts("Oceanus"); break; case "Stygian Delta": case "Land of Atum": artifacts = ArtifactMgr.GetArtifacts("Stygia"); break; case "Arbor Glen": case "Green Glades": artifacts = ArtifactMgr.GetArtifacts("Aerus"); break; case "Typhon's Reach": case "Ashen Isles": artifacts = ArtifactMgr.GetArtifacts("Volcanus"); break; } } if (artifacts.Count > 0) { string artifactID = artifacts[Util.Random(artifacts.Count - 1)].ArtifactID; int pageNumber; ItemTemplate loot = new ItemTemplate(); loot.AllowAdd = false; if (mob.Level > 55) { pageNumber = 3; } else if (mob.Level >= 51) { pageNumber = 2; } else { pageNumber = 1; } loot.Model = 488; loot.Name = "scroll|" + artifactID + "|" + pageNumber; loot.Level = 35; lootList.AddFixed(loot, 1); } } } return(lootList); }
/// <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); } }