源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1217 lines
39 KiB

пре 1 месец
  1. require("game.proto.146.Require146")
  2. require("game.foster.FosterConst")
  3. require("game.foster.FosterModel")
  4. require("game.foster.view.FosterBaseView")
  5. require("game.foster.view.FosterSubView")
  6. require("game.foster.view.FosterSubViewNew")
  7. require("game.foster.view.FosterSkinView")
  8. require("game.foster.view.FosterAttrItem")
  9. require("game.foster.view.FosterTabItem")
  10. require("game.foster.view.FosterSubTabItem")
  11. require("game.foster.view.FosterSkinTabItem")
  12. require("game.foster.view.FosterSkillItem")
  13. require("game.foster.view.FosterBlessView")
  14. require("game.foster.view.FosterSkillTips")
  15. require("game.foster.view.FosterEquipItem")
  16. require("game.foster.view.FosterEquipBaseView")
  17. require("game.foster.view.FosterEquipTipView")
  18. require("game.foster.view.FosterAttrItemTwo")
  19. require("game.foster.view.FosterAttrItemThree")
  20. require("game.foster.view.FosterUpEquipView")
  21. require("game.foster.view.FosterKernelView")
  22. require("game.foster.view.FosterKernelItem")
  23. require("game.foster.view.FosterKernelTips")
  24. require("game.foster.view.FosterEquipingView")
  25. require("game.foster.view.FosterEquipingTabItem")
  26. -- require("game.foster.view.FosterBagView")--逻辑修改已弃用
  27. FosterController = FosterController or BaseClass(BaseController, true)
  28. local FosterController = FosterController
  29. function FosterController:__init()
  30. FosterController.Instance = self
  31. self.model = FosterModel:GetInstance()
  32. self:AddEvents()
  33. self:RegisterAllProtocal()
  34. end
  35. function FosterController:__delete()
  36. self:StopShowUpCostTimer()
  37. end
  38. function FosterController:RegisterAllProtocal( )
  39. self:RegisterProtocal(14600, "on14600")--基础系统信息
  40. self:RegisterProtocal(14601, "on14601")--普通系统培养
  41. self:RegisterProtocal(14602, "on14602")--使用核心
  42. self:RegisterProtocal(14603, "on14603")--幻化协议
  43. self:RegisterProtocal(14604, "on14604")--技能升级
  44. self:RegisterProtocal(14605, "on14605")--技能激活通知
  45. self:RegisterProtocal(14606, "on14606")--装备升级
  46. self:RegisterProtocal(14607, "on14607")--装备穿戴
  47. self:RegisterProtocal(14608, "on14608")--装备更新
  48. self:RegisterProtocal(14609, "on14609")--骑乘状态修改
  49. self:RegisterProtocal(14613, "on14613")--新手激活推送
  50. self:RegisterProtocal(14614, "on14614")--进阶装备助战状态查询 - 全量数据
  51. self:RegisterProtocal(14615, "on14615")--进阶装备助战状态查询 - 单个查询
  52. self:RegisterProtocal(14616, "on14616")--手动激活进阶装备助战状态
  53. self:RegisterProtocal(14617, "on14617")--弱进阶系统皮肤信息
  54. self:RegisterProtocal(14618, "on14618")--弱进阶系统皮肤激活或者升星
  55. self:RegisterProtocal(14619, "on14619")--弱进阶系统皮肤幻化
  56. self:RegisterProtocal(14620, "on14620")--弱进阶系统升级
  57. self:RegisterProtocal(14621, "on14621")--助战变更后推送
  58. end
  59. function FosterController:AddEvents()
  60. local function init_open_day()
  61. self.model:Reset()
  62. local function delay( )
  63. for k,v in pairs(FosterConst.ModuleId) do
  64. if GetModuleIsOpen(146,v) then
  65. self.model:Fire(FosterConst.ReqBasicInfo, v)
  66. if v>=5 then
  67. self.model:Fire(FosterConst.ReqSubSkinInfo, v)
  68. end
  69. -- 请求装备协助相关
  70. if v == FosterConst.ModuleId.FHorse or v == FosterConst.ModuleId.FJarvis then
  71. self.model:Fire(FosterConst.ReqEquipAssistInfo, v)
  72. end
  73. end
  74. end
  75. end
  76. setTimeout(delay,2)
  77. end
  78. GlobalEventSystem:Bind(EventName.OPEN_DAY_INIT, init_open_day)
  79. local function loadComplete()
  80. --在不显示坐骑的场景,要下坐骑噢!
  81. local is_ride = RoleManager:getInstance():GetMainRoleVo() and (RoleManager:getInstance():GetMainRoleVo().is_ride ~= 0)
  82. if is_ride and (not SceneManager:getInstance():IsShowHorseScene()) then
  83. GlobalEventSystem:Fire(EventName.HIDE_HORSE)
  84. end
  85. end
  86. GlobalEventSystem:Bind(EventName.SCENE_LOAD_VIEW_COMPLETE, loadComplete)
  87. local function onLevelChange( level )
  88. for k,v in pairs(FosterConst.ModuleId) do
  89. if Config.Modulesub["146@" .. v] and (Config.Modulesub["146@" .. v].open_lv == level or Config.Modulesub["146@" .. v].icon_lv == level) then
  90. -- 幻化初始外观
  91. -- self.model:Fire(FosterConst.ReqChangeSkin, v, 1)
  92. self.model:Fire(FosterConst.ReqBasicInfo, v)
  93. -- 请求装备协助相关
  94. if v == FosterConst.ModuleId.FHorse or v == FosterConst.ModuleId.FJarvis then
  95. self.model:Fire(FosterConst.ReqEquipAssistInfo, v)
  96. end
  97. end
  98. end
  99. end
  100. RoleManager:getInstance().mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelChange)
  101. local function ANS_FINISHED_TASK_LIST( task_id )
  102. if task_id == Config.Modulesub["146@5"].task_id then
  103. --ai娘后端会提早开出来,所以要前端先不显示场景对象,任务完成的时候再更新显示
  104. local main_role = Scene.Instance:GetMainRole()
  105. if main_role then
  106. main_role:ChangePet()
  107. end
  108. end
  109. end
  110. GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST,ANS_FINISHED_TASK_LIST)
  111. --基础系统信息
  112. local function ReqBasicInfo( type_id )
  113. if type_id then
  114. self:SendFmtToGame(14600, "c", type_id)
  115. end
  116. end
  117. self.model:Bind(FosterConst.ReqBasicInfo, ReqBasicInfo)
  118. --普通系统培养
  119. local function ReqStrengthen( type_id, is_auto_up, is_auto_buy, auto_bgold )
  120. is_auto_up = is_auto_up and 1 or 0
  121. is_auto_buy = is_auto_buy and 1 or 0
  122. auto_bgold = auto_bgold or 0-- 0 红钻不足后停止,1 会消耗彩钻
  123. if type_id then
  124. self:SendFmtToGame(14601, "cccc", type_id, is_auto_up, is_auto_buy, auto_bgold)
  125. end
  126. end
  127. self.model:Bind(FosterConst.ReqStrengthen, ReqStrengthen)
  128. --弱进阶系统皮肤信息
  129. local function ReqSubSkinInfo(type_id)
  130. if type_id then
  131. self:SendFmtToGame(14617, "c", type_id)
  132. end
  133. end
  134. self.model:Bind(FosterConst.ReqSubSkinInfo, ReqSubSkinInfo)
  135. -- 弱进阶皮肤请求激活或升星
  136. local function req_sub_skin_act_or_up(type_id, skin_id, option)
  137. if type_id and skin_id and option then
  138. self:SendFmtToGame(14618, "chc", type_id, skin_id, option)
  139. end
  140. end
  141. self.model:Bind(FosterConst.ReqSubSkinActiveOrUpGrade, req_sub_skin_act_or_up)
  142. local function req_sub_skin_change(type_id, skin_id, star)
  143. if type_id and skin_id and star then
  144. self:SendFmtToGame(14619, "chh", type_id, skin_id, star)
  145. end
  146. end
  147. self.model:Bind(FosterConst.ReqSubSkinChange, req_sub_skin_change)
  148. --弱进阶系统使用升级材料
  149. local function ReqSubUpgrade( type_id, material_type, is_auto_up)
  150. material_type = material_type or 1
  151. is_auto_up = is_auto_up and 1 or 0
  152. if type_id then
  153. self:SendFmtToGame(14620, "ccc", type_id, material_type, is_auto_up)
  154. end
  155. end
  156. self.model:Bind(FosterConst.ReqSubUpgrade, ReqSubUpgrade)
  157. --使用核心
  158. local function ReqUseKernel( type_id, op_type, num )
  159. op_type = op_type or 0
  160. num = num or 1
  161. if type_id then
  162. self:SendFmtToGame(14602, "ccc", type_id, op_type, num)
  163. end
  164. end
  165. self.model:Bind(FosterConst.ReqUseKernel, ReqUseKernel)
  166. --幻化协议
  167. local function ReqChangeSkin( type_id, diaplay_id )
  168. if type_id and diaplay_id then
  169. self:SendFmtToGame(14603, "ch", type_id, diaplay_id)
  170. end
  171. end
  172. self.model:Bind(FosterConst.ReqChangeSkin, ReqChangeSkin)
  173. --技能升级
  174. local function ReqSkillUpgrade( type_id, pos )
  175. if type_id and pos then
  176. self:SendFmtToGame(14604, "cc", type_id, pos)
  177. end
  178. end
  179. self.model:Bind(FosterConst.ReqSkillUpgrade, ReqSkillUpgrade)
  180. --装备升级
  181. local function ReqEquipUpGrade( type_id, grade, pos, eats )
  182. if type_id and grade and pos and eats then
  183. self:WriteBegin(14606)
  184. self:WriteFMT("c", type_id)
  185. self:WriteFMT("h", grade)
  186. self:WriteFMT("c", pos)
  187. self:WriteFMT("h", TableSize(eats))
  188. for k, v in pairs(eats) do
  189. self:WriteFMT("l", k)
  190. end
  191. self:SendToGame()
  192. end
  193. end
  194. self.model:Bind(FosterConst.ReqEquipUpGrade, ReqEquipUpGrade)
  195. --装备穿戴
  196. local function ReqEquipDress( opty, type_id, grade, goods_id )
  197. if opty and type_id and grade and goods_id then
  198. self:SendFmtToGame(14607, "cchl", opty, type_id, grade, goods_id )
  199. end
  200. end
  201. self.model:Bind(FosterConst.ReqEquipDress, ReqEquipDress)
  202. local function OPEN_SUCCESS_VIEW( type_id,id,star )
  203. print('----LZR ShapeController.lua 92-- type_id,id,star=',type_id,id,star)
  204. if not self.shapesuccessview then
  205. self.shapesuccessview = ShapeSuccessView.New()
  206. self.shapesuccessview:Open(type_id,id,star, true)
  207. end
  208. end
  209. self.model:Bind(FosterConst.OPEN_SUCCESS_VIEW,OPEN_SUCCESS_VIEW)
  210. local function ReqEquipDressInfo( type_id,grade )
  211. if not type_id or not grade then return end
  212. self:SendFmtToGame(14608, "ch", type_id,grade )
  213. end
  214. self.model:Bind(FosterConst.ReqEquipDressInfo, ReqEquipDressInfo)
  215. --骑乘状态修改
  216. local function Change_Ride_Status( op_type )
  217. --非显示坐骑场景,不给上坐骑
  218. if op_type == 1 and not SceneManager:getInstance():IsShowHorseScene() then
  219. Message.show("该场景不能上坐骑哦")
  220. return
  221. end
  222. op_type = op_type or 0
  223. -------------------------
  224. --要筛选不能转换状态的情况,下坐骑就不限制了
  225. local main_role = Scene:getInstance():GetMainRole()
  226. if main_role then
  227. if op_type == 1 then
  228. --在部分不能上坐骑的地方,不要让它上坐骑
  229. if not main_role:CanOperateHorse() then
  230. Message.show("当前状态不能上坐骑哦")
  231. return
  232. end
  233. end
  234. end
  235. -------------------------
  236. if GetModuleIsOpen(146,1) then
  237. self:SendFmtToGame(14609, "c", op_type )
  238. end
  239. end
  240. self.model:Bind(FosterConst.Change_Ride_Status, Change_Ride_Status)
  241. local function require_equip_assist_info(type)
  242. if not type then return end
  243. self:SendFmtToGame(14614, "c", type)
  244. end
  245. self.model:Bind(FosterConst.ReqEquipAssistInfo, require_equip_assist_info)
  246. local function check_equip_assist_info(type, grade)
  247. if not type or not grade then return end
  248. self:SendFmtToGame(14615, "ch", type, grade)
  249. end
  250. self.model:Bind(FosterConst.CheckEquipAssistInfo, check_equip_assist_info)
  251. local function require_activate_equip_assist(type, grade)
  252. if not type or not grade then return end
  253. self:SendFmtToGame(14616, "ch", type, grade)
  254. end
  255. self.model:Bind(FosterConst.ReqActivateEquipAssist, require_activate_equip_assist)
  256. local function HIDE_HORSE( )
  257. --下坐骑
  258. Change_Ride_Status(0)
  259. end
  260. GlobalEventSystem:Bind(EventName.HIDE_HORSE,HIDE_HORSE)
  261. local function RIDE_HORSE( )
  262. if EscortModel:getInstance():IsEscortState() then--护送不给上坐骑
  263. return
  264. end
  265. --上坐骑
  266. Change_Ride_Status(1)
  267. end
  268. GlobalEventSystem:Bind(EventName.RIDE_HORSE,RIDE_HORSE)
  269. local function OpenBaseView( type_id, right_show_type,is_skin)
  270. -- print("Lizhijian:FosterController [start:298] ")
  271. -- print(type_id, right_show_type,is_skin)
  272. -- print("Lizhijian:FosterController [end:298] ")
  273. if not self.FosterBaseView then
  274. self.FosterBaseView = FosterBaseView.New(nil, nil, nil,type_id,right_show_type,is_skin)
  275. self.FosterBaseView:Open()
  276. else
  277. self.FosterBaseView:ReOpen(type_id,right_show_type,is_skin)
  278. end
  279. end
  280. GlobalEventSystem:Bind(FosterConst.OpenBaseView, OpenBaseView)
  281. local function OpenKernelView( type_id )
  282. if not type_id then
  283. if self.FosterKernelView then
  284. self.FosterKernelView:Close()
  285. end
  286. return
  287. end
  288. if not self.FosterKernelView then
  289. self.FosterKernelView = FosterKernelView.New()
  290. self.FosterKernelView:Open(type_id)
  291. end
  292. end
  293. self.model:Bind(FosterConst.OpenKernelView,OpenKernelView)
  294. local function OpenSkinView( type_id, sub_type_id)
  295. if self.FosterBaseView then
  296. self.FosterBaseView:Close()
  297. local function delay_method()
  298. local is_skin = true
  299. GlobalEventSystem:Fire(FosterConst.OpenBaseView, type_id, sub_type_id, is_skin)
  300. end
  301. self.delay_method_id = setTimeout(delay_method, 0.5)
  302. end
  303. end
  304. self.model:Bind(FosterConst.OpenSkinView,OpenSkinView)
  305. local function OpenEquipingView( type_id,grade,equip_pos,equip_color)
  306. if not type_id then
  307. if self.FosterEquipingView then
  308. self.FosterEquipingView:Close()
  309. end
  310. return
  311. end
  312. if not self.FosterEquipingView then
  313. self.FosterEquipingView = FosterEquipingView.New()
  314. self.FosterEquipingView:Open(type_id,grade,equip_pos,equip_color)
  315. end
  316. end
  317. self.model:Bind(FosterConst.OpenEquipingView,OpenEquipingView)
  318. local function OpenBlessView( type_id )
  319. if not type_id then
  320. self.model:Fire(FosterConst.CloseBaseView)
  321. return
  322. end
  323. if not self.FosterBlessView then
  324. self.FosterBlessView = FosterBlessView.New()
  325. self.FosterBlessView:Open(type_id)
  326. end
  327. end
  328. self.model:Bind(FosterConst.OpenBlessView, OpenBlessView)
  329. local function OpenSkillTips( type_id, pos, skill_id )
  330. if not type_id or not pos or not skill_id then
  331. return
  332. end
  333. if not self.FosterSkillTips then
  334. self.FosterSkillTips = FosterSkillTips.New()
  335. self.FosterSkillTips:Open(type_id, pos, skill_id)
  336. end
  337. end
  338. self.model:Bind(FosterConst.OpenSkillTips,OpenSkillTips)
  339. --技能tips界面里跳转到商店时,关闭这个tips
  340. local function CloseSkillTips()
  341. if self.FosterSkillTips and self.FosterSkillTips.isPop then
  342. self.FosterSkillTips:Close()
  343. end
  344. end
  345. self.model:Bind(FosterConst.CloseSkillTips,CloseSkillTips)
  346. -- local function OpenFosterBagView( type_id,grade,pos )
  347. -- if not grade then return Message.show("进阶背包参数错误") end
  348. -- if not self.FosterBagView then
  349. -- self.model:SetDressAction(type_id,grade,pos)
  350. -- -------------------------
  351. -- self.FosterBagView = FosterBagView.New()
  352. -- self.FosterBagView:Open(type_id,grade,pos)
  353. -- end
  354. -- end
  355. -- self.model:Bind(FosterConst.OpenFosterBagView,OpenFosterBagView)
  356. local function OpenFosterEquipTipView( data_1,data_2,tag,open_show_get_way,hide_base_con )
  357. --要传入背包的信息!!!!
  358. if not data_1 and not data_2 then return end
  359. if not self.FosterEquipBaseView then
  360. self.FosterEquipBaseView = FosterEquipBaseView.New()
  361. self.FosterEquipBaseView:Open(data_1,data_2,tag,open_show_get_way,hide_base_con)
  362. end
  363. end
  364. self.model:Bind(FosterConst.OpenFosterEquipTipView,OpenFosterEquipTipView)
  365. local function OpenFosterUpEquipView( bag_data )
  366. if not bag_data then return end
  367. --要传入背包的信息!!!!
  368. if not self.FosterUpEquipView then
  369. self.FosterUpEquipView = FosterUpEquipView.New()
  370. self.FosterUpEquipView:Open(bag_data)
  371. end
  372. end
  373. self.model:Bind(FosterConst.OpenFosterUpEquipView,OpenFosterUpEquipView)
  374. local function BOARD_CLOSE_FUNC_OPEN_VIEW( )
  375. if self.wait_show_up_success_call then
  376. self.wait_show_up_success_call()
  377. self.wait_show_up_success_call = false
  378. end
  379. end
  380. GlobalEventSystem:Bind(EventName.BOARD_CLOSE_FUNC_OPEN_VIEW, BOARD_CLOSE_FUNC_OPEN_VIEW)
  381. end
  382. --基础系统信息
  383. function FosterController:on14600( )
  384. local scmd = SCMD14600.New(true)
  385. scmd.end_time = scmd.retime + TimeUtil:getServerTime()
  386. self.model:SetBasicInfo(scmd.type, scmd)
  387. local basic = self.model:GetBasicInfo(scmd.type)
  388. self.model:CheckRedDot( true,scmd.type )
  389. self:CheckRedDot()
  390. self.model:Fire(FosterConst.AnsBasicInfo,scmd.type)
  391. end
  392. --系统培养
  393. function FosterController:on14601( )
  394. local scmd = SCMD14601.New(true)
  395. if scmd.result == 1 then
  396. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  397. local star_change,grade_change = self.model:StrengthenCheckIsUpgrade(scmd)
  398. if star_change or grade_change then
  399. if grade_change then
  400. self:ShowUpSuccess(scmd.type,scmd.grade)
  401. end
  402. --升级重新请求
  403. local function delay( )
  404. self.model:Fire(FosterConst.ReqBasicInfo, scmd.type)
  405. end
  406. setTimeout(delay,0)
  407. -------------------------
  408. -- 升阶成功后需要检测是否弹出活动引导
  409. local temp = {
  410. [1] = scmd.type,
  411. [2] = scmd.grade,
  412. [3] = scmd.star,
  413. }
  414. KfActivityModel:getInstance():CheckNeedShowActGuide("foster", temp)
  415. elseif not self.model:RefreshStrengthenExp( scmd ) then
  416. --非升级就直接修改,未成功修改就请求数据
  417. self.model:Fire(FosterConst.ReqBasicInfo, scmd.type)
  418. end
  419. -- if not (star_change or grade_change) then
  420. -- Message.show(string.format( "升阶成功,祝福值+%d",scmd.exp ))
  421. -- else
  422. Message.show("升阶成功")
  423. -- end
  424. self.model:CanUpgrade(true,scmd.type)
  425. self.model:Fire(FosterConst.AnsStrengthen,(star_change or grade_change) and true or false)
  426. self:CheckRedDot()
  427. self.model:ResetPetFightSkillState()
  428. if ((not (star_change or grade_change)) and (scmd.auto_up == 1 and scmd.auto_buy == 0)) or
  429. --自动进阶且非自动购买的时候,还没升级说明资源耗尽
  430. (self.model:IsFirstForsterAdvance() and KfActivityModel:getInstance():CheckFosterRechargeAdsShow( scmd.type, scmd.grade)) then
  431. self:ShowUpCostGoodsTips( scmd.type, scmd.grade, scmd.auto_up, true )
  432. end
  433. else
  434. self.model:Fire(FosterConst.AnsStrengthen,"fail")
  435. --[[if then
  436. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.FAULT)
  437. lua_soundM:PlayEffect(self, "fault", false, LuaSoundManager.SOUND_TYPE.UI)
  438. GlobalEventSystem:Fire(EventName.OPEN_RECHARGE_TIP_VIEW, true)
  439. ErrorCodeShow(scmd.result)
  440. else--]]
  441. if scmd.result == 1003 or scmd.result == 1006 or scmd.result == 1001 then
  442. if scmd.result == 1006 and scmd.auto_up == 1 and scmd.auto_buy == 1 then
  443. local function call_yes( )
  444. local function delay( )
  445. self.model:Fire(FosterConst.ReqStrengthen, scmd.type, true,true, 1)
  446. end
  447. setTimeout(delay,0.3)
  448. end
  449. Alert.show('您的红钻已用完,需要开始消耗彩钻进阶,确认继续吗?', Alert.Type.Two, call_yes, nil, '确定', '取消')
  450. return
  451. end
  452. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.FAULT)
  453. lua_soundM:PlayEffect(self, "fault", false, LuaSoundManager.SOUND_TYPE.UI)
  454. self:ShowUpCostGoodsTips( scmd.type, scmd.grade, scmd.auto_up, false)
  455. else
  456. ErrorCodeShow(scmd.result)
  457. end
  458. end
  459. end
  460. function FosterController:ShowUpCostGoodsTips( type_id, grade, auto_up, is_success )
  461. local cost_data = self.model:GetGradeCost(type_id)
  462. if cost_data then
  463. local parm_list = {}
  464. --如果是成功,并且是第一次弹提示窗,才需要延时
  465. local is_delay_show = self.model:IsFirstForsterAdvance() and is_success
  466. -- 进阶抢购和进阶首充不同时出现 进阶首充的显示优先级高
  467. if KfActivityModel:getInstance():CheckFosterRechargeAdsShow( type_id, grade) then
  468. parm_list.foster_recharge_show = true
  469. else
  470. parm_list.show_limit_shop = true
  471. end
  472. for k,v in pairs(ShopModel:getInstance():GetGoodsListInfo( ShopType.BindGold )) do
  473. for a,b in pairs(v) do
  474. if b.goods_id == tonumber(cost_data[1][2]) then
  475. parm_list.shop_data = DeepCopy(b)
  476. -------------------------
  477. --填入一个缺少值
  478. parm_list.shop_data.first_buy_num = self.model:GetUpgradeNeedMoreCostNum(type_id, auto_up)
  479. -------------------------
  480. end
  481. end
  482. end
  483. self:StopShowUpCostTimer()
  484. if is_delay_show then
  485. local function delay_call_back( ... )
  486. self:StopShowUpCostTimer()
  487. local main_role = Scene.Instance:GetMainRole()
  488. if not main_role then
  489. return
  490. end
  491. self.model:SetFirstForsterAdvanceCookie()
  492. -- 传入当前类型和阶数
  493. parm_list.foster_data = {type = type_id, grade = grade}
  494. UIToolTipMgr:getInstance():AppendGoodsTips(cost_data[1][2], nil, nil,nil,nil,parm_list,nil,nil)
  495. end
  496. self.show_up_cost_timer = GlobalTimerQuest:AddDelayQuest(delay_call_back,1.5)
  497. else
  498. self.model:SetFirstForsterAdvanceCookie()
  499. -- 传入当前类型和阶数
  500. parm_list.foster_data = {type = type_id, grade = grade}
  501. UIToolTipMgr:getInstance():AppendGoodsTips(cost_data[1][2], nil, nil,nil,nil,parm_list,nil,nil)
  502. end
  503. end
  504. end
  505. function FosterController:StopShowUpCostTimer()
  506. if self.show_up_cost_timer then
  507. GlobalTimerQuest:CancelQuest(self.show_up_cost_timer)
  508. self.show_up_cost_timer = nil
  509. end
  510. end
  511. --使用核心
  512. function FosterController:on14602( )
  513. local scmd = SCMD14602.New(true)
  514. if scmd.result == 1 then
  515. Message.show("使用成功")
  516. -- 每次使用成功后请求基础数据更新
  517. self.model:Fire(FosterConst.ReqBasicInfo, scmd.type)
  518. self.model:Fire(FosterConst.AnsUseKernel,scmd.opty, scmd.result)
  519. self.model:CanKernel(true,scmd.type)
  520. self:CheckRedDot()
  521. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  522. else
  523. self.model:Fire(FosterConst.AnsUseKernel,scmd.opty, scmd.result)
  524. ErrorCodeShow(scmd.result)
  525. end
  526. end
  527. --幻化协议
  528. function FosterController:on14603( )
  529. local scmd = SCMD14603.New(true)
  530. if scmd.result == 1 then
  531. Message.show("幻化成功")
  532. if not self.model:RefreshSkinUseInfo( scmd.type, scmd.display ) then
  533. self.model:Fire(FosterConst.ReqBasicInfo, scmd.type)
  534. end
  535. self.model:Fire(FosterConst.AnsChangeSkin, scmd.type)
  536. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  537. else
  538. ErrorCodeShow(scmd.result)
  539. end
  540. end
  541. --技能升级
  542. function FosterController:on14604( )
  543. local scmd = SCMD14604.New(true)
  544. if scmd.result == 1 then
  545. Message.show("升级成功")
  546. self.model:RefreshSkillInfo(scmd.type, scmd)
  547. -------------------------
  548. self.model:CanSkillUpgradeByType( true,scmd.type )
  549. self:CheckRedDot()
  550. self.model:Fire(FosterConst.AnsSkillUpgrade)
  551. self.model:Fire(FosterConst.ReqBasicInfo, scmd.type)
  552. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  553. else
  554. ErrorCodeShow(scmd.result)
  555. end
  556. end
  557. --技能激活通知
  558. function FosterController:on14605( )
  559. local scmd = SCMD14605.New(true)
  560. self.model:RefreshSkillInfo(scmd.type, scmd)
  561. self.model:Fire(FosterConst.BoardSkillActive)
  562. if scmd.skill > 0 then
  563. local skill_data = {skill_id = scmd.skill, show_time = 15, ignore_auto_task = true}
  564. FuncOpenController.Instance:ShowSkill(skill_data)
  565. end
  566. -------------------------
  567. self.model:CanSkillUpgradeByType( true,scmd.type )
  568. self:CheckRedDot()
  569. end
  570. --装备升级
  571. function FosterController:on14606( )
  572. local scmd = SCMD14606.New(true)
  573. if scmd.res == 1 then
  574. Message.show("升级成功")
  575. self.model:ResetSwallowSelect()
  576. self.model:Fire(FosterConst.SwallowStatusChange)
  577. -------------------------
  578. self.model:Fire(FosterConst.AnsEquipUpGrade, scmd.type, scmd.grade)
  579. self.model:Fire(FosterConst.ReqEquipDressInfo,scmd.type,scmd.grade)
  580. -------------------------
  581. self.model:RefreshEquipRedData( scmd.type )
  582. self:CheckRedDot()
  583. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  584. else
  585. ErrorCodeShow(scmd.res)
  586. end
  587. end
  588. --装备穿戴
  589. function FosterController:on14607( )
  590. local scmd = SCMD14607.New(true)
  591. if scmd.res == 1 then
  592. if scmd.opty == 1 then
  593. Message.show("穿戴成功")
  594. else
  595. Message.show("卸下成功")
  596. end
  597. self.model:Fire(FosterConst.CloseFosterEquipTipView)
  598. self.model:Fire(FosterConst.CloseFosterBagView)
  599. self.model:Fire(FosterConst.AnsEquipDress, scmd.type, scmd.grade, scmd.opty, scmd.pos)
  600. self.model:Fire(FosterConst.ReqEquipDressInfo,scmd.type,scmd.grade)
  601. -------------------------
  602. self.model:RefreshEquipRedData( scmd.type )
  603. self:CheckRedDot()
  604. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  605. else
  606. ErrorCodeShow(scmd.res)
  607. end
  608. end
  609. --装备更新
  610. function FosterController:on14608( )
  611. local scmd = SCMD14608.New(true)
  612. self.model:RefreshEquipList( scmd.type,scmd.grade,scmd.equips )
  613. self.model:Fire(FosterConst.AnsEquipDressInfo)
  614. -------------------------
  615. self.model:RefreshEquipRedData( scmd.type )
  616. self:CheckRedDot()
  617. end
  618. --骑乘状态修改
  619. function FosterController:on14609( )
  620. local scmd = SCMD14609.New(true)
  621. if scmd.res==1 then
  622. else
  623. ErrorCodeShow(scmd.res)
  624. end
  625. end
  626. --新手激活推送
  627. function FosterController:on14613( )
  628. local scmd = SCMD14613.New(true)
  629. local reward_data = {show_name = "", show_list = {}}
  630. for k,v in pairs(scmd.awards) do
  631. table.insert(reward_data.show_list, {0, v.kdata, v.vdata})
  632. end
  633. self:ShowUpSuccess( scmd.type, scmd.grade, reward_data )
  634. end
  635. -- 进阶装备助战状态查询 - 全量数据
  636. function FosterController:on14614( )
  637. local vo = SCMD14614.New(true)
  638. self.model:SetFosterSuitAssistFlagData(vo)
  639. self:CheckRedDot()
  640. self.model:Fire(FosterConst.UPDATE_FOSTER_ASSIST_FLAG)
  641. end
  642. function FosterController:on14615( )
  643. local vo = SCMD14615.New(true)
  644. self.model:UpdateFosterSuitAssistFlagData(vo)
  645. self.model:CanActivateFosterAssist(true, vo.type)
  646. self:CheckRedDot()
  647. self.model:Fire(FosterConst.UPDATE_FOSTER_ASSIST_FLAG, vo.type, vo.grade)
  648. end
  649. function FosterController:on14616( )
  650. local vo = SCMD14616.New(true)
  651. if vo.errcode == 1 then -- 激活成功
  652. vo.state = 2 -- 成功写死2
  653. self.model:UpdateFosterSuitAssistFlagData(vo)
  654. self.model:CanActivateFosterAssist(true, vo.type)
  655. self:CheckRedDot()
  656. self.model:Fire(FosterConst.UPDATE_FOSTER_ASSIST_FLAG, vo.type, vo.grade)
  657. else
  658. ErrorCodeShow(vo.errcode)
  659. end
  660. end
  661. function FosterController:on14617()
  662. local vo = SCMD14617.New(true)
  663. self.model:SetFosterSubSkinData(vo.type, vo.skins)
  664. self.model:Fire(FosterConst.AnsSubSkinInfo, vo.type, vo.skins)
  665. self:CheckRedDot()
  666. end
  667. function FosterController:on14618()
  668. local vo = SCMD14618.New(true)
  669. if vo.result == 1 then -- 操作成功
  670. self:CheckRedDot()
  671. --激活成功
  672. if vo.star == 1 then
  673. self.model:Fire(FosterConst.ReqSubSkinChange, vo.type, vo.id, vo.star)
  674. end
  675. self.model:Fire(FosterConst.ReqSubSkinInfo, vo.type)
  676. self.model:Fire(FosterConst.OPEN_SUCCESS_VIEW, vo.type, vo.id, vo.star)
  677. else
  678. ErrorCodeShow(vo.result)
  679. end
  680. self.model:Fire(FosterConst.AnsSubSkinActiveOrUpGrade, vo)
  681. end
  682. function FosterController:on14619()
  683. local vo = SCMD14619.New(true)
  684. if vo.result == 1 then -- 操作成功
  685. -- self:CheckRedDot()
  686. self.model:Fire(FosterConst.ReqSubSkinInfo, vo.type)
  687. else
  688. ErrorCodeShow(vo.result)
  689. end
  690. self.model:Fire(FosterConst.AnsSubSkinChange, vo)
  691. end
  692. function FosterController:on14620()
  693. local vo = SCMD14620.New(true)
  694. if vo.result == 1 then -- 使用材料成功
  695. self:CheckRedDot()
  696. elseif vo.result ~= 1003 then
  697. ErrorCodeShow(vo.result)
  698. end
  699. self.model:Fire(FosterConst.AnsSubUpgrade, vo.result, vo.type, vo.material_type, vo.lv, vo.exp)
  700. end
  701. function FosterController:on14621()
  702. local vo = SCMD14621.New(true)
  703. self.model:Fire(FosterConst.ReqBasicInfo, vo.type)
  704. end
  705. -------------------------
  706. --进阶消耗材料变更
  707. function FosterController:UpGradeGoodsChange( )
  708. for k,v in pairs(FosterConst.ModuleId) do
  709. if GetModuleIsOpen(146,v) then
  710. self.model:CanUpgrade(true,v)
  711. end
  712. end
  713. self:CheckRedDot()
  714. --贵族培养丹兑换需要检测材料数量变化
  715. SupremeVipModel:getInstance():Fire(SupremeVipConst.UPDATE_TRAIN_DRUG_NUM)
  716. end
  717. --属性丹消耗材料变更
  718. function FosterController:UpKernelGoodsChange( )
  719. for k,v in pairs(FosterConst.ModuleId) do
  720. if GetModuleIsOpen(146,v) then
  721. self.model:CanKernel( true, v )
  722. end
  723. end
  724. self:CheckRedDot()
  725. end
  726. function FosterController:UpHorseEquipChange( )
  727. if GetModuleIsOpen(146,FosterConst.ModuleId.FHorse) then
  728. local bool_i = self.model:CanDressNewEquipWithType(true,FosterConst.ModuleId.FHorse)
  729. local bool_i = self.model:CanDressUpEquipWithType(true,FosterConst.ModuleId.FHorse)
  730. local bool_i = self.model:CanUpEquipWithType( true,FosterConst.ModuleId.FHorse )
  731. self:CheckRedDot()
  732. end
  733. end
  734. function FosterController:SkillGoodsChange( )
  735. for k,v in pairs(FosterConst.ModuleId) do
  736. if GetModuleIsOpen(146,v) then
  737. self.model:CanSkillUpgradeByType( true, v )
  738. end
  739. end
  740. self:CheckRedDot()
  741. end
  742. function FosterController:UpAIEquipChange( )
  743. if GetModuleIsOpen(146,FosterConst.ModuleId.FJarvis) then
  744. self.model:CanDressUpEquipWithType(true,FosterConst.ModuleId.FJarvis)
  745. self.model:CanDressUpEquipWithType(true,FosterConst.ModuleId.FJarvis)
  746. self.model:CanUpEquipWithType( true,FosterConst.ModuleId.FJarvis )
  747. self:CheckRedDot()
  748. end
  749. end
  750. --刷新AI娘SKin红点
  751. function FosterController:UpAISkinChange( )
  752. if GetModuleIsOpen(146,FosterConst.ModuleId.FJarvis) then
  753. self.model:CanSkinActOrUp( true,FosterConst.ModuleId.FJarvis )
  754. self:CheckRedDot()
  755. end
  756. end
  757. --刷新磁炮皮肤红点
  758. function FosterController:UpFGunChange( )
  759. if GetModuleIsOpen(146,FosterConst.ModuleId.FJarvis) then
  760. self.model:CanSkinActOrUp( true,FosterConst.ModuleId.FGun )
  761. self:CheckRedDot()
  762. end
  763. end
  764. --刷新星翼皮肤红点
  765. function FosterController:UpFcloudChange( )
  766. if GetModuleIsOpen(146,FosterConst.ModuleId.FJarvis) then
  767. self.model:CanSkinActOrUp( true,FosterConst.ModuleId.FCloud )
  768. self:CheckRedDot()
  769. end
  770. end
  771. --刷新幻甲SKin红点
  772. function FosterController:UpFArmourChange( )
  773. if GetModuleIsOpen(146,FosterConst.ModuleId.FJarvis) then
  774. self.model:CanSkinActOrUp( true,FosterConst.ModuleId.FArmour )
  775. self:CheckRedDot()
  776. end
  777. end
  778. function FosterController:CheckRedDot( )
  779. local function call_backack( )
  780. local list = {
  781. [1] = {
  782. FosterConst.ModuleId.FHorse, FosterConst.ModuleId.FWing,
  783. FosterConst.ModuleId.FPearl, FosterConst.ModuleId.FWeapon,
  784. },
  785. [2] = {
  786. FosterConst.ModuleId.FJarvis, FosterConst.ModuleId.FGun,
  787. FosterConst.ModuleId.FCloud, FosterConst.ModuleId.FArmour,
  788. }
  789. }
  790. local bool_1,bool_2 = false,false
  791. for k,v in pairs(list[1]) do
  792. if GetModuleIsOpen(146,v) then
  793. bool_1 = bool_1 or self.model:CheckRedDot( false,v )
  794. end
  795. end
  796. for k,v in pairs(list[2]) do
  797. if GetModuleIsOpen(146,v) then
  798. bool_2 = bool_2 or self.model:CheckRedDot( false,v )
  799. end
  800. end
  801. GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT, 146, bool_1)
  802. GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT, 146555, bool_2)
  803. -------------------------
  804. self.model:Fire(FosterConst.RedDotRefresh)
  805. self.model:CheckBlessClock( )--祝福值清空提示机制
  806. end
  807. TimeManager.GetInstance():StartTime("FosterController_CheckRedDot", 0.5, call_backack)
  808. end
  809. function FosterController:ShowUpSuccess( type_id, grade, reward_data )
  810. local function call_up_success( )
  811. if (not type_id) or (not grade) then return end
  812. local cur_data = self.model:GetBaseConfOne( type_id, grade, 0 )
  813. if not cur_data then return end
  814. local attr_new = stringtotable(cur_data.attrs)
  815. local data = {}
  816. data.extra_type_id = type_id
  817. data.extra_grade = grade
  818. data.close_time = 10
  819. data.big_title_effect = {
  820. {res = "ui_jinjiechenggong01"},
  821. {res = "ui_jinjiechenggong02"},
  822. }
  823. data.grade_change = {
  824. old_grade = string.format("%s阶",grade-1),
  825. new_grade = string.format("%s阶",grade),
  826. old_star = grade - 1,
  827. new_star = grade,
  828. max_star_old = 0,--self.model:GetCurMaxStar( type_id,grade - 1 ),
  829. max_star_new = 0,--self.model:GetCurMaxStar( type_id,grade ),
  830. }
  831. data.model_info = {
  832. model_type = FosterConst.ModelMatch[type_id],
  833. model_id = cur_data.resource,
  834. name = Trim(cur_data.name),
  835. name_des = string.format("%s阶",grade)
  836. }
  837. -------------------------
  838. data.special_attr = {}
  839. for i=#attr_new,1,-1 do
  840. if WordManager:GetAttrIsSpecial(attr_new[i][1]) then
  841. table.insert(data.special_attr, table.remove(attr_new,i))
  842. end
  843. end
  844. -------------------------
  845. if grade == 1 then
  846. data.power_data = {
  847. new_power = GetFighting(attr_new),
  848. change_power = 0,
  849. }
  850. data.attr_data = {
  851. title_name = string.format("%s属性",FosterConst.ModelName[type_id]),
  852. attr_old = attr_new,
  853. attr_new = {},
  854. }
  855. else
  856. local attr_old = stringtotable(self.model:GetBaseConfOne( type_id, grade-1, self.model:GetCurMaxStar( type_id,grade-1 ) ).attrs)
  857. -------------------------
  858. --把特殊属性删掉
  859. for i=#attr_old,1,-1 do
  860. if WordManager:GetAttrIsSpecial(attr_old[i][1]) then
  861. table.remove(attr_old,i)
  862. end
  863. end
  864. -------------------------
  865. data.power_data = {
  866. new_power = GetFighting(attr_new),
  867. change_power = GetFighting(attr_new) - GetFighting(attr_old),
  868. }
  869. data.attr_data = {
  870. title_name = string.format("%s属性",FosterConst.ModelName[type_id]),
  871. attr_old = attr_old,
  872. attr_new = attr_new,
  873. }
  874. --特殊指定的奖励数据
  875. if reward_data then
  876. data.reward_data = reward_data
  877. data.reward_data.show_name = Trim(cur_data.name)
  878. else
  879. data.reward_data = {
  880. show_list = stringtotable(cur_data.award)
  881. }
  882. end
  883. end
  884. -------------------------
  885. data.attr_data.pos_type = #data.special_attr == 0 and "default" or "foster"
  886. -------------------------
  887. if self.FosterSkillTips then
  888. self.FosterSkillTips:Close()
  889. end
  890. GlobalEventSystem:Fire(EventName.OPEN_UPGRADE_SHOW_VIEW,data)
  891. end
  892. if self.model.wait_new_func_open then
  893. self.wait_show_up_success_call = call_up_success
  894. else
  895. call_up_success()
  896. self.wait_show_up_success_call = false
  897. end
  898. end
  899. --时装(这里就不触发更改,只调整数据)
  900. function FosterController:ChangeRoleFashionInfo(scmd, role_id)
  901. local role_vo = SceneManager.Instance:GetRoleVo(role_id)
  902. local role = Scene.Instance:GetRole(role_id)
  903. if not role_vo then return end
  904. local exchange_type_id = scmd.type_id
  905. --如果不是武器或者翅膀就不处理
  906. if not (FashionModel.FashionType.WING == exchange_type_id or FashionModel.FashionType.WEAPON == exchange_type_id) then return end
  907. --时装的类型和进阶的类型进行转换
  908. if exchange_type_id == FashionModel.FashionType.WING then
  909. exchange_type_id = FosterConst.ModuleId.FWing
  910. elseif exchange_type_id == FashionModel.FashionType.WEAPON then
  911. exchange_type_id = FosterConst.ModuleId.FWeapon
  912. end
  913. --这里要把别的系统的数据清理掉 开始
  914. for k,v in pairs(role_vo.foster_sub_skin_list) do
  915. if v.type_id == exchange_type_id then
  916. v.skin_id = 0
  917. v.star = 0
  918. break
  919. end
  920. end
  921. for k,v in pairs(role_vo.foster_skin_list) do
  922. if v.type_id == exchange_type_id then
  923. v.sub_id = 0
  924. v.star = 0
  925. v.skin_id = 0
  926. break
  927. end
  928. end
  929. --这里要把别的系统的数据清理掉 结束
  930. end
  931. --皮肤变更
  932. function FosterController:ChangeRoleForsterSunSkinInfo(scmd, role_id)
  933. local role_vo = SceneManager.Instance:GetRoleVo(role_id)
  934. local role = Scene.Instance:GetRole(role_id)
  935. if not role_vo then return end
  936. role_vo.foster_sub_skin_list = role_vo.foster_sub_skin_list or {}
  937. local is_have = false
  938. for k,v in pairs(role_vo.foster_sub_skin_list) do
  939. if v.type_id == scmd.type_id then
  940. v.skin_id = scmd.skin_id
  941. v.star = scmd.star
  942. is_have = true
  943. break
  944. end
  945. end
  946. if not is_have then
  947. table.insert(role_vo.foster_sub_skin_list, {type_id = scmd.type_id, skin_id = scmd.skin_id, star=scmd.star})
  948. end
  949. --这里要把别的系统的数据清理掉 开始
  950. for k,v in pairs(role_vo.foster_skin_list) do
  951. if v.type_id == scmd.type_id then
  952. v.sub_id = 0
  953. v.star = 0
  954. v.skin_id = 0
  955. break
  956. end
  957. end
  958. --这里要把别的系统的数据清理掉 结束
  959. local exchange_type_id = scmd.type_id
  960. local foster_res_id = false
  961. for k,v in pairs(role_vo.foster_list) do
  962. if v.type_id == exchange_type_id then
  963. foster_res_id = self.model:GetModuleResIdByStage(v.type_id,v.stage_id)
  964. end
  965. end
  966. local skin_res_id = false
  967. for k,v in pairs(role_vo.foster_skin_list) do
  968. if v.type_id == exchange_type_id and v.skin_id > 0 then
  969. skin_res_id = v.skin_id
  970. end
  971. end
  972. local skin_sub_res_id = false
  973. for k,v in pairs(role_vo.foster_sub_skin_list) do
  974. if v.type_id == exchange_type_id and v.skin_id > 0 then
  975. skin_sub_res_id = v.skin_id
  976. end
  977. end
  978. if skin_sub_res_id or skin_res_id or foster_res_id then
  979. role_vo:ChangeVar(FosterConst.CHANGE_TAG_LIST[exchange_type_id],skin_sub_res_id or skin_res_id or foster_res_id)
  980. end
  981. end
  982. --珍宝
  983. function FosterController:ChangeRoleForsterInfo( scmd,role_id, is_base_forster)
  984. role_id = role_id or RoleManager.Instance.mainRoleInfo.role_id
  985. local role_vo = SceneManager.Instance:GetRoleVo(role_id)
  986. local role = Scene.Instance:GetRole(role_id)
  987. if not role_vo then return end
  988. if scmd.type > 1000 then
  989. --珍宝的要特殊处理补齐参数哦
  990. if scmd.type - 1000 == FosterConst.ModuleId.FWeapon then
  991. --武器的珍宝需要手动折算2次成资源名
  992. if tonumber(scmd.display[2]) > 0 then
  993. scmd.skin_id = ShapeModel:GetModelRes( scmd.type-1000, tonumber(scmd.display[1]), tonumber(scmd.display[2]) )
  994. scmd.skin_id = GameResPath:GetFWeaponResName( role_vo.career,scmd.skin_id)
  995. else
  996. scmd.skin_id = 0
  997. end
  998. else
  999. scmd.skin_id = ShapeModel:GetModelRes( scmd.type-1000, tonumber(scmd.display[1]), tonumber(scmd.display[2]) )
  1000. end
  1001. scmd.sub_id = tonumber(scmd.display[1])
  1002. scmd.star = tonumber(scmd.display[2])
  1003. end
  1004. local function foster_have_change( type_id )
  1005. local have = false
  1006. for k,v in pairs(role_vo.foster_list) do
  1007. if v.type_id == type_id then
  1008. v.stage_id = scmd.display
  1009. have = true
  1010. break
  1011. end
  1012. end
  1013. return have
  1014. end
  1015. local function shape_have_change( type_id )
  1016. local have = false
  1017. for k,v in pairs(role_vo.foster_skin_list) do
  1018. if v.type_id == type_id then
  1019. v.sub_id = scmd.sub_id
  1020. v.star = scmd.star
  1021. v.skin_id = scmd.skin_id
  1022. have = true
  1023. break
  1024. end
  1025. end
  1026. return have
  1027. end
  1028. -------------------------
  1029. if FosterConst.CHANGE_TAG_LIST[scmd.type] or FosterConst.CHANGE_TAG_LIST[scmd.type-1000] then
  1030. if scmd.type < 1000 then
  1031. --进阶普通的要换算
  1032. local have = foster_have_change(scmd.type)
  1033. if not have then
  1034. table.insert( role_vo.foster_list, {type_id = scmd.type,stage_id = scmd.display} )
  1035. end
  1036. else
  1037. --珍宝的直接就是资源id
  1038. local have = shape_have_change(scmd.type - 1000)
  1039. if not have then
  1040. table.insert( role_vo.foster_skin_list, {type_id = scmd.type,skin_id = scmd.skin_id,sub_id = scmd.sub_id,star = scmd.star} )
  1041. end
  1042. end
  1043. -------------------------
  1044. local exchange_type_id = (scmd.type > 1000) and (scmd.type - 1000) or scmd.type
  1045. --这里要把别的系统的数据清理掉 开始
  1046. for k,v in pairs(role_vo.foster_sub_skin_list) do
  1047. if v.type_id == exchange_type_id then
  1048. v.skin_id = 0
  1049. v.star = 0
  1050. break
  1051. end
  1052. end
  1053. if is_base_forster then
  1054. for k,v in pairs(role_vo.foster_skin_list) do
  1055. if v.type_id == exchange_type_id then
  1056. v.sub_id = 0
  1057. v.star = 0
  1058. v.skin_id = 0
  1059. break
  1060. end
  1061. end
  1062. end
  1063. --这里要把别的系统的数据清理掉 结束
  1064. local foster_res_id = false
  1065. for k,v in pairs(role_vo.foster_list) do
  1066. if v.type_id == exchange_type_id then
  1067. foster_res_id = self.model:GetModuleResIdByStage(v.type_id,v.stage_id)
  1068. end
  1069. end
  1070. local skin_res_id = false
  1071. for k,v in pairs(role_vo.foster_skin_list) do
  1072. if v.type_id == exchange_type_id and v.skin_id > 0 then
  1073. skin_res_id = v.skin_id
  1074. end
  1075. end
  1076. local skin_sub_res_id = false
  1077. for k,v in pairs(role_vo.foster_sub_skin_list) do
  1078. if v.type_id == exchange_type_id and v.skin_id > 0 then
  1079. skin_sub_res_id = v.skin_id
  1080. end
  1081. end
  1082. if skin_sub_res_id or skin_res_id or foster_res_id then
  1083. role_vo:ChangeVar(FosterConst.CHANGE_TAG_LIST[exchange_type_id],skin_sub_res_id or skin_res_id or foster_res_id)
  1084. end
  1085. elseif scmd.type == 1000 + FosterConst.ModuleId.FWeapon then
  1086. --武器珍宝
  1087. local res_id = scmd.skin_id
  1088. local have = false
  1089. for k,v in pairs(role_vo.foster_skin_list) do
  1090. if v.type_id == FosterConst.ModuleId.FWeapon then
  1091. v.skin_id = res_id
  1092. have = true
  1093. break
  1094. end
  1095. end
  1096. if not have then
  1097. table.insert( role_vo.foster_skin_list, {type_id = FosterConst.ModuleId.FWeapon,skin_id = scmd.skin_id,sub_id = scmd.sub_id,star = scmd.star} )
  1098. end
  1099. -------------------------
  1100. if role then
  1101. role:ChangeWeapon( )
  1102. end
  1103. elseif scmd.type == FosterConst.ModuleId.FWeapon then
  1104. local have_add = false
  1105. for k,v in pairs(role_vo.level_model_list) do
  1106. if v.part_pos == FashionPartPos.Weapon then
  1107. v.level_model_id = GameResPath:GetFWeaponResName( role_vo.career,self.model:GetModuleResIdByStage(scmd.type,scmd.display) )
  1108. have_add = true
  1109. end
  1110. end
  1111. if not have_add then
  1112. table.insert( role_vo.level_model_list, {part_pos = FashionPartPos.Weapon,level_model_id = scmd.display} )
  1113. end
  1114. if role then
  1115. role:ChangeWeapon( )
  1116. end
  1117. end
  1118. end