/// <summary>
        /// Handle an item given to the scholar.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="item"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
        {
            GamePlayer      player  = source as GamePlayer;
            ArtifactScholar scholar = target as ArtifactScholar;

            if (player == null || scholar == null)
            {
                return(false);
            }

            //If the player is on the right step (the give me an art step)
            if (Step == 0)
            {
                //Lets see if they gave us a valid artifact
                string ArtID = ArtifactMgr.GetArtifactIDFromItemID(item.Id_nb);
                Dictionary <String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtID, (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm);
                //If this artifact has more than one option for them, give them the quest
                if (versions != null && item != null && versions.Count > 1 && RemoveItem(player, item))
                {
                    m_artifactID = ArtID;
                    SetCustomProperty("Art", ArtifactID);
                    SetCustomProperty("Id_nb", item.Id_nb);
                    SetCustomProperty("AXP", (item as InventoryArtifact).Experience.ToString());
                    SetCustomProperty("ALevel", (item as InventoryArtifact).ArtifactLevel.ToString());

                    GetNextOptions(versions);

                    SaveProperties();

                    scholar.TurnTo(player);
                    scholar.SayTo(player, string.Format("Would you prefer {0} of {1}?", GetOptions(), ArtifactID));
                    Step = 1;
                    return(true);
                }
            }
            else
            {
                //Why are they giving this to us!
                player.Out.SendMessage(string.Format("{0} doesn't want that item.", scholar.Name),
                                       eChatType.CT_Say, eChatLoc.CL_SystemWindow);
            }

            return(base.ReceiveItem(source, target, item));
        }
Esempio n. 2
0
        /// <summary>
        /// Handle an item given to the scholar.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="item"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item)
        {
            if (!(source is GamePlayer player) || !(target is ArtifactScholar scholar))
            {
                return(false);
            }

            // If the player is on the right step (the give me an art step)
            if (Step == 0)
            {
                // Lets see if they gave us a valid artifact
                string artId = ArtifactMgr.GetArtifactIDFromItemID(item.Id_nb);
                Dictionary <string, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(artId, (eCharacterClass)player.CharacterClass.ID, player.Realm);

                // If this artifact has more than one option for them, give them the quest
                if (versions != null && versions.Count > 1 && RemoveItem(player, item))
                {
                    _artifactId = artId;
                    SetCustomProperty("Art", ArtifactId);
                    SetCustomProperty("Id_nb", item.Id_nb);
                    SetCustomProperty("AXP", (item as InventoryArtifact)?.Experience.ToString());
                    SetCustomProperty("ALevel", (item as InventoryArtifact)?.ArtifactLevel.ToString());

                    GetNextOptions(versions);

                    SaveProperties();

                    scholar.TurnTo(player);
                    scholar.SayTo(player, $"Would you prefer {GetOptions()} of {ArtifactId}?");
                    Step = 1;
                    return(true);
                }
            }
            else
            {
                // Why are they giving this to us!
                player.Out.SendMessage($"{scholar.Name} doesn't want that item.", eChatType.CT_Say, eChatLoc.CL_SystemWindow);
            }

            return(base.ReceiveItem(source, target, item));
        }