diff --git a/scripts/commands/placestructure.py b/scripts/commands/placestructure.py new file mode 100644 index 00000000..edddb24e --- /dev/null +++ b/scripts/commands/placestructure.py @@ -0,0 +1,26 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + cmdArgs = commandString.split(" ") + + deedId = long(cmdArgs[0]) + deed = core.objectService.getObject(deedId) + + positionX = float(cmdArgs[1]) + positionZ = float(cmdArgs[2]) + #positionY = core.terrainService.getHeight(actor.getPlanetId(), positionX, positionZ) + 2 + + rotation = float(cmdArgs[3]) + + + #structureTemplate = deed.getAttachment("structureTemplate") + + core.housingService.placeStructure(actor, deed, positionX, positionZ, rotation) + + #building = core.objectService.createObject(structureTemplate, actor.getPlanet(), positionX, positionZ, positionY); + #core.simulationService.add(building, building.getPosition().x, building.getPosition().z); + + return \ No newline at end of file diff --git a/scripts/expertise/expertise_of_purge_1.py b/scripts/expertise/expertise_of_purge_1.py index 36e8c855..3598d236 100644 --- a/scripts/expertise/expertise_of_purge_1.py +++ b/scripts/expertise/expertise_of_purge_1.py @@ -1,9 +1,9 @@ import sys def addAbilities(core, actor, player): - actor.addAbility("expertise_of_purge_1") + actor.addAbility("of_purge_1") return def removeAbilities(core, actor, player): - actor.removeAbility("expertise_of_purge_1") + actor.removeAbility("of_purge_1") return diff --git a/scripts/houses/player_house_generic_small_style_01.py b/scripts/houses/player_house_generic_small_style_01.py new file mode 100644 index 00000000..3b1f0a4c --- /dev/null +++ b/scripts/houses/player_house_generic_small_style_01.py @@ -0,0 +1,19 @@ +import sys +from services.housing import HouseTemplate +from engine.resources.scene import Point3D + +def setup(core): + houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff", "object/building/player/shared_player_house_generic_small_style_01.iff", 2) + + houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3)) + houseTemplate.addPlaceablePlanet("tatooine") + houseTemplate.addPlaceablePlanet("corellia") + houseTemplate.addPlaceablePlanet("naboo") + houseTemplate.addPlaceablePlanet("talus") + houseTemplate.addPlaceablePlanet("rori") + houseTemplate.addPlaceablePlanet("dantooine") + houseTemplate.addPlaceablePlanet("lok") + houseTemplate.setDefaultItemLimit(200) + + core.housingService.addHousingTemplate(houseTemplate) + return \ No newline at end of file diff --git a/scripts/object/building/player/player_house_generic_small_style_01.py b/scripts/object/building/player/player_house_generic_small_style_01.py index ccad8904..17c11b52 100644 --- a/scripts/object/building/player/player_house_generic_small_style_01.py +++ b/scripts/object/building/player/player_house_generic_small_style_01.py @@ -1,4 +1,9 @@ import sys def setup(core, object): + sign = core.objectService.createChildObject(object, 'object/tangible/sign/player/shared_house_address.iff', -7.39, 2.36, 2, -1, 0, -1) + print(sign) + object.setAttachment("structureSign", sign) + + core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', -5, 0.74, -1.81, 0.707107, -0.707107, 1) return \ No newline at end of file diff --git a/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py b/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py index ccad8904..e100519a 100644 --- a/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py +++ b/scripts/object/tangible/deed/player_house_deed/generic_house_small_deed.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'structureDeed'); + return + +def use(core, actor, object): return \ No newline at end of file diff --git a/scripts/radial/structureDeed.py b/scripts/radial/structureDeed.py new file mode 100644 index 00000000..0ddee9f3 --- /dev/null +++ b/scripts/radial/structureDeed.py @@ -0,0 +1,11 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.housingService.enterStructureMode(owner, target) + return + \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java deleted file mode 100644 index d465c5f1..00000000 --- a/src/main/NGECore.java +++ /dev/null @@ -1,709 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 - * - * This File is part of NGECore2. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. - * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. - ******************************************************************************/ -package main; - -import java.io.IOException; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import org.apache.mina.core.service.IoHandler; -import org.apache.mina.core.session.IoSession; - -import com.sleepycat.je.Transaction; -import com.sleepycat.persist.EntityCursor; - -import protocol.swg.ChatSystemMessage; -import net.engio.mbassy.bus.config.BusConfiguration; -import resources.common.RadialOptions; -import resources.common.ThreadMonitor; -import resources.objects.creature.CreatureObject; -import services.AttributeService; -import services.BuffService; -import services.CharacterService; -import services.ConnectionService; -import services.ConversationService; -import services.DevService; -import services.EntertainmentService; -import services.EquipmentService; -import services.GroupService; -import services.InstanceService; -import services.LoginService; -import services.LootService; -import services.MissionService; -import services.PlayerService; -import services.ScriptService; -import services.SimulationService; -import services.SkillModService; -import services.SkillService; -import services.StaticService; -import services.SurveyService; -import services.TerrainService; -import services.WeatherService; -import services.ai.AIService; -import services.chat.ChatService; -import services.collections.CollectionService; -import services.combat.CombatService; -import services.command.CombatCommand; -import services.command.CommandService; -import services.gcw.FactionService; -import services.gcw.GCWService; -import services.guild.GuildService; -import services.LoginService; -import services.map.MapService; -import services.object.ObjectService; -import services.object.UpdateService; -import services.resources.ResourceService; -import services.retro.RetroService; -import services.spawn.SpawnService; -import services.sui.SUIService; -import services.trade.TradeService; -import services.travel.TravelService; -import engine.clientdata.ClientFileManager; -import engine.clientdata.visitors.CrcStringTableVisitor; -import engine.clientdata.visitors.DatatableVisitor; -import engine.clientdata.visitors.LevelOfDetailVisitor; -import engine.clientdata.visitors.MeshVisitor; -import engine.clientdata.visitors.PortalVisitor; -import engine.clientdata.visitors.TerrainVisitor; -import engine.clientdata.visitors.WorldSnapshotVisitor; -import engine.clientdata.visitors.WorldSnapshotVisitor.SnapshotChunk; -import engine.clients.Client; -import engine.resources.common.CRC; -import engine.resources.common.PHPBB3Auth; -import engine.resources.config.Config; -import engine.resources.config.DefaultConfig; -import engine.resources.container.Traverser; -import engine.resources.database.DatabaseConnection; -import engine.resources.database.ObjectDatabase; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; -import engine.resources.service.InteractiveJythonAcceptor; -import engine.resources.service.NetworkDispatch; -import engine.servers.InteractiveJythonServer; -import engine.servers.MINAServer; -import engine.servers.PingServer; - -@SuppressWarnings("unused") - -public class NGECore { - - public static boolean didServerCrash = false; - - private static NGECore instance; - - private Config config = null; - - private volatile boolean isShuttingDown = false; - private long galacticTime = System.currentTimeMillis(); - - private ConcurrentHashMap clients = new ConcurrentHashMap(); - - // Database - - private DatabaseConnection databaseConnection = null; - private DatabaseConnection databaseConnection2 = null; - - // Services - public LoginService loginService; - public RetroService retroService; - public ConnectionService connectionService; - public CommandService commandService; - public CharacterService characterService; - public FactionService factionService; - public ObjectService objectService; - public MapService mapService; - public UpdateService updateService; - public TerrainService terrainService; - public SimulationService simulationService; - public ScriptService scriptService; - public ChatService chatService; - public AttributeService attributeService; - public SUIService suiService; - public GuildService guildService; - public GCWService gcwService; - public TradeService tradeService; - public CombatService combatService; - public PlayerService playerService; - public BuffService buffService; - public StaticService staticService; - public GroupService groupService; - public SkillService skillService; - public SkillModService skillModService; - public EquipmentService equipmentService; - public TravelService travelService; - public CollectionService collectionService; - public EntertainmentService entertainmentService; - public WeatherService weatherService; - public SpawnService spawnService; - public AIService aiService; - //public MissionService missionService; - public InstanceService instanceService; - public DevService devService; - - public SurveyService surveyService; - public ResourceService resourceService; - - public ConversationService conversationService; - public LootService lootService; - - - // Login Server - public NetworkDispatch loginDispatch; - private MINAServer loginServer; - - // Zone Server - public NetworkDispatch zoneDispatch; - private MINAServer zoneServer; - - // Interactive Jython Console - public InteractiveJythonAcceptor jythonAcceptor; - private InteractiveJythonServer jythonServer; - - private ObjectDatabase creatureODB; - private ObjectDatabase mailODB; - private ObjectDatabase guildODB; - private ObjectDatabase objectIdODB; - private ObjectDatabase duplicateIdODB; - private ObjectDatabase chatRoomODB; - - private BusConfiguration eventBusConfig = BusConfiguration.Default(1, new ThreadPoolExecutor(1, 4, 1, TimeUnit.MINUTES, new LinkedBlockingQueue())); - - private ObjectDatabase buildingODB; - - private ObjectDatabase resourcesODB; - private ObjectDatabase resourceRootsODB; - private ObjectDatabase resourceHistoryODB; - - public static boolean PACKET_DEBUG = false; - - - - - - public NGECore() { - - } - - public void start() { - - instance = this; - final ThreadMonitor deadlockDetector = new ThreadMonitor(); - Thread deadlockMonitor = new Thread(new Runnable() { - @Override - public void run() { - try { - deadlockDetector.findDeadlock(); - Thread.sleep(60000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }); - deadlockMonitor.start(); - config = new Config(); - config.setFilePath("nge.cfg"); - if (!(config.loadConfigFile())) { - config = DefaultConfig.getConfig(); - } - // Database - databaseConnection = new DatabaseConnection(); - databaseConnection.connect(config.getString("DB.URL"), config.getString("DB.NAME"), config.getString("DB.USER"), config.getString("DB.PASS"), "postgresql"); - - String db2Url = config.getString("DB2.URL"); - if (db2Url == null || db2Url.matches("^\\s*$")) { - databaseConnection2 = null; - } else { - databaseConnection2 = new DatabaseConnection(); - databaseConnection2.connect(config.getString("DB2.URL"), config.getString("DB2.NAME"), config.getString("DB2.USER"), config.getString("DB2.PASS"), "mysql"); - } - - setGalaxyStatus(1); - creatureODB = new ObjectDatabase("creature", true, false, true); - buildingODB = new ObjectDatabase("building", true, false, true); - mailODB = new ObjectDatabase("mails", true, false, true); - guildODB = new ObjectDatabase("guild", true, false, true); - objectIdODB = new ObjectDatabase("oids", true, false, false); - duplicateIdODB = new ObjectDatabase("doids", true, false, true); - chatRoomODB = new ObjectDatabase("chatRooms", true, false, true); - resourcesODB = new ObjectDatabase("resources", true, false, true); - resourceRootsODB = new ObjectDatabase("resourceroots", true, false, true); - resourceHistoryODB = new ObjectDatabase("resourcehistory", true, false, true); - - // Services - loginService = new LoginService(this); - retroService = new RetroService(this); - connectionService = new ConnectionService(this); - characterService = new CharacterService(this); - mapService = new MapService(this); - travelService = new TravelService(this); - - factionService = new FactionService(this); - objectService = new ObjectService(this); - terrainService = new TerrainService(this); - updateService = new UpdateService(this); - scriptService = new ScriptService(this); - commandService = new CommandService(this); - chatService = new ChatService(this); - attributeService = new AttributeService(this); - suiService = new SUIService(this); - combatService = new CombatService(this); - playerService = new PlayerService(this); - buffService = new BuffService(this); - groupService = new GroupService(this); - skillService = new SkillService(this); - skillModService = new SkillModService(this); - equipmentService = new EquipmentService(this); - entertainmentService = new EntertainmentService(this); - devService = new DevService(this); - conversationService = new ConversationService(this); - lootService = new LootService(this); - - if (config.keyExists("JYTHONCONSOLE.PORT")) { - int jythonPort = config.getInt("JYTHONCONSOLE.PORT"); - if (jythonPort > 0) { - - System.out.println("Starting InteractiveJythonServer on Port " + jythonPort); - jythonAcceptor = new InteractiveJythonAcceptor(); - jythonServer = new InteractiveJythonServer((IoHandler) jythonAcceptor, jythonPort, this); - jythonAcceptor.setServer(jythonServer); - jythonServer.start(); - } - } - spawnService = new SpawnService(this); - aiService = new AIService(this); - //missionService = new MissionService(this); - - if (config.getInt("LOAD.RESOURCE.SYSTEM") == 1) { - surveyService = new SurveyService(this); - resourceService = new ResourceService(this); - } - - // Ping Server - try { - PingServer pingServer = new PingServer(config.getInt("PING.PORT")); - pingServer.bind(); - } catch (IOException e) { - e.printStackTrace(); - } - - // Login Server - loginDispatch = new NetworkDispatch(this, false); - loginDispatch.addService(loginService); - - loginServer = new MINAServer(loginDispatch, config.getInt("LOGIN.PORT")); - loginServer.start(); - - // Zone Server - zoneDispatch = new NetworkDispatch(this, true); - zoneDispatch.addService(retroService); - zoneDispatch.addService(connectionService); - zoneDispatch.addService(characterService); - zoneDispatch.addService(factionService); - zoneDispatch.addService(objectService); - zoneDispatch.addService(commandService); - zoneDispatch.addService(chatService); - zoneDispatch.addService(suiService); - zoneDispatch.addService(mapService); - zoneDispatch.addService(travelService); - zoneDispatch.addService(playerService); - zoneDispatch.addService(buffService); - zoneDispatch.addService(entertainmentService); - //zoneDispatch.addService(missionService); - - zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT")); - zoneServer.start(); - staticService = new StaticService(this); - //Start terrainList - // Original Planets - terrainService.addPlanet(1, "tatooine", "terrain/tatooine.trn", true); - terrainService.addPlanet(2, "naboo", "terrain/naboo.trn", true); - terrainService.addPlanet(3, "corellia", "terrain/corellia.trn", true); - terrainService.addPlanet(4, "rori", "terrain/rori.trn", true); - terrainService.addPlanet(5, "lok", "terrain/lok.trn", true); - terrainService.addPlanet(6, "dantooine", "terrain/dantooine.trn", true); - terrainService.addPlanet(7, "talus", "terrain/talus.trn", true); - terrainService.addPlanet(8, "yavin4", "terrain/yavin4.trn", true); - terrainService.addPlanet(9, "endor", "terrain/endor.trn", true); - terrainService.addPlanet(10, "dathomir", "terrain/dathomir.trn", true); - terrainService.addPlanet(11, "mustafar", "terrain/mustafar.trn", true); - terrainService.addPlanet(12, "kashyyyk_main", "terrain/kashyyyk_main.trn", true); - //Dungeon Terrains - // TODO: Fix BufferUnderFlow Errors on loaded of dungeon instances. - /*terrainService.addPlanet(13, "kashyyyk_dead_forest", "terrain/kashyyyk_dead_forest.trn", true); - terrainService.addPlanet(14, "kashyyyk_hunting", "terrain/kashyyyk_hunting.trn", true); - terrainService.addPlanet(15, "kashyyyk_north_dungeons", "terrain/kashyyyk_north_dungeons.trn", true); - terrainService.addPlanet(16, "kashyyyk_rryatt_trail", "terrain/kashyyyk_rryatt_trail.trn", true); - terrainService.addPlanet(17, "kashyyyk_south_dungeons", "terrain/kashyyyk_south_dungeons.trn", true);*/ - terrainService.addPlanet(18, "adventure1", "terrain/adventure1.trn", true); - terrainService.addPlanet(19, "adventure2", "terrain/adventure2.trn", true); - terrainService.addPlanet(20, "dungeon1", "terrain/dungeon1.trn", true); - //Space Zones - // NOTE: Commented out for now until space is implemented. No need to be loaded into memory when space is not implemented. - /*terrainService.addPlanet(21, "space_corellia", "terrain/space_corellia.trn", true); - terrainService.addPlanet(22, "space_corellia_2", "terrain/space_corellia_2.trn", true); - terrainService.addPlanet(23, "space_dantooine", "terrain/space_dantooine.trn", true); - terrainService.addPlanet(24, "space_dathomir", "terrain/space_dathomir.trn", true); - terrainService.addPlanet(25, "space_endor", "terrain/space_endor.trn", true); - terrainService.addPlanet(26, "space_env", "terrain/space_env.trn", true); - terrainService.addPlanet(27, "space_halos", "terrain/space_halos.trn", true); - terrainService.addPlanet(28, "space_heavy1", "terrain/space_heavy1.trn", true); - terrainService.addPlanet(29, "space_kashyyyk", "terrain/space_kashyyyk.trn", true); - terrainService.addPlanet(30, "space_light1", "terrain/space_light1.trn", true); - terrainService.addPlanet(31, "space_lok", "terrain/space_lok.trn", true); - terrainService.addPlanet(32, "space_naboo", "terrain/space_naboo.trn", true); - terrainService.addPlanet(33, "space_naboo_2", "terrain/space_naboo_2.trn", true); - terrainService.addPlanet(34, "space_nova_orion", "terrain/space_nova_orion.trn", true); - terrainService.addPlanet(35, "space_npe_falcon", "terrain/space_npe_falcon.trn", true); // TODO: New Player Tutorial - terrainService.addPlanet(36, "space_npe_falcon_2", "terrain/space_npe_falcon_2.trn", true); // TODO: New Player Tutorial - terrainService.addPlanet(37, "space_ord_mantell", "terrain/space_ord_mantell.trn", true); - terrainService.addPlanet(38, "space_ord_mantell_2", "terrain/space_ord_mantell_2.trn", true); - terrainService.addPlanet(39, "space_ord_mantell_3", "terrain/space_ord_mantell_3.trn", true); - terrainService.addPlanet(40, "space_ord_mantell_4", "terrain/space_ord_mantell_4.trn", true); - terrainService.addPlanet(41, "space_ord_mantell_5", "terrain/space_ord_mantell_5.trn", true); - terrainService.addPlanet(42, "space_ord_mantell_6", "terrain/space_ord_mantell_6.trn", true); - terrainService.addPlanet(43, "space_tatooine", "terrain/space_tatooine.trn", true); - terrainService.addPlanet(44, "space_tatooine_2", "terrain/space_tatooine_2.trn", true); - terrainService.addPlanet(45, "space_yavin4", "terrain/space_yavin4.trn", true);*/ - //PSWG New Content Terrains (WARNING Keep commented out unless you have the current build of kaas!) - - //terrainService.addPlanet(46, "kaas", "terrain/kaas.trn", true); - - //end terrainList - spawnService = new SpawnService(this); - terrainService.loadClientPois(); - // Travel Points - travelService.loadTravelPoints(); - simulationService = new SimulationService(this); - - objectService.loadBuildings(); - - if (config.getInt("LOAD.RESOURCE.SYSTEM") == 1) { - objectService.loadResourceRoots(); - objectService.loadResources(); - } - - terrainService.loadSnapShotObjects(); - objectService.loadServerTemplates(); - simulationService.insertSnapShotObjects(); - simulationService.insertPersistentBuildings(); - // Zone services that need to be loaded after the above - zoneDispatch.addService(simulationService); - - - // Static Spawns - staticService.spawnStatics(); - - guildService = new GuildService(this); - zoneDispatch.addService(guildService); - - gcwService = new GCWService(this); - zoneDispatch.addService(gcwService); - - collectionService = new CollectionService(this); - zoneDispatch.addService(collectionService); - - tradeService = new TradeService(this); - zoneDispatch.addService(tradeService); - - zoneDispatch.addService(skillService); - - instanceService = new InstanceService(this); - zoneDispatch.addService(instanceService); - - //travelService.startShuttleSchedule(); - - weatherService = new WeatherService(this); - weatherService.loadPlanetSettings(); - - spawnService.loadMobileTemplates(); - spawnService.loadLairTemplates(); - spawnService.loadLairGroups(); - spawnService.loadSpawnAreas(); - - equipmentService.loadBonusSets(); - - retroService.run(); - - didServerCrash = false; - System.out.println("Started Server."); - cleanupCreatureODB(); - setGalaxyStatus(2); - - } - - private void cleanupCreatureODB() { - EntityCursor cursor = creatureODB.getCursor(Long.class, CreatureObject.class); - - Iterator it = cursor.iterator(); - List deletedObjects = new ArrayList(); - - while(it.hasNext()) { - CreatureObject creature = it.next(); - if(!characterService.playerExists(creature.getObjectID())) - deletedObjects.add(creature); - } - - cursor.close(); - - Transaction txn = creatureODB.getEnvironment().beginTransaction(null, null); - for(CreatureObject creature : deletedObjects) { - creatureODB.delete(creature.getObjectID(), Long.class, CreatureObject.class, txn); - } - txn.commitSync(); - System.out.println("Deleted " + deletedObjects.size() + " creatures."); - } - - public void stop() { - System.out.println("Stopping Servers and Connections."); - databaseConnection.close(); - databaseConnection2.close(); - } - - public void cleanUp() { - System.out.println("Cleaning Up..."); - long memoryUsed = Runtime.getRuntime().freeMemory(); - System.out.println("Using " + memoryUsed + " bytes of memory."); - - config = null; - databaseConnection = null; - databaseConnection2 = null; - Runtime.getRuntime().gc(); - System.out.println("Cleaned Up " + (Runtime.getRuntime().freeMemory() - memoryUsed) + " bytes of memory."); - } - - public void restart() { - stop(); - cleanUp(); - try { - Thread.sleep(30000); - } catch (InterruptedException e) { - - } - start(); - } - - public static void main(String[] args) { - - NGECore core = new NGECore(); - - core.start(); - - do { - if (didServerCrash) { - core.restart(); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - - } - } while (true); - - } - - public void setGalaxyStatus(int statusId) { - - int galaxyId = config.getInt("GALAXY_ID"); - - try { - PreparedStatement ps = databaseConnection.preparedStatement("UPDATE \"connectionServers\" SET \"statusId\"=? WHERE \"galaxyId\"=?"); - ps.setInt(1, statusId); - ps.setInt(2, galaxyId); - ps.executeUpdate(); - } catch (SQLException e) { - e.printStackTrace(); - } - - } - - /* - * ---------- Getter methods for NGECore ---------- - */ - public Config getConfig() { - return config; - } - - public String getGalaxyName() { - return config.getString("GALAXY_NAME"); - } - - public DatabaseConnection getDatabase1() { - return databaseConnection; - } - - public DatabaseConnection getDatabase2() { - return databaseConnection2; - } - - public ObjectDatabase getCreatureODB() { - return creatureODB; - } - - public ObjectDatabase getMailODB() { - return mailODB; - } - - public ObjectDatabase getGuildODB() { - return guildODB; - } - - public ObjectDatabase getBuildingODB() { - return buildingODB; - } - - public ObjectDatabase getObjectIdODB() { - return objectIdODB; - } - - public ObjectDatabase getDuplicateIdODB() { - return duplicateIdODB; - } - - public ObjectDatabase getChatRoomODB() { - return chatRoomODB; - } - - public ObjectDatabase getResourcesODB() { - return resourcesODB; - } - - public ObjectDatabase getResourceRootsODB() { - return resourceRootsODB; - } - - public ObjectDatabase getResourceHistoryODB() { - return resourceHistoryODB; - } - - - public int getActiveClients() { - int connections = 0; - for (Map.Entry c : clients.entrySet()) { - if(c.getValue().getSession() != null) { - if (c.getValue().getSession().isConnected()) { - connections++; - } - } - } - return connections; - } - - public int getActiveZoneClients() { - int connections = 0; - for (Map.Entry c : clients.entrySet()) { - if(c.getValue().getSession() != null) { - if (c.getValue().getSession().isConnected() && c.getValue().getParent() != null) { - connections++; - } - } - } - return connections; - } - - - public Client getClient(IoSession session) { - return clients.get(session); - } - - public ConcurrentHashMap getActiveConnectionsMap() { - return clients; - } - - /* - * --------------- Other methods for services --------------- - */ - public void addClient(IoSession session, Client client) { - clients.put(session, client); - } - - public void removeClient(IoSession session) { - clients.remove(session); - } - - // for python scripts - public Thread getCurrentThread() { - return Thread.currentThread(); - } - - public static NGECore getInstance() { - return instance; - } - - public BusConfiguration getEventBusConfig() { - return eventBusConfig; - } - - public void initiateShutdown() { - if(isShuttingDown) - return; - try { - - for(int minutes = 15; minutes > 1; minutes--) { - simulationService.notifyAllClients(new ChatSystemMessage("The server will be shutting down soon. Please find a safe place to logout. (" + minutes + " minutes left)", (byte) 0 ).serialize()); - Thread.sleep(60000); - } - setGalaxyStatus(3); - simulationService.notifyAllClients(new ChatSystemMessage("The server will be shutting down soon. Please find a safe place to logout. (" + 1 + " minutes left)", (byte) 0 ).serialize()); - Thread.sleep(30000); - simulationService.notifyAllClients(new ChatSystemMessage("You will be disconnected in 30 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.", (byte) 0 ).serialize()); - Thread.sleep(20000); - simulationService.notifyAllClients(new ChatSystemMessage("You will be disconnected in 10 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.", (byte) 0 ).serialize()); - Thread.sleep(10000); - simulationService.notifyAllClients(new ChatSystemMessage("You will now be disconnected so the server can perform a final save before shutting down.", (byte) 0 ).serialize()); - - synchronized(getActiveConnectionsMap()) { - for(Client client : getActiveConnectionsMap().values()) { - client.getSession().close(true); - connectionService.disconnect(client); - } - } - - System.exit(0); - - } catch (InterruptedException e) { - e.printStackTrace(); - } - - - - } - - public long getGalacticTime() { - return System.currentTimeMillis() - galacticTime; - } - - -} - diff --git a/src/protocol/swg/CharacterSheetResponseMessage.java b/src/protocol/swg/CharacterSheetResponseMessage.java index 28de844d..70e14124 100644 --- a/src/protocol/swg/CharacterSheetResponseMessage.java +++ b/src/protocol/swg/CharacterSheetResponseMessage.java @@ -99,7 +99,7 @@ public class CharacterSheetResponseMessage extends SWGMessage { buffer.put(getUnicodeString(spouse)); - buffer.putInt(10); // lots remaining + buffer.putInt(creature.getPlayerObject().getLotsRemaining()); // lots remaining return buffer.flip(); } diff --git a/src/protocol/swg/ChatCreateRoom.java b/src/protocol/swg/ChatCreateRoom.java index 5f63614a..640cba0e 100644 --- a/src/protocol/swg/ChatCreateRoom.java +++ b/src/protocol/swg/ChatCreateRoom.java @@ -23,11 +23,23 @@ package protocol.swg; import org.apache.mina.core.buffer.IoBuffer; + public class ChatCreateRoom extends SWGMessage { + private String address, title; + private boolean privacy, moderatorOnly; + private int request; + + public ChatCreateRoom() { } @Override public void deserialize(IoBuffer data) { + this.privacy = (boolean) ((data.get() == 1) ? false : true); + this.moderatorOnly = (boolean) ((data.get() == 1) ? true : false); + data.getShort(); // unk + this.address = getAsciiString(data); + this.title = getAsciiString(data); + this.request = data.getInt(); } @Override @@ -35,4 +47,21 @@ public class ChatCreateRoom extends SWGMessage { return null; } + public String getAddress() { + return address; + } + public String getTitle() { + return title; + } + public boolean isPrivacy() { + return privacy; + } + public boolean isModeratorOnly() { + return moderatorOnly; + } + + public int getRequest() { + return request; + } + } diff --git a/src/protocol/swg/ChatEnterRoomById.java b/src/protocol/swg/ChatEnterRoomById.java index 29fd69cd..a5b2d4c3 100644 --- a/src/protocol/swg/ChatEnterRoomById.java +++ b/src/protocol/swg/ChatEnterRoomById.java @@ -23,15 +23,24 @@ package protocol.swg; import org.apache.mina.core.buffer.IoBuffer; +import resources.common.StringUtilities; + public class ChatEnterRoomById extends SWGMessage { private int roomId; + private int requestId; public ChatEnterRoomById() { } @Override public void deserialize(IoBuffer data) { - setRoomId(data.getInt()); + StringUtilities.printBytes(data.array()); + data.getShort(); + data.getInt(); + + this.requestId = data.getInt(); + this.roomId = data.getInt(); + // getAsciiString(data); // name of the room but don't need it since we have id. } @Override @@ -39,12 +48,12 @@ public class ChatEnterRoomById extends SWGMessage { return null; } + public int getRequestId() { + return requestId; + } + public int getRoomId() { return roomId; } - public void setRoomId(int roomId) { - this.roomId = roomId; - } - } diff --git a/src/protocol/swg/ChatOnCreateRoom.java b/src/protocol/swg/ChatOnCreateRoom.java index be54a71d..0492800c 100644 --- a/src/protocol/swg/ChatOnCreateRoom.java +++ b/src/protocol/swg/ChatOnCreateRoom.java @@ -21,6 +21,10 @@ ******************************************************************************/ package protocol.swg; +import java.nio.ByteOrder; + +import main.NGECore; + import org.apache.mina.core.buffer.IoBuffer; import services.chat.ChatRoom; @@ -28,9 +32,13 @@ import services.chat.ChatRoom; public class ChatOnCreateRoom extends SWGMessage { private ChatRoom room; + private int error; + private int requestId; - public ChatOnCreateRoom(ChatRoom room) { + public ChatOnCreateRoom(ChatRoom room, int error, int requestId) { this.room = room; + this.error = error; + this.requestId = requestId; } @Override @@ -40,8 +48,46 @@ public class ChatOnCreateRoom extends SWGMessage { @Override public IoBuffer serialize() { - // TODO Auto-generated method stub - return null; + String server = NGECore.getInstance().getGalaxyName(); + IoBuffer data = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + data.setAutoExpand(true); + + data.putShort((short) 4); + data.putInt(0x35D7CC9F); + + data.putInt(error); + data.putInt(room.getRoomId()); + data.putInt(room.isPrivateRoom() ? 0 : 1); + data.put((byte) (room.isModeratorsOnly() ? 1 : 0)); + data.put(getAsciiString(room.getRoomAddress())); + data.put(getAsciiString("SWG")); + data.put(getAsciiString(server)); + data.put(getAsciiString(room.getCreator())); + data.put(getAsciiString("SWG")); + data.put(getAsciiString(server)); + data.put(getAsciiString(room.getOwner())); + data.put(getUnicodeString(room.getDescription())); + + data.putInt(0); + /*if (room.getModeratorList().size() > 0) { + for (CreatureObject creo : room.getModeratorList()) { + data.put(getAsciiString("SWG")); + data.put(getAsciiString(server)); + data.put(getAsciiString(creo.getCustomName())); + } + }*/ + + data.putInt(0); + /*if (room.getUserList().size() > 0) { + for (CreatureObject creo : room.getUserList()) { + data.put(getAsciiString("SWG")); + data.put(getAsciiString(server)); + data.put(getAsciiString(creo.getCustomName())); + } + }*/ + + data.putInt(requestId); + return data.flip(); } } diff --git a/src/protocol/swg/ChatOnEnteredRoom.java b/src/protocol/swg/ChatOnEnteredRoom.java index b040c1bf..179f981a 100644 --- a/src/protocol/swg/ChatOnEnteredRoom.java +++ b/src/protocol/swg/ChatOnEnteredRoom.java @@ -62,6 +62,7 @@ public class ChatOnEnteredRoom extends SWGMessage { buffer.put(getAsciiString(characterName)); buffer.putInt(success); buffer.putInt(roomId); + buffer.putInt(0); return buffer.flip(); } diff --git a/src/protocol/swg/EnterStructurePlacementModeMessage.java b/src/protocol/swg/EnterStructurePlacementModeMessage.java new file mode 100644 index 00000000..3f12cf0a --- /dev/null +++ b/src/protocol/swg/EnterStructurePlacementModeMessage.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg; + +import java.nio.ByteOrder; + +import main.NGECore; + +import org.apache.mina.core.buffer.IoBuffer; + +import services.travel.TravelPoint; +import engine.resources.objects.SWGObject; + +@SuppressWarnings("unused") +public class EnterStructurePlacementModeMessage extends SWGMessage { + + private SWGObject deed; + private String structureTemplate; + + public EnterStructurePlacementModeMessage(SWGObject deed, String structureTemplate) { + this.deed = deed; + this.structureTemplate = structureTemplate; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer result = IoBuffer.allocate(16 + structureTemplate.length()).order(ByteOrder.LITTLE_ENDIAN); + + result.putShort((short) 3); + result.putInt(0xE8A54DC1); + + result.putLong(deed.getObjectID()); + + deed.setAttachment("structureTemplate", structureTemplate); + result.put(getAsciiString(structureTemplate)); + + return result.flip(); + } + +} \ No newline at end of file diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 74b2d7f3..da90caec 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -22,7 +22,6 @@ package resources.objects.creature; import java.lang.System; - import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -63,6 +62,7 @@ import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; +import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; @@ -1777,6 +1777,11 @@ public class CreatureObject extends TangibleObject implements IPersistent { return 0L; } + public PlayerObject getPlayerObject() + { + return (PlayerObject) this.getSlottedObject("ghost"); + } + //public float getCooldown(String cooldownGroup) { //return ((float) getCooldown(cooldownGroup) / (float) 1000); //} diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 9448144d..1a50837d 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -45,7 +45,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=9) +@Persistent(version=10) public class PlayerObject extends IntangibleObject { // PLAY 3 @@ -127,6 +127,8 @@ public class PlayerObject extends IntangibleObject { private String holoEmote; private int holoEmoteUses; + private int lotsRemaining = 10; + @NotPersistent private PlayerMessageBuilder messageBuilder; @@ -822,4 +824,30 @@ public class PlayerObject extends IntangibleObject { public void setRecentContainer(ResourceContainerObject recentContainer) { this.recentContainer = recentContainer; } + + public void setLotsRemaining(int amount) + { + this.lotsRemaining = amount; + } + + public boolean addLots(int amount) + { + this.lotsRemaining += amount; + return true; + } + + public boolean deductLots(int amount) + { + if(this.lotsRemaining - amount > 0) + { + this.lotsRemaining -= amount; + return true; + } + return false; + } + + public int getLotsRemaining() + { + return this.lotsRemaining; + } } diff --git a/src/services/DevService.java b/src/services/DevService.java deleted file mode 100644 index dc5b9a29..00000000 --- a/src/services/DevService.java +++ /dev/null @@ -1,1028 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 - * - * This File is part of NGECore2. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. - * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. - ******************************************************************************/ -package services; - -import java.nio.ByteOrder; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Vector; - -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.session.IoSession; - -import protocol.swg.ExpertiseRequestMessage; -import resources.common.Console; -import resources.common.FileUtilities; -import resources.common.Opcodes; -import resources.common.SpawnPoint; -import resources.objects.building.BuildingObject; -import resources.objects.creature.CreatureObject; -import resources.objects.player.PlayerObject; -import resources.objects.tangible.TangibleObject; -import resources.objects.tool.SurveyTool; -import services.sui.SUIWindow; -import services.sui.SUIService.ListBoxType; -import services.sui.SUIWindow.SUICallback; -import services.sui.SUIWindow.Trigger; -import main.NGECore; -import engine.clientdata.ClientFileManager; -import engine.clientdata.visitors.DatatableVisitor; -import engine.clients.Client; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.service.INetworkDispatch; -import engine.resources.service.INetworkRemoteEvent; - -@SuppressWarnings("unused") -public class DevService implements INetworkDispatch { - - private NGECore core; - - public DevService(NGECore core) { - this.core = core; - } - - public void sendCharacterBuilderSUI(CreatureObject creature, int childMenu) - { - Map suiOptions = new HashMap(); - - switch(childMenu) - { - case 0: // Root - suiOptions.put((long) 1, "Character"); - suiOptions.put((long) 2, "Items"); - break; - case 1: // Character - suiOptions.put((long) 10, "Set combat level to 90"); - suiOptions.put((long) 11, "Give 100,000 credits"); - suiOptions.put((long) 12, "Reset expertise"); - break; - case 2: // Items - suiOptions.put((long) 20, "Armor"); - suiOptions.put((long) 21, "Weapons"); - suiOptions.put((long) 22, "Misc Items"); - suiOptions.put((long) 23, "Jedi Items"); - suiOptions.put((long) 110, "Survey Devices"); - suiOptions.put((long) 111, "Spawn Tusken"); - suiOptions.put((long) 112, "Spawn Krayt"); - break; - case 3: // [Items] Weapons - suiOptions.put((long) 30, "Jedi Weapons"); - suiOptions.put((long) 31, "Melee Weapons"); - suiOptions.put((long) 32, "Ranged Weapons"); - break; - case 4: // [Items] Misc Items - suiOptions.put((long) 40, "Unity Ring"); - suiOptions.put((long) 41, "Tusken Rucksack"); - suiOptions.put((long) 42, "Heroism Jewlery Set"); - break; - case 5: // [Items] Armor - suiOptions.put((long) 50, "Assault Armor"); - suiOptions.put((long) 51, "Battle Armor"); - suiOptions.put((long) 52, "Reconnaissance Armor"); - break; - case 6: // [Items] Assault Armor - suiOptions.put((long) 60, "Composite"); - suiOptions.put((long) 61, "Ithorian Sentinel"); - suiOptions.put((long) 62, "Kashyyykian Hunting"); - break; - case 7: // [Items] Battle Armor - suiOptions.put((long) 70, "Bone"); - suiOptions.put((long) 71, "Ithorian Defender"); - suiOptions.put((long) 72, "Kashyyykian Black Mountain"); - break; - case 8: // [Items] Reconnaissance Armor - suiOptions.put((long) 80, "Marauder"); - suiOptions.put((long) 81, "Ithorian Guardian"); - suiOptions.put((long) 82, "Kashyyykian Ceremonial"); - break; - case 9: // [Items] Jedi Items - suiOptions.put((long) 90, "(Light) Jedi Robe"); - suiOptions.put((long) 91, "(Dark) Jedi Robe"); - suiOptions.put((long) 92, "Belt of Master Bodo Baas"); - break; - - } - - final SUIWindow window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "Character Builder Terminal", "Select the desired option and click OK.", suiOptions, creature, null, 10); - Vector returnList = new Vector(); - - returnList.add("List.lstList:SelectedRow"); - - window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() - { - public void process(SWGObject owner, int eventType, Vector returnList) - { - int index = Integer.parseInt(returnList.get(0)); - int childIndex = (int) window.getObjectIdByIndex(index); - - CreatureObject player = (CreatureObject) owner; - SWGObject inventory = player.getSlottedObject("inventory"); - Planet planet = player.getPlanet(); - - switch(childIndex) - { - // Root - case 1: // Character - sendCharacterBuilderSUI(player, 1); - return; - case 2: // Items - sendCharacterBuilderSUI(player, 2); - return; - - // Character - case 10: // Set combat level to 90 - core.playerService.grantLevel(player, 90); // Commented out until fixed - //core.playerService.giveExperience(player, 999999999); - return; - case 11: // Give 100,000 credits - player.setCashCredits(player.getCashCredits() + 100000); - return; - case 12: // Reset expertise - // Seefo->Light: I commented out the below line because it gave us an error and didn't properly remove the skill, could you try the method SWGList.reverseGet that I added? - //player.getSkills().get().stream().filter(s -> s.contains("expertise")).forEach(s -> core.skillService.removeSkill(creature, s)); - - // Using this for now - for(int i = creature.getSkills().size() - 1; i >= 0; i-- ) - { - String skill = creature.getSkills().get(i); - if(skill.contains("expertise")) core.skillService.removeSkill(player, skill); - } - return; - - // Items - case 20: // Armor - sendCharacterBuilderSUI(player, 5); - return; - case 21: // Weapons - sendCharacterBuilderSUI(player, 3); - return; - case 22: // Misc Items - sendCharacterBuilderSUI(player, 4); - return; - case 23: // Jedi Items - sendCharacterBuilderSUI(player, 9); - return; - case 25: // Tools - sendCharacterBuilderSUI(player, 15); - return; - - // [Items] Weapons - case 30: // Jedi Weapons - TangibleObject lightsaber1 = (TangibleObject) core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet); - lightsaber1.setIntAttribute("required_combat_level", 90); - lightsaber1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - lightsaber1.setStringAttribute("class_required", "Jedi"); - lightsaber1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber1.setStringAttribute("cat_wpn_damage.damage", "689-1379"); - - TangibleObject lightsaber2 = (TangibleObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet); - lightsaber2.setIntAttribute("required_combat_level", 90); - lightsaber2.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - lightsaber2.setStringAttribute("class_required", "Jedi"); - lightsaber2.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber2.setStringAttribute("cat_wpn_damage.damage", "689-1379"); - - TangibleObject lightsaber3 = (TangibleObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet); - lightsaber3.setIntAttribute("required_combat_level", 90); - lightsaber3.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - lightsaber3.setStringAttribute("class_required", "Jedi"); - lightsaber3.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber3.setStringAttribute("cat_wpn_damage.damage", "689-1379"); - - Random random = new Random(); - - lightsaber1.setCustomizationVariable("/private/index_color_blade", (byte) random.nextInt(47)); - lightsaber2.setCustomizationVariable("/private/index_color_blade", (byte) random.nextInt(47)); - lightsaber3.setCustomizationVariable("/private/index_color_blade", (byte) random.nextInt(47)); - - inventory.add(lightsaber1); - inventory.add(lightsaber2); - inventory.add(lightsaber3); - return; - case 31: // Melee Weapons - SWGObject sword1 = core.objectService.createObject("object/weapon/melee/sword/shared_sword_01.iff", planet); - sword1.setIntAttribute("required_combat_level", 90); - sword1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - sword1.setStringAttribute("class_required", "None"); - sword1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - sword1.setStringAttribute("cat_wpn_damage.damage", "1100-1200"); - - inventory.add(sword1); - return; - case 32: // Ranged Weapons - SWGObject rifle1 = core.objectService.createObject("object/weapon/ranged/rifle/shared_rifle_e11.iff", planet); - rifle1.setIntAttribute("required_combat_level", 90); - rifle1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", (float) 0.8); - rifle1.setStringAttribute("class_required", "None"); - rifle1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - rifle1.setStringAttribute("cat_wpn_damage.damage", "800-1250"); - - inventory.add(rifle1); - - SWGObject pistol = core.objectService.createObject("object/weapon/ranged/pistol/shared_pistol_cdef.iff", planet); - pistol.setIntAttribute("required_combat_level", 90); - pistol.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", (float) 0.4); - pistol.setStringAttribute("class_required", "None"); - pistol.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - pistol.setStringAttribute("cat_wpn_damage.damage", "400-559"); - - inventory.add(pistol); - - /* == Disabled until Elemental Damage is implemented. == - SWGObject heavy = core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); - heavy.setIntAttribute("required_combat_level", 90); - heavy.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - heavy.setStringAttribute("class_required", "Commando"); - heavy.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - heavy.setStringAttribute("cat_wpn_damage.damage", "700-1400"); - - inventory.add(heavy);*/ - return; - case 40: - TangibleObject ring = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); - ring.setCustomName("Unity Ring"); - inventory.add(ring); - case 41: - TangibleObject backpack = (TangibleObject) core.objectService.createObject("object/tangible/wearables/backpack/shared_backpack_krayt_skull.iff", planet); - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:agility_modified", 25); - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:constitution_modified", 30); - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:luck_modified", 25); - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:precision_modified", 35); - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:stamina_modified", 30); - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:strength_modified", 35); - inventory.add(backpack); - return; - case 42: - TangibleObject heroismBand = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); - heroismBand.setStfFilename("static_item_n"); - heroismBand.setStfName("item_band_set_hero_01_01"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBand.setAttachment("setBonus", "set_bonus_hero"); - - TangibleObject heroismRing = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); - heroismRing.setStfFilename("static_item_n"); - heroismRing.setStfName("item_ring_set_hero_01_01"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismRing.setAttachment("setBonus", "set_bonus_hero"); - - TangibleObject heroismNecklace = (TangibleObject) core.objectService.createObject("object/tangible/wearables/necklace/shared_necklace_s01.iff", planet); - heroismNecklace.setStfFilename("static_item_n"); - heroismNecklace.setStfName("item_necklace_set_hero_01_01"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismNecklace.setAttachment("setBonus", "set_bonus_hero"); - - TangibleObject heroismBraceletRight = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s02_r.iff", planet); - heroismBraceletRight.setStfFilename("static_item_n"); - heroismBraceletRight.setStfName("item_bracelet_r_set_hero_01_01"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBraceletRight.setAttachment("setBonus", "set_bonus_hero"); - - TangibleObject heroismBraceletLeft = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s02_l.iff", planet); - heroismBraceletLeft.setStfFilename("static_item_n"); - heroismBraceletLeft.setStfName("item_bracelet_l_set_hero_01_01"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBraceletLeft.setAttachment("setBonus", "set_bonus_hero"); - - inventory.add(heroismBand); - inventory.add(heroismRing); - inventory.add(heroismNecklace); - inventory.add(heroismBraceletRight); - inventory.add(heroismBraceletLeft); - return; - case 50: // [Items] Assault Armor - sendCharacterBuilderSUI(player, 6); - return; - case 51: // [Items] Battle Armor - sendCharacterBuilderSUI(player, 7); - return; - case 52: // [Items] Reconnaissance Armor - sendCharacterBuilderSUI(player, 8); - return; - case 60: // Composite Armor - SWGObject comp_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_bicep_r.iff", planet); - comp_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - comp_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - comp_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - comp_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - comp_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - comp_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject comp_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_bicep_l.iff", planet); - comp_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - comp_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - comp_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - comp_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - comp_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - comp_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject comp_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_bracer_r.iff", planet); - comp_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - comp_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - comp_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - comp_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - comp_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - comp_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject comp_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_bracer_l.iff", planet); - comp_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - comp_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - comp_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - comp_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - comp_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - comp_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject comp_leggings = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_leggings.iff", planet); - comp_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - comp_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - comp_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - comp_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - comp_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - comp_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject comp_helmet = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_helmet.iff", planet); - comp_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - comp_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - comp_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - comp_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - comp_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - comp_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject comp_chest = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_chest_plate.iff", planet); - comp_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - comp_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - comp_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - comp_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - comp_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - comp_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject comp_boots = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_boots.iff", planet); - SWGObject comp_gloves = core.objectService.createObject("object/tangible/wearables/armor/composite/shared_armor_composite_gloves.iff", planet); - - - - inventory.add(comp_bicep_r); - inventory.add(comp_bicep_l); - inventory.add(comp_bracer_r); - inventory.add(comp_bracer_l); - inventory.add(comp_leggings); - inventory.add(comp_helmet); - inventory.add(comp_chest); - inventory.add(comp_boots); - inventory.add(comp_gloves); - - - return; - case 61: // Ithorian Sentinel - SWGObject sent_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_r.iff", planet); - sent_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - sent_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - sent_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - sent_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - sent_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - sent_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject sent_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_l.iff", planet); - sent_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - sent_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - sent_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - sent_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - sent_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - sent_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject sent_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_r.iff", planet); - sent_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - sent_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - sent_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - sent_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - sent_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - sent_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject sent_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_l.iff", planet); - sent_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - sent_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - sent_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - sent_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - sent_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - sent_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject sent_leggings = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_leggings.iff", planet); - sent_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - sent_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - sent_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - sent_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - sent_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - sent_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject sent_helmet = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_helmet.iff", planet); - sent_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - sent_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - sent_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - sent_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - sent_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - sent_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject sent_chest = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_chest_plate.iff", planet); - sent_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - sent_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - sent_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - sent_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - sent_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - sent_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject sent_boots = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_boots.iff", planet); - SWGObject sent_gloves = core.objectService.createObject("object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_gloves.iff", planet); - - - - inventory.add(sent_bicep_r); - inventory.add(sent_bicep_l); - inventory.add(sent_bracer_r); - inventory.add(sent_bracer_l); - inventory.add(sent_leggings); - inventory.add(sent_helmet); - inventory.add(sent_chest); - inventory.add(sent_boots); - inventory.add(sent_gloves); - - - return; - case 62: // Kashyyykian Hunting - SWGObject hunt_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bicep_r.iff", planet); - hunt_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - hunt_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - hunt_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - hunt_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - hunt_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - hunt_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject hunt_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bicep_l.iff", planet); - hunt_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - hunt_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - hunt_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - hunt_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - hunt_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - hunt_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject hunt_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bracer_r.iff", planet); - hunt_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - hunt_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - hunt_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - hunt_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - hunt_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - hunt_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject hunt_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bracer_l.iff", planet); - hunt_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - hunt_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - hunt_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - hunt_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - hunt_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - hunt_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject hunt_leggings = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_leggings.iff", planet); - hunt_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - hunt_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - hunt_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - hunt_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - hunt_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - hunt_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject hunt_chest = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_chestplate.iff", planet); - hunt_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 7000); - hunt_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5000); - hunt_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - hunt_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - hunt_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - hunt_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - - - inventory.add(hunt_bicep_r); - inventory.add(hunt_bicep_l); - inventory.add(hunt_bracer_r); - inventory.add(hunt_bracer_l); - inventory.add(hunt_leggings); - inventory.add(hunt_chest); - - - return; - case 70: // Bone Armor - SWGObject bone_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_bicep_r.iff", planet); - bone_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - bone_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - bone_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - bone_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - bone_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - bone_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject bone_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_bicep_l.iff", planet); - bone_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - bone_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - bone_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - bone_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - bone_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - bone_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject bone_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_bracer_r.iff", planet); - bone_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - bone_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - bone_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - bone_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - bone_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - bone_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject bone_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_bracer_l.iff", planet); - bone_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - bone_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - bone_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - bone_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - bone_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - bone_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject bone_leggings = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_leggings.iff", planet); - bone_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - bone_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - bone_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - bone_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - bone_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - bone_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject bone_helmet = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_helmet.iff", planet); - bone_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - bone_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - bone_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - bone_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - bone_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - bone_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject bone_chest = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_chest_plate.iff", planet); - bone_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - bone_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - bone_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - bone_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - bone_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - bone_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject bone_boots = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_boots.iff", planet); - SWGObject bone_gloves = core.objectService.createObject("object/tangible/wearables/armor/bone/shared_armor_bone_s01_gloves.iff", planet); - - - - inventory.add(bone_bicep_r); - inventory.add(bone_bicep_l); - inventory.add(bone_bracer_r); - inventory.add(bone_bracer_l); - inventory.add(bone_leggings); - inventory.add(bone_helmet); - inventory.add(bone_chest); - inventory.add(bone_boots); - inventory.add(bone_gloves); - - - return; - case 71: // Ithorian Defender - SWGObject def_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_bicep_r.iff", planet); - def_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - def_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - def_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - def_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - def_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - def_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject def_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_bicep_l.iff", planet); - def_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - def_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - def_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - def_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - def_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - def_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject def_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_bracer_r.iff", planet); - def_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - def_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - def_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - def_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - def_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - def_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject def_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_bracer_l.iff", planet); - def_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - def_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - def_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - def_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - def_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - def_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject def_leggings = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_leggings.iff", planet); - def_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - def_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - def_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - def_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - def_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - def_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject def_helmet = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_helmet.iff", planet); - def_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - def_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - def_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - def_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - def_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - def_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject def_chest = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_chest_plate.iff", planet); - def_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - def_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - def_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - def_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - def_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - def_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject def_boots = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_boots.iff", planet); - SWGObject def_gloves = core.objectService.createObject("object/tangible/wearables/armor/ithorian_defender/shared_ith_armor_s01_gloves.iff", planet); - - - - inventory.add(def_bicep_r); - inventory.add(def_bicep_l); - inventory.add(def_bracer_r); - inventory.add(def_bracer_l); - inventory.add(def_leggings); - inventory.add(def_helmet); - inventory.add(def_chest); - inventory.add(def_boots); - inventory.add(def_gloves); - - - return; - case 72: // Kashyyykian Black Mountain - SWGObject moun_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_black_mtn/shared_armor_kashyyykian_black_mtn_bicep_r.iff", planet); - moun_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - moun_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - moun_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - moun_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - moun_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - moun_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject moun_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_black_mtn/shared_armor_kashyyykian_black_mtn_bicep_l.iff", planet); - moun_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - moun_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - moun_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - moun_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - moun_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - moun_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject moun_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_black_mtn/shared_armor_kashyyykian_black_mtn_bracer_r.iff", planet); - moun_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - moun_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - moun_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - moun_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - moun_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - moun_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject moun_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_black_mtn/shared_armor_kashyyykian_black_mtn_bracer_l.iff", planet); - moun_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - moun_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - moun_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - moun_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - moun_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - moun_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject moun_leggings = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_black_mtn/shared_armor_kashyyykian_black_mtn_leggings.iff", planet); - moun_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - moun_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - moun_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - moun_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - moun_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - moun_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject moun_chest = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_black_mtn/shared_armor_kashyyykian_black_mtn_chestplate.iff", planet); - moun_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 6000); - moun_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 6000); - moun_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - moun_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - moun_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - moun_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - - - inventory.add(moun_bicep_r); - inventory.add(moun_bicep_l); - inventory.add(moun_bracer_r); - inventory.add(moun_bracer_l); - inventory.add(moun_leggings); - inventory.add(moun_chest); - - - return; - case 80: // Marauder Armor - SWGObject mar_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_bicep_r.iff", planet); - mar_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - mar_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - mar_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - mar_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - mar_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - mar_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject mar_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_bicep_l.iff", planet); - mar_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - mar_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - mar_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - mar_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - mar_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - mar_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject mar_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_bracer_r.iff", planet); - mar_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - mar_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - mar_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - mar_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - mar_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - mar_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject mar_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_bracer_l.iff", planet); - mar_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - mar_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - mar_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - mar_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - mar_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - mar_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject mar_leggings = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_leggings.iff", planet); - mar_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - mar_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - mar_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - mar_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - mar_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - mar_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject mar_helmet = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_helmet.iff", planet); - mar_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - mar_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - mar_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - mar_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - mar_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - mar_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject mar_chest = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_chest_plate.iff", planet); - mar_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - mar_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - mar_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - mar_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - mar_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - mar_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject mar_boots = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_boots.iff", planet); - SWGObject mar_gloves = core.objectService.createObject("object/tangible/wearables/armor/marauder/shared_armor_marauder_s02_gloves.iff", planet); - - - - inventory.add(mar_bicep_r); - inventory.add(mar_bicep_l); - inventory.add(mar_bracer_r); - inventory.add(mar_bracer_l); - inventory.add(mar_leggings); - inventory.add(mar_helmet); - inventory.add(mar_chest); - inventory.add(mar_boots); - inventory.add(mar_gloves); - - - return; - case 81: // Ithorian Guardian - SWGObject gau_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_bicep_r.iff", planet); - gau_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - gau_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - gau_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - gau_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - gau_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - gau_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject gau_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_bicep_l.iff", planet); - gau_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - gau_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - gau_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - gau_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - gau_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - gau_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject gau_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_bracer_r.iff", planet); - gau_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - gau_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - gau_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - gau_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - gau_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - gau_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject gau_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_bracer_l.iff", planet); - gau_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - gau_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - gau_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - gau_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - gau_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - gau_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject gau_leggings = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_leggings.iff", planet); - gau_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - gau_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - gau_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - gau_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - gau_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - gau_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject gau_helmet = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_helmet.iff", planet); - gau_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - gau_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - gau_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - gau_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - gau_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - gau_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject gau_chest = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_chest_plate.iff", planet); - gau_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - gau_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - gau_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - gau_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - gau_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - gau_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject gau_boots = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_boots.iff", planet); - SWGObject gau_gloves = core.objectService.createObject("object/tangible/wearables/armor/ithorian_guardian/shared_ith_armor_s02_gloves.iff", planet); - - - - inventory.add(gau_bicep_r); - inventory.add(gau_bicep_l); - inventory.add(gau_bracer_r); - inventory.add(gau_bracer_l); - inventory.add(gau_leggings); - inventory.add(gau_helmet); - inventory.add(gau_chest); - inventory.add(gau_boots); - inventory.add(gau_gloves); - - - return; - case 82: // Kashyyykian Ceremonial - SWGObject cer_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_ceremonial/shared_armor_kashyyykian_ceremonial_bicep_r.iff", planet); - cer_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - cer_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - cer_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - cer_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - cer_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - cer_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject cer_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_ceremonial/shared_armor_kashyyykian_ceremonial_bicep_l.iff", planet); - cer_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - cer_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - cer_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - cer_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - cer_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - cer_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject cer_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_ceremonial/shared_armor_kashyyykian_ceremonial_bracer_r.iff", planet); - cer_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - cer_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - cer_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - cer_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - cer_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - cer_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject cer_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_ceremonial/shared_armor_kashyyykian_ceremonial_bracer_l.iff", planet); - cer_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - cer_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - cer_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - cer_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - cer_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - cer_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject cer_leggings = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_ceremonial/shared_armor_kashyyykian_ceremonial_leggings.iff", planet); - cer_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - cer_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - cer_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - cer_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - cer_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - cer_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - SWGObject cer_chest = core.objectService.createObject("object/tangible/wearables/armor/kashyyykian_ceremonial/shared_armor_kashyyykian_ceremonial_chestplate.iff", planet); - cer_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5000); - cer_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 7000); - cer_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 6000); - cer_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 6000); - cer_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 6000); - cer_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 6000); - - - - inventory.add(cer_bicep_r); - inventory.add(cer_bicep_l); - inventory.add(cer_bracer_r); - inventory.add(cer_bracer_l); - inventory.add(cer_leggings); - inventory.add(cer_chest); - - return; - - case 90: // (Light) Jedi Robe - inventory.add(core.objectService.createObject("object/tangible/wearables/robe/shared_robe_jedi_light_s03.iff", planet)); - return; - case 91: // (Dark) Jedi Robe - inventory.add(core.objectService.createObject("object/tangible/wearables/robe/shared_robe_jedi_dark_s03.iff", planet)); - return; - case 92: // Belt of Master Bodo Baas - inventory.add(core.objectService.createObject("object/tangible/wearables/backpack/shared_fannypack_s01.iff", planet)); - return; - case 110: - SurveyTool mineralSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_mineral.iff", planet); - mineralSurveyTool.setCustomName("Mineral Survey Device"); - inventory.add(mineralSurveyTool); - - SurveyTool chemicalSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_inorganic.iff", planet); - chemicalSurveyTool.setCustomName("Chemical Survey Device"); - inventory.add(chemicalSurveyTool); - - SurveyTool floraSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_lumber.iff", planet); - floraSurveyTool.setCustomName("Flora Survey Device"); - inventory.add(floraSurveyTool); - - SurveyTool gasSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_gas.iff", planet); - gasSurveyTool.setCustomName("Gas Survey Device"); - inventory.add(gasSurveyTool); - - SurveyTool waterSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_moisture.iff", planet); - waterSurveyTool.setCustomName("Water Survey Device"); - inventory.add(waterSurveyTool); - - SurveyTool windSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_wind.iff", planet); - windSurveyTool.setCustomName("Wind Survey Device"); - inventory.add(windSurveyTool); - - SurveyTool solarSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_solar.iff", planet); - solarSurveyTool.setCustomName("Solar Survey Device"); - inventory.add(solarSurveyTool); - - - - - break; - case 111: - SWGObject spawned = core.staticService.spawnObject("object/mobile/shared_tusken_raider.iff", "tatooine", 0L, 3522F, 4F, -4801F, 0.70F, 0.71F); - - core.lootService.handleLootRequest(player,(TangibleObject)spawned); - break; - case 112: - SWGObject spawned2 = core.staticService.spawnObject("object/mobile/shared_krayt_dragon.iff", "tatooine", 0L, 3512F, 4F, -4801F, 0.70F, 0.71F); - - core.lootService.handleLootRequest(player,(TangibleObject)spawned2); - break; - } - } - }); - - core.suiService.openSUIWindow(window); - } - - @Override - public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { - } - - - @Override - public void shutdown() { - - } - -} - diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index bf7cc26e..d7c05496 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -909,6 +909,11 @@ public class SimulationService implements INetworkDispatch { if(obj1.getPlanet() != obj2.getPlanet()) return false; + // If obj1 is container of obj2 vice versa + if (obj1 == obj2.getContainer() || obj2 == obj1.getContainer() || obj1 == obj2.getGrandparent() || obj2 == obj1.getGrandparent()) { + return true; + } + if(obj1.getGrandparent() != null || obj2.getGrandparent() != null) { if(obj1.getGrandparent() == obj2.getGrandparent()) diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 562686dc..8d4a159f 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -49,6 +49,7 @@ import resources.common.*; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import protocol.swg.AddIgnoreMessage; +import protocol.swg.ChatCreateRoom; import protocol.swg.ChatEnterRoomById; import protocol.swg.ChatOnChangeFriendStatus; import protocol.swg.ChatDeletePersistentMessage; @@ -56,6 +57,7 @@ import protocol.swg.ChatFriendsListUpdate; import protocol.swg.ChatInstantMessageToCharacter; import protocol.swg.ChatInstantMessagetoClient; import protocol.swg.ChatOnAddFriend; +import protocol.swg.ChatOnCreateRoom; import protocol.swg.ChatOnEnteredRoom; import protocol.swg.ChatOnSendInstantMessage; import protocol.swg.ChatOnSendPersistentMessage; @@ -369,13 +371,37 @@ public class ChatService implements INetworkDispatch { }); swgOpcodes.put(Opcodes.ChatCreateRoom, (session, data) -> { - //System.out.println("CREATE:"); - //StringUtilities.printBytes(data.array()); + data.order(ByteOrder.LITTLE_ENDIAN); + + Client client = core.getClient(session); + + if(client == null) + return; + + SWGObject obj = client.getParent(); + + if (obj == null) + return; + + CreatureObject creo = (CreatureObject) obj; + + ChatCreateRoom sentPacket = new ChatCreateRoom(); + sentPacket.deserialize(data); + + ChatRoom room = createChatRoom(sentPacket.getTitle(), sentPacket.getAddress(), creo.getCustomName().toLowerCase(), true, false); + room.setPrivateRoom(sentPacket.isPrivacy()); + room.setModeratorsOnly(sentPacket.isModeratorOnly()); + + if (room != null) { + room.getUserList().add(creo); + room.getModeratorList().add(creo); + ChatOnCreateRoom response = new ChatOnCreateRoom(room, 0, sentPacket.getRequest()); + session.write(response.serialize()); + } + }); swgOpcodes.put(Opcodes.ChatQueryRoom, (session, data) -> { - //System.out.println("QUERY: "); - //StringUtilities.printBytes(data.array()); }); swgOpcodes.put(Opcodes.ChatSendToRoom, (session, data) -> { @@ -408,13 +434,14 @@ public class ChatService implements INetworkDispatch { if (obj == null) return; - + data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); ChatEnterRoomById sentPacket = new ChatEnterRoomById(); sentPacket.deserialize(data); joinChatRoom((CreatureObject) obj, sentPacket.getRoomId()); - //System.out.println("Entering room..."); + System.out.println("Entering room... " + sentPacket.getRoomId()); }); } @@ -684,7 +711,7 @@ public class ChatService implements INetworkDispatch { } private void loadChatRooms() { - ChatRoom system = createChatRoom("Waves Dungeon", "ProjectSWGTest.Dungeon", "Waverunner", true); + ChatRoom system = createChatRoom("", "Chat", "system", true); chatRooms.put(system.getRoomId(), system); EntityCursor cursor = chatRoomsODB.getCursor(Integer.class, ChatRoom.class); @@ -704,7 +731,10 @@ public class ChatService implements INetworkDispatch { ChatRoom room = new ChatRoom(); room.setDescription(roomName); - room.setRoomAddress("SWG." + core.getGalaxyName() + "." + address); + if (!address.startsWith("SWG.")) + room.setRoomAddress("SWG." + core.getGalaxyName() + "." + address); + else + room.setRoomAddress(address); room.setCreator(creator); room.setOwner(creator); room.setVisible(showInList); diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 8e9bcf44..efb0fd84 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -118,7 +118,11 @@ public class CommandService implements INetworkDispatch { return false; } - if (target != null && actor.getPosition().getDistance(target.getPosition()) > command.getMaxRangeToTarget()) { + if (target.getContainer() == actor || target.getGrandparent() == actor) { + break; + } + + if (command.getMaxRangeToTarget() != 0 && actor.getPosition().getDistance(target.getPosition()) > command.getMaxRangeToTarget()) { return false; } @@ -272,7 +276,7 @@ public class CommandService implements INetworkDispatch { boolean hasCharacterAbility = (((String) visitor.getObject(i, 7-sub)).length() > 0); - if (tableArray[n].startsWith("client_") && tableArray[n].startsWith("command_table_")) { + if (tableArray[n].startsWith("client_") || tableArray[n].startsWith("command_table_")) { sub += 7; } @@ -282,8 +286,11 @@ public class CommandService implements INetworkDispatch { boolean isCombatCommand = false; - if(visitor.getObject(i, 82-sub) instanceof Boolean) - isCombatCommand = (Boolean) visitor.getObject(i, 82-sub); + System.out.println(((String) visitor.getObject(i, 85-sub))); + + if(((String) visitor.getObject(i, 3)).equals("failSpecialAttack") || ((String) visitor.getObject(i, 85-sub)).equals("defaultattack")) + isCombatCommand = true; + if (hasCharacterAbility || isCombatCommand) { CombatCommand command = new CombatCommand(name.toLowerCase()); @@ -333,7 +340,7 @@ public class CommandService implements INetworkDispatch { boolean hasCharacterAbility = (((String) visitor.getObject(i, 7-sub)).length() > 0); - if (tableArray[n].startsWith("client_") && tableArray[n].startsWith("command_table_")) { + if (tableArray[n].startsWith("client_") || tableArray[n].startsWith("command_table_")) { sub += 7; } @@ -343,9 +350,10 @@ public class CommandService implements INetworkDispatch { boolean isCombatCommand = false; - if(visitor.getObject(i, 82-sub) instanceof Boolean) - isCombatCommand = (Boolean) visitor.getObject(i, 82-sub); + if(((String) visitor.getObject(i, 3)).equals("failSpecialAttack") || ((String) visitor.getObject(i, 85-sub)).equals("defaultattack")) + isCombatCommand = true; + // "isCombatCommand" needs to be changed so that non-combat commands that are flagged to added to a combat queue are not considered combat commands if (hasCharacterAbility || isCombatCommand) { CombatCommand command = new CombatCommand(commandName); commandLookup.add(command); @@ -367,10 +375,7 @@ public class CommandService implements INetworkDispatch { } public void processCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) { - if (command.getCooldown() > (float) 1) { - actor.addCooldown(command.getCooldownGroup(), command.getCooldown()); - } - + actor.addCooldown(command.getCooldownGroup(), command.getCooldown()); if (command instanceof CombatCommand) { processCombatCommand(actor, target, (CombatCommand) command, actionCounter, commandArgs); } else { @@ -391,7 +396,9 @@ public class CommandService implements INetworkDispatch { //} if(FileUtilities.doesFileExist("scripts/commands/combat/" + command.getCommandName() + ".py")) + { core.scriptService.callScript("scripts/commands/combat/", command.getCommandName(), "setup", core, attacker, target, command); + } boolean success = true; @@ -476,7 +483,7 @@ public class CommandService implements INetworkDispatch { return; } - if(command.getHitType() == 0 && command.getBuffNameSelf().length() > 0) { + if(command.getHitType() == 0 && command.getBuffNameSelf() != null && command.getBuffNameSelf().length() > 0) { core.combatService.doSelfBuff(attacker, weapon, command, actionCounter); return; } diff --git a/src/services/housing/HouseTemplate.java b/src/services/housing/HouseTemplate.java new file mode 100644 index 00000000..fc2861df --- /dev/null +++ b/src/services/housing/HouseTemplate.java @@ -0,0 +1,70 @@ +package services.housing; + +import java.util.HashMap; +import java.util.Map; +import java.util.Vector; + +import engine.resources.scene.Point3D; + +public class HouseTemplate +{ + private String deedTemplate; + private String buildingTemplate; + private int lotCost; + private int defaultItemLimit; + private Vector placeablePlanets; + private Map buildingSigns; + + public HouseTemplate(String deedTemplate, String buildingTemplate, int lotCost) + { + this.deedTemplate = deedTemplate; + this.buildingTemplate = buildingTemplate; + this.lotCost = lotCost; + this.defaultItemLimit = 50; + this.placeablePlanets = new Vector(); + this.buildingSigns = new HashMap(); + } + + public void addBuildingSign(String signTemplate, Point3D signPosition) + { + buildingSigns.put(signTemplate, signPosition); + } + public void addPlaceablePlanet(String planetName) + { + this.placeablePlanets.add(planetName); + } + public void setDefaultItemLimit(int itemLimit) + { + this.defaultItemLimit = itemLimit; + } + + public String getDeedTemplate() + { + return this.deedTemplate; + } + public String getBuildingTemplate() + { + return this.buildingTemplate; + } + public Map getBuildingSigns() + { + return this.buildingSigns; + } + public Vector getPlaceablePlanets() + { + return this.placeablePlanets; + } + public boolean canBePlacedOn(String planetName) + { + if(placeablePlanets.contains(planetName)) return true; + else return false; + } + public int getLotCost() + { + return this.lotCost; + } + public int getDefaultItemLimit() + { + return this.defaultItemLimit; + } +} diff --git a/src/services/housing/HousingService.java b/src/services/housing/HousingService.java new file mode 100644 index 00000000..3bcc9188 --- /dev/null +++ b/src/services/housing/HousingService.java @@ -0,0 +1,182 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services.housing; + +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.FileVisitor; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.Map; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; + +import com.sleepycat.persist.EntityCursor; + +import main.NGECore; +import protocol.swg.EnterStructurePlacementModeMessage; +import resources.objects.building.BuildingObject; +import resources.objects.creature.CreatureObject; +import resources.objects.player.PlayerObject; +import resources.objects.tangible.TangibleObject; +import services.chat.Mail; +import services.equipment.BonusSetTemplate; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class HousingService implements INetworkDispatch { + + private NGECore core; + private Map housingTemplates = new ConcurrentHashMap(); + + public HousingService(NGECore core) { + this.core = core; + core.commandService.registerCommand("placestructure"); + core.commandService.registerCommand("movefurniture"); + core.commandService.registerCommand("rotatefurniture"); + } + + public void enterStructureMode(CreatureObject actor, TangibleObject deed) + { + if(!actor.getClient().isGM() && !core.terrainService.canBuildAtPosition(actor, actor.getWorldPosition().x, actor.getWorldPosition().z)) + { + actor.sendSystemMessage("You may not place a structure here.", (byte) 0); // should probably load this from an stf + return; + } + + if(housingTemplates.containsKey(deed.getTemplate())) + { + HouseTemplate houseTemplate = housingTemplates.get(deed.getTemplate()); + EnterStructurePlacementModeMessage packet = new EnterStructurePlacementModeMessage(deed, houseTemplate.getBuildingTemplate()); + actor.getClient().getSession().write(packet.serialize()); + } + } + + public void placeStructure(final CreatureObject actor, TangibleObject deed, float positionX, float positionZ, float rotation) + { + HouseTemplate houseTemplate = housingTemplates.get(deed.getTemplate()); + + int structureLotCost = houseTemplate.getLotCost(); + String structureTemplate = houseTemplate.getBuildingTemplate(); + + if(!houseTemplate.canBePlacedOn(actor.getPlanet().getName())) + { + actor.sendSystemMessage("You may not place this structure on this planet.", (byte) 0); // should probably load this from an stf + return; + } + + if(!actor.getClient().isGM() && !core.terrainService.canBuildAtPosition(actor, positionX, positionZ)) + { + actor.sendSystemMessage("You may not place a structure here.", (byte) 0); // should probably load this from an stf + return; + } + + // Lot stuff + if(actor.getPlayerObject().getLotsRemaining() - structureLotCost < 0) + { + actor.sendSystemMessage("You do not have enough available lots to place this structure.", (byte) 0); // should probably load this from an stf + return; + } + actor.getPlayerObject().deductLots(structureLotCost); + + // Calculate our orientation and height + Quaternion quaternion = new Quaternion(1, 0, 0, 0); + quaternion = resources.common.MathUtilities.rotateQuaternion(quaternion, (float)((Math.PI/2) * rotation), new Point3D(0, 1, 0)); + + float positionY = core.terrainService.getHeight(actor.getPlanetId(), positionX, positionZ) + 2f; + + // Create the building + BuildingObject building = (BuildingObject) core.objectService.createObject(structureTemplate, 0, actor.getPlanet(), new Point3D(positionX, positionY, positionZ), quaternion); + core.simulationService.add(building, building.getPosition().x, building.getPosition().z, true); + + // Name the sign + TangibleObject sign = (TangibleObject) building.getAttachment("structureSign"); + String playerFirstName = actor.getCustomName().split(" ")[0]; + sign.setCustomName2(playerFirstName + "'s House"); + //building.add(sign); + + core.objectService.destroyObject(deed); + + // Structure management + Vector admins = new Vector<>(); + admins.add(actor.getObjectID()); + + building.setAttachment("structureOwner", actor.getObjectID()); + building.setAttachment("structureAdmins", admins); + + // Save structure to DB + //building.createTransaction(core.getBuildingODB().getEnvironment()); + //core.getBuildingODB().put(building, Long.class, BuildingObject.class, building.getTransaction()); + //building.getTransaction().commitSync(); + } + + @SuppressWarnings("unchecked") + public boolean getPermissions(SWGObject player, SWGObject container) + { + if(((Vector) container.getContainer().getAttachment("structureAdmins")).contains(player.getObjectID())) return true; + return false; + } + + public void addHousingTemplate(HouseTemplate houseTemplate) + { + housingTemplates.put(houseTemplate.getDeedTemplate(), houseTemplate); + } + + public void loadHousingTemplates() { + Path p = Paths.get("scripts/houses/"); + FileVisitor fv = new SimpleFileVisitor() + { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException + { + System.out.println("Loading housing template " + file.getFileName()); + core.scriptService.callScript("scripts/houses/", file.getFileName().toString().replace(".py", ""), "setup", core); + return FileVisitResult.CONTINUE; + } + }; + try + { + Files.walkFileTree(p, fv); + } + catch (IOException e) { e.printStackTrace(); } + } + + + + @Override + public void insertOpcodes(Map arg0, + Map arg1) { + // TODO Auto-generated method stub + + } + + @Override + public void shutdown() { + + } +} \ No newline at end of file diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index cb85e06d..6c5a44a4 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -877,7 +877,7 @@ public class ObjectService implements INetworkDispatch { * @param position The position as an offset to the parent object. * @param orientation The orientation as an offset to the parent object. */ - public void createChildObject(SWGObject parent, String template, Point3D position, Quaternion orientation, int cellNumber) { + public SWGObject createChildObject(SWGObject parent, String template, Point3D position, Quaternion orientation, int cellNumber) { if(cellNumber == -1) { @@ -907,15 +907,15 @@ public class ObjectService implements INetworkDispatch { child.setAttachment("cellNumber", cellNumber); //core.simulationService.add(child, x, z); - + return child; } - public void createChildObject(SWGObject parent, String template, float x, float y, float z, float qy, float qw) { - createChildObject(parent, template, new Point3D(x, y, z), new Quaternion(qw, 0, qy, 0), -1); + public SWGObject createChildObject(SWGObject parent, String template, float x, float y, float z, float qy, float qw) { + return createChildObject(parent, template, new Point3D(x, y, z), new Quaternion(qw, 0, qy, 0), -1); } - public void createChildObject(SWGObject parent, String template, float x, float y, float z, float qy, float qw, int cellNumber) { - createChildObject(parent, template, new Point3D(x, y, z), new Quaternion(qw, 0, qy, 0), cellNumber); + public SWGObject createChildObject(SWGObject parent, String template, float x, float y, float z, float qy, float qw, int cellNumber) { + return createChildObject(parent, template, new Point3D(x, y, z), new Quaternion(qw, 0, qy, 0), cellNumber); } public void loadBuildoutObjects(Planet planet) throws InstantiationException, IllegalAccessException {