Add pot of gold.

This commit is contained in:
SilicaAndPina 2021-02-12 12:13:37 +13:00
parent 2c77957434
commit a7ad6fc60c
6 changed files with 31 additions and 4 deletions

View file

@ -419,6 +419,7 @@ namespace HISP.Game
// Treasure
public static string PirateTreasureFormat;
public static string PotOfGoldFormat;
// Groomer
@ -778,6 +779,10 @@ namespace HISP.Game
{
return PirateTreasureFormat.Replace("%PRIZE%", prize.ToString("N0"));
}
public static string FormatPotOfGold(int prize)
{
return PotOfGoldFormat.Replace("%PRIZE%", prize.ToString("N0"));
}
public static string FormatWorkshopCraftEntry(int iconId, string itemName, int price, int itemId, int craftId)
{
return WorkshopCraftEntryFormat.Replace("%ICONID%", iconId.ToString()).Replace("%ITEMNAME%", itemName).Replace("%PRICE%", price.ToString("N0")).Replace("%ITEMID%", itemId.ToString()).Replace("%CRAFTID%", craftId.ToString());

View file

@ -336,7 +336,9 @@ namespace HISP.Game
// check Treasures
if (Treasure.IsTileTreasure(x, y))
{
Treasure.GetTreasureAt(x, y).CollectTreasure(user);
Treasure treasure = Treasure.GetTreasureAt(x, y);
if(treasure.Type == "BURIED")
treasure.CollectTreasure(user);
return true;
}
}

View file

@ -157,6 +157,9 @@ namespace HISP.Game
}
else if(this.Type == "RAINBOW")
{
byte[] treasureReceivedPacket = PacketBuilder.CreateChat(Messages.FormatPotOfGold(this.Value), PacketBuilder.CHAT_BOTTOM_RIGHT);
user.LoggedinClient.SendPacket(treasureReceivedPacket);
user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PotOfGold).Count++;
if (user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PotOfGold).Count >= 3)

View file

@ -729,6 +729,7 @@ namespace HISP.Server
// Treasure
Messages.PirateTreasureFormat = gameData.messages.treasure.pirate_treasure;
Messages.PotOfGoldFormat = gameData.messages.treasure.pot_of_gold;
// Records
Messages.ProfileSavedMessage = gameData.messages.profile_save;

View file

@ -2809,13 +2809,28 @@ namespace HISP.Server
return;
}
if(loggedInUser.Y != newY || loggedInUser.X != newX)
if (loggedInUser.Y != newY || loggedInUser.X != newX)
{
loggedInUser.Facing = direction + (onHorse * 5);
if (moveTwo)
direction += 20;
loggedInUser.Y = newY;
loggedInUser.X = newX;
// check Treasures
if (Treasure.IsTileTreasure(loggedInUser.X, loggedInUser.Y))
{
Treasure treasure = Treasure.GetTreasureAt(loggedInUser.X, loggedInUser.Y);
if (treasure.Type == "RAINBOW")
{
treasure.CollectTreasure(loggedInUser);
Update(sender);
return;
}
}
byte[] moveResponse = PacketBuilder.CreateMovementPacket(loggedInUser.X, loggedInUser.Y, loggedInUser.CharacterId, loggedInUser.Facing, direction, true);
sender.SendPacket(moveResponse);
}