Ejemplo n.º 1
0
        private static void TakePet(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            RoomActor Actor = Instance.GetActorByReferenceId(Message.PopWiredUInt32(), RoomActorType.AiBot);

            if (Actor == null)
            {
                return;
            }

            Pet PetData = ((Bot)Actor.ReferenceObject).PetData;

            if (PetData == null || (PetData.OwnerId != Session.CharacterId && !Session.HasRight("hotel_admin")))
            {
                return;
            }

            Instance.RemoveActorFromRoom(Actor.Id);
            Session.PetInventoryCache.Add(PetData);
            Session.SendData(InventoryPetAddedComposer.Compose(PetData));
        }