internal static Msg_RC_CreateNpc BuildCreateNpcMessage(NpcInfo npc) { Msg_RC_CreateNpc bder = new Msg_RC_CreateNpc(); bder.npc_id = npc.GetId(); bder.unit_id = npc.GetUnitId(); Vector3 pos = npc.GetMovementStateInfo().GetPosition3D(); ArkCrossEngineMessage.Position pos_bd = new ArkCrossEngineMessage.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(); if (npc.GetUnitId() <= 0) { bder.camp_id = npc.GetCampId(); } if (npc.OwnerId > 0) { bder.owner_id = npc.OwnerId; } bder.level = npc.GetLevel(); return(bder); }
internal static Msg_RC_DropNpc BuildDropNpcMessage(NpcInfo npc, int fromNpcId, int dropType, int dropNum, string model) { Msg_RC_DropNpc bder = new Msg_RC_DropNpc(); bder.npc_id = npc.GetId(); bder.link_id = npc.GetLinkId(); bder.owner_id = npc.OwnerId; bder.from_npc_id = fromNpcId; bder.drop_type = dropType; bder.drop_num = dropNum; bder.camp_id = npc.GetCampId(); if (!String.IsNullOrEmpty(model)) { bder.model = model; } return(bder); }