Beispiel #1
0
        /// <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);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// sends a message to a living
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public void MessageToLiving(GameLiving living, string message, eChatType type)
 {
     if (living is GamePlayer && !string.IsNullOrEmpty(message))
     {
         living.MessageToSelf(message, type);
     }
 }
        /// <summary>
        /// Start the effect.
        /// </summary>
        /// <param name="target"></param>
        public override void Start(GameLiving target)
        {
            base.Start(target);

            GamePlayer petOwner = null;

            if (target is GameNPC && (target as GameNPC).Brain is IControlledBrain)
            {
                petOwner = ((target as GameNPC).Brain as IControlledBrain).Owner as GamePlayer;
            }

            foreach (GamePlayer player in target.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
            {
                if (player == null)
                {
                    continue;
                }

                player.Out.SendSpellEffectAnimation(target, target, 1073, 0, false, 1);

                eChatType chatType = (player != null && player == petOwner)
                                        ? eChatType.CT_Spell
                                        : eChatType.CT_System;

                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Effects.Necro.TauntEffect.SeemsChange", target.GetName(0, true)), chatType, eChatLoc.CL_SystemWindow);
            }
        }
Beispiel #4
0
 public void SendMessage(string msg, eChatType type, eChatLoc loc)
 {
     if (log.IsDebugEnabled)
     {
         log.Debug(string.Format("({0}, {1}): {2}", type, loc, msg));
     }
 }
Beispiel #5
0
 /// <summary>
 /// Send Raw Message to all group members.
 /// </summary>
 /// <param name="msg">message string</param>
 /// <param name="type">message type</param>
 /// <param name="loc">message location</param>
 public virtual void SendMessageToGroupMembers(string msg, eChatType type, eChatLoc loc)
 {
     foreach (GamePlayer player in GetPlayersInTheGroup())
     {
         player.Out.SendMessage(msg, type, loc);
     }
 }
        /// <summary>
        /// Stop the effect.
        /// </summary>
        public override void Stop()
        {
            base.Stop();

            GamePlayer petOwner = null;

            if (Owner is GameNPC && (Owner as GameNPC).Brain is IControlledBrain)
            {
                petOwner = ((Owner as GameNPC).Brain as IControlledBrain).Owner as GamePlayer;
            }

            foreach (GamePlayer player in Owner.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
            {
                if (player == null)
                {
                    continue;
                }

                eChatType chatType = (player == petOwner)
                                        ? eChatType.CT_SpellExpires
                                        : eChatType.CT_System;

                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Effects.Necro.TauntEffect.SeemsLessAgg", Owner.GetName(0, true)), chatType, eChatLoc.CL_SystemWindow);
            }
        }
Beispiel #7
0
        public override void SendMessage(string msg, eChatType type, eChatLoc loc)
        {
            if (m_gameClient.ClientState == GameClient.eClientState.CharScreen)
            {
                return;
            }

            GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Message));

            pak.WriteByte((byte)type);

            string str;

            if (loc == eChatLoc.CL_ChatWindow)
            {
                str = "@@";
            }
            else if (loc == eChatLoc.CL_PopupWindow)
            {
                str = "##";
            }
            else
            {
                str = "";
            }

            pak.WriteString(str + msg);
            SendTCP(pak);
        }
Beispiel #8
0
 public override void Read(ByteArray by)
 {
     base.Read(by);
     type = (eChatType)(by.ReadByte());
     receiver.Read(by);
     chat_content = by.ReadString();
 }
		public void SendMessage(string msg, eChatType type, eChatLoc loc)
		{
			if (log.IsDebugEnabled)
			{
				log.Debug(string.Format("({0}, {1}): {2}", type, loc, msg));
			}
		}
Beispiel #10
0
 /// <summary>
 /// sends a message to a living
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public void MessageToLiving(GameLiving living, string message, eChatType type)
 {
     if (living is GamePlayer && message != null && message.Length > 0)
     {
         living.MessageToSelf(message, type);
     }
 }
