Fix crashing on talking to npcs with 0 chatpoints.

This commit is contained in:
SilicaAndPina 2021-02-09 21:25:12 +13:00
parent d776d2adc3
commit fa8f21388c
8 changed files with 214 additions and 10 deletions

View file

@ -282,9 +282,16 @@ namespace HISP.Game
continue;
message += Messages.FormatNpcStartChatMessage(ent.IconId, ent.Name, ent.ShortDescription, ent.Id);
if (ent.LongDescription != "")
message += Messages.FormatNpcInformationButton(ent.Id);
message += Messages.FormatNpcTalkButton(ent.Id);
if(ent.Chatpoints.Length > 0)
{
if (ent.LongDescription != "")
message += Messages.FormatNpcInformationButton(ent.Id);
message += Messages.FormatNpcTalkButton(ent.Id);
}
else
{
message += Messages.NpcNoChatpoints;
}
message += "^R1";
}
return message;
@ -1017,7 +1024,31 @@ namespace HISP.Game
return message;
}
private static string buildRanch(User user, int ranchId)
{
string message = "";
Ranch ranch = Ranch.GetRanchById(ranchId);
bool mine = (ranch.OwnerId == user.Id);
string swfModule = ranch.GetSwf(mine);
byte[] moduleSwf = PacketBuilder.CreateSwfModulePacket(swfModule, PacketBuilder.PACKET_SWF_MODULE_FORCE);
user.LoggedinClient.SendPacket(moduleSwf);
if (mine) // This is My DS.
{
}
else if(ranch.OwnerId == -1) // No mans sky
{
}
else
{
}
return message;
}
private static string buildWorkshop(User user)
{
Workshop shop = Workshop.GetWorkshopAt(user.X, user.Y);
@ -1176,6 +1207,10 @@ namespace HISP.Game
{
message += buildMudHole(user);
}
if(TileCode == "RANCH")
{
message += buildRanch(user, int.Parse(TileArg));
}
if(TileCode == "MULTIROOM")
{
user.MetaPriority = false; // acturally want to track updates here >-<