Correctly limited quest log and achievement diary scrolling
This commit is contained in:
@@ -114,13 +114,12 @@ public class AchievementDiary {
|
||||
}
|
||||
child++;
|
||||
}
|
||||
// sendString(player, builder.toString(), 11);
|
||||
//Changes the size of the scroll bar
|
||||
//player.getPacketDispatch().sendRunScript(1207, "i", new Object[] { 330 });
|
||||
//sendString(player, builder.toString(), 11);
|
||||
if (!player.getInterfaceManager().isOpened()) {
|
||||
player.getInterfaceManager().open(new Component(DIARY_COMPONENT));
|
||||
}
|
||||
// Changes the size of the scroll bar (see 1207.cs2 for more)
|
||||
// (args1: 1 is to start from top of scroll) (args0: child-12 lines to display)
|
||||
player.getPacketDispatch().sendRunScript(1207, "ii", 1, child - 10);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package core.game.node.entity.player.link.quest;
|
||||
|
||||
import core.game.component.CloseEvent;
|
||||
import core.game.component.Component;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Plugin;
|
||||
@@ -215,6 +214,20 @@ public abstract class Quest implements Plugin<Object> {
|
||||
player.getPacketDispatch().sendString(crossed ? "<str>" + send + "</str>" : send, JOURNAL_COMPONENT, line);
|
||||
}
|
||||
|
||||
/**
|
||||
* Limits the quest log scroll to the number of lines minus 9.
|
||||
* Assumes that you start at line = 11 or line = 12.
|
||||
* Call this function at the end of the drawJournal function like: limitScroll(player, line);
|
||||
* @param player The player.
|
||||
* @param line The number of lines to scroll. Due to sendRunScript, it handles less than 12 lines pretty well.
|
||||
* @param startFromTop Whether to open the log at the top, defaults to opening the log at the very bottom.
|
||||
*/
|
||||
public void limitScrolling(Player player, int line, boolean startFromTop) {
|
||||
// sendRunScript reverses the objects you pass in
|
||||
// (args1: 0 is to start from bottom of scroll) (args0: child-12 lines to display)
|
||||
player.getPacketDispatch().sendRunScript(1207, "ii", startFromTop ? 1 : 0, line - 9); // -9 to give text some padding instead of line - 11 or 12
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws text on the quest reward component.
|
||||
* @param player The player.
|
||||
|
||||
Reference in New Issue
Block a user