Implement fountains.

This commit is contained in:
SilicaAndPina 2020-12-31 12:29:56 +13:00
parent 6bea119831
commit a0a328aa7d
7 changed files with 57 additions and 4 deletions

View file

@ -12,6 +12,10 @@
"click_nothing_message":"Nothing interesting here...",
"playtime_timeout":"You have run out of playtime for now. In one minute you will be disconnected. You gain one minute of playtime every 8 minutes. Please come back later!",
"random_movement":"You are sooo <B>%STAT%</B>. You wander dizzily in a different direction.",
"fountain":{
"drank_your_fill":"You drank your fill from the fountain.",
"dropped_money":"Oh no!!! While drinking you accidentally dropped $%MONEY% into the fountain!! There is no way to get it back!",
},
"consume":{
"consumed_item_format":"GULP! You consumed the %ITEM%.",
"consumed_but_max_reached":"You could not finish it all. Some was wasted."
@ -101,6 +105,7 @@
"end_of_meta":"^Z",
"back_to_map":"^M",
"long_full_line":"^L",
"fountain":"Although it's not recommended, you could drink from this fountain if you are thirsty...^T6Drink from the public fountain. ^B1D^R1^X^Z",
"awards_page":{
"awards_header":"^ATYour Awards Earned^H",
"no_awards":"<BR>You have not earned any awards yet. You can view a list of earnable awards in a Horse Isle Library.",

View file

@ -24,8 +24,8 @@ namespace HISP.Game
{
if (droppedItem.instance == null)
{
continue;
RemoveDroppedItem(droppedItem);
continue;
}
if(droppedItem.instance.ItemId == item.Id)

View file

@ -272,7 +272,7 @@ namespace HISP.Game
public static string East;
public static string South;
public static string West;
public static string TileFormat;
public static string Seperator;
@ -281,6 +281,11 @@ namespace HISP.Game
public static string LongFullLine;
public static string MetaTerminator;
// Fountain
public static string FountainMeta;
public static string FountainDrankYourFull;
public static string FountainDroppedMoneyFormat;
// Disconnect Messages
public static string KickReasonBanned;
public static string KickReasonDuplicateLogin;
@ -295,7 +300,10 @@ namespace HISP.Game
// Click
public static string NothingInterestingHere;
public static string FormatDroppedMoneyMessage(int amount)
{
return FountainDroppedMoneyFormat.Replace("%MONEY%", amount.ToString("N0"));
}
public static string FormatAbuseReportPlayerNotFound(string username)
{
return AbuseReportPlayerNotFoundFormat.Replace("%USERNAME%", username);

View file

@ -545,6 +545,10 @@ namespace HISP.Game
return message;
}
public static string buildFountain()
{
return Messages.FountainMeta;
}
public static string BuildSpecialTileInfo(User user, World.SpecialTile specialTile)
{
string message = "";
@ -602,6 +606,11 @@ namespace HISP.Game
message += buildShopInfo(shop,user.Inventory);
}
if(TileCode == "FOUNTAIN")
{
message += buildFountain();
}
}

View file

@ -495,6 +495,7 @@ namespace HISP.Server
Messages.AbuseReportPlayerNotFoundFormat = gameData.messages.abuse_report.player_not_found_format;
Messages.AbuseReportFiled = gameData.messages.abuse_report.report_filed;
Messages.AbuseReportProvideValidReason = gameData.messages.abuse_report.valid_reason;
// Chat
Messages.ChatViolationMessageFormat = gameData.messages.chat.violation_format;
@ -631,6 +632,11 @@ namespace HISP.Server
Messages.NoPitchforkMeta = gameData.messages.meta.hay_pile.no_pitchfork;
Messages.HasPitchforkMeta = gameData.messages.meta.hay_pile.pitchfork;
// Fountain
Messages.FountainMeta = gameData.messages.meta.fountain;
Messages.FountainDrankYourFull = gameData.messages.fountain.drank_your_fill;
Messages.FountainDroppedMoneyFormat = gameData.messages.fountain.dropped_money;
// Highscore
Messages.HighscoreHeaderMeta = gameData.messages.meta.highscores.header_meta;

View file

@ -1454,10 +1454,34 @@ namespace HISP.Server
Logger.HackerPrint(sender.LoggedinUser.Username + " Tried to wear an item they did not have.");
}
break;
case PacketBuilder.ITEM_DRINK:
packetStr = Encoding.UTF8.GetString(packet);
string idStr = packetStr.Substring(2, packet.Length - 4);
if(idStr == "NaN") // Fountain
{
string msg = Messages.FountainDrankYourFull;
bool looseMoney = RandomNumberGenerator.Next(0, 20) == 18;
if(looseMoney)
{
int looseAmount = RandomNumberGenerator.Next(0, 100);
if (looseAmount > sender.LoggedinUser.Money)
looseAmount = sender.LoggedinUser.Money;
sender.LoggedinUser.Money -= looseAmount;
msg = Messages.FormatDroppedMoneyMessage(looseAmount);
}
sender.LoggedinUser.Thirst = 1000;
byte[] drankFromFountainMessage = PacketBuilder.CreateChat(msg, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(drankFromFountainMessage);
}
else
{
Logger.ErrorPrint(sender.LoggedinUser.Username + "Sent unknown ITEM_DRINK command id: " + idStr);
}
break;
case PacketBuilder.ITEM_CONSUME:
packetStr = Encoding.UTF8.GetString(packet);
randomIdStr = packetStr.Substring(2, packet.Length - 2);
randomIdStr = packetStr.Substring(2, packet.Length - 3);
randomId = 0;
try

View file

@ -91,6 +91,7 @@ namespace HISP.Server
public const byte ITEM_WEAR = 0x46;
public const byte ITEM_REMOVE = 0x47;
public const byte ITEM_CONSUME = 0x51;
public const byte ITEM_DRINK = 0x52;
public const byte ITEM_BINOCULARS = 0x5C;
public const byte ITEM_MAGNIFYING = 0x5D;
public const byte ITEM_RAKE = 0x5B;