diff --git a/scripts/buffs/fs_force_run.py b/scripts/buffs/fs_force_run.py index 714e8198..52fa68f4 100644 --- a/scripts/buffs/fs_force_run.py +++ b/scripts/buffs/fs_force_run.py @@ -5,8 +5,7 @@ def setup(core, actor, buff): return def add(core, actor, buff): - actor.playEffectObject('clienteffect/pl_force_run.cef', 'fs_force_run') - actor.playEffectObject('appearance/pt_force_speed.prt', 'fs_force_run') + actor.playEffectObject('clienteffect/pl_force_run.cef', '') actor.setSpeedMultiplierBase(actor.getSpeedMultiplierBase() + 2.5 + (2.5 * (actor.getSkillModBase('expertise_movement_buff_fs_force_run')) / 100)) core.skillModService.addSkillMod(actor, 'slope_move', 5) core.skillModService.addSkillMod(actor, 'movement_resist_snare', 100) diff --git a/scripts/buffs/invis_sp_buff_invis_1.py b/scripts/buffs/invis_sp_buff_invis_1.py index 84ef0058..9192dba7 100644 --- a/scripts/buffs/invis_sp_buff_invis_1.py +++ b/scripts/buffs/invis_sp_buff_invis_1.py @@ -4,12 +4,23 @@ def setup(core, actor, buff): return def add(core, actor, buff): + actor.playEffectObject('clienteffect/npe_smoke_bomb.cef', '') actor.setInStealth(True) actor.setRadarVisible(False) + + core.combatService.endCombat(actor) + + if actor.getSkillMod('expertise_sp_without_a_trace_1'): + core.buffService.addBuffToCreature(actor, 'invis_sp_buff_invis_notrace_1') + return def remove(core, actor, buff): actor.setInStealth(False) actor.setRadarVisible(True) + + if actor.getSkillMod('expertise_sp_without_a_trace_1'): + core.buffService.removeBuffFromCreature(actor, 'invis_sp_buff_invis_notrace_1') + return diff --git a/scripts/buffs/invis_sp_buff_stealth_1.py b/scripts/buffs/invis_sp_buff_stealth_1.py new file mode 100644 index 00000000..1b30ee83 --- /dev/null +++ b/scripts/buffs/invis_sp_buff_stealth_1.py @@ -0,0 +1,14 @@ +import sys + +def setup(core, actor, buff): + return + +def add(core, actor, buff): + actor.setInStealth(True) + actor.setRadarVisible(False) + return + +def remove(core, actor, buff): + actor.setInStealth(False) + actor.setRadarVisible(True) + return diff --git a/scripts/commands/combat/forcethrow.py b/scripts/commands/combat/forcethrow.py index 276deb65..0e529b99 100644 --- a/scripts/commands/combat/forcethrow.py +++ b/scripts/commands/combat/forcethrow.py @@ -1,7 +1,7 @@ import sys def setup(core, actor, target, command): - core.buffService.addBuffToCreature(target, 'fs_force_throw') + core.buffService.addBuffToCreature(target, 'fs_force_throw', actor) return def preRun(core, actor, target, command): diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index b0e78d52..680ba082 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -116,5 +116,13 @@ def run(core, actor, target, commandString): elif command == 'setBounty': core.playerService.sendSetBountyWindow(actor, actor) return + + elif command == 'genloot': + object = core.lootService.generateLootItem(actor, arg1) + + inventory = actor.getSlottedObject('inventory') + + if inventory: + inventory.add(object) return diff --git a/scripts/commands/transferitemarmor.py b/scripts/commands/transferitemarmor.py index 2edbec74..f4af003c 100644 --- a/scripts/commands/transferitemarmor.py +++ b/scripts/commands/transferitemarmor.py @@ -4,8 +4,10 @@ def setup(): return def run(core, actor, target, commandString): - if core.equipmentService.canEquip(actor, target) is False: - actor.sendSystemMessage('@error_message:insufficient_skill', 0) + canEquip = core.equipmentService.canEquip(actor, target) + + if canEquip[0] is False: + actor.sendSystemMessage(canEquip[1], 0) return diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py index dfe13587..3583e05b 100644 --- a/scripts/commands/transferitemmisc.py +++ b/scripts/commands/transferitemmisc.py @@ -14,7 +14,7 @@ def run(core, actor, target, commandString): if container == None: return if(container.isFull()): - actor.sendSystemMessage('That container is full.', 0) + actor.sendSystemMessage('@container_error_message:container03', 0) return if container.getTemplate().startswith("object/tangible/inventory/shared_lightsaber_inventory") or target.getContainer().getTemplate().startswith("object/tangible/inventory/shared_lightsaber_inventory"): @@ -43,8 +43,10 @@ def run(core, actor, target, commandString): actor.sendSystemMessage("You do not have permission to access that container!", 0) return - if core.equipmentService.canEquip(actor, target) is False: - actor.sendSystemMessage('@error_message:insufficient_skill', 0) + canEquip = core.equipmentService.canEquip(actor, target) + + if canEquip[0] is False: + actor.sendSystemMessage(canEquip[1], 0) return @@ -68,11 +70,13 @@ def run(core, actor, target, commandString): oldContainer.transferTo(actor, container, target) + for object in replacedObjects: + core.equipmentService.unequip(actor, object) + if actor == container: if target.getTemplate().find('/wearables/') or target.getTemplate().find('/weapon/'): core.equipmentService.equip(actor, target) - for object in replacedObjects: - core.equipmentService.unequip(actor, object) + #path = 'scripts/' + target.getTemplate().rpartition('/')[0] + '/' #module = target.getTemplate().rpartition('/')[2].replace('shared_', '').replace('.iff', '') #core.scriptService.callScript(path, 'equip', module, core, actor, target) diff --git a/scripts/commands/transferitemweapon.py b/scripts/commands/transferitemweapon.py index 6e356571..60f34718 100644 --- a/scripts/commands/transferitemweapon.py +++ b/scripts/commands/transferitemweapon.py @@ -4,9 +4,11 @@ def setup(): return def run(core, actor, target, commandString): - if core.equipmentService.canEquip(actor, target) is False: - actor.sendSystemMessage('@error_message:insufficient_skill', 0) - return + canEquip = core.equipmentService.canEquip(actor, target) + + if canEquip[0] is False: + actor.sendSystemMessage(canEquip[1], 0) + return parsedMsg = commandString.split(' ', 3) diff --git a/scripts/conversation/medical_cloning_droid.py b/scripts/conversation/medical_cloning_droid.py index 78bac164..8089c5f5 100644 --- a/scripts/conversation/medical_cloning_droid.py +++ b/scripts/conversation/medical_cloning_droid.py @@ -20,16 +20,23 @@ def startConversation(core, actor, npc): if actor.getBuffByName('cloning_sickness'): - prose = ProsePackage('conversation/clone_droid', 's_6') - outOfBand = OutOfBand() - outOfBand.addProsePackage(prose) - convSvc.sendConversationMessage(actor, npc, outOfBand) - prose2 = ProsePackage('conversation/clone_droid', 's_8') + + level = int(actor.getLevel()) + + if level <= 10: + cloningFee = 100 + elif level >= 11: + cloningFee = (((actor.getLevel() + 17) * actor.getLevel())/2) + elif level == 90: + cloningFee = 5000 + + convSvc.sendConversationMessage(actor, npc, OutOfBand.ProsePackage("@conversation/clone_droid:s_6", int(cloningFee))) + prose1 = ProsePackage('conversation/clone_droid', 's_8') outOfBand2 = OutOfBand() - outOfBand2.addProsePackage(prose2) - prose3 = ProsePackage('conversation/clone_droid', 's_12') + outOfBand2.addProsePackage(prose1) + prose2 = ProsePackage('conversation/clone_droid', 's_12') outOfBand3 = OutOfBand() - outOfBand3.addProsePackage(prose3) + outOfBand3.addProsePackage(prose2) option1 = ConversationOption(outOfBand2, 0) option2 = ConversationOption(outOfBand3, 1) @@ -41,7 +48,7 @@ def startConversation(core, actor, npc): convSvc.sendConversationOptions(actor, npc, options, handleFirstScreen) return else: - core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_4') + core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_14') return return @@ -68,24 +75,48 @@ def handleFirstScreen(core, actor, npc, selection): if selection == 1: - core.buffService.removeBuffFromCreature(actor, actor.getBuffByName("cloning_sickness")); - core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_14') - return - return + if actor.getLevel() <= 10: + cloningFee = 100 + elif actor.getLevel() >= 11: + cloningFee = (((actor.getLevel() + 17) * actor.getLevel())/2) + elif actor.getLevel() == 90: + cloningFee = 5000 + + + if actor.getCashCredits() >= cloningFee: + core.buffService.removeBuffFromCreature(actor, actor.getBuffByName("cloning_sickness")); + core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_14') + actor.setCashCredits(actor.getCashCredits() - int(cloningFee)) + return + elif actor.getCashCredits() <= cloningFee: + core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_16') + return + return def handleSecondScreen(core, actor, npc, selection): convSvc = core.conversationService - + if actor.getLevel() <= 10: + cloningFee = 100 + elif actor.getLevel() >= 11: + cloningFee = (((actor.getLevel() + 17) * actor.getLevel())/2) + elif actor.getLevel() == 90: + cloningFee = 5000 if selection == 0: - core.buffService.removeBuffFromCreature(actor, actor.getBuffByName("cloning_sickness")); - core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_14') + if actor.getCashCredits() >= cloningFee: + core.buffService.removeBuffFromCreature(actor, actor.getBuffByName("cloning_sickness")); + core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_14') + actor.setCashCredits(actor.getCashCredits() - int(cloningFee)) + return + elif actor.getCashCredits() <= cloningFee: + core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_16') + return return - return def endConversation(core, actor, npc): core.conversationService.sendStopConversation(actor, npc, 'conversation/clone_droid', 's_4') return - + + \ No newline at end of file diff --git a/scripts/loot/lootItems/armor/bone/bone_armor_bicep_left.py b/scripts/loot/lootItems/armor/bone/bone_armor_bicep_left.py index c6582c41..fe66e1ab 100644 --- a/scripts/loot/lootItems/armor/bone/bone_armor_bicep_left.py +++ b/scripts/loot/lootItems/armor/bone/bone_armor_bicep_left.py @@ -3,9 +3,9 @@ def itemTemplate(): return ['object/tangible/wearables/armor/bone/shared_armor_bone_s01_bicep_l.iff'] -def customItemName(): +#def customItemName(): - return 'Bone Armor Bicep Left' +# return 'Bone Armor Bicep Left' def customItemStackCount(): diff --git a/scripts/loot/lootItems/veryrareloot/rare_ankarres_sapphire.py b/scripts/loot/lootItems/veryrareloot/rare_ankarres_sapphire.py index 5559fc50..cee3f5ae 100644 --- a/scripts/loot/lootItems/veryrareloot/rare_ankarres_sapphire.py +++ b/scripts/loot/lootItems/veryrareloot/rare_ankarres_sapphire.py @@ -15,3 +15,5 @@ def requiredCL(): return 80 +def customSetup(object): + object.setCustomName2("Success!") \ No newline at end of file diff --git a/scripts/object/mobile/21b_surgical_droid.py b/scripts/object/mobile/21b_surgical_droid.py index ccad8904..bdc8a620 100644 --- a/scripts/object/mobile/21b_surgical_droid.py +++ b/scripts/object/mobile/21b_surgical_droid.py @@ -1,4 +1,11 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','medical_cloning_droid') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('surgical_droid') + return + diff --git a/scripts/object/tangible/terminal/terminal_mission_artisan.py b/scripts/object/tangible/terminal/terminal_mission_artisan.py index 6bface4e..7bbd42dd 100644 --- a/scripts/object/tangible/terminal/terminal_mission_artisan.py +++ b/scripts/object/tangible/terminal/terminal_mission_artisan.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - + object.setAttachment("terminalType", 4) core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_artisan', object.getPosition().x, object.getPosition().z, 41, 76, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_trader_01_02.py b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_trader_01_02.py new file mode 100644 index 00000000..353407c0 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_trader_01_02.py @@ -0,0 +1,13 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_roadmap_belt_trader_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_roadmap_belt_trader_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 15) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 20) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 15) + object.setStringAttribute('class_required', 'Trader') + object.setIntAttribute('required_combat_level', 90) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/backpack/item_trader_backpack_01_02.py b/scripts/object/tangible/wearables/backpack/item_trader_backpack_01_02.py new file mode 100644 index 00000000..9eb23a37 --- /dev/null +++ b/scripts/object/tangible/wearables/backpack/item_trader_backpack_01_02.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_trader_backpack_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_trader_backpack_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:expertise_assembly_increase_artisan', 5) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:hiring', 3) + object.setStringAttribute('class_required', 'Trader') + return diff --git a/scripts/object/tangible/wearables/bodysuit/item_trader_roadmap_jumpsuit_02_01.py b/scripts/object/tangible/wearables/bodysuit/item_trader_roadmap_jumpsuit_02_01.py new file mode 100644 index 00000000..7218be6d --- /dev/null +++ b/scripts/object/tangible/wearables/bodysuit/item_trader_roadmap_jumpsuit_02_01.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_trader_roadmap_jumpsuit_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_trader_roadmap_jumpsuit_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 2) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 1) + object.setStringAttribute('class_required', 'Trader') + object.setIntAttribute('required_combat_level', 30) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bodysuit/item_trader_roadmap_jumpsuit_02_02.py b/scripts/object/tangible/wearables/bodysuit/item_trader_roadmap_jumpsuit_02_02.py new file mode 100644 index 00000000..f10fbe79 --- /dev/null +++ b/scripts/object/tangible/wearables/bodysuit/item_trader_roadmap_jumpsuit_02_02.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_trader_roadmap_jumpsuit_02_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_trader_roadmap_jumpsuit_02_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 2) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 1) + object.setStringAttribute('class_required', 'Trader') + object.setIntAttribute('required_combat_level', 30) + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_spy_utility_a_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_spy_utility_a_01_01.py index cf9b8380..024129b8 100644 --- a/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_spy_utility_a_01_01.py +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_spy_utility_a_01_01.py @@ -7,11 +7,12 @@ def setup(core, object): object.setDetailName('item_bracelet_l_set_spy_utility_a_01_01') object.setIntAttribute('required_combat_level', 85) object.setStringAttribute('class_required', 'Spy') - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_strikethrough_chance', 2) - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_action_all', 1) - object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 50) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 25) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_sp_smoke', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_duration_line_sp_preparation', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_cooldown_line_sp_preparation', 6) object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_spy_utility_a_1') object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_spy_utility_a_2') object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_spy_utility_a_3') object.setAttachment('setBonus', 'set_bonus_spy_utility_a') - return \ No newline at end of file + return diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_spy_utility_a_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_spy_utility_a_01_01.py index 490bfeab..6d18e3d8 100644 --- a/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_spy_utility_a_01_01.py +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_spy_utility_a_01_01.py @@ -7,11 +7,12 @@ def setup(core, object): object.setDetailName('item_bracelet_r_set_spy_utility_a_01_01') object.setIntAttribute('required_combat_level', 85) object.setStringAttribute('class_required', 'Spy') - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_strikethrough_chance', 2) - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_action_all', 1) - object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 50) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 25) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_sp_smoke', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_duration_line_sp_preparation', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_cooldown_line_sp_preparation', 6) object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_spy_utility_a_1') object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_spy_utility_a_2') object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_spy_utility_a_3') object.setAttachment('setBonus', 'set_bonus_spy_utility_a') - return \ No newline at end of file + return diff --git a/scripts/object/tangible/wearables/necklace/item_necklace_set_spy_utility_a_01_01.py b/scripts/object/tangible/wearables/necklace/item_necklace_set_spy_utility_a_01_01.py index af9be68a..405ed693 100644 --- a/scripts/object/tangible/wearables/necklace/item_necklace_set_spy_utility_a_01_01.py +++ b/scripts/object/tangible/wearables/necklace/item_necklace_set_spy_utility_a_01_01.py @@ -7,11 +7,12 @@ def setup(core, object): object.setDetailName('item_necklace_set_spy_utility_a_01_01') object.setIntAttribute('required_combat_level', 85) object.setStringAttribute('class_required', 'Spy') - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_strikethrough_chance', 2) - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_action_all', 1) - object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 50) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 25) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_sp_smoke', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_duration_sp_preparation', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_cooldown_line_sp_preparation', 6) object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_spy_utility_a_1') object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_spy_utility_a_2') object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_spy_utility_a_3') object.setAttachment('setBonus', 'set_bonus_spy_utility_a') - return \ No newline at end of file + return diff --git a/scripts/object/tangible/wearables/necklace/item_trader_pendant_01_02.py b/scripts/object/tangible/wearables/necklace/item_trader_pendant_01_02.py new file mode 100644 index 00000000..48f0b1b9 --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_trader_pendant_01_02.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_trader_pendant_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_trader_pendant_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:general_assembly', 5) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:hiring', 3) + object.setStringAttribute('class_required', 'Trader') + return diff --git a/scripts/object/tangible/wearables/ring/item_band_set_spy_utility_a_01_01.py b/scripts/object/tangible/wearables/ring/item_band_set_spy_utility_a_01_01.py index aa7306d4..3483cb23 100644 --- a/scripts/object/tangible/wearables/ring/item_band_set_spy_utility_a_01_01.py +++ b/scripts/object/tangible/wearables/ring/item_band_set_spy_utility_a_01_01.py @@ -9,11 +9,12 @@ def setup(core, object): object.setDetailName('item_band_set_spy_utility_a_01_01') object.setIntAttribute('required_combat_level', 85) object.setStringAttribute('class_required', 'Spy') - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_strikethrough_chance', 2) - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_action_all', 1) - object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 50) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 25) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_sp_smoke', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_duration_line_sp_preparation', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_cooldown_line_sp_preparation', 6) object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_spy_utility_a_1') object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_spy_utility_a_2') object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_spy_utility_a_3') object.setAttachment('setBonus', 'set_bonus_spy_utility_a') - return \ No newline at end of file + return diff --git a/scripts/object/tangible/wearables/ring/item_content_trader_ring_03_01.py b/scripts/object/tangible/wearables/ring/item_content_trader_ring_03_01.py new file mode 100644 index 00000000..70713a96 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_content_trader_ring_03_01.py @@ -0,0 +1,13 @@ +import sys + +def setup(core, object): + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_content_trader_ring_03_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_content_trader_ring_03_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 6) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:general_assembly', 6) + object.setStringAttribute('class_required', 'Trader') + object.setAttachment('radial_filename', 'ring/unity') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_ring_set_spy_utility_a_01_01.py b/scripts/object/tangible/wearables/ring/item_ring_set_spy_utility_a_01_01.py index e57da3f8..500ea4ff 100644 --- a/scripts/object/tangible/wearables/ring/item_ring_set_spy_utility_a_01_01.py +++ b/scripts/object/tangible/wearables/ring/item_ring_set_spy_utility_a_01_01.py @@ -9,11 +9,12 @@ def setup(core, object): object.setDetailName('item_ring_set_spy_utility_a_01_01') object.setIntAttribute('required_combat_level', 85) object.setStringAttribute('class_required', 'Spy') - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_strikethrough_chance', 2) - object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_action_all', 1) - object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 50) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 25) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_sp_smoke', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_duration_line_sp_preparation', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:expertise_cooldown_line_sp_preparation', 6) object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_spy_utility_a_1') object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_spy_utility_a_2') object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_spy_utility_a_3') object.setAttachment('setBonus', 'set_bonus_spy_utility_a') - return \ No newline at end of file + return diff --git a/scripts/object/weapon/melee/knife/weapon_knife_trader_roadmap_01_02.py b/scripts/object/weapon/melee/knife/weapon_knife_trader_roadmap_01_02.py new file mode 100644 index 00000000..a8e53801 --- /dev/null +++ b/scripts/object/weapon/melee/knife/weapon_knife_trader_roadmap_01_02.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('weapon_knife_trader_roadmap_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('weapon_knife_trader_roadmap_01_02') + object.setStringAttribute('class_required', 'Trader') + object.setIntAttribute('required_combat_level', 42) + object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0) + object.setStringAttribute('cat_wpn_damage.damage', '80 - 160') + object.setStringAttribute('cat_wpn_damage.wpn_range', '0-5m') + object.setStringAttribute('cat_wpn_damage.wpn_category', 'One-Handed Melee') + object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/pistol/weapon_pistol_trader_roadmap_01_02.py b/scripts/object/weapon/ranged/pistol/weapon_pistol_trader_roadmap_01_02.py new file mode 100644 index 00000000..9feea0cd --- /dev/null +++ b/scripts/object/weapon/ranged/pistol/weapon_pistol_trader_roadmap_01_02.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('weapon_pistol_trader_roadmap_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('weapon_pistol_trader_roadmap_01_02') + object.setStringAttribute('class_required', 'Trader') + object.setIntAttribute('required_combat_level', 62) + object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.4) + object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') + object.setStringAttribute('cat_wpn_damage.damage', '250-500') + object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') + object.setStringAttribute('cat_wpn_damage.wpn_category', 'Pistol') + object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + return \ No newline at end of file diff --git a/scripts/radial/terminal/cloning_terminal.py b/scripts/radial/terminal/cloning_terminal.py index 4809d1d6..1cf0e065 100644 --- a/scripts/radial/terminal/cloning_terminal.py +++ b/scripts/radial/terminal/cloning_terminal.py @@ -10,8 +10,19 @@ def createRadial(core, owner, target, radials): def handleSelection(core, owner, target, option): if option == 21 and target: + # REALLY Dirty hack until this can be resolved SWG way !! + stra = "Will you pay the %DI credits to clone yourself here?" + level = int(owner.getLevel()) + + if level <= 10: + cloningFee = 100 + elif level >= 11: + cloningFee = (((owner.getLevel() + 17) * owner.getLevel())/2) + elif level == 90: + cloningFee = 5000 + suiSvc = core.suiService - suiWindow = suiSvc.createMessageBox(MessageBoxType.MESSAGE_BOX_OK_CANCEL, '@base_player:clone_confirm_title', '@base_player:clone_confirm_prompt', owner, target, 15) + suiWindow = suiSvc.createMessageBox(MessageBoxType.MESSAGE_BOX_OK_CANCEL, '@base_player:clone_confirm_title', stra.replace ("%DI" , str(cloningFee)), owner, target, 15) returnParams = Vector() returnParams.add('btnOk:Text') returnParams.add('btnCancel:Text') @@ -24,17 +35,26 @@ def handleSelection(core, owner, target, option): def handleSUI(owner, window, eventType, returnList): if eventType == 0: + level = int(owner.getLevel()) + if level <= 10: + cloningFee = 100 + elif level >= 11: + cloningFee = (((owner.getLevel() + 17) * owner.getLevel())/2) + elif level == 90: + cloningFee = 5000 + cash = owner.getCashCredits() bank = owner.getBankCredits() - if bank < 1000 and cash < 1000: + + if bank < cloningFee and cash < cloningFee: owner.sendSystemMessage('You lack the credits required to cover the cost of cloning.', 0) return - elif bank > 1000: - owner.setBankCredits(bank - 1000) - elif cash > 1000 and bank < 1000: - owner.setCashCredits(cash - 1000) + elif bank >= cloningFee: + owner.setBankCredits(bank - cloningFee) + elif cash >= cloningFee and bank < cloningFee: + owner.setCashCredits(cash - cloningFee) - owner.setAttachment('preDesignatedCloner', window.getRangeObject().getGrandparent().getObjectID()) + owner.getPlayerObject().setBindLocation(window.getRangeObject().getGrandparent().getObjectID()) owner.sendSystemMessage('@base_player:clone_success', 0) diff --git a/scripts/roadmap/trader_0a.py b/scripts/roadmap/trader_0a.py index 203b6ad9..c0ae1ee4 100644 --- a/scripts/roadmap/trader_0a.py +++ b/scripts/roadmap/trader_0a.py @@ -25,4 +25,30 @@ def getAction(): return 75 def getRewards(name): - return \ No newline at end of file + if name == 'item_npe_gen_craft_tool_trader_03_01': + return "object/tangible/crafting/base/shared_generic_base_tool.iff" + + if name == 'item_trader_backpack_01_02': + return "object/tangible/wearables/backpack/shared_backpack_s04.iff" + + if name == 'weapon_knife_trader_roadmap_01_02': + return "object/weapon/melee/knife/shared_knife_dagger.iff" + + if name == 'item_trader_ring_01_02': + return "object/tangible/wearables/ring/shared_ring_s02.iff" + + if name == 'item_trader_roadmap_jumpsuit_02_02': + return "object/tangible/wearables/bodysuit/shared_bodysuit_s01.iff" + + if name == 'weapon_pistol_trader_roadmap_01_02': + return "object/weapon/ranged/pistol/shared_pistol_scout_blaster.iff" + + if name == 'item_trader_pendant_01_02': + return "object/tangible/wearables/necklace/shared_necklace_s07.iff" + + if name == 'item_trader_clicky_01_02': + return "object/tangible/crafting/station/shared_generic_generic_tool.iff" + + if name == 'item_roadmap_belt_trader_01_02': + return "object/tangible/wearables/armor/zam/shared_armor_zam_wesell_belt.iff" + return \ No newline at end of file diff --git a/scripts/roadmap/trader_0b.py b/scripts/roadmap/trader_0b.py index 203b6ad9..c3a7e4ec 100644 --- a/scripts/roadmap/trader_0b.py +++ b/scripts/roadmap/trader_0b.py @@ -24,5 +24,32 @@ def getHealth(): def getAction(): return 75 + def getRewards(name): - return \ No newline at end of file + if name == 'item_npe_gen_craft_tool_trader_03_01': + return "object/tangible/crafting/base/shared_generic_base_tool.iff" + + if name == 'item_trader_backpack_01_02': + return "object/tangible/wearables/backpack/shared_backpack_s04.iff" + + if name == 'weapon_knife_trader_roadmap_01_02': + return "object/weapon/melee/knife/shared_knife_dagger.iff" + + if name == 'item_trader_ring_01_02': + return "object/tangible/wearables/ring/shared_ring_s02.iff" + + if name == 'item_trader_roadmap_jumpsuit_02_02': + return "object/tangible/wearables/bodysuit/shared_bodysuit_s01.iff" + + if name == 'weapon_pistol_trader_roadmap_01_02': + return "object/weapon/ranged/pistol/shared_pistol_scout_blaster.iff" + + if name == 'item_trader_pendant_01_02': + return "object/tangible/wearables/necklace/shared_necklace_s07.iff" + + if name == 'item_trader_clicky_01_02': + return "object/tangible/crafting/station/shared_generic_generic_tool.iff" + + if name == 'item_roadmap_belt_trader_01_02': + return "object/tangible/wearables/armor/zam/shared_armor_zam_wesell_belt.iff" + return \ No newline at end of file diff --git a/scripts/roadmap/trader_0c.py b/scripts/roadmap/trader_0c.py index 203b6ad9..7ac4a0d7 100644 --- a/scripts/roadmap/trader_0c.py +++ b/scripts/roadmap/trader_0c.py @@ -25,4 +25,30 @@ def getAction(): return 75 def getRewards(name): - return \ No newline at end of file + if name == 'item_npe_gen_craft_tool_trader_03_01': + return "object/tangible/crafting/base/shared_generic_base_tool.iff" + + if name == 'item_trader_backpack_01_02': + return "object/tangible/wearables/backpack/shared_backpack_s04.iff" + + if name == 'weapon_knife_trader_roadmap_01_02': + return "object/weapon/melee/knife/shared_knife_dagger.iff" + + if name == 'item_trader_ring_01_02': + return "object/tangible/wearables/ring/shared_ring_s02.iff" + + if name == 'item_trader_roadmap_jumpsuit_02_02': + return "object/tangible/wearables/bodysuit/shared_bodysuit_s01.iff" + + if name == 'weapon_pistol_trader_roadmap_01_02': + return "object/weapon/ranged/pistol/shared_pistol_scout_blaster.iff" + + if name == 'item_trader_pendant_01_02': + return "object/tangible/wearables/necklace/shared_necklace_s07.iff" + + if name == 'item_trader_clicky_01_02': + return "object/tangible/crafting/station/shared_generic_generic_tool.iff" + + if name == 'item_roadmap_belt_trader_01_02': + return "object/tangible/wearables/armor/zam/shared_armor_zam_wesell_belt.iff" + return \ No newline at end of file diff --git a/scripts/roadmap/trader_0d.py b/scripts/roadmap/trader_0d.py index 203b6ad9..7ac4a0d7 100644 --- a/scripts/roadmap/trader_0d.py +++ b/scripts/roadmap/trader_0d.py @@ -25,4 +25,30 @@ def getAction(): return 75 def getRewards(name): - return \ No newline at end of file + if name == 'item_npe_gen_craft_tool_trader_03_01': + return "object/tangible/crafting/base/shared_generic_base_tool.iff" + + if name == 'item_trader_backpack_01_02': + return "object/tangible/wearables/backpack/shared_backpack_s04.iff" + + if name == 'weapon_knife_trader_roadmap_01_02': + return "object/weapon/melee/knife/shared_knife_dagger.iff" + + if name == 'item_trader_ring_01_02': + return "object/tangible/wearables/ring/shared_ring_s02.iff" + + if name == 'item_trader_roadmap_jumpsuit_02_02': + return "object/tangible/wearables/bodysuit/shared_bodysuit_s01.iff" + + if name == 'weapon_pistol_trader_roadmap_01_02': + return "object/weapon/ranged/pistol/shared_pistol_scout_blaster.iff" + + if name == 'item_trader_pendant_01_02': + return "object/tangible/wearables/necklace/shared_necklace_s07.iff" + + if name == 'item_trader_clicky_01_02': + return "object/tangible/crafting/station/shared_generic_generic_tool.iff" + + if name == 'item_roadmap_belt_trader_01_02': + return "object/tangible/wearables/armor/zam/shared_armor_zam_wesell_belt.iff" + return \ No newline at end of file diff --git a/scripts/skillMods/expertise_strikethrough_chance.py b/scripts/skillMods/expertise_strikethrough_chance.py index b5c5e291..47e3d763 100644 --- a/scripts/skillMods/expertise_strikethrough_chance.py +++ b/scripts/skillMods/expertise_strikethrough_chance.py @@ -1,8 +1,10 @@ import sys def add(core, actor, skillMod, value): + core.skillModService.addSkillMod(actor, 'display_only_strikethrough', 100 * skillMod.getBase()) return def deduct(core, actor, skillMod, value): + core.skillModService.deductSkillMod(actor, 'display_only_strikethrough', 100 * skillMod.getBase()) return - \ No newline at end of file + diff --git a/src/main/NGECore.java b/src/main/NGECore.java index d09d68e6..9e6bf585 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -314,6 +314,7 @@ public class NGECore { harvesterService = new HarvesterService(this); mountService = new MountService(this); playerCityService = new PlayerCityService(this); + staticService = new StaticService(this); if (config.keyExists("JYTHONCONSOLE.PORT")) { int jythonPort = config.getInt("JYTHONCONSOLE.PORT"); @@ -371,6 +372,7 @@ public class NGECore { zoneDispatch.addService(mountService); zoneDispatch.addService(housingService); zoneDispatch.addService(playerCityService); + zoneDispatch.addService(staticService); if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) { zoneDispatch.addService(surveyService); @@ -379,7 +381,7 @@ public class NGECore { zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT")); zoneServer.start(); - staticService = new StaticService(this); + //Start terrainList // Original Planets terrainService.addPlanet(1, "tatooine", "terrain/tatooine.trn", true); @@ -460,10 +462,6 @@ public class NGECore { // Zone services that need to be loaded after the above zoneDispatch.addService(simulationService); - - // Static Spawns - staticService.spawnStatics(); - guildService = new GuildService(this); zoneDispatch.addService(guildService); @@ -481,7 +479,6 @@ public class NGECore { instanceService = new InstanceService(this); zoneDispatch.addService(instanceService); - weatherService = new WeatherService(this); weatherService.loadPlanetSettings(); @@ -491,6 +488,8 @@ public class NGECore { spawnService.loadDynamicGroups();; spawnService.loadSpawnAreas(); + staticService.spawnStatics(); + equipmentService.loadBonusSets(); retroService.run(); diff --git a/src/protocol/swg/CharacterSheetResponseMessage.java b/src/protocol/swg/CharacterSheetResponseMessage.java index 70e14124..bdb6531d 100644 --- a/src/protocol/swg/CharacterSheetResponseMessage.java +++ b/src/protocol/swg/CharacterSheetResponseMessage.java @@ -49,11 +49,11 @@ public class CharacterSheetResponseMessage extends SWGMessage { public IoBuffer serialize() { CreatureObject creature = (CreatureObject) player.getContainer(); - if (creature != null) { + if (creature != null && player != null) { SWGObject desCloner = null; - if (creature.getAttachment("preDesignatedCloner") != null) - desCloner = NGECore.getInstance().objectService.getObject((long) creature.getAttachment("preDesignatedCloner")); + if (player.getBindLocation() != 0) + desCloner = NGECore.getInstance().objectService.getObject(player.getBindLocation()); String clonerPlanet = ""; String spouse = ""; diff --git a/src/resources/loot/LootRollSession.java b/src/resources/loot/LootRollSession.java index d6f26ad4..b20f1030 100644 --- a/src/resources/loot/LootRollSession.java +++ b/src/resources/loot/LootRollSession.java @@ -49,7 +49,10 @@ public class LootRollSession { private int lootedObjectLevel=0; private int lootedObjectDifficulty=0; - public LootRollSession(){ + public LootRollSession() + { + droppedItems = new ArrayList(); + errorMessages = new ArrayList(); } public LootRollSession(CreatureObject requester, TangibleObject lootedObject){ @@ -113,6 +116,11 @@ public class LootRollSession { public Planet getSessionPlanet() { return sessionPlanet; } + + public void setSessionPlanet(Planet planet) + { + this.sessionPlanet = planet; + } public List getErrorMessages() { return errorMessages; diff --git a/src/resources/objectives/SurveyMissionObjective.java b/src/resources/objectives/SurveyMissionObjective.java index d54b3a47..025b15bf 100644 --- a/src/resources/objectives/SurveyMissionObjective.java +++ b/src/resources/objectives/SurveyMissionObjective.java @@ -21,7 +21,11 @@ ******************************************************************************/ package resources.objectives; +import java.util.concurrent.atomic.AtomicInteger; + +import engine.resources.scene.Point3D; import main.NGECore; +import resources.datatables.DisplayType; import resources.objects.creature.CreatureObject; import resources.objects.mission.MissionObject; import services.mission.MissionObjective; @@ -30,27 +34,50 @@ public class SurveyMissionObjective extends MissionObjective{ private static final long serialVersionUID = 1L; + private String resourceFamily; + private Point3D pickupLocation; + private String pickupPlanet; + private int surveyMissionNum; + public SurveyMissionObjective(MissionObject parent) { super(parent); } @Override public void activate(NGECore core, CreatureObject player) { - + pickupPlanet = player.getPlanet().getName(); + pickupLocation = player.getPosition(); + resourceFamily = getMissionObject().getMissionTargetName(); + + // This way will allow 2 survey missions at a time. + AtomicInteger number = new AtomicInteger(); + player.getSlottedObject("datapad").viewChildren(player, true, false, (obj) -> { + if (obj instanceof MissionObject && ((MissionObject) obj).getMissionType().equals("survey")) { number.getAndIncrement(); } + }); + player.setAttachment("surveyMission" + Integer.valueOf(number.get()), getMissionObject().getObjectID()); + surveyMissionNum = number.get(); + + player.sendSystemMessage("@mission/mission_generic:survey_start", DisplayType.Broadcast); } @Override public void complete(NGECore core, CreatureObject player) { - // TODO Auto-generated method stub + player.addBankCredits(getMissionObject().getCreditReward()); + player.setAttachment("surveyMission" + Integer.valueOf(surveyMissionNum), 0); } @Override public void abort(NGECore core, CreatureObject player) { - // TODO Auto-generated method stub + player.setAttachment("surveyMission" + Integer.valueOf(surveyMissionNum), 0); } @Override public void update(NGECore core, CreatureObject player) { - // TODO Auto-generated method stub } + + public String getResourceFamily() { return resourceFamily; } + + public Point3D getPickupLocation() { return pickupLocation; } + + public String getPickupPlanet() { return pickupPlanet; } } diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 6a7ee843..436daeef 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -153,6 +153,7 @@ public class PlayerObject extends IntangibleObject implements Serializable { private long bountyMissionId; private Vector ownedVendors = new Vector(); + private long bindLocation; public PlayerObject() { super(); @@ -939,5 +940,17 @@ public class PlayerObject extends IntangibleObject implements Serializable { public int getAmountOfVendors() { return ownedVendors.size(); } + + public long getBindLocation() { + synchronized(objectMutex) { + return bindLocation; + } + } + + public void setBindLocation(long bindLocation) { + synchronized(objectMutex) { + this.bindLocation = bindLocation; + } + } } diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 02ed2d8b..2609d507 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -312,7 +312,9 @@ public class TangibleObject extends SWGObject implements Serializable { if(customizationVariables.containsKey(type)) customizationVariables.replace(type, value); else customizationVariables.put(type, value); - notifyObservers(messageBuilder.buildCustomizationDelta(getCustomizationBytes()), true); + byte[] customizationBytes = getCustomizationBytes(); + customization = customizationBytes; + notifyObservers(messageBuilder.buildCustomizationDelta(customizationBytes), true); } public void removeCustomizationVariable(String type) @@ -320,7 +322,9 @@ public class TangibleObject extends SWGObject implements Serializable { if(customizationVariables.containsKey(type)) { customizationVariables.remove(type); - notifyObservers(messageBuilder.buildCustomizationDelta(getCustomizationBytes()), true); + byte[] customizationBytes = getCustomizationBytes(); + customization = customizationBytes; + notifyObservers(messageBuilder.buildCustomizationDelta(customizationBytes), true); } } diff --git a/src/services/EquipmentService.java b/src/services/EquipmentService.java index 3f2b5a20..a4946d88 100644 --- a/src/services/EquipmentService.java +++ b/src/services/EquipmentService.java @@ -69,72 +69,95 @@ public class EquipmentService implements INetworkDispatch { } - public boolean canEquip(CreatureObject actor, SWGObject item) { + + /* + Returns an array; + [0] = boolean, whether or not the item may be equipped; + [1] = string, in case of failure, why + */ + public Object[] canEquip(CreatureObject actor, SWGObject item) { // TODO: Species restrictions // TODO: Gender restrictions boolean result = true; + String message = ""; - if (item == null) - return false; + if (item == null) + { + result = false; + message = "null_item"; + return new Object[] { result, message }; + } if (item.getAttributes().toString().contains("cat_armor")) { - if (actor.hasAbility("wear_all_armor")) result = true; // Change to "wear_all_armor" ability instead of lvl 22 - else return false; + if (actor.hasAbility("wear_all_armor")) result = true; + else + { + result = false; + message = "@error_message:insufficient_skill"; // I am unsure if this is the right message + return new Object[] { result, message }; + } } - if (item.getStringAttribute("class_required") != null) { + if (item.getStringAttribute("class_required") != null) + { String classRequired = item.getStringAttribute("class_required"); String profession = ((PlayerObject) actor.getSlottedObject("ghost")).getProfession(); - if (classRequired.contains(",")) { - String[] classes = classRequired.split(","); - - for (int i = 0; i < classes.length; i++) { - if (classes[i].contains(core.playerService.getFormalProfessionName(profession))) { - return true; - } - } + if (classRequired.contains(core.playerService.getFormalProfessionName(profession)) || classRequired.equals("None")) result = true; + else + { + result = false; + message = "@error_message:insufficient_skill"; // I am unsure if this is the right message + return new Object[] { result, message }; } - if (classRequired.contentEquals(core.playerService.getFormalProfessionName(profession)) || classRequired.contentEquals("None")) - result = true; - else - return false; } if (item.getStringAttribute("faction_restriction") != null) - if (item.getStringAttribute("faction_restriction").toLowerCase().contentEquals(actor.getFaction()) && actor.getFactionStatus() >= FactionStatus.Combatant) - result = true; - else - return false; + { + if (item.getStringAttribute("faction_restriction").toLowerCase().contentEquals(actor.getFaction()) && actor.getFactionStatus() >= FactionStatus.Combatant) result = true; + else + { + result = false; + message = "@faction_recruiter:must_be_faction_member_use"; // will have to somehow manage prose %TO for faction name + return new Object[] { result, message }; + } + } if (item.getAttributes().containsKey("required_combat_level")) { - if (actor.getLevel() >= item.getIntAttribute("required_combat_level")) - result = true; - else - return false; + if (actor.getLevel() >= item.getIntAttribute("required_combat_level")) result = true; + else + { + result = false; + message = "@error_message:insufficient_skill"; // I am unsure if this is the right message + return new Object[] { result, message }; + } } if(item.getAttachment("unity") != null) { - actor.sendSystemMessage("@unity:cannot_remove_ring", (byte) 0); - return false; + result = false; + message = "@unity:cannot_remove_ring"; + return new Object[] { result, message }; } if(item.getTemplate().startsWith("object/weapon/") && item.getTemplate().contains("lightsaber") && item.getAttachment("hasColorCrystal") == null) item.setAttachment("hasColorCrystal", false); if(item.getAttachment("hasColorCrystal") != null && (Boolean) item.getAttachment("hasColorCrystal") == false) { - actor.sendSystemMessage("You may not equip a light saber that has no color crystal!", (byte) 0); - return false; + result = false; + message = "@jedi_spam:lightsaber_no_color"; + return new Object[] { result, message }; } - return result; + result = true; + message = "success"; + return new Object[] { result, message }; } - public void equip(CreatureObject actor, SWGObject item) + synchronized public void equip(CreatureObject actor, SWGObject item) { String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff")); String serverTemplate = template.replace(".iff", ""); @@ -151,7 +174,7 @@ public class EquipmentService implements INetworkDispatch { } } - public void unequip(CreatureObject actor, SWGObject item) + synchronized public void unequip(CreatureObject actor, SWGObject item) { String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff")); String serverTemplate = template.replace(".iff", ""); @@ -318,17 +341,34 @@ public class EquipmentService implements INetworkDispatch { // Check if item is a lightsaber component if(lightsaber == null) return; if(lightsaberInventory == null) return; - if(lightsaber.getContainer() instanceof CreatureObject) return; + if(lightsaber.getContainer() instanceof CreatureObject) + { + actor.sendSystemMessage("@jedi_spam:saber_not_while_equpped", (byte) 0); + return; + } - if(!item.getTemplate().startsWith("object/tangible/component/weapon/lightsaber/")) return; + if(!item.getTemplate().startsWith("object/tangible/component/weapon/lightsaber/")) + { + actor.sendSystemMessage("@jedi_spam:saber_not_crystal", (byte) 0); + return; + } if(lightsaber.getAttachment("hasColorCrystal") == null) lightsaber.setAttachment("hasColorCrystal", false); - if(item.getAttributes().containsKey("@obj_attr_n:color") && (Boolean) lightsaber.getAttachment("hasColorCrystal") && !(targetContainer.getContainer() instanceof CreatureObject)) return; + if(item.getAttributes().containsKey("@obj_attr_n:color") && (Boolean) lightsaber.getAttachment("hasColorCrystal") && !(targetContainer.getContainer() instanceof CreatureObject)) + { + actor.sendSystemMessage("@jedi_spam:saber_already_has_color", (byte) 0); + return; + } // Find our tuner if(item.getAttachment("tunerId") == null) item.setAttachment("tunerId", 0); tunerId = (int) item.getAttachment("tunerId"); // Check if player tuned the crystal + if(tunerId == 0) + { + actor.sendSystemMessage("@jedi_spam:saber_crystal_not_tuned", (byte) 0); + return; + } if(tunerId != actor.getObjectId()) { actor.sendSystemMessage("@jedi_spam:saber_crystal_not_owner", (byte) 0); diff --git a/src/services/LootService.java b/src/services/LootService.java index f5a62344..687011e8 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -285,6 +285,17 @@ public class LootService implements INetworkDispatch { } } + public SWGObject generateLootItem(CreatureObject requester, String template) + { + LootRollSession rollSession = new LootRollSession(); + rollSession.setSessionPlanet(requester.getPlanet()); + + handleLootPoolItems(template, rollSession); + if(rollSession.getDroppedItems().get(0) != null) return rollSession.getDroppedItems().get(0); + + return null; + } + @SuppressWarnings("unused") private void handleLootPoolItems(String itemName,LootRollSession lootRollSession){ @@ -399,7 +410,7 @@ public class LootService implements INetworkDispatch { customName = setRandomStatsJewelry(droppedItem, lootRollSession); } - if (customName!=null) + if (!customName.isEmpty()) handleCustomDropName(droppedItem, customName); if (stackable!=-1){ @@ -451,6 +462,9 @@ public class LootService implements INetworkDispatch { droppedItem.setStringAttribute("required_faction", requiredFaction); } + if(core.scriptService.getMethod(itemPath,"","customSetup") != null) + core.scriptService.callScript(itemPath, "", "customSetup", droppedItem); + lootRollSession.addDroppedItem(droppedItem); System.out.println("END REACHED"); @@ -542,7 +556,10 @@ public class LootService implements INetworkDispatch { int crystalColor = new Random().nextInt(11); droppedItem.setCustomizationVariable("/private/index_color_1", (byte) crystalColor); + droppedItem.getAttributes().put("@obj_attr_n:condition", "100/100"); + droppedItem.getAttributes().put("@obj_attr_n:crystal_owner", "\\#D1F56F UNTUNED \\#FFFFFF "); droppedItem.getAttributes().put("@obj_attr_n:color", resources.datatables.LightsaberColors.get(crystalColor)); + droppedItem.setAttachment("radial_filename", "item/tunable"); //droppedItem.getAttributes().put("@obj_attr_n:color", "@jedi_spam:saber_color_" + crystalColor); // Commented out for now } diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 46ae2ac6..29134bb8 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -488,15 +488,15 @@ public class PlayerService implements INetworkDispatch { SWGObject preDesignatedCloner = null; - if(creature.getAttachment("preDesignatedCloner") != null) { - preDesignatedCloner = core.objectService.getObject((long) creature.getAttachment("preDesignatedCloner")); + if(creature.getPlayerObject().getBindLocation() != 0) { + preDesignatedCloner = core.objectService.getObject((long) creature.getPlayerObject().getBindLocation()); if(preDesignatedCloner != null) - cloneData.put(preDesignatedCloner.getObjectID(), core.mapService.getClosestCityName(preDesignatedCloner) /*+ " (" + String.valueOf(position.getDistance2D(cloner.getPosition())) + "m)"*/); + cloneData.put(preDesignatedCloner.getObjectID(), "@base_player:clone_location_registered_select_begin " + core.mapService.getClosestCityName(preDesignatedCloner) + " @base_player:clone_location_registered_select_end"); } final long preDesignatedObjectId = (preDesignatedCloner != null) ? preDesignatedCloner.getObjectID() : 0; cloners.stream().filter(c -> c.getObjectID() != preDesignatedObjectId).forEach(c -> cloneData.put(c.getObjectID(), core.mapService.getClosestCityName(c))); - final SUIWindow window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "@base_player:revive_title", "Select the desired option and click OK.", + final SUIWindow window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "@base_player:revive_title", "@base_player:clone_prompt_header", cloneData, creature, null, 0); Vector returnList = new Vector(); returnList.add("List.lstList:SelectedRow"); @@ -553,7 +553,7 @@ public class PlayerService implements INetworkDispatch { } creature.setFactionStatus(0); - core.buffService.addBuffToCreature(creature, "cloning_sickness"); + core.buffService.addBuffToCreature(creature, "cloning_sickness", creature); } diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 72b6db17..eea6564f 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -913,7 +913,7 @@ public class SimulationService implements INetworkDispatch { HeartBeatMessage heartBeat = new HeartBeatMessage(); session.write(heartBeat.serialize()); - CmdStartScene startScene = new CmdStartScene((byte) 0, object.getObjectID(), object.getPlanet().getPath(), object.getTemplate(), newPos.x, newPos.y, newPos.z, System.currentTimeMillis() / 1000, object.getRadians()); + CmdStartScene startScene = new CmdStartScene((byte) 0, object.getObjectID(), object.getPlanet().getPath(), object.getTemplate(), newPos.x, newPos.y, newPos.z, core.getGalacticTime() / 1000, object.getRadians()); session.write(startScene.serialize()); handleZoneIn(client); diff --git a/src/services/StaticService.java b/src/services/StaticService.java index f7631ecc..dc302656 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -116,7 +116,7 @@ public class StaticService implements INetworkDispatch { SWGObject object; if (core.spawnService.getMobileTemplate(template) != null) { - object = core.spawnService.spawnCreature(template, planetName, cellId, x, y, z, qW, qX, qY, qZ, (short) -1); + object = core.spawnService.spawnCreature(template, objectId, planetName, cellId, x, y, z, qW, qX, qY, qZ, (short) -1); } else { object = core.objectService.createObject(template, objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ), null, true, true); } diff --git a/src/services/collections/CollectionService.java b/src/services/collections/CollectionService.java index 1f471312..d4fd99b1 100644 --- a/src/services/collections/CollectionService.java +++ b/src/services/collections/CollectionService.java @@ -425,9 +425,9 @@ public class CollectionService implements INetworkDispatch { } } } - } catch (Exception e) { - e.printStackTrace(); - } + } catch (Exception e) { + e.printStackTrace(); + } if (FileUtilities.doesFileExist("scripts/collections/" + collectionName + ".py")) { PyObject method = core.scriptService.getMethod("scripts/collections/", collectionName, "complete"); diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 51ce2dd3..db087e12 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -827,10 +827,10 @@ public class CombatService implements INetworkDispatch { }, target.getIncapTimer(), TimeUnit.SECONDS); target.setIncapTask(incapTask); core.buffService.addBuffToCreature(target, "incapWeaken", target); - if(target.getSlottedObject("ghost") != null) { + if(target.getSlottedObject("ghost") != null && attacker.getSlottedObject("ghost") != null) { target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_incap", attacker.getCustomName())), (byte) 0); attacker.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_target_incap", target.getCustomName())), (byte) 0); - } + } else {target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_incap", "@" + attacker.getStfFilename() + ":" + attacker.getStfName())), (byte) 0); } return; } else if(target.getHealth() - damage <= 0 && target.getAttachment("AI") != null) { synchronized(target.getMutex()) { @@ -1063,7 +1063,11 @@ public class CombatService implements INetworkDispatch { target.removeDefender(attacker); target.setSpeedMultiplierBase(0); target.setTurnRadius(0); - target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_dead", attacker.getCustomName())), (byte) 0); + + if (attacker.getSlottedObject("ghost") != null) + target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_dead", attacker.getCustomName())), (byte) 0); + else + target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_dead", "@" + attacker.getStfFilename() + ":" + attacker.getStfName())), (byte) 0); core.playerService.sendCloningWindow(target, attacker.getSlottedObject("ghost") != null); } diff --git a/src/services/mission/MissionService.java b/src/services/mission/MissionService.java index 08c6dc84..967b01f3 100644 --- a/src/services/mission/MissionService.java +++ b/src/services/mission/MissionService.java @@ -38,8 +38,6 @@ import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; -import com.sleepycat.je.Transaction; - import protocol.swg.ObjControllerMessage; import protocol.swg.objectControllerObjects.MissionAbort; import protocol.swg.objectControllerObjects.MissionAcceptRequest; @@ -55,6 +53,8 @@ import resources.objectives.SurveyMissionObjective; import resources.objects.creature.CreatureObject; import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; +import resources.objects.resource.GalacticResource; +import resources.objects.resource.ResourceRoot; import resources.objects.tangible.TangibleObject; import engine.clientdata.StfTable; import engine.clients.Client; @@ -151,17 +151,25 @@ public class MissionService implements INetworkDispatch { int terminalType = (int) terminal.getAttachment("terminalType"); - if (terminalType == TerminalType.GENERIC) { - handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.GENERIC); - } else if (terminalType == TerminalType.BOUNTY) { - if (!object.hasSkill("class_bountyhunter_phase1_novice")) { object.sendSystemMessage("@mission/mission_generic:not_bounty_hunter_terminal", (byte) 0); } - else { handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.BOUNTY); } - } else if (terminalType == TerminalType.ENTERTAINER) { + switch(terminalType) { + case TerminalType.GENERIC: + handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.GENERIC); + break; + + case TerminalType.BOUNTY: + if (!object.hasSkill("class_bountyhunter_phase1_novice")) { object.sendSystemMessage("@mission/mission_generic:not_bounty_hunter_terminal", (byte) 0); } + else { handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.BOUNTY); } + break; + + case TerminalType.ARTISAN: + //handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.ARTISAN); + break; + + case TerminalType.ENTERTAINER: + //handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.ENTERTAINER); + break; - } else if (terminalType == TerminalType.ARTISAN) { - - } else { - //Console.println("ERROR: Unsupported terminal " + terminal.getObjectId()); + default: break; } } @@ -292,7 +300,7 @@ public class MissionService implements INetworkDispatch { randomBountyMission(player, mission); else if (type == TerminalType.ARTISAN) - return; + randomSurveyMission(player, mission); else return; @@ -302,20 +310,20 @@ public class MissionService implements INetworkDispatch { } else if (typeTwoCount.get() < 5) { - if (type == TerminalType.GENERIC) + if (type == TerminalType.GENERIC) // destroy + return; + + else if (type == TerminalType.ARTISAN) // crafting return; else if (type == TerminalType.BOUNTY) - return; - - else if (type == TerminalType.ARTISAN) - return; + randomBountyMission(player, mission); else return; - //mission.setRepeatCount(requestCounter); - //typeTwoCount.incrementAndGet(); + mission.setRepeatCount(requestCounter); + typeTwoCount.incrementAndGet(); } } }); @@ -423,7 +431,61 @@ public class MissionService implements INetworkDispatch { return null; } } + private void randomSurveyMission(SWGObject player, MissionObject mission) { + + byte generalType = (byte) (ran.nextInt(3) == 0 ? 1 : 0); + + // TODO: Change way of getting resources for planet. Possibly a map, would solve future concurrency problems. + Vector resources = core.resourceService.getSpawnedResourcesByPlanetAndType(player.getPlanetId(), generalType); + if (resources == null || resources.size() == 0) + return; + + // The level and reward calculations are taken from EMU. Can hardly find anything related to survey missions from NGE. + int maxLevel = 50; + int minLevel = 50; + float surveySkill = core.skillModService.getSkillModValue((CreatureObject) player, "surveying"); + + if (surveySkill > 30) { maxLevel += 10; } + if (surveySkill > 50) { maxLevel += 10; } + if (surveySkill > 70) { maxLevel += 10; } + if (surveySkill > 90) { maxLevel += 10; } + if (surveySkill > 100) { maxLevel += 5; } //Max mission level is 95. + + int randNumber = (maxLevel == minLevel ? 0 : ran.nextInt(maxLevel - minLevel)); // prevent bound error (can't randomize 0) + int randLevel = minLevel + (5 * randNumber) / 5; + + if (randLevel > maxLevel) + randLevel = maxLevel; + + GalacticResource resource = resources.get(ran.nextInt(resources.size() - 1)); + + if (resource == null) + return; + + ResourceRoot family = resource.getResourceRoot(); + + mission.setMissionType("survey"); + + String missionStf = "mission/mission_npc_survey_neutral_easy"; + + mission.setMissionId(getRandomStringEntry(missionStf)); + mission.setMissionDescription(missionStf); + mission.setMissionTitle(missionStf); + + mission.setCreator(nameGenerator.compose(2) + " " + nameGenerator.compose(3)); + + mission.setMissionLevel(randLevel); + + mission.setStartLocation(player.getPosition(), player.getPlanet().name); + + mission.setCreditReward(400 + (randLevel - minLevel) * 20 + ran.nextInt(100)); + + mission.setMissionTemplateObject(CRC.StringtoCRC(ResourceRoot.CONTAINER_TYPE_IFF_SIGNIFIER[family.getContainerType()])); // This should be the resource container obj + mission.setMissionTargetName(family.getResourceType() + family.getResourceClass()); + + } + private void randomDeliveryMission(SWGObject player, MissionObject mission) { mission.setMissionType("deliver"); @@ -432,7 +494,7 @@ public class MissionService implements INetworkDispatch { String missionStf = "mission/mission_deliver_neutral_" + difficulties[ran.nextInt(difficulties.length)]; mission.setMissionId(getRandomStringEntry(missionStf)); - mission.setMissionDescription(missionStf); + mission.setMissionDescription(missionStf, "o"); mission.setMissionTitle(missionStf); mission.setCreator(nameGenerator.compose(2) + " " + nameGenerator.compose(3)); @@ -446,7 +508,7 @@ public class MissionService implements INetworkDispatch { mission.setStartLocation(startLocation, player.getPlanet().name); mission.setDestination(destination, player.getPlanet().name); - mission.setCreditReward((int) (50 + ((startLocation.getDistance2D(destination) / 10)))); + mission.setCreditReward((int) (200 + ((startLocation.getDistance2D(destination) / 10)))); mission.setMissionTemplateObject(CRC.StringtoCRC("object/tangible/mission/shared_mission_datadisk.iff")); mission.setMissionTargetName("Datadisk"); @@ -468,10 +530,9 @@ public class MissionService implements INetworkDispatch { else gotBounty = true; } + if (attempts >= 5 && !gotBounty) + return; } - - if (bountyTarget == null || bountyTarget.getAssignedHunters().contains(player.getObjectId())) - return; mission.setMissionType("bounty"); @@ -510,7 +571,7 @@ public class MissionService implements INetworkDispatch { mission.setMissionDescription(missionStf, "s"); } - mission.setMissionLevel(new Random().nextInt(100 - 95) + 95); + mission.setMissionLevel(95 + bountyTarget.getFailedAttempts()); mission.setCreditReward(bountyTarget.getCreditReward()); diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 116c952a..b330e1b5 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -121,6 +121,7 @@ import resources.objects.tangible.TangibleObject; import resources.objects.tool.SurveyTool; import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; +import services.ai.AIActor; import services.command.BaseSWGCommand; import services.command.CombatCommand; import services.bazaar.AuctionItem; @@ -456,22 +457,23 @@ public class ObjectService implements INetworkDispatch { return; } - if (object instanceof TangibleObject && - ((TangibleObject) object).getRespawnTime() > 0) { + if (object.getAttachment("AI") != null && ((AIActor) object.getAttachment("AI")).getMobileTemplate().getRespawnTime() > 0) { final long objectId = object.getObjectID(); final String Template = object.getTemplate(); final Planet planet = object.getPlanet(); final Point3D position = object.getPosition(); final Quaternion orientation = object.getOrientation(); + final long cellId = ((object.getContainer() == null) ? 0L : object.getContainer().getObjectID()); + final short level = ((object instanceof CreatureObject) ? object.getLevel() : (short) 0); scheduler.schedule(new Runnable() { @Override public void run() { - createObject(Template, objectId, planet, position, orientation); + NGECore.getInstance().spawnService(Template, objectId, planet.getName(), cellId, position.x, position.y, position.z, orientation.w, orientation.x, oritentation.y, orientation.z, level); } - }, ((TangibleObject) object).getRespawnTime(), TimeUnit.SECONDS); + }, ((AIActor) object.getAttachment("AI")).getMobileTemplate().getRespawnTime(), TimeUnit.SECONDS); } String filePath = "scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", "") + object.getTemplate().split("shared_" , 2)[1].replace(".iff", "") + ".py"; @@ -836,9 +838,9 @@ public class ObjectService implements INetworkDispatch { core.buffService.clearBuffs(creature); - CmdStartScene startScene = new CmdStartScene((byte) 0, objectId, creature.getPlanet().getPath(), creature.getTemplate(), position.x, position.y, position.z, core.getGalacticTime(), 0); + CmdStartScene startScene = new CmdStartScene((byte) 0, objectId, creature.getPlanet().getPath(), creature.getTemplate(), position.x, position.y, position.z, core.getGalacticTime() / 1000, 0); session.write(startScene.serialize()); - + ChatServerStatus chatServerStatus = new ChatServerStatus(); client.getSession().write(chatServerStatus.serialize()); diff --git a/src/services/playercities/PlayerCity.java b/src/services/playercities/PlayerCity.java index 066c015e..2a271b9e 100644 --- a/src/services/playercities/PlayerCity.java +++ b/src/services/playercities/PlayerCity.java @@ -460,6 +460,14 @@ public class PlayerCity implements Serializable { electionVotes.add(vote); } + public void addToTreasury(int amountToAdd) { + cityTreasury += amountToAdd; + } + + public void removeFromTreasury(int amountToDeduct) { + cityTreasury -= amountToDeduct; + } + // Stalinesque method :D public void setElectionVotes(Vector electionVotes) { this.electionVotes = electionVotes; diff --git a/src/services/spawn/MobileTemplate.java b/src/services/spawn/MobileTemplate.java index 564a2be4..b18fc43e 100644 --- a/src/services/spawn/MobileTemplate.java +++ b/src/services/spawn/MobileTemplate.java @@ -56,6 +56,7 @@ public class MobileTemplate { private boolean isStalker = false; private String meatType, milkType, boneType, hideType; private int meatAmount, milkAmount, boneAmount, hideAmount; + private int respawnTime = 0; public Vector getTemplates() { return templates; @@ -328,4 +329,13 @@ public class MobileTemplate { public void setHideAmount(int hideAmount) { this.hideAmount = hideAmount; } + + public int getRespawnTime() { + return respawnTime; + } + + public void setRespawnTime(int respawnTime) { + this.respawnTime = respawnTime; + } + } diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java index b3b51689..f8817448 100644 --- a/src/services/spawn/SpawnService.java +++ b/src/services/spawn/SpawnService.java @@ -85,7 +85,7 @@ public class SpawnService { return null; } - CreatureObject creature = (CreatureObject) core.objectService.createObject(mobileTemplate.getTemplates().get(new Random().nextInt(mobileTemplate.getTemplates().size())), objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ)); + CreatureObject creature = (CreatureObject) core.objectService.createObject(mobileTemplate.getTemplates().get(new Random().nextInt(mobileTemplate.getTemplates().size())), objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ), null, (objectId > 0), true); if(creature == null) return null; diff --git a/src/services/travel/TravelService.java b/src/services/travel/TravelService.java index addfbfe1..74310bf3 100644 --- a/src/services/travel/TravelService.java +++ b/src/services/travel/TravelService.java @@ -27,9 +27,6 @@ import java.util.List; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; - import org.apache.commons.lang3.text.WordUtils; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; @@ -52,6 +49,7 @@ import resources.common.Opcodes; import resources.common.SpawnPoint; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; +import services.playercities.PlayerCity; import services.sui.SUIService.ListBoxType; import services.sui.SUIService.MessageBoxType; import services.sui.SUIWindow.SUICallback; @@ -63,7 +61,6 @@ public class TravelService implements INetworkDispatch { private NGECore core; private Map> travelMap = new ConcurrentHashMap>(); private Map> fareMap = new ConcurrentHashMap>(); - private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public TravelService(NGECore core) { this.core = core; @@ -255,9 +252,13 @@ public class TravelService implements INetworkDispatch { public void purchaseTravelTicket(SWGObject player, String departurePlanet, String departureLoc, String arrivalPlanet, String arrivalLoc, String roundTrip) { CreatureObject creatureObj = (CreatureObject) player; int fare = fareMap.get(player.getPlanet()).get(arrivalPlanet); + int tax = 0; if (roundTrip.equals("1")) { fare += fareMap.get(player.getPlanet()).get(arrivalPlanet); } + PlayerCity city = core.playerCityService.getCityObjectIsIn(player); + if (city != null && city.getTravelTax() != 0) { tax = city.getTravelTax(); fare += tax;} + int playerBankCredits = creatureObj.getBankCredits(); if (playerBankCredits < fare) { int cashDifference = fare - playerBankCredits; @@ -271,9 +272,12 @@ public class TravelService implements INetworkDispatch { creatureObj.setBankCredits(0); creatureObj.setCashCredits(creatureObj.getCashCredits() - cashDifference); + } else { creatureObj.setBankCredits(playerBankCredits - fare); + } + if (tax != 0) { city.addToTreasury(tax);} if (roundTrip.equals("1")) { SWGObject tripTicket = createTravelTicket(arrivalPlanet, arrivalLoc, departurePlanet, departureLoc);