Example #1
0
        internal List <RoomItem> RemoveAllFurniture(GameClient Session)
        {
            List <RoomItem> ReturnList = new List <RoomItem>();

            foreach (RoomItem Item in mFloorItems.Values.ToArray())
            {
                Item.Interactor.OnRemove(Session, Item);
                ServerMessage Message = new ServerMessage(Outgoing.ObjectRemove);
                Message.AppendString(Item.Id + String.Empty);
                Message.AppendInt32(0);
                Message.AppendInt32(room.OwnerId);
                room.SendMessage(Message);

                //mFloorItems.Remove(Item.Id);

                ReturnList.Add(Item);
            }

            foreach (RoomItem Item in mWallItems.Values.ToArray())
            {
                Item.Interactor.OnRemove(Session, Item);
                ServerMessage Message = new ServerMessage(Outgoing.PickUpWallItem);
                Message.AppendString(Item.Id + String.Empty);
                Message.AppendInt32(room.OwnerId);
                room.SendMessage(Message);
                //mWallItems.Remove(Item.Id);

                ReturnList.Add(Item);
            }

            mWallItems.Clear();
            mFloorItems.Clear();

            mRemovedItems.Clear();

            mMovedItems.Clear();
            mAddedItems.Clear();
            mRollers.QueueDelegate(new onCycleDoneDelegate(ClearRollers));

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("DELETE FROM items_rooms WHERE room_id = " + room.RoomId);
            }

            room.GetGameMap().GenerateMaps();
            room.GetRoomUserManager().UpdateUserStatuses();

            if (room.GotWired())
            {
                room.GetWiredHandler().OnPickall();
            }

            return(ReturnList);
        }
Example #2
0
        //internal RoomUser DeployBot(RoomAI Bot)
        //{
        //    RoomUser BotUser = new RoomUser(0, room.RoomId, primaryPrivateUserID++, room, false);
        //    int PersonalID = secondaryPrivateUserID++;
        //    BotUser.InternalRoomID = PersonalID;
        //    //this.UserList[PersonalID] = BotUser;
        //    userlist.Add(PersonalID, BotUser);
        //    DynamicRoomModel Model = room.GetGameMap().Model;

        //    if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY)
        //    {
        //        BotUser.SetPos(Bot.X, Bot.Y, Bot.Z);
        //        BotUser.SetRot(Bot.Rot, false);
        //    }
        //    else
        //    {
        //        Bot.X = Model.DoorX;
        //        Bot.Y = Model.DoorY;

        //        BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ);
        //        BotUser.SetRot(Model.DoorOrientation, false);
        //    }

        //    BotUser.BotData = Bot;
        //    BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId);

        //    if (BotUser.IsPet)
        //    {


        //        BotUser.BotAI.Init((int)Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room);
        //        BotUser.PetData = PetData;
        //        BotUser.PetData.VirtualId = BotUser.VirtualId;
        //    }
        //    else
        //    {
        //        BotUser.BotAI.Init(-1, BotUser.VirtualId, room.RoomId, BotUser, room);
        //    }

        //    UpdateUserStatus(BotUser, false);
        //    BotUser.UpdateNeeded = true;

        //    ServerMessage EnterMessage = new ServerMessage(Outgoing.PlaceBot);
        //    EnterMessage.AppendInt32(1);
        //    BotUser.Serialize(EnterMessage);
        //    room.SendMessage(EnterMessage);

        //    BotUser.BotAI.OnSelfEnterRoom();

        //    if (BotUser.BotData.AiType == AIType.Guide)
        //        room.guideBotIsCalled = true;
        //    if (BotUser.IsPet)
        //    {
        //        if (pets.ContainsKey(BotUser.PetData.PetId)) //Pet allready placed
        //            pets[BotUser.PetData.PetId] = BotUser;
        //        else
        //            pets.Add(BotUser.PetData.PetId, BotUser);

        //        petCount++;
        //    }

        //    return BotUser;
        //}

        //internal void RemoveBot(int VirtualId, bool Kicked)
        //{
        //    RoomUser User = GetRoomUserByVirtualId(VirtualId);

        //    if (User == null || !User.IsBot)
        //    {
        //        return;
        //    }

        //    if (User.IsPet)
        //    {
        //        pets.Remove(User.PetData.PetId);
        //        petCount--;
        //    }

        //    User.BotAI.OnSelfLeaveRoom(Kicked);

        //    ServerMessage LeaveMessage = new ServerMessage(Outgoing.UserLeftRoom);
        //    LeaveMessage.AppendRawInt32(User.VirtualId);
        //    room.SendMessage(LeaveMessage);

        //    userlist.Remove(User.InternalRoomID);
        //    //freeIDs[User.InternalRoomID] = null;
        //}


        private void UpdateUserEffect(RoomUser User, int x, int y)
        {
            byte NewCurrentUserItemEffect = room.GetGameMap().EffectMap[x, y];

            if (NewCurrentUserItemEffect > 0)
            {
                ItemEffectType Type = ByteToItemEffectEnum.Parse(NewCurrentUserItemEffect);
                if (Type != User.CurrentItemEffect)
                {
                    switch (Type)
                    {
                    case ItemEffectType.Iceskates:
                    {
                        if (User.GetClient().GetHabbo().Gender == "M")
                        {
                            User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(38);
                        }
                        else
                        {
                            User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(39);
                        }
                        User.CurrentItemEffect = ItemEffectType.Iceskates;
                        break;
                    }

                    case ItemEffectType.Normalskates:
                    {
                        if (User.GetClient().GetHabbo().Gender == "M")
                        {
                            User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(55);
                        }
                        else
                        {
                            User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(56);
                        }
                        //56=girls
                        //55=
                        User.CurrentItemEffect = Type;
                        break;
                    }

                    case ItemEffectType.Swim:
                    {
                        User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(29);
                        User.CurrentItemEffect = Type;
                        break;
                    }

                    case ItemEffectType.SwimLow:
                    {
                        User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(30);
                        User.CurrentItemEffect = Type;
                        break;
                    }

                    case ItemEffectType.SwimHalloween:
                    {
                        User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(37);
                        User.CurrentItemEffect = Type;
                        break;
                    }

                    case ItemEffectType.None:
                    {
                        User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(-1);
                        User.CurrentItemEffect = Type;
                        break;
                    }

                    case ItemEffectType.PublicPool:
                    {
                        User.AddStatus("swim", string.Empty);
                        User.CurrentItemEffect = Type;
                        break;
                    }
                    }
                }
            }
            else if (User.CurrentItemEffect != ItemEffectType.None && NewCurrentUserItemEffect == 0)
            {
                User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyEffect(-1);
                User.CurrentItemEffect = ItemEffectType.None;
                User.RemoveStatus("swim");
            }
        }