[C++] Reset Duel Script In The End

Hey that’s my duel script for the end.

You can configure your duel zone in the config file of the world server and you can change it without restart … just .relo conf

Pastebin : http://pastebin.com/j3N6pQ1K

add those to your worldserver.conf :


#   Duel.Zone

#			  Description: Resets the stats of the player in that zone after the duel

#			  Default:  NULL  - (Disabled)

#						   ZoneID  - (Enabled for ZoneID)

#

#

Duel.Zone1 =

Duel.Zone2 =

Duel.Zone3 =

Duel.Zone4 =

If you want to be everywhere

comment the “IF”


			 //   if (Pw->GetZoneId() == zone1 || Pw->GetZoneId() == zone2 || Pw->GetZoneId() == zone3 || Pw->GetZoneId() == zone4)

			 //   {


						Pw->RemoveArenaSpellCooldowns();

						Pl->RemoveArenaSpellCooldowns();

						Pw->SetHealth(Pw->GetMaxHealth());

						Pw->SetPower(POWER_MANA, Pw->GetMaxPower(POWER_MANA));

						Pl->SetHealth(Pl->GetMaxHealth());

						Pl->SetPower(POWER_MANA, Pl->GetMaxPower(POWER_MANA));

			   // }

This is like the 3rd topic about this subject, whereas all three of them contain a script like this.

Replace Pl with Player or it wont work.

U mad Bro ?!

— Canned message start —

You smell that? It was this thread rotting.

You just played:

http://img227.imageshack.us/img227/8899/threadnecromancerji6.jpg

— Canned message end —

You should look into string splitting, so you input zones like this:

PvPDuelZones = “1,2,3,4,5,6,7,8,9” Would make a more clean interface /emoticons/default_wink.png

Also, if the code is written correctly, it would allow you to have as many, or, as few, zones, as you wish.

here is the full reset and something else


player->RemoveAllSpellCooldown();

plTarget->RemoveAllSpellCooldown();


player->SetHealth(player->GetMaxHealth());

plTarget->SetHealth(plTarget->GetMaxHealth());


player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));

plTarget->SetPower(POWER_MANA,  plTarget->GetMaxPower(POWER_MANA));

player->SetPower(POWER_RAGE, 0);

plTarget->SetPower(POWER_RAGE, 0);

player->SetPower(POWER_RUNIC_POWER, 0);

plTarget->SetPower(POWER_RUNIC_POWER, 0);


player->DurabilityRepairAll(0, 0, false);

plTarget->DurabilityRepairAll(0, 0, false);

Is this script still compatible with last TrinityCore rev?

And I suggest you not to use:

player->RemoveAllSpellCooldown();

plTarget->RemoveAllSpellCooldown();

use:

player->RemoveAllArenaSpellCooldown();

plTarget->RemoveAllArenaSpellCooldown();

my code is working with the last rev

about you suggestion : the different is your code only reset the cooldowns with lower than the original arena max spell cooldown.

it means you dont reset the spells like the Bloodlust with this code .

its kind of the self decision .

I wonder would not function RemoveAllSpellCooldown() will remove and CD-s of professions and similar spells?

For the moment I’m experimenting with this:


diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp

index 1b3f71c..300dee4 100755

--- a/src/server/game/Handlers/DuelHandler.cpp

+++ b/src/server/game/Handlers/DuelHandler.cpp

@@ -51,6 +51,37 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)

.

	 player->SendDuelCountdown(3000);

	 plTarget->SendDuelCountdown(3000);

+

+    // clear CDs from players

+    player->RemoveArenaSpellCooldowns(true);

+    player->RemoveArenaAuras();

+    plTarget->RemoveArenaSpellCooldowns(true);

+    plTarget->RemoveArenaAuras();

+

+    // remove Debuffs

+    player->RemoveAura(41425); // Remove Hypothermia Debuff

+    plTarget->RemoveAura(41425);

+    player->RemoveAura(25771); // Remove Forbearance Debuff

+    plTarget->RemoveAura(25771);

+    player->RemoveAura(57724); // Remove Sated Debuff

+    plTarget->RemoveAura(57724);

+    player->RemoveAura(57723); // Remove Exhaustion Debuff

+    plTarget->RemoveAura(57723);

+    player->RemoveAura(31850); // Remove Ardent Defender Debuff

+    plTarget->RemoveAura(31850);

+    player->RemoveAura(11196); // Remove Recently Bandaged Debuff

+    plTarget->RemoveAura(11196);

+    // end of removing debuffs

+

+    player->SetHealth(player->GetMaxHealth());

+    plTarget->SetHealth(plTarget->GetMaxHealth());

+    player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));

+    plTarget->SetPower(POWER_MANA,  plTarget->GetMaxPower(POWER_MANA));

+    player->SetPower(POWER_RAGE, 0);

+    plTarget->SetPower(POWER_RAGE, 0);

+    player->SetPower(POWER_RUNIC_POWER, 0);

+    plTarget->SetPower(POWER_RUNIC_POWER, 0);

+    // end of CDs clearing

 }

.

 void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)

its good i think to remove the pets spell cooldowns too .