Many cmangos commits applied

Many cmangos commits applied
This commit is contained in:
Charles A Edwards 2016-09-11 10:26:49 +01:00 committed by Antz
parent cba86c231e
commit 8431568536
38 changed files with 173 additions and 83 deletions

View file

@ -144,7 +144,7 @@ Commands and their parameters
<tr bgcolor='#FEFEFF'><td align='center' valign='middle'>7</td><td align='left' valign='middle'>SCRIPT_COMMAND_QUEST_EXPLORED</td><td align='left' valign='middle'>one from source or target must be Player, another GO/Creature. `datalong` = quest_id, `datalong2` = distance or 0</td></tr>
<tr bgcolor='#FFFFEE'><td align='center' valign='middle'>8</td><td align='left' valign='middle'>SCRIPT_COMMAND_KILL_CREDIT</td><td align='left' valign='middle'>source or target with Player. `datalong` = creature entry, or 0; If 0 the entry of the creature source or target is used, `datalong2` = bool (0=personal credit, 1=group credit)</td></tr>
<tr bgcolor='#FEFEFF'><td align='center' valign='middle'>9</td><td align='left' valign='middle'>SCRIPT_COMMAND_RESPAWN_GAMEOBJECT</td><td align='left' valign='middle'>source = any, target = any. `datalong`=db_guid (can be skipped for buddy), `datalong2` = despawn_delay</td></tr>
<tr bgcolor='#FFFFEE'><td align='center' valign='middle'>10</td><td align='left' valign='middle'>SCRIPT_COMMAND_TEMP_SUMMON_CREATURE</td><td align='left' valign='middle'>source = any, target = any. `datalong` = creature entry, `datalong2` = despawn_delay, `data_flags` & SCRIPT_FLAG_COMMAND_ADDITIONAL: summon as active object</td></tr>
<tr bgcolor='#FFFFEE'><td align='center' valign='middle'>10</td><td align='left' valign='middle'>SCRIPT_COMMAND_TEMP_SUMMON_CREATURE</td><td align='left' valign='middle'>source = any, target = any. `datalong` = creature entry, `datalong2` = despawn_delay, `data_flags` & SCRIPT_FLAG_COMMAND_ADDITIONAL: summon as active object, dataint = (bool) setRun; 0 = off (default), 1 = on</td></tr>
<tr bgcolor='#FEFEFF'><td align='center' valign='middle'>11</td><td align='left' valign='middle'>SCRIPT_COMMAND_OPEN_DOOR</td><td align='left' valign='middle'>source = any. `datalong` = db_guid (can be skipped for buddy), `datalong2` = reset_delay</td></tr>
<tr bgcolor='#FFFFEE'><td align='center' valign='middle'>12</td><td align='left' valign='middle'>SCRIPT_COMMAND_CLOSE_DOOR</td><td align='left' valign='middle'>source = any. `datalong` = db_guid (can be skipped for buddy), `datalong2` = reset_delay</td></tr>
<tr bgcolor='#FEFEFF'><td align='center' valign='middle'>13</td><td align='left' valign='middle'>SCRIPT_COMMAND_ACTIVATE_OBJECT</td><td align='left' valign='middle'>source = unit, target=GO.</td></tr>

View file