Beispiel #11
0
 public override void OnEffectStart(GameSpellEffect effect)
 {
     base.OnEffectStart(effect);
     eChatType toLiving = (Spell.Pulse == 0) ? eChatType.CT_Spell : eChatType.CT_SpellPulse;
     eChatType toOther = (Spell.Pulse == 0) ? eChatType.CT_System : eChatType.CT_SpellPulse;
     MessageToLiving(effect.Owner, Spell.Message1, toLiving);
     Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), toOther, effect.Owner);
 }
Beispiel #12
0
        /// <summary>
        /// Send a message to the shade.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="chatType"></param>
        private void MessageToOwner(String message, eChatType chatType)
        {
            GamePlayer owner = Owner as GamePlayer;

            if ((owner != null) && (message.Length > 0))
            {
                owner.Out.SendMessage(message, chatType, eChatLoc.CL_SystemWindow);
            }
        }
        public void AddChat(eChatType type, CharacterIdxName sender, string content)
        {
            ChatInfo info = new ChatInfo();

            info.type    = type;
            info.sender  = sender;
            info.content = content;
            m_chat_infoes.Add(info);
        }
Beispiel #14
0
 /// <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="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, eChatType chattype, bool IsSaying)
 {
     foreach (GamePlayer bPlayer in obj.GetPlayersInRadius((ushort)WorldMgr.SAY_DISTANCE))
     {
         if (IsSaying) { bPlayer.Out.SendMessage(obj.Name + " says \"" + msg + "\"", chattype, eChatLoc.CL_ChatWindow); }
         else { bPlayer.Out.SendMessage(msg, chattype, eChatLoc.CL_ChatWindow); }
     }
     return;
 }
 public virtual void SendMessageToBattleGroupMembers(string msg, eChatType type, eChatLoc loc)
 {
     lock (m_battlegroupMembers) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
     {
         foreach (GamePlayer player in m_battlegroupMembers.Keys)
         {
             player.Out.SendMessage(msg, type, loc);
         }
     }
 }
Beispiel #16
0
 /// <summary>
 /// Message the pet's owner, not the pet
 /// </summary>
 /// <param name="message"></param>
 /// <param name="chatType"></param>
 protected override void MessageToOwner(string message, eChatType chatType)
 {
     if (Caster is GameNPC npc)
     {
         if (npc.Brain is ControlledNpcBrain brain && brain.Owner is GamePlayer owner)
         {
             owner.Out.SendMessage(message, chatType, eChatLoc.CL_SystemWindow);
         }
     }
 }
Beispiel #17
0
 private static void a(eChatType A_0, string A_1, int A_2, params int[] A_3)
 {
     a5.a a = new a5.a {
         a = A_0.ToString(),
         b = A_2,
         c = A_3
     };
     a5.a[A_0] = a;
     ap.b(a.a, A_1);
 }
Beispiel #18
0
        public override void OnEffectStart(GameSpellEffect effect)
        {
            effect.Owner.TempProperties.setProperty(ConvertDamage, 100000);
            GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttack));

            eChatType toLiving = (Spell.Pulse == 0) ? eChatType.CT_Spell : eChatType.CT_SpellPulse;
            eChatType toOther  = (Spell.Pulse == 0) ? eChatType.CT_System : eChatType.CT_Spell;

            MessageToLiving(effect.Owner, Spell.Message1, toLiving);
            Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), toOther, effect.Owner);
        }
 /// <summary>
 /// 聊天
 /// </summary>
 public static void SendChat(eChatType type, long receiver, string content)
 {
     c2ss.ChatSend msg = PacketPools.Get(c2ss.msg.CHAT_SEND) as c2ss.ChatSend;
     msg.type         = type;
     msg.chat_content = content;
     if (type == eChatType.PRIVATE)
     {
         msg.receiver.SetIdx(receiver);
     }
     ClientNetManager.Instance.Send(msg);
 }
        /// <summary>
        /// Event handler fired when players enters the game
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        private static void PlayerEntered(DOLEvent e, object sender, EventArgs arguments)
        {
            if (ServerProperties.Properties.SHOW_LOGINS == false)
            {
                return;
            }

            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

            if (player.IsAnonymous)
            {
                return;
            }

            foreach (GameClient pclient in WorldMgr.GetAllPlayingClients())
            {
                if (player.Client == pclient)
                {
                    continue;
                }

                string message = LanguageMgr.GetTranslation(pclient, "Scripts.Events.PlayerEnterExit.Entered", player.Name);

                if (player.Client.Account.PrivLevel > 1)
                {
                    message = LanguageMgr.GetTranslation(pclient, "Scripts.Events.PlayerEnterExit.Staff", message);
                }
                else
                {
                    string realm = string.Empty;
                    if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_Normal)
                    {
                        realm = "[" + GlobalConstants.RealmToName(player.Realm) + "] ";
                    }

                    message = realm + message;
                }

                eChatType chatType = eChatType.CT_System;

                if (Enum.IsDefined(typeof(eChatType), ServerProperties.Properties.SHOW_LOGINS_CHANNEL))
                {
                    chatType = (eChatType)ServerProperties.Properties.SHOW_LOGINS_CHANNEL;
                }

                pclient.Out.SendMessage(message, chatType, eChatLoc.CL_SystemWindow);
            }
        }
