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/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/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/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_tactical_sup_1.py b/scripts/commands/of_tactical_sup_1.py deleted file mode 100644 index 7ec7b103..00000000 --- a/scripts/commands/of_tactical_sup_1.py +++ /dev/null @@ -1,72 +0,0 @@ -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): - 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/loot/shared_npe_loot_crate_low.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') - - permissions = StaticContainerPermissions() - permissions.canRemove(actor, crate) - permissions.canView(actor, crate) - crate.setContainerPermissions(permissions) - - tac1 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac1) - tac2 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac2) - tac3 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac3) - tac4 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac4) - tac5 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac5) - tac6 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac6) - tac7 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac7) - tac8 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac8) - - stim1 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim1) - stim2 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim2) - stim3 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim3) - stim4 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim4) - stim5 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim5) - stim6 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim6) - stim7 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim7) - stim8 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim8) - - time.sleep(60) - core.objectService.destroyObject(crate) - - return \ No newline at end of file diff --git a/scripts/commands/of_tactical_sup_2.py b/scripts/commands/of_tactical_sup_2.py deleted file mode 100644 index 76c7b5aa..00000000 --- a/scripts/commands/of_tactical_sup_2.py +++ /dev/null @@ -1,13 +0,0 @@ -import sys - -def setup(core, actor, buff): - return - -def run(core, actor, target, commandString): - print (' shuttle called!') - lambdaShuttle = stcSvc.spawnObject('object/creature/npc/theme_park/shared_event_lambda_shuttle.iff', actor.getPlanet().getName(), - long(0), actor.getPosition().x, actor.getPosition().y, actor.getPosition().z, actor.getOrientation().y, actor.getOrientation().w) - - lambdaShuttle.setPosture(0) # 0 or 2? - print ('posture set!') - return \ No newline at end of file diff --git a/scripts/commands/of_tactical_sup_3.py b/scripts/commands/of_tactical_sup_3.py deleted file mode 100644 index 76c7b5aa..00000000 --- a/scripts/commands/of_tactical_sup_3.py +++ /dev/null @@ -1,13 +0,0 @@ -import sys - -def setup(core, actor, buff): - return - -def run(core, actor, target, commandString): - print (' shuttle called!') - lambdaShuttle = stcSvc.spawnObject('object/creature/npc/theme_park/shared_event_lambda_shuttle.iff', actor.getPlanet().getName(), - long(0), actor.getPosition().x, actor.getPosition().y, actor.getPosition().z, actor.getOrientation().y, actor.getOrientation().w) - - lambdaShuttle.setPosture(0) # 0 or 2? - print ('posture set!') - return \ No newline at end of file diff --git a/scripts/commands/of_tactical_sup_4.py b/scripts/commands/of_tactical_sup_4.py deleted file mode 100644 index 76c7b5aa..00000000 --- a/scripts/commands/of_tactical_sup_4.py +++ /dev/null @@ -1,13 +0,0 @@ -import sys - -def setup(core, actor, buff): - return - -def run(core, actor, target, commandString): - print (' shuttle called!') - lambdaShuttle = stcSvc.spawnObject('object/creature/npc/theme_park/shared_event_lambda_shuttle.iff', actor.getPlanet().getName(), - long(0), actor.getPosition().x, actor.getPosition().y, actor.getPosition().z, actor.getOrientation().y, actor.getOrientation().w) - - lambdaShuttle.setPosture(0) # 0 or 2? - print ('posture set!') - return \ No newline at end of file diff --git a/scripts/commands/of_tactical_sup_5.py b/scripts/commands/of_tactical_sup_5.py deleted file mode 100644 index 76c7b5aa..00000000 --- a/scripts/commands/of_tactical_sup_5.py +++ /dev/null @@ -1,13 +0,0 @@ -import sys - -def setup(core, actor, buff): - return - -def run(core, actor, target, commandString): - print (' shuttle called!') - lambdaShuttle = stcSvc.spawnObject('object/creature/npc/theme_park/shared_event_lambda_shuttle.iff', actor.getPlanet().getName(), - long(0), actor.getPosition().x, actor.getPosition().y, actor.getPosition().z, actor.getOrientation().y, actor.getOrientation().w) - - lambdaShuttle.setPosture(0) # 0 or 2? - print ('posture set!') - return \ No newline at end of file diff --git a/scripts/commands/of_tactical_sup_6.py b/scripts/commands/of_tactical_sup_6.py deleted file mode 100644 index ec8f96db..00000000 --- a/scripts/commands/of_tactical_sup_6.py +++ /dev/null @@ -1,70 +0,0 @@ -from engine.resources.container import StaticContainerPermissions -import time -import sys - -def setup(core, actor, buff): - return - -def run(core, actor, target, commandString): - doStimDrop(core, actor) - return - -def doStimDrop(core, actor): - stcSvc = core.staticService - time.sleep(10) # Wait time before shuttle arrives after command is called - 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(1) - 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/loot/shared_npe_loot_crate_low.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') - - permissions = StaticContainerPermissions() - permissions.canRemove(actor, crate) - permissions.canView(actor, crate) - crate.setContainerPermissions(permissions) - - tac1 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac1) - tac2 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac2) - tac3 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac3) - tac4 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac4) - tac5 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac5) - tac6 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac6) - tac7 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac7) - tac8 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_syren.iff', actor.getPlanet()) - crate.add(tac8) - - stim1 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim1) - stim2 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim2) - stim3 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim3) - stim4 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim4) - stim5 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim5) - stim6 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim6) - stim7 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim7) - stim8 = core.objectService.createObject('object/tangible/medicine/instant_stimpack/shared_stimpack_generic_a.iff', actor.getPlanet()) - crate.add(stim8) - - return \ No newline at end of file diff --git a/scripts/commands/requestwaypointatposition.py b/scripts/commands/requestwaypointatposition.py index 98c3fd2d..60b932ce 100644 --- a/scripts/commands/requestwaypointatposition.py +++ b/scripts/commands/requestwaypointatposition.py @@ -7,7 +7,7 @@ def run(core, actor, target, commandString): commandArgs = commandString.split("(^-,=+_)color_13548(,+-=_^)=1") - newString = commandArgs[1] + newString = commandArgs[0] print (newString) cmdService = core.commandService cmdService.callCommand(actor, 'waypoint', None, newString) # No need to re-create a script 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/expertise/expertise_of_tactical_sup_1.py b/scripts/expertise/expertise_of_tactical_sup_1.py index d95ef2a5..451c6fbe 100644 --- a/scripts/expertise/expertise_of_tactical_sup_1.py +++ b/scripts/expertise/expertise_of_tactical_sup_1.py @@ -37,12 +37,8 @@ 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): - actor.addAbility('of_tactical_sup_1') - return def removeAbilities(core, actor, player): - actor.removeAbility('of_tactical_sup_1') - 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/static_travel_points.py b/scripts/static_travel_points.py index 54b19a77..26ac3f85 100644 --- a/scripts/static_travel_points.py +++ b/scripts/static_travel_points.py @@ -40,11 +40,10 @@ def corelliaPoints(core, planet): 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): 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/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/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index 7b9b948f..5d03db30 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -56,5 +56,6 @@ public class Opcodes { 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/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/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/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index 90ed5851..ef2a2ad4 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -167,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()); @@ -228,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 @@ -245,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()); @@ -261,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); @@ -983,6 +987,43 @@ 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) 2, 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); @@ -1002,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 ea367d8f..f0b160b5 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -55,7 +55,7 @@ import engine.resources.scene.Quaternion; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; -@Entity(version=3) +@Entity(version=6) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -115,6 +115,13 @@ 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; + private CreatureObject performanceWatchee; + private CreatureObject performanceListenee; private int health = 1000; private int action = 300; @NotPersistent @@ -143,7 +150,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) { @@ -305,15 +312,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 @@ -747,6 +764,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) { @@ -894,6 +919,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; } @@ -1308,7 +1341,66 @@ public class CreatureObject extends TangibleObject implements IPersistent { public boolean setStaticNPC(boolean staticNPC) { return this.staticNPC = staticNPC; } + public CreatureObject getPerformanceWatchee() { + synchronized(objectMutex) { + return performanceWatchee; + } + } + + public void setPerformanceWatchee(CreatureObject performanceWatchee) { + synchronized(objectMutex) { + this.performanceWatchee = performanceWatchee; + } + getClient().getSession().write(messageBuilder.buildListenToId(performanceWatchee.getObjectId())); + } + + public CreatureObject getPerformanceListenee() { + synchronized(objectMutex) { + return performanceListenee; + } + } + + public void setPerformanceListenee(CreatureObject performanceListenee) { + synchronized(objectMutex) { + this.performanceListenee = performanceListenee; + } + } + + 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); diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 99d3f926..a4d45d4b 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -234,10 +234,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) { diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index 896f2525..5bcfa7b6 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 @@ -128,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); @@ -152,6 +213,14 @@ public class EntertainmentService implements INetworkDispatch { e.printStackTrace(); } } + + private void registerCommands() { + core.commandService.registerCommand("startdance"); + core.commandService.registerCommand("stopdance"); + core.commandService.registerCommand("flourish"); + core.commandService.registerAlias("flo","flourish"); + core.commandService.registerCommand("bandflourish"); + } public void giveInspirationBuff(SWGObject reciever, Vector buffVector) { CreatureObject buffCreature = (CreatureObject) reciever; @@ -177,6 +246,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/SkillService.java b/src/services/SkillService.java index da016e3a..c90d1095 100644 --- a/src/services/SkillService.java +++ b/src/services/SkillService.java @@ -87,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); @@ -95,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; } diff --git a/src/services/combat/CombatCommands.java b/src/services/combat/CombatCommands.java index 7ba5c596..1544a0ce 100644 --- a/src/services/combat/CombatCommands.java +++ b/src/services/combat/CombatCommands.java @@ -516,15 +516,10 @@ 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"); - core.commandService.registerCommand("of_tactical_sup_1"); - core.commandService.registerCommand("of_tactical_sup_2"); - core.commandService.registerCommand("of_tactical_sup_3"); - core.commandService.registerCommand("of_tactical_sup_4"); - core.commandService.registerCommand("of_tactical_sup_5"); - core.commandService.registerCommand("of_tactical_sup_6"); // Smuggler diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 06a84ce2..b943779c 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -405,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()); @@ -887,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); diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index f6483fab..367f9134 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,29 @@ public class CommandService implements INetworkDispatch { return command; } + + //FIXME: CRC could just be generated as well. + 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 +165,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) { diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java index 5792f2cd..ee1122c6 100644 --- a/src/services/gcw/FactionService.java +++ b/src/services/gcw/FactionService.java @@ -32,16 +32,17 @@ 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 resources.objects.tangible.TangibleObject; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; +import engine.clients.Client; import engine.resources.common.CRC; -import engine.resources.objects.SWGObject; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -85,6 +86,10 @@ public class FactionService implements INetworkDispatch { } public void addFactionStanding(CreatureObject creature, String faction, int factionStanding) { + if (!isFaction(faction)) { + return; + } + if (creature == null) { return; } @@ -99,6 +104,10 @@ public class FactionService implements INetworkDispatch { } public void removeFactionStanding(CreatureObject creature, String faction, int factionStanding) { + if (!isFaction(faction)) { + return; + } + if (creature == null) { return; } @@ -109,32 +118,7 @@ public class FactionService implements INetworkDispatch { return; } - player.modifyFactionStanding(faction, factionStanding); - } - - public void updateFactionStanding(SWGObject killedObject) { - if (!(killedObject instanceof TangibleObject) || killedObject == null) { - return; - } - - TangibleObject target = (TangibleObject) killedObject; - - if (!(((TangibleObject) killedObject).getKiller() instanceof TangibleObject) || ((TangibleObject) killedObject).getKiller() == null) { - return; - } - - TangibleObject killer = ((TangibleObject) killedObject).getKiller(); - - if (killer != null && target != null && isFaction(target.getFaction())) { - if (FileUtilities.doesFileExist("scripts/faction/standing/" + target.getFaction() + ".py")) { - - PyObject method = core.scriptService.getMethod("scripts/faction/standing/", target.getFaction(), "update"); - - if (method != null && method.isCallable()) { - method.__call__(Py.java2py(core), Py.java2py(killer), Py.java2py(target)); - } - } - } + player.modifyFactionStanding(faction, -factionStanding); } public boolean isFaction(String faction) { @@ -145,6 +129,62 @@ public class FactionService implements INetworkDispatch { 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; } @@ -156,7 +196,25 @@ public class FactionService implements INetworkDispatch { @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()); } }); diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 8da5bc20..6888b40b 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -21,6 +21,7 @@ ******************************************************************************/ package services.object; +import java.io.FileNotFoundException; import java.io.IOException; import java.nio.ByteOrder; import java.sql.PreparedStatement; @@ -220,7 +221,7 @@ public class ObjectService implements INetworkDispatch { object.setAttachment("serverTemplate", ((customServerTemplate != null) ? customServerTemplate : object.getTemplate())); object.setisInSnapshot(isSnapshot); - loadServerTemplate(object); + //loadServerTemplate(object); objectList.put(objectID, object); @@ -277,10 +278,12 @@ public class ObjectService implements INetworkDispatch { } } + } catch (FileNotFoundException e) { + System.out.println("!File Not Found:" + template.toString()); } catch (IOException e) { + System.out.println("!IO error " + template.toString()); e.printStackTrace(); } - } public SWGObject createObject(String Template, Planet planet) { @@ -352,18 +355,6 @@ public class ObjectService implements INetworkDispatch { } } - if (object instanceof CreatureObject) { - if (core.factionService.getFactionMap().containsKey(((CreatureObject) object).getFaction())) { - 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", ""), "destroy"); - - if (method != null && method.isCallable()) { - method.__call__(Py.java2py(core), Py.java2py(((TangibleObject) object).getKiller()), Py.java2py(object)); - } - } - } - } - if (object == null) { return; } @@ -457,10 +448,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)); } } }