mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-27 17:57:22 -04:00
Added more content, tweaked AI resources and buffs
- Added invasion-specific buffs - Added factional handling - Added AI switches - Added construction/repairing - Fixed enemy TANO color when changing status - Fixed notification baselines to consider GCW-specific circumstances - Optimized AI algorithmic complexity by eliminating expensive arithmetic operations - Fixed reposition state to avoid locations in water - Considered tower defense buff for NPCs in combat service - Compacted 3 AI threads into one - Dynamic allocation of AI resources depending on patrol point index and same faction AI density - Added Withdrawal state for more realistic post-battle behaviour - Positioned all pylons, camps, officers, terminals, barricades, turrets, towers, cloners in the appropriate coordinates
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
||||
LOAD.SNAPSHOT_OBJECTS=1
|
||||
LOAD.BUILDOUT_OBJECTS=1
|
||||
#LOAD.BUILDOUT_ONLY_FOR="dathomir"
|
||||
# example: LOAD.BUILDOUT_ONLY_FOR=tatooine
|
||||
LOAD.BUILDOUT_ONLY_FOR=naboo
|
||||
LOAD.RESOURCE.SYSTEM=0
|
||||
|
||||
# Misc
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
return
|
||||
|
||||
def add(core, actor, buff):
|
||||
actor.setGCWFatigue(actor.getGCWFatigue()+1)
|
||||
return
|
||||
|
||||
def remove(core, actor, buff):
|
||||
if actor.getGCWFatigue()>0:
|
||||
actor.setGCWFatigue(actor.getGCWFatigue()-1)
|
||||
# clear defbuff
|
||||
|
||||
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
|
||||
|
||||
@@ -48,6 +48,7 @@ def run(core, actor, target, commandString):
|
||||
|
||||
#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)
|
||||
faction = commandString
|
||||
|
||||
@@ -59,8 +60,8 @@ 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())
|
||||
@@ -72,8 +73,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
|
||||
|
||||
@@ -8,6 +8,7 @@ from java.awt.datatransfer import Clipboard
|
||||
from java.awt import Toolkit
|
||||
from resources.datatables import GcwRank
|
||||
from services.gcw import GCWService
|
||||
import time
|
||||
|
||||
|
||||
def setup():
|
||||
@@ -185,13 +186,61 @@ def run(core, actor, target, commandString):
|
||||
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 == 'showbitmask':
|
||||
latargetID = long(actor.getIntendedTarget())
|
||||
latarget = core.objectService.getObject(latargetID)
|
||||
actor.sendSystemMessage('Optionsbitmask for unit ' + latarget.getCustomName() + ' is %s' % latarget.getOptionsBitmask(), 0)
|
||||
|
||||
elif command == 'suitest':
|
||||
window = core.suiService.createSUIWindow('Script.countdownTimerBar', actor, None, 5)
|
||||
#window.setProperty('bg.caption.lblTitle:Text', 'Titletext')
|
||||
#window.setProperty('text:Text', '10')
|
||||
#window.setProperty('bar.value:Page', '10')
|
||||
window.addDataItem('bar.value', '10')
|
||||
core.suiService.openSUIWindow(window)
|
||||
time.sleep(5)
|
||||
core.suiService.closeSUIWindow(window.getOwner(),window.getWindowId())
|
||||
|
||||
elif command == 'spawninst':
|
||||
|
||||
elif command == 'unknownAbilityPacket' and arg1:
|
||||
#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 == 'unknownAbilityPacket' and arg1:
|
||||
packet = UnknownAbilityPacket(arg1)
|
||||
actor.getClient().getSession().write(packet.serialize())
|
||||
actor.sendSystemMessage('Sent UnknownAbilityPacket for ability ' + arg1, 0)
|
||||
|
||||
@@ -24,6 +24,7 @@ def addTemplate(core):
|
||||
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')
|
||||
|
||||
@@ -31,12 +31,13 @@ def addTemplate(core):
|
||||
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.RIFLE, 2.0, 55, 'energy')
|
||||
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('rangedShot')
|
||||
mobileTemplate.setDefaultAttack('gcw_atst_attack_tower') #gcw_atst_attack_tower #rangedShot
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('imp_invasion_at_st', mobileTemplate)
|
||||
|
||||
@@ -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
|
||||
@@ -25,6 +25,8 @@ def addTemplate(core):
|
||||
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')
|
||||
|
||||
@@ -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
|
||||
@@ -22,7 +22,7 @@ def addTemplate(core):
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
|
||||
mobileTemplate.setAIEnabled(False)
|
||||
mobileTemplate.setNoAI(True)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_rebel_lieutenant_colonel_human_male_01.iff')
|
||||
|
||||
@@ -24,9 +24,10 @@ def addTemplate(core):
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setFaction("rebel")
|
||||
mobileTemplate.setFactionStatus(FactionStatus.Combatant)
|
||||
mobileTemplate.setOptionsBitmask(Options.ATTACKABLE)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/vehicle/shared_walker_at_xt.iff')
|
||||
templates.add('object/mobile/shared_atxt.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
@@ -35,7 +36,7 @@ def addTemplate(core):
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setDefaultAttack('gcw_atst_attack_tower')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_at_xt', mobileTemplate)
|
||||
|
||||
@@ -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
|
||||
@@ -23,6 +23,8 @@ def addTemplate(core):
|
||||
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')
|
||||
|
||||
@@ -11,7 +11,7 @@ from java.util import Vector
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('eow_gcw_city_at_st_2')
|
||||
mobileTemplate.setCreatureName('rebel_battle_droid')
|
||||
mobileTemplate.setLevel(90)
|
||||
mobileTemplate.setDifficulty(Difficulty.BOSS)
|
||||
|
||||
@@ -30,12 +30,12 @@ def addTemplate(core):
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/vehicle/shared_vehicle_atst_ranged.iff', WeaponType.CARBINE, 1.0, 15, 'energy')
|
||||
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('rangedShot')
|
||||
mobileTemplate.setDefaultAttack('gcw_rocket_launch') #fireRocketLauncher #gcw_atst_attack_tower
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('rebel_invasion_hailfire_droid', mobileTemplate)
|
||||
|
||||
@@ -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
|
||||
@@ -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,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
|
||||
@@ -93,6 +93,7 @@ import services.equipment.EquipmentService;
|
||||
import services.gcw.FactionService;
|
||||
import services.gcw.GCWService;
|
||||
import services.gcw.InvasionService;
|
||||
import services.gcw.InvasionService3;
|
||||
import services.GuildService;
|
||||
import services.LoginService;
|
||||
import services.map.MapService;
|
||||
@@ -851,7 +852,7 @@ 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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -187,6 +187,8 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
private transient CreatureObject calledPet;
|
||||
|
||||
private byte locomotion = 0;
|
||||
private short GCWFatigue = 0;
|
||||
private boolean isConstructing = false;
|
||||
|
||||
public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
|
||||
super(objectID, planet, position, orientation, Template);
|
||||
@@ -1885,4 +1887,34 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
public void setCalledPet(CreatureObject calledPet) {
|
||||
this.calledPet = calledPet;
|
||||
}
|
||||
|
||||
public short getGCWFatigue() {
|
||||
return GCWFatigue;
|
||||
}
|
||||
|
||||
public void setGCWFatigue(short 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ package resources.objects.installation;
|
||||
import java.io.Serializable;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import protocol.swg.UpdatePostureMessage;
|
||||
@@ -31,14 +33,18 @@ import protocol.swg.UpdatePostureMessage;
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
|
||||
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.SWGSet;
|
||||
import resources.objects.building.BuildingMessageBuilder;
|
||||
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;
|
||||
@@ -49,32 +55,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) {
|
||||
//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());
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -405,11 +405,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());
|
||||
System.out.println("SENT TO CLIENT!");
|
||||
}
|
||||
getClient().getSession().write(new UpdatePVPStatusMessage(observer.getParent().getObjectID(), NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) this, (CreatureObject) observer.getParent()), getFaction()).serialize());
|
||||
//System.out.println("SENT TO CLIENT!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (getClient() != null) {
|
||||
@@ -430,7 +429,6 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isAttackableBy(CreatureObject attacker) {
|
||||
@@ -636,9 +634,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());
|
||||
@@ -651,6 +666,10 @@ 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());
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
import resources.skills.SkillMod;
|
||||
import services.ai.AIActor;
|
||||
import services.ai.states.FollowState;
|
||||
import services.command.CombatCommand;
|
||||
@@ -130,6 +131,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;
|
||||
}
|
||||
}
|
||||
@@ -191,6 +196,12 @@ public class BuffService implements INetworkDispatch {
|
||||
if(buff.getEffect3Name().length() > 0) core.skillModService.addSkillMod(target, buff.getEffect3Name(), (int) buff.getEffect3Value());
|
||||
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);
|
||||
@@ -266,7 +277,13 @@ public class BuffService implements INetworkDispatch {
|
||||
if(buff.getEffect1Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect3Name(), (int) buff.getEffect3Value());
|
||||
if(buff.getEffect1Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect4Name(), (int) buff.getEffect4Value());
|
||||
if(buff.getEffect1Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect5Name(), (int) buff.getEffect5Value());
|
||||
// }
|
||||
|
||||
if (buff.getBuffName().equals("gcw_fatigue")){
|
||||
if (FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py")) {
|
||||
core.scriptService.callScript("scripts/buffs/", buff.getBuffName(), "remove", core, creature, buff);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if (!buff.getCallback().equals("none") && !buff.getCallback().equals("")) {
|
||||
if (FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py")) {
|
||||
|
||||
@@ -41,6 +41,7 @@ import resources.datatables.WeaponType;
|
||||
import resources.harvest.SurveyTool;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.installation.InstallationObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
@@ -95,6 +96,12 @@ public class DevService implements INetworkDispatch {
|
||||
suiOptions.put((long) 4, "Treasure chest test");
|
||||
if (System.getProperty("user.name").equals("Charon"))
|
||||
suiOptions.put((long) 6, "Dearic attack camp");
|
||||
if (System.getProperty("user.name").equals("Charon"))
|
||||
suiOptions.put((long) 7, "Keren defensive positions");
|
||||
if (System.getProperty("user.name").equals("Charon"))
|
||||
suiOptions.put((long) 8, "Bestine defensive positions");
|
||||
if (System.getProperty("user.name").equals("Charon"))
|
||||
suiOptions.put((long) 9, "Spawn Pylon");
|
||||
if (creature.getClient().isGM())
|
||||
suiOptions.put((long) 200, "Get new CBT");
|
||||
break;
|
||||
@@ -232,13 +239,36 @@ public class DevService implements INetworkDispatch {
|
||||
return;
|
||||
|
||||
case 6: // Locations -890,4, -2994 475,6,-3019
|
||||
core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(475,6,-3019), player.getOrientation(), null);
|
||||
//core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(264, 4, -2950), player.getOrientation(), null); // starport
|
||||
//core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(-930,9, -2994), player.getOrientation(), null);
|
||||
|
||||
//core.invasionService.testPylons();
|
||||
return;
|
||||
case 7: // Locations -890,4, -2994 475,6,-3019
|
||||
//core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(475,6,-3019), player.getOrientation(), null);
|
||||
core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(264, 4, -2950), player.getOrientation(), null);
|
||||
core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("naboo"), new Point3D(1788, 6, 2518), player.getOrientation(), null);
|
||||
//core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(-930,9, -2994), player.getOrientation(), null);
|
||||
|
||||
//core.invasionService.testPylons();
|
||||
return;
|
||||
|
||||
case 8: // Locations -890,4, -2994 475,6,-3019
|
||||
//core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(475,6,-3019), player.getOrientation(), null);
|
||||
core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("tatooine"), new Point3D(-1214,6, -3626), player.getOrientation(), null);
|
||||
//core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName("talus"), new Point3D(-930,9, -2994), player.getOrientation(), null);
|
||||
|
||||
//core.invasionService.testPylons();
|
||||
return;
|
||||
|
||||
case 9:
|
||||
TangibleObject turret = (TangibleObject) NGECore.getInstance().objectService.createObject("object/tangible/destructible/shared_gcw_city_construction_beacon.iff", 0, player.getPlanet(), player.getWorldPosition(), player.getOrientation());
|
||||
NGECore.getInstance().simulationService.add(turret, turret.getPosition().x, turret.getPosition().z, true);
|
||||
float positionY = NGECore.getInstance().terrainService.getHeight(turret.getPlanetId(), turret.getPosition().x, turret.getPosition().z);
|
||||
|
||||
turret.setPosition(new Point3D(turret.getPosition().x,positionY, turret.getPosition().z));
|
||||
return;
|
||||
|
||||
// Character
|
||||
case 10: // Set combat level to 90
|
||||
if (player.getAttachment("hasLeveled") == null) {
|
||||
|
||||
@@ -67,6 +67,7 @@ import resources.common.OutOfBand;
|
||||
import resources.common.ProsePackage;
|
||||
import resources.common.SpawnPoint;
|
||||
import resources.datatables.DisplayType;
|
||||
import resources.datatables.FactionStatus;
|
||||
import resources.datatables.Options;
|
||||
import resources.datatables.PlayerFlags;
|
||||
import resources.datatables.Professions;
|
||||
@@ -526,10 +527,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 +552,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 +598,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 +620,9 @@ public class PlayerService implements INetworkDispatch {
|
||||
creature.updateAllBuffs();
|
||||
}
|
||||
|
||||
creature.setFactionStatus(0);
|
||||
creature.setFactionStatus(FactionStatus.OnLeave);
|
||||
creature.updatePvpStatus();
|
||||
|
||||
core.buffService.addBuffToCreature(creature, "cloning_sickness", creature);
|
||||
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ 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;
|
||||
@@ -289,6 +290,27 @@ public class SimulationService implements INetworkDispatch {
|
||||
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) -> {
|
||||
@@ -1302,8 +1324,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);
|
||||
@@ -1322,6 +1344,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;
|
||||
|
||||
@@ -1358,9 +1383,9 @@ public class SimulationService implements INetworkDispatch {
|
||||
public boolean checkLineOfSight2(SWGObject obj1, Point3D obj2) {
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
float heightOrigin = 1.f;
|
||||
float heightDirection = 1.f;
|
||||
|
||||
float heightOrigin = 1.75f;
|
||||
float heightDirection = 1.75f;
|
||||
|
||||
if(obj1 instanceof CreatureObject)
|
||||
heightOrigin = getHeightOrigin((CreatureObject) obj1);
|
||||
|
||||
@@ -1378,6 +1403,9 @@ public class SimulationService implements INetworkDispatch {
|
||||
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"))
|
||||
@@ -1447,8 +1475,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
|
||||
@@ -1474,6 +1504,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"))
|
||||
|
||||
@@ -239,14 +239,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,16 +212,16 @@ public class TerrainService {
|
||||
}
|
||||
|
||||
if (loaded && config.getInt("LOAD.BUILDOUT_OBJECTS") > 0) {
|
||||
if (!core.getExcludedDevelopers().contains(System.getProperty("user.name"))){
|
||||
if (!core.getExcludedDevelopers().contains(System.getProperty("user.name"))){
|
||||
if (! config.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(config.getString("LOAD.BUILDOUT_ONLY_FOR").trim())){
|
||||
try {
|
||||
core.objectService.loadBuildoutObjects(planet);
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
+145
-98
@@ -93,6 +93,8 @@ public class AIActor {
|
||||
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++;
|
||||
@@ -102,6 +104,23 @@ public class AIActor {
|
||||
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 {
|
||||
@@ -120,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.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 (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();
|
||||
}
|
||||
@@ -163,75 +183,62 @@ public class AIActor {
|
||||
if(creature.getFaction().length()>0 || !creature.getOption(Options.AGGRESSIVE)) {
|
||||
factionCheckTask = scheduler.scheduleAtFixedRate(() -> {
|
||||
try {
|
||||
|
||||
// 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;
|
||||
|
||||
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 && ! addedObject.getOption(Options.INVULNERABLE)){
|
||||
addDefender(addedObject);
|
||||
DevLog.debugoutai(this,"Charon", "faction creature ", "added " + creature.getFaction());
|
||||
DevLog.debugoutai(this,"Charon", "faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugoutai(this,"Charon", "factionCheckTask", "added " + obj.getCustomName());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
NGECore.getInstance().simulationService.getAllNearNonSameFactionNPCs(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 & ! calledPet.getOption(Options.INVULNERABLE)){
|
||||
addDefender(calledPet);
|
||||
}
|
||||
}
|
||||
if (addedObject.getPosture() != 13 && addedObject.getPosture() != 14 & ! addedObject.getOption(Options.INVULNERABLE)){
|
||||
addDefender(addedObject);
|
||||
DevLog.debugoutai(this,"Charon", "faction creature ", "added " + creature.getFaction());
|
||||
DevLog.debugoutai(this,"Charon", "faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugoutai(this,"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.getAllNearNonSameFactionTANOs(15, creature).forEach((obj) -> {
|
||||
if(new Random().nextFloat() <= 0.5 || creature.isInCombat()) {
|
||||
DevLog.debugoutai(this,"Charon", "TANO1 CHECK", creature.getTemplate() + " spotted near " + obj.getTemplate());
|
||||
// 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", "TANO1 faction ", creature.getTemplate() + "added " + creature.getFaction());
|
||||
DevLog.debugoutai(this,"Charon", "TANO1 faction obj", "added " + ((TangibleObject)obj).getFaction());
|
||||
DevLog.debugoutai(this,"Charon", "TANO1 factionCheckTask", "added " + obj.getCustomName());
|
||||
|
||||
// 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 (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();
|
||||
}
|
||||
@@ -281,8 +288,17 @@ public class AIActor {
|
||||
}
|
||||
|
||||
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());
|
||||
@@ -351,6 +367,8 @@ public class AIActor {
|
||||
// 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(() -> {
|
||||
@@ -725,4 +743,33 @@ public class AIActor {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,6 +230,14 @@ public class AIService {
|
||||
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 logAI(String logMsg){
|
||||
if (checkDeveloperIdentity()){
|
||||
System.err.println("AI-LOG: " + logMsg);
|
||||
|
||||
+244
-112
@@ -87,130 +87,149 @@ public abstract class AIState {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (movementPoints.size() != 0){
|
||||
try{
|
||||
targetPosition = movementPoints.firstElement();
|
||||
} catch (NoSuchElementException e) {
|
||||
targetPosition = currentPosition;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
if (actor.getCurrentState().getClass().equals(PatrolState.class)){
|
||||
targetPosition = patrolPoints.get(actor.getPatrolPointIndex());
|
||||
}
|
||||
for(int i = 1; i < path.size() && !finished; i++) {
|
||||
|
||||
if (actor.getCurrentState().getClass().equals(FollowState.class)){
|
||||
targetPosition = actor.getFollowObject().getWorldPosition();
|
||||
}
|
||||
Point3D currentPathPosition = path.get(i);
|
||||
cell = currentPathPosition.getCell();
|
||||
|
||||
Vector<Point3D> path = core.aiService.findPath(creature.getPlanetId(), currentPosition, targetPosition);
|
||||
if(oldPosition == null)
|
||||
oldPosition = path.get(0);
|
||||
Point3D oldWorldPos = oldPosition.getWorldPosition();
|
||||
|
||||
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++) {
|
||||
pathDistance += oldWorldPos.getDistance(currentPathPosition.getWorldPosition());
|
||||
if(pathDistance >= maxDistance || i == path.size() - 1 || currentPathPosition.getCell() != creature.getContainer()) {
|
||||
|
||||
Point3D currentPathPosition = path.get(i);
|
||||
cell = currentPathPosition.getCell();
|
||||
finished = true;
|
||||
|
||||
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)
|
||||
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);
|
||||
finished = false;
|
||||
} else {
|
||||
} 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(cell == null)
|
||||
oldPosition = oldPosition.getWorldPosition();
|
||||
else {
|
||||
if(oldPosition.getCell() == null)
|
||||
oldPosition = core.simulationService.convertPointToModelSpace(oldPosition, cell.getContainer());
|
||||
}
|
||||
if(pathDistance > maxDistance) {
|
||||
|
||||
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 {
|
||||
|
||||
float distance = oldWorldPos.getDistance(currentPathPosition.getWorldPosition());
|
||||
float travelDistance = distance - (pathDistance - maxDistance);
|
||||
// temp fix for melee npcs
|
||||
travelDistance *= 1.3;
|
||||
if(travelDistance <= 0) {
|
||||
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;
|
||||
} else {
|
||||
|
||||
if(distance > 0) {
|
||||
dx = currentPathPosition.x - oldPosition.x;
|
||||
dz = currentPathPosition.z - oldPosition.z;
|
||||
float deltaDist = (float) Math.sqrt((dx * dx) + (dz * dz));
|
||||
|
||||
|
||||
newX = (float) (oldPosition.x + (speed * (dx / deltaDist)));
|
||||
newZ = (float) (oldPosition.z + (speed * (dz / deltaDist)));
|
||||
|
||||
// if (creature.getPlanet().getName().equals("talus") && creature.getTemplate().contains("stormtrooper")){
|
||||
// float magnitude = (float)Math.sqrt(newX*newX + newZ*newZ);
|
||||
// System.out.println("magnitude: " + magnitude);
|
||||
// }
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
} else {
|
||||
newX = currentPathPosition.x;
|
||||
newZ = currentPathPosition.z;
|
||||
newY = core.terrainService.getHeight(creature.getPlanetId(), newX, newZ);
|
||||
}
|
||||
oldPosition = currentPathPosition;
|
||||
}
|
||||
//}
|
||||
newPosition.x = newX;
|
||||
newPosition.y = newY;
|
||||
@@ -712,10 +731,7 @@ public abstract class AIState {
|
||||
NGECore core = NGECore.getInstance();
|
||||
|
||||
CreatureObject creature = actor.getCreature();
|
||||
// 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;
|
||||
@@ -740,8 +756,8 @@ 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;
|
||||
@@ -749,17 +765,29 @@ public abstract class AIState {
|
||||
return;
|
||||
Point3D currentDestination = actor.getPatrolPoints().get(actor.getPatrolPointIndex());
|
||||
//System.out.println("currentPosition.getDistance2D(currentDestination) " + currentPosition.getDistance2D(currentDestination));
|
||||
if (currentPosition.getDistance2D(currentDestination)<2){
|
||||
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 {
|
||||
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.getInvasionPhase()==3 && core.invasionService.getDistanceToDefensiveGeneral(creature)<50){
|
||||
if (core.invasionService.getInvasionPhase()==3 && core.invasionService.getDistanceToDefensiveGeneral(creature)<2500){
|
||||
actor.addDefender(core.invasionService.getDefensiveGeneral());
|
||||
}
|
||||
|
||||
// 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; // Last Patrol point reached and no loop
|
||||
}
|
||||
}
|
||||
@@ -771,6 +799,110 @@ public abstract class AIState {
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ public class AttackState extends AIState {
|
||||
@Override
|
||||
public byte move(AIActor actor) {
|
||||
CreatureObject creature = actor.getCreature();
|
||||
if (creature==null)
|
||||
return StateResult.FINISHED;
|
||||
|
||||
if(creature.getPosture() == 14)
|
||||
return StateResult.DEAD;
|
||||
actor.getMovementPoints().clear();
|
||||
@@ -77,12 +80,15 @@ public class AttackState extends AIState {
|
||||
if (actor.getIntendedPrimaryAIState().getClass().equals(FollowState.class))
|
||||
checkPosition = creature.getWorldPosition();
|
||||
|
||||
if(checkPosition.getDistance(creature.getWorldPosition()) > 128 || NGECore.getInstance().terrainService.isWater(creature.getPlanetId(), actor.getFollowObject().getWorldPosition())) {
|
||||
actor.removeDefender(actor.getFollowObject());
|
||||
//actor.scheduleMovement();
|
||||
//return StateResult.UNFINISHED;
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
try {
|
||||
if(checkPosition.getDistance(creature.getWorldPosition()) > 128 || NGECore.getInstance().terrainService.isWater(creature.getPlanetId(), actor.getFollowObject().getWorldPosition())) {
|
||||
actor.removeDefender(actor.getFollowObject());
|
||||
//actor.scheduleMovement();
|
||||
//return StateResult.UNFINISHED;
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
} catch (Exception ex){} // When the followobject turns becomes null inside the if scope an npe can occur
|
||||
|
||||
float maxDistance = 0;
|
||||
if(creature.getWeaponId() != 0) {
|
||||
WeaponObject weapon = (WeaponObject) NGECore.getInstance().objectService.getObject(creature.getWeaponId());
|
||||
@@ -104,9 +110,13 @@ public class AttackState extends AIState {
|
||||
return StateResult.UNFINISHED;
|
||||
}
|
||||
} catch (Exception e){
|
||||
DevLog.debugoutai(actor, "Charon", "AI Attack State Exception move method", "actor " + actor);
|
||||
if (actor!=null)
|
||||
DevLog.debugoutai(actor, "Charon", "AI Attack State Exception move method", "actor " + actor);
|
||||
if (actor.getFollowObject()!=null)
|
||||
DevLog.debugoutai(actor, "Charon", "AI Attack State Exception move method", "actor.getFollowObject() " + actor.getFollowObject());
|
||||
if (actor.getFollowObject()!=null)
|
||||
DevLog.debugoutai(actor, "Charon", "AI Attack State Exception move method", "actor.getFollowObject().getWorldPosition() " + actor.getFollowObject().getWorldPosition());
|
||||
if (creature!=null)
|
||||
DevLog.debugoutai(actor, "Charon", "AI Attack State Exception move method", "creature.getWorldPosition() " + creature.getWorldPosition());
|
||||
}
|
||||
|
||||
@@ -208,6 +218,29 @@ public class AttackState extends AIState {
|
||||
actor.scheduleRecovery();
|
||||
return StateResult.UNFINISHED;
|
||||
}
|
||||
} else {
|
||||
TangibleObject targetObject = (TangibleObject) target;
|
||||
if((targetObject.getConditionDamage()>=targetObject.getMaximumCondition())) {
|
||||
|
||||
actor.setFollowObject(actor.getHighestDamageDealer());
|
||||
target = (CreatureObject) actor.getFollowObject();
|
||||
if(target == null)
|
||||
{
|
||||
creature.setLookAtTarget(0);
|
||||
creature.setIntendedTarget(0);
|
||||
|
||||
}
|
||||
actor.setFollowObject(null);
|
||||
actor.removeDefender(target);
|
||||
|
||||
if (actor.getIntendedPrimaryAIState().getClass().equals(PatrolState.class))
|
||||
actor.setCurrentState(new RetreatState()); // Should be Patrol state
|
||||
else {
|
||||
actor.setCurrentState(new RetreatState()); // Should be Patrol state
|
||||
}
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(target.getWorldPosition().getDistance(creature.getWorldPosition()) > maxDistance) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class DeathState extends AIState {
|
||||
if (killer.isPlayer()) // No point to do this for NPCs
|
||||
NGECore.getInstance().lootService.DropLoot(killer,(TangibleObject)(actor.getCreature()));
|
||||
}
|
||||
actor.destroyActor(); // to prevent standing up right after death
|
||||
//actor.destroyActor(); // to prevent standing up right after death
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class PatrolState extends AIState {
|
||||
}
|
||||
CreatureObject creature = actor.getCreature();
|
||||
if(creature.isInCombat()){
|
||||
System.out.println("PatrolState locking!");
|
||||
//System.out.println("PatrolState locking!");
|
||||
locked = true;
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import engine.resources.scene.Point3D;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import services.ai.AIActor;
|
||||
import services.ai.states.AIState.StateResult;
|
||||
import tools.DevLog;
|
||||
|
||||
/**
|
||||
@@ -12,6 +13,9 @@ import tools.DevLog;
|
||||
*/
|
||||
|
||||
public class RepositionState extends AIState{
|
||||
|
||||
int prog = 10;
|
||||
|
||||
@Override
|
||||
public byte onEnter(AIActor actor) {
|
||||
DevLog.debugoutai(actor, "Charon", "AI RepositionState", "onEnter");
|
||||
@@ -27,53 +31,123 @@ public class RepositionState extends AIState{
|
||||
TangibleObject tempObject = new TangibleObject(); // LOS overload for pos and creature does not work correctly
|
||||
tempObject.setPosition(scanPosition);
|
||||
boolean breakout = false;
|
||||
while (!NGECore.getInstance().simulationService.checkLineOfSight2(target,scanPosition) && !breakout){
|
||||
boolean foundPos = false;
|
||||
actor.setProgressionMarker(1);
|
||||
long repositionCalculationStart = System.currentTimeMillis(); // Limit time this is calculated to prevent deadloops
|
||||
while (!NGECore.getInstance().simulationService.checkLineOfSight(target,scanPosition) && !breakout || System.currentTimeMillis()>repositionCalculationStart+2000){
|
||||
// Quick, light-weight way to get the AI into a firing LOS position
|
||||
// ToDo: Check if the Quadnode at the LOS position contains a structure
|
||||
// Required: Add according method to Quadtree.java
|
||||
for (int x=2;x<50 && (!NGECore.getInstance().simulationService.checkLineOfSight2(target,scanPosition));x=x+2){
|
||||
scanPosition = new Point3D(creaturePosition.x+x,creaturePosition.y,creaturePosition.z);
|
||||
|
||||
boolean abortCondition = false;
|
||||
for (int x=1;x<50 && !abortCondition;x=x+1){
|
||||
if (NGECore.getInstance().simulationService.checkLineOfSight(target,new Point3D(creaturePosition.x+x,creaturePosition.y,creaturePosition.z)) && !NGECore.getInstance().terrainService.isWater(creature.getPlanetId(), creaturePosition.x+x, creaturePosition.z)){
|
||||
scanPosition = new Point3D(creaturePosition.x+x,creaturePosition.y,creaturePosition.z);
|
||||
abortCondition = true;
|
||||
}
|
||||
}
|
||||
for (int x=2;x>-50 && (!NGECore.getInstance().simulationService.checkLineOfSight2(target,scanPosition));x=x-2){
|
||||
scanPosition = new Point3D(creaturePosition.x+x,creaturePosition.y,creaturePosition.z);
|
||||
for (int x=-1;x>-50 && !abortCondition;x=x-1){
|
||||
if (NGECore.getInstance().simulationService.checkLineOfSight(target,new Point3D(creaturePosition.x+x,creaturePosition.y,creaturePosition.z)) && !NGECore.getInstance().terrainService.isWater(creature.getPlanetId(), creaturePosition.x+x, creaturePosition.z)){
|
||||
scanPosition = new Point3D(creaturePosition.x+x,creaturePosition.y,creaturePosition.z);
|
||||
abortCondition = true;
|
||||
}
|
||||
}
|
||||
for (int z=2;z<50 && (!NGECore.getInstance().simulationService.checkLineOfSight2(target,scanPosition));z=z+2){
|
||||
scanPosition = new Point3D(creaturePosition.x,creaturePosition.y,creaturePosition.z+z);
|
||||
for (int z=1;z<50 && !abortCondition;z=z+1){
|
||||
if (NGECore.getInstance().simulationService.checkLineOfSight(target,new Point3D(creaturePosition.x,creaturePosition.y,creaturePosition.z+z)) && !NGECore.getInstance().terrainService.isWater(creature.getPlanetId(), creaturePosition.x, creaturePosition.z+z)){
|
||||
scanPosition = new Point3D(creaturePosition.x,creaturePosition.y,creaturePosition.z+z);
|
||||
abortCondition = true;
|
||||
}
|
||||
}
|
||||
for (int z=2;z>-50 && (!NGECore.getInstance().simulationService.checkLineOfSight2(target,scanPosition));z=z-2){
|
||||
scanPosition = new Point3D(creaturePosition.x,creaturePosition.y,creaturePosition.z+z);
|
||||
for (int z=-1;z>-50 && !abortCondition;z=z-1){
|
||||
if (NGECore.getInstance().simulationService.checkLineOfSight(target,new Point3D(creaturePosition.x,creaturePosition.y,creaturePosition.z+z)) && !NGECore.getInstance().terrainService.isWater(creature.getPlanetId(), creaturePosition.x, creaturePosition.z+z)){
|
||||
scanPosition = new Point3D(creaturePosition.x,creaturePosition.y,creaturePosition.z+z);
|
||||
abortCondition = true;
|
||||
}
|
||||
}
|
||||
// if (!NGECore.getInstance().simulationService.checkLineOfSight2(target,scanPosition))
|
||||
// breakout=true;
|
||||
actor.setProgressionMarker(2);
|
||||
|
||||
if (!NGECore.getInstance().simulationService.checkLineOfSight(target,scanPosition)){
|
||||
foundPos=true;
|
||||
}
|
||||
|
||||
// else
|
||||
// System.out.println("LOS found");
|
||||
//
|
||||
breakout=true;
|
||||
}
|
||||
actor.setRepositionLocation(scanPosition);
|
||||
actor.setRepositionStartTime(System.currentTimeMillis());
|
||||
actor.setProgressionMarker(3);
|
||||
if (foundPos){
|
||||
actor.setRepositionLocation(scanPosition);
|
||||
actor.setRepositionStartTime(System.currentTimeMillis());
|
||||
} else {
|
||||
float positionY = NGECore.getInstance().terrainService.getHeight(target.getPlanetId(), target.getPosition().x, target.getPosition().z);
|
||||
actor.setRepositionLocation(new Point3D(target.getWorldPosition().x,positionY,target.getWorldPosition().z));
|
||||
actor.setRepositionStartTime(System.currentTimeMillis()+5000); // give it more time
|
||||
}
|
||||
|
||||
return 0;
|
||||
actor.scheduleMovement();
|
||||
return StateResult.UNFINISHED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte onExit(AIActor actor) {
|
||||
// TODO Auto-generated method stub
|
||||
// TODO Auto-generated method stub
|
||||
actor.setProgressionMarker(9);
|
||||
TangibleObject followObject = actor.getFollowObject();
|
||||
if (followObject==null)
|
||||
return StateResult.FINISHED;
|
||||
|
||||
if (followObject instanceof CreatureObject)
|
||||
if (((CreatureObject) followObject).getPosture()==14 || ((CreatureObject) followObject).getPosture()==13)
|
||||
actor.setFollowObject(null);
|
||||
|
||||
if (! (followObject instanceof CreatureObject))
|
||||
if(followObject.getConditionDamage()>=followObject.getMaximumCondition())
|
||||
actor.setFollowObject(null);
|
||||
|
||||
DevLog.debugoutai(actor, "Charon", "AI RepositionState", "exit");
|
||||
return 0;
|
||||
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte move(AIActor actor) {
|
||||
DevLog.debugoutai(actor, "Charon", "AI RepositionState", "move");
|
||||
|
||||
actor.setProgressionMarker(prog++);
|
||||
Point3D newPosition = actor.getRepositionLocation();
|
||||
TangibleObject target = actor.getLastTarget();
|
||||
if (target==null)
|
||||
if (target==null){
|
||||
if (actor.getIntendedPrimaryAIState().getClass().equals(PatrolState.class))
|
||||
actor.setCurrentState(new RetreatState());
|
||||
else {
|
||||
actor.setCurrentState(new RetreatState());
|
||||
}
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
if (target instanceof CreatureObject)
|
||||
if (((CreatureObject) target).getPosture()==14 || ((CreatureObject) target).getPosture()==13){
|
||||
if (actor.getIntendedPrimaryAIState().getClass().equals(PatrolState.class))
|
||||
actor.setCurrentState(new RetreatState());
|
||||
else {
|
||||
actor.setCurrentState(new RetreatState());
|
||||
}
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
if (! (target instanceof CreatureObject))
|
||||
if(target.getConditionDamage()>=target.getMaximumCondition()){
|
||||
if (actor.getIntendedPrimaryAIState().getClass().equals(PatrolState.class))
|
||||
actor.setCurrentState(new RetreatState());
|
||||
else {
|
||||
actor.setCurrentState(new RetreatState());
|
||||
}
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
if (newPosition.getDistance2D(target.getWorldPosition())<0.5 || System.currentTimeMillis()>actor.getRepositionStartTime()+5000){
|
||||
actor.addDefender(target);
|
||||
actor.setCurrentState(new AttackState());
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package services.ai.states;
|
||||
|
||||
import resources.datatables.Options;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import services.ai.AIActor;
|
||||
import services.ai.states.AIState.StateResult;
|
||||
import tools.DevLog;
|
||||
|
||||
public class WithdrawalState extends AIState {
|
||||
private boolean locked = false;
|
||||
|
||||
|
||||
@Override
|
||||
public byte onEnter(AIActor actor) {
|
||||
|
||||
DevLog.debugoutai(actor, "Charon", "AI WithdrawalState", "WITHDRAWAL ENTERED!");
|
||||
CreatureObject creature = actor.getCreature();
|
||||
if (creature==null)
|
||||
return 0;
|
||||
creature.setOptions(Options.INVULNERABLE, true);
|
||||
if(creature.getPosture() == 14)
|
||||
return StateResult.DEAD;
|
||||
actor.setPatrolPointIndex(actor.getPatrolPointIndex()-1);
|
||||
actor.scheduleMovement();
|
||||
actor.scheduleRecovery();
|
||||
return StateResult.UNFINISHED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte onExit(AIActor actor) {
|
||||
DevLog.debugoutai(actor, "Charon", "AI WithdrawalState", "EXITING WITHDRAWAL STATE!");
|
||||
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte move(AIActor actor) {
|
||||
DevLog.debugoutai(actor, "Charon", "AI WithdrawalState", "WITHDRAWAL MOVE!");
|
||||
if (locked){
|
||||
System.out.println("WITHDRAWAL locked!");
|
||||
return StateResult.FINISHED;
|
||||
}
|
||||
if (actor==null)
|
||||
return StateResult.FINISHED;
|
||||
CreatureObject creature = actor.getCreature();
|
||||
if (creature==null)
|
||||
return StateResult.FINISHED;
|
||||
|
||||
// if(creature.isInCombat()){
|
||||
// //System.out.println("PatrolState locking!");
|
||||
// locked = true;
|
||||
// return StateResult.FINISHED;
|
||||
// }
|
||||
doWithdrawal(actor);
|
||||
actor.scheduleMovement();
|
||||
return StateResult.UNFINISHED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte recover(AIActor actor) {
|
||||
if (actor.getFollowObject()!=null)
|
||||
System.out.println("recover follow object is not null");
|
||||
if (actor.getFollowObject()!=null)
|
||||
System.out.println("recover follow object is not null");
|
||||
return StateResult.UNFINISHED;
|
||||
}
|
||||
}
|
||||
@@ -795,6 +795,7 @@ public class CombatService implements INetworkDispatch {
|
||||
String animationStr = command.getRandomAnimation(weapon); // choosing turretShot as default attack, results in a zero length string
|
||||
if (weapon.getTemplate().contains("atst_ranged"))
|
||||
animationStr="fire_1_single_light";
|
||||
|
||||
CombatAction combatAction = new CombatAction(CRC.StringtoCRC(animationStr), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC());
|
||||
|
||||
// int turret_fire = 0xD334C0B8; // 0xA7595B4E
|
||||
@@ -1089,10 +1090,14 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
if (!attacker.isPlayer()){
|
||||
if (attacker.hasBuff("expertise_damage_npc")){
|
||||
rawDamage *=2; // tower_defense buff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rawDamage;
|
||||
|
||||
return rawDamage;
|
||||
}
|
||||
|
||||
private float calculateDamageForInstallation(InstallationObject attacker, TangibleObject target, WeaponObject weapon, CombatCommand command) {
|
||||
|
||||
@@ -240,13 +240,22 @@ public class FactionService implements INetworkDispatch {
|
||||
PyObject method = core.scriptService.getMethod("scripts/faction/", objectFaction, "isEnemy");
|
||||
|
||||
if (method != null && method.isCallable()) {
|
||||
return ((method.__call__(Py.java2py(targetFaction)).asInt() == 1) ? true : false);
|
||||
int checkResult = method.__call__(Py.java2py(targetFaction)).asInt();
|
||||
if (objectFaction.equals("rebel") || objectFaction.equals("imperial")){
|
||||
if (object.getFactionStatus()==FactionStatus.OnLeave)
|
||||
checkResult=0;
|
||||
}
|
||||
if (targetFaction.equals("rebel") || targetFaction.equals("imperial")){
|
||||
if (target.getFactionStatus()==FactionStatus.OnLeave)
|
||||
checkResult=0;
|
||||
}
|
||||
return ((checkResult == 1) ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Calculates the target's pvp bitmask based on the person's
|
||||
* faction standing and the enemy's options bitmask.
|
||||
@@ -267,6 +276,10 @@ public class FactionService implements INetworkDispatch {
|
||||
PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost");
|
||||
|
||||
int pvpBitmask = 0;
|
||||
|
||||
if (target==null)
|
||||
return 0; // Avoids infinite loading screen when another player character has been deleted,
|
||||
// but is still referenced by some collections being null
|
||||
|
||||
if (object == target) {
|
||||
pvpBitmask |= PvpStatus.Self;
|
||||
@@ -291,7 +304,7 @@ public class FactionService implements INetworkDispatch {
|
||||
if (target.getFactionStatus() == FactionStatus.SpecialForces) {
|
||||
pvpBitmask |= PvpStatus.Overt;
|
||||
}
|
||||
|
||||
|
||||
// Everything below assumes target is potentially attackable.
|
||||
if (!target.getOption(Options.ATTACKABLE) || target.getOption(Options.INVULNERABLE)) {
|
||||
return pvpBitmask;
|
||||
@@ -568,7 +581,14 @@ public class FactionService implements INetworkDispatch {
|
||||
upvpm.setStatus(NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), creo));
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
}
|
||||
if (obj instanceof InstallationObject){
|
||||
if (obj instanceof TangibleObject && !(obj instanceof CreatureObject)){
|
||||
TangibleObject tano = (TangibleObject) obj;
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(tano.getObjectID());
|
||||
upvpm.setFaction(CRC.StringtoCRC(tano.getFaction()));
|
||||
upvpm.setStatus(NGECore.getInstance().factionService.calculatePvpStatus((TangibleObject) destination.getParent(), tano));
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
}
|
||||
if (obj instanceof InstallationObject && !(obj instanceof TangibleObject)){
|
||||
InstallationObject inso = (InstallationObject) obj;
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(inso.getObjectID());
|
||||
upvpm.setFaction(CRC.StringtoCRC(inso.getFaction()));
|
||||
|
||||
+289
-347
@@ -21,18 +21,34 @@
|
||||
******************************************************************************/
|
||||
package services.gcw;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
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.TimeUnit;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.PlayClientEffectObjectMessage;
|
||||
import protocol.swg.PlayClientEffectObjectTransformMessage;
|
||||
import protocol.swg.UpdateContainmentMessage;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
import main.NGECore;
|
||||
import resources.datatables.FactionStatus;
|
||||
import resources.datatables.Factions;
|
||||
import resources.datatables.Options;
|
||||
import resources.datatables.WeaponType;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.installation.InstallationObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
import services.ai.TurretAIActor;
|
||||
import services.gcw.GCWSpawner.PatrolRoute;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
@@ -44,50 +60,21 @@ public class GCWPylon extends TangibleObject{
|
||||
private int pylonType = 0;
|
||||
private int pylonFaction = 0;
|
||||
private int spawnLevel = 0;
|
||||
private int totalSpawnedUnits = 0;
|
||||
private String[] soldierTemplates = new String[]{""};
|
||||
private String[] rebelSoldierTemplates1 = new String[]{""};
|
||||
private String[] rebelSoldierTemplates2 = new String[]{""};
|
||||
private String[] rebelSoldierTemplates3 = new String[]{"gcw_city_rebel_soldier"};
|
||||
private String[] imperialSoldierTemplates1 = new String[]{""};
|
||||
private String[] imperialSoldierTemplates2 = new String[]{""};
|
||||
private String[] imperialSoldierTemplates3 = new String[]{"elite_imperial_stormtrooper_90"};
|
||||
private int patrolRoute = 0;
|
||||
private int resourceFilling = 0;
|
||||
private int delay = 0;
|
||||
|
||||
private String[] vehicleTemplates = new String[]{""};
|
||||
private String[] rebelVehicleTemplates1 = new String[]{"rebel_invasion_at_xt"};
|
||||
private String[] rebelVehicleTemplates2 = new String[]{"rebel_invasion_at_xt"};
|
||||
private String[] rebelVehicleTemplates3 = new String[]{"rebel_invasion_at_xt"};
|
||||
private String[] imperialVehicleTemplates1 = new String[]{"imp_invasion_at_st"};
|
||||
private String[] imperialVehicleTemplates2 = new String[]{"imp_invasion_at_st"};
|
||||
private String[] imperialVehicleTemplates3 = new String[]{"imp_invasion_at_st"};
|
||||
private static Map<Integer,String> typeStfMapping = new ConcurrentHashMap<Integer,String>();
|
||||
static{
|
||||
typeStfMapping.put(PylonType.SoldierPatrol, "Soldier Patrol Pylon");
|
||||
typeStfMapping.put(PylonType.SoldierDefense, "Soldier Patrol Pylon");
|
||||
typeStfMapping.put(PylonType.VehiclePatrol, "Soldier Patrol Pylon");
|
||||
typeStfMapping.put(PylonType.SiegeVehiclePatrol, "Soldier Patrol Pylon");
|
||||
typeStfMapping.put(PylonType.Barricade, "Soldier Patrol Pylon");
|
||||
typeStfMapping.put(PylonType.Turret, "Soldier Patrol Pylon");
|
||||
typeStfMapping.put(PylonType.Tower, "Soldier Patrol Pylon");
|
||||
}
|
||||
|
||||
private String[] siegeVehicleTemplates = new String[]{""};
|
||||
private String[] rebelSiegeVehicleTemplates1 = new String[]{"rebel_invasion_hailfire_droid"};
|
||||
private String[] rebelSiegeVehicleTemplates2 = new String[]{"rebel_invasion_hailfire_droid"};
|
||||
private String[] rebelSiegeVehicleTemplates3 = new String[]{"rebel_invasion_hailfire_droid"};
|
||||
private String[] imperialSiegeVehicleTemplates1 = new String[]{"imp_invasion_at_at"};
|
||||
private String[] imperialSiegeVehicleTemplates2 = new String[]{"imp_invasion_at_at"};
|
||||
private String[] imperialSiegeVehicleTemplates3 = new String[]{"imp_invasion_at_at"};
|
||||
|
||||
private String barricadeTemplate = "";
|
||||
private String rebelBarricadeTemplate = "object/tangible/destructible/shared_gcw_rebel_barricade.iff";
|
||||
private String imperialBarricadeTemplate = "object/tangible/destructible/shared_gcw_imperial_barricade.iff";
|
||||
|
||||
|
||||
private String turretTemplates = "";
|
||||
private String[] rebelTurretTemplates1 = new String[]{""};
|
||||
private String[] rebelTurretTemplates2 = new String[]{""};
|
||||
private String[] rebelTurretTemplates3 = new String[]{"object/tangible/destructible/shared_gcw_rebel_turret.iff"};
|
||||
private String[] imperialTurretTemplates1 = new String[]{""};
|
||||
private String[] imperialTurretTemplates2 = new String[]{""};
|
||||
private String[] imperialTurretTemplates3 = new String[]{"object/tangible/destructible/shared_gcw_imperial_turret.iff"};
|
||||
|
||||
private String towerTemplate = "";
|
||||
private String rebelTowerTemplate = "object/tangible/destructible/shared_gcw_rebel_tower.iff";
|
||||
private String imperialTowerTemplate = "object/tangible/destructible/shared_gcw_imperial_tower.iff";
|
||||
|
||||
private Vector<Point3D> patrolRoute = new Vector<Point3D>();
|
||||
private CreatureObject lastDefender = null;
|
||||
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
@@ -96,7 +83,9 @@ public class GCWPylon extends TangibleObject{
|
||||
}
|
||||
|
||||
public GCWPylon(long objectID, Planet planet, Point3D position, Quaternion orientation, String template){
|
||||
super(objectID, planet, position, orientation, template);
|
||||
super(objectID, planet, position, orientation, template);
|
||||
this.setAttachment("Filling",0);
|
||||
this.setResourceFilling(0);
|
||||
}
|
||||
|
||||
public int getPylonType() {
|
||||
@@ -106,53 +95,26 @@ public class GCWPylon extends TangibleObject{
|
||||
public void setPylonType(int pylonType) {
|
||||
this.pylonType = pylonType;
|
||||
|
||||
if (pylonType==PylonType.SoldierPatrol){
|
||||
scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
spawnSoldier();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 60, TimeUnit.SECONDS);
|
||||
String pylonName = "";
|
||||
switch (pylonType){
|
||||
case PylonType.Barricade: pylonName="Barricade Construction Site";
|
||||
break;
|
||||
case PylonType.SoldierDefense: pylonName="Soldier Construction Site";
|
||||
break;
|
||||
case PylonType.SoldierPatrol: pylonName="Patrol Construction Site";
|
||||
break;
|
||||
case PylonType.VehiclePatrol: pylonName="Vehicle Construction Site";
|
||||
break;
|
||||
case PylonType.SiegeVehiclePatrol: pylonName="Siege Vehicle Construction Site";
|
||||
break;
|
||||
case PylonType.Tower: pylonName="Tower Construction Site";
|
||||
break;
|
||||
case PylonType.Turret: pylonName="Turret Construction Site";
|
||||
break;
|
||||
}
|
||||
|
||||
if (pylonType==PylonType.SoldierDefense){
|
||||
scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
spawnSoldierDefender();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception in SoldierDefensePylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 90, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
if (pylonType==PylonType.VehiclePatrol){
|
||||
scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
spawnVehicle();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnVehicle() " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 120, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
if (pylonType==PylonType.SoldierPatrol){
|
||||
scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
spawnSoldier();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 60, TimeUnit.SECONDS);
|
||||
}
|
||||
this.setCustomName(pylonName + " 0/100");
|
||||
this.setAttachment("Name", pylonName);
|
||||
|
||||
}
|
||||
|
||||
@@ -171,251 +133,226 @@ public class GCWPylon extends TangibleObject{
|
||||
public void setSpawnLevel(int spawnLevel) {
|
||||
this.spawnLevel = spawnLevel;
|
||||
}
|
||||
|
||||
public void spawnSoldier(){
|
||||
|
||||
if (NGECore.getInstance().invasionService.getInvasionPhase()==2){
|
||||
if (pylonFaction==Factions.Rebel){
|
||||
switch (spawnLevel) {
|
||||
case 1: soldierTemplates = rebelSoldierTemplates1;
|
||||
case 2: soldierTemplates = rebelSoldierTemplates2;
|
||||
case 3: soldierTemplates = rebelSoldierTemplates3;
|
||||
}
|
||||
}
|
||||
if (pylonFaction==Factions.Imperial){
|
||||
switch (spawnLevel) {
|
||||
case 1: soldierTemplates = imperialSoldierTemplates1;
|
||||
case 2: soldierTemplates = imperialSoldierTemplates2;
|
||||
case 3: soldierTemplates = imperialSoldierTemplates3;
|
||||
}
|
||||
}
|
||||
String soldierTemplate = soldierTemplates[new Random().nextInt(soldierTemplates.length)];
|
||||
CreatureObject soldier = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(soldierTemplate, this.getPlanet().getName(), 0L, this.getPosition().x, this.getPosition().y, this.getPosition().z, this.getOrientation().w, this.getOrientation().x, this.getOrientation().y,this.getOrientation().z,-1);
|
||||
|
||||
NGECore.getInstance().aiService.setPatrol(soldier, patrolRoute);
|
||||
NGECore.getInstance().aiService.setPatrolLoop(soldier,false);
|
||||
NGECore.getInstance().invasionService.registerInvader(soldier);
|
||||
totalSpawnedUnits++;
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnSoldierDefender(){
|
||||
|
||||
if (NGECore.getInstance().invasionService.getInvasionPhase()==2){
|
||||
if (pylonFaction==Factions.Rebel){
|
||||
switch (spawnLevel) {
|
||||
case 1: soldierTemplates = rebelSoldierTemplates1;
|
||||
case 2: soldierTemplates = rebelSoldierTemplates2;
|
||||
case 3: soldierTemplates = rebelSoldierTemplates3;
|
||||
}
|
||||
}
|
||||
if (pylonFaction==Factions.Imperial){
|
||||
switch (spawnLevel) {
|
||||
case 1: soldierTemplates = imperialSoldierTemplates1;
|
||||
case 2: soldierTemplates = imperialSoldierTemplates2;
|
||||
case 3: soldierTemplates = imperialSoldierTemplates3;
|
||||
}
|
||||
}
|
||||
if (lastDefender!=null)
|
||||
if (lastDefender.getPosture()!=13 && lastDefender.getPosture()!=13)
|
||||
return;
|
||||
String soldierTemplate = soldierTemplates[new Random().nextInt(soldierTemplates.length)];
|
||||
lastDefender = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(soldierTemplate, this.getPlanet().getName(), 0L, this.getPosition().x, this.getPosition().y, this.getPosition().z, this.getOrientation().w, this.getOrientation().x, this.getOrientation().y,this.getOrientation().z,-1);
|
||||
|
||||
NGECore.getInstance().invasionService.registerDefender(lastDefender);
|
||||
totalSpawnedUnits++;
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnVehicle(){
|
||||
|
||||
if (NGECore.getInstance().invasionService.getInvasionPhase()==2){
|
||||
if (pylonFaction==Factions.Rebel){
|
||||
switch (spawnLevel) {
|
||||
case 1: vehicleTemplates = rebelVehicleTemplates1;
|
||||
case 2: vehicleTemplates = rebelVehicleTemplates2;
|
||||
case 3: vehicleTemplates = rebelVehicleTemplates3;
|
||||
}
|
||||
}
|
||||
if (pylonFaction==Factions.Imperial){
|
||||
switch (spawnLevel) {
|
||||
case 1: vehicleTemplates = imperialVehicleTemplates1;
|
||||
case 2: vehicleTemplates = imperialVehicleTemplates2;
|
||||
case 3: vehicleTemplates = imperialVehicleTemplates3;
|
||||
}
|
||||
}
|
||||
String vehicleTemplate = vehicleTemplates[new Random().nextInt(vehicleTemplates.length)];
|
||||
CreatureObject vehicle = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(vehicleTemplate, this.getPlanet().getName(), 0L, this.getPosition().x, this.getPosition().y, this.getPosition().z, this.getOrientation().w, this.getOrientation().x, this.getOrientation().y,this.getOrientation().z,-1);
|
||||
|
||||
NGECore.getInstance().aiService.setPatrol(vehicle, get_Dearic_Route_1());
|
||||
NGECore.getInstance().aiService.setPatrolLoop(vehicle,false);
|
||||
NGECore.getInstance().invasionService.registerInvader(vehicle);
|
||||
totalSpawnedUnits++;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPatrolRoute(int route){
|
||||
switch(route){
|
||||
case PatrolRoute.Dearic1: patrolRoute = get_Dearic_Route_1();
|
||||
break;
|
||||
case PatrolRoute.Dearic2: patrolRoute = get_Dearic_Route_2();
|
||||
break;
|
||||
case PatrolRoute.Dearic3: patrolRoute = get_Dearic_Route_3();
|
||||
break;
|
||||
case PatrolRoute.Dearic4: patrolRoute = get_Dearic_Route_4();
|
||||
break;
|
||||
case PatrolRoute.Dearic5: patrolRoute = get_Dearic_Route_5();
|
||||
break;
|
||||
case PatrolRoute.Dearic6: patrolRoute = get_Dearic_Route_6();
|
||||
break;
|
||||
case PatrolRoute.Dearic7: patrolRoute = get_Dearic_Route_7();
|
||||
break;
|
||||
case PatrolRoute.Dearic8: patrolRoute = get_Dearic_Route_8();
|
||||
break;
|
||||
case PatrolRoute.Dearic9: patrolRoute = get_Dearic_Route_9();
|
||||
break;
|
||||
case PatrolRoute.Dearic10: patrolRoute = get_Dearic_Route_10();
|
||||
break;
|
||||
}
|
||||
this.patrolRoute = route;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_1(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(68.0F, 6.00F, -2959F));
|
||||
patrolpoints.add(new Point3D(151.93F,6.00F, -2961.66F));
|
||||
patrolpoints.add(new Point3D(170.18F, 6.00F, -2992.99F));
|
||||
patrolpoints.add(new Point3D(262.76F, 6.00F, -2999.76F));
|
||||
patrolpoints.add(new Point3D(275.87F, 6.00F, -3008.44F));
|
||||
patrolpoints.add(new Point3D(303.41F, 6.00F, -3005.19F));
|
||||
patrolpoints.add(new Point3D(343.31F, 6.00F, -2961.06F));
|
||||
patrolpoints.add(new Point3D(379.98F, 6.00F, -2963.31F));
|
||||
patrolpoints.add(new Point3D(404.70F, 6.00F, -2980.57F));
|
||||
patrolpoints.add(new Point3D(412.54F, 6.00F, -3039.39F));
|
||||
patrolpoints.add(new Point3D(423.06F, 6.00F, -3050.75F));
|
||||
patrolpoints.add(new Point3D(446.92F, 6.00F, -3046.32F));
|
||||
patrolpoints.add(new Point3D(470.48F, 6.00F, -3023.43F));
|
||||
return patrolpoints;
|
||||
public int getPatrolRoute(){
|
||||
return this.patrolRoute;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_2(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(76.0F, 6.00F, -2893F));
|
||||
patrolpoints.add(new Point3D(153.0F, 6.00F, -2898F));
|
||||
patrolpoints.add(new Point3D(162.89F, 6.00F, -2836.9F));
|
||||
patrolpoints.add(new Point3D(291.44F, 6.00F, -2844.6F));
|
||||
patrolpoints.add(new Point3D(333.19F, 6.00F, -2878.0F));
|
||||
patrolpoints.add(new Point3D(337.00F, 6.00F, -2954.0F));
|
||||
patrolpoints.add(new Point3D(378.00F, 6.00F, -2959.0F));
|
||||
patrolpoints.add(new Point3D(407.00F, 6.00F, -2978.0F));
|
||||
patrolpoints.add(new Point3D(414.00F, 6.00F, -3041.0F));
|
||||
patrolpoints.add(new Point3D(448.00F, 6.00F, -3043.0F));
|
||||
patrolpoints.add(new Point3D(463.00F, 6.00F, -3017.0F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_3(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(199.0F, 6.00F, -2790F));
|
||||
patrolpoints.add(new Point3D(200.0F, 6.00F, -2838F));
|
||||
patrolpoints.add(new Point3D(294.0F, 6.00F, -2841F));
|
||||
patrolpoints.add(new Point3D(335.0F, 6.00F, -2882F));
|
||||
patrolpoints.add(new Point3D(341.0F, 6.00F, -2950F));
|
||||
patrolpoints.add(new Point3D(378.0F, 6.00F, -2958F));
|
||||
patrolpoints.add(new Point3D(405.0F, 6.00F, -2981F));
|
||||
patrolpoints.add(new Point3D(473.0F, 6.00F, -3024F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_4(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(332.0F, 6.00F, -2715F));
|
||||
patrolpoints.add(new Point3D(324.0F, 6.00F, -2817F));
|
||||
patrolpoints.add(new Point3D(302.0F, 6.00F, -2835F));
|
||||
patrolpoints.add(new Point3D(338.0F, 6.00F, -2888F));
|
||||
patrolpoints.add(new Point3D(342.0F, 6.00F, -2949F));
|
||||
patrolpoints.add(new Point3D(407.0F, 6.00F, -2972F));
|
||||
patrolpoints.add(new Point3D(415.0F, 6.00F, -3055F));
|
||||
patrolpoints.add(new Point3D(451.0F, 6.00F, -3044F));
|
||||
patrolpoints.add(new Point3D(460.0F, 6.00F, -3011F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_5(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(384.0F, 6.00F, -2720F));
|
||||
patrolpoints.add(new Point3D(404.0F, 6.00F, -2817F));
|
||||
patrolpoints.add(new Point3D(417.0F, 6.00F, -2827F));
|
||||
patrolpoints.add(new Point3D(414.0F, 6.00F, -2854F));
|
||||
patrolpoints.add(new Point3D(384.0F, 6.00F, -2888F));
|
||||
patrolpoints.add(new Point3D(384.0F, 6.00F, -2959F));
|
||||
patrolpoints.add(new Point3D(407.0F, 6.00F, -2975F));
|
||||
patrolpoints.add(new Point3D(416.0F, 6.00F, -3049F));
|
||||
patrolpoints.add(new Point3D(450.0F, 6.00F, -3043F));
|
||||
patrolpoints.add(new Point3D(474.0F, 6.00F, -3025F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_6(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(590.0F, 6.00F, -2825F));
|
||||
patrolpoints.add(new Point3D(567.0F, 6.00F, -2860F));
|
||||
patrolpoints.add(new Point3D(563.0F, 6.00F, -2943F));
|
||||
patrolpoints.add(new Point3D(563.0F, 6.00F, -2943F));
|
||||
patrolpoints.add(new Point3D(507.0F, 6.00F, -2955F));
|
||||
patrolpoints.add(new Point3D(500.0F, 6.00F, -3011F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_7(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(723.0F, 6.00F, -2995F));
|
||||
patrolpoints.add(new Point3D(720.0F, 6.00F, -2964F));
|
||||
patrolpoints.add(new Point3D(623.0F, 6.00F, -2961F));
|
||||
patrolpoints.add(new Point3D(614.0F, 6.00F, -3010F));
|
||||
patrolpoints.add(new Point3D(510.0F, 6.00F, -3032F));
|
||||
patrolpoints.add(new Point3D(484.0F, 6.00F, -3021F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_8(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(733.0F, 6.00F, -3004F));
|
||||
patrolpoints.add(new Point3D(701.0F, 6.00F, -3004F));
|
||||
patrolpoints.add(new Point3D(699.0F, 6.00F, -3039F));
|
||||
patrolpoints.add(new Point3D(627.0F, 6.00F, -3041F));
|
||||
patrolpoints.add(new Point3D(605.0F, 6.00F, -3018F));
|
||||
patrolpoints.add(new Point3D(509.0F, 6.00F, -3033F));
|
||||
patrolpoints.add(new Point3D(496.0F, 6.00F, -3018F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_9(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(330.0F, 23.00F, -3402F));
|
||||
patrolpoints.add(new Point3D(360.0F, 6.00F, -3357F));
|
||||
patrolpoints.add(new Point3D(415.0F, 6.00F, -3273F));
|
||||
patrolpoints.add(new Point3D(464.0F, 6.00F, -3256F));
|
||||
patrolpoints.add(new Point3D(467.0F, 6.00F, -3236F));
|
||||
patrolpoints.add(new Point3D(498.0F, 6.00F, -3230F));
|
||||
patrolpoints.add(new Point3D(501.0F, 6.00F, -3205F));
|
||||
patrolpoints.add(new Point3D(481.0F, 6.00F, -3174F));
|
||||
patrolpoints.add(new Point3D(482.0F, 6.00F, -3126F));
|
||||
patrolpoints.add(new Point3D(437.0F, 6.00F, -3065F));
|
||||
patrolpoints.add(new Point3D(465.0F, 6.00F, -3019F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Dearic_Route_10(){// just for tests
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(618.0F, 6.00F, -2972F));
|
||||
patrolpoints.add(new Point3D(617.0F, 6.00F, -2980F));
|
||||
patrolpoints.add(new Point3D(616.0F, 6.00F, -2990F));
|
||||
patrolpoints.add(new Point3D(615.0F, 6.00F, -3010F));
|
||||
patrolpoints.add(new Point3D(500.0F, 6.00F, -3035F));
|
||||
public void convertToPhase2Object(){
|
||||
|
||||
return patrolpoints;
|
||||
//if (determinePylonLevel()==0)
|
||||
//return;
|
||||
|
||||
// resourceFilling = 100;
|
||||
// spawnLevel = 3;
|
||||
resourceFilling = 10;
|
||||
spawnLevel = 1;
|
||||
|
||||
switch (pylonType){
|
||||
case PylonType.Barricade: createBarricade();
|
||||
break;
|
||||
case PylonType.SoldierDefense: createSpawner();
|
||||
break;
|
||||
case PylonType.SoldierPatrol: createSpawner();
|
||||
break;
|
||||
case PylonType.VehiclePatrol: createSpawner();
|
||||
break;
|
||||
case PylonType.SiegeVehiclePatrol: createSpawner();
|
||||
break;
|
||||
case PylonType.Tower: createTower();
|
||||
break;
|
||||
case PylonType.Turret: createTurret();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public int determinePylonLevel(){
|
||||
if (resourceFilling==0) spawnLevel = 0;
|
||||
if (resourceFilling>0 && resourceFilling<50) spawnLevel = 1;
|
||||
if (resourceFilling>=50 && resourceFilling<100) spawnLevel = 2;
|
||||
if (resourceFilling==100) spawnLevel = 3;
|
||||
return spawnLevel;
|
||||
}
|
||||
|
||||
public void createSpawner(){
|
||||
GCWSpawner spawner = (GCWSpawner) NGECore.getInstance().objectService.createObject("object/tangible/loot/creature_loot/collections/shared_dejarik_table_base.iff", 0, this.getPlanet(), this.getWorldPosition(), this.getOrientation());
|
||||
NGECore.getInstance().simulationService.add(spawner, spawner.getPosition().x, spawner.getPosition().z, true);
|
||||
spawner.setPatrolRoute(getPatrolRoute());
|
||||
spawner.setDelay(getDelay());
|
||||
spawner.setSpawnLevel(3);
|
||||
spawner.setSpawnerFaction(getPylonFaction());
|
||||
spawner.setSpawnerType(getPylonType());
|
||||
NGECore.getInstance().invasionService.registerPhase2Objects(spawner);
|
||||
}
|
||||
|
||||
public void createTurret(){
|
||||
String turretTemplate="object/installation/turret/gcw/shared_adv_turret_dish_sm_heat.iff";
|
||||
//String turretTemplate="object/installation/turret/gcw/shared_adv_turret_dish_large_heat.iff";
|
||||
if (spawnLevel==2) turretTemplate="object/installation/turret/gcw/shared_adv_turret_dish_large_heat.iff";
|
||||
if (spawnLevel==3) turretTemplate="object/installation/turret/gcw/shared_adv_turret_block_med_heat.iff";
|
||||
Planet spawnPlanet = this.getPlanet();
|
||||
Point3D spawnPos = this.getWorldPosition();
|
||||
Quaternion quat = this.getOrientation();
|
||||
NGECore.getInstance().objectService.destroyObject(this.getObjectID());
|
||||
InstallationObject turret = (InstallationObject) NGECore.getInstance().objectService.createObject(turretTemplate, 0, spawnPlanet, spawnPos, quat);
|
||||
NGECore.getInstance().simulationService.add(turret, turret.getPosition().x, turret.getPosition().z, true);
|
||||
float positionY = NGECore.getInstance().terrainService.getHeight(turret.getPlanetId(), turret.getPosition().x, turret.getPosition().z);
|
||||
if (turret.getWorldPosition().getDistance2D(new Point3D(1779.27F, 12, 2517.37F))<5 || turret.getWorldPosition().getDistance2D(new Point3D(1797.00F, 12, 2518.32F))<5){
|
||||
positionY +=4; // The terrainService delivers incorrect heights on that bridge near the general in Keren
|
||||
}
|
||||
turret.setPosition(new Point3D(turret.getPosition().x,positionY, turret.getPosition().z));
|
||||
String customName = "Rebel Turret";
|
||||
String factionString = "rebel";
|
||||
if (getPylonFaction()==Factions.Imperial){
|
||||
customName = "Imperial Turret";
|
||||
factionString = "imperial";
|
||||
}
|
||||
turret.setCustomName(customName);
|
||||
|
||||
turret.setOptionsBitmask(Options.ATTACKABLE | Options.QUEST);
|
||||
//turret.setOptionsBitmask(Options.QUEST);
|
||||
turret.setFaction(factionString);
|
||||
turret.setFactionStatus(FactionStatus.Combatant);
|
||||
turret.setMaximumCondition(50000);
|
||||
TurretAIActor actor = new TurretAIActor(turret, turret.getPosition(), scheduler);
|
||||
turret.setAttachment("AI", actor);
|
||||
NGECore.getInstance().invasionService.registerPhase2Objects(turret);
|
||||
|
||||
WeaponObject turretWeapon = (WeaponObject) NGECore.getInstance().objectService.createObject("object/weapon/ranged/turret/shared_turret_heat.iff", turret.getPlanet());
|
||||
turretWeapon.setAttackSpeed(5.0F);
|
||||
//turretWeapon.setAttackSpeed(0.50F);
|
||||
turretWeapon.setWeaponType(WeaponType.RIFLE);
|
||||
turretWeapon.setMaxRange(60.0F);
|
||||
turretWeapon.setDamageType("energy");
|
||||
|
||||
int minDamage = 1500; int maxDamage = 2000;
|
||||
if (spawnLevel==2) {minDamage=2500; maxDamage=3500;}
|
||||
if (spawnLevel==3) {minDamage=4000; maxDamage=5000;}
|
||||
|
||||
turretWeapon.setMinDamage(minDamage);
|
||||
turretWeapon.setMaxDamage(maxDamage);
|
||||
turret.add(turretWeapon);
|
||||
turret.setAttachment("TurretWeapon",turretWeapon.getObjectID());
|
||||
// Set<Client> newObservers = new HashSet<Client>(turret.getObservers());
|
||||
// for(Client c : newObservers) {
|
||||
// UpdateContainmentMessage ucm = new UpdateContainmentMessage(turretWeapon.getObjectID(), turret.getObjectID(), 4);
|
||||
// c.getSession().write(ucm.serialize());
|
||||
// }
|
||||
}
|
||||
|
||||
public void createBarricade(){
|
||||
String barricadeTemplate = "object/tangible/destructible/shared_gcw_rebel_barricade.iff";
|
||||
TangibleObject barricade = (TangibleObject) NGECore.getInstance().objectService.createObject(barricadeTemplate, 0, this.getPlanet(), this.getWorldPosition(), this.getOrientation());
|
||||
NGECore.getInstance().simulationService.add(barricade, barricade.getPosition().x, barricade.getPosition().z, true);
|
||||
String customName = "Rebel Barricade";
|
||||
String factionString = "rebel";
|
||||
if (getPylonFaction()==Factions.Imperial){
|
||||
customName = "Imperial Barricade";
|
||||
factionString = "imperial";
|
||||
}
|
||||
barricade.setCustomName(customName);
|
||||
barricade.setOptionsBitmask(Options.ATTACKABLE | Options.QUEST);
|
||||
//barricade.setOptionsBitmask(Options.QUEST);
|
||||
barricade.setFaction(factionString);
|
||||
barricade.setFactionStatus(FactionStatus.Combatant);
|
||||
int maxCondition = 50000;
|
||||
maxCondition += 5000 * resourceFilling;
|
||||
|
||||
barricade.setMaximumCondition(maxCondition);
|
||||
NGECore.getInstance().invasionService.registerPhase2Objects(barricade);
|
||||
|
||||
final Future<?>[] fut = {null};
|
||||
fut[0] = scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
if (NGECore.getInstance().objectService.getObject(barricade.getObjectID())==null){
|
||||
Thread.yield();
|
||||
fut[0].cancel(false);
|
||||
}
|
||||
|
||||
Vector<CreatureObject> nearAllies = NGECore.getInstance().simulationService.getAllNearSameFactionCreatures(7,barricade.getWorldPosition(),barricade.getPlanet(),NGECore.getInstance().invasionService.getFactionName(getPylonFaction()));
|
||||
for (CreatureObject ally : nearAllies){
|
||||
if (! ally.hasBuff("barricade_defender")){
|
||||
NGECore.getInstance().buffService.addBuffToCreature(ally, "barricade_defender", ally);
|
||||
} else {
|
||||
|
||||
}
|
||||
} // towFacGuardDefenseItem
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception in Barricade thread " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void createTower(){
|
||||
String towerTemplate = "object/tangible/destructible/shared_gcw_rebel_tower.iff";
|
||||
String factionString = "rebel";
|
||||
String towerString = "Rebel Tower";
|
||||
if (getPylonFaction()==Factions.Imperial){
|
||||
towerTemplate = "object/tangible/destructible/shared_gcw_imperial_tower.iff";
|
||||
factionString = "imperial";
|
||||
towerString = "Imperial Tower";
|
||||
}
|
||||
TangibleObject tower = (TangibleObject) NGECore.getInstance().objectService.createObject(towerTemplate, 0, this.getPlanet(), this.getWorldPosition(), this.getOrientation());
|
||||
NGECore.getInstance().simulationService.add(tower, tower.getPosition().x, tower.getPosition().z, true);
|
||||
tower.setCustomName(towerString);
|
||||
tower.setOptionsBitmask(Options.ATTACKABLE | Options.QUEST);
|
||||
//tower.setOptionsBitmask(Options.QUEST);
|
||||
tower.setFaction(factionString);
|
||||
tower.setFactionStatus(FactionStatus.Combatant);
|
||||
int maxCondition = 50000;
|
||||
maxCondition += 5000 * resourceFilling;
|
||||
|
||||
tower.setMaximumCondition(maxCondition);
|
||||
NGECore.getInstance().invasionService.registerPhase2Objects(tower);
|
||||
|
||||
final Future<?>[] fut = {null};
|
||||
fut[0] = scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
try {
|
||||
if (NGECore.getInstance().objectService.getObject(tower.getObjectID())==null){
|
||||
Thread.yield();
|
||||
fut[0].cancel(false);
|
||||
}
|
||||
|
||||
Vector<CreatureObject> nearAllies = NGECore.getInstance().simulationService.getAllNearSameFactionNPCs(500, tower);
|
||||
for (CreatureObject ally : nearAllies){
|
||||
if (!ally.isPlayer()){
|
||||
if (! ally.hasBuff("tower_defender")){
|
||||
NGECore.getInstance().buffService.addBuffToCreature(ally, "tower_defender", ally);
|
||||
}
|
||||
}
|
||||
}
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception in Tower thread " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public int getResourceFilling() {
|
||||
return resourceFilling;
|
||||
}
|
||||
|
||||
public void setResourceFilling(int resourceFilling) {
|
||||
this.resourceFilling = resourceFilling;
|
||||
}
|
||||
|
||||
public int getDelay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public void setDelay(int delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public class PylonType {
|
||||
|
||||
public static final int SoldierPatrol = 0;
|
||||
@@ -436,27 +373,32 @@ public class GCWPylon extends TangibleObject{
|
||||
Tower Pylon - Spawns a watch tower that grants intelligence to nearby NPCs and offers combat missions to players - shown with a Tower icon.
|
||||
*/
|
||||
|
||||
public class PatrolRoute {
|
||||
|
||||
public static final int Dearic1 = 0;
|
||||
public static final int Dearic2 = 1;
|
||||
public static final int Dearic3 = 2;
|
||||
public static final int Dearic4 = 3;
|
||||
public static final int Dearic5 = 4;
|
||||
public static final int Dearic6 = 5;
|
||||
public static final int Dearic7 = 6;
|
||||
public static final int Dearic8 = 7;
|
||||
public static final int Dearic9 = 8;
|
||||
public static final int Dearic10 = 9;
|
||||
|
||||
}
|
||||
public void sendBaselines(Client destination) {
|
||||
if (destination != null && destination.getSession() != null) {
|
||||
destination.getSession().write(getBaseline(3).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());
|
||||
}
|
||||
|
||||
public int getTotalSpawnedUnits() {
|
||||
return totalSpawnedUnits;
|
||||
if (destination.getParent() != this) {
|
||||
// The icon disappears after a few seconds, no idea why. Must be the commandString requirement
|
||||
float y = -0.1F;
|
||||
//float qz= 1.06535322E9F;
|
||||
float qz= 99999;
|
||||
//String animName = "pt_gcw_quest_rebel_barricade.prt";
|
||||
String animName = "pt_gcw_quest_imperial_patrol_2.prt";
|
||||
//String animName = "pt_reb_insignia_02.prt"; // pt_gcw_quest_imperial_patrol_2.prt
|
||||
Point3D effectorPosition = new Point3D(0,y,0);
|
||||
Quaternion effectorOrientation = new Quaternion(0,0,0,qz);
|
||||
PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/" + animName,this.getObjectID(),"",effectorPosition,effectorOrientation);
|
||||
//PlayClientEffectObjectMessage lmsg = new PlayClientEffectObjectMessage("appearance/" + animName, this.getObjectID(), "");
|
||||
destination.getSession().write(lmsg.serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTotalSpawnedUnits(int totalSpawnedUnits) {
|
||||
this.totalSpawnedUnits = totalSpawnedUnits;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public class GCWSpawner extends TangibleObject{
|
||||
|
||||
private Vector<Point3D> patrolRoute = new Vector<Point3D>();
|
||||
private CreatureObject lastDefender = null;
|
||||
private int delay = 0;
|
||||
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
@@ -105,7 +106,6 @@ public class GCWSpawner extends TangibleObject{
|
||||
|
||||
public void setSpawnerType(int spawnerType) {
|
||||
this.spawnerType = spawnerType;
|
||||
|
||||
if (spawnerType==SpawnerType.SoldierPatrol){
|
||||
scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
@Override public void run() {
|
||||
@@ -115,7 +115,7 @@ public class GCWSpawner extends TangibleObject{
|
||||
System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 60, TimeUnit.SECONDS);
|
||||
}, getDelay(), 240, TimeUnit.SECONDS); //120
|
||||
}
|
||||
|
||||
if (spawnerType==SpawnerType.SoldierDefense){
|
||||
@@ -139,7 +139,7 @@ public class GCWSpawner extends TangibleObject{
|
||||
System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnVehicle() " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 5, 120, TimeUnit.SECONDS);
|
||||
}, getDelay(), 240, TimeUnit.SECONDS); //240
|
||||
}
|
||||
|
||||
if (spawnerType==SpawnerType.SiegeVehiclePatrol){
|
||||
@@ -151,7 +151,7 @@ public class GCWSpawner extends TangibleObject{
|
||||
System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}, 120, 600, TimeUnit.SECONDS);
|
||||
}, getDelay(), 600, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -173,7 +173,6 @@ public class GCWSpawner extends TangibleObject{
|
||||
}
|
||||
|
||||
public void spawnSoldier(){
|
||||
|
||||
if (NGECore.getInstance().invasionService.getInvasionPhase()==2){
|
||||
if (spawnerFaction==Factions.Rebel){
|
||||
switch (spawnLevel) {
|
||||
@@ -192,11 +191,12 @@ public class GCWSpawner extends TangibleObject{
|
||||
String soldierTemplate = soldierTemplates[new Random().nextInt(soldierTemplates.length)];
|
||||
//if (totalSpawnedUnits==0){
|
||||
CreatureObject soldier = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(soldierTemplate, this.getPlanet().getName(), 0L, this.getPosition().x, this.getPosition().y, this.getPosition().z, this.getOrientation().w, this.getOrientation().x, this.getOrientation().y,this.getOrientation().z,-1);
|
||||
|
||||
NGECore.getInstance().aiService.setPatrol(soldier, patrolRoute);
|
||||
NGECore.getInstance().aiService.setPatrolLoop(soldier,false);
|
||||
NGECore.getInstance().invasionService.registerInvader(soldier);
|
||||
totalSpawnedUnits++;
|
||||
soldier.setAttachment("IsInvader","yes");
|
||||
NGECore.getInstance().aiService.setPatrol(soldier, patrolRoute);
|
||||
NGECore.getInstance().aiService.setPatrolLoop(soldier,false);
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -248,11 +248,11 @@ public class GCWSpawner extends TangibleObject{
|
||||
}
|
||||
String vehicleTemplate = vehicleTemplates[new Random().nextInt(vehicleTemplates.length)];
|
||||
CreatureObject vehicle = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(vehicleTemplate, this.getPlanet().getName(), 0L, this.getPosition().x, this.getPosition().y, this.getPosition().z, this.getOrientation().w, this.getOrientation().x, this.getOrientation().y,this.getOrientation().z,-1);
|
||||
|
||||
NGECore.getInstance().aiService.setPatrol(vehicle, patrolRoute);
|
||||
NGECore.getInstance().aiService.setPatrolLoop(vehicle,false);
|
||||
NGECore.getInstance().invasionService.registerInvader(vehicle);
|
||||
totalSpawnedUnits++;
|
||||
vehicle.setAttachment("IsInvader","yes");
|
||||
NGECore.getInstance().aiService.setPatrol(vehicle, patrolRoute);
|
||||
NGECore.getInstance().aiService.setPatrolLoop(vehicle,false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,11 +276,12 @@ public class GCWSpawner extends TangibleObject{
|
||||
String vehicleTemplate = vehicleTemplates[new Random().nextInt(vehicleTemplates.length)];
|
||||
CreatureObject vehicle = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(vehicleTemplate, this.getPlanet().getName(), 0L, this.getPosition().x, this.getPosition().y, this.getPosition().z, this.getOrientation().w, this.getOrientation().x, this.getOrientation().y,this.getOrientation().z,-1);
|
||||
vehicle.setAttachment("IsSlowVehicle",true);
|
||||
|
||||
NGECore.getInstance().aiService.setPatrol(vehicle, patrolRoute);
|
||||
NGECore.getInstance().aiService.setPatrolLoop(vehicle,false);
|
||||
NGECore.getInstance().invasionService.registerInvader(vehicle);
|
||||
totalSpawnedUnits++;
|
||||
vehicle.setAttachment("IsInvader","yes");
|
||||
|
||||
NGECore.getInstance().aiService.setPatrol(vehicle, patrolRoute);
|
||||
NGECore.getInstance().aiService.setPatrolLoop(vehicle,false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,6 +309,38 @@ public class GCWSpawner extends TangibleObject{
|
||||
break;
|
||||
case PatrolRoute.Dearic11: patrolRoute = get_Dearic_Route_11();
|
||||
break;
|
||||
|
||||
case PatrolRoute.Keren1: patrolRoute = get_Keren_Route_1();
|
||||
break;
|
||||
case PatrolRoute.Keren2: patrolRoute = get_Keren_Route_2();
|
||||
break;
|
||||
case PatrolRoute.Keren3: patrolRoute = get_Keren_Route_3();
|
||||
break;
|
||||
case PatrolRoute.Keren4: patrolRoute = get_Keren_Route_4();
|
||||
break;
|
||||
case PatrolRoute.Keren5: patrolRoute = get_Keren_Route_5();
|
||||
break;
|
||||
case PatrolRoute.Keren6: patrolRoute = get_Keren_Route_6();
|
||||
break;
|
||||
case PatrolRoute.Keren7: patrolRoute = get_Keren_Route_7();
|
||||
break;
|
||||
|
||||
case PatrolRoute.Bestine1: patrolRoute = get_Bestine_Route_1();
|
||||
break;
|
||||
case PatrolRoute.Bestine2: patrolRoute = get_Bestine_Route_2();
|
||||
break;
|
||||
case PatrolRoute.Bestine3: patrolRoute = get_Bestine_Route_3();
|
||||
break;
|
||||
case PatrolRoute.Bestine4: patrolRoute = get_Bestine_Route_4();
|
||||
break;
|
||||
case PatrolRoute.Bestine5: patrolRoute = get_Bestine_Route_5();
|
||||
break;
|
||||
case PatrolRoute.Bestine6: patrolRoute = get_Bestine_Route_6();
|
||||
break;
|
||||
case PatrolRoute.Bestine7: patrolRoute = get_Bestine_Route_7();
|
||||
break;
|
||||
case PatrolRoute.Bestine8: patrolRoute = get_Bestine_Route_8();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +374,7 @@ public class GCWSpawner extends TangibleObject{
|
||||
patrolpoints.add(new Point3D(407.00F, 6.00F, -2978.0F));
|
||||
patrolpoints.add(new Point3D(414.00F, 6.00F, -3041.0F));
|
||||
patrolpoints.add(new Point3D(448.00F, 6.00F, -3043.0F));
|
||||
patrolpoints.add(new Point3D(463.00F, 6.00F, -3017.0F));
|
||||
patrolpoints.add(new Point3D(464.00F, 6.00F, -3017.0F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
@@ -419,7 +452,7 @@ public class GCWSpawner extends TangibleObject{
|
||||
patrolpoints.add(new Point3D(627.0F, 6.00F, -3041F));
|
||||
patrolpoints.add(new Point3D(605.0F, 6.00F, -3018F));
|
||||
patrolpoints.add(new Point3D(509.0F, 6.00F, -3033F));
|
||||
patrolpoints.add(new Point3D(496.0F, 6.00F, -3018F));
|
||||
patrolpoints.add(new Point3D(495.0F, 6.00F, -3017F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
@@ -455,6 +488,254 @@ public class GCWSpawner extends TangibleObject{
|
||||
patrolpoints.add(new Point3D(332.0F, 6.00F, -2715F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
|
||||
public Vector<Point3D> get_Keren_Route_1(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(1342.0F, 13.00F, 2917F));
|
||||
patrolpoints.add(new Point3D(1447.0F, 13.00F, 2825F));
|
||||
patrolpoints.add(new Point3D(1463.0F, 14.00F, 2781F));
|
||||
patrolpoints.add(new Point3D(1530.0F, 25.00F, 2760F));
|
||||
patrolpoints.add(new Point3D(1523.0F, 25.00F, 2731F));
|
||||
patrolpoints.add(new Point3D(1555.0F, 29.00F, 2721F));
|
||||
patrolpoints.add(new Point3D(1607.0F, 25.00F, 2706F));
|
||||
patrolpoints.add(new Point3D(1607.0F, 25.00F, 2706F));
|
||||
patrolpoints.add(new Point3D(1601.0F, 25.00F, 2676F));
|
||||
patrolpoints.add(new Point3D(1652.0F, 12.00F, 2652F));
|
||||
patrolpoints.add(new Point3D(1674.0F, 12.00F, 2637F));
|
||||
patrolpoints.add(new Point3D(1674.0F, 12.00F, 2586F));
|
||||
patrolpoints.add(new Point3D(1725.0F, 12.00F, 2584F));
|
||||
patrolpoints.add(new Point3D(1727.0F, 12.00F, 2559F));
|
||||
patrolpoints.add(new Point3D(1758.0F, 12.00F, 2555F));
|
||||
patrolpoints.add(new Point3D(1766.0F, 12.00F, 2528F));
|
||||
patrolpoints.add(new Point3D(1780.0F, 12.00F, 2520F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Keren_Route_2(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(1994.03F, 12.00F, 2769.94F));
|
||||
patrolpoints.add(new Point3D(1981.79F, 13.89F, 2736.23F));
|
||||
patrolpoints.add(new Point3D(1911.87F, 12F, 2737.51F));
|
||||
patrolpoints.add(new Point3D(1892.03F, 12F, 2718.64F));
|
||||
patrolpoints.add(new Point3D(1883.43F, 12F, 2727.32F));
|
||||
patrolpoints.add(new Point3D(1863.00F, 12F, 2707.36F));
|
||||
patrolpoints.add(new Point3D(1883.67F, 12F, 2694.01F));
|
||||
patrolpoints.add(new Point3D(1899.48F, 12F, 2661.86F));
|
||||
patrolpoints.add(new Point3D(1901.68F, 12F, 2638.95F));
|
||||
patrolpoints.add(new Point3D(1897.24F, 12F, 2603.49F));
|
||||
patrolpoints.add(new Point3D(1879.39F, 12F, 2563.75F));
|
||||
patrolpoints.add(new Point3D(1841.89F, 12F, 2527.75F));
|
||||
patrolpoints.add(new Point3D(1824.33F, 12F, 2521.45F));
|
||||
patrolpoints.add(new Point3D(1789.56F, 12F, 2518.26F));
|
||||
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Keren_Route_3(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(2063.0F, 49.00F, 2794F));
|
||||
patrolpoints.add(new Point3D(2020.0F, 49.00F, 2796F));
|
||||
patrolpoints.add(new Point3D(1817.0F, 40.00F, 2808F));
|
||||
patrolpoints.add(new Point3D(1753.0F, 40.00F, 2808F));
|
||||
patrolpoints.add(new Point3D(1715.0F, 40.00F, 2780F));
|
||||
patrolpoints.add(new Point3D(1717.0F, 12.00F, 2741F));
|
||||
patrolpoints.add(new Point3D(1713.0F, 12.00F, 2639F));
|
||||
patrolpoints.add(new Point3D(1695.0F, 12.00F, 2635F));
|
||||
patrolpoints.add(new Point3D(1696.0F, 12.00F, 2589F));
|
||||
patrolpoints.add(new Point3D(1725.0F, 12.00F, 2585F));
|
||||
patrolpoints.add(new Point3D(1727.0F, 12.00F, 2560F));
|
||||
patrolpoints.add(new Point3D(1758.0F, 12.00F, 2555F));
|
||||
patrolpoints.add(new Point3D(1766.0F, 12.00F, 2527F));
|
||||
patrolpoints.add(new Point3D(1781.0F, 12.00F, 2516F));
|
||||
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Keren_Route_4(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(1990.0F, 30.00F, 2715F));
|
||||
patrolpoints.add(new Point3D(1990.0F, 30.00F, 2682F));
|
||||
patrolpoints.add(new Point3D(1988.0F, 12.00F, 2624F));
|
||||
patrolpoints.add(new Point3D(1983.0F, 12.00F, 2560F));
|
||||
patrolpoints.add(new Point3D(1931.0F, 12.00F, 2535F));
|
||||
patrolpoints.add(new Point3D(1902.0F, 12.00F, 2554F));
|
||||
patrolpoints.add(new Point3D(1879.0F, 12.00F, 2525F));
|
||||
patrolpoints.add(new Point3D(1846.0F, 12.00F, 2504F));
|
||||
patrolpoints.add(new Point3D(1806.0F, 12.00F, 2492F));
|
||||
patrolpoints.add(new Point3D(1806.0F, 12.00F, 2520F));
|
||||
patrolpoints.add(new Point3D(1794.0F, 12.00F, 2519F));
|
||||
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Keren_Route_5(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(1342.0F, 13.00F, 2917F));
|
||||
patrolpoints.add(new Point3D(1447.0F, 13.00F, 2825F));
|
||||
patrolpoints.add(new Point3D(1463.0F, 14.00F, 2781F));
|
||||
patrolpoints.add(new Point3D(1530.0F, 25.00F, 2760F));
|
||||
patrolpoints.add(new Point3D(1523.0F, 25.00F, 2731F));
|
||||
patrolpoints.add(new Point3D(1555.0F, 29.00F, 2721F));
|
||||
patrolpoints.add(new Point3D(1607.0F, 25.00F, 2706F));
|
||||
patrolpoints.add(new Point3D(1607.0F, 25.00F, 2706F));
|
||||
patrolpoints.add(new Point3D(1601.0F, 25.00F, 2676F));
|
||||
patrolpoints.add(new Point3D(1652.0F, 12.00F, 2652F));
|
||||
patrolpoints.add(new Point3D(1674.0F, 12.00F, 2637F));
|
||||
patrolpoints.add(new Point3D(1674.0F, 12.00F, 2586F));
|
||||
patrolpoints.add(new Point3D(1725.0F, 12.00F, 2584F));
|
||||
patrolpoints.add(new Point3D(1758.0F, 12.00F, 2555F));
|
||||
patrolpoints.add(new Point3D(1766.0F, 12.00F, 2528F));
|
||||
patrolpoints.add(new Point3D(1780.0F, 12.00F, 2520F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Keren_Route_6(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(1980.0F, 10.00F, 2179F));
|
||||
patrolpoints.add(new Point3D(1957.0F, 11.00F, 2259F));
|
||||
patrolpoints.add(new Point3D(1934.0F, 12.00F, 2341F));
|
||||
patrolpoints.add(new Point3D(1947.0F, 12.00F, 2387F));
|
||||
patrolpoints.add(new Point3D(1945.0F, 12.00F, 2414F));
|
||||
patrolpoints.add(new Point3D(1879.0F, 12.00F, 2419F));
|
||||
patrolpoints.add(new Point3D(1847.0F, 12.00F, 2458F));
|
||||
patrolpoints.add(new Point3D(1789.0F, 12.00F, 2459F));
|
||||
patrolpoints.add(new Point3D(1743.0F, 12.00F, 2458F));
|
||||
patrolpoints.add(new Point3D(1728.0F, 12.00F, 2468F));
|
||||
patrolpoints.add(new Point3D(1729.0F, 12.00F, 2495F));
|
||||
patrolpoints.add(new Point3D(1761.0F, 12.00F, 2495F));
|
||||
patrolpoints.add(new Point3D(1764.0F, 12.00F, 2516F));
|
||||
patrolpoints.add(new Point3D(1776.0F, 12.00F, 2517F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Keren_Route_7(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(1342.0F, 13.00F, 2917F));
|
||||
patrolpoints.add(new Point3D(1487.0F, 20.00F, 2808F));
|
||||
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_1(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-978.75F, 12.00F, -3747.46F));
|
||||
patrolpoints.add(new Point3D(-996.37F, 12.00F, -3731.11F));
|
||||
patrolpoints.add(new Point3D(-1004.13F, 12.00F, -3708.60F));
|
||||
patrolpoints.add(new Point3D(-1042.40F, 12.00F, -3672.19F));
|
||||
patrolpoints.add(new Point3D(-1067.11F, 12.00F, -3665.97F));
|
||||
patrolpoints.add(new Point3D(-1107.36F, 12.00F, -3633.51F));
|
||||
patrolpoints.add(new Point3D(-1126.32F, 12.00F, -3650.40F));
|
||||
patrolpoints.add(new Point3D(-1144.03F, 12.00F, -3652.36F));
|
||||
patrolpoints.add(new Point3D(-1175.46F, 12.00F, -3631.40F));
|
||||
patrolpoints.add(new Point3D(-1204.07F, 12.00F, -3627.40F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_2(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-1002.90F, 19.15F, -3593.77F));
|
||||
patrolpoints.add(new Point3D(-1053.93F, 12F, -3576.39F));
|
||||
patrolpoints.add(new Point3D(-1064.00F, 12F, -3586.90F));
|
||||
patrolpoints.add(new Point3D(-1084.30F, 12F, -3583.85F));
|
||||
patrolpoints.add(new Point3D(-1100.69F, 12F, -3622.65F));
|
||||
patrolpoints.add(new Point3D(-1129.25F, 12F, -3653.48F));
|
||||
patrolpoints.add(new Point3D(-1158.12F, 12F, -3654.10F));
|
||||
patrolpoints.add(new Point3D(-1191.37F, 12F, -3628.60F));
|
||||
patrolpoints.add(new Point3D(-1214.79F, 12F, -3633.39F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_3(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-1104F, 20.00F, -3467F));
|
||||
patrolpoints.add(new Point3D(-1084.21F, 12.00F, -3513.44F));
|
||||
patrolpoints.add(new Point3D(-1107.65F, 12.00F, -3570.01F));
|
||||
patrolpoints.add(new Point3D(-1166.30F, 12.00F, -3527.04F));
|
||||
patrolpoints.add(new Point3D(-1182.49F, 12.00F, -3543.62F));
|
||||
patrolpoints.add(new Point3D(-1195.03F, 12.00F, -3534.84F));
|
||||
patrolpoints.add(new Point3D(-1222.08F, 12.00F, -3567.95F));
|
||||
patrolpoints.add(new Point3D(-1245.74F, 12.00F, -3550.56F));
|
||||
patrolpoints.add(new Point3D(-1284.93F, 12.00F, -3596.65F));
|
||||
patrolpoints.add(new Point3D(-1255.27F, 12.00F, -3620.79F));
|
||||
patrolpoints.add(new Point3D(-1223.85F, 12.00F, -3625.50F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_4(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-1224.17F, 14.92F, -3477.66F));
|
||||
patrolpoints.add(new Point3D(-1214.17F, 12F, -3520.83F));
|
||||
patrolpoints.add(new Point3D(-1239.38F, 12F, -3552.16F));
|
||||
patrolpoints.add(new Point3D(-1251.67F, 12F, -3554.41F));
|
||||
patrolpoints.add(new Point3D(-1288.84F, 12F, -3605.51F));
|
||||
patrolpoints.add(new Point3D(-1253.18F, 12F, -3620.50F));
|
||||
patrolpoints.add(new Point3D(-1224.78F, 12F, -3627.92F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_5(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-1289.09F, 10.77F, -3451.00F));
|
||||
patrolpoints.add(new Point3D(-1287.35F, 12F, -3499.91F));
|
||||
patrolpoints.add(new Point3D(-1293.84F, 12F, -3516.75F));
|
||||
patrolpoints.add(new Point3D(-1293.84F, 12F, -3516.75F));
|
||||
patrolpoints.add(new Point3D(-1282.01F, 12F, -3531.76F));
|
||||
patrolpoints.add(new Point3D(-1286.69F, 12F, -3604.70F));
|
||||
patrolpoints.add(new Point3D(-1247.24F, 12F, -3622.33F));
|
||||
patrolpoints.add(new Point3D(-1221.27F, 12F, -3616.53F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_6(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-1399.33F, 18.02F, -3842.45F));
|
||||
patrolpoints.add(new Point3D(-1378.02F, 10.02F, -3803.54F));
|
||||
patrolpoints.add(new Point3D(-1355.98F, 12.25F, -3741.07F));
|
||||
patrolpoints.add(new Point3D(-1351.22F, 12.0F, -3703.81F));
|
||||
patrolpoints.add(new Point3D(-1301.95F, 12.0F, -3626.74F));
|
||||
patrolpoints.add(new Point3D(-1261.14F, 12.0F, -3624.71F));
|
||||
patrolpoints.add(new Point3D(-1224.89F, 12.0F, -3631.51F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_7(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-1319.14F, 21.54F, -3854.52F));
|
||||
patrolpoints.add(new Point3D(-1327.96F, 24.39F, -3791.74F));
|
||||
patrolpoints.add(new Point3D(-1325.62F, 12.0F, -3694.68F));
|
||||
patrolpoints.add(new Point3D(-1325.62F, 12.0F, -3694.68F));
|
||||
patrolpoints.add(new Point3D(-1313.86F, 12.0F, -3632.90F));
|
||||
patrolpoints.add(new Point3D(-1261.17F, 12.0F, -3623.71F));
|
||||
patrolpoints.add(new Point3D(-1225.88F, 12.0F, -3631.15F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
public Vector<Point3D> get_Bestine_Route_8(){
|
||||
Vector<Point3D> patrolpoints = new Vector<Point3D>();
|
||||
patrolpoints.add(new Point3D(-1143.05F, 14.43F, -3756.47F));
|
||||
patrolpoints.add(new Point3D(-1126.50F, 12F, -3691.73F));
|
||||
patrolpoints.add(new Point3D(-1188.91F, 12F, -3627.55F));
|
||||
patrolpoints.add(new Point3D(-1203.55F, 12F, -3624.19F));
|
||||
return patrolpoints;
|
||||
}
|
||||
|
||||
|
||||
public int getTotalSpawnedUnits() {
|
||||
return totalSpawnedUnits;
|
||||
}
|
||||
|
||||
public void setTotalSpawnedUnits(int totalSpawnedUnits) {
|
||||
this.totalSpawnedUnits = totalSpawnedUnits;
|
||||
}
|
||||
|
||||
public int getDelay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public void setDelay(int delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public class SpawnerType {
|
||||
|
||||
@@ -490,14 +771,22 @@ public class GCWSpawner extends TangibleObject{
|
||||
public static final int Dearic10 = 9;
|
||||
public static final int Dearic11 = 10;
|
||||
|
||||
public static final int Keren1 = 11;
|
||||
public static final int Keren2 = 12;
|
||||
public static final int Keren3 = 13;
|
||||
public static final int Keren4 = 14;
|
||||
public static final int Keren5 = 15;
|
||||
public static final int Keren6 = 16;
|
||||
public static final int Keren7 = 17;
|
||||
|
||||
public static final int Bestine1 = 18;
|
||||
public static final int Bestine2 = 19;
|
||||
public static final int Bestine3 = 20;
|
||||
public static final int Bestine4 = 21;
|
||||
public static final int Bestine5 = 22;
|
||||
public static final int Bestine6 = 23;
|
||||
public static final int Bestine7 = 24;
|
||||
public static final int Bestine8 = 25;
|
||||
public static final int Bestine9 = 26;
|
||||
}
|
||||
|
||||
public int getTotalSpawnedUnits() {
|
||||
return totalSpawnedUnits;
|
||||
}
|
||||
|
||||
public void setTotalSpawnedUnits(int totalSpawnedUnits) {
|
||||
this.totalSpawnedUnits = totalSpawnedUnits;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1778
-510
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -283,13 +283,13 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
} else if(Template.startsWith("object/tangible/destructible/shared_gcw_city_construction_beacon")) {
|
||||
|
||||
float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f;
|
||||
float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1.5f;
|
||||
Point3D newpoint = new Point3D(position.x,positionY,position.z);
|
||||
object = new GCWPylon(objectID, planet, position, orientation, Template);
|
||||
|
||||
} else if(Template.startsWith("object/tangible/loot/creature_loot/collections/shared_dejarik_table_base")) {
|
||||
|
||||
float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)+1f;
|
||||
float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)+0.3f;
|
||||
Point3D newpoint = new Point3D(position.x,positionY,position.z);
|
||||
object = new GCWSpawner(objectID, planet, position, orientation, Template);
|
||||
|
||||
@@ -303,6 +303,17 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
//object = new BuildingObject(objectID, planet, position, orientation, Template);
|
||||
|
||||
} else if(Template.startsWith("object/tangible/gcw/static_base/shared_invisible_cloner")) {
|
||||
|
||||
object = new BuildingObject(objectID, planet, position, orientation, Template);
|
||||
if(!isSnapshot && !overrideSnapshot && object.getPortalVisitor() != null) {
|
||||
int cellCount = object.getPortalVisitor().cells.size() - 1; // -1 for index 0 cell which is outside the building and used for ai pathfinding
|
||||
for (int i = 0; i < cellCount; i++) {
|
||||
CellObject cell = (CellObject) createObject("object/cell/shared_cell.iff", planet);
|
||||
cell.setCellNumber(i+1);
|
||||
object.add(cell);
|
||||
}
|
||||
}
|
||||
} else if(Template.startsWith("object/tangible")) {
|
||||
|
||||
object = new TangibleObject(objectID, planet, position, orientation, Template);
|
||||
@@ -1282,7 +1293,6 @@ public class ObjectService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void loadBuildoutObjects(Planet planet) throws InstantiationException, IllegalAccessException {
|
||||
|
||||
DatatableVisitor buildoutTable = ClientFileManager.loadFile("datatables/buildout/areas_" + planet.getName() + ".iff", DatatableVisitor.class);
|
||||
|
||||
for (int i = 0; i < buildoutTable.getRowCount(); i++) {
|
||||
@@ -1290,7 +1300,6 @@ public class ObjectService implements INetworkDispatch {
|
||||
String areaName = (String) buildoutTable.getObject(i, 0);
|
||||
float x1 = (Float) buildoutTable.getObject(i, 1);
|
||||
float z1 = (Float) buildoutTable.getObject(i, 2);
|
||||
|
||||
readBuildoutDatatable(ClientFileManager.loadFile("datatables/buildout/" + planet.getName() + "/" + areaName + ".iff", DatatableVisitor.class), planet, x1, z1);
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class MobileTemplate implements Cloneable {
|
||||
private String PCDTemplate="";
|
||||
private String conversationFileName="";
|
||||
private boolean AIEnabled = true;
|
||||
private boolean noAI = false;
|
||||
|
||||
|
||||
public Vector<String> getTemplates() {
|
||||
@@ -378,5 +379,13 @@ public class MobileTemplate implements Cloneable {
|
||||
public void setAIEnabled(boolean aIEnabled) {
|
||||
AIEnabled = aIEnabled;
|
||||
}
|
||||
|
||||
public boolean isNoAI() {
|
||||
return noAI;
|
||||
}
|
||||
|
||||
public void setNoAI(boolean noAI) {
|
||||
this.noAI = noAI;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import protocol.swg.UpdateContainmentMessage;
|
||||
import resources.common.collidables.CollidableBox;
|
||||
import resources.common.collidables.CollidableCircle;
|
||||
import resources.datatables.Options;
|
||||
@@ -164,6 +165,11 @@ public class SpawnService {
|
||||
defaultWeapon.setWeaponType(weaponTemplates.get(rnd).getWeaponType());
|
||||
defaultWeapon.setMaxRange(weaponTemplates.get(rnd).getMaxRange());
|
||||
defaultWeapon.setDamageType(weaponTemplates.get(rnd).getDamageType());
|
||||
if (defaultWeapon.getTemplate().contains("atst_ranged")){
|
||||
defaultWeapon.setStfFilename("theme_park_name");
|
||||
defaultWeapon.setStfName("at_st");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (weaponTemplates.get(rnd).getMinDamage() != 0 && weaponTemplates.get(rnd).getMaxDamage() != 0) {
|
||||
@@ -174,8 +180,14 @@ public class SpawnService {
|
||||
defaultWeapon.setMinDamage(creature.getLevel() * 22);
|
||||
}
|
||||
|
||||
creature.addObjectToEquipList(defaultWeapon);
|
||||
creature.add(defaultWeapon);
|
||||
if (!defaultWeapon.getTemplate().contains("atst_ranged"))
|
||||
creature.addObjectToEquipList(defaultWeapon);
|
||||
if (!defaultWeapon.getTemplate().contains("atst_ranged"))
|
||||
creature.add(defaultWeapon);
|
||||
else {
|
||||
UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(defaultWeapon.getObjectID(), creature.getObjectID(), 4);
|
||||
creature.notifyClients(updateContainmentMessage.serialize(),true);
|
||||
}
|
||||
creature.setWeaponId(defaultWeapon.getObjectID());
|
||||
creature.addObjectToEquipList(inventory);
|
||||
creature.add(inventory);
|
||||
@@ -213,9 +225,15 @@ public class SpawnService {
|
||||
}
|
||||
|
||||
if (mobileTemplate.isAIEnabled()){
|
||||
AIActor actor = new AIActor(creature, creature.getPosition(), scheduler);
|
||||
if (!mobileTemplate.isNoAI()){ // NoAI is for QuestGivers that don't fight to save resources
|
||||
AIActor actor = new AIActor(creature, creature.getPosition(), scheduler);
|
||||
creature.setAttachment("AI", actor);
|
||||
actor.setMobileTemplate(mobileTemplate);
|
||||
}
|
||||
} else { // AIEnabled is to dynamically switch the AI on later
|
||||
AIActor actor = new AIActor(creature, creature.getPosition(), scheduler, false);
|
||||
creature.setAttachment("AI", actor);
|
||||
actor.setMobileTemplate(mobileTemplate);
|
||||
actor.setMobileTemplate(mobileTemplate);
|
||||
}
|
||||
|
||||
creature.setAttachment("radial_filename", "npc/mobile");
|
||||
|
||||
Reference in New Issue
Block a user