Schrotthändler werden keine gebühren berechnet

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

    • Schrotthändler werden keine gebühren berechnet

      Moin,

      Beim Schrotthändler werden keine Händlergebühren berechnet obwohl es im Admin menü eingestellt ist.
      ich habe es auch schon angepasst hier meine Show Trader Page.Vieleicht kann mir da wer helfen ich komme nihct drauf.

      No dealer fees are charged at the scrap dealer, although it is set in the admin menu.I've already adjusted it here on my Show Trader Page. Maybe someone can help me there, I can't figure it out.

      PHP Source Code

      1. <?php
      2. /**
      3. * 2Moons
      4. * by Jan-Otto Kröpke 2009-2016
      5. *
      6. * For the full copyright and license information, please view the LICENSE
      7. *
      8. * @package 2Moons
      9. * @author Jan-Otto Kröpke <slaver7@gmail.com>
      10. * @copyright 2009 Lucky
      11. * @copyright 2016 Jan-Otto Kröpke <slaver7@gmail.com>
      12. * @licence MIT
      13. * @version 1.8.0
      14. * @link https://github.com/jkroepke/2Moons
      15. */
      16. class ShowTraderPage extends AbstractGamePage
      17. {
      18. public static $requireModule = MODULE_TRADER;
      19. function __construct()
      20. {
      21. parent::__construct();
      22. }
      23. public static $Charge = array(
      24. 901 => array(901 => 1, 902 => 2, 903 => 4),
      25. 902 => array(901 => 0.5, 902 => 1, 903 => 2),
      26. 903 => array(901 => 0.25, 902 => 0.5, 903 => 1),
      27. );
      28. public function show()
      29. {
      30. global $LNG, $USER, $resource;
      31. $darkmatter_cost_trader = Config::get()->darkmatter_cost_trader;
      32. $this->assign(array(
      33. 'tr_cost_dm_trader' => sprintf($LNG['tr_cost_dm_trader'], pretty_number($darkmatter_cost_trader), $LNG['tech'][921]),
      34. 'charge' => self::$Charge,
      35. 'resource' => $resource,
      36. 'requiredDarkMatter' => $USER['darkmatter'] < $darkmatter_cost_trader ? sprintf($LNG['tr_not_enought'], $LNG['tech'][921]) : false,
      37. ));
      38. $this->display("page.trader.default.tpl");
      39. }
      40. function trade()
      41. {
      42. global $USER, $LNG;
      43. if ($USER['darkmatter'] < Config::get()->darkmatter_cost_trader) {
      44. $this->redirectTo('game.php?page=trader');
      45. }
      46. $resourceID = HTTP::_GP('resource', 0);
      47. if(!in_array($resourceID, array_keys(self::$Charge))) {
      48. $this->printMessage($LNG['invalid_action'], array(array(
      49. 'label' => $LNG['sys_back'],
      50. 'url' => 'game.php?page=trader'
      51. )));
      52. }
      53. $tradeResources = array_values(array_diff(array_keys(self::$Charge[$resourceID]), array($resourceID)));
      54. $this->tplObj->loadscript("trader.js");
      55. $this->assign(array(
      56. 'tradeResourceID' => $resourceID,
      57. 'tradeResources' => $tradeResources,
      58. 'charge' => self::$Charge[$resourceID],
      59. ));
      60. $this->display('page.trader.trade.tpl');
      61. }
      62. function send()
      63. {
      64. global $USER, $PLANET, $LNG, $resource;
      65. if ($USER['darkmatter'] < Config::get()->darkmatter_cost_trader) {
      66. $this->redirectTo('game.php?page=trader');
      67. }
      68. $resourceID = HTTP::_GP('resource', 0);
      69. if(!in_array($resourceID, array_keys(self::$Charge))) {
      70. $this->printMessage($LNG['invalid_action'], array(array(
      71. 'label' => $LNG['sys_back'],
      72. 'url' => 'game.php?page=trader'
      73. )));
      74. }
      75. $getTradeResources = HTTP::_GP('trade', array());
      76. $tradeResources = array_values(array_diff(array_keys(self::$Charge[$resourceID]), array($resourceID)));
      77. $tradeSum = 0;
      78. $sum=0;
      79. foreach($tradeResources as $tradeRessID)
      80. {
      81. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      82. $sum+= $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      83. }
      84. if($sum>$PLANET[$resource[$resourceID]])
      85. {
      86. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      87. 'label' => $LNG['sys_back'],
      88. 'url' => 'game.php?page=trader'
      89. )));
      90. }
      91. $sum=0;
      92. foreach($tradeResources as $tradeRessID)
      93. {
      94. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      95. $sum+= $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      96. }
      97. if($sum>$PLANET[$resource[$resourceID]])
      98. {
      99. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      100. 'label' => $LNG['sys_back'],
      101. 'url' => 'game.php?page=trader'
      102. )));
      103. }
      104. foreach($tradeResources as $tradeRessID)
      105. {
      106. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      107. if(empty($tradeAmount) || !isset(self::$Charge[$resourceID][$tradeRessID]))
      108. {
      109. continue;
      110. }
      111. if(isset($PLANET[$resource[$resourceID]]))
      112. {
      113. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      114. if($usedResources > $PLANET[$resource[$resourceID]])
      115. {
      116. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      117. 'label' => $LNG['sys_back'],
      118. 'url' => 'game.php?page=trader'
      119. )));
      120. }
      121. else
      122. {
      123. $tradeSum += $tradeAmount;
      124. $PLANET[$resource[$resourceID]] -= $usedResources;
      125. }
      126. }
      127. elseif(isset($USER[$resource[$resourceID]]))
      128. {
      129. if($resourceID == 921)
      130. {
      131. $USER[$resource[$resourceID]] -= Config::get()->darkmatter_cost_trader;
      132. }
      133. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      134. if($usedResources > $USER[$resource[$resourceID]])
      135. {
      136. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      137. 'label' => $LNG['sys_back'],
      138. 'url' => 'game.php?page=trader'
      139. )));
      140. }
      141. else
      142. {
      143. $tradeSum += $tradeAmount;
      144. $USER[$resource[$resourceID]] -= $usedResources;
      145. }
      146. if($resourceID == 921)
      147. {
      148. $USER[$resource[$resourceID]] += Config::get()->darkmatter_cost_trader;
      149. }
      150. }
      151. else
      152. {
      153. throw new Exception('Unknown resource ID #'.$resourceID);
      154. }
      155. if(isset($PLANET[$resource[$tradeRessID]]))
      156. {
      157. $PLANET[$resource[$tradeRessID]] += $tradeAmount;
      158. }
      159. elseif(isset($USER[$resource[$tradeRessID]]))
      160. {
      161. $USER[$resource[$tradeRessID]] += $tradeAmount;
      162. }
      163. else
      164. {
      165. throw new Exception('Unknown resource ID #'.$tradeRessID);
      166. }
      167. }
      Display All

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

    • The fees are calculated. That works, thanks for that, but no 1500 DM are calculated as set in the admin panel. Do I have to set this separately in the file? Thank you for your trouble
    • For my par when I but in my panel 1000 DM of fees he deducts me 1000 after each exchange, if I ui but 500 he deducts me well 500 DM
      Images
      • Screenshot_12.jpg

        49.01 kB, 880×120, viewed 206 times
    • Ah yes but you are no longer on the same system, low no it is normal to have 0 in DM because none of your ships needs it for their construction so it cannot give you the panel first is for the cost of trading resources and not for the junkyard.
    • I know, but the dealer demands a fee of 1500 so that you can call him. He takes his fee from the ship value, that works, but I can set in the admin panel that the player has to pay 1500 DM so that he can call the dealer
    • i Found This

      yamilrh wrote:

      En el mercader de recursos existen 2 errores.
      1- Cuando tu vas a cambiar 1 recurso pones a cambiar mas recurso del que tengas en tu planeta, cuando le das cambiar este te devuelve un error, te cambia los recursos pero no te cobra materia oscura.
      2- Cuando tu vas a cambiar 2 recursos pones a cambiar mas recursos del que tengas en tu planeta, cuando le das cambiar este te devuelve un error, te cambia los recursos pero no te cobra materia oscura.
      Remplace aproximadamente de la linea 100-170

      Source Code: ShowTraderPage.class.php

      1. foreach($tradeResources as $tradeRessID)
      2. {
      3. if(!isset($getTradeResources[$tradeRessID]))
      4. {
      5. continue;
      6. }
      7. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      8. if(empty($tradeAmount) || !isset(self::$Charge[$resourceID][$tradeRessID]))
      9. {
      10. continue;
      11. }
      12. if(isset($PLANET[$resource[$resourceID]]))
      13. {
      14. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      15. if($usedResources > $PLANET[$resource[$resourceID]])
      16. {
      17. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      18. 'label' => $LNG['sys_back'],
      19. 'url' => 'game.php?page=trader'
      20. )));
      21. }
      22. $tradeSum += $tradeAmount;
      23. $PLANET[$resource[$resourceID]] -= $usedResources;
      24. }
      25. elseif(isset($USER[$resource[$resourceID]]))
      26. {
      27. if($resourceID == 921)
      28. {
      29. $USER[$resource[$resourceID]] -= Config::get()->darkmatter_cost_trader;
      30. }
      31. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      32. if($usedResources > $USER[$resource[$resourceID]])
      33. {
      34. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      35. 'label' => $LNG['sys_back'],
      36. 'url' => 'game.php?page=trader'
      37. )));
      38. }
      39. $tradeSum += $tradeAmount;
      40. $USER[$resource[$resourceID]] -= $usedResources;
      41. if($resourceID == 921)
      42. {
      43. $USER[$resource[$resourceID]] += Config::get()->darkmatter_cost_trader;
      44. }
      45. }
      46. else
      47. {
      48. throw new Exception('Unknown resource ID #'.$resourceID);
      49. }
      50. if(isset($PLANET[$resource[$tradeRessID]]))
      51. {
      52. $PLANET[$resource[$tradeRessID]] += $tradeAmount;
      53. }
      54. elseif(isset($USER[$resource[$tradeRessID]]))
      55. {
      56. $USER[$resource[$tradeRessID]] += $tradeAmount;
      57. }
      58. else
      59. {
      60. throw new Exception('Unknown resource ID #'.$tradeRessID);
      61. }
      62. }
      Display All
      por

      Source Code: ShowTraderPage.class.php

      1. $sum=0;
      2. foreach($tradeResources as $tradeRessID)
      3. {
      4. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      5. $sum+= $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      6. }
      7. if($sum>$PLANET[$resource[$resourceID]])
      8. {
      9. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      10. 'label' => $LNG['sys_back'],
      11. 'url' => 'game.php?page=trader'
      12. )));
      13. }
      14. foreach($tradeResources as $tradeRessID)
      15. {
      16. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      17. if(empty($tradeAmount) || !isset(self::$Charge[$resourceID][$tradeRessID]))
      18. {
      19. continue;
      20. }
      21. if(isset($PLANET[$resource[$resourceID]]))
      22. {
      23. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      24. if($usedResources > $PLANET[$resource[$resourceID]])
      25. {
      26. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      27. 'label' => $LNG['sys_back'],
      28. 'url' => 'game.php?page=trader'
      29. )));
      30. }
      31. else
      32. {
      33. $tradeSum += $tradeAmount;
      34. $PLANET[$resource[$resourceID]] -= $usedResources;
      35. }
      36. }
      37. elseif(isset($USER[$resource[$resourceID]]))
      38. {
      39. if($resourceID == 921)
      40. {
      41. $USER[$resource[$resourceID]] -= Config::get()->darkmatter_cost_trader;
      42. }
      43. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      44. if($usedResources > $USER[$resource[$resourceID]])
      45. {
      46. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      47. 'label' => $LNG['sys_back'],
      48. 'url' => 'game.php?page=trader'
      49. )));
      50. }
      51. else
      52. {
      53. $tradeSum += $tradeAmount;
      54. $USER[$resource[$resourceID]] -= $usedResources;
      55. }
      56. if($resourceID == 921)
      57. {
      58. $USER[$resource[$resourceID]] += Config::get()->darkmatter_cost_trader;
      59. }
      60. }
      61. else
      62. {
      63. throw new Exception('Unknown resource ID #'.$resourceID);
      64. }
      65. if(isset($PLANET[$resource[$tradeRessID]]))
      66. {
      67. $PLANET[$resource[$tradeRessID]] += $tradeAmount;
      68. }
      69. elseif(isset($USER[$resource[$tradeRessID]]))
      70. {
      71. $USER[$resource[$tradeRessID]] += $tradeAmount;
      72. }
      73. else
      74. {
      75. throw new Exception('Unknown resource ID #'.$tradeRessID);
      76. }
      77. }
      Display All
      Este error se esta arrastrando del core 1.8.
      Saludos
    • But is not Working but you Know what i Mean

      yamilrh wrote:

      En el mercader de recursos existen 2 errores.
      1- Cuando tu vas a cambiar 1 recurso pones a cambiar mas recurso del que tengas en tu planeta, cuando le das cambiar este te devuelve un error, te cambia los recursos pero no te cobra materia oscura.
      2- Cuando tu vas a cambiar 2 recursos pones a cambiar mas recursos del que tengas en tu planeta, cuando le das cambiar este te devuelve un error, te cambia los recursos pero no te cobra materia oscura.
      Remplace aproximadamente de la linea 100-170

      Source Code: ShowTraderPage.class.php

      1. foreach($tradeResources as $tradeRessID)
      2. {
      3. if(!isset($getTradeResources[$tradeRessID]))
      4. {
      5. continue;
      6. }
      7. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      8. if(empty($tradeAmount) || !isset(self::$Charge[$resourceID][$tradeRessID]))
      9. {
      10. continue;
      11. }
      12. if(isset($PLANET[$resource[$resourceID]]))
      13. {
      14. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      15. if($usedResources > $PLANET[$resource[$resourceID]])
      16. {
      17. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      18. 'label' => $LNG['sys_back'],
      19. 'url' => 'game.php?page=trader'
      20. )));
      21. }
      22. $tradeSum += $tradeAmount;
      23. $PLANET[$resource[$resourceID]] -= $usedResources;
      24. }
      25. elseif(isset($USER[$resource[$resourceID]]))
      26. {
      27. if($resourceID == 921)
      28. {
      29. $USER[$resource[$resourceID]] -= Config::get()->darkmatter_cost_trader;
      30. }
      31. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      32. if($usedResources > $USER[$resource[$resourceID]])
      33. {
      34. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      35. 'label' => $LNG['sys_back'],
      36. 'url' => 'game.php?page=trader'
      37. )));
      38. }
      39. $tradeSum += $tradeAmount;
      40. $USER[$resource[$resourceID]] -= $usedResources;
      41. if($resourceID == 921)
      42. {
      43. $USER[$resource[$resourceID]] += Config::get()->darkmatter_cost_trader;
      44. }
      45. }
      46. else
      47. {
      48. throw new Exception('Unknown resource ID #'.$resourceID);
      49. }
      50. if(isset($PLANET[$resource[$tradeRessID]]))
      51. {
      52. $PLANET[$resource[$tradeRessID]] += $tradeAmount;
      53. }
      54. elseif(isset($USER[$resource[$tradeRessID]]))
      55. {
      56. $USER[$resource[$tradeRessID]] += $tradeAmount;
      57. }
      58. else
      59. {
      60. throw new Exception('Unknown resource ID #'.$tradeRessID);
      61. }
      62. }
      Display All
      por

      Source Code: ShowTraderPage.class.php

      1. $sum=0;
      2. foreach($tradeResources as $tradeRessID)
      3. {
      4. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      5. $sum+= $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      6. }
      7. if($sum>$PLANET[$resource[$resourceID]])
      8. {
      9. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      10. 'label' => $LNG['sys_back'],
      11. 'url' => 'game.php?page=trader'
      12. )));
      13. }
      14. foreach($tradeResources as $tradeRessID)
      15. {
      16. $tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
      17. if(empty($tradeAmount) || !isset(self::$Charge[$resourceID][$tradeRessID]))
      18. {
      19. continue;
      20. }
      21. if(isset($PLANET[$resource[$resourceID]]))
      22. {
      23. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      24. if($usedResources > $PLANET[$resource[$resourceID]])
      25. {
      26. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      27. 'label' => $LNG['sys_back'],
      28. 'url' => 'game.php?page=trader'
      29. )));
      30. }
      31. else
      32. {
      33. $tradeSum += $tradeAmount;
      34. $PLANET[$resource[$resourceID]] -= $usedResources;
      35. }
      36. }
      37. elseif(isset($USER[$resource[$resourceID]]))
      38. {
      39. if($resourceID == 921)
      40. {
      41. $USER[$resource[$resourceID]] -= Config::get()->darkmatter_cost_trader;
      42. }
      43. $usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
      44. if($usedResources > $USER[$resource[$resourceID]])
      45. {
      46. $this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
      47. 'label' => $LNG['sys_back'],
      48. 'url' => 'game.php?page=trader'
      49. )));
      50. }
      51. else
      52. {
      53. $tradeSum += $tradeAmount;
      54. $USER[$resource[$resourceID]] -= $usedResources;
      55. }
      56. if($resourceID == 921)
      57. {
      58. $USER[$resource[$resourceID]] += Config::get()->darkmatter_cost_trader;
      59. }
      60. }
      61. else
      62. {
      63. throw new Exception('Unknown resource ID #'.$resourceID);
      64. }
      65. if(isset($PLANET[$resource[$tradeRessID]]))
      66. {
      67. $PLANET[$resource[$tradeRessID]] += $tradeAmount;
      68. }
      69. elseif(isset($USER[$resource[$tradeRessID]]))
      70. {
      71. $USER[$resource[$tradeRessID]] += $tradeAmount;
      72. }
      73. else
      74. {
      75. throw new Exception('Unknown resource ID #'.$tradeRessID);
      76. }
      77. }
      Display All
      Este error se esta arrastrando del core 1.8.
      Saludos