diff --git a/build.gradle b/build.gradle index 611142c05..67216c714 100644 --- a/build.gradle +++ b/build.gradle @@ -17,8 +17,8 @@ plugins { } mainClassName = 'com.projectswg.holocore.ProjectSWG' -sourceCompatibility = 1.9 -targetCompatibility = 1.9 +sourceCompatibility = 9 +targetCompatibility = 9 test { testLogging { diff --git a/serverdata/radial/radials.sdb b/serverdata/radial/radials.sdb deleted file mode 100644 index b4d12663c..000000000 --- a/serverdata/radial/radials.sdb +++ /dev/null @@ -1,20 +0,0 @@ -iff script -TEXT TEXT -object/tangible/terminal/shared_terminal_bank.iff terminal/bank -object/tangible/terminal/shared_terminal_bazaar.iff terminal/bazaar -object/tangible/terminal/shared_terminal_travel.iff terminal/travel -object/tangible/travel/ticket_collector/shared_ticket_collector.iff terminal/ticket_collector -object/tangible/travel/travel_ticket/base/shared_base_travel_ticket.iff terminal/ticket -object/tangible/npe/shared_npe_uniform_box.iff object/usable -object/tangible/terminal/shared_terminal_character_builder.iff terminal/character_builder -object/tangible/survey_tool/shared_survey_tool_all.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_gas.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_geo_thermal.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_inorganic.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_liquid.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_lumber.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_mineral.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_moisture.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_organic.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_solar.iff object/survey/survey_tool -object/tangible/survey_tool/shared_survey_tool_wind.iff object/survey/survey_tool diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/RadialHandler.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/RadialHandler.groovy new file mode 100644 index 000000000..f69cdd871 --- /dev/null +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/RadialHandler.groovy @@ -0,0 +1,116 @@ +/*********************************************************************************** + * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create an emulator which will provide a server for players to * + * continue playing a game similar to the one they used to play. We are basing * + * it on the final publish of the game prior to end-game events. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ + +package com.projectswg.holocore.scripts.radial + +import com.projectswg.common.data.radial.RadialItem +import com.projectswg.common.data.radial.RadialOption +import com.projectswg.holocore.resources.objects.SWGObject +import com.projectswg.holocore.resources.objects.custom.AIObject +import com.projectswg.holocore.resources.objects.tangible.CreditObject +import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.object.AIObjectRadial +import com.projectswg.holocore.scripts.radial.object.CreditObjectRadial +import com.projectswg.holocore.scripts.radial.object.SWGObjectRadial +import com.projectswg.holocore.scripts.radial.object.UsableObjectRadial +import com.projectswg.holocore.scripts.radial.object.survey.ObjectSurveyToolRadial +import com.projectswg.holocore.scripts.radial.object.uniform.ObjectUniformBoxRadial +import com.projectswg.holocore.scripts.radial.terminal.* + +import javax.annotation.Nonnull + +class RadialHandler { + private static Map handlers = new HashMap<>() + private static Map, RadialHandlerInterface> classHandlers = new HashMap<>() + private static SWGObjectRadial genericRadialHandler = new SWGObjectRadial() + + static def initialize() { + initializeTerminalRadials() + initializeSurveyRadials() + initializeMiscRadials() + + classHandlers.put(AIObject.class, new AIObjectRadial()) + classHandlers.put(CreditObject.class, new CreditObjectRadial()) + } + + static def registerHandler(String iff, RadialHandlerInterface handler) { + handlers.put(iff, handler) + } + + static def getOptions(List options, Player player, SWGObject target) { + getHandler(target).getOptions(options, player, target) + } + + static def handleSelection(Player player, SWGObject target, RadialItem selection) { + getHandler(target).handleSelection(player, target, selection) + } + + @Nonnull + private static def getHandler(SWGObject target) { + def type = target.getTemplate() + RadialHandlerInterface handler = handlers.get(type) + if (handler != null) + return handler + + if (target != null) { + handler = classHandlers.get(target.getClass()) + if (handler != null) + return handler + } + + return genericRadialHandler + } + + private static def initializeTerminalRadials() { + registerHandler("object/tangible/terminal/shared_terminal_bank.iff", new TerminalBankRadial()) + registerHandler("object/tangible/terminal/shared_terminal_bazaar.iff", new TerminalBazaarRadial()) + registerHandler("object/tangible/terminal/shared_terminal_travel.iff", new TerminalTravelRadial()) + registerHandler("object/tangible/travel/ticket_collector/shared_ticket_collector.iff", new TerminalTicketCollectorRadial()) + registerHandler("object/tangible/travel/travel_ticket/base/shared_base_travel_ticket.iff", new TerminalTicketRadial()) + } + + private static def initializeSurveyRadials() { + registerHandler("object/tangible/survey_tool/shared_survey_tool_all.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_gas.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_geo_thermal.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_inorganic.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_liquid.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_lumber.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_mineral.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_moisture.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_organic.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_solar.iff", new ObjectSurveyToolRadial()) + registerHandler("object/tangible/survey_tool/shared_survey_tool_wind.iff", new ObjectSurveyToolRadial()) + } + + private static def initializeMiscRadials() { + registerHandler("object/tangible/npe/shared_npe_uniform_box.iff", new UsableObjectRadial()) + registerHandler("object/tangible/terminal/shared_terminal_character_builder.iff", new TerminalCharacterBuilderRadial()) + registerHandler("object/tangible/npe/shared_npe_uniform_box.iff", new ObjectUniformBoxRadial()) + } +} + diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/RadialHandlerInterface.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/RadialHandlerInterface.groovy new file mode 100644 index 000000000..057a25630 --- /dev/null +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/RadialHandlerInterface.groovy @@ -0,0 +1,38 @@ +/*********************************************************************************** + * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create an emulator which will provide a server for players to * + * continue playing a game similar to the one they used to play. We are basing * + * it on the final publish of the game prior to end-game events. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ + +package com.projectswg.holocore.scripts.radial + +import com.projectswg.common.data.radial.RadialItem +import com.projectswg.common.data.radial.RadialOption +import com.projectswg.holocore.resources.objects.SWGObject +import com.projectswg.holocore.resources.player.Player + +interface RadialHandlerInterface { + def getOptions(List options, Player player, SWGObject target) + def handleSelection(Player player, SWGObject target, RadialItem selection) +} diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/collection/WorldItemRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/collection/WorldItemRadial.groovy index 5c933f7f1..416964a4e 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/collection/WorldItemRadial.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/collection/WorldItemRadial.groovy @@ -29,18 +29,41 @@ package com.projectswg.holocore.scripts.radial.collection import com.projectswg.common.data.radial.RadialItem import com.projectswg.common.data.radial.RadialOption +import com.projectswg.holocore.intents.GrantClickyCollectionIntent import com.projectswg.holocore.resources.objects.SWGObject +import com.projectswg.holocore.resources.objects.collections.CollectionItem import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface -static def getOptions(List options, Player player, SWGObject target, Object... args) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.get(0).setOverriddenText("@collection:consume_item") -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection, Object... args) { - switch (selection) { - case RadialItem.ITEM_USE: - //Log.d("bazaar.groovy", "Bazaar Selection: ITEM_USE") - break +class WorldItemRadial implements RadialHandlerInterface { + + private final CollectionItem details + + WorldItemRadial(CollectionItem details) { + this.details = details } + + def getOptions(List options, Player player, SWGObject target) { + def use = null + for (RadialOption option : options) { + if (option.getOptionType() == RadialItem.ITEM_USE.getId()) { + use = option + break + } + } + if (use == null) { + use = new RadialOption(RadialItem.ITEM_USE) + options.add(0, use) + } + use.setOverriddenText("@collection:consume_item") + } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + if (selection != RadialItem.ITEM_USE) + return + + new GrantClickyCollectionIntent(player.getCreatureObject(), target, details).broadcast(); + } + } + diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/AIObjectRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/AIObjectRadial.groovy new file mode 100644 index 000000000..821381af5 --- /dev/null +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/AIObjectRadial.groovy @@ -0,0 +1,55 @@ +/*********************************************************************************** + * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create an emulator which will provide a server for players to * + * continue playing a game similar to the one they used to play. We are basing * + * it on the final publish of the game prior to end-game events. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ + +package com.projectswg.holocore.scripts.radial.object + +import com.projectswg.common.data.radial.RadialItem +import com.projectswg.common.data.radial.RadialOption +import com.projectswg.holocore.intents.combat.loot.LootRequestIntent +import com.projectswg.holocore.resources.objects.SWGObject +import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface + +class AIObjectRadial extends SWGObjectRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + RadialOption loot = new RadialOption(RadialItem.LOOT) + loot.addChild(RadialItem.LOOT_ALL) + options.add(loot) + } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + switch (selection) { + case RadialItem.LOOT: + LootRequestIntent.broadcast(player, target, LootRequestIntent.LootType.LOOT) + break + case RadialItem.LOOT_ALL: + LootRequestIntent.broadcast(player, target, LootRequestIntent.LootType.LOOT_ALL) + break + } + } +} diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/CreditObjectRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/CreditObjectRadial.groovy new file mode 100644 index 000000000..7d6e1c40d --- /dev/null +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/CreditObjectRadial.groovy @@ -0,0 +1,46 @@ +/*********************************************************************************** + * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create an emulator which will provide a server for players to * + * continue playing a game similar to the one they used to play. We are basing * + * it on the final publish of the game prior to end-game events. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ + +package com.projectswg.holocore.scripts.radial.object + +import com.projectswg.common.data.radial.RadialItem +import com.projectswg.common.data.radial.RadialOption +import com.projectswg.holocore.intents.combat.loot.LootRequestIntent +import com.projectswg.holocore.resources.objects.SWGObject +import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface + +class CreditObjectRadial extends SWGObjectRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.TRANSFER_CREDITS_TO_BANK_ACCOUNT)) + } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + LootRequestIntent.broadcast(player, target, LootRequestIntent.LootType.CREDITS) + } +} diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/usable.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/SWGObjectRadial.groovy similarity index 89% rename from src/main/groovy/com/projectswg/holocore/scripts/radial/object/usable.groovy rename to src/main/groovy/com/projectswg/holocore/scripts/radial/object/SWGObjectRadial.groovy index 1d6fa9da9..d1eae1136 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/usable.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/SWGObjectRadial.groovy @@ -31,11 +31,16 @@ import com.projectswg.common.data.radial.RadialItem import com.projectswg.common.data.radial.RadialOption import com.projectswg.holocore.resources.objects.SWGObject import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface -static def getOptions(List options, Player player, SWGObject target, Object... args) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.add(new RadialOption(RadialItem.EXAMINE)) -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection, Object... args) { +class SWGObjectRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + + } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + + } + } diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/UsableObjectRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/UsableObjectRadial.groovy new file mode 100644 index 000000000..c076b2e9c --- /dev/null +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/UsableObjectRadial.groovy @@ -0,0 +1,42 @@ +/*********************************************************************************** + * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create an emulator which will provide a server for players to * + * continue playing a game similar to the one they used to play. We are basing * + * it on the final publish of the game prior to end-game events. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ + +package com.projectswg.holocore.scripts.radial.object + +import com.projectswg.common.data.radial.RadialItem +import com.projectswg.common.data.radial.RadialOption +import com.projectswg.holocore.resources.objects.SWGObject +import com.projectswg.holocore.resources.player.Player + +class UsableObjectRadial extends SWGObjectRadial { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.ITEM_USE)) + options.add(new RadialOption(RadialItem.EXAMINE)) + } + +} diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/survey/survey_tool.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/survey/ObjectSurveyToolRadial.groovy similarity index 84% rename from src/main/groovy/com/projectswg/holocore/scripts/radial/object/survey/survey_tool.groovy rename to src/main/groovy/com/projectswg/holocore/scripts/radial/object/survey/ObjectSurveyToolRadial.groovy index c69f79b79..4ae0ab253 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/survey/survey_tool.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/survey/ObjectSurveyToolRadial.groovy @@ -32,12 +32,17 @@ import com.projectswg.common.data.radial.RadialOption import com.projectswg.holocore.intents.crafting.survey.StartSurveyToolIntent import com.projectswg.holocore.resources.objects.SWGObject import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface -static def getOptions(List options, Player player, SWGObject target, Object... args) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.add(new RadialOption(RadialItem.EXAMINE)) -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection, Object... args) { - new StartSurveyToolIntent(player.getCreatureObject(), target).broadcast() +class ObjectSurveyToolRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.ITEM_USE)) + options.add(new RadialOption(RadialItem.EXAMINE)) + } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + new StartSurveyToolIntent(player.getCreatureObject(), target).broadcast() + } + } diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/object/uniform/ObjectUniformBoxRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/uniform/ObjectUniformBoxRadial.groovy new file mode 100644 index 000000000..92485a318 --- /dev/null +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/object/uniform/ObjectUniformBoxRadial.groovy @@ -0,0 +1,44 @@ +/*********************************************************************************** + * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create an emulator which will provide a server for players to * + * continue playing a game similar to the one they used to play. We are basing * + * it on the final publish of the game prior to end-game events. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ + +package com.projectswg.holocore.scripts.radial.object.uniform + +import com.projectswg.common.data.radial.RadialItem +import com.projectswg.holocore.intents.object.DestroyObjectIntent +import com.projectswg.holocore.intents.player.uniform.OpenUniformBoxIntent +import com.projectswg.holocore.resources.objects.SWGObject +import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface +import com.projectswg.holocore.scripts.radial.object.SWGObjectRadial + +class ObjectUniformBoxRadial extends SWGObjectRadial implements RadialHandlerInterface { + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + DestroyObjectIntent.broadcast(target) + OpenUniformBoxIntent.broadcast(player) + } +} diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBankRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBankRadial.groovy index 960ebcbfc..ffe070946 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBankRadial.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBankRadial.groovy @@ -36,113 +36,146 @@ import com.projectswg.holocore.resources.objects.creature.CreatureObject import com.projectswg.holocore.resources.player.Player import com.projectswg.holocore.resources.sui.SuiButtons import com.projectswg.holocore.resources.sui.SuiWindow +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface import com.projectswg.holocore.utilities.IntentFactory -static def getOptions(List options, Player player, SWGObject target) { - def use = new RadialOption(RadialItem.ITEM_USE) - def reserve = new RadialOption(RadialItem.SERVER_MENU50) - def creature = player.getCreatureObject() - - reserve.setOverriddenText("@sui:bank_galactic_reserve") - - options.add(use) - options.add(new RadialOption(RadialItem.EXAMINE)) - if (creature.getCurrentCity() == "@corellia_region_names:coronet" || - creature.getCurrentCity() == "@naboo_region_names:theed" || - creature.getCurrentCity() == "@tatooine_region_names:mos_eisley") - options.add(reserve) - // Bank Transfer/Safety Deposit - use.addChildWithOverriddenText(RadialItem.SERVER_MENU1, "@sui:bank_credits") - use.addChildWithOverriddenText(RadialItem.SERVER_MENU2, "@sui:bank_items") - // Withdraw/Deposit - if (creature.getBankBalance() > 0) - use.addChildWithOverriddenText(RadialItem.SERVER_MENU4, "@sui:bank_withdrawall") - if (creature.getCashBalance() > 0) - use.addChildWithOverriddenText(RadialItem.SERVER_MENU3, "@sui:bank_depositall") - // Galactic Reserve - if (creature.getBankBalance() >= 1E9 || creature.getCashBalance() >= 1E9) - reserve.addChildWithOverriddenText(RadialItem.SERVER_MENU49, "@sui:bank_galactic_reserve_deposit") - if (creature.getReserveBalance() > 0) - reserve.addChildWithOverriddenText(RadialItem.SERVER_MENU48, "@sui:bank_galactic_reserve_withdraw") -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection) { - def creature = player.getCreatureObject() - switch (selection) { - case RadialItem.ITEM_USE: - case RadialItem.SERVER_MENU1: - def window = new SuiWindow("Script.transfer", SuiButtons.OK_CANCEL, '@base_player:bank_title', '@base_player:bank_prompt') - window.setPropertyText('transaction.lblFrom', 'Cash') - window.setPropertyText('transaction.lblTo', 'Bank') - window.setPropertyText('transaction.lblStartingFrom', creature.getCashBalance().toString()) - window.setPropertyText('transaction.lblStartingTo', creature.getBankBalance().toString()) - window.setPropertyText('transaction.txtInputFrom', creature.getCashBalance().toString()) - window.setPropertyText('transaction.txtInputTo', creature.getBankBalance().toString()) - window.setProperty('transaction', 'ConversionRatioFrom', '1') - window.setProperty('transaction', 'ConversionRatioTo', '1') - window.addReturnableProperty('transaction.txtInputFrom', 'Text') - window.addReturnableProperty('transaction.txtInputTo', 'Text') - window.addCallback(SuiEvent.OK_PRESSED, "handleBankTransfer", {event,parameters -> handleBankTransfer(player, player.getCreatureObject(), parameters)}) - window.display(player) - break - case RadialItem.SERVER_MENU2: - player.sendPacket(new ClientOpenContainerMessage(creature.getSlottedObject("bank").getObjectId(), "")) - break - case RadialItem.SERVER_MENU4: - def amount = creature.getBankBalance() as long - creature.setCashBalance(creature.getCashBalance() + amount) - creature.setBankBalance(0l) - if (amount > 0) - IntentFactory.sendSystemMessage(player, "@base_player:prose_withdraw_success", "DI", (int) amount) - else - IntentFactory.sendSystemMessage(player, '@error_message:bank_withdraw') - break - case RadialItem.SERVER_MENU3: - def amount = creature.getCashBalance() as long - creature.setBankBalance(amount + creature.getBankBalance()) - creature.setCashBalance(0l) - if (amount > 0) - IntentFactory.sendSystemMessage(player, "@base_player:prose_deposit_success", "DI", (int) amount) - else - IntentFactory.sendSystemMessage(player, '@error_message:bank_deposit') - break - case RadialItem.SERVER_MENU49: - if (!creature.canPerformGalacticReserveTransaction()) { - IntentFactory.sendSystemMessage(player, "You have to wait to perform another Galactic Reserve transaction") +class TerminalBankRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + def use = new RadialOption(RadialItem.ITEM_USE) + def creature = player.getCreatureObject() + + options.add(use) + options.add(new RadialOption(RadialItem.EXAMINE)) + + // Bank Transfer/Safety Deposit + use.addChildWithOverriddenText(RadialItem.SERVER_MENU1, "@sui:bank_credits") + use.addChildWithOverriddenText(RadialItem.SERVER_MENU2, "@sui:bank_items") + // Withdraw/Deposit + if (creature.getBankBalance() > 0) + use.addChildWithOverriddenText(RadialItem.SERVER_MENU4, "@sui:bank_withdrawall") + if (creature.getCashBalance() > 0) + use.addChildWithOverriddenText(RadialItem.SERVER_MENU3, "@sui:bank_depositall") + + if (isInGalacticReserveCity(creature)) { + def reserve = new RadialOption(RadialItem.SERVER_MENU50) + reserve.setOverriddenText("@sui:bank_galactic_reserve") + + if (creature.getBankBalance() >= 1E9 || creature.getCashBalance() >= 1E9) + reserve.addChildWithOverriddenText(RadialItem.SERVER_MENU49, "@sui:bank_galactic_reserve_deposit") + if (creature.getReserveBalance() > 0) + reserve.addChildWithOverriddenText(RadialItem.SERVER_MENU48, "@sui:bank_galactic_reserve_withdraw") + options.add(reserve) + } + } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + def creature = player.getCreatureObject() + switch (selection) { + case RadialItem.ITEM_USE: + case RadialItem.SERVER_MENU1: + handleTransfer(player, creature) break - } - def amount = creature.getBankBalance() as long - if (amount > 1E9) - amount = 1E9 - if (creature.getReserveBalance() + amount > 3E9 || amount == 0) { - IntentFactory.sendSystemMessage(player, '@error_message:bank_deposit') + case RadialItem.SERVER_MENU2: + handleOpenBank(player, creature) break - } - creature.setBankBalance((creature.getBankBalance() - amount).longValue()) - creature.setReserveBalance((creature.getReserveBalance() + amount).longValue()) - creature.updateLastGalacticReserveTime() - break - case RadialItem.SERVER_MENU48: - if (!creature.canPerformGalacticReserveTransaction()) { - IntentFactory.sendSystemMessage(player, "You have to wait to perform another Galactic Reserve transaction") + case RadialItem.SERVER_MENU3: + handleBankDeposit(player, creature) break - } - def amount = creature.getReserveBalance() - if (amount > 1E9) - amount = 1E9 - if (creature.getBankBalance() + amount > 2E9 || amount == 0) { - IntentFactory.sendSystemMessage(player, '@error_message:bank_withdraw') + case RadialItem.SERVER_MENU4: + handleBankWithdraw(player, creature) break - } - creature.setBankBalance((creature.getBankBalance() + amount).longValue()) - creature.setReserveBalance((creature.getReserveBalance() - amount).longValue()) - creature.updateLastGalacticReserveTime() - break + case RadialItem.SERVER_MENU49: + handleGalacticReserveDeposit(player, creature) + break + case RadialItem.SERVER_MENU48: + handleGalacticReserveWithdraw(player, creature) + break + } + } + + static def handleTransfer(Player player, CreatureObject creature) { + def window = new SuiWindow("Script.transfer", SuiButtons.OK_CANCEL, '@base_player:bank_title', '@base_player:bank_prompt') + window.setPropertyText('transaction.lblFrom', 'Cash') + window.setPropertyText('transaction.lblTo', 'Bank') + window.setPropertyText('transaction.lblStartingFrom', creature.getCashBalance().toString()) + window.setPropertyText('transaction.lblStartingTo', creature.getBankBalance().toString()) + window.setPropertyText('transaction.txtInputFrom', creature.getCashBalance().toString()) + window.setPropertyText('transaction.txtInputTo', creature.getBankBalance().toString()) + window.setProperty('transaction', 'ConversionRatioFrom', '1') + window.setProperty('transaction', 'ConversionRatioTo', '1') + window.addReturnableProperty('transaction.txtInputFrom', 'Text') + window.addReturnableProperty('transaction.txtInputTo', 'Text') + window.addCallback(SuiEvent.OK_PRESSED, "handleBankTransfer", {event,parameters -> handleBankTransfer(player, player.getCreatureObject(), parameters)}) + window.display(player) + } + + static def handleOpenBank(Player player, CreatureObject creature) { + player.sendPacket(new ClientOpenContainerMessage(creature.getSlottedObject("bank").getObjectId(), "")) + } + + static def handleBankDeposit(Player player, CreatureObject creature) { + def amount = creature.getCashBalance() as long + creature.setBankBalance(amount + creature.getBankBalance()) + creature.setCashBalance(0l) + if (amount > 0) + IntentFactory.sendSystemMessage(player, "@base_player:prose_deposit_success", "DI", (int) amount) + else + IntentFactory.sendSystemMessage(player, '@error_message:bank_deposit') + } + + static def handleBankWithdraw(Player player, CreatureObject creature) { + def amount = creature.getBankBalance() as long + creature.setCashBalance(creature.getCashBalance() + amount) + creature.setBankBalance(0l) + if (amount > 0) + IntentFactory.sendSystemMessage(player, "@base_player:prose_withdraw_success", "DI", (int) amount) + else + IntentFactory.sendSystemMessage(player, '@error_message:bank_withdraw') + } + + static def isInGalacticReserveCity(CreatureObject creature) { + return creature.getCurrentCity() == "@corellia_region_names:coronet" || creature.getCurrentCity() == "@naboo_region_names:theed" || creature.getCurrentCity() == "@tatooine_region_names:mos_eisley" + } + + static def handleGalacticReserveDeposit(Player player, CreatureObject creature) { + if (!creature.canPerformGalacticReserveTransaction()) { + IntentFactory.sendSystemMessage(player, "You have to wait to perform another Galactic Reserve transaction") + return + } + def amount = creature.getBankBalance() as long + if (amount > 1E9) + amount = 1E9 + if (creature.getReserveBalance() + amount > 3E9 || amount == 0) { + IntentFactory.sendSystemMessage(player, '@error_message:bank_deposit') + return + } + creature.setBankBalance((creature.getBankBalance() - amount).longValue()) + creature.setReserveBalance((creature.getReserveBalance() + amount).longValue()) + creature.updateLastGalacticReserveTime() + } + + static def handleGalacticReserveWithdraw(Player player, CreatureObject creature) { + if (!creature.canPerformGalacticReserveTransaction()) { + IntentFactory.sendSystemMessage(player, "You have to wait to perform another Galactic Reserve transaction") + return + } + def amount = creature.getReserveBalance() + if (amount > 1E9) + amount = 1E9 + if (creature.getBankBalance() + amount > 2E9 || amount == 0) { + IntentFactory.sendSystemMessage(player, '@error_message:bank_withdraw') + return + } + creature.setBankBalance((creature.getBankBalance() + amount).longValue()) + creature.setReserveBalance((creature.getReserveBalance() - amount).longValue()) + creature.updateLastGalacticReserveTime() + } + + static def handleBankTransfer(Player player, CreatureObject creature, Map parameters) { + creature.setCashBalance(Long.parseLong(parameters.get('transaction.txtInputFrom.Text'))) + creature.setBankBalance(Long.parseLong(parameters.get('transaction.txtInputTo.Text'))) + IntentFactory.sendSystemMessage(player, '@base_player:bank_success') } } -static def handleBankTransfer(Player player, CreatureObject creature, Map parameters) { - creature.setCashBalance(Long.parseLong(parameters.get('transaction.txtInputFrom.Text'))) - creature.setBankBalance(Long.parseLong(parameters.get('transaction.txtInputTo.Text'))) - IntentFactory.sendSystemMessage(player, '@base_player:bank_success') -} diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBazaarRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBazaarRadial.groovy index d561553c6..8517fc393 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBazaarRadial.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalBazaarRadial.groovy @@ -31,15 +31,20 @@ import com.projectswg.common.data.radial.RadialItem import com.projectswg.common.data.radial.RadialOption import com.projectswg.holocore.resources.objects.SWGObject import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface -static def getOptions(List options, Player player, SWGObject target) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.add(new RadialOption(RadialItem.EXAMINE)) -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection) { - switch (selection) { - case RadialItem.ITEM_USE: - break +class TerminalBazaarRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.ITEM_USE)) + options.add(new RadialOption(RadialItem.EXAMINE)) } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + switch (selection) { + case RadialItem.ITEM_USE: + break + } + } + } diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalCharacterBuilderRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalCharacterBuilderRadial.groovy index 6b2732670..0e5c4eaa5 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalCharacterBuilderRadial.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalCharacterBuilderRadial.groovy @@ -39,1347 +39,1352 @@ import com.projectswg.holocore.resources.objects.SWGObject import com.projectswg.holocore.resources.player.Player import com.projectswg.holocore.resources.sui.SuiButtons import com.projectswg.holocore.resources.sui.SuiListBox +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface import com.projectswg.holocore.services.objects.StaticItemService -static def getOptions(List options, Player player, SWGObject target) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.add(new RadialOption(RadialItem.EXAMINE)) -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection) { - switch (selection) { - case RadialItem.ITEM_USE: - def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a category.") - - listBox.addListItem("Armor") - listBox.addListItem("Weapons") - listBox.addListItem("Wearables") - listBox.addListItem("Tools") - listBox.addListItem("Travel") - - listBox.addCallback(SuiEvent.OK_PRESSED, "handleCategorySelection", {event,parameters -> handleCategorySelection(player, parameters)}) - listBox.display(player) - break +class TerminalCharacterBuilderRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.ITEM_USE)) + options.add(new RadialOption(RadialItem.EXAMINE)) } -} - -static def handleCategorySelection(Player player, Map parameters) { - def selection = SuiListBox.getSelectedRow(parameters) - - switch (selection) { - case 0: handleArmor(player); break - case 1: handleWeapons(player); break - case 2: handleWearables(player); break - case 3: handleTools(player); break - case 4: handleTravel(player); break + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + switch (selection) { + case RadialItem.ITEM_USE: + def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a category.") + + listBox.addListItem("Armor") + listBox.addListItem("Weapons") + listBox.addListItem("Wearables") + listBox.addListItem("Tools") + listBox.addListItem("Travel") + + listBox.addCallback(SuiEvent.OK_PRESSED, "handleCategorySelection", { event, parameters -> handleCategorySelection(player, parameters) }) + listBox.display(player) + break + } } -} - -static def spawnItems(Player player, List items) { - def creature = player.getCreatureObject() - def inventory = creature.getSlottedObject("inventory") - - new CreateStaticItemIntent(creature, inventory, new StaticItemService.LootBoxHandler(creature), ContainerPermissionsType.DEFAULT, items.toArray(new String[items.size()])).broadcast() -} - -static def handleArmor(Player player) { - def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a set of armor to receive.") - - listBox.addListItem("R.I.S. Armor") - listBox.addListItem("Mandalorian Armor") - listBox.addListItem("Bone Armor") - listBox.addListItem("Chitin Armor") - listBox.addListItem("Padded Armor") - listBox.addListItem("Ubese Armor") - listBox.addListItem("Ithorian Defender Armor") - listBox.addListItem("Wookiee Black Mountain Armor") - listBox.addListItem("Deathtrooper Armor") - listBox.addListItem("Imperial - Galactic Marine Armor") - listBox.addListItem("Imperial - Scout trooper Armor") - listBox.addListItem("Imperial - Shock trooper Armor") - listBox.addListItem("Imperial - Stormtrooper Armor") - listBox.addListItem("Imperial - Black Crusader Armor") - listBox.addListItem("Imperial - Black Spec Ops Armor") - listBox.addListItem("Imperial - White Spec Ops Armor") - listBox.addListItem("Imperial - Snow trooper Armor") - listBox.addListItem("Imperial - Forest Camouflage Armor") - listBox.addListItem("Rebel - Forest Camouflage Armor") - listBox.addListItem("Rebel - Assault Armor") - listBox.addListItem("Rebel - Battle Armor") - listBox.addListItem("Rebel - Marine Armor") - listBox.addListItem("Rebel - Spec Force Armor") - listBox.addListItem("Rebel - Black Crusader Armor") - listBox.addListItem("Rebel - Alliance Weather Cold Armor") - listBox.addCallback(SuiEvent.OK_PRESSED, "handleArmorSelection", {event,parameters -> handleArmorSelection(player, parameters)}) - listBox.display(player) -} - -static def handleArmorSelection(Player player, Map parameters) { - switch (SuiListBox.getSelectedRow(parameters)) { - case 0: handleRisArmor(player); break - case 1: handleMandoArmor(player); break - case 2: handleBoneArmor(player); break - case 3: handleChitinArmor(player); break - case 4: handlePaddedArmor(player); break - case 5: handleUbeseArmor(player); break - case 6: handleIthoriandefenderArmor(player); break - case 7: handleWookieeblackmtnArmor(player); break - case 8: handleDeathtrooperArmor(player); break - case 9: handleImpBattlemarineArmor(player); break - case 10: handleImpBattlewornscoutArmor(player); break - case 11: handleImpBattlewornshockArmor(player); break - case 12: handleImpBattlewornstormArmor(player); break - case 13: handleImpBlackcrusaderArmor(player); break - case 14: handleImpBlackpvpspecopsArmor(player); break - case 15: handleImpWhitepvpspecopsArmor(player); break - case 16: handleImpSnowtrooperArmor(player); break - case 17: handleImpForestCamoArmor(player); break - case 18: handleRebForestCamoArmor(player); break - case 19: handleRebBattlewornassaultArmor(player); break - case 20: handleRebBattlewornbattleArmor(player); break - case 21: handleRebBattlewornmarineArmor(player); break - case 22: handleRebBattlewornspecforceArmor(player); break - case 23: handleRebBlackcrusaderArmor(player); break - case 24: handleRebAlliancecoldArmor(player); break + + + static def handleCategorySelection(Player player, Map parameters) { + def selection = SuiListBox.getSelectedRow(parameters) + + switch (selection) { + case 0: handleArmor(player); break + case 1: handleWeapons(player); break + case 2: handleWearables(player); break + case 3: handleTools(player); break + case 4: handleTravel(player); break + } } -} - -static def handleRisArmor(Player player) { - spawnItems(player, [ - "armor_ris_bicep_l", - "armor_ris_bicep_r", - "armor_ris_boots", - "armor_ris_bracer_l", - "armor_ris_bracer_r", - "armor_ris_chest_plate", - "armor_ris_gloves", - "armor_ris_helmet", - "armor_ris_leggings" - ]) -} - -static def handleMandoArmor(Player player) { - spawnItems(player, [ - "armor_mandalorian_bicep_l", - "armor_mandalorian_bicep_r", - "armor_mandalorian_bracer_l", - "armor_mandalorian_bracer_r", - "armor_mandalorian_chest_plate", - "armor_mandalorian_gloves", - "armor_mandalorian_helmet", - "armor_mandalorian_leggings", - "armor_mandalorian_shoes" - ]) -} - -static def handleBoneArmor(Player player) { - spawnItems(player, [ - "armor_bone_bicep_l_02_01", - "armor_bone_bicep_r_02_01", - "armor_bone_boots_02_01", - "armor_bone_bracer_l_02_01", - "armor_bone_bracer_r_02_01", - "armor_bone_chest_02_01", - "armor_bone_gloves_02_01", - "armor_bone_helmet_02_01", - "armor_bone_leggings_02_01" - ]) -} - -static def handleChitinArmor(Player player) { - spawnItems(player, [ - "armor_assault_sta_lvl80_bicep_l_02_01", - "armor_assault_sta_lvl80_bicep_r_02_01", - "armor_assault_sta_lvl80_boots_02_01", - "armor_assault_sta_lvl80_bracer_l_02_01", - "armor_assault_sta_lvl80_bracer_r_02_01", - "armor_assault_sta_lvl80_chest_02_01", - "armor_assault_sta_lvl80_gloves_02_01", - "armor_assault_sta_lvl80_helmet_02_01", - "armor_assault_sta_lvl80_leggings_02_01" - ]) -} - -static def handlePaddedArmor(Player player) { - spawnItems(player, [ - "armor_tow_battle_bicep_l_03_01", - "armor_tow_battle_bicep_r_03_01", - "armor_tow_battle_boots_03_01", - "armor_tow_battle_bracer_l_03_01", - "armor_tow_battle_bracer_r_03_01", - "armor_tow_battle_chest_03_01", - "armor_tow_battle_gloves_03_01", - "armor_tow_battle_helmet_03_01", - "armor_tow_battle_leggings_03_01" - ]) -} - -static def handleUbeseArmor(Player player) { - spawnItems(player, [ - "armor_recon_sta_lvl80_boots_02_01", - "armor_recon_sta_lvl80_bracer_l_02_01", - "armor_recon_sta_lvl80_bracer_r_02_01", - "armor_recon_sta_lvl80_chest_02_01", - "armor_recon_sta_lvl80_gloves_02_01", - "armor_recon_sta_lvl80_helmet_02_01", - "armor_recon_sta_lvl80_leggings_02_01" - ]) -} - -static def handleIthoriandefenderArmor(Player player) { - spawnItems(player, [ - "armor_ithorian_defender_bicep_camo_l_04_01", - "armor_ithorian_defender_bicep_camo_r_04_01", - "armor_ithorian_defender_boots_camo_04_01", - "armor_ithorian_defender_bracer_camo_l_04_01", - "armor_ithorian_defender_bracer_camo_r_04_01", - "armor_ithorian_defender_chest_plate_camo_04_01", - "armor_ithorian_defender_gloves_camo_04_01", - "armor_ithorian_defender_helmet_camo_04_01", - "armor_ithorian_defender_leggings_camo_04_01" - ]) -} - -static def handleWookieeblackmtnArmor(Player player) { - spawnItems(player, [ - "armor_kashyyykian_black_mtn_bicep_camo_l_04_01", - "armor_kashyyykian_black_mtn_bicep_camo_r_04_01", - "armor_kashyyykian_black_mtn_bracer_camo_l_04_01", - "armor_kashyyykian_black_mtn_bracer_camo_r_04_01", - "armor_kashyyykian_black_mtn_chest_plate_camo_04_01", - "armor_kashyyykian_black_mtn_leggings_camo_04_01", - ]) -} - -static def handleDeathtrooperArmor(Player player) { - spawnItems(player, [ - "armor_deathtrooper_bicep_l_04_01", - "armor_deathtrooper_bicep_r_04_01", - "armor_deathtrooper_boots_04_01", - "armor_deathtrooper_bracer_l_04_01", - "armor_deathtrooper_bracer_r_04_01", - "armor_deathtrooper_chest_plate_04_01", - "armor_deathtrooper_gloves_04_01", - "armor_deathtrooper_helmet_04_01", - "armor_deathtrooper_leggings_04_01" - ]) -} - -static def handleImpBattlemarineArmor(Player player) { - spawnItems(player, [ - "armor_gcw_imperial_galactic_marine_bicep_l", - "armor_gcw_imperial_galactic_marine_bicep_r", - "armor_gcw_imperial_galactic_marine_boots", - "armor_gcw_imperial_galactic_marine_bracer_l", - "armor_gcw_imperial_galactic_marine_bracer_r", - "armor_gcw_imperial_galactic_marine_chest_plate", - "armor_gcw_imperial_galactic_marine_gloves", - "armor_gcw_imperial_galactic_marine_helmet", - "armor_gcw_imperial_galactic_marine_leggings" - ]) -} - -static def handleImpBattlewornscoutArmor(Player player) { - spawnItems(player, [ - "armor_gcw_imperial_scouttrooper_bicep_l", - "armor_gcw_imperial_scouttrooper_bicep_r", - "armor_gcw_imperial_scouttrooper_boots", - "armor_gcw_imperial_scouttrooper_bracer_l", - "armor_gcw_imperial_scouttrooper_bracer_r", - "armor_gcw_imperial_scouttrooper_chest_plate", - "armor_gcw_imperial_scouttrooper_gloves", - "armor_gcw_imperial_scouttrooper_helmet", - "armor_gcw_imperial_scouttrooper_leggings" - ]) -} - -static def handleImpBattlewornshockArmor(Player player) { - spawnItems(player, [ - "armor_gcw_imperial_shocktrooper_bicep_l", - "armor_gcw_imperial_shocktrooper_bicep_r", - "armor_gcw_imperial_shocktrooper_boots", - "armor_gcw_imperial_shocktrooper_bracer_l", - "armor_gcw_imperial_shocktrooper_bracer_r", - "armor_gcw_imperial_shocktrooper_chest_plate", - "armor_gcw_imperial_shocktrooper_gloves", - "armor_gcw_imperial_shocktrooper_helmet", - "armor_gcw_imperial_shocktrooper_leggings" - ]) -} - -static def handleImpBattlewornstormArmor(Player player) { - spawnItems(player, [ - "armor_gcw_imperial_stormtrooper_bicep_l", - "armor_gcw_imperial_stormtrooper_bicep_r", - "armor_gcw_imperial_stormtrooper_boots", - "armor_gcw_imperial_stormtrooper_bracer_l", - "armor_gcw_imperial_stormtrooper_bracer_r", - "armor_gcw_imperial_stormtrooper_chest_plate", - "armor_gcw_imperial_stormtrooper_gloves", - "armor_gcw_imperial_stormtrooper_helmet", - "armor_gcw_imperial_stormtrooper_leggings" - ]) -} - -static def handleRebBattlewornassaultArmor(Player player) { - spawnItems(player, [ - "armor_gcw_rebel_assault_bicep_l", - "armor_gcw_rebel_assault_bicep_r", - "armor_gcw_rebel_assault_boots", - "armor_gcw_rebel_assault_bracer_l", - "armor_gcw_rebel_assault_bracer_r", - "armor_gcw_rebel_assault_chest_plate", - "armor_gcw_rebel_assault_gloves", - "armor_gcw_rebel_assault_helmet", - "armor_gcw_rebel_assault_leggings" - ]) -} - -static def handleRebBattlewornbattleArmor(Player player) { - spawnItems(player, [ - "armor_gcw_rebel_battle_bicep_l", - "armor_gcw_rebel_battle_bicep_r", - "armor_gcw_rebel_battle_boots", - "armor_gcw_rebel_battle_bracer_l", - "armor_gcw_rebel_battle_bracer_r", - "armor_gcw_rebel_battle_chest_plate", - "armor_gcw_rebel_battle_gloves", - "armor_gcw_rebel_battle_helmet", - "armor_gcw_rebel_battle_leggings" - ]) -} - -static def handleRebBattlewornmarineArmor(Player player) { - spawnItems(player, [ - "armor_gcw_rebel_marine_bicep_l", - "armor_gcw_rebel_marine_bicep_r", - "armor_gcw_rebel_marine_boots", - "armor_gcw_rebel_marine_bracer_l", - "armor_gcw_rebel_marine_bracer_r", - "armor_gcw_rebel_marine_chest_plate", - "armor_gcw_rebel_marine_gloves", - "armor_gcw_rebel_marine_helmet", - "armor_gcw_rebel_marine_leggings" - ]) -} - -static def handleRebBattlewornspecforceArmor(Player player) { - spawnItems(player, [ - "armor_gcw_rebel_specforce_bicep_l", - "armor_gcw_rebel_specforce_bicep_r", - "armor_gcw_rebel_specforce_boots", - "armor_gcw_rebel_specforce_bracer_l", - "armor_gcw_rebel_specforce_bracer_r", - "armor_gcw_rebel_specforce_chest_plate", - "armor_gcw_rebel_specforce_gloves", - "armor_gcw_rebel_specforce_helmet", - "armor_gcw_rebel_specforce_leggings" - ]) -} - -static def handleImpBlackcrusaderArmor(Player player) { - spawnItems(player, [ - "armor_mandalorian_imperial_black_bicep_l_04_01", - "armor_mandalorian_imperial_black_bicep_r_04_01", - "armor_mandalorian_imperial_black_boots_04_01", - "armor_mandalorian_imperial_black_bracer_l_04_01", - "armor_mandalorian_imperial_black_bracer_r_04_01", - "armor_mandalorian_imperial_black_chest_plate_04_01", - "armor_mandalorian_imperial_black_gloves_04_01", - "armor_mandalorian_imperial_black_helmet_04_01", - "armor_mandalorian_imperial_black_leggings_04_01" - ]) -} - -static def handleRebBlackcrusaderArmor(Player player) { - spawnItems(player, [ - "armor_mandalorian_rebel_black_bicep_l_04_01", - "armor_mandalorian_rebel_black_bicep_r_04_01", - "armor_mandalorian_rebel_black_boots_04_01", - "armor_mandalorian_rebel_black_bracer_l_04_01", - "armor_mandalorian_rebel_black_bracer_r_04_01", - "armor_mandalorian_rebel_black_chest_plate_04_01", - "armor_mandalorian_rebel_black_gloves_04_01", - "armor_mandalorian_rebel_black_helmet_04_01", - "armor_mandalorian_rebel_black_leggings_04_01" - ]) -} - -static def handleImpBlackpvpspecopsArmor(Player player) { - spawnItems(player, [ - "armor_pvp_spec_ops_imperial_black_bicep_l_05_01", - "armor_pvp_spec_ops_imperial_black_bicep_r_05_01", - "armor_pvp_spec_ops_imperial_black_boots_05_01", - "armor_pvp_spec_ops_imperial_black_bracer_l_05_01", - "armor_pvp_spec_ops_imperial_black_bracer_r_05_01", - "armor_pvp_spec_ops_imperial_black_chest_plate_orange_pad_05_01", - "armor_pvp_spec_ops_imperial_black_gloves_05_01", - "armor_pvp_spec_ops_imperial_black_helmet_05_01", - "armor_pvp_spec_ops_imperial_black_leggings_05_01" - ]) -} - -static def handleImpWhitepvpspecopsArmor(Player player) { - spawnItems(player, [ - "armor_pvp_spec_ops_imperial_white_bicep_l_05_01", - "armor_pvp_spec_ops_imperial_white_bicep_r_05_01", - "armor_pvp_spec_ops_imperial_white_boots_05_01", - "armor_pvp_spec_ops_imperial_white_bracer_l_05_01", - "armor_pvp_spec_ops_imperial_white_bracer_r_05_01", - "armor_pvp_spec_ops_imperial_white_chest_plate_orange_pad_05_01", - "armor_pvp_spec_ops_imperial_white_gloves_05_01", - "armor_pvp_spec_ops_imperial_white_helmet_05_01", - "armor_pvp_spec_ops_imperial_white_leggings_05_01" - ]) -} - -static def handleImpSnowtrooperArmor(Player player) { - spawnItems(player, [ - "armor_snowtrooper_bicep_l", - "armor_snowtrooper_bicep_r", - "armor_snowtrooper_boots", - "armor_snowtrooper_bracer_l", - "armor_snowtrooper_bracer_r", - "armor_snowtrooper_chest_plate", - "armor_snowtrooper_gloves", - "armor_snowtrooper_helmet", - "armor_snowtrooper_leggings" - ]) -} - -static def handleImpForestCamoArmor(Player player) { - spawnItems(player, [ - "armor_scouttrooper_bicep_camo_l_04_01", - "armor_scouttrooper_bicep_camo_r_04_01", - "armor_scouttrooper_boots_camo_04_01", - "armor_scouttrooper_bracer_camo_l_04_01", - "armor_scouttrooper_bracer_camo_r_04_01", - "armor_scouttrooper_chest_plate_camo_04_01", - "armor_scouttrooper_gloves_camo_04_01", - "armor_scouttrooper_helmet_camo_04_01", - "armor_scouttrooper_leggings_camo_04_01" - ]) -} - -static def handleRebForestCamoArmor(Player player) { - spawnItems(player, [ - "armor_rebel_assault_bicep_camo_l_04_01", - "armor_rebel_assault_bicep_camo_r_04_01", - "armor_rebel_assault_boots_camo_04_01", - "armor_rebel_assault_bracer_camo_l_04_01", - "armor_rebel_assault_bracer_camo_r_04_01", - "armor_rebel_assault_chest_plate_camo_04_01", - "armor_rebel_assault_gloves_camo_04_01", - "armor_rebel_assault_helmet_camo_04_01", - "armor_rebel_assault_leggings_camo_04_01" - ]) -} - -static def handleRebGreenpvpspecopsArmor(Player player) { - spawnItems(player, [ - "armor_pvp_spec_ops_rebel_black_green_bicep_l_05_01", - "armor_pvp_spec_ops_rebel_black_green_bicep_r_05_01", - "armor_pvp_spec_ops_rebel_black_green_boots_05_01", - "armor_pvp_spec_ops_rebel_black_green_bracer_l_05_01", - "armor_pvp_spec_ops_rebel_black_green_bracer_r_05_01", - "armor_pvp_spec_ops_rebel_black_green_chest_plate_05_01", - "armor_pvp_spec_ops_rebel_black_green_gloves_05_01", - "armor_pvp_spec_ops_rebel_black_green_helmet_05_01", - "armor_pvp_spec_ops_rebel_black_green_leggings_05_01" - ]) -} - -static def handleRebAlliancecoldArmor(Player player) { - spawnItems(player, [ - "armor_rebel_snow_bicep_l", - "armor_rebel_snow_bicep_r", - "armor_rebel_snow_boots", - "armor_rebel_snow_bracer_l", - "armor_rebel_snow_bracer_r", - "armor_rebel_snow_chest_plate", - "armor_rebel_snow_gloves", - "armor_rebel_snow_helmet", - "armor_rebel_snow_leggings" - ]) -} - -static def handleWeapons(Player player) { - def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a weapon category to receive a weapon of that type.") - - listBox.addListItem("Lightsabers") - listBox.addListItem("Melee") - listBox.addListItem("Ranged") - - listBox.addCallback(SuiEvent.OK_PRESSED, "handleWeaponSelection", {event,parameters -> handleWeaponSelection(player, parameters)}) - listBox.display(player) -} - -static def handleWeaponSelection(Player player, Map parameters) { - def selection = SuiListBox.getSelectedRow(parameters) - - switch (selection) { - case 0: handleLightsabers(player); break - case 1: handleMelee(player); break - case 2: handleRanged(player); break + + static def spawnItems(Player player, List items) { + def creature = player.getCreatureObject() + def inventory = creature.getSlottedObject("inventory") + + new CreateStaticItemIntent(creature, inventory, new StaticItemService.LootBoxHandler(creature), ContainerPermissionsType.DEFAULT, items.toArray(new String[items.size()])).broadcast() } -} - -static def handleLightsabers(Player player) { - spawnItems(player, [ - "weapon_mandalorian_lightsaber_04_01", - "weapon_npe_lightsaber_02_01", - "weapon_npe_lightsaber_02_02", - "weapon_roadmap_lightsaber_02_02" - ]) -} - -static def handleMelee(Player player) { - spawnItems(player, [ - "weapon_tow_blasterfist_04_01", - "weapon_tow_sword_1h_05_02", - "weapon_tow_sword_2h_05_02", - "weapon_tow_polearm_05_01", - "weapon_polearm_02_01", - "weapon_polearm_04_01", - "weapon_magna_guard_polearm_04_01", - "weapon_content_polearm_tier_8_03_02", - "weapon_quest_u10_knuckler_01_02" - ]) -} - -static def handleRanged(Player player) { - spawnItems(player, [ - "weapon_tow_pistol_flechette_05_01", - "weapon_tow_carbine_05_01", - "weapon_tow_rifle_05_02", - "weapon_tow_rifle_lightning_cannon_04_01", - "weapon_tow_heavy_rocket_launcher_05_01", - "weapon_borvo_carbine_03_01", - "weapon_borvo_pistol_03_01", - "weapon_borvo_rifle_03_01", - "weapon_content_rifle_tier_7_03_01", - "weapon_content_pistol_tier_7_03_01", - "weapon_content_carbine_tier_7_03_01", - "weapon_content_carbine_talus_selonian_04_01", - "weapon_pistol_drop_lvl40_02_01", - "weapon_rifle_drop_lvl40_02_01", - "weapon_gcw_heavy_pulse_cannon_03_01", - "weapon_heavy_pvp_general_reward_06_01", - "weapon_pistol_imperial_pvp_general_reward_06_01", - "weapon_rifle_imperial_pvp_general_reward_06_01", - "weapon_carbine_pvp_imperial_general_reward_06_01" - ]) -} - -static def handleWearables(Player player) { - def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a wearable category to receive a weapon of that type.") - - listBox.addListItem("Backpacks") - listBox.addListItem("Bikinis") - listBox.addListItem("Bodysuits") - listBox.addListItem("Boots") - listBox.addListItem("Bustiers") - listBox.addListItem("Dress") - listBox.addListItem("Gloves") - listBox.addListItem("Goggles") - listBox.addListItem("Hats") - listBox.addListItem("Helmets") - listBox.addListItem("Jackets") - listBox.addListItem("Pants") - listBox.addListItem("Robes") - listBox.addListItem("Shirt") - listBox.addListItem("Shoes") - listBox.addListItem("Skirts") - listBox.addListItem("Vest") - listBox.addListItem("Ithorian equipment") - listBox.addListItem("Jedi equipment") - listBox.addListItem("Nightsister equipment") - listBox.addListItem("Tusken Raider equipment") - listBox.addListItem("Wookie equipment") - listBox.addListItem("TCG") - - listBox.addCallback(SuiEvent.OK_PRESSED, "handleWearablesSelection", {event,parameters -> handleWearablesSelection(player, parameters)}) - listBox.display(player) -} - -static def handleWearablesSelection(Player player, Map parameters) { - def selection = SuiListBox.getSelectedRow(parameters) - - switch (selection) { - case 0: handleBackpack(player); break - case 1: handleBikini(player); break - case 2: handleBodysuit(player); break - case 3: handleBoot(player); break - case 4: handleBustier(player); break - case 5: handleDress(player); break - case 6: handleGlove(player); break - case 7: handleGoggle(player); break - case 8: handleHat(player); break - case 9: handleHelmet(player); break - case 10: handleJacket(player); break - case 11: handlePant(player); break - case 12: handleRobe(player); break - case 13: handleShirt(player); break - case 14: handleShoe(player); break - case 15: handleSkirt(player); break - case 16: handleVest(player); break - case 17: handleIthorianEquipment(player); break - case 18: handleJediEquipment(player); break - case 19: handleNightsisterEquipment(player); break - case 20: handleTuskenEquipment(player); break - case 21: handleWookieeEquipment(player); break - case 22: handleOther(player); break + + static def handleArmor(Player player) { + def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a set of armor to receive.") + + listBox.addListItem("R.I.S. Armor") + listBox.addListItem("Mandalorian Armor") + listBox.addListItem("Bone Armor") + listBox.addListItem("Chitin Armor") + listBox.addListItem("Padded Armor") + listBox.addListItem("Ubese Armor") + listBox.addListItem("Ithorian Defender Armor") + listBox.addListItem("Wookiee Black Mountain Armor") + listBox.addListItem("Deathtrooper Armor") + listBox.addListItem("Imperial - Galactic Marine Armor") + listBox.addListItem("Imperial - Scout trooper Armor") + listBox.addListItem("Imperial - Shock trooper Armor") + listBox.addListItem("Imperial - Stormtrooper Armor") + listBox.addListItem("Imperial - Black Crusader Armor") + listBox.addListItem("Imperial - Black Spec Ops Armor") + listBox.addListItem("Imperial - White Spec Ops Armor") + listBox.addListItem("Imperial - Snow trooper Armor") + listBox.addListItem("Imperial - Forest Camouflage Armor") + listBox.addListItem("Rebel - Forest Camouflage Armor") + listBox.addListItem("Rebel - Assault Armor") + listBox.addListItem("Rebel - Battle Armor") + listBox.addListItem("Rebel - Marine Armor") + listBox.addListItem("Rebel - Spec Force Armor") + listBox.addListItem("Rebel - Black Crusader Armor") + listBox.addListItem("Rebel - Alliance Weather Cold Armor") + listBox.addCallback(SuiEvent.OK_PRESSED, "handleArmorSelection", { event, parameters -> handleArmorSelection(player, parameters) }) + listBox.display(player) } -} - -static def handleBackpack(Player player) { - spawnItems(player, [ - "item_content_backpack_rsf_02_01", - "item_empire_day_imperial_sandtrooper_backpack", - "item_empire_day_rebel_camoflauge_backpack", - "item_event_gmf_backpack_01", - "item_heroic_backpack_krayt_skull_01_01", - "item_heroic_backpack_tauntaun_skull_01_01" - ]) -} - -static def handleBikini(Player player) { - spawnItems(player, [ - "item_clothing_bikini_01_01", - "item_clothing_bikini_01_02", - "item_clothing_bikini_01_03", - "item_clothing_bikini_01_04", - "item_clothing_bikini_leggings_01_01" - ]) -} - -static def handleBodysuit(Player player) { - spawnItems(player, [ - "item_clothing_bodysuit_at_at_01_01", - "item_clothing_bodysuit_bwing_01_01", - "item_clothing_bodysuit_tie_fighter_01_01", - "item_clothing_bodysuit_trando_slaver_01_01" - ]) -} - -static def handleBoot(Player player) { - spawnItems(player, [ - "item_clothing_boots_01_03", - "item_clothing_boots_01_04", - "item_clothing_boots_01_05", - "item_clothing_boots_01_12", - "item_clothing_boots_01_14", - "item_clothing_boots_01_15", - "item_clothing_boots_01_19", - "item_clothing_boots_01_21", - "item_clothing_boots_01_22", - "item_clothing_boots_01_24" - ]) -} - -static def handleBustier(Player player) { - spawnItems(player, [ - "item_clothing_bustier_01_01", - "item_clothing_bustier_01_02", - "item_clothing_bustier_01_03" - ]) -} - -static def handleDress(Player player) { - spawnItems(player, [ - "item_clothing_dress_01_05", - "item_clothing_dress_01_06", - "item_clothing_dress_01_07", - "item_clothing_dress_01_08", - "item_clothing_dress_01_09", - "item_clothing_dress_01_10", - "item_clothing_dress_01_11", - "item_clothing_dress_01_12", - "item_clothing_dress_01_13", - "item_clothing_dress_01_14", - "item_clothing_dress_01_15", - "item_clothing_dress_01_16", - "item_clothing_dress_01_18", - "item_clothing_dress_01_19", - "item_clothing_dress_01_23", - "item_clothing_dress_01_26", - "item_clothing_dress_01_27", - "item_clothing_dress_01_29", - "item_clothing_dress_01_30", - "item_clothing_dress_01_31", - "item_clothing_dress_01_32", - "item_clothing_dress_01_33", - "item_clothing_dress_01_34", - "item_clothing_dress_01_35" - ]) -} - -static def handleGlove(Player player) { - spawnItems(player, [ - "item_clothing_gloves_01_02", - "item_clothing_gloves_01_03", - "item_clothing_gloves_01_06", - "item_clothing_gloves_01_07", - "item_clothing_gloves_01_10", - "item_clothing_gloves_01_11", - "item_clothing_gloves_01_12", - "item_clothing_gloves_01_13", - "item_clothing_gloves_01_14" - ]) -} - -static def handleGoggle(Player player) { - spawnItems(player, [ - "item_clothing_goggles_anniversary_01_01", - "item_clothing_goggles_goggles_01_01", - "item_clothing_goggles_goggles_01_02", - "item_clothing_goggles_goggles_01_03", - "item_clothing_goggles_goggles_01_04", - "item_clothing_goggles_goggles_01_05", - "item_clothing_goggles_goggles_01_06" - ]) -} - -static def handleHat(Player player) { - spawnItems(player, [ - "item_clothing_hat_chef_01_01", - "item_clothing_hat_chef_01_02", - "item_clothing_hat_imp_01_01", - "item_clothing_hat_imp_01_02", - "item_clothing_hat_rebel_trooper_01_01", - "item_clothing_hat_01_02", - "item_clothing_hat_01_04", - "item_clothing_hat_01_10", - "item_clothing_hat_01_12", - "item_clothing_hat_01_13", - "item_clothing_hat_01_14", - "item_clothing_hat_twilek_01_01", - "item_clothing_hat_twilek_01_02", - "item_clothing_hat_twilek_01_03", - "item_clothing_hat_twilek_01_04", - "item_clothing_hat_twilek_01_05" - ]) -} - -static def handleHelmet(Player player) { - spawnItems(player, [ - "item_clothing_helmet_at_at_01_01", - "item_clothing_helmet_fighter_blacksun_01_01", - "item_clothing_helmet_fighter_imperial_01_01", - "item_clothing_helmet_fighter_privateer_01_01", - "item_clothing_helmet_fighter_rebel_01_01", - "item_clothing_helmet_tie_fighter_01_01" - ]) -} - -static def handleJacket(Player player) { - spawnItems(player, [ - "item_clothing_jacket_ace_imperial_01_01", - "item_clothing_jacket_ace_privateer_01_01", - "item_clothing_jacket_ace_rebel_01_01", - "item_clothing_jacket_gcw_imperial_01_01", - "item_clothing_jacket_gcw_rebel_01_01", - "item_clothing_jacket_01_02", - "item_clothing_jacket_01_03", - "item_clothing_jacket_01_04", - "item_clothing_jacket_01_05", - "item_clothing_jacket_01_06", - "item_clothing_jacket_01_07", - "item_clothing_jacket_01_08", - "item_clothing_jacket_01_09", - "item_clothing_jacket_01_10", - "item_clothing_jacket_01_11", - "item_clothing_jacket_01_12", - "item_clothing_jacket_01_13", - "item_clothing_jacket_01_14", - "item_clothing_jacket_01_15", - "item_clothing_jacket_01_16", - "item_clothing_jacket_01_17", - "item_clothing_jacket_01_18", - "item_clothing_jacket_01_19", - "item_clothing_jacket_01_20", - "item_clothing_jacket_01_21", - "item_clothing_jacket_01_22", - "item_clothing_jacket_01_23", - "item_clothing_jacket_01_24", - "item_clothing_jacket_01_25", - "item_clothing_jacket_01_26" - ]) -} - -static def handlePant(Player player) { - spawnItems(player, [ - "item_clothing_pants_01_01", - "item_clothing_pants_01_02", - "item_clothing_pants_01_03", - "item_clothing_pants_01_04", - "item_clothing_pants_01_05", - "item_clothing_pants_01_06", - "item_clothing_pants_01_07", - "item_clothing_pants_01_08", - "item_clothing_pants_01_09", - "item_clothing_pants_01_10", - "item_clothing_pants_01_11", - "item_clothing_pants_01_12", - "item_clothing_pants_01_13", - "item_clothing_pants_01_14", - "item_clothing_pants_01_15", - "item_clothing_pants_01_16", - "item_clothing_pants_01_17", - "item_clothing_pants_01_18", - "item_clothing_pants_01_21", - "item_clothing_pants_01_22", - "item_clothing_pants_01_24", - "item_clothing_pants_01_25", - "item_clothing_pants_01_26", - "item_clothing_pants_01_27", - "item_clothing_pants_01_28", - "item_clothing_pants_01_29", - "item_clothing_pants_01_30", - "item_clothing_pants_01_31", - "item_clothing_pants_01_32", - "item_clothing_pants_01_33" - ]) -} - -static def handleRobe(Player player) { - spawnItems(player, [ - "item_clothing_robe_exar_cultist_hood_down_01_01", - "item_clothing_robe_exar_cultist_hood_up_01_01", - "item_clothing_robe_prefect_talmont_01_01", - "item_clothing_robe_01_01", - "item_clothing_robe_01_04", - "item_clothing_robe_01_05", - "item_clothing_robe_01_12", - "item_clothing_robe_01_18", - "item_clothing_robe_01_27", - "item_clothing_robe_01_32", - "item_clothing_robe_01_33" - ]) -} - -static def handleShirt(Player player) { - spawnItems(player, [ - "item_clothing_shirt_01_03", - "item_clothing_shirt_01_04", - "item_clothing_shirt_01_05", - "item_clothing_shirt_01_07", - "item_clothing_shirt_01_08", - "item_clothing_shirt_01_09", - "item_clothing_shirt_01_10", - "item_clothing_shirt_01_11", - "item_clothing_shirt_01_12", - "item_clothing_shirt_01_13", - "item_clothing_shirt_01_14", - "item_clothing_shirt_01_15", - "item_clothing_shirt_01_16", - "item_clothing_shirt_01_24", - "item_clothing_shirt_01_26", - "item_clothing_shirt_01_27", - "item_clothing_shirt_01_28", - "item_clothing_shirt_01_30", - "item_clothing_shirt_01_32", - "item_clothing_shirt_01_34", - "item_clothing_shirt_01_38", - "item_clothing_shirt_01_42" - ]) -} - -static def handleShoe(Player player) { - spawnItems(player, [ - "item_clothing_shoes_01_01", - "item_clothing_shoes_01_02", - "item_clothing_shoes_01_03", - "item_clothing_shoes_01_07", - "item_clothing_shoes_01_08", - "item_clothing_shoes_01_09" - ]) -} - -static def handleSkirt(Player player) { - spawnItems(player, [ - "item_clothing_skirt_01_03", - "item_clothing_skirt_01_04", - "item_clothing_skirt_01_05", - "item_clothing_skirt_01_06", - "item_clothing_skirt_01_07", - "item_clothing_skirt_01_08", - "item_clothing_skirt_01_09", - "item_clothing_skirt_01_10", - "item_clothing_skirt_01_11", - "item_clothing_skirt_01_12", - "item_clothing_skirt_01_13", - "item_clothing_skirt_01_14" - ]) -} - -static def handleVest(Player player) { - spawnItems(player, [ - "item_clothing_vest_01_01", - "item_clothing_vest_01_02", - "item_clothing_vest_01_03", - "item_clothing_vest_01_04", - "item_clothing_vest_01_05", - "item_clothing_vest_01_06", - "item_clothing_vest_01_09", - "item_clothing_vest_01_10", - "item_clothing_vest_01_11", - "item_clothing_vest_01_15" - ]) -} - -static def handleIthorianEquipment(Player player) { - spawnItems(player, [ - "item_clothing_ithorian_apron_chef_jacket_01_01", - "item_clothing_ithorian_hat_chef_01_01", - "item_clothing_ithorian_hat_chef_01_02", - "item_clothing_ithorian_bodysuit_01_01", - "item_clothing_ithorian_bodysuit_01_02", - "item_clothing_ithorian_bodysuit_01_03", - "item_clothing_ithorian_bodysuit_01_04", - "item_clothing_ithorian_bodysuit_01_05", - "item_clothing_ithorian_bodysuit_01_06", - "item_clothing_ithorian_dress_01_02", - "item_clothing_ithorian_dress_01_03", - "item_clothing_ithorian_gloves_01_01", - "item_clothing_ithorian_gloves_01_02", - "item_clothing_ithorian_hat_01_01", - "item_clothing_ithorian_hat_01_02", - "item_clothing_ithorian_hat_01_03", - "item_clothing_ithorian_hat_01_04", - "item_clothing_ithorian_pants_01_01", - "item_clothing_ithorian_pants_01_02", - "item_clothing_ithorian_pants_01_03", - "item_clothing_ithorian_pants_01_04", - "item_clothing_ithorian_pants_01_05", - "item_clothing_ithorian_pants_01_06", - "item_clothing_ithorian_pants_01_07", - "item_clothing_ithorian_pants_01_08", - "item_clothing_ithorian_pants_01_09", - "item_clothing_ithorian_pants_01_10", - "item_clothing_ithorian_pants_01_11", - "item_clothing_ithorian_pants_01_12", - "item_clothing_ithorian_pants_01_13", - "item_clothing_ithorian_pants_01_14", - "item_clothing_ithorian_pants_01_15", - "item_clothing_ithorian_pants_01_16", - "item_clothing_ithorian_pants_01_17", - "item_clothing_ithorian_pants_01_18", - "item_clothing_ithorian_pants_01_19", - "item_clothing_ithorian_pants_01_20", - "item_clothing_ithorian_pants_01_21", - "item_clothing_ithorian_robe_01_02", - "item_clothing_ithorian_robe_01_03", - "item_clothing_ithorian_shirt_01_01", - "item_clothing_ithorian_shirt_01_02", - "item_clothing_ithorian_shirt_01_03", - "item_clothing_ithorian_shirt_01_04", - "item_clothing_ithorian_shirt_01_05", - "item_clothing_ithorian_shirt_01_06", - "item_clothing_ithorian_shirt_01_07", - "item_clothing_ithorian_shirt_01_08", - "item_clothing_ithorian_shirt_01_09", - "item_clothing_ithorian_shirt_01_10", - "item_clothing_ithorian_shirt_01_11", - "item_clothing_ithorian_shirt_01_12", - "item_clothing_ithorian_shirt_01_13", - "item_clothing_ithorian_shirt_01_14", - "item_clothing_ithorian_skirt_01_01", - "item_clothing_ithorian_skirt_01_02", - "item_clothing_ithorian_skirt_01_03", - "item_clothing_ithorian_vest_01_01", - "item_clothing_ithorian_vest_01_02" - ]) -} - -static def handleJediEquipment(Player player) { - spawnItems(player, [ - "item_gcw_imperial_cape_01", - "item_gcw_imperial_jacket_01", - "item_gcw_rebel_cape_01", - "item_gcw_rebel_jacket_01", - "item_jedi_robe_04_01", - "item_jedi_robe_04_02", - "item_jedi_robe_06_03", - "item_jedi_robe_06_04", - "item_jedi_robe_dark_03_01", - "item_jedi_robe_dark_03_02", - "item_jedi_robe_dark_03_03", - "item_jedi_robe_dark_04_01", - "item_jedi_robe_dark_04_02", - "item_jedi_robe_dark_04_03", - "item_jedi_robe_dark_04_04", - "item_jedi_robe_dark_04_05", - "item_jedi_robe_light_03_01", - "item_jedi_robe_light_03_02", - "item_jedi_robe_light_03_03", - "item_jedi_robe_light_04_01", - "item_jedi_robe_light_04_02", - "item_jedi_robe_light_04_03", - "item_jedi_robe_light_04_04", - "item_jedi_robe_light_04_05" - ]) -} - -static def handleNightsisterEquipment(Player player) { - spawnItems(player, [ - "item_clothing_boots_nightsister_01_01", - "item_clothing_dress_nightsister_01_01", - "item_clothing_hat_nightsister_01_01", - "item_clothing_hat_nightsister_01_02", - "item_clothing_hat_nightsister_01_03", - "item_clothing_pants_nightsister_01_01", - "item_clothing_pants_nightsister_01_02", - "item_clothing_shirt_nightsister_01_01", - "item_clothing_shirt_nightsister_01_02", - "item_clothing_shirt_nightsister_01_03" - ]) -} - -static def handleTuskenEquipment(Player player) { - spawnItems(player, [ - "item_clothing_bandolier_tusken_01_01", - "item_clothing_bandolier_tusken_01_02", - "item_clothing_bandolier_tusken_01_03", - "item_clothing_boots_tusken_raider_01_01", - "item_clothing_gloves_tusken_raider_01_01", - "item_clothing_helmet_tusken_raider_01_01", - "item_clothing_helmet_tusken_raider_01_02", - "item_clothing_robe_tusken_raider_01_01", - "item_clothing_robe_tusken_raider_01_02" - ]) -} - -static def handleWookieeEquipment(Player player) { - spawnItems(player, [ - "item_clothing_wookiee_gloves_01_01", - "item_clothing_wookiee_gloves_01_02", - "item_clothing_wookiee_gloves_01_03", - "item_clothing_wookiee_gloves_01_04", - "item_clothing_wookiee_hat_01_01", - "item_clothing_wookiee_hood_01_01", - "item_clothing_wookiee_hood_01_02", - "item_clothing_wookiee_hood_01_03", - "item_clothing_wookiee_lifeday_robe_01_01", - "item_clothing_wookiee_lifeday_robe_01_02", - "item_clothing_wookiee_lifeday_robe_01_03", - "item_clothing_wookiee_shirt_01_01", - "item_clothing_wookiee_shirt_01_02", - "item_clothing_wookiee_shirt_01_03", - "item_clothing_wookiee_shirt_01_04", - "item_clothing_wookiee_shirt_01_05", - "item_clothing_wookiee_shoulder_pad_01_01", - "item_clothing_wookiee_shoulder_pad_01_02", - "item_clothing_wookiee_skirt_01_01", - "item_clothing_wookiee_skirt_01_02", - "item_clothing_wookiee_skirt_01_03", - "item_clothing_wookiee_skirt_01_04" - ]) -} - -static def handleOther(Player player) { - spawnItems(player, [ - "item_lifeday_09_jacket_01", - "item_pgc_chronicle_master_robe", - "item_senator_robe", - "item_senator_wookiee_robe", - "item_tcg_loot_reward_series1_arc170_flightsuit", - "item_tcg_loot_reward_series1_black_corset_dress", - "item_tcg_loot_reward_series1_black_flightsuit", - "item_tcg_loot_reward_series1_glowing_blue_eyes", - "item_tcg_loot_reward_series1_glowing_red_eyes", - "item_tcg_loot_reward_series5_ceremonial_travel_headdress", - "item_tcg_loot_reward_series6_greedo_outfit", - "item_tcg_loot_reward_series7_gold_cape", - "item_tow_duster_03_01", - "item_event_gmf_jacket_01", - "item_event_gmf_wings_01" - ]) -} - -static def handleTools(Player player) { - def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select the tools you want to receive.") - - listBox.addListItem("Survey Tools") - - listBox.addCallback(SuiEvent.OK_PRESSED, "handleToolsSelection", {event,parameters -> handleToolsSelection(player, parameters)}) - listBox.display(player) -} - -static def handleToolsSelection(Player player, Map parameters) { - def selection = SuiListBox.getSelectedRow(parameters) - - switch (selection) { - case 0: handleSurveyTools(player); break + + static def handleArmorSelection(Player player, Map parameters) { + switch (SuiListBox.getSelectedRow(parameters)) { + case 0: handleRisArmor(player); break + case 1: handleMandoArmor(player); break + case 2: handleBoneArmor(player); break + case 3: handleChitinArmor(player); break + case 4: handlePaddedArmor(player); break + case 5: handleUbeseArmor(player); break + case 6: handleIthoriandefenderArmor(player); break + case 7: handleWookieeblackmtnArmor(player); break + case 8: handleDeathtrooperArmor(player); break + case 9: handleImpBattlemarineArmor(player); break + case 10: handleImpBattlewornscoutArmor(player); break + case 11: handleImpBattlewornshockArmor(player); break + case 12: handleImpBattlewornstormArmor(player); break + case 13: handleImpBlackcrusaderArmor(player); break + case 14: handleImpBlackpvpspecopsArmor(player); break + case 15: handleImpWhitepvpspecopsArmor(player); break + case 16: handleImpSnowtrooperArmor(player); break + case 17: handleImpForestCamoArmor(player); break + case 18: handleRebForestCamoArmor(player); break + case 19: handleRebBattlewornassaultArmor(player); break + case 20: handleRebBattlewornbattleArmor(player); break + case 21: handleRebBattlewornmarineArmor(player); break + case 22: handleRebBattlewornspecforceArmor(player); break + case 23: handleRebBlackcrusaderArmor(player); break + case 24: handleRebAlliancecoldArmor(player); break + } } -} - -static def handleSurveyTools(Player player) { - spawnItems(player, [ - "survey_tool_gas", - "survey_tool_inorganic", - "survey_tool_liquid", - "survey_tool_lumber", - "survey_tool_mineral", - "survey_tool_moisture", - "survey_tool_organic", - "survey_tool_solar", - "survey_tool_wind" - ]) -} - -static def handleTravel(Player player) { - def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a location you want to get teleported to.") - - listBox.addListItem("Corellia - Stronghold") - listBox.addListItem("Coreliia - Corsec Base") - listBox.addListItem("Corellia - Rebel Base with X-Wings") - listBox.addListItem("Dantooine - Force Crystal Hunter's Cave") - listBox.addListItem("Dantooine - Jedi Temple Ruins") - listBox.addListItem("Dantooine - The Warren") - listBox.addListItem("Dathomir - Imperial Prison") - listBox.addListItem("Dathomir - Nightsister Stronghold") - listBox.addListItem("Dathomir - Nightsister vs. Singing Moutain Clan") - listBox.addListItem("Dathomir - Quarantine Zone") - listBox.addListItem("Endor - DWB") - listBox.addListItem("Endor - Jinda Cave") - listBox.addListItem("Kashyyyk - Etyyy, The Hunting Grounds") - listBox.addListItem("Kashyyyk - Kachirho, Slaver Camp") - listBox.addListItem("Kashyyyk - Kkowir, The Dead Forest") - listBox.addListItem("Lok - Droid Cave") - listBox.addListItem("Lok - Great Maze of Lok") - listBox.addListItem("Lok - Imperial Outpost") - listBox.addListItem("Lok - Kimogila Town") - listBox.addListItem("Naboo - Emperor's Retreat") - listBox.addListItem("Naboo - Weapon Development Facility") - listBox.addListItem("Rori - Hyperdrive Research Facility") - listBox.addListItem("Talus - Detainment Center") - listBox.addListItem("Tatooine - Fort Tusken") - listBox.addListItem("Tatooine - Imperial Oasis") - listBox.addListItem("Tatooine - Krayt Graveyard") - listBox.addListItem("Tatooine - Mos Eisley") - listBox.addListItem("Tatooine - Mos Taike") - listBox.addListItem("Tatooine - Squill Cave") - listBox.addListItem("Yavin 4 - Blueleaf Temple") - listBox.addListItem("Yavin 4 - Dark Enclave") - listBox.addListItem("Yavin 4 - Exar Kun") - listBox.addListItem("Yavin 4 - Geonosian Cave") - listBox.addListItem("Yavin 4 - Light Enclave") - - listBox.addCallback(SuiEvent.OK_PRESSED, "handleTravelSelection", {event,parameters -> handleTravelSelection(player, parameters)}) - listBox.display(player) -} - -static -def handleTravelSelection(Player player, Map parameters) { - def selection = SuiListBox.getSelectedRow(parameters) - - switch (selection) { - - // Planet: Corellia - case 0: handleCorStronghold(player); break - case 1: handleCorCorsecBase(player); break - case 2: handleCorRebelXwingBase(player); break - // Planet: Dantooine - case 3: handleDanCrystalCave(player); break - case 4: handleDanJediTemple(player); break - case 5: handleDanWarren(player); break - // Planet: Dathomir - case 6: handleDatImperialPrison(player); break - case 7: handleDatNS(player); break - case 8: handleDatNSvsSMC(player); break - case 9: handleDatQz(player); break - // Planet: Endor - case 10: handleEndDwb(player); break - case 11: handleEndJindaCave(player); break - // Planet: Kashyyyk - case 12: handleKasEtyyy(player); break - case 13: handleKasKachirho(player); break - case 14: handleKasKkowir(player); break - // Planet: Lok - case 15: handleLokDroidCave(player); break - case 16: handleLokGreatMaze(player); break - case 17: handleLokImperialOutpost(player); break - case 18: handleLokKimogilaTown(player); break - // Planet: Naboo - case 19: handleNabEmperorsRetreat(player); break - case 20: handleNabWeaponFac(player); break - // Planet: Rori - case 21: handleRorHyperdriveFacility(player); break - // Planet: Talus - case 22: handleTalDetainmentCenter(player); break - // Planet: Tatooine - case 23: handleTatFortTusken(player); break - case 24: handleTatImperialOasis(player); break - case 25: handleTatKraytGrave(player); break - case 26: handleTatMosEisley(player); break - case 27: handleTatMosTaike(player); break - case 28: handleTatSquillCave(player); break - // Planet: Yavin 4 - case 29: handleYavBlueleafTemple(player); break - case 30: handleYavDarkEnclave(player); break - case 31: handleYavExarKun(player); break - case 32: handleYavGeoCave(player); break - case 33: handleYavLightEnclave(player); break - + + static def handleRisArmor(Player player) { + spawnItems(player, [ + "armor_ris_bicep_l", + "armor_ris_bicep_r", + "armor_ris_boots", + "armor_ris_bracer_l", + "armor_ris_bracer_r", + "armor_ris_chest_plate", + "armor_ris_gloves", + "armor_ris_helmet", + "armor_ris_leggings" + ]) + } + + static def handleMandoArmor(Player player) { + spawnItems(player, [ + "armor_mandalorian_bicep_l", + "armor_mandalorian_bicep_r", + "armor_mandalorian_bracer_l", + "armor_mandalorian_bracer_r", + "armor_mandalorian_chest_plate", + "armor_mandalorian_gloves", + "armor_mandalorian_helmet", + "armor_mandalorian_leggings", + "armor_mandalorian_shoes" + ]) + } + + static def handleBoneArmor(Player player) { + spawnItems(player, [ + "armor_bone_bicep_l_02_01", + "armor_bone_bicep_r_02_01", + "armor_bone_boots_02_01", + "armor_bone_bracer_l_02_01", + "armor_bone_bracer_r_02_01", + "armor_bone_chest_02_01", + "armor_bone_gloves_02_01", + "armor_bone_helmet_02_01", + "armor_bone_leggings_02_01" + ]) + } + + static def handleChitinArmor(Player player) { + spawnItems(player, [ + "armor_assault_sta_lvl80_bicep_l_02_01", + "armor_assault_sta_lvl80_bicep_r_02_01", + "armor_assault_sta_lvl80_boots_02_01", + "armor_assault_sta_lvl80_bracer_l_02_01", + "armor_assault_sta_lvl80_bracer_r_02_01", + "armor_assault_sta_lvl80_chest_02_01", + "armor_assault_sta_lvl80_gloves_02_01", + "armor_assault_sta_lvl80_helmet_02_01", + "armor_assault_sta_lvl80_leggings_02_01" + ]) + } + + static def handlePaddedArmor(Player player) { + spawnItems(player, [ + "armor_tow_battle_bicep_l_03_01", + "armor_tow_battle_bicep_r_03_01", + "armor_tow_battle_boots_03_01", + "armor_tow_battle_bracer_l_03_01", + "armor_tow_battle_bracer_r_03_01", + "armor_tow_battle_chest_03_01", + "armor_tow_battle_gloves_03_01", + "armor_tow_battle_helmet_03_01", + "armor_tow_battle_leggings_03_01" + ]) + } + + static def handleUbeseArmor(Player player) { + spawnItems(player, [ + "armor_recon_sta_lvl80_boots_02_01", + "armor_recon_sta_lvl80_bracer_l_02_01", + "armor_recon_sta_lvl80_bracer_r_02_01", + "armor_recon_sta_lvl80_chest_02_01", + "armor_recon_sta_lvl80_gloves_02_01", + "armor_recon_sta_lvl80_helmet_02_01", + "armor_recon_sta_lvl80_leggings_02_01" + ]) + } + + static def handleIthoriandefenderArmor(Player player) { + spawnItems(player, [ + "armor_ithorian_defender_bicep_camo_l_04_01", + "armor_ithorian_defender_bicep_camo_r_04_01", + "armor_ithorian_defender_boots_camo_04_01", + "armor_ithorian_defender_bracer_camo_l_04_01", + "armor_ithorian_defender_bracer_camo_r_04_01", + "armor_ithorian_defender_chest_plate_camo_04_01", + "armor_ithorian_defender_gloves_camo_04_01", + "armor_ithorian_defender_helmet_camo_04_01", + "armor_ithorian_defender_leggings_camo_04_01" + ]) + } + + static def handleWookieeblackmtnArmor(Player player) { + spawnItems(player, [ + "armor_kashyyykian_black_mtn_bicep_camo_l_04_01", + "armor_kashyyykian_black_mtn_bicep_camo_r_04_01", + "armor_kashyyykian_black_mtn_bracer_camo_l_04_01", + "armor_kashyyykian_black_mtn_bracer_camo_r_04_01", + "armor_kashyyykian_black_mtn_chest_plate_camo_04_01", + "armor_kashyyykian_black_mtn_leggings_camo_04_01", + ]) + } + + static def handleDeathtrooperArmor(Player player) { + spawnItems(player, [ + "armor_deathtrooper_bicep_l_04_01", + "armor_deathtrooper_bicep_r_04_01", + "armor_deathtrooper_boots_04_01", + "armor_deathtrooper_bracer_l_04_01", + "armor_deathtrooper_bracer_r_04_01", + "armor_deathtrooper_chest_plate_04_01", + "armor_deathtrooper_gloves_04_01", + "armor_deathtrooper_helmet_04_01", + "armor_deathtrooper_leggings_04_01" + ]) + } + + static def handleImpBattlemarineArmor(Player player) { + spawnItems(player, [ + "armor_gcw_imperial_galactic_marine_bicep_l", + "armor_gcw_imperial_galactic_marine_bicep_r", + "armor_gcw_imperial_galactic_marine_boots", + "armor_gcw_imperial_galactic_marine_bracer_l", + "armor_gcw_imperial_galactic_marine_bracer_r", + "armor_gcw_imperial_galactic_marine_chest_plate", + "armor_gcw_imperial_galactic_marine_gloves", + "armor_gcw_imperial_galactic_marine_helmet", + "armor_gcw_imperial_galactic_marine_leggings" + ]) + } + + static def handleImpBattlewornscoutArmor(Player player) { + spawnItems(player, [ + "armor_gcw_imperial_scouttrooper_bicep_l", + "armor_gcw_imperial_scouttrooper_bicep_r", + "armor_gcw_imperial_scouttrooper_boots", + "armor_gcw_imperial_scouttrooper_bracer_l", + "armor_gcw_imperial_scouttrooper_bracer_r", + "armor_gcw_imperial_scouttrooper_chest_plate", + "armor_gcw_imperial_scouttrooper_gloves", + "armor_gcw_imperial_scouttrooper_helmet", + "armor_gcw_imperial_scouttrooper_leggings" + ]) + } + + static def handleImpBattlewornshockArmor(Player player) { + spawnItems(player, [ + "armor_gcw_imperial_shocktrooper_bicep_l", + "armor_gcw_imperial_shocktrooper_bicep_r", + "armor_gcw_imperial_shocktrooper_boots", + "armor_gcw_imperial_shocktrooper_bracer_l", + "armor_gcw_imperial_shocktrooper_bracer_r", + "armor_gcw_imperial_shocktrooper_chest_plate", + "armor_gcw_imperial_shocktrooper_gloves", + "armor_gcw_imperial_shocktrooper_helmet", + "armor_gcw_imperial_shocktrooper_leggings" + ]) + } + + static def handleImpBattlewornstormArmor(Player player) { + spawnItems(player, [ + "armor_gcw_imperial_stormtrooper_bicep_l", + "armor_gcw_imperial_stormtrooper_bicep_r", + "armor_gcw_imperial_stormtrooper_boots", + "armor_gcw_imperial_stormtrooper_bracer_l", + "armor_gcw_imperial_stormtrooper_bracer_r", + "armor_gcw_imperial_stormtrooper_chest_plate", + "armor_gcw_imperial_stormtrooper_gloves", + "armor_gcw_imperial_stormtrooper_helmet", + "armor_gcw_imperial_stormtrooper_leggings" + ]) + } + + static def handleRebBattlewornassaultArmor(Player player) { + spawnItems(player, [ + "armor_gcw_rebel_assault_bicep_l", + "armor_gcw_rebel_assault_bicep_r", + "armor_gcw_rebel_assault_boots", + "armor_gcw_rebel_assault_bracer_l", + "armor_gcw_rebel_assault_bracer_r", + "armor_gcw_rebel_assault_chest_plate", + "armor_gcw_rebel_assault_gloves", + "armor_gcw_rebel_assault_helmet", + "armor_gcw_rebel_assault_leggings" + ]) + } + + static def handleRebBattlewornbattleArmor(Player player) { + spawnItems(player, [ + "armor_gcw_rebel_battle_bicep_l", + "armor_gcw_rebel_battle_bicep_r", + "armor_gcw_rebel_battle_boots", + "armor_gcw_rebel_battle_bracer_l", + "armor_gcw_rebel_battle_bracer_r", + "armor_gcw_rebel_battle_chest_plate", + "armor_gcw_rebel_battle_gloves", + "armor_gcw_rebel_battle_helmet", + "armor_gcw_rebel_battle_leggings" + ]) + } + + static def handleRebBattlewornmarineArmor(Player player) { + spawnItems(player, [ + "armor_gcw_rebel_marine_bicep_l", + "armor_gcw_rebel_marine_bicep_r", + "armor_gcw_rebel_marine_boots", + "armor_gcw_rebel_marine_bracer_l", + "armor_gcw_rebel_marine_bracer_r", + "armor_gcw_rebel_marine_chest_plate", + "armor_gcw_rebel_marine_gloves", + "armor_gcw_rebel_marine_helmet", + "armor_gcw_rebel_marine_leggings" + ]) + } + + static def handleRebBattlewornspecforceArmor(Player player) { + spawnItems(player, [ + "armor_gcw_rebel_specforce_bicep_l", + "armor_gcw_rebel_specforce_bicep_r", + "armor_gcw_rebel_specforce_boots", + "armor_gcw_rebel_specforce_bracer_l", + "armor_gcw_rebel_specforce_bracer_r", + "armor_gcw_rebel_specforce_chest_plate", + "armor_gcw_rebel_specforce_gloves", + "armor_gcw_rebel_specforce_helmet", + "armor_gcw_rebel_specforce_leggings" + ]) + } + + static def handleImpBlackcrusaderArmor(Player player) { + spawnItems(player, [ + "armor_mandalorian_imperial_black_bicep_l_04_01", + "armor_mandalorian_imperial_black_bicep_r_04_01", + "armor_mandalorian_imperial_black_boots_04_01", + "armor_mandalorian_imperial_black_bracer_l_04_01", + "armor_mandalorian_imperial_black_bracer_r_04_01", + "armor_mandalorian_imperial_black_chest_plate_04_01", + "armor_mandalorian_imperial_black_gloves_04_01", + "armor_mandalorian_imperial_black_helmet_04_01", + "armor_mandalorian_imperial_black_leggings_04_01" + ]) + } + + static def handleRebBlackcrusaderArmor(Player player) { + spawnItems(player, [ + "armor_mandalorian_rebel_black_bicep_l_04_01", + "armor_mandalorian_rebel_black_bicep_r_04_01", + "armor_mandalorian_rebel_black_boots_04_01", + "armor_mandalorian_rebel_black_bracer_l_04_01", + "armor_mandalorian_rebel_black_bracer_r_04_01", + "armor_mandalorian_rebel_black_chest_plate_04_01", + "armor_mandalorian_rebel_black_gloves_04_01", + "armor_mandalorian_rebel_black_helmet_04_01", + "armor_mandalorian_rebel_black_leggings_04_01" + ]) + } + + static def handleImpBlackpvpspecopsArmor(Player player) { + spawnItems(player, [ + "armor_pvp_spec_ops_imperial_black_bicep_l_05_01", + "armor_pvp_spec_ops_imperial_black_bicep_r_05_01", + "armor_pvp_spec_ops_imperial_black_boots_05_01", + "armor_pvp_spec_ops_imperial_black_bracer_l_05_01", + "armor_pvp_spec_ops_imperial_black_bracer_r_05_01", + "armor_pvp_spec_ops_imperial_black_chest_plate_orange_pad_05_01", + "armor_pvp_spec_ops_imperial_black_gloves_05_01", + "armor_pvp_spec_ops_imperial_black_helmet_05_01", + "armor_pvp_spec_ops_imperial_black_leggings_05_01" + ]) + } + + static def handleImpWhitepvpspecopsArmor(Player player) { + spawnItems(player, [ + "armor_pvp_spec_ops_imperial_white_bicep_l_05_01", + "armor_pvp_spec_ops_imperial_white_bicep_r_05_01", + "armor_pvp_spec_ops_imperial_white_boots_05_01", + "armor_pvp_spec_ops_imperial_white_bracer_l_05_01", + "armor_pvp_spec_ops_imperial_white_bracer_r_05_01", + "armor_pvp_spec_ops_imperial_white_chest_plate_orange_pad_05_01", + "armor_pvp_spec_ops_imperial_white_gloves_05_01", + "armor_pvp_spec_ops_imperial_white_helmet_05_01", + "armor_pvp_spec_ops_imperial_white_leggings_05_01" + ]) + } + + static def handleImpSnowtrooperArmor(Player player) { + spawnItems(player, [ + "armor_snowtrooper_bicep_l", + "armor_snowtrooper_bicep_r", + "armor_snowtrooper_boots", + "armor_snowtrooper_bracer_l", + "armor_snowtrooper_bracer_r", + "armor_snowtrooper_chest_plate", + "armor_snowtrooper_gloves", + "armor_snowtrooper_helmet", + "armor_snowtrooper_leggings" + ]) + } + + static def handleImpForestCamoArmor(Player player) { + spawnItems(player, [ + "armor_scouttrooper_bicep_camo_l_04_01", + "armor_scouttrooper_bicep_camo_r_04_01", + "armor_scouttrooper_boots_camo_04_01", + "armor_scouttrooper_bracer_camo_l_04_01", + "armor_scouttrooper_bracer_camo_r_04_01", + "armor_scouttrooper_chest_plate_camo_04_01", + "armor_scouttrooper_gloves_camo_04_01", + "armor_scouttrooper_helmet_camo_04_01", + "armor_scouttrooper_leggings_camo_04_01" + ]) + } + + static def handleRebForestCamoArmor(Player player) { + spawnItems(player, [ + "armor_rebel_assault_bicep_camo_l_04_01", + "armor_rebel_assault_bicep_camo_r_04_01", + "armor_rebel_assault_boots_camo_04_01", + "armor_rebel_assault_bracer_camo_l_04_01", + "armor_rebel_assault_bracer_camo_r_04_01", + "armor_rebel_assault_chest_plate_camo_04_01", + "armor_rebel_assault_gloves_camo_04_01", + "armor_rebel_assault_helmet_camo_04_01", + "armor_rebel_assault_leggings_camo_04_01" + ]) + } + + static def handleRebGreenpvpspecopsArmor(Player player) { + spawnItems(player, [ + "armor_pvp_spec_ops_rebel_black_green_bicep_l_05_01", + "armor_pvp_spec_ops_rebel_black_green_bicep_r_05_01", + "armor_pvp_spec_ops_rebel_black_green_boots_05_01", + "armor_pvp_spec_ops_rebel_black_green_bracer_l_05_01", + "armor_pvp_spec_ops_rebel_black_green_bracer_r_05_01", + "armor_pvp_spec_ops_rebel_black_green_chest_plate_05_01", + "armor_pvp_spec_ops_rebel_black_green_gloves_05_01", + "armor_pvp_spec_ops_rebel_black_green_helmet_05_01", + "armor_pvp_spec_ops_rebel_black_green_leggings_05_01" + ]) + } + + static def handleRebAlliancecoldArmor(Player player) { + spawnItems(player, [ + "armor_rebel_snow_bicep_l", + "armor_rebel_snow_bicep_r", + "armor_rebel_snow_boots", + "armor_rebel_snow_bracer_l", + "armor_rebel_snow_bracer_r", + "armor_rebel_snow_chest_plate", + "armor_rebel_snow_gloves", + "armor_rebel_snow_helmet", + "armor_rebel_snow_leggings" + ]) + } + + static def handleWeapons(Player player) { + def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a weapon category to receive a weapon of that type.") + + listBox.addListItem("Lightsabers") + listBox.addListItem("Melee") + listBox.addListItem("Ranged") + + listBox.addCallback(SuiEvent.OK_PRESSED, "handleWeaponSelection", { event, parameters -> handleWeaponSelection(player, parameters) }) + listBox.display(player) + } + + static def handleWeaponSelection(Player player, Map parameters) { + def selection = SuiListBox.getSelectedRow(parameters) + + switch (selection) { + case 0: handleLightsabers(player); break + case 1: handleMelee(player); break + case 2: handleRanged(player); break + } + } + + static def handleLightsabers(Player player) { + spawnItems(player, [ + "weapon_mandalorian_lightsaber_04_01", + "weapon_npe_lightsaber_02_01", + "weapon_npe_lightsaber_02_02", + "weapon_roadmap_lightsaber_02_02" + ]) + } + + static def handleMelee(Player player) { + spawnItems(player, [ + "weapon_tow_blasterfist_04_01", + "weapon_tow_sword_1h_05_02", + "weapon_tow_sword_2h_05_02", + "weapon_tow_polearm_05_01", + "weapon_polearm_02_01", + "weapon_polearm_04_01", + "weapon_magna_guard_polearm_04_01", + "weapon_content_polearm_tier_8_03_02", + "weapon_quest_u10_knuckler_01_02" + ]) + } + + static def handleRanged(Player player) { + spawnItems(player, [ + "weapon_tow_pistol_flechette_05_01", + "weapon_tow_carbine_05_01", + "weapon_tow_rifle_05_02", + "weapon_tow_rifle_lightning_cannon_04_01", + "weapon_tow_heavy_rocket_launcher_05_01", + "weapon_borvo_carbine_03_01", + "weapon_borvo_pistol_03_01", + "weapon_borvo_rifle_03_01", + "weapon_content_rifle_tier_7_03_01", + "weapon_content_pistol_tier_7_03_01", + "weapon_content_carbine_tier_7_03_01", + "weapon_content_carbine_talus_selonian_04_01", + "weapon_pistol_drop_lvl40_02_01", + "weapon_rifle_drop_lvl40_02_01", + "weapon_gcw_heavy_pulse_cannon_03_01", + "weapon_heavy_pvp_general_reward_06_01", + "weapon_pistol_imperial_pvp_general_reward_06_01", + "weapon_rifle_imperial_pvp_general_reward_06_01", + "weapon_carbine_pvp_imperial_general_reward_06_01" + ]) + } + + static def handleWearables(Player player) { + def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a wearable category to receive a weapon of that type.") + + listBox.addListItem("Backpacks") + listBox.addListItem("Bikinis") + listBox.addListItem("Bodysuits") + listBox.addListItem("Boots") + listBox.addListItem("Bustiers") + listBox.addListItem("Dress") + listBox.addListItem("Gloves") + listBox.addListItem("Goggles") + listBox.addListItem("Hats") + listBox.addListItem("Helmets") + listBox.addListItem("Jackets") + listBox.addListItem("Pants") + listBox.addListItem("Robes") + listBox.addListItem("Shirt") + listBox.addListItem("Shoes") + listBox.addListItem("Skirts") + listBox.addListItem("Vest") + listBox.addListItem("Ithorian equipment") + listBox.addListItem("Jedi equipment") + listBox.addListItem("Nightsister equipment") + listBox.addListItem("Tusken Raider equipment") + listBox.addListItem("Wookie equipment") + listBox.addListItem("TCG") + + listBox.addCallback(SuiEvent.OK_PRESSED, "handleWearablesSelection", { event, parameters -> handleWearablesSelection(player, parameters) }) + listBox.display(player) + } + + static def handleWearablesSelection(Player player, Map parameters) { + def selection = SuiListBox.getSelectedRow(parameters) + + switch (selection) { + case 0: handleBackpack(player); break + case 1: handleBikini(player); break + case 2: handleBodysuit(player); break + case 3: handleBoot(player); break + case 4: handleBustier(player); break + case 5: handleDress(player); break + case 6: handleGlove(player); break + case 7: handleGoggle(player); break + case 8: handleHat(player); break + case 9: handleHelmet(player); break + case 10: handleJacket(player); break + case 11: handlePant(player); break + case 12: handleRobe(player); break + case 13: handleShirt(player); break + case 14: handleShoe(player); break + case 15: handleSkirt(player); break + case 16: handleVest(player); break + case 17: handleIthorianEquipment(player); break + case 18: handleJediEquipment(player); break + case 19: handleNightsisterEquipment(player); break + case 20: handleTuskenEquipment(player); break + case 21: handleWookieeEquipment(player); break + case 22: handleOther(player); break + } + } + + static def handleBackpack(Player player) { + spawnItems(player, [ + "item_content_backpack_rsf_02_01", + "item_empire_day_imperial_sandtrooper_backpack", + "item_empire_day_rebel_camoflauge_backpack", + "item_event_gmf_backpack_01", + "item_heroic_backpack_krayt_skull_01_01", + "item_heroic_backpack_tauntaun_skull_01_01" + ]) + } + + static def handleBikini(Player player) { + spawnItems(player, [ + "item_clothing_bikini_01_01", + "item_clothing_bikini_01_02", + "item_clothing_bikini_01_03", + "item_clothing_bikini_01_04", + "item_clothing_bikini_leggings_01_01" + ]) + } + + static def handleBodysuit(Player player) { + spawnItems(player, [ + "item_clothing_bodysuit_at_at_01_01", + "item_clothing_bodysuit_bwing_01_01", + "item_clothing_bodysuit_tie_fighter_01_01", + "item_clothing_bodysuit_trando_slaver_01_01" + ]) + } + + static def handleBoot(Player player) { + spawnItems(player, [ + "item_clothing_boots_01_03", + "item_clothing_boots_01_04", + "item_clothing_boots_01_05", + "item_clothing_boots_01_12", + "item_clothing_boots_01_14", + "item_clothing_boots_01_15", + "item_clothing_boots_01_19", + "item_clothing_boots_01_21", + "item_clothing_boots_01_22", + "item_clothing_boots_01_24" + ]) + } + + static def handleBustier(Player player) { + spawnItems(player, [ + "item_clothing_bustier_01_01", + "item_clothing_bustier_01_02", + "item_clothing_bustier_01_03" + ]) + } + + static def handleDress(Player player) { + spawnItems(player, [ + "item_clothing_dress_01_05", + "item_clothing_dress_01_06", + "item_clothing_dress_01_07", + "item_clothing_dress_01_08", + "item_clothing_dress_01_09", + "item_clothing_dress_01_10", + "item_clothing_dress_01_11", + "item_clothing_dress_01_12", + "item_clothing_dress_01_13", + "item_clothing_dress_01_14", + "item_clothing_dress_01_15", + "item_clothing_dress_01_16", + "item_clothing_dress_01_18", + "item_clothing_dress_01_19", + "item_clothing_dress_01_23", + "item_clothing_dress_01_26", + "item_clothing_dress_01_27", + "item_clothing_dress_01_29", + "item_clothing_dress_01_30", + "item_clothing_dress_01_31", + "item_clothing_dress_01_32", + "item_clothing_dress_01_33", + "item_clothing_dress_01_34", + "item_clothing_dress_01_35" + ]) + } + + static def handleGlove(Player player) { + spawnItems(player, [ + "item_clothing_gloves_01_02", + "item_clothing_gloves_01_03", + "item_clothing_gloves_01_06", + "item_clothing_gloves_01_07", + "item_clothing_gloves_01_10", + "item_clothing_gloves_01_11", + "item_clothing_gloves_01_12", + "item_clothing_gloves_01_13", + "item_clothing_gloves_01_14" + ]) + } + + static def handleGoggle(Player player) { + spawnItems(player, [ + "item_clothing_goggles_anniversary_01_01", + "item_clothing_goggles_goggles_01_01", + "item_clothing_goggles_goggles_01_02", + "item_clothing_goggles_goggles_01_03", + "item_clothing_goggles_goggles_01_04", + "item_clothing_goggles_goggles_01_05", + "item_clothing_goggles_goggles_01_06" + ]) + } + + static def handleHat(Player player) { + spawnItems(player, [ + "item_clothing_hat_chef_01_01", + "item_clothing_hat_chef_01_02", + "item_clothing_hat_imp_01_01", + "item_clothing_hat_imp_01_02", + "item_clothing_hat_rebel_trooper_01_01", + "item_clothing_hat_01_02", + "item_clothing_hat_01_04", + "item_clothing_hat_01_10", + "item_clothing_hat_01_12", + "item_clothing_hat_01_13", + "item_clothing_hat_01_14", + "item_clothing_hat_twilek_01_01", + "item_clothing_hat_twilek_01_02", + "item_clothing_hat_twilek_01_03", + "item_clothing_hat_twilek_01_04", + "item_clothing_hat_twilek_01_05" + ]) + } + + static def handleHelmet(Player player) { + spawnItems(player, [ + "item_clothing_helmet_at_at_01_01", + "item_clothing_helmet_fighter_blacksun_01_01", + "item_clothing_helmet_fighter_imperial_01_01", + "item_clothing_helmet_fighter_privateer_01_01", + "item_clothing_helmet_fighter_rebel_01_01", + "item_clothing_helmet_tie_fighter_01_01" + ]) + } + + static def handleJacket(Player player) { + spawnItems(player, [ + "item_clothing_jacket_ace_imperial_01_01", + "item_clothing_jacket_ace_privateer_01_01", + "item_clothing_jacket_ace_rebel_01_01", + "item_clothing_jacket_gcw_imperial_01_01", + "item_clothing_jacket_gcw_rebel_01_01", + "item_clothing_jacket_01_02", + "item_clothing_jacket_01_03", + "item_clothing_jacket_01_04", + "item_clothing_jacket_01_05", + "item_clothing_jacket_01_06", + "item_clothing_jacket_01_07", + "item_clothing_jacket_01_08", + "item_clothing_jacket_01_09", + "item_clothing_jacket_01_10", + "item_clothing_jacket_01_11", + "item_clothing_jacket_01_12", + "item_clothing_jacket_01_13", + "item_clothing_jacket_01_14", + "item_clothing_jacket_01_15", + "item_clothing_jacket_01_16", + "item_clothing_jacket_01_17", + "item_clothing_jacket_01_18", + "item_clothing_jacket_01_19", + "item_clothing_jacket_01_20", + "item_clothing_jacket_01_21", + "item_clothing_jacket_01_22", + "item_clothing_jacket_01_23", + "item_clothing_jacket_01_24", + "item_clothing_jacket_01_25", + "item_clothing_jacket_01_26" + ]) + } + + static def handlePant(Player player) { + spawnItems(player, [ + "item_clothing_pants_01_01", + "item_clothing_pants_01_02", + "item_clothing_pants_01_03", + "item_clothing_pants_01_04", + "item_clothing_pants_01_05", + "item_clothing_pants_01_06", + "item_clothing_pants_01_07", + "item_clothing_pants_01_08", + "item_clothing_pants_01_09", + "item_clothing_pants_01_10", + "item_clothing_pants_01_11", + "item_clothing_pants_01_12", + "item_clothing_pants_01_13", + "item_clothing_pants_01_14", + "item_clothing_pants_01_15", + "item_clothing_pants_01_16", + "item_clothing_pants_01_17", + "item_clothing_pants_01_18", + "item_clothing_pants_01_21", + "item_clothing_pants_01_22", + "item_clothing_pants_01_24", + "item_clothing_pants_01_25", + "item_clothing_pants_01_26", + "item_clothing_pants_01_27", + "item_clothing_pants_01_28", + "item_clothing_pants_01_29", + "item_clothing_pants_01_30", + "item_clothing_pants_01_31", + "item_clothing_pants_01_32", + "item_clothing_pants_01_33" + ]) + } + + static def handleRobe(Player player) { + spawnItems(player, [ + "item_clothing_robe_exar_cultist_hood_down_01_01", + "item_clothing_robe_exar_cultist_hood_up_01_01", + "item_clothing_robe_prefect_talmont_01_01", + "item_clothing_robe_01_01", + "item_clothing_robe_01_04", + "item_clothing_robe_01_05", + "item_clothing_robe_01_12", + "item_clothing_robe_01_18", + "item_clothing_robe_01_27", + "item_clothing_robe_01_32", + "item_clothing_robe_01_33" + ]) + } + + static def handleShirt(Player player) { + spawnItems(player, [ + "item_clothing_shirt_01_03", + "item_clothing_shirt_01_04", + "item_clothing_shirt_01_05", + "item_clothing_shirt_01_07", + "item_clothing_shirt_01_08", + "item_clothing_shirt_01_09", + "item_clothing_shirt_01_10", + "item_clothing_shirt_01_11", + "item_clothing_shirt_01_12", + "item_clothing_shirt_01_13", + "item_clothing_shirt_01_14", + "item_clothing_shirt_01_15", + "item_clothing_shirt_01_16", + "item_clothing_shirt_01_24", + "item_clothing_shirt_01_26", + "item_clothing_shirt_01_27", + "item_clothing_shirt_01_28", + "item_clothing_shirt_01_30", + "item_clothing_shirt_01_32", + "item_clothing_shirt_01_34", + "item_clothing_shirt_01_38", + "item_clothing_shirt_01_42" + ]) + } + + static def handleShoe(Player player) { + spawnItems(player, [ + "item_clothing_shoes_01_01", + "item_clothing_shoes_01_02", + "item_clothing_shoes_01_03", + "item_clothing_shoes_01_07", + "item_clothing_shoes_01_08", + "item_clothing_shoes_01_09" + ]) + } + + static def handleSkirt(Player player) { + spawnItems(player, [ + "item_clothing_skirt_01_03", + "item_clothing_skirt_01_04", + "item_clothing_skirt_01_05", + "item_clothing_skirt_01_06", + "item_clothing_skirt_01_07", + "item_clothing_skirt_01_08", + "item_clothing_skirt_01_09", + "item_clothing_skirt_01_10", + "item_clothing_skirt_01_11", + "item_clothing_skirt_01_12", + "item_clothing_skirt_01_13", + "item_clothing_skirt_01_14" + ]) + } + + static def handleVest(Player player) { + spawnItems(player, [ + "item_clothing_vest_01_01", + "item_clothing_vest_01_02", + "item_clothing_vest_01_03", + "item_clothing_vest_01_04", + "item_clothing_vest_01_05", + "item_clothing_vest_01_06", + "item_clothing_vest_01_09", + "item_clothing_vest_01_10", + "item_clothing_vest_01_11", + "item_clothing_vest_01_15" + ]) + } + + static def handleIthorianEquipment(Player player) { + spawnItems(player, [ + "item_clothing_ithorian_apron_chef_jacket_01_01", + "item_clothing_ithorian_hat_chef_01_01", + "item_clothing_ithorian_hat_chef_01_02", + "item_clothing_ithorian_bodysuit_01_01", + "item_clothing_ithorian_bodysuit_01_02", + "item_clothing_ithorian_bodysuit_01_03", + "item_clothing_ithorian_bodysuit_01_04", + "item_clothing_ithorian_bodysuit_01_05", + "item_clothing_ithorian_bodysuit_01_06", + "item_clothing_ithorian_dress_01_02", + "item_clothing_ithorian_dress_01_03", + "item_clothing_ithorian_gloves_01_01", + "item_clothing_ithorian_gloves_01_02", + "item_clothing_ithorian_hat_01_01", + "item_clothing_ithorian_hat_01_02", + "item_clothing_ithorian_hat_01_03", + "item_clothing_ithorian_hat_01_04", + "item_clothing_ithorian_pants_01_01", + "item_clothing_ithorian_pants_01_02", + "item_clothing_ithorian_pants_01_03", + "item_clothing_ithorian_pants_01_04", + "item_clothing_ithorian_pants_01_05", + "item_clothing_ithorian_pants_01_06", + "item_clothing_ithorian_pants_01_07", + "item_clothing_ithorian_pants_01_08", + "item_clothing_ithorian_pants_01_09", + "item_clothing_ithorian_pants_01_10", + "item_clothing_ithorian_pants_01_11", + "item_clothing_ithorian_pants_01_12", + "item_clothing_ithorian_pants_01_13", + "item_clothing_ithorian_pants_01_14", + "item_clothing_ithorian_pants_01_15", + "item_clothing_ithorian_pants_01_16", + "item_clothing_ithorian_pants_01_17", + "item_clothing_ithorian_pants_01_18", + "item_clothing_ithorian_pants_01_19", + "item_clothing_ithorian_pants_01_20", + "item_clothing_ithorian_pants_01_21", + "item_clothing_ithorian_robe_01_02", + "item_clothing_ithorian_robe_01_03", + "item_clothing_ithorian_shirt_01_01", + "item_clothing_ithorian_shirt_01_02", + "item_clothing_ithorian_shirt_01_03", + "item_clothing_ithorian_shirt_01_04", + "item_clothing_ithorian_shirt_01_05", + "item_clothing_ithorian_shirt_01_06", + "item_clothing_ithorian_shirt_01_07", + "item_clothing_ithorian_shirt_01_08", + "item_clothing_ithorian_shirt_01_09", + "item_clothing_ithorian_shirt_01_10", + "item_clothing_ithorian_shirt_01_11", + "item_clothing_ithorian_shirt_01_12", + "item_clothing_ithorian_shirt_01_13", + "item_clothing_ithorian_shirt_01_14", + "item_clothing_ithorian_skirt_01_01", + "item_clothing_ithorian_skirt_01_02", + "item_clothing_ithorian_skirt_01_03", + "item_clothing_ithorian_vest_01_01", + "item_clothing_ithorian_vest_01_02" + ]) + } + + static def handleJediEquipment(Player player) { + spawnItems(player, [ + "item_gcw_imperial_cape_01", + "item_gcw_imperial_jacket_01", + "item_gcw_rebel_cape_01", + "item_gcw_rebel_jacket_01", + "item_jedi_robe_04_01", + "item_jedi_robe_04_02", + "item_jedi_robe_06_03", + "item_jedi_robe_06_04", + "item_jedi_robe_dark_03_01", + "item_jedi_robe_dark_03_02", + "item_jedi_robe_dark_03_03", + "item_jedi_robe_dark_04_01", + "item_jedi_robe_dark_04_02", + "item_jedi_robe_dark_04_03", + "item_jedi_robe_dark_04_04", + "item_jedi_robe_dark_04_05", + "item_jedi_robe_light_03_01", + "item_jedi_robe_light_03_02", + "item_jedi_robe_light_03_03", + "item_jedi_robe_light_04_01", + "item_jedi_robe_light_04_02", + "item_jedi_robe_light_04_03", + "item_jedi_robe_light_04_04", + "item_jedi_robe_light_04_05" + ]) + } + + static def handleNightsisterEquipment(Player player) { + spawnItems(player, [ + "item_clothing_boots_nightsister_01_01", + "item_clothing_dress_nightsister_01_01", + "item_clothing_hat_nightsister_01_01", + "item_clothing_hat_nightsister_01_02", + "item_clothing_hat_nightsister_01_03", + "item_clothing_pants_nightsister_01_01", + "item_clothing_pants_nightsister_01_02", + "item_clothing_shirt_nightsister_01_01", + "item_clothing_shirt_nightsister_01_02", + "item_clothing_shirt_nightsister_01_03" + ]) + } + + static def handleTuskenEquipment(Player player) { + spawnItems(player, [ + "item_clothing_bandolier_tusken_01_01", + "item_clothing_bandolier_tusken_01_02", + "item_clothing_bandolier_tusken_01_03", + "item_clothing_boots_tusken_raider_01_01", + "item_clothing_gloves_tusken_raider_01_01", + "item_clothing_helmet_tusken_raider_01_01", + "item_clothing_helmet_tusken_raider_01_02", + "item_clothing_robe_tusken_raider_01_01", + "item_clothing_robe_tusken_raider_01_02" + ]) + } + + static def handleWookieeEquipment(Player player) { + spawnItems(player, [ + "item_clothing_wookiee_gloves_01_01", + "item_clothing_wookiee_gloves_01_02", + "item_clothing_wookiee_gloves_01_03", + "item_clothing_wookiee_gloves_01_04", + "item_clothing_wookiee_hat_01_01", + "item_clothing_wookiee_hood_01_01", + "item_clothing_wookiee_hood_01_02", + "item_clothing_wookiee_hood_01_03", + "item_clothing_wookiee_lifeday_robe_01_01", + "item_clothing_wookiee_lifeday_robe_01_02", + "item_clothing_wookiee_lifeday_robe_01_03", + "item_clothing_wookiee_shirt_01_01", + "item_clothing_wookiee_shirt_01_02", + "item_clothing_wookiee_shirt_01_03", + "item_clothing_wookiee_shirt_01_04", + "item_clothing_wookiee_shirt_01_05", + "item_clothing_wookiee_shoulder_pad_01_01", + "item_clothing_wookiee_shoulder_pad_01_02", + "item_clothing_wookiee_skirt_01_01", + "item_clothing_wookiee_skirt_01_02", + "item_clothing_wookiee_skirt_01_03", + "item_clothing_wookiee_skirt_01_04" + ]) + } + + static def handleOther(Player player) { + spawnItems(player, [ + "item_lifeday_09_jacket_01", + "item_pgc_chronicle_master_robe", + "item_senator_robe", + "item_senator_wookiee_robe", + "item_tcg_loot_reward_series1_arc170_flightsuit", + "item_tcg_loot_reward_series1_black_corset_dress", + "item_tcg_loot_reward_series1_black_flightsuit", + "item_tcg_loot_reward_series1_glowing_blue_eyes", + "item_tcg_loot_reward_series1_glowing_red_eyes", + "item_tcg_loot_reward_series5_ceremonial_travel_headdress", + "item_tcg_loot_reward_series6_greedo_outfit", + "item_tcg_loot_reward_series7_gold_cape", + "item_tow_duster_03_01", + "item_event_gmf_jacket_01", + "item_event_gmf_wings_01" + ]) + } + + static def handleTools(Player player) { + def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select the tools you want to receive.") + + listBox.addListItem("Survey Tools") + + listBox.addCallback(SuiEvent.OK_PRESSED, "handleToolsSelection", { event, parameters -> handleToolsSelection(player, parameters) }) + listBox.display(player) + } + + static def handleToolsSelection(Player player, Map parameters) { + def selection = SuiListBox.getSelectedRow(parameters) + + switch (selection) { + case 0: handleSurveyTools(player); break + } + } + + static def handleSurveyTools(Player player) { + spawnItems(player, [ + "survey_tool_gas", + "survey_tool_inorganic", + "survey_tool_liquid", + "survey_tool_lumber", + "survey_tool_mineral", + "survey_tool_moisture", + "survey_tool_organic", + "survey_tool_solar", + "survey_tool_wind" + ]) + } + + static def handleTravel(Player player) { + def listBox = new SuiListBox(SuiButtons.OK_CANCEL, "Character Builder Terminal", "Select a location you want to get teleported to.") + + listBox.addListItem("Corellia - Stronghold") + listBox.addListItem("Coreliia - Corsec Base") + listBox.addListItem("Corellia - Rebel Base with X-Wings") + listBox.addListItem("Dantooine - Force Crystal Hunter's Cave") + listBox.addListItem("Dantooine - Jedi Temple Ruins") + listBox.addListItem("Dantooine - The Warren") + listBox.addListItem("Dathomir - Imperial Prison") + listBox.addListItem("Dathomir - Nightsister Stronghold") + listBox.addListItem("Dathomir - Nightsister vs. Singing Moutain Clan") + listBox.addListItem("Dathomir - Quarantine Zone") + listBox.addListItem("Endor - DWB") + listBox.addListItem("Endor - Jinda Cave") + listBox.addListItem("Kashyyyk - Etyyy, The Hunting Grounds") + listBox.addListItem("Kashyyyk - Kachirho, Slaver Camp") + listBox.addListItem("Kashyyyk - Kkowir, The Dead Forest") + listBox.addListItem("Lok - Droid Cave") + listBox.addListItem("Lok - Great Maze of Lok") + listBox.addListItem("Lok - Imperial Outpost") + listBox.addListItem("Lok - Kimogila Town") + listBox.addListItem("Naboo - Emperor's Retreat") + listBox.addListItem("Naboo - Weapon Development Facility") + listBox.addListItem("Rori - Hyperdrive Research Facility") + listBox.addListItem("Talus - Detainment Center") + listBox.addListItem("Tatooine - Fort Tusken") + listBox.addListItem("Tatooine - Imperial Oasis") + listBox.addListItem("Tatooine - Krayt Graveyard") + listBox.addListItem("Tatooine - Mos Eisley") + listBox.addListItem("Tatooine - Mos Taike") + listBox.addListItem("Tatooine - Squill Cave") + listBox.addListItem("Yavin 4 - Blueleaf Temple") + listBox.addListItem("Yavin 4 - Dark Enclave") + listBox.addListItem("Yavin 4 - Exar Kun") + listBox.addListItem("Yavin 4 - Geonosian Cave") + listBox.addListItem("Yavin 4 - Light Enclave") + + listBox.addCallback(SuiEvent.OK_PRESSED, "handleTravelSelection", { event, parameters -> handleTravelSelection(player, parameters) }) + listBox.display(player) + } + + static + def handleTravelSelection(Player player, Map parameters) { + def selection = SuiListBox.getSelectedRow(parameters) + + switch (selection) { + + // Planet: Corellia + case 0: handleCorStronghold(player); break + case 1: handleCorCorsecBase(player); break + case 2: handleCorRebelXwingBase(player); break + // Planet: Dantooine + case 3: handleDanCrystalCave(player); break + case 4: handleDanJediTemple(player); break + case 5: handleDanWarren(player); break + // Planet: Dathomir + case 6: handleDatImperialPrison(player); break + case 7: handleDatNS(player); break + case 8: handleDatNSvsSMC(player); break + case 9: handleDatQz(player); break + // Planet: Endor + case 10: handleEndDwb(player); break + case 11: handleEndJindaCave(player); break + // Planet: Kashyyyk + case 12: handleKasEtyyy(player); break + case 13: handleKasKachirho(player); break + case 14: handleKasKkowir(player); break + // Planet: Lok + case 15: handleLokDroidCave(player); break + case 16: handleLokGreatMaze(player); break + case 17: handleLokImperialOutpost(player); break + case 18: handleLokKimogilaTown(player); break + // Planet: Naboo + case 19: handleNabEmperorsRetreat(player); break + case 20: handleNabWeaponFac(player); break + // Planet: Rori + case 21: handleRorHyperdriveFacility(player); break + // Planet: Talus + case 22: handleTalDetainmentCenter(player); break + // Planet: Tatooine + case 23: handleTatFortTusken(player); break + case 24: handleTatImperialOasis(player); break + case 25: handleTatKraytGrave(player); break + case 26: handleTatMosEisley(player); break + case 27: handleTatMosTaike(player); break + case 28: handleTatSquillCave(player); break + // Planet: Yavin 4 + case 29: handleYavBlueleafTemple(player); break + case 30: handleYavDarkEnclave(player); break + case 31: handleYavExarKun(player); break + case 32: handleYavGeoCave(player); break + case 33: handleYavLightEnclave(player); break + + } } -} // Planet: Corellia - -static def handleCorStronghold(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(4735d, 26d, -5676d, Terrain.CORELLIA)).broadcast() -} - -static def handleCorCorsecBase(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(5137d, 16d, 1518d, Terrain.CORELLIA)).broadcast() -} - -static def handleCorRebelXwingBase(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(213d, 50d, 4533d, Terrain.CORELLIA)).broadcast() -} + + static def handleCorStronghold(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(4735d, 26d, -5676d, Terrain.CORELLIA)).broadcast() + } + + static def handleCorCorsecBase(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(5137d, 16d, 1518d, Terrain.CORELLIA)).broadcast() + } + + static def handleCorRebelXwingBase(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(213d, 50d, 4533d, Terrain.CORELLIA)).broadcast() + } // Planet: Dantooine - -static def handleDanJediTemple(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(4078d, 10d, 5370d, Terrain.DANTOOINE)).broadcast() -} - -static def handleDanCrystalCave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6225d, 48d, 7381d, Terrain.DANTOOINE)).broadcast() -} - -static def handleDanWarren(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-564d, 1d, -3789d, Terrain.DANTOOINE)).broadcast() -} + + static def handleDanJediTemple(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(4078d, 10d, 5370d, Terrain.DANTOOINE)).broadcast() + } + + static def handleDanCrystalCave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6225d, 48d, 7381d, Terrain.DANTOOINE)).broadcast() + } + + static def handleDanWarren(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-564d, 1d, -3789d, Terrain.DANTOOINE)).broadcast() + } // Planet: Dathomir - -static def handleDatImperialPrison(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6079d, 132d, 971d, Terrain.DATHOMIR)).broadcast() -} - -static def handleDatNS(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-3989d, 124d, -10d, Terrain.DATHOMIR)).broadcast() -} - -static def handleDatNSvsSMC(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-2457d, 117d, 1530d, Terrain.DATHOMIR)).broadcast() -} - -static def handleDatQz(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-5786d, 510d, -6554d, Terrain.DATHOMIR)).broadcast() -} + + static def handleDatImperialPrison(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6079d, 132d, 971d, Terrain.DATHOMIR)).broadcast() + } + + static def handleDatNS(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-3989d, 124d, -10d, Terrain.DATHOMIR)).broadcast() + } + + static def handleDatNSvsSMC(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-2457d, 117d, 1530d, Terrain.DATHOMIR)).broadcast() + } + + static def handleDatQz(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-5786d, 510d, -6554d, Terrain.DATHOMIR)).broadcast() + } // Planet: Endor - -static def handleEndJindaCave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-1714d, 31d, -8d, Terrain.ENDOR)).broadcast() -} - -static def handleEndDwb(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-4683d, 13d, 4326d, Terrain.ENDOR)).broadcast() -} + + static def handleEndJindaCave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-1714d, 31d, -8d, Terrain.ENDOR)).broadcast() + } + + static def handleEndDwb(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-4683d, 13d, 4326d, Terrain.ENDOR)).broadcast() + } // Planet: Kashyyyk - -static def handleKasEtyyy(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(275d, 48d, 503d, Terrain.KASHYYYK_HUNTING)).broadcast() -} - -static def handleKasKachirho(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(146d, 19d, 162d, Terrain.KASHYYYK_MAIN)).broadcast() -} - - -static def handleKasKkowir(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-164d, 16d, -262d, Terrain.KASHYYYK_DEAD_FOREST)).broadcast() -} + + static def handleKasEtyyy(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(275d, 48d, 503d, Terrain.KASHYYYK_HUNTING)).broadcast() + } + + static def handleKasKachirho(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(146d, 19d, 162d, Terrain.KASHYYYK_MAIN)).broadcast() + } + + + static def handleKasKkowir(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-164d, 16d, -262d, Terrain.KASHYYYK_DEAD_FOREST)).broadcast() + } // Planet: Lok - -static def handleLokDroidCave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(3331d, 105d, -4912d, Terrain.LOK)).broadcast() -} - -static def handleLokGreatMaze(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(3848d, 62d, -464d, Terrain.LOK)).broadcast() -} - -static def handleLokImperialOutpost(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-1914d, 11d, -3299d, Terrain.LOK)).broadcast() -} - -static def handleLokKimogilaTown(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-70d, 42d, 2769d, Terrain.LOK)).broadcast() -} + + static def handleLokDroidCave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(3331d, 105d, -4912d, Terrain.LOK)).broadcast() + } + + static def handleLokGreatMaze(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(3848d, 62d, -464d, Terrain.LOK)).broadcast() + } + + static def handleLokImperialOutpost(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-1914d, 11d, -3299d, Terrain.LOK)).broadcast() + } + + static def handleLokKimogilaTown(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-70d, 42d, 2769d, Terrain.LOK)).broadcast() + } // Planet: Naboo - -static def handleNabEmperorsRetreat(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(2535d, 295d, -3887d, Terrain.NABOO)).broadcast() -} - -static def handleNabWeaponFac(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6439d, 41d, -3265d, Terrain.NABOO)).broadcast() -} + + static def handleNabEmperorsRetreat(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(2535d, 295d, -3887d, Terrain.NABOO)).broadcast() + } + + static def handleNabWeaponFac(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6439d, 41d, -3265d, Terrain.NABOO)).broadcast() + } // Planet: Rori - -static def handleRorHyperdriveFacility(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-1211d, 98d, 4552d, Terrain.RORI)).broadcast() -} + + static def handleRorHyperdriveFacility(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-1211d, 98d, 4552d, Terrain.RORI)).broadcast() + } // Planet: Talus - -static def handleTalDetainmentCenter(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(4958d, 449d, -5983d, Terrain.TALUS)).broadcast() -} + + static def handleTalDetainmentCenter(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(4958d, 449d, -5983d, Terrain.TALUS)).broadcast() + } // Planet: Tatooine - -static def handleTatFortTusken(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-3941d, 59d, 6318d, Terrain.TATOOINE)).broadcast() -} - -static def handleTatKraytGrave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(7380d, 122d, 4298d, Terrain.TATOOINE)).broadcast() -} - -static def handleTatMosEisley(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(3525d, 4d, -4807d, Terrain.TATOOINE)).broadcast() -} - -static def handleTatMosTaike(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(3684d, 7d, 2357d, Terrain.TATOOINE)).broadcast() -} - -static def handleTatSquillCave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(57d, 152d, -79d, Terrain.TATOOINE)).broadcast() -} - -static def handleTatImperialOasis(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-5458d, 10d, 2601d, Terrain.TATOOINE)).broadcast() -} + + static def handleTatFortTusken(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-3941d, 59d, 6318d, Terrain.TATOOINE)).broadcast() + } + + static def handleTatKraytGrave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(7380d, 122d, 4298d, Terrain.TATOOINE)).broadcast() + } + + static def handleTatMosEisley(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(3525d, 4d, -4807d, Terrain.TATOOINE)).broadcast() + } + + static def handleTatMosTaike(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(3684d, 7d, 2357d, Terrain.TATOOINE)).broadcast() + } + + static def handleTatSquillCave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(57d, 152d, -79d, Terrain.TATOOINE)).broadcast() + } + + static def handleTatImperialOasis(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-5458d, 10d, 2601d, Terrain.TATOOINE)).broadcast() + } // Planet: Yavin 4 - -static def handleYavBlueleafTemple(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-947d, 86d, -2131d, Terrain.YAVIN4)).broadcast() -} - -static def handleYavExarKun(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(4928d, 103d, 5587d, Terrain.YAVIN4)).broadcast() -} - -static def handleYavDarkEnclave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(5107d, 81d, 301d, Terrain.YAVIN4)).broadcast() -} - -static def handleYavLightEnclave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-5575d, 87d, 4902d, Terrain.YAVIN4)).broadcast() -} - -static def handleYavGeoCave(Player player) { - new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6485d, 83d, -446d, Terrain.YAVIN4)).broadcast() + + static def handleYavBlueleafTemple(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-947d, 86d, -2131d, Terrain.YAVIN4)).broadcast() + } + + static def handleYavExarKun(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(4928d, 103d, 5587d, Terrain.YAVIN4)).broadcast() + } + + static def handleYavDarkEnclave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(5107d, 81d, 301d, Terrain.YAVIN4)).broadcast() + } + + static def handleYavLightEnclave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-5575d, 87d, 4902d, Terrain.YAVIN4)).broadcast() + } + + static def handleYavGeoCave(Player player) { + new ObjectTeleportIntent(player.getCreatureObject(), new Location(-6485d, 83d, -446d, Terrain.YAVIN4)).broadcast() + } } diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalRadial.groovy deleted file mode 100644 index 8c09a3b3e..000000000 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalRadial.groovy +++ /dev/null @@ -1,79 +0,0 @@ -/*********************************************************************************** - * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * --------------------------------------------------------------------------------* - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - ***********************************************************************************/ - -package com.projectswg.holocore.scripts.radial.terminal - -import com.projectswg.common.data.radial.RadialItem -import com.projectswg.common.data.radial.RadialOption -import com.projectswg.holocore.resources.objects.SWGObject -import com.projectswg.holocore.resources.player.Player - -static def getOptions(String type, List options, Player player, SWGObject target) { - switch (type) { - case "bank": - TerminalBankRadial.getOptions(options, player, target) - break - case "bazaar": - TerminalBazaarRadial.getOptions(options, player, target) - break - case "character_builder": - TerminalCharacterBuilderRadial.getOptions(options, player, target) - break - case "ticket": - TerminalTicketRadial.getOptions(options, player, target) - break - case "ticket_collector": - TerminalTicketCollectorRadial.getOptions(options, player, target) - break - case "travel": - TerminalTravelRadial.getOptions(options, player, target) - break - } -} - -static def handleSelection(String type, Player player, SWGObject target, RadialItem selection) { - switch (type) { - case "bank": - TerminalBankRadial.handleSelection(player, target, selection) - break - case "bazaar": - TerminalBazaarRadial.handleSelection(player, target, selection) - break - case "character_builder": - TerminalCharacterBuilderRadial.handleSelection(player, target, selection) - break - case "ticket": - TerminalTicketRadial.handleSelection(player, target, selection) - break - case "ticket_collector": - TerminalTicketCollectorRadial.handleSelection(player, target, selection) - break - case "travel": - TerminalTravelRadial.handleSelection(player, target, selection) - break - } -} diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketCollectorRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketCollectorRadial.groovy index a981d6dc6..277c8222f 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketCollectorRadial.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketCollectorRadial.groovy @@ -32,16 +32,21 @@ import com.projectswg.common.data.radial.RadialOption import com.projectswg.holocore.intents.travel.TicketUseIntent import com.projectswg.holocore.resources.objects.SWGObject import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface -static def getOptions(List options, Player player, SWGObject target) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.add(new RadialOption(RadialItem.EXAMINE)) -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection) { - switch (selection) { - case RadialItem.ITEM_USE: - new TicketUseIntent(player).broadcast() - break +class TerminalTicketCollectorRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.ITEM_USE)) + options.add(new RadialOption(RadialItem.EXAMINE)) } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + switch (selection) { + case RadialItem.ITEM_USE: + new TicketUseIntent(player).broadcast() + break + } + } + } diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketRadial.groovy index 392bf7fc2..8dac2b114 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketRadial.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTicketRadial.groovy @@ -32,16 +32,21 @@ import com.projectswg.common.data.radial.RadialOption import com.projectswg.holocore.intents.travel.TicketUseIntent import com.projectswg.holocore.resources.objects.SWGObject import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface -static def getOptions(List options, Player player, SWGObject target) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.add(new RadialOption(RadialItem.EXAMINE)) -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection) { - switch (selection) { - case RadialItem.ITEM_USE: - new TicketUseIntent(player, target).broadcast() - break +class TerminalTicketRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.ITEM_USE)) + options.add(new RadialOption(RadialItem.EXAMINE)) } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + switch (selection) { + case RadialItem.ITEM_USE: + new TicketUseIntent(player, target).broadcast() + break + } + } + } diff --git a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTravelRadial.groovy b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTravelRadial.groovy index a0daabcd1..ffcf3cc72 100644 --- a/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTravelRadial.groovy +++ b/src/main/groovy/com/projectswg/holocore/scripts/radial/terminal/TerminalTravelRadial.groovy @@ -32,16 +32,21 @@ import com.projectswg.common.data.radial.RadialOption import com.projectswg.holocore.intents.travel.TravelPointSelectionIntent import com.projectswg.holocore.resources.objects.SWGObject import com.projectswg.holocore.resources.player.Player +import com.projectswg.holocore.scripts.radial.RadialHandlerInterface -static def getOptions(List options, Player player, SWGObject target) { - options.add(new RadialOption(RadialItem.ITEM_USE)) - options.add(new RadialOption(RadialItem.EXAMINE)) -} - -static def handleSelection(Player player, SWGObject target, RadialItem selection) { - switch (selection) { - case RadialItem.ITEM_USE: - new TravelPointSelectionIntent(player.getCreatureObject(), false).broadcast() - break +class TerminalTravelRadial implements RadialHandlerInterface { + + def getOptions(List options, Player player, SWGObject target) { + options.add(new RadialOption(RadialItem.ITEM_USE)) + options.add(new RadialOption(RadialItem.EXAMINE)) } + + def handleSelection(Player player, SWGObject target, RadialItem selection) { + switch (selection) { + case RadialItem.ITEM_USE: + new TravelPointSelectionIntent(player.getCreatureObject(), false).broadcast() + break + } + } + } diff --git a/src/main/java/com/projectswg/holocore/intents/radial/RadialSelectionIntent.java b/src/main/java/com/projectswg/holocore/intents/combat/loot/LootRequestIntent.java similarity index 80% rename from src/main/java/com/projectswg/holocore/intents/radial/RadialSelectionIntent.java rename to src/main/java/com/projectswg/holocore/intents/combat/loot/LootRequestIntent.java index a507a2dd4..07c52f3e5 100644 --- a/src/main/java/com/projectswg/holocore/intents/radial/RadialSelectionIntent.java +++ b/src/main/java/com/projectswg/holocore/intents/combat/loot/LootRequestIntent.java @@ -24,36 +24,23 @@ * You should have received a copy of the GNU Affero General Public License * * along with Holocore. If not, see . * ***********************************************************************************/ -package com.projectswg.holocore.intents.radial; + +package com.projectswg.holocore.intents.combat.loot; import com.projectswg.common.control.Intent; -import com.projectswg.common.data.radial.RadialItem; - import com.projectswg.holocore.resources.objects.SWGObject; import com.projectswg.holocore.resources.player.Player; -public class RadialSelectionIntent extends Intent { +public class LootRequestIntent extends Intent { - private Player player; - private SWGObject target; - private RadialItem selection; + private final Player player; + private final SWGObject target; + private final LootType type; - public RadialSelectionIntent(Player player, SWGObject target, RadialItem selection) { - setPlayer(player); - setTarget(target); - setSelection(selection); - } - - public void setPlayer(Player player) { + public LootRequestIntent(Player player, SWGObject target, LootType type) { this.player = player; - } - - public void setTarget(SWGObject target) { this.target = target; - } - - public void setSelection(RadialItem selection) { - this.selection = selection; + this.type = type; } public Player getPlayer() { @@ -64,8 +51,18 @@ public class RadialSelectionIntent extends Intent { return target; } - public RadialItem getSelection() { - return selection; + public LootType getType() { + return type; + } + + public static void broadcast(Player player, SWGObject target, LootType type) { + new LootRequestIntent(player, target, type).broadcast(); + } + + public enum LootType { + LOOT, + LOOT_ALL, + CREDITS } } diff --git a/src/main/java/com/projectswg/holocore/intents/object/DestroyObjectIntent.java b/src/main/java/com/projectswg/holocore/intents/object/DestroyObjectIntent.java index 96199498a..3ab60dc6c 100644 --- a/src/main/java/com/projectswg/holocore/intents/object/DestroyObjectIntent.java +++ b/src/main/java/com/projectswg/holocore/intents/object/DestroyObjectIntent.java @@ -42,4 +42,8 @@ public class DestroyObjectIntent extends Intent { return obj; } + public static void broadcast(SWGObject obj) { + new DestroyObjectIntent(obj).broadcast(); + } + } diff --git a/src/main/java/com/projectswg/holocore/intents/radial/RadialRequestIntent.java b/src/main/java/com/projectswg/holocore/intents/player/uniform/OpenUniformBoxIntent.java similarity index 74% rename from src/main/java/com/projectswg/holocore/intents/radial/RadialRequestIntent.java rename to src/main/java/com/projectswg/holocore/intents/player/uniform/OpenUniformBoxIntent.java index da410b2c3..6684dd4b6 100644 --- a/src/main/java/com/projectswg/holocore/intents/radial/RadialRequestIntent.java +++ b/src/main/java/com/projectswg/holocore/intents/player/uniform/OpenUniformBoxIntent.java @@ -24,48 +24,25 @@ * You should have received a copy of the GNU Affero General Public License * * along with Holocore. If not, see . * ***********************************************************************************/ -package com.projectswg.holocore.intents.radial; + +package com.projectswg.holocore.intents.player.uniform; import com.projectswg.common.control.Intent; -import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectMenuRequest; - -import com.projectswg.holocore.resources.objects.SWGObject; import com.projectswg.holocore.resources.player.Player; -public class RadialRequestIntent extends Intent { +public class OpenUniformBoxIntent extends Intent { - private Player player; - private SWGObject target; - private ObjectMenuRequest request; + private final Player player; - public RadialRequestIntent(Player player, SWGObject target, ObjectMenuRequest request) { - setPlayer(player); - setTarget(target); - setRequest(request); - } - - public void setPlayer(Player player) { + public OpenUniformBoxIntent(Player player) { this.player = player; } - public void setTarget(SWGObject target) { - this.target = target; - } - - public void setRequest(ObjectMenuRequest request) { - this.request = request; - } - public Player getPlayer() { return player; } - public SWGObject getTarget() { - return target; + public static void broadcast(Player player) { + new OpenUniformBoxIntent(player).broadcast(); } - - public ObjectMenuRequest getRequest() { - return request; - } - } diff --git a/src/main/java/com/projectswg/holocore/intents/radial/RadialResponseIntent.java b/src/main/java/com/projectswg/holocore/intents/radial/RadialResponseIntent.java deleted file mode 100644 index 471a95aba..000000000 --- a/src/main/java/com/projectswg/holocore/intents/radial/RadialResponseIntent.java +++ /dev/null @@ -1,83 +0,0 @@ -/*********************************************************************************** - * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * --------------------------------------------------------------------------------* - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - ***********************************************************************************/ -package com.projectswg.holocore.intents.radial; - -import java.util.List; - -import com.projectswg.common.control.Intent; -import com.projectswg.common.data.radial.RadialOption; - -import com.projectswg.holocore.resources.objects.SWGObject; -import com.projectswg.holocore.resources.player.Player; - -public class RadialResponseIntent extends Intent { - - private Player player; - private SWGObject target; - private List options; - private int counter; - - public RadialResponseIntent(Player player, SWGObject target, List options, int counter) { - setPlayer(player); - setTarget(target); - setOptions(options); - setCounter(counter); - } - - public void setPlayer(Player player) { - this.player = player; - } - - public void setTarget(SWGObject target) { - this.target = target; - } - - public void setOptions(List options) { - this.options = options; - } - - public void setCounter(int counter) { - this.counter = counter; - } - - public Player getPlayer() { - return player; - } - - public SWGObject getTarget() { - return target; - } - - public List getOptions() { - return options; - } - - public int getCounter() { - return counter; - } - -} diff --git a/src/main/java/com/projectswg/holocore/resources/collections/SWGList.java b/src/main/java/com/projectswg/holocore/resources/collections/SWGList.java index ae5dc50b5..1e9dc3419 100644 --- a/src/main/java/com/projectswg/holocore/resources/collections/SWGList.java +++ b/src/main/java/com/projectswg/holocore/resources/collections/SWGList.java @@ -26,25 +26,24 @@ ***********************************************************************************/ package com.projectswg.holocore.resources.collections; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.AbstractList; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicInteger; - import com.projectswg.common.concurrency.SynchronizedList; -import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; import com.projectswg.common.encoding.Encodable; import com.projectswg.common.encoding.Encoder; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; - import com.projectswg.holocore.resources.objects.SWGObject; +import java.lang.reflect.InvocationTargetException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.AbstractList; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicInteger; + /** * Supports a list of elements which automatically sends data as a delta when changed for baselines. * @@ -70,8 +69,6 @@ public class SWGList extends CopyOnWriteArrayList implements Encodable { * that this is an extension of {@link AbstractList} and makes use of * {@link java.util.ArrayList} * - * @param baseline {@link BaselineType} for this list, should be the same as the parent class - * this list resides in * @param view The baseline number this list resides in * @param updateType The update variable used for sending a delta, it's the operand count that * this list resides at within the baseline @@ -84,9 +81,8 @@ public class SWGList extends CopyOnWriteArrayList implements Encodable { * Creates a new {@link SWGList} with the given StringType to encode in. Note that this * constructor must be used if the elements within the list is a String. * - * @param baseline {@link BaselineType} for this list, should be the same as the parent class - * this list resides in * @param view The baseline number this list resides in + * @param updateType The update number for this variable * @param strType The {@link StringType} of the string, required only if the element in the list * is a String as it's used for encoding either Unicode or ASCII characters */ @@ -217,12 +213,12 @@ public class SWGList extends CopyOnWriteArrayList implements Encodable { private boolean decodeElement(NetBuffer wrap, Class elementType, boolean encodable) { if (encodable) { try { - E instance = elementType.newInstance(); + E instance = elementType.getConstructor().newInstance(); if (instance instanceof Encodable) { ((Encodable) instance).decode(wrap); add(instance); } - } catch (InstantiationException | IllegalAccessException e) { + } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { Log.e(e); return false; } @@ -299,7 +295,7 @@ public class SWGList extends CopyOnWriteArrayList implements Encodable { private void addObjectData(int index, E obj, byte update) { byte[] encodedData = Encoder.encode(obj, strType); - Assert.notNull(encodedData); + Objects.requireNonNull(encodedData, "Unable to encode obj"); synchronized (data) { dataSize += encodedData.length; diff --git a/src/main/java/com/projectswg/holocore/resources/collections/SWGSet.java b/src/main/java/com/projectswg/holocore/resources/collections/SWGSet.java index e3e171dfb..646d2f897 100644 --- a/src/main/java/com/projectswg/holocore/resources/collections/SWGSet.java +++ b/src/main/java/com/projectswg/holocore/resources/collections/SWGSet.java @@ -26,16 +26,6 @@ ***********************************************************************************/ package com.projectswg.holocore.resources.collections; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.AbstractSet; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.concurrent.atomic.AtomicInteger; - import com.projectswg.common.concurrency.SynchronizedList; import com.projectswg.common.concurrency.SynchronizedSet; import com.projectswg.common.debug.Log; @@ -43,10 +33,15 @@ import com.projectswg.common.encoding.Encodable; import com.projectswg.common.encoding.Encoder; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.packets.swg.zone.baselines.Baseline; - import com.projectswg.holocore.resources.objects.SWGObject; +import java.lang.reflect.InvocationTargetException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.*; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.atomic.AtomicInteger; + public class SWGSet extends CopyOnWriteArraySet implements Encodable { private static final long serialVersionUID = 1L; @@ -65,8 +60,6 @@ public class SWGSet extends CopyOnWriteArraySet implements Encodable { * Creates a new {@link SWGSet} for the defined baseline with the given view and update. Note * that this is an extension of {@link AbstractSet} and makes use of {@link HashSet} * - * @param baseline {@link Baseline.BaselineType} for this set, should be the same as the parent - * class this list resides in * @param view The baseline number this list resides in * @param updateType The update variable used for sending a delta, it's the operand count that * this list resides at within the baseline @@ -79,9 +72,8 @@ public class SWGSet extends CopyOnWriteArraySet implements Encodable { * Creates a new {@link SWGSet} with the given StringType to encode in. Note that this * constructor must be used if the elements within the list is a String. * - * @param baseline {@link Baseline.BaselineType} for this set, should be the same as the parent - * class this list resides in * @param view The baseline number this set resides in + * @param updateType The update number for this variable * @param strType The {@link StringType} of the string, required only if the element in the set * is a String as it's used for encoding either Unicode or ASCII characters */ @@ -269,12 +261,12 @@ public class SWGSet extends CopyOnWriteArraySet implements Encodable { private boolean decodeElement(NetBuffer wrap, Class elementType, boolean encodable) { if (encodable) { try { - E instance = elementType.newInstance(); + E instance = elementType.getConstructor().newInstance(); if (instance instanceof Encodable) { ((Encodable) instance).decode(wrap); add(instance); } - } catch (InstantiationException | IllegalAccessException e) { + } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { Log.e(e); return false; } diff --git a/src/main/java/com/projectswg/holocore/services/collections/CollectionService.java b/src/main/java/com/projectswg/holocore/services/collections/CollectionService.java index 4f05a57af..1953408d4 100644 --- a/src/main/java/com/projectswg/holocore/services/collections/CollectionService.java +++ b/src/main/java/com/projectswg/holocore/services/collections/CollectionService.java @@ -27,190 +27,56 @@ package com.projectswg.holocore.services.collections; import com.projectswg.common.control.Service; -import com.projectswg.common.data.info.RelationalServerData; -import com.projectswg.common.data.info.RelationalServerFactory; -import com.projectswg.common.data.radial.RadialOption; import com.projectswg.common.debug.Log; -import com.projectswg.holocore.ProjectSWG; -import com.projectswg.holocore.intents.GrantClickyCollectionIntent; -import com.projectswg.holocore.intents.radial.RadialRequestIntent; -import com.projectswg.holocore.intents.radial.RadialResponseIntent; -import com.projectswg.holocore.intents.radial.RadialSelectionIntent; import com.projectswg.holocore.resources.objects.collections.ClickyCollectionItem; import com.projectswg.holocore.resources.objects.collections.CollectionItem; +import com.projectswg.holocore.resources.server_info.SdbLoader; +import com.projectswg.holocore.resources.server_info.SdbLoader.SdbResultSet; +import com.projectswg.holocore.resources.server_info.StandardLog; +import com.projectswg.holocore.scripts.radial.RadialHandler; import com.projectswg.holocore.scripts.radial.collection.WorldItemRadial; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; +import java.io.File; +import java.io.IOException; public class CollectionService extends Service { - - private static final String GET_CLICKY_COLLECTION_ITEMS_SQL = "SELECT iff_template FROM collection_clicky"; - private static final String GET_CONSUME_COLLECTION_ITEMS_SQL = "SELECT item_name, iff_template FROM collection"; - private static final String GET_CLICKY_DETAILS_SQL = "SELECT * FROM collection_clicky WHERE iff_template=?"; - private static final String GET_CONSUME_DETAILS_SQL = "SELECT * FROM collection WHERE iff_template=?"; - - private RelationalServerData clickyDatabase; - private RelationalServerData consumeDatabase; - private final PreparedStatement getClickyCollectionItemsStatement; - private final PreparedStatement getConsumeCollectionItemsStatement; - private final List clickyCollectionItems = new ArrayList<>(); - private final List consumeCollectionItems = new ArrayList<>(); - + public CollectionService() { - clickyDatabase = RelationalServerFactory.getServerData("collections/collection_clicky.db", "collection_clicky"); - consumeDatabase = RelationalServerFactory.getServerData("items/collection.db", "collection"); - if (clickyDatabase == null) - throw new ProjectSWG.CoreException("Database collection_clicky failed to load"); - if (consumeDatabase == null) - throw new ProjectSWG.CoreException("Database collection failed to load"); - - getClickyCollectionItemsStatement = clickyDatabase.prepareStatement(GET_CLICKY_DETAILS_SQL); - getConsumeCollectionItemsStatement = consumeDatabase.prepareStatement(GET_CONSUME_DETAILS_SQL); - - registerClickyCollectionItems(); - registerConsumeCollectionItems(); - - registerForIntent(RadialRequestIntent.class, this::handleRadialRequestIntent); - registerForIntent(RadialSelectionIntent.class, this::handleRadialSelectionIntent); - } - - private void handleRadialRequestIntent(RadialRequestIntent rri){ - String iff = rri.getTarget().getTemplate(); - String itemName = rri.getTarget().getStringId().getKey(); - - if (isClickyCollectionItem(iff) || isConsumeCollectionItem(itemName, iff)) { - List options = new ArrayList<>(rri.getRequest().getOptions()); - WorldItemRadial.getOptions(options, rri.getPlayer(), rri.getTarget()); - new RadialResponseIntent(rri.getPlayer(), rri.getTarget(), options, rri.getRequest().getCounter()).broadcast(); - } - } - - private void handleRadialSelectionIntent(RadialSelectionIntent rsi){ - String iff = rsi.getTarget().getTemplate(); - String itemName = rsi.getTarget().getStringId().getKey(); - boolean isClicky = isClickyCollectionItem(iff); - - if (isClicky || isConsumeCollectionItem(itemName, iff)) { - new GrantClickyCollectionIntent(rsi.getPlayer().getCreatureObject(), rsi.getTarget(), getCollectionDetails(iff, isClicky)).broadcast(); - } - } - - private void registerClickyCollectionItems() { - try (ResultSet set = clickyDatabase.executeQuery(GET_CLICKY_COLLECTION_ITEMS_SQL)) { - while (set.next()) { - String iff = set.getString("iff_template"); - if (!clickyCollectionItems.contains(iff)) { - clickyCollectionItems.add(iff); - } - } - } catch (SQLException ex) { - Log.e(ex); - } - - //clickyDatabase.close(); - } - - private void registerConsumeCollectionItems() { - try (ResultSet set = consumeDatabase.executeQuery(GET_CONSUME_COLLECTION_ITEMS_SQL)) { - while (set.next()) { - ConsumeCollection collection = new ConsumeCollection(set.getString("item_name"), set.getString("iff_template")); - if (!consumeCollectionItems.contains(collection)) { - consumeCollectionItems.add(collection); - } - } - } catch (SQLException ex) { - Log.e(ex); - } - - //consumeDatabase.close(); - } - - private CollectionItem getCollectionDetails(String iff, boolean isClicky) { - if (isClicky) - return getClickyCollectionDetails(iff); - else - return getCollectionDetails(iff); - } - - private CollectionItem getCollectionDetails(String iff) { - String cleanedIff = cleanIff(iff); - CollectionItem collection = null; - - try { - synchronized (getConsumeCollectionItemsStatement) { - getConsumeCollectionItemsStatement.setString(1, cleanedIff); - ResultSet set = getConsumeCollectionItemsStatement.executeQuery(); - - while (set.next()) { - collection = new CollectionItem(set.getString("collection_slot_name"), set.getString("collection_name"), set.getString("iff_template")); - } - } - } catch (SQLException e) { - Log.e(e); - } - - return collection; - } - - private ClickyCollectionItem getClickyCollectionDetails(String iff) { - String cleanedIff = cleanIff(iff); - ClickyCollectionItem collection = null; - try { - ResultSet set; - synchronized (getClickyCollectionItemsStatement) { - getClickyCollectionItemsStatement.setString(1, cleanedIff); - set = getClickyCollectionItemsStatement.executeQuery(); - } - + } + + @Override + public boolean initialize() { + int count = 0; + long startTime = StandardLog.onStartLoad("collections"); + try (SdbResultSet set = SdbLoader.load(new File("serverdata/items/collection.sdb"))) { while (set.next()) { - collection = new ClickyCollectionItem(set.getString("slotName"), set.getString("collectionName"), set.getInt("object_id"), set.getString("iff_template"), set.getString("terrain"), set.getDouble("x"), set.getDouble("y")); + String iff = set.getText("iff_template"); + String slotName = set.getText("collection_slot_name"); + String collectionName = set.getText("collection_name"); + RadialHandler.registerHandler(iff, new WorldItemRadial(new CollectionItem(slotName, collectionName, iff))); + count++; } - - } catch (SQLException e) { + } catch (IOException e) { Log.e(e); } - - return collection; - } - - private boolean isClickyCollectionItem(String iff) { - return clickyCollectionItems.contains(cleanIff(iff)); - } - - private boolean isConsumeCollectionItem(String itemName, String iffTemplate) { - ConsumeCollection collection = new ConsumeCollection(itemName, iffTemplate); - return isConsumeCollectionItem(collection); - } - - private boolean isConsumeCollectionItem(ConsumeCollection collection) { - return consumeCollectionItems.contains(collection); - } - - private static String cleanIff(String iff) { - return iff.replace("shared_", ""); - } - - private class ConsumeCollection { - private String itemName; - private String iffTemplate; - - public ConsumeCollection(String itemName, String iffTemplate) { - this.itemName = itemName; - this.iffTemplate = iffTemplate; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ConsumeCollection)) - return false; - String myTemplate = cleanIff(iffTemplate); - String oTemplate = cleanIff(((ConsumeCollection) o).iffTemplate); - return itemName.equals(((ConsumeCollection) o).itemName) && myTemplate.equals(oTemplate); + try (SdbResultSet set = SdbLoader.load(new File("serverdata/collections/collection_clicky.sdb"))) { + while (set.next()) { + String iff = set.getText("iff_template"); + String slotName = set.getText("slotName"); + String collectionName = set.getText("collectionName"); + int objectId = (int) set.getInt("object_id"); + String terrain = set.getText("terrain"); + double x = set.getReal("x"); + double y = set.getReal("y"); + RadialHandler.registerHandler(iff, new WorldItemRadial(new ClickyCollectionItem(slotName, collectionName, objectId, iff, terrain, x, y))); + count++; + } + } catch (IOException e) { + Log.e(e); } + StandardLog.onEndLoad(count, "collections", startTime); + return super.initialize(); } + } diff --git a/src/main/java/com/projectswg/holocore/services/combat/LootService.java b/src/main/java/com/projectswg/holocore/services/combat/LootService.java index 20890018e..923650303 100644 --- a/src/main/java/com/projectswg/holocore/services/combat/LootService.java +++ b/src/main/java/com/projectswg/holocore/services/combat/LootService.java @@ -56,12 +56,11 @@ import com.projectswg.holocore.intents.chat.SystemMessageIntent; import com.projectswg.holocore.intents.combat.CorpseLootedIntent; import com.projectswg.holocore.intents.combat.CreatureKilledIntent; import com.projectswg.holocore.intents.combat.LootItemIntent; +import com.projectswg.holocore.intents.combat.loot.LootRequestIntent; import com.projectswg.holocore.intents.object.ContainerTransferIntent; import com.projectswg.holocore.intents.object.CreateStaticItemIntent; +import com.projectswg.holocore.intents.object.DestroyObjectIntent; import com.projectswg.holocore.intents.object.ObjectCreatedIntent; -import com.projectswg.holocore.intents.radial.RadialRequestIntent; -import com.projectswg.holocore.intents.radial.RadialResponseIntent; -import com.projectswg.holocore.intents.radial.RadialSelectionIntent; import com.projectswg.holocore.resources.config.ConfigFile; import com.projectswg.holocore.resources.containers.ContainerPermissionsType; import com.projectswg.holocore.resources.objects.SWGObject; @@ -98,8 +97,7 @@ public final class LootService extends Service { registerForIntent(ChatCommandIntent.class, this::handleChatCommand); registerForIntent(ContainerTransferIntent.class, this::handleContainerTransfer); registerForIntent(CreatureKilledIntent.class, this::handleCreatureKilled); - registerForIntent(RadialSelectionIntent.class, this::handleRadialSelection); - registerForIntent(RadialRequestIntent.class, this::handleRadialRequestIntent); + registerForIntent(LootRequestIntent.class, this::handleLootRequestIntent); registerForIntent(LootItemIntent.class, this::handleLootItemIntent); } @@ -289,77 +287,28 @@ public final class LootService extends Service { lootAll(cci.getSource(), cci.getTarget()); } - - private void handleRadialSelection(RadialSelectionIntent rsi) { - Player player = rsi.getPlayer(); - CreatureObject looter = player.getCreatureObject(); - SWGObject object = rsi.getTarget(); - - switch (rsi.getSelection()) { - case LOOT: { - if (!getLootPermission(looter, object)) - return; - - lootBox(player, object); - break; - } - case LOOT_ALL: { - if (!getLootPermission(looter, object)) - return; - - lootAll(looter, object); - break; - } - case TRANSFER_CREDITS_TO_BANK_ACCOUNT: { - SWGObject container = object.getParent(); - SWGObject owner = container.getParent(); - - if (!getLootPermission(looter, owner)) - return; - - long cash = ((CreditObject) object).getAmount(); - looter.addToBank(cash); - - new SystemMessageIntent(player, new ProsePackage("StringId", new StringId("base_player", "prose_transfer_success"), "DI", (int) cash)).broadcast(); - - object.moveToContainer(null); - - if (owner instanceof CreatureObject && container.getContainedObjects().isEmpty()) { - CreatureObject corpse = (CreatureObject) owner; - new CorpseLootedIntent(corpse).broadcast(); - player.sendPacket(new StopClientEffectObjectByLabelMessage(corpse.getObjectId(), "lootMe", false)); - } - - break; - } - default: - break; - } - } - private void handleRadialRequestIntent(RadialRequestIntent rri){ - SWGObject target = rri.getTarget(); + private void handleLootRequestIntent(LootRequestIntent lri) { + Player player = lri.getPlayer(); + CreatureObject looter = player.getCreatureObject(); + SWGObject target = lri.getTarget(); - if (target instanceof AIObject) { - CreatureObject creature = (CreatureObject) target; - - if (creature.getHealth() > 0) { - // Live creatures shouldn't get a loot radial - return; - } - - // TODO permissions check - - List options = new ArrayList<>(rri.getRequest().getOptions()); - RadialOption loot = new RadialOption(RadialItem.LOOT); - loot.addChild(RadialItem.LOOT_ALL); - options.add(loot); - new RadialResponseIntent(rri.getPlayer(), target, options, rri.getRequest().getCounter()).broadcast(); - } else if (target instanceof CreditObject) { - List options = new ArrayList<>(rri.getRequest().getOptions()); - RadialOption transfer = new RadialOption(RadialItem.TRANSFER_CREDITS_TO_BANK_ACCOUNT); - options.add(transfer); - new RadialResponseIntent(rri.getPlayer(), target, options, rri.getRequest().getCounter()).broadcast(); + switch (lri.getType()) { + case LOOT: + if (!getLootPermission(looter, target)) + return; + + lootBox(player, target); + break; + case LOOT_ALL: + if (!getLootPermission(looter, target)) + return; + + lootAll(looter, target); + break; + case CREDITS: + lootCredits(player, looter, target); + break; } } @@ -435,6 +384,26 @@ public final class LootService extends Service { loot.forEach(item -> loot((CreatureObject) looter, item, lootInventory)); } + private void lootCredits(Player player, CreatureObject looter, SWGObject target) { + SWGObject container = target.getParent(); + SWGObject owner = container.getParent(); + + if (!getLootPermission(looter, owner)) + return; + + long cash = ((CreditObject) target).getAmount(); + looter.addToBank(cash); + DestroyObjectIntent.broadcast(target); + + new SystemMessageIntent(player, new ProsePackage("StringId", new StringId("base_player", "prose_transfer_success"), "DI", (int) cash)).broadcast(); + + if (owner instanceof CreatureObject && container.getContainedObjects().isEmpty()) { + CreatureObject corpse = (CreatureObject) owner; + new CorpseLootedIntent(corpse).broadcast(); + player.sendPacket(new StopClientEffectObjectByLabelMessage(corpse.getObjectId(), "lootMe", false)); + } + } + private void randomGroupLoot(GroupObject lootGroup, SWGObject corpse) { if (!(corpse instanceof AIObject)) { return; diff --git a/src/main/java/com/projectswg/holocore/services/galaxy/GameManager.java b/src/main/java/com/projectswg/holocore/services/galaxy/GameManager.java index b82f44960..72222d059 100644 --- a/src/main/java/com/projectswg/holocore/services/galaxy/GameManager.java +++ b/src/main/java/com/projectswg/holocore/services/galaxy/GameManager.java @@ -37,7 +37,6 @@ import com.projectswg.holocore.services.commands.EntertainmentService; import com.projectswg.holocore.services.crafting.CraftingManager; import com.projectswg.holocore.services.experience.ExperienceManager; import com.projectswg.holocore.services.faction.FactionService; -import com.projectswg.holocore.services.galaxy.terminals.TerminalService; import com.projectswg.holocore.services.group.GroupService; import com.projectswg.holocore.services.sui.SuiService; @@ -50,7 +49,6 @@ public class GameManager extends Manager { addChildService(new CollectionService()); addChildService(new CollectionBadgeManager()); addChildService(new EnvironmentService()); - addChildService(new TerminalService()); addChildService(new FactionService()); addChildService(new GroupService()); addChildService(new SkillModService()); diff --git a/src/main/java/com/projectswg/holocore/services/galaxy/TerminalService.java b/src/main/java/com/projectswg/holocore/services/galaxy/TerminalService.java new file mode 100644 index 000000000..11e62ffa5 --- /dev/null +++ b/src/main/java/com/projectswg/holocore/services/galaxy/TerminalService.java @@ -0,0 +1,38 @@ +/*********************************************************************************** + * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create an emulator which will provide a server for players to * + * continue playing a game similar to the one they used to play. We are basing * + * it on the final publish of the game prior to end-game events. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ + +package com.projectswg.holocore.services.galaxy; + +import com.projectswg.common.control.Service; + +public class TerminalService extends Service { + + public TerminalService() { + + } + +} diff --git a/src/main/java/com/projectswg/holocore/services/galaxy/terminals/TerminalService.java b/src/main/java/com/projectswg/holocore/services/galaxy/terminals/TerminalService.java deleted file mode 100644 index 5b26ebb07..000000000 --- a/src/main/java/com/projectswg/holocore/services/galaxy/terminals/TerminalService.java +++ /dev/null @@ -1,104 +0,0 @@ -/*********************************************************************************** - * Copyright (c) 2018 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * --------------------------------------------------------------------------------* - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - ***********************************************************************************/ -package com.projectswg.holocore.services.galaxy.terminals; - -import com.projectswg.common.control.Service; -import com.projectswg.common.data.radial.RadialOption; -import com.projectswg.common.debug.Log; -import com.projectswg.holocore.intents.radial.RadialRequestIntent; -import com.projectswg.holocore.intents.radial.RadialResponseIntent; -import com.projectswg.holocore.intents.radial.RadialSelectionIntent; -import com.projectswg.holocore.resources.server_info.SdbLoader; -import com.projectswg.holocore.resources.server_info.SdbLoader.SdbResultSet; -import com.projectswg.holocore.scripts.radial.terminal.TerminalRadial; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class TerminalService extends Service { - - private static final String GET_ALL_TEMPLATES_SQL = "SELECT iff FROM radials"; - private static final String GET_SCRIPT_FOR_IFF_SQL = "SELECT script FROM radials WHERE iff = ?"; - - private final Set templates; - - public TerminalService() { - templates = new HashSet<>(); - - registerForIntent(RadialRequestIntent.class, this::handleRadialRequestIntent); - registerForIntent(RadialSelectionIntent.class, this::handleRadialSelectionIntent); - } - - @Override - public boolean initialize() { - try (SdbResultSet set = SdbLoader.load(new File("serverdata/radial/radials.sdb"))) { - templates.clear(); - while (set.next()) { - templates.add(set.getText("iff")); - } - } catch (IOException e) { - Log.e(e); - } - return super.initialize(); - } - - private void handleRadialRequestIntent(RadialRequestIntent rri){ - String script = lookupScript(rri.getTarget().getTemplate()); - if (script == null) - return; - List options = new ArrayList<>(rri.getRequest().getOptions()); - TerminalRadial.getOptions(script, options, rri.getPlayer(), rri.getTarget()); - new RadialResponseIntent(rri.getPlayer(), rri.getTarget(), options, rri.getRequest().getCounter()).broadcast(); - } - - private void handleRadialSelectionIntent(RadialSelectionIntent rsi){ - String script = lookupScript(rsi.getTarget().getTemplate()); - if (script == null) - return; - TerminalRadial.handleSelection(script, rsi.getPlayer(), rsi.getTarget(), rsi.getSelection()); - } - - private String lookupScript(String iff) { - if (!templates.contains(iff)) - return null; - try (SdbResultSet set = SdbLoader.load(new File("serverdata/radial/radials.sdb"))) { - while (set.next()) { - if (set.getText("iff").equals(iff)) { - return set.getText("script"); - } - } - } catch (IOException e) { - Log.e(e); - } - return null; - } - -} diff --git a/src/main/java/com/projectswg/holocore/services/objects/RadialService.java b/src/main/java/com/projectswg/holocore/services/objects/RadialService.java index e1bacb19e..ac08e415a 100644 --- a/src/main/java/com/projectswg/holocore/services/objects/RadialService.java +++ b/src/main/java/com/projectswg/holocore/services/objects/RadialService.java @@ -26,8 +26,6 @@ ***********************************************************************************/ package com.projectswg.holocore.services.objects; -import java.util.List; - import com.projectswg.common.control.Service; import com.projectswg.common.data.radial.RadialItem; import com.projectswg.common.data.radial.RadialOption; @@ -36,25 +34,29 @@ import com.projectswg.common.network.packets.SWGPacket; import com.projectswg.common.network.packets.swg.zone.ObjectMenuSelect; import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectMenuRequest; import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectMenuResponse; - import com.projectswg.holocore.intents.network.GalacticPacketIntent; -import com.projectswg.holocore.intents.radial.RadialRequestIntent; -import com.projectswg.holocore.intents.radial.RadialResponseIntent; -import com.projectswg.holocore.intents.radial.RadialSelectionIntent; import com.projectswg.holocore.resources.objects.SWGObject; import com.projectswg.holocore.resources.objects.creature.CreatureObject; import com.projectswg.holocore.resources.player.Player; +import com.projectswg.holocore.scripts.radial.RadialHandler; import com.projectswg.holocore.services.galaxy.GalacticManager; +import java.util.ArrayList; +import java.util.List; + public class RadialService extends Service { public RadialService() { - registerForIntent(GalacticPacketIntent.class, RadialService::handleGalacticPacketIntent); - registerForIntent(RadialResponseIntent.class, RadialService::handleRadialResponseIntent); - // RadialRegisterIntent + registerForIntent(GalacticPacketIntent.class, this::handleGalacticPacketIntent); } - - private static void handleGalacticPacketIntent(GalacticPacketIntent gpi){ + + @Override + public boolean initialize() { + RadialHandler.initialize(); + return super.initialize(); + } + + private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { SWGPacket p = gpi.getPacket(); if (p instanceof ObjectMenuRequest) { onRequest(gpi.getObjectManager(), (ObjectMenuRequest) p); @@ -63,7 +65,7 @@ public class RadialService extends Service { } } - private static void onRequest(ObjectManager objectManager, ObjectMenuRequest request) { + private void onRequest(ObjectManager objectManager, ObjectMenuRequest request) { SWGObject requestor = objectManager.getObjectById(request.getRequestorId()); SWGObject target = objectManager.getObjectById(request.getTargetId()); if (target == null) @@ -77,16 +79,13 @@ public class RadialService extends Service { Log.w("Requestor of target: %s does not have an owner! %s", target, requestor); return; } - - new RadialRequestIntent(player, target, request).broadcast(); + + List options = new ArrayList<>(); + RadialHandler.getOptions(options, player, target); + sendResponse(player, target, options, request.getCounter()); } - - private static void handleRadialResponseIntent(RadialResponseIntent rri) { - Player player = rri.getPlayer(); - sendResponse(player, rri.getTarget(), rri.getOptions(), rri.getCounter()); - } - - private static void onSelection(GalacticManager galacticManager, Player player, ObjectMenuSelect select) { + + private void onSelection(GalacticManager galacticManager, Player player, ObjectMenuSelect select) { SWGObject target = galacticManager.getObjectManager().getObjectById(select.getObjectId()); if (target == null) { Log.e("Selection target [%d] does not exist!", select.getObjectId()); @@ -96,14 +95,16 @@ public class RadialService extends Service { Log.e("Selection requestor does not exist! Target: [%d] %s", target.getObjectId(), target.getTemplate()); return; } + RadialItem selection = RadialItem.getFromId(select.getSelection()); if (selection == null) { Log.e("RadialItem does not exist with selection id: %d", select.getSelection()); return; } - new RadialSelectionIntent(player, target, selection).broadcast(); + + RadialHandler.handleSelection(player, target, selection); } - + private static void sendResponse(Player player, SWGObject target, List options, int counter) { ObjectMenuResponse menuResponse = new ObjectMenuResponse(player.getCreatureObject().getObjectId()); menuResponse.setTargetId(target.getObjectId()); @@ -112,5 +113,5 @@ public class RadialService extends Service { menuResponse.setCounter(counter); player.sendPacket(menuResponse); } - + } diff --git a/src/main/java/com/projectswg/holocore/services/objects/UniformBoxService.java b/src/main/java/com/projectswg/holocore/services/objects/UniformBoxService.java index 2ae2d441c..3f8a2ab67 100644 --- a/src/main/java/com/projectswg/holocore/services/objects/UniformBoxService.java +++ b/src/main/java/com/projectswg/holocore/services/objects/UniformBoxService.java @@ -41,7 +41,7 @@ import com.projectswg.common.debug.Log; import com.projectswg.holocore.ProjectSWG; import com.projectswg.holocore.intents.object.CreateStaticItemIntent; import com.projectswg.holocore.intents.object.DestroyObjectIntent; -import com.projectswg.holocore.intents.radial.RadialSelectionIntent; +import com.projectswg.holocore.intents.player.uniform.OpenUniformBoxIntent; import com.projectswg.holocore.resources.containers.ContainerPermissionsType; import com.projectswg.holocore.resources.objects.SWGObject; import com.projectswg.holocore.resources.objects.creature.CreatureObject; @@ -63,7 +63,7 @@ public class UniformBoxService extends Service { getUniformBoxStatement = uniformBoxDatabase.prepareStatement(GET_UNIFORMBOX_SQL); - registerForIntent(RadialSelectionIntent.class, this::handleRadialSelectionIntent); + registerForIntent(OpenUniformBoxIntent.class, this::handleOpenUniformBoxIntent); } @Override @@ -72,20 +72,12 @@ public class UniformBoxService extends Service { return super.terminate(); } - private void handleRadialSelectionIntent(RadialSelectionIntent rsi) { - if (!rsi.getTarget().getTemplate().equals(UNIFORM_BOX_IFF)) - return; - - if(!rsi.getSelection().equals(RadialItem.ITEM_USE)) { - return; - } - - Player player = rsi.getPlayer(); + private void handleOpenUniformBoxIntent(OpenUniformBoxIntent oubi) { + Player player = oubi.getPlayer(); CreatureObject creature = player.getCreatureObject(); SWGObject inventory = creature.getSlottedObject("inventory"); String profession = creature.getPlayerObject().getProfession(); - new DestroyObjectIntent(rsi.getTarget()).broadcast(); handleCreateItems(inventory, profession, creature); } diff --git a/src/main/java/com/projectswg/holocore/services/player/LoginService.java b/src/main/java/com/projectswg/holocore/services/player/LoginService.java index 046b7b46d..8f90779b8 100644 --- a/src/main/java/com/projectswg/holocore/services/player/LoginService.java +++ b/src/main/java/com/projectswg/holocore/services/player/LoginService.java @@ -58,6 +58,7 @@ import com.projectswg.holocore.resources.player.Player.PlayerServer; import com.projectswg.holocore.resources.player.PlayerState; import com.projectswg.holocore.resources.server_info.DataManager; import com.projectswg.holocore.services.CoreManager; +import com.projectswg.holocore.services.objects.ObjectManager.ObjectLookup; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -94,6 +95,30 @@ public class LoginService extends Service { return super.initialize(); } + @Override + public boolean start() { + synchronized (deleteCharacter) { + try (ResultSet set = database.executeQuery("SELECT id FROM players")) { + while (set.next()) { + long id = set.getLong(1); + if (ObjectLookup.getObjectById(id) != null) + continue; + + try { + deleteCharacter.setLong(1, id); + deleteCharacter.executeUpdate(); + Log.d("Deleted character with id: %d", id); + } catch (SQLException e) { + Log.e(e); + } + } + } catch (SQLException e) { + Log.e(e); + } + } + return super.start(); + } + @Override public boolean terminate() { database.close();