Example #1
0
 public void SendPrivateMessage(Player speaker, SpeakTypes type, string text)
 {
     if (Connection != null)
     {
         Connection.SendPrivateMessage(speaker, type, text);
     }
 }
Example #2
0
        public override bool OnSpeak(Player player, ref SpeakTypes type, string message)
        {
            AccountTypes playerAccountType = player.AccountType;

            if (type == SpeakTypes.ChannelY)
            {
                if (playerAccountType >= AccountTypes.SeniorTutor)
                {
                    type = SpeakTypes.ChannelO;
                }
            }
            else if (type == SpeakTypes.ChannelO)
            {
                if (playerAccountType < AccountTypes.SeniorTutor)
                {
                    type = SpeakTypes.ChannelY;
                }
            }
            else if (type == SpeakTypes.ChannelR1)
            {
                if (playerAccountType < AccountTypes.GameMaster && !player.HasFlag(PlayerFlags.CanTalkRedChannel))
                {
                    type = SpeakTypes.ChannelY;
                }
            }
            return(true);
        }
Example #3
0
 public void SendChannelMessage(string author, string text, SpeakTypes type, ushort channel)
 {
     if (Connection != null)
     {
         Connection.SendChannelMessage(author, text, type, channel);
     }
 }
Example #4
0
 public void SendToChannel(Creature creature, SpeakTypes type, string text, ushort channelId)
 {
     if (Connection != null)
     {
         Connection.SendToChannel(creature, type, text, channelId);
     }
 }
Example #5
0
        public override bool OnSpeak(Player player, ref SpeakTypes type, string message)
        {
            AccountTypes playerAccountType = player.AccountType;

            if (player.CharacterData.Level == 1 && playerAccountType < AccountTypes.GameMaster)
            {
                player.SendCancelMessage("You may not speak into channels as long as you are on level 1.");
                return(false);
            }

            if (type == SpeakTypes.ChannelY)
            {
                if (playerAccountType >= AccountTypes.GameMaster)
                {
                    type = SpeakTypes.ChannelO;
                }
            }
            else if (type == SpeakTypes.ChannelO)
            {
                if (playerAccountType < AccountTypes.GameMaster)
                {
                    type = SpeakTypes.ChannelY;
                }
            }
            else if (type == SpeakTypes.ChannelR1)
            {
                if (playerAccountType < AccountTypes.GameMaster && !player.HasFlag(PlayerFlags.CanTalkRedChannel))
                {
                    type = SpeakTypes.ChannelY;
                }
            }
            return(true);
        }
Example #6
0
 public void SendCreatureSay(Creature creature, SpeakTypes type, string text, Position pos = null)
 {
     if (Connection != null)
     {
         Connection.SendCreatureSay(creature, type, text, pos);
     }
 }
Example #7
0
 public void SendToAll(string message, SpeakTypes type)
 {
     foreach (Player user in Users.Values)
     {
         user.SendChannelMessage(string.Empty, message, type, Id);
     }
 }
Example #8
0
        public static bool TalkToChannel(Player player, SpeakTypes type, string text, ushort channelId)
        {
            ChatChannel channel = GetChannel(player, channelId);

            if (channel == null)
            {
                return(false);
            }

            if (channelId == Constants.ChatChannelGuild)
            {
                //if (player.getGuildLevel() > 1) { //TODO: GUILD
                //    type = TALKTYPE_CHANNEL_O;
                //} else if (type != TALKTYPE_CHANNEL_Y) {
                //    type = TALKTYPE_CHANNEL_Y;
                //}
            }
            else if (type != SpeakTypes.ChannelY && (channelId == Constants.ChatChannelPrivate || channelId == Constants.ChatChannelParty))
            {
                type = SpeakTypes.ChannelY;
            }

            if (!channel.OnSpeak(player, ref type, text))
            {
                return(false);
            }

            return(channel.Talk(player, type, text));
        }
Example #9
0
        public static bool SendChannelMessage(ushort channelId, SpeakTypes type, string message)
        {
            ChatChannel channel = GetChannelById(channelId);

            if (channel == null)
            {
                return(false);
            }

            channel.SendToAll(message, type);
            return(true);
        }
Example #10
0
        public bool Talk(Player fromPlayer, SpeakTypes type, string message)
        {
            if (!Users.ContainsKey(fromPlayer.Id))
            {
                return(false);
            }

            foreach (Player user in Users.Values)
            {
                user.SendToChannel(fromPlayer, type, message, Id);
            }
            return(true);
        }
