mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-29 14:12:52 -04:00
@@ -0,0 +1,71 @@
|
||||
activateinstance
|
||||
activatequest
|
||||
broadcast
|
||||
broadcastarea
|
||||
broadcastplanet
|
||||
broadcastgalaxy
|
||||
clearcompletedquest
|
||||
clearveteranreward
|
||||
createstaticitem
|
||||
credits
|
||||
csdumptarget
|
||||
deactivtequest
|
||||
destroy
|
||||
editappearance
|
||||
editbank
|
||||
editbankaccount
|
||||
editstats
|
||||
findobject
|
||||
findobjectbytemplate
|
||||
findplayer
|
||||
findcreatre
|
||||
gmforcecommand
|
||||
freezeplayer
|
||||
unfreezeplayer
|
||||
squelch
|
||||
unsquelch
|
||||
getgametime
|
||||
getplayerid
|
||||
getrank
|
||||
goto
|
||||
grantbadge
|
||||
getveteranrewardtimecs
|
||||
grantskill
|
||||
granttitle
|
||||
harmful
|
||||
harmless
|
||||
hasveteranreward
|
||||
kill
|
||||
killplayer
|
||||
listactivequests
|
||||
revokebadge
|
||||
revokeskill
|
||||
searchcorpse
|
||||
setgrievousauthorized
|
||||
setinstanceauthorized
|
||||
setfirstname
|
||||
setlastname
|
||||
setname
|
||||
setowner
|
||||
gmrevive
|
||||
setplayerappearance
|
||||
setplayerstate
|
||||
setrank
|
||||
setspeed
|
||||
settef
|
||||
setveteranreward
|
||||
showfactioninformation
|
||||
snoop
|
||||
uncityban
|
||||
unsnoop
|
||||
wipeitems
|
||||
csstorytellerdestroynpcs
|
||||
csstorytellerdestroyprops
|
||||
csstorytellerdestroyparticles
|
||||
csstorytellerdestroyallobjects
|
||||
revertplayerappearance
|
||||
gmclearquest
|
||||
gmgrantquest
|
||||
getaccountinfo
|
||||
object
|
||||
giveitem
|
||||
@@ -0,0 +1,95 @@
|
||||
teleport
|
||||
teleportto
|
||||
teleporttarget
|
||||
invulnerable
|
||||
setspeed
|
||||
database
|
||||
destroy
|
||||
dumptargetinfo
|
||||
dumpzoneinfo
|
||||
forcecommand
|
||||
giveitem
|
||||
kill
|
||||
killplayer
|
||||
setappearance
|
||||
setexperience
|
||||
activateinstance
|
||||
activatequest
|
||||
aiignore
|
||||
clearcompletedquest
|
||||
clearstaticitem
|
||||
credits
|
||||
csdumptarget
|
||||
editappearance
|
||||
editbank
|
||||
editbankaccount
|
||||
editstats
|
||||
emptymailtarget
|
||||
findobject
|
||||
findobjetbytemplate
|
||||
findplayer
|
||||
findcreature
|
||||
generatecrafteditem
|
||||
getgametime
|
||||
getplayerid
|
||||
getstationname
|
||||
gmforcecommand
|
||||
grantskill
|
||||
granttitle
|
||||
harmfull
|
||||
harmless
|
||||
goto
|
||||
gmweapon
|
||||
gmshowquest
|
||||
gmregrantquest
|
||||
gmveteranrewardtimecs
|
||||
listactivequests
|
||||
gmrevive
|
||||
maxforcepower
|
||||
overrideactivemonths
|
||||
overridepadawantrialseligibility
|
||||
qatool
|
||||
resetjedi
|
||||
revokebadge
|
||||
revokeskill
|
||||
searchcorpse
|
||||
setfaction
|
||||
setfactionstanding
|
||||
setname
|
||||
setplayerstate
|
||||
setrank
|
||||
setgrievousauthorized
|
||||
sethue
|
||||
setinstanceauthorized
|
||||
setfirstname
|
||||
setlastname
|
||||
setplayerappearance
|
||||
setplayerstate
|
||||
settef
|
||||
setveteranreward
|
||||
showfactioninformation
|
||||
snoop
|
||||
wipeitems
|
||||
csstorytellerdestroynpcs
|
||||
csstorytellerdestroyprops
|
||||
csstorytellerdestroyparticles
|
||||
csstorytellerdestroyallobjects
|
||||
revertplayerappearance
|
||||
eventshuttledrop
|
||||
eventstartraid
|
||||
gmclearquest
|
||||
gmgrantquest
|
||||
gmspawnship
|
||||
initializecomponent
|
||||
combatdatarecord
|
||||
combatdataclear
|
||||
combatdatareport
|
||||
combatdatastop
|
||||
combatmodecheck
|
||||
startrestussstagetwo
|
||||
completerestussstageone
|
||||
spewcommandqueue
|
||||
object
|
||||
giveitem
|
||||
createcreature
|
||||
createspawningelement
|
||||
@@ -0,0 +1,58 @@
|
||||
teleport
|
||||
teleportto
|
||||
teleporttarget
|
||||
invulnerable
|
||||
setspeed
|
||||
gmforcecommand
|
||||
grantbadge
|
||||
grantskill
|
||||
granttitle
|
||||
revokebadge
|
||||
revokeskill
|
||||
revoketitle
|
||||
kill
|
||||
killplayer
|
||||
gmrevive
|
||||
revokeappearance
|
||||
setfaction
|
||||
setfactionstanding
|
||||
setrank
|
||||
setfirstname
|
||||
setlastname
|
||||
setgodmode
|
||||
sethue
|
||||
setplayerappearnace
|
||||
setplayerstate
|
||||
settef
|
||||
revertplayerappearance
|
||||
freezeplayer
|
||||
unfreezeplayer
|
||||
squelch
|
||||
unsquelch
|
||||
createcreature
|
||||
createspawningelement
|
||||
createstaticitem
|
||||
editappearance
|
||||
broadcast
|
||||
broadcastarea
|
||||
broadcastplanet
|
||||
broadcastgalaxy
|
||||
eventbuff
|
||||
eventbuffarea
|
||||
eventbufftarget
|
||||
eventclearstates
|
||||
eventdamage
|
||||
eventmovetome
|
||||
eventstorepet
|
||||
eventtefarea
|
||||
eventtefclear
|
||||
eventteftarget
|
||||
eventundomovetome
|
||||
eventvaderchoke
|
||||
eventweapon
|
||||
getplayerid
|
||||
giveitem
|
||||
eventshuttledrop
|
||||
eventstartraid
|
||||
startrestussstagetwo
|
||||
completerestussstageone
|
||||
@@ -0,0 +1,128 @@
|
||||
activateinstance
|
||||
activatequest
|
||||
aiignore
|
||||
broadcast
|
||||
broadcastarea
|
||||
broadcastgalaxy
|
||||
broadcastplanet
|
||||
clearcompletedquest
|
||||
clearveteranreward
|
||||
createstaticitem
|
||||
credits
|
||||
csdumptarget
|
||||
deactivatequest
|
||||
destroy
|
||||
editappearance
|
||||
editbank
|
||||
editbankaccount
|
||||
editstats
|
||||
emptymailtarget
|
||||
eventbuff
|
||||
eventbuffarea
|
||||
eventbufftarget
|
||||
eventclearstates
|
||||
eventdamage
|
||||
eventmovetome
|
||||
eventstorepet
|
||||
eventtefarea
|
||||
eventtefclear
|
||||
eventteftarget
|
||||
eventundomovetome
|
||||
eventvaderchoke
|
||||
eventweapon
|
||||
findobject
|
||||
findobjectbytemplate
|
||||
findplayer
|
||||
findcreature
|
||||
forcecommand
|
||||
freezeplayer
|
||||
generatecrafteditem
|
||||
squelch
|
||||
unsquelch
|
||||
getgametime
|
||||
getplayerid
|
||||
getrank
|
||||
getstationname
|
||||
getveteranrewardtimecs
|
||||
gmforcecommand
|
||||
gmforcerank
|
||||
gmfsvillage
|
||||
gmregrantquest
|
||||
gmshowquest
|
||||
gmweapon
|
||||
goto
|
||||
grantbadge
|
||||
grantbadgearea
|
||||
grantpadawantrialseligibility
|
||||
grantskill
|
||||
granttitle
|
||||
harmful
|
||||
harmless
|
||||
hasveteranreward
|
||||
invulnerable
|
||||
kill
|
||||
listactivequests
|
||||
listcompletedquests
|
||||
maxforcepower
|
||||
overrideactivemonths
|
||||
overridepadawantrialseligibility
|
||||
qatool
|
||||
resetjedi
|
||||
revokebadge
|
||||
revokeskill
|
||||
searchcorpse
|
||||
setbiographyadmin
|
||||
setfaction
|
||||
setfactionstanding
|
||||
setfirstname
|
||||
setgrievousauthorized
|
||||
setgodmode
|
||||
sethue
|
||||
setinstanceauthorized
|
||||
gmrevive
|
||||
setlastname
|
||||
setname
|
||||
setowner
|
||||
setplayerappearance
|
||||
setplayerstate
|
||||
setrank
|
||||
setspeed
|
||||
settef
|
||||
setveteranreward
|
||||
showfactioninformation
|
||||
snoop
|
||||
uncityban
|
||||
unfreezeplayer
|
||||
unsnoop
|
||||
wipeitems
|
||||
csstorytellerdestroynpcs
|
||||
csstorytellerdestroyprops
|
||||
csstorytellerdestroyparticles
|
||||
csstorytellerdestroyallobjects
|
||||
revertplayerappearance
|
||||
eventshuttledrop
|
||||
eventstartraid
|
||||
gmclearquest
|
||||
gmgrantquest
|
||||
gmspawnship
|
||||
initializecomponent
|
||||
killplayer
|
||||
setloginmessage
|
||||
setwardenloginmessage
|
||||
combatdatarecord
|
||||
combatdataclear
|
||||
combatdatareport
|
||||
combatdatastop
|
||||
combatmodecheck
|
||||
findwarden
|
||||
grantwarden
|
||||
revokewarden
|
||||
startrestussstagetwo
|
||||
completerestussstageone
|
||||
spewcommandqueue
|
||||
server
|
||||
getaccountinfo
|
||||
object
|
||||
giveitem
|
||||
createcreature
|
||||
createspawningelement
|
||||
@@ -0,0 +1,62 @@
|
||||
teleport
|
||||
teleportto
|
||||
teleporttarget
|
||||
invulnerable
|
||||
setspeed
|
||||
destroy
|
||||
dumptargetinfo
|
||||
dumpzoneinfo
|
||||
forcecommand
|
||||
kill
|
||||
killplayer
|
||||
setexperience
|
||||
aiignore
|
||||
clearcompletedquest
|
||||
clearstaticitem
|
||||
csdumptarget
|
||||
editstats
|
||||
emptymailtarget
|
||||
findobject
|
||||
findobjetbytemplate
|
||||
findplayer
|
||||
findcreature
|
||||
generatecrafteditem
|
||||
getgametime
|
||||
getplayerid
|
||||
getstationname
|
||||
gmforcecommand
|
||||
grantskill
|
||||
harmfull
|
||||
harmless
|
||||
goto
|
||||
gmweapon
|
||||
gmrevive
|
||||
qatool
|
||||
searchcorpse
|
||||
setfaction
|
||||
setfactionstanding
|
||||
setname
|
||||
setplayerstate
|
||||
setrank
|
||||
setgrievousauthorized
|
||||
sethue
|
||||
setinstanceauthorized
|
||||
setfirstname
|
||||
setlastname
|
||||
setplayerappearance
|
||||
setplayerstate
|
||||
settef
|
||||
showfactioninformation
|
||||
gmclearquest
|
||||
gmgrantquest
|
||||
gmspawnship
|
||||
initializecomponent
|
||||
combatdatarecord
|
||||
combatdataclear
|
||||
combatdatareport
|
||||
combatdatastop
|
||||
combatmodecheck
|
||||
spewcommandqueue
|
||||
object
|
||||
createcreature
|
||||
createspawningelement
|
||||
@@ -0,0 +1,7 @@
|
||||
invulnerable
|
||||
teleport
|
||||
teleportto
|
||||
teleporttarget
|
||||
setspeed
|
||||
gmforcecommand
|
||||
gmrevive
|
||||
BIN
Binary file not shown.
Binary file not shown.
+21
-1
@@ -1,7 +1,27 @@
|
||||
# Toggles the loading of /clientdata/snapshot.
|
||||
# 1 = Enabled, 0 = Disabled.
|
||||
LOAD.SNAPSHOT_OBJECTS=1
|
||||
|
||||
# Toggles the loading of /clientdata/buildouts.
|
||||
# 1 = Enabled, 0 = Disabled.
|
||||
LOAD.BUILDOUT_OBJECTS=0
|
||||
|
||||
# Toggles the loading of /clinetdata/buildouts for a paticular terrain.
|
||||
# Specify the terrain. This line should be commented out to be disabled.
|
||||
#LOAD.BUILDOUT_ONLY_FOR="dathomir"
|
||||
|
||||
# Toggles Loading Old/Creating new/Spawning New Resources.
|
||||
# 1 = On, 0 = Off.
|
||||
LOAD.RESOURCE.SYSTEM=1
|
||||
|
||||
# Misc
|
||||
# Toggles full wipe of Server Database (Characters, Items, etc.)
|
||||
# 1 = Enabled, 0 = Disabled.
|
||||
CLEAN.ODB.FOLDERS=0
|
||||
|
||||
# Toggles Isolation System Spawning at Tatooine 0 0 0 around no NPC's.
|
||||
# 1 = On, 0 = Off.
|
||||
DO.ISOLATION.TESTS=0
|
||||
|
||||
# Toggles GCW Invasions System.
|
||||
# 1 = On, 0 = Off.
|
||||
ENABLE.INVASIONS=0
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'expertise_critical_niche_all', 5)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'expertise_critical_niche_all', 5)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'proc_buff', 1)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'proc_buff', 1)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'expertise_dodge', 2)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'expertise_dodge', 2)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'strength_modified', 100)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'strength_modified', 100)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'constitution_modified', 100)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'constitution_modified', 100)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'precision_modified', 100)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'precision_modified', 100)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'luck_modified', 100)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'luck_modified', 100)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'agility_modified', 100)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'agility_modified', 100)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'expertise_glancing_blow_all', 100)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'expertise_glancing_blow_all', 100)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'expertise_dodge', 35)
|
||||
core.skillModService.addSkillMod(actor, 'display_only_evasion', 5000)
|
||||
core.skillModService.addSkillMod(actor, 'combat_evasion_value', 50)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'expertise_dodge', 35)
|
||||
core.skillModService.deductSkillMod(actor, 'display_only_evasion', 5000)
|
||||
core.skillModService.deductSkillMod(actor, 'combat_evasion_value', 50)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import sys
|
||||
from java.lang import Short
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
|
||||
#fatigue = actor.getGCWFatigue() + 1
|
||||
#actor.setGCWFatigue(fatigue)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
#if actor.getGCWFatigue()>0:
|
||||
#fatigue = actor.getGCWFatigue() - 1
|
||||
#actor.setGCWFatigue(fatigue)
|
||||
# Major flaw in Buff system. It does not consider infinite, stackable buffs
|
||||
# The GCW buff gets automatically removed upon each new stack
|
||||
# resulting in +1-1 Fatigue, if the fatigue gets set here.
|
||||
# Only way is to set it, is in the java methods
|
||||
# and then invent a way so that entertainer can heal this
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'expertise_dodge', 35)
|
||||
core.skillModService.addSkillMod(actor, 'display_only_evasion', 5000)
|
||||
core.skillModService.addSkillMod(actor, 'combat_evasion_value', 50)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'expertise_dodge', 35)
|
||||
core.skillModService.deductSkillMod(actor, 'display_only_evasion', 5000)
|
||||
core.skillModService.deductSkillMod(actor, 'combat_evasion_value', 50)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
core.skillModService.addSkillMod(actor, 'expertise_damage_npc', 200)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
core.skillModService.deductSkillMod(actor, 'expertise_damage_npc', -200)
|
||||
return
|
||||
|
||||
@@ -142,8 +142,9 @@ def travelHandler(owner):
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, travelHandlerCallback)
|
||||
window.addListBoxMenuItem('Tatooine, Mos Eisley', 0)
|
||||
window.addListBoxMenuItem('Dantooine, Jedi Ruins', 1)
|
||||
window.addListBoxMenuItem('Blank', 2)
|
||||
window.addListBoxMenuItem('Blank', 3)
|
||||
window.addListBoxMenuItem('Talus, Dearic Starport', 2)
|
||||
window.addListBoxMenuItem('Naboo, Keren Starport', 3)
|
||||
window.addListBoxMenuItem('Tatooine, Bestine Starport', 4)
|
||||
core.suiService.openSUIWindow(window);
|
||||
|
||||
def travelHandlerCallback(owner, window, eventType, returnList):
|
||||
@@ -158,6 +159,15 @@ def travelHandlerCallback(owner, window, eventType, returnList):
|
||||
if returnList.get(0)=='1':
|
||||
jediRuinsTravel(owner)
|
||||
return
|
||||
if returnList.get(0)=='2':
|
||||
GCWDearicTravel(owner)
|
||||
return
|
||||
if returnList.get(0)=='3':
|
||||
GCWKerenTravel(owner)
|
||||
return
|
||||
if returnList.get(0)=='4':
|
||||
GCWBestineTravel(owner)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
@@ -307,6 +317,9 @@ def miscHandler(owner):
|
||||
window.addListBoxMenuItem('Heroism Jewelry Set', 1)
|
||||
window.addListBoxMenuItem('Belt of Master Bodo Baas', 2)
|
||||
window.addListBoxMenuItem('Starter Equipment Box', 3)
|
||||
window.addListBoxMenuItem('GCW Banners', 4)
|
||||
window.addListBoxMenuItem('Bounty Droids', 5)
|
||||
|
||||
core.suiService.openSUIWindow(window);
|
||||
|
||||
def miscHandlerCallback(owner, window, eventType, returnList):
|
||||
@@ -327,6 +340,13 @@ def miscHandlerCallback(owner, window, eventType, returnList):
|
||||
if returnList.get(0)=='3':
|
||||
starterEquipmentBox(owner, inventory)
|
||||
return
|
||||
if returnList.get(0)=='4':
|
||||
GCWBanners(owner, inventory)
|
||||
return
|
||||
if returnList.get(0)=='5':
|
||||
bountyDroids(owner, inventory)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def combatLevel(owner):
|
||||
@@ -652,6 +672,21 @@ def jediRuinsTravel(owner):
|
||||
core.simulationService.transferToPlanet(owner, core.terrainService.getPlanetByName("dantooine"), position, owner.getOrientation(), None)
|
||||
return
|
||||
|
||||
def GCWDearicTravel(owner):
|
||||
position = Point3D(264, 4, -2950)
|
||||
core.simulationService.transferToPlanet(owner, core.terrainService.getPlanetByName("talus"), position, owner.getOrientation(), None)
|
||||
return
|
||||
|
||||
def GCWKerenTravel(owner):
|
||||
position = Point3D(1366, 13, 2747)
|
||||
core.simulationService.transferToPlanet(owner, core.terrainService.getPlanetByName("naboo"), position, owner.getOrientation(), None)
|
||||
return
|
||||
|
||||
def GCWBestineTravel(owner):
|
||||
position = Point3D(-1385,12, -3597)
|
||||
core.simulationService.transferToPlanet(owner, core.terrainService.getPlanetByName("tatooine"), position, owner.getOrientation(), None)
|
||||
return
|
||||
|
||||
def surveyDevices(owner, inventory):
|
||||
mineralSurveyTool = core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_mineral.iff", owner.getPlanet())
|
||||
chemicalSurveyTool = core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_inorganic.iff", owner.getPlanet())
|
||||
@@ -668,4 +703,29 @@ def surveyDevices(owner, inventory):
|
||||
inventory.add(windSurveyTool)
|
||||
inventory.add(solarSurveyTool)
|
||||
return
|
||||
|
||||
|
||||
def GCWBanners(owner, inventory):
|
||||
|
||||
gcwBanner1 = core.objectService.createObject('object/tangible/gcw/pvp_rank_rewards/shared_rebel_battle_banner.iff', owner.getPlanet())
|
||||
gcwBanner1.setStfFilename('static_item_n')
|
||||
gcwBanner1.setStfName('item_pvp_captain_battle_banner_rebel_reward_04_01')
|
||||
gcwBanner1.setDetailFilename('static_item_d')
|
||||
gcwBanner1.setDetailName('item_pvp_captain_battle_banner_rebel_reward_04_01')
|
||||
inventory.add(gcwBanner1)
|
||||
gcwBanner2 = core.objectService.createObject('object/tangible/gcw/pvp_rank_rewards/shared_imperial_battle_banner.iff', owner.getPlanet())
|
||||
gcwBanner2.setStfFilename('static_item_n')
|
||||
gcwBanner2.setStfName('item_pvp_captain_battle_banner_imperial_reward_04_01')
|
||||
gcwBanner2.setDetailFilename('static_item_d')
|
||||
gcwBanner2.setDetailName('item_pvp_captain_battle_banner_imperial_reward_04_01')
|
||||
inventory.add(gcwBanner2)
|
||||
return
|
||||
|
||||
def bountyDroids(owner, inventory):
|
||||
seekers = core.objectService.createObject('object/tangible/mission/shared_mission_bounty_droid_seeker.iff', owner.getPlanet())
|
||||
seekers.setUses(20)
|
||||
inventory.add(seekers)
|
||||
|
||||
probe = core.objectService.createObject('object/tangible/mission/shared_mission_bounty_droid_probot.iff', owner.getPlanet())
|
||||
probe.setUses(20)
|
||||
inventory.add(probe)
|
||||
return
|
||||
@@ -9,10 +9,7 @@ def run(core, actor, target, commandString):
|
||||
arg1 = commandArgs[0]
|
||||
if len(commandArgs) > 1:
|
||||
arg2 = commandArgs[1]
|
||||
|
||||
if actor.getClient() and actor.getClient().isGM() == False:
|
||||
return
|
||||
|
||||
|
||||
if not commandString.startswith('object/tangible') and not commandString.startswith('object/weapon'):
|
||||
return
|
||||
|
||||
|
||||
+17
-6
@@ -10,7 +10,7 @@ def setup():
|
||||
def run(core, actor, target, commandString):
|
||||
faction = actor.getFaction()
|
||||
factionStatus = actor.getFactionStatus()
|
||||
|
||||
|
||||
if actor.getPvpStatus(PvpStatus.GoingOvert) or actor.getPvpStatus(PvpStatus.GoingCovert):
|
||||
actor.sendSystemMessage('@faction_recruiter:pvp_status_changing', 0)
|
||||
return
|
||||
@@ -18,9 +18,10 @@ def run(core, actor, target, commandString):
|
||||
actor.sendSystemMessage('@gcw:pvp_advanced_region_cannot_go_covert', 0)
|
||||
return
|
||||
|
||||
if commandString != '' and commandString != faction:
|
||||
if commandString != '' and commandString != faction and len(faction)!=0:
|
||||
if commandString == 'rebel' or commandString == 'imperial' or commandString == 'neutral':
|
||||
if faction != 'neutral':
|
||||
|
||||
if faction != 'neutral' and len(faction)!=0:
|
||||
actor.sendSystemMessage('@faction_recruiter:sui_resig_complete_in_5', 0)
|
||||
|
||||
if actor.getFactionStatus() == FactionStatus.SpecialForces:
|
||||
@@ -37,7 +38,7 @@ def run(core, actor, target, commandString):
|
||||
|
||||
if commandString == 'neutral' or commandString == 'resign':
|
||||
time.sleep(1)
|
||||
actor.setFaction('')
|
||||
actor.setFaction('') # ???
|
||||
actor.sendSystemMessage('@faction_recruiter:resign_complete', 0)
|
||||
return
|
||||
|
||||
@@ -45,6 +46,15 @@ def run(core, actor, target, commandString):
|
||||
actor.setFaction(commandString)
|
||||
return
|
||||
|
||||
#This can be removed if player is required to see the recruiter first
|
||||
if faction == '':
|
||||
actor.setFactionStatus(FactionStatus.Combatant) # Must be! otherwise updatePVPstatus will be called with onLeave!
|
||||
actor.setFaction(commandString)
|
||||
player = actor.getSlottedObject("ghost")
|
||||
if player.getCurrentRank()==0:
|
||||
player.setCurrentRank(1);
|
||||
faction = commandString
|
||||
|
||||
if faction == 'neutral' or faction == '':
|
||||
actor.sendSystemMessage('@faction_recruiter:not_aligned', 0)
|
||||
return
|
||||
@@ -53,10 +63,11 @@ def run(core, actor, target, commandString):
|
||||
actor.sendSystemMessage('@faction_recruiter:on_leave_to_covert', 0)
|
||||
actor.setPvpStatus(PvpStatus.GoingCovert, True)
|
||||
time.sleep(1)
|
||||
actor.setFactionStatus(FactionStatus.Combatant)
|
||||
actor.setPvpStatus(PvpStatus.GoingCovert, False)
|
||||
actor.setFactionStatus(FactionStatus.Combatant)
|
||||
actor.sendSystemMessage('@faction_recruiter:covert_complete', 0)
|
||||
actor.updatePvpStatus()
|
||||
core.factionService.updatePVPFromNearbyNPCs(actor, actor.getClient())
|
||||
return
|
||||
|
||||
if factionStatus == FactionStatus.Combatant:
|
||||
@@ -65,8 +76,8 @@ def run(core, actor, target, commandString):
|
||||
time.sleep(30)
|
||||
if core.gcwService.isInPvpZone(actor):
|
||||
return
|
||||
actor.setFactionStatus(FactionStatus.SpecialForces)
|
||||
actor.setPvpStatus(PvpStatus.GoingOvert, False)
|
||||
actor.setFactionStatus(FactionStatus.SpecialForces)
|
||||
actor.sendSystemMessage('@faction_recruiter:overt_complete', 0)
|
||||
actor.updatePvpStatus()
|
||||
return
|
||||
|
||||
@@ -2,6 +2,7 @@ import sys
|
||||
from engine.resources.scene import Point3D
|
||||
from protocol.swg import ObjControllerMessage
|
||||
from protocol.swg import UnknownAbilityPacket
|
||||
from protocol.swg import PlayClientEffectLocMessage
|
||||
from engine.resources.objects import SWGObject
|
||||
from java.awt.datatransfer import StringSelection
|
||||
from java.awt.datatransfer import Clipboard
|
||||
@@ -35,16 +36,6 @@ def run(core, actor, target, commandString):
|
||||
if len(commandArgs) > 5:
|
||||
arg5 = commandArgs[5]
|
||||
|
||||
if not command:
|
||||
return
|
||||
|
||||
if actor.getClient().isGM() is False:
|
||||
return
|
||||
|
||||
if playerObject.getGodLevel() == 0:
|
||||
actor.addAbility("admin")
|
||||
playerObject.setGodLevel(50)
|
||||
|
||||
if command == 'giveExperience' and arg1:
|
||||
core.playerService.giveExperience(actor, int(arg1))
|
||||
|
||||
@@ -191,6 +182,85 @@ def run(core, actor, target, commandString):
|
||||
actor.setPosture(0)
|
||||
actor.setSpeedMultiplierBase(1)
|
||||
actor.setTurnRadius(1)
|
||||
|
||||
elif command == 'checkai':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
actor.sendSystemMessage('Checking AI handling for unit ' + latarget.getCustomName(), 0)
|
||||
core.aiService.setCheckAI(latarget)
|
||||
|
||||
elif command == 'checkaitarget':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
if latarget.getAttachment('AI'):
|
||||
if latarget.getAttachment('AI').getFollowObject():
|
||||
actor.sendSystemMessage('Checking AI target ' + latarget.getAttachment('AI').getFollowObject().getTemplate(), 0)
|
||||
|
||||
elif command == 'checkaistate':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
if latarget.getAttachment('AI'):
|
||||
if latarget.getAttachment('AI').getCurrentState():
|
||||
actor.sendSystemMessage('Checking AI state ' + latarget.getAttachment('AI').getCurrentState().getClass().getName(), 0)
|
||||
|
||||
elif command == 'checkairepos':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
if latarget.getAttachment('AI'):
|
||||
if latarget.getAttachment('AI').getRepositionStartTime()():
|
||||
actor.sendSystemMessage('Checking AI state ' + latarget.getAttachment('AI').getRepositionStartTime(), 0)
|
||||
|
||||
elif command == 'checkaiprog':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
if latarget.getAttachment('AI'):
|
||||
actor.sendSystemMessage('Checking AI progression %s' % latarget.getAttachment('AI').getProgressionMarker(), 0)
|
||||
|
||||
elif command == 'checkwithdrawn':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
if latarget.getAttachment('isWithdrawn'):
|
||||
actor.sendSystemMessage('Checking AIisWithdrawn %s' % latarget.getAttachment('isWithdrawn'), 0)
|
||||
|
||||
elif command == 'showbitmask':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
actor.sendSystemMessage('Optionsbitmask for unit ' + latarget.getCustomName() + ' is %s' % latarget.getOptionsBitmask(), 0)
|
||||
|
||||
elif command == 'spawninst':
|
||||
|
||||
#String campTemplate = "object/building/poi/shared_gcw_rebel_clone_tent_small.iff"; // LOL why doesn't this spawn?!?!?!
|
||||
inst = core.objectService.createObject(arg1, 0, actor.getPlanet(), actor.getWorldPosition(), actor.getOrientation())
|
||||
if inst:
|
||||
#TangibleObject inst = (TangibleObject) core.objectService.createObject(campTemplate, 0, core.terrainService.getPlanetByName("talus"), new Point3D(-890,9, -2994), quaternion)
|
||||
core.simulationService.add(inst, inst.getPosition().x, inst.getPosition().z, True)
|
||||
positionY = core.terrainService.getHeight(inst.getPlanetId(), inst.getPosition().x, inst.getPosition().z)
|
||||
instpos = Point3D(inst.getPosition().x,positionY+2, inst.getPosition().z)
|
||||
inst.setPosition(instpos)
|
||||
|
||||
elif command == 'los':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
los = core.simulationService.checkLineOfSight(actor, latarget)
|
||||
if los:
|
||||
actor.sendSystemMessage('Line of sight between player and target', 0)
|
||||
else:
|
||||
actor.sendSystemMessage('NO Line of sight between player and target', 0)
|
||||
|
||||
elif command == 'playfx':
|
||||
effectFile = arg1
|
||||
cEffMsg = PlayClientEffectLocMessage(effectFile, actor.getPlanet().getName(), actor.getPosition())
|
||||
actor.getClient().getSession().write(cEffMsg.serialize())
|
||||
|
||||
elif command == 'toinvasion':
|
||||
invasionplanet = core.invasionService.getInvasionPlanetName()
|
||||
position = Point3D(float(1366), float(13), float(2747))
|
||||
if invasionplanet == 'talus':
|
||||
position = Point3D(float(264), float(4), float(-2950))
|
||||
if invasionplanet == 'tatooine':
|
||||
position = Point3D(float(-1385), float(12), float(-3597))
|
||||
|
||||
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(invasionplanet), position, actor.getOrientation(), None)
|
||||
|
||||
elif command == 'unknownAbilityPacket' and arg1:
|
||||
packet = UnknownAbilityPacket(arg1)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import sys
|
||||
|
||||
def isAlly(ally):
|
||||
if ally == 'imperial':
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def isEnemy(enemy):
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import sys
|
||||
|
||||
def isAlly(ally):
|
||||
if ally == 'rebel':
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def isEnemy(enemy):
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('crackdown_stormtrooper_hard')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_black_white.iff')
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_white_black.iff')
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_white_white.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e11.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('elite_imperial_stormtrooper_90', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,43 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('fbase_imperial_colonel_extreme')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(False)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
|
||||
mobileTemplate.setNoAI(True)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_imperial_colonel_m.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e11.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_defensive_quest_officer', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,42 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('at_at')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.BOSS)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_atat.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_at_at', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,44 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('eow_gcw_city_at_st_2')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.ATTACKABLE)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_atst.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector() # object/weapon/ranged/turret/shared_turret_heat.iff object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff', WeaponType.CARBINE, 2.0, 55, 'energy')
|
||||
#weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_t21.iff', WeaponType.RIFLE, 1.0, 24, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('gcw_atst_attack_tower') #gcw_atst_attack_tower #rangedShot
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_at_st', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,44 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('gcw_city_imperial_captain')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.NORMAL)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(False)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
|
||||
mobileTemplate.setNoAI(True)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_imperial_captain_m.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e11.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_captain', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,45 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCustomName('A demoralized imperial soldier')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_black_white.iff')
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_white_black.iff')
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_white_white.iff')
|
||||
templates.add('object/mobile/shared_dark_trooper.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e11.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_demoralized_soldier', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,45 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCustomName('A disabled AT-ST')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.ATTACKABLE)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_atst.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector() # object/weapon/ranged/turret/shared_turret_heat.iff object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff', WeaponType.CARBINE, 2.0, 55, 'energy')
|
||||
#weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_t21.iff', WeaponType.RIFLE, 1.0, 24, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('gcw_atst_attack_tower') #gcw_atst_attack_tower #rangedShot
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_disabled_atst', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,45 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('gcw_city_imperial_general')
|
||||
mobileTemplate.setLevel(110)
|
||||
mobileTemplate.setHealth(1000000)
|
||||
mobileTemplate.setDifficulty(Difficulty.BOSS)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.INVULNERABLE)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_imperial_general_m.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e11.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_general', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,44 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('crackdown_stormtrooper_hard')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_black_white.iff')
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_white_black.iff')
|
||||
templates.add('object/mobile/shared_dressed_stormtrooper_white_white.iff')
|
||||
templates.add('object/mobile/shared_dark_trooper.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e11.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_soldier_cl90', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,45 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('gcw_city_offensive_imperial_general')
|
||||
mobileTemplate.setLevel(110)
|
||||
mobileTemplate.setHealth(1000000)
|
||||
mobileTemplate.setDifficulty(Difficulty.BOSS)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("imperial")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("imperial")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_imperial_general_m.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e11.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_offensive_invasion_general', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,45 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('cheerleader_rebel_commando_hard')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(True)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_human_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_human_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_moncal_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_rodian_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_twilek_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_zabrak_female_01.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e5.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('gcw_city_rebel_soldier', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,46 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('crackdown_rebel_colonel')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
|
||||
mobileTemplate.setNoAI(True)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_rebel_lieutenant_colonel_human_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_lieutenant_colonel_human_male_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_lieutenant_colonel_moncal_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_lieutenant_colonel_rodian_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_lieutenant_colonel_rodian_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_lieutenant_colonel_zabrak_male_01.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e5.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_defensive_quest_officer', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,43 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('eow_gcw_city_at_xt_2')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.ATTACKABLE)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_atxt.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('gcw_atst_attack_tower')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_at_xt', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,46 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('gcw_city_rebel_captain')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
|
||||
mobileTemplate.setNoAI(True)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_rebel_army_captain_bothan_male.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_army_captain_human_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_army_captain_moncal_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_army_captain_trandoshan_female.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_army_captain_twk_male.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_army_captain_zabrak_female.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e5.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_captain', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,46 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('A demoralized rebel soldier')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(True)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_human_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_human_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_moncal_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_rodian_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_twilek_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_commando_zabrak_female_01.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e5.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_demoralized_soldier', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,44 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCustomName('A disabled AT-XT')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.ATTACKABLE)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_atxt.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('gcw_atst_attack_tower')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_disabled_atxt', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,48 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('gcw_city_rebel_general')
|
||||
mobileTemplate.setLevel(110)
|
||||
mobileTemplate.setHealth(1000000)
|
||||
mobileTemplate.setDifficulty(Difficulty.BOSS)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.INVULNERABLE)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_human_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_human_female_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_moncal_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_old_twilek_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_rieekan_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_rodian_female_01.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e5.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_general', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,42 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('rebel_battle_droid')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.BOSS)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_hailfire_droid.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/droid/shared_droid_rocket_launcher.iff', WeaponType.RIFLE, 1.0, 55, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('gcw_rocket_launch') #fireRocketLauncher #gcw_atst_attack_tower
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_hailfire_droid', mobileTemplate)
|
||||
return
|
||||
@@ -0,0 +1,48 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import FactionStatus
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('gcw_city_offensive_rebel_general')
|
||||
mobileTemplate.setLevel(110)
|
||||
mobileTemplate.setHealth(1000000)
|
||||
mobileTemplate.setDifficulty(Difficulty.BOSS)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setSocialGroup("rebel")
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_human_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_human_female_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_moncal_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_old_twilek_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_rieekan_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_rebel_general_rodian_female_01.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_e5.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_offensive_invasion_general', mobileTemplate)
|
||||
return
|
||||
@@ -19,6 +19,7 @@ def addTemplate(core):
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(True)
|
||||
mobileTemplate.setOptionsBitmask(Options.ATTACKABLE)
|
||||
mobileTemplate.setRespawnTime(5)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_eisley_officer_aqualish_female_01.iff')
|
||||
|
||||
@@ -19,6 +19,7 @@ def addTemplate(core):
|
||||
mobileTemplate.setAssistRange(0)
|
||||
mobileTemplate.setStalker(True)
|
||||
mobileTemplate.setOptionsBitmask(Options.ATTACKABLE)
|
||||
mobileTemplate.setRespawnTime(5)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_eisley_officer_bothan_female_01.iff')
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.useTurret(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.useTurret(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.useTurret(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.usePylon(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.useBarricade(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.useTower(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.useBarricade(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.useTower(owner, target);
|
||||
return
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'item/gcwbanner')
|
||||
return
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'item/gcwbanner')
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.supplyTerminalSUI(owner, 0);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.supplyOffensiveTerminalSUI(owner, 0);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.supplyTerminalSUI(owner, 0);
|
||||
return
|
||||
@@ -1,4 +1,7 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'object/usable')
|
||||
return
|
||||
|
||||
def use(core, owner, target):
|
||||
core.invasionService.supplyOffensiveTerminalSUI(owner, 0);
|
||||
return
|
||||
@@ -0,0 +1,49 @@
|
||||
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, target, option):
|
||||
if option == 21 and target:
|
||||
handleBanner(core, owner, target, option)
|
||||
if option == 15 and target:
|
||||
core.objectService.destroyObject(target)
|
||||
return
|
||||
|
||||
def handleBanner(core, owner, bannerinventoryobject, option):
|
||||
|
||||
# check if faction alignment matches
|
||||
if len(owner.getFaction()) == 0:
|
||||
owner.sendSystemMessage('You are not aligned appropriately to use this banner' , 0)
|
||||
return
|
||||
if bannerinventoryobject.getTemplate().find(owner.getFaction()) == -1:
|
||||
owner.sendSystemMessage('You are not aligned appropriately to use this banner' , 0)
|
||||
return
|
||||
|
||||
# check if banner object is not already spawned
|
||||
#if bannerinventoryobject.getAttachment('BannerSpawned'):
|
||||
#owner.sendSystemMessage('Banner already spawned' , 0)
|
||||
#return
|
||||
|
||||
# spawn banner object
|
||||
stcSvc = core.staticService
|
||||
banner = stcSvc.spawnObject(bannerinventoryobject.getTemplate(), owner.getPlanet().getName(), long(0), owner.getWorldPosition().x + 1, owner.getWorldPosition().y, owner.getWorldPosition().z, owner.getOrientation().w, owner.getOrientation().x, owner.getOrientation().y, owner.getOrientation().z)
|
||||
if len(bannerinventoryobject.getStfFilename())>0:
|
||||
banner.setStfFilename(bannerinventoryobject.getStfFilename())
|
||||
if len(bannerinventoryobject.getStfName())>0:
|
||||
banner.setStfName(bannerinventoryobject.getStfName())
|
||||
if len(bannerinventoryobject.getDetailFilename())>0:
|
||||
banner.setDetailFilename(bannerinventoryobject.getDetailFilename())
|
||||
if len(bannerinventoryobject.getDetailName())>0:
|
||||
#banner.setDetailDescription(bannerinventoryobject.getBaseline(6).get("detailedDescription").getString())
|
||||
banner.setDetailName(bannerinventoryobject.getDetailName())
|
||||
bannerinventoryobject.setAttachment('BannerSpawned', True)
|
||||
|
||||
# start buffing process
|
||||
core.buffService.initiateBannerBuffProcess(owner, banner)
|
||||
|
||||
return
|
||||
@@ -34,7 +34,7 @@ def createRadial(core, owner, target, radials):
|
||||
if owner.getPlayerObject().getCitizenship() != 3 and core.playerCityService.getPlayerCity(owner) == city:
|
||||
radials.add(RadialOptions(2, 230, 0, '@city/city:revoke_citizenship'))
|
||||
|
||||
if owner.getClient().isGM():
|
||||
if core.adminService.getAccessLevelFromDB(actor.getClient().getAccountId()) is not None:
|
||||
radials.add(RadialOptions(2, 231, 0, 'Add 10 citizens'))
|
||||
radials.add(RadialOptions(2, 232, 0, 'Deduct 10 citizens'))
|
||||
|
||||
|
||||
+31
-12
@@ -65,6 +65,7 @@ import services.ConversationService;
|
||||
import services.EntertainmentService;
|
||||
import services.GroupService;
|
||||
import services.housing.HousingService;
|
||||
import services.AdminService;
|
||||
import services.BrowserService;
|
||||
import services.InstanceService;
|
||||
import services.LoginService;
|
||||
@@ -91,6 +92,7 @@ import services.command.CommandService;
|
||||
import services.equipment.EquipmentService;
|
||||
import services.gcw.FactionService;
|
||||
import services.gcw.GCWService;
|
||||
import services.gcw.InvasionService;
|
||||
import services.GuildService;
|
||||
import services.LoginService;
|
||||
import services.map.MapService;
|
||||
@@ -153,9 +155,11 @@ public class NGECore {
|
||||
private static NGECore instance;
|
||||
|
||||
private Config config = null;
|
||||
private Config options = null;
|
||||
private String motd = "";
|
||||
private volatile boolean isShuttingDown = false;
|
||||
private long galacticTime = System.currentTimeMillis();
|
||||
private int galaxyStatus = -1;
|
||||
|
||||
private ConcurrentHashMap<IoSession, Client> clients = new ConcurrentHashMap<IoSession, Client>();
|
||||
|
||||
@@ -212,6 +216,8 @@ public class NGECore {
|
||||
public PetService petService;
|
||||
public BrowserService browserService;
|
||||
//public BattlefieldService battlefieldService;
|
||||
public InvasionService invasionService;
|
||||
public AdminService adminService;
|
||||
|
||||
// Login Server
|
||||
public NetworkDispatch loginDispatch;
|
||||
@@ -269,11 +275,15 @@ public class NGECore {
|
||||
config = DefaultConfig.getConfig();
|
||||
}
|
||||
|
||||
Config options = new Config();
|
||||
options = new Config();
|
||||
options.setFilePath("options.cfg");
|
||||
boolean optionsConfigLoaded = options.loadConfigFile();
|
||||
|
||||
if (optionsConfigLoaded && options.getInt("CLEAN.ODB.FOLDERS") > 0 || getExcludedDevelopers().contains(System.getProperty("user.name"))){
|
||||
if (!(options.loadConfigFile())) {
|
||||
System.err.println("Failed to load options.cfg!");
|
||||
options = DefaultConfig.getConfig();
|
||||
}
|
||||
|
||||
//if (optionsConfigLoaded && options.getInt("CLEAN.ODB.FOLDERS") > 0 || getExcludedDevelopers().contains(System.getProperty("user.name"))){
|
||||
if (options.getInt("CLEAN.ODB.FOLDERS") > 0){
|
||||
File baseFolder = new File("./odb");
|
||||
|
||||
if (baseFolder.isDirectory()) {
|
||||
@@ -354,7 +364,7 @@ public class NGECore {
|
||||
reverseEngineeringService = new ReverseEngineeringService(this);
|
||||
petService = new PetService(this);
|
||||
|
||||
if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) {
|
||||
if (options.getInt("LOAD.RESOURCE.SYSTEM") == 1) {
|
||||
surveyService = new SurveyService(this);
|
||||
resourceService = new ResourceService(this);
|
||||
}
|
||||
@@ -373,6 +383,7 @@ public class NGECore {
|
||||
spawnService = new SpawnService(this);
|
||||
aiService = new AIService(this);
|
||||
missionService = new MissionService(this);
|
||||
invasionService = new InvasionService(this);
|
||||
|
||||
// Ping Server
|
||||
|
||||
@@ -427,8 +438,9 @@ public class NGECore {
|
||||
zoneDispatch.addService(staticService);
|
||||
zoneDispatch.addService(reverseEngineeringService);
|
||||
zoneDispatch.addService(petService);
|
||||
zoneDispatch.addService(invasionService);
|
||||
|
||||
if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) {
|
||||
if (options.getInt("LOAD.RESOURCE.SYSTEM") == 1) {
|
||||
zoneDispatch.addService(surveyService);
|
||||
zoneDispatch.addService(resourceService);
|
||||
}
|
||||
@@ -493,13 +505,10 @@ public class NGECore {
|
||||
terrainService.addPlanet(43, "space_tatooine", "terrain/space_tatooine.trn", true);
|
||||
terrainService.addPlanet(44, "space_tatooine_2", "terrain/space_tatooine_2.trn", true);
|
||||
terrainService.addPlanet(45, "space_yavin4", "terrain/space_yavin4.trn", true);*/
|
||||
//PSWG New Content Terrains (WARNING Keep commented out unless you have the current build of kaas!)
|
||||
|
||||
//terrainService.addPlanet(46, "kaas", "terrain/kaas.trn", true);
|
||||
|
||||
|
||||
//end terrainList
|
||||
|
||||
if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") > 0) {
|
||||
if (options.getInt("LOAD.RESOURCE.SYSTEM") > 0) {
|
||||
resourceService.loadResources();
|
||||
}
|
||||
|
||||
@@ -557,6 +566,7 @@ public class NGECore {
|
||||
|
||||
browserService = new BrowserService(this);
|
||||
//battlefieldService = new BattlefieldService(this);
|
||||
adminService = new AdminService(this);
|
||||
|
||||
DevLogQueuer devLogQueuer = new DevLogQueuer();
|
||||
|
||||
@@ -644,6 +654,7 @@ public class NGECore {
|
||||
|
||||
public void setGalaxyStatus(int statusId) {
|
||||
|
||||
galaxyStatus = statusId;
|
||||
int galaxyId = config.getInt("GALAXY_ID");
|
||||
|
||||
try {
|
||||
@@ -657,6 +668,10 @@ public class NGECore {
|
||||
|
||||
}
|
||||
|
||||
public int getGalaxyStatus() {
|
||||
return galaxyStatus;
|
||||
}
|
||||
|
||||
/*
|
||||
* ---------- Getter methods for NGECore ----------
|
||||
*/
|
||||
@@ -852,10 +867,14 @@ public class NGECore {
|
||||
|
||||
public Vector<String> getExcludedDevelopers(){
|
||||
Vector<String> excludedDevelopers = new Vector<String>();
|
||||
excludedDevelopers.add("Charon");
|
||||
//excludedDevelopers.add("Charon");
|
||||
// Feel free to add your OS user account name here to exclude yourself from loading buildouts and snapshots
|
||||
// without having to change options.cfg all the time
|
||||
return excludedDevelopers;
|
||||
}
|
||||
|
||||
public Config getOptions() {
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,13 @@
|
||||
package protocol.swg;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.clients.Client;
|
||||
@@ -50,8 +55,8 @@ public class LoginClusterStatus extends SWGMessage {
|
||||
}
|
||||
public void addServer(int galaxyID, String serverIP, int serverPort, int pingPort, int maxCharacters, int status, int recommended, int population, Client client) {
|
||||
IoBuffer result = IoBuffer.allocate(39 + serverIP.length()).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
int populationStatus = 0;
|
||||
|
||||
result.putInt(galaxyID);
|
||||
result.put(getAsciiString(serverIP));
|
||||
result.putShort((short)serverPort);
|
||||
@@ -66,11 +71,10 @@ public class LoginClusterStatus extends SWGMessage {
|
||||
populationStatus = 6;
|
||||
status = 3;
|
||||
}
|
||||
if(status == 3 && client.isGM())
|
||||
if(status == 3 && !(NGECore.getInstance().adminService.getAccessLevelFromDB(client.getAccountId()) == null) ) // Ziggy - admins can enter Locked galaxies
|
||||
status = 2;
|
||||
result.putInt(populationStatus); // 0 = very light, 1 = light, 2 = medium , 3 = heavy, 4 = very heavy, 5 = extremely heavy, 6 = full
|
||||
result.putInt(maxCharacters);
|
||||
//result.putInt(0xFFFF8F80); // Distance?
|
||||
result.putInt(timeZone.getRawOffset() / 3600000);
|
||||
result.putInt(status);
|
||||
result.put((byte)recommended);
|
||||
|
||||
@@ -78,6 +78,7 @@ public class ObjControllerMessage extends SWGMessage {
|
||||
public static final int RESOURCE_WEIGHTS = 0x0207;
|
||||
public static final int MISSION_ACCEPT_RESPONSE = 0x00FA;
|
||||
public static final int MISSION_ABORT_RESPONSE = 0x0142;
|
||||
public static final int QUEST_TASK_TIMER_MESSAGE = 0x0441;
|
||||
|
||||
public ObjControllerMessage() {
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package protocol.swg;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class SUICreateTimerBar extends SWGMessage{
|
||||
|
||||
private String script;
|
||||
private int windowId;
|
||||
private int startCount;
|
||||
private int digitCount;
|
||||
private List<Integer> digits = new ArrayList<Integer>();
|
||||
String prompt;
|
||||
|
||||
public SUICreateTimerBar(String script, int windowId, String prompt, int startCount) {
|
||||
|
||||
this.script = script;
|
||||
this.windowId = windowId;
|
||||
this.startCount = startCount;
|
||||
this.prompt = prompt;
|
||||
|
||||
digitCount = 3;
|
||||
if (startCount>9)
|
||||
digitCount = 4;
|
||||
|
||||
while (startCount > 0) {
|
||||
int d = startCount / 10;
|
||||
int k = startCount - d * 10;
|
||||
startCount = d;
|
||||
digits.add((int)(Integer.toString(k).charAt(0)));
|
||||
//System.out.println("digit: "+Integer.toHexString((int)(Integer.toString(k).charAt(0))));
|
||||
}
|
||||
// digits.add(0x39);
|
||||
// digits.add(0x31);
|
||||
}
|
||||
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer serialize() {
|
||||
|
||||
IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
|
||||
result.setAutoExpand(true);
|
||||
|
||||
result.putShort((short) 2);
|
||||
result.putInt(0xD44B7259);
|
||||
|
||||
result.putInt(windowId);
|
||||
result.put(getAsciiString(script));
|
||||
result.putInt(5);
|
||||
result.putInt(5);
|
||||
result.put((byte)0);
|
||||
result.putInt(3);
|
||||
result.putShort((short)0);
|
||||
result.putShort((short)1);
|
||||
result.put((byte)9);
|
||||
|
||||
result.put(getAsciiString("modifySlot"));
|
||||
result.putInt(5);
|
||||
result.put((byte)0);
|
||||
result.putInt(3);
|
||||
result.putShort((short)0);
|
||||
result.putShort((short)1);
|
||||
result.put((byte)0xA);
|
||||
result.put(getAsciiString("modifySlot"));
|
||||
result.put((byte)3);
|
||||
result.putInt(1);
|
||||
|
||||
result.put(getUnicodeString(prompt));
|
||||
|
||||
result.putInt(2);
|
||||
|
||||
result.put(getAsciiString("comp.text"));
|
||||
result.put(getAsciiString("Text"));
|
||||
|
||||
result.put((byte)3);
|
||||
result.putInt(1);
|
||||
|
||||
result.put(getUnicodeString("quest_countdown_timer"));
|
||||
|
||||
result.putInt(2);
|
||||
|
||||
result.put(getAsciiString("bg.caption.lblTitle"));
|
||||
result.put(getAsciiString("Text"));
|
||||
|
||||
|
||||
result.put((byte)3);
|
||||
result.putInt(1);
|
||||
result.putInt(digitCount);
|
||||
|
||||
result.putShort((short)0x30);
|
||||
result.putShort((short)0x2C);
|
||||
for (int i=digits.size()-1;i>=0;i--)
|
||||
result.putShort((short)((int)digits.get(i)));
|
||||
|
||||
result.putInt(2);
|
||||
result.put(getAsciiString("this"));
|
||||
result.put(getAsciiString("countdownTimerTimeValue"));
|
||||
|
||||
result.putLong(0);
|
||||
result.putInt(0x7F7FFFFF);
|
||||
result.putInt(0x7F7FFFFF);
|
||||
result.putInt(0x7F7FFFFF);
|
||||
result.putInt(0);
|
||||
|
||||
int size = result.position();
|
||||
result = IoBuffer.allocate(size).put(result.array(), 0, size);
|
||||
|
||||
return result.flip();
|
||||
}
|
||||
}
|
||||
@@ -21,15 +21,14 @@
|
||||
******************************************************************************/
|
||||
package protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.BufferUnderflowException;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
|
||||
public class DataTransform extends ObjControllerObject {
|
||||
@@ -93,21 +92,23 @@ public class DataTransform extends ObjControllerObject {
|
||||
}
|
||||
|
||||
public void deserialize(IoBuffer buffer) {
|
||||
objectId = buffer.getLong();
|
||||
buffer.getInt();
|
||||
|
||||
movementStamp = buffer.getInt();
|
||||
movementIndex = buffer.getInt();
|
||||
|
||||
xOrientation = buffer.getFloat();
|
||||
yOrientation = buffer.getFloat();
|
||||
zOrientation = buffer.getFloat();
|
||||
wOrientation = buffer.getFloat();
|
||||
|
||||
xPosition = buffer.getFloat();
|
||||
yPosition = buffer.getFloat();
|
||||
zPosition = buffer.getFloat();
|
||||
speed = buffer.getFloat();
|
||||
try{
|
||||
objectId = buffer.getLong();
|
||||
buffer.getInt();
|
||||
|
||||
movementStamp = buffer.getInt();
|
||||
movementIndex = buffer.getInt();
|
||||
|
||||
xOrientation = buffer.getFloat();
|
||||
yOrientation = buffer.getFloat();
|
||||
zOrientation = buffer.getFloat();
|
||||
wOrientation = buffer.getFloat();
|
||||
|
||||
xPosition = buffer.getFloat();
|
||||
yPosition = buffer.getFloat();
|
||||
zPosition = buffer.getFloat();
|
||||
speed = buffer.getFloat();
|
||||
} catch (BufferUnderflowException ex){System.err.println("BufferUnderflowException during Datatransform deserialization");}
|
||||
}
|
||||
|
||||
public IoBuffer serialize() {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import resources.datatables.HitType;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ObjController_0250 extends ObjControllerObject{
|
||||
|
||||
private long creatureId;
|
||||
|
||||
public ObjController_0250(long creatureId) {
|
||||
this.creatureId = creatureId;
|
||||
}
|
||||
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer serialize() {
|
||||
|
||||
IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
|
||||
result.setAutoExpand(true);
|
||||
result.putInt((int)(System.currentTimeMillis()/1000));
|
||||
int packetSize = result.position();
|
||||
result = IoBuffer.allocate(packetSize).put(result.array(), 0, packetSize);
|
||||
|
||||
return result.flip();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class QuestTaskTimerMessage extends ObjControllerObject {
|
||||
|
||||
private long objectId;
|
||||
private String questName;
|
||||
|
||||
public QuestTaskTimerMessage(long objectId, String questName) {
|
||||
this.objectId = objectId;
|
||||
this.questName = questName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(16).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putInt(ObjControllerMessage.QUEST_TASK_TIMER_MESSAGE);
|
||||
buffer.putLong(objectId);
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString("quest/ep3_trando_hssissk_zssik_10"));
|
||||
buffer.putInt(1);
|
||||
buffer.put(getUnicodeString("quest/groundquests:destroy_counter"));
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(1);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
|
||||
|
||||
return buffer.flip();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class Forager {
|
||||
}
|
||||
|
||||
// chosenObject = 5; // To test TMs
|
||||
if(forager.getClient().isGM()) // Always yield a TM for testing
|
||||
if(!(NGECore.getInstance().adminService.getAccessLevelFromDB(forager.getClient().getAccountId()) == null)) // Always yield a TM for testing
|
||||
chosenObject = 5;
|
||||
|
||||
//forager.sendSystemMessage("chosenObject " + chosenObject,(byte) 0);
|
||||
|
||||
@@ -304,12 +304,12 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
|
||||
WaypointObject missionWp = mission.getWaypoint();
|
||||
|
||||
if (missionWp == null || missionWp.getPlanetCRC() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
if (missionWp == null || missionWp.getPlanetCrc() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
WaypointObject waypoint = (WaypointObject) getMissionObject().getWaypoint();
|
||||
waypoint.setActive(true);
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setName(getMissionObject().getTargetName());
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setStringAttribute("", "");
|
||||
waypoint.setPosition(target.getWorldPosition());
|
||||
mission.setWaypoint(waypoint);
|
||||
@@ -352,12 +352,12 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
|
||||
WaypointObject missionWp = mission.getWaypoint();
|
||||
|
||||
if (missionWp == null || missionWp.getPlanetCRC() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
if (missionWp == null || missionWp.getPlanetCrc() != CRC.StringtoCRC(target.getPlanet().name)) {
|
||||
WaypointObject waypoint = (WaypointObject) getMissionObject().getWaypoint();
|
||||
waypoint.setActive(true);
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setName(getMissionObject().getTargetName());
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setStringAttribute("", "");
|
||||
waypoint.setPosition(target.getWorldPosition());
|
||||
mission.setWaypoint(waypoint);
|
||||
@@ -388,7 +388,7 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
waypoint.setActive(true);
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setName(getMissionObject().getTargetName());
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(target.getPlanet().getName()));
|
||||
waypoint.setStringAttribute("", "");
|
||||
getMissionObject().setWaypoint(waypoint);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
|
||||
if (getObjectivePhase() == 0) {
|
||||
WaypointObject waypoint = getMissionObject().getWaypoint();
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPosition(parent.getStartLocation().getLocation());
|
||||
waypoint.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
@@ -63,7 +63,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
|
||||
} else if (getObjectivePhase() == 1) {
|
||||
WaypointObject waypoint = getMissionObject().getWaypoint();
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPosition(parent.getDestinationLocation().getLocation());
|
||||
waypoint.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
@@ -103,7 +103,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
waypoint.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
waypoint.setColor(WaypointObject.ORANGE);
|
||||
waypoint.setActive(true);
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
waypoint.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
getMissionObject().setTargetName("Dropoff Location");
|
||||
getMissionObject().setWaypoint(waypoint);
|
||||
break;
|
||||
@@ -113,7 +113,7 @@ public class DeliveryMissionObjective extends MissionObjective {
|
||||
returnWp.setName("@" + parent.getTitle().getStfFilename() + ":" + "m" + parent.getMissionId() + "t");
|
||||
returnWp.setColor(WaypointObject.ORANGE);
|
||||
returnWp.setActive(true);
|
||||
returnWp.setPlanetCRC(CRC.StringtoCRC(player.getPlanet().name));
|
||||
returnWp.setPlanetCrc(CRC.StringtoCRC(player.getPlanet().name));
|
||||
getMissionObject().setTargetName("Return");
|
||||
getMissionObject().setWaypoint(returnWp);
|
||||
break;
|
||||
|
||||
@@ -403,7 +403,7 @@ public class BuildingObject extends TangibleObject implements IPersistent, Seria
|
||||
}
|
||||
|
||||
public boolean canEnter(SWGObject object) {
|
||||
return (getPrivacy() == PRIVATE && (entryList.contains(object.getObjectID()) || adminList.contains(object.getObjectID()))) || !banList.contains(object.getObjectID()) || object.getClient().isGM();
|
||||
return (getPrivacy() == PRIVATE && (entryList.contains(object.getObjectID()) || adminList.contains(object.getObjectID()))) || !banList.contains(object.getObjectID()) || !(NGECore.getInstance().adminService.getAccessLevelFromDB(client.getAccountId()) == null);
|
||||
}
|
||||
|
||||
public void updateCellPermissions(SWGObject obj) {
|
||||
|
||||
@@ -307,7 +307,7 @@ public class CreatureMessageBuilder extends TangibleMessageBuilder {
|
||||
SWGObject obj = NGECore.getInstance().objectService.getObject(objId);
|
||||
|
||||
if(obj == null) {
|
||||
System.err.println("Cant find obj for obj id in equip list!!!");
|
||||
System.err.println("Cant find obj for obj id in equip list!!! (Normal Message for AI wipes)");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ public class CreatureMessageBuilder extends TangibleMessageBuilder {
|
||||
SWGObject obj = NGECore.getInstance().objectService.getObject(objId);
|
||||
|
||||
if(obj == null) {
|
||||
System.err.println("Cant find obj for obj id in equip list!!!");
|
||||
System.err.println("Cant find obj for obj id in equip list!!! (Normal Message for AI wipes)");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,8 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
private transient CreatureObject calledPet;
|
||||
|
||||
private byte locomotion = 0;
|
||||
private int GCWFatigue = 0;
|
||||
private boolean isConstructing = false;
|
||||
|
||||
public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
|
||||
super(objectID, planet, position, orientation, Template);
|
||||
@@ -545,6 +547,9 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
if (companion != null) {
|
||||
companion.setFaction(faction);
|
||||
}
|
||||
|
||||
if (this.getCalledPet()!=null)
|
||||
this.getCalledPet().setFaction(faction);
|
||||
}
|
||||
|
||||
public void setFactionStatus(int factionStatus) {
|
||||
@@ -555,6 +560,8 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
if (companion != null) {
|
||||
companion.setFactionStatus(factionStatus);
|
||||
}
|
||||
if (this.getCalledPet()!=null)
|
||||
this.getCalledPet().setFactionStatus(factionStatus);
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
@@ -1148,7 +1155,7 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
}
|
||||
//destination.getSession().write(messageBuilder.buildBaseline8());
|
||||
//destination.getSession().write(messageBuilder.buildBaseline9());
|
||||
|
||||
|
||||
if(destination != getClient()) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID(), NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this), getFaction());
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
@@ -1887,4 +1894,34 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
public void setCalledPet(CreatureObject calledPet) {
|
||||
this.calledPet = calledPet;
|
||||
}
|
||||
|
||||
public int getGCWFatigue() {
|
||||
return GCWFatigue;
|
||||
}
|
||||
|
||||
public void setGCWFatigue(int gCWFatigue) {
|
||||
GCWFatigue = gCWFatigue;
|
||||
}
|
||||
|
||||
public boolean isTrader(){
|
||||
if (isPlayer()){
|
||||
PlayerObject player = (PlayerObject) this.getSlottedObject("ghost");
|
||||
String profession = player.getProfession();
|
||||
if (profession.equals("trader_0a") ||
|
||||
profession.equals("trader_0b") ||
|
||||
profession.equals("trader_0c") ||
|
||||
profession.equals("trader_0d")){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isConstructing() {
|
||||
return isConstructing;
|
||||
}
|
||||
|
||||
public void setConstructing(boolean isConstructing) {
|
||||
this.isConstructing = isConstructing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.nio.ByteOrder;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.objects.Builder;
|
||||
import resources.objects.tangible.TangibleMessageBuilder;
|
||||
|
||||
@@ -215,6 +214,27 @@ public class InstallationMessageBuilder extends TangibleMessageBuilder{
|
||||
// 0010: 4E 49 07 12 00 00 00 02 00 09 00 00 00 00 00 05 NI..............
|
||||
// 0020: 00 8A D3 79 16 00 00 0F 00 ...y.....
|
||||
|
||||
public IoBuffer buildCustomNameDelta(InstallationObject installation, String customName) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
int sizeP = 8;
|
||||
sizeP += 2*customName.length();
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(installation.getObjectID());
|
||||
buffer.putInt(0x54414E4F);
|
||||
buffer.put((byte)3);
|
||||
buffer.putInt(sizeP);
|
||||
buffer.putShort((short)1);
|
||||
buffer.putShort((short)2);
|
||||
buffer.put(getUnicodeString(customName));
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildBaseline3(Map<Integer, Builder> baselineBuilders, Map<Integer, Builder> deltaBuilders) {
|
||||
super.buildBaseline3(deltaBuilders, deltaBuilders);
|
||||
|
||||
@@ -24,16 +24,21 @@ package resources.objects.installation;
|
||||
import java.io.Serializable;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.Baseline;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
import resources.datatables.Options;
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
@Entity(version=0)
|
||||
public class InstallationObject extends TangibleObject implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -44,20 +49,94 @@ public class InstallationObject extends TangibleObject implements Serializable {
|
||||
messageBuilder = new InstallationMessageBuilder(this);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void sendBaselines(Client destination) {
|
||||
//
|
||||
// if(destination == null || destination.getSession() == null) {
|
||||
// //System.out.println("NULL session");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// destination.getSession().write(messageBuilder.buildBaseline3(this));
|
||||
// //destination.getSession().write(messageBuilder.buildBaseline6(this));
|
||||
//
|
||||
// if(destination != getClient()) {
|
||||
// UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID(), NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this), getFaction());
|
||||
// destination.getSession().write(upvpm.serialize());
|
||||
// }
|
||||
// }
|
||||
|
||||
public Baseline getBaseline3() {
|
||||
Baseline baseline = super.getBaseline3();
|
||||
baseline.put("activeFlag", false);
|
||||
baseline.put("PowerReserves", 0);
|
||||
baseline.put("PowerCost", 0);
|
||||
return baseline;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
if (destination != null && destination.getSession() != null) {
|
||||
|
||||
// Factional peculiarities
|
||||
Baseline baseLine3 = getBaseline(3);
|
||||
if (destination.getParent() instanceof CreatureObject){
|
||||
if (((CreatureObject) destination.getParent()).isPlayer() && ((CreatureObject) destination.getParent()).getFaction()!=this.getFaction()){
|
||||
int optionsBitMask = getOptionsBitmask();
|
||||
if (getOption(Options.QUEST))
|
||||
optionsBitMask = optionsBitMask & ~Options.QUEST;
|
||||
if (!getOption(Options.ATTACKABLE))
|
||||
optionsBitMask = optionsBitMask | Options.ATTACKABLE;
|
||||
|
||||
baseLine3.set("optionsBitmask", optionsBitMask);
|
||||
}
|
||||
}
|
||||
|
||||
//destination.getSession().write(getBaseline(3).getBaseline());
|
||||
destination.getSession().write(baseLine3.getBaseline());
|
||||
destination.getSession().write(getBaseline(6).getBaseline());
|
||||
|
||||
Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient());
|
||||
|
||||
if (parent != null && destination == parent) {
|
||||
destination.getSession().write(getBaseline(8).getBaseline());
|
||||
destination.getSession().write(getBaseline(9).getBaseline());
|
||||
}
|
||||
|
||||
if (destination.getParent() != this) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
|
||||
upvpm.setFaction(CRC.StringtoCRC(getFaction()));
|
||||
// if (this.getTemplate().contains("turret")){
|
||||
// System.out.println("TURRET RESULT " + NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this));
|
||||
// }
|
||||
upvpm.setStatus(NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this));
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyClients(IoBuffer buffer, boolean notifySelf) {
|
||||
notifyObservers(buffer, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectMessageBuilder getMessageBuilder() {
|
||||
synchronized(objectMutex) {
|
||||
if (messageBuilder == null) {
|
||||
messageBuilder = new InstallationMessageBuilder(this);
|
||||
}
|
||||
return messageBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initAfterDBLoad() {
|
||||
super.init();
|
||||
messageBuilder = new InstallationMessageBuilder(this);
|
||||
defendersList = new Vector<TangibleObject>();
|
||||
}
|
||||
|
||||
public ObjectMessageBuilder getMessageBuilder() {
|
||||
return messageBuilder;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -441,7 +441,7 @@ public class GalacticResource extends SWGObject implements Serializable {
|
||||
if (lastSurveyWaypoint == null) {
|
||||
surveyWaypoint = (WaypointObject) NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", crafter.getPlanet(), smuMsg.getHighestX(), 0, smuMsg.getHighestZ());
|
||||
surveyWaypoint.setName("Survey location");
|
||||
surveyWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
surveyWaypoint.setPlanetCrc(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
surveyWaypoint.setPosition(new Point3D(smuMsg.getHighestX(), 0, smuMsg.getHighestZ()));
|
||||
player.waypointAdd(surveyWaypoint);
|
||||
surveyWaypoint.setPosition(new Point3D(smuMsg.getHighestX(), 0, smuMsg.getHighestZ()));
|
||||
@@ -450,7 +450,7 @@ public class GalacticResource extends SWGObject implements Serializable {
|
||||
surveyWaypoint.setStringAttribute("", "");
|
||||
player.waypointAdd(surveyWaypoint);
|
||||
surveyWaypoint.setName("Survey location");
|
||||
surveyWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
surveyWaypoint.setPlanetCrc(engine.resources.common.CRC.StringtoCRC(crafter.getPlanet().getName()));
|
||||
player.setLastSurveyWaypoint(surveyWaypoint);
|
||||
} else {
|
||||
surveyWaypoint = lastSurveyWaypoint;
|
||||
|
||||
@@ -24,6 +24,7 @@ package resources.objects.tangible;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -241,6 +242,8 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
|
||||
public void setOptionsBitmask(int optionsBitmask) {
|
||||
notifyClients(getBaseline(3).set("optionsBitmask", optionsBitmask), true);
|
||||
// This needs to be refactored to be sent to clients with different values depending on their faction
|
||||
// A quest object for one faction, can't be quest object for opposing faction
|
||||
}
|
||||
|
||||
public void setOptions(int options, boolean add) {
|
||||
@@ -322,18 +325,30 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
// All objects can be in combat (terminal mission flag bases, tutorial target box)
|
||||
|
||||
public List<TangibleObject> getDefendersList() {
|
||||
synchronized(objectMutex) {
|
||||
synchronized(defendersList) {
|
||||
return defendersList;
|
||||
}
|
||||
}
|
||||
|
||||
public List<TangibleObject> getDefendersListClone() {
|
||||
synchronized(objectMutex) {
|
||||
List<TangibleObject> returnList = new Vector<TangibleObject>();
|
||||
Collections.copy(returnList, defendersList);
|
||||
return returnList;
|
||||
}
|
||||
}
|
||||
|
||||
public void addDefender(TangibleObject defender) {
|
||||
if (((CreatureObject)this).getOwnerId()>0){
|
||||
if (((CreatureObject)this).getOwnerId()==defender.getObjectID()){
|
||||
return; // fix for now until determined where the tamer is added from
|
||||
if (this instanceof CreatureObject){
|
||||
if (((CreatureObject)this).getOwnerId()>0){
|
||||
if (((CreatureObject)this).getOwnerId()==defender.getObjectID()){
|
||||
return; // fix for now until determined where the tamer is added from
|
||||
}
|
||||
}
|
||||
}
|
||||
defendersList.add(defender);
|
||||
synchronized(defendersList) {
|
||||
defendersList.add(defender);
|
||||
}
|
||||
|
||||
if (!isInCombat()) {
|
||||
setInCombat(true);
|
||||
@@ -341,13 +356,15 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
}
|
||||
|
||||
public void removeDefender(TangibleObject defender) {
|
||||
defendersList.remove(defender);
|
||||
|
||||
if (defendersList.isEmpty() && isInCombat()) {
|
||||
setInCombat(false);
|
||||
synchronized(defendersList) {
|
||||
defendersList.remove(defender);
|
||||
|
||||
if (defendersList.isEmpty() && isInCombat()) {
|
||||
setInCombat(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getPvpBitmask() {
|
||||
synchronized(objectMutex) {
|
||||
return pvpBitmask;
|
||||
@@ -387,10 +404,10 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
|
||||
if (observer.getParent() != null) {
|
||||
observer.getSession().write(new UpdatePVPStatusMessage(this.getObjectID(), NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) observer.getParent(), this), getFaction()).serialize());
|
||||
if(getClient() != null)
|
||||
getClient().getSession().write(new UpdatePVPStatusMessage(observer.getParent().getObjectID(), NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) this, (CreatureObject) observer.getParent()), getFaction()).serialize());
|
||||
if(getClient() != null){
|
||||
getClient().getSession().write(new UpdatePVPStatusMessage(observer.getParent().getObjectID(), NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) this, (CreatureObject) observer.getParent()), getFaction()).serialize());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (getClient() != null) {
|
||||
@@ -400,16 +417,6 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
companion.updatePvpStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this instanceof CreatureObject){
|
||||
if (((CreatureObject)this).isPlayer()){
|
||||
// Here a specific CREO delta must be sent to update the faction info in character sheet and symbol in name
|
||||
// If anyone knows which that would be, please replace it here!
|
||||
sendBaselines(this.getClient());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAttackableBy(CreatureObject attacker) {
|
||||
@@ -602,7 +609,8 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
}
|
||||
|
||||
public void notifyClients(IoBuffer buffer, boolean notifySelf) {
|
||||
notifyObservers(buffer, false);
|
||||
// notifyObservers(buffer, false); // ??? Ignores the notifySelf argument. Was this done purposely? Faction Status etc. can't update the client without it
|
||||
notifyObservers(buffer, notifySelf);
|
||||
}
|
||||
|
||||
public ObjectMessageBuilder getMessageBuilder() {
|
||||
@@ -615,9 +623,26 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
if (destination != null && destination.getSession() != null) {
|
||||
destination.getSession().write(getBaseline(3).getBaseline());
|
||||
|
||||
// Factional peculiarities
|
||||
Baseline baseLine3 = getBaseline(3);
|
||||
if (destination.getParent() instanceof CreatureObject){
|
||||
if (((CreatureObject) destination.getParent()).isPlayer() && ((CreatureObject) destination.getParent()).getFaction()!=this.getFaction()){
|
||||
int optionsBitMask = getOptionsBitmask();
|
||||
if (getOption(Options.QUEST))
|
||||
optionsBitMask = optionsBitMask & ~Options.QUEST;
|
||||
if (!getOption(Options.ATTACKABLE))
|
||||
optionsBitMask = optionsBitMask | Options.ATTACKABLE;
|
||||
|
||||
baseLine3.set("optionsBitmask", optionsBitMask);
|
||||
}
|
||||
}
|
||||
|
||||
//destination.getSession().write(getBaseline(3).getBaseline());
|
||||
destination.getSession().write(baseLine3.getBaseline());
|
||||
destination.getSession().write(getBaseline(6).getBaseline());
|
||||
|
||||
Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient());
|
||||
@@ -630,12 +655,18 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
if (destination.getParent() != this) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
|
||||
upvpm.setFaction(CRC.StringtoCRC(getFaction()));
|
||||
// if (this.getTemplate().contains("barricade")){
|
||||
// System.out.println("BARTANO RESULT " + NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this));
|
||||
// }
|
||||
|
||||
upvpm.setStatus(NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this));
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
switch (viewType) {
|
||||
case 3:
|
||||
|
||||
@@ -22,147 +22,162 @@
|
||||
package resources.objects.waypoint;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.buffer.SimpleBufferAllocator;
|
||||
|
||||
import resources.objects.intangible.IntangibleObject;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.common.StringUtilities;
|
||||
import engine.resources.common.UString;
|
||||
import engine.resources.objects.Baseline;
|
||||
import engine.resources.objects.IDelta;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import resources.objects.intangible.IntangibleObject;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
public class WaypointObject extends IntangibleObject implements Serializable, IDelta {
|
||||
public class WaypointObject extends IntangibleObject implements IDelta, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int cellId; // ???
|
||||
private long locationNetworkId;
|
||||
private int planetCRC;
|
||||
private String name = "";
|
||||
private byte color;
|
||||
private boolean isActive;
|
||||
private transient static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
|
||||
public static final byte BLUE = 1, GREEN = 2, ORANGE = 3, YELLOW = 4, PURPLE = 5, WHITE = 6, MULTICOLOR = 7;
|
||||
|
||||
public static final byte BLUE = 1;
|
||||
public static final byte GREEN = 2;
|
||||
public static final byte ORANGE = 3;
|
||||
public static final byte YELLOW = 4;
|
||||
public static final byte PURPLE = 5;
|
||||
public static final byte WHITE = 6;
|
||||
public static final byte MULTICOLOR = 7; // JTL waypoint
|
||||
|
||||
public WaypointObject() { }
|
||||
|
||||
public WaypointObject(long objectID, Planet planet, Point3D position) {
|
||||
super(objectID, planet, position, new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff");
|
||||
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff");
|
||||
}
|
||||
|
||||
public WaypointObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initAfterDBLoad() {
|
||||
super.init();
|
||||
}
|
||||
|
||||
public synchronized int getCellId() {
|
||||
return cellId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setCellId(int cellId) {
|
||||
this.cellId = cellId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized long getLocationNetworkId() {
|
||||
return locationNetworkId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setLocationNetworkId(long locationNetworkId) {
|
||||
this.locationNetworkId = locationNetworkId;
|
||||
}
|
||||
|
||||
|
||||
public synchronized int getPlanetCRC() {
|
||||
return planetCRC;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setPlanetCRC(int planetCRC) {
|
||||
this.planetCRC = planetCRC;
|
||||
}
|
||||
|
||||
|
||||
public synchronized String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public synchronized byte getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setColor(byte color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
public synchronized boolean isActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
|
||||
public void setActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client client) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() {
|
||||
IoBuffer buffer = bufferPool.allocate(42 + name.length() * 2, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putInt(getCellId());
|
||||
|
||||
buffer.putFloat(getPosition().x);
|
||||
buffer.putFloat(getPosition().y);
|
||||
buffer.putFloat(getPosition().z);
|
||||
|
||||
buffer.putLong(0); // networklocationId
|
||||
buffer.putInt(getPlanetCRC());
|
||||
|
||||
buffer.put(StringUtilities.getUnicodeString(getName()));
|
||||
buffer.putLong(getObjectID());
|
||||
|
||||
buffer.put((byte) getColor());
|
||||
|
||||
if (isActive())
|
||||
buffer.put((byte) 1);
|
||||
else
|
||||
buffer.put((byte) 0);
|
||||
|
||||
return buffer.flip().array();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(SWGObject arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
public void init(SWGObject object) {
|
||||
|
||||
}
|
||||
|
||||
public Baseline getOtherVariables() {
|
||||
Baseline baseline = super.getOtherVariables();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline3() {
|
||||
Baseline baseline = super.getBaseline3();
|
||||
baseline.put("cellNumber", 0);
|
||||
baseline.put("position", new Point3D(0, 0, 0));
|
||||
baseline.put("targetId", (long) 0);
|
||||
baseline.put("planetCrc", 0);
|
||||
baseline.put("name", new UString("Waypoint"));
|
||||
baseline.put("color", (byte) 1);
|
||||
baseline.put("active", false);
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline6() {
|
||||
Baseline baseline = super.getBaseline6();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Baseline getBaseline8() {
|
||||
Baseline baseline = super.getBaseline8();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Baseline getBaseline9() {
|
||||
Baseline baseline = super.getBaseline9();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public int getCellNumber() {
|
||||
return (int) getBaseline(3).get("cellNumber");
|
||||
}
|
||||
|
||||
public void setCellNumber(int cellNumber) {
|
||||
getBaseline(3).set("cellNumber", cellNumber);
|
||||
}
|
||||
|
||||
public void setPosition(Point3D position) {
|
||||
getBaseline(3).set("position", position);
|
||||
}
|
||||
|
||||
public long getTargetId() {
|
||||
return (long) getBaseline(3).get("targetId");
|
||||
}
|
||||
|
||||
public void setTargetId(long targetId) {
|
||||
getBaseline(3).set("targetId", targetId);
|
||||
}
|
||||
|
||||
public int getPlanetCrc() {
|
||||
return (int) getBaseline(3).get("planetCrc");
|
||||
}
|
||||
|
||||
public void setPlanetCrc(int planetCrc) {
|
||||
getBaseline(3).set("planetCrc", planetCrc);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return ((UString) getBaseline(3).get("name")).get();
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
getBaseline(3).set("name", new UString(name));
|
||||
}
|
||||
|
||||
public byte getColor() {
|
||||
return (byte) getBaseline(3).get("color");
|
||||
}
|
||||
|
||||
public void setColor(byte color) {
|
||||
getBaseline(3).set("color", color);
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return (boolean) getBaseline(3).get("active");
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
getBaseline(3).set("active", active);
|
||||
}
|
||||
|
||||
public void toggleActive() {
|
||||
setActive(!isActive());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
synchronized(objectMutex) {
|
||||
IoBuffer buffer = Baseline.createBuffer(38 + StringUtilities.getUnicodeString(getName()).length);
|
||||
buffer.putInt(getCellNumber());
|
||||
buffer.put(Baseline.toBytes(getBaseline(3).get("position")));
|
||||
buffer.putLong(getTargetId());
|
||||
buffer.putInt(getPlanetCrc());
|
||||
buffer.put(StringUtilities.getUnicodeString(getName()));
|
||||
buffer.putLong(getObjectID());
|
||||
buffer.put(getColor());
|
||||
buffer.put(Baseline.getBoolean(isActive()));
|
||||
return buffer.flip().array();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated public int getCellId() { return getCellNumber(); }
|
||||
|
||||
@Deprecated public void setCellId(int cellId) { setCellNumber(cellId); }
|
||||
|
||||
@Deprecated public long getLocationNetworkId() { return getTargetId(); }
|
||||
|
||||
@Deprecated public void setLocationNetworkId(long locationNetworkId) { setTargetId(locationNetworkId); }
|
||||
|
||||
@Deprecated public int getPlanetCRC() { return getPlanetCrc(); }
|
||||
|
||||
@Deprecated public void setPlanetCRC(int planetCRC) { setPlanetCrc(planetCRC); }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package services;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.sql.PreparedStatement;
|
||||
|
||||
import main.NGECore;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
|
||||
public class AdminService implements INetworkDispatch {
|
||||
|
||||
private NGECore core;
|
||||
|
||||
public AdminService(NGECore core) {
|
||||
this.core = core;
|
||||
|
||||
}
|
||||
|
||||
public String getAccessLevelFromDB(long id) {
|
||||
String accessLevel = null;
|
||||
PreparedStatement preparedStatement;
|
||||
|
||||
try {
|
||||
preparedStatement = NGECore.getInstance().getDatabase1().preparedStatement("SELECT * FROM accounts WHERE id=" + id + "");
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
if(resultSet.next())
|
||||
accessLevel = resultSet.getString("accessLevel");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return accessLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> arg0, Map<Integer, INetworkRemoteEvent> arg1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,8 +22,10 @@
|
||||
package services;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -34,6 +36,7 @@ import org.python.core.PyObject;
|
||||
import resources.buffs.Buff;
|
||||
import resources.buffs.DamageOverTime;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.datatables.Posture;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
@@ -51,6 +54,22 @@ public class BuffService implements INetworkDispatch {
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
private ConcurrentHashMap<String, Buff> buffMap = new ConcurrentHashMap<String, Buff>();
|
||||
|
||||
private static Map<String,String> bannerBuffMapping = new ConcurrentHashMap<String,String>();
|
||||
static{
|
||||
bannerBuffMapping.put("trader_0a", "banner_buff_trader");
|
||||
bannerBuffMapping.put("trader_0b", "banner_buff_trader");
|
||||
bannerBuffMapping.put("trader_0c", "banner_buff_trader");
|
||||
bannerBuffMapping.put("trader_0d", "banner_buff_trader");
|
||||
bannerBuffMapping.put("entertainer_1a", "banner_buff_entertainer");
|
||||
bannerBuffMapping.put("medic_1a", "banner_buff_medic");
|
||||
bannerBuffMapping.put("officer_1a", "banner_buff_officer");
|
||||
bannerBuffMapping.put("bounty_hunter_1a", "banner_buff_bounty_hunter");
|
||||
bannerBuffMapping.put("smuggler_1a", "banner_buff_smuggler");
|
||||
bannerBuffMapping.put("commando_1a", "banner_buff_commando");
|
||||
bannerBuffMapping.put("spy_1a", "banner_buff_spy");
|
||||
bannerBuffMapping.put("force_sensitive_1a", "banner_buff_force_sensitive");
|
||||
}
|
||||
|
||||
public BuffService(NGECore core) {
|
||||
this.core = core;
|
||||
core.commandService.registerCommand("removeBuff");
|
||||
@@ -102,6 +121,10 @@ public class BuffService implements INetworkDispatch {
|
||||
} else {
|
||||
if (! hasBuff(target,buffName)) // QA, prevent infinite "refreshing" of buff by repeated use
|
||||
doAddBuff(target, buffName, buffer);
|
||||
else {
|
||||
if (buff.getMaxStacks()>1)
|
||||
doAddBuff(target, buffName, buffer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -182,6 +205,12 @@ public class BuffService implements INetworkDispatch {
|
||||
if(buff.getEffect4Name().length() > 0) core.skillModService.addSkillMod(target, buff.getEffect4Name(), (int) buff.getEffect4Value());
|
||||
if(buff.getEffect5Name().length() > 0) core.skillModService.addSkillMod(target, buff.getEffect5Name(), (int) buff.getEffect5Value());
|
||||
// }
|
||||
|
||||
if (buffName.equals("gcw_fatigue")){
|
||||
if (FileUtilities.doesFileExist("scripts/buffs/" + buffName + ".py")) {
|
||||
core.scriptService.callScript("scripts/buffs/", buffName, "add", core, buffer, buff);
|
||||
}
|
||||
}
|
||||
|
||||
target.addBuff(buff);
|
||||
|
||||
@@ -414,6 +443,56 @@ public class BuffService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
public void applyGCWBuff(String buffName, String factionName, SWGObject center) {
|
||||
Vector<CreatureObject> inRangeObjects = core.simulationService.getAllNearSameFactionCreatures(10, center.getWorldPosition(), center.getPlanet(), factionName);
|
||||
for(SWGObject obj : inRangeObjects) {
|
||||
if(!(obj instanceof CreatureObject))
|
||||
continue;
|
||||
if(obj instanceof CreatureObject && (((CreatureObject) obj).getPosture() == Posture.Dead))
|
||||
continue;
|
||||
CreatureObject buffed = (CreatureObject) obj;
|
||||
if (! buffed.hasBuff(buffName))
|
||||
addBuffToCreature(buffed, buffName, buffed);
|
||||
}
|
||||
}
|
||||
|
||||
public void initiateBannerBuffProcess(CreatureObject buffer, SWGObject banner){
|
||||
|
||||
String factionName = buffer.getFaction();
|
||||
String professionName = buffer.getPlayerObject().getProfession();
|
||||
String buffName = bannerBuffMapping.get(professionName);
|
||||
applyGCWBuff(buffName, factionName, banner);
|
||||
|
||||
final Future<?>[] fut = {null};
|
||||
fut[0] = scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
if (NGECore.getInstance().objectService.getObject(banner.getObjectID())==null){
|
||||
Thread.yield();
|
||||
fut[0].cancel(false);
|
||||
}
|
||||
|
||||
applyGCWBuff(buffName, factionName, banner);
|
||||
|
||||
if (! buffer.isInQuadtree()){
|
||||
NGECore.getInstance().objectService.destroyObject(banner.getObjectID());
|
||||
Thread.yield();
|
||||
fut[0].cancel(false);
|
||||
}
|
||||
|
||||
if (buffer.getWorldPosition().getDistance2D(banner.getWorldPosition())>1000 || buffer.getPlanetId()!=banner.getPlanetId()){
|
||||
NGECore.getInstance().objectService.destroyObject(banner.getObjectID());
|
||||
Thread.yield();
|
||||
fut[0].cancel(false);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception in GCW Banner thread " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 0, 2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void loadBuffs() {
|
||||
try {
|
||||
DatatableVisitor visitor = ClientFileManager.loadFile("datatables/buff/buff.iff", DatatableVisitor.class);
|
||||
|
||||
@@ -39,6 +39,7 @@ import engine.clientdata.visitors.DatatableVisitor;
|
||||
import engine.clientdata.visitors.ProfessionTemplateVisitor;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.config.Config;
|
||||
import engine.resources.container.CreatureContainerPermissions;
|
||||
import engine.resources.container.CreaturePermissions;
|
||||
import engine.resources.container.Traverser;
|
||||
@@ -265,7 +266,15 @@ public class CharacterService implements INetworkDispatch {
|
||||
object.setCustomName(clientCreateCharacter.getName());
|
||||
object.setHeight(clientCreateCharacter.getScale());
|
||||
object.setPersistent(true);
|
||||
object.setPosition(SpawnPoint.getRandomPosition(new Point3D(3528, 0, -4804), (float) 0.5, 3, core.terrainService.getPlanetByName("tatooine").getID()));
|
||||
|
||||
Config options = NGECore.getInstance().getOptions();
|
||||
|
||||
if (options != null && options.getInt("DO.ISOLATION.TESTS") > 0){
|
||||
object.setPosition(SpawnPoint.getRandomPosition(new Point3D(0, 0, 0), (float) 0.5, 3, core.terrainService.getPlanetByName("tatooine").getID()));
|
||||
} else {
|
||||
object.setPosition(SpawnPoint.getRandomPosition(new Point3D(3528, 0, -4804), (float) 0.5, 3, core.terrainService.getPlanetByName("tatooine").getID()));
|
||||
}
|
||||
|
||||
object.setCashCredits(100);
|
||||
object.setBankCredits(1000);
|
||||
object.setIncapTimer(10);
|
||||
@@ -357,7 +366,7 @@ public class CharacterService implements INetworkDispatch {
|
||||
System.out.println("Saving character with name: " + object.getCustomName());
|
||||
core.getSWGObjectODB().put(object.getObjectID(), object);
|
||||
|
||||
PreparedStatement ps = databaseConnection.preparedStatement("INSERT INTO characters (id, \"firstName\", \"lastName\", \"accountId\", \"galaxyId\", \"statusId\", appearance, gmflag) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
PreparedStatement ps = databaseConnection.preparedStatement("INSERT INTO characters (id, \"firstName\", \"lastName\", \"accountId\", \"galaxyId\", \"statusId\", appearance) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||
ps.setLong(1, object.getObjectID());
|
||||
ps.setString(2, clientCreateCharacter.getFirstName());
|
||||
ps.setString(3, clientCreateCharacter.getLastName());
|
||||
@@ -365,7 +374,6 @@ public class CharacterService implements INetworkDispatch {
|
||||
ps.setInt(5, galaxyId);
|
||||
ps.setInt(6, 1);
|
||||
ps.setInt(7, CRC.StringtoCRC(raceTemplate));
|
||||
ps.setBoolean(8, false);
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
CreateCharacterSuccess success = new CreateCharacterSuccess(object.getObjectID());
|
||||
|
||||
@@ -137,7 +137,6 @@ public class ConnectionService implements INetworkDispatch {
|
||||
if (resultSet.next()) {
|
||||
client.setAccountId(resultSet.getLong("accountId"));
|
||||
client.setSessionKey(clientIdMsg.getSessionKey());
|
||||
client.setGM(core.loginService.checkForGmPermission((int) resultSet.getLong("accountId")));
|
||||
AccountFeatureBits accountFeatureBits = new AccountFeatureBits();
|
||||
ClientPermissionsMessage clientPermissionsMessage = new ClientPermissionsMessage(maxNumberOfCharacters - core.characterService.getNumberOfCharacters((int) resultSet.getLong("accountId")));
|
||||
session.write(new HeartBeatMessage().serialize());
|
||||
@@ -340,7 +339,6 @@ public class ConnectionService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
ghost.toggleFlag(PlayerFlags.LD);
|
||||
|
||||
object.setPerformanceListenee(null);
|
||||
object.setPerformanceWatchee(null);
|
||||
object.setAttachment("disconnectTask", null);
|
||||
|
||||
@@ -140,9 +140,7 @@ public class LoginService implements INetworkDispatch{
|
||||
client.setPassword(pass);
|
||||
client.setSessionKey(generateSessionKey());
|
||||
client.setAccountId(id);
|
||||
//client.setAccountEmail(email);
|
||||
client.setSession(session);
|
||||
client.setGM(checkForGmPermission(id));
|
||||
|
||||
core.addClient(session, client);
|
||||
|
||||
@@ -156,9 +154,6 @@ public class LoginService implements INetworkDispatch{
|
||||
System.out.println(client.getAccountName() + " was not added to active connections map.");
|
||||
return;
|
||||
}
|
||||
/*if(!checkIfAccountExistInGameDB(id)) {
|
||||
createAccountForGameDB(id, user, email, encryptPass);
|
||||
}*/
|
||||
|
||||
persistSession(client);
|
||||
|
||||
@@ -170,6 +165,8 @@ public class LoginService implements INetworkDispatch{
|
||||
CharacterCreationDisabled charCreationDisabled = new CharacterCreationDisabled(0);
|
||||
StationIdHasJediSlot jediSlot = new StationIdHasJediSlot(false);
|
||||
ServerNowEpochTime time = new ServerNowEpochTime((int) (System.currentTimeMillis() / 1000));
|
||||
//System.out.println("ServerNowEpochTime " + (int) (System.currentTimeMillis() / 1000));
|
||||
//tools.CharonPacketUtils.printAnalysis(time.serialize(), "ServerNowEpochTime");
|
||||
|
||||
if (client.getSession().containsAttribute("tradeSession") == true) {
|
||||
client.getSession().removeAttribute("tradeSession");
|
||||
@@ -267,29 +264,6 @@ 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();
|
||||
if(resultSet.next())
|
||||
return resultSet.getBoolean("gmflag");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves session data to DB so Zone Server can link sessions to accounts.
|
||||
* @param client Client that needs a session save.
|
||||
|
||||
+104
-33
@@ -37,9 +37,11 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
|
||||
|
||||
import protocol.swg.CharacterSheetResponseMessage;
|
||||
import protocol.swg.ClientIdMsg;
|
||||
import protocol.swg.ClientMfdStatusUpdateMessage;
|
||||
@@ -67,6 +69,9 @@ import resources.common.OutOfBand;
|
||||
import resources.common.ProsePackage;
|
||||
import resources.common.SpawnPoint;
|
||||
import resources.datatables.DisplayType;
|
||||
import resources.datatables.FactionStatus;
|
||||
import resources.datatables.Factions;
|
||||
import resources.datatables.GcwRank;
|
||||
import resources.datatables.Options;
|
||||
import resources.datatables.PlayerFlags;
|
||||
import resources.datatables.Professions;
|
||||
@@ -136,6 +141,48 @@ public class PlayerService implements INetworkDispatch {
|
||||
player.setTotalPlayTime((int) (player.getTotalPlayTime() + ((System.currentTimeMillis() - player.getLastPlayTimeUpdate()) / 1000)));
|
||||
player.setLastPlayTimeUpdate(System.currentTimeMillis());
|
||||
core.collectionService.checkExplorationRegions(creature);
|
||||
|
||||
// GCW rank progress
|
||||
if (creature.getFaction().equals("rebel") || creature.getFaction().equals("imperial")){
|
||||
int oldrank = player.getCurrentRank();
|
||||
//int oldprogress = (int) ((player.getRankProgress() > 100) ? 100 : player.getRankProgress());
|
||||
int oldprogress = 0;
|
||||
int oldpoints = player.getGcwPoints();
|
||||
int newrank = oldrank;
|
||||
int newprogress = oldprogress;
|
||||
int oldranktotal = 0;
|
||||
int oldrankprogress = 0;
|
||||
int newranktotal = 0;
|
||||
int newrankprogress = 0;
|
||||
|
||||
oldrankprogress = oldprogress * 50;
|
||||
oldranktotal = 5000 * (oldrank - 1) + oldrankprogress;
|
||||
|
||||
newprogress = (int) core.gcwService.helper(oldpoints, oldrank);
|
||||
|
||||
if (newprogress < -2000) {
|
||||
newprogress = -2000;
|
||||
}
|
||||
|
||||
newranktotal = oldranktotal + newprogress;
|
||||
|
||||
if (oldrank == GcwRank.LIEUTENANT && newprogress < 0 && newranktotal < 30000) {
|
||||
newranktotal = 29999;
|
||||
}
|
||||
|
||||
newrank = oldrank;
|
||||
|
||||
if (newrank > GcwRank.GENERAL) {
|
||||
newrank = GcwRank.GENERAL;
|
||||
newranktotal = 12 * 5000 - 1;
|
||||
}
|
||||
|
||||
newrankprogress = newranktotal - (newrank - 1) * 5000;
|
||||
newprogress = newrankprogress * 100 / 5000;
|
||||
|
||||
player.setRankProgress((float) Math.floor(newprogress));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -526,10 +573,19 @@ public class PlayerService implements INetworkDispatch {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void sendCloningWindow(CreatureObject creature, final boolean pvpDeath) {
|
||||
|
||||
//if(creature.getPosture() != 14)
|
||||
// return;
|
||||
if(creature.getPosture() != 14)
|
||||
return;
|
||||
|
||||
List<SWGObject> cloners = core.staticService.getCloningFacilitiesByPlanet(creature.getPlanet());
|
||||
|
||||
boolean invasionDeath = core.invasionService.checkInvasionDeath(creature);
|
||||
|
||||
if (invasionDeath){
|
||||
if (core.invasionService.getAccordingCloners(creature).size()>0){
|
||||
cloners = core.invasionService.getAccordingCloners(creature);
|
||||
}
|
||||
}
|
||||
|
||||
Map<Long, String> cloneData = new HashMap<Long, String>();
|
||||
Point3D position = creature.getWorldPosition();
|
||||
|
||||
@@ -542,9 +598,20 @@ public class PlayerService implements INetworkDispatch {
|
||||
}
|
||||
final long preDesignatedObjectId = (preDesignatedCloner != null) ? preDesignatedCloner.getObjectID() : 0;
|
||||
cloners.stream().filter(c -> c.getObjectID() != preDesignatedObjectId).forEach(c -> cloneData.put(c.getObjectID(), core.mapService.getClosestCityName(c)));
|
||||
|
||||
Map<Long, String> listedCloneData = cloneData;
|
||||
|
||||
if (invasionDeath){
|
||||
if (core.invasionService.getAccordingCloners(creature).size()>0){
|
||||
listedCloneData = new HashMap<Long, String>();
|
||||
for (SWGObject cloner : core.invasionService.getAccordingCloners(creature)){
|
||||
listedCloneData.put(cloner.getObjectID(), cloner.getCustomName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final SUIWindow window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "@base_player:revive_title", "@base_player:clone_prompt_header",
|
||||
cloneData, creature, null, 0);
|
||||
listedCloneData, creature, null, 0);
|
||||
Vector<String> returnList = new Vector<String>();
|
||||
returnList.add("List.lstList:SelectedRow");
|
||||
|
||||
@@ -577,10 +644,10 @@ public class PlayerService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void handleCloneRequest(CreatureObject creature, BuildingObject cloner, SpawnPoint spawnPoint, boolean pvpDeath) {
|
||||
|
||||
|
||||
CellObject cell = cloner.getCellByCellNumber(spawnPoint.getCellNumber());
|
||||
|
||||
if(cell == null)
|
||||
if(cell == null && !cloner.getTemplate().contains("shared_invisible_cloner"))
|
||||
return;
|
||||
|
||||
creature.setPosture((byte) 0);
|
||||
@@ -599,7 +666,9 @@ public class PlayerService implements INetworkDispatch {
|
||||
creature.updateAllBuffs();
|
||||
}
|
||||
|
||||
creature.setFactionStatus(0);
|
||||
creature.setFactionStatus(FactionStatus.OnLeave);
|
||||
creature.updatePvpStatus();
|
||||
|
||||
core.buffService.addBuffToCreature(creature, "cloning_sickness", creature);
|
||||
|
||||
}
|
||||
@@ -681,35 +750,36 @@ public class PlayerService implements INetworkDispatch {
|
||||
/*
|
||||
* Resets to level 1
|
||||
*/
|
||||
public void resetLevel(CreatureObject creature) {
|
||||
public void resetLevel(CreatureObject creature, boolean unequipItems) {
|
||||
PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost");
|
||||
SWGObject inventory = creature.getSlottedObject("inventory");
|
||||
|
||||
try {
|
||||
for (Long equipmentId : new ArrayList<Long>(creature.getEquipmentList())) {
|
||||
|
||||
SWGObject equipment = core.objectService.getObject(equipmentId);
|
||||
|
||||
if (equipment == null || equipment.getTemplate().startsWith("object/tangible/hair/")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (equipment.getTemplate()) {
|
||||
case "object/tangible/inventory/shared_character_inventory.iff":
|
||||
case "object/tangible/inventory/shared_appearance_inventory.iff":
|
||||
case "object/tangible/datapad/shared_character_datapad.iff":
|
||||
case "object/tangible/bank/shared_character_bank.iff":
|
||||
case "object/tangible/mission_bag/shared_mission_bag.iff":
|
||||
case "object/weapon/creature/shared_creature_default_weapon.iff":
|
||||
continue;
|
||||
default:
|
||||
creature.transferTo(creature, inventory, equipment);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
if (unequipItems) {
|
||||
try {
|
||||
for (Long equipmentId : new ArrayList<Long>(creature.getEquipmentList())) {
|
||||
|
||||
SWGObject equipment = core.objectService.getObject(equipmentId);
|
||||
|
||||
if (equipment == null || equipment.getTemplate().startsWith("object/tangible/hair/")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (equipment.getTemplate()) {
|
||||
case "object/tangible/inventory/shared_character_inventory.iff":
|
||||
case "object/tangible/inventory/shared_appearance_inventory.iff":
|
||||
case "object/tangible/datapad/shared_character_datapad.iff":
|
||||
case "object/tangible/bank/shared_character_bank.iff":
|
||||
case "object/tangible/mission_bag/shared_mission_bag.iff":
|
||||
case "object/weapon/creature/shared_creature_default_weapon.iff":
|
||||
continue;
|
||||
default:
|
||||
creature.transferTo(creature, inventory, equipment);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//for (SWGObject equipment : creature.getAppearanceEquipmentList()) {
|
||||
//core.equipmentService.unequip(creature, equipment);
|
||||
//}
|
||||
@@ -793,7 +863,8 @@ public class PlayerService implements INetworkDispatch {
|
||||
|
||||
if(level == 0) return;
|
||||
|
||||
resetLevel(creature);
|
||||
if (!(creature.getLevel() <= (short) 1)) resetLevel(creature, true);
|
||||
else resetLevel(creature, false);
|
||||
|
||||
try {
|
||||
experienceTable = ClientFileManager.loadFile("datatables/player/player_level.iff", DatatableVisitor.class);
|
||||
|
||||
@@ -80,7 +80,9 @@ import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.harvester.HarvesterObject;
|
||||
import resources.objects.installation.InstallationObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.staticobject.StaticObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.common.*;
|
||||
import resources.common.collidables.AbstractCollidable;
|
||||
@@ -281,12 +283,172 @@ public class SimulationService implements INetworkDispatch {
|
||||
public Vector<CreatureObject> getAllNearNPCs(int distance, SWGObject value ){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(value.getPlanet(), value.getWorldPosition().x, value.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
if (objecta instanceof CreatureObject)
|
||||
if (objecta instanceof CreatureObject && objecta!=value)
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
);
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<CreatureObject> getAllNearPlayers(int distance, SWGObject value ){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(value.getPlanet(), value.getWorldPosition().x, value.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
if (objecta instanceof CreatureObject && objecta!=value)
|
||||
if (((CreatureObject)objecta).isPlayer())
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
);
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<CreatureObject> getAllNearPlayers(int distance, Planet planet, Point3D pos ){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(planet, pos.x, pos.z, distance).stream().forEach((objecta) -> {
|
||||
if (objecta instanceof CreatureObject)
|
||||
if (((CreatureObject)objecta).isPlayer())
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
);
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<TangibleObject> getAllNearNonSameFactionTargets(int distance, SWGObject center ){
|
||||
Vector<TangibleObject> foundTargets = new Vector<TangibleObject>();
|
||||
core.simulationService.get(center.getPlanet(), center.getWorldPosition().x, center.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
if (center.getObjectID()!=objecta.getObjectID()){
|
||||
String centerfaction = "";
|
||||
if (center instanceof CreatureObject)
|
||||
centerfaction = ((CreatureObject)center).getFaction();
|
||||
if (center instanceof InstallationObject)
|
||||
centerfaction = ((InstallationObject)center).getFaction();
|
||||
if (center instanceof TangibleObject)
|
||||
centerfaction = ((TangibleObject)center).getFaction();
|
||||
|
||||
if (centerfaction.length()>0 && !(objecta instanceof StaticObject)){
|
||||
if (objecta.getObjectID()!=center.getObjectID() && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject) objecta,(TangibleObject) center))
|
||||
foundTargets.add((TangibleObject)objecta);
|
||||
}
|
||||
}
|
||||
});
|
||||
return foundTargets;
|
||||
}
|
||||
|
||||
public Vector<CreatureObject> getAllNearNonSameFactionNPCs(int distance, SWGObject center ){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(center.getPlanet(), center.getWorldPosition().x, center.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
if (center.getObjectID()!=objecta.getObjectID()){
|
||||
String centerfaction = "";
|
||||
if (center instanceof CreatureObject)
|
||||
centerfaction = ((CreatureObject)center).getFaction();
|
||||
if (center instanceof InstallationObject)
|
||||
centerfaction = ((InstallationObject)center).getFaction();
|
||||
if (center instanceof TangibleObject)
|
||||
centerfaction = ((TangibleObject)center).getFaction();
|
||||
|
||||
if (centerfaction.length()>0 && objecta instanceof CreatureObject){
|
||||
if (objecta.getObjectID()!=center.getObjectID() && NGECore.getInstance().factionService.isFactionEnemy((CreatureObject) objecta,(TangibleObject) center))
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
}
|
||||
});
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<CreatureObject> getAllNearNonSameFactionPlayers(int distance, SWGObject center ){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(center.getPlanet(), center.getWorldPosition().x, center.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
if (center.getObjectID()!=objecta.getObjectID()){
|
||||
String centerfaction = "";
|
||||
if (center instanceof CreatureObject)
|
||||
centerfaction = ((CreatureObject)center).getFaction();
|
||||
if (center instanceof InstallationObject)
|
||||
centerfaction = ((InstallationObject)center).getFaction();
|
||||
if (center instanceof TangibleObject)
|
||||
centerfaction = ((TangibleObject)center).getFaction();
|
||||
|
||||
if (centerfaction.length()>0 && objecta instanceof CreatureObject){
|
||||
if (((CreatureObject)objecta).isPlayer() && objecta.getObjectID()!=center.getObjectID() && NGECore.getInstance().factionService.isFactionEnemy((CreatureObject) objecta,(TangibleObject) center))
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
}
|
||||
});
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<CreatureObject> getAllNearSameFactionNPCs(int distance, SWGObject center ){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(center.getPlanet(), center.getWorldPosition().x, center.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
|
||||
String centerfaction = "";
|
||||
if (center instanceof CreatureObject)
|
||||
centerfaction = ((CreatureObject)center).getFaction();
|
||||
if (center instanceof InstallationObject)
|
||||
centerfaction = ((InstallationObject)center).getFaction();
|
||||
if (center instanceof TangibleObject)
|
||||
centerfaction = ((TangibleObject)center).getFaction();
|
||||
|
||||
if (centerfaction.length()>0 && objecta instanceof CreatureObject){
|
||||
if (objecta.getObjectID()!=center.getObjectID() && NGECore.getInstance().factionService.isFactionAlly((TangibleObject) objecta,(TangibleObject) center))
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
});
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<CreatureObject> getAllNearSameFactionPlayers(int distance, Point3D centerPos, Planet planet, String factionName){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(planet, centerPos.x, centerPos.z, distance).stream().forEach((objecta) -> {
|
||||
|
||||
if (factionName.length()>0 && objecta instanceof CreatureObject){
|
||||
if (((CreatureObject)objecta).isPlayer() && NGECore.getInstance().factionService.isFactionAlly(((CreatureObject) objecta).getFaction(),factionName))
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
});
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<CreatureObject> getAllNearSameFactionCreatures(int distance, Point3D centerPos, Planet planet, String factionName){
|
||||
Vector<CreatureObject> foundCreatures = new Vector<CreatureObject>();
|
||||
core.simulationService.get(planet, centerPos.x, centerPos.z, distance).stream().forEach((objecta) -> {
|
||||
if (factionName.length()>0 && objecta instanceof CreatureObject){
|
||||
if (NGECore.getInstance().factionService.isFactionAlly(((CreatureObject) objecta).getFaction(),factionName))
|
||||
foundCreatures.add((CreatureObject)objecta);
|
||||
}
|
||||
});
|
||||
return foundCreatures;
|
||||
}
|
||||
|
||||
public Vector<TangibleObject> getAllNearTANOs(int distance, SWGObject value ){
|
||||
Vector<TangibleObject> foundTANOs = new Vector<TangibleObject>();
|
||||
core.simulationService.get(value.getPlanet(), value.getWorldPosition().x, value.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
if (objecta instanceof TangibleObject && objecta!=value)
|
||||
foundTANOs.add((TangibleObject)objecta);
|
||||
}
|
||||
);
|
||||
return foundTANOs;
|
||||
}
|
||||
|
||||
public Vector<TangibleObject> getAllNearNonSameFactionTANOs(int distance, SWGObject center ){
|
||||
Vector<TangibleObject> foundTANOs = new Vector<TangibleObject>();
|
||||
core.simulationService.get(center.getPlanet(), center.getWorldPosition().x, center.getWorldPosition().z, distance).stream().forEach((objecta) -> {
|
||||
|
||||
//if (objecta.getTemplate().contains("shared_adv_turret_dish_sm_heat")){
|
||||
String centerfaction = "";
|
||||
if (center instanceof CreatureObject)
|
||||
centerfaction = ((CreatureObject)center).getFaction();
|
||||
if (center instanceof InstallationObject)
|
||||
centerfaction = ((InstallationObject)center).getFaction();
|
||||
if (center instanceof TangibleObject)
|
||||
centerfaction = ((TangibleObject)center).getFaction();
|
||||
|
||||
if (centerfaction.length()>0 && objecta instanceof TangibleObject && !(objecta instanceof CreatureObject)){
|
||||
if (objecta.getObjectID()!=center.getObjectID() && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject) objecta,(TangibleObject) center))
|
||||
foundTANOs.add((TangibleObject)objecta);
|
||||
}
|
||||
|
||||
});
|
||||
return foundTANOs;
|
||||
}
|
||||
|
||||
public boolean move(SWGObject object, int oldX, int oldZ, int newX, int newZ) {
|
||||
if(quadTrees.get(object.getPlanet().getName()).remove(oldX, oldZ, object)) {
|
||||
@@ -705,6 +867,15 @@ public class SimulationService implements INetworkDispatch {
|
||||
add(object, newPosition.x, newPosition.z);
|
||||
}
|
||||
|
||||
if (object.getPlanet().getName().equals("talus") && object.getTemplate().contains("stormtrooper")){
|
||||
// float xx = object.getWorldPosition().x - newPosition.x;
|
||||
// float zz = object.getWorldPosition().z - newPosition.z;
|
||||
// float diff = (float) Math.sqrt(xx*xx+zz*zz);
|
||||
// System.out.println(" ((CreatureObject)object).getSpeedMultiplierBase());: " + ((CreatureObject)object).getSpeedMultiplierBase());
|
||||
// System.out.println(" ((CreatureObject)object).getSpeedMultiplierMod());: " + ((CreatureObject)object).getSpeedMultiplierMod());
|
||||
//
|
||||
}
|
||||
|
||||
UpdateTransformMessage utm = new UpdateTransformMessage(object.getObjectID(), (short) (newPosition.x * 4 + 0.5), (short) (newPosition.y * 4 + 0.5), (short) (newPosition.z * 4 + 0.5), movementCounter + 1, getSpecialDirection(newOrientation), speed);
|
||||
|
||||
List<SWGObject> newAwareObjects = get(object.getPlanet(), newPosition.x, newPosition.z, 512);
|
||||
@@ -838,8 +1009,18 @@ public class SimulationService implements INetworkDispatch {
|
||||
float cos = (float) Math.cos(radians);
|
||||
|
||||
WB_M44 rotationMatrix = new WB_M44(cos, 0, sin, 0, 0, 1, 0, 0, -sin, 0, cos, 0, 0, 0, 0, 1);
|
||||
|
||||
WB_M44 modelSpace = translateMatrix.mult(rotationMatrix).inverse();
|
||||
|
||||
WB_M44 modelSpace = null;
|
||||
try {
|
||||
modelSpace = translateMatrix.mult(rotationMatrix).inverse();
|
||||
} catch (Exception ex){
|
||||
// It's usually a bank terminal causing this
|
||||
//System.out.println("The object " + object.getTemplate() + " at x:" + object.getWorldPosition().x + " z:" + object.getWorldPosition().z + " causes a problem during modelspaceconversion. Can be safely ignored.");
|
||||
if (modelSpace==null)
|
||||
return new Ray(origin, new Vector3D(0,0,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
float originX = (float) (modelSpace.m11 * origin.x + modelSpace.m12 * origin.y + modelSpace.m13 * origin.z + modelSpace.m14);
|
||||
float originY = (float) (modelSpace.m21 * origin.x + modelSpace.m22 * origin.y + modelSpace.m23 * origin.z + modelSpace.m24);
|
||||
@@ -1185,8 +1366,8 @@ public class SimulationService implements INetworkDispatch {
|
||||
public boolean checkLineOfSight(SWGObject object, Point3D position2) {
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
float heightOrigin = 1.f;
|
||||
float heightDirection = 1.f;
|
||||
float heightOrigin = 1.75f;
|
||||
float heightDirection = 1.75f;
|
||||
|
||||
if (object instanceof CreatureObject) {
|
||||
heightOrigin = getHeightOrigin((CreatureObject) object);
|
||||
@@ -1205,6 +1386,9 @@ public class SimulationService implements INetworkDispatch {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (object.getTemplate().contains("_barricade") || object.getTemplate().contains("shared_dejarik_table_base"))
|
||||
continue;
|
||||
|
||||
if (object.getTemplateData() != null && object.getTemplateData().getAttribute("collisionActionBlockFlags") != null) {
|
||||
int bit = (Integer) object.getTemplateData().getAttribute("collisionActionBlockFlags") & 255;
|
||||
|
||||
@@ -1237,6 +1421,83 @@ public class SimulationService implements INetworkDispatch {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean checkLineOfSight2(SWGObject obj1, Point3D obj2) {
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
float heightOrigin = 1.75f;
|
||||
float heightDirection = 1.75f;
|
||||
|
||||
if(obj1 instanceof CreatureObject)
|
||||
heightOrigin = getHeightOrigin((CreatureObject) obj1);
|
||||
|
||||
Point3D position1 = obj1.getWorldPosition();
|
||||
Point3D position2 = obj2;
|
||||
|
||||
Point3D origin = new Point3D(position1.x, position1.y + heightOrigin, position1.z);
|
||||
Point3D end = new Point3D(position2.x, position2.y + heightDirection, position2.z);
|
||||
float distance = position1.getDistance2D(position2);
|
||||
|
||||
List<SWGObject> inRangeObjects = get(obj1.getPlanet(), position1.x, position1.z, (int) (distance + 10));
|
||||
|
||||
for(SWGObject object : inRangeObjects) {
|
||||
|
||||
if(object == obj1)
|
||||
continue;
|
||||
|
||||
if (object.getTemplate().contains("_barricade") || object.getTemplate().contains("shared_dejarik_table_base"))
|
||||
continue;
|
||||
|
||||
if(object.getTemplateData() != null && object.getTemplateData().getAttribute("collisionActionBlockFlags") != null) {
|
||||
int bit = (Integer) object.getTemplateData().getAttribute("collisionActionBlockFlags") & 255;
|
||||
if(bit == (Integer) object.getTemplateData().getAttribute("collisionActionBlockFlags"))
|
||||
continue;
|
||||
}
|
||||
|
||||
Ray ray = convertRayToModelSpace(origin, end, object);
|
||||
|
||||
MeshVisitor visitor = object.getMeshVisitor();
|
||||
|
||||
if(visitor == null)
|
||||
continue;
|
||||
|
||||
List<Mesh3DTriangle> tris = visitor.getTriangles();
|
||||
|
||||
if(tris.isEmpty())
|
||||
continue;
|
||||
|
||||
for(Mesh3DTriangle tri : tris) {
|
||||
|
||||
if(ray.intersectsTriangle(tri, distance) != null) {
|
||||
//System.out.println("Collision took: " + (System.nanoTime() - startTime) + " ns (collided)");
|
||||
// System.out.println("Collided with " + object.getTemplate() + " X: " + object.getPosition().x + " Y: " + object.getPosition().y + " Z: " + object.getPosition().z);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<Vec3D> segments = new ArrayList<Vec3D>();
|
||||
Line3D.splitIntoSegments(new Vec3D(position1.x, position1.y + 1, position1.z), new Vec3D(position2.x, position2.y + 1, position2.z), (float) 1, segments, true);
|
||||
|
||||
for(Vec3D segment : segments) {
|
||||
float y = segment.y;
|
||||
|
||||
int height = (int) core.terrainService.getHeight(obj1.getPlanetId(), segment.x, segment.z); // round down to int
|
||||
|
||||
if(height > y) {
|
||||
//System.out.println("Collision took: " + (System.nanoTime() - startTime) + " ns (terrain collision)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//System.out.println("Collision took: " + (System.nanoTime() - startTime) + " ns (did not collide)");
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean checkLineOfSight(SWGObject obj1, SWGObject obj2) {
|
||||
long startTime = System.nanoTime();
|
||||
if(obj1.getPlanet() != obj2.getPlanet())
|
||||
@@ -1256,8 +1517,10 @@ public class SimulationService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
float heightOrigin = 1.f;
|
||||
float heightDirection = 1.f;
|
||||
// float heightOrigin = 1.f;
|
||||
// float heightDirection = 1.f;
|
||||
float heightOrigin = 1.75f;
|
||||
float heightDirection = 1.75f;
|
||||
|
||||
if (obj2.getTemplate().equals("object/tangible/inventory/shared_character_inventory.iff")){
|
||||
obj2 = obj2.getContainer(); // LOS message fix on corpse
|
||||
@@ -1283,6 +1546,9 @@ public class SimulationService implements INetworkDispatch {
|
||||
if(object == obj1 || object == obj2)
|
||||
continue;
|
||||
|
||||
if (object.getTemplate().contains("_barricade") || object.getTemplate().contains("shared_dejarik_table_base"))
|
||||
continue;
|
||||
|
||||
if(object.getTemplateData() != null && object.getTemplateData().getAttribute("collisionActionBlockFlags") != null) {
|
||||
int bit = (Integer) object.getTemplateData().getAttribute("collisionActionBlockFlags") & 255;
|
||||
if(bit == (Integer) object.getTemplateData().getAttribute("collisionActionBlockFlags"))
|
||||
|
||||
@@ -59,9 +59,9 @@ public class StaticService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void spawnStatics() {
|
||||
Config options = new Config();
|
||||
options.setFilePath("options.cfg");
|
||||
final boolean buildoutsDisabled = ((options.loadConfigFile() && options.getInt("LOAD.BUILDOUT_OBJECTS") == 0) ? true : false);
|
||||
Config options = core.getOptions();
|
||||
|
||||
final boolean buildoutsDisabled = ((options != null && options.getInt("LOAD.BUILDOUT_OBJECTS") == 0) ? true : false);
|
||||
|
||||
for (Planet planet : core.terrainService.getPlanetList()) {
|
||||
if (FileUtilities.doesFileExist("scripts/static_spawns/" + planet.getName())) {
|
||||
@@ -240,14 +240,13 @@ public class StaticService implements INetworkDispatch {
|
||||
public List<SWGObject> getCloningFacilitiesByPlanet(Planet planet) {
|
||||
List<SWGObject> objects = core.simulationService.get(planet, 0, 0, 8300);
|
||||
List<SWGObject> cloners = new ArrayList<SWGObject>();
|
||||
|
||||
for (SWGObject obj : objects) {
|
||||
if(obj instanceof BuildingObject && (obj.getTemplate().contains("cloning_facility") || obj.getTemplate().contains("cloning_tatooine") || obj.getTemplate().contains("cloning_naboo") || obj.getTemplate().contains("cloning_corellia"))) {
|
||||
if(!obj.getTemplate().equals("object/building/general/shared_cloning_facility_general.iff"))
|
||||
cloners.add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return cloners;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ import resources.harvest.SurveyTool;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.resource.GalacticResource;
|
||||
import resources.objects.resource.ResourceConcentration;
|
||||
import resources.objects.resource.ResourceContainerObject;
|
||||
import resources.objects.resource.ResourceRoot;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
@@ -34,6 +34,7 @@ import resources.datatables.ClientPOIRadius;
|
||||
import services.playercities.ClientRegion;
|
||||
import engine.clientdata.ClientFileManager;
|
||||
import engine.clientdata.visitors.DatatableVisitor;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.config.Config;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
@@ -168,6 +169,16 @@ public class TerrainService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Planet getPlanetByCrc(int crc) {
|
||||
for (int i = 0; i < planets.size(); i++) {
|
||||
if (CRC.StringtoCRC(planets.get(i).getName().toLowerCase()) == crc) {
|
||||
return planets.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Planet getPlanetByPath(String path) {
|
||||
for (int i = 0; i < planets.size(); i++) {
|
||||
if (planets.get(i).getPath().equals(path)) {
|
||||
@@ -197,11 +208,9 @@ public class TerrainService {
|
||||
if(planet.getSnapshotVisitor() != null) {
|
||||
Thread thread = new Thread(() -> {
|
||||
|
||||
Config config = new Config();
|
||||
config.setFilePath("options.cfg");
|
||||
boolean loaded = config.loadConfigFile();
|
||||
|
||||
if (loaded && config.getInt("LOAD.SNAPSHOT_OBJECTS") > 0) {
|
||||
Config options = core.getOptions();
|
||||
|
||||
if (options != null && options.getInt("LOAD.SNAPSHOT_OBJECTS") > 0) {
|
||||
if (!core.getExcludedDevelopers().contains(System.getProperty("user.name"))){
|
||||
try {
|
||||
core.objectService.loadSnapshotObjects(planet);
|
||||
@@ -211,17 +220,17 @@ public class TerrainService {
|
||||
}
|
||||
}
|
||||
|
||||
if (loaded && config.getInt("LOAD.BUILDOUT_OBJECTS") > 0) {
|
||||
if (!core.getExcludedDevelopers().contains(System.getProperty("user.name"))){
|
||||
if (! config.keyExists("LOAD.BUILDOUT_ONLY_FOR")){
|
||||
if (options != null && options.getInt("LOAD.BUILDOUT_OBJECTS") > 0) {
|
||||
if (!core.getExcludedDevelopers().contains(System.getProperty("user.name"))){
|
||||
if (! options.keyExists("LOAD.BUILDOUT_ONLY_FOR")){
|
||||
try {
|
||||
core.objectService.loadBuildoutObjects(planet);
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (planet.getName().equals(config.getString("LOAD.BUILDOUT_ONLY_FOR"))){
|
||||
try {
|
||||
} else {
|
||||
if (planet.getName().trim().equals(options.getString("LOAD.BUILDOUT_ONLY_FOR").trim())){
|
||||
try {
|
||||
core.objectService.loadBuildoutObjects(planet);
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
+265
-96
@@ -59,7 +59,7 @@ public class AIActor {
|
||||
private CreatureObject creature;
|
||||
private Point3D spawnPosition;
|
||||
private volatile AIState currentState;
|
||||
private CreatureObject followObject;
|
||||
private TangibleObject followObject;
|
||||
private Vector<Point3D> movementPoints = new Vector<Point3D>();
|
||||
private MobileTemplate mobileTemplate;
|
||||
private ScheduledExecutorService scheduler;
|
||||
@@ -86,14 +86,41 @@ public class AIActor {
|
||||
private ScheduledFuture<?> movementFuture;
|
||||
private ScheduledFuture<?> recoveryFuture;
|
||||
private ScheduledFuture<?> despawnFuture;
|
||||
private boolean patrolLoop = true; // default
|
||||
private TangibleObject lastTarget = null;
|
||||
private Point3D repositionLocation;
|
||||
private long repositionStartTime = 0L;
|
||||
private long actorID = 0L;
|
||||
private static long autoActorID = 0L;
|
||||
private boolean actorAlive = true;
|
||||
private int progressionMarker = 0;
|
||||
private boolean AIactive = true;
|
||||
|
||||
public AIActor(CreatureObject creature, Point3D spawnPosition, ScheduledExecutorService scheduler) {
|
||||
actorID = autoActorID++;
|
||||
this.creature = creature;
|
||||
this.spawnPosition = spawnPosition;
|
||||
setLastPositionBeforeStateChange(spawnPosition); // just to make sure it's initialized
|
||||
this.scheduler = scheduler;
|
||||
creature.getEventBus().subscribe(this);
|
||||
this.currentState = new IdleState();
|
||||
initiateSchedules();
|
||||
}
|
||||
|
||||
public AIActor(CreatureObject creature, Point3D spawnPosition, ScheduledExecutorService scheduler, boolean aiactive) {
|
||||
actorID = autoActorID++;
|
||||
this.creature = creature;
|
||||
this.spawnPosition = spawnPosition;
|
||||
setLastPositionBeforeStateChange(spawnPosition); // just to make sure it's initialized
|
||||
this.scheduler = scheduler;
|
||||
creature.getEventBus().subscribe(this);
|
||||
this.currentState = new IdleState();
|
||||
this.AIactive = aiactive;
|
||||
initiateSchedules();
|
||||
}
|
||||
|
||||
private void initiateSchedules(){
|
||||
|
||||
setIntendedPrimaryAIState(this.currentState); // to switch back to after aggro
|
||||
regenTask = scheduler.scheduleAtFixedRate(() -> {
|
||||
try {
|
||||
@@ -112,41 +139,42 @@ public class AIActor {
|
||||
if(creature.getOption(Options.AGGRESSIVE)) {
|
||||
aggroCheckTask = scheduler.scheduleAtFixedRate(() -> {
|
||||
try {
|
||||
|
||||
if(creature == null || creature.getObservers().isEmpty() || creature.isInCombat() || isStalking)
|
||||
return;
|
||||
if (creature.getAttachment("tamed")!=null){
|
||||
DevLog.debugout("Charon", "Pet AI", "aggroCheckTask tamed==1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (creature.getCustomName().contains("baby"))
|
||||
DevLog.debugout("Charon", "Pet AI", "baby aggroCheckTask should not be here " +creature.getAttachment("tamed"));
|
||||
|
||||
creature.getObservers().stream().map(Client::getParent).filter(obj -> obj.inRange(creature.getWorldPosition(), 15)).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat() || isStalking) {
|
||||
/*if(mobileTemplate.isStalker()) {
|
||||
setFollowObject((CreatureObject) obj);
|
||||
setCurrentState(new StalkState());
|
||||
} else */
|
||||
|
||||
if (creature.getAttachment("IsBeingTamed")!=null)
|
||||
return;
|
||||
|
||||
if (obj instanceof CreatureObject){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (calledPet.getPosture() != 13 && calledPet.getPosture() != 14){
|
||||
addDefender(calledPet);
|
||||
if (AIactive){
|
||||
if(creature == null || creature.getObservers().isEmpty() || creature.isInCombat() || isStalking)
|
||||
return;
|
||||
if (creature.getAttachment("tamed")!=null){
|
||||
DevLog.debugoutai(this, "Charon", "Pet AI", "aggroCheckTask tamed==1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (creature.getCustomName().contains("baby"))
|
||||
DevLog.debugoutai(this, "Charon", "Pet AI", "baby aggroCheckTask should not be here " +creature.getAttachment("tamed"));
|
||||
|
||||
creature.getObservers().stream().map(Client::getParent).filter(obj -> obj.inRange(creature.getWorldPosition(), 15)).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat() || isStalking) {
|
||||
/*if(mobileTemplate.isStalker()) {
|
||||
setFollowObject((CreatureObject) obj);
|
||||
setCurrentState(new StalkState());
|
||||
} else */
|
||||
|
||||
if (creature.getAttachment("IsBeingTamed")!=null)
|
||||
return;
|
||||
|
||||
if (obj instanceof CreatureObject){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (calledPet.getPosture() != 13 && calledPet.getPosture() != 14){
|
||||
addDefender(calledPet);
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14){
|
||||
addDefender(addedObject);
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14){
|
||||
addDefender(addedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -155,61 +183,66 @@ public class AIActor {
|
||||
if(creature.getFaction().length()>0 || !creature.getOption(Options.AGGRESSIVE)) {
|
||||
factionCheckTask = scheduler.scheduleAtFixedRate(() -> {
|
||||
try {
|
||||
|
||||
if(creature == null || creature.getFactionStatus()!=FactionStatus.Combatant || creature.getObservers().isEmpty() || creature.isInCombat())
|
||||
return;
|
||||
|
||||
creature.getObservers().stream().map(Client::getParent).filter(obj -> obj.inRange(creature.getWorldPosition(), 15)).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat()) {
|
||||
DevLog.debugout("Charon", "CHECK faction creature ", "added " + creature.getFaction());
|
||||
DevLog.debugout("Charon", "CHECK faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugout("Charon", "CHECK factionCheckTask", "added " + obj.getCustomName());
|
||||
DevLog.debugout("Charon", "CHECK isFactionEnemy", "res " + NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj));
|
||||
if (obj instanceof CreatureObject && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj)){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (calledPet.getPosture() != 13 && calledPet.getPosture() != 14){
|
||||
addDefender(calledPet);
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14){
|
||||
addDefender(addedObject);
|
||||
DevLog.debugout("Charon", "faction creature ", "added " + creature.getFaction());
|
||||
DevLog.debugout("Charon", "faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugout("Charon", "factionCheckTask", "added " + obj.getCustomName());
|
||||
}
|
||||
if (AIactive){
|
||||
// this is difficult, should NPC not fight when no player is near? || creature.getObservers().isEmpty()
|
||||
if(creature == null || creature.getFactionStatus()!=FactionStatus.Combatant || creature.isInCombat())
|
||||
return;
|
||||
if(this.getFollowObject() != null){ // Don't search if actor has valid target
|
||||
CreatureObject addedCreature = null;
|
||||
TangibleObject addedObject = null;
|
||||
if (this.getFollowObject() instanceof TangibleObject){
|
||||
addedObject = (TangibleObject) this.getFollowObject();
|
||||
if (addedObject.getConditionDamage()>=addedObject.getMaximumCondition())
|
||||
return;
|
||||
}
|
||||
if (this.getFollowObject() instanceof CreatureObject){
|
||||
addedCreature = (CreatureObject) this.getFollowObject();
|
||||
if (addedCreature.getPosture() != 13 && addedCreature.getPosture() != 14)
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
NGECore.getInstance().simulationService.getAllNearNPCs(15, creature).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat()) {
|
||||
DevLog.debugout("Charon", "CHECK faction creature ", "added " + creature.getFaction());
|
||||
DevLog.debugout("Charon", "CHECK faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugout("Charon", "CHECK factionCheckTask", "added " + obj.getCustomName());
|
||||
DevLog.debugout("Charon", "CHECK isFactionEnemy", "res " + NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj));
|
||||
if (obj instanceof CreatureObject && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj)){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (calledPet.getPosture() != 13 && calledPet.getPosture() != 14){
|
||||
addDefender(calledPet);
|
||||
|
||||
// Check for near targets
|
||||
float[] closestDist = {9999F};
|
||||
TangibleObject[] closestCreature = {null};
|
||||
|
||||
NGECore.getInstance().simulationService.getAllNearNonSameFactionTargets(15, creature).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat()) {
|
||||
if (obj instanceof CreatureObject && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (CreatureObject)obj)){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (NGECore.getInstance().aiService.distanceSquared2D(creature.getWorldPosition(), obj.getWorldPosition())<closestDist[0] && calledPet.getPosture() != 13 && calledPet.getPosture() != 14 & ! calledPet.getOption(Options.INVULNERABLE)){
|
||||
closestCreature[0] = addedObject; // Determine the closest NPC
|
||||
closestDist[0] = NGECore.getInstance().aiService.distanceSquared2D(creature.getWorldPosition(), obj.getWorldPosition());
|
||||
}
|
||||
}
|
||||
if (NGECore.getInstance().aiService.distanceSquared2D(creature.getWorldPosition(), obj.getWorldPosition())<closestDist[0] && obj!=getFollowObject() && addedObject.getPosture() != 13 && addedObject.getPosture() != 14 & ! addedObject.getOption(Options.INVULNERABLE)){
|
||||
closestCreature[0] = addedObject; // Determine the closest NPC
|
||||
closestDist[0] = NGECore.getInstance().aiService.distanceSquared2D(creature.getWorldPosition(), obj.getWorldPosition());
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14){
|
||||
addDefender(addedObject);
|
||||
DevLog.debugout("Charon", "faction creature ", "added " + creature.getFaction());
|
||||
DevLog.debugout("Charon", "faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugout("Charon", "factionCheckTask", "added " + obj.getCustomName());
|
||||
|
||||
if (obj instanceof TangibleObject && !(obj instanceof CreatureObject) && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj)){
|
||||
TangibleObject addedObject = (TangibleObject) obj;
|
||||
|
||||
if (NGECore.getInstance().aiService.distanceSquared2D(creature.getWorldPosition(), obj.getWorldPosition())<closestDist[0] && obj!=getFollowObject() && addedObject.getConditionDamage()<addedObject.getMaximumCondition() & ! addedObject.getOption(Options.INVULNERABLE)){
|
||||
closestCreature[0] = addedObject; // Determine the closest TANO
|
||||
//closestDist[0] = obj.getWorldPosition().getDistance2D(creature.getWorldPosition());
|
||||
closestDist[0] = NGECore.getInstance().aiService.distanceSquared2D(creature.getWorldPosition(), obj.getWorldPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (closestCreature[0]!=null){
|
||||
addDefender(closestCreature[0]);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 0, 5000, TimeUnit.MILLISECONDS);
|
||||
}, 0, 3000, TimeUnit.MILLISECONDS);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -230,15 +263,19 @@ public class AIActor {
|
||||
this.spawnPosition = spawnPosition;
|
||||
}
|
||||
|
||||
public void addDefender(CreatureObject defender) {
|
||||
// public void addDefender(CreatureObject defender) {
|
||||
// addDefender(defender, false);
|
||||
// }
|
||||
public void addDefender(TangibleObject defender) {
|
||||
addDefender(defender, false);
|
||||
}
|
||||
|
||||
|
||||
public void addDefender(CreatureObject defender, boolean isAssisting) {
|
||||
public void addDefender(TangibleObject defender, boolean isAssisting) {
|
||||
creature.addDefender(defender);
|
||||
if(followObject == null)
|
||||
setFollowObject(defender);
|
||||
DevLog.debugoutai(this,"Charon", "AI addDefender", "getFollowObject " + getFollowObject().getTemplate());
|
||||
setCurrentState(new AttackState());
|
||||
if(!isAssisting) {
|
||||
NGECore.getInstance().simulationService.get(creature.getPlanet(), creature.getWorldPosition().x, creature.getWorldPosition().z, 38).stream().filter((obj) ->
|
||||
@@ -250,9 +287,18 @@ public class AIActor {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeDefender(CreatureObject defender) {
|
||||
public void removeDefender(TangibleObject defender) {
|
||||
if (defender==null){
|
||||
// damageMap.keySet().remove(null);
|
||||
// damageMap.values().remove(null);
|
||||
//ToDo: Remove those empty defenders somehow
|
||||
// if (damageMap.containsKey(null))
|
||||
// damageMap.remove(null);
|
||||
return;
|
||||
}
|
||||
creature.removeDefender(defender);
|
||||
damageMap.remove(defender);
|
||||
if (damageMap.containsKey(defender))
|
||||
damageMap.remove(defender);
|
||||
defender.removeDefender(creature);
|
||||
if(followObject == defender) {
|
||||
setFollowObject(getHighestDamageDealer());
|
||||
@@ -285,17 +331,18 @@ public class AIActor {
|
||||
if(this.currentState != null)
|
||||
doStateAction(this.currentState.onExit(this));
|
||||
this.currentState = currentState;
|
||||
DevLog.debugoutai(this,"Charon", "AI Actor setCurrentState", "setCurrentState " + currentState.getClass().getName());
|
||||
doStateAction(currentState.onEnter(this));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public CreatureObject getFollowObject() {
|
||||
public TangibleObject getFollowObject() {
|
||||
return followObject;
|
||||
}
|
||||
|
||||
public void setFollowObject(CreatureObject followObject) {
|
||||
public void setFollowObject(TangibleObject followObject) {
|
||||
this.followObject = followObject;
|
||||
}
|
||||
|
||||
@@ -316,23 +363,39 @@ public class AIActor {
|
||||
}
|
||||
|
||||
public void scheduleMovement() {
|
||||
// Catch current state BEFORE waiting 500ms for execution,
|
||||
// as the state could have changed in that time resulting in
|
||||
// undesired additional movement loops
|
||||
AIState caughtAIState = currentState;
|
||||
if (currentState==null)
|
||||
return;
|
||||
if (!actorAlive)
|
||||
return;
|
||||
movementFuture = scheduler.schedule(() -> {
|
||||
try {
|
||||
if (creature==null){
|
||||
destroyActor();
|
||||
return;
|
||||
}
|
||||
doStateAction(currentState.move(AIActor.this));
|
||||
if (caughtAIState!=null && currentState!=null){
|
||||
if (caughtAIState.getClass().equals(currentState.getClass()))
|
||||
doStateAction(caughtAIState.move(AIActor.this));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//System.out.println("Exception in scheduleMovement");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void scheduleRecovery() {
|
||||
AIState caughtAIState = currentState;
|
||||
if (!actorAlive)
|
||||
return;
|
||||
recoveryFuture = scheduler.schedule(() -> {
|
||||
try {
|
||||
doStateAction(currentState.recover(AIActor.this));
|
||||
if (caughtAIState.getClass().equals(currentState.getClass()))
|
||||
doStateAction(caughtAIState.recover(AIActor.this));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -345,11 +408,18 @@ public class AIActor {
|
||||
|
||||
@Handler
|
||||
public void handleDamage(DamageTaken event) {
|
||||
CreatureObject attacker = event.attacker;
|
||||
CreatureObject attacker = (CreatureObject)event.attacker;
|
||||
if(damageMap.containsKey(attacker))
|
||||
damageMap.put(attacker, damageMap.get(attacker) + event.damage);
|
||||
else
|
||||
damageMap.put(attacker, event.damage);
|
||||
|
||||
// Put AI into combat state if it is not yet and damaged
|
||||
if (!creature.isInCombat()){
|
||||
creature.setInCombat(true);
|
||||
if (this.getHighestDamageDealer()!=null)
|
||||
addDefender(this.getHighestDamageDealer());
|
||||
}
|
||||
}
|
||||
|
||||
public Map<CreatureObject, Integer> getDamageMap() {
|
||||
@@ -408,7 +478,8 @@ public class AIActor {
|
||||
}
|
||||
|
||||
switch(result) {
|
||||
|
||||
|
||||
|
||||
case StateResult.DEAD:
|
||||
setCurrentState(new DeathState());
|
||||
break;
|
||||
@@ -459,17 +530,24 @@ public class AIActor {
|
||||
try {
|
||||
damageMap.clear();
|
||||
followObject = null;
|
||||
creature.setAttachment("AI", null);
|
||||
NGECore.getInstance().objectService.destroyObject(creature);
|
||||
NGECore.getInstance().objectService.destroyObject(creature);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 2, TimeUnit.MINUTES);
|
||||
//}, 2, TimeUnit.MINUTES);
|
||||
}, 10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void destroyActor(){
|
||||
creature.getEventBus().unsubscribe(this);
|
||||
if (creature!=null){
|
||||
if (despawnFuture!=null){
|
||||
despawnFuture.cancel(true);
|
||||
despawnFuture = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure to kill all AI helper threads
|
||||
if (aggroCheckTask!=null)
|
||||
aggroCheckTask.cancel(true);
|
||||
@@ -484,11 +562,7 @@ public class AIActor {
|
||||
if (movementFuture!=null){
|
||||
recoveryFuture.cancel(true);
|
||||
recoveryFuture = null;
|
||||
}
|
||||
if (despawnFuture!=null){
|
||||
despawnFuture.cancel(true);
|
||||
despawnFuture = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelAggro(){
|
||||
@@ -627,5 +701,100 @@ public class AIActor {
|
||||
Point3D lastPositionBeforeStateChange) {
|
||||
this.lastPositionBeforeStateChange = lastPositionBeforeStateChange;
|
||||
}
|
||||
|
||||
public boolean isPatrolLoop() {
|
||||
return patrolLoop;
|
||||
}
|
||||
|
||||
public void setPatrolLoop(boolean patrolLoop) {
|
||||
this.patrolLoop = patrolLoop;
|
||||
}
|
||||
|
||||
public TangibleObject getLastTarget() {
|
||||
return lastTarget;
|
||||
}
|
||||
|
||||
public void setLastTarget(TangibleObject lastTarget) {
|
||||
this.lastTarget = lastTarget;
|
||||
}
|
||||
|
||||
public Point3D getRepositionLocation() {
|
||||
return repositionLocation;
|
||||
}
|
||||
|
||||
public void setRepositionLocation(Point3D repositionLocation) {
|
||||
this.repositionLocation = repositionLocation;
|
||||
}
|
||||
|
||||
public long getRepositionStartTime() {
|
||||
return repositionStartTime;
|
||||
}
|
||||
|
||||
public void setRepositionStartTime(long repositionStartTime) {
|
||||
this.repositionStartTime = repositionStartTime;
|
||||
}
|
||||
|
||||
public long getActorID() {
|
||||
return actorID;
|
||||
}
|
||||
|
||||
public boolean isActorAlive() {
|
||||
return actorAlive;
|
||||
}
|
||||
|
||||
public void setActorAlive(boolean actorAlive) {
|
||||
this.actorAlive = actorAlive;
|
||||
}
|
||||
|
||||
public int getProgressionMarker() {
|
||||
return progressionMarker;
|
||||
}
|
||||
|
||||
public void setProgressionMarker(int progressionMarker) {
|
||||
this.progressionMarker = progressionMarker;
|
||||
}
|
||||
|
||||
public boolean isAIactive() {
|
||||
return AIactive;
|
||||
}
|
||||
|
||||
public void setAIactive(boolean aIactive) {
|
||||
AIactive = aIactive;
|
||||
}
|
||||
|
||||
public void prepareDeletion() {
|
||||
if(this.creature!=null){
|
||||
lastPositionBeforeStateChange = this.creature.getWorldPosition();
|
||||
this.creature.getDefendersList().clear();
|
||||
this.setFollowObject(null);
|
||||
}
|
||||
this.setIntendedPrimaryAIState(new IdleState());
|
||||
patrolPoints.clear();
|
||||
movementPoints.clear();
|
||||
actorAlive = false; // stop moving
|
||||
AIactive = false; // stop reacting to attacks
|
||||
}
|
||||
|
||||
public void cloneActor(AIActor oldActor) {
|
||||
AIactive = oldActor.isAIactive();
|
||||
isStalking = oldActor.isStalking();
|
||||
patrolPoints = oldActor.getPatrolPoints();
|
||||
loiterDestType = oldActor.getLoiterDestType();
|
||||
loiterDestination = oldActor.getLoiterDestination();
|
||||
minLoiterDist = oldActor.getMinLoiterDist();
|
||||
maxLoiterDist = oldActor.getMaxLoiterDist();
|
||||
waitState = oldActor.getWaitState();
|
||||
waitStartTime = oldActor.getWaitStartTime();
|
||||
patrolLoop =oldActor.isPatrolLoop();
|
||||
intendedPrimaryAIState = oldActor.getIntendedPrimaryAIState();
|
||||
try {
|
||||
setCurrentState(intendedPrimaryAIState.getClass().newInstance());
|
||||
} catch (InstantiationException e) {
|
||||
System.out.println("Aiactor cloning failed InstantiationException");
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
System.out.println("Aiactor cloning failed IllegalAccessException");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,13 @@
|
||||
******************************************************************************/
|
||||
package services.ai;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -33,18 +38,21 @@ import resources.datatables.GcwType;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import services.ai.states.AIState;
|
||||
import services.ai.states.IdleState;
|
||||
import services.ai.states.LoiterState;
|
||||
import services.ai.states.PatrolState;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import main.NGECore;
|
||||
|
||||
public class AIService {
|
||||
|
||||
@SuppressWarnings("unused") private Vector<AIActor> aiActors = new Vector<AIActor>();
|
||||
private NGECore core;
|
||||
private TangibleObject checkerAI = null;
|
||||
|
||||
public AIService(NGECore core) {
|
||||
this.core = core;
|
||||
@@ -54,6 +62,8 @@ public class AIService {
|
||||
|
||||
// TODO: implement cell pathfinding, returning straight line for now
|
||||
Vector<Point3D> path = new Vector<Point3D>();
|
||||
if (pointA==null || pointB==null)
|
||||
return path;
|
||||
path.add(pointA);
|
||||
float x = pointB.x - 1 + new Random().nextFloat();
|
||||
float z = pointB.z - 1 + new Random().nextFloat();
|
||||
@@ -169,6 +179,13 @@ public class AIService {
|
||||
}
|
||||
}
|
||||
|
||||
public void setPatrolLoop(CreatureObject creature, boolean value){
|
||||
AIActor actor = (AIActor) creature.getAttachment("AI");
|
||||
if (actor==null)
|
||||
return;
|
||||
actor.setPatrolLoop(value);
|
||||
}
|
||||
|
||||
public void setPatrol(CreatureObject creature, Vector<Point3D> patrolpoints){
|
||||
AIActor actor = (AIActor) creature.getAttachment("AI");
|
||||
if (actor==null)
|
||||
@@ -178,6 +195,8 @@ public class AIService {
|
||||
AIState intendedPrimaryAIState = new PatrolState();
|
||||
actor.setIntendedPrimaryAIState(intendedPrimaryAIState);
|
||||
actor.setCurrentState(intendedPrimaryAIState);
|
||||
actor.setCurrentState(intendedPrimaryAIState);
|
||||
actor.setCurrentState(intendedPrimaryAIState);
|
||||
}
|
||||
|
||||
public void setPatrol(CreatureObject creature, boolean active){
|
||||
@@ -209,6 +228,95 @@ public class AIService {
|
||||
actor.setCurrentState(intendedPrimaryAIState);
|
||||
}
|
||||
|
||||
public void setCheckAI(TangibleObject checker){
|
||||
checkerAI = checker;
|
||||
}
|
||||
|
||||
public TangibleObject getCheckAI(){
|
||||
return this.checkerAI;
|
||||
}
|
||||
|
||||
public float distanceSquared2D(Point3D p2, Point3D p1){
|
||||
return (p2.x - p1.x) * (p2.x - p1.x) + (p2.z - p1.z) * (p2.z - p1.z);
|
||||
}
|
||||
|
||||
public float distanceSquared(Point3D p2, Point3D p1){
|
||||
return (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y) + (p2.z - p1.z) * (p2.z - p1.z);
|
||||
}
|
||||
|
||||
public void waitForEvent(AIActor actor, INetworkDispatch service, String serviceMethodName, boolean expectedValue, Class<?> nextStateClass){
|
||||
|
||||
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
final Future<?>[] wfe = {null};
|
||||
wfe[0] = scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Class<?> noParams[] = {};
|
||||
Method m = service.getClass().getMethod(serviceMethodName, noParams);
|
||||
boolean value = (boolean) m.invoke(service);
|
||||
if (value==expectedValue){
|
||||
actor.setCurrentState((AIState)nextStateClass.newInstance());
|
||||
System.out.println("condition true waitForEvent! " + nextStateClass.getName());
|
||||
Thread.yield();
|
||||
wfe[0].cancel(false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 10, 3000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void waitForEvent(AIActor actor, INetworkDispatch service, String serviceMethodName, int expectedValue, Class<?> nextStateClass){
|
||||
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
final Future<?>[] wfe = {null};
|
||||
wfe[0] = scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Class<?> noParams[] = {};
|
||||
Method m = service.getClass().getMethod(serviceMethodName, noParams);
|
||||
int number = (int) m.invoke(service);
|
||||
if (number==expectedValue){
|
||||
actor.setCurrentState((AIState)nextStateClass.newInstance());
|
||||
Thread.yield();
|
||||
wfe[0].cancel(false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 10, 3000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
// ToDo: Make an overloaded method with params
|
||||
public void waitForEvent(INetworkDispatch service, String serviceMethodName, Object[] params){
|
||||
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
final Future<?>[] wfe = {null};
|
||||
wfe[0] = scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
boolean condition = true;
|
||||
Class<?> noParams[] = {};
|
||||
Method m = service.getClass().getMethod(serviceMethodName, noParams);
|
||||
m.invoke(service);
|
||||
|
||||
if (condition){
|
||||
Thread.yield();
|
||||
wfe[0].cancel(false);
|
||||
}
|
||||
// do something
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}, 10, 2000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void logAI(String logMsg){
|
||||
if (checkDeveloperIdentity()){
|
||||
System.err.println("AI-LOG: " + logMsg);
|
||||
|
||||
@@ -33,6 +33,7 @@ import resources.objects.tangible.TangibleObject;
|
||||
import services.combat.CombatEvents.DamageTaken;
|
||||
import tools.DevLog;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class LairActor {
|
||||
|
||||
private Vector<AIActor> creatures = new Vector<AIActor>();
|
||||
@@ -86,8 +87,8 @@ public class LairActor {
|
||||
spawnNewCreatures();
|
||||
|
||||
for(AIActor ai : creatures) {
|
||||
ai.addDefender(event.attacker);
|
||||
event.attacker.addDefender(ai.getCreature());
|
||||
ai.addDefender((CreatureObject)event.attacker);
|
||||
((CreatureObject)event.attacker).addDefender(ai.getCreature());
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +164,6 @@ public class LairActor {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void healLair() {
|
||||
|
||||
if(lairObject.getConditionDamage() == 0 || creatures.isEmpty())
|
||||
|
||||
@@ -0,0 +1,599 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package services.ai;
|
||||
|
||||
import java.util.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.installation.InstallationObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import services.ai.states.TurretAIState;
|
||||
import services.ai.states.TurretAIState.StateResult;
|
||||
import services.ai.states.AIState;
|
||||
import services.ai.states.TurretAttackState;
|
||||
import services.ai.states.TurretIdleState;
|
||||
import services.combat.CombatEvents.DamageTaken;
|
||||
import services.spawn.MobileTemplate;
|
||||
import tools.DevLog;
|
||||
import resources.datatables.FactionStatus;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class TurretAIActor {
|
||||
|
||||
private TangibleObject creature;
|
||||
private Point3D spawnPosition;
|
||||
private volatile TurretAIState currentState;
|
||||
private TangibleObject followObject;
|
||||
private Vector<Point3D> movementPoints = new Vector<Point3D>();
|
||||
private MobileTemplate mobileTemplate;
|
||||
private ScheduledExecutorService scheduler;
|
||||
private Map<CreatureObject, Integer> damageMap = new ConcurrentHashMap<CreatureObject, Integer>();
|
||||
private volatile boolean hasReachedPosition;
|
||||
private long lastAttackTimestamp;
|
||||
private ScheduledFuture<?> regenTask;
|
||||
private ScheduledFuture<?> aggroCheckTask;
|
||||
private ScheduledFuture<?> factionCheckTask;
|
||||
private boolean isStalking = false;
|
||||
private byte milkState = 0;
|
||||
private boolean hasBeenHarvested = false;
|
||||
private Vector<Point3D> patrolPoints = new Vector<Point3D>();
|
||||
private int patrolPointIndex = 0;
|
||||
private String loiterDestType = "LOITER";
|
||||
private Point3D loiterDestination;
|
||||
private Point3D originPosition;
|
||||
private float minLoiterDist;
|
||||
private float maxLoiterDist;
|
||||
private String waitState = "NO";
|
||||
private long waitStartTime = 0L;
|
||||
private TurretAIState intendedPrimaryTurretAIState;
|
||||
private Point3D lastPositionBeforeStateChange;
|
||||
private boolean patrolLoop = true; // default
|
||||
private ScheduledFuture<?> recoveryFuture;
|
||||
|
||||
|
||||
public TurretAIActor(TangibleObject creature, Point3D spawnPosition, ScheduledExecutorService scheduler) {
|
||||
this.creature = creature;
|
||||
this.spawnPosition = spawnPosition;
|
||||
setLastPositionBeforeStateChange(spawnPosition); // just to make sure it's initialized
|
||||
this.scheduler = scheduler;
|
||||
creature.getEventBus().subscribe(this);
|
||||
this.currentState = new TurretIdleState();
|
||||
setIntendedPrimaryTurretAIState(this.currentState); // to switch back to after aggro
|
||||
|
||||
if(creature.getOption(Options.AGGRESSIVE)) {
|
||||
aggroCheckTask = scheduler.scheduleAtFixedRate(() -> {
|
||||
try {
|
||||
|
||||
if(creature == null || creature.getObservers().isEmpty() || creature.isInCombat() || isStalking)
|
||||
return;
|
||||
if (creature.getAttachment("tamed")!=null){
|
||||
DevLog.debugoutai(this, "Charon", "Pet AI", "aggroCheckTask tamed==1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (creature.getCustomName().contains("baby"))
|
||||
DevLog.debugoutai(this, "Charon", "Pet AI", "baby aggroCheckTask should not be here " +creature.getAttachment("tamed"));
|
||||
|
||||
creature.getObservers().stream().map(Client::getParent).filter(obj -> obj.inRange(creature.getWorldPosition(), 60)).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat() || isStalking) {
|
||||
/*if(mobileTemplate.isStalker()) {
|
||||
setFollowObject((CreatureObject) obj);
|
||||
setCurrentState(new StalkState());
|
||||
} else */
|
||||
|
||||
if (creature.getAttachment("IsBeingTamed")!=null)
|
||||
return;
|
||||
|
||||
if (obj instanceof CreatureObject){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (calledPet.getPosture() != 13 && calledPet.getPosture() != 14){
|
||||
addDefender(calledPet);
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14){
|
||||
addDefender(addedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 0, 2000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
if(creature.getFaction().length()>0 || !creature.getOption(Options.AGGRESSIVE)) {
|
||||
factionCheckTask = scheduler.scheduleAtFixedRate(() -> {
|
||||
//System.out.println("Turret faction thread");
|
||||
try {
|
||||
|
||||
if(creature == null || creature.getFactionStatus()!=FactionStatus.Combatant || creature.getObservers().isEmpty() || creature.isInCombat())
|
||||
return;
|
||||
|
||||
creature.getObservers().stream().map(Client::getParent).filter(obj -> obj.inRange(creature.getWorldPosition(), 60)).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat()) {
|
||||
// DevLog.debugout("Charon", "TURRET CHECK faction creature ", "added " + creature.getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET CHECK faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET CHECK factionCheckTask", "added " + obj.getCustomName());
|
||||
// DevLog.debugout("Charon", "TURRET CHECK isFactionEnemy", "res " + NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj));
|
||||
if (obj instanceof CreatureObject && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj)){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (calledPet.getPosture() != 13 && calledPet.getPosture() != 14){
|
||||
addDefender(calledPet);
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14 && ! addedObject.getOption(Options.INVULNERABLE)){
|
||||
addDefender(addedObject);
|
||||
// DevLog.debugout("Charon", "TURRET faction creature ", "added " + creature.getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET factionCheckTask", "added " + obj.getCustomName());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
NGECore.getInstance().simulationService.getAllNearNonSameFactionNPCs(60, creature).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat()) {
|
||||
// DevLog.debugout("Charon", "TURRET CHECK faction creature ", "added " + creature.getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET CHECK faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET CHECK factionCheckTask", "added " + obj.getCustomName());
|
||||
// DevLog.debugout("Charon", "TURRET CHECK isFactionEnemy", "res " + NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj));
|
||||
if (obj instanceof CreatureObject && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj)){
|
||||
CreatureObject addedObject = (CreatureObject) obj;
|
||||
if (addedObject.getCalledPet()!=null){
|
||||
CreatureObject calledPet = addedObject.getCalledPet();
|
||||
if (calledPet.getPosture() != 13 && calledPet.getPosture() != 14 & ! calledPet.getOption(Options.INVULNERABLE)){
|
||||
addDefender(calledPet);
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14 & ! addedObject.getOption(Options.INVULNERABLE)){
|
||||
addDefender(addedObject);
|
||||
// DevLog.debugout("Charon", "TURRET faction creature ", "added " + creature.getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
// DevLog.debugout("Charon", "TURRET factionCheckTask", "added " + obj.getCustomName());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
NGECore.getInstance().simulationService.getAllNearNonSameFactionTANOs(60, creature).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat()) {
|
||||
// DevLog.debugout("Charon", "TANO CHECK faction creature ", "added " + creature.getFaction());
|
||||
// DevLog.debugout("Charon", "TANO CHECK faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
// DevLog.debugout("Charon", "TANO CHECK factionCheckTask", "added " + obj.getCustomName());
|
||||
// DevLog.debugout("Charon", "TANO CHECK isFactionEnemy", "res " + NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj));
|
||||
if (obj instanceof TangibleObject && !(obj instanceof CreatureObject) && NGECore.getInstance().factionService.isFactionEnemy((TangibleObject)creature, (TangibleObject)obj)){
|
||||
TangibleObject addedObject = (TangibleObject) obj;
|
||||
addDefender(addedObject);
|
||||
DevLog.debugoutai(this, "Charon", "TANO faction creature ", "added " + creature.getFaction());
|
||||
DevLog.debugoutai(this, "Charon", "TANO faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugoutai(this, "Charon", "TANO factionCheckTask", "added " + obj.getCustomName());
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 0, 1000, TimeUnit.MILLISECONDS);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public TangibleObject getCreature() {
|
||||
return creature;
|
||||
}
|
||||
|
||||
public void setCreature(CreatureObject creature) {
|
||||
this.creature = creature;
|
||||
}
|
||||
|
||||
public Point3D getSpawnPosition() {
|
||||
return spawnPosition;
|
||||
}
|
||||
|
||||
public void setSpawnPosition(Point3D spawnPosition) {
|
||||
this.spawnPosition = spawnPosition;
|
||||
}
|
||||
|
||||
// public void addDefender(CreatureObject defender) {
|
||||
// addDefender(defender, false);
|
||||
// }
|
||||
public void addDefender(TangibleObject defender) {
|
||||
addDefender(defender, false);
|
||||
}
|
||||
|
||||
|
||||
public void addDefender(TangibleObject defender, boolean isAssisting) {
|
||||
creature.addDefender(defender);
|
||||
if(followObject == null)
|
||||
setFollowObject(defender);
|
||||
setCurrentState(new TurretAttackState());
|
||||
// if(!isAssisting) {
|
||||
// NGECore.getInstance().simulationService.get(creature.getPlanet(), creature.getWorldPosition().x, creature.getWorldPosition().z, 38).stream().filter((obj) ->
|
||||
// obj instanceof CreatureObject &&
|
||||
// obj.getAttachment("AI") != null &&
|
||||
// ((TurretAIActor) obj.getAttachment("AI")).getMobileTemplate().getSocialGroup().equals(getMobileTemplate().getSocialGroup()) &&
|
||||
// obj.inRange(creature.getWorldPosition(), ((TurretAIActor) obj.getAttachment("AI")).getMobileTemplate().getAssistRange())
|
||||
// ).forEach((obj) -> ((TurretAIActor) obj.getAttachment("AI")).addDefender(defender, true));
|
||||
// }
|
||||
}
|
||||
|
||||
public void removeDefender(TangibleObject defender) {
|
||||
creature.removeDefender(defender);
|
||||
damageMap.remove(defender);
|
||||
defender.removeDefender(creature);
|
||||
if(followObject == defender) {
|
||||
setFollowObject(getHighestDamageDealer());
|
||||
if(creature.getDefendersList().size() == 0)
|
||||
setCurrentState(new TurretIdleState());
|
||||
}
|
||||
}
|
||||
|
||||
public CreatureObject getHighestDamageDealer() {
|
||||
CreatureObject highestDamageDealer = null;
|
||||
highestDamageDealer = damageMap.keySet().stream().max((c1, c2) -> damageMap.get(c1) - damageMap.get(c2)).orElse(null);
|
||||
// return first defender if no damage has been dealt
|
||||
if(highestDamageDealer == null) {
|
||||
for(TangibleObject tangible : creature.getDefendersList().toArray(new TangibleObject[]{})) {
|
||||
if(tangible instanceof CreatureObject)
|
||||
return (CreatureObject) tangible;
|
||||
}
|
||||
}
|
||||
return highestDamageDealer;
|
||||
}
|
||||
|
||||
public TurretAIState getCurrentState() {
|
||||
return currentState;
|
||||
}
|
||||
|
||||
public void setCurrentState(TurretAIState currentState) {
|
||||
try {
|
||||
if(currentState.getClass() == this.currentState.getClass())
|
||||
return;
|
||||
if(this.currentState != null)
|
||||
doStateAction(this.currentState.onExit(this));
|
||||
this.currentState = currentState;
|
||||
doStateAction(currentState.onEnter(this));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public TangibleObject getFollowObject() {
|
||||
return followObject;
|
||||
}
|
||||
|
||||
public void setFollowObject(TangibleObject followObject) {
|
||||
this.followObject = followObject;
|
||||
}
|
||||
|
||||
public Vector<Point3D> getMovementPoints() {
|
||||
return movementPoints;
|
||||
}
|
||||
|
||||
public void setMovementPoints(Vector<Point3D> movementPoints) {
|
||||
this.movementPoints = movementPoints;
|
||||
}
|
||||
|
||||
public MobileTemplate getMobileTemplate() {
|
||||
return mobileTemplate;
|
||||
}
|
||||
|
||||
public void setMobileTemplate(MobileTemplate mobileTemplate) {
|
||||
this.mobileTemplate = mobileTemplate;
|
||||
}
|
||||
|
||||
public void scheduleRecovery() {
|
||||
TurretAIState caughtAIState = currentState;
|
||||
recoveryFuture = scheduler.schedule(() -> {
|
||||
try {
|
||||
if (caughtAIState.getClass().equals(currentState.getClass()))
|
||||
doStateAction(currentState.recover(TurretAIActor.this));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 2000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void setNextPosition(Point3D position) {
|
||||
movementPoints.add(0, position);
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void handleDamage(DamageTaken event) {
|
||||
CreatureObject attacker = (CreatureObject)event.attacker;
|
||||
if(damageMap.containsKey(attacker))
|
||||
damageMap.put(attacker, damageMap.get(attacker) + event.damage);
|
||||
else
|
||||
damageMap.put(attacker, event.damage);
|
||||
}
|
||||
|
||||
public Map<CreatureObject, Integer> getDamageMap() {
|
||||
return damageMap;
|
||||
}
|
||||
|
||||
public boolean hasReachedPosition() {
|
||||
return hasReachedPosition;
|
||||
}
|
||||
|
||||
public void setHasReachedPosition(boolean hasReachedPosition) {
|
||||
this.hasReachedPosition = hasReachedPosition;
|
||||
}
|
||||
|
||||
public void faceObject(SWGObject object) {
|
||||
// Null checks due to a null error at: float direction =
|
||||
if (object == null) DevLog.debugout("Charon", "AI Actor", "faceObject object is NULL");
|
||||
if (creature == null) DevLog.debugout("Charon", "AI Actor", "faceObject creature is NULL");
|
||||
if (object.getWorldPosition() == null) DevLog.debugout("Charon", "AI Actor", "faceObject object's position is NULL");
|
||||
if (creature.getWorldPosition() == null) DevLog.debugout("Charon", "AI Actor", "faceObject creature's position is NULL");
|
||||
|
||||
float direction = (float) Math.atan2(object.getWorldPosition().x - creature.getWorldPosition().x, object.getWorldPosition().z - creature.getWorldPosition().z);
|
||||
if(direction < 0)
|
||||
direction = (float) (2 * Math.PI + direction);
|
||||
if(Math.abs(direction - creature.getRadians()) < 0.05)
|
||||
return;
|
||||
Quaternion quaternion = new Quaternion((float) Math.cos(direction / 2), 0, (float) Math.sin(direction / 2), 0);
|
||||
if (quaternion.y < 0.0f && quaternion.w > 0.0f) {
|
||||
quaternion.y *= -1;
|
||||
quaternion.w *= -1;
|
||||
}
|
||||
if(creature.getContainer() instanceof CellObject)
|
||||
NGECore.getInstance().simulationService.moveObject(creature, creature.getPosition(), quaternion, creature.getMovementCounter(), 0, (CellObject) creature.getContainer());
|
||||
else
|
||||
NGECore.getInstance().simulationService.moveObject(creature, creature.getPosition(), quaternion, creature.getMovementCounter(), 0, null);
|
||||
|
||||
}
|
||||
|
||||
public long getLastAttackTimestamp() {
|
||||
return lastAttackTimestamp;
|
||||
}
|
||||
|
||||
public void setLastAttackTimestamp(long lastAttackTimestamp) {
|
||||
this.lastAttackTimestamp = lastAttackTimestamp;
|
||||
}
|
||||
|
||||
public long getTimeSinceLastAttack() {
|
||||
return System.currentTimeMillis() - getLastAttackTimestamp();
|
||||
}
|
||||
|
||||
public void doStateAction(byte result) {
|
||||
|
||||
if (creature==null){
|
||||
destroyActor();
|
||||
return;
|
||||
}
|
||||
|
||||
switch(result) {
|
||||
|
||||
case StateResult.DEAD:
|
||||
destroyActor();
|
||||
break;
|
||||
case StateResult.FINISHED:
|
||||
case StateResult.UNFINISHED:
|
||||
return;
|
||||
case StateResult.IDLE:
|
||||
setCurrentState(new TurretIdleState());
|
||||
return;
|
||||
|
||||
//case StateResult.NONE:
|
||||
// System.out.println("State action returned error result");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void scheduleDespawn() {
|
||||
// Sometimes these tasks are null?
|
||||
|
||||
try {
|
||||
if (aggroCheckTask!=null)
|
||||
aggroCheckTask.cancel(true);
|
||||
if (factionCheckTask!=null)
|
||||
factionCheckTask.cancel(true);
|
||||
} catch(Exception e) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
regenTask.cancel(true);
|
||||
} catch(Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void destroyActor(){
|
||||
creature.getEventBus().unsubscribe(this);
|
||||
// Make sure to kill all AI helper threads
|
||||
if (aggroCheckTask!=null)
|
||||
aggroCheckTask.cancel(true);
|
||||
if (factionCheckTask!=null)
|
||||
factionCheckTask.cancel(true);
|
||||
if (regenTask!=null)
|
||||
regenTask.cancel(true);
|
||||
}
|
||||
|
||||
public void cancelAggro(){
|
||||
try {
|
||||
aggroCheckTask.cancel(true);
|
||||
} catch(Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public byte getMilkState() {
|
||||
synchronized(creature.getMutex()) {
|
||||
return milkState;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMilkState(byte milkState) {
|
||||
synchronized(creature.getMutex()) {
|
||||
this.milkState = milkState;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasBeenHarvested() {
|
||||
synchronized(creature.getMutex()) {
|
||||
return hasBeenHarvested;
|
||||
}
|
||||
}
|
||||
|
||||
public void setHasBeenHarvested(boolean hasBeenHarvested) {
|
||||
synchronized(creature.getMutex()) {
|
||||
this.hasBeenHarvested = hasBeenHarvested;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPatrolPoints(Vector<Point3D> patrolPoints){
|
||||
this.patrolPoints = patrolPoints;
|
||||
//setMovementPoints(patrolPoints);
|
||||
}
|
||||
|
||||
public int getPatrolPointIndex() {
|
||||
return patrolPointIndex;
|
||||
}
|
||||
|
||||
public void setPatrolPointIndex(int patrolPointIndex) {
|
||||
this.patrolPointIndex = patrolPointIndex;
|
||||
}
|
||||
|
||||
public Point3D getLoiterDestination() {
|
||||
return loiterDestination;
|
||||
}
|
||||
|
||||
public void setLoiterDestination(Point3D loiterDestination) {
|
||||
this.loiterDestination = loiterDestination;
|
||||
}
|
||||
|
||||
public Point3D getOriginPosition() {
|
||||
return originPosition;
|
||||
}
|
||||
|
||||
public void setOriginPosition(Point3D originPosition) {
|
||||
this.originPosition = originPosition;
|
||||
}
|
||||
|
||||
public String getLoiterDestType() {
|
||||
return loiterDestType;
|
||||
}
|
||||
|
||||
public void setLoiterDestType(String loiterDestType) {
|
||||
this.loiterDestType = loiterDestType;
|
||||
}
|
||||
|
||||
public float getMinLoiterDist() {
|
||||
return minLoiterDist;
|
||||
}
|
||||
|
||||
public void setMinLoiterDist(float minLoiterDist) {
|
||||
this.minLoiterDist = minLoiterDist;
|
||||
}
|
||||
|
||||
public float getMaxLoiterDist() {
|
||||
return maxLoiterDist;
|
||||
}
|
||||
|
||||
public void setMaxLoiterDist(float maxLoiterDist) {
|
||||
this.maxLoiterDist = maxLoiterDist;
|
||||
}
|
||||
|
||||
public String getWaitState() {
|
||||
return waitState;
|
||||
}
|
||||
|
||||
public void setWaitState(String waitState) {
|
||||
this.waitState = waitState;
|
||||
}
|
||||
|
||||
public long getWaitStartTime() {
|
||||
return waitStartTime;
|
||||
}
|
||||
|
||||
public void setWaitStartTime(long waitStartTime) {
|
||||
this.waitStartTime = waitStartTime;
|
||||
}
|
||||
|
||||
public Vector<Point3D> getPatrolPoints() {
|
||||
return patrolPoints;
|
||||
}
|
||||
|
||||
public TurretAIState getIntendedPrimaryTurretAIState() {
|
||||
return intendedPrimaryTurretAIState;
|
||||
}
|
||||
|
||||
public void setIntendedPrimaryTurretAIState(TurretAIState intendedPrimaryTurretAIState) {
|
||||
this.intendedPrimaryTurretAIState = intendedPrimaryTurretAIState;
|
||||
}
|
||||
|
||||
public Point3D getLastPositionBeforeStateChange() {
|
||||
return lastPositionBeforeStateChange;
|
||||
}
|
||||
|
||||
public void setLastPositionBeforeStateChange(
|
||||
Point3D lastPositionBeforeStateChange) {
|
||||
this.lastPositionBeforeStateChange = lastPositionBeforeStateChange;
|
||||
}
|
||||
|
||||
public boolean isPatrolLoop() {
|
||||
return patrolLoop;
|
||||
}
|
||||
|
||||
public void setPatrolLoop(boolean patrolLoop) {
|
||||
this.patrolLoop = patrolLoop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,12 +27,16 @@ import java.util.Vector;
|
||||
import main.NGECore;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import resources.common.SpawnPoint;
|
||||
import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
import services.ai.AIActor;
|
||||
import tools.DevLog;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class AIState {
|
||||
|
||||
public abstract byte onEnter(AIActor actor) throws Exception;
|
||||
@@ -40,6 +44,11 @@ public abstract class AIState {
|
||||
public abstract byte move(AIActor actor) throws Exception;
|
||||
public abstract byte recover(AIActor actor) throws Exception;
|
||||
|
||||
public static long lastExecutionTime = 0L;
|
||||
public static long stateID = 0L;
|
||||
public static long autoStateID = 0L;
|
||||
|
||||
|
||||
public enum StateResult {;
|
||||
|
||||
// default error state result
|
||||
@@ -54,11 +63,187 @@ public abstract class AIState {
|
||||
public static final byte PATROL = 5;
|
||||
public static final byte LOITER = 6;
|
||||
public static final byte FOLLOW = 7;
|
||||
public static final byte ATTACK = 8;
|
||||
|
||||
}
|
||||
|
||||
public boolean findNewPosition(AIActor actor, float speed, float stopDistance, Point3D newPosition) {
|
||||
|
||||
speed *= 0.5; // 2 updates per second
|
||||
CreatureObject creature = actor.getCreature();
|
||||
if (!actor.isActorAlive())
|
||||
return false; // Suppress any further movement when actor is destroyed to prevent reappearing
|
||||
NGECore core = NGECore.getInstance();
|
||||
Point3D currentPosition = creature.getPosition();
|
||||
Point3D targetPosition = null;
|
||||
float maxDistance = stopDistance;
|
||||
boolean finished = false;
|
||||
float dx, dz, newX = 0, newY = 0, newZ = 0;
|
||||
Vector<Point3D> movementPoints = actor.getMovementPoints();
|
||||
Vector<Point3D> patrolPoints = actor.getPatrolPoints();
|
||||
CellObject cell = null;
|
||||
//while(!finished && movementPoints.size() != 0) {
|
||||
|
||||
if ((!(actor.getCurrentState() instanceof FollowState)) && movementPoints.size() == 0 && patrolPoints.size() == 0) {
|
||||
DevLog.debugoutai(actor, "Charon", "AI State findnewpos", "Breakout1");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (movementPoints.size() != 0){
|
||||
try{
|
||||
targetPosition = movementPoints.firstElement();
|
||||
} catch (NoSuchElementException e) {
|
||||
targetPosition = currentPosition;
|
||||
}
|
||||
}
|
||||
|
||||
if (actor.getCurrentState().getClass().equals(PatrolState.class)){
|
||||
targetPosition = patrolPoints.get(actor.getPatrolPointIndex());
|
||||
}
|
||||
|
||||
if (actor.getCurrentState().getClass().equals(WithdrawalState.class)){
|
||||
targetPosition = patrolPoints.get(actor.getPatrolPointIndex());
|
||||
}
|
||||
|
||||
if (actor.getCurrentState().getClass().equals(FollowState.class)){
|
||||
targetPosition = actor.getFollowObject().getWorldPosition();
|
||||
}
|
||||
|
||||
Vector<Point3D> path = core.aiService.findPath(creature.getPlanetId(), currentPosition, targetPosition);
|
||||
|
||||
if (targetPosition==null){
|
||||
DevLog.debugoutai(actor, "Charon", "AI State findnewpos", "Breakout2");
|
||||
return false;
|
||||
}
|
||||
float distanceToTarget = targetPosition.getWorldPosition().getDistance(creature.getWorldPosition());
|
||||
|
||||
if(distanceToTarget > stopDistance) {
|
||||
maxDistance = Math.min(speed, distanceToTarget - stopDistance);
|
||||
} else {
|
||||
/*
|
||||
DevLog.debugoutai(actor, "Charon", "AI State findnewpos", "Breakout3");
|
||||
if (actor.getCurrentState().getClass().equals(RetreatState.class)){
|
||||
if(actor.getIntendedPrimaryAIState().equals(PatrolState.class)){
|
||||
actor.setCurrentState(new PatrolState());
|
||||
}
|
||||
if(actor.getIntendedPrimaryAIState().equals(FollowState.class)){
|
||||
actor.setCurrentState(new FollowState());
|
||||
}
|
||||
if(actor.getIntendedPrimaryAIState().equals(LoiterState.class)){
|
||||
actor.setCurrentState(new LoiterState());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
Point3D oldPosition = null;
|
||||
float pathDistance = 0;
|
||||
|
||||
|
||||
|
||||
for(int i = 1; i < path.size() && !finished; i++) {
|
||||
|
||||
Point3D currentPathPosition = path.get(i);
|
||||
cell = currentPathPosition.getCell();
|
||||
|
||||
if(oldPosition == null)
|
||||
oldPosition = path.get(0);
|
||||
Point3D oldWorldPos = oldPosition.getWorldPosition();
|
||||
|
||||
pathDistance += oldWorldPos.getDistance(currentPathPosition.getWorldPosition());
|
||||
if(pathDistance >= maxDistance || i == path.size() - 1 || currentPathPosition.getCell() != creature.getContainer()) {
|
||||
|
||||
finished = true;
|
||||
|
||||
if(movementPoints.size() != 0 && currentPosition.getWorldPosition().getDistance(currentPathPosition.getWorldPosition()) <= stopDistance && cell == creature.getContainer()) {
|
||||
if(i == path.size() - 1 && movementPoints.size()>0){
|
||||
try {
|
||||
movementPoints.remove(0);
|
||||
} catch (ArrayIndexOutOfBoundsException ex){} // No idea why a vector with size>0 throws this sometimes
|
||||
}
|
||||
finished = false;
|
||||
} else {
|
||||
|
||||
if(cell == null)
|
||||
oldPosition = oldPosition.getWorldPosition();
|
||||
else {
|
||||
if(oldPosition.getCell() == null)
|
||||
oldPosition = core.simulationService.convertPointToModelSpace(oldPosition, cell.getContainer());
|
||||
}
|
||||
|
||||
if(pathDistance > maxDistance) {
|
||||
|
||||
//float distance = oldWorldPos.getDistance(currentPathPosition.getWorldPosition());
|
||||
float distance = NGECore.getInstance().aiService.distanceSquared(oldWorldPos, currentPathPosition.getWorldPosition()); // Ok to use, as distance is not directly used later
|
||||
float travelDistance = distance - (pathDistance - maxDistance);
|
||||
// temp fix for melee npcs
|
||||
travelDistance *= 1.3;
|
||||
if(travelDistance <= 0) {
|
||||
newX = currentPathPosition.x;
|
||||
newZ = currentPathPosition.z;
|
||||
} else {
|
||||
|
||||
if(distance > 0) {
|
||||
dx = currentPathPosition.x - oldPosition.x;
|
||||
dz = currentPathPosition.z - oldPosition.z;
|
||||
//float deltaDist = (float) Math.sqrt((dx * dx) + (dz * dz));
|
||||
int fullong=0; // Approximation->faster
|
||||
int halfshort=0;
|
||||
float tempdx = dx;
|
||||
float tempdz = dz;
|
||||
if (tempdx<0)
|
||||
tempdx*=-1;
|
||||
if (tempdz<0)
|
||||
tempdz*=-1;
|
||||
if(tempdx > tempdz) {
|
||||
fullong = (int)(tempdx*100);
|
||||
halfshort = ((int)(tempdz*100)) >> 1;
|
||||
} else {
|
||||
fullong = (int)(tempdz*100);
|
||||
halfshort = ((int)(tempdx*100)) >> 1;
|
||||
}
|
||||
float deltaDist = (fullong + halfshort)/100;
|
||||
|
||||
newX = (float) (oldPosition.x + (speed * (dx / deltaDist)));
|
||||
newZ = (float) (oldPosition.z + (speed * (dz / deltaDist)));
|
||||
|
||||
|
||||
} else {
|
||||
newX = currentPathPosition.x;
|
||||
newZ = currentPathPosition.z;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(cell == null) {
|
||||
float height = core.terrainService.getHeight(creature.getPlanetId(), newX, newZ);
|
||||
newY = height;
|
||||
} else {
|
||||
newY = currentPathPosition.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
newX = currentPathPosition.x;
|
||||
newZ = currentPathPosition.z;
|
||||
newY = core.terrainService.getHeight(creature.getPlanetId(), newX, newZ);
|
||||
}
|
||||
oldPosition = currentPathPosition;
|
||||
}
|
||||
//}
|
||||
newPosition.x = newX;
|
||||
newPosition.y = newY;
|
||||
newPosition.z = newZ;
|
||||
newPosition.setCell(cell);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean findNewLOSPosition(AIActor actor, float speed, float stopDistance, Point3D newPosition) {
|
||||
|
||||
speed *= 0.5; // 2 updates per second
|
||||
CreatureObject creature = actor.getCreature();
|
||||
NGECore core = NGECore.getInstance();
|
||||
@@ -94,6 +279,41 @@ public abstract class AIState {
|
||||
|
||||
Vector<Point3D> path = core.aiService.findPath(creature.getPlanetId(), currentPosition, targetPosition);
|
||||
|
||||
if (targetPosition==null)
|
||||
return false;
|
||||
if (actor.getFollowObject()==null)
|
||||
return false;
|
||||
|
||||
int attempts = 0;
|
||||
float LOSdistance = targetPosition.getWorldPosition().getDistance(actor.getFollowObject().getWorldPosition());
|
||||
Point3D LOSorigin = actor.getFollowObject().getWorldPosition();
|
||||
float deltaX = actor.getFollowObject().getWorldPosition().x-targetPosition.getWorldPosition().x;
|
||||
float deltaZ = actor.getFollowObject().getWorldPosition().z-targetPosition.getWorldPosition().z;
|
||||
float originAngle = (float) (Math.atan2(deltaX,deltaZ));
|
||||
int sign = 0;
|
||||
while (!core.simulationService.checkLineOfSight(actor.getFollowObject(),targetPosition) && attempts<160){
|
||||
|
||||
float angle = 0;
|
||||
if (sign==0){
|
||||
angle = originAngle + attempts;
|
||||
sign = 1;
|
||||
} else {
|
||||
angle = originAngle - attempts;
|
||||
sign = 0;
|
||||
}
|
||||
if (actor.getFollowObject() instanceof CreatureObject){
|
||||
if (((CreatureObject)actor.getFollowObject()).isPlayer()){
|
||||
System.out.println("CORRECTING LOS");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
targetPosition = new Point3D((float) (LOSorigin.x + LOSdistance * Math.cos(angle)), 0, (float) (LOSorigin.z + LOSdistance * Math.sin(angle)));
|
||||
attempts++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float distanceToTarget = targetPosition.getWorldPosition().getDistance(creature.getWorldPosition());
|
||||
|
||||
if(distanceToTarget > stopDistance) {
|
||||
@@ -195,7 +415,7 @@ public abstract class AIState {
|
||||
float maxDistance = stopDistance;
|
||||
boolean finished = false;
|
||||
float dx, dz, newX = 0, newY = 0, newZ = 0;
|
||||
@SuppressWarnings("unused") Vector<Point3D> movementPoints = actor.getMovementPoints();
|
||||
Vector<Point3D> movementPoints = actor.getMovementPoints();
|
||||
CellObject cell = null;
|
||||
|
||||
targetPosition = actor.getLoiterDestination();
|
||||
@@ -421,8 +641,11 @@ public abstract class AIState {
|
||||
actor.setFollowObject(null);
|
||||
return;
|
||||
}
|
||||
CreatureObject target = actor.getFollowObject();
|
||||
TangibleObject target = actor.getFollowObject();
|
||||
float speed = (float) creature.getRunSpeed();
|
||||
if (creature.getAttachment("IsSlowVehicle")!=null){
|
||||
speed = (float) creature.getWalkSpeed();
|
||||
}
|
||||
float maxDistance = 6;
|
||||
if(creature.getWeaponId() != 0) {
|
||||
WeaponObject weapon = (WeaponObject) core.objectService.getObject(creature.getWeaponId());
|
||||
@@ -439,7 +662,9 @@ public abstract class AIState {
|
||||
maxDistance = 1;
|
||||
|
||||
Point3D newPosition = new Point3D();
|
||||
boolean foundNewPos = findNewPosition(actor, speed, maxDistance, newPosition);
|
||||
|
||||
boolean foundNewPos = false;
|
||||
foundNewPos = findNewPosition(actor, speed, maxDistance, newPosition);
|
||||
|
||||
if(!foundNewPos || (newPosition.x == 0 && newPosition.z == 0))
|
||||
return;
|
||||
@@ -454,20 +679,72 @@ public abstract class AIState {
|
||||
quaternion.w *= -1;
|
||||
}
|
||||
|
||||
core.simulationService.moveObject(creature, newPosition, quaternion, creature.getMovementCounter(), speed, newPosition.getCell());
|
||||
}
|
||||
|
||||
public void doReposition(AIActor actor){
|
||||
|
||||
NGECore core = NGECore.getInstance();
|
||||
|
||||
CreatureObject creature = actor.getCreature();
|
||||
if(creature.getPosture() == 14 || creature.getPosture() == 13) {
|
||||
actor.setFollowObject(null);
|
||||
return;
|
||||
}
|
||||
TangibleObject target = actor.getLastTarget();
|
||||
float speed = (float) creature.getRunSpeed();
|
||||
float maxDistance = 6;
|
||||
if(creature.getWeaponId() != 0) {
|
||||
WeaponObject weapon = (WeaponObject) core.objectService.getObject(creature.getWeaponId());
|
||||
if(weapon != null)
|
||||
maxDistance = weapon.getMaxRange() - 1;
|
||||
} else if(creature.getSlottedObject("default_weapon") != null) {
|
||||
WeaponObject weapon = (WeaponObject) creature.getSlottedObject("default_weapon");
|
||||
if(weapon != null)
|
||||
maxDistance = weapon.getMaxRange() - 1;
|
||||
}
|
||||
Point3D currentPosition = creature.getWorldPosition();
|
||||
|
||||
if(target != null && !core.simulationService.checkLineOfSight(creature, target))
|
||||
maxDistance = 1;
|
||||
|
||||
Point3D newPosition = actor.getRepositionLocation();
|
||||
|
||||
if(newPosition.x == 0 && newPosition.z == 0)
|
||||
return;
|
||||
|
||||
Point3D newWorldPos = newPosition.getWorldPosition();
|
||||
float direction = (float) Math.atan2(newWorldPos.x - currentPosition.x, newWorldPos.z - currentPosition.z);
|
||||
if(direction < 0)
|
||||
direction = (float) (2 * Math.PI + direction);
|
||||
Quaternion quaternion = new Quaternion((float) Math.cos(direction / 2), 0, (float) Math.sin(direction / 2), 0);
|
||||
if (quaternion.y < 0.0f && quaternion.w > 0.0f) {
|
||||
quaternion.y *= -1;
|
||||
quaternion.w *= -1;
|
||||
}
|
||||
|
||||
core.simulationService.moveObject(creature, newPosition, quaternion, creature.getMovementCounter(), speed, newPosition.getCell());
|
||||
|
||||
}
|
||||
|
||||
public void doPatrol(AIActor actor) {
|
||||
//NGECore.getInstance().aiService.logAI("AI STATE doPatrol");
|
||||
|
||||
NGECore core = NGECore.getInstance();
|
||||
|
||||
CreatureObject creature = actor.getCreature();
|
||||
|
||||
if(creature.getPosture() == 14 || creature.getPosture() == 13) {
|
||||
actor.setFollowObject(null);
|
||||
return;
|
||||
}
|
||||
CreatureObject target = actor.getFollowObject();
|
||||
|
||||
if (creature.isInCombat()){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TangibleObject target = actor.getFollowObject();
|
||||
float speed = (float) creature.getWalkSpeed();
|
||||
float maxDistance = 6;
|
||||
if(creature.getWeaponId() != 0) {
|
||||
@@ -481,24 +758,162 @@ public abstract class AIState {
|
||||
}
|
||||
Point3D currentPosition = creature.getWorldPosition();
|
||||
|
||||
if(target != null && !core.simulationService.checkLineOfSight(creature, target))
|
||||
maxDistance = 1;
|
||||
// if(target != null && !core.simulationService.checkLineOfSight(creature, target))
|
||||
// maxDistance = 1;
|
||||
|
||||
// Manage Patrol points
|
||||
maxDistance = 1;
|
||||
if (actor.getPatrolPoints().size()==0)
|
||||
return;
|
||||
Point3D currentDestination = actor.getPatrolPoints().get(actor.getPatrolPointIndex());
|
||||
//System.out.println("currentPosition.getDistance2D(currentDestination)<1) " + currentPosition.getDistance2D(currentDestination));
|
||||
if (currentPosition.getDistance2D(currentDestination)<2){
|
||||
//System.out.println("currentPosition.getDistance2D(currentDestination) " + currentPosition.getDistance2D(currentDestination));
|
||||
if (NGECore.getInstance().aiService.distanceSquared2D(currentPosition, currentDestination)<4){
|
||||
//if (currentPosition.getDistance2D(currentDestination)<4){
|
||||
if (actor.getPatrolPointIndex()<actor.getPatrolPoints().size()-1){
|
||||
actor.setPatrolPointIndex(actor.getPatrolPointIndex()+1);
|
||||
} else {
|
||||
actor.setPatrolPointIndex(0);
|
||||
if (actor.isPatrolLoop())
|
||||
actor.setPatrolPointIndex(0);
|
||||
else {
|
||||
String isInvader = (String) creature.getAttachment("IsInvader");
|
||||
if (isInvader==null)
|
||||
return;
|
||||
// If invader check for in weapon range general
|
||||
if (core.invasionService.getDefensiveGeneral()!=null){
|
||||
if (core.invasionService.getInvasionPhase()==3 && core.invasionService.getDefensiveGeneral().getPosture()!=13 && core.invasionService.getDefensiveGeneral().getPosture()!=14 && core.invasionService.getDistanceToDefensiveGeneral(creature)<2500){
|
||||
actor.addDefender(core.invasionService.getDefensiveGeneral());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are more than 5 invaders at same spot
|
||||
if (NGECore.getInstance().simulationService.getAllNearSameFactionNPCs(7, creature).size()>=4 && NGECore.getInstance().invasionService.getInvasionPhase()!=3){
|
||||
actor.setAIactive(false); // switch off auto-target-recognition to counter lag
|
||||
actor.setCurrentState(new IdleState());
|
||||
//System.out.println("AI switched off!");
|
||||
return;
|
||||
}
|
||||
|
||||
//actor.setCurrentState(new IdleState());
|
||||
// Wait state() Since this state does not require move,recover and all that its simple task
|
||||
|
||||
//NGECore.getInstance().aiService.waitForEvent(actor, NGECore.getInstance().invasionService, "isDefendingGeneralAlive", false, WithdrawalState.class);
|
||||
|
||||
return; // Last Patrol point reached and no loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Point3D newPosition = new Point3D();
|
||||
boolean foundNewPos = findNewPosition(actor, speed, maxDistance, newPosition);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!foundNewPos || (newPosition.x == 0 && newPosition.z == 0))
|
||||
return;
|
||||
|
||||
Point3D newWorldPos = newPosition.getWorldPosition();
|
||||
float direction = (float) Math.atan2(newWorldPos.x - currentPosition.x, newWorldPos.z - currentPosition.z);
|
||||
if(direction < 0)
|
||||
direction = (float) (2 * Math.PI + direction);
|
||||
Quaternion quaternion = new Quaternion((float) Math.cos(direction / 2), 0, (float) Math.sin(direction / 2), 0);
|
||||
if (quaternion.y < 0.0f && quaternion.w > 0.0f) {
|
||||
quaternion.y *= -1;
|
||||
quaternion.w *= -1;
|
||||
}
|
||||
|
||||
// if (newPosition.getCell()==null)
|
||||
// System.out.println("newPosition.getCell() is NULL");
|
||||
try{
|
||||
core.simulationService.moveObject(creature, newPosition, quaternion, creature.getMovementCounter(), speed, newPosition.getCell());
|
||||
} catch (NullPointerException e) {
|
||||
// Just to identify what exactly is null here
|
||||
// if (creature==null)
|
||||
// System.out.print("creature==null" );
|
||||
// if (newPosition==null)
|
||||
// System.out.print("newPosition==null" );
|
||||
// if (quaternion==null)
|
||||
// System.out.print("quaternion==null" );
|
||||
// if (newPosition.getCell()==null)
|
||||
// System.out.print("newPosition.getCell()==null" );
|
||||
//
|
||||
// System.out.print("creature.getMovementCounter() " + creature.getMovementCounter());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doWithdrawal(AIActor actor) {
|
||||
//NGECore.getInstance().aiService.logAI("AI STATE doPatrol");
|
||||
|
||||
NGECore core = NGECore.getInstance();
|
||||
|
||||
if(actor==null)
|
||||
return;
|
||||
CreatureObject creature = actor.getCreature();
|
||||
if(creature==null)
|
||||
return;
|
||||
|
||||
// if (creature.getPlanet().getName().equals("talus") && creature.getTemplate().contains("stormtrooper")){
|
||||
// System.out.println("actor " + actor.getActorID() + " stateID " + stateID + " creatureID"+ creature.getObjectID()+ " TIMEDIFF: " + (System.currentTimeMillis()-lastExecutionTime));
|
||||
// lastExecutionTime = System.currentTimeMillis();
|
||||
// }
|
||||
if(creature.getPosture() == 14 || creature.getPosture() == 13) {
|
||||
actor.setFollowObject(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (creature.isInCombat()){
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
TangibleObject target = actor.getFollowObject();
|
||||
float speed = (float) creature.getWalkSpeed();
|
||||
float maxDistance = 6;
|
||||
if(creature.getWeaponId() != 0) {
|
||||
WeaponObject weapon = (WeaponObject) core.objectService.getObject(creature.getWeaponId());
|
||||
if(weapon != null)
|
||||
maxDistance = weapon.getMaxRange() - 1;
|
||||
} else if(creature.getSlottedObject("default_weapon") != null) {
|
||||
WeaponObject weapon = (WeaponObject) creature.getSlottedObject("default_weapon");
|
||||
if(weapon != null)
|
||||
maxDistance = weapon.getMaxRange() - 1;
|
||||
}
|
||||
Point3D currentPosition = creature.getWorldPosition();
|
||||
|
||||
// if(target != null && !core.simulationService.checkLineOfSight(creature, target))
|
||||
// maxDistance = 1;
|
||||
|
||||
// Manage Patrol points
|
||||
maxDistance = 1;
|
||||
if (actor.getPatrolPoints().size()==0)
|
||||
return;
|
||||
if (actor.getPatrolPointIndex()<=0)
|
||||
actor.setPatrolPointIndex(0);
|
||||
Point3D currentDestination = actor.getPatrolPoints().get(actor.getPatrolPointIndex());
|
||||
//System.out.println("currentPosition.getDistance2D(currentDestination) " + currentPosition.getDistance2D(currentDestination));
|
||||
if (NGECore.getInstance().aiService.distanceSquared2D(currentPosition, currentDestination)<4){
|
||||
//if (currentPosition.getDistance2D(currentDestination)<4){
|
||||
if (actor.getPatrolPointIndex()>0){
|
||||
actor.setPatrolPointIndex(actor.getPatrolPointIndex()-1);
|
||||
} else {
|
||||
if (actor!=null)
|
||||
actor.destroyActor();
|
||||
if (creature!=null){
|
||||
core.simulationService.remove(creature, creature.getWorldPosition().x, creature.getWorldPosition().z, true); // Make sure
|
||||
core.objectService.destroyObject(creature.getObjectID());
|
||||
}
|
||||
return; // First Patrol point reached
|
||||
}
|
||||
}
|
||||
|
||||
Point3D newPosition = new Point3D();
|
||||
boolean foundNewPos = findNewPosition(actor, speed, maxDistance, newPosition);
|
||||
|
||||
|
||||
|
||||
|
||||
if(!foundNewPos || (newPosition.x == 0 && newPosition.z == 0))
|
||||
return;
|
||||
|
||||
@@ -541,7 +956,7 @@ public abstract class AIState {
|
||||
actor.setFollowObject(null);
|
||||
return;
|
||||
}
|
||||
CreatureObject target = actor.getFollowObject();
|
||||
TangibleObject target = actor.getFollowObject();
|
||||
float speed = (float) creature.getWalkSpeed();
|
||||
float maxDistance = 6;
|
||||
if(creature.getWeaponId() != 0) {
|
||||
@@ -654,7 +1069,6 @@ public abstract class AIState {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void doFollow(AIActor actor) {
|
||||
//NGECore.getInstance().aiService.logAI("AI STATE doPatrol");
|
||||
NGECore core = NGECore.getInstance();
|
||||
@@ -664,7 +1078,7 @@ public abstract class AIState {
|
||||
actor.setFollowObject(null);
|
||||
return;
|
||||
}
|
||||
CreatureObject target = actor.getFollowObject();
|
||||
TangibleObject target = actor.getFollowObject();
|
||||
float speed = (float) creature.getRunSpeed();
|
||||
float maxDistance = 6;
|
||||
if(creature.getWeaponId() != 0) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user