Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from steemnova/master
Browse files Browse the repository at this point in the history
Getting my fork up to date
  • Loading branch information
antonmosich authored Mar 28, 2018
2 parents b12da2c + dfa991c commit 0f23984
Show file tree
Hide file tree
Showing 17 changed files with 191 additions and 185 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ SteemNova expansion goes as follows:
3. Game manual and tips & tricks for newbies.
4. ~~Specify detailed explanation how the reward system will work~~. (https://steemit.com/steemnova/@steemnova/steemnova-weekly-sbd-reward-scheme-for-members-of-the-best-alliances)
5. Announce bug bounties, artwork contests and utopian-io task requests for contributors (mobile UI, visual bugs etc.).
6. Steem accounts integration.
6. ~~Steem accounts integration.~~ (https://github.com/steemnova/steemnova/pull/67)


## Local installation

- Clone the repo: `git clone https://github.com/steemnova/steemnova`
- Install components: `apt-get install apache2 php7.0 php7.0-gd php7.0-fpm php7.0-mysql libapache2-mod mysql-server`
- Install components: `apt-get install apache2 php7.0 php7.0-gd php7.0-fpm php7.0-mysql php7.0-curl libapache2-mod mysql-server`
- Install [php-ds extension](https://github.com/php-ds/extension)
- `apt-get install php-pear php7.0-dev`
- pecl install ds
Expand Down
2 changes: 1 addition & 1 deletion includes/classes/class.BuildFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function getElementPrice($USER, $PLANET, $Element, $forDestroy = f
$price[$resType] = $ressourceAmount;

if(isset($pricelist[$Element]['factor']) && $pricelist[$Element]['factor'] != 0 && $pricelist[$Element]['factor'] != 1) {
$price[$resType] *= pow($pricelist[$Element]['factor'], $elementLevel);
$price[$resType] *= pow($pricelist[$Element]['factor'], $elementLevel - 1);
}

if($forLevel && (in_array($Element, $reslist['fleet']) || in_array($Element, $reslist['defense']) || in_array($Element, $reslist['missile']))) {
Expand Down
32 changes: 9 additions & 23 deletions includes/classes/class.statbuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private function GetUsersInfosFromDB()
$Return['Fleets'] = $FlyingFleets;
$Return['Planets'] = $database->select('SELECT SQL_BIG_RESULT DISTINCT '.$select_buildings.' p.id, p.universe, p.id_owner, u.authlevel, u.bana, u.username FROM %%PLANETS%% as p LEFT JOIN %%USERS%% as u ON u.id = p.id_owner;');
$Return['Users'] = $database->select('SELECT SQL_BIG_RESULT DISTINCT '.$selected_tech.$select_fleets.$select_defenses.' u.id, u.ally_id, u.authlevel, u.bana, u.universe, u.username, s.tech_rank AS old_tech_rank, s.build_rank AS old_build_rank, s.defs_rank AS old_defs_rank, s.fleet_rank AS old_fleet_rank, s.total_rank AS old_total_rank FROM %%USERS%% as u LEFT JOIN %%STATPOINTS%% as s ON s.stat_type = 1 AND s.id_owner = u.id LEFT JOIN %%PLANETS%% as p ON u.id = p.id_owner GROUP BY s.id_owner, u.id, u.authlevel;');
$Return['Alliance'] = $database->select('SELECT SQL_BIG_RESULT DISTINCT a.id, a.ally_universe, s.tech_rank AS old_tech_rank, s.build_rank AS old_build_rank, s.defs_rank AS old_defs_rank, s.fleet_rank AS old_fleet_rank, s.total_rank AS old_total_rank FROM %%ALLIANCE%% as a LEFT JOIN %%STATPOINTS%% as s ON s.stat_type = 2 AND s.id_owner = a.id;');
$Return['Alliance'] = $database->select('SELECT SQL_BIG_RESULT DISTINCT a.id, a.ally_universe, s.tech_rank AS old_tech_rank, s.build_rank AS old_build_rank, s.defs_rank AS old_defs_rank, s.fleet_rank AS old_fleet_rank, s.total_rank AS old_total_rank FROM %%ALLIANCE%% as a LEFT JOIN %%STATPOINTS%% as s ON s.stat_type = 2 AND s.id_owner = a.id GROUP BY a.id;');

return $Return;
}
Expand Down Expand Up @@ -169,18 +169,11 @@ private function GetTechnoPoints($USER)
{
if($USER[$resource[$Techno]] == 0) continue;

// Points = (All resources / PointsPerCost) * Factor * ( 2 * ( Factor ^ Level ) - Factor) + 1)
// PointsPerCot == Config::get()->stat_settings
// PointsPerCot == Config::get()->stat_settings
for ($i = 1; $i <= $USER[$resource[$Techno]]; $i++) {
$TechPoints += ($pricelist[$Techno]['cost'][901] + $pricelist[$Techno]['cost'][902] + $pricelist[$Techno]['cost'][903]) * pow($pricelist[$Techno]['factor'], $i - 1);
}
$TechCounts += $USER[$resource[$Techno]];
$TechPoints +=
($pricelist[$Techno]['cost'][901] + $pricelist[$Techno]['cost'][902] + $pricelist[$Techno]['cost'][903])
* $pricelist[$Techno]['factor']
* (
2 * (
pow($pricelist[$Techno]['factor'], $USER[$resource[$Techno]]) - $pricelist[$Techno]['factor']
) + 1
);


$this->setRecords($USER['id'], $Techno, $USER[$resource[$Techno]]);
}
Expand All @@ -198,17 +191,10 @@ private function GetBuildPoints($PLANET)
{
if($PLANET[$resource[$Build]] == 0) continue;

// Points = (All resources / PointsPerCost) * Factor * ( 2 * ( Factor ^ Level ) - Factor) + 1)
// PointsPerCot == Config::get()->stat_settings
$BuildPoints +=
($pricelist[$Build]['cost'][901] + $pricelist[$Build]['cost'][902] + $pricelist[$Build]['cost'][903])
* $pricelist[$Build]['factor']
* (
2 * (
pow($pricelist[$Build]['factor'], $PLANET[$resource[$Build]]) - $pricelist[$Build]['factor']
) + 1
);

// PointsPerCot == Config::get()->stat_settings
for ($i = 1; $i <= $PLANET[$resource[$Build]]; $i++) {
$BuildPoints += ($pricelist[$Build]['cost'][901] + $pricelist[$Build]['cost'][902] + $pricelist[$Build]['cost'][903]) * pow($pricelist[$Build]['factor'], $i - 1);
}
$BuildCounts += $PLANET[$resource[$Build]];

$this->setRecords($PLANET['id_owner'], $Build, $PLANET[$resource[$Build]]);
Expand Down
4 changes: 2 additions & 2 deletions includes/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@
define('SPY_VIEW_FACTOR' , 1);

// Bash Settings
define('BASH_ON' , false);
define('BASH_ON' , true);
define('BASH_COUNT' , 6);
define('BASH_TIME' , 86400);

// Bash rule on wars:
// 0 = NORMAL
// 1 = ON WAR, BASH RULE IS DEACTIVE
define('BASH_WAR' , 0);
define('BASH_WAR' , 1);

// MINIMUM FLEET TIME MUST HIGHER THEN BASH_TIME
define('FLEETLOG_AGE' , 86400);
Expand Down
2 changes: 1 addition & 1 deletion includes/pages/game/ShowAlliancePage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ protected function adminDetailApply()
LEFT JOIN
%%USERS%% AS u ON r.userId = u.id
INNER JOIN
%%STATPOINTS%% AS stat
%%STATPOINTS%% AS stat ON r.userId = stat.id_owner
LEFT JOIN
%%PLANETS%% AS p ON p.id = u.id_planet
WHERE
Expand Down
23 changes: 3 additions & 20 deletions includes/pages/game/ShowBattleHallPage.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* 2Moons
* 2Moons
* by Jan-Otto Kröpke 2009-2016
*
* For the full copyright and license information, please view the LICENSE
Expand All @@ -27,21 +27,6 @@ function __construct()
function show()
{
global $USER, $LNG;
$order = HTTP::_GP('order', 'units');
$sort = HTTP::_GP('sort', 'desc');
$sort = strtoupper($sort) === "DESC" ? "DESC" : "ASC";


switch($order)
{
case 'date':
$key = '%%TOPKB%%.time '.$sort;
break;
case 'units':
default:
$key = '%%TOPKB%%.units '.$sort;
break;
}

$db = Database::get();
$sql = "SELECT *, (
Expand All @@ -57,7 +42,7 @@ function show()
FROM %%TOPKB_USERS%% INNER JOIN %%USERS%% ON uid = id
WHERE %%TOPKB_USERS%%.rid = %%TOPKB%%.`rid` AND `role` = 2
) as defender
FROM %%TOPKB%% WHERE universe = :universe ORDER BY ".$key." LIMIT 100;";
FROM %%TOPKB%% WHERE universe = :universe ORDER BY %%TOPKB%%.units DESC LIMIT 100;";

$top = $db->select($sql, array(
':universe' => Universe::current()
Expand All @@ -79,10 +64,8 @@ function show()

$this->assign(array(
'TopKBList' => $TopKBList,
'sort' => $sort,
'order' => $order,
));

$this->display('page.battleHall.default.tpl');
}
}
}
9 changes: 5 additions & 4 deletions includes/pages/game/ShowFleetAjaxPage.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* 2Moons
* 2Moons
* by Jan-Otto Kröpke 2009-2016
*
* For the full copyright and license information, please view the LICENSE
Expand Down Expand Up @@ -97,8 +97,9 @@ public function show()

foreach($recElementIDs as $elementID)
{
$shipsNeed = min(ceil($totalDebris / $pricelist[$elementID]['capacity']), $PLANET[$resource[$elementID]]);
$totalDebris -= ($shipsNeed * $pricelist[$elementID]['capacity']);
$a = $pricelist[$elementID]['capacity'] * (1 + $USER['factor']['ShipStorage']);
$shipsNeed = min(ceil($totalDebris / $a), $PLANET[$resource[$elementID]]);
$totalDebris -= ($shipsNeed * $a);

$fleetArray[$elementID] = $shipsNeed;
$this->returnData['ships'][$elementID] = $PLANET[$resource[$elementID]] - $shipsNeed;
Expand Down Expand Up @@ -217,4 +218,4 @@ public function show()

$this->sendData(600, $LNG['fa_sending']." ".array_sum($fleetArray)." ". $LNG['tech'][$shipID[0]] ." ".$LNG['gl_to']." ".$targetData['galaxy'].":".$targetData['system'].":".$targetData['planet']." ...");
}
}
}
Loading

0 comments on commit 0f23984

Please sign in to comment.