[MOD] Race/Class mod

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

    • tarta wrote:

      Yaro2709 wrote:

      tarta wrote:

      How can I add in the statistics and overview the race of the player? to give more functions to this mod.

      an example of the code to add it?
      Вывести столбец race из SQL. И привязать к $LNG.
      Большое спасибо, но применяйте его к языку, если знаю.Но что делать на SQL? Не могли бы вы привести мне пример?
      посмотри как сделано у меня в проекте. Суть не меняется.
    • Yaro2709 wrote:

      tarta wrote:

      Yaro2709 wrote:

      tarta wrote:

      How can I add in the statistics and overview the race of the player? to give more functions to this mod.

      an example of the code to add it?
      Вывести столбец race из SQL. И привязать к $LNG.
      Большое спасибо, но применяйте его к языку, если знаю.Но что делать на SQL? Не могли бы вы привести мне пример?
      посмотри как сделано у меня в проекте. Суть не меняется.
      Ваш проект очень хорош. Поздравляю.
      Я ясно понимаю, разница здесь в том, что вы используете xterium, а я - 2 ммона 1.7.
    • Я бы советовал перейти на 1.8. Всё мои моды на 1.8 есть и на 1.7. Только я их не публиковал)
      Я привык к xterium дизайну. Я в нем хорошо разбираюсь, даже лучше чем с бустрапом. Поэтому не хочу его менять. И да, я не делаю копию xterium-a.
    • tarta wrote:

      How can I add in the statistics and overview the race of the player? to give more functions to this mod.

      an example of the code to add it?


      Tu buscas algo así,

      PHP Source Code: ShowStaticsPage.class.php

      1. if ($config->stat == 2) {
      2. $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race , a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
      3. INNER JOIN %%USERS%% as u ON u.id = s.id_owner
      4. LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
      5. WHERE s.universe = :universe AND s.stat_type = 1 AND u.authlevel < :authLevel
      6. ORDER BY ".$Order." ASC LIMIT :offset, :limit;";
      7. $query = $db->select($sql, array(
      8. ':universe' => Universe::current(),
      9. ':authLevel'=> $config->stat_level,
      10. ':offset' => $start,
      11. ':limit' => 100,
      12. ));
      13. } else {
      14. $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race, a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
      15. INNER JOIN %%USERS%% as u ON u.id = s.id_owner
      16. LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
      17. WHERE s.universe = :universe AND s.stat_type = 1
      18. ORDER BY " . $Order . " ASC LIMIT :offset, :limit;";
      19. $query = $db->select($sql, array(
      20. ':universe' => Universe::current(),
      21. ':offset' => $start,
      22. ':limit' => 100,
      23. ));
      24. }
      Display All



      Agregas en el $sql ambas lineas u.race
      Mas abajo

      PHP Source Code

      1. $RangeList[] = array(

      Agregas

      PHP Source Code

      1. 'race' => $StatRow['race'],

      Entonces en el common.php o AbstractGamePage.class.php o GeneralFunctions.php

      agregas


      PHP Source Code

      1. function imageRace($razas)
      2. {
      3. if($razas==1)
      4. return '<img src="./styles/theme/gow/img/race1.jpg" class="tooltip" data-tooltip-content="Investigador">';
      5. if($razas==2)
      6. return '<img src="./styles/theme/gow/img/race2.jpg" class="tooltip" data-tooltip-content="Minero">';
      7. if($razas==3)
      8. return '<img src="./styles/theme/gow/img/race3.jpg" class="tooltip" data-tooltip-content="Guerrero">';
      9. if($razas==4)
      10. return '<img src="./styles/theme/gow/img/race4.jpg" class="tooltip" data-tooltip-content="Comerciante">';
      11. }
      Display All

      HTML Source Code: shared.statistics.playerTable.tpl

      1. <td class="rango_est position">{imageRace($RangeInfo.race)}</td>
      .rango_est img {
      width: 35px !important;
      height: 35px !important;
      }
      y listo tienes un resultado como el de la foto

      Espero que sea esto lo que busques. saludos
      FUNCIONA EN VERSION 2.0 en adelante
      VERY SAD :/ :/ :/ :/
    • goto language/xx/TECH.php
      add to $LNG['tech']

      Source Code

      1. 800 => 'classes',
      2. 802 => 'Miner',
      3. 803 => 'warrior',
      4. 801 => 'researcher',
      5. 804 => 'dealer',


      do that for every language
      now you can use
      $LNG["TECH"]["80" . $USER["race"]] in php

      and
      {$LNG["TECH"][$race]} in smarty, if you assinged it like that in the php class of the page you want to use it in

      Source Code

      1. $this->assign(array(
      2. "race" => "80" . $USER["race"],
      3. "raceimg" => "race" . $USER["race"]
      4. ));
      the assign line is mostly in the ende of the php file, if you want to use it in statistics, then the file would be includes\pages\game\ShowStatisticsPage.class.php

      for a picture you can now use following code in the *.tpl files, if you assinged "race" and "raceimg" before

      Source Code

      1. <img src="{$dpath}img/{$raceimg}.jpg" class="tooltip" data-tooltip-content="{$LNG['TECH'][$race]}">
    • yamilrh wrote:

      tarta wrote:

      How can I add in the statistics and overview the race of the player? to give more functions to this mod.

      an example of the code to add it?

      Tu buscas algo así,

      PHP Source Code: ShowStaticsPage.class.php

      1. if ($config->stat == 2) {
      2. $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race , a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
      3. INNER JOIN %%USERS%% as u ON u.id = s.id_owner
      4. LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
      5. WHERE s.universe = :universe AND s.stat_type = 1 AND u.authlevel < :authLevel
      6. ORDER BY ".$Order." ASC LIMIT :offset, :limit;";
      7. $query = $db->select($sql, array(
      8. ':universe' => Universe::current(),
      9. ':authLevel'=> $config->stat_level,
      10. ':offset' => $start,
      11. ':limit' => 100,
      12. ));
      13. } else {
      14. $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race, a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
      15. INNER JOIN %%USERS%% as u ON u.id = s.id_owner
      16. LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
      17. WHERE s.universe = :universe AND s.stat_type = 1
      18. ORDER BY " . $Order . " ASC LIMIT :offset, :limit;";
      19. $query = $db->select($sql, array(
      20. ':universe' => Universe::current(),
      21. ':offset' => $start,
      22. ':limit' => 100,
      23. ));
      24. }
      Display All


      Agregas en el $sql ambas lineas u.race
      Mas abajo

      PHP Source Code

      1. $RangeList[] = array(
      Agregas

      PHP Source Code

      1. 'race' => $StatRow['race'],
      Entonces en el common.php o AbstractGamePage.class.php o GeneralFunctions.php

      agregas


      PHP Source Code

      1. function imageRace($razas)
      2. {
      3. if($razas==1)
      4. return '<img src="./styles/theme/gow/img/race1.jpg" class="tooltip" data-tooltip-content="Investigador">';
      5. if($razas==2)
      6. return '<img src="./styles/theme/gow/img/race2.jpg" class="tooltip" data-tooltip-content="Minero">';
      7. if($razas==3)
      8. return '<img src="./styles/theme/gow/img/race3.jpg" class="tooltip" data-tooltip-content="Guerrero">';
      9. if($razas==4)
      10. return '<img src="./styles/theme/gow/img/race4.jpg" class="tooltip" data-tooltip-content="Comerciante">';
      11. }
      Display All

      HTML Source Code: shared.statistics.playerTable.tpl

      1. <td class="rango_est position">{imageRace($RangeInfo.race)}</td>
      .rango_est img {
      width: 35px !important;
      height: 35px !important;
      }
      y listo tienes un resultado como el de la foto

      Espero que sea esto lo que busques. saludos
      FUNCIONA EN VERSION 2.0 en adelante
      Funciono perfecto!! Muchas gracias.
      El error lo tenia principalmente en el llamado de la imagen y el aplicarlo al stat... Te agradezco por tu ayuda.
      El unico problema que persiste es que al agregar el u.race al Sql en la linea:

      $stats_sql = 'SELECT DISTINCT s.*, u.race, u.id, u.username, u.lang, u.ally_id, a.ally_name FROM '.STATPOINTS.' as s
      INNER JOIN '.USERS.' as u ON u.id = s.id_owner
      LEFT JOIN '.ALLIANCE.' as a ON a.id = s.id_ally
      WHERE s.`universe` = '.$UNI.' AND s.`stat_type` = 1 '.((Config::get('stat') == 2)?'AND u.`authlevel` < '.Config::get('stat_level').' ':'').'
      ORDER BY `'. $Order .'` ASC LIMIT '. $start .',100;';


      Me da un error al consultar las estadisticas por contrucciones o flotas o investigaciones y me dice:

      SQL Error: Unknown column 'u.race' in 'field list'

      Query Code: SELECT DISTINCT s.*, u.race, a.id, a.ally_members, a.ally_name FROM uni1_statpoints as s INNER JOIN uni1_alliance as a ON a.id = s.id_owner WHERE `universe` = 1 AND `stat_type` = 2 ORDER BY `total_rank` ASC LIMIT 0,100;

      Por todo lo demas si funciona.. solo tengo ese error. que de seguro es porque no esta en la DB
    • tarta wrote:

      Disculpen, estuve algo ocupado y no pude responder.
      Race esta en la DB uni_user pero lo raro es que me salte ese erro al añadir en la lista Query Code.
      Aun no lo soluciono.
      Muestra tu error, para ver si te pueden ayudar. Saludos
      VERY SAD :/ :/ :/ :/