@ -70,7 +70,7 @@ typedef std::map<uint32, BuyerAuctionEval > CheckEntryMap;
struct AHB_Buyer_Config
{
public:
AHB_Buyer_Config() : m_houseType(AUCTION_HOUSE_NEUTRAL) {}
AHB_Buyer_Config() : FactionChance(0), BuyerEnabled(false), BuyerPriceRatio(0), m_houseType(AUCTION_HOUSE_NEUTRAL) {}
void Initialize(AuctionHouseType houseType)
{
@ -121,7 +121,7 @@ struct SellerItemInfo
class AHB_Seller_Config
{
public:
AHB_Seller_Config() : m_houseType(AUCTION_HOUSE_NEUTRAL)
AHB_Seller_Config() : LastMissedItem(0), m_houseType(AUCTION_HOUSE_NEUTRAL), m_minTime(0), m_maxTime(0)
{
}
@ -625,7 +625,7 @@ uint32 AuctionBotConfig::getConfigItemQualityAmount(AuctionQuality quality) cons
//== AuctionBotBuyer functions =============================
AuctionBotBuyer::AuctionBotBuyer()
AuctionBotBuyer::AuctionBotBuyer(): m_CheckInterval(0)
{
// Define faction for our main data class.
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)

View file

@ -184,7 +184,7 @@ void BattleGround::BroadcastWorker(Do& _do)
_do(plr);
}
BattleGround::BattleGround()
BattleGround::BattleGround(): m_BuffChange(false), m_ArenaBuffSpawned(false), m_StartDelayTime(0), m_startMaxDist(0)
{
m_TypeID = BattleGroundTypeId(0);
m_Status = STATUS_NONE;

View file

@ -660,6 +660,7 @@ class BattleGround
float m_TeamStartLocY[PVP_TEAM_COUNT];
float m_TeamStartLocZ[PVP_TEAM_COUNT];
float m_TeamStartLocO[PVP_TEAM_COUNT];
float m_startMaxDist;
};
// helper functions for world state list fill

View file

@ -32,7 +32,7 @@
#include "WorldPacket.h"
#include "DBCStores.h" // TODO REMOVE this when graveyard handling for pvp is updated
BattleGroundAV::BattleGroundAV()
BattleGroundAV::BattleGroundAV(): m_HonorMapComplete(0), m_RepTowerDestruction(0), m_RepCaptain(0), m_RepBoss(0), m_RepOwnedGrave(0), m_RepOwnedMine(0), m_RepSurviveCaptain(0), m_RepSurviveTower(0)
{
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE;

View file

@ -34,7 +34,7 @@
#include "Util.h"
#include "MapManager.h"
BattleGroundEY::BattleGroundEY()
BattleGroundEY::BattleGroundEY(): m_flagState(), m_towersAlliance(0), m_towersHorde(0), m_honorTicks(0), m_flagRespawnTimer(0), m_resourceUpdateTimer(0), m_felReaverFlagTimer(0)
{
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE;

View file

@ -125,6 +125,7 @@ class BattleGroundQueue
class SelectionPool
{
public:
SelectionPool() : PlayerCount(0) {}
void Init();
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
bool KickGroup(uint32 size);

View file

@ -34,7 +34,7 @@
#include "Language.h"
#include "MapManager.h"
BattleGroundWS::BattleGroundWS()
BattleGroundWS::BattleGroundWS(): m_ReputationCapture(0), m_HonorWinKills(0), m_HonorEndKills(0), m_EndTimer(0), m_LastCapturedFlagTeam()
{
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;

View file

@ -4623,6 +4623,33 @@ bool ChatHandler::HandleLevelUpCommand(char* args)
}
}
//add pet to levelup command
if (m_session)
{
Creature* creatureTarget = getSelectedCreature();
Player* player = m_session->GetPlayer();
if (creatureTarget && creatureTarget->IsPet() && creatureTarget->GetOwner() && creatureTarget->GetOwner()->GetTypeId() == TYPEID_PLAYER)
{
Pet* petTarget = (Pet*)creatureTarget;
if (petTarget->getPetType() == HUNTER_PET)
{
uint32 newPetLevel = petTarget->getLevel() + addlevel;
if (newPetLevel <= player->getLevel())
{
petTarget->GivePetLevel(newPetLevel);
std::string nameLink = petLink(petTarget->GetName());
PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newPetLevel);
return true;
}
}
return false;
}
}
Player* target;
ObjectGuid target_guid;
std::string target_name;

View file

@ -32,7 +32,7 @@ class ConfusedMovementGenerator
: public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> >
{
public:
explicit ConfusedMovementGenerator() : i_nextMoveTime(0) {}
explicit ConfusedMovementGenerator() : i_nextMoveTime(0), i_x(0), i_y(0), i_z(0) {}
void Initialize(T&);
void Finalize(T&);

View file

@ -31,7 +31,7 @@
#include "movement/MoveSpline.h"
template<>
RandomMovementGenerator<Creature>::RandomMovementGenerator(const Creature& creature)
RandomMovementGenerator<Creature>::RandomMovementGenerator(const Creature& creature): i_verticalZ(0)
{
float respX, respY, respZ, respO, wander_distance;
creature.GetRespawnCoord(respX, respY, respZ, &respO, &wander_distance);

View file

@ -150,11 +150,11 @@ class CalendarEvent
public:
CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
time_t eventTime, uint32 flags, time_t unknownTime, std::string title, std::string description) :
EventId(eventId), CreatorGuid(creatorGUID), GuildId(guildId), Type(type), DungeonId(dungeonId),
EventId(eventId), CreatorGuid(creatorGUID), GuildId(guildId), Type(type), Repeatable(), DungeonId(dungeonId),
EventTime(eventTime), Flags(flags), UnknownTime(unknownTime), Title(title),
Description(description) { }
CalendarEvent() : EventId(0), CreatorGuid(uint64(0)), GuildId(0), Type(CALENDAR_TYPE_OTHER), DungeonId(-1), EventTime(0),
CalendarEvent() : EventId(0), CreatorGuid(uint64(0)), GuildId(0), Type(CALENDAR_TYPE_OTHER), Repeatable(), DungeonId(-1), EventTime(0),
Flags(0), UnknownTime(0) { }
~CalendarEvent();

View file

@ -26,6 +26,7 @@
#include "Creature.h"
#include "DBCStores.h"
#include "Spell.h"
#include "SpellMgr.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
@ -60,6 +61,9 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
// Check for power (also done by Spell::CheckCast())
if (m_creature->GetPower((Powers)pSpell->powerType) < Spell::CalculatePowerCost(pSpell, m_creature))
{ return CAST_FAIL_POWER; }
if (!pSpell->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !m_creature->IsWithinLOSInMap(pTarget) && m_creature != pTarget)
return CAST_FAIL_NOT_IN_LOS;
}
if (const SpellRangeEntry* pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex))
@ -116,6 +120,16 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
if (uiCastFlags & CAST_INTERRUPT_PREVIOUS && pCaster->IsNonMeleeSpellCasted(false))
{ pCaster->InterruptNonMeleeSpells(false); }
// Creature should always stop before it will cast a non-instant spell
if (GetSpellCastTime(pSpell))
pCaster->StopMoving();
// Creature should interrupt any current melee spell
pCaster->InterruptSpell(CURRENT_MELEE_SPELL);
// Creature should stop wielding weapon while casting
pCaster->SetSheath(SHEATH_STATE_UNARMED);
pCaster->CastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED, NULL, NULL, uiOriginalCasterGUID);
return CAST_OK;
}

