UberEmu FIX (YOU NEED) (Items Bug)
Replace your whole SetFlooritem Void in Room.cs
With:
Code:
public bool SetFloorItem(GameClient Session, RoomItem Item, int newX, int newY, int newRot, bool newItem)
{
// Find affected tiles
Dictionary<int, AffectedTile> AffectedTiles = GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, newRot);
// Verify tiles are valid
if (!ValidTile(newX, newY))
{
return false;
}
foreach (AffectedTile Tile in AffectedTiles.Values)
{
if (!ValidTile(Tile.X, Tile.Y))
{
return false;
}
}
// Start calculating new Z coordinate
double newZ = Model.SqFloorHeight[newX, newY];
// Is the item trying to stack on itself!?
if (Item.Rot == newRot && Item.X == newX && Item.Y == newY && Item.Z != newZ)
{
return false;
}
// Make sure this tile is open and there are no users here
if (Model.SqState[newX, newY] != SquareState.OPEN)
{
return false;
}
foreach (AffectedTile Tile in AffectedTiles.Values)
{
if (Model.SqState[Tile.X, Tile.Y] != SquareState.OPEN)
{
return false;
}
}
// And that we have no users
if (!Item.GetBaseItem().IsSeat)
{
if (SquareHasUsers(newX, newY))
{
return false;
}
foreach (AffectedTile Tile in AffectedTiles.Values)
{
if (SquareHasUsers(Tile.X, Tile.Y))
{
return false;
}
}
}
// Find affected objects
List<RoomItem> ItemsOnTile = GetFurniObjects(newX, newY);
List<RoomItem> ItemsAffected = new List<RoomItem>();
List<RoomItem> ItemsComplete = new List<RoomItem>();
foreach (AffectedTile Tile in AffectedTiles.Values)
{
List<RoomItem> Temp = GetFurniObjects(Tile.X, Tile.Y);
if (Temp != null)
{
ItemsAffected.AddRange(Temp);
}
}
if (ItemsOnTile == null) ItemsOnTile = new List<RoomItem>();
ItemsComplete.AddRange(ItemsOnTile);
ItemsComplete.AddRange(ItemsAffected);
// Check for items in the stack that do not allow stacking on top of them
foreach (RoomItem I in ItemsComplete)
{
if (I.Id == Item.Id)
{
continue;
}
if (!I.GetBaseItem().Stackable)
{
return false;
}
}
// If this is a rotating action, maintain item at current height
if (Item.Rot != newRot && Item.X == newX && Item.Y == newY)
{
newZ = Item.Z;
}
// Are there any higher objects in the stack!?
foreach (RoomItem I in ItemsComplete)
{
if (I.Id == Item.Id)
{
continue; // cannot stack on self
}
/*if (I.GetBaseItem().Height == 0.5)
{
Console.WriteLine("" + I.GetBaseItem().Name + " Is lower than 1 [is fixing]");
double Shit = I.GetBaseItem().Height;
newZ = I.Z + Shit;
Console.WriteLine("" + newZ + " = Bette than Zer0");
}*/
if (I.TotalHeight > newZ)
{
newZ = I.TotalHeight;
}
}
// Verify the rotation is correct
if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8)
{
newRot = 0;
}
Item.X = newX;
Item.Y = newY;
Item.Z = newZ;
Item.Rot = newRot;
Item.Interactor.OnPlace(Session, Item);
//Console.WriteLine("" + newZ + " = finally");
string NewZ = newZ.ToString().Replace(',','.');
if (newItem)
{
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("extra_data", Item.ExtraData);
dbClient.ExecuteQuery("INSERT INTO room_items (id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('" + Item.Id + "','" + RoomId + "','" + Item.BaseItem + "',@extra_data,'" + Item.X + "','" + Item.Y + "','" + NewZ + "','" + Item.Rot + "','')");
}
Items.Add(Item);
ServerMessage Message = new ServerMessage(93);
Item.Serialize(Message);
SendMessage(Message);
}
else
{
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE room_items SET x = '" + Item.X + "', y = '" + Item.Y + "', z = '" + NewZ + "', rot = '" + Item.Rot + "', wall_pos = '' WHERE id = '" + Item.Id + "' LIMIT 1");
}
ServerMessage Message = new ServerMessage(95);
Item.Serialize(Message);
SendMessage(Message);
}
GenerateMaps();
UpdateUserStatusses();
return true;
}
Credits to me for editing it,
Meth0d Has coded it.
DONT FOREGET TO PUSH THE 'THANK' BUTTON (Thx)
Re: UberEmu Stacking Bug fix 100%
Thanks for sharing, but maybe you can tell what's the bug?
Re: UberEmu Stacking Bug fix 100%
Great release - but may i ask what was wrong with the stacking?
Re: UberEmu Stacking Bug fix 100%
Thanks, and the problem was that sometimes 2 furni stack in each other when you reload the room, this is fixed now :)
Re: UberEmu Stacking Bug fix 100%
thanks mate really needed this
Re: UberEmu Stacking Bug fix 100%
oh lol i found some weird spanish thing about this without any code i just needed to replace something in my computer with a .
Re: UberEmu Stacking Bug fix 100%
What was fixed like the code only?
Re: UberEmu Stacking Bug fix 100%
Quote:
Originally Posted by
matty13
What was fixed like the code only?
Read my post above :p
Re: UberEmu Stacking Bug fix 100%
Re: UberEmu Stacking Bug fix 100%
You have more uber fixes? I use iJakey's Uber Server, and over 250+ online I get crashes. Send me PM Wichard I send you my MSN im from habbohotel.biz
Re: UberEmu Stacking Bug fix 100%
Maybe a little suggestion, maybe you could fix how people can walk on top of mats that are high, you can't make mazes because of that, they can just get back on if they fall off. I hope this could be done {: anyways, nice release.
Re: UberEmu Stacking Bug fix 100%
Nice Release Wichard, Looking foward for some more good fixes.
Re: UberEmu Stacking Bug fix 100%
Quote:
Originally Posted by
Ðavid
Maybe a little suggestion, maybe you could fix how people can walk on top of mats that are high, you can't make mazes because of that, they can just get back on if they fall off. I hope this could be done {: anyways, nice release.
You mean that people can walk on high stacked items?
Yeah we can code that, that's easy stuff :P
Re: UberEmu Stacking Bug fix 100%
Quote:
Originally Posted by
PEjump2
You mean that people can walk on high stacked items?
Yeah we can code that, that's easy stuff :P
That is indeed very easy, i will get a code together if anyone wants this?
Re: UberEmu Stacking Bug fix 100%
Quote:
Originally Posted by
matty13
That is indeed very easy, i will get a code together if anyone wants this?
It would be nice!