showing alliance events in overview

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • showing alliance events in overview

      Hola me gustaría mostrar los eventos de la alianza en la visión general pero no di como hacer las llamadas a las funciones $ally_events por lo que me devuelve un error, alguna solución para esto
      VERY SAD :/ :/ :/ :/
    • Quieres ver todas las flotas en movimiento de la alianza en la vista general!!??

      Eso seria demasiado extenso y se vuelve complicado de entender cuando tienes 50 flotas volando de todos los miembros aliados.
    • я доделал практически то что вы описали ... палка в двух концах, если не правильно подойдете будет нагрузка лишняя на игру за счет постоянной проверки .. если подойти правильно то решать надо через ajax запросы
      Делаю качественно в сроки! на любой версии moons, встрою, или напишу любой мод , но дорого! afire-space.com
    • Es justo como dices. Puede representar una carga adicional al juego. La vista general es de las que mas ve el jugador.

      It is just as you say. It may represent an additional burden on the game. The general view is one of the most seen by the player.

      Это так, как вы говорите. Это может представлять дополнительную нагрузку на игру. Общий вид - один из самых видных для игрока.
    • in class.FlyingFleetsTable.php
      after

      PHP Source Code

      1. protected $missions = false;

      add

      PHP Source Code

      1. protected $allyId = null;


      after

      PHP Source Code

      1. public function setMissions($missions) {
      2. $this->missions = implode(',', array_filter(explode(',', $missions), 'is_numeric'));
      3. }

      add

      PHP Source Code

      1. public function setAlly($allyId) {
      2. $this->allyId = $allyId;
      3. }
      4. private function getAllyEvents() {
      5. $sql = 'SELECT ally_events FROM %%ALLIANCE%% WHERE id = :allianceId;';
      6. $allianceData = Database::get()->selectSingle($sql, array(
      7. ':allianceId' => $this->allyId
      8. ));
      9. return $allianceData['ally_events'];
      10. }
      11. private function getAllyMembers() {
      12. if($this->allyId !== null){
      13. $sql = 'SELECT id
      14. FROM %%USERS%%
      15. WHERE ally_id = :allyId;';
      16. $param = array(
      17. ':allyId' => $this->allyId
      18. );
      19. return Database::get()->select($sql, $param);
      20. }
      21. }
      Display All
      change


      PHP Source Code

      1. else {
      2. $where = 'fleet_owner = :userId OR (fleet_target_owner = :userId AND fleet_mission != 8)';
      3. $param = array(
      4. ':userId' => $this->userId,
      5. );
      6. }
      to


      PHP Source Code

      1. else {
      2. if($this->allyId !== null && $this->allyId != 0){
      3. $allyMembers = $this->getAllyMembers();
      4. $userIds = '';
      5. $allyEvents = $this->getAllyEvents();
      6. foreach($allyMembers as $member){
      7. if($member['id'] != $this->userId)
      8. $userIds .= ($userIds == '') ? $member['id'] : ','.$member['id'];
      9. }
      10. $where = '(fleet_owner IN ('.$userIds.') OR (fleet_target_owner IN ('.$userIds.') AND fleet_mission != 8)) AND fleet_mission IN ('.$allyEvents.')';
      11. $param = array(
      12. ':userIds' => $userIds,
      13. );
      14. }else{
      15. $where = 'fleet_owner = :userId OR (fleet_target_owner = :userId AND fleet_mission != 8)';
      16. $param = array(
      17. ':userId' => $this->userId,
      18. );
      19. }
      20. }
      Display All
      in ShowOverviewPage.class.php


      change private function GetFleets() to

      PHP Source Code

      1. private function GetFleets() {
      2. global $USER, $PLANET;
      3. require 'includes/classes/class.FlyingFleetsTable.php';
      4. $fleetTableObj = new FlyingFleetsTable;
      5. $fleetTableObj->setUser($USER['id']);
      6. $fleetTableObj->setPlanet($PLANET['id']);
      7. $fleets = $fleetTableObj->renderTable();
      8. $allyfleets = array();
      9. if($USER['ally_id'] != 0){
      10. $fleetTableObj->setAlly($USER['ally_id']);
      11. $allyfleets = $fleetTableObj->renderTable();
      12. }
      13. return array('fleets' => $fleets, 'allyfleets' => $allyfleets);
      14. }
      Display All


      in show function before

      PHP Source Code

      1. $this->assign(array(
      add


      PHP Source Code

      1. $events = $this->GetFleets();
      change


      PHP Source Code

      1. 'fleets' => this->GetFleets(),
      to


      PHP Source Code

      1. 'fleets' => $events['fleets'],
      2. 'Allyfleets' => $events['allyfleets'],
      in your lang package INGAME.php add


      PHP Source Code

      1. $LNG['ov_events_ally'] = 'События альянса';
      in page.overview.default.tpl

      after

      Smarty-Template

      1. <tr>
      2. <th colspan="3">{$LNG.ov_events}</th>
      3. </tr>
      4. {foreach $fleets as $index => $fleet}
      5. <tr>
      6. <td id="fleettime_{$index}" class="fleets" data-fleet-end-time="{$fleet.returntime}" data-fleet-time="{$fleet.resttime}">{pretty_fly_time({$fleet.resttime})}</td>
      7. <td colspan="2">{$fleet.text}</td>
      8. </tr>
      9. {/foreach}
      add


      Smarty-Template

      1. {if count($Allyfleets) > 0}
      2. <tr>
      3. <th colspan="3">{$LNG.ov_events_ally}</th>
      4. </tr>
      5. {foreach $Allyfleets as $index => $fleet}
      6. <tr>
      7. <td id="fleettime_{$index}" class="fleets" data-fleet-end-time="{$fleet.returntime}" data-fleet-time="{$fleet.resttime}">{pretty_fly_time({$fleet.resttime})}</td>
      8. <td colspan="2">{$fleet.text}</td>
      9. </tr>
      10. {/foreach}
      11. {/if}
      Display All