internal static Msg_RC_CreateNpc BuildCreateNpcMessage(EntityInfo npc, int rate = -1) { Msg_RC_CreateNpc bder = new Msg_RC_CreateNpc(); bder.npc_id = npc.GetId(); bder.unit_id = npc.GetUnitId(); ScriptRuntime.Vector3 pos = npc.GetMovementStateInfo().GetPosition3D(); GameFrameworkMessage.Position pos_bd = new GameFrameworkMessage.Position(); pos_bd.x = (float)pos.X; pos_bd.z = (float)pos.Z; bder.cur_pos = pos_bd; bder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir(); bder.link_id = npc.GetLinkId(); bder.camp_id = npc.GetCampId(); if (npc.OwnerId > 0) { bder.owner_id = npc.OwnerId; } if (npc.GetAiStateInfo().LeaderID > 0) { bder.leader_id = npc.GetAiStateInfo().LeaderID; } User user = npc.CustomData as User; if (null != user) { bder.key = user.GetKey(); } bder.level = npc.GetLevel(); return bder; }
internal static Msg_RC_CreateNpc BuildCreateNpcMessage(EntityInfo npc, int rate = -1) { Msg_RC_CreateNpc bder = new Msg_RC_CreateNpc(); bder.npc_id = npc.GetId(); bder.unit_id = npc.GetUnitId(); ScriptRuntime.Vector3 pos = npc.GetMovementStateInfo().GetPosition3D(); GameFrameworkMessage.Position pos_bd = new GameFrameworkMessage.Position(); pos_bd.x = (float)pos.X; pos_bd.z = (float)pos.Z; bder.cur_pos = pos_bd; bder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir(); bder.link_id = npc.GetLinkId(); bder.camp_id = npc.GetCampId(); if (npc.OwnerId > 0) { bder.owner_id = npc.OwnerId; } if (npc.GetAiStateInfo().LeaderID > 0) { bder.leader_id = npc.GetAiStateInfo().LeaderID; } User user = npc.CustomData as User; if (null != user) { bder.key = user.GetKey(); } bder.level = npc.GetLevel(); return(bder); }