Example #11
0
        public override bool OnSpeak(Player player, ref SpeakTypes type, string message)
        {
            AccountTypes playerAccountType = player.AccountType;

            if (playerAccountType >= AccountTypes.GameMaster)
            {
                if (type == SpeakTypes.ChannelY)
                {
                    type = SpeakTypes.ChannelO;
                }
                return(true);
            }

            if (player.GetCondition(ConditionFlags.ChannelMutedTicks, ConditionIds.Default, Id) != null)
            {
                player.SendCancelMessage("You may only place one offer in two minutes.");
                return(false);
            }
            player.AddCondition(Condition.CreateCondition(ConditionIds.Default, ConditionFlags.ChannelMutedTicks, 120000, 0, false, Id));

            if (type == SpeakTypes.ChannelO)
            {
                if (playerAccountType < AccountTypes.GameMaster)
                {
                    type = SpeakTypes.ChannelY;
                }
            }
            else if (type == SpeakTypes.ChannelR1)
            {
                if (playerAccountType < AccountTypes.GameMaster && !player.HasFlag(PlayerFlags.CanTalkRedChannel))
                {
                    type = SpeakTypes.ChannelY;
                }
            }
            return(true);
        }
Example #12
0
 public virtual bool OnSpeak(Player player, ref SpeakTypes type, string message)
 {
     return(true);
 }
Example #13
0
        public override bool OnSpeak(Player player, ref SpeakTypes type, string message)
        {
            AccountTypes playerAccountType = player.AccountType;

            if (player.CharacterData.Level == 1 && playerAccountType == AccountTypes.Normal)
            {
                player.SendCancelMessage("You may not speak into channels as long as you are on level 1.");
                return(false);
            }

            if (player.GetCondition(ConditionFlags.ChannelMutedTicks, ConditionIds.Default, Id) != null)
            {
                player.SendCancelMessage("You are muted from the Help channel for using it inappropriately.");
                return(false);
            }

            if (playerAccountType >= AccountTypes.Tutor)
            {
                if (message.StartsWith("!mute "))
                {
                    string targetName = message.Substring(6);
                    Player target     = Game.GetPlayerByName(targetName);

                    if (target != null)
                    {
                        if (playerAccountType > target.AccountType)
                        {
                            if (target.GetCondition(ConditionFlags.ChannelMutedTicks, ConditionIds.Default, Id) != null)
                            {
                                target.AddCondition(Condition.CreateCondition(ConditionIds.Default, ConditionFlags.ChannelMutedTicks, 3600000, 0, false, Id));
                                Chat.SendChannelMessage(Id, SpeakTypes.ChannelR1, string.Format("{0} has been muted by {1} for using Help Channel inappropriately.", target.CharacterName, player.CharacterName));
                            }
                            else
                            {
                                player.SendCancelMessage("That player is already muted.");
                            }
                        }
                        else
                        {
                            player.SendCancelMessage("You are not authorized to mute that player.");
                        }
                    }
                    else
                    {
                        player.SendCancelMessage(ReturnTypes.PlayerWithThisNameIsNotOnline);
                    }
                    return(false);
                }
                else if (message.StartsWith("!unmute "))
                {
                    string targetName = message.Substring(8);
                    Player target     = Game.GetPlayerByName(targetName);

                    if (target != null)
                    {
                        if (playerAccountType > target.AccountType)
                        {
                            Condition condition = target.GetCondition(ConditionFlags.ChannelMutedTicks, ConditionIds.Default, Id);
                            if (condition != null)
                            {
                                target.RemoveCondition(condition);
                                Chat.SendChannelMessage(Id, SpeakTypes.ChannelR1, string.Format("{0} has been unmuted by {1}.", target.CharacterName, player.CharacterName));
                            }
                            else
                            {
                                player.SendCancelMessage("That player is not muted.");
                            }
                        }
                        else
                        {
                            player.SendCancelMessage("You are not authorized to unmute that player.");
                        }
                    }
                    else
                    {
                        player.SendCancelMessage(ReturnTypes.PlayerWithThisNameIsNotOnline);
                    }
                    return(false);
                }
            }

            if (type == SpeakTypes.ChannelY)
            {
                if (playerAccountType >= AccountTypes.GameMaster)
                {
                    type = SpeakTypes.ChannelO;
                }
            }
            else if (type == SpeakTypes.ChannelO)
            {
                if (playerAccountType < AccountTypes.GameMaster)
                {
                    type = SpeakTypes.ChannelY;
                }
            }
            else if (type == SpeakTypes.ChannelR1)
            {
                if (playerAccountType < AccountTypes.GameMaster && !player.HasFlag(PlayerFlags.CanTalkRedChannel))
                {
                    if (playerAccountType >= AccountTypes.Tutor || player.HasFlag(PlayerFlags.TalkOrangeHelpChannel))
                    {
                        type = SpeakTypes.ChannelO;
                    }
                    else
                    {
                        type = SpeakTypes.ChannelY;
                    }
                }
            }
            return(true);
        }