/// <summary> /// Sends a text message to players within a specific radius of another object /// </summary> /// <param name="centerObject">The center object</param> /// <param name="message">The message to send</param> /// <param name="chatType">The chat typ</param> /// <param name="chatLoc">The chat location</param> /// <param name="distance">The distance</param> /// <param name="excludes">A list of GameObjects to exlude from the message</param> public static void MessageToArea(GameObject centerObject, string message, eChatType chatType, eChatLoc chatLoc, ushort distance, params GameObject[] excludes) { if (message == null || message.Length <= 0) { return; } bool excluded; foreach (GamePlayer player in centerObject.GetPlayersInRadius(distance)) { excluded = false; if (excludes != null) { foreach (GameObject obj in excludes) { if (obj == player) { excluded = true; break; } } } if (!excluded) { player.MessageFromArea(centerObject, message, chatType, chatLoc); } } }
/// <summary> /// Called on every timer tick. /// </summary> protected override void OnTick() { m_ticks++; if (m_ticks < m_maxTicks) { if (m_smoke) { // Send smoke animation to players in visibility range. foreach (GamePlayer player in m_owner.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { player.Out.SendSpellEffectAnimation(m_owner, m_owner, SummonSpellEffect, 0, false, 0x01); } } } else { // We're done, stop the timer and notify owner. this.Stop(); IsRunning = false; m_owner.Notify(m_event); } }
public virtual IList SelectRealmTargets(GameObject castTarget) { ArrayList list = new ArrayList(); foreach (GamePlayer player in castTarget.GetPlayersInRadius((ushort)1000)) { if(player.Realm == m_caster.Realm && player!=m_caster) list.Add(player); } list.Add(m_caster); return list; }
/// <summary> /// Sends a message to the system window of players inside /// INFO_DISTANCE radius of the center object /// </summary> /// <param name="centerObject">The center object of the message</param> /// <param name="chatType">The type of message to send</param> /// <param name="LanguageMessageID">The language message ID</param> /// <param name="args">The Translation args</param> /// <remarks>If the centerObject is a player, he won't receive the message</remarks> public static void SystemToOthers2(GameObject centerObject, eChatType chatType, string LanguageMessageID, params object[] args) { if (LanguageMessageID == null || LanguageMessageID.Length <= 0) { return; } foreach (GamePlayer player in centerObject.GetPlayersInRadius(WorldMgr.INFO_DISTANCE)) { if (!(centerObject is GamePlayer && centerObject == player)) { player.MessageFromArea(centerObject, LanguageMgr.GetTranslation(player.Client.Account.Language, LanguageMessageID, args), chatType, eChatLoc.CL_SystemWindow); } } }
/// <summary> /// Broadcasts a message to players within (whatever) distance from this object /// </summary> /// <param name="obj">The object that says the message</param> /// <param name="msg">The message that the object says</param> /// <param name="distance">The distance which the message is heard</param> /// <param name="chattype">The chattype of the message</param> /// <param name="IsSaying">Is this object saying the message if false the message will drop the 'objname says' part</param> public static void BroadcastMsg(GameObject obj, string msg, int distance, eChatType chattype, bool IsSaying) { foreach (GamePlayer bPlayer in obj.GetPlayersInRadius((ushort)distance)) { if (IsSaying) { bPlayer.Out.SendMessage(obj.Name + " says \"" + msg + "\"", chattype, eChatLoc.CL_ChatWindow); } else { bPlayer.Out.SendMessage(msg, chattype, eChatLoc.CL_ChatWindow); } } return; }
/// <summary> /// Broadcasts a message to players within saydistance from this object /// </summary> /// <param name="obj">The object that says the message</param> /// <param name="msg">The message that the object says</param> /// <param name="IsSaying">Is this object saying the message if false the message will drop the 'objname says' part</param> public static void BroadcastMsg(GameObject obj, string msg, bool IsSaying) { foreach (GamePlayer bPlayer in obj.GetPlayersInRadius((ushort)WorldMgr.SAY_DISTANCE)) { if (IsSaying) { bPlayer.Out.SendMessage(obj.Name + " says \"" + msg + "\"", eChatType.CT_Broadcast, eChatLoc.CL_ChatWindow); } else { bPlayer.Out.SendMessage(msg, eChatType.CT_Broadcast, eChatLoc.CL_ChatWindow); } } return; }
public virtual IList SelectRealmTargets(GameObject castTarget) { ArrayList list = new ArrayList(); foreach (GamePlayer player in castTarget.GetPlayersInRadius((ushort)1000)) { if (player.Realm == m_caster.Realm && player != m_caster) { list.Add(player); } } list.Add(m_caster); return(list); }
public virtual void SendEffectAnimation(GameObject target, ushort clientEffect, ushort boltDuration, bool noSound, byte success) { if (target == null) target = m_caster; foreach (GamePlayer player in target.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { player.Out.SendSpellEffectAnimation(m_caster, target, clientEffect, boltDuration, noSound, success); } }