Fix crashing, add mroe logging

This commit is contained in:
Bluzume 2021-11-05 20:18:04 -04:00
parent 23711f47b4
commit 4ad3bd1432

View file

@ -6068,7 +6068,7 @@ namespace HISP.Server
} }
if (packet.Length < 3) if (packet.Length < 3)
{ {
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet."); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. " + BitConverter.ToString(packet));
return; return;
} }
@ -6109,7 +6109,7 @@ namespace HISP.Server
} }
catch(FormatException) catch(FormatException)
{ {
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet."); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. " + BitConverter.ToString(packet));
return; return;
} }
@ -6274,7 +6274,7 @@ namespace HISP.Server
} }
catch (FormatException) catch (FormatException)
{ {
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. (THROW)"); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. (THROW) " + BitConverter.ToString(packet));
return; return;
} }
if (sender.LoggedinUser.Inventory.HasItemId(itemId)) if (sender.LoggedinUser.Inventory.HasItemId(itemId))
@ -6340,7 +6340,7 @@ namespace HISP.Server
} }
catch (FormatException) catch (FormatException)
{ {
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet."); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. " + BitConverter.ToString(packet));
return; return;
} }
if (sender.LoggedinUser.Inventory.HasItem(randomId)) if (sender.LoggedinUser.Inventory.HasItem(randomId))
@ -6376,7 +6376,7 @@ namespace HISP.Server
} }
catch (FormatException) catch (FormatException)
{ {
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet."); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. " + BitConverter.ToString(packet));
return; return;
} }
if (sender.LoggedinUser.Inventory.HasItem(randomId)) if (sender.LoggedinUser.Inventory.HasItem(randomId))
@ -6426,7 +6426,7 @@ namespace HISP.Server
} }
catch (FormatException) catch (FormatException)
{ {
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet."); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. " + BitConverter.ToString(packet));
return; return;
} }
if (sender.LoggedinUser.Inventory.HasItem(randomId)) if (sender.LoggedinUser.Inventory.HasItem(randomId))
@ -7192,7 +7192,7 @@ namespace HISP.Server
} }
catch (FormatException) catch (FormatException)
{ {
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet."); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. "+BitConverter.ToString(packet));
return; return;
} }
if (packet[2] == PacketBuilder.ITEM_INFORMATON) if (packet[2] == PacketBuilder.ITEM_INFORMATON)
@ -7838,15 +7838,17 @@ namespace HISP.Server
forClient.LoggedinUser.ListingAuction = false; forClient.LoggedinUser.ListingAuction = false;
string LocationStr = ""; string LocationStr = "";
if (!World.InSpecialTile(forClient.LoggedinUser.X, forClient.LoggedinUser.Y)) int tileX = forClient.LoggedinUser.X;
int tileY = forClient.LoggedinUser.Y;
if (!World.InSpecialTile(tileX, tileY))
{ {
if (forClient.LoggedinUser.InRealTimeQuiz) if (forClient.LoggedinUser.InRealTimeQuiz)
return; return;
LocationStr = Meta.BuildMetaInfo(forClient.LoggedinUser, forClient.LoggedinUser.X, forClient.LoggedinUser.Y); LocationStr = Meta.BuildMetaInfo(forClient.LoggedinUser, tileX, tileY);
} }
else else
{ {
World.SpecialTile specialTile = World.GetSpecialTile(forClient.LoggedinUser.X, forClient.LoggedinUser.Y); World.SpecialTile specialTile = World.GetSpecialTile(tileX, tileY);
if (specialTile.AutoplaySwf != null && specialTile.AutoplaySwf != "") if (specialTile.AutoplaySwf != null && specialTile.AutoplaySwf != "")
{ {
byte[] swfModulePacket = PacketBuilder.CreateSwfModulePacket(specialTile.AutoplaySwf,PacketBuilder.PACKET_SWF_MODULE_GENTLE); byte[] swfModulePacket = PacketBuilder.CreateSwfModulePacket(specialTile.AutoplaySwf,PacketBuilder.PACKET_SWF_MODULE_GENTLE);