diff --git a/scripts/commands/holoemote.py b/scripts/commands/holoemote.py index 1146b0b8..6b0554f0 100644 --- a/scripts/commands/holoemote.py +++ b/scripts/commands/holoemote.py @@ -27,7 +27,10 @@ def run(core, actor, target, commandString): if commandString == "kitty": commandString = "technokitty" - + + if commandString is None or commandString == "": + commandString == installedEmote + if commandString != installedEmote and installedEmote != 'all': actor.sendSystemMessage('Your installed Holo-Emote generator does not support that emote.', 0) return @@ -47,7 +50,7 @@ def holoPrompt(player, emote): if player.getHoloEmoteUses() == 1: remainingCharges = "You have 1 charge remaining.\n" - body = "To play a Holo-Emote, type /holoemote ." \ + body = "To play a Holo-Emote, type /holoemote .\n" \ "To delete your Holo-Emote type /holoemote delete.\n" \ "Purchasing a new Holo-Emote will automatically delete your current Holo-Emote.\n" \ "\n" \ diff --git a/scripts/commands/imagedesign.py b/scripts/commands/imagedesign.py index 5a931c73..aabb16af 100644 --- a/scripts/commands/imagedesign.py +++ b/scripts/commands/imagedesign.py @@ -7,13 +7,18 @@ def setup(): def run(core, actor, target, commandString): - if target is None: + if target is None and commandString is None: design = ImageDesignStartMessage(actor.getObjectId(), actor.getObjectId(), target.getObjectId()) obj = ObjControllerMessage(11, design) actor.getClient().getSession().write(obj.serialize()) return else: + if target is None and commandString is not None: + target = core.chatService.getObjectByFirstName(commandString) + if target is None: + return + if target.getGroupId() == actor.getGroupId(): tDesign = ImageDesignStartMessage(target.getObjectId(), actor.getObjectId(), target.getObjectId()) diff --git a/scripts/commands/inspire.py b/scripts/commands/inspire.py index dea0e544..57cd0a29 100644 --- a/scripts/commands/inspire.py +++ b/scripts/commands/inspire.py @@ -17,6 +17,11 @@ def run(core, actor, target, commandString): actor.getClient().getSession().write(objController.serialize()) return + if target is None and commandString is not None: + target = core.chatService.getObjectByFirstName(commandString) + if target is None: + return + if actor.getPosture() != 0x09 and target.getObjectId() != actor.getObjectId(): actor.sendSystemMessage('@performance:insp_buff_must_perform', 2) return diff --git a/scripts/commands/of_buff_def_1.py b/scripts/commands/of_buff_def_1.py index 90af7887..dcc1881b 100644 --- a/scripts/commands/of_buff_def_1.py +++ b/scripts/commands/of_buff_def_1.py @@ -4,6 +4,9 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_1') + if target is None: + target = actor + + core.buffService.addGroupBuff(target, 'of_buff_def_1', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_2.py b/scripts/commands/of_buff_def_2.py index 1627ed3c..9b018174 100644 --- a/scripts/commands/of_buff_def_2.py +++ b/scripts/commands/of_buff_def_2.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_2') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_2', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_3.py b/scripts/commands/of_buff_def_3.py index 1936f539..45cbf987 100644 --- a/scripts/commands/of_buff_def_3.py +++ b/scripts/commands/of_buff_def_3.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_3') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_3', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_4.py b/scripts/commands/of_buff_def_4.py index 0d047c07..43627e27 100644 --- a/scripts/commands/of_buff_def_4.py +++ b/scripts/commands/of_buff_def_4.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_4') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_4', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_5.py b/scripts/commands/of_buff_def_5.py index 2e21de66..3f9fdc33 100644 --- a/scripts/commands/of_buff_def_5.py +++ b/scripts/commands/of_buff_def_5.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_5') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_5', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_6.py b/scripts/commands/of_buff_def_6.py index 80517962..00d8b7e3 100644 --- a/scripts/commands/of_buff_def_6.py +++ b/scripts/commands/of_buff_def_6.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_6') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_6', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_7.py b/scripts/commands/of_buff_def_7.py index 4d0fe8ba..a5dd7341 100644 --- a/scripts/commands/of_buff_def_7.py +++ b/scripts/commands/of_buff_def_7.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_7') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_7', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_8.py b/scripts/commands/of_buff_def_8.py index b5d13337..9fd12b12 100644 --- a/scripts/commands/of_buff_def_8.py +++ b/scripts/commands/of_buff_def_8.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_8') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_8', actor) return \ No newline at end of file diff --git a/scripts/commands/of_buff_def_9.py b/scripts/commands/of_buff_def_9.py index 1b09914e..116775df 100644 --- a/scripts/commands/of_buff_def_9.py +++ b/scripts/commands/of_buff_def_9.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_buff_def_9') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_buff_def_9', actor) return \ No newline at end of file diff --git a/scripts/commands/of_drillmaster_1.py b/scripts/commands/of_drillmaster_1.py index 00c17c70..3b715ac0 100644 --- a/scripts/commands/of_drillmaster_1.py +++ b/scripts/commands/of_drillmaster_1.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_drillmaster_1') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_drillmaster_1', actor) return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_1.py b/scripts/commands/of_focus_fire_1.py index dbd564ec..9fdb7d5c 100644 --- a/scripts/commands/of_focus_fire_1.py +++ b/scripts/commands/of_focus_fire_1.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_focus_fire_1') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_focus_fire_1', actor) return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_2.py b/scripts/commands/of_focus_fire_2.py index 406fb584..92d99f17 100644 --- a/scripts/commands/of_focus_fire_2.py +++ b/scripts/commands/of_focus_fire_2.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_focus_fire_2') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_focus_fire_2', actor) return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_3.py b/scripts/commands/of_focus_fire_3.py index ea194a77..f5900d0a 100644 --- a/scripts/commands/of_focus_fire_3.py +++ b/scripts/commands/of_focus_fire_3.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_focus_fire_3') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_focus_fire_3', actor) return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_4.py b/scripts/commands/of_focus_fire_4.py index d4645925..9f6dc518 100644 --- a/scripts/commands/of_focus_fire_4.py +++ b/scripts/commands/of_focus_fire_4.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_focus_fire_4') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_focus_fire_4', actor) return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_5.py b/scripts/commands/of_focus_fire_5.py index 1ff3a903..dc51c2e6 100644 --- a/scripts/commands/of_focus_fire_5.py +++ b/scripts/commands/of_focus_fire_5.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_focus_fire_5') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_focus_fire_5', actor) return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_6.py b/scripts/commands/of_focus_fire_6.py index 834a0d25..674a5bec 100644 --- a/scripts/commands/of_focus_fire_6.py +++ b/scripts/commands/of_focus_fire_6.py @@ -4,6 +4,8 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addGroupBuff(actor, 'of_focus_fire_6') + if target is None: + target = actor + core.buffService.addGroupBuff(target, 'of_focus_fire_6', actor) return \ No newline at end of file diff --git a/src/resources/objects/Buff.java b/src/resources/objects/Buff.java index c545b5a0..eb207a33 100644 --- a/src/resources/objects/Buff.java +++ b/src/resources/objects/Buff.java @@ -40,12 +40,12 @@ import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; import engine.resources.common.CRC; -@Persistent(version=8) +@Persistent(version=9) public class Buff implements IDelta { @NotPersistent private SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - private String group1; + private String group1, group2; private int priority; private float duration; private String buffName; @@ -86,6 +86,7 @@ public class Buff implements IDelta { if(((String) visitor.getObject(i, 0)).equalsIgnoreCase(buffName)) { group1 = (String) visitor.getObject(i, 1); + group2 = (String) visitor.getObject(i, 2); priority = (int) visitor.getObject(i, 4); duration = (Float) visitor.getObject(i, 6); effect1Name = (String) visitor.getObject(i, 7); @@ -440,4 +441,12 @@ public class Buff implements IDelta { this.groupBufferId = groupBufferId; } + public String getGroup2() { + return group2; + } + + public void setGroup2(String group2) { + this.group2 = group2; + } + } diff --git a/src/services/BuffService.java b/src/services/BuffService.java index f712daf4..6f7620d5 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -89,7 +89,7 @@ public class BuffService implements INetworkDispatch { } } - public Buff doAddBuff(final CreatureObject target, String buffName, CreatureObject buffer) { + public Buff doAddBuff(final CreatureObject target, String buffName, final CreatureObject buffer) { if (target.getPosition().getDistance(buffer.getPosition()) > 20) { return null; @@ -153,6 +153,23 @@ public class BuffService implements INetworkDispatch { buff.setRemovalTask(task); + } else if (buff.getGroup2().contains("of_aura") && buffer != null && buffer.getObjectId() != target.getObjectId()) { + + // I'm not sure if all aura effects follow the same rules, so this is simply restricted to officer aura's atm + ScheduledFuture task = scheduler.scheduleAtFixedRate(new Runnable() { + @SuppressWarnings("unused") + @Override + public void run() { + if (buffer == null) + removeBuffFromCreature(target, buff); + + if (target.getPosition().getDistance2D(buffer.getWorldPosition()) > 80) { + removeBuffFromCreature(target, buff); + } + } + }, 5, 5, TimeUnit.SECONDS); + + buff.setRemovalTask(task); } for (String effect : buff.getParticleEffect().split(",")) { @@ -186,7 +203,6 @@ public class BuffService implements INetworkDispatch { @SuppressWarnings("unused") public void removeBuffFromCreature(CreatureObject creature, Buff buff) { - if(!creature.getBuffList().contains(buff)) return; DamageOverTime dot = creature.getDotByBuff(buff); @@ -201,8 +217,11 @@ public class BuffService implements INetworkDispatch { for (String effect : buff.getParticleEffect().split(",")) { creature.stopEffectObject(buff.getBuffName()); } - - + + if (buff.getRemovalTask() != null) { + buff.getRemovalTask().cancel(true); + buff.setRemovalTask(null); + } } public void clearBuffs(final CreatureObject creature) { diff --git a/src/services/GroupService.java b/src/services/GroupService.java index 4946f503..b6ae0b87 100644 --- a/src/services/GroupService.java +++ b/src/services/GroupService.java @@ -187,8 +187,8 @@ public class GroupService implements INetworkDispatch { for(SWGObject otherMember : group.getMemberList()) { if(otherMember != member) { for(Buff buff : ((CreatureObject) otherMember).getBuffList().get()) { - if(buff.isGroupBuff()) { - core.buffService.doAddBuff(member, buff.getBuffName(), (CreatureObject) core.objectService.getObject(buff.getGroupBufferId())); + if(buff.isGroupBuff() && otherMember.getPlanet() == member.getPlanet() && otherMember.getPosition().getDistance2D(member.getWorldPosition()) <= 80) { + core.buffService.addBuffToCreature((CreatureObject) otherMember, buff.getBuffName(), member); } } return; diff --git a/src/services/SkillService.java b/src/services/SkillService.java index 59831d10..e8533299 100644 --- a/src/services/SkillService.java +++ b/src/services/SkillService.java @@ -92,7 +92,6 @@ public class SkillService implements INetworkDispatch { if (isTitle == true) { core.playerService.addPlayerTitle(player, skill); - Console.println("Gave skill title: " + skill); } if (isProfession) { @@ -118,7 +117,6 @@ public class SkillService implements INetworkDispatch { for (String skillName : skillsRequired) { if (skillName != "" && !creature.hasSkill(skillName)) { - System.out.println("Skill Name: " + skillName); return; } }