Example #1
0
        private void TriggerItem()
        {
            if (RoomUser.CalculateRights(Client.GetHabbo().RoomId, Client.GetHabbo().ID))
            {
                int furniID = Request.PopWiredInt32();

                FloorItems mFloor = AleedaEnvironment.GetCache().GetFloorItems().getItem(furniID);
                WallItems  mWall  = AleedaEnvironment.GetCache().GetWallItems().getItem(furniID);

                if (mFloor == null)
                {
                    Response.Initialize(85); // "AU"
                    Response.AppendString(mWall.ID + "");
                    Response.AppendInt32(mWall.SpriteID);
                    Response.AppendString(mWall.Wall);
                    if (mWall.Trigger == 0)
                    {
                        Response.Append(1);
                        Update.UpdateFurniTrigger(furniID, 1);

                        //Set the trigger
                        AleedaEnvironment.GetCache().GetWallItems().getItem(mWall.ID).Trigger = 1;
                    }
                    else
                    {
                        Response.Append(0);
                        Update.UpdateFurniTrigger(furniID, 0);

                        //Set the trigger
                        AleedaEnvironment.GetCache().GetWallItems().getItem(mWall.ID).Trigger = 0;
                    }
                    SendRoom();
                }
                else if (mWall == null)
                {
                    Response.Initialize(88); // "AX"
                    Response.Append(furniID);
                    Response.AppendChar(2);
                    if (mFloor.Trigger == 0)
                    {
                        Response.Append(1);
                        Update.UpdateFurniTrigger(furniID, 1);

                        //Set the trigger
                        AleedaEnvironment.GetCache().GetFloorItems().getItem(mFloor.ID).Trigger = 1;
                    }
                    else
                    {
                        Response.Append(0);
                        Update.UpdateFurniTrigger(furniID, 0);

                        //Set the trigger
                        AleedaEnvironment.GetCache().GetFloorItems().getItem(mFloor.ID).Trigger = 0;
                    }
                    Response.AppendChar(2);
                    SendRoom();
                }
            }
        }
Example #2
0
        private void RotateItem()
        {
            if (RoomUser.CalculateRights(Client.GetHabbo().RoomId, Client.GetHabbo().ID))
            {
                int FurnitureId = Request.PopWiredInt32();
                int FurniX      = Request.PopWiredInt32();
                int FurniY      = Request.PopWiredInt32();
                int FurniRot    = Request.PopWiredInt32();

                //Update furni coords.
                GetFloorItems().getItem(FurnitureId).X        = FurniX;
                GetFloorItems().getItem(FurnitureId).Y        = FurniY;
                GetFloorItems().getItem(FurnitureId).Rotation = FurniRot;

                //Do the mysql queries
                using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE room_items SET x_axis = '" + FurniX + "' WHERE id = '" + FurnitureId + "'");
                    dbClient.ExecuteQuery("UPDATE room_items SET y_axis = '" + FurniY + "'WHERE id = '" + FurnitureId + "'");
                    dbClient.ExecuteQuery("UPDATE room_items SET rotation = '" + FurniRot + "' WHERE id = '" + FurnitureId + "'");
                }

                if (Client.GetHabbo().ItemUsingID == FurnitureId && Client.GetHabbo().IsOnItem)
                {
                    Client.GetHabbo().UserRotation = GetFloorItems().getItem(FurnitureId).Rotation;
                    MoveUser(true);
                }
                else
                {
                    Client.GetHabbo().IsOnItem = false;
                    MoveUser(true);
                }

                //Send the updated move/rotate
                FloorItems mItem = AleedaEnvironment.GetCache().GetFloorItems().getItem(FurnitureId);
                {
                    Response.Initialize(95);
                    Response.AppendInt32(mItem.ID);
                    Response.AppendInt32(mItem.SpriteID);
                    Response.AppendInt32(mItem.X);
                    Response.AppendInt32(mItem.Y);
                    Response.AppendInt32(mItem.Rotation);
                    Response.AppendString("0.0");
                    Response.AppendInt32(0);
                    Response.AppendRawInt32WithBreak(mItem.Trigger, 2);
                    Response.AppendInt32(-1);
                    Response.AppendInt32(0);
                    SendRoom();
                }
            }
        }
