added routes for new views
added displayTotalWorth view display added form response for displaying total worth modified Moons Controller modified Moon Calc class
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
10
resources/views/moons/displayTotalWorth.blade.php
Normal file
10
resources/views/moons/displayTotalWorth.blade.php
Normal file
@@ -0,0 +1,10 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2>Total Worth of the Moon / Month</h2>
|
||||
<div class="jumbotron">
|
||||
Total Moon Goo + Ore Worth: <?php echo $totalWorth; ?> <br>
|
||||
Total Moon Goo Worth: <?php echo $totalGoo; ?> <br>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
173
resources/views/moons/formTotalWorth.blade.php
Normal file
173
resources/views/moons/formTotalWorth.blade.php
Normal file
@@ -0,0 +1,173 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2>Total Worth Calculator</h2><br>
|
||||
<h3>Enter the moon composition</h3><br>
|
||||
{!! Form::open(['action' => 'MoonsController@displayTotalWorth', 'method' => 'POST']) !!}
|
||||
<div class="form-group col-md-6">
|
||||
{{ 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']) }}
|
||||
</div>
|
||||
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user