Order quest links by quest activity.
This commit is contained in:
@@ -84,6 +84,10 @@ public class QuestLink implements IBypassHandler
|
|||||||
private static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Collection<Quest> quests)
|
private static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Collection<Quest> quests)
|
||||||
{
|
{
|
||||||
final StringBuilder sb = StringUtil.startAppend(150, "<html><body>");
|
final StringBuilder sb = StringUtil.startAppend(150, "<html><body>");
|
||||||
|
final StringBuilder qStarted = StringUtil.startAppend(150, "");
|
||||||
|
final StringBuilder qCanStart = StringUtil.startAppend(150, "");
|
||||||
|
final StringBuilder qCannotstart = StringUtil.startAppend(150, "");
|
||||||
|
final StringBuilder qComplete = StringUtil.startAppend(150, "");
|
||||||
String state = "";
|
String state = "";
|
||||||
String color = "";
|
String color = "";
|
||||||
|
|
||||||
@@ -121,9 +125,51 @@ public class QuestLink implements IBypassHandler
|
|||||||
state = quest.isCustomQuest() ? " (Done)" : "03";
|
state = quest.isCustomQuest() ? " (Done)" : "03";
|
||||||
color = "787878";
|
color = "787878";
|
||||||
}
|
}
|
||||||
StringUtil.append(sb, "<font color=\"" + color + "\">");
|
|
||||||
StringUtil.append(sb, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
|
|
||||||
|
|
||||||
|
switch (color)
|
||||||
|
{
|
||||||
|
case "ffdd66": // started
|
||||||
|
{
|
||||||
|
StringUtil.append(qStarted, "<font color=\"" + color + "\">");
|
||||||
|
StringUtil.append(qStarted, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
|
||||||
|
appendToText(quest, qStarted, state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "bbaa88": // can start
|
||||||
|
{
|
||||||
|
StringUtil.append(qCanStart, "<font color=\"" + color + "\">");
|
||||||
|
StringUtil.append(qCanStart, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
|
||||||
|
appendToText(quest, qCanStart, state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "a62f31": // cannot start
|
||||||
|
{
|
||||||
|
StringUtil.append(qCannotstart, "<font color=\"" + color + "\">");
|
||||||
|
StringUtil.append(qCannotstart, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
|
||||||
|
appendToText(quest, qCannotstart, state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "787878": // complete
|
||||||
|
{
|
||||||
|
StringUtil.append(qComplete, "<font color=\"" + color + "\">");
|
||||||
|
StringUtil.append(qComplete, "<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_", String.valueOf(npc.getObjectId()), "_Quest ", quest.getName(), "\">");
|
||||||
|
appendToText(quest, qComplete, state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append(qStarted);
|
||||||
|
sb.append(qCanStart);
|
||||||
|
sb.append(qCannotstart);
|
||||||
|
sb.append(qComplete);
|
||||||
|
sb.append("</body></html>");
|
||||||
|
|
||||||
|
// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
|
||||||
|
npc.insertObjectIdAndShowChatWindow(player, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void appendToText(Quest quest, StringBuilder sb, String state)
|
||||||
|
{
|
||||||
if (quest.isCustomQuest())
|
if (quest.isCustomQuest())
|
||||||
{
|
{
|
||||||
StringUtil.append(sb, quest.getDescr(), state);
|
StringUtil.append(sb, quest.getDescr(), state);
|
||||||
@@ -144,11 +190,6 @@ public class QuestLink implements IBypassHandler
|
|||||||
}
|
}
|
||||||
sb.append("</button></font>");
|
sb.append("</button></font>");
|
||||||
}
|
}
|
||||||
sb.append("</body></html>");
|
|
||||||
|
|
||||||
// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
|
|
||||||
npc.insertObjectIdAndShowChatWindow(player, sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a quest window on client with the text of the L2NpcInstance.<br>
|
* Open a quest window on client with the text of the L2NpcInstance.<br>
|
||||||
|
Reference in New Issue
Block a user