예제 #1
0
 public LocalizedGossipMenuItem(TranslatableItem text, GossipActionHandler callback,
                                params LocalizedGossipMenuItem[] items)
     : this(text)
 {
     Action  = new NonNavigatingGossipAction(callback);
     SubMenu = new GossipMenu(items);
 }
예제 #2
0
 public LocalizedGossipMenuItem(GossipMenuIcon icon, RealmLangKey langKey,
                                params LocalizedGossipMenuItem[] items)
     : this(langKey)
 {
     Icon    = icon;
     SubMenu = new GossipMenu(items);
 }
예제 #3
0
 public LocalizedGossipMenuItem(GossipMenuIcon icon, TranslatableItem text,
                                params LocalizedGossipMenuItem[] items)
     : this(text)
 {
     Icon    = icon;
     SubMenu = new GossipMenu(items);
 }
예제 #4
0
 public QuitGossipMenuItem(GossipMenu subMenu, RealmLangKey msg, params object[] args)
     : base(subMenu, msg, args)
 {
     this.Action =
         (IGossipAction) new NonNavigatingGossipAction((GossipActionHandler)(convo =>
                                                                             convo.Character.GossipConversation.StayOpen = false));
 }
예제 #5
0
 public MultiStringGossipMenuItem(string[] texts, GossipActionHandler callback,
                                  params MultiStringGossipMenuItem[] items)
     : this(texts)
 {
     Action  = new NonNavigatingGossipAction(callback);
     SubMenu = new GossipMenu(items);
 }
예제 #6
0
 public MultiStringGossipMenuItem(GossipMenuIcon icon, string[] texts, GossipActionHandler callback, GossipMenu subMenu)
     : this(texts)
 {
     Icon    = icon;
     Action  = new NonNavigatingGossipAction(callback);
     SubMenu = subMenu;
 }
예제 #7
0
 public MultiStringGossipMenuItem(GossipMenuIcon icon, string[] texts, IGossipAction action, GossipMenu subMenu)
     : this(texts)
 {
     Icon    = icon;
     SubMenu = subMenu;
     Action  = action;
 }
예제 #8
0
 /// <summary>Creates gossip conversation by its fields</summary>
 /// <param name="menu">starting menu</param>
 /// <param name="chr">character which started the conversation</param>
 /// <param name="speaker">respondent</param>
 public GossipConversation(GossipMenu menu, Character chr, WorldObject speaker, bool keepOpen)
 {
     CurrentMenu = menu;
     Character   = chr;
     Speaker     = speaker;
     StayOpen    = keepOpen;
 }
예제 #9
0
		/// <summary>
		/// Creates gossip conversation by its fields
		/// </summary>
		/// <param name="menu">starting menu</param>
		/// <param name="chr">character which started the conversation</param>
		/// <param name="speaker">respondent</param>
		public GossipConversation(GossipMenu menu, Character chr, WorldObject speaker, bool keepOpen)
		{
			CurrentMenu = menu;
			Character = chr;
			Speaker = speaker;
			StayOpen = keepOpen;
		}
예제 #10
0
 public LocalizedGossipMenuItem(GossipActionHandler callback, GossipMenu subMenu, RealmLangKey msgKey,
                                params object[] msgArgs)
     : this(msgKey, msgArgs)
 {
     this.Action  = (IGossipAction) new NonNavigatingGossipAction(callback);
     this.SubMenu = subMenu;
 }
예제 #11
0
 public LocalizedGossipMenuItem(IGossipAction action, GossipMenu subMenu, RealmLangKey msgKey,
                                params object[] msgArgs)
     : this(msgKey, msgArgs)
 {
     this.Action  = action;
     this.SubMenu = subMenu;
 }
예제 #12
0
 public QuitGossipMenuItem(GossipMenu subMenu, RealmLangKey msg, params object[] args)
     : base(subMenu, msg, args)
 {
     Action = new NonNavigatingGossipAction((convo) =>
     {
         convo.Character.GossipConversation.StayOpen = false;
     });
 }
예제 #13
0
 public LocalizedGossipMenuItem(GossipMenu subMenu, RealmLangKey msgKey, params object[] msgArgs)
     : this(msgKey, new object[3]
 {
     (object)msgArgs,
     null,
     (object)subMenu
 })
 {
 }
