mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[12144] Change behaviour of text selection for gossip menus
This way the behaviour will be well defined in case multiple conditions match. Now the text with the highest condition-id will be taken.
This commit is contained in:
parent
796068fc13
commit
d387c20dad
2 changed files with 15 additions and 14 deletions
|
|
@ -13118,32 +13118,33 @@ uint32 Player::GetGossipTextId(uint32 menuId, WorldObject* pSource)
|
||||||
if (!menuId)
|
if (!menuId)
|
||||||
return textId;
|
return textId;
|
||||||
|
|
||||||
GossipMenusMapBounds pMenuBounds = sObjectMgr.GetGossipMenusMapBounds(menuId);
|
uint32 scriptId = 0;
|
||||||
|
uint32 lastConditionId = 0;
|
||||||
|
|
||||||
|
GossipMenusMapBounds pMenuBounds = sObjectMgr.GetGossipMenusMapBounds(menuId);
|
||||||
for (GossipMenusMap::const_iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr)
|
for (GossipMenusMap::const_iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second.conditionId && sObjectMgr.IsPlayerMeetToNEWCondition(this, itr->second.conditionId))
|
// Take the text that has the highest conditionId of all fitting
|
||||||
|
// TODO: Simplify logic to (!itr->second.conditionId && !lastConditionId) || <lineBelow>)
|
||||||
|
if (itr->second.conditionId > lastConditionId && sObjectMgr.IsPlayerMeetToNEWCondition(this, itr->second.conditionId))
|
||||||
{
|
{
|
||||||
|
lastConditionId = itr->second.conditionId;
|
||||||
textId = itr->second.text_id;
|
textId = itr->second.text_id;
|
||||||
|
scriptId = itr->second.script_id;
|
||||||
// Start related script
|
|
||||||
if (itr->second.script_id)
|
|
||||||
GetMap()->ScriptsStart(sGossipScripts, itr->second.script_id, this, pSource);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if (!itr->second.conditionId)
|
else if (!itr->second.conditionId && !lastConditionId)
|
||||||
{
|
{
|
||||||
if (sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_1) && sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_2))
|
if (sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_1) && sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_2))
|
||||||
{
|
{
|
||||||
textId = itr->second.text_id;
|
textId = itr->second.text_id;
|
||||||
|
scriptId = itr->second.script_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start related script
|
// Start related script
|
||||||
if (itr->second.script_id)
|
if (scriptId)
|
||||||
GetMap()->ScriptsStart(sGossipScripts, itr->second.script_id, this, pSource);
|
GetMap()->ScriptsStart(sGossipScripts, scriptId, this, pSource);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return textId;
|
return textId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12143"
|
#define REVISION_NR "12144"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue