diff --git a/ngengine_public.jar b/ngengine_public.jar index 418f084c..99fc3d2a 100644 Binary files a/ngengine_public.jar and b/ngengine_public.jar differ diff --git a/options.cfg b/options.cfg index 5a3a7f8e..ac85b4ef 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,6 @@ LOAD.SNAPSHOT_OBJECTS=1 LOAD.BUILDOUT_OBJECTS=1 -LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file +LOAD.RESOURCE.SYSTEM=1 + +# Misc +CLEAN.ODB.FOLDERS=0 \ No newline at end of file diff --git a/scripts/buffs/drink_breath_of_heaven.py b/scripts/buffs/drink_breath_of_heaven.py deleted file mode 100644 index 34ee2c0a..00000000 --- a/scripts/buffs/drink_breath_of_heaven.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys - -def setup(core, actor, buff): - return - -def add(core, actor, buff): - core.skillModService.addSkillMod(actor, 'constitution_modified', 80) - core.skillModService.addSkillMod(actor, 'expertise_dodge', 3) - return - -def remove(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'constitution_modified', 80) - core.skillModService.deductSkillMod(actor, 'expertise_dodge', 3) - return diff --git a/scripts/buffs/invis_sp_buff_invis_notrace_1.py b/scripts/buffs/invis_sp_buff_invis_notrace_1.py new file mode 100644 index 00000000..11b5dbd0 --- /dev/null +++ b/scripts/buffs/invis_sp_buff_invis_notrace_1.py @@ -0,0 +1,22 @@ +import sys + +def setup(core, actor, buff): + return + +def add(core, actor, buff): + actor.setInStealth(True) + actor.setRadarVisible(False) + + if actor.getSkillMod('expertise_sp_covert_mastery_1'): + core.skillModService.addSkillMod(actor, 'sp_covert_mastery') + + return + +def remove(core, actor, buff): + actor.setInStealth(False) + actor.setRadarVisible(True) + + if actor.getSkillMod('expertise_sp_covert_mastery_1'): + core.skillModService.deductSkillMod(actor, 'sp_covert_mastery') + + return diff --git a/scripts/buffs/me_stasis_1.py b/scripts/buffs/me_stasis_1.py index 7d4b7fe5..ad96199e 100644 --- a/scripts/buffs/me_stasis_1.py +++ b/scripts/buffs/me_stasis_1.py @@ -5,10 +5,10 @@ def setup(core, actor, buff): def add(core, actor, buff): actor.playEffectObject('clienteffect/medic_stasis.cef', 'me_stasis_1') - actor.setSpeedMultiplierBase(0.2) + core.skillModService.deductSkillMod(actor, 'movement', 8) return def remove(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.addSkillMod(actor, 'movement', 8) return \ No newline at end of file diff --git a/scripts/collections/master_bounty_hunter_1a.py b/scripts/collections/master_bounty_hunter_1a.py deleted file mode 100644 index c81bc04a..00000000 --- a/scripts/collections/master_bounty_hunter_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_bountyhunter_master") - return \ No newline at end of file diff --git a/scripts/collections/master_commando_1a.py b/scripts/collections/master_commando_1a.py deleted file mode 100644 index beb5e848..00000000 --- a/scripts/collections/master_commando_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_commando_master") - return \ No newline at end of file diff --git a/scripts/collections/master_entertainer_1a.py b/scripts/collections/master_entertainer_1a.py deleted file mode 100644 index e2dc3c3c..00000000 --- a/scripts/collections/master_entertainer_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_social_entertainer_master") - return \ No newline at end of file diff --git a/scripts/collections/master_force_sensitive_1a.py b/scripts/collections/master_force_sensitive_1a.py deleted file mode 100644 index b2ae17a5..00000000 --- a/scripts/collections/master_force_sensitive_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_jedi_master") - return \ No newline at end of file diff --git a/scripts/collections/master_medic_1a.py b/scripts/collections/master_medic_1a.py deleted file mode 100644 index d19ba11b..00000000 --- a/scripts/collections/master_medic_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_medic_master") - return \ No newline at end of file diff --git a/scripts/collections/master_officer_1a.py b/scripts/collections/master_officer_1a.py deleted file mode 100644 index 589869ae..00000000 --- a/scripts/collections/master_officer_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_officer_master") - return \ No newline at end of file diff --git a/scripts/collections/master_smuggler_1a.py b/scripts/collections/master_smuggler_1a.py deleted file mode 100644 index f7d741f1..00000000 --- a/scripts/collections/master_smuggler_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_smuggler_master") - return \ No newline at end of file diff --git a/scripts/collections/master_spy_1a.py b/scripts/collections/master_spy_1a.py deleted file mode 100644 index 1ff5be54..00000000 --- a/scripts/collections/master_spy_1a.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_spy_master") - return \ No newline at end of file diff --git a/scripts/collections/master_trader_0a.py b/scripts/collections/master_trader_0a.py deleted file mode 100644 index bff48590..00000000 --- a/scripts/collections/master_trader_0a.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") - core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") - core.collectionService.addCollection(actor, "new_prof_crafting_chef_master") - core.collectionService.addCollection(actor, "new_prof_crafting_tailor_master") - return \ No newline at end of file diff --git a/scripts/collections/master_trader_0b.py b/scripts/collections/master_trader_0b.py deleted file mode 100644 index 55a1c3d3..00000000 --- a/scripts/collections/master_trader_0b.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") - core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") - core.collectionService.addCollection(actor, "new_prof_crafting_architect_master") - return \ No newline at end of file diff --git a/scripts/collections/master_trader_0c.py b/scripts/collections/master_trader_0c.py deleted file mode 100644 index 018141b4..00000000 --- a/scripts/collections/master_trader_0c.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") - core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") - core.collectionService.addCollection(actor, "new_prof_crafting_armorsmith_master") - core.collectionService.addCollection(actor, "new_prof_crafting_weaponsmith_master") - return \ No newline at end of file diff --git a/scripts/collections/master_trader_0d.py b/scripts/collections/master_trader_0d.py deleted file mode 100644 index a9223ac6..00000000 --- a/scripts/collections/master_trader_0d.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys - -def setup(): - return - -def run(): - return - -def addMasterBadge(core, actor): - if actor.getLevel() == 90: - core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") - core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") - core.collectionService.addCollection(actor, "new_prof_crafting_droidengineer_master") - return \ No newline at end of file diff --git a/scripts/collections/profession_master.py b/scripts/collections/profession_master.py new file mode 100644 index 00000000..dbd6e1e0 --- /dev/null +++ b/scripts/collections/profession_master.py @@ -0,0 +1,60 @@ +import sys + +def bounty_hunter_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_bountyhunter_master") + return + +def commando_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_commando_master") + return + +def entertainer_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_social_entertainer_master") + return + +def force_sensitive_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_jedi_master") + return + +def medic_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_medic_master") + return + +def officer_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_officer_master") + return + +def smuggler_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_officer_master") + return + +def spy_1a(core, actor): + core.collectionService.addCollection(actor, "new_prof_spy_master") + return + +def trader_0a(core, actor): + core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") + core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") + core.collectionService.addCollection(actor, "new_prof_crafting_chef_master") + core.collectionService.addCollection(actor, "new_prof_crafting_tailor_master") + return + +def trader_0b(core, actor): + core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") + core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") + core.collectionService.addCollection(actor, "new_prof_crafting_architect_master") + return + +def trader_0c(core, actor): + core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") + core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") + core.collectionService.addCollection(actor, "new_prof_crafting_armorsmith_master") + core.collectionService.addCollection(actor, "new_prof_crafting_weaponsmith_master") + return + +def trader_0d(core, actor): + core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master") + core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master") + core.collectionService.addCollection(actor, "new_prof_crafting_droidengineer_master") + return + \ No newline at end of file diff --git a/scripts/commands/bh_armor_sprint_1.py b/scripts/commands/bh_armor_sprint_1.py index 45376aa9..22439323 100644 --- a/scripts/commands/bh_armor_sprint_1.py +++ b/scripts/commands/bh_armor_sprint_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, buff): - core.buffService.addBuffToCreature(actor, 'bh_power_sprint_1') + core.buffService.addBuffToCreature(actor, 'bh_power_sprint_1', actor) return def run(core, actor, target, commandString): diff --git a/scripts/commands/bh_cover_1.py b/scripts/commands/bh_cover_1.py index f9217c4e..8875a673 100644 --- a/scripts/commands/bh_cover_1.py +++ b/scripts/commands/bh_cover_1.py @@ -4,5 +4,5 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'bh_cover_1') + core.buffService.addBuffToCreature(actor, 'bh_cover_1', actor) return \ No newline at end of file diff --git a/scripts/commands/bh_shields_1.py b/scripts/commands/bh_shields_1.py index 41e93a6a..1bf27a70 100644 --- a/scripts/commands/bh_shields_1.py +++ b/scripts/commands/bh_shields_1.py @@ -4,7 +4,7 @@ def setup(core, actor, target, command): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'bh_shields') - core.buffService.addBuffToCreature(actor, 'bh_shields_charged') - core.buffService.addBuffToCreature(actor, 'bh_shields_handler') + core.buffService.addBuffToCreature(actor, 'bh_shields', actor) + core.buffService.addBuffToCreature(actor, 'bh_shields_charged', actor) + core.buffService.addBuffToCreature(actor, 'bh_shields_handler', actor) return \ No newline at end of file diff --git a/scripts/commands/co_first_aid_training.py b/scripts/commands/co_first_aid_training.py index e185f733..18b9aedf 100644 --- a/scripts/commands/co_first_aid_training.py +++ b/scripts/commands/co_first_aid_training.py @@ -4,5 +4,5 @@ def setup(): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'co_first_aid_training') + core.buffService.addBuffToCreature(actor, 'co_first_aid_training', actor) return \ No newline at end of file diff --git a/scripts/commands/combat/bh_return_fire_command_1.py b/scripts/commands/combat/bh_return_fire_command_1.py index 9542ec56..9fb224c0 100644 --- a/scripts/commands/combat/bh_return_fire_command_1.py +++ b/scripts/commands/combat/bh_return_fire_command_1.py @@ -6,6 +6,6 @@ def setup(core, actor, target, command): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'bh_return_fire_1') + core.buffService.addBuffToCreature(actor, 'bh_return_fire_1', actor) return \ No newline at end of file diff --git a/scripts/commands/combat/en_spiral_kick_0.py b/scripts/commands/combat/en_spiral_kick_0.py index eee76225..62a7efb2 100644 --- a/scripts/commands/combat/en_spiral_kick_0.py +++ b/scripts/commands/combat/en_spiral_kick_0.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_spiral_kick_1.py b/scripts/commands/combat/en_spiral_kick_1.py index eee76225..62a7efb2 100644 --- a/scripts/commands/combat/en_spiral_kick_1.py +++ b/scripts/commands/combat/en_spiral_kick_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_spiral_kick_2.py b/scripts/commands/combat/en_spiral_kick_2.py index eee76225..62a7efb2 100644 --- a/scripts/commands/combat/en_spiral_kick_2.py +++ b/scripts/commands/combat/en_spiral_kick_2.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_spiral_kick_3.py b/scripts/commands/combat/en_spiral_kick_3.py index eee76225..62a7efb2 100644 --- a/scripts/commands/combat/en_spiral_kick_3.py +++ b/scripts/commands/combat/en_spiral_kick_3.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_spiral_kick_4.py b/scripts/commands/combat/en_spiral_kick_4.py index eee76225..62a7efb2 100644 --- a/scripts/commands/combat/en_spiral_kick_4.py +++ b/scripts/commands/combat/en_spiral_kick_4.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_thrill.py b/scripts/commands/combat/en_thrill.py index 868b6bed..1dbabf6a 100644 --- a/scripts/commands/combat/en_thrill.py +++ b/scripts/commands/combat/en_thrill.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_debuff_thrill') + core.buffService.addBuffToCreature(target, 'en_debuff_thrill', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_thrill_1.py b/scripts/commands/combat/en_thrill_1.py index c3fd3fc2..41d4b0aa 100644 --- a/scripts/commands/combat/en_thrill_1.py +++ b/scripts/commands/combat/en_thrill_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_debuff_thrill_1') + core.buffService.addBuffToCreature(target, 'en_debuff_thrill_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_thrill_2.py b/scripts/commands/combat/en_thrill_2.py index c3fd3fc2..41d4b0aa 100644 --- a/scripts/commands/combat/en_thrill_2.py +++ b/scripts/commands/combat/en_thrill_2.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_debuff_thrill_1') + core.buffService.addBuffToCreature(target, 'en_debuff_thrill_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_thrill_3.py b/scripts/commands/combat/en_thrill_3.py index 2783c9d7..7e1892d5 100644 --- a/scripts/commands/combat/en_thrill_3.py +++ b/scripts/commands/combat/en_thrill_3.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_debuff_thrill_2') + core.buffService.addBuffToCreature(target, 'en_debuff_thrill_2', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_void_dance_1.py b/scripts/commands/combat/en_void_dance_1.py index cdc97c59..ce94693c 100644 --- a/scripts/commands/combat/en_void_dance_1.py +++ b/scripts/commands/combat/en_void_dance_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_void_dance_buff_1') + core.buffService.addBuffToCreature(target, 'en_void_dance_buff_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_void_dance_2.py b/scripts/commands/combat/en_void_dance_2.py index 186e477a..b6167823 100644 --- a/scripts/commands/combat/en_void_dance_2.py +++ b/scripts/commands/combat/en_void_dance_2.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_void_dance_buff_2') + core.buffService.addBuffToCreature(target, 'en_void_dance_buff_2', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/en_void_dance_3.py b/scripts/commands/combat/en_void_dance_3.py index 77d58c3d..268bbd4e 100644 --- a/scripts/commands/combat/en_void_dance_3.py +++ b/scripts/commands/combat/en_void_dance_3.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'en_void_dance_buff_3') + core.buffService.addBuffToCreature(target, 'en_void_dance_buff_3', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/me_burst_1.py b/scripts/commands/combat/me_burst_1.py index a8c6ccdf..f3944a79 100644 --- a/scripts/commands/combat/me_burst_1.py +++ b/scripts/commands/combat/me_burst_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'me_burst_1') + core.buffService.addBuffToCreature(target, 'me_burst_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/me_cranial_smash_1.py b/scripts/commands/combat/me_cranial_smash_1.py index 4c813179..0325e3b0 100644 --- a/scripts/commands/combat/me_cranial_smash_1.py +++ b/scripts/commands/combat/me_cranial_smash_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'me_cranial_smash_1') + core.buffService.addBuffToCreature(target, 'me_cranial_smash_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/me_doom.py b/scripts/commands/combat/me_doom.py index 9ba8326b..890f1ee4 100644 --- a/scripts/commands/combat/me_doom.py +++ b/scripts/commands/combat/me_doom.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'me_doom') + core.buffService.addBuffToCreature(target, 'me_doom', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/me_electrolyte_drain_1.py b/scripts/commands/combat/me_electrolyte_drain_1.py index 6ba20964..0775e620 100644 --- a/scripts/commands/combat/me_electrolyte_drain_1.py +++ b/scripts/commands/combat/me_electrolyte_drain_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'me_electrolyte_drain_1') + core.buffService.addBuffToCreature(target, 'me_electrolyte_drain_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/me_induce_insanity_1.py b/scripts/commands/combat/me_induce_insanity_1.py index 52fefadb..8b2d04a9 100644 --- a/scripts/commands/combat/me_induce_insanity_1.py +++ b/scripts/commands/combat/me_induce_insanity_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'me_induce_insanity_1') + core.buffService.addBuffToCreature(target, 'me_induce_insanity_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/me_serotonin_purge_1.py b/scripts/commands/combat/me_serotonin_purge_1.py index 7490ade3..c15e6e77 100644 --- a/scripts/commands/combat/me_serotonin_purge_1.py +++ b/scripts/commands/combat/me_serotonin_purge_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'me_serotonin_purge_1') + core.buffService.addBuffToCreature(target, 'me_serotonin_purge_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/me_stasis_1.py b/scripts/commands/combat/me_stasis_1.py index 35ffc3d7..977ff1be 100644 --- a/scripts/commands/combat/me_stasis_1.py +++ b/scripts/commands/combat/me_stasis_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('me_stasis_1') + core.buffService.addBuffToCreature(target, 'me_stasis_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_ae_dm_cc_1.py b/scripts/commands/combat/of_ae_dm_cc_1.py index 8cb29c18..91fcdb26 100644 --- a/scripts/commands/combat/of_ae_dm_cc_1.py +++ b/scripts/commands/combat/of_ae_dm_cc_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_ae_dm_cc_1') + core.buffService.addBuffToCreature(target, 'of_ae_dm_cc_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_ae_dm_cc_2.py b/scripts/commands/combat/of_ae_dm_cc_2.py index 6a6e15d1..21314fd9 100644 --- a/scripts/commands/combat/of_ae_dm_cc_2.py +++ b/scripts/commands/combat/of_ae_dm_cc_2.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_ae_dm_cc_2') + core.buffService.addBuffToCreature(target, 'of_ae_dm_cc_2', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_ae_dm_cc_3.py b/scripts/commands/combat/of_ae_dm_cc_3.py index fe44b74b..1a282584 100644 --- a/scripts/commands/combat/of_ae_dm_cc_3.py +++ b/scripts/commands/combat/of_ae_dm_cc_3.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_ae_dm_cc_3') + core.buffService.addBuffToCreature(target, 'of_ae_dm_cc_3', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_cc_melee_1.py b/scripts/commands/combat/of_cc_melee_1.py index 78feccc6..d6c0b925 100644 --- a/scripts/commands/combat/of_cc_melee_1.py +++ b/scripts/commands/combat/of_cc_melee_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_cc_melee_1') + core.buffService.addBuffToCreature(target, 'of_cc_melee_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_cc_melee_2.py b/scripts/commands/combat/of_cc_melee_2.py index 90462c2e..045fbdaa 100644 --- a/scripts/commands/combat/of_cc_melee_2.py +++ b/scripts/commands/combat/of_cc_melee_2.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_cc_melee_2') + core.buffService.addBuffToCreature(target, 'of_cc_melee_2', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_cc_melee_3.py b/scripts/commands/combat/of_cc_melee_3.py index b23d1da4..cf690edf 100644 --- a/scripts/commands/combat/of_cc_melee_3.py +++ b/scripts/commands/combat/of_cc_melee_3.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_cc_melee_3') + core.buffService.addBuffToCreature(target, 'of_cc_melee_3', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_cc_melee_4.py b/scripts/commands/combat/of_cc_melee_4.py index 7c5fb4ac..46ace711 100644 --- a/scripts/commands/combat/of_cc_melee_4.py +++ b/scripts/commands/combat/of_cc_melee_4.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_cc_melee_4') + core.buffService.addBuffToCreature(target, 'of_cc_melee_4', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_cc_melee_5.py b/scripts/commands/combat/of_cc_melee_5.py index b30529b9..5d476219 100644 --- a/scripts/commands/combat/of_cc_melee_5.py +++ b/scripts/commands/combat/of_cc_melee_5.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_cc_melee_5') + core.buffService.addBuffToCreature(target, 'of_cc_melee_5', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_cc_melee_6.py b/scripts/commands/combat/of_cc_melee_6.py index 8ade5109..1401aebc 100644 --- a/scripts/commands/combat/of_cc_melee_6.py +++ b/scripts/commands/combat/of_cc_melee_6.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_cc_melee_6') + core.buffService.addBuffToCreature(target, 'of_cc_melee_6', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_cc_melee_7.py b/scripts/commands/combat/of_cc_melee_7.py index 8736060a..a31ea5ef 100644 --- a/scripts/commands/combat/of_cc_melee_7.py +++ b/scripts/commands/combat/of_cc_melee_7.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_cc_melee_7') + core.buffService.addBuffToCreature(target, 'of_cc_melee_7', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deadeye_debuff.py b/scripts/commands/combat/of_deadeye_debuff.py index 5209b851..1b0a0ca8 100644 --- a/scripts/commands/combat/of_deadeye_debuff.py +++ b/scripts/commands/combat/of_deadeye_debuff.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deadeye_debuff') + core.buffService.addBuffToCreature(target, 'of_deadeye_debuff', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_1.py b/scripts/commands/combat/of_deb_def_1.py index 6e9a7fd3..97a9e475 100644 --- a/scripts/commands/combat/of_deb_def_1.py +++ b/scripts/commands/combat/of_deb_def_1.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_1') + core.buffService.addBuffToCreature(target, 'of_deb_def_1', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_1') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_1') + core.buffService.addBuffToCreature(target, 'of_deb_def_1', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_1', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_1') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_1') + core.buffService.addBuffToCreature(target, 'of_deb_def_1', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_2.py b/scripts/commands/combat/of_deb_def_2.py index 109e4d2c..3343fc97 100644 --- a/scripts/commands/combat/of_deb_def_2.py +++ b/scripts/commands/combat/of_deb_def_2.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_2') + core.buffService.addBuffToCreature(target, 'of_deb_def_2', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_2') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_2') + core.buffService.addBuffToCreature(target, 'of_deb_def_2', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_2', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_2') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_2') + core.buffService.addBuffToCreature(target, 'of_deb_def_2', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_2', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_3.py b/scripts/commands/combat/of_deb_def_3.py index 0060bee0..77e1d3fc 100644 --- a/scripts/commands/combat/of_deb_def_3.py +++ b/scripts/commands/combat/of_deb_def_3.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_3') + core.buffService.addBuffToCreature(target, 'of_deb_def_3', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_3') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_3') + core.buffService.addBuffToCreature(target, 'of_deb_def_3', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_3', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_3') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_3') + core.buffService.addBuffToCreature(target, 'of_deb_def_3', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_3', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_4.py b/scripts/commands/combat/of_deb_def_4.py index 32b7d21a..b9aa9a9c 100644 --- a/scripts/commands/combat/of_deb_def_4.py +++ b/scripts/commands/combat/of_deb_def_4.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_4') + core.buffService.addBuffToCreature(target, 'of_deb_def_4', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_4') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_4') + core.buffService.addBuffToCreature(target, 'of_deb_def_4', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_4', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_4') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_4') + core.buffService.addBuffToCreature(target, 'of_deb_def_4', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_4', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_5.py b/scripts/commands/combat/of_deb_def_5.py index f880a828..c641d203 100644 --- a/scripts/commands/combat/of_deb_def_5.py +++ b/scripts/commands/combat/of_deb_def_5.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_5') + core.buffService.addBuffToCreature(target, 'of_deb_def_5', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_5') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_5') + core.buffService.addBuffToCreature(target, 'of_deb_def_5', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_5', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_5') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_5') + core.buffService.addBuffToCreature(target, 'of_deb_def_5', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_5', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_6.py b/scripts/commands/combat/of_deb_def_6.py index aa1f3f18..0dfde469 100644 --- a/scripts/commands/combat/of_deb_def_6.py +++ b/scripts/commands/combat/of_deb_def_6.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_6') + core.buffService.addBuffToCreature(target, 'of_deb_def_6', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_6') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_6') + core.buffService.addBuffToCreature(target, 'of_deb_def_6', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_6', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_6') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_6') + core.buffService.addBuffToCreature(target, 'of_deb_def_6', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_6', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_7.py b/scripts/commands/combat/of_deb_def_7.py index ac8dbaec..a5f19a81 100644 --- a/scripts/commands/combat/of_deb_def_7.py +++ b/scripts/commands/combat/of_deb_def_7.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_7') + core.buffService.addBuffToCreature(target, 'of_deb_def_7', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_7') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_7') + core.buffService.addBuffToCreature(target, 'of_deb_def_7', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_7', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_7') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_7') + core.buffService.addBuffToCreature(target, 'of_deb_def_7', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_7', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_deb_def_8.py b/scripts/commands/combat/of_deb_def_8.py index b2ad7912..5ecc4517 100644 --- a/scripts/commands/combat/of_deb_def_8.py +++ b/scripts/commands/combat/of_deb_def_8.py @@ -1,11 +1,11 @@ def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'of_deb_def_8;) + core.buffService.addBuffToCreature(target, 'of_deb_def_8', actor) if actor.getSkillMod('expertise_of_adv_paint_debuff'): - core.buffService.addBuffToCreature(target, 'of_deb_def_8') - core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_8') + core.buffService.addBuffToCreature(target, 'of_deb_def_8', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_debuff_8', actor) if actor.getSkillMod('expertise_of_adv_paint_expose'): - core.buffService.addBuffToCreature(target, 'of_deb_def_8') - core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_8') + core.buffService.addBuffToCreature(target, 'of_deb_def_8', actor) + core.buffService.addBuffToCreature(target, 'of_adv_paint_expose_8', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_decapitate_1.py b/scripts/commands/combat/of_decapitate_1.py index d32bcc1e..9e6e9440 100644 --- a/scripts/commands/combat/of_decapitate_1.py +++ b/scripts/commands/combat/of_decapitate_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_decap_bleed_1') + core.buffService.addBuffToCreature(target, 'of_decap_bleed_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_decapitate_2.py b/scripts/commands/combat/of_decapitate_2.py index 7202e1e7..fb2cecf3 100644 --- a/scripts/commands/combat/of_decapitate_2.py +++ b/scripts/commands/combat/of_decapitate_2.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_decap_bleed_2') + core.buffService.addBuffToCreature(target, 'of_decap_bleed_2', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_decapitate_3.py b/scripts/commands/combat/of_decapitate_3.py index 53fc24d1..ffe4fa2f 100644 --- a/scripts/commands/combat/of_decapitate_3.py +++ b/scripts/commands/combat/of_decapitate_3.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_decap_bleed_3') + core.buffService.addBuffToCreature(target, 'of_decap_bleed_3', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_decapitate_4.py b/scripts/commands/combat/of_decapitate_4.py index 0ad1f93d..99481e70 100644 --- a/scripts/commands/combat/of_decapitate_4.py +++ b/scripts/commands/combat/of_decapitate_4.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_decap_bleed_4') + core.buffService.addBuffToCreature(target, 'of_decap_bleed_4', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_decapitate_5.py b/scripts/commands/combat/of_decapitate_5.py index fdc3539e..a282c4ae 100644 --- a/scripts/commands/combat/of_decapitate_5.py +++ b/scripts/commands/combat/of_decapitate_5.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_decap_bleed_5') + core.buffService.addBuffToCreature(target, 'of_decap_bleed_5', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_decapitate_6.py b/scripts/commands/combat/of_decapitate_6.py index 7b9fa74a..dae1edb5 100644 --- a/scripts/commands/combat/of_decapitate_6.py +++ b/scripts/commands/combat/of_decapitate_6.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_decap_bleed_6') + core.buffService.addBuffToCreature(target, 'of_decap_bleed_6', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_del_ae_dm_dot_1.py b/scripts/commands/combat/of_del_ae_dm_dot_1.py index a609a9fd..8fa6ed3b 100644 --- a/scripts/commands/combat/of_del_ae_dm_dot_1.py +++ b/scripts/commands/combat/of_del_ae_dm_dot_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_dot_bomb_1') + core.buffService.addBuffToCreature(target, 'of_dot_bomb_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_del_ae_dm_dot_2.py b/scripts/commands/combat/of_del_ae_dm_dot_2.py index a609a9fd..8fa6ed3b 100644 --- a/scripts/commands/combat/of_del_ae_dm_dot_2.py +++ b/scripts/commands/combat/of_del_ae_dm_dot_2.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_dot_bomb_1') + core.buffService.addBuffToCreature(target, 'of_dot_bomb_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_del_ae_dm_dot_3.py b/scripts/commands/combat/of_del_ae_dm_dot_3.py index a609a9fd..8fa6ed3b 100644 --- a/scripts/commands/combat/of_del_ae_dm_dot_3.py +++ b/scripts/commands/combat/of_del_ae_dm_dot_3.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_dot_bomb_1') + core.buffService.addBuffToCreature(target, 'of_dot_bomb_1', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_pistol_bleed_1.py b/scripts/commands/combat/of_pistol_bleed_1.py index ba2f33ba..a31c6c19 100644 --- a/scripts/commands/combat/of_pistol_bleed_1.py +++ b/scripts/commands/combat/of_pistol_bleed_1.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_pistol_bleed') + core.buffService.addBuffToCreature(target, 'of_pistol_bleed', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_vortex_1.py b/scripts/commands/combat/of_vortex_1.py index fa9bd5a9..72cf4b13 100644 --- a/scripts/commands/combat/of_vortex_1.py +++ b/scripts/commands/combat/of_vortex_1.py @@ -1,8 +1,8 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_vortex_bleed_1') - command.setBuffNameTarget('of_vortex_root') + core.buffService.addBuffToCreature(target, 'of_vortex_bleed_1', actor) + core.buffService.addBuffToCreature(target, 'of_vortex_root', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_vortex_2.py b/scripts/commands/combat/of_vortex_2.py index 15ea7699..61b586d4 100644 --- a/scripts/commands/combat/of_vortex_2.py +++ b/scripts/commands/combat/of_vortex_2.py @@ -1,8 +1,8 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_vortex_bleed_2') - command.setBuffNameTarget('of_vortex_root') + core.buffService.addBuffToCreature(target, 'of_vortex_bleed_2', actor) + core.buffService.addBuffToCreature(target, 'of_vortex_root', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_vortex_3.py b/scripts/commands/combat/of_vortex_3.py index 6b5a9e0f..4507ec9d 100644 --- a/scripts/commands/combat/of_vortex_3.py +++ b/scripts/commands/combat/of_vortex_3.py @@ -1,8 +1,8 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_vortex_bleed_3') - command.setBuffNameTarget('of_vortex_root') + core.buffService.addBuffToCreature(target, 'of_vortex_bleed_3', actor) + core.buffService.addBuffToCreature(target, 'of_vortex_root', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_vortex_4.py b/scripts/commands/combat/of_vortex_4.py index d185ba6a..ff87ce05 100644 --- a/scripts/commands/combat/of_vortex_4.py +++ b/scripts/commands/combat/of_vortex_4.py @@ -1,8 +1,8 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_vortex_bleed_4') - command.setBuffNameTarget('of_vortex_root') + core.buffService.addBuffToCreature(target, 'of_vortex_bleed_4', actor) + core.buffService.addBuffToCreature(target, 'of_vortex_root', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/combat/of_vortex_5.py b/scripts/commands/combat/of_vortex_5.py index b8b7010c..ae7aacee 100644 --- a/scripts/commands/combat/of_vortex_5.py +++ b/scripts/commands/combat/of_vortex_5.py @@ -1,8 +1,8 @@ import sys def setup(core, actor, target, command): - command.setBuffNameTarget('of_vortex_bleed_5') - command.setBuffNameTarget('of_vortex_root') + core.buffService.addBuffToCreature(target, 'of_vortex_bleed_5', actor) + core.buffService.addBuffToCreature(target, 'of_vortex_root', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/en_action_regen.py b/scripts/commands/en_action_regen.py index c6905572..c4ea6986 100644 --- a/scripts/commands/en_action_regen.py +++ b/scripts/commands/en_action_regen.py @@ -4,5 +4,5 @@ def setup(): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'en_action_regen') + core.buffService.addBuffToCreature(actor, 'en_action_regen', actor) return \ No newline at end of file diff --git a/scripts/commands/me_cure_affliction_1.py b/scripts/commands/me_cure_affliction_1.py index c03b5879..4b52e823 100644 --- a/scripts/commands/me_cure_affliction_1.py +++ b/scripts/commands/me_cure_affliction_1.py @@ -4,5 +4,5 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'me_cure_affliction_1', target) + core.buffService.addBuffToCreature(actor, 'me_cure_affliction_1', actor) return \ No newline at end of file diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py index 2bc32e5e..6ebaf183 100644 --- a/scripts/commands/transferitemmisc.py +++ b/scripts/commands/transferitemmisc.py @@ -28,7 +28,7 @@ def run(core, actor, target, commandString): if target.isLootItem(): target.setLootItem(0) - actor.sendSystemMessage('You looted ' + target.getTrueName() + ' from corpse.', 0) + actor.sendSystemMessage('You looted ' + target.getStf().getStfValue() + ' from corpse.', 0) if actorContainer != None and (container.getTemplate() == "object/cell/shared_cell.iff") & core.housingService.getPermissions(actor, actorContainer): target.getContainer().transferTo(actor, container, target) diff --git a/scripts/conversation/respec.py b/scripts/conversation/respec.py index f929002e..1c54294c 100644 --- a/scripts/conversation/respec.py +++ b/scripts/conversation/respec.py @@ -6,91 +6,55 @@ import sys def startConversation(core, actor, npc): convSvc = core.conversationService - prose = ProsePackage('conversation/respecseller', 's_31') - outOfBand = OutOfBand() - outOfBand.addProsePackage(prose) - convSvc.sendConversationMessage(actor, npc, outOfBand) - prose2 = ProsePackage('conversation/respecseller', 's_32') - outOfBand2 = OutOfBand() - outOfBand2.addProsePackage(prose2) - prose3 = ProsePackage('conversation/respecseller', 's_33') - outOfBand3 = OutOfBand() - outOfBand3.addProsePackage(prose3) - option1 = ConversationOption(outOfBand2, 0) - option2 = ConversationOption(outOfBand3, 1) + + convSvc.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@conversation/respecseller:s_31')) + options = Vector() - options.add(option1) - options.add(option2) + options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/respecseller:s_32'), 0)) + options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/respecseller:s_33'), 1)) convSvc.sendConversationOptions(actor, npc, options, handleFirstScreen) - return + return + def handleFirstScreen(core, actor, npc, selection): - - if selection == 0: - # respec - # TODO: check for prices - convSvc = core.conversationService - prose = ProsePackage('conversation/respecseller', 's_58') - outOfBand = OutOfBand() - outOfBand.addProsePackage(prose) - convSvc.sendConversationMessage(actor, npc, outOfBand) - prose2 = ProsePackage('conversation/respecseller', 's_60') - outOfBand2 = OutOfBand() - outOfBand2.addProsePackage(prose2) - prose3 = ProsePackage('conversation/respecseller', 's_64') - outOfBand3 = OutOfBand() - outOfBand3.addProsePackage(prose3) - option1 = ConversationOption(outOfBand2, 0) - option2 = ConversationOption(outOfBand3, 1) - options = Vector() - options.add(option1) - options.add(option2) - convSvc.sendConversationOptions(actor, npc, options, handleRespecScreen) - return - if selection == 1: - # expertise reset - # TODO: check for prices - convSvc = core.conversationService - prose = ProsePackage('conversation/respecseller', 's_35') - outOfBand = OutOfBand() - outOfBand.addProsePackage(prose) - convSvc.sendConversationMessage(actor, npc, outOfBand) - prose2 = ProsePackage('conversation/respecseller', 's_71') - outOfBand2 = OutOfBand() - outOfBand2.addProsePackage(prose2) - prose3 = ProsePackage('conversation/respecseller', 's_72') - outOfBand3 = OutOfBand() - outOfBand3.addProsePackage(prose3) - option1 = ConversationOption(outOfBand2, 0) - option2 = ConversationOption(outOfBand3, 1) - options = Vector() - options.add(option1) - options.add(option2) - convSvc.sendConversationOptions(actor, npc, options, handleResetScreen) - - - return + convSvc = core.conversationService -def handleRespecScreen(core, actor, npc, selection): + # TODO: check for prices + + if selection == 0: # respec + convSvc.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@conversation/respecseller:s_58')) + + options = Vector() + options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/respecseller:s_60'), 0)) + options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/respecseller:s_64'), 1)) + convSvc.sendConversationOptions(actor, npc, options, handleRespecScreen) + + if selection == 1: # expertise reset + convSvc.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@conversation/respecseller:s_35')) + + options = Vector() + options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/respecseller:s_71'), 0)) + options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/respecseller:s_72'), 1)) + convSvc.sendConversationOptions(actor, npc, options, handleResetScreen) + + return +def handleRespecScreen(core, actor, npc, selection): if selection == 0: core.skillService.sendRespecWindow(actor) - + core.conversationService.handleEndConversation(actor, npc) - + return - def handleResetScreen(core, actor, npc, selection): - if selection == 0: core.skillService.resetExpertise(actor) - - core.conversationService.handleEndConversation(actor, npc) - - return + core.conversationService.handleEndConversation(actor, npc) + + return + def endConversation(core, actor, npc): core.conversationService.sendStopConversation(actor, npc, 'conversation/respecseller', 's_38') return - \ No newline at end of file diff --git a/scripts/object/intangible/data_item/guild_stone.py b/scripts/object/intangible/data_item/guild_stone.py index ccad8904..7cf0dd3a 100644 --- a/scripts/object/intangible/data_item/guild_stone.py +++ b/scripts/object/intangible/data_item/guild_stone.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'object/guild_access_device') return \ No newline at end of file diff --git a/scripts/object/tangible/furniture/technical/guild_registry_initial.py b/scripts/object/tangible/furniture/technical/guild_registry_initial.py index ccad8904..25ce3c98 100644 --- a/scripts/object/tangible/furniture/technical/guild_registry_initial.py +++ b/scripts/object/tangible/furniture/technical/guild_registry_initial.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'object/guild_registry') return \ No newline at end of file diff --git a/scripts/radial/npc/corpse.py b/scripts/radial/npc/corpse.py index 453b7382..663ff2b6 100644 --- a/scripts/radial/npc/corpse.py +++ b/scripts/radial/npc/corpse.py @@ -5,7 +5,7 @@ def createRadial(core, owner, target, radials): #owner.sendSystemMessage('Correct Loot Radial created', 0) radials.clear() radials.add(RadialOptions(0, 36, 0, 'Loot')) - if target.getAttachment('AI') and core.resourceService.canHarvest(owner, target): + if target.getAttachment('AI') and core.resourceService and core.resourceService.canHarvest(owner, target): radials.add(RadialOptions(0, 163, 3, '@sui:harvest_corpse')) radials.add(RadialOptions(2, 164, 3, '@sui:harvest_meat')) radials.add(RadialOptions(2, 165, 3, '@sui:harvest_hide')) @@ -15,13 +15,7 @@ def createRadial(core, owner, target, radials): return def handleSelection(core, owner, target, option): - - if option == 164 and target.getAttachment('AI') and core.resourceService.canHarvest(owner, target): - core.resourceService.doHarvest(owner, target, 'meat') - if option == 165 and target.getAttachment('AI') and core.resourceService.canHarvest(owner, target): - core.resourceService.doHarvest(owner, target, 'hide') - if option == 166 and target.getAttachment('AI') and core.resourceService.canHarvest(owner, target): - core.resourceService.doHarvest(owner, target, 'bone') + if option == 36 and target: #core.lootService.handleLootRequest(owner,target) core.lootService.handleLootRequest(owner,target) @@ -30,5 +24,11 @@ def handleSelection(core, owner, target, option): #core.lootService.handleCreditDrop(owner, lootedObjectInventory) if option == 15 and target: core.objectService.destroyObject(target) + if option == 164 and target.getAttachment('AI') and core.resourceService.canHarvest(owner, target): + core.resourceService.doHarvest(owner, target, 'meat') + if option == 165 and target.getAttachment('AI') and core.resourceService.canHarvest(owner, target): + core.resourceService.doHarvest(owner, target, 'hide') + if option == 166 and target.getAttachment('AI') and core.resourceService.canHarvest(owner, target): + core.resourceService.doHarvest(owner, target, 'bone') return \ No newline at end of file diff --git a/scripts/radial/object/guild_access_device.py b/scripts/radial/object/guild_access_device.py new file mode 100644 index 00000000..bd019f39 --- /dev/null +++ b/scripts/radial/object/guild_access_device.py @@ -0,0 +1,30 @@ +from resources.common import RadialOptions +from services.sui.SUIService import InputBoxType +from java.util import Vector +from main import NGECore +import sys + +def createRadial(core, owner, target, radials): + + #radials.clear() + + if owner.getGuildId() != 0: + guild = core.guildService.getGuildById(owner.getGuildId) + + if guild is None: + return + + if guild.getLeader() == owner.getObjectID(): + radials.add(RadialOptions(0, RadialOptions.serverGuildGuildManagement, 3, '@guild:menu_guild_management')) + radials.add(RadialOptions(0, RadialOptions.serverGuildMemberManagement, 3, '@guild:menu_member_management')) + + #Guild Management + radials.add(RadialOptions(3, RadialOptions.serverGuildDisband, 3, '@guild:menu_disband')) + + #Member Management + radials.add(RadialOptions(4, RadialOptions.serverGuildSponsor, 3, '@guild:menu_sponsor')) + return + return + +def handleSelection(core, owner, target, option): + return \ No newline at end of file diff --git a/scripts/radial/object/guild_registry.py b/scripts/radial/object/guild_registry.py new file mode 100644 index 00000000..7b383d9a --- /dev/null +++ b/scripts/radial/object/guild_registry.py @@ -0,0 +1,47 @@ +from resources.common import RadialOptions +from services.sui.SUIService import InputBoxType +from java.util import Vector +from main import NGECore +import sys + +def createRadial(core, owner, target, radials): + + #radials.clear() + + if owner.getGuildId() == 0: + radials.add(RadialOptions(0, RadialOptions.serverGuildCreate, 3, '@guild:menu_create')) + return + + return + +def handleSelection(core, owner, target, option): + suiSvc = NGECore().getInstance().suiService + # Create Guild + if option == 185 and target: + wndGuildCreate = core.suiService.createInputBox(InputBoxType.INPUT_BOX_OK_CANCEL, '@guild:create_name_title', '@guild:create_name_prompt', owner, owner, 0, handleGuildCreateName) + wndGuildCreate.setProperty("txtInput:MaxLength", "24"); + wndGuildCreate.setProperty("txtInput:NumericInteger", "false") + suiSvc.openSUIWindow(wndGuildCreate) + return + + return + +def handleGuildCreateName(owner, window, eventType, returnList): + suiSvc = NGECore().getInstance().suiService + if eventType == 0: + guildName = str(returnList.get(0)) + if guildName is not None: + owner.setAttachment('guildName', guildName) + wndGuildInitials = NGECore().getInstance().suiService.createInputBox(InputBoxType.INPUT_BOX_OK, '@guild:create_abbrev_title', '@guild:create_abbrev_prompt', owner, owner, 0, doGuildCreate) + wndGuildInitials.setProperty("txtInput:MaxLength", "4"); + wndGuildInitials.setProperty("txtInput:NumericInteger", "false") + suiSvc.openSUIWindow(wndGuildInitials) + return + return + +def doGuildCreate(owner, window, eventType, returnList): + if eventType == 0: + guild = NGECore().getInstance().guildService.createGuild(str(returnList.get(0)), str(owner.getAttachment('guildName')), owner) + owner.setGuildId(guild.getId()) + return + return \ No newline at end of file diff --git a/scripts/static_spawns/corellia/coronet.py b/scripts/static_spawns/corellia/coronet.py index c04fe03e..60de3058 100644 --- a/scripts/static_spawns/corellia/coronet.py +++ b/scripts/static_spawns/corellia/coronet.py @@ -33,75 +33,75 @@ def addPlanetSpawns(core, planet): #---Coronet-CityHall-interrior brantlee = stcSvc.spawnObject('object/mobile/shared_dressed_brantlee_spondoon.iff', 'corellia', long(1855463), float(-25.7), float(1.3), float(-0.5), float(0.98), float(0.01)) - brantlee.setCustomName2('Brantlee Spondoon') - brantlee.setOptionsBitmask(256) + #brantlee.setCustomName2('Brantlee Spondoon') + #brantlee.setOptionsBitmask(256) cor_brawlr00 = stcSvc.spawnObject('object/mobile/shared_dressed_brawler_trainer_01.iff', 'corellia', long(1855463), float(-1.7274), float(7.9), float(-32.175), float(0.5), float(0.01)) - cor_brawlr00.setCustomName2('a brawler') + #cor_brawlr00.setCustomName2('a brawler') cor_btdiplmt02 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_male_01.iff', 'corellia', long(1855463), float(5.228), float(0.3), float(2.9167), float(-0.47), float(0.21)) - cor_btdiplmt02.setCustomName2('a Bothan Diplomat') + #cor_btdiplmt02.setCustomName2('a Bothan Diplomat') cor_btinfobkr00 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_female_02.iff', 'corellia', long(1855463), float(5.228), float(0.3), float(4.016), float(0.99), float(0.01)) - cor_btinfobkr00.setCustomName2('a Bothan Information Broker') + #cor_btinfobkr00.setCustomName2('a Bothan Information Broker') cor_btinfobkr01 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_male_02.iff', 'corellia', long(1855463), float(5.345), float(2.278), float(-27.0615), float(-0.14), float(0.22)) - cor_btinfobkr01.setCustomName2('a Bothan Information Broker') + #cor_btinfobkr01.setCustomName2('a Bothan Information Broker') cor_ent00 = stcSvc.spawnObject('object/mobile/shared_dressed_twk_entertainer.iff', 'corellia', long(1855463), float(0.767877), float(0.3), float(-2.902), float(-0.50), float(0.11)) - cor_ent00.setCustomName2('an Entertainer') + #cor_ent00.setCustomName2('an Entertainer') cor_farmer00 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_02.iff', 'corellia', long(1855463), float(-18.6014), float(1.3026), float(-11.314), float(-0.45), float(0.21)) - cor_farmer00.setCustomName2('a farmer') + #cor_farmer00.setCustomName2('a farmer') cor_farmer01 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_female_01.iff', 'corellia', long(1855463), float(0.767877), float(0.3), float(-4.002), float(-0.45), float(0.21)) - cor_farmer01.setCustomName2('a farmer') + #cor_farmer01.setCustomName2('a farmer') galluraHanderin = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_02.iff', 'corellia', long(1855463), float(-6.51554), float(1.303), float(9.6562), float(0.1), float(0.01)) - galluraHanderin.setCustomName2('Gallura Handerin') - galluraHanderin.setOptionsBitmask(256) + #galluraHanderin.setCustomName2('Gallura Handerin') + #galluraHanderin.setOptionsBitmask(256) corsec_agent00 = stcSvc.spawnObject('object/mobile/shared_dressed_corellia_local_corsec_chief.iff', 'corellia', long(1855463), float(-0.332), float(0.3), float(-2.902), float(0.89), float(0.01)) - corsec_agent00.setCustomName2('a CorSec Agent') + #corsec_agent00.setCustomName2('a CorSec Agent') thaleDustrunner = stcSvc.spawnObject('object/mobile/shared_dressed_criminal_smuggler_human_male_01.iff', 'corellia', long(1855463), float(-0.05), float(3.078), float(-10.9388), float(0.99), float(0.11)) - thaleDustrunner.setCustomName2('Thale Dustrunner') - thaleDustrunner.setOptionsBitmask(256) + #thaleDustrunner.setCustomName2('Thale Dustrunner') + #thaleDustrunner.setOptionsBitmask(256) #---Coronet-StarPort-interrior cor_btdiplmt00 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_bothan_female_01.iff', 'corellia', long(1855678), float(56.669), float(-0.521137), float(33.7689), float(0.99), float(0.11)) - cor_btdiplmt00.setCustomName2('a Bothan Diplomat') + #cor_btdiplmt00.setCustomName2('a Bothan Diplomat') cor_btdiplmt01 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_bothan_male_01.iff', 'corellia', long(1855672), float(8.651), float(0.6394), float(74.448), float(-0.47), float(0.21)) - cor_btdiplmt01.setCustomName2('a Bothan Diplomat') + #cor_btdiplmt01.setCustomName2('a Bothan Diplomat') corsec_cadt00 = stcSvc.spawnObject('object/mobile/shared_dressed_corsec_pilot_human_female_01.iff', 'corellia', long(1855678), float(37.163), float(0.6394), float(40.706), float(0.99), float(0.11)) - corsec_cadt00.setCustomName2('a CorSec cadet') + #corsec_cadt00.setCustomName2('a CorSec cadet') farmer02 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_04.iff', 'corellia', long(1855683), float(-62.767), float(2.6394), float(40.66), float(-0.45), float(0.21)) - farmer02.setCustomName2('a farmer') + #farmer02.setCustomName2('a farmer') gambler00 = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_cheated_gambler.iff', 'corellia', long(1855675), float(-4.61669), float(0.6394), float(67.826), float(0.99), float(0.11)) - gambler00.setCustomName2('a gambler') + #gambler00.setCustomName2('a gambler') cor_hunter00 = stcSvc.spawnObject('object/mobile/shared_dressed_trader_thug_male_moncal_02.iff', 'corellia', long(1855672), float(8.651), float(0.6394), float(75.548), float(0.99), float(0.11)) - cor_hunter00.setCustomName2('a hunter') + #cor_hunter00.setCustomName2('a hunter') jessbConvorr = stcSvc.spawnObject('object/mobile/shared_dressed_corellia_jesseb_convorr.iff', 'corellia', long(1855684), float(50.2), float(1.0), float(20.1), float(-0.47), float(0.21)) - jessbConvorr.setCustomName2('Jesseb Convorr') - jessbConvorr.setOptionsBitmask(256) + #jessbConvorr.setCustomName2('Jesseb Convorr') + #jessbConvorr.setOptionsBitmask(256) cor_merc00 = stcSvc.spawnObject('object/mobile/shared_dressed_mercenary_strong_hum_m.iff', 'corellia', long(1855683), float(-62.767), float(2.6394), float(41.76), float(0.99), float(0.11)) - cor_merc00.setCustomName2('a mercenary') + #cor_merc00.setCustomName2('a mercenary') cor_miner00 = stcSvc.spawnObject('object/mobile/shared_dressed_mand_miner_hum_03.iff', 'corellia', long(1855678), float(37.163), float(0.6394), float(39.606), float(-0.47), float(0.21)) - cor_miner00.setCustomName2('a miner') + #cor_miner00.setCustomName2('a miner') cor_scintst00 = stcSvc.spawnObject('object/mobile/shared_dressed_twi_female_scientist_01.iff', 'corellia', long(1855678), float(56.669), float(-0.521137), float(32.6689), float(-0.47), float(0.21)) - cor_scintst00.setCustomName2('a Scientist') + #cor_scintst00.setCustomName2('a Scientist') cor_slice00 = stcSvc.spawnObject('object/mobile/shared_dressed_criminal_slicer_human_male_01.iff', 'corellia', long(1855675), float(-4.61669), float(0.6394), float(66.7263), float(-0.5), float(0.21)) - cor_slice00.setCustomName2('a slicer') + #cor_slice00.setCustomName2('a slicer') #-Coronet-Legacy NPCs stregand = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_bith_male_01.iff', 'corellia', long(0), float(-33), float(28), float(-4424), float(0.67), float(0.21)) diff --git a/scripts/static_spawns/tatooine/anchorhead.py b/scripts/static_spawns/tatooine/anchorhead.py index 379246f2..5e2fb31e 100644 --- a/scripts/static_spawns/tatooine/anchorhead.py +++ b/scripts/static_spawns/tatooine/anchorhead.py @@ -17,11 +17,11 @@ def addPlanetSpawns(core, planet): # Cantina Interior rebRecruiter = stcSvc.spawnObject('object/mobile/shared_dressed_rebel_recruiter_human_female_01.iff', 'tatooine', long(1213345), float(-2.2), float(0.4), float(-5.4), float(0), float(0)) - rebRecruiter.setOptionsBitmask(264) + #rebRecruiter.setOptionsBitmask(264) 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') - borraSetas.setOptionsBitmask(256) + #borraSetas.setCustomName2('Borra Setas') + #borraSetas.setOptionsBitmask(256) # 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)) diff --git a/scripts/static_spawns/tatooine/bestine.py b/scripts/static_spawns/tatooine/bestine.py index caaeed4a..a636f8c3 100644 --- a/scripts/static_spawns/tatooine/bestine.py +++ b/scripts/static_spawns/tatooine/bestine.py @@ -17,84 +17,84 @@ def addPlanetSpawns(core, planet): # 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') - indigoSiyan.setOptionsBitmask(256) + #indigoSiyan.setCustomName2('Indigo Siyan') + #indigoSiyan.setOptionsBitmask(256) 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') - keanna.setOptionsBitmask(256) + #keanna.setCustomName2('Keanna Li\'kyna') + #keanna.setOptionsBitmask(256) 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') - oberhaur.setOptionsBitmask(256) + #oberhaur.setCustomName2('Commander Oberhaur') + #oberhaur.setOptionsBitmask(256) 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') - seanTrenwell.setOptionsBitmask(256) + #seanTrenwell.setCustomName2('Sean Trenwell') + #seanTrenwell.setOptionsBitmask(256) 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)) - talmont.setCustomName2('Prefect Talmont') - talmont.setOptionsBitmask(256) + #talmont.setCustomName2('Prefect Talmont') + #talmont.setOptionsBitmask(256) 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') - tourAryon.setOptionsBitmask(256) + #tourAryon.setCustomName2('Tour Aryon') + #tourAryon.setOptionsBitmask(256) 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') - victorVisalis.setOptionsBitmask(256) + #victorVisalis.setCustomName2('Victor Visalis') + #victorVisalis.setOptionsBitmask(256) 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)) - wilhalmSkrim.setCustomName2('Wilhalm Skrim') - wilhalmSkrim.setOptionsBitmask(256) + #wilhalmSkrim.setCustomName2('Wilhalm Skrim') + #wilhalmSkrim.setOptionsBitmask(256) #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') - akalColzet.setOptionsBitmask(256) + #akalColzet.setCustomName2('lt. Akal Colzet') + #akalColzet.setOptionsBitmask(256) 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)) - fariousGletch.setCustomName2('Farious Gletch') - fariousGletch.setOptionsBitmask(256) + #fariousGletch.setCustomName2('Farious Gletch') + #fariousGletch.setOptionsBitmask(256) 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') - pfilbeeJhorn.setOptionsBitmask(256) + #pfilbeeJhorn.setCustomName2('Pfilbee Jhorn') + #pfilbeeJhorn.setOptionsBitmask(256) #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') - gilBurtin.setOptionsBitmask(256) + #gilBurtin.setCustomName2('Gil Burtin') + #gilBurtin.setOptionsBitmask(256) # 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') - barak.setOptionsBitmask(256) + #barak.setCustomName2('Barak') + #barak.setOptionsBitmask(256) 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') - barrezz.setOptionsBitmask(256) + #barrezz.setCustomName2('Commander Barrezz') + #barrezz.setOptionsBitmask(256) 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') - jasha.setOptionsBitmask(256) + #jasha.setCustomName2('Captain Jasha') + #jasha.setOptionsBitmask(256) 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') - dkrn.setOptionsBitmask(256) + #dkrn.setCustomName2('Commander D\'krn') + #dkrn.setOptionsBitmask(256) 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') - gunham.setOptionsBitmask(256) + #gunham.setCustomName2('Commander Gunham') + #gunham.setOptionsBitmask(256) 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') - kormundThrylle.setOptionsBitmask(256) + #kormundThrylle.setCustomName2('Kormund Thrylle') + #kormundThrylle.setOptionsBitmask(256) 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') - calebKnolar.setOptionsBitmask(256) + #calebKnolar.setCustomName2('Major Caleb Knolar') + #calebKnolar.setOptionsBitmask(256) return diff --git a/scripts/static_spawns/tatooine/jabbas_palace.py b/scripts/static_spawns/tatooine/jabbas_palace.py index df11aef4..036fc2a1 100644 --- a/scripts/static_spawns/tatooine/jabbas_palace.py +++ b/scripts/static_spawns/tatooine/jabbas_palace.py @@ -18,65 +18,65 @@ def addPlanetSpawns(core, planet): # TODO Verify proper cell IDs once Jabba's Palace is spawning properly again. 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') - reelo.setOptionsBitmask(264) + #reelo.setCustomName2('Reelo Baruk') + #reelo.setOptionsBitmask(264) 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') - reeyees.setOptionsBitmask(264) + #reeyees.setCustomName2('Ree-Yees') + #reeyees.setOptionsBitmask(264) 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') - ephant.setOptionsBitmask(264) + #ephant.setCustomName2('Ephant Mon') + #ephant.setOptionsBitmask(264) 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') - porcellus.setOptionsBitmask(264) + #porcellus.setCustomName2('Porcellus') + #porcellus.setOptionsBitmask(264) 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') - barada.setOptionsBitmask(264) + #barada.setCustomName2('Barada') + #barada.setOptionsBitmask(264) 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') - bibMain.setOptionsBitmask(264) + #bibMain.setCustomName2('Bib Fortuna') + #bibMain.setOptionsBitmask(264) 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') - jabba.setOptionsBitmask(264) + #jabba.setCustomName2('Jabba the Hutt') + #jabba.setOptionsBitmask(264) 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.setOptionsBitmask(264) + #oola.setCustomName2('Oola') + #oola.setOptionsBitmask(264) 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') - bobaFett.setOptionsBitmask(264) + #bobaFett.setCustomName2('Boba Fett') + #bobaFett.setOptionsBitmask(264) 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') - ev9d9.setOptionsBitmask(264) + #ev9d9.setCustomName2('EV-9D9') + #ev9d9.setOptionsBitmask(264) 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') - malakili.setOptionsBitmask(264) + #malakili.setCustomName2('Malakili') + #malakili.setOptionsBitmask(264) # TODO 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') - maxRebo.setOptionsBitmask(264) + #maxRebo.setCustomName2('Max Rebo') + #maxRebo.setOptionsBitmask(264) 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') - droopy.setOptionsBitmask(264) + #droopy.setCustomName2('Droopy McCool') + #droopy.setOptionsBitmask(264) 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') - sySnootles.setOptionsBitmask(264) + #sySnootles.setCustomName2('Sy Snootles') + #sySnootles.setOptionsBitmask(264) 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') - g5po.setOptionsBitmask(264) + #g5po.setCustomName2('G5-PO') + #g5po.setOptionsBitmask(264) return diff --git a/scripts/static_spawns/tatooine/mos_eisley.py b/scripts/static_spawns/tatooine/mos_eisley.py index 8b3ac25f..0007f1f0 100644 --- a/scripts/static_spawns/tatooine/mos_eisley.py +++ b/scripts/static_spawns/tatooine/mos_eisley.py @@ -17,134 +17,134 @@ def addPlanetSpawns(core, planet): #Cantina Interior wuher = stcSvc.spawnObject('object/mobile/shared_wuher.iff', 'tatooine', long(1082877), float(8.6), float(-0.9), float(0.4), float(0.71), float(0.71)) - wuher.setCustomName2('Wuher') - wuher.setOptionsBitmask(256) + #wuher.setCustomName2('Wuher') + #wuher.setOptionsBitmask(256) chadraFanFemale = stcSvc.spawnObject('object/mobile/shared_chadra_fan_female.iff', 'tatooine', long(1082877), float(10.6), float(-0.9), float(-1.5), float(0.42), float(0.90)) - chadraFanFemale.setCustomName2('a Chadra Fan Female') - chadraFanFemale.setOptionsBitmask(256) + #chadraFanFemale.setCustomName2('a Chadra Fan Female') + #chadraFanFemale.setOptionsBitmask(256) chadraFanMale = stcSvc.spawnObject('object/mobile/shared_chadra_fan_male.iff', 'tatooine', long(1082877), float(10.7), float(-0.9), float(-0.3), float(0.64), float(0.77)) - chadraFanMale.setCustomName2('a Chadra Fan Male') - chadraFanMale.setOptionsBitmask(256) + #chadraFanMale.setCustomName2('a Chadra Fan Male') + #chadraFanMale.setOptionsBitmask(256) muftak = stcSvc.spawnObject('object/mobile/shared_muftak.iff', 'tatooine', long(1082877), float(20.3), float(-0.9), float(4.9), float(0.82), float(0.57)) - muftak.setCustomName2('Muftak') - muftak.setOptionsBitmask(256) + #muftak.setCustomName2('Muftak') + #muftak.setOptionsBitmask(256) chissMale1 = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_etyyy_chiss_poacher_01.iff', 'tatooine', long(1082877), float(1.7), float(-0.9), float(-5.0), float(0.71), float(0.71)) - chissMale1.setCustomName2('a Chiss Male') - chissMale1.setOptionsBitmask(256) + #chissMale1.setCustomName2('a Chiss Male') + #chissMale1.setOptionsBitmask(256) chissMale2 = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_etyyy_chiss_poacher_02.iff', 'tatooine', long(1082877), float(3.4), float(-0.9), float(-4.8), float(0), float(0)) - chissMale2.setCustomName2('a Chiss Male') - chissMale2.setOptionsBitmask(256) + #chissMale2.setCustomName2('a Chiss Male') + #chissMale2.setOptionsBitmask(256) cantinaStorm = stcSvc.spawnObject('object/mobile/shared_stormtrooper.iff', 'tatooine', long(1082877), float(2.9), float(-0.9), float(-6.5), float(0.71), float(0.71)) - cantinaStorm.setCustomName2('a Stormtrooper') - cantinaStorm.setOptionsBitmask(256) + #cantinaStorm.setCustomName2('a Stormtrooper') + #cantinaStorm.setOptionsBitmask(256) cantinaStormL = stcSvc.spawnObject('object/mobile/shared_stormtrooper_groupleader.iff', 'tatooine', long(1082877), float(3.6), float(-0.9), float(-7.9), float(0.71), float(0.71)) - cantinaStormL.setCustomName2('a Stormtrooper Squad Leader') - cantinaStormL.setOptionsBitmask(256) + #cantinaStormL.setCustomName2('a Stormtrooper Squad Leader') + #cantinaStormL.setOptionsBitmask(256) 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 D\'an') - figrinDan.setOptionsBitmask(256) + #figrinDan.setCustomName2('Figrin D\'an') + #figrinDan.setOptionsBitmask(256) 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') - techMor.setOptionsBitmask(256) + #techMor.setCustomName2('Tech M\'or') + #techMor.setOptionsBitmask(256) doikkNats = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(2.2), float(-0.9), float(-16.4), float(0.42), float(0.91)) - doikkNats.setCustomName2('Doikk Na\'ts') - doikkNats.setOptionsBitmask(256) + #doikkNats.setCustomName2('Doikk Na\'ts') + #doikkNats.setOptionsBitmask(256) tednDahai = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(1.3), float(-0.9), float(-15.2), float(0.42), float(0.91)) - tednDahai.setCustomName2('Tedn Dahai') - tednDahai.setOptionsBitmask(256) + #tednDahai.setCustomName2('Tedn Dahai') + #tednDahai.setOptionsBitmask(256) 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') - nalanCheel.setOptionsBitmask(256) + #nalanCheel.setCustomName2('Nalan Cheel') + #nalanCheel.setOptionsBitmask(256) 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') - businessman1.setOptionsBitmask(256) + #businessman1.setCustomName2('a Businessman') + #businessman1.setOptionsBitmask(256) 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') - commoner1.setOptionsBitmask(256) + #commoner1.setCustomName2('a Commoner') + #commoner1.setOptionsBitmask(256) 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') - entertainer1.setOptionsBitmask(256) + #entertainer1.setCustomName2('an Entertainer') + #entertainer1.setOptionsBitmask(256) 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') - noble1.setOptionsBitmask(256) + #noble1.setCustomName2('a Noble') + #noble1.setOptionsBitmask(256) 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') - commoner2.setOptionsBitmask(256) + #commoner2.setCustomName2('a Commoner') + #commoner2.setOptionsBitmask(256) 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') - commoner3.setOptionsBitmask(256) + #commoner3.setCustomName2('a Commoner') + #commoner3.setOptionsBitmask(256) 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') - commoner4.setOptionsBitmask(256) + #commoner4.setCustomName2('a Commoner') + #commoner4.setOptionsBitmask(256) 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') - commoner5.setOptionsBitmask(256) + #commoner5.setCustomName2('a Commoner') + #commoner5.setOptionsBitmask(256) 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') - commoner6.setOptionsBitmask(256) + #commoner6.setCustomName2('a Commoner') + #commoner6.setOptionsBitmask(256) 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') - commoner7.setOptionsBitmask(256) + #commoner7.setCustomName2('a Patron') + #commoner7.setOptionsBitmask(256) 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') - commoner8.setOptionsBitmask(256) + #commoner8.setCustomName2('a Patron') + #commoner8.setOptionsBitmask(256) 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)) - commoner9.setCustomName2('a Commoner') - commoner9.setOptionsBitmask(256) + #commoner9.setCustomName2('a Commoner') + #commoner9.setOptionsBitmask(256) 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') - commoner10.setOptionsBitmask(256) + #commoner10.setCustomName2('a Commoner') + #commoner10.setOptionsBitmask(256) 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') - anetiaKahryn.setOptionsBitmask(256) + #anetiaKahryn.setCustomName2('Anetia Kah\'ryn') + #anetiaKahryn.setOptionsBitmask(256) 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') - dravis.setOptionsBitmask(256) + #dravis.setCustomName2('Dravis') + #dravis.setOptionsBitmask(256) 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') - talonKarrde.setOptionsBitmask(256) + #talonKarrde.setCustomName2('Talon Karrde') + #talonKarrde.setOptionsBitmask(256) #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') - bartender1.setOptionsBitmask(256) + #bartender1.setCustomName2('a Bartender') + #bartender1.setOptionsBitmask(256) #City Hall Interior #Lucky Despot Interior TODO: Check Cell IDs for Spawned NPCS inside once Lucky Despot is spawning properly again. 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') - hansolo1.setOptionsBitmask(256) + #hansolo1.setCustomName2('Han Solo') + #hansolo1.setOptionsBitmask(256) #Medical Center Interior @@ -290,7 +290,7 @@ def addPlanetSpawns(core, planet): vourk.setOptionsBitmask(256) 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.setOptionsBitmask(264) + #mayor.setOptionsBitmask(264) 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') @@ -301,8 +301,8 @@ def addPlanetSpawns(core, planet): purvis.setOptionsBitmask(256) 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.setOptionsBitmask(256) + #peawpRdawc.setCustomName2('Peawp R\'dawc') + #peawpRdawc.setOptionsBitmask(256) nikoBrehe = 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)) nikoBrehe.setOptionsBitmask(264) @@ -315,7 +315,7 @@ def addPlanetSpawns(core, planet): #recruiters impRecruiter = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_officer_f.iff', 'tatooine', long(1280132), float(-6), float(1), float(9.2), float(0.70), float(0.71)) - impRecruiter.setOptionsBitmask(264) + #impRecruiter.setOptionsBitmask(264) diff --git a/scripts/static_spawns/tatooine/mos_espa.py b/scripts/static_spawns/tatooine/mos_espa.py index 6cb589b3..f628b9be 100644 --- a/scripts/static_spawns/tatooine/mos_espa.py +++ b/scripts/static_spawns/tatooine/mos_espa.py @@ -17,14 +17,14 @@ def addPlanetSpawns(core, planet): # 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') - dalaSocuna.setOptionsBitmask(256) + #dalaSocuna.setCustomName2('Commander Da\'la Socuna') + #dalaSocuna.setOptionsBitmask(256) #Watto's Shop ****TODO: Get Proper cells for Watto's Shop once Buildout structures are spawning as intended again. 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') - watto.setOptionsBitmask(256) + #watto.setCustomName2('Watto') + #watto.setOptionsBitmask(256) #Exterior Uninteractable NPCs 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)) diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 5e6e0ceb..44cab1a0 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -21,6 +21,7 @@ ******************************************************************************/ package main; +import java.io.File; import java.io.IOException; import java.sql.PreparedStatement; import java.sql.SQLException; @@ -59,7 +60,6 @@ import services.ConnectionService; import services.ConversationService; import services.DevService; import services.EntertainmentService; -import services.EquipmentService; import services.GroupService; import services.housing.HousingService; import services.InstanceService; @@ -84,9 +84,10 @@ import services.collections.CollectionService; import services.combat.CombatService; import services.command.CombatCommand; import services.command.CommandService; +import services.equipment.EquipmentService; import services.gcw.FactionService; import services.gcw.GCWService; -import services.guild.GuildService; +import services.GuildService; import services.LoginService; import services.map.MapService; import services.mission.MissionService; @@ -256,6 +257,21 @@ public class NGECore { options.setFilePath("options.cfg"); boolean optionsConfigLoaded = options.loadConfigFile(); + if (optionsConfigLoaded && options.getInt("CLEAN.ODB.FOLDERS") > 0) { + File baseFolder = new File("./odb"); + + if (baseFolder.isDirectory()) { + for (File odbFolder : baseFolder.listFiles()) { + if (odbFolder.isDirectory()) { + for (File file : odbFolder.listFiles()) { + if (!file.isDirectory() && !file.getName().equals("placeholder.txt")) { file.delete(); } + } + } + } + } + System.out.println("Cleaned ODB Folders."); + } + // Database databaseConnection = new DatabaseConnection(); databaseConnection.connect(config.getString("DB.URL"), config.getString("DB.NAME"), config.getString("DB.USER"), config.getString("DB.PASS"), "postgresql"); diff --git a/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java b/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java index e67de9b2..3ea90dd0 100644 --- a/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java @@ -22,15 +22,10 @@ package protocol.swg.auctionManagerClientListener; import java.nio.ByteOrder; -import java.util.HashSet; import java.util.LinkedHashSet; -import java.util.Set; -import java.util.TreeSet; -import java.util.Vector; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.CRC; import protocol.swg.SWGMessage; import services.bazaar.AuctionItem; diff --git a/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java b/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java index d05a6756..33a57339 100644 --- a/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java @@ -26,7 +26,6 @@ import java.nio.ByteBuffer; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.Utilities; import protocol.swg.SWGMessage; public class CreateAuctionMessage extends SWGMessage { diff --git a/src/protocol/swg/auctionManagerClientListener/CreateImmediateAuctionMessage.java b/src/protocol/swg/auctionManagerClientListener/CreateImmediateAuctionMessage.java index 6db48c5b..0546f41e 100644 --- a/src/protocol/swg/auctionManagerClientListener/CreateImmediateAuctionMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/CreateImmediateAuctionMessage.java @@ -26,7 +26,6 @@ import java.nio.ByteBuffer; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.Utilities; import protocol.swg.SWGMessage; public class CreateImmediateAuctionMessage extends SWGMessage { diff --git a/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java b/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java index 458c59d6..e4aaac6c 100644 --- a/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java +++ b/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java @@ -25,7 +25,6 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.objects.SWGObject; import protocol.swg.SWGMessage; import resources.objects.tangible.TangibleObject; import services.bazaar.AuctionItem; diff --git a/src/protocol/swg/chat/ChatOnLeaveRoom.java b/src/protocol/swg/chat/ChatOnLeaveRoom.java index a45b1def..b9c2c0ba 100644 --- a/src/protocol/swg/chat/ChatOnLeaveRoom.java +++ b/src/protocol/swg/chat/ChatOnLeaveRoom.java @@ -25,7 +25,6 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.StringUtilities; import protocol.swg.SWGMessage; public class ChatOnLeaveRoom extends SWGMessage { diff --git a/src/protocol/swg/chat/ChatSendToRoom.java b/src/protocol/swg/chat/ChatSendToRoom.java index 302390de..68e0ced2 100644 --- a/src/protocol/swg/chat/ChatSendToRoom.java +++ b/src/protocol/swg/chat/ChatSendToRoom.java @@ -26,7 +26,6 @@ import java.nio.ByteBuffer; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.StringUtilities; import protocol.swg.SWGMessage; public class ChatSendToRoom extends SWGMessage { diff --git a/src/protocol/swg/objectControllerObjects/CombatSpam.java b/src/protocol/swg/objectControllerObjects/CombatSpam.java index 26d64b9a..b6be2857 100644 --- a/src/protocol/swg/objectControllerObjects/CombatSpam.java +++ b/src/protocol/swg/objectControllerObjects/CombatSpam.java @@ -28,6 +28,7 @@ import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.ObjControllerMessage; import resources.datatables.HitType; +@SuppressWarnings("unused") public class CombatSpam extends ObjControllerObject{ private long attackerId; diff --git a/src/protocol/swg/objectControllerObjects/MissionListRequest.java b/src/protocol/swg/objectControllerObjects/MissionListRequest.java index 974b69cd..6d1fa2f5 100644 --- a/src/protocol/swg/objectControllerObjects/MissionListRequest.java +++ b/src/protocol/swg/objectControllerObjects/MissionListRequest.java @@ -23,9 +23,6 @@ package protocol.swg.objectControllerObjects; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.StringUtilities; -import resources.common.Console; - public class MissionListRequest extends ObjControllerObject { private long objectId; diff --git a/src/resources/common/Forager.java b/src/resources/common/Forager.java index 66b11041..71874a78 100644 --- a/src/resources/common/Forager.java +++ b/src/resources/common/Forager.java @@ -29,6 +29,7 @@ import java.util.Vector; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; import main.NGECore; +import resources.datatables.DisplayType; import resources.datatables.Options; import resources.loot.LootGroup; import resources.objects.creature.CreatureObject; @@ -289,7 +290,6 @@ public class Forager { break; } wormie.setCustomName(name); - wormie.setCustomName2(name); wormie.setLevel(forager.getLevel()); wormie.setOptions(Options.AGGRESSIVE, true); wormie.setOptions(Options.ATTACKABLE, true); @@ -342,16 +342,15 @@ public class Forager { goon.addObserver(forager); goon.setCustomName(name); - goon.setCustomName2(name); goon.setLevel(forager.getLevel()); goon.setOptions(Options.AGGRESSIVE, true); goon.setOptions(Options.ATTACKABLE, true); AIActor actor = (AIActor) goon.getAttachment("AI"); actor.addDefender(forager); - forager.sendSystemMessage("@foraging/forage_enemy:" + barkString,(byte) 0); - //OutOfBand oob = new OutOfBand(new ProsePackage("@foraging/forage_enemy",barkString)); - OutOfBand oob = new OutOfBand(new ProsePackage("@jawa_trader","cant_understand")); - forager.sendSystemMessage("@jawa_trader:cant_understand",(byte) 0); + forager.sendSystemMessage("@foraging/forage_enemy:" + barkString, DisplayType.Broadcast); + //OutOfBand oob = OutOfBand.ProsePackage("@foraging/forage_enemy:" + barkString)); + OutOfBand oob = OutOfBand.ProsePackage("@jawa_trader:cant_understand"); + forager.sendSystemMessage("@jawa_trader:cant_understand", DisplayType.Broadcast); NGECore.getInstance().chatService.spatialChat(goon, forager, "", (short)0x0, (short)0x0, 1, oob); } @@ -418,7 +417,6 @@ public class Forager { guard.addObserver(owner); // ToDo: add any players in aggro range!!! guard.setCustomName(name); - guard.setCustomName2(name); guard.setLevel(owner.getLevel()); guard.setOptions(Options.AGGRESSIVE, true); guard.setOptions(Options.ATTACKABLE, true); @@ -426,16 +424,16 @@ public class Forager { actor.addDefender(owner); barkString = "bark_"+map.getAttachment("MapSTFName"); - owner.sendSystemMessage("@treasure_map/treasure_map:" + barkString,(byte) 0); - OutOfBand oob = new OutOfBand(new ProsePackage("@treasure_map/treasure_map",barkString)); + owner.sendSystemMessage("@treasure_map/treasure_map:" + barkString, DisplayType.Broadcast); + OutOfBand oob = OutOfBand.ProsePackage("@treasure_map/treasure_map:" + barkString); NGECore.getInstance().chatService.spatialChat(guard, owner, "", (short)0x0, (short)0x0, 1, oob); return guard; } public CreatureObject spawnBoss(Point3D exactTreasureLocation, CreatureObject owner, TangibleObject map, short spawnLevel){ - Point3D treasureLocation = resources.common.SpawnPoint.getRandomPosition(exactTreasureLocation, 1, 10, owner.getPlanetId()); - return new CreatureObject(); + //Point3D treasureLocation = resources.common.SpawnPoint.getRandomPosition(exactTreasureLocation, 1, 10, owner.getPlanetId()); + return new CreatureObject(); // FIXME on paper this looks bad } @SuppressWarnings("unchecked") diff --git a/src/resources/common/ProsePackage.java b/src/resources/common/ProsePackage.java index 22549d40..d9baa309 100644 --- a/src/resources/common/ProsePackage.java +++ b/src/resources/common/ProsePackage.java @@ -50,28 +50,6 @@ public class ProsePackage { private int diInteger = 0; private float dfFloat = 0; - // TODO: Add more constructors - - public ProsePackage(String stfFile, String stfLabel) { - stf.setStfFilename(stfFile); - stf.setStfName(stfLabel); - } - - public ProsePackage(String stfFile, String stfLabel, String ttCustomString) { - stf.setStfFilename(stfFile); - stf.setStfName(stfLabel); - this.ttCustomString = ttCustomString; - } - - public ProsePackage(String stfFile, String stfLabel, long tuObjectId, String tuStfFile, String tuStfLabel, String tuCustomString) { - stf.setStfFilename(stfFile); - stf.setStfName(stfLabel); - this.tuObjectId = tuObjectId; - tuStf.setStfFilename(tuStfFile); - tuStf.setStfName(tuStfLabel); - this.tuCustomString = tuCustomString; - } - /* * Any parameters can be entered. * diff --git a/src/resources/datatables/DisplayType.java b/src/resources/datatables/DisplayType.java index 0e13f62a..437a0df4 100644 --- a/src/resources/datatables/DisplayType.java +++ b/src/resources/datatables/DisplayType.java @@ -23,13 +23,23 @@ package resources.datatables; public class DisplayType { + // System public static byte Broadcast = 0; // Level up. combatspam/skill_up - //public static byte Screen = 1; // Screen? XP gain + public static byte Screen = 1; // Screen? XP gain public static byte Chat = 2; //public static byte Overhead = 3; // Flytext? Seen on ent duration //public static byte Combat = 4; // CombatSpam? //public static byte Combat = 5; // Seen in combat flytext //public static byte Combat = 11; // Seen when blocking + // Flytext + //public static byte Broadcast = 0; // Level up. combatspam/skill_up + //public static byte Screen = 1; // Screen? XP gain + //public static byte Chat = 2; + //public static byte Overhead = 3; // Flytext? Seen on ent duration + //public static byte Combat = 4; // CombatSpam? + //public static byte Combat = 5; // Seen in combat flytext + //public static byte Combat = 11; // Seen when blocking + } diff --git a/src/resources/guild/Guild.java b/src/resources/guild/Guild.java index b45d8dca..4c1f0201 100644 --- a/src/resources/guild/Guild.java +++ b/src/resources/guild/Guild.java @@ -22,6 +22,7 @@ package resources.guild; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; import org.apache.mina.core.buffer.IoBuffer; @@ -29,21 +30,23 @@ import org.apache.mina.core.buffer.IoBuffer; import engine.resources.objects.Delta; import engine.resources.objects.SWGObject; -public class Guild extends Delta implements Serializable { +public class Guild extends Delta implements Serializable, Comparable { private static final long serialVersionUID = 1L; private int id; private String abbreviation; private String name; - private SWGObject leader; - private List members; + private long leader; + private String leaderName; + private List members = new ArrayList(); 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); + this.leader = leader.getObjectID(); + this.leaderName = leader.getCustomName(); + this.members.add(leader.getObjectID()); } public Guild() { @@ -90,22 +93,34 @@ public class Guild extends Delta implements Serializable { return (Integer.toString(getId()) + ":" + getAbbreviation()); } - public SWGObject getLeader() { + public long getLeader() { synchronized(objectMutex) { return leader; } } - public void setLeader(SWGObject leader) { + public void setLeader(long leader) { synchronized(objectMutex) { this.leader = leader; } } - public List getMembers() { + public List getMembers() { return members; } + public String getLeaderName() { + synchronized(objectMutex) { + return leaderName; + } + } + + public void setLeaderName(String leaderName) { + synchronized(objectMutex) { + this.leaderName = leaderName; + } + } + public byte[] getBytes() { synchronized(objectMutex) { IoBuffer buffer = createBuffer((getString().length() + 2)); @@ -114,4 +129,9 @@ public class Guild extends Delta implements Serializable { } } + @Override + public int compareTo(Guild guild) { + return ((Integer) id).compareTo(guild.getId()); + } + } diff --git a/src/resources/loot/LootGroup.java b/src/resources/loot/LootGroup.java index 9df63790..94ad4ef7 100644 --- a/src/resources/loot/LootGroup.java +++ b/src/resources/loot/LootGroup.java @@ -23,8 +23,6 @@ package resources.loot; import java.io.Serializable; -import com.sleepycat.persist.model.Persistent; - /** * @author Charon */ diff --git a/src/resources/objectives/BountyMissionObjective.java b/src/resources/objectives/BountyMissionObjective.java index 6c6dcff1..fa102f8f 100644 --- a/src/resources/objectives/BountyMissionObjective.java +++ b/src/resources/objectives/BountyMissionObjective.java @@ -37,7 +37,6 @@ import engine.resources.scene.Quaternion; import main.NGECore; import resources.common.BountyListItem; import resources.common.OutOfBand; -import resources.common.ProsePackage; import resources.common.SpawnPoint; import resources.datatables.DisplayType; import resources.objects.creature.CreatureObject; @@ -92,7 +91,7 @@ public class BountyMissionObjective extends MissionObjective { String message = "@mission/mission_bounty_informant:target_hard_" + Integer.toString(new Random().nextInt(4) + 1); - CommPlayerMessage comm = new CommPlayerMessage(player.getObjectId(), new OutOfBand(new ProsePackage(message))); + CommPlayerMessage comm = new CommPlayerMessage(player.getObjectId(), OutOfBand.ProsePackage(message)); comm.setTime(2000); switch (bountyTarget.getFaction()) { case "neutral": @@ -187,7 +186,7 @@ public class BountyMissionObjective extends MissionObjective { CreatureObject hunter = (CreatureObject) core.objectService.getObject(id); if (hunter != null) { - hunter.sendSystemMessage(new OutOfBand(new ProsePackage("@bounty_hunter:bounty_failed_hunter", "TT", getMissionObject().getGrandparent().getObjectId())), DisplayType.Broadcast); + hunter.sendSystemMessage(OutOfBand.ProsePackage("@bounty_hunter:bounty_failed_hunter", "TT", getMissionObject().getGrandparent().getObjectId()), DisplayType.Broadcast); hunter.getSlottedObject("datapad").viewChildren(hunter, true, false, new Traverser() { @Override public void process(SWGObject item) { diff --git a/src/resources/objectives/DeliveryMissionObjective.java b/src/resources/objectives/DeliveryMissionObjective.java index 7d5f029b..96f9b583 100644 --- a/src/resources/objectives/DeliveryMissionObjective.java +++ b/src/resources/objectives/DeliveryMissionObjective.java @@ -24,7 +24,7 @@ package resources.objectives; import engine.resources.scene.Point3D; import main.NGECore; import resources.common.OutOfBand; -import resources.common.ProsePackage; +import resources.datatables.DisplayType; import resources.objects.creature.CreatureObject; import resources.objects.mission.MissionObject; import resources.objects.tangible.TangibleObject; @@ -103,7 +103,7 @@ public class DeliveryMissionObjective extends MissionObjective { player.addBankCredits(reward); - player.sendSystemMessage(new OutOfBand(new ProsePackage("@mission/mission_generic:success_w_amount", reward)), (byte) 0); + player.sendSystemMessage(OutOfBand.ProsePackage("@mission/mission_generic:success_w_amount", reward), DisplayType.Broadcast); abort(core, player); diff --git a/src/resources/objects/building/BuildingMessageBuilder.java b/src/resources/objects/building/BuildingMessageBuilder.java index 6861117f..ab612ca9 100644 --- a/src/resources/objects/building/BuildingMessageBuilder.java +++ b/src/resources/objects/building/BuildingMessageBuilder.java @@ -40,96 +40,24 @@ public class BuildingMessageBuilder extends TangibleMessageBuilder { super(); } - public IoBuffer buildBaseline3() { - - BuildingObject building = (BuildingObject) object; - IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - - buffer.putShort((short) 0x0D); - buffer.putFloat(building.getComplexity()); - buffer.put(getAsciiString(building.getStfFilename())); - buffer.putInt(0); - buffer.put(getAsciiString(building.getStfName())); - buffer.putInt(0); - buffer.putInt(0xFF); - //buffer.putInt(0x64); - buffer.putInt(0); - buffer.putInt(0); - buffer.putShort((short) 0); - - buffer.putInt(0); - buffer.putInt(0); - // buffer.putInt(16777216); - buffer.putInt(0x100); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0x201C); - buffer.put((byte) 1); - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - - buffer.flip(); - buffer = createBaseline("BUIO", (byte) 3, buffer, size); - - return buffer; - - } - - public IoBuffer buildBaseline6() { - - BuildingObject building = (BuildingObject) object; - IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - - buffer.putShort((short) 8); - buffer.putInt(0x43); - - buffer.put(getAsciiString(building.getDetailFilename())); - buffer.putInt(0); - buffer.put(getAsciiString(building.getDetailName())); - buffer.putInt(0); - buffer.put((byte) 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); - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - - buffer.flip(); - buffer = createBaseline("BUIO", (byte) 6, buffer, size); - - return buffer; - - } - - public IoBuffer buildBaseline8() { - IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putShort((short) 0); - int size = buffer.position(); - buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size); - buffer.flip(); - buffer = createBaseline("BUIO", (byte) 8, buffer, size); - - return buffer; + @Override + public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { + super.buildBaseline3(baselineBuilders, deltaBuilders); } - public IoBuffer buildBaseline9() { - IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putShort((short) 0); - int size = buffer.position(); - buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size); - buffer.flip(); - buffer = createBaseline("BUIO", (byte) 9, buffer, size); - - return buffer; + @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); } public IoBuffer buildPermissionListCreate(Vector permissionList, String listName) { @@ -152,24 +80,4 @@ public class BuildingMessageBuilder extends TangibleMessageBuilder { return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); } - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(deltaBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(deltaBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(deltaBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(deltaBuilders, deltaBuilders); - } - } diff --git a/src/resources/objects/building/BuildingObject.java b/src/resources/objects/building/BuildingObject.java index ed6adb3c..6e5fd02c 100644 --- a/src/resources/objects/building/BuildingObject.java +++ b/src/resources/objects/building/BuildingObject.java @@ -22,67 +22,151 @@ package resources.objects.building; import java.io.Serializable; +import java.util.Map; import java.util.Vector; import java.util.concurrent.atomic.AtomicReference; +import org.apache.mina.core.buffer.IoBuffer; + import main.NGECore; +import resources.common.OutOfBand; +import resources.datatables.DisplayType; +import resources.datatables.Options; import resources.objects.ObjectMessageBuilder; import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; - -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.PortalVisitor; import engine.clients.Client; +import engine.resources.objects.Baseline; import engine.resources.objects.IPersistent; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Entity(version=6) public class BuildingObject extends TangibleObject implements IPersistent, Serializable { private static final long serialVersionUID = 1L; - @NotPersistent + private transient BuildingMessageBuilder messageBuilder; - private float maintenanceAmount = 0; - private int BMR = 0; - private String deedTemplate=""; - private boolean residency=false; - private byte privacy=(byte)0; - public static byte PRIVATE = (byte)0; - public static byte PUBLIC = (byte)1; - private short maximumStorageCapacity=0; - private Vector entryList = new Vector(); // Preferably the OIDs should be stored, because of name changes + private Vector entryList = new Vector(); private Vector banList = new Vector(); + public static final byte PRIVATE = (byte) 0; + public static final byte PUBLIC = (byte) 1; + public BuildingObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, Template, position, orientation); - messageBuilder = new BuildingMessageBuilder(this); - this.setConditionDamage(100); + super(objectID, planet, position, orientation, Template); + getBaseline(3).set("volume", 255); + setOptionsBitmask(Options.INVULNERABLE); + setConditionDamage(100); + setMaximumCondition(4320); + setStaticObject(true); } public BuildingObject() { super(); - messageBuilder = new BuildingMessageBuilder(this); - this.setConditionDamage(100); + getBaseline(3).set("volume", 255); + setOptionsBitmask(Options.INVULNERABLE); + setConditionDamage(100); + setMaximumCondition(4320); + setStaticObject(true); + } + + @Override + public void initAfterDBLoad() { + super.init(); + defendersList = new Vector(); + getBaseline(3).set("volume", 255); + setOptionsBitmask(Options.INVULNERABLE); + setConditionDamage(100); + setMaximumCondition(4320); + } + + @Override + public Baseline getOtherVariables() { + Baseline baseline = super.getOtherVariables(); + baseline.put("maintainanceAmount", (float) 0); + baseline.put("baseMaintenanceRate", 0); + baseline.put("deedTemplate", ""); + baseline.put("residency", false); + baseline.put("privacy", (byte) 0); + baseline.put("maximumStorageCapacity", (short) 0); + return baseline; + } + + @Override + public Baseline getBaseline3() { + Baseline baseline = super.getBaseline3(); + 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 Vector getCells() { + final Vector cells = new Vector(); + + this.viewChildren(this, true, false, (obj) -> { + if (obj instanceof CellObject) { + cells.add((CellObject) obj); + } + }); + + return cells; } public CellObject getCellByCellNumber(final int cellNumber) { - final AtomicReference ref = new AtomicReference(); synchronized(objectMutex) { this.viewChildren(this, true, false, (obj) -> { - if(obj instanceof CellObject && ((CellObject) obj).getCellNumber() == cellNumber) + if (obj instanceof CellObject && ((CellObject) obj).getCellNumber() == cellNumber) { ref.set((CellObject) obj); + } }); } return ref.get(); + } + + public CellObject getCellByCellName(String cellName) { + Map attributes = getTemplateData().getAttributes(); + if (attributes.containsKey("portalLayoutFilename") && ((String) attributes.get("portalLayoutFilename")).length() > 0) { + String portalLayoutFilename = (String) attributes.get("portalLayoutFilename"); + + try { + PortalVisitor portal = ClientFileManager.loadFile(portalLayoutFilename, PortalVisitor.class); + + for (int i = 1; i <= portal.cellCount; i++) { + if (cellName.equals(portal.cells.get(i).name)) { + return getCellByCellNumber(i); + } + } + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + return null; } public int getCellNumberByObjectId(long objectId) { @@ -98,168 +182,177 @@ public class BuildingObject extends TangibleObject implements IPersistent, Seria } public float getMaintenanceAmount() { - return maintenanceAmount; + return (float) otherVariables.get("maintenanceAmount"); } - + public void setMaintenanceAmount(float maintenanceAmount) { - this.maintenanceAmount = maintenanceAmount; - } - - public void setDeedTemplate(String deedTemplate){ - this.deedTemplate = deedTemplate; - } - - public String getDeedTemplate(){ - return this.deedTemplate; - } - - public String getBuildingName() { - return this.getCustomName(); - } - - public void setBuildingName(String buildingName, CreatureObject owner) { - //owner.getClient().getSession().write(messageBuilder.buildCustomNameDelta(this,buildingName)); - this.setCustomName(buildingName); - ((CreatureObject)owner).sendSystemMessage("Structure renamed.", (byte) 0); + otherVariables.set("maintenanceAmount", maintenanceAmount); } public int getBMR() { - return BMR; + return (int) otherVariables.get("baseMaintenanceRate"); } - + public void setBMR(int BMR) { - this.BMR = BMR; + otherVariables.set("baseMaintenanceRate", BMR); + } + + public String getDeedTemplate(){ + return (String) otherVariables.get("deedTemplate"); + } + + public void setDeedTemplate(String deedTemplate){ + otherVariables.set("deedTemplate", deedTemplate); + } + + public String getBuildingName() { + return getCustomName(); + } + + public void setBuildingName(String buildingName, CreatureObject owner) { + setCustomName(buildingName); + ((CreatureObject) owner).sendSystemMessage("Structure renamed.", DisplayType.Broadcast); + } + + public boolean getResidency(){ + return (boolean) otherVariables.get("residency"); } public void setResidency(CreatureObject owner){ owner.sendSystemMessage("@player_structure:declared_residency", (byte) 1); - residency = true; - } - - public boolean getResidency(){ - return this.residency; + otherVariables.set("residency", true); } public byte getPrivacy() { - return privacy; + return (byte) otherVariables.get("privacy"); } public String getPrivacyString() { - if (privacy==PRIVATE) - return "private"; - if (privacy==PUBLIC) - return "public"; - return "42"; + switch (getPrivacy()) { + case PRIVATE: + return "private"; + case PUBLIC: + return "public"; + default: + return "42"; + } } - + public void setPrivacy(byte privacy) { - this.privacy = privacy; + otherVariables.set("residency", privacy); } public Vector getItemsList() { Vector items = new Vector(); + getCells().forEach(c -> c.viewChildren(c, true, false, (item) -> { if(!(item instanceof CreatureObject) && item.getTemplate() != "object/tangible/terminal/shared_terminal_player_structure.iff" - && item.getTemplate() != "object/tangible/terminal/shared_terminal_city.iff" - && item.getTemplate() != "object/tangible/terminal/shared_terminal_city_vote.iff") + && item.getTemplate() != "object/tangible/terminal/shared_terminal_city.iff" + && item.getTemplate() != "object/tangible/terminal/shared_terminal_city_vote.iff") { items.add((TangibleObject) item); + } })); + return items; } - + public short getMaximumStorageCapacity() { - return maximumStorageCapacity; - } - - public void setMaximumStorageCapacity(short maximumStorageCapacity) { - this.maximumStorageCapacity = maximumStorageCapacity; + return (byte) otherVariables.get("maximumStorageCapacity"); } - public void setPermissionEntry(String name,CreatureObject owner){ + public void setMaximumStorageCapacity(short maximumStorageCapacity) { + otherVariables.set("maximumStorageCapacity", maximumStorageCapacity); + } + + public void setPermissionEntry(String name, CreatureObject owner){ Vector entryListFirstNames = new Vector(); - for (long oid : entryList){ + + for (long oid : entryList) { String firstName = NGECore.getInstance().characterService.getPlayerFirstName(oid); entryListFirstNames.add(firstName); } + entryListFirstNames.add("Peter"); entryListFirstNames.add("Jackson"); + owner.getClient().getSession().write(messageBuilder.buildPermissionListCreate(entryListFirstNames, name)); } - public void setPermissionBan(String name,CreatureObject owner){ + public void setPermissionBan(String name, CreatureObject owner){ Vector banListFirstNames = new Vector(); - for (long oid : banList){ + + for (long oid : banList) { String firstName = NGECore.getInstance().characterService.getPlayerFirstName(oid); banListFirstNames.add(firstName); - } + } + banListFirstNames.add("Peter"); banListFirstNames.add("Smith"); + owner.getClient().getSession().write(messageBuilder.buildPermissionListCreate(banListFirstNames, name)); } - public void addPlayerToEntryList(CreatureObject owner,long oid, String firstName){ + public void addPlayerToEntryList(CreatureObject owner, long oid, String firstName){ if (!entryList.contains(oid)){ - this.entryList.add(oid); - owner.sendSystemMessage(firstName+ " added to the list.", (byte)1); // player_added %NO added to the list. + entryList.add(oid); + owner.sendSystemMessage(OutOfBand.ProsePackage("@player_structure:player_removed", "TO", NGECore.getInstance().objectService.getObject(oid).getCustomName()), DisplayType.Screen); } } - public void removePlayerFromEntryList(CreatureObject owner,long oid, String firstName){ + public void removePlayerFromEntryList(CreatureObject owner, long oid, String firstName){ if (entryList.contains(oid)){ - this.entryList.remove(oid); - owner.sendSystemMessage(firstName+ " removed to the list.", (byte)1); // player_removed %NO removed from the list. + entryList.remove(oid); + owner.sendSystemMessage(OutOfBand.ProsePackage("@player_structure:player_removed", "TO", NGECore.getInstance().objectService.getObject(oid).getCustomName()), DisplayType.Screen); } } - public void addPlayerToBanList(CreatureObject owner,long oid, String firstName){ + public void addPlayerToBanList(CreatureObject owner, long oid, String firstName){ if (!banList.contains(oid)){ - this.banList.add(oid); - owner.sendSystemMessage(firstName+ " added to the list.", (byte)1); + banList.add(oid); + owner.sendSystemMessage(OutOfBand.ProsePackage("@player_structure:player_removed", "TO", NGECore.getInstance().objectService.getObject(oid).getCustomName()), DisplayType.Screen); } } - public void removePlayerFromBanList(CreatureObject owner,long oid, String firstName){ + public void removePlayerFromBanList(CreatureObject owner, long oid, String firstName){ if (banList.contains(oid)){ - this.banList.remove(oid); - owner.sendSystemMessage(firstName+ " removed to the list.", (byte)1); + banList.remove(oid); + owner.sendSystemMessage(OutOfBand.ProsePackage("@player_structure:player_removed", "TO", NGECore.getInstance().objectService.getObject(oid).getCustomName()), DisplayType.Screen); } } + @Override + public void notifyClients(IoBuffer buffer, boolean notifySelf) { + notifyObservers(buffer, false); + } + + @Override + public ObjectMessageBuilder getMessageBuilder() { + synchronized(objectMutex) { + if (messageBuilder == null) { + messageBuilder = new BuildingMessageBuilder(this); + } + + return messageBuilder; + } + } - @Override public void sendBaselines(Client destination) { - - if(destination == null || destination.getSession() == null) { - System.out.println("NULL session"); - return; + if (destination != null && destination.getSession() != null) { + destination.getSession().write(getBaseline(3).getBaseline()); + destination.getSession().write(getBaseline(6).getBaseline()); + + Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient()); + + if (parent != null && destination == parent) { + destination.getSession().write(getBaseline(8).getBaseline()); + destination.getSession().write(getBaseline(9).getBaseline()); + } } - - destination.getSession().write(messageBuilder.buildBaseline3()); - destination.getSession().write(messageBuilder.buildBaseline6()); - destination.getSession().write(messageBuilder.buildBaseline8()); - destination.getSession().write(messageBuilder.buildBaseline9()); - } - public Vector getCells() { - final Vector cells = new Vector(); - this.viewChildren(this, true, false, (obj) -> { - if(obj instanceof CellObject) - cells.add((CellObject) obj); - }); - return cells; - } - - @Override - public void initAfterDBLoad() { - super.init(); - messageBuilder = new BuildingMessageBuilder(this); - defendersList = new Vector(); - } - - public ObjectMessageBuilder getMessageBuilder() { - return messageBuilder; + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + super.sendListDelta(viewType, updateType, buffer); } } diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index 30a53018..8c8edbf9 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -682,6 +682,16 @@ public class CreatureMessageBuilder extends TangibleMessageBuilder { } + public IoBuffer buildGuildIdDelta(int guildId) { + IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(guildId); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x0F, buffer, size + 4); + + return buffer; + } + public IoBuffer buildGroupInviteDelta(long inviteSenderId, String inviteSenderName, long inviteCounter) { IoBuffer buffer = bufferPool.allocate(18 + inviteSenderName.length(), false).order(ByteOrder.LITTLE_ENDIAN); diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 84e0bf2c..68eea2b3 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -104,7 +104,6 @@ public class CreatureObject extends TangibleObject implements Serializable { private transient int missionCriticalObjectsUpdateCounter = 0; // CREO6 - private byte combatFlag = 0; private short level = -1; private int grantedHealth = 0; private String currentAnimation; @@ -187,7 +186,7 @@ public class CreatureObject extends TangibleObject implements Serializable { private transient SWGObject useTarget; public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, Template, position, orientation); + super(objectID, planet, position, orientation, Template); messageBuilder = new CreatureMessageBuilder(this); loadTemplateData(); skills = new ArrayList(); @@ -234,12 +233,6 @@ public class CreatureObject extends TangibleObject implements Serializable { } - public void setCustomName2(String customName) { - setCustomName(customName); - - notifyObservers(messageBuilder.buildCustomNameDelta(customName), true); - } - public int getBankCredits() { synchronized(objectMutex) { return bankCredits; @@ -351,25 +344,6 @@ public class CreatureObject extends TangibleObject implements Serializable { } - @Override - public int getOptionsBitmask() { - synchronized(objectMutex) { - return optionsBitmask; - } - } - - @Override - public void setOptionsBitmask(int optionBitmask) { - synchronized(objectMutex) { - this.optionsBitmask = optionBitmask; - } - - IoBuffer optionDelta = messageBuilder.buildOptionMaskDelta(optionBitmask); - - notifyObservers(optionDelta, true); - - } - public void setOptions(int options, boolean add) { synchronized(objectMutex) { if (options != 0) { @@ -485,15 +459,9 @@ public class CreatureObject extends TangibleObject implements Serializable { this.inspirationTick = inspirationTick; } } - - @Override + public void setFaction(String faction) { - synchronized(objectMutex) { - this.faction = faction; - } - - notifyObservers(messageBuilder.buildFactionDelta(faction), true); - + super.setFaction(faction); CreatureObject companion = NGECore.getInstance().mountService.getCompanion(this); @@ -502,13 +470,8 @@ public class CreatureObject extends TangibleObject implements Serializable { } } - @Override public void setFactionStatus(int factionStatus) { - synchronized(objectMutex) { - this.factionStatus = factionStatus; - } - - notifyObservers(messageBuilder.buildFactionStatusDelta(factionStatus), true); + super.setFactionStatus(factionStatus); CreatureObject companion = NGECore.getInstance().mountService.getCompanion(this); @@ -812,21 +775,6 @@ public class CreatureObject extends TangibleObject implements Serializable { return missionCriticalObjects; } - public byte getCombatFlag() { - synchronized(objectMutex) { - return combatFlag; - } - } - - public void setCombatFlag(byte combatFlag) { - synchronized(objectMutex) { - this.combatFlag = combatFlag; - } - IoBuffer combatDelta = messageBuilder.buildCombatFlagDelta(combatFlag); - - notifyObservers(combatDelta, true); - } - public short getLevel() { synchronized(objectMutex) { return level; @@ -967,6 +915,10 @@ public class CreatureObject extends TangibleObject implements Serializable { synchronized(objectMutex) { this.guildId = guildId; } + + IoBuffer guildIdDelta = messageBuilder.buildGuildIdDelta(guildId); + + notifyObservers(guildIdDelta, true); } public long getLookAtTarget() { diff --git a/src/resources/objects/factorycrate/FactoryCrateObject.java b/src/resources/objects/factorycrate/FactoryCrateObject.java index 8c82e824..b735ece8 100644 --- a/src/resources/objects/factorycrate/FactoryCrateObject.java +++ b/src/resources/objects/factorycrate/FactoryCrateObject.java @@ -69,8 +69,8 @@ public class FactoryCrateObject extends TangibleObject implements Serializable { } - public FactoryCrateObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { - super(objectID, planet, template, position, orientation); + public FactoryCrateObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { + super(objectID, planet, position, orientation, template); this.messageBuilder = new FactoryCrateMessageBuilder(this); this.contents = new Vector(); this.contentObjectQuantity = 0; diff --git a/src/resources/objects/group/GroupObject.java b/src/resources/objects/group/GroupObject.java index 92986e39..85535598 100644 --- a/src/resources/objects/group/GroupObject.java +++ b/src/resources/objects/group/GroupObject.java @@ -32,6 +32,7 @@ import engine.resources.scene.Quaternion; public class GroupObject extends UniverseObject { + private static final long serialVersionUID = 1L; private Vector memberList = new Vector(); private int memberListUpdateCounter; private SWGObject groupLeader; diff --git a/src/resources/objects/guild/GuildMessageBuilder.java b/src/resources/objects/guild/GuildMessageBuilder.java index a29b8f68..65bc51c6 100644 --- a/src/resources/objects/guild/GuildMessageBuilder.java +++ b/src/resources/objects/guild/GuildMessageBuilder.java @@ -21,17 +21,9 @@ ******************************************************************************/ package resources.objects.guild; -import java.nio.ByteOrder; import java.util.Map; -import java.util.Map.Entry; - -import org.apache.mina.core.buffer.IoBuffer; import engine.resources.objects.Builder; -import resources.gcw.CurrentServerGCWZoneHistory; -import resources.gcw.CurrentServerGCWZonePercent; -import resources.gcw.OtherServerGCWZonePercent; -import resources.guild.Guild; import resources.objects.universe.UniverseMessageBuilder; public class GuildMessageBuilder extends UniverseMessageBuilder { @@ -44,181 +36,6 @@ public class GuildMessageBuilder extends UniverseMessageBuilder { super(); } - public IoBuffer buildBaseline3() { - GuildObject guilds = (GuildObject) object; - - IoBuffer buffer = bufferPool.allocate(((guilds.getGuildList().size() * 10) + 49), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putShort((short) 5); // Object Count - buffer.putFloat(guilds.getComplexity()); - buffer.put(getAsciiString(guilds.getSTFFile())); - buffer.putInt(guilds.getSTFSpacer()); - buffer.put(getAsciiString(guilds.getSTFName())); - buffer.put(getUnicodeString(guilds.getCustomName())); - buffer.putInt(guilds.getVolume()); - buffer.putInt(guilds.getGuildList().size()); - buffer.putInt(guilds.getGuildList().getUpdateCounter()); - for (Guild object : guilds.getGuildList().get()) { - buffer.put(getAsciiString(object.getString())); - } - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - buffer.flip(); - buffer = createBaseline("GILD", (byte) 3, buffer, size); - - return buffer; - } - - public IoBuffer buildBaseline6() { - GuildObject guilds = (GuildObject) object; - - int capacity = 16 + getAsciiString(guilds.getSTFFile()).length; - for (Entry entry : guilds.getCurrentServerGCWZonePercentMap().entrySet()) capacity += (11 + entry.getKey().length() + entry.getValue().getBytes().length); - for (Entry entry : guilds.getCurrentServerGCWTotalPercentMap().entrySet()) capacity += (11 + entry.getKey().length() + entry.getValue().getBytes().length); - for (Entry entry : guilds.getCurrentServerGCWZoneHistoryMap().entries()) capacity += (11 + entry.getKey().length() + entry.getValue().getBytes().length); - for (Entry entry : guilds.getCurrentServerGCWTotalHistoryMap().entries()) capacity += (11 + entry.getKey().length() + entry.getValue().getBytes().length); - for (Entry entry : guilds.getOtherServerGCWZonePercentMap().entries()) capacity += (11 + entry.getKey().length() + entry.getValue().getBytes().length); - for (Entry entry : guilds.getOtherServerGCWTotalPercentMap().entries()) capacity += (11 + entry.getKey().length() + entry.getValue().getBytes().length); - - IoBuffer buffer = bufferPool.allocate(capacity, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - buffer.putShort((short) 9); // Object Count - buffer.putInt(guilds.getServerId()); - buffer.put(getAsciiString(guilds.getSTFFile())); - buffer.putInt(guilds.getUnknown1()); - buffer.putShort(guilds.getUnknown2()); - buffer.putInt(guilds.getCurrentServerGCWZonePercentMap().size()); - buffer.putInt(guilds.getCurrentServerGCWZonePercentMap().getUpdateCounter()); - for (Entry entry : guilds.getCurrentServerGCWZonePercentMap().entrySet()) { - buffer.put((byte) 0); - buffer.put(getAsciiString(entry.getKey())); - buffer.put(entry.getValue().getBytes()); - } - buffer.putInt(guilds.getCurrentServerGCWTotalPercentMap().size()); - buffer.putInt(guilds.getCurrentServerGCWTotalPercentMap().getUpdateCounter()); - for (Entry entry : guilds.getCurrentServerGCWTotalPercentMap().entrySet()) { - buffer.put((byte) 0); - buffer.put(getAsciiString(entry.getKey())); - buffer.put(entry.getValue().getBytes()); - } - buffer.putInt(guilds.getCurrentServerGCWZoneHistoryMap().size()); - buffer.putInt(guilds.getCurrentServerGCWZoneHistoryMap().getUpdateCounter()); - for (Entry entry : guilds.getCurrentServerGCWZoneHistoryMap().entries()) { - buffer.put((byte) 0); - buffer.put(getAsciiString(entry.getKey())); - buffer.put(entry.getValue().getBytes()); - } - buffer.putInt(guilds.getCurrentServerGCWTotalHistoryMap().size()); - buffer.putInt(guilds.getCurrentServerGCWTotalHistoryMap().getUpdateCounter()); - for (Entry entry : guilds.getCurrentServerGCWTotalHistoryMap().entries()) { - buffer.put((byte) 0); - buffer.put(getAsciiString(entry.getKey())); - buffer.put(entry.getValue().getBytes()); - } - buffer.putInt(guilds.getOtherServerGCWZonePercentMap().size()); - buffer.putInt(guilds.getOtherServerGCWZonePercentMap().getUpdateCounter()); - for (Entry entry : guilds.getOtherServerGCWZonePercentMap().entries()) { - buffer.put((byte) 0); - buffer.put(getAsciiString(entry.getKey())); - buffer.put(entry.getValue().getBytes()); - } - buffer.putInt(guilds.getOtherServerGCWTotalPercentMap().size()); - buffer.putInt(guilds.getOtherServerGCWTotalPercentMap().getUpdateCounter()); - for (Entry entry : guilds.getOtherServerGCWTotalPercentMap().entries()) { - buffer.put((byte) 0); - buffer.put(getAsciiString(entry.getKey())); - buffer.put(entry.getValue().getBytes()); - } - buffer.putInt(guilds.getUnknown3()); - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - buffer.flip(); - buffer = createBaseline("GILD", (byte) 6, buffer, size); - - return buffer; - } - - public IoBuffer buildComplexity(float complexity) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.putFloat(complexity); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("GILD", (byte) 3, (short) 1, (short) 0, buffer, size + 4); - - return buffer; - } - - public IoBuffer buildSTF(String STFFile, int STFSpacer, String STFName) { - IoBuffer buffer = bufferPool.allocate((STFFile.length() + STFName.length() + 8), false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.put(getAsciiString(STFFile)); - buffer.putInt(STFSpacer); - buffer.put(getAsciiString(STFName)); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("GILD", (byte) 3, (short) 1, (short) 1, buffer, size + 4); - - return buffer; - } - - public IoBuffer buildCustomName(String customName) { - IoBuffer buffer = bufferPool.allocate((customName.length() + 4), false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.put(getUnicodeString(customName)); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("GILD", (byte) 3, (short) 1, (short) 2, buffer, size + 4); - - return buffer; - } - - public IoBuffer buildVolume(int volume) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.putInt(volume); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("GILD", (byte) 3, (short) 1, (short) 3, buffer, size + 4); - - return buffer; - } - - public IoBuffer buildServerId(int serverId) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.putInt(serverId); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("GILD", (byte) 6, (short) 1, (short) 0, buffer, size + 4); - - return buffer; - } - - public IoBuffer buildUnknowns(int unknown1, short unknown2) { - IoBuffer buffer = bufferPool.allocate(6, false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.putInt(unknown1); - buffer.putShort(unknown2); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("GILD", (byte) 6, (short) 1, (short) 1, buffer, size + 4); - - return buffer; - } - - public IoBuffer buildUnknown3(int unknown3) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.putInt(unknown3); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("GILD", (byte) 6, (short) 1, (short) 8, buffer, size + 4); - - return buffer; - } - @Override public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { super.buildBaseline3(baselineBuilders, deltaBuilders); diff --git a/src/resources/objects/guild/GuildObject.java b/src/resources/objects/guild/GuildObject.java index bee39d0c..b3723937 100644 --- a/src/resources/objects/guild/GuildObject.java +++ b/src/resources/objects/guild/GuildObject.java @@ -37,254 +37,112 @@ import resources.objects.ObjectMessageBuilder; import resources.objects.SWGList; import resources.objects.SWGMap; import resources.objects.SWGMultiMap; +import resources.objects.SWGSet; import resources.objects.universe.UniverseObject; import services.collections.ServerFirst; - -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - import engine.clients.Client; +import engine.resources.objects.Baseline; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Entity(version=1) public class GuildObject extends UniverseObject implements Serializable { private static final long serialVersionUID = 1L; - protected NGECore core; - @NotPersistent + private transient GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this); - private Map serverFirst = new HashMap(); - private Map> zoneMap = new TreeMap>(); - - private long nextInstanceId = 0; - - // GILD 3 - private float complexity = 0x803F0F00; - private String STFFile = "string_id_table"; - private int STFSpacer = 0; - private String STFName = ""; - private String customName = ""; - private int volume = 0; - private SWGList guildList = new SWGList(this, 3, 4, false); - - // GILD 6 - private int serverId = 0x43; - //private String STFName = "string_id_table"; - private int unknown1 = 0; - private short unknown2 = 0; - private SWGMap currentServerGCWZonePercentMap = new SWGMap(this, 6, 2, true); - private SWGMap currentServerGCWTotalPercentMap = new SWGMap(this, 6, 3, true); - private SWGMultiMap currentServerGCWZoneHistoryMap = new SWGMultiMap(this, 6, 4, true); - private SWGMultiMap currentServerGCWTotalHistoryMap = new SWGMultiMap(this, 6, 5, true); - private SWGMultiMap otherServerGCWZonePercentMap = new SWGMultiMap(this, 6, 6, true); - private SWGMultiMap otherServerGCWTotalPercentMap = new SWGMultiMap(this, 6, 7, true); - private int unknown3 = 5; - public GuildObject(NGECore core, long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, position, orientation, Template); - this.core = core; + otherVariables = getOtherVariables(); // FIXME temp + } + + public GuildObject() { + super(); + } + + public void initAfterDBLoad() { + super.init(); } @Override - public void initAfterDBLoad() { - super.init(); - messageBuilder = new GuildMessageBuilder(this); - guildList.init(this); - currentServerGCWZonePercentMap.init(this); - currentServerGCWTotalPercentMap.init(this); - currentServerGCWZoneHistoryMap.init(this); - currentServerGCWTotalHistoryMap.init(this); - otherServerGCWZonePercentMap.init(this); - otherServerGCWTotalPercentMap.init(this); + public Baseline getOtherVariables() { + Baseline baseline = super.getOtherVariables(); + baseline.put("nextInstanceId", (long) 0); + baseline.put("zoneMap", new TreeMap>()); + baseline.put("serverFirst", new HashMap()); + return baseline; } - public float getComplexity() { - synchronized(objectMutex) { - return complexity; - } + @Override + public Baseline getBaseline3() { + Baseline baseline = super.getBaseline3(); + baseline.put("guildList", new SWGSet(this, 3, 4, false)); + return baseline; } - public void setComplexity(float complexity) { - synchronized(objectMutex) { - this.complexity = complexity; - } - - notifyAll(messageBuilder.buildComplexity(complexity)); + @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; } - public String getSTFFile() { - synchronized(objectMutex) { - return STFFile; - } - } - - public void setSTFFile(String STFFile) { - synchronized(objectMutex) { - this.STFFile = STFFile; - } - - notifyAll(messageBuilder.buildSTF(STFFile, STFSpacer, STFName)); - } - - public int getSTFSpacer() { - synchronized(objectMutex) { - return STFSpacer; - } - } - - public void setSTFSpacer(int STFSpacer) { - synchronized(objectMutex) { - this.STFSpacer = STFSpacer; - } - - notifyAll(messageBuilder.buildSTF(STFFile, STFSpacer, STFName)); - } - - public String getSTFName() { - synchronized(objectMutex) { - return STFName; - } - } - - public void setSTFName(String STFName) { - synchronized(objectMutex) { - this.STFName = STFName; - } - - notifyAll(messageBuilder.buildSTF(STFFile, STFSpacer, STFName)); - } - - public String getCustomName() { - synchronized(objectMutex) { - return customName; - } - } - - public void setCustomName(String customName) { - synchronized(objectMutex) { - this.customName = customName; - } - - notifyAll(messageBuilder.buildCustomName(customName)); - } - - public int getVolume() { - synchronized(objectMutex) { - return volume; - } - } - - public void setVolume(int volume) { - synchronized(objectMutex) { - this.volume = volume; - } - - notifyAll(messageBuilder.buildVolume(volume)); - } - - public SWGList getGuildList() { - return guildList; - } - - public int getServerId() { - synchronized(objectMutex) { - return serverId; - } - } - - public void setServerId(int serverId) { - synchronized(objectMutex) { - this.serverId = serverId; - } - - notifyAll(messageBuilder.buildServerId(serverId)); - } - - public int getUnknown1() { - synchronized(objectMutex) { - return unknown1; - } - } - - public void setUnknown1(int unknown1) { - synchronized(objectMutex) { - this.unknown1 = unknown1; - } - - notifyAll(messageBuilder.buildUnknowns(unknown1, unknown2)); - } - - public short getUnknown2() { - synchronized(objectMutex) { - return unknown2; - } - } - - public void setUnknown2(short unknown2) { - synchronized(objectMutex) { - this.unknown2 = unknown2; - } - - notifyAll(messageBuilder.buildUnknowns(unknown1, unknown2)); + @SuppressWarnings("unchecked") + public SWGSet getGuildList() { + return (SWGSet) getBaseline(3).get("guildList"); } + @SuppressWarnings("unchecked") public SWGMap getCurrentServerGCWZonePercentMap() { - return currentServerGCWZonePercentMap; + return (SWGMap) getBaseline(6).get("currentServerGCWZonePercentMap"); } + @SuppressWarnings("unchecked") public SWGMap getCurrentServerGCWTotalPercentMap() { - return currentServerGCWTotalPercentMap; + return (SWGMap) getBaseline(6).get("currentServerGCWTotalPercentMap"); } + @SuppressWarnings("unchecked") public SWGMultiMap getCurrentServerGCWZoneHistoryMap() { - return currentServerGCWZoneHistoryMap; + return (SWGMultiMap) getBaseline(6).get("currentServerGCWZoneHistoryMap"); } + @SuppressWarnings("unchecked") public SWGMultiMap getCurrentServerGCWTotalHistoryMap() { - return currentServerGCWTotalHistoryMap; + return (SWGMultiMap) getBaseline(6).get("currentServerGCWTotalHistoryMap"); } + @SuppressWarnings("unchecked") public SWGMultiMap getOtherServerGCWZonePercentMap() { - return otherServerGCWZonePercentMap; + return (SWGMultiMap) getBaseline(6).get("otherServerGCWZonePercentMap"); } + @SuppressWarnings("unchecked") public SWGMultiMap getOtherServerGCWTotalPercentMap() { - return otherServerGCWTotalPercentMap; - } - - public int getUnknown3() { - synchronized(objectMutex) { - return unknown3; - } - } - - public void setUnknown3(int unknown3) { - synchronized(objectMutex) { - this.unknown3 = unknown3; - } - - notifyAll(messageBuilder.buildUnknown3(unknown3)); + return (SWGMultiMap) getBaseline(6).get("otherServerGCWTotalPercentMap"); } + @SuppressWarnings("unchecked") public Map> getZoneMap() { - synchronized(objectMutex) { - return zoneMap; - } + return (Map>) otherVariables.get("zoneMap"); } + @SuppressWarnings("unchecked") public Map getServerFirst() { - synchronized(objectMutex) { - return serverFirst; - } + return (Map) otherVariables.get("serverFirst"); } public boolean addServerFirst(String collectionName, ServerFirst player) { synchronized(objectMutex) { - if (!serverFirst.containsKey(collectionName)) { - serverFirst.put(collectionName, player); + if (!getServerFirst().containsKey(collectionName)) { + getServerFirst().put(collectionName, player); return true; } @@ -292,74 +150,40 @@ public class GuildObject extends UniverseObject implements Serializable { } } - public synchronized long getNextInstanceId() { - long ret = nextInstanceId; - nextInstanceId++; - return ret; + public long getNextInstanceId() { + synchronized(objectMutex) { + otherVariables.set("nextInstanceId", (long) (((long) otherVariables.get("nextInstanceId")) + 1L)); + return (long) otherVariables.get("nextInstanceId"); + } + } + + @Override + public void notifyClients(IoBuffer buffer, boolean notifySelf) { + notifyObservers(buffer, false); + } + + @Override + public ObjectMessageBuilder getMessageBuilder() { + synchronized(objectMutex) { + if (messageBuilder == null) { + messageBuilder = new GuildMessageBuilder(this); + } + + return messageBuilder; + } } @Override public void sendBaselines(Client destination) { - destination.getSession().write(messageBuilder.buildBaseline3()); - destination.getSession().write(messageBuilder.buildBaseline6()); - } - - private void notifyAll(IoBuffer buffer) { - synchronized(core.getActiveConnectionsMap()) { - for (Client client : core.getActiveConnectionsMap().values()) { - client.getSession().write(buffer); - } + if (destination != null && destination.getSession() != null) { + destination.getSession().write(getBaseline(3).getBaseline()); + destination.getSession().write(getBaseline(6).getBaseline()); } } - public ObjectMessageBuilder getMessageBuilder() { - return messageBuilder; - } - @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - - switch (viewType) { - case 3: - { - switch (updateType) { - case 4: - { - buffer = messageBuilder.createDelta("GILD", (byte) 3, (short) 1, (short) 4, buffer.flip(), buffer.array().length + 4); - - for (Client client : core.getActiveConnectionsMap().values()) { - client.getSession().write(buffer); - } - - break; - } - } - } - case 6: - { - switch (updateType) { - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - { - buffer = messageBuilder.createDelta("GILD", (byte) 6, (short) 1, (short) updateType, buffer.flip(), buffer.array().length + 4); - - for (Client client : core.getActiveConnectionsMap().values()) { - client.getSession().write(buffer); - } - - break; - } - default: - { - return; - } - } - } - } + notifyClients(getBaseline(viewType).createDelta(updateType, buffer.array()), false); } } diff --git a/src/resources/objects/harvester/HarvesterMessageBuilder.java b/src/resources/objects/harvester/HarvesterMessageBuilder.java index bf3422cb..81372b07 100644 --- a/src/resources/objects/harvester/HarvesterMessageBuilder.java +++ b/src/resources/objects/harvester/HarvesterMessageBuilder.java @@ -168,9 +168,9 @@ public class HarvesterMessageBuilder extends TangibleMessageBuilder { Vector outputHopperContent = harvester.getOutputHopperContent(); int hopperContentSize = outputHopperContent.size(); - int iHopperList = 1; + //int iHopperList = 1; if (hopperContentSize==0) { - iHopperList = 0; + //iHopperList = 0; } //int sizeP = 30 + 15*hopperContentSize; int sizeP = 30-2-4-4; @@ -195,12 +195,12 @@ public class HarvesterMessageBuilder extends TangibleMessageBuilder { // buffer.putInt(iHopperList); // buffer.putInt(harvester.getResourceUpdateCount()); int sumOfHopper = 0; - int i = 0; + //int i = 0; sumOfHopper = 0; Vector outputHopper = harvester.getOutputHopperContent(); for (ResourceContainerObject cont : outputHopper){ sumOfHopper += cont.getStackCount(); - i++; + //i++; } buffer.putShort((short)0x0A); @@ -432,9 +432,9 @@ public class HarvesterMessageBuilder extends TangibleMessageBuilder { public IoBuffer buildHINO7ActivateDelta2(HarvesterObject harvester) { - int iHopperList = 0; + //int iHopperList = 0; if (harvester.getOutputHopperContent().size() >= 1) { - iHopperList = 1; + //iHopperList = 1; } IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); @@ -463,9 +463,9 @@ public class HarvesterMessageBuilder extends TangibleMessageBuilder { public IoBuffer buildHINO7ActivateDelta2old(HarvesterObject harvester) { - int iHopperList = 0; + //int iHopperList = 0; if (harvester.getOutputHopperContent().size() >= 1) { - iHopperList = 1; + //iHopperList = 1; } IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); diff --git a/src/resources/objects/harvester/HarvesterObject.java b/src/resources/objects/harvester/HarvesterObject.java index d53eb991..50f87e23 100644 --- a/src/resources/objects/harvester/HarvesterObject.java +++ b/src/resources/objects/harvester/HarvesterObject.java @@ -118,8 +118,8 @@ public class HarvesterObject extends InstallationObject implements Serializable private int specRate; - public HarvesterObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ - super(objectID, planet, template, position, orientation); + public HarvesterObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { + super(objectID, planet, position, orientation, template); this.setConditionDamage(100); messageBuilder = new HarvesterMessageBuilder(this); installationMessageBuilder = new InstallationMessageBuilder((InstallationObject)this); diff --git a/src/resources/objects/installation/InstallationMessageBuilder.java b/src/resources/objects/installation/InstallationMessageBuilder.java index 8b67f8d3..d2b1f80c 100644 --- a/src/resources/objects/installation/InstallationMessageBuilder.java +++ b/src/resources/objects/installation/InstallationMessageBuilder.java @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.mina.core.buffer.IoBuffer; import engine.resources.objects.Builder; -import resources.objects.harvester.HarvesterObject; import resources.objects.tangible.TangibleMessageBuilder; public class InstallationMessageBuilder extends TangibleMessageBuilder{ @@ -174,8 +173,8 @@ public class InstallationMessageBuilder extends TangibleMessageBuilder{ public IoBuffer constructINSO7Var1(InstallationObject installationObject,long selectedResource) { IoBuffer buffer = bufferPool.allocate(10, false).order(ByteOrder.LITTLE_ENDIAN); - int hopperContentsSize = ((HarvesterObject)installationObject).getOutputHopperContent().size()+1; - byte updateCounter = ((HarvesterObject)installationObject).getUpdateCount(); + //int hopperContentsSize = ((HarvesterObject)installationObject).getOutputHopperContent().size()+1; + //byte updateCounter = ((HarvesterObject)installationObject).getUpdateCount(); buffer.setAutoExpand(true); buffer.putShort((short)2); // buffer.putShort((short)updateCounter); diff --git a/src/resources/objects/installation/InstallationObject.java b/src/resources/objects/installation/InstallationObject.java index c6269dc3..b9cc98d6 100644 --- a/src/resources/objects/installation/InstallationObject.java +++ b/src/resources/objects/installation/InstallationObject.java @@ -39,8 +39,8 @@ public class InstallationObject extends TangibleObject implements Serializable { private static final long serialVersionUID = 1L; private transient InstallationMessageBuilder messageBuilder; - public InstallationObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ - super(objectID, planet, template, position, orientation); + public InstallationObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { + super(objectID, planet, position, orientation, template); messageBuilder = new InstallationMessageBuilder(this); } diff --git a/src/resources/objects/intangible/IntangibleObject.java b/src/resources/objects/intangible/IntangibleObject.java index 0e1d788f..df6843b3 100644 --- a/src/resources/objects/intangible/IntangibleObject.java +++ b/src/resources/objects/intangible/IntangibleObject.java @@ -41,7 +41,6 @@ public class IntangibleObject extends SWGObject implements Serializable { public IntangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, position, orientation, Template); - messageBuilder = new IntangibleMessageBuilder(this); } public IntangibleObject() { @@ -50,7 +49,6 @@ public class IntangibleObject extends SWGObject implements Serializable { public void initAfterDBLoad() { super.init(); - messageBuilder = new IntangibleMessageBuilder(this); } public Baseline getOtherVariables() { diff --git a/src/resources/objects/resource/GalacticResource.java b/src/resources/objects/resource/GalacticResource.java index e8141781..eff19d01 100644 --- a/src/resources/objects/resource/GalacticResource.java +++ b/src/resources/objects/resource/GalacticResource.java @@ -231,7 +231,7 @@ public class GalacticResource extends SWGObject implements Serializable { public void generateResourceStats(){ // Generate the stats randomly, considering the caps for (int k=0;k0) randomStatValue = (short) (resourceRoot.getResourceMinCaps()[k] + new Random().nextInt(resourceRoot.getResourceMaxCaps()[k]-resourceRoot.getResourceMinCaps()[k])); diff --git a/src/resources/objects/resource/ResourceContainerObject.java b/src/resources/objects/resource/ResourceContainerObject.java index 66ac4a80..aef9ce0e 100644 --- a/src/resources/objects/resource/ResourceContainerObject.java +++ b/src/resources/objects/resource/ResourceContainerObject.java @@ -144,8 +144,8 @@ public class ResourceContainerObject extends TangibleObject implements Serializa } - public ResourceContainerObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ - super(objectID, planet, template, position, orientation); + public ResourceContainerObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template){ + super(objectID, planet, position, orientation, template); messageBuilder = new ResourceContainerMessageBuilder(this); this.setAttachment("radial_filename", "resourceContainer"); } diff --git a/src/resources/objects/ship/ShipObject.java b/src/resources/objects/ship/ShipObject.java index 67d27246..faeac78c 100644 --- a/src/resources/objects/ship/ShipObject.java +++ b/src/resources/objects/ship/ShipObject.java @@ -23,15 +23,13 @@ package resources.objects.ship; import java.io.Serializable; -import com.sleepycat.persist.model.Persistent; - import resources.objects.ObjectMessageBuilder; import resources.objects.tangible.TangibleObject; -@Persistent(version=0) public class ShipObject extends TangibleObject implements Serializable { private static final long serialVersionUID = 1L; + private transient ObjectMessageBuilder messageBuilder = null; @Override diff --git a/src/resources/objects/staticobject/StaticMessageBuilder.java b/src/resources/objects/staticobject/StaticMessageBuilder.java index ffcfe443..c412a78d 100644 --- a/src/resources/objects/staticobject/StaticMessageBuilder.java +++ b/src/resources/objects/staticobject/StaticMessageBuilder.java @@ -21,11 +21,8 @@ ******************************************************************************/ package resources.objects.staticobject; -import java.nio.ByteOrder; import java.util.Map; -import org.apache.mina.core.buffer.IoBuffer; - import resources.objects.ObjectMessageBuilder; import engine.resources.objects.Builder; @@ -39,52 +36,6 @@ public class StaticMessageBuilder extends ObjectMessageBuilder { super(); } - public IoBuffer buildBaseline3() { - - IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - - buffer.putShort((short) 4); - buffer.putInt(0); - //buffer.putShort((short) 0); - - buffer.put(getAsciiString(object.getStfFilename())); - buffer.putInt(0); - //buffer.putShort((short) 0); - buffer.put(getAsciiString(object.getStfName())); - buffer.putInt(0); - buffer.putInt(0xFF); - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - - buffer.flip(); - buffer = createBaseline("STAO", (byte) 3, buffer, size); - - return buffer; - } - - public IoBuffer buildBaseline6() { - - IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - buffer.putShort((short) 2); - buffer.putInt(0x43); - //buffer.putShort((short) 0); - buffer.put(getAsciiString(object.getDetailFilename())); - buffer.putInt(0); - buffer.put(getAsciiString(object.getDetailName())); - // buffer.putShort((short) 0); - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - - buffer.flip(); - buffer = createBaseline("STAO", (byte) 6, buffer, size); - - return buffer; - } - @Override public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { super.buildBaseline3(baselineBuilders, deltaBuilders); diff --git a/src/resources/objects/staticobject/StaticObject.java b/src/resources/objects/staticobject/StaticObject.java index d116f7cb..1131aafd 100644 --- a/src/resources/objects/staticobject/StaticObject.java +++ b/src/resources/objects/staticobject/StaticObject.java @@ -25,57 +25,79 @@ import java.io.Serializable; import org.apache.mina.core.buffer.IoBuffer; -import resources.objects.ObjectMessageBuilder; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - import engine.clients.Client; +import engine.resources.objects.Baseline; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=0) public class StaticObject extends SWGObject implements Serializable { private static final long serialVersionUID = 1L; - @NotPersistent + private transient StaticMessageBuilder messageBuilder; - - public StaticObject() { - super(); - messageBuilder = new StaticMessageBuilder(this); - } - + public StaticObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, position, orientation, Template); - messageBuilder = new StaticMessageBuilder(this); } - - @Override - public void sendBaselines(Client destination) { - - - if(destination == null || destination.getSession() == null) { - System.out.println("NULL destination"); - return; - } - - //destination.getSession().write(messageBuilder.buildBaseline3()); - //destination.getSession().write(messageBuilder.buildBaseline6()); - - + + public StaticObject() { + super(); } @Override public void initAfterDBLoad() { super.init(); - messageBuilder = new StaticMessageBuilder(this); } - public ObjectMessageBuilder getMessageBuilder() { - return messageBuilder; + @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(getBaseline(3).getBaseline()); + destination.getSession().write(getBaseline(6).getBaseline()); + + Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient()); + + if (parent != null && destination == parent) { + destination.getSession().write(getBaseline(8).getBaseline()); + destination.getSession().write(getBaseline(9).getBaseline()); + } + } } @Override diff --git a/src/resources/objects/tangible/TangibleMessageBuilder.java b/src/resources/objects/tangible/TangibleMessageBuilder.java index befaeddf..b6f4e4b8 100644 --- a/src/resources/objects/tangible/TangibleMessageBuilder.java +++ b/src/resources/objects/tangible/TangibleMessageBuilder.java @@ -21,11 +21,8 @@ ******************************************************************************/ package resources.objects.tangible; -import java.nio.ByteOrder; import java.util.Map; -import org.apache.mina.core.buffer.IoBuffer; - import resources.objects.ObjectMessageBuilder; import engine.resources.objects.Builder; @@ -39,177 +36,6 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { super(); } - public IoBuffer buildBaseline3() { - TangibleObject tangible = (TangibleObject) object; - IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - - buffer.putShort((short) 0x0D); - buffer.putFloat(object.getComplexity()); - buffer.put(getAsciiString(object.getStfFilename())); - buffer.putInt(0); - buffer.put(getAsciiString(object.getStfName())); - - if(object.getCustomName() == null || object.getCustomName().length() < 1) - buffer.putInt(0); - else - buffer.put(getUnicodeString(object.getCustomName())); - buffer.putInt(object.getVolume()); - buffer.putInt(0); - buffer.putInt(tangible.getFactionStatus()); // faction vars - - if(tangible.getCustomization() == null || tangible.getCustomization().length <= 0) - buffer.putShort((short) 0); - else { - buffer.putShort((short) tangible.getCustomization().length); - buffer.put(tangible.getCustomization()); - } - - buffer.putInt(0); - buffer.putInt(0); - - //buffer.putInt(0); - if(tangible.getOptionsBitmask() == 0) - tangible.setOptionsBitmask(0x100); - buffer.putInt(tangible.getOptionsBitmask()); - buffer.putInt(tangible.getUses()); // number of item uses - buffer.putInt(tangible.getConditionDamage()); - buffer.putInt(tangible.getMaxDamage()); - buffer.put((byte) (tangible.isStaticObject() ? 1 : 0)); - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - - buffer.flip(); - buffer = createBaseline("TANO", (byte) 3, buffer, size); - - return buffer; - } - - public IoBuffer buildBaseline6() { - TangibleObject tangible = (TangibleObject) object; - IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - buffer.putShort((short) 8); - buffer.putInt(0x43); - buffer.put(getAsciiString(tangible.getDetailFilename())); - buffer.putInt(0); - buffer.put(getAsciiString(tangible.getDetailName())); - buffer.putLong(0); - buffer.putLong(0); - buffer.putLong(0); // unks - buffer.putLong(0); - buffer.putInt(0); - buffer.put((byte) 0); - - int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - - buffer.flip(); - buffer = createBaseline("TANO", (byte) 6, buffer, size); - - return buffer; - } - - public IoBuffer buildBaseline8() { - IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putShort((short) 0); - int size = buffer.position(); - buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size); - buffer.flip(); - buffer = createBaseline("TANO", (byte) 8, buffer, size); - - return buffer; - } - - public IoBuffer buildBaseline9() { - IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putShort((short) 0); - int size = buffer.position(); - buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size); - buffer.flip(); - buffer = createBaseline("TANO", (byte) 9, buffer, size); - - return buffer; - } - - public IoBuffer buildConditionDamageDelta(int conditionDamage) { - - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(conditionDamage); - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("TANO", (byte) 3, (short) 1, (short) 0x0A, buffer, size + 4); - - return buffer; - - } - - 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; - - } - - public IoBuffer buildCustomizationDelta(byte[] customization) { - IoBuffer buffer = bufferPool.allocate(customization.length + 2, false).order(ByteOrder.LITTLE_ENDIAN); - - buffer.putShort((short) customization.length); - buffer.put(customization); - - int size = buffer.position(); - buffer.flip(); - buffer = createDelta("TANO", (byte) 3, (short) 1, (short) 6, buffer, size + 4); - return buffer; - } - - public IoBuffer buildDelta3() { - IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - buffer.putShort((short)5); - buffer.putInt(0x12862153); - buffer.putLong(getObject().getObjectID()); - buffer.putInt(0x54414E4F); - buffer.put((byte)3); - buffer.putInt(8);//buffer.putInt(8+6); - - buffer.putShort((short) 2); - buffer.putShort((short)8); - buffer.put((byte)0); - buffer.putShort((short) 0x21); - buffer.put((byte)0); - -// buffer.putShort((short) 0); -// buffer.putFloat(4.0F); - - int size = buffer.position(); - buffer.flip(); - return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); - } - - public IoBuffer buildAssemblyDelta3() { - IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - buffer.putShort((short)5); - buffer.putInt(0x12862153); - buffer.putLong(getObject().getObjectID()); - buffer.putInt(0x54414E4F); - buffer.put((byte)3); - buffer.putInt(8);//buffer.putInt(8+6); - - buffer.putShort((short) 1); - buffer.putShort((short)0x0B); - buffer.putInt(0x000003E8); // ? - - int size = buffer.position(); - buffer.flip(); - return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); - } - @Override public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { super.buildBaseline3(baselineBuilders, deltaBuilders); diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 9da87652..621e6c16 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -45,213 +45,316 @@ import resources.datatables.Options; import resources.datatables.PvpStatus; import resources.loot.LootGroup; import resources.objects.ObjectMessageBuilder; +import resources.objects.SWGList; +import resources.objects.SWGSet; import resources.objects.creature.CreatureObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.IDManagerVisitor; import engine.clients.Client; +import engine.resources.common.CRC; import engine.resources.common.RGB; +import engine.resources.objects.Baseline; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=12) +@SuppressWarnings("unchecked") public class TangibleObject extends SWGObject implements Serializable { private static final long serialVersionUID = 1L; - // TODO: Thread safety - protected int incapTimer = 10; - private int conditionDamage = 0; - protected int pvpBitmask = 0; - protected byte[] customization; - private List componentCustomizations = new ArrayList(); - private Map customizationVariables = new HashMap(); - protected int optionsBitmask = 0; - private int uses = 0; - private int maxDamage = 1000; - private boolean staticObject = true; - protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason - protected int factionStatus = 0; - @NotPersistent - protected transient Vector defendersList = new Vector(); // unused in packets but useful for the server - @NotPersistent private transient TangibleMessageBuilder messageBuilder; + private Map customizationVariables = new HashMap(); + + protected transient Vector defendersList = new Vector(); + + private transient int pvpBitmask = 0; + //private TreeSet> lootSpecification = new TreeSet>(); private transient List lootGroups = new ArrayList(); - - @NotPersistent - private transient boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart - @NotPersistent + private transient boolean looted = false; private transient boolean lootLock = false; - @NotPersistent private transient boolean creditRelieved = false; - @NotPersistent private transient boolean lootItem = false; - - private boolean stackable = false; - private int stackCount = 1; - private boolean noSell = false; - private byte junkType = -1; - private int junkDealerPrice = 0; - - private String serialNumber; - - @NotPersistent private transient TangibleObject killer = null; + public TangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { + super(objectID, planet, position, orientation, template); + if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1); + getBaseline(3).set("volume", 1); + } + public TangibleObject(long objectID, Planet planet, String template) { super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); - messageBuilder = new TangibleMessageBuilder(this); - if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1); - } - - public TangibleObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { - super(objectID, planet, position, orientation, template); - messageBuilder = new TangibleMessageBuilder(this); if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1); + getBaseline(3).set("volume", 1); } public TangibleObject() { super(); - messageBuilder = new TangibleMessageBuilder(this); } - @Override public void initAfterDBLoad() { super.init(); defendersList = new Vector(); - messageBuilder = new TangibleMessageBuilder(this); } - @Deprecated - public void setCustomName2(String customName) { - setCustomName(customName); - System.err.println("setCustomName2 is now deprecated - please use setCustomName"); - } - - public int getIncapTimer() { - return incapTimer; - } - - public void setIncapTimer(int incapTimer) { - this.incapTimer = incapTimer; + public Baseline getOtherVariables() { + Baseline baseline = super.getOtherVariables(); + baseline.put("stackable", false); + baseline.put("noSell", false); + baseline.put("junkType", (byte) -1); + baseline.put("junkDealerPrice", 0); + return baseline; } - public int getUses() { - return uses; + public Baseline getBaseline3() { + Baseline baseline = super.getBaseline3(); + baseline.put("faction", 0); + baseline.put("factionStatus", 0); + baseline.put("customization", new byte[] { }); + baseline.put("componentCustomizations", new SWGList(this, 3, 7, false)); + baseline.put("optionsBitmask", 0); + baseline.put("uses", 0); + baseline.put("conditionDamage", 0); + baseline.put("maximumCondition", 100); + baseline.put("staticObject", false); + return baseline; } - public void setUses(int uses) { - this.uses = uses; - setIntAttribute("uses", uses); + public Baseline getBaseline6() { + Baseline baseline = super.getBaseline6(); + baseline.put("inCombat", false); + baseline.put("defendersList", new SWGSet(this, 6, 3, false)); + baseline.put("4", 0); + baseline.put("5", new SWGList(this, 6, 5, false)); + baseline.put("6", new SWGList(this, 6, 6, false)); + baseline.put("7", (long) 0); // Unknown List (HUGE structure inside) + return baseline; } - - public synchronized int getConditionDamage() { - return conditionDamage; + + @Override + public Baseline getBaseline8() { + Baseline baseline = super.getBaseline8(); + return baseline; } - - public synchronized void setConditionDamage(int conditionDamage) { - if(conditionDamage < 0) - conditionDamage = 0; - else if(conditionDamage > getMaxDamage()) - conditionDamage = getMaxDamage(); - this.conditionDamage = conditionDamage; - notifyObservers(messageBuilder.buildConditionDamageDelta(conditionDamage), true); - if (maxDamage > 0) { - this.setStringAttribute("condition", (maxDamage + "/" + (maxDamage - conditionDamage))); - } + + @Override + public Baseline getBaseline9() { + Baseline baseline = super.getBaseline9(); + return baseline; } - + + public String getFaction() { + return NGECore.getInstance().factionService.getName((int) getBaseline(3).get("faction")); + } + + public void setFaction(String faction) { + notifyClients(getBaseline(3).set("faction", CRC.StringtoCRC(faction)), true); + updatePvpStatus(); + } + + public int getFactionStatus() { + return (int) getBaseline(3).get("factionStatus"); + } + + public void setFactionStatus(int factionStatus) { + notifyClients(getBaseline(3).set("factionStatus", factionStatus), true); + } + public byte[] getCustomization() { - return customization; + return (byte[]) getBaseline(3).get("customization"); } - + public void setCustomization(byte[] customization) { - synchronized(objectMutex) { - this.customization = customization; + notifyClients(getBaseline(3).set("customization", customization), true); + } + + public SWGList getComponentCustomizations() { + return (SWGList) getBaseline(3).get("componentCustomizations"); + } + + public void setComponentCustomizations(List componentCustomizations) { + getComponentCustomizations().addAll(componentCustomizations); + } + + public Byte getCustomizationVariable(String type) { + if (customizationVariables.containsKey(type)) { + return customizationVariables.get(type); + } else { + System.err.println("Error: object doesn't have customization variable " + type); } - notifyObservers(messageBuilder.buildCustomizationDelta(customization), true); + return null; } - - public List getComponentCustomizations() { - return componentCustomizations; + + public void setCustomizationVariable(String type, byte value) { + if (customizationVariables.containsKey(type)) { + customizationVariables.replace(type, value); + } else { + customizationVariables.put(type, value); + } + + setCustomization(getCustomizationBytes()); } - - public void setComponentCustomizations(List componentCustomizations) { - this.componentCustomizations = componentCustomizations; + + public void removeCustomizationVariable(String type) { + if (customizationVariables.containsKey(type)) { + customizationVariables.remove(type); + setCustomization(getCustomizationBytes()); + } } - + + private byte[] getCustomizationBytes() { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + + try { + IDManagerVisitor visitor = ClientFileManager.loadFile("customization/customization_id_manager.iff", IDManagerVisitor.class); + + stream.write((byte) 0x02); // Unk + stream.write((byte) customizationVariables.size()); // Number of customization attributes + + for (String type : customizationVariables.keySet()) { + stream.write(visitor.getAttributeIndex(type)); // Index of palette type within "customization/customization_id_manager.iff" + stream.write(customizationVariables.get(type)); // Value/Index within palette + + // Seperator/Footer + stream.write((byte) 0xC3); + stream.write((byte) 0xBF); + stream.write((byte) 0x03); + } + + return stream.toByteArray(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + public int getOptionsBitmask() { - return optionsBitmask; + return (int) getBaseline(3).get("optionsBitmask"); } - + public void setOptionsBitmask(int optionsBitmask) { - this.optionsBitmask = optionsBitmask; + notifyClients(getBaseline(3).set("optionsBitmask", optionsBitmask), true); } public void setOptions(int options, boolean add) { - synchronized(objectMutex) { - if (options != 0) { - if (add) { - addOption(options); - } else { - removeOption(options); - } + if (options != 0) { + if (add) { + setOptionsBitmask(getOptionsBitmask() | options); + } else { + setOptionsBitmask(getOptionsBitmask() & ~options);; } } } public boolean getOption(int option) { - synchronized(objectMutex) { - return ((optionsBitmask & option) == option); + return ((getOptionsBitmask() & option) == option); + } + + public int getUses() { + return (int) getBaseline(3).get("uses"); + } + + public void setUses(int uses) { + notifyClients(getBaseline(3).set("uses", uses), true); + setIntAttribute("uses", uses); + } + + public int getIncapTimer() { + return getUses(); + } + + public void setIncapTimer(int incapTimer) { + notifyClients(getBaseline(3).set("uses", incapTimer), true); + } + + public int getConditionDamage() { + return (int) getBaseline(3).get("conditionDamage"); + } + + public void setConditionDamage(int conditionDamage) { + int maximumCondition = getMaximumCondition(); + + if (conditionDamage < 0) { + conditionDamage = 0; + } else if (conditionDamage > maximumCondition) { + conditionDamage = maximumCondition; + } + + notifyClients(getBaseline(3).set("conditionDamage", conditionDamage), true); + + if (getMaximumCondition() > 0) { + setStringAttribute("condition", (maximumCondition + "/" + (maximumCondition - conditionDamage))); } } - public void addOption(int option) { - setOptionsBitmask(getOptionsBitmask() | option); + public int getMaximumCondition() { + return (int) getBaseline(3).get("maximumCondition"); } - public void removeOption(int option) { - setOptionsBitmask(getOptionsBitmask() & ~option); + public void setMaximumCondition(int maximumCondition) { + notifyClients(getBaseline(3).set("maximumCondition", maximumCondition), true); + setStringAttribute("condition", (maximumCondition + "/" + (maximumCondition - getConditionDamage()))); } - public int getMaxDamage() { - return maxDamage; - } - - public void setMaxDamage(int maxDamage) { - this.maxDamage = maxDamage; - - this.setStringAttribute("condition", (maxDamage + "/" + (maxDamage - conditionDamage))); - } - public boolean isStaticObject() { - return staticObject; - } - - public void setStaticObject(boolean staticObject) { - this.staticObject = staticObject; + return (boolean) getBaseline(3).get("staticObject"); } - public int getPvPBitmask() { + public void setStaticObject(boolean staticObject) { + notifyClients(getBaseline(3).set("staticObject", staticObject), true); + } + + public boolean isInCombat() { + return (boolean) getBaseline(6).get("inCombat"); + } + + public void setInCombat(boolean inCombat) { + notifyClients(getBaseline(6).set("inCombat", inCombat), true); + } + + // All objects can be in combat (terminal mission flag bases, tutorial target box) + + public List getDefendersList() { + synchronized(objectMutex) { + return defendersList; + } + } + + public void addDefender(TangibleObject defender) { + defendersList.add(defender); + + if (!isInCombat()) { + setInCombat(true); + } + } + + public void removeDefender(TangibleObject defender) { + defendersList.remove(defender); + + if (defendersList.isEmpty() && isInCombat()) { + setInCombat(false); + } + } + + public int getPvpBitmask() { synchronized(objectMutex) { return pvpBitmask; } } - - public void setPvPBitmask(int pvpBitmask) { + + public void setPvpBitmask(int pvpBitmask) { synchronized(objectMutex) { this.pvpBitmask = pvpBitmask; } } + public boolean getPvpStatus(int pvpStatus) { synchronized(objectMutex) { return ((pvpBitmask & pvpStatus) != 0); @@ -268,8 +371,6 @@ public class TangibleObject extends SWGObject implements Serializable { } } } - - //updatePvpStatus(); } public void updatePvpStatus() { @@ -295,162 +396,9 @@ public class TangibleObject extends SWGObject implements Serializable { } } - public Byte getCustomizationVariable(String type) - { - if(customizationVariables.containsKey(type)) return customizationVariables.get(type); - System.err.println("Error: object doesn't have customization variable " + type); - return null; - } - - public void setCustomizationVariable(String type, byte value) - { - if(customizationVariables.containsKey(type)) customizationVariables.replace(type, value); - else customizationVariables.put(type, value); - - byte[] customizationBytes = getCustomizationBytes(); - customization = customizationBytes; - notifyObservers(messageBuilder.buildCustomizationDelta(customizationBytes), true); - } - - public void removeCustomizationVariable(String type) - { - if(customizationVariables.containsKey(type)) - { - customizationVariables.remove(type); - byte[] customizationBytes = getCustomizationBytes(); - customization = customizationBytes; - notifyObservers(messageBuilder.buildCustomizationDelta(customizationBytes), true); - } - } - - private byte[] getCustomizationBytes() - { - //if(customizationVariables.size() == 0) customization = { 0x00 }; - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - try - { - IDManagerVisitor visitor = ClientFileManager.loadFile("customization/customization_id_manager.iff", IDManagerVisitor.class); - - stream.write((byte)0x02); // Unk - stream.write((byte)customizationVariables.size()); // Number of customization attributes - - for(String type : customizationVariables.keySet()) - { - stream.write(visitor.getAttributeIndex(type)); // Index of palette type within "customization/customization_id_manager.iff" - stream.write(customizationVariables.get(type)); // Value/Index within palette - - // Seperator/Footer - stream.write((byte) 0xC3); - stream.write((byte) 0xBF); - stream.write((byte) 0x03); - } - return stream.toByteArray(); - } - catch (Exception e) { e.printStackTrace(); } - return null; - } - - public String getFaction() { - synchronized(objectMutex) { - return faction; - } - } - - public void setFaction(String faction) { - synchronized(objectMutex) { - this.faction = faction; - } - - updatePvpStatus(); - } - - public int getFactionStatus() { - synchronized(objectMutex) { - return factionStatus; - } - } - - public void setFactionStatus(int factionStatus) { - synchronized(objectMutex) { - this.factionStatus = factionStatus; - } - } - - public Vector getDefendersList() { - synchronized(objectMutex) { - return defendersList; - } - } - - public void addDefender(TangibleObject defender) { - - defendersList.add(defender); - - if(this instanceof CreatureObject) { - CreatureObject creature = (CreatureObject) this; - - if(creature.getCombatFlag() == 0) - creature.setCombatFlag((byte) 1); - } - - } - - public void removeDefender(TangibleObject defender) { - - defendersList.remove(defender); - - if(this instanceof CreatureObject) { - CreatureObject creature = (CreatureObject) this; - - if(creature.getCombatFlag() == 1 && defendersList.isEmpty()) - creature.setCombatFlag((byte) 0); - } - - } - public boolean isAttackableBy(CreatureObject attacker) { int pvpStatus = NGECore.getInstance().factionService.calculatePvpStatus(attacker, this); return (((pvpStatus & PvpStatus.Attackable) == PvpStatus.Attackable) || ((pvpStatus & PvpStatus.Aggressive) == PvpStatus.Aggressive)); - - /* - CreatureObject creature; - - if(this instanceof CreatureObject) { - creature = (CreatureObject) this; - if(creature.getDuelList().contains(attacker) && attacker.getDuelList().contains(this)) - return true; - } - - if(faction.equals("rebel") && attacker.getFaction().equals("rebel")) - return false; - else if(faction.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((faction.equals("rebel") || faction.equals("imperial")) && attacker.getFactionStatus() >= 1) - return true; - else if((faction.equals("rebel") || faction.equals("imperial")) && attacker.getFactionStatus() == 0) - return false; - - return getPvPBitmask() == 1 || getPvPBitmask() == 2; - - } else if(attacker.getSlottedObject("ghost") == null) - return true; - - return getPvPBitmask() == 1 || getPvPBitmask() == 2; - */ } public void showFlyText(OutOfBand outOfBand, float scale, RGB color, int displayType, boolean notifyObservers) { @@ -491,6 +439,15 @@ public class TangibleObject extends SWGObject implements Serializable { notifyObservers(new StopClientEffectObjectByLabel(getObjectID(), commandString), true); } + public String getSerialNumber() { + return getStringAttribute("serial_number"); + } + + public void setSerialNumber(String serialNumber) { + setStringAttribute("serial_number", serialNumber); + setOptions(Options.SERIAL, true); + } + public TangibleObject getKiller() { synchronized(objectMutex) { return killer; @@ -504,167 +461,208 @@ public class TangibleObject extends SWGObject implements Serializable { } public List getLootGroups() { - return lootGroups; + synchronized(objectMutex) { + return lootGroups; + } } public void setLootGroups(List lootGroups) { - this.lootGroups = lootGroups; + synchronized(objectMutex) { + this.lootGroups = lootGroups; + } } public void addToLootGroups(String[] lootPoolNames, double[] lootPoolChances, double lootGroupChance) { - //System.out.println("lootPoolNames[0] " + lootPoolNames[0]); - LootGroup lootGroup = new LootGroup(lootPoolNames, lootPoolChances, lootGroupChance); - this.lootGroups.add(lootGroup); + synchronized(objectMutex) { + //System.out.println("lootPoolNames[0] " + lootPoolNames[0]); + LootGroup lootGroup = new LootGroup(lootPoolNames, lootPoolChances, lootGroupChance); + lootGroups.add(lootGroup); + } } public void addToLootGroups(LootGroup lootGroup) { - this.lootGroups.add(lootGroup); + synchronized(objectMutex) { + lootGroups.add(lootGroup); + } } - public boolean isLooted() { - return looted; + synchronized(objectMutex) { + return looted; + } } - + public void setLooted(boolean looted) { - this.looted = looted; + synchronized(objectMutex) { + this.looted = looted; + } } public boolean isLootLock() { - return lootLock; + synchronized(objectMutex) { + return lootLock; + } } - + public void setLootLock(boolean lootLock) { - this.lootLock = lootLock; + synchronized(objectMutex) { + this.lootLock = lootLock; + } } public boolean isLootItem() { - return lootItem; + synchronized(objectMutex) { + return lootItem; + } } - + public void setLootItem(boolean lootItem) { - this.lootItem = lootItem; + synchronized(objectMutex) { + this.lootItem = lootItem; + } } public boolean isStackable() { - return stackable; - } - - public void setStackable(boolean stackable) { - this.stackable = stackable; + return (boolean) otherVariables.get("stackable"); } - public int getStackCount() { - return stackCount; - } - - public void setStackCount(int stackCount) { - this.stackCount = stackCount; + public void setStackable(boolean stackable) { + otherVariables.set("stackable", stackable); } public boolean isNoSell() { - return noSell; + return (boolean) otherVariables.get("noSell"); } - + public void setNoSell(boolean noSell) { - this.noSell = noSell; + otherVariables.set("noSell", noSell); } public byte getJunkType() { - return junkType; + return (byte) otherVariables.get("junkType"); } - + public void setJunkType(byte junkType) { - this.junkType = junkType; + otherVariables.set("junkType", junkType); } - + public int getJunkDealerPrice() { - return junkDealerPrice; + return (int) otherVariables.get("junkDealerPrice"); } - + public void setJunkDealerPrice(int junkDealerPrice) { - this.junkDealerPrice = junkDealerPrice; + otherVariables.set("junkDealerPrice", junkDealerPrice); } public boolean isCreditRelieved() { - return creditRelieved; + synchronized(objectMutex) { + return creditRelieved; + } } - + public void setCreditRelieved(boolean creditRelieved) { - if (creditRelieved) - this.creditRelieved = creditRelieved; // only allow one state change to prevent hacking + synchronized(objectMutex) { + if (creditRelieved) { + this.creditRelieved = creditRelieved; // only allow one state change to prevent hacking + } + } } - public String getSerialNumber() { - return getStringAttribute("serial_number"); - } - - public void setSerialNumber(String serialNumber) { - setStringAttribute("serial_number", serialNumber); - setOptions(Options.SERIAL, true); - } - - public void sendDelta3(Client destination) { - destination.getSession().write(messageBuilder.buildDelta3()); - //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"TANO3 Delta"); - } - - public void sendAssemblyDelta3(Client destination) { - destination.getSession().write(messageBuilder.buildAssemblyDelta3()); - //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildAssemblyDelta3(),"TANO3 Assembly Delta"); - } - - public void sendCustomizationDelta3(Client destination, String enteredName){ - destination.getSession().write(messageBuilder.buildCustomNameDelta(enteredName)); - //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildCustomNameDelta(enteredName),"TANO3 Customization Delta"); - } - - - @Override - public void sendBaselines(Client destination) { - - - if(destination == null || destination.getSession() == null) { - System.out.println("NULL destination"); - return; + public boolean isFull() { + if (getTemplateData().getAttribute("containerVolumeLimit") == null) { + return false; } - destination.getSession().write(messageBuilder.buildBaseline3()); - destination.getSession().write(messageBuilder.buildBaseline6()); - destination.getSession().write(messageBuilder.buildBaseline8()); - destination.getSession().write(messageBuilder.buildBaseline9()); + int containerVolumeLimit = (int) getTemplateData().getAttribute("containerVolumeLimit") >> 8; // Shifting because it seems to be returning an extra byte before it should - if(getPvPBitmask() != 0) { - UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); - upvpm.setStatus(getPvPBitmask()); - destination.getSession().write(upvpm.serialize()); + if (containerVolumeLimit == 0) { + return false; } - - } - - public ObjectMessageBuilder getMessageBuilder() { - return messageBuilder; - } - - public boolean isFull() - { - if(getTemplateData().getAttribute("containerVolumeLimit") == null) return false; + if (NGECore.getInstance().objectService.objsInContainer(this, this) >= containerVolumeLimit) { + return true; + } - int containerVolumeLimit = (int)getTemplateData().getAttribute("containerVolumeLimit") >> 8; // Shifting because it seems to be returning an extra byte before it should - - if(containerVolumeLimit == 0) return false; - - if(NGECore.getInstance().objectService.objsInContainer(this, this) >= containerVolumeLimit) return true; - return false; } - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - // TODO Auto-generated method stub - + public void notifyClients(IoBuffer buffer, boolean notifySelf) { + notifyObservers(buffer, false); } + public ObjectMessageBuilder getMessageBuilder() { + synchronized(objectMutex) { + if (messageBuilder == null) { + messageBuilder = new TangibleMessageBuilder(this); + } + + return messageBuilder; + } + } + + public void sendBaselines(Client destination) { + if (destination != null && destination.getSession() != null) { + destination.getSession().write(getBaseline(3).getBaseline()); + destination.getSession().write(getBaseline(6).getBaseline()); + + Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient()); + + if (parent != null && destination == parent) { + destination.getSession().write(getBaseline(8).getBaseline()); + destination.getSession().write(getBaseline(9).getBaseline()); + } + + if (destination.getParent() != this) { + UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); + upvpm.setFaction(CRC.StringtoCRC(getFaction())); + upvpm.setStatus(NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this)); + destination.getSession().write(upvpm.serialize()); + } + } + } + + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + switch (viewType) { + case 3: + { + switch (updateType) { + case 7: + { + buffer = getBaseline(3).createDelta(7, buffer.array()); + notifyClients(buffer, true); + break; + } + } + } + } + } + + @Deprecated public void setCustomName2(String customName) { setCustomName(customName); } + + @Deprecated public void sendDelta3(Client destination) { setOptions(Options.SERIAL | Options.INVULNERABLE, true); } + + @Deprecated public void sendAssemblyDelta3(Client destination) { setMaximumCondition(1000); } + + @Deprecated public void sendCustomizationDelta3(Client destination, String enteredName){ setCustomName(enteredName); } + + @Deprecated public void addOption(int option) { setOptionsBitmask(getOptionsBitmask() | option); } + + @Deprecated public void removeOption(int option) { setOptionsBitmask(getOptionsBitmask() & ~option); } + + @Deprecated public int getMaxDamage() { return getMaximumCondition(); } + + @Deprecated public void setMaxDamage(int maxDamage) { setMaximumCondition(maxDamage); } + + @Deprecated public byte getCombatFlag() { return (byte) ((isInCombat()) ? 1 : 0); } //Baseline.getBoolean(isInCombat()); } + + @Deprecated public void setCombatFlag(byte combatFlag) { setInCombat(combatFlag > 0); } //setInCombat(Baseline.getBoolean(combatFlag)); } + + @Deprecated public int getPvPBitmask() { return getPvpBitmask(); } + + @Deprecated public void setPvPBitmask(int pvpBitmask) { setPvpBitmask(pvpBitmask); } + + @Deprecated public int getStackCount() { if (getUses() == 0) setUses(1); return getUses(); } + + @Deprecated public void setStackCount(int stackCount) { setUses(stackCount); } + } diff --git a/src/resources/objects/tool/SurveyTool.java b/src/resources/objects/tool/SurveyTool.java index e9337445..464c8534 100644 --- a/src/resources/objects/tool/SurveyTool.java +++ b/src/resources/objects/tool/SurveyTool.java @@ -95,8 +95,8 @@ public class SurveyTool extends TangibleObject implements Serializable { defendersList = new Vector(); } - public SurveyTool(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ - super(objectID, planet, template, position, orientation); + public SurveyTool(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { + super(objectID, planet, position, orientation, template); surveyEffectString = ""; sampleEffectString = ""; this.tanoID = objectID; diff --git a/src/resources/objects/universe/UniverseObject.java b/src/resources/objects/universe/UniverseObject.java index 3f3bb6b1..021abff6 100644 --- a/src/resources/objects/universe/UniverseObject.java +++ b/src/resources/objects/universe/UniverseObject.java @@ -27,19 +27,17 @@ import org.apache.mina.core.buffer.IoBuffer; import resources.objects.ObjectMessageBuilder; -import com.sleepycat.persist.model.Persistent; - import engine.clients.Client; +import engine.resources.objects.Baseline; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=0) public class UniverseObject extends SWGObject implements Serializable { private static final long serialVersionUID = 1L; - private transient ObjectMessageBuilder messageBuilder = null; + private transient UniverseMessageBuilder messageBuilder = null; public UniverseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, position, orientation, Template); @@ -53,20 +51,36 @@ public class UniverseObject extends SWGObject implements Serializable { public void initAfterDBLoad() { super.init(); } - + @Override - public void sendBaselines(Client arg0) { - // TODO Auto-generated method stub - + public Baseline getOtherVariables() { + Baseline baseline = super.getOtherVariables(); + return baseline; } + @Override + public void notifyClients(IoBuffer buffer, boolean notifySelf) { + notifyObservers(buffer, false); + } + + @Override public ObjectMessageBuilder getMessageBuilder() { - return messageBuilder; + synchronized(objectMutex) { + if (messageBuilder == null) { + messageBuilder = new UniverseMessageBuilder(this); + } + + return messageBuilder; + } + } + + @Override + public void sendBaselines(Client destination) { + } @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - // TODO Auto-generated method stub } diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index a4ef7b31..4fca13d7 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -44,14 +44,14 @@ public class WeaponObject extends TangibleObject implements Serializable { private transient WeaponMessageBuilder messageBuilder; public WeaponObject(long objectID, Planet planet, String template) { - super(objectID, planet, template, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0)); + super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); messageBuilder = new WeaponMessageBuilder(this); if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); setStringAttribute("cat_wpn_damage.damage", "0-0"); } - public WeaponObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { - super(objectID, planet, template, position, orientation); + public WeaponObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { + super(objectID, planet, position, orientation, template); messageBuilder = new WeaponMessageBuilder(this); if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); setStringAttribute("cat_wpn_damage.damage", "0-0"); @@ -68,38 +68,12 @@ public class WeaponObject extends TangibleObject implements Serializable { messageBuilder = new WeaponMessageBuilder(this); defendersList = new Vector(); } - - public int getIncapTimer() { - return incapTimer; - } - - public void setIncapTimer(int incapTimer) { - this.incapTimer = incapTimer; - } - - - public byte[] getCustomization() { - return customization; - } - - public void setCustomization(byte[] customization) { - this.customization = customization; - } - - public int getOptionsBitmask() { - return optionsBitmask; - } - - public void setOptionsBitmask(int optionsBitmask) { - this.optionsBitmask = optionsBitmask; - } - + public int getMaxDamage() { return Integer.parseInt(getStringAttribute("cat_wpn_damage.damage").split("-")[1]); } - + public void setMaxDamage(int maxDamage) { - setStringAttribute("cat_wpn_damage.damage", String.valueOf(getMinDamage()) + "-" + String.valueOf(maxDamage)); setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 531895f4..591d76db 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -60,6 +60,7 @@ import protocol.swg.ClientVerifyAndLockNameResponse; import protocol.swg.CreateCharacterSuccess; import protocol.swg.HeartBeatMessage; import resources.objects.creature.CreatureObject; +import resources.objects.intangible.IntangibleObject; import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; @@ -338,6 +339,9 @@ public class CharacterService implements INetworkDispatch { object._add(defaultWeapon); object.setWeaponId(defaultWeapon.getObjectID()); + IntangibleObject pda = (IntangibleObject) core.objectService.createObject("object/intangible/data_item/shared_guild_stone.iff", object.getPlanet()); + datapad.add(pda); + createStarterClothing(object, sharedRaceTemplate, clientCreateCharacter.getStarterProfession()); //core.scriptService.callScript("scripts/", "demo", "CreateStartingCharacter", core, object); diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index 92841d3a..9baa6d0b 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -195,8 +195,6 @@ public class ConnectionService implements INetworkDispatch { CreatureObject object = (CreatureObject) client.getParent(); - object.setPvPBitmask(0); - object.setInviteCounter(0); object.setInviteSenderId(0); object.setInviteSenderName(""); diff --git a/src/services/DevService.java b/src/services/DevService.java index 7b79dcfe..68c616a7 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -88,10 +88,14 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 26, "Installations"); suiOptions.put((long) 110, "Survey Devices"); if(creature.getPlayerObject().getProfession().equals("bounty_hunter_1a")) suiOptions.put((long) 123, "Tracking Droids"); - if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds"); - if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools"); - if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds"); - if(creature.getClient().isGM()) suiOptions.put((long) 121, "Sandbox City"); + if (creature.getClient().isGM()) { + suiOptions.put((long) 120, "House Deeds"); + suiOptions.put((long) 125, "Crafting Tools"); + suiOptions.put((long) 130, "Vehicle Deeds"); + suiOptions.put((long) 121, "Sandbox City"); + suiOptions.put((long) 140, "Guild Registry Device (PDA)"); + } + break; case 3: // [Items] Weapons suiOptions.put((long) 30, "Jedi Weapons"); @@ -1263,6 +1267,11 @@ public class DevService implements INetworkDispatch { inventory.add(swoopDeed); inventory.add(av21deed); return; + + case 140: + TangibleObject guildRegistry = (TangibleObject) core.objectService.createObject("object/tangible/furniture/technical/shared_guild_registry_initial.iff", planet); + inventory.add(guildRegistry); + return; } } }); diff --git a/src/services/guild/GuildService.java b/src/services/GuildService.java similarity index 76% rename from src/services/guild/GuildService.java rename to src/services/GuildService.java index 3197e9e1..fed7c2c9 100644 --- a/src/services/guild/GuildService.java +++ b/src/services/GuildService.java @@ -19,12 +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 services.guild; +package services; import java.util.Map; import resources.guild.Guild; -import resources.objects.SWGList; +import resources.objects.SWGSet; import resources.objects.guild.GuildObject; import main.NGECore; import engine.resources.objects.SWGObject; @@ -55,15 +55,9 @@ public class GuildService implements INetworkDispatch { 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); + int listSize = object.getGuildList().size(); + Guild guild = new Guild((listSize == 0 ? 1 : listSize + 1), abbreviation, name, leader); object.getGuildList().add(guild); @@ -74,38 +68,20 @@ public class GuildService implements INetworkDispatch { return object; } - public SWGList getGuildList() { + public SWGSet getGuildList() { return object.getGuildList(); } public Guild getGuildById(int id) { - for (int i = 0; i < object.getGuildList().size(); i++) { - if (object.getGuildList().get(i).getId() == id) { - return object.getGuildList().get(i); - } - } - - return null; + return object.getGuildList().stream().filter(g -> g.getId() == id).findFirst().get(); } public Guild getGuildByAbbreviation(String abbreviation) { - for (int i = 0; i < object.getGuildList().size(); i++) { - if (object.getGuildList().get(i).getAbbreviation().equals(abbreviation)) { - return object.getGuildList().get(i); - } - } - - return null; + return object.getGuildList().stream().filter(g -> g.getAbbreviation().equals(abbreviation)).findFirst().get(); } public Guild getGuildByName(String name) { - for (int i = 0; i < object.getGuildList().size(); i++) { - if (object.getGuildList().get(i).getName().equals(name)) { - return object.getGuildList().get(i); - } - } - - return null; + return object.getGuildList().stream().filter(g -> g.getName().equals(name)).findFirst().get(); } public boolean removeGuild(int id) { diff --git a/src/services/LootService.java b/src/services/LootService.java index 687011e8..3b680b74 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -21,12 +21,9 @@ ******************************************************************************/ package services; -import java.io.File; import java.io.IOException; -import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream.Filter; import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; import java.nio.file.Files; @@ -41,8 +38,6 @@ import java.util.Map; import java.util.Random; import java.util.Vector; -import org.apache.commons.lang3.ArrayUtils; - import protocol.swg.PlayClientEffectObjectTransformMessage; import resources.loot.LootGroup; import resources.loot.LootRollSession; @@ -793,7 +788,7 @@ public class LootService implements INetworkDispatch { int finalMinDmg = 0; int finalMaxDmg = 0; - String tunableObjectName = ""; + @SuppressWarnings("unused") String tunableObjectName = ""; if (objectType.contains("powercrystal")){ tunableObjectName = "Power Crystal"; @@ -1041,7 +1036,7 @@ public class LootService implements INetworkDispatch { float qz= 1.06535322E9F; Point3D effectorPosition = new Point3D(0,y,0); Quaternion effectorOrientation = new Quaternion(0,0,0,qz); - PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("",lootedObject.getObjectID(),"",effectorPosition,effectorOrientation); + //PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("",lootedObject.getObjectID(),"",effectorPosition,effectorOrientation); //((CreatureObject) requester).getClient().getSession().write(lmsg.serialize()); } diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 37f6757e..4eda23aa 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -160,7 +160,7 @@ public class PlayerService implements INetworkDispatch { scheduleList.add(scheduler.scheduleAtFixedRate(() -> { if(creature.getAction() < creature.getMaxAction() && creature.getPosture() != 14) { - if(creature.getCombatFlag() == 0) + if(!creature.isInCombat()) creature.setAction(creature.getAction() + (15 + creature.getLevel() * 5)); else creature.setAction(creature.getAction() + ((15 + creature.getLevel() * 5) / 2)); @@ -168,7 +168,7 @@ public class PlayerService implements INetworkDispatch { }, 0, 1000, TimeUnit.MILLISECONDS)); scheduleList.add(scheduler.scheduleAtFixedRate(() -> { - if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14) + if(creature.getHealth() < creature.getMaxHealth() && !creature.isInCombat() && creature.getPosture() != 13 && creature.getPosture() != 14) creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4)); }, 0, 1000, TimeUnit.MILLISECONDS)); schedulers.put(creature.getObjectID(), scheduleList); @@ -873,7 +873,8 @@ public class PlayerService implements INetworkDispatch { creature.getClient().getSession().write((new ClientMfdStatusUpdateMessage((float) ((level >= 90) ? 90 : (level + 1)), "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize()); creature.setLevel((short) level); - core.scriptService.callScript("scripts/collections/", "master_" + player.getProfession(), "addMasterBadge", core, creature); + if (level == 90) + core.scriptService.callScript("scripts/collections/", "profession_master", player.getProfession(), core, creature); creature.showFlyText(OutOfBand.ProsePackage("@cbt_spam:skill_up"), 2.5f, new RGB(154, 205, 50), 0, true); creature.playEffectObject("clienteffect/skill_granted.cef", ""); diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 1eb8ede6..432868e4 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -460,6 +460,8 @@ public class SimulationService implements INetworkDispatch { remove(object, oldPos.x, oldPos.z); if(object.getContainer() != null) object.getContainer()._remove(object); + else if (object.getClient().isGM() && parent.getContainer() != null) + object.sendSystemMessage("BuildingId: Dec: " + parent.getContainer().getObjectID() + " / Hex: " + Long.toHexString(parent.getContainer().getObjectID()), DisplayType.Broadcast); parent._add(object); } object.setPosition(newPos); diff --git a/src/services/SkillService.java b/src/services/SkillService.java index a61116b3..6396581f 100644 --- a/src/services/SkillService.java +++ b/src/services/SkillService.java @@ -399,6 +399,8 @@ public class SkillService implements INetworkDispatch { public void resetExpertise(CreatureObject creature) { List skills = new ArrayList(creature.getSkills()); skills.stream().filter(s -> s.contains("expertise")).forEach(s -> removeSkill(creature, s)); + + creature.getBuffList().stream().forEach(buff -> creature.removeBuff(buff)); } public void sendRespecWindow(CreatureObject creature) { diff --git a/src/services/StaticService.java b/src/services/StaticService.java index 11b9dee8..7fbaade4 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -113,6 +113,11 @@ public class StaticService implements INetworkDispatch { SWGObject cell = core.objectService.getObject(cellId); + if (cellId != 0 && cell == null) { + System.err.println("CellId invalid for template " + template); + return null; + } + if (cell != null && cell.getContainer() != null && cell.getContainer() instanceof BuildingObject) { buildingId = cell.getContainer().getObjectId(); cellNumber = ((BuildingObject) cell.getContainer()).getCellNumberByObjectId(cellId); @@ -121,6 +126,7 @@ public class StaticService implements INetworkDispatch { long objectId = core.objectService.getDOId(planetName, template, 0, buildingId, cellNumber, x, y, z); SWGObject object = null; + MobileTemplate mobileTemplate = core.spawnService.getMobileTemplate(template); if (mobileTemplate != null) { @@ -149,6 +155,10 @@ public class StaticService implements INetworkDispatch { System.err.println("StaticService: ObjectId " + objectId + " was taken for object with template " + object.getTemplate() + ". Replacement: " + object.getObjectID()); } + if (mobileTemplate != null) { + return object; + } + boolean checkCells = false; // shouldn't be needed; for debugging if (object instanceof BuildingObject && checkCells) { diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index a2e3cdb5..fddea8b1 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -338,7 +338,7 @@ public class SurveyService implements INetworkDispatch { if (crafter.getPosture()==13) return; // QA - if (crafter.getCombatFlag()!=0){ // QA + if (crafter.isInCombat()){ // QA crafter.sendSystemMessage("@survey:sample_cancel_attack", (byte) 0); return; } @@ -422,7 +422,7 @@ public class SurveyService implements INetworkDispatch { surveyTool.setCurrentlyCoolingDown(false); CreatureObject crafter = (CreatureObject) NGECore.getInstance().objectService.getObject(surveyTool.getUserID()); - PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost"); + if (crafter.getPosture()!=1){ crafter.sendSystemMessage("@survey:sample_cancel", (byte) 0); surveyTool.setExceptionalState(false); @@ -433,7 +433,7 @@ public class SurveyService implements INetworkDispatch { if (crafter.getPosture()==13) return; - if (crafter.getCombatFlag()!=0){ + if (crafter.isInCombat()){ crafter.sendSystemMessage("@survey:sample_cancel_attack", (byte) 0); return; } @@ -665,7 +665,6 @@ public class SurveyService implements INetworkDispatch { Vector returnList = new Vector(); returnList.add("List.lstList:SelectedRow"); - final SurveyTool outerSurveyTool = (SurveyTool)target; window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() { @Override diff --git a/src/services/ai/AIActor.java b/src/services/ai/AIActor.java index 7cfceb6c..81db67c8 100644 --- a/src/services/ai/AIActor.java +++ b/src/services/ai/AIActor.java @@ -44,7 +44,6 @@ import services.ai.states.AttackState; import services.ai.states.DeathState; import services.ai.states.IdleState; import services.ai.states.RetreatState; -import services.ai.states.StalkState; import services.combat.CombatEvents.DamageTaken; import services.spawn.MobileTemplate; import java.util.Random; @@ -74,15 +73,15 @@ public class AIActor { creature.getEventBus().subscribe(this); this.currentState = new IdleState(); regenTask = scheduler.scheduleAtFixedRate(() -> { - if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14) + if(creature.getHealth() < creature.getMaxHealth() && !creature.isInCombat() && creature.getPosture() != 13 && creature.getPosture() != 14) creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4)); }, 0, 1000, TimeUnit.MILLISECONDS); if(creature.getOption(Options.AGGRESSIVE)) { aggroCheckTask = scheduler.scheduleAtFixedRate(() -> { - if(creature == null || creature.getObservers().isEmpty() || creature.getCombatFlag() != 0 || isStalking) + if(creature == null || creature.getObservers().isEmpty() || creature.isInCombat() || isStalking) return; creature.getObservers().stream().map(Client::getParent).filter(obj -> obj.inRange(creature.getWorldPosition(), 10)).forEach((obj) -> { - if(new Random().nextFloat() <= 0.33 || creature.getCombatFlag() != 0 || isStalking) { + if(new Random().nextFloat() <= 0.33 || creature.isInCombat() || isStalking) { /*if(mobileTemplate.isStalker()) { setFollowObject((CreatureObject) obj); setCurrentState(new StalkState()); diff --git a/src/services/ai/LairActor.java b/src/services/ai/LairActor.java index 778de963..80472ef9 100644 --- a/src/services/ai/LairActor.java +++ b/src/services/ai/LairActor.java @@ -87,7 +87,7 @@ public class LairActor { return; int currentCondition = lairObject.getConditionDamage(); - int maxCondition = lairObject.getMaxDamage(); + int maxCondition = lairObject.getMaximumCondition(); switch(spawnWave) { // TODO: play damage effect @@ -146,7 +146,7 @@ public class LairActor { int healAmount = 0; for(AIActor ai : creatures) { - healAmount += lairObject.getMaxDamage() / 100; + healAmount += lairObject.getMaximumCondition() / 100; } lairObject.setConditionDamage(lairObject.getConditionDamage() - healAmount); diff --git a/src/services/ai/states/AttackState.java b/src/services/ai/states/AttackState.java index dbc0a54d..3b16a857 100644 --- a/src/services/ai/states/AttackState.java +++ b/src/services/ai/states/AttackState.java @@ -37,7 +37,7 @@ public class AttackState extends AIState { CreatureObject creature = actor.getCreature(); if(creature.getPosture() == 14) return StateResult.DEAD; - if(creature.getCombatFlag() == 0 || creature.getDefendersList().size() == 0 || actor.getFollowObject() == null) + if(!creature.isInCombat() || creature.getDefendersList().size() == 0 || actor.getFollowObject() == null) return StateResult.FINISHED; actor.scheduleMovement(); actor.scheduleRecovery(); @@ -115,7 +115,7 @@ public class AttackState extends AIState { NGECore core = NGECore.getInstance(); if(creature.getPosture() == 14) return StateResult.DEAD; - if(creature.getCombatFlag() == 0 || creature.getDefendersList().size() == 0 || actor.getFollowObject() == null) + if(!creature.isInCombat() || creature.getDefendersList().size() == 0 || actor.getFollowObject() == null) { creature.setLookAtTarget(0); creature.setIntendedTarget(0); diff --git a/src/services/ai/states/DeathState.java b/src/services/ai/states/DeathState.java index 94148dbc..926d60f8 100644 --- a/src/services/ai/states/DeathState.java +++ b/src/services/ai/states/DeathState.java @@ -21,10 +21,7 @@ ******************************************************************************/ package services.ai.states; -import java.util.Vector; - import main.NGECore; -import resources.common.RadialOptions; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; import services.ai.AIActor; diff --git a/src/services/ai/states/StalkState.java b/src/services/ai/states/StalkState.java index 26b3a90a..b7d2384a 100644 --- a/src/services/ai/states/StalkState.java +++ b/src/services/ai/states/StalkState.java @@ -22,7 +22,6 @@ package services.ai.states; import services.ai.AIActor; -import services.ai.states.AIState.StateResult; public class StalkState extends AIState { diff --git a/src/services/bazaar/AuctionItem.java b/src/services/bazaar/AuctionItem.java index ffa3f6d4..4e0d2fca 100644 --- a/src/services/bazaar/AuctionItem.java +++ b/src/services/bazaar/AuctionItem.java @@ -23,13 +23,9 @@ package services.bazaar; import java.io.Serializable; -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.PrimaryKey; -import engine.resources.objects.IPersistent; import engine.resources.objects.SWGObject; @Entity(version=1) diff --git a/src/services/bazaar/BazaarService.java b/src/services/bazaar/BazaarService.java index 2efde273..75f3e3f4 100644 --- a/src/services/bazaar/BazaarService.java +++ b/src/services/bazaar/BazaarService.java @@ -22,19 +22,11 @@ package services.bazaar; import java.nio.ByteOrder; -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Set; -import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListSet; -import java.util.function.BiFunction; -import java.util.function.Function; - -import com.sleepycat.je.Transaction; -import com.sleepycat.persist.EntityCursor; import main.NGECore; import engine.clients.Client; @@ -47,6 +39,7 @@ import engine.resources.service.INetworkRemoteEvent; import resources.common.Opcodes; import resources.common.OutOfBand; import resources.common.ProsePackage; +import resources.datatables.DisplayType; import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; import resources.objects.intangible.IntangibleObject; @@ -682,14 +675,12 @@ public class BazaarService implements INetworkDispatch { core.objectService.destroyObject(item); if(vendor.getTemplate().contains("terminal_bazaar")) { - ProsePackage prose = new ProsePackage("base_player", "sale_fee"); int salesFee = SALES_FEE; if(premium) salesFee *= 5; player.setBankCredits(player.getBankCredits() - salesFee); - prose.setDiInteger(salesFee); - player.sendSystemMessage(new OutOfBand(prose), (byte) 0); + player.sendSystemMessage(OutOfBand.ProsePackage("@base_player:sale_fee", salesFee), DisplayType.Broadcast); } if(auction) { diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index e75acf0a..251d125e 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -34,9 +34,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; -import com.sleepycat.je.Transaction; -import com.sleepycat.persist.EntityCursor; - import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; import engine.clients.Client; @@ -944,6 +941,7 @@ public class ChatService implements INetworkDispatch { } room.addUser(user.toLowerCase()); + ((CreatureObject) player).getPlayerObject().addChannel(roomId); return true; } return false; @@ -1004,10 +1002,6 @@ public class ChatService implements INetworkDispatch { }); } - public void handleGroupChat(SWGObject sender, String message) { - - } - public ConcurrentHashMap getChatRooms() { return chatRooms; } diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index db087e12..d73f7eff 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -44,13 +44,11 @@ import resources.buffs.Buff; import resources.buffs.DamageOverTime; import resources.common.FileUtilities; import resources.common.OutOfBand; -import resources.common.ProsePackage; import resources.datatables.DisplayType; import resources.datatables.Options; import resources.datatables.Elemental; import resources.datatables.Posture; import resources.datatables.WeaponType; -import resources.objectives.BountyMissionObjective; import resources.objects.creature.CreatureObject; import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; @@ -206,7 +204,7 @@ public class CombatService implements INetworkDispatch { } else if(target instanceof TangibleObject) { - if(target.getConditionDamage() == target.getMaxDamage()) + if(target.getConditionDamage() == target.getMaximumCondition()) { for(TangibleObject defender : target.getDefendersList()) defender.removeDefender(target); core.objectService.destroyObject(target); @@ -828,9 +826,9 @@ public class CombatService implements INetworkDispatch { target.setIncapTask(incapTask); core.buffService.addBuffToCreature(target, "incapWeaken", target); if(target.getSlottedObject("ghost") != null && attacker.getSlottedObject("ghost") != null) { - target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_incap", attacker.getCustomName())), (byte) 0); - attacker.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_target_incap", target.getCustomName())), (byte) 0); - } else {target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_incap", "@" + attacker.getStfFilename() + ":" + attacker.getStfName())), (byte) 0); } + target.sendSystemMessage(OutOfBand.ProsePackage("@base_player:prose_victim_incap", "TT", attacker.getCustomName()), DisplayType.Broadcast); + attacker.sendSystemMessage(OutOfBand.ProsePackage("@base_player:prose_target_incap", "TT", target.getCustomName()), DisplayType.Broadcast); + } else {target.sendSystemMessage(OutOfBand.ProsePackage("@base_player:prose_victim_incap", "TT", "@" + attacker.getStfFilename() + ":" + attacker.getStfName()), DisplayType.Broadcast); } return; } else if(target.getHealth() - damage <= 0 && target.getAttachment("AI") != null) { synchronized(target.getMutex()) { @@ -1021,14 +1019,9 @@ public class CombatService implements INetworkDispatch { if (mission != null && mission.getBountyMarkId() == target.getObjectID()) { - ProsePackage attackerPp = new ProsePackage("bounty_hunter", "bounty_success_hunter", target.getCustomName()); - attackerPp.setToCustomString("his"); // TODO: Genders - attackerPp.setDiInteger(mission.getCreditReward()); - attacker.sendSystemMessage(new OutOfBand(attackerPp), DisplayType.Broadcast); + attacker.sendSystemMessage(OutOfBand.ProsePackage("@bounty_hunter:bounty_success_hunter", mission.getCreditReward(), "TT", target.getCustomName(), "TO", target.getObjectID()), DisplayType.Broadcast); - ProsePackage targetPp = new ProsePackage ("bounty_hunter", "bounty_success_hunter", attacker.getCustomName()); - targetPp.setDiInteger(mission.getCreditReward()); - target.sendSystemMessage(new OutOfBand(targetPp), DisplayType.Broadcast); + target.sendSystemMessage(OutOfBand.ProsePackage("@bounty_hunter:bounty_success_hunter", mission.getCreditReward(), "TT", attacker.getCustomName()), DisplayType.Broadcast); core.missionService.handleMissionComplete(attacker, mission); } @@ -1039,13 +1032,9 @@ public class CombatService implements INetworkDispatch { if (mission != null && mission.getBountyMarkId() == attacker.getObjectID()) { - ProsePackage attackerPp = new ProsePackage("bounty_hunter", "bounty_failed_target", target.getCustomName()); - attackerPp.setToCustomString("his"); // TODO: Genders - attackerPp.setDiInteger(mission.getCreditReward()); - attacker.sendSystemMessage(new OutOfBand(attackerPp), DisplayType.Broadcast); + attacker.sendSystemMessage(OutOfBand.ProsePackage("@bounty_hunter:bounty_failed_target", mission.getCreditReward(), "TT", target.getCustomName(), "TO", target.getObjectID()), DisplayType.Broadcast); - ProsePackage targetPp = new ProsePackage ("bounty_hunter", "bounty_failed_hunter", attacker.getCustomName()); - target.sendSystemMessage(new OutOfBand(targetPp), DisplayType.Broadcast); + target.sendSystemMessage(OutOfBand.ProsePackage("@bounty_hunter:bounty_failed_hunter", "TT", attacker.getCustomName()), DisplayType.Broadcast); core.missionService.handleMissionAbort(target, mission); } @@ -1065,9 +1054,9 @@ public class CombatService implements INetworkDispatch { target.setTurnRadius(0); if (attacker.getSlottedObject("ghost") != null) - target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_dead", attacker.getCustomName())), (byte) 0); + target.sendSystemMessage(OutOfBand.ProsePackage("@base_player:prose_victim_dead", "TT", attacker.getCustomName()), DisplayType.Broadcast); else - target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_dead", "@" + attacker.getStfFilename() + ":" + attacker.getStfName())), (byte) 0); + target.sendSystemMessage(OutOfBand.ProsePackage("@base_player:prose_victim_dead", "TT", "@" + attacker.getStfFilename() + ":" + attacker.getStfName()), DisplayType.Broadcast); core.playerService.sendCloningWindow(target, attacker.getSlottedObject("ghost") != null); } diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 0e0e47db..9435a0ea 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -57,7 +57,7 @@ public class CommandService implements INetworkDispatch { private Vector commandLookup = new Vector(); private ConcurrentHashMap aliases = new ConcurrentHashMap(); - private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + @SuppressWarnings("unused") private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); private NGECore core; public CommandService(NGECore core) { @@ -557,6 +557,7 @@ public class CommandService implements INetworkDispatch { } @Override + @SuppressWarnings("unused") public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { objControllerOpcodes.put(ObjControllerOpcodes.COMMAND_QUEUE_ENQUEUE, new INetworkRemoteEvent() { diff --git a/src/services/EquipmentService.java b/src/services/equipment/EquipmentService.java similarity index 99% rename from src/services/EquipmentService.java rename to src/services/equipment/EquipmentService.java index a75ba2d6..8b16291f 100644 --- a/src/services/EquipmentService.java +++ b/src/services/equipment/EquipmentService.java @@ -19,7 +19,7 @@ * 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; +package services.equipment; import java.io.IOException; import java.nio.file.FileVisitResult; @@ -48,7 +48,6 @@ import engine.resources.service.INetworkRemoteEvent; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; -import services.equipment.BonusSetTemplate; public class EquipmentService implements INetworkDispatch { diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java index f46d4f2f..c5bafb16 100644 --- a/src/services/gcw/FactionService.java +++ b/src/services/gcw/FactionService.java @@ -246,11 +246,11 @@ public class FactionService implements INetworkDispatch { target = (TangibleObject) core.objectService.getObject(((CreatureObject) target).getOwnerId()); } - if ((target.getPvPBitmask() & PvpStatus.GoingCovert) == PvpStatus.GoingCovert) { + if ((target.getPvpBitmask() & PvpStatus.GoingCovert) == PvpStatus.GoingCovert) { pvpBitmask |= PvpStatus.GoingCovert; } - if ((target.getPvPBitmask() & PvpStatus.GoingOvert) == PvpStatus.GoingOvert) { + if ((target.getPvpBitmask() & PvpStatus.GoingOvert) == PvpStatus.GoingOvert) { pvpBitmask |= PvpStatus.GoingOvert; } @@ -383,12 +383,12 @@ public class FactionService implements INetworkDispatch { return; } - if (actor.getPvPBitmask() == PvpStatus.GoingCovert) { + if (actor.getPvpBitmask() == PvpStatus.GoingCovert) { actor.sendSystemMessage("@faction_recruiter:pvp_status_changing", DisplayType.Broadcast); return; } - if (actor.getPvPBitmask() == PvpStatus.GoingOvert) { + if (actor.getPvpBitmask() == PvpStatus.GoingOvert) { actor.sendSystemMessage("@faction_recruiter:pvp_status_changing", DisplayType.Broadcast); return; } @@ -428,7 +428,7 @@ public class FactionService implements INetworkDispatch { final String finalMessage = message; scheduler.schedule(() -> { - actor.setPvPBitmask(0); + actor.setPvpBitmask(0); actor.setFactionStatus(factionStatus); actor.updatePvpStatus(); actor.sendSystemMessage("@faction_recruiter:" + finalMessage, DisplayType.Broadcast); @@ -436,12 +436,12 @@ public class FactionService implements INetworkDispatch { } public void resign(CreatureObject actor) { - if (actor.getPvPBitmask() == PvpStatus.GoingCovert) { + if (actor.getPvpBitmask() == PvpStatus.GoingCovert) { actor.sendSystemMessage("@faction_recruiter:pvp_status_changing", DisplayType.Broadcast); return; } - if (actor.getPvPBitmask() == PvpStatus.GoingOvert) { + if (actor.getPvpBitmask() == PvpStatus.GoingOvert) { actor.sendSystemMessage("@faction_recruiter:pvp_status_changing", DisplayType.Broadcast); return; } @@ -461,7 +461,7 @@ public class FactionService implements INetworkDispatch { } scheduler.schedule(() -> { - actor.setPvPBitmask(0); + actor.setPvpBitmask(0); actor.setFactionStatus(FactionStatus.OnLeave); actor.setFaction(""); actor.updatePvpStatus(); diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index a1b6b79b..c1566e45 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -121,15 +121,14 @@ import resources.objects.tangible.TangibleObject; import resources.objects.tool.SurveyTool; import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; -import services.EquipmentService; import services.ai.AIActor; import services.command.BaseSWGCommand; import services.command.CombatCommand; import services.bazaar.AuctionItem; import services.chat.ChatRoom; +import services.equipment.EquipmentService; @SuppressWarnings("unused") - public class ObjectService implements INetworkDispatch { private Map objectList = new ConcurrentHashMap(); @@ -241,11 +240,11 @@ public class ObjectService implements INetworkDispatch { } else if(Template.startsWith("object/tangible/survey_tool")) { - object = new SurveyTool(objectID, planet, Template, position, orientation); + object = new SurveyTool(objectID, planet, position, orientation, Template); } else if(Template.startsWith("object/tangible")) { - object = new TangibleObject(objectID, planet, Template, position, orientation); + object = new TangibleObject(objectID, planet, position, orientation, Template); } else if(Template.startsWith("object/intangible")) { @@ -253,7 +252,7 @@ public class ObjectService implements INetworkDispatch { } else if(Template.startsWith("object/weapon")) { - object = new WeaponObject(objectID, planet, Template, position, orientation); + object = new WeaponObject(objectID, planet, position, orientation, Template); } else if(Template.startsWith("object/building") || Template.startsWith("object/static/worldbuilding/structures") || Template.startsWith("object/static/structure")){ @@ -297,11 +296,11 @@ public class ObjectService implements INetworkDispatch { } else if(Template.startsWith("object/resource_container")) { - object = new ResourceContainerObject(objectID, planet, Template, position, orientation); + object = new ResourceContainerObject(objectID, planet, position, orientation, Template); } else if(Template.startsWith("object/factory/shared_factory_crate")) { - object = new FactoryCrateObject(objectID, planet, Template, position, orientation); + object = new FactoryCrateObject(objectID, planet, position, orientation, Template); } else if(Template.startsWith("object/draft_schematic")) { @@ -315,7 +314,7 @@ public class ObjectService implements INetworkDispatch { float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f; Point3D newpoint = new Point3D(position.x,positionY,position.z); - object = new InstallationObject(objectID, planet, Template, newpoint, orientation); + object = new InstallationObject(objectID, planet, newpoint, orientation, Template); } else if(Template.startsWith("object/installation/mining_ore") || Template.startsWith("object/installation/mining_liquid") || Template.startsWith("object/installation/mining_gas") || Template.startsWith("object/installation/mining_organic") || @@ -323,7 +322,7 @@ public class ObjectService implements INetworkDispatch { float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f; Point3D newpoint = new Point3D(position.x,positionY,position.z); - object = new HarvesterObject(objectID, planet, Template, newpoint, orientation); + object = new HarvesterObject(objectID, planet, newpoint, orientation, Template); } else { return null; @@ -1139,6 +1138,7 @@ public class ObjectService implements INetworkDispatch { containers.add(objectId); object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz), null, true, false); object.setAttachment("childObjects", null); + /*if (!duplicate.containsValue(objectId)) { ((BuildingObject) object).createTransaction(core.getBuildingODB().getEnvironment()); core.getBuildingODB().put((BuildingObject) object, Long.class, BuildingObject.class, ((BuildingObject) object).getTransaction()); @@ -1177,6 +1177,10 @@ public class ObjectService implements INetworkDispatch { object.setContainerPermissions(WorldPermissions.WORLD_PERMISSIONS); } + if (object != null && object instanceof TangibleObject && !(object instanceof CreatureObject)) { + ((TangibleObject) object).setStaticObject(true); + } + //System.out.println("Spawning: " + template + " at: X:" + object.getPosition().x + " Y: " + object.getPosition().y + " Z: " + object.getPosition().z); if(object != null) object.setAttachment("isBuildout", new Boolean(true)); diff --git a/src/services/pet/MountService.java b/src/services/pet/MountService.java index 1ffc8949..c1d836d5 100644 --- a/src/services/pet/MountService.java +++ b/src/services/pet/MountService.java @@ -138,7 +138,7 @@ public class MountService implements INetworkDispatch { return; } - if (actor.getCombatFlag() == 1) { + if (actor.isInCombat()) { actor.sendSystemMessage(OutOfBand.ProsePackage("@pet/pet_menu:cannot_call_in_combat"), DisplayType.Broadcast); return; } @@ -284,7 +284,7 @@ public class MountService implements INetworkDispatch { return; } - if (mount.getConditionDamage() >= mount.getMaxDamage()) { + if (mount.getConditionDamage() >= mount.getMaximumCondition()) { disable(mount); } } diff --git a/src/services/playercities/PlayerCity.java b/src/services/playercities/PlayerCity.java index 2a271b9e..64af777d 100644 --- a/src/services/playercities/PlayerCity.java +++ b/src/services/playercities/PlayerCity.java @@ -630,7 +630,7 @@ public class PlayerCity implements Serializable { // city_version_update_body_4 Vector citizenList = getCitizens(); for (long citizen : citizenList){ - CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen); +// CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen); Mail actorMail = new Mail(); actorMail.setMailId(NGECore.getInstance().chatService.generateMailId()); actorMail.setRecieverId(citizen); diff --git a/src/services/resources/HarvesterService.java b/src/services/resources/HarvesterService.java index b49e048e..5055431f 100644 --- a/src/services/resources/HarvesterService.java +++ b/src/services/resources/HarvesterService.java @@ -55,7 +55,6 @@ import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import resources.common.ObjControllerOpcodes; -import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; import resources.objects.harvester.HarvesterMessageBuilder; import resources.objects.harvester.HarvesterObject; @@ -363,8 +362,7 @@ public class HarvesterService implements INetworkDispatch { }); window.addHandler(1, "", Trigger.TRIGGER_CANCEL, returnList, new SUICallback() { @Override - public void process(SWGObject owner, int eventType, Vector returnList) { - CreatureObject crafter = (CreatureObject)owner; + public void process(SWGObject owner, int eventType, Vector returnList) { core.suiService.closeSUIWindow(owner, 0); } }); @@ -853,11 +851,9 @@ public class HarvesterService implements INetworkDispatch { ResourceContainerObject containerObject = (ResourceContainerObject) core.objectService.createObject(resourceContainerIFF, owner.getPlanet()); containerObject.initializeStats(sampleResource); containerObject.setProprietor(owner); - containerObject.setStackCount(stackcount,owner); - int resCRC = CRC.StringtoCRC(resourceContainerIFF); + containerObject.setStackCount(stackcount,owner); containerObject.setIffFileName(resourceContainerIFF); - long objectId = containerObject.getObjectID(); SWGObject crafterInventory = owner.getSlottedObject("inventory"); // SceneCreateObjectByCrc createObjectMsg = new SceneCreateObjectByCrc(objectId, owner.getOrientation().x, owner.getOrientation().y, owner.getOrientation().z, owner.getOrientation().w, owner.getPosition().x, owner.getPosition().y, owner.getPosition().z, resCRC, (byte) 0); @@ -1018,7 +1014,6 @@ public class HarvesterService implements INetworkDispatch { CreatureObject actor = (CreatureObject) NGECore.getInstance().objectService.getObject((Long) object.getAttachment("ownerId")); String structureTemplate = (String) object.getAttachment("StructureTemplate"); HarvesterObject harvester = (HarvesterObject) NGECore.getInstance().objectService.createObject(structureTemplate, actor.getPlanet()); - long objectId = harvester.getObjectID(); Vector adminList = harvester.getAdminList(); //String[] fullName = ((CreatureObject)actor).getCustomName().split(" "); adminList.add(actor.getCustomName()); diff --git a/src/services/resources/ResourceService.java b/src/services/resources/ResourceService.java index 09d9c9c5..78612dd9 100644 --- a/src/services/resources/ResourceService.java +++ b/src/services/resources/ResourceService.java @@ -22,7 +22,6 @@ package services.resources; import java.util.Hashtable; -import java.util.Iterator; import java.util.Map; import java.util.Random; import java.util.Vector; @@ -30,10 +29,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import com.sleepycat.persist.EntityCursor; - import main.NGECore; -import engine.resources.common.CRC; import engine.resources.database.ODBCursor; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -41,8 +37,6 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; -import resources.common.OutOfBand; -import resources.common.ProsePackage; import resources.datatables.MilkState; import resources.objects.creature.CreatureObject; import resources.objects.harvester.HarvesterObject; @@ -11444,11 +11438,9 @@ public class ResourceService implements INetworkDispatch { containerObject.setProprietor(crafter); containerObject.setStackCount(stackCount,false); //int stackCount = core.resourceService.getResourceSampleQuantity(crafter, sampleResource); - containerObject.initializeStats(sampleResource); - int resCRC = CRC.StringtoCRC(resourceContainerIFF); - containerObject.setIffFileName(resourceContainerIFF); - long objectId = containerObject.getObjectID(); - SWGObject crafterInventory = crafter.getSlottedObject("inventory"); + containerObject.initializeStats(sampleResource); + containerObject.setIffFileName(resourceContainerIFF); + SWGObject crafterInventory = crafter.getSlottedObject("inventory"); crafterInventory.add(containerObject); return containerObject; } @@ -11476,7 +11468,7 @@ public class ResourceService implements INetworkDispatch { public boolean canMilk(CreatureObject actor, CreatureObject target) { - if(target.getPosture() == 14 || !actor.inRange(target.getWorldPosition(), 5) || actor.getCombatFlag() == 1 || target.getCombatFlag() == 1) + if(target.getPosture() == 14 || !actor.inRange(target.getWorldPosition(), 5) || actor.isInCombat() || target.isInCombat()) return false; AIActor ai = (AIActor) target.getAttachment("AI"); @@ -11593,7 +11585,7 @@ public class ResourceService implements INetworkDispatch { return; } - if(actor.getCombatFlag() == 1) { + if(actor.isInCombat()) { actor.sendSystemMessage("@skl_use:milk_combat", (byte) 0); ai.setMilkState(MilkState.NOTYETMILKED); return; diff --git a/src/services/spawn/DynamicSpawnArea.java b/src/services/spawn/DynamicSpawnArea.java index 388195c6..f45e7196 100644 --- a/src/services/spawn/DynamicSpawnArea.java +++ b/src/services/spawn/DynamicSpawnArea.java @@ -22,7 +22,6 @@ package services.spawn; import java.util.Collections; -import java.util.Iterator; import java.util.Random; import java.util.Vector; @@ -35,7 +34,6 @@ import resources.common.collidables.AbstractCollidable.ExitEvent; import resources.objects.creature.CreatureObject; import services.TerrainService; import services.SimulationService.MoveEvent; -import services.ai.LairActor; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; diff --git a/src/services/spawn/MobileTemplate.java b/src/services/spawn/MobileTemplate.java index 18505f7d..1d31bb5a 100644 --- a/src/services/spawn/MobileTemplate.java +++ b/src/services/spawn/MobileTemplate.java @@ -31,7 +31,7 @@ import resources.loot.LootGroup; public class MobileTemplate implements Cloneable { private Vector templates; - private int optionBitmask = Options.ATTACKABLE; + private int optionsBitmask = Options.ATTACKABLE; private int pvpBitmask = PvpStatus.Attackable; private short level; private short minLevel; @@ -70,12 +70,12 @@ public class MobileTemplate implements Cloneable { this.templates = templates; } - public int getOptionBitmask() { - return optionBitmask; + public int getOptionsBitmask() { + return optionsBitmask; } - public void setOptionBitmask(int optionBitmask) { - this.optionBitmask = optionBitmask; + public void setOptionsBitmask(int optionsBitmask) { + this.optionsBitmask = optionsBitmask; } public int getPvpBitmask() { diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java index 2d30d0c3..18d66938 100644 --- a/src/services/spawn/SpawnService.java +++ b/src/services/spawn/SpawnService.java @@ -103,8 +103,8 @@ public class SpawnService { if(mobileTemplate.getLootGroups() != null) creature.setLootGroups(mobileTemplate.getLootGroups()); - creature.setOptionsBitmask(mobileTemplate.getOptionBitmask()); - creature.setPvPBitmask(mobileTemplate.getPvpBitmask()); + creature.setOptionsBitmask(mobileTemplate.getOptionsBitmask()); + creature.setPvpBitmask(mobileTemplate.getPvpBitmask()); creature.setStfFilename("mob/creature_names"); // TODO: set other STFs for NPCs other than creatures creature.setStfName(mobileTemplate.getCreatureName()); creature.setHeight(mobileTemplate.getScale()); @@ -252,8 +252,8 @@ public class SpawnService { return null; lairObject.setOptionsBitmask(Options.ATTACKABLE); - lairObject.setPvPBitmask(PvpStatus.Attackable); - lairObject.setMaxDamage(1000 * level); + lairObject.setPvpBitmask(PvpStatus.Attackable); + lairObject.setMaximumCondition(1000 * level); LairActor lairActor = new LairActor(lairObject, lairTemplate.getMobileName(), 10, level); lairObject.setAttachment("AI", lairActor); diff --git a/src/services/trade/TradeService.java b/src/services/trade/TradeService.java index 08201aab..2b18e7b9 100644 --- a/src/services/trade/TradeService.java +++ b/src/services/trade/TradeService.java @@ -99,7 +99,7 @@ public class TradeService implements INetworkDispatch{ // creates a new trade session for the user who sent the request. It's given the objectID // that the player wants to trade with. - if (senderObject.getCombatFlag() == 0 && recieverObject.getCombatFlag() == 0) { + if (!senderObject.isInCombat() && !recieverObject.isInCombat()) { senderClient.getSession().setAttribute("tradeSession", recieverID); recieverObject.sendSystemMessage(senderObject.getCustomName() + " wants to trade with you.", (byte) 0);