예제 #14
0
		/// <summary>
		/// Creates gossip conversation by its fields
		/// </summary>
		/// <param name="menu">starting menu</param>
		/// <param name="speaker">character which started the conversation</param>
		/// <param name="target">respondent</param>
		public GossipConversation(GossipMenu menu, Character speaker, WorldObject target, bool keepOpen)
		{
			if (menu.BodyTextId == 0)
			{
				menu.BodyTextId = GossipMgr.DefaultTextId;
			}
			CurrentMenu = menu;
			Character = speaker;
			Speaker = target;
			StayOpen = keepOpen;
		}
예제 #15
0
		/// <summary>
		/// Creates and returns the sub-menu for Waypoints
		/// </summary>
		/// <returns></returns>
		private GossipMenu CreateWaypointMenu()
		{
			var menu = new GossipMenu(m_point.SpawnEntry.Entry.NameGossipId);
			menu.AddGoBackItem("Go back...");
			foreach (var wp in m_point.SpawnEntry.Waypoints)
			{
				menu.AddItem(new WPItem(m_point, wp));
			}
			menu.AddQuitMenuItem("Done");
			return menu;
		}
예제 #16
0
 /// <summary>Shows menu to player</summary>
 /// <param name="menu">menu to show</param>
 public void DisplayMenu(GossipMenu menu)
 {
     CurrentMenu = menu;
     menu.OnDisplay(this);
     if (Speaker is IQuestHolder && ((IQuestHolder)Speaker).QuestHolderInfo != null)
     {
         GossipHandler.SendPageToCharacter(this,
                                           ((IQuestHolder)Speaker).QuestHolderInfo.GetQuestMenuItems(
                                               Character));
     }
     else
     {
         GossipHandler.SendPageToCharacter(this, null);
     }
 }
예제 #17
0
        /// <summary>Handles selection of item in menu by player</summary>
        /// <param name="itemID">ID of selected item</param>
        /// <param name="extra">additional parameter supplied by user</param>
        public void HandleSelectedItem(uint itemID, string extra)
        {
            IList <GossipMenuItemBase> gossipItems = CurrentMenu.GossipItems;

            if (itemID >= gossipItems.Count)
            {
                return;
            }
            GossipMenuItemBase gossipMenuItemBase = gossipItems[(int)itemID];

            if (gossipMenuItemBase == null)
            {
                return;
            }
            if (gossipMenuItemBase.Action != null && gossipMenuItemBase.Action.CanUse(this))
            {
                GossipMenu currentMenu = CurrentMenu;
                gossipMenuItemBase.Action.OnSelect(this);
                if (currentMenu != CurrentMenu || gossipMenuItemBase.Action.Navigates)
                {
                    return;
                }
            }

            if (gossipMenuItemBase.SubMenu != null)
            {
                DisplayMenu(gossipMenuItemBase.SubMenu);
            }
            else if (StayOpen)
            {
                DisplayCurrentMenu();
            }
            else
            {
                CurrentMenu.NotifyClose(this);
                Dispose();
            }
        }
