From 6e30ac0a0d6662c4ad93c96644e914e34904c827 Mon Sep 17 00:00:00 2001 From: Treeku Date: Fri, 14 Mar 2014 16:18:16 +0000 Subject: [PATCH 01/36] Commented a spammy message --- src/services/collections/CollectionService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/collections/CollectionService.java b/src/services/collections/CollectionService.java index 61671372..ba063de9 100644 --- a/src/services/collections/CollectionService.java +++ b/src/services/collections/CollectionService.java @@ -289,7 +289,7 @@ public class CollectionService implements INetworkDispatch { } } else { if (numAltTitles > 0 || alternateTitles.length > 0) { - System.out.println(slotName + ": slot " + slotName + " cannot have any alternative titles unless it is defined as \"titleable\""); + //System.out.println(slotName + ": slot " + slotName + " cannot have any alternative titles unless it is defined as \"titleable\""); } } From fae3847b640d2fc64d1d52f9fc1bab4f942ba2cf Mon Sep 17 00:00:00 2001 From: Treeku Date: Fri, 14 Mar 2014 16:47:42 +0000 Subject: [PATCH 02/36] Evaluation improvements for collections --- .../collections/CollectionService.java | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/services/collections/CollectionService.java b/src/services/collections/CollectionService.java index ba063de9..025307e5 100644 --- a/src/services/collections/CollectionService.java +++ b/src/services/collections/CollectionService.java @@ -185,17 +185,17 @@ public class CollectionService implements INetworkDispatch { ((String) collectionTable.getObject(c, 32)) }; - if (bookName == "") { + if (bookName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); throw new Exception(); } - if (pageName == "") { + if (pageName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); throw new Exception(); } - if (collectionName == "") { + if (collectionName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); throw new Exception(); } @@ -460,30 +460,30 @@ public class CollectionService implements INetworkDispatch { if (slotName.equals(collection)) { int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); - if (bookName == "") { + if (bookName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); throw new Exception(); } - if (pageName == "") { + if (pageName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); throw new Exception(); } - if (collectionName == "") { + if (collectionName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); throw new Exception(); } - if (collection == bookName) { + if (collection.equals(bookName)) { System.out.println("Checking if a book is complete is unsupported at this time."); throw new Exception(); - } else if (collection == pageName) { + } else if (collection.equals(pageName)) { System.out.println("Checking if a page is complete is unsupported at this time."); throw new Exception(); - } else if (collection == collectionName) { + } else if (collection.equals(collectionName)) { return collections.get(beginSlotId); - } else if (collection == slotName) { + } else if (collection.equals(slotName)) { return collections.get(beginSlotId); } } @@ -545,34 +545,34 @@ public class CollectionService implements INetworkDispatch { int maxSlotValue = ((Integer) collectionTable.getObject(c, 6)); int bits = 0; - if (bookName == "") { + if (bookName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); throw new Exception(); } - if (pageName == "") { + if (pageName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); throw new Exception(); } - if (collectionName == "") { + if (collectionName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); throw new Exception(); } - if (collection == bookName) { + if (collection.equals(bookName)) { found += getCollection(creature, pageName); continue; - } else if (collection == pageName) { + } else if (collection.equals(pageName)) { found += getCollection(creature, collectionName); continue; - } else if (collection == collectionName) { + } else if (collection.equals(collectionName)) { if (collections.get(beginSlotId)) { found++; } continue; - } else if (collection == slotName) { + } else if (collection.equals(slotName)) { if (endSlotId != -1) { if (beginSlotId >= endSlotId) { System.out.println(slotName + ", row " + c + ": begin slot id " + beginSlotId + " must be < end slot id" + endSlotId); @@ -705,23 +705,23 @@ public class CollectionService implements INetworkDispatch { int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); int endSlotId = ((Integer) collectionTable.getObject(c, 5)); - if (bookName == "") { + if (bookName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); throw new Exception(); } - if (pageName == "") { + if (pageName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); throw new Exception(); } - if (collectionName == "") { + if (collectionName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); throw new Exception(); } - if (collection == bookName || collection == pageName || - collection == collectionName || collection == slotName) { + if (collection.equals(bookName) || collection.equals(pageName) || + collection.equals(collectionName) || collection.equals(slotName)) { found = true; if (collections.get(beginSlotId, endSlotId + 1).cardinality() > 0) { @@ -794,17 +794,17 @@ public class CollectionService implements INetworkDispatch { int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); int endSlotId = ((Integer) collectionTable.getObject(c, 5)); - if (bookName == "") { + if (bookName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); throw new Exception(); } - if (pageName == "") { + if (pageName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); throw new Exception(); } - if (collectionName == "") { + if (collectionName.equals("")) { System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); throw new Exception(); } From d581cc94cb0285d6eb4e8b7b5d03805c94caa213 Mon Sep 17 00:00:00 2001 From: xbang21 Date: Fri, 14 Mar 2014 21:35:53 -0400 Subject: [PATCH 03/36] Fixed some debuffs and buffs - added all entertainer debuffs and buffs - fixed some movement related buffs --- scripts/buffs/en_action_regen.py | 10 ++++++++ scripts/buffs/en_debuff_thrill.py | 10 ++++++++ scripts/buffs/en_debuff_thrill_1.py | 10 ++++++++ scripts/buffs/en_debuff_thrill_2.py | 10 ++++++++ scripts/buffs/en_spiral_kick_snare.py | 9 +++++++ scripts/buffs/en_sprint.py | 12 +++++++++ scripts/buffs/en_sweeping_pirouette_root.py | 9 +++++++ scripts/buffs/en_unhealthy_fixation_debuff.py | 9 +++++++ scripts/buffs/en_void_dance_buff.py | 10 ++++++++ scripts/buffs/en_void_dance_buff_1.py | 10 ++++++++ scripts/buffs/en_void_dance_buff_2.py | 10 ++++++++ scripts/buffs/en_void_dance_buff_3.py | 10 ++++++++ scripts/buffs/fs_ae_dm_cc_0.py | 7 +++--- scripts/buffs/fs_ae_dm_cc_1.py | 7 +++--- scripts/buffs/fs_ae_dm_cc_2.py | 7 +++--- scripts/buffs/fs_ae_dm_cc_3.py | 7 +++--- scripts/buffs/fs_ae_dm_cc_4.py | 7 +++--- scripts/buffs/fs_ae_dm_cc_5.py | 7 +++--- scripts/buffs/fs_ae_dm_cc_6.py | 7 +++--- scripts/buffs/fs_force_throw.py | 8 +++--- scripts/buffs/of_ae_dm_cc_1.py | 4 +-- scripts/buffs/of_ae_dm_cc_2.py | 4 +-- scripts/buffs/of_ae_dm_cc_3.py | 4 +-- scripts/buffs/of_cc_melee_1.py | 4 +-- scripts/buffs/of_cc_melee_2.py | 4 +-- scripts/buffs/of_cc_melee_3.py | 4 +-- scripts/buffs/of_cc_melee_4.py | 4 +-- scripts/buffs/of_cc_melee_5.py | 4 +-- scripts/buffs/of_cc_melee_6.py | 4 +-- scripts/buffs/of_cc_melee_7.py | 4 +-- scripts/buffs/of_vortex_root.py | 4 +-- scripts/buffs/sm_ae_dm_cc_1.py | 4 +-- scripts/buffs/sm_ae_dm_cc_2.py | 4 +-- scripts/buffs/sm_ae_dm_cc_3.py | 4 +-- scripts/buffs/sm_ae_dm_cc_4.py | 4 +-- scripts/buffs/sm_ae_dm_cc_5.py | 4 +-- scripts/buffs/sm_ae_dm_cc_6.py | 4 +-- scripts/commands/co_first_aid_training.py | 1 - scripts/commands/combat/en_spiral_kick_0.py | 11 ++++++++ scripts/commands/combat/en_spiral_kick_1.py | 11 ++++++++ scripts/commands/combat/en_spiral_kick_2.py | 11 ++++++++ scripts/commands/combat/en_spiral_kick_3.py | 11 ++++++++ scripts/commands/combat/en_spiral_kick_4.py | 11 ++++++++ scripts/commands/combat/en_thrill.py | 11 ++++++++ scripts/commands/combat/en_thrill_1.py | 11 ++++++++ scripts/commands/combat/en_thrill_2.py | 11 ++++++++ scripts/commands/combat/en_thrill_3.py | 11 ++++++++ .../commands/combat/en_unhealthy_fixation.py | 11 ++++++++ scripts/commands/combat/en_void_dance.py | 11 ++++++++ scripts/commands/combat/en_void_dance_1.py | 11 ++++++++ scripts/commands/combat/en_void_dance_2.py | 11 ++++++++ scripts/commands/combat/en_void_dance_3.py | 11 ++++++++ scripts/commands/combat/fs_dm_cc_crit_1.py | 10 ++++++++ scripts/commands/en_action_regen.py | 8 ++++++ scripts/commands/en_sprint_1.py | 8 ++++++ scripts/commands/giveitem.py | 18 +------------ scripts/commands/setgodmode.py | 25 +++++++++++++++++++ 57 files changed, 383 insertions(+), 85 deletions(-) create mode 100644 scripts/buffs/en_action_regen.py create mode 100644 scripts/buffs/en_debuff_thrill.py create mode 100644 scripts/buffs/en_debuff_thrill_1.py create mode 100644 scripts/buffs/en_debuff_thrill_2.py create mode 100644 scripts/buffs/en_spiral_kick_snare.py create mode 100644 scripts/buffs/en_sprint.py create mode 100644 scripts/buffs/en_sweeping_pirouette_root.py create mode 100644 scripts/buffs/en_unhealthy_fixation_debuff.py create mode 100644 scripts/buffs/en_void_dance_buff.py create mode 100644 scripts/buffs/en_void_dance_buff_1.py create mode 100644 scripts/buffs/en_void_dance_buff_2.py create mode 100644 scripts/buffs/en_void_dance_buff_3.py create mode 100644 scripts/commands/combat/en_spiral_kick_0.py create mode 100644 scripts/commands/combat/en_spiral_kick_1.py create mode 100644 scripts/commands/combat/en_spiral_kick_2.py create mode 100644 scripts/commands/combat/en_spiral_kick_3.py create mode 100644 scripts/commands/combat/en_spiral_kick_4.py create mode 100644 scripts/commands/combat/en_thrill.py create mode 100644 scripts/commands/combat/en_thrill_1.py create mode 100644 scripts/commands/combat/en_thrill_2.py create mode 100644 scripts/commands/combat/en_thrill_3.py create mode 100644 scripts/commands/combat/en_unhealthy_fixation.py create mode 100644 scripts/commands/combat/en_void_dance.py create mode 100644 scripts/commands/combat/en_void_dance_1.py create mode 100644 scripts/commands/combat/en_void_dance_2.py create mode 100644 scripts/commands/combat/en_void_dance_3.py create mode 100644 scripts/commands/combat/fs_dm_cc_crit_1.py create mode 100644 scripts/commands/en_action_regen.py create mode 100644 scripts/commands/en_sprint_1.py 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..23b9e75d 100644 --- a/scripts/commands/giveitem.py +++ b/scripts/commands/giveitem.py @@ -4,21 +4,5 @@ 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) - + core.playerService.giveExperience(actor, 25000) return \ No newline at end of file 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 From d4e05ff84cdd92afb920920b040182acc0600617 Mon Sep 17 00:00:00 2001 From: xbang21 Date: Fri, 14 Mar 2014 21:48:24 -0400 Subject: [PATCH 04/36] Delete giveitem.py --- scripts/commands/giveitem.py | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 scripts/commands/giveitem.py diff --git a/scripts/commands/giveitem.py b/scripts/commands/giveitem.py deleted file mode 100644 index 23b9e75d..00000000 --- a/scripts/commands/giveitem.py +++ /dev/null @@ -1,8 +0,0 @@ -import sys - -def setup(): - return - -def run(core, actor, target, commandString): - core.playerService.giveExperience(actor, 25000) - return \ No newline at end of file From d008f3fa37dd48c0d9fc7132ef43518cff4ba00b Mon Sep 17 00:00:00 2001 From: Treeku Date: Sat, 15 Mar 2014 19:52:17 +0000 Subject: [PATCH 05/36] giveExperience() takes account of XP bonuses --- src/services/PlayerService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index c1d1095d..0c8dc7bc 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -573,6 +573,10 @@ public class PlayerService implements INetworkDispatch { // Cannot gain more than half of the XP needed for the next level in one go // Do check + int experienceBonus = creature.getSkillModBase("flush_with_success"); + + experience += ((experience * experienceBonus) / 100); + // 1. Add the experience. if (experience > 0) { creature.showFlyText("base_player", "prose_flytext_xp", "", experience, (float) 2.5, new RGB(180, 60, 240), 1); From 3152ab021c6de340bbe54386629be098664a4aff Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 16 Mar 2014 00:13:38 +0000 Subject: [PATCH 06/36] No longer be able to heal duel opponent --- src/services/combat/CombatService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index e657b941..acabae46 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -855,6 +855,10 @@ public class CombatService implements INetworkDispatch { if(healer == target) return true; + if (areInDuel(healer, target)) { + return false; + } + if(healer.getFaction().equals(target.getFaction())) { if(healer.getFactionStatus() < target.getFactionStatus()) From 3f3d4e93fe0a2389eb810605ddcf86f7e5a0b29a Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 16 Mar 2014 00:29:34 +0000 Subject: [PATCH 07/36] Only medics and NPCs can heal others now --- src/services/combat/CombatService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index acabae46..04f65a4f 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -855,6 +855,12 @@ public class CombatService implements INetworkDispatch { if(healer == target) return true; + PlayerObject healerPo = healer.getSlottedObject("ghost"); + + if (healerPo != null && !healerPo.getProfession().startsWith("medic")) { + return false; + } + if (areInDuel(healer, target)) { return false; } From d85bd44d7b591cff82934911bf139c141d4633bb Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 16 Mar 2014 00:45:48 +0000 Subject: [PATCH 08/36] Fixed error --- src/services/combat/CombatService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 04f65a4f..01f73d43 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -855,7 +855,7 @@ public class CombatService implements INetworkDispatch { if(healer == target) return true; - PlayerObject healerPo = healer.getSlottedObject("ghost"); + PlayerObject healerPo = (PlayerObject) healer.getSlottedObject("ghost"); if (healerPo != null && !healerPo.getProfession().startsWith("medic")) { return false; From 84f7fe8ae5e498b55b02ce15d564119cdc948125 Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 16 Mar 2014 01:12:16 +0000 Subject: [PATCH 09/36] Duels are ended when a client disconnects --- src/services/ConnectionService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index 934efd58..92769c47 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -191,18 +191,26 @@ public class ConnectionService implements INetworkDispatch { return; CreatureObject object = (CreatureObject) client.getParent(); + object.setInviteCounter(0); object.setInviteSenderId(0); object.setInviteSenderName(""); core.groupService.handleGroupDisband(object); + + for (opponent : object.getDuelList()) { + if (opponent != null) { + core.combatService.handleEndDuel(object, opponent); + } + } + object.setClient(null); + PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); if(ghost == null) return; - if(object.getGroupId() != 0) - core.groupService.handleGroupDisband(object); + if () Point3D objectPos = object.getWorldPosition(); From a9e794dd14b764f5a1dac49e0e0c4fc64cafbdd4 Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 16 Mar 2014 01:18:59 +0000 Subject: [PATCH 10/36] Fixed reference for prev --- src/services/ConnectionService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index 92769c47..f21f9de5 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -56,6 +56,7 @@ import resources.common.collidables.AbstractCollidable; import resources.datatables.PlayerFlags; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; +import resources.objects.tangible.TangibleObject; @SuppressWarnings("unused") @@ -197,7 +198,7 @@ public class ConnectionService implements INetworkDispatch { object.setInviteSenderName(""); core.groupService.handleGroupDisband(object); - for (opponent : object.getDuelList()) { + for (TangibleObject opponent : object.getDuelList()) { if (opponent != null) { core.combatService.handleEndDuel(object, opponent); } From f99098d1579e4dba697fa3bbb6ed420470a6bd54 Mon Sep 17 00:00:00 2001 From: Levarrishawk Date: Sat, 15 Mar 2014 21:22:16 -0400 Subject: [PATCH 11/36] Added Dungeon & Space Terrains Added all Kashyyyk / Mustafar / Heroic Dungeon terrain files. Added framework for post-release content additions. --- src/main/NGECore.java | 44 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 48281f51..2d491e9d 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -306,8 +306,8 @@ public class NGECore { zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT")); zoneServer.start(); staticService = new StaticService(this); - - // Planets + //Start terrainList + // Original Planets terrainService.addPlanet(1, "tatooine", "terrain/tatooine.trn", true); terrainService.addPlanet(2, "naboo", "terrain/naboo.trn", true); terrainService.addPlanet(3, "corellia", "terrain/corellia.trn", true); @@ -320,6 +320,46 @@ public class NGECore { terrainService.addPlanet(10, "dathomir", "terrain/dathomir.trn", true); terrainService.addPlanet(11, "mustafar", "terrain/mustafar.trn", true); terrainService.addPlanet(12, "kashyyyk_main", "terrain/kashyyyk_main.trn", true); + //Dungeon Terrains + terrainService.addPlanet(13, "kashyyyk_dead_forest", "terrain/kashyyyk_dead_forest.trn", true); + terrainService.addPlanet(14, "kashyyyk_hunting", "terrain/kashyyyk_hunting.trn", true); + terrainService.addPlanet(15, "kashyyyk_north_dungeons", "terrain/kashyyyk_north_dungeons.trn", true); + terrainService.addPlanet(16, "kashyyyk_rryatt_trail", "terrain/kashyyyk_rryatt_trail.trn", true); + terrainService.addPlanet(17, "kashyyyk_south_dungeons", "terrain/kashyyyk_south_dungeons.trn", true); + terrainService.addPlanet(18, "adventure1", "terrain/adventure1.trn", true); + terrainService.addPlanet(19, "adventure2", "terrain/adventure2.trn", true); + terrainService.addPlanet(20, "dungeon1", "terrain/dungeon1.trn", true); + //Space Zones + terrainService.addPlanet(21, "space_corellia", "terrain/space_corellia.trn", true); + terrainService.addPlanet(22, "space_corellia_2", "terrain/space_corellia_2.trn", true); + terrainService.addPlanet(23, "space_dantooine", "terrain/space_dantooine.trn", true); + terrainService.addPlanet(24, "space_dathomir", "terrain/space_dathomir.trn", true); + terrainService.addPlanet(25, "space_endor", "terrain/space_endor.trn", true); + terrainService.addPlanet(26, "space_env", "terrain/space_env.trn", true); + terrainService.addPlanet(27, "space_halos", "terrain/space_halos.trn", true); + terrainService.addPlanet(28, "space_heavy1", "terrain/space_heavy1.trn", true); + terrainService.addPlanet(29, "space_kashyyyk", "terrain/space_kashyyyk.trn", true); + terrainService.addPlanet(30, "space_light1", "terrain/space_light1.trn", true); + terrainService.addPlanet(31, "space_lok", "terrain/space_lok.trn", true); + terrainService.addPlanet(32, "space_naboo", "terrain/space_naboo.trn", true); + terrainService.addPlanet(33, "space_naboo_2", "terrain/space_naboo_2.trn", true); + terrainService.addPlanet(34, "space_nova_orion", "terrain/space_nova_orion.trn", true); + terrainService.addPlanet(35, "space_npe_falcon", "terrain/space_npe_falcon.trn", true); + terrainService.addPlanet(36, "space_npe_falcon_2", "terrain/space_npe_falcon_2.trn", true); + terrainService.addPlanet(37, "space_ord_mantell", "terrain/space_ord_mantell.trn", true); + terrainService.addPlanet(38, "space_ord_mantell_2", "terrain/space_ord_mantell_2.trn", true); + terrainService.addPlanet(39, "space_ord_mantell_3", "terrain/space_ord_mantell_3.trn", true); + terrainService.addPlanet(40, "space_ord_mantell_4", "terrain/space_ord_mantell_4.trn", true); + terrainService.addPlanet(41, "space_ord_mantell_5", "terrain/space_ord_mantell_5.trn", true); + terrainService.addPlanet(42, "space_ord_mantell_6", "terrain/space_ord_mantell_6.trn", true); + terrainService.addPlanet(43, "space_tatooine", "terrain/space_tatooine.trn", true); + terrainService.addPlanet(44, "space_tatooine_2", "terrain/space_tatooine_2.trn", true); + terrainService.addPlanet(45, "space_yavin4", "terrain/space_yavin4.trn", true); + //PSWG New Content Terrains (WARNING Keep commented out unless you have the current build of kaas!) + /* + terrainService.addPlanet(46, "kaas", "terrain/kaas.trn", true); + */ + //end terrainList spawnService = new SpawnService(this); terrainService.loadClientPois(); // Travel Points From 0891bc871c1bc958204143caad54f25674df38f5 Mon Sep 17 00:00:00 2001 From: Levarrishawk Date: Sat, 15 Mar 2014 21:22:30 -0400 Subject: [PATCH 12/36] Fixed Recursion Error --- scripts/object/building/military/outpost_cloning_facility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/object/building/military/outpost_cloning_facility.py b/scripts/object/building/military/outpost_cloning_facility.py index c3d8cb98..e5c55907 100644 --- a/scripts/object/building/military/outpost_cloning_facility.py +++ b/scripts/object/building/military/outpost_cloning_facility.py @@ -4,7 +4,7 @@ from resources.common import SpawnPoint def setup(core, object): objSvc = core.objectService - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_cloning.iff', float(0.0387871), float(0.125265), float(-6), float(-0.0595427), float(0.998226), 3) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_cloning.iff', float(0.04), float(0.16), float(-6), float(-0.06), float(0.99), 3) spawnPoints = Vector() spawnPoints.add(SpawnPoint(3.2408, 0.125266, -3.59732, 0.707641, -0.706572, 5)) From 4130de20c655c9d19635017cb3784f4dd3e454dd Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 16 Mar 2014 01:25:44 +0000 Subject: [PATCH 13/36] Fixed ref 2 --- src/services/ConnectionService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index f21f9de5..1d18bf53 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -56,7 +56,6 @@ import resources.common.collidables.AbstractCollidable; import resources.datatables.PlayerFlags; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; -import resources.objects.tangible.TangibleObject; @SuppressWarnings("unused") @@ -198,7 +197,7 @@ public class ConnectionService implements INetworkDispatch { object.setInviteSenderName(""); core.groupService.handleGroupDisband(object); - for (TangibleObject opponent : object.getDuelList()) { + for (CreatureObject opponent : object.getDuelList()) { if (opponent != null) { core.combatService.handleEndDuel(object, opponent); } From 02ef99900a1a7cb37b0b1df24739211ac0acb3b4 Mon Sep 17 00:00:00 2001 From: Levarrishawk Date: Sat, 15 Mar 2014 21:45:09 -0400 Subject: [PATCH 14/36] Fixed recursion error: AGAIN! Same error as last time. --- scripts/object/building/military/outpost_cloning_facility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/object/building/military/outpost_cloning_facility.py b/scripts/object/building/military/outpost_cloning_facility.py index e5c55907..e9fd684a 100644 --- a/scripts/object/building/military/outpost_cloning_facility.py +++ b/scripts/object/building/military/outpost_cloning_facility.py @@ -7,7 +7,7 @@ def setup(core, object): objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_cloning.iff', float(0.04), float(0.16), float(-6), float(-0.06), float(0.99), 3) spawnPoints = Vector() - spawnPoints.add(SpawnPoint(3.2408, 0.125266, -3.59732, 0.707641, -0.706572, 5)) + spawnPoints.add(SpawnPoint(3.24, 0.16, -3.60, 0.71, -0.71, 5)) object.setAttachment('spawnPoints', spawnPoints) From c02d876bbaaf8910ffc21b3db42a2c690a5b3146 Mon Sep 17 00:00:00 2001 From: Levarrishawk Date: Sat, 15 Mar 2014 22:28:41 -0400 Subject: [PATCH 15/36] Fixed additional recursion errors --- .../military/outpost_cloning_facility_s02.py | 8 ++++---- .../object/building/military/outpost_starport.py | 4 ++-- .../building/naboo/cloning_facility_naboo.py | 14 +++++++------- .../object/building/naboo/hangar_naboo_theed.py | 12 ++++++------ scripts/object/building/naboo/starport_naboo.py | 6 +++--- scripts/static_spawns/kaas.py | 13 +++++++++++++ src/services/StaticService.java | 1 + 7 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 scripts/static_spawns/kaas.py diff --git a/scripts/object/building/military/outpost_cloning_facility_s02.py b/scripts/object/building/military/outpost_cloning_facility_s02.py index b77dca9b..bcea9348 100644 --- a/scripts/object/building/military/outpost_cloning_facility_s02.py +++ b/scripts/object/building/military/outpost_cloning_facility_s02.py @@ -4,12 +4,12 @@ from resources.common import SpawnPoint def setup(core, object): objSvc = core.objectService - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_cloning.iff', float(-5.5), float(0.125265), float(-3.43841), float(0.699512), float(0.714621), 6) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_cloning.iff', float(-5.5), float(0.13), float(-3.44), float(0.70), float(0.71), 6) spawnPoints = Vector() - spawnPoints.add(SpawnPoint(4.44727, 0.125266, -3.80136, -0.706468, 0.707745, 5)) - spawnPoints.add(SpawnPoint(4.65395, 0.125266, 1.49466, 0.714548, -0.699587, 4)) - spawnPoints.add(SpawnPoint(-3.99569, 0.125266, -3.51553, 0.70407, 0.710131, 6)) + spawnPoints.add(SpawnPoint(4.45, 0.13, -3.80, -0.71, 0.71, 5)) + spawnPoints.add(SpawnPoint(4.65, 0.13, 1.50, 0.71, -0.70, 4)) + spawnPoints.add(SpawnPoint(-3.99, 0.13, -3.52, 0.70, 0.71, 6)) object.setAttachment('spawnPoints', spawnPoints) diff --git a/scripts/object/building/military/outpost_starport.py b/scripts/object/building/military/outpost_starport.py index 22ca3e75..b0e8b915 100644 --- a/scripts/object/building/military/outpost_starport.py +++ b/scripts/object/building/military/outpost_starport.py @@ -2,9 +2,9 @@ import sys def setup(core, object): objSvc = core.objectService - objSvc.createChildObject(object, 'object/creature/npc/theme_park/shared_player_transport.iff', 0, 7, 0, 0.707107, 0.707107) + objSvc.createChildObject(object, 'object/creature/npc/theme_park/shared_player_transport.iff', 0, 7, 0, 0.71, 0.71) objSvc.createChildObject(object, 'object/tangible/travel/ticket_collector/shared_ticket_collector.iff', 1, 0, -10, 0, 1) - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-3.12), float(0.14659503), float(-17.57), float(0.707107), float(-0.707107), 1) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-3.12), float(0.15), float(-17.57), float(0.71), float(-0.71), 1) core.mapService.addLocation(object.getPlanet(), 'Starport', object.getPosition().x, object.getPosition().z, 15, 0, 0) return \ No newline at end of file diff --git a/scripts/object/building/naboo/cloning_facility_naboo.py b/scripts/object/building/naboo/cloning_facility_naboo.py index 76288df2..91cb87d3 100644 --- a/scripts/object/building/naboo/cloning_facility_naboo.py +++ b/scripts/object/building/naboo/cloning_facility_naboo.py @@ -8,13 +8,13 @@ def setup(core, object): objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_cloning.iff', float(1), float(-0.05), float(-1.35), float(1), float(0), 2) spawnPoints = Vector() - spawnPoints.add(SpawnPoint(-16.6514, -4.29167, -10.4976, 0.709453, 0.704753, 4)) - spawnPoints.add(SpawnPoint(-16.5965, -4.29167, -14.1652, 0.721346, 0.692575, 4)) - spawnPoints.add(SpawnPoint(16.5771, -4.29167, -14.2091, 0.71195, -0.702231, 4)) - spawnPoints.add(SpawnPoint(16.6876, -4.29167, -10.5391, -0.6972, 0.716877, 4)) - spawnPoints.add(SpawnPoint(6.32992, -4.79167, 0.613332, 0.999992, 0.00405023, 4)) - spawnPoints.add(SpawnPoint(1.58067, -4.79167, 0.582775, 0.989691, 0.0143216, 4)) - spawnPoints.add(SpawnPoint(-2.84125, -4.79167, 0.657588, -0.0356012, 0.999366, 4)) + spawnPoints.add(SpawnPoint(-16.66, -4.29, -10.50, 0.71, 0.70, 4)) + spawnPoints.add(SpawnPoint(-16.60, -4.29, -14.17, 0.72, 0.69, 4)) + spawnPoints.add(SpawnPoint(16.58, -4.29, -14.21, 0.71, -0.70, 4)) + spawnPoints.add(SpawnPoint(16.69, -4.29, -10.54, -0.70, 0.72, 4)) + spawnPoints.add(SpawnPoint(6.33, -4.79, 0.61, 0.99, 0.01, 4)) + spawnPoints.add(SpawnPoint(1.58, -4.79, 0.58, 0.99, 0.01, 4)) + spawnPoints.add(SpawnPoint(-2.84, -4.79, 0.66, -0.04, 0.99, 4)) object.setAttachment('spawnPoints', spawnPoints) diff --git a/scripts/object/building/naboo/hangar_naboo_theed.py b/scripts/object/building/naboo/hangar_naboo_theed.py index 41cc6f5c..79a247e9 100644 --- a/scripts/object/building/naboo/hangar_naboo_theed.py +++ b/scripts/object/building/naboo/hangar_naboo_theed.py @@ -3,12 +3,12 @@ import sys def setup(core, object): objSvc = core.objectService - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-26.94), float(0.749), float(-67.14), float(1), float(0), 3) - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(26.94), float(0.749), float(-67.14), float(1), float(0), 4) - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-9.49), float(7.979), float(-45.2359), float(0), float(1), 5) - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(9.49), float(7.979), float(-45.2359), float(0), float(1), 5) - objSvc.createChildObject(object, 'object/tangible/travel/ticket_collector/shared_ticket_collector.iff', float(-10), float(7.979), float(10), float(-0.707107), float(0.707107), 5) - objSvc.createChildObject(object, 'object/creature/npc/theme_park/shared_player_transport_theed_hangar.iff', float(0), float(7.979), float(0), float(1), float(1), 5) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-26.94), float(0.75), float(-67.14), float(1), float(0), 3) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(26.94), float(0.75), float(-67.14), float(1), float(0), 4) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-9.49), float(7.98), float(-45.24), float(0), float(1), 5) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(9.49), float(7.98), float(-45.24), float(0), float(1), 5) + objSvc.createChildObject(object, 'object/tangible/travel/ticket_collector/shared_ticket_collector.iff', float(-10), float(7.98), float(10), float(-0.71), float(0.71), 5) + objSvc.createChildObject(object, 'object/creature/npc/theme_park/shared_player_transport_theed_hangar.iff', float(0), float(7.98), float(0), float(1), float(1), 5) core.mapService.addLocation(object.getPlanet(), 'Starport', object.getPosition().x, object.getPosition().z, 15, 0, 0) diff --git a/scripts/object/building/naboo/starport_naboo.py b/scripts/object/building/naboo/starport_naboo.py index bfb384c6..e66e8bf2 100644 --- a/scripts/object/building/naboo/starport_naboo.py +++ b/scripts/object/building/naboo/starport_naboo.py @@ -2,12 +2,12 @@ import sys def setup(core, object): objSvc = core.objectService - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(11.5), float(0.6), float(51.3), float(0.195405), float(-0.980722), 4) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(11.5), float(0.6), float(51.3), float(0.20), float(-0.98), 4) objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(3.1), float(0.6), float(49), float(0), float(1), 4) objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-2.7), float(0.6), float(49), float(0), float(1), 4) - objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-13.2), float(0.6), float(51.3), float(-0.195405), float(-0.980722), 4) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', float(-13.2), float(0.6), float(51.3), float(-0.20), float(-0.98), 4) objSvc.createChildObject(object, 'object/creature/npc/theme_park/shared_player_transport.iff', 0, 0, 0, 1, 0) - objSvc.createChildObject(object, 'object/tangible/travel/ticket_collector/shared_ticket_collector.iff', 10, 0, -10, 0.707107, 0.707107) + objSvc.createChildObject(object, 'object/tangible/travel/ticket_collector/shared_ticket_collector.iff', 10, 0, -10, 0.71, 0.71) core.mapService.addLocation(object.getPlanet(), 'Starport', object.getPosition().x, object.getPosition().z, 15, 0, 0) return \ No newline at end of file diff --git a/scripts/static_spawns/kaas.py b/scripts/static_spawns/kaas.py new file mode 100644 index 00000000..6b171a07 --- /dev/null +++ b/scripts/static_spawns/kaas.py @@ -0,0 +1,13 @@ +import sys +from resources.datatables import Options +from resources.datatables import StateStatus + +def addPlanetSpawns(core, planet): + + stcSvc = core.staticService + + #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)) + + + return + diff --git a/src/services/StaticService.java b/src/services/StaticService.java index a0447d0a..221ad1ce 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -56,6 +56,7 @@ public class StaticService implements INetworkDispatch { spawnPlanetStaticObjs("naboo"); spawnPlanetStaticObjs("tatooine"); spawnPlanetStaticObjs("lok"); + //spawnPlanetStaticObjs("kaas"); // Keep commented out unless you possess the latest build of Kaas! } @Override From 97f4db58d13e63c69dd3d65444600402635db3d5 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Sun, 16 Mar 2014 13:01:30 -0400 Subject: [PATCH 16/36] Buff Windows now close, changed formula used for stats on inspiration buffs, minor changes overall to entertainer --- scripts/buffs/buildabuff_inspiration.py | 14 +- scripts/commands/inspire.py | 10 +- scripts/commands/watch.py | 47 ++-- src/protocol/swg/ObjControllerMessage.java | 3 +- .../BuffBuilderChangeMessage.java | 219 +++++++++--------- .../BuffBuilderEndMessage.java | 197 ++++++++++++++++ src/resources/common/BuffBuilder.java | 114 +++++---- .../common/ObjControllerOpcodes.java | 1 + src/resources/objects/BuffItem.java | 45 ++-- .../objects/player/PlayerObject.java | 4 +- src/services/EntertainmentService.java | 170 ++++++++++---- src/services/chat/ChatService.java | 3 + 12 files changed, 565 insertions(+), 262 deletions(-) create mode 100644 src/protocol/swg/objectControllerObjects/BuffBuilderEndMessage.java 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/commands/inspire.py b/scripts/commands/inspire.py index 46a97aaf..4a2aa2c8 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()) @@ -30,12 +29,11 @@ def run(core, actor, target, commandString): 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) + 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/watch.py b/scripts/commands/watch.py index 5658d8fb..6e55feef 100644 --- a/scripts/commands/watch.py +++ b/scripts/commands/watch.py @@ -4,31 +4,30 @@ 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', 0) + return - if not target.isPlayer(): - actor.sendSystemMessage('@performance:dance_watch_npc') - return + perf = entSvc.getPerformanceByIndex(target.getPerformanceId()) - - entSvc = core.entertainmentService - perf = entSvc.getPerformanceByIndex(target.getPerformanceId()) + if target.getPosture() != 0x09 or not perf or perf.getDanceVisualId() < 0: + actor.sendSystemMessage(target.getCustomName() + ' is not dancing.',0) + return - if target.getPosture() != 0x09 or not perf or perf.getDanceVisualId() < 0: - actor.sendSystemMessage('@performance:dance_watch_not_dancing',0) - return - - oldWatchee = actor.getPerformanceWatchee() - if oldWatchee and oldWatchee != target: - oldWatchee.removeAudience(actor) - - 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) + actor.setMoodAnimation('entertained') + actor.sendSystemMessage('You start watching ' + target.getCustomName() + '.',0) + return \ No newline at end of file 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/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..1732727b 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); + session.write(closeBuilder.serialize()); + + ObjControllerMessage closeRecipient = new ObjControllerMessage(0x0B, endRecipient); + session.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"); 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; From f14f65692444a5342790bb6ece68e1b07e1d587e Mon Sep 17 00:00:00 2001 From: Waverunner Date: Sun, 16 Mar 2014 13:19:59 -0400 Subject: [PATCH 17/36] Fixed server errors, removed loading of space instances to save memory --- src/main/NGECore.java | 22 ++++++++++++---------- src/services/ConnectionService.java | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 2d491e9d..b2776a0e 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -321,16 +321,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); @@ -343,9 +345,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); @@ -354,11 +356,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/services/ConnectionService.java b/src/services/ConnectionService.java index 1d18bf53..ae0962ee 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -210,7 +210,7 @@ public class ConnectionService implements INetworkDispatch { if(ghost == null) return; - if () + //if () Point3D objectPos = object.getWorldPosition(); From dfd68c11d6fc451c17332de8cc4a91dd7555fb10 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Sun, 16 Mar 2014 13:42:19 -0400 Subject: [PATCH 18/36] Range checks for /inspire and /watch --- scripts/commands/inspire.py | 6 +++++- scripts/commands/watch.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/commands/inspire.py b/scripts/commands/inspire.py index 4a2aa2c8..0206cb2a 100644 --- a/scripts/commands/inspire.py +++ b/scripts/commands/inspire.py @@ -28,7 +28,11 @@ def run(core, actor, target, commandString): else: actor.sendSystemMessage('@performance:insp_buff_must_listen', 2) return - + + if target.getPosition().getDistance2D(actor.getWorldPosition()) > float(20): + actor.sendSystemMessage(target.getCustomName() + ' is too far away to inspire.') + return + builderWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), target.getObjectId()) objController = ObjControllerMessage(11, builderWindow) actor.getClient().getSession().write(objController.serialize()) diff --git a/scripts/commands/watch.py b/scripts/commands/watch.py index 6e55feef..071319c1 100644 --- a/scripts/commands/watch.py +++ b/scripts/commands/watch.py @@ -11,7 +11,12 @@ def run(core, actor, target, commandString): if target is None: return - + + + if target.getPosition().getDistance2D(actor.getWorldPosition()) > float(20): + actor.sendSystemMessage(target.getCustomName() + ' is too far away to watch.', 0) + return + if not target.isPlayer(): actor.sendSystemMessage('@performance:dance_watch_npc', 0) return From 1801ac5cae7336ffbe658edc926cc2c426936d02 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Sun, 16 Mar 2014 14:01:32 -0400 Subject: [PATCH 19/36] Minor fix to packet being sent --- src/services/EntertainmentService.java | 4 ++-- src/services/collections/CollectionService.java | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index 1732727b..f82cb731 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -172,10 +172,10 @@ public class EntertainmentService implements INetworkDispatch { endRecipient.setObjectId(buffRecipient.getObjectId()); ObjControllerMessage closeBuilder = new ObjControllerMessage(0x0B, endBuilder); - session.write(closeBuilder.serialize()); + buffer.getClient().getSession().write(closeBuilder.serialize()); ObjControllerMessage closeRecipient = new ObjControllerMessage(0x0B, endRecipient); - session.write(closeRecipient.serialize()); + buffRecipient.getClient().getSession().write(closeRecipient.serialize()); } else if (sentPacket.getAccepted() == true && sentPacket.getBuffRecipientAccepted() == 0) { changeMessage.setAccepted(true); 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 From 8d81e26504b81263af818f04cb3287d1d3bc8a66 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Sun, 16 Mar 2014 15:26:42 -0400 Subject: [PATCH 20/36] Forgot a 0 --- scripts/commands/inspire.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/commands/inspire.py b/scripts/commands/inspire.py index 0206cb2a..531aa1e2 100644 --- a/scripts/commands/inspire.py +++ b/scripts/commands/inspire.py @@ -30,7 +30,7 @@ def run(core, actor, target, commandString): return if target.getPosition().getDistance2D(actor.getWorldPosition()) > float(20): - actor.sendSystemMessage(target.getCustomName() + ' is too far away to inspire.') + actor.sendSystemMessage(target.getCustomName() + ' is too far away to inspire.', 0) return builderWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), target.getObjectId()) From e0ca1ea7b278e30f330f57fc9620516894d735c3 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Mon, 17 Mar 2014 16:49:50 -0400 Subject: [PATCH 21/36] Range check on performances for spectators --- scripts/commands/watch.py | 3 +- .../objects/creature/CreatureObject.java | 17 ++++++++++- src/services/EntertainmentService.java | 30 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/scripts/commands/watch.py b/scripts/commands/watch.py index 071319c1..0a9baf04 100644 --- a/scripts/commands/watch.py +++ b/scripts/commands/watch.py @@ -33,6 +33,7 @@ def run(core, actor, target, commandString): actor.setPerformanceWatchee(target) target.addAudience(actor) + core.entertainmentService.startSpectating(actor, target) actor.setMoodAnimation('entertained') - actor.sendSystemMessage('You start watching ' + target.getCustomName() + '.',0) + actor.sendSystemMessage('You start watching ' + target.getCustomName() + '.',0) return \ No newline at end of file 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/services/EntertainmentService.java b/src/services/EntertainmentService.java index f82cb731..a57d486d 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -422,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() { From b28da5bcd02be09de8d2be4d33db541403c32d8c Mon Sep 17 00:00:00 2001 From: xbang21 Date: Mon, 17 Mar 2014 20:40:15 -0400 Subject: [PATCH 22/36] fixed giveitem --- scripts/commands/giveitem.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/commands/giveitem.py diff --git a/scripts/commands/giveitem.py b/scripts/commands/giveitem.py new file mode 100644 index 00000000..8279dc05 --- /dev/null +++ b/scripts/commands/giveitem.py @@ -0,0 +1,24 @@ +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 From 604d1f7aefa82c91c36e0f867f3be1cfd1ecf8ae Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 18:23:25 +0000 Subject: [PATCH 23/36] Changed duplicate id handling, static objids - I noticed when targetting a client-spawned object (EK brazier), it sent a target packet to the client with all 8 bytes filled, instead of just the 4 stated in the buildout. It seems the same 4 digits get added to all buildout ids. As a result, all buildout int-objectIds now have the follow bytes added to them: FF FF 86 F9 Not sure about snapshot objects, but I imagine it's the same for them. - I had to allow duplicate objects to be spawned in order for heroics and instances to work. It gives every duplicate object a new objectId and also replaces the parentIds as well by storing the changes in a map on each buildout area cycle. --- src/services/object/ObjectService.java | 41 ++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 6771397a..c5535ddd 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -30,6 +30,7 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -84,6 +85,7 @@ import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import main.NGECore; +import resources.objects.Delta; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; @@ -678,7 +680,12 @@ public class ObjectService implements INetworkDispatch { int counter = 0; for(SnapshotChunk chunk : visitor.getChunks()) { ++counter; - SWGObject obj = createObject(visitor.getName(chunk.nameId), chunk.id, planet, new Point3D(chunk.xPosition, chunk.yPosition, chunk.zPosition), new Quaternion(chunk.orientationW, chunk.orientationX, chunk.orientationY, chunk.orientationZ)); + // Since the ids are just ints, they append 0xFFFF86F9 to them + // This is demonstated in the packet sent to the server when you /target client-spawned buildouts + // This is done for buildouts; uncertain about snapshot objects so it's commented for now + //long objectId = Delta.createBuffer(8).putInt(chunk.id).putInt(0xF986FFFF).flip().getLong(); // Not sure what extension they add to 4-byte-only snapshot objectIds. With buildouts they add 0xFFFF86F9. This is demonstated in the packet sent to the server when you /target client-spawned objects + int objectId = chunk.id; + SWGObject obj = createObject(visitor.getName(chunk.nameId), objectId, planet, new Point3D(chunk.xPosition, chunk.yPosition, chunk.zPosition), new Quaternion(chunk.orientationW, chunk.orientationX, chunk.orientationY, chunk.orientationZ)); if(obj != null) { obj.setisInSnapshot(true); obj.setParentId(chunk.parentId); @@ -768,6 +775,8 @@ public class ObjectService implements INetworkDispatch { CrcStringTableVisitor crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class); List quadtreeObjects = new ArrayList(); + Map duplicate = new HashMap(); + for (int i = 0; i < buildoutTable.getRowCount(); i++) { String template; @@ -798,7 +807,9 @@ public class ObjectService implements INetworkDispatch { } else { - objectId = (Integer) buildoutTable.getObject(i, 0); + // Since the ids are just ints, they append 0xFFFF86F9 to them + // This is demonstated in the packet sent to the server when you /target client-spawned objects + objectId = Delta.createBuffer(8).putInt((Integer) buildoutTable.getObject(i, 0)).putInt(0xF986FFFF).flip().getLong(); containerId = (Integer) buildoutTable.getObject(i, 1); type = (Integer) buildoutTable.getObject(i, 2); cellIndex = (Integer) buildoutTable.getObject(i, 4); @@ -814,12 +825,30 @@ public class ObjectService implements INetworkDispatch { portalCRC = (Integer) buildoutTable.getObject(i, 13); } - + + // Treeku - Refactored to work around duplicate objectIds + // Required for instances/heroics which are duplicated ie. 10 times if(!template.equals("object/cell/shared_cell.iff") && objectId != 0 && getObject(objectId) != null) { - //System.out.println("Duplicate buildout object: " + template); - continue; + SWGObject object = getObject(objectId); + + // Same coordinates is a true duplicate + if ((px + x1) == object.getPosition().x && + py == object.getPosition().y && + (pz + z1) == object.getPosition().z) { + //System.out.println("Duplicate buildout object: " + template); + continue; + } } - + + if (objectId != 0 && getObject(objectId) != null) { + duplicate.put(objectId, generateObjectID()); + objectId = duplicate.get(objectId); + } + + if (duplicate.containsKey(containerId)) { + containerId = duplicate.get(containerId); + } + List containers = new ArrayList(); SWGObject object; if(objectId != 0 && containerId == 0) { From 5df4b7c2034c58e1bfa3c0b1efe859d8efd88fdb Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 18:26:15 +0000 Subject: [PATCH 24/36] Made all callScript functions consistent --- scripts/starterclothing.py | 240 ++++++++++++------------- src/services/BuffService.java | 4 +- src/services/CharacterService.java | 2 +- src/services/PlayerService.java | 4 +- src/services/ScriptService.java | 12 +- src/services/SkillService.java | 2 +- src/services/StaticService.java | 2 +- src/services/map/MapService.java | 2 +- src/services/travel/TravelService.java | 2 +- 9 files changed, 135 insertions(+), 135 deletions(-) diff --git a/scripts/starterclothing.py b/scripts/starterclothing.py index f24afeb3..567e1345 100644 --- a/scripts/starterclothing.py +++ b/scripts/starterclothing.py @@ -5,294 +5,294 @@ import sys def CreateStarterClothing(core, object, starterProfession, raceTemplate): if starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/human_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidMale", "outdoors_scout_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidMale", "outdoors_scout_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidMale", "outdoors_scout_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidMale", "outdoors_scout_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidMale", "outdoors_scout_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidMale", "outdoors_scout_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidMale", "outdoors_scout_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/human_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidFemale", "outdoors_scout_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/zabrak_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidFemale", "outdoors_scout_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/bothan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidFemale", "outdoors_scout_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/sullustan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidFemale", "outdoors_scout_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/twilek_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidFemale", "outdoors_scout_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/moncal_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidFemale", "outdoors_scout_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/rodian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutHumanoidFemale", "outdoors_scout_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/trandoshan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutTrandoshanMale", "outdoors_scout_trandoshan_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_trandoshan_male", "OutdoorScoutTrandoshanMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/trandoshan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutTrandoshanFemale", "outdoors_scout_trandoshan_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_trandoshan_female", "OutdoorScoutTrandoshanFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/wookiee_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutWookieeMale", "outdoors_scout_wookiee_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_wookiee_male", "OutdoorScoutWookieeMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/wookiee_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutWookieeFemale", "outdoors_scout_wookiee_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_wookiee_female", "OutdoorScoutWookieeFemale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/ithorian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutIthorianMale", "outdoors_scout_ithorian_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_ithorian_male", "OutdoorScoutIthorianMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/ithorian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "OutdoorScoutIthorianFemale", "outdoors_scout_ithorian_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_ithorian_female", "OutdoorScoutIthorianFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/human_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidMale", "combat_brawler_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_male", "CombatBrawlerHumanoidMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidMale", "combat_brawler_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_male", "CombatBrawlerHumanoidMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidMale", "combat_brawler_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_male", "CombatBrawlerHumanoidMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidMale", "combat_brawler_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_male", "CombatBrawlerHumanoidMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidMale", "combat_brawler_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_male", "CombatBrawlerHumanoidMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidMale", "combat_brawler_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_male", "CombatBrawlerHumanoidMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidMale", "combat_brawler_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_male", "CombatBrawlerHumanoidMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/human_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidFemale", "combat_brawler_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_female", "CombatBrawlerHumanoidFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/zabrak_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidFemale", "combat_brawler_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_female", "CombatBrawlerHumanoidFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/bothan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidFemale", "combat_brawler_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_female", "CombatBrawlerHumanoidFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/sullustan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidFemale", "combat_brawler_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_female", "CombatBrawlerHumanoidFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/twilek_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidFemale", "combat_brawler_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_female", "CombatBrawlerHumanoidFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/moncal_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidFemale", "combat_brawler_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_female", "CombatBrawlerHumanoidFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/rodian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerHumanoidFemale", "combat_brawler_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_humanoid_female", "CombatBrawlerHumanoidFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/trandoshan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerTrandoshanMale", "combat_brawler_trandoshan_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_trandoshan_male", "CombatBrawlerTrandoshanMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/trandoshan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerOutdoorScoutTrandoshanFemale", "combat_brawler_trandoshan_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_trandoshan_female", "CombatBrawlerOutdoorScoutTrandoshanFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/wookiee_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerWookieeMale", "combat_brawler_wookiee_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_wookiee_male", "CombatBrawlerWookieeMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/wookiee_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerWookieeFemale", "combat_brawler_wookiee_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_wookiee_female", "CombatBrawlerWookieeFemale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/ithorian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerIthorianMale", "combat_brawler_ithorian_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_ithorian_male", "CombatBrawlerIthorianMale", core, object) elif starterProfession == 'combat_brawler' and raceTemplate == 'object/creature/player/ithorian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatBrawlerIthorianFemale", "combat_brawler_ithorian_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_brawler_ithorian_female", "CombatBrawlerIthorianFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/human_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidMale", "combat_marksman_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_male", "CombatMarksmanHumanoidMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidMale", "combat_marksman_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_male", "CombatMarksmanHumanoidMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidMale", "combat_marksman_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_male", "CombatMarksmanHumanoidMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidMale", "combat_marksman_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_male", "CombatMarksmanHumanoidMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidMale", "combat_marksman_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_male", "CombatMarksmanHumanoidMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidMale", "combat_marksman_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_male", "CombatMarksmanHumanoidMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidMale", "combat_marksman_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_male", "CombatMarksmanHumanoidMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/human_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidFemale", "combat_marksman_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_female", "CombatMarksmanHumanoidFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/zabrak_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidFemale", "combat_marksman_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_female", "CombatMarksmanHumanoidFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/bothan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidFemale", "combat_marksman_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_female", "CombatMarksmanHumanoidFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/sullustan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidFemale", "combat_marksman_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_female", "CombatMarksmanHumanoidFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/twilek_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidFemale", "combat_marksman_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_female", "CombatMarksmanHumanoidFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/moncal_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidFemale", "combat_marksman_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_female", "CombatMarksmanHumanoidFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/rodian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanHumanoidFemale", "combat_marksman_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_humanoid_female", "CombatMarksmanHumanoidFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/trandoshan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanTrandoshanMale", "combat_marksman_trandoshan_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_trandoshan_male", "CombatMarksmanTrandoshanMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/trandoshan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanTrandoshanFemale", "combat_marksman_trandoshan_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_trandoshan_female", "CombatMarksmanTrandoshanFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/wookiee_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanWookieeMale", "combat_marksman_wookiee_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_wookiee_male", "CombatMarksmanWookieeMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/wookiee_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanWookieeFemale", "combat_marksman_wookiee_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_wookiee_female", "CombatMarksmanWookieeFemale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/ithorian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanIthorianMale", "combat_marksman_ithorian_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_ithorian_male", "CombatMarksmanIthorianMale", core, object) elif starterProfession == 'combat_marksman' and raceTemplate == 'object/creature/player/ithorian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CombatMarksmanIthorianFemale", "combat_marksman_ithorian_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "combat_marksman_ithorian_female", "CombatMarksmanIthorianFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/human_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidMale", "crafting_artisan_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_male", "CraftingArtisanHumanoidMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidMale", "crafting_artisan_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_male", "CraftingArtisanHumanoidMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidMale", "crafting_artisan_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_male", "CraftingArtisanHumanoidMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidMale", "crafting_artisan_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_male", "CraftingArtisanHumanoidMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidMale", "crafting_artisan_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_male", "CraftingArtisanHumanoidMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidMale", "crafting_artisan_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_male", "CraftingArtisanHumanoidMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidMale", "crafting_artisan_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_male", "CraftingArtisanHumanoidMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/human_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidFemale", "crafting_artisan_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_female", "CraftingArtisanHumanoidFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/zabrak_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidFemale", "crafting_artisan_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_female", "CraftingArtisanHumanoidFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/bothan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidFemale", "crafting_artisan_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_female", "CraftingArtisanHumanoidFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/sullustan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidFemale", "crafting_artisan_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_female", "CraftingArtisanHumanoidFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/twilek_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanTwilekFemale", "crafting_artisan_twilek_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_twilek_female", "CraftingArtisanTwilekFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/moncal_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidFemale", "crafting_artisan_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_female", "CraftingArtisanHumanoidFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/rodian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanHumanoidFemale", "crafting_artisan_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_humanoid_female", "CraftingArtisanHumanoidFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/trandoshan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanTrandoshanMale", "crafting_artisan_trandoshan_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_trandoshan_male", "CraftingArtisanTrandoshanMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/trandoshan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanTrandoshanFemale", "crafting_artisan_trandoshan_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_trandoshan_female", "CraftingArtisanTrandoshanFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/wookiee_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanWookieeMale", "crafting_artisan_wookiee_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_wookiee_male", "CraftingArtisanWookieeMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/wookiee_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanWookieeFemale", "crafting_artisan_wookiee_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_wookiee_female", "CraftingArtisanWookieeFemale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/ithorian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanIthorianMale", "crafting_artisan_ithorian_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_ithorian_male", "CraftingArtisanIthorianMale", core, object) elif starterProfession == 'crafting_artisan' and raceTemplate == 'object/creature/player/ithorian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "CraftingArtisanIthorianFemale", "crafting_artisan_ithorian_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "crafting_artisan_ithorian_female", "CraftingArtisanIthorianFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/human_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidMale", "science_medic_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_male", "ScienceMedicHumanoidMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidMale", "science_medic_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_male", "ScienceMedicHumanoidMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidMale", "science_medic_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_male", "ScienceMedicHumanoidMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidMale", "science_medic_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_male", "ScienceMedicHumanoidMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidMale", "science_medic_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_male", "ScienceMedicHumanoidMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidMale", "science_medic_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_male", "ScienceMedicHumanoidMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidMale", "science_medic_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_male", "ScienceMedicHumanoidMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/human_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidFemale", "science_medic_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_female", "ScienceMedicHumanoidFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/zabrak_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidFemale", "science_medic_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_female", "ScienceMedicHumanoidFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/bothan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidFemale", "science_medic_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_female", "ScienceMedicHumanoidFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/sullustan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidFemale", "science_medic_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_female", "ScienceMedicHumanoidFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/twilek_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidFemale", "science_medic_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_female", "ScienceMedicHumanoidFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/moncal_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidFemale", "science_medic_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_female", "ScienceMedicHumanoidFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/rodian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicHumanoidFemale", "science_medic_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_humanoid_female", "ScienceMedicHumanoidFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/trandoshan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicTrandoshanMale", "science_medic_trandoshan_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_trandoshan_male", "ScienceMedicTrandoshanMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/trandoshan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicTrandoshanFemale", "science_medic_trandoshan_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_trandoshan_female", "ScienceMedicTrandoshanFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/wookiee_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicWookieeMale", "science_medic_wookiee_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_wookiee_male", "ScienceMedicWookieeMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/wookiee_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicWookieeFemale", "science_medic_wookiee_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_wookiee_female", "ScienceMedicWookieeFemale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/ithorian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicIthorianMale", "science_medic_ithorian_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_ithorian_male", "ScienceMedicIthorianMale", core, object) elif starterProfession == 'science_medic' and raceTemplate == 'object/creature/player/ithorian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "ScienceMedicIthorianFemale", "science_medic_ithorian_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "science_medic_ithorian_female", "ScienceMedicIthorianFemale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/human_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidMale", "social_entertainer_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_male", "SocialEntertainerHumanoidMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidMale", "social_entertainer_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_male", "SocialEntertainerHumanoidMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidMale", "social_entertainer_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_male", "SocialEntertainerHumanoidMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidMale", "social_entertainer_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_male", "SocialEntertainerHumanoidMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidMale", "social_entertainer_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_male", "SocialEntertainerHumanoidMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidMale", "social_entertainer_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_male", "SocialEntertainerHumanoidMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidMale", "social_entertainer_humanoid_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_male", "SocialEntertainerHumanoidMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/human_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidFemale", "social_entertainer_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_female", "SocialEntertainerHumanoi_female", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/zabrak_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidFemale", "social_entertainer_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_female", "SocialEntertainerHumanoi_female", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/bothan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidFemale", "social_entertainer_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_female", "SocialEntertainerHumanoi_female", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/sullustan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidFemale", "social_entertainer_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_female", "SocialEntertainerHumanoi_female", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/twilek_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerTwilekFemale", "social_entertainer_twilek_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_twilek_female", "SocialEntertainerTwilekFemale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/moncal_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidFemale", "social_entertainer_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_female", "SocialEntertainerHumanoi_female", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/rodian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerHumanoidFemale", "social_entertainer_humanoid_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_humanoid_female", "SocialEntertainerHumanoi_female", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/trandoshan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerTrandoshanMale", "social_entertainer_trandoshan_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_trandoshan_male", "SocialEntertainerTrandoshanMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/trandoshan_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerTrandoshanFemale", "social_entertainer_trandoshan_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_trandoshan_female", "SocialEntertainerTrandoshanFemale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/wookiee_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerWookieeMale", "social_entertainer_wookiee_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_wookiee_male", "SocialEntertainerWookieeMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/wookiee_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerWookieeFemale", "social_entertainer_wookiee_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_wookiee_female", "SocialEntertainerWookieeFemale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/ithorian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerIthorianMale", "social_entertainer_ithorian_male", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_ithorian_male", "SocialEntertainerIthorianMale", core, object) elif starterProfession == 'social_entertainer' and raceTemplate == 'object/creature/player/ithorian_female.iff': - core.scriptService.callScript("scripts/starter_clothing/", "SocialEntertainerIthorianFemale", "social_entertainer_ithorian_female", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "social_entertainer_ithorian_female", "SocialEntertainerIthorianFemale", core, object) \ No newline at end of file diff --git a/src/services/BuffService.java b/src/services/BuffService.java index 76948e89..cd8e218b 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -110,7 +110,7 @@ public class BuffService implements INetworkDispatch { } if(FileUtilities.doesFileExist("scripts/buffs/" + buffName + ".py")) - core.scriptService.callScript("scripts/buffs/", "setup", buffName, core, creature, buff); + core.scriptService.callScript("scripts/buffs/", buffName, "setup", core, creature, buff); creature.addBuff(buff); @@ -168,7 +168,7 @@ public class BuffService implements INetworkDispatch { creature.removeDot(dot); } if(FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py")) - core.scriptService.callScript("scripts/buffs/", "removeBuff", buff.getBuffName(), core, creature, buff); + core.scriptService.callScript("scripts/buffs/", buff.getBuffName(), "removeBuff", core, creature, buff); creature.removeBuff(buff); for (String effect : buff.getParticleEffect().split(",")) { diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index d87738c9..ea133655 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -325,7 +325,7 @@ public class CharacterService implements INetworkDispatch { object._add(defaultWeapon); object.setWeaponId(defaultWeapon.getObjectID()); core.scriptService.callScript("scripts/", "starterclothing", "CreateStarterClothing", core, object, clientCreateCharacter.getStarterProfession(), clientCreateCharacter.getRaceTemplate()); - core.scriptService.callScript("scripts/", "CreateStartingCharacter", "demo", core, object); + core.scriptService.callScript("scripts/", "demo", "CreateStartingCharacter", core, object); core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction()); // might not need to commit transaction but better safe than sorry diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 0c8dc7bc..5c3eaf9c 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -454,7 +454,7 @@ public class PlayerService implements INetworkDispatch { if(!FileUtilities.doesFileExist("scripts/expertise/" + expertiseBox + ".py")) return; - core.scriptService.callScript("scripts/expertise/", "addExpertisePoint", expertiseBox, core, creature); + core.scriptService.callScript("scripts/expertise/", expertiseBox, "addExpertisePoint", core, creature); } @@ -598,7 +598,7 @@ public class PlayerService implements INetworkDispatch { creature.playEffectObject("clienteffect/level_granted.cef", ""); creature.getClient().getSession().write((new ClientMfdStatusUpdateMessage((float) ((creature.getLevel() == 90) ? 90 : (creature.getLevel() + 1)), "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize()); creature.setLevel(((Integer) experienceTable.getObject(i, 0)).shortValue()); - core.scriptService.callScript("scripts/collections/", "addMasterBadge", "master_" + player.getProfession(), core, creature); + core.scriptService.callScript("scripts/collections/", "master_" + player.getProfession(), "addMasterBadge", core, creature); // 3. Add the relevant health/action and expertise points. float luck = (((((float) (core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getLuck").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getLuck").__call__().asInt())) / ((float) 90)) * ((float) creature.getLevel())) - ((float) creature.getSkillModBase("luck"))); diff --git a/src/services/ScriptService.java b/src/services/ScriptService.java index 791e3cd5..9ea1c999 100644 --- a/src/services/ScriptService.java +++ b/src/services/ScriptService.java @@ -30,10 +30,10 @@ import main.NGECore; @SuppressWarnings("unused") public class ScriptService { - + private NGECore core; private PythonInterpreter interpreter; - + public ScriptService(NGECore core) { this.core = core; } @@ -62,7 +62,7 @@ public class ScriptService { return python.get(method).__call__(Py.java2py(arg1)); } - public PyObject callScript(String path, String method, String module, Object arg1, Object arg2) { + public PyObject callScript(String path, String module, String method, Object arg1, Object arg2) { /*PythonInterpreter interpreter = new PythonInterpreter(); interpreter.cleanup(); interpreter.exec("import sys\nsys.path.append('" + path + "')\nfrom " + module + " import " + method); @@ -74,7 +74,7 @@ public class ScriptService { return python.get(method).__call__(Py.java2py(arg1), Py.java2py(arg2)); } - public PyObject callScript(String path, String method, String module, Object arg1, Object arg2, Object arg3) { + public PyObject callScript(String path, String module, String method, Object arg1, Object arg2, Object arg3) { /*PythonInterpreter interpreter = new PythonInterpreter(); interpreter.cleanup(); interpreter.exec("import sys\nsys.path.append('" + path + "')\nfrom " + module + " import " + method); @@ -86,7 +86,7 @@ public class ScriptService { return python.get(method).__call__(Py.java2py(arg1), Py.java2py(arg2), Py.java2py(arg3)); } - + public PyObject callScript(String path, String module, String method, Object arg1, Object arg2, Object arg3, Object arg4) { /*PythonInterpreter interpreter = new PythonInterpreter(); interpreter.cleanup(); @@ -106,5 +106,5 @@ public class ScriptService { PyObject func = python.get(method); return func; } - + } diff --git a/src/services/SkillService.java b/src/services/SkillService.java index 75385d8c..de024d6d 100644 --- a/src/services/SkillService.java +++ b/src/services/SkillService.java @@ -274,7 +274,7 @@ public class SkillService implements INetworkDispatch { addSkill(creature, expertiseName); if(!FileUtilities.doesFileExist("scripts/expertise/" + expertiseName + ".py")) continue; - core.scriptService.callScript("scripts/expertise/", "addAbilities", expertiseName, core, creature, player); + core.scriptService.callScript("scripts/expertise/", expertiseName, "addAbilities", core, creature, player); } } diff --git a/src/services/StaticService.java b/src/services/StaticService.java index 221ad1ce..f6c8bf68 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -71,7 +71,7 @@ public class StaticService implements INetworkDispatch { public void spawnPlanetStaticObjs(String planet) { Planet planetObj = (Planet) core.terrainService.getPlanetByName(planet); - core.scriptService.callScript("scripts/static_spawns/", "addPlanetSpawns", planetObj.getName(), core, planetObj); + core.scriptService.callScript("scripts/static_spawns/", planetObj.getName(), "addPlanetSpawns", core, planetObj); System.out.println("Loaded static objs for " + planetObj.getName()); } diff --git a/src/services/map/MapService.java b/src/services/map/MapService.java index f586cfde..23b6437c 100644 --- a/src/services/map/MapService.java +++ b/src/services/map/MapService.java @@ -105,7 +105,7 @@ public class MapService implements INetworkDispatch { public void addPlanet(Planet planet) { locationMap.put(planet, new Vector()); - core.scriptService.callScript("scripts/", "addLocations", "static_map_locations", core, planet); + core.scriptService.callScript("scripts/", "static_map_locations", "addLocations", core, planet); } public void addLocation(Planet planet, String name, float x, float y, byte category, byte subcategory, byte active) { diff --git a/src/services/travel/TravelService.java b/src/services/travel/TravelService.java index d0daaa6c..6eeb3bb5 100644 --- a/src/services/travel/TravelService.java +++ b/src/services/travel/TravelService.java @@ -193,7 +193,7 @@ public class TravelService implements INetworkDispatch { public void addPlanet(Planet planet) { Vector travelPointVector = new Vector(); travelMap.put(planet, travelPointVector); - core.scriptService.callScript("scripts/", "addPoints", "static_travel_points", core, planet); + core.scriptService.callScript("scripts/", "static_travel_points", "addPoints", core, planet); } public void addTravelPoint(Planet planet, String name, float x, float y, float z) { From 0633c410be23da19994415efb4857b7093450bc7 Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 18:53:25 +0000 Subject: [PATCH 25/36] Labelled a few CREO variables --- .../creature/CreatureMessageBuilder.java | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index 1d7deeb0..8e917fe9 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -196,7 +196,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putInt(1); } } - buffer.putInt(0); // unk + buffer.putInt(0); // displayXp int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); @@ -213,21 +213,23 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); buffer.putShort((short) 0x23); - buffer.putInt(0x43); + buffer.putInt(0x43); // serverId - buffer.putInt(0); // defenders list unused in NGE - buffer.putInt(0); + buffer.putShort((short) 0); // detaiLStfFilename + buffer.putInt(0); // detailStfSpacer + buffer.putShort((short) 0); // detailStfName + + // TANO 6 lists TODO: research buffer.put(creature.getCombatFlag()); - - buffer.putLong(0); - buffer.putLong(0); - buffer.putLong(0); // Vehicle vars or TANO 6 vars TODO: research - buffer.putLong(0); - buffer.putInt(0); + + buffer.putLong(0); //List possibly defenders list + buffer.putInt(0); //Int + buffer.putLong(0); //List + buffer.putLong(0); //List + buffer.putLong(0); //List buffer.putShort(creature.getLevel()); - //buffer.putShort((short) 90); buffer.putInt(creature.getGrantedHealth()); // From player_level.iff. Ranges from 0-2000 as you level, consistent with that table. //0A @@ -253,8 +255,9 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putLong(creature.getInviteCounter()); buffer.putInt(creature.getGuildId()); - //10 - buffer.putLong(creature.getTargetId()); + + buffer.putLong(0); // lookAtTarget 0x10 + buffer.putLong(creature.getTargetId()); // intendedTarget 0x11 buffer.put(creature.getMoodId()); buffer.putInt(creature.getPerformanceCounter()); /* @@ -262,9 +265,6 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { * in the CREO, otherwise the evul note bubbles appear */ buffer.putInt((creature.getPerformanceType()) ? 0 : creature.getPerformanceId()); - - buffer.putInt(0); // unks - buffer.putInt(0); buffer.putInt(6); // Current HAM buffer.putInt(creature.getHamListCounter()); @@ -332,9 +332,9 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } - buffer.putShort((short) 0); + buffer.putShort((short) 0); // costume //buffer.put(getAsciiString("appearance/gungan_m.sat")); - buffer.put((byte) 1); // 0 = cloak + buffer.put((byte) 1); // visible boolean. default: true. cloaked if false. if(creature.getBuffList().isEmpty()) { buffer.putInt(0); @@ -377,10 +377,10 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } - buffer.put((byte) 0); // crashes if 1 + buffer.put((byte) 0); // performing? boolean buffer.put(creature.getDifficulty()); buffer.putInt(0xFFFFFFFF); // -1 normal appearance, 0 hologram - buffer.put((byte) 1); // crashes if 0 + buffer.put((byte) 1); // visibleOnRadar? boolean buffer.put((byte) 0); // no effect for 1? buffer.put((byte) 0); // no effect for 1? @@ -413,8 +413,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } } - buffer.putInt(0); // unk list - buffer.putInt(0); + buffer.putLong(0); // unk long int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); From 0ef12787bbad58ebe5892a038c98683bac355b70 Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 19:43:29 +0000 Subject: [PATCH 26/36] Instance implementation --- scripts/commands/eject.py | 8 + scripts/instances/heroic_exar_kun.py | 53 ++ scripts/instances/heroic_star_destroyer.py | 53 ++ .../quest/heroic/heroic_exar_kun_entrance.py | 7 +- scripts/radial/exar_kun_brazier.py | 14 + src/main/NGECore.java | 5 + src/resources/objects/guild/GuildObject.java | 11 +- src/services/ConnectionService.java | 6 +- src/services/InstanceService.java | 778 ++++++++++++++++++ src/services/SimulationService.java | 1 + 10 files changed, 931 insertions(+), 5 deletions(-) create mode 100644 scripts/commands/eject.py create mode 100644 scripts/instances/heroic_exar_kun.py create mode 100644 scripts/instances/heroic_star_destroyer.py create mode 100644 scripts/radial/exar_kun_brazier.py create mode 100644 src/services/InstanceService.java diff --git a/scripts/commands/eject.py b/scripts/commands/eject.py new file mode 100644 index 00000000..eafbd1f0 --- /dev/null +++ b/scripts/commands/eject.py @@ -0,0 +1,8 @@ +import sys + +def run(core, actor, target, commandString): + instSvc = core.instanceService + + if instSvc.isInInstance(actor): + instSvc.remove(instSvc.getActiveInstance(actor), actor) + diff --git a/scripts/instances/heroic_exar_kun.py b/scripts/instances/heroic_exar_kun.py new file mode 100644 index 00000000..d961fee0 --- /dev/null +++ b/scripts/instances/heroic_exar_kun.py @@ -0,0 +1,53 @@ +import sys +import services.InstanceService.Instance + +def getTerrain(): + return 'terrain/dungeon1.trn' + +def getBuilding(): + return 'object/building/heroic/shared_exar_kun_tomb.iff' + +def getCellId(): + return 1 + +def getSpawnPosition(position): + position.x = float(-11.918457) + position.y = float(0.601063) + position.z = float(-125.692871) + return + +def getDuration(): + return 120 + +# NK lockout time was 30 minutes. Most instances were 0 and got reset at 12AM PTC. +def getLockoutTime(): + return 0 + +def getExitTerrain(): + return 'terrain/yavin4.trn' + +def getExitPosition(position): + position.x = float(5097) + position.y = float(0) + position.z = float(5537) + return + +# Called on instance creation to spawn npcs and objects. +def setup(core, instance): + return + +# Called when there is a new participant added to the instance. +def add(core, instance, actor): + return + +# Called when a participant is removed from the instance. +def remove(core, instance, actor): + return + +# Any operations that need to be carried out regularly +def run(core, instance): + return + +# Called on instance destruction to destroy the instance. +def destroy(core, instance): + return \ No newline at end of file diff --git a/scripts/instances/heroic_star_destroyer.py b/scripts/instances/heroic_star_destroyer.py new file mode 100644 index 00000000..2109ea39 --- /dev/null +++ b/scripts/instances/heroic_star_destroyer.py @@ -0,0 +1,53 @@ +import sys +import services.InstanceService.Instance + +def getTerrain(): + return 'terrain/dungeon1.trn' + +def getBuilding(): + return 'object/building/general/shared_space_dungeon_star_destroyer.iff' + +def getCellId(): + return 36 + +def getSpawnPosition(position): + position.x = float(0) + position.y = float(173.834625) + position.z = float(30) + return + +def getDuration(): + return 120 + +# NK lockout time was 30 minutes. Most instances were 0 and got reset at 12AM PTC. +def getLockoutTime(): + return 0 + +def getExitTerrain(): + return 'terrain/corellia.trn' + +def getExitPosition(position): + position.x = float(-131) + position.y = float(0) + position.z = float(-4723) + return + +# Called on instance creation to spawn npcs and objects. +def setup(core, instance): + return + +# Called when there is a new participant added to the instance. +def add(core, instance, actor): + return + +# Called when a participant is removed from the instance. +def remove(core, instance, actor): + return + +# Any operations that need to be carried out regularly +def run(core, instance): + return + +# Called on instance destruction to destroy the instance. +def destroy(core, instance): + return \ No newline at end of file diff --git a/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py b/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py index ccad8904..79b40d1f 100644 --- a/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py +++ b/scripts/object/tangible/quest/heroic/heroic_exar_kun_entrance.py @@ -1,4 +1,9 @@ import sys def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'exar_kun_brazier') + return + +def use(core, actor, object): + if actor: + core.instanceService.queue('heroic_exar_kun', actor) \ No newline at end of file diff --git a/scripts/radial/exar_kun_brazier.py b/scripts/radial/exar_kun_brazier.py new file mode 100644 index 00000000..d78e1915 --- /dev/null +++ b/scripts/radial/exar_kun_brazier.py @@ -0,0 +1,14 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 21, 3, '@building_name:heroic_exar_enter')) + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.objectService.useObject(owner, target) + return + \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 2d491e9d..dbb6cf0a 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -55,6 +55,7 @@ import services.ConnectionService; import services.EntertainmentService; import services.EquipmentService; import services.GroupService; +import services.InstanceService; import services.LoginService; import services.MissionService; import services.PlayerService; @@ -163,6 +164,7 @@ public class NGECore { public SpawnService spawnService; public AIService aiService; //public MissionService missionService; + public InstanceService instanceService; // Login Server public NetworkDispatch loginDispatch; @@ -391,6 +393,9 @@ public class NGECore { zoneDispatch.addService(skillService); + instanceService = new InstanceService(this); + zoneDispatch.addService(instanceService); + //travelService.startShuttleSchedule(); weatherService = new WeatherService(this); diff --git a/src/resources/objects/guild/GuildObject.java b/src/resources/objects/guild/GuildObject.java index a1fe7edb..5890756b 100644 --- a/src/resources/objects/guild/GuildObject.java +++ b/src/resources/objects/guild/GuildObject.java @@ -46,12 +46,11 @@ import com.sleepycat.persist.model.NotPersistent; import engine.clients.Client; import engine.resources.objects.IPersistent; -import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Entity(version=0) +@Entity(version=1) public class GuildObject extends UniverseObject implements IPersistent { protected NGECore core; @@ -63,6 +62,8 @@ public class GuildObject extends UniverseObject implements IPersistent { @NotPersistent private Transaction txn; + private long nextInstanceId = 0; + // GILD 3 private float complexity = 0x803F0F00; private String STFFile = "string_id_table"; @@ -281,6 +282,12 @@ public class GuildObject extends UniverseObject implements IPersistent { } } + public synchronized long getNextInstanceId() { + long ret = nextInstanceId; + nextInstanceId++; + return ret; + } + @Override public void sendBaselines(Client destination) { destination.getSession().write(messageBuilder.buildBaseline3()); diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index 1d18bf53..c0d5405e 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -203,6 +203,10 @@ public class ConnectionService implements INetworkDispatch { } } + if (core.instanceService.isInInstance(object)) { + core.instanceService.remove(core.instanceService.getActiveInstance(object), object); + } + object.setClient(null); PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); @@ -210,8 +214,6 @@ public class ConnectionService implements INetworkDispatch { if(ghost == null) return; - if () - Point3D objectPos = object.getWorldPosition(); List collidables = core.simulationService.getCollidables(object.getPlanet(), objectPos.x, objectPos.z, 512); diff --git a/src/services/InstanceService.java b/src/services/InstanceService.java new file mode 100644 index 00000000..8747fd2f --- /dev/null +++ b/src/services/InstanceService.java @@ -0,0 +1,778 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import resources.objects.building.BuildingObject; +import resources.objects.creature.CreatureObject; +import resources.objects.group.GroupObject; + +import main.NGECore; + +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.DatatableVisitor; +import engine.resources.common.CRC; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class InstanceService implements INetworkDispatch { + + private NGECore core; + + private Map> instanceMap = new HashMap>(); + + private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + + public class Instance { + + private long instanceId = 0; + private String name = ""; + private long startTime = System.currentTimeMillis(); + private Point3D instancePosition; + private Point3D spawnPosition; + private int duration = 0; + private int lockoutTime = 0; + private CreatureObject owner; + private List participants = new ArrayList(); + private List activeParticipants = new ArrayList(); + protected final Object objectMutex = new Object(); + private ScheduledFuture task; + private boolean faulty = false; + private boolean closed = false; + + public Instance(long instanceId, String name, Point3D instancePosition, Point3D spawnPosition, int duration, int lockoutTime, CreatureObject owner) { + this.instanceId = instanceId; + this.name = name; + this.instancePosition = instancePosition; + this.spawnPosition = spawnPosition; + this.duration = (duration * 1000); + this.lockoutTime = lockoutTime; + this.owner = owner; + participants.add(owner); + } + + public Instance() { + + } + + public long getInstanceId() { + synchronized(objectMutex) { + return instanceId; + } + } + + public String getName() { + synchronized(objectMutex) { + return name; + } + } + + public long getStartTime() { + synchronized(objectMutex) { + return startTime; + } + } + + public long getTimeRemaining() { + synchronized(objectMutex) { + return ((closed) ? 0 : (((long) duration) - (System.currentTimeMillis() - startTime))); + } + } + + public boolean isOpen() { + synchronized(objectMutex) { + if (closed || getTimeRemaining() <= 0) { + return false; + } + + return true; + } + } + + public Point3D getInstancePosition() { + synchronized(objectMutex) { + return instancePosition; + } + } + + public Point3D getSpawnPosition() { + synchronized(objectMutex) { + return spawnPosition; + } + } + + public int getDuration() { + synchronized(objectMutex) { + return duration; + } + } + + public int getLockoutTime() { + synchronized(objectMutex) { + return lockoutTime; + } + } + + public CreatureObject getOwner() { + synchronized(objectMutex) { + return owner; + } + } + + public List getParticipants() { + return participants; + } + + public List getActiveParticipants() { + return participants; + } + + public boolean addParticipant(CreatureObject participant) { + synchronized(objectMutex) { + if (activeParticipants.contains(participant)) { + return true; + } + + if (activeParticipants.size() >= 8) { + return false; + } + + activeParticipants.add(participant); + participants.add(participant); + + return true; + } + } + + public boolean isActiveParticipant(CreatureObject participant) { + synchronized(objectMutex) { + return activeParticipants.contains(participant); + } + } + + public boolean isFormerParticipant(CreatureObject participant) { + synchronized(objectMutex) { + return participants.contains(participant); + } + } + + public boolean removeParticipant(CreatureObject participant) { + synchronized(objectMutex) { + return activeParticipants.remove(participant); + } + } + + public ScheduledFuture getTask() { + synchronized(objectMutex) { + return task; + } + } + + public void setTask(ScheduledFuture task) { + synchronized(objectMutex) { + this.task = task; + } + } + + public boolean isFaulty() { + synchronized(objectMutex) { + return faulty; + } + } + + public void setFaulty(boolean faulty) { + synchronized(objectMutex) { + this.faulty = faulty; + } + } + + public boolean isClosed() { + synchronized(objectMutex) { + return closed; + } + } + + public void close() { + synchronized(objectMutex) { + closed = true; + } + } + + } + + public InstanceService(NGECore core) { + this.core = core; + } + + /* + * @author Treeku + * + * @description Create a brand new instance. + * + * @param instanceName Buildout name of the instance to build. + * @param owner Creator's creature object. + */ + public synchronized Instance create(String instanceName, CreatureObject owner) { + Instance instance = null; + + try { + String planetName = core.scriptService.callScript("scripts/instances/", instanceName, "getTerrain").asString(); + Planet planet = core.terrainService.getPlanetByPath(planetName); + Point3D spawnPosition = new Point3D(); + int duration = (core.scriptService.callScript("scripts/instances/", instanceName, "getDuration").asInt() * 60); + int lockoutTime = core.scriptService.callScript("scripts/instances/", instanceName, "getLockoutTime").asInt();; + + core.scriptService.callScript("scripts/instances/", instanceName, "getSpawnPosition", spawnPosition); + + DatatableVisitor buildoutTable = ClientFileManager.loadFile("datatables/buildout/areas_" + planet.getName() + ".iff", DatatableVisitor.class); + + for (int i = 0; i < buildoutTable.getRowCount(); i++) { + if (((String) buildoutTable.getObject(i, 0)).equals(instanceName)) { + Point3D instancePosition = new Point3D((Float) buildoutTable.getObject(i, 1), 0, (Float) buildoutTable.getObject(i, 2)); + + if (!instanceInUse(instanceName, instancePosition)) { + instance = new Instance(core.guildService.getGuildObject().getNextInstanceId(), instanceName, instancePosition, spawnPosition, duration, lockoutTime, owner); + } + } + } + + if (instance == null) { + return null; + } + + core.scriptService.callScript("scripts/instances/", instanceName, "setup", core, instance); + + final Instance reference = instance; + + instance.setTask(scheduler.scheduleAtFixedRate(new Runnable() { + + private final Instance instance = reference; + private boolean sentCloseWarning = false; + + public void run() { + if (instance.getDuration() > 300 && instance.getTimeRemaining() <= 300 && !sentCloseWarning) { + for (CreatureObject player : instance.getActiveParticipants()) { + player.sendSystemMessage("@instance:five_minute_warning", (byte) 0); + } + + sentCloseWarning = true; + } + + if (!instance.isOpen()) { + for (CreatureObject player : instance.getActiveParticipants()) { + player.sendSystemMessage("@instance:instance_time_out", (byte) 0); + } + + close(instance); + } + + core.scriptService.callScript("scripts/instances/", instance.getName(), "run", core, instance); + } + + }, 1, 1, TimeUnit.MINUTES)); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + if (!instanceMap.containsKey(instance.getName())) { + instanceMap.put(instance.getName(), new ArrayList()); + } + + instanceMap.get(instance.getName()).add(instance); + + return instance; + } + + + /* + * @author Treeku + * + * @description Queue them for an instance for 19 seconds, remove if none available. + * + * @param instanceName Name of the instance .py script. + * @param creature Player's creature object to queue for the instance. + * + * @return None. + */ + public void queue(String instanceName, CreatureObject creature) { + Instance instance = null; + + if (creature.getBuffByName("instance_launching") != null) { + creature.sendSystemMessage("@instance:instance_request_pending", (byte) 0); + return; + } + + core.buffService.addBuffToCreature(creature, "instance_launching"); + + if (isLockedOut(instanceName, creature)) { + creature.sendSystemMessage("@instance:lockout_notification", (byte) 0); + core.buffService.removeBuffFromCreature(creature, creature.getBuffByName("instance_launching")); + return; + } + + instance = getActiveInstance(instanceName, creature); + + if (creature.getGroupId() > 0) { + if (instance == null) { + GroupObject group = (GroupObject) core.objectService.getObject(creature.getGroupId()); + + if (group != null) { + for (SWGObject member : group.getMemberList()) { + instance = getActiveInstance(instanceName, (CreatureObject) member); + + if (instance != null) { + break; + } + } + } + } else { + GroupObject group = (GroupObject) core.objectService.getObject(creature.getGroupId()); + + if (group != null) { + for (SWGObject member : group.getMemberList()) { + Instance instance2 = getActiveInstance(instanceName, (CreatureObject) member); + + if (!instance2.equals(instance)) { + creature.sendSystemMessage("@instance:fail_invalid_lockout", (byte) 0); + core.buffService.removeBuffFromCreature(creature, creature.getBuffByName("instance_launching")); + return; + } + } + } + } + } + + if (instance == null) { + instance = create(instanceName, creature); + + if (instance == null) { + creature.sendSystemMessage("@instance:all_full", (byte) 0); + core.buffService.removeBuffFromCreature(creature, creature.getBuffByName("instance_launching")); + return; + } + } + + if (instance.getActiveParticipants().size() >= 8) { + creature.sendSystemMessage("@instance:fail_instance_full", (byte) 0); + core.buffService.removeBuffFromCreature(creature, creature.getBuffByName("instance_launching")); + return; + } + + if (instance != null) { + add(instance, creature); + } + + core.buffService.removeBuffFromCreature(creature, creature.getBuffByName("instance_launching")); + } + + /* + * @author Treeku + * + * @description Adds a player to an instance. Can be used directly to avoid queue. + * + * @param instance Instance object. + * @param creature Player's creature object to add to the instance. + * + * @return None. + */ + public synchronized void add(Instance instance, CreatureObject creature) { + try { + String terrain = core.scriptService.callScript("scripts/instances/", instance.getName(), "getTerrain").asString(); + Planet planet = core.terrainService.getPlanetByPath(terrain); + int cellId = core.scriptService.callScript("scripts/instances/", instance.getName(), "getCellId").asInt(); + + if (cellId == -1) { + Point3D position = new Point3D(); + position.x = instance.getInstancePosition().x + instance.getSpawnPosition().x; + position.y = instance.getInstancePosition().y + instance.getSpawnPosition().y; + position.z = instance.getInstancePosition().z + instance.getSpawnPosition().z; + + core.simulationService.transferToPlanet(creature, planet, position, creature.getOrientation(), null); + } else { + String buildingName = core.scriptService.callScript("scripts/instances/", instance.getName(), "getBuilding").asString(); + BuildingObject building = null; + + Point3D buildingPosition = instance.getInstancePosition().clone(); + + DatatableVisitor buildoutTable = ClientFileManager.loadFile("datatables/buildout/" + planet.getName() + "/" + instance.getName() + ".iff", DatatableVisitor.class); + + for (int i = 0; i < buildoutTable.getRowCount(); i++) { + if (((Integer) buildoutTable.getObject(i, 3)) == CRC.StringtoCRC(buildingName)) { + buildingPosition.x += ((Float) buildoutTable.getObject(i, 5)); + buildingPosition.y += ((Float) buildoutTable.getObject(i, 6)); + buildingPosition.z += ((Float) buildoutTable.getObject(i, 7)); + } + } + + for (SWGObject object : core.objectService.getObjectList().values()) { + if (object instanceof BuildingObject && + object.getTemplate().equals(buildingName) && + object.getPosition().x == buildingPosition.x && + object.getPosition().y == buildingPosition.y && + object.getPosition().z == buildingPosition.z) { + building = (BuildingObject) object; + break; + } + } + + if (building == null) { + throw new Exception(); + } + + core.simulationService.transferToPlanet(creature, planet, instance.getSpawnPosition(), creature.getOrientation(), building.getCellByCellNumber(cellId)); + } + + instance.addParticipant(creature); + + core.scriptService.callScript("scripts/instances/", instance.getName(), "add", core, instance, creature); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /* + * @author Treeku + * + * @description Removes a player from an instance. Can be used directly. + * + * @param instance Instance object. + * @param creature Player's creature object to add to the instance. + * + * @return None. + */ + public void remove(Instance instance, CreatureObject creature) { + try { + if (creature.getBuffByName("instance_exiting") != null) { + creature.sendSystemMessage("@instance:instance_request_pending", (byte) 0); + return; + } + + core.buffService.addBuffToCreature(creature, "instance_exiting"); + + String exitTerrain = core.scriptService.callScript("scripts/instances/", instance.getName(), "getExitTerrain").asString(); + Point3D exitPosition = new Point3D(); + Planet exitPlanet = core.terrainService.getPlanetByPath(exitTerrain); + + core.scriptService.callScript("scripts/instances/", instance.getName(), "getExitPosition", exitPosition); + + core.scriptService.callScript("scripts/instances/", instance.getName(), "remove", core, instance, creature); + + instance.removeParticipant(creature); + + core.simulationService.transferToPlanet(creature, exitPlanet, exitPosition, creature.getOrientation(), null); + } catch (Exception e) { + e.printStackTrace(); + } + + core.buffService.removeBuffFromCreature(creature, creature.getBuffByName("instance_exiting")); + } + + /* + * @author Treeku + * + * @description Closes an instance. + * + * @param instance Instance object. + * + * @return None. + */ + public synchronized void close(Instance instance) { + try { + if (instance.isClosed()) { + return; + } + + String exitTerrain = core.scriptService.callScript("scripts/instances/", instance.getName(), "getExitTerrain").asString(); + Point3D exitPosition = new Point3D(); + Planet exitPlanet = core.terrainService.getPlanetByPath(exitTerrain); + + core.scriptService.callScript("scripts/instances/", instance.getName(), "getExitPosition", exitPosition); + + for (CreatureObject participant : instance.getActiveParticipants()) { + instance.removeParticipant(participant); + core.simulationService.transferToPlanet(participant, exitPlanet, exitPosition, participant.getOrientation(), null); + } + + if (!instance.getTask().isCancelled()) { + instance.getTask().cancel(true); + } + + core.scriptService.callScript("scripts/instances/", instance.getName(), "destroy", core, instance); + + instance.close(); + } catch (Exception e) { + e.printStackTrace(); + instance.setFaulty(true); + } + } + + /* + * @author Treeku + * + * @description Checks if an instance area is in use. + * + * @param instanceName Buildout name of the instance. + * @param instancePosition Position of the instance in the game world. + * + * @return True if instance is in use. + */ + public boolean instanceInUse(String instanceName, Point3D instancePosition) { + if (instanceMap.containsKey(instanceName)) { + for (Instance instance : instanceMap.get(instanceName)) { + if (instance.isFaulty() || (instance.isOpen() && + instance.getInstancePosition().x == instancePosition.x && + instance.getInstancePosition().z == instancePosition.z)) { + return true; + } + } + } + + return false; + } + + /* + * @author Treeku + * + * @description Gets an instance object from an instanceId. + * + * @param instanceId Id of an instance you want an object for. + * + * @return Instance object, or null if none found. + */ + public Instance getInstance(long instanceId) { + for (List instanceList : instanceMap.values()) { + for (Instance instance : instanceList) { + if (instance.getInstanceId() == instanceId) { + return instance; + } + } + } + + return null; + } + + /* + * @author Treeku + * + * @description Checks if player is in an instance. + * + * @param creature Player's creature object. + * + * @return True if player is in an instance. + */ + public boolean isInInstance(CreatureObject creature) { + for (List instanceList : instanceMap.values()) { + for (Instance instance : instanceList) { + if (instance.isActiveParticipant(creature)) { + return true; + } + } + } + + return false; + } + + /* + * @author Treeku + * + * @description Checks if player is in a specific instance. + * + * @param instanceName Buildout name of the instance. + * @param creature Player's creature object. + * + * @return True if player is in the specified instance. + */ + public boolean isInInstance(String instanceName, CreatureObject creature) { + if (instanceMap.containsKey(instanceName)) { + for (Instance instance : instanceMap.get(instanceName)) { + if (instance.isActiveParticipant(creature)) { + return true; + } + } + } + + return false; + } + + /* + * @author Treeku + * + * @description Checks if player is in a specific instance. + * + * @param instance Instance object. + * @param creature Player's creature object. + * + * @return True if player is in the specified instance. + */ + public boolean isInInstance(Instance instance, CreatureObject creature) { + return instance.getActiveParticipants().contains(creature); + } + + /* + * @author Treeku + * + * @description Finds the instance object a player is currently in. + * + * @param creature Player's creature object. + * + * @return Instance object of the player, or null if they aren't in one. + */ + public Instance getActiveInstance(CreatureObject creature) { + for (List instanceList : instanceMap.values()) { + for (Instance instance : instanceList) { + if (instance.isActiveParticipant(creature)) { + return instance; + } + } + } + + return null; + } + + /* + * @author Treeku + * + * @description Finds the instance object of an instance a player is/has been in. + * + * @param instanceName Buildout name of the instance. + * @param creature Player's creature object. + * + * @return Instance object of the specified instance the specified player has entered since reset, or null if not found. + */ + public Instance getActiveInstance(String instanceName, CreatureObject creature) { + if (instanceMap.containsKey(instanceName)) { + for (Instance instance : instanceMap.get(instanceName)) { + if (instance.isFormerParticipant(creature) && instance.getTimeRemaining() > 0) { + return instance; + } + } + } + + return null; + } + + /* + * @author Treeku + * + * @description Checks if player has any instance lockouts. + * + * @param creature Player's creature object. + * + * @return True if player is locked out from any instances. + */ + public boolean hasInstanceLockout(CreatureObject creature) { + for (List instanceList : instanceMap.values()) { + for (Instance instance : instanceList) { + if (instance.isFormerParticipant(creature)) { + return true; + } + } + } + + return false; + } + + /* + * @author Treeku + * + * @description Finds the instance object of an instance a player is/has been in. + * + * @param instanceName Buildout name of the instance. + * @param creature Player's creature object. + * + * @return Instance object of the specified instance the specified player has entered since reset, or null if not found. + */ + public List getLockoutList(CreatureObject creature) { + List lockoutList = new ArrayList(); + + for (List instanceList : instanceMap.values()) { + for (Instance instance : instanceList) { + if (instance.isFormerParticipant(creature)) { + lockoutList.add(instance); + } + } + } + + return lockoutList; + } + + /* + * @author Treeku + * + * @description Checks if player is locked out of an instance. + * + * @param instanceName Buildout name of the instance. + * @param creature Player's creature object. + * + * @return True if player is locked out from the specified instance. + */ + public boolean isLockedOut(String instanceName, CreatureObject creature) { + if (instanceMap.containsKey(instanceName)) { + for (Instance instance : instanceMap.get(instanceName)) { + if (instance.isFormerParticipant(creature) && instance.getTimeRemaining() <= 0) { + return true; + } + } + } + + return false; + } + + /* + * @author Treeku + * + * @description Shows the instance UI. + * + * @param creature Player's creature object. + * + * @return None. + */ + public void showInstances(CreatureObject creature) { + // Stub for the /showi UI + } + + @Override + public void insertOpcodes(Map swgOpcodes, + Map objControllerOpcodes) { + // TODO Auto-generated method stub + + } + + @Override + public void shutdown() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index a71cb9c3..5c9c06b7 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -162,6 +162,7 @@ public class SimulationService implements INetworkDispatch { core.commandService.registerCommand("editbiography"); core.commandService.registerCommand("setbiography"); core.commandService.registerCommand("requestbiography"); + core.commandService.registerCommand("eject"); } From d210dc7ad7c425ccae16543e0dd517a65affb4a9 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 19 Mar 2014 15:56:52 -0400 Subject: [PATCH 27/36] Added posture checks, radial script for player objects, bug fixes (Bug Fix) Must now wait before performing multiple flourishes (Bug Fix) Can no longer propose to yourself (aka your hand) (Bug Fix) Fixed some strings that didn't have variables (Added) Posture checks before Skill Animating (Added) Additional radial options show on players --- scripts/commands/flourish.py | 8 +---- scripts/commands/startdance.py | 11 +++++-- .../object/creature/player/bothan_female.py | 1 + scripts/object/creature/player/bothan_male.py | 1 + .../object/creature/player/human_female.py | 1 + scripts/object/creature/player/human_male.py | 1 + .../object/creature/player/ithorian_female.py | 1 + .../object/creature/player/ithorian_male.py | 1 + .../object/creature/player/moncal_female.py | 1 + scripts/object/creature/player/moncal_male.py | 1 + .../object/creature/player/rodian_female.py | 1 + scripts/object/creature/player/rodian_male.py | 1 + .../creature/player/sullustan_female.py | 1 + .../object/creature/player/sullustan_male.py | 1 + .../creature/player/trandoshan_female.py | 1 + .../object/creature/player/trandoshan_male.py | 1 + .../object/creature/player/twilek_female.py | 1 + scripts/object/creature/player/twilek_male.py | 1 + .../object/creature/player/wookiee_female.py | 1 + .../object/creature/player/wookiee_male.py | 1 + .../object/creature/player/zabrak_female.py | 1 + scripts/object/creature/player/zabrak_male.py | 1 + scripts/radial/player.py | 23 +++++++++++++ scripts/radial/ring/unity.py | 2 ++ src/resources/datatables/Posture.java | 21 ++++++++++++ .../objects/creature/CreatureObject.java | 7 ++-- src/services/EntertainmentService.java | 33 +++++++++++++++++-- 27 files changed, 110 insertions(+), 15 deletions(-) create mode 100644 scripts/radial/player.py create mode 100644 src/resources/datatables/Posture.java diff --git a/scripts/commands/flourish.py b/scripts/commands/flourish.py index 37c26077..0ec20d6b 100644 --- a/scripts/commands/flourish.py +++ b/scripts/commands/flourish.py @@ -22,11 +22,5 @@ def run(core, actor, target, commandString): if actor.getPerformanceId() <= 0: actor.sendSystemMessage('@performance:flourish_not_performing', 0) return - - actor.incFlourishCount() - actor.sendSystemMessage('@performance:flourish_perform', 0) - animation = 'skill_action_' + str(flourish) - if flourish == 9: - animation = 'mistake' - actor.doSkillAnimation(animation) + core.entertainmentService.performFlourish(actor, flourish) \ No newline at end of file diff --git a/scripts/commands/startdance.py b/scripts/commands/startdance.py index bae424d8..23b815c6 100644 --- a/scripts/commands/startdance.py +++ b/scripts/commands/startdance.py @@ -4,6 +4,7 @@ from services.sui.SUIWindow import Trigger from services.sui.SUIService import ListBoxType from java.util import Vector from java.util import HashMap +from resources.datatables import Posture import sys def setup(): @@ -26,7 +27,6 @@ def run(core, actor, target, commandString): else: availableDances = entSvc.getAvailableDances(actor) - print availableDances suiSvc = core.suiService suiWindow = suiSvc.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "@performance:select_dance", "@performance:available_dances", availableDances, actor, None, 10) @@ -74,8 +74,13 @@ def startDance(core, actor, danceName, visual): actor.sendSystemMessage('@performance:already_performing_self',0) return - #TODO: check costume, posture, etc? - + #TODO: check costume + + if actor.getPosture() != Posture.Upright: + print (' can\t dance because ' + str(actor.getPosture())) + actor.sendSystemMessage('@performance:dance_fail', 0) + return + actor.sendSystemMessage('@performance:dance_start_self',0); # i'm not sure about this. i think stopping just stopped any watchers anyways # method doesn't exist now. diff --git a/scripts/object/creature/player/bothan_female.py b/scripts/object/creature/player/bothan_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/bothan_female.py +++ b/scripts/object/creature/player/bothan_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/bothan_male.py b/scripts/object/creature/player/bothan_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/bothan_male.py +++ b/scripts/object/creature/player/bothan_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/human_female.py b/scripts/object/creature/player/human_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/human_female.py +++ b/scripts/object/creature/player/human_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/human_male.py b/scripts/object/creature/player/human_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/human_male.py +++ b/scripts/object/creature/player/human_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/ithorian_female.py b/scripts/object/creature/player/ithorian_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/ithorian_female.py +++ b/scripts/object/creature/player/ithorian_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/ithorian_male.py b/scripts/object/creature/player/ithorian_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/ithorian_male.py +++ b/scripts/object/creature/player/ithorian_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/moncal_female.py b/scripts/object/creature/player/moncal_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/moncal_female.py +++ b/scripts/object/creature/player/moncal_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/moncal_male.py b/scripts/object/creature/player/moncal_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/moncal_male.py +++ b/scripts/object/creature/player/moncal_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/rodian_female.py b/scripts/object/creature/player/rodian_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/rodian_female.py +++ b/scripts/object/creature/player/rodian_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/rodian_male.py b/scripts/object/creature/player/rodian_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/rodian_male.py +++ b/scripts/object/creature/player/rodian_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/sullustan_female.py b/scripts/object/creature/player/sullustan_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/sullustan_female.py +++ b/scripts/object/creature/player/sullustan_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/sullustan_male.py b/scripts/object/creature/player/sullustan_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/sullustan_male.py +++ b/scripts/object/creature/player/sullustan_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/trandoshan_female.py b/scripts/object/creature/player/trandoshan_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/trandoshan_female.py +++ b/scripts/object/creature/player/trandoshan_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/trandoshan_male.py b/scripts/object/creature/player/trandoshan_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/trandoshan_male.py +++ b/scripts/object/creature/player/trandoshan_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/twilek_female.py b/scripts/object/creature/player/twilek_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/twilek_female.py +++ b/scripts/object/creature/player/twilek_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/twilek_male.py b/scripts/object/creature/player/twilek_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/twilek_male.py +++ b/scripts/object/creature/player/twilek_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/wookiee_female.py b/scripts/object/creature/player/wookiee_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/wookiee_female.py +++ b/scripts/object/creature/player/wookiee_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/wookiee_male.py b/scripts/object/creature/player/wookiee_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/wookiee_male.py +++ b/scripts/object/creature/player/wookiee_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/zabrak_female.py b/scripts/object/creature/player/zabrak_female.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/zabrak_female.py +++ b/scripts/object/creature/player/zabrak_female.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/object/creature/player/zabrak_male.py b/scripts/object/creature/player/zabrak_male.py index ccad8904..b80d569c 100644 --- a/scripts/object/creature/player/zabrak_male.py +++ b/scripts/object/creature/player/zabrak_male.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'player') return \ No newline at end of file diff --git a/scripts/radial/player.py b/scripts/radial/player.py new file mode 100644 index 00000000..3ca2cc75 --- /dev/null +++ b/scripts/radial/player.py @@ -0,0 +1,23 @@ +from resources.common import RadialOptions +from resources.datatables import Posture +import sys + +def createRadial(core, owner, target, radials): + if target.getPosture() == Posture.SkillAnimating: + if target.getPerformanceType() is True: + radials.add(RadialOptions(0, 140, 1, 'Watch')) + else: + radials.add(RadialOptions(0, 140, 1, 'Listen')) + + return + +def handleSelection(core, owner, target, option): + if option == 140: + if target.getPerformanceType() is True: + core.commandService.callCommand(owner, 'watch', target, '') + return + else: + # TODO: Insert callCommand /listen + return + return + return \ No newline at end of file diff --git a/scripts/radial/ring/unity.py b/scripts/radial/ring/unity.py index f57f3034..5065a8f4 100644 --- a/scripts/radial/ring/unity.py +++ b/scripts/radial/ring/unity.py @@ -14,6 +14,8 @@ def createRadial(core, owner, target, radials): if ghost.getSpouseName() is None or ghost.getSpouseName() is "": targetPlayer = core.objectService.getObject(owner.getTargetId()) if targetPlayer is not None and targetPlayer.getSlottedObject('ghost') is not None: + if targetPlayer.getObjectID() is owner.getObjectID(): + return radials.add(RadialOptions(0, 69, 1, '@unity:mnu_propose')) return else: diff --git a/src/resources/datatables/Posture.java b/src/resources/datatables/Posture.java new file mode 100644 index 00000000..312337f1 --- /dev/null +++ b/src/resources/datatables/Posture.java @@ -0,0 +1,21 @@ +package resources.datatables; + +public class Posture { + // Posture.iff + public static final int Invalid = -1; + public static final int Upright = 0; + public static final int Crouched = 1; + public static final int Prone = 2; + public static final int Sneaking = 3; + public static final int Blocking = 4; + public static final int Climbing = 5; + public static final int Flying = 6; + public static final int LyingDown = 7; + public static final int Sitting = 8; + public static final int SkillAnimating = 9; + public static final int DrivingVehicle = 10; + public static final int RidingCreature = 11; + public static final int KnockedDown = 12; + public static final int Incapacitated = 13; + public static final int Dead = 14; +} diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 19d60409..a3166959 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -355,11 +355,10 @@ public class CreatureObject extends TangibleObject implements IPersistent { this.posture = posture; } - IoBuffer postureDelta = messageBuilder.buildPostureDelta(posture); Posture postureUpdate = new Posture(getObjectID(), posture); ObjControllerMessage objController = new ObjControllerMessage(0x1B, postureUpdate); - notifyObservers(postureDelta, true); + notifyObservers(messageBuilder.buildPostureDelta(posture), true); notifyObservers(objController, true); if (needsStopPerformance) { @@ -377,6 +376,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { public void stopPerformance() { String type = ""; synchronized(objectMutex) { + // TODO: Minimum check to wait for song to finish before stopping... ? setPerformanceId(0,true); setPerformanceCounter(0); setCurrentAnimation(""); @@ -413,7 +413,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { next.setMoodAnimation(""); } if (next == this) { continue; } - next.sendSystemMessage("@performance:" + type + "_stop_other",(byte)0); + if(performanceType) { next.sendSystemMessage("You stop watching " + getCustomName() + ".",(byte)0); } + else { next.sendSystemMessage("You stop listening to " + getCustomName() + ".",(byte)0); } next.getSpectatorTask().cancel(true); } //not sure if this behaviour is correct. might need fixing later. diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index a57d486d..ad35f3f8 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -429,8 +429,7 @@ public class EntertainmentService implements INetworkDispatch { public void run() { if (spectator.getPosition().getDistance2D(performer.getWorldPosition()) > (float) 70) { - String pType = (performer.getPerformanceType()) ? "dance" : "music"; - if(pType.equals("dance")) { + if(((performer.getPerformanceType()) ? "dance" : "music").equals("dance")) { spectator.setPerformanceWatchee(null); spectator.sendSystemMessage("You stop watching " + performer.getCustomName() + " because " + performer.getCustomName() + " is out of range.", (byte) 0); @@ -452,6 +451,36 @@ public class EntertainmentService implements INetworkDispatch { spectator.setSpectatorTask(spectatorTask); } + public void performFlourish(final CreatureObject performer, int flourish) { + + if (performer.getFlourishCount() > 0) { + performer.sendSystemMessage("@performance:wait_flourish_self", (byte) 0); + return; + } + Performance performance = getPerformanceByIndex(performer.getPerformanceId()); + + if(performance == null) + return; + + String anmFlo = "skill_action_" + flourish; + + if (flourish == 9) + anmFlo = "mistake"; + + performer.setFlourishCount(1); + performer.sendSystemMessage("@performance:flourish_perform", (byte) 0); + performer.doSkillAnimation(anmFlo); + + scheduler.schedule(new Runnable() { + + @Override + public void run() { + performer.setFlourishCount(0); + } + + }, (long) performance.getLoopDuration(), TimeUnit.SECONDS); + } + @Override public void shutdown() { From 119451e293ce4f3c56819e4fa418a82c7faf9c62 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 19 Mar 2014 16:11:22 -0400 Subject: [PATCH 28/36] Fixed starterclothing script, added startInstance to setgodmode command --- scripts/commands/setgodmode.py | 20 +++----------------- scripts/starterclothing.py | 12 ++++++------ 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 536a588b..455e2d82 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -1,10 +1,6 @@ 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 @@ -16,9 +12,6 @@ def run(core, actor, target, commandString): if not playerObject: return - if target is not None: - print ('has target!') - commandArgs = commandString.split(' ') command = commandArgs[0] if len(commandArgs) > 1: @@ -60,17 +53,10 @@ def run(core, actor, target, commandString): 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()) + + elif command == 'startInstance' and arg1: + core.instanceService.queue(arg1, actor) return diff --git a/scripts/starterclothing.py b/scripts/starterclothing.py index 567e1345..3f0a3101 100644 --- a/scripts/starterclothing.py +++ b/scripts/starterclothing.py @@ -7,17 +7,17 @@ def CreateStarterClothing(core, object, starterProfession, raceTemplate): if starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/human_male.iff': core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/human_female.iff': core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) From cf55c5968f85591ae343d07641273d389e7c74c0 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 19 Mar 2014 16:33:26 -0400 Subject: [PATCH 29/36] Revert "Fixed starterclothing script, added startInstance to setgodmode command" This reverts commit 119451e293ce4f3c56819e4fa418a82c7faf9c62. --- scripts/commands/setgodmode.py | 20 +++++++++++++++++--- scripts/starterclothing.py | 12 ++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 455e2d82..536a588b 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -1,6 +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 @@ -12,6 +16,9 @@ def run(core, actor, target, commandString): if not playerObject: return + if target is not None: + print ('has target!') + commandArgs = commandString.split(' ') command = commandArgs[0] if len(commandArgs) > 1: @@ -53,10 +60,17 @@ def run(core, actor, target, commandString): 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()) - - elif command == 'startInstance' and arg1: - core.instanceService.queue(arg1, actor) return diff --git a/scripts/starterclothing.py b/scripts/starterclothing.py index 3f0a3101..567e1345 100644 --- a/scripts/starterclothing.py +++ b/scripts/starterclothing.py @@ -7,17 +7,17 @@ def CreateStarterClothing(core, object, starterProfession, raceTemplate): if starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/human_male.iff': core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/zabrak_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/bothan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/sullustan_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/twilek_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/moncal_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/rodian_male.iff': - core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", core, object) + core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_male", "OutdoorScoutHumanoidMale", coree, object) elif starterProfession == 'outdoors_scout' and raceTemplate == 'object/creature/player/human_female.iff': core.scriptService.callScript("scripts/starter_clothing/", "outdoors_scout_humanoid_female", "OutdoorScoutHumanoidFemale", core, object) From 9a100ee49fd81c06f307919fb44e577157561dd9 Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 20:36:43 +0000 Subject: [PATCH 30/36] lookAtTarget (cursor) intendedTarget (target) Updated target's position in the baseline. The two unknown longs were the lookAtTarget (thing you cursor is hovering over), which I believe probably comes before the actual target. This could improve radial menus if the order is right, and allow them to work even if you don't have the object targetted. --- .../common/ObjControllerOpcodes.java | 5 ++- .../creature/CreatureMessageBuilder.java | 18 ++++++--- .../objects/creature/CreatureObject.java | 39 ++++++++++++++----- src/services/SimulationService.java | 30 +++++++++++--- 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 0317dfd0..64636512 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -27,12 +27,13 @@ public class ObjControllerOpcodes { public static final int DATA_TRANSFORM_WITH_PARENT = 0xF1000000; public static final int COMMAND_QUEUE_ENQUEUE = 0x16010000; public static final int COMMAND_QUEUE_REMOVE = 0x17010000; - public static final int HOVER_TARGET = 0x26010000; // lookAtTarget - public static final int TARGET_UPDATE = 0xC5040000; // intendedTarget + public static final int lookAtTarget = 0x26010000; + public static final int intendedTarget = 0xC5040000; 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/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index 8e917fe9..9ffad44b 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -256,8 +256,8 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putInt(creature.getGuildId()); - buffer.putLong(0); // lookAtTarget 0x10 - buffer.putLong(creature.getTargetId()); // intendedTarget 0x11 + buffer.putLong(creature.getLookAtTarget()); // lookAtTarget 0x10 + buffer.putLong(creature.getIntendedTarget()); // intendedTarget 0x11 buffer.put(creature.getMoodId()); buffer.putInt(creature.getPerformanceCounter()); /* @@ -664,16 +664,22 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } - public IoBuffer buildTargetDelta(long targetId) { - + public IoBuffer buildLookAtTargetDelta(long targetId) { IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN); buffer.putLong(targetId); int size = buffer.position(); buffer.flip(); buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x10, buffer, size + 4); - return buffer; - + } + + public IoBuffer buildIntendedTargetDelta(long targetId) { + IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putLong(targetId); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x11, buffer, size + 4); + return buffer; } public IoBuffer buildHealthDelta(int health) { diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 19d60409..5ef41fc8 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -56,7 +56,7 @@ import engine.resources.scene.Quaternion; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; -@Entity(version=0) +@Entity(version=1) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -112,6 +112,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { private String inviteSenderName; private long inviteCounter = 0; private int guildId = 0; + private long lookAtTarget = 0; private long targetId = 0; private byte moodId = 0; private int performanceCounter = 0; @@ -959,23 +960,43 @@ public class CreatureObject extends TangibleObject implements IPersistent { this.guildId = guildId; } } - - public long getTargetId() { + + public long getLookAtTarget() { + synchronized(objectMutex) { + return lookAtTarget; + } + } + + public void setLookAtTarget(long lookAtTarget) { + synchronized(objectMutex) { + this.lookAtTarget = lookAtTarget; + } + + notifyObservers(messageBuilder.buildLookAtTargetDelta(lookAtTarget), true); + } + + public long getIntendedTarget() { synchronized(objectMutex) { return targetId; } } - public void setTargetId(long targetId) { + public void setIntendedTarget(long intendedTarget) { synchronized(objectMutex) { - this.targetId = targetId; + this.targetId = intendedTarget; } - IoBuffer targetDelta = messageBuilder.buildTargetDelta(targetId); - notifyObservers(targetDelta, false); - + notifyObservers(messageBuilder.buildIntendedTargetDelta(intendedTarget), true); } - + + public long getTargetId() { + return getIntendedTarget(); + } + + public void setTargetId(long targetId) { + setIntendedTarget(targetId); + } + public long getInviteCounter() { synchronized(objectMutex) { return inviteCounter; diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 5c9c06b7..98f4a230 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -437,7 +437,7 @@ public class SimulationService implements INetworkDispatch { }); - objControllerOpcodes.put(ObjControllerOpcodes.TARGET_UPDATE, new INetworkRemoteEvent() { + objControllerOpcodes.put(ObjControllerOpcodes.lookAtTarget, new INetworkRemoteEvent() { @Override public void handlePacket(IoSession session, IoBuffer data) throws Exception { @@ -460,19 +460,39 @@ public class SimulationService implements INetworkDispatch { TargetUpdate targetUpdate = new TargetUpdate(); targetUpdate.deserialize(data); - object.setTargetId(targetUpdate.getTargetId()); + object.setLookAtTarget(targetUpdate.getTargetId()); } - + }); - objControllerOpcodes.put(ObjControllerOpcodes.HOVER_TARGET, new INetworkRemoteEvent() { + objControllerOpcodes.put(ObjControllerOpcodes.intendedTarget, new INetworkRemoteEvent() { @Override public void handlePacket(IoSession session, IoBuffer data) throws Exception { + data.order(ByteOrder.LITTLE_ENDIAN); + + Client client = core.getClient(session); + + if(client == null) { + System.out.println("NULL Client"); + return; + } + + if(client.getParent() == null) { + System.out.println("NULL Object"); + return; + } + CreatureObject object = (CreatureObject) client.getParent(); + + TargetUpdate targetUpdate = new TargetUpdate(); + targetUpdate.deserialize(data); + + object.setIntendedTarget(targetUpdate.getTargetId()); + } - + }); } From 69832cc30da274e1be59fd6474e877e292c20289 Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 20:37:37 +0000 Subject: [PATCH 31/36] Temp quadtree remove() fix --- src/services/SimulationService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 98f4a230..9b9a81ab 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -263,6 +263,10 @@ public class SimulationService implements INetworkDispatch { } public boolean remove(SWGObject object, float x, float y, boolean notifyObservers) { + if (object == null || !object.isInQuadtree()) { + return false; + } + boolean success = quadTrees.get(object.getPlanet().getName()).remove(x, y, object); object.setIsInQuadtree(success); if(success && notifyObservers) { From 49ceedf404f41c64dd8af685ab6527143aa626bc Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 19 Mar 2014 17:40:33 -0400 Subject: [PATCH 32/36] Fixed check --- scripts/radial/ring/unity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/radial/ring/unity.py b/scripts/radial/ring/unity.py index 5065a8f4..8c1c4c5d 100644 --- a/scripts/radial/ring/unity.py +++ b/scripts/radial/ring/unity.py @@ -14,7 +14,7 @@ def createRadial(core, owner, target, radials): if ghost.getSpouseName() is None or ghost.getSpouseName() is "": targetPlayer = core.objectService.getObject(owner.getTargetId()) if targetPlayer is not None and targetPlayer.getSlottedObject('ghost') is not None: - if targetPlayer.getObjectID() is owner.getObjectID(): + if targetPlayer.getObjectID() == owner.getObjectID(): return radials.add(RadialOptions(0, 69, 1, '@unity:mnu_propose')) return @@ -105,4 +105,4 @@ def handlePropose(owner, window, eventType, returnList): owner.setAttachment("proposer", None) return - return \ No newline at end of file + return From 0948a68c3b76fc4595815db0aa454b06d4dceef6 Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 22:07:29 +0000 Subject: [PATCH 33/36] Enabled heroic dungeons, fixed radials getOptionType() seems to work now --- src/main/NGECore.java | 4 +- .../ObjectMenuResponse.java | 37 +++++++------------ src/services/trade/TradeService.java | 2 +- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 1483e4f7..6a351892 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -328,10 +328,10 @@ public class NGECore { 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(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 // 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); diff --git a/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java b/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java index 1d1ae2c5..f7533788 100644 --- a/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java +++ b/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java @@ -59,41 +59,30 @@ public class ObjectMenuResponse extends ObjControllerObject { @Override public IoBuffer serialize() { + int size = 37; + byte counter = 0; - IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); - result.setAutoExpand(true); + for (RadialOptions radialOption : radialOptions) { + size += 5 + getUnicodeString(radialOption.getDescription()).length; + } + IoBuffer result = IoBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN); result.putInt(ObjControllerMessage.OBJECT_MENU_RESPONSE); result.putLong(ownerId); result.putInt(0); result.putLong(targetId); result.putLong(ownerId); - - int size = radialOptions.size(); - result.putInt(size); - - if(size > 0) { - byte counter = 0; - for(RadialOptions radialOption : radialOptions) { - result.put(++counter); - result.put(radialOption.getParentId()); - result.putShort(radialOption.getOptionId()); - //result.put(radialOption.getOptionType()); - result.put((byte) 3); - - if(radialOption.getDescription().length() > 0) - result.put(getUnicodeString(radialOption.getDescription())); - else - result.putInt(0); - - } + result.putInt(radialOptions.size()); + for (RadialOptions radialOption : radialOptions) { + result.put(++counter); + result.put(radialOption.getParentId()); + result.putShort(radialOption.getOptionId()); + result.put(radialOption.getOptionType()); //result.put((byte) 3); + result.put(getUnicodeString(radialOption.getDescription())); } result.put(radialCount); - int packetSize = result.position(); - result = IoBuffer.allocate(packetSize).put(result.array(), 0, packetSize); return result.flip(); - } } diff --git a/src/services/trade/TradeService.java b/src/services/trade/TradeService.java index 3490c69a..cde8292e 100644 --- a/src/services/trade/TradeService.java +++ b/src/services/trade/TradeService.java @@ -202,7 +202,7 @@ public class TradeService implements INetworkDispatch{ } else { - if(objectToTrade.getAttributes()/*.toString()*/.containsKey("no_trade")) { + if(objectToTrade.getAttributes().containsKey("no_trade")) { return; } From 6412a8914a5ffcf72fd73f78724bb50174cb3212 Mon Sep 17 00:00:00 2001 From: Treeku Date: Wed, 19 Mar 2014 23:07:57 +0000 Subject: [PATCH 34/36] Fixed bug with previous buildout id change --- src/services/object/ObjectService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index c5535ddd..6f164ebc 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -809,8 +809,8 @@ public class ObjectService implements INetworkDispatch { // Since the ids are just ints, they append 0xFFFF86F9 to them // This is demonstated in the packet sent to the server when you /target client-spawned objects - objectId = Delta.createBuffer(8).putInt((Integer) buildoutTable.getObject(i, 0)).putInt(0xF986FFFF).flip().getLong(); - containerId = (Integer) buildoutTable.getObject(i, 1); + objectId = (((Integer) buildoutTable.getObject(i, 0) == 0) ? 0 : Delta.createBuffer(8).putInt((Integer) buildoutTable.getObject(i, 0)).putInt(0xF986FFFF).flip().getLong()); + containerId = (((Integer) buildoutTable.getObject(i, 1) == 0) ? 0 : Delta.createBuffer(8).putInt((Integer) buildoutTable.getObject(i, 1)).putInt(0xF986FFFF).flip().getLong()); type = (Integer) buildoutTable.getObject(i, 2); cellIndex = (Integer) buildoutTable.getObject(i, 4); From 17fbb79ef079f329d2b0f5af142c65d2c58ee85e Mon Sep 17 00:00:00 2001 From: Treeku Date: Thu, 20 Mar 2014 15:24:19 +0000 Subject: [PATCH 35/36] Synchronization improvements for instances --- src/services/InstanceService.java | 184 +++++++++--------------------- 1 file changed, 56 insertions(+), 128 deletions(-) diff --git a/src/services/InstanceService.java b/src/services/InstanceService.java index 8747fd2f..d5c032a0 100644 --- a/src/services/InstanceService.java +++ b/src/services/InstanceService.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -63,9 +64,8 @@ public class InstanceService implements INetworkDispatch { private int duration = 0; private int lockoutTime = 0; private CreatureObject owner; - private List participants = new ArrayList(); - private List activeParticipants = new ArrayList(); - protected final Object objectMutex = new Object(); + private List participants = new CopyOnWriteArrayList(); + private List activeParticipants = new CopyOnWriteArrayList(); private ScheduledFuture task; private boolean faulty = false; private boolean closed = false; @@ -85,68 +85,48 @@ public class InstanceService implements INetworkDispatch { } - public long getInstanceId() { - synchronized(objectMutex) { - return instanceId; - } + public synchronized long getInstanceId() { + return instanceId; } - public String getName() { - synchronized(objectMutex) { - return name; - } + public synchronized String getName() { + return name; } - public long getStartTime() { - synchronized(objectMutex) { - return startTime; - } + public synchronized long getStartTime() { + return startTime; } - public long getTimeRemaining() { - synchronized(objectMutex) { - return ((closed) ? 0 : (((long) duration) - (System.currentTimeMillis() - startTime))); - } + public synchronized long getTimeRemaining() { + return ((closed) ? 0 : (((long) duration) - (System.currentTimeMillis() - startTime))); } - public boolean isOpen() { - synchronized(objectMutex) { - if (closed || getTimeRemaining() <= 0) { - return false; - } - - return true; + public synchronized boolean isOpen() { + if (closed || getTimeRemaining() <= 0) { + return false; } + + return true; } - public Point3D getInstancePosition() { - synchronized(objectMutex) { - return instancePosition; - } + public synchronized Point3D getInstancePosition() { + return instancePosition; } - public Point3D getSpawnPosition() { - synchronized(objectMutex) { - return spawnPosition; - } + public synchronized Point3D getSpawnPosition() { + return spawnPosition; } - public int getDuration() { - synchronized(objectMutex) { - return duration; - } + public synchronized int getDuration() { + return duration; } - public int getLockoutTime() { - synchronized(objectMutex) { - return lockoutTime; - } + public synchronized int getLockoutTime() { + return lockoutTime; } - public CreatureObject getOwner() { - synchronized(objectMutex) { - return owner; - } + public synchronized CreatureObject getOwner() { + return owner; } public List getParticipants() { @@ -157,75 +137,55 @@ public class InstanceService implements INetworkDispatch { return participants; } - public boolean addParticipant(CreatureObject participant) { - synchronized(objectMutex) { - if (activeParticipants.contains(participant)) { - return true; - } - - if (activeParticipants.size() >= 8) { - return false; - } - - activeParticipants.add(participant); - participants.add(participant); - + public synchronized boolean addParticipant(CreatureObject participant) { + if (activeParticipants.contains(participant)) { return true; } + + if (activeParticipants.size() >= 8) { + return false; + } + + activeParticipants.add(participant); + participants.add(participant); + + return true; } - public boolean isActiveParticipant(CreatureObject participant) { - synchronized(objectMutex) { - return activeParticipants.contains(participant); - } + public synchronized boolean isActiveParticipant(CreatureObject participant) { + return activeParticipants.contains(participant); } - public boolean isFormerParticipant(CreatureObject participant) { - synchronized(objectMutex) { - return participants.contains(participant); - } + public synchronized boolean isFormerParticipant(CreatureObject participant) { + return participants.contains(participant); } - public boolean removeParticipant(CreatureObject participant) { - synchronized(objectMutex) { - return activeParticipants.remove(participant); - } + public synchronized boolean removeParticipant(CreatureObject participant) { + return activeParticipants.remove(participant); } - public ScheduledFuture getTask() { - synchronized(objectMutex) { - return task; - } + public synchronized ScheduledFuture getTask() { + return task; } - public void setTask(ScheduledFuture task) { - synchronized(objectMutex) { - this.task = task; - } + public synchronized void setTask(ScheduledFuture task) { + this.task = task; } - public boolean isFaulty() { - synchronized(objectMutex) { - return faulty; - } + public synchronized boolean isFaulty() { + return faulty; } - public void setFaulty(boolean faulty) { - synchronized(objectMutex) { - this.faulty = faulty; - } + public synchronized void setFaulty(boolean faulty) { + this.faulty = faulty; } - public boolean isClosed() { - synchronized(objectMutex) { - return closed; - } + public synchronized boolean isClosed() { + return closed; } - public void close() { - synchronized(objectMutex) { - closed = true; - } + public synchronized void close() { + closed = true; } } @@ -235,8 +195,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Create a brand new instance. * * @param instanceName Buildout name of the instance to build. @@ -316,8 +274,6 @@ public class InstanceService implements INetworkDispatch { /* - * @author Treeku - * * @description Queue them for an instance for 19 seconds, remove if none available. * * @param instanceName Name of the instance .py script. @@ -397,8 +353,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Adds a player to an instance. Can be used directly to avoid queue. * * @param instance Instance object. @@ -406,7 +360,7 @@ public class InstanceService implements INetworkDispatch { * * @return None. */ - public synchronized void add(Instance instance, CreatureObject creature) { + public void add(Instance instance, CreatureObject creature) { try { String terrain = core.scriptService.callScript("scripts/instances/", instance.getName(), "getTerrain").asString(); Planet planet = core.terrainService.getPlanetByPath(terrain); @@ -462,8 +416,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Removes a player from an instance. Can be used directly. * * @param instance Instance object. @@ -499,8 +451,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Closes an instance. * * @param instance Instance object. @@ -538,8 +488,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Checks if an instance area is in use. * * @param instanceName Buildout name of the instance. @@ -562,8 +510,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Gets an instance object from an instanceId. * * @param instanceId Id of an instance you want an object for. @@ -583,8 +529,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Checks if player is in an instance. * * @param creature Player's creature object. @@ -604,8 +548,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Checks if player is in a specific instance. * * @param instanceName Buildout name of the instance. @@ -626,8 +568,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Checks if player is in a specific instance. * * @param instance Instance object. @@ -640,8 +580,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Finds the instance object a player is currently in. * * @param creature Player's creature object. @@ -661,8 +599,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Finds the instance object of an instance a player is/has been in. * * @param instanceName Buildout name of the instance. @@ -683,8 +619,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Checks if player has any instance lockouts. * * @param creature Player's creature object. @@ -704,8 +638,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Finds the instance object of an instance a player is/has been in. * * @param instanceName Buildout name of the instance. @@ -728,8 +660,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Checks if player is locked out of an instance. * * @param instanceName Buildout name of the instance. @@ -750,8 +680,6 @@ public class InstanceService implements INetworkDispatch { } /* - * @author Treeku - * * @description Shows the instance UI. * * @param creature Player's creature object. From 36458239d3dfad68d22d926d0e27629afc29ddf4 Mon Sep 17 00:00:00 2001 From: Treeku Date: Thu, 20 Mar 2014 15:29:04 +0000 Subject: [PATCH 36/36] Added object tracking lists to instances Add objects with instance.getObjectList().add(object) It's removed automatically when the instance closes. --- src/services/InstanceService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/services/InstanceService.java b/src/services/InstanceService.java index d5c032a0..171e77a7 100644 --- a/src/services/InstanceService.java +++ b/src/services/InstanceService.java @@ -66,6 +66,7 @@ public class InstanceService implements INetworkDispatch { private CreatureObject owner; private List participants = new CopyOnWriteArrayList(); private List activeParticipants = new CopyOnWriteArrayList(); + private List objectList = new CopyOnWriteArrayList(); private ScheduledFuture task; private boolean faulty = false; private boolean closed = false; @@ -137,6 +138,10 @@ public class InstanceService implements INetworkDispatch { return participants; } + public List getObjectList() { + return objectList; + } + public synchronized boolean addParticipant(CreatureObject participant) { if (activeParticipants.contains(participant)) { return true; @@ -185,6 +190,12 @@ public class InstanceService implements INetworkDispatch { } public synchronized void close() { + for (SWGObject object : objectList) { + core.objectService.destroyObject(object); + } + + objectList.clear(); + closed = true; }