Core/Gossip: Use algorithms from std::ranges namespace in gossip menu code
Port From (https://github.com/TrinityCore/TrinityCore/commit/a562f4fafade619ec1289d6f54e14fc28dc010d8)
This commit is contained in:
@@ -35,15 +35,12 @@ namespace Game.Misc
|
|||||||
orderIndex = (int)(itr.OrderIndex + 1);
|
orderIndex = (int)(itr.OrderIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_menuItems.Empty())
|
foreach (var (_, _menuItem) in _menuItems)
|
||||||
{
|
{
|
||||||
foreach (var pair in _menuItems)
|
if (_menuItem.OrderIndex > orderIndex)
|
||||||
{
|
break;
|
||||||
if (pair.Value.OrderIndex > orderIndex)
|
|
||||||
break;
|
|
||||||
|
|
||||||
orderIndex = (int)pair.Value.OrderIndex + 1;
|
orderIndex = (int)_menuItem.OrderIndex + 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,13 +415,13 @@ namespace Game.Misc
|
|||||||
{
|
{
|
||||||
QuestGiverQuestDetails packet = new();
|
QuestGiverQuestDetails packet = new();
|
||||||
|
|
||||||
packet.QuestTitle = quest.LogTitle;
|
packet.QuestTitle = quest.LogTitle;
|
||||||
packet.LogDescription = quest.LogDescription;
|
packet.LogDescription = quest.LogDescription;
|
||||||
packet.DescriptionText = quest.QuestDescription;
|
packet.DescriptionText = quest.QuestDescription;
|
||||||
packet.PortraitGiverText = quest.PortraitGiverText;
|
packet.PortraitGiverText = quest.PortraitGiverText;
|
||||||
packet.PortraitGiverName = quest.PortraitGiverName;
|
packet.PortraitGiverName = quest.PortraitGiverName;
|
||||||
packet.PortraitTurnInText = quest.PortraitTurnInText;
|
packet.PortraitTurnInText = quest.PortraitTurnInText;
|
||||||
packet.PortraitTurnInName = quest.PortraitTurnInName;
|
packet.PortraitTurnInName = quest.PortraitTurnInName;
|
||||||
|
|
||||||
Locale locale = _session.GetSessionDbLocaleIndex();
|
Locale locale = _session.GetSessionDbLocaleIndex();
|
||||||
|
|
||||||
@@ -714,13 +711,9 @@ namespace Game.Misc
|
|||||||
_questMenuItems.Add(questMenuItem);
|
_questMenuItems.Add(questMenuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasItem(uint questId)
|
public bool HasItem(uint questId)
|
||||||
{
|
{
|
||||||
foreach (var item in _questMenuItems)
|
return _questMenuItems.Any(p => p.QuestId == questId);
|
||||||
if (item.QuestId == questId)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearMenu()
|
public void ClearMenu()
|
||||||
|
|||||||
Reference in New Issue
Block a user