예제 #18
0
 /// <summary>Add default Gossip options for Vendors etc</summary>
 private static void AddDefaultGossipOptions()
 {
     foreach (NPCEntry entry1 in NPCMgr.Entries)
     {
         NPCEntry entry = entry1;
         if (entry != null && entry.NPCFlags.HasAnyFlag(NPCFlags.Gossip))
         {
             GossipMenu gossipMenu = entry.DefaultGossip;
             if (gossipMenu == null)
             {
                 entry.DefaultGossip = gossipMenu = new GossipMenu();
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.Banker))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(GossipMenuIcon.Bank,
                                                                                     (GossipActionHandler)(convo => convo.Character.OpenBank(convo.Speaker)),
                                                                                     RealmLangKey.GossipOptionBanker, new object[0]));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.BattleMaster))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new GossipMenuItem(GossipMenuIcon.Battlefield,
                                                                            "Battlefield...", (GossipActionHandler)(convo =>
                 {
                     if (entry.BattlegroundTemplate == null)
                     {
                         return;
                     }
                     ((NPC)convo.Speaker).TalkToBattlemaster(convo.Character);
                 })));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.InnKeeper))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(GossipMenuIcon.Bind,
                                                                                     (GossipActionHandler)(convo => convo.Character.BindTo((NPC)convo.Speaker)),
                                                                                     RealmLangKey.GossipOptionInnKeeper, new object[0]));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.GuildBanker))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new GossipMenuItem(GossipMenuIcon.Guild,
                                                                            "Guild Bank...",
                                                                            (GossipActionHandler)(convo =>
                                                                                                  convo.Character.SendSystemMessage(RealmLangKey.FeatureNotYetImplemented,
                                                                                                                                    new object[0]))));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.SpiritHealer))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(GossipMenuIcon.Resurrect,
                                                                                     (GossipActionHandler)(convo => convo.Character.ResurrectWithConsequences()),
                                                                                     RealmLangKey.GossipOptionSpiritHealer, new object[0]));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.Petitioner))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new GossipMenuItem(GossipMenuIcon.Bank, "Petitions...",
                                                                            (GossipActionHandler)(convo => ((NPC)convo.Speaker).SendPetitionList(convo.Character))));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.TabardDesigner))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(GossipMenuIcon.Tabard,
                                                                                     (GossipActionHandler)(convo =>
                                                                                                           convo.Character.SendSystemMessage(RealmLangKey.FeatureNotYetImplemented,
                                                                                                                                             new object[0])), RealmLangKey.GossipOptionTabardDesigner, new object[0]));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.FlightMaster))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(GossipMenuIcon.Taxi,
                                                                                     (GossipActionHandler)(convo => ((NPC)convo.Speaker).TalkToFM(convo.Character)),
                                                                                     RealmLangKey.GossipOptionFlightMaster, new object[0]));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.StableMaster))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(
                                        (GossipActionHandler)(convo =>
                                                              PetMgr.ListStabledPets(convo.Character, (NPC)convo.Speaker)),
                                        RealmLangKey.GossipOptionStableMaster, new object[0]));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.AnyTrainer))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(GossipMenuIcon.Taxi,
                                                                                     (GossipActionHandler)(convo => ((NPC)convo.Speaker).TalkToTrainer(convo.Character)),
                                                                                     RealmLangKey.GossipOptionTrainer, new object[0]));
             }
             if (entry.NPCFlags.HasAnyFlag(NPCFlags.AnyVendor))
             {
                 gossipMenu.AddItem((GossipMenuItemBase) new LocalizedGossipMenuItem(GossipMenuIcon.Trade,
                                                                                     (GossipActionHandler)(convo =>
                 {
                     if (((NPC)convo.Speaker).VendorEntry == null)
                     {
                         return;
                     }
                     ((NPC)convo.Speaker).VendorEntry.UseVendor(convo.Character);
                 }), RealmLangKey.GossipOptionVendor, new object[0]));
             }
         }
     }
 }
예제 #19
0
		/// <summary>
		/// Shows menu to player
		/// 
		/// TODO: Why is this only sending Quest-information? And: Why is this sending Quest information at all?
		/// TODO: Quest handling should be part of a subclass of GossipMenu or similar
		/// </summary>
		/// <param name="menu">menu to show</param>
		public void DisplayMenu(GossipMenu menu)
		{
			CurrentMenu = menu;

			if (Speaker is IQuestHolder && ((IQuestHolder)Speaker).QuestHolderInfo != null)
			{
				var questMenuItems = ((IQuestHolder)Speaker).QuestHolderInfo.GetQuestMenuItems(Character);

				GossipHandler.SendPageToCharacter(this, menu.BodyTextId, menu.GossipItems, questMenuItems);
			}
			else
			{
				GossipHandler.SendPageToCharacter(this, menu.BodyTextId, menu.GossipItems, null);
			}
		}
예제 #20
0
 /// <summary>Creates gossip conversation by its fields</summary>
 /// <param name="menu">starting menu</param>
 /// <param name="chr">character which started the conversation</param>
 /// <param name="speaker">respondent</param>
 public GossipConversation(GossipMenu menu, Character chr, WorldObject speaker)
     : this(menu, chr, speaker, menu.KeepOpen)
 {
 }
