源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

657 行
29 KiB

  1. --[[
  2. @description:
  3. ]]
  4. require("game.chuanWen.ChuanWenManager")
  5. ChuanWenController = ChuanWenController or BaseClass(BaseController)
  6. function ChuanWenController:__init()
  7. ChuanWenController.Instance = self
  8. self.manager = ChuanWenManager:getInstance()
  9. self:RegisterAllProtocals()
  10. self:AddAllEvents()
  11. end
  12. function ChuanWenController:__delete()
  13. end
  14. function ChuanWenController:RegisterAllProtocals()
  15. self:RegisterProtocal(11015,"on11015") --传闻(新版通用格式)
  16. self:RegisterProtocal(11018,"on11018") --带头像的传闻..
  17. end
  18. function ChuanWenController:AddAllEvents()
  19. local receive_new_fun = function (scmd,type)
  20. -- scmd = {module_id = 646, id = 3, content = "1234,主玩家,110103,22"} --测试用
  21. self:RevNewChuanwen(scmd,type)
  22. end
  23. GlobalEventSystem:Bind(EventName.RECEIVE_NEW_CHUANWEN, receive_new_fun)
  24. local link_fun = function (param_list, x, y)
  25. self:LinkFun(param_list, x, y)
  26. end
  27. GlobalEventSystem:Bind(EventName.UNDER_LINE_CLICK_EVENT, link_fun)
  28. end
  29. --传闻
  30. function ChuanWenController:on11015()
  31. local scmd = SCMD11015.New(true)
  32. --[[用对应的model保存特定的传闻,自己去触发--]]
  33. --寻宝
  34. -- if scmd.module_id == 416 then
  35. -- if scmd.id == 1 or scmd.id == 2 or scmd.id == 3 or scmd.id == 4 then
  36. -- local array = Split(scmd.content,",")
  37. -- if array[1] == RoleManager.Instance.mainRoleInfo.name then
  38. -- TreasureHuntModel:getInstance():AddSelfChuanWen(scmd, 11015)
  39. -- return
  40. -- end
  41. -- end
  42. -- end
  43. --print("=============>>> YiRan:ChuanWenController [start:52] 11015scmd ------------------------------------------")
  44. --PrintTable(scmd)
  45. --print("=============>>> YiRan:ChuanWenController [end] ------------------------------------------")
  46. GlobalEventSystem:Fire(EventName.RECEIVE_NEW_CHUANWEN, scmd, 11015)--传闻
  47. end
  48. --传闻
  49. function ChuanWenController:on11018()
  50. local scmd = SCMD11018.New(true)
  51. --print("=============>>> YiRan:ChuanWenController [start:52] 11018scmd ------------------------------------------")
  52. --PrintTable(scmd)
  53. --print("=============>>> YiRan:ChuanWenController [end] ------------------------------------------")
  54. GlobalEventSystem:Fire(EventName.RECEIVE_NEW_CHUANWEN, scmd, 11018)--传闻
  55. end
  56. --如果传闻出现配置了 但是又没有显示在游戏内 策划又让你找问题 就去语言配置那里看看 是不是发送频道配错了 怼他!!!
  57. function ChuanWenController:RevNewChuanwen(scmd,type)
  58. if scmd == nil or scmd.module_id == nil or scmd.id == nil then
  59. return
  60. end
  61. if scmd.module_id == 331 and scmd.id == 2 and HopeGiftModel:getInstance():GetHopeGiftIsAction() then--臻享礼包动画过程中不播放传闻
  62. HopeGiftModel:getInstance():SetChuanwenInfo(scmd,type)
  63. return
  64. end
  65. local desc, chuanwen_cfg = self.manager:GetChuanWen(scmd)
  66. --self:CanEnterScene(desc)--判断先去掉
  67. if desc ~= "" then
  68. -- local chat_data = {}
  69. -- chat_data.content = desc
  70. local scene_id = SceneManager.Instance:GetSceneId()
  71. if not Config.ConfigChat.NoChuanwenSceneId[scene_id] then
  72. scmd.type = type
  73. scmd.chuanwen_type = chuanwen_cfg.type --传闻类型
  74. if chuanwen_cfg.type == ChuanWenManager.Type.Rolling then--传闻跑马灯飘(屏幕中部)(1)
  75. SysInfoCtrl.Instance:AppendMsg(SysInfoCtrl.SysInfoType.NOTICE, desc)
  76. GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
  77. elseif chuanwen_cfg.type == ChuanWenManager.Type.SystemNomal then--频道普通消息
  78. GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
  79. elseif chuanwen_cfg.type == ChuanWenManager.Type.RollingSystemNomal then--跑马灯加频道(3)
  80. --先解析标签,再删除特殊标签
  81. Message.show(self.manager:DeleteSpecialSign(PackageSpecialTab(desc)))
  82. if chuanwen_cfg.subtype ~= 0 then
  83. GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
  84. end
  85. elseif chuanwen_cfg.type == ChuanWenManager.Type.CSEvent then -- 跨服玩法传闻(屏幕中部,参考睾♂级藏宝图)
  86. GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
  87. MainUIModel:getInstance():AppendCSEventChuanwen(desc)
  88. -- elseif chuanwen_cfg.type == 5 then
  89. -- GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
  90. -- Message.show(self.manager:DeleteSpecialSign(PackageSpecialTab(desc)))
  91. end
  92. end
  93. end
  94. end
  95. function ChuanWenController:LinkFun(param_list, x, y)
  96. print("点击链接的事件===:", param_list)
  97. PrintTable(param_list)
  98. if param_list then
  99. if param_list[1] == "goods" or param_list[1] == "goods5" then --通过类型id查看tips
  100. local goods_basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(param_list[2])
  101. if goods_basic then
  102. if goods_basic.type == GoodsModel.TYPE.WarSoul then--战魂
  103. UIToolTipMgr:getInstance():AppendWarSoulTips(goods_basic.type_id, x, y)
  104. else
  105. UIToolTipMgr:getInstance():AppendGoodsTips(param_list[2])
  106. end
  107. end
  108. elseif param_list[1] == "goods2" then --通过唯一id查看物品 then
  109. --获取playerid 和 goods_id 发送15001协议 显示tips
  110. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, tonumber(param_list[2]), tonumber(param_list[3]), tonumber(param_list[4]))
  111. elseif param_list[1] == "scene" then --进入场景
  112. local cur_id, target_id = SceneManager:getInstance():GetSceneId(), tonumber(param_list[2])
  113. if SceneManager:getInstance():IsClickFindScene(cur_id, target_id) then
  114. GlobalEventSystem:Fire(SceneEventType.REQUEST_CHANGE_SCENE, cur_id)
  115. end
  116. elseif param_list[1] == "scene2" then --进入场景
  117. local cur_id, target_id = SceneManager:getInstance():GetSceneId(), tonumber(param_list[2])
  118. if SceneManager:getInstance():IsClickFindScene(cur_id, target_id) then
  119. local findVo = FindVo.New()
  120. findVo.type = FindVo.POINT
  121. findVo.sceneId = tonumber(param_list[2])
  122. findVo.x = tonumber(param_list[3])
  123. findVo.y = tonumber(param_list[4])
  124. GlobalEventSystem:Fire(EventName.FIND,findVo)
  125. end
  126. elseif param_list[1] == "player" then --查看玩家信息
  127. local name = param_list[2]
  128. local role_id = tonumber(param_list[3])
  129. if role_id~=0 then
  130. SocialityModel:getInstance():Fire(SocialityModel.REQUEST_OTHER_INFO, role_id, x, y)
  131. end
  132. elseif param_list[1] == "player2" then --查看玩家信息
  133. local name = param_list[2]
  134. local role_id = tonumber(param_list[3])
  135. local server_id = tonumber(param_list[4])
  136. if role_id~=0 then
  137. if server_id~=RoleManager.Instance.mainRoleInfo.server_id then
  138. Message.show("外域玩家无法查看信息")
  139. else
  140. SocialityModel:getInstance():Fire(SocialityModel.REQUEST_OTHER_INFO, role_id, x, y)
  141. end
  142. end
  143. elseif param_list[1] == "scene3" then --点击前往
  144. local cur_id, target_id = SceneManager:getInstance():GetSceneId(), tonumber(param_list[2])
  145. if cur_id~=target_id then
  146. self:goBoss(param_list)
  147. else
  148. --正在场景中
  149. if SceneManager:getInstance():IsWorldBeastScene() then --在幻兽之域中
  150. self:onBeast(param_list)
  151. else
  152. local findVo = FindVo.New()
  153. findVo.type = FindVo.POINT
  154. findVo.sceneId = tonumber(param_list[2])
  155. findVo.x = tonumber(param_list[3])/SceneObj.LogicRealRatio.x
  156. findVo.y = tonumber(param_list[4])/SceneObj.LogicRealRatio.y
  157. GlobalEventSystem:Fire(EventName.FIND,findVo)
  158. end
  159. end
  160. elseif param_list[1] == "open_fun" then --打开功能
  161. local winId = tonumber(param_list[2])
  162. local subId = tonumber(param_list[3])
  163. local parm = {}
  164. for i,v in ipairs(param_list) do
  165. if i == 3 and param_list[4] then
  166. --传闻跳转如果要传值,那么第三个参数就应该是充当openfun的第二个传参作用
  167. if tonumber(param_list[2]) == 461 then
  168. --可是有的功能模块id和跳转实际使用的传参不对应的话,就要单独处理
  169. table.insert( parm, 9 )--废都幻魔
  170. elseif tonumber(param_list[2]) == 462 then
  171. table.insert( parm, Config.ConfigBoss.ModuleId.BossHome )--boss之家
  172. else
  173. table.insert( parm, tonumber(v) )
  174. end
  175. elseif i > 3 then
  176. table.insert( parm, tonumber(v) )
  177. end
  178. end
  179. OpenFun.Open(winId, subId, unpack(parm))
  180. elseif param_list[1] == "skill" then --用<a解析,但是不是超链接
  181. GlobalEventSystem:Fire(EventName.OPEN_CHAT_VIEW)
  182. elseif param_list[1] == "pos" then --点击坐标
  183. local function ok( ... )
  184. local scene_id = tonumber(param_list[2])
  185. local line = tonumber(param_list[3]) or 1
  186. local x = tonumber(param_list[4]) or 0
  187. local y = tonumber(param_list[5]) or 0
  188. local cur_line = MapModel:getInstance():GetServerLine()
  189. local scene_info = SceneManager:getInstance():GetSceneInfo(scene_id)
  190. local level = RoleManager.Instance.mainRoleInfo.level
  191. if scene_info then
  192. --如果在当前场景当前线路,就直接寻路
  193. if scene_id == SceneManager.Instance:GetSceneId() and line==cur_line
  194. and scene_info.type~=2 and scene_info.type~=5 and scene_info.type~=6 and scene_info.type~=7
  195. and scene_info.type~=4 and scene_info.type~=8 then
  196. local findVo = FindVo.New()
  197. findVo.type = FindVo.POINT
  198. findVo.sceneId = scene_id
  199. findVo.x = x/SceneObj.LogicRealRatio.x
  200. findVo.y = y/SceneObj.LogicRealRatio.y
  201. GlobalEventSystem:Fire(EventName.FIND,findVo)
  202. return
  203. end
  204. if scene_info.type==3 then --打开界面
  205. if SceneManager:getInstance():IsWorldBeastScene(scene_id) then
  206. if level < Config.ConfigOpenLv.RightTop.beast then
  207. Message.show(string.format("%d级开启世界服", Config.ConfigOpenLv.RightTop.beast))
  208. return
  209. end
  210. GlobalEventSystem:Fire(EventName.OPEN_WORLD_VIEW, true)
  211. end
  212. else --请求协议
  213. if scene_id and line and x and y then
  214. local cur_id, target_id = SceneManager:getInstance():GetSceneId(), scene_id
  215. --if SceneManager:getInstance():IsClickFindScene(cur_id, target_id) then
  216. line = 0 --暂时改成都能跳
  217. GlobalEventSystem:Fire(SceneEventType.REQUEST_POS_LINK, scene_id, line, x, y)
  218. --else
  219. -- Message.show("目标场景不能进入")
  220. --end
  221. end
  222. end
  223. end
  224. end
  225. local scene_info = SceneManager.Instance:GetSceneInfo(tonumber(param_list[2]))
  226. local name = ""
  227. if scene_info then
  228. name = Trim(scene_info.name)
  229. local ask_str = string.format("即将寻路至 <color=%s>[%s(%d,%d)]</color> 是否确认?", ColorUtil.PURPLE_DARK,name, tonumber(param_list[4]) / 100, tonumber(param_list[5]) / 100)
  230. Alert.show(ask_str, Alert.Type.Two, ok ,nil,"确定","取消")
  231. end
  232. elseif param_list[1] == "pos_festival_boss" then --点击坐标
  233. local function ok( ... )
  234. local scene_id = tonumber(param_list[2])
  235. local scene_info = SceneManager:getInstance():GetSceneInfo(scene_id)
  236. local line = tonumber(param_list[3]) or 1
  237. local cur_line = MapModel:getInstance():GetServerLine()
  238. local x = tonumber(param_list[4]) or 0
  239. local y = tonumber(param_list[5]) or 0
  240. if scene_info then
  241. if scene_id == SceneManager.Instance:GetSceneId() and line==cur_line then
  242. --如果在当前场景当前线路,就直接寻路
  243. local findVo = FindVo.New()
  244. findVo.type = FindVo.POINT
  245. findVo.sceneId = scene_id
  246. findVo.x = x/SceneObj.LogicRealRatio.x
  247. findVo.y = y/SceneObj.LogicRealRatio.y
  248. GlobalEventSystem:Fire(EventName.FIND,findVo)
  249. else
  250. BossModel:GetInstance():Fire(BossConst.REQ_DESERTED_BOSS_SCMD,46028,tonumber(param_list[2]))
  251. BossModel:GetInstance().festival_boss_find_way_data = DeepCopy(param_list)--保存跳转场景后的寻路参数
  252. end
  253. end
  254. end
  255. local scene_info = SceneManager.Instance:GetSceneInfo(tonumber(param_list[2]))
  256. local name = ""
  257. if scene_info then
  258. name = Trim(scene_info.name)
  259. local ask_str = string.format("即将寻路至 <color=%s>[%s(%d,%d)]</color> 是否确认?", ColorUtil.PURPLE_DARK,name, tonumber(param_list[4]) / 100, tonumber(param_list[5]) / 100)
  260. Alert.show(ask_str, Alert.Type.Two, ok ,nil,"确定","取消")
  261. end
  262. elseif param_list[1] == "mail" then --邮件
  263. GlobalEventSystem:Fire(EventName.OPEN_SOCIALITY_VIEW, 3)
  264. elseif param_list[1] == "url" then --跳转网页
  265. local str = param_list[2]
  266. elseif param_list[1] == "mate_show" then
  267. MateModel:GetInstance():Fire(MateConst.REQ_LOOK_OTHER_MATE,param_list[2],param_list[3])
  268. elseif param_list[1] == "showbaby" then--晒娃
  269. --if RoleManager.Instance.mainRoleInfo.level < Config.Moduleopenlv["163@1"].lv then
  270. -- Message.show("75级之后才可以逗逗TA的宝宝哦~")
  271. --else
  272. --Message.show("逗宝宝")
  273. local data = {
  274. child_name = param_list[2],
  275. name = param_list[3],
  276. role_id = param_list[4],
  277. sex = param_list[5],
  278. child_clothe_res_id = param_list[6],
  279. career = param_list[7],
  280. level = param_list[8],
  281. turn = param_list[9],
  282. profile_photo_id = param_list[10],
  283. vip_flag = param_list[11],
  284. sup_vip_type = param_list[12],
  285. fashion_id = param_list[13],
  286. child_level = param_list[14],
  287. child_sex = param_list[15],
  288. }
  289. -- GlobalEventSystem:Fire(EventName.CLOSE_CHAT_VIEW)
  290. ChildModel:GetInstance():Fire(ChildConst.OPEN_CHILD_CHAT_NICE_VIEW,true,data)
  291. --end
  292. elseif param_list[1] == "guild" then--加入社团
  293. GuildModel:getInstance():Fire(GuildModel.ApplyJoinGuildEvt, param_list[2]) --申请加入社团
  294. elseif param_list[1] == "guildScene" then --进入社团驻地
  295. local guild_id = RoleManager.Instance.mainRoleInfo.guild_id
  296. if not guild_id or guild_id == 0 then
  297. Message.show("请先加入社团")
  298. return
  299. end
  300. GuildModel:getInstance():Fire(GuildModel.ENTER_GUILD_BASE)
  301. elseif param_list[1] == "redenvelopes" or param_list[1] == "actredenvelopes" then --抢社团红包
  302. RedPacketModel:GetInstance():Fire(RedPacketModel.OPEN_GUILD_REDPACKET_VIEW, true) -- 只打开界面
  303. elseif param_list[1] == "Pet" then --展示宠物
  304. if not GetModuleIsOpen(163) then
  305. Message.show("该功能暂未开启")
  306. return
  307. end
  308. PetModel:getInstance():Fire(PetConst.REQUEST_CCMD_EVENT,16311,tonumber(param_list[2]),tonumber(param_list[3]))
  309. elseif param_list[1] == "showPetSupport" then --跳到宠物声援界面
  310. if not GetModuleIsOpen(163) then
  311. Message.show("该功能暂未开启")
  312. return
  313. end
  314. GlobalEventSystem:Fire(EventName.OPEN_PET_VIEW,2)
  315. elseif param_list[1] == "showPetVote" then --跳到宠物投票界面
  316. if not GetModuleIsOpen(163) then
  317. Message.show("该功能暂未开启")
  318. return
  319. end
  320. PetModel:getInstance():Fire(PetConst.OPEN_PET_VOTE_VIEW)
  321. elseif param_list[1] == "showPetRank" then --跳到宠物榜单界面
  322. if not GetModuleIsOpen(163) then
  323. Message.show("该功能暂未开启")
  324. return
  325. end
  326. PetModel:getInstance():Fire(PetConst.OPEN_PET_SUPPORT_RANK_VIEW)
  327. elseif param_list[1] == BeachConst.GiftTagStr then
  328. local role_id = tonumber(param_list[2])
  329. if role_id == RoleManager.Instance.mainRoleInfo.role_id then
  330. Message.show("不能给自己投票哦")
  331. return
  332. end
  333. local num = 0
  334. local data = BeachModel:GetInstance():GetMyInfo( )
  335. if data then
  336. num = data.vote_times or 0
  337. end
  338. if num > 0 then
  339. local name_str = GetCSLongName( param_list[3], param_list[4] )
  340. BeachModel:GetInstance():VoteToOher(name_str,role_id)
  341. else
  342. BeachModel:GetInstance():Fire(BeachConst.OPEN_BUY_VOTE)
  343. end
  344. elseif param_list[1] == "dunManyTeam" then --加入队伍
  345. local is_aotu_ready = DunManyModel:getInstance():GetAotoReadyState()
  346. DunManyModel:getInstance():Fire(DunManyModel.REQUEST_CCMD_EVENT,21503,param_list[2],param_list[3],0,is_aotu_ready and 1 or 0)
  347. elseif param_list[1] == "dunManyGuardianTeam" then --加入绝地守卫队伍
  348. if tonumber(param_list[4]) == 1 then
  349. local data = {
  350. dun_type = BaseDungeonModel.DUN_TYPE.GuardianThree,
  351. team_id = param_list[2],
  352. dun_id = param_list[3],
  353. }
  354. DunManyModel.Instance:Fire(DunManyModel.OPEN_PASSWORD_VIEW, data)
  355. else
  356. local is_aotu_ready = DunManyModel:getInstance():GetAotoReadyState()
  357. DunManyModel:getInstance():Fire(DunManyModel.REQUEST_CCMD_EVENT,21503,param_list[2],param_list[3],0,is_aotu_ready and 1 or 0)
  358. end
  359. elseif param_list[1] == "guild_rec" then --公会招募
  360. local main_role = RoleManager.Instance.mainRoleInfo
  361. if main_role.guild_id ~= 0 then
  362. Message.show("您已经有社团了!")
  363. else
  364. GuildModel:getInstance():Fire(GuildModel.ApplyJoinGuildEvt, param_list[2])
  365. end
  366. elseif param_list[1] == "firstrecharge" then --首充
  367. local server_info = RechargeActivityModel:getInstance():GetFirstRechargeInfo()
  368. if server_info and server_info.open == 0 then
  369. OpenFun.Open(450,1)
  370. else
  371. local is_get_over = false--是否已经领完
  372. for i,v in ipairs(server_info.product_list) do
  373. if v.state ~= 2 then
  374. is_get_over = false
  375. break
  376. else
  377. is_get_over = v.state == 2
  378. end
  379. end
  380. if is_get_over then
  381. OpenFun.Open(450,1)
  382. else
  383. RechargeActivityModel:getInstance():Fire(RechargeActivityModel.OPEN_FIRST_RECHARGE_VIEW)
  384. end
  385. end
  386. elseif param_list[1] == "fortuneCat" then -- 招财猫
  387. local event_data = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.FORTUNE_CAT)
  388. if event_data then
  389. local sub_type = event_data.sub_type
  390. FortuneCatModel:getInstance():Fire(FortuneCatModel.OPEN_FORTUNE_CAT_VIEW, true, sub_type)
  391. end
  392. elseif param_list[1] == "racerank" then --竞榜
  393. -- GlobalEventSystem:Fire(CompetingListModel.OPEN_COMPETING_LIST_VIEW, tonumber(param_list[3]))
  394. GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,tonumber(param_list[3]),KfActivityModel.TabID.Competing)
  395. elseif param_list[1] == "kfGroupBuying" then --开服团购活动
  396. GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,nil,KfActivityModel.TabID.GroupBuying)
  397. elseif param_list[1] == "mobilizationGroupBuying" then
  398. GlobalEventSystem:Fire(MobilizationModel.OPEN_MOBILIZATION_VIEW,tonumber(param_list[2]),tonumber(param_list[3]))
  399. elseif param_list[1] == "marble" then
  400. local need_lv = GetModuleOpenLevel(331,6)
  401. local cur_lv = RoleManager.Instance.mainRoleInfo.level
  402. if cur_lv >= need_lv then
  403. RechargeActivityModel:getInstance():Fire(RechargeActivityModel.OPEN_DAILY_RECHARGE_VIEW,nil,DailyRechargeBaseView.ShowType.Pellet)
  404. else
  405. Message.show(string.format( "该功能%d级开启", need_lv ))
  406. end
  407. elseif param_list[1] == "mono" then --大富翁
  408. GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,nil,KfActivityModel.TabID.Monopoly)
  409. elseif param_list[1] == "contract" then --我也要解锁
  410. local sub_type = tonumber(param_list[2])
  411. local act_info = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.CONTRACT, sub_type)
  412. if act_info and RoleManager.Instance.mainRoleInfo.level >= Config.Modulesub["331@74"].open_lv then
  413. local pay_state = ContractModel:getInstance():GetPayState( sub_type )
  414. if pay_state == ContractConst.PayState.Lock then
  415. ContractModel:getInstance():Fire(ContractConst.OPEN_UNLOCK_VIEW,sub_type)
  416. else
  417. local id = 33100000 + CustomActivityModel.CustomActBaseType.CONTRACT * 1000 + sub_type
  418. GlobalEventSystem:Fire(FuliConst.OPEN_FULI_MAIN_VIEW, id)
  419. end
  420. else
  421. Message.show("活动已经结束了哦~")
  422. end
  423. elseif param_list[1] == "contractLv" then --我也要升级
  424. local sub_type = tonumber(param_list[2])
  425. local act_info = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.CONTRACT, sub_type)
  426. if act_info and RoleManager.Instance.mainRoleInfo.level >= Config.Modulesub["331@74"].open_lv then
  427. local id = 33100000 + CustomActivityModel.CustomActBaseType.CONTRACT * 1000 + sub_type
  428. GlobalEventSystem:Fire(FuliConst.OPEN_FULI_MAIN_VIEW, id)
  429. else
  430. Message.show("活动已经结束了哦~")
  431. end
  432. elseif param_list[1] == "escortHelp" then --护送协助
  433. local role_id = RoleManager.Instance.mainRoleInfo.role_id
  434. if role_id == tonumber(param_list[4]) then
  435. Message.show("不能协助自己哦~")
  436. else
  437. local data = {
  438. support_cfg_id = 4,
  439. name = param_list[3],
  440. support_sid = param_list[2],
  441. }
  442. GuildModel:getInstance():Fire(GuildModel.OPEN_GUILD_SUPPORT_GO_VIEW,data)
  443. end
  444. elseif param_list[1] == "guild_csgr_enter" then -- 本国团战
  445. GlobalEventSystem:Fire(EventName.OPEN_ACITVITY_TIP, 410, 1, nil)
  446. elseif param_list[1] == "bosspass" or param_list[1] == "bosspassLv" then
  447. --幻魔宝典
  448. local need_lv = GetModuleOpenLevel(331,104)
  449. local cur_lv = RoleManager.Instance.mainRoleInfo.level
  450. if cur_lv >= need_lv then
  451. OpenFun.Open(331,104)
  452. else
  453. Message.show(string.format( "该功能%d级开启", need_lv ))
  454. end
  455. elseif param_list[1] == "hopegift" then--臻享礼包
  456. local sub_type = tonumber(param_list[2])
  457. local is_open = HopeGiftModel:getInstance():CheckActIsOpen(sub_type)
  458. if is_open then
  459. if RoleManager.Instance.mainRoleInfo.vip_flag >= 4 then
  460. GlobalEventSystem:Fire(EventName.OPEN_VIP_VIEW,3316500 + sub_type)
  461. else
  462. Message.show("您的VIP等级不足,请先提升VIP等级!","fault")
  463. end
  464. else
  465. Message.show("您的VIP等级不足,请先提升VIP等级!","fault")
  466. end
  467. elseif param_list[1] == "compose" then--合成机回答问题
  468. if tonumber(param_list[2]) and tonumber(param_list[3]) and tonumber(param_list[4]) then
  469. OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33292, tonumber(param_list[2]), 1, tonumber(param_list[3]), tonumber(param_list[4]))
  470. end
  471. elseif param_list[1] == "recruitFriends" then--招募好友
  472. local herf_copntent = string.format("<a@addFriend@%s><color=#2CF86F>[添加好友]</color></a>",RoleManager.Instance.mainRoleInfo.role_id)
  473. local des_cfg = Config.AssistantChat.AddFriendDes
  474. local random_num = math.random(1, TableSize(des_cfg))
  475. local add_freiend_des = Config.AssistantChat.AddFriendDes[random_num]
  476. local content = string.format("%s%s", add_freiend_des, herf_copntent)
  477. ChatModel:getInstance():Fire(ChatModel.SEND_MSG,ChatModel.CHANNEL_WORLD,content)
  478. GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
  479. GlobalEventSystem:Fire(EventName.OPEN_CHAT_VIEW,ChatModel.CHANNEL_WORLD)
  480. elseif param_list[1] == "assistDoMainTask" then--小助手聊天前往做主线
  481. GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
  482. GlobalEventSystem:Fire(EventName.FORCE_TO_DO_TASK, true, true)
  483. elseif param_list[1] == "assistDoDailyTask" then--小助手聊天前往做经验跑环
  484. GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
  485. TaskModel:getInstance():DoBountyTask()
  486. elseif param_list[1] == "assistDoGuildTask" then--小助手聊天前往做社团跑环
  487. GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
  488. TaskModel:getInstance():DoGuildTask()
  489. elseif param_list[1] == "addFriend" then--添加好友
  490. local role_id = tonumber(param_list[2])
  491. if role_id == RoleManager.Instance.mainRoleInfo.role_id then
  492. Message.show("不能添加自己为好友")
  493. elseif SocialityModel:getInstance():IsRelaviveType(role_id, Config.ConfigSocial.RelativeType.friend) then
  494. Message.show("对方已经是好友了")
  495. else
  496. SocialityModel:getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14003, role_id)
  497. Message.show("已添加对方为好友")
  498. end
  499. elseif param_list[1] == "jumpCapsuleEgg" then -- 龙神宝库
  500. OpenFun.Open(170,1)
  501. elseif param_list[1] == "card" then -- 尊享卡
  502. if VipModel.getInstance():GetVipLevel() < 1 or not GetModuleIsOpen(450, 6) then
  503. Message.show("功能未开启")
  504. return
  505. end
  506. OpenFun.Open(450,6)
  507. elseif param_list[1] == "mobilize" then--全民动员
  508. local subtype = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.MOBILIZATION)
  509. GlobalEventSystem:Fire(MobilizationModel.OPEN_MOBILIZATION_VIEW,subtype)
  510. elseif param_list[1] == "treasure" then -- 藏宝图
  511. local event_type = tonumber(param_list[2])
  512. if event_type == 1 then -- 打开宝图介绍界面
  513. -- TreasureMapModel:getInstance():Fire(TreasureMapConst.OPEN_DESC_VIEW, true)
  514. OpenFun.Open(424, 1)
  515. elseif event_type == 2 then -- 跳转到藏宝图boss位置
  516. local pos_cfg = Config.Treasuremappos[tonumber(param_list[3])]
  517. if not pos_cfg then return end
  518. local pos_data = stringtotable(pos_cfg.pos)
  519. local scene_id = tonumber(pos_data[1])
  520. local x = tonumber(pos_data[2]) or 0
  521. local y = tonumber(pos_data[3]) or 0
  522. local findVo = FindVo.New()
  523. findVo.type = FindVo.POINT
  524. findVo.x = x / SceneObj.LogicRealRatio.x
  525. findVo.y = y / SceneObj.LogicRealRatio.y
  526. findVo.sceneId = scene_id
  527. findVo.call_back = function()
  528. GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT,false,true)
  529. end
  530. local function ok( ... )
  531. local use_shoe = VipModel:getInstance():CanFreeUseShoe()
  532. local function find_way_func()
  533. if SceneManager:getInstance():GetSceneId() ~= findVo.sceneId then -- 场景不同,先切场景
  534. GlobalEventSystem:Fire(SceneEventType.REQUEST_CHANGE_SCENE, findVo.sceneId, nil, SceneTransType.World)
  535. else
  536. GlobalEventSystem:Fire(EventName.FIND, findVo)
  537. end
  538. end
  539. if self.tm_fly_delay_id then
  540. TimerQuest.CancelQuest(GlobalTimerQuest, self.tm_fly_delay_id)
  541. self.tm_fly_delay_id = false
  542. end
  543. if use_shoe then
  544. local end_pos = GameMath.GetPosByCeterPoint(findVo.x * SceneObj.LogicRealRatio.x,findVo.y * SceneObj.LogicRealRatio.y, 100)
  545. local function callback()
  546. if findVo.sceneId == SceneManager:getInstance():GetSceneId() then
  547. find_way_func()
  548. else
  549. self.tm_fly_delay_id = setTimeout(find_way_func, 0.5)
  550. end
  551. end
  552. GlobalEventSystem:Fire(EventName.USE_FLY_SHOE, findVo.sceneId, end_pos.x, end_pos.y, callback)
  553. else
  554. find_way_func()
  555. end
  556. end
  557. local scene_info = SceneManager.Instance:GetSceneInfo(scene_id)
  558. local name = ""
  559. if scene_info then
  560. name = Trim(scene_info.name)
  561. local ask_str = string.format("即将寻路至 <color=%s>[%s(%d,%d)]</color> 是否确认?",
  562. ColorUtil.PURPLE_DARK, name, findVo.x, findVo.y)
  563. Alert.show(ask_str, Alert.Type.Two, ok, nil, "确定", "取消")
  564. end
  565. end
  566. end
  567. end
  568. end
  569. function ChuanWenController:goBoss( param_list )
  570. do return end
  571. --需要前往boss场景
  572. local boss_type = tonumber(param_list[5])
  573. local scene_id = tonumber(param_list[2])
  574. local boss_id = tonumber(param_list[6])
  575. local layers
  576. for k,v in pairs(Config.Bosscfg) do
  577. if v.scene==scene_id then
  578. layers = v.layers
  579. end
  580. end
  581. if SceneManager.Instance:IsBossPersonScene(scene_id) then
  582. GlobalEventSystem:Fire(EventName.OPEN_BOSS_VIEW, Config.ConfigBoss.ModuleId.Person ,boss_id)
  583. return
  584. end
  585. if boss_id then
  586. -- BossModel:GetInstance().need_find_pos = Vector2(tonumber(param_list[3])/SceneObj.LogicRealRatio.x
  587. -- , tonumber(param_list[4])/SceneObj.LogicRealRatio.y)
  588. end
  589. end
  590. function ChuanWenController:goBeast(param_list)
  591. --需要前往幻兽之域
  592. local boss_id = tonumber(param_list[5])
  593. local cfg = boss_id and Config.Eudemonsbosscfg[boss_id]
  594. if cfg then --是boss
  595. WorldModel:getInstance():Fire(WorldModel.REQUEST_CCMD_EVENT, 47003, WorldModel.BossType.BEAST, boss_id)
  596. else --其他
  597. --随便拿一个bossid进入场景,前往坐标点
  598. for i, v in pairs(Config.Eudemonsbosscfg) do
  599. if v.scene == tonumber(param_list[2]) then
  600. boss_id = i
  601. break
  602. end
  603. end
  604. WorldModel:getInstance():Fire(WorldModel.REQUEST_CCMD_EVENT, 47003, WorldModel.BossType.BEAST, boss_id)
  605. WorldModel:getInstance().need_find_pos = Vector2(tonumber(param_list[3])/SceneObj.LogicRealRatio.x
  606. , tonumber(param_list[4])/SceneObj.LogicRealRatio.y)
  607. end
  608. end
  609. function ChuanWenController:onBeast(param_list)
  610. local boss_id = tonumber(param_list[5])
  611. local cfg = boss_id and Config.Eudemonsbosscfg[boss_id]
  612. if not cfg then
  613. WorldModel:getInstance().need_find_pos = Vector2(tonumber(param_list[3])/SceneObj.LogicRealRatio.x,
  614. tonumber(param_list[4])/SceneObj.LogicRealRatio.y)
  615. end
  616. WorldModel:getInstance():Fire(WorldModel.ON_FIND_MONSTER, boss_id)
  617. end
  618. --是否能够前往该场景
  619. function ChuanWenController:CanEnterScene(desc)
  620. local list = Split(desc, "@")
  621. for i, v in ipairs(list) do
  622. if v == "scene3" then
  623. local scene_id = tonumber(list[i+1])
  624. if SceneManager.Instance:IsWorldBeastScene(scene_id) then --前往幻兽之域
  625. --不满足进入该场景条件
  626. local layer = SceneManager.Instance:IsWorldBeastScene(scene_id)
  627. local lv, vip = WorldModel:getInstance():GetBeastCondition(layer)
  628. if RoleManager.Instance.mainRoleInfo.level < lv or RoleManager.Instance.mainRoleInfo.vip_flag < vip then
  629. return false
  630. end
  631. end
  632. end
  633. end
  634. return true
  635. end