--[[
@description:传闻
]]
require("game.chuanWen.ChuanWenManager")
ChuanWenController = ChuanWenController or BaseClass(BaseController)
function ChuanWenController:__init()
ChuanWenController.Instance = self
self.manager = ChuanWenManager:getInstance()
self:RegisterAllProtocals()
self:AddAllEvents()
end
function ChuanWenController:__delete()
end
function ChuanWenController:RegisterAllProtocals()
self:RegisterProtocal(11015,"on11015") --传闻(新版通用格式)
self:RegisterProtocal(11018,"on11018") --带头像的传闻..
end
function ChuanWenController:AddAllEvents()
local receive_new_fun = function (scmd,type)
-- scmd = {module_id = 646, id = 3, content = "1234,主玩家,110103,22"} --测试用
self:RevNewChuanwen(scmd,type)
end
GlobalEventSystem:Bind(EventName.RECEIVE_NEW_CHUANWEN, receive_new_fun)
local link_fun = function (param_list, x, y)
self:LinkFun(param_list, x, y)
end
GlobalEventSystem:Bind(EventName.UNDER_LINE_CLICK_EVENT, link_fun)
end
--传闻
function ChuanWenController:on11015()
local scmd = SCMD11015.New(true)
--[[用对应的model保存特定的传闻,自己去触发--]]
--寻宝
-- if scmd.module_id == 416 then
-- if scmd.id == 1 or scmd.id == 2 or scmd.id == 3 or scmd.id == 4 then
-- local array = Split(scmd.content,",")
-- if array[1] == RoleManager.Instance.mainRoleInfo.name then
-- TreasureHuntModel:getInstance():AddSelfChuanWen(scmd, 11015)
-- return
-- end
-- end
-- end
--print("=============>>> YiRan:ChuanWenController [start:52] 11015scmd ------------------------------------------")
--PrintTable(scmd)
--print("=============>>> YiRan:ChuanWenController [end] ------------------------------------------")
GlobalEventSystem:Fire(EventName.RECEIVE_NEW_CHUANWEN, scmd, 11015)--传闻
end
--传闻
function ChuanWenController:on11018()
local scmd = SCMD11018.New(true)
--print("=============>>> YiRan:ChuanWenController [start:52] 11018scmd ------------------------------------------")
--PrintTable(scmd)
--print("=============>>> YiRan:ChuanWenController [end] ------------------------------------------")
GlobalEventSystem:Fire(EventName.RECEIVE_NEW_CHUANWEN, scmd, 11018)--传闻
end
--如果传闻出现配置了 但是又没有显示在游戏内 策划又让你找问题 就去语言配置那里看看 是不是发送频道配错了 怼他!!!
function ChuanWenController:RevNewChuanwen(scmd,type)
if scmd == nil or scmd.module_id == nil or scmd.id == nil then
return
end
if scmd.module_id == 331 and scmd.id == 2 and HopeGiftModel:getInstance():GetHopeGiftIsAction() then--臻享礼包动画过程中不播放传闻
HopeGiftModel:getInstance():SetChuanwenInfo(scmd,type)
return
end
local desc, chuanwen_cfg = self.manager:GetChuanWen(scmd)
--self:CanEnterScene(desc)--判断先去掉
if desc ~= "" then
-- local chat_data = {}
-- chat_data.content = desc
local scene_id = SceneManager.Instance:GetSceneId()
if not Config.ConfigChat.NoChuanwenSceneId[scene_id] then
scmd.type = type
scmd.chuanwen_type = chuanwen_cfg.type --传闻类型
if chuanwen_cfg.type == ChuanWenManager.Type.Rolling then--传闻跑马灯飘(屏幕中部)(1)
SysInfoCtrl.Instance:AppendMsg(SysInfoCtrl.SysInfoType.NOTICE, desc)
GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
elseif chuanwen_cfg.type == ChuanWenManager.Type.SystemNomal then--频道普通消息
GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
elseif chuanwen_cfg.type == ChuanWenManager.Type.RollingSystemNomal then--跑马灯加频道(3)
--先解析标签,再删除特殊标签
Message.show(self.manager:DeleteSpecialSign(PackageSpecialTab(desc)))
if chuanwen_cfg.subtype ~= 0 then
GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
end
elseif chuanwen_cfg.type == ChuanWenManager.Type.CSEvent then -- 跨服玩法传闻(屏幕中部,参考睾♂级藏宝图)
GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
MainUIModel:getInstance():AppendCSEventChuanwen(desc)
-- elseif chuanwen_cfg.type == 5 then
-- GlobalEventSystem:Fire(EventName.SHOW_CHUANWEN, desc, chuanwen_cfg, scmd)
-- Message.show(self.manager:DeleteSpecialSign(PackageSpecialTab(desc)))
end
end
end
end
function ChuanWenController:LinkFun(param_list, x, y)
print("点击链接的事件===:", param_list)
PrintTable(param_list)
if param_list then
if param_list[1] == "goods" or param_list[1] == "goods5" then --通过类型id查看tips
local goods_basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(param_list[2])
if goods_basic then
if goods_basic.type == GoodsModel.TYPE.WarSoul then--战魂
UIToolTipMgr:getInstance():AppendWarSoulTips(goods_basic.type_id, x, y)
else
UIToolTipMgr:getInstance():AppendGoodsTips(param_list[2])
end
end
elseif param_list[1] == "goods2" then --通过唯一id查看物品 then
--获取playerid 和 goods_id 发送15001协议 显示tips
GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, tonumber(param_list[2]), tonumber(param_list[3]), tonumber(param_list[4]))
elseif param_list[1] == "scene" then --进入场景
local cur_id, target_id = SceneManager:getInstance():GetSceneId(), tonumber(param_list[2])
if SceneManager:getInstance():IsClickFindScene(cur_id, target_id) then
GlobalEventSystem:Fire(SceneEventType.REQUEST_CHANGE_SCENE, cur_id)
end
elseif param_list[1] == "scene2" then --进入场景
local cur_id, target_id = SceneManager:getInstance():GetSceneId(), tonumber(param_list[2])
if SceneManager:getInstance():IsClickFindScene(cur_id, target_id) then
local findVo = FindVo.New()
findVo.type = FindVo.POINT
findVo.sceneId = tonumber(param_list[2])
findVo.x = tonumber(param_list[3])
findVo.y = tonumber(param_list[4])
GlobalEventSystem:Fire(EventName.FIND,findVo)
end
elseif param_list[1] == "player" then --查看玩家信息
local name = param_list[2]
local role_id = tonumber(param_list[3])
if role_id~=0 then
SocialityModel:getInstance():Fire(SocialityModel.REQUEST_OTHER_INFO, role_id, x, y)
end
elseif param_list[1] == "player2" then --查看玩家信息
local name = param_list[2]
local role_id = tonumber(param_list[3])
local server_id = tonumber(param_list[4])
if role_id~=0 then
if server_id~=RoleManager.Instance.mainRoleInfo.server_id then
Message.show("外域玩家无法查看信息")
else
SocialityModel:getInstance():Fire(SocialityModel.REQUEST_OTHER_INFO, role_id, x, y)
end
end
elseif param_list[1] == "scene3" then --点击前往
local cur_id, target_id = SceneManager:getInstance():GetSceneId(), tonumber(param_list[2])
if cur_id~=target_id then
self:goBoss(param_list)
else
--正在场景中
if SceneManager:getInstance():IsWorldBeastScene() then --在幻兽之域中
self:onBeast(param_list)
else
local findVo = FindVo.New()
findVo.type = FindVo.POINT
findVo.sceneId = tonumber(param_list[2])
findVo.x = tonumber(param_list[3])/SceneObj.LogicRealRatio.x
findVo.y = tonumber(param_list[4])/SceneObj.LogicRealRatio.y
GlobalEventSystem:Fire(EventName.FIND,findVo)
end
end
elseif param_list[1] == "open_fun" then --打开功能
local winId = tonumber(param_list[2])
local subId = tonumber(param_list[3])
local parm = {}
for i,v in ipairs(param_list) do
if i == 3 and param_list[4] then
--传闻跳转如果要传值,那么第三个参数就应该是充当openfun的第二个传参作用
if tonumber(param_list[2]) == 461 then
--可是有的功能模块id和跳转实际使用的传参不对应的话,就要单独处理
table.insert( parm, 9 )--废都幻魔
elseif tonumber(param_list[2]) == 462 then
table.insert( parm, Config.ConfigBoss.ModuleId.BossHome )--boss之家
else
table.insert( parm, tonumber(v) )
end
elseif i > 3 then
table.insert( parm, tonumber(v) )
end
end
OpenFun.Open(winId, subId, unpack(parm))
elseif param_list[1] == "skill" then --用[%s(%d,%d)] 是否确认?", ColorUtil.PURPLE_DARK,name, tonumber(param_list[4]) / 100, tonumber(param_list[5]) / 100)
Alert.show(ask_str, Alert.Type.Two, ok ,nil,"确定","取消")
end
elseif param_list[1] == "pos_festival_boss" then --点击坐标
local function ok( ... )
local scene_id = tonumber(param_list[2])
local scene_info = SceneManager:getInstance():GetSceneInfo(scene_id)
local line = tonumber(param_list[3]) or 1
local cur_line = MapModel:getInstance():GetServerLine()
local x = tonumber(param_list[4]) or 0
local y = tonumber(param_list[5]) or 0
if scene_info then
if scene_id == SceneManager.Instance:GetSceneId() and line==cur_line then
--如果在当前场景当前线路,就直接寻路
local findVo = FindVo.New()
findVo.type = FindVo.POINT
findVo.sceneId = scene_id
findVo.x = x/SceneObj.LogicRealRatio.x
findVo.y = y/SceneObj.LogicRealRatio.y
GlobalEventSystem:Fire(EventName.FIND,findVo)
else
BossModel:GetInstance():Fire(BossConst.REQ_DESERTED_BOSS_SCMD,46028,tonumber(param_list[2]))
BossModel:GetInstance().festival_boss_find_way_data = DeepCopy(param_list)--保存跳转场景后的寻路参数
end
end
end
local scene_info = SceneManager.Instance:GetSceneInfo(tonumber(param_list[2]))
local name = ""
if scene_info then
name = Trim(scene_info.name)
local ask_str = string.format("即将寻路至 [%s(%d,%d)] 是否确认?", ColorUtil.PURPLE_DARK,name, tonumber(param_list[4]) / 100, tonumber(param_list[5]) / 100)
Alert.show(ask_str, Alert.Type.Two, ok ,nil,"确定","取消")
end
elseif param_list[1] == "mail" then --邮件
GlobalEventSystem:Fire(EventName.OPEN_SOCIALITY_VIEW, 3)
elseif param_list[1] == "url" then --跳转网页
local str = param_list[2]
elseif param_list[1] == "mate_show" then
MateModel:GetInstance():Fire(MateConst.REQ_LOOK_OTHER_MATE,param_list[2],param_list[3])
elseif param_list[1] == "showbaby" then--晒娃
--if RoleManager.Instance.mainRoleInfo.level < Config.Moduleopenlv["163@1"].lv then
-- Message.show("75级之后才可以逗逗TA的宝宝哦~")
--else
--Message.show("逗宝宝")
local data = {
child_name = param_list[2],
name = param_list[3],
role_id = param_list[4],
sex = param_list[5],
child_clothe_res_id = param_list[6],
career = param_list[7],
level = param_list[8],
turn = param_list[9],
profile_photo_id = param_list[10],
vip_flag = param_list[11],
sup_vip_type = param_list[12],
fashion_id = param_list[13],
child_level = param_list[14],
child_sex = param_list[15],
}
-- GlobalEventSystem:Fire(EventName.CLOSE_CHAT_VIEW)
ChildModel:GetInstance():Fire(ChildConst.OPEN_CHILD_CHAT_NICE_VIEW,true,data)
--end
elseif param_list[1] == "guild" then--加入社团
GuildModel:getInstance():Fire(GuildModel.ApplyJoinGuildEvt, param_list[2]) --申请加入社团
elseif param_list[1] == "guildScene" then --进入社团驻地
local guild_id = RoleManager.Instance.mainRoleInfo.guild_id
if not guild_id or guild_id == 0 then
Message.show("请先加入社团")
return
end
GuildModel:getInstance():Fire(GuildModel.ENTER_GUILD_BASE)
elseif param_list[1] == "redenvelopes" or param_list[1] == "actredenvelopes" then --抢社团红包
RedPacketModel:GetInstance():Fire(RedPacketModel.OPEN_GUILD_REDPACKET_VIEW, true) -- 只打开界面
elseif param_list[1] == "Pet" then --展示宠物
if not GetModuleIsOpen(163) then
Message.show("该功能暂未开启")
return
end
PetModel:getInstance():Fire(PetConst.REQUEST_CCMD_EVENT,16311,tonumber(param_list[2]),tonumber(param_list[3]))
elseif param_list[1] == "showPetSupport" then --跳到宠物声援界面
if not GetModuleIsOpen(163) then
Message.show("该功能暂未开启")
return
end
GlobalEventSystem:Fire(EventName.OPEN_PET_VIEW,2)
elseif param_list[1] == "showPetVote" then --跳到宠物投票界面
if not GetModuleIsOpen(163) then
Message.show("该功能暂未开启")
return
end
PetModel:getInstance():Fire(PetConst.OPEN_PET_VOTE_VIEW)
elseif param_list[1] == "showPetRank" then --跳到宠物榜单界面
if not GetModuleIsOpen(163) then
Message.show("该功能暂未开启")
return
end
PetModel:getInstance():Fire(PetConst.OPEN_PET_SUPPORT_RANK_VIEW)
elseif param_list[1] == BeachConst.GiftTagStr then
local role_id = tonumber(param_list[2])
if role_id == RoleManager.Instance.mainRoleInfo.role_id then
Message.show("不能给自己投票哦")
return
end
local num = 0
local data = BeachModel:GetInstance():GetMyInfo( )
if data then
num = data.vote_times or 0
end
if num > 0 then
local name_str = GetCSLongName( param_list[3], param_list[4] )
BeachModel:GetInstance():VoteToOher(name_str,role_id)
else
BeachModel:GetInstance():Fire(BeachConst.OPEN_BUY_VOTE)
end
elseif param_list[1] == "dunManyTeam" then --加入队伍
local is_aotu_ready = DunManyModel:getInstance():GetAotoReadyState()
DunManyModel:getInstance():Fire(DunManyModel.REQUEST_CCMD_EVENT,21503,param_list[2],param_list[3],0,is_aotu_ready and 1 or 0)
elseif param_list[1] == "dunManyGuardianTeam" then --加入绝地守卫队伍
if tonumber(param_list[4]) == 1 then
local data = {
dun_type = BaseDungeonModel.DUN_TYPE.GuardianThree,
team_id = param_list[2],
dun_id = param_list[3],
}
DunManyModel.Instance:Fire(DunManyModel.OPEN_PASSWORD_VIEW, data)
else
local is_aotu_ready = DunManyModel:getInstance():GetAotoReadyState()
DunManyModel:getInstance():Fire(DunManyModel.REQUEST_CCMD_EVENT,21503,param_list[2],param_list[3],0,is_aotu_ready and 1 or 0)
end
elseif param_list[1] == "guild_rec" then --公会招募
local main_role = RoleManager.Instance.mainRoleInfo
if main_role.guild_id ~= 0 then
Message.show("您已经有社团了!")
else
GuildModel:getInstance():Fire(GuildModel.ApplyJoinGuildEvt, param_list[2])
end
elseif param_list[1] == "firstrecharge" then --首充
local server_info = RechargeActivityModel:getInstance():GetFirstRechargeInfo()
if server_info and server_info.open == 0 then
OpenFun.Open(450,1)
else
local is_get_over = false--是否已经领完
for i,v in ipairs(server_info.product_list) do
if v.state ~= 2 then
is_get_over = false
break
else
is_get_over = v.state == 2
end
end
if is_get_over then
OpenFun.Open(450,1)
else
RechargeActivityModel:getInstance():Fire(RechargeActivityModel.OPEN_FIRST_RECHARGE_VIEW)
end
end
elseif param_list[1] == "fortuneCat" then -- 招财猫
local event_data = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.FORTUNE_CAT)
if event_data then
local sub_type = event_data.sub_type
FortuneCatModel:getInstance():Fire(FortuneCatModel.OPEN_FORTUNE_CAT_VIEW, true, sub_type)
end
elseif param_list[1] == "racerank" then --竞榜
-- GlobalEventSystem:Fire(CompetingListModel.OPEN_COMPETING_LIST_VIEW, tonumber(param_list[3]))
GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,tonumber(param_list[3]),KfActivityModel.TabID.Competing)
elseif param_list[1] == "kfGroupBuying" then --开服团购活动
GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,nil,KfActivityModel.TabID.GroupBuying)
elseif param_list[1] == "mobilizationGroupBuying" then
GlobalEventSystem:Fire(MobilizationModel.OPEN_MOBILIZATION_VIEW,tonumber(param_list[2]),tonumber(param_list[3]))
elseif param_list[1] == "marble" then
local need_lv = GetModuleOpenLevel(331,6)
local cur_lv = RoleManager.Instance.mainRoleInfo.level
if cur_lv >= need_lv then
RechargeActivityModel:getInstance():Fire(RechargeActivityModel.OPEN_DAILY_RECHARGE_VIEW,nil,DailyRechargeBaseView.ShowType.Pellet)
else
Message.show(string.format( "该功能%d级开启", need_lv ))
end
elseif param_list[1] == "mono" then --大富翁
GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,nil,KfActivityModel.TabID.Monopoly)
elseif param_list[1] == "contract" then --我也要解锁
local sub_type = tonumber(param_list[2])
local act_info = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.CONTRACT, sub_type)
if act_info and RoleManager.Instance.mainRoleInfo.level >= Config.Modulesub["331@74"].open_lv then
local pay_state = ContractModel:getInstance():GetPayState( sub_type )
if pay_state == ContractConst.PayState.Lock then
ContractModel:getInstance():Fire(ContractConst.OPEN_UNLOCK_VIEW,sub_type)
else
local id = 33100000 + CustomActivityModel.CustomActBaseType.CONTRACT * 1000 + sub_type
GlobalEventSystem:Fire(FuliConst.OPEN_FULI_MAIN_VIEW, id)
end
else
Message.show("活动已经结束了哦~")
end
elseif param_list[1] == "contractLv" then --我也要升级
local sub_type = tonumber(param_list[2])
local act_info = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.CONTRACT, sub_type)
if act_info and RoleManager.Instance.mainRoleInfo.level >= Config.Modulesub["331@74"].open_lv then
local id = 33100000 + CustomActivityModel.CustomActBaseType.CONTRACT * 1000 + sub_type
GlobalEventSystem:Fire(FuliConst.OPEN_FULI_MAIN_VIEW, id)
else
Message.show("活动已经结束了哦~")
end
elseif param_list[1] == "escortHelp" then --护送协助
local role_id = RoleManager.Instance.mainRoleInfo.role_id
if role_id == tonumber(param_list[4]) then
Message.show("不能协助自己哦~")
else
local data = {
support_cfg_id = 4,
name = param_list[3],
support_sid = param_list[2],
}
GuildModel:getInstance():Fire(GuildModel.OPEN_GUILD_SUPPORT_GO_VIEW,data)
end
elseif param_list[1] == "guild_csgr_enter" then -- 本国团战
GlobalEventSystem:Fire(EventName.OPEN_ACITVITY_TIP, 410, 1, nil)
elseif param_list[1] == "bosspass" or param_list[1] == "bosspassLv" then
--幻魔宝典
local need_lv = GetModuleOpenLevel(331,104)
local cur_lv = RoleManager.Instance.mainRoleInfo.level
if cur_lv >= need_lv then
OpenFun.Open(331,104)
else
Message.show(string.format( "该功能%d级开启", need_lv ))
end
elseif param_list[1] == "hopegift" then--臻享礼包
local sub_type = tonumber(param_list[2])
local is_open = HopeGiftModel:getInstance():CheckActIsOpen(sub_type)
if is_open then
if RoleManager.Instance.mainRoleInfo.vip_flag >= 4 then
GlobalEventSystem:Fire(EventName.OPEN_VIP_VIEW,3316500 + sub_type)
else
Message.show("您的VIP等级不足,请先提升VIP等级!","fault")
end
else
Message.show("您的VIP等级不足,请先提升VIP等级!","fault")
end
elseif param_list[1] == "compose" then--合成机回答问题
if tonumber(param_list[2]) and tonumber(param_list[3]) and tonumber(param_list[4]) then
OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33292, tonumber(param_list[2]), 1, tonumber(param_list[3]), tonumber(param_list[4]))
end
elseif param_list[1] == "recruitFriends" then--招募好友
local herf_copntent = string.format("[添加好友]",RoleManager.Instance.mainRoleInfo.role_id)
local des_cfg = Config.AssistantChat.AddFriendDes
local random_num = math.random(1, TableSize(des_cfg))
local add_freiend_des = Config.AssistantChat.AddFriendDes[random_num]
local content = string.format("%s%s", add_freiend_des, herf_copntent)
ChatModel:getInstance():Fire(ChatModel.SEND_MSG,ChatModel.CHANNEL_WORLD,content)
GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
GlobalEventSystem:Fire(EventName.OPEN_CHAT_VIEW,ChatModel.CHANNEL_WORLD)
elseif param_list[1] == "assistDoMainTask" then--小助手聊天前往做主线
GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
GlobalEventSystem:Fire(EventName.FORCE_TO_DO_TASK, true, true)
elseif param_list[1] == "assistDoDailyTask" then--小助手聊天前往做经验跑环
GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
TaskModel:getInstance():DoBountyTask()
elseif param_list[1] == "assistDoGuildTask" then--小助手聊天前往做社团跑环
GlobalEventSystem:Fire(EventName.CLOSE_SOCIALITY_VIEW)
TaskModel:getInstance():DoGuildTask()
elseif param_list[1] == "addFriend" then--添加好友
local role_id = tonumber(param_list[2])
if role_id == RoleManager.Instance.mainRoleInfo.role_id then
Message.show("不能添加自己为好友")
elseif SocialityModel:getInstance():IsRelaviveType(role_id, Config.ConfigSocial.RelativeType.friend) then
Message.show("对方已经是好友了")
else
SocialityModel:getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14003, role_id)
Message.show("已添加对方为好友")
end
elseif param_list[1] == "jumpCapsuleEgg" then -- 龙神宝库
OpenFun.Open(170,1)
elseif param_list[1] == "card" then -- 尊享卡
if VipModel.getInstance():GetVipLevel() < 1 or not GetModuleIsOpen(450, 6) then
Message.show("功能未开启")
return
end
OpenFun.Open(450,6)
elseif param_list[1] == "mobilize" then--全民动员
local subtype = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.MOBILIZATION)
GlobalEventSystem:Fire(MobilizationModel.OPEN_MOBILIZATION_VIEW,subtype)
elseif param_list[1] == "treasure" then -- 藏宝图
local event_type = tonumber(param_list[2])
if event_type == 1 then -- 打开宝图介绍界面
-- TreasureMapModel:getInstance():Fire(TreasureMapConst.OPEN_DESC_VIEW, true)
OpenFun.Open(424, 1)
elseif event_type == 2 then -- 跳转到藏宝图boss位置
local pos_cfg = Config.Treasuremappos[tonumber(param_list[3])]
if not pos_cfg then return end
local pos_data = stringtotable(pos_cfg.pos)
local scene_id = tonumber(pos_data[1])
local x = tonumber(pos_data[2]) or 0
local y = tonumber(pos_data[3]) or 0
local findVo = FindVo.New()
findVo.type = FindVo.POINT
findVo.x = x / SceneObj.LogicRealRatio.x
findVo.y = y / SceneObj.LogicRealRatio.y
findVo.sceneId = scene_id
findVo.call_back = function()
GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT,false,true)
end
local function ok( ... )
local use_shoe = VipModel:getInstance():CanFreeUseShoe()
local function find_way_func()
if SceneManager:getInstance():GetSceneId() ~= findVo.sceneId then -- 场景不同,先切场景
GlobalEventSystem:Fire(SceneEventType.REQUEST_CHANGE_SCENE, findVo.sceneId, nil, SceneTransType.World)
else
GlobalEventSystem:Fire(EventName.FIND, findVo)
end
end
if self.tm_fly_delay_id then
TimerQuest.CancelQuest(GlobalTimerQuest, self.tm_fly_delay_id)
self.tm_fly_delay_id = false
end
if use_shoe then
local end_pos = GameMath.GetPosByCeterPoint(findVo.x * SceneObj.LogicRealRatio.x,findVo.y * SceneObj.LogicRealRatio.y, 100)
local function callback()
if findVo.sceneId == SceneManager:getInstance():GetSceneId() then
find_way_func()
else
self.tm_fly_delay_id = setTimeout(find_way_func, 0.5)
end
end
GlobalEventSystem:Fire(EventName.USE_FLY_SHOE, findVo.sceneId, end_pos.x, end_pos.y, callback)
else
find_way_func()
end
end
local scene_info = SceneManager.Instance:GetSceneInfo(scene_id)
local name = ""
if scene_info then
name = Trim(scene_info.name)
local ask_str = string.format("即将寻路至 [%s(%d,%d)] 是否确认?",
ColorUtil.PURPLE_DARK, name, findVo.x, findVo.y)
Alert.show(ask_str, Alert.Type.Two, ok, nil, "确定", "取消")
end
end
end
end
end
function ChuanWenController:goBoss( param_list )
do return end
--需要前往boss场景
local boss_type = tonumber(param_list[5])
local scene_id = tonumber(param_list[2])
local boss_id = tonumber(param_list[6])
local layers
for k,v in pairs(Config.Bosscfg) do
if v.scene==scene_id then
layers = v.layers
end
end
if SceneManager.Instance:IsBossPersonScene(scene_id) then
GlobalEventSystem:Fire(EventName.OPEN_BOSS_VIEW, Config.ConfigBoss.ModuleId.Person ,boss_id)
return
end
if boss_id then
-- BossModel:GetInstance().need_find_pos = Vector2(tonumber(param_list[3])/SceneObj.LogicRealRatio.x
-- , tonumber(param_list[4])/SceneObj.LogicRealRatio.y)
end
end
function ChuanWenController:goBeast(param_list)
--需要前往幻兽之域
local boss_id = tonumber(param_list[5])
local cfg = boss_id and Config.Eudemonsbosscfg[boss_id]
if cfg then --是boss
WorldModel:getInstance():Fire(WorldModel.REQUEST_CCMD_EVENT, 47003, WorldModel.BossType.BEAST, boss_id)
else --其他
--随便拿一个bossid进入场景,前往坐标点
for i, v in pairs(Config.Eudemonsbosscfg) do
if v.scene == tonumber(param_list[2]) then
boss_id = i
break
end
end
WorldModel:getInstance():Fire(WorldModel.REQUEST_CCMD_EVENT, 47003, WorldModel.BossType.BEAST, boss_id)
WorldModel:getInstance().need_find_pos = Vector2(tonumber(param_list[3])/SceneObj.LogicRealRatio.x
, tonumber(param_list[4])/SceneObj.LogicRealRatio.y)
end
end
function ChuanWenController:onBeast(param_list)
local boss_id = tonumber(param_list[5])
local cfg = boss_id and Config.Eudemonsbosscfg[boss_id]
if not cfg then
WorldModel:getInstance().need_find_pos = Vector2(tonumber(param_list[3])/SceneObj.LogicRealRatio.x,
tonumber(param_list[4])/SceneObj.LogicRealRatio.y)
end
WorldModel:getInstance():Fire(WorldModel.ON_FIND_MONSTER, boss_id)
end
--是否能够前往该场景
function ChuanWenController:CanEnterScene(desc)
local list = Split(desc, "@")
for i, v in ipairs(list) do
if v == "scene3" then
local scene_id = tonumber(list[i+1])
if SceneManager.Instance:IsWorldBeastScene(scene_id) then --前往幻兽之域
--不满足进入该场景条件
local layer = SceneManager.Instance:IsWorldBeastScene(scene_id)
local lv, vip = WorldModel:getInstance():GetBeastCondition(layer)
if RoleManager.Instance.mainRoleInfo.level < lv or RoleManager.Instance.mainRoleInfo.vip_flag < vip then
return false
end
end
end
end
return true
end