TeleporterQuestRecommendationHolder support for more than one conditions.

This commit is contained in:
MobiusDevelopment
2019-04-11 21:23:38 +00:00
parent de2d8b316e
commit a96e5e99f3
22 changed files with 169 additions and 141 deletions

View File

@@ -54,8 +54,8 @@ public final class TeleporterInstance extends Npc
// static
// {
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", new int[]{-1}, "30848-Q561-Q562"));
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", new int[]{-1}, "30848-561-562"));
// }
public TeleporterInstance(NpcTemplate template)
@@ -177,16 +177,18 @@ public final class TeleporterInstance extends Npc
pom = String.valueOf(npcId);
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
{
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
CHECK: for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
{
final QuestState qs = player.getQuestState(rec.getQuestName());
if ((qs != null) && qs.isStarted())
{
final int cond = rec.getCond();
if ((cond == -1) || qs.isCond(cond))
for (int cond : rec.getConditions())
{
pom = rec.getHtml();
break;
if ((cond == -1) || qs.isCond(cond))
{
pom = rec.getHtml();
break CHECK;
}
}
}
}

View File

@@ -23,14 +23,14 @@ public class TeleporterQuestRecommendationHolder
{
private final int _npcId;
private final String _questName;
private final int _cond; // -1 = all conditions
private final int[] _conditions; // -1 = all conditions
private final String _html;
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
public TeleporterQuestRecommendationHolder(int npcId, String questName, int[] conditions, String html)
{
_npcId = npcId;
_questName = questName;
_cond = cond;
_conditions = conditions;
_html = html;
}
@@ -44,9 +44,9 @@ public class TeleporterQuestRecommendationHolder
return _questName;
}
public int getCond()
public int[] getConditions()
{
return _cond;
return _conditions;
}
public String getHtml()