View file

@ -53,7 +53,7 @@ enum CanCastResult
CAST_FAIL_POWER = 5,
CAST_FAIL_STATE = 6,
CAST_FAIL_TARGET_AURA = 7,
CAST_FAIL_NO_LOS = 8
CAST_FAIL_NOT_IN_LOS = 8
};
enum CastFlags

View file

@ -38,11 +38,18 @@ namespace FactorySelector
{
CreatureAI* selectAI(Creature* creature)
{
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if ((!creature->IsPet() || !((Pet*)creature)->isControlled()) && !creature->IsCharmed())
if (CreatureAI* scriptedAI = sScriptMgr.GetCreatureAI(creature))
CreatureAI* scriptedAI = sScriptMgr.GetCreatureAI(creature);
if (scriptedAI)
{
// charmed creature may have some script even if its not supposed to be that way (ex: Eye of Acherus)
if (creature->IsCharmed())
return scriptedAI;
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if (!creature->IsPet() || !static_cast<Pet*>(creature)->isControlled())
return scriptedAI;
}
CreatureAIRegistry& ai_registry(CreatureAIRepository::Instance());
const CreatureAICreator* ai_factory = NULL;

View file

@ -663,8 +663,26 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
switch (castResult)
{
case CAST_FAIL_POWER:
case CAST_OK:
{
if (m_DynamicMovement)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
if (spellInfo && !(spellInfo->rangeIndex == SPELL_RANGE_IDX_COMBAT || spellInfo->rangeIndex == SPELL_RANGE_IDX_SELF_ONLY) && target != m_creature)
{
SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
if (spellRange)
m_LastSpellMaxRange = spellRange->maxRange;
}
}
break;
}
case CAST_FAIL_TOO_FAR:
case CAST_FAIL_POWER:
case CAST_FAIL_NOT_IN_LOS:
{
if (!m_creature->hasUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT))
{
// Melee current victim if flag not set
if (!(action.cast.castFlags & CAST_NO_MELEE_IF_OOM))
@ -683,6 +701,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
}
}
else if (m_DynamicMovement)
{
m_LastSpellMaxRange = 0.0f;
}
break;
}
default:
@ -1029,10 +1052,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
case ACTION_T_DYNAMIC_MOVEMENT:
{
if (action.dynamicMovement.state && m_DynamicMovement || !action.dynamicMovement.state && !m_DynamicMovement)
if ((!!action.dynamicMovement.state) == m_DynamicMovement)
break;
m_DynamicMovement = action.dynamicMovement.state;
m_DynamicMovement = !!action.dynamicMovement.state;
SetCombatMovement(!m_DynamicMovement, true);
break;
}
@ -1345,21 +1368,25 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
m_EventUpdateTime -= diff;
}
// Melee Auto-Attack (getVictim might be nullptr as result of timer based events and actions)
if (Combat && m_creature->getVictim())
Unit* victim = m_creature->getVictim();
// Melee Auto-Attack
if (Combat && victim && !(m_creature->IsNonMeleeSpellCasted(false) || m_creature->hasUnitState(UNIT_STAT_CAN_NOT_REACT)))
{
// Update creature dynamic movement position before doing anything else
if (m_DynamicMovement)
{
if (!m_creature->hasUnitState(UNIT_STAT_CAN_NOT_REACT) && !m_creature->IsNonMeleeSpellCasted(false))
if (m_creature->IsWithinLOSInMap(victim))
{
if (m_LastSpellMaxRange && m_creature->IsInRange(m_creature->getVictim(), 0, (m_LastSpellMaxRange / 1.5f)))
if (m_LastSpellMaxRange && m_creature->IsInRange(victim, 0, (m_LastSpellMaxRange / 1.5f)))
SetCombatMovement(false, true);
else
SetCombatMovement(true, true);
}
else
SetCombatMovement(true, true);
}
else if (m_MeleeEnabled)
else if (m_MeleeEnabled && m_creature->CanReachWithMeleeAttack(victim)
&& !(m_creature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_MELEE))
DoMeleeAttackIfReady();
}
}

