moon mailer

This commit is contained in:
2019-05-31 21:55:15 -05:00
parent b8e6e71da6
commit ba289865ac
2 changed files with 75 additions and 3 deletions

View File

@@ -184,13 +184,13 @@ class MoonMailerCommand extends Command
//Get the updated price for the moon
$price = $moonCalc->SpatialMoonsOnlyGoo($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
//Check the type and figure out which price to add in
if($rental->Type == 'alliance') {
$totalCost += (int)$price['alliance'];
$totalCost += ($price['alliance'] * 1.00);
} else{
$totalCost += (int)$price['outofalliance'];
$totalCost += ($price['outofalliance'] * 1.00);
}
}

View File

@@ -145,6 +145,78 @@ class MoonCalc {
return $totalPriceMined;
}
public function SpatialMoonsOnlyGooMailer($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
//Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
//Total pull size is 14,385,600 m3
$totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
//Get the configuration for pricing calculations
$config = DB::table('Config')->get();
if($firstQuan >= 1.00) {
$firstPerc = $this->ConvertToPercentage($firstQuan);
} else {
$firstPerc = $firstQuan;
}
if($secondQuan >= 1.00) {
$secondPerc = $this->ConvertToPercentage($secondQuan);
} else {
$secondPerc = $secondQuan;
}
if($thirdQuan >= 1.00) {
$thirdPerc = $this->ConvertToPercentage($thirdQuan);
} else {
$thirdPerc = $thirdQuan;
}
if($fourthQuan >= 1.00) {
$fourthPerc = $this->ConvertToPercentage($fourthQuan);
} else {
$fourthPerc = $fourthQuan;
}
if($firstOre != "None") {
if($this->IsRMoon($firstOre)) {
$firstTotal = $this->CalcPrice($firstOre, $firstPerc);
} else {
$firstTotal = 0.00;
}
} else {
$firstTotal = 0.00;
}
if($secondOre != "None") {
if($this->IsRMoon($secondOre)) {
$secondTotal = $this->CalcPrice($secondOre, $secondPerc);
} else {
$secondTotal = 0.00;
}
} else {
$secondTotal = 0.00;
}
if($thirdOre != "None") {
if($this->IsRMoon($thirdOre)) {
$thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
} else {
$thirdTotal = 0.00;
}
} else {
$thirdTotal = 0.00;
}
if($fourthOre != "None") {
if($this->IsRMoon($fourthOre)) {
$fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
} else {
$fourthTotal = 0.00;
}
} else {
$fourthTotal = 0.00;
}
//Calculate the total to price to be mined in one month
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
//Calculate the rental price. Refined rate is already included in the price from rental composition
$rentalPrice['alliance'] = $totalPriceMined * ($config[0]->RentalTax / 100.00);
$rentalPrice['outofalliance'] = $totalPriceMined * ($config[0]->AllyRentalTax / 100.00);
//Return the rental price to the caller
return $rentalPrice;
}
public function SpatialMoonsOnlyGoo($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
//Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
//Total pull size is 14,385,600 m3