aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-09-16 21:50:01 +0200
committerShauren <shauren.trinity@gmail.com>2014-09-16 21:50:01 +0200
commit7d1d55124c1e289748d2afefae896c97f710e57b (patch)
treedcae6831f97fa1d353233fa7367800af1c4caa98 /src/server/game/Scripting
parent6810a4469ebe6600be2f8649e917110a17ce27f3 (diff)
parent9b933b4a291e377d4ae124eb8e3d2ba74b37f34f (diff)
Merge branch 'ObjectGuid' of https://github.com/TrinityCore/TrinityCore
Conflicts: src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Player/Player.h src/server/game/Scripting/MapScripts.cpp src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
Diffstat (limited to 'src/server/game/Scripting')
-rw-r--r--src/server/game/Scripting/MapScripts.cpp32
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp14
-rw-r--r--src/server/game/Scripting/ScriptMgr.h28
3 files changed, 37 insertions, 37 deletions
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 888c1ec7e8d..db7c26fe5cb 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;
}
}
@@ -434,9 +434,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);
}
@@ -565,7 +565,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;
@@ -805,7 +805,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 */