From 483dad57a0343ec476c6d820d9865e562029496a Mon Sep 17 00:00:00 2001 From: Thom McGrath Date: Tue, 16 Jan 2024 22:02:49 +0000 Subject: [PATCH] Added game-specific versions of website breeding charts --- Website/conf/www.conf | 3 + Website/www/{tools => games/ark}/breeding.php | 34 ++--- Website/www/games/arksa/breeding.php | 140 ++++++++++++++++++ 3 files changed, 160 insertions(+), 17 deletions(-) rename Website/www/{tools => games/ark}/breeding.php (93%) create mode 100644 Website/www/games/arksa/breeding.php diff --git a/Website/conf/www.conf b/Website/conf/www.conf index aacb831d7..a146f2636 100644 --- a/Website/conf/www.conf +++ b/Website/conf/www.conf @@ -86,6 +86,7 @@ rewrite "^/spawn/?$" /Games/Ark/Cheats permanent; rewrite "^/account/auth$" /account/auth/redeem.php last; rewrite "^/account/login/verify(\.php)?$" /account/auth/verify.php last; rewrite "^/download(/?((index)?\.php)?)?$" /download/index.php last; +rewrite "^/tools/breeding(\.php)?$" /Games/Ark/Breeding permanent; rewrite "(?i)^/Games/?$" /games/index.php last; @@ -105,6 +106,7 @@ rewrite "(?i)^/Games/Ark/Tags/([0-9A-Za-z_]+)/(Creatures|Engrams|LootDrops|Spawn rewrite "(?i)^/Games/Ark/Tags/([0-9A-Za-z_]+)/(Creatures|Engrams|LootDrops|SpawnPoints)/(\d+)$" /games/ark/blueprints.php?tag=$1&group=$2&page=$3 last; rewrite "(?i)^/Games/Ark/([A-Za-z0-9_]+_[cC])$" /games/ark/blueprint.php?classString=$1 last; rewrite "(?i)^/Games/Ark/Mods/(\d+)/([A-Za-z0-9_]+_[cC])$" /games/ark/blueprint.php?contentPackId=$1&classString=$2 last; +rewrite "(?i)^/Games/Ark/Breeding$" /games/ark/breeding.php last; rewrite "(?i)^/Games/ArkSA/?$" /games/arksa/index.php last; rewrite "(?i)^/Games/ArkSA/(Creatures|Engrams|LootDrops|SpawnPoints)/?$" /games/arksa/blueprints.php?group=$1 last; @@ -122,5 +124,6 @@ rewrite "(?i)^/Games/ArkSA/Tags/([0-9A-Za-z_]+)/(Creatures|Engrams|LootDrops|Spa rewrite "(?i)^/Games/ArkSA/Tags/([0-9A-Za-z_]+)/(Creatures|Engrams|LootDrops|SpawnPoints)/(\d+)$" /games/arksa/blueprints.php?tag=$1&group=$2&page=$3 last; rewrite "(?i)^/Games/ArkSA/([A-Za-z0-9_]+_[cC])$" /games/arksa/blueprint.php?classString=$1 last; rewrite "(?i)^/Games/ArkSA/Mods/(\d+)/([A-Za-z0-9_]+_[cC])$" /games/arksa/blueprint.php?contentPackId=$1&classString=$2 last; +rewrite "(?i)^/Games/ArkSA/Breeding$" /games/arksa/breeding.php last; rewrite "^/robots.txt" /robots.php last; diff --git a/Website/www/tools/breeding.php b/Website/www/games/ark/breeding.php similarity index 93% rename from Website/www/tools/breeding.php rename to Website/www/games/ark/breeding.php index dc010d7fb..a7be9f2f2 100644 --- a/Website/www/tools/breeding.php +++ b/Website/www/games/ark/breeding.php @@ -1,6 +1,6 @@ Query('SELECT MAX(build_number) AS newest_build FROM updates;'); $min_version = $results->Field('newest_build'); - + $officialPacks = ContentPack::Search(['minVersion' => $min_version, 'isOfficial' => true], true); $officialPackIds = []; foreach ($officialPacks as $officialPack) { $officialPackIds[] = $officialPack->ContentPackId(); } - + $marketplacePacks = ContentPack::Search(['minVersion' => $min_version, 'marketplace' => 'Steam Workshop', 'marketplaceId' => implode(',', $steamIds)], true); $marketplacePackIds = []; foreach ($marketplacePacks as $marketplacePack) { $marketplacePackIds[] = $marketplacePack->ContentPackId(); } - + $showModNames = count($steamIds) > 0; $combinedPackIds = array_merge($officialPackIds, $marketplacePackIds); $creatures = Creature::Search(['minVersion' => $min_version, 'contentPackId' => $combinedPackIds], true); @@ -98,15 +98,15 @@ if (is_null($creature->IncubationTimeSeconds()) || is_null($creature->MatureTimeSeconds())) { continue; } - + $incubation_seconds = $creature->IncubationTimeSeconds() / $ism; $mature_seconds = $creature->MatureTimeSeconds() / $msm; - + $max_cuddles = 0; $per_cuddle = 0; if ($iam > 0) { $max_cuddles = floor($mature_seconds / $computed_cuddle_period); - + if ($max_cuddles > 0) { $per_cuddle = min((1 / $max_cuddles) * $iam, 1.0); $max_cuddles = ceil(1.0 / $per_cuddle); @@ -117,24 +117,24 @@ } else { $cuddle_text = number_format($per_cuddle * 100, 0) . '% ea / ' . $max_cuddles . ' total'; } - + $label = htmlentities($creature->Label()); if ($showModNames) { $label .= '
' . htmlentities($creature->ContentPackName()) . '
'; } - + $incubation_text = BeaconCommon::SecondsToEnglish(round($incubation_seconds), true); $mature_text = BeaconCommon::SecondsToEnglish(round($mature_seconds), true); echo '' . $label . '
Incubation Time: ' . htmlentities($incubation_text) . '
Mature Time: ' . htmlentities($mature_text) . '
Imprinting: ' . htmlentities($cuddle_text) . '
' . htmlentities($incubation_text) . '' . htmlentities($mature_text) . '' . htmlentities($cuddle_text) . ''; } - + $cached = ob_get_contents(); ob_end_clean(); BeaconCache::Set($cache_key, $cached); } - + echo $cached; ?> -

Any creature that can be imprinted can be imprinted to 100%

\ No newline at end of file +

Any creature that can be imprinted can be imprinted to 100%

diff --git a/Website/www/games/arksa/breeding.php b/Website/www/games/arksa/breeding.php new file mode 100644 index 000000000..2d1d8a4fe --- /dev/null +++ b/Website/www/games/arksa/breeding.php @@ -0,0 +1,140 @@ + 0) ? $msm : 1.0; +$ipm = ($ipm > 0) ? $ipm : 1.0; +$ism = ($ism > 0) ? $ism : 1.0; +$iam = ($iam > 0) ? $iam : 1.0; + +$database = BeaconCommon::Database(); +$results = $database->Query('SELECT value::INTEGER FROM arksa.game_variables WHERE key = $1;', 'Cuddle Period'); +if ($results->RecordCount() != 1) { + http_response_code(500); + echo "There was a problem loading the default imprint interval."; + exit; +} +$official_cuddle_period = $results->Field('value'); +$computed_cuddle_period = round($official_cuddle_period * $ipm); + +BeaconTemplate::AddStylesheet(BeaconCommon::AssetURI('breeding.css')); + +?>
+
+
Mature Speed:
+
+
+
+
Incubation Speed:
+
+
+
+
Imprint Period:
+
+
+
+
Imprint Amount:
+
+
+
+
Imprint Frequency:
+
+
+
+ + + + + + + + + + + Query('SELECT MAX(build_number) AS newest_build FROM updates;'); + $min_version = $results->Field('newest_build'); + + $officialPacks = ContentPack::Search(['minVersion' => $min_version, 'isOfficial' => true], true); + $officialPackIds = []; + foreach ($officialPacks as $officialPack) { + $officialPackIds[] = $officialPack->ContentPackId(); + } + + $marketplacePacks = ContentPack::Search(['minVersion' => $min_version, 'marketplace' => 'Steam Workshop', 'marketplaceId' => implode(',', $steamIds)], true); + $marketplacePackIds = []; + foreach ($marketplacePacks as $marketplacePack) { + $marketplacePackIds[] = $marketplacePack->ContentPackId(); + } + + $showModNames = count($steamIds) > 0; + $combinedPackIds = array_merge($officialPackIds, $marketplacePackIds); + $creatures = Creature::Search(['minVersion' => $min_version, 'contentPackId' => $combinedPackIds], true); + foreach ($creatures as $creature) { + if (is_null($creature->IncubationTimeSeconds()) || is_null($creature->MatureTimeSeconds())) { + continue; + } + + $incubation_seconds = $creature->IncubationTimeSeconds() / $ism; + $mature_seconds = $creature->MatureTimeSeconds() / $msm; + + $max_cuddles = 0; + $per_cuddle = 0; + if ($iam > 0) { + $max_cuddles = floor($mature_seconds / $computed_cuddle_period); + + if ($max_cuddles > 0) { + $per_cuddle = min((1 / $max_cuddles) * $iam, 1.0); + $max_cuddles = ceil(1.0 / $per_cuddle); + } + } + if ($max_cuddles == 0) { + $cuddle_text = 'Can\'t Imprint'; + } else { + $cuddle_text = number_format($per_cuddle * 100, 0) . '% ea / ' . $max_cuddles . ' total'; + } + + $label = htmlentities($creature->Label()); + if ($showModNames) { + $label .= '
' . htmlentities($creature->ContentPackName()) . '
'; + } + + $incubation_text = BeaconCommon::SecondsToEnglish(round($incubation_seconds), true); + $mature_text = BeaconCommon::SecondsToEnglish(round($mature_seconds), true); + echo ''; + } + + $cached = ob_get_contents(); + ob_end_clean(); + BeaconCache::Set($cache_key, $cached); + } + + echo $cached; + ?> + +
CreatureIncubation TimeMature TimeImprints
' . $label . '
Incubation Time: ' . htmlentities($incubation_text) . '
Mature Time: ' . htmlentities($mature_text) . '
Imprinting: ' . htmlentities($cuddle_text) . '
' . htmlentities($incubation_text) . '' . htmlentities($mature_text) . '' . htmlentities($cuddle_text) . '
+

Any creature that can be imprinted can be imprinted to 100%