예제 #21
0
		public LocalizedGossipMenuItem(GossipMenuIcon icon, string[] texts, params LocalizedGossipMenuItem[] items)
			: this(texts)
		{
			Icon = icon;
			SubMenu = new GossipMenu(items);
		}
예제 #22
0
		public LocalizedGossipMenuItem(string[] texts, IGossipAction action, GossipMenu subMenu)
			: this(texts)
		{
			Action = action;
			SubMenu = subMenu;
		}
예제 #23
0
		public GossipMenuItem(string text, GossipActionHandler callback, params GossipMenuItem[] items)
			: this(text)
		{
			Action = new DefaultGossipAction(callback);
			SubMenu = new GossipMenu(items);
		}
예제 #24
0
		public LocalizedGossipMenuItem(GossipMenuIcon icon, LangKey langKey, params LocalizedGossipMenuItem[] items)
			: this(langKey)
		{
			Icon = icon;
			SubMenu = new GossipMenu(items);
		}
예제 #25
0
		public LocalizedGossipMenuItem(LangKey langKey, params LocalizedGossipMenuItem[] items)
			: this(langKey)
		{
			SubMenu = new GossipMenu(items);
		}
예제 #26
0
		public LocalizedGossipMenuItem(LangKey langKey, IGossipAction action, GossipMenu subMenu)
			: this(langKey)
		{
			Action = action;
			SubMenu = subMenu;
		}
예제 #27
0
		public LocalizedGossipMenuItem(LangKey langKey, GossipActionHandler callback, GossipMenu subMenu)
			: this(langKey)
		{
			Action = new DefaultGossipAction(callback);
			SubMenu = subMenu;
		}
예제 #28
0
		public LocalizedGossipMenuItem(LangKey langKey, GossipMenu subMenu)
			: this(langKey, (IGossipAction)null, subMenu)
		{
		}
예제 #29
0
		public LocalizedGossipMenuItem(LangKey langKey, GossipActionHandler callback, params LocalizedGossipMenuItem[] items)
			: this(langKey)
		{
			Action = new DefaultGossipAction(callback);
			SubMenu = new GossipMenu(items);
		}
예제 #30
0
 public GossipMenuItem(string text, params GossipMenuItem[] items)
     : this(text)
 {
     SubMenu = new GossipMenu(items);
 }
예제 #31
0
 public GossipMenuItem(string text, GossipMenu subMenu)
     : this(text, (IGossipAction)null, subMenu)
 {
 }
예제 #32
0
		public GossipMenuItem(string text, GossipMenu subMenu)
			: this(text, (IGossipAction)null, subMenu)
		{
		}
예제 #33
0
		public LocalizedGossipMenuItem(string[] texts, params LocalizedGossipMenuItem[] items)
			: this(texts)
		{
			SubMenu = new GossipMenu(items);
		}
예제 #34
0
		public GossipMenuItem(string text, GossipActionHandler callback, GossipMenu subMenu)
			: this(text)
		{
			Action = new DefaultGossipAction(callback);
			SubMenu = subMenu;
		}
예제 #35
0
		public GossipMenuItem(string text, IGossipAction action, GossipMenu subMenu)
			: this(text)
		{
			Action = action;
			SubMenu = subMenu;
		}
예제 #36
0
 public LocalizedGossipMenuItem(TranslatableItem text, GossipMenu subMenu)
     : this(text, (IGossipAction)null, subMenu)
 {
 }
예제 #37
0
 public GossipMenuItem(string text, IGossipAction action, GossipMenu subMenu)
     : this(text)
 {
     Action  = action;
     SubMenu = subMenu;
 }
예제 #38
0
		public static GossipMenu CreateTeleMenu(List<INamedWorldZoneLocation> locations, Action<GossipConversation, INamedWorldZoneLocation> callback)
		{
			// create gossip of all options
			var menu = new GossipMenu();
			foreach (var location in locations)
			{
				var loc = location;		// allocate a local copy
				menu.AddItem(new LocalizedGossipMenuItem(loc.Names, convo =>
				{
					callback(convo, loc);
				}));
			}
			return menu;
		}
