示例#1
0
    //--行为--//

    /** 创建玩家群 */
    public void createRoleGroup(CreateRoleGroupData data)
    {
        if (isRoleGroupFull())
        {
            me.warnLog("创建玩家群时,已达到数目限制");
            return;
        }

        if (_config.createCostID > 0 && !me.bag.hasCost(_config.createCostID))
        {
            me.warnLog("创建玩家群时,cost不满足");
            return;
        }

        if (!me.role.checkRoleConditions(_config.createConditions, true))
        {
            me.warnLog("创建玩家群时,condition不满足");
            return;
        }

        if (_config.nameCharLimit > 0 && StringUtils.getCharMachineNum(data.name) > _config.nameCharLimit)
        {
            me.warnLog("创建玩家群时,名字过长");
            return;
        }

        if (_config.noticeCharLimit > 0 && StringUtils.getCharMachineNum(data.notice) > _config.noticeCharLimit)
        {
            me.warnLog("创建玩家群时,公告过长");
            return;
        }

        //敏感字
        if (BaseGameUtils.hasSensitiveWord(data.name))
        {
            Ctrl.warnLog("创建玩家群时,名字敏感");
            GameC.info.showInfoCode(InfoCodeType.CreateRoleGroupFailed_nameIsSensitive);
            return;
        }

        //敏感字
        if (BaseGameUtils.hasSensitiveWord(data.notice))
        {
            Ctrl.warnLog("创建玩家群时,公告敏感");
            GameC.info.showInfoCode(InfoCodeType.CreateRoleGroupFailed_noticeIsSensitive);
            return;
        }

        if (!canCreateRoleGroupEx())
        {
            me.warnLog("创建玩家群时,ex不满足");
            return;
        }

        //发送
        me.send(FuncCreateRoleGroupRequest.create(_funcID, data));
    }
示例#2
0
    /// <summary>
    /// 发送聊天
    /// </summary>
    public void chat(ChatData data, int channel, long key)
    {
        ChatChannelConfig config = ChatChannelConfig.get(channel);

        //条件不满足
        if (!me.role.checkRoleConditions(config.useConditions, true))
        {
            me.warnLog("聊天条件不满足", channel);
            return;
        }

        ChatChannelData cData = getChatChannelData(channel, key);

        long now = me.getTimeMillis();

        if (config.cd > 0 && (cData.lastChatTime + config.cd > now))
        {
            me.warnLog("聊天cd中", channel);
            return;
        }

        if (config.costID > 0 && !me.bag.hasCost(config.costID))
        {
            me.warnLog("聊天cost不足", channel);
            return;
        }

        //文字
        if (data.type == ChatType.Text && BaseGameUtils.hasSensitiveWord(data.text))
        {
            me.warnLog("聊天有屏蔽字内容", data.text);
            return;
        }

        if (config.cd > 0)
        {
            cData.lastChatTime = now;
        }

        //需要自行添加的
        if (channel == ChatChannelType.Whisper)
        {
            RoleChatData rData = new RoleChatData();
            rData.chatData  = data;
            rData.showData  = me.role.createRoleSimpleShowData();
            rData.time      = me.getTimeMillis();
            rData.sendIndex = _chatReceiveIndex;          //当前序号
            onReceiveChat(rData, channel, key);
        }

        me.send(PlayerChatRequest.create(data, channel, key));
    }
示例#3
0
    /** 改公告 */
    public void changeNotice(String notice)
    {
        if (!RoleGroupTitleConfig.get(_selfData.title).canChangeNotice)
        {
            me.warnLog("修改群公告时,权限不够");
            return;
        }

        if (_config.noticeCharLimit > 0 && StringUtils.getCharMachineNum(notice) > _config.noticeCharLimit)
        {
            me.warnLog("修改群公告时,名字过长");
            return;
        }

        //敏感字
        if (BaseGameUtils.hasSensitiveWord(notice))
        {
            Ctrl.warnLog("修改群公告时,名字敏感");
            GameC.info.showInfoCode(InfoCodeType.CreateRoleGroupFailed_nameIsSensitive);
            return;
        }

        me.send(FuncChangeRoleGroupNoticeRequest.create(_funcID, groupID, notice));
    }