Beispiel #21
0
        protected static int MakeSaySequence(RegionTimer callingTimer)
        {
            m_sayTimerQueue.Dequeue();
            GamePlayer player   = (GamePlayer)m_sayObjectQueue.Dequeue();
            String     message  = (String)m_sayMessageQueue.Dequeue();
            eChatType  chatType = (eChatType)m_sayChatTypeQueue.Dequeue();
            eChatLoc   chatLoc  = (eChatLoc)m_sayChatLocQueue.Dequeue();

            player.Out.SendMessage(message, chatType, chatLoc);

            return(0);
        }
Beispiel #22
0
        // This spell should be a buffer that absorbs 50% of the style damage
        // there is no cap to how much is absorbs, just simply the duration of the spell
        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);

            GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttack));

            eChatType toLiving = Spell.Pulse == 0 ? eChatType.CT_Spell : eChatType.CT_SpellPulse;
            eChatType toOther  = Spell.Pulse == 0 ? eChatType.CT_System : eChatType.CT_SpellPulse;

            MessageToLiving(effect.Owner, Spell.Message1, toLiving);
            Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), toOther, effect.Owner);
        }
Beispiel #23
0
        public static void MessageToAllStaff(string msg, eChatType chattype, eChatLoc chatloc)
        {
            if (msg == null)
            {
                return;
            }

            foreach (GamePlayer staffplayer in StaffList)
            {
                staffplayer.Out.SendMessage("[Appeals]: " + msg, chattype, chatloc);
            }
            return;
        }
Beispiel #24
0
 /// <summary>
 /// Message the pet's owner, not the pet
 /// </summary>
 /// <param name="message"></param>
 /// <param name="chatType"></param>
 protected override void MessageToOwner(String message, eChatType chatType)
 {
     GameNPC npc = Caster as GameNPC;
     if (npc != null)
     {
         ControlledNpcBrain brain = npc.Brain as ControlledNpcBrain;
         if (brain != null)
         {
             GamePlayer owner = brain.Owner as GamePlayer;
             if (owner != null)
                 owner.Out.SendMessage(message, chatType, eChatLoc.CL_SystemWindow);
         }
     }
 }
        /// <summary>
        /// 处理客户端发送的聊天信息
        /// </summary>
        public void HandleSendChat(Unit unit, eChatType type, CharacterIdxOrName receiver, string content)
        {
            switch (type)
            {
            case eChatType.PRIVATE:    //私聊
                Unit target = null;
                if (receiver.IsIdxValid())
                {
                    // 不能对自己发送
                    if (receiver.char_idx == unit.char_idx)
                    {
                        return;
                    }
                    target = UnitManager.Instance.GetUnitByIdx(receiver.char_idx);
                }
                else
                {
                    if (receiver.char_name == unit.char_name)
                    {
                        return;
                    }
                    target = UnitManager.Instance.GetUnitByName(receiver.char_name);
                }

                if (target != null)
                {    //直接发给对方
                    ss2c.ChatRecv msg = PacketPools.Get(ss2c.msg.CHAT_RECV) as ss2c.ChatRecv;
                    msg.type = type;
                    msg.sender.Set(unit.char_idx, unit.char_name);
                    msg.chat_content = content;
                    ServerNetManager.Instance.SendProxy(target.client_uid, msg);
                }
                else
                {    //告诉对方不在线
                    ss2c.ChatResult msg = PacketPools.Get(ss2c.msg.CHAT_RESULT) as ss2c.ChatResult;
                    msg.error = eChatError.ERROR_DST_OFFLINE;
                    ServerNetManager.Instance.SendProxy(unit.client_uid, msg);
                }

                break;

            case eChatType.GROUP:    //组队聊天

                break;

            case eChatType.GUILD:    //军团聊天

                break;
            }
        }