예제 #39
0
		public void FinalizeDataHolder()
		{
			var entry = NPCMgr.GetEntry(NPCId);
			if (entry != null && entry.DefaultGossip == null)
			{
				var menu = new GossipMenu(TextId);

				entry.DefaultGossip = menu;

				if (entry.NPCFlags.HasAnyFlag(NPCFlags.SpiritHealer))
				{
					entry.NPCFlags |= NPCFlags.Gossip;
				}
				else
				{
					entry.NPCFlags &= ~NPCFlags.Gossip;
				}
			}
		}
예제 #40
0
 public GossipMenuItem(string text, GossipActionHandler callback, GossipMenu subMenu)
     : this(text)
 {
     Action  = new NonNavigatingGossipAction(callback);
     SubMenu = subMenu;
 }
예제 #41
0
 public LocalizedGossipMenuItem(TranslatableItem text, IGossipAction action, GossipMenu subMenu)
     : this(text)
 {
     this.Action  = action;
     this.SubMenu = subMenu;
 }
예제 #42
0
		public virtual void FinalizeDataHolder()
		{
			if (Id != 0)
			{
				GOId = (GOEntryId)Id;
			}
			else
			{
				Id = (uint)GOId;
			}

			if (FactionId != 0)
			{
				Faction = FactionMgr.Get(FactionId);
			}

			InitEntry();

			// create GossipMenu
			if (GossipId != 0 && DefaultGossip == null)
			{
				var gossipEntry = GossipMgr.GetEntry(GossipId);
				if (gossipEntry == null)
				{
					ContentMgr.OnInvalidDBData("GOEntry {0} has missing GossipId: {1}", this, GossipId);
					DefaultGossip = new GossipMenu();
				}
				else
				{
					DefaultGossip = new GossipMenu(GossipId);
				}
			}
			else if (QuestHolderInfo != null)
			{
				// Make sure, there is a gossip menu, so quests can be started/completed
				DefaultGossip = new GossipMenu();
			}

			// set HandlerCreator
			if (HandlerCreator == null)
			{
				HandlerCreator = GOMgr.Handlers[(int)Type];
			}

			if (GOCreator == null)
			{
				if (IsTransport)
				{
					GOCreator = () => new Transport();
				}
				else
				{
					GOCreator = () => new GameObject();
				}
			}

			if (Fields != null)		// ignore invalid ones
			{
				//Fields = null;
				GOMgr.Entries[Id] = this;
			}
		}
예제 #43
0
		/// <summary>
		/// Initialize the GO
		/// </summary>
		/// <param name="entry"></param>
		/// <param name="templ"></param>
		internal virtual void Init(GOEntry entry, GOSpawnEntry spawnEntry, GOSpawnPoint spawnPoint)
		{
			EntityId = EntityId.GetGameObjectId((uint)Interlocked.Increment(ref _lastGOUID), entry.GOId);
			Type |= ObjectTypes.GameObject;
			//DynamicFlagsLow = GameObjectDynamicFlagsLow.Activated;
			m_entry = entry;
			m_spawnPoint = spawnPoint;

			DisplayId = entry.DisplayId;
			EntryId = entry.Id;
			GOType = entry.Type;
			Flags = m_entry.Flags;
			m_faction = m_entry.Faction ?? Faction.NullFaction;
			ScaleX = m_entry.Scale;
			GossipMenu = entry.DefaultGossip;

			if (QuestHolderInfo != null && GossipMenu == null)
			{
				// make sure, there is a GossipMenu that allows the player to start/finish quests
				GossipMenu = new GossipMenu();
			}

			spawnEntry = spawnEntry ?? entry.FirstSpawnEntry;
			if (spawnEntry != null)
			{
				Phase = spawnEntry.Phase;
				State = spawnEntry.State;
				if (spawnEntry.Scale != 1)
				{
					ScaleX = spawnEntry.Scale;
				}
				Orientation = spawnEntry.Orientation;
				AnimationProgress = spawnEntry.AnimProgress;
				SetRotationFields(spawnEntry.Rotations);
			}

			m_entry.InitGO(this);
		}
예제 #44
0
		/// <summary>
		/// Lets the Character gossip with herself
		/// </summary>
		public void StartGossip(GossipMenu menu)
		{
			GossipConversation = new GossipConversation(menu, this, this, menu.KeepOpen);
			GossipConversation.DisplayCurrentMenu();
		}
