%%%--------------------------------------
|
|
%%% @Author : calvin
|
|
%%% @Email : calvinzhong888@gmail.com
|
|
%%% @Created : 2012.5.9
|
|
%%% @Description: 聊天
|
|
%%%--------------------------------------
|
|
|
|
%% 11017协议
|
|
%% 目前暂时只有队伍频道
|
|
-define(FLOAT_TEXT_ONLY, 1). %% 只飘字
|
|
-define(CHAT_WINDOW_ONLY, 2). %% 只聊天框
|
|
-define(FLOAT_AND_CHAT, 3). %% 飘字加聊天框
|
|
|
|
%% ----------------------------------------------------
|
|
%% 举报/禁言
|
|
%% ----------------------------------------------------
|
|
|
|
%% 禁言类型
|
|
-define(TALK_LIMIT_TYPE_1, 1). %% gm或指导员禁言
|
|
-define(TALK_LIMIT_TYPE_2, 2). %% 违反规则自动禁言A
|
|
-define(TALK_LIMIT_TYPE_3, 3). %% 违反规则自动禁言B
|
|
-define(TALK_LIMIT_TYPE_4, 4). %% 被举报次数过多禁言
|
|
-define(TALK_LIMIT_TYPE_6, 6). %% 被霸主禁言跨服聊天
|
|
|
|
%% 释放类型
|
|
-define(TALK_RELEASE_TYPE_1, 1). %% gm或管理员手动解禁
|
|
-define(TALK_RELEASE_TYPE_2, 2). %% 自动解禁
|
|
|
|
-define(HORN_TALK_LV, 30). %% 发喇叭级别
|
|
-define(TALK_LIMIT_TIME, 180). %% 禁言时
|
|
-define(TALK_LIMIT_TIME_0, 300). %% 禁言5分钟
|
|
-define(TALK_LIMIT_TIME_1, 600). %% 禁言10分钟
|
|
-define(TALK_LIMIT_TIME_2, 1800). %% 禁言30分钟
|
|
-define(TALK_LIMIT_TIME_3, 3600). %% 禁言1个小时
|
|
-define(TALK_LIMIT_TIME_4, 7200). %% 禁言2小时
|
|
-define(TALK_LIMIT_TIME_5, 21600). %% 禁言6小时
|
|
-define(TALK_LIMIT_TIME_6, 86400). %% 禁言24小时
|
|
-define(TALK_LIMIT_TIME_7, (86400*3)). %% 禁言3天
|
|
-define(TALK_LIMIT_TIME_8, (86400*7)). %% 禁言一周
|
|
-define(TALK_LIMIT_TIME_9, (3*366*86400)). %% 禁言三年
|
|
-define(ALLOW_INFORM_NUM, 10). %% 最多被举报次数
|
|
-define(ALLOW_CHAT_NUM_1, 20). %% 40级下,每天最多私聊玩家数
|
|
-define(ALLOW_CHAT_NUM_2, 30). %% 40级下,给非好友最多私聊次数
|
|
-define(CHAT_RULE_5_REJECT, [[43], [43,229,165,189,229,143,139]]). %% 聊天规则5,排除字符["+","+加好友"]
|
|
|
|
-define(SQL_UPDATE_TALK_LIM, <<"update player_login set talk_lim=~p, talk_lim_type=~p, talk_lim_time=~p where id=~p">>).
|
|
-define(SQL_UPDATE_LIM_RIGHT, <<"update player_login set talk_lim_right=~p where id=~p">>).
|
|
-define(SQL_SELECT_TALK_LIM, <<"select talk_lim, talk_lim_time, talk_lim_right from player_login where id =~p">>).
|
|
|
|
%% 存储被举报的信息
|
|
-define(SQL_TALK_REPORT,<<"insert into `talk_report`(from_id, to_id, `msg`, `time`) values(~p, ~p, '~ts', UNIX_TIMESTAMP() )">>).
|
|
|
|
-record(talk_accept, {
|
|
all_accept = 1, %% 世界消息的接受。1:接受|0:拒绝
|
|
all_tv_accept = 1 %% 世界传闻消息的接受。1:接受|0:拒绝
|
|
}).
|
|
|
|
%% ----------------------------------------------------
|
|
%% 聊天
|
|
%% ----------------------------------------------------
|
|
%% 聊天类型
|
|
-define(CHAT_CHANNEL_WORLD, 1). %% 世界频道
|
|
-define(CHAT_CHANNEL_HORN, 2). %% 喇叭
|
|
-define(CHAT_CHANNEL_NEARBY, 3). %% 区域频道
|
|
-define(CHAT_CHANNEL_GUILD, 4). %% 公会频道
|
|
-define(CHAT_CHANNEL_TEAM, 5). %% 队伍频道
|
|
-define(CHAT_CHANNEL_PRIVATE, 6). %% 私聊频道
|
|
-define(CHAT_CHANNEL_RELA, 7). %% 好友频道(给所有好友发送)
|
|
-define(CHAT_CHANNEL_RECRUIT, 8). %% 招募频道
|
|
-define(CHAT_CHANNEL_INFORM, 9). %% 举报频道
|
|
-define(CHAT_CHANNEL_SYS, 10). %% 系统频道
|
|
-define(CHAT_CHANNEL_WAIT_TEAM,11). %% 组队(招募)频道
|
|
-define(CHAT_CHANNEL_SCENE, 12). %% 场景聊天(只针对活动场景的聊天)
|
|
-define(CHAT_CHANNEL_WORLD_KF, 13). %% 跨服世界频道
|
|
-define(CHAT_CHANNEL_REPLY, 14). %% 答题频道
|
|
-define(CHAT_CHANNEL_3V3_TEAM, 15). %% 跨服3v3队伍
|
|
-define(CHAT_CHANNEL_1VN_BET, 16). %% 跨服1vN押注
|
|
-define(CHAT_CHANNEL_BEACH, 17). %% 温泉频道
|
|
-define(CHAT_CHANNEL_WEDDING, 18). %% 婚礼弹幕
|
|
-define(CHAT_CHANNEL_GLAMOUR, 19). %% 跑马弹幕
|
|
-define(CHAT_CHANNEL_GUARD_RECRUIT, 20). %% 三人守塔招募频道
|
|
-define(CHAT_CHANNEL_COUNTRY, 21). %% 本国频道
|
|
|
|
|
|
%% 聊天类型开放列表
|
|
-define(CHAT_CHANNEL_OPEN_LIST, [
|
|
?CHAT_CHANNEL_WORLD,
|
|
?CHAT_CHANNEL_NEARBY,
|
|
?CHAT_CHANNEL_GUILD,
|
|
?CHAT_CHANNEL_TEAM,
|
|
?CHAT_CHANNEL_PRIVATE,
|
|
?CHAT_CHANNEL_RELA,
|
|
?CHAT_CHANNEL_WAIT_TEAM,
|
|
?CHAT_CHANNEL_SCENE,
|
|
?CHAT_CHANNEL_WORLD_KF,
|
|
?CHAT_CHANNEL_REPLY,
|
|
?CHAT_CHANNEL_3V3_TEAM,
|
|
?CHAT_CHANNEL_1VN_BET,
|
|
?CHAT_CHANNEL_BEACH,
|
|
?CHAT_CHANNEL_WEDDING,
|
|
?CHAT_CHANNEL_GLAMOUR,
|
|
?CHAT_CHANNEL_GUARD_RECRUIT,
|
|
?CHAT_CHANNEL_COUNTRY
|
|
]).
|
|
|
|
%% 聊天内容
|
|
-define(CHAT_CONTENT_TEXT, 1). %% 文字聊天
|
|
-define(CHAT_CONTENT_PICTURE, 2). %% 图片聊天
|
|
-define(CHAT_CONTENT_VOICE, 3). %% 声音聊天
|
|
|
|
%% 聊天时间
|
|
-define(CHAT_GAP_WORLD, 5). %% 世界频道发言间隔
|
|
-define(CHAT_GAP_NEARBY, 5). %% 附近频道发言间隔
|
|
-define(CHAT_GAP_GUILD, 3). %% 社团(公会)频道发言间隔
|
|
-define(CHAT_GAP_TEAM, 3). %% 队伍频道发言间隔
|
|
-define(CHAT_GAP_PRIVATE, 3). %% 私聊频道发言间隔
|
|
-define(CHAT_GAP_RELA, 3). %% 好友频道发言间隔
|
|
-define(CHAT_GAP_INFORM, 3). %% 举报间隔
|
|
-define(CHAT_GAP_WAIT_TEAM, 10). %% 组队邀请时间间隔
|
|
-define(CHAT_GAP_SCENE, 5). %% 场景聊天时间间隔
|
|
-define(CHAT_GAP_WORLD_KF, 3). %% 跨服世界频道聊天时间间隔
|
|
-define(CHAT_GAP_HORN, 3). %% 喇叭发言间隔(本项目不使用)
|
|
-define(CHAT_GAP_CAREER, 3). %% 职业/门派发言间隔(本项目不使用)
|
|
-define(CHAT_GAP_REPLY, 0). %% 答题频道间隔(本项目不使用)
|
|
-define(CHAT_GAP_DEFAULT, 3). %% 默认发言间隔
|
|
-define(CHAT_GAP_GUARD, 10). %% 守卫信标招募间隔
|
|
|
|
%% 聊天等级
|
|
-define(CHAT_LV_WORLD, 60). %% 世界频道发言等级
|
|
-define(CHAT_LV_NEARBY, 70). %% 附近频道
|
|
-define(CHAT_LV_GUILD, 60). %% 社团(公会)
|
|
-define(CHAT_LV_TEAM, 70). %% 队伍频道
|
|
-define(CHAT_LV_PRIVATE, 60). %% 私聊频道
|
|
-define(CHAT_LV_RELA, 60). %% 好友频道
|
|
-define(CHAT_LV_SCENE, 60). %% 场景聊天频道
|
|
-define(CHAT_LV_WORLD_KF,180). %% 跨服世界频道 %% 350
|
|
-define(CHAT_LV_WEDDING, 75). %% 婚礼弹幕等级
|
|
-define(CHAT_LV_HORN, 110). %% 喇叭(本项目不使用)
|
|
-define(CHAT_LV_CAREER, 60). %% 职业/门派频道(本项目不使用)
|
|
-define(CHAT_LV_DEFAULT, 60). %% 默认发言等级
|
|
|
|
|
|
%% 聊天长度
|
|
-define(CHAT_LEN_DEFAULT, 250). %% 默认长度(服务器放宽,1汉字=2单位长度,1数字字母=1单位长度)
|
|
|
|
%% 聊天道具
|
|
-define(CHAT_GOODS_HORN, 38050001). %% 喇叭道具
|
|
-define(CHAT_GOODS_WORLD_KF, 38050002). %% 跨服频道道具
|
|
|
|
%% 聊天内容相同
|
|
-define(CHAT_CONTENT_SAME_NO, 0). %% 不相同
|
|
-define(CHAT_CONTENT_SAME_YES, 1). %% 相同
|
|
|
|
%% 参数结果类型
|
|
-define(CHAT_ARGS_RESULT_NO, 0). %% 没有参数
|
|
-define(CHAT_ARGS_RESULT_PASS, 1). %% 有参数校验正常
|
|
-define(CHAT_ARGS_RESULT_NO_PASS, 2). %% 有参数校验失败
|
|
|
|
%% 其他
|
|
-define(CHAT_HORN_SHOW_TIME, 5). %% 喇叭展示时间
|
|
|
|
|
|
%% 聊天
|
|
-record(status_chat, {
|
|
prev_record_time = [], %% 上次记录内容的时间[{Channel,Time}]
|
|
record_content = [] %% 记录的聊天内容
|
|
}).
|
|
|
|
%% 聊天喇叭
|
|
-record(bugle_state, {
|
|
bugle_queue = queue:new(), %% 玩家喇叭队列
|
|
gm_bugle_queue = queue:new(), %% gm喇叭队列(优先)
|
|
ref = none %% 定时器
|
|
}).
|
|
|
|
%% 喇叭
|
|
-record(bugle, {
|
|
role_id = 0, %% 玩家id
|
|
bugle_id = 0, %% 喇叭id
|
|
show_time = 0, %% 展示时间
|
|
msg = [] %% 消息列表
|
|
}).
|
|
|
|
%% 喇叭配置
|
|
-record(bugle_cfg, {
|
|
id = 0,
|
|
first_cost = [],
|
|
second_cost = [],
|
|
show_time = 0,
|
|
conditions = []
|
|
}).
|
|
|
|
%% 聊天缓存
|
|
-record(cache_state, {
|
|
priv_cache_map = #{} %% 私聊离线缓存 在线的私聊不做缓存 客户端自己存cookie #{ReceiverId => #priv_cache{}}
|
|
}).
|
|
|
|
-record(priv_cache, {
|
|
len = 0,
|
|
msg = []
|
|
}).
|
|
|
|
%% 私聊信息
|
|
-record(msg_record, {
|
|
channel = 0
|
|
, sender_id = 0
|
|
, sender_figure = undefined
|
|
, sender_server_id = 0
|
|
, sender_server_num = 0
|
|
, sender_server_name = <<>>
|
|
, receive_id = 0
|
|
, receive_figure = undefined
|
|
, msg_send = ""
|
|
, args = []
|
|
, args_result = 0
|
|
, utime = 0
|
|
, client_ver = 0
|
|
, client_auto_id = 0
|
|
, voice_msg_time = 0
|
|
}).
|
|
|
|
%% 语音
|
|
-record(voice_state, {
|
|
voice_dict = dict:new(),
|
|
picture_dict = dict:new()
|
|
}).
|
|
|
|
%% 私聊对象基本信息(聊天监控用)
|
|
-record(chat_to, {
|
|
id = 0
|
|
,name = <<>>
|
|
,accname = <<>>
|
|
,level = 0
|
|
,vip_level = 0
|
|
,power = 0
|
|
,career = 0
|
|
}).
|
|
|
|
%% ----------------------------------------------------
|
|
%% 小红点
|
|
%% ----------------------------------------------------
|
|
%% 公会
|
|
-define(RED_POINT_GUILD_APPLY, 1). % 公会申请
|
|
-define(RED_POINT_GUILD_UPGRADE, 2). % 公会升级
|
|
-define(RED_POINT_RECEIVE_FLOWER_GIFT, 1). % 收到新的鲜花礼物
|
|
-define(RED_POINT_SALARY_STATE, 3). % 公会工资
|
|
|
|
%% 图鉴
|
|
-define(RED_POINT_PIC_CHAPTER, 1). % 图鉴章节激活
|
|
-define(RED_POINT_PIC_TYPE_TWO, 2). % 图鉴2类型
|
|
-define(RED_POINT_PIC_TYPE_THREE, 3). % 图鉴3类型
|
|
|
|
%% ----------------------------------------------------
|
|
%% 其他
|
|
%% ----------------------------------------------------
|
|
%% 公告Ets
|
|
-define(ETS_SYS_NOTICE, ets_sys_notice).
|
|
|
|
|
|
%% ----------------------------------------------------
|
|
%% 聊天次数监控
|
|
%% ----------------------------------------------------
|
|
-define(SQL_CHAT_LIMIT_GET,
|
|
<<"select chat_count, chat_limit, role_shield from role_chat_limit where role_id = ~p">>).
|
|
-define(SQL_CHAT_LIMIT_UPDATE,
|
|
<<"replace into role_chat_limit set role_id = ~p, chat_count = ~p, chat_limit = '~ts', role_shield = '~ts'">>).
|
|
-define(SQL_CHAT_ROLE_SHIELD_UPDATE,
|
|
<<"update role_chat_limit set role_shield = '~ts' where role_id = ~p">>).
|
|
|
|
%% 世界频道发言,聊天字符长度限制
|
|
-define(DIFF_LV, 150). %%
|
|
-define(DIFF_POWER, 60000). %%
|
|
-define(DIFF_STRING, 50). %%
|
|
-define(DIFF_VIP, 1).
|
|
|
|
%% 敏感词等级战力检测
|
|
-define(SEN_LV, 250).
|
|
-define(SEN_VIP, 4).
|
|
-define(SEN_POWER, 1000000).
|
|
|
|
%% 私人聊天双方等级差
|
|
-define(PRI_LV, 50).
|
|
-define(PRI_POWER, 2000000).
|
|
|
|
-record(role_chat_limit, {
|
|
role_id = 0,
|
|
chat_count = 0, %% 聊天次数特定等级下检测
|
|
chat_limit = [], %% 特殊操作监控
|
|
role_shield = undefined %% 玩家屏蔽列表
|
|
}).
|
|
|
|
|
|
%% 离线聊天时的亲密度限制
|
|
-define(INTIMACY_LIMIT, 100).
|
|
|
|
%% 屏蔽&取消
|
|
-define(CHAT_SHEILD, 1).
|
|
-define(CHAT_UNSHEILD, 2).
|
|
|
|
%% 黑名单人数限制(本服+其他服)
|
|
-define(SHEILD_NUM, 20).
|
|
|
|
%%
|
|
-record(role_shield, {
|
|
shield_roles = [], %% 玩家屏蔽列表
|
|
role_figure = [] %% 玩家头像等信息
|
|
}).
|
|
|
|
%% ----------------------------------------------------
|
|
%% 聊天机器人
|
|
%% ----------------------------------------------------
|
|
-record(chat_simulation, {
|
|
trigger_id = 0,
|
|
trigger_content = [],
|
|
trigger_lv = []
|
|
}).
|
|
-record(chat_simulation_log, {
|
|
name = <<>>,
|
|
sex = 1,
|
|
vip = 0,
|
|
picture = 0,
|
|
msg = <<>>,
|
|
time = 0,
|
|
lv = 1
|
|
}).
|
|
-record(base_chat_simulation_content, {
|
|
classify,
|
|
order,
|
|
id,
|
|
content,
|
|
space_time,
|
|
desc,
|
|
condition
|
|
}).
|
|
-record(base_chat_simulation_robot, {
|
|
id,
|
|
name,
|
|
vip,
|
|
sex = 1,
|
|
picture,
|
|
lv = 1
|
|
}).
|
|
-record(base_chat_simulation_trigger, {
|
|
id,
|
|
lv_min,
|
|
lv_max,
|
|
content
|
|
}).
|