[MOD] share spy report v1.8, v2.0

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

    • [MOD] share spy report v1.8, v2.0

      Compatible con 2Moons 1.8 en adelante
      Es para que ustedes puedan compartir con sus miembros de la Alianza o algún Amigo un reporte de espionaje que ustedes desean.
      Función:
      Usted puede compartir un Reporte de Espionaje a todos los miembros de tu alianza, a un miembro específico de tu alianza o a un amigo
      ¿Cómo puedo compartir dicho espionaje?
      Una vez tu tengas el reporte de espionaje verás algo como lo siguiente imagen

      Le damos click a ese icono y les aparecerá algo como la siguiente imagen

      Luego seleccionas si quieres compartir el Reporte de Espionaje con un amigo, o con los miembros de la alianza, le das al botón OK y les saldrá un mensaje como la siguiente imagen


      Resultado


      Añadir

      PHP Source Code: ShowMessagesPage.class.php

      1. function SRTFshow()
      2. {
      3. global $USER, $LNG;
      4. $this->setWindow('popup');
      5. $this->initTemplate();
      6. $RaportID = HTTP::_GP('RaportID', 0);
      7. $AllyFriends = array();
      8. $BuddyFriends = array();
      9. if($USER['ally_id'] != 0){
      10. $db = Database::get();
      11. $sql = 'SELECT * FROM %%USERS%% WHERE ally_id = :allianceId AND id != :userId;';
      12. $AllyFriend = $db->select($sql, array(
      13. ':allianceId' => $USER['ally_id'],
      14. ':userId' => $USER['id']
      15. ));
      16. foreach($AllyFriend as $friend){
      17. $AllyFriends[] = array(
      18. 'friendId' => $friend['id'],
      19. 'friendUsername' => empty($friend['username']) ? $friend['username'] : $friend['username'],
      20. );
      21. }
      22. }
      23. $sql = "SELECT sender, owner FROM %%BUDDY%% WHERE (sender = :userID AND buddyType = 1 AND isAccepted = 1) OR (owner = :userID AND buddyType = 1 AND isAccepted = 1);";
      24. $Friends = database::get()->select($sql, array(
      25. ':userID' => $USER['id']
      26. ));
      27. foreach($Friends as $friend){
      28. $idToChoose = $friend['sender'];
      29. if($idToChoose == $USER['id'])
      30. $idToChoose = $friend['owner'];
      31. $sql = 'SELECT username FROM %%USERS%% WHERE id = :userId;';
      32. $AllyFriend = database::get()->selectSingle($sql, array(
      33. ':userId' => $idToChoose,
      34. ));
      35. $isNew = 1;
      36. foreach($AllyFriends as $AllyFriendin){
      37. if($AllyFriendin['friendId'] == $idToChoose)
      38. $isNew = 0;
      39. }
      40. if($isNew == 1){
      41. $AllyFriends[] = array(
      42. 'friendId' => $idToChoose,
      43. 'friendUsername' => empty($AllyFriend['username']) ? $AllyFriend['username'] : $AllyFriend['username'],
      44. );
      45. }
      46. }
      47. $this->tplObj->loadscript('message.js');
      48. $this->assign(array(
      49. 'RaportID' => $RaportID,
      50. 'AllyFriends' => $AllyFriends,
      51. 'BuddyFriends' => $BuddyFriends,
      52. 'allyidf' => $USER['ally_id'],
      53. ));
      54. $this->display('page.srtfshow.view.tpl');
      55. }
      56. function SpyRaportToFreind()
      57. {
      58. global $USER, $LNG;
      59. $this->setWindow('popup');
      60. $this->initTemplate();
      61. $RaportID = HTTP::_GP('RaportID', 0);
      62. $FriendID = HTTP::_GP('FriendID', "", UTF8_SUPPORT);
      63. $ally = HTTP::_GP('ally', "", UTF8_SUPPORT);
      64. if($FriendID == ""){
      65. $this->sendJSON($LNG['msg_ms_4']);
      66. }elseif($FriendID == "ally" && $USER['ally_id'] != 0){
      67. $db = Database::get();
      68. $sql = 'SELECT * FROM %%USERS%% WHERE ally_id = :allianceId AND id != :userId;';
      69. $AllyFriend = $db->select($sql, array(
      70. ':allianceId' => $USER['ally_id'],
      71. ':userId' => $USER['id']
      72. ));
      73. foreach($AllyFriend as $friend){
      74. $sql = 'SELECT * FROM %%MESSAGES%% WHERE message_id = :RaportID && message_owner = :message_owner;';
      75. $msgInfo = $db->selectSingle($sql, array(
      76. ':RaportID' => $RaportID,
      77. ':message_owner' => $USER['id']
      78. ));
      79. PlayerUtil::sendMessage($friend['id'], $USER['id'], $USER['username'], 2, $msgInfo['message_subject'], $msgInfo['message_text'], TIMESTAMP, NULL, 1, Universe::getEmulated());
      80. }
      81. $this->sendJSON($LNG['msg_ms_3']);
      82. }elseif($FriendID > 0){
      83. $db = Database::get();
      84. $sql = 'SELECT * FROM %%MESSAGES%% WHERE message_id = :RaportID && message_owner = :message_owner;';
      85. $msgInfo = $db->selectSingle($sql, array(
      86. ':RaportID' => $RaportID,
      87. ':message_owner' => $USER['id']
      88. ));
      89. PlayerUtil::sendMessage($FriendID, $USER['id'], $USER['username'], 1, $msgInfo['message_subject'], $msgInfo['message_text'], TIMESTAMP, NULL, 1, Universe::getEmulated());
      90. $this->sendJSON($LNG['msg_ms_3']);
      91. }else{
      92. $this->sendJSON($LNG['msg_ms_4']);
      93. }
      94. }
      Display All




      Añadir

      JavaScript Source Code: message.js

      1. function SRTF(RaportID)
      2. {
      3. var Name = $('#upgrade_name').val();
      4. ally = '';
      5. if(Name == 'ally')
      6. ally = 'ally';
      7. $.post("game.php?page=messages", {'mode': 'SpyRaportToFreind', 'RaportID': RaportID, 'FriendID': Name, 'ally': ally, 'ajax': 1}, function(data)
      8. {
      9. $('.ally_contents').text(data);
      10. setTimeout(function(){ parent.$.fancybox.close();}, 2000);
      11. }, "json");
      12. }
      Display All
      Añadir styles\templates\game
      page.srtfshow.view.tpl

      Agregar en page.message.view.tpl

      Luego de

      HTML Source Code

      1. {if $MessID != 999}<input name="messageID[{$Message.id}]" value="1" type="checkbox">{/if}

      Esto

      HTML Source Code

      1. {if $MessID == 0 || $MessID == 3 || $MessID == 199 && $Message.oldType == 0 || $MessID == 199 && $Message.oldType == 3}
      2. <br>
      3. <a class="tooltip" data-tooltip-content="{$LNG.mg_re}" onclick="return Dialog.SRTF({$Message.id})"><i class="fas fa-share-square"></i></a>
      4. {/if}

      Traducción al español

      Source Code

      1. //MESSAGES
      2. $LNG['msg_remove'] = 'Eliminar';
      3. $LNG['msg_ms_1'] = 'Seleccione el destino';
      4. $LNG['msg_ms_2'] = 'Todos los jugadores de la alianza';
      5. $LNG['msg_ms_3'] = 'Mensaje enviado.';
      6. $LNG['msg_ms_4'] = 'No se encuentra el destino.';
      7. $LNG['mg_re'] = 'Reenviar Mensaje';
      Espero que sea de su agrado. Saludos
      Files
      VERY SAD :/ :/ :/ :/
    • Si quieren agregar este MOD a la version 1.8.git, después que hagan los pasos anteriores deben completar su MOD con estas líneas de códigos.

      En el archivo Js ubicado en scripts/game/base.js

      Buscar la variable Dialog y agregar esta línea de código:

      PHP Source Code: base.js

      1. SRTF: function(ID) {
      2. return Dialog.open('game.php?page=messages&mode=SRTFshow&RaportID='+ID, 400, 130);
      3. },

      Luego solo deben agregar estas columnas a la tabla uni1_buddy:

      SQL-Query: sql

      1. ALTER TABLE uni1_buddy ADD buddyType TINYINT(3) NOT NULL DEFAULT '1' AFTER universe, ADD isAccepted TINYINT(3) NOT NULL DEFAULT '0' AFTER buddyType;

      Con esto ya tienen para que les funcione en la versión 1.8.git

      Recuerden borrar cache.
      Images
      • photo_2023-07-29_01-00-35.jpg

        65.21 kB, 1,280×648, viewed 72 times

      The post was edited 2 times, last by tellez: Solucion de errores en 1.8.git ().