diff --git a/app/Http/Controllers/MoonsController.php b/app/Http/Controllers/MoonsController.php
index 87ebe3eb7..6cde1d94f 100644
--- a/app/Http/Controllers/MoonsController.php
+++ b/app/Http/Controllers/MoonsController.php
@@ -74,7 +74,6 @@ class MoonsController extends Controller
'region' => 'required',
'system' => 'required',
'structure' => 'required',
-
]);
// Add new moon
@@ -127,4 +126,36 @@ class MoonsController extends Controller
return redirect('/moons/display')->with('success', 'Moon Updated');
}
+
+ public function displayTotalWorthForm() {
+ return view('moons.formTotalWorth');
+ }
+
+ public function displayTotalWorth(Request $request) {
+ $firstOre = $request->firstOre;
+ $firstQuantity = $request->firstQuantity;
+ $secondOre = $request->secondOre;
+ $secondQuantity = $request->secondQuantity;
+ $thirdOre = $request->thirdOre;
+ $thirdQuantity = $request->thirdQuantity;
+ $fourthOre = $request->fourthOre;
+ $fourthQuantity = $request->fourthQuantity;
+
+ //Setup calls to the MoonCalc class
+ $moonCalc = new MoonCalc();
+ //Update the prices for the moon
+ $moonCalc->FetchNewPrices();
+
+ $totalGoo = $moonCalc->SpatialMoonsOnlyGooTotalWorth($firstOre, $firstQuantity,
+ $secondOre, $secondQuantity,
+ $thirdOre, $thirdQuantity,
+ $fourthOre, $fourthQuantity);
+
+ $totalWorth = $moonCalc->SpatialMoonsTotalWorth($firstOre, $firstQuantity,
+ $secondOre, $secondQuantity,
+ $thirdOre, $thirdQuantity,
+ $fourthOre, $fourthQuantity);
+
+ return view('moons.displayTotalWorth')->with(['totalWorth' => $totalWorth, 'totalGoo' => $totalGoo]);
+ }
}
diff --git a/app/Library/MoonCalc.php b/app/Library/MoonCalc.php
index 873a8872b..ad887b92c 100644
--- a/app/Library/MoonCalc.php
+++ b/app/Library/MoonCalc.php
@@ -19,6 +19,128 @@ use App\Models\ItemComposition;
class MoonCalc {
+ public function SpatialMoonsTotalWorth($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") {
+ $firstTotal = $this->CalcPrice($firstOre, $firstPerc);
+ } else {
+ $firstTotal = 0.00;
+ }
+ if($secondOre != "None") {
+ $secondTotal = $this->CalcPrice($secondOre, $secondPerc);
+ } else {
+ $secondTotal = 0.00;
+ }
+ if($thirdOre != "None") {
+ $thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
+ } else {
+ $thirdTotal = 0.00;
+ }
+ if($fourthOre != "None") {
+ $fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
+ } else {
+ $fourthTotal = 0.00;
+ }
+ //Calculate the total to price to be mined in one month
+ $totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
+
+ //Return the rental price to the caller
+ return $totalPriceMined;
+ }
+
+ public function SpatialMoonsOnlyGooTotalWorth($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;
+
+ //Return the rental price to the caller
+ return $totalPriceMined;
+ }
+
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
diff --git a/resources/views/moons/displayTotalWorth.blade.php b/resources/views/moons/displayTotalWorth.blade.php
new file mode 100644
index 000000000..1d871fc12
--- /dev/null
+++ b/resources/views/moons/displayTotalWorth.blade.php
@@ -0,0 +1,10 @@
+@extends('layouts.b4')
+@section('content')
+
+
Total Worth Calculator
+
Enter the moon composition
+ {!! Form::open(['action' => 'MoonsController@displayTotalWorth', 'method' => 'POST']) !!}
+
+ {{ Form::label('firstOre', 'First Ore') }}
+ {{ Form::select('firstOre', [
+ 'None' => 'None',
+ 'Bitumens' => 'Bitumens',
+ 'Brilliant Gneiss' => 'Brilliant Gneiss',
+ 'Carnotite' => 'Carnotite',
+ 'Chromite' => 'Chromite',
+ 'Cinnabar' => 'Cinnabar',
+ 'Cobaltite' => 'Cobaltite',
+ 'Coesite' => 'Coesite',
+ 'Cubic Bistot' => 'Cubic Bistot',
+ 'Dazzling Spodumain' => 'Dazzling Spodumain',
+ 'Euxenite' => 'Euxenite',
+ 'Flawless Arkonor' => 'Flawless Arkonor',
+ 'Glossy Scordite' => 'Glossy Scordite',
+ 'Immaculate Jaspet' => 'Immaculate Jaspet',
+ 'Jet Ochre' => 'Jet Ochre',
+ 'Loparite' => 'Loparite',
+ 'Lustrous Hedbergite' => 'Lustrous Hedbergite',
+ 'Monazite' => 'Monazite',
+ 'Opulent Pyroxeres' => 'Opulent Pyroxeres',
+ 'Otavite' => 'Otavite',
+ 'Pellucid Crokite' => 'Pellucid Crokite',
+ 'Platinoid Omber' => 'Platinoid Omber',
+ 'Pollucite' => 'Pollucite',
+ 'Resplendant Kernite' => 'Resplendant Kernite',
+ 'Scheelite' => 'Scheelite',
+ 'Scintillating Hemorphite' => 'Scintillating Hemorphite',
+ 'Sparkling Plagioclase' => 'Sparkling Plagioclase',
+ 'Sperrylite' => 'Sperrylite',
+ 'Stable Veldspar' => 'Stable Veldspar',
+ 'Sylvite' => 'Sylvite',
+ 'Titanite' => 'Titanite',
+ 'Vanadinite' => 'Vanadinite',
+ 'Xenotime' => 'Xenotime',
+ 'Ytterbite' => 'Ytterbite',
+ 'Zeolites' => 'Zeolites',
+ 'Zircon' => 'Zircon',
+ ], 'None') }}
+ {{ Form::text('firstQuantity', '', ['class' => 'form-control']) }}
+ {{ Form::label('secondOre', 'Second Ore') }}
+ {{ Form::select('secondOre', [
+ 'None' => 'None',
+ 'Bitumens' => 'Bitumens',
+ 'Brilliant Gneiss' => 'Brilliant Gneiss',
+ 'Carnotite' => 'Carnotite',
+ 'Chromite' => 'Chromite',
+ 'Cinnabar' => 'Cinnabar',
+ 'Cobaltite' => 'Cobaltite',
+ 'Coesite' => 'Coesite',
+ 'Cubic Bistot' => 'Cubic Bistot',
+ 'Dazzling Spodumain' => 'Dazzling Spodumain',
+ 'Euxenite' => 'Euxenite',
+ 'Flawless Arkonor' => 'Flawless Arkonor',
+ 'Glossy Scordite' => 'Glossy Scordite',
+ 'Immaculate Jaspet' => 'Immaculate Jaspet',
+ 'Jet Ochre' => 'Jet Ochre',
+ 'Loparite' => 'Loparite',
+ 'Lustrous Hedbergite' => 'Lustrous Hedbergite',
+ 'Monazite' => 'Monazite',
+ 'Opulent Pyroxeres' => 'Opulent Pyroxeres',
+ 'Otavite' => 'Otavite',
+ 'Pellucid Crokite' => 'Pellucid Crokite',
+ 'Platinoid Omber' => 'Platinoid Omber',
+ 'Pollucite' => 'Pollucite',
+ 'Resplendant Kernite' => 'Resplendant Kernite',
+ 'Scheelite' => 'Scheelite',
+ 'Scintillating Hemorphite' => 'Scintillating Hemorphite',
+ 'Sparkling Plagioclase' => 'Sparkling Plagioclase',
+ 'Sperrylite' => 'Sperrylite',
+ 'Stable Veldspar' => 'Stable Veldspar',
+ 'Sylvite' => 'Sylvite',
+ 'Titanite' => 'Titanite',
+ 'Vanadinite' => 'Vanadinite',
+ 'Xenotime' => 'Xenotime',
+ 'Ytterbite' => 'Ytterbite',
+ 'Zeolites' => 'Zeolites',
+ 'Zircon' => 'Zircon',
+ ], 'None') }}
+ {{ Form::text('secondQuantity', '', ['class' => 'form-control']) }}
+ {{ Form::label('thirdOre', 'Third Ore') }}
+ {{ Form::select('thirdOre', [
+ 'None' => 'None',
+ 'Bitumens' => 'Bitumens',
+ 'Brilliant Gneiss' => 'Brilliant Gneiss',
+ 'Carnotite' => 'Carnotite',
+ 'Chromite' => 'Chromite',
+ 'Cinnabar' => 'Cinnabar',
+ 'Cobaltite' => 'Cobaltite',
+ 'Coesite' => 'Coesite',
+ 'Cubic Bistot' => 'Cubic Bistot',
+ 'Dazzling Spodumain' => 'Dazzling Spodumain',
+ 'Euxenite' => 'Euxenite',
+ 'Flawless Arkonor' => 'Flawless Arkonor',
+ 'Glossy Scordite' => 'Glossy Scordite',
+ 'Immaculate Jaspet' => 'Immaculate Jaspet',
+ 'Jet Ochre' => 'Jet Ochre',
+ 'Loparite' => 'Loparite',
+ 'Lustrous Hedbergite' => 'Lustrous Hedbergite',
+ 'Monazite' => 'Monazite',
+ 'Opulent Pyroxeres' => 'Opulent Pyroxeres',
+ 'Otavite' => 'Otavite',
+ 'Pellucid Crokite' => 'Pellucid Crokite',
+ 'Platinoid Omber' => 'Platinoid Omber',
+ 'Pollucite' => 'Pollucite',
+ 'Resplendant Kernite' => 'Resplendant Kernite',
+ 'Scheelite' => 'Scheelite',
+ 'Scintillating Hemorphite' => 'Scintillating Hemorphite',
+ 'Sparkling Plagioclase' => 'Sparkling Plagioclase',
+ 'Sperrylite' => 'Sperrylite',
+ 'Stable Veldspar' => 'Stable Veldspar',
+ 'Sylvite' => 'Sylvite',
+ 'Titanite' => 'Titanite',
+ 'Vanadinite' => 'Vanadinite',
+ 'Xenotime' => 'Xenotime',
+ 'Ytterbite' => 'Ytterbite',
+ 'Zeolites' => 'Zeolites',
+ 'Zircon' => 'Zircon',
+ ], 'None') }}
+ {{ Form::text('thirdQuantity', '', ['class' => 'form-control']) }}
+ {{ Form::label('fourthOre', 'Fourth Ore') }}
+ {{ Form::select('fourthOre', [
+ 'None' => 'None',
+ 'Bitumens' => 'Bitumens',
+ 'Brilliant Gneiss' => 'Brilliant Gneiss',
+ 'Carnotite' => 'Carnotite',
+ 'Chromite' => 'Chromite',
+ 'Cinnabar' => 'Cinnabar',
+ 'Cobaltite' => 'Cobaltite',
+ 'Coesite' => 'Coesite',
+ 'Cubic Bistot' => 'Cubic Bistot',
+ 'Dazzling Spodumain' => 'Dazzling Spodumain',
+ 'Euxenite' => 'Euxenite',
+ 'Flawless Arkonor' => 'Flawless Arkonor',
+ 'Glossy Scordite' => 'Glossy Scordite',
+ 'Immaculate Jaspet' => 'Immaculate Jaspet',
+ 'Jet Ochre' => 'Jet Ochre',
+ 'Loparite' => 'Loparite',
+ 'Lustrous Hedbergite' => 'Lustrous Hedbergite',
+ 'Monazite' => 'Monazite',
+ 'Opulent Pyroxeres' => 'Opulent Pyroxeres',
+ 'Otavite' => 'Otavite',
+ 'Pellucid Crokite' => 'Pellucid Crokite',
+ 'Platinoid Omber' => 'Platinoid Omber',
+ 'Pollucite' => 'Pollucite',
+ 'Resplendant Kernite' => 'Resplendant Kernite',
+ 'Scheelite' => 'Scheelite',
+ 'Scintillating Hemorphite' => 'Scintillating Hemorphite',
+ 'Sparkling Plagioclase' => 'Sparkling Plagioclase',
+ 'Sperrylite' => 'Sperrylite',
+ 'Stable Veldspar' => 'Stable Veldspar',
+ 'Sylvite' => 'Sylvite',
+ 'Titanite' => 'Titanite',
+ 'Vanadinite' => 'Vanadinite',
+ 'Xenotime' => 'Xenotime',
+ 'Ytterbite' => 'Ytterbite',
+ 'Zeolites' => 'Zeolites',
+ 'Zircon' => 'Zircon',
+ ], 'None') }}
+ {{ Form::text('fourthQuantity', '', ['class' => 'form-control']) }}
+
+ {{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
+ {!! Form::close() !!}
+
+@endsection
+
diff --git a/routes/web.php b/routes/web.php
index 9576f0c3e..580cd595e 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -27,10 +27,11 @@ Route::get('/dashboard', 'DashboardController@index');
Route::get('/moons/display', 'MoonsController@displayMoons');
Route::get('/moons/addmoon', 'MoonsController@addMoon');
Route::get('/moons/updatemoon', 'MoonsController@updateMoon');
-
+Route::get('/moons/display/worth', 'MoonsController@displayTotalWorthForm');
//Moon Controller POST requests
Route::post('storeMoon', 'MoonsController@storeMoon');
Route::post('storeUpdateMoon', 'MoonsController@storeUpdateMoon');
+Route::post('displayTotalWorth', 'MoonsController@displayTotalWorth');
//Wiki Controller display pages
Route::get('/wiki/register', 'WikiController@displayRegister');