Steemnova - Recyclers and battle hall fixes
Bug Fixes
Recyclers from galaxy view
Some time ago I found issue that if you're sending recyclers to debris from galaxy the bonus is not working.
Here is example of the 36k Metal and 36k Crystal on the debris. In total it is 72k of the resources.
Recycler:
Cargo capacity 20.000
So 4 recyclers should be sent. But there also exists special officer
So the cargo capacity is 40.000 and only 2 recyclers should be sent.
If I was sending recyclers from fleet view everything worked correctly.
But here is what happens:
After fix:
a/includes/pages/game/ShowFleetAjaxPage.class.php
@@ -97,8 +97,9 @@ class ShowFleetAjaxPage extends AbstractGamePage
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);
I've found parameter which is used for the fleetview and I've used it.
$USER['factor']['ShipStorage'] - bonus value in % / 100
https://github.com/steemnova/steemnova/pull/68
Battle hall sorting
This bug is different. It is possible to sort table in the battle hall (with the best battles) by date. It means that is possible to get the newest battles and by using the time/date and the location of the planets you can do attack on the returning fleet. It should be not possible because Phalax Sensor (which is needed for scanning) costs a lot and needs the moon.
+++ b/includes/pages/game/ShowBattleHallPage.class.php
@@ -27,21 +27,6 @@ class ShowBattleHallPage extends AbstractGamePage
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 *, (
@@ -57,7 +42,7 @@ class ShowBattleHallPage extends AbstractGamePage
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;";
It was enough to change the query and remove the links for sorting.
+++ b/styles/templates/game/page.battleHall.default.tpl
@@ -11,8 +11,8 @@
<tr>
<td>{$LNG.tkb_platz}</td>
<td>{$LNG.tkb_owners}</td>
- <td><a href="game.php?page=battleHall&order=date&sort={if $sort == "ASC"}DESC{else}ASC{/if}"{if $order == "date"} style="font-weight:bold;"{/if}>{$LNG.tkb_datum}</a></td>
- <td><a href="game.php?page=battleHall&order=units&sort={if $sort == "ASC"}DESC{else}ASC{/if}"{if $order == "units"} style="font-weight:bold;"{/if}>{$LNG.tkb_units}</a></td>
+ <td>{$LNG.tkb_datum}</td>
+ <td>{$LNG.tkb_units}</td>
https://github.com/steemnova/steemnova/pull/72
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Thank you!
Hey @vladimir-simovic, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!
ty for effort to improve.
Some new features will be soon :-)
Hey @dotevo I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x