diff --git a/scripts/buffs/buildabuff_inspiration.py b/scripts/buffs/buildabuff_inspiration.py index bfcff248..c6bf7407 100644 --- a/scripts/buffs/buildabuff_inspiration.py +++ b/scripts/buffs/buildabuff_inspiration.py @@ -10,18 +10,14 @@ def setup(core, actor, buff): buff.setDuration(3600) #1 hour - for BuffBuilder in buffWorkshop: - core.skillModService.addSkillMod(actor, BuffBuilder.getStatAffects(), BuffBuilder.getTotalAffected()) - print (' gave the skill mod ' + BuffBuilder.getStatAffects() + ' with affect of ' + str(BuffBuilder.getTotalAffected())) - return - + for BuffItem in buffWorkshop: + core.skillModService.addSkillMod(actor, BuffItem.getSkillName(), BuffItem.getAffectAmount()) + return def removeBuff(core, actor, buff): - for BuffBuilder in actor.getAttachment('buffWorkshop'): - core.skillModService.deductSkillMod(actor, BuffBuilder.getStatAffects(), BuffBuilder.getTotalAffected()) - print ('removed skill mod!') - return + for BuffItem in actor.getAttachment('buffWorkshop'): + core.skillModService.deductSkillMod(actor, BuffItem.getSkillName(), BuffItem.getAffectAmount()) actor.setAttachment('buffWorkshop', 'none') return \ No newline at end of file diff --git a/scripts/buffs/en_action_regen.py b/scripts/buffs/en_action_regen.py new file mode 100644 index 00000000..6193a43d --- /dev/null +++ b/scripts/buffs/en_action_regen.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'expertise_action_weapon_melee', 60) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'expertise_action_weapon_melee', 60) + return \ No newline at end of file diff --git a/scripts/buffs/en_debuff_thrill.py b/scripts/buffs/en_debuff_thrill.py new file mode 100644 index 00000000..69ced2d5 --- /dev/null +++ b/scripts/buffs/en_debuff_thrill.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'critical_hit_vulnerable', 2) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'critical_hit_vulnerable', 2) + return \ No newline at end of file diff --git a/scripts/buffs/en_debuff_thrill_1.py b/scripts/buffs/en_debuff_thrill_1.py new file mode 100644 index 00000000..0c399bb3 --- /dev/null +++ b/scripts/buffs/en_debuff_thrill_1.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'critical_hit_vulnerable', 4) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'critical_hit_vulnerable', 4) + return \ No newline at end of file diff --git a/scripts/buffs/en_debuff_thrill_2.py b/scripts/buffs/en_debuff_thrill_2.py new file mode 100644 index 00000000..0f533529 --- /dev/null +++ b/scripts/buffs/en_debuff_thrill_2.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'critical_hit_vulnerable', 6) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'critical_hit_vulnerable', 6) + return \ No newline at end of file diff --git a/scripts/buffs/en_spiral_kick_snare.py b/scripts/buffs/en_spiral_kick_snare.py new file mode 100644 index 00000000..82a33b29 --- /dev/null +++ b/scripts/buffs/en_spiral_kick_snare.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'movement', 5) + return + +def removeBuff(core, actor, buff): + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/en_sprint.py b/scripts/buffs/en_sprint.py new file mode 100644 index 00000000..842e0c3c --- /dev/null +++ b/scripts/buffs/en_sprint.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'movement_resist_snare', 100) + core.skillModService.addSkillMod(actor, 'movement', 5) + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'movement', 5) + core.skillModService.deductSkillMod(actor, 'movement_resist_snare', 100) + return + \ No newline at end of file diff --git a/scripts/buffs/en_sweeping_pirouette_root.py b/scripts/buffs/en_sweeping_pirouette_root.py new file mode 100644 index 00000000..32ba0f8d --- /dev/null +++ b/scripts/buffs/en_sweeping_pirouette_root.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'movement', 10) + return + +def removeBuff(core, actor, buff): + core.skillModService.addSkillMod(actor, 'movement', 10) + return \ No newline at end of file diff --git a/scripts/buffs/en_unhealthy_fixation_debuff.py b/scripts/buffs/en_unhealthy_fixation_debuff.py new file mode 100644 index 00000000..2ae015d2 --- /dev/null +++ b/scripts/buffs/en_unhealthy_fixation_debuff.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'en_unhealthy_stun', 1) + return + +def removeBuff(core, actor, buff): + core.skillModService.addSkillMod(actor, 'en_unhealthy_stun', 1) + return \ No newline at end of file diff --git a/scripts/buffs/en_void_dance_buff.py b/scripts/buffs/en_void_dance_buff.py new file mode 100644 index 00000000..c0318a09 --- /dev/null +++ b/scripts/buffs/en_void_dance_buff.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'expertise_glancing_blow_all', 60) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'expertise_glancing_blow_all', 60) + return \ No newline at end of file diff --git a/scripts/buffs/en_void_dance_buff_1.py b/scripts/buffs/en_void_dance_buff_1.py new file mode 100644 index 00000000..2c8f2ee9 --- /dev/null +++ b/scripts/buffs/en_void_dance_buff_1.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'expertise_glancing_blow_all', 65) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'expertise_glancing_blow_all', 65) + return \ No newline at end of file diff --git a/scripts/buffs/en_void_dance_buff_2.py b/scripts/buffs/en_void_dance_buff_2.py new file mode 100644 index 00000000..a6aa1d1f --- /dev/null +++ b/scripts/buffs/en_void_dance_buff_2.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'expertise_glancing_blow_all', 70) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'expertise_glancing_blow_all', 70) + return \ No newline at end of file diff --git a/scripts/buffs/en_void_dance_buff_3.py b/scripts/buffs/en_void_dance_buff_3.py new file mode 100644 index 00000000..c4674163 --- /dev/null +++ b/scripts/buffs/en_void_dance_buff_3.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'expertise_glancing_blow_all', 75) + + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'expertise_glancing_blow_all', 75) + return \ No newline at end of file diff --git a/scripts/buffs/fs_ae_dm_cc_0.py b/scripts/buffs/fs_ae_dm_cc_0.py index 493481d7..82a33b29 100644 --- a/scripts/buffs/fs_ae_dm_cc_0.py +++ b/scripts/buffs/fs_ae_dm_cc_0.py @@ -1,10 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(0.5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/fs_ae_dm_cc_1.py b/scripts/buffs/fs_ae_dm_cc_1.py index 493481d7..82a33b29 100644 --- a/scripts/buffs/fs_ae_dm_cc_1.py +++ b/scripts/buffs/fs_ae_dm_cc_1.py @@ -1,10 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(0.5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/fs_ae_dm_cc_2.py b/scripts/buffs/fs_ae_dm_cc_2.py index 493481d7..82a33b29 100644 --- a/scripts/buffs/fs_ae_dm_cc_2.py +++ b/scripts/buffs/fs_ae_dm_cc_2.py @@ -1,10 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(0.5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/fs_ae_dm_cc_3.py b/scripts/buffs/fs_ae_dm_cc_3.py index 493481d7..82a33b29 100644 --- a/scripts/buffs/fs_ae_dm_cc_3.py +++ b/scripts/buffs/fs_ae_dm_cc_3.py @@ -1,10 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(0.5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/fs_ae_dm_cc_4.py b/scripts/buffs/fs_ae_dm_cc_4.py index 493481d7..82a33b29 100644 --- a/scripts/buffs/fs_ae_dm_cc_4.py +++ b/scripts/buffs/fs_ae_dm_cc_4.py @@ -1,10 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(0.5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/fs_ae_dm_cc_5.py b/scripts/buffs/fs_ae_dm_cc_5.py index 493481d7..82a33b29 100644 --- a/scripts/buffs/fs_ae_dm_cc_5.py +++ b/scripts/buffs/fs_ae_dm_cc_5.py @@ -1,10 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(0.5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/fs_ae_dm_cc_6.py b/scripts/buffs/fs_ae_dm_cc_6.py index 493481d7..82a33b29 100644 --- a/scripts/buffs/fs_ae_dm_cc_6.py +++ b/scripts/buffs/fs_ae_dm_cc_6.py @@ -1,10 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(0.5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/fs_force_throw.py b/scripts/buffs/fs_force_throw.py index f20ef882..82a33b29 100644 --- a/scripts/buffs/fs_force_throw.py +++ b/scripts/buffs/fs_force_throw.py @@ -1,11 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', float(-0.5)) - + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', float(-0.5)) - return - \ No newline at end of file + core.skillModService.addSkillMod(actor, 'movement', 5) + return \ No newline at end of file diff --git a/scripts/buffs/of_ae_dm_cc_1.py b/scripts/buffs/of_ae_dm_cc_1.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_ae_dm_cc_1.py +++ b/scripts/buffs/of_ae_dm_cc_1.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_ae_dm_cc_2.py b/scripts/buffs/of_ae_dm_cc_2.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_ae_dm_cc_2.py +++ b/scripts/buffs/of_ae_dm_cc_2.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_ae_dm_cc_3.py b/scripts/buffs/of_ae_dm_cc_3.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_ae_dm_cc_3.py +++ b/scripts/buffs/of_ae_dm_cc_3.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_cc_melee_1.py b/scripts/buffs/of_cc_melee_1.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_cc_melee_1.py +++ b/scripts/buffs/of_cc_melee_1.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_cc_melee_2.py b/scripts/buffs/of_cc_melee_2.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_cc_melee_2.py +++ b/scripts/buffs/of_cc_melee_2.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_cc_melee_3.py b/scripts/buffs/of_cc_melee_3.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_cc_melee_3.py +++ b/scripts/buffs/of_cc_melee_3.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_cc_melee_4.py b/scripts/buffs/of_cc_melee_4.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_cc_melee_4.py +++ b/scripts/buffs/of_cc_melee_4.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_cc_melee_5.py b/scripts/buffs/of_cc_melee_5.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_cc_melee_5.py +++ b/scripts/buffs/of_cc_melee_5.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_cc_melee_6.py b/scripts/buffs/of_cc_melee_6.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_cc_melee_6.py +++ b/scripts/buffs/of_cc_melee_6.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_cc_melee_7.py b/scripts/buffs/of_cc_melee_7.py index 620bbaaa..82a33b29 100644 --- a/scripts/buffs/of_cc_melee_7.py +++ b/scripts/buffs/of_cc_melee_7.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', -5) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 15) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/of_vortex_root.py b/scripts/buffs/of_vortex_root.py index 5048a0be..32ba0f8d 100644 --- a/scripts/buffs/of_vortex_root.py +++ b/scripts/buffs/of_vortex_root.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - core.skillModService.addSkillMod(actor, 'movement', 0) + core.skillModService.deductSkillMod(actor, 'movement', 10) return def removeBuff(core, actor, buff): - core.skillModService.deductSkillMod(actor, 'movement', 10) + core.skillModService.addSkillMod(actor, 'movement', 10) return \ No newline at end of file diff --git a/scripts/buffs/sm_ae_dm_cc_1.py b/scripts/buffs/sm_ae_dm_cc_1.py index 18da7f78..82a33b29 100644 --- a/scripts/buffs/sm_ae_dm_cc_1.py +++ b/scripts/buffs/sm_ae_dm_cc_1.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/sm_ae_dm_cc_2.py b/scripts/buffs/sm_ae_dm_cc_2.py index 18da7f78..82a33b29 100644 --- a/scripts/buffs/sm_ae_dm_cc_2.py +++ b/scripts/buffs/sm_ae_dm_cc_2.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/sm_ae_dm_cc_3.py b/scripts/buffs/sm_ae_dm_cc_3.py index 18da7f78..82a33b29 100644 --- a/scripts/buffs/sm_ae_dm_cc_3.py +++ b/scripts/buffs/sm_ae_dm_cc_3.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/sm_ae_dm_cc_4.py b/scripts/buffs/sm_ae_dm_cc_4.py index 18da7f78..82a33b29 100644 --- a/scripts/buffs/sm_ae_dm_cc_4.py +++ b/scripts/buffs/sm_ae_dm_cc_4.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/sm_ae_dm_cc_5.py b/scripts/buffs/sm_ae_dm_cc_5.py index 18da7f78..82a33b29 100644 --- a/scripts/buffs/sm_ae_dm_cc_5.py +++ b/scripts/buffs/sm_ae_dm_cc_5.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.addSkillMod(actor, 'movement', 5) return \ No newline at end of file diff --git a/scripts/buffs/sm_ae_dm_cc_6.py b/scripts/buffs/sm_ae_dm_cc_6.py index 18da7f78..82a33b29 100644 --- a/scripts/buffs/sm_ae_dm_cc_6.py +++ b/scripts/buffs/sm_ae_dm_cc_6.py @@ -1,9 +1,9 @@ import sys def setup(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.deductSkillMod(actor, 'movement', 5) return def removeBuff(core, actor, buff): - actor.setSpeedMultiplierBase(1) + core.skillModService.addSkillMod(actor, 'movement', 5) 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 baf4621d..e185f733 100644 --- a/scripts/commands/co_first_aid_training.py +++ b/scripts/commands/co_first_aid_training.py @@ -4,6 +4,5 @@ def setup(): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'co_first_aid_training') 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 new file mode 100644 index 00000000..eee76225 --- /dev/null +++ b/scripts/commands/combat/en_spiral_kick_0.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_spiral_kick_1.py b/scripts/commands/combat/en_spiral_kick_1.py new file mode 100644 index 00000000..eee76225 --- /dev/null +++ b/scripts/commands/combat/en_spiral_kick_1.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_spiral_kick_2.py b/scripts/commands/combat/en_spiral_kick_2.py new file mode 100644 index 00000000..eee76225 --- /dev/null +++ b/scripts/commands/combat/en_spiral_kick_2.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_spiral_kick_3.py b/scripts/commands/combat/en_spiral_kick_3.py new file mode 100644 index 00000000..eee76225 --- /dev/null +++ b/scripts/commands/combat/en_spiral_kick_3.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_spiral_kick_4.py b/scripts/commands/combat/en_spiral_kick_4.py new file mode 100644 index 00000000..eee76225 --- /dev/null +++ b/scripts/commands/combat/en_spiral_kick_4.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_spiral_kick_snare') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_thrill.py b/scripts/commands/combat/en_thrill.py new file mode 100644 index 00000000..868b6bed --- /dev/null +++ b/scripts/commands/combat/en_thrill.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_debuff_thrill') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_thrill_1.py b/scripts/commands/combat/en_thrill_1.py new file mode 100644 index 00000000..c3fd3fc2 --- /dev/null +++ b/scripts/commands/combat/en_thrill_1.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_debuff_thrill_1') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_thrill_2.py b/scripts/commands/combat/en_thrill_2.py new file mode 100644 index 00000000..c3fd3fc2 --- /dev/null +++ b/scripts/commands/combat/en_thrill_2.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_debuff_thrill_1') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_thrill_3.py b/scripts/commands/combat/en_thrill_3.py new file mode 100644 index 00000000..2783c9d7 --- /dev/null +++ b/scripts/commands/combat/en_thrill_3.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_debuff_thrill_2') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_unhealthy_fixation.py b/scripts/commands/combat/en_unhealthy_fixation.py new file mode 100644 index 00000000..620dd09a --- /dev/null +++ b/scripts/commands/combat/en_unhealthy_fixation.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_unhealthy_fixation_debuff') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_void_dance.py b/scripts/commands/combat/en_void_dance.py new file mode 100644 index 00000000..2354238e --- /dev/null +++ b/scripts/commands/combat/en_void_dance.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_void_dance_buff') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_void_dance_1.py b/scripts/commands/combat/en_void_dance_1.py new file mode 100644 index 00000000..cdc97c59 --- /dev/null +++ b/scripts/commands/combat/en_void_dance_1.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_void_dance_buff_1') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_void_dance_2.py b/scripts/commands/combat/en_void_dance_2.py new file mode 100644 index 00000000..186e477a --- /dev/null +++ b/scripts/commands/combat/en_void_dance_2.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_void_dance_buff_2') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/en_void_dance_3.py b/scripts/commands/combat/en_void_dance_3.py new file mode 100644 index 00000000..77d58c3d --- /dev/null +++ b/scripts/commands/combat/en_void_dance_3.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, actor, target, command): + core.buffService.addBuffToCreature(target, 'en_void_dance_buff_3') + return + +def preRun(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_cc_crit_1.py b/scripts/commands/combat/fs_dm_cc_crit_1.py new file mode 100644 index 00000000..493481d7 --- /dev/null +++ b/scripts/commands/combat/fs_dm_cc_crit_1.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + actor.setSpeedMultiplierBase(0.5) + return + +def removeBuff(core, actor, buff): + actor.setSpeedMultiplierBase(1) + return + \ No newline at end of file diff --git a/scripts/commands/en_action_regen.py b/scripts/commands/en_action_regen.py new file mode 100644 index 00000000..c6905572 --- /dev/null +++ b/scripts/commands/en_action_regen.py @@ -0,0 +1,8 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + core.buffService.addBuffToCreature(actor, 'en_action_regen') + return \ No newline at end of file diff --git a/scripts/commands/en_sprint_1.py b/scripts/commands/en_sprint_1.py new file mode 100644 index 00000000..1393d38e --- /dev/null +++ b/scripts/commands/en_sprint_1.py @@ -0,0 +1,8 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + core.buffService.addBuffToCreature(actor, 'en_sprint') + return \ No newline at end of file diff --git a/scripts/commands/giveitem.py b/scripts/commands/giveitem.py index de894888..8279dc05 100644 --- a/scripts/commands/giveitem.py +++ b/scripts/commands/giveitem.py @@ -2,23 +2,23 @@ import sys def setup(): return - + def run(core, actor, target, commandString): - + if actor.getClient() and actor.getClient().isGM() == False: return - + if not commandString.startswith('object/tangible') and not commandString.startswith('object/weapon'): return - + object = core.objectService.createObject(commandString, actor.getPlanet()) if not object: return - + inventory = actor.getSlottedObject('inventory') - + if inventory: inventory.add(object) - + return \ No newline at end of file diff --git a/scripts/commands/inspire.py b/scripts/commands/inspire.py index 46a97aaf..531aa1e2 100644 --- a/scripts/commands/inspire.py +++ b/scripts/commands/inspire.py @@ -12,7 +12,6 @@ def run(core, actor, target, commandString): return if target is None or actor.getObjectId() == target.getObjectId(): - print ('Buffing Player: ' + str(target.getObjectId()) + ' or: ' + target.getCustomName()) openBuffWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), actor.getObjectId()) objController = ObjControllerMessage(11, openBuffWindow) actor.getClient().getSession().write(objController.serialize()) @@ -29,13 +28,16 @@ def run(core, actor, target, commandString): else: actor.sendSystemMessage('@performance:insp_buff_must_listen', 2) return - - print ('Buffing Player: ' + str(target.getObjectId()) + ' or: ' + target.getCustomName()) - openBuffWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), target.getObjectId()) - objController = ObjControllerMessage(11, openBuffWindow) + + if target.getPosition().getDistance2D(actor.getWorldPosition()) > float(20): + actor.sendSystemMessage(target.getCustomName() + ' is too far away to inspire.', 0) + return + + builderWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), target.getObjectId()) + objController = ObjControllerMessage(11, builderWindow) actor.getClient().getSession().write(objController.serialize()) - openBuffWindow = BuffBuilderStartMessage(target.getObjectId(), actor.getObjectId(), target.getObjectId()) - objController2 = ObjControllerMessage(11, openBuffWindow) + recipientWindow = BuffBuilderStartMessage(target.getObjectId(), actor.getObjectId(), target.getObjectId()) + objController2 = ObjControllerMessage(11, recipientWindow) target.getClient().getSession().write(objController2.serialize()) return diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index c4fd1f08..536a588b 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -1,5 +1,10 @@ import sys from engine.resources.scene import Point3D +from protocol.swg import CommPlayerMessage +from protocol.swg.objectControllerObjects import ShowLootBox +from protocol.swg import ObjControllerMessage +from engine.resources.objects import SWGObject +from jarray import array def setup(): return @@ -48,4 +53,24 @@ def run(core, actor, target, commandString): actor.addAbility(str(arg1)) actor.sendSystemMessage('You have learned ' + arg1 + '') + elif command == 'anim' and arg1: + actor.doSkillAnimation(arg1) + actor.sendSystemMessage('Performed ' + arg1 ,0) + + elif command == 'changeBio' and arg1: + actor.getSlottedObject('ghost').setBiography(arg1) + + elif command == 'rewardMe': + testObject = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_t21.iff', actor.getPlanet()) + testObject.setCustomName('Crush4r') + testObject.setStringAttribute('crafter', 'Wavescrub') + dGun = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_tc22_blaster.iff', actor.getPlanet()) + dGun.setCustomName('Supertoms Gun') + dGun.setStringAttribute('crafter', 'Wavescrub') + core.playerService.giveItems(actor, testObject, dGun) + return + + elif command == 'comm': + comm = CommPlayerMessage(actor.getObjectId()) + actor.getClient().getSession().write(comm.serialize()) return diff --git a/scripts/commands/watch.py b/scripts/commands/watch.py index 5658d8fb..0a9baf04 100644 --- a/scripts/commands/watch.py +++ b/scripts/commands/watch.py @@ -4,31 +4,36 @@ def setup(): return def run(core, actor, target, commandString): - if not target: - #FIXME: should accept name as a parameter. - # since that probably needs support in many places, - # best find a generic place for it in the server code - return + entSvc = core.entertainmentService + + if not target and commandString is not None: + target = core.chatService.getObjectByFirstName(commandString) + + if target is None: + return - if not target.isPlayer(): - actor.sendSystemMessage('@performance:dance_watch_npc') - return + if target.getPosition().getDistance2D(actor.getWorldPosition()) > float(20): + actor.sendSystemMessage(target.getCustomName() + ' is too far away to watch.', 0) + return - entSvc = core.entertainmentService - perf = entSvc.getPerformanceByIndex(target.getPerformanceId()) + if not target.isPlayer(): + actor.sendSystemMessage('@performance:dance_watch_npc', 0) + return - if target.getPosture() != 0x09 or not perf or perf.getDanceVisualId() < 0: - actor.sendSystemMessage('@performance:dance_watch_not_dancing',0) - return + perf = entSvc.getPerformanceByIndex(target.getPerformanceId()) - oldWatchee = actor.getPerformanceWatchee() - if oldWatchee and oldWatchee != target: - oldWatchee.removeAudience(actor) + if target.getPosture() != 0x09 or not perf or perf.getDanceVisualId() < 0: + actor.sendSystemMessage(target.getCustomName() + ' is not dancing.',0) + return - actor.setPerformanceWatchee(target) - target.addAudience(actor) - actor.setMoodAnimation('entertained') - actor.sendSystemMessage('@performance:dance_watch_self',0) - return + oldWatchee = actor.getPerformanceWatchee() + if oldWatchee and oldWatchee != target: + oldWatchee.removeAudience(actor) + actor.setPerformanceWatchee(target) + target.addAudience(actor) + core.entertainmentService.startSpectating(actor, target) + actor.setMoodAnimation('entertained') + actor.sendSystemMessage('You start watching ' + target.getCustomName() + '.',0) + return \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index dbb6cf0a..1483e4f7 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -323,16 +323,18 @@ public class NGECore { terrainService.addPlanet(11, "mustafar", "terrain/mustafar.trn", true); terrainService.addPlanet(12, "kashyyyk_main", "terrain/kashyyyk_main.trn", true); //Dungeon Terrains - terrainService.addPlanet(13, "kashyyyk_dead_forest", "terrain/kashyyyk_dead_forest.trn", true); + // TODO: Fix BufferUnderFlow Errors on loaded of dungeon instances. + /*terrainService.addPlanet(13, "kashyyyk_dead_forest", "terrain/kashyyyk_dead_forest.trn", true); terrainService.addPlanet(14, "kashyyyk_hunting", "terrain/kashyyyk_hunting.trn", true); terrainService.addPlanet(15, "kashyyyk_north_dungeons", "terrain/kashyyyk_north_dungeons.trn", true); terrainService.addPlanet(16, "kashyyyk_rryatt_trail", "terrain/kashyyyk_rryatt_trail.trn", true); terrainService.addPlanet(17, "kashyyyk_south_dungeons", "terrain/kashyyyk_south_dungeons.trn", true); terrainService.addPlanet(18, "adventure1", "terrain/adventure1.trn", true); terrainService.addPlanet(19, "adventure2", "terrain/adventure2.trn", true); - terrainService.addPlanet(20, "dungeon1", "terrain/dungeon1.trn", true); + terrainService.addPlanet(20, "dungeon1", "terrain/dungeon1.trn", true);*/ //Space Zones - terrainService.addPlanet(21, "space_corellia", "terrain/space_corellia.trn", true); + // NOTE: Commented out for now until space is implemented. No need to be loaded into memory when space is not implemented. + /*terrainService.addPlanet(21, "space_corellia", "terrain/space_corellia.trn", true); terrainService.addPlanet(22, "space_corellia_2", "terrain/space_corellia_2.trn", true); terrainService.addPlanet(23, "space_dantooine", "terrain/space_dantooine.trn", true); terrainService.addPlanet(24, "space_dathomir", "terrain/space_dathomir.trn", true); @@ -345,9 +347,9 @@ public class NGECore { terrainService.addPlanet(31, "space_lok", "terrain/space_lok.trn", true); terrainService.addPlanet(32, "space_naboo", "terrain/space_naboo.trn", true); terrainService.addPlanet(33, "space_naboo_2", "terrain/space_naboo_2.trn", true); - terrainService.addPlanet(34, "space_nova_orion", "terrain/space_nova_orion.trn", true); - terrainService.addPlanet(35, "space_npe_falcon", "terrain/space_npe_falcon.trn", true); - terrainService.addPlanet(36, "space_npe_falcon_2", "terrain/space_npe_falcon_2.trn", true); + terrainService.addPlanet(34, "space_nova_orion", "terrain/space_nova_orion.trn", true); + terrainService.addPlanet(35, "space_npe_falcon", "terrain/space_npe_falcon.trn", true); // TODO: New Player Tutorial + terrainService.addPlanet(36, "space_npe_falcon_2", "terrain/space_npe_falcon_2.trn", true); // TODO: New Player Tutorial terrainService.addPlanet(37, "space_ord_mantell", "terrain/space_ord_mantell.trn", true); terrainService.addPlanet(38, "space_ord_mantell_2", "terrain/space_ord_mantell_2.trn", true); terrainService.addPlanet(39, "space_ord_mantell_3", "terrain/space_ord_mantell_3.trn", true); @@ -356,11 +358,11 @@ public class NGECore { terrainService.addPlanet(42, "space_ord_mantell_6", "terrain/space_ord_mantell_6.trn", true); terrainService.addPlanet(43, "space_tatooine", "terrain/space_tatooine.trn", true); terrainService.addPlanet(44, "space_tatooine_2", "terrain/space_tatooine_2.trn", true); - terrainService.addPlanet(45, "space_yavin4", "terrain/space_yavin4.trn", true); + terrainService.addPlanet(45, "space_yavin4", "terrain/space_yavin4.trn", true);*/ //PSWG New Content Terrains (WARNING Keep commented out unless you have the current build of kaas!) - /* - terrainService.addPlanet(46, "kaas", "terrain/kaas.trn", true); - */ + + //terrainService.addPlanet(46, "kaas", "terrain/kaas.trn", true); + //end terrainList spawnService = new SpawnService(this); terrainService.loadClientPois(); diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index af68bbe7..a441cad4 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -55,8 +55,9 @@ public class ObjControllerMessage extends SWGMessage { public static final int SHOW_FLY_TEXT = 0x01BD; public static final int START_TASK = 0x448; public static final int ANIMATION = 0x00F2; - public static final int BUFF_BUILDER_START = 0x025C; public static final int BUFF_BUILDER_CHANGE = 0x025A; + public static final int BUFF_BUILDER_END = 0x025B; + public static final int BUFF_BUILDER_START = 0x025C; public static final int UI_PLAY_EFFECT = 0x0401; public static final int SHOW_LOOT_BOX = 0x04BC; diff --git a/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java b/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java index a877944a..ef067e9c 100644 --- a/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java +++ b/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java @@ -6,28 +6,26 @@ import java.util.Vector; import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.ObjControllerMessage; -import resources.common.ObjControllerOpcodes; -import resources.common.StringUtilities; import resources.objects.BuffItem; public class BuffBuilderChangeMessage extends ObjControllerObject { + private boolean accepted; private int buffCost; - private int time; + + private long bufferId; + private int buffRecipientAccepted; + private long buffRecipientId; private long objectId; - private long bufferId; - private long buffRecipientId; - - private boolean accepted; - private int buffRecipientAccepted; - private Vector statBuffs = new Vector(); - + + private int time; + public BuffBuilderChangeMessage() { - + } - + public BuffBuilderChangeMessage(long objectId, long bufferId, long buffRecipientId, Vector statBuffs) { this.objectId = objectId; this.bufferId = bufferId; @@ -35,136 +33,135 @@ public class BuffBuilderChangeMessage extends ObjControllerObject { this.statBuffs = statBuffs; } - + @Override - public void deserialize(IoBuffer buffer) { - setObjectId(buffer.getLong()); - buffer.getInt(); - setBufferId(buffer.getLong()); - setBuffRecipientId(buffer.getLong()); - setTime(buffer.getInt()); - setBuffCost(buffer.getInt()); - - byte value = buffer.get(); + public void deserialize(IoBuffer data) { + setObjectId(data.getLong()); + data.getInt(); + setBufferId(data.getLong()); + setBuffRecipientId(data.getLong()); + setTime(data.getInt()); + setBuffCost(data.getInt()); + + byte value = data.get(); if (value == (byte) 0) setAccepted(false); else if (value == (byte) 1) setAccepted(true); - - setBuffRecipientAccepted(buffer.getInt()); - - int statSize = buffer.getInt(); + + setBuffRecipientAccepted(data.getInt()); + + int statSize = data.getInt(); for (int i = 0; i < statSize; i++) { BuffItem item = new BuffItem(); - - String statName = getAsciiString(buffer); + + String statName = getAsciiString(data); item.setSkillName(statName); - - int investedPoints = buffer.getInt(); + + int investedPoints = data.getInt(); item.setInvested(investedPoints); - - int maxAmount = buffer.getInt(); - item.setBonusAmount(maxAmount); - + + int entBonus = data.getInt(); + item.setEntertainerBonus(entBonus); + statBuffs.add(item); - System.out.println("Added buff item with " + investedPoints + " invested points " + " which has a bonus amount of " + maxAmount); } } - @Override - public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(65 + statBuffs.size()).order(ByteOrder.LITTLE_ENDIAN); - result.setAutoExpand(true); - - result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE); - result.putLong(objectId); - - result.putInt(0); - - result.putLong(bufferId); - result.putLong(buffRecipientId); - - result.putInt(time); - result.putInt(buffCost); - - result.put((byte) ((accepted) ? 1 : 0)); - result.putInt(buffRecipientAccepted); - - result.putInt(statBuffs.size()); - - if (!statBuffs.isEmpty()) { - for (BuffItem item : statBuffs) { - result.put(getAsciiString(item.getSkillName())); - result.putInt(item.getInvested()); - result.putInt(item.getBonusAmount()); - } - } - - return result.flip(); - } - - public int getBuffCost() { - return buffCost; - } - - public void setBuffCost(int buffCost) { - this.buffCost = buffCost; - } - - public int getTime() { - return time; - } - - public void setTime(int time) { - this.time = time; - } - - public long getObjectId() { - return objectId; - } - - public void setObjectId(long objectId) { - this.objectId = objectId; - } - - public long getBufferId() { - return bufferId; - } - - public void setBufferId(long bufferId) { - this.bufferId = bufferId; - } - - public long getBuffRecipientId() { - return buffRecipientId; - } - - public void setBuffRecipientId(long buffRecipientId) { - this.buffRecipientId = buffRecipientId; - } - public boolean getAccepted() { return accepted; } - public void setAccepted(boolean accepted) { - this.accepted = accepted; + public int getBuffCost() { + return buffCost; + } + + public long getBufferId() { + return bufferId; } public int getBuffRecipientAccepted() { return buffRecipientAccepted; } - public void setBuffRecipientAccepted(int buffRecipientAccepted) { - this.buffRecipientAccepted = buffRecipientAccepted; + public long getBuffRecipientId() { + return buffRecipientId; + } + + public long getObjectId() { + return objectId; } public Vector getStatBuffs() { return statBuffs; } + public int getTime() { + return time; + } + + @Override + public IoBuffer serialize() { + IoBuffer result = IoBuffer.allocate(65 + statBuffs.size()).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + + result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE); + result.putLong(objectId); + + result.putInt(0); + + result.putLong(bufferId); + result.putLong(buffRecipientId); + + result.putInt(time); + result.putInt(buffCost); + + result.put((byte) ((accepted) ? 1 : 0)); + result.putInt(buffRecipientAccepted); + + result.putInt(statBuffs.size()); + + if (!statBuffs.isEmpty()) { + for (BuffItem item : statBuffs) { + result.put(getAsciiString(item.getSkillName())); + result.putInt(item.getInvested()); + result.putInt(item.getEntertainerBonus()); + } + } + + return result.flip(); + } + + public void setAccepted(boolean accepted) { + this.accepted = accepted; + } + + public void setBuffCost(int buffCost) { + this.buffCost = buffCost; + } + + public void setBufferId(long bufferId) { + this.bufferId = bufferId; + } + + public void setBuffRecipientAccepted(int buffRecipientAccepted) { + this.buffRecipientAccepted = buffRecipientAccepted; + } + + public void setBuffRecipientId(long buffRecipientId) { + this.buffRecipientId = buffRecipientId; + } + + public void setObjectId(long objectId) { + this.objectId = objectId; + } + public void setStatBuffs(Vector statBuffs) { this.statBuffs = statBuffs; } + public void setTime(int time) { + this.time = time; + } + } diff --git a/src/protocol/swg/objectControllerObjects/BuffBuilderEndMessage.java b/src/protocol/swg/objectControllerObjects/BuffBuilderEndMessage.java new file mode 100644 index 00000000..96a959db --- /dev/null +++ b/src/protocol/swg/objectControllerObjects/BuffBuilderEndMessage.java @@ -0,0 +1,197 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg.objectControllerObjects; + +import java.nio.ByteOrder; +import java.util.Vector; + +import org.apache.mina.core.buffer.IoBuffer; + +import protocol.swg.ObjControllerMessage; +import resources.objects.BuffItem; + +public class BuffBuilderEndMessage extends ObjControllerObject { + + private boolean accepted; + private int buffCost; + + private long bufferId; + private int buffRecipientAccepted; + private long buffRecipientId; + + private long objectId; + private Vector statBuffs = new Vector(); + + private int time; + + public BuffBuilderEndMessage() { + + } + + public BuffBuilderEndMessage(BuffBuilderEndMessage endMessage) { + this.buffCost = endMessage.getBuffCost(); + this.time = endMessage.getTime(); + this.accepted = endMessage.getAccepted(); + this.buffRecipientAccepted = endMessage.getBuffRecipientAccepted(); + this.statBuffs = endMessage.getStatBuffs(); + } + + public BuffBuilderEndMessage(BuffBuilderChangeMessage changeMessage) { + this.buffRecipientId = changeMessage.getBuffRecipientId(); + this.bufferId = changeMessage.getBufferId(); + this.buffCost = changeMessage.getBuffCost(); + this.time = changeMessage.getTime(); + this.accepted = changeMessage.getAccepted(); + this.buffRecipientAccepted = changeMessage.getBuffRecipientAccepted(); + this.statBuffs = changeMessage.getStatBuffs(); + } + @Override + public void deserialize(IoBuffer data) { + setObjectId(data.getLong()); + data.getInt(); + setBufferId(data.getLong()); + setBuffRecipientId(data.getLong()); + setTime(data.getInt()); + setBuffCost(data.getInt()); + + byte value = data.get(); + if (value == (byte) 0) + setAccepted(false); + else if (value == (byte) 1) + setAccepted(true); + + setBuffRecipientAccepted(data.getInt()); + + int statSize = data.getInt(); + for (int i = 0; i < statSize; i++) { + BuffItem item = new BuffItem(); + + String statName = getAsciiString(data); + item.setSkillName(statName); + + int investedPoints = data.getInt(); + item.setInvested(investedPoints); + + int entBonus = data.getInt(); + item.setEntertainerBonus(entBonus); + + statBuffs.add(item); + } + } + + public boolean getAccepted() { + return accepted; + } + + public int getBuffCost() { + return buffCost; + } + + public long getBufferId() { + return bufferId; + } + + public int getBuffRecipientAccepted() { + return buffRecipientAccepted; + } + + public long getBuffRecipientId() { + return buffRecipientId; + } + + public long getObjectId() { + return objectId; + } + + public Vector getStatBuffs() { + return statBuffs; + } + + public int getTime() { + return time; + } + + @Override + public IoBuffer serialize() { + IoBuffer result = IoBuffer.allocate(65 + statBuffs.size()).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + + result.putInt(ObjControllerMessage.BUFF_BUILDER_END); + result.putLong(objectId); + + result.putInt(0); + + result.putLong(bufferId); + result.putLong(buffRecipientId); + + result.putInt(time); + result.putInt(buffCost); + + result.put((byte) ((accepted) ? 1 : 0)); + result.putInt(buffRecipientAccepted); + + result.putInt(statBuffs.size()); + + if (!statBuffs.isEmpty()) { + for (BuffItem item : statBuffs) { + result.put(getAsciiString(item.getSkillName())); + result.putInt(item.getInvested()); + result.putInt(item.getEntertainerBonus()); + } + } + + return result.flip(); + } + + public void setAccepted(boolean accepted) { + this.accepted = accepted; + } + + public void setBuffCost(int buffCost) { + this.buffCost = buffCost; + } + + public void setBufferId(long bufferId) { + this.bufferId = bufferId; + } + + public void setBuffRecipientAccepted(int buffRecipientAccepted) { + this.buffRecipientAccepted = buffRecipientAccepted; + } + + public void setBuffRecipientId(long buffRecipientId) { + this.buffRecipientId = buffRecipientId; + } + + public void setObjectId(long objectId) { + this.objectId = objectId; + } + + public void setStatBuffs(Vector statBuffs) { + this.statBuffs = statBuffs; + } + + public void setTime(int time) { + this.time = time; + } + +} diff --git a/src/resources/common/BuffBuilder.java b/src/resources/common/BuffBuilder.java index c376ae5a..83b2d9fb 100644 --- a/src/resources/common/BuffBuilder.java +++ b/src/resources/common/BuffBuilder.java @@ -1,70 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ package resources.common; public class BuffBuilder { - private String statName; - private String statAffects; - private int maxTimesApplied; private int affectAmount; - private String requiredExperience; - - private int entBonus; - + private String category; + private int cost; + private int maxTimesApplied; + private String requiredExpertise; + private String statAffects; + private String statName; + public BuffBuilder() { - - } - public String getStatName() { - return statName; - } - - public void setStatName(String statName) { - this.statName = statName; - } - - public String getStatAffects() { - return statAffects; - } - - public void setStatAffects(String statAffects) { - this.statAffects = statAffects; - } - - public int getMaxTimesApplied() { - return maxTimesApplied; - } - - public void setMaxTimesApplied(int maxTimesApplied) { - this.maxTimesApplied = maxTimesApplied; } public int getAffectAmount() { return affectAmount; } + public String getCategory() { + return category; + } + + public int getCost() { + return this.cost; + } + + public int getMaxTimesApplied() { + return maxTimesApplied; + } + + public String getRequiredExpertise() { + return requiredExpertise; + } + + public String getStatAffects() { + return statAffects; + } + + public String getStatName() { + return statName; + } + public void setAffectAmount(int affectAmount) { this.affectAmount = affectAmount; } - public String getRequiredExperience() { - return requiredExperience; + public void setCategory(String category) { + this.category = category; } - public void setRequiredExperience(String requiredExperience) { - this.requiredExperience = requiredExperience; - } - - public int getTotalAffected() { - // 10 * 10 = 100 - int totalAffected = getMaxTimesApplied() * getAffectAmount(); - Console.println("Total Affected: " + totalAffected + getEntBonus()); - return totalAffected + getEntBonus(); + public void setCost(int cost) { + this.cost = cost; } - public int getEntBonus() { - return entBonus; + public void setMaxTimesApplied(int maxTimesApplied) { + this.maxTimesApplied = maxTimesApplied; } - public void setEntBonus(int entBonus) { - this.entBonus = entBonus; + public void setRequiredExpertise(String requiredExpertise) { + this.requiredExpertise = requiredExpertise; + } + + public void setStatAffects(String statAffects) { + this.statAffects = statAffects; + } + + public void setStatName(String statName) { + this.statName = statName; } } diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 5834038e..0317dfd0 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -32,6 +32,7 @@ public class ObjControllerOpcodes { public static final int OBJECT_MENU_REQUEST = 0x46010000; public static final int SECURE_TRADE = 0x15010000; public static final int BUFF_BUILDER_CHANGE = 0x5A020000; + public static final int BUFF_BUILDER_END = 0x5B020000; public static final int MISSION_LIST_REQUEST = 0xF5000000; public static final int ChangeRoleIconChoice = 0x4D040000; } diff --git a/src/resources/objects/BuffItem.java b/src/resources/objects/BuffItem.java index 8d647d4a..050c21e9 100644 --- a/src/resources/objects/BuffItem.java +++ b/src/resources/objects/BuffItem.java @@ -16,47 +16,56 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * - * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. ******************************************************************************/ package resources.objects; public class BuffItem { - private String skillName; + private int affectAmount; + private int entertainerBonus; private int invested; - private int bonusAmount; // expertise bonus (50%*4 = 200) which would then result in bonusAmount + (maxTimesApplied * affectAmount) = result - + private String skillName; + public BuffItem() { - + } - - public BuffItem(String skillName, int invested, int amount) { + + public BuffItem(String skillName, int invested, int entBonus) { this.skillName = skillName; this.invested = invested; - this.bonusAmount = amount; + this.entertainerBonus = entBonus; } - public String getSkillName() { - return skillName; + public int getAffectAmount() { + return affectAmount; } - public void setSkillName(String skillName) { - this.skillName = skillName; + public int getEntertainerBonus() { + return entertainerBonus; } public int getInvested() { return invested; } + public String getSkillName() { + return skillName; + } + + public void setAffectAmount(int amount) { + this.affectAmount = amount; + } + + public void setEntertainerBonus(int entertainerBonus) { + this.entertainerBonus = entertainerBonus; + } + public void setInvested(int invested) { this.invested = invested; } - public int getBonusAmount() { - return bonusAmount; - } - - public void setBonusAmount(int amount) { - this.bonusAmount = amount; + public void setSkillName(String skillName) { + this.skillName = skillName; } } diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 56239f1c..19d60409 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -159,6 +159,9 @@ public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent private ScheduledFuture inspirationTick; + @NotPersistent + private ScheduledFuture spectatorTask; + private boolean staticNPC = false; // temp @NotPersistent private int flourishCount = 0; @@ -411,6 +414,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { } if (next == this) { continue; } next.sendSystemMessage("@performance:" + type + "_stop_other",(byte)0); + next.getSpectatorTask().cancel(true); } //not sure if this behaviour is correct. might need fixing later. performanceAudience = new SWGList(); @@ -1617,5 +1621,16 @@ public class CreatureObject extends TangibleObject implements IPersistent { this.appearanceEquipmentListUpdateCounter = appearanceEquipmentListUpdateCounter; } } - + + public ScheduledFuture getSpectatorTask() { + synchronized(objectMutex) { + return spectatorTask; + } + } + + public void setSpectatorTask(ScheduledFuture spectatorTask) { + synchronized(objectMutex) { + this.spectatorTask = spectatorTask; + } + } } diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 2735c475..7ea0ff18 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -232,8 +232,8 @@ public class PlayerObject extends IntangibleObject { synchronized(objectMutex) { xpExists = xpList.containsKey(type); xpList.put(type, amount); - Console.println("Put " + type + " exp of " + amount + " in the map."); - Console.println("Map is now: " + xpList.get(type).intValue()); + //Console.println("Put " + type + " exp of " + amount + " in the map."); + //Console.println("Map is now: " + xpList.get(type).intValue()); } if (getContainer() != null && getContainer().getClient() != null && getContainer().getClient().getSession() != null) { diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index 2f6adb3b..a57d486d 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -19,11 +19,13 @@ import org.apache.mina.core.session.IoSession; import protocol.swg.ObjControllerMessage; import protocol.swg.OkMessage; import protocol.swg.objectControllerObjects.BuffBuilderChangeMessage; +import protocol.swg.objectControllerObjects.BuffBuilderEndMessage; import protocol.swg.objectControllerObjects.BuffBuilderStartMessage; import resources.common.BuffBuilder; import resources.common.Console; import resources.common.ObjControllerOpcodes; import resources.common.Performance; +import resources.common.StringUtilities; import resources.objects.Buff; import resources.objects.BuffItem; import resources.objects.creature.CreatureObject; @@ -55,52 +57,103 @@ public class EntertainmentService implements INetworkDispatch { @Override public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + objControllerOpcodes.put(ObjControllerOpcodes.BUFF_BUILDER_END, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + data.order(ByteOrder.LITTLE_ENDIAN); + StringUtilities.printBytes(data.array()); + Client client = core.getClient(session); + + if(client == null) + return; + + SWGObject sender = client.getParent(); + + if(sender == null) + return; + + BuffBuilderEndMessage sentPacket = new BuffBuilderEndMessage(); + sentPacket.deserialize(data); + + SWGObject buffer = core.objectService.getObject(sentPacket.getBufferId()); + SWGObject buffRecipient = core.objectService.getObject(sentPacket.getBuffRecipientId()); + + if(buffer == null || buffRecipient == null) + return; + + // No need to send end packet when buffing yourself. + if (buffRecipient != buffer) { + if(buffRecipient.getClient() == null || buffRecipient.getClient().getSession() == null) + return; + + if (sender.getObjectId() == buffer.getObjectId()) { + // send close packet to recipient + BuffBuilderEndMessage end = new BuffBuilderEndMessage(sentPacket); + end.setObjectId(buffRecipient.getObjectId()); + + end.setBufferId(buffer.getObjectId()); + end.setBuffRecipientId(buffRecipient.getObjectId()); + + ObjControllerMessage closeMessage = new ObjControllerMessage(0x0B, end); + buffRecipient.getClient().getSession().write(closeMessage.serialize()); + + } + if (sender.getObjectId() == buffRecipient.getObjectId()) { + // send close packet to buffer + BuffBuilderEndMessage end = new BuffBuilderEndMessage(sentPacket); + end.setObjectId(buffer.getObjectId()); + + end.setBufferId(buffer.getObjectId()); + end.setBuffRecipientId(buffRecipient.getObjectId()); + + ObjControllerMessage closeMessage = new ObjControllerMessage(0x0B, end); + buffer.getClient().getSession().write(closeMessage.serialize()); + CreatureObject cre = (CreatureObject) buffer; + cre.sendSystemMessage("The buff recipient cancelled the buff builder session.", (byte) 0); + } + } + } + }); + objControllerOpcodes.put(ObjControllerOpcodes.BUFF_BUILDER_CHANGE, new INetworkRemoteEvent() { @Override public void handlePacket(IoSession session, IoBuffer data) throws Exception { - Console.println("BUFF_BUILDER_CHANGE RECIEVED"); data.order(ByteOrder.LITTLE_ENDIAN); - + Client client = core.getClient(session); - + if(client == null) return; - + SWGObject sender = client.getParent(); - + if(sender == null) return; - + BuffBuilderChangeMessage sentPacket = new BuffBuilderChangeMessage(); sentPacket.deserialize(data); Vector statBuffs = sentPacket.getStatBuffs(); - - /*for (BuffItem item : statBuffs) { - System.out.println("Buff Name: " + item.getSkillName()); - System.out.println("Ents bonus to item: " + item.getAmount()); - }*/ - + SWGObject buffer = core.objectService.getObject(sentPacket.getBufferId()); SWGObject buffRecipient = core.objectService.getObject(sentPacket.getBuffRecipientId()); - - Console.println("Packet Sender ID: " + sender.getObjectId()); - + if (buffer != buffRecipient) { - + BuffBuilderChangeMessage changeMessage = new BuffBuilderChangeMessage(); changeMessage.setBuffCost(sentPacket.getBuffCost()); changeMessage.setTime(sentPacket.getTime()); changeMessage.setBufferId(buffer.getObjectId()); changeMessage.setBuffRecipientId(buffRecipient.getObjectId()); - + if (!statBuffs.isEmpty()) changeMessage.setStatBuffs(statBuffs); - + if (sentPacket.getAccepted() == true && sentPacket.getBuffRecipientAccepted() == 1) { - System.out.println("both accepted!"); - + if (sentPacket.getBuffCost() > 0) { CreatureObject recipientCreature = (CreatureObject) buffRecipient; if (recipientCreature.getCashCredits() >= sentPacket.getBuffCost()) { @@ -109,36 +162,47 @@ public class EntertainmentService implements INetworkDispatch { return; } } - - OkMessage closeMsg = new OkMessage(); - buffer.getClient().getSession().write(closeMsg.serialize()); - + giveInspirationBuff(buffRecipient, statBuffs); - + + BuffBuilderEndMessage endBuilder = new BuffBuilderEndMessage(changeMessage); + endBuilder.setObjectId(buffer.getObjectId()); + + BuffBuilderEndMessage endRecipient = new BuffBuilderEndMessage(changeMessage); + endRecipient.setObjectId(buffRecipient.getObjectId()); + + ObjControllerMessage closeBuilder = new ObjControllerMessage(0x0B, endBuilder); + buffer.getClient().getSession().write(closeBuilder.serialize()); + + ObjControllerMessage closeRecipient = new ObjControllerMessage(0x0B, endRecipient); + buffRecipient.getClient().getSession().write(closeRecipient.serialize()); + } else if (sentPacket.getAccepted() == true && sentPacket.getBuffRecipientAccepted() == 0) { changeMessage.setAccepted(true); changeMessage.setObjectId(buffRecipient.getObjectId()); - + ObjControllerMessage objMsg = new ObjControllerMessage(0x0B, changeMessage); buffRecipient.getClient().getSession().write(objMsg.serialize()); } else { changeMessage.setAccepted(false); changeMessage.setObjectId(sentPacket.getBuffRecipientId()); - + ObjControllerMessage objMsg = new ObjControllerMessage(0x0B, changeMessage); buffRecipient.getClient().getSession().write(objMsg.serialize()); } - + } else { if (sentPacket.getAccepted() == true) { - OkMessage closeMsg = new OkMessage(); - buffer.getClient().getSession().write(closeMsg.serialize()); - giveInspirationBuff(buffRecipient, statBuffs); + BuffBuilderEndMessage endBuilder = new BuffBuilderEndMessage(sentPacket); + endBuilder.setObjectId(buffer.getObjectId()); + + ObjControllerMessage objMsg = new ObjControllerMessage(0x0B, endBuilder); + buffRecipient.getClient().getSession().write(objMsg.serialize()); } } } - + }); } @@ -202,17 +266,21 @@ public class EntertainmentService implements INetworkDispatch { for (int r = 0; r < buffBuilder.getRowCount(); r++) { String skillName = ((String) buffBuilder.getObject(r, 0)); + String category = ((String) buffBuilder.getObject(r, 1)); String statAffects = ((String) buffBuilder.getObject(r, 2)); int maxTimes = ((int) buffBuilder.getObject(r, 3)); + int cost = ((int) buffBuilder.getObject(r, 4)); int affectAmount = ((int) buffBuilder.getObject(r, 5)); - String requiredExperience = ((String) buffBuilder.getObject(r, 6)); + String requiredExpertise = ((String) buffBuilder.getObject(r, 6)); BuffBuilder item = new BuffBuilder(); item.setStatName(skillName); + item.setCategory(category); item.setStatAffects(statAffects); item.setMaxTimesApplied(maxTimes); + item.setCost(cost); item.setAffectAmount(affectAmount); - item.setRequiredExperience(requiredExperience); + item.setRequiredExpertise(requiredExpertise); buffBuilderSkills.add(item); } @@ -235,22 +303,34 @@ public class EntertainmentService implements INetworkDispatch { public void giveInspirationBuff(SWGObject reciever, Vector buffVector) { CreatureObject buffCreature = (CreatureObject) reciever; - Vector availableSkills = buffBuilderSkills; - - Vector buffsToAdd = new Vector(); - + Vector availableStats = buffBuilderSkills; + Vector stats = new Vector(); + for (BuffItem item : buffVector) { - for (BuffBuilder builder : availableSkills) { - if (builder.getStatName().equals(item.getSkillName())) { - builder.setEntBonus(item.getBonusAmount()); - buffsToAdd.add(builder); - Console.println("Added buff item: " + builder.getStatAffects() + " with total affect of " + builder.getTotalAffected() + " and ent bonus of " + builder.getEntBonus()); - continue; + for(BuffBuilder builder : availableStats) { + if(builder.getStatName().equalsIgnoreCase(item.getSkillName())) { + if(builder.getMaxTimesApplied() < item.getInvested()) + return; + + // Ent. Expertise Percent + (invested points * affect amount) = stat + int bonusPoints = (int) (builder.getAffectAmount() *((float) item.getEntertainerBonus()/100f)); + int affectTotal = bonusPoints + (item.getInvested() * builder.getAffectAmount()); + + BuffItem stat = new BuffItem(builder.getStatAffects(), item.getInvested(), item.getEntertainerBonus()); + stat.setAffectAmount(affectTotal); + + /*System.out.println("Invested Points: " + item.getInvested()); + System.out.println("Entertainer Bonus: " + item.getEntertainerBonus()); + System.out.println("Affect Total: " + affectTotal);*/ + + stats.add(stat); + + break; } } } - reciever.setAttachment("buffWorkshop", buffsToAdd); + reciever.setAttachment("buffWorkshop", buffVector); core.buffService.addBuffToCreature(buffCreature, "buildabuff_inspiration"); @@ -342,6 +422,36 @@ public class EntertainmentService implements INetworkDispatch { } + public void startSpectating(final CreatureObject spectator, final CreatureObject performer) { + final ScheduledFuture spectatorTask = scheduler.scheduleAtFixedRate(new Runnable() { + + @Override + public void run() { + if (spectator.getPosition().getDistance2D(performer.getWorldPosition()) > (float) 70) { + + String pType = (performer.getPerformanceType()) ? "dance" : "music"; + if(pType.equals("dance")) { + spectator.setPerformanceWatchee(null); + spectator.sendSystemMessage("You stop watching " + performer.getCustomName() + " because " + performer.getCustomName() + + " is out of range.", (byte) 0); + } + else { + spectator.setPerformanceListenee(null); + spectator.sendSystemMessage("You stop listening to " + performer.getCustomName() + " because " + performer.getCustomName() + + " is out of range.", (byte) 0); + } + spectator.setMoodAnimation("neutral"); + performer.removeAudience(spectator); + + spectator.getSpectatorTask().cancel(true); + } + } + + }, 2, 2, TimeUnit.SECONDS); + + spectator.setSpectatorTask(spectatorTask); + } + @Override public void shutdown() { diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 2bd76a4f..356193c9 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -553,6 +553,9 @@ public class ChatService implements INetworkDispatch { public SWGObject getObjectByFirstName(String name) { ConcurrentHashMap clients = core.getActiveConnectionsMap(); + if(name.contains(" ")) + name = name.split(" ")[0]; + for(Client client : clients.values()) { if(client.getParent() == null) continue; diff --git a/src/services/collections/CollectionService.java b/src/services/collections/CollectionService.java index 025307e5..15567a6b 100644 --- a/src/services/collections/CollectionService.java +++ b/src/services/collections/CollectionService.java @@ -71,7 +71,7 @@ public class CollectionService implements INetworkDispatch { } } - /* + /** * @see datatables/collection/collections.iff * * Count and exploration count badges are added automatically. @@ -417,7 +417,7 @@ public class CollectionService implements INetworkDispatch { return false; } - /* + /** * @param creature The player's CreatureObject instance. * @param collection slotName or collectionName from collection.iff. * @@ -497,7 +497,7 @@ public class CollectionService implements INetworkDispatch { return false; } - /* + /** * Returns number of completed bits in a slot or the number of completed * slots in a collection, page or book. * @@ -623,7 +623,8 @@ public class CollectionService implements INetworkDispatch { return 0; } - /* + + /** * Registers an exploration badge location. * * @param planet Name from Planet.getName(). @@ -640,7 +641,7 @@ public class CollectionService implements INetworkDispatch { explorationLocations.get(planet).put(badgeName, new ExplorationRegion(new Point3D(x, 0, z), range)); } - /* + /** * Checks if the player is in range of any exploration regions * and grants any ungranted badges. * @@ -660,7 +661,7 @@ public class CollectionService implements INetworkDispatch { } } - /* + /** * Clears the specified slot, collection, page or book. * * @param creature The player's CreatureObject instance. @@ -749,7 +750,7 @@ public class CollectionService implements INetworkDispatch { return false; } - /* + /** * Clears all collections. * * This must cycle through all the collections because