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/findfriend.py b/scripts/commands/findfriend.py new file mode 100644 index 00000000..992efa35 --- /dev/null +++ b/scripts/commands/findfriend.py @@ -0,0 +1,18 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + ghost = actor.getSlottedObject('ghost') + friend = commandString.split(' ')[0] + + if ghost.getFriendList().contains(friend): + friendObj = core.chatService.getObjectByFirstName(friend) + if friendObj is not None: + if friendObj.getSlottedObject('ghost').getFriendList().contains(actor.getCustomName().lower().split(' ')[0]): + fPos = friendObj.getPosition() + core.commandService.callCommand(actor, 'waypoint', None, friendObj.getPlanet().name + ' ' + str(fPos.x) + ' ' + str(fPos.z) + ' ' + str(fPos.y) + ' blue ' + friendObj.getCustomName()) + return + return + return \ No newline at end of file diff --git a/scripts/commands/flourish.py b/scripts/commands/flourish.py new file mode 100644 index 00000000..0bb6cb93 --- /dev/null +++ b/scripts/commands/flourish.py @@ -0,0 +1,31 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + if len(commandString) <= 0: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + try: + flourish = int(commandString) + except ValueError: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + if flourish < 1 or flourish > 9: + actor.sendSystemMessage('@performance:flourish_not_valid', 0) + return + + if actor.getPerformanceId() <= 0: + actor.sendSystemMessage('@performance:flourish_not_performing', 0) + return + + actor.sendSystemMessage('@performance:flourish_perform', 0) + animation = 'skill_action_' + str(flourish) + if flourish == 9: + animation = 'mistake' + + actor.doSkillAnimation(animation) diff --git a/scripts/commands/groupdance.py b/scripts/commands/groupdance.py new file mode 100644 index 00000000..ed38ed89 --- /dev/null +++ b/scripts/commands/groupdance.py @@ -0,0 +1,11 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + newState = actor.toggleGroupDance() + msg = '@performance:dance_group_on' if newState else '@performance:dance_group_off' + actor.sendSystemMessage(msg, 0) + return diff --git a/scripts/commands/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/commands/tip.py b/scripts/commands/tip.py index b0b4331c..b34992f2 100644 --- a/scripts/commands/tip.py +++ b/scripts/commands/tip.py @@ -1,6 +1,4 @@ -from resources.objects.creature import CreatureObject from java.util import Date -from engine.resources.objects import SWGObject from services.chat import ChatService from services.chat import Mail from services.sui import SUIWindow @@ -8,6 +6,7 @@ from services.sui import SUIService from services.sui.SUIWindow import Trigger from services.sui.SUIService import MessageBoxType from java.util import Vector +from main import NGECore import sys # initialize global vars (happens at compile time) @@ -81,7 +80,8 @@ def run(core, actor, target, commandString): return return -def handleBankTip(core, owner, eventType, returnList): +def handleBankTip(owner, window, eventType, returnList): + core = NGECore.getInstance() chatSvc = core.chatService actorGlobal = core.objectService.getObject(actorID) targetGlobal = core.objectService.getObject(targetID) @@ -115,7 +115,7 @@ def handleBankTip(core, owner, eventType, returnList): actorMail.setSubject('@base_player:wire_mail_subject') actorMail.setSenderName('bank') - targetGlobal.setBankCredits(int(tipAmount)) + targetGlobal.setBankCredits(int(tipAmount) + int(targetGlobal.getBankCredits())) actorGlobal.setBankCredits(int(actorFunds) - int(totalLost)) actorGlobal.sendSystemMessage('You have successfully sent ' + tipAmount + ' bank credits to ' + targetGlobal.getCustomName(), 0) targetGlobal.sendSystemMessage('You have successfully received ' + tipAmount + ' bank credits from ' + actorGlobal.getCustomName(), 0) diff --git a/scripts/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/object/tangible/terminal/terminal_mission.py b/scripts/object/tangible/terminal/terminal_mission.py index 4884aa67..ccf684c0 100644 --- a/scripts/object/tangible/terminal/terminal_mission.py +++ b/scripts/object/tangible/terminal/terminal_mission.py @@ -1,7 +1,9 @@ +from resources.common import TerminalType import sys def setup(core, object): core.mapService.addLocation(object.getPlanet(), 'Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 44, 0) + object.setAttachment("terminalType", TerminalType.MISSION_GENERIC) return \ No newline at end of file diff --git a/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py b/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py index ccad8904..77e1b16d 100644 --- a/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py +++ b/scripts/object/tangible/travel/travel_ticket/base/base_travel_ticket.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'travel_ticket') return \ No newline at end of file diff --git a/scripts/radial/travel_terminal.py b/scripts/radial/travel_terminal.py index f8b984fb..eae686ca 100644 --- a/scripts/radial/travel_terminal.py +++ b/scripts/radial/travel_terminal.py @@ -8,13 +8,10 @@ def createRadial(core, owner, target, radials): def handleSelection(core, owner, target, option): if option == 21 and target: - print ('Owner: ' + str(owner.getObjectId())) - + if owner is not None: tpm = EnterTicketPurchaseModeMessage(owner.getPlanet().getName(), core.mapService.getClosestCityName(owner), owner) owner.getClient().getSession().write(tpm.serialize()) - print ('Planet name: ' + owner.getPlanet().getName()) - print ('City name: ' + core.mapService.getClosestCityName(owner)) return return diff --git a/scripts/radial/travel_ticket.py b/scripts/radial/travel_ticket.py new file mode 100644 index 00000000..a42df278 --- /dev/null +++ b/scripts/radial/travel_ticket.py @@ -0,0 +1,40 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.clear + + radials.add(RadialOptions(0, 21, 1, 'Use Travel Ticket')) + #radials.add(RadialOptions(0, 7, 1, '')) + #radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + + if option == 21 and target: + + tp = core.travelService.getNearestTravelPoint(owner) + + if owner is not None and tp is not None: + print (str(tp.getLocation().getDistance2D(owner.getWorldPosition()))) + if tp.getLocation().getDistance2D(owner.getWorldPosition()) <= float(25): + if tp.isShuttleAvailable() is True: + core.travelService.doTransport(owner, core.travelService.getTravelPointByName(target.getStringAttribute('@obj_attr_n:travel_arrival_planet'), + target.getStringAttribute('@obj_attr_n:travel_arrival_point'))) + core.objectService.destroyObject(target) + return + return + else: + owner.sendSystemMessage('@travel:boarding_too_far', 0) + return + return + return + + if option == 15 and target: + core.commandService.callCommand(owner, 'serverdestroyobject', target, None) + return + return + +def handleSUI(owner, window, eventType, returnList): + + return \ No newline at end of file diff --git a/scripts/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/main/NGECore.java b/src/main/NGECore.java index 6fd87731..1e25ed4e 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -35,7 +35,6 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import net.engio.mbassy.bus.config.BusConfiguration; - import resources.common.RadialOptions; import resources.common.ThreadMonitor; import resources.objects.creature.CreatureObject; @@ -47,6 +46,7 @@ import services.EntertainmentService; import services.EquipmentService; import services.GroupService; import services.LoginService; +import services.MissionService; import services.PlayerService; import services.ScriptService; import services.SimulationService; @@ -144,6 +144,7 @@ public class NGECore { public WeatherService weatherService; public SpawnService spawnService; public AIService aiService; + //public MissionService missionService; // Login Server public NetworkDispatch loginDispatch; @@ -219,6 +220,7 @@ public class NGECore { equipmentService = new EquipmentService(this); entertainmentService = new EntertainmentService(this); aiService = new AIService(this); + //missionService = new MissionService(this); // Ping Server try { @@ -249,6 +251,7 @@ public class NGECore { zoneDispatch.addService(playerService); zoneDispatch.addService(buffService); zoneDispatch.addService(entertainmentService); + //zoneDispatch.addService(missionService); zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT")); zoneServer.start(); 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/protocol/swg/objectControllerObjects/MissionListRequest.java b/src/protocol/swg/objectControllerObjects/MissionListRequest.java index 1cafd618..7fbe2d02 100644 --- a/src/protocol/swg/objectControllerObjects/MissionListRequest.java +++ b/src/protocol/swg/objectControllerObjects/MissionListRequest.java @@ -39,6 +39,7 @@ public class MissionListRequest extends ObjControllerObject { public void deserialize(IoBuffer data) { Console.println("MissionListRequest: " + StringUtilities.bytesToHex(data.array())); setObjectId(data.getLong()); + data.getInt(); // unk data.get(); // unk byte setTickCount(data.get()); setTerminalId(data.getLong()); diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 17c9784c..551857d9 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -31,6 +31,6 @@ public class ObjControllerOpcodes { public static final int OBJECT_MENU_REQUEST = 0x46010000; public static final int SECURE_TRADE = 0x15010000; public static final int BUFF_BUILDER_CHANGE = 0x5A020000; - public static final int MISSION_LIST_REQUEST = 0x5F000000; + public static final int MISSION_LIST_REQUEST = 0xF5000000; } 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/common/TerminalType.java b/src/resources/common/TerminalType.java new file mode 100644 index 00000000..375d1e61 --- /dev/null +++ b/src/resources/common/TerminalType.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.common; + +public class TerminalType { + public static int MISSION_GENERIC = 1; + public static int MISSION_BOUNTYHUNTER = 2; + public static int MISSION_ENTERTAINER = 3; + public static int MISSION_ARTISAN = 4; + public static int MISSION_EXPLORER = 5; +} diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index 2ae391d4..22051e7a 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -168,7 +168,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()); @@ -229,10 +229,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 @@ -246,10 +248,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()); @@ -262,6 +265,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); @@ -984,6 +988,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) 0x09, buffer, size + 4); + return buffer; + } + + public IoBuffer buildPerformanceId(int performanceId) { + IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(performanceId); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x14, buffer, size + 4); + return buffer; + } + + public IoBuffer buildPerformanceCounter(int performanceCounter) { + IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(performanceCounter); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x13, buffer, size + 4); + return buffer; + } + + public IoBuffer buildStartPerformance(boolean doStart) { + IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.put((byte) ((doStart) ? 1 : 0)); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1B, buffer, size + 4); + return buffer; + } + + public IoBuffer buildDifficultyDelta(byte difficulty) { IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN); buffer.put(difficulty); @@ -1003,5 +1044,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 0f313801..b218c901 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=7) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -115,6 +115,15 @@ public class CreatureObject extends TangibleObject implements IPersistent { private byte moodId = 0; private int performanceCounter = 0; private int performanceId = 0; + //FIXME: this is a bit of a hack. + private boolean performanceType = false; + //FIXME: hmm.. or persistent? + @NotPersistent + private boolean acceptBandflourishes = true; + @NotPersistent + private boolean groupDance = true; + private CreatureObject performanceWatchee; + private CreatureObject performanceListenee; private int health = 1000; private int action = 300; @NotPersistent @@ -143,7 +152,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { private SWGList dotList = new SWGList(); @NotPersistent private ScheduledFuture incapTask; - + private boolean staticNPC = false; // temp public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { @@ -305,15 +314,25 @@ public class CreatureObject extends TangibleObject implements IPersistent { } public void setPosture(byte posture) { + boolean needsStopPerformance = false; synchronized(objectMutex) { + if (this.posture == 0x09) { + needsStopPerformance = true; + } this.posture = posture; } + IoBuffer postureDelta = messageBuilder.buildPostureDelta(posture); Posture postureUpdate = new Posture(getObjectID(), posture); ObjControllerMessage objController = new ObjControllerMessage(0x1B, postureUpdate); notifyObservers(postureDelta, true); notifyObservers(objController, true); + + if (needsStopPerformance) { + stopPerformance(); + } + } @Override @@ -747,6 +766,14 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(messageBuilder.buildCurrentAnimationDelta(currentAnimation), true); } + + public void doSkillAnimation(String skillAnimation) { + Animation animation = new Animation(getObjectId(), skillAnimation); + ObjControllerMessage objController = new ObjControllerMessage(0x1B, animation); + + notifyObservers(objController, true); + + } public String getMoodAnimation() { synchronized(objectMutex) { @@ -894,6 +921,14 @@ public class CreatureObject extends TangibleObject implements IPersistent { } } + public boolean getAcceptBandflourishes() { + return acceptBandflourishes; + } + + public void setAcceptBandflourishes(boolean acceptBandflourishes) { + this.acceptBandflourishes = acceptBandflourishes; + } + public SWGList getEquipmentList() { return equipmentList; } @@ -1317,6 +1352,88 @@ public class CreatureObject extends TangibleObject implements IPersistent { return this.staticNPC = staticNPC; } + public boolean getGroupDance() { + synchronized(objectMutex) { + return groupDance; + } + } + + public void setGroupDance(boolean groupDance) { + synchronized(objectMutex) { + this.groupDance = groupDance; + } + } + + public boolean toggleGroupDance() { + synchronized(objectMutex) { + groupDance = !groupDance; + return groupDance; + } + } + + public CreatureObject getPerformanceWatchee() { + synchronized(objectMutex) { + return performanceWatchee; + } + } + + public void setPerformanceWatchee(CreatureObject performanceWatchee) { + synchronized(objectMutex) { + this.performanceWatchee = performanceWatchee; + } + //getClient().getSession().write(messageBuilder.buildListenToId(0)); + } + + public CreatureObject getPerformanceListenee() { + synchronized(objectMutex) { + return performanceListenee; + } + } + + public void setPerformanceListenee(CreatureObject performanceListenee) { + synchronized(objectMutex) { + this.performanceListenee = performanceListenee; + //possibly redundant, need to research this further. + this.listenToId = performanceListenee.getObjectId(); + } + getClient().getSession().write(messageBuilder.buildListenToId(this.listenToId)); + } + + public void startPerformance(int performanceId, int performanceCounter, String skillName, boolean isDance) { + synchronized(objectMutex) { + this.performanceId = performanceId; + this.performanceCounter = performanceCounter; + this.currentAnimation = skillName; + this.performanceType = isDance; + } + + getClient().getSession().write(messageBuilder.buildPerformanceId(performanceId)); + getClient().getSession().write(messageBuilder.buildPerformanceCounter(performanceCounter)); + getClient().getSession().write(messageBuilder.buildCurrentAnimationDelta(skillName)); + getClient().getSession().write(messageBuilder.buildStartPerformance(true)); + + } + + public void stopPerformance() { + String type = ""; + synchronized(objectMutex) { + this.performanceId = 0; + this.performanceCounter = 0; + this.currentAnimation = null; + type = (performanceType) ? "dance" : "music"; + } + + sendSystemMessage("@performance:" + type + "_stop_self",(byte)0); + notifyAudience("@performance:" + type + "_stop_other"); + + getClient().getSession().write(messageBuilder.buildStartPerformance(false)); + } + + public void notifyAudience(String message) { + //TODO: stub + } + + @Override public void setPvPBitmask(int pvpBitmask) { super.setPvPBitmask(pvpBitmask); diff --git a/src/resources/objects/mission/MissionMessageBuilder.java b/src/resources/objects/mission/MissionMessageBuilder.java index 8e206c01..190773ad 100644 --- a/src/resources/objects/mission/MissionMessageBuilder.java +++ b/src/resources/objects/mission/MissionMessageBuilder.java @@ -26,6 +26,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import engine.resources.common.CRC; +import resources.common.Console; +import resources.common.StringUtilities; import resources.objects.ObjectMessageBuilder; import resources.objects.waypoint.WaypointObject; @@ -40,17 +42,17 @@ public class MissionMessageBuilder extends ObjectMessageBuilder { IoBuffer buffer = IoBuffer.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); - buffer.putShort((short) 11); + buffer.putShort((short) 17); - buffer.putFloat(mission.getMissionComplexity()); - buffer.put(getAsciiString("mission/mission_object")); + buffer.putFloat(1); // mission complexity ?? + buffer.put(getAsciiString(mission.getStfFilename())); buffer.putInt(0); buffer.put(getAsciiString(mission.getStfName())); if (mission.getCustomName() == null) { buffer.put(getUnicodeString("")); } else { buffer.put(getUnicodeString(mission.getCustomName())); } - buffer.putInt(mission.getVolume()); + buffer.putInt(0); // volume buffer.putInt(0); // unused buffer.putInt(mission.getMissionLevel()); @@ -60,8 +62,12 @@ public class MissionMessageBuilder extends ObjectMessageBuilder { buffer.putLong(0); // ?? - buffer.putInt(CRC.StringtoCRC(mission.getMissionStartPlanet())); - + if (mission.getMissionStartPlanet() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getMissionStartPlanet())); + } + buffer.put(getUnicodeString(mission.getMissionCreator())); buffer.putInt(mission.getMissionCredits()); @@ -71,10 +77,18 @@ public class MissionMessageBuilder extends ObjectMessageBuilder { buffer.putLong(0); // ?? - buffer.putInt(CRC.StringtoCRC(mission.getMissionDestinationPlanet())); - - buffer.putInt(CRC.StringtoCRC(mission.getMissionTemplateObject())); + if (mission.getMissionDestinationPlanet() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getMissionDestinationPlanet())); + } + if (mission.getTargetTemplateObject() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getTargetTemplateObject())); + } + buffer.put(getAsciiString(mission.getMissionDescription())); buffer.putInt(0); buffer.put(getAsciiString(mission.getMissionDescId())); @@ -85,8 +99,12 @@ public class MissionMessageBuilder extends ObjectMessageBuilder { buffer.putInt(0); // refresh counter - buffer.putInt(CRC.StringtoCRC(mission.getMissionType())); - + if(mission.getMissionType() == null) { + buffer.putInt(0); + } else { + buffer.putInt(CRC.StringtoCRC(mission.getMissionType())); + } + buffer.put(getAsciiString(mission.getMissionTargetName())); WaypointObject wp = mission.getMissionAttachedWaypoint(); @@ -109,6 +127,8 @@ public class MissionMessageBuilder extends ObjectMessageBuilder { buffer.putFloat(wp.getPosition().y); buffer.putLong(0); buffer.putInt(CRC.StringtoCRC(wp.getPlanet().name)); + buffer.put((byte) 0); + buffer.put((byte) 0x01); } int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); @@ -116,23 +136,197 @@ public class MissionMessageBuilder extends ObjectMessageBuilder { buffer.flip(); buffer = createBaseline("MISO", (byte) 3, buffer, size); + Console.println("Bytes: " + StringUtilities.bytesToHex(buffer.array())); return buffer; } public IoBuffer buildBaseline6() { IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.putInt(121); // unk int size = buffer.position(); - buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); - buffer.flip(); buffer = createBaseline("MISO", (byte) 6, buffer, size); return buffer; } + public IoBuffer buildStfDelta(String stfFile, String stfName) { + + IoBuffer buffer = IoBuffer.allocate(4 + stfFile.length() + stfName.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(stfFile)); + buffer.putInt(0); + buffer.put(getAsciiString(stfName)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x01, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildDifficultyLevelDelta(int difficulty) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(difficulty); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x05, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildStartLocationDelta(float x, float z, float y, String planet) { + + IoBuffer buffer = IoBuffer.allocate(24, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putFloat(x); + buffer.putFloat(z); + buffer.putFloat(y); + + buffer.putLong(0); + + buffer.putInt(CRC.StringtoCRC(planet)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x06, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildCreatorNameDelta(String creator) { + + IoBuffer buffer = IoBuffer.allocate(4 + creator.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(creator)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x07, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildCreditsRewardDelta(int creds) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(creds); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x08, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildDestinationDelta(float x, float z, float y, String planet) { + + IoBuffer buffer = IoBuffer.allocate(24, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putFloat(x); + buffer.putFloat(z); + buffer.putFloat(y); + + buffer.putLong(0); // Destination Object ID + + buffer.putInt(CRC.StringtoCRC(planet)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x09, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildTargetObjectIffDelta(String template) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(CRC.StringtoCRC(template)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0A, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildMissionDescriptionDelta(String desc, String id) { + + IoBuffer buffer = IoBuffer.allocate(8 + desc.length() + id.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(desc)); + buffer.putInt(0); + buffer.put(getAsciiString(id)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0B, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildMissionTitleDelta(String title, String id) { + + IoBuffer buffer = IoBuffer.allocate(8 + title.length() + id.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(title)); + buffer.putInt(0); + buffer.put(getAsciiString(id)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0C, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildRepeatCounterDelta(int counter) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(counter); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0D, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildMissionTypeDelta(String type) { + + IoBuffer buffer = IoBuffer.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putInt(CRC.StringtoCRC(type)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0E, buffer, size + 4); + + return buffer; + } + + public IoBuffer buildTargetNameDelta(String targetName) { + + IoBuffer buffer = IoBuffer.allocate(4 + targetName.length(), false).order(ByteOrder.LITTLE_ENDIAN); + + buffer.put(getAsciiString(targetName)); + + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("MISO", (byte) 3, (short) 1, (short) 0x0F, buffer, size + 4); + + return buffer; + } + @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { diff --git a/src/resources/objects/mission/MissionObject.java b/src/resources/objects/mission/MissionObject.java index 3cbde103..635da311 100644 --- a/src/resources/objects/mission/MissionObject.java +++ b/src/resources/objects/mission/MissionObject.java @@ -23,7 +23,9 @@ package resources.objects.mission; import com.sleepycat.je.Environment; import com.sleepycat.je.Transaction; +import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; +import com.sleepycat.persist.model.Persistent; import resources.objects.tangible.TangibleObject; import resources.objects.waypoint.WaypointObject; @@ -34,13 +36,9 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; +@Persistent(version=1) public class MissionObject extends SWGObject implements IPersistent { - private String stfName; - private String customName; - private int volume; - - private float missionComplexity; private float missionDestinationX; private float missionDestinationY; private float missionDestinationZ; @@ -52,12 +50,12 @@ public class MissionObject extends SWGObject implements IPersistent { private String missionDestinationPlanet; private int missionRepeatCounter; // increases for each player using the mission; used for redisplaying on mission term too private int missionCredits; - private String missionCreator; - private String missionDescription; - private String missionTitle; - private String missionTargetName; // target/destination - private String missionDescId; - private String missionTitleId; + private String missionCreator = ""; + private String missionDescription = ""; + private String missionTitle = ""; + private String missionTargetName = ""; // Target object I guess? + private String missionDescId = ""; + private String missionTitleId = ""; private String missionType; private WaypointObject missionAttachedWaypoint; @@ -68,202 +66,222 @@ public class MissionObject extends SWGObject implements IPersistent { @NotPersistent private Transaction txn; - + + public MissionObject() { + super(); + } public MissionObject(long objectID, Planet planet, String template) { super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), template); } - - public String getStfName() { - return stfName; - } - - public void setStfName(String stfName) { - this.stfName = stfName; - } - - public String getCustomName() { - return customName; - } - - public void setCustomName(String customName) { - this.customName = customName; - } - - public int getVolume() { - return volume; - } - - public void setVolume(int volume) { - this.volume = volume; - } - - public float getMissionComplexity() { - return missionComplexity; - } - - public void setMissionComplexity(float missionComplexity) { - this.missionComplexity = missionComplexity; - } public float getMissionStartX() { - return missionStartX; - } - - public void setMissionStartX(float missionStartX) { - this.missionStartX = missionStartX; + synchronized(objectMutex) { + return missionStartX; + } } public float getMissionStartY() { - return missionStartY; - } - - public void setMissionStartY(float missionStartY) { - this.missionStartY = missionStartY; + synchronized(objectMutex) { + return missionStartY; + } } public float getMissionStartZ() { - return missionStartZ; + synchronized(objectMutex) { + return missionStartZ; + } } - public void setMissionStartZ(float missionStartZ) { - this.missionStartZ = missionStartZ; + public void setMissionStart(float x, float y, float z, String planet) { + synchronized(objectMutex) { + this.missionStartZ = z; + this.missionStartX = x; + this.missionStartY = y; + this.missionStartPlanet = planet; + } + + notifyObservers(messageBuilder.buildStartLocationDelta(x, z, y, planet), false); } public float getMissionDestinationX() { - return missionDestinationX; - } - - public void setMissionDestinationX(float missionDestinationX) { - this.missionDestinationX = missionDestinationX; + synchronized(objectMutex) { + return missionDestinationX; + } } public float getMissionDestinationY() { - return missionDestinationY; - } - - public void setMissionDestinationY(float missionDestinationY) { - this.missionDestinationY = missionDestinationY; + synchronized(objectMutex) { + return missionDestinationY; + } } public float getMissionDestinationZ() { - return missionDestinationZ; + synchronized(objectMutex) { + return missionDestinationZ; + } } - public void setMissionDestinationZ(float missionDestinationZ) { - this.missionDestinationZ = missionDestinationZ; + public void setMissionDestination(float x, float y, float z, String planet) { + synchronized(objectMutex) { + this.missionDestinationZ = z; + this.missionDestinationY = y; + this.missionDestinationZ = z; + this.missionDestinationPlanet = planet; + } } public String getMissionDestinationPlanet() { - return missionDestinationPlanet; - } - - public void setMissionDestinationPlanet(String missionDestinationPlanet) { - this.missionDestinationPlanet = missionDestinationPlanet; + synchronized(objectMutex) { + return missionDestinationPlanet; + } } public int getMissionLevel() { - return missionLevel; + synchronized(objectMutex) { + return missionLevel; + } } public void setMissionLevel(int missionLevel) { - this.missionLevel = missionLevel; + synchronized(objectMutex) { + this.missionLevel = missionLevel; + } } public String getMissionStartPlanet() { - return missionStartPlanet; - } - - public void setMissionStartPlanet(String missionStartPlanetCRC) { - this.missionStartPlanet = missionStartPlanetCRC; + synchronized(objectMutex) { + return missionStartPlanet; + } } public int getMissionRepeatCounter() { - return missionRepeatCounter; + synchronized(objectMutex) { + return missionRepeatCounter; + } } public void setMissionRepeatCounter(int missionRepeatCounter) { - this.missionRepeatCounter = missionRepeatCounter; + synchronized(objectMutex) { + this.missionRepeatCounter = missionRepeatCounter; + } } public int getMissionCredits() { - return missionCredits; + synchronized(objectMutex) { + return missionCredits; + } } public void setMissionCredits(int missionCredits) { - this.missionCredits = missionCredits; + synchronized(objectMutex) { + this.missionCredits = missionCredits; + } + notifyObservers(messageBuilder.buildCreditsRewardDelta(missionCredits), false); } public String getMissionCreator() { - return missionCreator; + synchronized(objectMutex) { + return missionCreator; + } } public void setMissionCreator(String missionCreator) { - this.missionCreator = missionCreator; + synchronized(objectMutex) { + this.missionCreator = missionCreator; + } + notifyObservers(messageBuilder.buildCreatorNameDelta(missionCreator), false); } public String getMissionDescription() { - return missionDescription; + synchronized(objectMutex) { + return missionDescription; + } } - public void setMissionDescription(String missionDescription) { - this.missionDescription = missionDescription; + public void setMissionDescription(String missionDescription, String id) { + synchronized(objectMutex) { + this.missionDescription = missionDescription; + this.missionDescId = id; + } + notifyObservers(messageBuilder.buildMissionDescriptionDelta(missionDescription, id), false); } public String getMissionTitle() { - return missionTitle; + synchronized(objectMutex) { + return missionTitle; + } } - public void setMissionTitle(String missionTitle) { - this.missionTitle = missionTitle; + public void setMissionTitle(String missionTitle, String id) { + synchronized(objectMutex) { + this.missionTitle = missionTitle; + this.missionTitleId = id; + } + notifyObservers(messageBuilder.buildMissionTitleDelta(missionTitle, id), false); } public String getMissionTargetName() { - return missionTargetName; + synchronized(objectMutex) { + return missionTargetName; + } } public void setMissionTargetName(String missionTargetName) { - this.missionTargetName = missionTargetName; + synchronized(objectMutex) { + this.missionTargetName = missionTargetName; + } + notifyObservers(messageBuilder.buildTargetNameDelta(missionTargetName), false); } public WaypointObject getMissionAttachedWaypoint() { - return missionAttachedWaypoint; + synchronized(objectMutex) { + return missionAttachedWaypoint; + } } public void setMissionAttachedWaypoint(WaypointObject missionAttachedWaypoint) { - this.missionAttachedWaypoint = missionAttachedWaypoint; + synchronized(objectMutex) { + this.missionAttachedWaypoint = missionAttachedWaypoint; + } } - public String getMissionTemplateObject() { - return missionTemplateObject; + public String getTargetTemplateObject() { + synchronized(objectMutex) { + return missionTemplateObject; + } } - public void setMissionTemplateObject(String missionTemplateObject) { - this.missionTemplateObject = missionTemplateObject; + public void setTargetTemplateObject(String missionTemplateObject) { + synchronized(objectMutex) { + this.missionTemplateObject = missionTemplateObject; + } + notifyObservers(messageBuilder.buildTargetObjectIffDelta(missionTemplateObject), false); } public String getMissionDescId() { - return missionDescId; - } - - public void setMissionDescId(String missionDescId) { - this.missionDescId = missionDescId; + synchronized(objectMutex) { + return missionDescId; + } } public String getMissionTitleId() { - return missionTitleId; - } - - public void setMissionTitleId(String missionTitleId) { - this.missionTitleId = missionTitleId; + synchronized(objectMutex) { + return missionTitleId; + } } public String getMissionType() { - return missionType; + synchronized(objectMutex) { + return missionType; + } } public void setMissionType(String missionType) { - this.missionType = missionType; + synchronized(objectMutex) { + this.missionType = missionType; + } + notifyObservers(messageBuilder.buildMissionTypeDelta(missionType), false); } public Transaction getTransaction() { diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 5298d0da..a4d45d4b 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -37,6 +37,7 @@ import engine.clients.Client; import engine.resources.common.CRC; import engine.resources.container.CreatureContainerPermissions; import engine.resources.container.CreaturePermissions; +import engine.resources.container.Traverser; import engine.resources.database.DatabaseConnection; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; @@ -44,7 +45,6 @@ import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import resources.common.*; - import protocol.swg.ClientCreateCharacter; import protocol.swg.ClientMfdStatusUpdateMessage; import protocol.swg.ClientRandomNameRequest; @@ -53,8 +53,8 @@ import protocol.swg.ClientVerifyAndLockNameRequest; import protocol.swg.ClientVerifyAndLockNameResponse; import protocol.swg.CreateCharacterSuccess; import protocol.swg.HeartBeatMessage; - import resources.objects.creature.CreatureObject; +import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; @@ -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) { @@ -264,6 +266,14 @@ public class CharacterService implements INetworkDispatch { object._add(datapad); object._add(bank); object._add(missionBag); + + /*for(int missionsAdded = 0; missionsAdded < 12; missionsAdded++) { + MissionObject mission = (MissionObject) core.objectService.createObject("object/mission/shared_mission_object.iff", object.getPlanet()); + + missionBag._add(mission); + Console.println("Added empty mission " + missionsAdded); + }*/ + TangibleObject backpack = (TangibleObject) core.objectService.createObject("object/tangible/wearables/backpack/shared_backpack_galactic_marine.iff", object.getPlanet()); inventory._add(backpack); //object.addObjectToEquipList(datapad); diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index 896f2525..60a6d7a0 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -1,6 +1,8 @@ package services; import java.nio.ByteOrder; +import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; @@ -17,6 +19,7 @@ import protocol.swg.objectControllerObjects.BuffBuilderStartMessage; import resources.common.BuffBuilder; import resources.common.Console; import resources.common.ObjControllerOpcodes; +import resources.common.Performance; import resources.objects.Buff; import resources.objects.BuffItem; import resources.objects.creature.CreatureObject; @@ -33,10 +36,15 @@ public class EntertainmentService implements INetworkDispatch { private NGECore core; private Vector buffBuilderSkills = new Vector(); + //FIXME: create a wrapper class for double key lookup maps + private HashMap performances = new HashMap(); + private HashMap danceMap = new HashMap(); public EntertainmentService(NGECore core) { this.core = core; populateSkillCaps(); + populatePerformanceTable(); + registerCommands(); } @Override @@ -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,15 @@ public class EntertainmentService implements INetworkDispatch { e.printStackTrace(); } } + + private void registerCommands() { + core.commandService.registerCommand("bandflourish"); + core.commandService.registerCommand("flourish"); + core.commandService.registerAlias("flo","flourish"); + core.commandService.registerCommand("groupdance"); + core.commandService.registerCommand("startdance"); + core.commandService.registerCommand("stopdance"); + } public void giveInspirationBuff(SWGObject reciever, Vector buffVector) { CreatureObject buffCreature = (CreatureObject) reciever; @@ -177,6 +247,49 @@ public class EntertainmentService implements INetworkDispatch { } + public int getDanceVisualId(String danceName) { + Performance p = performances.get(danceName); + + //if 0 , then it's no dance. need to handle that in the script. + return p.getDanceVisualId(); + } + + public Map getAvailableDances(CreatureObject actor) { + + Map dances = new HashMap(); + for (int index : danceMap.keySet()) { + if (!canDance(actor, danceMap.get(index) )) { continue; } + dances.put( new Long( danceMap.get(index).getDanceVisualId() ), danceMap.get(index).getPerformanceName() ); + } + + return dances; + + } + + public boolean isDance(int visualId) { + return ( danceMap.get(visualId) != null ) ; + } + + public boolean canDance(CreatureObject actor, Performance dance) { + if (actor.hasAbility(dance.getRequiredDance())) { + return true; + } + return false; + } + + public boolean canDance(CreatureObject actor, int visualId) { + if (!isDance(visualId)) { return false; } + return canDance(actor, danceMap.get(visualId)); + } + + public Performance getDance(int visualId) { + return danceMap.get(visualId); + } + + public Performance getPerformance(String name) { + return performances.get(name); + } + @Override public void shutdown() { diff --git a/src/services/MissionService.java b/src/services/MissionService.java index d376f698..4eaca9bb 100644 --- a/src/services/MissionService.java +++ b/src/services/MissionService.java @@ -21,29 +21,192 @@ ******************************************************************************/ package services; +import java.nio.ByteOrder; import java.util.Map; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; +import protocol.swg.objectControllerObjects.MissionListRequest; +import resources.common.Console; +import resources.common.TerminalType; import resources.common.ObjControllerOpcodes; +import resources.objects.creature.CreatureObject; +import resources.objects.mission.MissionObject; +import resources.objects.tangible.TangibleObject; +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.DatatableVisitor; +import engine.clients.Client; +import engine.resources.container.Traverser; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; public class MissionService implements INetworkDispatch { + private NGECore core; + + public MissionService(NGECore core) { + this.core = core; + } + @Override public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { objControllerOpcodes.put(ObjControllerOpcodes.MISSION_LIST_REQUEST, new INetworkRemoteEvent() { @Override public void handlePacket(IoSession session, IoBuffer data) throws Exception { + data.order(ByteOrder.LITTLE_ENDIAN); + + MissionListRequest request = new MissionListRequest(); + request.deserialize(data); + + Client client = core.getClient((Integer) session.getAttribute("connectionId")); + if(client == null || client.getSession() == null) + return; + + SWGObject object = client.getParent(); + + if(object == null) + return; + + SWGObject terminal = core.objectService.getObject(request.getTerminalId()); + + int terminalType = (int) terminal.getAttachment("terminalType"); + + if (terminalType == TerminalType.MISSION_GENERIC) { + populateMissions(core.objectService.getObject(request.getObjectId()), TerminalType.MISSION_GENERIC); + } else if (terminalType == TerminalType.MISSION_BOUNTYHUNTER) { + + } else if (terminalType == TerminalType.MISSION_ENTERTAINER) { + + } else if (terminalType == TerminalType.MISSION_ARTISAN) { + + } else { + Console.println("ERROR: Unsupported terminal " + terminal.getObjectId()); + } } }); } + + private void populateMissions(final SWGObject player, int type) { + CreatureObject creature = (CreatureObject) player; + TangibleObject missionBag = (TangibleObject) creature.getSlottedObject("mission_bag"); + + final AtomicInteger deliveryCount = new AtomicInteger(); + final AtomicInteger destroyCount = new AtomicInteger(); + final int deliveryEntries = 30; + + final Random ran = new Random(); + + final int bagSize = core.objectService.objsInContainer(creature, missionBag); + Console.println("Delivery Entries: " + deliveryEntries); + if (bagSize != 12) { + for(int missionsAdded = 0; missionsAdded < 12; missionsAdded++) { + MissionObject mission = (MissionObject) core.objectService.createObject("object/mission/shared_mission_object.iff", creature.getPlanet()); + + int textId = ran.nextInt(deliveryEntries); + + Console.println("Random Int Value: " + textId); + Console.println("Now the value is: " + textId); + + mission.setMissionLevel(5); + + mission.setMissionStart(0, 0, 0, player.getPlanet().name); + + mission.setMissionCreator("Waverunner"); + mission.setMissionCredits(9000); + + // TODO: Base this off of textId + f + mission.setTargetTemplateObject("object/tangible/mission/shared_mission_datadisk.iff"); + // TODO: Base this off of textId + l + mission.setMissionTargetName("Osskscosco"); + + mission.setMissionDescription("mission/mission_deliver_neutral_easy", "m" + textId + "d"); + mission.setMissionTitle("mission/mission_deliver_neutral_easy", "m" + textId + "t"); + + mission.setMissionType("deliver"); + + mission.setMissionDestination(-5962, 0, -6259, player.getPlanet().name); + deliveryCount.getAndIncrement(); + + + missionBag._add(mission); + Console.println("Added mission " + missionsAdded); + } + return; + } + + missionBag.viewChildren(player, false, false, new Traverser() { + + @Override + public void process(SWGObject child) { + if (deliveryCount.get() == 6) + return; + + MissionObject mission = (MissionObject) child; + int textId = ran.nextInt(deliveryEntries); + + Console.println("Random Int Value: " + textId); + Console.println("Now the value is: " + textId); + + mission.setMissionLevel(5); + + mission.setMissionStart(0, 0, 0, player.getPlanet().name); + + mission.setMissionCreator("Waverunner"); + mission.setMissionCredits(9000); + + // TODO: Base this off of textId + f + mission.setTargetTemplateObject("object/tangible/mission/shared_mission_datadisk.iff"); + // TODO: Base this off of textId + l + mission.setMissionTargetName("Osskscosco"); + + mission.setMissionDescription("mission/mission_deliver_neutral_easy", "m" + textId + "d"); + mission.setMissionTitle("mission/mission_deliver_neutral_easy", "m" + textId + "t"); + + mission.setMissionType("deliver"); + + mission.setMissionDestination(-5962, 0, -6259, player.getPlanet().name); + deliveryCount.getAndIncrement(); + } + + }); + + Console.println("Outside of the traverser now!"); + } + + // May want to create a map for the server with needed info + public int getNumberOfEntries(String stf) { + try { + DatatableVisitor stfFile = ClientFileManager.loadFile(stf, DatatableVisitor.class); + + for (int s = 0; s < stfFile.getRowCount(); s++) { + String name = ((String) stfFile.getObject(s, 3)); + Console.println("Name: " + name); + if (name.equals("number_of_entries")) { + int entryCount = ((int) stfFile.getObject(s, 4)); + Console.println("Entry Count: " + entryCount); + return entryCount; + } + } + } + catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + + return 0; + } + @Override public void shutdown() { diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 46c605e5..8bc4c37c 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -589,36 +589,9 @@ public class SimulationService implements INetworkDispatch { add(object, pos.x, pos.z, true); } - PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); - if (ghost != null) { - - String objectShortName = object.getCustomName().toLowerCase(); - - if (object.getCustomName().contains(" ")) { - String[] splitName = object.getCustomName().toLowerCase().split(" "); - objectShortName = splitName[0].toLowerCase(); - } - - core.chatService.playerStatusChange(objectShortName, (byte) 1); - - if (ghost.getFriendList().isEmpty() == false) { - // Find out what friends are online/offline - for (String friend : ghost.getFriendList()) { - SWGObject friendObject = (SWGObject) core.chatService.getObjectByFirstName(friend); - if (friendObject == null) - continue; - if(friendObject.isInQuadtree() == true) { - ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend, (byte) 1); - client.getSession().write(onlineNotifyStatus.serialize()); - - } else { - ChatOnChangeFriendStatus changeStatus = new ChatOnChangeFriendStatus(object.getObjectID(), friend, 0); - client.getSession().write(changeStatus.serialize()); - } - } - } - } + if(object.getParentId() == 0) + add(object, pos.x, pos.z); core.weatherService.sendWeather(object); 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/chat/ChatService.java b/src/services/chat/ChatService.java index 2d0c26c4..e9aa0576 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -74,6 +74,7 @@ public class ChatService implements INetworkDispatch { core.commandService.registerCommand("socialinternal"); core.commandService.registerCommand("addignore"); core.commandService.registerCommand("removeignore"); + core.commandService.registerCommand("findfriend"); mailODB = core.getMailODB(); } @@ -110,6 +111,10 @@ public class ChatService implements INetworkDispatch { for(Client client : observers) { float distance = client.getParent().getPosition().getDistance2D(position); if(client != null && client.getSession() != null && distance <= 80) { + + if(((PlayerObject)client.getParent().getSlottedObject("ghost")).getIgnoreList().contains(speaker.getCustomName().toLowerCase().split(" ")[0])) + continue; + spatialChat.setDestinationId(client.getParent().getObjectID()); ObjControllerMessage objControllerMessage2 = new ObjControllerMessage(0x0B, spatialChat); client.getSession().write(objControllerMessage2.serialize()); 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 859d770d..54514c4f 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..d02d5521 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -22,8 +22,11 @@ package services.command; import java.nio.ByteOrder; +import java.util.HashMap; import java.util.Map; import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; + import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; @@ -50,6 +53,8 @@ import resources.objects.weapon.WeaponObject; public class CommandService implements INetworkDispatch { private Vector commandLookup = new Vector(); + private ConcurrentHashMap aliases = new ConcurrentHashMap(); + private ConcurrentHashMap aliasesByCRC = new ConcurrentHashMap(); private NGECore core; public CommandService(NGECore core) { @@ -125,9 +130,28 @@ public class CommandService implements INetworkDispatch { return command; } + + public void registerAlias(String name, String target) { + Vector commands = new Vector(commandLookup); // copy for thread safety + BaseSWGCommand targetCommand = null; + for(BaseSWGCommand command : commands) { + if(command.getCommandName().equalsIgnoreCase(target)) { + targetCommand = command; + } + } + if (targetCommand == null) { return; } + + aliases.put(name, targetCommand); + aliasesByCRC.put(CRC.StringtoCRC(name), targetCommand); + + } public BaseSWGCommand getCommandByCRC(int CRC) { + if (aliasesByCRC.containsKey(CRC)) { + return aliasesByCRC.get(CRC); + } + Vector commands = new Vector(commandLookup); // copy for thread safety for(BaseSWGCommand command : commands) { @@ -140,6 +164,10 @@ public class CommandService implements INetworkDispatch { public BaseSWGCommand getCommandByName(String name) { + if (aliases.containsKey(name)) { + return aliases.get(name); + } + Vector commands = new Vector(commandLookup); // copy for thread safety for(BaseSWGCommand command : commands) { @@ -256,7 +284,7 @@ public class CommandService implements INetworkDispatch { } - public void callCommand(CreatureObject actor, String commandName, SWGObject target, String commandArgs) { + public void callCommand(SWGObject actor, String commandName, SWGObject target, String commandArgs) { if (actor == null) return; diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java 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 3ffae4e9..146859a9 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; @@ -36,6 +37,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import resources.common.*; @@ -47,6 +49,8 @@ import org.python.core.PyObject; import com.sleepycat.persist.EntityCursor; +import protocol.swg.ChatFriendsListUpdate; +import protocol.swg.ChatOnChangeFriendStatus; import protocol.swg.ChatOnGetFriendsList; import protocol.swg.CmdSceneReady; import protocol.swg.CmdStartScene; @@ -219,7 +223,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); @@ -276,10 +280,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) { @@ -351,18 +357,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; } @@ -456,10 +450,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)); } } } @@ -566,6 +566,35 @@ public class ObjectService implements INetworkDispatch { ChatOnGetFriendsList friendsListMessage = new ChatOnGetFriendsList(ghost); client.getSession().write(friendsListMessage.serialize()); + if (ghost != null) { + + String objectShortName = creature.getCustomName().toLowerCase(); + + if (creature.getCustomName().contains(" ")) { + String[] splitName = creature.getCustomName().toLowerCase().split(" "); + objectShortName = splitName[0].toLowerCase(); + } + + core.chatService.playerStatusChange(objectShortName, (byte) 1); + + if (ghost.getFriendList().isEmpty() == false) { + // Find out what friends are online/offline + for (String friend : ghost.getFriendList()) { + SWGObject friendObject = (SWGObject) core.chatService.getObjectByFirstName(friend); + if (friendObject == null) + continue; + if(friendObject.isInQuadtree() == true) { + ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend, (byte) 1); + client.getSession().write(onlineNotifyStatus.serialize()); + + } else { + ChatOnChangeFriendStatus changeStatus = new ChatOnChangeFriendStatus(creature.getObjectID(), friend, 0); + client.getSession().write(changeStatus.serialize()); + } + } + } + } + core.playerService.postZoneIn(creature); } @@ -740,5 +769,24 @@ public class ObjectService implements INetworkDispatch { } - + public int objsInContainer(SWGObject owner, TangibleObject container) { + if (owner == null) { + Console.println("Owner null!"); + } + if (container == null) { + Console.println("Container is null!"); + } + final AtomicInteger count = new AtomicInteger(); + + container.viewChildren(owner, false, false, new Traverser() { + + @Override + public void process(SWGObject child) { + count.getAndIncrement(); + } + + }); + + return count.get(); + } } diff --git a/src/services/travel/TravelService.java b/src/services/travel/TravelService.java index 956c34ca..8ab347ca 100644 --- a/src/services/travel/TravelService.java +++ b/src/services/travel/TravelService.java @@ -114,11 +114,14 @@ public class TravelService implements INetworkDispatch { Vector correctTravelPoints = new Vector(); for(TravelPoint tp : travelMap.get(planet)) { - if(tp.isStarport() || tp.getPlanetName().equalsIgnoreCase(object.getPlanet().getName())) + if(tp.isStarport() || tp.getPlanetName().equalsIgnoreCase(object.getPlanet().getName())) { correctTravelPoints.add(tp); + //Console.println(tp.getName()); + } } PlanetTravelPointListResponse response = new PlanetTravelPointListResponse(planetString, correctTravelPoints); client.getSession().write(response.serialize()); + break; } @@ -227,7 +230,7 @@ public class TravelService implements INetworkDispatch { Planet planet = core.terrainService.getPlanetByName(departurePlanet.toLowerCase()); SWGObject travelTicket = core.objectService.createObject("object/tangible/travel/travel_ticket/base/shared_base_travel_ticket.iff", planet); - + travelTicket.setStringAttribute("@obj_attr_n:travel_departure_planet", WordUtils.capitalize(departurePlanet)); travelTicket.setStringAttribute("@obj_attr_n:travel_departure_point", departureLoc); @@ -271,7 +274,7 @@ public class TravelService implements INetworkDispatch { creatureObj.getSlottedObject("inventory").add(travelTicket); //Console.println("Total cost: " + fare); - SUIWindow window = core.suiService.createMessageBox(MessageBoxType.MESSAGE_BOX_OK, "STAR WARS GALAXIES", "Ticket purchase complete.", player, null, 0); + SUIWindow window = core.suiService.createMessageBox(MessageBoxType.MESSAGE_BOX_OK, "STAR WARS GALAXIES", "@travel:ticket_purchase_complete", player, null, 0); core.suiService.openSUIWindow(window); creatureObj.sendSystemMessage("You successfully make a payment of " + fare + " credits to the Galactic Travel Commission.", (byte) 0); @@ -364,7 +367,7 @@ public class TravelService implements INetworkDispatch { for (int f = 0; f < travelFares.getRowCount(); f++) { Planet planet = core.terrainService.getPlanetByName((String) travelFares.getObject(f, 0)); if (travelMap.containsKey(planet)) { - int corellia = ((Integer) travelFares.getObject(f, 1)); + int corellia = ((int) travelFares.getObject(f, 1)); int dantooine = ((int) travelFares.getObject(f, 2)); int dathomir = ((int) travelFares.getObject(f, 3)); int endor = ((int) travelFares.getObject(f, 4));