Beispiel #26
0
 /// <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);
         }
     }
 }
Beispiel #27
0
        public override void SendMessage(string msg, eChatType type, eChatLoc loc)
        {
            // if (m_gameClient.ClientState == GameClient.eClientState.CharScreen)
            // {
            //  return;
            // }

            GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Message));
            {
                pak.WriteByte((byte)type);
                pak.WriteString(AssembleWithPrefix(loc, msg));
                SendTCP(pak);
            }
        }
Beispiel #28
0
 /// <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;
 }
Beispiel #29
0
        /// <summary>
        /// Sends a message to all group members
        /// </summary>
        /// <param name="msg">message string</param>
        /// <param name="type">message type</param>
        /// <param name="loc">message location</param>
        public virtual void SendMessageToGroupMembers(GameLiving from, string msg, eChatType type, eChatLoc loc)
        {
            string message = msg;

            if (from != null)
            {
                message = "[Party] " + from.GetName(0, true) + ": \"" + message + "\"";
            }
            else
            {
                message = "[Party] " + message;
            }

            SendMessageToGroupMembers(message, type, loc);
        }
Beispiel #30
0
        /// <summary>
        /// When an applied effect starts
        /// duration spells only
        /// </summary>
        /// <param name="effect"></param>
        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);
            // "Your weapon is blessed by the gods!"
            // "{0}'s weapon glows with the power of the gods!"
            eChatType chatType = eChatType.CT_SpellPulse;

            if (Spell.Pulse == 0)
            {
                chatType = eChatType.CT_Spell;
            }
            MessageToLiving(effect.Owner, Spell.Message1, chatType);
            Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, true)), chatType, effect.Owner);
            GameEventMgr.AddHandler(effect.Owner, EventType, new DOLEventHandler(EventHandler));
        }
Beispiel #31
0
        /// <summary>
        /// Sends a message to all group members with an object from
        /// </summary>
        /// <param name="from">GameLiving source of the message</param>
        /// <param name="msg">message string</param>
        /// <param name="type">message type</param>
        /// <param name="loc">message location</param>
        public virtual void SendMessageToGroupMembers(GameLiving from, string msg, eChatType type, eChatLoc loc)
        {
            string message;

            if (from != null)
            {
                message = string.Format("[Party] {0}: \"{1}\"", from.GetName(0, true), msg);
            }
            else
            {
                message = string.Format("[Party] {0}", msg);
            }

            SendMessageToGroupMembers(message, type, loc);
        }
Beispiel #32
0
        /// <summary>
        /// 发消息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnBtnOK(object sender, EventArgs e)
        {
            int select_idx = m_comb_chat_type.SelectedIndex;

            if (select_idx >= 0 && m_txt_content.Text.Length > 0)
            {
                eChatType type     = (eChatType)(select_idx + 2);
                string    content  = m_txt_content.Text;
                long      receiver = 0;
                if (type == eChatType.PRIVATE)
                {
                    receiver = long.Parse(m_txt_recevier.Text);
                }
                ServerMsgSend.SendChat(type, receiver, content);
            }
        }
Beispiel #33
0
 public static void a(eChatType A_0, string A_1)
 {
     if (a != null)
     {
         string str = b + A_1;
         if (c)
         {
             Console.WriteLine(str);
             Debug.Print(str);
         }
         if (a.ContainsKey(A_0))
         {
             ap.b(a[A_0].a, str, a[A_0].b, a[A_0].c);
         }
     }
 }
Beispiel #34
0
 /// <summary>
 /// Send custom text message to system window
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public virtual void MessageToLiving(GameLiving living, string message, eChatType type)
 {
     MessageToLiving(living, message, type, eChatLoc.CL_SystemWindow);
 }
