[Fix] the trader, does not consume dark matter

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

  • [Fix] the trader, does not consume dark matter

    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