Core/GameObjects: Add isUse parameter to GossipHello for distinction between CMSG_GAMEOBJECT_USE and CMSG_GAMEOBJECT_REPORT_USE

This commit is contained in:
Shocker
2016-05-26 13:09:56 +03:00
parent 2fffa51a65
commit b539ac6afa
9 changed files with 17 additions and 13 deletions

View File

@@ -1353,8 +1353,10 @@ class go_twilight_portal : public GameObjectScript
}
}
bool GossipHello(Player* player) override
bool GossipHello(Player* player, bool isUse) override
{
if (!isUse)
return true;
if (_spellId != 0)
player->CastSpell(player, _spellId, true);
return true;

View File

@@ -977,8 +977,11 @@ class go_celestial_planetarium_access : public GameObjectScript
{
}
bool GossipHello(Player* player) override
bool GossipHello(Player* player, bool isUse) override
{
if (!isUse)
return true;
if (go->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE))
return true;

View File

@@ -834,12 +834,11 @@ class go_soulwell : public GameObjectScript
{
}
/// Due to the fact that this GameObject triggers CMSG_GAMEOBJECT_USE
/// _and_ CMSG_GAMEOBJECT_REPORT_USE, this GossipHello hook is called
/// twice. The script's handling is fine as it won't remove two charges
/// on the well. We have to find how to segregate REPORT_USE and USE.
bool GossipHello(Player* player) override
bool GossipHello(Player* player, bool isUse) override
{
if (!isUse)
return true;
Unit* owner = go->GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !player->IsInSameRaidWith(owner->ToPlayer()))
return true;