View file

@ -842,6 +842,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_COMBAT_MOVEMENT: // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
case ACTION_T_RANGED_MOVEMENT: // Distance, Angle
case ACTION_T_CALL_FOR_HELP: // Distance
case ACTION_T_DYNAMIC_MOVEMENT: // EnableDynamicMovement (1 = on; 0 = off)
break;
case ACTION_T_RANDOM_SAY:

View file

@ -34,7 +34,7 @@
#include "SpellMgr.h"
#include "DBCStores.h"
DynamicObject::DynamicObject() : WorldObject()
DynamicObject::DynamicObject() : WorldObject(), m_spellId(0), m_effIndex(), m_aliveDuration(0), m_radius(0), m_positive(false)
{
m_objectType |= TYPEMASK_DYNAMICOBJECT;
m_objectTypeId = TYPEID_DYNAMICOBJECT;

View file

@ -55,7 +55,7 @@
#include "ElunaEventMgr.h"
#endif /* ENABLE_ELUNA */
Object::Object()
Object::Object(): m_updateFlag(0)
{
m_objectTypeId = TYPEID_OBJECT;
m_objectType = TYPEMASK_OBJECT;
@ -1781,41 +1781,44 @@ void WorldObject::AddObjectToRemoveList()
GetMap()->AddObjectToRemoveList(this);
}
Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject)
Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject, bool setRun)
{
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(id);
if (!cinfo)
{
sLog.outErrorDb("WorldObject::SummonCreature: Creature (Entry: %u) not existed for summoner: %s. ", id, GetGuidStr().c_str());
return NULL;
return nullptr;
}
TemporarySummon* pCreature = new TemporarySummon(GetObjectGuid());
Team team = TEAM_NONE;
if (GetTypeId() == TYPEID_PLAYER)
{ team = ((Player*)this)->GetTeam(); }
team = ((Player*)this)->GetTeam();
CreatureCreatePos pos(GetMap(), x, y, z, ang, GetPhaseMask());
if (x == 0.0f && y == 0.0f && z == 0.0f)
{ pos = CreatureCreatePos(this, GetOrientation(), CONTACT_DISTANCE, ang); }
pos = CreatureCreatePos(this, GetOrientation(), CONTACT_DISTANCE, ang);
if (!pCreature->Create(GetMap()->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo, team))
{
delete pCreature;
return NULL;
return nullptr;
}
pCreature->SetRespawnCoord(pos);
// Set run or walk before any other movement starts
pCreature->SetWalk(!setRun);
// Active state set before added to map
pCreature->SetActiveObjectState(asActiveObject);
pCreature->Summon(spwtype, despwtime); // Also initializes the AI and MMGen
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
{ ((Creature*)this)->AI()->JustSummoned(pCreature); }
((Creature*)this)->AI()->JustSummoned(pCreature);
#ifdef ENABLE_ELUNA
if (Unit* summoner = ToUnit())
@ -1824,7 +1827,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
// Creature Linking, Initial load is handled like respawn
if (pCreature->IsLinkingEventTrigger())
{ GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature); }
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature);
// return the creature therewith the summoner has access to it
return pCreature;

