diff --git a/.gitignore b/.gitignore index 0b643352..8c1860c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,217 +1,225 @@ -################# -## Eclipse -################# - -*.pydevproject -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.pkc -*.swp -*~.nib -local.properties -.settings/ -.loadpath -*.ltn -*.pln -*.lsb -pt_sword_glint -*.lod -*.msh -*.mesh -*.iff -*.pob -*.ws -*.trn -*.tga -*.lmg -*.sat -*.lay -*.flr -*.apt -*.prt -*.cfg -*.spr -*.swh -*.jdb -*.lck -*.mgn -*.0 -cachedir/ -appearance/ -clientdata/ -*.class - -# SWG Client Folders -footprint/ -interiorlayout/ -clientdata/quest/ - -# PSWG Object Databases -odb/building/je.info.* -odb/creature/je.info.* -odb/doids/je.info.* -odb/guild/je.info.* -odb/mails/je.info.* -odb/oids/je.info.* -odb/chatRooms/je.info.* -odb/resourcehistory/je.info.* -odb/resourceroots/je.info.* -odb/resources/je.info.* +################# +## Eclipse +################# + +*.pydevproject +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.pkc +*.swp +*~.nib +local.properties +.settings/ +.loadpath +*.ltn +*.pln +*.lsb +pt_sword_glint +*.lod +*.msh +*.mesh +*.iff +*.pob +*.ws +*.trn +*.tga +*.lmg +*.sat +*.lay +*.flr +*.apt +*.prt +*.cfg +*.spr +*.swh +*.jdb +*.lck +*.mgn +*.0 +cachedir/ +appearance/ +clientdata/ +*.class + +# SWG Client Folders +footprint/ +interiorlayout/ +clientdata/quest/ + +# PSWG Object Databases +odb/building/je.info.* +odb/creature/je.info.* +odb/doids/je.info.* +odb/guild/je.info.* +odb/mails/je.info.* +odb/oids/je.info.* +odb/chatRooms/je.info.* +odb/resourcehistory/je.info.* +odb/resourceroots/je.info.* +odb/resources/je.info.* +<<<<<<< HEAD odb/auction/je.info.* -odb/bounties/je.info.* -odb/swgobjects/je.info.* - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -.builds -*.dotCover - -## TODO: If you have NuGet Package Restore enabled, uncomment this -#packages/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store - - -############# -## PyCharm -############# -.idea +odb/swgobjects/je.info.* +======= +odb/auction/je.info.* +odb/bounties/je.info.* +<<<<<<< HEAD +odb/swgobjects/je.info.* +======= +>>>>>>> 12ca3ae66170fcfe09d848a7eea529041b9af5ad +>>>>>>> origin/master + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store + + +############# +## PyCharm +############# +.idea diff --git a/.project b/.project index 5c73c250..d1bd5e27 100644 --- a/.project +++ b/.project @@ -5,6 +5,11 @@ + + org.python.pydev.PyDevBuilder + + + org.eclipse.jdt.core.javabuilder @@ -13,5 +18,6 @@ org.eclipse.jdt.core.javanature + org.python.pydev.pythonNature diff --git a/ngengine_public.jar b/ngengine_public.jar index a78a6cba..c5451df1 100644 Binary files a/ngengine_public.jar and b/ngengine_public.jar differ diff --git a/scripts/buffs/drink_breath_of_heaven.py b/scripts/buffs/drink_breath_of_heaven.py new file mode 100644 index 00000000..34ee2c0a --- /dev/null +++ b/scripts/buffs/drink_breath_of_heaven.py @@ -0,0 +1,14 @@ +import sys + +def setup(core, actor, buff): + return + +def add(core, actor, buff): + core.skillModService.addSkillMod(actor, 'constitution_modified', 80) + core.skillModService.addSkillMod(actor, 'expertise_dodge', 3) + return + +def remove(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'constitution_modified', 80) + core.skillModService.deductSkillMod(actor, 'expertise_dodge', 3) + return diff --git a/scripts/commands/grantzoningrights.py b/scripts/commands/grantzoningrights.py new file mode 100644 index 00000000..21cbbb8d --- /dev/null +++ b/scripts/commands/grantzoningrights.py @@ -0,0 +1,40 @@ +import sys +from java.lang import System +from resources.common import OutOfBand +from resources.common import ProsePackage +import main.NGECore + +def setup(): + return + +def run(core, actor, target, commandString): + + if target == None: + return + + #if !actor.hasSkill('Politician'): + #You must be a Politician to enable city zoning. + #actor.sendSystemMessage('@city/city:zoning_skill', 0) + #return + + thisCity = main.NGECore.getInstance().playerCityService.getCityObjectIsIn(actor) + + if thisCity == None: + #not_in_city_limits + actor.sendSystemMessage('@city/city:not_in_city_limits', 0) + return + + if thisCity.getMayorID()!=actor.getObjectID() and not thisCity.isMilitiaMember(actor.getObjectID()): + #You must be the mayor of the city or a member of the city militia to grant zoning rights. + actor.sendSystemMessage('@city/city:grant_rights_fail', 0) + actor.sendSystemMessage('thisCity.getMayorID() %s' % thisCity.getMayorID(), 0) + actor.sendSystemMessage('actor.getObjectID() %s' % actor.getObjectID(), 0) + return + + #You have granted %TO zoning rights for 24 hours. + actor.sendSystemMessage(OutOfBand.ProsePackage("@city/city:rights_granted_self", "TO", target.getCustomName()), 0) + target.setAttachment('Has24HZoningFor',thisCity.getCityID()) + target.setAttachment('Has24HZoningUntil',System.currentTimeMillis()+60*60*24) + target.sendSystemMessage(OutOfBand.ProsePackage("@city/city:rights_granted", "TO", thisCity.getCityName()), 0) + + return \ No newline at end of file diff --git a/scripts/commands/pvp.py b/scripts/commands/pvp.py index 1260a24c..c313fbc4 100644 --- a/scripts/commands/pvp.py +++ b/scripts/commands/pvp.py @@ -48,30 +48,30 @@ def run(core, actor, target, commandString): if factionStatus == FactionStatus.OnLeave: actor.sendSystemMessage('@faction_recruiter:on_leave_to_covert', 0) - #actor.setPvpStatus(PvpStatus.GoingCovert, True) + actor.setPvpStatus(PvpStatus.GoingCovert, True) time.sleep(1) actor.setFactionStatus(FactionStatus.Combatant) - #actor.setPvpStatus(PvpStatus.GoingCovert, False) + actor.setPvpStatus(PvpStatus.GoingCovert, False) actor.sendSystemMessage('@faction_recruiter:covert_complete', 0) actor.updatePvpStatus() return if factionStatus == FactionStatus.Combatant: actor.sendSystemMessage('@faction_recruiter:covert_to_overt', 0) - #actor.setPvpStatus(PvpStatus.GoingOvert, True) + actor.setPvpStatus(PvpStatus.GoingOvert, True) time.sleep(30) actor.setFactionStatus(FactionStatus.SpecialForces) - #actor.setPvpStatus(PvpStatus.GoingOvert, False) + actor.setPvpStatus(PvpStatus.GoingOvert, False) actor.sendSystemMessage('@faction_recruiter:overt_complete', 0) actor.updatePvpStatus() return if factionStatus == FactionStatus.SpecialForces: actor.sendSystemMessage('@faction_recruiter:overt_to_covert', 0) - #actor.setPvpStatus(PvpStatus.GoingCovert, True) + actor.setPvpStatus(PvpStatus.GoingCovert, True) time.sleep(300) actor.setFactionStatus(FactionStatus.Combatant) - #actor.setPvpStatus(PvpStatus.GoingCovert, False) + actor.setPvpStatus(PvpStatus.GoingCovert, False) actor.sendSystemMessage('@faction_recruiter:covert_complete', 0) actor.updatePvpStatus() return diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 63019d92..b0e78d52 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -113,11 +113,8 @@ def run(core, actor, target, commandString): actor.removeAbility("admin") playerObject.setGodLevel(0) - elif command == 'setBounty' and arg1: - if not core.missionService.addToExistingBounty(actor, int(arg1)): - core.missionService.createNewBounty(actor, int(arg1)) - - actor.sendSystemMessage('Your bounty has been set to an additional ' + str(arg1) + ' credits.', 0) + elif command == 'setBounty': + core.playerService.sendSetBountyWindow(actor, actor) return return diff --git a/scripts/conversation/byxle.py b/scripts/conversation/byxle.py new file mode 100644 index 00000000..71c08205 --- /dev/null +++ b/scripts/conversation/byxle.py @@ -0,0 +1,15 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_byxle', 's_48') + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_byxle', 's_48') + return \ No newline at end of file diff --git a/scripts/conversation/dunir.py b/scripts/conversation/dunir.py new file mode 100644 index 00000000..189e1748 --- /dev/null +++ b/scripts/conversation/dunir.py @@ -0,0 +1,15 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_dunir', 's_37') + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_dunir', 's_37') + return \ No newline at end of file diff --git a/scripts/conversation/gendra.py b/scripts/conversation/gendra.py new file mode 100644 index 00000000..25277b59 --- /dev/null +++ b/scripts/conversation/gendra.py @@ -0,0 +1,15 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_gendra', 's_99') + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_gendra', 's_99') + return \ No newline at end of file diff --git a/scripts/conversation/imp_recruiter.py b/scripts/conversation/imp_recruiter.py index 399294b1..7659eb4b 100644 --- a/scripts/conversation/imp_recruiter.py +++ b/scripts/conversation/imp_recruiter.py @@ -546,7 +546,7 @@ def handleSecondScreen(core, actor, npc, selection): def handleThirdScreen(core, actor, npc, selection): if selection == 0: core.conversationService.sendStopConversation(actor, npc, 'conversation/faction_recruiter_imperial', 's_94') - actor.setFaction('neutral') + actor.setFaction('') return if selection == 1: diff --git a/scripts/conversation/mayor_mikdanyel_guhrantt.py b/scripts/conversation/mayor_mikdanyel_guhrantt.py new file mode 100644 index 00000000..32d86b84 --- /dev/null +++ b/scripts/conversation/mayor_mikdanyel_guhrantt.py @@ -0,0 +1,15 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + core.conversationService.sendStopConversation(actor, npc, 'conversation/mos_eisley_mayor', 's_117') + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, 'conversation/mos_eisley_mayor', 's_117') + return \ No newline at end of file diff --git a/scripts/conversation/missions/bounty_droid_probot.py b/scripts/conversation/missions/bounty_droid_probot.py new file mode 100644 index 00000000..ea327232 --- /dev/null +++ b/scripts/conversation/missions/bounty_droid_probot.py @@ -0,0 +1,70 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import time +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + probotRequester = core.objectService.getObject(long(npc.getAttachment('probotRequester'))) + + if probotRequester is None: + core.objectService.destroyObject(npc) + return + + if probotRequester.getObjectId() != actor.getObjectId(): + prose = ProsePackage('conversation/bounty_probot', 's_6') + outOfBand = OutOfBand() + outOfBand.addProsePackage(prose) + convSvc.sendConversationMessage(actor, npc, outOfBand) + return + + mission = core.objectService.getObject(long(npc.getAttachment('attachedMission'))) + + if mission is None: + prose = ProsePackage('conversation/bounty_probot', 's_4') + outOfBand = OutOfBand() + outOfBand.addProsePackage(prose) + convSvc.sendConversationMessage(actor, npc, prose) + return + + objective = mission.getObjective() + + if objective is None: + prose = ProsePackage('conversation/bounty_probot', 's_4') + outOfBand = OutOfBand() + outOfBand.addProsePackage(prose) + convSvc.sendConversationMessage(actor, npc, prose) + return + + prose = ProsePackage('conversation/bounty_probot', 's_5') + outOfBand = OutOfBand() + outOfBand.addProsePackage(prose) + convSvc.sendConversationMessage(actor, npc, outOfBand) + + options = Vector() + optionProse = ProsePackage('conversation/bounty_probot', 's_8') + optionOOB = OutOfBand() + optionOOB.addProsePackage(optionProse) + options.add(ConversationOption(optionOOB, 0)) + convSvc.sendConversationOptions(actor, npc, options, handleBioTransmit) + + return + +def handleBioTransmit(core, actor, npc, selection): + core.conversationService.handleEndConversation(actor, npc) + actor.sendSystemMessage('@mission/mission_generic:probe_droid_takeoff', 0) + + npc.setPosture(8) + + time.sleep(7) + objective = core.objectService.getObject(long(npc.getAttachment('attachedMission'))).getObjective() + objective.beginArakydUpdate(actor) + core.objectService.destroyObject(npc) + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, '', '') + return diff --git a/scripts/conversation/niko.py b/scripts/conversation/niko.py new file mode 100644 index 00000000..87e9d576 --- /dev/null +++ b/scripts/conversation/niko.py @@ -0,0 +1,15 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_niko', 's_71') + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_niko', 's_71') + return \ No newline at end of file diff --git a/scripts/conversation/reb_recruiter.py b/scripts/conversation/reb_recruiter.py index 9c8b803d..6cc16459 100644 --- a/scripts/conversation/reb_recruiter.py +++ b/scripts/conversation/reb_recruiter.py @@ -315,7 +315,7 @@ def handleSecondScreen(core, actor, npc, selection): if actor.getFaction() != 'rebel' and actor.getFaction() != 'imperial': if selection == 0: - actor.setFaction('imperial') + actor.setFaction('rebel') actor.setFactionStatus(FactionStatus.OnLeave) prose = ProsePackage('conversation/faction_recruiter_rebel', 's_99') @@ -546,7 +546,7 @@ def handleSecondScreen(core, actor, npc, selection): def handleThirdScreen(core, actor, npc, selection): if selection == 0: core.conversationService.sendStopConversation(actor, npc, 'conversation/faction_recruiter_rebel', 's_58') - actor.setFaction('neutral') + actor.setFaction('') return if selection == 1: diff --git a/scripts/conversation/reimos.py b/scripts/conversation/reimos.py new file mode 100644 index 00000000..dcc7a6e1 --- /dev/null +++ b/scripts/conversation/reimos.py @@ -0,0 +1,15 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_reimos_v2', 's_36') + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_reimos_v2', 's_36') + return \ No newline at end of file diff --git a/scripts/conversation/toggi.py b/scripts/conversation/toggi.py new file mode 100644 index 00000000..0654f9c3 --- /dev/null +++ b/scripts/conversation/toggi.py @@ -0,0 +1,15 @@ +from resources.common import ConversationOption +from resources.common import OutOfBand +from resources.common import ProsePackage +from java.util import Vector +import sys + +def startConversation(core, actor, npc): + convSvc = core.conversationService + + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_toggi', 's_4') + return + +def endConversation(core, actor, npc): + core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_toggi', 's_4') + return \ No newline at end of file diff --git a/scripts/expertise/expertise_of_medical_sup_1.py b/scripts/expertise/expertise_of_medical_sup_1.py index fe15a79d..3b3e1915 100644 --- a/scripts/expertise/expertise_of_medical_sup_1.py +++ b/scripts/expertise/expertise_of_medical_sup_1.py @@ -1,17 +1,17 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 10: + if actor.getLevel() >= 18: actor.addAbility("of_medical_sup_1") - if actor.getLevel() >= 34: + if actor.getLevel() >= 30: actor.addAbility("of_medical_sup_2") - if actor.getLevel() >= 48: + if actor.getLevel() >= 44: actor.addAbility("of_medical_sup_3") - if actor.getLevel() >= 62: + if actor.getLevel() >= 58: actor.addAbility("of_medical_sup_4") - if actor.getLevel() >= 76: + if actor.getLevel() >= 72: actor.addAbility("of_medical_sup_5") - if actor.getLevel() >= 90: + if actor.getLevel() >= 86: actor.addAbility("of_medical_sup_6") return diff --git a/scripts/expertise/expertise_sm_general_bad_odds_1.py b/scripts/expertise/expertise_sm_general_bad_odds_1.py index fa70a2fc..5435e2e9 100644 --- a/scripts/expertise/expertise_sm_general_bad_odds_1.py +++ b/scripts/expertise/expertise_sm_general_bad_odds_1.py @@ -1,15 +1,15 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 26: - actor.addAbility("sm_bad_odds_1") if actor.getLevel() >= 34: + actor.addAbility("sm_bad_odds_1") + if actor.getLevel() >= 46: actor.addAbility("sm_bad_odds_2") - if actor.getLevel() >= 48: + if actor.getLevel() >= 58: actor.addAbility("sm_bad_odds_3") - if actor.getLevel() >= 62: + if actor.getLevel() >= 74: actor.addAbility("sm_bad_odds_4") - if actor.getLevel() >= 76: + if actor.getLevel() >= 84: actor.addAbility("sm_bad_odds_5") return diff --git a/scripts/expertise/expertise_sm_path_shoot_first_1.py b/scripts/expertise/expertise_sm_path_shoot_first_1.py index 3cfcce30..3dbc049f 100644 --- a/scripts/expertise/expertise_sm_path_shoot_first_1.py +++ b/scripts/expertise/expertise_sm_path_shoot_first_1.py @@ -1,15 +1,15 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 26: - actor.addAbility("sm_shoot_first_1") if actor.getLevel() >= 34: + actor.addAbility("sm_shoot_first_1") + if actor.getLevel() >= 46: actor.addAbility("sm_shoot_first_2") - if actor.getLevel() >= 48: - actor.addAbility("sm_shoot_first_3") if actor.getLevel() >= 62: + actor.addAbility("sm_shoot_first_3") + if actor.getLevel() >= 74: actor.addAbility("sm_shoot_first_4") - if actor.getLevel() >= 76: + if actor.getLevel() >= 90: actor.addAbility("sm_shoot_first_5") return diff --git a/scripts/houses/player_garden_tatooine_sml_01.py b/scripts/houses/player_garden_tatooine_sml_01.py new file mode 100644 index 00000000..ed3b2981 --- /dev/null +++ b/scripts/houses/player_garden_tatooine_sml_01.py @@ -0,0 +1,15 @@ +import sys +from services.housing import HouseTemplate +from engine.resources.scene import Point3D + +def setup(housingTemplates): + houseTemplate = HouseTemplate("object/tangible/deed/city_deed/shared_garden_tatooine_sml_01_deed.iff", "object/building/player/city/shared_garden_tatooine_sml_01.iff", 0) + + houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3)) + houseTemplate.addPlaceablePlanet("tatooine") + houseTemplate.addPlaceablePlanet("dantooine") + houseTemplate.addPlaceablePlanet("lok") + houseTemplate.setDefaultItemLimit(0) + + housingTemplates.put(houseTemplate.getDeedTemplate(), houseTemplate) + return \ No newline at end of file diff --git a/scripts/houses/player_shuttleport_tatooine.py b/scripts/houses/player_shuttleport_tatooine.py new file mode 100644 index 00000000..4d7e480f --- /dev/null +++ b/scripts/houses/player_shuttleport_tatooine.py @@ -0,0 +1,12 @@ +import sys +from services.housing import HouseTemplate +from engine.resources.scene import Point3D + +def setup(housingTemplates): + houseTemplate = HouseTemplate("object/tangible/deed/city_deed/shared_shuttleport_tatooine_deed.iff", "object/building/tatooine/shared_shuttleport_tatooine.iff", 1) + + houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(3.5),float(-0.3),float(3.5))) + houseTemplate.addPlaceablePlanet("tatooine") + houseTemplate.setDefaultItemLimit(0) + housingTemplates.put(houseTemplate.getDeedTemplate(), houseTemplate) + return \ No newline at end of file diff --git a/scripts/mobiles/dantooine/dark_adept.py b/scripts/mobiles/dantooine/dark_adept.py new file mode 100644 index 00000000..fd56213d --- /dev/null +++ b/scripts/mobiles/dantooine/dark_adept.py @@ -0,0 +1,42 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('dark_adept') + mobileTemplate.setLevel(70) + mobileTemplate.setMinLevel(60) + mobileTemplate.setMaxLevel(70) + mobileTemplate.setDifficulty(1) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(9) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(True) + mobileTemplate.setSocialGroup('dark jedi') + mobileTemplate.setAssistRange(12) + + + templates = Vector() + templates.add('object/mobile/shared_dressed_dark_jedi_elder_male_human_01.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff', 9, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff', 10, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff', 11, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('saberHit') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('dark_adept', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/dark_force_crystal_hunter.py b/scripts/mobiles/dantooine/dark_force_crystal_hunter.py new file mode 100644 index 00000000..09b3c0f3 --- /dev/null +++ b/scripts/mobiles/dantooine/dark_force_crystal_hunter.py @@ -0,0 +1,37 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('dark_force_crystal_hunter') + mobileTemplate.setLevel(90) + mobileTemplate.setMinLevel(60) + mobileTemplate.setMaxLevel(69) + mobileTemplate.setDifficulty(0) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(4) + mobileTemplate.setMinSpawnDistance(2) + mobileTemplate.setMaxSpawnDistance(4) + mobileTemplate.setDeathblow(True) + mobileTemplate.setSocialGroup('remnants of kun') + mobileTemplate.setAssistRange(12) + + templates = Vector() + templates.add('object/mobile/shared_dressed_dark_force_crystal_hunter.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/sword/shared_sword_01.iff', 4, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('meleehit') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('dark_force_crystal_hunter', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/dark_jedi_knight.py b/scripts/mobiles/dantooine/dark_jedi_knight.py new file mode 100644 index 00000000..bcd26a26 --- /dev/null +++ b/scripts/mobiles/dantooine/dark_jedi_knight.py @@ -0,0 +1,64 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('dark_jedi_knight') + mobileTemplate.setLevel(90) + mobileTemplate.setMinLevel(62) + mobileTemplate.setMaxLevel(70) + mobileTemplate.setDifficulty(1) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(9) + mobileTemplate.setMinSpawnDistance(3) + mobileTemplate.setMaxSpawnDistance(5) + mobileTemplate.setDeathblow(True) + mobileTemplate.setSocialGroup('dark jedi') + mobileTemplate.setAssistRange(12) + + templates = Vector() + templates.add('object/mobile/shared_dressed_dark_jedi_male_human_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_human_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_human_03.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_human_04.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_human_05.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_human_06.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_twk_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_twk_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_twk_03.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_zab_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_zab_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_male_zab_03.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_human_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_human_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_human_03.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_human_04.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_twk_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_twk_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_twk_03.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_zab_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_zab_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_female_zab_03.iff') + + + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff', 9, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff', 10, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff', 11, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('saberHit') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('dark_jedi_knight', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/dark_jedi_master.py b/scripts/mobiles/dantooine/dark_jedi_master.py new file mode 100644 index 00000000..6d6566ae --- /dev/null +++ b/scripts/mobiles/dantooine/dark_jedi_master.py @@ -0,0 +1,46 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('dark_jedi_master') + mobileTemplate.setLevel(90) + mobileTemplate.setDifficulty(2) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(9) + mobileTemplate.setMinSpawnDistance(3) + mobileTemplate.setMaxSpawnDistance(5) + mobileTemplate.setDeathblow(True) + mobileTemplate.setSocialGroup('dark jedi') + mobileTemplate.setAssistRange(12) + + templates = Vector() + templates.add('object/mobile/shared_dressed_dark_jedi_master_female_twk_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_master_female_twk_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_master_female_zab_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_master_female_zab_02.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_master_male_human_01.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_master_male_human_04.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_master_male_human_05.iff') + templates.add('object/mobile/shared_dressed_dark_jedi_master_male_human_06.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff', 9, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff', 10, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff', 11, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('saberHit') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('dark_jedi_master', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/dark_side_savage.py b/scripts/mobiles/dantooine/dark_side_savage.py new file mode 100644 index 00000000..9f8138f1 --- /dev/null +++ b/scripts/mobiles/dantooine/dark_side_savage.py @@ -0,0 +1,34 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('eow_dark_side_savage') + mobileTemplate.setLevel(85) + mobileTemplate.setDifficulty(0) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(2) + mobileTemplate.setMaxSpawnDistance(4) + mobileTemplate.setDeathblow(False) + mobileTemplate.setSocialGroup('remnants of kun') + + templates = Vector() + templates.add('object/mobile/shared_dressed_dark_side_savage.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('creatureMeleeAttack') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('dark_side_savage', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/force_sensitive_crypt_crawler.py b/scripts/mobiles/dantooine/force_sensitive_crypt_crawler.py new file mode 100644 index 00000000..bbbf90f5 --- /dev/null +++ b/scripts/mobiles/dantooine/force_sensitive_crypt_crawler.py @@ -0,0 +1,36 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('eow_force_sensitive_crypt_crawler') + mobileTemplate.setLevel(90) + mobileTemplate.setMinLevel(60) + mobileTemplate.setMaxLevel(70) + mobileTemplate.setDifficulty(0) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(7) + mobileTemplate.setMinSpawnDistance(3) + mobileTemplate.setMaxSpawnDistance(5) + mobileTemplate.setDeathblow(False) + mobileTemplate.setSocialGroup('remnants of kun') + + templates = Vector() + templates.add('object/mobile/shared_dressed_force_sensitive_crypt_crawler.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/polearm/shared_lance_staff_wood_s1.iff', 7, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('meleehit') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('force_sensitive_crypt_crawler', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/force_sensitive_renegade.py b/scripts/mobiles/dantooine/force_sensitive_renegade.py new file mode 100644 index 00000000..1efb1591 --- /dev/null +++ b/scripts/mobiles/dantooine/force_sensitive_renegade.py @@ -0,0 +1,37 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('force_sensitive_renegade') + mobileTemplate.setLevel(90) + mobileTemplate.setMinLevel(61) + mobileTemplate.setMaxLevel(69) + mobileTemplate.setDifficulty(0) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(7) + mobileTemplate.setDeathblow(False) + mobileTemplate.setSocialGroup('force renegade') + + + templates = Vector() + templates.add('object/mobile/shared_dressed_force_sensitive_renegade.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('creatureMeleeAttack') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('force_sensitive_renegade', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/forsaken_force_drifter.py b/scripts/mobiles/dantooine/forsaken_force_drifter.py new file mode 100644 index 00000000..3cb43224 --- /dev/null +++ b/scripts/mobiles/dantooine/forsaken_force_drifter.py @@ -0,0 +1,34 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('eow_forsaken_force_drifter') + mobileTemplate.setLevel(74) + mobileTemplate.setDifficulty(0) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(3) + mobileTemplate.setMaxSpawnDistance(6) + mobileTemplate.setDeathblow(False) + mobileTemplate.setSocialGroup('force renegade') + + templates = Vector() + templates.add('object/mobile/shared_dressed_forsaken_force_drifter.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('creatureMeleeAttack') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('forsaken_force_drifter', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/novice_force_mystic.py b/scripts/mobiles/dantooine/novice_force_mystic.py new file mode 100644 index 00000000..b034a3ae --- /dev/null +++ b/scripts/mobiles/dantooine/novice_force_mystic.py @@ -0,0 +1,34 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('novice_force_mystic') + mobileTemplate.setLevel(63) + mobileTemplate.setDifficulty(0) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(4) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(7) + mobileTemplate.setDeathblow(False) + mobileTemplate.setSocialGroup('force renegade') + + templates = Vector() + templates.add('object/mobile/shared_dressed_novice_force_mystic.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/sword/shared_sword_01.iff', 4, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('meleehit') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('novice_force_mystic', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dantooine/untrained_wielder_of_the_dark_side.py b/scripts/mobiles/dantooine/untrained_wielder_of_the_dark_side.py new file mode 100644 index 00000000..dacb0620 --- /dev/null +++ b/scripts/mobiles/dantooine/untrained_wielder_of_the_dark_side.py @@ -0,0 +1,37 @@ +import sys +from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate +from java.util import Vector + +def addTemplate(core): + mobileTemplate = MobileTemplate() + + mobileTemplate.setCreatureName('untrained_wielder_of_the_dark_side') + mobileTemplate.setLevel(90) + mobileTemplate.setMinLevel(61) + mobileTemplate.setMaxLevel(70) + mobileTemplate.setDifficulty(0) + mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(4) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(6) + mobileTemplate.setDeathblow(False) + mobileTemplate.setSocialGroup('remnants of kun') + mobileTemplate.setAssistRange(12) + + templates = Vector() + templates.add('object/mobile/shared_dressed_untrained_wielder_of_the_darkside.iff') + mobileTemplate.setTemplates(templates) + + weaponTemplates = Vector() + weapontemplate = WeaponTemplate('object/weapon/melee/sword/shared_sword_01.iff', 4, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + + attacks = Vector() + mobileTemplate.setDefaultAttack('meleehit') + mobileTemplate.setAttacks(attacks) + + core.spawnService.addMobileTemplate('untrained_wielder_of_the_dark_side', mobileTemplate) + \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/adolescent_krayt_wild_1.py b/scripts/mobiles/dynamicgroups/adolescent_krayt_wild_1.py new file mode 100644 index 00000000..69f920a2 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/adolescent_krayt_wild_1.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('adolescent_krayt_dragon') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('adolescent_krayt_wild_1') + dynamicGroup.setMaxSpawns(15) + dynamicGroup.setMinSpawnDistance(150) + core.spawnService.addDynamicGroup('adolescent_krayt_wild_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/canyon_krayt_wild_1.py b/scripts/mobiles/dynamicgroups/canyon_krayt_wild_1.py new file mode 100644 index 00000000..b793b4e1 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/canyon_krayt_wild_1.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('canyon_krayt_dragon') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('canyon_krayt_wild_1') + dynamicGroup.setMaxSpawns(15) + dynamicGroup.setMinSpawnDistance(150) + core.spawnService.addDynamicGroup('canyon_krayt_wild_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/dark_jedi_wild_1.py b/scripts/mobiles/dynamicgroups/dark_jedi_wild_1.py new file mode 100644 index 00000000..3bf8c043 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/dark_jedi_wild_1.py @@ -0,0 +1,18 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('dark_jedi_master') + mobileTemplates.add('dark_jedi_knight') + mobileTemplates.add('dark_adept') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(3) + dynamicGroup.setName('dark_jedi_wild_1') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(150) + core.spawnService.addDynamicGroup('dark_jedi_wild_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/force_sensitives_wild_1.py b/scripts/mobiles/dynamicgroups/force_sensitives_wild_1.py new file mode 100644 index 00000000..9ee91b60 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/force_sensitives_wild_1.py @@ -0,0 +1,20 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('force_sensitive_crypt_crawler') + mobileTemplates.add('force_sensitive_renegade') + mobileTemplates.add('forsaken_force_drifter') + mobileTemplates.add('novice_force_mystic') + mobileTemplates.add('untrained_wielder_of_the_dark_side') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(-3) + dynamicGroup.setName('force_sensitives_wild_1') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(150) + core.spawnService.addDynamicGroup('force_sensitives_wild_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/giant_canyon_krayt_wild_1.py b/scripts/mobiles/dynamicgroups/giant_canyon_krayt_wild_1.py new file mode 100644 index 00000000..90595b2f --- /dev/null +++ b/scripts/mobiles/dynamicgroups/giant_canyon_krayt_wild_1.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('giant_canyon_krayt_dragon') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('giant_canyon_krayt_dragon_1') + dynamicGroup.setMaxSpawns(1) + dynamicGroup.setMinSpawnDistance(60) + core.spawnService.addDynamicGroup('giant_canyon_krayt_dragon_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/grand_canyon_krayt_wild_1.py b/scripts/mobiles/dynamicgroups/grand_canyon_krayt_wild_1.py new file mode 100644 index 00000000..0c22b98f --- /dev/null +++ b/scripts/mobiles/dynamicgroups/grand_canyon_krayt_wild_1.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('grand_canyon_krayt_dragon') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(2) + dynamicGroup.setName('grand_canyon_krayt_dragon_1') + dynamicGroup.setMaxSpawns(1) + dynamicGroup.setMinSpawnDistance(60) + core.spawnService.addDynamicGroup('grand_canyon_krayt_dragon_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/juvenile_krayts_wild_1.py b/scripts/mobiles/dynamicgroups/juvenile_krayts_wild_1.py new file mode 100644 index 00000000..f47da91b --- /dev/null +++ b/scripts/mobiles/dynamicgroups/juvenile_krayts_wild_1.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('juvenile_canyon_krayt_dragon') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('juvenile_krayts_wild_1') + dynamicGroup.setMaxSpawns(15) + dynamicGroup.setMinSpawnDistance(150) + core.spawnService.addDynamicGroup('juvenile_krayts_wild_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/krayt_dragon_ancient_wild_1.py b/scripts/mobiles/dynamicgroups/krayt_dragon_ancient_wild_1.py new file mode 100644 index 00000000..f7b8ad42 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/krayt_dragon_ancient_wild_1.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('krayt_dragon_ancient') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('krayt_dragon_ancient_1') + dynamicGroup.setMaxSpawns(1) + dynamicGroup.setMinSpawnDistance(1) + core.spawnService.addDynamicGroup('krayt_dragon_ancient_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_carrion_kreetle_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_carrion_kreetle_01.py new file mode 100644 index 00000000..db1bc7c3 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_carrion_kreetle_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('carrion_kreetle') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_carrion_kreetle_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_carrion_kreetle_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_city_sewer_rats_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_city_sewer_rats_01.py new file mode 100644 index 00000000..37c76c65 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_city_sewer_rats_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('city_sewer_swamprat') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_city_sewer_rats_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_city_sewer_rats_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_mound_mites_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_mound_mites_01.py new file mode 100644 index 00000000..46f2eddb --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_mound_mites_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('mound_mite') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_mound_mites_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_mound_mites_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_rock_mites_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_rock_mites_01.py new file mode 100644 index 00000000..ead62ff3 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_rock_mites_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('rockmite') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_rock_mites_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_rock_mites_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_sickly_womp_rats_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_sickly_womp_rats_01.py new file mode 100644 index 00000000..73f1a14d --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_sickly_womp_rats_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('sickly_womprat') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_sickly_womp_rats_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_sickly_womp_rats_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_tame_worrts_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_tame_worrts_01.py new file mode 100644 index 00000000..148f876b --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_tame_worrts_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('tame_worrt') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_tame_worrts_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_tame_worrts_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_tempest_rills_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_tempest_rills_01.py new file mode 100644 index 00000000..cb230f4f --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_tempest_rills_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('tempest_rill') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_tempest_rills_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_tempest_rills_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/mos_eisley_womp_rats_01.py b/scripts/mobiles/dynamicgroups/mos_eisley_womp_rats_01.py new file mode 100644 index 00000000..00637d0f --- /dev/null +++ b/scripts/mobiles/dynamicgroups/mos_eisley_womp_rats_01.py @@ -0,0 +1,16 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('womprat') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setGroupMembersNumber(1) + dynamicGroup.setName('mos_eisley_womprats_01') + dynamicGroup.setMaxSpawns(-1) + dynamicGroup.setMinSpawnDistance(5) + core.spawnService.addDynamicGroup('mos_eisley_womprats_01', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/dynamicgroups/tuskens_wild_1.py b/scripts/mobiles/dynamicgroups/tuskens_wild_1.py new file mode 100644 index 00000000..472747c0 --- /dev/null +++ b/scripts/mobiles/dynamicgroups/tuskens_wild_1.py @@ -0,0 +1,15 @@ +import sys +from services.spawn import DynamicSpawnGroup +from services.spawn import MobileTemplate +from java.util import Vector + +def addDynamicGroup(core): + dynamicGroup = DynamicSpawnGroup() + mobileTemplates = Vector() + mobileTemplates.add('tusken_raider') + dynamicGroup.setMobiles(mobileTemplates) + dynamicGroup.setName('tuskens_wild_1') + dynamicGroup.setMaxSpawns(20) + dynamicGroup.setMinSpawnDistance(25) + core.spawnService.addDynamicGroup('tuskens_wild_1', dynamicGroup) + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/force_sensitives_dynamic_1.py b/scripts/mobiles/spawnareas/force_sensitives_dynamic_1.py new file mode 100644 index 00000000..6c7638ea --- /dev/null +++ b/scripts/mobiles/spawnareas/force_sensitives_dynamic_1.py @@ -0,0 +1,9 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('force_sensitives_wild_1') + dynamicGroups.add('dark_jedi_wild_1') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 4083, 5780, 2048, 'dantooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_1.py b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_1.py new file mode 100644 index 00000000..7a998fa8 --- /dev/null +++ b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_1.py @@ -0,0 +1,11 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('adolescent_krayt_wild_1') + dynamicGroups.add('juvenile_krayts_wild_1') + dynamicGroups.add('canyon_krayt_wild_1') + dynamicGroups.add('giant_canyon_krayt_dragon_1') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 6471, 4267, 1024, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_2.py b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_2.py new file mode 100644 index 00000000..e97d5637 --- /dev/null +++ b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_2.py @@ -0,0 +1,8 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('grand_canyon_krayt_dragon_1') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 7431, 4762, 120, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_3.py b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_3.py new file mode 100644 index 00000000..0d863838 --- /dev/null +++ b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_3.py @@ -0,0 +1,8 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('krayt_dragon_ancient_1') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 7490, 4466, 10, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_4.py b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_4.py new file mode 100644 index 00000000..275f8a8c --- /dev/null +++ b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_4.py @@ -0,0 +1,8 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('krayt_dragon_ancient_1') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 6794, 4307, 10, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_5.py b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_5.py new file mode 100644 index 00000000..90c70591 --- /dev/null +++ b/scripts/mobiles/spawnareas/krayt_graveyard_dynamic_5.py @@ -0,0 +1,8 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('krayt_dragon_ancient_1') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 7493, 5992, 10, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/legacy_starter_tatooine_1.py b/scripts/mobiles/spawnareas/legacy_starter_tatooine_1.py new file mode 100644 index 00000000..e397088d --- /dev/null +++ b/scripts/mobiles/spawnareas/legacy_starter_tatooine_1.py @@ -0,0 +1,9 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('mos_eisley_carrion_kreetle_01') + dynamicGroups.add('mos_eisley_city_sewer_rats_01') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 3216, -4465, 100, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/legacy_starter_tatooine_2.py b/scripts/mobiles/spawnareas/legacy_starter_tatooine_2.py new file mode 100644 index 00000000..60c6b356 --- /dev/null +++ b/scripts/mobiles/spawnareas/legacy_starter_tatooine_2.py @@ -0,0 +1,9 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('mos_eisley_tame_worrts_01') + dynamicGroups.add('mos_eisley_sickly_womp_rats_01') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 3115, -4758, 100, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/legacy_starter_tatooine_3.py b/scripts/mobiles/spawnareas/legacy_starter_tatooine_3.py new file mode 100644 index 00000000..140d9432 --- /dev/null +++ b/scripts/mobiles/spawnareas/legacy_starter_tatooine_3.py @@ -0,0 +1,9 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('mos_eisley_tame_worrts_01') + dynamicGroups.add('mos_eisley_rock_mites_01') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 3153, -4945, 100, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/legacy_starter_tatooine_4.py b/scripts/mobiles/spawnareas/legacy_starter_tatooine_4.py new file mode 100644 index 00000000..8edcc45b --- /dev/null +++ b/scripts/mobiles/spawnareas/legacy_starter_tatooine_4.py @@ -0,0 +1,9 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('mos_eisley_tempest_rills_01') + dynamicGroups.add('mos_eisley_mound_mites_01') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 3841, -4345, 100, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/legacy_starter_tatooine_5.py b/scripts/mobiles/spawnareas/legacy_starter_tatooine_5.py new file mode 100644 index 00000000..44fcbc17 --- /dev/null +++ b/scripts/mobiles/spawnareas/legacy_starter_tatooine_5.py @@ -0,0 +1,9 @@ +import sys +from java.util import Vector + +def addSpawnArea(core): + dynamicGroups = Vector() + dynamicGroups.add('mos_eisley_womprats_01') + dynamicGroups.add('mos_eisley_mound_mites_01') + core.spawnService.addDynamicSpawnArea(dynamicGroups, 3587, -4354, 100, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/spawnareas/tuskens_dynamic_1.py b/scripts/mobiles/spawnareas/tuskens_dynamic_1.py new file mode 100644 index 00000000..4d9f5915 --- /dev/null +++ b/scripts/mobiles/spawnareas/tuskens_dynamic_1.py @@ -0,0 +1,5 @@ +import sys + +def addSpawnArea(core): + core.spawnService.addDynamicSpawnArea('tuskens_wild_1', 4310, -4786, 250, 'tatooine') + return \ No newline at end of file diff --git a/scripts/mobiles/tatooine/adolescent_krayt_dragon.py b/scripts/mobiles/tatooine/adolescent_krayt_dragon.py index c1c3fb85..9e28d4c8 100644 --- a/scripts/mobiles/tatooine/adolescent_krayt_dragon.py +++ b/scripts/mobiles/tatooine/adolescent_krayt_dragon.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('krayt_dragon_adolescent') mobileTemplate.setLevel(84) + mobileTemplate.setMinLevel(80) + mobileTemplate.setMaxLevel(84) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(12) - mobileTemplate.setWeaponType(6) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(True) + mobileTemplate.setScale(0.5) + + templates = Vector() templates.add('object/mobile/shared_krayt_dragon.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/canyon_krayt_dragon.py b/scripts/mobiles/tatooine/canyon_krayt_dragon.py index 7eb53cc6..08197313 100644 --- a/scripts/mobiles/tatooine/canyon_krayt_dragon.py +++ b/scripts/mobiles/tatooine/canyon_krayt_dragon.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('canyon_krayt_dragon') mobileTemplate.setLevel(85) + mobileTemplate.setMinLevel(80) + mobileTemplate.setMaxLevel(86) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(12) - mobileTemplate.setWeaponType(6) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(True) + mobileTemplate.setScale(0.8) + + templates = Vector() templates.add('object/mobile/shared_canyon_krayt_dragon.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/carion_kreetle.py b/scripts/mobiles/tatooine/carion_kreetle.py index f1a1bf01..0a8a8494 100644 --- a/scripts/mobiles/tatooine/carion_kreetle.py +++ b/scripts/mobiles/tatooine/carion_kreetle.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('fragile_kreetle') mobileTemplate.setLevel(2) + mobileTemplate.setMinLevel(5) + mobileTemplate.setMaxLevel(7) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_kreetle.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/city_sewer_swamprat.py b/scripts/mobiles/tatooine/city_sewer_swamprat.py index ecb72a17..d3f34960 100644 --- a/scripts/mobiles/tatooine/city_sewer_swamprat.py +++ b/scripts/mobiles/tatooine/city_sewer_swamprat.py @@ -7,16 +7,24 @@ def addTemplate(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('city_sewer_swamprat') - mobileTemplate.setLevel(3) + mobileTemplate.setLevel(4) + mobileTemplate.setMinLevel(4) + mobileTemplate.setMaxLevel(4) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_womp_rat.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/giant_canyon_krayt_dragon.py b/scripts/mobiles/tatooine/giant_canyon_krayt_dragon.py index 2d86f3cd..5da03190 100644 --- a/scripts/mobiles/tatooine/giant_canyon_krayt_dragon.py +++ b/scripts/mobiles/tatooine/giant_canyon_krayt_dragon.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('giant_canyon_krayt_dragon') mobileTemplate.setLevel(87) + mobileTemplate.setMinLevel(80) + mobileTemplate.setMaxLevel(88) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(12) - mobileTemplate.setWeaponType(6) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(True) + mobileTemplate.setScale(2.5) + + templates = Vector() - templates.add('object/mobile/shared_krayt_dragon.iff') + templates.add('object/mobile/shared_canyon_krayt_dragon.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/grand_krayt_dragon.py b/scripts/mobiles/tatooine/grand_krayt_dragon.py index d149306b..060fec50 100644 --- a/scripts/mobiles/tatooine/grand_krayt_dragon.py +++ b/scripts/mobiles/tatooine/grand_krayt_dragon.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('krayt_dragon_grand') mobileTemplate.setLevel(88) + mobileTemplate.setMinLevel(80) + mobileTemplate.setMaxLevel(89) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(12) - mobileTemplate.setWeaponType(6) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(True) + mobileTemplate.setScale(2.6) + + templates = Vector() - templates.add('object/mobile/shared_krayt_dragon.iff') + templates.add('object/mobile/shared_canyon_krayt_dragon.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/juvenile_canyon_krayt_dragon.py b/scripts/mobiles/tatooine/juvenile_canyon_krayt_dragon.py index d06ec11d..02a36d90 100644 --- a/scripts/mobiles/tatooine/juvenile_canyon_krayt_dragon.py +++ b/scripts/mobiles/tatooine/juvenile_canyon_krayt_dragon.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('juvenile_canyon_krayt') mobileTemplate.setLevel(82) + mobileTemplate.setMinLevel(78) + mobileTemplate.setMaxLevel(82) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(12) - mobileTemplate.setWeaponType(6) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(True) + mobileTemplate.setScale(0.5) + + templates = Vector() - templates.add('object/mobile/shared_juvenile_canyon_krayt.iff') + templates.add('object/mobile/shared_krayt_dragon.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/krayt_dragon_ancient.py b/scripts/mobiles/tatooine/krayt_dragon_ancient.py index b8450ec0..9e3e68c0 100644 --- a/scripts/mobiles/tatooine/krayt_dragon_ancient.py +++ b/scripts/mobiles/tatooine/krayt_dragon_ancient.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('krayt_dragon_ancient') mobileTemplate.setLevel(90) + mobileTemplate.setMinLevel(90) + mobileTemplate.setMaxLevel(90) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(12) - mobileTemplate.setWeaponType(6) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(True) + mobileTemplate.setScale(2.8) + + templates = Vector() templates.add('object/mobile/shared_krayt_dragon.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/mound_mite.py b/scripts/mobiles/tatooine/mound_mite.py index c62a5715..ff49aa4c 100644 --- a/scripts/mobiles/tatooine/mound_mite.py +++ b/scripts/mobiles/tatooine/mound_mite.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('mound_mite') mobileTemplate.setLevel(4) + mobileTemplate.setMinLevel(5) + mobileTemplate.setMaxLevel(7) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_mound_mite.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/rockmite.py b/scripts/mobiles/tatooine/rockmite.py index bd6f39e5..a6ac06bc 100644 --- a/scripts/mobiles/tatooine/rockmite.py +++ b/scripts/mobiles/tatooine/rockmite.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('rockmite') mobileTemplate.setLevel(8) + mobileTemplate.setMinLevel(8) + mobileTemplate.setMaxLevel(9) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_rock_mite.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/sickly_womprat.py b/scripts/mobiles/tatooine/sickly_womprat.py index 3961ece7..da6e0c5f 100644 --- a/scripts/mobiles/tatooine/sickly_womprat.py +++ b/scripts/mobiles/tatooine/sickly_womprat.py @@ -7,16 +7,24 @@ def addTemplate(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('sickly_womprat') - mobileTemplate.setLevel(1) + mobileTemplate.setLevel(4) + mobileTemplate.setMinLevel(5) + mobileTemplate.setMaxLevel(13) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_womp_rat.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/tame_worrt.py b/scripts/mobiles/tatooine/tame_worrt.py index 75bda089..b78b5c1c 100644 --- a/scripts/mobiles/tatooine/tame_worrt.py +++ b/scripts/mobiles/tatooine/tame_worrt.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('tame_worrt') mobileTemplate.setLevel(5) + mobileTemplate.setMinLevel(5) + mobileTemplate.setMaxLevel(6) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_worrt.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/tempest_rill.py b/scripts/mobiles/tatooine/tempest_rill.py index d5df155c..3224a410 100644 --- a/scripts/mobiles/tatooine/tempest_rill.py +++ b/scripts/mobiles/tatooine/tempest_rill.py @@ -8,15 +8,23 @@ def addTemplate(core): mobileTemplate.setCreatureName('rill_tempest') mobileTemplate.setLevel(8) + mobileTemplate.setMinLevel(8) + mobileTemplate.setMaxLevel(10) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_rill.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/mobiles/tatooine/womprat.py b/scripts/mobiles/tatooine/womprat.py index 7852829b..b67a9948 100644 --- a/scripts/mobiles/tatooine/womprat.py +++ b/scripts/mobiles/tatooine/womprat.py @@ -7,16 +7,24 @@ def addTemplate(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('womprat') - mobileTemplate.setLevel(5) + mobileTemplate.setLevel(4) + mobileTemplate.setMinLevel(5) + mobileTemplate.setMaxLevel(13) mobileTemplate.setDifficulty(0) - mobileTemplate.setAttackRange(5) - mobileTemplate.setWeaponType(6) + mobileTemplate.setAttackRange(4) mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(6) + mobileTemplate.setMinSpawnDistance(4) + mobileTemplate.setMaxSpawnDistance(8) + mobileTemplate.setDeathblow(False) + mobileTemplate.setScale(1) + + templates = Vector() templates.add('object/mobile/shared_womp_rat.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0) weaponTemplates.add(weapontemplate) diff --git a/scripts/object/building/player/city/garden_tatooine_sml_01.py b/scripts/object/building/player/city/garden_tatooine_sml_01.py index ccad8904..287ca8f0 100644 --- a/scripts/object/building/player/city/garden_tatooine_sml_01.py +++ b/scripts/object/building/player/city/garden_tatooine_sml_01.py @@ -1,4 +1,14 @@ import sys +from engine.resources.scene import Point3D +from engine.resources.scene import Quaternion def setup(core, object): + sign = core.objectService.createChildObject(object, 'object/tangible/sign/player/shared_house_address.iff', -13.7, 3, 9.1, -1, 0, -1) + print(sign) + object.setAttachment("structureSign", sign) + + structureterminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', -17.2, 1.5 , 8, 1, 0 ,4) + #structureterminal.setAttachment('radial_filename', 'structure_management_terminal') + structureterminal.setAttachment('housing_parentstruct', object) + return \ No newline at end of file diff --git a/scripts/object/creature/npc/droid/imperial_probot_bounty.py b/scripts/object/creature/npc/droid/imperial_probot_bounty.py index ccad8904..de71643c 100644 --- a/scripts/object/creature/npc/droid/imperial_probot_bounty.py +++ b/scripts/object/creature/npc/droid/imperial_probot_bounty.py @@ -1,4 +1,8 @@ +from resources.datatables import Options import sys def setup(core, object): + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','missions/bounty_droid_probot') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) return \ No newline at end of file diff --git a/scripts/object/mobile/dressed_dark_force_crystal_hunter.py b/scripts/object/mobile/dressed_dark_force_crystal_hunter.py index ccad8904..dbbb65df 100644 --- a/scripts/object/mobile/dressed_dark_force_crystal_hunter.py +++ b/scripts/object/mobile/dressed_dark_force_crystal_hunter.py @@ -1,4 +1,27 @@ import sys def setup(core, object): - return \ No newline at end of file + + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] + lootGroupChance_1 = 65 + object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames_2 = ['jedi_relic_1'] + lootPoolChances_2 = [100] + lootGroupChance_2 = 85 + object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 12 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['sithholocrons'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 1 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + + + + return \ No newline at end of file diff --git a/scripts/object/mobile/dressed_dark_side_savage.py b/scripts/object/mobile/dressed_dark_side_savage.py index ccad8904..70052ae4 100644 --- a/scripts/object/mobile/dressed_dark_side_savage.py +++ b/scripts/object/mobile/dressed_dark_side_savage.py @@ -1,4 +1,21 @@ import sys def setup(core, object): - return \ No newline at end of file + + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] + lootGroupChance_1 = 65 + object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames_2 = ['jedi_relic_1'] + lootPoolChances_2 = [100] + lootGroupChance_2 = 85 + object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 12 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + + return \ No newline at end of file diff --git a/scripts/object/mobile/dressed_force_sensitive_crypt_crawler.py b/scripts/object/mobile/dressed_force_sensitive_crypt_crawler.py index ccad8904..2c42c975 100644 --- a/scripts/object/mobile/dressed_force_sensitive_crypt_crawler.py +++ b/scripts/object/mobile/dressed_force_sensitive_crypt_crawler.py @@ -1,4 +1,27 @@ import sys def setup(core, object): - return \ No newline at end of file + + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] + lootGroupChance_1 = 65 + object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames_2 = ['jedi_relic_1'] + lootPoolChances_2 = [100] + lootGroupChance_2 = 85 + object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 12 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['jediholocrons'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 1 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + + + + return \ No newline at end of file diff --git a/scripts/object/mobile/dressed_force_sensitive_renegade.py b/scripts/object/mobile/dressed_force_sensitive_renegade.py index ccad8904..2c42c975 100644 --- a/scripts/object/mobile/dressed_force_sensitive_renegade.py +++ b/scripts/object/mobile/dressed_force_sensitive_renegade.py @@ -1,4 +1,27 @@ import sys def setup(core, object): - return \ No newline at end of file + + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] + lootGroupChance_1 = 65 + object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames_2 = ['jedi_relic_1'] + lootPoolChances_2 = [100] + lootGroupChance_2 = 85 + object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 12 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['jediholocrons'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 1 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + + + + return \ No newline at end of file diff --git a/scripts/object/mobile/dressed_forsaken_force_drifter.py b/scripts/object/mobile/dressed_forsaken_force_drifter.py index ccad8904..2c42c975 100644 --- a/scripts/object/mobile/dressed_forsaken_force_drifter.py +++ b/scripts/object/mobile/dressed_forsaken_force_drifter.py @@ -1,4 +1,27 @@ import sys def setup(core, object): - return \ No newline at end of file + + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] + lootGroupChance_1 = 65 + object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames_2 = ['jedi_relic_1'] + lootPoolChances_2 = [100] + lootGroupChance_2 = 85 + object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 12 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['jediholocrons'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 1 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + + + + return \ No newline at end of file diff --git a/scripts/object/mobile/dressed_gendra.py b/scripts/object/mobile/dressed_gendra.py index ccad8904..ceee905c 100644 --- a/scripts/object/mobile/dressed_gendra.py +++ b/scripts/object/mobile/dressed_gendra.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','gendra') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('newbie_gendra') + return diff --git a/scripts/object/mobile/dressed_imperial_officer_f.py b/scripts/object/mobile/dressed_imperial_officer_f.py index ccad8904..b9963b3e 100644 --- a/scripts/object/mobile/dressed_imperial_officer_f.py +++ b/scripts/object/mobile/dressed_imperial_officer_f.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('imperial_recruiter') + return diff --git a/scripts/object/mobile/dressed_imperial_officer_m_2.py b/scripts/object/mobile/dressed_imperial_officer_m_2.py index ccad8904..b9963b3e 100644 --- a/scripts/object/mobile/dressed_imperial_officer_m_2.py +++ b/scripts/object/mobile/dressed_imperial_officer_m_2.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('imperial_recruiter') + return diff --git a/scripts/object/mobile/dressed_imperial_officer_m_3.py b/scripts/object/mobile/dressed_imperial_officer_m_3.py index ccad8904..b9963b3e 100644 --- a/scripts/object/mobile/dressed_imperial_officer_m_3.py +++ b/scripts/object/mobile/dressed_imperial_officer_m_3.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('imperial_recruiter') + return diff --git a/scripts/object/mobile/dressed_imperial_officer_m_4.py b/scripts/object/mobile/dressed_imperial_officer_m_4.py index ccad8904..b9963b3e 100644 --- a/scripts/object/mobile/dressed_imperial_officer_m_4.py +++ b/scripts/object/mobile/dressed_imperial_officer_m_4.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('imperial_recruiter') + return diff --git a/scripts/object/mobile/dressed_imperial_officer_m_5.py b/scripts/object/mobile/dressed_imperial_officer_m_5.py index ccad8904..b9963b3e 100644 --- a/scripts/object/mobile/dressed_imperial_officer_m_5.py +++ b/scripts/object/mobile/dressed_imperial_officer_m_5.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('imperial_recruiter') + return diff --git a/scripts/object/mobile/dressed_imperial_officer_m_6.py b/scripts/object/mobile/dressed_imperial_officer_m_6.py index ccad8904..b9963b3e 100644 --- a/scripts/object/mobile/dressed_imperial_officer_m_6.py +++ b/scripts/object/mobile/dressed_imperial_officer_m_6.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('imperial_recruiter') + return diff --git a/scripts/object/mobile/dressed_mayor_mikdanyell_guhrantt.py b/scripts/object/mobile/dressed_mayor_mikdanyell_guhrantt.py index ccad8904..e8e3da38 100644 --- a/scripts/object/mobile/dressed_mayor_mikdanyell_guhrantt.py +++ b/scripts/object/mobile/dressed_mayor_mikdanyell_guhrantt.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','mayor_mikdanyel_guhrantt') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('mos_eisley_mayor') + return diff --git a/scripts/object/mobile/dressed_novice_force_mystic.py b/scripts/object/mobile/dressed_novice_force_mystic.py index ccad8904..2c42c975 100644 --- a/scripts/object/mobile/dressed_novice_force_mystic.py +++ b/scripts/object/mobile/dressed_novice_force_mystic.py @@ -1,4 +1,27 @@ import sys def setup(core, object): - return \ No newline at end of file + + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] + lootGroupChance_1 = 65 + object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames_2 = ['jedi_relic_1'] + lootPoolChances_2 = [100] + lootGroupChance_2 = 85 + object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 12 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['jediholocrons'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 1 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + + + + return \ No newline at end of file diff --git a/scripts/object/mobile/dressed_rebel_recruiter_human_female_01.py b/scripts/object/mobile/dressed_rebel_recruiter_human_female_01.py index ccad8904..e0dd64a1 100644 --- a/scripts/object/mobile/dressed_rebel_recruiter_human_female_01.py +++ b/scripts/object/mobile/dressed_rebel_recruiter_human_female_01.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','reb_recruiter') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('rebel_recruiter') + return diff --git a/scripts/object/mobile/dressed_tatooine_opening_byxle.py b/scripts/object/mobile/dressed_tatooine_opening_byxle.py index ccad8904..a9115a52 100644 --- a/scripts/object/mobile/dressed_tatooine_opening_byxle.py +++ b/scripts/object/mobile/dressed_tatooine_opening_byxle.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','byxle') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('tatooine_opening_byxle') + return diff --git a/scripts/object/mobile/dressed_tatooine_opening_dunir.py b/scripts/object/mobile/dressed_tatooine_opening_dunir.py index ccad8904..f9d28082 100644 --- a/scripts/object/mobile/dressed_tatooine_opening_dunir.py +++ b/scripts/object/mobile/dressed_tatooine_opening_dunir.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','durni') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('tatooine_opening_dunir') + return diff --git a/scripts/object/mobile/dressed_tatooine_opening_niko.py b/scripts/object/mobile/dressed_tatooine_opening_niko.py index ccad8904..bb8c0ab4 100644 --- a/scripts/object/mobile/dressed_tatooine_opening_niko.py +++ b/scripts/object/mobile/dressed_tatooine_opening_niko.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','niko') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('tatooine_opening_niko') + return diff --git a/scripts/object/mobile/dressed_tatooine_opening_reimos.py b/scripts/object/mobile/dressed_tatooine_opening_reimos.py index ccad8904..2b2075d4 100644 --- a/scripts/object/mobile/dressed_tatooine_opening_reimos.py +++ b/scripts/object/mobile/dressed_tatooine_opening_reimos.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','reimos') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('tatooine_opening_reimos') + return diff --git a/scripts/object/mobile/dressed_tatooine_opening_toggi.py b/scripts/object/mobile/dressed_tatooine_opening_toggi.py index ccad8904..ee3d1ccf 100644 --- a/scripts/object/mobile/dressed_tatooine_opening_toggi.py +++ b/scripts/object/mobile/dressed_tatooine_opening_toggi.py @@ -1,4 +1,10 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'object/conversation'); + object.setAttachment('conversationFile','toggi') + object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('tatooine_opening_toggi') + return diff --git a/scripts/object/mobile/dressed_untrained_wielder_of_the_darkside.py b/scripts/object/mobile/dressed_untrained_wielder_of_the_darkside.py index ccad8904..dbbb65df 100644 --- a/scripts/object/mobile/dressed_untrained_wielder_of_the_darkside.py +++ b/scripts/object/mobile/dressed_untrained_wielder_of_the_darkside.py @@ -1,4 +1,27 @@ import sys def setup(core, object): - return \ No newline at end of file + + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] + lootGroupChance_1 = 65 + object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames_2 = ['jedi_relic_1'] + lootPoolChances_2 = [100] + lootGroupChance_2 = 85 + object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 12 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['sithholocrons'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 1 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + + + + return \ No newline at end of file diff --git a/scripts/object/mobile/space_privateer_tier1_tatooine.py b/scripts/object/mobile/space_privateer_tier1_tatooine.py index ccad8904..b0f81354 100644 --- a/scripts/object/mobile/space_privateer_tier1_tatooine.py +++ b/scripts/object/mobile/space_privateer_tier1_tatooine.py @@ -1,4 +1,9 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + #object.setAttachment('radial_filename', 'object/conversation'); + #object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.INVULNERABLE) + object.setCustomName('Dravis') + return diff --git a/scripts/object/mobile/space_privateer_tier2_shamdon.py b/scripts/object/mobile/space_privateer_tier2_shamdon.py index ccad8904..f30504b0 100644 --- a/scripts/object/mobile/space_privateer_tier2_shamdon.py +++ b/scripts/object/mobile/space_privateer_tier2_shamdon.py @@ -1,4 +1,9 @@ import sys +from resources.datatables import Options def setup(core, object): - return \ No newline at end of file + #object.setAttachment('radial_filename', 'object/conversation'); + #object.setAttachment('conversationFile','imp_recruiter') + object.setOptionsBitmask(Options.INVULNERABLE) + object.setCustomName('Shamdon Kree ') + return diff --git a/scripts/object/mobile/vehicle/barc_speeder_imperial.py b/scripts/object/mobile/vehicle/barc_speeder_imperial.py index ccad8904..6093148c 100644 --- a/scripts/object/mobile/vehicle/barc_speeder_imperial.py +++ b/scripts/object/mobile/vehicle/barc_speeder_imperial.py @@ -1,4 +1,9 @@ import sys def setup(core, object): + core.buffService.addBuffToCreature(object, 'vehicle_pvp_barc_imperial', object) + return + +def use(core, actor, object): + core.buffService.addBuffToCreature(object, 'vehicle_pvp_barc_imperial', object) return \ No newline at end of file diff --git a/scripts/object/mobile/vehicle/barc_speeder_rebel.py b/scripts/object/mobile/vehicle/barc_speeder_rebel.py index ccad8904..402fab24 100644 --- a/scripts/object/mobile/vehicle/barc_speeder_rebel.py +++ b/scripts/object/mobile/vehicle/barc_speeder_rebel.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + return + +def use(core, actor, object): + core.buffService.addBuffToCreature(object, 'vehicle_pvp_barc_rebel', object) return \ No newline at end of file diff --git a/scripts/object/mobile/vehicle/walker_at_rt_camo.py b/scripts/object/mobile/vehicle/walker_at_rt_camo.py index ccad8904..38038e73 100644 --- a/scripts/object/mobile/vehicle/walker_at_rt_camo.py +++ b/scripts/object/mobile/vehicle/walker_at_rt_camo.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + return + +def use(core, actor, object): + core.buffService.addBuffToCreature(object, 'vehicle_at_rt', object) return \ No newline at end of file diff --git a/scripts/object/mobile/vehicle/walker_at_rt_reg.py b/scripts/object/mobile/vehicle/walker_at_rt_reg.py index ccad8904..38038e73 100644 --- a/scripts/object/mobile/vehicle/walker_at_rt_reg.py +++ b/scripts/object/mobile/vehicle/walker_at_rt_reg.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + return + +def use(core, actor, object): + core.buffService.addBuffToCreature(object, 'vehicle_at_rt', object) return \ No newline at end of file diff --git a/scripts/object/tangible/deed/city_deed/garden_tatooine_sml_01_deed.py b/scripts/object/tangible/deed/city_deed/garden_tatooine_sml_01_deed.py index ccad8904..07ab9319 100644 --- a/scripts/object/tangible/deed/city_deed/garden_tatooine_sml_01_deed.py +++ b/scripts/object/tangible/deed/city_deed/garden_tatooine_sml_01_deed.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'deeds/structureDeed') + return + +def use(core, actor, object): return \ No newline at end of file diff --git a/scripts/object/tangible/deed/city_deed/shuttleport_tatooine_deed.py b/scripts/object/tangible/deed/city_deed/shuttleport_tatooine_deed.py index ccad8904..07ab9319 100644 --- a/scripts/object/tangible/deed/city_deed/shuttleport_tatooine_deed.py +++ b/scripts/object/tangible/deed/city_deed/shuttleport_tatooine_deed.py @@ -1,4 +1,8 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'deeds/structureDeed') + return + +def use(core, actor, object): return \ No newline at end of file diff --git a/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py b/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py index 92a45a9d..f031d37f 100644 --- a/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py +++ b/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py @@ -1,7 +1,7 @@ import sys def setup(core, object): - object.setAttachment('radial_filename', 'vehicleDeed') + object.setAttachment('radial_filename', 'deeds/vehicleDeed') return def use(core, actor, object): @@ -21,4 +21,4 @@ def use(core, actor, object): core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) actor.setAttachment('activeVehicleID', vehicle.getObjectID()) - return \ No newline at end of file + return diff --git a/scripts/object/tangible/food/crafted/drink_breath_of_heaven.py b/scripts/object/tangible/food/crafted/drink_breath_of_heaven.py index ccad8904..eec73983 100644 --- a/scripts/object/tangible/food/crafted/drink_breath_of_heaven.py +++ b/scripts/object/tangible/food/crafted/drink_breath_of_heaven.py @@ -1,4 +1,5 @@ import sys def setup(core, object): - return \ No newline at end of file + object.setAttachment('radial_filename', 'shared_drink_breath_of_heaven') + return diff --git a/scripts/object/tangible/mission/mission_bounty_droid_probot.py b/scripts/object/tangible/mission/mission_bounty_droid_probot.py index ccad8904..4b30916a 100644 --- a/scripts/object/tangible/mission/mission_bounty_droid_probot.py +++ b/scripts/object/tangible/mission/mission_bounty_droid_probot.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'npc/bounty_probot') return \ No newline at end of file diff --git a/scripts/object/tangible/mission/mission_bounty_droid_seeker.py b/scripts/object/tangible/mission/mission_bounty_droid_seeker.py index ccad8904..516734c3 100644 --- a/scripts/object/tangible/mission/mission_bounty_droid_seeker.py +++ b/scripts/object/tangible/mission/mission_bounty_droid_seeker.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'npc/bounty_seeker') return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_bank.py b/scripts/object/tangible/terminal/terminal_bank.py index 64205c68..0a27868e 100644 --- a/scripts/object/tangible/terminal/terminal_bank.py +++ b/scripts/object/tangible/terminal/terminal_bank.py @@ -2,6 +2,6 @@ import sys def setup(core, object): object.setAttachment('radial_filename', 'terminal/bank') - core.mapService.addLocation(object.getPlanet(), 'Bank Terminal', object.getPosition().x, object.getPosition().z, 41, 42, 0) + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_bank', object.getPosition().x, object.getPosition().z, 2, 42, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_bazaar.py b/scripts/object/tangible/terminal/terminal_bazaar.py index e94866f0..967ff912 100644 --- a/scripts/object/tangible/terminal/terminal_bazaar.py +++ b/scripts/object/tangible/terminal/terminal_bazaar.py @@ -1,7 +1,6 @@ import sys def setup(core, object): - - core.mapService.addLocation(object.getPlanet(), 'Bazaar Terminal', object.getPosition().x, object.getPosition().z, 41, 43, 0) + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_bazaar', object.getPosition().x, object.getPosition().z, 41, 43, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_city_junk_dealer.py b/scripts/object/tangible/terminal/terminal_city_junk_dealer.py index ccad8904..f09f88cc 100644 --- a/scripts/object/tangible/terminal/terminal_city_junk_dealer.py +++ b/scripts/object/tangible/terminal/terminal_city_junk_dealer.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:junk_dealer', object.getPosition().x, object.getPosition().z, 26, 81, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_cloning.py b/scripts/object/tangible/terminal/terminal_cloning.py index dc256f9a..46138012 100644 --- a/scripts/object/tangible/terminal/terminal_cloning.py +++ b/scripts/object/tangible/terminal/terminal_cloning.py @@ -2,5 +2,6 @@ import sys def setup(core, object): object.setAttachment('radial_filename', 'terminal/cloning_terminal') + return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_mission_artisan.py b/scripts/object/tangible/terminal/terminal_mission_artisan.py index 911010d8..6bface4e 100644 --- a/scripts/object/tangible/terminal/terminal_mission_artisan.py +++ b/scripts/object/tangible/terminal/terminal_mission_artisan.py @@ -2,6 +2,6 @@ import sys def setup(core, object): - core.mapService.addLocation(object.getPlanet(), 'Artisan Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 21, 0) + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_artisan', object.getPosition().x, object.getPosition().z, 41, 76, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_mission_entertainer.py b/scripts/object/tangible/terminal/terminal_mission_entertainer.py index 433b5f91..31bc4a90 100644 --- a/scripts/object/tangible/terminal/terminal_mission_entertainer.py +++ b/scripts/object/tangible/terminal/terminal_mission_entertainer.py @@ -1,7 +1,6 @@ import sys def setup(core, object): - - core.mapService.addLocation(object.getPlanet(), 'Entertainer Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 24, 0) - return - \ No newline at end of file + object.setAttachment("terminalType", 2) + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_entertainer', object.getPosition().x, object.getPosition().z, 41, 75, 0) + return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_mission_imperial.py b/scripts/object/tangible/terminal/terminal_mission_imperial.py index 8e4773b5..216f3bfc 100644 --- a/scripts/object/tangible/terminal/terminal_mission_imperial.py +++ b/scripts/object/tangible/terminal/terminal_mission_imperial.py @@ -1,7 +1,6 @@ import sys def setup(core, object): - - core.mapService.addLocation(object.getPlanet(), 'Imperial Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 46, 0) + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_imperial', object.getPosition().x, object.getPosition().z, 41, 80, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_mission_rebel.py b/scripts/object/tangible/terminal/terminal_mission_rebel.py index 0bb50bbe..f435f149 100644 --- a/scripts/object/tangible/terminal/terminal_mission_rebel.py +++ b/scripts/object/tangible/terminal/terminal_mission_rebel.py @@ -1,7 +1,6 @@ import sys def setup(core, object): - - core.mapService.addLocation(object.getPlanet(), 'Rebel Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 45, 0) + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_rebel', object.getPosition().x, object.getPosition().z, 41, 79, 0) return \ No newline at end of file diff --git a/scripts/object/tangible/terminal/terminal_mission_scout.py b/scripts/object/tangible/terminal/terminal_mission_scout.py index ccad8904..eb7c1e2a 100644 --- a/scripts/object/tangible/terminal/terminal_mission_scout.py +++ b/scripts/object/tangible/terminal/terminal_mission_scout.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_scout', object.getPosition().x, object.getPosition().z, 41, 77, 0) return \ No newline at end of file diff --git a/scripts/radial/creature/vehicle.py b/scripts/radial/creature/vehicle.py index 5106c8ee..af827f7d 100644 --- a/scripts/radial/creature/vehicle.py +++ b/scripts/radial/creature/vehicle.py @@ -22,6 +22,7 @@ def handleSelection(core, owner, target, option): mntSvc.dismount(owner, target) else: mntSvc.mount(owner, target) + core.objectService.useObject(owner, target) elif option == 60: mntSvc.store(owner, target) elif option == 114: diff --git a/scripts/radial/npc/bounty_probot.py b/scripts/radial/npc/bounty_probot.py new file mode 100644 index 00000000..1301c027 --- /dev/null +++ b/scripts/radial/npc/bounty_probot.py @@ -0,0 +1,30 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 138, 1, '@mission/mission_generic:probe_droid_summon')) + return + +def handleSelection(core, owner, target, option): + + if option == 138 and target: + id = owner.getPlayerObject().getBountyMissionId() + if id is None or id == 0: + owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0) + return + + mission = core.objectService.getObject(id) + if mission is None: + owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0) + return + + if mission.getObjective().isArakydActive(): + owner.sendSystemMessage('@mission/mission_generic:probe_droid_too_many', 0) + return + + if not core.terrainService.canBuildAtPosition(owner, owner.getPosition().x, owner.getPosition().z): + owner.sendSystemMessage('@mission/mission_generic:probe_droid_bad_location', 0) + return + + mission.getObjective().handleProbeDroidSummon(core, owner) + return \ No newline at end of file diff --git a/scripts/radial/npc/bounty_seeker.py b/scripts/radial/npc/bounty_seeker.py new file mode 100644 index 00000000..d7e829fe --- /dev/null +++ b/scripts/radial/npc/bounty_seeker.py @@ -0,0 +1,41 @@ +from resources.common import RadialOptions +from resources.common import SpawnPoint +import time +import sys + +def createRadial(core, owner, target, radials): + radials.clear() + radials.add(RadialOptions(0, 138, 0, 'Track Target')) + radials.add(RadialOptions(1, 136, 0, '@mission/mission_generic:probe_droid_track_target')) # Track Bounty Target + radials.add(RadialOptions(1, 137, 0, '@mission/mission_generic:probe_droid_find_target')) # Identify Bounty Target + return + +def handleSelection(core, owner, target, option): + + if option == 136 and target or option == 138 and target: + id = owner.getPlayerObject().getBountyMissionId() + if id is None or id == 0: + owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0) + return + + mission = core.objectService.getObject(id) + if mission is None: + owner.sendSystemMessage('@mission/mission_generic:bounty_no_mission', 0) + return + + if mission.getObjective().isSeekerActive(): + owner.sendSystemMessage('@mission/mission_generic:bounty_already_tracking', 0) + return + pos = SpawnPoint.getRandomPosition(owner.getPosition(), 1, 3, owner.getPlanetId()) + ori = owner.getOrientation() + seeker = core.staticService.spawnObject('object/creature/npc/droid/crafted/shared_probe_droid_advanced.iff', owner.getPlanet().getName(), 0, pos.x, pos.y, pos.z, ori.y, ori.w) + time.sleep(3) + owner.sendSystemMessage('@mission/mission_generic:seeker_droid_standby', 0) + seeker.setPosture(8) + time.sleep(7.5) + mission.getObjective().beginSeekerUpdates(core, owner) + return + + if option == 137 and target: + return + return \ No newline at end of file diff --git a/scripts/radial/shared_drink_breath_of_heaven.py b/scripts/radial/shared_drink_breath_of_heaven.py new file mode 100644 index 00000000..11ae9ca7 --- /dev/null +++ b/scripts/radial/shared_drink_breath_of_heaven.py @@ -0,0 +1,16 @@ +import resources.objects.creature.CreatureObject; +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, object, option): + if option == 21: + core.buffService.addBuffToCreature(owner, 'drink_breath_of_heaven', owner) + + core.objectService.destroyObject(object) + return diff --git a/scripts/radial/terminal/city_maintenance_terminal.py b/scripts/radial/terminal/city_maintenance_terminal.py index ef951426..e5bab716 100644 --- a/scripts/radial/terminal/city_maintenance_terminal.py +++ b/scripts/radial/terminal/city_maintenance_terminal.py @@ -24,6 +24,10 @@ def createRadial(core, owner, target, radials): radials.add(RadialOptions(3, 121, 0, '@city/city:non_citizen_city_status')) radials.add(RadialOptions(3, 122, 0, '@city/city:rank_info_t')) radials.add(RadialOptions(3, 123, 0, '@city/city:citizen_list_t')) + radials.add(RadialOptions(3, 230, 0, '@city/city:revoke_citizenship')) + + radials.add(RadialOptions(3, 231, 0, 'Add 10 citizens')) + radials.add(RadialOptions(3, 232, 0, 'Deduct 10 citizens')) return @@ -80,14 +84,26 @@ def handleSelection(core, owner, target, option): if owner is not None: handleCitizenList(core, owner, target, option) return - -def handleSetCityName(core, owner, target, option): - window = core.suiService.createInputBox(2,'@city/city:city_name_new_t','@city/city:city_name_new_d', owner, target, 0) - returnList = Vector() - returnList.add('txtInput:LocalText') - window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setnameCallBack) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setnameCallBack) - core.suiService.openSUIWindow(window); + + if option == 231: + if owner is not None: + handle10Add(core, owner, target, option) + return + + if option == 232: + if owner is not None: + handle10Deduct(core, owner, target, option) + return + +def handle10Add(core, owner, target, option): + playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner) + playerCity.Add10MoreCitizens() + return + + +def handle10Deduct(core, owner, target, option): + playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner) + playerCity.Deduct10Citizens() return def setnameCallBack(owner, window, eventType, returnList): diff --git a/scripts/skillMods/strength_modified.py b/scripts/skillMods/strength_modified.py index 45ac9940..469cc568 100644 --- a/scripts/skillMods/strength_modified.py +++ b/scripts/skillMods/strength_modified.py @@ -4,7 +4,7 @@ def add(core, actor, skillMod, divisor): core.skillModService.addSkillMod(actor, 'display_only_block', skillMod.getBase() / 2) return -def deduct(core, actor, name, base): +def deduct(core, actor, skillMod, divisor): core.skillModService.deductSkillMod(actor, 'display_only_block', skillMod.getBase() / 2) return \ No newline at end of file diff --git a/scripts/static_spawns/corellia/placeholder.txt b/scripts/static_spawns/corellia/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/dantooine/placeholder.txt b/scripts/static_spawns/dantooine/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/dathomir/placeholder.txt b/scripts/static_spawns/dathomir/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/endor/placeholder.txt b/scripts/static_spawns/endor/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/kaas.py b/scripts/static_spawns/kaas/kaas.py similarity index 73% rename from scripts/static_spawns/kaas.py rename to scripts/static_spawns/kaas/kaas.py index b576e2da..f21c8441 100644 --- a/scripts/static_spawns/kaas.py +++ b/scripts/static_spawns/kaas/kaas.py @@ -14,14 +14,14 @@ def addPlanetSpawns(core, planet): objSvc = core.objectService #Dark Temple Area #Structures - stcSvc.spawnObject('object/building/military/shared_military_base_police_station_imperial_lok_otto.iff', 'kaas', long(0), float(-5117.8), float(80.0), float(-2314.1), float(0), float(0)) - stcSvc.spawnObject('object/building/player/shared_player_house_corellia_medium_style_01.iff', 'kaas', long(0), float(-5078.6), float(80.0), float(-2302.5), float(0), float(0)) - stcSvc.spawnObject('object/building/general/shared_bunker_imperial_weapons_research_facility_01.iff', 'kaas', long(0), float(-5159.5), float(80.0), float(-2298.7), float(0), float(0)) - stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2369.6), float(0.71), float(0.71)) - stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2351.6), float(0.71), float(0.71)) - stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2369.6), float(-0.71), float(0.71)) - stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2351.6), float(-0.71), float(0.71)) - stcSvc.spawnObject('object/building/military/shared_outpost_cloning_facility_s02.iff', long(0), 'kaas', long(0), float(-5072.1), float(80.0), float(-2279.5), float(0.71), float(0), float(-0.71), float(0)) + #stcSvc.spawnObject('object/building/military/shared_military_base_police_station_imperial_lok_otto.iff', 'kaas', long(0), float(-5117.8), float(80.0), float(-2314.1), float(0), float(0)) + #stcSvc.spawnObject('object/building/player/shared_player_house_corellia_medium_style_01.iff', 'kaas', long(0), float(-5078.6), float(80.0), float(-2302.5), float(0), float(0)) + #stcSvc.spawnObject('object/building/general/shared_bunker_imperial_weapons_research_facility_01.iff', 'kaas', long(0), float(-5159.5), float(80.0), float(-2298.7), float(0), float(0)) + #stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2369.6), float(0.71), float(0.71)) + #stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2351.6), float(0.71), float(0.71)) + #stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2369.6), float(-0.71), float(0.71)) + #stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2351.6), float(-0.71), float(0.71)) + #stcSvc.spawnObject('object/building/military/shared_outpost_cloning_facility_s02.iff', 'kaas', long(0), float(-5072.1), float(80.0), float(-2279.5), float(0.71), float(0), float(-0.71), float(0)) #Terminals stcSvc.spawnObject('object/tangible/terminal/shared_terminal_bank.iff', 'kaas', long(0), float(-5080.8), float(80.0), float(-2275.7), float(-0.71), float(0.71)) @@ -58,20 +58,20 @@ def addPlanetSpawns(core, planet): #Village of the Descendants Area - stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(3348.1), float(110), float(2562.1), float(0), float(0)) + #stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(3348.1), float(110), float(2562.1), float(0), float(0)) #Kaas City Ruins #Tomb of Vitiate #Northwest Cave - stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(-6135.3), float(185), float(6575.0), float(0), float(0)) + #stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(-6135.3), float(185), float(6575.0), float(0), float(0)) #Abandoned Separatist Base - stcSvc.spawnObject('object/building/military/shared_military_base_police_station_rebel_style_01.iff', 'kaas', long(0), float(-3538), float(80), float(6758), float(0), float(0)) + #stcSvc.spawnObject('object/building/military/shared_military_base_police_station_rebel_style_01.iff', 'kaas', long(0), float(-3538), float(80), float(6758), float(0), float(0)) #Sith Meditation Chamber - stcSvc.spawnObject('object/building/player/shared_player_house_sith_meditation_room.iff', 'kaas', long(0), float(4766), float(126), float(-7307), float(0), float(0)) + #stcSvc.spawnObject('object/building/player/shared_player_house_sith_meditation_room.iff', 'kaas', long(0), float(4766), float(126), float(-7307), float(0), float(0)) #Large Ruin stcSvc.spawnObject('object/static/structure/dantooine/shared_dant_jedi_main_structure.iff', 'kaas', long(0), float(-434), float(77), float(-2252), float(0), float(0)) diff --git a/scripts/static_spawns/kaas/placeholder.txt b/scripts/static_spawns/kaas/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/kashyyyk_main/placeholder.txt b/scripts/static_spawns/kashyyyk_main/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/lok.py b/scripts/static_spawns/lok.py deleted file mode 100644 index 30c9163e..00000000 --- a/scripts/static_spawns/lok.py +++ /dev/null @@ -1,10 +0,0 @@ - -import sys -from resources.datatables import Options -from resources.datatables import StateStatus - -def addPlanetSpawns(core, planet): -#This Script is no longer to be used for NPC Scripting. - Levarris - - - return diff --git a/scripts/static_spawns/lok/lok.py b/scripts/static_spawns/lok/lok.py new file mode 100644 index 00000000..658c4a93 --- /dev/null +++ b/scripts/static_spawns/lok/lok.py @@ -0,0 +1,14 @@ + +import sys +from resources.datatables import Options +from resources.datatables import StateStatus + +def addPlanetSpawns(core, planet): +######################################################## +# DO NOT ADD ANYTHING ELSE TO THIS SCRIPT, PLEASE USE THE +# SUBFOLDERS FOR EACH PLANET AND CREATE NEW SCRIPTS FOR +# EACH AREA OF A PLANET. - LEVARRIS +######################################################## + + + return diff --git a/scripts/static_spawns/lok/placeholder.txt b/scripts/static_spawns/lok/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/mustafar/placeholder.txt b/scripts/static_spawns/mustafar/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/naboo.py b/scripts/static_spawns/naboo.py deleted file mode 100644 index c1072308..00000000 --- a/scripts/static_spawns/naboo.py +++ /dev/null @@ -1,8 +0,0 @@ -import sys - -def addPlanetSpawns(core, planet): - - stcSvc = core.staticService - #this script is no longer for NPC spawning - Levarris - - return \ No newline at end of file diff --git a/scripts/static_spawns/naboo/naboo.py b/scripts/static_spawns/naboo/naboo.py new file mode 100644 index 00000000..7b0f3034 --- /dev/null +++ b/scripts/static_spawns/naboo/naboo.py @@ -0,0 +1,11 @@ +import sys + +def addPlanetSpawns(core, planet): + + stcSvc = core.staticService +######################################################## +# DO NOT ADD ANYTHING ELSE TO THIS SCRIPT, PLEASE USE THE +# SUBFOLDERS FOR EACH PLANET AND CREATE NEW SCRIPTS FOR +# EACH AREA OF A PLANET. - LEVARRIS + + return \ No newline at end of file diff --git a/scripts/static_spawns/naboo/placeholder.txt b/scripts/static_spawns/naboo/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/rori.py b/scripts/static_spawns/rori/restuss.py similarity index 100% rename from scripts/static_spawns/rori.py rename to scripts/static_spawns/rori/restuss.py diff --git a/scripts/static_spawns/rori/rori.py b/scripts/static_spawns/rori/rori.py new file mode 100644 index 00000000..ff976d80 --- /dev/null +++ b/scripts/static_spawns/rori/rori.py @@ -0,0 +1,14 @@ +import sys + +def addPlanetSpawns(core, planet): + + stcSvc = core.staticService + +######################################################## +# DO NOT ADD ANYTHING ELSE TO THIS SCRIPT, PLEASE USE THE +# SUBFOLDERS FOR EACH PLANET AND CREATE NEW SCRIPTS FOR +# EACH AREA OF A PLANET. - LEVARRIS +######################################################## + + + return \ No newline at end of file diff --git a/scripts/static_spawns/talus/placeholder.txt b/scripts/static_spawns/talus/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/static_spawns/tatooine.py b/scripts/static_spawns/tatooine.py deleted file mode 100644 index 1d7b383b..00000000 --- a/scripts/static_spawns/tatooine.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys -from resources.datatables import Options -from resources.datatables import StateStatus - -def addPlanetSpawns(core, planet): - - stcSvc = core.staticService - - # Objects - - stcSvc.spawnObject('object/tangible/terminal/shared_terminal_character_builder.iff', 'tatooine', long(0), float(3525), float(4), float(-4801), float(0.70), float(0.71)) - - # Buildings - - # Example - #building = stcSvc.spawnObject('object/building/myThatchedHut.iff', 'tatooine', long(0), float(3525), float(4), float(-4804), float(0.70), float(0.71)) - #stcSvc.spawnObject('object/mobile/shared_my_npc.iff', 'tatooine', building.getCellByCellNumber(7), float(3525), float(4), float(-4804), float(0.70), float(0.71)) - - # NPCs - - stcSvc.spawnObject('object/mobile/shared_respec_seller_f_1.iff', 'tatooine', long(0), float(3533.14), float(5), float(-4788.86), float(-0.3327), float(0.9288)) - - stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3525), float(4), float(-4804), float(0.70), float(0.71)) - - #stcSvc.spawnObject('object/mobile/shared_3po_protocol_droid_red.iff', 'tatooine', long(26582), float(-14.3), float(2.0), float(47.4), float(0.70), float(0.71)) - - return - diff --git a/scripts/static_spawns/tatooine/anchorhead.py b/scripts/static_spawns/tatooine/anchorhead.py new file mode 100644 index 00000000..379246f2 --- /dev/null +++ b/scripts/static_spawns/tatooine/anchorhead.py @@ -0,0 +1,51 @@ +import sys +# Project SWG: Anchorhead: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + # Cantina Interior + rebRecruiter = stcSvc.spawnObject('object/mobile/shared_dressed_rebel_recruiter_human_female_01.iff', 'tatooine', long(1213345), float(-2.2), float(0.4), float(-5.4), float(0), float(0)) + rebRecruiter.setOptionsBitmask(264) + + borraSetas = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_rodian_female_03.iff', 'tatooine', long(1213345), float(9.8), float(0.4), float(-1.2), float(-0.65), float(0.75)) + borraSetas.setCustomName2('Borra Setas') + borraSetas.setOptionsBitmask(256) + + # Outside + aaphKoden = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_aaph_koden.iff', 'tatooine', long(0), float(129), float(5.0), float(-5399), float(-0.67), float(0.73)) + aaphKoden.setCustomName2('Aaph Koden') + aaphKoden.setOptionsBitmask(256) + + Alger = stcSvc.spawnObject('object/mobile/shared_smuggler_fence_alger.iff', 'tatooine', long(0), float(107), float(5.0), float(-5315), float(0.96), float(0.26)) + Alger.setCustomName2('Alger') + Alger.setOptionsBitmask(256) + + carhlaBastra = stcSvc.spawnObject('object/mobile/shared_dressed_legacy_bastra.iff', 'tatooine', long(0), float(128), float(5.0), float(-5428), float(-0.26), float(0.96)) + carhlaBastra.setCustomName2('Carh\'la Bastra') + carhlaBastra.setOptionsBitmask(256) + + cuanTalon = stcSvc.spawnObject('object/mobile/shared_dressed_legacy_cuan.iff', 'tatooine', long(0), float(-161.7), float(65.0), float(-5322.8), float(0), float(0)) + cuanTalon.setCustomName2('Cuan Talon') + cuanTalon.setOptionsBitmask(256) + + dromaOrdo = stcSvc.spawnObject('object/mobile/shared_dressed_anchorjobs_ordo.iff', 'tatooine', long(0), float(110), float(52.0), float(-5431), float(0.36), float(0.93)) + dromaOrdo.setCustomName2('Droma Ordo') + dromaOrdo.setOptionsBitmask(256) + + Sorna = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_tosche_sorna.iff', 'tatooine', long(0), float(-135), float(52.0), float(-5331), float(0.36), float(0.93)) + Sorna.setCustomName2('Sorna') + Sorna.setOptionsBitmask(256) + return + diff --git a/scripts/static_spawns/tatooine/bestine.py b/scripts/static_spawns/tatooine/bestine.py new file mode 100644 index 00000000..caaeed4a --- /dev/null +++ b/scripts/static_spawns/tatooine/bestine.py @@ -0,0 +1,100 @@ +import sys +# Project SWG: Bestine: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + # City hall + indigoSiyan = stcSvc.spawnObject('object/mobile/shared_dressed_indigo_siyan.iff', 'tatooine', long(926483), float(24.7), float(3.2), float(-30.7), float(-0.06), float(0.99)) + indigoSiyan.setCustomName2('Indigo Siyan') + indigoSiyan.setOptionsBitmask(256) + + keanna = stcSvc.spawnObject('object/mobile/shared_dressed_keanna_likyna.iff', 'tatooine', long(926480), float(-18.7), float(3.2), float(20.6), float(-0.97), float(0.2)) + keanna.setCustomName2('Keanna Li\'kyna') + keanna.setOptionsBitmask(256) + + oberhaur = stcSvc.spawnObject('object/mobile/shared_space_imperial_tier2_tatooine_oberhaur.iff', 'tatooine', long(926480), float(-21.9), float(3.2), float(26.9), float(0.99), float(0.01)) + oberhaur.setCustomName2('Commander Oberhaur') + oberhaur.setOptionsBitmask(256) + + seanTrenwell = stcSvc.spawnObject('object/mobile/shared_dressed_sean_trenwell.iff', 'tatooine', long(926483), float(19.4), float(3.2), float(-36), float(-0.06), float(0.99)) + seanTrenwell.setCustomName2('Sean Trenwell') + seanTrenwell.setOptionsBitmask(256) + + talmont = stcSvc.spawnObject('object/mobile/shared_prefect_talmont.iff', 'tatooine', long(926475), float(-1.9), float(3.1), float(-10.3), float(0.99), float(0)) + talmont.setCustomName2('Prefect Talmont') + talmont.setOptionsBitmask(256) + + tourAryon = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_tour_aryon.iff', 'tatooine', long(926479), float(-36.8), float(1.3), float(0.3), float(0.8), float(0.59)) + tourAryon.setCustomName2('Tour Aryon') + tourAryon.setOptionsBitmask(256) + + victorVisalis = stcSvc.spawnObject('object/mobile/shared_dressed_victor_visalis.iff', 'tatooine', long(926480), float(-26.7), float(3.2), float(20.8), float(0.96), float(0.24)) + victorVisalis.setCustomName2('Victor Visalis') + victorVisalis.setOptionsBitmask(256) + + wilhalmSkrim = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_wilhalm_skrim.iff', 'tatooine', long(926482), float(28.9), float(1.3), float(-6.0), float(0.23), float(0.97)) + wilhalmSkrim.setCustomName2('Wilhalm Skrim') + wilhalmSkrim.setOptionsBitmask(256) + + + #Miscellaneous Building Interiors + akalColzet = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_trainer_space_01.iff', 'tatooine', long(1212359), float(0.7), float(1.8), float(-14), float(0), float(0.99)) + akalColzet.setCustomName2('lt. Akal Colzet') + akalColzet.setOptionsBitmask(256) + + fariousGletch = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_farious_gletch.iff', 'tatooine', long(1278989), float(2.0), float(-0.4), float(-5.7), float(-0.15), float(0.98)) + fariousGletch.setCustomName2('Farious Gletch') + fariousGletch.setOptionsBitmask(256) + + pfilbeeJhorn = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_pfilbee_jhorn.iff', 'tatooine', long(1279923), float(5.1), float(0.1), float(-3.8), float(-0.7), float(0.71)) + pfilbeeJhorn.setCustomName2('Pfilbee Jhorn') + pfilbeeJhorn.setOptionsBitmask(256) + + #Hotel interior + gilBurtin = stcSvc.spawnObject('object/mobile/shared_dressed_industrialist_trainer_01.iff', 'tatooine', long(1223850), float(20.3), float(1.6), float(12.8), float(0.99), float(0)) + gilBurtin.setCustomName2('Gil Burtin') + gilBurtin.setOptionsBitmask(256) + + # Outside + barak = stcSvc.spawnObject('object/mobile/shared_smuggler_broker_barak.iff', 'tatooine', long(0), float(-1049), float(5.0), float(-3537), float(0.97), float(0.23)) + barak.setCustomName2('Barak') + barak.setOptionsBitmask(256) + + barrezz = stcSvc.spawnObject('object/mobile/shared_dressed_dressed_legacy_barrezz.iff', 'tatooine', long(0), float(-1146.8), float(98.0), float(-3892.1), float(0.75), float(0.65)) + barrezz.setCustomName2('Commander Barrezz') + barrezz.setOptionsBitmask(256) + + jasha = stcSvc.spawnObject('object/mobile/shared_dressed_bestinejobs_jasha.iff', 'tatooine', long(0), float(-1128), float(98.0), float(-3900), float(-0.42), float(0.90)) + jasha.setCustomName2('Captain Jasha') + jasha.setOptionsBitmask(256) + + dkrn = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_general_m.iff', 'tatooine', long(0), float(-1160), float(5.0), float(-3525), float(0.90), float(-0.41)) + dkrn.setCustomName2('Commander D\'krn') + dkrn.setOptionsBitmask(256) + + gunham = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_lieutenant_m.iff', 'tatooine', long(0), float(-1125), float(12.2), float(-3620), float(0.9), float(0.42)) + gunham.setCustomName2('Commander Gunham') + gunham.setOptionsBitmask(256) + + kormundThrylle = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_kormund_thrylle.iff', 'tatooine', long(0), float(-1043), float(10.0), float(-3530), float(0.99), float(0.06)) + kormundThrylle.setCustomName2('Kormund Thrylle') + kormundThrylle.setOptionsBitmask(256) + + calebKnolar = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_major_cold_m.iff', 'tatooine', long(0), float(-1149), float(98.0), float(-3903), float(0.42), float(0.91)) + calebKnolar.setCustomName2('Major Caleb Knolar') + calebKnolar.setOptionsBitmask(256) + + return + diff --git a/scripts/static_spawns/tatooine/jabbas_palace.py b/scripts/static_spawns/tatooine/jabbas_palace.py new file mode 100644 index 00000000..df11aef4 --- /dev/null +++ b/scripts/static_spawns/tatooine/jabbas_palace.py @@ -0,0 +1,82 @@ +import sys +# Project SWG: Jabba's Palace: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + # TODO Verify proper cell IDs once Jabba's Palace is spawning properly again. + + reelo = stcSvc.spawnObject('object/mobile/shared_reelo_baruk.iff', 'tatooine', long(26560), float(-3.5), float(0.2), float(113.5), float(0), float(0)) + reelo.setCustomName2('Reelo Baruk') + reelo.setOptionsBitmask(264) + + reeyees = stcSvc.spawnObject('object/mobile/shared_dressed_gran_thug_male_01.iff', 'tatooine', long(26560), float(5.8), float(0.2), float(115.7), float(0.70), float(-0.71)) + reeyees.setCustomName2('Ree-Yees') + reeyees.setOptionsBitmask(264) + + ephant = stcSvc.spawnObject('object/mobile/shared_ephant_mon.iff', 'tatooine', long(26564), float(-6.1), float(5.8), float(86.1), float(0), float(0)) + ephant.setCustomName2('Ephant Mon') + ephant.setOptionsBitmask(264) + + porcellus = stcSvc.spawnObject('object/mobile/shared_dressed_porcellus.iff', 'tatooine', long(26572), float(-44.0), float(3.0), float(63.4), float(0), float(0)) + porcellus.setCustomName2('Porcellus') + porcellus.setOptionsBitmask(264) + + barada = stcSvc.spawnObject('object/mobile/shared_barada.iff', 'tatooine', long(26596), float(31.2), float(0.2), float(-1.0), float(0.98), float(-0.17)) + barada.setCustomName2('Barada') + barada.setOptionsBitmask(264) + + bibMain = stcSvc.spawnObject('object/mobile/shared_bib_fortuna.iff', 'tatooine', long(26582), float(-11.1), float(2.0), float(49.5), float(0.70), float(0.71)) + bibMain.setCustomName2('Bib Fortuna') + bibMain.setOptionsBitmask(264) + + jabba = stcSvc.spawnObject('object/mobile/shared_jabba_the_hutt.iff', 'tatooine', long(26582), float(-17.0), float(2.8), float(44.9), float(0.70), float(0.71)) + jabba.setCustomName2('Jabba the Hutt') + jabba.setOptionsBitmask(264) + + oola = stcSvc.spawnObject('object/mobile/shared_oola.iff', 'tatooine', long(26582), float(-10.3), float(2.0), float(43.9), float(0.70), float(-0.71)) + oola.setCustomName2('Oola') + oola.setOptionsBitmask(264) + + bobaFett = stcSvc.spawnObject('object/mobile/shared_boba_fett.iff', 'tatooine', long(26582), float(-1.0), float(3.0), float(33.1), float(0), float(0)) + bobaFett.setCustomName2('Boba Fett') + bobaFett.setOptionsBitmask(264) + + ev9d9 = stcSvc.spawnObject('object/mobile/shared_ev_9d9.iff', 'tatooine', long(26574), float(18.8), float(0.2), float(78.7), float(1.0), float(0)) + ev9d9.setCustomName2('EV-9D9') + ev9d9.setOptionsBitmask(264) + + malakili = stcSvc.spawnObject('object/mobile/shared_malakili.iff', 'tatooine', long(26599), float(17.3), float(-11.0), float(43.8), float(0), float(0)) + malakili.setCustomName2('Malakili') + malakili.setOptionsBitmask(264) + +# TODO Need to somehow get the cellID for the Rancor Pit or it will NEVER be spawned. + + maxRebo = stcSvc.spawnObject('object/mobile/shared_max_rebo.iff', 'tatooine', long(26582), float(-1.4), float(3.0), float(26.9), float(0.42), float(-0.9)) + maxRebo.setCustomName2('Max Rebo') + maxRebo.setOptionsBitmask(264) + + droopy = stcSvc.spawnObject('object/mobile/shared_droopy_mccool.iff', 'tatooine', long(26582), float(-3.9), float(3.0), float(26.1), float(0.42), float(-0.9)) + droopy.setCustomName2('Droopy McCool') + droopy.setOptionsBitmask(264) + + sySnootles = stcSvc.spawnObject('object/mobile/shared_sy_snootles.iff', 'tatooine', long(26582), float(-1.4), float(3.0), float(29.8), float(0.42), float(-0.)) + sySnootles.setCustomName2('Sy Snootles') + sySnootles.setOptionsBitmask(264) + + g5po = stcSvc.spawnObject('object/mobile/shared_3po_protocol_droid_red.iff', 'tatooine', long(26582), float(-14.3), float(2.0), float(47.4), float(0.70), float(0.71)) + g5po.setCustomName2('G5-PO') + g5po.setOptionsBitmask(264) + return + diff --git a/scripts/static_spawns/tatooine/jawa_sandcrawler_legacy.py b/scripts/static_spawns/tatooine/jawa_sandcrawler_legacy.py new file mode 100644 index 00000000..4a4d0c61 --- /dev/null +++ b/scripts/static_spawns/tatooine/jawa_sandcrawler_legacy.py @@ -0,0 +1,25 @@ +import sys +# Project SWG: Jawa Sandcrawler - Legacy Quest Area: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + #Outside + fa2po = stcSvc.spawnObject('object/mobile/shared_3po_protocol_droid.iff', 'tatooine', long(0), float(-3805.7), float(30.4), float(-4721.6), float(0), float(0)) + fa2po.setCustomName2('FA-2PO') + fa2po.setOptionsBitmask(256) + + + return + diff --git a/scripts/static_spawns/tatooine/lars_homestead.py b/scripts/static_spawns/tatooine/lars_homestead.py new file mode 100644 index 00000000..88c7b417 --- /dev/null +++ b/scripts/static_spawns/tatooine/lars_homestead.py @@ -0,0 +1,25 @@ +import sys +# Project SWG: Mos Entha: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + #Outside + zefAndo = stcSvc.spawnObject('object/mobile/shared_dressed_legacy_zef.iff', 'tatooine', long(0), float(-2574.9), float(0), float(-5516.7), float(0), float(0)) + zefAndo.setCustomName2('Zef Ando') + zefAndo.setOptionsBitmask(256) + + + return + diff --git a/scripts/static_spawns/tatooine/mos_eisley.py b/scripts/static_spawns/tatooine/mos_eisley.py new file mode 100644 index 00000000..8b3ac25f --- /dev/null +++ b/scripts/static_spawns/tatooine/mos_eisley.py @@ -0,0 +1,336 @@ +import sys +# Project SWG: Mos Eisley: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + #Cantina Interior + wuher = stcSvc.spawnObject('object/mobile/shared_wuher.iff', 'tatooine', long(1082877), float(8.6), float(-0.9), float(0.4), float(0.71), float(0.71)) + wuher.setCustomName2('Wuher') + wuher.setOptionsBitmask(256) + + chadraFanFemale = stcSvc.spawnObject('object/mobile/shared_chadra_fan_female.iff', 'tatooine', long(1082877), float(10.6), float(-0.9), float(-1.5), float(0.42), float(0.90)) + chadraFanFemale.setCustomName2('a Chadra Fan Female') + chadraFanFemale.setOptionsBitmask(256) + + chadraFanMale = stcSvc.spawnObject('object/mobile/shared_chadra_fan_male.iff', 'tatooine', long(1082877), float(10.7), float(-0.9), float(-0.3), float(0.64), float(0.77)) + chadraFanMale.setCustomName2('a Chadra Fan Male') + chadraFanMale.setOptionsBitmask(256) + + muftak = stcSvc.spawnObject('object/mobile/shared_muftak.iff', 'tatooine', long(1082877), float(20.3), float(-0.9), float(4.9), float(0.82), float(0.57)) + muftak.setCustomName2('Muftak') + muftak.setOptionsBitmask(256) + + chissMale1 = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_etyyy_chiss_poacher_01.iff', 'tatooine', long(1082877), float(1.7), float(-0.9), float(-5.0), float(0.71), float(0.71)) + chissMale1.setCustomName2('a Chiss Male') + chissMale1.setOptionsBitmask(256) + + chissMale2 = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_etyyy_chiss_poacher_02.iff', 'tatooine', long(1082877), float(3.4), float(-0.9), float(-4.8), float(0), float(0)) + chissMale2.setCustomName2('a Chiss Male') + chissMale2.setOptionsBitmask(256) + + cantinaStorm = stcSvc.spawnObject('object/mobile/shared_stormtrooper.iff', 'tatooine', long(1082877), float(2.9), float(-0.9), float(-6.5), float(0.71), float(0.71)) + cantinaStorm.setCustomName2('a Stormtrooper') + cantinaStorm.setOptionsBitmask(256) + + cantinaStormL = stcSvc.spawnObject('object/mobile/shared_stormtrooper_groupleader.iff', 'tatooine', long(1082877), float(3.6), float(-0.9), float(-7.9), float(0.71), float(0.71)) + cantinaStormL.setCustomName2('a Stormtrooper Squad Leader') + cantinaStormL.setOptionsBitmask(256) + + figrinDan = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(3.7), float(-0.9), float(-14.4), float(0.42), float(0.91)) + figrinDan.setCustomName2('Figrin D\'an') + figrinDan.setOptionsBitmask(256) + + techMor = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(4.0), float(-0.9), float(-17.0), float(0.42), float(0.91)) + techMor.setCustomName2('Tech M\'or') + techMor.setOptionsBitmask(256) + + doikkNats = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(2.2), float(-0.9), float(-16.4), float(0.42), float(0.91)) + doikkNats.setCustomName2('Doikk Na\'ts') + doikkNats.setOptionsBitmask(256) + + tednDahai = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(1.3), float(-0.9), float(-15.2), float(0.42), float(0.91)) + tednDahai.setCustomName2('Tedn Dahai') + tednDahai.setOptionsBitmask(256) + + nalanCheel = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(0.5), float(-0.9), float(-17.1), float(0.42), float(0.91)) + nalanCheel.setCustomName2('Nalan Cheel') + nalanCheel.setOptionsBitmask(256) + + businessman1 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(1082877), float(11.0), float(-0.9), float(2.1), float(0.38), float(-0.92)) + businessman1.setCustomName2('a Businessman') + businessman1.setOptionsBitmask(256) + + commoner1 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_male_01.iff', 'tatooine', long(1082877), float(10.3), float(-0.9), float(2.7), float(0.82), float(0.57)) + commoner1.setCustomName2('a Commoner') + commoner1.setOptionsBitmask(256) + + entertainer1 = stcSvc.spawnObject('object/mobile/shared_dressed_entertainer_trainer_twk_female_01.iff', 'tatooine', long(1082877), float(9.4), float(-0.9), float(3.9), float(0.38), float(-0.92)) + entertainer1.setCustomName2('an Entertainer') + entertainer1.setOptionsBitmask(256) + + noble1 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_trandoshan_male_01.iff', 'tatooine', long(1082877), float(8.6), float(-0.9), float(4.8), float(0.82), float(0.57)) + noble1.setCustomName2('a Noble') + noble1.setOptionsBitmask(256) + + commoner2 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_female_01.iff', 'tatooine', long(1082877), float(4.1), float(-0.9), float(5.7), float(1), float(0)) + commoner2.setCustomName2('a Commoner') + commoner2.setOptionsBitmask(256) + + commoner3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_female_01.iff', 'tatooine', long(1082877), float(3.1), float(-0.9), float(5.9), float(1), float(0)) + commoner3.setCustomName2('a Commoner') + commoner3.setOptionsBitmask(256) + + commoner4 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_twilek_male_01.iff', 'tatooine', long(1082877), float(1.7), float(-0.9), float(6.0), float(1), float(0)) + commoner4.setCustomName2('a Commoner') + commoner4.setOptionsBitmask(256) + + commoner5 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_male_01.iff', 'tatooine', long(1082877), float(-0.4), float(-0.9), float(5.9), float(1), float(0)) + commoner5.setCustomName2('a Commoner') + commoner5.setOptionsBitmask(256) + + commoner6 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_05.iff', 'tatooine', long(1082877), float(16.0), float(-0.9), float(4.1), float(0), float(0)) + commoner6.setCustomName2('a Commoner') + commoner6.setOptionsBitmask(256) + + commoner7 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_zabrak_male_01.iff', 'tatooine', long(1082877), float(8.8), float(-0.9), float(-6.0), float(0.98), float(-0.22)) + commoner7.setCustomName2('a Patron') + commoner7.setOptionsBitmask(256) + + commoner8 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_08.iff', 'tatooine', long(1082877), float(6.8), float(-0.9), float(-6.5), float(0.98), float(-0.22)) + commoner8.setCustomName2('a Patron') + commoner8.setOptionsBitmask(256) + + commoner9 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_male_09.iff', 'tatooine', long(1082877), float(1.1), float(-0.9), float(-7.7), float(0.42), float(0.91)) + commoner9.setCustomName2('a Commoner') + commoner9.setOptionsBitmask(256) + + commoner10 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_nikto_male_04.iff', 'tatooine', long(1082877), float(2.1), float(-0.9), float(-8.4), float(0.42), float(0.91)) + commoner10.setCustomName2('a Commoner') + commoner10.setOptionsBitmask(256) + + anetiaKahryn = stcSvc.spawnObject('object/mobile/shared_dressed_twk_entertainer.iff', 'tatooine', long(1082878), float(19.8), float(-0.9), float(-21), float(-0.03), float(0.99)) + anetiaKahryn.setCustomName2('Anetia Kah\'ryn') + anetiaKahryn.setOptionsBitmask(256) + + dravis = stcSvc.spawnObject('object/mobile/shared_space_privateer_tier1_tatooine.iff', 'tatooine', long(1082886), float(-21.7), float(-0.9), float(25.5), float(0.99), float(0.03)) + dravis.setCustomName2('Dravis') + dravis.setOptionsBitmask(256) + + talonKarrde = stcSvc.spawnObject('object/mobile/shared_dressed_talon_karrde.iff', 'tatooine', long(1082887), float(-25.7), float(-0.5), float(8.8), float(0.21), float(0.97)) + talonKarrde.setCustomName2('Talon Karrde') + talonKarrde.setOptionsBitmask(256) + + #Starport Interior + + bartender1 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_nikto_male_04.iff', 'tatooine', long(1106380), float(-59.1), float(2.6), float(39.5), float(0), float(0)) + bartender1.setCustomName2('a Bartender') + bartender1.setOptionsBitmask(256) + + #City Hall Interior + + #Lucky Despot Interior TODO: Check Cell IDs for Spawned NPCS inside once Lucky Despot is spawning properly again. + + hansolo1 = stcSvc.spawnObject('object/mobile/shared_han_solo.iff', 'tatooine', long(26949), float(32.3), float(7.0), float(1.6), float(0), float(0)) + hansolo1.setCustomName2('Han Solo') + hansolo1.setOptionsBitmask(256) + + #Medical Center Interior + + #Theater Interior + + #Miscellaneous Building Interiors + + #Outside + businessman2 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(0), float(3663.3), float(4.0), float(-4738.6), float(0), float(0)) + businessman2.setCustomName2('a Businessman') + businessman2.setOptionsBitmask(256) + + noble2 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_01.iff', 'tatooine', long(0), float(3542.3), float(5.0), float(-4826.0), float(0.42), float(0.91)) + noble2.setCustomName2('a Noble') + noble2.setOptionsBitmask(256) + + commoner11 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_06.iff', 'tatooine', long(0), float(3529.1), float(5.0), float(-4900.4), float(0.42), float(0.91)) + commoner11.setCustomName2('a Commoner') + commoner11.setOptionsBitmask(256) + + businessman3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_male_02.iff', 'tatooine', long(0), float(3595.7), float(5.0), float(-4740.1), float(0), float(0)) + businessman3.setCustomName2('a Businessman') + businessman3.setOptionsBitmask(256) + + jawa1 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3663.3), float(5.0), float(-4858.6), float(0), float(0)) + jawa1.setCustomName2('a Jawa') + jawa1.setOptionsBitmask(256) + + commoner12 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_moncal_male_01.iff', 'tatooine', long(0), float(3490.3), float(5.0), float(-4799.4), float(0), float(0)) + commoner12.setCustomName2('a Scientist') + commoner12.setOptionsBitmask(256) + + commoner13 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_zabrak_female_02.iff', 'tatooine', long(0), float(3559.7), float(5.0), float(-4725.9), float(0), float(0)) + commoner13.setCustomName2('a Commoner') + commoner13.setOptionsBitmask(256) + + commoner14 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_devaronian_male_01.iff', 'tatooine', long(0), float(3527.7), float(5.0), float(-4721.1), float(0.71), float(0.71)) + commoner14.setCustomName2('a Commoner') + commoner14.setOptionsBitmask(256) + + commoner15 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_female_01.iff', 'tatooine', long(0), float(3514.9), float(5.0), float(-4737.8), float(0), float(0)) + commoner15.setCustomName2('a Commoner') + commoner15.setOptionsBitmask(256) + + jawa2 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3485.2), float(4.9), float(-4859.2), float(0), float(0)) + jawa2.setCustomName2('a Jawa') + jawa2.setOptionsBitmask(256) + + jawa3 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3465.3), float(5.0), float(-4860.1), float(0.71), float(-0.71)) + jawa3.setCustomName2('a Jawa') + jawa3.setOptionsBitmask(256) + + jawa4 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3486.8), float(5.0), float(-4884.7), float(0.43051), float(-0.9025)) + jawa4.setCustomName2('a Jawa') + jawa4.setOptionsBitmask(256) + + jawa5 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3487.1), float(5.0), float(-4886.0), float(0.95105), float(0.3090)) + jawa5.setCustomName2('a Jawa') + jawa5.setOptionsBitmask(256) + + jawa6 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3488.8), float(5.0), float(-4884.4), float(0.3255), float(-0.9455)) + jawa6.setCustomName2('a Jawa') + jawa6.setOptionsBitmask(256) + + jawa7 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3472.2), float(5.0), float(-4918.4), float(0), float(0)) + jawa7.setCustomName2('a Jawa') + jawa7.setOptionsBitmask(256) + + jawa8 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3471.4), float(5.0), float(-4919.5), float(0), float(0)) + jawa8.setCustomName2('a Jawa') + jawa8.setOptionsBitmask(256) + + jawa9 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3470.3), float(5.0), float(-4918.7), float(0), float(0)) + jawa9.setCustomName2('a Jawa') + jawa9.setOptionsBitmask(256) + + bib = stcSvc.spawnObject('object/mobile/shared_bib_fortuna.iff', 'tatooine', long(0), float(3552.4), float(5.0), float(-4933.2), float(0.31730), float(-0.9483)) + bib.setCustomName2('Bib Fortuna') + bib.setOptionsBitmask(256) + + commoner16 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_06.iff', 'tatooine', long(0), float(3398.2), float(4.0), float(-4654.2), float(0.42), float(0.91)) + commoner16.setCustomName2('a Commoner') + commoner16.setOptionsBitmask(256) + + noble3 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_01.iff', 'tatooine', long(0), float(3396.3), float(4.0), float(-4774.1), float(0.42), float(0.91)) + noble3.setCustomName2('a Noble') + noble3.setOptionsBitmask(256) + + entertainer1 = stcSvc.spawnObject('object/mobile/shared_dressed_entertainer_trainer_twk_female_01.iff', 'tatooine', long(0), float(3305.7), float(5.6), float(-4771.7), float(0), float(0)) + entertainer1.setCustomName2('an Entertainer') + entertainer1.setOptionsBitmask(256) + + r3m6 = stcSvc.spawnObject('object/mobile/shared_r3.iff', 'tatooine', long(0), float(3460.1), float(4.0), float(-4898.2), float(0.38), float(-0.92)) + r3m6.setCustomName2('R3-M6') + r3m6.setOptionsBitmask(256) + + eg1 = stcSvc.spawnObject('object/mobile/shared_eg6_power_droid.iff', 'tatooine', long(0), float(3463.8), float(4.0), float(-4882.6), float(-0.38), float(0.92)) + eg1.setCustomName2('an EG-6 Power Droid') + eg1.setOptionsBitmask(256) + + commoner17 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_zabrak_female_02.iff', 'tatooine', long(0), float(3452.6), float(4.0), float(-4937.1), float(0), float(0)) + commoner17.setCustomName2('a Commoner') + commoner17.setOptionsBitmask(256) + + lifter1 = stcSvc.spawnObject('object/mobile/shared_cll8_binary_load_lifter.iff', 'tatooine', long(0), float(3547), float(5.0), float(-4768.9), float(0), float(0)) + lifter1.setCustomName2('a CLL-8 Binary Load Lifter') + lifter1.setOptionsBitmask(256) + + r3j7 = stcSvc.spawnObject('object/mobile/shared_r3.iff', 'tatooine', long(0), float(3311.1), float(4.0), float(-4820.2), float(0.38), float(-0.92)) + r3j7.setCustomName2('R3-J7') + r3j7.setOptionsBitmask(256) + + noble4 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_03.iff', 'tatooine', long(0), float(3255.3), float(4.0), float(-4848.1), float(0.42), float(0.91)) + noble4.setCustomName2('a Noble') + noble4.setOptionsBitmask(256) + + byxlePedette = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_byxle.iff', 'tatooine', long(0), float(3365), float(5), float(-4639), float(0.99), float(0.12)) + byxlePedette.setOptionsBitmask(264) + + errikDarksider = stcSvc.spawnObject('object/mobile/shared_dressed_herald_tatooine_01.iff', 'tatooine', long(0), float(3381), float(4.6), float(-4498), float(0.91), float(0.40)) + errikDarksider.setCustomName2('Errik Darksider') + errikDarksider.setOptionsBitmask(256) + + gendra = stcSvc.spawnObject('object/mobile/shared_dressed_gendra.iff', 'tatooine', long(0), float(3308), float(5.6), float(-4785), float(0.84), float(0.53)) + gendra.setOptionsBitmask(264) + + lurval = stcSvc.spawnObject('object/mobile/shared_lurval.iff', 'tatooine', long(0), float(3387), float(5), float(-4791), float(-0.4), float(0.91)) + lurval.setCustomName2('Lurval') + lurval.setOptionsBitmask(256) + + matildaCarson = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_02.iff', 'tatooine', long(0), float(3490.2), float(5), float(-4778), float(0.87), float(0.48)) + matildaCarson.setCustomName2('Matilda Carson') + matildaCarson.setOptionsBitmask(256) + + vanvi = stcSvc.spawnObject('object/mobile/shared_dressed_bestine_artist01.iff', 'tatooine', long(0), float(3312), float(5), float(-4655), float(0.95), float(-0.28)) + vanvi.setCustomName2('Vanvi Hotn') + vanvi.setOptionsBitmask(256) + + #Eisley Legacy Quest NPCs + + vourk = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_santos.iff', 'tatooine', long(0), float(3520.0), float(5.0), float(-4821.0), float(0.42), float(0.91)) + vourk.setCustomName2('Vourk Ver\'Zremp') + vourk.setOptionsBitmask(256) + + mayor = stcSvc.spawnObject('object/mobile/shared_dressed_mayor_mikdanyell_guhrantt.iff', 'tatooine', long(1279960), float(1.2), float(2.5), float(5.4), float(0), float(0)) + mayor.setOptionsBitmask(264) + + enthaKandela = stcSvc.spawnObject('object/mobile/shared_dressed_entha_kandela.iff', 'tatooine', long(0), float(3511), float(5.0), float(-4785), float(0.70), float(0.71)) + enthaKandela.setCustomName2('Entha Kandela') + enthaKandela.setOptionsBitmask(256) + + purvis = stcSvc.spawnObject('object/mobile/shared_dressed_purvis_arrison.iff', 'tatooine', long(0), float(3512.4), float(5.0), float(-4764.9), float(0.38), float(-0.92)) + purvis.setCustomName2('Purvis Arrison') + purvis.setOptionsBitmask(256) + + peawpRdawc = stcSvc.spawnObject('object/mobile/shared_peawp_bodyguard_trainer.iff', 'tatooine', long(1189639), float(-11.8), float(1.1), float(-10.1), float(0), float(0)) + peawpRdawc.setCustomName2('Peawp R\'dawc') + peawpRdawc.setOptionsBitmask(256) + + nikoBrehe = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_niko.iff', 'tatooine', long(0), float(3506.7), float(5.0), float(-4795.8), float(0.70), float(0.71)) + nikoBrehe.setOptionsBitmask(264) + + dunir = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_opening_dunir.iff', 'tatooine', long(0), float(3520.7), float(5.0), float(-4683.7), float(0.99), float(-0.08)) + dunir.setOptionsBitmask(264) + + #Eisley Ship Controller + stcSvc.spawnObject('object/mobile/shared_distant_ship_controller.iff', 'tatooine', long(0), float(3542.3), float(5.0), float(-4826.0), float(0.42), float(0.91)) + + #recruiters + impRecruiter = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_officer_f.iff', 'tatooine', long(1280132), float(-6), float(1), float(9.2), float(0.70), float(0.71)) + impRecruiter.setOptionsBitmask(264) + + + + #Profession Counselor + stcSvc.spawnObject('object/mobile/shared_respec_seller_f_1.iff', 'tatooine', long(0), float(3533.14), float(5), float(-4788.86), float(-0.3327), float(0.9288)) + + #Junk Dealers + stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3355), float(5), float(-4823), float(0.71), float(0.71)) + stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3412), float(5), float(-4713), float(0.71), float(-0.71)) + stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3500), float(5), float(-4960), float(0), float(0)) + stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3497), float(5), float(-4928), float(0), float(1)) + stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3377), float(5), float(-4524), float(0.71), float(0.71)) + stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3271), float(5), float(-4704), float(0), float(0)) + stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3476), float(5), float(-4665), float(0.71), float(0.71)) + + + return + diff --git a/scripts/static_spawns/tatooine/mos_entha.py b/scripts/static_spawns/tatooine/mos_entha.py new file mode 100644 index 00000000..e99d36ea --- /dev/null +++ b/scripts/static_spawns/tatooine/mos_entha.py @@ -0,0 +1,25 @@ +import sys +# Project SWG: Mos Entha: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + #Outside + ankwee = stcSvc.spawnObject('object/mobile/shared_dressed_tatooine_entha_ankwee.iff', 'tatooine', long(0), float(1351), float(5.0), float(3108), float(0.42), float(0.91)) + ankwee.setCustomName2('An\'kwee') + ankwee.setOptionsBitmask(256) + + + return + diff --git a/scripts/static_spawns/tatooine/mos_espa.py b/scripts/static_spawns/tatooine/mos_espa.py new file mode 100644 index 00000000..6cb589b3 --- /dev/null +++ b/scripts/static_spawns/tatooine/mos_espa.py @@ -0,0 +1,69 @@ +import sys +# Project SWG: Mos Espa: Static Spawns +# (C)2014 ProjectSWG + + + +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): + + + stcSvc = core.staticService + objSvc = core.objectService + + # TODO Check all NPCs for personalized scripting, change format. + + # Cantina Interior + dalaSocuna = stcSvc.spawnObject('object/mobile/shared_space_rebel_tier1_tatooine_socuna.iff', 'tatooine', long(1256068), float(-28.4), float(-0.5), float(9.4), float(0.33), float(0.94)) + dalaSocuna.setCustomName2('Commander Da\'la Socuna') + dalaSocuna.setOptionsBitmask(256) + + #Watto's Shop ****TODO: Get Proper cells for Watto's Shop once Buildout structures are spawning as intended again. + + watto = stcSvc.spawnObject('object/mobile/shared_watto.iff', 'tatooine', long(26670), float(4.7), float(-0.5), float(2.4), float(0.70), float(-0.71)) + watto.setCustomName2('Watto') + watto.setOptionsBitmask(256) + + #Exterior Uninteractable NPCs + commoner18 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_zabrak_female_02.iff', 'tatooine', long(0), float(-2915.3), float(5.0), float(2148.5), float(0), float(0)) + commoner18.setCustomName2('a Commoner') + commoner18.setOptionsBitmask(256) + + jawa10 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(-2966.3), float(5.0), float(2196.9), float(0), float(0)) + jawa10.setCustomName2('a Jawa') + jawa10.setOptionsBitmask(256) + + commoner19 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_06.iff', 'tatooine', long(0), float(-2960.4), float(5.0), float(2271.3), float(0), float(0)) + commoner19.setCustomName2('a Commoner') + commoner19.setOptionsBitmask(256) + + commoner20 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_devaronian_male_01.iff', 'tatooine', long(0), float(-2934.3), float(5.0), float(2298.9), float(0.71), float(0.71)) + commoner20.setCustomName2('a Commoner') + commoner20.setOptionsBitmask(256) + + commoner21 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_01.iff', 'tatooine', long(0), float(-2897.7), float(5.0), float(2345.4), float(0.71), float(0.71)) + commoner21.setCustomName2('a Commoner') + commoner21.setOptionsBitmask(256) + + commoner22 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_twilek_male_01.iff', 'tatooine', long(0), float(-2763.8), float(5.0), float(2305.2), float(0.71), float(0.71)) + commoner22.setCustomName2('a Commoner') + commoner22.setOptionsBitmask(256) + + jawa11 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(-2936.8), float(5.0), float(2078.4), float(0.95105), float(0.3090)) + jawa11.setCustomName2('a Jawa') + jawa11.setOptionsBitmask(256) + + businessman4 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_male_02.iff', 'tatooine', long(0), float(-2914.2), float(5.0), float(2022.4), float(0), float(0)) + businessman4.setCustomName2('a Businessman') + businessman4.setOptionsBitmask(256) + + commoner23 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_moncal_male_01.iff', 'tatooine', long(0), float(-2904.1), float(5.0), float(1965.3), float(0.71), float(0.71)) + commoner23.setCustomName2('a Commoner') + commoner23.setOptionsBitmask(256) + + + + return + diff --git a/scripts/static_spawns/tatooine/tatooine.py b/scripts/static_spawns/tatooine/tatooine.py new file mode 100644 index 00000000..9a45d308 --- /dev/null +++ b/scripts/static_spawns/tatooine/tatooine.py @@ -0,0 +1,21 @@ +import sys +from resources.datatables import Options +from resources.datatables import State + +def addPlanetSpawns(core, planet): +######################################################## +# DO NOT ADD ANYTHING ELSE TO THIS SCRIPT, PLEASE USE THE +# SUBFOLDERS FOR EACH PLANET AND CREATE NEW SCRIPTS FOR +# EACH AREA OF A PLANET. - LEVARRIS +######################################################## + stcSvc = core.staticService + # Blue Frog: Uncomment only when needed for testing. + stcSvc.spawnObject('object/tangible/terminal/shared_terminal_character_builder.iff', 'tatooine', long(0), float(3525), float(4), float(-4801), float(0.70), float(0.71)) + +######################################################## +# DO NOT ADD ANYTHING ELSE TO THIS SCRIPT, PLEASE USE THE +# SUBFOLDERS FOR EACH PLANET AND CREATE NEW SCRIPTS FOR +# EACH AREA OF A PLANET. - LEVARRIS +######################################################## + return + diff --git a/scripts/static_spawns/yavin4/placeholder.txt b/scripts/static_spawns/yavin4/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 18f15e3d..1fb03377 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -45,9 +45,13 @@ import com.sleepycat.persist.EntityCursor; import protocol.swg.chat.ChatSystemMessage; import net.engio.mbassy.bus.config.BusConfiguration; +import resources.common.BountyListItem; import resources.common.RadialOptions; import resources.common.ThreadMonitor; import resources.objects.creature.CreatureObject; +import resources.objects.guild.GuildObject; +import resources.objects.resource.GalacticResource; +import resources.objects.resource.ResourceRoot; import services.AttributeService; import services.BuffService; import services.CharacterService; @@ -71,8 +75,11 @@ import services.SurveyService; import services.TerrainService; import services.WeatherService; import services.ai.AIService; +import services.bazaar.AuctionItem; import services.bazaar.BazaarService; +import services.chat.ChatRoom; import services.chat.ChatService; +import services.chat.Mail; import services.collections.CollectionService; import services.combat.CombatService; import services.command.CombatCommand; @@ -83,6 +90,8 @@ import services.guild.GuildService; import services.LoginService; import services.map.MapService; import services.mission.MissionService; +import services.object.DuplicateId; +import services.object.ObjectId; import services.object.ObjectService; import services.object.UpdateService; import services.pet.MountService; @@ -110,6 +119,7 @@ import engine.resources.config.Config; import engine.resources.config.DefaultConfig; import engine.resources.container.Traverser; import engine.resources.database.DatabaseConnection; +import engine.resources.database.ODBCursor; import engine.resources.database.ObjectDatabase; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; @@ -199,7 +209,6 @@ public class NGECore { public InteractiveJythonAcceptor jythonAcceptor; private InteractiveJythonServer jythonServer; - private ObjectDatabase creatureODB; private ObjectDatabase mailODB; private ObjectDatabase guildODB; private ObjectDatabase objectIdODB; @@ -208,11 +217,11 @@ public class NGECore { private BusConfiguration eventBusConfig = BusConfiguration.Default(1, new ThreadPoolExecutor(1, 4, 1, TimeUnit.MINUTES, new LinkedBlockingQueue())); - private ObjectDatabase buildingODB; private ObjectDatabase auctionODB; private ObjectDatabase resourcesODB; private ObjectDatabase resourceRootsODB; private ObjectDatabase resourceHistoryODB; + private ObjectDatabase swgObjectODB; private ObjectDatabase bountiesODB; public static boolean PACKET_DEBUG = false; @@ -264,18 +273,17 @@ public class NGECore { } setGalaxyStatus(1); - creatureODB = new ObjectDatabase("creature", true, false, true); - buildingODB = new ObjectDatabase("building", true, false, true); - mailODB = new ObjectDatabase("mails", true, false, true); - guildODB = new ObjectDatabase("guild", true, false, true); - objectIdODB = new ObjectDatabase("oids", true, false, false); - duplicateIdODB = new ObjectDatabase("doids", true, false, true); - chatRoomODB = new ObjectDatabase("chatRooms", true, false, true); - resourcesODB = new ObjectDatabase("resources", true, false, true); - resourceRootsODB = new ObjectDatabase("resourceroots", true, false, true); - resourceHistoryODB = new ObjectDatabase("resourcehistory", true, false, true); - auctionODB = new ObjectDatabase("auction", true, false, true); - bountiesODB = new ObjectDatabase("bounties", true, false, true); + swgObjectODB = new ObjectDatabase("swgobjects", true, true, true, SWGObject.class); + mailODB = new ObjectDatabase("mails", true, true, true, Mail.class); + guildODB = new ObjectDatabase("guild", true, true, true, GuildObject.class); + objectIdODB = new ObjectDatabase("oids", true, true, true, ObjectId.class); + duplicateIdODB = new ObjectDatabase("doids", true, true, true, DuplicateId.class); + chatRoomODB = new ObjectDatabase("chatRooms", true, true, true, ChatRoom.class); + resourcesODB = new ObjectDatabase("resources", true, true, true, GalacticResource.class); + resourceRootsODB = new ObjectDatabase("resourceroots", true, true, true, ResourceRoot.class); + resourceHistoryODB = new ObjectDatabase("resourcehistory", true, true, true, GalacticResource.class); + auctionODB = new ObjectDatabase("auction", true, true, true, AuctionItem.class); + bountiesODB = new ObjectDatabase("bounties", true, true, true, BountyListItem.class); // Services loginService = new LoginService(this); @@ -483,6 +491,7 @@ public class NGECore { spawnService.loadMobileTemplates(); spawnService.loadLairTemplates(); spawnService.loadLairGroups(); + spawnService.loadDynamicGroups();; spawnService.loadSpawnAreas(); equipmentService.loadBonusSets(); @@ -497,24 +506,21 @@ public class NGECore { } private void cleanupCreatureODB() { - EntityCursor cursor = creatureODB.getCursor(Long.class, CreatureObject.class); + ODBCursor cursor = swgObjectODB.getCursor(); - Iterator it = cursor.iterator(); List deletedObjects = new ArrayList(); - while(it.hasNext()) { - CreatureObject creature = it.next(); - if(!characterService.playerExists(creature.getObjectID())) - deletedObjects.add(creature); + while(cursor.hasNext()) { + SWGObject creature = (SWGObject) cursor.next(); + if(!characterService.playerExists(creature.getObjectID()) && creature instanceof CreatureObject) + deletedObjects.add((CreatureObject) creature); } - cursor.close(); - Transaction txn = creatureODB.getEnvironment().beginTransaction(null, null); for(CreatureObject creature : deletedObjects) { - creatureODB.delete(creature.getObjectID(), Long.class, CreatureObject.class, txn); + swgObjectODB.remove(creature.getObjectID()); } - txn.commitSync(); + System.out.println("Deleted " + deletedObjects.size() + " creatures."); } @@ -600,8 +606,8 @@ public class NGECore { return databaseConnection2; } - public ObjectDatabase getCreatureODB() { - return creatureODB; + public ObjectDatabase getSWGObjectODB() { + return swgObjectODB; } public ObjectDatabase getMailODB() { @@ -611,11 +617,7 @@ public class NGECore { public ObjectDatabase getGuildODB() { return guildODB; } - - public ObjectDatabase getBuildingODB() { - return buildingODB; - } - + public ObjectDatabase getObjectIdODB() { return objectIdODB; } @@ -744,6 +746,19 @@ public class NGECore { return System.currentTimeMillis() - galacticTime; } + public void closeODBs() { + swgObjectODB.close(); + mailODB.close(); + guildODB.close(); + chatRoomODB.close(); + resourcesODB.close(); + resourceRootsODB.close(); + resourceHistoryODB.close(); + objectIdODB.close(); + duplicateIdODB.close(); + auctionODB.close(); + } + } diff --git a/src/protocol/swg/CommPlayerMessage.java b/src/protocol/swg/CommPlayerMessage.java index 5d1274c8..9acde60c 100644 --- a/src/protocol/swg/CommPlayerMessage.java +++ b/src/protocol/swg/CommPlayerMessage.java @@ -25,15 +25,16 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; -import resources.common.Console; +import engine.resources.common.CRC; import resources.common.OutOfBand; -import resources.common.StringUtilities; public class CommPlayerMessage extends SWGMessage { private long objectId; + private String model; private OutOfBand outOfBand; - + private int time; + public CommPlayerMessage(long objectId, OutOfBand outOfBand) { this.objectId = objectId; this.outOfBand = outOfBand; @@ -46,28 +47,35 @@ public class CommPlayerMessage extends SWGMessage { @Override public IoBuffer serialize() { - IoBuffer buffer = IoBuffer.allocate(200).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = IoBuffer.allocate(50).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short) 2); buffer.putInt(0x594AD258); buffer.put((byte) 0); // aurebesh borders on comm, space version? Can cause crashes buffer.putLong(objectId); - /* Seen numbers: - * 52 (Starting Station Comms) - * 54 (Tansarii Comms) - * 57 (Supply Drops) - * 58 (Faction Covert->Overt) - * 68 (Imperial stop) - */ buffer.put(outOfBand.serialize().array()); // Officer Supply Drop: 0x3E894347 // Rebel Faction Dude: 0x528CB3D7 - buffer.putInt(0x528CB3D7); // model crc, can be anything w/o crashing + if (model == null) + buffer.putInt(0x3E894347); + else + buffer.putInt(CRC.StringtoCRC(model)); buffer.putInt(0); // sound buffer.putShort((short) 0); // unk - buffer.putShort((short) 16576); // comm display time, unsure on how it's calculated (probably milliseconds) + if (time == 0) + buffer.putShort((short) 16576); + else + buffer.putShort((short) time); buffer.flip(); - Console.println("CPM: " + StringUtilities.bytesToHex(buffer.array())); return buffer; } + + public void setModel(String model) { + this.model = model; + } + public void setTime(int time) { + this.time = time; + } } diff --git a/src/resources/buffs/Buff.java b/src/resources/buffs/Buff.java index 52b9613e..24d4937f 100644 --- a/src/resources/buffs/Buff.java +++ b/src/resources/buffs/Buff.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.buffs; +import java.io.Serializable; import java.nio.ByteOrder; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledFuture; @@ -40,10 +41,11 @@ import com.sleepycat.persist.model.Persistent; import engine.resources.common.CRC; @Persistent(version=10) -public class Buff implements IDelta { +public class Buff implements IDelta, Serializable { + private static final long serialVersionUID = 1L; @NotPersistent - private SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); + private transient SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); private String group1, group2; private int priority; private float duration; @@ -65,7 +67,7 @@ public class Buff implements IDelta { private int totalPlayTime; private byte decayCounter = 0; @NotPersistent - private ScheduledFuture removalTask; + private transient ScheduledFuture removalTask; private int stacks = 1; private long groupBufferId; private int buffCRC; diff --git a/src/resources/buffs/BuffItem.java b/src/resources/buffs/BuffItem.java index ae302027..208df3f6 100644 --- a/src/resources/buffs/BuffItem.java +++ b/src/resources/buffs/BuffItem.java @@ -21,10 +21,14 @@ ******************************************************************************/ package resources.buffs; +import java.io.Serializable; + import com.sleepycat.persist.model.Persistent; @Persistent -public class BuffItem { +public class BuffItem implements Serializable { + + private static final long serialVersionUID = 1L; private int affectAmount; private int entertainerBonus; private int invested; diff --git a/src/resources/buffs/DamageOverTime.java b/src/resources/buffs/DamageOverTime.java index 8a21306a..d1aa8bc9 100644 --- a/src/resources/buffs/DamageOverTime.java +++ b/src/resources/buffs/DamageOverTime.java @@ -21,20 +21,22 @@ ******************************************************************************/ package resources.buffs; +import java.io.Serializable; import java.util.concurrent.ScheduledFuture; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; @Persistent(version=1) -public class DamageOverTime { +public class DamageOverTime implements Serializable { + private static final long serialVersionUID = 1L; private Buff buff; private String type; private int duration; private int intensity; @NotPersistent - private ScheduledFuture task; + private transient ScheduledFuture task; private long startTime; private String commandName; diff --git a/src/resources/common/AString.java b/src/resources/common/AString.java index 1a9f73f2..14677cb6 100644 --- a/src/resources/common/AString.java +++ b/src/resources/common/AString.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.common; +import java.io.Serializable; import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; @@ -30,8 +31,9 @@ import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; @Persistent -public final class AString extends Delta { +public final class AString extends Delta implements Serializable { + private static final long serialVersionUID = 1L; private String string; public AString() { diff --git a/src/resources/common/BountyListItem.java b/src/resources/common/BountyListItem.java index 696d24df..10033656 100644 --- a/src/resources/common/BountyListItem.java +++ b/src/resources/common/BountyListItem.java @@ -21,15 +21,17 @@ ******************************************************************************/ package resources.common; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.PrimaryKey; + +@Entity(version=1) +public class BountyListItem implements Serializable { -@Entity -public class BountyListItem { - + private static final long serialVersionUID = 1L; @PrimaryKey private long objectId; private int creditReward; @@ -37,7 +39,9 @@ public class BountyListItem { private String faction; private String name; private List assignedHunters; - + private List bountyPlacers; + private int failedAttempts; + public BountyListItem() { } public BountyListItem(long objectId, int creditReward, String profession, String faction, String name) { @@ -47,6 +51,7 @@ public class BountyListItem { this.faction = faction; this.setName(name); this.setAssignedHunters(new ArrayList(3)); + this.setBountyPlacers(new ArrayList()); } public long getObjectId() { @@ -87,6 +92,10 @@ public class BountyListItem { public void addBounty(int amountToAdd) { this.creditReward += amountToAdd; } + + public void deductBounty(int amountToDeduct) { + this.creditReward = this.creditReward - amountToDeduct; + } public List getAssignedHunters() { return assignedHunters; @@ -103,4 +112,24 @@ public class BountyListItem { public void removeBountyHunter(long objectId) { assignedHunters.remove(objectId); } -} + + public List getBountyPlacers() { + return bountyPlacers; + } + + public void setBountyPlacers(List bountyPlacers) { + this.bountyPlacers = bountyPlacers; + } + + public int getFailedAttempts() { + return failedAttempts; + } + + public void setFailedAttempts(int failedAttempts) { + this.failedAttempts = failedAttempts; + } + + public void incrementFailedAttempts() { + this.failedAttempts += 1; + } +} \ No newline at end of file diff --git a/src/resources/common/ProsePackage.java b/src/resources/common/ProsePackage.java index b461bb8e..6af9bbe4 100644 --- a/src/resources/common/ProsePackage.java +++ b/src/resources/common/ProsePackage.java @@ -55,6 +55,12 @@ public class ProsePackage { stf.setStfName(stfLabel); } + public ProsePackage(String stfFile, String stfLabel, String ttCustomString) { + stf.setStfFilename(stfFile); + stf.setStfName(stfLabel); + this.ttCustomString = ttCustomString; + } + public ProsePackage(String stfFile, String stfLabel, long tuObjectId, String tuStfFile, String tuStfLabel, String tuCustomString) { stf.setStfFilename(stfFile); stf.setStfName(stfLabel); diff --git a/src/resources/common/UString.java b/src/resources/common/UString.java index dec215af..37564bd1 100644 --- a/src/resources/common/UString.java +++ b/src/resources/common/UString.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.common; +import java.io.Serializable; import java.io.UnsupportedEncodingException; import com.sleepycat.persist.model.Persistent; @@ -28,8 +29,9 @@ import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; @Persistent -public final class UString extends Delta { +public final class UString extends Delta implements Serializable { + private static final long serialVersionUID = 1L; private String string; public UString() { diff --git a/src/resources/datatables/PvpStatus.java b/src/resources/datatables/PvpStatus.java index ddded7a4..f2bb3350 100644 --- a/src/resources/datatables/PvpStatus.java +++ b/src/resources/datatables/PvpStatus.java @@ -32,6 +32,6 @@ public class PvpStatus { public static int Enemy = 32; public static int GoingOvert = 64; public static int GoingCovert = 128; - public static int Dueling = 256; + public static int Self = 256; } diff --git a/src/resources/gcw/CurrentServerGCWZoneHistory.java b/src/resources/gcw/CurrentServerGCWZoneHistory.java index 66874d64..c8f81fda 100644 --- a/src/resources/gcw/CurrentServerGCWZoneHistory.java +++ b/src/resources/gcw/CurrentServerGCWZoneHistory.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.gcw; +import java.io.Serializable; + import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; @@ -28,8 +30,9 @@ import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; @Persistent(version=0) -public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { +public class CurrentServerGCWZoneHistory extends Delta implements Cloneable, Serializable { + private static final long serialVersionUID = 1L; private int lastUpdateTime; private int percent; diff --git a/src/resources/gcw/CurrentServerGCWZonePercent.java b/src/resources/gcw/CurrentServerGCWZonePercent.java index ea825d7a..6e5bf56a 100644 --- a/src/resources/gcw/CurrentServerGCWZonePercent.java +++ b/src/resources/gcw/CurrentServerGCWZonePercent.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.gcw; +import java.io.Serializable; import java.math.BigDecimal; import java.math.MathContext; @@ -29,12 +30,12 @@ import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; import engine.resources.scene.Point2D; - import resources.objects.Delta; @Persistent(version=0) -public class CurrentServerGCWZonePercent extends Delta implements Cloneable { +public class CurrentServerGCWZonePercent extends Delta implements Cloneable, Serializable { + private static final long serialVersionUID = 1L; private Point2D position; private float radius = 0; private BigDecimal weight; diff --git a/src/resources/gcw/OtherServerGCWZonePercent.java b/src/resources/gcw/OtherServerGCWZonePercent.java index ab8048eb..15d9da9d 100644 --- a/src/resources/gcw/OtherServerGCWZonePercent.java +++ b/src/resources/gcw/OtherServerGCWZonePercent.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.gcw; +import java.io.Serializable; + import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; @@ -28,8 +30,9 @@ import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; @Persistent(version=0) -public class OtherServerGCWZonePercent extends Delta implements Cloneable { +public class OtherServerGCWZonePercent extends Delta implements Cloneable, Serializable { + private static final long serialVersionUID = 1L; private String zone = ""; private int percent = 50; diff --git a/src/resources/guild/Guild.java b/src/resources/guild/Guild.java index 5651c2d0..7ecdd2bb 100644 --- a/src/resources/guild/Guild.java +++ b/src/resources/guild/Guild.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.guild; +import java.io.Serializable; import java.util.List; import org.apache.mina.core.buffer.IoBuffer; @@ -28,12 +29,12 @@ import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; - import engine.resources.objects.SWGObject; @Persistent(version=0) -public class Guild extends Delta { +public class Guild extends Delta implements Serializable { + private static final long serialVersionUID = 1L; private int id; private String abbreviation; private String name; diff --git a/src/resources/loot/LootGroup.java b/src/resources/loot/LootGroup.java index 8666014d..a43e435d 100644 --- a/src/resources/loot/LootGroup.java +++ b/src/resources/loot/LootGroup.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.loot; +import java.io.Serializable; + import com.sleepycat.persist.model.Persistent; /** @@ -28,8 +30,10 @@ import com.sleepycat.persist.model.Persistent; */ @Persistent(version=0) -public class LootGroup { +public class LootGroup implements Serializable { + private static final long serialVersionUID = 1L; + private String[] lootPoolNames; private double[] lootPoolChances; private double lootGroupChance; diff --git a/src/resources/objectives/BountyMissionObjective.java b/src/resources/objectives/BountyMissionObjective.java index 96b90c88..672a8977 100644 --- a/src/resources/objectives/BountyMissionObjective.java +++ b/src/resources/objectives/BountyMissionObjective.java @@ -1,80 +1,386 @@ -/******************************************************************************* - * 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.objectives; - -import java.util.Random; - -import engine.resources.scene.Point3D; -import main.NGECore; -import resources.common.BountyListItem; -import resources.objects.creature.CreatureObject; -import resources.objects.mission.MissionObject; -import services.mission.MissionObjective; - -public class BountyMissionObjective extends MissionObjective { - - private Point3D lastKnownLocation; - private long markObjId; - - public BountyMissionObjective(MissionObject parent) { - super(parent); - } - - @Override - public void activate(NGECore core, CreatureObject player) { - if (isActivated()) - return; - - BountyListItem bountyTarget = core.missionService.getBountyListItem(getMissionObject().getBountyObjId()); - - setMarkObjId(bountyTarget.getObjectId()); - - // TODO: Change this to a comm message. - player.sendSystemMessage("@mission/mission_bounty_informant:target_hard_" + Integer.toString(new Random().nextInt(5)), (byte) 0); - - - } - - @Override - public void complete(NGECore core, CreatureObject player) { - - } - - @Override - public void abort(NGECore core, CreatureObject player) { - - } - - @Override - public void update(NGECore core, CreatureObject player) { - - } - - public Point3D getLastKnownLocation() { return lastKnownLocation; } - - public void setLastKnownLocation(Point3D lastKnownLocation) { this.lastKnownLocation = lastKnownLocation; } - - public long getMarkObjId() { return markObjId; } - - public void setMarkObjId(long markObjId) { this.markObjId = markObjId; } - -} +/******************************************************************************* + * 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.objectives; + +import java.util.Random; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import protocol.swg.CommPlayerMessage; +import protocol.swg.PlayClientEffectLocMessage; +import protocol.swg.UpdatePVPStatusMessage; +import engine.resources.common.CRC; +import engine.resources.container.Traverser; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; +import main.NGECore; +import resources.common.BountyListItem; +import resources.common.OutOfBand; +import resources.common.ProsePackage; +import resources.common.SpawnPoint; +import resources.datatables.DisplayType; +import resources.objects.creature.CreatureObject; +import resources.objects.mission.MissionObject; +import resources.objects.waypoint.WaypointObject; +import services.chat.Mail; +import services.mission.MissionObjective; + +public class BountyMissionObjective extends MissionObjective { + + private static final long serialVersionUID = 1L; + + private Point3D lastKnownLocation; + private String lastKnownPlanet; + private ScheduledFuture seekerUpdates; + private ScheduledFuture probeSummonTask; + private long markObjId; + + private boolean seekerActive = false; + private String seekerPlanet = ""; + private boolean arakydActive = false; + + private Point3D arakydLandingLocation; + + ////// Droids in the world - Set Posture to 8 to launch them. ////// + // Seeker Droids: object/creature/npc/droid/crafted/shared_probe_droid_advanced.iff + // Arakyd Droids: object/creature/npc/droid/shared_imperial_probot_bounty.iff + + ///// Inventory form ///// + // Seeker Droids: object/tangible/mission/shared_mission_bounty_droid_seeker.iff + // Arakyd Droids: object/tangible/mission/shared_mission_bounty_droid_probot.iff + public BountyMissionObjective(MissionObject parent) { + super(parent); + } + + @Override + public void activate(NGECore core, CreatureObject player) { + if (isActivated()) + return; + + BountyListItem bountyTarget = core.missionService.getBountyListItem(getMissionObject().getBountyObjId()); + + if (bountyTarget == null) { + core.missionService.handleMissionAbort(player, getMissionObject()); + player.sendSystemMessage("@bountyhunter:null_mission", DisplayType.Broadcast); + return; + } + + bountyTarget.addBountyHunter(player.getObjectId()); + + setMarkObjId(bountyTarget.getObjectId()); + + String message = "@mission/mission_bounty_informant:target_hard_" + Integer.toString(new Random().nextInt(4) + 1); + + CommPlayerMessage comm = new CommPlayerMessage(player.getObjectId(), new OutOfBand(new ProsePackage(message))); + comm.setTime(5000); + switch (bountyTarget.getFaction()) { + case "neutral": + comm.setModel("object/mobile/shared_dressed_assassin_mission_giver_0" + Integer.toString(new Random().nextInt(2) + 1) + ".iff"); + break; + case "rebel": + comm.setModel("object/mobile/shared_dressed_assassin_mission_giver_imp_hum_m_0" + Integer.toString(new Random().nextInt(2) + 1) + ".iff"); + break; + case "imperial": + comm.setModel("object/mobile/shared_dressed_assassin_mission_giver_reb_0" + Integer.toString(new Random().nextInt(2) + 1) + ".iff"); + break; + } //Could also be: object/mobile/shared_bounty_guild_bounty_check.iff || object/mobile/shared_bounty_check_fugitive_x.iff + + player.getClient().getSession().write(comm.serialize()); + + player.getPlayerObject().setBountyMissionId(getMissionObject().getObjectId()); + + /*CreatureObject target = (CreatureObject) core.objectService.getObject(markObjId); + if (target != null && target.getPlanetId() == player.getPlanetId()) { + UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(player.getObjectID(), core.factionService.calculatePvpStatus(player, target), player.getFaction()); + player.getClient().getSession().write(upvpm.serialize()); + }*/ + } + + + @Override + public void complete(NGECore core, CreatureObject player) { + BountyListItem bounty = core.missionService.getBountyListItem(markObjId); + + if (bounty == null) + return; + + int reward = getMissionObject().getCreditReward(); + + if (bounty.getCreditReward() - reward == 0) + player.addBankCredits(reward); + else + player.addBankCredits(bounty.getCreditReward()); + + notifyBountyPlacers(core, player, bounty); + + clearActiveMissions(core, bounty); + + core.missionService.removeBounty(markObjId); + player.getPlayerObject().setBountyMissionId(0); + } + + @Override + public void abort(NGECore core, CreatureObject player) { + cancelLocationUpdates(); + + BountyListItem bounty = core.missionService.getBountyListItem(markObjId); + + if (bounty == null) + return; + + bounty.removeBountyHunter(player.getObjectId()); + player.getPlayerObject().setBountyMissionId(0); + } + + @Override + public void update(NGECore core, CreatureObject player) { + + } + + public void notifyBountyPlacers(NGECore core, CreatureObject player, BountyListItem bounty) { + + String message = "Dear Sir or Madam,\nThe Galactic Bounty Network wishes to inform you that the bounty that you placed on the head of "+ bounty.getName() + + " has been claimed by the bounty hunter, " + player.getCustomName() + ".\nThank you for your patronage, and have a nice day."; + + bounty.getBountyPlacers().forEach(id -> { + Mail bountyMail = new Mail(); + bountyMail.setMailId(core.chatService.generateMailId()); + bountyMail.setTimeStamp((int) (new java.util.Date().getTime() / 1000)); + bountyMail.setRecieverId(id); + bountyMail.setSubject("Bounty Claim Notification"); + bountyMail.setSenderName("Galactic Bounty Network"); + bountyMail.setMessage(message); + bountyMail.setStatus(Mail.NEW); + + core.chatService.storePersistentMessage(bountyMail); + + SWGObject obj = core.objectService.getObject(id); + if (obj != null) + core.chatService.sendPersistentMessageHeader(obj.getClient(), bountyMail); + }); + } + + public void clearActiveMissions(NGECore core, BountyListItem bounty) { + bounty.getAssignedHunters().forEach(id -> { + CreatureObject hunter = (CreatureObject) core.objectService.getObject(id); + + if (hunter != null) { + hunter.sendSystemMessage(new OutOfBand(new ProsePackage("@bounty_hunter:bounty_failed_hunter", "TT", getMissionObject().getGrandparent().getObjectId())), DisplayType.Broadcast); + hunter.getSlottedObject("datapad").viewChildren(hunter, true, false, new Traverser() { + @Override + public void process(SWGObject item) { + if (item instanceof MissionObject) { + MissionObject mission = (MissionObject) item; + if (mission.getMissionType().equals("bounty")) { + core.missionService.handleMissionAbort(hunter, mission); + } + } + } + }); + } + }); + } + + public void checkBountyActiveStatus(NGECore core) { + BountyListItem bountyTarget = core.missionService.getBountyListItem(getMissionObject().getBountyObjId()); + CreatureObject player = (CreatureObject) getMissionObject().getGrandparent(); + + if (bountyTarget == null || !bountyTarget.getAssignedHunters().contains(player.getObjectId())) { + player.sendSystemMessage("@bounty_hunter:bounty_incomplete", DisplayType.Broadcast); + core.missionService.handleMissionAbort(player, getMissionObject(), true); + } + } + + public void handleProbeDroidSummon(NGECore core, final CreatureObject actor) { + + actor.sendSystemMessage("@mission/mission_generic:probe_droid_launch_prep", DisplayType.Broadcast); + AtomicInteger countDown = new AtomicInteger(); + + ScheduledFuture summon = Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() { + + @Override + public void run() { + switch(countDown.incrementAndGet()) { + case 15: + actor.sendSystemMessage("@mission/mission_generic:probe_droid_arrival_5", DisplayType.Broadcast); + break; + case 16: + actor.sendSystemMessage("@mission/mission_generic:probe_droid_arrival_4", DisplayType.Broadcast); + break; + case 17: + actor.sendSystemMessage("@mission/mission_generic:probe_droid_arrival_3", DisplayType.Broadcast); + break; + case 18: + actor.sendSystemMessage("@mission/mission_generic:probe_droid_arrival_2", DisplayType.Broadcast); + break; + case 19: + actor.sendSystemMessage("@mission/mission_generic:probe_droid_arrival_1", DisplayType.Broadcast); + arakydLandingLocation = SpawnPoint.getRandomPosition(actor.getPosition(), 50, 120, actor.getPlanetId()); + PlayClientEffectLocMessage effectMsg = new PlayClientEffectLocMessage("clienteffect/probot_delivery.cef", actor.getPlanet().getName(), arakydLandingLocation); + actor.getClient().getSession().write(effectMsg.serialize()); + break; + case 20: + break; + case 23: + Quaternion ori = actor.getOrientation(); + + CreatureObject probe = (CreatureObject) NGECore.getInstance().staticService.spawnObject("object/creature/npc/droid/shared_imperial_probot_bounty.iff", + actor.getPlanet().getName(), 0, arakydLandingLocation.x, arakydLandingLocation.y, arakydLandingLocation.z, ori.y, ori.w); + + // TODO: Move probe to the player. + + probe.setAttachment("probotRequester", actor.getObjectID()); + probe.setAttachment("attachedMission", getMissionObject().getObjectID()); + actor.sendSystemMessage("@mission/mission_generic:probe_droid_arrival", DisplayType.Broadcast); + probeSummonTask.cancel(false); + break; + } + } + }, 1, 1, TimeUnit.SECONDS); + + probeSummonTask = summon; + + } + + public void beginSeekerUpdates(NGECore core, CreatureObject actor) { + + if (!seekerActive) { + setSeekerActive(true); + setSeekerPlanet(actor.getPlanet().getName()); + + AtomicInteger updates = new AtomicInteger(); + ScheduledFuture updater = Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() { + + @Override + public void run() { + + MissionObject mission = getMissionObject(); + SWGObject target = core.objectService.getObject(markObjId); + + if (target == null) { + actor.sendSystemMessage("@mission/mission_generic:player_target_inactive", DisplayType.Broadcast); + cancelLocationUpdates(); + return; + } else if (target.getPlanet().getName() != getSeekerPlanet()) { + actor.sendSystemMessage("@mission/mission_generic:target_not_on_planet", DisplayType.Broadcast); + cancelLocationUpdates(); + return; + } else { + + if (updates.get() >= 5) { + actor.sendSystemMessage("@mission/mission_generic:target_track_lost", DisplayType.Broadcast); + cancelLocationUpdates(); + return; + } + + WaypointObject missionWp = mission.getAttachedWaypoint(); + + if (missionWp == null) { + WaypointObject waypoint = (WaypointObject) NGECore.getInstance().objectService.createObject("object/waypoint/shared_waypoint.iff", target.getPlanet(), + target.getWorldPosition().x, target.getWorldPosition().z, target.getWorldPosition().y); + waypoint.setActive(true); + waypoint.setColor(WaypointObject.ORANGE); + waypoint.setName(getMissionObject().getMissionTargetName()); + waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName())); + waypoint.setStringAttribute("", ""); + getMissionObject().setAttachedWaypoint(waypoint); + actor.sendSystemMessage("@mission/mission_generic:target_location_updated_ground", DisplayType.Broadcast); + } else { + missionWp.setPosition(target.getWorldPosition()); + mission.setAttachedWaypoint(missionWp); + actor.sendSystemMessage("@mission/mission_generic:target_location_updated_ground", DisplayType.Broadcast); + } + updates.getAndIncrement(); + } + } + }, 60, 15, TimeUnit.SECONDS); + + seekerUpdates = updater; + } + } + + public void beginArakydUpdate(final CreatureObject actor) { + arakydActive = true; + Executors.newScheduledThreadPool(1).schedule(() -> { + + int number = new Random().nextInt(100); + + // Effectively a 16% chance of failing. The failure type is calculated by subtracting 10 from the number received. + if (number <= 16 && number != 0) { actor.sendSystemMessage("@mission/mission_generic:target_not_found_" + String.valueOf(10 - number), (byte) 0); return; } + + SWGObject target = NGECore.getInstance().objectService.getObject(markObjId); + if (target == null) { actor.sendSystemMessage("@mission/mission_generic:player_target_inactive", DisplayType.Broadcast); } + + WaypointObject waypoint = (WaypointObject) NGECore.getInstance().objectService.createObject("object/waypoint/shared_waypoint.iff", target.getPlanet(), + target.getWorldPosition().x, target.getWorldPosition().z, target.getWorldPosition().y); + waypoint.setActive(true); + waypoint.setColor(WaypointObject.ORANGE); + waypoint.setName(getMissionObject().getMissionTargetName()); + waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName())); + waypoint.setStringAttribute("", ""); + getMissionObject().setAttachedWaypoint(waypoint); + + actor.sendSystemMessage("@mission/mission_generic:target_location_updated_ground", DisplayType.Broadcast); + actor.sendSystemMessage("@mission/mission_generic:target_located_" + target.getPlanet().getName(), DisplayType.Broadcast); + + }, 180, TimeUnit.SECONDS); + } + + public void cancelLocationUpdates() { + if (seekerUpdates != null) + seekerUpdates.cancel(true); + if (probeSummonTask != null) + probeSummonTask.cancel(true); + + setSeekerActive(false); + setSeekerPlanet(""); + setArakydActive(false); + } + + public Point3D getLastKnownLocation() { return lastKnownLocation; } + + public void setLastKnownLocation(Point3D lastKnownLocation) { this.lastKnownLocation = lastKnownLocation; } + + public long getMarkObjId() { return markObjId; } + + public void setMarkObjId(long markObjId) { this.markObjId = markObjId; } + + public String getLastKnownPlanet() { return lastKnownPlanet; } + + public void setLastKnownPlanet(String lastKnownPlanet) { this.lastKnownPlanet = lastKnownPlanet; } + + public boolean isSeekerActive() { return seekerActive; } + + public void setSeekerActive(boolean seekerActive) { this.seekerActive = seekerActive; } + + public boolean isArakydActive() { return arakydActive; } + + public void setArakydActive(boolean araykdActive) { this.arakydActive = araykdActive; } + + public String getSeekerPlanet() { return seekerPlanet; } + + public void setSeekerPlanet(String seekerPlanet) { this.seekerPlanet = seekerPlanet; } + +} diff --git a/src/resources/objectives/DeliveryMissionObjective.java b/src/resources/objectives/DeliveryMissionObjective.java index 6a116a8e..7d5f029b 100644 --- a/src/resources/objectives/DeliveryMissionObjective.java +++ b/src/resources/objectives/DeliveryMissionObjective.java @@ -33,6 +33,8 @@ import services.mission.MissionObjective; public class DeliveryMissionObjective extends MissionObjective { + private static final long serialVersionUID = 1L; + private TangibleObject deliveryObject; private CreatureObject missionGiver; private CreatureObject dropOffNpc; diff --git a/src/resources/objectives/DestroyMissionObjective.java b/src/resources/objectives/DestroyMissionObjective.java index 7437d46f..442e4384 100644 --- a/src/resources/objectives/DestroyMissionObjective.java +++ b/src/resources/objectives/DestroyMissionObjective.java @@ -28,6 +28,8 @@ import services.mission.MissionObjective; public class DestroyMissionObjective extends MissionObjective { + private static final long serialVersionUID = 1L; + public DestroyMissionObjective(MissionObject parent) { super(parent); } diff --git a/src/resources/objects/Delta.java b/src/resources/objects/Delta.java index 35ef4299..6e57706e 100644 --- a/src/resources/objects/Delta.java +++ b/src/resources/objects/Delta.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects; +import java.io.Serializable; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -33,12 +34,13 @@ import com.sleepycat.persist.model.Persistent; import resources.common.StringUtilities; @Persistent -public abstract class Delta implements IDelta { +public abstract class Delta implements IDelta, Serializable { + private static final long serialVersionUID = 1L; @NotPersistent - protected final Object objectMutex = new Object(); + protected transient final Object objectMutex = new Object(); @NotPersistent - private static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); + private transient static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); public Delta() { diff --git a/src/resources/objects/ObjectMessageBuilder.java b/src/resources/objects/ObjectMessageBuilder.java index 4ae29461..073e7c6e 100644 --- a/src/resources/objects/ObjectMessageBuilder.java +++ b/src/resources/objects/ObjectMessageBuilder.java @@ -42,7 +42,7 @@ public abstract class ObjectMessageBuilder { public SWGObject object; @NotPersistent public SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - + public IoBuffer createBaseline(String objectType, byte viewType, IoBuffer data, int size) { IoBuffer buffer = bufferPool.allocate(23 + size, false).order(ByteOrder.LITTLE_ENDIAN); diff --git a/src/resources/objects/SWGList.java b/src/resources/objects/SWGList.java index 7471305c..13e1854d 100644 --- a/src/resources/objects/SWGList.java +++ b/src/resources/objects/SWGList.java @@ -21,7 +21,8 @@ ******************************************************************************/ package resources.objects; -import java.nio.ByteOrder; +import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; @@ -34,30 +35,36 @@ import java.util.function.Predicate; import java.util.function.UnaryOperator; import java.util.stream.Stream; +import main.NGECore; + import org.apache.mina.core.buffer.IoBuffer; import org.python.google.common.collect.Lists; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; +import engine.resources.objects.SWGObject; + /* A SWGList element MUST implement IDelta, or it will refuse to work with it */ @Persistent -public class SWGList implements List { +public class SWGList implements List, Serializable { + private static final long serialVersionUID = 1L; private List list = new ArrayList(); @NotPersistent - private int updateCounter = 1; - private ObjectMessageBuilder messageBuilder; + private transient int updateCounter = 1; + private long objectId; + private transient ObjectMessageBuilder messageBuilder; private byte viewType; private short updateType; @NotPersistent - protected final Object objectMutex = new Object(); + protected transient final Object objectMutex = new Object(); public SWGList() { } - public SWGList(ObjectMessageBuilder messageBuilder, int viewType, int updateType) { - this.messageBuilder = messageBuilder; + public SWGList(long objectId, int viewType, int updateType) { + this.objectId = objectId; this.viewType = (byte) viewType; this.updateType = (short) updateType; } @@ -294,7 +301,7 @@ public class SWGList implements List { if (!list.isEmpty()) { for (E element : list) { if (element instanceof IDelta) { - IoBuffer buffer = messageBuilder.bufferPool.allocate((newListData.length + ((IDelta) element).getBytes().length), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = Delta.createBuffer((newListData.length + ((IDelta) element).getBytes().length)); buffer.put(newListData); buffer.put(((IDelta) element).getBytes()); newListData = buffer.array(); @@ -359,7 +366,7 @@ public class SWGList implements List { return new byte[] { }; } - IoBuffer buffer = messageBuilder.bufferPool.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = Delta.createBuffer(size); buffer.put((byte) type); if (useIndex) buffer.putShort((short) index); if (useData) buffer.put(data); @@ -370,7 +377,18 @@ public class SWGList implements List { } private void queue(byte[] data) { - IoBuffer buffer = messageBuilder.bufferPool.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); + if (messageBuilder == null) { + try { + SWGObject object = NGECore.getInstance().objectService.getObject(objectId); + this.messageBuilder = (ObjectMessageBuilder) object.getClass().getMethod("getMessageBuilder", new Class[] {}).invoke(object, new Object[] { }); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + IoBuffer buffer = Delta.createBuffer((data.length + 8)); buffer.putInt(1); buffer.putInt(updateCounter); buffer.put(data); @@ -384,7 +402,18 @@ public class SWGList implements List { size += queued.length; } - IoBuffer buffer = messageBuilder.bufferPool.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); + if (messageBuilder == null) { + try { + SWGObject object = NGECore.getInstance().objectService.getObject(objectId); + this.messageBuilder = (ObjectMessageBuilder) object.getClass().getMethod("getMessageBuilder", new Class[] {}).invoke(object, new Object[] { }); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + IoBuffer buffer = Delta.createBuffer((size + 8)); buffer.putInt(data.size()); buffer.putInt(updateCounter); for (byte[] queued : data) buffer.put(queued); diff --git a/src/resources/objects/SWGMap.java b/src/resources/objects/SWGMap.java index b8f9610d..ffd380af 100644 --- a/src/resources/objects/SWGMap.java +++ b/src/resources/objects/SWGMap.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.objects; +import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Collection; @@ -33,6 +35,8 @@ import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Function; +import main.NGECore; + import org.apache.mina.core.buffer.IoBuffer; import resources.common.StringUtilities; @@ -40,30 +44,35 @@ import resources.common.StringUtilities; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; +import engine.resources.objects.SWGObject; + @SuppressWarnings("unused") @Persistent -public class SWGMap implements Map { +public class SWGMap implements Map, Serializable { + private static final long serialVersionUID = 1L; private Map map = new TreeMap(); @NotPersistent - private int updateCounter = 0; - private ObjectMessageBuilder messageBuilder; + private transient int updateCounter = 0; + long objectId; + private transient ObjectMessageBuilder messageBuilder; private byte viewType; private short updateType; @NotPersistent - protected final Object objectMutex = new Object(); + protected transient final Object objectMutex = new Object(); public SWGMap() { } - public SWGMap(ObjectMessageBuilder messageBuilder, int viewType, int updateType) { - this.messageBuilder = messageBuilder; + public SWGMap(long objectId, int viewType, int updateType) { + this.objectId = objectId; this.viewType = (byte) viewType; this.updateType = (short) updateType; } public SWGMap(Map m) { if (m instanceof SWGMap) { + this.objectId = ((SWGMap) m).objectId; this.messageBuilder = ((SWGMap) m).messageBuilder; this.viewType = ((SWGMap) m).viewType; this.updateType = ((SWGMap) m).updateType; @@ -214,7 +223,7 @@ public class SWGMap implements Map { int size = 1 + ((useIndex) ? (2 + index.toString().getBytes().length) : 0) + ((useData) ? data.length : 0); - IoBuffer buffer = messageBuilder.bufferPool.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = Delta.createBuffer((size)); buffer.put((byte) type); if (useIndex) { if (index instanceof String) { @@ -242,7 +251,18 @@ public class SWGMap implements Map { } private void queue(byte[] data) { - IoBuffer buffer = messageBuilder.bufferPool.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); + if (messageBuilder == null) { + try { + SWGObject object = NGECore.getInstance().objectService.getObject(objectId); + this.messageBuilder = (ObjectMessageBuilder) object.getClass().getMethod("getMessageBuilder", new Class[] {}).invoke(object, new Object[] { }); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + IoBuffer buffer = Delta.createBuffer((data.length + 8)); buffer.putInt(1); buffer.putInt(updateCounter); buffer.put(data); @@ -257,7 +277,18 @@ public class SWGMap implements Map { size += queued.length; } - IoBuffer buffer = messageBuilder.bufferPool.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); + if (messageBuilder == null) { + try { + SWGObject object = NGECore.getInstance().objectService.getObject(objectId); + this.messageBuilder = (ObjectMessageBuilder) object.getClass().getMethod("getMessageBuilder", new Class[] {}).invoke(object, new Object[] { }); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + IoBuffer buffer = Delta.createBuffer((size + 8)); buffer.putInt(data.size()); buffer.putInt(updateCounter); for (byte[] queued : data) buffer.put(queued); diff --git a/src/resources/objects/SWGMultiMap.java b/src/resources/objects/SWGMultiMap.java index 850b55f9..22659c1b 100644 --- a/src/resources/objects/SWGMultiMap.java +++ b/src/resources/objects/SWGMultiMap.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.objects; +import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Collection; @@ -31,6 +33,8 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; +import main.NGECore; + import org.apache.mina.core.buffer.IoBuffer; import org.python.google.common.collect.ArrayListMultimap; import org.python.google.common.collect.Multimap; @@ -43,30 +47,35 @@ import resources.common.StringUtilities; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; +import engine.resources.objects.SWGObject; + @SuppressWarnings("unused") @Persistent -public class SWGMultiMap implements Multimap { +public class SWGMultiMap implements Multimap, Serializable { + private static final long serialVersionUID = 1L; private Multimap map = ArrayListMultimap.create(); @NotPersistent - private int updateCounter = 0; - private ObjectMessageBuilder messageBuilder; + private transient int updateCounter = 0; + private long objectId; + private transient ObjectMessageBuilder messageBuilder; private byte viewType; private short updateType; @NotPersistent - protected final Object objectMutex = new Object(); + protected transient final Object objectMutex = new Object(); public SWGMultiMap() { } - public SWGMultiMap(ObjectMessageBuilder messageBuilder, int viewType, int updateType) { - this.messageBuilder = messageBuilder; + public SWGMultiMap(long objectId, int viewType, int updateType) { + this.objectId = objectId; this.viewType = (byte) viewType; this.updateType = (short) updateType; } public SWGMultiMap(Multimap m) { if (m instanceof SWGMultiMap) { + this.objectId = ((SWGMultiMap) m).objectId; this.messageBuilder = ((SWGMultiMap) m).messageBuilder; this.viewType = ((SWGMultiMap) m).viewType; this.updateType = ((SWGMultiMap) m).updateType; @@ -296,7 +305,7 @@ public class SWGMultiMap implements Multimap { int size = 1 + ((useIndex) ? (2 + index.toString().getBytes().length) : 0) + ((useData) ? data.length : 0); - IoBuffer buffer = messageBuilder.bufferPool.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = Delta.createBuffer(size); buffer.put((byte) type); if (useIndex) { if (index instanceof String) { @@ -323,7 +332,18 @@ public class SWGMultiMap implements Multimap { } private void queue(byte[] data) { - IoBuffer buffer = messageBuilder.bufferPool.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); + if (messageBuilder == null) { + try { + SWGObject object = NGECore.getInstance().objectService.getObject(objectId); + this.messageBuilder = (ObjectMessageBuilder) object.getClass().getMethod("getMessageBuilder", new Class[] {}).invoke(object, new Object[] { }); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + IoBuffer buffer = Delta.createBuffer((data.length + 8)); buffer.putInt(1); buffer.putInt(updateCounter); buffer.put(data); @@ -337,7 +357,18 @@ public class SWGMultiMap implements Multimap { size += queued.length; } - IoBuffer buffer = messageBuilder.bufferPool.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); + if (messageBuilder == null) { + try { + SWGObject object = NGECore.getInstance().objectService.getObject(objectId); + this.messageBuilder = (ObjectMessageBuilder) object.getClass().getMethod("getMessageBuilder", new Class[] {}).invoke(object, new Object[] { }); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + IoBuffer buffer = Delta.createBuffer((size + 8)); buffer.putInt(data.size()); buffer.putInt(updateCounter); for (byte[] queued : data) buffer.put(queued); diff --git a/src/resources/objects/building/BuildingObject.java b/src/resources/objects/building/BuildingObject.java index 5d276fc8..43228195 100644 --- a/src/resources/objects/building/BuildingObject.java +++ b/src/resources/objects/building/BuildingObject.java @@ -21,11 +21,13 @@ ******************************************************************************/ package resources.objects.building; +import java.io.Serializable; import java.util.Vector; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import main.NGECore; +import resources.objects.ObjectMessageBuilder; import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; @@ -44,12 +46,13 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Entity(version=6) -public class BuildingObject extends TangibleObject implements IPersistent { +public class BuildingObject extends TangibleObject implements IPersistent, Serializable { + private static final long serialVersionUID = 1L; @NotPersistent - private BuildingMessageBuilder messageBuilder; + private transient BuildingMessageBuilder messageBuilder; @NotPersistent - private Transaction txn; + private transient Transaction txn; private float maintenanceAmount = 0; private int BMR = 0; @@ -262,4 +265,14 @@ public class BuildingObject extends TangibleObject implements IPersistent { return cells; } + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new BuildingMessageBuilder(this); + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/cell/CellObject.java b/src/resources/objects/cell/CellObject.java index 32f1e86b..cd95919f 100644 --- a/src/resources/objects/cell/CellObject.java +++ b/src/resources/objects/cell/CellObject.java @@ -21,10 +21,14 @@ ******************************************************************************/ package resources.objects.cell; +import java.io.Serializable; + import protocol.swg.UpdateCellPermissionMessage; +import resources.objects.ObjectMessageBuilder; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; + import engine.clients.Client; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -32,11 +36,12 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=0) -public class CellObject extends SWGObject { +public class CellObject extends SWGObject implements Serializable { + private static final long serialVersionUID = 1L; private int cellNumber = 0; @NotPersistent - private CellMessageBuilder messageBuilder; + private transient CellMessageBuilder messageBuilder; public CellObject() { super(); @@ -80,5 +85,14 @@ public class CellObject extends SWGObject { } - + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new CellMessageBuilder(this); + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/craft/DraftSchematic.java b/src/resources/objects/craft/DraftSchematic.java index 3e47ae31..54d203a5 100644 --- a/src/resources/objects/craft/DraftSchematic.java +++ b/src/resources/objects/craft/DraftSchematic.java @@ -21,7 +21,12 @@ ******************************************************************************/ package resources.objects.craft; +import java.io.Serializable; + +import resources.objects.ObjectMessageBuilder; + import com.sleepycat.persist.model.Persistent; + import engine.clients.Client; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -29,9 +34,11 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent -public class DraftSchematic extends SWGObject { - +public class DraftSchematic extends SWGObject implements Serializable { + private static final long serialVersionUID = 1L; + private transient ObjectMessageBuilder messageBuilder = null; + public DraftSchematic(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ super(objectID, planet, position, orientation, template); } @@ -42,5 +49,13 @@ public class DraftSchematic extends SWGObject { } + @Override + public void initAfterDBLoad() { + super.init(); + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } } diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index cfd9a60c..d724e44b 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.creature; +import java.io.Serializable; import java.lang.System; import java.util.ArrayList; import java.util.Collections; @@ -42,8 +43,6 @@ import protocol.swg.objectControllerObjects.Animation; import protocol.swg.objectControllerObjects.Posture; import protocol.swg.objectControllerObjects.StartTask; -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; @@ -53,10 +52,10 @@ import resources.buffs.Buff; import resources.buffs.DamageOverTime; import resources.common.Cooldown; import resources.common.OutOfBand; +import resources.objects.ObjectMessageBuilder; import resources.objects.SWGList; import resources.objects.SWGMap; import engine.resources.common.CRC; -import engine.resources.objects.IPersistent; import engine.resources.objects.MissionCriticalObject; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -68,18 +67,17 @@ import resources.skills.SkillMod; import services.command.BaseSWGCommand; @Entity(version=9) -public class CreatureObject extends TangibleObject implements IPersistent { +public class CreatureObject extends TangibleObject implements Serializable { - @NotPersistent - private Transaction txn; + private static final long serialVersionUID = 1L; // CREO 1 private int bankCredits = 0; private int cashCredits = 0; private List skills; @NotPersistent - private int skillsUpdateCounter = 0; - + private transient int skillsUpdateCounter = 0; + // CREO 3 private byte posture = 0; private float height; @@ -102,12 +100,11 @@ public class CreatureObject extends TangibleObject implements IPersistent { private SWGList abilities; private int abilitiesUpdateCounter = 0; private int xpBarValue = 0; - + private SWGList missionCriticalObjects; @NotPersistent - private int missionCriticalObjectsUpdateCounter = 0; - - + private transient int missionCriticalObjectsUpdateCounter = 0; + // CREO6 private byte combatFlag = 0; private short level = -1; @@ -130,30 +127,30 @@ public class CreatureObject extends TangibleObject implements IPersistent { private boolean acceptBandflourishes = true; private boolean groupDance = true; @NotPersistent - private CreatureObject performanceWatchee; + private transient CreatureObject performanceWatchee; @NotPersistent - private CreatureObject performanceListenee; + private transient CreatureObject performanceListenee; @NotPersistent - private Vector performanceAudience = new Vector(); + private transient Vector performanceAudience = new Vector(); private int health = 1000; private int action = 300; @NotPersistent - private int HAMListCounter = 0; + private transient int HAMListCounter = 0; private int maxHealth = 1000; private int maxAction = 300; @NotPersistent - private int maxHAMListCounter = 0; + private transient int maxHAMListCounter = 0; private SWGList equipmentList; @NotPersistent - private int equipmentListUpdateCounter = 0; + private transient int equipmentListUpdateCounter = 0; private SWGList buffList = new SWGList(); @NotPersistent - private int buffListUpdateCounter = 0; + private transient int buffListUpdateCounter = 0; private byte difficulty = 0; private SWGList appearanceEquipmentList; @NotPersistent - private int appearanceEquipmentListUpdateCounter = 0; + private transient int appearanceEquipmentListUpdateCounter = 0; private boolean inStealth = false; private boolean radarVisible = true; // radar @@ -161,48 +158,48 @@ public class CreatureObject extends TangibleObject implements IPersistent { // non-baseline vars @NotPersistent - private List duelList = Collections.synchronizedList(new ArrayList()); + private transient List duelList = Collections.synchronizedList(new ArrayList()); @NotPersistent - private CreatureMessageBuilder messageBuilder; + private transient CreatureMessageBuilder messageBuilder; private SWGList dotList = new SWGList(); @NotPersistent - private ScheduledFuture incapTask; + private transient ScheduledFuture incapTask; @NotPersistent - private ScheduledFuture entertainerExperience; + private transient ScheduledFuture entertainerExperience; @NotPersistent - private ScheduledFuture inspirationTick; + private transient ScheduledFuture inspirationTick; @NotPersistent - private ScheduledFuture spectatorTask; + private transient ScheduledFuture spectatorTask; private boolean staticNPC = false; // temp @NotPersistent - private int flourishCount = 0; + private transient int flourishCount = 0; @NotPersistent - private boolean performingEffect; + private transient boolean performingEffect; @NotPersistent - private boolean performingFlourish; + private transient boolean performingFlourish; private int coverCharge; @NotPersistent - private TangibleObject conversingNpc; + private transient TangibleObject conversingNpc; @NotPersistent - private ConcurrentHashMap cooldowns = new ConcurrentHashMap(); + private transient ConcurrentHashMap cooldowns = new ConcurrentHashMap(); @NotPersistent - private long tefTime = System.currentTimeMillis(); + private transient long tefTime = System.currentTimeMillis(); @NotPersistent - private SWGObject useTarget; + private transient SWGObject useTarget; public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, Template, position, orientation); messageBuilder = new CreatureMessageBuilder(this); loadTemplateData(); skills = new ArrayList(); - skillMods = new SWGMap(messageBuilder, 4, 3); - abilities = new SWGList(messageBuilder, 4, 14); - missionCriticalObjects = new SWGList(messageBuilder, 4, 13); - equipmentList = new SWGList(messageBuilder, 6, 0x17); - buffList = new SWGList(messageBuilder, 6, 0x1A); - appearanceEquipmentList = new SWGList(messageBuilder, 6, 0x1F); + skillMods = new SWGMap(getObjectID(), 4, 3); + abilities = new SWGList(getObjectID(), 4, 14); + missionCriticalObjects = new SWGList(getObjectID(), 4, 13); + equipmentList = new SWGList(getObjectID(), 6, 0x17); + buffList = new SWGList(getObjectID(), 6, 0x1A); + appearanceEquipmentList = new SWGList(getObjectID(), 6, 0x1F); } public CreatureObject() { @@ -210,6 +207,16 @@ public class CreatureObject extends TangibleObject implements IPersistent { messageBuilder = new CreatureMessageBuilder(this); } + @Override + public void initAfterDBLoad() { + super.init(); + duelList = Collections.synchronizedList(new ArrayList()); + cooldowns = new ConcurrentHashMap(); + performanceAudience = new Vector(); + tefTime = System.currentTimeMillis(); + messageBuilder = new CreatureMessageBuilder(this); + } + private void loadTemplateData() { /*if(getTemplateData().getAttribute("scale") != null) @@ -228,10 +235,6 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(messageBuilder.buildCustomNameDelta(customName), true); } - - public Transaction getTransaction() { return txn; } - - public void createTransaction(Environment env) { txn = env.beginTransaction(null, null); } public int getBankCredits() { synchronized(objectMutex) { @@ -560,12 +563,14 @@ public class CreatureObject extends TangibleObject implements IPersistent { synchronized(objectMutex) { if (state != 0) { if (add) { - stateBitmask = (stateBitmask | state); + state = (stateBitmask | state); } else { - stateBitmask = (stateBitmask & ~state); + state = (stateBitmask & ~state); } } } + + notifyObservers(messageBuilder.buildStateDelta(state), true); } public boolean getState(long state) { @@ -1848,4 +1853,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { //return ((float) getCooldown(cooldownGroup) / (float) 1000); //} + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/factorycrate/FactoryCrateObject.java b/src/resources/objects/factorycrate/FactoryCrateObject.java index d7b7b7d6..69f4d537 100644 --- a/src/resources/objects/factorycrate/FactoryCrateObject.java +++ b/src/resources/objects/factorycrate/FactoryCrateObject.java @@ -21,16 +21,15 @@ ******************************************************************************/ package resources.objects.factorycrate; +import java.io.Serializable; import java.util.Map; import java.util.Vector; import main.NGECore; - import protocol.swg.SceneCreateObjectByCrc; import protocol.swg.SceneDestroyObject; import protocol.swg.SceneEndBaselines; import protocol.swg.UpdateContainmentMessage; -import protocol.swg.UpdatePVPStatusMessage; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; @@ -41,7 +40,7 @@ import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; - +import resources.objects.ObjectMessageBuilder; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; @@ -50,8 +49,10 @@ import resources.objects.tangible.TangibleObject; */ @Persistent(version=0) -public class FactoryCrateObject extends TangibleObject { +public class FactoryCrateObject extends TangibleObject implements Serializable { + private static final long serialVersionUID = 1L; + private Vector contents; private byte capacity; private byte contentObjectQuantity; @@ -59,12 +60,19 @@ public class FactoryCrateObject extends TangibleObject { private TangibleObject contentObjectType; @NotPersistent - private FactoryCrateMessageBuilder messageBuilder; + private transient FactoryCrateMessageBuilder messageBuilder; public FactoryCrateObject() { } + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new FactoryCrateMessageBuilder(this); + } + + public FactoryCrateObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { super(objectID, planet, template, position, orientation); this.messageBuilder = new FactoryCrateMessageBuilder(this); @@ -267,4 +275,9 @@ public class FactoryCrateObject extends TangibleObject { this.getAttributes().put("@obj_attr_n:factory_count", ""+this.getQuantity()); //services.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"FCYT3 Delta"); } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } \ No newline at end of file diff --git a/src/resources/objects/group/GroupObject.java b/src/resources/objects/group/GroupObject.java index 0f5c4622..92986e39 100644 --- a/src/resources/objects/group/GroupObject.java +++ b/src/resources/objects/group/GroupObject.java @@ -23,8 +23,8 @@ package resources.objects.group; import java.util.Vector; +import resources.objects.ObjectMessageBuilder; import resources.objects.universe.UniverseObject; - import engine.clients.Client; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; @@ -38,7 +38,7 @@ public class GroupObject extends UniverseObject { private SWGObject lootMaster; private short groupLevel; private int lootMode; - private GroupMessageBuilder messageBuilder; + private transient GroupMessageBuilder messageBuilder; private int chatRoomId; public static int FREE_FOR_ALL = 0; @@ -165,4 +165,9 @@ public class GroupObject extends UniverseObject { destination.getSession().write(messageBuilder.buildBaseline6()); } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/guild/GuildObject.java b/src/resources/objects/guild/GuildObject.java index 5890756b..fe01d97a 100644 --- a/src/resources/objects/guild/GuildObject.java +++ b/src/resources/objects/guild/GuildObject.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.guild; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; @@ -28,39 +29,35 @@ import java.util.TreeMap; import org.apache.mina.core.buffer.IoBuffer; import main.NGECore; - import resources.gcw.CurrentServerGCWZoneHistory; import resources.gcw.CurrentServerGCWZonePercent; import resources.gcw.OtherServerGCWZonePercent; import resources.guild.Guild; +import resources.objects.ObjectMessageBuilder; import resources.objects.SWGList; import resources.objects.SWGMap; import resources.objects.SWGMultiMap; import resources.objects.universe.UniverseObject; import services.collections.ServerFirst; -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; import engine.clients.Client; -import engine.resources.objects.IPersistent; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Entity(version=1) -public class GuildObject extends UniverseObject implements IPersistent { +public class GuildObject extends UniverseObject implements Serializable { + private static final long serialVersionUID = 1L; protected NGECore core; @NotPersistent - private GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this); + private transient GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this); private Map serverFirst = new HashMap(); private Map> zoneMap = new TreeMap>(); - @NotPersistent - private Transaction txn; private long nextInstanceId = 0; @@ -71,19 +68,19 @@ public class GuildObject extends UniverseObject implements IPersistent { private String STFName = ""; private String customName = ""; private int volume = 0; - private SWGList guildList = new SWGList(messageBuilder, 3, 4); + private SWGList guildList = new SWGList(getObjectID(), 3, 4); // GILD 6 private int serverId = 0x43; //private String STFName = "string_id_table"; private int unknown1 = 0; private short unknown2 = 0; - private SWGMap currentServerGCWZonePercentMap = new SWGMap(messageBuilder, 6, 2); - private SWGMap currentServerGCWTotalPercentMap = new SWGMap(messageBuilder, 6, 3); - private SWGMultiMap currentServerGCWZoneHistoryMap = new SWGMultiMap(messageBuilder, 6, 4); - private SWGMultiMap currentServerGCWTotalHistoryMap = new SWGMultiMap(messageBuilder, 6, 5); - private SWGMultiMap otherServerGCWZonePercentMap = new SWGMultiMap(messageBuilder, 6, 6); - private SWGMultiMap otherServerGCWTotalPercentMap = new SWGMultiMap(messageBuilder, 6, 7); + private SWGMap currentServerGCWZonePercentMap = new SWGMap(getObjectID(), 6, 2); + private SWGMap currentServerGCWTotalPercentMap = new SWGMap(getObjectID(), 6, 3); + private SWGMultiMap currentServerGCWZoneHistoryMap = new SWGMultiMap(getObjectID(), 6, 4); + private SWGMultiMap currentServerGCWTotalHistoryMap = new SWGMultiMap(getObjectID(), 6, 5); + private SWGMultiMap otherServerGCWZonePercentMap = new SWGMultiMap(getObjectID(), 6, 6); + private SWGMultiMap otherServerGCWTotalPercentMap = new SWGMultiMap(getObjectID(), 6, 7); private int unknown3 = 5; public GuildObject(NGECore core, long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { @@ -91,6 +88,13 @@ public class GuildObject extends UniverseObject implements IPersistent { this.core = core; } + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new GuildMessageBuilder(this); + } + + public float getComplexity() { synchronized(objectMutex) { return complexity; @@ -302,12 +306,8 @@ public class GuildObject extends UniverseObject implements IPersistent { } } - public Transaction getTransaction() { - return txn; - } - - public void createTransaction(Environment env) { - txn = env.beginTransaction(null, null); + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; } } diff --git a/src/resources/objects/harvester/HarvesterObject.java b/src/resources/objects/harvester/HarvesterObject.java index 8964d7e1..87cc8ea1 100644 --- a/src/resources/objects/harvester/HarvesterObject.java +++ b/src/resources/objects/harvester/HarvesterObject.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.harvester; +import java.io.Serializable; import java.util.Vector; import main.NGECore; @@ -31,6 +32,7 @@ import engine.clients.Client; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; +import resources.objects.ObjectMessageBuilder; import resources.objects.creature.CreatureObject; import resources.objects.installation.InstallationMessageBuilder; import resources.objects.installation.InstallationObject; @@ -42,10 +44,12 @@ import resources.objects.resource.ResourceContainerObject; */ @Persistent(version=0) -public class HarvesterObject extends InstallationObject { +public class HarvesterObject extends InstallationObject implements Serializable { - private HarvesterMessageBuilder messageBuilder; - private InstallationMessageBuilder installationMessageBuilder; + private static final long serialVersionUID = 1L; + + private transient HarvesterMessageBuilder messageBuilder; + private transient InstallationMessageBuilder installationMessageBuilder; public final static byte HARVESTER_TYPE_MINERAL = 0; public final static byte HARVESTER_TYPE_CHEMICAL = 1; @@ -128,6 +132,13 @@ public class HarvesterObject extends InstallationObject { public int getBER() { return BER; } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new HarvesterMessageBuilder(this); + installationMessageBuilder = new InstallationMessageBuilder((InstallationObject)this); + } public void setBER(int baseExtractionRate) { @@ -408,4 +419,9 @@ public class HarvesterObject extends InstallationObject { //destination.getSession().write(installationMessageBuilder.buildBaseline9()); } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/installation/InstallationObject.java b/src/resources/objects/installation/InstallationObject.java index 4d78229d..a31fc02e 100644 --- a/src/resources/objects/installation/InstallationObject.java +++ b/src/resources/objects/installation/InstallationObject.java @@ -21,23 +21,41 @@ ******************************************************************************/ package resources.objects.installation; +import java.io.Serializable; + import com.sleepycat.persist.model.Entity; import engine.clients.Client; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; +import resources.objects.ObjectMessageBuilder; import resources.objects.tangible.TangibleObject; @Entity(version=0) -public class InstallationObject extends TangibleObject { +public class InstallationObject extends TangibleObject implements Serializable { + private static final long serialVersionUID = 1L; + private transient InstallationMessageBuilder messageBuilder; + public InstallationObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ - super(objectID, planet, template, position, orientation); + super(objectID, planet, template, position, orientation); + messageBuilder = new InstallationMessageBuilder(this); } @Override public void sendBaselines(Client destination) { } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new InstallationMessageBuilder(this); + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } \ No newline at end of file diff --git a/src/resources/objects/intangible/IntangibleMessageBuilder.java b/src/resources/objects/intangible/IntangibleMessageBuilder.java index 1dd0af60..c71177be 100644 --- a/src/resources/objects/intangible/IntangibleMessageBuilder.java +++ b/src/resources/objects/intangible/IntangibleMessageBuilder.java @@ -21,6 +21,26 @@ ******************************************************************************/ package resources.objects.intangible; -public class IntangibleMessageBuilder { +import org.apache.mina.core.buffer.IoBuffer; + +import resources.objects.ObjectMessageBuilder; + +public class IntangibleMessageBuilder extends ObjectMessageBuilder { + + public IntangibleMessageBuilder(IntangibleObject intangibleObject) { + setObject(intangibleObject); + } + + @Override + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + // TODO Auto-generated method stub + + } + + @Override + public void sendBaselines() { + // TODO Auto-generated method stub + + } } diff --git a/src/resources/objects/intangible/IntangibleObject.java b/src/resources/objects/intangible/IntangibleObject.java index 23801ed6..6bb64e6f 100644 --- a/src/resources/objects/intangible/IntangibleObject.java +++ b/src/resources/objects/intangible/IntangibleObject.java @@ -21,6 +21,10 @@ ******************************************************************************/ package resources.objects.intangible; +import java.io.Serializable; + +import resources.objects.ObjectMessageBuilder; + import com.sleepycat.persist.model.Persistent; import engine.clients.Client; @@ -30,16 +34,26 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=0) -public class IntangibleObject extends SWGObject { +public class IntangibleObject extends SWGObject implements Serializable { + private static final long serialVersionUID = 1L; + private transient IntangibleMessageBuilder messageBuilder; private int genericInt; public IntangibleObject() { super(); + messageBuilder = new IntangibleMessageBuilder(this); } public IntangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, position, orientation, Template); + messageBuilder = new IntangibleMessageBuilder(this); + } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new IntangibleMessageBuilder(this); } public int getGenericInt() { @@ -59,5 +73,9 @@ public class IntangibleObject extends SWGObject { // TODO Auto-generated method stub } - + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/manufacture/ManufactureSchematicMessageBuilder.java b/src/resources/objects/manufacture/ManufactureSchematicMessageBuilder.java new file mode 100644 index 00000000..30c04def --- /dev/null +++ b/src/resources/objects/manufacture/ManufactureSchematicMessageBuilder.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * 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.objects.manufacture; + +import org.apache.mina.core.buffer.IoBuffer; + +import resources.objects.ObjectMessageBuilder; + +public class ManufactureSchematicMessageBuilder extends ObjectMessageBuilder { + + public ManufactureSchematicMessageBuilder(ManufactureSchematicObject object) { + setObject(object); + } + + @Override + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + // TODO Auto-generated method stub + + } + + @Override + public void sendBaselines() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/resources/objects/manufacture/ManufactureSchematicObject.java b/src/resources/objects/manufacture/ManufactureSchematicObject.java index 4ed340ef..b8532f00 100644 --- a/src/resources/objects/manufacture/ManufactureSchematicObject.java +++ b/src/resources/objects/manufacture/ManufactureSchematicObject.java @@ -21,9 +21,13 @@ ******************************************************************************/ package resources.objects.manufacture; +import java.io.Serializable; +import resources.objects.ObjectMessageBuilder; import resources.objects.intangible.IntangibleObject; + import com.sleepycat.persist.model.Persistent; + import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @@ -34,14 +38,24 @@ import engine.resources.scene.Quaternion; */ @Persistent(version=0) -public class ManufactureSchematicObject extends IntangibleObject{ +public class ManufactureSchematicObject extends IntangibleObject implements Serializable { - //@NotPersistent - //private ManufactureSchematicMessageBuilder messageBuilder; + private static final long serialVersionUID = 1L; + private transient ManufactureSchematicMessageBuilder messageBuilder; public ManufactureSchematicObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { super(objectID, planet, position, orientation, template); - //messageBuilder = new ManufactureSchematicMessageBuilder(this); + messageBuilder = new ManufactureSchematicMessageBuilder(this); + } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new ManufactureSchematicMessageBuilder(this); + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; } } diff --git a/src/resources/objects/mission/MissionObject.java b/src/resources/objects/mission/MissionObject.java index 48f573f2..a5e4d195 100644 --- a/src/resources/objects/mission/MissionObject.java +++ b/src/resources/objects/mission/MissionObject.java @@ -21,24 +21,24 @@ ******************************************************************************/ package resources.objects.mission; -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; +import java.io.Serializable; + import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; -import resources.common.BountyListItem; +import resources.objects.ObjectMessageBuilder; import resources.objects.intangible.IntangibleObject; import resources.objects.waypoint.WaypointObject; import services.mission.MissionObjective; import engine.clients.Client; -import engine.resources.objects.IPersistent; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=1) -public class MissionObject extends IntangibleObject implements IPersistent { - +public class MissionObject extends IntangibleObject implements Serializable { + + private static final long serialVersionUID = 1L; private Point3D destination; private Point3D startLocation; private String startPlanet = ""; @@ -60,11 +60,8 @@ public class MissionObject extends IntangibleObject implements IPersistent { private long bountyObjId; @NotPersistent - MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this); - - @NotPersistent - private Transaction txn; - + private transient MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this); + public MissionObject() { super(); } @@ -78,6 +75,12 @@ public class MissionObject extends IntangibleObject implements IPersistent { return destinationPlanet; } } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new MissionMessageBuilder(this); + } public int getMissionLevel() { synchronized(objectMutex) { @@ -306,14 +309,6 @@ public class MissionObject extends IntangibleObject implements IPersistent { this.bountyObjId = bountyObjId; } - public Transaction getTransaction() { - return txn; - } - - public void createTransaction(Environment env) { - txn = env.beginTransaction(null, null); - } - @Override public void sendBaselines(Client destination) { @@ -327,5 +322,9 @@ public class MissionObject extends IntangibleObject implements IPersistent { destination.getSession().write(messageBuilder.buildBaseline8()); destination.getSession().write(messageBuilder.buildBaseline9()); } - + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index bcbc3b21..9dd04221 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.player; +import java.io.Serializable; import java.util.ArrayList; import java.util.BitSet; import java.util.HashMap; @@ -28,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import resources.objects.ObjectMessageBuilder; import resources.objects.intangible.IntangibleObject; import resources.objects.resource.ResourceContainerObject; import resources.objects.tool.SurveyTool; @@ -45,8 +47,9 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=13) -public class PlayerObject extends IntangibleObject { +public class PlayerObject extends IntangibleObject implements Serializable { + private static final long serialVersionUID = 1L; // PLAY 3 private String title; @@ -71,11 +74,11 @@ public class PlayerObject extends IntangibleObject { private Map xpList = new HashMap(); @NotPersistent - private int xpListUpdateCounter = 0; + private transient int xpListUpdateCounter = 0; private List waypoints = new ArrayList(); @NotPersistent - private int waypointListUpdateCounter = 0; + private transient int waypointListUpdateCounter = 0; private int currentForcePower = 0; // unused in NGE private int maxForcePower = 0; // unused in NGE @@ -85,7 +88,7 @@ public class PlayerObject extends IntangibleObject { private List questJournal = new ArrayList(); @NotPersistent - private int questJournalUpdateCounter = 0; + private transient int questJournalUpdateCounter = 0; private String professionWheelPosition; @@ -97,17 +100,17 @@ public class PlayerObject extends IntangibleObject { private List draftSchematicList = new ArrayList(); @NotPersistent - private int draftSchematicListUpdateCounter = 0; + private transient int draftSchematicListUpdateCounter = 0; private int experimentationPoints = 0; private int accomplishmentCounter = 0; private List friendList = new ArrayList(); @NotPersistent - private int friendListUpdateCounter = 0; + private transient int friendListUpdateCounter = 0; private List ignoreList = new ArrayList(); @NotPersistent - private int ignoreListUpdateCounter = 0; + private transient int ignoreListUpdateCounter = 0; private int languageId = 0; // unused in NGE private int currentStomach = 0; // unused in NGE @@ -129,10 +132,10 @@ public class PlayerObject extends IntangibleObject { private int lotsRemaining = 10; @NotPersistent - private PlayerMessageBuilder messageBuilder; + private transient PlayerMessageBuilder messageBuilder; @NotPersistent - private long lastPlayTimeUpdate = System.currentTimeMillis(); + private transient long lastPlayTimeUpdate = System.currentTimeMillis(); private Map factionStandingMap = new TreeMap(); @@ -145,7 +148,9 @@ public class PlayerObject extends IntangibleObject { private List chatChannels = new ArrayList(); @NotPersistent - private boolean callingCompanion = false; + private transient boolean callingCompanion = false; + + private long bountyMissionId; public PlayerObject() { super(); @@ -156,6 +161,13 @@ public class PlayerObject extends IntangibleObject { super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), "object/player/shared_player.iff"); messageBuilder = new PlayerMessageBuilder(this); } + + @Override + public void initAfterDBLoad() { + super.init(); + lastPlayTimeUpdate = System.currentTimeMillis(); + messageBuilder = new PlayerMessageBuilder(this); + } public String getTitle() { synchronized(objectMutex) { @@ -884,10 +896,8 @@ public class PlayerObject extends IntangibleObject { public boolean isMemberOfChannel(int roomId) { if (chatChannels.contains(roomId)) { - System.out.println("Member of the channel!"); return true; } - System.out.println("Not a Member of the channel!"); return false; } @@ -899,4 +909,16 @@ public class PlayerObject extends IntangibleObject { this.callingCompanion = callingCompanion; } + public long getBountyMissionId() { + return bountyMissionId; + } + + public void setBountyMissionId(long bountyMissionId) { + this.bountyMissionId = bountyMissionId; + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/resource/GalacticResource.java b/src/resources/objects/resource/GalacticResource.java index 9f23a171..eb8d1635 100644 --- a/src/resources/objects/resource/GalacticResource.java +++ b/src/resources/objects/resource/GalacticResource.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.resource; +import java.io.Serializable; import java.util.List; import java.util.Random; import java.util.Vector; @@ -31,13 +32,10 @@ import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.objects.waypoint.WaypointObject; -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; import engine.clients.Client; -import engine.resources.objects.IPersistent; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; @@ -48,10 +46,9 @@ import engine.resources.scene.Quaternion; */ @Entity(version=0) -public class GalacticResource extends SWGObject implements IPersistent { +public class GalacticResource extends SWGObject implements Serializable { - @NotPersistent - private Transaction txn; + private static final long serialVersionUID = 1L; private String name; private String fileName; @@ -63,30 +60,30 @@ public class GalacticResource extends SWGObject implements IPersistent { @NotPersistent - public static final int INT_COLDRESISTANCE = 0; + public transient static final int INT_COLDRESISTANCE = 0; @NotPersistent - public static final int INT_CONDUCTIVITY = 1; + public transient static final int INT_CONDUCTIVITY = 1; @NotPersistent - public static final int INT_DECAYRESISTANCE = 2; + public transient static final int INT_DECAYRESISTANCE = 2; @NotPersistent - public static final int INT_HEATRESISTANCE = 3; + public transient static final int INT_HEATRESISTANCE = 3; @NotPersistent - public static final int INT_MALLEABILITY = 4; + public transient static final int INT_MALLEABILITY = 4; @NotPersistent - public static final int INT_SHOCKRESISTANCE = 5; + public transient static final int INT_SHOCKRESISTANCE = 5; @NotPersistent - public static final int INT_UNITTOUGHNESS = 6; + public transient static final int INT_UNITTOUGHNESS = 6; @NotPersistent - public static final int INT_ENTANGLERESISTANCE = 7; + public transient static final int INT_ENTANGLERESISTANCE = 7; @NotPersistent - public static final int INT_POTENTIALENERGY = 8; + public transient static final int INT_POTENTIALENERGY = 8; @NotPersistent - public static final int INT_OVERALLQUALITY = 9; + public transient static final int INT_OVERALLQUALITY = 9; @NotPersistent - public static final int INT_FLAVOR = 10; + public transient static final int INT_FLAVOR = 10; @NotPersistent - public static final String[] statNamesLookup = {"Cold Resistance", + public transient static final String[] statNamesLookup = {"Cold Resistance", "Conductivity", "Decay Resistance", "Heat Resistance", @@ -117,22 +114,22 @@ public class GalacticResource extends SWGObject implements IPersistent { short[] resourceStats = new short[11]; @NotPersistent - private static int RES_CAT_HI = 1; // Up to 99%, easy to find spots over 90% + private transient static int RES_CAT_HI = 1; // Up to 99%, easy to find spots over 90% @NotPersistent - private static int RES_CAT_MID = 2; // Up to 90%, often have to settle at around 80% + private transient static int RES_CAT_MID = 2; // Up to 90%, often have to settle at around 80% @NotPersistent - private static int RES_CAT_LO = 3; // Up to 70%, often have to settle around 60% + private transient static int RES_CAT_LO = 3; // Up to 70%, often have to settle around 60% @NotPersistent - private static int RES_CAT_CRE = 4; // Creature resource + private transient static int RES_CAT_CRE = 4; // Creature resource @NotPersistent // Direct Persistence Layer entity reference restriction - private ResourceRoot resourceRoot; + private transient ResourceRoot resourceRoot; private int resourceRootID; // This is for re-referencing the resourceRoot in the reloaded resourceRoot collection // due to the DPL entity reference restriction @NotPersistent - private double minDist = 99999.0; + private transient double minDist = 99999.0; public GalacticResource(){ @@ -148,6 +145,11 @@ public class GalacticResource extends SWGObject implements IPersistent { this.id = id; } + @Override + public void initAfterDBLoad() { + init(); + } + public GalacticResource(String name, String fileName, String category){ this.name = name; this.fileName = fileName; @@ -633,13 +635,6 @@ public class GalacticResource extends SWGObject implements IPersistent { "zau"}; - @Override - public void createTransaction(Environment env) { txn = env.beginTransaction(null, null);} - - - @Override - public Transaction getTransaction() { return txn; } - @Override public void sendBaselines(Client arg0) { } diff --git a/src/resources/objects/resource/PlanetDeposits.java b/src/resources/objects/resource/PlanetDeposits.java index 712ec89b..9daea331 100644 --- a/src/resources/objects/resource/PlanetDeposits.java +++ b/src/resources/objects/resource/PlanetDeposits.java @@ -1,12 +1,14 @@ package resources.objects.resource; +import java.io.Serializable; import java.util.List; import com.sleepycat.persist.model.Persistent; @Persistent(version=0) -public class PlanetDeposits { +public class PlanetDeposits implements Serializable { + private static final long serialVersionUID = 1L; private int planetId; private List depositList; diff --git a/src/resources/objects/resource/ResourceContainerObject.java b/src/resources/objects/resource/ResourceContainerObject.java index c5b84a9f..66ac4a80 100644 --- a/src/resources/objects/resource/ResourceContainerObject.java +++ b/src/resources/objects/resource/ResourceContainerObject.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.resource; +import java.io.Serializable; import main.NGECore; @@ -32,6 +33,7 @@ import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; +import resources.objects.ObjectMessageBuilder; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; @@ -40,8 +42,9 @@ import resources.objects.tangible.TangibleObject; */ @Persistent(version=0) -public class ResourceContainerObject extends TangibleObject { +public class ResourceContainerObject extends TangibleObject implements Serializable { + private static final long serialVersionUID = 1L; // Unique ID private long containerID; @@ -131,20 +134,27 @@ public class ResourceContainerObject extends TangibleObject { */ @NotPersistent - public static int maximalStackCapacity = 100000; + public transient static int maximalStackCapacity = 100000; @NotPersistent - private ResourceContainerMessageBuilder messageBuilder; + private transient ResourceContainerMessageBuilder messageBuilder; public ResourceContainerObject(){ } + public ResourceContainerObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ super(objectID, planet, template, position, orientation); messageBuilder = new ResourceContainerMessageBuilder(this); this.setAttachment("radial_filename", "resourceContainer"); - } + } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new ResourceContainerMessageBuilder(this); + } public void initializeStats(GalacticResource resource){ this.setResourceName(resource.getName()); @@ -548,4 +558,9 @@ public class ResourceContainerObject extends TangibleObject { destination.getSession().write(messageBuilder.buildDelta3()); } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/resource/ResourceDeposit.java b/src/resources/objects/resource/ResourceDeposit.java index 9a6572fc..b3772f52 100644 --- a/src/resources/objects/resource/ResourceDeposit.java +++ b/src/resources/objects/resource/ResourceDeposit.java @@ -1,5 +1,7 @@ package resources.objects.resource; +import java.io.Serializable; + import com.sleepycat.persist.model.Persistent; /** @@ -7,7 +9,9 @@ import com.sleepycat.persist.model.Persistent; */ @Persistent(version=0) -public class ResourceDeposit { +public class ResourceDeposit implements Serializable { + + private static final long serialVersionUID = 1L; private float spawnCoordsX; private float spawnCoordsZ; private float spawnRadius; diff --git a/src/resources/objects/resource/ResourceRoot.java b/src/resources/objects/resource/ResourceRoot.java index 34bba280..31d558da 100644 --- a/src/resources/objects/resource/ResourceRoot.java +++ b/src/resources/objects/resource/ResourceRoot.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.objects.resource; +import java.io.Serializable; + import com.sleepycat.je.Environment; import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; @@ -32,8 +34,9 @@ import com.sleepycat.persist.model.PrimaryKey; */ @Entity(version=0) -public class ResourceRoot { +public class ResourceRoot implements Serializable { + private static final long serialVersionUID = 1L; // Publish 15: // - Total: 61, Minimum pool: 15, Random pool: 24 (3 was removed), Fixed pool: 22. @@ -84,7 +87,7 @@ public class ResourceRoot { // All 38 Organic types for each planet @NotPersistent - private Transaction txn; + private transient Transaction txn; private static int highestID = 0; diff --git a/src/resources/objects/ship/ShipObject.java b/src/resources/objects/ship/ShipObject.java index 62d4d6a4..67d27246 100644 --- a/src/resources/objects/ship/ShipObject.java +++ b/src/resources/objects/ship/ShipObject.java @@ -21,11 +21,26 @@ ******************************************************************************/ package resources.objects.ship; +import java.io.Serializable; + import com.sleepycat.persist.model.Persistent; +import resources.objects.ObjectMessageBuilder; import resources.objects.tangible.TangibleObject; @Persistent(version=0) -public class ShipObject extends TangibleObject { - +public class ShipObject extends TangibleObject implements Serializable { + + private static final long serialVersionUID = 1L; + private transient ObjectMessageBuilder messageBuilder = null; + + @Override + public void initAfterDBLoad() { + super.init(); + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/staticobject/StaticObject.java b/src/resources/objects/staticobject/StaticObject.java index 53297b00..a0c2de5c 100644 --- a/src/resources/objects/staticobject/StaticObject.java +++ b/src/resources/objects/staticobject/StaticObject.java @@ -21,6 +21,10 @@ ******************************************************************************/ package resources.objects.staticobject; +import java.io.Serializable; + +import resources.objects.ObjectMessageBuilder; + import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; @@ -31,10 +35,11 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=0) -public class StaticObject extends SWGObject { +public class StaticObject extends SWGObject implements Serializable { + private static final long serialVersionUID = 1L; @NotPersistent - private StaticMessageBuilder messageBuilder; + private transient StaticMessageBuilder messageBuilder; public StaticObject() { super(); @@ -60,4 +65,15 @@ public class StaticObject extends SWGObject { } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new StaticMessageBuilder(this); + } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index a06dfcaf..cb2e4f3f 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -22,6 +22,7 @@ package resources.objects.tangible; import java.io.ByteArrayOutputStream; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -40,7 +41,9 @@ import protocol.swg.objectControllerObjects.ShowFlyText; import resources.common.OutOfBand; import resources.common.RGB; import resources.datatables.Options; +import resources.datatables.PvpStatus; import resources.loot.LootGroup; +import resources.objects.ObjectMessageBuilder; import resources.objects.creature.CreatureObject; import resources.visitors.IDManagerVisitor; @@ -54,9 +57,10 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=13) -public class TangibleObject extends SWGObject { +@Persistent(version=12) +public class TangibleObject extends SWGObject implements Serializable { + private static final long serialVersionUID = 1L; // TODO: Thread safety protected int incapTimer = 10; @@ -72,9 +76,9 @@ public class TangibleObject extends SWGObject { protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason protected int factionStatus = 0; @NotPersistent - private Vector defendersList = new Vector(); // unused in packets but useful for the server + private transient Vector defendersList = new Vector(); // unused in packets but useful for the server @NotPersistent - private TangibleMessageBuilder messageBuilder; + private transient TangibleMessageBuilder messageBuilder; private int respawnTime = 0; private Point3D spawnCoordinates = new Point3D(0, 0, 0); @@ -83,13 +87,13 @@ public class TangibleObject extends SWGObject { private List lootGroups = new ArrayList(); @NotPersistent - private boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart + private transient boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart @NotPersistent - private boolean lootLock = false; + private transient boolean lootLock = false; @NotPersistent - private boolean creditRelieved = false; + private transient boolean creditRelieved = false; @NotPersistent - private boolean lootItem = false; + private transient boolean lootItem = false; private boolean stackable = false; private int stackCount = 1; @@ -101,7 +105,7 @@ public class TangibleObject extends SWGObject { private String serialNumber; @NotPersistent - private TangibleObject killer = null; + private transient TangibleObject killer = null; public TangibleObject(long objectID, Planet planet, String template) { super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); @@ -121,6 +125,12 @@ public class TangibleObject extends SWGObject { messageBuilder = new TangibleMessageBuilder(this); } + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new TangibleMessageBuilder(this); + } + public void setCustomName2(String customName) { setCustomName(customName); @@ -390,7 +400,10 @@ public class TangibleObject extends SWGObject { } public boolean isAttackableBy(CreatureObject attacker) { + int pvpStatus = NGECore.getInstance().factionService.calculatePvpStatus(attacker, this); + return (((pvpStatus & PvpStatus.Attackable) == PvpStatus.Attackable) || ((pvpStatus & PvpStatus.Aggressive) == PvpStatus.Aggressive)); + /* CreatureObject creature; if(this instanceof CreatureObject) { @@ -427,6 +440,7 @@ public class TangibleObject extends SWGObject { return true; return getPvPBitmask() == 1 || getPvPBitmask() == 2; + */ } public void showFlyText(OutOfBand outOfBand, float scale, RGB color, int displayType, boolean notifyObservers) { @@ -622,4 +636,9 @@ public class TangibleObject extends SWGObject { } + + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/tool/SurveyTool.java b/src/resources/objects/tool/SurveyTool.java index 90dfbc18..a8fde661 100644 --- a/src/resources/objects/tool/SurveyTool.java +++ b/src/resources/objects/tool/SurveyTool.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.tool; +import java.io.Serializable; import java.util.Vector; import main.NGECore; @@ -41,8 +42,9 @@ import resources.objects.tangible.TangibleObject; */ @Persistent(version=0) -public class SurveyTool extends TangibleObject{ +public class SurveyTool extends TangibleObject implements Serializable { + private static final long serialVersionUID = 1L; private byte toolType=0; private long surveyResourceID; private long userID=0; @@ -50,25 +52,25 @@ public class SurveyTool extends TangibleObject{ private byte SurveyRangeSetting=0; @NotPersistent - private String surveyEffectString=""; + private transient String surveyEffectString=""; @NotPersistent - private String sampleEffectString=""; + private transient String sampleEffectString=""; @NotPersistent - private boolean currentlySurveying=false; + private transient boolean currentlySurveying=false; @NotPersistent - private boolean currentlySampling=false; + private transient boolean currentlySampling=false; @NotPersistent - private boolean currentlyCoolingDown=false; + private transient boolean currentlyCoolingDown=false; @NotPersistent - private boolean exceptionalState=false; + private transient boolean exceptionalState=false; @NotPersistent - private boolean recoveryMode=false; + private transient boolean recoveryMode=false; @NotPersistent - private Long lastSurveyTime=0L; + private transient Long lastSurveyTime=0L; @NotPersistent - private Long lastSampleTime=0L; + private transient Long lastSampleTime=0L; @NotPersistent - private Long recoveryTime=10L; + private transient Long recoveryTime=10L; public static byte MineralSurveyDevice = 1; public static byte ChemicalSurveyDevice = 2; @@ -84,6 +86,12 @@ public class SurveyTool extends TangibleObject{ this.exceptionalState = false; } + @Override + public void initAfterDBLoad() { + super.init(); + this.exceptionalState = false; + } + public SurveyTool(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ super(objectID, planet, template, position, orientation); surveyEffectString = ""; diff --git a/src/resources/objects/universe/UniverseObject.java b/src/resources/objects/universe/UniverseObject.java index 723d5a1e..841e300a 100644 --- a/src/resources/objects/universe/UniverseObject.java +++ b/src/resources/objects/universe/UniverseObject.java @@ -21,6 +21,10 @@ ******************************************************************************/ package resources.objects.universe; +import java.io.Serializable; + +import resources.objects.ObjectMessageBuilder; + import com.sleepycat.persist.model.Persistent; import engine.clients.Client; @@ -30,7 +34,10 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=0) -public class UniverseObject extends SWGObject { +public class UniverseObject extends SWGObject implements Serializable { + + private static final long serialVersionUID = 1L; + private transient ObjectMessageBuilder messageBuilder = null; public UniverseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, position, orientation, Template); @@ -39,6 +46,11 @@ public class UniverseObject extends SWGObject { public UniverseObject() { super(); } + + @Override + public void initAfterDBLoad() { + super.init(); + } @Override public void sendBaselines(Client arg0) { @@ -46,4 +58,8 @@ public class UniverseObject extends SWGObject { } + public ObjectMessageBuilder getMessageBuilder() { + return messageBuilder; + } + } diff --git a/src/resources/objects/waypoint/WaypointObject.java b/src/resources/objects/waypoint/WaypointObject.java index 32d73e1b..6cd72dca 100644 --- a/src/resources/objects/waypoint/WaypointObject.java +++ b/src/resources/objects/waypoint/WaypointObject.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.objects.waypoint; +import java.io.Serializable; + import resources.objects.intangible.IntangibleObject; import com.sleepycat.persist.model.Persistent; @@ -31,7 +33,9 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=0) -public class WaypointObject extends IntangibleObject { +public class WaypointObject extends IntangibleObject implements Serializable { + + private static final long serialVersionUID = 1L; private int cellId; // ??? private long locationNetworkId; @@ -54,6 +58,11 @@ public class WaypointObject extends IntangibleObject { super(objectID, planet, position, new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff"); } + @Override + public void initAfterDBLoad() { + super.init(); + } + public int getCellId() { synchronized(objectMutex) { return cellId; diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 2d0fa6ba..65d15a72 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.objects.weapon; +import java.io.Serializable; + import resources.datatables.WeaponType; import resources.objects.tangible.TangibleObject; @@ -33,12 +35,14 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent(version=1) -public class WeaponObject extends TangibleObject { +public class WeaponObject extends TangibleObject implements Serializable { + private static final long serialVersionUID = 1L; + // TODO: Thread safety @NotPersistent - private WeaponMessageBuilder messageBuilder; + private transient WeaponMessageBuilder messageBuilder; public WeaponObject(long objectID, Planet planet, String template) { super(objectID, planet, template, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0)); @@ -53,12 +57,17 @@ public class WeaponObject extends TangibleObject { if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); setStringAttribute("cat_wpn_damage.damage", "0-0"); } - public WeaponObject() { super(); messageBuilder = new WeaponMessageBuilder(this); } + + @Override + public void initAfterDBLoad() { + super.init(); + messageBuilder = new WeaponMessageBuilder(this); + } public int getIncapTimer() { return incapTimer; @@ -214,5 +223,4 @@ public class WeaponObject extends TangibleObject { return false; } - } diff --git a/src/resources/skills/SkillMod.java b/src/resources/skills/SkillMod.java index 2bce0b23..c3cbbbfe 100644 --- a/src/resources/skills/SkillMod.java +++ b/src/resources/skills/SkillMod.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.skills; +import java.io.Serializable; + import org.apache.mina.core.buffer.IoBuffer; import resources.objects.Delta; @@ -28,8 +30,10 @@ import resources.objects.Delta; import com.sleepycat.persist.model.Persistent; @Persistent(version=0) -public class SkillMod extends Delta { +public class SkillMod extends Delta implements Serializable { + private static final long serialVersionUID = 1L; + private int base; private int modifier; diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 7807b9ec..55fd1de3 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -269,10 +269,7 @@ public class CharacterService implements INetworkDispatch { core.skillModService.addSkillMod(object, "language_basic_speak", 100); core.skillModService.addSkillMod(object, "creature_harvesting", 25); core.skillModService.addSkillMod(object, "language_wookiee_comprehend", 100); - - - 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()); @@ -317,14 +314,9 @@ public class CharacterService implements INetworkDispatch { } // TODO: Race abilities - if (client.isGM()) - object.addAbility("admin"); - object.addAbility("startDance"); object.addAbility("startDance+Basic"); - object.setFaction("neutral"); - object.addObjectToEquipList(datapad); object.addObjectToEquipList(inventory); object.addObjectToEquipList(bank); @@ -339,9 +331,7 @@ public class CharacterService implements INetworkDispatch { createStarterClothing(object, sharedRaceTemplate, clientCreateCharacter.getStarterProfession()); //core.scriptService.callScript("scripts/", "demo", "CreateStartingCharacter", core, object); - core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction()); - // might not need to commit transaction but better safe than sorry - object.getTransaction().commitSync(); + core.getSWGObjectODB().put(object.getObjectID(), object); PreparedStatement ps = databaseConnection.preparedStatement("INSERT INTO characters (id, \"firstName\", \"lastName\", \"accountId\", \"galaxyId\", \"statusId\", appearance, gmflag) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); ps.setLong(1, object.getObjectID()); diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index c27423cd..b5e5e1e7 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -270,7 +270,7 @@ public class ConnectionService implements INetworkDispatch { } }*/ - core.missionService.getBountyList().remove(core.getBountiesODB().get(object.getObjectId(), Long.class, BountyListItem.class)); + core.missionService.getBountyList().remove(core.getBountiesODB().get(object.getObjectId())); ghost.toggleFlag(PlayerFlags.LD); @@ -283,9 +283,7 @@ public class ConnectionService implements INetworkDispatch { schedulers.clear(); core.playerService.getSchedulers().remove(object.getObjectID()); - object.createTransaction(core.getCreatureODB().getEnvironment()); - core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction()); - object.getTransaction().commitSync(); + core.getSWGObjectODB().put(object.getObjectID(), object); core.objectService.destroyObject(object); } diff --git a/src/services/DevService.java b/src/services/DevService.java index e2bd4390..5f99911c 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -31,7 +31,6 @@ import java.util.Vector; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; -import protocol.swg.ExpertiseRequestMessage; import resources.common.Console; import resources.common.FileUtilities; import resources.common.Opcodes; @@ -79,7 +78,6 @@ public class DevService implements INetworkDispatch { case 1: // Character suiOptions.put((long) 10, "Set combat level to 90"); suiOptions.put((long) 11, "Give 100,000 credits"); - suiOptions.put((long) 12, "Reset expertise"); break; case 2: // Items suiOptions.put((long) 20, "Armor"); @@ -88,10 +86,13 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 23, "Jedi Items"); suiOptions.put((long) 26, "Installations"); suiOptions.put((long) 110, "Survey Devices"); + if(creature.getPlayerObject().getProfession().equals("bounty_hunter_1a")) suiOptions.put((long) 123, "Tracking Droids"); if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds"); if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools"); if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds"); - + if(creature.getClient().isGM()) suiOptions.put((long) 121, "Sandbox City"); + if(creature.getClient().isGM()) suiOptions.put((long) 122, "Jedi Ruins"); + break; case 3: // [Items] Weapons suiOptions.put((long) 30, "Jedi Weapons"); @@ -103,6 +104,7 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 40, "Unity Ring"); suiOptions.put((long) 41, "Tusken Rucksack"); suiOptions.put((long) 42, "Heroism Jewlery Set"); + suiOptions.put((long) 43, "Breath of Heaven"); break; case 5: // [Items] Armor suiOptions.put((long) 50, "Assault Armor"); @@ -170,18 +172,7 @@ public class DevService implements INetworkDispatch { case 11: // Give 100,000 credits player.setCashCredits(player.getCashCredits() + 100000); return; - case 12: // Reset expertise - // Seefo->Light: I commented out the below line because it gave us an error and didn't properly remove the skill, could you try the method SWGList.reverseGet that I added? - //player.getSkills().get().stream().filter(s -> s.contains("expertise")).forEach(s -> core.skillService.removeSkill(creature, s)); - - // Using this for now - for(int i = creature.getSkills().size() - 1; i >= 0; i-- ) - { - String skill = creature.getSkills().get(i); - if(skill.contains("expertise")) core.skillService.removeSkill(player, skill); - } - return; - + // Items case 20: // Armor sendCharacterBuilderSUI(player, 5); @@ -353,6 +344,12 @@ public class DevService implements INetworkDispatch { inventory.add(heroismBraceletRight); inventory.add(heroismBraceletLeft); return; + case 43: + TangibleObject drink = (TangibleObject) core.objectService.createObject("object/tangible/food/crafted/shared_drink_breath_of_heaven.iff", planet); + drink.setFloatAttribute("cat_stat_mod_bonus.@stat_n:constitution_modified", 100); + drink.setFloatAttribute("cat_stat_mod_bonus.@stat_n:dodge", 3); + inventory.add(drink); + return; case 50: // [Items] Assault Armor sendCharacterBuilderSUI(player, 6); return; @@ -1176,6 +1173,26 @@ public class DevService implements INetworkDispatch { inventory.add(deed); return; + + case 121: + NGECore.getInstance().playerCityService.buildSandboxTestCity(player); + return; + + case 122: + Point3D position = new Point3D(4086,15,5554); + core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("dantooine"), position, player.getOrientation(), null); + return; + + case 123: + TangibleObject arakydDroids = (TangibleObject) core.objectService.createObject("object/tangible/mission/shared_mission_bounty_droid_probot.iff", planet); + //arakydDroids.setStackable(true); + //arakydDroids.setStackCount(10); + inventory.add(arakydDroids); + + TangibleObject seekerDroids = (TangibleObject) core.objectService.createObject("object/tangible/mission/shared_mission_bounty_droid_seeker.iff", planet); + inventory.add(seekerDroids); + return; + case 125: TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet); genericCraftingTool.setCustomName("Generic Crafting Tool"); diff --git a/src/services/LoginService.java b/src/services/LoginService.java index 374400ef..bad84964 100644 --- a/src/services/LoginService.java +++ b/src/services/LoginService.java @@ -26,6 +26,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; +import java.util.Properties; import java.util.Random; import java.util.concurrent.ScheduledExecutorService; @@ -42,7 +43,6 @@ import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import engine.resources.service.LocalDbLoginProvider; import engine.resources.service.VBLoginProvider; - import protocol.swg.CharacterCreationDisabled; import protocol.swg.ClientUIErrorMessage; import protocol.swg.DeleteCharacterMessage; @@ -56,7 +56,6 @@ import protocol.swg.ServerNowEpochTime; import protocol.swg.StationIdHasJediSlot; import resources.common.*; import resources.datatables.PlayerFlags; - import resources.objects.creature.CreatureObject; @SuppressWarnings("unused") @@ -206,7 +205,12 @@ public class LoginService implements INetworkDispatch{ core.objectService.destroyObject(object); } - core.getCreatureODB().delete(new Long(packet.getcharId()), Long.class, CreatureObject.class); + try { + core.getSWGObjectODB().remove(object.getObjectID()); + } catch (Exception e) { + + } + DeleteCharacterReplyMessage reply = new DeleteCharacterReplyMessage(0); session.write(reply.serialize()); } @@ -224,7 +228,16 @@ public class LoginService implements INetworkDispatch{ } public boolean checkForGmPermission(int id) { + try { + if (core.getConfig().getInt("ADMIN") > 0) { + return true; + } + } catch (Exception e) { + + } + PreparedStatement preparedStatement; + try { preparedStatement = databaseConnection1.preparedStatement("SELECT * FROM accounts WHERE id=" + id + ""); ResultSet resultSet = preparedStatement.executeQuery(); @@ -233,6 +246,7 @@ public class LoginService implements INetworkDispatch{ } catch (SQLException e) { e.printStackTrace(); } + return false; } diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 62f6e14a..8cc06788 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -69,6 +69,7 @@ import resources.common.RGB; import resources.common.SpawnPoint; import resources.common.StringUtilities; import resources.datatables.DisplayType; +import resources.datatables.Options; import resources.datatables.PlayerFlags; import resources.datatables.Professions; import resources.guild.Guild; @@ -116,15 +117,41 @@ public class PlayerService implements INetworkDispatch { } public void postZoneIn(final CreatureObject creature) { - if(schedulers.get(creature.getObjectID()) != null) return; + List> scheduleList = new ArrayList>(); + scheduleList.add(scheduler.scheduleAtFixedRate(() -> { ServerTimeMessage time = new ServerTimeMessage(core.getGalacticTime() / 1000); IoBuffer packet = time.serialize(); creature.getClient().getSession().write(packet); - }, 45, 45, TimeUnit.SECONDS)); + }, 5, 45, TimeUnit.SECONDS)); + + scheduleList.add(scheduler.scheduleAtFixedRate(() -> { + if (creature.isInStealth() && !creature.getOption(Options.INVULNERABLE) && ((PlayerObject) creature.getSlottedObject("ghost")).getGodLevel() == 0) { + List objects = core.simulationService.get(creature.getPlanet(), creature.getPosition().x, creature.getPosition().z, 64); + + for (SWGObject object : objects) { + if (object == null) { + continue; + } + + if (!(object instanceof CreatureObject)) { + continue; + } + + CreatureObject observer = (CreatureObject) object; + + int camoflauge = creature.getSkillModBase("camoflauge") - observer.getSkillModBase("detectcamo"); + camoflauge -= (64 - creature.getPosition().getDistance(observer.getPosition())); + + if (new Random(camoflauge).nextInt() == camoflauge) { + creature.setInStealth(false); + } + } + } + }, 15, 15, TimeUnit.SECONDS)); scheduleList.add(scheduler.scheduleAtFixedRate(() -> { PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); @@ -147,6 +174,7 @@ public class PlayerService implements INetworkDispatch { creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4)); }, 0, 1000, TimeUnit.MILLISECONDS)); schedulers.put(creature.getObjectID(), scheduleList); + /*final PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost"); scheduler.schedule(new Runnable() { @@ -159,7 +187,6 @@ public class PlayerService implements INetworkDispatch { } }, 1, TimeUnit.SECONDS);*/ - } @Override @@ -1255,25 +1282,51 @@ public class PlayerService implements INetworkDispatch { } public void sendSetBountyWindow(final CreatureObject victim, final CreatureObject attacker) { - SUIWindow bountyWindow = core.suiService.createInputBox(InputBoxType.INPUT_BOX_OK_CANCEL, "@bounty_hunter:setbounty_title", "@bounty_hunter:setbounty_prompt1 " + attacker.getCustomName() + "?" + "\n@bounty_hunter:setbounty_prompt2 " + victim.getBankCredits(), - victim, null, (float) 10, new SUICallback() { + SUIWindow bountyWindow = core.suiService.createInputBox(InputBoxType.INPUT_BOX_OK_CANCEL, "@bounty_hunter:setbounty_title", "@bounty_hunter:setbounty_prompt1 " + attacker.getCustomName() + "?" + "\n@bounty_hunter:setbounty_prompt2 " + + String.valueOf(victim.getBankCredits() + victim.getCashCredits()), victim, null, (float) 10, new SUICallback() { @Override public void process(SWGObject owner, int eventType, Vector returnList) { if (eventType == 0 && returnList.get(0) != null) { int bounty = Integer.parseInt(returnList.get(0)); + int totalFunds = victim.getBankCredits() + victim.getCashCredits(); - if (bounty > victim.getBankCredits()) + if (bounty > totalFunds) { + victim.sendSystemMessage("@bounty_hunter:setbounty_too_much", DisplayType.Broadcast); + sendSetBountyWindow(victim, attacker); return; - - if (!core.missionService.addToExistingBounty(attacker, bounty)) - core.missionService.createNewBounty(attacker, bounty); - - victim.setBankCredits(victim.getBankCredits() - bounty); + } + + if (bounty < 20000) { + victim.sendSystemMessage("@bounty_hunter:setbounty_too_little", DisplayType.Broadcast); + sendSetBountyWindow(victim, attacker); + return; + } else if (bounty > 1000000) { + victim.sendSystemMessage("@bounty_hunter:setbounty_cap", DisplayType.Broadcast); + bounty = 1000000; + } + + // Try removing bounty amount from the bank first then cash. Remove amount accordingly if bank/cash is less than placed bounty. + if (bounty > victim.getBankCredits()) { + int difference = bounty - victim.getBankCredits(); + + victim.setCashCredits(victim.getCashCredits() - difference); + victim.setBankCredits(0); + } else if (bounty > victim.getCashCredits()) { + int difference = bounty - victim.getCashCredits(); + + victim.setBankCredits(victim.getBankCredits() - difference); + victim.setCashCredits(0); + } else { victim.setBankCredits(victim.getBankCredits() - bounty); } + + if (!core.missionService.addToExistingBounty(attacker.getObjectId(), victim.getObjectId(), bounty)) + core.missionService.createNewBounty(attacker, victim.getObjectId(), bounty); } } }); + bountyWindow.setProperty("txtInput:NumericInteger", "true"); + bountyWindow.setProperty("txtInput:MaxLength", "7"); core.suiService.openSUIWindow(bountyWindow); } diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 29f352cf..f32b1365 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -34,6 +34,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import main.NGECore; @@ -53,6 +54,7 @@ import engine.resources.common.Event; import engine.resources.common.Mesh3DTriangle; import engine.resources.common.Ray; import engine.resources.container.Traverser; +import engine.resources.database.ODBCursor; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; @@ -186,13 +188,11 @@ public class SimulationService implements INetworkDispatch { } public void insertPersistentBuildings() { - EntityCursor cursor = core.getBuildingODB().getCursor(Long.class, BuildingObject.class); + ODBCursor cursor = core.getSWGObjectODB().getCursor(); - Iterator it = cursor.iterator(); - - while(it.hasNext()) { - final BuildingObject building = (BuildingObject) core.objectService.getObject(it.next().getObjectID()); - if(building == null) + while(cursor.hasNext()) { + SWGObject building = core.objectService.getObject(((SWGObject) cursor.next()).getObjectID()); + if(building == null || !(building instanceof BuildingObject)) continue; if(building.getAttachment("hasLoadedServerTemplate") == null) core.objectService.loadServerTemplate(building); @@ -214,22 +214,23 @@ public class SimulationService implements INetworkDispatch { return collidableQuadTrees.get(planet.getName()).get(x, y, range); } - public boolean add(SWGObject object, float x, float y) { - return add(object, x, y, false); + public boolean add(SWGObject object, float x, float z) { + return add(object, x, z, false); } - public boolean add(SWGObject object, float x, float y, boolean notifyObservers) { + public boolean add(SWGObject object, float x, float z, boolean notifyObservers) { object.setIsInQuadtree(true); - boolean success = quadTrees.get(object.getPlanet().getName()).put(x, y, object); + boolean success = quadTrees.get(object.getPlanet().getName()).put(x, z, object); if(success) { @SuppressWarnings("unchecked") Vector childObjects = (Vector) object.getAttachment("childObjects"); if(childObjects != null) { addChildObjects(object, childObjects); object.setAttachment("childObjects", null); } + if(notifyObservers) { - Point3D pos = new Point3D(x, 0, y); - Collection newAwareObjects = get(object.getPlanet(), x, y, 512); + Point3D pos = new Point3D(x, 0, z); + Collection newAwareObjects = get(object.getPlanet(), x, z, 512); for(Iterator it = newAwareObjects.iterator(); it.hasNext();) { SWGObject obj = it.next(); if((obj.getAttachment("bigSpawnRange") == null && obj.getWorldPosition().getDistance2D(pos) > 200) || obj == object) @@ -263,39 +264,39 @@ public class SimulationService implements INetworkDispatch { } - public boolean move(SWGObject object, int oldX, int oldY, int newX, int newY) { - if(quadTrees.get(object.getPlanet().getName()).remove(oldX, oldY, object)) { - return quadTrees.get(object.getPlanet().getName()).put(newX, newY, object); + public boolean move(SWGObject object, int oldX, int oldZ, int newX, int newZ) { + if(quadTrees.get(object.getPlanet().getName()).remove(oldX, oldZ, object)) { + return quadTrees.get(object.getPlanet().getName()).put(newX, newZ, object); } return false; } - public boolean move(SWGObject object, float oldX, float oldY, float newX, float newY) { + public boolean move(SWGObject object, float oldX, float oldZ, float newX, float newZ) { long startTime = System.nanoTime(); - if(quadTrees.get(object.getPlanet().getName()).remove(oldX, oldY, object)) { - boolean success = quadTrees.get(object.getPlanet().getName()).put(newX, newY, object); + if(quadTrees.get(object.getPlanet().getName()).remove(oldX, oldZ, object)) { + boolean success = quadTrees.get(object.getPlanet().getName()).put(newX, newZ, object); return success; } System.out.println("Move failed."); return false; } - public List get(Planet planet, float x, float y, int range) { - List list = quadTrees.get(planet.getName()).get((int)x, (int)y, range); + public List get(Planet planet, float x, float z, int range) { + List list = quadTrees.get(planet.getName()).get((int)x, (int)z, range); return list; } - public boolean remove(SWGObject object, float x, float y) { - return remove(object, x, y, false); + public boolean remove(SWGObject object, float x, float z) { + return remove(object, x, z, false); } - public boolean remove(SWGObject object, float x, float y, boolean notifyObservers) { + public boolean remove(SWGObject object, float x, float z, boolean notifyObservers) { if (object == null || !object.isInQuadtree()) { return false; } - boolean success = quadTrees.get(object.getPlanet().getName()).remove(x, y, object); + boolean success = quadTrees.get(object.getPlanet().getName()).remove(x, z, object); object.setIsInQuadtree(success); if(success && notifyObservers) { HashSet oldObservers = new HashSet(object.getObservers()); @@ -763,6 +764,8 @@ public class SimulationService implements INetworkDispatch { if(object.getAttachment("proposer") != null) object.setAttachment("proposer", null); + object.setPvPBitmask(0); + //session.suspendWrite(); final long objectId = object.getObjectID(); @@ -789,10 +792,14 @@ public class SimulationService implements INetworkDispatch { ScheduledFuture disconnectTask = scheduler.schedule(new Runnable() { @Override public void run() { - if(core.objectService.getObject(objectId).getAttachment("disconnectTask") != null) - core.connectionService.disconnect(client); + SWGObject object = core.objectService.getObject(objectId); + + if (object.getAttachment("disconnectTask") != null) { + //core.connectionService.disconnect(client); + core.simulationService.remove(object, object.getPosition().x, object.getPosition().z, true); + } } - }, 1, TimeUnit.MINUTES); + }, 120, TimeUnit.SECONDS); core.removeClient(session); object.setAttachment("disconnectTask", disconnectTask); diff --git a/src/services/StaticService.java b/src/services/StaticService.java index 41401fea..3479748d 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -21,10 +21,19 @@ ******************************************************************************/ package services; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.FileVisitor; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.List; import java.util.Map; +import resources.common.FileUtilities; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; @@ -55,17 +64,34 @@ public class StaticService implements INetworkDispatch { } } - spawnObjects("rori"); - spawnObjects("naboo"); - spawnObjects("tatooine"); - spawnObjects("lok"); - //spawnObjects("kaas"); // Keep commented out unless you possess the latest build of Kaas! - } - - public void spawnObjects(String planetName) { - Planet planet = (Planet) core.terrainService.getPlanetByName(planetName); - core.scriptService.callScript("scripts/static_spawns/", planet.getName(), "addPlanetSpawns", core, planet); - System.out.println("Loaded static objects for " + planet.getName()); + for (Planet planet : core.terrainService.getPlanetList()) { + if (FileUtilities.doesFileExist("scripts/static_spawns/" + planet.getName())) { + Path p = Paths.get("scripts/static_spawns/" + planet.getName()); + + FileVisitor fv = new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.getFileName().toString().endsWith(".py")) { + core.scriptService.callScript("scripts/static_spawns/" + planet.getName() + "/", file.getFileName().toString().replace(".py", ""), "addPlanetSpawns", core, planet); + } + + return FileVisitResult.CONTINUE; + } + }; + + try { + Files.walkFileTree(p, fv); + } catch (IOException e) { + e.printStackTrace(); + } + } + + if (FileUtilities.doesFileExist("scripts/static_spawns/" + planet.getName() + ".py")) { + core.scriptService.callScript("scripts/static_spawns/", planet.getName(), "addPlanetSpawns", core, planet); + } + + System.out.println("Loaded static objects for " + planet.getName()); + } } public SWGObject spawnObject(String template, String planetName, long cellId, float x, float y, float z, float qY, float qW) { @@ -111,7 +137,9 @@ public class StaticService implements INetworkDispatch { ((CreatureObject) object).setStaticNPC(true); } - if (object instanceof BuildingObject) { + boolean checkCells = false; // shouldn't be needed; for debugging + + if (object instanceof BuildingObject && checkCells) { BuildingObject building = (BuildingObject) object; Map attributes = building.getTemplateData().getAttributes(); @@ -140,7 +168,7 @@ public class StaticService implements INetworkDispatch { } } else { if (cell == null) { - System.err.println("StaticService: Cell not found"); + System.err.println("StaticService: Cell not found for: " + template); return object; } diff --git a/src/services/ai/AIActor.java b/src/services/ai/AIActor.java index 30eb11bc..ca61c66a 100644 --- a/src/services/ai/AIActor.java +++ b/src/services/ai/AIActor.java @@ -25,13 +25,16 @@ import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import main.NGECore; import net.engio.mbassy.listener.Handler; +import engine.clients.Client; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; +import resources.datatables.Options; import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; @@ -41,8 +44,10 @@ import services.ai.states.AttackState; import services.ai.states.DeathState; import services.ai.states.IdleState; import services.ai.states.RetreatState; +import services.ai.states.StalkState; import services.combat.CombatEvents.DamageTaken; import services.spawn.MobileTemplate; +import java.util.Random; public class AIActor { @@ -56,13 +61,37 @@ public class AIActor { private Map damageMap = new ConcurrentHashMap(); private volatile boolean hasReachedPosition; private long lastAttackTimestamp; - + private ScheduledFuture regenTask; + private ScheduledFuture aggroCheckTask; + private boolean isStalking = false; + public AIActor(CreatureObject creature, Point3D spawnPosition, ScheduledExecutorService scheduler) { this.creature = creature; this.spawnPosition = spawnPosition; this.scheduler = scheduler; creature.getEventBus().subscribe(this); this.currentState = new IdleState(); + regenTask = scheduler.scheduleAtFixedRate(() -> { + if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14) + creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4)); + }, 0, 1000, TimeUnit.MILLISECONDS); + if(creature.getOption(Options.AGGRESSIVE)) { + aggroCheckTask = scheduler.scheduleAtFixedRate(() -> { + if(creature == null || creature.getObservers().isEmpty() || creature.getCombatFlag() != 0 || isStalking) + return; + creature.getObservers().stream().map(Client::getParent).filter(obj -> obj.inRange(creature.getWorldPosition(), 10)).forEach((obj) -> { + if(new Random().nextFloat() <= 0.33 || creature.getCombatFlag() != 0 || isStalking) { + /*if(mobileTemplate.isStalker()) { + setFollowObject((CreatureObject) obj); + setCurrentState(new StalkState()); + } else */ + addDefender((CreatureObject) obj); + + } + }); + }, 0, 5000, TimeUnit.MILLISECONDS); + + } } public CreatureObject getCreature() { @@ -86,6 +115,12 @@ public class AIActor { if(followObject == null) setFollowObject(defender); setCurrentState(new AttackState()); + NGECore.getInstance().simulationService.get(creature.getPlanet(), creature.getWorldPosition().x, creature.getWorldPosition().z, 30).stream().filter((obj) -> + obj instanceof CreatureObject && + obj.getAttachment("AI") != null && + ((AIActor) obj.getAttachment("AI")).getMobileTemplate().getSocialGroup().equals(getMobileTemplate().getSocialGroup()) && + obj.inRange(creature.getWorldPosition(), ((AIActor) obj.getAttachment("AI")).getMobileTemplate().getAssistRange()) + ).forEach((obj) -> ((AIActor) obj.getAttachment("AI")).addDefender(defender)); } public void removeDefender(CreatureObject defender) { @@ -250,6 +285,7 @@ public class AIActor { public void scheduleDespawn() { scheduler.schedule(() -> { + regenTask.cancel(true); damageMap.clear(); followObject = null; creature.setAttachment("AI", null); @@ -257,5 +293,21 @@ public class AIActor { }, 30000, TimeUnit.MILLISECONDS); } + + public ScheduledFuture getRegenTask() { + return regenTask; + } + + public void setRegenTask(ScheduledFuture regenTask) { + this.regenTask = regenTask; + } + + public boolean isStalking() { + return isStalking; + } + + public void setStalking(boolean isStalking) { + this.isStalking = isStalking; + } } diff --git a/src/services/ai/states/StalkState.java b/src/services/ai/states/StalkState.java new file mode 100644 index 00000000..26b3a90a --- /dev/null +++ b/src/services/ai/states/StalkState.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services.ai.states; + +import services.ai.AIActor; +import services.ai.states.AIState.StateResult; + +public class StalkState extends AIState { + + @Override + public byte onEnter(AIActor actor) throws Exception { + actor.setStalking(true); + return StateResult.UNFINISHED; + } + + @Override + public byte onExit(AIActor actor) throws Exception { + actor.setStalking(false); + return StateResult.UNFINISHED; + } + + @Override + public byte move(AIActor actor) throws Exception { + if(!actor.isStalking() || actor.getFollowObject() == null) + return StateResult.FINISHED; + return StateResult.UNFINISHED; + + } + + @Override + public byte recover(AIActor actor) throws Exception { + if(!actor.isStalking() || actor.getFollowObject() == null) + return StateResult.FINISHED; + return StateResult.UNFINISHED; + } + +} diff --git a/src/services/bazaar/AuctionItem.java b/src/services/bazaar/AuctionItem.java index 92e1e41f..ffa3f6d4 100644 --- a/src/services/bazaar/AuctionItem.java +++ b/src/services/bazaar/AuctionItem.java @@ -21,6 +21,8 @@ ******************************************************************************/ package services.bazaar; +import java.io.Serializable; + import com.sleepycat.je.Environment; import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; @@ -31,8 +33,10 @@ import engine.resources.objects.IPersistent; import engine.resources.objects.SWGObject; @Entity(version=1) -public class AuctionItem implements IPersistent, Comparable { +public class AuctionItem implements Comparable, Serializable { + private static final long serialVersionUID = 1L; + @PrimaryKey private long objectId; private SWGObject item; @@ -62,10 +66,7 @@ public class AuctionItem implements IPersistent, Comparable { public final static int EXPIRED = 4; public final static int OFFERED = 5; public final static int RETRIEVED = 6; - - @NotPersistent - private Transaction txn; - + public AuctionItem() { } @@ -256,16 +257,6 @@ public class AuctionItem implements IPersistent, Comparable { this.auctionOptions = auctionOptions; } - @Override - public void createTransaction(Environment env) { - txn = env.beginTransaction(null, null); - } - - @Override - public Transaction getTransaction() { - return txn; - } - public SWGObject getItem() { return item; } diff --git a/src/services/bazaar/BazaarService.java b/src/services/bazaar/BazaarService.java index 4d074039..b6e542b1 100644 --- a/src/services/bazaar/BazaarService.java +++ b/src/services/bazaar/BazaarService.java @@ -38,6 +38,7 @@ import com.sleepycat.persist.EntityCursor; import main.NGECore; import engine.clients.Client; +import engine.resources.database.ODBCursor; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; @@ -81,16 +82,18 @@ public class BazaarService implements INetworkDispatch { public BazaarService(NGECore core) { this.core = core; loadAuctionItems(); - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - System.out.println("Saving auction items..."); - auctionItems.forEach(item -> core.objectService.persistObject(item, Long.class, AuctionItem.class, core.getAuctionODB())); - })); + } + + public void saveAllItems() { + System.out.println("Saving auction items..."); + auctionItems.forEach(item -> core.objectService.persistObject(item.getObjectId(), item, core.getAuctionODB())); } private void loadAuctionItems() { - EntityCursor cursor = core.getAuctionODB().getCursor(Long.class, AuctionItem.class); - Iterator it = cursor.iterator(); - it.forEachRemaining(this::addAuctionItem); + ODBCursor cursor = core.getAuctionODB().getCursor(); + while(cursor.hasNext()) { + addAuctionItem((AuctionItem) cursor.next()); + } cursor.close(); } @@ -412,7 +415,7 @@ public class BazaarService implements INetworkDispatch { if(seller == null) { seller = core.objectService.getCreatureFromDB(item.getOwnerId()); seller.setBankCredits(seller.getBankCredits() + item.getPrice()); - core.objectService.persistObject(seller, Long.class, CreatureObject.class, core.getAuctionODB()); + core.objectService.persistObject(seller.getObjectID(), seller, core.getSWGObjectODB()); } } @@ -752,8 +755,8 @@ public class BazaarService implements INetworkDispatch { if(commodityLimit.get(auctionItem.getOwnerId()) != null) commodityNumber = commodityLimit.get(auctionItem.getOwnerId()); commodityLimit.put(auctionItem.getOwnerId(), commodityNumber + 1); - if(!core.getAuctionODB().contains(auctionItem.getObjectId(), Long.class, AuctionItem.class)) { - core.objectService.persistObject(auctionItem, Long.class, AuctionItem.class, core.getAuctionODB()); + if(!core.getAuctionODB().contains(auctionItem.getObjectId())) { + core.objectService.persistObject(auctionItem.getObjectId(), auctionItem, core.getAuctionODB()); } } @@ -763,7 +766,7 @@ public class BazaarService implements INetworkDispatch { if(commodityLimit.get(auctionItem.getOwnerId()) != null) commodityNumber = commodityLimit.get(auctionItem.getOwnerId()); commodityLimit.put(auctionItem.getOwnerId(), commodityNumber - 1); - core.objectService.deletePersistentObject(auctionItem, Long.class, AuctionItem.class, core.getAuctionODB(), auctionItem.getObjectId()); + core.objectService.deletePersistentObject(auctionItem.getObjectId(), core.getAuctionODB()); } } diff --git a/src/services/chat/ChatRoom.java b/src/services/chat/ChatRoom.java index 10f853c1..dd243d2d 100644 --- a/src/services/chat/ChatRoom.java +++ b/src/services/chat/ChatRoom.java @@ -21,15 +21,19 @@ ******************************************************************************/ package services.chat; +import java.io.Serializable; import java.util.Vector; + import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.PrimaryKey; @Entity(version=1) -public class ChatRoom { +public class ChatRoom implements Serializable { + + private static final long serialVersionUID = 1L; private String creator; // creator of the room (first name only, lowercase) private String description; // title @PrimaryKey @@ -39,7 +43,7 @@ public class ChatRoom { private Vector moderatorList = new Vector(); private Vector banList = new Vector(); @NotPersistent - private Vector userList = new Vector(); // current users + private transient Vector userList = new Vector(); // current users private boolean moderatorsOnly; private boolean privateRoom; diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index be4cbb43..26e6c611 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -42,6 +42,7 @@ import engine.clientdata.visitors.DatatableVisitor; import engine.clients.Client; import engine.resources.config.Config; import engine.resources.config.DefaultConfig; +import engine.resources.database.ODBCursor; import engine.resources.database.ObjectDatabase; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -317,7 +318,7 @@ public class ChatService implements INetworkDispatch { return; SWGObject obj = client.getParent(); - Mail mail = mailODB.get(new Integer(packet.getMailId()), Integer.class, Mail.class); + Mail mail = (Mail) mailODB.get((long) packet.getMailId()); if(obj == null || mail == null) return; @@ -352,7 +353,7 @@ public class ChatService implements INetworkDispatch { return; SWGObject obj = client.getParent(); - Mail mail = mailODB.get(new Integer(packet.getMailId()), Integer.class, Mail.class); + Mail mail = (Mail) mailODB.get((long) packet.getMailId()); if(obj == null || mail == null) return; @@ -689,15 +690,11 @@ public class ChatService implements INetworkDispatch { public void storePersistentMessage(Mail mail) { - Transaction txn = mailODB.getEnvironment().beginTransaction(null, null); - mailODB.put(mail, Integer.class, Mail.class, txn); - txn.commitSync(); + mailODB.put((long) mail.getMailId(), mail); } public void deletePersistentMessage(Mail mail) { - Transaction txn = mailODB.getEnvironment().beginTransaction(null, null); - mailODB.delete(new Integer(mail.getMailId()), Integer.class, Mail.class, txn); - txn.commitSync(); + mailODB.remove((long) mail.getMailId()); } public void loadMailHeaders(Client client) { @@ -707,14 +704,16 @@ public class ChatService implements INetworkDispatch { if(obj == null || client.getSession() == null) return; - EntityCursor cursor = mailODB.getCursor(Integer.class, Mail.class); + ODBCursor cursor = mailODB.getCursor(); - for(Mail mail : cursor) { - + while(cursor.hasNext()) { + Mail mail = (Mail) cursor.next(); if(mail.getRecieverId() == obj.getObjectID()) { sendPersistentMessageHeader(client, mail); } + } + cursor.close(); } @@ -747,7 +746,7 @@ public class ChatService implements INetworkDispatch { int id = rand.nextInt(); - if(mailODB.contains(new Integer(id), Integer.class, Mail.class)) + if(mailODB.contains((long) id)) return generateMailId(); else return id; @@ -755,7 +754,7 @@ public class ChatService implements INetworkDispatch { public Mail getMailById(int mailId) { - Mail mail = mailODB.get(new Integer(mailId), Integer.class, Mail.class); + Mail mail = (Mail) mailODB.get((long) mailId); return mail; } @@ -776,7 +775,7 @@ public class ChatService implements INetworkDispatch { Random rand = new Random(); int id = rand.nextInt(); - if (chatRoomsODB.contains(new Integer(id), Integer.class, ChatRoom.class)) + if (chatRoomsODB.contains((long) id)) return generateChatRoomId(); else return id; @@ -819,11 +818,13 @@ public class ChatService implements INetworkDispatch { createChatRoom("Politician chat for this galaxy", "Politician", "system", true); //createChatRoom("Pilot chat for this galaxy", "Pilot", "system", true); - EntityCursor cursor = chatRoomsODB.getCursor(Integer.class, ChatRoom.class); - cursor.forEach(room -> { + ODBCursor cursor = chatRoomsODB.getCursor(); + + while(cursor.hasNext()) { + ChatRoom room = (ChatRoom) cursor.next(); if (!chatRooms.containsValue(room)) chatRooms.put(room.getRoomId(), room); - }); + } cursor.close(); List planets = core.terrainService.getPlanetList(); @@ -891,9 +892,7 @@ public class ChatService implements INetworkDispatch { chatRooms.put(room.getRoomId(), room); if(store){ - Transaction txn = chatRoomsODB.getEnvironment().beginTransaction(null, null); - chatRoomsODB.put(room, Integer.class, ChatRoom.class, txn); - txn.commitSync(); + chatRoomsODB.put((long) room.getRoomId(), room); } //Console.println("Created room " + address + " with ID " + room.getRoomId()); diff --git a/src/services/chat/Mail.java b/src/services/chat/Mail.java index 5709a059..48166af5 100644 --- a/src/services/chat/Mail.java +++ b/src/services/chat/Mail.java @@ -21,13 +21,18 @@ ******************************************************************************/ package services.chat; +import java.io.Serializable; +import java.util.ArrayList; import java.util.List; + import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.PrimaryKey; @Entity(version=1) -public class Mail { +public class Mail implements Serializable { + private static final long serialVersionUID = 1L; + @PrimaryKey private int mailId; private String senderName; @@ -36,7 +41,7 @@ public class Mail { private String message; private byte status; private int timeStamp; - private List attachments; + private List attachments = new ArrayList(); public static final byte NEW = 0x4E; public static final byte READ = 0x52; diff --git a/src/services/chat/WaypointAttachment.java b/src/services/chat/WaypointAttachment.java index 314cb08f..1a3c2d84 100644 --- a/src/services/chat/WaypointAttachment.java +++ b/src/services/chat/WaypointAttachment.java @@ -21,11 +21,15 @@ ******************************************************************************/ package services.chat; +import java.io.Serializable; + import com.sleepycat.persist.model.Persistent; @Persistent -public class WaypointAttachment { +public class WaypointAttachment implements Serializable { + private static final long serialVersionUID = 1L; + public WaypointAttachment() { } public long cellID; diff --git a/src/services/collections/ServerFirst.java b/src/services/collections/ServerFirst.java index 2b855fb4..0811d9c9 100644 --- a/src/services/collections/ServerFirst.java +++ b/src/services/collections/ServerFirst.java @@ -21,6 +21,8 @@ ******************************************************************************/ package services.collections; +import java.io.Serializable; + import org.apache.mina.core.buffer.IoBuffer; import resources.objects.Delta; @@ -28,8 +30,10 @@ import resources.objects.Delta; import com.sleepycat.persist.model.Persistent; @Persistent -public class ServerFirst extends Delta { +public class ServerFirst extends Delta implements Serializable { + private static final long serialVersionUID = 1L; + private String name; private String collection; private long time; diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 301bf037..4276db3f 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -43,11 +43,15 @@ import protocol.swg.objectControllerObjects.StartTask; import resources.buffs.Buff; import resources.buffs.DamageOverTime; import resources.common.FileUtilities; +import resources.common.OutOfBand; +import resources.common.ProsePackage; import resources.datatables.Options; import resources.datatables.Elemental; import resources.datatables.Posture; import resources.datatables.WeaponType; +import resources.objectives.BountyMissionObjective; import resources.objects.creature.CreatureObject; +import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.waypoint.WaypointObject; @@ -292,6 +296,8 @@ public class CombatService implements INetworkDispatch { event.attacker = attacker; event.damage = damage; target.getEventBus().publish(event); + + attacker.setTefTime(300000); } private void doAreaCombat(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { @@ -798,8 +804,10 @@ public class CombatService implements INetworkDispatch { }, target.getIncapTimer(), TimeUnit.SECONDS); target.setIncapTask(incapTask); core.buffService.addBuffToCreature(target, "incapWeaken", target); - if(target.getSlottedObject("ghost") != null) - attacker.sendSystemMessage("You incapacitate " + target.getCustomName() + ".", (byte) 0); + if(target.getSlottedObject("ghost") != null) { + target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_incap", attacker.getCustomName())), (byte) 0); + attacker.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_target_incap", target.getCustomName())), (byte) 0); + } return; } else if(target.getHealth() - damage <= 0 && target.getAttachment("AI") != null) { synchronized(target.getMutex()) { @@ -981,17 +989,50 @@ public class CombatService implements INetworkDispatch { target.stopIncapTask(); target.setIncapTask(null); target.setPosture((byte) 14); - attacker.sendSystemMessage("You have killed " + target.getCustomName() + ".", (byte) 0); - target.sendSystemMessage("@base_player:victim_dead", (byte) 0); + + if (target.getSlottedObject("ghost") != null && attacker.getSlottedObject("ghost") != null) { + boolean bountyWindow = true; + if (target.getPlayerObject().getBountyMissionId() != 0) { + MissionObject mission = (MissionObject) core.objectService.getObject(target.getPlayerObject().getBountyMissionId()); + if (mission != null && mission.getBountyObjId() == attacker.getObjectId()) { + bountyWindow = false; + target.sendSystemMessage(new OutOfBand(new ProsePackage("bounty_hunter", "bounty_failed_hunter", attacker.getCustomName())), (byte) 0); + + ProsePackage pp = new ProsePackage("bounty_hunter", "bounty_failed_target", attacker.getCustomName()); + pp.setToCustomString("their"); + attacker.sendSystemMessage(new OutOfBand(pp), (byte) 0); + + core.missionService.handleMissionAbort(target, mission); + } + } else if (attacker.getPlayerObject().getBountyMissionId() != 0) { + MissionObject mission = (MissionObject) core.objectService.getObject(attacker.getPlayerObject().getBountyMissionId()); + if (mission != null && mission.getBountyObjId() == target.getObjectId()) { + bountyWindow = false; + ProsePackage targetProse = new ProsePackage("bounty_hunter", "bounty_success_target", attacker.getCustomName()); + targetProse.setDiInteger(mission.getCreditReward()); + target.sendSystemMessage(new OutOfBand(targetProse), (byte) 0); + + ProsePackage attackerProse = new ProsePackage("bounty_hunter", "bounty_success_hunter", attacker.getCustomName()); + attackerProse.setToCustomString("their"); // should be his or her: http://youtu.be/BqeDQQSETJI?t=2m19s + attackerProse.setDiInteger(mission.getCreditReward()); + attacker.sendSystemMessage(new OutOfBand(attackerProse), (byte) 0); + + core.missionService.handleMissionAbort(target, mission); + } + } + + if(target.getDuelList().contains(attacker)) + bountyWindow = false; + handleEndDuel(target, attacker, false); + + if (bountyWindow) core.playerService.sendSetBountyWindow(target, attacker); + } else { attacker.sendSystemMessage("You have killed " + target.getCustomName() + ".", (byte) 0); } + attacker.removeDefender(target); target.removeDefender(attacker); target.setSpeedMultiplierBase(0); target.setTurnRadius(0); - - if(!target.getDuelList().contains(attacker) && attacker.getSlottedObject("ghost") != null) - core.playerService.sendSetBountyWindow(target, attacker); - else - handleEndDuel(target, attacker, false); + target.sendSystemMessage(new OutOfBand(new ProsePackage("base_player", "prose_victim_dead", attacker.getCustomName())), (byte) 0); core.playerService.sendCloningWindow(target, attacker.getSlottedObject("ghost") != null); } diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index cf14b35a..c778a25f 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -91,9 +91,9 @@ public class CommandService implements INetworkDispatch { return false; } - WeaponObject weapon = (WeaponObject) core.objectService.getObject(actor.getWeaponId()); + TangibleObject weapon = (TangibleObject) core.objectService.getObject(actor.getWeaponId()); - if (weapon != null && weapon.getWeaponType() == command.getInvalidWeapon()) { + if (weapon != null && weapon instanceof WeaponObject && ((WeaponObject) weapon).getWeaponType() == command.getInvalidWeapon()) { return false; } diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java index 4148f969..d9c07e26 100644 --- a/src/services/gcw/FactionService.java +++ b/src/services/gcw/FactionService.java @@ -24,6 +24,7 @@ package services.gcw; import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; +import java.util.concurrent.atomic.AtomicReference; import main.NGECore; @@ -33,15 +34,15 @@ import org.python.core.Py; import org.python.core.PyObject; import protocol.swg.FactionResponseMessage; - import resources.common.FileUtilities; import resources.common.Opcodes; import resources.datatables.FactionStatus; +import resources.datatables.Options; import resources.datatables.PvpStatus; import resources.objects.creature.CreatureObject; +import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; - import engine.clientdata.StfTable; import engine.clients.Client; import engine.resources.common.CRC; @@ -131,27 +132,27 @@ public class FactionService implements INetworkDispatch { } /* - * Returns true if creature2 is an ally of creature1 + * Returns true if target is an ally of object * * 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) { + public boolean isFactionAlly(TangibleObject object, TangibleObject target) { + if (object == null || target == null) { return false; } - String faction1 = creature1.getFaction(); - String faction2 = creature2.getFaction(); + String objectFaction = object.getFaction(); + String targetFaction = target.getFaction(); - if (!isFaction(faction1) || !isFaction(faction2)) { + if (!isFaction(objectFaction) || !isFaction(targetFaction)) { return false; } - if (FileUtilities.doesFileExist("scripts/faction/" + faction1 + ".py")) { - PyObject method = core.scriptService.getMethod("scripts/faction/", faction1, "isAlly"); + if (FileUtilities.doesFileExist("scripts/faction/" + objectFaction + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/faction/", objectFaction, "isAlly"); if (method != null && method.isCallable()) { - return ((method.__call__(Py.java2py(faction2)).asInt() == 1) ? true : false); + return ((method.__call__(Py.java2py(targetFaction)).asInt() == 1) ? true : false); } } @@ -159,27 +160,27 @@ public class FactionService implements INetworkDispatch { } /* - * Returns true if creature2 is an enemy of creature1 + * Returns true if target is an enemy of object * * 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) { + public boolean isFactionEnemy(TangibleObject object, TangibleObject target) { + if (object == null || target == null) { return false; } - String faction1 = creature1.getFaction(); - String faction2 = creature2.getFaction(); + String objectFaction = object.getFaction(); + String targetFaction = target.getFaction(); - if (!isFaction(faction1) || !isFaction(faction2)) { + if (!isFaction(objectFaction) || !isFaction(targetFaction)) { return false; } - if (FileUtilities.doesFileExist("scripts/faction/" + faction1 + ".py")) { - PyObject method = core.scriptService.getMethod("scripts/faction/", faction1, "isEnemy"); + if (FileUtilities.doesFileExist("scripts/faction/" + objectFaction + ".py")) { + PyObject method = core.scriptService.getMethod("scripts/faction/", objectFaction, "isEnemy"); if (method != null && method.isCallable()) { - return ((method.__call__(Py.java2py(faction2)).asInt() == 1) ? true : false); + return ((method.__call__(Py.java2py(targetFaction)).asInt() == 1) ? true : false); } } @@ -196,66 +197,139 @@ public class FactionService implements INetworkDispatch { * * This should be used instead of getPvPBitmask where possible, but * should not be used in setPvPBitmask. + * + * *** Updated this so it calculates if even a tangible object + * should see something as attackable (so it works for npcs and turrets). + * + * Also takes into account bounty targets and if it's a pet. */ - /*public int calculatePvpStatus(CreatureObject player, TangibleObject target) { - PlayerObject ghost = (PlayerObject) player.getSlottedObject("ghost"); + public int calculatePvpStatus(TangibleObject object, TangibleObject target) { + PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); - int pvpBitmask = target.getPvPBitmask(); + int pvpBitmask = 0; - // Seefo: Casting target to type CreatureObject as temporary fix. I am unsure whether or not we want to put a factionStatus member inside of TangibleObject. - if (((CreatureObject) target).getFactionStatus() == FactionStatus.Combatant) { - pvpBitmask |= PvpStatus.Enemy; - } - - if (((CreatureObject) target).getFactionStatus() == FactionStatus.SpecialForces) { - pvpBitmask |= PvpStatus.Overt; - - if (target.getSlottedObject("ghost") != null) { - pvpBitmask |= PvpStatus.Enemy; - } + if (object == target) { + pvpBitmask |= PvpStatus.Self; } if (target.getSlottedObject("ghost") != null) { pvpBitmask |= PvpStatus.Player; - - if ((!player.getFaction().equals(target.getFaction()) && - player.getFactionStatus() == FactionStatus.SpecialForces && - ((CreatureObject) target).getFactionStatus() == FactionStatus.SpecialForces) || - core.combatService.areInDuel(player, (CreatureObject) target)) { - pvpBitmask |= (PvpStatus.Attackable | PvpStatus.Aggressive); - } - - if (core.combatService.areInDuel(player, (CreatureObject) target)) { - //pvpBitmask |= PvpStatus.Dueling; - } - + } + + if (target instanceof CreatureObject && ((CreatureObject) target).getOwnerId() > 0) { + target = (TangibleObject) core.objectService.getObject(((CreatureObject) target).getOwnerId()); + } + + if ((target.getPvPBitmask() & PvpStatus.GoingCovert) == PvpStatus.GoingCovert) { + pvpBitmask |= PvpStatus.GoingCovert; + } + + if ((target.getPvPBitmask() & PvpStatus.GoingOvert) == PvpStatus.GoingOvert) { + pvpBitmask |= PvpStatus.GoingOvert; + } + + if (target.getFactionStatus() == FactionStatus.SpecialForces) { + pvpBitmask |= PvpStatus.Overt; + } + + // Everything below assumes target is potentially attackable. + if (!target.getOption(Options.ATTACKABLE)) { return pvpBitmask; } - if (player.getFaction().equals(target.getFaction())) { + if (ghost != null && target.getSlottedObject("ghost") != null && + core.combatService.areInDuel((CreatureObject) object, (CreatureObject) target)) { + pvpBitmask |= (PvpStatus.Attackable | PvpStatus.Aggressive); + } + + if (object.getDefendersList().contains(target)) { + pvpBitmask |= (PvpStatus.Attackable | PvpStatus.Aggressive); + } + + AtomicReference ref = new AtomicReference(0); + + long targetId = target.getObjectID(); + + if (object.getSlottedObject("datapad") != null) { + object.getSlottedObject("datapad").viewChildren(object, false, false, (mission) -> { + if (((MissionObject) mission).getBountyObjId() == targetId) { + ref.set(PvpStatus.Attackable | PvpStatus.Aggressive); + } + }); + } + + if (ghost != null && ghost.getProfession().contains("smuggler") && + target.getSlottedObject("datapad") != null) { + target.getSlottedObject("datapad").viewChildren(target, false, false, (mission) -> { + if (((MissionObject) mission).getBountyObjId() == object.getObjectID()) { + ref.set(PvpStatus.Attackable); + } + }); + } + + pvpBitmask |= ref.get(); + + if (target instanceof CreatureObject && ((CreatureObject) target).getTefTime() > 0) { + pvpBitmask |= PvpStatus.TEF; + } + + if (target.getFaction().length() > 0 && target.getFaction().equals(object.getFaction())) { return pvpBitmask; } - if (target.getOption(Options.ATTACKABLE)) { + if (target.getSlottedObject("ghost") == null && target.getFactionStatus() == FactionStatus.OnLeave) { pvpBitmask |= PvpStatus.Attackable; } if (target.getOption(Options.AGGRESSIVE)) { pvpBitmask |= PvpStatus.Aggressive; - } else { - Integer factionStanding = ghost.getFactionStandingMap().get(target.getFaction()); - - if (factionStanding != null) { - if (((TangibleObject) target).getOption(Options.ATTACKABLE) && factionStanding < 0) { - pvpBitmask |= PvpStatus.Aggressive; + } + + if (object.getFactionStatus() == FactionStatus.OnLeave) { + return pvpBitmask; + } + + if (target.getFactionStatus() >= FactionStatus.Combatant) { + if (ghost != null) { + if (target.getSlottedObject("ghost") == null) { + pvpBitmask |= PvpStatus.Enemy; + + Integer factionStanding = ghost.getFactionStandingMap().get(target.getFaction()); + + if (factionStanding != null) { + if (factionStanding < 0) { + pvpBitmask |= PvpStatus.Aggressive; + } else { + pvpBitmask |= PvpStatus.Attackable; + } + } else { + pvpBitmask |= PvpStatus.Attackable; + } + + return pvpBitmask; + } + } else { + if (isFactionEnemy(object, target)) { + pvpBitmask |= PvpStatus.Attackable | PvpStatus.Enemy; + } + + if (isFactionEnemy(target, object)) { + pvpBitmask |= PvpStatus.Aggressive | PvpStatus.Enemy; } } } + if (target.getFactionStatus() == FactionStatus.SpecialForces) { + if (object.getFactionStatus() == FactionStatus.SpecialForces) { + pvpBitmask |= (PvpStatus.Attackable | PvpStatus.Aggressive | PvpStatus.Enemy); + } + } + return pvpBitmask; - }*/ + } // temp fix until calculatePvpStatus is fixed + /* public int calculatePvpStatus(CreatureObject player, TangibleObject target) { if(target.getSlottedObject("ghost") != null) { @@ -275,6 +349,7 @@ public class FactionService implements INetworkDispatch { } } + */ public Map getFactionMap() { return factionMap; diff --git a/src/services/gcw/PvPZone.java b/src/services/gcw/PvPZone.java new file mode 100644 index 00000000..785efb8f --- /dev/null +++ b/src/services/gcw/PvPZone.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services.gcw; + +import java.util.Vector; + +import net.engio.mbassy.listener.Handler; +import resources.common.collidables.AbstractCollidable; +import resources.common.collidables.AbstractCollidable.EnterEvent; +import resources.common.collidables.AbstractCollidable.ExitEvent; +import engine.resources.scene.Planet; + +public class PvPZone { + + private Planet planet; + private AbstractCollidable area; + + public PvPZone(Planet planet, AbstractCollidable area) { + this.planet = planet; + this.area = area; + area.getEventBus().subscribe(this); + } + + public Planet getPlanet() { + return planet; + } + + public void setPlanet(Planet planet) { + this.planet = planet; + } + + public AbstractCollidable getArea() { + return area; + } + + public void setArea(AbstractCollidable area) { + this.area = area; + } + + @Handler + public void onEnter(EnterEvent event) { + + } + + @Handler + public void onExit(ExitEvent event) { + + } + + +} diff --git a/src/services/guild/GuildService.java b/src/services/guild/GuildService.java index 022895de..3197e9e1 100644 --- a/src/services/guild/GuildService.java +++ b/src/services/guild/GuildService.java @@ -49,7 +49,6 @@ public class GuildService implements INetworkDispatch { object = (GuildObject) this.core.objectService.createObject("object/guild/shared_guild_object.iff", core.terrainService.getPlanetList().get(0)); } - object.createTransaction(core.getGuildODB().getEnvironment()); } public Guild createGuild(String abbreviation, String name, SWGObject leader) { diff --git a/src/services/housing/HousingService.java b/src/services/housing/HousingService.java index 34bdb205..2b092b6f 100644 --- a/src/services/housing/HousingService.java +++ b/src/services/housing/HousingService.java @@ -154,15 +154,17 @@ public class HousingService implements INetworkDispatch { // Check for city founders joining a new city PlayerCity cityActorIsIn = core.playerCityService.getCityObjectIsIn(actor); - actor.setAttachment("Has24HZoningFor",cityActorIsIn.getCityID()); // for testing - - int cityActorHasZoning = (int)actor.getAttachment("Has24HZoningFor"); - if (cityActorIsIn!=null && cityActorHasZoning==cityActorIsIn.getCityID()){ - if (! cityActorIsIn.getCitizens().contains(actor.getObjectID())){ - building.setAttachment("structureCity", cityActorIsIn.getCityID()); - // actor.setAttachment("residentCity", cityActorIsIn.getCityID()); He must do it manually - cityActorIsIn.addCitizen(actor.getObjectID()); - cityActorIsIn.addNewStructure(building.getObjectID()); + if (cityActorIsIn!=null){ + actor.setAttachment("Has24HZoningFor",cityActorIsIn.getCityID()); // for testing + + int cityActorHasZoning = (int)actor.getAttachment("Has24HZoningFor"); + if (cityActorIsIn!=null && cityActorHasZoning==cityActorIsIn.getCityID()){ + if (! cityActorIsIn.getCitizens().contains(actor.getObjectID())){ + building.setAttachment("structureCity", cityActorIsIn.getCityID()); + // actor.setAttachment("residentCity", cityActorIsIn.getCityID()); He must do it manually + cityActorIsIn.addCitizen(actor.getObjectID()); + cityActorIsIn.addNewStructure(building.getObjectID()); + } } } diff --git a/src/services/mission/MissionObjective.java b/src/services/mission/MissionObjective.java index 8f43fe9f..df07879a 100644 --- a/src/services/mission/MissionObjective.java +++ b/src/services/mission/MissionObjective.java @@ -21,6 +21,7 @@ ******************************************************************************/ package services.mission; +import java.io.Serializable; import main.NGECore; import com.sleepycat.persist.model.Persistent; @@ -29,8 +30,10 @@ import resources.objects.creature.CreatureObject; import resources.objects.mission.MissionObject; @Persistent(version=0) -public abstract class MissionObjective { +public abstract class MissionObjective implements Serializable { + private static final long serialVersionUID = 1L; + protected long startTime; protected boolean activated; protected MissionObject parent; diff --git a/src/services/mission/MissionService.java b/src/services/mission/MissionService.java index f701ad2e..bf1f2ea4 100644 --- a/src/services/mission/MissionService.java +++ b/src/services/mission/MissionService.java @@ -24,6 +24,8 @@ package services.mission; import java.io.File; import java.io.IOException; import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.Random; import java.util.Vector; @@ -37,7 +39,6 @@ import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import com.sleepycat.je.Transaction; -import com.sleepycat.persist.EntityCursor; import protocol.swg.ObjControllerMessage; import protocol.swg.objectControllerObjects.MissionAbort; @@ -59,6 +60,7 @@ import engine.clients.Client; import engine.resources.common.CRC; import engine.resources.common.NameGen; import engine.resources.container.Traverser; +import engine.resources.database.ODBCursor; import engine.resources.database.ObjectDatabase; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; @@ -151,11 +153,8 @@ public class MissionService implements INetworkDispatch { if (terminalType == TerminalType.GENERIC) { handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.GENERIC); } else if (terminalType == TerminalType.BOUNTY) { - if (!object.hasSkill("class_bountyhunter_phase1_novice")) { - object.sendSystemMessage("@mission/mission_generic:not_bounty_hunter_terminal", (byte) 0); - } else { - handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.BOUNTY); - } + if (!object.hasSkill("class_bountyhunter_phase1_novice")) { object.sendSystemMessage("@mission/mission_generic:not_bounty_hunter_terminal", (byte) 0); } + else { handleMissionListRequest(core.objectService.getObject(request.getObjectId()), request.getTickCount(), TerminalType.BOUNTY); } } else if (terminalType == TerminalType.ENTERTAINER) { } else if (terminalType == TerminalType.ARTISAN) { @@ -205,9 +204,13 @@ public class MissionService implements INetworkDispatch { } public void handleMissionAbort(CreatureObject creature, MissionObject mission) { + handleMissionAbort(creature, mission, false); + } + + public void handleMissionAbort(CreatureObject creature, MissionObject mission, boolean silent) { MissionObjective objective = mission.getObjective(); - if (objective != null) + if (objective != null && !silent) objective.abort(core, creature); core.objectService.destroyObject(mission.getObjectId()); @@ -217,7 +220,7 @@ public class MissionService implements INetworkDispatch { File missionFolder = new File("./clientdata/string/en/mission"); File[] missionFiles = missionFolder.listFiles(); - int missionStrings = 0; + //int missionStrings = 0; for (int i = 0; i < missionFiles.length; i++) { if (missionFiles[i].getName().contains("_easy") || missionFiles[i].getName().contains("_medium") || missionFiles[i].getName().contains("_hard")) { @@ -239,7 +242,7 @@ public class MissionService implements INetworkDispatch { continue; } } catch (Exception e) { e.printStackTrace(); } - missionStrings++; + //missionStrings++; } } //System.out.println("Loaded " + missionStrings + " mission entry counts."); @@ -279,14 +282,13 @@ public class MissionService implements INetworkDispatch { MissionObject mission = (MissionObject) obj; - if (typeOneCount.get() < 4) { + if (typeOneCount.get() < 5) { if (type == TerminalType.GENERIC) randomDeliveryMission(player, mission); else if (type == TerminalType.BOUNTY) - //randomBountyMission(player, mission); - return; + randomBountyMission(player, mission); else if (type == TerminalType.ARTISAN) return; @@ -297,7 +299,7 @@ public class MissionService implements INetworkDispatch { mission.setRepeatCount(requestCounter); typeOneCount.incrementAndGet(); - } else if (typeTwoCount.get() < 4) { + } else if (typeTwoCount.get() < 5) { if (type == TerminalType.GENERIC) return; @@ -440,7 +442,7 @@ public class MissionService implements INetworkDispatch { } } - if (bountyTarget == null) + if (bountyTarget == null || bountyTarget.getAssignedHunters().contains(player.getObjectId())) return; mission.setMissionType("bounty"); @@ -448,17 +450,20 @@ public class MissionService implements INetworkDispatch { String missionStf = "mission/mission_bounty_jedi"; if (!bountyTarget.getProfession().equals("")) { // TODO: Smuggler mission checks. - if (bountyTarget.getFaction().equals("neutral")) { + if (bountyTarget.getFaction().equals("neutral")) { // There were no neutral bounty missions. Remove this when done testing. mission.setMissionTargetName("@mission/mission_bounty_jedi:neutral_jedi"); mission.setMissionId(3); + mission.setCreator("Corporate Sector Authority"); } else if (bountyTarget.getFaction().equals("rebel")) { - mission.setMissionTargetName("@mission/mission_bounty_jedi:rebel_jedi"); + mission.setMissionTargetName("Rebel Bounty"); mission.setMissionId(2); + mission.setCreator("The Galactic Empire"); } else if (bountyTarget.getFaction().equals("imperial")) { - mission.setMissionTargetName("@mission/mission_bounty_jedi:imperial_jedi"); + mission.setMissionTargetName("Imperial Bounty"); mission.setMissionId(1); + mission.setCreator("The Alliance"); } mission.setMissionTitle(missionStf); mission.setMissionDescription(missionStf); @@ -477,7 +482,7 @@ public class MissionService implements INetworkDispatch { mission.setMissionDescription(missionStf, "s"); } - mission.setMissionLevel(90); + mission.setMissionLevel(new Random().nextInt(100 - 95) + 95); mission.setCreditReward(bountyTarget.getCreditReward()); @@ -513,7 +518,7 @@ public class MissionService implements INetworkDispatch { return null; } - public BountyListItem createNewBounty(CreatureObject bountyTarget, int reward) { + public BountyListItem createNewBounty(CreatureObject bountyTarget, long placer, int reward) { PlayerObject player = (PlayerObject) bountyTarget.getSlottedObject("ghost"); if (player == null) return null; @@ -523,9 +528,10 @@ public class MissionService implements INetworkDispatch { BountyListItem bounty = new BountyListItem(bountyTarget.getObjectId(), reward, core.playerService.getFormalProfessionName(player.getProfession()), bountyTarget.getFaction(), bountyTarget.getCustomName()); - Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null); - bountiesODB.put(bounty, Long.class, BountyListItem.class, txn); - txn.commitSync(); + if (placer != 0) + bounty.getBountyPlacers().add(placer); + + bountiesODB.put(bounty.getObjectId(), bounty); bountyList.add(bounty); @@ -533,53 +539,51 @@ public class MissionService implements INetworkDispatch { return bounty; } - public boolean addToExistingBounty(CreatureObject bountyTarget, int amountToAdd) { + public boolean addToExistingBounty(long bountyTarget, long placer, int amountToAdd) { - BountyListItem bounty = getBountyListItem(bountyTarget.getObjectId()); + BountyListItem bounty = getBountyListItem(bountyTarget); if (bounty == null) return false; bounty.addBounty(amountToAdd); + + if (placer != 0 && !bounty.getBountyPlacers().contains(placer)) + bounty.getBountyPlacers().add(placer); - Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null); - bountiesODB.put(bounty, Long.class, BountyListItem.class, txn); - txn.commitSync(); + bountiesODB.put(bounty.getObjectId(), bounty); //System.out.println("Added bounty of " + amountToAdd + " to " + bounty.getName()); return true; } - public boolean removeBounty(CreatureObject bountyTarget, boolean listRemove) { + public boolean removeBounty(long bountyTarget, boolean listRemove) { Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null); if (listRemove) - bountyList.remove(bountiesODB.get(bountyTarget.getObjectId(), Long.class, BountyListItem.class)); + bountyList.remove(bountiesODB.get(bountyTarget)); - bountiesODB.delete(bountyTarget.getObjectId(), Long.class, BountyListItem.class, txn); + bountiesODB.remove(bountyTarget); txn.commitSync(); return true; } - public boolean removeBounty(CreatureObject bountyTarget) { + public boolean removeBounty(long bountyTarget) { return removeBounty(bountyTarget, true); } private void cleanupBounties() { - AtomicInteger bountyCount = new AtomicInteger(); - Transaction txn = bountiesODB.getEnvironment().beginTransaction(null, null); - EntityCursor bountyCursor = bountiesODB.getEntityStore().getPrimaryIndex(Long.class, BountyListItem.class).entities(txn, null); - bountyCursor.forEach(bounty -> { + List bounties = new ArrayList(); + ODBCursor cursor = bountiesODB.getCursor(); + while(cursor.hasNext()) { + BountyListItem bounty = (BountyListItem) cursor.next(); if (!core.characterService.playerExists(bounty.getObjectId())) { - bountyCursor.delete(); - bountyCount.getAndIncrement(); + bounties.add(bounty); } - }); - bountyCursor.close(); - txn.commitSync(); - - if (bountyCount.get() != 0) - System.out.println("Removed " + bountyCount.get() + " bounties."); + } + bounties.stream().mapToLong(b -> b.getObjectId()).forEach(bountiesODB::remove); + if (bounties.size() != 0) + System.out.println("Removed " + bounties.size() + " bounties."); } @Override diff --git a/src/services/object/DuplicateId.java b/src/services/object/DuplicateId.java index db618527..55b03ab6 100644 --- a/src/services/object/DuplicateId.java +++ b/src/services/object/DuplicateId.java @@ -21,12 +21,16 @@ ******************************************************************************/ package services.object; +import java.io.Serializable; + import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.PrimaryKey; @Entity -public class DuplicateId { +public class DuplicateId implements Serializable { + private static final long serialVersionUID = 1L; + @PrimaryKey private String key; private long objectId; diff --git a/src/services/object/ObjectId.java b/src/services/object/ObjectId.java index 36df1736..1f8362fb 100644 --- a/src/services/object/ObjectId.java +++ b/src/services/object/ObjectId.java @@ -21,12 +21,16 @@ ******************************************************************************/ package services.object; +import java.io.Serializable; + import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.PrimaryKey; @Entity -public class ObjectId { +public class ObjectId implements Serializable { + private static final long serialVersionUID = 1L; + @PrimaryKey public long objectId; diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 0923192d..0fbd8334 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -88,6 +88,7 @@ import engine.resources.container.Traverser; import engine.resources.container.WorldCellPermissions; import engine.resources.container.WorldPermissions; import engine.resources.database.DatabaseConnection; +import engine.resources.database.ODBCursor; import engine.resources.database.ObjectDatabase; import engine.resources.objects.IPersistent; import engine.resources.objects.SWGObject; @@ -97,6 +98,7 @@ import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import main.NGECore; +import resources.objectives.BountyMissionObjective; import resources.objects.Delta; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; @@ -145,7 +147,6 @@ public class ObjectService implements INetworkDispatch { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { - core.getObjectIdODB().getEnvironment().flushLog(true); synchronized(objectList) { for(SWGObject obj : objectList.values()) { @@ -155,6 +156,8 @@ public class ObjectService implements INetworkDispatch { } } + core.bazaarService.saveAllItems(); + core.closeODBs(); } }); @@ -173,25 +176,20 @@ public class ObjectService implements INetworkDispatch { } public void loadBuildings() { - EntityCursor cursor = core.getBuildingODB().getCursor(Long.class, BuildingObject.class); - - Iterator it = cursor.iterator(); - - while(it.hasNext()) { - final BuildingObject building = it.next(); + ODBCursor cursor = core.getSWGObjectODB().getCursor(); + + while(cursor.hasNext()) { + final SWGObject building = (SWGObject) cursor.next(); + if(!(building instanceof BuildingObject) || building == null) + continue; objectList.put(building.getObjectID(), building); Planet planet = core.terrainService.getPlanetByID(building.getPlanetId()); building.setPlanet(planet); - building.viewChildren(building, true, true, new Traverser() { - - @Override - public void process(SWGObject object) { - objectList.put(object.getObjectID(), object); - if(object.getParentId() != 0 && object.getContainer() == null) - object.setParent(building); - object.getContainerInfo(object.getTemplate()); - } - + building.viewChildren(building, true, true, (object) -> { + objectList.put(object.getObjectID(), object); + if(object.getParentId() != 0 && object.getContainer() == null) + object.setParent(building); + object.getContainerInfo(object.getTemplate()); }); } @@ -338,10 +336,8 @@ public class ObjectService implements INetworkDispatch { object.setAttachment("customServerTemplate", customServerTemplate); object.setisInSnapshot(isSnapshot); - - if(!core.getObjectIdODB().contains(objectID, Long.class, ObjectId.class)) { - core.getObjectIdODB().put(new ObjectId(objectID), Long.class, ObjectId.class); - } + if(!core.getObjectIdODB().contains(objectID)) + core.getObjectIdODB().put(objectID, new ObjectId(objectID)); // Set Options - easier to set them across the board here // because we'll be spawning them despite most of them being unscripted. @@ -528,6 +524,9 @@ public class ObjectService implements INetworkDispatch { } public SWGObject getObjectByCustomName(String customName) { + if (customName == null) { + return null; + } synchronized(objectList) { @@ -540,24 +539,32 @@ public class ObjectService implements INetworkDispatch { } - EntityCursor cursor = core.getCreatureODB().getCursor(Long.class, CreatureObject.class); + ODBCursor cursor = core.getSWGObjectODB().getCursor(); - Iterator it = cursor.iterator(); - - while(it.hasNext()) { - if(it.next().getCustomName().equals(customName)) - return it.next(); + while (cursor.hasNext()) { + SWGObject object = (SWGObject) cursor.next(); + + if (object == null) { + continue; + } + + if (object.getCustomName() != null && customName.length() > 0 && object.getCustomName().equals(customName)) { + return object; + } } - + return null; - } public SWGObject getObjectByFirstName(String customName) { + if (customName == null) { + return null; + } synchronized(objectList) { - for(SWGObject obj : objectList.values()) { + if(obj == null) + continue; if(obj.getCustomName() == null) continue; if(obj.getCustomName().startsWith(customName)) @@ -566,35 +573,33 @@ public class ObjectService implements INetworkDispatch { } - EntityCursor cursor = core.getCreatureODB().getCursor(Long.class, CreatureObject.class); + ODBCursor cursor = core.getSWGObjectODB().getCursor(); - Iterator it = cursor.iterator(); - - while(it.hasNext()) { - if(it.next().getCustomName().startsWith(customName)) - return it.next(); + while (cursor.hasNext()) { + SWGObject object = (SWGObject) cursor.next(); + + if (object == null) { + continue; + } + + if (object.getCustomName() != null && customName.length() > 0 && object.getCustomName().startsWith(customName)) { + return object; + } } - + cursor.close(); return null; - } public CreatureObject getCreatureFromDB(long objectId) { - CreatureObject object = core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); - + SWGObject object = (SWGObject) core.getSWGObjectODB().get(objectId); + if(!(object instanceof CreatureObject)) + return null; if (object != null && getObject(object.getObjectID()) == null) { loadServerTemplate(object); - - object.viewChildren(object, true, true, new Traverser() { - - public void process(SWGObject child) { - loadServerTemplate(child); - } - - }); + object.viewChildren(object, true, true, (child) -> loadServerTemplate(child)); } - return object; + return (CreatureObject) object; } public long generateObjectID() { @@ -627,7 +632,7 @@ public class ObjectService implements INetworkDispatch { } catch (SQLException e) { e.printStackTrace(); } - if(getObject(newId) != null || core.getObjectIdODB().contains(newId, Long.class, ObjectId.class)) + if(getObject(newId) != null || core.getObjectIdODB().contains(newId)) found = false; else found = true; @@ -645,13 +650,11 @@ public class ObjectService implements INetworkDispatch { long objectId = 0; - if (core.getDuplicateIdODB().contains(key, String.class, DuplicateId.class)) { - objectId = core.getDuplicateIdODB().get(key, String.class, DuplicateId.class).getObjectId(); + if (core.getDuplicateIdODB().contains(key)) { + objectId = ((DuplicateId) core.getDuplicateIdODB().get(key)).getObjectId(); } else { objectId = generateObjectID(); - Transaction txn = core.getDuplicateIdODB().getEnvironment().beginTransaction(null, null); - core.getDuplicateIdODB().put(new DuplicateId(key, objectId), String.class, DuplicateId.class, txn); - txn.commitSync(); + core.getDuplicateIdODB().put(key, new DuplicateId(key, objectId)); } return objectId; @@ -913,9 +916,23 @@ public class ObjectService implements INetworkDispatch { if(!core.getConfig().getString("MOTD").equals("")) creature.sendSystemMessage(core.getConfig().getString("MOTD"), (byte) 2); - BountyListItem bounty = core.getBountiesODB().get(creature.getObjectId(), Long.class, BountyListItem.class); - if (bounty != null) - core.missionService.getBountyList().add(bounty); + if (core.getBountiesODB().contains(creature.getObjectId())) + core.missionService.getBountyList().add((BountyListItem) core.getBountiesODB().get(creature.getObjectId())); + + if (creature.getSlottedObject("datapad") != null) { + creature.getSlottedObject("datapad").viewChildren(creature, true, false, new Traverser() { + + @Override + public void process(SWGObject obj) { + if (obj instanceof MissionObject) { + MissionObject mission = (MissionObject) obj; + if (mission.getMissionType().equals("bounty")) { + ((BountyMissionObjective) mission.getObjective()).checkBountyActiveStatus(core); + } + } + } + }); + } core.playerService.postZoneIn(creature); } @@ -1112,13 +1129,11 @@ public class ObjectService implements INetworkDispatch { String key = "" + CRC.StringtoCRC(planet.getName()) + CRC.StringtoCRC(template) + type + containerId + cellIndex + x + py + z; long newObjectId = 0; - if (core.getDuplicateIdODB().contains(key, String.class, DuplicateId.class)) { - newObjectId = core.getDuplicateIdODB().get(key, String.class, DuplicateId.class).getObjectId(); + if (core.getDuplicateIdODB().contains(key)) { + newObjectId = ((DuplicateId) core.getDuplicateIdODB().get(key)).getObjectId(); } else { newObjectId = generateObjectID(); - Transaction txn = core.getDuplicateIdODB().getEnvironment().beginTransaction(null, null); - core.getDuplicateIdODB().put(new DuplicateId(key, newObjectId), String.class, DuplicateId.class, txn); - txn.commitSync(); + core.getDuplicateIdODB().put(key, new DuplicateId(key, newObjectId)); } duplicate.put(objectId, newObjectId); @@ -1129,7 +1144,7 @@ public class ObjectService implements INetworkDispatch { SWGObject object; if(objectId != 0 && containerId == 0) { if(portalCRC != 0) { - if (core.getBuildingODB().contains(objectId, Long.class, BuildingObject.class) && !duplicate.containsValue(objectId)) + if (core.getSWGObjectODB().contains(objectId) && !duplicate.containsValue(objectId)) continue; containers.add(objectId); object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz), null, true, false); @@ -1181,9 +1196,7 @@ public class ObjectService implements INetworkDispatch { } for(BuildingObject building : persistentBuildings) { - building.createTransaction(core.getBuildingODB().getEnvironment()); - core.getBuildingODB().put(building, Long.class, BuildingObject.class, building.getTransaction()); - building.getTransaction().commitSync(); + core.getSWGObjectODB().put(building.getObjectID(), building); destroyObject(building); } @@ -1210,16 +1223,12 @@ public class ObjectService implements INetworkDispatch { return count.get(); } - public void persistObject(IPersistent object, Class keyClass, Class valueClass, ObjectDatabase odb) { - object.createTransaction(odb.getEnvironment()); - core.getAuctionODB().put(object, keyClass, valueClass, object.getTransaction()); - object.getTransaction().commitSync(); + public void persistObject(long key, Object value, ObjectDatabase odb) { + odb.put(key, value); } - public void deletePersistentObject(IPersistent object, Class keyClass, Class valueClass, ObjectDatabase odb, Object key) { - object.createTransaction(odb.getEnvironment()); - core.getAuctionODB().delete(key, keyClass, valueClass, object.getTransaction()); - object.getTransaction().commitSync(); + public void deletePersistentObject(long key, ObjectDatabase odb) { + odb.remove(key); } } diff --git a/src/services/object/ObjectTransactionManager.java b/src/services/object/ObjectTransactionManager.java deleted file mode 100644 index f4fcfc6a..00000000 --- a/src/services/object/ObjectTransactionManager.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 - * - * This File is part of NGECore2. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. - * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. - ******************************************************************************/ -package services.object; - -import java.util.Collection; -import java.util.Iterator; - -import com.sleepycat.je.Transaction; - -import engine.resources.objects.IPersistent; -import engine.resources.objects.SWGObject; - - -/** - * This Class is used to periodically save all Objects using transactions to disk. - * Remember that you still need commit transactions manually whenever an object using transactions is removed from zone i.e. when a player logs out. - * @author Light - */ -public class ObjectTransactionManager implements Runnable { - - private ObjectService objService; - private int cycleTime; - - /** - * - * @param objService ObjectService - * @param cycleTime Time between each full object save in ms. - */ - public ObjectTransactionManager(ObjectService objService, int cycleTime) { - - this.objService = objService; - this.cycleTime = cycleTime; - - } - - - @Override - public void run() { - - try { - - Thread.sleep(cycleTime); - - Collection swgObjects = objService.getObjectList().values(); - - synchronized(swgObjects) { - - Iterator it = swgObjects.iterator(); - - while(it.hasNext()) { - - SWGObject obj = it.next(); - - if(obj instanceof IPersistent && !obj.isInSnapshot() && obj.isPersistent()) { - - if(((IPersistent) obj).getTransaction() == null) - continue; - - if(!((IPersistent) obj).getTransaction().isValid()) - continue; - - Transaction txn = ((IPersistent) obj).getTransaction(); - txn.commitSync(); - - } - - } - - } - - } catch (InterruptedException e) { - e.printStackTrace(); - } - - } - -} - - diff --git a/src/services/pet/MountService.java b/src/services/pet/MountService.java index a8094945..6108e0a2 100644 --- a/src/services/pet/MountService.java +++ b/src/services/pet/MountService.java @@ -33,7 +33,6 @@ import resources.datatables.DisplayType; import resources.datatables.Options; import resources.datatables.Posture; import resources.datatables.State; -import resources.datatables.StateStatus; import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; @@ -184,6 +183,7 @@ public class MountService implements INetworkDispatch { mount.setFaction(actor.getFaction()); mount.setFactionStatus(actor.getFactionStatus()); + mount.setOwnerId(actor.getObjectID()); if (pcd.getTemplate().contains("vehicle")) { callVehicle(actor, pcd, player, mount); @@ -422,21 +422,19 @@ public class MountService implements INetworkDispatch { return; } - // Put rider into mount mount._add(rider); - - // Set mount states and stuff - mount.setStateBitmask(mount.getStateBitmask() | State.MountedCreature); - mount.setState(State.MountedCreature, true); - rider.setPosture((mount.getTemplate().contains("vehicle")) ? Posture.DrivingVehicle : Posture.RidingCreature); - - // Set rider states and stuff - rider.setStateBitmask(rider.getStateBitmask() | State.RidingMount); - rider.setState(State.RidingMount, true); - - // Notify observers and update quadtree mount.notifyObservers(new UpdateContainmentMessage(rider.getObjectID(), mount.getObjectID(), 4), true); core.simulationService.remove(rider, rider.getWorldPosition().x, rider.getWorldPosition().z, false); + + rider.setState(State.RidingMount, true); + mount.setState(State.MountedCreature, true); + + rider.setPosture((mount.getTemplate().contains("vehicle")) ? Posture.DrivingVehicle : Posture.RidingCreature); + //mount.setPosture((mount.getTemplate().contains("vehicle")) ? Posture.DrivingVehicle : Posture.RidingCreature); + + if (!mount.getSlotNameForObject(rider).equals("rider1")) { + core.buffService.addBuffToCreature(rider, "vehicle_passenger", mount); + } } public CreatureObject getMount(SWGObject pcd) { @@ -637,6 +635,9 @@ public class MountService implements INetworkDispatch { core.simulationService.teleport(rider, mount.getWorldPosition(), mount.getOrientation(), 0); core.simulationService.add(rider, mount.getWorldPosition().x, mount.getWorldPosition().z, false); + core.buffService.clearBuffs(mount); + core.buffService.removeBuffFromCreature(rider, rider.getBuffByName("vehicle_passenger")); + // Store mount if it's a creature if (!mount.getTemplate().contains("vehicle") && rider.getObjectID() == mount.getOwnerId()) { store(rider, mount); diff --git a/src/services/playercities/PlayerCity.java b/src/services/playercities/PlayerCity.java index 34afeef9..066c015e 100644 --- a/src/services/playercities/PlayerCity.java +++ b/src/services/playercities/PlayerCity.java @@ -21,6 +21,7 @@ ******************************************************************************/ package services.playercities; +import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -40,9 +41,12 @@ import engine.resources.scene.Point3D; * @author Charon */ -public class PlayerCity { +public class PlayerCity implements Serializable { + + private static final long serialVersionUID = 1L; public static final int DESERTED = 0; + public static final int NEWCITY = 0; public static final int OUTPOST = 1; public static final int VILLAGE = 2; public static final int TOWNSHIP = 3; @@ -106,8 +110,11 @@ public class PlayerCity { private boolean registered = false; private boolean zoningEnabled = false; - private final long cityUpdateSpan = 7*86400*1000; - private final long legislationPeriod = 21*86400*1000; + //private final long cityUpdateSpan = 7*86400*1000; + private final long cityUpdateSpan = 100*1000; + + //private final long legislationPeriod = 21*86400*1000; + private final long legislationPeriod = 100*1000; private Vector placedStructures = new Vector(); private Vector citizens = new Vector(); @@ -129,6 +136,7 @@ public class PlayerCity { setNextElectionDate(foundationTime+legislationPeriod); citizens.add(founder.getObjectID()); this.cityID = cityID; + setMayorID(founder.getObjectID()); } public void handleGrantZoning() { @@ -156,36 +164,67 @@ public class PlayerCity { public void processCityUpdate() { // has something changed? System.out.println("processCityUpdate"); - int censusResult = citizens.size(); - // ToDo: Consider 1 rank per update changes - if (censusResult<5){ - setRank(DESERTED); // City is technically not a city anymore - setCityRadius(0); - } + int censusResult = citizens.size(); + int currentRank = getRank(); - if (censusResult>=5 && censusResult<10){ - setRank(OUTPOST); - setCityRadius(150); - } + switch (currentRank) { + case NEWCITY : if (censusResult>=5){ + setRank(++currentRank); // Expand to Outpost + sendCityExpandMailAll(); + } + + if (censusResult<5){ + // kill city + } + break; + + case OUTPOST : if (censusResult>=10){ + setRank(++currentRank); // Expand to Village + sendCityExpandMailAll(); + } + if (censusResult<5){ + setRank(--currentRank); // Contract to Deserted + sendCityContractMailAll(); + } + break; + + case VILLAGE : if (censusResult>=15){ + setRank(++currentRank); // Expand to Township + sendCityExpandMailAll(); + } + if (censusResult<10){ + setRank(--currentRank); // Contract to Outpost + sendCityContractMailAll(); + } + break; + + case TOWNSHIP : if (censusResult>=30){ + setRank(++currentRank); // Expand to City + sendCityExpandMailAll(); + } + if (censusResult<15){ + setRank(--currentRank); // Contract to Village + sendCityContractMailAll(); + } + break; + + case CITY : if (censusResult>=40){ + setRank(++currentRank); // Expand to Metropolis + sendCityExpandMailAll(); + } + if (censusResult<15){ + setRank(--currentRank); // Contract to Township + sendCityContractMailAll(); + } + break; + + case METROPOLIS : if (censusResult<40){ + setRank(--currentRank); // Contract to City + sendCityContractMailAll(); + } + break; + - if (censusResult>=10 && censusResult<15){ - setRank(VILLAGE); - setCityRadius(200); - } - - if (censusResult>=15 && censusResult<30){ - setRank(TOWNSHIP); - setCityRadius(300); - } - - if (censusResult>=30 && censusResult<40){ - setRank(CITY); - setCityRadius(400); - } - - if (censusResult>=40){ - setRank(METROPOLIS); - setCityRadius(450); } // collect taxes @@ -212,6 +251,10 @@ public class PlayerCity { setNextCityUpdate(System.currentTimeMillis()+cityUpdateSpan); } + public void cityFixUp(){ + + } + public void demolishHighRankStructures() { // Check if there are any structures in the city // that require a higher rank than the current one @@ -263,8 +306,10 @@ public class PlayerCity { if (citizenList.contains(founderId) && (long)citizenObject.getAttachment("residentCity")==this.getCityID()) founderCitizenCount++; } - if (founderCitizenCount==founders.size()) - return true; // All founders are citizens now + if (founderCitizenCount==founders.size()){ + return true; // All founders are citizens now + + } return false; } @@ -475,6 +520,7 @@ public class PlayerCity { public void setCityName(String cityName) { this.cityName = cityName; sendNameChangeMail(cityName); + return; } public int getCityID() { @@ -548,6 +594,20 @@ public class PlayerCity { public void setZoningEnabled(boolean zoningEnabled) { this.zoningEnabled = zoningEnabled; } + + public boolean isMilitiaMember(long actor){ + if (getMilitiaList().contains(actor)) + return true; + + return false; + } + + public boolean hasCitizen(long actor){ + if (getCitizens().contains(actor)) + return true; + + return false; + } public static String[] getSpecialisationSTFNames() { return specialisationSTFNames; @@ -695,5 +755,95 @@ public class PlayerCity { } } + + public void sendCityExpandMailAll() { + Vector citizenList = getCitizens(); + for (long citizen : citizenList){ + CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen); + Mail actorMail = new Mail(); + actorMail.setMailId(NGECore.getInstance().chatService.generateMailId()); + actorMail.setRecieverId(citizen); + actorMail.setStatus(Mail.NEW); + actorMail.setTimeStamp((int) (new Date().getTime() / 1000)); + actorMail.setMessage("@city/city:city_expand_body"); + actorMail.setSubject("@city/city:city_expand_subject"); + actorMail.setSenderName("City " + this.cityName); + + List attachments = new ArrayList(); + WaypointObject constructionWaypoint = (WaypointObject)NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", citizenObject.getPlanet(), citizenObject.getPosition().x, 0 ,citizenObject.getPosition().z); + WaypointAttachment attachment = new WaypointAttachment(); + attachment.active = false; + attachment.cellID = constructionWaypoint.getCellId(); + attachment.color = (byte)1; + attachment.name = "City"; + attachment.planetCRC = engine.resources.common.CRC.StringtoCRC(citizenObject.getPlanet().getName()); + attachment.positionX = citizenObject.getPosition().x; + attachment.positionY = 0; + attachment.positionZ = citizenObject.getPosition().z; + attachments.add(attachment); + actorMail.setAttachments(attachments); + + NGECore.getInstance().chatService.storePersistentMessage(actorMail); + + } + } + + public void sendCityContractMailAll() { + + Vector citizenList = getCitizens(); + for (long citizen : citizenList){ + CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen); + Mail actorMail = new Mail(); + actorMail.setMailId(NGECore.getInstance().chatService.generateMailId()); + actorMail.setRecieverId(citizen); + actorMail.setStatus(Mail.NEW); + actorMail.setTimeStamp((int) (new Date().getTime() / 1000)); + actorMail.setMessage("@city/city:city_contract_body"); + actorMail.setSubject("@city/city:city_contract_subject"); + actorMail.setSenderName("City " + this.cityName); + + List attachments = new ArrayList(); + WaypointObject constructionWaypoint = (WaypointObject)NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", citizenObject.getPlanet(), citizenObject.getPosition().x, 0 ,citizenObject.getPosition().z); + WaypointAttachment attachment = new WaypointAttachment(); + attachment.active = false; + attachment.cellID = constructionWaypoint.getCellId(); + attachment.color = (byte)1; + attachment.name = "City"; + attachment.planetCRC = engine.resources.common.CRC.StringtoCRC(citizenObject.getPlanet().getName()); + attachment.positionX = citizenObject.getPosition().x; + attachment.positionY = 0; + attachment.positionZ = citizenObject.getPosition().z; + attachments.add(attachment); + actorMail.setAttachments(attachments); + + NGECore.getInstance().chatService.storePersistentMessage(actorMail); + } + } + + + + + // Test method to be deleted later + public void Add10MoreCitizens() { + synchronized(citizens){ + for (int i=0;i<10;i++){ + this.citizens.add(this.getMayorID()); + } + + } + } + + + // Test method to be deleted later + public void Deduct10Citizens() { + int citizenCount = this.getCitizens().size(); + synchronized(citizens){ + this.citizens.clear(); + + for (int i=0;i playerCities = new Vector(); private int cityID = 0; // This must be persisted or handled via objectservice somehow + // static helper variable to be deleted later + public static boolean sandboxCityBuilt = false; + public PlayerCityService(NGECore core) { this.core = core; @@ -95,7 +102,8 @@ public class PlayerCityService implements INetworkDispatch { synchronized(playerCities){ for (PlayerCity city : playerCities){ int radius = city.getCityRadius(); - if (object.getPosition().getDistance2D(city.getCityCenterPosition()) returnList = new Vector(); + returnList.add("txtInput:LocalText"); + window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() { + @Override + public void process(SWGObject owner, int eventType, Vector returnList) { + if (returnList.size()==0) + return; + PlayerCity playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity((CreatureObject) owner); + playerCity.setCityName(returnList.get(0)); + //owner.sendSystemMessage("@city/city:name_changed", 0); + core.suiService.closeSUIWindow(owner, 0); + newCitySUI2((CreatureObject) owner, playerCity); + } + }); + core.suiService.openSUIWindow(window); + } + + public void newCitySUI2(CreatureObject citizen, final PlayerCity newCity) { final SUIWindow window = core.suiService.createSUIWindow("Script.messageBox", citizen, citizen, 0); window.setProperty("bg.caption.lblTitle:Text", "@city/city:rank0"); window.setProperty("Prompt.lblPrompt:Text", "@city/city:new_city_body"); @@ -135,6 +163,99 @@ public class PlayerCityService implements INetworkDispatch { }); core.suiService.openSUIWindow(window); } + + + // Test method to be deleted later + public void buildSandboxTestCity(CreatureObject founder) { + + if (sandboxCityBuilt) + return; + + float positionX = 2170.0F; + float positionY = 1.0F; + float positionZ = -4659.0F; + + String structureTemplate = "object/building/player/city/shared_cityhall_tatooine.iff"; + + BuildingObject cityHall = (BuildingObject) core.objectService.createObject(structureTemplate, 0, founder.getPlanet(), new Point3D(positionX, positionY, positionZ), founder.getOrientation()); + core.simulationService.add(cityHall, cityHall.getPosition().x, cityHall.getPosition().z, true); + + SWGObject sign = core.objectService.createChildObject((SWGObject)cityHall, "object/tangible/sign/player/shared_house_address.iff", -7.39F, 2.36F, 2, -1, 0, -1); + cityHall.setAttachment("structureSign", sign); + + PlayerCity sandboxCity = null; + synchronized(playerCities){ + sandboxCity = new PlayerCity(founder,cityID++); + sandboxCity.setCityName("Sandbox City"); + playerCities.add(sandboxCity); + } + + cityHall.setAttachment("structureCity", sandboxCity.getCityID()); + founder.setAttachment("residentCity", sandboxCity.getCityID()); + // Name the sign +// TangibleObject sign = (TangibleObject) cityHall.getAttachment("structureSign"); +// String playerFirstName = founder.getCustomName().split(" ")[0]; +// +// if (sign !=null) +// sign.setCustomName2(playerFirstName + "'s House"); + + + + // Structure management + Vector admins = new Vector<>(); + admins.add(founder.getObjectID()); + + cityHall.setAttachment("structureOwner", founder.getObjectID()); + cityHall.setAttachment("structureAdmins", admins); + cityHall.setDeedTemplate("object/tangible/deed/city_deed/shared_cityhall_tatooine_deed.iff"); + cityHall.setBMR(325); + cityHall.setConditionDamage(100); + + + positionY = core.terrainService.getHeight(founder.getPlanetId(), positionX, positionZ); + founder.setPosition(new Point3D(positionX,positionY,positionZ+50)); + core.simulationService.teleport(founder, new Point3D(positionX,positionY,positionZ+50), founder.getOrientation(), 0); + + TangibleObject swoopDeed = (TangibleObject) core.objectService.createObject("object/tangible/deed/vehicle_deed/shared_speederbike_swoop_deed.iff", founder.getPlanet()); + SWGObject inventory = founder.getSlottedObject("inventory"); + inventory.add(swoopDeed); + + TangibleObject shuttleportDeed = (TangibleObject) core.objectService.createObject("object/tangible/deed/city_deed/shared_shuttleport_tatooine_deed.iff", founder.getPlanet()); + inventory.add(shuttleportDeed); + + TangibleObject garden1 = (TangibleObject) core.objectService.createObject("object/tangible/deed/city_deed/shared_garden_tatooine_sml_01_deed.iff", founder.getPlanet()); + inventory.add(garden1); + + + //structureTemplate = "object/building/player/city/shared_shuttleport_tatooine.iff"; + structureTemplate = "object/building/tatooine/shared_shuttleport_tatooine.iff"; + positionX = 2170.0F; + positionY = 1.0F; + positionZ = -4559.0F; + positionY = core.terrainService.getHeight(founder.getPlanetId(), positionX, positionZ); + + //StructureObject shuttlePort = (StructureObject) core.objectService.createObject(structureTemplate, 0, founder.getPlanet(), new Point3D(positionX, positionY, positionZ), founder.getOrientation()); + //BuildingObject shuttlePort = (BuildingObject) core.objectService.createObject(structureTemplate, 0, founder.getPlanet(), new Point3D(positionX, positionY, positionZ), founder.getOrientation()); + //shuttlePort.setAttachment("cellsSorted", new Boolean(true)); + //"bigSpawnRange" + + //core.simulationService.add(shuttlePort, shuttlePort.getPosition().x, shuttlePort.getPosition().z, true); +// sign = core.objectService.createChildObject((SWGObject)shuttlePort, "object/tangible/sign/player/shared_house_address.iff", -7.39F, 2.36F, 2, -1, 0, -1); +// shuttlePort.setAttachment("structureSign", sign); + + // Structure management + admins = new Vector<>(); + admins.add(founder.getObjectID()); + +// shuttlePort.setAttachment("structureOwner", founder.getObjectID()); +// shuttlePort.setAttachment("structureAdmins", admins); +// shuttlePort.setDeedTemplate("object/tangible/deed/city_deed/shared_cityhall_tatooine_deed.iff"); +// shuttlePort.setBMR(12); +// shuttlePort.setConditionDamage(100); + + sandboxCityBuilt = true; + } + @Override public void insertOpcodes(Map arg0, diff --git a/src/services/resources/ResourceService.java b/src/services/resources/ResourceService.java index 0cb2cab1..d6719c0b 100644 --- a/src/services/resources/ResourceService.java +++ b/src/services/resources/ResourceService.java @@ -33,6 +33,7 @@ import com.sleepycat.persist.EntityCursor; import main.NGECore; import engine.resources.common.CRC; +import engine.resources.database.ODBCursor; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; @@ -114,9 +115,8 @@ public class ResourceService implements INetworkDispatch { // createCollections2(); // createCollections3(); // } else { - EntityCursor cursor = core.getResourceRootsODB().getCursor(Integer.class, ResourceRoot.class); - Iterator it = cursor.iterator(); - if(!it.hasNext()) { + ODBCursor cursor = core.getResourceRootsODB().getCursor(); + if(!cursor.hasNext()) { createCollections(); createCollections2(); createCollections3(); @@ -133,12 +133,11 @@ public class ResourceService implements INetworkDispatch { // loads the resource roots at server start public void loadResourceRoots() { - EntityCursor cursor = core.getResourceRootsODB().getCursor(Integer.class, ResourceRoot.class); - Iterator it = cursor.iterator(); + ODBCursor cursor = core.getResourceRootsODB().getCursor(); int loadedResourceRootsCounter = 0; System.out.println("Loading resource roots..."); - while(it.hasNext()) { - final ResourceRoot resourceRoot = it.next(); + while(cursor.hasNext()) { + final ResourceRoot resourceRoot = (ResourceRoot) cursor.next(); System.err.println("resourceRoot loaded ID: " + resourceRoot.getResourceRootID() + " " + resourceRoot.getResourceFileName()); core.resourceService.add_resourceRoot(resourceRoot); loadedResourceRootsCounter++; @@ -154,12 +153,11 @@ public class ResourceService implements INetworkDispatch { // loads the currently spawned resources at server start public void loadResources() { - EntityCursor cursor = core.getResourcesODB().getCursor(Long.class, GalacticResource.class); - Iterator it = cursor.iterator(); + ODBCursor cursor = core.getResourcesODB().getCursor(); int loadedResourceCounter = 0; System.out.println("Loading resources..."); - while(it.hasNext()) { - final GalacticResource resource = it.next(); + while(cursor.hasNext()) { + final GalacticResource resource = (GalacticResource) cursor.next(); System.err.println("resource " + resource.getName() + " rootID " + resource.getResourceRootID()); core.objectService.getObjectList().put(resource.getId(), resource); @@ -10800,9 +10798,7 @@ public class ResourceService implements INetworkDispatch { for (int i=0;i spawnGroups; + private Vector mobiles = new Vector(); + + public DynamicSpawnArea(Planet planet, AbstractCollidable area, DynamicSpawnGroup spawnGroup) { super(planet, area); + this.spawnGroup = spawnGroup; + } + + public DynamicSpawnArea(Planet planet, AbstractCollidable area, Vector spawnGroups) { + super(planet, area); + this.spawnGroups = spawnGroups; } @Override @Handler public void onEnter(EnterEvent event) { + + SWGObject object = event.object; + if(object == null || !(object instanceof CreatureObject)) + return; + + CreatureObject creature = (CreatureObject) object; + + if(creature.getSlottedObject("ghost") == null) + return; + + creature.getEventBus().subscribe(this); + // spawn some creatures + if (spawnGroups==null){ + if (spawnGroup.getGroupMembersNumber()==-1){ + for(int i = 0; i < 5; i++) + spawnCreature(creature); + } else { + Vector groupMembers = new Vector(); + Point3D randomGroupPosition = getRandomPosition(creature.getWorldPosition(), 32, 100); + for(int i = 0; i < spawnGroup.getGroupMembersNumber(); i++) {// A group with a specified number of members + CreatureObject spawnedCreature = spawnCreatureMember(creature, groupMembers, randomGroupPosition, i); + if (spawnedCreature!=null) + groupMembers.add(spawnedCreature); + } + } + } else { + // select randomly one of the spawngroups -> minimizes number of collidables for areas with multiple different NPC groups + // One spawnarea -> many NPC groups + int index = new Random().nextInt(spawnGroups.size()); + this.spawnGroup = spawnGroups.get(index); + Vector groupMembers = new Vector(); + Point3D randomGroupPosition = getRandomPosition(creature.getWorldPosition(), 32, 100); + int spawnCount = spawnGroup.getGroupMembersNumber(); + if (spawnCount<0) + spawnCount = Math.abs(spawnCount) + new Random().nextInt(spawnGroup.getMobiles().size()-Math.abs(spawnCount)); + for(int i = 0; i < spawnCount; i++) {// A group with a specified or random number of members + CreatureObject spawnedCreature = spawnCreatureMember(creature, groupMembers, randomGroupPosition, i); + if (spawnedCreature!=null) + groupMembers.add(spawnedCreature); + } + } + } @Override @Handler public void onExit(ExitEvent event) { + SWGObject object = event.object; + + if(object == null || !(object instanceof CreatureObject)) + return; + + CreatureObject creature = (CreatureObject) object; + + if(creature.getSlottedObject("ghost") == null) + return; + + creature.getEventBus().unsubscribe(this); + + } + + @Handler + public void onMove(MoveEvent event) { + + SWGObject object = event.object; + + if(object == null || !(object instanceof CreatureObject) || object.getContainer() != null) + return; + + CreatureObject creature = (CreatureObject) object; + + if(creature.getSlottedObject("ghost") == null) + return; + + if (spawnGroups==null){ + if (spawnGroup.getGroupMembersNumber()==-1){ + if(new Random().nextFloat() <= 0.25) + spawnCreature(creature); + } else + { + Vector groupMembers = new Vector(); + Point3D randomGroupPosition = getRandomPosition(creature.getWorldPosition(), 32, 100); + for(int i = 0; i < spawnGroup.getGroupMembersNumber(); i++) {// A group with a specified number of members + CreatureObject spawnedCreature = spawnCreatureMember(creature, groupMembers, randomGroupPosition, i); + if (spawnedCreature!=null) + groupMembers.add(spawnedCreature); + } + } + } else { + // select randomly one of the spawngroups -> minimizes number of collidables for areas with multiple different NPC groups + // One spawnarea -> many NPC groups + int index = new Random().nextInt(spawnGroups.size()); + this.spawnGroup = spawnGroups.get(index); + Vector groupMembers = new Vector(); + Point3D randomGroupPosition = getRandomPosition(creature.getWorldPosition(), 32, 100); + int spawnCount = spawnGroup.getGroupMembersNumber(); + if (spawnCount<0) + spawnCount = Math.abs(spawnCount) + new Random().nextInt(spawnGroup.getMobiles().size()-Math.abs(spawnCount)); + for(int i = 0; i < spawnCount; i++) {// A group with a specified or random number of members + CreatureObject spawnedCreature = spawnCreatureMember(creature, groupMembers, randomGroupPosition, i); + if (spawnedCreature!=null) + groupMembers.add(spawnedCreature); + } + } + } + + private void spawnCreature(CreatureObject creature) { + + NGECore core = NGECore.getInstance(); + +// Iterator it = mobiles.iterator(); // This stops further execution of this method for some reason +// it.forEachRemaining(mobile -> { +// if(mobile.getPosture() == Posture.Dead) +// it.remove(); +// }); + + mobiles.removeAll(Collections.singleton(null)); + Vector removers = new Vector(); + for (CreatureObject ob : mobiles){ + if (ob.getPosture() == Posture.Dead) + removers.add(ob); + } + mobiles.removeAll(removers); + + if(mobiles.size() >= spawnGroup.getMaxSpawns()) + return; + + boolean foundPos = false; + int tries = 0; + Point3D randomPosition = null; + + while(!foundPos && ++tries < 10) { + + randomPosition = getRandomPosition(creature.getWorldPosition(), 32.f, 200.f); + + if(randomPosition == null) + return; + + TerrainService terrainSvc = core.terrainService; + + float height = terrainSvc.getHeight(getPlanet().getID(), randomPosition.x, randomPosition.z); + randomPosition.y = height; + + if (mobiles.size()>0){ // Fix, mobiles must be filled first, before doing this check + for(CreatureObject mobile : mobiles) { + if(mobile.getWorldPosition().getDistance(randomPosition) > spawnGroup.getMinSpawnDistance()) + foundPos = true; + } + } else {foundPos = true;} + + if(!terrainSvc.canBuildAtPosition(creature, randomPosition.x, randomPosition.z)) + foundPos = false; + + } + + if(!foundPos) + return; + + Random random = new Random(); + + String mobileTemplate = spawnGroup.getMobiles().get(random.nextInt(spawnGroup.getMobiles().size())); + CreatureObject spawnedCreature = core.spawnService.spawnCreature(mobileTemplate, getPlanet().getName(), 0, randomPosition.x, randomPosition.y, randomPosition.z); + if(spawnedCreature != null){ + mobiles.add(spawnedCreature); + } + + } + + + private CreatureObject spawnCreatureMember(CreatureObject creature, Vector groupMembers, Point3D randomGroupPosition, int spawnIndex) { + + NGECore core = NGECore.getInstance(); + +// Iterator it = mobiles.iterator(); // This stops further execution of this method for some reason +// it.forEachRemaining(mobile -> { +// if(mobile.getPosture() == Posture.Dead) +// it.remove(); +// }); + + mobiles.removeAll(Collections.singleton(null)); + Vector removers = new Vector(); + for (CreatureObject ob : mobiles){ + if (ob.getPosture() == Posture.Dead) + removers.add(ob); + } + mobiles.removeAll(removers); + +// if(mobiles.size() >= spawnGroup.getMaxSpawns()) +// return; + + boolean foundPos = false; + int tries = 0; + Point3D randomPosition = null; + String template = spawnGroup.getMobiles().get(spawnIndex); + MobileTemplate mobileTemplate = NGECore.getInstance().spawnService.getMobileTemplate(template); + if (mobileTemplate==null){ + System.out.println("mobileTemplate==null"); + return null; + } + + while(!foundPos && ++tries < 30) { + + randomPosition = getRandomPosition(randomGroupPosition, mobileTemplate.getMinSpawnDistance(), mobileTemplate.getMaxSpawnDistance()); + + if(randomPosition == null){ + System.out.println("randomPosition == null"); + return null; + } + + TerrainService terrainSvc = core.terrainService; + + float height = terrainSvc.getHeight(getPlanet().getID(), randomPosition.x, randomPosition.z); + randomPosition.y = height; + + if (mobiles.size()>0){ // Fix, mobiles must be filled first, before doing this check + boolean minDistViolated = false; + for(CreatureObject mobile : mobiles) { + if(mobile.getWorldPosition().getDistance(randomPosition) < spawnGroup.getMinSpawnDistance() && ! groupMembers.contains(mobile)){ + minDistViolated = true; // Distance to other nearby groups + } + } + if (minDistViolated) + foundPos = false; + else + foundPos = true; + } else {foundPos = true;} + + if(!terrainSvc.canBuildAtPosition(creature, randomPosition.x, randomPosition.z)) + foundPos = false; + + } + + if(!foundPos){ + return null; + } + + + CreatureObject spawnedCreature = core.spawnService.spawnCreature(template, getPlanet().getName(), 0, randomPosition.x, randomPosition.y, randomPosition.z); + if(spawnedCreature != null){ + mobiles.add(spawnedCreature); + } + + return spawnedCreature; + } } diff --git a/src/services/spawn/DynamicSpawnGroup.java b/src/services/spawn/DynamicSpawnGroup.java new file mode 100644 index 00000000..da3df12e --- /dev/null +++ b/src/services/spawn/DynamicSpawnGroup.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package services.spawn; + +import java.util.Vector; + +public class DynamicSpawnGroup { + + private Vector mobiles; + private String name; + private int maxSpawns; + private int minSpawnDistance; + private int groupMembersNumber = -1; + + public Vector getMobiles() { + return mobiles; + } + + public void setMobiles(Vector mobiles) { + this.mobiles = mobiles; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getMaxSpawns() { + return maxSpawns; + } + + public void setMaxSpawns(int maxSpawns) { + this.maxSpawns = maxSpawns; + } + + public int getMinSpawnDistance() { + return minSpawnDistance; + } + + public void setMinSpawnDistance(int minSpawnDistance) { + this.minSpawnDistance = minSpawnDistance; + } + + public int getGroupMembersNumber() { + return groupMembersNumber; + } + + public void setGroupMembersNumber(int groupMembersNumber) { + this.groupMembersNumber = groupMembersNumber; + } + +} diff --git a/src/services/spawn/LairSpawnArea.java b/src/services/spawn/LairSpawnArea.java index 026268cd..a4f29896 100644 --- a/src/services/spawn/LairSpawnArea.java +++ b/src/services/spawn/LairSpawnArea.java @@ -79,7 +79,7 @@ public class LairSpawnArea extends SpawnArea { randomPosition.y = height; for(LairActor otherLair : lairs) { - if(otherLair.getLairObject().getWorldPosition().getDistance(randomPosition) < 10) + if(otherLair.getLairObject().getWorldPosition().getDistance(randomPosition) < 30) return; } diff --git a/src/services/spawn/MobileTemplate.java b/src/services/spawn/MobileTemplate.java index 92f19f75..61098040 100644 --- a/src/services/spawn/MobileTemplate.java +++ b/src/services/spawn/MobileTemplate.java @@ -32,6 +32,8 @@ public class MobileTemplate { private int optionBitmask = Options.ATTACKABLE; private int pvpBitmask = PvpStatus.Attackable; private short level; + private short minLevel; + private short maxLevel; private Vector attacks; private String defaultAttack; private int minDamage = 0; @@ -46,7 +48,13 @@ public class MobileTemplate { private int attackRange; private Vector weaponTemplates = new Vector(); private Vector weaponTemplateVector = new Vector(); - + private int minSpawnDistance = 0; + private int maxSpawnDistance = 0; + private boolean deathblow = false; + private String socialGroup; // see prima guide + private int assistRange; // use prima guide for ranges + private boolean isStalker = false; + public Vector getTemplates() { return templates; } @@ -190,4 +198,68 @@ public class MobileTemplate { public void setWeaponTemplateVector(Vector weaponTemplateVector) { this.weaponTemplateVector = weaponTemplateVector; } + + public int getMinSpawnDistance() { + return minSpawnDistance; + } + + public void setMinSpawnDistance(int minSpawnDistance) { + this.minSpawnDistance = minSpawnDistance; + } + + public int getMaxSpawnDistance() { + return maxSpawnDistance; + } + + public void setMaxSpawnDistance(int maxSpawnDistance) { + this.maxSpawnDistance = maxSpawnDistance; + } + + public short getMinLevel() { + return minLevel; + } + + public void setMinLevel(short minLevel) { + this.minLevel = minLevel; + } + + public short getMaxLevel() { + return maxLevel; + } + + public void setMaxLevel(short maxLevel) { + this.maxLevel = maxLevel; + } + + public boolean isDeathblow() { + return deathblow; + } + + public void setDeathblow(boolean deathblow) { + this.deathblow = deathblow; + } + + public String getSocialGroup() { + return socialGroup; + } + + public void setSocialGroup(String socialGroup) { + this.socialGroup = socialGroup; + } + + public int getAssistRange() { + return assistRange; + } + + public void setAssistRange(int assistRange) { + this.assistRange = assistRange; + } + + public boolean isStalker() { + return isStalker; + } + + public void setStalker(boolean isStalker) { + this.isStalker = isStalker; + } } diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java index dcde2707..4008156d 100644 --- a/src/services/spawn/SpawnService.java +++ b/src/services/spawn/SpawnService.java @@ -61,6 +61,7 @@ public class SpawnService { private Map lairGroupTemplates = new ConcurrentHashMap(); private Map lairTemplates = new ConcurrentHashMap(); private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(4); + private Map dynamicGroupTemplates = new ConcurrentHashMap(); public SpawnService(NGECore core) { this.core = core; @@ -106,10 +107,19 @@ public class SpawnService { creature.setHeight(mobileTemplate.getScale()); int difficulty = mobileTemplate.getDifficulty(); creature.setDifficulty((byte) difficulty); + if(level != -1) creature.setLevel(level); - else - creature.setLevel(mobileTemplate.getLevel()); + else { + creature.setLevel(mobileTemplate.getLevel()); + level = mobileTemplate.getLevel(); + } + + if (mobileTemplate.getMinLevel()!=0 && mobileTemplate.getMaxLevel()!=0){ + level = (short) (mobileTemplate.getMinLevel() + (new Random().nextInt(mobileTemplate.getMaxLevel()-mobileTemplate.getMinLevel()))); + creature.setLevel(level); + } + //WeaponObject defaultWeapon = (mobileTemplate.getWeaponTemplates().size() > 0) ? (WeaponObject) core.objectService.createObject(mobileTemplate.getWeaponTemplates().get(new Random().nextInt(mobileTemplate.getWeaponTemplates().size())), creature.getPlanet()) : (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet()); @@ -171,6 +181,7 @@ public class SpawnService { creature.setMaxAction((int) (400 + level * 134)); creature.setAction((int) (400 + level * 134)); } else { + System.out.println("HERE"); creature.setMaxHealth(customHealth); creature.setHealth(customHealth); creature.setMaxAction((int) (level * 128)); @@ -251,7 +262,8 @@ public class SpawnService { FileVisitor fv = new SimpleFileVisitor() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - if(!file.toString().contains("lairs") && !file.toString().contains("spawnareas") && !file.toString().contains("lairgroups")) + if(!file.toString().contains("lairs") && !file.toString().contains("spawnareas") + && !file.toString().contains("lairgroups") && !file.toString().contains("dynamicgroups")) core.scriptService.callScript(file.toString().replace(file.getFileName().toString(), ""), file.getFileName().toString().replace(".py", ""), "addTemplate", core); return FileVisitResult.CONTINUE; } @@ -304,6 +316,26 @@ public class SpawnService { } } + public void loadDynamicGroups() { + Path p = Paths.get("scripts/mobiles/dynamicgroups"); + FileVisitor fv = new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + core.scriptService.callScript("scripts/mobiles/dynamicgroups/", file.getFileName().toString().replace(".py", ""), "addDynamicGroup", core); + return FileVisitResult.CONTINUE; + } + }; + try { + Files.walkFileTree(p, fv); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void addDynamicGroup(String name, DynamicSpawnGroup dynamicSpawnGroup) { + dynamicGroupTemplates.put(name, dynamicSpawnGroup); + } + public void addLairGroup(String name, Vector lairSpawnTemplates) { lairGroupTemplates.put(name, new LairGroupTemplate(name, lairSpawnTemplates)); } @@ -334,6 +366,43 @@ public class SpawnService { spawnAreas.get(planet).add(lairSpawnArea); core.simulationService.addCollidable(collidableCircle, x, z); } + + public void addDynamicSpawnArea(String dynamicGroup, float x, float z, float radius, String planetName) { + DynamicSpawnGroup dynamicGroupTemplate = dynamicGroupTemplates.get(dynamicGroup); + Planet planet = core.terrainService.getPlanetByName(planetName); + if(dynamicGroupTemplate == null || planet == null) + return; + CollidableCircle collidableCircle = new CollidableCircle(new Point3D(x, 0, z), radius, planet); + DynamicSpawnArea dynamicSpawnArea = new DynamicSpawnArea(planet, collidableCircle, dynamicGroupTemplate); + spawnAreas.get(planet).add(dynamicSpawnArea); + core.simulationService.addCollidable(collidableCircle, x, z); + } + + public void addDynamicSpawnArea(Vector dynamicGroups, float x, float z, float radius, String planetName) { + Vector dynamicSpawnGroups = new Vector(); + for (String template : dynamicGroups){ + if (dynamicGroupTemplates.get(template)==null){ + System.err.println("Dynamic Group template " + template +" not found in spawnservice collection!"); + return; + } + dynamicSpawnGroups.add(dynamicGroupTemplates.get(template)); + } + + Planet planet = core.terrainService.getPlanetByName(planetName); + if(dynamicSpawnGroups == null || dynamicSpawnGroups.size() == 0 || planet == null) + return; + CollidableCircle collidableCircle = new CollidableCircle(new Point3D(x, 0, z), radius, planet); + DynamicSpawnArea dynamicSpawnArea = new DynamicSpawnArea(planet, collidableCircle, dynamicSpawnGroups); + spawnAreas.get(planet).add(dynamicSpawnArea); + core.simulationService.addCollidable(collidableCircle, x, z); + } + public Map getMobileTemplates() { + return mobileTemplates; + } + + public MobileTemplate getMobileTemplate(String template) { + return mobileTemplates.get(template); + } }