Steemnova bugfixing pack (Marketplace + wrong page)

in #utopian-io7 years ago (edited)

Bug Fixes

Requested resource can be empty

Description: Utopian

I've added additional checking:

diff --git a/includes/pages/game/ShowFleetStep3Page.class.php b/includes/pages/game/ShowFleetStep3Page.class.php
index affa8cd..60e1a46 100644
--- a/includes/pages/game/ShowFleetStep3Page.class.php
+++ b/includes/pages/game/ShowFleetStep3Page.class.php
@@ -96,6 +96,14 @@ class ShowFleetStep3Page extends AbstractGamePage
                        )));
                }
 
+               if ($targetMission == 16 && $WantedResourceAmount < 1)
+               {
+                       $this->printMessage($LNG['fl_no_noresource'], array(array(
+                               'label' => $LNG['sys_back'],
+                               'url'   => 'game.php?page=fleet2'
+                       )));
+               }
+

Wrong time for fleet return

Description: When you click the return from planet where fleet is standing the return time is equal fly time + on_hold status. So If the offer is on the market 10h fleet return time will be to long (+ 10hours).

Fix is changing the type of return time calculation.

diff --git a/includes/classes/class.FleetFunctions.php b/includes/classes/class.FleetFunctions.php
index 1d72ed3..b57fa8e 100644
--- a/includes/classes/class.FleetFunctions.php
+++ b/includes/classes/class.FleetFunctions.php
@@ -365,7 +365,7 @@ class FleetFunctions
                        }
                }
 
