diff --git a/src/main/java/com/l2jserver/datapack/custom/service/buffer/BufferService.java b/src/main/java/com/l2jserver/datapack/custom/service/buffer/BufferService.java index 32d3849572b8f78a44a2a6a3314cddc4d992749e..d7d215d275589d04c858f2847e54b9c979e20cd6 100644 --- a/src/main/java/com/l2jserver/datapack/custom/service/buffer/BufferService.java +++ b/src/main/java/com/l2jserver/datapack/custom/service/buffer/BufferService.java @@ -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); } } diff --git a/src/main/resources/data/service/buffer/documentation.txt b/src/main/resources/data/service/buffer/documentation.txt index b888f35651d75f0e35d318e77614485d552dc777..d73d04450c400df137bd0212ce276c2771ca8758 100644 --- a/src/main/resources/data/service/buffer/documentation.txt +++ b/src/main/resources/data/service/buffer/documentation.txt @@ -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: