mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -28,9 +28,9 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O
|
||||
return;
|
||||
|
||||
// prepare static data
|
||||
uint64 sourceGUID = source ? source->GetGUID() : uint64(0); //some script commands doesn't have source
|
||||
uint64 targetGUID = target ? target->GetGUID() : uint64(0);
|
||||
uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0);
|
||||
ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; //some script commands doesn't have source
|
||||
ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
|
||||
ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
|
||||
|
||||
///- Schedule script execution for all scripts in the script map
|
||||
ScriptMap const* s2 = &(s->second);
|
||||
@@ -63,9 +63,9 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
||||
// NOTE: script record _must_ exist until command executed
|
||||
|
||||
// prepare static data
|
||||
uint64 sourceGUID = source ? source->GetGUID() : uint64(0);
|
||||
uint64 targetGUID = target ? target->GetGUID() : uint64(0);
|
||||
uint64 ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0);
|
||||
ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty;
|
||||
ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
|
||||
ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
|
||||
|
||||
ScriptAction sa;
|
||||
sa.sourceGUID = sourceGUID;
|
||||
@@ -101,10 +101,10 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
|
||||
player = source->ToPlayer();
|
||||
|
||||
if (!player)
|
||||
LOG_ERROR("server", "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %s; target: TypeId: %u, Entry: %u, GUID: %s), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(),
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString().c_str() : "",
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString().c_str() : "");
|
||||
}
|
||||
return player;
|
||||
}
|
||||
@@ -134,10 +134,10 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
|
||||
}
|
||||
|
||||
if (!creature)
|
||||
LOG_ERROR("server", "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %s; target: TypeId: %u, Entry: %u, GUID: %s), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(),
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString().c_str() : "",
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString().c_str() : "");
|
||||
}
|
||||
return creature;
|
||||
}
|
||||
@@ -148,8 +148,8 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
|
||||
if (!obj)
|
||||
LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
else if (!obj->isType(TYPEMASK_UNIT))
|
||||
LOG_ERROR("server", "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %s), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUID().ToString().c_str());
|
||||
else
|
||||
{
|
||||
unit = obj->ToUnit();
|
||||
@@ -169,8 +169,8 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf
|
||||
{
|
||||
player = obj->ToPlayer();
|
||||
if (!player)
|
||||
LOG_ERROR("server", "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s %s object is not a player (%s).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetGUID().ToString().c_str());
|
||||
}
|
||||
return player;
|
||||
}
|
||||
@@ -184,8 +184,8 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip
|
||||
{
|
||||
creature = obj->ToCreature();
|
||||
if (!creature)
|
||||
LOG_ERROR("server", "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
|
||||
isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s %s object is not a creature (%s).", scriptInfo->GetDebugInfo().c_str(),
|
||||
isSource ? "source" : "target", obj->GetGUID().ToString().c_str());
|
||||
}
|
||||
return creature;
|
||||
}
|
||||
@@ -200,8 +200,8 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const
|
||||
{
|
||||
pWorldObject = dynamic_cast<WorldObject*>(obj);
|
||||
if (!pWorldObject)
|
||||
LOG_ERROR("server", "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s %s object is not a world object (%s).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetGUID().ToString().c_str());
|
||||
}
|
||||
return pWorldObject;
|
||||
}
|
||||
@@ -209,7 +209,7 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const
|
||||
inline void Map::_ScriptProcessDoor(Object* source, Object* target, const ScriptInfo* scriptInfo) const
|
||||
{
|
||||
bool bOpen = false;
|
||||
uint32 guid = scriptInfo->ToggleDoor.GOGuid;
|
||||
ObjectGuid::LowType guid = scriptInfo->ToggleDoor.GOGuid;
|
||||
int32 nTimeToToggle = std::max(15, int32(scriptInfo->ToggleDoor.ResetDelay));
|
||||
switch (scriptInfo->command)
|
||||
{
|
||||
@@ -227,22 +227,20 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
|
||||
else if (!source)
|
||||
LOG_ERROR("server", "%s source object is nullptr.", scriptInfo->GetDebugInfo().c_str());
|
||||
else if (!source->isType(TYPEMASK_UNIT))
|
||||
LOG_ERROR("server", "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
|
||||
source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s source object is not unit (%s), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetGUID().ToString().c_str());
|
||||
else
|
||||
{
|
||||
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
|
||||
if (!wSource)
|
||||
LOG_ERROR("server", "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s source object could not be casted to world object (%s), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetGUID().ToString().c_str());
|
||||
else
|
||||
{
|
||||
GameObject* pDoor = _FindGameObject(wSource, guid);
|
||||
if (!pDoor)
|
||||
LOG_ERROR("server", "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
|
||||
else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
|
||||
LOG_ERROR("server", "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s gameobject is not a door (%s).",
|
||||
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGUID().ToString().c_str());
|
||||
else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
|
||||
{
|
||||
pDoor->UseDoorOrButton(nTimeToToggle);
|
||||
@@ -258,20 +256,13 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
|
||||
}
|
||||
}
|
||||
|
||||
inline GameObject* Map::_FindGameObject(WorldObject* searchObject, uint32 guid) const
|
||||
inline GameObject* Map::_FindGameObject(WorldObject* searchObject, ObjectGuid::LowType guid) const
|
||||
{
|
||||
GameObject* gameobject = nullptr;
|
||||
auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
|
||||
if (bounds.first == bounds.second)
|
||||
return nullptr;
|
||||
|
||||
CellCoord p(acore::ComputeCellCoord(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::GameObjectWithDbGUIDCheck goCheck(guid);
|
||||
acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck> checker(searchObject, gameobject, goCheck);
|
||||
|
||||
TypeContainerVisitor<acore::GameObjectSearcher<acore::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > objectChecker(checker);
|
||||
cell.Visit(p, objectChecker, *searchObject->GetMap(), *searchObject, searchObject->GetGridActivationRange());
|
||||
|
||||
return gameobject;
|
||||
return bounds.first->second;
|
||||
}
|
||||
|
||||
/// Process queued scripts
|
||||
@@ -290,38 +281,35 @@ void Map::ScriptsProcess()
|
||||
Object* source = nullptr;
|
||||
if (step.sourceGUID)
|
||||
{
|
||||
switch (GUID_HIPART(step.sourceGUID))
|
||||
switch (step.sourceGUID.GetHigh())
|
||||
{
|
||||
case HIGHGUID_ITEM: // as well as HIGHGUID_CONTAINER
|
||||
if (Player* player = GetPlayer(step.ownerGUID))
|
||||
case HighGuid::Item: // as well as HIGHGUID_CONTAINER
|
||||
if (Player* player = ObjectAccessor::GetPlayer(this, step.ownerGUID))
|
||||
source = player->GetItemByGuid(step.sourceGUID);
|
||||
break;
|
||||
case HIGHGUID_UNIT:
|
||||
case HIGHGUID_VEHICLE:
|
||||
case HighGuid::Unit:
|
||||
case HighGuid::Vehicle:
|
||||
source = GetCreature(step.sourceGUID);
|
||||
break;
|
||||
case HIGHGUID_PET:
|
||||
case HighGuid::Pet:
|
||||
source = GetPet(step.sourceGUID);
|
||||
break;
|
||||
case HIGHGUID_PLAYER:
|
||||
source = GetPlayer(step.sourceGUID);
|
||||
case HighGuid::Player:
|
||||
source = HashMapHolder<Player>::Find(step.sourceGUID);
|
||||
break;
|
||||
case HIGHGUID_TRANSPORT:
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
case HighGuid::Transport:
|
||||
case HighGuid::GameObject:
|
||||
source = GetGameObject(step.sourceGUID);
|
||||
break;
|
||||
case HIGHGUID_CORPSE:
|
||||
case HighGuid::Corpse:
|
||||
source = GetCorpse(step.sourceGUID);
|
||||
break;
|
||||
case HIGHGUID_MO_TRANSPORT:
|
||||
{
|
||||
GameObject* go = GetGameObject(step.sourceGUID);
|
||||
source = go ? go->ToTransport() : nullptr;
|
||||
break;
|
||||
}
|
||||
case HighGuid::Mo_Transport:
|
||||
source = GetTransport(step.sourceGUID);
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("server", "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
|
||||
step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID));
|
||||
LOG_ERROR("server", "%s source with unsupported high guid (%s).",
|
||||
step.script->GetDebugInfo().c_str(), step.sourceGUID.ToString().c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -329,34 +317,31 @@ void Map::ScriptsProcess()
|
||||
WorldObject* target = nullptr;
|
||||
if (step.targetGUID)
|
||||
{
|
||||
switch (GUID_HIPART(step.targetGUID))
|
||||
switch (step.targetGUID.GetHigh())
|
||||
{
|
||||
case HIGHGUID_UNIT:
|
||||
case HIGHGUID_VEHICLE:
|
||||
case HighGuid::Unit:
|
||||
case HighGuid::Vehicle:
|
||||
target = GetCreature(step.targetGUID);
|
||||
break;
|
||||
case HIGHGUID_PET:
|
||||
case HighGuid::Pet:
|
||||
target = GetPet(step.targetGUID);
|
||||
break;
|
||||
case HIGHGUID_PLAYER: // empty GUID case also
|
||||
target = GetPlayer(step.targetGUID);
|
||||
case HighGuid::Player: // empty GUID case also
|
||||
target = HashMapHolder<Player>::Find(step.targetGUID);
|
||||
break;
|
||||
case HIGHGUID_TRANSPORT:
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
case HighGuid::Transport:
|
||||
case HighGuid::GameObject:
|
||||
target = GetGameObject(step.targetGUID);
|
||||
break;
|
||||
case HIGHGUID_CORPSE:
|
||||
case HighGuid::Corpse:
|
||||
target = GetCorpse(step.targetGUID);
|
||||
break;
|
||||
case HIGHGUID_MO_TRANSPORT:
|
||||
{
|
||||
GameObject* go = GetGameObject(step.targetGUID);
|
||||
target = go ? go->ToTransport() : nullptr;
|
||||
break;
|
||||
}
|
||||
case HighGuid::Mo_Transport:
|
||||
target = GetTransport(step.targetGUID);
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("server", "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
|
||||
step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID));
|
||||
LOG_ERROR("server", "%s target with unsupported high guid (%s).",
|
||||
step.script->GetDebugInfo().c_str(), step.targetGUID.ToString().c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -392,8 +377,8 @@ void Map::ScriptsProcess()
|
||||
case CHAT_TYPE_WHISPER:
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
{
|
||||
uint64 targetGUID = target ? target->GetGUID() : 0;
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
|
||||
if (!targetGUID || !targetGUID.IsPlayer())
|
||||
LOG_ERROR("server", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
player->Whisper(text, LANG_UNIVERSAL, targetGUID);
|
||||
@@ -409,7 +394,7 @@ void Map::ScriptsProcess()
|
||||
// Source or target must be Creature.
|
||||
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
|
||||
{
|
||||
uint64 targetGUID = target ? target->GetGUID() : 0;
|
||||
ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
|
||||
switch (step.script->Talk.ChatType)
|
||||
{
|
||||
case CHAT_TYPE_SAY:
|
||||
@@ -425,13 +410,13 @@ void Map::ScriptsProcess()
|
||||
cSource->MonsterTextEmote(step.script->Talk.TextID, target, true);
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID || !targetGUID.IsPlayer())
|
||||
LOG_ERROR("server", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer());
|
||||
break;
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
if (!targetGUID || !targetGUID.IsPlayer())
|
||||
LOG_ERROR("server", "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer(), true);
|
||||
@@ -460,9 +445,8 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount())
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (%s) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID, cSource->GetValuesCount(), cSource->GetGUID().ToString().c_str());
|
||||
else
|
||||
cSource->SetUInt32Value(step.script->FieldSet.FieldID, step.script->FieldSet.FieldValue);
|
||||
}
|
||||
@@ -489,9 +473,8 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (%s) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, cSource->GetValuesCount(), cSource->GetGUID().ToString().c_str());
|
||||
else
|
||||
cSource->SetFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue);
|
||||
}
|
||||
@@ -503,9 +486,8 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (%s) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, cSource->GetValuesCount(), cSource->GetGUID().ToString().c_str());
|
||||
else
|
||||
cSource->RemoveFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue);
|
||||
}
|
||||
@@ -546,8 +528,7 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
LOG_ERROR("server", "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s source is not unit, gameobject or player (%s), skipping.", step.script->GetDebugInfo().c_str(), source->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
worldObject = dynamic_cast<WorldObject*>(source);
|
||||
@@ -559,17 +540,15 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
LOG_ERROR("server", "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s target is not unit, gameobject or player (%s), skipping.", step.script->GetDebugInfo().c_str(), target->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
worldObject = dynamic_cast<WorldObject*>(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("server", "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(),
|
||||
target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s neither source nor target is player (source: %s; target: %s), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -591,7 +570,7 @@ void Map::ScriptsProcess()
|
||||
if (step.script->KillCredit.Flags & SF_KILLCREDIT_REWARD_GROUP)
|
||||
player->RewardPlayerAndGroupAtEvent(step.script->KillCredit.CreatureEntry, player);
|
||||
else
|
||||
player->KilledMonsterCredit(step.script->KillCredit.CreatureEntry, 0);
|
||||
player->KilledMonsterCredit(step.script->KillCredit.CreatureEntry);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -680,8 +659,7 @@ void Map::ScriptsProcess()
|
||||
|
||||
if (target->GetTypeId() != TYPEID_GAMEOBJECT)
|
||||
{
|
||||
LOG_ERROR("server", "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s target object is not gameobject (%s), skipping.", step.script->GetDebugInfo().c_str(), target->GetGUID().ToString().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -823,22 +801,15 @@ void Map::ScriptsProcess()
|
||||
}
|
||||
|
||||
Creature* cTarget = nullptr;
|
||||
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
|
||||
if (wSource) //using grid searcher
|
||||
auto creatureBounds = _creatureBySpawnIdStore.equal_range(step.script->CallScript.CreatureEntry);
|
||||
if (creatureBounds.first != creatureBounds.second)
|
||||
{
|
||||
CellCoord p(acore::ComputeCellCoord(wSource->GetPositionX(), wSource->GetPositionY()));
|
||||
Cell cell(p);
|
||||
|
||||
acore::CreatureWithDbGUIDCheck target_check(step.script->CallScript.CreatureEntry);
|
||||
acore::CreatureSearcher<acore::CreatureWithDbGUIDCheck> checker(wSource, cTarget, target_check);
|
||||
|
||||
TypeContainerVisitor<acore::CreatureSearcher <acore::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker);
|
||||
cell.Visit(p, unit_checker, *wSource->GetMap(), *wSource, wSource->GetGridActivationRange());
|
||||
}
|
||||
else //check hashmap holders
|
||||
{
|
||||
if (CreatureData const* data = sObjectMgr->GetCreatureData(step.script->CallScript.CreatureEntry))
|
||||
cTarget = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, MAKE_NEW_GUID(step.script->CallScript.CreatureEntry, data->id, HIGHGUID_UNIT), cTarget);
|
||||
// Prefer alive (last respawned) creature
|
||||
auto creatureItr = std::find_if(creatureBounds.first, creatureBounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
|
||||
{
|
||||
return pair.second->IsAlive();
|
||||
});
|
||||
cTarget = creatureItr != creatureBounds.second ? creatureItr->second : creatureBounds.first->second;
|
||||
}
|
||||
|
||||
if (!cTarget)
|
||||
@@ -866,8 +837,7 @@ void Map::ScriptsProcess()
|
||||
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
|
||||
{
|
||||
if (cSource->isDead())
|
||||
LOG_ERROR("server", "%s creature is already dead (Entry: %u, GUID: %u)",
|
||||
step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
LOG_ERROR("server", "%s creature is already dead (%s)", step.script->GetDebugInfo().c_str(), cSource->GetGUID().ToString().c_str());
|
||||
else
|
||||
{
|
||||
cSource->setDeathState(JUST_DIED);
|
||||
|
||||
@@ -362,7 +362,7 @@ void ScriptMgr::CreateSpellScriptLoaders(uint32 spellId, std::vector<std::pair<S
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforePlayerDurabilityRepair(Player* player, uint64 npcGUID, uint64 itemGUID, float& discountMod, uint8 guildBank)
|
||||
void ScriptMgr::OnBeforePlayerDurabilityRepair(Player* player, ObjectGuid npcGUID, ObjectGuid itemGUID, float& discountMod, uint8 guildBank)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnBeforeDurabilityRepair(player, npcGUID, itemGUID, discountMod, guildBank);
|
||||
}
|
||||
@@ -1528,7 +1528,7 @@ void ScriptMgr::OnPlayerEmote(Player* player, uint32 emote)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnEmote(player, emote);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid)
|
||||
void ScriptMgr::OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnTextEmote(player, textEmote, emoteNum, guid);
|
||||
@@ -1586,15 +1586,15 @@ void ScriptMgr::OnPlayerSave(Player* player)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnSave(player);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerDelete(uint64 guid, uint32 accountId)
|
||||
void ScriptMgr::OnPlayerDelete(ObjectGuid guid, uint32 accountId)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnDelete(GUID_LOPART(guid));
|
||||
sEluna->OnDelete(guid.GetCounter());
|
||||
#endif
|
||||
FOREACH_SCRIPT(PlayerScript)->OnDelete(guid, accountId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerFailedDelete(uint64 guid, uint32 accountId)
|
||||
void ScriptMgr::OnPlayerFailedDelete(ObjectGuid guid, uint32 accountId)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnFailedDelete(guid, accountId);
|
||||
}
|
||||
@@ -1710,7 +1710,7 @@ void ScriptMgr::OnGetMaxPersonalArenaRatingRequirement(const Player* player, uin
|
||||
FOREACH_SCRIPT(PlayerScript)->OnGetMaxPersonalArenaRatingRequirement(player, minSlot, maxArenaRating);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnLootItem(Player* player, Item* item, uint32 count, uint64 lootguid)
|
||||
void ScriptMgr::OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid lootguid)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnLootItem(player, item, count, lootguid);
|
||||
}
|
||||
@@ -1733,7 +1733,7 @@ void ScriptMgr::OnFirstLogin(Player* player)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnFirstLogin(player);
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanJoinInBattlegroundQueue(Player* player, uint64 BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err)
|
||||
bool ScriptMgr::CanJoinInBattlegroundQueue(Player* player, ObjectGuid BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
@@ -1885,7 +1885,7 @@ void ScriptMgr::OnGuildItemMove(Guild* guild, Player* player, Item* pItem, bool
|
||||
FOREACH_SCRIPT(GuildScript)->OnItemMove(guild, player, pItem, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGuildEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank)
|
||||
void ScriptMgr::OnGuildEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
|
||||
@@ -1893,7 +1893,7 @@ void ScriptMgr::OnGuildEvent(Guild* guild, uint8 eventType, uint32 playerGuid1,
|
||||
FOREACH_SCRIPT(GuildScript)->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
|
||||
void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnBankEvent(guild, eventType, tabId, playerGuid, itemOrMoney, itemStackCount, destTabId);
|
||||
@@ -1902,7 +1902,7 @@ void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uin
|
||||
}
|
||||
|
||||
// Group
|
||||
void ScriptMgr::OnGroupAddMember(Group* group, uint64 guid)
|
||||
void ScriptMgr::OnGroupAddMember(Group* group, ObjectGuid guid)
|
||||
{
|
||||
ASSERT(group);
|
||||
#ifdef ELUNA
|
||||
@@ -1911,7 +1911,7 @@ void ScriptMgr::OnGroupAddMember(Group* group, uint64 guid)
|
||||
FOREACH_SCRIPT(GroupScript)->OnAddMember(group, guid);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGroupInviteMember(Group* group, uint64 guid)
|
||||
void ScriptMgr::OnGroupInviteMember(Group* group, ObjectGuid guid)
|
||||
{
|
||||
ASSERT(group);
|
||||
#ifdef ELUNA
|
||||
@@ -1920,7 +1920,7 @@ void ScriptMgr::OnGroupInviteMember(Group* group, uint64 guid)
|
||||
FOREACH_SCRIPT(GroupScript)->OnInviteMember(group, guid);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason)
|
||||
void ScriptMgr::OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason)
|
||||
{
|
||||
ASSERT(group);
|
||||
#ifdef ELUNA
|
||||
@@ -1929,7 +1929,7 @@ void ScriptMgr::OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod meth
|
||||
FOREACH_SCRIPT(GroupScript)->OnRemoveMember(group, guid, method, kicker, reason);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
|
||||
void ScriptMgr::OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
|
||||
{
|
||||
ASSERT(group);
|
||||
#ifdef ELUNA
|
||||
@@ -1948,7 +1948,7 @@ void ScriptMgr::OnGroupDisband(Group* group)
|
||||
}
|
||||
|
||||
// Global
|
||||
void ScriptMgr::OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid)
|
||||
void ScriptMgr::OnGlobalItemDelFromDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid)
|
||||
{
|
||||
ASSERT(trans);
|
||||
ASSERT(itemGuid);
|
||||
@@ -1961,7 +1961,7 @@ void ScriptMgr::OnGlobalMirrorImageDisplayItem(const Item* item, uint32& display
|
||||
FOREACH_SCRIPT(GlobalScript)->OnMirrorImageDisplayItem(item, display);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeUpdateArenaPoints(ArenaTeam* at, std::map<uint32, uint32>& ap)
|
||||
void ScriptMgr::OnBeforeUpdateArenaPoints(ArenaTeam* at, std::map<ObjectGuid, uint32>& ap)
|
||||
{
|
||||
FOREACH_SCRIPT(GlobalScript)->OnBeforeUpdateArenaPoints(at, ap);
|
||||
}
|
||||
@@ -2052,7 +2052,7 @@ void ScriptMgr::OnPlayerMove(Player* player, MovementInfo movementInfo, uint32 o
|
||||
FOREACH_SCRIPT(MovementHandlerScript)->OnPlayerMove(player, movementInfo, opcode);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeBuyItemFromVendor(Player* player, uint64 vendorguid, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot)
|
||||
void ScriptMgr::OnBeforeBuyItemFromVendor(Player* player, ObjectGuid vendorguid, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnBeforeBuyItemFromVendor(player, vendorguid, vendorslot, item, count, bag, slot);
|
||||
}
|
||||
@@ -2229,7 +2229,7 @@ void ScriptMgr::OnBeforeStoreOrEquipNewItem(Player* player, uint32 vendorslot, u
|
||||
FOREACH_SCRIPT(PlayerScript)->OnBeforeStoreOrEquipNewItem(player, vendorslot, item, count, bag, slot, pProto, pVendor, crItem, bStore);
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanJoinInArenaQueue(Player* player, uint64 BattlemasterGuid, uint8 arenaslot, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, uint8 IsRated, GroupJoinBattlegroundResult& err)
|
||||
bool ScriptMgr::CanJoinInArenaQueue(Player* player, ObjectGuid BattlemasterGuid, uint8 arenaslot, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, uint8 IsRated, GroupJoinBattlegroundResult& err)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
@@ -2284,7 +2284,7 @@ bool ScriptMgr::CanSellItem(Player* player, Item* item, Creature* creature)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanSendMail(Player* player, uint64 receiverGuid, uint64 mailbox, std::string& subject, std::string& body, uint32 money, uint32 COD, Item* item)
|
||||
bool ScriptMgr::CanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 COD, Item* item)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
@@ -2509,7 +2509,7 @@ void ScriptMgr::OnGetQuestRate(Player* player, float& result)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnGetQuestRate(player, result);
|
||||
}
|
||||
|
||||
bool ScriptMgr::PassedQuestKilledMonsterCredit(Player* player, Quest const* qinfo, uint32 entry, uint32 real_entry, uint64 guid)
|
||||
bool ScriptMgr::PassedQuestKilledMonsterCredit(Player* player, Quest const* qinfo, uint32 entry, uint32 real_entry, ObjectGuid guid)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
@@ -2918,7 +2918,7 @@ bool ScriptMgr::CanResetTalents(Pet* pet)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanAddMember(ArenaTeam* team, uint64 PlayerGuid)
|
||||
bool ScriptMgr::CanAddMember(ArenaTeam* team, ObjectGuid PlayerGuid)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
@@ -3012,7 +3012,7 @@ bool ScriptMgr::CanItemApplyEquipSpell(Player* player, Item* item)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanSendAuctionHello(WorldSession const* session, uint64 guid, Creature* creature)
|
||||
bool ScriptMgr::CanSendAuctionHello(WorldSession const* session, ObjectGuid guid, Creature* creature)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
|
||||
@@ -841,7 +841,7 @@ public:
|
||||
// Both of the below are called on emote opcodes.
|
||||
virtual void OnEmote(Player* /*player*/, uint32 /*emote*/) { }
|
||||
|
||||
virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, uint64 /*guid*/) { }
|
||||
virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, ObjectGuid /*guid*/) { }
|
||||
|
||||
// Called in Spell::Cast.
|
||||
virtual void OnSpellCast(Player* /*player*/, Spell* /*spell*/, bool /*skipCheck*/) { }
|
||||
@@ -859,10 +859,10 @@ public:
|
||||
virtual void OnCreate(Player* /*player*/) { }
|
||||
|
||||
// Called when a player is deleted.
|
||||
virtual void OnDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
|
||||
virtual void OnDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
|
||||
|
||||
// Called when a player delete failed.
|
||||
virtual void OnFailedDelete(uint64 /*guid*/, uint32 /*accountId*/) { }
|
||||
virtual void OnFailedDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
|
||||
|
||||
// Called when a player is about to be saved.
|
||||
virtual void OnSave(Player* /*player*/) { }
|
||||
@@ -937,7 +937,7 @@ public:
|
||||
virtual void OnGetMaxPersonalArenaRatingRequirement(const Player* /*player*/, uint32 /*minSlot*/, uint32& /*maxArenaRating*/) const {}
|
||||
|
||||
//After looting item
|
||||
virtual void OnLootItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, uint64 /*lootguid*/) { }
|
||||
virtual void OnLootItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, ObjectGuid /*lootguid*/) { }
|
||||
|
||||
//After creating item (eg profession item creation)
|
||||
virtual void OnCreateItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { }
|
||||
@@ -949,10 +949,10 @@ public:
|
||||
[[nodiscard]] virtual bool OnBeforeQuestComplete(Player* /*player*/, uint32 /*quest_id*/) { return true; }
|
||||
|
||||
// Before durability repair action, you can even modify the discount value
|
||||
virtual void OnBeforeDurabilityRepair(Player* /*player*/, uint64 /*npcGUID*/, uint64 /*itemGUID*/, float&/*discountMod*/, uint8 /*guildBank*/) { }
|
||||
virtual void OnBeforeDurabilityRepair(Player* /*player*/, ObjectGuid /*npcGUID*/, ObjectGuid /*itemGUID*/, float&/*discountMod*/, uint8 /*guildBank*/) { }
|
||||
|
||||
//Before buying something from any vendor
|
||||
virtual void OnBeforeBuyItemFromVendor(Player* /*player*/, uint64 /*vendorguid*/, uint32 /*vendorslot*/, uint32& /*item*/, uint8 /*count*/, uint8 /*bag*/, uint8 /*slot*/) { };
|
||||
virtual void OnBeforeBuyItemFromVendor(Player* /*player*/, ObjectGuid /*vendorguid*/, uint32 /*vendorslot*/, uint32& /*item*/, uint8 /*count*/, uint8 /*bag*/, uint8 /*slot*/) { };
|
||||
|
||||
//Before buying something from any vendor
|
||||
virtual void OnBeforeStoreOrEquipNewItem(Player* /*player*/, uint32 /*vendorslot*/, uint32& /*item*/, uint8 /*count*/, uint8 /*bag*/, uint8 /*slot*/, ItemTemplate const* /*pProto*/, Creature* /*pVendor*/, VendorItem const* /*crItem*/, bool /*bStore*/) { };
|
||||
@@ -971,7 +971,7 @@ public:
|
||||
|
||||
virtual void OnFirstLogin(Player* /*player*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanJoinInBattlegroundQueue(Player* /*player*/, uint64 /*BattlemasterGuid*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
[[nodiscard]] virtual bool CanJoinInBattlegroundQueue(Player* /*player*/, ObjectGuid /*BattlemasterGuid*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
virtual bool ShouldBeRewardedWithMoneyInsteadOfExp(Player* /*player*/) { return false; }
|
||||
|
||||
// Called before the player's temporary summoned creature has initialized it's stats
|
||||
@@ -986,7 +986,7 @@ public:
|
||||
// Called before loading a player's pet from the DB
|
||||
virtual void OnBeforeLoadPetFromDB(Player* /*player*/, uint32& /*petentry*/, uint32& /*petnumber*/, bool& /*current*/, bool& /*forceLoadFromDB*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanJoinInArenaQueue(Player* /*player*/, uint64 /*BattlemasterGuid*/, uint8 /*arenaslot*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, uint8 /*IsRated*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
[[nodiscard]] virtual bool CanJoinInArenaQueue(Player* /*player*/, ObjectGuid /*BattlemasterGuid*/, uint8 /*arenaslot*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, uint8 /*IsRated*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanBattleFieldPort(Player* /*player*/, uint8 /*arenaType*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*action*/) { return true; }
|
||||
|
||||
@@ -996,7 +996,7 @@ public:
|
||||
|
||||
[[nodiscard]] virtual bool CanSellItem(Player* /*player*/, Item* /*item*/, Creature* /*creature*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanSendMail(Player* /*player*/, uint64 /*receiverGuid*/, uint64 /*mailbox*/, std::string& /*subject*/, std::string& /*body*/, uint32 /*money*/, uint32 /*COD*/, Item* /*item*/) { return true; }
|
||||
[[nodiscard]] virtual bool CanSendMail(Player* /*player*/, ObjectGuid /*receiverGuid*/, ObjectGuid /*mailbox*/, std::string& /*subject*/, std::string& /*body*/, uint32 /*money*/, uint32 /*COD*/, Item* /*item*/) { return true; }
|
||||
|
||||
virtual void PetitionBuy(Player* /*player*/, Creature* /*creature*/, uint32& /*charterid*/, uint32& /*cost*/, uint32& /*type*/) { }
|
||||
|
||||
@@ -1050,7 +1050,7 @@ public:
|
||||
|
||||
virtual void OnGetQuestRate(Player* /*player*/, float& /*result*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool PassedQuestKilledMonsterCredit(Player* /*player*/, Quest const* /*qinfo*/, uint32 /*entry*/, uint32 /*real_entry*/, uint64 /*guid*/) { return true; }
|
||||
[[nodiscard]] virtual bool PassedQuestKilledMonsterCredit(Player* /*player*/, Quest const* /*qinfo*/, uint32 /*entry*/, uint32 /*real_entry*/, ObjectGuid /*guid*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CheckItemInSlotAtLoadInventory(Player* /*player*/, Item* /*item*/, uint8 /*slot*/, uint8& /*err*/, uint16& /*dest*/) { return true; }
|
||||
|
||||
@@ -1145,9 +1145,9 @@ public:
|
||||
virtual void OnItemMove(Guild* /*guild*/, Player* /*player*/, Item* /*pItem*/, bool /*isSrcBank*/, uint8 /*srcContainer*/, uint8 /*srcSlotId*/,
|
||||
bool /*isDestBank*/, uint8 /*destContainer*/, uint8 /*destSlotId*/) { }
|
||||
|
||||
virtual void OnEvent(Guild* /*guild*/, uint8 /*eventType*/, uint32 /*playerGuid1*/, uint32 /*playerGuid2*/, uint8 /*newRank*/) { }
|
||||
virtual void OnEvent(Guild* /*guild*/, uint8 /*eventType*/, ObjectGuid::LowType /*playerGuid1*/, ObjectGuid::LowType /*playerGuid2*/, uint8 /*newRank*/) { }
|
||||
|
||||
virtual void OnBankEvent(Guild* /*guild*/, uint8 /*eventType*/, uint8 /*tabId*/, uint32 /*playerGuid*/, uint32 /*itemOrMoney*/, uint16 /*itemStackCount*/, uint8 /*destTabId*/) { }
|
||||
virtual void OnBankEvent(Guild* /*guild*/, uint8 /*eventType*/, uint8 /*tabId*/, ObjectGuid::LowType /*playerGuid*/, uint32 /*itemOrMoney*/, uint16 /*itemStackCount*/, uint8 /*destTabId*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanGuildSendBankList(Guild const* /*guild*/, WorldSession* /*session*/, uint8 /*tabId*/, bool /*sendAllSlots*/) { return true; }
|
||||
};
|
||||
@@ -1161,16 +1161,16 @@ public:
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
// Called when a member is added to a group.
|
||||
virtual void OnAddMember(Group* /*group*/, uint64 /*guid*/) { }
|
||||
virtual void OnAddMember(Group* /*group*/, ObjectGuid /*guid*/) { }
|
||||
|
||||
// Called when a member is invited to join a group.
|
||||
virtual void OnInviteMember(Group* /*group*/, uint64 /*guid*/) { }
|
||||
virtual void OnInviteMember(Group* /*group*/, ObjectGuid /*guid*/) { }
|
||||
|
||||
// Called when a member is removed from a group.
|
||||
virtual void OnRemoveMember(Group* /*group*/, uint64 /*guid*/, RemoveMethod /*method*/, uint64 /*kicker*/, const char* /*reason*/) { }
|
||||
virtual void OnRemoveMember(Group* /*group*/, ObjectGuid /*guid*/, RemoveMethod /*method*/, ObjectGuid /*kicker*/, const char* /*reason*/) { }
|
||||
|
||||
// Called when the leader of a group is changed.
|
||||
virtual void OnChangeLeader(Group* /*group*/, uint64 /*newLeaderGuid*/, uint64 /*oldLeaderGuid*/) { }
|
||||
virtual void OnChangeLeader(Group* /*group*/, ObjectGuid /*newLeaderGuid*/, ObjectGuid /*oldLeaderGuid*/) { }
|
||||
|
||||
// Called when a group is disbanded.
|
||||
virtual void OnDisband(Group* /*group*/) { }
|
||||
@@ -1188,7 +1188,7 @@ protected:
|
||||
|
||||
public:
|
||||
// items
|
||||
virtual void OnItemDelFromDB(SQLTransaction& /*trans*/, uint32 /*itemGuid*/) { }
|
||||
virtual void OnItemDelFromDB(SQLTransaction& /*trans*/, ObjectGuid::LowType /*itemGuid*/) { }
|
||||
virtual void OnMirrorImageDisplayItem(const Item* /*item*/, uint32& /*display*/) { }
|
||||
|
||||
// loot
|
||||
@@ -1200,7 +1200,7 @@ public:
|
||||
virtual void OnAfterInitializeLockedDungeons(Player* /*player*/) { }
|
||||
|
||||
// On Before arena points distribution
|
||||
virtual void OnBeforeUpdateArenaPoints(ArenaTeam* /*at*/, std::map<uint32, uint32>& /*ap*/) { }
|
||||
virtual void OnBeforeUpdateArenaPoints(ArenaTeam* /*at*/, std::map<ObjectGuid, uint32>& /*ap*/) { }
|
||||
|
||||
// Called when a dungeon encounter is updated.
|
||||
virtual void OnAfterUpdateEncounterState(Map* /*map*/, EncounterCreditType /*type*/, uint32 /*creditEntry*/, Unit* /*source*/, Difficulty /*difficulty_fixed*/, DungeonEncounterList const* /*encounters*/, uint32 /*dungeonCompleted*/, bool /*updated*/) { }
|
||||
@@ -1380,7 +1380,7 @@ public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
|
||||
[[nodiscard]] virtual bool CanAddMember(ArenaTeam* /*team*/, uint64 /*PlayerGuid*/) { return true; }
|
||||
[[nodiscard]] virtual bool CanAddMember(ArenaTeam* /*team*/, ObjectGuid /*PlayerGuid*/) { return true; }
|
||||
|
||||
virtual void OnGetPoints(ArenaTeam* /*team*/, uint32 /*memberRating*/, float& /*points*/) { }
|
||||
|
||||
@@ -1419,7 +1419,7 @@ public:
|
||||
|
||||
[[nodiscard]] virtual bool CanItemApplyEquipSpell(Player* /*player*/, Item* /*item*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanSendAuctionHello(WorldSession const* /*session*/, uint64 /*guid*/, Creature* /*creature*/) { return true; }
|
||||
[[nodiscard]] virtual bool CanSendAuctionHello(WorldSession const* /*session*/, ObjectGuid /*guid*/, Creature* /*creature*/) { return true; }
|
||||
|
||||
virtual void ValidateSpellAtCastSpell(Player* /*player*/, uint32& /*oldSpellId*/, uint32& /*spellId*/, uint8& /*castCount*/, uint8& /*castFlags*/) { }
|
||||
|
||||
@@ -1632,15 +1632,15 @@ public: /* PlayerScript */
|
||||
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild);
|
||||
void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel);
|
||||
void OnPlayerEmote(Player* player, uint32 emote);
|
||||
void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, uint64 guid);
|
||||
void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid);
|
||||
void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck);
|
||||
void OnPlayerLogin(Player* player);
|
||||
void OnPlayerLoadFromDB(Player* player);
|
||||
void OnPlayerLogout(Player* player);
|
||||
void OnPlayerCreate(Player* player);
|
||||
void OnPlayerSave(Player* player);
|
||||
void OnPlayerDelete(uint64 guid, uint32 accountId);
|
||||
void OnPlayerFailedDelete(uint64 guid, uint32 accountId);
|
||||
void OnPlayerDelete(ObjectGuid guid, uint32 accountId);
|
||||
void OnPlayerFailedDelete(ObjectGuid guid, uint32 accountId);
|
||||
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
|
||||
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
|
||||
void OnPlayerUpdateArea(Player* player, uint32 oldArea, uint32 newArea);
|
||||
@@ -1663,12 +1663,12 @@ public: /* PlayerScript */
|
||||
void GetCustomGetArenaTeamId(const Player* player, uint8 slot, uint32& teamID) const;
|
||||
void GetCustomArenaPersonalRating(const Player* player, uint8 slot, uint32& rating) const;
|
||||
void OnGetMaxPersonalArenaRatingRequirement(const Player* player, uint32 minSlot, uint32& maxArenaRating) const;
|
||||
void OnLootItem(Player* player, Item* item, uint32 count, uint64 lootguid);
|
||||
void OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid lootguid);
|
||||
void OnCreateItem(Player* player, Item* item, uint32 count);
|
||||
void OnQuestRewardItem(Player* player, Item* item, uint32 count);
|
||||
bool OnBeforePlayerQuestComplete(Player* player, uint32 quest_id);
|
||||
void OnBeforePlayerDurabilityRepair(Player* player, uint64 npcGUID, uint64 itemGUID, float& discountMod, uint8 guildBank);
|
||||
void OnBeforeBuyItemFromVendor(Player* player, uint64 vendorguid, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot);
|
||||
void OnBeforePlayerDurabilityRepair(Player* player, ObjectGuid npcGUID, ObjectGuid itemGUID, float& discountMod, uint8 guildBank);
|
||||
void OnBeforeBuyItemFromVendor(Player* player, ObjectGuid vendorguid, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot);
|
||||
void OnBeforeStoreOrEquipNewItem(Player* player, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
|
||||
void OnAfterStoreOrEquipNewItem(Player* player, uint32 vendorslot, Item* item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
|
||||
void OnAfterUpdateMaxPower(Player* player, Powers& power, float& value);
|
||||
@@ -1679,18 +1679,18 @@ public: /* PlayerScript */
|
||||
void OnFirstLogin(Player* player);
|
||||
void OnPlayerCompleteQuest(Player* player, Quest const* quest);
|
||||
void OnBattlegroundDesertion(Player* player, BattlegroundDesertionType const desertionType);
|
||||
bool CanJoinInBattlegroundQueue(Player* player, uint64 BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err);
|
||||
bool CanJoinInBattlegroundQueue(Player* player, ObjectGuid BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err);
|
||||
bool ShouldBeRewardedWithMoneyInsteadOfExp(Player* player);
|
||||
void OnBeforeTempSummonInitStats(Player* player, TempSummon* tempSummon, uint32& duration);
|
||||
void OnBeforeGuardianInitStatsForLevel(Player* player, Guardian* guardian, CreatureTemplate const* cinfo, PetType& petType);
|
||||
void OnAfterGuardianInitStatsForLevel(Player* player, Guardian* guardian);
|
||||
void OnBeforeLoadPetFromDB(Player* player, uint32& petentry, uint32& petnumber, bool& current, bool& forceLoadFromDB);
|
||||
bool CanJoinInArenaQueue(Player* player, uint64 BattlemasterGuid, uint8 arenaslot, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, uint8 IsRated, GroupJoinBattlegroundResult& err);
|
||||
bool CanJoinInArenaQueue(Player* player, ObjectGuid BattlemasterGuid, uint8 arenaslot, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, uint8 IsRated, GroupJoinBattlegroundResult& err);
|
||||
bool CanBattleFieldPort(Player* player, uint8 arenaType, BattlegroundTypeId BGTypeID, uint8 action);
|
||||
bool CanGroupInvite(Player* player, std::string& membername);
|
||||
bool CanGroupAccept(Player* player, Group* group);
|
||||
bool CanSellItem(Player* player, Item* item, Creature* creature);
|
||||
bool CanSendMail(Player* player, uint64 receiverGuid, uint64 mailbox, std::string& subject, std::string& body, uint32 money, uint32 COD, Item* item);
|
||||
bool CanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 COD, Item* item);
|
||||
void PetitionBuy(Player* player, Creature* creature, uint32& charterid, uint32& cost, uint32& type);
|
||||
void PetitionShowList(Player* player, Creature* creature, uint32& CharterEntry, uint32& CharterDispayID, uint32& CharterCost);
|
||||
void OnRewardKillRewarder(Player* player, bool isDungeon, float& rate);
|
||||
@@ -1717,7 +1717,7 @@ public: /* PlayerScript */
|
||||
bool CanSaveEquipNewItem(Player* player, Item* item, uint16 pos, bool update);
|
||||
bool CanApplyEnchantment(Player* player, Item* item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition);
|
||||
void OnGetQuestRate(Player* player, float& result);
|
||||
bool PassedQuestKilledMonsterCredit(Player* player, Quest const* qinfo, uint32 entry, uint32 real_entry, uint64 guid);
|
||||
bool PassedQuestKilledMonsterCredit(Player* player, Quest const* qinfo, uint32 entry, uint32 real_entry, ObjectGuid guid);
|
||||
bool CheckItemInSlotAtLoadInventory(Player* player, Item* item, uint8 slot, uint8& err, uint16& dest);
|
||||
bool NotAvoidSatisfy(Player* player, DungeonProgressionRequirements const* ar, uint32 target_map, bool report);
|
||||
bool NotVisibleGloballyFor(Player* player, Player const* u);
|
||||
@@ -1753,23 +1753,23 @@ public: /* GuildScript */
|
||||
void OnGuildMemberDepositMoney(Guild* guild, Player* player, uint32& amount);
|
||||
void OnGuildItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
|
||||
bool isDestBank, uint8 destContainer, uint8 destSlotId);
|
||||
void OnGuildEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank);
|
||||
void OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId);
|
||||
void OnGuildEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank);
|
||||
void OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId);
|
||||
bool CanGuildSendBankList(Guild const* guild, WorldSession* session, uint8 tabId, bool sendAllSlots);
|
||||
|
||||
public: /* GroupScript */
|
||||
void OnGroupAddMember(Group* group, uint64 guid);
|
||||
void OnGroupInviteMember(Group* group, uint64 guid);
|
||||
void OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason);
|
||||
void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
|
||||
void OnGroupAddMember(Group* group, ObjectGuid guid);
|
||||
void OnGroupInviteMember(Group* group, ObjectGuid guid);
|
||||
void OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason);
|
||||
void OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid);
|
||||
void OnGroupDisband(Group* group);
|
||||
bool CanGroupJoinBattlegroundQueue(Group const* group, Player* member, Battleground const* bgTemplate, uint32 MinPlayerCount, bool isRated, uint32 arenaSlot);
|
||||
void OnCreate(Group* group, Player* leader);
|
||||
|
||||
public: /* GlobalScript */
|
||||
void OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid);
|
||||
void OnGlobalItemDelFromDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid);
|
||||
void OnGlobalMirrorImageDisplayItem(const Item* item, uint32& display);
|
||||
void OnBeforeUpdateArenaPoints(ArenaTeam* at, std::map<uint32, uint32>& ap);
|
||||
void OnBeforeUpdateArenaPoints(ArenaTeam* at, std::map<ObjectGuid, uint32>& ap);
|
||||
void OnAfterRefCount(Player const* player, Loot& loot, bool canRate, uint16 lootMode, LootStoreItem* LootStoreItem, uint32& maxcount, LootStore const& store);
|
||||
void OnBeforeDropAddItem(Player const* player, Loot& loot, bool canRate, uint16 lootMode, LootStoreItem* LootStoreItem, LootStore const& store);
|
||||
void OnItemRoll(Player const* player, LootStoreItem const* LootStoreItem, float& chance, Loot& loot, LootStore const& store);
|
||||
@@ -1874,7 +1874,7 @@ public: /* AchievementScript */
|
||||
|
||||
public: /* ArenaScript */
|
||||
|
||||
bool CanAddMember(ArenaTeam* team, uint64 PlayerGuid);
|
||||
bool CanAddMember(ArenaTeam* team, ObjectGuid PlayerGuid);
|
||||
void OnGetPoints(ArenaTeam* team, uint32 memberRating, float& points);
|
||||
bool CanSaveToDB(ArenaTeam* team);
|
||||
|
||||
@@ -1891,7 +1891,7 @@ public: /* AchievementScript */
|
||||
void OnItemCreate(Item* item, ItemTemplate const* itemProto, Player const* owner);
|
||||
bool CanApplySoulboundFlag(Item* item, ItemTemplate const* proto);
|
||||
bool CanItemApplyEquipSpell(Player* player, Item* item);
|
||||
bool CanSendAuctionHello(WorldSession const* session, uint64 guid, Creature* creature);
|
||||
bool CanSendAuctionHello(WorldSession const* session, ObjectGuid guid, Creature* creature);
|
||||
void ValidateSpellAtCastSpell(Player* player, uint32& oldSpellId, uint32& spellId, uint8& castCount, uint8& castFlags);
|
||||
void OnPlayerSetPhase(const AuraEffect* auraEff, AuraApplication const* aurApp, uint8 mode, bool apply, uint32& newPhase);
|
||||
void ValidateSpellAtCastSpellResult(Player* player, Unit* mover, Spell* spell, uint32 oldSpellId, uint32 spellId);
|
||||
|
||||
Reference in New Issue
Block a user