Beispiel #35
0
 /// <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;
     //bool excluded;
     foreach (GamePlayer player in centerObject.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
     {
         /*
         excluded = false;
         if (excludes != null)
         {
             foreach (GameObject obj in excludes)
                 if (obj == player)
                 {
                     excluded = true;
                     break;
                 }
         }
         if (!excluded)
         */
         if (!(centerObject is GamePlayer && centerObject == player))
             player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, LanguageMessageID, args), chatType, eChatLoc.CL_SystemWindow);
     }
 }
Beispiel #36
0
        /// <summary>
        /// Send a message to player.  You can use &lt;Player&gt;, &lt;Class&gt;, &lt;Race&gt;, &lt;Guild&gt;, &lt;RealmTitle&gt;, &lt;Title&gt; to have text replaced with actual player values. 
        /// </summary>
        /// <param name="player"></param>
        /// <param name="msg"></param>
        /// <param name="delay"></param>
        /// <param name="chatType"></param>
        /// <param name="chatLoc"></param>
		protected static void SendMessage(GamePlayer player, string msg, uint delay, eChatType chatType, eChatLoc chatLoc)
		{
            msg = BehaviourUtils.GetPersonalizedMessage(msg, player);

            if (delay == 0)
            {
                player.Out.SendMessage(msg, chatType, chatLoc);
            }
            else
            {
                m_sayMessageQueue.Enqueue(msg);
                m_sayObjectQueue.Enqueue(player);
                m_sayChatLocQueue.Enqueue(chatLoc);
                m_sayChatTypeQueue.Enqueue(chatType);
                m_sayTimerQueue.Enqueue(new RegionTimer(player, new RegionTimerCallback(MakeSaySequence), (int)delay * 100));
            }
		}
Beispiel #37
0
 /// <summary>
 /// sends a message to a living
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public void MessageToLiving(GameLiving living, string message, eChatType type)
 {
     if (message != null && message.Length > 0)
     {
         living.MessageToSelf(message, type);
     }
 }
Beispiel #38
0
		/// <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="message">The message to send</param>
		/// <param name="chatType">The type of message to send</param>
		/// <param name="excludes">An optional list of excluded players</param>
		public static void SystemToArea(GameObject centerObject, string message, eChatType chatType, params GameObject[] excludes)
		{
			SystemToArea(centerObject, message, chatType, WorldMgr.INFO_DISTANCE, excludes);
		}
Beispiel #39
0
		public static void MessageToAllStaff(string msg, eChatType chattype, eChatLoc chatloc)
		{
			if (msg == null) { return; }

			foreach (GamePlayer staffplayer in StaffList)
			{
				staffplayer.Out.SendMessage("[Appeals]: " + msg, chattype, chatloc);
			}
			return;
		}
Beispiel #40
0
		/// <summary>
		/// Sends a message to all group members with an object from
		/// </summary>
		/// <param name="from">GameLiving source of the message</param>
		/// <param name="msg">message string</param>
		/// <param name="type">message type</param>
		/// <param name="loc">message location</param>
		public virtual void SendMessageToGroupMembers(GameLiving from, string msg, eChatType type, eChatLoc loc)
		{
			string message;
			if (from != null)
			{
				message = string.Format("[Party] {0}: \"{1}\"", from.GetName(0, true), msg);
			}
			else
			{
				message = string.Format("[Party] {0}", msg);
			}

			SendMessageToGroupMembers(message, type, loc);
		}
		/// <summary>
		/// Sends a message to a living
		/// </summary>
		/// <param name="handler"></param>
		/// <param name="living"></param>
		/// <param name="type"></param>
		/// <param name="format"></param>
		/// <param name="args"></param>
		public static void MessageToLiving(this SpellHandler handler, GameLiving living, eChatType type, string format, params object[] args)
		{
			handler.MessageToLiving(living, string.Format(format, args), type);
		}
Beispiel #42
0
 /// <summary>
 /// Send message to owner.
 /// </summary>
 /// <param name="message"></param>
 /// <param name="chatType"></param>
 protected virtual void MessageToOwner(String message, eChatType chatType)
 {
     base.MessageToCaster(message, chatType);
 }