예제 #45
0
		public GossipMenuItem(string text, params GossipMenuItem[] items)
			: this(text)
		{
			SubMenu = new GossipMenu(items);
		}
예제 #46
0
 public GossipMenuItem(GossipMenuIcon icon, string text, params GossipMenuItem[] items)
     : this(text)
 {
     Icon    = icon;
     SubMenu = new GossipMenu(items);
 }
예제 #47
0
 public LocalizedGossipMenuItem(TranslatableItem text, GossipActionHandler callback, GossipMenu subMenu)
     : this(text)
 {
     this.Action  = (IGossipAction) new NonNavigatingGossipAction(callback);
     this.SubMenu = subMenu;
 }
예제 #48
0
		public GossipMenuItem(GossipMenuIcon icon, string text, params GossipMenuItem[] items)
			: this(text)
		{
			Icon = icon;
			SubMenu = new GossipMenu(items);
		}
예제 #49
0
파일: GossipEntry.cs 프로젝트: Jeroz/WCell
		public void FinalizeDataHolder()
		{
			var spawn = NPCMgr.GetSpawnEntry(NPCSpawnId);
			var gossipEntry = GossipMgr.GetEntry(GossipId);

			if (spawn == null)
			{
				ContentMgr.OnInvalidDBData("{0} refers to invalid spawn id: {1}", GetType(), this);
			}
			else if (gossipEntry == null)
			{
				ContentMgr.OnInvalidDBData("{0} has invalid GossipId: {1}", GetType(), this);
			}
			else
			{
				// for now, assume that all spawns share the same gossip menu
				var entry = spawn.Entry;
				if (entry.DefaultGossip == null)
				{
					var menu = new GossipMenu(gossipEntry);

					entry.DefaultGossip = menu;
				}
				else
				{
					entry.DefaultGossip.GossipEntry = gossipEntry;
				}

				entry.NPCFlags |= NPCFlags.Gossip;
			}
		}
예제 #50
0
 public MultiStringGossipMenuItem(string[] texts, GossipMenu subMenu)
     : this(texts, (IGossipAction)null, subMenu)
 {
 }
예제 #51
0
		/// <summary>
		/// Lets the Character gossip with the given speaker
		/// </summary>
		public void StartGossip(GossipMenu menu, WorldObject speaker)
		{
			GossipConversation = new GossipConversation(menu, this, speaker, menu.KeepOpen);
			GossipConversation.DisplayCurrentMenu();
		}
예제 #52
0
 public MultiStringGossipMenuItem(string[] texts, params MultiStringGossipMenuItem[] items)
     : this(texts)
 {
     SubMenu = new GossipMenu(items);
 }
