Stack magic tool fix [PlusEmulator]

Results 1 to 10 of 10
  1. #1
    The **** Keiz is offline
    MemberRank
    Nov 2015 Join Date
    238Posts

    Stack magic tool fix [PlusEmulator]

    Hey hey,

    it's been some time since I released something, so here we are.
    Quite some people have requested me to make this fix. I didn't want money for such an easy fix, so once again here we are.

    In Plus\HabboHotel\Rooms\RoomItemHandling.cs find
    Code:
    public bool SetFloorItem(GameClient Session, Item Item, int newX, int newY, int newRot, bool newItem, bool OnRoller, bool sendMessage, bool updateRoomUserStatuses = false)
    Change the entire void to
    Spoiler:

    Code:
            public bool SetFloorItem(GameClient Session, Item Item, int newX, int newY, int newRot, bool newItem, bool OnRoller, bool sendMessage, bool updateRoomUserStatuses = false)
            {
                // Questions -> Skype: keiz.er
                bool NeedsReAdd = false;
    
    
                if (newItem)
                    if (Item.IsWired)
                        if (Item.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps && _room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps).Count() > 0)
                            return false;
    
    
                List<Item> ItemsOnTile = GetFurniObjects(newX, newY);
                if (Item.GetBaseItem().InteractionType == InteractionType.ROLLER && ItemsOnTile.Where(x => x.GetBaseItem().InteractionType == InteractionType.ROLLER && x.Id != Item.Id).Count() > 0)
                    return false;
    
    
                if (!newItem)
                    NeedsReAdd = _room.GetGameMap().RemoveFromMap(Item);
    
    
                Dictionary<int, ThreeDCoord> AffectedTiles = Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, newRot);
    
    
                if (!_room.GetGameMap().ValidTile(newX, newY) || _room.GetGameMap().SquareHasUsers(newX, newY) && !Item.GetBaseItem().IsSeat)
                {
                    if (NeedsReAdd)
                        _room.GetGameMap().AddToMap(Item);
                    return false;
                }
    
    
                foreach (ThreeDCoord Tile in AffectedTiles.Values)
                {
                    if (!_room.GetGameMap().ValidTile(Tile.X, Tile.Y) ||
                        (_room.GetGameMap().SquareHasUsers(Tile.X, Tile.Y) && !Item.GetBaseItem().IsSeat))
                    {
                        if (NeedsReAdd)
                        {
                            _room.GetGameMap().AddToMap(Item);
                        }
                        return false;
                    }
                }
                
                Double newZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY];
    
    
                if (!OnRoller)
                {
                    if (_room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN && !Item.GetBaseItem().IsSeat)
                    {
                        return false;
                    }
    
    
                    foreach (ThreeDCoord Tile in AffectedTiles.Values)
                    {
                        if (_room.GetGameMap().Model.SqState[Tile.X, Tile.Y] != SquareState.OPEN &&
                            !Item.GetBaseItem().IsSeat)
                        {
                            if (NeedsReAdd)
                            {
                                //AddItem(Item);
                                _room.GetGameMap().AddToMap(Item);
                            }
                            return false;
                        }
                    }
                    
                    if (!Item.GetBaseItem().IsSeat && !Item.IsRoller)
                    {
                        foreach (ThreeDCoord Tile in AffectedTiles.Values)
                        {
                            if (_room.GetGameMap().GetRoomUsers(new Point(Tile.X, Tile.Y)).Count > 0)
                            {
                                if (NeedsReAdd)
                                    _room.GetGameMap().AddToMap(Item);
                                return false;
                            }
                        }
                    }
                }
    
    
                // Find affected objects
                var ItemsAffected = new List<Item>();
                var ItemsComplete = new List<Item>();
    
    
                foreach (ThreeDCoord Tile in AffectedTiles.Values.ToList())
                {
                    List<Item> Temp = GetFurniObjects(Tile.X, Tile.Y);
    
    
                    if (Temp != null)
                    {
                        ItemsAffected.AddRange(Temp);
                    }
                }
    
    
    
    
                ItemsComplete.AddRange(ItemsOnTile);
                ItemsComplete.AddRange(ItemsAffected);
    
    
                if (!OnRoller)
                {
                    foreach (Item I in ItemsComplete.ToList())
                    {
                        if (I == null)
                            continue;
    
    
                        if (I.Id == Item.Id)
                            continue;
    
    
                        if (I.GetBaseItem() == null)
                            continue;
    
    
                    }
                }
                
                {
                    if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)
                        newZ = Item.GetZ;
                    
                    foreach (Item I in ItemsComplete.ToList())
                    {
                        if (I == null)
                            continue;
                        if (I.Id == Item.Id)
                            continue;
    
    
                        if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL)
                        { // Basically the core of the fix
                            // Questions -> Skype: keiz.er
                            newZ = I.GetZ;
                            break; 
                        }
    
    
                        if (I.TotalHeight > newZ)
                        {
                            newZ = I.TotalHeight;
                        }
    
    
                    }
                }
                
                if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8 && !Item.GetBaseItem().ExtraRot)
                    newRot = 0;
    
    
                Item.Rotation = newRot;
                int oldX = Item.GetX;
                int oldY = Item.GetY;
                Item.SetState(newX, newY, newZ, AffectedTiles);
    
    
                if (!OnRoller && Session != null)
                    Item.Interactor.OnPlace(Session, Item);
    
    
    
    
                if (newItem)
                {
                    if (_floorItems.ContainsKey(Item.Id))
                    {
                        if (Session != null)
                            Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
                        _room.GetGameMap().RemoveFromMap(Item);
                        return true;
                    }
    
    
                    if (Item.IsFloorItem && !_floorItems.ContainsKey(Item.Id))
                        _floorItems.TryAdd(Item.Id, Item);
                    else if (Item.IsWallItem && !_wallItems.ContainsKey(Item.Id))
                        _wallItems.TryAdd(Item.Id, Item);
    
    
                    if (sendMessage)
                        _room.SendMessage(new ObjectAddComposer(Item, _room));
                }
                else
                {
                    UpdateItem(Item);
                    if (!OnRoller && sendMessage)
                        _room.SendMessage(new ObjectUpdateComposer(Item, _room.OwnerId));
                }
                _room.GetGameMap().AddToMap(Item);
    
    
                if (Item.GetBaseItem().IsSeat)
                    updateRoomUserStatuses = true;
    
    
                if (updateRoomUserStatuses)
                    _room.GetRoomUserManager().UpdateUserStatusses();
    
    
                if (Item.GetBaseItem().InteractionType == InteractionType.TENT || Item.GetBaseItem().InteractionType == InteractionType.TENT_SMALL)
                {
                    _room.RemoveTent(Item.Id, Item);
                    _room.AddTent(Item.Id);
                }
    
    
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "' WHERE `id` = '" + Item.Id + "' LIMIT 1");
                }
                return true;
            }


    That should do it!

    Loves,
    Keiz
    Last edited by Keiz; 08-05-16 at 10:28 PM.


  2. #2
    Member Noisecontroller is offline
    MemberRank
    Aug 2015 Join Date
    NetherlandLocation
    58Posts

    Re: Stack magic tool fix [PlusEmulator]

    Could you look at wordfilter so you can't say h a b b o so you don't need to make over 1000 on habbo (This is a EG)

    And great fix!

  3. #3
    Enthusiast desilva is offline
    MemberRank
    Oct 2015 Join Date
    40Posts

    Re: Stack magic tool fix [PlusEmulator]

    grace of the fix I needed

  4. #4
    Apprentice Itsblue is offline
    MemberRank
    Mar 2012 Join Date
    10Posts

    Re: Stack magic tool fix [PlusEmulator]

    The fix have a error. All furnis can stack whitout magic stack furni.
    How to fix that?

  5. #5
    The **** Keiz is offline
    MemberRank
    Nov 2015 Join Date
    238Posts

    Re: Stack magic tool fix [PlusEmulator]

    @Itsblue Ohw that's because I used it on my RP hotel, so my builders could easily build, use this void instead:
    Code:
            public bool SetFloorItem(GameClient Session, Item Item, int newX, int newY, int newRot, bool newItem, bool OnRoller, bool sendMessage, bool updateRoomUserStatuses = false)
            {
                bool NeedsReAdd = false;
                bool fail = false;
    
    
                if (newItem)
                    if (Item.IsWired)
                        if (Item.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps && _room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps).Count() > 0)
                            return false;
    
    
                List<Item> ItemsOnTile = GetFurniObjects(newX, newY);
                if (Item.GetBaseItem().InteractionType == InteractionType.ROLLER && ItemsOnTile.Where(x => x.GetBaseItem().InteractionType == InteractionType.ROLLER && x.Id != Item.Id).Count() > 0)
                    return false;
    
    
                if (!newItem)
                    NeedsReAdd = _room.GetGameMap().RemoveFromMap(Item);
    
    
                Dictionary<int, ThreeDCoord> AffectedTiles = Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, newRot);
    
    
                if (!_room.GetGameMap().ValidTile(newX, newY) || _room.GetGameMap().SquareHasUsers(newX, newY) && !Item.GetBaseItem().IsSeat)
                {
                    if (NeedsReAdd)
                        _room.GetGameMap().AddToMap(Item);
                    return false;
                }
    
    
                foreach (ThreeDCoord Tile in AffectedTiles.Values)
                {
                    if (!_room.GetGameMap().ValidTile(Tile.X, Tile.Y) ||
                        (_room.GetGameMap().SquareHasUsers(Tile.X, Tile.Y) && !Item.GetBaseItem().IsSeat))
                    {
                        if (NeedsReAdd)
                        {
                            _room.GetGameMap().AddToMap(Item);
                        }
                        return false;
                    }
                }
    
    
                // Start calculating new Z coordinate
                Double newZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY];
    
    
                if (!OnRoller)
                {
                    // Make sure this tile is open and there are no users here
                    if (_room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN && !Item.GetBaseItem().IsSeat)
                    {
                        return false;
                    }
    
    
                    foreach (ThreeDCoord Tile in AffectedTiles.Values)
                    {
                        if (_room.GetGameMap().Model.SqState[Tile.X, Tile.Y] != SquareState.OPEN &&
                            !Item.GetBaseItem().IsSeat)
                        {
                            if (NeedsReAdd)
                            {
                                //AddItem(Item);
                                _room.GetGameMap().AddToMap(Item);
                            }
                            return false;
                        }
                    }
    
    
                    // And that we have no users
                    if (!Item.GetBaseItem().IsSeat && !Item.IsRoller)
                    {
                        foreach (ThreeDCoord Tile in AffectedTiles.Values)
                        {
                            if (_room.GetGameMap().GetRoomUsers(new Point(Tile.X, Tile.Y)).Count > 0)
                            {
                                if (NeedsReAdd)
                                    _room.GetGameMap().AddToMap(Item);
                                return false;
                            }
                        }
                    }
                }
    
    
                // Find affected objects
                var ItemsAffected = new List<Item>();
                var ItemsComplete = new List<Item>();
    
    
                foreach (ThreeDCoord Tile in AffectedTiles.Values.ToList())
                {
                    List<Item> Temp = GetFurniObjects(Tile.X, Tile.Y);
    
    
                    if (Temp != null)
                    {
                        ItemsAffected.AddRange(Temp);
                    }
                }
    
    
    
    
                ItemsComplete.AddRange(ItemsOnTile);
                ItemsComplete.AddRange(ItemsAffected);
    
    
                if (!OnRoller)
                {
                    // Check for items in the stack that do not allow stacking on top of them
                    foreach (Item I in ItemsComplete.ToList())
                    {
                        if (I == null)
                            continue;
    
    
                        if (I.Id == Item.Id)
                            continue;
    
    
                        if (I.GetBaseItem() == null)
                            continue;
    
    
                        if (!I.GetBaseItem().Stackable)
                         {
                             if (NeedsReAdd)
                             {
                                 //AddItem(Item);
                                 _room.GetGameMap().AddToMap(Item);
                             }
                            fail = true;
                         }
                    }
                }
    
    
                //if (!Item.IsRoller)
                {
                    // If this is a rotating action, maintain item at current height
                    if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)
                        newZ = Item.GetZ;
    
    
    
    
    
    
    
    
                    // Are there any higher objects in the stack!?
                    foreach (Item I in ItemsComplete.ToList())
                    {
                        if (I == null)
                            continue;
                        if (I.Id == Item.Id)
                            continue;
    
    
                        if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL)
                        {
                            newZ = I.GetZ;
                            fail = false;
                            break;
                        }
    
    
                        if (I.TotalHeight > newZ)
                        {
                            newZ = I.TotalHeight;
                        }
    
    
                    }
                }
    
    
                if (fail)
                    return false;
    
    
                // Verify the rotation is correct
                if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8 && !Item.GetBaseItem().ExtraRot)
                    newRot = 0;
    
    
                Item.Rotation = newRot;
                int oldX = Item.GetX;
                int oldY = Item.GetY;
                Item.SetState(newX, newY, newZ, AffectedTiles);
    
    
                if (!OnRoller && Session != null)
                    Item.Interactor.OnPlace(Session, Item);
    
    
    
    
                if (newItem)
                {
                    if (_floorItems.ContainsKey(Item.Id))
                    {
                        if (Session != null)
                            Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
                        _room.GetGameMap().RemoveFromMap(Item);
                        return true;
                    }
    
    
                    if (Item.IsFloorItem && !_floorItems.ContainsKey(Item.Id))
                        _floorItems.TryAdd(Item.Id, Item);
                    else if (Item.IsWallItem && !_wallItems.ContainsKey(Item.Id))
                        _wallItems.TryAdd(Item.Id, Item);
    
    
                    if (sendMessage)
                        _room.SendMessage(new ObjectAddComposer(Item, _room));
                }
                else
                {
                    UpdateItem(Item);
                    if (!OnRoller && sendMessage)
                        _room.SendMessage(new ObjectUpdateComposer(Item, _room.OwnerId));
                }
                _room.GetGameMap().AddToMap(Item);
    
    
                if (Item.GetBaseItem().IsSeat)
                    updateRoomUserStatuses = true;
    
    
                if (updateRoomUserStatuses)
                    _room.GetRoomUserManager().UpdateUserStatusses();
    
    
                if (Item.GetBaseItem().InteractionType == InteractionType.TENT || Item.GetBaseItem().InteractionType == InteractionType.TENT_SMALL)
                {
                    _room.RemoveTent(Item.Id, Item);
                    _room.AddTent(Item.Id);
                }
    
    
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "' WHERE `id` = '" + Item.Id + "' LIMIT 1");
                }
                return true;
            }

  6. #6
    Apprentice Itsblue is offline
    MemberRank
    Mar 2012 Join Date
    10Posts

    Re: Stack magic tool fix [PlusEmulator]

    Same problem.. :/

  7. #7
    Member MattSantos is offline
    MemberRank
    May 2016 Join Date
    94Posts

    Re: Stack magic tool fix [PlusEmulator]

    You could porcurar a fix for the room configs ? Even off the floor through habbos sometimes other habbos able to walk in others. Thank you.
    Last edited by Droppy; 22-05-16 at 11:13 PM. Reason: Removed offtopic content.

  8. #8
    Enthusiast desilva is offline
    MemberRank
    Oct 2015 Join Date
    40Posts

    Re: Stack magic tool fix [PlusEmulator]

    very important to fix, I will adopt him immediately in my retro

  9. #9
    Member MattSantos is offline
    MemberRank
    May 2016 Join Date
    94Posts

    Re: Stack magic tool fix [PlusEmulator]

    I used this fix but it all mobis were empilháveis.Já used this you went , but it did not work. @Keiz

  10. #10
    Apprentice Mortum is offline
    MemberRank
    Jun 2016 Join Date
    16Posts

    Re: Stack magic tool fix [PlusEmulator]

    you have to read carefully and do the steps right



Advertisement