diff --git a/.classpath b/.classpath index 6d739bfc..6da71800 100644 --- a/.classpath +++ b/.classpath @@ -28,8 +28,8 @@ - - + + diff --git a/README.md b/README.md index 783721b1..c138cb9e 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Then export the following folders to your clientdata folder(should be located in - snapshot - terrain +Export the same folders from sku1_client.toc, sku2_client.toc and sku3_client.toc to avoid errors with kashyyyk. + Now you're ready to run the core! Contributing and Submitting patches diff --git a/lib/mbassador-1.1.7.jar b/lib/mbassador-1.1.7.jar deleted file mode 100644 index c7ae2c11..00000000 Binary files a/lib/mbassador-1.1.7.jar and /dev/null differ diff --git a/lib/mbassador-1.1.9.jar b/lib/mbassador-1.1.9.jar new file mode 100644 index 00000000..ff742d1c Binary files /dev/null and b/lib/mbassador-1.1.9.jar differ diff --git a/ngengine_public.jar b/ngengine_public.jar index 326b2a85..71e72b65 100644 Binary files a/ngengine_public.jar and b/ngengine_public.jar differ diff --git a/odb/creature/je.info.0.1 b/odb/creature/je.info.0.1 new file mode 100644 index 00000000..e69de29b diff --git a/scripts/buffs/armor_break.py b/scripts/buffs/armor_break.py new file mode 100644 index 00000000..288a2db0 --- /dev/null +++ b/scripts/buffs/armor_break.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, actor, buff): + actor.addSkillMod('expertise_innate_reduction_all_player', 6 * buff.getStacks()) + actor.addSkillMod('expertise_innate_reduction_all_mob', 600 * buff.getStacks()) + return + +def removeBuff(core, actor, buff): + actor.deductSkillMod('expertise_innate_reduction_all_mob', 600 * buff.getStacks()) + actor.deductSkillMod('expertise_innate_reduction_all_player', 6 * buff.getStacks()) + return + diff --git a/scripts/buffs/buildabuff_inspiration.py b/scripts/buffs/buildabuff_inspiration.py index 5aa473b7..bfcff248 100644 --- a/scripts/buffs/buildabuff_inspiration.py +++ b/scripts/buffs/buildabuff_inspiration.py @@ -8,6 +8,8 @@ def setup(core, actor, buff): if buffWorkshop is None: return + 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())) diff --git a/scripts/buffs/co_base_of_operations.py b/scripts/buffs/co_base_of_operations.py new file mode 100644 index 00000000..894c389c --- /dev/null +++ b/scripts/buffs/co_base_of_operations.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'expertise_innate_protection_all', 1000) + core.skillModService.addSkillMod(actor, 'expertise_critical_niche_all', 5) + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'expertise_innate_protection_all', 1000) + core.skillModService.deductSkillMod(actor, 'expertise_critical_niche_all', 5) + return + \ No newline at end of file diff --git a/scripts/buffs/co_position_secured.py b/scripts/buffs/co_position_secured.py new file mode 100644 index 00000000..b0b2781c --- /dev/null +++ b/scripts/buffs/co_position_secured.py @@ -0,0 +1,50 @@ +import sys + +def setup(core, actor, buff): + + actor.setSpeedMultiplierMod(0) + + core.skillModService.addSkillMod(actor, 'precision_modified', 200) + core.skillModService.addSkillMod(actor, 'strength_modified', 200) + + if actor.getSkillMod('expertise_action_line_co_imp_pos_sec'): + core.skillModService.addSkillMod(actor, 'expertise_action_all', actor.getSkillMod('expertise_action_line_co_imp_pos_sec').getBase()) + #if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_proc'): + if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus'): + core.skillModService.addSkillMod(actor, 'expertise_devastation_bonus', actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus').getBase() * 10) + if actor.getSkillMod('expertise_co_pos_secured_line_critical'): + core.skillModService.addSkillMod(actor, 'display_only_critical', actor.getSkillMod('expertise_co_pos_secured_line_critical').getBase() * 100) + if actor.getSkillMod('expertise_co_pos_secured_line_protection'): + core.skillModService.addSkillMod(actor, 'display_only_expertise_critical_hit_reduction', actor.getSkillMod('expertise_co_pos_secured_line_protection').getBase() * 100) + + if actor.hasSkill('expertise_co_base_of_operations_1'): + core.buffService.addBuffToCreature(actor, 'co_base_of_operations') + + return + +def removeBuff(core, actor, buff): + + actor.setSpeedMultiplierMod(1) + + core.skillModService.deductSkillMod(actor, 'precision_modified', 200) + core.skillModService.deductSkillMod(actor, 'strength_modified', 200) + + if actor.getSkillMod('expertise_action_line_co_imp_pos_sec'): + core.skillModService.deductSkillMod(actor, 'expertise_action_all', actor.getSkillMod('expertise_action_line_co_imp_pos_sec').getBase()) + #if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_proc'): + if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus'): + core.skillModService.deductSkillMod(actor, 'expertise_devastation_bonus', actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus').getBase() * 10) + if actor.getSkillMod('expertise_co_pos_secured_line_critical'): + core.skillModService.deductSkillMod(actor, 'display_only_critical', actor.getSkillMod('expertise_co_pos_secured_line_critical').getBase() * 100) + if actor.getSkillMod('expertise_co_pos_secured_line_protection'): + core.skillModService.deductSkillMod(actor, 'display_only_expertise_critical_hit_reduction', actor.getSkillMod('expertise_co_pos_secured_line_protection').getBase() * 100) + + if actor.hasSkill('expertise_co_base_of_operations_1'): + if actor.getGroupId() != 0 and core.objectService.getObject(actor.getGroupId()): + group = core.objectService.getObject(actor.getGroupId()) + for member in group.getMemberList(): + core.buffService.removeBuffFromCreature(member, member.getBuffByName('co_base_of_operations')) + else: + core.buffService.removeBuffFromCreature(actor, actor.getBuffByName('co_base_of_operations')) + + return \ No newline at end of file diff --git a/scripts/buffs/co_stand_fast.py b/scripts/buffs/co_stand_fast.py new file mode 100644 index 00000000..17563ff9 --- /dev/null +++ b/scripts/buffs/co_stand_fast.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, actor, buff): + if actor.getSkillMod('expertise_buff_duration_line_co_stand_fast'): + buff.setDuration(buff.getDuration() + actor.getSkillMod('expertise_buff_duration_line_co_stand_fast').getBase()) + + if actor.getSkillMod('expertise_damage_decrease_percentage'): + core.skillModService.addSkillMod(actor, 'damage_decrease_percentage', (60 + actor.getSkillMod('expertise_damage_decrease_percentage').getBase()) / 2) + else: + core.skillModService.addSkillMod(actor, 'damage_decrease_percentage', 60 / 2) + + return + +def removeBuff(core, actor, buff): + if actor.getSkillMod('expertise_damage_decrease_percentage'): + core.skillModService.deductSkillMod(actor, 'damage_decrease_percentage', (60 + actor.getSkillMod('expertise_damage_decrease_percentage').getBase()) / 2) + else: + core.skillModService.deductSkillMod(actor, 'damage_decrease_percentage', 60 / 2) + return \ No newline at end of file diff --git a/scripts/buffs/proc_old_light_jedi_gift.py b/scripts/buffs/proc_old_light_jedi_gift.py new file mode 100644 index 00000000..e09c02e5 --- /dev/null +++ b/scripts/buffs/proc_old_light_jedi_gift.py @@ -0,0 +1,8 @@ +import sys + +def setup(core, actor, buff): + return + +def removeBuff(core, actor, buff): + return + \ No newline at end of file diff --git a/scripts/commands/addignore.py b/scripts/commands/addignore.py new file mode 100644 index 00000000..d8da29a8 --- /dev/null +++ b/scripts/commands/addignore.py @@ -0,0 +1,10 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + actorGhost = actor.getSlottedObject("ghost") + chatSrvc = core.chatService + chatSrvc.addToIgnoreList(actor, commandString) + return \ No newline at end of file diff --git a/scripts/commands/bandflourish.py b/scripts/commands/bandflourish.py new file mode 100644 index 00000000..e30daa8f --- /dev/null +++ b/scripts/commands/bandflourish.py @@ -0,0 +1,57 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + if len(commandString) <= 0: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + if commandString == 'on': + actor.setAcceptBandflourishes(1) + actor.sendSystemMessage('@performance:band_flourish_status_on', 0) + return + if commandString == 'off': + actor.setAcceptBandflourishes(0) + actor.sendSystemMessage('@performance:band_flourish_status_off', 0) + return + + try: + flourish = int(commandString) + except ValueError: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + if flourish < 1 or flourish > 9: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + if actor.getPerformanceId() <= 0: + actor.sendSystemMessage('@performance:flourish_not_performing', 0) + return + + animation = 'skill_action_' + str(flourish) + if flourish == 9: + animation = 'mistake' + + if actor.getAcceptBandflourishes(): + actor.sendSystemMessage('@performance:flourish_perform_band_self', 0) + actor.sendSystemMessage('@performance:flourish_perform', 0) + actor.doSkillAnimation(animation) + + group = core.objectService.getObject(actor.getGroupId()) + if not group: + return + + for creature in group.getMemberList(): + if creature == actor: + continue + if creature.getAcceptBandflourishes(): + creature.sendSystemMessage('@performance:flourish_perform_band_member', 0) + creature.sendSystemMessage('@performance:flourish_perform', 0) + creature.doSkillAnimation(animation) + return + + diff --git a/scripts/commands/boardshuttle.py b/scripts/commands/boardshuttle.py index f84f7e9b..398a4674 100644 --- a/scripts/commands/boardshuttle.py +++ b/scripts/commands/boardshuttle.py @@ -30,7 +30,7 @@ def run(core, actor, target, commandString): if nearestPoint.isShuttleAvailable() is False and nearestPoint.isShuttleDeparting() is True: actor.sendSystemMessage('@travel:shuttle_not_available', 0) return - elif nearestPoint.getSecondsRemaining() == 0: + elif nearestPoint.getSecondsRemaining() <= 0: actor.sendSystemMessage('The next shuttle is about to begin boarding.', 0) return else: diff --git a/scripts/commands/co_position_secured.py b/scripts/commands/co_position_secured.py new file mode 100644 index 00000000..a2165915 --- /dev/null +++ b/scripts/commands/co_position_secured.py @@ -0,0 +1,14 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + if actor.hasBuff('co_position_secured'): + core.buffService.removeBuffFromCreature(actor, actor.getBuffByName('co_position_secured')) + else: + core.buffService.addBuffToCreature(actor, 'co_position_secured') + + return + \ No newline at end of file diff --git a/scripts/commands/combat/co_armor_cracker.py b/scripts/commands/combat/co_armor_cracker.py new file mode 100644 index 00000000..c065b7ca --- /dev/null +++ b/scripts/commands/combat/co_armor_cracker.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_cooldown_line_co_riddle_armor'): + command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_co_riddle_armor').getBase()) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_1_1.py b/scripts/commands/combat/co_del_ae_cc_1_1.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_1_1.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_1_2.py b/scripts/commands/combat/co_del_ae_cc_1_2.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_1_2.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_1_3.py b/scripts/commands/combat/co_del_ae_cc_1_3.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_1_3.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_2_1.py b/scripts/commands/combat/co_del_ae_cc_2_1.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_2_1.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_2_2.py b/scripts/commands/combat/co_del_ae_cc_2_2.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_2_2.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_dm_1.py b/scripts/commands/combat/co_del_ae_dm_1.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_dm_1.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_dm_2.py b/scripts/commands/combat/co_del_ae_dm_2.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_dm_2.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_dm_3.py b/scripts/commands/combat/co_del_ae_dm_3.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_dm_3.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_riddle_armor.py b/scripts/commands/combat/co_riddle_armor.py new file mode 100644 index 00000000..c065b7ca --- /dev/null +++ b/scripts/commands/combat/co_riddle_armor.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_cooldown_line_co_riddle_armor'): + command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_co_riddle_armor').getBase()) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_stand_fast.py b/scripts/commands/combat/co_stand_fast.py new file mode 100644 index 00000000..36b4a557 --- /dev/null +++ b/scripts/commands/combat/co_stand_fast.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_cooldown_line_co_stand_fast'): + command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_co_stand_fast').getBase()) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/findfriend.py b/scripts/commands/findfriend.py new file mode 100644 index 00000000..992efa35 --- /dev/null +++ b/scripts/commands/findfriend.py @@ -0,0 +1,18 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + ghost = actor.getSlottedObject('ghost') + friend = commandString.split(' ')[0] + + if ghost.getFriendList().contains(friend): + friendObj = core.chatService.getObjectByFirstName(friend) + if friendObj is not None: + if friendObj.getSlottedObject('ghost').getFriendList().contains(actor.getCustomName().lower().split(' ')[0]): + fPos = friendObj.getPosition() + core.commandService.callCommand(actor, 'waypoint', None, friendObj.getPlanet().name + ' ' + str(fPos.x) + ' ' + str(fPos.z) + ' ' + str(fPos.y) + ' blue ' + friendObj.getCustomName()) + return + return + return \ No newline at end of file diff --git a/scripts/commands/flourish.py b/scripts/commands/flourish.py new file mode 100644 index 00000000..0bb6cb93 --- /dev/null +++ b/scripts/commands/flourish.py @@ -0,0 +1,31 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + if len(commandString) <= 0: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + try: + flourish = int(commandString) + except ValueError: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + if flourish < 1 or flourish > 9: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + if actor.getPerformanceId() <= 0: + actor.sendSystemMessage('@performance:flourish_not_performing', 0) + return + + actor.sendSystemMessage('@performance:flourish_perform', 0) + animation = 'skill_action_' + str(flourish) + if flourish == 9: + animation = 'mistake' + + actor.doSkillAnimation(animation) diff --git a/scripts/commands/groupdance.py b/scripts/commands/groupdance.py new file mode 100644 index 00000000..ed38ed89 --- /dev/null +++ b/scripts/commands/groupdance.py @@ -0,0 +1,11 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + newState = actor.toggleGroupDance() + msg = '@performance:dance_group_on' if newState else '@performance:dance_group_off' + actor.sendSystemMessage(msg, 0) + return diff --git a/scripts/commands/inspire.py b/scripts/commands/inspire.py index 495c193f..38a789ab 100644 --- a/scripts/commands/inspire.py +++ b/scripts/commands/inspire.py @@ -6,6 +6,10 @@ def setup(): return def run(core, actor, target, commandString): + + if (actor.getProfession() != "entertainer_1a"): + return + print ('Buffing Player: ' + str(target.getObjectId()) + ' or: ' + target.getCustomName()) openBuffWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), target.getObjectId()) objController = ObjControllerMessage(11, openBuffWindow) diff --git a/scripts/commands/of_charge_1.py b/scripts/commands/of_charge_1.py index 8b1194d2..8a1c683d 100644 --- a/scripts/commands/of_charge_1.py +++ b/scripts/commands/of_charge_1.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_charge_1') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_charge_1') return \ No newline at end of file diff --git a/scripts/commands/of_drillmaster_1.py b/scripts/commands/of_drillmaster_1.py index 313f855b..0b448c2b 100644 --- a/scripts/commands/of_drillmaster_1.py +++ b/scripts/commands/of_drillmaster_1.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_drillmaster_1') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_drillmaster_1') return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_1.py b/scripts/commands/of_focus_fire_1.py index 4857b1ce..d3a2cfb8 100644 --- a/scripts/commands/of_focus_fire_1.py +++ b/scripts/commands/of_focus_fire_1.py @@ -6,7 +6,9 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_focus_fire_1') group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_focus_fire_1') + if group is not None: + for creature in group.getMemberList(): + core.buffService.addBuffToCreature(creature, 'of_focus_fire_1') + return return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_2.py b/scripts/commands/of_focus_fire_2.py index 2eb8248d..cafae5bd 100644 --- a/scripts/commands/of_focus_fire_2.py +++ b/scripts/commands/of_focus_fire_2.py @@ -4,8 +4,11 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'of_focus_fire_1') + core.buffService.addBuffToCreature(actor, 'of_focus_fire_2') group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_focus_fire_2') - return \ No newline at end of file + if group is not None: + for creature in group.getMemberList(): + core.buffService.addBuffToCreature(creature, 'of_focus_fire_2') + return + return + \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_3.py b/scripts/commands/of_focus_fire_3.py index bac08eb4..75129446 100644 --- a/scripts/commands/of_focus_fire_3.py +++ b/scripts/commands/of_focus_fire_3.py @@ -4,8 +4,11 @@ def setup(core, actor, buff): return def run(core, actor, target, commandString): - core.buffService.addBuffToCreature(actor, 'of_focus_fire_1') + core.buffService.addBuffToCreature(actor, 'of_focus_fire_3') group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_focus_fire_3') - return \ No newline at end of file + if group is not None: + for creature in group.getMemberList(): + core.buffService.addBuffToCreature(creature, 'of_focus_fire_3') + return + return + \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_4.py b/scripts/commands/of_focus_fire_4.py index 4091e213..a5fa51f9 100644 --- a/scripts/commands/of_focus_fire_4.py +++ b/scripts/commands/of_focus_fire_4.py @@ -5,7 +5,4 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_focus_fire_1') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_focus_fire_4') return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_5.py b/scripts/commands/of_focus_fire_5.py index 704dc3c4..a5fa51f9 100644 --- a/scripts/commands/of_focus_fire_5.py +++ b/scripts/commands/of_focus_fire_5.py @@ -5,7 +5,4 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_focus_fire_1') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_focus_fire_5') return \ No newline at end of file diff --git a/scripts/commands/of_focus_fire_6.py b/scripts/commands/of_focus_fire_6.py index 5027e12c..a5fa51f9 100644 --- a/scripts/commands/of_focus_fire_6.py +++ b/scripts/commands/of_focus_fire_6.py @@ -5,7 +5,4 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_focus_fire_1') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_focus_fire_6') return \ No newline at end of file diff --git a/scripts/commands/of_inspiration_1.py b/scripts/commands/of_inspiration_1.py index 95c691d9..001b0e69 100644 --- a/scripts/commands/of_inspiration_1.py +++ b/scripts/commands/of_inspiration_1.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_inspiration_1') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_inspiration_1') return \ No newline at end of file diff --git a/scripts/commands/of_inspiration_2.py b/scripts/commands/of_inspiration_2.py index f667ecd4..01dbef43 100644 --- a/scripts/commands/of_inspiration_2.py +++ b/scripts/commands/of_inspiration_2.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_inspiration_2') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_inspiration_2') return \ No newline at end of file diff --git a/scripts/commands/of_inspiration_3.py b/scripts/commands/of_inspiration_3.py index ce4e0b49..a1d2296f 100644 --- a/scripts/commands/of_inspiration_3.py +++ b/scripts/commands/of_inspiration_3.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_inspiration_3') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_inspiration_3') return \ No newline at end of file diff --git a/scripts/commands/of_inspiration_4.py b/scripts/commands/of_inspiration_4.py index 198e36b5..d1954310 100644 --- a/scripts/commands/of_inspiration_4.py +++ b/scripts/commands/of_inspiration_4.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_inspiration_4') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_inspiration_4') return \ No newline at end of file diff --git a/scripts/commands/of_inspiration_5.py b/scripts/commands/of_inspiration_5.py index e114bec1..e2d35933 100644 --- a/scripts/commands/of_inspiration_5.py +++ b/scripts/commands/of_inspiration_5.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_inspiration_5') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_inspiration_5') return \ No newline at end of file diff --git a/scripts/commands/of_inspiration_6.py b/scripts/commands/of_inspiration_6.py index 230aaa5f..c73a2000 100644 --- a/scripts/commands/of_inspiration_6.py +++ b/scripts/commands/of_inspiration_6.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_inspiration_6') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_inspiration_6') return \ No newline at end of file diff --git a/scripts/commands/of_medical_sup_1.py b/scripts/commands/of_medical_sup_1.py new file mode 100644 index 00000000..b7186ab6 --- /dev/null +++ b/scripts/commands/of_medical_sup_1.py @@ -0,0 +1,52 @@ +from engine.resources.container import StaticContainerPermissions +import time +import sys + +def setup(core, actor, target, command): + return + +def run(core, actor, target, commandString): + doStimDrop(core, actor) + return + +def doStimDrop(core, actor): + actor.sendSystemMessage('Stims incoming Mr. Bossman!', 0) + stcSvc = core.staticService + shuttle = stcSvc.spawnObject('object/creature/npc/theme_park/shared_lambda_shuttle.iff', actor.getPlanet().getName(), long(0), actor.getPosition().x, actor.getPosition().y, actor.getPosition().z, actor.getOrientation().y, actor.getOrientation().w) + shuttle.setPosture(0) + time.sleep(10) # Wait time before shuttle arrives after command is called + shuttle.setPosture(2) + time.sleep(20) # wait time for the crate to show (length of landing animation for shuttle) + spawnCrate(core, actor, shuttle) + time.sleep(5) # Wait time for the shuttle to leave after crate is spawned + shuttle.setPosture(0) + time.sleep(20) # How long the take-off sequence is, until the Shuttle is destroyed + core.objectService.destroyObject(shuttle) + return + +def spawnCrate(core, actor, shuttle): + crate = core.staticService.spawnObject('object/tangible/container/drum/shared_supply_drop_crate.iff', shuttle.getPlanet().getName(), long(0), shuttle.getPosition().x, shuttle.getPosition().y, shuttle.getPosition().z, shuttle.getOrientation().y, shuttle.getOrientation().w) + crate.setCustomName('Supply Crate') + + group = core.objectService.getObject(actor.getGroupId()) + + permissions = StaticContainerPermissions() + permissions.canRemove(group, crate) + permissions.canView(group, crate) + crate.setContainerPermissions(permissions) + + if actor.hasSkill('expertise_of_tactical_sup_1'): + for i in range(0, 8): + tactical = core.objectService.createObject('object/tangible/loot/generic_usable/shared_stim_syringe_generic.iff', actor.getPlanet()) #FIXME: Use the correct template + tactical.setCustomName('Tactical Serum A') + crate.add(tactical) + + for i in range(0, 8): + stimpack = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_e.iff', actor.getPlanet()) #FIXME: Use the correct template + stimpack.setCustomName('Field Stimpack A') + crate.add(stimpack) + + time.sleep(60) + core.objectService.destroyObject(crate) + + return \ No newline at end of file diff --git a/scripts/commands/of_scatter_1.py b/scripts/commands/of_scatter_1.py index c1ae742a..8ee17071 100644 --- a/scripts/commands/of_scatter_1.py +++ b/scripts/commands/of_scatter_1.py @@ -5,8 +5,5 @@ def setup(core, actor, buff): def run(core, actor, target, commandString): core.buffService.addBuffToCreature(actor, 'of_scatter_1') - group = core.objectService.getObject(actor.getGroupId()) - for creature in group.getMemberList(): - core.buffService.addBuffToCreature(creature, 'of_scatter_1') return \ No newline at end of file diff --git a/scripts/commands/pvp.py b/scripts/commands/pvp.py index 93e9051b..0155c528 100644 --- a/scripts/commands/pvp.py +++ b/scripts/commands/pvp.py @@ -1,74 +1,72 @@ from resources.objects.creature import CreatureObject -from protocol.swg import UpdatePVPStatusMessage +from resources.common import PvpStatus +from resources.common import FactionStatus import sys +import time def setup(): return def run(core, actor, target, commandString): - actorFaction = actor.getFaction() - actorStatus = actor.getFactionStatus() - pvpStatus = UpdatePVPStatusMessage(actor.getObjectId()) - - if commandString == ('imperial') and actorFaction != "imperial": - actor.setFaction('imperial') - return - - if commandString == ('rebel') and actorFaction != "rebel": - actor.setFaction('rebel') - return - - if commandString == ('neutral') and actorFaction != "neutral": - actor.setFaction('neutral') - return - - if actorStatus == 0 and actorFaction == "imperial": - actor.setFactionStatus(1) - #print ("FactionStatus: " + str(actor.getFactionStatus())) - actor.sendSystemMessage('You are no longer On Leave.', 0) - return + faction = actor.getFaction() + factionStatus = actor.getFactionStatus() - if actorStatus == 0 and actorFaction == "rebel": - actor.setFactionStatus(1) - #print ("FactionStatus: " + str(actor.getFactionStatus())) - actor.sendSystemMessage('You are no longer On Leave.', 0) - return + if actor.getPvpStatus(PvpStatus.GoingOvert) or actor.getPvpStatus(PvpStatus.GoingCovert): + actor.sendSystemMessage('@faction_recruiter:pvp_status_changing', 0) + return - if actorStatus == 1 and actorFaction == "imperial": - actor.setFactionStatus(2) - pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial) - pvpStatus.setStatus(55) - actor.notifyObservers(pvpStatus.serialize(), True) - actor.sendSystemMessage('@faction_recruiter:overt_complete', 0) - print ("FactionStatus: " + str(actor.getFactionStatus())) - return - - if actorStatus == 1 and actorFaction == "rebel": - actor.setFactionStatus(2) - pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel) - pvpStatus.setStatus(55) - actor.notifyObservers(pvpStatus.serialize(), True) - actor.sendSystemMessage('@faction_recruiter:overt_complete', 0) - print ("FactionStatus: " + str(actor.getFactionStatus())) - return - - if actorStatus == 2 and actorFaction == "imperial": - actor.setFactionStatus(1) - pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial) - pvpStatus.setStatus(16) - actor.notifyObservers(pvpStatus.serialize(), True) - actor.sendSystemMessage('@faction_recruiter:covert_complete', 0) - print ("FactionStatus: " + str(actor.getFactionStatus())) - return - - if actorStatus == 2 and actorFaction == "rebel": - actor.setFactionStatus(1) - pvpStatus.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel) - pvpStatus.setStatus(16) - actor.notifyObservers(pvpStatus.serialize(), True) - actor.sendSystemMessage('@faction_recruiter:covert_complete', 0) - print ("FactionStatus: " + str(actor.getFactionStatus())) - return - - - return \ No newline at end of file + if commandString != '' and commandString != faction: + if commandString == 'rebel' or commandString == 'imperial' or commandString == 'neutral': + actor.sendSystemMessage('@faction_recruiter:sui_resig_complete_in_5', 0) + + if actor.getFactionStatus() == FactionStatus.SpecialForces: + actor.setPvpStatus(PvpStatus.GoingCovert, True) + time.sleep(300) + + actor.setPvpStatus(PvpStatus.GoingCovert | PvpStatus.Overt | PvpStatus.Attackable | PvpStatus.Aggressive | PvpStatus.Enemy, False) + actor.setFactionStatus(FactionStatus.OnLeave) + + if actor.getFaction() != '' and actor.getFaction() != 'neutral': + time.sleep(1) + actor.setFaction('') + actor.sendSystemMessage('@faction_recruiter:resign_complete', 0) + + + time.sleep(1) + actor.setFaction(commandString) + return + + if faction == 'neutral' or faction == '': + actor.sendSystemMessage('@faction_recruiter:not_aligned', 0) + return + + if factionStatus == FactionStatus.OnLeave: + actor.sendSystemMessage('@faction_recruiter:on_leave_to_covert', 0) + actor.setPvpStatus(PvpStatus.GoingCovert, True) + time.sleep(1) + actor.setFactionStatus(FactionStatus.Combatant) + actor.setPvpStatus(PvpStatus.GoingCovert, False) + actor.setPvpStatus(PvpStatus.Enemy, True) + actor.sendSystemMessage('@faction_recruiter:covert_complete', 0) + return + + if factionStatus == FactionStatus.Combatant: + actor.sendSystemMessage('@faction_recruiter:covert_to_overt', 0) + actor.setPvpStatus(PvpStatus.GoingOvert, True) + time.sleep(30) + actor.setFactionStatus(FactionStatus.SpecialForces) + actor.setPvpStatus(PvpStatus.GoingOvert, False) + actor.setPvpStatus(PvpStatus.Overt | PvpStatus.Attackable | PvpStatus.Aggressive, True) + actor.sendSystemMessage('@faction_recruiter:overt_complete', 0) + return + + if factionStatus == FactionStatus.SpecialForces: + actor.sendSystemMessage('@faction_recruiter:overt_to_covert', 0) + actor.setPvpStatus(PvpStatus.GoingCovert, True) + time.sleep(300) + actor.setFactionStatus(FactionStatus.Combatant) + actor.setPvpStatus(PvpStatus.GoingCovert | PvpStatus.Overt | PvpStatus.Attackable | PvpStatus.Aggressive, False) + actor.sendSystemMessage('@faction_recruiter:covert_complete', 0) + return + + return diff --git a/scripts/commands/removeignore.py b/scripts/commands/removeignore.py new file mode 100644 index 00000000..4561dd79 --- /dev/null +++ b/scripts/commands/removeignore.py @@ -0,0 +1,10 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + actorGhost = actor.getSlottedObject("ghost") + chatSrvc = core.chatService + chatSrvc.removeFromIgnoreList(actor, commandString) + return \ No newline at end of file diff --git a/scripts/commands/requestwaypointatposition.py b/scripts/commands/requestwaypointatposition.py new file mode 100644 index 00000000..60b932ce --- /dev/null +++ b/scripts/commands/requestwaypointatposition.py @@ -0,0 +1,14 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + commandArgs = commandString.split("(^-,=+_)color_13548(,+-=_^)=1") + + newString = commandArgs[0] + print (newString) + cmdService = core.commandService + cmdService.callCommand(actor, 'waypoint', None, newString) # No need to re-create a script + return \ No newline at end of file diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py new file mode 100644 index 00000000..d8b9647d --- /dev/null +++ b/scripts/commands/setgodmode.py @@ -0,0 +1,39 @@ +import sys +from engine.resources.scene import Point3D + +def setup(): + return + +def run(core, actor, target, commandString): + + playerObject = actor.getSlottedObject('ghost') + + if not playerObject: + return + + commandArgs = commandString.split(' ') + command = commandArgs[0] + arg1 = commandArgs[1] + if commandArgs[2]: + arg2 = commandArgs[2] + if commandArgs[3]: + arg3 = commandArgs[3] + if commandArgs[4]: + arg4 = commandArgs[4] + + if not command: + return + + if command == 'giveExperience' and arg1: + core.playerService.giveExperience(actor, int(arg1)) + + if command == 'setSpeed' and arg1: + actor.sendSystemMessage('Your speed was ' + str(actor.getSpeedMultiplierBase()) + '. Don\'t forget to set this back or it\'ll permanently imbalance your speed. Default without buffs or mods is 1.', 2) + actor.setSpeedMultiplierBase(float(arg1)) + actor.sendSystemMessage('Your new speed is ' + str(actor.getSpeedMultiplierBase()) + '.', 2) + + if command == 'teleport' and arg2 and arg3 and arg4: + position = Point3D(float(arg2), float(arg3), float(arg4)) + core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(arg1), position, actor.getOrientation(), None) + + return diff --git a/scripts/commands/startdance.py b/scripts/commands/startdance.py new file mode 100644 index 00000000..18aa211c --- /dev/null +++ b/scripts/commands/startdance.py @@ -0,0 +1,96 @@ +from services.sui import SUIWindow +from services.sui import SUIService +from services.sui.SUIWindow import Trigger +from services.sui.SUIService import ListBoxType +from java.util import Vector +from java.util import HashMap +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + entSvc = core.entertainmentService + global actorObject + global coreObject + global availableDances + global suiWindow + actorObject = actor + coreObject = core + + if len(commandString) > 0: + params = commandString.split(" ") + startDance(core, actor, params[0], 0) + return + 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) + + returnList = Vector() + returnList.add("List.lstList:SelectedRow") + suiWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleStartdance) + + suiSvc.openSUIWindow(suiWindow) + return + return + + +def handleStartdance(core, owner, eventType, returnList): + + item = suiWindow.getMenuItems().get(int(returnList.get(0))) + + if not item: + return + + #if eventType == 0: + startDance(coreObject, actorObject, '', int(item.getObjectId())) + return + +def startDance(core, actor, danceName, visual): + + entSvc = core.entertainmentService + + if visual <= 0: + visual = entSvc.getDanceVisualId(danceName) + + if visual <= 0: + return + + if not entSvc.isDance(visual): + actor.sendSystemMessage('@performance:dance_unknown_self',0) + return + + if not entSvc.canDance(actor, visual): + actor.sendSystemMessage('@performance:dance_lack_skill_self',0) + return + + if actor.getPerformanceId() > 0: + actor.sendSystemMessage('@performance:already_performing_self',0) + return + + #TODO: check costume, posture, etc? + + actor.sendSystemMessage('@performance:dance_start_self',0); + actor.notifyAudience('@performance:dance_start_other'); + + danceVisual = 'dance_' + str(visual) + + if not actor.getPerformanceWatchee(): + #this also notifies the client with a delta4 + actor.setPerformanceWatchee(actor) + + #this should send a CREO3 + actor.setPosture(0x09); + + dance = entSvc.getDance(visual) + + # send CREO6 here + # second param is some sort of counter or start tick + actor.startPerformance(dance.getLineNumber(), -842249156 , danceVisual, 1) + + return diff --git a/scripts/commands/stopdance.py b/scripts/commands/stopdance.py new file mode 100644 index 00000000..0f2d4763 --- /dev/null +++ b/scripts/commands/stopdance.py @@ -0,0 +1,19 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + entSvc = core.entertainmentService + + if (actor.getPerformanceId() <= 0): + actor.sendSystemMessage('@performance:dance_not_performing', 0) + return + + #since we need to stop performance for any posture change, + # all packets are triggered in setPosture. + # this may not be very consistent, but it prevents + # duplicate code. + actor.setPosture(0x00) + + return diff --git a/scripts/commands/tip.py b/scripts/commands/tip.py index b0b4331c..b34992f2 100644 --- a/scripts/commands/tip.py +++ b/scripts/commands/tip.py @@ -1,6 +1,4 @@ -from resources.objects.creature import CreatureObject from java.util import Date -from engine.resources.objects import SWGObject from services.chat import ChatService from services.chat import Mail from services.sui import SUIWindow @@ -8,6 +6,7 @@ from services.sui import SUIService from services.sui.SUIWindow import Trigger from services.sui.SUIService import MessageBoxType from java.util import Vector +from main import NGECore import sys # initialize global vars (happens at compile time) @@ -81,7 +80,8 @@ def run(core, actor, target, commandString): return return -def handleBankTip(core, owner, eventType, returnList): +def handleBankTip(owner, window, eventType, returnList): + core = NGECore.getInstance() chatSvc = core.chatService actorGlobal = core.objectService.getObject(actorID) targetGlobal = core.objectService.getObject(targetID) @@ -115,7 +115,7 @@ def handleBankTip(core, owner, eventType, returnList): actorMail.setSubject('@base_player:wire_mail_subject') actorMail.setSenderName('bank') - targetGlobal.setBankCredits(int(tipAmount)) + targetGlobal.setBankCredits(int(tipAmount) + int(targetGlobal.getBankCredits())) actorGlobal.setBankCredits(int(actorFunds) - int(totalLost)) actorGlobal.sendSystemMessage('You have successfully sent ' + tipAmount + ' bank credits to ' + targetGlobal.getCustomName(), 0) targetGlobal.sendSystemMessage('You have successfully received ' + tipAmount + ' bank credits from ' + actorGlobal.getCustomName(), 0) diff --git a/scripts/commands/waypoint.py b/scripts/commands/waypoint.py index ab3b56a1..5e2802c4 100644 --- a/scripts/commands/waypoint.py +++ b/scripts/commands/waypoint.py @@ -67,6 +67,24 @@ def run(core, actor, target, commandString): actorPlayer.waypointAdd(waypoint) actor.sendSystemMessage('A waypoint has been created in your datapad at your location.', 0) return + + #/wp planet x z y name + elif len(commandArgs) >= 3 and isFloat(commandArgs[2]) and isFloat(commandArgs[3]) and isFloat(commandArgs[4]): + waypoint = core.objectService.createObject('object/waypoint/shared_waypoint.iff', core.terrainService.getPlanetByName(commandArgs[1]), float(commandArgs[2]), float(commandArgs[4]), float(commandArgs[3])) + waypoint.setActive(True) + waypoint.setColor(WaypointObject.BLUE) + name = commandString.split(" ", 5) + print (name) + if name == "": + name = "Waypoint" + + waypoint.setName(name[5]) + waypoint.setPlanetCRC(crc.StringtoCRC(actor.getPlanet().getName())) + actorPlayer.getWaypoints().add(waypoint) + actorPlayer.waypointAdd(waypoint) + actor.sendSystemMessage('A waypoint has been created in your datapad at your location.', 0) + return + #/wp NAME else: waypoint = core.objectService.createObject('object/waypoint/shared_waypoint.iff', actor.getPlanet(), actor.getWorldPosition().x, actor.getWorldPosition().z, actor.getWorldPosition().y) diff --git a/scripts/expertise/expertise_of_tactical_sup_1.py b/scripts/expertise/expertise_of_tactical_sup_1.py index ce701bb6..451c6fbe 100644 --- a/scripts/expertise/expertise_of_tactical_sup_1.py +++ b/scripts/expertise/expertise_of_tactical_sup_1.py @@ -36,11 +36,9 @@ def removeExpertisePoint(core, actor): # this checks what abilities the player gets by level, need to also call this on level-up def addAbilities(core, actor, player): - - + return def removeAbilities(core, actor, player): - - + return diff --git a/scripts/faction/aakuans.py b/scripts/faction/aakuans.py new file mode 100644 index 00000000..a8fc0c39 --- /dev/null +++ b/scripts/faction/aakuans.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'fed_dub' or enemy == 'binayre' or enemy == 'liberation_party': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/afarathu.py b/scripts/faction/afarathu.py new file mode 100644 index 00000000..80a24805 --- /dev/null +++ b/scripts/faction/afarathu.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'corsec': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/alkhara.py b/scripts/faction/alkhara.py new file mode 100644 index 00000000..3553adcd --- /dev/null +++ b/scripts/faction/alkhara.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'tusken_raider': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/bandit.py b/scripts/faction/bandit.py new file mode 100644 index 00000000..bd97f757 --- /dev/null +++ b/scripts/faction/bandit.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'townsperson': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/beldonnas_league.py b/scripts/faction/beldonnas_league.py new file mode 100644 index 00000000..c15dab6d --- /dev/null +++ b/scripts/faction/beldonnas_league.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'corsec': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'followers_of_lord_nyax' or enemy == 'lost_aqualish': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/binayre.py b/scripts/faction/binayre.py new file mode 100644 index 00000000..5eb7703b --- /dev/null +++ b/scripts/faction/binayre.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'fed_dub' or enemy == 'aakuans' or enemy == 'corsec': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/bloodrazor.py b/scripts/faction/bloodrazor.py new file mode 100644 index 00000000..78220da0 --- /dev/null +++ b/scripts/faction/bloodrazor.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'canyon_corsair' or enemy == 'nym': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/borvo.py b/scripts/faction/borvo.py new file mode 100644 index 00000000..1dfa01f8 --- /dev/null +++ b/scripts/faction/borvo.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'gungan' or enemy == 'trade_federation' or enemy == 'jabba': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/canyon_corsair.py b/scripts/faction/canyon_corsair.py new file mode 100644 index 00000000..f978debe --- /dev/null +++ b/scripts/faction/canyon_corsair.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'bloodrazor' or enemy == 'nym': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/cobral.py b/scripts/faction/cobral.py new file mode 100644 index 00000000..139fe6a1 --- /dev/null +++ b/scripts/faction/cobral.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'restuss': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/cor_swoop.py b/scripts/faction/cor_swoop.py new file mode 100644 index 00000000..7d2ffab5 --- /dev/null +++ b/scripts/faction/cor_swoop.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'smashball': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/corsec.py b/scripts/faction/corsec.py new file mode 100644 index 00000000..30ca26bf --- /dev/null +++ b/scripts/faction/corsec.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'afarathu' or enemy == 'followers_of_lord_nyax' or enemy == 'beldonnas_league' or enemy == 'monumenter' or enemy == 'rogue_corsec' or enemy == 'lost_aqualish': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/dantari_raiders.py b/scripts/faction/dantari_raiders.py new file mode 100644 index 00000000..f1dd456b --- /dev/null +++ b/scripts/faction/dantari_raiders.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'kunga_tribe' or enemy == 'mokk_tribe' or enemy == 'janta_tribe': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/desert_demon.py b/scripts/faction/desert_demon.py new file mode 100644 index 00000000..9dd1a4d4 --- /dev/null +++ b/scripts/faction/desert_demon.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'swoop': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/donkuwah_tribe.py b/scripts/faction/donkuwah_tribe.py new file mode 100644 index 00000000..6db0ca51 --- /dev/null +++ b/scripts/faction/donkuwah_tribe.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'gondula_tribe' or enemy == 'panshee_tribe': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/drall.py b/scripts/faction/drall.py new file mode 100644 index 00000000..5059caaf --- /dev/null +++ b/scripts/faction/drall.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'corsec' or enemy == 'fed_dub': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/endor_marauder.py b/scripts/faction/endor_marauder.py new file mode 100644 index 00000000..6db0ca51 --- /dev/null +++ b/scripts/faction/endor_marauder.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'gondula_tribe' or enemy == 'panshee_tribe': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/fed_dub.py b/scripts/faction/fed_dub.py new file mode 100644 index 00000000..20a018fb --- /dev/null +++ b/scripts/faction/fed_dub.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'liberation_party' or enemy == 'binayre' or enemy == 'lost_aqualish' or enemy == 'drall': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/flail.py b/scripts/faction/flail.py new file mode 100644 index 00000000..37a3ff1d --- /dev/null +++ b/scripts/faction/flail.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'hidden_daggers': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/followers_of_lord_nyax.py b/scripts/faction/followers_of_lord_nyax.py new file mode 100644 index 00000000..35c07b91 --- /dev/null +++ b/scripts/faction/followers_of_lord_nyax.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'corsec' or enemy == 'beldonnas_league': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/forest_kerritamba.py b/scripts/faction/forest_kerritamba.py new file mode 100644 index 00000000..1213cf20 --- /dev/null +++ b/scripts/faction/forest_kerritamba.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'forest_outcast': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/forest_outcast.py b/scripts/faction/forest_outcast.py new file mode 100644 index 00000000..05faa8d3 --- /dev/null +++ b/scripts/faction/forest_outcast.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'forest_kerritamba': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/fs_villager.py b/scripts/faction/fs_villager.py new file mode 100644 index 00000000..0fd5d988 --- /dev/null +++ b/scripts/faction/fs_villager.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'sith_shadow': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/garyn.py b/scripts/faction/garyn.py new file mode 100644 index 00000000..139fe6a1 --- /dev/null +++ b/scripts/faction/garyn.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'restuss': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/gondula_tribe.py b/scripts/faction/gondula_tribe.py new file mode 100644 index 00000000..c0078e6a --- /dev/null +++ b/scripts/faction/gondula_tribe.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'donkuwah_tribe' or enemy == 'korga_tribe' or enemy == 'panshee_tribe' or enemy == 'pubam' or enemy == 'endor_marauder': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/gungan.py b/scripts/faction/gungan.py new file mode 100644 index 00000000..1f9355e5 --- /dev/null +++ b/scripts/faction/gungan.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'plasma_thief' or enemy == 'swamp_rat' or enemy == 'borvo': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/hidden_daggers.py b/scripts/faction/hidden_daggers.py new file mode 100644 index 00000000..34c20129 --- /dev/null +++ b/scripts/faction/hidden_daggers.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'rogue_corsec': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'corsec' or enemy == 'beldonnas_league' or enemy == 'flail': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/hutt.py b/scripts/faction/hutt.py new file mode 100644 index 00000000..0d468932 --- /dev/null +++ b/scripts/faction/hutt.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'panshee_tribe': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'naboo_security_force' or enemy == 'nym' or enemy == 'imperial' or enemy == 'jabba' or enemy == 'borvo' or enemy == 'corsec' or enemy == 'narmle': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/imperial.py b/scripts/faction/imperial.py new file mode 100644 index 00000000..b5bc8cc0 --- /dev/null +++ b/scripts/faction/imperial.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'rebel': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/jabba.py b/scripts/faction/jabba.py new file mode 100644 index 00000000..5840595b --- /dev/null +++ b/scripts/faction/jabba.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'hutt': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'valarian' or enemy == 'borvo': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/janta_tribe.py b/scripts/faction/janta_tribe.py new file mode 100644 index 00000000..b446a0a0 --- /dev/null +++ b/scripts/faction/janta_tribe.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'kunga_tribe' or enemy == 'dantari_raiders': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/jawa.py b/scripts/faction/jawa.py new file mode 100644 index 00000000..3553adcd --- /dev/null +++ b/scripts/faction/jawa.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'tusken_raider': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/kobola.py b/scripts/faction/kobola.py new file mode 100644 index 00000000..8befaec5 --- /dev/null +++ b/scripts/faction/kobola.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'narmle' or enemy == 'spice_collective': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/korga_tribe.py b/scripts/faction/korga_tribe.py new file mode 100644 index 00000000..6db0ca51 --- /dev/null +++ b/scripts/faction/korga_tribe.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'gondula_tribe' or enemy == 'panshee_tribe': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/kunga_tribe.py b/scripts/faction/kunga_tribe.py new file mode 100644 index 00000000..52e241cb --- /dev/null +++ b/scripts/faction/kunga_tribe.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'mokk_tribe' or enemy == 'dantari_raiders': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/liberation_party.py b/scripts/faction/liberation_party.py new file mode 100644 index 00000000..2fff2b6f --- /dev/null +++ b/scripts/faction/liberation_party.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'fed_dub' or enemy == 'corsec': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/lok_mercenaries.py b/scripts/faction/lok_mercenaries.py new file mode 100644 index 00000000..ebf10bf9 --- /dev/null +++ b/scripts/faction/lok_mercenaries.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'bloodrazor' or enemy == 'canyon_corsair': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/lost_aqualish.py b/scripts/faction/lost_aqualish.py new file mode 100644 index 00000000..9aef6e55 --- /dev/null +++ b/scripts/faction/lost_aqualish.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'beldonnas_league' or enemy == 'fed_dub' or enemy == 'corsec': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/meatlump.py b/scripts/faction/meatlump.py new file mode 100644 index 00000000..3e432825 --- /dev/null +++ b/scripts/faction/meatlump.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'corsec' or enemy == 'rogue_corsec' or enemy == 'beldonnas_league': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/mokk_tribe.py b/scripts/faction/mokk_tribe.py new file mode 100644 index 00000000..93e05b64 --- /dev/null +++ b/scripts/faction/mokk_tribe.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'janta_tribe' or enemy == 'dantari_raiders': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/monumenter.py b/scripts/faction/monumenter.py new file mode 100644 index 00000000..35c07b91 --- /dev/null +++ b/scripts/faction/monumenter.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'corsec' or enemy == 'beldonnas_league': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/mtn_clan.py b/scripts/faction/mtn_clan.py new file mode 100644 index 00000000..e2b7c145 --- /dev/null +++ b/scripts/faction/mtn_clan.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'nightsister': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/naboo.py b/scripts/faction/naboo.py new file mode 100644 index 00000000..22519151 --- /dev/null +++ b/scripts/faction/naboo.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'borvo': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/naboo_pirate.py b/scripts/faction/naboo_pirate.py new file mode 100644 index 00000000..d409c4ff --- /dev/null +++ b/scripts/faction/naboo_pirate.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'naboo_security_force': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/naboo_security_force.py b/scripts/faction/naboo_security_force.py new file mode 100644 index 00000000..ec32a708 --- /dev/null +++ b/scripts/faction/naboo_security_force.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'borvo' or enemy == 'naboo_pirate' or enemy == 'plasma_thief' or enemy == 'swamp_rat' or enemy == 'trade_federation': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/narmle.py b/scripts/faction/narmle.py new file mode 100644 index 00000000..3188e87c --- /dev/null +++ b/scripts/faction/narmle.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'restuss': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'narmle' or enemy == 'spice_collective' or enemy == 'kobola': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/nightsister.py b/scripts/faction/nightsister.py new file mode 100644 index 00000000..cf1f8c4e --- /dev/null +++ b/scripts/faction/nightsister.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'mtn_clan' or enemy == 'imperial': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/nym.py b/scripts/faction/nym.py new file mode 100644 index 00000000..ebf10bf9 --- /dev/null +++ b/scripts/faction/nym.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'bloodrazor' or enemy == 'canyon_corsair': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/olag_greck.py b/scripts/faction/olag_greck.py new file mode 100644 index 00000000..35c07b91 --- /dev/null +++ b/scripts/faction/olag_greck.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'corsec' or enemy == 'beldonnas_league': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/panshee_tribe.py b/scripts/faction/panshee_tribe.py new file mode 100644 index 00000000..6ea96a0d --- /dev/null +++ b/scripts/faction/panshee_tribe.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'donkuwah_tribe' or enemy == 'korga_tribe' or enemy == 'gondula_tribe' or enemy == 'pubam' or enemy == 'endor_marauder': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/pirate.py b/scripts/faction/pirate.py new file mode 100644 index 00000000..a8fc0c39 --- /dev/null +++ b/scripts/faction/pirate.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'fed_dub' or enemy == 'binayre' or enemy == 'liberation_party': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/plasma_thief.py b/scripts/faction/plasma_thief.py new file mode 100644 index 00000000..89a851e9 --- /dev/null +++ b/scripts/faction/plasma_thief.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'gungan': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/pubam.py b/scripts/faction/pubam.py new file mode 100644 index 00000000..6db0ca51 --- /dev/null +++ b/scripts/faction/pubam.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'gondula_tribe' or enemy == 'panshee_tribe': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/rebel.py b/scripts/faction/rebel.py new file mode 100644 index 00000000..0d685a6a --- /dev/null +++ b/scripts/faction/rebel.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'imperial': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/restuss.py b/scripts/faction/restuss.py new file mode 100644 index 00000000..9ce8318a --- /dev/null +++ b/scripts/faction/restuss.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'narmle': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'garyn' or enemy == 'cobral': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/rogue_corsec.py b/scripts/faction/rogue_corsec.py new file mode 100644 index 00000000..38fd4f3a --- /dev/null +++ b/scripts/faction/rogue_corsec.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'hidden_daggers': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'corsec': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/rorgungan.py b/scripts/faction/rorgungan.py new file mode 100644 index 00000000..f39573c6 --- /dev/null +++ b/scripts/faction/rorgungan.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'spice_collective': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/sif.py b/scripts/faction/sif.py new file mode 100644 index 00000000..04d90a0e --- /dev/null +++ b/scripts/faction/sif.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'hutt': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'rebel' or enemy == 'imperial': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/sith_shadow.py b/scripts/faction/sith_shadow.py new file mode 100644 index 00000000..e89c90da --- /dev/null +++ b/scripts/faction/sith_shadow.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'rebel' or ally == 'imperial': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'fs_villager': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/smashball.py b/scripts/faction/smashball.py new file mode 100644 index 00000000..89e21659 --- /dev/null +++ b/scripts/faction/smashball.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'corsec' or enemy == 'cor_swoop': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/spice_collective.py b/scripts/faction/spice_collective.py new file mode 100644 index 00000000..a95f585e --- /dev/null +++ b/scripts/faction/spice_collective.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'narmle' or enemy == 'rorgungan' or enemy == 'kobola': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/spider_nightsister.py b/scripts/faction/spider_nightsister.py new file mode 100644 index 00000000..90a4f892 --- /dev/null +++ b/scripts/faction/spider_nightsister.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'mtn_clan': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/swamp_rat.py b/scripts/faction/swamp_rat.py new file mode 100644 index 00000000..89a851e9 --- /dev/null +++ b/scripts/faction/swamp_rat.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'gungan': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/swoop.py b/scripts/faction/swoop.py new file mode 100644 index 00000000..24e9984a --- /dev/null +++ b/scripts/faction/swoop.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'desert_demon': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/thug.py b/scripts/faction/thug.py new file mode 100644 index 00000000..bd97f757 --- /dev/null +++ b/scripts/faction/thug.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'townsperson': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/townsperson.py b/scripts/faction/townsperson.py new file mode 100644 index 00000000..e747a256 --- /dev/null +++ b/scripts/faction/townsperson.py @@ -0,0 +1,11 @@ +import sys + +def isAlly(ally): + if ally == 'rebel' or ally == 'imperial': + return 1 + return 0 + +def isEnemy(enemy): + if enemy == 'thug' or enemy == 'bandit': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/trade_federation.py b/scripts/faction/trade_federation.py new file mode 100644 index 00000000..74674464 --- /dev/null +++ b/scripts/faction/trade_federation.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'borvo' or enemy == 'naboo_security_force': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/tusken_raider.py b/scripts/faction/tusken_raider.py new file mode 100644 index 00000000..4a81e25b --- /dev/null +++ b/scripts/faction/tusken_raider.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'jawa' or enemy == 'alkhara': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/valarian.py b/scripts/faction/valarian.py new file mode 100644 index 00000000..9d5ef701 --- /dev/null +++ b/scripts/faction/valarian.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'jabba': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/faction/yavin_scavenger.py b/scripts/faction/yavin_scavenger.py new file mode 100644 index 00000000..0c95933c --- /dev/null +++ b/scripts/faction/yavin_scavenger.py @@ -0,0 +1,9 @@ +import sys + +def isAlly(ally): + return 0 + +def isEnemy(enemy): + if enemy == 'hutt' or enemy == 'jabba': + return 1 + return 0 \ No newline at end of file diff --git a/scripts/object/building/corellia/bank_corellia.py b/scripts/object/building/corellia/bank_corellia.py index ccad8904..8a96a6ad 100644 --- a/scripts/object/building/corellia/bank_corellia.py +++ b/scripts/object/building/corellia/bank_corellia.py @@ -1,4 +1,12 @@ import sys def setup(core, object): + + objSvc = core.objectService + + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 0, 0.5, 4.2, 0, 1) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 0, 0.5, -4.2, 1, 0) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 4.2, 0.5, 0.707107, 0.707107, 1) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', -4.2, 0.5, 0, -0.707107, 0.707107) + return \ No newline at end of file diff --git a/scripts/object/building/general/shuttleport_general.py b/scripts/object/building/general/shuttleport_general.py index ccad8904..9d1219e5 100644 --- a/scripts/object/building/general/shuttleport_general.py +++ b/scripts/object/building/general/shuttleport_general.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + objSvc = core.objectService + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', -13, 0.6, -10, -0.707107, 0.707107) + objSvc.createChildObject(object, 'object/creature/npc/theme_park/shared_player_shuttle.iff', 0, 0.6, 0, 1, 0) + objSvc.createChildObject(object, 'object/tangible/travel/ticket_collector/shared_ticket_collector.iff', -13, 0.6, 10, -0.707107, 0.707107) return \ No newline at end of file diff --git a/scripts/object/building/naboo/bank_naboo.py b/scripts/object/building/naboo/bank_naboo.py index ccad8904..8a96a6ad 100644 --- a/scripts/object/building/naboo/bank_naboo.py +++ b/scripts/object/building/naboo/bank_naboo.py @@ -1,4 +1,12 @@ import sys def setup(core, object): + + objSvc = core.objectService + + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 0, 0.5, 4.2, 0, 1) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 0, 0.5, -4.2, 1, 0) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 4.2, 0.5, 0.707107, 0.707107, 1) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', -4.2, 0.5, 0, -0.707107, 0.707107) + return \ No newline at end of file diff --git a/scripts/object/building/naboo/hangar_naboo_theed.py b/scripts/object/building/naboo/hangar_naboo_theed.py index ccad8904..f3d215ec 100644 --- a/scripts/object/building/naboo/hangar_naboo_theed.py +++ b/scripts/object/building/naboo/hangar_naboo_theed.py @@ -1,4 +1,19 @@ import sys def setup(core, object): + stcSvc = core.staticService + cell = object.getCellByCellNumber(3) + cell2 = object.getCellByCellNumber(4) + cell3 = object.getCellByCellNumber(5) + + if cell: + stcSvc.spawnObject('object/tangible/terminal/shared_terminal_travel.iff', object.getPlanet().getName(), cell.getObjectID(), float(-26.94), float(0.749), float(-67.14), float(1), float(0)) + stcSvc.spawnObject('object/tangible/terminal/shared_terminal_travel.iff', object.getPlanet().getName(), cell2.getObjectID(), float(26.94), float(0.749), float(-67.14), float(1), float(0)) + stcSvc.spawnObject('object/tangible/terminal/shared_terminal_travel.iff', object.getPlanet().getName(), cell3.getObjectID(), float(-9.49), float(7.979), float(-45.2359), float(0), float(1)) + stcSvc.spawnObject('object/tangible/terminal/shared_terminal_travel.iff', object.getPlanet().getName(), cell3.getObjectID(), float(9.49), float(7.979), float(-45.2359), float(0), float(1)) + stcSvc.spawnObject('object/tangible/travel/ticket_collector/shared_ticket_collector.iff', object.getPlanet().getName(), cell3.getObjectID(), float(-10), float(7.979), float(10), float(-0.707107), float(0.707107)) + stcSvc.spawnObject('object/creature/npc/theme_park/shared_player_transport_theed_hangar.iff', object.getPlanet().getName(), cell3.getObjectID(), float(0), float(7.979), float(0), float(1), float(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/rori_restuss_shuttleport.py b/scripts/object/building/naboo/rori_restuss_shuttleport.py index ccad8904..9d1219e5 100644 --- a/scripts/object/building/naboo/rori_restuss_shuttleport.py +++ b/scripts/object/building/naboo/rori_restuss_shuttleport.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + objSvc = core.objectService + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_travel.iff', -13, 0.6, -10, -0.707107, 0.707107) + objSvc.createChildObject(object, 'object/creature/npc/theme_park/shared_player_shuttle.iff', 0, 0.6, 0, 1, 0) + objSvc.createChildObject(object, 'object/tangible/travel/ticket_collector/shared_ticket_collector.iff', -13, 0.6, 10, -0.707107, 0.707107) return \ No newline at end of file diff --git a/scripts/object/building/naboo/rori_restuss_starport.py b/scripts/object/building/naboo/rori_restuss_starport.py index ccad8904..c48218dd 100644 --- a/scripts/object/building/naboo/rori_restuss_starport.py +++ b/scripts/object/building/naboo/rori_restuss_starport.py @@ -1,4 +1,14 @@ import sys def setup(core, object): + stcSvc = core.staticService + 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/tangible/travel/ticket_collector/shared_ticket_collector.iff', 1, 0, -10, 0, 1) + + cell = object.getCellByCellNumber(1) + + if cell: + stcSvc.spawnObject('object/tangible/terminal/shared_terminal_travel.iff', object.getPlanet().getName(), cell.getObjectID(), float(-3.12), float(0.14659503), float(-17.57), float(0.707107), float(-0.707107)) + return \ No newline at end of file diff --git a/scripts/object/building/restuss/restuss_shuttleport.py b/scripts/object/building/restuss/restuss_shuttleport.py index ccad8904..a3ddedaa 100644 --- a/scripts/object/building/restuss/restuss_shuttleport.py +++ b/scripts/object/building/restuss/restuss_shuttleport.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + return \ No newline at end of file diff --git a/scripts/object/building/restuss/restuss_starport.py b/scripts/object/building/restuss/restuss_starport.py index ccad8904..b686025c 100644 --- a/scripts/object/building/restuss/restuss_starport.py +++ b/scripts/object/building/restuss/restuss_starport.py @@ -1,4 +1,16 @@ import sys def setup(core, object): + + stcSvc = core.staticService + 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/tangible/travel/ticket_collector/shared_ticket_collector.iff', 1, 0, -10, 0, 1) + + cell = object.getCellByCellNumber(1) + + if cell: + stcSvc.spawnObject('object/tangible/terminal/shared_terminal_travel.iff', object.getPlanet().getName(), cell.getObjectID(), float(-3.12), float(0.14659503), float(-17.57), float(0.707107), float(-0.707107)) + + return \ No newline at end of file diff --git a/scripts/object/building/tatooine/bank_tatooine.py b/scripts/object/building/tatooine/bank_tatooine.py index ccad8904..8a96a6ad 100644 --- a/scripts/object/building/tatooine/bank_tatooine.py +++ b/scripts/object/building/tatooine/bank_tatooine.py @@ -1,4 +1,12 @@ import sys def setup(core, object): + + objSvc = core.objectService + + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 0, 0.5, 4.2, 0, 1) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 0, 0.5, -4.2, 1, 0) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', 4.2, 0.5, 0.707107, 0.707107, 1) + objSvc.createChildObject(object, 'object/tangible/terminal/shared_terminal_bank.iff', -4.2, 0.5, 0, -0.707107, 0.707107) + return \ No newline at end of file diff --git a/scripts/object/creature/npc/theme_park/lambda_shuttle.py b/scripts/object/creature/npc/theme_park/lambda_shuttle.py index ccad8904..3e8a7cbb 100644 --- a/scripts/object/creature/npc/theme_park/lambda_shuttle.py +++ b/scripts/object/creature/npc/theme_park/lambda_shuttle.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + #object.setPosture(2) return \ No newline at end of file diff --git a/scripts/object/creature/npc/theme_park/player_shuttle.py b/scripts/object/creature/npc/theme_park/player_shuttle.py index ccad8904..57a5dcc3 100644 --- a/scripts/object/creature/npc/theme_park/player_shuttle.py +++ b/scripts/object/creature/npc/theme_park/player_shuttle.py @@ -1,4 +1,11 @@ import sys def setup(core, object): + object.setPosture(0) # land = 0 : away = 2 + object.setOptionsBitmask(256) + tp = core.travelService.getNearestTravelPoint(object) + if tp: + tp.setShuttle(object) + tp.setShuttleAvailable(True) + tp.setShuttleLanding(False) return \ No newline at end of file diff --git a/scripts/object/creature/npc/theme_park/player_transport.py b/scripts/object/creature/npc/theme_park/player_transport.py index e1dd8242..57a5dcc3 100644 --- a/scripts/object/creature/npc/theme_park/player_transport.py +++ b/scripts/object/creature/npc/theme_park/player_transport.py @@ -2,6 +2,7 @@ import sys def setup(core, object): object.setPosture(0) # land = 0 : away = 2 + object.setOptionsBitmask(256) tp = core.travelService.getNearestTravelPoint(object) if tp: tp.setShuttle(object) diff --git a/scripts/object/creature/npc/theme_park/player_transport_theed_hangar.py b/scripts/object/creature/npc/theme_park/player_transport_theed_hangar.py index ccad8904..57a5dcc3 100644 --- a/scripts/object/creature/npc/theme_park/player_transport_theed_hangar.py +++ b/scripts/object/creature/npc/theme_park/player_transport_theed_hangar.py @@ -1,4 +1,11 @@ import sys def setup(core, object): + object.setPosture(0) # land = 0 : away = 2 + object.setOptionsBitmask(256) + tp = core.travelService.getNearestTravelPoint(object) + if tp: + tp.setShuttle(object) + tp.setShuttleAvailable(True) + tp.setShuttleLanding(False) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_mission.py b/scripts/object/tangible/terminal/terminal_mission.py index 4884aa67..ccf684c0 100644 --- a/scripts/object/tangible/terminal/terminal_mission.py +++ b/scripts/object/tangible/terminal/terminal_mission.py @@ -1,7 +1,9 @@ +from resources.common import TerminalType import sys def setup(core, object): core.mapService.addLocation(object.getPlanet(), 'Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 44, 0) + object.setAttachment("terminalType", TerminalType.MISSION_GENERIC) return \ No newline at end of file diff --git a/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py b/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py index ccad8904..77e1b16d 100644 --- a/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py +++ b/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'travel_ticket') return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_l.py b/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_l.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_l.py +++ b/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_l.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_r.py b/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_r.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_r.py +++ b/scripts/object/tangible/wearables/armor/appearance_invisible_bicep_r.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_l.py b/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_l.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_l.py +++ b/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_l.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_r.py b/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_r.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_r.py +++ b/scripts/object/tangible/wearables/armor/appearance_invisible_bracer_r.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/armor/nightsister/armor_nightsister_bicep_r_s01.py b/scripts/object/tangible/wearables/armor/nightsister/armor_nightsister_bicep_r_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/armor/nightsister/armor_nightsister_bicep_r_s01.py +++ b/scripts/object/tangible/wearables/armor/nightsister/armor_nightsister_bicep_r_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/back_gmf_wings.py b/scripts/object/tangible/wearables/backpack/back_gmf_wings.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/backpack/back_gmf_wings.py +++ b/scripts/object/tangible/wearables/backpack/back_gmf_wings.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/back_love_day_10_blue_wings.py b/scripts/object/tangible/wearables/backpack/back_love_day_10_blue_wings.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/backpack/back_love_day_10_blue_wings.py +++ b/scripts/object/tangible/wearables/backpack/back_love_day_10_blue_wings.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/back_love_day_10_golden_wings.py b/scripts/object/tangible/wearables/backpack/back_love_day_10_golden_wings.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/backpack/back_love_day_10_golden_wings.py +++ b/scripts/object/tangible/wearables/backpack/back_love_day_10_golden_wings.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/back_love_day_10_pink_wings.py b/scripts/object/tangible/wearables/backpack/back_love_day_10_pink_wings.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/backpack/back_love_day_10_pink_wings.py +++ b/scripts/object/tangible/wearables/backpack/back_love_day_10_pink_wings.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/back_love_day_11_hue_wings.py b/scripts/object/tangible/wearables/backpack/back_love_day_11_hue_wings.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/backpack/back_love_day_11_hue_wings.py +++ b/scripts/object/tangible/wearables/backpack/back_love_day_11_hue_wings.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/back_love_day_wings.py b/scripts/object/tangible/wearables/backpack/back_love_day_wings.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/backpack/back_love_day_wings.py +++ b/scripts/object/tangible/wearables/backpack/back_love_day_wings.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/backpack_gmf_01.py b/scripts/object/tangible/wearables/backpack/backpack_gmf_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/backpack/backpack_gmf_01.py +++ b/scripts/object/tangible/wearables/backpack/backpack_gmf_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/empireday_rebel_endor_backpack.py b/scripts/object/tangible/wearables/backpack/empireday_rebel_endor_backpack.py index ccad8904..fa0152e7 100644 --- a/scripts/object/tangible/wearables/backpack/empireday_rebel_endor_backpack.py +++ b/scripts/object/tangible/wearables/backpack/empireday_rebel_endor_backpack.py @@ -1,4 +1,9 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + object.setStringAttribute('cost', '[15] Remembrance Day Token') + object.setStringAttribute('faction_restriction', 'Rebel Alliance') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/empireday_sandtrooper_backpack.py b/scripts/object/tangible/wearables/backpack/empireday_sandtrooper_backpack.py index ccad8904..c86c4ed5 100644 --- a/scripts/object/tangible/wearables/backpack/empireday_sandtrooper_backpack.py +++ b/scripts/object/tangible/wearables/backpack/empireday_sandtrooper_backpack.py @@ -1,4 +1,9 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + object.setStringAttribute('cost', '[15] Empire Day Token') + object.setStringAttribute('faction_restriction', 'Imperial') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s01.py b/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s01.py +++ b/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s02.py b/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s02.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s02.py +++ b/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s02.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s03.py b/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s03.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s03.py +++ b/scripts/object/tangible/wearables/bandolier/bandolier_tusken_raider_s03.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/belt/appearance_invisible_s01.py b/scripts/object/tangible/wearables/belt/appearance_invisible_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/belt/appearance_invisible_s01.py +++ b/scripts/object/tangible/wearables/belt/appearance_invisible_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/belt/belt_whip_s01.py b/scripts/object/tangible/wearables/belt/belt_whip_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/belt/belt_whip_s01.py +++ b/scripts/object/tangible/wearables/belt/belt_whip_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/bodysuit_atat.py b/scripts/object/tangible/wearables/bodysuit/bodysuit_atat.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bodysuit/bodysuit_atat.py +++ b/scripts/object/tangible/wearables/bodysuit/bodysuit_atat.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/bodysuit_atat_quest.py b/scripts/object/tangible/wearables/bodysuit/bodysuit_atat_quest.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bodysuit/bodysuit_atat_quest.py +++ b/scripts/object/tangible/wearables/bodysuit/bodysuit_atat_quest.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing.py b/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing.py +++ b/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing_quest.py b/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing_quest.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing_quest.py +++ b/scripts/object/tangible/wearables/bodysuit/bodysuit_bwing_quest.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/bodysuit_outbreak_prisoner.py b/scripts/object/tangible/wearables/bodysuit/bodysuit_outbreak_prisoner.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bodysuit/bodysuit_outbreak_prisoner.py +++ b/scripts/object/tangible/wearables/bodysuit/bodysuit_outbreak_prisoner.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter.py b/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter.py +++ b/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter_quest.py b/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter_quest.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter_quest.py +++ b/scripts/object/tangible/wearables/bodysuit/bodysuit_tie_fighter_quest.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/boots/boots_tusken_raider.py b/scripts/object/tangible/wearables/boots/boots_tusken_raider.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/boots/boots_tusken_raider.py +++ b/scripts/object/tangible/wearables/boots/boots_tusken_raider.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bracelet/appearance_invisible_l_s01.py b/scripts/object/tangible/wearables/bracelet/appearance_invisible_l_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bracelet/appearance_invisible_l_s01.py +++ b/scripts/object/tangible/wearables/bracelet/appearance_invisible_l_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bracelet/appearance_invisible_r_s01.py b/scripts/object/tangible/wearables/bracelet/appearance_invisible_r_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/bracelet/appearance_invisible_r_s01.py +++ b/scripts/object/tangible/wearables/bracelet/appearance_invisible_r_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/cape/cape_imperial_01.py b/scripts/object/tangible/wearables/cape/cape_imperial_01.py index ccad8904..66ff82f4 100644 --- a/scripts/object/tangible/wearables/cape/cape_imperial_01.py +++ b/scripts/object/tangible/wearables/cape/cape_imperial_01.py @@ -1,4 +1,11 @@ import sys def setup(core, object): + object.setCustomName('Imperial Cape') + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + object.setStringAttribute('cost', '[2500] Imperial Galactic Civil War token') + object.setStringAttribute('faction_restriction', 'Imperial') + + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/cape/cape_rebel_01.py b/scripts/object/tangible/wearables/cape/cape_rebel_01.py index ccad8904..ac9674d5 100644 --- a/scripts/object/tangible/wearables/cape/cape_rebel_01.py +++ b/scripts/object/tangible/wearables/cape/cape_rebel_01.py @@ -1,4 +1,11 @@ import sys def setup(core, object): + object.setCustomName('Rebel Alliance Cape') + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + object.setStringAttribute('cost', '[2500] Rebel Alliance Galactic Civil War token') + object.setStringAttribute('faction_restriction', 'Rebel Alliance') + + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/gloves/appearance_invisible_s01.py b/scripts/object/tangible/wearables/gloves/appearance_invisible_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/gloves/appearance_invisible_s01.py +++ b/scripts/object/tangible/wearables/gloves/appearance_invisible_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/gloves/gloves_tusken_raider.py b/scripts/object/tangible/wearables/gloves/gloves_tusken_raider.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/gloves/gloves_tusken_raider.py +++ b/scripts/object/tangible/wearables/gloves/gloves_tusken_raider.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/goggles_anniversary.py b/scripts/object/tangible/wearables/goggles/goggles_anniversary.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/goggles/goggles_anniversary.py +++ b/scripts/object/tangible/wearables/goggles/goggles_anniversary.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/goggles_s01.py b/scripts/object/tangible/wearables/goggles/goggles_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/goggles/goggles_s01.py +++ b/scripts/object/tangible/wearables/goggles/goggles_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/goggles_s02.py b/scripts/object/tangible/wearables/goggles/goggles_s02.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/goggles/goggles_s02.py +++ b/scripts/object/tangible/wearables/goggles/goggles_s02.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/goggles_s03.py b/scripts/object/tangible/wearables/goggles/goggles_s03.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/goggles/goggles_s03.py +++ b/scripts/object/tangible/wearables/goggles/goggles_s03.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/goggles_s04.py b/scripts/object/tangible/wearables/goggles/goggles_s04.py index ccad8904..4f631a53 100644 --- a/scripts/object/tangible/wearables/goggles/goggles_s04.py +++ b/scripts/object/tangible/wearables/goggles/goggles_s04.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/goggles_s05.py b/scripts/object/tangible/wearables/goggles/goggles_s05.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/goggles/goggles_s05.py +++ b/scripts/object/tangible/wearables/goggles/goggles_s05.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/goggles_s06.py b/scripts/object/tangible/wearables/goggles/goggles_s06.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/goggles/goggles_s06.py +++ b/scripts/object/tangible/wearables/goggles/goggles_s06.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/goggles/rebreather.py b/scripts/object/tangible/wearables/goggles/rebreather.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/goggles/rebreather.py +++ b/scripts/object/tangible/wearables/goggles/rebreather.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/hat/hat_fedora__s01.py b/scripts/object/tangible/wearables/hat/hat_fedora__s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/hat/hat_fedora__s01.py +++ b/scripts/object/tangible/wearables/hat/hat_fedora__s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/hat/hat_imp_s01.py b/scripts/object/tangible/wearables/hat/hat_imp_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/hat/hat_imp_s01.py +++ b/scripts/object/tangible/wearables/hat/hat_imp_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/hat/hat_imp_s02.py b/scripts/object/tangible/wearables/hat/hat_imp_s02.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/hat/hat_imp_s02.py +++ b/scripts/object/tangible/wearables/hat/hat_imp_s02.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/hat/hat_imperial_gunner_01.py b/scripts/object/tangible/wearables/hat/hat_imperial_gunner_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/hat/hat_imperial_gunner_01.py +++ b/scripts/object/tangible/wearables/hat/hat_imperial_gunner_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/hat/hat_loveday_halo_01.py b/scripts/object/tangible/wearables/hat/hat_loveday_halo_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/hat/hat_loveday_halo_01.py +++ b/scripts/object/tangible/wearables/hat/hat_loveday_halo_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/hat/hat_loveday_halo_02.py b/scripts/object/tangible/wearables/hat/hat_loveday_halo_02.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/hat/hat_loveday_halo_02.py +++ b/scripts/object/tangible/wearables/hat/hat_loveday_halo_02.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/hat/hat_rebel_trooper_01.py b/scripts/object/tangible/wearables/hat/hat_rebel_trooper_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/hat/hat_rebel_trooper_01.py +++ b/scripts/object/tangible/wearables/hat/hat_rebel_trooper_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_atat.py b/scripts/object/tangible/wearables/helmet/helmet_atat.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_atat.py +++ b/scripts/object/tangible/wearables/helmet/helmet_atat.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_fighter_blacksun_ace.py b/scripts/object/tangible/wearables/helmet/helmet_fighter_blacksun_ace.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_fighter_blacksun_ace.py +++ b/scripts/object/tangible/wearables/helmet/helmet_fighter_blacksun_ace.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_fighter_imperial_ace.py b/scripts/object/tangible/wearables/helmet/helmet_fighter_imperial_ace.py index ccad8904..4f631a53 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_fighter_imperial_ace.py +++ b/scripts/object/tangible/wearables/helmet/helmet_fighter_imperial_ace.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_fighter_privateer_ace.py b/scripts/object/tangible/wearables/helmet/helmet_fighter_privateer_ace.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_fighter_privateer_ace.py +++ b/scripts/object/tangible/wearables/helmet/helmet_fighter_privateer_ace.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_fighter_rebel_ace.py b/scripts/object/tangible/wearables/helmet/helmet_fighter_rebel_ace.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_fighter_rebel_ace.py +++ b/scripts/object/tangible/wearables/helmet/helmet_fighter_rebel_ace.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_tie_fighter.py b/scripts/object/tangible/wearables/helmet/helmet_tie_fighter.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_tie_fighter.py +++ b/scripts/object/tangible/wearables/helmet/helmet_tie_fighter.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s01.py b/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s01.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s01.py +++ b/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s02.py b/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s02.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s02.py +++ b/scripts/object/tangible/wearables/helmet/helmet_tusken_raider_s02.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/appearance_invisible_s01.py b/scripts/object/tangible/wearables/jacket/appearance_invisible_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/appearance_invisible_s01.py +++ b/scripts/object/tangible/wearables/jacket/appearance_invisible_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_ace_imperial.py b/scripts/object/tangible/wearables/jacket/jacket_ace_imperial.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_ace_imperial.py +++ b/scripts/object/tangible/wearables/jacket/jacket_ace_imperial.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_ace_privateer.py b/scripts/object/tangible/wearables/jacket/jacket_ace_privateer.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_ace_privateer.py +++ b/scripts/object/tangible/wearables/jacket/jacket_ace_privateer.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_ace_rebel.py b/scripts/object/tangible/wearables/jacket/jacket_ace_rebel.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_ace_rebel.py +++ b/scripts/object/tangible/wearables/jacket/jacket_ace_rebel.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_gcw_imperial_01.py b/scripts/object/tangible/wearables/jacket/jacket_gcw_imperial_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_gcw_imperial_01.py +++ b/scripts/object/tangible/wearables/jacket/jacket_gcw_imperial_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_gcw_rebel_01.py b/scripts/object/tangible/wearables/jacket/jacket_gcw_rebel_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_gcw_rebel_01.py +++ b/scripts/object/tangible/wearables/jacket/jacket_gcw_rebel_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_gmf_01.py b/scripts/object/tangible/wearables/jacket/jacket_gmf_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_gmf_01.py +++ b/scripts/object/tangible/wearables/jacket/jacket_gmf_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_01.py b/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_01.py +++ b/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_02.py b/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_02.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_02.py +++ b/scripts/object/tangible/wearables/jacket/jacket_lifeday_09_02.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/jacket/jacket_outbreak_prison_guard.py b/scripts/object/tangible/wearables/jacket/jacket_outbreak_prison_guard.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/jacket/jacket_outbreak_prison_guard.py +++ b/scripts/object/tangible/wearables/jacket/jacket_outbreak_prison_guard.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/appearance_invisible_s01.py b/scripts/object/tangible/wearables/necklace/appearance_invisible_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/appearance_invisible_s01.py +++ b/scripts/object/tangible/wearables/necklace/appearance_invisible_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_f.py b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_f.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_m.py b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_m.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_empire_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_f.py b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_f.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_m.py b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_m.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_neutral_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_f.py b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_f.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_m.py b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_m.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_f.py b/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_f.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_m.py b/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_m.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_rodian_safari_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_f.py b/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_f.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_m.py b/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_m.py +++ b/scripts/object/tangible/wearables/necklace/ith_necklace_trando_scale_of_honor_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_f.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_m.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_f.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_m.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_empire_wke_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_f.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_m.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_f.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_m.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_neutral_wke_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_f.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_m.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_f.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_m.py b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_lifeday.py b/scripts/object/tangible/wearables/necklace/necklace_lifeday.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_lifeday.py +++ b/scripts/object/tangible/wearables/necklace/necklace_lifeday.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_medallion_black_sun.py b/scripts/object/tangible/wearables/necklace/necklace_medallion_black_sun.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_medallion_black_sun.py +++ b/scripts/object/tangible/wearables/necklace/necklace_medallion_black_sun.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_primitive_01.py b/scripts/object/tangible/wearables/necklace/necklace_primitive_01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_primitive_01.py +++ b/scripts/object/tangible/wearables/necklace/necklace_primitive_01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_primitive_03.py b/scripts/object/tangible/wearables/necklace/necklace_primitive_03.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_primitive_03.py +++ b/scripts/object/tangible/wearables/necklace/necklace_primitive_03.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_primitive_04.py b/scripts/object/tangible/wearables/necklace/necklace_primitive_04.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_primitive_04.py +++ b/scripts/object/tangible/wearables/necklace/necklace_primitive_04.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari.py b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari.py +++ b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_f.py b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_m.py b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_f.py b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_m.py b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_rodian_safari_wke_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_f.py b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_m.py b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_f.py b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_f.py +++ b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_m.py b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_m.py +++ b/scripts/object/tangible/wearables/necklace/necklace_trando_scale_of_honor_wke_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/pants/pants_outbreak_prison_guard.py b/scripts/object/tangible/wearables/pants/pants_outbreak_prison_guard.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/pants/pants_outbreak_prison_guard.py +++ b/scripts/object/tangible/wearables/pants/pants_outbreak_prison_guard.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s01.py b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s01.py index ccad8904..1d64fa57 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s01.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s01.py @@ -1,4 +1,18 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'constitution_modified', 100) + core.skillModService.addSkillMod(actor, 'precision_modified', 100) + + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'constitution_modified', 100) + core.skillModService.deductSkillMod(actor, 'precision_modified', 100) + + + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s02.py b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s02.py index ccad8904..0a02012a 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s02.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s02.py @@ -1,4 +1,18 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'constitution_modified', 145) + core.skillModService.addSkillMod(actor, 'precision_modified', 145) + + + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'constitution_modified', 145) + core.skillModService.deductSkillMod(actor, 'precision_modified', 145) + + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s03.py b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s03.py index ccad8904..9a627b3b 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s03.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s03.py @@ -1,4 +1,19 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'constitution_modified', 185) + core.skillModService.addSkillMod(actor, 'precision_modified', 185) + core.skillModService.addSkillMod(actor, 'luck_modified', 185) + + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'constitution_modified', 185) + core.skillModService.deductSkillMod(actor, 'precision_modified', 185) + core.skillModService.deductSkillMod(actor, 'luck_modified', 185) + + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s04.py b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s04.py index ccad8904..8c145ab4 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_dark_s04.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_dark_s04.py @@ -1,4 +1,31 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'constitution_modified', 250) + core.skillModService.addSkillMod(actor, 'precision_modified', 250) + core.skillModService.addSkillMod(actor, 'luck_modified', 250) + + Buff = actor.getBuffByName('proc_old_dark_jedi_gift') + if actor.getBuffList().contains(Buff): + core.buffService.removeBuffFromCreature(actor, Buff) + return + + if actor: + core.buffService.addBuffToCreature(actor, 'proc_old_dark_jedi_gift') + return + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'constitution_modified', 250) + core.skillModService.deductSkillMod(actor, 'precision_modified', 250) + core.skillModService.deductSkillMod(actor, 'luck_modified', 250) + + Buff = actor.getBuffByName('proc_old_dark_jedi_gift') + if actor.getBuffList().contains(Buff): + core.buffService.removeBuffFromCreature(actor, Buff) + return + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_light_s01.py b/scripts/object/tangible/wearables/robe/robe_jedi_light_s01.py index ccad8904..639eac05 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_light_s01.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_light_s01.py @@ -1,4 +1,18 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'constitution_modified', 100) + core.skillModService.addSkillMod(actor, 'strength_modified', 100) + + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'constitution_modified', 100) + core.skillModService.deductSkillMod(actor, 'strength_modified', 100) + + + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_light_s02.py b/scripts/object/tangible/wearables/robe/robe_jedi_light_s02.py index ccad8904..9db15ef9 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_light_s02.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_light_s02.py @@ -1,4 +1,18 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'constitution_modified', 145) + core.skillModService.addSkillMod(actor, 'strength_modified', 145) + + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'constitution_modified', 145) + core.skillModService.deductSkillMod(actor, 'strength_modified', 145) + + + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_light_s03.py b/scripts/object/tangible/wearables/robe/robe_jedi_light_s03.py index ccad8904..6a546a09 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_light_s03.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_light_s03.py @@ -1,4 +1,19 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'agility_modified', 185) + core.skillModService.addSkillMod(actor, 'constitution_modified', 185) + core.skillModService.addSkillMod(actor, 'strength_modified', 185) + + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'agility_modified', 185) + core.skillModService.deductSkillMod(actor, 'constitution_modified', 185) + core.skillModService.deductSkillMod(actor, 'strength_modified', 185) + + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_light_s04.py b/scripts/object/tangible/wearables/robe/robe_jedi_light_s04.py index ccad8904..be022790 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_light_s04.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_light_s04.py @@ -1,4 +1,31 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'agility_modified', 250) + core.skillModService.addSkillMod(actor, 'constitution_modified', 250) + core.skillModService.addSkillMod(actor, 'strength_modified', 250) + + Buff = actor.getBuffByName('proc_old_light_jedi_gift') + if actor.getBuffList().contains(Buff): + core.buffService.removeBuffFromCreature(actor, Buff) + return + + if actor: + core.buffService.addBuffToCreature(actor, 'proc_old_light_jedi_gift') + return + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'agility_modified', 250) + core.skillModService.deductSkillMod(actor, 'constitution_modified', 250) + core.skillModService.deductSkillMod(actor, 'strength_modified', 250) + + Buff = actor.getBuffByName('proc_old_light_jedi_gift') + if actor.getBuffList().contains(Buff): + core.buffService.removeBuffFromCreature(actor, Buff) + return + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_light_s05.py b/scripts/object/tangible/wearables/robe/robe_jedi_light_s05.py index ccad8904..9c60f170 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_light_s05.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_light_s05.py @@ -1,4 +1,34 @@ import sys +def setup(core, object): + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'agility_modified', 250) + core.skillModService.addSkillMod(actor, 'constitution_modified', 250) + core.skillModService.addSkillMod(actor, 'strength_modified', 250) + + Buff = actor.getBuffByName('proc_old_light_jedi_gift') + if actor.getBuffList().contains(Buff): + core.buffService.removeBuffFromCreature(actor, Buff) + return + + if actor: + core.buffService.addBuffToCreature(actor, 'proc_old_light_jedi_gift') + return + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'agility_modified', 250) + core.skillModService.deductSkillMod(actor, 'constitution_modified', 250) + core.skillModService.deductSkillMod(actor, 'strength_modified', 250) + + Buff = actor.getBuffByName('proc_old_light_jedi_gift') + if actor.getBuffList().contains(Buff): + core.buffService.removeBuffFromCreature(actor, Buff) + return + return + import sys + def setup(core, object): return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_jedi_padawan.py b/scripts/object/tangible/wearables/robe/robe_jedi_padawan.py index ccad8904..6a0ba95d 100644 --- a/scripts/object/tangible/wearables/robe/robe_jedi_padawan.py +++ b/scripts/object/tangible/wearables/robe/robe_jedi_padawan.py @@ -1,4 +1,15 @@ import sys def setup(core, object): - return \ No newline at end of file + return + +def equip(core, actor, target): + core.skillModService.addSkillMod(actor, 'agility_modified', 21) + + return + +def unequip(core, actor, target): + core.skillModService.deductSkillMod(actor, 'agility_modified', 21) + + return + \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_tusken_raider_s01.py b/scripts/object/tangible/wearables/robe/robe_tusken_raider_s01.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/robe/robe_tusken_raider_s01.py +++ b/scripts/object/tangible/wearables/robe/robe_tusken_raider_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/robe/robe_tusken_raider_s02.py b/scripts/object/tangible/wearables/robe/robe_tusken_raider_s02.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/robe/robe_tusken_raider_s02.py +++ b/scripts/object/tangible/wearables/robe/robe_tusken_raider_s02.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/utility/utility_belt_tusken_raider.py b/scripts/object/tangible/wearables/utility/utility_belt_tusken_raider.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/utility/utility_belt_tusken_raider.py +++ b/scripts/object/tangible/wearables/utility/utility_belt_tusken_raider.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/vest/appearance_invisible_s01.py b/scripts/object/tangible/wearables/vest/appearance_invisible_s01.py index ccad8904..a398dc48 100644 --- a/scripts/object/tangible/wearables/vest/appearance_invisible_s01.py +++ b/scripts/object/tangible/wearables/vest/appearance_invisible_s01.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe.py b/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe.py +++ b/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_f.py b/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_f.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_f.py +++ b/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_f.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_m.py b/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_m.py index ccad8904..b89922ca 100644 --- a/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_m.py +++ b/scripts/object/tangible/wearables/wookiee/wke_lifeday_robe_m.py @@ -1,4 +1,7 @@ import sys def setup(core, object): + object.setStringAttribute('condition', '100/100') + object.setIntAttribute('volume', 1) + return \ No newline at end of file diff --git a/scripts/radial/default.py b/scripts/radial/default.py index 572f253b..94d4e810 100644 --- a/scripts/radial/default.py +++ b/scripts/radial/default.py @@ -2,8 +2,12 @@ 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, '')) 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/scripts/radial/travel_terminal.py b/scripts/radial/travel_terminal.py index f8b984fb..eae686ca 100644 --- a/scripts/radial/travel_terminal.py +++ b/scripts/radial/travel_terminal.py @@ -8,13 +8,10 @@ def createRadial(core, owner, target, radials): def handleSelection(core, owner, target, option): if option == 21 and target: - print ('Owner: ' + str(owner.getObjectId())) - + if owner is not None: tpm = EnterTicketPurchaseModeMessage(owner.getPlanet().getName(), core.mapService.getClosestCityName(owner), owner) owner.getClient().getSession().write(tpm.serialize()) - print ('Planet name: ' + owner.getPlanet().getName()) - print ('City name: ' + core.mapService.getClosestCityName(owner)) return return diff --git a/scripts/radial/travel_ticket.py b/scripts/radial/travel_ticket.py new file mode 100644 index 00000000..a42df278 --- /dev/null +++ b/scripts/radial/travel_ticket.py @@ -0,0 +1,40 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.clear + + radials.add(RadialOptions(0, 21, 1, 'Use Travel Ticket')) + #radials.add(RadialOptions(0, 7, 1, '')) + #radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + + if option == 21 and target: + + tp = core.travelService.getNearestTravelPoint(owner) + + if owner is not None and tp is not None: + print (str(tp.getLocation().getDistance2D(owner.getWorldPosition()))) + if tp.getLocation().getDistance2D(owner.getWorldPosition()) <= float(25): + if tp.isShuttleAvailable() is True: + core.travelService.doTransport(owner, core.travelService.getTravelPointByName(target.getStringAttribute('@obj_attr_n:travel_arrival_planet'), + target.getStringAttribute('@obj_attr_n:travel_arrival_point'))) + core.objectService.destroyObject(target) + return + return + else: + owner.sendSystemMessage('@travel:boarding_too_far', 0) + return + return + return + + if option == 15 and target: + core.commandService.callCommand(owner, 'serverdestroyobject', target, None) + return + return + +def handleSUI(owner, window, eventType, returnList): + + return \ No newline at end of file diff --git a/scripts/skillMods/expertise_critical_niche_all.py b/scripts/skillMods/expertise_critical_niche_all.py index 4f2871ac..ef07415a 100644 --- a/scripts/skillMods/expertise_critical_niche_all.py +++ b/scripts/skillMods/expertise_critical_niche_all.py @@ -2,11 +2,11 @@ import sys def add(core, actor, name, base): actor.addSkillMod(name, base) - core.skillModService.addSkillMod(actor, 'display_only_critical', 100 * (actor.getSkillModBase('expertise_critical_niche_all'))) + core.skillModService.addSkillMod(actor, 'display_only_critical', 100 * base) return def deduct(core, actor, name, base): actor.deductSkillMod(name, base) - core.skillModService.deductSkillMod(actor, 'display_only_critical', 100 * (actor.getSkillModBase('expertise_critical_niche_all'))) + core.skillModService.deductSkillMod(actor, 'display_only_critical', 100 * base) return \ No newline at end of file diff --git a/scripts/skillMods/expertise_innate_protection_all.py b/scripts/skillMods/expertise_innate_protection_all.py index ee7769e2..cceb61ec 100644 --- a/scripts/skillMods/expertise_innate_protection_all.py +++ b/scripts/skillMods/expertise_innate_protection_all.py @@ -1,10 +1,22 @@ import sys def add(core, actor, name, base): + actor.addSkillMod('energy', base) + actor.addSkillMod('kinetic', base) + actor.addSkillMod('acid', base) + actor.addSkillMod('heat', base) + actor.addSkillMod('cold', base) + actor.addSkillMod('electricity', base) actor.addSkillMod(name, base) return def deduct(core, actor, name, base): + actor.deductSkillMod('energy', base) + actor.deductSkillMod('kinetic', base) + actor.deductSkillMod('acid', base) + actor.deductSkillMod('heat', base) + actor.deductSkillMod('cold', base) + actor.deductSkillMod('electricity', base) actor.deductSkillMod(name, base) return \ No newline at end of file diff --git a/scripts/skillMods/face.py b/scripts/skillMods/face.py new file mode 100644 index 00000000..49050a23 --- /dev/null +++ b/scripts/skillMods/face.py @@ -0,0 +1,10 @@ +import sys + +# Only for entertainers? +def add(core, actor, name, base): + actor.addSkillMod(name, base) + return + +def deduct(core, actor, name, base): + actor.deductSkillMod(name, base) + return \ No newline at end of file diff --git a/scripts/skillMods/hair.py b/scripts/skillMods/hair.py new file mode 100644 index 00000000..49050a23 --- /dev/null +++ b/scripts/skillMods/hair.py @@ -0,0 +1,10 @@ +import sys + +# Only for entertainers? +def add(core, actor, name, base): + actor.addSkillMod(name, base) + return + +def deduct(core, actor, name, base): + actor.deductSkillMod(name, base) + return \ No newline at end of file diff --git a/scripts/skillMods/markings.py b/scripts/skillMods/markings.py new file mode 100644 index 00000000..49050a23 --- /dev/null +++ b/scripts/skillMods/markings.py @@ -0,0 +1,10 @@ +import sys + +# Only for entertainers? +def add(core, actor, name, base): + actor.addSkillMod(name, base) + return + +def deduct(core, actor, name, base): + actor.deductSkillMod(name, base) + return \ No newline at end of file diff --git a/scripts/skillMods/movement.py b/scripts/skillMods/movement.py index 47ce841d..a842f3db 100644 --- a/scripts/skillMods/movement.py +++ b/scripts/skillMods/movement.py @@ -2,13 +2,10 @@ import sys def add(core, actor, name, base): actor.addSkillMod(name, base) - actor.getSkillMod(name).setModifier(10) - modifier = actor.getSkillMod(name).getModifier() - actor.setSpeedMultiplierBase(actor.getSpeedMultiplierBase() + float(float(base) / float(modifier))) + actor.setSpeedMultiplierBase(actor.getSpeedMultiplierBase() + base / 100) return def deduct(core, actor, name, base): - modifier = actor.getSkillMod(name).getModifier() - actor.setSpeedMultiplierBase(actor.getSpeedMultiplierBase() - float(float(base) / float(modifier))) + actor.setSpeedMultiplierBase(actor.getSpeedMultiplierBase() - base / 100) actor.deductSkillMod(name, base) return \ No newline at end of file diff --git a/scripts/starter_clothing/crafting_artisan_trandoshan_male.py b/scripts/starter_clothing/crafting_artisan_trandoshan_male.py index fcabfeda..3862af73 100644 --- a/scripts/starter_clothing/crafting_artisan_trandoshan_male.py +++ b/scripts/starter_clothing/crafting_artisan_trandoshan_male.py @@ -2,10 +2,9 @@ import sys def CraftingArtisanTrandoshanMale(core, object): shirt = core.objectService.createObject('object/tangible/wearables/shirt/shared_shirt_s03.iff', object.getPlanet()) - vest = core.objectService.createObject('object/tangible/wearables/vest/shared_vest_s09.if', object.getPlanet()) + vest = core.objectService.createObject('object/tangible/wearables/vest/shared_vest_s09.iff', object.getPlanet()) necklace = core.objectService.createObject('object/tangible/wearables/necklace/shared_necklace_primitive_03.iff', object.getPlanet()) - pants = core.objectService.createObject('object/tangible/wearables/pants/shared_pants_s13.ifff', object.getPlanet()) - inventory = object.getSlottedObject('inventory') + pants = core.objectService.createObject('object/tangible/wearables/pants/shared_pants_s13.iff', object.getPlanet()) object._add(shirt) object._add(vest) object._add(necklace) diff --git a/scripts/static_map_locations.py b/scripts/static_map_locations.py index 2222447d..c0d85263 100644 --- a/scripts/static_map_locations.py +++ b/scripts/static_map_locations.py @@ -30,7 +30,13 @@ def addLocations(core, planet): dathomirLocations(core, planet) if planet.getName() == 'lok': - lokLocations(core, planet) + lokLocations(core, planet) + + #if planet.getName() == 'kaas': + #kaasLocations(core, planet) + + #if planet.getName() == 'taanab': + #taanabLocations(core, planet) def tatooineLocations(core, planet): @@ -44,6 +50,7 @@ def tatooineLocations(core, planet): mapService.addLocation(planet, 'Wayfar', -5124, -6530, 17, 0, 0) mapService.addLocation(planet, 'Mos Eisley', 3528, -4804, 17, 0, 0) mapService.addLocation(planet, 'Anchorhead', 40, -5348, 17, 0, 0) + mapService.addLocation(planet, 'Mos Taike', 3813, 2354, 17, 0, 0) def corelliaLocations(core, planet): @@ -52,11 +59,11 @@ def corelliaLocations(core, planet): # Cities mapService.addLocation(planet, 'Coronet', -178, -4504, 17, 0, 0) - mapService.addLocation(planet, 'Tyrena', -5140, 2450, 17, 0, 0) + mapService.addLocation(planet, 'Tyrena', -5140, -2450, 17, 0, 0) mapService.addLocation(planet, 'Bela Vistal', 6766, -5692, 17, 0, 0) mapService.addLocation(planet, 'Kor Vella', -3420, 3146, 17, 0, 0) mapService.addLocation(planet, 'Doaba Guerfel', 3274, 5582, 17, 0, 0) - mapService.addLocation(planet, 'Vreni Island', -5538, 6176, 17, 0, 0) + mapService.addLocation(planet, 'Vreni Island', -5538, -6176, 17, 0, 0) def nabooLocations(core, planet): @@ -67,7 +74,7 @@ def nabooLocations(core, planet): mapService.addLocation(planet, 'Theed', -5488, 4380, 17, 0, 0) mapService.addLocation(planet, 'Keren', 1888, 2700, 17, 0, 0) mapService.addLocation(planet, 'Moenia', 4836, -4830.5, 17, 0, 0) - mapService.addLocation(planet, 'Deeja Peek', 4686, -1375, 17, 0, 0) + mapService.addLocation(planet, 'Deeja Peak', 4686, -1375, 17, 0, 0) mapService.addLocation(planet, 'Kaadara', 5288, 6687, 17, 0, 0) def roriLocations(core, planet): @@ -78,7 +85,7 @@ def roriLocations(core, planet): mapService.addLocation(planet, 'Narmle', -5140, -2368, 17, 0, 0) mapService.addLocation(planet, 'Restuss', 5318, 5680, 17, 0, 0) - mapService.addLocation(planet, 'Rebel outpost', 3677, -6447, 17, 0, 0) + mapService.addLocation(planet, 'Rebel Outpost', 3677, -6447, 17, 0, 0) def endorLocations(core, planet): @@ -86,7 +93,7 @@ def endorLocations(core, planet): # Cities - mapService.addLocation(planet, 'an outpost', -905, 1584, 17, 0, 0) + mapService.addLocation(planet, 'an Outpost', -905, 1584, 17, 0, 0) def talusLocations(core, planet): @@ -96,7 +103,7 @@ def talusLocations(core, planet): mapService.addLocation(planet, 'Dearic', 422, -3004, 17, 0, 0) mapService.addLocation(planet, 'Nashal', 4163, 5220, 17, 0, 0) - mapService.addLocation(planet, 'Imperial outpost', -2178, 2300, 17, 0, 0) + mapService.addLocation(planet, 'Imperial Outpost', -2178, 2300, 17, 0, 0) def yavin4Locations(core, planet): @@ -113,9 +120,9 @@ def dantooineLocations(core, planet): # Cities - mapService.addLocation(planet, 'Mining outpost', -640, 2486, 17, 0, 0) - mapService.addLocation(planet, 'Pirate outpost', 1588, -6399, 17, 0, 0) - mapService.addLocation(planet, 'Imperial outpost', -4224, -2400, 17, 0, 0) + mapService.addLocation(planet, 'Mining Outpost', -640, 2486, 17, 0, 0) + mapService.addLocation(planet, 'Pirate Outpost', 1588, -6399, 17, 0, 0) + mapService.addLocation(planet, 'Imperial Outpost', -4224, -2400, 17, 0, 0) def dathomirLocations(core, planet): @@ -136,4 +143,19 @@ def lokLocations(core, planet): mapService.addLocation(planet, 'Nym\'s Stronghold', 440, 5029, 17, 0, 0) mapService.addLocation(planet, 'Imperial outpost', -1920, -3084, 17, 0, 0) - \ No newline at end of file +#def kaasLocations(core, planet): + #mapService = core.mapService + + # Cities + + #mapService.addLocation(planet, 'Imperial Outpost', -5118, -2386, 17, 0, 0) + +#def taanabLocations(core, planet): + + #mapService = core.mapService + + # Cities + + #mapService.addLocation(planet, 'Pandath Spaceport', 0, 0, 17, 0, 0) + + diff --git a/scripts/static_spawns/rori.py b/scripts/static_spawns/rori.py index ae6e37f3..e097f64b 100644 --- a/scripts/static_spawns/rori.py +++ b/scripts/static_spawns/rori.py @@ -369,15 +369,15 @@ def addPlanetSpawns(core, planet): stcSvc.spawnObject('object/static/worldbuilding/structures/shared_mun_nboo_building_chunk_destoyed_10.iff', 'rori', long(0), float(5165.2), float(80), float(5550.01), float(0.24), float(0.971)) stcSvc.spawnObject('object/static/worldbuilding/decal/shared_mun_decal_blast_lg.iff', 'rori', long(0), float(5139.4), float(160), float(5599.26), float(0.349), float(0.937)) stcSvc.spawnObject('object/static/worldbuilding/structures/shared_mun_nboo_building_chunk_destoyed_13.iff', 'rori', long(0), float(5124.02), float(80), float(5682.59), float(0.057), float(0.998)) - stcSvc.spawnObject('object/building/military/shared_outpost_cloning_facility.iff', 'rori', long(0), float(5232.54), float(79.914), float(6176.29), float(0.703), float(0.711)) - stcSvc.spawnObject('object/building/naboo/shared_rori_restuss_starport.iff', 'rori', long(0), float(5281.13), float(80), float(6171.442), float(1), float(-0.001)) - stcSvc.spawnObject('object/building/military/shared_military_base_shed_imperial_style_cantina_s01.iff', 'rori', long(0), float(5284.15), float(80), float(6236.408), float(1), float(-0.001)) - stcSvc.spawnObject('object/building/military/shared_military_base_shed_imperial_style_hospital_01.iff', 'rori', long(0), float(5327.94), float(80), float(6204.451), float(0.877), float(-0.48)) - stcSvc.spawnObject('object/building/military/shared_military_rebel_tactical_center.iff', 'rori', long(0), float(4719.25), float(80), float(5870.46), float(0.707), float(0.707)) - stcSvc.spawnObject('object/building/restuss/shared_restuss_faction_cantina.iff', 'rori', long(0), float(4827.85), float(80), float(5874.45), float(0.703), float(0.711)) - stcSvc.spawnObject('object/building/military/shared_military_rebel_tactical_center.iff', 'rori', long(0), float(4778.08), float(80), float(5905.97), float(1), float(0)) - stcSvc.spawnObject('object/building/military/shared_military_base_shed_rebel_style_01.iff', 'rori', long(0), float(4831.285), float(80), float(5810.192), float(-0.41), float(0.912)) - stcSvc.spawnObject('object/building/military/shared_military_rebel_detachment_hq.iff', 'rori', long(0), float(4777.64), float(80), float(5776.2), float(0), float(1)) + #stcSvc.spawnObject('object/building/military/shared_outpost_cloning_facility.iff', 'rori', long(0), float(5232.54), float(79.914), float(6176.29), float(0.703), float(0.711)) + #stcSvc.spawnObject('object/building/naboo/shared_rori_restuss_starport.iff', 'rori', long(0), float(5281.13), float(80), float(6171.442), float(1), float(-0.001)) + #stcSvc.spawnObject('object/building/military/shared_military_base_shed_imperial_style_cantina_s01.iff', 'rori', long(0), float(5284.15), float(80), float(6236.408), float(1), float(-0.001)) + #stcSvc.spawnObject('object/building/military/shared_military_base_shed_imperial_style_hospital_01.iff', 'rori', long(0), float(5327.94), float(80), float(6204.451), float(0.877), float(-0.48)) + #stcSvc.spawnObject('object/building/military/shared_military_rebel_tactical_center.iff', 'rori', long(0), float(4719.25), float(80), float(5870.46), float(0.707), float(0.707)) + #stcSvc.spawnObject('object/building/restuss/shared_restuss_faction_cantina.iff', 'rori', long(0), float(4827.85), float(80), float(5874.45), float(0.703), float(0.711)) + #stcSvc.spawnObject('object/building/military/shared_military_rebel_tactical_center.iff', 'rori', long(0), float(4778.08), float(80), float(5905.97), float(1), float(0)) + #stcSvc.spawnObject('object/building/military/shared_military_base_shed_rebel_style_01.iff', 'rori', long(0), float(4831.285), float(80), float(5810.192), float(-0.41), float(0.912)) + #stcSvc.spawnObject('object/building/military/shared_military_rebel_detachment_hq.iff', 'rori', long(0), float(4777.64), float(80), float(5776.2), float(0), float(1)) stcSvc.spawnObject('object/static/worldbuilding/decal/shared_mun_decal_blast_lg.iff', 'rori', long(0), float(5254.85), float(160), float(5553.39), float(-0.551), float(0.834)) stcSvc.spawnObject('object/static/worldbuilding/decal/shared_mun_decal_blast_lg.iff', 'rori', long(0), float(5365.02), float(160), float(5577.16), float(-0.574), float(0.819)) stcSvc.spawnObject('object/static/worldbuilding/decal/shared_mun_decal_blast_lg.iff', 'rori', long(0), float(5143.04), float(160), float(5552.77), float(-0.259), float(0.966)) diff --git a/scripts/static_travel_points.py b/scripts/static_travel_points.py index 54964e53..26ac3f85 100644 --- a/scripts/static_travel_points.py +++ b/scripts/static_travel_points.py @@ -21,39 +21,52 @@ def addPoints(core, planet): if planet.getName() == 'tatooine': tatooinePoints(core, planet) if planet.getName() == 'yavin4': - yavin4Points(core, planet) + yavin4Points(core, planet) + if planet.getName() == 'kashyyyk_main': + kashyyyk_mainPoints(core, planet) + if planet.getName() == 'mustafar': + mustafarPoints(core, planet) return def corelliaPoints(core, planet): trvSvc = core.travelService - + + trvSvc.addTravelPoint(planet, "Coronet Shuttle A", -25, 28, -4409) + trvSvc.addTravelPoint(planet, "Coronet Shuttle B", -329, 28, -4641) + trvSvc.addTravelPoint(planet, "Vreni Island Shuttle", -5551, 15, -6059) + trvSvc.addTravelPoint(planet, "Tyrena Shuttle A", -5005, 21, -2386) + trvSvc.addTravelPoint(planet, "Tyrena Shuttle B", -5600, 21, -2790) + trvSvc.addTravelPoint(planet, "Doaba Guerfel Shuttleport", 3085, 280, 4993) + trvSvc.addTravelPoint(planet, "Kor Vella Shuttleport", -3775, 86, 3234) + trvSvc.addTravelPoint(planet, "Bela Vistal Shuttleport A", 6644, 330, -5922) + trvSvc.addTravelPoint(planet, "Bela Vistal Shuttleport B", 6930, 330, -5534) trvSvc.addTravelPoint(planet, "Coronet Starport", -51, 28, -4735) trvSvc.addTravelPoint(planet, "Tyrena Starport", -4975, 21, -2230) trvSvc.addTravelPoint(planet, "Kor Vella Starport", -3136, 31, 2894) - trvSvc.addTravelPoint(planet, "Doaba Guerful Starport", 3377, 308, 5605) + trvSvc.addTravelPoint(planet, "Doaba Guerfel Starport", 3377, 308, 5605) return def dantooinePoints(core, planet): trvSvc = core.travelService - - trvSvc.addTravelPoint(planet, "Coronet Starport", -51, 28, -4735) - trvSvc.addTravelPoint(planet, "Tyrena Starport", -4975, 21, -2230) - trvSvc.addTravelPoint(planet, "Kor Vella Starport", -3136, 31, 2894) - trvSvc.addTravelPoint(planet, "Doaba Guerful Starport", 3377, 308, 5605) + + trvSvc.addTravelPoint(planet, "Imperial Outpost", -635, 3, 2507) + trvSvc.addTravelPoint(planet, "Mining Outpost", -4208, 3, -2350) + trvSvc.addTravelPoint(planet, "Agro Outpost", 1569, 4, -6415) return def dathomirPoints(core, planet): trvSvc = core.travelService - trvSvc.addTravelPoint(planet, "Science Outpost", -76, 18, -1586) - trvSvc.addTravelPoint(planet, "Trade Outpost", -592, 6, 3087) + trvSvc.addTravelPoint(planet, "Science Outpost", -49, 18, -1584) + trvSvc.addTravelPoint(planet, "Trade Outpost", 618, 6, 3092) + trvSvc.addTravelPoint(planet, "Quarantine Zone", -5691, 511, -6467) return def endorPoints(core, planet): trvSvc = core.travelService - trvSvc.addTravelPoint(planet, "Smuggler Outpost", -978, 73, 1554) - trvSvc.addTravelPoint(planet, "Research Outpost", 3222, 24, -3482) + trvSvc.addTravelPoint(planet, "Smuggler Outpost", -950, 73, 1553) + trvSvc.addTravelPoint(planet, "Research Outpost", 3201, 24, -3499) return def lokPoints(core, planet): @@ -66,23 +79,38 @@ def nabooPoints(core, planet): trvSvc = core.travelService trvSvc.addTravelPoint(planet, "Kaadara Starport", 5295, -192, 6664) + trvSvc.addTravelPoint(planet, "Kaadara Shuttleport", 5123, -192, 6616) + trvSvc.addTravelPoint(planet, "Dee'ja Peak Shuttleport", 5331, 327, -1576) + trvSvc.addTravelPoint(planet, "Moenia Shuttleport", 4961, 3, -4892) + trvSvc.addTravelPoint(planet, "Lake Retreat Shuttleport", -5494, -150, -21) + trvSvc.addTravelPoint(planet, "Keren Shuttleport", 2021, 19, 2525) + trvSvc.addTravelPoint(planet, "Keren Shuttleport South", 1567, 25, 2837) trvSvc.addTravelPoint(planet, "Keren Starport", 1352, 13, 2768) trvSvc.addTravelPoint(planet, "Moenia Starport", 4728, 4, -4650) + trvSvc.addTravelPoint(planet, "Theed Shuttle A", -5856, 19, 4172) + trvSvc.addTravelPoint(planet, "Theed Shuttle B", -5005, 19, 4072) + trvSvc.addTravelPoint(planet, "Theed Shuttle C", -5411, 19, 4332) + trvSvc.addTravelPoint(planet, "Theed Spaceport", -4858, 5, 4164) return def roriPoints(core, planet): trvSvc = core.travelService - trvSvc.addTravelPoint(planet, "Narmle Starport", -5472, 80, 2161) + trvSvc.addTravelPoint(planet, "Narmle Starport", -5374, 80, -2188) + trvSvc.addTravelPoint(planet, "Narmle Shuttleport", -5255, 80, -2161) trvSvc.addTravelPoint(planet, "Rebel Outpost", 3672, 96, -6421) + trvSvc.addTravelPoint(planet, "Restuss Starport", 5281, 80, 6171) + trvSvc.addTravelPoint(planet, "Restuss Shuttleport", 5398, 80, 6195) return def talusPoints(core, planet): trvSvc = core.travelService - trvSvc.addTravelPoint(planet, "Dearic Starport", 245, 6, -2931) - trvSvc.addTravelPoint(planet, "Nashal Starport", 4480, 2, 6365) - trvSvc.addTravelPoint(planet, "Imperial Outpost", -2212, 20, 2302) + trvSvc.addTravelPoint(planet, "Dearic Starport", 263, 6, -2952) + trvSvc.addTravelPoint(planet, "Dearic Shuttleport", 699, 6, -3041) + trvSvc.addTravelPoint(planet, "Nashal Starport", 4453, 2, 5354) + trvSvc.addTravelPoint(planet, "Nashal Shuttleport", 4334, 9, 5431) + trvSvc.addTravelPoint(planet, "Imperial Outpost", -2226, 20, 2319) return def tatooinePoints(core, planet): @@ -92,12 +120,12 @@ def tatooinePoints(core, planet): trvSvc.addTravelPoint(planet, "Mos Eisley Starport", 3619, 5, -4801) trvSvc.addTravelPoint(planet, "Mos Espa Starport", -2829, 5, 2080) trvSvc.addTravelPoint(planet, "Mos Entha Starport", 1238, 7, 3062) - trvSvc.addTravelPoint(planet, "Anchorhead Shuttleport", 48, 52, -5319) + trvSvc.addTravelPoint(planet, "Anchorhead Shuttle", 48, 52, -5319) trvSvc.addTravelPoint(planet, "Mos Entha Shuttleport A", 1731, 7, 3205) trvSvc.addTravelPoint(planet, "Mos Entha Shuttleport B", 1396, 7, 3487) - trvSvc.addTravelPoint(planet, "Mos Espa Shuttleport A", -3132, 5, 2172) - trvSvc.addTravelPoint(planet, "Mos Espa Shuttleport B", -2799, 5, 2163) - trvSvc.addTravelPoint(planet, "Mos Espa Shuttleport C", -2892, 5, 1914) + trvSvc.addTravelPoint(planet, "Mos Espa Shuttle West", -3132, 5, 2172) + trvSvc.addTravelPoint(planet, "Mos Espa Shuttle East", -2799, 5, 2163) + trvSvc.addTravelPoint(planet, "Mos Espa Shuttle South", -2892, 5, 1914) trvSvc.addTravelPoint(planet, "Mos Eisley Shuttleport", 3434, 5, -4659) trvSvc.addTravelPoint(planet, "Bestine Shuttleport", -1071, 12, -3566) trvSvc.addTravelPoint(planet, "Wayfar Shuttleport", -5089, 75, -6594) @@ -106,7 +134,19 @@ def tatooinePoints(core, planet): def yavin4Points(core, planet): trvSvc = core.travelService - trvSvc.addTravelPoint(planet, "Imperial Base", 4033, 37, -6234) - trvSvc.addTravelPoint(planet, "Labor Outpost", -6939, 73, -5706) - trvSvc.addTravelPoint(planet, "Mining Outpost", -277, 35, 4879) - return \ No newline at end of file + trvSvc.addTravelPoint(planet, "Imperial Base", 4054, 37, -6216) + trvSvc.addTravelPoint(planet, "Labor Outpost", -6921, 73, -5726) + trvSvc.addTravelPoint(planet, "Mining Outpost", -267, 35, 4896) + return + +def kashyyyk_mainPoints(core, planet): + trvSvc = core.travelService + + trvSvc.addTravelPoint(planet, "Kachirho Starport", -688, 19, -165) + return + +def mustafarPoints(core, planet): + trvSvc = core.travelService + + trvSvc.addTravelPoint(planet, "Mensix Mining Facility", 405, 230, -1352) + return \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 266f4cb9..6bb81a11 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -28,14 +28,14 @@ import java.util.HashMap; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import org.apache.mina.core.service.IoHandler; - - - - - - +import net.engio.mbassy.bus.config.BusConfiguration; import resources.common.RadialOptions; import resources.common.ThreadMonitor; import resources.objects.creature.CreatureObject; @@ -47,6 +47,7 @@ import services.EntertainmentService; import services.EquipmentService; import services.GroupService; import services.LoginService; +import services.MissionService; import services.PlayerService; import services.ScriptService; import services.SimulationService; @@ -55,16 +56,20 @@ import services.SkillService; import services.StaticService; import services.TerrainService; import services.WeatherService; +import services.ai.AIService; import services.chat.ChatService; +import services.collections.CollectionService; import services.combat.CombatService; import services.command.CombatCommand; import services.command.CommandService; +import services.gcw.FactionService; import services.gcw.GCWService; import services.guild.GuildService; import services.LoginService; import services.map.MapService; import services.object.ObjectService; import services.object.UpdateService; +import services.spawn.SpawnService; import services.sui.SUIService; import services.trade.TradeService; import services.travel.TravelService; @@ -116,6 +121,7 @@ public class NGECore { public ConnectionService connectionService; public CommandService commandService; public CharacterService characterService; + public FactionService factionService; public ObjectService objectService; public MapService mapService; public UpdateService updateService; @@ -137,8 +143,12 @@ public class NGECore { public SkillModService skillModService; public EquipmentService equipmentService; public TravelService travelService; + public CollectionService collectionService; public EntertainmentService entertainmentService; public WeatherService weatherService; + public SpawnService spawnService; + public AIService aiService; + //public MissionService missionService; // Login Server public NetworkDispatch loginDispatch; @@ -154,6 +164,8 @@ public class NGECore { private ObjectDatabase creatureODB; private ObjectDatabase mailODB; + + private BusConfiguration eventBusConfig = BusConfiguration.Default(1, new ThreadPoolExecutor(1, 4, 1, TimeUnit.MINUTES, new LinkedBlockingQueue())); public NGECore() { @@ -203,7 +215,8 @@ public class NGECore { characterService = new CharacterService(this); mapService = new MapService(this); travelService = new TravelService(this); - + + factionService = new FactionService(this); objectService = new ObjectService(this); terrainService = new TerrainService(this); updateService = new UpdateService(this); @@ -232,6 +245,9 @@ public class NGECore { jythonServer.start(); } } + spawnService = new SpawnService(this); + aiService = new AIService(this); + //missionService = new MissionService(this); // Ping Server try { @@ -252,6 +268,7 @@ public class NGECore { zoneDispatch = new NetworkDispatch(this, true); zoneDispatch.addService(connectionService); zoneDispatch.addService(characterService); + zoneDispatch.addService(factionService); zoneDispatch.addService(objectService); zoneDispatch.addService(commandService); zoneDispatch.addService(chatService); @@ -261,6 +278,7 @@ public class NGECore { zoneDispatch.addService(playerService); zoneDispatch.addService(buffService); zoneDispatch.addService(entertainmentService); + //zoneDispatch.addService(missionService); zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT")); zoneServer.start(); @@ -279,6 +297,7 @@ 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); + terrainService.loadClientPois(); // Travel Points travelService.loadTravelPoints(); simulationService = new SimulationService(this); @@ -298,13 +317,16 @@ public class NGECore { gcwService = new GCWService(this); zoneDispatch.addService(gcwService); + + collectionService = new CollectionService(this); + zoneDispatch.addService(collectionService); tradeService = new TradeService(this); zoneDispatch.addService(tradeService); zoneDispatch.addService(skillService); - travelService.startShuttleSchedule(); + //travelService.startShuttleSchedule(); weatherService = new WeatherService(this); weatherService.loadPlanetSettings(); @@ -313,7 +335,7 @@ public class NGECore { didServerCrash = false; System.out.println("Started Server."); setGalaxyStatus(2); - + } public void stop() { @@ -454,5 +476,10 @@ public class NGECore { public static NGECore getInstance() { return instance; } + + public BusConfiguration getEventBusConfig() { + return eventBusConfig; + } + } diff --git a/src/protocol/swg/AddIgnoreMessage.java b/src/protocol/swg/AddIgnoreMessage.java new file mode 100644 index 00000000..44455a1c --- /dev/null +++ b/src/protocol/swg/AddIgnoreMessage.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg; + +import java.nio.ByteOrder; + +import main.NGECore; + +import org.apache.mina.core.buffer.IoBuffer; + +import engine.resources.config.Config; +import engine.resources.config.DefaultConfig; +import engine.resources.objects.SWGObject; + +public class AddIgnoreMessage extends SWGMessage { + + private SWGObject player; + private boolean type; + private String ignoreName; + + public AddIgnoreMessage(SWGObject obj, String name, boolean type) { + this.player = obj; + this.ignoreName = name; + this.type = type; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + Config config = NGECore.getInstance().getConfig(); + String server = config.getProperty("GALAXY_NAME"); + + IoBuffer result = IoBuffer.allocate(34 + server.length() + ignoreName.length()).order(ByteOrder.LITTLE_ENDIAN); + + result.putShort((short) 6); + result.putInt(0x70E9DA0F); + result.putLong(player.getObjectId()); + + result.put(getAsciiString("SWG")); + result.put(getAsciiString(server)); + result.put(getAsciiString(ignoreName)); + + result.putInt(0); + result.put((byte) ((type) ? 1 : 0)); // add = T, remove = F + result.putInt(0); + + return result.flip(); + } + +} diff --git a/src/protocol/swg/ChatOnAddFriend.java b/src/protocol/swg/ChatOnAddFriend.java index be805945..0b84e6ff 100644 --- a/src/protocol/swg/ChatOnAddFriend.java +++ b/src/protocol/swg/ChatOnAddFriend.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ package protocol.swg; import java.nio.ByteOrder; diff --git a/src/protocol/swg/ChatOnChangeFriendStatus.java b/src/protocol/swg/ChatOnChangeFriendStatus.java index 5eeb3f33..c93e5265 100644 --- a/src/protocol/swg/ChatOnChangeFriendStatus.java +++ b/src/protocol/swg/ChatOnChangeFriendStatus.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ package protocol.swg; import java.nio.ByteOrder; @@ -28,12 +49,9 @@ public class ChatOnChangeFriendStatus extends SWGMessage { @Override public IoBuffer serialize() { - Config config = new Config(); - config.setFilePath("nge.cfg"); - if (!(config.loadConfigFile())) { - config = DefaultConfig.getConfig(); - } + Config config = NGECore.getInstance().getConfig(); String server = config.getString("GALAXY_NAME"); + IoBuffer result = IoBuffer.allocate(100 + this.name.length() + server.length()).order(ByteOrder.LITTLE_ENDIAN); result.putShort((short)0x06); result.putInt(0x54336726); diff --git a/src/protocol/swg/EnterTicketPurchaseModeMessage.java b/src/protocol/swg/EnterTicketPurchaseModeMessage.java index d5d8d02c..04cec6fb 100644 --- a/src/protocol/swg/EnterTicketPurchaseModeMessage.java +++ b/src/protocol/swg/EnterTicketPurchaseModeMessage.java @@ -51,7 +51,7 @@ public class EnterTicketPurchaseModeMessage extends SWGMessage { public IoBuffer serialize() { final NGECore core = NGECore.getInstance(); TravelPoint nearestPoint = core.travelService.getNearestTravelPoint(player); - IoBuffer result = IoBuffer.allocate(20 + planetName.length() + nearestPoint.getName().length()).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer result = IoBuffer.allocate(11 + planetName.length() + nearestPoint.getName().length()).order(ByteOrder.LITTLE_ENDIAN); result.putShort((short) 3); result.putInt(0x904DAE1A); @@ -59,6 +59,8 @@ public class EnterTicketPurchaseModeMessage extends SWGMessage { result.put(getAsciiString(planetName)); result.put(getAsciiString(nearestPoint.getName())); + result.put((byte) 0); + return result.flip(); } diff --git a/src/protocol/swg/FactionResponseMessage.java b/src/protocol/swg/FactionResponseMessage.java new file mode 100644 index 00000000..ad9f85e9 --- /dev/null +++ b/src/protocol/swg/FactionResponseMessage.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg; + +import java.nio.ByteOrder; +import java.util.Map; +import java.util.TreeMap; + +import org.apache.mina.core.buffer.IoBuffer; + +import resources.common.Opcodes; + +public class FactionResponseMessage extends SWGMessage { + + private Map factionStandingMap; + private int factionRank = 0; + private int rebelPoints = 0; + private int imperialPoints = 0; + + public FactionResponseMessage(Map factionStandingMap, int factionRank) { + this.factionStandingMap = new TreeMap(); + this.factionStandingMap.putAll(factionStandingMap); + this.factionRank = factionRank; + + if (this.factionStandingMap.containsKey("rebel")) { + this.rebelPoints = this.factionStandingMap.get("rebel"); + } + + if (this.factionStandingMap.containsKey("imperial")) { + this.imperialPoints = this.factionStandingMap.get("imperial"); + } + } + + public void deserialize(IoBuffer data) { + + } + + public IoBuffer serialize() { + IoBuffer result = IoBuffer.allocate(26).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + result.putShort((short) 2); + result.putInt(Opcodes.FactionResponseMessage); + result.putInt(factionRank); + result.putInt(rebelPoints); + result.putInt(imperialPoints); + result.putInt(factionStandingMap.size()); + for (String faction : factionStandingMap.keySet()) { + result.put(getAsciiString(faction)); + } + result.putInt(factionStandingMap.size()); + for (Integer points : factionStandingMap.values()) { + result.putInt(points); + } + + return result.flip(); + } + +} diff --git a/src/protocol/swg/PlanetTravelPointListResponse.java b/src/protocol/swg/PlanetTravelPointListResponse.java index 46d37683..4bd409b9 100644 --- a/src/protocol/swg/PlanetTravelPointListResponse.java +++ b/src/protocol/swg/PlanetTravelPointListResponse.java @@ -35,12 +35,10 @@ public class PlanetTravelPointListResponse extends SWGMessage { private String planetString; private Vector travelPoints; - private List planetList; - public PlanetTravelPointListResponse(String planetString, Vector travelPoints, List planetList) { + public PlanetTravelPointListResponse(String planetString, Vector travelPoints) { this.planetString = planetString; this.travelPoints = travelPoints; - this.planetList = planetList; } @Override @@ -50,7 +48,7 @@ public class PlanetTravelPointListResponse extends SWGMessage { @Override public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(travelPoints.size() * 2).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); result.setAutoExpand(true); result.putShort((short) 6); @@ -81,8 +79,9 @@ public class PlanetTravelPointListResponse extends SWGMessage { for (TravelPoint point : travelPoints) { result.put((byte) 1); // isReachable } - result.flip(); - return result; + int size = result.position(); + result = IoBuffer.allocate(size).put(result.array(), 0, size); + return result.flip(); } } diff --git a/src/protocol/swg/UpdateCellPermissionMessage.java b/src/protocol/swg/UpdateCellPermissionMessage.java index fe35f240..943eb532 100644 --- a/src/protocol/swg/UpdateCellPermissionMessage.java +++ b/src/protocol/swg/UpdateCellPermissionMessage.java @@ -42,13 +42,13 @@ public class UpdateCellPermissionMessage extends SWGMessage { } public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(128).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer result = IoBuffer.allocate(15).order(ByteOrder.LITTLE_ENDIAN); result.putShort((short)3); result.putInt(0xF612499C); result.put(permission); result.putLong(cellId); - return result; + return result.flip(); } } diff --git a/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java b/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java index cbe6ce87..a877944a 100644 --- a/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java +++ b/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java @@ -64,9 +64,10 @@ public class BuffBuilderChangeMessage extends ObjControllerObject { item.setInvested(investedPoints); int maxAmount = buffer.getInt(); - item.setAmount(maxAmount); + item.setBonusAmount(maxAmount); statBuffs.add(item); + System.out.println("Added buff item with " + investedPoints + " invested points " + " which has a bonus amount of " + maxAmount); } } @@ -95,7 +96,7 @@ public class BuffBuilderChangeMessage extends ObjControllerObject { for (BuffItem item : statBuffs) { result.put(getAsciiString(item.getSkillName())); result.putInt(item.getInvested()); - result.putInt(item.getAmount()); + result.putInt(item.getBonusAmount()); } } diff --git a/src/protocol/swg/objectControllerObjects/CommandEnqueue.java b/src/protocol/swg/objectControllerObjects/CommandEnqueue.java index 40b228a6..bb1705a4 100644 --- a/src/protocol/swg/objectControllerObjects/CommandEnqueue.java +++ b/src/protocol/swg/objectControllerObjects/CommandEnqueue.java @@ -39,6 +39,15 @@ public class CommandEnqueue extends ObjControllerObject { public static final int STAND = 0xA8A25C79; public static final int ATTACK = 0xA8FEF90A; public static final int TRANSFERITEM = 0x3CFB449D; + + //ent + // this really needed? + public static final int STARTDANCE = 0x7B1DCBE0; + public static final int STOPDANCE = 0xECC171CC; + public static final int FLOURISH = 0xC8998CE9; + public static final int FLO = 0x3B159B76; + public static final int BANDFLOURISH = 0xF4C60EC3; + public static final int BANDFLO = 0xDD3FB008; private int actionCounter; private int commandCRC; diff --git a/src/protocol/swg/objectControllerObjects/MissionListRequest.java b/src/protocol/swg/objectControllerObjects/MissionListRequest.java new file mode 100644 index 00000000..7fbe2d02 --- /dev/null +++ b/src/protocol/swg/objectControllerObjects/MissionListRequest.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * 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 org.apache.mina.core.buffer.IoBuffer; + +import protocol.swg.ObjControllerMessage; +import resources.common.Console; +import resources.common.StringUtilities; + +public class MissionListRequest extends ObjControllerObject { + + private long objectId; + private long terminalId; + private int tickCount; + + @Override + public void deserialize(IoBuffer data) { + Console.println("MissionListRequest: " + StringUtilities.bytesToHex(data.array())); + setObjectId(data.getLong()); + data.getInt(); // unk + data.get(); // unk byte + setTickCount(data.get()); + setTerminalId(data.getLong()); + } + + @Override + public IoBuffer serialize() { + return null; + } + + public long getObjectId() { + return objectId; + } + + public void setObjectId(long objectId) { + this.objectId = objectId; + } + + public long getTerminalId() { + return terminalId; + } + + public void setTerminalId(long terminalId) { + this.terminalId = terminalId; + } + + public int getTickCount() { + return tickCount; + } + + public void setTickCount(int tickCount) { + this.tickCount = tickCount; + } + +} diff --git a/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java b/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java index b4450dc9..1d1ae2c5 100644 --- a/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java +++ b/src/protocol/swg/objectControllerObjects/ObjectMenuResponse.java @@ -73,12 +73,13 @@ public class ObjectMenuResponse extends ObjControllerObject { result.putInt(size); if(size > 0) { - byte counter = 1; + byte counter = 0; for(RadialOptions radialOption : radialOptions) { - result.put(counter++); + result.put(++counter); result.put(radialOption.getParentId()); result.putShort(radialOption.getOptionId()); - result.put(radialOption.getOptionType()); + //result.put(radialOption.getOptionType()); + result.put((byte) 3); if(radialOption.getDescription().length() > 0) result.put(getUnicodeString(radialOption.getDescription())); @@ -87,7 +88,6 @@ public class ObjectMenuResponse extends ObjControllerObject { } } - result.put(radialCount); int packetSize = result.position(); diff --git a/src/protocol/swg/objectControllerObjects/ShowFlyText.java b/src/protocol/swg/objectControllerObjects/ShowFlyText.java index b4f73d31..41325368 100644 --- a/src/protocol/swg/objectControllerObjects/ShowFlyText.java +++ b/src/protocol/swg/objectControllerObjects/ShowFlyText.java @@ -38,11 +38,12 @@ public class ShowFlyText extends ObjControllerObject { private int unknownInt2; private String stfFile; private String stfString; - private short unknownShort2; + private short xp; private float scale; private RGB color; private int displayType; private boolean alternativeStructure; + private String customText; public ShowFlyText(long recieverId, long objectId, String stfFile, String stfString, float scale, RGB color, int displayType) { this.recieverId = recieverId; @@ -55,7 +56,7 @@ public class ShowFlyText extends ObjControllerObject { this.alternativeStructure = false; } - public ShowFlyText(long recieverId, long objectId, int unknownInt1, int unknownShort1, int unknownByte1, int unknownInt2, String stfFile, String stfString, int unknownShort2, float scale, RGB color, int displayType) { + public ShowFlyText(long recieverId, long objectId, int unknownInt1, int unknownShort1, int unknownByte1, int unknownInt2, String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType) { this.recieverId = recieverId; this.objectId = objectId; this.unknownInt1 = unknownInt1; @@ -64,7 +65,8 @@ public class ShowFlyText extends ObjControllerObject { this.unknownInt2 = unknownInt2; this.stfFile = stfFile; this.stfString = stfString; - this.unknownShort2 = (short) unknownShort2; + this.customText = customText; + this.xp = (short) xp; this.scale = scale; this.color = color; this.alternativeStructure = true; @@ -115,8 +117,8 @@ public class ShowFlyText extends ObjControllerObject { result.putLong(0); result.putLong(0); result.putLong(0); - result.putInt(0); - result.putShort((short) unknownShort2); + result.put(getUnicodeString(customText)); + result.putShort(xp); result.putLong(0); result.putFloat(scale); result.put(color.getBytes()); diff --git a/src/resources/common/BuffBuilder.java b/src/resources/common/BuffBuilder.java index e372c58c..c376ae5a 100644 --- a/src/resources/common/BuffBuilder.java +++ b/src/resources/common/BuffBuilder.java @@ -54,7 +54,9 @@ public class BuffBuilder { } public int getTotalAffected() { - int totalAffected = getMaxTimesApplied() + getAffectAmount(); + // 10 * 10 = 100 + int totalAffected = getMaxTimesApplied() * getAffectAmount(); + Console.println("Total Affected: " + totalAffected + getEntBonus()); return totalAffected + getEntBonus(); } diff --git a/src/resources/common/Difficulty.java b/src/resources/common/Difficulty.java new file mode 100644 index 00000000..e1229723 --- /dev/null +++ b/src/resources/common/Difficulty.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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 Difficulty { + + public static byte NORMAL = 0; // Normal + public static byte ELITE = 1; // Elite + public static byte BOSS = 2; // Gold elite + +} diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 9e66c155..551857d9 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -26,10 +26,11 @@ public class ObjControllerOpcodes { public static final int DATA_TRANSFORM = 0x71000000; public static final int DATA_TRANSFORM_WITH_PARENT = 0xF1000000; public static final int COMMAND_QUEUE_ENQUEUE = 0x16010000; - public static final int TARGET_UPDATE = 0x26010000; + public static final int HOVER_TARGET = 0x26010000; + public static final int TARGET_UPDATE = 0xC5040000; public static final int OBJECT_MENU_REQUEST = 0x46010000; public static final int SECURE_TRADE = 0x15010000; - public static final int USE_OBJECT = 0xC5040000; public static final int BUFF_BUILDER_CHANGE = 0x5A020000; + public static final int MISSION_LIST_REQUEST = 0xF5000000; } diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index 670abfde..5d03db30 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -55,5 +55,7 @@ public class Opcodes { public static int ClientMfdStatusUpdateMessage = CRC.StringtoCRC("ClientMdfStatusUpdateMessage"); public static int PlayMusicMessage = CRC.StringtoCRC("PlayMusicMessage"); public static int PlanetTravelPointListRequest = 0x96405D4D; + public static int FactionRequestMessage = CRC.StringtoCRC("FactionRequestMessage"); + public static int FactionResponseMessage = CRC.StringtoCRC("FactionResponseMessage"); } diff --git a/src/resources/common/Options.java b/src/resources/common/Options.java new file mode 100644 index 00000000..5b8faa0e --- /dev/null +++ b/src/resources/common/Options.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * 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 Options { + + // Any uncommented ones are confirmed correct for NGE with detailed analysis + + public static int NONE = 0; // HAM is visible, but health is grey without the Attackable flag + public static int SPACE_ATTACKABLE = 1; // Ships that are attackable in space. Includes everything except stations and asteroids so far + public static int USABLE = 2; // Vendors, collections (hand icon) + public static int INSURED = 4; // Unused in NGE + public static int CONVERSABLE = 8; // Conversable on ground / commable in space + //public static int FOLLOWINGWAYPOINT = 16; // Uncertain, could be "frozen" flag or "alert" flag or other. Seen on rare occasions on NPCs + public static int SOCKETED = 32; // Object has sockets + public static int AGGRESSIVE = 64; // Always aggressive no matter what regardless of faction standing. + public static int ATTACKABLE = 128; // Attackable + public static int INVULNERABLE = 256; // No HAM + public static int DISABLED = 512; // Disabled Vehicle + //public static int CRAFTED = 1024; // Wearable TANO objects. Isn't used for WEAOs (weapons), it's just for identifying if a TANO is a wearable probably as that's where this is seen. Also seen on naboo small house deed however... Could also be "crafted items" + public static int QUEST = 2048; // Quest icon + public static int MOUNT = 4096; // Vehicle and creature mounts + public static int SERIAL = 8192; // Has serial number + //public static int UNKNOWN = 16384; // Seen being requested by the client in objcontroller 0x02AB but probably not relevant + public static int PILOT = 32768; // Pilot trainers, chassis dealers + //public static int UNKNOWN = 65536; + //public static int UNKNOWN = 131072; + //public static int UNKNOWN = 262144; + //public static int UNKNOWN = 524288; + //public static int UNKNOWN = 1048576; + //public static int UNKNOWN = 2097152; + //public static int UNKNOWN = 4194304; + public static int STARTER_SHIP = 8388508; // Seen on player scyk fighters, but no others. Could also mean SPACE_OVERT + +} diff --git a/src/resources/common/Performance.java b/src/resources/common/Performance.java new file mode 100644 index 00000000..9100e2f2 --- /dev/null +++ b/src/resources/common/Performance.java @@ -0,0 +1,254 @@ +package resources.common; + +public class Performance { + + + private String performanceName; + private int instrumentAudioId; + private String requiredSong; + private String requiredInstrument; + private String requiredDance; + private int danceVisualId; + private int actionPointsPerLoop; + private float loopDuration; + private int type; + private int baseXp; + private int flourishXpMod; + private int healMindWound; + private int healShockWound; + private String requiredSkillMod; + private int requiredSkillModValue; + private String mainloop; + private String flourish1; + private String flourish2; + private String flourish3; + private String flourish4; + private String flourish5; + private String flourish6; + private String flourish7; + private String flourish8; + private String intro; + private String outro; + private int lineNumber; + + public Performance() { + + } + + public int getBaseXp() { + return baseXp; + } + + public void setBaseXp(int baseXp) { + this.baseXp = baseXp; + } + + public String getPerformanceName() { + return performanceName; + } + + public void setPerformanceName(String performanceName) { + this.performanceName = performanceName; + } + + public int getInstrumentAudioId() { + return instrumentAudioId; + } + + public void setInstrumentAudioId(int instrumentAudioId) { + this.instrumentAudioId = instrumentAudioId; + } + + public int getRequiredSkillModValue() { + return requiredSkillModValue; + } + + public void setRequiredSkillModValue(int requiredSkillModValue) { + this.requiredSkillModValue = requiredSkillModValue; + } + + public String getRequiredSong() { + return requiredSong; + } + + public void setRequiredSong(String requiredSong) { + this.requiredSong = requiredSong; + } + + public String getRequiredInstrument() { + return requiredInstrument; + } + + public void setRequiredInstrument(String requiredInstrument) { + this.requiredInstrument = requiredInstrument; + } + + public String getRequiredDance() { + return requiredDance; + } + + public void setRequiredDance(String requiredDance) { + this.requiredDance = requiredDance; + } + + public int getDanceVisualId() { + return danceVisualId; + } + + public void setDanceVisualId(int danceVisualId) { + this.danceVisualId = danceVisualId; + } + + public int getActionPointsPerLoop() { + return actionPointsPerLoop; + } + + public void setActionPointsPerLoop(int actionPointsPerLoop) { + this.actionPointsPerLoop = actionPointsPerLoop; + } + + public float getLoopDuration() { + return loopDuration; + } + + public void setLoopDuration(float loopDuration) { + this.loopDuration = loopDuration; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getFlourishXpMod() { + return flourishXpMod; + } + + public void setFlourishXpMod(int flourishXpMod) { + this.flourishXpMod = flourishXpMod; + } + + public int getHealMindWound() { + return healMindWound; + } + + public void setHealMindWound(int healMindWound) { + this.healMindWound = healMindWound; + } + + public int getHealShockWound() { + return healShockWound; + } + + public int getLineNumber() { + return lineNumber; + } + + public void setHealShockWound(int healShockWound) { + this.healShockWound = healShockWound; + } + + public String getRequiredSkillMod() { + return requiredSkillMod; + } + + public void setRequiredSkillMod(String requiredSkillMod) { + this.requiredSkillMod = requiredSkillMod; + } + + public String getMainloop() { + return mainloop; + } + + public void setMainloop(String mainloop) { + this.mainloop = mainloop; + } + + public String getFlourish1() { + return flourish1; + } + + public void setFlourish1(String flourish1) { + this.flourish1 = flourish1; + } + + public String getFlourish2() { + return flourish2; + } + + public void setFlourish2(String flourish2) { + this.flourish2 = flourish2; + } + + public String getFlourish3() { + return flourish3; + } + + public void setFlourish3(String flourish3) { + this.flourish3 = flourish3; + } + + public String getFlourish4() { + return flourish4; + } + + public void setFlourish4(String flourish4) { + this.flourish4 = flourish4; + } + + public String getFlourish5() { + return flourish5; + } + + public void setFlourish5(String flourish5) { + this.flourish5 = flourish5; + } + + public String getFlourish6() { + return flourish6; + } + + public void setFlourish6(String flourish6) { + this.flourish6 = flourish6; + } + + public String getFlourish7() { + return flourish7; + } + + public void setFlourish7(String flourish7) { + this.flourish7 = flourish7; + } + + public String getFlourish8() { + return flourish8; + } + + public void setFlourish8(String flourish8) { + this.flourish8 = flourish8; + } + + public String getIntro() { + return intro; + } + + public void setIntro(String intro) { + this.intro = intro; + } + + public String getOutro() { + return outro; + } + + public void setOutro(String outro) { + this.outro = outro; + } + + public void setLineNumber(int lineNumber) { + this.lineNumber = lineNumber; + } + +} diff --git a/src/resources/common/PvpStatus.java b/src/resources/common/PvpStatus.java index 18365a58..e668ba56 100644 --- a/src/resources/common/PvpStatus.java +++ b/src/resources/common/PvpStatus.java @@ -23,6 +23,7 @@ package resources.common; public class PvpStatus { + public static int None = 0; public static int Attackable = 1; public static int Aggressive = 2; public static int Overt = 4; @@ -30,7 +31,7 @@ public class PvpStatus { public static int Player = 16; public static int Enemy = 32; public static int GoingOvert = 64; - public static int GoingCombatant = 128; + public static int GoingCovert = 128; public static int Dueling = 256; } diff --git a/src/resources/common/StateStatus.java b/src/resources/common/StateStatus.java index e4039a46..e97026c7 100644 --- a/src/resources/common/StateStatus.java +++ b/src/resources/common/StateStatus.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * 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 StateStatus { diff --git a/src/resources/common/TerminalType.java b/src/resources/common/TerminalType.java new file mode 100644 index 00000000..375d1e61 --- /dev/null +++ b/src/resources/common/TerminalType.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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 TerminalType { + public static int MISSION_GENERIC = 1; + public static int MISSION_BOUNTYHUNTER = 2; + public static int MISSION_ENTERTAINER = 3; + public static int MISSION_ARTISAN = 4; + public static int MISSION_EXPLORER = 5; +} diff --git a/src/resources/common/collidables/AbstractCollidable.java b/src/resources/common/collidables/AbstractCollidable.java new file mode 100644 index 00000000..443903b7 --- /dev/null +++ b/src/resources/common/collidables/AbstractCollidable.java @@ -0,0 +1,110 @@ +/******************************************************************************* + * 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.collidables; + +import java.util.Vector; + +import main.NGECore; +import net.engio.mbassy.bus.SyncMessageBus; + +import org.python.core.Py; +import org.python.core.PyObject; + +import engine.resources.common.Event; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; + +public abstract class AbstractCollidable { + + private PyObject callback; + public Vector collidedObjects = new Vector(); + private Planet planet; + private SyncMessageBus eventBus = new SyncMessageBus(NGECore.getInstance().getEventBusConfig()); + + public abstract boolean doesCollide(SWGObject obj); + public abstract boolean doesCollide(Point3D position); + + public PyObject getCallback() { + return callback; + } + + public void setCallback(PyObject callback) { + this.callback = callback; + } + + public void addCollidedObject(SWGObject obj) { + collidedObjects.add(obj); + EnterEvent event = new EnterEvent(); + event.object = obj; + eventBus.publish(event); + } + + public void removeCollidedObject(SWGObject obj) { + collidedObjects.remove(obj); + ExitEvent event = new ExitEvent(); + event.object = obj; + eventBus.publish(event); + } + + public boolean isInCollisionList(SWGObject obj) { + return collidedObjects.contains(obj); + } + + public void doCollisionCheck(SWGObject obj) { + // check if already collided + if(isInCollisionList(obj) && doesCollide(obj)) { + return; + } else if(isInCollisionList(obj) && !doesCollide(obj)) { + removeCollidedObject(obj); + } else if(doesCollide(obj) && !isInCollisionList(obj)) { + addCollidedObject(obj); + if(getCallback() != null) + getCallback().__call__(Py.java2py(NGECore.getInstance()), Py.java2py(obj), Py.java2py(this)); + } + } + + public Planet getPlanet() { + return planet; + } + + public void setPlanet(Planet planet) { + this.planet = planet; + } + + public SyncMessageBus getEventBus() { + return eventBus; + } + + public class EnterEvent implements Event { + public SWGObject object; + } + + public class ExitEvent implements Event { + public SWGObject object; + } + + public abstract Point3D getRandomPosition(Point3D origin, float minDistance, float maxDistance); + public abstract Point3D getRandomPosition(); + + +} diff --git a/src/resources/common/collidables/CollidableBox.java b/src/resources/common/collidables/CollidableBox.java new file mode 100644 index 00000000..4fd64080 --- /dev/null +++ b/src/resources/common/collidables/CollidableBox.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.collidables; + +public class CollidableBox { + + + +} diff --git a/src/resources/common/collidables/CollidableCircle.java b/src/resources/common/collidables/CollidableCircle.java new file mode 100644 index 00000000..fef3eacc --- /dev/null +++ b/src/resources/common/collidables/CollidableCircle.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * 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.collidables; + +import java.util.Random; + +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; + +public class CollidableCircle extends AbstractCollidable { + + private Point3D center; + private float radius; + // for bh traps + private boolean useYAxis = false; + + public CollidableCircle(Point3D center, float radius, Planet planet) { + this.setCenter(center); + this.setRadius(radius); + this.setPlanet(planet); + } + + public Point3D getCenter() { + return center; + } + + public void setCenter(Point3D center) { + this.center = center; + } + + public float getRadius() { + return radius; + } + + public void setRadius(float radius) { + this.radius = radius; + } + + public boolean isUseYAxis() { + return useYAxis; + } + + public void setUseYAxis(boolean useYAxis) { + this.useYAxis = useYAxis; + } + + @Override + public boolean doesCollide(SWGObject obj) { + Point3D objectPos = obj.getWorldPosition(); + if(useYAxis) { + return center.getDistance(objectPos) <= radius && objectPos.y == center.y; + } else { + return center.getDistance(objectPos) <= radius; + } + } + + @Override + public boolean doesCollide(Point3D position) { + if(useYAxis) { + return center.getDistance(position) <= radius && position.y == center.y; + } else { + return center.getDistance(position) <= radius; + } + } + + @Override + public Point3D getRandomPosition(Point3D origin, float minDistance, float maxDistance) { + + Random random = new Random(); + float distance = random.nextInt((int) (maxDistance - minDistance) + 1) + minDistance; + float angle = (float) (random.nextInt(360) * (Math.PI / 180)); + + return new Point3D((float) (origin.x + distance * Math.cos(angle)), 0, (float) (origin.z + distance * Math.sin(angle))); + + } + + @Override + public Point3D getRandomPosition() { + + Random random = new Random(); + float distance = random.nextInt((int) radius); + float angle = (float) (random.nextInt(360) * (Math.PI / 180)); + + return new Point3D((float) (center.x + distance * Math.cos(angle)), 0, (float) (center.z + distance * Math.sin(angle))); + + } +} diff --git a/src/resources/objects/Buff.java b/src/resources/objects/Buff.java index 16fb49f3..ea55a20e 100644 --- a/src/resources/objects/Buff.java +++ b/src/resources/objects/Buff.java @@ -31,7 +31,6 @@ import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; -import resources.common.BuffBuilder; import resources.objects.creature.CreatureObject; import com.sleepycat.persist.model.NotPersistent; @@ -41,7 +40,7 @@ import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; import engine.resources.common.CRC; -@Persistent(version=6) +@Persistent(version=8) public class Buff implements IListObject { @NotPersistent @@ -53,6 +52,7 @@ public class Buff implements IListObject { private long ownerId; private String effect1Name, effect2Name, effect3Name, effect4Name, effect5Name; private float effect1Value, effect2Value, effect3Value, effect4Value, effect5Value; + private String callback; private String particleEffect; private boolean isDebuff; private boolean removeOnDeath; @@ -68,6 +68,7 @@ public class Buff implements IListObject { @NotPersistent private ScheduledFuture removalTask; private int stacks = 1; + private long groupBufferId; public Buff(String buffName, long ownerId) { @@ -97,6 +98,7 @@ public class Buff implements IListObject { effect4Value = (Float) visitor.getObject(i, 14); effect5Name = (String) visitor.getObject(i, 15); effect5Value = (Float) visitor.getObject(i, 16); + callback = (String) visitor.getObject(i, 18); particleEffect = (String) visitor.getObject(i, 19); isDebuff = (Boolean) visitor.getObject(i, 22); removeOnDeath = (Integer) visitor.getObject(i, 25) != 0; @@ -265,6 +267,14 @@ public class Buff implements IListObject { public void setEffect5Value(float effect5Value) { this.effect5Value = effect5Value; } + + public String getCallback() { + return callback; + } + + public void setCallback(String callback) { + this.callback = callback; + } public String getParticleEffect() { return particleEffect; @@ -417,5 +427,17 @@ public class Buff implements IListObject { public void setStacks(int stacks) { this.stacks = stacks; } + + public boolean isGroupBuff() { + return effect1Name.equals("group"); + } + + public long getGroupBufferId() { + return groupBufferId; + } + + public void setGroupBufferId(long groupBufferId) { + this.groupBufferId = groupBufferId; + } } diff --git a/src/resources/objects/BuffItem.java b/src/resources/objects/BuffItem.java index 79e28b8a..8d647d4a 100644 --- a/src/resources/objects/BuffItem.java +++ b/src/resources/objects/BuffItem.java @@ -52,11 +52,11 @@ public class BuffItem { this.invested = invested; } - public int getAmount() { + public int getBonusAmount() { return bonusAmount; } - public void setAmount(int amount) { + public void setBonusAmount(int amount) { this.bonusAmount = amount; } } diff --git a/src/resources/objects/building/BuildingMessageBuilder.java b/src/resources/objects/building/BuildingMessageBuilder.java index 224e0a8d..606f5f78 100644 --- a/src/resources/objects/building/BuildingMessageBuilder.java +++ b/src/resources/objects/building/BuildingMessageBuilder.java @@ -21,6 +21,93 @@ ******************************************************************************/ package resources.objects.building; -public class BuildingMessageBuilder { +import java.nio.ByteOrder; +import org.apache.mina.core.buffer.IoBuffer; +import resources.objects.ObjectMessageBuilder; + +public class BuildingMessageBuilder extends ObjectMessageBuilder { + + public BuildingMessageBuilder(BuildingObject buildingObject) { + setObject(buildingObject); + } + + public IoBuffer buildBaseline3() { + + BuildingObject building = (BuildingObject) object; + IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putShort((short) 0x0D); + buffer.putFloat(building.getComplexity()); + buffer.put(getAsciiString(building.getStfFilename())); + buffer.putInt(0); + buffer.put(getAsciiString(building.getStfName())); + buffer.putInt(0); + buffer.putInt(255); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(1).order(ByteOrder.BIG_ENDIAN); + buffer.putInt(0); + buffer.putInt(0); + buffer.putShort((short) 0); + buffer.putInt(0x201C); + buffer.put((byte) 1); + + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + + buffer.flip(); + buffer = createBaseline("BUIO", (byte) 3, buffer, size); + + return buffer; + + } + + public IoBuffer buildBaseline6() { + + BuildingObject building = (BuildingObject) object; + IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putShort((short) 8); + buffer.putInt(0x43); + + buffer.put(getAsciiString(building.getDetailFilename())); + buffer.putInt(0); + buffer.put(getAsciiString(building.getDetailName())); + buffer.putInt(0); + buffer.put((byte) 0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + + buffer.flip(); + buffer = createBaseline("BUIO", (byte) 6, buffer, size); + + return buffer; + + } + + + @Override + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + // TODO Auto-generated method stub + + } + + @Override + public void sendBaselines() { + + } } diff --git a/src/resources/objects/building/BuildingObject.java b/src/resources/objects/building/BuildingObject.java index a1267703..482e9cb2 100644 --- a/src/resources/objects/building/BuildingObject.java +++ b/src/resources/objects/building/BuildingObject.java @@ -21,14 +21,10 @@ ******************************************************************************/ package resources.objects.building; - - import java.util.concurrent.atomic.AtomicReference; - import resources.objects.cell.CellObject; - import com.sleepycat.persist.model.Entity; - +import com.sleepycat.persist.model.NotPersistent; import engine.clients.Client; import engine.resources.container.Traverser; import engine.resources.objects.SWGObject; @@ -39,18 +35,17 @@ import engine.resources.scene.Quaternion; @Entity public class BuildingObject extends SWGObject { + @NotPersistent + private BuildingMessageBuilder messageBuilder; + public BuildingObject() { super(); + messageBuilder = new BuildingMessageBuilder(this); } public BuildingObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, position, orientation, Template); - } - - @Override - public void sendBaselines(Client client) { - // TODO Auto-generated method stub - + messageBuilder = new BuildingMessageBuilder(this); } public CellObject getCellByCellNumber(final int cellNumber) { @@ -73,5 +68,17 @@ public class BuildingObject extends SWGObject { } - + @Override + public void sendBaselines(Client destination) { + + if(destination == null || destination.getSession() == null) { + System.out.println("NULL session"); + return; + } + + destination.getSession().write(messageBuilder.buildBaseline3()); + destination.getSession().write(messageBuilder.buildBaseline6()); + + } + } diff --git a/src/resources/objects/cell/CellMessageBuilder.java b/src/resources/objects/cell/CellMessageBuilder.java index 63f5592b..dd627e06 100644 --- a/src/resources/objects/cell/CellMessageBuilder.java +++ b/src/resources/objects/cell/CellMessageBuilder.java @@ -21,6 +21,78 @@ ******************************************************************************/ package resources.objects.cell; -public class CellMessageBuilder { +import java.nio.ByteOrder; +import org.apache.mina.core.buffer.IoBuffer; + +import resources.objects.ObjectMessageBuilder; +import resources.objects.building.BuildingObject; + +public class CellMessageBuilder extends ObjectMessageBuilder { + + public CellMessageBuilder(CellObject cellObject) { + setObject(cellObject); + } + + public IoBuffer buildBaseline3() { + + CellObject cell = (CellObject) object; + IoBuffer buffer = bufferPool.allocate(27, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putShort((short) 6); + buffer.putFloat(0); + buffer.putShort((short) 0); + + buffer.putInt(0); + buffer.putShort((short) 0); + + buffer.putInt(0); + buffer.putInt(0); + buffer.put((byte) 1); + buffer.putInt(cell.getCellNumber()); + + int size = buffer.position(); + + buffer.flip(); + buffer = createBaseline("SCLT", (byte) 3, buffer, size); + + return buffer; + + } + + public IoBuffer buildBaseline6() { + + IoBuffer buffer = bufferPool.allocate(30, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putShort((short) 4); + buffer.putInt(0x43); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + + int size = buffer.position(); + + buffer.flip(); + buffer = createBaseline("SCLT", (byte) 6, buffer, size); + + return buffer; + + } + + + + @Override + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + // TODO Auto-generated method stub + + } + + @Override + public void sendBaselines() { + // TODO Auto-generated method stub + + } } diff --git a/src/resources/objects/cell/CellObject.java b/src/resources/objects/cell/CellObject.java index a32e33b1..bf8670b8 100644 --- a/src/resources/objects/cell/CellObject.java +++ b/src/resources/objects/cell/CellObject.java @@ -21,10 +21,10 @@ ******************************************************************************/ package resources.objects.cell; +import protocol.swg.UpdateCellPermissionMessage; - +import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; - import engine.clients.Client; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -35,18 +35,23 @@ import engine.resources.scene.Quaternion; public class CellObject extends SWGObject { private int cellNumber = 0; + @NotPersistent + private CellMessageBuilder messageBuilder; public CellObject() { super(); + messageBuilder = new CellMessageBuilder(this); } public CellObject(long objectID, Planet planet, int cellNumber) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff"); + super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), "object/cell/shared_cell.iff"); setCellNumber(cellNumber); + messageBuilder = new CellMessageBuilder(this); } public CellObject(long objectID, Planet planet) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff"); + super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), "object/cell/shared_cell.iff"); + messageBuilder = new CellMessageBuilder(this); } public int getCellNumber() { @@ -62,8 +67,17 @@ public class CellObject extends SWGObject { } @Override - public void sendBaselines(Client client) { - // TODO Auto-generated method stub + public void sendBaselines(Client destination) { + + if(destination == null || destination.getSession() == null) { + System.out.println("NULL session"); + return; + } + + destination.getSession().write(messageBuilder.buildBaseline3()); + destination.getSession().write(messageBuilder.buildBaseline6()); + destination.getSession().write(new UpdateCellPermissionMessage((byte) 1, getObjectID()).serialize()); + } diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index 0f5d71bf..2491e829 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -97,14 +97,8 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.put(getAsciiString(creature.getStfName())); if (creature.getCustomName() == null) { creature.setCustomName(""); }//Not all CreatureObjects have CustomName (Shuttles) buffer.put(getUnicodeString(creature.getCustomName())); - buffer.putInt(0x000F4240); // unk - String factionCRC = creature.getFaction(); - if(factionCRC == null) - buffer.putInt(0); - else if(factionCRC.equals("neutral")) - buffer.putInt(0); - else - buffer.putInt(CRC.StringtoCRC(factionCRC)); + buffer.putInt(0x000F4240); // volume + buffer.putInt(CRC.StringtoCRC(creature.getFaction())); buffer.putInt(creature.getFactionStatus()); @@ -119,14 +113,14 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putInt(1); buffer.putInt(0); // TANO Data buffer.putInt(0); - buffer.putInt(0x80); // 0x80 = Player, 0x08 = Quest NPC, + buffer.putInt(creature.getOptionsBitmask()); // 0x80 = Player, 0x08 = Quest NPC, buffer.putInt(creature.getIncapTimer()); buffer.putInt(0); buffer.putInt(0x3A98); buffer.put((byte) 1); + buffer.put((byte) creature.getPosture()); buffer.put((byte) 0); - buffer.put((byte) 1); buffer.putLong(creature.getOwnerId()); @@ -173,7 +167,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } buffer.putFloat(creature.getSpeedMultiplierBase()); buffer.putFloat(creature.getSpeedMultiplierMod()); - buffer.putLong(0); // unk + buffer.putLong(creature.getListenToId()); buffer.putFloat(creature.getRunSpeed()); @@ -234,10 +228,12 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { //buffer.putShort((short) 90); buffer.putInt(creature.getGrantedHealth()); // From player_level.iff. Ranges from 0-2000 as you level, consistent with that table. + //0A if(creature.getCurrentAnimation() == null || creature.getCurrentAnimation().length() == 0) buffer.putShort((short) 0); else buffer.put(getAsciiString(creature.getCurrentAnimation())); + if(creature.getMoodAnimation() == null || creature.getMoodAnimation().length() == 0) buffer.put(getAsciiString("neutral")); else @@ -251,10 +247,11 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putShort((short) 0); else buffer.put(getAsciiString(creature.getInviteSenderName())); - + buffer.putLong(creature.getInviteCounter()); buffer.putInt(creature.getGuildId()); + //10 buffer.putLong(creature.getTargetId()); buffer.put(creature.getMoodId()); buffer.putInt(creature.getPerformanceCounter()); @@ -267,6 +264,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putInt(creature.getHamListCounter()); buffer.putInt(creature.getHealth()); + //1A buffer.putInt(0); buffer.putInt(creature.getAction()); buffer.putInt(0); @@ -372,8 +370,9 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putInt(1); } - - buffer.putShort((short) 0); + + buffer.put((byte) 0); + buffer.put(creature.getDifficulty()); buffer.putInt(0xFFFFFFFF); buffer.put((byte) 1); buffer.putShort((short) 0); @@ -541,7 +540,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } - public IoBuffer buildSpeedModDelta(float speed) { + public IoBuffer buildSpeedModBaseDelta(float speed) { IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); buffer.putFloat(speed); @@ -552,6 +551,19 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { return buffer; } + + public IoBuffer buildSpeedModDelta(float speedModifier) { + + IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putFloat(speedModifier); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 5, buffer, size + 4); + + return buffer; + + } + public IoBuffer buildTurnRadiusDelta(float turnRadius) { @@ -975,6 +987,52 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } + public IoBuffer buildListenToId(long creatureObjectId) { + IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putLong(creatureObjectId); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 0x09, buffer, size + 4); + return buffer; + } + + public IoBuffer buildPerformanceId(int performanceId) { + IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(performanceId); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x14, buffer, size + 4); + return buffer; + } + + public IoBuffer buildPerformanceCounter(int performanceCounter) { + IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(performanceCounter); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x13, buffer, size + 4); + return buffer; + } + + public IoBuffer buildStartPerformance(boolean doStart) { + IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.put((byte) ((doStart) ? 1 : 0)); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1B, buffer, size + 4); + return buffer; + } + + + public IoBuffer buildDifficultyDelta(byte difficulty) { + IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.put(difficulty); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1C, buffer, size + 4); + return buffer; + } + @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { // TODO Auto-generated method stub @@ -985,5 +1043,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { public void sendBaselines() { } + + } diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 23307378..4f24298c 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -31,8 +31,8 @@ import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.ChatSystemMessage; import protocol.swg.ObjControllerMessage; import protocol.swg.PlayMusicMessage; -import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.UpdatePostureMessage; +import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.objectControllerObjects.Animation; import protocol.swg.objectControllerObjects.Posture; @@ -55,7 +55,7 @@ import engine.resources.scene.Quaternion; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; -@Entity(version=2) +@Entity(version=7) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -101,7 +101,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { // CREO6 private byte combatFlag = 0; - private short level = 1; + private short level = -1; private int grantedHealth = 0; private String currentAnimation; private String moodAnimation; @@ -115,6 +115,15 @@ public class CreatureObject extends TangibleObject implements IPersistent { private byte moodId = 0; private int performanceCounter = 0; private int performanceId = 0; + //FIXME: this is a bit of a hack. + private boolean performanceType = false; + //FIXME: hmm.. or persistent? + @NotPersistent + private boolean acceptBandflourishes = true; + @NotPersistent + private boolean groupDance = true; + private CreatureObject performanceWatchee; + private CreatureObject performanceListenee; private int health = 1000; private int action = 300; @NotPersistent @@ -130,6 +139,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { private SWGList buffList = new SWGList(); @NotPersistent private int buffListUpdateCounter = 0; + private byte difficulty = 0; private SWGList appearanceEquipmentList; @NotPersistent private int appearanceEquipmentListUpdateCounter = 0; @@ -142,7 +152,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { private SWGList dotList = new SWGList(); @NotPersistent private ScheduledFuture incapTask; - + private boolean staticNPC = false; // temp public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { @@ -257,7 +267,14 @@ public class CreatureObject extends TangibleObject implements IPersistent { } } - + + @Override + public int getOptionsBitmask() { + synchronized(objectMutex) { + return optionsBitmask; + } + } + @Override public void setOptionsBitmask(int optionBitmask) { synchronized(objectMutex) { @@ -269,6 +286,26 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(optionDelta, true); } + + public void setOptions(int options, boolean add) { + synchronized(objectMutex) { + if (options != 0) { + if (add) { + addOption(options); + } else { + removeOption(options); + } + } + } + } + + public void addOption(int option) { + setOptionsBitmask(getOptionsBitmask() | option); + } + + public void removeOption(int option) { + setOptionsBitmask(getOptionsBitmask() & ~option); + } public byte getPosture() { synchronized(objectMutex) { @@ -277,15 +314,25 @@ public class CreatureObject extends TangibleObject implements IPersistent { } public void setPosture(byte posture) { + boolean needsStopPerformance = false; synchronized(objectMutex) { + if (this.posture == 0x09) { + needsStopPerformance = true; + } this.posture = posture; } + IoBuffer postureDelta = messageBuilder.buildPostureDelta(posture); Posture postureUpdate = new Posture(getObjectID(), posture); ObjControllerMessage objController = new ObjControllerMessage(0x1B, postureUpdate); notifyObservers(postureDelta, true); notifyObservers(objController, true); + + if (needsStopPerformance) { + stopPerformance(); + } + } @Override @@ -294,10 +341,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { this.faction = faction; } - IoBuffer factionDelta = messageBuilder.buildFactionDelta(faction); - - notifyObservers(factionDelta, true); - + notifyObservers(messageBuilder.buildFactionDelta(faction), true); + setPvpStatus(0, true); } public int getFactionStatus() { @@ -311,10 +356,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { this.factionStatus = factionStatus; } - IoBuffer factionStatusDelta = messageBuilder.buildFactionStatusDelta(factionStatus); - - notifyObservers(factionStatusDelta, true); - + notifyObservers(messageBuilder.buildFactionStatusDelta(factionStatus), true); } public float getHeight() { @@ -491,7 +533,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { synchronized(objectMutex) { this.speedMultiplierBase = speedMultiplierBase; } - IoBuffer speedDelta = messageBuilder.buildSpeedModDelta(speedMultiplierBase); + IoBuffer speedDelta = messageBuilder.buildSpeedModBaseDelta(speedMultiplierBase); notifyObservers(speedDelta, true); @@ -507,6 +549,9 @@ public class CreatureObject extends TangibleObject implements IPersistent { synchronized(objectMutex) { this.speedMultiplierMod = speedMultiplierMod; } + IoBuffer speedDelta = messageBuilder.buildSpeedModDelta(speedMultiplierMod); + + notifyObservers(speedDelta, true); } public long getListenToId() { @@ -721,6 +766,14 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(messageBuilder.buildCurrentAnimationDelta(currentAnimation), true); } + + public void doSkillAnimation(String skillAnimation) { + Animation animation = new Animation(getObjectId(), skillAnimation); + ObjControllerMessage objController = new ObjControllerMessage(0x1B, animation); + + notifyObservers(objController, true); + + } public String getMoodAnimation() { synchronized(objectMutex) { @@ -868,6 +921,14 @@ public class CreatureObject extends TangibleObject implements IPersistent { } } + public boolean getAcceptBandflourishes() { + return acceptBandflourishes; + } + + public void setAcceptBandflourishes(boolean acceptBandflourishes) { + this.acceptBandflourishes = acceptBandflourishes; + } + public SWGList getEquipmentList() { return equipmentList; } @@ -925,33 +986,48 @@ public class CreatureObject extends TangibleObject implements IPersistent { //destination.getSession().write(upm.serialize()); if(destination != getClient()) { - UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); + UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID(), getPvPBitmask(), getFaction()); + + /* if (factionStatus == 1 && faction == "imperial") { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); upvpm.setStatus(16); + if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0); + if (getOwnerId() != 0) upvpm.setStatus(256); } if (factionStatus == 1 && faction == "rebel") { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); upvpm.setStatus(16); + if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0); + if (getOwnerId() != 0) upvpm.setStatus(256); } if (factionStatus == 2 && faction == "imperial") { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); upvpm.setStatus(55); + if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(39); + if (getOwnerId() != 0) upvpm.setStatus(295); } if (factionStatus == 2 && faction == "rebel") { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); upvpm.setStatus(55); + if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(39); + if (getOwnerId() != 0) upvpm.setStatus(295); } if(factionStatus == 0 && faction == "neutral") { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); upvpm.setStatus(16); - } - else { + if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0); + if (getOwnerId() != 0) upvpm.setStatus(256); + } else { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); upvpm.setStatus(16); + if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0); + if (getOwnerId() != 0) upvpm.setStatus(256); } + */ + destination.getSession().write(upvpm.serialize()); } } @@ -1268,4 +1344,112 @@ public class CreatureObject extends TangibleObject implements IPersistent { return this.staticNPC = staticNPC; } + public boolean getGroupDance() { + synchronized(objectMutex) { + return groupDance; + } + } + + public void setGroupDance(boolean groupDance) { + synchronized(objectMutex) { + this.groupDance = groupDance; + } + } + + public boolean toggleGroupDance() { + synchronized(objectMutex) { + groupDance = !groupDance; + return groupDance; + } + } + + public CreatureObject getPerformanceWatchee() { + synchronized(objectMutex) { + return performanceWatchee; + } + } + + public void setPerformanceWatchee(CreatureObject performanceWatchee) { + synchronized(objectMutex) { + this.performanceWatchee = performanceWatchee; + } + //getClient().getSession().write(messageBuilder.buildListenToId(0)); + } + + public CreatureObject getPerformanceListenee() { + synchronized(objectMutex) { + return performanceListenee; + } + } + + public void setPerformanceListenee(CreatureObject performanceListenee) { + synchronized(objectMutex) { + this.performanceListenee = performanceListenee; + //possibly redundant, need to research this further. + this.listenToId = performanceListenee.getObjectId(); + } + getClient().getSession().write(messageBuilder.buildListenToId(this.listenToId)); + } + + public void startPerformance(int performanceId, int performanceCounter, String skillName, boolean isDance) { + synchronized(objectMutex) { + this.performanceId = performanceId; + this.performanceCounter = performanceCounter; + this.currentAnimation = skillName; + this.performanceType = isDance; + } + + getClient().getSession().write(messageBuilder.buildPerformanceId(performanceId)); + getClient().getSession().write(messageBuilder.buildPerformanceCounter(performanceCounter)); + getClient().getSession().write(messageBuilder.buildCurrentAnimationDelta(skillName)); + getClient().getSession().write(messageBuilder.buildStartPerformance(true)); + + } + + public void stopPerformance() { + String type = ""; + synchronized(objectMutex) { + this.performanceId = 0; + this.performanceCounter = 0; + this.currentAnimation = null; + type = (performanceType) ? "dance" : "music"; + } + + sendSystemMessage("@performance:" + type + "_stop_self",(byte)0); + notifyAudience("@performance:" + type + "_stop_other"); + + getClient().getSession().write(messageBuilder.buildStartPerformance(false)); + } + + public void notifyAudience(String message) { + //TODO: stub + } + + + @Override + public void setPvPBitmask(int pvpBitmask) { + super.setPvPBitmask(pvpBitmask); + notifyObservers(new UpdatePVPStatusMessage(getObjectID(), getPvPBitmask(), getFaction()), false); + } + + @Override + public void setPvpStatus(int pvpBitmask, boolean add) { + super.setPvpStatus(pvpBitmask, add); + notifyObservers(new UpdatePVPStatusMessage(getObjectID(), getPvPBitmask(), getFaction()), false); + } + + public byte getDifficulty() { + synchronized(objectMutex) { + return difficulty; + } + } + + public void setDifficulty(byte difficulty) { + synchronized(objectMutex) { + this.difficulty = difficulty; + } + + notifyObservers(messageBuilder.buildDifficultyDelta(difficulty), true); + } + } diff --git a/src/resources/objects/guild/GuildObject.java b/src/resources/objects/guild/GuildObject.java index 0107ff79..504a10e6 100644 --- a/src/resources/objects/guild/GuildObject.java +++ b/src/resources/objects/guild/GuildObject.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.guild; +import java.util.HashMap; import java.util.Map; import java.util.TreeMap; @@ -35,6 +36,7 @@ import resources.guild.Guild; import resources.objects.SWGList; import resources.objects.SWGMap; import resources.objects.SWGMultiMap; +import services.collections.ServerFirst; import com.sleepycat.je.Environment; import com.sleepycat.je.Transaction; @@ -54,7 +56,8 @@ public class GuildObject extends SWGObject implements IPersistent { protected NGECore core; @NotPersistent private GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this); - + + private Map serverFirst = new HashMap(); private Map> zoneMap = new TreeMap>(); @NotPersistent private Transaction txn; @@ -260,6 +263,20 @@ public class GuildObject extends SWGObject implements IPersistent { } } + public Map getServerFirst() { + synchronized(objectMutex) { + return serverFirst; + } + } + + public void addServerFirst(String collectionName, ServerFirst player) { + synchronized(objectMutex) { + if (!serverFirst.containsKey(collectionName)) { + serverFirst.put(collectionName, player); + } + } + } + @Override public void sendBaselines(Client destination) { destination.getSession().write(messageBuilder.buildBaseline3()); diff --git a/src/resources/objects/mission/MissionMessageBuilder.java b/src/resources/objects/mission/MissionMessageBuilder.java index 90c78dfe..190773ad 100644 --- a/src/resources/objects/mission/MissionMessageBuilder.java +++ b/src/resources/objects/mission/MissionMessageBuilder.java @@ -21,6 +21,320 @@ ******************************************************************************/ package resources.objects.mission; -public class MissionMessageBuilder { +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; + +import engine.resources.common.CRC; +import resources.common.Console; +import resources.common.StringUtilities; +import resources.objects.ObjectMessageBuilder; +import resources.objects.waypoint.WaypointObject; + +public class MissionMessageBuilder extends ObjectMessageBuilder { + + public MissionMessageBuilder(MissionObject missionObject) { + setObject(missionObject); + } + + public IoBuffer buildBaseline3() { + MissionObject mission = (MissionObject) object; + IoBuffer buffer = IoBuffer.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putShort((short) 17); + + buffer.putFloat(1); // mission complexity ?? + buffer.put(getAsciiString(mission.getStfFilename())); + buffer.putInt(0); + buffer.put(getAsciiString(mission.getStfName())); + + if (mission.getCustomName() == null) { buffer.put(getUnicodeString("")); } + else { buffer.put(getUnicodeString(mission.getCustomName())); } + + buffer.putInt(0); // volume + buffer.putInt(0); // unused + buffer.putInt(mission.getMissionLevel()); + + buffer.putFloat(mission.getMissionStartX()); + buffer.putFloat(0); // missionStartZ + buffer.putFloat(mission.getMissionStartY()); + + buffer.putLong(0); // ?? + + if (mission.getMissionStartPlanet() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getMissionStartPlanet())); + } + + buffer.put(getUnicodeString(mission.getMissionCreator())); + buffer.putInt(mission.getMissionCredits()); + + buffer.putFloat(mission.getMissionDestinationX()); + buffer.putFloat(0); // missionDestinationZ + buffer.putFloat(mission.getMissionDestinationY()); + + buffer.putLong(0); // ?? + + if (mission.getMissionDestinationPlanet() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getMissionDestinationPlanet())); + } + + if (mission.getTargetTemplateObject() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getTargetTemplateObject())); + } + + buffer.put(getAsciiString(mission.getMissionDescription())); + buffer.putInt(0); + buffer.put(getAsciiString(mission.getMissionDescId())); + + buffer.put(getAsciiString(mission.getMissionTitle())); + buffer.putInt(0); + buffer.put(getAsciiString(mission.getMissionTitleId())); + + buffer.putInt(0); // refresh counter + + if(mission.getMissionType() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getMissionType())); + } + + buffer.put(getAsciiString(mission.getMissionTargetName())); + + WaypointObject wp = mission.getMissionAttachedWaypoint(); + + if (wp == null) { + buffer.putInt(0); + buffer.putFloat(0); // x + buffer.putFloat(0); // z + buffer.putFloat(0); // y + buffer.putLong(0); // target id + buffer.putInt(0); // planet crc + buffer.put(getUnicodeString("")); + buffer.putLong(0); // waypoint id + buffer.put((byte) 0); // color + buffer.put((byte) 0x01); //active + } else { + buffer.putInt(wp.getCellId()); + buffer.putFloat(wp.getPosition().x); + buffer.putFloat(wp.getPosition().z); + buffer.putFloat(wp.getPosition().y); + buffer.putLong(0); + buffer.putInt(CRC.StringtoCRC(wp.getPlanet().name)); + buffer.put((byte) 0); + buffer.put((byte) 0x01); + } + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + + buffer.flip(); + buffer = createBaseline("MISO", (byte) 3, buffer, size); + + Console.println("Bytes: " + StringUtilities.bytesToHex(buffer.array())); + return buffer; + } + + public IoBuffer buildBaseline6() { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(121); // unk + + int size = buffer.position(); + buffer.flip(); + buffer = createBaseline("MISO", (byte) 6, buffer, size); + + return buffer; + } + + public IoBuffer buildStfDelta(String stfFile, String stfName) { + + IoBuffer buffer = IoBuffer.allocate(4 + stfFile.length() + stfName.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(stfFile)); + buffer.putInt(0); + buffer.put(getAsciiString(stfName)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x01, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildDifficultyLevelDelta(int difficulty) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(difficulty); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x05, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildStartLocationDelta(float x, float z, float y, String planet) { + + IoBuffer buffer = IoBuffer.allocate(24, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putFloat(x); + buffer.putFloat(z); + buffer.putFloat(y); + + buffer.putLong(0); + + buffer.putInt(CRC.StringtoCRC(planet)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x06, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildCreatorNameDelta(String creator) { + + IoBuffer buffer = IoBuffer.allocate(4 + creator.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(creator)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x07, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildCreditsRewardDelta(int creds) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(creds); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x08, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildDestinationDelta(float x, float z, float y, String planet) { + + IoBuffer buffer = IoBuffer.allocate(24, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putFloat(x); + buffer.putFloat(z); + buffer.putFloat(y); + + buffer.putLong(0); // Destination Object ID + + buffer.putInt(CRC.StringtoCRC(planet)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x09, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildTargetObjectIffDelta(String template) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(CRC.StringtoCRC(template)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0A, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildMissionDescriptionDelta(String desc, String id) { + + IoBuffer buffer = IoBuffer.allocate(8 + desc.length() + id.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(desc)); + buffer.putInt(0); + buffer.put(getAsciiString(id)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0B, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildMissionTitleDelta(String title, String id) { + + IoBuffer buffer = IoBuffer.allocate(8 + title.length() + id.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(title)); + buffer.putInt(0); + buffer.put(getAsciiString(id)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0C, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildRepeatCounterDelta(int counter) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(counter); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0D, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildMissionTypeDelta(String type) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(CRC.StringtoCRC(type)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0E, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildTargetNameDelta(String targetName) { + + IoBuffer buffer = IoBuffer.allocate(4 + targetName.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(targetName)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0F, buffer, size + 4); + + return buffer; + } + + @Override + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + + } + + @Override + public void sendBaselines() { + + } } diff --git a/src/resources/objects/mission/MissionObject.java b/src/resources/objects/mission/MissionObject.java index 57c7540e..635da311 100644 --- a/src/resources/objects/mission/MissionObject.java +++ b/src/resources/objects/mission/MissionObject.java @@ -21,6 +21,287 @@ ******************************************************************************/ package resources.objects.mission; -public class MissionObject { +import com.sleepycat.je.Environment; +import com.sleepycat.je.Transaction; +import com.sleepycat.persist.model.Entity; +import com.sleepycat.persist.model.NotPersistent; +import com.sleepycat.persist.model.Persistent; + +import resources.objects.tangible.TangibleObject; +import resources.objects.waypoint.WaypointObject; +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; + +@Persistent(version=1) +public class MissionObject extends SWGObject implements IPersistent { + + private float missionDestinationX; + private float missionDestinationY; + private float missionDestinationZ; + private float missionStartX; + private float missionStartY; + private float missionStartZ; + private String missionStartPlanet; + private int missionLevel; // Difficulty level displayed in details + private String missionDestinationPlanet; + private int missionRepeatCounter; // increases for each player using the mission; used for redisplaying on mission term too + private int missionCredits; + private String missionCreator = ""; + private String missionDescription = ""; + private String missionTitle = ""; + private String missionTargetName = ""; // Target object I guess? + private String missionDescId = ""; + private String missionTitleId = ""; + private String missionType; + private WaypointObject missionAttachedWaypoint; + + private String missionTemplateObject; + + @NotPersistent + MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this); + + @NotPersistent + private Transaction txn; + + public MissionObject() { + super(); + } + + public MissionObject(long objectID, Planet planet, String template) { + super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), template); + } + + public float getMissionStartX() { + synchronized(objectMutex) { + return missionStartX; + } + } + + public float getMissionStartY() { + synchronized(objectMutex) { + return missionStartY; + } + } + + public float getMissionStartZ() { + synchronized(objectMutex) { + return missionStartZ; + } + } + + public void setMissionStart(float x, float y, float z, String planet) { + synchronized(objectMutex) { + this.missionStartZ = z; + this.missionStartX = x; + this.missionStartY = y; + this.missionStartPlanet = planet; + } + + notifyObservers(messageBuilder.buildStartLocationDelta(x, z, y, planet), false); + } + + public float getMissionDestinationX() { + synchronized(objectMutex) { + return missionDestinationX; + } + } + + public float getMissionDestinationY() { + synchronized(objectMutex) { + return missionDestinationY; + } + } + + public float getMissionDestinationZ() { + synchronized(objectMutex) { + return missionDestinationZ; + } + } + + public void setMissionDestination(float x, float y, float z, String planet) { + synchronized(objectMutex) { + this.missionDestinationZ = z; + this.missionDestinationY = y; + this.missionDestinationZ = z; + this.missionDestinationPlanet = planet; + } + } + + public String getMissionDestinationPlanet() { + synchronized(objectMutex) { + return missionDestinationPlanet; + } + } + + public int getMissionLevel() { + synchronized(objectMutex) { + return missionLevel; + } + } + + public void setMissionLevel(int missionLevel) { + synchronized(objectMutex) { + this.missionLevel = missionLevel; + } + } + + public String getMissionStartPlanet() { + synchronized(objectMutex) { + return missionStartPlanet; + } + } + + public int getMissionRepeatCounter() { + synchronized(objectMutex) { + return missionRepeatCounter; + } + } + + public void setMissionRepeatCounter(int missionRepeatCounter) { + synchronized(objectMutex) { + this.missionRepeatCounter = missionRepeatCounter; + } + } + + public int getMissionCredits() { + synchronized(objectMutex) { + return missionCredits; + } + } + + public void setMissionCredits(int missionCredits) { + synchronized(objectMutex) { + this.missionCredits = missionCredits; + } + notifyObservers(messageBuilder.buildCreditsRewardDelta(missionCredits), false); + } + + public String getMissionCreator() { + synchronized(objectMutex) { + return missionCreator; + } + } + + public void setMissionCreator(String missionCreator) { + synchronized(objectMutex) { + this.missionCreator = missionCreator; + } + notifyObservers(messageBuilder.buildCreatorNameDelta(missionCreator), false); + } + + public String getMissionDescription() { + synchronized(objectMutex) { + return missionDescription; + } + } + + public void setMissionDescription(String missionDescription, String id) { + synchronized(objectMutex) { + this.missionDescription = missionDescription; + this.missionDescId = id; + } + notifyObservers(messageBuilder.buildMissionDescriptionDelta(missionDescription, id), false); + } + + public String getMissionTitle() { + synchronized(objectMutex) { + return missionTitle; + } + } + + public void setMissionTitle(String missionTitle, String id) { + synchronized(objectMutex) { + this.missionTitle = missionTitle; + this.missionTitleId = id; + } + notifyObservers(messageBuilder.buildMissionTitleDelta(missionTitle, id), false); + } + + public String getMissionTargetName() { + synchronized(objectMutex) { + return missionTargetName; + } + } + + public void setMissionTargetName(String missionTargetName) { + synchronized(objectMutex) { + this.missionTargetName = missionTargetName; + } + notifyObservers(messageBuilder.buildTargetNameDelta(missionTargetName), false); + } + + public WaypointObject getMissionAttachedWaypoint() { + synchronized(objectMutex) { + return missionAttachedWaypoint; + } + } + + public void setMissionAttachedWaypoint(WaypointObject missionAttachedWaypoint) { + synchronized(objectMutex) { + this.missionAttachedWaypoint = missionAttachedWaypoint; + } + } + + public String getTargetTemplateObject() { + synchronized(objectMutex) { + return missionTemplateObject; + } + } + + public void setTargetTemplateObject(String missionTemplateObject) { + synchronized(objectMutex) { + this.missionTemplateObject = missionTemplateObject; + } + notifyObservers(messageBuilder.buildTargetObjectIffDelta(missionTemplateObject), false); + } + + public String getMissionDescId() { + synchronized(objectMutex) { + return missionDescId; + } + } + + public String getMissionTitleId() { + synchronized(objectMutex) { + return missionTitleId; + } + } + + public String getMissionType() { + synchronized(objectMutex) { + return missionType; + } + } + + public void setMissionType(String missionType) { + synchronized(objectMutex) { + this.missionType = missionType; + } + notifyObservers(messageBuilder.buildMissionTypeDelta(missionType), false); + } + + public Transaction getTransaction() { + return txn; + } + + public void createTransaction(Environment env) { + txn = env.beginTransaction(null, null); + } + + @Override + public void sendBaselines(Client destination) { + + if(destination == null || destination.getSession() == null) { + System.out.println("NULL session"); + return; + } + + destination.getSession().write(messageBuilder.buildBaseline3()); + destination.getSession().write(messageBuilder.buildBaseline6()); + } } diff --git a/src/resources/objects/player/PlayerMessageBuilder.java b/src/resources/objects/player/PlayerMessageBuilder.java index cb480a88..452acc19 100644 --- a/src/resources/objects/player/PlayerMessageBuilder.java +++ b/src/resources/objects/player/PlayerMessageBuilder.java @@ -22,12 +22,14 @@ package resources.objects.player; import java.nio.ByteOrder; +import java.util.BitSet; import java.util.Map.Entry; import org.apache.mina.core.buffer.IoBuffer; import engine.resources.common.CRC; +import resources.common.StringUtilities; import resources.objects.ObjectMessageBuilder; import resources.objects.waypoint.WaypointObject; @@ -86,46 +88,18 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { buffer.putInt(getProfData(player.getProfession())); // prof icon buffer.put(getAsciiString(player.getProfession())); - buffer.putInt(0); // unk - buffer.putInt(0); // unk + buffer.putInt(0); // GCW + buffer.putInt(0); // PvP Kills + buffer.putLong(0); // Lifetime GCW + buffer.putInt(0); // Lifetime PvP Kills + buffer.putInt(player.getCollections().length); + buffer.putInt(player.getHighestSetBit()); + buffer.put(player.getCollections()); + buffer.putInt(0); // Unknown, part of one delta, maybe a list + buffer.putInt(0); // Unknown, part of one delta, maybe a list + buffer.put((byte) 0); // Unknown Boolean used in Tansarii + buffer.put((byte) 0); // Unknown Boolean used in Tansarii - byte[] data1 = new byte[] { - - 0x76, (byte) 0x0C, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xCF, (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x3E, (byte) 0x00, (byte) 0x00, (byte) 0x0F, (byte) 0x00, (byte) 0x60, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x41, (byte) 0x02, (byte) 0x88, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1F, (byte) 0x20, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x84, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x01, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }; - buffer.put(data1); - byte[] data2 = new byte[] { - - 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xC0, (byte) 0x05, (byte) 0x04, (byte) 0x78, (byte) 0x34, (byte) 0x78, (byte) 0x78, (byte) 0x08, (byte) 0x08, (byte) 0x14, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x04, (byte) 0x00, (byte) 0x20, (byte) 0x81, (byte) 0x0A, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x60, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0xC0, (byte) 0xFF, (byte) 0xC7, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }; - buffer.put(data2); - byte[] data3 = new byte[] { - - 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0xCB, (byte) 0x32, (byte) 0x06, (byte) 0x18, (byte) 0x60, (byte) 0x0C, (byte) 0x30, (byte) 0x60, (byte) 0x2D, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }; - buffer.put(data3); - byte[] data4 = new byte[] { - - 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }; - buffer.put(data4); - byte[] data5 = new byte[] { - - 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xC0, (byte) 0xFF, (byte) 0x1F, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xD0, (byte) 0xD5, (byte) 0x68, (byte) 0x00, (byte) 0x1A, (byte) 0x46, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x30, (byte) 0x1A, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x03, (byte) 0xD0, (byte) 0x00, (byte) 0x34, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }; - buffer.put(data5); - byte[] data6 = new byte[] { - - 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }; - buffer.put(data6); - byte[] data7 = new byte[] { - - 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0xFF, (byte) 0x3F, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00 - }; - buffer.put(data7); - - int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); @@ -377,6 +351,18 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { } + public IoBuffer buildCollectionsDelta(byte[] collections, int highestSetBit) { + IoBuffer buffer = bufferPool.allocate(8 + collections.length, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(collections.length); + buffer.putInt(highestSetBit); + for (byte collection : collections) buffer.put(collection); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("PLAY", (byte) 3, (short) 1, (short) 16, buffer, size + 4); + System.out.println(StringUtilities.bytesToHex(buffer.array())); + return buffer; + } + public IoBuffer buildXPListDelta(String type, int amount, boolean alreadyExists) { PlayerObject player = (PlayerObject) object; player.setXpListUpdateCounter(player.getXpListUpdateCounter() + 1); @@ -576,6 +562,44 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { } + public IoBuffer buildIgnoreAddDelta(String ignoreName) { + IoBuffer buffer = bufferPool.allocate(30, false).order(ByteOrder.LITTLE_ENDIAN); + PlayerObject player = (PlayerObject) object; + + buffer.putInt(1); + buffer.putInt(player.getIgnoreListUpdateCounter()); + + buffer.put((byte) 1); // updateType (SubType) + + buffer.putShort((short) player.getIgnoreList().indexOf(ignoreName)); + buffer.put(getAsciiString(ignoreName)); + + int size = buffer.position(); + buffer.flip(); + + buffer = createDelta("PLAY", (byte) 9, (short) 1, (short) 8, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildIgnoreRemoveDelta(String removeName) { + IoBuffer buffer = bufferPool.allocate(30, false).order(ByteOrder.LITTLE_ENDIAN); + PlayerObject player = (PlayerObject) object; + + buffer.putInt(1); + buffer.putInt(player.getIgnoreListUpdateCounter()); + + buffer.put((byte) 0); + buffer.putShort((short) player.getIgnoreList().indexOf(removeName)); + + int size = buffer.position(); + buffer.flip(); + + buffer = createDelta("PLAY", (byte) 9, (short) 1, (short) 8, buffer, size + 4); + + return buffer; + } + public int getProfData(String profession) { switch (profession) { diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index fa60f7c6..5b679a34 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -22,9 +22,11 @@ package resources.objects.player; import java.util.ArrayList; +import java.util.BitSet; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TreeMap; import resources.objects.waypoint.WaypointObject; @@ -39,7 +41,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent +@Persistent(version=1) public class PlayerObject extends SWGObject { // PLAY 3 @@ -51,6 +53,8 @@ public class PlayerObject extends SWGObject { private List titleList = new ArrayList(); private int bornDate = 0; private int totalPlayTime = 0; + private byte[] collections = new byte[] { }; + private int highestSetBit = 0; // PLAY 6 @@ -116,7 +120,7 @@ public class PlayerObject extends SWGObject { @NotPersistent private long lastPlayTimeUpdate = System.currentTimeMillis(); - + private Map factionStandingMap = new TreeMap(); public PlayerObject() { super(); @@ -136,12 +140,13 @@ public class PlayerObject extends SWGObject { public void setTitle(String title) { synchronized(objectMutex) { - if(!getTitleList().isEmpty() && getTitleList().contains(title)) { this.title = title; - notifyObservers(messageBuilder.buildTitleDelta(title), true); } + } + + notifyObservers(messageBuilder.buildTitleDelta(title), true); } public String getProfession() { @@ -433,6 +438,22 @@ public class PlayerObject extends SWGObject { } } + public void ignoreAdd(String ignoreName) { + synchronized(objectMutex) { + setIgnoreListUpdateCounter(getIgnoreListUpdateCounter() + 1); + getContainer().getClient().getSession().write(messageBuilder.buildIgnoreAddDelta(ignoreName)); + ignoreList.add(ignoreName); + } + } + + public void ignoreRemove(String removeName) { + synchronized(objectMutex) { + setIgnoreListUpdateCounter(getIgnoreListUpdateCounter() + 1); + getContainer().getClient().getSession().write(messageBuilder.buildIgnoreRemoveDelta(removeName)); + ignoreList.remove(removeName); + } + } + public void setIgnoreListUpdateCounter(int ignoreListUpdateCounter) { synchronized(objectMutex) { this.ignoreListUpdateCounter = ignoreListUpdateCounter; @@ -535,7 +556,30 @@ public class PlayerObject extends SWGObject { this.jediState = jediState; } } - + + public Map getFactionStandingMap() { + return factionStandingMap; + } + + public void setFactionStanding(String faction, int factionStanding) { + synchronized(objectMutex) { + factionStandingMap.put(faction, ((factionStanding < -5000) ? -5000 : ((factionStanding > 5000) ? 5000 : factionStanding))); + } + } + + public void modifyFactionStanding(String faction, int modifier) { + synchronized(objectMutex) { + int factionStanding = (((factionStandingMap.containsKey(faction)) ? factionStandingMap.get(faction) : 0) + modifier); + factionStandingMap.put(faction, ((factionStanding < -5000) ? -5000 : ((factionStanding > 5000) ? 5000 : factionStanding))); + } + } + + public int getFactionStanding(String faction) { + synchronized(objectMutex) { + return ((factionStandingMap.containsKey(faction)) ? factionStandingMap.get(faction) : 0); + } + } + @Override public void sendBaselines(Client destination) { @@ -567,9 +611,30 @@ public class PlayerObject extends SWGObject { public List getTitleList() { return titleList; } - + public void setTitleList(List titleList) { this.titleList = titleList; } + public void setCollections(byte[] collections) { + synchronized(objectMutex) { + this.collections = collections; + this.highestSetBit = BitSet.valueOf(collections).length(); + } + + notifyObservers(messageBuilder.buildCollectionsDelta(collections, getHighestSetBit()), true); + } + + public byte[] getCollections() { + synchronized(objectMutex) { + return collections; + } + } + + public int getHighestSetBit() { + synchronized(objectMutex) { + return highestSetBit; + } + } + } diff --git a/src/resources/objects/staticobject/StaticMessageBuilder.java b/src/resources/objects/staticobject/StaticMessageBuilder.java index 696954f3..41aaa4ba 100644 --- a/src/resources/objects/staticobject/StaticMessageBuilder.java +++ b/src/resources/objects/staticobject/StaticMessageBuilder.java @@ -41,9 +41,11 @@ public class StaticMessageBuilder extends ObjectMessageBuilder { buffer.putShort((short) 4); buffer.putInt(0); + //buffer.putShort((short) 0); buffer.put(getAsciiString(object.getStfFilename())); buffer.putInt(0); + //buffer.putShort((short) 0); buffer.put(getAsciiString(object.getStfName())); buffer.putInt(0); buffer.putInt(0xFF); @@ -63,9 +65,11 @@ public class StaticMessageBuilder extends ObjectMessageBuilder { buffer.setAutoExpand(true); buffer.putShort((short) 2); buffer.putInt(0x92); + //buffer.putShort((short) 0); buffer.put(getAsciiString(object.getDetailFilename())); buffer.putInt(0); buffer.put(getAsciiString(object.getDetailName())); + // buffer.putShort((short) 0); int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); diff --git a/src/resources/objects/staticobject/StaticObject.java b/src/resources/objects/staticobject/StaticObject.java index 1bb2380c..28b9d797 100644 --- a/src/resources/objects/staticobject/StaticObject.java +++ b/src/resources/objects/staticobject/StaticObject.java @@ -55,8 +55,8 @@ public class StaticObject extends SWGObject { return; } - destination.getSession().write(messageBuilder.buildBaseline3()); - destination.getSession().write(messageBuilder.buildBaseline6()); + //destination.getSession().write(messageBuilder.buildBaseline3()); + //destination.getSession().write(messageBuilder.buildBaseline6()); } diff --git a/src/resources/objects/tangible/TangibleMessageBuilder.java b/src/resources/objects/tangible/TangibleMessageBuilder.java index b15e4bbd..fdb7142b 100644 --- a/src/resources/objects/tangible/TangibleMessageBuilder.java +++ b/src/resources/objects/tangible/TangibleMessageBuilder.java @@ -51,7 +51,7 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { buffer.put(getUnicodeString(object.getCustomName())); buffer.putInt(object.getVolume()); buffer.putInt(0); - buffer.putInt(0); // unknowns + buffer.putInt(0); // faction vars if(tangible.getCustomization() == null || tangible.getCustomization().length < 1) buffer.putShort((short) 0); @@ -59,12 +59,14 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { buffer.putShort((short) tangible.getCustomization().length); buffer.put(tangible.getCustomization()); } + + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(tangible.getOptionsBitmask()); - buffer.putInt(tangible.getIncapTimer()); + buffer.putInt(0); // number of item uses buffer.putInt(tangible.getConditionDamage()); buffer.putInt(tangible.getMaxDamage()); - buffer.putInt(0); - buffer.putInt(0x64); buffer.put((byte) (tangible.isStaticObject() ? 1 : 0)); int size = buffer.position(); @@ -123,6 +125,18 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { return buffer; } + public IoBuffer buildConditionDamageDelta(int conditionDamage) { + + IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(conditionDamage); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("TANO", (byte) 3, (short) 1, (short) 0x0A, buffer, size + 4); + + return buffer; + + } + @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { // TODO Auto-generated method stub diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 4fece110..5a9a56f6 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -29,6 +29,7 @@ import java.util.Vector; import protocol.swg.ObjControllerMessage; import protocol.swg.PlayClientEffectObjectMessage; import protocol.swg.StopClientEffectObjectByLabel; +import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.objectControllerObjects.ShowFlyText; import resources.common.RGB; @@ -48,7 +49,6 @@ import engine.resources.scene.Quaternion; @Persistent public class TangibleObject extends SWGObject { - // TODO: Thread safety protected int incapTimer = 10; @@ -57,9 +57,9 @@ public class TangibleObject extends SWGObject { protected byte[] customization; private List componentCustomizations = new ArrayList(); protected int optionsBitmask = 0; - private int maxDamage = 0; + private int maxDamage = 1000; private boolean staticObject = false; - protected String faction = ""; + protected String faction = "neutral"; // Says you're "Imperial Special Forces" if it's 0 for some reason @NotPersistent private Vector defendersList = new Vector(); // unused in packets but useful for the server @NotPersistent @@ -68,15 +68,20 @@ public class TangibleObject extends SWGObject { private int respawnTime = 0; private Point3D spawnCoordinates = new Point3D(0, 0, 0); + @NotPersistent + private TangibleObject killer = null; + public TangibleObject(long objectID, Planet planet, String template) { super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); messageBuilder = new TangibleMessageBuilder(this); + if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1); } public TangibleObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { super(objectID, planet, position, orientation, template); messageBuilder = new TangibleMessageBuilder(this); spawnCoordinates = position.clone(); + if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1); } public TangibleObject() { @@ -92,12 +97,20 @@ public class TangibleObject extends SWGObject { this.incapTimer = incapTimer; } - public int getConditionDamage() { + public synchronized int getConditionDamage() { return conditionDamage; } - public void setConditionDamage(int conditionDamage) { + public synchronized void setConditionDamage(int conditionDamage) { + if(conditionDamage < 0) + conditionDamage = 0; + else if(conditionDamage > getMaxDamage()) + conditionDamage = getMaxDamage(); this.conditionDamage = conditionDamage; + notifyObservers(messageBuilder.buildConditionDamageDelta(conditionDamage), false); + if (maxDamage > 0) { + this.setStringAttribute("condition", (maxDamage + "/" + (maxDamage - conditionDamage))); + } } public byte[] getCustomization() { @@ -123,13 +136,35 @@ public class TangibleObject extends SWGObject { public void setOptionsBitmask(int optionsBitmask) { this.optionsBitmask = optionsBitmask; } - + + public void setOptions(int options, boolean add) { + synchronized(objectMutex) { + if (options != 0) { + if (add) { + addOption(options); + } else { + removeOption(options); + } + } + } + } + + public void addOption(int option) { + setOptionsBitmask(getOptionsBitmask() | option); + } + + public void removeOption(int option) { + setOptionsBitmask(getOptionsBitmask() & ~option); + } + public int getMaxDamage() { return maxDamage; } public void setMaxDamage(int maxDamage) { this.maxDamage = maxDamage; + + this.setStringAttribute("condition", (maxDamage + "/" + (maxDamage - conditionDamage))); } public boolean isStaticObject() { @@ -142,7 +177,7 @@ public class TangibleObject extends SWGObject { public int getPvPBitmask() { synchronized(objectMutex) { - return optionsBitmask; + return pvpBitmask; } } @@ -152,6 +187,24 @@ public class TangibleObject extends SWGObject { } } + public boolean getPvpStatus(int pvpStatus) { + synchronized(objectMutex) { + return ((pvpBitmask & pvpStatus) != 0); + } + } + + public void setPvpStatus(int pvpBitmask, boolean add) { + synchronized(objectMutex) { + if (pvpBitmask != 0) { + if (add) { + this.pvpBitmask |= pvpBitmask; + } else { + this.pvpBitmask &= ~pvpBitmask; + } + } + } + } + public String getFaction() { synchronized(objectMutex) { return faction; @@ -245,15 +298,15 @@ public class TangibleObject extends SWGObject { } } - public void showFlyText(String stfFile, String stfString, int xp, float scale, RGB color, int displayType) { + public void showFlyText(String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType) { Set observers = getObservers(); if (getClient() != null) { - getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, xp, scale, color, displayType))).serialize()); + getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize()); } for (Client client : observers) { - client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, xp, scale, color, displayType))).serialize()); + client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize()); } } @@ -277,6 +330,18 @@ public class TangibleObject extends SWGObject { } } + public TangibleObject getKiller() { + synchronized(objectMutex) { + return killer; + } + } + + public void setKiller(TangibleObject killer) { + synchronized(objectMutex) { + this.killer = killer; + } + } + @Override public void sendBaselines(Client destination) { @@ -291,6 +356,11 @@ public class TangibleObject extends SWGObject { destination.getSession().write(messageBuilder.buildBaseline8()); destination.getSession().write(messageBuilder.buildBaseline9()); + UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); + upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); + upvpm.setStatus(1); + destination.getSession().write(upvpm.serialize()); + } diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 9f0b8381..368ebb18 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -54,6 +54,7 @@ public class WeaponObject extends SWGObject { public WeaponObject(long objectID, Planet planet, String template) { super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); messageBuilder = new WeaponMessageBuilder(this); + if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); calculateRange(); calculateAttackSpeed(); } @@ -61,6 +62,7 @@ public class WeaponObject extends SWGObject { public WeaponObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { super(objectID, planet, position, orientation, template); messageBuilder = new WeaponMessageBuilder(this); + if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); calculateRange(); calculateAttackSpeed(); } diff --git a/src/services/BuffService.java b/src/services/BuffService.java index 8e28b62c..1c2fd7a0 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -21,41 +21,22 @@ ******************************************************************************/ package services; -import java.nio.ByteOrder; import java.util.Map; -import java.util.Vector; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import org.python.core.Py; +import org.python.core.PyObject; - - - - - - - - - - - -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.session.IoSession; - -import protocol.swg.ObjControllerMessage; -import protocol.swg.objectControllerObjects.BuffBuilderStartMessage; -import resources.common.Console; import resources.common.FileUtilities; -import resources.common.ObjControllerOpcodes; import resources.objects.Buff; -import resources.objects.BuffItem; import resources.objects.DamageOverTime; import resources.objects.creature.CreatureObject; +import resources.objects.group.GroupObject; import resources.objects.player.PlayerObject; import main.NGECore; -import engine.clients.Client; import engine.resources.objects.SWGObject; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -63,7 +44,7 @@ import engine.resources.service.INetworkRemoteEvent; public class BuffService implements INetworkDispatch { private NGECore core; - private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public BuffService(NGECore core) { this.core = core; @@ -86,6 +67,16 @@ public class BuffService implements INetworkDispatch { return; }*/ + final Buff buff = new Buff(buffName, creature.getObjectID()); + if(buff.isGroupBuff()) { + addGroupBuff(creature, buffName); + } else { + doAddBuff(creature, buffName); + } + } + + public Buff doAddBuff(final CreatureObject creature, String buffName) { + final Buff buff = new Buff(buffName, creature.getObjectID()); buff.setTotalPlayTime(((PlayerObject) creature.getSlottedObject("ghost")).getTotalPlayTime()); @@ -104,7 +95,7 @@ public class BuffService implements INetworkDispatch { } if (otherBuff.getRemainingDuration() > buff.getDuration() && otherBuff.getStacks() >= otherBuff.getMaxStacks()) { - return; + return null; } } @@ -112,7 +103,7 @@ public class BuffService implements INetworkDispatch { break; } else { System.out.println("buff not added:" + buffName); - return; + return null; } } @@ -139,8 +130,25 @@ public class BuffService implements INetworkDispatch { } + for (String effect : buff.getParticleEffect().split(",")) { + creature.playEffectObject(effect, buff.getBuffName()); + } + + if (!buff.getCallback().equals("")) { + if (FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/buffs/", buff.getBuffName(), buff.getCallback()); + + if (method != null && method.isCallable()) { + method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(buff)); + } + } + } + + return buff; + } + @SuppressWarnings("unused") public void removeBuffFromCreature(CreatureObject creature, Buff buff) { if(!creature.getBuffList().contains(buff)) @@ -154,6 +162,10 @@ public class BuffService implements INetworkDispatch { core.scriptService.callScript("scripts/buffs/", "removeBuff", buff.getBuffName(), core, creature, buff); creature.removeBuff(buff); + for (String effect : buff.getParticleEffect().split(",")) { + creature.stopEffectObject(buff.getBuffName()); + } + } @@ -164,6 +176,11 @@ public class BuffService implements INetworkDispatch { for(final Buff buff : creature.getBuffList().get().toArray(new Buff[] { })) { if (buff.getGroup1().startsWith("setBonus")) { continue; } + + if(buff.isGroupBuff() && buff.getGroupBufferId() != creature.getObjectID()) { + removeBuffFromCreature(creature, buff); + continue; + } if(buff.getRemainingDuration() > 0 && buff.getDuration() > 0) { ScheduledFuture task = scheduler.schedule(new Runnable() { @@ -186,6 +203,24 @@ public class BuffService implements INetworkDispatch { } - + public void addGroupBuff(final CreatureObject buffer, String buffName) { + + if(buffer.getGroupId() == 0) { + doAddBuff(buffer, buffName); + return; + } + + GroupObject group = (GroupObject) core.objectService.getObject(buffer.getGroupId()); + + if(group == null) { + doAddBuff(buffer, buffName); + return; + } + + for(SWGObject member : group.getMemberList()) { + Buff buff = doAddBuff((CreatureObject) member, buffName); + buff.setGroupBufferId(buffer.getObjectID()); + } + } } diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 7797d46d..1be62a7a 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -37,13 +37,14 @@ import engine.clients.Client; import engine.resources.common.CRC; import engine.resources.container.CreatureContainerPermissions; import engine.resources.container.CreaturePermissions; +import engine.resources.container.Traverser; import engine.resources.database.DatabaseConnection; +import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import resources.common.*; - import protocol.swg.ClientCreateCharacter; import protocol.swg.ClientMfdStatusUpdateMessage; import protocol.swg.ClientRandomNameRequest; @@ -52,8 +53,8 @@ import protocol.swg.ClientVerifyAndLockNameRequest; import protocol.swg.ClientVerifyAndLockNameResponse; import protocol.swg.CreateCharacterSuccess; import protocol.swg.HeartBeatMessage; - import resources.objects.creature.CreatureObject; +import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; @@ -226,8 +227,10 @@ public class CharacterService implements INetworkDispatch { object.setPosition(new Point3D(3528, 0, -4804)); object.setCashCredits(100); object.setBankCredits(1000); + object.setOptionsBitmask(0x80); //object.setPosition(new Point3D(0, 0, 0)); object.setOrientation(new Quaternion(1, 0, 0, 0)); + object.setLevel((short) 1); float luck = (((((float) (core.scriptService.getMethod("scripts/roadmap/", clientCreateCharacter.getProfession(), "getLuck").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", object.getStfName(), "getLuck").__call__().asInt())) / ((float) 90)) * ((float) object.getLevel())) - ((float) object.getSkillModBase("luck"))); float precision = (((((float) (core.scriptService.getMethod("scripts/roadmap/", clientCreateCharacter.getProfession(), "getPrecision").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", object.getStfName(), "getPrecision").__call__().asInt())) / ((float) 90)) * ((float) object.getLevel())) - ((float) object.getSkillModBase("precision"))); float strength = (((((float) (core.scriptService.getMethod("scripts/roadmap/", clientCreateCharacter.getProfession(), "getStrength").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", object.getStfName(), "getStrength").__call__().asInt())) / ((float) 90)) * ((float) object.getLevel())) - ((float) object.getSkillModBase("strength"))); @@ -240,10 +243,12 @@ public class CharacterService implements INetworkDispatch { if (constitution >= 1) core.skillModService.addSkillMod(object, "constitution", (int) constitution); if (stamina >= 1) core.skillModService.addSkillMod(object, "stamina", (int) stamina); if (agility >= 1) core.skillModService.addSkillMod(object, "agility", (int) agility); + object.createTransaction(core.getCreatureODB().getEnvironment()); PlayerObject player = (PlayerObject) core.objectService.createObject("object/player/shared_player.iff", object.getPlanet()); object._add(player); + core.skillService.addSkill(object, "species_" + object.getStfName()); player.setProfession(clientCreateCharacter.getProfession()); player.setProfessionWheelPosition(clientCreateCharacter.getProfessionWheelPosition()); if(clientCreateCharacter.getHairObject().length() > 0) { @@ -270,6 +275,14 @@ public class CharacterService implements INetworkDispatch { object._add(datapad); object._add(bank); object._add(missionBag); + + /*for(int missionsAdded = 0; missionsAdded < 12; missionsAdded++) { + MissionObject mission = (MissionObject) core.objectService.createObject("object/mission/shared_mission_object.iff", object.getPlanet()); + + missionBag._add(mission); + Console.println("Added empty mission " + missionsAdded); + }*/ + TangibleObject backpack = (TangibleObject) core.objectService.createObject("object/tangible/wearables/backpack/shared_backpack_galactic_marine.iff", object.getPlanet()); inventory._add(backpack); //object.addObjectToEquipList(datapad); @@ -310,7 +323,7 @@ public class CharacterService implements INetworkDispatch { session.write(core.loginService.getLoginClusterStatus().serialize()); session.write(success.serialize()); - session.write((new ClientMfdStatusUpdateMessage((float) 2, "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize()); + session.write((new ClientMfdStatusUpdateMessage((float) 2, "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize()); } }); diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index e5789cb0..60a6d7a0 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -1,6 +1,8 @@ package services; import java.nio.ByteOrder; +import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; @@ -17,6 +19,7 @@ import protocol.swg.objectControllerObjects.BuffBuilderStartMessage; import resources.common.BuffBuilder; import resources.common.Console; import resources.common.ObjControllerOpcodes; +import resources.common.Performance; import resources.objects.Buff; import resources.objects.BuffItem; import resources.objects.creature.CreatureObject; @@ -33,10 +36,15 @@ public class EntertainmentService implements INetworkDispatch { private NGECore core; private Vector buffBuilderSkills = new Vector(); + //FIXME: create a wrapper class for double key lookup maps + private HashMap performances = new HashMap(); + private HashMap danceMap = new HashMap(); public EntertainmentService(NGECore core) { this.core = core; populateSkillCaps(); + populatePerformanceTable(); + registerCommands(); } @Override @@ -86,6 +94,16 @@ public class EntertainmentService implements INetworkDispatch { 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()) { + recipientCreature.setCashCredits(recipientCreature.getCashCredits() - sentPacket.getBuffCost()); + } else { + return; + } + } + OkMessage closeMsg = new OkMessage(); buffer.getClient().getSession().write(closeMsg.serialize()); @@ -118,6 +136,59 @@ public class EntertainmentService implements INetworkDispatch { }); } + private void populatePerformanceTable() { + + try { + DatatableVisitor PerformanceVisitor = ClientFileManager.loadFile("datatables/performance/performance.iff", DatatableVisitor.class); + + //rformanceVisitor. + + for (int r = 0; r < PerformanceVisitor.getRowCount(); r++) { + Performance p = new Performance(); + + /* for (int j=0; j < PerformanceVisitor.getColumnCount(); j++) { + System.out.println(j + ": " + PerformanceVisitor.getObject(r, j)); + }*/ + + p.setPerformanceName( ( (String) PerformanceVisitor.getObject(r, 0) ).toLowerCase()); + p.setInstrumentAudioId((int) PerformanceVisitor.getObject(r, 1)); + p.setRequiredSong((String) PerformanceVisitor.getObject(r, 2)); + p.setRequiredInstrument((String) PerformanceVisitor.getObject(r, 3)); + p.setRequiredDance((String) PerformanceVisitor.getObject(r, 4)); + p.setDanceVisualId((int) PerformanceVisitor.getObject(r, 5)); + p.setActionPointsPerLoop((int) PerformanceVisitor.getObject(r, 6)); + p.setLoopDuration((float) PerformanceVisitor.getObject(r, 7)); + p.setType((int) PerformanceVisitor.getObject(r, 8)); + p.setBaseXp((int) PerformanceVisitor.getObject(r, 9)); + p.setFlourishXpMod((int) PerformanceVisitor.getObject(r, 10)); + p.setHealMindWound((int) PerformanceVisitor.getObject(r, 11)); + p.setHealShockWound((int) PerformanceVisitor.getObject(r, 12)); + p.setRequiredSkillMod((String) PerformanceVisitor.getObject(r, 13)); + p.setRequiredSkillModValue((int) PerformanceVisitor.getObject(r, 14)); + p.setMainloop((String) PerformanceVisitor.getObject(r, 15)); + p.setFlourish1((String) PerformanceVisitor.getObject(r, 16)); + p.setFlourish2((String) PerformanceVisitor.getObject(r, 17)); + p.setFlourish3((String) PerformanceVisitor.getObject(r, 18)); + p.setFlourish4((String) PerformanceVisitor.getObject(r, 19)); + p.setFlourish5((String) PerformanceVisitor.getObject(r, 20)); + p.setFlourish6((String) PerformanceVisitor.getObject(r, 21)); + p.setFlourish7((String) PerformanceVisitor.getObject(r, 22)); + p.setFlourish8((String) PerformanceVisitor.getObject(r, 23)); + p.setIntro((String) PerformanceVisitor.getObject(r, 24)); + p.setOutro((String) PerformanceVisitor.getObject(r, 25)); + p.setLineNumber(r); + + if (p.getType() == -1788534963) { + danceMap.put(new Integer(p.getDanceVisualId()), p); + } + performances.put(p.getPerformanceName(), p); + } + + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + } + private void populateSkillCaps() { try { DatatableVisitor buffBuilder = ClientFileManager.loadFile("datatables/buff/buff_builder.iff", DatatableVisitor.class); @@ -142,6 +213,15 @@ public class EntertainmentService implements INetworkDispatch { e.printStackTrace(); } } + + private void registerCommands() { + core.commandService.registerCommand("bandflourish"); + core.commandService.registerCommand("flourish"); + core.commandService.registerAlias("flo","flourish"); + core.commandService.registerCommand("groupdance"); + core.commandService.registerCommand("startdance"); + core.commandService.registerCommand("stopdance"); + } public void giveInspirationBuff(SWGObject reciever, Vector buffVector) { CreatureObject buffCreature = (CreatureObject) reciever; @@ -153,11 +233,9 @@ public class EntertainmentService implements INetworkDispatch { for (BuffItem item : buffVector) { for (BuffBuilder builder : availableSkills) { if (builder.getStatName().equals(item.getSkillName())) { - builder.setEntBonus(item.getAmount()); + builder.setEntBonus(item.getBonusAmount()); buffsToAdd.add(builder); - Console.println("Added buff item: " + builder.getStatName()); - break; - } else { + Console.println("Added buff item: " + builder.getStatAffects() + " with total affect of " + builder.getTotalAffected() + " and ent bonus of " + builder.getEntBonus()); continue; } } @@ -169,6 +247,49 @@ public class EntertainmentService implements INetworkDispatch { } + public int getDanceVisualId(String danceName) { + Performance p = performances.get(danceName); + + //if 0 , then it's no dance. need to handle that in the script. + return p.getDanceVisualId(); + } + + public Map getAvailableDances(CreatureObject actor) { + + Map dances = new HashMap(); + for (int index : danceMap.keySet()) { + if (!canDance(actor, danceMap.get(index) )) { continue; } + dances.put( new Long( danceMap.get(index).getDanceVisualId() ), danceMap.get(index).getPerformanceName() ); + } + + return dances; + + } + + public boolean isDance(int visualId) { + return ( danceMap.get(visualId) != null ) ; + } + + public boolean canDance(CreatureObject actor, Performance dance) { + if (actor.hasAbility(dance.getRequiredDance())) { + return true; + } + return false; + } + + public boolean canDance(CreatureObject actor, int visualId) { + if (!isDance(visualId)) { return false; } + return canDance(actor, danceMap.get(visualId)); + } + + public Performance getDance(int visualId) { + return danceMap.get(visualId); + } + + public Performance getPerformance(String name) { + return performances.get(name); + } + @Override public void shutdown() { diff --git a/src/services/GroupService.java b/src/services/GroupService.java index b3c1832f..0df7fd2c 100644 --- a/src/services/GroupService.java +++ b/src/services/GroupService.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import resources.objects.Buff; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; @@ -150,6 +151,8 @@ public class GroupService implements INetworkDispatch { leader.setGroupId(group.getObjectID()); invited.makeAware(group); invited.setGroupId(group.getObjectID()); + addGroupBuffsToMember(group, leader); + addGroupBuffsToMember(group, invited); return; } @@ -162,6 +165,7 @@ public class GroupService implements INetworkDispatch { invited.makeAware(group); invited.setGroupId(group.getObjectID()); invited.sendSystemMessage("@group:joined_self", (byte) 0); + addGroupBuffsToMember(group, invited); } else if(group.getMemberList().size() >= 8) { @@ -175,10 +179,33 @@ public class GroupService implements INetworkDispatch { } + } + + public void addGroupBuffsToMember(GroupObject group, CreatureObject member) { + // loop until we find a member other than ourself + for(SWGObject otherMember : group.getMemberList()) { + if(otherMember != member) { + for(Buff buff : ((CreatureObject) otherMember).getBuffList().get()) { + if(buff.isGroupBuff()) { + Buff newBuff = core.buffService.doAddBuff(member, buff.getBuffName()); + newBuff.setGroupBufferId(buff.getGroupBufferId()); + } + } + return; + } + } } + public void removeGroupBuffs(CreatureObject member) { + for(Buff buff : new ArrayList(member.getBuffList().get())) { + if(buff.isGroupBuff() && buff.getGroupBufferId() != member.getObjectID()) { + core.buffService.removeBuffFromCreature(member, buff); + } + } + } + public void handleGroupDisband(CreatureObject creature) { if(creature.getGroupId() == 0) @@ -201,7 +228,7 @@ public class GroupService implements INetworkDispatch { creature.setGroupId(0); creature.makeUnaware(group); creature.sendSystemMessage("You have left the group.", (byte) 0); - + for(SWGObject member : memberList) { CreatureObject creature2 = (CreatureObject) member; @@ -209,6 +236,8 @@ public class GroupService implements INetworkDispatch { } + removeGroupBuffs(creature); + } else { for(SWGObject member : memberList) { @@ -224,7 +253,9 @@ public class GroupService implements INetworkDispatch { creature2.makeUnaware(group); creature2.sendSystemMessage("The group has been disbanded.", (byte) 0); - + + removeGroupBuffs((CreatureObject) member); + } core.objectService.destroyObject(group.getObjectID()); diff --git a/src/services/MissionService.java b/src/services/MissionService.java new file mode 100644 index 00000000..4eaca9bb --- /dev/null +++ b/src/services/MissionService.java @@ -0,0 +1,215 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services; + +import java.nio.ByteOrder; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +import main.NGECore; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; + +import protocol.swg.objectControllerObjects.MissionListRequest; +import resources.common.Console; +import resources.common.TerminalType; +import resources.common.ObjControllerOpcodes; +import resources.objects.creature.CreatureObject; +import resources.objects.mission.MissionObject; +import resources.objects.tangible.TangibleObject; +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.DatatableVisitor; +import engine.clients.Client; +import engine.resources.container.Traverser; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class MissionService implements INetworkDispatch { + + private NGECore core; + + public MissionService(NGECore core) { + this.core = core; + } + + @Override + public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + objControllerOpcodes.put(ObjControllerOpcodes.MISSION_LIST_REQUEST, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + data.order(ByteOrder.LITTLE_ENDIAN); + + MissionListRequest request = new MissionListRequest(); + request.deserialize(data); + + Client client = core.getClient((Integer) session.getAttribute("connectionId")); + + if(client == null || client.getSession() == null) + return; + + SWGObject object = client.getParent(); + + if(object == null) + return; + + SWGObject terminal = core.objectService.getObject(request.getTerminalId()); + + int terminalType = (int) terminal.getAttachment("terminalType"); + + if (terminalType == TerminalType.MISSION_GENERIC) { + populateMissions(core.objectService.getObject(request.getObjectId()), TerminalType.MISSION_GENERIC); + } else if (terminalType == TerminalType.MISSION_BOUNTYHUNTER) { + + } else if (terminalType == TerminalType.MISSION_ENTERTAINER) { + + } else if (terminalType == TerminalType.MISSION_ARTISAN) { + + } else { + Console.println("ERROR: Unsupported terminal " + terminal.getObjectId()); + } + } + + }); + } + + private void populateMissions(final SWGObject player, int type) { + CreatureObject creature = (CreatureObject) player; + TangibleObject missionBag = (TangibleObject) creature.getSlottedObject("mission_bag"); + + final AtomicInteger deliveryCount = new AtomicInteger(); + final AtomicInteger destroyCount = new AtomicInteger(); + + final int deliveryEntries = 30; + + final Random ran = new Random(); + + final int bagSize = core.objectService.objsInContainer(creature, missionBag); + Console.println("Delivery Entries: " + deliveryEntries); + if (bagSize != 12) { + for(int missionsAdded = 0; missionsAdded < 12; missionsAdded++) { + MissionObject mission = (MissionObject) core.objectService.createObject("object/mission/shared_mission_object.iff", creature.getPlanet()); + + int textId = ran.nextInt(deliveryEntries); + + Console.println("Random Int Value: " + textId); + Console.println("Now the value is: " + textId); + + mission.setMissionLevel(5); + + mission.setMissionStart(0, 0, 0, player.getPlanet().name); + + mission.setMissionCreator("Waverunner"); + mission.setMissionCredits(9000); + + // TODO: Base this off of textId + f + mission.setTargetTemplateObject("object/tangible/mission/shared_mission_datadisk.iff"); + // TODO: Base this off of textId + l + mission.setMissionTargetName("Osskscosco"); + + mission.setMissionDescription("mission/mission_deliver_neutral_easy", "m" + textId + "d"); + mission.setMissionTitle("mission/mission_deliver_neutral_easy", "m" + textId + "t"); + + mission.setMissionType("deliver"); + + mission.setMissionDestination(-5962, 0, -6259, player.getPlanet().name); + deliveryCount.getAndIncrement(); + + + missionBag._add(mission); + Console.println("Added mission " + missionsAdded); + } + return; + } + + missionBag.viewChildren(player, false, false, new Traverser() { + + @Override + public void process(SWGObject child) { + if (deliveryCount.get() == 6) + return; + + MissionObject mission = (MissionObject) child; + int textId = ran.nextInt(deliveryEntries); + + Console.println("Random Int Value: " + textId); + Console.println("Now the value is: " + textId); + + mission.setMissionLevel(5); + + mission.setMissionStart(0, 0, 0, player.getPlanet().name); + + mission.setMissionCreator("Waverunner"); + mission.setMissionCredits(9000); + + // TODO: Base this off of textId + f + mission.setTargetTemplateObject("object/tangible/mission/shared_mission_datadisk.iff"); + // TODO: Base this off of textId + l + mission.setMissionTargetName("Osskscosco"); + + mission.setMissionDescription("mission/mission_deliver_neutral_easy", "m" + textId + "d"); + mission.setMissionTitle("mission/mission_deliver_neutral_easy", "m" + textId + "t"); + + mission.setMissionType("deliver"); + + mission.setMissionDestination(-5962, 0, -6259, player.getPlanet().name); + deliveryCount.getAndIncrement(); + } + + }); + + Console.println("Outside of the traverser now!"); + } + + // May want to create a map for the server with needed info + public int getNumberOfEntries(String stf) { + try { + DatatableVisitor stfFile = ClientFileManager.loadFile(stf, DatatableVisitor.class); + + for (int s = 0; s < stfFile.getRowCount(); s++) { + String name = ((String) stfFile.getObject(s, 3)); + Console.println("Name: " + name); + if (name.equals("number_of_entries")) { + int entryCount = ((int) stfFile.getObject(s, 4)); + Console.println("Entry Count: " + entryCount); + return entryCount; + } + } + } + catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + + return 0; + } + + @Override + public void shutdown() { + + } + +} diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index ed08b68b..453c7945 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -109,6 +109,7 @@ public class PlayerService implements INetworkDispatch { PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); player.setTotalPlayTime(player.getTotalPlayTime() + 30); player.setLastPlayTimeUpdate(System.currentTimeMillis()); + core.collectionService.checkExplorationRegions(creature); } @@ -169,7 +170,7 @@ public class PlayerService implements INetworkDispatch { }); - swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() { + /*swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() { @Override public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { @@ -198,7 +199,7 @@ public class PlayerService implements INetworkDispatch { } - }); + });*/ } @@ -329,7 +330,7 @@ public class PlayerService implements INetworkDispatch { // 1. Add the experience. if (experience > 0) { - creature.showFlyText("base_player", "prose_flytext_xp", experience, (float) 2.5, new RGB(180, 60, 240), 1); + creature.showFlyText("base_player", "prose_flytext_xp", "", experience, (float) 2.5, new RGB(180, 60, 240), 1); } String xpType = ((player.getProfession().contains("entertainer")) ? "entertainer" : ((player.getProfession().contains("trader")) ? "crafting" : "combat_general")); diff --git a/src/services/ScriptService.java b/src/services/ScriptService.java index e7d3b966..791e3cd5 100644 --- a/src/services/ScriptService.java +++ b/src/services/ScriptService.java @@ -45,6 +45,7 @@ public class ScriptService { PyObject func = interpreter.get(method); func.__call__(Py.java2py(core));*/ PythonInterpreter python = new PythonInterpreter(); + python.cleanup(); python.execfile(path + module + ".py"); return python.get(method).__call__(); } @@ -56,6 +57,7 @@ public class ScriptService { PyObject func = interpreter.get(method); func.__call__(Py.java2py(core), Py.java2py(arg1));*/ PythonInterpreter python = new PythonInterpreter(); + python.cleanup(); python.execfile(path + module + ".py"); return python.get(method).__call__(Py.java2py(arg1)); } @@ -67,6 +69,7 @@ public class ScriptService { PyObject func = interpreter.get(method); func.__call__(Py.java2py(arg1), Py.java2py(arg2));*/ PythonInterpreter python = new PythonInterpreter(); + python.cleanup(); python.execfile(path + module + ".py"); return python.get(method).__call__(Py.java2py(arg1), Py.java2py(arg2)); } @@ -78,6 +81,7 @@ public class ScriptService { PyObject func = interpreter.get(method); func.__call__(Py.java2py(arg1), Py.java2py(arg2), Py.java2py(arg3));*/ PythonInterpreter python = new PythonInterpreter(); + python.cleanup(); python.execfile(path + module + ".py"); return python.get(method).__call__(Py.java2py(arg1), Py.java2py(arg2), Py.java2py(arg3)); @@ -90,12 +94,14 @@ public class ScriptService { PyObject func = interpreter.get(method); func.__call__(Py.java2py(arg1), Py.java2py(arg2), Py.java2py(arg3), Py.java2py(arg4));*/ PythonInterpreter python = new PythonInterpreter(); + python.cleanup(); python.execfile(path + module + ".py"); return python.get(method).__call__(Py.java2py(arg1), Py.java2py(arg2), Py.java2py(arg3), Py.java2py(arg4)); } public PyObject getMethod(String path, String module, String method) { PythonInterpreter python = new PythonInterpreter(); + python.cleanup(); python.execfile(path + module + ".py"); PyObject func = python.get(method); return func; diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 443d57cb..3d9af0fb 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -42,6 +42,7 @@ import engine.clientdata.visitors.MeshVisitor; import engine.clientdata.visitors.PortalVisitor; import engine.clientdata.visitors.PortalVisitor.Cell; import engine.clients.Client; +import engine.resources.common.Event; import engine.resources.common.Mesh3DTriangle; import engine.resources.common.Ray; import engine.resources.objects.SWGObject; @@ -68,7 +69,10 @@ import protocol.swg.objectControllerObjects.TargetUpdate; import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; +import resources.objects.tangible.TangibleObject; import resources.common.*; +import resources.common.collidables.AbstractCollidable; +import services.ai.LairActor; import toxi.geom.Line3D; import toxi.geom.Ray3D; import toxi.geom.Vec3D; @@ -91,6 +95,9 @@ import wblut.math.WB_M44; public class SimulationService implements INetworkDispatch { Map> quadTrees; + Map> collidableQuadTrees; + + private NGECore core; private Map cellMeshes = new ConcurrentHashMap(); @@ -98,9 +105,11 @@ public class SimulationService implements INetworkDispatch { this.core = core; TerrainService terrainService = core.terrainService; quadTrees = new ConcurrentHashMap>(); + collidableQuadTrees = new ConcurrentHashMap>(); for (int i = 0; i < core.terrainService.getPlanetList().size(); i++) { quadTrees.put(terrainService.getPlanetList().get(i).getName(), new QuadTree(-8192, -8192, 8192, 8192)); + collidableQuadTrees.put(terrainService.getPlanetList().get(i).getName(), new QuadTree(-8192, -8192, 8192, 8192)); } core.commandService.registerCommand("opencontainer"); @@ -135,6 +144,8 @@ public class SimulationService implements INetworkDispatch { core.commandService.registerCommand("boardshuttle"); core.commandService.registerCommand("getplayerid"); core.commandService.registerCommand("inspire"); + core.commandService.registerCommand("setgodmode"); + core.commandService.registerCommand("requestwaypointatposition"); } @@ -146,6 +157,18 @@ public class SimulationService implements INetworkDispatch { } } + public void addCollidable(AbstractCollidable collidable, float x, float y) { + collidableQuadTrees.get(collidable.getPlanet().getName()).put(x, y, collidable); + } + + public void removeCollidable(AbstractCollidable collidable, float x, float y) { + collidableQuadTrees.get(collidable.getPlanet().getName()).remove(x, y, collidable); + } + + public List getCollidables(Planet planet, float x, float y, float range) { + return collidableQuadTrees.get(planet.getName()).get(x, y, range); + } + public void add(SWGObject object, int x, int y) { object.setIsInQuadtree(true); core.objectService.loadServerTemplate(object); @@ -248,7 +271,7 @@ public class SimulationService implements INetworkDispatch { // + " should be: " + dataTransform.getYPosition()); UpdateTransformMessage utm = new UpdateTransformMessage(object.getObjectID(), dataTransform.getTransformedX(), dataTransform.getTransformedY(), dataTransform.getTransformedZ(), dataTransform.getMovementCounter(), (byte) dataTransform.getMovementAngle(), dataTransform.getSpeed()); - List newAwareObjects = get(object.getPlanet(), newPos.x, newPos.z, 200); + List newAwareObjects = get(object.getPlanet(), newPos.x, newPos.z, 512); ArrayList oldAwareObjects = new ArrayList(object.getAwareObjects()); Collection updateAwareObjects = CollectionUtils.intersection(oldAwareObjects, newAwareObjects); object.notifyObservers(utm, false); @@ -256,6 +279,8 @@ public class SimulationService implements INetworkDispatch { for(int i = 0; i < oldAwareObjects.size(); i++) { SWGObject obj = oldAwareObjects.get(i); if(!updateAwareObjects.contains(obj) && obj != object && obj.getWorldPosition().getDistance2D(newPos) > 200 && obj.isInQuadtree() /*&& obj.getParentId() == 0*/) { + if(obj.getAttachment("bigSpawnRange") != null && obj.getWorldPosition().getDistance2D(newPos) < 512) + continue; object.makeUnaware(obj); if(obj.getClient() != null) obj.makeUnaware(object); @@ -263,14 +288,17 @@ public class SimulationService implements INetworkDispatch { } for(int i = 0; i < newAwareObjects.size(); i++) { SWGObject obj = newAwareObjects.get(i); - if(!updateAwareObjects.contains(obj) && obj != object && !object.getAwareObjects().contains(obj) && obj.getWorldPosition().getDistance2D(newPos) <= 200 && obj.getContainer() != object && obj.isInQuadtree()) { + //System.out.println(obj.getTemplate()); + if(!updateAwareObjects.contains(obj) && obj != object && !object.getAwareObjects().contains(obj) && obj.getContainer() != object && obj.isInQuadtree()) { + if(obj.getAttachment("bigSpawnRange") == null && obj.getWorldPosition().getDistance2D(newPos) > 200) + continue; object.makeAware(obj); if(obj.getClient() != null) obj.makeAware(object); } } - + checkForCollidables(object); } @@ -321,6 +349,8 @@ public class SimulationService implements INetworkDispatch { object.setOrientation(newOrientation); object.setMovementCounter(dataTransform.getMovementCounter()); object.notifyObservers(utm, false); + + checkForCollidables(object); } @@ -461,6 +491,14 @@ public class SimulationService implements INetworkDispatch { if(object.getGroupId() != 0) core.groupService.handleGroupDisband(object); + Point3D objectPos = object.getWorldPosition(); + + List collidables = getCollidables(object.getPlanet(), objectPos.x, objectPos.z, 512); + + for(AbstractCollidable collidable : collidables) { + collidables.remove(object); + } + if (ghost != null) { String objectShortName = object.getCustomName(); @@ -510,14 +548,14 @@ public class SimulationService implements INetworkDispatch { CreatureObject object = (CreatureObject) client.getParent(); Quaternion orientation = object.getOrientation(); Point3D position = object.getPosition(); - - Point3D pos = object.getWorldPosition(); - - Collection newAwareObjects = get(object.getPlanet(), pos.x, pos.z, 200); + + Collection newAwareObjects = get(object.getPlanet(), pos.x, pos.z, 512); for(Iterator it = newAwareObjects.iterator(); it.hasNext();) { SWGObject obj = it.next(); + if(obj.getAttachment("bigSpawnRange") == null & obj.getWorldPosition().getDistance(pos) > 200) + continue; object.makeAware(obj); if(obj.getClient() != null) obj.makeAware(object); @@ -525,36 +563,8 @@ public class SimulationService implements INetworkDispatch { if(object.getParentId() == 0) add(object, pos.x, pos.z); - + PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); - if (ghost != null) { - - String objectShortName = object.getCustomName().toLowerCase(); - - if (object.getCustomName().contains(" ")) { - String[] splitName = object.getCustomName().toLowerCase().split(" "); - objectShortName = splitName[0].toLowerCase(); - } - - core.chatService.playerStatusChange(objectShortName, (byte) 1); - - if (ghost.getFriendList().isEmpty() == false) { - // Find out what friends are online/offline - for (String friend : ghost.getFriendList()) { - SWGObject friendObject = (SWGObject) core.chatService.getObjectByFirstName(friend); - if (friendObject == null) - continue; - if(friendObject.isInQuadtree() == true) { - ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend, (byte) 1); - client.getSession().write(onlineNotifyStatus.serialize()); - - } else { - ChatOnChangeFriendStatus changeStatus = new ChatOnChangeFriendStatus(object.getObjectID(), friend, 0); - client.getSession().write(changeStatus.serialize()); - } - } - } - } core.weatherService.sendWeather(object); @@ -910,5 +920,20 @@ public class SimulationService implements INetworkDispatch { } } + + public void checkForCollidables(SWGObject object) { + Point3D objectPos = object.getWorldPosition(); + List collidables = getCollidables(object.getPlanet(), objectPos.x, objectPos.z, 256); + + for(AbstractCollidable collidable : collidables) { + collidable.doCollisionCheck(object); + } + } + + public class MoveEvent implements Event { + + public SWGObject object; + + } } diff --git a/src/services/SkillModService.java b/src/services/SkillModService.java index f7fabe0e..dfc1bb56 100644 --- a/src/services/SkillModService.java +++ b/src/services/SkillModService.java @@ -23,6 +23,7 @@ package services; import java.util.Map; +import resources.common.FileUtilities; import resources.objects.SWGList; import resources.objects.creature.CreatureObject; import main.NGECore; @@ -40,13 +41,19 @@ public class SkillModService implements INetworkDispatch { public void addSkillMod(CreatureObject creature, String skillMod, int value) { - core.scriptService.callScript("scripts/skillMods/", skillMod, "add", core, creature, skillMod, value); - + if(FileUtilities.doesFileExist("scripts/skillMods/" + skillMod + ".py")) + core.scriptService.callScript("scripts/skillMods/", skillMod, "add", core, creature, skillMod, value); + else + creature.addSkillMod(skillMod, value); } public void deductSkillMod(CreatureObject creature, String skillMod, int value) { - core.scriptService.callScript("scripts/skillMods/", skillMod, "deduct", core, creature, skillMod, value); + if(FileUtilities.doesFileExist("scripts/skillMods/" + skillMod + ".py")) + core.scriptService.callScript("scripts/skillMods/", skillMod, "deduct", core, creature, skillMod, value); + else + creature.deductSkillMod(skillMod, value); + } diff --git a/src/services/SkillService.java b/src/services/SkillService.java index 5fa961b5..c90d1095 100644 --- a/src/services/SkillService.java +++ b/src/services/SkillService.java @@ -21,14 +21,23 @@ ******************************************************************************/ package services; +import java.nio.ByteOrder; import java.util.Map; +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; + +import protocol.swg.ExpertiseRequestMessage; + import resources.common.Console; +import resources.common.FileUtilities; +import resources.common.Opcodes; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import main.NGECore; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; +import engine.clients.Client; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -78,6 +87,8 @@ public class SkillService implements INetworkDispatch { String[] schematicsGranted = ((String) skillTable.getObject(s, 23)).split(","); String[] schematicsRevoked = ((String) skillTable.getObject(s, 24)).split(","); + boolean speciesSkill = skill.matches("^species.+$"); + if (isTitle == true) { core.playerService.addPlayerTitle(player, skill); Console.println("Gave skill title: " + skill); @@ -86,8 +97,9 @@ public class SkillService implements INetworkDispatch { if (isProfession) { return; } - - if (godOnly || isHidden) { + + //exempt species skills from being returned -- they're marked godOnly but really meant to be granted + if ((!speciesSkill) && ( godOnly || isHidden)) { return; } @@ -136,8 +148,10 @@ public class SkillService implements INetworkDispatch { } } - for (String ability : abilities) { - creature.addAbility(ability); + if(!skill.contains("expertise")) { // only mark 1 abilities in datatable need to remove abilities per script + for (String ability : abilities) { + creature.addAbility(ability); + } } for (String skillMod : skillMods) { @@ -167,7 +181,7 @@ public class SkillService implements INetworkDispatch { PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); DatatableVisitor skillTable; - if (creature.getClient() == null) { + if (player == null) { return; } @@ -201,8 +215,10 @@ public class SkillService implements INetworkDispatch { //creature.addExpertisePoints(pointsRequired); } - for (String ability : abilities) { - creature.removeAbility(ability); + if(!skill.contains("expertise")) { // only mark 1 abilities in datatable need to remove abilities per script + for (String ability : abilities) { + creature.removeAbility(ability); + } } for (String skillMod : skillMods) { @@ -225,7 +241,43 @@ public class SkillService implements INetworkDispatch { } @Override - public void insertOpcodes(Map arg0, Map arg1) { + public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + + swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + + buffer = buffer.order(ByteOrder.LITTLE_ENDIAN); + buffer.position(0); + + ExpertiseRequestMessage expertise = new ExpertiseRequestMessage(); + expertise.deserialize(buffer); + + Client client = core.getClient((Integer) session.getAttribute("connectionId")); + if(client == null) { + System.out.println("NULL Client"); + return; + } + + if(client.getParent() == null) + return; + + CreatureObject creature = (CreatureObject) client.getParent(); + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + + if(player == null) + return; + + for(String expertiseName : expertise.getExpertiseSkills()) { + addSkill(creature, expertiseName); + if(!FileUtilities.doesFileExist("scripts/expertise/" + expertiseName + ".py")) + continue; + core.scriptService.callScript("scripts/expertise/", "addAbilities", expertiseName, core, creature, player); + } + + } + }); } diff --git a/src/services/TerrainService.java b/src/services/TerrainService.java index d6c80695..eb1c9808 100644 --- a/src/services/TerrainService.java +++ b/src/services/TerrainService.java @@ -26,9 +26,17 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import resources.common.FileUtilities; +import resources.common.collidables.CollidableCircle; + +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.DatatableVisitor; import engine.resources.config.Config; +import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; import main.NGECore; @@ -36,13 +44,66 @@ public class TerrainService { private NGECore core; private List planets = Collections.synchronizedList(new ArrayList()); + private Map> noBuildAreas = new ConcurrentHashMap>(); public TerrainService(NGECore core) { - - this.core = core; - + this.core = core; } + public void loadClientPois() { + + try { + + DatatableVisitor poiTable = ClientFileManager.loadFile("datatables/clientpoi/clientpoi.iff", DatatableVisitor.class); + + for (int i = 0; i < poiTable.getRowCount(); i++) { + + Planet planet = getPlanetByName((String) poiTable.getObject(i, 0)); + + if(planet == null) + continue; + + float x = (Float) poiTable.getObject(i, 4); + float z = (Float) poiTable.getObject(i, 6); + + CollidableCircle poiArea = new CollidableCircle(new Point3D(x, 0, z), 150, planet); + noBuildAreas.get(planet).add(poiArea); + + } + + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + + } + + private void loadClientRegions(Planet planet) { + + if(!FileUtilities.doesFileExist("datatables/clientregion/" + planet.getName() + ".iff")) + return; + + try { + + DatatableVisitor regionTable = ClientFileManager.loadFile("datatables/clientpoi/clientpoi.iff", DatatableVisitor.class); + + for (int i = 0; i < regionTable.getRowCount(); i++) { + + float x = (Float) regionTable.getObject(i, 1); + float z = (Float) regionTable.getObject(i, 2); + float radius = (Float) regionTable.getObject(i, 3); + + CollidableCircle region = new CollidableCircle(new Point3D(x, 0, z), radius, planet); + noBuildAreas.get(planet).add(region); + + } + + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + + } + + public boolean isWater(int planetId, float x, float z) { if(getPlanetByID(planetId) == null) @@ -112,6 +173,8 @@ public class TerrainService { Planet planet = new Planet(ID, name, path, loadSnapshot); planets.add(planet); core.mapService.addPlanet(planet); + noBuildAreas.put(planet, new ArrayList()); + loadClientRegions(planet); } @@ -130,7 +193,12 @@ public class TerrainService { config.setFilePath("options.cfg"); if (config.loadConfigFile() && config.getInt("LOAD.SNAPSHOT_OBJECTS") > 0) { - core.objectService.loadSnapshotObjects(planet); + try { + core.objectService.loadSnapshotObjects(planet); + core.objectService.loadBuildoutObjects(planet); + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } } } @@ -152,6 +220,21 @@ public class TerrainService { } + public boolean canBuildAtPosition(SWGObject object, float x, float z) { + + if(isWater(object.getPlanet(), z, z)) + return false; + + Point3D position = new Point3D(x, 0, z); + + for(CollidableCircle noBuildArea : noBuildAreas.get(object.getPlanet())) { + if(noBuildArea.doesCollide(position)) + return false; + } + + return true; + + } diff --git a/src/services/ai/AIActor.java b/src/services/ai/AIActor.java new file mode 100644 index 00000000..bb8efca5 --- /dev/null +++ b/src/services/ai/AIActor.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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.ai; + +import engine.resources.scene.Point3D; +import resources.objects.creature.CreatureObject; +import services.ai.states.AIState; + +public class AIActor { + + private CreatureObject creature; + private Point3D spawnPosition; + private volatile AIState currentState; + private CreatureObject followObject; + + public AIActor(CreatureObject creature, Point3D spawnPosition) { + this.creature = creature; + this.spawnPosition = spawnPosition; + } + + public CreatureObject getCreature() { + return creature; + } + + public void setCreature(CreatureObject creature) { + this.creature = creature; + } + + public Point3D getSpawnPosition() { + return spawnPosition; + } + + public void setSpawnPosition(Point3D spawnPosition) { + this.spawnPosition = spawnPosition; + } + + public void doAggro(CreatureObject defender) { + + } + + public AIState getCurrentState() { + return currentState; + } + + public void setCurrentState(AIState currentState) { + if(currentState == this.currentState) + return; + this.currentState.onExit(); + this.currentState = currentState; + currentState.onEnter(); + } + + public CreatureObject getFollowObject() { + return followObject; + } + + public void setFollowObject(CreatureObject followObject) { + this.followObject = followObject; + } + +} diff --git a/src/services/ai/AIService.java b/src/services/ai/AIService.java new file mode 100644 index 00000000..ea980a89 --- /dev/null +++ b/src/services/ai/AIService.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * 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.ai; + +import java.util.Vector; + +import engine.resources.scene.Point3D; + +import main.NGECore; + +public class AIService { + + private Vector aiActors = new Vector(); + private NGECore core; + + public AIService(NGECore core) { + this.core = core; + } + + + +} diff --git a/src/services/ai/LairActor.java b/src/services/ai/LairActor.java new file mode 100644 index 00000000..09043e82 --- /dev/null +++ b/src/services/ai/LairActor.java @@ -0,0 +1,145 @@ +/******************************************************************************* + * 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.ai; + +import java.util.Vector; +import net.engio.mbassy.listener.Handler; +import resources.objects.tangible.TangibleObject; +import services.combat.CombatEvents.DamageTaken; + +public class LairActor { + + private Vector creatures = new Vector(); + private TangibleObject lairObject; + private int maxSpawns; + private String creatureTemplate; + private volatile int spawnWave = 0; + + public LairActor(TangibleObject lairObject, String creatureTemplate) { + this.lairObject = lairObject; + this.creatureTemplate = creatureTemplate; + lairObject.getEventBus().subscribe(this); + } + + public LairActor(TangibleObject lairObject, String creatureTemplate, int maxSpawns) { + this.lairObject = lairObject; + this.creatureTemplate = creatureTemplate; + this.maxSpawns = maxSpawns; + lairObject.getEventBus().subscribe(this); + } + + + public Vector getCreatures() { + return creatures; + } + + public TangibleObject getLairObject() { + return lairObject; + } + + public void setLairObject(TangibleObject lairObject) { + this.lairObject = lairObject; + } + + @Handler + public void handleLairDamageEvent(DamageTaken event) { + + for(AIActor ai : creatures) { + ai.doAggro(event.attacker); + } + + spawnNewCreatures(); + + } + + private void spawnNewCreatures() { + + if(creatures.size() >= maxSpawns) + return; + + int currentCondition = lairObject.getConditionDamage(); + int maxCondition = lairObject.getMaxDamage(); + + switch(spawnWave) { + // TODO: play damage effect + case 0: + spawnWave++; + break; + case 1: + if((currentCondition / maxCondition) < 0.7) { + spawnWave++; + } else { + return; + } + case 2: + if((currentCondition / maxCondition) < 0.3) { + spawnWave++; + } else { + return; + } + break; + case 3: + return; + + default: + return; + + } + + // TODO: spawn creatures + + healLair(); + + } + + private void healLair() { + + if(lairObject.getConditionDamage() == 0 || creatures.isEmpty()) + return; + + int healAmount = 0; + + for(AIActor ai : creatures) { + healAmount += lairObject.getMaxDamage() / 100; + } + + lairObject.setConditionDamage(lairObject.getConditionDamage() - healAmount); + lairObject.playEffectObject("clienteffect/healing_healdamage.cef", "root"); + + } + + public int getMaxSpawns() { + return maxSpawns; + } + + public void setMaxSpawns(int maxSpawns) { + this.maxSpawns = maxSpawns; + } + + public String getCreatureTemplate() { + return creatureTemplate; + } + + public void setCreatureTemplate(String creatureTemplate) { + this.creatureTemplate = creatureTemplate; + } +} diff --git a/src/services/ai/states/AIState.java b/src/services/ai/states/AIState.java new file mode 100644 index 00000000..3da9131c --- /dev/null +++ b/src/services/ai/states/AIState.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * 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.ai.states; + +public abstract class AIState { + + public abstract byte onEnter(); + public abstract byte onExit(); + public abstract byte move(); + public abstract byte recover(); + + public enum StateResult {; + + // default error state result + public static final byte NONE = 0; + // finished with state + public static final byte FINISHED = 1; + // unfinished with state, call recover() + public static final byte UNFINISHED = 2; + public static final byte DEAD = 3; + // for deaggro or idling + public static final byte IDLE = 4; + + } + + + +} diff --git a/src/services/ai/states/AttackState.java b/src/services/ai/states/AttackState.java new file mode 100644 index 00000000..fedb6112 --- /dev/null +++ b/src/services/ai/states/AttackState.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.ai.states; + +public class AttackState extends AIState { + + @Override + public byte onEnter() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte onExit() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte move() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte recover() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/services/ai/states/DeathState.java b/src/services/ai/states/DeathState.java new file mode 100644 index 00000000..aee6e323 --- /dev/null +++ b/src/services/ai/states/DeathState.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.ai.states; + +public class DeathState extends AIState { + + @Override + public byte onEnter() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte onExit() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte move() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte recover() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/services/ai/states/IdleState.java b/src/services/ai/states/IdleState.java new file mode 100644 index 00000000..597630e9 --- /dev/null +++ b/src/services/ai/states/IdleState.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.ai.states; + +public class IdleState extends AIState { + + @Override + public byte onEnter() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte onExit() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte move() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte recover() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/services/ai/states/PatrolState.java b/src/services/ai/states/PatrolState.java new file mode 100644 index 00000000..81e4eace --- /dev/null +++ b/src/services/ai/states/PatrolState.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.ai.states; + +public class PatrolState extends AIState { + + @Override + public byte onEnter() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte onExit() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte move() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte recover() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/services/ai/states/RetreatState.java b/src/services/ai/states/RetreatState.java new file mode 100644 index 00000000..64e4fa71 --- /dev/null +++ b/src/services/ai/states/RetreatState.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.ai.states; + +public class RetreatState extends AIState { + + @Override + public byte onEnter() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte onExit() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte move() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte recover() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/services/ai/states/SpawnState.java b/src/services/ai/states/SpawnState.java new file mode 100644 index 00000000..4d46a557 --- /dev/null +++ b/src/services/ai/states/SpawnState.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.ai.states; + +public class SpawnState extends AIState { + + @Override + public byte onEnter() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte onExit() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte move() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte recover() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 0b32913a..e9aa0576 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -46,6 +46,7 @@ import engine.resources.service.INetworkRemoteEvent; import resources.common.*; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; +import protocol.swg.AddIgnoreMessage; import protocol.swg.ChatOnChangeFriendStatus; import protocol.swg.ChatDeletePersistentMessage; import protocol.swg.ChatFriendsListUpdate; @@ -71,6 +72,9 @@ public class ChatService implements INetworkDispatch { this.core = core; core.commandService.registerCommand("spatialchatinternal"); core.commandService.registerCommand("socialinternal"); + core.commandService.registerCommand("addignore"); + core.commandService.registerCommand("removeignore"); + core.commandService.registerCommand("findfriend"); mailODB = core.getMailODB(); } @@ -107,6 +111,10 @@ public class ChatService implements INetworkDispatch { for(Client client : observers) { float distance = client.getParent().getPosition().getDistance2D(position); if(client != null && client.getSession() != null && distance <= 80) { + + if(((PlayerObject)client.getParent().getSlottedObject("ghost")).getIgnoreList().contains(speaker.getCustomName().toLowerCase().split(" ")[0])) + continue; + spatialChat.setDestinationId(client.getParent().getObjectID()); ObjControllerMessage objControllerMessage2 = new ObjControllerMessage(0x0B, spatialChat); client.getSession().write(objControllerMessage2.serialize()); @@ -177,10 +185,13 @@ public class ChatService implements INetworkDispatch { if(sender == null) return; - - SWGObject recipient = getObjectByFirstName(firstName); + PlayerObject recipientGhost = (PlayerObject) recipient.getSlottedObject("ghost"); + + if (recipientGhost.getIgnoreList().contains(sender.getCustomName().toLowerCase())) + return; + if(recipient == null || recipient.getClient() == null || recipient.getClient().getSession() == null) { ChatOnSendInstantMessage response = new ChatOnSendInstantMessage(4, chatInstantMsg.getSequence()); //System.out.println(response.serialize().getHexDump()); @@ -219,7 +230,12 @@ public class ChatService implements INetworkDispatch { return; SWGObject recipient = getObjectByFirstName(packet.getRecipient()); - + + PlayerObject recipientGhost = (PlayerObject) recipient.getSlottedObject("ghost"); + + if (recipientGhost.getIgnoreList().contains(sender.getCustomName().toLowerCase())) + return; + if(recipient == null || recipient.getSlottedObject("ghost" ) == null) { ChatOnSendPersistentMessage response = new ChatOnSendPersistentMessage(4, packet.getCounter()); session.write(response.serialize()); @@ -421,6 +437,50 @@ public class ChatService implements INetworkDispatch { //actor.friendAdd(friendShortName); } + public void addToIgnoreList(SWGObject actor, String ignoreName) { + PlayerObject ghost = (PlayerObject) actor.getSlottedObject("ghost"); + CreatureObject creature = (CreatureObject) actor; + List ignoreList = ghost.getIgnoreList(); + + if (ignoreList.contains(ignoreName.toLowerCase())) { + creature.sendSystemMessage(ignoreName + " is already in your ignore list.", (byte) 0); + return; + } else { + // TODO: Do check for valid names to ignore + + AddIgnoreMessage addIgnore = new AddIgnoreMessage(actor, ignoreName.toLowerCase(), true); + actor.getClient().getSession().write(addIgnore.serialize()); + Console.println("Sent the add ignore message!"); + ghost.ignoreAdd(ignoreName.toLowerCase()); + Console.println("Sent the add ignore delta!"); + creature.sendSystemMessage(ignoreName + " is now ignored.", (byte) 0); + } + + } + + public void removeFromIgnoreList(SWGObject actor, String ignoreName) { + PlayerObject ghost = (PlayerObject) actor.getSlottedObject("ghost"); + CreatureObject creature = (CreatureObject) actor; + List ignoreList = ghost.getIgnoreList(); + + if (ignoreList.contains(ignoreName.toLowerCase())) { + for (String name : ignoreList) { + if(name.equalsIgnoreCase(ignoreName)) { + //Console.println("Name found!"); + AddIgnoreMessage removeIgnore = new AddIgnoreMessage(actor, ignoreName.toLowerCase(), false); + actor.getClient().getSession().write(removeIgnore.serialize()); + //Console.println("Sent AddIgnoreMessage to remove friend!"); + ghost.ignoreRemove(ignoreName.toLowerCase()); + //Console.println("Sent ignoreRemove delta!"); + creature.sendSystemMessage(ignoreName + " is no longer ignored.", (byte) 0); + + // TODO: Find out why player must click on name twice in list for name to be removed. + break; + } + } + } else { return; } + } + public void sendPersistentMessageHeader(Client client, Mail mail) { if(client.getSession() == null) diff --git a/src/services/collections/CollectionService.java b/src/services/collections/CollectionService.java new file mode 100644 index 00000000..d86ee7ad --- /dev/null +++ b/src/services/collections/CollectionService.java @@ -0,0 +1,852 @@ +/******************************************************************************* + * 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.collections; + +import java.util.BitSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import org.python.core.Py; +import org.python.core.PyObject; + +import resources.common.FileUtilities; +import resources.objects.creature.CreatureObject; +import resources.objects.player.PlayerObject; + +import main.NGECore; + +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.DatatableVisitor; +import engine.resources.scene.Point3D; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class CollectionService implements INetworkDispatch { + + private NGECore core; + + private Map> explorationLocations = new TreeMap>(); + + private class ExplorationRegion { + + public Point3D location; + public float range; + + public ExplorationRegion(Point3D location, float range) { + this.location = location; + this.range = range; + } + + } + + public CollectionService(NGECore core) { + this.core = core; + + if (FileUtilities.doesFileExist("scripts/collections/exploration_badges.py")) { + PyObject method = core.scriptService.getMethod("scripts/collections/", "exploration_badges", "setup"); + + if (method != null && method.isCallable()) { + method.__call__(Py.java2py(this)); + } + } + } + + /* + * @see datatables/collection/collections.iff + * + * Count and exploration count badges are added automatically. + * + * You can add a new exploration location in scripts/collections + * /exploration_badges.py by defining setup(collectionService) + * and using collectionService.registerExplorationBadge(badge, x, z). + * + * Scripts named collection's slotName or collectionName should be + * put in scripts/collections/ and can use the modify(core, actor, count) + * method upon modification or complete(core, actor, count) on completion. + * + * Please distinguish a slot from a collection. A slot could be + * a type of blacksun ship where you have to kill 25 of them, and a + * collection could be a row of different blacksun ships. + * + * You'll need to choose carefully whether you make a script for the + * collection, or the specific slots, or both. + * + * @param creature The player's CreatureObject instance. + * @param collection slotName of the collection you want to add. + * + * @return True if added successfully. + */ + @SuppressWarnings("unused") + public boolean addCollection(CreatureObject creature, String collection) { + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + DatatableVisitor collectionTable; + + if (player == null) { + return false; + } + + collection = collection.toLowerCase(); + + if (isComplete(creature, collection)) { + return false; + } + + try { + collectionTable = ClientFileManager.loadFile("datatables/collection/collection.iff", DatatableVisitor.class); + BitSet collections; + String bookName = ""; + String pageName = ""; + String collectionName = ""; + boolean titleOnComplete = false; + + collections = BitSet.valueOf(player.getCollections()); + + for (int c = 0; c < collectionTable.getRowCount(); c++) { + if (collectionTable.getObject(c, 0) != null) { + if (((String) collectionTable.getObject(c, 0)) != "") { + bookName = ((String) collectionTable.getObject(c, 0)); + pageName = ""; + collectionName = ""; + titleOnComplete = false; + } else if (((String) collectionTable.getObject(c, 1)) != "") { + pageName = ((String) collectionTable.getObject(c, 1)); + collectionName = ""; + titleOnComplete = false; + } else if (((String) collectionTable.getObject(c, 2)) != "") { + collectionName = ((String) collectionTable.getObject(c, 2)); + titleOnComplete = ((Boolean) collectionTable.getObject(c, 27)); + } else if (((String) collectionTable.getObject(c, 3)) != "") { + String slotName = ((String) collectionTable.getObject(c, 3)); + + if (slotName.equals(collection)) { + int bits = 0; + boolean noScriptOnModify = false; + boolean clearOnComplete = false; + boolean noMessage = true; + boolean grantIfPreReqMet = true; + boolean buddyCollection = false; + int numAltTitles = 0; + int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); + int endSlotId = ((Integer) collectionTable.getObject(c, 5)); + int maxSlotValue = ((Integer) collectionTable.getObject(c, 6)); + String music = ((String) collectionTable.getObject(c, 24)); + boolean hidden = ((Boolean) collectionTable.getObject(c, 26)); + boolean title = ((Boolean) collectionTable.getObject(c, 27)); + boolean noReward = ((Boolean) collectionTable.getObject(c, 33)); + boolean trackServerFirst = ((Boolean) collectionTable.getObject(c, 34)); + + String[] categories = { + ((String) collectionTable.getObject(c, 7)), + ((String) collectionTable.getObject(c, 8)), + ((String) collectionTable.getObject(c, 9)), + ((String) collectionTable.getObject(c, 10)), + ((String) collectionTable.getObject(c, 11)), + ((String) collectionTable.getObject(c, 12)), + ((String) collectionTable.getObject(c, 13)), + ((String) collectionTable.getObject(c, 14)), + ((String) collectionTable.getObject(c, 15)), + ((String) collectionTable.getObject(c, 16)), + ((String) collectionTable.getObject(c, 17)) + }; + + String[] prereqSlotNames = { + ((String) collectionTable.getObject(c, 18)), + ((String) collectionTable.getObject(c, 19)), + ((String) collectionTable.getObject(c, 20)), + ((String) collectionTable.getObject(c, 21)), + ((String) collectionTable.getObject(c, 22)) + }; + + String[] alternateTitles = { + ((String) collectionTable.getObject(c, 28)), + ((String) collectionTable.getObject(c, 29)), + ((String) collectionTable.getObject(c, 30)), + ((String) collectionTable.getObject(c, 31)), + ((String) collectionTable.getObject(c, 32)) + }; + + if (bookName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); + throw new Exception(); + } + + if (pageName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); + throw new Exception(); + } + + if (collectionName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); + throw new Exception(); + } + + if (endSlotId != -1) { + if (beginSlotId >= endSlotId) { + System.out.println(slotName + ", row " + c + ": begin slot id " + beginSlotId + " must be < end slot id" + endSlotId); + throw new Exception(); + } + + bits = (endSlotId - beginSlotId); + + if (bits > 32) { + System.out.println(slotName + ", row " + c + ": counter-type slot uses " + bits + " bits which exceeds the limit of 32 bits for counter-type slot"); + throw new Exception(); + } + + if (maxSlotValue > -1) { + if (!(maxSlotValue > 1)) { + System.out.println(slotName + ", row " + c + ": max slot value " + maxSlotValue + " must be > 1"); + throw new Exception(); + } + + BitSet bitValue = new BitSet(64); + bitValue.set(64-bits, 64); + + BitSet maxValue = new BitSet(64); + maxValue.set(64-maxSlotValue, 64); + + if (bitValue.toLongArray()[0] < maxValue.toLongArray()[0]) { + System.out.println(slotName + ", row " + c + ": counter-type slot uses " + bits + " bits, which can only hold a max value of " + bitValue.toLongArray()[0] + ", which is less than the specified max value of " + maxValue.toLongArray()[0]); + throw new Exception(); + } + } + } else { + bits = 1; + } + + for (String prereqSlotName : prereqSlotNames) { + if (!prereqSlotName.equals("") && getCollection(creature, prereqSlotName) < 1) { + if (prereqSlotName.equals(slotName)) { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " cannot have itself as a prereq"); + throw new Exception(); + } + + return false; + } + } + + for (String category : categories) { + if (category.equals("noScriptOnModify")) { + noScriptOnModify = true; + } else if (category.equals("clearOnComplete")) { + clearOnComplete = true; + } else if (category.equals("noMessage")) { + noMessage = true; + } else if (category.equals("grantIfPreReqMet")) { + grantIfPreReqMet = true; + } else if (category.equals("buddyCollection")) { + buddyCollection = true; + } else if (category.startsWith("numAltTitles")) { + numAltTitles = new Integer(category.split(":")[1]); + } else if (category.startsWith("kill")) { + continue; + } else if (category.contains("showFullInformationToOthers")) { + continue; + } else if (category.contains("collection")) { + continue; + } else if (category.startsWith("updateOnCount")) { + continue; + } else if (category.equals("rewardOnUpdate")) { + continue; + } else if (category.equals("rewardOnComplete")) { + continue; + } else if (category.contains("relic")) { + break; + } else if (!category.equals("")){ + continue; + } + } + + if (title) { + player.getTitleList().add(slotName); + + if (alternateTitles.length > 0) { + for (String altTitle : alternateTitles) { + if (altTitle != "") { + player.getTitleList().add(altTitle); + } + } + } + } else { + if (numAltTitles > 0 || alternateTitles.length > 0) { + System.out.println(slotName + ": slot " + slotName + " cannot have any alternative titles unless it is defined as \"titleable\""); + } + } + + if (bits > 1) { + int nextBit = collections.get(beginSlotId, (endSlotId + 1)).previousClearBit(endSlotId); + + if (nextBit == -1) { + return false; + } + + collections.set((beginSlotId + nextBit)); + } else { + collections.set(beginSlotId); + } + + player.setCollections(collections.toByteArray()); + + if (!hidden && !noMessage) { + creature.sendSystemMessage("collection_n", collection, 0, 0); + } + + if (!music.equals("")) { + creature.playMusic(music); + } + + if (!noScriptOnModify) { + if (FileUtilities.doesFileExist("scripts/collections/" + slotName + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/collections/", slotName, "modify"); + + if (method != null && method.isCallable()) { + method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(getCollection(creature, slotName))); + } + } + + if (FileUtilities.doesFileExist("scripts/collections/" + collectionName + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/collections/", collectionName, "modify"); + + if (method != null && method.isCallable()) { + method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(getCollection(creature, collectionName))); + } + } + } + + if (isComplete(creature, slotName)) { + if (FileUtilities.doesFileExist("scripts/collections/" + slotName + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/collections/", slotName, "complete"); + + if (method != null && method.isCallable()) { + method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(getCollection(creature, collectionName))); + } + } + } + + if (!isComplete(creature, collectionName)) { + if (!noReward) { + if (FileUtilities.doesFileExist("scripts/collections/" + collectionName + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/collections/", collectionName, "complete"); + + if (method != null && method.isCallable()) { + method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(getCollection(creature, collectionName))); + } + } + } + + if (titleOnComplete) { + player.getTitleList().add(collectionName); + } + + if (trackServerFirst) { + core.guildService.getGuildObject().addServerFirst(collectionName, new ServerFirst(creature.getCustomName(), System.currentTimeMillis())); + } + + if (clearOnComplete) { + if (endSlotId > -1) { + if (collections.get(beginSlotId, (endSlotId + 1)).cardinality() == bits) { + clearCollection(creature, collectionName); + } + } + } + + if (bookName.equals("badge_book")) { + int badges = getCollection(creature, "badge_book"); + + switch (badges) { + case 5: + addCollection(creature, "count_5"); + case 10: + addCollection(creature, "count_10"); + default: + if (((badges % 25) == 0) && !(badges > 500)) { + addCollection(creature, "count_" + badges); + } + } + } + + if (pageName.equals("bdg_explore")) { + int badges = getCollection(creature, "bdg_explore"); + + switch (badges) { + case 10: + addCollection(creature, "bdg_exp_10_badges"); + case 20: + addCollection(creature, "bdg_exp_20_badges"); + case 30: + addCollection(creature, "bdg_exp_30_badges"); + case 40: + addCollection(creature, "bdg_exp_40_badges"); + case 45: + addCollection(creature, "bdg_exp_45_badges"); + } + } + } + + return true; + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return false; + } + + /* + * @param creature The player's CreatureObject instance. + * @param collection slotName or collectionName from collection.iff. + * + * @return True if the slot or collection is complete. + */ + public boolean isComplete(CreatureObject creature, String collection) { + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + DatatableVisitor collectionTable; + + if (player == null) { + return false; + } + + collection = collection.toLowerCase(); + + try { + collectionTable = ClientFileManager.loadFile("datatables/collection/collection.iff", DatatableVisitor.class); + BitSet collections; + String bookName = ""; + String pageName = ""; + String collectionName = ""; + boolean found = false; + boolean collectionComplete = false; + + collections = BitSet.valueOf(player.getCollections()); + + for (int c = 0; c < collectionTable.getRowCount(); c++) { + if (collectionTable.getObject(c, 0) != null) { + if (((String) collectionTable.getObject(c, 0)) != "") { + bookName = ((String) collectionTable.getObject(c, 0)); + pageName = ""; + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 1)) != "") { + pageName = ((String) collectionTable.getObject(c, 1)); + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 2)) != "") { + collectionName = ((String) collectionTable.getObject(c, 2)); + } else if (((String) collectionTable.getObject(c, 3)) != "") { + String slotName = ((String) collectionTable.getObject(c, 3)); + + if (slotName.equals(collection)) { + int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); + + if (bookName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); + throw new Exception(); + } + + if (pageName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); + throw new Exception(); + } + + if (collectionName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); + throw new Exception(); + } + + if (collection == bookName) { + System.out.println("Checking if a book is complete is unsupported at this time."); + throw new Exception(); + } else if (collection == pageName) { + System.out.println("Checking if a page is complete is unsupported at this time."); + throw new Exception(); + } else if (collection == collectionName) { + collectionComplete = collections.get(beginSlotId); + found = true; + } else if (collection == slotName) { + return collections.get(beginSlotId); + } + + if (found && collectionName != collection) { + return collectionComplete; + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return false; + } + + /* + * Returns number of completed bits in a slot or the number of completed + * slots in a collection, page or book. + * + * @param creature The player's CreatureObject instance. + * @param collection slotName, collectionName, pageName or bookName from collection.iff. + * + * @return Number of completed collections within the slot, collection, page or book. + */ + public int getCollection(CreatureObject creature, String collection) { + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + DatatableVisitor collectionTable; + + if (player == null) { + return 0; + } + + collection = collection.toLowerCase(); + + try { + collectionTable = ClientFileManager.loadFile("datatables/collection/collection.iff", DatatableVisitor.class); + BitSet collections; + String bookName = ""; + String pageName = ""; + String collectionName = ""; + int found = 0; + + collections = BitSet.valueOf(player.getCollections()); + + for (int c = 0; c < collectionTable.getRowCount(); c++) { + if (collectionTable.getObject(c, 0) != null) { + if (((String) collectionTable.getObject(c, 0)) != "") { + bookName = ((String) collectionTable.getObject(c, 0)); + pageName = ""; + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 1)) != "") { + pageName = ((String) collectionTable.getObject(c, 1)); + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 2)) != "") { + collectionName = ((String) collectionTable.getObject(c, 2)); + } else if (((String) collectionTable.getObject(c, 3)) != "") { + String slotName = ((String) collectionTable.getObject(c, 3)); + + int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); + int endSlotId = ((Integer) collectionTable.getObject(c, 5)); + int maxSlotValue = ((Integer) collectionTable.getObject(c, 6)); + int bits = 0; + + if (bookName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); + throw new Exception(); + } + + if (pageName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); + throw new Exception(); + } + + if (collectionName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); + throw new Exception(); + } + + if (collection == bookName) { + found += getCollection(creature, pageName); + continue; + } else if (collection == pageName) { + found += getCollection(creature, collectionName); + continue; + } else if (collection == collectionName) { + if (collections.get(beginSlotId)) { + found++; + } + + continue; + } else if (collection == slotName) { + if (endSlotId != -1) { + if (beginSlotId >= endSlotId) { + System.out.println(slotName + ", row " + c + ": begin slot id " + beginSlotId + " must be < end slot id" + endSlotId); + throw new Exception(); + } + + bits = (endSlotId - beginSlotId); + + if (bits > 32) { + System.out.println(slotName + ", row " + c + ": counter-type slot uses " + bits + " bits which exceeds the limit of 32 bits for counter-type slot"); + throw new Exception(); + } + + if (maxSlotValue > -1) { + if (!(maxSlotValue > 1)) { + System.out.println(slotName + ", row " + c + ": max slot value " + maxSlotValue + " must be > 1"); + throw new Exception(); + } + + BitSet bitValue = new BitSet(64); + bitValue.set(64-bits, 64); + + BitSet maxValue = new BitSet(64); + maxValue.set(64-maxSlotValue, 64); + + if (bitValue.toLongArray()[0] < maxValue.toLongArray()[0]) { + System.out.println(slotName + ", row " + c + ": counter-type slot uses " + bits + " bits, which can only hold a max value of " + bitValue.toLongArray()[0] + ", which is less than the specified max value of " + maxValue.toLongArray()[0]); + throw new Exception(); + } + + return collections.get(beginSlotId, (endSlotId + 1)).cardinality(); + } + } else { + return ((collections.get(beginSlotId)) ? 1 : 0); + } + } + + if (found > 0) { + return found; + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return 0; + } + + /* + * Registers an exploration badge location. + * + * @param planet Name from Planet.getName(). + * @param badgeName slotName from collection.iff. + * @param x The first 2d coordinate. + * @param z The second 2d coordinate. + * @param range The radius from the coordinates at which this will check for players and award them the badge. + */ + public void registerExplorationBadge(String planet, String badgeName, int x, int z, int range) { + if (!explorationLocations.containsKey(planet)) { + explorationLocations.put(planet, new TreeMap()); + } + + 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. + * + * @param creature The player's CreatreObject instance. + */ + public void checkExplorationRegions(CreatureObject creature) { + String planet = creature.getPlanet().getName(); + + if (explorationLocations.containsKey(planet)) { + for (Entry badge : explorationLocations.get(planet).entrySet()) { + if (creature.inRange(badge.getValue().location, badge.getValue().range)) { + if (!isComplete(creature, badge.getKey())) { + addCollection(creature, badge.getKey()); + } + } + } + } + } + + /* + * Clears the specified slot, collection, page or book. + * + * @param creature The player's CreatureObject instance. + * @param collection slotName, collectionName, pageName or bookName from collection.iff + * + * @return True if successful. + */ + public boolean clearCollection(CreatureObject creature, String collection) { + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + DatatableVisitor collectionTable; + + if (player == null) { + return false; + } + + collection = collection.toLowerCase(); + + try { + collectionTable = ClientFileManager.loadFile("datatables/collection/collection.iff", DatatableVisitor.class); + BitSet collections; + String bookName = ""; + String pageName = ""; + String collectionName = ""; + boolean found = false; + + collections = BitSet.valueOf(player.getCollections()); + + for (int c = 0; c < collectionTable.getRowCount(); c++) { + if (collectionTable.getObject(c, 0) != null) { + if (((String) collectionTable.getObject(c, 0)) != "") { + bookName = ((String) collectionTable.getObject(c, 0)); + pageName = ""; + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 1)) != "") { + pageName = ((String) collectionTable.getObject(c, 1)); + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 2)) != "") { + collectionName = ((String) collectionTable.getObject(c, 2)); + } else if (((String) collectionTable.getObject(c, 3)) != "") { + String slotName = ((String) collectionTable.getObject(c, 3)); + + int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); + int endSlotId = ((Integer) collectionTable.getObject(c, 5)); + + if (bookName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); + throw new Exception(); + } + + if (pageName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); + throw new Exception(); + } + + if (collectionName == "") { + 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) { + found = true; + + if (collections.get(beginSlotId, endSlotId + 1).cardinality() > 0) { + collections.clear(beginSlotId, (endSlotId + 1)); + + if (player.getTitleList().contains(slotName)) { + player.getTitleList().remove(slotName); + } + + continue; + } + } + + if (found) { + player.setCollections(collections.toByteArray()); + return true; + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return false; + } + + /* + * Clears all collections. + * + * This must cycle through all the collections because + * it needs to remove titles and other such things. + * + * @param creature The player's CreatureObject instance. + * + * @return True if successful. + */ + public boolean clearCollections(CreatureObject creature) { + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + DatatableVisitor collectionTable; + + if (player == null) { + return false; + } + + try { + collectionTable = ClientFileManager.loadFile("datatables/collection/collection.iff", DatatableVisitor.class); + BitSet collections; + String bookName = ""; + String pageName = ""; + String collectionName = ""; + boolean found = false; + + collections = BitSet.valueOf(player.getCollections()); + + for (int c = 0; c < collectionTable.getRowCount(); c++) { + if (collectionTable.getObject(c, 0) != null) { + if (((String) collectionTable.getObject(c, 0)) != "") { + bookName = ((String) collectionTable.getObject(c, 0)); + pageName = ""; + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 1)) != "") { + pageName = ((String) collectionTable.getObject(c, 1)); + collectionName = ""; + } else if (((String) collectionTable.getObject(c, 2)) != "") { + collectionName = ((String) collectionTable.getObject(c, 2)); + } else if (((String) collectionTable.getObject(c, 3)) != "") { + String slotName = ((String) collectionTable.getObject(c, 3)); + + int beginSlotId = ((Integer) collectionTable.getObject(c, 4)); + int endSlotId = ((Integer) collectionTable.getObject(c, 5)); + + if (bookName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a book"); + throw new Exception(); + } + + if (pageName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a page"); + throw new Exception(); + } + + if (collectionName == "") { + System.out.println(slotName + ", row " + c + ": slot " + slotName + " must be in a collection"); + throw new Exception(); + } + + if (collections.get(beginSlotId, endSlotId + 1).cardinality() > 0) { + found = true; + + collections.clear(beginSlotId, (endSlotId + 1)); + + if (player.getTitleList().contains(slotName)) { + player.getTitleList().remove(slotName); + } + + continue; + } + + if (found) { + player.setCollections(collections.toByteArray()); + return true; + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return ((player.getCollections().length > 0) ? false : true); + } + + @Override + public void insertOpcodes(Map arg0, Map arg1) { + + } + + @Override + public void shutdown() { + + } + +} diff --git a/src/services/collections/ServerFirst.java b/src/services/collections/ServerFirst.java new file mode 100644 index 00000000..a11a01f6 --- /dev/null +++ b/src/services/collections/ServerFirst.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * 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.collections; + +import resources.objects.ListObject; + +import com.sleepycat.persist.model.Persistent; + +@Persistent +public class ServerFirst extends ListObject { + + private String name; + private long time; + + public ServerFirst(String name, long time) { + this.name = name; + this.time = time; + } + + public ServerFirst() { + + } + + public String getName() { + return name; + } + + public long getTime() { + return time; + } + + @Override + public byte[] getBytes() { + return new byte[] { }; + } + +} diff --git a/src/services/combat/CombatCommands.java b/src/services/combat/CombatCommands.java index b2ab9acd..1544a0ce 100644 --- a/src/services/combat/CombatCommands.java +++ b/src/services/combat/CombatCommands.java @@ -64,7 +64,6 @@ public class CombatCommands { core.commandService.registerCombatCommand("fireStunCannon"); core.commandService.registerCombatCommand("fireVoidRocketLauncher"); - // Bounty Hunter core.commandService.registerCombatCommand("bh_ae_dm_1"); @@ -130,8 +129,6 @@ public class CombatCommands { core.commandService.registerCombatCommand("bh_sh_2"); core.commandService.registerCombatCommand("bh_sh_3"); - - // Jedi core.commandService.registerCombatCommand("fs_sweep_1"); @@ -195,7 +192,6 @@ public class CombatCommands { core.commandService.registerCommand("fs_buff_invis_1"); // Force Cloak core.commandService.registerCombatCommand("fs_force_throw_1"); core.commandService.registerCommand("forceThrow"); - // Commando @@ -233,8 +229,8 @@ public class CombatCommands { core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_4"); core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_5"); core.commandService.registerCombatCommand("co_armor_cracker"); - core.commandService.registerCombatCommand("co_cluster_bomb"); - core.commandService.registerCombatCommand("co_cluster_bomblet"); + //core.commandService.registerCombatCommand("co_cluster_bomb"); + //core.commandService.registerCombatCommand("co_cluster_bomblet"); core.commandService.registerCombatCommand("co_del_ae_cc_1_1"); core.commandService.registerCombatCommand("co_del_ae_cc_1_2"); core.commandService.registerCombatCommand("co_del_ae_cc_1_3"); @@ -307,9 +303,10 @@ public class CombatCommands { core.commandService.registerCombatCommand("co_sh_1"); core.commandService.registerCombatCommand("co_sh_2"); core.commandService.registerCombatCommand("co_sh_3"); + core.commandService.registerCombatCommand("co_stand_fast"); core.commandService.registerCommand("co_hw_dot"); core.commandService.registerCommand("co_ae_hw_dot"); - + core.commandService.registerCommand("co_position_secured"); // Entertainer @@ -519,6 +516,7 @@ public class CombatCommands { core.commandService.registerCommand("of_buff_def_9"); core.commandService.registerCommand("of_emergency_shield"); core.commandService.registerCommand("of_firepower_1"); + core.commandService.registerCommand("of_medical_sup_1"); core.commandService.registerCommand("of_purge_1"); core.commandService.registerCommand("of_scatter_1"); core.commandService.registerCommand("of_stimulator_1"); diff --git a/src/services/combat/CombatEvents.java b/src/services/combat/CombatEvents.java new file mode 100644 index 00000000..f41a0098 --- /dev/null +++ b/src/services/combat/CombatEvents.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.combat; + +import resources.objects.creature.CreatureObject; +import engine.resources.common.Event; + +public class CombatEvents implements Event { + + public class DamageTaken implements Event { + + public CreatureObject attacker; + + } + +} diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 1522fce0..b943779c 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -48,6 +48,7 @@ import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; +import services.combat.CombatEvents.DamageTaken; import services.command.CombatCommand; import services.sui.SUIService.MessageBoxType; import services.sui.SUIWindow; @@ -64,6 +65,7 @@ public class CombatService implements INetworkDispatch { private NGECore core; private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + private CombatEvents events = new CombatEvents(); public CombatService(NGECore core) { this.core = core; @@ -240,8 +242,24 @@ public class CombatService implements INetworkDispatch { } float damage = calculateDamage(attacker, target, weapon, command); + + if(damage > 0) + applyDamage(attacker, target, (int) damage); + + sendCombatPackets(attacker, target, weapon, command, actionCounter, damage, 0, HitType.HIT); + + if(FileUtilities.doesFileExist("scripts/commands/combat/" + command.getCommandName() + ".py")) + core.scriptService.callScript("scripts/commands/combat/", command.getCommandName(), "run", core, attacker, target, null); + } + private void applyDamage(CreatureObject attacker, TangibleObject target, int damage) { + target.setConditionDamage(target.getConditionDamage() + damage); + DamageTaken event = events.new DamageTaken(); + event.attacker = attacker; + target.getEventBus().publish(event); + } + private void doAreaCombat(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { float x = attacker.getWorldPosition().x; @@ -322,11 +340,16 @@ public class CombatService implements INetworkDispatch { int armorAbsorbed = (int) (damageBeforeArmor - damage); if(mitigationType == HitType.BLOCK) { - float blockValue = (attacker.getStrength() + attacker.getSkillMod("combat_block_value").getBase()) / 2 + 25; + float blockValue = (attacker.getStrength() + attacker.getSkillModBase("combat_block_value")) / 2 + 25; damage -= blockValue; } + if(command.getAttackType() != 1 && target.getSkillMod("area_damage_resist_full_percentage") != null) { + if(new Random().nextFloat() <= target.getSkillModBase("area_damage_resist_full_percentage")) + damage = 0; + } + if(damage > 0) applyDamage(attacker, target, (int) damage); @@ -353,7 +376,7 @@ public class CombatService implements INetworkDispatch { } - private void sendCombatPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) { + private void sendCombatPackets(CreatureObject attacker, TangibleObject target, WeaponObject weapon, CombatCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) { String animationStr = command.getRandomAnimation(weapon); @@ -382,11 +405,21 @@ public class CombatService implements INetworkDispatch { private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { + float cooldown = 0; + CombatAction combatAction = new CombatAction(CRC.StringtoCRC(command.getDefaultAnimations()[0]), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC()); ObjControllerMessage objController = new ObjControllerMessage(0x1B, combatAction); attacker.notifyObserversInRange(objController, true, 125); - StartTask startTask = new StartTask(actionCounter, attacker.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), command.getCooldown()); + cooldown = command.getCooldown(); + System.out.println(cooldown); + + if(attacker.getSkillMod("expertise_cooldown_line_of_heal") != null) + cooldown -= attacker.getSkillMod("expertise_cooldown_line_of_heal").getBase(); + if(attacker.getSkillMod("expertise_cooldown_line_sh") != null) + cooldown -= ((attacker.getSkillMod("expertise_cooldown_line_sh").getBase())/10); + + StartTask startTask = new StartTask(actionCounter, attacker.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), cooldown); ObjControllerMessage objController2 = new ObjControllerMessage(0x0B, startTask); attacker.getClient().getSession().write(objController2.serialize()); @@ -433,6 +466,9 @@ public class CombatService implements INetworkDispatch { baseArmor = target.getSkillMod("electricity").getBase(); } + + if(target.getSkillMod("expertise_innate_reduction_all_player") != null) + baseArmor *= (100 - target.getSkillMod("expertise_innate_reduction_all_player").getBase()) / 100; float mitigation = (float) (90 * (1 - Math.exp(-0.000125 * baseArmor)) + baseArmor / 9000); @@ -479,8 +515,7 @@ public class CombatService implements INetworkDispatch { if(actionCost == 0 && healthCost == 0) return true; - if(attacker.getSkillMod("expertise_action_all") != null) - actionCost *= attacker.getSkillMod("expertise_action_all").getBase(); + actionCost *= getWeaponActionCostReduction(attacker, weapon); float newAction = attacker.getAction() - actionCost; if(newAction <= 0) @@ -558,6 +593,8 @@ public class CombatService implements INetworkDispatch { } + rawDamage *= getWeaponDamageIncrease(attacker, weapon); + if(target.getSkillMod("damage_decrease_percentage") != null) { rawDamage *= (1 - (target.getSkillMod("damage_decrease_percentage").getBase() / 100)); } @@ -565,11 +602,7 @@ public class CombatService implements INetworkDispatch { if(target.getSkillMod("combat_divide_damage_dealt") != null) { rawDamage *= (1 - (target.getSkillMod("combat_divide_damage_dealt").getBase() / 100)); } - - if(attacker.getSkillMod("expertise_damage_melee") != null) { - rawDamage *= (1 + (attacker.getSkillMod("expertise_damage_melee").getBase() / 100)); - } - + return rawDamage; } @@ -677,7 +710,7 @@ public class CombatService implements INetworkDispatch { } - float critChance = (float) attacker.getSkillMod("display_only_critical").getBase() / 10000; + float critChance = (float) (attacker.getSkillMod("display_only_critical").getBase() - target.getSkillModBase("display_only_expertise_critical_hit_reduction")) / 10000; r = random.nextFloat(); if(r <= critChance) return HitType.CRITICAL; @@ -693,7 +726,7 @@ public class CombatService implements INetworkDispatch { float r; Random random = new Random(); - float blockChance = (float) target.getSkillMod("display_only_block").getBase() / 10000; + float blockChance = (float) target.getSkillModBase("display_only_block") / 10000; r = random.nextFloat(); if(r <= blockChance) @@ -701,7 +734,7 @@ public class CombatService implements INetworkDispatch { if(command.getAttackType() == 0 || command.getAttackType() == 2 || command.getAttackType() == 3) { - float evasionChance = (float) target.getSkillMod("display_only_evasion").getBase() / 10000; + float evasionChance = (float) target.getSkillModBase("display_only_evasion") / 10000; r = random.nextFloat(); if(r <= evasionChance) @@ -711,7 +744,7 @@ public class CombatService implements INetworkDispatch { if(hitType == HitType.HIT && target.getSkillMod("display_only_glancing_blow") != null) { - float glanceChance = (float) target.getSkillMod("display_only_glancing_blow").getBase() / 10000; + float glanceChance = (float) target.getSkillModBase("display_only_glancing_blow") / 10000; r = random.nextFloat(); if(r <= glanceChance) @@ -845,6 +878,12 @@ public class CombatService implements INetworkDispatch { private void doSingleTargetHeal(CreatureObject healer, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { + if(command.getDotDuration() > 0) { + addHealOverTimeToCreature(healer, target, command); + return; + } + + int healAmount = command.getAddedDamage(); int healPotency = 0; @@ -858,8 +897,10 @@ public class CombatService implements INetworkDispatch { healPotency += healer.getSkillMod("expertise_healing_line_sm_heal").getBase(); if(healer.getSkillMod("expertise_healing_line_sp_heal") != null) healPotency += healer.getSkillMod("expertise_healing_line_sp_heal").getBase(); + if(healer.getSkillMod("expertise_stance_healing_line_fs_heal") != null) + healPotency += healer.getSkillMod("expertise_stance_healing_line_fs_heal").getBase(); if(healPotency > 0) - healAmount += (healAmount * (healPotency / 100)); + healAmount += ((healAmount * healPotency) / 100); if(target.getSkillMod("expertise_healing_reduction") != null) healAmount *= (1 - target.getSkillMod("expertise_healing_reduction").getBase() / 100); @@ -1123,6 +1164,10 @@ public class CombatService implements INetworkDispatch { } + if(target.getSkillMod("expertise_innate_reduction_all_player") != null) { + baseArmor *= (100 - target.getSkillMod("expertise_innate_reduction_all_player").getBase()) / 100; + } + if(baseArmor > 0) { float mitigation = (float) (90 * (1 - Math.exp(-0.000125 * baseArmor)) + baseArmor / 9000); mitigation /= 100; @@ -1137,7 +1182,162 @@ public class CombatService implements INetworkDispatch { applyDamage(attacker, target, damage); } + + public void doSelfBuff(CreatureObject creature, WeaponObject weapon, CombatCommand command, int actionCounter) { + + boolean success = true; + + if(!applySpecialCost(creature, weapon, command)) + success = false; + + if(!success) { + IoSession session = creature.getClient().getSession(); + CommandEnqueueRemove commandRemove = new CommandEnqueueRemove(creature.getObjectId(), actionCounter); + session.write(new ObjControllerMessage(0x0B, commandRemove).serialize()); + StartTask startTask = new StartTask(actionCounter, creature.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), -1); + session.write(new ObjControllerMessage(0x0B, startTask).serialize()); + return; + } + + core.buffService.addBuffToCreature(creature, command.getBuffNameSelf()); + StartTask startTask = new StartTask(actionCounter, creature.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), command.getCooldown()); + ObjControllerMessage objController2 = new ObjControllerMessage(0x0B, startTask); + creature.getClient().getSession().write(objController2.serialize()); + + CommandEnqueueRemove commandRemove = new CommandEnqueueRemove(creature.getObjectID(), actionCounter); + ObjControllerMessage objController3 = new ObjControllerMessage(0x0B, commandRemove); + creature.getClient().getSession().write(objController3.serialize()); + + + } + + public void addHealOverTimeToCreature(final CreatureObject healer, final CreatureObject target, final CombatCommand command) { + + if(target.getDotByName(command.getCommandName()) != null) { + + DamageOverTime oldDot = target.getDotByName(command.getCommandName()); + oldDot.getTask().cancel(true); + target.removeDot(oldDot); + + } + + final DamageOverTime dot = new DamageOverTime(command.getCommandName(), null, command.getDotType(), command.getDotDuration(), command.getDotIntensity()); + target.addDot(dot); + dot.setStartTime(System.currentTimeMillis()); + + final ScheduledFuture task = scheduler.scheduleAtFixedRate(new Runnable() { + + @Override + public void run() { + + if(dot.getRemainingDuration() <= 0) { + target.removeDot(dot); + dot.getTask().cancel(true); + } + + doHealOverTimeTick(healer, target, command, dot); + + } + + + + }, 0, command.getDotDuration() / (command.getAddedDamage() / command.getDotIntensity()), TimeUnit.SECONDS); + + dot.setTask(task); + + + } + + private void doHealOverTimeTick(CreatureObject healer, CreatureObject target, CombatCommand command, DamageOverTime dot) { + + int healAmount = command.getDotIntensity(); + int healPotency = 0; + + if(healer.getSkillMod("expertise_healing_all") != null) + healPotency += healer.getSkillMod("expertise_healing_all").getBase(); + if(healer.getSkillMod("expertise_healing_line_me_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_me_heal").getBase(); + if(healer.getSkillMod("expertise_healing_line_of_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_of_heal").getBase(); + if(healer.getSkillMod("expertise_healing_line_sm_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_sm_heal").getBase(); + if(healer.getSkillMod("expertise_healing_line_sp_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_sp_heal").getBase(); + if(healPotency > 0) + healAmount += (healAmount * (healPotency / 100)); + if(target.getSkillMod("expertise_healing_reduction") != null) + healAmount *= (1 - target.getSkillMod("expertise_healing_reduction").getBase() / 100); + + synchronized(target.getMutex()) { + target.setHealth(target.getHealth() + healAmount); + } + + target.notifyObservers(new PlayClientEffectLocMessage("appearance/pt_heal_2.prt", target.getPlanet().getName(), target.getWorldPosition()), true); + + } + + public float getWeaponActionCostReduction(CreatureObject attacker, WeaponObject weapon) { + + int weaponType = weapon.getWeaponType(); + int actionReduction; + + switch(weaponType) { + + case 0: actionReduction = attacker.getSkillModBase("expertise_action_weapon_0"); + case 1: actionReduction = attacker.getSkillModBase("expertise_action_weapon_1"); + case 2: actionReduction = attacker.getSkillModBase("expertise_action_weapon_2"); + case 4: actionReduction = attacker.getSkillModBase("expertise_action_weapon_4"); + case 5: actionReduction = attacker.getSkillModBase("expertise_action_weapon_5"); + case 6: actionReduction = attacker.getSkillModBase("expertise_action_weapon_6"); + case 7: actionReduction = attacker.getSkillModBase("expertise_action_weapon_7"); + case 8: actionReduction = attacker.getSkillModBase("expertise_action_weapon_8"); + case 9: actionReduction = attacker.getSkillModBase("expertise_action_weapon_9"); + case 10: actionReduction = attacker.getSkillModBase("expertise_action_weapon_10"); + case 11: actionReduction = attacker.getSkillModBase("expertise_action_weapon_11"); + case 12: actionReduction = attacker.getSkillModBase("expertise_action_weapon_3"); + + default: actionReduction = 0; + + } + + actionReduction += attacker.getSkillModBase("expertise_action_all"); + + return 1 + (actionReduction / 100); + + } + + public float getWeaponDamageIncrease(CreatureObject attacker, WeaponObject weapon) { + + int weaponType = weapon.getWeaponType(); + int weaponDmgIncrease; + + switch(weaponType) { + + case 0: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_0"); + case 1: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_1"); + case 2: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_2"); + case 4: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_4"); + case 5: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_5"); + case 6: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_6"); + case 7: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_7"); + case 8: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_8"); + case 9: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_9"); + case 10: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_10"); + case 11: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_11"); + case 12: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_3"); + + default: weaponDmgIncrease = 0; + + } + + weaponDmgIncrease += attacker.getSkillModBase("expertise_damage_all"); + + + return 1 + (weaponDmgIncrease / 100); + + } + public enum HitType{; public static final byte MISS = 0; @@ -1166,4 +1366,6 @@ public class CombatService implements INetworkDispatch { } + + } diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 41ce0c64..d02d5521 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -22,8 +22,11 @@ package services.command; import java.nio.ByteOrder; +import java.util.HashMap; import java.util.Map; import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; + import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; @@ -50,6 +53,8 @@ import resources.objects.weapon.WeaponObject; public class CommandService implements INetworkDispatch { private Vector commandLookup = new Vector(); + private ConcurrentHashMap aliases = new ConcurrentHashMap(); + private ConcurrentHashMap aliasesByCRC = new ConcurrentHashMap(); private NGECore core; public CommandService(NGECore core) { @@ -125,9 +130,28 @@ public class CommandService implements INetworkDispatch { return command; } + + public void registerAlias(String name, String target) { + Vector commands = new Vector(commandLookup); // copy for thread safety + BaseSWGCommand targetCommand = null; + for(BaseSWGCommand command : commands) { + if(command.getCommandName().equalsIgnoreCase(target)) { + targetCommand = command; + } + } + if (targetCommand == null) { return; } + + aliases.put(name, targetCommand); + aliasesByCRC.put(CRC.StringtoCRC(name), targetCommand); + + } public BaseSWGCommand getCommandByCRC(int CRC) { + if (aliasesByCRC.containsKey(CRC)) { + return aliasesByCRC.get(CRC); + } + Vector commands = new Vector(commandLookup); // copy for thread safety for(BaseSWGCommand command : commands) { @@ -140,6 +164,10 @@ public class CommandService implements INetworkDispatch { public BaseSWGCommand getCommandByName(String name) { + if (aliases.containsKey(name)) { + return aliases.get(name); + } + Vector commands = new Vector(commandLookup); // copy for thread safety for(BaseSWGCommand command : commands) { @@ -168,7 +196,7 @@ public class CommandService implements INetworkDispatch { //if((command.getHitType() == 5 || command.getHitType() == 7) && !(target instanceof CreatureObject)) // success = false; - if(!(command.getAttackType() == 2) && !(command.getHitType() == 5)) { + if(!(command.getAttackType() == 2) && !(command.getHitType() == 5) && !(command.getHitType() == 0)) { if(target == null || !(target instanceof TangibleObject) || target == attacker) success = false; } else { @@ -245,13 +273,18 @@ public class CommandService implements INetworkDispatch { core.combatService.doRevive(attacker, (CreatureObject) target, weapon, command, actionCounter); return; } + + if(command.getHitType() == 0 && command.getBuffNameSelf().length() > 0) { + core.combatService.doSelfBuff(attacker, weapon, command, actionCounter); + return; + } core.combatService.doCombat(attacker, (TangibleObject) target, weapon, command, actionCounter); } } - public void callCommand(CreatureObject actor, String commandName, SWGObject target, String commandArgs) { + public void callCommand(SWGObject actor, String commandName, SWGObject target, String commandArgs) { if (actor == null) return; diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java new file mode 100644 index 00000000..ee1122c6 --- /dev/null +++ b/src/services/gcw/FactionService.java @@ -0,0 +1,229 @@ +/******************************************************************************* + * 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.gcw; + +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import main.NGECore; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; +import org.python.core.Py; +import org.python.core.PyObject; + +import protocol.swg.FactionResponseMessage; + +import resources.common.FileUtilities; +import resources.common.Opcodes; +import resources.objects.creature.CreatureObject; +import resources.objects.player.PlayerObject; + +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.DatatableVisitor; +import engine.clients.Client; +import engine.resources.common.CRC; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class FactionService implements INetworkDispatch { + + private NGECore core; + + private Map factionMap = new TreeMap(); + + public FactionService(NGECore core) { + DatatableVisitor factionTable; + + this.core = core; + + try { + factionTable = ClientFileManager.loadFile("strings/en/faction/faction_names.stf", DatatableVisitor.class); + + for (int s = 0; s < factionTable.getRowCount(); s++) { + if (factionTable.getObject(s, 0) != null) { + String faction = ((String) factionTable.getObject(s, 1)); + factionMap.put(faction, CRC.StringtoCRC(faction)); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public int getCRC(String faction) { + return CRC.StringtoCRC(faction); + } + + public String getName(int factionCrc) { + for (Entry entry : factionMap.entrySet()) { + if (factionCrc == entry.getValue()) { + return entry.getKey(); + } + } + + return ""; + } + + public void addFactionStanding(CreatureObject creature, String faction, int factionStanding) { + if (!isFaction(faction)) { + return; + } + + if (creature == null) { + return; + } + + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + + if (player == null) { + return; + } + + player.modifyFactionStanding(faction, factionStanding); + } + + public void removeFactionStanding(CreatureObject creature, String faction, int factionStanding) { + if (!isFaction(faction)) { + return; + } + + if (creature == null) { + return; + } + + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + + if (player == null) { + return; + } + + player.modifyFactionStanding(faction, -factionStanding); + } + + public boolean isFaction(String faction) { + if (factionMap.containsKey(faction)) { + return true; + } + + return false; + } + + /* + * Returns true if creature2 is an ally of creature1 + * + * Will be useful for NPC AI, so they know who to help and who to be indifferent to. + */ + public boolean isFactionAlly(CreatureObject creature1, CreatureObject creature2) { + if (creature1 == null || creature2 == null) { + return false; + } + + String faction1 = creature1.getFaction(); + String faction2 = creature2.getFaction(); + + if (!isFaction(faction1) || !isFaction(faction2)) { + return false; + } + + if (FileUtilities.doesFileExist("scripts/faction/" + faction1 + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/faction/", faction1, "isAlly"); + + if (method != null && method.isCallable()) { + return ((method.__call__(Py.java2py(faction2)).asInt() == 1) ? true : false); + } + } + + return false; + } + + /* + * Returns true if creature2 is an enemy of creature1 + * + * Will be useful for NPC AI, so they know who to attack and who to be indifferent to. + */ + public boolean isFactionEnemy(CreatureObject creature1, CreatureObject creature2) { + if (creature1 == null || creature2 == null) { + return false; + } + + String faction1 = creature1.getFaction(); + String faction2 = creature2.getFaction(); + + if (!isFaction(faction1) || !isFaction(faction2)) { + return false; + } + + if (FileUtilities.doesFileExist("scripts/faction/" + faction1 + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/faction/", faction1, "isEnemy"); + + if (method != null && method.isCallable()) { + return ((method.__call__(Py.java2py(faction2)).asInt() == 1) ? true : false); + } + } + + return false; + } + + public Map getFactionMap() { + return factionMap; + } + + @Override + public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + + swgOpcodes.put(Opcodes.FactionRequestMessage, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { + Client client = core.getClient((int) session.getAttribute("connectionId")); + + if (client == null) { + return; + } + + CreatureObject creature = (CreatureObject) client.getParent(); + + if (creature == null) { + return; + } + + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + + if (player == null) { + return; + } + + session.write((new FactionResponseMessage(player.getFactionStandingMap(), 0)).serialize()); + } + + }); + } + + @Override + public void shutdown() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 1ae1f816..254e94a2 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -37,6 +37,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import resources.common.*; @@ -48,6 +49,8 @@ import org.python.core.PyObject; import com.sleepycat.persist.EntityCursor; +import protocol.swg.ChatFriendsListUpdate; +import protocol.swg.ChatOnChangeFriendStatus; import protocol.swg.ChatOnGetFriendsList; import protocol.swg.CmdSceneReady; import protocol.swg.CmdStartScene; @@ -58,6 +61,7 @@ import protocol.swg.ServerTimeMessage; import protocol.swg.UnkByteFlag; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.CrcStringTableVisitor; +import engine.clientdata.visitors.DatatableVisitor; import engine.clientdata.visitors.WorldSnapshotVisitor; import engine.clientdata.visitors.WorldSnapshotVisitor.SnapshotChunk; import engine.clients.Client; @@ -76,6 +80,7 @@ import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; import resources.objects.guild.GuildObject; +import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.staticobject.StaticObject; import resources.objects.tangible.TangibleObject; @@ -133,7 +138,7 @@ public class ObjectService implements INetworkDispatch { } } - public SWGObject createObject(String Template, long objectID, Planet planet, Point3D position, Quaternion orientation) { + public SWGObject createObject(String Template, long objectID, Planet planet, Point3D position, Quaternion orientation, String customServerTemplate) { SWGObject object = null; CrcStringTableVisitor crcTable; try { @@ -145,8 +150,11 @@ public class ObjectService implements INetworkDispatch { } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } + boolean isSnapshot = false; if(objectID == 0) objectID = generateObjectID(); + else + isSnapshot = true; if(Template.startsWith("object/creature")) { @@ -164,9 +172,17 @@ public class ObjectService implements INetworkDispatch { object = new WeaponObject(objectID, planet, Template, position, orientation); - } else if(Template.startsWith("object/building")){ + } else if(Template.startsWith("object/building") || Template.startsWith("object/static/worldbuilding/structures")){ object = new BuildingObject(objectID, planet, position, orientation, Template); + if(!isSnapshot && object.getPortalVisitor() != null) { + int cellCount = object.getPortalVisitor().cells.size() - 1; // -1 for index 0 cell which is outside the building and used for ai pathfinding + for (int i = 0; i < cellCount; i++) { + CellObject cell = (CellObject) createObject("object/cell/shared_cell.iff", planet); + cell.setCellNumber(i+1); + object.add(cell); + } + } } else if(Template.startsWith("object/cell")) { @@ -192,7 +208,11 @@ public class ObjectService implements INetworkDispatch { object = new WaypointObject(objectID, planet, position); - } else { + } else if(Template.startsWith("object/mission")) { + + object = new MissionObject(objectID, planet, Template); + + } else { return null; @@ -200,16 +220,50 @@ public class ObjectService implements INetworkDispatch { object.setPlanetId(planet.getID()); + object.setAttachment("serverTemplate", ((customServerTemplate != null) ? customServerTemplate : object.getTemplate())); + + object.setisInSnapshot(isSnapshot); //loadServerTemplate(object); objectList.put(objectID, object); - + + // Set Default Tangible Options + /* + if (Template.startsWith("object/creature/") || Template.startsWith("object/mobile/")) { + ((CreatureObject) object).setOptionsBitmask(Options.MOBILE); + + if (Template.startsWith("object/mobile/beast_master/")) { + ((CreatureObject) object).setOptionsBitmask(Options.NONE); + } else if (Template.startsWith("object/mobile/vendor/")) { + ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.USABLE); + } else if (Template.startsWith("object/mobile/vehicle/")) { + ((CreatureObject) object).addOption(Options.INVULNERABLE | Options.MOUNT); + } else if (Template.startsWith("object/mobile/hologram/")) { + ((CreatureObject) object).addOption(Options.INVULNERABLE); + } else if (Template.startsWith("object/creature/npc/theme_park/")) { + ((CreatureObject) object).addOption(Options.INVULNERABLE); + } else if (Template.startsWith("object/creature/general/")) { + ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.CONVERSABLE); + } else if (Template.startsWith("object/creature/droid/")) { + ((CreatureObject) object).addOption(Options.INVULNERABLE); + } + } else if (object instanceof TangibleObject) { + ((TangibleObject) object).setOptionsBitmask(Options.INVULNERABLE); + + if (Template.startsWith("object/tangible/vendor/")) { + ((CreatureObject) object).addOption(Options.USABLE); + } else if (Template.startsWith("object/creature/droid/")) { + ((CreatureObject) object).addOption(Options.INVULNERABLE); + } + } + */ + return object; } public void loadServerTemplate(SWGObject object) { - String template = object.getTemplate(); + String template = ((object.getAttachment("serverTemplate") == null) ? object.getTemplate() : ((String) object.getAttachment("serverTemplate"))); String serverTemplate = template.replace(".iff", ""); // check if template is empty(4 default lines) to reduce RAM usage(saves about 500 MB of RAM) try { @@ -231,7 +285,6 @@ public class ObjectService implements INetworkDispatch { } catch (IOException e) { System.out.println("!IO error " + template.toString()); } - } public SWGObject createObject(String Template, Planet planet) { @@ -242,6 +295,10 @@ public class ObjectService implements INetworkDispatch { return createObject(Template, 0, planet, new Point3D(x, y, z), new Quaternion(1, 0, 0, 0)); } + public SWGObject createObject(String Template, long objectID, Planet planet, Point3D position, Quaternion orientation) { + return createObject(Template, objectID, planet, position, orientation, null); + } + public void addObjectToScene(SWGObject object) { core.simulationService.add(object, object.getPosition().x, object.getPosition().z); @@ -376,7 +433,7 @@ public class ObjectService implements INetworkDispatch { } catch (SQLException e) { e.printStackTrace(); } - if(getObject(newId) == null) + if(getObject(newId) == null && getCreatureFromDB(newId) == null) return newId; else return generateObjectID(); @@ -392,10 +449,16 @@ public class ObjectService implements INetworkDispatch { String filePath = "scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", "") + object.getTemplate().split("shared_" , 2)[1].replace(".iff", "") + ".py"; if (FileUtilities.doesFileExist(filePath)) { - PyObject method = core.scriptService.getMethod("scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", ""), object.getTemplate().split("shared_" , 2)[1].replace(".iff", ""), "useObject"); + filePath = "scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", ""); + String fileName = object.getTemplate().split("shared_" , 2)[1].replace(".iff", ""); - if (method != null && method.isCallable()) { - method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(object)); + PyObject method1 = core.scriptService.getMethod("scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", ""), object.getTemplate().split("shared_" , 2)[1].replace(".iff", ""), "use"); + PyObject method2 = core.scriptService.getMethod("scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", ""), object.getTemplate().split("shared_" , 2)[1].replace(".iff", ""), "useObject"); + + if (method1 != null && method1.isCallable()) { + method1.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(object)); + } else if (method2 != null && method2.isCallable()) { + method2.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(object)); } } } @@ -488,11 +551,11 @@ public class ObjectService implements INetworkDispatch { CmdStartScene startScene = new CmdStartScene((byte) 0, objectId, creature.getPlanet().getPath(), creature.getTemplate(), position.x, position.y, position.z, System.currentTimeMillis() / 1000, 0); session.write(startScene.serialize()); - creature.makeAware(creature); creature.makeAware(core.guildService.getGuildObject()); core.simulationService.handleZoneIn(client); + creature.makeAware(creature); CmdSceneReady sceneReady = new CmdSceneReady(); client.getSession().write(sceneReady.serialize()); @@ -502,37 +565,41 @@ public class ObjectService implements INetworkDispatch { ChatOnGetFriendsList friendsListMessage = new ChatOnGetFriendsList(ghost); client.getSession().write(friendsListMessage.serialize()); + if (ghost != null) { + + String objectShortName = creature.getCustomName().toLowerCase(); + + if (creature.getCustomName().contains(" ")) { + String[] splitName = creature.getCustomName().toLowerCase().split(" "); + objectShortName = splitName[0].toLowerCase(); + } + + core.chatService.playerStatusChange(objectShortName, (byte) 1); + + if (ghost.getFriendList().isEmpty() == false) { + // Find out what friends are online/offline + for (String friend : ghost.getFriendList()) { + SWGObject friendObject = (SWGObject) core.chatService.getObjectByFirstName(friend); + if (friendObject == null) + continue; + if(friendObject.isInQuadtree() == true) { + ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend, (byte) 1); + client.getSession().write(onlineNotifyStatus.serialize()); + + } else { + ChatOnChangeFriendStatus changeStatus = new ChatOnChangeFriendStatus(creature.getObjectID(), friend, 0); + client.getSession().write(changeStatus.serialize()); + } + } + } + } + core.playerService.postZoneIn(creature); } }); - objControllerOpcodes.put(ObjControllerOpcodes.USE_OBJECT, new INetworkRemoteEvent() { - - @Override - public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { - buffer.order(ByteOrder.LITTLE_ENDIAN); - - CreatureObject creature = (CreatureObject) getObject(buffer.getLong()); - - if (creature == null || creature.getClient() == null) { - return; - } - - buffer.skip(4); - - SWGObject object = getObject(buffer.getLong()); - - if (object == null) { - return; - } - - useObject(creature, object); - } - - }); - } public void shutdown() { @@ -600,6 +667,125 @@ public class ObjectService implements INetworkDispatch { public void createChildObject(SWGObject parent, String template, float x, float y, float z, float qy, float qw) { createChildObject(parent, template, new Point3D(x, y, z), new Quaternion(qw, 0, qy, 0)); } - + public void loadBuildoutObjects(Planet planet) throws InstantiationException, IllegalAccessException { + + DatatableVisitor buildoutTable = ClientFileManager.loadFile("datatables/buildout/areas_" + planet.getName() + ".iff", DatatableVisitor.class); + + for (int i = 0; i < buildoutTable.getRowCount(); i++) { + + String areaName = (String) buildoutTable.getObject(i, 0); + float x1 = (Float) buildoutTable.getObject(i, 1); + float z1 = (Float) buildoutTable.getObject(i, 2); + + readBuildoutDatatable(ClientFileManager.loadFile("datatables/buildout/" + planet.getName() + "/" + areaName + ".iff", DatatableVisitor.class), planet, x1, z1); + + } + } + + public void readBuildoutDatatable(DatatableVisitor buildoutTable, Planet planet, float x1, float z1) throws InstantiationException, IllegalAccessException { + + CrcStringTableVisitor crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class); + + for (int i = 0; i < buildoutTable.getRowCount(); i++) { + + String template; + + if(buildoutTable.getColumnCount() <= 11) + template = crcTable.getTemplateString((Integer) buildoutTable.getObject(i, 0)); + else + template = crcTable.getTemplateString((Integer) buildoutTable.getObject(i, 3)); + + if(template != null) { + + float px, py, pz, qw, qx, qy, qz, radius; + long objectId = 0, containerId = 0; + int type = 0, cellIndex = 0, portalCRC; + + if(buildoutTable.getColumnCount() <= 11) { + + cellIndex = (Integer) buildoutTable.getObject(i, 1); + px = (Float) buildoutTable.getObject(i, 2); + py = (Float) buildoutTable.getObject(i, 3); + pz = (Float) buildoutTable.getObject(i, 4); + qw = (Float) buildoutTable.getObject(i, 5); + qx = (Float) buildoutTable.getObject(i, 6); + qy = (Float) buildoutTable.getObject(i, 7); + qz = (Float) buildoutTable.getObject(i, 8); + radius = (Float) buildoutTable.getObject(i, 9); + portalCRC = (Integer) buildoutTable.getObject(i, 10); + + } else { + + objectId = (Integer) buildoutTable.getObject(i, 0); + containerId = (Integer) buildoutTable.getObject(i, 1); + type = (Integer) buildoutTable.getObject(i, 2); + cellIndex = (Integer) buildoutTable.getObject(i, 4); + + px = (Float) buildoutTable.getObject(i, 5); + py = (Float) buildoutTable.getObject(i, 6); + pz = (Float) buildoutTable.getObject(i, 7); + qw = (Float) buildoutTable.getObject(i, 8); + qx = (Float) buildoutTable.getObject(i, 9); + qy = (Float) buildoutTable.getObject(i, 10); + qz = (Float) buildoutTable.getObject(i, 11); + radius = (Float) buildoutTable.getObject(i, 12); + portalCRC = (Integer) buildoutTable.getObject(i, 13); + + } + + SWGObject object; + + if(objectId != 0 && containerId == 0) { + if(portalCRC != 0) + objectId = 0; + object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz)); + if(object == null) + continue; + if(radius > 256) + object.setAttachment("bigSpawnRange", new Boolean(true)); + core.simulationService.add(object, object.getPosition().x, object.getPosition().z); + } else if(objectId != 0 && containerId != 0 && cellIndex != 0) { + object = createObject(template, objectId, planet, new Point3D(px, py, pz), new Quaternion(qw, qx, qy, qz)); + if(object instanceof CellObject) + ((CellObject) object).setCellNumber(cellIndex); + SWGObject parent = getObject(containerId); + + if(parent != null && object != null) + parent.add(object); + } else { + object = createObject(template, 0, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz)); + core.simulationService.add(object, object.getPosition().x, object.getPosition().z); + } + + //System.out.println("Spawning: " + template + " at: X:" + object.getPosition().x + " Y: " + object.getPosition().y + " Z: " + object.getPosition().z); + + } + + + } + + + } + + public int objsInContainer(SWGObject owner, TangibleObject container) { + if (owner == null) { + Console.println("Owner null!"); + } + if (container == null) { + Console.println("Container is null!"); + } + final AtomicInteger count = new AtomicInteger(); + + container.viewChildren(owner, false, false, new Traverser() { + + @Override + public void process(SWGObject child) { + count.getAndIncrement(); + } + + }); + + return count.get(); + } } diff --git a/src/services/spawn/DynamicSpawnArea.java b/src/services/spawn/DynamicSpawnArea.java new file mode 100644 index 00000000..e588e4cd --- /dev/null +++ b/src/services/spawn/DynamicSpawnArea.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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.spawn; + +import net.engio.mbassy.listener.Handler; +import resources.common.collidables.AbstractCollidable; +import resources.common.collidables.AbstractCollidable.EnterEvent; +import resources.common.collidables.AbstractCollidable.ExitEvent; +import engine.resources.scene.Planet; + +public class DynamicSpawnArea extends SpawnArea { + + public DynamicSpawnArea(Planet planet, AbstractCollidable area) { + super(planet, area); + } + + @Override + @Handler + public void onEnter(EnterEvent event) { + + } + + @Override + @Handler + public void onExit(ExitEvent event) { + + } + +} diff --git a/src/services/spawn/LairGroupTemplate.java b/src/services/spawn/LairGroupTemplate.java new file mode 100644 index 00000000..0f6347dd --- /dev/null +++ b/src/services/spawn/LairGroupTemplate.java @@ -0,0 +1,17 @@ +package services.spawn; + +import java.util.Vector; + +public class LairGroupTemplate { + + private Vector lairSpawnTemplates; + + public Vector getLairSpawnTemplates() { + return lairSpawnTemplates; + } + + public void setLairSpawnTemplates(Vector lairSpawnTemplates) { + this.lairSpawnTemplates = lairSpawnTemplates; + } + +} diff --git a/src/services/spawn/LairSpawnArea.java b/src/services/spawn/LairSpawnArea.java new file mode 100644 index 00000000..da136ba6 --- /dev/null +++ b/src/services/spawn/LairSpawnArea.java @@ -0,0 +1,128 @@ +/******************************************************************************* + * 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.spawn; + +import java.util.Random; +import java.util.Vector; + +import main.NGECore; +import net.engio.mbassy.listener.Handler; +import resources.common.collidables.AbstractCollidable; +import resources.common.collidables.AbstractCollidable.EnterEvent; +import resources.common.collidables.AbstractCollidable.ExitEvent; +import resources.objects.creature.CreatureObject; +import services.SimulationService.MoveEvent; +import services.TerrainService; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; + +public class LairSpawnArea extends SpawnArea { + + private LairGroupTemplate lairGroup; + + public LairSpawnArea(Planet planet, AbstractCollidable area) { + super(planet, area); + } + + public LairGroupTemplate getLairGroup() { + return lairGroup; + } + + public void setLairGroup(LairGroupTemplate lairGroup) { + this.lairGroup = lairGroup; + } + + public void spawnLair(CreatureObject object) { + + Vector lairTemplates = lairGroup.getLairSpawnTemplates(); + + if(lairGroup == null || lairTemplates.isEmpty()) + return; + + Point3D randomPosition = getRandomPosition(object.getWorldPosition(), 32.f, 256.f); + + if(randomPosition == null) + return; + + TerrainService terrainSvc = NGECore.getInstance().terrainService; + + float height = terrainSvc.getHeight(getPlanet().getID(), randomPosition.x, randomPosition.z); + randomPosition.y = height; + + if(!terrainSvc.canBuildAtPosition(object, randomPosition.x, randomPosition.z)) + return; + + Random random = new Random(); + + LairSpawnTemplate lairSpawn = lairTemplates.get(random.nextInt(lairTemplates.size())); + + int level = random.nextInt((int) (lairSpawn.getMaxLevel() - lairSpawn.getMinLevel()) + 1) + lairSpawn.getMinLevel(); + + NGECore.getInstance().spawnService.spawnLair(lairSpawn.getLairTemplate(), getPlanet(), randomPosition, level); + + } + + @Override + @Handler + public void onEnter(EnterEvent event) { + + SWGObject object = event.object; + + if(object == null || !(object instanceof CreatureObject)) + return; + + CreatureObject creature = (CreatureObject) object; + + if(creature.getSlottedObject("ghost") == null) + return; + + spawnLair(creature); + + } + + @Override + @Handler + public void onExit(ExitEvent event) { + + } + + @Handler + public void onMove(MoveEvent event) { + + SWGObject object = event.object; + + if(object == null || !(object instanceof CreatureObject) || object.getContainer() != null) + return; + + CreatureObject creature = (CreatureObject) object; + + if(creature.getSlottedObject("ghost") == null) + return; + + if(new Random().nextFloat() <= 0.10) + spawnLair(creature); + + } + + +} diff --git a/src/services/spawn/LairSpawnTemplate.java b/src/services/spawn/LairSpawnTemplate.java new file mode 100644 index 00000000..50538b9a --- /dev/null +++ b/src/services/spawn/LairSpawnTemplate.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * 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.spawn; + +public class LairSpawnTemplate { + + private int maxSpawnLimit; + private LairTemplate lairTemplate; + private int minLevel; + private int maxLevel; + + public int getMaxSpawnLimit() { + return maxSpawnLimit; + } + + public void setMaxSpawnLimit(int maxSpawnLimit) { + this.maxSpawnLimit = maxSpawnLimit; + } + + public LairTemplate getLairTemplate() { + return lairTemplate; + } + + public void setLairTemplate(LairTemplate lairTemplate) { + this.lairTemplate = lairTemplate; + } + + public int getMinLevel() { + return minLevel; + } + + public void setMinLevel(int minLevel) { + this.minLevel = minLevel; + } + + public int getMaxLevel() { + return maxLevel; + } + + public void setMaxLevel(int maxLevel) { + this.maxLevel = maxLevel; + } + + + +} diff --git a/src/services/spawn/LairTemplate.java b/src/services/spawn/LairTemplate.java new file mode 100644 index 00000000..94df1517 --- /dev/null +++ b/src/services/spawn/LairTemplate.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * 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.spawn; + +public class LairTemplate { + + private String lairCRC; + private String mobileName; + + public String getLairCRC() { + return lairCRC; + } + + public void setLairCRC(String lairCRC) { + this.lairCRC = lairCRC; + } + + public String getMobileName() { + return mobileName; + } + + public void setMobileName(String mobileName) { + this.mobileName = mobileName; + } + +} diff --git a/src/services/spawn/SpawnArea.java b/src/services/spawn/SpawnArea.java new file mode 100644 index 00000000..2d64c576 --- /dev/null +++ b/src/services/spawn/SpawnArea.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * 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.spawn; + +import java.util.Vector; + +import net.engio.mbassy.listener.Handler; + +import resources.common.collidables.AbstractCollidable; +import resources.common.collidables.AbstractCollidable.EnterEvent; +import resources.common.collidables.AbstractCollidable.ExitEvent; + +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; + +public abstract class SpawnArea { + + private Planet planet; + private Vector templates; + private AbstractCollidable area; + private Vector observers = new Vector(); + + public SpawnArea(Planet planet, AbstractCollidable area) { + this.planet = planet; + this.area = area; + area.getEventBus().subscribe(this); + } + + public Planet getPlanet() { + return planet; + } + + public void setPlanet(Planet planet) { + this.planet = planet; + } + + public Vector getTemplates() { + return templates; + } + + public void setTemplates(Vector templates) { + this.templates = templates; + } + + public AbstractCollidable getArea() { + return area; + } + + public void setArea(AbstractCollidable area) { + this.area = area; + } + + @Handler + public abstract void onEnter(EnterEvent event); + @Handler + public abstract void onExit(ExitEvent event); + + public Vector getObservers() { + return observers; + } + + public Point3D getRandomPosition() { + + int tries = 0; + + while(tries++ < 10) { + Point3D randomPos = area.getRandomPosition(); + if(area.doesCollide(randomPos)) + return randomPos; + } + + return null; + + } + + public Point3D getRandomPosition(Point3D origin, float minDistance, float maxDistance) { + + int tries = 0; + + while(tries++ < 10) { + Point3D randomPos = area.getRandomPosition(origin, minDistance, maxDistance); + if(area.doesCollide(randomPos)) + return randomPos; + } + + return null; + + } + + +} diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java new file mode 100644 index 00000000..1fd5152f --- /dev/null +++ b/src/services/spawn/SpawnService.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * 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.spawn; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import main.NGECore; + +public class SpawnService { + + private NGECore core; + private Map> spawnAreas = new ConcurrentHashMap>(); + + public SpawnService(NGECore core) { + + } + + public void spawnCreature(String template, float x, float y, float z) { + spawnCreature(template, new Point3D(x, y, z)); + } + + public void spawnCreature(String template, Point3D position) { + + } + + public void spawnLair(LairTemplate lairTemplate, Planet planet, Point3D position, int level) { + + } + + +} diff --git a/src/services/spawn/StaticSpawnArea.java b/src/services/spawn/StaticSpawnArea.java new file mode 100644 index 00000000..64de8d63 --- /dev/null +++ b/src/services/spawn/StaticSpawnArea.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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.spawn; + +import net.engio.mbassy.listener.Handler; +import resources.common.collidables.AbstractCollidable; +import resources.common.collidables.AbstractCollidable.EnterEvent; +import resources.common.collidables.AbstractCollidable.ExitEvent; +import engine.resources.scene.Planet; + +public class StaticSpawnArea extends SpawnArea { + + public StaticSpawnArea(Planet planet, AbstractCollidable area) { + super(planet, area); + } + + @Override + @Handler + public void onEnter(EnterEvent event) { + + } + + @Override + @Handler + public void onExit(ExitEvent event) { + + } + +} diff --git a/src/services/sui/SUIService.java b/src/services/sui/SUIService.java index be3c2ecf..928fb404 100644 --- a/src/services/sui/SUIService.java +++ b/src/services/sui/SUIService.java @@ -83,8 +83,6 @@ public class SUIService implements INetworkDispatch { return; core.scriptService.callScript("scripts/radial/", getRadialFilename(target), "createRadial", core, owner, target, request.getRadialOptions()); - if(getRadialFilename(target).equals("default")) - return; sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount()); @@ -104,7 +102,6 @@ public class SUIService implements INetworkDispatch { objMenuSelect.deserialize(data); Client client = core.getClient((Integer) session.getAttribute("connectionId")); - if(client == null || client.getSession() == null) return; @@ -113,7 +110,7 @@ public class SUIService implements INetworkDispatch { if(target == null || owner == null) return; - + core.scriptService.callScript("scripts/radial/", getRadialFilename(target), "handleSelection", core, owner, target, objMenuSelect.getSelection()); } diff --git a/src/services/travel/ShuttleCountdown.java b/src/services/travel/ShuttleCountdown.java deleted file mode 100644 index ce4c7042..00000000 --- a/src/services/travel/ShuttleCountdown.java +++ /dev/null @@ -1,39 +0,0 @@ -package services.travel; - -import java.util.Vector; -import java.util.Map.Entry; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import main.NGECore; -import resources.common.Console; -import engine.resources.scene.Planet; - -public class ShuttleCountdown implements Runnable { - - private NGECore core; - private final AtomicInteger runCount = new AtomicInteger(); - private final Runnable delegate; - private volatile ScheduledFuture self; - - public ShuttleCountdown(Runnable delegate, NGECore core) { - this.core = core; - this.delegate = delegate; - } - - @Override - public void run() { - delegate.run(); - Console.println("Atomic int: " + runCount.get()); - if (runCount.incrementAndGet() == 60) { - Console.println("Shutting down countdown!"); - self.cancel(false); - } - } - - public void startCountdown(ScheduledExecutorService scheduler) { - self = scheduler.scheduleAtFixedRate(delegate, 0, 1, TimeUnit.SECONDS); - } -} diff --git a/src/services/travel/TravelPoint.java b/src/services/travel/TravelPoint.java index 27baf809..1f1771bd 100644 --- a/src/services/travel/TravelPoint.java +++ b/src/services/travel/TravelPoint.java @@ -21,6 +21,10 @@ ******************************************************************************/ package services.travel; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + import resources.common.SpawnPoint; import resources.objects.creature.CreatureObject; import engine.resources.scene.Point3D; @@ -37,6 +41,8 @@ public class TravelPoint { private boolean shuttleLanding; private int secondsRemaining; private boolean shuttleDeparting; + private ExecutorService scheduler = Executors.newFixedThreadPool(1); + private long departureTimestamp; public TravelPoint() { } @@ -96,6 +102,7 @@ public class TravelPoint { public void setShuttle(CreatureObject shuttleObj) { this.shuttle = shuttleObj; + startShuttleSchedule(); } public boolean isShuttleAvailable() { @@ -115,11 +122,15 @@ public class TravelPoint { } public int getSecondsRemaining() { - return secondsRemaining; + long currentTime = System.currentTimeMillis() / 1000; + long diff = currentTime - getDepartureTimestamp(); + + return (int) (60 - diff); } public void setSecondsRemaining(int secondsRemaining) { this.secondsRemaining = secondsRemaining; + System.out.println(secondsRemaining); } public boolean isShuttleDeparting() { @@ -129,4 +140,60 @@ public class TravelPoint { public void setShuttleDeparting(boolean shuttleDeparting) { this.shuttleDeparting = shuttleDeparting; } + + public boolean isStarport() { + if(getShuttle() != null) { + return (getShuttle().getTemplate().equals("object/creature/npc/theme_park/shared_player_transport.iff") || getShuttle().getTemplate().equals("object/creature/npc/theme_park/shared_player_transport_theed_hangar.iff")); + } else { + System.out.println("null shuttle at: " + getName()); + return false; + } + } + + private void startShuttleSchedule() { + + scheduler.execute(new Runnable() { + @Override + public void run() { + while(getShuttle() != null) { + + try { + setShuttleAvailable(true); + setShuttleLanding(false); + Thread.sleep(120000); + setShuttleAvailable(false); + setShuttleDeparting(true); + setDepartureTimestamp(System.currentTimeMillis() / 1000); + getShuttle().setPosture((byte) 2); + setShuttleDeparting(false); + Thread.sleep(60000); + setShuttleLanding(true); + getShuttle().setPosture((byte) 0); + if(isStarport()) + Thread.sleep(21000); + else + Thread.sleep(17000); + + + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + } + + }); + + + + + } + + public long getDepartureTimestamp() { + return departureTimestamp; + } + + public void setDepartureTimestamp(long depatureTimestamp) { + this.departureTimestamp = depatureTimestamp; + } } diff --git a/src/services/travel/TravelService.java b/src/services/travel/TravelService.java index 987f9492..8ab347ca 100644 --- a/src/services/travel/TravelService.java +++ b/src/services/travel/TravelService.java @@ -28,6 +28,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -96,137 +97,65 @@ public class TravelService implements INetworkDispatch { if(object == null) return; - List planetList = core.terrainService.getPlanetList(); + TravelPoint travelPoint = getNearestTravelPoint(object); - for (Planet planet : planetList) { - String planetString = planet.getName(); + if(travelPoint == null) + return; + + if(travelPoint.isStarport()) { + + List planetList = core.terrainService.getPlanetList(); - if (request.getPlanet().equals(planetString)) { - - PlanetTravelPointListResponse response = new PlanetTravelPointListResponse(planetString, travelMap.get(planet), planetList); - client.getSession().write(response.serialize()); - break; + for (Planet planet : planetList) { + String planetString = planet.getName(); + if (request.getPlanet().equals(planetString)) { + + Vector correctTravelPoints = new Vector(); + + for(TravelPoint tp : travelMap.get(planet)) { + if(tp.isStarport() || tp.getPlanetName().equalsIgnoreCase(object.getPlanet().getName())) { + correctTravelPoints.add(tp); + //Console.println(tp.getName()); + } + } + PlanetTravelPointListResponse response = new PlanetTravelPointListResponse(planetString, correctTravelPoints); + client.getSession().write(response.serialize()); + + break; + + } } + + } else { + + Planet planet = object.getPlanet(); + + PlanetTravelPointListResponse response = new PlanetTravelPointListResponse(planet.getName(), travelMap.get(planet)); + client.getSession().write(response.serialize()); + } + } }); - } - public void startShuttleSchedule() { - final Runnable shuttleRun = new Runnable() { - - @Override - public void run() { - - for (Entry> entry : travelMap.entrySet()) { - for(TravelPoint tp : entry.getValue()) { - if (tp.getShuttle() == null) - continue; - else { - - if (tp.isShuttleAvailable() == false) { - tp.getShuttle().setPosture((byte) 0); - tp.setShuttleLanding(true); - handleShuttleLanding(); - //Console.println("Started handle shuttle landing"); - } - else { - tp.getShuttle().setPosture((byte) 2); - tp.setShuttleAvailable(false); - tp.setShuttleLanding(false); - tp.setShuttleDeparting(true); - handleShuttleDeparture(); - //Console.println("Shuttle is not available."); - } - } - } - } - - } - - }; - - scheduler.scheduleAtFixedRate(shuttleRun, 83, 83, TimeUnit.SECONDS); - - //shuttleCountdown(); - } - - private void handleShuttleLanding() { - scheduler.schedule(new Runnable() { - - @Override - public void run() { - for (Entry> entry : travelMap.entrySet()) { - for(TravelPoint tp : entry.getValue()) { - if (tp.isShuttleLanding()) { - tp.setShuttleLanding(false); - tp.setShuttleAvailable(true); - //Console.println("Shuttle has landed!"); - } - } - } - } - - }, 27, TimeUnit.SECONDS); - - } - - private void handleShuttleDeparture() { - scheduler.schedule(new Runnable() { - - @Override - public void run() { - for (Entry> entry : travelMap.entrySet()) { - for(TravelPoint tp : entry.getValue()) { - tp.setShuttleDeparting(false); - tp.setSecondsRemaining(60); - - } - } - shuttleCountdown(); - //Console.println("Countdown initiated"); - } - - }, 20, TimeUnit.SECONDS); - } - - private void shuttleCountdown() { - Runnable countDown = new Runnable() { - @Override - public void run() { - for (Entry> entry : travelMap.entrySet()) { - for(TravelPoint tp : entry.getValue()) { - if (tp.getShuttle() == null || tp.isShuttleDeparting() == true || tp.isShuttleAvailable() == true || tp.getSecondsRemaining() == 0) - continue; - - else { - tp.setSecondsRemaining(tp.getSecondsRemaining() - 1); - //Console.println("Time Remaining: " + tp.getSecondsRemaining()); - } - } - } - } - - }; - - runCountdown(countDown, scheduler); - } public TravelPoint getNearestTravelPoint(SWGObject obj) { TravelPoint returnedPoint = null; Vector planetTp = travelMap.get(obj.getPlanet()); - for (TravelPoint tp : planetTp) { - //System.out.println("Distance for point " + tp.getName() + " is " + tp.getLocation().getDistance2D(obj.getWorldPosition())); - if (tp.getLocation().getDistance2D(obj.getWorldPosition()) <= 70) { - returnedPoint = tp; + synchronized(travelMap) { + for (TravelPoint tp : planetTp) { + //System.out.println("Distance for point " + tp.getName() + " is " + tp.getLocation().getDistance2D(obj.getWorldPosition())); + if (tp.getLocation().getDistance2D(obj.getWorldPosition()) <= 125) { + returnedPoint = tp; + } } } if (returnedPoint == null) { - System.out.println("NULL TravelPoint!"); + System.out.println("NULL TravelPoint at : " + core.mapService.getClosestCityName(obj)); } return returnedPoint; } @@ -238,11 +167,14 @@ public class TravelService implements INetworkDispatch { TravelPoint returnedPoint = null; - for (TravelPoint tp : tpMap) { - if (tp.getName().equals(tpName)) { - returnedPoint = tp; + synchronized(travelMap) { + for (TravelPoint tp : tpMap) { + if (tp.getName().equals(tpName)) { + returnedPoint = tp; + } } } + if (returnedPoint == null) { System.out.println("Couldn't find a travelpoint w/ name " + tpName); } return returnedPoint; } @@ -258,7 +190,6 @@ public class TravelService implements INetworkDispatch { TravelPoint travelPoint = new TravelPoint(name, x, y, z, 150); travelPoint.setPlanetName(WordUtils.capitalize(planet.getName())); - if (travelMap.containsKey(planet)) { travelMap.get(planet).add(travelPoint); @@ -271,6 +202,7 @@ public class TravelService implements INetworkDispatch { System.out.println("Added planet " + planet.getName() + " to TravelMap."); System.out.println("Added travel point " + travelPoint.getName()); } + } public void removeTravelPointByName(Planet planet, String name){ @@ -298,7 +230,7 @@ public class TravelService implements INetworkDispatch { Planet planet = core.terrainService.getPlanetByName(departurePlanet.toLowerCase()); SWGObject travelTicket = core.objectService.createObject("object/tangible/travel/travel_ticket/base/shared_base_travel_ticket.iff", planet); - + travelTicket.setStringAttribute("@obj_attr_n:travel_departure_planet", WordUtils.capitalize(departurePlanet)); travelTicket.setStringAttribute("@obj_attr_n:travel_departure_point", departureLoc); @@ -341,8 +273,8 @@ public class TravelService implements INetworkDispatch { SWGObject travelTicket = createTravelTicket(departurePlanet, departureLoc, arrivalPlanet, arrivalLoc); creatureObj.getSlottedObject("inventory").add(travelTicket); - Console.println("Total cost: " + fare); - SUIWindow window = core.suiService.createMessageBox(MessageBoxType.MESSAGE_BOX_OK, "STAR WARS GALAXIES", "Ticket purchase complete.", player, null, 0); + //Console.println("Total cost: " + fare); + SUIWindow window = core.suiService.createMessageBox(MessageBoxType.MESSAGE_BOX_OK, "STAR WARS GALAXIES", "@travel:ticket_purchase_complete", player, null, 0); core.suiService.openSUIWindow(window); creatureObj.sendSystemMessage("You successfully make a payment of " + fare + " credits to the Galactic Travel Commission.", (byte) 0); @@ -435,7 +367,7 @@ public class TravelService implements INetworkDispatch { for (int f = 0; f < travelFares.getRowCount(); f++) { Planet planet = core.terrainService.getPlanetByName((String) travelFares.getObject(f, 0)); if (travelMap.containsKey(planet)) { - int corellia = ((Integer) travelFares.getObject(f, 1)); + int corellia = ((int) travelFares.getObject(f, 1)); int dantooine = ((int) travelFares.getObject(f, 2)); int dathomir = ((int) travelFares.getObject(f, 3)); int endor = ((int) travelFares.getObject(f, 4)); @@ -477,10 +409,6 @@ public class TravelService implements INetworkDispatch { return this.travelMap; } - public void runCountdown(Runnable task, ScheduledExecutorService executor) { - new ShuttleCountdown(task, this.core).startCountdown(executor); - } - @Override public void shutdown() {