public static void HandleGossipHello(IRealmClient client, RealmPacketIn packet) { var targetEntityId = packet.ReadEntityId(); var chr = client.ActiveCharacter; var target = chr.Region.GetObject(targetEntityId) as Unit; if (target == null) return; if (chr.GossipConversation != null) { chr.GossipConversation = null; } var menu = target.GossipMenu; if (menu == null) return; if (target is NPC) { if (!((NPC)target).CanInteractWith(chr)) { return; } } else if (!chr.Role.IsStaff) { return; } chr.OnInteract(target); var conversation = new GossipConversation(menu, chr, target, menu.KeepOpen); client.ActiveCharacter.GossipConversation = conversation; conversation.DisplayCurrentMenu(); }
/// <summary> /// Generate the menu's text dynamically /// </summary> public override string GetText(GossipConversation convo) { var text = RealmLocalizer.Instance.Translate(convo.Character.Locale, RealmLangKey.EditorMapMenuText) + GossipTextHelper.Newline; if (!GOMgr.Loaded || !NPCMgr.Loaded) { if (!convo.Speaker.HasUpdateAction(action => action is PeriodicLoadMapTimer)) { // already loading text += RealmLocalizer.Instance.Translate(convo.Character.Locale, RealmLangKey.EditorMapMenuStatusNoData); } else { // not loading yet text += RealmLocalizer.Instance.Translate(convo.Character.Locale, RealmLangKey.EditorMapMenuStatusDataLoading); } } else if (!Editor.Map.IsSpawned) { if (Editor.Map.IsSpawning) { // already spawning text += RealmLocalizer.Instance.Translate(convo.Character.Locale, RealmLangKey.EditorMapMenuStatusSpawning); } else { // not spawning yet text += RealmLocalizer.Instance.Translate(convo.Character.Locale, RealmLangKey.EditorMapMenuStatusNotSpawned); } } return text; }
public override string GetConfirmText(GossipConversation convo) { if (this.ConfirmText != null) { return(this.ConfirmText.Translate(convo.User.Locale)); } return(""); }
public override string GetTextFemale(GossipConversation convo) { if (convo == null) { return("<invalid context>"); } return(this.StringGetter(convo)); }
public override string GetText(GossipConversation convo) { return Text.Translate(convo.User.Locale); }
public abstract string GetTextFemale(GossipConversation convo);
public virtual void OnSelect(GossipConversation convo) { }
public override string GetTextFemale(GossipConversation convo) { return TextFemale; }
/// <summary> /// Called before menu is sent to Character /// </summary> protected internal virtual void OnDisplay(GossipConversation convo) { }
public override string GetText(GossipConversation convo) { return(this.Text.Translate(convo.User.Locale)); }
/// <summary> /// Handle what happens when clicking on the Teleport option /// </summary> void HandleTeleport(GossipConversation convo) { convo.Character.TeleportTo(m_point); }
public abstract string GetConfirmText(GossipConversation convo);
/// <summary> /// Move the Waypoint over to the Character /// </summary> void HandleMoveOver(GossipConversation convo) { m_Point.MoveWP(m_wp, convo.Character.Position); }
/// <summary> /// Insert a new WP /// </summary> void HandleInsert(GossipConversation convo) { m_Point.InsertAfter(m_wp, convo.Character.Position, convo.Character.Orientation); }
/// <summary> /// Remove the WP /// </summary> void HandleRemove(GossipConversation convo) { m_Point.RemoveWP(m_wp); // the WP is now gone, so let's send the Menu again (without this Item in it) convo.Invalidate(); }
/// <summary> /// Go to the WP /// </summary> void HandleGoto(GossipConversation convo) { convo.Character.TeleportTo(m_Point.Region, m_wp.Position); }
public void OnSelect(GossipConversation convo) { m_Handler(convo); }
public PeriodicLoadMapTimer(GossipConversation convo) { m_Convo = convo; Delay = 1000; Callback = OnTick; }
/// <summary> /// Handle what happens when clicking on the Remove option /// </summary> private void HandleRemove(GossipConversation convo) { m_point.RemoveSpawnLater(); }
static void OnLoadClicked(GossipConversation convo) { GOMgr.LoadAllLater(); NPCMgr.LoadAllLater(); var chr = convo.Character; chr.SendSystemMessage(RealmLangKey.PleaseWait); convo.Character.AddUpdateAction(new PeriodicLoadMapTimer(convo)); }
/// <summary> /// Handle what happens when clicking on the Add WP button /// </summary> private void HandleAddWP(GossipConversation convo) { var chr = convo.Character; m_point.InsertAfter(null, chr.Position, chr.Orientation); }
private static string OnTextQuery(GossipConversation convo) { return ((DynamicTextGossipMenu)convo.CurrentMenu).GetText(convo); }
internal void NotifyClose(GossipConversation convo) { }
public override string GetTextFemale(GossipConversation convo) { return(TextFemale); }
/// <summary> /// Sends a page to the character /// </summary> /// <param name="chr">recieving character</param> /// <param name="owner">EntityID of sender</param> public static void SendPageToCharacter(GossipConversation convo, IList<QuestMenuItem> questItems) { var speaker = convo.Speaker; var chr = convo.Character; var menu = convo.CurrentMenu; var gossipItems = menu.GossipItems; var gossipEntry = menu.GossipEntry; if (gossipEntry.IsDynamic) { // not cached QueryHandler.SendNPCTextUpdate(chr, gossipEntry); } using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GOSSIP_MESSAGE)) { packet.Write(speaker.EntityId); packet.Write(0); // new Flag field since 2.4.0 - menu id packet.Write(gossipEntry.GossipId); var countPos = packet.Position; packet.Position += 4; var count = 0; if (gossipItems != null) { for (var i = 0; i < gossipItems.Count; i++) { var item = gossipItems[i]; if (item.Action != null && !item.Action.CanUse(convo)) { continue; } packet.Write(i); packet.Write((byte)item.Icon); packet.Write(item.Input); packet.Write((uint)item.RequiredMoney); packet.WriteCString(item.GetText(convo)); packet.WriteCString(item.GetConfirmText(convo)); count++; } } if (questItems != null) { packet.WriteUInt(questItems.Count); for (int i = 0; i < questItems.Count; i++) { var item = questItems[i]; packet.Write(item.ID); packet.Write(item.Status); packet.Write(item.Level); packet.Write(0); // quest flags packet.Write((byte)0); // 3.3.3 flag (blue question or yelloe exclamation mark) packet.WriteCString(item.Text); } } else packet.Write(0); packet.Position = countPos; packet.Write(count); chr.Client.Send(packet); } }
public override string GetConfirmText(GossipConversation convo) { if (ConfirmText != null) return ConfirmText.Translate(convo.User.Locale); return ""; }
public override string GetTextMale(GossipConversation convo) { return(this.TextMale); }
/// <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(); }
public override string GetTextFemale(GossipConversation convo) { if (convo == null) return "<invalid context>"; return StringGetter(convo); }
public override string GetConfirmText(GossipConversation convo) { return(ConfirmText); }
/// <summary> /// Lets the Character gossip with herself /// </summary> public void StartGossip(GossipMenu menu) { GossipConversation = new GossipConversation(menu, this, this, menu.KeepOpen); GossipConversation.DisplayCurrentMenu(); }
/// <summary> /// Sends a page to the character /// </summary> /// <param name="chr">recieving character</param> /// <param name="owner">EntityID of sender</param> public static void SendPageToCharacter(GossipConversation convo, uint bodyTextID, IList<GossipMenuItemBase> gossipItems, IList<QuestMenuItem> questItems) { var owner = convo.Speaker; var chr = convo.Character; if (bodyTextID == 0) { // Client won't display the gossip if text id is 0 bodyTextID = 1; } using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GOSSIP_MESSAGE)) { packet.Write(owner.EntityId); packet.Write(0); // new Flag field since 2.4.0 - menu id packet.Write(bodyTextID); var countPos = packet.Position; packet.Position += 4; var count = 0; if (gossipItems != null) { for (var i = 0; i < gossipItems.Count; i++) { var item = gossipItems[i]; if (item.Action != null && !item.Action.CanUse(chr)) { continue; } packet.Write(i); packet.Write((byte)item.Icon); packet.Write(item.Input); packet.Write((uint)item.RequiredMoney); packet.WriteCString(item.GetText(convo)); packet.WriteCString(item.GetConfirmText(convo)); count++; } } if (questItems != null) { packet.WriteUInt(questItems.Count); for (int i = 0; i < questItems.Count; i++) { var item = questItems[i]; packet.Write(item.ID); packet.Write(item.Status); packet.Write(item.Level); packet.Write(0); // quest flags packet.Write((byte)0); // 3.3.3 flag (blue question or yelloe exclamation mark) packet.WriteCString(item.Text); } } else packet.Write(0); packet.Position = countPos; packet.Write(count); chr.Client.Send(packet); } }
private static string OnTextQuery(GossipConversation convo) { return(((DynamicTextGossipMenu)convo.CurrentMenu).GetText(convo)); }
public override string GetConfirmText(GossipConversation convo) { return ConfirmTexts.Localize(convo.User.Locale); }
public override string GetText(GossipConversation convo) { return SpawnPoint.ToString(); }
public override string GetConfirmText(GossipConversation convo) { return ConfirmText; }
public override string GetText(GossipConversation convo) { return ""; }
public override string GetConfirmText(GossipConversation convo) { return(ConfirmTexts.Localize(convo.User.Locale)); }
public override string GetConfirmText(GossipConversation convo) { return(GetConfirmTextCallback(convo, (M)convo.CurrentMenu)); }