View file

@ -647,7 +647,7 @@ class WorldObject : public Object
void RemoveFromClientUpdateList() override;
void BuildUpdateData(UpdateDataMapType&) override;
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject = false);
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, TempSummonType spwtype, uint32 despwtime, bool asActiveObject = false, bool setRun = false);
GameObject* SummonGameObject(uint32 id, float x, float y, float z, float angle, uint32 despwtime);
bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }

View file

@ -216,7 +216,8 @@ typedef std::pair<QuestRelationsMap::const_iterator, QuestRelationsMap::const_it
struct PetLevelInfo
{
PetLevelInfo() : health(0), mana(0) { for (int i = 0; i < MAX_STATS; ++i) stats[i] = 0; }
PetLevelInfo() : health(0), mana(0), armor(0)
{ for (int i = 0; i < MAX_STATS; ++i) stats[i] = 0; }
uint16 stats[MAX_STATS];
uint16 health;

View file

@ -303,7 +303,7 @@ typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
struct PlayerInfo
{
// existence checked by displayId != 0 // existence checked by displayId != 0
PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL)
PlayerInfo() : mapId(0), areaId(0), positionX(0.f), positionY(0.f), positionZ(0.f), orientation(0.f), displayId_m(0), displayId_f(0), levelInfo(nullptr)
{
}

View file

@ -34,7 +34,7 @@
INSTANTIATE_SINGLETON_1(SocialMgr);
PlayerSocial::PlayerSocial()
PlayerSocial::PlayerSocial(): m_playerLowGuid(0)
{
}

View file

@ -83,7 +83,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId);
// Different spell properties
inline float GetSpellRadius(SpellRadiusEntry const* radius) { return (radius ? radius->Radius : 0); }
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL);
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = nullptr);
uint32 GetSpellCastTimeForBonus(SpellEntry const* spellProto, DamageEffectType damagetype);
float CalculateDefaultCoefficient(SpellEntry const* spellProto, DamageEffectType const damagetype);
inline float GetSpellMinRange(SpellRangeEntry const* range, bool friendly = false)

View file

@ -491,9 +491,10 @@ void GlobalCooldownMgr::CancelGlobalCooldown(SpellEntry const* spellInfo)
Unit::Unit() :
movespline(new Movement::MoveSpline()),
m_charmInfo(NULL),
m_charmInfo(nullptr),
i_motionMaster(this),
m_vehicleInfo(NULL),
m_regenTimer(0),
m_vehicleInfo(nullptr),
m_ThreatManager(this),
m_HostileRefManager(this)
{
@ -6454,6 +6455,14 @@ void Unit::Uncharm()
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
// TODO:: find a way to get rid of this bad hack to remove Raise ally aura
if (charm->GetTypeId() == TYPEID_UNIT)
{
uint32 createdBySpellId = charm->GetUInt32Value(UNIT_CREATED_BY_SPELL);
if (static_cast<Creature*>(charm)->IsTemporarySummon() && createdBySpellId)
RemoveAurasDueToSpell(createdBySpellId);
}
}
}

