fix building

This commit is contained in:
SilicaAndPina 2021-02-08 21:44:00 +13:00
parent e169303b2c
commit 93829b1484
3 changed files with 61 additions and 14 deletions

View file

@ -152,7 +152,7 @@
"ranch_brought":"You paid $%PRICE% and are now the proud owner of this ranch!",
"saved_ranch":"Saved Ranch Description.",
"default_title":"Ranch",
"ranch_description":"^PLRanch Title:|%RANCHTITLE%^LYour Ranch Description:^R1^PB160|%RANCHDESC%^PS11|SAVE DESCRIPTION"
"ranch_description":"^PLRanch Title:|%RANCHTITLE%^LYour Ranch Description:^R1^PB160|%RANCHDESC%^PS11|SAVE DESCRIPTION",
"build":{
"build_on_this_spot":"You can build one of the following buildings on this spot:",
"build_format":"^T6Build a %BUILDINGNAME% for $%PRICE%^B6L%BUILDINGID%^B6B%BUILDINGID%^R1",
@ -548469,7 +548469,7 @@
"description": "This large, fancy barn is big enough to allow you to own 12 more horses",
}
]
}
},
"ranch_locations":[
{"id":37,"x":519,"y":217,"value":500000},
{"id":38,"x":517,"y":218,"value":500000},

View file

@ -5,16 +5,42 @@ namespace HISP.Game
{
public class Ranch
{
public class RanchBuilding
public class RanchUpgrade
{
public static List<RanchBuilding> RanchBuildings = new List<RanchBuilding>();
public static List<RanchUpgrade> RanchUpgrades = new List<RanchUpgrade>();
public int Id;
public string Type;
public int Cost;
public string Title;
public string Description;
public int Limit;
public static bool RanchUpgradeExists(int id)
{
foreach (RanchUpgrade rachUpgrade in RanchUpgrades)
{
if (rachUpgrade.Id == id)
return true;
}
return false;
}
public static RanchUpgrade GetRanchUpgradeById(int id)
{
foreach (RanchUpgrade rachUpgrade in RanchUpgrades)
{
if (rachUpgrade.Id == id)
return rachUpgrade;
}
throw new KeyNotFoundException("No ranch found.");
}
}
public class RanchBuilding
{
public static List<RanchBuilding> RanchBuildings = new List<RanchBuilding>();
public int Id;
public int Cost;
public string Title;
public string Description;
public static bool RanchBuildingExists(int id)
{
foreach (RanchBuilding ranchBuilding in RanchBuildings)

View file

@ -575,6 +575,7 @@ namespace HISP.Server
Logger.DebugPrint("Registered Workshop at X: " + wkShop.X + " Y: " + wkShop.Y);
}
// Register Ranches
int totalRanchLocations = gameData.ranch.ranch_locations.Count;
for (int i = 0; i < totalRanchLocations; i++)
{
@ -587,21 +588,18 @@ namespace HISP.Server
Logger.DebugPrint("Registered Ranch at X: " + ranch.X + " Y: " + ranch.Y);
}
int totalRanchBuildings = gameData.ranch.ranch_buildings.Count;
// Register Ranch Buildings
int totalRanchBuildings = gameData.ranch.ranch_buildings.buildings.Count;
for (int i = 0; i < totalRanchBuildings; i++)
{
int id = gameData.ranch.ranch_buildings[i].id;
string type = gameData.ranch.ranch_buildings[i].type;
int cost = gameData.ranch.ranch_buildings[i].cost;
string title = gameData.ranch.ranch_buildings[i].title;
string description = gameData.ranch.ranch_buildings[i].description;
int id = gameData.ranch.ranch_buildings.buildings[i].id;
int cost = gameData.ranch.ranch_buildings.buildings[i].cost;
string title = gameData.ranch.ranch_buildings.buildings[i].title;
string description = gameData.ranch.ranch_buildings.buildings[i].description;
Ranch.RanchBuilding building = new Ranch.RanchBuilding();
if (gameData.ranch.ranch_buildings[i].limit != null)
building.Limit = gameData.ranch.ranch_buildings[i].limit;
building.Id = id;
building.Type = type;
building.Cost = cost;
building.Title = title;
building.Description = description;
@ -610,6 +608,29 @@ namespace HISP.Server
Logger.DebugPrint("Registered Ranch Building: "+building.Title);
}
// Register Ranch Upgrades
int totalRanchUpgrades = gameData.ranch.ranch_buildings.upgrades.Count;
for (int i = 0; i < totalRanchUpgrades; i++)
{
int id = gameData.ranch.ranch_buildings.upgrades[i].id;
int cost = gameData.ranch.ranch_buildings.upgrades[i].cost;
string title = gameData.ranch.ranch_buildings.upgrades[i].title;
string description = gameData.ranch.ranch_buildings.upgrades[i].description;
Ranch.RanchUpgrade upgrade = new Ranch.RanchUpgrade();
if (gameData.ranch.ranch_buildings.upgrades[i].limit != null)
upgrade.Limit = gameData.ranch.ranch_buildings.upgrades[i].limit;
upgrade.Id = id;
upgrade.Cost = cost;
upgrade.Title = title;
upgrade.Description = description;
Ranch.RanchUpgrade.RanchUpgrades.Add(upgrade);
Logger.DebugPrint("Registered Ranch Upgrade: " + upgrade.Title);
}
// Register Riddles
int totalRiddles = gameData.riddle_room.Count;
for (int i = 0; i < totalRiddles; i++)
{