diff --git a/nge.cfg b/nge.cfg deleted file mode 100644 index 328f9018..00000000 --- a/nge.cfg +++ /dev/null @@ -1,13 +0,0 @@ -#Tue Oct 30 18:21:38 CDT 2012 -ZONE.URL= -ZONE.PORT=44463 -LOGIN.URL= -LOGIN.PORT=44453 -LOGIN.SESSION_KEY_SIZE=24 -PING.PORT=44462 -DB.NAME=nge -DB.USER=postgres -DB.URL=localhost -DB.PASS=nge -GALAXY_ID=2 -GALAXY_NAME=Local Connection diff --git a/scripts/collections/exploration_badges.py b/scripts/collections/exploration_badges.py new file mode 100644 index 00000000..d864c169 --- /dev/null +++ b/scripts/collections/exploration_badges.py @@ -0,0 +1,76 @@ +import sys +import services.collections.CollectionService + + +def setup(collectionService): + +#Corellia + collectionService.registerExplorationBadge('corellia', 'bdg_exp_cor_rogue_corsec_base', 5175, 1644, 64) + collectionService.registerExplorationBadge('corellia', 'bdg_exp_cor_tyrena_theater', -5418, -6248, 64) + collectionService.registerExplorationBadge('corellia', 'bdg_exp_cor_bela_vistal_fountain', 6760, -5617, 32) + collectionService.registerExplorationBadge('corellia', 'bdg_exp_cor_rebel_hideout', -6530, 5967, 64) + collectionService.registerExplorationBadge('corellia', 'exp_cor_agrilat_swamp', 1389, 3756, 64) + +#Dantooine + collectionService.registerExplorationBadge('dantooine', 'bdg_exp_dan_dantari_village1', -3862, -5706, 16) + collectionService.registerExplorationBadge('dantooine', 'bdg_exp_dan_dantari_village2', -7156, -883, 32) + collectionService.registerExplorationBadge('dantooine', 'exp_dan_rebel_base', -6836, 5520, 32) + collectionService.registerExplorationBadge('dantooine', 'exp_dan_jedi_temple', 4195, 5203, 16) + +#Dathomir + collectionService.registerExplorationBadge('dathomir', 'exp_dat_tarpit', 668, -4835, 32) + collectionService.registerExplorationBadge('dathomir', 'exp_dat_sarlacc', -2101, 3165, 16) + collectionService.registerExplorationBadge('dathomir', 'exp_dat_escape_pod', -4437, 574, 32) + collectionService.registerExplorationBadge('dathomir', 'exp_dat_misty_falls_1', 3558, 1554, 32) + collectionService.registerExplorationBadge('dathomir', 'exp_dat_misty_falls_2', 3021, 1289, 32) + collectionService.registerExplorationBadge('dathomir', 'bdg_exp_dat_imp_prison', -6304, 753, 32) + collectionService.registerExplorationBadge('dathomir', 'bdg_exp_dat_crashed_ship', 5727, 1923, 32) + +#Endor + collectionService.registerExplorationBadge('endor', 'bdg_exp_end_ewok_tree_village', 4596, -2423, 32) + collectionService.registerExplorationBadge('endor', 'bdg_exp_end_ewok_lake_village', 1454, -3272, 32) + collectionService.registerExplorationBadge('endor', 'bdg_exp_end_dulok_village', 6051, -2477, 16) + collectionService.registerExplorationBadge('endor', 'bdg_exp_end_imp_outpost', -4628, -2273, 32) + +#Kashyyyk + collectionService.registerExplorationBadge('kashyyyk', 'exp_kash_kachirho_found', -660, -201, 64) + +#Lok + collectionService.registerExplorationBadge('lok', 'exp_lok_volcano', 3091, -4638, 32) + collectionService.registerExplorationBadge('lok', 'bdg_exp_lok_imp_outpost', -1814, -3086, 32) + collectionService.registerExplorationBadge('lok', 'bdg_exp_lok_kimogila_skeleton', 4562, -1156, 16) + +#Mustafar + collectionService.registerExplorationBadge('mustafar', 'exp_must_mustafar_found', 0, 0, 32) + +#Naboo + collectionService.registerExplorationBadge('naboo', 'exp_nab_gungan_sacred_place', -2066, -5423, 32) + collectionService.registerExplorationBadge('naboo', 'bdg_exp_nab_theed_falls_bottom', -4628, 4207, 32) + collectionService.registerExplorationBadge('naboo', 'bdg_exp_nab_deeja_falls_top', 5157, -1646, 32) + collectionService.registerExplorationBadge('naboo', 'bdg_exp_nab_amidalas_sandy_beach', -5828, -93, 32) + +#Rori + collectionService.registerExplorationBadge('rori', 'bdg_exp_ror_imp_camp', -5633, -5661, 32) + collectionService.registerExplorationBadge('rori', 'bdg_exp_ror_imp_hyperdrive_fac', -1130, 4544, 32) + collectionService.registerExplorationBadge('rori', 'bdg_exp_ror_rebel_outpost', 3664, -6501, 32) + collectionService.registerExplorationBadge('rori', 'bdg_exp_ror_kobala_spice_mine', 7371, 169, 32) + +#Talus + collectionService.registerExplorationBadge('talus', 'bdg_exp_tal_creature_village', 4133, 962, 32) + collectionService.registerExplorationBadge('talus', 'bdg_exp_tal_imp_base', -2184, 2405, 32) + collectionService.registerExplorationBadge('talus', 'bdg_exp_tal_imp_vs_reb_battle', -2452, 3846, 32) + collectionService.registerExplorationBadge('talus', 'bdg_exp_tal_aqualish_cave', -4425, -1414, 64) + +#Tatooine + collectionService.registerExplorationBadge('tatooine', 'exp_tat_lars_homestead', -2579, -5500, 32) + collectionService.registerExplorationBadge('tatooine', 'exp_tat_bens_hut', -4512, -2270, 16) + collectionService.registerExplorationBadge('tatooine', 'exp_tat_sarlacc_pit', -6176, -3372, 32) + collectionService.registerExplorationBadge('tatooine', 'exp_tat_escape_pod', -3931, -4397, 32) + collectionService.registerExplorationBadge('tatooine', 'exp_tat_krayt_skeleton', -4632, -4346, 16) + collectionService.registerExplorationBadge('tatooine', 'exp_tat_krayt_graveyard', 7396, 4478, 64) + collectionService.registerExplorationBadge('tatooine', 'exp_tat_tusken_pool', -3966, 6267, 32) + +#Yavin + collectionService.registerExplorationBadge('yavin4', 'exp_yav_temple_exar_kun', 5076, 5537, 32) + collectionService.registerExplorationBadge('yavin4', 'exp_yav_temple_blueleaf', -875, -2047, 32) + collectionService.registerExplorationBadge('yavin4', 'exp_yav_temple_woolamander', 519, -646, 32) diff --git a/scripts/commands/editbiography.py b/scripts/commands/editbiography.py new file mode 100644 index 00000000..cfdb755f --- /dev/null +++ b/scripts/commands/editbiography.py @@ -0,0 +1,10 @@ +import sys +from protocol.swg.objectControllerObjects import BiographyUpdate +from protocol.swg import ObjControllerMessage + +def setup(): + return + +def run(core, actor, target, commandString): + print ('do you do anything?!') + return \ No newline at end of file diff --git a/scripts/commands/inspire.py b/scripts/commands/inspire.py index 30df2e29..46a97aaf 100644 --- a/scripts/commands/inspire.py +++ b/scripts/commands/inspire.py @@ -10,9 +10,15 @@ def run(core, actor, target, commandString): print playerObject.getProfession() if not playerObject or playerObject.getProfession() != "entertainer_1a": return - - print 'x' - if actor.getPosture() != 0x09: + + if target is None or actor.getObjectId() == target.getObjectId(): + print ('Buffing Player: ' + str(target.getObjectId()) + ' or: ' + target.getCustomName()) + openBuffWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), actor.getObjectId()) + objController = ObjControllerMessage(11, openBuffWindow) + actor.getClient().getSession().write(objController.serialize()) + return + + if actor.getPosture() != 0x09 and target.getObjectId() != actor.getObjectId(): actor.sendSystemMessage('@performance:insp_buff_must_perform', 2) return diff --git a/scripts/commands/lfg.py b/scripts/commands/lfg.py index dc0033c5..4d22f5ca 100644 --- a/scripts/commands/lfg.py +++ b/scripts/commands/lfg.py @@ -1,4 +1,4 @@ -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): diff --git a/scripts/commands/newbiehelper.py b/scripts/commands/newbiehelper.py index cce8079c..277ecd01 100644 --- a/scripts/commands/newbiehelper.py +++ b/scripts/commands/newbiehelper.py @@ -1,4 +1,4 @@ -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): diff --git a/scripts/commands/requestbiography.py b/scripts/commands/requestbiography.py new file mode 100644 index 00000000..41ed2382 --- /dev/null +++ b/scripts/commands/requestbiography.py @@ -0,0 +1,24 @@ +import sys +from protocol.swg.objectControllerObjects import BiographyUpdate +from protocol.swg import ObjControllerMessage + + +# Called when open Character tab +def setup(): + return + +def run(core, actor, target, commandString): + + if actor is None: + return + + if target is None: + return + + tGhost = target.getSlottedObject('ghost') + + bioUpdate = BiographyUpdate(actor.getObjectId(), target.getObjectId(), tGhost.getBiography()) + objMsg = ObjControllerMessage(11, bioUpdate) + actor.getClient().getSession().write(objMsg.serialize()) + + return \ No newline at end of file diff --git a/scripts/commands/roleplay.py b/scripts/commands/roleplay.py index a862303d..312e93fc 100644 --- a/scripts/commands/roleplay.py +++ b/scripts/commands/roleplay.py @@ -1,5 +1,5 @@ from java.lang import Integer -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): diff --git a/scripts/commands/setbiography.py b/scripts/commands/setbiography.py new file mode 100644 index 00000000..2d113622 --- /dev/null +++ b/scripts/commands/setbiography.py @@ -0,0 +1,25 @@ +import sys +from protocol.swg.objectControllerObjects import BiographyUpdate +from protocol.swg import ObjControllerMessage + +def setup(): + return + +def run(core, actor, target, commandString): + if actor is None: + return + + if len(commandString) > 200: + return + + ghost = actor.getSlottedObject('ghost') + + if ghost is None: + return + + ghost.setBiography(commandString) + + bioUpdate = BiographyUpdate(actor.getObjectId(), actor.getObjectId(), commandString) + objMsg = ObjControllerMessage(11, bioUpdate) + actor.getClient().getSession().write(objMsg.serialize()) + return \ No newline at end of file diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 785de8d0..536a588b 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -1,5 +1,10 @@ import sys from engine.resources.scene import Point3D +from protocol.swg import CommPlayerMessage +from protocol.swg.objectControllerObjects import ShowLootBox +from protocol.swg import ObjControllerMessage +from engine.resources.objects import SWGObject +from jarray import array def setup(): return @@ -11,6 +16,9 @@ def run(core, actor, target, commandString): if not playerObject: return + if target is not None: + print ('has target!') + commandArgs = commandString.split(' ') command = commandArgs[0] if len(commandArgs) > 1: @@ -45,4 +53,24 @@ def run(core, actor, target, commandString): actor.addAbility(str(arg1)) actor.sendSystemMessage('You have learned ' + arg1 + '') + elif command == 'anim' and arg1: + actor.doSkillAnimation(arg1) + actor.sendSystemMessage('Performed ' + arg1 ,0) + + elif command == 'changeBio' and arg1: + actor.getSlottedObject('ghost').setBiography(arg1) + + elif command == 'rewardMe': + testObject = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_t21.iff', actor.getPlanet()) + testObject.setCustomName('Crush4r') + testObject.setStringAttribute('crafter', 'Wavescrub') + dGun = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_tc22_blaster.iff', actor.getPlanet()) + dGun.setCustomName('Supertoms Gun') + dGun.setStringAttribute('crafter', 'Wavescrub') + core.playerService.giveItems(actor, testObject, dGun) + return + + elif command == 'comm': + comm = CommPlayerMessage(actor.getObjectId()) + actor.getClient().getSession().write(comm.serialize()) return diff --git a/scripts/commands/transferitemarmor.py b/scripts/commands/transferitemarmor.py index 2b890936..bfd8486d 100644 --- a/scripts/commands/transferitemarmor.py +++ b/scripts/commands/transferitemarmor.py @@ -5,7 +5,8 @@ def setup(): def run(core, actor, target, commandString): if core.equipmentService.canEquip(actor, target) is False: - return + return + parsedMsg = commandString.split(' ', 3) objService = core.objectService diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py index 79ef9455..ee205206 100644 --- a/scripts/commands/transferitemmisc.py +++ b/scripts/commands/transferitemmisc.py @@ -7,6 +7,7 @@ def run(core, actor, target, commandString): if core.equipmentService.canEquip(actor, target) is False: return + parsedMsg = commandString.split(' ', 3) objService = core.objectService containerID = long(parsedMsg[1]) diff --git a/scripts/commands/transferitemweapon.py b/scripts/commands/transferitemweapon.py index 9b403eaf..2640ac0c 100644 --- a/scripts/commands/transferitemweapon.py +++ b/scripts/commands/transferitemweapon.py @@ -6,6 +6,7 @@ def setup(): def run(core, actor, target, commandString): if core.equipmentService.canEquip(actor, target) is False: return + parsedMsg = commandString.split(' ', 3) objService = core.objectService diff --git a/scripts/object/tangible/component/weapon/lightsaber/item_krayt_pearl_04_01.py b/scripts/object/tangible/component/weapon/lightsaber/item_krayt_pearl_04_01.py new file mode 100644 index 00000000..49c8246d --- /dev/null +++ b/scripts/object/tangible/component/weapon/lightsaber/item_krayt_pearl_04_01.py @@ -0,0 +1,6 @@ +import sys + +def setup(core, object): + object.setStringAttribute('crystal_owner', '\#FFFF00UNTUNED') + object.setStringAttribute('quality', 'Poor') + return \ No newline at end of file diff --git a/scripts/object/tangible/loot/generic_usable/item_bounty_hunter_clicky_01_02.py b/scripts/object/tangible/loot/generic_usable/item_bounty_hunter_clicky_01_02.py new file mode 100644 index 00000000..22d032c5 --- /dev/null +++ b/scripts/object/tangible/loot/generic_usable/item_bounty_hunter_clicky_01_02.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_bounty_hunter_clicky_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bounty_hunter_clicky_01_02') + object.setStringAttribute('class_required', 'Bounty Hunter') + return diff --git a/scripts/object/tangible/loot/generic_usable/item_force_sensitive_clicky_01_02.py b/scripts/object/tangible/loot/generic_usable/item_force_sensitive_clicky_01_02.py new file mode 100644 index 00000000..e6745838 --- /dev/null +++ b/scripts/object/tangible/loot/generic_usable/item_force_sensitive_clicky_01_02.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_force_sensitive_clicky_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_force_sensitive_clicky_01_02') + object.setStringAttribute('class_required', 'Jedi') + return diff --git a/scripts/object/tangible/terminal/terminal_bank.py b/scripts/object/tangible/terminal/terminal_bank.py index 4f068472..64205c68 100644 --- a/scripts/object/tangible/terminal/terminal_bank.py +++ b/scripts/object/tangible/terminal/terminal_bank.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'bank') + object.setAttachment('radial_filename', 'terminal/bank') core.mapService.addLocation(object.getPlanet(), 'Bank Terminal', object.getPosition().x, object.getPosition().z, 41, 42, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_cloning.py b/scripts/object/tangible/terminal/terminal_cloning.py index 91f80095..dc256f9a 100644 --- a/scripts/object/tangible/terminal/terminal_cloning.py +++ b/scripts/object/tangible/terminal/terminal_cloning.py @@ -1,6 +1,6 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'cloning_terminal') + object.setAttachment('radial_filename', 'terminal/cloning_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_travel.py b/scripts/object/tangible/terminal/terminal_travel.py index 160aac1c..07222fe6 100644 --- a/scripts/object/tangible/terminal/terminal_travel.py +++ b/scripts/object/tangible/terminal/terminal_travel.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'travel_terminal') + object.setAttachment('radial_filename', 'terminal/travel_terminal') return \ No newline at end of file diff --git a/scripts/object/tangible/travel/ticket_collector/ticket_collector.py b/scripts/object/tangible/travel/ticket_collector/ticket_collector.py index d243308d..a4dcc12f 100644 --- a/scripts/object/tangible/travel/ticket_collector/ticket_collector.py +++ b/scripts/object/tangible/travel/ticket_collector/ticket_collector.py @@ -1,5 +1,5 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'npc_ticket_collector') + object.setAttachment('radial_filename', 'npc/npc_ticket_collector') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bicep_l_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bicep_l_02_01.py new file mode 100644 index 00000000..9fa443b7 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bicep_l_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_bicep_l_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_bicep_l_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bicep_r_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bicep_r_02_01.py new file mode 100644 index 00000000..f8e88597 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bicep_r_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_bicep_r_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_bicep_r_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_boots_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_boots_02_01.py new file mode 100644 index 00000000..dcbb349e --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_boots_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_boots_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_boots_02_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bracer_l_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bracer_l_02_01.py new file mode 100644 index 00000000..5ca4b024 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bracer_l_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_bracer_l_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_bracer_l_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bracer_r_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bracer_r_02_01.py new file mode 100644 index 00000000..83bf330b --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_bracer_r_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_bracer_r_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_bracer_r_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_chest_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_chest_02_01.py new file mode 100644 index 00000000..815a1640 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_chest_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_chest_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_chest_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_gloves_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_gloves_02_01.py new file mode 100644 index 00000000..0edc69cc --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_gloves_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_gloves_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_gloves_02_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_helmet_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_helmet_02_01.py new file mode 100644 index 00000000..f798283c --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_helmet_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_helmet_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_helmet_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_leggings_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_leggings_02_01.py new file mode 100644 index 00000000..6ad62c58 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_bounty_hunter_roadmap_leggings_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_bounty_hunter_roadmap_leggings_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_bounty_hunter_roadmap_leggings_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bicep_l_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bicep_l_02_03.py new file mode 100644 index 00000000..67da6ef4 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bicep_l_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_bicep_l_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_bicep_l_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bicep_r_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bicep_r_02_03.py new file mode 100644 index 00000000..53f0fb21 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bicep_r_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_bicep_r_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_bicep_r_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_boots_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_boots_02_03.py new file mode 100644 index 00000000..5822a2dc --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_boots_02_03.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_boots_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_boots_02_03') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bracer_l_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bracer_l_02_03.py new file mode 100644 index 00000000..2c96e2dd --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bracer_l_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_bracer_l_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_bracer_l_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bracer_r_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bracer_r_02_03.py new file mode 100644 index 00000000..1fee94a5 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_bracer_r_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_bracer_r_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_bracer_r_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_chest_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_chest_02_03.py new file mode 100644 index 00000000..b17b98cc --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_chest_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_chest_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_chest_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_gloves_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_gloves_02_03.py new file mode 100644 index 00000000..54aab0ca --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_gloves_02_03.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_gloves_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_gloves_02_03') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_helmet_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_helmet_02_03.py new file mode 100644 index 00000000..91f77a60 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_helmet_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_helmet_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_helmet_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_leggings_02_03.py b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_leggings_02_03.py new file mode 100644 index 00000000..e77eef3a --- /dev/null +++ b/scripts/object/tangible/wearables/armor/ithorian_sentinel/armor_ithorian_roadmap_leggings_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_ithorian_roadmap_leggings_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_ithorian_roadmap_leggings_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bicep_l_02_03.py b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bicep_l_02_03.py new file mode 100644 index 00000000..765a3379 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bicep_l_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_wookiee_roadmap_bicep_l_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_wookiee_roadmap_bicep_l_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bicep_r_02_03.py b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bicep_r_02_03.py new file mode 100644 index 00000000..f25225df --- /dev/null +++ b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bicep_r_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_wookiee_roadmap_bicep_r_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_wookiee_roadmap_bicep_r_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bracer_l_02_03.py b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bracer_l_02_03.py new file mode 100644 index 00000000..808e135d --- /dev/null +++ b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bracer_l_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_wookiee_roadmap_bracer_l_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_wookiee_roadmap_bracer_l_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bracer_r_02_03.py b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bracer_r_02_03.py new file mode 100644 index 00000000..a2b95572 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_bracer_r_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_wookiee_roadmap_bracer_r_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_wookiee_roadmap_bracer_r_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_chest_02_03.py b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_chest_02_03.py new file mode 100644 index 00000000..15500015 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_chest_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_wookiee_roadmap_chest_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_wookiee_roadmap_chest_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_leggings_02_03.py b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_leggings_02_03.py new file mode 100644 index 00000000..ca4b2cfa --- /dev/null +++ b/scripts/object/tangible/wearables/armor/kashyyykian_hunting/armor_wookiee_roadmap_leggings_02_03.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_wookiee_roadmap_leggings_02_03') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_wookiee_roadmap_leggings_02_03') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_bounty_hunter_01_02.py b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_bounty_hunter_01_02.py new file mode 100644 index 00000000..c845f9fb --- /dev/null +++ b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_bounty_hunter_01_02.py @@ -0,0 +1,13 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_roadmap_belt_bounty_hunter_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_roadmap_belt_bounty_hunter_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 15) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 20) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 15) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 90) + return diff --git a/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_force_sensitive_01_02.py b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_force_sensitive_01_02.py new file mode 100644 index 00000000..e383382b --- /dev/null +++ b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_force_sensitive_01_02.py @@ -0,0 +1,13 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_roadmap_belt_force_sensitive_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_roadmap_belt_force_sensitive_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 15) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 20) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 15) + object.setStringAttribute('class_required', 'Jedi') + object.setIntAttribute('required_combat_level', 90) + return diff --git a/scripts/object/tangible/wearables/backpack/item_bounty_hunter_backpack_01_02.py b/scripts/object/tangible/wearables/backpack/item_bounty_hunter_backpack_01_02.py new file mode 100644 index 00000000..b1bdc206 --- /dev/null +++ b/scripts/object/tangible/wearables/backpack/item_bounty_hunter_backpack_01_02.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_bounty_hunter_backpack_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bounty_hunter_backpack_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 5) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 5) + object.setStringAttribute('class_required', 'Bounty Hunter') + return diff --git a/scripts/object/tangible/wearables/necklace/item_bounty_hunter_pendant_01_02.py b/scripts/object/tangible/wearables/necklace/item_bounty_hunter_pendant_01_02.py new file mode 100644 index 00000000..46555e1f --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_bounty_hunter_pendant_01_02.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_bounty_hunter_pendant_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bounty_hunter_pendant_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 12) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 12) + object.setStringAttribute('class_required', 'Bounty Hunter') + return diff --git a/scripts/object/tangible/wearables/necklace/item_force_sensitive_pendant_01_02.py b/scripts/object/tangible/wearables/necklace/item_force_sensitive_pendant_01_02.py new file mode 100644 index 00000000..37735e50 --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_force_sensitive_pendant_01_02.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_force_sensitive_pendant_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_force_sensitive_pendant_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 12) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 12) + object.setStringAttribute('class_required', 'Jedi') + return diff --git a/scripts/object/tangible/wearables/ring/aakuan_ring.py b/scripts/object/tangible/wearables/ring/aakuan_ring.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/aakuan_ring.py +++ b/scripts/object/tangible/wearables/ring/aakuan_ring.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_bounty_hunter_ring_01_02.py b/scripts/object/tangible/wearables/ring/item_bounty_hunter_ring_01_02.py new file mode 100644 index 00000000..e8042f0b --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_bounty_hunter_ring_01_02.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_bounty_hunter_ring_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bounty_hunter_ring_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 6) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 6) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setAttachment('radial_filename', 'ring/unity') + return diff --git a/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_01_02.py b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_01_02.py new file mode 100644 index 00000000..1219d4db --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_01_02.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_force_sensitive_ring_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_force_sensitive_ring_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 6) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 6) + object.setStringAttribute('class_required', 'Jedi') + object.setAttachment('radial_filename', 'ring/unity') + return diff --git a/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_02_01.py b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_02_01.py new file mode 100644 index 00000000..7fc2c243 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_force_sensitive_ring_02_01.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_force_sensitive_ring_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_force_sensitive_ring_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 5) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 5) + object.setStringAttribute('class_required', 'Jedi') + object.setAttachment('radial_filename', 'ring/unity') + return diff --git a/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py b/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py +++ b/scripts/object/tangible/wearables/ring/ring_gcw_imperial.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py b/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py +++ b/scripts/object/tangible/wearables/ring/ring_gcw_rebel.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_mark_hero.py b/scripts/object/tangible/wearables/ring/ring_mark_hero.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_mark_hero.py +++ b/scripts/object/tangible/wearables/ring/ring_mark_hero.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_nightsister.py b/scripts/object/tangible/wearables/ring/ring_nightsister.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_nightsister.py +++ b/scripts/object/tangible/wearables/ring/ring_nightsister.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_s01.py b/scripts/object/tangible/wearables/ring/ring_s01.py index dc6ea0b1..83da2342 100644 --- a/scripts/object/tangible/wearables/ring/ring_s01.py +++ b/scripts/object/tangible/wearables/ring/ring_s01.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/object/tangible/wearables/ring/ring_s02.py b/scripts/object/tangible/wearables/ring/ring_s02.py index 2ca3d3ca..f594fe2b 100644 --- a/scripts/object/tangible/wearables/ring/ring_s02.py +++ b/scripts/object/tangible/wearables/ring/ring_s02.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/object/tangible/wearables/ring/ring_s03.py b/scripts/object/tangible/wearables/ring/ring_s03.py index 418b5aa4..c4aa2f2f 100644 --- a/scripts/object/tangible/wearables/ring/ring_s03.py +++ b/scripts/object/tangible/wearables/ring/ring_s03.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/object/tangible/wearables/ring/ring_s03_quest.py b/scripts/object/tangible/wearables/ring/ring_s03_quest.py index ccad8904..2540ccc0 100644 --- a/scripts/object/tangible/wearables/ring/ring_s03_quest.py +++ b/scripts/object/tangible/wearables/ring/ring_s03_quest.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/ring_s04.py b/scripts/object/tangible/wearables/ring/ring_s04.py index 6410d76f..8eee5461 100644 --- a/scripts/object/tangible/wearables/ring/ring_s04.py +++ b/scripts/object/tangible/wearables/ring/ring_s04.py @@ -1,6 +1,7 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') return def equip(core, actor, object): diff --git a/scripts/object/tangible/wearables/robe/item_npe_fs_robe_02_02.py b/scripts/object/tangible/wearables/robe/item_npe_fs_robe_02_02.py index faf7ac17..d71c2f44 100644 --- a/scripts/object/tangible/wearables/robe/item_npe_fs_robe_02_02.py +++ b/scripts/object/tangible/wearables/robe/item_npe_fs_robe_02_02.py @@ -1,7 +1,6 @@ import sys def setup(core, object): - object.setStfFilename('static_item_n') object.setStfName('item_npe_fs_robe_02_02') object.setDetailFilename('static_item_d') @@ -10,4 +9,5 @@ def setup(core, object): object.setStringAttribute('protection_level', 'Faint') object.setStringAttribute('class_required', 'Jedi') object.setIntAttribute('required_combat_level', 20) + object.setAttachment('type', 'jedi_robe') return diff --git a/scripts/object/weapon/ranged/carbine/weapon_carbine_bh_roadmap_01_02.py b/scripts/object/weapon/ranged/carbine/weapon_carbine_bh_roadmap_01_02.py new file mode 100644 index 00000000..eb0efac8 --- /dev/null +++ b/scripts/object/weapon/ranged/carbine/weapon_carbine_bh_roadmap_01_02.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('weapon_carbine_bh_roadmap_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('weapon_carbine_bh_roadmap_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 5) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 30) + object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) + object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') + object.setStringAttribute('cat_wpn_damage.damage', '109-218') + object.setStringAttribute('cat_wpn_damage.range', '0-55m') + object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') + object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/rifle/weapon_rifle_bh_roadmap_01_02.py b/scripts/object/weapon/ranged/rifle/weapon_rifle_bh_roadmap_01_02.py new file mode 100644 index 00000000..ec585481 --- /dev/null +++ b/scripts/object/weapon/ranged/rifle/weapon_rifle_bh_roadmap_01_02.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('weapon_rifle_bh_roadmap_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('weapon_rifle_bh_roadmap_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 5) + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 50) + object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.8) + object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') + object.setStringAttribute('cat_wpn_damage.damage', '261-522') + object.setStringAttribute('cat_wpn_damage.range', '0-64m') + object.setStringAttribute('cat_wpn_damage.wpn_category', 'Rifle') + object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + return \ No newline at end of file diff --git a/scripts/radial/appearance.py b/scripts/radial/appearance.py new file mode 100644 index 00000000..4c184296 --- /dev/null +++ b/scripts/radial/appearance.py @@ -0,0 +1,16 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file diff --git a/scripts/radial/deed.py b/scripts/radial/deed.py new file mode 100644 index 00000000..633eb6db --- /dev/null +++ b/scripts/radial/deed.py @@ -0,0 +1,16 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + radials.add(RadialOptions(0, 61, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 61 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file diff --git a/scripts/radial/npc_ticket_collector.py b/scripts/radial/npc/npc_ticket_collector.py similarity index 100% rename from scripts/radial/npc_ticket_collector.py rename to scripts/radial/npc/npc_ticket_collector.py diff --git a/scripts/radial/ring/unity.py b/scripts/radial/ring/unity.py new file mode 100644 index 00000000..704268a4 --- /dev/null +++ b/scripts/radial/ring/unity.py @@ -0,0 +1,35 @@ +from resources.common import RadialOptions +from services.sui.SUIWindow import Trigger +import sys + +def createRadial(core, owner, target, radials): + + ghost = owner.getSlottedObject('ghost') + if ghost is None: + return + print (owner.getTargetId()) + print (owner.getObjectId()) + if ghost.getSpouseName() is None: + targetPlayer = core.objectService.getObject(owner.getTargetId()) + if targetPlayer is not None and targetPlayer.getSlottedObject('ghost') is not None: + radials.add(RadialOptions(0, 69, 1, 'Propose Unity')) + return + +def handleSelection(core, owner, target, option): + if option == 69 and target: + tGhost = core.objectService.getObject(owner.getTargetId()).getSlottedObject('ghost') + suiSvc = core.suiService + targetWindow = suiSvc.createMessageBox(3, 'Proposal', owner.getCustomName() + ' would like to marry you. Would you like to marry?', tGhost, owner, 10) + returnList = Vector() + targetWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSUI) + targetWindow.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleSUI) + suiSvc.openSUIWindow(targetWindow) + return + return + +def handleSUI(owner, window, eventType, returnList): + if eventType == 0: + ghost = owner.getSlottedObject('ghost') + ghost.setSpouseName("Waverunner") + return + return \ No newline at end of file diff --git a/scripts/radial/bank.py b/scripts/radial/terminal/bank.py similarity index 100% rename from scripts/radial/bank.py rename to scripts/radial/terminal/bank.py diff --git a/scripts/radial/cloning_terminal.py b/scripts/radial/terminal/cloning_terminal.py similarity index 100% rename from scripts/radial/cloning_terminal.py rename to scripts/radial/terminal/cloning_terminal.py diff --git a/scripts/radial/travel_terminal.py b/scripts/radial/terminal/travel_terminal.py similarity index 100% rename from scripts/radial/travel_terminal.py rename to scripts/radial/terminal/travel_terminal.py diff --git a/scripts/radial/travel_ticket.py b/scripts/radial/travel_ticket.py index a42df278..fbb150e9 100644 --- a/scripts/radial/travel_ticket.py +++ b/scripts/radial/travel_ticket.py @@ -2,7 +2,7 @@ from resources.common import RadialOptions import sys def createRadial(core, owner, target, radials): - radials.clear + radials.clear() radials.add(RadialOptions(0, 21, 1, 'Use Travel Ticket')) #radials.add(RadialOptions(0, 7, 1, '')) @@ -31,7 +31,7 @@ def handleSelection(core, owner, target, option): return if option == 15 and target: - core.commandService.callCommand(owner, 'serverdestroyobject', target, None) + core.objectService.destroyObject(target) return return diff --git a/scripts/radial/wearable.py b/scripts/radial/wearable.py new file mode 100644 index 00000000..4c184296 --- /dev/null +++ b/scripts/radial/wearable.py @@ -0,0 +1,16 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file diff --git a/scripts/roadmap/roadmap_rewards.py b/scripts/roadmap/roadmap_rewards.py index b1071bbc..a764248f 100644 --- a/scripts/roadmap/roadmap_rewards.py +++ b/scripts/roadmap/roadmap_rewards.py @@ -1,9 +1,122 @@ import sys def get(name): + # Jedi # + if name == 'item_force_sensitive_ring_02_01': + return "object/tangible/wearables/ring/shared_ring_s02.iff" if name == 'item_npe_fs_robe_02_02': return "object/tangible/wearables/robe/shared_robe_jedi_padawan.iff" if name == 'weapon_roadmap_lightsaber_02_02': - return "object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_s1.iff" \ No newline at end of file + return "object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_s1.iff" + + if name == 'item_force_sensitive_ring_01_02': + return "object/tangible/wearables/ring/shared_ring_s01.iff" + + if name == 'item_krayt_pearl_04_01': + return "object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff" + + if name == 'item_force_sensitive_pendant_01_02': + return "object/tangible/wearables/necklace/shared_necklace_s12.iff" + + if name == 'item_force_sensitive_clicky_01_02': + return "object/tangible/loot/generic_usable/shared_generic_crystal.iff" + + if name == 'item_roadmap_belt_force_sensitive_01_02': + return "object/tangible/wearables/armor/zam/shared_armor_zam_wesell_belt.iff" + + # Bounty Hunter # + + if name == 'item_bounty_hunter_backpack_01_02': + return "object/tangible/wearables/backpack/shared_backpack_s05.iff" + + if name == 'armor_bounty_hunter_roadmap_bicep_l_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bicep_l.iff" + + if name == 'armor_bounty_hunter_roadmap_bicep_r_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bicep_r.iff" + + if name == 'armor_bounty_hunter_roadmap_bracer_l_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bracer_l.iff" + + if name == 'armor_bounty_hunter_roadmap_bracer_r_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bracer_r.iff" + + if name == 'armor_bounty_hunter_roadmap_boots_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_boots.iff" + + if name == 'armor_bounty_hunter_roadmap_chest_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_chest_plate.iff" + + if name == 'armor_bounty_hunter_roadmap_gloves_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_gloves.iff" + + if name == 'armor_bounty_hunter_roadmap_helmet_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_helmet.iff" + + if name == 'armor_bounty_hunter_roadmap_leggings_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_leggings.iff" + + if name == 'armor_wookiee_roadmap_chest_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_chestplate.iff" + + if name == 'armor_wookiee_roadmap_leggings_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_leggings.iff" + + if name == 'armor_wookiee_roadmap_bicep_l_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bicep_l.iff" + + if name == 'armor_wookiee_roadmap_bicep_r_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bicep_r.iff" + + if name == 'armor_wookiee_roadmap_bracer_l_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bracer_l.iff" + + if name == 'armor_wookiee_roadmap_bracer_r_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bracer_r.iff" + + if name == 'armor_ithorian_roadmap_chest_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_chest_plate.iff" + + if name == 'armor_ithorian_roadmap_leggings_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_leggings.iff" + + if name == 'armor_ithorian_roadmap_helmet_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_helmet.iff" + + if name == 'armor_ithorian_roadmap_bicep_l_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_l.iff" + + if name == 'armor_ithorian_roadmap_bicep_r_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_r.iff" + + if name == 'armor_ithorian_roadmap_bracer_l_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_l.iff" + + if name == 'armor_ithorian_roadmap_bracer_r_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_r.iff" + + if name == 'armor_ithorian_roadmap_boots_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_boots.iff" + + if name == 'armor_ithorian_roadmap_gloves_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_gloves.iff" + + if name == 'weapon_carbine_bh_roadmap_01_02': + return "object/weapon/ranged/carbine/shared_carbine_ee3.iff" + + if name == 'item_bounty_hunter_ring_01_02': + return "object/tangible/wearables/ring/shared_ring_s02.iff" + + if name == 'weapon_rifle_bh_roadmap_01_02': + return "object/weapon/ranged/rifle/shared_rifle_lightning.iff" + + if name == 'item_bounty_hunter_pendant_01_02': + return "object/tangible/wearables/necklace/shared_necklace_s02.iff" + + if name == 'item_bounty_hunter_clicky_01_02': + return "object/tangible/loot/generic_usable/shared_survey_pad_adv_generic.iff" + + if name == 'item_roadmap_belt_bounty_hunter_01_02': + return "object/tangible/wearables/armor/zam/shared_armor_zam_wesell_belt.iff" \ No newline at end of file diff --git a/scripts/starter_clothing/combat_brawler_trandoshan_female.py b/scripts/starter_clothing/combat_brawler_trandoshan_female.py index 1f755bfe..6f71399c 100644 --- a/scripts/starter_clothing/combat_brawler_trandoshan_female.py +++ b/scripts/starter_clothing/combat_brawler_trandoshan_female.py @@ -1,6 +1,6 @@ import sys -def CombatBrawlerTrandoshanFemale(core, object): +def CombatBrawlerOutdoorScoutTrandoshanFemale(core, object): shirt = core.objectService.createObject('object/tangible/wearables/shirt/shared_shirt_s24.iff', object.getPlanet()) jacket = core.objectService.createObject('object/tangible/wearables/jacket/shared_jacket_s24.iff', object.getPlanet()) pants = core.objectService.createObject('object/tangible/wearables/pants/shared_pants_s25.iff', object.getPlanet()) @@ -8,4 +8,4 @@ def CombatBrawlerTrandoshanFemale(core, object): object._add(shirt) object._add(jacket) object._add(pants) - object._add(necklace) \ No newline at end of file + object._add(necklace) diff --git a/scripts/static_spawns/lok.py b/scripts/static_spawns/lok.py index acb0f8a6..e84b7994 100644 --- a/scripts/static_spawns/lok.py +++ b/scripts/static_spawns/lok.py @@ -1,5 +1,7 @@ import sys +from resources.datatables import Options +from resources.datatables import StateStatus def addPlanetSpawns(core, planet): diff --git a/scripts/static_spawns/naboo.py b/scripts/static_spawns/naboo.py index 86f073af..5432f13c 100644 --- a/scripts/static_spawns/naboo.py +++ b/scripts/static_spawns/naboo.py @@ -3,5 +3,145 @@ import sys def addPlanetSpawns(core, planet): stcSvc = core.staticService +# Theed Spawns + # OutSide + loruna = stcSvc.spawnObject('object/mobile/shared_loruna_scathe.iff', 'naboo', long(0), float(-5149), float(6), float(4286), float(0.34), float(0.93)) + loruna.setCustomName2('Loruna Scathe') + + pooja = stcSvc.spawnObject('object/mobile/shared_dressed_pooja_naberrie.iff', 'naboo', long(0), float(-5479.1), float(14), float(4467.3), float(-0.96), float(0.25)) + pooja.setCustomName2('Pooja Naberrie') + + vaikannaSilverlight = stcSvc.spawnObject('object/mobile/shared_dressed_herald_naboo_01.iff', 'naboo', long(0), float(-5484), float(10), float(4424), float(-0.93), float(0.34)) + vaikannaSilverlight.setCustomName2('Vaik\'anna Silverlight') + + hannaSkiyah = stcSvc.spawnObject('object/mobile/shared_dressed_herald_noble_twk_female_01.iff', 'naboo', long(0), float(-5480), float(-0.5), float(4398), float(0.44), float(0.89)) + hannaSkiyah.setCustomName2('Hanna S\'kiyah') +# Keren Spawns + # Cantina interior + lergoBrazee = stcSvc.spawnObject('object/mobile/shared_dressed_lergo_brazee.iff', 'naboo', long(5), float(2.8), float(-0.9), float(-5.3), float(0.25), float(0.96)) + lergoBrazee.setCustomName2('Lergo Brazee') + + # Starport interior + gavynSykes = stcSvc.spawnObject('object/mobile/shared_dressed_gavyn_sykes.iff', 'naboo', long(2125382), float(9.3), float(0.6), float(66.6), float(-0.90), float(0.42)) + gavynSykes.setCustomName2('Capt. Gavyn Sykes') + + #Miscellaneous Building Interiors + kritusMorven = stcSvc.spawnObject('object/mobile/shared_dressed_kritus_morven.iff', 'naboo', long(1685077), float(-3.9), float(-4.9), float(-7.5), float(-0.57), float(0.81)) + kritusMorven.setCustomName2('Kritus Morven') + + Raev = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_clone_relics_major_raev.iff', 'naboo', long(1393881), float(-10), float(1.7), float(-9.5), float(0.38), float(0.92)) + Raev.setCustomName2('Major Raev') + + # Outside + brennis = stcSvc.spawnObject('object/mobile/shared_dressed_brennis_doore.iff', 'naboo', long(0), float(1740), float(12), float(2657), float(-0.99), float(0)) + brennis.setCustomName2('Brennis Doore') + + demitri = stcSvc.spawnObject('object/mobile/shared_dressed_herald_servant_naboo_human_male.iff', 'naboo', long(0), float(1673), float(12), float(2582), float(0.31), float(0.94)) + demitri.setCustomName2('Demitri Firewatcher') + + ogden = stcSvc.spawnObject('object/mobile/shared_smuggler_broker_ogden.iff', 'naboo', long(0), float(1907), float(12), float(2352), float(0.97), float(0.22)) + ogden.setCustomName2('Ogden') + +# Kaadara Spawns + #Miscellaneous Building Interiors + barnSinkko = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_trainer_space_03.iff', 'naboo', long(1741494), float(-1.3), float(1.8), float(-14), float(-0.34), float(0.93)) + barnSinkko.setCustomName2('Lt. Barn Sinkko') + + # OutSide + dakk = stcSvc.spawnObject('object/mobile/shared_dressed_acklay_dakk.iff', 'naboo', long(0), float(5167), float(-192), float(6674), float(-0.99), float(0.04)) + dakk.setCustomName2('Dakk') + + panaka = stcSvc.spawnObject('object/mobile/shared_panaka.iff', 'naboo', long(0), float(5196.6), float(-192), float(6712.8), float(0.99), float(0.04)) + +# Dejaa Peak Spawns + + # OutSide + arvenWendik = stcSvc.spawnObject('object/mobile/shared_dressed_arven_wendik.iff', 'naboo', long(0), float(4710), float(330), float(-1432), float(-0.70), float(0.70)) + arvenWendik.setCustomName2('Arven Wendik') + + damaliaKorde = stcSvc.spawnObject('object/mobile/shared_dressed_damalia_korde.iff', 'naboo', long(0), float(5139), float(346.5), float(-1530.9), float(0.34), float(0.93)) + damaliaKorde.setCustomName2('Damalia Korde') + + hermanPate = stcSvc.spawnObject('object/mobile/shared_naboo_herman_pate.iff', 'naboo', long(0), float(4871.1), float(360.6), float(-1442.1), float(0), float(1)) + hermanPate.setCustomName2('Herman Pate') + + kimaNazith = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_female_03.iff', 'naboo', long(0), float(4972), float(360), float(-1583), float(-0.95), float(0.28)) + kimaNazith.setCustomName2('Kima Nazith') + + kippyMartin = stcSvc.spawnObject('object/mobile/shared_naboo_kippy_martin.iff', 'naboo', long(0), float(4324), float(295.1), float(-1250), float(0.55), float(0.82)) + kippyMartin.setCustomName2('Kippy Martin') + + ruab = stcSvc.spawnObject('object/mobile/shared_smuggler_fence_ruab.iff', 'naboo', long(0), float(4998), float(360), float(-1485), float(-0.34), float(0.93)) + ruab.setCustomName2('Ruab') + + tanoaVills = stcSvc.spawnObject('object/mobile/shared_naboo_tanoa_vills.iff', 'naboo', long(0), float(4740), float(330), float(-1322), float(-0.96), float(0.27)) + tanoaVills.setCustomName2('Tanoa Vills') + + vanceGroten = stcSvc.spawnObject('object/mobile/shared_naboo_vance_groten.iff', 'naboo', long(0), float(5144), float(346.5), float(-1530), float(-0.17), float(0.98)) + vanceGroten.setCustomName2('Vance Groten') + + walker = stcSvc.spawnObject('object/mobile/shared_naboo_walker_luskeske.iff', 'naboo', long(0), float(4994), float(360), float(-1506), float(-0.97), float(0.21)) + walker.setCustomName2('Walker Luskeske') + + zanier = stcSvc.spawnObject('object/mobile/shared_naboo_professor_hudmasse.iff', 'naboo', long(0), float(4690), float(330.2), float(-1391), float(0.52), float(0.84)) + zanier.setCustomName2('Professor Zanier Hudmasse') + +# Moenia Spawns + # Cantina interior + borvo = stcSvc.spawnObject('object/mobile/shared_borvo.iff', 'naboo', long(121), float(-29), float(-0.5), float(7.9), float(0.44), float(0.89)) + borvo.setCustomName2('Borvo The Hutt') + + # OutSide + c3tc = stcSvc.spawnObject('object/mobile/shared_3po_protocol_droid_silver.iff', 'naboo', long(0), float(4723), float(3.8), float(-4935), float(-0.99), float(0)) + c3tc.setCustomName2('C-3TC') + + dilvin = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_male_03.iff', 'naboo', long(0), float(4893), float(3.8), float(-4998), float(0.96), float(0.27)) + dilvin.setCustomName2('Dilvin Lormurojo') + + ebenn = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_male_02.iff', 'naboo', long(0), float(4869), float(3.8), float(-4875), float(-0.70), float(0.70)) + ebenn.setCustomName2('Ebenn Q3 Baobab') + + v3fx = stcSvc.spawnObject('object/mobile/shared_space_rebel_tier1_naboo_v3fx.iff', 'naboo', long(0), float(4764.2), float(6.1), float(-4795), float(0.99), float(0.08)) + v3fx.setCustomName2('V3-FX') + + roninLightrunner = stcSvc.spawnObject('object/mobile/shared_dressed_herald_naboo_02.iff', 'naboo', long(0), float(4810), float(6.3), float(-4977), float(0), float(1)) + roninLightrunner.setCustomName2('Ronin Lightrunner') + + dagorel = stcSvc.spawnObject('object/mobile/shared_dressed_gendra.iff', 'naboo', long(0), float(4471), float(4), float(-4714), float(-0.64), float(0.76)) + dagorel.setCustomName2('Dagorel') + +# Emperor's Retreat interior + kaja = stcSvc.spawnObject('object/mobile/shared_kaja_orzee.iff', 'naboo', long(1418872), float(1.9), float(0.2), float(-13.4), float(0), float(1)) + kaja.setCustomName2('Kaja Or\'Zee') + + ltVelso = stcSvc.spawnObject('object/mobile/shared_dressed_corvette_imperial_velso.iff', 'naboo', long(1418874), float(23.6), float(0.2), float(-19), float(-0.93), float(0.34)) + ltVelso.setCustomName2('Lt. Velso') + + royalGuard1 = stcSvc.spawnObject('object/mobile/shared_royal_guard.iff', 'naboo', long(1418874), float(17), float(0.2), float(-31), float(0), float(1)) + royalGuard2 = stcSvc.spawnObject('object/mobile/shared_royal_guard.iff', 'naboo', long(1418874), float(9), float(0.2), float(-31), float(0), float(1)) + + vrke = stcSvc.spawnObject('object/mobile/shared_space_imperial_tier3_naboo_vrke.iff', 'naboo', long(1418875), float(24.3), float(0.2), float(-39.6), float(0), float(1)) + vrke.setCustomName2('Inquisitor Vrke') + + loamRedge = stcSvc.spawnObject('object/mobile/shared_loam_redge.iff', 'naboo', long(1418875), float(18.6), float(0.2), float(-42), float(0.34), float(0.93)) + loamRedge.setCustomName2('Loam Redge') + + hethrir = stcSvc.spawnObject('object/mobile/shared_lord_hethrir.iff', 'naboo', long(1418876), float(4.6), float(0.2), float(-41.3), float(0), float(1)) + hethrir.setCustomName2('Lord Hethrir') + + jaceYiaso = stcSvc.spawnObject('object/mobile/shared_space_imperial_tier4_naboo_inquisitor.iff', 'naboo', long(1418884), float(-44), float(0.2), float(-31.9), float(0), float(1)) + jaceYiaso.setCustomName2('Grand Inquisitor Ja\'ce Yiaso') + + vader = stcSvc.spawnObject('object/mobile/shared_darth_vader.iff', 'naboo', long(1418884), float(-57), float(0.2), float(-24), float(0.70), float(0.70)) + + # Outside Emperor's Retreat + veers = stcSvc.spawnObject('object/mobile/naboo_npc/shared_veers.iff', 'naboo', long(0), float(2368), float(291), float(-3921), float(0.64), float(0.76)) + veers.setCustomName2('Colonel Veers') + + thrawn = stcSvc.spawnObject('object/mobile/naboo_npc/shared_thrawn.iff', 'naboo', long(0), float(2369), float(291), float(-3922), float(0.34), float(0.93)) + thrawn.setCustomName2('Captain Thrawn') + + fazoll = stcSvc.spawnObject('object/mobile/shared_space_imperial_tier2_naboo.iff', 'naboo', long(0), float(2444), float(292), float(-3896), float(-0.996194), float(0.087155)) + fazoll.setCustomName2('Inquisitor Fa\'Zoll') return \ No newline at end of file diff --git a/scripts/static_spawns/tatooine.py b/scripts/static_spawns/tatooine.py index 9817b21c..4fe1cad2 100644 --- a/scripts/static_spawns/tatooine.py +++ b/scripts/static_spawns/tatooine.py @@ -5,21 +5,34 @@ from resources.datatables import StateStatus def addPlanetSpawns(core, planet): stcSvc = core.staticService -# Wayfar Life Day, by Wefi + +# Wayfar Life Day, by Wefi, modified by Fingies - stcSvc.spawnObject('object/mobile/shared_lifeday_saun_dann.iff', 'tatooine', long(0), float(-5037.00), float(75), float(-6561), float(-0.75), float(0)) # Life Day - stcSvc.spawnObject('object/tangible/holiday/life_day/shared_main_lifeday_tree.iff', 'tatooine', long(0), float(-5043.00), float(75), float(-6541.00), float(0.999132931232), float(-0.0416347384453)) # Lifeday Tree - stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan.iff', 'tatooine', long(0), float(-5046.00), float(75), float(-6560), float(-0.75), float(0)) # LD Figrin - bandtat1 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5040.00), float(75), float(-6557), float(-0.75), float(0)) # LD Band 1 - bandtat1.setCustomName2('Doikk Nats') - bandtat2 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5043.00), float(75), float(-6559), float(-0.75), float(0)) # LD band 2 - bandtat2.setCustomName2('Tech Mor') - bandtat3 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5048.00), float(75), float(-6557), float(-0.75), float(0)) # LD Band 3 - bandtat3.setCustomName2('Nalan Cheel') - bandtat4 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5045.00), float(75), float(-6555), float(-0.75), float(0)) # LD band 4 - bandtat4.setCustomName2('Sunil Eide') - stcSvc.spawnObject('object/tangible/instrument/shared_nalargon.iff', 'tatooine', long(0), float(-5045.00), float(75), float(-6555), float(0.999132931232), float(-0.0416347384453)) # Drums - stcSvc.spawnObject('object/tangible/instrument/shared_ommni_box.iff', 'tatooine', long(0), float(-5043.00), float(75), float(-6559), float(0.999132931232), float(-0.0416347384453)) # Box +# stcSvc.spawnObject('object/mobile/shared_lifeday_saun_dann.iff', 'tatooine', long(0), float(-5037.00), float(75), float(-6561), float(-0.75), float(0)) # Life Day +# figlife = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan.iff', 'tatooine', long(0), float(-5046.00), float(75), float(-6560), float(-0.75), float(0)) # LD Figrin +# figlife.setCustomName2('Figrin D\'an') +# bandtat1 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5040.00), float(75), float(-6557), float(-0.75), float(0)) # LD Band 1 +# bandtat1.setCustomName2('Doikk Nats') +# bandtat2 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5043.00), float(75), float(-6559), float(-0.75), float(0)) # LD band 2 +# bandtat2.setCustomName2('Tech Mor') +# bandtat3 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5048.00), float(75), float(-6557), float(-0.75), float(0)) # LD Band 3 +# bandtat3.setCustomName2('Nalan Cheel') +# bandtat4 = stcSvc.spawnObject('object/mobile/shared_lifeday_figrin_dan_band.iff', 'tatooine', long(0), float(-5045.00), float(75), float(-6555), float(-0.75), float(0)) # LD band 4 +# bandtat4.setCustomName2('Sunil Eide') +# reblifevendor = stcSvc.spawnObject('object/mobile/shared_life_day_rebel_vendor.iff', 'tatooine', long(0), float(-5212.2), float(75.0), float(-6571.7), float(0.656), float(-0.7547)) #Rebel Wookiee Vendor +# reblifevendor.setCustomName2('Oolovv \(Wookiee Freedom Fighter)') +# reblifesold1 = stcSvc.spawnObject('object/mobile/shared_rebel_snow_m_01.iff', 'tatooine', long(0), float(-5208.8), float(75.0), float(-6569.6), float(0.669), float(-0.743)) #Rebel Vendor Guard 1 +# reblifesold1.setCustomName2('a Rebel Soldier') +# reblifesold2 = stcSvc.spawnObject('object/mobile/shared_rebel_snow_m_01.iff', 'tatooine', long(0), float(-5208.8), float(75.0), float(-6573.1), float(0.669), float(-0.743)) #Rebel Vendor Guard 2 +# reblifesold2.setCustomName2('a Rebel Soldier') +# implifevendor = stcSvc.spawnObject('object/mobile/shared_life_day_imperial_vendor.iff', 'tatooine', long(0), float(-5097.1), float(75.0), float(-6570.7), float(0.0087), float(-0.9999)) #Imp Vendor +# implifevendor.setCustomName2('Sstrigge \(Trandoshan \'Trader\')') +# implifesold1 = stcSvc.spawnObject('object/mobile/shared_snowtrooper_s01.iff', 'tatooine', long(0), float(-5092.2), float(75.0), float(-6569.0), float(0.0087), float(-0.9999)) #Imp Vendor Guard 1 +# implifesold1.setCustomName2('a Stormtrooper') +# implifesold2 = stcSvc.spawnObject('object/mobile/shared_snowtrooper_s01.iff', 'tatooine', long(0), float(-5100.8), float(75.0), float(-6569.4), float(0.0087), float(-0.9999)) #Imp Vendor Guard 2 +# implifesold2.setCustomName2('a Stormtrooper') +# stcSvc.spawnObject('object/tangible/instrument/shared_nalargon.iff', 'tatooine', long(0), float(-5045.00), float(75), float(-6555), float(0.999132931232), float(-0.0416347384453)) # Drums +# stcSvc.spawnObject('object/tangible/instrument/shared_ommni_box.iff', 'tatooine', long(0), float(-5043.00), float(75), float(-6559), float(0.999132931232), float(-0.0416347384453)) # Box # Mos Eisley Spawns: WORK IN PROGRESS by Levarris @@ -51,7 +64,7 @@ def addPlanetSpawns(core, planet): cantinaStormL.setCustomName2('a Stormtrooper Squad Leader') figrinDan = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(3.7), float(-0.9), float(-14.4), float(0.42), float(0.91)) - figrinDan.setCustomName2('Figrin Dan') + figrinDan.setCustomName2('Figrin D\'an') techMor = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(4.0), float(-0.9), float(-17.0), float(0.42), float(0.91)) techMor.setCustomName2('Tech M\'or') @@ -65,37 +78,37 @@ def addPlanetSpawns(core, planet): nalanCheel = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(0.5), float(-0.9), float(-17.1), float(0.42), float(0.91)) nalanCheel.setCustomName2('Nalan Cheel') - businessman1 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(1082877), float(10.7), float(-0.9), float(1.9), float(0.42), float(0.91)) + businessman1 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(1082877), float(11.0), float(-0.9), float(2.1), float(0.38), float(-0.92)) businessman1.setCustomName2('a Businessman') - commoner1 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_male_01.iff', 'tatooine', long(1082877), float(10.3), float(-0.9), float(2.7), float(0.42), float(0.91)) + commoner1 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_male_01.iff', 'tatooine', long(1082877), float(10.3), float(-0.9), float(2.7), float(0.82), float(0.57)) commoner1.setCustomName2('a Commoner') - entertainer1 = stcSvc.spawnObject('object/mobile/shared_dressed_entertainer_trainer_twk_female_01.iff', 'tatooine', long(1082877), float(9.4), float(-0.9), float(3.9), float(0.42), float(0.91)) + entertainer1 = stcSvc.spawnObject('object/mobile/shared_dressed_entertainer_trainer_twk_female_01.iff', 'tatooine', long(1082877), float(9.4), float(-0.9), float(3.9), float(0.38), float(-0.92)) entertainer1.setCustomName2('an Entertainer') - noble1 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_trandoshan_male_01.iff', 'tatooine', long(1082877), float(8.6), float(-0.9), float(4.8), float(0.42), float(0.91)) + noble1 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_trandoshan_male_01.iff', 'tatooine', long(1082877), float(8.6), float(-0.9), float(4.8), float(0.82), float(0.57)) noble1.setCustomName2('a Noble') - commoner2 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_female_01.iff', 'tatooine', long(1082877), float(4.1), float(-0.9), float(5.7), float(0.42), float(0.91)) + commoner2 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_female_01.iff', 'tatooine', long(1082877), float(4.1), float(-0.9), float(5.7), float(1), float(0)) commoner2.setCustomName2('a Commoner') - commoner3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_female_01.iff', 'tatooine', long(1082877), float(3.1), float(-0.9), float(5.9), float(0.42), float(0.91)) + commoner3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_female_01.iff', 'tatooine', long(1082877), float(3.1), float(-0.9), float(5.9), float(1), float(0)) commoner3.setCustomName2('a Commoner') - commoner4 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_twilek_male_01.iff', 'tatooine', long(1082877), float(1.7), float(-0.9), float(6.0), float(0.42), float(0.91)) + commoner4 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_twilek_male_01.iff', 'tatooine', long(1082877), float(1.7), float(-0.9), float(6.0), float(1), float(0)) commoner4.setCustomName2('a Commoner') - commoner5 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_male_01.iff', 'tatooine', long(1082877), float(-0.4), float(-0.9), float(5.9), float(0.42), float(0.91)) + commoner5 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_male_01.iff', 'tatooine', long(1082877), float(-0.4), float(-0.9), float(5.9), float(1), float(0)) commoner5.setCustomName2('a Commoner') - commoner6 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_05.iff', 'tatooine', long(1082877), float(16.0), float(-0.9), float(4.1), float(0.42), float(0.91)) + commoner6 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_05.iff', 'tatooine', long(1082877), float(16.0), float(-0.9), float(4.1), float(0), float(0)) commoner6.setCustomName2('a Commoner') - commoner7 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_zabrak_male_01.iff', 'tatooine', long(1082877), float(8.8), float(-0.9), float(-6.0), float(0.42), float(0.91)) + commoner7 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_zabrak_male_01.iff', 'tatooine', long(1082877), float(8.8), float(-0.9), float(-6.0), float(0.98), float(-0.22)) commoner7.setCustomName2('a Patron') - commoner8 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_08.iff', 'tatooine', long(1082877), float(6.8), float(-0.9), float(-6.5), float(0.42), float(0.91)) + commoner8 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_08.iff', 'tatooine', long(1082877), float(6.8), float(-0.9), float(-6.5), float(0.98), float(-0.22)) commoner8.setCustomName2('a Patron') commoner9 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_male_09.iff', 'tatooine', long(1082877), float(1.1), float(-0.9), float(-7.7), float(0.42), float(0.91)) @@ -104,20 +117,35 @@ def addPlanetSpawns(core, planet): commoner10 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_nikto_male_04.iff', 'tatooine', long(1082877), float(2.1), float(-0.9), float(-8.4), float(0.42), float(0.91)) commoner10.setCustomName2('a Commoner') + anetiaKahryn = stcSvc.spawnObject('object/mobile/shared_dressed_twk_entertainer.iff', 'tatooine', long(1082878), float(19.8), float(-0.9), float(-21), float(-0.03), float(0.99)) + anetiaKahryn.setCustomName2('Anetia Kah\'ryn') + + dravis = stcSvc.spawnObject('object/mobile/shared_space_privateer_tier1_tatooine.iff', 'tatooine', long(1082886), float(-21.7), float(-0.9), float(25.5), float(0.99), float(0.03)) + dravis.setCustomName2('Dravis') + + talonKarrde = stcSvc.spawnObject('object/mobile/shared_dressed_talon_karrde.iff', 'tatooine', long(1082887), float(-25.7), float(-0.5), float(8.8), float(0.21), float(0.97)) + talonKarrde.setCustomName2('Talon Karrde') + #Starport Interior + bartender1 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_nikto_male_04.iff', 'tatooine', long(1106380), float(-59.1), float(2.6), float(39.5), float(0), float(0)) + bartender1.setCustomName2('a Bartender') + #City Hall Interior #Lucky Despot Interior + hansolo1 = stcSvc.spawnObject('object/mobile/shared_han_solo.iff', 'tatooine', long(26949), float(32.3), float(7.0), float(1.6), float(0), float(0)) + hansolo1.setCustomName2('Han Solo') + #Medical Center Interior #Theater Interior #Miscellaneous Building Interiors - + #Outside - businessman2 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(0), float(3532.7), float(5.0), float(-4788.1), float(0), float(0)) + businessman2 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(0), float(3663.3), float(4.0), float(-4738.6), float(0), float(0)) businessman2.setCustomName2('a Businessman') noble2 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_01.iff', 'tatooine', long(0), float(3542.3), float(5.0), float(-4826.0), float(0.42), float(0.91)) @@ -126,40 +154,37 @@ def addPlanetSpawns(core, planet): commoner11 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_06.iff', 'tatooine', long(0), float(3529.1), float(5.0), float(-4900.4), float(0.42), float(0.91)) commoner11.setCustomName2('a Commoner') - businessman3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_male_02.iff', 'tatooine', long(0), float(3532.7), float(5.0), float(-4788.1), float(0), float(0)) + businessman3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_male_02.iff', 'tatooine', long(0), float(3595.7), float(5.0), float(-4740.1), float(0), float(0)) businessman3.setCustomName2('a Businessman') jawa1 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3663.3), float(5.0), float(-4858.6), float(0), float(0)) jawa1.setCustomName2('a Jawa') - commoner12 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_moncal_male_01.iff', 'tatooine', long(0), float(3532.7), float(5.0), float(-4788.1), float(0), float(0)) + commoner12 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_moncal_male_01.iff', 'tatooine', long(0), float(3490.3), float(5.0), float(-4799.4), float(0), float(0)) commoner12.setCustomName2('a Scientist') commoner13 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_zabrak_female_02.iff', 'tatooine', long(0), float(3559.7), float(5.0), float(-4725.9), float(0), float(0)) commoner13.setCustomName2('a Commoner') - commoner14 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_devaronian_male_01.iff', 'tatooine', long(0), float(3527.7), float(5.0), float(-4721.1), float(0), float(0)) + commoner14 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_devaronian_male_01.iff', 'tatooine', long(0), float(3527.7), float(5.0), float(-4721.1), float(0.71), float(0.71)) commoner14.setCustomName2('a Commoner') - commoner15 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_female_01.iff', 'tatooine', long(0), float(3513.7), float(5.0), float(-4740.4), float(0), float(0)) + commoner15 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_female_01.iff', 'tatooine', long(0), float(3514.9), float(5.0), float(-4737.8), float(0), float(0)) commoner15.setCustomName2('a Commoner') - ltHarburik = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_lt_harburik.iff', 'tatooine', long(0), float(3485.4), float(5.0), float(-4788.1), float(0), float(0)) - ltHarburik.setCustomName2('Lieutenant Harburik') - - jawa2 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3475.4), float(5.0), float(-4852.7), float(0), float(0)) + jawa2 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3485.2), float(4.9), float(-4859.2), float(0), float(0)) jawa2.setCustomName2('a Jawa') - jawa3 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3469.3), float(5.0), float(-4861.5), float(0), float(0)) + jawa3 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3465.3), float(5.0), float(-4860.1), float(0.71), float(-0.71)) jawa3.setCustomName2('a Jawa') - jawa4 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3486.1), float(5.0), float(-4884.7), float(0), float(0)) + jawa4 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3486.8), float(5.0), float(-4884.7), float(0.43051), float(-0.9025)) jawa4.setCustomName2('a Jawa') - jawa5 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3487.1), float(5.0), float(-4886.0), float(0), float(0)) + jawa5 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3487.1), float(5.0), float(-4886.0), float(0.95105), float(0.3090)) jawa5.setCustomName2('a Jawa') - jawa6 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3488.8), float(5.0), float(-4884.4), float(0), float(0)) + jawa6 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3488.8), float(5.0), float(-4884.4), float(0.3255), float(-0.9455)) jawa6.setCustomName2('a Jawa') jawa7 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3472.2), float(5.0), float(-4918.4), float(0), float(0)) @@ -171,22 +196,269 @@ def addPlanetSpawns(core, planet): jawa9 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3470.3), float(5.0), float(-4918.7), float(0), float(0)) jawa9.setCustomName2('a Jawa') - bib = stcSvc.spawnObject('object/mobile/shared_bib_fortuna.iff', 'tatooine', long(0), float(3552.4), float(5.0), float(-4933.2), float(0), float(0)) + bib = stcSvc.spawnObject('object/mobile/shared_bib_fortuna.iff', 'tatooine', long(0), float(3552.4), float(5.0), float(-4933.2), float(0.31730), float(-0.9483)) bib.setCustomName2('Bib Fortuna') + commoner16 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_06.iff', 'tatooine', long(0), float(3398.2), float(4.0), float(-4654.2), float(0.42), float(0.91)) + commoner16.setCustomName2('a Commoner') + + noble3 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_01.iff', 'tatooine', long(0), float(3396.3), float(4.0), float(-4774.1), float(0.42), float(0.91)) + noble3.setCustomName2('a Noble') + + entertainer1 = stcSvc.spawnObject('object/mobile/shared_dressed_entertainer_trainer_twk_female_01.iff', 'tatooine', long(0), float(3305.7), float(5.6), float(-4771.7), float(0), float(0)) + entertainer1.setCustomName2('an Entertainer') + + r3m6 = stcSvc.spawnObject('object/mobile/shared_r3.iff', 'tatooine', long(0), float(3460.1), float(4.0), float(-4898.2), float(0.38), float(-0.92)) + r3m6.setCustomName2('R3-M6') + + eg1 = stcSvc.spawnObject('object/mobile/shared_eg6_power_droid.iff', 'tatooine', long(0), float(3463.8), float(4.0), float(-4882.6), float(-0.38), float(0.92)) + eg1.setCustomName2('an EG-6 Power Droid') + + commoner17 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_zabrak_female_02.iff', 'tatooine', long(0), float(3452.6), float(4.0), float(-4937.1), float(0), float(0)) + commoner17.setCustomName2('a Commoner') + + lifter1 = stcSvc.spawnObject('object/mobile/shared_cll8_binary_load_lifter.iff', 'tatooine', long(0), float(3547), float(5.0), float(-4768.9), float(0), float(0)) + lifter1.setCustomName2('a CLL-8 Binary Load Lifter') + + r3j7 = stcSvc.spawnObject('object/mobile/shared_r3.iff', 'tatooine', long(0), float(3311.1), float(4.0), float(-4820.2), float(0.38), float(-0.92)) + r3j7.setCustomName2('R3-J7') + + noble4 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_03.iff', 'tatooine', long(0), float(3255.3), float(4.0), float(-4848.1), float(0.42), float(0.91)) + noble4.setCustomName2('a Noble') + + byxlePedette = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_byxle.iff', 'tatooine', long(0), float(3365), float(5), float(-4639), float(0.99), float(0.12)) + byxlePedette.setCustomName2('Byxle Pedette') + + errikDarksider = stcSvc.spawnObject('object/mobile/shared_dressed_herald_tatooine_01.iff', 'tatooine', long(0), float(3381), float(4.6), float(-4498), float(0.91), float(0.40)) + errikDarksider.setCustomName2('Errik Darksider') + + gendra = stcSvc.spawnObject('object/mobile/shared_dressed_gendra.iff', 'tatooine', long(0), float(3308), float(5.6), float(-4785), float(0.84), float(0.53)) + gendra.setCustomName2('Gendra') + + lurval = stcSvc.spawnObject('object/mobile/shared_lurval.iff', 'tatooine', long(0), float(3387), float(5), float(-4791), float(-0.4), float(0.91)) + lurval.setCustomName2('Lurval') + + matildaCarson = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_02.iff', 'tatooine', long(0), float(3490.2), float(5), float(-4778), float(0.87), float(0.48)) + matildaCarson.setCustomName2('Matilda Carson') + + vanvi = stcSvc.spawnObject('object/mobile/shared_dressed_bestine_artist01.iff', 'tatooine', long(0), float(3312), float(5), float(-4655), float(0.95), float(-0.28)) + vanvi.setCustomName2('Vanvi Hotn') + + #Eisley Legacy Quest NPCs + + vourk = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_santos.iff', 'tatooine', long(0), float(3520.0), float(5.0), float(-4821.0), float(0.42), float(0.91)) + vourk.setCustomName2('Vourk Ver\'Zremp') + + mayor = stcSvc.spawnObject('object/mobile/shared_dressed_mayor_mikdanyell_guhrantt.iff', 'tatooine', long(1279960), float(1.2), float(2.5), float(5.4), float(0), float(0)) + mayor.setCustomName2('Mayor Mikdanyell Guh\'rantt') + + enthaKandela = stcSvc.spawnObject('object/mobile/shared_dressed_entha_kandela.iff', 'tatooine', long(0), float(3511), float(5.0), float(-4785), float(0.70), float(0.71)) + enthaKandela.setCustomName2('Entha Kandela') + + purvis = stcSvc.spawnObject('object/mobile/shared_dressed_purvis_arrison.iff', 'tatooine', long(0), float(3512.4), float(5.0), float(-4764.9), float(0.38), float(-0.92)) + purvis.setCustomName2('Purvis Arrison') + + peawpRdawc = stcSvc.spawnObject('object/mobile/shared_peawp_bodyguard_trainer.iff', 'tatooine', long(1189639), float(-11.8), float(1.1), float(-10.1), float(0), float(0)) + peawpRdawc.setCustomName2('Peawp R\'dawc') + + peawpRdawc = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_niko.iff', 'tatooine', long(0), float(3506.7), float(5.0), float(-4795.8), float(0.70), float(0.71)) + peawpRdawc.setCustomName2('Niko Brehe') + + dunir = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_dunir.iff', 'tatooine', long(0), float(3520.7), float(5.0), float(-4683.7), float(0.99), float(-0.08)) + dunir.setCustomName2('Dunir') + + #Eisley Ship Controller + stcSvc.spawnObject('object/mobile/shared_distant_ship_controller.iff', 'tatooine', long(0), float(3542.3), float(5.0), float(-4826.0), float(0.42), float(0.91)) + # Mos Espa NPC Spawns + # Cantina Interior + dalaSocuna = stcSvc.spawnObject('object/mobile/shared_space_rebel_tier1_tatooine_socuna.iff', 'tatooine', long(1256068), float(-28.4), float(-0.5), float(9.4), float(0.33), float(0.94)) + dalaSocuna.setCustomName2('Commander Da\'la Socuna') + + watto = stcSvc.spawnObject('object/mobile/shared_watto.iff', 'tatooine', long(26670), float(4.7), float(-0.5), float(2.4), float(0.70), float(-0.71)) + watto.setCustomName2('Watto') + + #Exterior Uninteractables + commoner18 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_zabrak_female_02.iff', 'tatooine', long(0), float(-2915.3), float(5.0), float(2148.5), float(0), float(0)) + commoner18.setCustomName2('a Commoner') + + jawa10 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(-2966.3), float(5.0), float(2196.9), float(0), float(0)) + jawa10.setCustomName2('a Jawa') + commoner19 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_06.iff', 'tatooine', long(0), float(-2960.4), float(5.0), float(2271.3), float(0), float(0)) + commoner19.setCustomName2('a Commoner') + + commoner20 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_devaronian_male_01.iff', 'tatooine', long(0), float(-2934.3), float(5.0), float(2298.9), float(0.71), float(0.71)) + commoner20.setCustomName2('a Commoner') + + commoner21 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_01.iff', 'tatooine', long(0), float(-2897.7), float(5.0), float(2345.4), float(0.71), float(0.71)) + commoner21.setCustomName2('a Commoner') + + commoner22 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_twilek_male_01.iff', 'tatooine', long(0), float(-2763.8), float(5.0), float(2305.2), float(0.71), float(0.71)) + commoner22.setCustomName2('a Commoner') + + jawa11 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(-2936.8), float(5.0), float(2078.4), float(0.95105), float(0.3090)) + jawa11.setCustomName2('a Jawa') + + businessman4 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_male_02.iff', 'tatooine', long(0), float(-2914.2), float(5.0), float(2022.4), float(0), float(0)) + businessman4.setCustomName2('a Businessman') + + commoner23 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_moncal_male_01.iff', 'tatooine', long(0), float(-2904.1), float(5.0), float(1965.3), float(0.71), float(0.71)) + commoner23.setCustomName2('a Commoner') + # Mos Entha NPC Spawns - + #Outside + ankwee = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_entha_ankwee.iff', 'tatooine', long(0), float(1351), float(5.0), float(3108), float(0.42), float(0.91)) + ankwee.setCustomName2('An\'kwee') + # Bestine NPC Spawns + # City hall + indigoSiyan = stcSvc.spawnObject('object/mobile/shared_dressed_indigo_siyan.iff', 'tatooine', long(926483), float(24.7), float(3.2), float(-30.7), float(-0.06), float(0.99)) + indigoSiyan.setCustomName2('Indigo Siyan') + + keanna = stcSvc.spawnObject('object/mobile/shared_dressed_keanna_likyna.iff', 'tatooine', long(926480), float(-18.7), float(3.2), float(20.6), float(-0.97), float(0.2)) + keanna.setCustomName2('Keanna Li\'kyna') + + oberhaur = stcSvc.spawnObject('object/mobile/shared_space_imperial_tier2_tatooine_oberhaur.iff', 'tatooine', long(926480), float(-21.9), float(3.2), float(26.9), float(0.99), float(0.01)) + oberhaur.setCustomName2('Commander Oberhaur') + + seanTrenwell = stcSvc.spawnObject('object/mobile/shared_dressed_sean_trenwell.iff', 'tatooine', long(926483), float(19.4), float(3.2), float(-36), float(-0.06), float(0.99)) + seanTrenwell.setCustomName2('Sean Trenwell ') + + talmont = stcSvc.spawnObject('object/mobile/shared_prefect_talmont.iff', 'tatooine', long(926475), float(-1.9), float(3.1), float(-10.3), float(0.99), float(0)) + + tourAryon = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_tour_aryon.iff', 'tatooine', long(926479), float(-36.8), float(1.3), float(0.3), float(0.8), float(0.59)) + tourAryon.setCustomName2('Tour Aryon') + + victorVisalis = stcSvc.spawnObject('object/mobile/shared_dressed_victor_visalis.iff', 'tatooine', long(926480), float(-26.7), float(3.2), float(20.8), float(0.96), float(0.24)) + victorVisalis.setCustomName2('Victor Visalis') + + wilhalmSkrim = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_wilhalm_skrim.iff', 'tatooine', long(926482), float(28.9), float(1.3), float(-6.0), float(0.23), float(0.97)) + + #Miscellaneous Building Interiors + akalColzet = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_trainer_space_01.iff', 'tatooine', long(1212359), float(0.7), float(1.8), float(-14), float(0), float(0.99)) + akalColzet.setCustomName2('lt. Akal Colzet') + + fariousGletch = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_farious_gletch.iff', 'tatooine', long(1278989), float(2.0), float(-0.4), float(-5.7), float(-0.15), float(0.98)) + pfilbeeJhorn = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_pfilbee_jhorn.iff', 'tatooine', long(1279923), float(5.1), float(0.1), float(-3.8), float(-0.7), float(0.71)) + pfilbeeJhorn.setCustomName2('Pfilbee Jhorn') + + #Hotel interior + gilBurtin = stcSvc.spawnObject('object/mobile/shared_dressed_industrialist_trainer_01.iff', 'tatooine', long(1223850), float(20.3), float(1.6), float(12.8), float(0.99), float(0)) + gilBurtin.setCustomName2('Gil Burtin') + + # Outside + barak = stcSvc.spawnObject('object/mobile/shared_smuggler_broker_barak.iff', 'tatooine', long(0), float(-1049), float(5.0), float(-3537), float(0.97), float(0.23)) + barak.setCustomName2('Barak') + + barrezz = stcSvc.spawnObject('object/mobile/shared_dressed_dressed_legacy_barrezz.iff', 'tatooine', long(0), float(-1146.8), float(98.0), float(-3892.1), float(0.75), float(0.65)) + barrezz.setCustomName2('Commander Barrezz') + + jasha = stcSvc.spawnObject('object/mobile/shared_dressed_bestinejobs_jasha.iff', 'tatooine', long(0), float(-1128), float(98.0), float(-3900), float(-0.42), float(0.90)) + jasha.setCustomName2('Captain Jasha') + + dkrn = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_general_m.iff', 'tatooine', long(0), float(-1160), float(5.0), float(-3525), float(0.90), float(-0.41)) + dkrn.setCustomName2('Commander D\'krn') + + gunham = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_lieutenant_m.iff', 'tatooine', long(0), float(-1125), float(12.2), float(-3620), float(0.9), float(0.42)) + gunham.setCustomName2('Commander Gunham') + + kormundThrylle = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_kormund_thrylle.iff', 'tatooine', long(0), float(-1043), float(10.0), float(-3530), float(0.99), float(0.06)) + kormundThrylle.setCustomName2('Kormund Thrylle') + + calebKnolar = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_major_cold_m.iff', 'tatooine', long(0), float(-1149), float(98.0), float(-3903), float(0.42), float(0.91)) + calebKnolar.setCustomName2('Major Caleb Knolar') + # Anchorhead NPC Spawns + # Cantina Interior + borraSetas = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_rodian_female_03.iff', 'tatooine', long(1213345), float(9.8), float(0.4), float(-1.2), float(-0.65), float(0.75)) + borraSetas.setCustomName2('Borra Setas') + + # Outside + aaphKoden = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_aaph_koden.iff', 'tatooine', long(0), float(129), float(5.0), float(-5399), float(-0.67), float(0.73)) + aaphKoden.setCustomName2('Aaph Koden') + + Alger = stcSvc.spawnObject('object/mobile/shared_smuggler_fence_alger.iff', 'tatooine', long(0), float(107), float(5.0), float(-5315), float(0.96), float(0.26)) + Alger.setCustomName2('Alger') + + carhlaBastra = stcSvc.spawnObject('object/mobile/shared_dressed_legacy_bastra.iff', 'tatooine', long(0), float(128), float(5.0), float(-5428), float(-0.26), float(0.96)) + carhlaBastra.setCustomName2('Carh\'la Bastra') + + cuanTalon = stcSvc.spawnObject('object/mobile/shared_dressed_legacy_cuan.iff', 'tatooine', long(0), float(-161.7), float(65.0), float(-5322.8), float(0), float(0)) + cuanTalon.setCustomName2('Cuan Talon') + + dromaOrdo = stcSvc.spawnObject('object/mobile/shared_dressed_anchorjobs_ordo.iff', 'tatooine', long(0), float(110), float(52.0), float(-5431), float(0.36), float(0.93)) + dromaOrdo.setCustomName2('Droma Ordo') + + Sorna = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_tosche_sorna.iff', 'tatooine', long(0), float(-135), float(52.0), float(-5331), float(0.36), float(0.93)) + Sorna.setCustomName2('Sorna') + +# Lars Homestead + zefAndo = stcSvc.spawnObject('object/mobile/shared_dressed_legacy_zef.iff', 'tatooine', long(0), float(-2574.9), float(0), float(-5516.7), float(0), float(0)) + zefAndo.setCustomName2('Zef Ando') + +# Jawa Sandcrawler (legacy quest) + fa2po = stcSvc.spawnObject('object/mobile/shared_3po_protocol_droid.iff', 'tatooine', long(0), float(-3805.7), float(30.4), float(-4721.6), float(0), float(0)) + fa2po.setCustomName2('FA-2PO') + +# Darklighter Cache Cave (tat -260 -6930 not spawning from buildout) + + + # Mos Taike NPC Spawns # Wayfar NPC Spawns -# Jabba's Palace Theme Park Spawns +# Jabba's Palace Theme Park Spawns + + reelo = stcSvc.spawnObject('object/mobile/shared_reelo_baruk.iff', 'tatooine', long(26560), float(-3.5), float(0.2), float(113.5), float(0), float(0)) + reelo.setCustomName2('Reelo Baruk') + + reeyees = stcSvc.spawnObject('object/mobile/shared_dressed_gran_thug_male_01.iff', 'tatooine', long(26560), float(5.8), float(0.2), float(115.7), float(0.70), float(-0.71)) + reeyees.setCustomName2('Ree-Yees') + + ephant = stcSvc.spawnObject('object/mobile/shared_ephant_mon.iff', 'tatooine', long(26564), float(-6.1), float(5.8), float(86.1), float(0), float(0)) + ephant.setCustomName2('Ephant Mon') + + porcellus = stcSvc.spawnObject('object/mobile/shared_dressed_porcellus.iff', 'tatooine', long(26572), float(-44.0), float(3.0), float(63.4), float(0), float(0)) + porcellus.setCustomName2('Porcellus') + + barada = stcSvc.spawnObject('object/mobile/shared_barada.iff', 'tatooine', long(26596), float(31.2), float(0.2), float(-1.0), float(0.98), float(-0.17)) + barada.setCustomName2('Barada') + + bibMain = stcSvc.spawnObject('object/mobile/shared_bib_fortuna.iff', 'tatooine', long(26582), float(-11.1), float(2.0), float(49.5), float(0.70), float(0.71)) + bibMain.setCustomName2('Bib Fortuna') + + jabba = stcSvc.spawnObject('object/mobile/shared_jabba_the_hutt.iff', 'tatooine', long(26582), float(-17.0), float(2.8), float(44.9), float(0.70), float(0.71)) + jabba.setCustomName2('Jabba the Hutt') + + oola = stcSvc.spawnObject('object/mobile/shared_oola.iff', 'tatooine', long(26582), float(-10.3), float(2.0), float(43.9), float(0.70), float(-0.71)) + oola.setCustomName2('Oola') + oola.setCurrentAnimation('wave1') + + bobaFett = stcSvc.spawnObject('object/mobile/shared_boba_fett.iff', 'tatooine', long(26582), float(-1.0), float(3.0), float(33.1), float(0), float(0)) + bobaFett.setCustomName2('Boba Fett') + + ev9d9 = stcSvc.spawnObject('object/mobile/shared_ev_9d9.iff', 'tatooine', long(26574), float(18.8), float(0.2), float(78.7), float(1.0), float(0)) + ev9d9.setCustomName2('EV-9D9') + + malakili = stcSvc.spawnObject('object/mobile/shared_malakili.iff', 'tatooine', long(26599), float(17.3), float(-11.0), float(43.8), float(0), float(0)) + malakili.setCustomName2('Malakili') + #Need to somehow get the cellID for the Rancor Pit or it will NEVER be spawned. + + maxRebo = stcSvc.spawnObject('object/mobile/shared_max_rebo.iff', 'tatooine', long(26582), float(-1.4), float(3.0), float(26.9), float(0.42), float(-0.9)) + maxRebo.setCustomName2('Max Rebo') + + droopy = stcSvc.spawnObject('object/mobile/shared_droopy_mccool.iff', 'tatooine', long(26582), float(-3.9), float(3.0), float(26.1), float(0.42), float(-0.9)) + droopy.setCustomName2('Droopy McCool') + + sySnootles = stcSvc.spawnObject('object/mobile/shared_sy_snootles.iff', 'tatooine', long(26582), float(-1.4), float(3.0), float(29.8), float(0.42), float(-0.)) + sySnootles.setCustomName2('Sy Snootles') + + g5po = stcSvc.spawnObject('object/mobile/shared_3po_protocol_droid_red.iff', 'tatooine', long(26582), float(-14.3), float(2.0), float(47.4), float(0.70), float(0.71)) + g5po.setCustomName2('G5-PO') return - \ No newline at end of file + diff --git a/src/main/NGECore.java b/src/main/NGECore.java index c8ad5d16..48281f51 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -78,6 +78,7 @@ import services.LoginService; import services.map.MapService; import services.object.ObjectService; import services.object.UpdateService; +import services.retro.RetroService; import services.spawn.SpawnService; import services.sui.SUIService; import services.trade.TradeService; @@ -130,6 +131,7 @@ public class NGECore { // Services public LoginService loginService; + public RetroService retroService; public ConnectionService connectionService; public CommandService commandService; public CharacterService characterService; @@ -230,6 +232,7 @@ public class NGECore { // Services loginService = new LoginService(this); + retroService = new RetroService(this); connectionService = new ConnectionService(this); characterService = new CharacterService(this); mapService = new MapService(this); @@ -285,6 +288,7 @@ public class NGECore { // Zone Server zoneDispatch = new NetworkDispatch(this, true); + zoneDispatch.addService(retroService); zoneDispatch.addService(connectionService); zoneDispatch.addService(characterService); zoneDispatch.addService(factionService); @@ -357,6 +361,8 @@ public class NGECore { spawnService.loadLairGroups(); spawnService.loadSpawnAreas();*/ + retroService.run(); + didServerCrash = false; System.out.println("Started Server."); setGalaxyStatus(2); diff --git a/src/protocol/swg/CharacterSheetResponseMessage.java b/src/protocol/swg/CharacterSheetResponseMessage.java new file mode 100644 index 00000000..3e3dbc81 --- /dev/null +++ b/src/protocol/swg/CharacterSheetResponseMessage.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * 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 org.apache.mina.core.buffer.IoBuffer; + +import resources.objects.player.PlayerObject; +import engine.resources.common.CRC; + +public class CharacterSheetResponseMessage extends SWGMessage { + + private PlayerObject player; + public CharacterSheetResponseMessage(PlayerObject player) { + this.player = player; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + buffer.putShort((short) 12); + buffer.putInt(CRC.StringtoCRC("CharacterSheetResponseMessage")); + buffer.putShort((short) 0); //unk + buffer.putInt(1); // unk + + + buffer.putFloat(0); // bind x + buffer.putFloat(0); // bind z + buffer.putFloat(0); // bind y + buffer.putInt(0); // planet + + buffer.putFloat(0); // bank x + buffer.putFloat(0); // bank z + buffer.putFloat(0); // bank y + buffer.put(getAsciiString("tatooine")); // planet + + buffer.putFloat(0); // home x + buffer.putFloat(0); // home z + buffer.putFloat(0); // home y + buffer.putInt(0); // home planet + + if (player.getSpouseName() == null) + buffer.putInt(0); + else + buffer.put(getUnicodeString(player.getSpouseName())); // spouse name <<<<< CORRECT + + buffer.putInt(10); // lots remaining <<<<<<< CORRECT + return buffer.flip(); + } + +} diff --git a/src/protocol/swg/ChatFriendsListUpdate.java b/src/protocol/swg/ChatFriendsListUpdate.java index bd6debb0..962b2ad2 100644 --- a/src/protocol/swg/ChatFriendsListUpdate.java +++ b/src/protocol/swg/ChatFriendsListUpdate.java @@ -6,9 +6,6 @@ import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.config.Config; -import engine.resources.config.DefaultConfig; - public class ChatFriendsListUpdate extends SWGMessage { private String friendName; diff --git a/src/protocol/swg/CommPlayerMessage.java b/src/protocol/swg/CommPlayerMessage.java new file mode 100644 index 00000000..631d4c1c --- /dev/null +++ b/src/protocol/swg/CommPlayerMessage.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * 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 org.apache.mina.core.buffer.IoBuffer; + +import resources.common.Console; +import resources.common.StringUtilities; +import engine.resources.common.CRC; + +public class CommPlayerMessage extends SWGMessage { + + private long objectId; + + public CommPlayerMessage(long objectId) { + this.objectId = objectId; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(200).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putShort((short) 2); + buffer.putInt(0x594AD258); + + buffer.put((byte) 0); // aurebesh borders on comm, space version? Can cause crashes + + buffer.putLong(objectId); + + /*Seen numbers: + * 52 (Starting Station Comms) + * 54 (Tansarii Comms) + * 57 (Supply Drops) + * 58 (Faction Covert->Overt) + * 68 (Imperial stop) + * + */ + buffer.putInt(57); // unknown, changes for each comm message (counter?) + + buffer.putShort((short) 0); // unknonw flag, seems to do nothing + buffer.put((byte) 0); // unknown, always 0 except for imperial stop message + + buffer.putInt(0xFFFFFFFF); + + buffer.put(getAsciiString("stormtrooper")); // StfFile + buffer.putInt(0); // stf spacer + buffer.put(getAsciiString("u11")); // StfName + + buffer.putInt(0); // stf spacer + buffer.putLong(0); + buffer.putLong(0); + buffer.putLong(0); + buffer.putLong(0); // 70 bytes + buffer.putLong(0); + buffer.putLong(0); + buffer.putLong(0); + buffer.putLong(0); + buffer.put((byte) 0); + + // Officer Supply Drop: 0x3E894347 + // Rebel Faction Dude: 0x528CB3D7 + buffer.putInt(0x528CB3D7); // model crc, can be anything w/o crashing + + buffer.putInt(0); // sound + + buffer.putShort((short) 0); // unk + buffer.putShort((short) 16576); // comm display time, unsure on how it's calculated + buffer.flip(); + Console.println("CPM: " + StringUtilities.bytesToHex(buffer.array())); + return buffer; + } + +} diff --git a/src/resources/z/exp/group/MemberInfo.java b/src/protocol/swg/CreateClientPathMessage.java similarity index 55% rename from src/resources/z/exp/group/MemberInfo.java rename to src/protocol/swg/CreateClientPathMessage.java index a19fce7c..37a6d571 100644 --- a/src/resources/z/exp/group/MemberInfo.java +++ b/src/protocol/swg/CreateClientPathMessage.java @@ -19,64 +19,47 @@ * 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 resources.z.exp.group; +package protocol.swg; import java.nio.ByteOrder; +import java.util.List; import org.apache.mina.core.buffer.IoBuffer; -import com.sleepycat.persist.model.Persistent; +import resources.common.StringUtilities; +import engine.resources.common.CRC; +import engine.resources.scene.Point3D; -import resources.objects.Delta; +public class CreateClientPathMessage extends SWGMessage { -@Persistent -public class MemberInfo extends Delta { + private List coordinates; - private long info; - private int memberId; - - public MemberInfo(long info, int memberId) { - this.info = info; - this.memberId = memberId; + public CreateClientPathMessage(List coordinates) { + this.coordinates = coordinates; } - public MemberInfo() { + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate((coordinates.size() * 12) + 10).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putShort((short) 2); + buffer.putInt(CRC.StringtoCRC("CreateClientPathMessage")); - } - - public long getInfo() { - synchronized(objectMutex) { - return info; + buffer.putInt(coordinates.size()); + for(Point3D point : coordinates) { + buffer.putFloat(point.x); + buffer.putFloat(point.z); + buffer.putFloat(point.y); } + + buffer.flip(); + StringUtilities.printBytes(buffer.array()); + return buffer; } - - public MemberInfo setInfo(long info) { - synchronized(objectMutex) { - this.info = info; - return this; - } - } - - public int getMemberId() { - synchronized(objectMutex) { - return memberId; - } - } - - public MemberInfo setMemberId(int memberId) { - synchronized(objectMutex) { - this.memberId = memberId; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(12, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putLong(info); - buffer.putInt(memberId); - return buffer.array(); - } - } - + } diff --git a/src/protocol/swg/GuildRequestMessage.java b/src/protocol/swg/GuildRequestMessage.java new file mode 100644 index 00000000..211536e4 --- /dev/null +++ b/src/protocol/swg/GuildRequestMessage.java @@ -0,0 +1,34 @@ +package protocol.swg; + +import org.apache.mina.core.buffer.IoBuffer; + +import resources.common.Console; +import resources.common.StringUtilities; + +public class GuildRequestMessage extends SWGMessage { + + private long characterId; + + public GuildRequestMessage() { + } + + @Override + public void deserialize(IoBuffer data) { + //data.getShort(); + setCharacterId(data.getLong()); + } + + @Override + public IoBuffer serialize() { + return null; + } + + public long getCharacterId() { + return characterId; + } + + public void setCharacterId(long characterId) { + this.characterId = characterId; + } + +} diff --git a/src/resources/z/exp/manufacture/SubList.java b/src/protocol/swg/GuildResponseMessage.java similarity index 60% rename from src/resources/z/exp/manufacture/SubList.java rename to src/protocol/swg/GuildResponseMessage.java index 4a65aaa9..e0c8eb42 100644 --- a/src/resources/z/exp/manufacture/SubList.java +++ b/src/protocol/swg/GuildResponseMessage.java @@ -19,45 +19,43 @@ * 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 resources.z.exp.manufacture; +package protocol.swg; import java.nio.ByteOrder; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; import org.apache.mina.core.buffer.IoBuffer; -import com.sleepycat.persist.model.Persistent; +import resources.common.Console; +import resources.common.StringUtilities; +import resources.guild.Guild; +import resources.objects.creature.CreatureObject; -import resources.objects.Delta; -import resources.z.exp.objects.Baseline; +public class GuildResponseMessage extends SWGMessage { -@Persistent -public class SubList extends Delta { + private long player; + private String guildName; - private List list = new CopyOnWriteArrayList(); + public GuildResponseMessage(long player, String guild) { + this.player = player; + this.guildName = guild; + } - public SubList() { + @Override + public void deserialize(IoBuffer data) { + } - - public List getList() { - return list; + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(18 + guildName.length()).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putShort((short) 4); + buffer.putInt(0x32263F20); + + buffer.putLong(player); + buffer.put(getAsciiString(guildName)); + + return buffer.flip(); } - - public byte[] getBytes() { - synchronized(objectMutex) { - int size = 4; - for (o object : list) size += Baseline.toBytes(object).length; - - IoBuffer buffer = bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(list.size()); - for (o object : list) { - buffer.put(Baseline.toBytes(object)); - } - - return buffer.array(); - } - } - } diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index a664888c..af68bbe7 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -26,11 +26,13 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; + import protocol.swg.objectControllerObjects.CommandEnqueue; import protocol.swg.objectControllerObjects.DataTransform; import protocol.swg.objectControllerObjects.DataTransformWithParent; import protocol.swg.objectControllerObjects.ObjControllerObject; import protocol.swg.objectControllerObjects.UnknownObjController; +import resources.common.StringUtilities; public class ObjControllerMessage extends SWGMessage { @@ -56,6 +58,7 @@ public class ObjControllerMessage extends SWGMessage { public static final int BUFF_BUILDER_START = 0x025C; public static final int BUFF_BUILDER_CHANGE = 0x025A; public static final int UI_PLAY_EFFECT = 0x0401; + public static final int SHOW_LOOT_BOX = 0x04BC; public ObjControllerMessage() { @@ -79,7 +82,7 @@ public class ObjControllerMessage extends SWGMessage { buffer.putInt(0x80CE5E46); buffer.putInt(update); buffer.put(objControllerObject.serialize()); - //System.out.println("OBJMSG: " + buffer.flip().getHexDump()); + //System.out.println("OBJMSG: " + StringUtilities.bytesToHex(buffer.flip().array())); int size = buffer.position(); return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); } diff --git a/src/resources/z/exp/quest/Quest.java b/src/protocol/swg/PlayerMoneyResponse.java similarity index 65% rename from src/resources/z/exp/quest/Quest.java rename to src/protocol/swg/PlayerMoneyResponse.java index 9dfc1ae4..0438dd02 100644 --- a/src/resources/z/exp/quest/Quest.java +++ b/src/protocol/swg/PlayerMoneyResponse.java @@ -19,18 +19,39 @@ * 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 resources.z.exp.quest; +package protocol.swg; -import resources.objects.Delta; +import java.nio.ByteOrder; -public class Quest extends Delta { +import org.apache.mina.core.buffer.IoBuffer; + +public class PlayerMoneyResponse extends SWGMessage { + + int cash; + int bank; - public Quest() { + public PlayerMoneyResponse(int cash, int bank) { + this.cash = cash; + this.bank = bank; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(14).order(ByteOrder.LITTLE_ENDIAN); + buffer.putShort((short) 3); + buffer.putInt(0x367E737E); + + buffer.putInt(bank); + buffer.putInt(cash); + + buffer.flip(); + return buffer; } - - public byte[] getBytes() { - return new byte[] { }; - } - + } diff --git a/src/protocol/swg/SetWaypointColor.java b/src/protocol/swg/SetWaypointColor.java index bb53cd75..f7a418d9 100644 --- a/src/protocol/swg/SetWaypointColor.java +++ b/src/protocol/swg/SetWaypointColor.java @@ -26,8 +26,6 @@ import java.nio.ByteBuffer; import org.apache.mina.core.buffer.IoBuffer; -import resources.common.StringUtilities; - public class SetWaypointColor extends SWGMessage { private long objectId; diff --git a/src/protocol/swg/objectControllerObjects/Animation.java b/src/protocol/swg/objectControllerObjects/Animation.java index c3475969..957cf7d2 100644 --- a/src/protocol/swg/objectControllerObjects/Animation.java +++ b/src/protocol/swg/objectControllerObjects/Animation.java @@ -26,7 +26,6 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.ObjControllerMessage; -import protocol.swg.SWGMessage; public class Animation extends ObjControllerObject { @@ -45,7 +44,7 @@ public class Animation extends ObjControllerObject { @Override public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(36).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer result = IoBuffer.allocate(20 + animation.length()).order(ByteOrder.LITTLE_ENDIAN); result.putInt(ObjControllerMessage.ANIMATION); diff --git a/src/resources/z/exp/group/Member.java b/src/protocol/swg/objectControllerObjects/BiographyUpdate.java similarity index 57% rename from src/resources/z/exp/group/Member.java rename to src/protocol/swg/objectControllerObjects/BiographyUpdate.java index 93c5b64b..30e2f1a2 100644 --- a/src/resources/z/exp/group/Member.java +++ b/src/protocol/swg/objectControllerObjects/BiographyUpdate.java @@ -19,52 +19,47 @@ * 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 resources.z.exp.group; +package protocol.swg.objectControllerObjects; import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; -import com.sleepycat.persist.model.Persistent; +import protocol.swg.ObjControllerMessage; +import resources.common.Console; +import resources.common.StringUtilities; -import engine.resources.objects.SWGObject; - -import resources.objects.Delta; - -@Persistent -public class Member extends Delta { +public class BiographyUpdate extends ObjControllerObject { - private SWGObject member; + private long objectId; + private long targetObjectId; - public Member(SWGObject member) { - this.member = member; + private String biography; + + public BiographyUpdate(long objectId, long targetObjectId, String biography) { + this.objectId = objectId; + this.biography = biography; + this.targetObjectId = targetObjectId; } - - public Member() { + + @Override + public void deserialize(IoBuffer data) { + } - - public SWGObject getMember() { - synchronized(objectMutex) { - return member; - } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(28 + (biography.length() * 2)).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(0x000001DB); + buffer.putLong(objectId); // requester + buffer.putInt(0); + buffer.putLong(targetObjectId); + buffer.put(getUnicodeString(biography)); + + return buffer.flip(); } - public long getObjectId() { - return member.getObjectID(); - } - - public String getCustomName() { - return member.getCustomName(); - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(8 + getAsciiString(getCustomName()).length, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putLong(getObjectId()); - buffer.put(getAsciiString(getCustomName())); - return buffer.array(); - } - } } diff --git a/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java b/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java index 2cb16f10..7a458ead 100644 --- a/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java +++ b/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java @@ -21,12 +21,8 @@ ******************************************************************************/ package protocol.swg.objectControllerObjects; -import java.nio.ByteOrder; - import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.Utilities; - public class ChangeRoleIconChoice extends ObjControllerObject { private long objectId = 0; diff --git a/src/protocol/swg/objectControllerObjects/SecureTrade.java b/src/protocol/swg/objectControllerObjects/SecureTrade.java index e621072f..bd61aad4 100644 --- a/src/protocol/swg/objectControllerObjects/SecureTrade.java +++ b/src/protocol/swg/objectControllerObjects/SecureTrade.java @@ -27,8 +27,7 @@ public class SecureTrade extends ObjControllerObject{ @Override public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); - result.setAutoExpand(true); + IoBuffer result = IoBuffer.allocate(40).order(ByteOrder.LITTLE_ENDIAN); result.putInt(ObjControllerMessage.SPACIAL_CHAT); result.putInt(1); diff --git a/src/resources/z/exp/manufacture/Property.java b/src/protocol/swg/objectControllerObjects/ShowLootBox.java similarity index 53% rename from src/resources/z/exp/manufacture/Property.java rename to src/protocol/swg/objectControllerObjects/ShowLootBox.java index 254c1689..e295fc2d 100644 --- a/src/resources/z/exp/manufacture/Property.java +++ b/src/protocol/swg/objectControllerObjects/ShowLootBox.java @@ -19,66 +19,52 @@ * 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 resources.z.exp.manufacture; +package protocol.swg.objectControllerObjects; import java.nio.ByteOrder; +import java.util.List; import org.apache.mina.core.buffer.IoBuffer; -import com.sleepycat.persist.model.Persistent; +import engine.resources.objects.SWGObject; +import protocol.swg.ObjControllerMessage; +import resources.common.StringUtilities; -import resources.objects.Delta; +public class ShowLootBox extends ObjControllerObject { -@Persistent -public class Property extends Delta { + private long playerId; + private SWGObject[] rewards; - private int unused = 0; - private String key = ""; - private float value = 0; - - public Property(String key, float value) { - this.key = key; - this.value = value; + public ShowLootBox(long playerId, SWGObject[] rewards) { + this.playerId = playerId; + this.rewards = rewards; } - public Property() { + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + // Controller Type = 11 + IoBuffer buffer = IoBuffer.allocate(20 + (rewards.length * 8)).order(ByteOrder.LITTLE_ENDIAN); - } - - public String getKey() { - synchronized(objectMutex) { - return key; + buffer.putInt(ObjControllerMessage.SHOW_LOOT_BOX); + buffer.putLong(playerId); + + buffer.putInt(0); // 1 for a black background on icon, 0 or 2 for transparent (default) + + if (rewards.length == 1) { + buffer.putInt(1); + buffer.putLong(rewards[0].getObjectId()); + } else { + buffer.putInt(rewards.length); + for(SWGObject obj : rewards) { + buffer.putLong(obj.getObjectID()); + } } + return buffer.flip(); } - - public Property setKey(String key) { - synchronized(objectMutex) { - this.key = key; - return this; - } - } - - public float getValue() { - synchronized(objectMutex) { - return value; - } - } - - public Property setValue(float value) { - synchronized(objectMutex) { - this.value = value; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(8 + getAsciiString(key).length, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(unused); - buffer.put(getAsciiString(key)); - buffer.putFloat(value); - return buffer.array(); - } - } - + } diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 7d6e6b21..5834038e 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -26,6 +26,7 @@ public class ObjControllerOpcodes { public static final int DATA_TRANSFORM = 0x71000000; public static final int DATA_TRANSFORM_WITH_PARENT = 0xF1000000; public static final int COMMAND_QUEUE_ENQUEUE = 0x16010000; + public static final int COMMAND_QUEUE_REMOVE = 0x17010000; public static final int HOVER_TARGET = 0x26010000; // lookAtTarget public static final int TARGET_UPDATE = 0xC5040000; // intendedTarget public static final int OBJECT_MENU_REQUEST = 0x46010000; @@ -33,5 +34,4 @@ public class ObjControllerOpcodes { public static final int BUFF_BUILDER_CHANGE = 0x5A020000; public static final int MISSION_LIST_REQUEST = 0xF5000000; public static final int ChangeRoleIconChoice = 0x4D040000; - } diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index b9284791..f9284c25 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -29,8 +29,12 @@ public class Opcodes { public static int ChatInstantMessageToCharacter = 0x84BB21F7; public static int ChatPersistentMessageToServer = 0x25A29FA6; public static int ChatRequestPersistentMessage = 0x07E3559F; + public static int ChatRequestRoomList = 0x4C3D2CFA; public static int ChatSystemMessage = CRC.StringtoCRC("ChatSystemMessage"); public static int ClientOpenContainerMessage = 0x2D2D6EE1; + public static int CommodotiesItemTypeListRequest = 0x48F493C5; + public static int CommoditiesResourceTypeListRequest = 0xCB1AE82D; + public static int NewbieTutorialResponse = 0xCA88FBAD; public static int CmdSceneReady = 0x43FD1C22; public static int ConnectPlayerMessage = 0x2E365218; public static int ClientCreateCharacter = 0xB97F3074; @@ -59,5 +63,16 @@ public class Opcodes { public static int FactionRequestMessage = CRC.StringtoCRC("FactionRequestMessage"); public static int FactionResponseMessage = CRC.StringtoCRC("FactionResponseMessage"); public static int SetWaypointColor = CRC.StringtoCRC("SetWaypointColor"); + public static int GuildRequestMessage = CRC.StringtoCRC("GuildRequestMessage"); + public static int PlayerMoneyRequest = CRC.StringtoCRC("PlayerMoneyRequest"); + public static int LagReport = CRC.StringtoCRC("LagReport"); + public static int GetSpecificMapLocationsMessage = CRC.StringtoCRC("GetSpecificMapLocationsMessage"); + public static int SetCombatSpamFilter = CRC.StringtoCRC("SetCombatSpamFilter"); + public static int SetCombatSpamRangeFilter = CRC.StringtoCRC("SetCombatSpamRangeFilter"); + public static int SetLfgInterests = CRC.StringtoCRC("SetLfgInterests"); + public static int SetFurnitureRoationDegree = CRC.StringtoCRC("SetFurnitureRotationDegree"); + public static int SetJediSlotInfo = CRC.StringtoCRC("SetJediSlotInfo"); + public static int CollectionServerFirstListRequest = CRC.StringtoCRC("CollectionServerFirstListRequest"); + public static int Unknown = 0x173B91C2; // packet sent to server on every character load-in } diff --git a/src/resources/common/Stf.java b/src/resources/common/Stf.java index 191b2a60..1ebfc72a 100644 --- a/src/resources/common/Stf.java +++ b/src/resources/common/Stf.java @@ -23,7 +23,6 @@ package resources.common; import org.apache.mina.core.buffer.IoBuffer; -import resources.z.exp.objects.Baseline; import resources.objects.Delta; import com.sleepycat.persist.model.Persistent; @@ -85,7 +84,7 @@ public class Stf extends Delta { synchronized(objectMutex) { int size = stfFilename.getBytes().length + 4 + stfName.getBytes().length; - IoBuffer buffer = Baseline.createBuffer(size); + IoBuffer buffer = createBuffer(size); buffer.put(stfFilename.getBytes()); buffer.putInt(spacer); buffer.put(stfName.getBytes()); diff --git a/src/resources/common/StringUtilities.java b/src/resources/common/StringUtilities.java index a28bf368..e7d34d3a 100644 --- a/src/resources/common/StringUtilities.java +++ b/src/resources/common/StringUtilities.java @@ -27,6 +27,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import engine.resources.common.Utilities; + public class StringUtilities { final protected static char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; @@ -166,16 +168,20 @@ public class StringUtilities { } public static String bytesToHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - int v; - - for ( int j = 0; j < bytes.length; j++ ) { - v = bytes[j] & 0xFF; - hexChars[j * 2] = hexArray[v >>> 4]; - hexChars[j * 2 + 1] = hexArray[v & 0x0F]; - } - - return new String(hexChars); + char[] hexChars = new char[bytes.length * 2]; + int v; + + for ( int j = 0; j < bytes.length; j++ ) { + v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + + return new String(hexChars); + } + + public static void printBytes(byte[] bytes) { + System.out.println(Utilities.getHexString(bytes)); } } diff --git a/src/resources/common/UString.java b/src/resources/common/UString.java index 5aa290dc..dec215af 100644 --- a/src/resources/common/UString.java +++ b/src/resources/common/UString.java @@ -22,9 +22,6 @@ package resources.common; import java.io.UnsupportedEncodingException; -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; @@ -64,7 +61,7 @@ public final class UString extends Delta { public byte[] getBytes() { synchronized(objectMutex) { try { - return IoBuffer.allocate(4 + string.length(), false).order(ByteOrder.LITTLE_ENDIAN).putInt(string.length()).put(string.getBytes("UTF-16LE")).flip().array(); + return createBuffer(4 + (string.length() * 2)).putInt(string.length()).put(string.getBytes("UTF-16LE")).flip().array(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return new byte[] { 0x00, 0x00, 0x00, 0x00 }; diff --git a/src/resources/gcw/CurrentServerGCWZoneHistory.java b/src/resources/gcw/CurrentServerGCWZoneHistory.java index a7a77e98..66874d64 100644 --- a/src/resources/gcw/CurrentServerGCWZoneHistory.java +++ b/src/resources/gcw/CurrentServerGCWZoneHistory.java @@ -21,15 +21,13 @@ ******************************************************************************/ package resources.gcw; -import java.nio.ByteOrder; - import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; -@Persistent +@Persistent(version=0) public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { private int lastUpdateTime; @@ -40,6 +38,10 @@ public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { this.lastUpdateTime = zone.getLastUpdateTime(); } + public CurrentServerGCWZoneHistory() { + + } + public int getLastUpdateTime() { synchronized(objectMutex) { return lastUpdateTime; @@ -54,7 +56,7 @@ public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((8), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer(8); buffer.putInt(lastUpdateTime); buffer.putInt(percent); return buffer.array(); diff --git a/src/resources/gcw/CurrentServerGCWZonePercent.java b/src/resources/gcw/CurrentServerGCWZonePercent.java index 09034cf6..ea825d7a 100644 --- a/src/resources/gcw/CurrentServerGCWZonePercent.java +++ b/src/resources/gcw/CurrentServerGCWZonePercent.java @@ -23,7 +23,6 @@ package resources.gcw; import java.math.BigDecimal; import java.math.MathContext; -import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; @@ -33,7 +32,7 @@ import engine.resources.scene.Point2D; import resources.objects.Delta; -@Persistent +@Persistent(version=0) public class CurrentServerGCWZonePercent extends Delta implements Cloneable { private Point2D position; @@ -53,6 +52,10 @@ public class CurrentServerGCWZonePercent extends Delta implements Cloneable { this.percent = new BigDecimal("50.0", MathContext.DECIMAL128); } + public CurrentServerGCWZonePercent() { + + } + public Point2D getPosition() { synchronized(objectMutex) { return position.clone(); @@ -148,7 +151,7 @@ public class CurrentServerGCWZonePercent extends Delta implements Cloneable { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer(4); buffer.putInt(percent.intValue()); return buffer.array(); } diff --git a/src/resources/gcw/OtherServerGCWZonePercent.java b/src/resources/gcw/OtherServerGCWZonePercent.java index a006d7a8..ab8048eb 100644 --- a/src/resources/gcw/OtherServerGCWZonePercent.java +++ b/src/resources/gcw/OtherServerGCWZonePercent.java @@ -21,15 +21,13 @@ ******************************************************************************/ package resources.gcw; -import java.nio.ByteOrder; - import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; -@Persistent +@Persistent(version=0) public class OtherServerGCWZonePercent extends Delta implements Cloneable { private String zone = ""; @@ -39,6 +37,10 @@ public class OtherServerGCWZonePercent extends Delta implements Cloneable { this.zone = zone; } + public OtherServerGCWZonePercent() { + + } + public String getZone() { synchronized(objectMutex) { return zone; @@ -60,7 +62,7 @@ public class OtherServerGCWZonePercent extends Delta implements Cloneable { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((2 + zone.length() + 4), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer((2 + zone.length() + 4)); buffer.put(getAsciiString(zone)); buffer.putInt(percent); return buffer.array(); diff --git a/src/resources/guild/Guild.java b/src/resources/guild/Guild.java index 1cebf0f6..5651c2d0 100644 --- a/src/resources/guild/Guild.java +++ b/src/resources/guild/Guild.java @@ -21,15 +21,17 @@ ******************************************************************************/ package resources.guild; -import java.nio.ByteOrder; import java.util.List; import org.apache.mina.core.buffer.IoBuffer; +import com.sleepycat.persist.model.Persistent; + import resources.objects.Delta; import engine.resources.objects.SWGObject; +@Persistent(version=0) public class Guild extends Delta { private int id; @@ -46,6 +48,10 @@ public class Guild extends Delta { this.members.add(leader); } + public Guild() { + + } + public int getId() { synchronized(objectMutex) { return id; @@ -83,17 +89,19 @@ public class Guild extends Delta { } public String getString() { - synchronized(objectMutex) { - return (Integer.toString(id) + ":" + abbreviation); - } + return (Integer.toString(getId()) + ":" + getAbbreviation()); } public SWGObject getLeader() { - return leader; + synchronized(objectMutex) { + return leader; + } } public void setLeader(SWGObject leader) { - this.leader = leader; + synchronized(objectMutex) { + this.leader = leader; + } } public List getMembers() { @@ -102,7 +110,7 @@ public class Guild extends Delta { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((getString().length() + 2), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer((getString().length() + 2)); buffer.put(getAsciiString(getString())); return buffer.array(); } diff --git a/src/resources/objects/Delta.java b/src/resources/objects/Delta.java index 8b1e7f18..31782741 100644 --- a/src/resources/objects/Delta.java +++ b/src/resources/objects/Delta.java @@ -22,19 +22,27 @@ package resources.objects; import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; +import com.sleepycat.persist.model.NotPersistent; +import com.sleepycat.persist.model.Persistent; import resources.common.StringUtilities; - +@Persistent public abstract class Delta implements IDelta { - public Delta() { } - + @NotPersistent protected final Object objectMutex = new Object(); - public SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); + @NotPersistent + private static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); + + public Delta() { + + } protected String getAsciiString(ByteBuffer buffer) { return StringUtilities.getAsciiString(buffer); @@ -56,4 +64,8 @@ public abstract class Delta implements IDelta { return ((byte) ((variable) ? 1 : 0)); } + public static IoBuffer createBuffer(int size) { + return bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); + } + } diff --git a/src/resources/objects/SWGList.java b/src/resources/objects/SWGList.java index 1c72a400..ae185112 100644 --- a/src/resources/objects/SWGList.java +++ b/src/resources/objects/SWGList.java @@ -346,14 +346,19 @@ public class SWGList implements List { private byte[] item(int type, int index, byte[] data, boolean useIndex, boolean useData) { int size = 1 + ((useIndex) ? 2 : 0) + ((useData) ? data.length : 0); - + + if (messageBuilder == null) { + updateCounter++; + return new byte[] { }; + } + IoBuffer buffer = messageBuilder.bufferPool.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); buffer.put((byte) type); if (useIndex) buffer.putShort((short) index); if (useData) buffer.put(data); - + updateCounter++; - + return buffer.array(); } diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index ece8a6a4..56239f1c 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -90,8 +90,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { private float slopeModAngle = 1; private float slopeModPercent = 1; private float turnRadius = 1; - private float walkSpeed = (float) 2.75; - private float waterModPercent = 1; + private float walkSpeed = (float) 1.549; + private float waterModPercent = (float) 0.75; private SWGList abilities; private int abilitiesUpdateCounter = 0; diff --git a/src/resources/objects/player/PlayerMessageBuilder.java b/src/resources/objects/player/PlayerMessageBuilder.java index ace201df..ca901719 100644 --- a/src/resources/objects/player/PlayerMessageBuilder.java +++ b/src/resources/objects/player/PlayerMessageBuilder.java @@ -28,6 +28,7 @@ import java.util.Map.Entry; import org.apache.mina.core.buffer.IoBuffer; import engine.resources.common.CRC; +import resources.common.StringUtilities; import resources.objects.ObjectMessageBuilder; import resources.objects.waypoint.WaypointObject; @@ -362,7 +363,7 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { PlayerObject player = (PlayerObject) object; player.setXpListUpdateCounter(player.getXpListUpdateCounter() + 1); - IoBuffer result = bufferPool.allocate(17 + type.length(), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer result = bufferPool.allocate(15 + type.length(), false).order(ByteOrder.LITTLE_ENDIAN); result.putInt(1); result.putInt(player.getXpListUpdateCounter()); @@ -372,12 +373,23 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { int size = result.position(); result.flip(); - result = createDelta("PLAY", (byte) 8, (short) 1, (short) 0, result, size + 4); - return result; } + public IoBuffer buildProfessionWheelPositionDelta(String professionWheelPosition) { + IoBuffer buffer = bufferPool.allocate(2 + professionWheelPosition.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(professionWheelPosition)); + + int size = buffer.position(); + buffer.flip(); + + buffer = createDelta("PLAY", (byte) 8, (short) 1, (short) 8, buffer, size + 4); + return buffer; + + } + public IoBuffer buildWaypointAddDelta(WaypointObject waypoint) { PlayerObject player = (PlayerObject) object; diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 54738f72..ae29a905 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import resources.common.Console; import resources.objects.intangible.IntangibleObject; import resources.objects.waypoint.WaypointObject; @@ -41,7 +42,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=3) +@Persistent(version=5) public class PlayerObject extends IntangibleObject { // PLAY 3 @@ -116,6 +117,9 @@ public class PlayerObject extends IntangibleObject { private int jediState = 0; // unused in NGE + private String biography = ""; + private String spouse; + @NotPersistent private PlayerMessageBuilder messageBuilder; @@ -228,6 +232,8 @@ public class PlayerObject extends IntangibleObject { synchronized(objectMutex) { xpExists = xpList.containsKey(type); xpList.put(type, amount); + Console.println("Put " + type + " exp of " + amount + " in the map."); + Console.println("Map is now: " + xpList.get(type).intValue()); } if (getContainer() != null && getContainer().getClient() != null && getContainer().getClient().getSession() != null) { @@ -342,6 +348,9 @@ public class PlayerObject extends IntangibleObject { synchronized(objectMutex) { this.professionWheelPosition = professionWheelPosition; } + if (getContainer() != null && getContainer().getClient() != null && getContainer().getClient().getSession() != null) { + getContainer().getClient().getSession().write(messageBuilder.buildProfessionWheelPositionDelta(professionWheelPosition)); + } } public int getExperimentationFlag() { @@ -664,6 +673,26 @@ public class PlayerObject extends IntangibleObject { } } + public String getBiography() { + return biography; + } + + public void setBiography(String biography) { + synchronized(objectMutex) { + this.biography = biography; + } + } + + public String getSpouseName() { + return spouse; + } + + public void setSpouseName(String spouse) { + synchronized(objectMutex) { + this.spouse = spouse; + } + } + public int getFlagBitmask() { synchronized(objectMutex) { return flagBitmask; diff --git a/src/resources/objects/tangible/TangibleMessageBuilder.java b/src/resources/objects/tangible/TangibleMessageBuilder.java index 2a930abf..92d525ee 100644 --- a/src/resources/objects/tangible/TangibleMessageBuilder.java +++ b/src/resources/objects/tangible/TangibleMessageBuilder.java @@ -140,6 +140,16 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { } + public IoBuffer buildCustomNameDelta(String customName) { + IoBuffer buffer = bufferPool.allocate(getUnicodeString(customName).length, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.put(getUnicodeString(customName)); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("TANO", (byte) 3, (short) 1, (short) 2, buffer, size + 4); + return buffer; + + } + @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { // TODO Auto-generated method stub diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index e766c0ad..587daa91 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -87,6 +87,12 @@ public class TangibleObject extends SWGObject { super(); messageBuilder = new TangibleMessageBuilder(this); } + + public void setCustomName2(String customName) { + setCustomName(customName); + + notifyObservers(messageBuilder.buildCustomNameDelta(customName), true); + } public int getIncapTimer() { return incapTimer; diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 8caa651e..17325be5 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -154,7 +154,10 @@ public class WeaponObject extends TangibleObject { } public int getDamagePerSecond() { - return (int) (((getMaxDamage() + getElementalDamage() + getMinDamage() + getElementalDamage()) / 2 + getElementalDamage()) * (1 / getAttackSpeed())); + if (getElementalType() != null) + return (int) (((getMaxDamage() + getElementalDamage() + getMinDamage() + getElementalDamage()) / 2 + getElementalDamage()) * (1 / getAttackSpeed())); + else + return (int) (((getMaxDamage() + getMinDamage()) / 2 ) * (1 / getAttackSpeed())); } public int getWeaponType() { diff --git a/src/resources/z/exp/buffs/Buff.java b/src/resources/z/exp/buffs/Buff.java deleted file mode 100644 index dc6259d6..00000000 --- a/src/resources/z/exp/buffs/Buff.java +++ /dev/null @@ -1,324 +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 resources.z.exp.buffs; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.buffer.SimpleBufferAllocator; - -import resources.objects.IDelta; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clientdata.ClientFileManager; -import engine.clientdata.visitors.DatatableVisitor; - -@Persistent(version=3) -public class Buff implements IDelta { - - @NotPersistent - private SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - private float duration; - private String buffName; - private long ownerId; - private String effect1Name, effect2Name, effect3Name, effect4Name, effect5Name; - private float effect1Value, effect2Value, effect3Value, effect4Value, effect5Value; - private String particleEffect; - private boolean isDebuff; - private boolean removeOnDeath; - private boolean isRemovableByPlayer; - private int maxStacks; - private boolean isPersistent; - private boolean removeOnRespec; - private boolean aiRemoveOnEndCombat; - private boolean decayOnPvPDeath; - private long startTime; - private int totalPlayTime; - - public Buff(String buffName, long ownerId) { - this.buffName = buffName; - this.ownerId = ownerId; - - DatatableVisitor visitor; - - try { - - visitor = ClientFileManager.loadFile("datatables/buff/buff.iff", DatatableVisitor.class); - - for (int i = 0; i < visitor.getRowCount(); i++) { - - if (visitor.getObject(i, 0) != null) { - - if (((String) visitor.getObject(i, 0)).equalsIgnoreCase(buffName)) { - - duration = (Float) visitor.getObject(i, 6); - effect1Name = (String) visitor.getObject(i, 7); - effect1Value = (Float) visitor.getObject(i, 8); - effect2Name = (String) visitor.getObject(i, 9); - effect2Value = (Float) visitor.getObject(i, 10); - effect3Name = (String) visitor.getObject(i, 11); - effect3Value = (Float) visitor.getObject(i, 12); - effect4Name = (String) visitor.getObject(i, 13); - effect4Value = (Float) visitor.getObject(i, 14); - effect5Name = (String) visitor.getObject(i, 15); - effect5Value = (Float) visitor.getObject(i, 16); - particleEffect = (String) visitor.getObject(i, 19); - isDebuff = (Boolean) visitor.getObject(i, 22); - removeOnDeath = (Integer) visitor.getObject(i, 25) != 0; - isRemovableByPlayer = (Integer) visitor.getObject(i, 26) != 0; - maxStacks = (Integer) visitor.getObject(i, 28); - isPersistent = (Integer) visitor.getObject(i, 29) != 0; - removeOnRespec = (Integer) visitor.getObject(i, 31) != 0; - aiRemoveOnEndCombat = (Integer) visitor.getObject(i, 32) != 0; - decayOnPvPDeath = (Integer) visitor.getObject(i, 33) != 0; - - } - - } - - } - - } catch (InstantiationException | IllegalAccessException e) { - e.printStackTrace(); - } - } - - public Buff() { - - } - - public byte[] getBytes() { - IoBuffer buffer = bufferPool.allocate(28, false).order(ByteOrder.LITTLE_ENDIAN); - if (duration > 0) { - buffer.putInt((int) (totalPlayTime + getRemainingDuration())); - buffer.putInt(0); - buffer.putInt((int) duration); - } else { - buffer.putInt(-1); - buffer.putInt(0); - buffer.putInt(-1); - } - buffer.putLong(ownerId); - buffer.putInt(1); // Unknown - buffer.flip(); - return buffer.array(); - } - - public float getDuration() { - return duration; - } - - public void setDuration(float duration) { - this.duration = duration; - } - - public String getBuffName() { - return buffName; - } - - public void setBuffName(String buffName) { - this.buffName = buffName; - } - - public long getOwnerId() { - return ownerId; - } - - public void setOwnerId(long ownerId) { - this.ownerId = ownerId; - } - - public String getEffect1Name() { - return effect1Name; - } - - public void setEffect1Name(String effect1Name) { - this.effect1Name = effect1Name; - } - - public String getEffect2Name() { - return effect2Name; - } - - public void setEffect2Name(String effect2Name) { - this.effect2Name = effect2Name; - } - - public String getEffect3Name() { - return effect3Name; - } - - public void setEffect3Name(String effect3Name) { - this.effect3Name = effect3Name; - } - - public String getEffect4Name() { - return effect4Name; - } - - public void setEffect4Name(String effect4Name) { - this.effect4Name = effect4Name; - } - - public String getEffect5Name() { - return effect5Name; - } - - public void setEffect5Name(String effect5Name) { - this.effect5Name = effect5Name; - } - - public float getEffect1Value() { - return effect1Value; - } - - public void setEffect1Value(float effect1Value) { - this.effect1Value = effect1Value; - } - - public float getEffect2Value() { - return effect2Value; - } - - public void setEffect2Value(float effect2Value) { - this.effect2Value = effect2Value; - } - - public float getEffect3Value() { - return effect3Value; - } - - public void setEffect3Value(float effect3Value) { - this.effect3Value = effect3Value; - } - - public float getEffect4Value() { - return effect4Value; - } - - public void setEffect4Value(float effect4Value) { - this.effect4Value = effect4Value; - } - - public float getEffect5Value() { - return effect5Value; - } - - public void setEffect5Value(float effect5Value) { - this.effect5Value = effect5Value; - } - - public String getParticleEffect() { - return particleEffect; - } - - public void setParticleEffect(String particleEffect) { - this.particleEffect = particleEffect; - } - - public boolean isDebuff() { - return isDebuff; - } - - public void setDebuff(boolean isDebuff) { - this.isDebuff = isDebuff; - } - - public boolean isRemoveOnDeath() { - return removeOnDeath; - } - - public void setRemoveOnDeath(boolean removeOnDeath) { - this.removeOnDeath = removeOnDeath; - } - - public boolean isRemovableByPlayer() { - return isRemovableByPlayer; - } - - public void setRemovableByPlayer(boolean isRemovableByPlayer) { - this.isRemovableByPlayer = isRemovableByPlayer; - } - - public int getMaxStacks() { - return maxStacks; - } - - public void setMaxStacks(int maxStacks) { - this.maxStacks = maxStacks; - } - - public boolean isPersistent() { - return isPersistent; - } - - public void setPersistent(boolean isPersistent) { - this.isPersistent = isPersistent; - } - - public boolean isRemoveOnRespec() { - return removeOnRespec; - } - - public void setRemoveOnRespec(boolean removeOnRespec) { - this.removeOnRespec = removeOnRespec; - } - - public boolean isAiRemoveOnEndCombat() { - return aiRemoveOnEndCombat; - } - - public void setAiRemoveOnEndCombat(boolean aiRemoveOnEndCombat) { - this.aiRemoveOnEndCombat = aiRemoveOnEndCombat; - } - - public boolean isDecayOnPvPDeath() { - return decayOnPvPDeath; - } - - public void setDecayOnPvPDeath(boolean decayOnPvPDeath) { - this.decayOnPvPDeath = decayOnPvPDeath; - } - - public void setStartTime() { - this.startTime = System.currentTimeMillis(); - } - - public int getRemainingDuration() { - long currentTime = System.currentTimeMillis(); - long timeDiff = (currentTime - startTime) / 1000; - int remaining = (int) (duration - timeDiff); - System.out.println("Buff remaining: " + remaining); - return remaining; - } - - public int getTotalPlayTime() { - return totalPlayTime; - } - - public void setTotalPlayTime(int totalPlayTime) { - this.totalPlayTime = totalPlayTime; - } - -} diff --git a/src/resources/z/exp/craft/DraftSchematic.java b/src/resources/z/exp/craft/DraftSchematic.java deleted file mode 100644 index 7192c98b..00000000 --- a/src/resources/z/exp/craft/DraftSchematic.java +++ /dev/null @@ -1,88 +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 resources.z.exp.craft; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class DraftSchematic extends Delta { - - private int serverSchematicCrc = 0; - private int schematicCrc = 0; - private int amount = 1; - - public DraftSchematic(int serverSchematicCrc, int schematicCrc, int amount) { - this.serverSchematicCrc = serverSchematicCrc; - this.schematicCrc = schematicCrc; - this.amount = amount; - } - - public DraftSchematic(int serverSchematicCrc, int schematicCrc) { - this.serverSchematicCrc = serverSchematicCrc; - this.schematicCrc = schematicCrc; - } - - public DraftSchematic() { - - } - - public int getServerSchematicCrc() { - synchronized(objectMutex) { - return serverSchematicCrc; - } - } - - public int getSchematicCrc() { - synchronized(objectMutex) { - return schematicCrc; - } - } - - public int getAmount() { - synchronized(objectMutex) { - return amount; - } - } - - public void setAmount(int amount) { - synchronized(objectMutex) { - this.amount = amount; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(12, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(serverSchematicCrc); - buffer.putInt(schematicCrc); - buffer.putInt(amount); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/equipment/Equipment.java b/src/resources/z/exp/equipment/Equipment.java deleted file mode 100644 index 4e7e06cc..00000000 --- a/src/resources/z/exp/equipment/Equipment.java +++ /dev/null @@ -1,83 +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 resources.z.exp.equipment; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import engine.resources.common.CRC; -import engine.resources.objects.SWGObject; -import resources.objects.Delta; -import resources.z.exp.objects.tangible.TangibleObject; -import resources.z.exp.objects.weapon.WeaponObject; - -@Persistent -public class Equipment extends Delta { - - private TangibleObject object; - - public Equipment(SWGObject object) { - this.object = ((object instanceof TangibleObject) ? (TangibleObject) object : null); - } - - public Equipment() { - - } - - public SWGObject getObject() { - synchronized(objectMutex) { - return object; - } - } - - public long getObjectId() { - synchronized(objectMutex) { - return object.getObjectId(); - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - int size = 18 + object.getCustomization().length; - - IoBuffer buffer = bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - buffer.putShort((short) object.getCustomization().length); - buffer.put(object.getCustomization()); - buffer.putInt(object.getArrangementId()); - buffer.putLong(object.getObjectID()); - buffer.putInt(CRC.StringtoCRC(object.getTemplate())); - buffer.put(getBoolean((object instanceof WeaponObject))); - if (object instanceof WeaponObject) { - buffer.put(((WeaponObject) object).getBaseline3().getBaseline()); - buffer.put(((WeaponObject) object).getBaseline6().getBaseline()); - } - buffer.flip(); - - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/gcw/CurrentServerGCWZoneHistory.java b/src/resources/z/exp/gcw/CurrentServerGCWZoneHistory.java deleted file mode 100644 index 3171a5eb..00000000 --- a/src/resources/z/exp/gcw/CurrentServerGCWZoneHistory.java +++ /dev/null @@ -1,77 +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 resources.z.exp.gcw; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { - - private int lastUpdateTime; - private int percent; - - public CurrentServerGCWZoneHistory(CurrentServerGCWZonePercent zone) { - this.percent = zone.getPercent().intValue(); - this.lastUpdateTime = zone.getLastUpdateTime(); - } - - public CurrentServerGCWZoneHistory() { - - } - - public int getLastUpdateTime() { - synchronized(objectMutex) { - return lastUpdateTime; - } - } - - public int getPercent() { - synchronized(objectMutex) { - return percent; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(lastUpdateTime); - buffer.putInt(percent); - return buffer.array(); - } - } - - public CurrentServerGCWZoneHistory clone() { - try { - return (CurrentServerGCWZoneHistory) super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/src/resources/z/exp/gcw/CurrentServerGCWZonePercent.java b/src/resources/z/exp/gcw/CurrentServerGCWZonePercent.java deleted file mode 100644 index 930671f0..00000000 --- a/src/resources/z/exp/gcw/CurrentServerGCWZonePercent.java +++ /dev/null @@ -1,173 +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 resources.z.exp.gcw; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import engine.resources.scene.Point2D; - -import resources.objects.Delta; - -@Persistent -public class CurrentServerGCWZonePercent extends Delta implements Cloneable { - - private Point2D position; - private float radius = 0; - private BigDecimal weight; - private int type = 0; - private BigDecimal percent; - private int gcwPoints = 1; - private long lastUpdateTime = (System.currentTimeMillis() / ((long) 1000)); - - public CurrentServerGCWZonePercent(Point2D position, float radius, int weight, int type) { - this.position = position; - this.radius = radius; - this.weight = new BigDecimal(weight, MathContext.DECIMAL128); - this.weight = this.weight.divide(new BigDecimal("10000000.0", MathContext.DECIMAL128), MathContext.DECIMAL128); - this.type = type; - this.percent = new BigDecimal("50.0", MathContext.DECIMAL128); - } - - public CurrentServerGCWZonePercent() { - - } - - public Point2D getPosition() { - synchronized(objectMutex) { - return position.clone(); - } - } - - public void setPosition(Point2D position) { - synchronized(objectMutex) { - this.position = position; - } - } - - public float getRadius() { - synchronized(objectMutex) { - return radius; - } - } - - public void setRadius(float radius) { - synchronized(objectMutex) { - this.radius = radius; - } - } - - public int getGroup() { - synchronized(objectMutex) { - return weight.unscaledValue().intValue(); - } - } - - public BigDecimal getWeight() { - synchronized(objectMutex) { - return weight; - } - } - - public void setWeight(int weight) { - synchronized(objectMutex) { - this.weight = new BigDecimal(weight, MathContext.DECIMAL128); - this.weight = this.weight.divide(new BigDecimal("10000000.0", MathContext.DECIMAL128), MathContext.DECIMAL128); - } - } - - public int getType() { - synchronized(objectMutex) { - return type; - } - } - - public void setType(int type) { - synchronized(objectMutex) { - this.type = type; - } - } - - public BigDecimal getPercent() { - synchronized(objectMutex) { - return percent; - } - } - - public CurrentServerGCWZonePercent setPercent(BigDecimal percent) { - synchronized(objectMutex) { - this.percent = percent; - this.lastUpdateTime = (System.currentTimeMillis() / ((long) 1000)); - return this; - } - } - - public int getGCWPoints() { - synchronized(objectMutex) { - return gcwPoints; - } - } - - public void addGCWPoints(int gcwPoints) { - synchronized(objectMutex) { - this.gcwPoints += gcwPoints; - } - } - - public void removeGCWPoints(int gcwPoints) { - synchronized(objectMutex) { - this.gcwPoints = (((this.gcwPoints - gcwPoints) < 1) ? 1 : this.gcwPoints - gcwPoints); - } - } - - public int getLastUpdateTime() { - synchronized(objectMutex) { - return ((int) lastUpdateTime); - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(percent.intValue()); - return buffer.array(); - } - } - - @Override - public CurrentServerGCWZonePercent clone() { - try { - CurrentServerGCWZonePercent object = (CurrentServerGCWZonePercent) super.clone(); - object.setPosition(getPosition()); - return object; - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/src/resources/z/exp/gcw/OtherServerGCWZonePercent.java b/src/resources/z/exp/gcw/OtherServerGCWZonePercent.java deleted file mode 100644 index 8411980d..00000000 --- a/src/resources/z/exp/gcw/OtherServerGCWZonePercent.java +++ /dev/null @@ -1,84 +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 resources.z.exp.gcw; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class OtherServerGCWZonePercent extends Delta implements Cloneable { - - private String zone = ""; - private int percent = 50; - - public OtherServerGCWZonePercent(String zone) { - this.zone = zone; - } - - public OtherServerGCWZonePercent() { - - } - - public String getZone() { - synchronized(objectMutex) { - return zone; - } - } - - public int getPercent() { - synchronized(objectMutex) { - return percent; - } - } - - public OtherServerGCWZonePercent setPercent(double percent) { - synchronized(objectMutex) { - this.percent = (int) percent; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((2 + zone.length() + 4), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(getAsciiString(zone)); - buffer.putInt(percent); - return buffer.array(); - } - } - - @Override - public OtherServerGCWZonePercent clone() { - try { - return (OtherServerGCWZonePercent) super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/src/resources/z/exp/gcw/RegionDefender.java b/src/resources/z/exp/gcw/RegionDefender.java deleted file mode 100644 index 3f0194fa..00000000 --- a/src/resources/z/exp/gcw/RegionDefender.java +++ /dev/null @@ -1,99 +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 resources.z.exp.gcw; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.common.AString; -import resources.z.exp.objects.Baseline; -import resources.objects.Delta; - -@Persistent -public class RegionDefender extends Delta { - - private AString region; - private byte byte1 = 0; - private byte byte2 = 0; - - public RegionDefender(String region, byte byte1, byte byte2) { - this.region = new AString(region); - this.byte1 = byte1; - this.byte2 = byte2; - } - - public RegionDefender(String region) { - this.region = new AString(region); - } - - public RegionDefender() { - this.region = new AString(); - } - - public String getRegion() { - synchronized(objectMutex) { - return region.get(); - } - } - - public void setRegion(String region) { - synchronized(objectMutex) { - this.region = new AString(region); - } - } - - public byte getByte1() { - synchronized(objectMutex) { - return byte1; - } - } - - public void setByte1(byte byte1) { - synchronized(objectMutex) { - this.byte1 = byte1; - } - } - - public byte getByte2() { - synchronized(objectMutex) { - return byte2; - } - } - - public void setByte2(byte byte2) { - synchronized(objectMutex) { - this.byte2 = byte2; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = Baseline.createBuffer(region.getBytes().length + 2); - buffer.put(region.getBytes()); - buffer.put(byte1); - buffer.put(byte2); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/group/GroupInviteInfo.java b/src/resources/z/exp/group/GroupInviteInfo.java deleted file mode 100644 index 97c53445..00000000 --- a/src/resources/z/exp/group/GroupInviteInfo.java +++ /dev/null @@ -1,79 +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 resources.z.exp.group; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.common.AString; -import resources.z.exp.objects.Baseline; -import resources.objects.Delta; - -@Persistent -public class GroupInviteInfo extends Delta { - - private long senderId; - private AString senderName; - private long inviteCounter; - - public GroupInviteInfo(long senderId, String senderName) { - this.senderId = senderId; - this.senderName = new AString(senderName); - inviteCounter = 1; - } - - public GroupInviteInfo() { - - } - - public long getSenderId() { - synchronized(objectMutex) { - return senderId; - } - } - - public String getSenderName() { - synchronized(objectMutex) { - return senderName.get(); - } - } - - public void setSender(long senderId, String senderName) { - synchronized(objectMutex) { - this.senderId = senderId; - this.senderName = new AString(senderName); - inviteCounter++; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = Baseline.createBuffer(16 + senderName.getBytes().length); - buffer.putLong(senderId); - buffer.put(senderName.getBytes()); - buffer.putLong(inviteCounter); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/guild/Guild.java b/src/resources/z/exp/guild/Guild.java deleted file mode 100644 index 7e29d8a2..00000000 --- a/src/resources/z/exp/guild/Guild.java +++ /dev/null @@ -1,120 +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 resources.z.exp.guild; - -import java.nio.ByteOrder; -import java.util.List; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -import engine.resources.objects.SWGObject; - -@Persistent -public class Guild extends Delta { - - private int id; - private String abbreviation; - private String name; - private SWGObject leader; - private List members; - - public Guild(int id, String abbreviation, String name, SWGObject leader) { - this.id = id; - this.abbreviation = abbreviation; - this.name = name; - this.leader = leader; - this.members.add(leader); - } - - public Guild() { - - } - - public int getId() { - synchronized(objectMutex) { - return id; - } - } - - public void setId(int id) { - synchronized(objectMutex) { - this.id = id; - } - } - - public String getAbbreviation() { - synchronized(objectMutex) { - return abbreviation; - } - } - - public void setAbbreviation(String abbreviation) { - synchronized(objectMutex) { - this.abbreviation = abbreviation; - } - } - - public String getName() { - synchronized(objectMutex) { - return name; - } - } - - public void setName(String name) { - synchronized(objectMutex) { - this.name = name; - } - } - - public String getString() { - return (Integer.toString(getId()) + ":" + getAbbreviation()); - } - - public SWGObject getLeader() { - synchronized(objectMutex) { - return leader; - } - } - - public void setLeader(SWGObject leader) { - synchronized(objectMutex) { - this.leader = leader; - } - } - - public List getMembers() { - return members; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((getString().length() + 2), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(getAsciiString(getString())); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/manufacture/TableAndKey.java b/src/resources/z/exp/manufacture/TableAndKey.java deleted file mode 100644 index acf3aa73..00000000 --- a/src/resources/z/exp/manufacture/TableAndKey.java +++ /dev/null @@ -1,84 +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 resources.z.exp.manufacture; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class TableAndKey extends Delta { - - private String table = ""; - private int unused = 0; - private String key = ""; - - public TableAndKey(String table, String key) { - this.table = table; - this.table = key; - } - - public TableAndKey() { - - } - - public String getTable() { - synchronized(objectMutex) { - return table; - } - } - - public TableAndKey setTable(String table) { - synchronized(objectMutex) { - this.table = table; - return this; - } - } - - public String getKey() { - synchronized(objectMutex) { - return key; - } - } - - public TableAndKey setKey(String key) { - synchronized(objectMutex) { - this.key = key; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(4 + getAsciiString(table).length + getAsciiString(key).length, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(getAsciiString(table)); - buffer.putInt(unused); - buffer.put(getAsciiString(key)); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/mission/MissionLocation.java b/src/resources/z/exp/mission/MissionLocation.java deleted file mode 100644 index 52a37dc1..00000000 --- a/src/resources/z/exp/mission/MissionLocation.java +++ /dev/null @@ -1,47 +0,0 @@ -package resources.z.exp.mission; - -import com.sleepycat.persist.model.Persistent; - -import engine.resources.common.CRC; -import engine.resources.scene.Point3D; - -@Persistent -public class MissionLocation { - - private float x, y, z; - private long objectId; - private String planet; - - public MissionLocation(Point3D position, long objectId, String planet) { - this.x = position.x; - this.y = position.y; - this.z = position.z; - this.objectId = objectId; - this.planet = planet; - } - - public MissionLocation() { - - } - - public Point3D getPosition() { - return new Point3D(x, y, z); - } - - public long getObjectId() { - return objectId; - } - - public String getPlanet() { - return planet; - } - - public int getPlanetCRC() { - if (planet != null) { - return CRC.StringtoCRC(planet); - } else { - return 0; - } - } - -} diff --git a/src/resources/z/exp/objects/Baseline.java b/src/resources/z/exp/objects/Baseline.java deleted file mode 100644 index 9ae536c6..00000000 --- a/src/resources/z/exp/objects/Baseline.java +++ /dev/null @@ -1,747 +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 resources.z.exp.objects; - -import java.io.UnsupportedEncodingException; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeMap; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.buffer.SimpleBufferAllocator; - -import resources.common.AString; -import resources.common.Opcodes; -import resources.common.UString; -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.resources.objects.SWGObject; - -@Persistent -public class Baseline implements List { - - private List list = new CopyOnWriteArrayList(); - private Map definition = new TreeMap(); - private BaseObject object; - private byte viewType; - @NotPersistent - protected final Object objectMutex = new Object(); - @NotPersistent - private static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - @NotPersistent - private Map baselineBuilders; - @NotPersistent - private Map deltaBuilders; - - public Baseline() { } - - public Baseline(BaseObject object, int viewType) { - this.viewType = (byte) viewType; - this.object = object; - } - - public boolean add(Object e) { - synchronized(objectMutex) { - if (list.add(e)) { - definition.put(Integer.toString(list.size() - 1), list.size() - 1); - return true; - } else { - return false; - } - } - } - - public void add(int index, Object element) { - synchronized(objectMutex) { - return; - } - } - - public boolean addAll(Collection c) { - synchronized(objectMutex) { - return false; - } - } - - public boolean addAll(int index, Collection c) { - synchronized(objectMutex) { - return false; - } - } - - public void clear() { - synchronized(objectMutex) { - list.clear(); - definition.clear(); - } - } - - public boolean contains(Object o) { - synchronized(objectMutex) { - return list.contains(o); - } - } - - public boolean containsAll(Collection c) { - synchronized(objectMutex) { - return list.containsAll(c); - } - } - - private boolean compareTypes(Object o1, Object o2) { - if ((o1 instanceof IDelta && o2 instanceof IDelta) || - (o1 instanceof AString && o2 instanceof AString) || - (o1 instanceof UString && o2 instanceof UString) || - (o1 instanceof Byte[] && o2 instanceof Byte[]) || - (o1 instanceof Byte && o2 instanceof Byte) || - (o1 instanceof Boolean && o2 instanceof Boolean) || - (o1 instanceof Short && o2 instanceof Short) || - (o1 instanceof Integer && o2 instanceof Integer) || - (o1 instanceof Float && o2 instanceof Float) || - (o1 instanceof Long && o2 instanceof Long) || - (o1 instanceof SWGObject && o2 instanceof SWGObject) || - (o1 instanceof SWGList && o2 instanceof SWGList) || - (o1 instanceof SWGSet && o2 instanceof SWGSet) || - (o1 instanceof SWGMap && o2 instanceof SWGMap) || - (o1 instanceof SWGMultiMap && o2 instanceof SWGMultiMap) || - (o1 instanceof ArrayList && o2 instanceof ArrayList)) { - return true; - } - - return false; - } - - public IoBuffer createBaseline() { - byte[] objects = { }; - int size = 0; - - for (Object o : list) { - byte[] object; - - if (baselineBuilders != null && baselineBuilders.containsKey(o)) { - object = baselineBuilders.get(o).build(); - } else { - object = toBytes(o); - } - - size += object.length; - - IoBuffer buffer = createBuffer(size); - buffer.put(objects); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = createBuffer(25 + size); - buffer.putShort((short) 5); - buffer.putInt(Opcodes.BaselinesMessage); - buffer.putLong(object.getObjectID()); - try { - buffer.put(reverse(getShortTemplate()).getBytes("US-ASCII")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - buffer.put(viewType); - buffer.putInt(size); - buffer.putShort((short) list.size()); - buffer.put(objects); - buffer.flip(); - - return buffer; - } - - public static IoBuffer createBuffer(int size) { - return bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - } - - public IoBuffer createDelta() { - List objectQueue = new ArrayList(); - - synchronized(objectMutex) { - for (int i = 0; i < list.size(); i++) { - objectQueue.add(i); - } - } - - return createDelta(objectQueue, null); - } - - public IoBuffer createDelta(int object) { - List objectQueue = new ArrayList(); - objectQueue.add(object); - return createDelta(objectQueue, null); - } - - public IoBuffer createDelta(int object, byte[] data) { - List objectQueue = new ArrayList(); - objectQueue.add(object); - return createDelta(objectQueue, data); - } - - public IoBuffer createDelta(List objectQueue, byte[] data) { - byte[] objects = { }; - int size = 0; - - for (Integer o : objectQueue) { - byte[] object; - - if (deltaBuilders != null && deltaBuilders.containsKey(o)) { - object = deltaBuilders.get(o).build(); - } else if (data != null) { - object = data; - } else { - object = toBytes(get(o)); - } - - size += 2 + object.length; - - IoBuffer buffer = createBuffer(size); - buffer.put(objects); - buffer.putShort(o.shortValue()); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = createBuffer(27 + size); - buffer.putShort((short) 5); - buffer.putInt(Opcodes.DeltasMessage); - buffer.putLong(object.getObjectID()); - try { - buffer.put(reverse(getShortTemplate()).getBytes("US-ASCII")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - buffer.put(viewType); - buffer.putInt(size); - buffer.putShort((short) objectQueue.size()); - buffer.put(objects); - buffer.flip(); - - return buffer; - } - - public Object get(int index) { - synchronized(objectMutex) { - return list.get(index); - } - } - - public Object get(String name) { - synchronized(objectMutex) { - return list.get(definition.get(name)); - } - } - - public IoBuffer getBaseline() { - return createBaseline(); - } - - public Map getBaselineBuilders() { - synchronized(objectMutex) { - return baselineBuilders; - } - } - - public static byte getBoolean(boolean condition) { - return ((byte) ((condition) ? 1 : 0)); - } - - public byte[] getBytes() { - synchronized(objectMutex) { - int size = 0; - - for (Object o : list) { - size += toBytes(o).length; - } - - IoBuffer buffer = createBuffer(size); - - for (Object o : list) { - buffer.put(toBytes(o)); - } - - buffer.flip(); - - return buffer.array(); - } - } - - public byte[] getBytes(int index) { - synchronized(objectMutex) { - return toBytes(list.get(index)); - } - } - - public byte[] getBytes(String name) { - synchronized(objectMutex) { - return toBytes(list.get(definition.get(name))); - } - } - - private String getDefinition(int index) { - for (Entry entry : definition.entrySet()) { - if (entry.getValue() == index) { - return entry.getKey(); - } - } - - return null; - } - - public Map getDefinitions() { - synchronized(objectMutex) { - return definition; - } - } - - public IoBuffer getDelta(int index) { - return createDelta(index); - } - - public IoBuffer getDelta(String name) { - return createDelta(definition.get(name)); - } - - public Map getDeltaBuilders() { - synchronized(objectMutex) { - return deltaBuilders; - } - } - - public Object getMutex() { - return objectMutex; - } - - public String getShortTemplate() throws Exception { - String Template = object.getTemplate(); - - if (Template.startsWith("object/battlefield_marker")) { - return "BMRK"; - } else if(Template.startsWith("object/building")){ - return "BUIO"; - } else if(Template.startsWith("object/cell")) { - return "SCLT"; - } else if (Template.startsWith("object/construction_contract")) { - throw new Exception(); - } else if (Template.startsWith("object/counting")) { - throw new Exception(); - } else if (Template.startsWith("object/creature")) { - return "CREO"; - } else if (Template.startsWith("object/draft_schematic")) { - throw new Exception(); - } else if (Template.startsWith("object/factory")) { - return "FCYT"; - } else if(Template.startsWith("object/group")) { - return "GRUP"; - } else if(Template.startsWith("object/guild")) { - return "GILD"; - } else if (Template.startsWith("object/installation")) { - return "INSO"; - } else if (Template.startsWith("object/installation/battlefield")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/faction_perk/covert_detector")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/faction_perk/minefield")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/faction_perk/turret")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/generators")) { - return "HINO"; - } else if (Template.startsWith("object/installation/manufacture")) { - return "MINO"; - } else if (Template.startsWith("object/installation/mining_gas")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_liquid")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_gas")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_ore")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_organic")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/turret")) { - throw new Exception(); - } else if (Template.startsWith("object/intangible")) { - return "ITNO"; - } else if (Template.startsWith("object/jedi_manager")) { - throw new Exception(); - } else if (Template.startsWith("object/manufacture_schematic")) { - return "MSCO"; - } else if (Template.startsWith("object/mission")) { - return "MISO"; - } else if (Template.startsWith("object/mobile")) { - throw new Exception(); - } else if (Template.startsWith("object/object")) { - throw new Exception(); - } else if (Template.startsWith("object/path_waypoint")) { - throw new Exception(); - } else if (Template.startsWith("object/player")) { - return "PLAY"; - } else if (Template.startsWith("object/player_quest")) { - return "PQOS"; - } else if (Template.startsWith("object/resource_container")) { - return "RCNO"; - } else if (Template.startsWith("object/ship")) { - return "SHIP"; - } else if (Template.startsWith("object/soundobject")) { - throw new Exception(); - } else if(Template.startsWith("object/static")) { - return "STAO"; - } else if (Template.startsWith("object/tangible")) { - return "TANO"; - } else if (Template.startsWith("object/token")) { - throw new Exception(); - } else if (Template.startsWith("object/universe")) { - throw new Exception(); - } else if(Template.startsWith("object/waypoint")) { - return "WAYP"; - } else if (Template.startsWith("object/weapon")) { - return "WEAO"; - } else { - throw new Exception(); - } - } - - public int indexOf(Object o) { - synchronized(objectMutex) { - return list.indexOf(o); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return list.isEmpty(); - } - } - - public Iterator iterator() { - synchronized(objectMutex) { - return list.iterator(); - } - } - - public int lastIndexOf(Object o) { - synchronized(objectMutex) { - return lastIndexOf(o); - } - } - - public ListIterator listIterator() { - synchronized(objectMutex) { - return list.listIterator(); - } - } - - public ListIterator listIterator(int index) { - synchronized(objectMutex) { - return listIterator(index); - } - } - - public void put(String name, Object o) { - synchronized(objectMutex) { - definition.put(name, list.size()); - list.add(o); - } - } - - public boolean remove(Object o) { - return false; - } - - public Object remove(int index) { - return null; - } - - public boolean removeAll(Collection c) { - return false; - } - - public boolean retainAll(Collection c) { - return false; - } - - private String reverse(String reverseString) { - if (reverseString.length() <= 1) { - return reverseString; - } - - return reverse(reverseString.substring(1, reverseString.length())) + reverseString.charAt(0); - } - - public Object set(int index, Object element) { - return null; - } - - public IoBuffer set(String name, Object o) { - synchronized(objectMutex) { - int index = definition.get(name); - - if (compareTypes(o, list.get(index)) && list.set(index, o) != null) { - return createDelta(index); - } else { - return null; - } - } - } - - public void setBaselineBuilders(Map baselineBuilders) { - synchronized(objectMutex) { - this.baselineBuilders = baselineBuilders; - } - } - - public void setDeltaBuilders(Map deltaBuilders) { - synchronized(objectMutex) { - this.deltaBuilders = deltaBuilders; - } - } - - public int size() { - synchronized(objectMutex) { - return list.size(); - } - } - - public List subList(int fromIndex, int toIndex) { - synchronized(objectMutex) { - return list.subList(fromIndex, toIndex); - } - } - - public Object[] toArray() { - synchronized(objectMutex) { - return list.toArray(); - } - } - - public T[] toArray(T[] a) { - synchronized(objectMutex) { - return list.toArray(a); - } - } - - public static byte[] toBytes(Object o) { - try { - if (o != null) { - if (o instanceof IDelta) { - return ((IDelta) o).getBytes(); - } else if (o instanceof String) { - return (new AString((String) o)).getBytes(); - } else if (o instanceof AString) { - return ((AString) o).getBytes(); - } else if (o instanceof UString) { - return ((UString) o).getBytes(); - } else if (o instanceof Byte[]) { - IoBuffer buffer = createBuffer(2 + ((Byte[]) o).length); - buffer.putShort((short) ((Byte[]) o).length); - for (Byte b : (Byte[]) o) buffer.put(b); - return buffer.array(); - } else if (o instanceof Byte) { - return createBuffer(1).put((Byte) o).array(); - } else if (o instanceof Boolean) { - return createBuffer(1).put(((((Boolean) o)) ? (byte) 1 : (byte) 0)).array(); - } else if (o instanceof Short) { - return createBuffer(2).putShort((Short) o).array(); - } else if (o instanceof Integer) { - return createBuffer(4).putInt((Integer) o).array(); - } else if (o instanceof Float) { - return createBuffer(4).putFloat((Float) o).array(); - } else if (o instanceof Long) { - return createBuffer(8).putLong((Long) o).array(); - } else if (o instanceof SWGObject) { - long objectId = ((((SWGObject) o) == null) ? (long) 0 : ((SWGObject) o).getObjectID()); - return createBuffer(8).putLong(objectId).array(); - } else if (o instanceof SWGList) { - return ((SWGList) o).getBytes(); - } else if (o instanceof SWGSet) { - return ((SWGSet) o).getBytes(); - } else if (o instanceof SWGMap) { - return ((SWGMap) o).getBytes(); - } else if (o instanceof SWGMultiMap) { - return ((SWGMultiMap) o).getBytes(); - } else if (o instanceof ArrayList) { - ArrayList list = ((ArrayList) o); - int size = 0; - byte[] objects = { }; - - for (int i = 0; i < list.size(); i++) { - byte[] object = toBytes(list.get(i)); - size += object.length; - - IoBuffer buffer = createBuffer(size); - buffer.put(objects); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - return createBuffer(size + 4).putInt(list.size()).array(); - } else { - System.out.println("ERROR: Unsupported type used in Baseline: " + (o.getClass()).getSimpleName()); - throw new Exception(); - //return new byte[] { }; - } - } else { - if (o instanceof IDelta) { - System.out.println("ERROR: a baseline object that implements IDelta is null. This could cause crashes! Make it at least a new instance with all fields set to 0."); - return new byte[] { }; - } else if (o instanceof String) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof AString) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof UString) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof Byte[]) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof Byte) { - return new byte[] { 0x00 }; - } else if (o instanceof Boolean) { - return new byte[] { 0x00 }; - } else if (o instanceof Short) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof Integer) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof Float) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof Long) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGObject) { - return null; - } else if (o instanceof SWGList) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGSet) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGMap) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGMultiMap) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof ArrayList) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else { - System.out.println("ERROR: Unsupported type used in Baseline."); - System.out.println("~additionally, the type was null, which is dangerous."); - return new byte[] { }; - } - } - } catch (Exception e) { - e.printStackTrace(); - return new byte[] { }; - } - } - - public void transformStructure(Baseline defaults) { - synchronized(objectMutex) { - List oldStruct = list; - Baseline newStruct = defaults; - - for (int i = 0; i < newStruct.size(); i++) { - if (definition.containsKey(newStruct.getDefinition(i))) { - int oldIndex = definition.get(newStruct.getDefinition(i)); - Object newObject = newStruct.get(i); - Object oldObject = oldStruct.get(oldIndex); - - if (compareTypes(newObject, oldObject)) { - newStruct.set(i, oldObject); - } else { - if (newObject instanceof String) { - if (oldObject instanceof AString) { - newStruct.set(i, ((AString) oldObject).get()); - } else if (oldObject instanceof UString) { - newStruct.set(i, ((UString) oldObject).get()); - } - } else if (newObject instanceof AString) { - if (oldObject instanceof String) { - newStruct.set(i, new AString((String) oldObject)); - } else if (oldObject instanceof UString) { - newStruct.set(i, new AString(((UString) oldObject).get())); - } - } else if (newObject instanceof UString) { - if (oldObject instanceof String) { - newStruct.set(i, new UString((String) oldObject)); - } else if (oldObject instanceof AString) { - newStruct.set(i, new UString(((AString) oldObject).get())); - } - } else if (newObject instanceof Byte) { - if (oldObject instanceof Short && (Short) oldObject < 0xFF) { - newStruct.set(i, ((Short) oldObject).byteValue()); - } else if (oldObject instanceof Integer && (Integer) oldObject < 0xFF) { - newStruct.set(i, ((Integer) oldObject).byteValue()); - } else if (oldObject instanceof Long && (Long) oldObject < 0xFF) { - newStruct.set(i, ((Long) oldObject).byteValue()); - } - } else if (newObject instanceof Short) { - if (oldObject instanceof Byte) { - newStruct.set(i, ((Byte) oldObject).shortValue()); - } else if (oldObject instanceof Integer && (Integer) oldObject < 0xFFFF) { - newStruct.set(i, ((Integer) oldObject).shortValue()); - } else if (oldObject instanceof Long && (Long) oldObject < 0xFFFF) { - newStruct.set(i, ((Long) oldObject).shortValue()); - } - } else if (newObject instanceof Integer) { - if (oldObject instanceof Byte) { - newStruct.set(i, ((Byte) oldObject).intValue()); - } else if (oldObject instanceof Short) { - newStruct.set(i, ((Short) oldObject).intValue()); - } else if (oldObject instanceof Long && (Long) oldObject < 0xFFFFFFFF) { - newStruct.set(i, ((Long) oldObject).intValue()); - } - } else if (newObject instanceof Long) { - if (oldObject instanceof Byte) { - newStruct.set(i, ((Byte) oldObject).longValue()); - } else if (oldObject instanceof Short) { - newStruct.set(i, ((Short) oldObject).longValue()); - } else if (oldObject instanceof Integer) { - newStruct.set(i, ((Integer) oldObject).longValue()); - } else if (oldObject instanceof SWGObject) { - newStruct.set(i, ((SWGObject) oldObject).getObjectID()); - } - } - } - } - } - - list = newStruct.list; - } - } - -} diff --git a/src/resources/z/exp/objects/ObjectMessageBuilder.java b/src/resources/z/exp/objects/ObjectMessageBuilder.java deleted file mode 100644 index 0ef9564f..00000000 --- a/src/resources/z/exp/objects/ObjectMessageBuilder.java +++ /dev/null @@ -1,127 +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 resources.z.exp.objects; - -import java.nio.ByteBuffer; -import java.util.Map; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.common.StringUtilities; -import resources.z.exp.objects.object.BaseObject; - -@Persistent -public class ObjectMessageBuilder { - - protected BaseObject object; - - public ObjectMessageBuilder(BaseObject object) { - setObject(object); - } - - public ObjectMessageBuilder() { - - } - - public void buildBaseline1(Map baselineBuilders, Map deltaBuilders) { - /* - baselineBuilders.put(5, new Builder { - public byte[] build() { - IoBuffer = Baseline.createBuffer(2); - buffer.putShort((short) 27); - return buffer.array(); - } - }); - - deltaBuilders.put(7, new Builder { - public byte[] build() { - IoBuffer = Baseline.createBuffer(4); - buffer.putInt(27); - return buffer.array(); - } - }); - */ - } - - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline4(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline7(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - - } - - public IoBuffer createBuffer(int size, boolean autoSize) { - return createBuffer(size).setAutoExpand(autoSize); - } - - public IoBuffer createBuffer(int size) { - return Baseline.createBuffer(size); - } - - public BaseObject getObject() { - return object; - } - - public void setObject(BaseObject object) { - this.object = object; - } - - protected byte getBoolean(boolean variable) { - return Baseline.getBoolean(variable); - } - - protected String getAsciiString(ByteBuffer buffer) { - return StringUtilities.getAsciiString(buffer); - } - - protected String getUnicodeString(ByteBuffer buffer) { - return StringUtilities.getUnicodeString(buffer); - } - - protected byte[] getAsciiString(String string) { - return StringUtilities.getAsciiString(string); - } - - protected byte[] getUnicodeString(String string) { - return StringUtilities.getUnicodeString(string); - } - -} diff --git a/src/resources/z/exp/objects/SWGList.java b/src/resources/z/exp/objects/SWGList.java deleted file mode 100644 index 5e1883ec..00000000 --- a/src/resources/z/exp/objects/SWGList.java +++ /dev/null @@ -1,410 +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 resources.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -/* A SWGList element should extend Delta or implement IDelta */ - -@Persistent -public class SWGList implements List { - - private List list = new CopyOnWriteArrayList(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGList() { } - - public SWGList(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public boolean add(E e) { - synchronized(objectMutex) { - if (valid(e) && list.add(e)) { - queue(item(1, list.lastIndexOf(e), Baseline.toBytes(e), true, true)); - return true; - } - - return false; - } - } - - public void add(int index, E element) { - synchronized(objectMutex) { - if (valid(element)) { - list.add(index, element); - queue(item(1, index, Baseline.toBytes(element), true, true)); - } - } - } - - public boolean addAll(Collection c) { - synchronized(objectMutex) { - if (!c.isEmpty()) { - List buffer = new ArrayList(); - boolean success = false; - - for (E element : c) { - if (valid(element)) { - if (list.add(element)) { - buffer.add(item(1, list.lastIndexOf(element), Baseline.toBytes(element), true, true)); - success = true; - } - } else { - return false; - } - } - - if (success == true) { - queue(buffer); - } else { - return false; - } - } - - return false; - } - } - - public boolean addAll(int index, Collection c) { - synchronized(objectMutex) { - if (!c.isEmpty()) { - List buffer = new ArrayList(); - - for (E element : c) { - if (valid(element)) { - list.add(index, element); - buffer.add(item(1, index, Baseline.toBytes(element), true, true)); - index++; - } else { - return false; - } - } - - queue(buffer); - - return true; - } - - return false; - } - } - - public void clear() { - synchronized(objectMutex) { - list.clear(); - queue(item(4, 0, null, false, false)); - } - } - - public boolean contains(Object o) { - synchronized(objectMutex) { - return list.contains(o); - } - } - - public boolean containsAll(Collection c) { - synchronized(objectMutex) { - return list.containsAll(c); - } - } - - public E get(int index) { - synchronized(objectMutex) { - return list.get(index); - } - } - - public List get() { - return list; - } - - public int indexOf(Object o) { - synchronized(objectMutex) { - return list.indexOf(o); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return list.isEmpty(); - } - } - - public Iterator iterator() { - synchronized(objectMutex) { - return list.iterator(); - } - } - - public int lastIndexOf(Object o) { - synchronized(objectMutex) { - return list.lastIndexOf(o); - } - } - - public ListIterator listIterator() { - synchronized(objectMutex) { - return list.listIterator(); - } - } - - public ListIterator listIterator(int index) { - synchronized(objectMutex) { - return listIterator(index); - } - } - - public boolean remove(Object o) { - synchronized(objectMutex) { - int index = list.indexOf(o); - - if (list.remove(o)) { - queue(item(1, index, null, true, false)); - return true; - } else { - return false; - } - } - } - - public E remove(int index) { - synchronized(objectMutex) { - E element = list.remove(index); - - queue(item(1, index, null, true, false)); - - return (E) element; - } - } - - public boolean removeAll(Collection c) { - synchronized(objectMutex) { - if (!c.isEmpty()) { - List buffer = new ArrayList(); - int index; - boolean success = false; - - for (Object element : c) { - index = list.indexOf(element); - - if (list.remove(element)) { - buffer.add(item(0, index, null, true, false)); - success = true; - } - } - - if (success) { - queue(buffer); - } - - return success; - } - - return false; - } - } - - public boolean retainAll(Collection c) { - synchronized(objectMutex) { - return list.retainAll(c); - } - } - - public E set(int index, E element) { - synchronized(objectMutex) { - if (valid(element)) { - E previousElement = list.set(index, element); - - queue(item(2, index, Baseline.toBytes(element), true, true)); - - return previousElement; - } - - return null; - } - } - - public boolean set(List list) { - synchronized(objectMutex) { - byte[] newListData = { 0x03 }; - - if (!list.isEmpty()) { - for (E element : list) { - if (valid(element)) { - IoBuffer buffer = IoBuffer.allocate((newListData.length + Baseline.toBytes(element).length), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(newListData); - buffer.put(Baseline.toBytes(element)); - newListData = buffer.array(); - } else { - return false; - } - } - - this.list = list; - - updateCounter++; - queue(newListData); - - return true; - } - - return false; - } - } - - public int size() { - synchronized(objectMutex) { - return list.size(); - } - } - - public List subList(int fromIndex, int toIndex) { - synchronized(objectMutex) { - return list.subList(fromIndex, toIndex); - } - } - - public Object[] toArray() { - synchronized(objectMutex) { - return list.toArray(); - } - } - - public T[] toArray(T[] a) { - synchronized(objectMutex) { - return list.toArray(a); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Object o : list) { - byte[] object = Baseline.toBytes(o); - size += object.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(list.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private boolean valid(Object o) { - if (o instanceof String || o instanceof Byte || o instanceof Short || - o instanceof Integer || o instanceof Float || o instanceof Long || - o instanceof IDelta) { - return true; - } else { - return false; - } - } - - private byte[] item(int type, int index, byte[] data, boolean useIndex, boolean useData) { - int size = 1 + ((useIndex) ? 2 : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) buffer.putShort((short) index); - if (useData) buffer.put(data); - buffer.flip(); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - buffer.flip(); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - buffer.flip(); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/SWGMap.java b/src/resources/z/exp/objects/SWGMap.java deleted file mode 100644 index 663d3fd3..00000000 --- a/src/resources/z/exp/objects/SWGMap.java +++ /dev/null @@ -1,279 +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 resources.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -/* A SWGMap element should extend Delta or implement IDelta */ - -@Persistent -public class SWGMap implements Map { - - private Map map = new TreeMap(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGMap() { } - - public SWGMap(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public SWGMap(Map m) { - if (m instanceof SWGMap) { - this.object = ((SWGMap) m).object; - this.viewType = ((SWGMap) m).viewType; - this.updateType = ((SWGMap) m).updateType; - map.putAll(m); - } - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean containsKey(Object key) { - synchronized(objectMutex) { - return map.containsKey(key); - } - } - - public boolean containsValue(Object value) { - synchronized(objectMutex) { - return map.containsValue(value); - } - } - - public Set> entrySet() { - synchronized(objectMutex) { - return map.entrySet(); - } - } - - public V get(Object key) { - return map.get(key); - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return map.isEmpty(); - } - } - - public Set keySet() { - synchronized(objectMutex) { - return map.keySet(); - } - } - - public V put(K key, V value) { - synchronized(objectMutex) { - if (valid(key) && valid(value)) { - if (map.containsKey(key)) { - V oldValue = map.put(key, value); - - queue(item(2, key, Baseline.toBytes(value), true, true)); - - return oldValue; - } else { - V oldValue = map.put(key, value); - - queue(item(0, key, Baseline.toBytes(value), true, true)); - - return oldValue; - } - } - - return null; - } - } - - public void putAll(Map m) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (Entry entry : m.entrySet()) { - K key = entry.getKey(); - V value = entry.getValue(); - - if (valid(key) && valid(value)) { - if (map.containsKey(key)) { - if (map.put(key, value) != null) { - buffer.add(item(2, key, Baseline.toBytes(value), true, true)); - } - } else { - if (map.put(key, value) != null) { - buffer.add(item(0, key, Baseline.toBytes(value), true, true)); - } - } - } - } - - if (buffer.size() > 0) { - queue(buffer); - } - } - } - - public V remove(Object key) { - synchronized(objectMutex) { - if (valid(key)) { - V value = map.remove(key); - - queue(item(1, key, Baseline.toBytes(map.get(key)), true, true)); - - return value; - } - - return null; - } - } - - public int size() { - synchronized(objectMutex) { - return map.size(); - } - } - - public Collection values() { - synchronized(objectMutex) { - return map.values(); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Entry entry : map.entrySet()) { - byte[] key = Baseline.toBytes(entry.getKey()); - byte[] value = Baseline.toBytes(entry.getValue()); - size += ((addByte) ? 1 : 0) + key.length + value.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(key); - buffer.put(value); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(map.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private boolean valid(Object o) { - if (o instanceof String || o instanceof Byte || o instanceof Short || - o instanceof Integer || o instanceof Float || o instanceof Long || - o instanceof IDelta) { - return true; - } else { - return false; - } - } - - private byte[] item(int type, Object index, byte[] data, boolean useIndex, boolean useData) { - if (useIndex && ((index instanceof IDelta) || !valid(index))) { - throw new IllegalArgumentException(); - } - - int size = 1 + ((useIndex) ? (2 + Baseline.toBytes(index).length) : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) buffer.put(Baseline.toBytes(index)); - if (useData) buffer.put(data); - buffer.flip(); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate(data.length + 8, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - buffer.flip(); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - buffer.flip(); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/SWGMultiMap.java b/src/resources/z/exp/objects/SWGMultiMap.java deleted file mode 100644 index 3a63d514..00000000 --- a/src/resources/z/exp/objects/SWGMultiMap.java +++ /dev/null @@ -1,382 +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 resources.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeMap; - -import org.apache.mina.core.buffer.IoBuffer; -import org.python.google.common.collect.ArrayListMultimap; -import org.python.google.common.collect.Multimap; -import org.python.google.common.collect.Multiset; -import org.python.google.common.collect.Ordering; -import org.python.google.common.collect.TreeMultimap; - -import resources.common.StringUtilities; -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -@SuppressWarnings("unused") - -@Persistent -public class SWGMultiMap implements Multimap { - - private Multimap map = ArrayListMultimap.create(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGMultiMap() { } - - public SWGMultiMap(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public SWGMultiMap(Multimap m) { - if (m instanceof SWGMultiMap) { - this.object = ((SWGMultiMap) m).object; - this.viewType = ((SWGMultiMap) m).viewType; - this.updateType = ((SWGMultiMap) m).updateType; - map.putAll(m); - } - } - - public Map> asMap() { - synchronized(objectMutex) { - return map.asMap(); - } - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean containsEntry(Object key, Object value) { - synchronized(objectMutex) { - return map.containsEntry(key, value); - } - } - - public boolean containsKey(Object key) { - synchronized(objectMutex) { - return map.containsKey(key); - } - } - - public boolean containsValue(Object value) { - synchronized(objectMutex) { - return map.containsValue(value); - } - } - - public Collection> entries() { - synchronized(objectMutex) { - return map.entries(); - } - } - - public Collection get(K key) { - synchronized(objectMutex) { - return map.get(key); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return map.isEmpty(); - } - } - - public Multiset keys() { - synchronized(objectMutex) { - return map.keys(); - } - } - - public Set keySet() { - synchronized(objectMutex) { - return map.keySet(); - } - } - - public boolean put(K key, V value) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long || - value instanceof IDelta) { - if (map.put(key, value)) { - queue(item(0, (String) key, ((IDelta) value).getBytes(), true, true)); - return true; - } - } - - return false; - } - } - - public boolean putAll(K key, Iterable values) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - List buffer = new ArrayList(); - - for (V value : values) { - if (value instanceof IDelta) { - if (map.put(key, value)) { - buffer.add(item(0, (String) key, ((IDelta) value).getBytes(), true, true)); - } - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } - } - - return false; - } - } - - public boolean putAll(Multimap map) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (Entry entry : map.entries()) { - K key = entry.getKey(); - V value = entry.getValue(); - - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long || - value instanceof IDelta) { - if (this.map.put(key, value)) { - buffer.add(item(0, (String) key, ((IDelta) value).getBytes(), true, true)); - } - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } - - return false; - } - } - - @SuppressWarnings("unchecked") - public boolean remove(Object key, Object value) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - if (map.remove(key, value)) { - queue(item(1, (String) key, ((IDelta) map.get((K) key)).getBytes(), true, true)); - - return true; - } - } - - return false; - } - } - - @SuppressWarnings("unchecked") - public Collection removeAll(Object key) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - Collection collection = map.get((K) key); - List buffer = new ArrayList(); - - for (V value : map.get((K) key)) { - if (map.remove(key, value)) { - buffer.add(item(1, (String) key, ((IDelta) map.get((K) key)).getBytes(), true, true)); - } - } - - if (buffer.size() > 0) { - queue(buffer); - return collection; - } - } - - return null; - } - } - - public Collection replaceValues(K key, Iterable values) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - if (map.containsKey(key)) { - List buffer = new ArrayList(); - - for (V value : values) { - if (value instanceof IDelta) { - if (!map.get(key).contains(value)) { - buffer.add(item(2, (String) key, ((IDelta) value).getBytes(), true, true)); - } - } else { - return null; - } - } - - if (buffer.size() > 0) { - queue(buffer); - return map.replaceValues(key, values); - } - } - } - - return null; - } - } - - public int size() { - synchronized(objectMutex) { - return map.size(); - } - } - - public Collection values() { - synchronized(objectMutex) { - return map.values(); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Entry entry : map.entries()) { - byte[] key = Baseline.toBytes(entry.getKey()); - byte[] value = Baseline.toBytes(entry.getValue()); - size += ((addByte) ? 1 : 0) + key.length + value.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(key); - buffer.put(value); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(map.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private byte[] item(int type, Object index, byte[] data, boolean useIndex, boolean useData) { - if (useIndex && !(index instanceof Byte) && !(index instanceof Short) - && !(index instanceof Integer) && !(index instanceof Float) - && !(index instanceof Long) && !(index instanceof String)) { - throw new IllegalArgumentException(); - } - - int size = 1 + ((useIndex) ? (2 + index.toString().getBytes().length) : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) { - if (index instanceof String) { - buffer.put(StringUtilities.getAsciiString((String) index)); - } else if (index instanceof Byte) { - buffer.put(((Byte) index).byteValue()); - } else if (index instanceof Short) { - buffer.putShort(((Short) index).shortValue()); - } else if (index instanceof Integer) { - buffer.putInt(((Integer) index).intValue()); - } else if (index instanceof Float) { - buffer.putFloat(((Float) index).floatValue()); - } else if (index instanceof Long) { - buffer.putLong(((Long) index).longValue()); - } else { - throw new IllegalArgumentException(); - } - } - if (useData) buffer.put(data); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/SWGSet.java b/src/resources/z/exp/objects/SWGSet.java deleted file mode 100644 index a960c0f2..00000000 --- a/src/resources/z/exp/objects/SWGSet.java +++ /dev/null @@ -1,280 +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 resources.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -/* A SWGSet element should extend Delta or implement IDelta */ - -@Persistent -public class SWGSet implements Set { - - private TreeSet set = new TreeSet(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGSet() { } - - public SWGSet(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public SWGSet(Set s) { - if (s instanceof SWGSet) { - this.object = ((SWGSet) s).object; - this.viewType = ((SWGSet) s).viewType; - this.updateType = ((SWGSet) s).updateType; - set.addAll(s); - } - } - - public boolean add(E e) { - synchronized(objectMutex) { - if (valid(e)) { - if (set.add(e)) { - queue(item(1, e, null, true, false)); - return true; - } - } - - return false; - } - } - - public boolean addAll(Collection c) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (E e : c) { - if (valid(e) && set.add(e)) { - buffer.add(item(1, e, null, true, false)); - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } else { - return false; - } - } - } - - public void clear() { - synchronized(objectMutex) { - queue(item(2, null, null, false, false)); - } - } - - public boolean contains(Object o) { - synchronized(objectMutex) { - return set.contains(o); - } - } - - public boolean containsAll(Collection c) { - synchronized(objectMutex) { - return set.containsAll(c); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return set.isEmpty(); - } - } - - public Iterator iterator() { - synchronized(objectMutex) { - return set.iterator(); - } - } - - public boolean remove(Object e) { - synchronized(objectMutex) { - if (valid(e) && set.remove(e)) { - queue(item(0, e, null, true, false)); - return true; - } - - return false; - } - } - - public boolean removeAll(Collection c) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (Object o : c) { - if (valid(o) && set.remove(o)) { - buffer.add(item(0, o, null, true, false)); - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } else { - return false; - } - } - } - - public boolean retainAll(Collection c) { - synchronized(objectMutex) { - return set.retainAll(c); - } - } - - public int size() { - synchronized(objectMutex) { - return set.size(); - } - } - - public Object[] toArray() { - synchronized(objectMutex) { - return set.toArray(); - } - } - - public T[] toArray(T[] a) { - synchronized(objectMutex) { - return set.toArray(a); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Object o : set) { - byte[] object = Baseline.toBytes(o); - size += object.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(set.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private boolean valid(Object o) { - if (o instanceof String || o instanceof Byte || o instanceof Short || - o instanceof Integer || o instanceof Float || o instanceof Long || - o instanceof IDelta) { - return true; - } else { - return false; - } - } - - private byte[] item(int type, Object index, byte[] data, boolean useIndex, boolean useData) { - if (useIndex && ((index instanceof IDelta) || !valid(index))) { - throw new IllegalArgumentException(); - } - - int size = 1 + ((useIndex) ? (2 + Baseline.toBytes(index).length) : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) buffer.put(Baseline.toBytes(index)); - if (useData) buffer.put(data); - buffer.flip(); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - buffer.flip(); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - buffer.flip(); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/building/BuildingMessageBuilder.java b/src/resources/z/exp/objects/building/BuildingMessageBuilder.java deleted file mode 100644 index b6905d33..00000000 --- a/src/resources/z/exp/objects/building/BuildingMessageBuilder.java +++ /dev/null @@ -1,49 +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 resources.z.exp.objects.building; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.tangible.TangibleMessageBuilder; - -public class BuildingMessageBuilder extends TangibleMessageBuilder { - - public BuildingMessageBuilder(BuildingObject object) { - super(object); - } - - public BuildingMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(deltaBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(deltaBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/building/BuildingObject.java b/src/resources/z/exp/objects/building/BuildingObject.java deleted file mode 100644 index 578c0dd7..00000000 --- a/src/resources/z/exp/objects/building/BuildingObject.java +++ /dev/null @@ -1,102 +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 resources.z.exp.objects.building; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.tangible.TangibleObject; - -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Entity -public class BuildingObject extends TangibleObject { - - @NotPersistent - private BuildingMessageBuilder messageBuilder; - - public BuildingObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - setVolume(255); - setOptionsBitmask(256); - setMaximumCondition(4320); - toggleStatic(); - } - - public BuildingObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public BuildingMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new BuildingMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/cell/CellMessageBuilder.java b/src/resources/z/exp/objects/cell/CellMessageBuilder.java deleted file mode 100644 index 92e25457..00000000 --- a/src/resources/z/exp/objects/cell/CellMessageBuilder.java +++ /dev/null @@ -1,59 +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 resources.z.exp.objects.cell; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -public class CellMessageBuilder extends ObjectMessageBuilder { - - public CellMessageBuilder(CellObject object) { - super(object); - } - - public CellMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/cell/CellObject.java b/src/resources/z/exp/objects/cell/CellObject.java deleted file mode 100644 index 059c8d3d..00000000 --- a/src/resources/z/exp/objects/cell/CellObject.java +++ /dev/null @@ -1,137 +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 resources.z.exp.objects.cell; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class CellObject extends BaseObject { - - @NotPersistent - CellMessageBuilder messageBuilder; - - public CellObject(long objectID, Planet planet, int cellNumber) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff"); - setCellNumber(cellNumber); - } - - public CellObject(long objectID, Planet planet) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff"); - } - - public CellObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("4", (byte) 1); // Unknown - baseline.put("cellNumber", 0); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("2", (long) 0); // Unknown - baseline.put("3", (long) 0); // Unknown - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getCellNumber() { - return (int) baseline3.get("cellNumber"); - } - - public void setCellNumber(int cellNumber) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("cellNumber", cellNumber); - } - - getContainer().notifyObservers(buffer, false); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - getContainer().notifyObservers(buffer, false); - } - - @Override - public CellMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new CellMessageBuilder(); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/creature/CreatureMessageBuilder.java b/src/resources/z/exp/objects/creature/CreatureMessageBuilder.java deleted file mode 100644 index d76e8383..00000000 --- a/src/resources/z/exp/objects/creature/CreatureMessageBuilder.java +++ /dev/null @@ -1,72 +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 resources.z.exp.objects.creature; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.tangible.TangibleMessageBuilder; - -@Persistent -public class CreatureMessageBuilder extends TangibleMessageBuilder { - - public CreatureMessageBuilder(CreatureObject creatureObject) { - super(creatureObject); - } - - public CreatureMessageBuilder() { - super(); - } - - @Override - public void buildBaseline1(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline1(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline4(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline4(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/creature/CreatureObject.java b/src/resources/z/exp/objects/creature/CreatureObject.java deleted file mode 100644 index 511875ea..00000000 --- a/src/resources/z/exp/objects/creature/CreatureObject.java +++ /dev/null @@ -1,1086 +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 resources.z.exp.objects.creature; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map.Entry; - -import org.apache.mina.core.buffer.IoBuffer; - -import protocol.swg.ChatSystemMessage; -import protocol.swg.ObjControllerMessage; -import protocol.swg.UpdatePVPStatusMessage; -import protocol.swg.UpdatePostureMessage; -import protocol.swg.objectControllerObjects.Posture; - -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - -import engine.clients.Client; -import resources.z.exp.buffs.Buff; -import resources.common.StringUtilities; -import resources.z.exp.equipment.Equipment; -import resources.z.exp.group.GroupInviteInfo; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMap; -import resources.z.exp.objects.SWGSet; -import engine.resources.common.CRC; -import engine.resources.objects.IPersistent; -import engine.resources.objects.SWGObject; -import resources.z.exp.skills.SkillMod; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -import resources.z.exp.objects.player.PlayerObject; -import resources.z.exp.objects.tangible.TangibleObject; - -@Entity -public class CreatureObject extends TangibleObject implements IPersistent { - - @NotPersistent - private Transaction txn; - - @NotPersistent - private CreatureMessageBuilder messageBuilder; - - // non-baseline vars - @NotPersistent - private List duelList = Collections.synchronizedList(new ArrayList()); - - public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - getBaseHAMList().add(0x00002FF8); - getBaseHAMList().add(0x000003E8); - getBaseHAMList().add(0x0000245F); - getBaseHAMList().add(0x000001F4); - getBaseHAMList().add(0x0000012C); - getBaseHAMList().add(0x000003E8); - setVolume(0x000F4240); - getComponentCustomizationList().add(0); - setOptionsBitmask(0x80); - setMaximumCondition(0x3A98); - getHamList().add(20000); - getHamList().add(0); - getHamList().add(12500); - getHamList().add(0); - getHamList().add(0x2C01); - getHamList().add(0); - getMaxHamList().add(20000); - getMaxHamList().add(0); - getMaxHamList().add(12500); - getMaxHamList().add(0); - getMaxHamList().add(0x2C01); - getMaxHamList().add(0); - getBuffList().put(0, new Buff("", 0)); // Initial Default Buff - } - - public CreatureObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(1); - initializeBaseline(4); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline1() { - Baseline baseline = super.getBaseline1(); - baseline.put("bankCredits", 0); - baseline.put("cashCredits", 0); - baseline.put("baseHamList", new SWGList(this, 1, 2, false)); - baseline.put("skills", new SWGSet(this, 1, 3, false)); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("posture", (byte) 1); - baseline.put("factionRank", (byte) 0); // For NPCs probably - baseline.put("ownerId", (long) 0); - baseline.put("height", (float) 1); - baseline.put("battleFatigue", 0); - baseline.put("stateBitmask", (long) 0); - return baseline; - } - - @Override - public Baseline getBaseline4() { - Baseline baseline = super.getBaseline4(); - baseline.put("accelerationMultiplierBase", (float) 1); - baseline.put("accelerationMultiplierMod", (float) 1); - baseline.put("hamEncumberanceList", new SWGList(this, 4, 2, false)); - baseline.put("skillMods", new SWGMap(this, 4, 3, true)); - baseline.put("speedMultiplierBase", (float) 1); - baseline.put("speedMultiplierMod", (float) 1); - baseline.put("listenToId", (long) 0); - baseline.put("runSpeed", (float) 7.3); - baseline.put("slopeModAngle", (float) 1); - baseline.put("slopeModPercent", (float) 1); - baseline.put("turnRadius", (float) 1); - baseline.put("walkSpeed", (float) 2.75); - baseline.put("waterModPercent", (float) 1); - baseline.put("missionCriticalObjects", new SWGMap(this, 4, 13, false)); - baseline.put("abilities", new SWGMap(this, 4, 14, true)); - baseline.put("15", (byte) 0); // Unknown (been seen as 0xD4) - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("level", (short) 90); - baseline.put("9", (int) 0xD007); - baseline.put("currentAnimation", ""); - baseline.put("moodAnimation", "neutral"); - baseline.put("weaponId", (long) 0); - baseline.put("groupId", (long) 0); - baseline.put("groupInviteInfo", new GroupInviteInfo((long) 0, "")); - baseline.put("guildId", 0); - baseline.put("targetId", (long) 0); - baseline.put("moodId", (byte) 0); - baseline.put("performanceCounter", 0); - baseline.put("performanceId", 0); - baseline.put("20", new SWGList(this, 6, 20, false)); // Unknown List - baseline.put("hamList", new SWGList(this, 6, 21, false)); - baseline.put("maxHamList", new SWGList(this, 6, 22, false)); - baseline.put("equipmentList", new SWGList(this, 6, 23, false)); - baseline.put("costume", ""); - baseline.put("lockMovement", false); - baseline.put("buffList", new SWGMap(this, 6, 26, false)); - // need to build an 0x01 int after the bufflist - baseline.put("27", (short) 0); - baseline.put("hologramColor", -1); - baseline.put("29", (byte) 1); - baseline.put("30", (short) 0); - baseline.put("appearanceEquipmentList", new SWGList(this, 6, 31, false)); - baseline.put("32", 0); - baseline.put("33", (short) 0); - baseline.put("34", (short) 0); // there's 35 elements, so 2 of these = shorts - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getBankCredits() { - synchronized(objectMutex) { - return (int) baseline1.get("bankCredits"); - } - } - - public void setBankCredits(int bankCredits) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline1.set("bankCredits", bankCredits); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public int getCashCredits() { - synchronized(objectMutex) { - return (int) baseline1.get("cashCredits"); - } - } - - public void setCashCredits(int cashCredits) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline1.set("cashCredits", cashCredits); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGList getBaseHAMList() { - return (SWGList) baseline1.get("baseHamList"); - } - - @SuppressWarnings("unchecked") - public SWGSet getSkills() { - return (SWGSet) baseline3.get("skills"); - } - - public void addSkill(String skill) { - if (!getSkills().contains(skill)) { - getSkills().add(skill); - } - } - - public void removeSkill(String skill) { - if (getSkills().contains(skill)) { - getSkills().remove(skill); - } - } - - public byte getPosture() { - synchronized(objectMutex) { - return (byte) baseline3.get("posture"); - } - } - - public void setPosture(byte posture) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("posture", posture); - } - - notifyObservers(buffer, true); - notifyObservers(new ObjControllerMessage(0x1B, new Posture(getObjectID(), posture)), true); - } - - public byte getFactionRank() { - synchronized(objectMutex) { - return (byte) baseline3.get("factionRank"); - } - } - - public void setFactionRank(byte factionRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("factionRank", factionRank); - } - - notifyObservers(buffer, true); - } - - public long getOwnerId() { - synchronized(objectMutex) { - return (long) baseline3.get("ownerId"); - } - } - - public void setOwnerId(long ownerId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("ownerId", ownerId); - } - - notifyObservers(buffer, true); - } - - public float getHeight() { - synchronized(objectMutex) { - return (float) baseline3.get("height"); - } - } - - public void setHeight(float height) { - height = (((height < 0.7) || (height > 1.5)) ? 1 : height); - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("height", height); - } - - notifyObservers(buffer, true); - } - - public int getBattleFatigue() { - synchronized(objectMutex) { - return (int) baseline3.get("battleFatigue"); - } - } - - public void setBattleFatigue(int battleFatigue) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("battleFatigue", battleFatigue); - } - - notifyObservers(buffer, true); - } - - public long getStateBitmask() { - synchronized(objectMutex) { - return (long) baseline3.get("stateBitmask"); - } - } - - public void setStateBitmask(long stateBitmask) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("stateBitmask", stateBitmask); - } - - notifyObservers(buffer, true); - } - - public float getAccelerationMultiplierBase() { - synchronized(objectMutex) { - return (float) baseline4.get("accelerationMultiplierBase"); - } - } - - public void setAccelerationMultiplierBase(float accelerationMultiplierBase) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("accelerationMultiplierBase", accelerationMultiplierBase); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getAccelerationMultiplierMod() { - synchronized(objectMutex) { - return (float) baseline4.get("accelerationMultiplierMod"); - } - } - - public void setAccelerationMultiplierMod(float accelerationMultiplierMod) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("accelerationMultiplierMod", accelerationMultiplierMod); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGList getHamEncumberanceList() { - return (SWGList) baseline4.get("hamEncumberanceList"); - } - - @SuppressWarnings("unchecked") - public SWGMap getSkillMods() { - return (SWGMap) baseline4.get("skillMods"); - } - - public SkillMod getSkillMod(String name) { - synchronized(objectMutex) { - if (getSkillMods().containsKey(name) && getSkillMods().get(name) != null) { - return getSkillMods().get(name); - } - - return null; - } - } - - public void addSkillMod(String name, int base) { - if (!getSkillMods().containsKey(name)) { - getSkillMods().put(name, new SkillMod(base, 0)); - } else { - SkillMod mod = getSkillMods().get(name); - getSkillMods().put(name, new SkillMod(mod.getBase() + base, mod.getModifier())); - } - } - - public void deductSkillMod(String name, int base) { - if (getSkillMods().containsKey(name)) { - SkillMod mod = getSkillMods().get(name); - mod = new SkillMod(mod.getBase() - base, mod.getModifier()); - - if (mod.getBase() - base <= 0) { - removeSkillMod(name); - } else { - getSkillMods().put(name, mod); - } - } - } - - public void removeSkillMod(String name) { - getSkillMods().remove(name); - } - - public float getSpeedMultiplierBase() { - synchronized(objectMutex) { - return (float) baseline4.get("speedMultiplierBase"); - } - } - - public void setSpeedMultiplierBase(float speedMultiplierBase) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("speedMultiplierBase", speedMultiplierBase); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getSpeedMultiplierMod() { - synchronized(objectMutex) { - return (float) baseline4.get("speedMultiplierMod"); - } - } - - public void setSpeedMultiplierMod(float speedMultiplierMod) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("speedMultiplierMod", speedMultiplierMod); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public long getListenToId() { - synchronized(objectMutex) { - return (long) baseline4.get("listenToId"); - } - } - - public void setListenToId(long listenToId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("listenToId", listenToId); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getRunSpeed() { - synchronized(objectMutex) { - return (float) baseline4.get("runSpeed"); - } - } - - public void setRunSpeed(float runSpeed) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("runSpeed", runSpeed); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getSlopeModAngle() { - synchronized(objectMutex) { - return (float) baseline4.get("slopeModAngle"); - } - } - - public void setSlopeModAngle(float slopeModAngle) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("slopeModAngle", slopeModAngle); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getSlopeModPercent() { - synchronized(objectMutex) { - return (float) baseline4.get("slopeModPercent"); - } - } - - public void setSlopeModPercent(float slopeModPercent) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("slopeModPercent", slopeModPercent); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getTurnRadius() { - synchronized(objectMutex) { - return (float) baseline4.get("turnRadius"); - } - } - - public void setTurnRadius(float turnRadius) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("turnRadius", turnRadius); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getWalkSpeed() { - synchronized(objectMutex) { - return (float) baseline4.get("walkSpeed"); - } - } - - public void setWalkSpeed(float walkSpeed) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("walkSpeed", walkSpeed); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getWaterModPercent() { - synchronized(objectMutex) { - return (float) baseline4.get("waterModPercent"); - } - } - - public void setWaterModPercent(float waterModPercent) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("waterModPercent", waterModPercent); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGMap getMissionCriticalObjects() { - return (SWGMap) baseline4.get("missionCriticalObjects"); - } - - @SuppressWarnings("unchecked") - public SWGMap getAbilities() { - return (SWGMap) baseline4.get("abilities"); - } - - public void addAbility(String abilityName) { - if (!getAbilities().containsKey(abilityName)) { - getAbilities().put(abilityName, 1); - } - } - - public void removeAbility(String abilityName) { - if (getAbilities().containsKey(abilityName)) { - getAbilities().remove(abilityName); - } - } - - public short getLevel() { - synchronized(objectMutex) { - return (short) baseline6.get("level"); - } - } - - public void setLevel(short level) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("level", level); - } - - notifyObservers(buffer, true); - } - - public String getCurrentAnimation() { - synchronized(objectMutex) { - return (String) baseline6.get("currentAnimation"); - } - } - - public void setCurrentAnimation(String currentAnimation) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("currentAnimation", currentAnimation); - } - - notifyObservers(buffer, true); - } - - public String getMoodAnimation() { - synchronized(objectMutex) { - return (String) baseline6.get("moodAnimation"); - } - } - - public void setMoodAnimation(String moodAnimation) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("moodAnimation", moodAnimation); - } - - notifyObservers(buffer, true); - } - - public long getWeaponId() { - synchronized(objectMutex) { - return (long) baseline6.get("weaponId"); - } - } - - public void setWeaponId(long weaponId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("weaponId", weaponId); - } - - notifyObservers(buffer, true); - } - - public long getGroupId() { - synchronized(objectMutex) { - return (long) baseline6.get("groupId"); - } - } - - public void setGroupId(long groupId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupId", groupId); - } - - notifyObservers(buffer, true); - } - - public GroupInviteInfo getGroupInviteInfo() { - return (GroupInviteInfo) baseline6.get("groupInviteInfo"); - } - - public long getInviteSenderId() { - synchronized(objectMutex) { - return getGroupInviteInfo().getSenderId(); - } - } - - public void setInviteSenderId(long inviteSenderId) { - synchronized(objectMutex) { - getGroupInviteInfo().setSender(inviteSenderId, getInviteSenderName()); - } - } - - public String getInviteSenderName() { - synchronized(objectMutex) { - return getGroupInviteInfo().getSenderName(); - } - } - - public void setInviteSenderName(String inviteSenderName) { - synchronized(objectMutex) { - getGroupInviteInfo().setSender(getInviteSenderId(), inviteSenderName); - } - } - - public long getInviteCounter() { - return 0; - } - - public void setInviteCounter(long inviteCounter) { - - } - - public void updateGroupInviteInfo() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupInviteInfo", getGroupInviteInfo()); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public int getGuildId() { - synchronized(objectMutex) { - return (int) baseline6.get("guildId"); - } - } - - public void setGuildId(int guildId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("guildId", guildId); - } - - notifyObservers(buffer, true); - } - - public long getTargetId() { - synchronized(objectMutex) { - return (long) baseline6.get("targetId"); - } - } - - public void setTargetId(long targetId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("targetId", targetId); - } - - notifyObservers(buffer, true); - } - - public byte getMoodId() { - synchronized(objectMutex) { - return (byte) baseline6.get("moodId"); - } - } - - public void setMoodId(byte moodId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("moodId", moodId); - } - - notifyObservers(buffer, true); - } - - public int getPerformanceCounter() { - synchronized(objectMutex) { - return (int) baseline6.get("performanceCounter"); - } - } - - public void setPerformanceCounter(int performanceCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("performanceCounter", performanceCounter); - } - - notifyObservers(buffer, true); - } - - public int getPerformanceId() { - synchronized(objectMutex) { - return (int) baseline6.get("performanceId"); - } - } - - public void setPerformanceId(int performanceId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("performanceId", performanceId); - } - - notifyObservers(buffer, true); - } - - @SuppressWarnings("unchecked") - public SWGList getHamList() { - return (SWGList) baseline6.get("hamList"); - } - - public int getHealth() { - synchronized(objectMutex) { - return getHamList().get(0); - } - } - - public void setHealth(int health) { - if (health > getMaxHealth()) { - health = getMaxHealth(); - } - - synchronized(objectMutex) { - getHamList().set(0, health); - } - } - - public int getAction() { - synchronized(objectMutex) { - return getHamList().get(2); - } - } - - public void setAction(int action) { - if (action > getMaxAction()) { - action = getMaxAction(); - } - - synchronized(objectMutex) { - getHamList().set(2, action); - } - } - - @SuppressWarnings("unchecked") - public SWGList getMaxHamList() { - return (SWGList) baseline6.get("maxHamList"); - } - - public int getMaxHealth() { - synchronized(objectMutex) { - return getMaxHamList().get(0); - } - } - - public void setMaxHealth(int maxHealth) { - synchronized(objectMutex) { - getMaxHamList().set(0, maxHealth); - } - } - - public int getMaxAction() { - synchronized(objectMutex) { - return getMaxHamList().get(2); - } - } - - public void setMaxAction(int maxAction) { - synchronized(objectMutex) { - getMaxHamList().set(2, maxAction); - } - } - - @SuppressWarnings("unchecked") - public SWGList getEquipmentList() { - return (SWGList) baseline6.get("equipmentList"); - } - - public void equipObject(SWGObject object) { - if (object instanceof TangibleObject) { - getEquipmentList().add(new Equipment(object)); - } - } - - public void unequipObject(SWGObject object) { - if (object instanceof TangibleObject) { - for (Equipment equipment : getEquipmentList()) { - if (equipment.getObjectId() == object.getObjectId()) { - getEquipmentList().remove(equipment); - } - } - } - } - - @SuppressWarnings("unchecked") - public SWGMap getBuffList() { - return (SWGMap) baseline6.get("buffList"); - } - - public void addBuff(Buff buff) { - synchronized(objectMutex) { - PlayerObject player = (PlayerObject) this.getSlottedObject("ghost"); - buff.setTotalPlayTime((int) (player.getTotalPlayTime() + (System.currentTimeMillis() - player.getLastPlayTimeUpdate()) / 1000)); - } - - getBuffList().put(CRC.StringtoCRC(buff.getBuffName()), buff); - - synchronized(objectMutex) { - buff.setStartTime(); - } - } - - public void removeBuff(Buff buff) { - getBuffList().remove(CRC.StringtoCRC(buff.getBuffName())); - } - - public Buff getBuffByName(String buffName) { - for (Entry entry : getBuffList().entrySet()) { - if (entry.getKey().equals(CRC.StringtoCRC(buffName))) { - return entry.getValue(); - } - } - - return null; - } - - @SuppressWarnings("unchecked") - public SWGList getAppearanceEquipmentList() { - return (SWGList) baseline6.get("appearanceEquipmentList"); - } - - public void equipAppearance(SWGObject object) { - if (object instanceof TangibleObject) { - getAppearanceEquipmentList().add(new Equipment(object)); - } - } - - public void unequipAppearance(SWGObject object) { - if (object instanceof TangibleObject) { - for (Equipment equipment : getAppearanceEquipmentList()) { - if (equipment.getObjectId() == object.getObjectId()) { - getAppearanceEquipmentList().remove(equipment); - } - } - } - } - - public List getDuelList() { - return duelList; - } - - public boolean isInDuelList(long objectId) { - if (duelList.contains(objectId)) { - return true; - } - - return false; - } - - public boolean isInDuelList(SWGObject object) { - return isInDuelList(object.getObjectId()); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public CreatureMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new CreatureMessageBuilder(this); - } - - return messageBuilder; - } - } - - @SuppressWarnings("unused") - @Override - public void sendBaselines(Client destination) { - if (destination == null || destination.getSession() == null) { - System.out.println("NULL session"); - return; - } - - System.out.println(StringUtilities.bytesToHex(baseline3.getBaseline().array())); - destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - if (destination == getClient()) { - //destination.getSession().write(baseline1.getBaseline()); - //destination.getSession().write(baseline4.getBaseline()); - } - //destination.getSession().write(baseline8().getBaseline()); - //destination.getSession().write(baseline9().getBaseline()); - - UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), (byte) 0); - //destination.getSession().write(upm.serialize()); - - if (destination != getClient()) { - UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); - - int factionStatus = getFactionStatus(); - String faction = getFaction(); - - if (factionStatus == 1 && faction == "imperial") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); - upvpm.setStatus(16); - } - - if (factionStatus == 1 && faction == "rebel") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); - upvpm.setStatus(16); - } - - if (factionStatus == 2 && faction == "imperial") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); - upvpm.setStatus(55); - } - - if (factionStatus == 2 && faction == "rebel") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); - upvpm.setStatus(55); - } - - if (factionStatus == 0 && faction == "neutral") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); - upvpm.setStatus(16); - } else { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); - upvpm.setStatus(16); - } - - destination.getSession().write(upvpm.serialize()); - } - } - - public void sendSystemMessage(String message, byte displayType) { - if (getClient() != null && getClient().getSession() != null) { - ChatSystemMessage systemMsg = new ChatSystemMessage(message, displayType); - getClient().getSession().write(systemMsg.serialize()); - } - } - - public Transaction getTransaction() { - return txn; - } - - public void createTransaction(Environment env) { - txn = env.beginTransaction(null, null); - } - -} diff --git a/src/resources/z/exp/objects/factorycrate/FactoryCrateMessageBuilder.java b/src/resources/z/exp/objects/factorycrate/FactoryCrateMessageBuilder.java deleted file mode 100644 index a3558047..00000000 --- a/src/resources/z/exp/objects/factorycrate/FactoryCrateMessageBuilder.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.factorycrate; - -public class FactoryCrateMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/factorycrate/FactoryCrateObject.java b/src/resources/z/exp/objects/factorycrate/FactoryCrateObject.java deleted file mode 100644 index e69c6c15..00000000 --- a/src/resources/z/exp/objects/factorycrate/FactoryCrateObject.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.factorycrate; - -public class FactoryCrateObject { - -} diff --git a/src/resources/z/exp/objects/group/GroupMessageBuilder.java b/src/resources/z/exp/objects/group/GroupMessageBuilder.java deleted file mode 100644 index 807b0a2a..00000000 --- a/src/resources/z/exp/objects/group/GroupMessageBuilder.java +++ /dev/null @@ -1,49 +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 resources.z.exp.objects.group; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.universe.UniverseMessageBuilder; - -public class GroupMessageBuilder extends UniverseMessageBuilder { - - public GroupMessageBuilder(GroupObject groupObject) { - super(groupObject); - } - - public GroupMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/group/GroupObject.java b/src/resources/z/exp/objects/group/GroupObject.java deleted file mode 100644 index 30ddc659..00000000 --- a/src/resources/z/exp/objects/group/GroupObject.java +++ /dev/null @@ -1,256 +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 resources.z.exp.objects.group; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.NotPersistent; - -import resources.z.exp.group.Member; -import resources.z.exp.group.MemberInfo; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.creature.CreatureObject; -import resources.z.exp.objects.universe.UniverseObject; - -import engine.clients.Client; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -public class GroupObject extends UniverseObject { - - @NotPersistent - private GroupMessageBuilder messageBuilder; - - public GroupObject(long objectId) { - super(objectId, null, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/group/shared_group_object.iff"); - } - - public GroupObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("memberList", new SWGList(this, 6, 2, false)); - baseline.put("memberInfoList", new SWGList(this, 6, 3, false)); - baseline.put("4", ""); - baseline.put("groupLevel", (short) 0); - baseline.put("6", 0); - baseline.put("groupLeader", null); - baseline.put("lootMaster", null); - baseline.put("lootMode", 0); - return baseline; - } - - @SuppressWarnings("unchecked") - public SWGList getMemberList() { - return (SWGList) baseline6.get("memberList"); - } - - @SuppressWarnings("unchecked") - public SWGList getMemberInfoList() { - return (SWGList) baseline6.get("memberInfoList"); - } - - public void addMember(SWGObject member) { - if (member instanceof CreatureObject && member.getClient() != null) { - SWGList memberList = getMemberList(); - SWGList memberInfoList = getMemberInfoList(); - - if (memberList.size() >= 8) { - ((CreatureObject) member).sendSystemMessage("@group:join_full", (byte) 0); - } else { - Member newMember = new Member(member); - - if (memberList.add(newMember)) { - memberInfoList.add(new MemberInfo(memberList.indexOf(newMember), 0)); - - if (((CreatureObject) member).getLevel() > getGroupLevel()) { - setGroupLevel(((CreatureObject) member).getLevel()); - } - } - } - } - } - - public void removeMember(SWGObject member) { - if (member instanceof CreatureObject && member.getClient() != null) { - SWGList memberList = getMemberList(); - SWGList memberInfoList = getMemberInfoList(); - - if (!(memberList.size() <= 0)) { - int index = memberList.indexOf(member); - - if (memberList.remove(member)) { - memberInfoList.remove(index); - - synchronized(objectMutex) { - for (int i = 0; i < memberInfoList.size(); i++) { - if (memberInfoList.get(i).getMemberId() != i) { - memberInfoList.set(i, memberInfoList.get(i).setMemberId(i)); - } - } - } - } - - short maxLevel = 0; - - for (Member memberObject : getMemberList()) { - if (memberObject.getMember() instanceof CreatureObject) { - CreatureObject creature = (CreatureObject) memberObject.getMember(); - - if (creature.getLevel() > maxLevel) { - maxLevel = creature.getLevel(); - } - } - } - - if (maxLevel != getGroupLevel()) { - setGroupLevel(maxLevel); - } - } - } - } - - public boolean setMemberInfo(SWGObject object, long info) { - if (object instanceof CreatureObject && object.getClient() != null) { - for (Member member : getMemberList()) { - if (member.getMember().equals(member)) { - int id = getMemberList().indexOf(member); - getMemberInfoList().set(id, new MemberInfo(info, id)); - return true; - } - } - } - - return false; - } - - public short getGroupLevel() { - synchronized(objectMutex) { - return (short) baseline6.get("groupLevel"); - } - } - - public void setGroupLevel(short groupLevel) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupLevel", groupLevel); - } - - notifyObservers(buffer, false); - } - - public SWGObject getGroupLeader() { - synchronized(objectMutex) { - return (SWGObject) baseline6.get("groupLeader"); - } - } - - public void setGroupLeader(SWGObject groupLeader) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupLeader", groupLeader); - } - - notifyObservers(buffer, false); - } - - public SWGObject getLootMaster() { - synchronized(objectMutex) { - return (SWGObject) baseline6.get("lootMaster"); - } - } - - public void setLootMaster(SWGObject lootMaster) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("lootMaster", lootMaster); - } - - notifyObservers(buffer, false); - } - - public int getLootMode() { - synchronized(objectMutex) { - return (int) baseline6.get("lootMode"); - } - } - - public void setLootMode(int lootMode) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("lootMode", lootMode); - } - - notifyObservers(buffer, false); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public GroupMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new GroupMessageBuilder(); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/guild/GuildMessageBuilder.java b/src/resources/z/exp/objects/guild/GuildMessageBuilder.java deleted file mode 100644 index 21d64947..00000000 --- a/src/resources/z/exp/objects/guild/GuildMessageBuilder.java +++ /dev/null @@ -1,48 +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 resources.z.exp.objects.guild; - -import java.util.Map; -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.universe.UniverseMessageBuilder; - -public class GuildMessageBuilder extends UniverseMessageBuilder { - - public GuildMessageBuilder(GuildObject guildObject) { - super(guildObject); - } - - public GuildMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/guild/GuildObject.java b/src/resources/z/exp/objects/guild/GuildObject.java deleted file mode 100644 index 7df685e4..00000000 --- a/src/resources/z/exp/objects/guild/GuildObject.java +++ /dev/null @@ -1,192 +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 resources.z.exp.objects.guild; - -import java.util.Map; -import java.util.TreeMap; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.gcw.CurrentServerGCWZoneHistory; -import resources.gcw.CurrentServerGCWZonePercent; -import resources.gcw.OtherServerGCWZonePercent; -import resources.z.exp.guild.Guild; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMap; -import resources.z.exp.objects.SWGMultiMap; -import resources.z.exp.objects.universe.UniverseObject; - -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - -import engine.clients.Client; -import engine.resources.objects.IPersistent; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Entity -public class GuildObject extends UniverseObject implements IPersistent { - - @NotPersistent - private GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this); - - private Map> zoneMap = new TreeMap>(); - - @NotPersistent - private Transaction txn; - - public GuildObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public GuildObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("nextUpdateTime", 1321383613); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("guildList", new SWGList(this, 3, 4, false)); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("currentServerGCWZonePercentMap", new SWGMap(this, 6, 2, true)); - baseline.put("currentServerGCWTotalPercentMap", new SWGMap(this, 6, 3, true)); - baseline.put("currentServerGCWZoneHistoryMap", new SWGMultiMap(this, 6, 4, true)); - baseline.put("currentServerGCWTotalHistoryMap", new SWGMultiMap(this, 6, 5, true)); - baseline.put("otherServerGCWZonePercentMap", new SWGMultiMap(this, 6, 6, true)); - baseline.put("otherServerGCWTotalPercentMap", new SWGMultiMap(this, 6, 7, true)); - baseline.put("8", 5); - return baseline; - } - - @SuppressWarnings("unchecked") - public SWGList getGuildList() { - return (SWGList) baseline3.get("guildList"); - } - - @SuppressWarnings("unchecked") - public SWGMap getCurrentServerGCWZonePercentMap() { - return (SWGMap) baseline6.get("currentServerGCWZonePercentMap"); - } - - @SuppressWarnings("unchecked") - public SWGMap getCurrentServerGCWTotalPercentMap() { - return (SWGMap) baseline6.get("currentServerGCWTotalPercentMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getCurrentServerGCWZoneHistoryMap() { - return (SWGMultiMap) baseline6.get("currentServerGCWZoneHistoryMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getCurrentServerGCWTotalHistoryMap() { - return (SWGMultiMap) baseline6.get("currentServerGCWTotalHistoryMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getOtherServerGCWZonePercentMap() { - return (SWGMultiMap) baseline6.get("otherServerGCWZonePercentMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getOtherServerGCWTotalPercentMap() { - return (SWGMultiMap) baseline6.get("otherServerGCWTotalPercentMap"); - } - - public Map> getZoneMap() { - synchronized(objectMutex) { - return zoneMap; - } - } - - public int getNextUpdateTime() { - synchronized(objectMutex) { - return (int) otherVariables.get("nextUpdateTime"); - } - } - - public int setNextUpdateTime(long nextUpdateTime) { - synchronized(objectMutex) { - otherVariables.set("nextUpdateTime", (int) nextUpdateTime); - return getNextUpdateTime(); - } - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public GuildMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new GuildMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - notifyClients(baseline6.createDelta(updateType, buffer.array()), false); - } - - public Transaction getTransaction() { - return txn; - } - - public void createTransaction(Environment env) { - txn = env.beginTransaction(null, null); - } - -} diff --git a/src/resources/z/exp/objects/harvester/HarvesterMessageBuilder.java b/src/resources/z/exp/objects/harvester/HarvesterMessageBuilder.java deleted file mode 100644 index 06f08e30..00000000 --- a/src/resources/z/exp/objects/harvester/HarvesterMessageBuilder.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.harvester; - -public class HarvesterMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/harvester/HarvesterObject.java b/src/resources/z/exp/objects/harvester/HarvesterObject.java deleted file mode 100644 index a09905cb..00000000 --- a/src/resources/z/exp/objects/harvester/HarvesterObject.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.harvester; - -public class HarvesterObject { - -} diff --git a/src/resources/z/exp/objects/installation/InstallationMessageBuilder.java b/src/resources/z/exp/objects/installation/InstallationMessageBuilder.java deleted file mode 100644 index 054ba875..00000000 --- a/src/resources/z/exp/objects/installation/InstallationMessageBuilder.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.installation; - -public class InstallationMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/installation/InstallationObject.java b/src/resources/z/exp/objects/installation/InstallationObject.java deleted file mode 100644 index e57c0460..00000000 --- a/src/resources/z/exp/objects/installation/InstallationObject.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.installation; - -public class InstallationObject { - -} diff --git a/src/resources/z/exp/objects/intangible/IntangibleMessageBuilder.java b/src/resources/z/exp/objects/intangible/IntangibleMessageBuilder.java deleted file mode 100644 index b069678a..00000000 --- a/src/resources/z/exp/objects/intangible/IntangibleMessageBuilder.java +++ /dev/null @@ -1,62 +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 resources.z.exp.objects.intangible; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -@Persistent -public class IntangibleMessageBuilder extends ObjectMessageBuilder { - - public IntangibleMessageBuilder(IntangibleObject object) { - super(object); - } - - public IntangibleMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/intangible/IntangibleObject.java b/src/resources/z/exp/objects/intangible/IntangibleObject.java deleted file mode 100644 index d02b9ccf..00000000 --- a/src/resources/z/exp/objects/intangible/IntangibleObject.java +++ /dev/null @@ -1,139 +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 resources.z.exp.objects.intangible; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class IntangibleObject extends BaseObject { - - @NotPersistent - private IntangibleMessageBuilder messageBuilder; - - public IntangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public IntangibleObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("genericInt", 0); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getGenericInt() { - synchronized(objectMutex) { - return (int) baseline3.get("genericInt"); - } - } - - public void setGenericInt(int genericInt) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("genericInt", genericInt); - } - - notifyClients(buffer, true); - } - - public void incrementGenericInt(int increase) { - setGenericInt((getGenericInt() + increase)); - } - - public void decrementGenericInt(int decrease) { - setGenericInt((((getGenericInt() - decrease) < 1) ? 0 : (getGenericInt() - decrease))); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public IntangibleMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new IntangibleMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/manufacture/ManufactureSchematicMessageBuilder.java b/src/resources/z/exp/objects/manufacture/ManufactureSchematicMessageBuilder.java deleted file mode 100644 index 97d20d8e..00000000 --- a/src/resources/z/exp/objects/manufacture/ManufactureSchematicMessageBuilder.java +++ /dev/null @@ -1,64 +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 resources.z.exp.objects.manufacture; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.intangible.IntangibleMessageBuilder; - -public class ManufactureSchematicMessageBuilder extends IntangibleMessageBuilder { - - public ManufactureSchematicMessageBuilder(ManufactureSchematicObject object) { - super(object); - } - - public ManufactureSchematicMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline7(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline7(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/manufacture/ManufactureSchematicObject.java b/src/resources/z/exp/objects/manufacture/ManufactureSchematicObject.java deleted file mode 100644 index 88e49380..00000000 --- a/src/resources/z/exp/objects/manufacture/ManufactureSchematicObject.java +++ /dev/null @@ -1,603 +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 resources.z.exp.objects.manufacture; - -import java.util.ArrayList; -import java.util.Collection; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; -import resources.z.exp.manufacture.Property; -import resources.z.exp.manufacture.SubList; -import resources.z.exp.manufacture.TableAndKey; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMultiMap; -import resources.z.exp.objects.intangible.IntangibleObject; - -@Persistent -public class ManufactureSchematicObject extends IntangibleObject { - - @NotPersistent - private ManufactureSchematicMessageBuilder messageBuilder; - - public ManufactureSchematicObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - initializeBaseline(7); - } - - public ManufactureSchematicObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("totalSlots", (byte) 0); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("properties", new SWGMultiMap(this, 3, 5, true)); - baseline.put("schematicComplexity", 0); - baseline.put("schematicDataSize", (float) 1); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("schematicCustomization", new byte[] { }); - baseline.put("customizationTemplate", ""); - baseline.put("schematicPrototype", ""); - baseline.put("inUse", false); - baseline.put("filledSlots", (byte) 0); - return baseline; - } - - @Override - public Baseline getBaseline7() { - Baseline baseline = super.getBaseline7(); - baseline.put("slotNameList", new SWGList(this, 7, 0, false)); - baseline.put("slotContentsList", new SWGList(this, 7, 1, false)); - baseline.put("ingredientList", new SWGList>(this, 7, 2, false)); - baseline.put("quantityList", new SWGList>(this, 7, 3, false)); - baseline.put("qualityList", new SWGList(this, 7, 4, false)); - baseline.put("cleanSlotList", new SWGList(this, 7, 5, false)); - baseline.put("slotIndexList", new SWGList(this, 7, 6, false)); - baseline.put("ingredientsCounter", (byte) 0); - baseline.put("experimentationNameList", new SWGList(this, 7, 8, false)); - baseline.put("currentExperimentationValueList", new SWGList(this, 7, 9, false)); - baseline.put("experimentationOffsetList", new SWGList(this, 7, 10, false)); - baseline.put("bluebarList", new SWGList(this, 7, 11, false)); - baseline.put("maxExperimentationList", new SWGList(this, 7, 12, false)); - baseline.put("customizationNameList", new SWGList(this, 7, 13, false)); - baseline.put("palleteSelectionList", new SWGList(this, 7, 14, false)); - baseline.put("palleteStartIndexList", new SWGList(this, 7, 15, false)); - baseline.put("palleteEndIndexList", new SWGList(this, 7, 16, false)); - baseline.put("customizationCounter", (byte) 0); - baseline.put("riskFactor", (float) 0); - baseline.put("objectTemplateCustomizationList", new SWGList(this, 7, 19, false)); - baseline.put("ready", true); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public void setQuantity(int quantity) { - setGenericInt(quantity); - } - - public void incrementQuantity(int increase) { - incrementGenericInt(increase); - } - - public void decrementQuantity(int decrease) { - decrementGenericInt(decrease); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getPropertiesMap() { - return (SWGMultiMap) baseline3.get("properties"); - } - - public Collection getPropertiesForFile(String stfFile) { - synchronized(objectMutex) { - if (getPropertiesMap().containsKey(stfFile)) { - return getPropertiesMap().get(stfFile); - } else { - return new ArrayList(); - } - } - } - - public Collection getAllProperties() { - synchronized(objectMutex) { - return getPropertiesMap().values(); - } - } - - public boolean containsKey(String stfFile, String key) { - synchronized(objectMutex) { - for (Property property : getPropertiesMap().get(stfFile)) { - if (property.getKey().equals(key)) { - return true; - } - } - - return false; - } - } - - public boolean containsKey(String key) { - synchronized(objectMutex) { - for (Property property : getPropertiesMap().values()) { - if (property.getKey().equals(key)) { - return true; - } - } - - return false; - } - } - - public Property getProperty(String stfFile, String key) { - synchronized(objectMutex) { - for (Property property: getPropertiesMap().get(stfFile)) { - if (property.getKey().equals(key)) { - return property; - } - } - - return null; - } - } - - public Property getProperty(String key) { - synchronized(objectMutex) { - for (Property property: getPropertiesMap().values()) { - if (property.getKey().equals(key)) { - return property; - } - } - - return null; - } - } - - public void addProperty(String stfFile, String key, float value) { - if (!containsKey(stfFile, key)) { - getPropertiesMap().put(stfFile, new Property(key, value)); - } - } - - public void setProperty(String stfFile, String key, float value) { - if (getPropertiesMap().containsKey(stfFile)) { - for (Property property : getPropertiesMap().get(stfFile)) { - if (property.getKey().equals(key)) { - property.setValue(value); - getPropertiesMap().replaceValues(stfFile, getPropertiesMap().get(stfFile)); - return; - } - } - } - } - - public void removeProperty(String stfFile, String key) { - if (containsKey(stfFile, key)) { - getPropertiesMap().remove(stfFile, getProperty(key)); - } - } - - public void removeFile(String stfFile) { - getPropertiesMap().removeAll(stfFile); - } - - public int getSchematicComplexity() { - synchronized(objectMutex) { - return (int) baseline3.get("schematicComplexity"); - } - } - - public void setSchematicComplexity(int schematicComplexity) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("schematicComplexity", schematicComplexity); - } - - notifyClients(buffer, false); - } - - public float getSchematicDataSize() { - synchronized(objectMutex) { - return (float) baseline3.get("schematicDataSize"); - } - } - - public void setSchematicDataSize(float schematicDataSize) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("schematicDataSize", schematicDataSize); - } - - notifyClients(buffer, false); - } - - public byte[] getSchematicCustomization() { - synchronized(objectMutex) { - return (byte[]) baseline6.get("schematicCustomization"); - } - } - - public void setSchematicCustomization(byte[] schematicCustomization) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("schematicCustomization", schematicCustomization); - } - - notifyClients(buffer, false); - } - - public String getCustomizationTemplate() { - synchronized(objectMutex) { - return (String) baseline6.get("customizationTemplate"); - } - } - - public void setCustomizationTemplate(String customizationTemplate) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("customizationTemplate", customizationTemplate); - } - - notifyClients(buffer, false); - } - - public String getSchematicTemplate() { - synchronized(objectMutex) { - return (String) baseline6.get("schematicTemplate"); - } - } - - public void setSchematicTemplate(String schematicTemplate) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("schematicTemplate", schematicTemplate); - } - - notifyClients(buffer, false); - } - - public boolean inUse() { - synchronized(objectMutex) { - return (boolean) baseline6.get("inUse"); - } - } - - public void setInUse(boolean inUse) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("inUse", inUse); - } - - notifyClients(buffer, false); - } - - public void toggleInUse() { - setInUse(!inUse()); - } - - public byte getTotalSlots() { - synchronized(objectMutex) { - return (byte) otherVariables.get("totalSlots"); - } - } - - public void setTotalSlots(byte totalSlots) { - synchronized(objectMutex) { - otherVariables.set("totalSlots", totalSlots); - } - } - - public byte getFilledSlots() { - synchronized(objectMutex) { - return (byte) baseline6.get("filledSlots"); - } - } - - public void setFilledSlots(byte filledSlots) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("filledSlots", filledSlots); - } - - notifyClients(buffer, false); - } - - public void incrementFilledSlots(int increase) { - setFilledSlots(((byte) (getFilledSlots() + ((byte) increase)))); - } - - public void decrementFilledSlots(int decrease) { - setFilledSlots(((byte) (((getFilledSlots() - ((byte) decrease)) < 0) ? ((byte) 0) : (getFilledSlots() - ((byte) decrease))))); - } - - @SuppressWarnings("unchecked") - public SWGList getSlotNameList() { - return (SWGList) baseline7.get("slotNameList"); - } - - @SuppressWarnings("unchecked") - public SWGList getSlotContentsList() { - return (SWGList) baseline7.get("slotContentsList"); - } - - @SuppressWarnings("unchecked") - public SWGList> getIngredientList() { - return (SWGList>) baseline7.get("ingredientList"); - } - - @SuppressWarnings("unchecked") - public SWGList> getQuantityList() { - return (SWGList>) baseline7.get("quantityList"); - } - - @SuppressWarnings("unchecked") - public SWGList getQualityList() { - return (SWGList) baseline7.get("quantityList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCleanSlotList() { - return (SWGList) baseline7.get("cleanSlotList"); - } - - @SuppressWarnings("unchecked") - public SWGList getSlotIndexList() { - return (SWGList) baseline7.get("slotIndexList"); - } - - public byte getIngredientsCounter() { - return (byte) baseline7.get("ingredientsCounter"); - } - - public void setIngredientsCounter(byte ingredientsCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("ingredientsCounter", ingredientsCounter); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - public void incrementIngredientsCounter(int increase) { - setIngredientsCounter((byte) (getIngredientsCounter() + ((byte) increase))); - } - - public void decrementIngredientsCoutner(int decrease) { - byte ingredientsCounter = getIngredientsCounter(); - setIngredientsCounter(((ingredientsCounter < 0) ? 0 : ((byte) (ingredientsCounter - ((byte) decrease))))); - } - - @SuppressWarnings("unchecked") - public SWGList getExperimentationNameList() { - return (SWGList) baseline7.get("experimentationNameList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCurrentExperimentationValueList() { - return (SWGList) baseline7.get("currentExperimentationValueList"); - } - - @SuppressWarnings("unchecked") - public SWGList getExperimentationOffsetList() { - return (SWGList) baseline7.get("experimentationOffsetList"); - } - - @SuppressWarnings("unchecked") - public SWGList getBlueBarList() { - return (SWGList) baseline7.get("blueBarList"); - } - - @SuppressWarnings("unchecked") - public SWGList getMaxExperimentationList() { - return (SWGList) baseline7.get("maxExperimentationList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCustomizationNameList() { - return (SWGList) baseline7.get("customizationNameList"); - } - - @SuppressWarnings("unchecked") - public SWGList getPalleteSelectionList() { - return (SWGList) baseline7.get("palleteSelectionList"); - } - - @SuppressWarnings("unchecked") - public SWGList getPalleteStartIndexList() { - return (SWGList) baseline7.get("palleteStartIndexList"); - } - - @SuppressWarnings("unchecked") - public SWGList getPalleteEndIndexList() { - return (SWGList) baseline7.get("palleteEndIndexList"); - } - - public byte getCustomizationCounter() { - synchronized(objectMutex) { - return (byte) baseline7.get("customizationCounter"); - } - } - - public void setCustomizationCounter(byte customizationCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("customizationCounter", customizationCounter); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - public void incrementCustomizationCounter(int increase) { - - } - - public void decrementCustomizationCounter(int decrease) { - - } - - public float getRiskFactor() { - synchronized(objectMutex) { - return (float) baseline7.get("riskFactor"); - } - } - - public void setRiskFactor(float riskFactor) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("riskFactor", riskFactor); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGList getObjectTemplateCustomizationList() { - return (SWGList) baseline7.get("objectTemplateCustomizationList"); - } - - public boolean isReady() { - synchronized(objectMutex) { - return (boolean) baseline7.get("isReady"); - } - } - - public void setReady(boolean ready) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("ready", ready); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - public void toggleReady() { - setReady(!isReady()); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public ManufactureSchematicMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new ManufactureSchematicMessageBuilder(this); - } - - return messageBuilder; - } - } - - public void sendBaseline7(Client destination) { - destination.getSession().write(baseline7.getBaseline()); - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - destination.getSession().write(baseline8.getBaseline()); - destination.getSession().write(baseline9.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 1: - case 4: - case 7: - if (getGrandparent().getClient() != null) { - buffer = getBaseline(viewType).createDelta(updateType, buffer.array()); - getGrandparent().getClient().getSession().write(buffer); - } - - return; - case 3: - case 6: - case 8: - case 9: - notifyObservers(getBaseline(viewType).createDelta(updateType, buffer.array()), true); - default: - return; - } - } - -} diff --git a/src/resources/z/exp/objects/mission/MissionMessageBuilder.java b/src/resources/z/exp/objects/mission/MissionMessageBuilder.java deleted file mode 100644 index b1626472..00000000 --- a/src/resources/z/exp/objects/mission/MissionMessageBuilder.java +++ /dev/null @@ -1,59 +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 resources.z.exp.objects.mission; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.intangible.IntangibleMessageBuilder; - -public class MissionMessageBuilder extends IntangibleMessageBuilder { - - public MissionMessageBuilder(MissionObject object) { - super(object); - } - - public MissionMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/mission/MissionObject.java b/src/resources/z/exp/objects/mission/MissionObject.java deleted file mode 100644 index fdb43469..00000000 --- a/src/resources/z/exp/objects/mission/MissionObject.java +++ /dev/null @@ -1,329 +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 resources.z.exp.objects.mission; - -import org.apache.mina.core.buffer.IoBuffer; - -import main.NGECore; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -import resources.common.Stf; -import resources.common.UString; -import resources.z.exp.mission.MissionLocation; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.intangible.IntangibleObject; -import resources.z.exp.objects.waypoint.WaypointObject; - -@Persistent -public class MissionObject extends IntangibleObject { - - @NotPersistent - private MissionMessageBuilder messageBuilder; - - public MissionObject(NGECore core, long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - baseline3.set("waypoint", (WaypointObject) core.objectService.createObject("object/waypoint/base/shared_base_waypoint.iff", planet)); - } - - public MissionObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("difficultyLevel", 0); - baseline.put("startLocation", new MissionLocation(new Point3D(0, 0, 0), 0, "")); - baseline.put("creator", new UString()); - baseline.put("creditReward", 0); - baseline.put("targetObject", 0); - baseline.put("description", new Stf()); - baseline.put("title", new Stf()); - baseline.put("repeatCounter", 0); - baseline.put("missionType", ""); - baseline.put("targetName", ""); - baseline.put("waypoint", new WaypointObject()); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getDifficultyLevel() { - synchronized(objectMutex) { - return (int) baseline3.get("difficultyLevel"); - } - } - - public void setDifficultyLevel(int difficultyLevel) { - synchronized(objectMutex) { - baseline3.set("difficultyLevel", difficultyLevel); - } - } - - public MissionLocation getStartLocation() { - synchronized(objectMutex) { - return (MissionLocation) baseline3.get("startLocation"); - } - } - - public void setStartLocation(Point3D position, SWGObject object, Planet planet) { - setStartLocation(position, object, planet.getName()); - } - - public void setStartLocation(Point3D position, SWGObject object, String planet) { - synchronized(objectMutex) { - MissionLocation startLocation = new MissionLocation(position.clone(), object.getObjectID(), planet); - baseline3.set("startLocation", startLocation); - } - } - - public String getCreator() { - synchronized(objectMutex) { - return (String) baseline3.get("creator"); - } - } - - public void setCreator(String creator) { - synchronized(objectMutex) { - baseline3.set("creator", creator); - } - } - - public int getCreditReward() { - synchronized(objectMutex) { - return (int) baseline3.get("creditReward"); - } - } - - public void setCreditReward(int creditReward) { - synchronized(objectMutex) { - baseline3.set("creditReward", creditReward); - } - } - - public MissionLocation getDestination() { - synchronized(objectMutex) { - return (MissionLocation) baseline3.get("destination"); - } - } - - public void setDestination(Point3D position, SWGObject object, Planet planet) { - setDestination(position, object, planet.getName()); - } - - public void setDestination(Point3D position, SWGObject object, String planet) { - synchronized(objectMutex) { - MissionLocation destination = new MissionLocation(position.clone(), object.getObjectID(), planet); - baseline3.set("destination", destination); - } - } - - public int getTargetObject() { - synchronized(objectMutex) { - return (int) baseline3.get("targetObject"); - } - } - - public void setTargetObject(int targetObject) { - synchronized(objectMutex) { - baseline3.set("targetObject", targetObject); - } - } - - public Stf getDescription() { - synchronized(objectMutex) { - return (Stf) baseline3.get("description"); - } - } - - public void setDescription(String stfFilename, String string) { - synchronized(objectMutex) { - Stf description = new Stf(stfFilename, 0, string); - baseline3.set("description", description); - } - } - - public Stf getTitle() { - synchronized(objectMutex) { - return (Stf) baseline3.get("title"); - } - } - - public void setTitle(String stfFilename, String string) { - synchronized(objectMutex) { - Stf title = new Stf(stfFilename, 0, string); - baseline3.set("title", title); - } - } - - public int getRepeatCounter() { - synchronized(objectMutex) { - return (int) baseline3.get("repeatCounter"); - } - } - - public void setRepeatCounter(int repeatCounter) { - synchronized(objectMutex) { - baseline3.set("repeatCounter", repeatCounter); - } - } - - public void incrementRepeatCounter(int increase) { - setRepeatCounter(getRepeatCounter() + 1); - } - - public void decrementRepeatCounter(int decrease) { - int repeatCounter = getRepeatCounter() + 1; - setRepeatCounter((repeatCounter < 0) ? 0 : repeatCounter); - } - - public String getMissionType() { - synchronized(objectMutex) { - return (String) baseline3.get("missionType"); - } - } - - public void setMissionType(String missionType) { - synchronized(objectMutex) { - baseline3.set("missionType", missionType); - } - } - - public String getTargetName() { - synchronized(objectMutex) { - return (String) baseline3.get("targetName"); - } - } - - public void setTargetName(String targetName) { - synchronized(objectMutex) { - baseline3.set("targetName", targetName); - } - } - - public WaypointObject getWaypoint() { - synchronized(objectMutex) { - return (WaypointObject) baseline3.get("waypoint"); - } - } - - public void setWaypoint(WaypointObject waypoint) { - synchronized(objectMutex) { - baseline3.set("waypoint", waypoint); - } - } - - // A new mission listing is just one big delta to one of the player's - // empty, pre-existing MissionObjects - public void updateMission() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.createDelta(); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - getGrandparent().getClient().getSession().write(buffer); - } - - @Override - public MissionMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new MissionMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - destination.getSession().write(baseline8.getBaseline()); - destination.getSession().write(baseline9.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 1: - case 4: - case 3: - case 6: - case 7: - case 8: - case 9: - if (getGrandparent().getClient() != null) { - buffer = getBaseline(viewType).createDelta(updateType, buffer.array()); - getGrandparent().getClient().getSession().write(buffer); - } - default: - return; - } - } - -} diff --git a/src/resources/z/exp/objects/object/BaseObject.java b/src/resources/z/exp/objects/object/BaseObject.java deleted file mode 100644 index 37dc0f85..00000000 --- a/src/resources/z/exp/objects/object/BaseObject.java +++ /dev/null @@ -1,543 +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 resources.z.exp.objects.object; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.common.Stf; -import resources.common.UString; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class BaseObject extends SWGObject { - - @NotPersistent - private ObjectMessageBuilder messageBuilder; - - protected Baseline baseline1; - protected Baseline baseline3; - protected Baseline baseline4; - protected Baseline baseline6; - protected Baseline baseline7; - protected Baseline baseline8; - protected Baseline baseline9; - protected Baseline otherVariables; - - @NotPersistent - private ScheduledExecutorService scheduler; - - private boolean ready = false; - - public BaseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - super.setCustomName(""); - if (super.getDetailFilename() == null) super.setDetailFilename(""); - if (super.getDetailName() == null) super.setDetailName(""); - initializeBaselines(); - otherVariables = getOtherVariables(); - ready = true; - } - - public BaseObject() { - super(); - - scheduler = Executors.newScheduledThreadPool(2); - - // Makes sure this runs after the baselines have been restored from DB - - scheduler.schedule(new Runnable() { - - public void run() { - while (!ready); - initializeBaselines(); - } - - }, 0, TimeUnit.NANOSECONDS); - } - - public void initializeBaselines() { - // Transform the structures of any baselines incase they've been altered - - if (otherVariables != null) { - otherVariables.transformStructure(getOtherVariables()); - } - - if (baseline1 != null) { - baseline1.transformStructure(getBaseline1()); - addBuilders(1); - } - - if (baseline3 != null) { - baseline3.transformStructure(getBaseline3()); - addBuilders(3); - } - - if (baseline4 != null) { - baseline4.transformStructure(getBaseline4()); - addBuilders(4); - } - - if (baseline6 != null) { - baseline6.transformStructure(getBaseline6()); - addBuilders(6); - } - - if (baseline7 != null) { - baseline7.transformStructure(getBaseline7()); - addBuilders(7); - } - - if (baseline8 != null) { - baseline8.transformStructure(getBaseline8()); - addBuilders(8); - } - - if (baseline9 != null) { - baseline9.transformStructure(getBaseline9()); - addBuilders(9); - } - - // Inheriting objects initialize these only if needed, for efficiency - - initializeBaseline(3); - initializeBaseline(6); - } - - public void initializeBaseline(int viewType) { - // Won't initialize any baselines if they've already been initialized - - switch (viewType) { - case 1: - if (baseline1 == null) { - baseline1 = getBaseline1(); - addBuilders(viewType); - getMessageBuilder().buildBaseline1(baseline1.getBaselineBuilders(), baseline1.getDeltaBuilders()); - } - - return; - case 3: - if (baseline3 == null) { - baseline3 = getBaseline3(); - addBuilders(viewType); - getMessageBuilder().buildBaseline3(baseline3.getBaselineBuilders(), baseline3.getDeltaBuilders()); - } - - return; - case 4: - if (baseline4 == null) { - baseline4 = getBaseline4(); - addBuilders(viewType); - getMessageBuilder().buildBaseline4(baseline4.getBaselineBuilders(), baseline4.getDeltaBuilders()); - } - - return; - case 6: - if (baseline6 == null) { - baseline6 = getBaseline6(); - addBuilders(viewType); - getMessageBuilder().buildBaseline6(baseline6.getBaselineBuilders(), baseline6.getDeltaBuilders()); - } - - return; - case 7: - if (baseline7 == null) { - baseline7 = getBaseline7(); - addBuilders(viewType); - getMessageBuilder().buildBaseline7(baseline7.getBaselineBuilders(), baseline7.getDeltaBuilders()); - } - - return; - case 8: - if (baseline8 == null) { - baseline8 = getBaseline8(); - addBuilders(viewType); - getMessageBuilder().buildBaseline8(baseline8.getBaselineBuilders(), baseline8.getDeltaBuilders()); - } - - return; - case 9: - if (baseline9 == null) { - baseline9 = getBaseline9(); - addBuilders(viewType); - getMessageBuilder().buildBaseline9(baseline9.getBaselineBuilders(), baseline9.getDeltaBuilders()); - } - default: - return; - } - } - - public void addBuilders(int viewType) { - Baseline baseline = getBaseline(viewType); - Map baselineBuilders = new HashMap(); - Map deltaBuilders = new HashMap(); - - switch (viewType) { - case 1: - getMessageBuilder().buildBaseline1(baselineBuilders, deltaBuilders); - break; - case 3: - getMessageBuilder().buildBaseline3(baselineBuilders, deltaBuilders); - break; - case 4: - getMessageBuilder().buildBaseline4(baselineBuilders, deltaBuilders); - break; - case 6: - getMessageBuilder().buildBaseline6(baselineBuilders, deltaBuilders); - break; - case 7: - getMessageBuilder().buildBaseline7(baselineBuilders, deltaBuilders); - break; - case 8: - getMessageBuilder().buildBaseline8(baselineBuilders, deltaBuilders); - break; - case 9: - getMessageBuilder().buildBaseline9(baselineBuilders, deltaBuilders); - break; - } - - if (baselineBuilders.size() > 0) { - baseline.setBaselineBuilders(baselineBuilders); - } - - if (deltaBuilders.size() > 0) { - baseline.setDeltaBuilders(deltaBuilders); - } - } - - public Baseline getOtherVariables() { - Baseline baseline = new Baseline(this, 0); - return baseline; - } - - public Baseline getBaseline1() { - Baseline baseline = new Baseline(this, 1); - return baseline; - } - - public Baseline getBaseline3() { - Baseline baseline = new Baseline(this, 3); - baseline.put("complexity", (float) 1); - baseline.put("stf", new Stf(getStfFilename(), 0, getStfName())); - baseline.put("customName", new UString("")); - baseline.put("volume", 1); - return baseline; - } - - public Baseline getBaseline4() { - Baseline baseline = new Baseline(this, 4); - return baseline; - } - - public Baseline getBaseline6() { - Baseline baseline = new Baseline(this, 6); - baseline.put("serverId", 0); - baseline.put("detail", new Stf(getDetailFilename(), 0, getDetailName())); - return baseline; - } - - public Baseline getBaseline7() { - Baseline baseline = new Baseline(this, 7); - return baseline; - } - - public Baseline getBaseline8() { - Baseline baseline = new Baseline(this, 8); - return baseline; - } - - public Baseline getBaseline9() { - Baseline baseline = new Baseline(this, 9); - return baseline; - } - - public float getComplexity() { - synchronized(objectMutex) { - return (float) baseline3.get("complexity"); - } - } - - public void setComplexity(float complexity) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("complexity", complexity); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public Stf getStf() { - return (Stf) baseline3.get("stf"); - } - - public void setStfFilename(String stfFilename) { - super.setStfFilename(stfFilename); - - if (baseline3 != null) { - IoBuffer buffer; - - getStf().setStfFilename(stfFilename); - - synchronized(objectMutex) { - buffer = baseline3.set("stf", getStf()); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - } - - public int getStfSpacer() { - synchronized(objectMutex) { - return ((Stf) baseline3.get("stf")).getSpacer(); - } - } - - public void setStfSpacer(int stfSpacer) { - IoBuffer buffer; - - getStf().setSpacer(stfSpacer); - - synchronized(objectMutex) { - buffer = baseline3.set("stf", getStf()); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public void setStfName(String stfName) { - super.setStfName(stfName); - - if (baseline3 != null) { - IoBuffer buffer; - - getStf().setStfName(stfName); - - synchronized(objectMutex) { - buffer = baseline3.set("stf", getStf()); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - } - - public void setCustomName(String customName) { - super.setCustomName(customName); - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("customName", customName); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public void setVolume(int volume) { - super.setVolume(volume); - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("volume", volume); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public void incrementVolume(int increase) { - setVolume((getVolume() + increase)); - } - - public void decrementVolume(int decrease) { - setVolume((((getVolume() - decrease) < 1) ? 0 : (getVolume() - decrease))); - } - - public int getServerId() { - synchronized(objectMutex) { - return (int) baseline6.get("serverId"); - } - } - - public void setServerId(int serverId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("serverId", serverId); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - - public Stf getDetail() { - return (Stf) baseline3.get("detail"); - } - - public void setDetailFilename(String detailFilename) { - super.setDetailFilename(detailFilename); - - if (baseline6 != null) { - IoBuffer buffer; - - getDetail().setStfFilename(detailFilename); - - synchronized(objectMutex) { - buffer = baseline6.set("detail", getDetail()); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - } - - public int getDetailSpacer() { - synchronized(objectMutex) { - return ((Stf) baseline6.get("detail")).getSpacer(); - } - } - - public void setDetailSpacer(int detailSpacer) { - IoBuffer buffer; - - getDetail().setSpacer(detailSpacer); - - synchronized(objectMutex) { - buffer = baseline6.set("detail", getDetail()); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - - public void setDetailName(String detailName) { - super.setDetailName(detailName); - - if (baseline6 != null) { - IoBuffer buffer; - - getDetail().setStfName(detailName); - - synchronized(objectMutex) { - buffer = baseline6.set("detail", getDetail()); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - } - - protected Baseline getBaseline(int viewType) { - switch (viewType) { - case 1: return baseline1; - case 3: return baseline3; - case 4: return baseline4; - case 6: return baseline6; - case 7: return baseline7; - case 8: return baseline8; - case 9: return baseline9; - default: return null; - } - } - - /* - This should contain the method of notifying observers, as - it tends to vary depending on the type of object, which is - a problem for inheritance when the master object uses a - different method (ie. ITNO and PLAY). - */ - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - public ObjectMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new ObjectMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - } - } - - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 1: - case 4: - case 7: - if (getClient() != null) { - buffer = getBaseline(viewType).createDelta(updateType, buffer.array()); - getClient().getSession().write(buffer); - } - - return; - case 3: - case 6: - case 8: - case 9: - notifyClients(getBaseline(viewType).createDelta(updateType, buffer.array()), true); - default: - return; - } - } - -} diff --git a/src/resources/z/exp/objects/player/PlayerMessageBuilder.java b/src/resources/z/exp/objects/player/PlayerMessageBuilder.java deleted file mode 100644 index f4886ec9..00000000 --- a/src/resources/z/exp/objects/player/PlayerMessageBuilder.java +++ /dev/null @@ -1,60 +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 resources.z.exp.objects.player; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.intangible.IntangibleMessageBuilder; - -@Persistent -public class PlayerMessageBuilder extends IntangibleMessageBuilder { - - public PlayerMessageBuilder(PlayerObject playerObject) { - super(playerObject); - } - - public PlayerMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/player/PlayerObject.java b/src/resources/z/exp/objects/player/PlayerObject.java deleted file mode 100644 index df7284b0..00000000 --- a/src/resources/z/exp/objects/player/PlayerObject.java +++ /dev/null @@ -1,999 +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 resources.z.exp.objects.player; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; -import java.util.Locale; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.datatables.Professions; -import resources.z.exp.gcw.RegionDefender; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMap; -import resources.z.exp.objects.intangible.IntangibleObject; -import resources.z.exp.objects.waypoint.WaypointObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import resources.z.exp.craft.DraftSchematic; -import resources.z.exp.quest.Quest; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class PlayerObject extends IntangibleObject { - - @NotPersistent - private PlayerMessageBuilder messageBuilder; - - @NotPersistent - private long lastPlayTimeUpdate = System.currentTimeMillis(); - - public PlayerObject(long objectID, Planet planet) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), "object/player/shared_player.iff"); - setServerId(0x8A); - } - - public PlayerObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - List flagsList = new ArrayList(); - flagsList.add(0); - flagsList.add(0); - flagsList.add(0); - flagsList.add(0); - baseline.put("flagsList", flagsList); - List profileFlagsList = new ArrayList(); - profileFlagsList.add(0); - profileFlagsList.add(0); - profileFlagsList.add(0); - profileFlagsList.add(0); - baseline.put("profileFlagsList", profileFlagsList); - baseline.put("title", ""); - baseline.put("bornDate", Integer.parseInt(new SimpleDateFormat("yyyymmdd", Locale.ENGLISH).format(Calendar.getInstance().getTime()))); - baseline.put("totalPlayTime", 0); - baseline.put("professionIcon", 0); - baseline.put("profession", "trader_1a"); - baseline.put("gcwPoints", 0); - baseline.put("pvpKills", 0); - baseline.put("lifetimeGcwPoints", (long) 0); - baseline.put("lifetimePvpKills", 0); - baseline.put("16", new SWGList(this, 3, 16, false)); // Misc data size (varies, 0 in tutorial) <- collections?) <- this isn't a SWGList, but it'll work until we need it - baseline.put("17", new SWGList(this, 3, 17, false)); // Misc ints (2 ints in tutorial, 5 bytes other times...) - baseline.put("18", (byte) 0); // Unknown Flag (regularly changed in tutorial) - baseline.put("19", (byte) 0); // Unknown Flag (regularly changed in tutorial) - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("adminFlags", (byte) 0); - baseline.put("currentRank", 0); - baseline.put("rankProgress", (float) 0); - baseline.put("highestRebelRank", 0); - baseline.put("highestImperialRank", 0); - baseline.put("nextUpdateTime", 0); // TODO set correctly - baseline.put("home", ""); - baseline.put("citizenship", (byte) 0); // Homeless/Citizen/Militia/Mayor? - baseline.put("cityRegionDefender", new RegionDefender()); - baseline.put("guildRegionDefender", new RegionDefender()); - baseline.put("12", 0); // General? - baseline.put("13", 0); // Guild Rank Title? - baseline.put("14", 0); // Citizen Rank Title? - baseline.put("15", 0); // All random guesses, always seem to be 0 - baseline.put("16", 0); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - baseline.put("xpList", new SWGMap(this, 8, 0, true)); - baseline.put("waypoints", new SWGMap(this, 8, 1, true)); - baseline.put("currentForcePower", 100); - baseline.put("maxForcePower", 100); - baseline.put("currentFSQuestList", new SWGList(this, 8, 4, false)); - baseline.put("completedFSQuestList", new SWGList(this, 8, 5, false)); - baseline.put("questJournal", new SWGList(this, 8, 6, false)); - baseline.put("professionWheelPosition", ""); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - baseline.put("experimentationFlag", 0); - baseline.put("craftingStage", 0); - baseline.put("nearestCraftingStation", 0); - baseline.put("draftSchematicList", new SWGList(this, 9, 3, true)); - baseline.put("4", new SWGList(this, 9, 4, false)); // Might or might not be a list, but at the very least it's two 0 ints that are part of the same delta. - baseline.put("experimentationPoints", 0); - baseline.put("accomplishmentCounter", 0); - baseline.put("friendList", new SWGList(this, 9, 7, false)); - baseline.put("ignoreList", new SWGList(this, 9, 8, false)); - baseline.put("languageId", 0); - baseline.put("currentStomach", 0); - baseline.put("maxStomach", 100); - baseline.put("currentDrink", 0); - baseline.put("maxDrink", 100); - baseline.put("currentConsumable", 0); - baseline.put("maxConsumable", 100); - // The others are unknown, commented below. - // it won't send the rest and won't have to by using a lower object count. - // If we figure all these structs out all we have to do is add them the - // same way as above - /* - buffer.putInt(0); // Related to stomach in CU - buffer.putInt(0); // Related to stomach in CU - buffer.putInt(0); // Been seen as 0x0A - buffer.putInt(3); // Also been seen as 0x0A and 0x02 and 0x18 - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); // Unused Waypoint List? - buffer.putInt(0); // Update Counter? - buffer.putInt(2); // Unknown, sometimes a number and sometimes 0 - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(object.getJediState()); - buffer.putShort((short) 0); - */ - return baseline; - } - - @SuppressWarnings("unchecked") - public List getFlagsList() { - return (List) baseline3.get("flagsList"); - } - - public void setFlagsList(int flag1, int flag2, int flag3, int flag4) { - IoBuffer buffer; - - synchronized(objectMutex) { - List flagsList = getFlagsList(); - flagsList.set(0, flag1); - flagsList.set(1, flag2); - flagsList.set(2, flag3); - flagsList.set(3, flag4); - buffer = baseline3.set("flagsList", flagsList); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public List getProfileFlagsList() { - return (List) baseline3.get("profileFlagsList"); - } - - public void setProfileFlagsList(int flag1, int flag2, int flag3, int flag4) { - IoBuffer buffer; - - synchronized(objectMutex) { - List profileFlagsList = getProfileFlagsList(); - profileFlagsList.set(0, flag1); - profileFlagsList.set(1, flag2); - profileFlagsList.set(2, flag3); - profileFlagsList.set(3, flag4); - buffer = baseline3.set("profileFlagsList", profileFlagsList); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public String getTitle() { - synchronized(objectMutex) { - return (String) baseline3.get("title"); - } - } - - public void setTitle(String title) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("title", title); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getBornDate() { - synchronized(objectMutex) { - return (int) baseline3.get("bornDate"); - } - } - - public long getLastPlayTimeUpdate() { - synchronized(objectMutex) { - return (long) baseline3.get("lastPlayTimeUpdate"); - } - } - - public void setLastPlayTimeUpdate(long lastPlayTimeUpdate) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("lastPlayTimeUpdate", lastPlayTimeUpdate); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getTotalPlayTime() { - synchronized(objectMutex) { - return (int) baseline3.get("totalPlayTime"); - } - } - - public void setTotalPlayTime(int totalPlayTime) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("totalPlayTime", totalPlayTime); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getProfessionIcon() { - synchronized(objectMutex) { - return (int) baseline3.get("professionIcon"); - } - } - - public void setProfessionIcon(int professionIcon) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("professionIcon", professionIcon); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public String getProfession() { - synchronized(objectMutex) { - return (String) baseline3.get("profession"); - } - } - - public void setProfession(String profession) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("profession", profession); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - - setProfessionIcon(Professions.get(profession)); - } - - public int getGcwPoints() { - synchronized(objectMutex) { - return (int) baseline3.get("gcwPoints"); - } - } - - public void addGcwPoints(int gcwPoints) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("gcwPoints", (((int) baseline3.get("gcwPoints")) + gcwPoints)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public void resetGcwPoints() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("gcwPoints", 0); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getPvpKills() { - synchronized(objectMutex) { - return (int) baseline3.get("pvpKills"); - } - } - - public void addPvpKill() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("pvpKills", (((int) baseline3.get("pvpKills")) + 1)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public void resetPvpKills() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("pvpKills", 0); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public long getLifetimeGcwPoints() { - synchronized(objectMutex) { - return (long) baseline3.get("lifetimeGcwPoints"); - } - } - - public void addLifetimeGcwPoints(long gcwPoints) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("lifetimeGcwPoints", (((long) baseline3.get("lifetimeGcwPoints")) + gcwPoints)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getLifetimePvpKills() { - synchronized(objectMutex) { - return (int) baseline3.get("lifetimePvpKills"); - } - } - - public void addLifetimePvpKills(int pvpKills) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("lifetimePvpKills", (((int) baseline3.get("lifetimePvpKills")) + pvpKills)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public byte getAdminFlag() { - synchronized(objectMutex) { - return (byte) baseline6.get("adminFlag"); - } - } - - public void setAdminFlag(byte adminFlag) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("adminFlag", adminFlag); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentRank() { - synchronized(objectMutex) { - return (int) baseline6.get("currentRank"); - } - } - - public void setCurrentRank(int currentRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("currentRank", currentRank); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public float getRankProgress() { - synchronized(objectMutex) { - return (float) baseline6.get("rankProgress"); - } - } - - public void setRankProgress(float rankProgress) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("rankProgress", rankProgress); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getHighestRebelRank() { - synchronized(objectMutex) { - return (int) baseline6.get("highestRebelRank"); - } - } - - public void setHighestIRank(int highestRebelRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("highestRebelRank", highestRebelRank); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getHighestImperialRank() { - synchronized(objectMutex) { - return (int) baseline6.get("highestImperialRank"); - } - } - - public void setHighestImperialRank(int highestImperialRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("highestImperialRank", highestImperialRank); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getNextUpdateTime() { - synchronized(objectMutex) { - return (int) baseline6.get("nextUpdateTime"); - } - } - - public void setNextUpdateTime(int nextUpdateTime) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("nextUpdateTime", nextUpdateTime); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public String getHome() { - synchronized(objectMutex) { - return (String) baseline6.get("home"); - } - } - - public void setHome(String home) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("home", home); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public byte getCitizenship() { - synchronized(objectMutex) { - return (byte) baseline6.get("citizenship"); - } - } - - public void setCitizenship(byte citizenship) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("citizenship", citizenship); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public RegionDefender getCityRegionDefender() { - synchronized(objectMutex) { - return (RegionDefender) baseline6.get("cityRegionDefender"); - } - } - - public void setCityRegionDefender(RegionDefender cityRegionDefender) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("cityRegionDefender", cityRegionDefender); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public RegionDefender getGuildRegionDefender() { - synchronized(objectMutex) { - return (RegionDefender) baseline6.get("guildRegionDefender"); - } - } - - public void setGuildRegionDefender(RegionDefender guildRegionDefender) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("guildRegionDefender", guildRegionDefender); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGMap getXpList() { - return (SWGMap) baseline8.get("xpList"); - } - - @SuppressWarnings("unchecked") - public SWGMap getWaypoints() { - return (SWGMap) baseline8.get("waypoints"); - } - - public void waypointUpdate(WaypointObject waypoint) { - getWaypoints().put(waypoint.getObjectID(), waypoint); - } - - public void waypointRemove(WaypointObject waypoint) { - getWaypoints().remove(waypoint.getObjectID()); - } - - public void waypointAdd(WaypointObject waypoint) { - getWaypoints().put(waypoint.getObjectID(), waypoint); - } - - public WaypointObject getWaypointFromList(WaypointObject waypoint) { - synchronized(objectMutex) { - if (getWaypoints().containsKey(waypoint.getObjectID())) { - return getWaypoints().get(waypoint.getObjectID()); - } - } - - return null; - } - - public int getCurrentForcePower() { - synchronized(objectMutex) { - return (int) baseline8.get("currentForcePower"); - } - } - - public void setCurrentForcePower(int currentForcePower) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline8.set("currentForcePower", currentForcePower); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxForcePower() { - synchronized(objectMutex) { - return (int) baseline8.get("maxForcePower"); - } - } - - public void setMaxForcePower(int maxForcePower) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline8.set("maxForcePower", maxForcePower); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGList getCurrentFSQuestList() { - return (SWGList) baseline8.get("currentFSQuestList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCompletedFSQuestList() { - return (SWGList) baseline8.get("completedFSQuestList"); - } - - @SuppressWarnings("unchecked") - public SWGList getQuestJournal() { - return (SWGList) baseline8.get("questJournal"); - } - - public String getProfessionWheelPosition() { - synchronized(objectMutex) { - return (String) baseline8.get("professionWheelPosition"); - } - } - - public void setProfessionWheelPosition(String professionWheelPosition) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline8.set("professionWheelPosition", professionWheelPosition); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getExperimentationFlag() { - synchronized(objectMutex) { - return (int) baseline9.get("experimentationFlag"); - } - } - - public void setExperimentationFlag(int experimentationFlag) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("experimentationFlag", experimentationFlag); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCraftingStage() { - synchronized(objectMutex) { - return (int) baseline9.get("craftingStage"); - } - } - - public void setCraftingStage(int craftingStage) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("craftingStage", craftingStage); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public long getNearestCraftingStation() { - synchronized(objectMutex) { - return (long) baseline9.get("nearestCraftingStation"); - } - } - - public void setNearestCraftingStation(long nearestCraftingStation) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("nearestCraftingStation", nearestCraftingStation); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGList getDraftSchematicList() { - return (SWGList) baseline9.get("draftSchematicList"); - } - - public int getExperimentationPoints() { - synchronized(objectMutex) { - return (int) baseline9.get("experimentationPoints"); - } - } - - public void setExperimentationPoints(int experimentationPoints) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("experimentationPoints", experimentationPoints); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getAccomplishmentCounter() { - synchronized(objectMutex) { - return (int) baseline9.get("accomplishmentCounter"); - } - } - - public void setAccomplishmentCounter(int accomplishmentCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("accomplishmentCounter", accomplishmentCounter); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGList getFriendList() { - return (SWGList) baseline9.get("friendList"); - } - - public void friendAdd(String friend) { - getFriendList().add(friend); - } - - public void friendRemove(String friend) { - getFriendList().remove(friend); - } - - @SuppressWarnings("unchecked") - public SWGList getIgnoreList() { - return (SWGList) baseline9.get("ignoreList"); - } - - public void ignoreAdd(String name) { - getIgnoreList().add(name); - } - - public void ignoreRemove(String name) { - getIgnoreList().remove(name); - } - - public int getLanguageId() { - synchronized(objectMutex) { - return (int) baseline9.get("languageId"); - } - } - - public void setLanguageId(int languageId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("languageId", languageId); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentStomach() { - synchronized(objectMutex) { - return (int) baseline9.get("currentStomach"); - } - } - - public void setCurrentStomach(int currentStomach) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("currentStomach", currentStomach); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxStomach() { - synchronized(objectMutex) { - return (int) baseline9.get("maxStomach"); - } - } - - public void setMaxStomach(int maxStomach) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("maxStomach", maxStomach); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentDrink() { - synchronized(objectMutex) { - return (int) baseline9.get("currentDrink"); - } - } - - public void setCurrentDrink(int currentDrink) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("currentDrink", currentDrink); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxDrink() { - synchronized(objectMutex) { - return (int) baseline9.get("maxDrink"); - } - } - - public void setMaxDrink(int maxDrink) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("maxDrink", maxDrink); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentConsumable() { - synchronized(objectMutex) { - return (int) baseline9.get("currentConsumable"); - } - } - - public void setCurrentConsumable(int currentConsumable) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("currentConsumable", currentConsumable); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxConsumable() { - synchronized(objectMutex) { - return (int) baseline9.get("maxConsumable"); - } - } - - public void setMaxConsumable(int maxConsumable) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("maxConsumable", maxConsumable); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - if (getContainer() != null) { - getContainer().notifyObservers(buffer, notifySelf); - } - } - - @Override - public PlayerMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new PlayerMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //if(destination.getParent().getObjectID() == getParentId()) { // only send to self - //destination.getSession().write(getBaseline(3).getBaseline()); - //destination.getSession().write(getBaseline(6).getBaseline()); - //destination.getSession().write(getBaseline(8).getBaseline()); - //destination.getSession().write(getBaseline(9).getBaseline()); - //} - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - if (getContainer() != null) { - getContainer().notifyObservers(getBaseline(viewType).createDelta(updateType, buffer.array()), true); - } - } - -} diff --git a/src/resources/z/exp/objects/resource/ResourceContainerMessageBuilder.java b/src/resources/z/exp/objects/resource/ResourceContainerMessageBuilder.java deleted file mode 100644 index 10450243..00000000 --- a/src/resources/z/exp/objects/resource/ResourceContainerMessageBuilder.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.resource; - -public class ResourceContainerMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/resource/ResourceContainerObject.java b/src/resources/z/exp/objects/resource/ResourceContainerObject.java deleted file mode 100644 index a3ef31ad..00000000 --- a/src/resources/z/exp/objects/resource/ResourceContainerObject.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.resource; - -public class ResourceContainerObject { - -} diff --git a/src/resources/z/exp/objects/ship/ShipMessageBuilder.java b/src/resources/z/exp/objects/ship/ShipMessageBuilder.java deleted file mode 100644 index a1a8de8e..00000000 --- a/src/resources/z/exp/objects/ship/ShipMessageBuilder.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.ship; - -public class ShipMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/ship/ShipObject.java b/src/resources/z/exp/objects/ship/ShipObject.java deleted file mode 100644 index 5789f04d..00000000 --- a/src/resources/z/exp/objects/ship/ShipObject.java +++ /dev/null @@ -1,26 +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 resources.z.exp.objects.ship; - -public class ShipObject { - -} diff --git a/src/resources/z/exp/objects/staticobject/StaticMessageBuilder.java b/src/resources/z/exp/objects/staticobject/StaticMessageBuilder.java deleted file mode 100644 index 5156390b..00000000 --- a/src/resources/z/exp/objects/staticobject/StaticMessageBuilder.java +++ /dev/null @@ -1,49 +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 resources.z.exp.objects.staticobject; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -public class StaticMessageBuilder extends ObjectMessageBuilder { - - public StaticMessageBuilder(StaticObject object) { - super(object); - } - - public StaticMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/staticobject/StaticObject.java b/src/resources/z/exp/objects/staticobject/StaticObject.java deleted file mode 100644 index 309be323..00000000 --- a/src/resources/z/exp/objects/staticobject/StaticObject.java +++ /dev/null @@ -1,93 +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 resources.z.exp.objects.staticobject; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class StaticObject extends BaseObject { - - @NotPersistent - private StaticMessageBuilder messageBuilder; - - public StaticObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public StaticObject() { - super(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public StaticMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new StaticMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/tangible/TangibleMessageBuilder.java b/src/resources/z/exp/objects/tangible/TangibleMessageBuilder.java deleted file mode 100644 index 0575128c..00000000 --- a/src/resources/z/exp/objects/tangible/TangibleMessageBuilder.java +++ /dev/null @@ -1,62 +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 resources.z.exp.objects.tangible; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -@Persistent -public class TangibleMessageBuilder extends ObjectMessageBuilder { - - public TangibleMessageBuilder(TangibleObject object) { - super(object); - } - - public TangibleMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/tangible/TangibleObject.java b/src/resources/z/exp/objects/tangible/TangibleObject.java deleted file mode 100644 index 1a54abb6..00000000 --- a/src/resources/z/exp/objects/tangible/TangibleObject.java +++ /dev/null @@ -1,400 +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 resources.z.exp.objects.tangible; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.datatables.FactionStatus; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.creature.CreatureObject; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.common.CRC; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class TangibleObject extends BaseObject { - - @NotPersistent - private TangibleMessageBuilder messageBuilder; - - @NotPersistent - private List defendersList = new ArrayList(); - - public TangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { - super(objectID, planet, position, orientation, template); - } - - public TangibleObject(long objectID, Planet planet, String template) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); - } - - public TangibleObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("faction", ""); - baseline.put("pvpBitmask", 0); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("faction", 0); - baseline.put("factionStatus", 0); - baseline.put("customization", new Byte[] { 0x00, 0x00 }); - baseline.put("componentCustomizationList", new SWGList(this, 3, 7, false)); - baseline.put("optionsBitmask", 0); - baseline.put("incapacityTimer", 0); - baseline.put("conditionDamage", 0); - baseline.put("maximumCondition", 0); - baseline.put("isStatic", false); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("inCombat", false); - baseline.put("3", (long) 0); // Unknown - baseline.put("4", (long) 0); // Unknown - baseline.put("5", (long) 0); // Unknown - baseline.put("6", (long) 0); // Unknown - baseline.put("7", 0); // Unknown - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public String getFaction() { - synchronized(objectMutex) { - return (String) otherVariables.get("faction"); - } - } - - public void setFaction(String faction) { - IoBuffer buffer; - - synchronized(objectMutex) { - otherVariables.set("faction", faction); - buffer = baseline3.set("faction", CRC.StringtoCRC(faction)); - } - - notifyClients(buffer, true); - } - - public int getFactionStatus() { - synchronized(objectMutex) { - return (int) baseline3.get("factionStatus"); - } - } - - public void setFactionStatus(int factionStatus) { - switch (factionStatus) { - case FactionStatus.OnLeave: - case FactionStatus.Combatant: - case FactionStatus.SpecialForces: - break; - default: - factionStatus = 0; - } - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("factionStatus", factionStatus); - } - - notifyClients(buffer, true); - } - - public byte[] getCustomization() { - synchronized(objectMutex) { - return (byte[]) baseline3.get("customization"); - } - } - - public void setCustomization(byte[] customization) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("customization", customization); - } - - notifyClients(buffer, true); - } - - @SuppressWarnings("unchecked") - public SWGList getComponentCustomizationList() { - return (SWGList) baseline3.get("componentCustomizationList"); - } - - public int getOptionsBitmask() { - synchronized(objectMutex) { - return (int) baseline3.get("optionsBitmask"); - } - } - - public void setOptionsBitmask(int optionsBitmask) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("optionsBitmask", optionsBitmask); - } - - notifyClients(buffer, true); - } - - public int getIncapacityTimer() { - synchronized(objectMutex) { - return (int) baseline3.get("incapacityTimer"); - } - } - - public void setIncapacityTimer(int incapacityTimer) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("incapacityTimer", incapacityTimer); - } - - notifyClients(buffer, true); - } - - public int getConditionDamage() { - synchronized(objectMutex) { - return (int) baseline3.get("conditionDamage"); - } - } - - public void setConditionDamage(int conditionDamage) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("conditionDamage", conditionDamage); - } - - notifyClients(buffer, true); - } - - public int getMaximumCondition() { - synchronized(objectMutex) { - return (int) baseline3.get("maximumCondition"); - } - } - - public void setMaximumCondition(int maximumCondition) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("maximumCondition", maximumCondition); - } - - notifyClients(buffer, true); - } - - public boolean isStatic() { - synchronized(objectMutex) { - return (boolean) baseline3.get("isStatic"); - } - } - - public void setStatic(boolean isStatic) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("isStatic", isStatic); - } - - notifyClients(buffer, true); - } - - public void toggleStatic() { - setStatic(!isStatic()); - } - - public boolean inCombat() { - synchronized(objectMutex) { - return (boolean) baseline6.get("inCombat"); - } - } - - public void setInCombat(boolean inCombat) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("inCombat", inCombat); - } - - notifyClients(buffer, true); - } - - public void toggleCombat() { - setInCombat(!inCombat()); - } - - public List getDefendersList() { - return defendersList; - } - - // All objects can be in combat (terminal mission flag bases, tutorial target box) - public void addDefender(TangibleObject defender) { - defendersList.add(defender); - - if (!inCombat()) { - setInCombat(true); - } - } - - public void removeDefender(TangibleObject defender) { - defendersList.remove(defender); - - if (defendersList.isEmpty() && inCombat()) { - setInCombat(false); - } - } - - public int getPvPBitmask() { - synchronized(objectMutex) { - return (int) otherVariables.get("pvpBitmask"); - } - } - - public void setPvPBitmask(int pvpBitmask) { - synchronized(objectMutex) { - otherVariables.set("pvpBitmask", pvpBitmask); - } - } - - public boolean isAttackableBy(CreatureObject attacker) { - CreatureObject creature; - - if (this instanceof CreatureObject) { - creature = (CreatureObject) this; - - if (creature.getDuelList().contains(attacker) && attacker.getDuelList().contains(this)) { - return true; - } - } - - if (getFaction().equals("rebel") && attacker.getFaction().equals("rebel")) { - return false; - } else if (getFaction().equals("imperial") && attacker.getFaction().equals("imperial")) { - return false; - } else if(attacker.getSlottedObject("ghost") != null) { - if (this instanceof CreatureObject && getSlottedObject("ghost") != null) { - creature = (CreatureObject) this; - - if (creature.getFactionStatus() == 2 && attacker.getFactionStatus() == 2) { - return true; - } else { - return false; - } - } - - if ((getFaction().equals("rebel") || getFaction().equals("imperial")) && attacker.getFactionStatus() >= 1) { - return true; - } else if ((getFaction().equals("rebel") || getFaction().equals("imperial")) && attacker.getFactionStatus() == 0) { - return false; - } - - return getPvPBitmask() == 1 || getPvPBitmask() == 2; - } - - return getPvPBitmask() == 1 || getPvPBitmask() == 2; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public TangibleMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new TangibleMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 3: - { - switch (updateType) { - case 7: - { - buffer = baseline3.createDelta(7, buffer.array()); - notifyClients(buffer, true); - break; - } - } - } - } - } - -} diff --git a/src/resources/z/exp/objects/universe/UniverseMessageBuilder.java b/src/resources/z/exp/objects/universe/UniverseMessageBuilder.java deleted file mode 100644 index d318a313..00000000 --- a/src/resources/z/exp/objects/universe/UniverseMessageBuilder.java +++ /dev/null @@ -1,36 +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 resources.z.exp.objects.universe; - -import resources.z.exp.objects.ObjectMessageBuilder; - -public class UniverseMessageBuilder extends ObjectMessageBuilder { - - public UniverseMessageBuilder(UniverseObject object) { - super(object); - } - - public UniverseMessageBuilder() { - super(); - } - -} diff --git a/src/resources/z/exp/objects/universe/UniverseObject.java b/src/resources/z/exp/objects/universe/UniverseObject.java deleted file mode 100644 index e01bbf1e..00000000 --- a/src/resources/z/exp/objects/universe/UniverseObject.java +++ /dev/null @@ -1,83 +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 resources.z.exp.objects.universe; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class UniverseObject extends BaseObject { - - @NotPersistent - private UniverseMessageBuilder messageBuilder; - - public UniverseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public UniverseObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public UniverseMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new UniverseMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - - } - -} diff --git a/src/resources/z/exp/objects/waypoint/WaypointObject.java b/src/resources/z/exp/objects/waypoint/WaypointObject.java deleted file mode 100644 index 6539e172..00000000 --- a/src/resources/z/exp/objects/waypoint/WaypointObject.java +++ /dev/null @@ -1,172 +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 resources.z.exp.objects.waypoint; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.common.StringUtilities; -import resources.objects.IDelta; -import resources.z.exp.objects.intangible.IntangibleObject; -import resources.z.exp.objects.Baseline; - -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent(version=0) -public class WaypointObject extends IntangibleObject implements IDelta { - - public static final byte BLUE, GREEN, ORANGE, YELLOW, PURPLE, WHITE, MULTICOLOR; - - static { - BLUE = 1; - GREEN = 2; - ORANGE = 3; - YELLOW = 4; - PURPLE = 5; - WHITE = 6; - MULTICOLOR = 7; - }; - - // WAYP 3 - private int cellId; - //private Point3D position = new Point3D(0, 0, 0); - private long targetId = 0; - private int planetCrc = 0; - private String name = "Waypoint"; - //private long waypointId = 0; - private byte color = 1; - private boolean isActive = false; - - public WaypointObject(long objectID, Planet planet, Point3D position) { - super(objectID, planet, position, new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff"); - } - - public WaypointObject() { - super(); - } - - public int getCellId() { - synchronized(objectMutex) { - return cellId; - } - } - - public void setCellId(int cellId) { - synchronized(objectMutex) { - this.cellId = cellId; - } - } - - public long getTargetId() { - synchronized(objectMutex) { - return targetId; - } - } - - public void setTargetId(long targetId) { - synchronized(objectMutex) { - this.targetId = targetId; - } - } - - public int getPlanetCrc() { - synchronized(objectMutex) { - return planetCrc; - } - } - - public void setPlanetCrc(int planetCrc) { - synchronized(objectMutex) { - this.planetCrc = planetCrc; - } - } - - public String getName() { - synchronized(objectMutex) { - return name; - } - } - - public void setName(String name) { - synchronized(objectMutex) { - this.name = name; - } - } - - public byte getColor() { - synchronized(objectMutex) { - return color; - } - } - - public void setColor(byte color) { - synchronized(objectMutex) { - this.color = color; - } - } - - public boolean isActive() { - synchronized(objectMutex) { - return isActive; - } - } - - public void setActive(boolean isActive) { - synchronized(objectMutex) { - this.isActive = isActive; - } - } - - public void toggleActive() { - setActive(!isActive()); - } - - @Override - public void sendBaselines(Client destination) { - - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = IoBuffer.allocate(42, false).order(ByteOrder.LITTLE_ENDIAN).setAutoExpand(true); - buffer.putInt(cellId); - buffer.putFloat(getPosition().x); - buffer.putFloat(getPosition().y); - buffer.putFloat(getPosition().z); - buffer.putLong(targetId); - buffer.putInt(planetCrc); - buffer.put(StringUtilities.getUnicodeString(name)); - buffer.putLong(getObjectID()); - buffer.put(color); - buffer.put(Baseline.getBoolean(isActive)); - buffer.flip(); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/objects/weapon/WeaponMessageBuilder.java b/src/resources/z/exp/objects/weapon/WeaponMessageBuilder.java deleted file mode 100644 index 860f5bd2..00000000 --- a/src/resources/z/exp/objects/weapon/WeaponMessageBuilder.java +++ /dev/null @@ -1,77 +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 resources.z.exp.objects.weapon; - -import java.util.Map; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.tangible.TangibleMessageBuilder; - -public class WeaponMessageBuilder extends TangibleMessageBuilder { - - public WeaponMessageBuilder(WeaponObject weaponObject) { - super(weaponObject); - } - - public WeaponMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - - baselineBuilders.put(13, new Builder() { - - public byte[] build() { - return Baseline.createBuffer(4).putInt(((WeaponObject) object).getWeaponType()).array(); - } - - }); - - deltaBuilders.put(13, new Builder() { - - public byte[] build() { - return Baseline.createBuffer(4).putInt(((WeaponObject) object).getWeaponType()).array(); - } - - }); - - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/weapon/WeaponObject.java b/src/resources/z/exp/objects/weapon/WeaponObject.java deleted file mode 100644 index d1b92a7b..00000000 --- a/src/resources/z/exp/objects/weapon/WeaponObject.java +++ /dev/null @@ -1,246 +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 resources.z.exp.objects.weapon; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.tangible.TangibleObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class WeaponObject extends TangibleObject { - - @NotPersistent - private WeaponMessageBuilder messageBuilder; - - public WeaponObject(long objectID, Planet planet, String template) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); - } - - public WeaponObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { - super(objectID, planet, position, orientation, template); - } - - public WeaponObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("maxDamage", 0); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("attackSpeed", (float) 1); - baseline.put("14", 0); - baseline.put("15", 0); - baseline.put("maxRange", calculateRange()); - baseline.put("17", 0); // Could be lightsaber color? Seen as 2 on a saber - baseline.put("18", 0); // something to do with particle color - baseline.put("19", 0); // something to do with particle color - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("weaponType", 0); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public float getAttackSpeed() { - synchronized(objectMutex) { - return (float) baseline3.get("attackSpeed"); - } - } - - public void setAttackSpeed(float attackSpeed) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("attackSpeed", attackSpeed); - } - - notifyClients(buffer, false); - } - - private float calculateRange() { - int weaponType = getWeaponType(); - - switch (weaponType) { - case 4: - case 5: - case 6: - case 7: - case 9: - case 10: - case 11: - return 5; - case 2: - return 35; - case 1: - return 50; - case 0: - case 3: - case 8: - return 64; - default: - return 0; - } - } - - public float getMaxRange() { - synchronized(objectMutex) { - return (float) baseline3.get("maxRange"); - } - } - - public void setMaxRange(float maxRange) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("maxRange", maxRange); - } - - notifyClients(buffer, false); - } - - public int getWeaponType() { - String template = getTemplate(); - int weaponType = -1; - - synchronized(objectMutex) { - if (template == null) { - return weaponType; - } - - if (template.contains("rifle")) weaponType = 0; - if (template.contains("carbine")) weaponType = 1; - if (template.contains("pistol")) weaponType = 2; - if (template.contains("heavy")) weaponType = 3; - if (template.contains("sword") || template.contains("baton")) weaponType = 4; - if (template.contains("2h_sword") || template.contains("axe")) weaponType = 5; - if (template.contains("unarmed")) weaponType = 6; - if (template.contains("polearm") || template.contains("lance")) weaponType = 7; - if (template.contains("thrown")) weaponType = 8; - if (template.contains("lightsaber_one_handed")) weaponType = 9; - if (template.contains("lightsaber_two_handed")) weaponType = 10; - if (template.contains("lightsaber_polearm")) weaponType = 11; - - if (weaponType == -1) { - weaponType = 6; - } - - return weaponType; - } - } - - public int getMaxDamage() { - synchronized(objectMutex) { - return (int) otherVariables.get("maxDamage"); - } - } - - public void setMaxDamage(int maxDamage) { - synchronized(objectMutex) { - otherVariables.set("maxDamage", maxDamage); - } - } - - public boolean isMelee() { - int weaponType = getWeaponType(); - - if ((weaponType > 4 && weaponType < 8) || (weaponType > 8 && weaponType < 12)) { - return true; - } - - return false; - } - - public boolean isRanged() { - int weaponType = getWeaponType(); - - if (weaponType == 0 || weaponType == 1 || weaponType == 2 || weaponType == 3) { - return true; - } - - return false; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public WeaponMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new WeaponMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/skills/SkillMod.java b/src/resources/z/exp/skills/SkillMod.java deleted file mode 100644 index 82cdb237..00000000 --- a/src/resources/z/exp/skills/SkillMod.java +++ /dev/null @@ -1,102 +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 resources.z.exp.skills; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -// Proxy for engine.resources.objects.SkillMod so it uses Delta - -@Persistent -public class SkillMod extends Delta { - - private int base = 0; - private int modifier = 0; - - public SkillMod(int base, int modifier) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - this.base = skillMod.getBase(); - this.modifier = skillMod.getModifier(); - } - - public SkillMod() { - - } - - public int getBase() { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - return skillMod.getBase(); - } - } - - public void setBase(int base) { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(this.base); - skillMod.setModifier(modifier); - skillMod.setBase(base); - this.base = skillMod.getBase(); - } - } - - public int getModifier() { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - return skillMod.getModifier(); - } - } - - public void setModifier(int modifier) { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(this.modifier); - skillMod.setModifier(modifier); - this.modifier = skillMod.getModifier(); - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN); - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - buffer.putInt(skillMod.getBase()); - buffer.putInt(skillMod.getModifier()); - return buffer.array(); - } - } - -} diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 3c9b93a0..d87738c9 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -191,7 +191,16 @@ public class CharacterService implements INetworkDispatch { }); + + swgOpcodes.put(Opcodes.LagReport, new INetworkRemoteEvent() { + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + swgOpcodes.put(Opcodes.ClientCreateCharacter, new INetworkRemoteEvent() { @Override @@ -250,6 +259,12 @@ public class CharacterService implements INetworkDispatch { if (stamina >= 1) core.skillModService.addSkillMod(object, "stamina", (int) stamina); if (agility >= 1) core.skillModService.addSkillMod(object, "agility", (int) agility); + core.skillModService.addSkillMod(object, "language_basic_comprehend", 100); + core.skillModService.addSkillMod(object, "language_basic_speak", 100); + core.skillModService.addSkillMod(object, "creature_harvesting", 25); + core.skillModService.addSkillMod(object, "language_wookiee_comprehend", 100); + + object.createTransaction(core.getCreatureODB().getEnvironment()); PlayerObject player = (PlayerObject) core.objectService.createObject("object/player/shared_player.iff", object.getPlanet()); @@ -332,8 +347,25 @@ public class CharacterService implements INetworkDispatch { session.write(core.loginService.getLoginCluster().serialize()); session.write(core.loginService.getLoginClusterStatus(client).serialize()); - session.write(success.serialize()); - session.write((new ClientMfdStatusUpdateMessage((float) 2, "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize()); + session.write(success.serialize()); + } + + }); + + swgOpcodes.put(Opcodes.NewbieTutorialResponse, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.SetJediSlotInfo, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + } }); @@ -475,8 +507,8 @@ public class CharacterService implements INetworkDispatch { if (name.contains(" ")) { name = name.split(" ")[0]; } - name = name.replace("'", "''"); name = name.toLowerCase(); + try { PreparedStatement ps = databaseConnection.preparedStatement("SELECT id FROM characters WHERE LOWER(\"firstName\")=?"); ps.setString(1, name); diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index c3ce890c..934efd58 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -172,7 +172,15 @@ public class ConnectionService implements INetworkDispatch { } }); + + swgOpcodes.put(Opcodes.ConnectPlayerMessage, new INetworkRemoteEvent() { + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + //ConnectPlayerResponseMessage + } + + }); } diff --git a/src/services/EquipmentService.java b/src/services/EquipmentService.java index f96e0e2c..7125fa32 100644 --- a/src/services/EquipmentService.java +++ b/src/services/EquipmentService.java @@ -28,6 +28,7 @@ import java.util.TreeMap; import org.python.core.Py; import org.python.core.PyObject; +import resources.datatables.FactionStatus; import resources.objects.creature.CreatureObject; import main.NGECore; import engine.resources.objects.SWGObject; @@ -113,58 +114,111 @@ public class EquipmentService implements INetworkDispatch { if (item.getStringAttribute("class_required") != null) { String profession = ((PlayerObject) actor.getSlottedObject("ghost")).getProfession(); - if (item.getStringAttribute("class_required").contentEquals(getFormalProfessionName(profession))) { + if (item.getStringAttribute("class_required").contentEquals(getFormalProfessionName(profession))) result = true; - } else{ + else return false; - } } - + + if (item.getStringAttribute("faction_restriction") != null) + if (item.getStringAttribute("faction_restriction").toLowerCase().contentEquals(actor.getFaction()) && actor.getFactionStatus() >= FactionStatus.Combatant) + result = true; + else + return false; + + if (item.getAttributes().toString().contains("required_combat_level")) + if (actor.getLevel() >= item.getIntAttribute("required_combat_level")) + result = true; + else + return false; + return result; } - public void equip(CreatureObject actor, SWGObject item) { + public void calculateForceProtection(CreatureObject actor, SWGObject item, boolean add) { + int type = 0; + int level = 0; + int[][] protection = {{1400,3000,4000,5000,6500},{0, 0, 4500, 5600, 6500}}; + switch ((String) item.getAttachment("type")) { + case "jedi_robe": type = 0; break; + case "jedi_cloak": type = 1; break; + } + + switch (item.getStringAttribute("protection_level")) { + case "Faint": level = 0; break; + case "Weak": level = 1; break; + case "Lucent": level = 2; break; + case "Luminous": level = 3; break; + case "Radiant": level = 4; break; + } + + if (add==true) { + core.skillModService.addSkillMod(actor, "kinetic", protection[type][level]); + core.skillModService.addSkillMod(actor, "energy", protection[type][level]); + core.skillModService.addSkillMod(actor, "heat", protection[type][level]); + core.skillModService.addSkillMod(actor, "cold", protection[type][level]); + core.skillModService.addSkillMod(actor, "acid", protection[type][level]); + core.skillModService.addSkillMod(actor, "electricity", protection[type][level]); + } else { + core.skillModService.deductSkillMod(actor, "kinetic", protection[type][level]); + core.skillModService.deductSkillMod(actor, "energy", protection[type][level]); + core.skillModService.deductSkillMod(actor, "heat", protection[type][level]); + core.skillModService.deductSkillMod(actor, "cold", protection[type][level]); + core.skillModService.deductSkillMod(actor, "acid", protection[type][level]); + core.skillModService.deductSkillMod(actor, "electricity", protection[type][level]); + } + + } + + public void equip(CreatureObject actor, SWGObject item) { + String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff")); String serverTemplate = template.replace(".iff", ""); PyObject func = core.scriptService.getMethod("scripts/" + serverTemplate.split("shared_" , 2)[0].replace("shared_", ""), serverTemplate.split("shared_" , 2)[1], "equip"); if(func != null) func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item)); + + if (item.getStringAttribute("protection_level") != null) + calculateForceProtection(actor, item, true); - // TODO: add health/action bonus from crafted weapon with augmentations (also seen with cybernetics) // TODO: faction restrictions - You had to be a Combatant as minimum in order to EQUIP an item. // TODO: Species restrictions // TODO: Gender restrictions // TODO: crit enhancement from crafted weapons - // TODO: Jedi robes Force Protection Intensity // TODO: check for armor category in order to add resistance to certain DoT types // TODO: Calculate actual armor values (REMINDER: Check if the player is wearing a jedi robe/cloak (look for force protection intensity). If they are, they shouldn't receive any additional protection from other items with armour.) - // TODO: bio-link (assign it by objectID with setAttachment and then just display it as a character name). - // TODO: item level requirement. if actorLevel >= itemLevel - // TODO: refactor equipable items that grant buffs. use setAttachment("itemBuff", "buffname") - - if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true) - weaponCriticalToDisplay(actor, item, true); + // TODO: bio-link (assign it by objectID with setAttachment and then just display the customName for that objectID). + if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null) + if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true) + weaponCriticalToDisplay(actor, item, true); + Map attributes = new TreeMap(item.getAttributes()); for(Entry e : attributes.entrySet()) { if(e.getKey().startsWith("cat_skill_mod_bonus.@stat_n:")) { core.skillModService.addSkillMod(actor, e.getKey().replace("cat_skill_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); } + + if(e.getKey().startsWith("cat_stat_mod_bonus.@stat_n:")) { + core.skillModService.addSkillMod(actor, e.getKey().replace("cat_stat_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); + } + if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_health")) { actor.setMaxHealth(actor.getMaxHealth() + Integer.parseInt((String) e.getValue())); - } + } + if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_action")) { actor.setMaxAction(actor.getMaxAction() + Integer.parseInt((String) e.getValue())); - } - + } } - + if(!actor.getEquipmentList().contains(item)) actor.addObjectToEquipList(item); - - } + +} + public void unequip(CreatureObject actor, SWGObject item) { @@ -174,8 +228,12 @@ public class EquipmentService implements INetworkDispatch { if(func != null) func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item)); - if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true) - weaponCriticalToDisplay(actor, item, false); + if (item.getStringAttribute("protection_level") != null) + calculateForceProtection(actor, item, false); + + if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null) + if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true) + weaponCriticalToDisplay(actor, item, false); Map attributes = new TreeMap(item.getAttributes()); @@ -189,14 +247,13 @@ public class EquipmentService implements INetworkDispatch { } if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_action")) { actor.setMaxAction(actor.getMaxAction() - Integer.parseInt((String) e.getValue())); - } + } - } + } if(actor.getEquipmentList().contains(item)) actor.removeObjectFromEquipList(item); } - } diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index b209ee48..04ff8f72 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -37,13 +37,20 @@ import java.util.concurrent.TimeUnit; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; +import protocol.swg.CharacterSheetResponseMessage; import protocol.swg.ClientIdMsg; import protocol.swg.ClientMfdStatusUpdateMessage; +import protocol.swg.CreateClientPathMessage; import protocol.swg.ExpertiseRequestMessage; +import protocol.swg.GuildRequestMessage; +import protocol.swg.GuildResponseMessage; +import protocol.swg.ObjControllerMessage; +import protocol.swg.PlayerMoneyResponse; import protocol.swg.ServerTimeMessage; import protocol.swg.SetWaypointColor; import protocol.swg.objectControllerObjects.ChangeRoleIconChoice; import protocol.swg.objectControllerObjects.ShowFlyText; +import protocol.swg.objectControllerObjects.ShowLootBox; import resources.common.Console; import resources.common.FileUtilities; import resources.common.ObjControllerOpcodes; @@ -51,6 +58,7 @@ import resources.common.Opcodes; import resources.common.RGB; import resources.common.SpawnPoint; import resources.datatables.PlayerFlags; +import resources.guild.Guild; import resources.objects.Buff; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; @@ -249,6 +257,151 @@ public class PlayerService implements INetworkDispatch { } + }); + swgOpcodes.put(Opcodes.GuildRequestMessage, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + data.order(ByteOrder.LITTLE_ENDIAN); + + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + + if (player == null) + return; + + GuildRequestMessage request = new GuildRequestMessage(); + request.deserialize(data); + + CreatureObject targetPlayer = (CreatureObject) core.objectService.getObject(request.getCharacterId()); + + if (targetPlayer.getGuildId() != 0) { + Guild targetGuild = core.guildService.getGuildById(targetPlayer.getGuildId()); + GuildResponseMessage response = new GuildResponseMessage(request.getCharacterId(), targetGuild.getName()); + client.getSession().write(response.serialize()); + } else { + GuildResponseMessage response = new GuildResponseMessage(request.getCharacterId(), "None"); + client.getSession().write(response.serialize()); + } + } + + }); + + swgOpcodes.put(Opcodes.PlayerMoneyRequest, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + + if (player == null) + return; + + CreatureObject creature = (CreatureObject) player; + + if (creature == null) + return; + + PlayerMoneyResponse response = new PlayerMoneyResponse(creature.getCashCredits(), creature.getBankCredits()); + session.write(response.serialize()); + + PlayerObject ghost = (PlayerObject) player.getSlottedObject("ghost"); + if (ghost == null) + return; + + CharacterSheetResponseMessage msg = new CharacterSheetResponseMessage(ghost); + session.write(msg.serialize()); + } + + }); + swgOpcodes.put(Opcodes.GetSpecificMapLocationsMessage, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.SetCombatSpamFilter, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.SetCombatSpamRangeFilter, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.SetLfgInterests, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.CommodotiesItemTypeListRequest, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.SetFurnitureRoationDegree, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.CommoditiesResourceTypeListRequest, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.CollectionServerFirstListRequest, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + + }); + + swgOpcodes.put(Opcodes.Unknown, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + } + }); swgOpcodes.put(Opcodes.CmdSceneReady, new INetworkRemoteEvent() { @@ -543,16 +696,18 @@ public class PlayerService implements INetworkDispatch { for (int n = 0; n < items.length; n++) { String item = items[n]; - if (wookieeItems.length > 0 && creature.getStfName().contains("wookiee")) { + if (wookieeItems[0].length() > 0 && creature.getStfName().contains("wookiee")) { item = wookieeItems[n]; - } else if (ithorianItems.length > 0 && creature.getStfName().contains("ithorian")) { + } else if (ithorianItems[0].length() > 0 && creature.getStfName().contains("ithorian")) { item = ithorianItems[n]; } try { String customServerTemplate = null; - if (!item.contains("/")) { + if (item.contains("/")) { + item = (item.substring(0, (item.lastIndexOf("/") + 1)) + "shared_" + item.substring((item.lastIndexOf("/") + 1))); + } else { customServerTemplate = item; item = core.scriptService.callScript("scripts/roadmap/", "roadmap_rewards", "get", item).asString(); } @@ -590,7 +745,6 @@ public class PlayerService implements INetworkDispatch { return; player.getTitleList().add(title); - Console.println("Added title" + title); } @@ -603,6 +757,55 @@ public class PlayerService implements INetworkDispatch { } + /** + * Creates a blue path to the destination point. + * @param actor Player that will be seeing the blue path. + * @param destination Where the blue path will lead to. + */ + public void createClientPath(SWGObject actor, Point3D destination) { + + if (actor == null || actor.getClient() == null || actor.getClient().getSession() == null) + return; + + List coordinates = new ArrayList(); + coordinates.add(actor.getPosition()); + + // TODO: Generate a path to destination based off of objects in the world. + + coordinates.add(destination); // Destination MUST be last coordinate in array + + CreateClientPathMessage path = new CreateClientPathMessage(coordinates); + actor.getClient().getSession().write(path.serialize()); + } + + /** + * Gives a player items and shows the "New Items" message. + * @param reciever Player receiving the items + * @param items The object(s) to be given. This will allow multiple arguments. + */ + public void giveItems(CreatureObject reciever, SWGObject... items) { + if (reciever == null || items == null) + return; + + if (reciever.getClient() == null) + return; + Client client = reciever.getClient(); + + if (client.getSession() == null) + return; + SWGObject inventory = reciever.getSlottedObject("inventory"); + + if (inventory == null) + return; + + for (SWGObject obj : items) { + inventory.add(obj); + } + + ObjControllerMessage objController = new ObjControllerMessage(11, new ShowLootBox(reciever.getObjectID(), items)); + client.getSession().write(objController.serialize()); + } + @Override public void shutdown() { // TODO Auto-generated method stub diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 5e6bc68a..b9edf1e1 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -159,6 +159,9 @@ public class SimulationService implements INetworkDispatch { core.commandService.registerCommand("roleplay"); core.commandService.registerAlias("afk", "toggleawayfromkeyboard"); core.commandService.registerCommand("toggledisplayingfactionrank"); + core.commandService.registerCommand("editbiography"); + core.commandService.registerCommand("setbiography"); + core.commandService.registerCommand("requestbiography"); } @@ -749,7 +752,7 @@ public class SimulationService implements INetworkDispatch { PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); core.weatherService.sendWeather(object); - + if (!object.hasSkill(ghost.getProfessionWheelPosition())) { object.showFlyText("cbt_spam", "skill_up", (float) 2.5, new RGB(154, 205, 50), 0); object.playEffectObject("clienteffect/skill_granted.cef", ""); diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 0a68ab4c..2bd76a4f 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -24,7 +24,6 @@ package services.chat; import java.nio.ByteOrder; import java.util.Date; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; @@ -53,7 +52,6 @@ import protocol.swg.ChatFriendsListUpdate; import protocol.swg.ChatInstantMessageToCharacter; import protocol.swg.ChatInstantMessagetoClient; import protocol.swg.ChatOnAddFriend; -import protocol.swg.ChatOnGetFriendsList; import protocol.swg.ChatOnSendInstantMessage; import protocol.swg.ChatOnSendPersistentMessage; import protocol.swg.ChatPersistentMessageToClient; @@ -331,6 +329,16 @@ public class ChatService implements INetworkDispatch { } }); + + swgOpcodes.put(Opcodes.ChatRequestRoomList, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + //ChatRoomList + } + + }); + } public void playerStatusChange(String name, byte status) { diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 9ea8dca5..00aea867 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -22,7 +22,6 @@ package services.command; import java.nio.ByteOrder; -import java.util.HashMap; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; @@ -114,6 +113,15 @@ public class CommandService implements INetworkDispatch { } }); + + objControllerOpcodes.put(ObjControllerOpcodes.COMMAND_QUEUE_REMOVE, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + } + + }); } diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java index 0406f2e5..9a2dfd42 100644 --- a/src/services/gcw/FactionService.java +++ b/src/services/gcw/FactionService.java @@ -36,8 +36,12 @@ import protocol.swg.FactionResponseMessage; import resources.common.FileUtilities; import resources.common.Opcodes; +import resources.datatables.FactionStatus; +import resources.datatables.Options; +import resources.datatables.PvpStatus; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; +import resources.objects.tangible.TangibleObject; import engine.clientdata.StfTable; import engine.clients.Client; @@ -183,6 +187,52 @@ public class FactionService implements INetworkDispatch { return false; } + /* + * Calculates the target's pvp bitmask based on the person's + * faction standing and the enemy's options bitmask. + * + * This shouldn't be what we "set" the bitmask to, just + * what we use when calculating how to treat a target + * and when we send it. + * + * This should be used instead of getPvPBitmask where possible, but + * should not be used in setPvPBitmask. + */ + public int calculatePvpStatus(CreatureObject player, TangibleObject target) { + PlayerObject ghost = (PlayerObject) player.getSlottedObject("ghost"); + + int pvpBitmask = target.getPvPBitmask(); + + if (target.getSlottedObject("ghost") != null) { + pvpBitmask |= PvpStatus.Player; + + if (player.getFactionStatus() == FactionStatus.SpecialForces && + ((CreatureObject) target).getFactionStatus() == FactionStatus.SpecialForces) { + pvpBitmask |= (PvpStatus.Attackable | PvpStatus.Aggressive); + } + + return pvpBitmask; + } + + if (target.getOption(Options.ATTACKABLE)) { + pvpBitmask |= PvpStatus.Attackable; + } + + if (target.getOption(Options.AGGRESSIVE)) { + pvpBitmask |= PvpStatus.Aggressive; + } else { + Integer factionStanding = ghost.getFactionStandingMap().get(target.getFaction()); + + if (factionStanding != null) { + if (((TangibleObject) target).getOption(Options.ATTACKABLE) && factionStanding < 0) { + pvpBitmask |= PvpStatus.Aggressive; + } + } + } + + return pvpBitmask; + } + public Map getFactionMap() { return factionMap; } diff --git a/src/services/guild/GuildService.java b/src/services/guild/GuildService.java index 902bd569..f591db3e 100644 --- a/src/services/guild/GuildService.java +++ b/src/services/guild/GuildService.java @@ -23,12 +23,11 @@ package services.guild; import java.util.Map; +import resources.common.Console; import resources.guild.Guild; import resources.objects.SWGList; import resources.objects.guild.GuildObject; - import main.NGECore; - import engine.resources.objects.SWGObject; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -55,7 +54,17 @@ public class GuildService implements INetworkDispatch { } public Guild createGuild(String abbreviation, String name, SWGObject leader) { - int id = ((object.getGuildList().get(object.getGuildList().size()).getId()) + 1); + + if (leader == null) + return null; + + int id = 0; + if (object.getGuildList().size() < 1) { + id = 0; + } else { + id = ((object.getGuildList().get(object.getGuildList().size()).getId() + 1)); + } + Guild guild = new Guild(id, abbreviation, name, leader); object.getGuildList().add(guild); diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index b275c358..934d3384 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -44,6 +44,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import resources.common.*; +import resources.datatables.Options; import resources.datatables.PlayerFlags; import org.apache.mina.core.buffer.IoBuffer; @@ -263,36 +264,39 @@ public class ObjectService implements INetworkDispatch { objectList.put(objectID, object); - // Set Default Tangible Options - /* + // Set Options - easier to set them across the board here + // because we'll be spawning them despite most of them being unscripted. + // Any such settings can be completely reset with setOptionsBitmask + // in scripts and modified with setOptions(Options.X, true/false) if (Template.startsWith("object/creature/") || Template.startsWith("object/mobile/")) { - ((CreatureObject) object).setOptionsBitmask(Options.MOBILE); - - if (Template.startsWith("object/mobile/beast_master/")) { + if (Template.startsWith("object/mobile/")) { + ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE); + } else if (Template.startsWith("object/mobile/beast_master/")) { ((CreatureObject) object).setOptionsBitmask(Options.NONE); } else if (Template.startsWith("object/mobile/vendor/")) { ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.USABLE); } else if (Template.startsWith("object/mobile/vehicle/")) { - ((CreatureObject) object).addOption(Options.INVULNERABLE | Options.MOUNT); + ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE | Options.MOUNT); } else if (Template.startsWith("object/mobile/hologram/")) { - ((CreatureObject) object).addOption(Options.INVULNERABLE); + ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE); } else if (Template.startsWith("object/creature/npc/theme_park/")) { - ((CreatureObject) object).addOption(Options.INVULNERABLE); - } else if (Template.startsWith("object/creature/general/")) { + ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE); + } else if (Template.startsWith("object/creature/npc/general/")) { ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.CONVERSABLE); + } else if (Template.startsWith("object/creature/droid/crafted/")) { + ((CreatureObject) object).setOptionsBitmask(Options.NONE); } else if (Template.startsWith("object/creature/droid/")) { - ((CreatureObject) object).addOption(Options.INVULNERABLE); + ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE | Options.INVULNERABLE); + } else if (Template.startsWith("object/creature/player/")) { + ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE); } } else if (object instanceof TangibleObject) { ((TangibleObject) object).setOptionsBitmask(Options.INVULNERABLE); if (Template.startsWith("object/tangible/vendor/")) { - ((CreatureObject) object).addOption(Options.USABLE); - } else if (Template.startsWith("object/creature/droid/")) { - ((CreatureObject) object).addOption(Options.INVULNERABLE); + ((TangibleObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.USABLE); } } - */ return object; } @@ -407,7 +411,7 @@ public class ObjectService implements INetworkDispatch { } }); objectList.remove(object.getObjectID()); - //core.simulationService.remove(object, object.getPosition().x, object.getPosition().y); + core.simulationService.remove(object, object.getPosition().x, object.getPosition().y); } diff --git a/src/resources/z/exp/objects/Builder.java b/src/services/retro/IRetroModification.java similarity index 90% rename from src/resources/z/exp/objects/Builder.java rename to src/services/retro/IRetroModification.java index 8bc6b647..8af86790 100644 --- a/src/resources/z/exp/objects/Builder.java +++ b/src/services/retro/IRetroModification.java @@ -19,10 +19,12 @@ * 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 resources.z.exp.objects; +package services.retro; -public interface Builder { +import main.NGECore; + +public interface IRetroModification { - public byte[] build(); + public void modify(NGECore core); } diff --git a/src/services/retro/RetroService.java b/src/services/retro/RetroService.java new file mode 100644 index 00000000..cb23e6cb --- /dev/null +++ b/src/services/retro/RetroService.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * 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.retro; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; +import main.NGECore; + +/* + * Very often we will need to make changes to existing objects when the server + * boots up. This is especially the case when fixes or new features are + * added that affect already-existing objects. To make the changes retroactive + * we can use this service to make it more tidy. Add to the list of + * modifications in the relevant service's constructor, or in this one. + */ +public class RetroService implements INetworkDispatch { + + private NGECore core; + + private List modifications; + + public RetroService(NGECore core) { + this.core = core; + modifications = new ArrayList(); + + /* + core.retroService.addModification(new IRetroModification() { + + public void modify(NGECore core) { + + } + + }); + */ + } + + public void addModification(IRetroModification modification) { + modifications.add(modification); + } + + public void run() { + for (IRetroModification modification : modifications) { + modification.modify(core); + } + } + + public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + + } + + public void shutdown() { + + } + +} diff --git a/src/services/trade/TradeService.java b/src/services/trade/TradeService.java index 9c80fc3a..3490c69a 100644 --- a/src/services/trade/TradeService.java +++ b/src/services/trade/TradeService.java @@ -207,9 +207,8 @@ public class TradeService implements INetworkDispatch{ } addItemForTrade(objectToTrade, tradingWithClient); - System.out.println("Trading item: " + objectToTrade.getCustomName() + " detail: " + objectToTrade.getDetailFilename()); - - System.out.println("tradingObjectTable: " + tradingObjectsTable.toString()); + //System.out.println("Trading item: " + objectToTrade.getCustomName() + " detail: " + objectToTrade.getDetailFilename()); + tradee.makeAware(objectToTrade); AddItemMessage tradeeResponse = new AddItemMessage(); tradeeResponse.setTradeObjectID(tradeItemID); @@ -313,20 +312,6 @@ public class TradeService implements INetworkDispatch{ tradePartner.getClient().getSession().write(undoAccept.serialize()); } - }); - // not used, but just in case.... VerifyTradeMessage is sent instead when a user - // hits the Accept button. Can use this as an additional check if need to. - swgOpcodes.put(TradeOpcodes.BeginVerificationMessage, new INetworkRemoteEvent() { - - @Override - public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { - System.out.println("Got BeginVerificationMessage"); - Client client = core.getClient(session); - client.getSession().setAttribute("tradeSessionIsVerified"); - System.out.println("Verified client"); - - } - }); swgOpcodes.put(TradeOpcodes.VerifyTradeMessage, new INetworkRemoteEvent() { @@ -405,12 +390,7 @@ public class TradeService implements INetworkDispatch{ actingTrader.setCashCredits(tradePartnerCredits - moneyToGive); tradePartner.setCashCredits(tradePartnerCredits + moneyToGive); } - - - System.out.println("Finished trading items/credits"); - cleanTradeSession(client, tradePartner.getClient()); - } } diff --git a/src/services/travel/TravelPoint.java b/src/services/travel/TravelPoint.java index 2d76137c..bf2977dc 100644 --- a/src/services/travel/TravelPoint.java +++ b/src/services/travel/TravelPoint.java @@ -23,7 +23,6 @@ package services.travel; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import resources.common.Console; import resources.common.SpawnPoint; diff --git a/src/services/travel/TravelService.java b/src/services/travel/TravelService.java index b449d25b..d0daaa6c 100644 --- a/src/services/travel/TravelService.java +++ b/src/services/travel/TravelService.java @@ -50,6 +50,7 @@ import engine.resources.service.INetworkRemoteEvent; import main.NGECore; import resources.common.Console; import resources.common.Opcodes; +import resources.common.SpawnPoint; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; import services.sui.SUIService.ListBoxType; @@ -322,23 +323,8 @@ public class TravelService implements INetworkDispatch { public void doTransport(SWGObject actor, TravelPoint tp) { Planet planet = core.terrainService.getPlanetByName(tp.getPlanetName()); - - Random ran = new Random(); - - float oY = tp.getShuttle().getOrientation().y; - float dirDg = (float) ((Math.acos(oY) * 180 / Math.PI) * 2); - - ran.setSeed(32); - dirDg = dirDg - 18 + ran.nextFloat(); - float dirRadian = (float) (dirDg * Math.PI / 180); - ran.setSeed(3); - float distance = 13 + ran.nextFloat(); - - float x = (float) (tp.getSpawnLocation().getPosition().x + Math.sin(dirRadian) * distance); - float z = (float) (tp.getSpawnLocation().getPosition().z + Math.cos(dirRadian) * distance); - - Point3D spawnPoint = new Point3D(x, tp.getSpawnLocation().getPosition().y, z); - core.simulationService.transferToPlanet(actor, planet, spawnPoint, new Quaternion(0, 0, 0, 0), null); + Point3D spawnLocation = SpawnPoint.getRandomPosition(tp.getShuttle().getPosition(), 10, 50, actor.getPlanetId()); + core.simulationService.transferToPlanet(actor, planet, spawnLocation, new Quaternion(0, 0, 0, 0), null); }