예제 #53
0
        /// <summary>
        /// Add default Gossip options for Vendors etc
        /// </summary>
        private static void AddDefaultGossipOptions()
        {
            foreach (var _entry in NPCMgr.Entries)
            {
                var entry = _entry;                                                     // copy object to prevent access to modified closure in callbacks
                if (entry != null)
                {
                    if (entry.NPCFlags.HasAnyFlag(NPCFlags.Gossip))
                    {
                        var menu = entry.DefaultGossip;
                        if (menu == null)
                        {
                            entry.DefaultGossip = menu = new GossipMenu();
                        }
                        //else if (menu.GossipItems.Count > 0)
                        //{
                        //    // Talk option -> Should it be in a sub menu?
                        //    entry.DefaultGossip = menu = new GossipMenu(menu.GossipEntry, new GossipMenuItem("Talk")
                        //    {
                        //        SubMenu = menu
                        //    });
                        //}

                        // NPC professions
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.Banker))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(GossipMenuIcon.Bank, convo =>
                            {
                                convo.Character.OpenBank(convo.Speaker);
                            }, RealmLangKey.GossipOptionBanker));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.BattleMaster))
                        {
                            menu.AddItem(new GossipMenuItem(GossipMenuIcon.Battlefield, "Battlefield...", convo =>
                            {
                                if (entry.BattlegroundTemplate != null)
                                {
                                    ((NPC)convo.Speaker).TalkToBattlemaster(convo.Character);
                                }
                            }));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.InnKeeper))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(GossipMenuIcon.Bind, convo =>
                            {
                                convo.Character.BindTo((NPC)convo.Speaker);
                            }, RealmLangKey.GossipOptionInnKeeper));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.GuildBanker))
                        {
                            menu.AddItem(new GossipMenuItem(GossipMenuIcon.Guild, "Guild Bank...", convo =>
                            {
                                convo.Character.SendSystemMessage(RealmLangKey.FeatureNotYetImplemented);
                            }));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.SpiritHealer))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(GossipMenuIcon.Resurrect, convo =>
                            {
                                convo.Character.ResurrectWithConsequences();
                            }, RealmLangKey.GossipOptionSpiritHealer));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.Petitioner))
                        {
                            menu.AddItem(new GossipMenuItem(GossipMenuIcon.Bank, "Petitions...", convo =>
                            {
                                ((NPC)convo.Speaker).SendPetitionList(convo.Character);
                            }));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.TabardDesigner))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(GossipMenuIcon.Tabard, convo =>
                            {
                                convo.Character.SendSystemMessage(RealmLangKey.FeatureNotYetImplemented);
                            }, RealmLangKey.GossipOptionTabardDesigner));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.FlightMaster))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(GossipMenuIcon.Taxi, convo =>
                            {
                                ((NPC)convo.Speaker).TalkToFM(convo.Character);
                            }, RealmLangKey.GossipOptionFlightMaster));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.StableMaster))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(convo =>
                            {
                                PetMgr.ListStabledPets(convo.Character, ((NPC)convo.Speaker));
                            }, RealmLangKey.GossipOptionStableMaster));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.AnyTrainer))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(GossipMenuIcon.Train, convo =>
                            {
                                ((NPC)convo.Speaker).TalkToTrainer(convo.Character);
                            }, RealmLangKey.GossipOptionTrainer));
                        }
                        if (entry.NPCFlags.HasAnyFlag(NPCFlags.AnyVendor))
                        {
                            menu.AddItem(new LocalizedGossipMenuItem(GossipMenuIcon.Trade, convo =>
                            {
                                if (((NPC)convo.Speaker).VendorEntry != null)
                                {
                                    ((NPC)convo.Speaker).VendorEntry.UseVendor(convo.Character);
                                }
                            }, RealmLangKey.GossipOptionVendor));
                        }
                    }
                }
            }
        }
예제 #54
0
		public LocalizedGossipMenuItem(string[] texts, GossipActionHandler callback, GossipMenu subMenu)
			: this(texts)
		{
			Action = new DefaultGossipAction(callback);
			SubMenu = subMenu;
		}
예제 #55
0
		public QuitGossipMenuItem(string text, GossipActionHandler callback, GossipMenu subMenu)
			: base(text, subMenu)
		{
			Action = new DefaultGossipAction((convo) => {
				convo.Character.GossipConversation.StayOpen = false;
				callback(convo);
			});
		}
예제 #56
0
 public GossipMenuItem(string text, GossipActionHandler callback, params GossipMenuItem[] items)
     : this(text)
 {
     Action  = new NonNavigatingGossipAction(callback);
     SubMenu = new GossipMenu(items);
 }
예제 #57
0
 public MultiStringGossipMenuItem(string[] texts, IGossipAction action, GossipMenu subMenu)
     : this(texts)
 {
     Action  = action;
     SubMenu = subMenu;
 }
예제 #58
0
		public LocalizedGossipMenuItem(string[] texts, GossipActionHandler callback, params LocalizedGossipMenuItem[] items)
			: this(texts)
		{
			Action = new DefaultGossipAction(callback);
			SubMenu = new GossipMenu(items);
		}
예제 #59
0
 public MultiStringGossipMenuItem(GossipMenuIcon icon, string[] texts, params MultiStringGossipMenuItem[] items)
     : this(texts)
 {
     Icon    = icon;
     SubMenu = new GossipMenu(items);
 }
예제 #60
0
		public LocalizedGossipMenuItem(string[] texts, GossipMenu subMenu)
			: this(texts, (IGossipAction)null, subMenu)
		{
		}