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

@ -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;