Core/GameObject: implement dismount on use of certain GOs

- The fact of player dismounting was entirely client-sided, with no server code enforcing it.

Closes #19979

# Conflicts:
#	src/server/game/Entities/GameObject/GameObject.cpp
This commit is contained in:
ariel- authored and Ovahlord committed 2020-09-11 15:08:53 +02:00
1 parent d2b27bc43c
commit 46866bad04
1 file changed
+28
@@ -453,6 +453,20 @@ struct GameObjectTemplate
}
}
bool DismountOnUse() const
{
switch (type)
{
case GAMEOBJECT_TYPE_MAILBOX: return false;
case GAMEOBJECT_TYPE_BARBER_CHAIR: return true;
default:
{
// this part not implemented properly, missing an internal check
return (GetPropNum(0x5B) >= uint32(0x18));
}
}
}
uint32 GetLockId() const
{
switch (type)
@@ -615,6 +629,20 @@ struct GameObjectTemplate
void InitializeQueryData();
WorldPacket BuildQueryData(LocaleConstant loc) const;
private:
static std::vector<uint32> const _goTypeProperties[MAX_GAMEOBJECT_TYPE];
uint32 GetPropNum(int32 propNum) const
{
if (type >= MAX_GAMEOBJECT_TYPE || propNum >= 0x81)
return uint32(-1);
auto itr = std::find(_goTypeProperties[type].begin(), _goTypeProperties[type].end(), propNum);
if (itr == _goTypeProperties[type].end())
return uint32(-1);
return uint32(std::distance(_goTypeProperties[type].begin(), itr));
}
};
// From `gameobject_template_addon`