View file

@ -93,13 +93,17 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent
};
ThreatManager* iThreatManager;
public:
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostileReference = NULL; }
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(nullptr)
{ iHostileReference = nullptr; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(nullptr)
{ iHostileReference = pHostileReference; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iFValue = pValue; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(nullptr)
{ iHostileReference = pHostileReference; iFValue = pValue; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iBValue = pValue; }
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(nullptr)
{ iHostileReference = pHostileReference; iBValue = pValue; }
int32 getIValue() const { return iIValue; }

View file

@ -867,9 +867,9 @@ ChatCommand* ChatHandler::getCommandTable()
return commandTable;
}
ChatHandler::ChatHandler(WorldSession* session) : m_session(session) {}
ChatHandler::ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) {}
ChatHandler::ChatHandler(Player* player) : m_session(player->GetSession()) {}
ChatHandler::ChatHandler(Player* player) : m_session(player->GetSession()), sentErrorMessage(false) {}
ChatHandler::~ChatHandler() {}

View file

@ -132,7 +132,7 @@ class ChatHandler
char const* channelName = NULL, uint32 achievementId = 0, const char* addonPrefix = NULL);
protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
explicit ChatHandler() : m_session(nullptr), sentErrorMessage(false) {} // for CLI subclass
bool hasStringAbbr(const char* name, const char* part);
@ -683,6 +683,7 @@ class ChatHandler
bool ExtractPlayerTarget(char** args, Player** player, ObjectGuid* player_guid = NULL, std::string* player_name = NULL);
// select by arg (name/link) or in-game selection online/offline player
std::string petLink(std::string const& name) const { return m_session ? "|cffffffff|Hpet:" + name + "|h[" + name + "]|h|r" : name; }
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:" + name + "|h[" + name + "]|h|r" : name; }
std::string GetNameLink(Player* chr) const;

View file

@ -39,7 +39,7 @@ INSTANTIATE_SINGLETON_2(MapManager, CLASS_LOCK);
INSTANTIATE_CLASS_MUTEX(MapManager, ACE_Recursive_Thread_Mutex);
MapManager::MapManager()
: i_gridCleanUpDelay(sWorld.getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN))
: i_GridStateErrorCount(0), i_gridCleanUpDelay(sWorld.getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN))
{
i_timer.SetInterval(sWorld.getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE));
}

View file

