Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************
- # 2015 #
- * Duel Reset+Config *
- # Release by Ghostcrawler336 #
- * Add Config By : H.NoRRt *
- # Worked : 100% #
- ********************************************************/
- #include "ScriptPCH.h"
- #include "ScriptMgr.h"
- #include "Config.h"
- #include "Language.h"
- bool Duel_Resets;
- int Zone_Duel;
- class Duel_Reset : public PlayerScript
- {
- public:
- Duel_Reset() : PlayerScript("Duel_Reset"){}
- void OnDuelStart(Player* pWinner, Player* pLoser)
- {
- if (pWinner->GetZoneId() == Zone_Duel && pLoser->GetZoneId() == Zone_Duel)
- {
- pWinner->RemoveAllSpellCooldown();
- pLoser->RemoveAllSpellCooldown();
- pWinner->SetHealth(pWinner->GetMaxHealth());
- if (pWinner->getPowerType() == POWER_MANA)
- pWinner->SetPower(POWER_MANA, pWinner->GetMaxPower(POWER_MANA));
- if (Duel_Resets)
- pLoser->SetHealth(pLoser->GetMaxHealth());
- if (pLoser->getPowerType() == POWER_MANA)
- pLoser->SetPower(POWER_MANA, pLoser->GetMaxPower(POWER_MANA));
- }
- }
- void OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType /*type*/)
- {
- if (pWinner->GetZoneId() == Zone_Duel && pLoser->GetZoneId() == Zone_Duel)
- pWinner->RemoveAllSpellCooldown();
- pLoser->RemoveAllSpellCooldown();
- pWinner->SetHealth(pWinner->GetMaxHealth());
- if ( pWinner->getPowerType() == POWER_MANA )
- pWinner->SetPower(POWER_MANA, pWinner->GetMaxPower(POWER_MANA));
- if (Duel_Resets)
- pLoser->SetHealth(pLoser->GetMaxHealth());
- if ( pLoser->getPowerType() == POWER_MANA )
- pLoser->SetPower(POWER_MANA, pLoser->GetMaxPower(POWER_MANA));
- }
- };
- class Duel_Reset_WorldScript : public WorldScript
- {
- public:
- Duel_Reset_WorldScript() : WorldScript("Script_npc_changer_WorldScript") { }
- void OnConfigLoad(bool /*reload*/)
- {
- Duel_Resets = sConfigMgr->GetBoolDefault("Duel.Reset", true);
- Zone_Duel = sConfigMgr->GetIntDefault("Zone.Duel", 0);
- }
- };
- void AddSC_Duel_Reset()
- {
- new Duel_Reset();
- new Duel_Reset_WorldScript();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement