Skip to content
Snippets Groups Projects
Commit 57769c44 authored by HorridoJoho's avatar HorridoJoho
Browse files

BufferService

+ added target select command
+ added target deselect command
* adjusted documentation
parent 4d2e6f9e
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,7 @@ public final class BufferService extends CustomServiceScript {
private static final Map<Integer, String> ACTIVE_PLAYER_BUFFLISTS = new ConcurrentHashMap<>();
private static final Map<Integer, String> ACTIVE_PLAYER_CATEGORIES = new ConcurrentHashMap<>();
private static final Map<Integer, String> ACTIVE_PLAYER_TARGETS = new ConcurrentHashMap<>();
BufferService() {
super(SCRIPT_NAME);
......@@ -125,6 +126,11 @@ public final class BufferService extends CustomServiceScript {
}
}
String activeTarget = ACTIVE_PLAYER_TARGETS.get(player.getObjectId());
if (activeTarget != null) {
placeholders.put("active_target", new HTMLTemplatePlaceholder("active_taget", activeTarget));
}
HTMLTemplatePlaceholder playerPlaceholder = new HTMLTemplatePlaceholder("player", null);
playerPlaceholder.addChild("name", player.getName());
playerPlaceholder.addChild("unique_max_buffs", String.valueOf(player.getStat().getMaxBuffCount()));
......@@ -355,7 +361,20 @@ public final class BufferService extends CustomServiceScript {
target.stopAllEffectsExceptThoseThatLastThroughDeath();
}
private void targetSelect(L2PcInstance player, L2Playable target) {
ACTIVE_PLAYER_TARGETS.put(player.getObjectId(), target.isSummon() ? "summon" : "player");
}
private void targetDeselect(L2PcInstance player) {
ACTIVE_PLAYER_TARGETS.remove(player.getObjectId());
}
private void executeTargetCommand(L2PcInstance player, AbstractBuffer buffer, CommandProcessor command) {
if (command.matchAndRemove("deselect", "des")) {
targetDeselect(player);
return;
}
// first determine the target
L2Playable target;
if (command.matchAndRemove("player ", "p ")) {
......@@ -387,6 +406,8 @@ public final class BufferService extends CustomServiceScript {
targetHeal(player, target, buffer);
} else if (command.matchAndRemove("cancel", "c")) {
targetCancel(player, target, buffer);
} else if (command.matchAndRemove("select", "s")) {
targetSelect(player, target);
}
}
......
......@@ -13,6 +13,7 @@ Commands:
preset, p [presetId] Opens preset.html
buff, b [categoryId] [buffId] Opens buff.html
unique, u [uniqueName] Opens unique.html
target, t [deselect, des] Deselect the active target
target, t [target] [target] can either be player or
summon
buff, b [categoryId] [buffId] Apply a buff to the target
......@@ -22,6 +23,7 @@ Commands:
target
heal, h Heal the target
cancel, c Cancel bufs of the target
select, s Select target as active
category, c
select, s [categoryId] Select a buff category as active.
The selected buff category can be
......@@ -79,6 +81,7 @@ is put in it's place. All available placeholders are:
| player.unique_max_song_dances | number | The players unique max songs/dances |
| active_unique | list(UniqueBufflist) | Only defined if one is selected |
| active_category | list(BuffCategory) | Only defined if one is selected |
| active_target | string | Only defined if one is selected |
|-------------------------------|----------------------|-------------------------------------|
Following is a list of html files and their additional available placeholders:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment