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

63 行
2.2 KiB

  1. --[[
  2. Npc信息结构体
  3. ]]
  4. NpcVo = NpcVo or BaseClass(BaseVo)
  5. function NpcVo:__init()
  6. self.instance_id = 0 --唯一标识(int32)
  7. self.type_id = 0 --类型ID(int32)
  8. self.name = "" --名称(string)
  9. self.pos_x = 0 --X坐标(int16)
  10. self.pos_y = 0 --Y坐标(int16)
  11. self.logic_x = 0
  12. self.logic_y = 0
  13. self.model = 0 --资源ID(int32)
  14. self.func_flag = 0 --功能(int8)
  15. self.realm = 0 --国家(int8)
  16. self.icon = 0 --Npc形象
  17. self.head_icon = 0 --Npc头像(int32)
  18. self.prePoseState = PoseState.STAND
  19. self.poseState = PoseState.STAND
  20. -- self.task_icon = 0 --任务状态:1什么都没有,2可接任务,3有未完成任务,4可提交任务,5有任务相关
  21. self.task_icon = 0 --任务状态:0什么都没有,1可接任务,2有未完成任务,3可提交任务,4有任务相关
  22. self.talk = 0 --默认对话内容
  23. self.dynamic_action_str = "" --动态npc的动作和角度字符串
  24. self.assign_angle = -1 -- 初始化的角度
  25. self.weapon_id = 0 --武器id
  26. self.wing_id = 0
  27. end
  28. function NpcVo:CreateNpcInfo(baseInfo)
  29. if baseInfo == nil then
  30. return
  31. end
  32. local npc_id = baseInfo.npc_id or baseInfo.id or baseInfo.instance_id
  33. local npc_config = ConfigItemMgr.Instance:GetNpcItem(npc_id)
  34. if npc_config == nil then
  35. return
  36. end
  37. self.instance_id = npc_id --唯一标识(int32)
  38. self.type_id = npc_id --类型ID(int32)
  39. self.name = Trim(npc_config.name) --名称(string)
  40. self.pos_x = baseInfo.x or baseInfo.pos_x --X坐标(int16)
  41. self.pos_y = baseInfo.y or baseInfo.pos_y --Y坐标(int16)
  42. self.logic_x = self.pos_x / SceneObj.LogicRealRatio.x
  43. self.logic_y = self.pos_y / SceneObj.LogicRealRatio.y
  44. self.model = npc_config.icon --资源ID(int32)
  45. self.func_flag = npc_config.func --功能(int8)
  46. self.realm = npc_config.realm --国家(int8)
  47. self.icon = npc_config.icon
  48. self.head_icon = npc_config.image --Npc头像(int32)
  49. self.talk = npc_config.talk --默认对话内容
  50. self.anima = npc_config.anima
  51. self.dynamic_action_str = baseInfo.args or ""
  52. self.assign_angle = baseInfo.assign_angle or -1
  53. self.weapon_id = npc_config.arm_id
  54. self.texture_id = npc_config.texture_id or 0
  55. if GodClothesResId[self.model] then
  56. self.weapon_id = self.model
  57. self.wing_id = self.model
  58. end
  59. end