diff --git a/scripts/commands/colorlights.py b/scripts/commands/colorlights.py index 5f9f7abc..0708c4ea 100644 --- a/scripts/commands/colorlights.py +++ b/scripts/commands/colorlights.py @@ -4,23 +4,35 @@ def setup(): return def run(core, actor, target, commandString): - + level = actor.getLevel() command = 'ColorLights1' effect = 'clienteffect/entertainer_color_lights_level_1.cef' rLevel = 4 # minimum level to perform this effect - if commandString == '2': - command = 'ColorLights2' - effect = 'clienteffect/entertainer_color_lights_level_2.cef' - rLevel = 20 + if commandString is None or commandString == '': + + if level >= 50: + command = 'ColorLights3' + effect = 'clienteffect/entertainer_color_lights_level_3.cef' + + elif level >= 20: + command = 'ColorLights2' + effect = 'clienteffect/entertainer_color_lights_level_2.cef' - elif commandString == '3': - command = 'ColorLights3' - effect = 'clienteffect/entertainer_color_lights_level_3.cef' - rLevel = 50 - - if actor.getLevel() < rLevel: - actor.sendSystemMessage('@performance:effect_lack_skill_self') + if commandString is not None: + if commandString == '2': + command = 'ColorLights2' + effect = 'clienteffect/entertainer_color_lights_level_2.cef' + rLevel = 20 + + elif commandString == '3': + command = 'ColorLights3' + effect = 'clienteffect/entertainer_color_lights_level_3.cef' + rLevel = 50 + + if level < rLevel: + actor.sendSystemMessage('@performance:effect_lack_skill_self', 0) + return if core.entertainmentService.performEffect(actor, command, effect, target) is True: actor.sendSystemMessage('@performance:effect_perform_color_lights', 0) diff --git a/scripts/commands/covercharge.py b/scripts/commands/covercharge.py new file mode 100644 index 00000000..82ca56af --- /dev/null +++ b/scripts/commands/covercharge.py @@ -0,0 +1,46 @@ +from services.sui import SUIWindow +from services.sui.SUIWindow import Trigger +from java.util import Vector +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + ghost = actor.getSlottedObject('ghost') + if ghost.getProfession() != 'entertainer_1a': + actor.sendSystemMessage('@performance:cc_no_skill', 0) + return + if commandString == '0': + actor.setCoverCharge(0) + actor.sendSystemMessage('@performance:cc_stop_charge', 0) + return + + if commandString == None or commandString == '': + window = core.suiService.createInputBox(2, '@performance:cc_set_title', '@performance:cc_set_prompt', actor, None, 10, handleCoverCharge) + window.setProperty('txtInput:NumericInteger', 'true') + window.setProperty('txtInput:MaxLength', '12') + core.suiService.openSUIWindow(window) + return + else: + try: + actor.setCoverCharge(int(commandString)) + actor.sendSystemMessage('You are now charging a cover of ' + commandString + ' credit(s).', 0) + except ValueError: + return + return + return + +def handleCoverCharge(actor, window, eventType, returnList): + if eventType == 0 and len(returnList) == 1: + charge = returnList.get(0) + if charge == "0": + actor.setCoverCharge(0) + actor.sendSystemMessage('@performance:cc_stop_charge', 0) + return + else: + actor.setCoverCharge(int(returnList.get(0))) + actor.sendSystemMessage('You are now charging a cover of ' + returnList.get(0) + ' credits(s).', 0) + return + return + return \ No newline at end of file diff --git a/scripts/commands/dazzle.py b/scripts/commands/dazzle.py index e1d8cefd..03e79b11 100644 --- a/scripts/commands/dazzle.py +++ b/scripts/commands/dazzle.py @@ -4,23 +4,35 @@ def setup(): return def run(core, actor, target, commandString): - + level = actor.getLevel() command = 'Dazzle1' effect = 'clienteffect/entertainer_dazzle_level_1.cef' rLevel = 10 # minimum level to perform this effect - if commandString == '2': - command = 'Dazzle2' - effect = 'clienteffect/entertainer_dazzle_level_2.cef' - rLevel = 20 + if commandString is None or commandString == '': + + if level >= 30: + command = 'Dazzle3' + effect = 'clienteffect/entertainer_dazzle_level_3.cef' + + elif level >= 20: + command = 'Dazzle2' + effect = 'clienteffect/entertainer_dazzle_level_2.cef' - elif commandString == '3': - command = 'Dazzle3' - effect = 'clienteffect/entertainer_dazzle_level_3.cef' - rLevel = 30 - - if actor.getLevel() < rLevel: - actor.sendSystemMessage('@performance:effect_lack_skill_self') + if commandString is not None: + if commandString == '2': + command = 'Dazzle2' + effect = 'clienteffect/entertainer_dazzle_level_2.cef' + rLevel = 20 + + elif commandString == '3': + command = 'Dazzle3' + effect = 'clienteffect/entertainer_dazzle_level_3.cef' + rLevel = 30 + + if level < rLevel: + actor.sendSystemMessage('@performance:effect_lack_skill_self', 0) + return if core.entertainmentService.performEffect(actor, command, effect, target) is True: actor.sendSystemMessage('@performance:effect_perform_dazzle', 0) diff --git a/scripts/commands/distract.py b/scripts/commands/distract.py index d92cb55e..ec57828b 100644 --- a/scripts/commands/distract.py +++ b/scripts/commands/distract.py @@ -4,25 +4,35 @@ def setup(): return def run(core, actor, target, commandString): - + level = actor.getLevel() command = 'Distract1' effect = 'clienteffect/entertainer_distract_level_1.cef' rLevel = 18 # minimum level to perform this effect - if commandString == '2': - command = 'Distract2' - effect = 'clienteffect/entertainer_distract_level_2.cef' - rLevel = 50 + if commandString is None or commandString == '': + if level >= 75: + command = 'Distract3' + effect = 'clienteffect/entertainer_distract_level_3.cef' + + elif level >= 50: + command = 'Distract2' + effect = 'clienteffect/entertainer_distract_level_2.cef' - elif commandString == '3': - command = 'Distract3' - effect = 'clienteffect/entertainer_distract_level_3.cef' - rLevel = 75 - - if actor.getLevel() < rLevel: - actor.sendSystemMessage('@performance:effect_lack_skill_self') + if commandString is not None: + if commandString == '2': + command = 'Distract2' + effect = 'clienteffect/entertainer_distract_level_2.cef' + rLevel = 50 + + elif commandString == '3': + command = 'Distract3' + effect = 'clienteffect/entertainer_distract_level_3.cef' + rLevel = 75 + + if level < rLevel: + actor.sendSystemMessage('@performance:effect_lack_skill_self', 0) return - + if core.entertainmentService.performEffect(actor, command, effect, target) is True: actor.sendSystemMessage('@performance:effect_perform_distract', 0) return \ No newline at end of file diff --git a/scripts/commands/firejet.py b/scripts/commands/firejet.py index 63a5ba54..26261d56 100644 --- a/scripts/commands/firejet.py +++ b/scripts/commands/firejet.py @@ -4,25 +4,35 @@ def setup(): return def run(core, actor, target, commandString): - + level = actor.getLevel() command = 'FireJets1' effect = 'clienteffect/entertainer_fire_jets_level_1.cef' rLevel = 26 # minimum level to perform this effect - if commandString == '2': - command = 'FireJets2' - effect = 'clienteffect/entertainer_fire_jets_level_2.cef' - rLevel = 50 + if commandString is None or commandString == '': + if level >= 75: + command = 'FireJets3' + effect = 'clienteffect/entertainer_fire_jets_level_3.cef' + + elif level >= 50: + command = 'FireJets2' + effect = 'clienteffect/entertainer_fire_jets_level_2.cef' - elif commandString == '3': - command = 'FireJets3' - effect = 'clienteffect/entertainer_fire_jets_level_3.cef' - rLevel = 75 + if commandString is not None: + if commandString == '2': + command = 'FireJets2' + effect = 'clienteffect/entertainer_fire_jets_level_2.cef' + rLevel = 50 + + elif commandString == '3': + command = 'FireJets3' + effect = 'clienteffect/entertainer_fire_jets_level_3.cef' + rLevel = 75 - if actor.getLevel() < rLevel: - actor.sendSystemMessage('@performance:effect_lack_skill_self') + if level < rLevel: + actor.sendSystemMessage('@performance:effect_lack_skill_self', 0) return - + if core.entertainmentService.performEffect(actor, command, effect, target) is True: actor.sendSystemMessage('@performance:effect_perform_fire_jets', 0) return \ No newline at end of file diff --git a/scripts/commands/smokebomb.py b/scripts/commands/smokebomb.py index cb747ce1..a9da5abb 100644 --- a/scripts/commands/smokebomb.py +++ b/scripts/commands/smokebomb.py @@ -4,23 +4,34 @@ def setup(): return def run(core, actor, target, commandString): - + level = actor.getLevel() command = 'SmokeBomb1' effect = 'clienteffect/entertainer_smoke_bomb_level_1.cef' rLevel = 50 # minimum level to perform this effect - if commandString == '2': - command = 'SmokeBomb2' - effect = 'clienteffect/entertainer_smoke_bomb_level_2.cef' - rLevel = 75 + if commandString is None or commandString == '': + if level >= 90: + command = 'SmokeBomb3' + effect = 'clienteffect/entertainer_smoke_bomb_level_3.cef' + + elif level >= 75: + command = 'SmokeBomb2' + effect = 'clienteffect/entertainer_smoke_bomb_level_2.cef' - elif commandString == '3': - command = 'SmokeBomb3' - effect = 'clienteffect/entertainer_smoke_bomb_level_3.cef' - rLevel = 90 + if commandString is not None: + if commandString == '2': + command = 'SmokeBomb2' + effect = 'clienteffect/entertainer_smoke_bomb_level_2.cef' + rLevel = 75 + + elif commandString == '3': + command = 'SmokeBomb3' + effect = 'clienteffect/entertainer_smoke_bomb_level_3.cef' + rLevel = 90 - if actor.getLevel() < rLevel: - actor.sendSystemMessage('@performance:effect_lack_skill_self') + if level < rLevel: + actor.sendSystemMessage('@performance:effect_lack_skill_self', 0) + return if core.entertainmentService.performEffect(actor, command, effect, target) is True: actor.sendSystemMessage('@performance:effect_perform_smoke_bomb', 0) diff --git a/scripts/commands/spotlight.py b/scripts/commands/spotlight.py index 1f94394a..204c0017 100644 --- a/scripts/commands/spotlight.py +++ b/scripts/commands/spotlight.py @@ -5,23 +5,33 @@ def setup(): return def run(core, actor, target, commandString): - + level = actor.getLevel() command = 'SpotLight1' effect = 'clienteffect/entertainer_spot_light_level_1.cef' rLevel = 1 # minimum level to perform this effect - if commandString == '2': - command = 'SpotLight2' - effect = 'clienteffect/entertainer_spot_light_level_2.cef' - rLevel = 20 + if commandString is None or commandString == '': + if level >= 30: + command = 'SpotLight3' + effect = 'clienteffect/entertainer_spot_light_level_3.cef' + + elif level >= 20: + command = 'SpotLight2' + effect = 'clienteffect/entertainer_spot_light_level_2.cef' - elif commandString == '3': - command = 'SpotLight3' - effect = 'clienteffect/entertainer_spot_light_level_3.cef' - rLevel = 30 + if commandString is not None: + if commandString == '2': + command = 'SpotLight2' + effect = 'clienteffect/entertainer_spot_light_level_2.cef' + rLevel = 20 + + elif commandString == '3': + command = 'SpotLight3' + effect = 'clienteffect/entertainer_spot_light_level_3.cef' + rLevel = 30 - if actor.getLevel() < rLevel: - actor.sendSystemMessage('@performance:effect_lack_skill_self') + if level < rLevel: + actor.sendSystemMessage('@performance:effect_lack_skill_self', 0) return if core.entertainmentService.performEffect(actor, command, effect, None) is True: diff --git a/scripts/commands/stopwatching.py b/scripts/commands/stopwatching.py index 7dc96fc8..23a36c17 100644 --- a/scripts/commands/stopwatching.py +++ b/scripts/commands/stopwatching.py @@ -4,12 +4,14 @@ def setup(): return def run(core, actor, target, commandString): - dancer = actor.getPerformanceWatchee() - if not dancer: - return - + performer = target + if commandString is not None and target is None: + performer = core.chatService.getObjectByFirstName(commandString) + + if performer is None: + return + performer.removeAudience(actor) actor.setPerformanceWatchee(None) - dancer.removeAudience(actor) if not actor.getPerformanceListenee(): actor.setMoodAnimation('') diff --git a/scripts/commands/ventriloquism.py b/scripts/commands/ventriloquism.py index 043293ff..1781fbd1 100644 --- a/scripts/commands/ventriloquism.py +++ b/scripts/commands/ventriloquism.py @@ -4,23 +4,34 @@ def setup(): return def run(core, actor, target, commandString): - + level = actor.getLevel() command = 'Ventriloquism1' effect = 'clienteffect/entertainer_ventriloquism_level_1.cef' rLevel = 58 # minimum level to perform this effect - if commandString == '2': - command = 'Ventriloquism2' - effect = 'clienteffect/entertainer_ventriloquism_level_2.cef' - rLevel = 75 + if commandString is None or commandString == '': + if level >= 90: + command = 'Ventriloquism3' + effect = 'clienteffect/entertainer_ventriloquism_level_3.cef' + + elif level >= 75: + command = 'Ventriloquism2' + effect = 'clienteffect/entertainer_ventriloquism_level_2.cef' - elif commandString == '3': - command = 'Ventriloquism3' - effect = 'clienteffect/entertainer_ventriloquism_level_3.cef' - rLevel = 90 + if commandString is not None: + if commandString == '2': + command = 'Ventriloquism2' + effect = 'clienteffect/entertainer_ventriloquism_level_2.cef' + rLevel = 75 + + elif commandString == '3': + command = 'Ventriloquism3' + effect = 'clienteffect/entertainer_ventriloquism_level_3.cef' + rLevel = 90 - if actor.getLevel() < rLevel: + if level < rLevel: actor.sendSystemMessage('@performance:effect_lack_skill_self', 0) + return if core.entertainmentService.performEffect(actor, command, effect, target) is True: actor.sendSystemMessage('@performance:effect_perform_ventriloquism', 0) diff --git a/scripts/commands/watch.py b/scripts/commands/watch.py index 0a9baf04..07ca268d 100644 --- a/scripts/commands/watch.py +++ b/scripts/commands/watch.py @@ -26,14 +26,10 @@ def run(core, actor, target, commandString): if target.getPosture() != 0x09 or not perf or perf.getDanceVisualId() < 0: actor.sendSystemMessage(target.getCustomName() + ' is not dancing.',0) return - - oldWatchee = actor.getPerformanceWatchee() - if oldWatchee and oldWatchee != target: - oldWatchee.removeAudience(actor) - - actor.setPerformanceWatchee(target) - target.addAudience(actor) - core.entertainmentService.startSpectating(actor, target) - actor.setMoodAnimation('entertained') - actor.sendSystemMessage('You start watching ' + target.getCustomName() + '.',0) + + if target.getCoverCharge() > 0 or target.getCoverCharge() == None: + core.entertainmentService.handleCoverCharge(actor, target) + return + else: + core.entertainmentService.startSpectating(actor, target, True) return \ No newline at end of file diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 2d89527f..efb52cb8 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -57,7 +57,7 @@ import engine.resources.scene.Quaternion; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; -@Entity(version=2) +@Entity(version=3) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -119,12 +119,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { private int performanceCounter = 0; private int performanceId = 0; private boolean hologram = false; - //FIXME: this is a bit of a hack. private boolean performanceType = false; - //FIXME: hmm.. or persistent? - @NotPersistent private boolean acceptBandflourishes = true; - @NotPersistent private boolean groupDance = true; private CreatureObject performanceWatchee; private CreatureObject performanceListenee; @@ -172,6 +168,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent private boolean performingEffect; + private int coverCharge; + public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, Template, position, orientation); messageBuilder = new CreatureMessageBuilder(this); @@ -422,7 +420,6 @@ public class CreatureObject extends TangibleObject implements IPersistent { if(performanceType) { next.sendSystemMessage("You stop watching " + getCustomName() + ".",(byte)0); } else { next.sendSystemMessage("You stop listening to " + getCustomName() + ".",(byte)0); } next.getSpectatorTask().cancel(true); - next.getInspirationTick().cancel(true); } //not sure if this behaviour is correct. might need fixing later. performanceAudience = new SWGList(); @@ -1539,7 +1536,11 @@ public class CreatureObject extends TangibleObject implements IPersistent { public void removeAudience(CreatureObject audienceMember) { synchronized(objectMutex) { if (performanceAudience == null) { return; } - performanceAudience.remove(audienceMember); + if (audienceMember.getInspirationTick() != null) + audienceMember.getInspirationTick().cancel(true); + + if(performanceAudience.contains(audienceMember)) + performanceAudience.remove(audienceMember); // SWGList error } } @@ -1690,4 +1691,16 @@ public class CreatureObject extends TangibleObject implements IPersistent { return hologram; } } + + public int getCoverCharge() { + synchronized(objectMutex) { + return coverCharge; + } + } + + public void setCoverCharge(int coverCharge) { + synchronized (objectMutex) { + this.coverCharge = coverCharge; + } + } } diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index 9e1a0b64..d3375af1 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -38,6 +38,10 @@ import resources.objects.SWGList; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; +import services.sui.SUIService.InputBoxType; +import services.sui.SUIWindow; +import services.sui.SUIWindow.SUICallback; +import services.sui.SUIWindow.Trigger; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; import engine.clients.Client; @@ -341,8 +345,10 @@ public class EntertainmentService implements INetworkDispatch { core.commandService.registerCommand("startdance"); core.commandService.registerCommand("stopdance"); core.commandService.registerCommand("watch"); - core.commandService.registerCommand("stopwatching"); + //core.commandService.registerCommand("stopwatching"); // SWGList error //core.commandService.registerCommand("holoEmote"); + core.commandService.registerCommand("covercharge"); + // TODO: Add /bandsolo, /bandpause, /changeBandMusic, /changeDance, /changeGroupDance, /changeMusic // Entertainer Effects @@ -499,8 +505,19 @@ public class EntertainmentService implements INetworkDispatch { } - public void startSpectating(final CreatureObject spectator, final CreatureObject performer) { - + public void startSpectating(final CreatureObject spectator, final CreatureObject performer, boolean spectateType) { + + // visual + if (spectator.getPerformanceWatchee() == performer && spectateType) + spectator.getPerformanceWatchee().removeAudience(spectator); + // music + else if (spectator.getPerformanceListenee() == performer && !spectateType) + spectator.getPerformanceListenee().removeAudience(spectator); + + spectator.setPerformanceWatchee(performer); + performer.addAudience(spectator); + spectator.setMoodAnimation("entertained"); + final ScheduledFuture spectatorTask = scheduler.scheduleAtFixedRate(new Runnable() { @Override @@ -519,7 +536,7 @@ public class EntertainmentService implements INetworkDispatch { } spectator.setMoodAnimation("neutral"); performer.removeAudience(spectator); - + if (spectator.getInspirationTick().cancel(true)) spectator.getSpectatorTask().cancel(true); } @@ -528,11 +545,16 @@ public class EntertainmentService implements INetworkDispatch { }, 2, 2, TimeUnit.SECONDS); spectator.setSpectatorTask(spectatorTask); - + if(((PlayerObject)performer.getSlottedObject("ghost")).getProfession().equals("entertainer_1a")) { handleInspirationTicks(spectator, performer); } - + + if(spectateType) + spectator.sendSystemMessage("You start watching " + performer.getCustomName() + ".", (byte) 0); + else + spectator.sendSystemMessage("You start listening to " + performer.getCustomName() + ".", (byte) 0); + } public void performFlourish(final CreatureObject performer, int flourish) { @@ -624,15 +646,15 @@ public class EntertainmentService implements INetworkDispatch { public void run() { int time = 0; // current buff duration time (minutes) int buffCap = 215; // 5 hours 35 minutes - 2 hours (buff duration increase bonus) << Taken from video, doesn't account for performance bonuses etc. - + if (spectator.getAttachment("inspireDuration") != null) time+= (int) spectator.getAttachment("inspireDuration"); - + if (performer.getSkillMod("expertise_en_inspire_buff_duration_increase") != null) { SkillMod durationMod = performer.getSkillMod("expertise_en_inspire_buff_duration_increase"); buffCap += durationMod.getBase() + durationMod.getModifier(); } - + if (time >= buffCap) { spectator.setAttachment("inspireDuration", buffCap); // incase someone went over cap spectator.getInspirationTick().cancel(true); @@ -642,22 +664,58 @@ public class EntertainmentService implements INetworkDispatch { SkillMod pulseMod = performer.getSkillMod("expertise_en_inspire_pulse_duration_increase"); entTick += pulseMod.getBase() + pulseMod.getModifier(); } - + int duration = (time + entTick); // minutes int hMinutes = MathUtilities.secondsToHourMinutes(duration * 60); int hours = MathUtilities.secondsToWholeHours(duration * 60); spectator.showFlyText("spam", "buff_duration_tick_observer", String.valueOf(hours) + " hours , " + hMinutes + " minutes ", 0, (float) 0.66, new RGB(255, 182, 193), 3, 78); - + spectator.setAttachment("inspireDuration", duration); //System.out.println("Inspire Duration: " + spectator.getAttachment("inspireDuration") + " on " + spectator.getCustomName()); } } - + }, 10, 10, TimeUnit.SECONDS); spectator.setInspirationTick(inspirationTick); } + public void handleCoverCharge(final CreatureObject actor, final CreatureObject performer) { + final int charge = performer.getCoverCharge(); + + if (charge == 0) + return; + + else { + SUIWindow notification = core.suiService.createMessageBox(InputBoxType.INPUT_BOX_OK, "Cover Charge", performer.getCustomName() + + " has a cover charge of " + performer.getCoverCharge() + ". Do you wish to pay it?", actor, performer, (float) 30); + Vector returnParams = new Vector(); + + returnParams.add("btnOk:Text"); + + notification.addHandler(0, "", Trigger.TRIGGER_OK, returnParams, new SUICallback(){ + + @Override + public void process(SWGObject owner, int eventType, Vector returnList) { + if (eventType == 0) { + if (charge > actor.getCashCredits()) { + actor.sendSystemMessage("You do not have enough credits to cover the charge.", (byte) 0); // TODO: Find the message in the STF files. + return; + } else{ + actor.setCashCredits(actor.getCashCredits() - charge); + actor.sendSystemMessage("You payed the cover charge of " + charge + " to " + performer.getCustomName(), (byte) 0); // TODO: Find the message in the STF files. + performer.setCashCredits(performer.getCashCredits() + charge); + + startSpectating(actor, performer, performer.getPerformanceType()); + + } + } + } + }); + core.suiService.openSUIWindow(notification); + } + } + @Override public void shutdown() { diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index dd2f9608..96e1f987 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -776,7 +776,7 @@ public class PlayerService implements INetworkDispatch { e.printStackTrace(); } - if(player.getProfession().equals("entertainer_1a") && creature.getLevel() == (short) 90) + if(player.getProfession().equals("entertainer_1a") && creature.getLevel() == (short) 90 && creature.getEntertainerExperience() != null) creature.getEntertainerExperience().cancel(true); //} } diff --git a/src/services/sui/SUIService.java b/src/services/sui/SUIService.java index e898c576..8f496dc1 100644 --- a/src/services/sui/SUIService.java +++ b/src/services/sui/SUIService.java @@ -43,13 +43,12 @@ import protocol.swg.SUIForceClosePageMessage; import protocol.swg.SUIUpdatePageMessage; import protocol.swg.objectControllerObjects.ObjectMenuRequest; import protocol.swg.objectControllerObjects.ObjectMenuResponse; - import resources.common.FileUtilities; import resources.common.ObjControllerOpcodes; import resources.common.Opcodes; import resources.common.RadialOptions; import services.sui.SUIWindow.SUICallback; - +import services.sui.SUIWindow.Trigger; import engine.clients.Client; import engine.resources.objects.SWGObject; import engine.resources.service.INetworkDispatch; @@ -334,6 +333,34 @@ public class SUIService implements INetworkDispatch { return window; } + /** + * Creates an Input Box SUIWindow and adds a handler that will return text inputed into text box with the callback as the specified PyObject. + * @param PyObject Definition that will be run when user clicks on "OK" + * @return SUIWindow + * @author Waverunner + */ + public SUIWindow createInputBox(int type, String title, String promptText, SWGObject owner, SWGObject rangeObject, float maxDistance, PyObject handleFunc) { + SUIWindow window = createInputBox(type, title, promptText, owner, rangeObject, maxDistance); + Vector returnParams = new Vector(); + returnParams.add("txtInput:LocalText"); + window.addHandler(0, "", Trigger.TRIGGER_OK, returnParams, handleFunc); + return window; + } + + /** + * Creates an Input Box SUIWindow and adds a handler that will return text inputed into text box with the callback as the specified PyObject. + * @param SUICallback Callback that will be ran when user clicks on "OK" + * @return SUIWindow + * @author Waverunner + */ + public SUIWindow createInputBox(int type, String title, String promptText, SWGObject owner, SWGObject rangeObject, float maxDistance, SUICallback handleFunc) { + SUIWindow window = createInputBox(type, title, promptText, owner, rangeObject, maxDistance); + Vector returnParams = new Vector(); + returnParams.add("txtInput:LocalText"); + window.addHandler(0, "", Trigger.TRIGGER_OK, returnParams, handleFunc); + return window; + } + public void closeSUIWindow(SWGObject owner, int id) { if(owner.getClient() == null || owner.getClient().getSession() == null)