diff --git a/app/Libraries/Missions/Expedition.php b/app/Libraries/Missions/Expedition.php
index 999459efe..37da84a2c 100755
--- a/app/Libraries/Missions/Expedition.php
+++ b/app/Libraries/Missions/Expedition.php
@@ -2,109 +2,228 @@
namespace App\Libraries\Missions;
+use App\Core\Objects;
use App\Libraries\FleetsLib;
-use App\Libraries\FormatLib;
use App\Libraries\Functions;
+use App\Services\Formulas\Expedition as FmlExpedition;
class Expedition extends Missions
{
- /**
- * The amount of hazard for an expedition
- *
- * @var int
- */
- private $hazard;
-
- /**
- * A flag to indicate if a fleet was completly destroyed.
- *
- * @var int
- */
- private $all_destroyed = false;
+ private FmlExpedition $fmlExpedition;
+ private int $resourceExpeditionPoints = 0;
+ private int $shipExpeditionPoints = 0;
+ private int $fleetCapacity = 0;
public function __construct()
{
parent::__construct();
- // load Language
- parent::loadLang(['game/global', 'game/missions', 'game/expedition', 'game/ships']);
+ $this->fmlExpedition = new FmlExpedition();
}
- /**
- * expeditionMission
- *
- * @param array $fleet_row Fleet row
- *
- * @return void
- */
- public function expeditionMission($fleet_row)
+ public function expeditionMission(array $fleet): void
{
// do mission
- if (parent::canStartMission($fleet_row)) {
- $ships_points = $this->setShipsPoints();
- $ships = FleetsLib::getFleetShipsArray($fleet_row['fleet_array']);
- $fleet_capacity = 0;
- $fleet_points = 0;
- $current_fleet = [];
-
- foreach ($ships as $id => $count) {
- $current_fleet[$id] = $count;
- $fleet_capacity += FleetsLib::getMaxStorage(
- $this->pricelist[$id]['capacity'],
- $fleet_row['research_hyperspace_technology']
- ) * $count;
- $fleet_points += ($count * $ships_points[$id]);
- }
-
- // GET A NUMBER BETWEEN 0 AND 10 RANDOMLY
- $this->hazard = mt_rand(0, 10);
-
- // EXPEDITION RESULT "HAZARD"
- switch ($this->hazard) {
- // BLACKHOLE
- case (($this->hazard < 3)):
- $this->hazardBlackhole($fleet_row, $current_fleet);
+ if (parent::canStartMission($fleet)) {
+ $this->setExpeditionPoints($fleet);
+
+ var_dump($this->fmlExpedition->getExpeditionResult());
+ var_dump($this->resourceExpeditionPoints);
+ var_dump($this->shipExpeditionPoints);
+ var_dump($this->fleetCapacity);
+ die();
+
+ switch($this->fmlExpedition->getExpeditionResult()) {
+ case 'darkMatter':
+ $this->resultDarkMatter($fleet);
+ break;
+ case 'ships':
+ $this->resultShips($fleet);
break;
- // NOTHING
- case (($this->hazard == 3)):
- $this->hazardNothing($fleet_row);
+ case 'resources':
+ $this->resultResources($fleet);
break;
- // RESOURCES
- case ((($this->hazard >= 4) && ($this->hazard < 7))):
- $this->hazardResources($fleet_row, $fleet_capacity);
+ case 'pirates':
+ $this->resultPirates($fleet);
break;
- // NOTHING
- case (($this->hazard == 7)):
- $this->hazardNothing($fleet_row);
+ case 'aliens':
+ $this->resultAliens($fleet);
break;
- // SHIPS
- case ((($this->hazard >= 8) && ($this->hazard < 11))):
- $this->hazardShips($fleet_row, $fleet_points, $current_fleet);
+ case 'delay':
+ $this->resultDelay($fleet);
+ break;
+ case 'early':
+ $this->resultEarly($fleet);
+ break;
+ case 'merchant':
+ $this->resultMerchant($fleet);
+ break;
+ case 'blackHole':
+ $this->resultBlackHole($fleet);
+ break;
+ case 'nothing':
+ default:
+ $this->resultNothing($fleet);
break;
}
- } elseif (parent::canCompleteMission($fleet_row)) {
+ } elseif (parent::canCompleteMission($fleet)) {
if (!$this->all_destroyed) {
$this->expeditionMessage(
- $fleet_row['fleet_owner'],
- $this->langs->line('exp_back_home'),
- $fleet_row['fleet_end_time']
+ $fleet['fleet_owner'],
+ __('game/expedition.exp_back_home'),
+ $fleet['fleet_end_time']
);
- parent::restoreFleet($fleet_row, true);
- parent::removeFleet((int) $fleet_row['fleet_id']);
+ parent::restoreFleet($fleet, true);
+ parent::removeFleet($fleet['fleet_id']);
+ }
+ }
+ }
+
+ private function setExpeditionPoints(array $fleet): void
+ {
+ $priceList = Objects::getInstance()->getPrice();
+ $expeditionPoints = 0;
+
+ foreach (FleetsLib::getFleetShipsArray($fleet['fleet_array']) as $id => $count) {
+ if (in_array($id, $this->fmlExpedition->getPossibleShips())) {
+ $expeditionPoints += $this->fmlExpedition->calculateExpeditionPoints(
+ ($priceList[$id]['metal'] + $priceList[$id]['crystal'])
+ ) * $count;
}
+
+ $this->fleetCapacity += FleetsLib::getMaxStorage(
+ $priceList[$id]['capacity'],
+ $fleet['research_hyperspace_technology']
+ ) * $count;
+ }
+
+ $topPlayerPoints = $this->missionsModel->getTopPlayerPoints();
+
+ $maxResourceFindExpeditionPoints = $this->fmlExpedition->getMaxExpeditionPoints(
+ $topPlayerPoints
+ );
+ $maxShipsFindExpeditionPoints = $this->fmlExpedition->getMaxShipsExpeditionPoints(
+ $topPlayerPoints
+ );
+
+ $this->resourceExpeditionPoints = $expeditionPoints;
+ $this->shipExpeditionPoints = $expeditionPoints;
+
+ // limit the amount of resources that can be found
+ if ($expeditionPoints > $maxResourceFindExpeditionPoints) {
+ $this->resourceExpeditionPoints = $maxResourceFindExpeditionPoints;
+ }
+
+ // limit the amount of ships that can be found
+ if ($expeditionPoints > $maxShipsFindExpeditionPoints) {
+ $this->shipExpeditionPoints = $maxShipsFindExpeditionPoints;
}
}
/**
- * hazardBlackhole
- *
- * @param array $fleet_row Fleet row
- * @param array $current_fleet Current fleet
+ * @todo needs polishing, there are 3 types of packages
+ * small package: 300-400 DM
+ * medium package: 500-700 DM
+ * large package: 1.000-1.800 DM
*
- * @return void
+ * needs review because I replicated previous used logic for resources
+ * I couldn't find any rule behind this...
*/
- private function hazardBlackhole($fleet_row, $current_fleet)
+ private function resultDarkMatter(array $fleet): void
+ {
+ $darkMatterFound = $this->fmlExpedition->getDarkMatterSourceSize(
+ $this->fmlExpedition->calculateDarkMatterSourceSize()
+ );
+
+ $this->expeditionMessage(
+ (int) $fleet['fleet_owner'],
+ $this->langs->line('game/expedition.exp_dm_' . mt_rand(1, 5)),
+ (int) $fleet['fleet_end_stay']
+ );
+
+ $this->missionsModel->updateDarkMatter((int) $fleet['fleet_owner'], $darkMatterFound);
+
+ parent::returnFleet($fleet['fleet_id']);
+ }
+
+ private function resultShips(array $fleet): void
+ {
+ }
+
+ private function resultResources(array $fleet): void
+ {
+ // fleet capacity
+ $fleetUsedStorage = $fleet['fleet_resource_metal'] + $fleet['fleet_resource_crystal'] + $fleet['fleet_resource_deuterium'];
+ $fleetMaxCapacity = $this->fleetCapacity - $fleetUsedStorage;
+
+ // expedition resources obtained calculations
+ $typeObtained = $this->fmlExpedition->calculateResourceTypeObtained();
+ $foundAmount = $this->fmlExpedition->getResourceFoundAmount(
+ $this->fmlExpedition->getResourceSourceSizeMultChances(
+ $typeObtained
+ ),
+ $this->resourceExpeditionPoints,
+ $typeObtained
+ );
+
+ if ($foundAmount > $fleetMaxCapacity) {
+ $fillFleetStorage = $fleetMaxCapacity;
+ } else {
+ $fillFleetStorage = $foundAmount;
+ }
+
+ $this->missionsModel->updateFleetResourcesById(
+ (int) $fleet['fleet_id'],
+ $typeObtained,
+ $fillFleetStorage
+ );
+
+ $this->expeditionMessage(
+ (int) $fleet['fleet_owner'],
+ $this->langs->line('game/expedition.exp_new_resources_' . mt_rand(1, 4)),
+ (int) $fleet['fleet_end_stay']
+ );
+
+ parent::returnFleet($fleet['fleet_id']);
+ }
+
+ private function resultPirates(array $fleet): void
+ {
+ }
+
+ private function resultAliens(array $fleet): void
+ {
+ }
+
+ private function resultDelay(array $fleet): void
+ {
+ }
+
+ private function resultEarly(array $fleet): void
+ {
+ }
+
+ private function resultMerchant(array $fleet): void
+ {
+ }
+
+ private function resultBlackHole(array $fleet): void
+ {
+ }
+
+ private function resultNothing(array $fleet): void
+ {
+ $this->expeditionMessage(
+ $fleet['fleet_owner'],
+ $this->langs->line('game/expedition.exp_nothing_' . mt_rand(1, 6)),
+ $fleet['fleet_end_stay']
+ );
+
+ parent::returnFleet($fleet['fleet_id']);
+ }
+
+ private function hazardBlackhole($fleet, $current_fleet)
{
$this->hazard += 1;
$lost_amount = (($this->hazard * 33) + 1) / 100;
@@ -113,13 +232,13 @@ private function hazardBlackhole($fleet_row, $current_fleet)
$this->all_destroyed = true;
$this->expeditionMessage(
- $fleet_row['fleet_owner'],
- $this->langs->line('exp_blackholl_2'),
- $fleet_row['fleet_end_stay']
+ $fleet['fleet_owner'],
+ $this->langs->line('game/expedition.exp_blackholl_2'),
+ $fleet['fleet_end_stay']
);
- $this->missionsModel->updateLostShipsAndDefensePoints($fleet_row['fleet_owner'], $current_fleet);
- parent::removeFleet((int) $fleet_row['fleet_id']);
+ $this->missionsModel->updateLostShipsAndDefensePoints($fleet['fleet_owner'], $current_fleet);
+ parent::removeFleet($fleet['fleet_id']);
} else {
$this->all_destroyed = true;
$new_ships = [];
@@ -135,116 +254,41 @@ private function hazardBlackhole($fleet_row, $current_fleet)
if (!$this->all_destroyed) {
$this->expeditionMessage(
- $fleet_row['fleet_owner'],
- $this->langs->line('exp_blackholl_1'),
- $fleet_row['fleet_end_stay']
+ $fleet['fleet_owner'],
+ $this->langs->line('game/expedition.exp_blackholl_1'),
+ $fleet['fleet_end_stay']
);
- $this->missionsModel->updateLostShipsAndDefensePoints($fleet_row['fleet_owner'], $lost_ships);
+ $this->missionsModel->updateLostShipsAndDefensePoints($fleet['fleet_owner'], $lost_ships);
$this->missionsModel->updateFleetArrayById([
'ships' => FleetsLib::setFleetShipsArray($new_ships),
- 'fleet_id' => $fleet_row['fleet_id'],
+ 'fleet_id' => $fleet['fleet_id'],
]);
} else {
$this->expeditionMessage(
- $fleet_row['fleet_owner'],
- $this->langs->line('exp_blackholl_2'),
- $fleet_row['fleet_end_stay']
+ $fleet['fleet_owner'],
+ $this->langs->line('game/expedition.exp_blackholl_2'),
+ $fleet['fleet_end_stay']
);
- $this->missionsModel->updateLostShipsAndDefensePoints($fleet_row['fleet_owner'], $current_fleet);
- parent::removeFleet((int) $fleet_row['fleet_id']);
+ $this->missionsModel->updateLostShipsAndDefensePoints($fleet['fleet_owner'], $current_fleet);
+ parent::removeFleet($fleet['fleet_id']);
}
}
}
- /**
- * hazardNothing
- *
- * @param array $fleet_row Fleet row
- *
- * @return void
- */
- private function hazardNothing($fleet_row)
- {
- $this->expeditionMessage(
- $fleet_row['fleet_owner'],
- $this->langs->line('exp_nothing_' . mt_rand(1, 6)),
- $fleet_row['fleet_end_stay']
- );
-
- parent::returnFleet((int) $fleet_row['fleet_id']);
- }
-
- /**
- * hazardResources
- *
- * @param array $fleet_row Fleet row
- * @param int $fleet_capacity Fleet capacity
- *
- * @return void
- */
- private function hazardResources($fleet_row, $fleet_capacity)
- {
- $fleet_current_capacity = $fleet_row['fleet_resource_metal'] + $fleet_row['fleet_resource_crystal'] + $fleet_row['fleet_resource_deuterium'];
- $fleet_capacity -= $fleet_current_capacity;
-
- if ($fleet_capacity > 5000) {
- $min_capacity = $fleet_capacity - 5000;
- $max_capacity = $fleet_capacity;
- $found_resources = mt_rand($min_capacity, $max_capacity);
- $found_metal = intval($found_resources / 2);
- $found_crystal = intval($found_resources / 4);
- $found_deuterium = intval($found_resources / 6);
- $found_darkmatter = ($fleet_capacity > 10000) ? intval(3 * log($fleet_capacity / 10000) * 100) : 0;
- $found_darkmatter = mt_rand(intval($found_darkmatter / 2), $found_darkmatter);
-
- $this->missionsModel->updateFleetResourcesById([
- 'found' => [
- 'metal' => $found_metal,
- 'crystal' => $found_crystal,
- 'deuterium' => $found_deuterium,
- 'darkmatter' => $found_darkmatter,
- ],
- 'fleet_id' => $fleet_row['fleet_id'],
- ]);
-
- $message = sprintf(
- $this->langs->line('exp_found_goods'),
- FormatLib::prettyNumber($found_metal),
- $this->langs->line('metal'),
- FormatLib::prettyNumber($found_crystal),
- $this->langs->line('crystal'),
- FormatLib::prettyNumber($found_deuterium),
- $this->langs->line('deuterium'),
- FormatLib::prettyNumber($found_darkmatter),
- $this->langs->line('dark_matter')
- );
-
- $this->expeditionMessage($fleet_row['fleet_owner'], $message, $fleet_row['fleet_end_stay']);
- }
- }
-
- /**
- * hazardShips
- *
- * @param array $fleet_row Fleet row
- * @param int $fleet_points Fleet points
- * @param array $current_fleet Current fleet
- *
- * @return void
- */
- private function hazardShips($fleet_row, $fleet_points, $current_fleet)
+ private function hazardShips($fleet, $fleet_points, $current_fleet)
{
$ships_ratio = $this->setShipsRatios();
- $found_chance = $fleet_points / $fleet_row['fleet_amount'];
+ $found_chance = $fleet_points / $fleet['fleet_amount'];
+ $foundShip = [];
for ($ship = 202; $ship <= 215; $ship++) {
if (isset($current_fleet[$ship]) && $current_fleet[$ship] != 0) {
- $found_ship[$ship] = round($current_fleet[$ship] * $ships_ratio[$ship] * $found_chance) + 1;
+ $foundShip[$ship] = round($current_fleet[$ship] * $ships_ratio[$ship] * $found_chance) + 1;
- if ($found_ship[$ship] > 0) {
- $current_fleet[$ship] += $found_ship[$ship];
+ if ($foundShip[$ship] > 0) {
+ $current_fleet[$ship] += $foundShip[$ship];
}
}
}
@@ -258,70 +302,33 @@ private function hazardShips($fleet_row, $fleet_points, $current_fleet)
}
}
- if ($found_ship != null) {
- foreach ($found_ship as $ship => $count) {
+ if ($foundShip != null) {
+ foreach ($foundShip as $ship => $count) {
if ($count != 0) {
- $found_ship_message .= $this->langs->line($this->resource[$ship]) . ': ' . $count . '
';
+ $found_ship_message .= $this->langs->line('game/ships.' . $this->resource[$ship]) . ': ' . $count . '
';
}
}
}
$this->missionsModel->updateFleetArrayById([
'ships' => FleetsLib::setFleetShipsArray($new_ships),
- 'fleet_id' => $fleet_row['fleet_id'],
+ 'fleet_id' => $fleet['fleet_id'],
]);
- $message = sprintf($this->langs->line('exp_new_ships_' . mt_rand(1, 5)), $found_ship_message);
+ $message = sprintf($this->langs->line('game/expedition.exp_new_ships_' . mt_rand(1, 5)), $found_ship_message);
- $this->expeditionMessage($fleet_row['fleet_owner'], $message, $fleet_row['fleet_end_stay']);
+ $this->expeditionMessage($fleet['fleet_owner'], $message, $fleet['fleet_end_stay']);
}
- /**
- * setShipsPoints
- *
- * @return array
- */
- private function setShipsPoints()
- {
- return [
- 202 => 1.0, 203 => 1.5, 204 => 0.5, 205 => 1.5, 206 => 2.0,
- 207 => 2.5, 208 => 0.5, 209 => 1.0, 210 => 0.01, 211 => 3.0,
- 212 => 0.0, 213 => 3.5, 214 => 5.0, 215 => 3.2,
- ];
- }
-
- /**
- * setShipsRatios
- *
- * @return array
- */
- private function setShipsRatios()
- {
- return [
- 202 => 0.1, 203 => 0.1, 204 => 0.1, 205 => 0.5, 206 => 0.25,
- 207 => 0.125, 208 => 0.5, 209 => 0.1, 210 => 0.1, 211 => 0.0625,
- 212 => 0.0, 213 => 0.0625, 214 => 0.03125, 215 => 0.0625,
- ];
- }
-
- /**
- * expeditionMessage
- *
- * @param int $owner Owner
- * @param string $message Message
- * @param int $time Time
- *
- * @return void
- */
- private function expeditionMessage($owner, $message, $time)
+ private function expeditionMessage(int $owner, string $message, int $time): void
{
Functions::sendMessage(
$owner,
'',
$time,
5,
- $this->langs->line('mi_fleet_command'),
- $this->langs->line('exp_report_title'),
+ $this->langs->line('game/missions.mi_fleet_command'),
+ $this->langs->line('game/expedition.exp_report_title'),
$message
);
}
diff --git a/app/Models/Libraries/Missions/Missions.php b/app/Models/Libraries/Missions/Missions.php
index 260ce092c..f1642f6bd 100644
--- a/app/Models/Libraries/Missions/Missions.php
+++ b/app/Models/Libraries/Missions/Missions.php
@@ -680,20 +680,13 @@ public function updateFleetDataToReturn(array $data): void
);
}
}
- /**
- *
- * EXPEDITION
- *
- */
/**
*
+ * EXPEDITION
*
- * @param array $data Data to update
- *
- * @return void
*/
- public function updateFleetArrayById(array $data = [])
+ public function updateFleetArrayById(array $data = []): void
{
if (is_array($data)) {
$this->db->query(
@@ -705,28 +698,32 @@ public function updateFleetArrayById(array $data = [])
}
}
- /**
- * Updates the fleet resources with what we found on the expedition
- *
- * @param array $data Data to update
- *
- * @return void
- */
- public function updateFleetResourcesById(array $data = [])
+ public function updateFleetResourcesById(int $fleetId, string $resource, int $amount): void
{
- if (is_array($data)) {
- $this->db->query(
- 'UPDATE ' . FLEETS . ' AS f
- INNER JOIN ' . PREMIUM . " AS pr ON pr.premium_user_id = f.fleet_owner SET
- `fleet_resource_metal` = `fleet_resource_metal` + '" . $data['found']['metal'] . "',
- `fleet_resource_crystal` = `fleet_resource_crystal` + '" . $data['found']['crystal'] . "',
- `fleet_resource_deuterium` = `fleet_resource_deuterium` + '" . $data['found']['deuterium'] . "',
- `premium_dark_matter` = `premium_dark_matter` + '" . $data['found']['darkmatter'] . "',
- `fleet_mess` = '1'
- WHERE `fleet_id` = '" . (int) $data['fleet_id'] . "';"
- );
- }
+ $this->db->query(
+ 'UPDATE ' . FLEETS . " AS f
+ `fleet_resource_' . $resource . '` = `fleet_resource_' . $resource . '` + '" . $amount . "',
+ `fleet_mess` = '1'
+ WHERE `fleet_id` = '" . $fleetId . "';"
+ );
+ }
+
+ public function updateDarkMatter(int $userId, int $darkMatter): void
+ {
+ $this->db->query(
+ 'UPDATE ' . PREMIUM . " AS p SET
+ `premium_dark_matter` = `premium_dark_matter` + '" . $darkMatter . "'
+ WHERE `premium_user_id` = '" . $userId . "';"
+ );
}
+
+ public function getTopPlayerPoints(): int
+ {
+ return $this->db->queryFetch(
+ 'SELECT MAX(us.user_statistic_total_points) AS total FROM `xgp_users_statistics` us;'
+ )['total'];
+ }
+
/**
*
* MISSILE
diff --git a/app/Services/Formulas/Expedition.php b/app/Services/Formulas/Expedition.php
new file mode 100644
index 000000000..9d93feb8f
--- /dev/null
+++ b/app/Services/Formulas/Expedition.php
@@ -0,0 +1,231 @@
+getMaxExpeditionPoints($topPlayerPoints) * 100;
+ }
+
+ public function calculateExpeditionPoints(int $structuralIntegrity): int
+ {
+ return ($structuralIntegrity * 5 / 1000);
+ }
+
+ public function getExpeditionResult(): string
+ {
+ // probability ratios - we add a weight
+ $events = [
+ 'darkMatter' => 900, // 9%
+ 'ships' => 2200, // 22%
+ 'resources' => 3250, // 32.5%
+ 'pirates' => 580, // 5.8%
+ 'aliens' => 260, // 2.6%
+ 'delay' => 700, // 7%
+ 'early' => 200, // 2%
+ 'nothing' => 1860, // 18.6%
+ 'merchant' => 17, // 0.17%
+ 'blackHole' => 33, // 0.33%
+ ];
+ $randomNumber = mt_rand(0, array_sum($events));
+ $sum = 0;
+
+ foreach ($events as $event => $probability) {
+ $sum += $probability;
+
+ if ($randomNumber <= $sum) {
+ return $event;
+ }
+ }
+
+ // fallback
+ return 'nothing';
+ }
+
+ public function calculateDarkMatterSourceSize(): int
+ {
+ // probability ratios - we add a weight
+ $discoveryTypes = [
+ 'small' => 8900, // 89%
+ 'medium' => 2400, // 10%
+ 'large' => 750, // 1%
+ ];
+ $randomNumber = mt_rand(0, array_sum($discoveryTypes));
+ $sum = 0;
+
+ foreach ($discoveryTypes as $discovery => $probability) {
+ $sum += $probability;
+
+ if ($randomNumber <= $sum) {
+ return $discovery;
+ }
+ }
+
+ // fallback
+ return 'small';
+ }
+
+ public function getDarkMatterSourceSize(string $discoveryType): int
+ {
+ if ($discoveryType === 'medium') {
+ return mt_rand(500, 700);
+ }
+
+ if ($discoveryType === 'large') {
+ return mt_rand(1000, 1800);
+ }
+
+ return mt_rand(300, 400); // $discoveryType === 'small'
+ }
+
+ public function calculateResourceTypeObtained(): int
+ {
+ // probability ratios - we add a weight
+ $resources = [
+ 'metal' => 6850, // 68,5%
+ 'crystal' => 2400, // 24%
+ 'deuterium' => 750, // 7.5%
+ ];
+ $randomNumber = mt_rand(0, array_sum($resources));
+ $sum = 0;
+
+ foreach ($resources as $resource => $probability) {
+ $sum += $probability;
+
+ if ($randomNumber <= $sum) {
+ return $resource;
+ }
+ }
+
+ // fallback
+ return 'metal';
+ }
+
+ public function calculateResourceSourceSize(): int
+ {
+ // probability ratios - we add a weight
+ $discoveryTypes = [
+ 'normal' => 8900, // 89%
+ 'large' => 2400, // 10%
+ 'xl' => 750, // 1%
+ ];
+ $randomNumber = mt_rand(0, array_sum($discoveryTypes));
+ $sum = 0;
+
+ foreach ($discoveryTypes as $discovery => $probability) {
+ $sum += $probability;
+
+ if ($randomNumber <= $sum) {
+ return $discovery;
+ }
+ }
+
+ // fallback
+ return 'normal';
+ }
+
+ public function getResourceSourceSizeMultChances(string $discoveryType): int
+ {
+ if ($discoveryType === 'large') {
+ return mt_rand(50, 100);
+ }
+
+ if ($discoveryType === 'xl') {
+ return mt_rand(100, 200);
+ }
+
+ return mt_rand(10, 50); // $discoveryType === 'normal'
+ }
+
+ public function getResourceFoundAmount(int $chancesMultiplier, int $expeditionPoints, string $resourceType): int
+ {
+ $resource = [
+ 'metal' => 1,
+ 'crystal' => 2,
+ 'deuterium' => 3,
+ ];
+
+ return $chancesMultiplier * $expeditionPoints / $resource[$resourceType];
+ }
+
+ public function calculateShipFoundAmount(int $chancesMultiplier, int $expeditionPoints)
+ {
+ return $chancesMultiplier * $expeditionPoints / 2;
+ }
+
+ /**
+ * Only these ships are computed for the expeditions points
+ */
+ public function getPossibleShips(): array
+ {
+ return [
+ 202, // ship_small_cargo_ship
+ 203, // ship_big_cargo_ship
+ 204, // ship_light_fighter
+ 205, // ship_heavy_fighter
+ 206, // ship_cruiser
+ 207, // ship_battleship
+ 210, // ship_espionage_probe
+ 211, // ship_bomber
+ 213, // ship_destroyer
+ 215, // ship_battlecruiser
+ ];
+ }
+
+ /**
+ * Only these ships are obtainable on an expedition
+ */
+ public function getShipsObtainableChances(): array
+ {
+ return [
+ 202 => 0.1, // ship_small_cargo_ship
+ 203 => 0.1, // ship_big_cargo_ship
+ 204 => 0.1, // ship_light_fighter
+ 205 => 0.5, // ship_heavy_fighter
+ 206 => 0.25, // ship_cruiser
+ 207 => 0.125, // ship_battleship
+ 210 => 0.1, // ship_espionage_probe
+ 211 => 0.0625, // ship_bomber
+ 213 => 0.0625, // ship_destroyer
+ 215 => 0.0625, // ship_battlecruiser
+ ];
+ }
+}
diff --git a/resources/lang/english/game/expedition_lang.php b/resources/lang/english/game/expedition_lang.php
index c400daf5c..412ea0dde 100644
--- a/resources/lang/english/game/expedition_lang.php
+++ b/resources/lang/english/game/expedition_lang.php
@@ -83,8 +83,5 @@
'exp_status_fresh_2' => 'Entry from the communications officers logbook: It feels great to be the first ones traveling through an unexplored sector.', // ok
// old lines
- 'exp_blackholl_1' => 'The fleet was sucked into a black hole is partially destroyed.',
- 'exp_blackholl_2' => 'The fleet was sucked into a black hole, and was completely destroyed!',
- 'exp_found_goods' => 'The fleet has discovered an unmanned spacecraft!
His scouts have recovered %s de %s, %s de %s, %s de %s y %s de %s.',
'exp_back_home' => 'Your expedition returned to the hangar.',
];
diff --git a/resources/lang/spanish/game/expedition_lang.php b/resources/lang/spanish/game/expedition_lang.php
index aa23ab9fa..b0853e754 100644
--- a/resources/lang/spanish/game/expedition_lang.php
+++ b/resources/lang/spanish/game/expedition_lang.php
@@ -84,8 +84,5 @@
'exp_status_fresh_2' => 'Registro en el diario de navegación del oficial de comunicación: Es una gran sensación ser el primero en un sector inexplorado.', // ok
// old lines
- 'exp_blackholl_1' => 'La flota fue arrastrada hacia un agujero negro, esta parcialmente destruida.',
- 'exp_blackholl_2' => 'La flota fue arrastrada hacia un agujero negro, y fue completamente destruida!',
- 'exp_found_goods' => 'La flota ha descubierto una nave no tripulada!
Tus exploradores han recuperado %s de %s, %s de %s, %s de %s y %s de %s.',
'exp_back_home' => 'Tu expedición regresó al hangar.',
];