Skip to content

Commit

Permalink
Price trent was gone (#55)
Browse files Browse the repository at this point in the history
Moved changes of 163fcd2 from php
script to template.
  • Loading branch information
J0hnHawk committed Aug 14, 2019
1 parent d3f207a commit 36cd127
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions include/savegame/Prices.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ private static function getGreatDemandMultiplier($fillType, $stationId) {
private static function getPrice($amplitude0, $amplitude1, $period0, $period1, $time0, $time1, $nominalAmplitude1) {
$sin1 = $amplitude0 * sin ( (2 * pi () / $period0) * $time0 );
$sin2 = $amplitude1 * sin ( (2 * pi () / $period1) * $time1 ) + $nominalAmplitude1 * 10;
return floor(($sin1 + $sin2) * 1000 * self::$priceMultiplier);
return ($sin1 + $sin2) * 1000 * self::$priceMultiplier;
}
private static function getPrices($curve0, $curve1) {
$curve0 = self::objects2float ( $curve0 );
$curve1 = self::objects2float ( $curve1 );
$offset = 1000;
$currentPrice = self::getPrice ( $curve0 ['amplitude'], $curve1 ['amplitude'], $curve0 ['period'], $curve1 ['period'], $curve0 ['time'], $curve1 ['time'], $curve1 ['nominalAmplitude'] );
$nextPrice = self::getPrice ( $curve0 ['amplitude'], $curve1 ['amplitude'], $curve0 ['period'], $curve1 ['period'], $curve0 ['time'] + $offset, $curve1 ['time'] + $offset, $curve1 ['nominalAmplitude'] );
$maxPrice = floor(($curve0 ['nominalAmplitude'] + $curve0 ['nominalAmplitudeVariation'] + $curve1 ['nominalAmplitude'] + $curve1 ['nominalAmplitudeVariation'] + $curve1 ['nominalAmplitude'] * 10) * 1000 * self::$priceMultiplier);
$minPrice = floor((($curve0 ['nominalAmplitude'] + $curve0 ['nominalAmplitudeVariation'] + $curve1 ['nominalAmplitude'] + $curve1 ['nominalAmplitudeVariation']) * - 1 + $curve1 ['nominalAmplitude'] * 10) * 1000 * self::$priceMultiplier);
$maxPrice = ($curve0 ['nominalAmplitude'] + $curve0 ['nominalAmplitudeVariation'] + $curve1 ['nominalAmplitude'] + $curve1 ['nominalAmplitudeVariation'] + $curve1 ['nominalAmplitude'] * 10) * 1000 * self::$priceMultiplier;
$minPrice = (($curve0 ['nominalAmplitude'] + $curve0 ['nominalAmplitudeVariation'] + $curve1 ['nominalAmplitude'] + $curve1 ['nominalAmplitudeVariation']) * - 1 + $curve1 ['nominalAmplitude'] * 10) * 1000 * self::$priceMultiplier;
return array (
'currentPrice' => $currentPrice,
'minPrice' => $minPrice,
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$webStatsVersion = '0.9.4';
$webStatsVersion = '0.9.5';
ini_set ( 'error_reporting', E_ALL );
ini_set ( 'display_errors', 1 );
ini_set ( 'log_errors', 1 );
Expand Down
4 changes: 2 additions & 2 deletions styles/fs19webstats/templates/prices.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{else}
{$trend='<i class="fas fa-caret-down" style="visibility: hidden"></i>'}
{/if}
{$value=$fillTypeData.locations.$location.price|number_format:0:",":"."}
{$value=$fillTypeData.locations.$location.price|floor|number_format:0:",":"."}

{else}
{$dataorder=""}{$class=""}{$value=""}{$trend=""}
Expand Down Expand Up @@ -109,7 +109,7 @@
<td>{$fillTypeData.bestLocation}</td>
<td class="text-right col-1 pr-3">{$fillTypeData.minPrice|number_format:0:",":"."}</td>
<td class="text-right col-1 pr-3">{$fillTypeData.maxPrice|number_format:0:",":"."}</td>
<td class="text-right col-1 pr-3 {if $fillTypeData.greatDemand}text-info{elseif $percent>=60}text-success{elseif $percent<=40}text-danger{/if}">{$fillTypeData.bestPrice|number_format:0:",":"."} {if $fillTypeData.priceTrend == 1} <i class="fas fa-caret-up text-success"></i> {elseif
<td class="text-right col-1 pr-3 {if $fillTypeData.greatDemand}text-info{elseif $percent>=60}text-success{elseif $percent<=40}text-danger{/if}">{$fillTypeData.bestPrice|floor|number_format:0:",":"."} {if $fillTypeData.priceTrend == 1} <i class="fas fa-caret-up text-success"></i> {elseif
$fillTypeData.priceTrend == -1} <i class="fas fa-caret-down text-danger"></i> {else} <i class="fas fa-caret-down" style="visibility: hidden"></i> {/if}
</td>
<td class="text-center text-nowrap">{$percent|number_format:0:",":"."} %</td> {if $options['farmId']>0}{if isset($commodities.$fillType) && $commodities.$fillType.overall > 0}
Expand Down

0 comments on commit 36cd127

Please sign in to comment.