-               if($fleetResult['fleet_mission'] == 5 && $fleetResult['fleet_mess'] == FLEET_HOLD) {
+               if(($fleetResult['fleet_mission'] == 5 || $fleetResult['fleet_mission'] == 16) && $fleetResult['fleet_mess'] == FLEET_HOLD) {
                        $fleetEndTime   = ($fleetResult['fleet_start_time'] - $fleetResult['start_time']) + TIMESTAMP;
                }else{
                        $fleetEndTime   = (TIMESTAMP - $fleetResult['start_time']) + TIMESTAMP;

Return button is not working for transport after trading

Description: When you click to "return" button nothing happens.

Solution. Work as designed because you should not have possibility to return the fleet in this case. But button should be removed.

I've added the field to template

@@ -230,11 +230,12 @@ class ShowFleetTablePage extends AbstractGamePage
                        {
                                $returnTime     = $fleetsRow['fleet_end_time'];
                        }
-                       
+
                        $FlyingFleetList[]      = array(
                                'id'                    => $fleetsRow['fleet_id'],
                                'mission'               => $fleetsRow['fleet_mission'],
                                'state'                 => $fleetsRow['fleet_mess'],
+                               'no_returnable'                 => $fleetsRow['fleet_no_m_return'],
                                'startGalaxy'   => $fleetsRow['fleet_start_galaxy'],
                                'startSystem'   => $fleetsRow['fleet_start_system'],
                                'startPlanet'   => $fleetsRow['fleet_start_planet'],
@@ -249,21 +250,21 @@ class ShowFleetTablePage extends AbstractGamePage
                                'FleetList'             => $FleetList[$fleetsRow['fleet_id']],
                        );

And conditional in template

--- a/styles/templates/game/page.fleetTable.default.tpl
+++ b/styles/templates/game/page.fleetTable.default.tpl
@@ -39,7 +39,7 @@
        {/if}
        <td id="fleettime_{$smarty.foreach.FlyingFleets.iteration}" class="fleets" data-fleet-end-time="{$FlyingFleetRow.returntime}" data-fleet-time="{$FlyingFleetRow.resttime}">{pretty_fly_time({$FlyingFleetRow.resttime})}</td>
        <td>
-       {if !$isVacation && $FlyingFleetRow.state != 1}
+       {if !$isVacation && $FlyingFleetRow.state != 1 && $FlyingFleetRow.no_returnable != 1}^M
                <form action="game.php?page=fleetTable&amp;action=sendfleetback" method="post">
                <input name="fleetID" value="{$FlyingFleetRow.id}" type="hidden">
                <input value="{$LNG.fl_send_back}" type="submit">
@@ -115,7 +115,7 @@
        {if $maxFleetSlots != $activeFleetSlots}
        <tr style="height:20px;"><td colspan="4"><input type="submit" value="{$LNG.fl_continue}"></td>
        {/if}

Market is ugly

Zrzut ekranu z 2018-03-15 22-56-45.png

@mys projected the new UI and I've implemented it

Zrzut ekranu z 2018-03-15 23-06-46.png

<table style="width:50%">
    <tr>
-       <th colspan="2">
-           Options
+       <th colspan="2" class="center">
+           {$LNG.market_info_header}
        </th>
    </tr>
+   <tr>
+       <td colspan="2">
+           {$LNG.market_info_description}
+       </td>
+   </tr>
    <tr>
        <td>
-           Ship type as first:
+           {$LNG.market_ship_as_first}
        </td>
        <td>
            <select id="shipT">
@@ -37,18 +42,34 @@
 {/if}
 <table id="tradeList" style="width:50%;white-space: nowrap;" class="tablesorter">
    <thead>
+       <tr class="no-background no-border center">
+           <th></th>
+           <th></th>
+           <th><img src="./styles/theme/nova/images/metal.gif"/></th>
+           <th><img src="./styles/theme/nova/images/crystal.gif"/></th>
+           <th><img src="./styles/theme/nova/images/deuterium.gif"/></th>
+           <th></th>
+           <th></th>
+           <th></th>
+           <th></th>
+           <th></th>
+           <th class="LC" style="display: none;"></th>
+           <th class="HC"></th>
+           <th></th>
+       </tr>
        <tr>
            <th>ID</th>
            <th>{$LNG['gl_player']}</th>
            <th>{$LNG['tech'][901]}</th>
            <th>{$LNG['tech'][902]}</th>
            <th>{$LNG['tech'][903]}</th>
            <th>{$LNG.market_p_total}</th>
+           <th>{$LNG.market_p_end}</th>
+           <th  class="no-background no-border center">-></th>
            <th>{$LNG.market_p_cost_type}</th>
            <th>{$LNG.market_p_cost_amount}</th>
-           <th>{$LNG.market_p_end}</th>
            <th>{$LNG.market_p_from_duration}</th>
-           <th class="LC">{$LNG.market_p_to_duration}</th>
+           <th class="LC" style="display: none;">{$LNG.market_p_to_duration}</th>
            <th class="HC">{$LNG.market_p_to_duration}</th>
            <th>{$LNG.market_p_buy}</th>
        </tr>
@@ -59,15 +80,24 @@
    <tr>
        <td>{$smarty.foreach.FlyingFleets.iteration}</td>
        <td>{$FlyingFleetRow.username}</td>
-       <td>{$FlyingFleetRow.fleet_resource_metal}</td>
-       <td>{$FlyingFleetRow.fleet_resource_crystal}</td>
-       <td>{$FlyingFleetRow.fleet_resource_deuterium}</td>
-       <td>{$FlyingFleetRow.total}</td>
-       <td>{$FlyingFleetRow.fleet_wanted_resource}</td>
-       <td>{$FlyingFleetRow.fleet_wanted_resource_amount}</td>
+       <td class="resource_metal">{$FlyingFleetRow.fleet_resource_metal|number}</td>
+       <td class="resource_crystal">{$FlyingFleetRow.fleet_resource_crystal|number}</td>
+       <td class="resource_deuterium">{$FlyingFleetRow.fleet_resource_deuterium|number}</td>
+       <td>{$FlyingFleetRow.total|number}</td>
        <td data-time="{$FlyingFleetRow.end}">{pretty_fly_time({$FlyingFleetRow.end})}</td>
+       <td class="no-background no-border">
+           {if $FlyingFleetRow.fleet_wanted_resource_id == 1}
+           <img src="./styles/theme/nova/images/metal.gif"/>
+           {elseif $FlyingFleetRow.fleet_wanted_resource_id == 2}
+           <img src="./styles/theme/nova/images/crystal.gif"/>
+           {elseif $FlyingFleetRow.fleet_wanted_resource_id == 3}
+           <img src="./styles/theme/nova/images/deuterium.gif"/>
+           {/if}
+       </td>
+       <td class="wanted-resource-{$FlyingFleetRow.fleet_wanted_resource_id}">{$FlyingFleetRow.fleet_wanted_resource}</td>
+       <td class="wanted-resource-amount">{$FlyingFleetRow.fleet_wanted_resource_amount|number}</td>
        <td>{pretty_fly_time({$FlyingFleetRow.from_duration})}</td>
-       <td class="LC">{pretty_fly_time({$FlyingFleetRow.to_lc_duration})}</td>
+       <td class="LC" style="display: none;">{pretty_fly_time({$FlyingFleetRow.to_lc_duration})}</td>
        <td class="HC">{pretty_fly_time({$FlyingFleetRow.to_hc_duration})}</td>
        <td><form class="market_form" action="game.php?page=marketPlace&amp;action=buy" method="post">
        <input name="fleetID" value="{$FlyingFleetRow.id}" type="hidden">
@@ -102,7 +132,7 @@ $('#shipT').on('change', function (e) {
 $('#shipT').trigger("change");
 
 $(".market_form").submit( function() {
-   var c = confirm("Are you sure?");
+   var c = confirm({$LNG.market_confirm_are_you_sure});
    if (c) {
        $(this).append('<input type="hidden" name="shipType" value="' + $("#shipT").val() + '">')
    }

Part of the https://github.com/steemnova/steemnova/pull/59/files

Fleet menu: Wrong transport mission bug

https://utopian.io/utopian-io/@barbarossastudio/fleet-menu-wrong-transport-mission-bug

I've fixed typos in the page names.

        $this->printMessage($LNG['fl_error_same_planet'], array(array(
                'label' => $LNG['sys_back'],
-               'url'   => 'game.php?page=fleet1'
+               'url'   => 'game.php?page=fleetStep1'
            )));
        }
 
@@ -84,15 +84,23 @@ public function show()
            ($targetType !== 1 && $targetType !== 2 && $targetType !== 3)) {
            $this->printMessage($LNG['fl_invalid_target'], array(array(
                'label' => $LNG['sys_back'],
-               'url'   => 'game.php?page=fleet1'
+               'url'   => 'game.php?page=fleetStep1'
            )));
        }
 
        if (($targetMission == 3 || $targetMission == 16)&& $TransportMetal + $TransportCrystal + $TransportDeuterium < 1)
        {
            $this->printMessage($LNG['fl_no_noresource'], array(array(
                'label' => $LNG['sys_back'],
-               'url'   => 'game.php?page=fleet2'
+               'url'   => 'game.php?page=fleetStep2'
+           )));
+       }
+
+       if ($targetMission == 16 && $WantedResourceAmount < 1)
+       {
+           $this->printMessage($LNG['fl_no_noresource_exchange'], array(array(
+               'label' => $LNG['sys_back'],
+               'url'   => 'game.php?page=fleetStep2'
            )));
        }
 
@@ -139,14 +147,14 @@ public function show()
            if (!empty($targetPlanetData)) {
                $this->printMessage($LNG['fl_target_exists'], array(array(
                    'label' => $LNG['sys_back'],
-                   'url'   => 'game.php?page=fleet1'
+                   'url'   => 'game.php?page=fleetStep1'
                )));
            }
 
            if ($targetType != 1) {
                $this->printMessage($LNG['fl_only_planets_colonizable'], array(array(
                    'label' => $LNG['sys_back'],
-                   'url'   => 'game.php?page=fleet1'
+                   'url'   => 'game.php?page=fleetStep1'
                )));
            }
        }
@@ -160,14 +168,14 @@ public function show()
            if ($targetPlanetData["destruyed"] != 0) {
                $this->printMessage($LNG['fl_no_target'], array(array(
                    'label' => $LNG['sys_back'],
-                   'url'   => 'game.php?page=fleet1'
+                   'url'   => 'game.php?page=fleetStep1'
                )));
            }
 
            if (empty($targetPlanetData)) {
                $this->printMessage($LNG['fl_no_target'], array(array(
                    'label' => $LNG['sys_back'],
-                   'url'   => 'game.php?page=fleet1'
+                   'url'   => 'game.php?page=fleetStep1'
                )));
            }
        }
@@ -238,7 +246,7 @@ public function show()
        {
            $this->printMessage($LNG['fl_empty_target'], array(array(
                'label' => $LNG['sys_back'],
-               'url'   => 'game.php?page=fleet1'
+               'url'   => 'game.php?page=fleetStep1'
            )));
        }
 
@@ -255,14 +263,14 @@ public function show()
        if (!in_array($targetMission, $availableMissions['MissionSelector'])) {
            $this->printMessage($LNG['fl_invalid_mission'], array(array(
                'label' => $LNG['sys_back'],
-               'url'   => 'game.php?page=fleet2'
+               'url'   => 'game.php?page=fleetStep2'
            )));
        }
 
        if ($targetMission != 8 && IsVacationMode($targetPlayerData)) {
            $this->printMessage($LNG['fl_target_exists'], array(array(
                'label' => $LNG['sys_back'],
-               'url'   => 'game.php?page=fleet1'
+               'url'   => 'game.php?page=fleetStep1'
            )));
        }

Part of the https://github.com/steemnova/steemnova/pull/59/files

Translation fallback to en

Many languages do not have all strings translated. Instead of english text you can see IDs
Zrzut ekranu z 2018-03-15 23-09-47.png

I've added including the en files before the selected.

public function includeData($files)
    {
        // Fixed BOM problems.
        ob_start();
        $LNG    = array();
 
+       //FALLBACK
+       $path   = 'language/en/';
+        foreach($files as $file) {
+           $filePath   = $path.$file.'.php';
+           if(file_exists($filePath))
+           {
+               require $filePath;
+           }
+       }
+
+       //LANGUAGE
        $path   = 'language/'.$this->getLanguage().'/';

https://github.com/steemnova/steemnova/pull/61/files



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Very fast! Thank you :)

Hey @codingdefined, 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!

Hey @dotevo I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

this is a wonderfull , awesom