Beispiel #43
0
		/// <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);
				}
			}
		}
 protected static void SendMessage(GamePlayer player, String msg, uint delay, eChatType chatType, eChatLoc chatLoc)
 {
     if (delay == 0)
         player.Out.SendMessage(msg, chatType, chatLoc);
     else
     {
         m_sayMessageQueue.Enqueue(msg);
         m_sayObjectQueue.Enqueue(player);
         m_sayChatLocQueue.Enqueue(chatLoc);
         m_sayChatTypeQueue.Enqueue(chatType);
         m_sayTimerQueue.Enqueue(new RegionTimer(player, new RegionTimerCallback(MakeSaySequence), (int)delay * 100));
     }
 }
Beispiel #45
0
 /// <summary>
 /// Send custom text message to GameLiving
 /// </summary>
 /// <param name="living"></param>
 /// <param name="message"></param>
 /// <param name="type"></param>
 /// <param name="loc"></param>
 public virtual void MessageToLiving(GameLiving living, string message, eChatType type, eChatLoc loc)
 {
     if (living is GamePlayer)
         ((GamePlayer)living).Out.SendMessage(message, type, loc);
 }
		public virtual void SendMessage(string msg, eChatType type, eChatLoc loc)
		{
			if (m_gameClient.ClientState == GameClient.eClientState.CharScreen)
				return;

			// types not supported by 1.68+ clients
			switch (type)
			{
				case eChatType.CT_ScreenCenterSmaller:
				case eChatType.CT_ScreenCenter:
					return;
			}

			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Message)))
			{
				pak.WriteShort((ushort) m_gameClient.SessionID);
				pak.WriteShort(0x00);
				pak.WriteByte((byte) type);
				pak.Fill(0x0, 3);

				String str;
				if (loc == eChatLoc.CL_ChatWindow)
					str = "@@";
				else if (loc == eChatLoc.CL_PopupWindow)
					str = "##";
				else
					str = "";

				str = String.Concat(str, msg);
				pak.WriteString(str);
				SendTCP(pak);
			}
		}
		/// <summary>
		/// Sends a message to the caster, if the caster is a controlled
		/// creature, to the player instead (only spell hit and resisted
		/// messages).
		/// </summary>
		/// <param name="handler"></param>
		/// <param name="type"></param>
		/// <param name="format"></param>
		/// <param name="args"></param>
		public static void MessageToCaster(this SpellHandler handler, eChatType type, string format, params object[] args)
		{
			handler.MessageToCaster(string.Format(format, args), type);
		}
Beispiel #48
0
		public void SendMessage(string msg, eChatType type, eChatLoc loc)
		{
			if (SendMessageMethod != null) SendMessageMethod(this, msg, type, loc);
		}
Beispiel #49
0
 /// <summary>
 /// Sends a message to the caster, if the caster is a controlled
 /// creature, to the player instead (only spell hit and resisted
 /// messages).
 /// </summary>
 /// <param name="message"></param>
 /// <param name="type"></param>
 public void MessageToCaster(string message, eChatType type)
 {
     if (Caster is GamePlayer)
     {
         (Caster as GamePlayer).MessageToSelf(message, type);
     }
     else if (Caster is GameNPC && (Caster as GameNPC).Brain is IControlledBrain
              && (type == eChatType.CT_YouHit || type == eChatType.CT_SpellResisted))
     {
         GamePlayer owner = ((Caster as GameNPC).Brain as IControlledBrain).GetPlayerOwner();
         if (owner != null)
         {
             owner.MessageFromControlled(message, type);
         }
     }
 }
Beispiel #50
0
		/// <summary>
		/// Sends a message to the caster, if the caster is a controlled
		/// creature, to the player instead (only spell hit and resisted
		/// messages).
		/// </summary>
		/// <param name="message"></param>
		/// <param name="type"></param>
		public void MessageToCaster(string message, eChatType type)
		{
			if (Caster is GamePlayer)
			{
				(Caster as GamePlayer).Out.SendMessage(message, type, eChatLoc.CL_SystemWindow);
			}
			else if (Caster is GameNPC && (Caster as GameNPC).Brain is IControlledBrain
			         && (type == eChatType.CT_YouHit || type == eChatType.CT_SpellResisted))
			{
				GamePlayer owner = ((Caster as GameNPC).Brain as IControlledBrain).GetPlayerOwner();
				if (owner != null)
					owner.Out.SendMessage(message, type, eChatLoc.CL_SystemWindow);
			}
		}
