*Wintergrasp: Tenacity fixes by Spp
*Better Windows signal handling for services, by defacer *Always hide triggers for players, by ogeraisi --HG-- branch : trunk
This commit is contained in:
@@ -2000,6 +2000,10 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const
|
||||
if(pl->isGameMaster())
|
||||
return true;
|
||||
|
||||
// Trigger shouldn't be visible for players
|
||||
if(isTrigger())
|
||||
return false;
|
||||
|
||||
// Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0
|
||||
if(pl->isAlive() || pl->GetDeathTimer() > 0)
|
||||
{
|
||||
|
||||
+58
-66
@@ -69,6 +69,7 @@ void LoadTeamPair(TeamPairMap &pairMap, const TeamPair *pair)
|
||||
|
||||
#define REMOVE_WARTIME_AURAS(p) (p)->RemoveAura(SPELL_RECRUIT);\
|
||||
(p)->RemoveAura(SPELL_CORPORAL);(p)->RemoveAura(SPELL_LIEUTENANT)
|
||||
#define REMOVE_TENACITY_AURA(p) CastTenacity(p, 0)
|
||||
|
||||
typedef std::list<const AreaPOIEntry *> AreaPOIList;
|
||||
|
||||
@@ -145,24 +146,13 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
|
||||
}
|
||||
areaPOIs.erase(poi);
|
||||
|
||||
//disable for now
|
||||
//continue;
|
||||
|
||||
// add capture point
|
||||
uint32 capturePointEntry = 0;
|
||||
|
||||
//192028 192029
|
||||
//192030 192031
|
||||
//192032 192033
|
||||
|
||||
//190475 190487 not sure
|
||||
//192626 192627
|
||||
//194959 194960
|
||||
|
||||
switch(goData->id)
|
||||
{
|
||||
case 192028: capturePointEntry = 190475; break;
|
||||
case 192029: capturePointEntry = 190487; break;
|
||||
case 192029: capturePointEntry = 190487; break; // not sure
|
||||
case 192030: capturePointEntry = 190475; break;
|
||||
case 192031: capturePointEntry = 190487; break;
|
||||
case 192032: capturePointEntry = 190475; break;
|
||||
@@ -292,6 +282,7 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
|
||||
m_wartime = false;
|
||||
m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_START_TIME) * MINUTE * IN_MILISECONDS;
|
||||
|
||||
// Load custom rewards
|
||||
if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR))
|
||||
for (int i = 0; i < WG_REWARD_EVENT_MAX; ++i)
|
||||
m_customHonorReward[i] = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_0 + i);
|
||||
@@ -328,7 +319,7 @@ void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId)
|
||||
{
|
||||
for (PlayerSet::const_iterator itr = m_players[m_defender].begin(); itr != m_players[m_defender].end(); ++itr)
|
||||
if ((*itr)->HasAura(SPELL_LIEUTENANT) && ((*itr)->getLevel() > 69))
|
||||
(*itr)->ModifyHonorPoints(m_customHonorReward[DAMAGED_TOWER]);
|
||||
(*itr)->ModifyHonorPoints(m_customHonorReward[DAMAGED_TOWER]);
|
||||
}
|
||||
else
|
||||
LieutenantCastSpell(m_defender, SPELL_DAMAGED_TOWER);
|
||||
@@ -362,7 +353,6 @@ void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BroadcastStateChange(state);
|
||||
}
|
||||
}
|
||||
@@ -370,7 +360,7 @@ void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId)
|
||||
|
||||
void OPvPWintergrasp::RemoveOfflinePlayerWGAuras()
|
||||
{
|
||||
// if server crashed while in battle there could be players with rank, tenacity or wintergrasp essence auras
|
||||
// if server crashed while in battle there could be players with rank or tenacity
|
||||
CharacterDatabase.PExecute("DELETE FROM character_aura WHERE spell IN (%u,%u,%u, %u)",
|
||||
SPELL_RECRUIT, SPELL_CORPORAL, SPELL_LIEUTENANT, SPELL_TENACITY);
|
||||
}
|
||||
@@ -668,7 +658,6 @@ void OPvPWintergrasp::HandlePlayerEnterZone(Player * plr, uint32 zone)
|
||||
plr->CastSpell(plr, SPELL_RECRUIT, true);
|
||||
|
||||
SendInitWorldStatesTo(plr);
|
||||
|
||||
OutdoorPvP::HandlePlayerEnterZone(plr, zone);
|
||||
UpdateTenacityStack();
|
||||
}
|
||||
@@ -681,7 +670,7 @@ void OPvPWintergrasp::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
||||
plr->GetVehicle()->Dismiss();
|
||||
REMOVE_WARTIME_AURAS(plr);
|
||||
}
|
||||
plr->RemoveAura(SPELL_TENACITY);
|
||||
REMOVE_TENACITY_AURA(plr);
|
||||
OutdoorPvP::HandlePlayerLeaveZone(plr, zone);
|
||||
UpdateTenacityStack();
|
||||
}
|
||||
@@ -746,12 +735,33 @@ void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
|
||||
}
|
||||
}
|
||||
|
||||
// Cast or removes Tenacity. MaxHP Modified, HP keeps it's % ratio
|
||||
void OPvPWintergrasp::CastTenacity(Unit *utr, int32 newStack)
|
||||
{
|
||||
if (!utr)
|
||||
return;
|
||||
|
||||
uint32 spellId = utr->GetTypeId() == TYPEID_PLAYER ? SPELL_TENACITY : SPELL_TENACITY_VEHICLE;
|
||||
float percent = (0.0f + utr->GetHealth()) / utr->GetMaxHealth();
|
||||
|
||||
if (newStack)
|
||||
utr->SetAuraStack(spellId, utr, newStack);
|
||||
else
|
||||
utr->RemoveAura(spellId);
|
||||
utr->SetHealth(uint32(utr->GetMaxHealth()*percent));
|
||||
}
|
||||
|
||||
// Recalculates Tenacity and applies it to Players / Vehicles
|
||||
void OPvPWintergrasp::UpdateTenacityStack()
|
||||
{
|
||||
if (!m_wartime)
|
||||
return;
|
||||
|
||||
TeamId team = TEAM_NEUTRAL;
|
||||
uint32 allianceNum = m_players[TEAM_ALLIANCE].size();
|
||||
uint32 hordeNum = m_players[TEAM_HORDE].size();
|
||||
|
||||
int32 newStack = 0;
|
||||
|
||||
if (allianceNum && hordeNum)
|
||||
{
|
||||
if (allianceNum < hordeNum)
|
||||
@@ -763,36 +773,37 @@ void OPvPWintergrasp::UpdateTenacityStack()
|
||||
if (newStack == m_tenacityStack)
|
||||
return;
|
||||
|
||||
// Remove old buff
|
||||
if (m_tenacityStack > 0) // old buff was on alliance
|
||||
{
|
||||
if (newStack <= 0) // new buff should on horde
|
||||
{
|
||||
TeamCastSpell(TEAM_ALLIANCE, -SPELL_TENACITY);
|
||||
VehicleCastSpell(TEAM_ALLIANCE, -SPELL_TENACITY_VEHICLE);
|
||||
}
|
||||
}
|
||||
else if (m_tenacityStack < 0)
|
||||
{
|
||||
if (newStack >= 0)
|
||||
{
|
||||
TeamCastSpell(TEAM_HORDE, -SPELL_TENACITY);
|
||||
VehicleCastSpell(TEAM_HORDE, -SPELL_TENACITY_VEHICLE);
|
||||
}
|
||||
}
|
||||
if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance
|
||||
team = TEAM_ALLIANCE;
|
||||
else if (m_tenacityStack < 0 && newStack >= 0) // old buff was on horde
|
||||
team = TEAM_HORDE;
|
||||
|
||||
m_tenacityStack = newStack;
|
||||
|
||||
// Remove old buff
|
||||
if (team != TEAM_NEUTRAL)
|
||||
{
|
||||
for (PlayerSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if ((*itr)->getLevel() > 69)
|
||||
REMOVE_TENACITY_AURA((*itr));
|
||||
|
||||
for (CreatureSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
REMOVE_TENACITY_AURA((*itr));
|
||||
}
|
||||
|
||||
// Apply new buff
|
||||
if (newStack)
|
||||
{
|
||||
TeamId team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
if (newStack < 0) newStack = -newStack;
|
||||
int32 auraStack = newStack > 20 ? 20 : newStack; //Dont let it be higher than 20
|
||||
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
int32 auraStack = newStack > 20 ? 20 : newStack; // Dont let it be higher than 20
|
||||
|
||||
for (PlayerSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if ((*itr)->getLevel() > 69)
|
||||
(*itr)->SetAuraStack(SPELL_TENACITY, *itr, auraStack);
|
||||
for (CreatureSet::iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
(*itr)->SetAuraStack(SPELL_TENACITY_VEHICLE, *itr, auraStack);
|
||||
CastTenacity((*itr), auraStack);
|
||||
|
||||
for (CreatureSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
CastTenacity((*itr), auraStack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,14 +903,10 @@ void OPvPWintergrasp::StartBattle()
|
||||
m_wartime = true;
|
||||
m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_BATTLE_TIME) * MINUTE * IN_MILISECONDS;
|
||||
|
||||
for (uint32 team = 0; team < 2; ++team)
|
||||
{
|
||||
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
REMOVE_WARTIME_AURAS(*itr);
|
||||
(*itr)->CastSpell(*itr, SPELL_RECRUIT, true);
|
||||
}
|
||||
}
|
||||
// Add recruit Aura, Add Tenacity
|
||||
TeamCastSpell(m_defender, SPELL_RECRUIT);
|
||||
TeamCastSpell(OTHER_TEAM(m_defender), SPELL_RECRUIT);
|
||||
UpdateTenacityStack();
|
||||
}
|
||||
|
||||
void OPvPWintergrasp::EndBattle()
|
||||
@@ -945,6 +952,7 @@ void OPvPWintergrasp::EndBattle()
|
||||
(*itr)->ModifyHonorPoints(honor);
|
||||
}
|
||||
REMOVE_WARTIME_AURAS(*itr);
|
||||
REMOVE_TENACITY_AURA(*itr);
|
||||
(*itr)->CombatStop(true);
|
||||
}
|
||||
|
||||
@@ -957,14 +965,7 @@ void OPvPWintergrasp::EndBattle()
|
||||
}
|
||||
}
|
||||
|
||||
/*TeamId loser = OTHER_TEAM(m_defender);
|
||||
for (PlayerSet::iterator itr = m_players[loser].begin(); itr != m_players[loser].end();)
|
||||
{
|
||||
Player *plr = *itr;
|
||||
++itr;
|
||||
plr->CastSpell(plr, SPELL_TELEPORT_DALARAN, true);
|
||||
}*/
|
||||
|
||||
//3.2.0: TeamCastSpell(OTHER_TEAM(m_defender), SPELL_TELEPORT_DALARAN);
|
||||
RemoveOfflinePlayerWGAuras();
|
||||
}
|
||||
|
||||
@@ -1103,12 +1104,3 @@ void SiegeWorkshop::ChangeTeam(TeamId oldTeam)
|
||||
|
||||
sLog.outDebug("Wintergrasp workshop now belongs to %u.", (uint32)m_buildingState->GetTeam());
|
||||
}
|
||||
|
||||
/*
|
||||
void SiegeWorkshop::DespawnAllVehicles()
|
||||
{
|
||||
while(!m_vehicles.empty())
|
||||
(*m_vehicles.begin())->Dismiss();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
+20
-20
@@ -21,12 +21,15 @@
|
||||
|
||||
#include "OutdoorPvPImpl.h"
|
||||
|
||||
#define ZONE_WINTERGRASP 4197
|
||||
#define ZONE_WINTERGRASP 4197
|
||||
#define POS_X_CENTER 4700
|
||||
#define MAX_VEHICLE_PER_WORKSHOP 4
|
||||
|
||||
const uint16 GameEventWintergraspDefender[2] = {50, 51};
|
||||
const uint32 WintergraspFaction[2] = {1732, 1735};
|
||||
|
||||
#define POS_X_CENTER 4700
|
||||
const uint32 WG_MARK_OF_HONOR = 43589;
|
||||
const uint32 VehNumWorldState[2] = {3680,3490};
|
||||
const uint32 MaxVehNumWorldState[2] = {3681,3491};
|
||||
const uint32 ClockWorldState[5] = {3785,3784,3782,3976,3975};
|
||||
|
||||
enum WintergraspSpell
|
||||
{
|
||||
@@ -36,18 +39,21 @@ enum WintergraspSpell
|
||||
|
||||
SPELL_TENACITY = 58549,
|
||||
SPELL_TENACITY_VEHICLE = 59911,
|
||||
SPELL_TOWER_CONTROL = 62064,
|
||||
|
||||
SPELL_TELEPORT_DALARAN = 53360,
|
||||
SPELL_SHUTDOWN_VEHICLE = 21247,
|
||||
|
||||
SPELL_TOWER_CONTROL = 62064,
|
||||
SPELL_VICTORY_REWARD = 56902,
|
||||
SPELL_DEFEAT_REWARD = 58494,
|
||||
SPELL_DAMAGED_TOWER = 59135,
|
||||
SPELL_DESTROYED_TOWER = 59136,
|
||||
SPELL_DAMAGED_BUILDING = 59201,
|
||||
SPELL_INTACT_BUILDING = 59203,
|
||||
|
||||
SPELL_TELEPORT_DALARAN = 53360,
|
||||
|
||||
SPELL_SHUTDOWN_VEHICLE = 21247,
|
||||
// Unused: Not implemented
|
||||
// SPELL_VICTORY_AURA = 60044,
|
||||
// SPELL_RULERS_OF_WG = 52108,
|
||||
// SPELL_ESSENCE_OF_WG = 58045,
|
||||
};
|
||||
|
||||
enum WintergraspRewardEvent
|
||||
@@ -61,22 +67,18 @@ enum WintergraspRewardEvent
|
||||
WG_REWARD_EVENT_MAX
|
||||
};
|
||||
|
||||
#define MAX_VEHICLE_PER_WORKSHOP 4
|
||||
/* Not used / Not implemented
|
||||
|
||||
const uint32 WG_KEEP_CM = 0; //Need data
|
||||
const uint32 WG_RULERS_BUFF = 52108;
|
||||
//some cosmetics :
|
||||
const uint32 WG_VICTORY_AURA = 60044;
|
||||
const uint16 GameEventWintergraspDefender[2] = {50, 51};
|
||||
|
||||
enum OutdoorPvP_WG_Sounds
|
||||
{
|
||||
/*TODO OutdoorPvP_WG_SOUND_KEEP_CLAIMED = 8192,
|
||||
OutdoorPvP_WG_SOUND_KEEP_CLAIMED = 8192,
|
||||
OutdoorPvP_WG_SOUND_KEEP_CAPTURED_ALLIANCE = 8173,
|
||||
OutdoorPvP_WG_SOUND_KEEP_CAPTURED_HORDE = 8213,
|
||||
OutdoorPvP_WG_SOUND_KEEP_ASSAULTED_ALLIANCE = 8212,
|
||||
OutdoorPvP_WG_SOUND_KEEP_ASSAULTED_HORDE = 8174,
|
||||
OutdoorPvP_WG_SOUND_NEAR_VICTORY = 8456
|
||||
*/
|
||||
};
|
||||
|
||||
enum DataId
|
||||
@@ -94,10 +96,7 @@ enum OutdoorPvP_WG_KeepStatus
|
||||
OutdoorPvP_WG_KEEP_STATUS_ALLY_OCCUPIED = 3,
|
||||
OutdoorPvP_WG_KEEP_STATUS_HORDE_OCCUPIED = 4
|
||||
};
|
||||
|
||||
const uint32 VehNumWorldState[2] = {3680,3490};
|
||||
const uint32 MaxVehNumWorldState[2] = {3681,3491};
|
||||
const uint32 ClockWorldState[5] = {3785,3784,3782,3976,3975};
|
||||
*/
|
||||
|
||||
enum WintergraspCreType
|
||||
{
|
||||
@@ -226,6 +225,7 @@ class OPvPWintergrasp : public OutdoorPvP
|
||||
void UpdateClockDigit(uint32 &timer, uint32 digit, uint32 mod);
|
||||
void PromotePlayer(Player *player) const;
|
||||
void UpdateTenacityStack();
|
||||
void CastTenacity(Unit *utr, int32 newStack);
|
||||
void UpdateAllWorldObject();
|
||||
bool UpdateCreatureInfo(Creature *creature) const;
|
||||
bool UpdateGameObjectInfo(GameObject *go) const;
|
||||
|
||||
@@ -521,7 +521,8 @@ void Master::_OnSignal(int s)
|
||||
break;
|
||||
case SIGTERM:
|
||||
#ifdef _WIN32
|
||||
case SIGBREAK:
|
||||
if (m_ServiceStatus != 1)
|
||||
case SIGBREAK:
|
||||
#endif
|
||||
World::StopNow(SHUTDOWN_EXIT_CODE);
|
||||
break;
|
||||
@@ -536,7 +537,8 @@ void Master::_HookSignals()
|
||||
signal(SIGINT, _OnSignal);
|
||||
signal(SIGTERM, _OnSignal);
|
||||
#ifdef _WIN32
|
||||
signal(SIGBREAK, _OnSignal);
|
||||
if (m_ServiceStatus != 1)
|
||||
signal(SIGBREAK, _OnSignal);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,8 @@ void HookSignals()
|
||||
signal(SIGINT, OnSignal);
|
||||
signal(SIGTERM, OnSignal);
|
||||
#ifdef _WIN32
|
||||
signal(SIGBREAK, OnSignal);
|
||||
if (m_ServiceStatus != 1)
|
||||
signal(SIGBREAK, OnSignal);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -383,7 +384,8 @@ void UnhookSignals()
|
||||
signal(SIGINT, 0);
|
||||
signal(SIGTERM, 0);
|
||||
#ifdef _WIN32
|
||||
signal(SIGBREAK, 0);
|
||||
if (m_ServiceStatus != 1)
|
||||
signal(SIGBREAK, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user