[MOD][V2.8.1] Adding PlayerCard Achievements

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

  • [MOD][V2.8.1] Adding PlayerCard Achievements

    I want to make an achievements region in the Player Card Area I want to show which achievement the player has done in the game, in short, I want to show the achievements area in the player card area

    The post was edited 1 time, last by Zeus ().

  • Okay, here's what to do (Design the New star)

    Search

    PHP Source Code: ShowPlayerCardPage.class.php

    1. global $USER, $LNG;
    Replace By

    PHP Source Code: ShowPlayerCardPage.class.php

    1. global $USER, $LNG, $reslist, $PLANET, $pricelist, $resource;
    Search

    PHP Source Code: ShowPlayerCardPage.class.php

    1. $sql = "SELECT
    2. u.username, u.galaxy, u.system, u.planet, u.wons, u.loos, u.draws, u.lostunits, u.desunits, u.ally_id, u.timezone, u.foto,
    3. p.name,
    4. s.tech_rank, s.tech_points, s.build_rank, s.build_points, s.defs_rank, s.defs_points, s.fleet_rank, s.fleet_points, s.total_rank, s.total_points,
    5. a.ally_name
    6. FROM %%USERS%% u
    7. INNER JOIN %%PLANETS%% p ON p.id = u.id_planet
    8. LEFT JOIN %%STATPOINTS%% s ON s.id_owner = u.id AND s.stat_type = 1
    9. LEFT JOIN %%ALLIANCE%% a ON a.id = u.ally_id
    10. WHERE u.id = :playerID AND u.universe = :universe;";
    Replace by

    PHP Source Code: ShowPlayerCardPage.class.php

    1. $sql = "SELECT
    2. u.*,
    3. p.name,
    4. s.tech_rank, s.tech_points, s.build_rank, s.build_points, s.defs_rank, s.defs_points, s.fleet_rank, s.fleet_points, s.total_rank, s.total_points,
    5. a.ally_name
    6. FROM %%USERS%% u
    7. INNER JOIN %%PLANETS%% p ON p.id = u.id_planet
    8. LEFT JOIN %%STATPOINTS%% s ON s.id_owner = u.id AND s.stat_type = 1
    9. LEFT JOIN %%ALLIANCE%% a ON a.id = u.ally_id
    10. WHERE u.id = :playerID AND u.universe = :universe;";
    Addon

    PHP Source Code: ShowPlayerCardPage.class.php

    1. $achievementsList = array();
    2. if (isModuleAvailable(MODULE_ACHIEVEMENTS)) {
    3. foreach ($reslist['achievements'] as $Element) {
    4. $techTreeList = BuildFunctions::requirementsList($query, $PLANET, $Element);
    5. $elementBonus = BuildFunctions::getAvalibleBonus($Element);
    6. $achievementsList[$Element] = array(
    7. 'level' => $query[$resource[$Element]],
    8. 'maxLevel' => $pricelist[$Element]['max'],
    9. 'factor' => $pricelist[$Element]['factor'],
    10. 'elementBonus' => $elementBonus,
    11. 'AllTech' => $techTreeList,
    12. 'techacc' => BuildFunctions::isTechnologieAccessible($query, $PLANET, $Element, array()),
    13. );
    14. }
    15. }
    Display All
    Search

    Source Code: ShowPlayerCardPage.class.php

    1. 'ava' => $query['foto'],
    Addon

    PHP Source Code: ShowPlayerCardPage.class.php

    1. 'achievementsList' => $achievementsList,
    Addon in TPL

    Smarty-Template: page.playerCard.default.tpl

    1. <div class="col-12">
    2. <div class="card background-border-black-blue shadow">
    3. <div class="card-body">
    4. <p class="card-title text-align-center">Achievements</p>
    5. <div class="row">
    6. {foreach $achievementsList as $ID => $Element}
    7. <div
    8. class="col-2"
    9. style="text-align: center; margin-bottom: 10px"
    10. >
    11. <div>
    12. <a href="#" onclick="return Dialog.info({$ID})"
    13. ><img
    14. src="{$dpath}gebaeude/{$ID}.gif"
    15. alt="{$LNG.tech.{$ID}}"
    16. width="50px"
    17. /></a>
    18. </div>
    19. <div>
    20. <font class="gov6"
    21. >{$Element.level}/{$Element.maxLevel}</font
    22. >
    23. </div>
    24. </div>
    25. {/foreach}
    26. </div>
    27. </div>
    28. </div>
    29. </div>
    Display All

    enjoy :D

    The post was edited 1 time, last by Danter14: Addon code ().

  • OK, I have integrated it, there is only one thing that needs to be done here, for example, my achievements are all completed, but when I look at another profile, my achievements appear, how else to do it for this, everyone should show the level of achievements they have made, is it possible to do this?