Core/Gossip: Fixed incorrect gossip menu texts introduced after dropping npc_gossip table

This commit is contained in:
Shauren
2011-06-15 18:53:55 +02:00
parent 53e45b57f8
commit fb44a609ff
3 changed files with 15 additions and 30 deletions
+13 -15
View File
@@ -14277,15 +14277,12 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
ModifyMoney(-cost);
}
uint32 Player::GetGossipTextId(WorldObject *pSource)
uint32 Player::GetGossipTextId(WorldObject* source)
{
if (!pSource || pSource->GetTypeId() != TYPEID_UNIT || !pSource->ToCreature()->GetDBTableGUIDLow())
if (!source)
return DEFAULT_GOSSIP_MESSAGE;
if (uint32 pos = sObjectMgr->GetNpcGossip(pSource->ToCreature()->GetDBTableGUIDLow()))
return pos;
return DEFAULT_GOSSIP_MESSAGE;
return GetGossipTextId(GetDefaultGossipMenuForSource(source));
}
uint32 Player::GetGossipTextId(uint32 menuId)
@@ -14295,23 +14292,24 @@ uint32 Player::GetGossipTextId(uint32 menuId)
if (!menuId)
return textId;
GossipMenusMapBounds pMenuBounds = sObjectMgr->GetGossipMenusMapBounds(menuId);
GossipMenusMapBounds menuBounds = sObjectMgr->GetGossipMenusMapBounds(menuId);
for (GossipMenusMap::const_iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr)
{
for (GossipMenusMap::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr)
if (sConditionMgr->IsPlayerMeetToConditions(this, itr->second.conditions))
textId = itr->second.text_id;
}
return textId;
}
uint32 Player::GetDefaultGossipMenuForSource(WorldObject *pSource)
uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source)
{
if (pSource->GetTypeId() == TYPEID_UNIT)
return pSource->ToCreature()->GetCreatureInfo()->GossipMenuId;
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
return((GameObject*)pSource)->GetGOInfo()->GetGossipMenuId();
switch (source->GetTypeId())
{
case TYPEID_UNIT:
return source->ToCreature()->GetCreatureInfo()->GossipMenuId;
case TYPEID_GAMEOBJECT:
return source->ToGameObject()->GetGOInfo()->GetGossipMenuId();
}
return 0;
}
+2 -2
View File
@@ -1339,8 +1339,8 @@ class Player : public Unit, public GridObject<Player>
void OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId);
uint32 GetGossipTextId(uint32 menuId);
uint32 GetGossipTextId(WorldObject *pSource);
uint32 GetDefaultGossipMenuForSource(WorldObject *pSource);
uint32 GetGossipTextId(WorldObject* source);
static uint32 GetDefaultGossipMenuForSource(WorldObject* source);
/*********************************************************/
/*** QUEST SYSTEM ***/