源战役
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

347 行
12 KiB

  1. %%%--------------------------------------
  2. %%% @Author : calvin
  3. %%% @Email : calvinzhong888@gmail.com
  4. %%% @Created : 2012.5.9
  5. %%% @Description: 聊天
  6. %%%--------------------------------------
  7. %% 11017协议
  8. %% 目前暂时只有队伍频道
  9. -define(FLOAT_TEXT_ONLY, 1). %% 只飘字
  10. -define(CHAT_WINDOW_ONLY, 2). %% 只聊天框
  11. -define(FLOAT_AND_CHAT, 3). %% 飘字加聊天框
  12. %% ----------------------------------------------------
  13. %% 举报/禁言
  14. %% ----------------------------------------------------
  15. %% 禁言类型
  16. -define(TALK_LIMIT_TYPE_1, 1). %% gm或指导员禁言
  17. -define(TALK_LIMIT_TYPE_2, 2). %% 违反规则自动禁言A
  18. -define(TALK_LIMIT_TYPE_3, 3). %% 违反规则自动禁言B
  19. -define(TALK_LIMIT_TYPE_4, 4). %% 被举报次数过多禁言
  20. -define(TALK_LIMIT_TYPE_6, 6). %% 被霸主禁言跨服聊天
  21. %% 释放类型
  22. -define(TALK_RELEASE_TYPE_1, 1). %% gm或管理员手动解禁
  23. -define(TALK_RELEASE_TYPE_2, 2). %% 自动解禁
  24. -define(HORN_TALK_LV, 30). %% 发喇叭级别
  25. -define(TALK_LIMIT_TIME, 180). %% 禁言时
  26. -define(TALK_LIMIT_TIME_0, 300). %% 禁言5分钟
  27. -define(TALK_LIMIT_TIME_1, 600). %% 禁言10分钟
  28. -define(TALK_LIMIT_TIME_2, 1800). %% 禁言30分钟
  29. -define(TALK_LIMIT_TIME_3, 3600). %% 禁言1个小时
  30. -define(TALK_LIMIT_TIME_4, 7200). %% 禁言2小时
  31. -define(TALK_LIMIT_TIME_5, 21600). %% 禁言6小时
  32. -define(TALK_LIMIT_TIME_6, 86400). %% 禁言24小时
  33. -define(TALK_LIMIT_TIME_7, (86400*3)). %% 禁言3天
  34. -define(TALK_LIMIT_TIME_8, (86400*7)). %% 禁言一周
  35. -define(TALK_LIMIT_TIME_9, (3*366*86400)). %% 禁言三年
  36. -define(ALLOW_INFORM_NUM, 10). %% 最多被举报次数
  37. -define(ALLOW_CHAT_NUM_1, 20). %% 40级下,每天最多私聊玩家数
  38. -define(ALLOW_CHAT_NUM_2, 30). %% 40级下,给非好友最多私聊次数
  39. -define(CHAT_RULE_5_REJECT, [[43], [43,229,165,189,229,143,139]]). %% 聊天规则5,排除字符["+","+加好友"]
  40. -define(SQL_UPDATE_TALK_LIM, <<"update player_login set talk_lim=~p, talk_lim_type=~p, talk_lim_time=~p where id=~p">>).
  41. -define(SQL_UPDATE_LIM_RIGHT, <<"update player_login set talk_lim_right=~p where id=~p">>).
  42. -define(SQL_SELECT_TALK_LIM, <<"select talk_lim, talk_lim_time, talk_lim_right from player_login where id =~p">>).
  43. %% 存储被举报的信息
  44. -define(SQL_TALK_REPORT,<<"insert into `talk_report`(from_id, to_id, `msg`, `time`) values(~p, ~p, '~ts', UNIX_TIMESTAMP() )">>).
  45. -record(talk_accept, {
  46. all_accept = 1, %% 世界消息的接受。1:接受|0:拒绝
  47. all_tv_accept = 1 %% 世界传闻消息的接受。1:接受|0:拒绝
  48. }).
  49. %% ----------------------------------------------------
  50. %% 聊天
  51. %% ----------------------------------------------------
  52. %% 聊天类型
  53. -define(CHAT_CHANNEL_WORLD, 1). %% 世界频道
  54. -define(CHAT_CHANNEL_HORN, 2). %% 喇叭
  55. -define(CHAT_CHANNEL_NEARBY, 3). %% 区域频道
  56. -define(CHAT_CHANNEL_GUILD, 4). %% 公会频道
  57. -define(CHAT_CHANNEL_TEAM, 5). %% 队伍频道
  58. -define(CHAT_CHANNEL_PRIVATE, 6). %% 私聊频道
  59. -define(CHAT_CHANNEL_RELA, 7). %% 好友频道(给所有好友发送)
  60. -define(CHAT_CHANNEL_RECRUIT, 8). %% 招募频道
  61. -define(CHAT_CHANNEL_INFORM, 9). %% 举报频道
  62. -define(CHAT_CHANNEL_SYS, 10). %% 系统频道
  63. -define(CHAT_CHANNEL_WAIT_TEAM,11). %% 组队(招募)频道
  64. -define(CHAT_CHANNEL_SCENE, 12). %% 场景聊天(只针对活动场景的聊天)
  65. -define(CHAT_CHANNEL_WORLD_KF, 13). %% 跨服世界频道
  66. -define(CHAT_CHANNEL_REPLY, 14). %% 答题频道
  67. -define(CHAT_CHANNEL_3V3_TEAM, 15). %% 跨服3v3队伍
  68. -define(CHAT_CHANNEL_1VN_BET, 16). %% 跨服1vN押注
  69. -define(CHAT_CHANNEL_BEACH, 17). %% 温泉频道
  70. -define(CHAT_CHANNEL_WEDDING, 18). %% 婚礼弹幕
  71. -define(CHAT_CHANNEL_GLAMOUR, 19). %% 跑马弹幕
  72. -define(CHAT_CHANNEL_GUARD_RECRUIT, 20). %% 三人守塔招募频道
  73. -define(CHAT_CHANNEL_COUNTRY, 21). %% 本国频道
  74. %% 聊天类型开放列表
  75. -define(CHAT_CHANNEL_OPEN_LIST, [
  76. ?CHAT_CHANNEL_WORLD,
  77. ?CHAT_CHANNEL_NEARBY,
  78. ?CHAT_CHANNEL_GUILD,
  79. ?CHAT_CHANNEL_TEAM,
  80. ?CHAT_CHANNEL_PRIVATE,
  81. ?CHAT_CHANNEL_RELA,
  82. ?CHAT_CHANNEL_WAIT_TEAM,
  83. ?CHAT_CHANNEL_SCENE,
  84. ?CHAT_CHANNEL_WORLD_KF,
  85. ?CHAT_CHANNEL_REPLY,
  86. ?CHAT_CHANNEL_3V3_TEAM,
  87. ?CHAT_CHANNEL_1VN_BET,
  88. ?CHAT_CHANNEL_BEACH,
  89. ?CHAT_CHANNEL_WEDDING,
  90. ?CHAT_CHANNEL_GLAMOUR,
  91. ?CHAT_CHANNEL_GUARD_RECRUIT,
  92. ?CHAT_CHANNEL_COUNTRY
  93. ]).
  94. %% 聊天内容
  95. -define(CHAT_CONTENT_TEXT, 1). %% 文字聊天
  96. -define(CHAT_CONTENT_PICTURE, 2). %% 图片聊天
  97. -define(CHAT_CONTENT_VOICE, 3). %% 声音聊天
  98. %% 聊天时间
  99. -define(CHAT_GAP_WORLD, 5). %% 世界频道发言间隔
  100. -define(CHAT_GAP_NEARBY, 5). %% 附近频道发言间隔
  101. -define(CHAT_GAP_GUILD, 3). %% 社团(公会)频道发言间隔
  102. -define(CHAT_GAP_TEAM, 3). %% 队伍频道发言间隔
  103. -define(CHAT_GAP_PRIVATE, 3). %% 私聊频道发言间隔
  104. -define(CHAT_GAP_RELA, 3). %% 好友频道发言间隔
  105. -define(CHAT_GAP_INFORM, 3). %% 举报间隔
  106. -define(CHAT_GAP_WAIT_TEAM, 10). %% 组队邀请时间间隔
  107. -define(CHAT_GAP_SCENE, 5). %% 场景聊天时间间隔
  108. -define(CHAT_GAP_WORLD_KF, 3). %% 跨服世界频道聊天时间间隔
  109. -define(CHAT_GAP_HORN, 3). %% 喇叭发言间隔(本项目不使用)
  110. -define(CHAT_GAP_CAREER, 3). %% 职业/门派发言间隔(本项目不使用)
  111. -define(CHAT_GAP_REPLY, 0). %% 答题频道间隔(本项目不使用)
  112. -define(CHAT_GAP_DEFAULT, 3). %% 默认发言间隔
  113. -define(CHAT_GAP_GUARD, 10). %% 守卫信标招募间隔
  114. %% 聊天等级
  115. -define(CHAT_LV_WORLD, 60). %% 世界频道发言等级
  116. -define(CHAT_LV_NEARBY, 70). %% 附近频道
  117. -define(CHAT_LV_GUILD, 60). %% 社团(公会)
  118. -define(CHAT_LV_TEAM, 70). %% 队伍频道
  119. -define(CHAT_LV_PRIVATE, 60). %% 私聊频道
  120. -define(CHAT_LV_RELA, 60). %% 好友频道
  121. -define(CHAT_LV_SCENE, 60). %% 场景聊天频道
  122. -define(CHAT_LV_WORLD_KF,180). %% 跨服世界频道 %% 350
  123. -define(CHAT_LV_WEDDING, 75). %% 婚礼弹幕等级
  124. -define(CHAT_LV_HORN, 110). %% 喇叭(本项目不使用)
  125. -define(CHAT_LV_CAREER, 60). %% 职业/门派频道(本项目不使用)
  126. -define(CHAT_LV_DEFAULT, 60). %% 默认发言等级
  127. %% 聊天长度
  128. -define(CHAT_LEN_DEFAULT, 250). %% 默认长度(服务器放宽,1汉字=2单位长度,1数字字母=1单位长度)
  129. %% 聊天道具
  130. -define(CHAT_GOODS_HORN, 38050001). %% 喇叭道具
  131. -define(CHAT_GOODS_WORLD_KF, 38050002). %% 跨服频道道具
  132. %% 聊天内容相同
  133. -define(CHAT_CONTENT_SAME_NO, 0). %% 不相同
  134. -define(CHAT_CONTENT_SAME_YES, 1). %% 相同
  135. %% 参数结果类型
  136. -define(CHAT_ARGS_RESULT_NO, 0). %% 没有参数
  137. -define(CHAT_ARGS_RESULT_PASS, 1). %% 有参数校验正常
  138. -define(CHAT_ARGS_RESULT_NO_PASS, 2). %% 有参数校验失败
  139. %% 其他
  140. -define(CHAT_HORN_SHOW_TIME, 5). %% 喇叭展示时间
  141. %% 聊天
  142. -record(status_chat, {
  143. prev_record_time = [], %% 上次记录内容的时间[{Channel,Time}]
  144. record_content = [] %% 记录的聊天内容
  145. }).
  146. %% 聊天喇叭
  147. -record(bugle_state, {
  148. bugle_queue = queue:new(), %% 玩家喇叭队列
  149. gm_bugle_queue = queue:new(), %% gm喇叭队列(优先)
  150. ref = none %% 定时器
  151. }).
  152. %% 喇叭
  153. -record(bugle, {
  154. role_id = 0, %% 玩家id
  155. bugle_id = 0, %% 喇叭id
  156. show_time = 0, %% 展示时间
  157. msg = [] %% 消息列表
  158. }).
  159. %% 喇叭配置
  160. -record(bugle_cfg, {
  161. id = 0,
  162. first_cost = [],
  163. second_cost = [],
  164. show_time = 0,
  165. conditions = []
  166. }).
  167. %% 聊天缓存
  168. -record(cache_state, {
  169. priv_cache_map = #{} %% 私聊离线缓存 在线的私聊不做缓存 客户端自己存cookie #{ReceiverId => #priv_cache{}}
  170. }).
  171. -record(priv_cache, {
  172. len = 0,
  173. msg = []
  174. }).
  175. %% 私聊信息
  176. -record(msg_record, {
  177. channel = 0
  178. , sender_id = 0
  179. , sender_figure = undefined
  180. , sender_server_id = 0
  181. , sender_server_num = 0
  182. , sender_server_name = <<>>
  183. , receive_id = 0
  184. , receive_figure = undefined
  185. , msg_send = ""
  186. , args = []
  187. , args_result = 0
  188. , utime = 0
  189. , client_ver = 0
  190. , client_auto_id = 0
  191. , voice_msg_time = 0
  192. }).
  193. %% 语音
  194. -record(voice_state, {
  195. voice_dict = dict:new(),
  196. picture_dict = dict:new()
  197. }).
  198. %% 私聊对象基本信息(聊天监控用)
  199. -record(chat_to, {
  200. id = 0
  201. ,name = <<>>
  202. ,accname = <<>>
  203. ,level = 0
  204. ,vip_level = 0
  205. ,power = 0
  206. ,career = 0
  207. }).
  208. %% ----------------------------------------------------
  209. %% 小红点
  210. %% ----------------------------------------------------
  211. %% 公会
  212. -define(RED_POINT_GUILD_APPLY, 1). % 公会申请
  213. -define(RED_POINT_GUILD_UPGRADE, 2). % 公会升级
  214. -define(RED_POINT_RECEIVE_FLOWER_GIFT, 1). % 收到新的鲜花礼物
  215. -define(RED_POINT_SALARY_STATE, 3). % 公会工资
  216. %% 图鉴
  217. -define(RED_POINT_PIC_CHAPTER, 1). % 图鉴章节激活
  218. -define(RED_POINT_PIC_TYPE_TWO, 2). % 图鉴2类型
  219. -define(RED_POINT_PIC_TYPE_THREE, 3). % 图鉴3类型
  220. %% ----------------------------------------------------
  221. %% 其他
  222. %% ----------------------------------------------------
  223. %% 公告Ets
  224. -define(ETS_SYS_NOTICE, ets_sys_notice).
  225. %% ----------------------------------------------------
  226. %% 聊天次数监控
  227. %% ----------------------------------------------------
  228. -define(SQL_CHAT_LIMIT_GET,
  229. <<"select chat_count, chat_limit, role_shield from role_chat_limit where role_id = ~p">>).
  230. -define(SQL_CHAT_LIMIT_UPDATE,
  231. <<"replace into role_chat_limit set role_id = ~p, chat_count = ~p, chat_limit = '~ts', role_shield = '~ts'">>).
  232. -define(SQL_CHAT_ROLE_SHIELD_UPDATE,
  233. <<"update role_chat_limit set role_shield = '~ts' where role_id = ~p">>).
  234. %% 世界频道发言,聊天字符长度限制
  235. -define(DIFF_LV, 150). %%
  236. -define(DIFF_POWER, 60000). %%
  237. -define(DIFF_STRING, 50). %%
  238. -define(DIFF_VIP, 1).
  239. %% 敏感词等级战力检测
  240. -define(SEN_LV, 250).
  241. -define(SEN_VIP, 4).
  242. -define(SEN_POWER, 1000000).
  243. %% 私人聊天双方等级差
  244. -define(PRI_LV, 50).
  245. -define(PRI_POWER, 2000000).
  246. -record(role_chat_limit, {
  247. role_id = 0,
  248. chat_count = 0, %% 聊天次数特定等级下检测
  249. chat_limit = [], %% 特殊操作监控
  250. role_shield = undefined %% 玩家屏蔽列表
  251. }).
  252. %% 离线聊天时的亲密度限制
  253. -define(INTIMACY_LIMIT, 100).
  254. %% 屏蔽&取消
  255. -define(CHAT_SHEILD, 1).
  256. -define(CHAT_UNSHEILD, 2).
  257. %% 黑名单人数限制(本服+其他服)
  258. -define(SHEILD_NUM, 20).
  259. %%
  260. -record(role_shield, {
  261. shield_roles = [], %% 玩家屏蔽列表
  262. role_figure = [] %% 玩家头像等信息
  263. }).
  264. %% ----------------------------------------------------
  265. %% 聊天机器人
  266. %% ----------------------------------------------------
  267. -record(chat_simulation, {
  268. trigger_id = 0,
  269. trigger_content = [],
  270. trigger_lv = []
  271. }).
  272. -record(chat_simulation_log, {
  273. name = <<>>,
  274. sex = 1,
  275. vip = 0,
  276. picture = 0,
  277. msg = <<>>,
  278. time = 0,
  279. lv = 1
  280. }).
  281. -record(base_chat_simulation_content, {
  282. classify,
  283. order,
  284. id,
  285. content,
  286. space_time,
  287. desc,
  288. condition
  289. }).
  290. -record(base_chat_simulation_robot, {
  291. id,
  292. name,
  293. vip,
  294. sex = 1,
  295. picture,
  296. lv = 1
  297. }).
  298. -record(base_chat_simulation_trigger, {
  299. id,
  300. lv_min,
  301. lv_max,
  302. content
  303. }).