Core/Scripts: multiple changes

- fixed non pch build
- fixed some warnings
- fixed some coverity issues
- some random things here and there
This commit is contained in:
joschiwald
2014-12-29 01:00:16 +01:00
parent 21360bb50c
commit 9ecc578cb1
59 changed files with 709 additions and 762 deletions
@@ -134,9 +134,9 @@ namespace Battlenet
void CallHandler(Session* session) override;
PacketHeader Header;
ClosingReason Reason;
ClosingReason Reason = PACKET_CORRUPT;
std::vector<PacketInfo> Packets;
time_t Now;
time_t Now = 0;
};
class Pong final : public ServerPacket
+21 -11
View File
@@ -771,6 +771,13 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
return nullptr;
}
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: entry %u does not exist.", entry);
return nullptr;
}
Creature* creature = new Creature();
if (!creature->Create(sObjectMgr->GetGenerator<HighGuid::Creature>()->Generate(), map, PHASEMASK_NORMAL, entry, x, y, z, o))
{
@@ -778,14 +785,8 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
delete creature;
return nullptr;
}
creature->SetHomePosition(x, y, z, o);
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: entry %u does not exist.", entry);
return nullptr;
}
creature->SetHomePosition(x, y, z, o);
// Set creature in world
map->AddToMap(creature);
@@ -798,18 +799,27 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
{
// Get map object
Map* map = sMapMgr->CreateBaseMap(571); // *vomits*
Map* map = sMapMgr->CreateBaseMap(m_MapId);
if (!map)
return 0;
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Can't create GameObject (Entry: %u). Map not found.", entry);
return nullptr;
}
GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goInfo)
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: GameObject template %u not found in database! Battlefield not created!", entry);
return nullptr;
}
// Create gameobject
GameObject* go = new GameObject;
if (!go->Create(sObjectMgr->GetGenerator<HighGuid::GameObject>()->Generate(), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
delete go;
return NULL;
return nullptr;
}
// Add to world
+17 -34
View File
@@ -27,6 +27,16 @@
namespace DisableMgr
{
char const* MapTypeNames[] =
{
"World",
"Dungeon",
"Raid",
"Battleground",
"Arena",
"Scenario"
};
namespace
{
struct DisableData
@@ -194,30 +204,19 @@ void LoadDisables()
{
case MAP_COMMON:
if (flags & VMAP::VMAP_DISABLE_AREAFLAG)
TC_LOG_INFO("misc", "Areaflag disabled for world map %u.", entry);
TC_LOG_INFO("misc", "Areaflag disabled for %s map %u.", MapTypeNames[mapEntry->InstanceType], entry);
if (flags & VMAP::VMAP_DISABLE_LIQUIDSTATUS)
TC_LOG_INFO("misc", "Liquid status disabled for world map %u.", entry);
TC_LOG_INFO("misc", "Liquid status disabled for %s map %u.", MapTypeNames[mapEntry->InstanceType], entry);
break;
case MAP_INSTANCE:
case MAP_RAID:
if (flags & VMAP::VMAP_DISABLE_HEIGHT)
TC_LOG_INFO("misc", "Height disabled for instance map %u.", entry);
if (flags & VMAP::VMAP_DISABLE_LOS)
TC_LOG_INFO("misc", "LoS disabled for instance map %u.", entry);
break;
case MAP_BATTLEGROUND:
if (flags & VMAP::VMAP_DISABLE_HEIGHT)
TC_LOG_INFO("misc", "Height disabled for battleground map %u.", entry);
if (flags & VMAP::VMAP_DISABLE_LOS)
TC_LOG_INFO("misc", "LoS disabled for battleground map %u.", entry);
break;
case MAP_ARENA:
case MAP_SCENARIO:
if (flags & VMAP::VMAP_DISABLE_HEIGHT)
TC_LOG_INFO("misc", "Height disabled for arena map %u.", entry);
TC_LOG_INFO("misc", "Height disabled for %s map %u.", MapTypeNames[mapEntry->InstanceType], entry);
if (flags & VMAP::VMAP_DISABLE_LOS)
TC_LOG_INFO("misc", "LoS disabled for arena map %u.", entry);
break;
default:
TC_LOG_INFO("misc", "LoS disabled for %s map %u.", MapTypeNames[mapEntry->InstanceType], entry);
break;
}
break;
@@ -230,24 +229,8 @@ void LoadDisables()
TC_LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
switch (mapEntry->InstanceType)
{
case MAP_COMMON:
TC_LOG_INFO("misc", "Pathfinding disabled for world map %u.", entry);
break;
case MAP_INSTANCE:
case MAP_RAID:
TC_LOG_INFO("misc", "Pathfinding disabled for instance map %u.", entry);
break;
case MAP_BATTLEGROUND:
TC_LOG_INFO("misc", "Pathfinding disabled for battleground map %u.", entry);
break;
case MAP_ARENA:
TC_LOG_INFO("misc", "Pathfinding disabled for arena map %u.", entry);
break;
default:
break;
}
if (mapEntry->InstanceType <= MAP_SCENARIO)
TC_LOG_INFO("misc", "Pathfinding disabled for %s map %u.", MapTypeNames[mapEntry->InstanceType], entry);
break;
}
default:
+2 -2
View File
@@ -66,8 +66,8 @@ inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, D
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T),
"Size of '%s' set by format string (%u) not equal size of C++ structure (%u).",
DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename.c_str());
"Size of '%s' set by format string (" SZFMTD ") not equal size of C++ structure (%u).",
filename.c_str(), DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T));
++DB2FilesCount;
-2
View File
@@ -20,8 +20,6 @@
#include "DB2Store.h"
#include "DB2Structure.h"
#include <string>
#include <map>
#include "SharedDefines.h"
extern DB2Storage<BroadcastTextEntry> sBroadcastTextStore;
-3
View File
@@ -19,13 +19,10 @@
#ifndef TRINITY_DBCSTORES_H
#define TRINITY_DBCSTORES_H
#include "Common.h"
#include "DBCStore.h"
#include "DBCStructure.h"
#include "SharedDefines.h"
#include <list>
typedef std::map<uint32, uint32> SpecializationOverrideSpellsList;
typedef std::map<uint32, SpecializationOverrideSpellsList> SpecializationOverrideSpellsMap;
@@ -21,7 +21,6 @@
#include "Common.h"
#include "DBCEnums.h"
#include "Define.h"
#include "Path.h"
#include "Util.h"
@@ -57,7 +56,6 @@ struct AchievementEntry
uint32 CriteriaTree; // 14
};
//19116
struct AchievementCategoryEntry
{
uint32 ID; // 0
@@ -1708,14 +1706,11 @@ struct SpellItemEnchantmentConditionEntry
{
uint32 ID; // 0
uint8 LTOperandType[5]; // 1-2
//uint8 Padding[3]; // 1-2
uint32 LTOperand[5]; // 2-6
uint8 Operator[5]; // 7-8
uint8 RTOperandType[5]; // 8-9
//uint8 Padding[2]; // 9
uint32 RTOperand[5]; // 10-14
uint8 Logic[5]; // 15-16
//uint8 Padding[3]; // 16
};
struct StableSlotPricesEntry
+1 -1
View File
@@ -1577,7 +1577,7 @@ LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid)
}
uint8 level = player->getLevel();
uint8 expansion = player->GetSession()->Expansion();
uint8 expansion = player->GetSession()->GetExpansion();
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
bool denyJoin = !player->GetSession()->HasPermission(rbac::RBAC_PERM_JOIN_DUNGEON_FINDER);
+17 -48
View File
@@ -44,8 +44,8 @@
#include "UpdateFieldFlags.h"
#include "TemporarySummon.h"
#include "Totem.h"
#include "MovementPackets.h"
#include "OutdoorPvPMgr.h"
#include "MovementPacketBuilder.h"
#include "DynamicTree.h"
#include "Unit.h"
#include "Group.h"
@@ -432,24 +432,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
data->WriteBit(0); // RemoteTimeValid
if (!unit->m_movementInfo.transport.guid.IsEmpty())
{
*data << unit->m_movementInfo.transport.guid; // Transport Guid
*data << float(unit->GetTransOffsetX());
*data << float(unit->GetTransOffsetY());
*data << float(unit->GetTransOffsetZ());
*data << float(unit->GetTransOffsetO());
*data << int8(unit->m_movementInfo.transport.seat); // VehicleSeatIndex
*data << uint32(unit->m_movementInfo.transport.time); // MoveTime
data->WriteBit(unit->m_movementInfo.transport.prevTime != 0);
data->WriteBit(unit->m_movementInfo.transport.vehicleId != 0);
if (unit->m_movementInfo.transport.prevTime)
*data << uint32(unit->m_movementInfo.transport.prevTime); // PrevMoveTime
if (unit->m_movementInfo.transport.vehicleId)
*data << uint32(unit->m_movementInfo.transport.vehicleId); // VehicleRecID
}
*data << unit->m_movementInfo.transport;
if (HasFall)
{
@@ -488,28 +471,13 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
// HasMovementSpline - marks that spline data is present in packet
if (data->WriteBit(HasSpline))
Movement::PacketBuilder::WriteCreate(*unit->movespline, *data);
WorldPackets::Movement::CommonMovement::WriteCreateObjectSplineDataBlock(*unit->movespline, *data);
}
if (HasMovementTransport)
{
WorldObject const* self = static_cast<WorldObject const*>(this);
*data << self->m_movementInfo.transport.guid; // Transport Guid
*data << float(self->GetTransOffsetX());
*data << float(self->GetTransOffsetY());
*data << float(self->GetTransOffsetZ());
*data << float(self->GetTransOffsetO());
*data << int8(self->m_movementInfo.transport.seat); // VehicleSeatIndex
*data << uint32(self->m_movementInfo.transport.time); // MoveTime
data->WriteBit(self->m_movementInfo.transport.prevTime != 0);
data->WriteBit(self->m_movementInfo.transport.vehicleId != 0);
if (self->m_movementInfo.transport.prevTime)
*data << uint32(self->m_movementInfo.transport.prevTime); // PrevMoveTime
if (self->m_movementInfo.transport.vehicleId)
*data << uint32(self->m_movementInfo.transport.vehicleId); // VehicleRecID
*data << self->m_movementInfo.transport;
}
if (Stationary)
@@ -1506,7 +1474,7 @@ bool Position::operator==(Position const &a)
return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
G3D::fuzzyEq(a.m_positionY, m_positionY) &&
G3D::fuzzyEq(a.m_positionZ, m_positionZ) &&
G3D::fuzzyEq(a.m_orientation, m_orientation));
G3D::fuzzyEq(a._orientation, _orientation));
}
bool Position::HasInLine(WorldObject const* target, float width) const
@@ -1521,7 +1489,7 @@ bool Position::HasInLine(WorldObject const* target, float width) const
std::string Position::ToString() const
{
std::stringstream sstr;
sstr << "X: " << m_positionX << " Y: " << m_positionY << " Z: " << m_positionZ << " O: " << m_orientation;
sstr << "X: " << m_positionX << " Y: " << m_positionY << " Z: " << m_positionZ << " O: " << _orientation;
return sstr.str();
}
@@ -1529,14 +1497,14 @@ ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
{
float x, y, z, o;
buf >> x >> y >> z >> o;
streamer.m_pos->Relocate(x, y, z, o);
streamer.Pos->Relocate(x, y, z, o);
return buf;
}
ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer)
{
float x, y, z;
streamer.m_pos->GetPosition(x, y, z);
buf << x << y << z;
buf << streamer.Pos->GetPositionX();
buf << streamer.Pos->GetPositionY();
buf << streamer.Pos->GetPositionZ();
return buf;
}
@@ -1544,15 +1512,16 @@ ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const& str
{
float x, y, z;
buf >> x >> y >> z;
streamer.m_pos->Relocate(x, y, z);
streamer.Pos->Relocate(x, y, z);
return buf;
}
ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer)
{
float x, y, z, o;
streamer.m_pos->GetPosition(x, y, z, o);
buf << x << y << z << o;
buf << streamer.Pos->GetPositionX();
buf << streamer.Pos->GetPositionY();
buf << streamer.Pos->GetPositionZ();
buf << streamer.Pos->GetOrientation();
return buf;
}
@@ -1989,7 +1958,7 @@ bool Position::HasInArc(float arc, const Position* obj, float border) const
arc = NormalizeOrientation(arc);
float angle = GetAngle(obj);
angle -= m_orientation;
angle -= _orientation;
// move angle to range -pi ... +pi
angle = NormalizeOrientation(angle);
@@ -2136,7 +2105,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
bool Position::IsPositionValid() const
{
return Trinity::IsValidMapCoord(m_positionX, m_positionY, m_positionZ, m_orientation);
return Trinity::IsValidMapCoord(m_positionX, m_positionY, m_positionZ, _orientation);
}
float WorldObject::GetGridActivationRange() const
+17 -17
View File
@@ -261,30 +261,30 @@ class Object
struct Position
{
Position(float x = 0, float y = 0, float z = 0, float o = 0)
: m_positionX(x), m_positionY(y), m_positionZ(z), m_orientation(NormalizeOrientation(o)) { }
: m_positionX(x), m_positionY(y), m_positionZ(z), _orientation(NormalizeOrientation(o)) { }
Position(const Position &loc) { Relocate(loc); }
Position(Position const& loc) { Relocate(loc); }
struct PositionXYZStreamer
{
explicit PositionXYZStreamer(Position& pos) : m_pos(&pos) { }
Position* m_pos;
explicit PositionXYZStreamer(Position& pos) : Pos(&pos) { }
Position* Pos;
};
struct PositionXYZOStreamer
{
explicit PositionXYZOStreamer(Position& pos) : m_pos(&pos) { }
Position* m_pos;
explicit PositionXYZOStreamer(Position& pos) : Pos(&pos) { }
Position* Pos;
};
float m_positionX;
float m_positionY;
float m_positionZ;
// Better to limit access to m_orientation field, but this will be hard to achieve with many scripts using array initialization for this structure
//private:
float m_orientation;
//public:
// Better to limit access to _orientation field, to guarantee the value is normalized
private:
float _orientation;
public:
bool operator==(Position const &a);
inline bool operator!=(Position const &a)
@@ -299,24 +299,24 @@ struct Position
void Relocate(float x, float y, float z, float orientation)
{ m_positionX = x; m_positionY = y; m_positionZ = z; SetOrientation(orientation); }
void Relocate(Position const &pos)
{ m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; SetOrientation(pos.m_orientation); }
{ m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; SetOrientation(pos._orientation); }
void Relocate(Position const* pos)
{ m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; SetOrientation(pos->m_orientation); }
{ m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; SetOrientation(pos->_orientation); }
void RelocateOffset(Position const &offset);
void SetOrientation(float orientation)
{ m_orientation = NormalizeOrientation(orientation); }
{ _orientation = NormalizeOrientation(orientation); }
float GetPositionX() const { return m_positionX; }
float GetPositionY() const { return m_positionY; }
float GetPositionZ() const { return m_positionZ; }
float GetOrientation() const { return m_orientation; }
float GetOrientation() const { return _orientation; }
void GetPosition(float &x, float &y) const
{ x = m_positionX; y = m_positionY; }
void GetPosition(float &x, float &y, float &z) const
{ x = m_positionX; y = m_positionY; z = m_positionZ; }
void GetPosition(float &x, float &y, float &z, float &o) const
{ x = m_positionX; y = m_positionY; z = m_positionZ; o = m_orientation; }
{ x = m_positionX; y = m_positionY; z = m_positionZ; o = _orientation; }
Position GetPosition() const
{
@@ -357,8 +357,8 @@ struct Position
float GetAngle(Position const* pos) const;
float GetAngle(float x, float y) const;
float GetRelativeAngle(Position const* pos) const
{ return GetAngle(pos) - m_orientation; }
float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
{ return GetAngle(pos) - _orientation; }
float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - _orientation; }
void GetSinCos(float x, float y, float &vsin, float &vcos) const;
bool IsInDist2d(float x, float y, float dist) const
@@ -72,7 +72,7 @@ char const* TypeNames[] =
char const* ObjectGuid::GetTypeName(HighGuid high)
{
if (high > HighGuid::Count)
if (high >= HighGuid::Count)
return "<unknown>";
return TypeNames[uint32(high)];
+3 -3
View File
@@ -1979,7 +1979,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
return false;
// client without expansion support
if (GetSession()->Expansion() < mEntry->Expansion())
if (GetSession()->GetExpansion() < mEntry->Expansion())
{
TC_LOG_DEBUG("maps", "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid);
@@ -16962,7 +16962,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)
// client without expansion support
if (mapEntry)
{
if (GetSession()->Expansion() < mapEntry->Expansion())
if (GetSession()->GetExpansion() < mapEntry->Expansion())
{
TC_LOG_DEBUG("entities.player.loading", "Player %s using client without required expansion tried login at non accessible map %u", GetName().c_str(), mapId);
RelocateToHomebind();
@@ -18743,7 +18743,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
// accept saved data only for valid position (and non instanceable), and accessable
if (MapManager::IsValidMapCoord(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ) &&
!bindMapEntry->Instanceable() && GetSession()->Expansion() >= bindMapEntry->Expansion())
!bindMapEntry->Instanceable() && GetSession()->GetExpansion() >= bindMapEntry->Expansion())
ok = true;
else
{
+4 -6
View File
@@ -7688,15 +7688,13 @@ void Unit::SetMinion(Minion *minion, bool apply)
}
}
void Unit::GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry)
void Unit::GetAllMinionsByEntry(std::list<TempSummon*>& Minions, uint32 entry)
{
for (Unit::ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
for (Unit::ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
{
Unit* unit = *itr;
++itr;
if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
&& unit->ToCreature()->IsSummon()) // minion, actually
Minions.push_back(unit->ToCreature());
if (unit->GetEntry() == entry && unit->IsSummon()) // minion, actually
Minions.push_back(unit->ToTempSummon());
}
}
+1 -1
View File
@@ -1731,7 +1731,7 @@ class Unit : public WorldObject
Player* GetAffectingPlayer() const;
void SetMinion(Minion *minion, bool apply);
void GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry);
void GetAllMinionsByEntry(std::list<TempSummon*>& Minions, uint32 entry);
void RemoveAllMinionsByEntry(uint32 entry);
void SetCharm(Unit* target, bool apply);
Unit* GetNextRandomRaidMemberOrPet(float radius);
+11 -10
View File
@@ -584,17 +584,18 @@ void ObjectMgr::LoadCreatureTemplateAddons()
creatureAddon.auras.resize(tokens.size());
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(atoul(*itr));
uint32 spellId = uint32(atoul(*itr));
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!AdditionalSpellInfo)
{
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong spell %lu defined in `auras` field in `creature_template_addon`.", entry, atoul(*itr));
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, spellId);
continue;
}
if (AdditionalSpellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_CONTROL_VEHICLE))
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr)));
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_template_addon`.", entry, spellId);
creatureAddon.auras[i++] = atoul(*itr);
creatureAddon.auras[i++] = spellId;
}
if (creatureAddon.mount)
@@ -1041,18 +1042,18 @@ void ObjectMgr::LoadCreatureAddons()
creatureAddon.auras.resize(tokens.size());
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(atoul(*itr));
uint32 spellId = uint32(atoul(*itr));
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!AdditionalSpellInfo)
{
TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has wrong spell %lu defined in `auras` field in `creature_addon`.", guid, atoul(*itr));
TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has wrong spell %u defined in `auras` field in `creature_addon`.", guid, spellId);
continue;
}
if (AdditionalSpellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_CONTROL_VEHICLE))
TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
TC_LOG_ERROR("sql.sql", "Creature (GUID: " UI64FMTD ") has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, spellId);
creatureAddon.auras[i++] = atoul(*itr);
creatureAddon.auras[i++] = spellId;
}
if (creatureAddon.mount)
@@ -6811,7 +6812,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
continue;
}
if (factionSpillover->ReputationIndex < 0)
if (!factionSpillover->CanHaveReputation())
{
TC_LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId);
continue;
+2 -2
View File
@@ -30,8 +30,8 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
response.WaitInfo.Value.WaitCount = queuePos;
if (code == AUTH_OK)
{
response.SuccessInfo.Value.AccountExpansionLevel = Expansion();
response.SuccessInfo.Value.ActiveExpansionLevel = Expansion();
response.SuccessInfo.Value.AccountExpansionLevel = GetExpansion();
response.SuccessInfo.Value.ActiveExpansionLevel = GetExpansion();
response.SuccessInfo.Value.VirtualRealmAddress = GetVirtualRealmAddress();
std::string realmName = sObjectMgr->GetRealmName(realmHandle.Index);
@@ -370,18 +370,18 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateChar& c
// prevent character creating Expansion race without Expansion account
uint8 raceExpansionRequirement = sObjectMgr->GetRaceExpansionRequirement(charCreate.CreateInfo->Race);
if (raceExpansionRequirement > Expansion())
if (raceExpansionRequirement > GetExpansion())
{
TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceExpansionRequirement, charCreate.CreateInfo->Race);
TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", GetExpansion(), GetAccountId(), raceExpansionRequirement, charCreate.CreateInfo->Race);
SendCharCreate(CHAR_CREATE_EXPANSION);
return;
}
// prevent character creating Expansion class without Expansion account
uint8 classExpansionRequirement = sObjectMgr->GetClassExpansionRequirement(charCreate.CreateInfo->Class);
if (classExpansionRequirement > Expansion())
if (classExpansionRequirement > GetExpansion())
{
TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classExpansionRequirement, charCreate.CreateInfo->Class);
TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", GetExpansion(), GetAccountId(), classExpansionRequirement, charCreate.CreateInfo->Class);
SendCharCreate(CHAR_CREATE_EXPANSION_CLASS);
return;
}
+1 -1
View File
@@ -287,7 +287,7 @@ void WorldSession::SendLfgPlayerLockInfo()
// Get Random dungeons that can be done at a certain level and expansion
uint8 level = GetPlayer()->getLevel();
lfg::LfgDungeonSet const& randomDungeons =
sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion());
sLFGMgr->GetRandomAndSeasonalDungeons(level, GetExpansion());
// Get player locked Dungeons
lfg::LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid);
+3 -4
View File
@@ -135,11 +135,10 @@ void WorldSession::HandleCreatureQuery(WorldPackets::Query::QueryCreature& packe
void WorldSession::HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObject& packet)
{
WorldPackets::Query::QueryGameObjectResponse response;
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(packet.Entry);
response.Entry = packet.Entry;
response.GameObjectID = packet.GameObjectID;
if (gameObjectInfo)
if (GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(packet.GameObjectID))
{
response.Allow = true;
WorldPackets::Query::GameObjectStats& stats = response.Stats;
@@ -419,7 +418,7 @@ void WorldSession::HandleDBQueryBulk(WorldPackets::Query::DBQueryBulk& packet)
return;
}
for (WorldPackets::Query::DBQueryRecord const& rec : packet.Queries)
for (WorldPackets::Query::DBQueryBulk::DBQueryRecord const& rec : packet.Queries)
{
WorldPackets::Query::DBReply response;
response.TableHash = packet.TableHash;
+1 -1
View File
@@ -775,7 +775,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
if (pOther->GetTeam() != _player->GetTeam() &&
(!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) &&
!GetPlayer()->GetSession()->HasPermission(rbac::RBAC_PERM_ALLOW_TWO_SIDE_TRADE)))
!HasPermission(rbac::RBAC_PERM_ALLOW_TWO_SIDE_TRADE)))
{
info.Status = TRADE_STATUS_WRONG_FACTION;
SendTradeStatus(info);
+14 -2
View File
@@ -22,6 +22,15 @@
#include "Spline.h"
#include "MoveSplineInitArgs.h"
namespace WorldPackets
{
namespace Movement
{
class CommonMovement;
class MonsterMove;
}
}
namespace Movement
{
struct Location : public Vector3
@@ -36,11 +45,15 @@ namespace Movement
// MoveSpline represents smooth catmullrom or linear curve and point that moves belong it
// curve can be cyclic - in this case movement will be cyclic
// point can have vertical acceleration motion componemt(used in fall, parabolic movement)
// point can have vertical acceleration motion component (used in fall, parabolic movement)
class MoveSpline
{
friend class WorldPackets::Movement::CommonMovement;
friend class WorldPackets::Movement::MonsterMove;
public:
typedef Spline<int32> MySpline;
enum UpdateResult
{
Result_None = 0x01,
@@ -48,7 +61,6 @@ namespace Movement
Result_NextCycle = 0x04,
Result_NextSegment = 0x08
};
friend class PacketBuilder;
protected:
MySpline spline;
@@ -18,9 +18,8 @@
#ifndef TRINITYSERVER_MOVESPLINEFLAG_H
#define TRINITYSERVER_MOVESPLINEFLAG_H
#include "MovementTypedefs.h"
#include <string>
#include "MovementTypedefs.h"
namespace Movement
{
@@ -18,7 +18,6 @@
#include "MoveSplineInit.h"
#include "MoveSpline.h"
#include "MovementPacketBuilder.h"
#include "Unit.h"
#include "Transport.h"
#include "Vehicle.h"
@@ -119,7 +118,7 @@ namespace Movement
WorldPackets::Movement::MonsterMove packet;
packet.MoverGUID = unit->GetGUID();
packet.Pos = real_position;
PacketBuilder::WriteMonsterMove(move_spline, packet.SplineData);
packet.InitializeSplineData(move_spline);
unit->SendMessageToSet(packet.Write(), true);
return move_spline.Duration();
@@ -1,182 +0,0 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "MovementPacketBuilder.h"
#include "MoveSpline.h"
#include "WorldPacket.h"
#include "Object.h"
#include "MovementPackets.h"
namespace Movement
{
void PacketBuilder::WriteMonsterMove(const MoveSpline& move_spline, WorldPackets::Movement::MovementMonsterSpline& movementMonsterSpline)
{
movementMonsterSpline.ID = move_spline.m_Id;
WorldPackets::Movement::MovementSpline& movementSpline = movementMonsterSpline.Move;
MoveSplineFlag splineflags = move_spline.splineflags;
splineflags.enter_cycle = move_spline.isCyclic();
movementSpline.Flags = uint32(splineflags & uint32(~MoveSplineFlag::Mask_No_Monster_Move));
switch (move_spline.splineflags & MoveSplineFlag::Mask_Final_Facing)
{
case MoveSplineFlag::Final_Point:
movementSpline.Face = MONSTER_MOVE_FACING_SPOT;
movementSpline.FaceSpot = move_spline.facing.f;
break;
case MoveSplineFlag::Final_Target:
movementSpline.Face = MONSTER_MOVE_FACING_TARGET;
movementSpline.FaceGUID = move_spline.facing.target;
break;
case MoveSplineFlag::Final_Angle:
movementSpline.Face = MONSTER_MOVE_FACING_ANGLE;
movementSpline.FaceDirection = move_spline.facing.angle;
break;
default:
movementSpline.Face = MONSTER_MOVE_NORMAL;
break;
}
if (splineflags.animation)
{
movementSpline.AnimTier = splineflags.getAnimationId();
movementSpline.TierTransStartTime = move_spline.effect_start_time;
}
movementSpline.MoveTime = move_spline.Duration();
if (splineflags.parabolic)
{
movementSpline.JumpGravity = move_spline.vertical_acceleration;
movementSpline.SpecialTime = move_spline.effect_start_time;
}
Spline<int32> const& spline = move_spline.spline;
std::vector<Vector3> const& array = spline.getPoints();
if (splineflags & MoveSplineFlag::UncompressedPath)
{
if (!splineflags.cyclic)
{
uint32 count = spline.getPointCount() - 3;
for (uint32 i = 2; i < count; ++i)
movementSpline.Points.push_back(array[i]);
}
else
{
uint32 count = spline.getPointCount() - 3;
movementSpline.Points.push_back(array[1]);
for (uint32 i = 1; i < count; ++i)
movementSpline.Points.push_back(array[i]);
}
}
else
{
uint32 last_idx = spline.getPointCount() - 3;
Vector3 const* real_path = &spline.getPoint(1);
movementSpline.Points.push_back(real_path[last_idx]);
if (last_idx > 1)
{
Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
Vector3 offset;
// first and last points already appended
for (uint32 i = 1; i < last_idx; ++i)
{
offset = middle - real_path[i];
movementSpline.PackedDeltas.push_back(offset);
}
}
}
}
void PacketBuilder::WriteCreate(MoveSpline const& moveSpline, ByteBuffer& data)
{
data << uint32(moveSpline.GetId()); // ID
if (!moveSpline.isCyclic()) // Destination
{
Vector3 dest = moveSpline.FinalDestination();
data << float(dest.z);
data << float(dest.x);
data << float(dest.y);
}
else
data << Vector3::zero();
if (data.WriteBit(!moveSpline.Finalized())) // MovementSplineMove
{
MoveSplineFlag const& splineFlags = moveSpline.splineflags;
data.FlushBits();
data.WriteBits(moveSpline.splineflags.raw(), 25); // SplineFlags
if (splineFlags.final_angle)
data.WriteBits(3, 2); // Face
else if (splineFlags.final_target)
data.WriteBits(2, 2); // Face
else if (splineFlags.final_point)
data.WriteBits(1, 2); // Face
else
data.WriteBits(0, 2); // Face
bool HasJumpGravity = data.WriteBit(moveSpline.splineflags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation)); // HasJumpGravity
bool HasSpecialTime = data.WriteBit((moveSpline.splineflags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration()); // HasSpecialTime
data.WriteBits(uint8(moveSpline.spline.mode()), 2); // Mode
data.WriteBit(0); // HasSplineFilterKey
data << int32(moveSpline.timePassed()); // Elapsed
data << uint32(moveSpline.Duration()); // Duration
data << float(1.0f); // DurationModifier
data << float(1.0f); // NextDurationModifier
uint32 PointsCount = moveSpline.getPath().size();
data << uint32(PointsCount);
if (splineFlags.final_angle) // FaceDirection
data << moveSpline.facing.angle;
else if (splineFlags.final_target) // FaceGUID
data << moveSpline.facing.target;
else if (splineFlags.final_point) // FaceSpot
data << moveSpline.facing.f.x << moveSpline.facing.f.y << moveSpline.facing.f.z;
if (HasJumpGravity)
data << float(moveSpline.vertical_acceleration); // JumpGravity
if (HasSpecialTime)
data << uint32(moveSpline.effect_start_time); // SpecialTime
//if (HasSplineFilterKey)
//{
// data << uint32(FilterKeysCount);
// for (var i = 0; i < PointsCount; ++i)
// {
// data << float(In);
// data << float(Out);
// }
// data.WriteBits(FilterFlags, 2);
//}
data.append<Vector3>(&moveSpline.getPath()[0], PointsCount); // Points
}
}
}
@@ -1,41 +0,0 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRINITYSERVER_PACKET_BUILDER_H
#define TRINITYSERVER_PACKET_BUILDER_H
#include "Define.h" // for uint32
#include "G3D/Vector3.h"
#include "MovementPackets.h"
using G3D::Vector3;
class ByteBuffer;
class WorldPacket;
namespace Movement
{
class MoveSpline;
class PacketBuilder
{
public:
static void WriteMonsterMove(const MoveSpline& mov, WorldPackets::Movement::MovementMonsterSpline& movementMonsterSpline);
static void WriteCreate(MoveSpline const& moveSpline, ByteBuffer& data);
};
}
#endif // TRINITYSERVER_PACKET_BUILDER_H
@@ -21,14 +21,6 @@
#include "Common.h"
enum MonsterMoveType
{
MONSTER_MOVE_NORMAL = 0,
MONSTER_MOVE_FACING_SPOT = 1,
MONSTER_MOVE_FACING_TARGET = 2,
MONSTER_MOVE_FACING_ANGLE = 3
};
namespace G3D
{
class Vector3;
@@ -40,6 +32,14 @@ namespace Movement
using G3D::Vector3;
using G3D::Vector4;
enum MonsterMoveType
{
MONSTER_MOVE_NORMAL = 0,
MONSTER_MOVE_FACING_SPOT = 1,
MONSTER_MOVE_FACING_TARGET = 2,
MONSTER_MOVE_FACING_ANGLE = 3
};
inline uint32 SecToMS(float sec)
{
return static_cast<uint32>(sec * 1000.f);
@@ -17,8 +17,6 @@
*/
#include "MoveSplineFlag.h"
#include <cmath>
#include <string>
namespace Movement
{
@@ -85,103 +83,100 @@ namespace Movement
return result;
}
#define STR(x) #x
char const* g_MovementFlag_names[] =
char const* MovementFlagNames[] =
{
STR(Forward ), // 0x00000001,
STR(Backward ), // 0x00000002,
STR(Strafe_Left ), // 0x00000004,
STR(Strafe_Right ), // 0x00000008,
STR(Turn_Left ), // 0x00000010,
STR(Turn_Right ), // 0x00000020,
STR(Pitch_Up ), // 0x00000040,
STR(Pitch_Down ), // 0x00000080,
STR(Walking ), // 0x00000100, // Walking
STR(DisableGravity ), // 0x00000200,
STR(Root ), // 0x00000400,
STR(Falling ), // 0x00000800,
STR(FallingFar ), // 0x00001000,
STR(PendingStop ), // 0x00002000,
STR(PendingStrafeStop ), // 0x00004000,
STR(PendingForward ), // 0x00008000,
STR(PendingBackward ), // 0x00010000,
STR(PendingStrafeLeft ), // 0x00020000,
STR(PendingStrafeRight ), // 0x00040000,
STR(PendingRoot ), // 0x00080000,
STR(Swimming ), // 0x00100000, // Appears With Fly Flag Also
STR(Ascending ), // 0x00200000, // Swim Up Also
STR(Descending ), // 0x00400000, // Swim Down Also
STR(Can_Fly ), // 0x00800000, // Can Fly In 3.3?
STR(Flying ), // 0x01000000, // Actual Flying Mode
STR(Spline_Elevation ), // 0x02000000, // Used For Flight Paths
STR(Waterwalking ), // 0x04000000, // Prevent Unit From Falling Through Water
STR(Safe_Fall ), // 0x08000000, // Active Rogue Safe Fall Spell (Passive)
STR(Hover ), // 0x10000000
STR(Local_Dirty ), // 0x20000000
STR(None31 ), // 0x40000000
STR(None32 ), // 0x80000000
STRINGIZE(Forward ), // 0x00000001
STRINGIZE(Backward ), // 0x00000002
STRINGIZE(Strafe_Left ), // 0x00000004
STRINGIZE(Strafe_Right ), // 0x00000008
STRINGIZE(Turn_Left ), // 0x00000010
STRINGIZE(Turn_Right ), // 0x00000020
STRINGIZE(Pitch_Up ), // 0x00000040
STRINGIZE(Pitch_Down ), // 0x00000080
STRINGIZE(Walking ), // 0x00000100 // Walking
STRINGIZE(DisableGravity ), // 0x00000200
STRINGIZE(Root ), // 0x00000400
STRINGIZE(Falling ), // 0x00000800
STRINGIZE(FallingFar ), // 0x00001000
STRINGIZE(PendingStop ), // 0x00002000
STRINGIZE(PendingStrafeStop ), // 0x00004000
STRINGIZE(PendingForward ), // 0x00008000
STRINGIZE(PendingBackward ), // 0x00010000
STRINGIZE(PendingStrafeLeft ), // 0x00020000
STRINGIZE(PendingStrafeRight), // 0x00040000
STRINGIZE(PendingRoot ), // 0x00080000
STRINGIZE(Swimming ), // 0x00100000 // Appears With Fly Flag Also
STRINGIZE(Ascending ), // 0x00200000 // Swim Up Also
STRINGIZE(Descending ), // 0x00400000 // Swim Down Also
STRINGIZE(Can_Fly ), // 0x00800000 // Can Fly In 3.3?
STRINGIZE(Flying ), // 0x01000000 // Actual Flying Mode
STRINGIZE(Spline_Elevation ), // 0x02000000 // Used For Flight Paths
STRINGIZE(Waterwalking ), // 0x04000000 // Prevent Unit From Falling Through Water
STRINGIZE(Safe_Fall ), // 0x08000000 // Active Rogue Safe Fall Spell (Passive)
STRINGIZE(Hover ), // 0x10000000
STRINGIZE(Local_Dirty ), // 0x20000000
STRINGIZE(None31 ), // 0x40000000
STRINGIZE(None32 ), // 0x80000000
};
char const* g_MovementFlagExtra_names[] =
char const* MovementFlagExtraNames[] =
{
STR(NoStrafe ),
STR(NoJump ),
STR(FullSpeedTurning ),
STR(FullSpeedPitching ),
STR(Allow_Pitching ),
STR(Unk6 ),
STR(Unk7 ),
STR(Unk8 ),
STR(Unk9 ),
STR(Unk10 ),
STR(Unk11 ),
STR(Unk12 ),
STR(Unk13 ),
STR(Interpolated_Movement),
STR(Interpolated_Turning ),
STR(Interpolated_Pitching),
STRINGIZE(NoStrafe ),
STRINGIZE(NoJump ),
STRINGIZE(FullSpeedTurning ),
STRINGIZE(FullSpeedPitching ),
STRINGIZE(Allow_Pitching ),
STRINGIZE(Unk6 ),
STRINGIZE(Unk7 ),
STRINGIZE(Unk8 ),
STRINGIZE(Unk9 ),
STRINGIZE(Unk10 ),
STRINGIZE(Unk11 ),
STRINGIZE(Unk12 ),
STRINGIZE(Unk13 ),
STRINGIZE(Interpolated_Movement),
STRINGIZE(Interpolated_Turning ),
STRINGIZE(Interpolated_Pitching),
};
char const* g_SplineFlag_names[32] =
char const* SplineFlagNames[32] =
{
STR(AnimBit1 ), // 0x00000001,
STR(AnimBit2 ), // 0x00000002,
STR(AnimBit3 ), // 0x00000004,
STR(Unknown0 ), // 0x00000008,
STR(FallingSlow ), // 0x00000010,
STR(Done ), // 0x00000020,
STR(Falling ), // 0x00000040, // Not Compartible With Trajectory Movement
STR(No_Spline ), // 0x00000080,
STR(Unknown2 ), // 0x00000100,
STR(Flying ), // 0x00000200, // Smooth Movement(Catmullrom Interpolation Mode), Flying Animation
STR(OrientationFixed ), // 0x00000400, // Model Orientation Fixed
STR(Catmullrom ), // 0x00000800, // Used Catmullrom Interpolation Mode
STR(Cyclic ), // 0x00001000, // Movement By Cycled Spline
STR(Enter_Cycle ), // 0x00002000, // Everytime Appears With Cyclic Flag In Monster Move Packet
STR(Frozen ), // 0x00004000,
STR(TransportEnter ), // 0x00008000
STR(TransportExit ), // 0x00010000
STR(Unknown3 ), // 0x00020000,
STR(Unknown4 ), // 0x00040000,
STR(OrientationInversed), // 0x00080000, // Appears With Runmode Flag, Nodes ), // 1, Handles Orientation
STR(SmoothGroundPath ), // 0x00100000,
STR(Walkmode ), // 0x00200000,
STR(UncompressedPath ), // 0x00400000,
STR(Unknown6 ), // 0x00800000,
STR(Animation ), // 0x01000000, // Animationid (0...3), Uint32 Time, Not Compartible With Trajectory And Fall Movement
STR(Parabolic ), // 0x02000000, // Not Compartible With Fall Movement
STR(Final_Point ), // 0x04000000,
STR(Final_Target ), // 0x08000000,
STR(Final_Angle ), // 0x10000000,
STR(Unknown7 ), // 0x20000000,
STR(Unknown8 ), // 0x40000000,
STR(Unknown9 ), // 0x80000000,
STRINGIZE(AnimBit1 ), // 0x00000001
STRINGIZE(AnimBit2 ), // 0x00000002
STRINGIZE(AnimBit3 ), // 0x00000004
STRINGIZE(Unknown0 ), // 0x00000008
STRINGIZE(FallingSlow ), // 0x00000010
STRINGIZE(Done ), // 0x00000020
STRINGIZE(Falling ), // 0x00000040 // Not Compartible With Trajectory Movement
STRINGIZE(No_Spline ), // 0x00000080
STRINGIZE(Unknown2 ), // 0x00000100
STRINGIZE(Flying ), // 0x00000200 // Smooth Movement(Catmullrom Interpolation Mode), Flying Animation
STRINGIZE(OrientationFixed ), // 0x00000400 // Model Orientation Fixed
STRINGIZE(Catmullrom ), // 0x00000800 // Used Catmullrom Interpolation Mode
STRINGIZE(Cyclic ), // 0x00001000 // Movement By Cycled Spline
STRINGIZE(Enter_Cycle ), // 0x00002000 // Everytime Appears With Cyclic Flag In Monster Move Packet
STRINGIZE(Frozen ), // 0x00004000
STRINGIZE(TransportEnter ), // 0x00008000
STRINGIZE(TransportExit ), // 0x00010000
STRINGIZE(Unknown3 ), // 0x00020000
STRINGIZE(Unknown4 ), // 0x00040000
STRINGIZE(OrientationInversed), // 0x00080000 // Appears With Runmode Flag, Nodes ), // 1, Handles Orientation
STRINGIZE(SmoothGroundPath ), // 0x00100000
STRINGIZE(Walkmode ), // 0x00200000
STRINGIZE(UncompressedPath ), // 0x00400000
STRINGIZE(Unknown6 ), // 0x00800000
STRINGIZE(Animation ), // 0x01000000 // Animationid (0...3), Uint32 Time, Not Compartible With Trajectory And Fall Movement
STRINGIZE(Parabolic ), // 0x02000000 // Not Compartible With Fall Movement
STRINGIZE(Final_Point ), // 0x04000000
STRINGIZE(Final_Target ), // 0x08000000
STRINGIZE(Final_Angle ), // 0x10000000
STRINGIZE(Unknown7 ), // 0x20000000
STRINGIZE(Unknown8 ), // 0x40000000
STRINGIZE(Unknown9 ), // 0x80000000
};
template<class Flags, int N>
void print_flags(Flags t, char const* (&names)[N], std::string& str)
void PrintFlags(Flags t, char const* (&names)[N], std::string& str)
{
for (int i = 0; i < N; ++i)
{
@@ -193,21 +188,21 @@ namespace Movement
std::string MoveSplineFlag::ToString() const
{
std::string str;
print_flags(raw(), g_SplineFlag_names, str);
PrintFlags(raw(), SplineFlagNames, str);
return str;
}
std::string MovementFlags_ToString(uint32 flags)
{
std::string str;
print_flags(flags, g_MovementFlag_names, str);
PrintFlags(flags, MovementFlagNames, str);
return str;
}
std::string MovementFlagsExtra_ToString(uint32 flags)
{
std::string str;
print_flags(flags, g_MovementFlagExtra_names, str);
PrintFlags(flags, MovementFlagExtraNames, str);
return str;
}
}
+2 -1
View File
@@ -434,7 +434,7 @@ class Quest
uint32 EmoteOnCompleteDelay = 0;
uint32 EmoteOnIncompleteDelay = 0;
std::string RequestItemsText;
// quest_offer_reward table
uint32 OfferRewardEmote[QUEST_EMOTE_COUNT] = {};
uint32 OfferRewardEmoteDelay[QUEST_EMOTE_COUNT] = {};
@@ -469,4 +469,5 @@ struct QuestStatusData
uint32 Timer;
std::vector<int32> ObjectiveData;
};
#endif
+3 -3
View File
@@ -243,7 +243,7 @@ void ReputationMgr::Initialize()
{
FactionEntry const* factionEntry = sFactionStore.LookupEntry(i);
if (factionEntry && (factionEntry->ReputationIndex >= 0))
if (factionEntry && factionEntry->CanHaveReputation())
{
FactionState newFaction;
newFaction.ID = factionEntry->ID;
@@ -395,7 +395,7 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
{
if (factionEntry->ReputationIndex < 0)
if (!factionEntry->CanHaveReputation())
return;
FactionStateList::iterator itr = _factions.find(factionEntry->ReputationIndex);
@@ -499,7 +499,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
Field* fields = result->Fetch();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
if (factionEntry && (factionEntry->ReputationIndex >= 0))
if (factionEntry && factionEntry->CanHaveReputation())
{
FactionState* faction = &_factions[factionEntry->ReputationIndex];
@@ -32,19 +32,19 @@ namespace WorldPackets
WorldPacket const* Write() override;
int32 Absorbed;
int32 ShieldBlock;
int32 Absorbed = 0;
int32 ShieldBlock = 0;
ObjectGuid Me;
int32 SpellID;
int32 Resisted;
bool Periodic;
uint8 SchoolMask;
int32 SpellID = 0;
int32 Resisted = 0;
bool Periodic = 0.0f;
uint8 SchoolMask = 0;
ObjectGuid CasterGUID;
Optional<Spells::SpellCastLogData> LogData;
int32 Damage;
int32 Damage = 0;
// Optional<SpellNonMeleeDamageLogDebugInfo> Debug Info;
int32 Flags;
int32 Overkill;
int32 Flags = 0;
int32 Overkill = 0;
};
}
}
@@ -16,6 +16,8 @@
*/
#include "MovementPackets.h"
#include "MoveSpline.h"
#include "MoveSplineFlag.h"
#include "MovementTypedefs.h"
#include "Unit.h"
@@ -34,8 +36,6 @@ ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector3& v)
ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo)
{
bool hasTransportData = !movementInfo.transport.guid.IsEmpty();
bool hasTransportPrevTime = hasTransportData && movementInfo.transport.prevTime != 0;
bool hasTransportVehicleId = hasTransportData && movementInfo.transport.vehicleId != 0;
bool hasFallDirection = movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR);
bool hasFallData = hasFallDirection || movementInfo.jump.fallTime != 0;
@@ -66,21 +66,7 @@ ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo)
data.WriteBit(0); // RemoteTimeValid
if (hasTransportData)
{
data << movementInfo.transport.guid;
data << movementInfo.transport.pos.PositionXYZOStream();
data << movementInfo.transport.seat;
data << movementInfo.transport.time;
data.WriteBit(hasTransportPrevTime);
data.WriteBit(hasTransportVehicleId);
if (hasTransportPrevTime)
data << movementInfo.transport.prevTime;
if (hasTransportVehicleId)
data << movementInfo.transport.vehicleId;
}
data << movementInfo.transport;
if (hasFallData)
{
@@ -131,21 +117,7 @@ ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo)
data.ReadBit(); // RemoteTimeValid
if (hasTransport)
{
data >> movementInfo.transport.guid;
data >> movementInfo.transport.pos.PositionXYZOStream();
data >> movementInfo.transport.seat;
data >> movementInfo.transport.time;
bool hasPrevTime = data.ReadBit();
bool hasVehicleId = data.ReadBit();
if (hasPrevTime)
data >> movementInfo.transport.prevTime;
if (hasVehicleId)
data >> movementInfo.transport.vehicleId;
}
data >> movementInfo.transport;
if (hasFall)
{
@@ -166,12 +138,58 @@ ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo)
return data;
}
ByteBuffer& operator>>(ByteBuffer& data, MovementInfo::TransportInfo& transportInfo)
{
data >> transportInfo.guid; // Transport Guid
data >> transportInfo.pos.PositionXYZOStream();
data >> transportInfo.seat; // VehicleSeatIndex
data >> transportInfo.time; // MoveTime
bool hasPrevTime = data.ReadBit();
bool hasVehicleId = data.ReadBit();
if (hasPrevTime)
data >> transportInfo.prevTime; // PrevMoveTime
if (hasVehicleId)
data >> transportInfo.vehicleId; // VehicleRecID
return data;
}
ByteBuffer& operator<<(ByteBuffer& data, MovementInfo::TransportInfo const& transportInfo)
{
bool hasPrevTime = transportInfo.prevTime != 0;
bool hasVehicleId = transportInfo.vehicleId != 0;
data << transportInfo.guid; // Transport Guid
data << transportInfo.pos.GetPositionX();
data << transportInfo.pos.GetPositionY();
data << transportInfo.pos.GetPositionZ();
data << transportInfo.pos.GetOrientation();
data << transportInfo.seat; // VehicleSeatIndex
data << transportInfo.time; // MoveTime
data.WriteBit(hasPrevTime);
data.WriteBit(hasVehicleId);
if (hasPrevTime)
data << transportInfo.prevTime; // PrevMoveTime
if (hasVehicleId)
data << transportInfo.vehicleId; // VehicleRecID
data.FlushBits();
return data;
}
void WorldPackets::Movement::ClientPlayerMovement::Read()
{
_worldPacket >> movementInfo;
}
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFilterKey& monsterSplineFilterKey)
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFilterKey const& monsterSplineFilterKey)
{
data << monsterSplineFilterKey.Idx;
data << monsterSplineFilterKey.Speed;
@@ -179,13 +197,13 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFi
return data;
}
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFilter& monsterSplineFilter)
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFilter const& monsterSplineFilter)
{
data << uint32(monsterSplineFilter.FilterKeys.size());
data << monsterSplineFilter.BaseSpeed;
data << monsterSplineFilter.StartOffset;
data << monsterSplineFilter.DistToPrevFilterKey;
for (WorldPackets::Movement::MonsterSplineFilterKey& filterKey : monsterSplineFilter.FilterKeys)
for (WorldPackets::Movement::MonsterSplineFilterKey const& filterKey : monsterSplineFilter.FilterKeys)
data << filterKey;
data << monsterSplineFilter.AddedToStart;
data.WriteBits(monsterSplineFilter.FilterFlags, 2);
@@ -194,7 +212,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFi
return data;
}
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline& movementSpline)
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline const& movementSpline)
{
data << movementSpline.Flags;
data << movementSpline.AnimTier;
@@ -219,14 +237,14 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline&
switch (movementSpline.Face)
{
case MONSTER_MOVE_FACING_SPOT:
case ::Movement::MONSTER_MOVE_FACING_SPOT:
data << movementSpline.FaceSpot;
break;
case MONSTER_MOVE_FACING_TARGET:
case ::Movement::MONSTER_MOVE_FACING_TARGET:
data << movementSpline.FaceDirection;
data << movementSpline.FaceGUID;
break;
case MONSTER_MOVE_FACING_ANGLE:
case ::Movement::MONSTER_MOVE_FACING_ANGLE:
data << movementSpline.FaceDirection;
break;
}
@@ -237,7 +255,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline&
return data;
}
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementMonsterSpline& movementMonsterSpline)
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementMonsterSpline const& movementMonsterSpline)
{
data << movementMonsterSpline.ID;
data << movementMonsterSpline.Destination;
@@ -255,6 +273,166 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementMonster
return data;
}
void WorldPackets::Movement::CommonMovement::WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const& moveSpline, ByteBuffer& data)
{
data << uint32(moveSpline.GetId()); // ID
if (!moveSpline.isCyclic()) // Destination
{
G3D::Vector3 dest = moveSpline.FinalDestination();
data << float(dest.z);
data << float(dest.x);
data << float(dest.y);
}
else
data << G3D::Vector3::zero();
if (data.WriteBit(!moveSpline.Finalized())) // MovementSplineMove
{
data.FlushBits();
::Movement::MoveSplineFlag const& splineFlags = moveSpline.splineflags;
data.WriteBits(moveSpline.splineflags.raw(), 25); // SplineFlags
uint8 face = ::Movement::MONSTER_MOVE_NORMAL;
if (splineFlags.final_angle)
face = ::Movement::MONSTER_MOVE_FACING_ANGLE;
else if (splineFlags.final_target)
face = ::Movement::MONSTER_MOVE_FACING_TARGET;
else if (splineFlags.final_point)
face = ::Movement::MONSTER_MOVE_FACING_SPOT;
data.WriteBits(face, 2); // Face
bool HasJumpGravity = data.WriteBit(moveSpline.splineflags & (::Movement::MoveSplineFlag::Parabolic | ::Movement::MoveSplineFlag::Animation)); // HasJumpGravity
bool HasSpecialTime = data.WriteBit((moveSpline.splineflags & ::Movement::MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration()); // HasSpecialTime
data.WriteBits(uint8(moveSpline.spline.mode()), 2); // Mode
data.WriteBit(0); // HasSplineFilterKey
data << int32(moveSpline.timePassed()); // Elapsed
data << uint32(moveSpline.Duration()); // Duration
data << float(1.0f); // DurationModifier
data << float(1.0f); // NextDurationModifier
uint32 PointsCount = moveSpline.getPath().size();
data << uint32(PointsCount);
switch (face)
{
case ::Movement::MONSTER_MOVE_FACING_SPOT:
data << moveSpline.facing.f; // FaceSpot
break;
case ::Movement::MONSTER_MOVE_FACING_TARGET:
data << moveSpline.facing.target; // FaceGUID
break;
case ::Movement::MONSTER_MOVE_FACING_ANGLE:
data << moveSpline.facing.angle; // FaceDirection
break;
}
if (HasJumpGravity)
data << float(moveSpline.vertical_acceleration); // JumpGravity
if (HasSpecialTime)
data << uint32(moveSpline.effect_start_time); // SpecialTime
//if (HasSplineFilterKey)
//{
// data << uint32(FilterKeysCount);
// for (var i = 0; i < PointsCount; ++i)
// {
// data << float(In);
// data << float(Out);
// }
// data.WriteBits(FilterFlags, 2);
//}
data.append<G3D::Vector3>(&moveSpline.getPath()[0], PointsCount); // Points
}
}
void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveSpline const& moveSpline)
{
SplineData.ID = moveSpline.m_Id;
WorldPackets::Movement::MovementSpline& movementSpline = SplineData.Move;
::Movement::MoveSplineFlag splineFlags = moveSpline.splineflags;
splineFlags.enter_cycle = moveSpline.isCyclic();
movementSpline.Flags = uint32(splineFlags & uint32(~::Movement::MoveSplineFlag::Mask_No_Monster_Move));
switch (moveSpline.splineflags & ::Movement::MoveSplineFlag::Mask_Final_Facing)
{
case ::Movement::MoveSplineFlag::Final_Point:
movementSpline.Face = ::Movement::MONSTER_MOVE_FACING_SPOT;
movementSpline.FaceSpot = moveSpline.facing.f;
break;
case ::Movement::MoveSplineFlag::Final_Target:
movementSpline.Face = ::Movement::MONSTER_MOVE_FACING_TARGET;
movementSpline.FaceGUID = moveSpline.facing.target;
break;
case ::Movement::MoveSplineFlag::Final_Angle:
movementSpline.Face = ::Movement::MONSTER_MOVE_FACING_ANGLE;
movementSpline.FaceDirection = moveSpline.facing.angle;
break;
default:
movementSpline.Face = ::Movement::MONSTER_MOVE_NORMAL;
break;
}
if (splineFlags.animation)
{
movementSpline.AnimTier = splineFlags.getAnimationId();
movementSpline.TierTransStartTime = moveSpline.effect_start_time;
}
movementSpline.MoveTime = moveSpline.Duration();
if (splineFlags.parabolic)
{
movementSpline.JumpGravity = moveSpline.vertical_acceleration;
movementSpline.SpecialTime = moveSpline.effect_start_time;
}
::Movement::Spline<int32> const& spline = moveSpline.spline;
std::vector<G3D::Vector3> const& array = spline.getPoints();
if (splineFlags & ::Movement::MoveSplineFlag::UncompressedPath)
{
if (!splineFlags.cyclic)
{
uint32 count = spline.getPointCount() - 3;
for (uint32 i = 2; i < count; ++i)
movementSpline.Points.push_back(array[i]);
}
else
{
uint32 count = spline.getPointCount() - 3;
movementSpline.Points.push_back(array[1]);
for (uint32 i = 1; i < count; ++i)
movementSpline.Points.push_back(array[i]);
}
}
else
{
uint32 lastIdx = spline.getPointCount() - 3;
G3D::Vector3 const* realPath = &spline.getPoint(1);
movementSpline.Points.push_back(realPath[lastIdx]);
if (lastIdx > 1)
{
G3D::Vector3 middle = (realPath[0] + realPath[lastIdx]) / 2.f;
// first and last points already appended
for (uint32 i = 1; i < lastIdx; ++i)
movementSpline.PackedDeltas.push_back(middle - realPath[i]);
}
}
}
WorldPacket const* WorldPackets::Movement::MonsterMove::Write()
{
_worldPacket << MoverGUID;
@@ -20,8 +20,14 @@
#include "Packet.h"
#include "Object.h"
#include <G3D/Vector3.h>
namespace Movement
{
class MoveSpline;
}
namespace WorldPackets
{
namespace Movement
@@ -92,11 +98,19 @@ namespace WorldPackets
MovementSpline Move;
};
class CommonMovement
{
public:
static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const& moveSpline, ByteBuffer& data);
};
class MonsterMove final : public ServerPacket
{
public:
MonsterMove() : ServerPacket(SMSG_MONSTER_MOVE) { }
void InitializeSplineData(::Movement::MoveSpline const& moveSpline);
WorldPacket const* Write() override;
MovementMonsterSpline SplineData;
@@ -280,6 +294,9 @@ ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector3& v);
ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo);
ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo);
ByteBuffer& operator>>(ByteBuffer& data, MovementInfo::TransportInfo& transportInfo);
ByteBuffer& operator<<(ByteBuffer& data, MovementInfo::TransportInfo const& transportInfo);
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFilterKey const& monsterSplineFilterKey);
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFilter const& monsterSplineFilter);
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline const& movementSpline);
@@ -174,6 +174,8 @@ WorldPacket const* WorldPackets::Query::QueryNPCTextResponse::Write()
_worldPacket << BroadcastTextID[i];
}
_worldPacket.FlushBits();
return &_worldPacket;
}
@@ -182,7 +184,6 @@ void WorldPackets::Query::DBQueryBulk::Read()
_worldPacket >> TableHash;
uint32 count = _worldPacket.ReadBits(13);
_worldPacket.ResetBitPos();
Queries.resize(count);
for (uint32 i = 0; i < count; ++i)
@@ -204,7 +205,7 @@ WorldPacket const* WorldPackets::Query::DBReply::Write()
if (Data)
Data->WriteRecord(RecordID, Locale, _worldPacket);
_worldPacket.put<int32>(sizePos, _worldPacket.wpos() - sizePos - 4);
_worldPacket.put<int32>(sizePos, _worldPacket.wpos() - sizePos - sizeof(int32));
return &_worldPacket;
}
@@ -224,13 +225,13 @@ WorldPacket const* WorldPackets::Query::HotfixNotifyBlob::Write()
void WorldPackets::Query::QueryGameObject::Read()
{
_worldPacket >> Entry;
_worldPacket >> GameObjectID;
_worldPacket >> Guid;
}
WorldPacket const* WorldPackets::Query::QueryGameObjectResponse::Write()
{
_worldPacket << Entry;
_worldPacket << GameObjectID;
_worldPacket.WriteBit(Allow);
if (Allow)
+29 -26
View File
@@ -1,27 +1,27 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QueryPackets_h__
#define QueryPackets_h__
#include "Packet.h"
#include "Creature.h"
#include "NPCHandler.h"
#include "DB2Stores.h"
#include "NPCHandler.h"
namespace WorldPackets
{
@@ -168,15 +168,15 @@ namespace WorldPackets
uint32 BroadcastTextID[MAX_GOSSIP_TEXT_OPTIONS];
};
struct DBQueryRecord
{
ObjectGuid GUID;
uint32 RecordID;
};
class DBQueryBulk final : public ClientPacket
{
public:
struct DBQueryRecord
{
ObjectGuid GUID;
int32 RecordID = 0;
};
DBQueryBulk(WorldPacket&& packet) : ClientPacket(CMSG_DB_QUERY_BULK, std::move(packet)) { }
void Read() override;
@@ -217,8 +217,9 @@ namespace WorldPackets
QueryGameObject(WorldPacket&& packet) : ClientPacket(CMSG_GAMEOBJECT_QUERY, std::move(packet)) { }
void Read() override;
uint32 Entry = 0;
ObjectGuid Guid;
uint32 GameObjectID = 0;
};
struct GameObjectStats
@@ -236,17 +237,19 @@ namespace WorldPackets
size_t GetDataSize() const
{
return sizeof(Type) + sizeof(DisplayID) + (Name->length() + (4 * 1)) + (IconName.size() + 1) + (CastBarCaption.size() + 1) + (UnkString.size() + 1) + sizeof(Data) + sizeof(Size) + sizeof(uint8) + (QuestItems.size() * sizeof(uint32)) + sizeof(Expansion);
// [1..3] always empty '\0' '\0' '\0' '\0' QuestItems counter
return sizeof(Type) + sizeof(DisplayID) + (Name->length() + (4 * 1)) + (IconName.size() + 1) + (CastBarCaption.size() + 1) + (UnkString.size() + 1) + sizeof(Data) + sizeof(Size) + sizeof(uint8) + (QuestItems.size() * sizeof(int32)) + sizeof(Expansion);
}
};
class QueryGameObjectResponse final : public ServerPacket
{
public:
QueryGameObjectResponse() : ServerPacket(SMSG_GAMEOBJECT_QUERY_RESPONSE, 165) { } // Guess size
QueryGameObjectResponse() : ServerPacket(SMSG_GAMEOBJECT_QUERY_RESPONSE, 165) { }
WorldPacket const* Write() override;
uint32 Entry = 0;
uint32 GameObjectID = 0;
bool Allow = false;
GameObjectStats Stats;
};
+20 -20
View File
@@ -120,7 +120,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
void Init(bool IsFullUpdate, ObjectGuid Target, uint32 Count);
void BuildUpdatePacket(AuraApplication* aurApp, bool remove, uint16 level);
};
};
class SpellCastRequest final : public ClientPacket
{
@@ -133,34 +133,34 @@ namespace WorldPackets
void Read() override;
ObjectGuid PetGuid;
uint8 CastID;
uint32 SpellID;
uint32 Misc;
uint32 TargetFlags;
uint8 CastID = 0;
uint32 SpellID = 0;
uint32 Misc = 0;
uint32 TargetFlags = 0;
ObjectGuid UnitGuid;
ObjectGuid ItemGuid;
ObjectGuid SrcTransportGuid;
ObjectGuid DstTransportGuid;
Position SrcPos;
Position DstPos;
float Orientation;
float Orientation = 0.0f;
std::string Name;
float Pitch;
float Speed;
float Pitch = 0.0f;
float Speed = 0.0f;
ObjectGuid Guid;
uint32 SendCastFlags;
uint32 SendCastFlags = 0;
MovementInfo movementInfo;
};
struct TargetLocation
{
ObjectGuid Transport;
Position Location;
};
struct SpellTargetData
{
uint32 Flags = 0;
@@ -171,49 +171,49 @@ namespace WorldPackets
Optional<float> Orientation; // Not found in JAM structures
std::string Name;
};
struct SpellMissStatus
{
uint8 Reason = 0;
uint8 ReflectStatus = 0;
};
struct SpellPowerData
{
int32 Cost = 0;
int8 Type = 0;
};
struct RuneData
{
uint8 Start = 0;
uint8 Count = 0;
std::vector<uint8> Cooldowns;
};
struct MissileTrajectoryResult
{
uint32 TravelTime = 0;
float Pitch = 0.0f;
};
struct SpellAmmo
{
int32 DisplayID = 0;
int8 InventoryType = 0;
};
struct ProjectileVisualData
{
int32 ID[2];
};
struct CreatureImmunities
{
uint32 School = 0;
uint32 Value = 0;
};
struct SpellHealPrediction
{
ObjectGuid BeaconGUID;
+3 -2
View File
@@ -18,13 +18,16 @@
#include "Opcodes.h"
#include "WorldSession.h"
#include "Packets/AchievementPackets.h"
#include "Packets/CharacterPackets.h"
#include "Packets/ChannelPackets.h"
#include "Packets/ChatPackets.h"
#include "Packets/ClientConfigPackets.h"
#include "Packets/CombatPackets.h"
#include "Packets/EquipmentSetPackets.h"
#include "Packets/GameObjectPackets.h"
#include "Packets/GuildPackets.h"
#include "Packets/ItemPackets.h"
#include "Packets/MiscPackets.h"
#include "Packets/MovementPackets.h"
#include "Packets/NPCPackets.h"
@@ -32,8 +35,6 @@
#include "Packets/QuestPackets.h"
#include "Packets/TalentPackets.h"
#include "Packets/TradePackets.h"
#include "Packets/ItemPackets.h"
#include "Packets/GameObjectPackets.h"
template<class PacketClass, void(WorldSession::*HandlerFunction)(PacketClass&)>
class PacketHandler : public ClientOpcodeHandler
+1 -1
View File
@@ -416,7 +416,7 @@ class WorldSession
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
void SetPlayer(Player* player);
uint8 Expansion() const { return m_expansion; }
uint8 GetExpansion() const { return m_expansion; }
void InitWarden(BigNumber* k, std::string const& os);
+46 -28
View File
@@ -2110,9 +2110,12 @@ void Spell::CleanupTargetList()
void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/, bool implicit /*= true*/, Position const* losPosition /*= nullptr*/)
{
uint32 validEffectMask = 0;
for (SpellEffectInfo const* effect : GetEffects())
if (effect && (!effect->IsEffect() || !CheckEffectTarget(target, effect->EffectIndex, losPosition)))
effectMask &= ~(1 << effect->EffectIndex);
if (effect && (effectMask & effect->EffectIndex) != 0 && CheckEffectTarget(target, effect, losPosition))
validEffectMask |= 1 << effect->EffectIndex;
effectMask &= validEffectMask;
// no effects left
if (!effectMask)
@@ -2218,29 +2221,14 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
void Spell::AddGOTarget(GameObject* go, uint32 effectMask)
{
uint32 validEffectMask = 0;
for (SpellEffectInfo const* effect : GetEffects())
{
if (!effect)
continue;
if (effect && (effectMask & effect->EffectIndex) != 0 && CheckEffectTarget(go, effect))
validEffectMask |= 1 << effect->EffectIndex;
if (!effect->IsEffect())
effectMask &= ~(1 << effect->EffectIndex);
else
{
switch (effect->Effect)
{
case SPELL_EFFECT_GAMEOBJECT_DAMAGE:
case SPELL_EFFECT_GAMEOBJECT_REPAIR:
case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE:
if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
effectMask &= ~(1 << effect->EffectIndex);
break;
default:
break;
}
}
}
effectMask &= validEffectMask;
// no effects left
if (!effectMask)
return;
@@ -2288,9 +2276,12 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask)
void Spell::AddItemTarget(Item* item, uint32 effectMask)
{
uint32 validEffectMask = 0;
for (SpellEffectInfo const* effect : GetEffects())
if (!effect || !effect->IsEffect())
effectMask &= ~(1 << effect->EffectIndex);
if (effect && (effectMask & effect->EffectIndex) != 0 && CheckEffectTarget(item, effect))
validEffectMask |= 1 << effect->EffectIndex;
effectMask &= validEffectMask;
// no effects left
if (!effectMask)
@@ -6723,10 +6714,9 @@ CurrentSpellTypes Spell::GetCurrentContainer() const
return(CURRENT_GENERIC_SPELL);
}
bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* losPosition) const
bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const* effect, Position const* losPosition) const
{
SpellEffectInfo const* effect = GetEffect(eff);
if (!effect)
if (!effect->IsEffect())
return false;
switch (effect->ApplyAuraName)
@@ -6741,7 +6731,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* lo
return false;
if (!target->GetCharmerGUID().IsEmpty())
return false;
if (int32 damage = CalculateDamage(eff, target))
if (int32 damage = CalculateDamage(effect->EffectIndex, target))
if ((int32)target->getLevel() > damage)
return false;
break;
@@ -6803,6 +6793,34 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* lo
return true;
}
bool Spell::CheckEffectTarget(GameObject const* target, SpellEffectInfo const* effect) const
{
if (!effect->IsEffect())
return false;
switch (effect->Effect)
{
case SPELL_EFFECT_GAMEOBJECT_DAMAGE:
case SPELL_EFFECT_GAMEOBJECT_REPAIR:
case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE:
if (target->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
return false;
break;
default:
break;
}
return true;
}
bool Spell::CheckEffectTarget(Item const* target, SpellEffectInfo const* effect) const
{
if (!effect->IsEffect())
return false;
return true;
}
bool Spell::IsNextMeleeSwingSpell() const
{
return (m_spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING) != 0;
+4 -2
View File
@@ -437,7 +437,9 @@ class Spell
void DoCreateItem(uint32 i, uint32 itemtype);
void WriteSpellGoTargets(WorldPacket* data);
bool CheckEffectTarget(Unit const* target, uint32 eff, Position const* losPosition) const;
bool CheckEffectTarget(Unit const* target, SpellEffectInfo const* effect, Position const* losPosition) const;
bool CheckEffectTarget(GameObject const* target, SpellEffectInfo const* effect) const;
bool CheckEffectTarget(Item const* target, SpellEffectInfo const* effect) const;
bool CanAutoCast(Unit* target);
void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); }
void CheckDst() { if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); }
@@ -701,7 +703,7 @@ class Spell
// effect helpers
void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons);
void CalculateJumpSpeeds(uint8 i, float dist, float & speedxy, float & speedz);
void CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedxy, float& speedz);
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
// -------------------------------------------
+10 -12
View File
@@ -927,7 +927,7 @@ void Spell::EffectJump(SpellEffIndex effIndex)
unitTarget->GetContactPoint(m_caster, x, y, z, CONTACT_DISTANCE);
float speedXY, speedZ;
CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(x, y), speedXY, speedZ);
CalculateJumpSpeeds(effectInfo, m_caster->GetExactDist2d(x, y), speedXY, speedZ);
m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
}
@@ -947,21 +947,19 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
destTarget->GetPosition(x, y, z);
float speedXY, speedZ;
CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(x, y), speedXY, speedZ);
CalculateJumpSpeeds(effectInfo, m_caster->GetExactDist2d(x, y), speedXY, speedZ);
m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
}
void Spell::CalculateJumpSpeeds(uint8 i, float dist, float & speedXY, float & speedZ)
void Spell::CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedXY, float& speedZ)
{
if (SpellEffectInfo const* effect = GetEffect(i))
{
if (effect->MiscValue)
speedZ = float(effect->MiscValue) / 10;
else if (effect->MiscValueB)
speedZ = float(effect->MiscValueB) / 10;
else
speedZ = 10.0f;
}
if (effInfo->MiscValue)
speedZ = float(effInfo->MiscValue) / 10;
else if (effInfo->MiscValueB)
speedZ = float(effInfo->MiscValueB) / 10;
else
speedZ = 10.0f;
speedXY = dist * 10.0f / speedZ;
}
+1
View File
@@ -1049,6 +1049,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntryMap effects)
Targets = _target ? _target->Targets : 0;
TargetCreatureType = _target ? _target->TargetCreatureType : 0;
MaxAffectedTargets = _target ? _target->MaxAffectedTargets : 0;
MaxTargetLevel = _target ? _target->MaxTargetLevel : 0;
// SpellTotemsEntry
SpellTotemsEntry const* _totem = GetSpellTotems();
+7
View File
@@ -590,6 +590,13 @@ void SpellScript::PreventHitDefaultEffect(SpellEffIndex effIndex)
m_hitPreventDefaultEffectMask |= 1 << effIndex;
}
SpellEffectInfo const* SpellScript::GetEffectInfo() const
{
ASSERT(IsInEffectHook(), "Script: `%s` Spell: `%u`: function SpellScript::GetEffectInfo was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return m_spell->effectInfo;
}
int32 SpellScript::GetEffectValue() const
{
if (!IsInEffectHook())
+2 -1
View File
@@ -417,7 +417,8 @@ class SpellScript : public _SpellScript
// will not work if effects were already handled
void PreventHitDefaultEffect(SpellEffIndex effIndex);
// method avalible only in EffectHandler method
// method available only in EffectHandler method
SpellEffectInfo const* GetEffectInfo() const;
int32 GetEffectValue() const;
void SetEffectValue(int32 value);
@@ -934,20 +934,16 @@ public:
void FindMinions(Unit* owner)
{
std::list<Creature*> MinionList;
std::list<TempSummon*> MinionList;
owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS);
if (!MinionList.empty())
{
for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr)
for (TempSummon* summon : MinionList)
{
if ((*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID())
{
if ((*itr)->IsInCombat() && (*itr)->getAttackerForHelper())
{
AttackStart((*itr)->getAttackerForHelper());
}
}
if (summon->GetOwnerGUID() == me->GetOwnerGUID())
if (summon->IsInCombat() && summon->getAttackerForHelper())
AttackStart(summon->getAttackerForHelper());
}
}
}
@@ -377,15 +377,15 @@ public:
void DoSummonPriestess()
{
// Summon 2 Elune priestess and make each of them move to a different spot
if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ, wingThicketLocations[0].m_orientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[0], TEMPSUMMON_CORPSE_DESPAWN, 0))
{
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[3].m_positionX, wingThicketLocations[3].m_positionY, wingThicketLocations[3].m_positionZ);
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[3]);
_firstPriestessGUID = priestess->GetGUID();
}
if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ, wingThicketLocations[1].m_orientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
if (Creature* priestess = me->SummonCreature(NPC_PRIESTESS_ELUNE, wingThicketLocations[1], TEMPSUMMON_CORPSE_DESPAWN, 0))
{
// Left priestess should have a distinct move point because she is the one who starts the dialogue at point reach
priestess->GetMotionMaster()->MovePoint(1, wingThicketLocations[4].m_positionX, wingThicketLocations[4].m_positionY, wingThicketLocations[4].m_positionZ);
priestess->GetMotionMaster()->MovePoint(1, wingThicketLocations[4]);
_secondPriestessGUID = priestess->GetGUID();
}
}
@@ -476,19 +476,19 @@ public:
case SAY_PRIESTESS_ALTAR_9:
// move near the escort npc
if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID))
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[6].m_positionX, wingThicketLocations[6].m_positionY, wingThicketLocations[6].m_positionZ);
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[6]);
break;
case SAY_PRIESTESS_ALTAR_13:
// summon the Guardian of Elune
if (Creature* guard = me->SummonCreature(NPC_GUARDIAN_ELUNE, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ, wingThicketLocations[2].m_orientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
if (Creature* guard = me->SummonCreature(NPC_GUARDIAN_ELUNE, wingThicketLocations[2], TEMPSUMMON_CORPSE_DESPAWN, 0))
{
guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[5].m_positionX, wingThicketLocations[5].m_positionY, wingThicketLocations[5].m_positionZ);
guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[5]);
_guardEluneGUID = guard->GetGUID();
}
// summon the Voice of Elune
if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID))
{
if (Creature* voice = me->SummonCreature(NPC_VOICE_ELUNE, altar->GetPositionX(), altar->GetPositionY(), altar->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000))
if (Creature* voice = me->SummonCreature(NPC_VOICE_ELUNE, *altar, TEMPSUMMON_TIMED_DESPAWN, 30000))
_voiceEluneGUID = voice->GetGUID();
}
break;
@@ -497,14 +497,14 @@ public:
if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID))
{
priestess->AI()->Talk(SAY_PRIESTESS_ALTAR_14);
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[7].m_positionX, wingThicketLocations[7].m_positionY, wingThicketLocations[7].m_positionZ);
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[7]);
}
break;
case SAY_PRIESTESS_ALTAR_19:
// make the voice of elune leave
if (Creature* guard = me->GetMap()->GetCreature(_guardEluneGUID))
{
guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ);
guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2]);
guard->DespawnOrUnsummon(4000);
}
break;
@@ -512,7 +512,7 @@ public:
// make the first priestess leave
if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID))
{
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ);
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0]);
priestess->DespawnOrUnsummon(4000);
}
break;
@@ -520,7 +520,7 @@ public:
// make the second priestess leave
if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID))
{
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ);
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1]);
priestess->DespawnOrUnsummon(4000);
}
break;
@@ -111,23 +111,15 @@ class boss_keristrasza : public CreatureScript
Talk(SAY_SLAY);
}
bool CheckContainmentSpheres(bool remove_prison = false)
bool CheckContainmentSpheres(bool removePrison = false)
{
ContainmentSphereGUIDs[0] = instance->GetGuidData(ANOMALUS_CONTAINMET_SPHERE);
ContainmentSphereGUIDs[1] = instance->GetGuidData(ORMOROKS_CONTAINMET_SPHERE);
ContainmentSphereGUIDs[2] = instance->GetGuidData(TELESTRAS_CONTAINMET_SPHERE);
GameObject* ContainmentSpheres[DATA_CONTAINMENT_SPHERES];
for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i)
for (uint32 i = ANOMALUS_CONTAINMET_SPHERE; i < (ANOMALUS_CONTAINMET_SPHERE + DATA_CONTAINMENT_SPHERES); ++i)
{
ContainmentSpheres[i] = ObjectAccessor::GetGameObject(*me, ContainmentSphereGUIDs[i]);
if (!ContainmentSpheres[i])
return false;
if (ContainmentSpheres[i]->GetGoState() != GO_STATE_ACTIVE)
GameObject* containmentSpheres = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(i));
if (!containmentSpheres || containmentSpheres->GetGoState() != GO_STATE_ACTIVE)
return false;
}
if (remove_prison)
if (removePrison)
RemovePrison(true);
return true;
}
@@ -207,7 +199,7 @@ class boss_keristrasza : public CreatureScript
private:
bool _intenseCold;
bool _enrage;
ObjectGuid ContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES];
public:
GuidList _intenseColdList;
};
@@ -285,9 +277,9 @@ class achievement_intense_cold : public AchievementCriteriaScript
if (!target)
return false;
GuidList _intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->_intenseColdList;
GuidList const& _intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->_intenseColdList;
if (!_intenseColdList.empty())
for (GuidList::iterator itr = _intenseColdList.begin(); itr != _intenseColdList.end(); ++itr)
for (GuidList::const_iterator itr = _intenseColdList.begin(); itr != _intenseColdList.end(); ++itr)
if (player->GetGUID() == *itr)
return false;
@@ -174,34 +174,29 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
{
if (id == 1)
{
me->SetFacingTo(PosTalkLocations[talkWing].m_orientation);
me->SetFacingTo(PosTalkLocations[talkWing].GetOrientation());
TurnAudience();
switch (talkWing)
{
case 0: // Pinnacle of Naxxramas
{
switch (urand (0, 1))
case 0: // Pinnacle of Naxxramas
switch (urand(0, 1))
{
case 0: ChangeImage(NPC_IMAGE_OF_KELTHUZAD, MODEL_IMAGE_OF_KELTHUZAD, SAY_KELTHUZAD_1);
_events.ScheduleEvent(EVENT_KELTHUZAD_2, 8000); break;
_events.ScheduleEvent(EVENT_KELTHUZAD_2, 8000); break;
case 1: ChangeImage(NPC_IMAGE_OF_SAPPHIRON, MODEL_IMAGE_OF_SAPPHIRON, SAY_SAPPHIRON); break;
}
}
break;
case 1: // Death knight wing of Naxxramas
{
switch (urand (0, 2))
break;
case 1: // Death knight wing of Naxxramas
switch (urand(0, 2))
{
case 0: ChangeImage(NPC_IMAGE_OF_RAZUVIOUS, MODEL_IMAGE_OF_RAZUVIOUS, SAY_RAZUVIOUS); break;
case 1: ChangeImage(NPC_IMAGE_OF_GOTHIK, MODEL_IMAGE_OF_GOTHIK, SAY_GOTHIK); break;
case 2: ChangeImage(NPC_IMAGE_OF_THANE, MODEL_IMAGE_OF_THANE, SAY_DEATH_KNIGHTS_1);
_events.ScheduleEvent(EVENT_DEATH_KNIGHTS_2, 10000); break;
_events.ScheduleEvent(EVENT_DEATH_KNIGHTS_2, 10000); break;
}
}
break;
case 2: // Blighted abomination wing of Naxxramas
{
break;
case 2: // Blighted abomination wing of Naxxramas
switch (urand (0, 3))
{
case 0: ChangeImage(NPC_IMAGE_OF_PATCHWERK, MODEL_IMAGE_OF_PATCHWERK, SAY_PATCHWERK); break;
@@ -209,20 +204,16 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
case 2: ChangeImage(NPC_IMAGE_OF_THADDIUS, MODEL_IMAGE_OF_THADDIUS, SAY_THADDIUS); break;
case 3: ChangeImage(NPC_IMAGE_OF_GLUTH, MODEL_IMAGE_OF_GLUTH, SAY_GLUTH); break;
}
}
break;
case 3: // Accursed spider wing of Naxxramas
{
break;
case 3: // Accursed spider wing of Naxxramas
switch (urand (0, 2))
{
case 0: ChangeImage(NPC_IMAGE_OF_ANUBREKHAN, MODEL_IMAGE_OF_ANUBREKHAN, SAY_ANUBREKHAN); break;
case 1: ChangeImage(NPC_IMAGE_OF_FAERLINA, MODEL_IMAGE_OF_FAERLINA, SAY_FAERLINA); break;
case 2: ChangeImage(NPC_IMAGE_OF_MAEXXNA, MODEL_IMAGE_OF_MAEXXNA, SAY_MAEXXNA); break;
}
}
break;
case 4: // Dread plague wing of Naxxramas
{
break;
case 4: // Dread plague wing of Naxxramas
switch (urand (0, 2))
{
case 0: ChangeImage(NPC_IMAGE_OF_NOTH, MODEL_IMAGE_OF_NOTH, SAY_NOTH); break;
@@ -230,11 +221,10 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
_events.ScheduleEvent(EVENT_HEIGAN_2, 8000); break;
case 2: ChangeImage(NPC_IMAGE_OF_LOATHEB, MODEL_IMAGE_OF_LOATHEB, SAY_LOATHEB); break;
}
}
break;
case 5: // Home
_events.ScheduleEvent(EVENT_START_RANDOM, 30000);
break;
break;
case 5: // Home
_events.ScheduleEvent(EVENT_START_RANDOM, 30000);
break;
}
}
}
+2 -3
View File
@@ -1231,12 +1231,11 @@ class spell_dk_raise_dead : public SpellScriptLoader
private:
bool Validate(SpellInfo const* spellInfo) override
{
// 6.x effects changed
/*if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_1)->CalcValue())
if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_1)->CalcValue())
|| !sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_2)->CalcValue())
|| !sSpellMgr->GetSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_MASTER_OF_GHOULS))
return false;*/
return false;
return false;
}
+1 -1
View File
@@ -159,7 +159,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader
return true;
}
void HandleEnergize(SpellEffIndex effIndex)
void HandleEnergize(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
+17 -13
View File
@@ -1180,13 +1180,12 @@ class spell_gen_defend : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
// 6.x effects changed
//if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1))
// return false;
//if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2))
// return false;
//if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3))
// return false;
if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3))
return false;
return false;
}
@@ -1221,26 +1220,29 @@ class spell_gen_defend : public SpellScriptLoader
void Register() override
{
/*
SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId);
// 6.x effects removed
// Defend spells cast by NPCs (add visuals)
/*if (spell->GetEffect(EFFECT_0)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
if (spell->GetEffect(EFFECT_0)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
{
AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
}*/
}
// Remove Defend spell from player when he dismounts
//if (spell->GetEffect(EFFECT_2)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
// OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
if (spell->GetEffect(EFFECT_2)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
// Defend spells cast by players (add/remove visuals)
/*if (spell->GetEffect(EFFECT_1)->ApplyAuraName == SPELL_AURA_DUMMY)
if (spell->GetEffect(EFFECT_1)->ApplyAuraName == SPELL_AURA_DUMMY)
{
AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
}*/
}
*/
}
};
@@ -1913,6 +1915,8 @@ class spell_gen_mounted_charge: public SpellScriptLoader
}
break;
}
default:
break;
}
}
+1 -1
View File
@@ -1485,7 +1485,7 @@ class spell_item_gift_of_the_harvester : public SpellScriptLoader
SpellCastResult CheckRequirement()
{
std::list<Creature*> ghouls;
std::list<TempSummon*> ghouls;
GetCaster()->GetAllMinionsByEntry(ghouls, NPC_GHOUL);
if (ghouls.size() >= MAX_GHOULS)
{
+30 -24
View File
@@ -1294,51 +1294,53 @@ class spell_mage_ring_of_frost : public SpellScriptLoader
return true;
}
bool Load() override
{
ringOfFrost = NULL;
return true;
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (ringOfFrost)
if (GetMaxDuration() - (int32)ringOfFrost->GetTimer() >= sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_DUMMY)->GetDuration())
if (TempSummon* ringOfFrost = GetRingOfFrostMinion())
if (GetMaxDuration() - int32(ringOfFrost->GetTimer()) >= sSpellMgr->EnsureSpellInfo(SPELL_MAGE_RING_OF_FROST_DUMMY)->GetDuration())
GetTarget()->CastSpell(ringOfFrost->GetPositionX(), ringOfFrost->GetPositionY(), ringOfFrost->GetPositionZ(), SPELL_MAGE_RING_OF_FROST_FREEZE, true);
}
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
std::list<Creature*> MinionList;
std::list<TempSummon*> MinionList;
GetTarget()->GetAllMinionsByEntry(MinionList, GetSpellInfo()->GetEffect(EFFECT_0)->MiscValue);
// Get the last summoned RoF, save it and despawn older ones
for (std::list<Creature*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++)
for (std::list<TempSummon*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++)
{
TempSummon* summon = (*itr)->ToTempSummon();
TempSummon* summon = (*itr);
if (ringOfFrost && summon)
if (TempSummon* ringOfFrost = GetRingOfFrostMinion())
{
if (summon->GetTimer() > ringOfFrost->GetTimer())
{
ringOfFrost->DespawnOrUnsummon();
ringOfFrost = summon;
_ringOfFrostGUID = summon->GetGUID();
}
else
summon->DespawnOrUnsummon();
}
else if (summon)
ringOfFrost = summon;
else
_ringOfFrostGUID = summon->GetGUID();
}
}
TempSummon* ringOfFrost;
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_ring_of_frost_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectApply += AuraEffectApplyFn(spell_mage_ring_of_frost_AuraScript::Apply, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_ring_of_frost_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectApply += AuraEffectApplyFn(spell_mage_ring_of_frost_AuraScript::Apply, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
private:
TempSummon* GetRingOfFrostMinion() const
{
if (Creature* creature = ObjectAccessor::GetCreature(*GetOwner(), _ringOfFrostGUID))
return creature->ToTempSummon();
return nullptr;
}
ObjectGuid _ringOfFrostGUID;
};
AuraScript* GetAuraScript() const override
@@ -1369,13 +1371,17 @@ class spell_mage_ring_of_frost_freeze : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
float outRadius = sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON)->GetEffect(EFFECT_0)->CalcRadius();
WorldLocation const* dest = GetExplTargetDest();
float outRadius = sSpellMgr->EnsureSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON)->GetEffect(EFFECT_0)->CalcRadius();
float inRadius = 4.7f;
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
if (Unit* unit = (*itr)->ToUnit())
if (unit->HasAura(SPELL_MAGE_RING_OF_FROST_DUMMY) || unit->HasAura(SPELL_MAGE_RING_OF_FROST_FREEZE) || unit->GetExactDist(GetExplTargetDest()) > outRadius || unit->GetExactDist(GetExplTargetDest()) < inRadius)
targets.erase(itr--);
targets.remove_if([dest, outRadius, inRadius](WorldObject* target)
{
Unit* unit = target->ToUnit();
if (!unit)
return true;
return unit->HasAura(SPELL_MAGE_RING_OF_FROST_DUMMY) || unit->HasAura(SPELL_MAGE_RING_OF_FROST_FREEZE) || unit->GetExactDist(dest) > outRadius || unit->GetExactDist(dest) < inRadius;
});
}
void Register() override
+3 -5
View File
@@ -1251,17 +1251,13 @@ class spell_warl_soul_swap_dot_marker : public SpellScriptLoader
{
PrepareSpellScript(spell_warl_soul_swap_dot_marker_SpellScript);
void HandleHit(SpellEffIndex effIndex)
void HandleHit(SpellEffIndex /*effIndex*/)
{
Unit* swapVictim = GetCaster();
Unit* warlock = GetHitUnit();
if (!warlock || !swapVictim)
return;
// effect existance checked in dbc, should not be removed by core at any time, so no need to check for null
SpellEffectInfo const* effect = GetSpellInfo()->GetEffect(DIFFICULTY_NONE, EFFECT_0);
flag128 classMask = effect->SpellClassMask;
Unit::AuraApplicationMap const& appliedAuras = swapVictim->GetAppliedAuras();
SoulSwapOverrideAuraScript* swapSpellScript = nullptr;
if (Aura* swapOverrideAura = warlock->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE))
@@ -1270,6 +1266,8 @@ class spell_warl_soul_swap_dot_marker : public SpellScriptLoader
if (!swapSpellScript)
return;
flag128 classMask = GetEffectInfo()->SpellClassMask;
for (Unit::AuraApplicationMap::const_iterator itr = appliedAuras.begin(); itr != appliedAuras.end(); ++itr)
{
SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
+6 -4
View File
@@ -866,6 +866,7 @@ class spell_warr_vigilance : public SpellScriptLoader
return true;
}
/*
bool CheckProc(ProcEventInfo& eventInfo)
{
_procTarget = GetCaster();
@@ -874,12 +875,13 @@ class spell_warr_vigilance : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
/*PreventDefaultAction();
PreventDefaultAction();
int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()));
GetTarget()->CastSpell(_procTarget, SPELL_WARRIOR_VIGILANCE_PROC, true, NULL, aurEff);
_procTarget->CastCustomSpell(_procTarget, SPELL_WARRIOR_VENGEANCE, &damage, &damage, &damage, true, NULL, aurEff);*/
_procTarget->CastCustomSpell(_procTarget, SPELL_WARRIOR_VENGEANCE, &damage, &damage, &damage, true, NULL, aurEff);
}
*/
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
@@ -892,8 +894,8 @@ class spell_warr_vigilance : public SpellScriptLoader
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_warr_vigilance_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_warr_vigilance_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
//DoCheckProc += AuraCheckProcFn(spell_warr_vigilance_AuraScript::CheckProc);
//OnEffectProc += AuraEffectProcFn(spell_warr_vigilance_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
OnEffectRemove += AuraEffectRemoveFn(spell_warr_vigilance_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
@@ -20,9 +20,9 @@
#include "Define.h"
#include "Utilities/ByteConverter.h"
#include <cassert>
#include <list>
#include "Common.h"
class DB2FileLoader
{
+6 -7
View File
@@ -18,10 +18,9 @@
#ifndef DB2STORE_H
#define DB2STORE_H
#include "DB2StorageLoader.h"
#include "Common.h"
#include "DB2StorageLoader.h"
#include "ByteBuffer.h"
#include <vector>
/// Interface class for common access
class DB2StorageBase
@@ -127,7 +126,7 @@ public:
bool Load(char const* fn, uint32 locale)
{
DB2FileLoader db2;
// Check if load was sucessful, only then continue
// Check if load was successful, only then continue
if (!db2.Load(fn, fmt))
return false;
@@ -142,17 +141,17 @@ public:
{
m_stringPoolList.push_back(stringHolders);
// load strings from dbc data
// load strings from db2 data
m_stringPoolList.push_back(db2.AutoProduceStrings(fmt, (char*)m_dataTable, locale));
}
// error in dbc file at loading if NULL
// error in db2 file at loading if NULL
return indexTable.asT != NULL;
}
bool LoadStringsFrom(char const* fn, uint32 locale)
{
// DBC must be already loaded using Load
// DB2 must be already loaded using Load
if (!indexTable.asT)
return false;
@@ -161,7 +160,7 @@ public:
if (!db2.Load(fn, fmt))
return false;
// load strings from another locale dbc data
// load strings from another locale db2 data
if (DB2FileLoader::GetFormatStringFieldCount(fmt))
m_stringPoolList.push_back(db2.AutoProduceStrings(fmt, (char*)m_dataTable, locale));
@@ -18,6 +18,7 @@
#ifndef DBC_FILE_LOADER_H
#define DBC_FILE_LOADER_H
#include "Define.h"
#include "Utilities/ByteConverter.h"
#include <cassert>
+1 -1
View File
@@ -94,7 +94,7 @@ class DBCStorage
bool Load(char const* fn, SqlDbc* sql)
{
DBCFileLoader dbc;
// Check if load was sucessful, only then continue
// Check if load was successful, only then continue
if (!dbc.Load(fn, fmt))
return false;
+1 -1
View File
@@ -197,7 +197,7 @@ int64 MoneyStringToMoney(const std::string& moneyString)
if (gCount + sCount + cCount != 1)
return 0;
uint64 amount = atol(*itr);
uint64 amount = atoull(*itr);
if (gCount == 1)
money += amount * 100 * 100;
else if (sCount == 1)