mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 21:25:42 +12:00
Fix packetStr.SubString lengths; to make up for the fact received packets no longer terminate in \0
This commit is contained in:
parent
b665061308
commit
a9a5ef65b0
1 changed files with 388 additions and 391 deletions
|
@ -264,6 +264,8 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Requested Bird Map when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Requested Bird Map when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(packet.Length >= 2)
|
||||||
|
{
|
||||||
byte method = packet[1];
|
byte method = packet[1];
|
||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
|
@ -277,7 +279,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PLAYER_INTERACTION_PROFILE:
|
case PacketBuilder.PLAYER_INTERACTION_PROFILE:
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int playerId = -1;
|
int playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -300,7 +302,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PLAYER_INTERACTION_MUTE:
|
case PacketBuilder.PLAYER_INTERACTION_MUTE:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -328,7 +330,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PLAYER_INTERACTION_UNMUTE:
|
case PacketBuilder.PLAYER_INTERACTION_UNMUTE:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -356,7 +358,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PLAYER_INTERACTION_REMOVE_BUDDY:
|
case PacketBuilder.PLAYER_INTERACTION_REMOVE_BUDDY:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -384,7 +386,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PLAYER_INTERACTION_TAG:
|
case PacketBuilder.PLAYER_INTERACTION_TAG:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -423,7 +425,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PLAYER_INTERACTION_ADD_BUDDY:
|
case PacketBuilder.PLAYER_INTERACTION_ADD_BUDDY:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -447,7 +449,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
|
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string idStr = packetStr.Substring(2, packetStr.Length - 4);
|
string idStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
char firstChar = idStr[0];
|
char firstChar = idStr[0];
|
||||||
switch (firstChar)
|
switch (firstChar)
|
||||||
{
|
{
|
||||||
|
@ -518,7 +520,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PLAYER_INTERACTION_TRADE:
|
case PacketBuilder.PLAYER_INTERACTION_TRADE:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -560,6 +562,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void OnSocialPacket(GameClient sender, byte[] packet)
|
public static void OnSocialPacket(GameClient sender, byte[] packet)
|
||||||
{
|
{
|
||||||
if (!sender.LoggedIn)
|
if (!sender.LoggedIn)
|
||||||
|
@ -573,7 +576,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
case PacketBuilder.SOCIALS_MENU:
|
case PacketBuilder.SOCIALS_MENU:
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int playerId = -1;
|
int playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -722,7 +725,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent auction packet when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent auction packet when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet.Length < 4)
|
if (packet.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid sized auction packet: " + BitConverter.ToString(packet).Replace("-", " "));
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid sized auction packet: " + BitConverter.ToString(packet).Replace("-", " "));
|
||||||
return;
|
return;
|
||||||
|
@ -762,7 +765,7 @@ namespace HISP.Server
|
||||||
Auction auctionRoom = Auction.GetAuctionRoomById(int.Parse(tile.Code.Split('-')[1]));
|
Auction auctionRoom = Auction.GetAuctionRoomById(int.Parse(tile.Code.Split('-')[1]));
|
||||||
int auctionEntryId = -1;
|
int auctionEntryId = -1;
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string auctionEntryStr = packetStr.Substring(2, packetStr.Length - 4);
|
string auctionEntryStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auctionEntryId = int.Parse(auctionEntryStr);
|
auctionEntryId = int.Parse(auctionEntryStr);
|
||||||
|
@ -798,7 +801,7 @@ namespace HISP.Server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packet.Length < 3)
|
if(packet.Length < 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid sized horse interaction packet: " + BitConverter.ToString(packet).Replace("-", " "));
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid sized horse interaction packet: " + BitConverter.ToString(packet).Replace("-", " "));
|
||||||
return;
|
return;
|
||||||
|
@ -835,7 +838,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_FEED:
|
case PacketBuilder.HORSE_FEED:
|
||||||
int randomId = 0;
|
int randomId = 0;
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -864,7 +867,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_PET:
|
case PacketBuilder.HORSE_PET:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -882,8 +885,6 @@ namespace HISP.Server
|
||||||
int randMoodAddition = RandomNumberGenerator.Next(1, 20);
|
int randMoodAddition = RandomNumberGenerator.Next(1, 20);
|
||||||
int randTiredMinus = RandomNumberGenerator.Next(1, 10);
|
int randTiredMinus = RandomNumberGenerator.Next(1, 10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
string msgs = "";
|
string msgs = "";
|
||||||
if (horsePetInst.BasicStats.Mood + randMoodAddition >= 1000)
|
if (horsePetInst.BasicStats.Mood + randMoodAddition >= 1000)
|
||||||
{
|
{
|
||||||
|
@ -956,7 +957,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_VET_SERVICE:
|
case PacketBuilder.HORSE_VET_SERVICE:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
|
|
||||||
if (randomIdStr == "NaN")
|
if (randomIdStr == "NaN")
|
||||||
break;
|
break;
|
||||||
|
@ -1017,7 +1018,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_SHOE_IRON:
|
case PacketBuilder.HORSE_SHOE_IRON:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
|
|
||||||
if (randomIdStr == "NaN")
|
if (randomIdStr == "NaN")
|
||||||
break;
|
break;
|
||||||
|
@ -1141,7 +1142,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_GROOM_SERVICE:
|
case PacketBuilder.HORSE_GROOM_SERVICE:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
|
|
||||||
if (randomIdStr == "NaN")
|
if (randomIdStr == "NaN")
|
||||||
break;
|
break;
|
||||||
|
@ -1255,7 +1256,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_BARN_SERVICE:
|
case PacketBuilder.HORSE_BARN_SERVICE:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
|
|
||||||
if (randomIdStr == "NaN")
|
if (randomIdStr == "NaN")
|
||||||
break;
|
break;
|
||||||
|
@ -1371,7 +1372,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_TRAIN:
|
case PacketBuilder.HORSE_TRAIN:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
|
|
||||||
if (randomIdStr == "NaN")
|
if (randomIdStr == "NaN")
|
||||||
break;
|
break;
|
||||||
|
@ -1476,7 +1477,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_GIVE_FEED:
|
case PacketBuilder.HORSE_GIVE_FEED:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -1616,7 +1617,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_ENTER_ARENA:
|
case PacketBuilder.HORSE_ENTER_ARENA:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -1706,7 +1707,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_RELEASE:
|
case PacketBuilder.HORSE_RELEASE:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -1760,7 +1761,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_TACK:
|
case PacketBuilder.HORSE_TACK:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -1799,7 +1800,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -1853,7 +1854,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
int itemId = 0;
|
int itemId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string itemIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string itemIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
itemId = int.Parse(itemIdStr);
|
itemId = int.Parse(itemIdStr);
|
||||||
|
@ -2022,7 +2023,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_DISMOUNT:
|
case PacketBuilder.HORSE_DISMOUNT:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
|
|
||||||
if(randomIdStr == "") // F7 Shortcut
|
if(randomIdStr == "") // F7 Shortcut
|
||||||
{
|
{
|
||||||
|
@ -2069,7 +2070,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_MOUNT:
|
case PacketBuilder.HORSE_MOUNT:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -2093,7 +2094,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_LOOK:
|
case PacketBuilder.HORSE_LOOK:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
HorseInstance horseInst;
|
HorseInstance horseInst;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2185,7 +2186,7 @@ namespace HISP.Server
|
||||||
case PacketBuilder.HORSE_TRY_CAPTURE:
|
case PacketBuilder.HORSE_TRY_CAPTURE:
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
randomIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
randomId = int.Parse(randomIdStr);
|
randomId = int.Parse(randomIdStr);
|
||||||
|
@ -2230,7 +2231,7 @@ namespace HISP.Server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string dynamicInputStr = packetStr.Substring(1, packetStr.Length - 3);
|
string dynamicInputStr = packetStr.Substring(1, packetStr.Length - 2);
|
||||||
if(dynamicInputStr.Contains("|"))
|
if(dynamicInputStr.Contains("|"))
|
||||||
{
|
{
|
||||||
string[] dynamicInput = dynamicInputStr.Split('|');
|
string[] dynamicInput = dynamicInputStr.Split('|');
|
||||||
|
@ -2250,7 +2251,7 @@ namespace HISP.Server
|
||||||
switch(inputId)
|
switch(inputId)
|
||||||
{
|
{
|
||||||
case 1: // Bank
|
case 1: // Bank
|
||||||
if (dynamicInput.Length >= 2)
|
if (dynamicInput.Length >= 3)
|
||||||
{
|
{
|
||||||
Int64 moneyDeposited = 0;
|
Int64 moneyDeposited = 0;
|
||||||
Int64 moneyWithdrawn = 0;
|
Int64 moneyWithdrawn = 0;
|
||||||
|
@ -2287,7 +2288,6 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if((moneyDeposited <= sender.LoggedinUser.Money) && moneyDeposited != 0)
|
if((moneyDeposited <= sender.LoggedinUser.Money) && moneyDeposited != 0)
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.TakeMoney(Convert.ToInt32(moneyDeposited));
|
sender.LoggedinUser.TakeMoney(Convert.ToInt32(moneyDeposited));
|
||||||
|
@ -2810,7 +2810,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Requests player info when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Requests player info when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(packet.Length < 3)
|
if(packet.Length < 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent playerinfo packet of wrong size");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent playerinfo packet of wrong size");
|
||||||
}
|
}
|
||||||
|
@ -2834,7 +2834,7 @@ namespace HISP.Server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string buttonIdStr = packetStr.Substring(1, packetStr.Length - 3);
|
string buttonIdStr = packetStr.Substring(1, packetStr.Length - 2);
|
||||||
|
|
||||||
switch(buttonIdStr)
|
switch(buttonIdStr)
|
||||||
{
|
{
|
||||||
|
@ -3630,13 +3630,13 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Requested user information when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Requested user information when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(packet.Length <= 3)
|
if(packet.Length <= 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + "Sent invalid Arena Scored Packet.");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + "Sent invalid Arena Scored Packet.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string scoreStr = packetStr.Substring(1, packet.Length - 3);
|
string scoreStr = packetStr.Substring(1, packet.Length - 2);
|
||||||
int score = -1;
|
int score = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -3814,8 +3814,6 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnSwfModuleCommunication(GameClient sender, byte[] packet)
|
public static void OnSwfModuleCommunication(GameClient sender, byte[] packet)
|
||||||
|
@ -3825,7 +3823,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " tried to send swf communication when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " tried to send swf communication when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet.Length < 4)
|
if (packet.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid swf commmunication Packet");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid swf commmunication Packet");
|
||||||
return;
|
return;
|
||||||
|
@ -3836,13 +3834,13 @@ namespace HISP.Server
|
||||||
switch(module)
|
switch(module)
|
||||||
{
|
{
|
||||||
case PacketBuilder.SWFMODULE_INVITE:
|
case PacketBuilder.SWFMODULE_INVITE:
|
||||||
if(packet.Length < 4)
|
if(packet.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid 2PLAYER INVITE Packet (WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid 2PLAYER INVITE Packet (WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int playerId = -1;
|
int playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -3857,13 +3855,13 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.SWFMODULE_ACCEPT:
|
case PacketBuilder.SWFMODULE_ACCEPT:
|
||||||
if (packet.Length < 4)
|
if (packet.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid 2PLAYER ACCEPT Packet (WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid 2PLAYER ACCEPT Packet (WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
playerIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -3889,7 +3887,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
if(packet[2] == PacketBuilder.DRAWINGROOM_GET_DRAWING)
|
if(packet[2] == PacketBuilder.DRAWINGROOM_GET_DRAWING)
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -3915,7 +3913,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if(packet[2] == PacketBuilder.DRAWINGROOM_SAVE)
|
else if(packet[2] == PacketBuilder.DRAWINGROOM_SAVE)
|
||||||
{
|
{
|
||||||
if (packet.Length < 5)
|
if (packet.Length < 4)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -3967,7 +3965,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if (packet[2] == PacketBuilder.DRAWINGROOM_LOAD)
|
else if (packet[2] == PacketBuilder.DRAWINGROOM_LOAD)
|
||||||
{
|
{
|
||||||
if (packet.Length < 5)
|
if (packet.Length < 4)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -4031,7 +4029,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else // Default action- draw line
|
else // Default action- draw line
|
||||||
{
|
{
|
||||||
if (packet.Length < 5)
|
if (packet.Length < 4)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRAWINGROOM GET DRAWING packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -4059,7 +4057,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
|
|
||||||
string drawing = packetStr.Substring(3, packetStr.Length - 5);
|
string drawing = packetStr.Substring(3, packetStr.Length - 4);
|
||||||
if (drawing.Contains("X!")) // Clear byte
|
if (drawing.Contains("X!")) // Clear byte
|
||||||
{
|
{
|
||||||
room.Drawing = "";
|
room.Drawing = "";
|
||||||
|
@ -4082,14 +4080,14 @@ namespace HISP.Server
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.SWFMODULE_BRICKPOET:
|
case PacketBuilder.SWFMODULE_BRICKPOET:
|
||||||
if(packet.Length < 5)
|
if(packet.Length < 4)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(packet[2] == PacketBuilder.BRICKPOET_LIST_ALL)
|
if(packet[2] == PacketBuilder.BRICKPOET_LIST_ALL)
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET LIST ALL packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET LIST ALL packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -4113,7 +4111,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if(packet[3] == PacketBuilder.BRICKPOET_MOVE)
|
else if(packet[3] == PacketBuilder.BRICKPOET_MOVE)
|
||||||
{
|
{
|
||||||
if (packet.Length < 0xB)
|
if (packet.Length < 0xA)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET MOVE packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid BRICKPOET MOVE packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -4184,7 +4182,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.SWFMODULE_DRESSUPROOM:
|
case PacketBuilder.SWFMODULE_DRESSUPROOM:
|
||||||
if (packet.Length < 6)
|
if ( packet.Length < 5 )
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -4203,7 +4201,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else // Move
|
else // Move
|
||||||
{
|
{
|
||||||
if (packet.Length < 9)
|
if (packet.Length < 8)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM MOVE packet (swf communication, WRONG SIZE)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent invalid DRESSUPROOM MOVE packet (swf communication, WRONG SIZE)");
|
||||||
break;
|
break;
|
||||||
|
@ -4218,7 +4216,7 @@ namespace HISP.Server
|
||||||
Dressup.DressupRoom room = Dressup.GetDressupRoom(roomId);
|
Dressup.DressupRoom room = Dressup.GetDressupRoom(roomId);
|
||||||
|
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string moveStr = packetStr.Substring(3, packetStr.Length - 5);
|
string moveStr = packetStr.Substring(3, packetStr.Length - 4);
|
||||||
|
|
||||||
string[] moves = moveStr.Split('|');
|
string[] moves = moveStr.Split('|');
|
||||||
|
|
||||||
|
@ -4343,7 +4341,7 @@ namespace HISP.Server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packet.Length < 4)
|
if(packet.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid wish Packet");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid wish Packet");
|
||||||
return;
|
return;
|
||||||
|
@ -4438,7 +4436,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Requested stats when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Requested stats when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(packet.Length < 3)
|
if(packet.Length < 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + "Sent an invalid Stats Packet");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + "Sent an invalid Stats Packet");
|
||||||
return;
|
return;
|
||||||
|
@ -4475,7 +4473,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
|
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
if (packet.Length < 3 || !packetStr.Contains('|'))
|
if (packet.Length <= 4 || !packetStr.Contains('|'))
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid Profile SAVE Packet");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid Profile SAVE Packet");
|
||||||
return;
|
return;
|
||||||
|
@ -4484,11 +4482,9 @@ namespace HISP.Server
|
||||||
int characterId = (packet[2] - 20) * 64 + (packet[3] - 20);
|
int characterId = (packet[2] - 20) * 64 + (packet[3] - 20);
|
||||||
|
|
||||||
string profilePage = packetStr.Split('|')[1];
|
string profilePage = packetStr.Split('|')[1];
|
||||||
profilePage = profilePage.Substring(0, profilePage.Length - 2);
|
profilePage = profilePage.Substring(0, profilePage.Length - 1);
|
||||||
sender.LoggedinUser.CharacterId = characterId;
|
sender.LoggedinUser.CharacterId = characterId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (profilePage.Length > 4000)
|
if (profilePage.Length > 4000)
|
||||||
{
|
{
|
||||||
byte[] notSaved = PacketBuilder.CreateChat(Messages.ProfileTooLongMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] notSaved = PacketBuilder.CreateChat(Messages.ProfileTooLongMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
@ -4523,14 +4519,14 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
||||||
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode AWARD request with invalid size");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode AWARD request with invalid size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string awardIdStr = packetStr.Substring(6, packetStr.Length - 6 - 2);
|
string awardIdStr = packetStr.Substring(6, packetStr.Length - 6 - 1);
|
||||||
|
|
||||||
int value = -1;
|
int value = -1;
|
||||||
try
|
try
|
||||||
|
@ -4565,7 +4561,7 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
||||||
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode score/time/winloose request with invalid size");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode score/time/winloose request with invalid size");
|
||||||
return;
|
return;
|
||||||
|
@ -4573,7 +4569,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
|
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string gameInfoStr = packetStr.Substring(6, packetStr.Length - 6 - 2);
|
string gameInfoStr = packetStr.Substring(6, packetStr.Length - 6 - 1);
|
||||||
if (winloose)
|
if (winloose)
|
||||||
{
|
{
|
||||||
string gameTitle = gameInfoStr.Substring(1);
|
string gameTitle = gameInfoStr.Substring(1);
|
||||||
|
@ -4690,14 +4686,14 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
||||||
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode money request with invalid size");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode money request with invalid size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string gameInfoStr = packetStr.Substring(6, packetStr.Length - 6 - 2);
|
string gameInfoStr = packetStr.Substring(6, packetStr.Length - 6 - 1);
|
||||||
if (gameInfoStr.Contains("|"))
|
if (gameInfoStr.Contains("|"))
|
||||||
{
|
{
|
||||||
string[] moneyInfo = gameInfoStr.Split('|');
|
string[] moneyInfo = gameInfoStr.Split('|');
|
||||||
|
@ -4745,13 +4741,13 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
||||||
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode item request with invalid size");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode item request with invalid size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string intStr = packetStr.Substring(6, packetStr.Length - 6 - 2);
|
string intStr = packetStr.Substring(6, packetStr.Length - 6 - 1);
|
||||||
int value = -1;
|
int value = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -4805,13 +4801,13 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
||||||
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode item request with invalid size");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode item request with invalid size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string intStr = packetStr.Substring(6, packetStr.Length - 6 - 2);
|
string intStr = packetStr.Substring(6, packetStr.Length - 6 - 1);
|
||||||
int value = -1;
|
int value = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -4858,13 +4854,13 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Sent sec code: " + BitConverter.ToString(GotSecCode).Replace("-", " "));
|
||||||
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
if (ExpectedSecCode.SequenceEqual(GotSecCode))
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode quest request with invalid size");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent a seccode quest request with invalid size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string intStr = packetStr.Substring(6, packetStr.Length - 6 - 2);
|
string intStr = packetStr.Substring(6, packetStr.Length - 6 - 1);
|
||||||
int value = -1;
|
int value = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -4902,7 +4898,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.MajorPriority = true;
|
sender.LoggedinUser.MajorPriority = true;
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string gameName = packetStr.Substring(2, packetStr.Length - 4);
|
string gameName = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
byte[] metaTag = PacketBuilder.CreateMeta(Meta.BuildTopHighscores(gameName));
|
byte[] metaTag = PacketBuilder.CreateMeta(Meta.BuildTopHighscores(gameName));
|
||||||
sender.SendPacket(metaTag);
|
sender.SendPacket(metaTag);
|
||||||
}
|
}
|
||||||
|
@ -4910,7 +4906,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.MajorPriority = true;
|
sender.LoggedinUser.MajorPriority = true;
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string gameName = packetStr.Substring(2, packetStr.Length - 4);
|
string gameName = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
byte[] metaTag = PacketBuilder.CreateMeta(Meta.BuildTopTimes(gameName));
|
byte[] metaTag = PacketBuilder.CreateMeta(Meta.BuildTopTimes(gameName));
|
||||||
sender.SendPacket(metaTag);
|
sender.SendPacket(metaTag);
|
||||||
}
|
}
|
||||||
|
@ -4918,7 +4914,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.MajorPriority = true;
|
sender.LoggedinUser.MajorPriority = true;
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string gameName = packetStr.Substring(2, packetStr.Length - 4);
|
string gameName = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
byte[] metaTag = PacketBuilder.CreateMeta(Meta.BuildTopWinners(gameName));
|
byte[] metaTag = PacketBuilder.CreateMeta(Meta.BuildTopWinners(gameName));
|
||||||
sender.SendPacket(metaTag);
|
sender.SendPacket(metaTag);
|
||||||
}
|
}
|
||||||
|
@ -4960,7 +4956,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
if(loggedInUser.CurrentlyRidingHorse.BasicStats.Experience < 25)
|
if(loggedInUser.CurrentlyRidingHorse.BasicStats.Experience < 25)
|
||||||
{
|
{
|
||||||
if(GameServer.RandomNumberGenerator.Next(0, 100) >= 97 || sender.LoggedinUser.Username.ToLower() == "dream")
|
if(GameServer.RandomNumberGenerator.Next(0, 100) == 97)
|
||||||
{
|
{
|
||||||
loggedInUser.CurrentlyRidingHorse.BasicStats.Experience++;
|
loggedInUser.CurrentlyRidingHorse.BasicStats.Experience++;
|
||||||
byte[] horseBuckedMessage;
|
byte[] horseBuckedMessage;
|
||||||
|
@ -5236,7 +5232,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent npc interaction packet when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent npc interaction packet when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet.Length < 3)
|
if (packet.Length < 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid npc interaction packet.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid npc interaction packet.");
|
||||||
return;
|
return;
|
||||||
|
@ -5246,7 +5242,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
|
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string number = packetStr.Substring(2, packetStr.Length - 4);
|
string number = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int chatId = 0;
|
int chatId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -5284,7 +5280,7 @@ namespace HISP.Server
|
||||||
else if (action == PacketBuilder.NPC_CONTINUE_CHAT)
|
else if (action == PacketBuilder.NPC_CONTINUE_CHAT)
|
||||||
{
|
{
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string number = packetStr.Substring(2, packetStr.Length - 4);
|
string number = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int replyId = 0;
|
int replyId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -5327,7 +5323,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent transport packet when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent transport packet when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet.Length < 3)
|
if (packet.Length < 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid transport packet.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid transport packet.");
|
||||||
return;
|
return;
|
||||||
|
@ -5335,7 +5331,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
|
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string number = packetStr.Substring(1, packetStr.Length - 3);
|
string number = packetStr.Substring(1, packetStr.Length - 2);
|
||||||
|
|
||||||
int transportid;
|
int transportid;
|
||||||
try
|
try
|
||||||
|
@ -5425,7 +5421,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent ranch packet when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent ranch packet when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet.Length < 4)
|
if (packet.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid ranch packet.");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid ranch packet.");
|
||||||
return;
|
return;
|
||||||
|
@ -5435,7 +5431,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
if (method == PacketBuilder.RANCH_INFO)
|
if (method == PacketBuilder.RANCH_INFO)
|
||||||
{
|
{
|
||||||
string buildingIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string buildingIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int buildingId = 0;
|
int buildingId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -5463,7 +5459,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if (method == PacketBuilder.RANCH_SELL)
|
else if (method == PacketBuilder.RANCH_SELL)
|
||||||
{
|
{
|
||||||
string NanSTR = packetStr.Substring(2, packetStr.Length - 4);
|
string NanSTR = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
if (NanSTR == "NaN")
|
if (NanSTR == "NaN")
|
||||||
{
|
{
|
||||||
if (sender.LoggedinUser.OwnedRanch == null)
|
if (sender.LoggedinUser.OwnedRanch == null)
|
||||||
|
@ -5494,7 +5490,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if (method == PacketBuilder.RANCH_UPGRADE)
|
else if (method == PacketBuilder.RANCH_UPGRADE)
|
||||||
{
|
{
|
||||||
string NanSTR = packetStr.Substring(2, packetStr.Length - 4);
|
string NanSTR = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
if (NanSTR == "NaN")
|
if (NanSTR == "NaN")
|
||||||
{
|
{
|
||||||
if (sender.LoggedinUser.OwnedRanch != null)
|
if (sender.LoggedinUser.OwnedRanch != null)
|
||||||
|
@ -5545,7 +5541,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if (method == PacketBuilder.RANCH_REMOVE)
|
else if (method == PacketBuilder.RANCH_REMOVE)
|
||||||
{
|
{
|
||||||
string buildingIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string buildingIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int buildingId = 0;
|
int buildingId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -5603,7 +5599,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if (method == PacketBuilder.RANCH_BUILD)
|
else if (method == PacketBuilder.RANCH_BUILD)
|
||||||
{
|
{
|
||||||
string buildingIdStr = packetStr.Substring(2, packetStr.Length - 4);
|
string buildingIdStr = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
int buildingId = 0;
|
int buildingId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -5657,7 +5653,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if (method == PacketBuilder.RANCH_BUY)
|
else if (method == PacketBuilder.RANCH_BUY)
|
||||||
{
|
{
|
||||||
string nan = packetStr.Substring(2, packetStr.Length - 4);
|
string nan = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
if (nan == "NaN")
|
if (nan == "NaN")
|
||||||
{
|
{
|
||||||
if (Ranch.IsRanchHere(sender.LoggedinUser.X, sender.LoggedinUser.Y))
|
if (Ranch.IsRanchHere(sender.LoggedinUser.X, sender.LoggedinUser.Y))
|
||||||
|
@ -5693,7 +5689,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else if (method == PacketBuilder.RANCH_CLICK)
|
else if (method == PacketBuilder.RANCH_CLICK)
|
||||||
{
|
{
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid ranch click packet.");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid ranch click packet.");
|
||||||
return;
|
return;
|
||||||
|
@ -5772,7 +5768,7 @@ namespace HISP.Server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.Length < 4)
|
if (packet.Length < 3)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid chat packet.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid chat packet.");
|
||||||
return;
|
return;
|
||||||
|
@ -5782,7 +5778,7 @@ namespace HISP.Server
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
|
|
||||||
Chat.ChatChannel channel = (Chat.ChatChannel)packet[1];
|
Chat.ChatChannel channel = (Chat.ChatChannel)packet[1];
|
||||||
string message = packetStr.Substring(2, packetStr.Length - 4);
|
string message = packetStr.Substring(2, packetStr.Length - 3);
|
||||||
|
|
||||||
Logger.DebugPrint(sender.LoggedinUser.Username + " Attempting to say '" + message + "' in channel: " + channel.ToString());
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Attempting to say '" + message + "' in channel: " + channel.ToString());
|
||||||
|
|
||||||
|
@ -6048,7 +6044,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Send click packet when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Send click packet when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet.Length < 6)
|
if (packet.Length < 5)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid Click Packet");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid Click Packet");
|
||||||
return;
|
return;
|
||||||
|
@ -6057,7 +6053,7 @@ namespace HISP.Server
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
if(packetStr.Contains("|"))
|
if(packetStr.Contains("|"))
|
||||||
{
|
{
|
||||||
string packetContents = packetStr.Substring(1, packetStr.Length - 3);
|
string packetContents = packetStr.Substring(1, packetStr.Length - 2);
|
||||||
string[] xy = packetContents.Split('|');
|
string[] xy = packetContents.Split('|');
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
@ -6126,7 +6122,7 @@ namespace HISP.Server
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent object interaction packet when not logged in.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent object interaction packet when not logged in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet.Length < 3)
|
if (packet.Length < 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. " + BitConverter.ToString(packet));
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent an invalid object interaction packet. " + BitConverter.ToString(packet));
|
||||||
return;
|
return;
|
||||||
|
@ -6160,7 +6156,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_PICKUP:
|
case PacketBuilder.ITEM_PICKUP:
|
||||||
string packetStr = Encoding.UTF8.GetString(packet);
|
string packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string randomIdStr = packetStr.Substring(2, packet.Length - 4);
|
string randomIdStr = packetStr.Substring(2, packet.Length - 3);
|
||||||
int randomId = 0;
|
int randomId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -6325,7 +6321,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_THROW:
|
case PacketBuilder.ITEM_THROW:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string itemidStr = packetStr.Substring(2, packet.Length - 2);
|
string itemidStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
int itemId = 0;
|
int itemId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -6391,7 +6387,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_WRAP:
|
case PacketBuilder.ITEM_WRAP:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 2);
|
randomIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -6427,7 +6423,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_OPEN:
|
case PacketBuilder.ITEM_OPEN:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 2);
|
randomIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -6473,7 +6469,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_USE:
|
case PacketBuilder.ITEM_USE:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 4);
|
randomIdStr = packetStr.Substring(2, packet.Length - 3);
|
||||||
|
|
||||||
if(randomIdStr == "") // f12 ranch shortcut
|
if(randomIdStr == "") // f12 ranch shortcut
|
||||||
{
|
{
|
||||||
|
@ -6510,7 +6506,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_WEAR:
|
case PacketBuilder.ITEM_WEAR:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 2);
|
randomIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -6626,7 +6622,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_DRINK:
|
case PacketBuilder.ITEM_DRINK:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string idStr = packetStr.Substring(2, packet.Length - 4);
|
string idStr = packetStr.Substring(2, packet.Length - 3);
|
||||||
if(idStr == "NaN") // Fountain
|
if(idStr == "NaN") // Fountain
|
||||||
{
|
{
|
||||||
string msg = Messages.FountainDrankYourFull;
|
string msg = Messages.FountainDrankYourFull;
|
||||||
|
@ -6651,7 +6647,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_CONSUME:
|
case PacketBuilder.ITEM_CONSUME:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 3);
|
randomIdStr = packetStr.Substring(2, packet.Length - 2);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -6689,7 +6685,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_DROP:
|
case PacketBuilder.ITEM_DROP:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 2);
|
randomIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -6763,7 +6759,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_CRAFT:
|
case PacketBuilder.ITEM_CRAFT:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string craftIdStr = packetStr.Substring(2, packet.Length - 2);
|
string craftIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
int craftId = 0;
|
int craftId = 0;
|
||||||
// Prevent crashing on non-int string.
|
// Prevent crashing on non-int string.
|
||||||
try
|
try
|
||||||
|
@ -6842,7 +6838,7 @@ namespace HISP.Server
|
||||||
int message = 1;
|
int message = 1;
|
||||||
|
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 2);
|
randomIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
// Prevent crashing on non-int string.
|
// Prevent crashing on non-int string.
|
||||||
try
|
try
|
||||||
|
@ -6866,7 +6862,7 @@ namespace HISP.Server
|
||||||
goto doSell;
|
goto doSell;
|
||||||
case PacketBuilder.ITEM_SELL_ALL:
|
case PacketBuilder.ITEM_SELL_ALL:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string itemIdStr = packetStr.Substring(2, packet.Length - 2);
|
string itemIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
itemId = 0;
|
itemId = 0;
|
||||||
// Prevent crashing on non-int string.
|
// Prevent crashing on non-int string.
|
||||||
try
|
try
|
||||||
|
@ -6944,7 +6940,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
case PacketBuilder.ITEM_BUY_AND_CONSUME:
|
case PacketBuilder.ITEM_BUY_AND_CONSUME:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
itemIdStr = packetStr.Substring(2, packet.Length - 3);
|
itemIdStr = packetStr.Substring(2, packet.Length - 2);
|
||||||
itemId = 0;
|
itemId = 0;
|
||||||
// Prevent crashing on non-int string.
|
// Prevent crashing on non-int string.
|
||||||
try
|
try
|
||||||
|
@ -7023,7 +7019,7 @@ namespace HISP.Server
|
||||||
count = 25;
|
count = 25;
|
||||||
doPurchase:;
|
doPurchase:;
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
itemIdStr = packetStr.Substring(2, packet.Length - 3);
|
itemIdStr = packetStr.Substring(2, packet.Length - 2);
|
||||||
itemId = 0;
|
itemId = 0;
|
||||||
// Prevent crashing on non-int string.
|
// Prevent crashing on non-int string.
|
||||||
try
|
try
|
||||||
|
@ -7155,7 +7151,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.ITEM_RIP:
|
case PacketBuilder.ITEM_RIP:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(2, packet.Length - 2);
|
randomIdStr = packetStr.Substring(2, packet.Length - 1);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -7190,7 +7186,7 @@ namespace HISP.Server
|
||||||
if (method == PacketBuilder.ITEM_LOOK)
|
if (method == PacketBuilder.ITEM_LOOK)
|
||||||
{
|
{
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
itemIdStr = packetStr.Substring(3, packet.Length - 3);
|
itemIdStr = packetStr.Substring(3, packet.Length - 2);
|
||||||
itemId = 0;
|
itemId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -7219,7 +7215,7 @@ namespace HISP.Server
|
||||||
else if(method == PacketBuilder.ITEM_READ)
|
else if(method == PacketBuilder.ITEM_READ)
|
||||||
{
|
{
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
randomIdStr = packetStr.Substring(3, packet.Length - 3);
|
randomIdStr = packetStr.Substring(3, packet.Length - 2);
|
||||||
randomId = 0;
|
randomId = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -7260,7 +7256,7 @@ namespace HISP.Server
|
||||||
break;
|
break;
|
||||||
case PacketBuilder.PACKET_INFORMATION:
|
case PacketBuilder.PACKET_INFORMATION:
|
||||||
packetStr = Encoding.UTF8.GetString(packet);
|
packetStr = Encoding.UTF8.GetString(packet);
|
||||||
string valueStr = packetStr.Substring(3, packet.Length - 3);
|
string valueStr = packetStr.Substring(3, packet.Length - 2);
|
||||||
int value = 0;
|
int value = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -7335,7 +7331,7 @@ namespace HISP.Server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.Length < 2)
|
if (packet.Length < 1)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid inventory request packet.");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid inventory request packet.");
|
||||||
return;
|
return;
|
||||||
|
@ -7349,7 +7345,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
string loginRequestString = Encoding.UTF8.GetString(packet).Substring(1);
|
string loginRequestString = Encoding.UTF8.GetString(packet).Substring(1);
|
||||||
|
|
||||||
if (!loginRequestString.Contains('|') || packet.Length < 3)
|
if (!loginRequestString.Contains('|') || packet.Length < 2)
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid login request");
|
Logger.ErrorPrint(sender.RemoteIp + " Sent an invalid login request");
|
||||||
return;
|
return;
|
||||||
|
@ -7946,14 +7942,15 @@ namespace HISP.Server
|
||||||
forClient.LoggedinUser.MajorPriority = false;
|
forClient.LoggedinUser.MajorPriority = false;
|
||||||
forClient.LoggedinUser.MinorPriority = false;
|
forClient.LoggedinUser.MinorPriority = false;
|
||||||
|
|
||||||
string LocationStr = "";
|
string locationStr;
|
||||||
|
|
||||||
int tileX = forClient.LoggedinUser.X;
|
int tileX = forClient.LoggedinUser.X;
|
||||||
int tileY = forClient.LoggedinUser.Y;
|
int tileY = forClient.LoggedinUser.Y;
|
||||||
if (!World.InSpecialTile(tileX, tileY))
|
if (!World.InSpecialTile(tileX, tileY))
|
||||||
{
|
{
|
||||||
if (forClient.LoggedinUser.InRealTimeQuiz)
|
if (forClient.LoggedinUser.InRealTimeQuiz)
|
||||||
return;
|
return;
|
||||||
LocationStr = Meta.BuildMetaInfo(forClient.LoggedinUser, tileX, tileY);
|
locationStr = Meta.BuildMetaInfo(forClient.LoggedinUser, tileX, tileY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7973,12 +7970,12 @@ namespace HISP.Server
|
||||||
if (specialTile.Code != null)
|
if (specialTile.Code != null)
|
||||||
if (!ProcessMapCodeWithArg(forClient, specialTile))
|
if (!ProcessMapCodeWithArg(forClient, specialTile))
|
||||||
return;
|
return;
|
||||||
LocationStr = Meta.BuildSpecialTileInfo(forClient.LoggedinUser, specialTile);
|
locationStr = Meta.BuildSpecialTileInfo(forClient.LoggedinUser, specialTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
byte[] AreaMessage = PacketBuilder.CreateMeta(LocationStr);
|
byte[] areaMessage = PacketBuilder.CreateMeta(locationStr);
|
||||||
forClient.SendPacket(AreaMessage);
|
forClient.SendPacket(areaMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void UpdateStats(GameClient client)
|
public static void UpdateStats(GameClient client)
|
||||||
|
|
Loading…
Add table
Reference in a new issue