The other thing being most of the formula being created that will actually "generate" the amount of gold that a given shop that was just entered will be assigned when first entered. This currently being determined mostly by shop quality, as well as the "regional adjuster" which is mostly a random number at the moment. As well as another random number multiplying the whole thing to give more variable gold values, instead of boring values like 20000.
In reality, this was the easy parts, still need to actually figure out how to save data to a JSON file to keep the gold values of shops from being reset every-time one is entered before the restock cycle has expired. As well as being able to keep the values saved after the game is saved/loaded. This is quite the big hurdle for someone who has never did any read/writing to JSON files for data, but hopefully with the example of the "PersistentDungeons" mod I will be able to figure this out much more quickly.
Code: Select all
private static void Testing_OnTransitionInterior(PlayerEnterExit.TransitionEventArgs args)
{
int buildingQuality = 0;
int buildingKey = 0;
int mapID = 0;
int currentGoldSupply = 0;
buildingQuality = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData.quality;
buildingKey = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData.buildingKey;
mapID = GameManager.Instance.PlayerGPS.CurrentLocation.MapTableData.MapId;
if (GameManager.Instance.PlayerEnterExit.IsPlayerInsideOpenShop)
{
Debug.Log("You Just Entered An Open Shop, Good Job!...");
currentGoldSupply = GoldSupplyAmountGenerator (buildingQuality);
}
else
Debug.Log("You Just Entered Something Other Than An Open Shop...");
Debug.LogFormat("mapID = {1} and buildingKey = {0}. The Quality of the building is {2}. currentGoldSupply = {3}.", buildingKey, mapID, buildingQuality, currentGoldSupply); // Higher Quality value = better shop quality.
} // So MapID and BuildingKey seem to be what is used to identify a specific "Scene" or building interior. So these would likely be needed to track different shops.
public static int GoldSupplyAmountGenerator(int buildingQuality)
{
int currentRegionIndex = GameManager.Instance.PlayerGPS.CurrentRegionIndex;
int regionCostAdjust = GameManager.Instance.PlayerEntity.RegionData[currentRegionIndex].PriceAdjustment / 100;
float varianceMaker = (UnityEngine.Random.Range(1.001f, 2.001f));
return (int)Mathf.Ceil(((buildingQuality * 2) + (regionCostAdjust + 1)) * (float)(500 * varianceMaker));
}