Beispiel #51
0
		public virtual void SendMessageToGroupMembers(string msg, eChatType type, eChatLoc loc)
		{
			foreach (GamePlayer player in GetPlayersInTheGroup())
			{
				if(player==null) continue;
				player.Out.SendMessage(msg, type, loc);
			}
		}
Beispiel #52
0
		/// <summary>
		/// Send a message to the shade.
		/// </summary>
		/// <param name="message"></param>
		/// <param name="chatType"></param>
		private void MessageToOwner(String message, eChatType chatType)
		{
			GamePlayer owner = Owner as GamePlayer;
			if ((owner != null) && (message.Length > 0))
				owner.Out.SendMessage(message, chatType, eChatLoc.CL_SystemWindow);
		}
Beispiel #53
0
		/// <summary>
		/// sends a message to a living
		/// </summary>
		/// <param name="living"></param>
		/// <param name="message"></param>
		/// <param name="type"></param>
		public void MessageToLiving(GameLiving living, string message, eChatType type)
		{
			if (living is GamePlayer && message != null && message.Length > 0)
			{
				((GamePlayer)living).Out.SendMessage(message, type, eChatLoc.CL_SystemWindow);
			}
		}
Beispiel #54
0
		/// <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);
				}
			}
		}
Beispiel #55
0
		public override void SendMessage(string msg, eChatType type, eChatLoc loc)
		{
			if (m_gameClient.ClientState == GameClient.eClientState.CharScreen)
				return;

			using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Message)))
			{
				pak.WriteShort(0xFFFF);
				pak.WriteShort((ushort)m_gameClient.SessionID);
				pak.WriteByte((byte)type);
				pak.Fill(0x0, 3);

				string str;
				if (loc == eChatLoc.CL_ChatWindow)
					str = "@@";
				else if (loc == eChatLoc.CL_PopupWindow)
					str = "##";
				else
					str = "";

				pak.WriteString(str+msg);
				SendTCP(pak);
			}
		}
Beispiel #56
0
		/// <summary>
		/// Sends a message to the chat window of players inside
		/// a specific distance of the center object
		/// </summary>
		/// <param name="centerObject">The center object of the message</param>
		/// <param name="message">The message to send</param>
		/// <param name="chatType">The type of message to send</param>
		/// <param name="distance">The distance around the center where players will receive the message</param>
		/// <param name="excludes">An optional list of excluded players</param>
		/// <remarks>If the center object is a player, he will get the message too</remarks>
		public static void ChatToArea(GameObject centerObject, string message, eChatType chatType, ushort distance, params GameObject[] excludes)
		{
			MessageToArea(centerObject, message, chatType, eChatLoc.CL_ChatWindow, distance, excludes);
		}
Beispiel #57
0
 public virtual void SendMessageToBattleGroupMembers(string msg, eChatType type, eChatLoc loc)
 {
     lock (m_battlegroupMembers) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
     {
         foreach (GamePlayer player in m_battlegroupMembers.Keys)
         {
             player.Out.SendMessage(msg, type, loc);
         }
     }
 }
Beispiel #58
0
		/// <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="message">The message to send</param>
		/// <param name="chatType">The type of message to send</param>
		/// <remarks>If the centerObject is a player, he won't receive the message</remarks>
		public static void SystemToOthers(GameObject centerObject, string message, eChatType chatType)
		{
			SystemToArea(centerObject, message, chatType, WorldMgr.INFO_DISTANCE, centerObject);
		}
Beispiel #59
0
		/// <summary>
		/// Sends a message to all group members 
		/// </summary>
		/// <param name="msg">message string</param>
		/// <param name="type">message type</param>
		/// <param name="loc">message location</param>
		public virtual void SendMessageToGroupMembers(GameLiving from, string msg, eChatType type, eChatLoc loc)
		{
			string message = msg;
			if (from != null)
			{
				message = "[Party] " + from.GetName(0, true) + ": \"" + message + "\"";
			}
			else
			{
				message = "[Party] " + message;
			}

			SendMessageToGroupMembers(message, type, loc);
		}