@ -516,7 +516,7 @@ void PoolGroup<Pool>::ReSpawn1Object(MapPersistentState& /*mapState*/, PoolObjec
////////////////////////////////////////////////////////////
// Methods of class PoolManager
PoolManager::PoolManager()
PoolManager::PoolManager(): max_pool_id(0)
{
}

View file

@ -1476,7 +1476,7 @@ bool ScriptAction::HandleScriptStep()
float z = m_script->z;
float o = m_script->o;
Creature* pCreature = pSource->SummonCreature(m_script->summonCreature.creatureEntry, x, y, z, o, m_script->summonCreature.despawnDelay ? TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN : TEMPSUMMON_DEAD_DESPAWN, m_script->summonCreature.despawnDelay, (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) ? true : false);
Creature* pCreature = pSource->SummonCreature(m_script->summonCreature.creatureEntry, x, y, z, o, m_script->summonCreature.despawnDelay ? TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN : TEMPSUMMON_DEAD_DESPAWN, m_script->summonCreature.despawnDelay, (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) ? true : false, m_script->textId[0] == 1);
if (!pCreature)
{
sLog.outErrorDb(" DB-SCRIPTS: Process table `%s` id %u, command %u failed for creature (entry: %u).", m_table, m_script->id, m_script->command, m_script->summonCreature.creatureEntry);

View file

@ -90,6 +90,7 @@ enum DBScriptCommand // resSource, resTar
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any, datalong=db_guid, datalong2=despawn_delay
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any, datalong=creature entry, datalong2=despawn_delay
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = summon active
// dataint = (bool) setRun; 0 = off (default), 1 = on
SCRIPT_COMMAND_OPEN_DOOR = 11, // datalong=db_guid (or not provided), datalong2=reset_delay
SCRIPT_COMMAND_CLOSE_DOOR = 12, // datalong=db_guid (or not provided), datalong2=reset_delay
SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = unit, target=GO

View file

@ -7951,8 +7951,8 @@ void Aura::PeriodicTick()
if (!target->IsAlive())
{ return; }
Powers pt = target->GetPowerType();
if (int32(pt) != m_modifier.m_miscvalue)
Powers powerType = target->GetPowerType();
if (int32(powerType) != m_modifier.m_miscvalue)
{ return; }
if ( spellProto->GetAuraInterruptFlags() & AURA_INTERRUPT_FLAG_NOT_SEATED )
@ -7969,8 +7969,11 @@ void Aura::PeriodicTick()
// Anger Management
// amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3
// so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec
if (pt == POWER_RAGE)
target->ModifyPower(pt, m_modifier.m_amount * 3 / 5);
if (powerType == POWER_RAGE)
target->ModifyPower(powerType, m_modifier.m_amount * 3 / 5);
// Butchery
else if (powerType == POWER_RUNIC_POWER && target->IsInCombat())
target->ModifyPower(powerType, m_modifier.m_amount);
break;
}
// Here tick dummy auras

View file

@ -7555,6 +7555,14 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
unitTarget->CastSpell(unitTarget, 27699, true);
return;
}
case 28352: // Breath of Sargeras
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
unitTarget->CastSpell(unitTarget, 28342, true);
return;
}
case 28374: // Decimate (Naxxramas: Gluth)
case 54426: // Decimate (Naxxramas: Gluth (spells are identical))
case 71123: // Decimate (ICC: Precious / Stinky)
@ -8790,26 +8798,7 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
return;
charmer->RemoveAurasDueToSpell(51923);
// HACK ALERT
// Replace with Spell Interrupting, when casting spells properly is possible in mangos
//charmer->InterruptNonMeleeSpells(true);
Player* player = (Player*)charmer;
Creature* possessed = (Creature*)m_caster;
player->RemoveAurasDueToSpell(51852);
player->SetCharm(nullptr);
player->SetClientControl(possessed, 0);
player->SetMover(nullptr);
player->GetCamera().ResetView();
player->RemovePetActionBar();
possessed->clearUnitState(UNIT_STAT_CONTROLLED);
possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
possessed->SetCharmerGuid(ObjectGuid());
possessed->ForcedDespawn();
charmer->RemoveAurasDueToSpell(51852);
return;
}
case 52751: // Death Gate

View file

@ -148,7 +148,7 @@ void MapManager::LoadTransports()
}
}
Transport::Transport() : GameObject()
Transport::Transport() : GameObject(), m_pathTime(0), m_timer(0), m_nextNodeTime(0), m_period(0)
{
m_updateFlag = UPDATEFLAG_TRANSPORT | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION;
}

View file

@ -48,7 +48,7 @@ class Transport : public GameObject
private:
struct WayPoint
{
WayPoint() : mapid(0), x(0), y(0), z(0), teleport(false) {}
WayPoint() : mapid(0), x(0), y(0), z(0), teleport(false), arrivalEventID(0), departureEventID(0) {}
WayPoint(uint32 _mapid, float _x, float _y, float _z, bool _teleport, uint32 _arrivalEventID = 0, uint32 _departureEventID = 0)
: mapid(_mapid), x(_x), y(_y), z(_z), teleport(_teleport),
arrivalEventID(_arrivalEventID), departureEventID(_departureEventID)

View file

@ -108,7 +108,7 @@ float World::m_relocation_lower_limit_sq = 10.f * 10.f;
uint32 World::m_relocation_ai_notify_delay = 1000u;
/// World constructor
World::World()
World::World(): mail_timer(0), mail_timer_expires(0), m_NextMonthlyQuestReset(0)
{
m_playerLimit = 0;
m_allowMovement = true;

View file

@ -33,6 +33,7 @@
#include "Utilities/Callback.h"
#include <mutex>
#include <memory>
/// ---- BASE ---