using Newtonsoft.Json.Linq;
using XFEWarframe.Core.Data;
namespace XFEWarframe.Core.Services;
public static class AccountRules
{
private static readonly IReadOnlyDictionary<string, string> CurrencyRules = new Dictionary<string, string>
{
["RegularCredits"] = "infiniteCredits", ["PremiumCredits"] = "infinitePlatinum", ["PrimeTokens"] = "infiniteRegalAya",
["FusionPoints"] = "infiniteEndo", ["CrewShipFusionPoints"] = "infiniteDirac"
};
private static readonly Lazy<JArray> Dialogue = new(() => (JArray)Assets.Json("fixed_responses/allDialogue.json"));
private static readonly Lazy<JArray> Popups = new(() => (JArray)Assets.Json("fixed_responses/allPopups.json"));
public static bool InfiniteCurrency(JObject inventory, string currency) => CurrencyRules.TryGetValue(currency, out var rule) && inventory.Value<bool>(rule);
public static int Mastery(JObject inventory) => inventory.Value<int?>("spoofMasteryRank") is >= 0 and var rank ? rank : inventory.Value<int>("PlayerLevel");
// Apply to a response copy only. Turning a rule off must reveal the saved
// balance, mastery, equipment features and polarity exactly as before.
public static void Project(JObject response, long build, JObject? world, bool masteryPatched)
{
foreach (var (currency, rule) in CurrencyRules) if (response.Value<bool>(rule)) response[currency] = 999999999;
if (response.Value<bool>("infinitePlatinum")) response["PremiumCreditsFree"] = 0;
if (response.Value<bool>("infiniteTrades")) response["TradesRemaining"] = 9999;
if (response.Value<bool>("infiniteGifts")) response["GiftsRemaining"] = 9999;
if (response.Value<bool>("infiniteRevives")) foreach (var suit in response.Array("Suits")) suit["ExtraRemaining"] = 999999999;
if (response.Value<bool>("skipAllDialogue"))
{
foreach (var node in new[] { "TreasureTutorial", "StarchartTutorial", "CraftingTutorial" })
if (!response.Array("TauntHistory").Any(x => x.Value<string>("node") == node)) response.Array("TauntHistory").Add(new JObject { ["node"] = node, ["state"] = "TS_COMPLETED" });
foreach (var text in Dialogue.Value) response.Array("NodeIntrosCompleted").UniqueAdd(text);
}
if (response.Value<bool>("skipAllPopups"))
{
foreach (var text in Popups.Value) response.Array("NodeIntrosCompleted").UniqueAdd(text);
response.Obj("Settings")["TradingRulesConfirmed"] = true;
response["PlayedParkourTutorial"] = response["MadeStoryModeDecision"] = response["HasResetAccount"] = true;
}
if (world?.Value<bool>("baroTennoConRelay") == true)
for (var year = 2022; year <= 2026; year++)
{
var type = $"/Lotus/Types/Items/Events/TennoConRelay{year}EarlyAccess";
if (!response.Array("FlavourItems").Any(x => x.Value<string>("ItemType") == type)) response.Array("FlavourItems").Add(new JObject { ["ItemType"] = type });
}
if (response.Value<int?>("spoofMasteryRank") is >= 0 and var mastery)
{
response["PlayerLevel"] = mastery;
if (!masteryPatched)
{
var rank = Math.Min(mastery, 100); var affinity = rank <= 30 ? 2500 * rank * rank : 2250000 + 147500 * (rank - 30);
response["XPInfo"] = new JArray(Enumerable.Range(0, (affinity + 5999) / 6000).Select(_ => new JObject { ["ItemType"] = "/Lotus/Powersuits/Mag/Mag", ["XP"] = 900000 }));
}
}
var features = (response.Value<bool>("unlockDoubleCapacityPotatoesEverywhere") ? 1 : 0) |
(response.Value<bool>("unlockExilusEverywhere") ? 2 : 0) | (response.Value<bool>("unlockArcanesEverywhere") ? 96 : 0);
var polarity = response.Value<bool>("universalPolarityEverywhere") && build >= GameVersion.Of("24.4.0");
if (features != 0 || polarity)
foreach (var item in Inventory.EquipmentKeys.SelectMany(key => response.Array(key)).OfType<JObject>())
{
if (features != 0) item["Features"] = item.Value<int>("Features") | features;
if (polarity) item["Polarity"] = new JArray(Enumerable.Range(0, 15).Select(slot => new JObject { ["Slot"] = slot, ["Value"] = "AP_ANY" }));
}
if (response.Value<bool>("noDailyStandingLimits"))
foreach (var field in response.Properties().Where(x => x.Name.StartsWith("DailyAffiliation", StringComparison.Ordinal)).ToArray()) field.Value = Math.Max(999999, 16000 + response.Value<int>("PlayerLevel") * 500);
if (response.Value<bool>("noDailyFocusLimit")) response["DailyFocus"] = Math.Max(999999, 250000 + response.Value<int>("PlayerLevel") * 5000);
}
public static void DecayArgon(JObject inventory, long previousRefill, long now)
{
if (previousRefill <= 0 || previousRefill > now) return;
const string type = "/Lotus/Types/Items/MiscItems/ArgonCrystal";
var item = inventory.Array("MiscItems").FirstOrDefault(x => x.Value<string>("ItemType") == type);
var count = item?.Value<long>("ItemCount") ?? 0;
var stable = Math.Clamp(inventory.Array("FoundToday").FirstOrDefault(x => x.Value<string>("ItemType") == type)?.Value<long>("ItemCount") ?? 0, 0, count);
var days = Math.Min(32, (now - previousRefill) / 86400000 + 1);
if (!inventory.Value<bool>("noArgonCrystalDecay"))
for (var day = 0; day < days && count > 0; day++) { count -= (count - stable + 1) / 2; stable = 0; }
if (item is not null) { if (count == 0) item.Remove(); else item["ItemCount"] = count; }
inventory.Remove("FoundToday");
}
}
using Newtonsoft.Json.Linq;
using XFEWarframe.Core.Data;
namespace XFEWarframe.Core.Services;
public static class AccountRules
{
private static readonly IReadOnlyDictionary<string, string> CurrencyRules = new Dictionary<string, string>
{
["RegularCredits"] = "infiniteCredits", ["PremiumCredits"] = "infinitePlatinum", ["PrimeTokens"] = "infiniteRegalAya",
["FusionPoints"] = "infiniteEndo", ["CrewShipFusionPoints"] = "infiniteDirac"
};
private static readonly Lazy<JArray> Dialogue = new(() => (JArray)Assets.Json("fixed_responses/allDialogue.json"));
private static readonly Lazy<JArray> Popups = new(() => (JArray)Assets.Json("fixed_responses/allPopups.json"));
public static bool InfiniteCurrency(JObject inventory, string currency) => CurrencyRules.TryGetValue(currency, out var rule) && inventory.Value<bool>(rule);
public static int Mastery(JObject inventory) => inventory.Value<int?>("spoofMasteryRank") is >= 0 and var rank ? rank : inventory.Value<int>("PlayerLevel");
// Apply to a response copy only. Turning a rule off must reveal the saved
// balance, mastery, equipment features and polarity exactly as before.
public static void Project(JObject response, long build, JObject? world, bool masteryPatched)
{
foreach (var (currency, rule) in CurrencyRules) if (response.Value<bool>(rule)) response[currency] = 999999999;
if (response.Value<bool>("infinitePlatinum")) response["PremiumCreditsFree"] = 0;
if (response.Value<bool>("infiniteTrades")) response["TradesRemaining"] = 9999;
if (response.Value<bool>("infiniteGifts")) response["GiftsRemaining"] = 9999;
if (response.Value<bool>("infiniteRevives")) foreach (var suit in response.Array("Suits")) suit["ExtraRemaining"] = 999999999;
if (response.Value<bool>("skipAllDialogue"))
{
foreach (var node in new[] { "TreasureTutorial", "StarchartTutorial", "CraftingTutorial" })
if (!response.Array("TauntHistory").Any(x => x.Value<string>("node") == node)) response.Array("TauntHistory").Add(new JObject { ["node"] = node, ["state"] = "TS_COMPLETED" });
foreach (var text in Dialogue.Value) response.Array("NodeIntrosCompleted").UniqueAdd(text);
}
if (response.Value<bool>("skipAllPopups"))
{
foreach (var text in Popups.Value) response.Array("NodeIntrosCompleted").UniqueAdd(text);
response.Obj("Settings")["TradingRulesConfirmed"] = true;
response["PlayedParkourTutorial"] = response["MadeStoryModeDecision"] = response["HasResetAccount"] = true;
}
if (world?.Value<bool>("baroTennoConRelay") == true)
for (var year = 2022; year <= 2026; year++)
{
var type = $"/Lotus/Types/Items/Events/TennoConRelay{year}EarlyAccess";
if (!response.Array("FlavourItems").Any(x => x.Value<string>("ItemType") == type)) response.Array("FlavourItems").Add(new JObject { ["ItemType"] = type });
}
if (response.Value<int?>("spoofMasteryRank") is >= 0 and var mastery)
{
response["PlayerLevel"] = mastery;
if (!masteryPatched)
{
var rank = Math.Min(mastery, 100); var affinity = rank <= 30 ? 2500 * rank * rank : 2250000 + 147500 * (rank - 30);
response["XPInfo"] = new JArray(Enumerable.Range(0, (affinity + 5999) / 6000).Select(_ => new JObject { ["ItemType"] = "/Lotus/Powersuits/Mag/Mag", ["XP"] = 900000 }));
}
}
var features = (response.Value<bool>("unlockDoubleCapacityPotatoesEverywhere") ? 1 : 0) |
(response.Value<bool>("unlockExilusEverywhere") ? 2 : 0) | (response.Value<bool>("unlockArcanesEverywhere") ? 96 : 0);
var polarity = response.Value<bool>("universalPolarityEverywhere") && build >= GameVersion.Of("24.4.0");
if (features != 0 || polarity)
foreach (var item in Inventory.EquipmentKeys.SelectMany(key => response.Array(key)).OfType<JObject>())
{
if (features != 0) item["Features"] = item.Value<int>("Features") | features;
if (polarity) item["Polarity"] = new JArray(Enumerable.Range(0, 15).Select(slot => new JObject { ["Slot"] = slot, ["Value"] = "AP_ANY" }));
}
if (response.Value<bool>("noDailyStandingLimits"))
foreach (var field in response.Properties().Where(x => x.Name.StartsWith("DailyAffiliation", StringComparison.Ordinal)).ToArray()) field.Value = Math.Max(999999, 16000 + response.Value<int>("PlayerLevel") * 500);
if (response.Value<bool>("noDailyFocusLimit")) response["DailyFocus"] = Math.Max(999999, 250000 + response.Value<int>("PlayerLevel") * 5000);
}
public static void DecayArgon(JObject inventory, long previousRefill, long now)
{
if (previousRefill <= 0 || previousRefill > now) return;
const string type = "/Lotus/Types/Items/MiscItems/ArgonCrystal";
var item = inventory.Array("MiscItems").FirstOrDefault(x => x.Value<string>("ItemType") == type);
var count = item?.Value<long>("ItemCount") ?? 0;
var stable = Math.Clamp(inventory.Array("FoundToday").FirstOrDefault(x => x.Value<string>("ItemType") == type)?.Value<long>("ItemCount") ?? 0, 0, count);
var days = Math.Min(32, (now - previousRefill) / 86400000 + 1);
if (!inventory.Value<bool>("noArgonCrystalDecay"))
for (var day = 0; day < days && count > 0; day++) { count -= (count - stable + 1) / 2; stable = 0; }
if (item is not null) { if (count == 0) item.Remove(); else item["ItemCount"] = count; }
inventory.Remove("FoundToday");
}
}