Ranch forcefully sold message

This commit is contained in:
SilicaAndPina 2021-06-27 19:55:06 +12:00
parent b898983778
commit 168d534381
5 changed files with 33 additions and 13 deletions

View file

@ -608,6 +608,7 @@
"unowned_ranch_click":"Unowned Ranch",
"click_message":"%USERNAME%'s %TITLE%",
"forcefully_sold":"Your ranch has been forcibly sold since subscription lapsed 30+ days. You earned $%AMOUNT% from the sale.",
"no_dorothy_shoes":"You do not have Dorothy Shoes. They come with a ranch.",
"dorothy_message":"There's no place like home... There's no place like home...",
"dorothy_prison_isle":"You tap them together a bunch of times, but nothing.. They don't work here!",

View file

@ -405,7 +405,7 @@ namespace HISP.Game
public static string RanchCantAffordRanch;
public static string RanchRanchBroughtMessageFormat;
public static string RanchForcefullySoldFormat;
public static string RanchSavedRanchDescripton;
public static string RanchSavedTitleTooLongError;
public static string RanchSavedDescrptionTooLongError;
@ -1599,6 +1599,10 @@ namespace HISP.Game
{
return ArenaYouWinFormat.Replace("%PRIZE%", prizeMoney.ToString("N0", CultureInfo.InvariantCulture)).Replace("%EXP%", experience.ToString("N0", CultureInfo.InvariantCulture));
}
public static string FormatRanchForcefullySoldMessage(int amount)
{
return RanchForcefullySoldFormat.Replace("%AMOUNT%", amount.ToString());
}
public static string FormatArenaYourScore(int score)
{
return ArenaYourScoreFormat.Replace("%SCORE%", score.ToString("N0", CultureInfo.InvariantCulture));

View file

@ -130,8 +130,31 @@ namespace HISP.Game
{
if(ownerId != -1)
{
if (!Database.IsUserSubscribed(ownerId) && !Database.IsUserAdmin(ownerId))
if (ConfigReader.AllUsersSubbed || Database.IsUserAdmin(ownerId))
return ownerId;
int subExp = Database.GetUserSubscriptionExpireDate(ownerId);
DateTime expTime = Converters.UnixTimeStampToDateTime(subExp);
if ((DateTime.UtcNow.Date - expTime.Date).Days >= 30)
{
int price = GetSellPrice();
try
{
checked
{
Database.SetPlayerMoney(Database.GetPlayerMoney(ownerId) + price, ownerId);
}
}
catch (OverflowException)
{
Database.SetPlayerMoney(2147483647, ownerId);;
}
Database.AddMessageToQueue(ownerId, Messages.FormatRanchForcefullySoldMessage(price));
deleteRanch();
return -1;
}
}
return ownerId;

View file

@ -555,15 +555,7 @@ namespace HISP.Player
if(Ranch.IsRanchOwned(this.Id))
{
if (this.Subscribed)
{
OwnedRanch = Ranch.GetRanchOwnedBy(this.Id);
}
else // idk what it does here ...
{
OwnedRanch = null;
Ranch.GetRanchOwnedBy(this.Id).OwnerId = -1;
}
OwnedRanch = Ranch.GetRanchOwnedBy(this.Id);
}
Gender = Database.GetGender(UserId);

View file

@ -1312,6 +1312,7 @@ namespace HISP.Server
Messages.RanchNoDorothyShoesMessage = gameData.messages.meta.ranch.no_dorothy_shoes;
Messages.RanchDorothyShoesMessage = gameData.messages.meta.ranch.dorothy_message;
Messages.RanchDorothyShoesPrisonIsleMessage = gameData.messages.meta.ranch.dorothy_prison_isle;
Messages.RanchForcefullySoldFormat = gameData.messages.meta.ranch.forcefully_sold;
Messages.RanchCantAffordRanch = gameData.messages.meta.ranch.ranch_buy_cannot_afford;
Messages.RanchRanchBroughtMessageFormat = gameData.messages.meta.ranch.ranch_brought;
@ -1321,8 +1322,7 @@ namespace HISP.Server
Messages.RanchSavedDescrptionTooLongError = gameData.messages.meta.ranch.ranch_info.description_too_long;
Messages.RanchSavedTitleViolationsError = gameData.messages.meta.ranch.ranch_info.title_contains_violations;
Messages.RanchSavedDescrptionViolationsErrorFormat = gameData.messages.meta.ranch.ranch_info.desc_contains_violations;
Messages.RanchDefaultRanchTitle = gameData.messages.meta.ranch.default_title;
Messages.RanchEditDescriptionMetaFormat = gameData.messages.meta.ranch.edit_description;