Advertisement
NoRRt

Duel Reset+Config

Jan 1st, 2015
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.52 KB | None | 0 0
  1. /*******************************************************
  2. #                         2015                         #
  3. *                   Duel Reset+Config                  *
  4. #             Release by Ghostcrawler336               #
  5. *               Add Config By : H.NoRRt                *
  6. #                   Worked : 100%                      #
  7. ********************************************************/
  8. #include "ScriptPCH.h"
  9. #include "ScriptMgr.h"
  10. #include "Config.h"
  11. #include "Language.h"
  12.  
  13. bool Duel_Resets;
  14. int  Zone_Duel;
  15.  
  16. class Duel_Reset : public PlayerScript
  17. {
  18.         public:
  19.                 Duel_Reset() : PlayerScript("Duel_Reset"){}
  20.  
  21.                 void OnDuelStart(Player* pWinner, Player* pLoser)
  22.                 {
  23.                     if (pWinner->GetZoneId() == Zone_Duel && pLoser->GetZoneId() == Zone_Duel)
  24.                     {
  25.                         pWinner->RemoveAllSpellCooldown();
  26.                         pLoser->RemoveAllSpellCooldown();
  27.                         pWinner->SetHealth(pWinner->GetMaxHealth());
  28.                         if (pWinner->getPowerType() == POWER_MANA)
  29.                             pWinner->SetPower(POWER_MANA, pWinner->GetMaxPower(POWER_MANA));
  30.                         if (Duel_Resets)
  31.                         pLoser->SetHealth(pLoser->GetMaxHealth());
  32.                         if (pLoser->getPowerType() == POWER_MANA)
  33.                             pLoser->SetPower(POWER_MANA, pLoser->GetMaxPower(POWER_MANA));
  34.                     }
  35.                 }
  36.  
  37.                 void OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType /*type*/)
  38.                 {
  39.                     if (pWinner->GetZoneId() == Zone_Duel && pLoser->GetZoneId() == Zone_Duel)
  40.  
  41.                         pWinner->RemoveAllSpellCooldown();
  42.                         pLoser->RemoveAllSpellCooldown();
  43.                         pWinner->SetHealth(pWinner->GetMaxHealth());
  44.                         if ( pWinner->getPowerType() == POWER_MANA )
  45.                                 pWinner->SetPower(POWER_MANA, pWinner->GetMaxPower(POWER_MANA));
  46.                         if (Duel_Resets)
  47.                         pLoser->SetHealth(pLoser->GetMaxHealth());
  48.                         if ( pLoser->getPowerType() == POWER_MANA )
  49.                                 pLoser->SetPower(POWER_MANA,  pLoser->GetMaxPower(POWER_MANA));
  50.                 }
  51. };
  52.  
  53.   class Duel_Reset_WorldScript : public WorldScript
  54. {
  55. public:
  56.         Duel_Reset_WorldScript() : WorldScript("Script_npc_changer_WorldScript") { }
  57.  
  58.         void OnConfigLoad(bool /*reload*/)
  59.         {
  60.                 Duel_Resets       = sConfigMgr->GetBoolDefault("Duel.Reset", true);
  61.                 Zone_Duel         = sConfigMgr->GetIntDefault("Zone.Duel", 0);
  62.         }
  63. };
  64.  
  65. void AddSC_Duel_Reset()
  66. {
  67.         new Duel_Reset();
  68.         new Duel_Reset_WorldScript();
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement