Exemple #1
0
        public void RaiseChatMessage(ChatChannelEnum Channel, string Content)
        {
            if (!this.Character.IsChatChannelEnable(Channel))
            {
                return;
            }
            if (this.myChatChannels.ContainsKey(Channel))
            {
                if (this.myChatChannels[Channel] != null && WorldServer.GetChatController().canSendMessage(this, Channel))
                {
                    if (ChatTiming.Exist(Channel))
                    {
                        this.myChatRestrictions[Channel] = Program.currentTimeMillis();
                    }
                    if (Content != String.Empty && Content[0] == '.' && this.myFight == null)
                    {
                        var parameters = new CommandParameters(Content.Substring(1), false);
                        var command    = JSKernel.CommandsPlayer.Get(parameters.Prefix);
                        if (command != null)
                        {
                            bool result = command.callAction(this, parameters);
                            if (!result)
                            {
                                Send(new ChatGameMessage("Commande invalide , tapez .help pour plus d'infos", "FF0000"));
                                return;
                            }
                            return;
                        }
                        else
                        {
                            Send(new ChatGameMessage("Commande invalide , tapez .help pour plus d'infos", "FF0000"));
                            return;
                        }

                        /*TeraScript Script = ScriptKernel.getScript(Content.Substring(1).Split(' ')[0].ToLower());
                         * if (Script != null)
                         * {
                         *  Script.apply(this.Character);
                         *  return;
                         * }
                         * else
                         * {
                         *  Send(new ChatGameMessage("Commande invalide , tapez .help pour plus d'infos", "FF0000"));
                         *  return;
                         * }*/
                    }
                }
            }
        }
Exemple #2
0
        public Boolean canSendMessage(WorldClient Client, ChatChannelEnum ChannelType)
        {
            ;
            switch (ChannelType)
            {
            case ChatChannelEnum.CHANNEL_ALIGNMENT:
                if (Client.Character.Deshonor >= 1)
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 83, getTimeEplased(Client, ChannelType).ToString()));
                    return(false);
                }
                if (Client.Character.Alignement == 0)
                {
                    Client.Send(new BasicNoOperationMessage());
                    return(false);
                }
                else if (getTimeLeft(Client, ChannelType) < ChatTiming.getTime(ChannelType))
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.INFO, 115, getTimeEplased(Client, ChannelType).ToString()));
                    return(false);
                }
                break;

            case ChatChannelEnum.CHANNEL_GENERAL:
                if (getTimeLeft(Client, ChannelType) < ChatTiming.getTime(ChannelType))
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.UNK, 184));
                    return(false);
                }
                break;

            case ChatChannelEnum.CHANNEL_GUILD:
                if (getTimeLeft(Client, ChannelType) < ChatTiming.getTime(ChannelType))
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.UNK, 184));
                    return(false);
                }
                break;

            case ChatChannelEnum.CHANNEL_GROUP:
                if (getTimeLeft(Client, ChannelType) < ChatTiming.getTime(ChannelType))
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.UNK, 184));
                    return(false);
                }
                break;

            case ChatChannelEnum.CHANNEL_RECRUITMENT:
                if (getTimeLeft(Client, ChannelType) < ChatTiming.getTime(ChannelType))
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.INFO, 115, getTimeEplased(Client, ChannelType).ToString()));
                    return(false);
                }
                break;

            case ChatChannelEnum.CHANNEL_DEALING:
                if (getTimeLeft(Client, ChannelType) < ChatTiming.getTime(ChannelType))
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.INFO, 115, getTimeEplased(Client, ChannelType).ToString()));
                    return(false);
                }
                break;

            case ChatChannelEnum.CHANNEL_PRIVATE_SEND:
                if (getTimeLeft(Client, ChannelType) < ChatTiming.getTime(ChannelType))
                {
                    Client.Send(new TextInformationMessage(TextInformationTypeEnum.UNK, 184));
                    return(false);
                }
                break;
            }
            return(true);
        }
Exemple #3
0
 public long getTimeEplased(WorldClient Client, ChatChannelEnum ChannelType)
 {
     return(Convert.ToInt32(Math.Ceiling((ChatTiming.getTime(ChannelType) - (Program.currentTimeMillis() - Client.myChatRestrictions[ChannelType])) / 1000d) + 1));
 }