Example #3
0
 // TODO Use visitor pattern to achieve this?
 public virtual void Add(Item item)
 {
     if (item is FloorItem)
     {
         FloorItems.Add((FloorItem)item);
     }
     else if (item is WallItem)
     {
         WallItems.Add((WallItem)item);
     }
     else if (item is PetItem)
     {
         Pets.Add((PetItem)item);
     }
 }
Example #4
0
        private void PickUpItem()
        {
            //Remove garbage
            Request.PopWiredInt32();

            int furniID = Request.PopWiredInt32();

            FloorItems mFloor = GetFloorItems().getItem(furniID);
            WallItems  mWall  = GetWallItems().getItem(furniID);

            uint   ServerMessageID = 0;
            string FurnitureType   = "";

            if (mFloor == null)
            {
                ServerMessageID = 84;
                FurnitureType   = "i";

                //Add item to inventory.
                Client.GetHabbo().AddItem(furniID, mWall.SpriteID, FurnitureType);

                //Get rid of item from cache.
                AleedaEnvironment.GetCache().GetWallItems().deleteItem(furniID);
            }
            else if (mWall == null)
            {
                ServerMessageID = 94;
                FurnitureType   = "s";

                //Add item to inventory.
                Client.GetHabbo().AddItem(furniID, mFloor.SpriteID, FurnitureType);

                //Get rid of item from cache.
                AleedaEnvironment.GetCache().GetFloorItems().deleteItem(furniID);
            }

            if (Client.GetHabbo().ItemUsingID != 0)
            {
                Client.GetHabbo().IsOnItem = false;
                MoveUser(true);
            }

            Response.Initialize(ServerMessageID);
            Response.AppendRawInt32(furniID);
            Response.AppendString("");
            Response.AppendBoolean(false);
            SendRoom();
        }
