|
|
-
- --[[
- 服务器下发的Npc信息结构体
- ]]
- NpcVo = NpcVo or BaseClass(BaseVo)
-
- function NpcVo:__init()
- self.instance_id = 0 --唯一标识(int32)
- self.type_id = 0 --类型ID(int32)
- self.name = "" --名称(string)
- self.pos_x = 0 --X坐标(int16)
- self.pos_y = 0 --Y坐标(int16)
- self.logic_x = 0
- self.logic_y = 0
- self.model = 0 --资源ID(int32)
- self.func_flag = 0 --功能(int8)
- self.realm = 0 --国家(int8)
- self.icon = 0 --Npc形象
- self.head_icon = 0 --Npc头像(int32)
- self.prePoseState = PoseState.STAND
- self.poseState = PoseState.STAND
- -- self.task_icon = 0 --任务状态:1什么都没有,2可接任务,3有未完成任务,4可提交任务,5有任务相关
- self.task_icon = 0 --任务状态:0什么都没有,1可接任务,2有未完成任务,3可提交任务,4有任务相关
- self.talk = 0 --默认对话内容
- self.dynamic_action_str = "" --动态npc的动作和角度字符串
- self.assign_angle = -1 -- 初始化的角度
- self.weapon_id = 0 --武器id
- self.wing_id = 0
- end
-
- function NpcVo:CreateNpcInfo(baseInfo)
- if baseInfo == nil then
- return
- end
- local npc_id = baseInfo.npc_id or baseInfo.id or baseInfo.instance_id
- local npc_config = ConfigItemMgr.Instance:GetNpcItem(npc_id)
- if npc_config == nil then
- return
- end
- self.instance_id = npc_id --唯一标识(int32)
- self.type_id = npc_id --类型ID(int32)
- self.name = Trim(npc_config.name) --名称(string)
- self.pos_x = baseInfo.x or baseInfo.pos_x --X坐标(int16)
- self.pos_y = baseInfo.y or baseInfo.pos_y --Y坐标(int16)
- self.logic_x = self.pos_x / SceneObj.LogicRealRatio.x
- self.logic_y = self.pos_y / SceneObj.LogicRealRatio.y
- self.model = npc_config.icon --资源ID(int32)
- self.func_flag = npc_config.func --功能(int8)
- self.realm = npc_config.realm --国家(int8)
- self.icon = npc_config.icon
- self.head_icon = npc_config.image --Npc头像(int32)
- self.talk = npc_config.talk --默认对话内容
- self.anima = npc_config.anima
- self.dynamic_action_str = baseInfo.args or ""
- self.assign_angle = baseInfo.assign_angle or -1
- self.weapon_id = npc_config.arm_id
- self.texture_id = npc_config.texture_id or 0
-
- if GodClothesResId[self.model] then
- self.weapon_id = self.model
- self.wing_id = self.model
- end
- end
|