diff options
Diffstat (limited to 'src/server/game/Scripting')
| -rw-r--r-- | src/server/game/Scripting/MapScripts.cpp | 42 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 14 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.h | 28 |
3 files changed, 42 insertions, 42 deletions
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 3ccc876e1a2..e7a5fb77c6a 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -40,9 +40,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); @@ -75,9 +75,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; @@ -299,7 +299,7 @@ void Map::ScriptsProcess() Object* source = NULL; if (step.sourceGUID) { - switch (GUID_HIPART(step.sourceGUID)) + switch (step.sourceGUID.GetHigh()) { case HIGHGUID_ITEM: // as well as HIGHGUID_CONTAINER if (Player* player = HashMapHolder<Player>::Find(step.ownerGUID)) @@ -329,8 +329,8 @@ void Map::ScriptsProcess() break; } default: - TC_LOG_ERROR("scripts", "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", - step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID)); + TC_LOG_ERROR("scripts", "%s source with unsupported high guid %s.", + step.script->GetDebugInfo().c_str(), step.sourceGUID.ToString().c_str()); break; } } @@ -338,7 +338,7 @@ void Map::ScriptsProcess() WorldObject* target = NULL; if (step.targetGUID) { - switch (GUID_HIPART(step.targetGUID)) + switch (step.targetGUID.GetHigh()) { case HIGHGUID_UNIT: case HIGHGUID_VEHICLE: @@ -364,8 +364,8 @@ void Map::ScriptsProcess() break; } default: - TC_LOG_ERROR("scripts", "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", - step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID)); + TC_LOG_ERROR("scripts", "%s target with unsupported high guid %s.", + step.script->GetDebugInfo().c_str(), step.targetGUID.ToString().c_str()); break; } } @@ -400,8 +400,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()) TC_LOG_ERROR("scripts", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else player->Whisper(text, LANG_UNIVERSAL, targetGUID); @@ -417,7 +417,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: @@ -433,13 +433,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()) TC_LOG_ERROR("scripts", "%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()) TC_LOG_ERROR("scripts", "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer(), true); @@ -468,9 +468,9 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount()) - TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, %s) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID, - cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); + cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetGUID().ToString().c_str()); else cSource->SetUInt32Value(step.script->FieldSet.FieldID, step.script->FieldSet.FieldValue); } @@ -599,7 +599,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; @@ -839,7 +839,7 @@ void Map::ScriptsProcess() 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); + cTarget = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, ObjectGuid(HIGHGUID_UNIT, data->id, step.script->CallScript.CreatureEntry), cTarget); } if (!cTarget) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index d13c81ed059..51100accf77 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1240,7 +1240,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) { FOREACH_SCRIPT(PlayerScript)->OnTextEmote(player, textEmote, emoteNum, guid); } @@ -1265,12 +1265,12 @@ void ScriptMgr::OnPlayerCreate(Player* player) FOREACH_SCRIPT(PlayerScript)->OnCreate(player); } -void ScriptMgr::OnPlayerDelete(uint64 guid, uint32 accountId) +void ScriptMgr::OnPlayerDelete(ObjectGuid guid, uint32 accountId) { 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); } @@ -1384,25 +1384,25 @@ 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); FOREACH_SCRIPT(GroupScript)->OnAddMember(group, guid); } -void ScriptMgr::OnGroupInviteMember(Group* group, uint64 guid) +void ScriptMgr::OnGroupInviteMember(Group* group, ObjectGuid guid) { ASSERT(group); 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); 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); FOREACH_SCRIPT(GroupScript)->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 499d7ff6c09..ae7b8f9947e 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -738,7 +738,7 @@ class PlayerScript : public UnitScript // 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*/) { } @@ -753,10 +753,10 @@ class PlayerScript : public UnitScript 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*/) { } @@ -855,16 +855,16 @@ class GroupScript : public ScriptObject bool IsDatabaseBound() const final 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*/) { } @@ -1068,13 +1068,13 @@ class ScriptMgr 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, bool firstLogin); void OnPlayerLogout(Player* player); void OnPlayerCreate(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 OnPlayerSave(Player* player); void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent); void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea); @@ -1106,10 +1106,10 @@ class ScriptMgr 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); public: /* UnitScript */ |
