Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/server/game/Custom/DynamicResurrection/DynamicResurrection.cpp b/src/server/game/Custom/DynamicResurrection/DynamicResurrection.cpp
- new file mode 100644
- index 0000000..f3ec129
- --- /dev/null
- +++ b/src/server/game/Custom/DynamicResurrection/DynamicResurrection.cpp
- @@ -0,0 +1,32 @@
- +/* Copyright
- +Author : Callmephil
- +Version : 3.3.5 / 4.3.4
- +Dynamic Resurrection is a simple script that add a "Resurrection Waypoint" near the latest boss killed in dungeon or raid. for faster Resurrection.
- +*/
- +
- +#include "DynamicResurrection.h"
- +
- +bool Dynamic_Resurrection::IsInDungeonOrRaid(Player* player)
- +{
- + if (sMapStore.LookupEntry(player->GetMapId())->Instanceable())
- + return true; // boolean need to return to a value
- + return false;
- +}
- +
- +bool Dynamic_Resurrection::CheckForSpawnPoint(Player* player)
- +{
- + // Find Nearest Creature And Teleport.
- + if (Creature* creature = player->FindNearestCreature(C_Resurrection_ENTRY, C_DISTANCE_CHECK_RANGE))
- + return true;
- + return false;
- +}
- +
- +void Dynamic_Resurrection::DynamicResurrection(Player* player)
- +{
- + // Find Nearest Creature And Teleport.
- + if (Creature* creature = player->FindNearestCreature(C_Resurrection_ENTRY, C_DISTANCE_CHECK_RANGE))
- + player->TeleportTo(player->GetMapId(), creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 1);
- + // Revive Player with 70 %
- + player->ResurrectPlayer(0.7);
- + player->SpawnCorpseBones();
- +}
- \ No newline at end of file
- diff --git a/src/server/game/Custom/DynamicResurrection/DynamicResurrection.h b/src/server/game/Custom/DynamicResurrection/DynamicResurrection.h
- new file mode 100644
- index 0000000..d945ad4
- --- /dev/null
- +++ b/src/server/game/Custom/DynamicResurrection/DynamicResurrection.h
- @@ -0,0 +1,37 @@
- +/* Copyright
- +Author : Callmephil
- +Version : 3.3.5 / 4.3.4
- +Dynamic Resurrection is a simple script that add a "Resurrection Waypoint" near the latest boss killed in dungeon or raid. for faster Resurrection.
- +*/
- +
- +#ifndef DYNAMIC_RESURRECTION
- +#define DYNAMIC_RESURRECTION
- +
- +#include "Player.h"
- +#include "DBCStores.h"
- +
- +class Player;
- +
- +enum WAYPOINT_CREATURE
- +{
- + C_Resurrection_ENTRY = 1, // change this as you wishes
- + C_DISTANCE_CHECK_RANGE = 1000, // change this (in yards)
- + C_SPAWN_TIMER_TWO_HOURS = 1200000, // change this (in miliseconds)
- +};
- +
- +class TC_GAME_API Dynamic_Resurrection
- +{
- +public:
- + static Dynamic_Resurrection* instance()
- + {
- + static Dynamic_Resurrection instance;
- + return &instance;
- + }
- +
- + bool IsInDungeonOrRaid(Player* player);
- + bool CheckForSpawnPoint(Player* player);
- + void DynamicResurrection(Player* player);
- +};
- +#define sDynRes Dynamic_Resurrection::instance()
- +
- +#endif
- \ No newline at end of file
- diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
- index b618200..89c9975 100644
- --- a/src/server/game/Entities/Player/Player.cpp
- +++ b/src/server/game/Entities/Player/Player.cpp
- @@ -81,6 +81,7 @@
- #include "WorldSession.h"
- #include "GameObjectAI.h"
- #include "Transmogrification.h"
- +#include "DynamicResurrection.h"
- #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
- @@ -5124,16 +5125,21 @@ void Player::RepopAtGraveyard()
- // and don't show spirit healer location
- if (ClosestGrave)
- {
- - TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation());
- - if (isDead()) // not send if alive, because it used in TeleportTo()
- - {
- - WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // show spirit healer position on minimap
- - data << ClosestGrave->map_id;
- - data << ClosestGrave->x;
- - data << ClosestGrave->y;
- - data << ClosestGrave->z;
- - GetSession()->SendPacket(&data);
- - }
- + if (sDynRes->IsInDungeonOrRaid(this) && sDynRes->CheckForSpawnPoint(this))
- + sDynRes->DynamicResurrection(this);
- + else
- + {
- + TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation());
- + if (isDead()) // not send if alive, because it used in TeleportTo()
- + {
- + WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // show spirit healer position on minimap
- + data << ClosestGrave->map_id;
- + data << ClosestGrave->x;
- + data << ClosestGrave->y;
- + data << ClosestGrave->z;
- + GetSession()->SendPacket(&data);
- + }
- + }
- }
- else if (GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
- TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
- diff --git a/src/server/scripts/Custom/DynamicRessurection/DynamicReurrections.cpp b/src/server/scripts/Custom/DynamicRessurection/DynamicReurrections.cpp
- new file mode 100644
- index 0000000..435de9e
- --- /dev/null
- +++ b/src/server/scripts/Custom/DynamicRessurection/DynamicReurrections.cpp
- @@ -0,0 +1,24 @@
- +/* Copyright
- +Author : Callmephil
- +Version : 3.3.5 / 4.3.4
- +Dynamic Resurrection is a simple script that add a "Resurrection Waypoint" near the latest boss killed in dungeon or raid. for faster Resurrection.
- +*/
- +
- +#include "DynamicResurrection.h"
- +
- +class Dynamic_Resurrections : public PlayerScript
- +{
- +public:
- + Dynamic_Resurrections() : PlayerScript("Dynamic_Resurrections") {}
- +
- + void OnCreatureKill(Player* player, Creature* boss) override
- + {
- + if (sDynRes->IsInDungeonOrRaid(player) && (boss->isWorldBoss() || boss->IsDungeonBoss()))
- + player->SummonCreature(C_RESURECTION_ENTRY, boss->GetPositionX(), boss->GetPositionY(), boss->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, C_SPAWN_TIMER_TWO_HOURS);
- + }
- +};
- +
- +void AddSC_Dynamic_Resurrections()
- +{
- + new Dynamic_Resurrections();
- +}
- \ No newline at end of file
- diff --git a/src/server/scripts/Custom/custom_script_loader.cpp b/src/server/scripts/Custom/custom_script_loader.cpp
- index dd4b5e9..fa143d7 100644
- --- a/src/server/scripts/Custom/custom_script_loader.cpp
- +++ b/src/server/scripts/Custom/custom_script_loader.cpp
- @@ -17,6 +17,7 @@
- // 13
- // 14
- // 15
- +void AddSC_Dynamic_Resurrections();
- // 16
- // 17
- // 18
- @@ -47,6 +47,7 @@
- // 15
- // 16
- // 17
- + AddSC_Dynamic_Resurrections();
- // 18
- // 19
- // 20
Advertisement
Add Comment
Please, Sign In to add comment