Example #5
0
        private static void LoadGameLibraries()
        {
            Count = MapLibs.Length + Monsters.Length + Gates.Length + NPCs.Length + CArmours.Length +
                    CHair.Length + CWeapons.Length + CWeaponEffect.Length + AArmours.Length + AHair.Length + AWeaponsL.Length + AWeaponsR.Length +
                    ARArmours.Length + ARHair.Length + ARWeapons.Length + ARWeaponsS.Length +
                    CHumEffect.Length + AHumEffect.Length + ARHumEffect.Length + Mounts.Length + Fishing.Length + Pets.Length +
                    Transform.Length + TransformMounts.Length + TransformEffect.Length + TransformWeaponEffect.Length + 17;

            Dragon.Initialize();
            Progress++;

            BuffIcon.Initialize();
            Progress++;

            Help.Initialize();
            Progress++;

            MiniMap.Initialize();
            Progress++;

            MagIcon.Initialize();
            Progress++;
            MagIcon2.Initialize();
            Progress++;

            Magic.Initialize();
            Progress++;
            Magic2.Initialize();
            Progress++;
            Magic3.Initialize();
            Progress++;
            MagicC.Initialize();
            Progress++;

            Effect.Initialize();
            Progress++;

            GuildSkill.Initialize();
            Progress++;

            Background.Initialize();
            Progress++;

            Deco.Initialize();
            Progress++;

            Items.Initialize();
            Progress++;
            StateItems.Initialize();
            Progress++;
            FloorItems.Initialize();
            Progress++;

            for (int i = 0; i < MapLibs.Length; i++)
            {
                if (MapLibs[i] == null)
                {
                    MapLibs[i] = new MLibrary("");
                }
                else
                {
                    MapLibs[i].Initialize();
                }
                Progress++;
            }

            for (int i = 0; i < Monsters.Length; i++)
            {
                Monsters[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < Gates.Length; i++)
            {
                Gates[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < NPCs.Length; i++)
            {
                NPCs[i].Initialize();
                Progress++;
            }


            for (int i = 0; i < CArmours.Length; i++)
            {
                CArmours[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < CHair.Length; i++)
            {
                CHair[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < CWeapons.Length; i++)
            {
                CWeapons[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < CWeaponEffect.Length; i++)
            {
                CWeaponEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AArmours.Length; i++)
            {
                AArmours[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AHair.Length; i++)
            {
                AHair[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AWeaponsL.Length; i++)
            {
                AWeaponsL[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AWeaponsR.Length; i++)
            {
                AWeaponsR[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARArmours.Length; i++)
            {
                ARArmours[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARHair.Length; i++)
            {
                ARHair[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARWeapons.Length; i++)
            {
                ARWeapons[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARWeaponsS.Length; i++)
            {
                ARWeaponsS[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < CHumEffect.Length; i++)
            {
                CHumEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AHumEffect.Length; i++)
            {
                AHumEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARHumEffect.Length; i++)
            {
                ARHumEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < Mounts.Length; i++)
            {
                Mounts[i].Initialize();
                Progress++;
            }


            for (int i = 0; i < Fishing.Length; i++)
            {
                Fishing[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < Pets.Length; i++)
            {
                Pets[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < Transform.Length; i++)
            {
                Transform[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < TransformEffect.Length; i++)
            {
                TransformEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < TransformWeaponEffect.Length; i++)
            {
                TransformWeaponEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < TransformMounts.Length; i++)
            {
                TransformMounts[i].Initialize();
                Progress++;
            }

            Loaded = true;
        }
Example #6
0
        static void LoadLibraries()
        {
            Count = MapLibs.Length + Monsters.Length + NPCs.Length + CArmours.Length +
                    CHair.Length + CWeapons.Length + AArmours.Length + AHair.Length + AWeaponsL.Length + AWeaponsR.Length +
                    ARArmours.Length + ARHair.Length + ARWeapons.Length + ARWeaponsS.Length +
                    CHumEffect.Length + AHumEffect.Length + ARHumEffect.Length + Mounts.Length + Fishing.Length + Pets.Length + 20;

            Dragon.Initialize();
            Progress++;

            ChrSel.Initialize();
            Progress++;

            Prguse.Initialize();
            Progress++;

            Prguse2.Initialize();
            Progress++;

            BuffIcon.Initialize();
            Progress++;

            Help.Initialize();
            Progress++;

            MiniMap.Initialize();
            Progress++;
            MagIcon.Initialize();
            Progress++;
            MagIcon2.Initialize();
            Progress++;

            Magic.Initialize();
            Progress++;
            Magic2.Initialize();
            Progress++;
            Magic3.Initialize();
            Progress++;
            MagicC.Initialize();
            Progress++;
            Effect.Initialize();
            Progress++;
            CustomEffects.Initialize();
            Progress++;

            Items.Initialize();
            Progress++;
            StateItems.Initialize();
            Progress++;
            FloorItems.Initialize();
            Progress++;

            for (int i = 0; i < MapLibs.Length; i++)
            {
                if (MapLibs[i] == null)
                {
                    MapLibs[i] = new MLibrary("");
                }
                else
                {
                    MapLibs[i].Initialize();
                }
                Progress++;
            }

            for (int i = 0; i < Monsters.Length; i++)
            {
                Monsters[i].Initialize();
                Progress++;
            }


            for (int i = 0; i < NPCs.Length; i++)
            {
                NPCs[i].Initialize();
                Progress++;
            }


            for (int i = 0; i < CArmours.Length; i++)
            {
                CArmours[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < CHair.Length; i++)
            {
                CHair[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < CWeapons.Length; i++)
            {
                CWeapons[i].Initialize();
                Progress++;
            }


            for (int i = 0; i < AArmours.Length; i++)
            {
                AArmours[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AHair.Length; i++)
            {
                AHair[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AWeaponsL.Length; i++)
            {
                AWeaponsL[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AWeaponsR.Length; i++)
            {
                AWeaponsR[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARArmours.Length; i++)
            {
                ARArmours[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARHair.Length; i++)
            {
                ARHair[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARWeapons.Length; i++)
            {
                ARWeapons[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARWeaponsS.Length; i++)
            {
                ARWeaponsS[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < CHumEffect.Length; i++)
            {
                CHumEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < AHumEffect.Length; i++)
            {
                AHumEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < ARHumEffect.Length; i++)
            {
                ARHumEffect[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < Mounts.Length; i++)
            {
                Mounts[i].Initialize();
                Progress++;
            }


            for (int i = 0; i < Fishing.Length; i++)
            {
                Fishing[i].Initialize();
                Progress++;
            }

            for (int i = 0; i < Pets.Length; i++)
            {
                Pets[i].Initialize();
                Progress++;
            }

            Loaded = true;
        }
 public override int GetHashCode()
 {
     return(unchecked ((Floor * 397) ^ FloorItems.GetHashCode()));
 }
Example #8
0
 public virtual FloorItem GetFloorItem(int id)
 {
     return(FloorItems.SingleOrDefault(x => x.Id == id));
 }