mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-06 21:12:59 -04:00
@@ -0,0 +1,74 @@
|
||||
import sys
|
||||
import engine.resources.scene.Point3D
|
||||
import resources.common.Forager
|
||||
import time
|
||||
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
|
||||
#if actor.getSkills('Foraging')==0:
|
||||
#actor.sendSystemMessage('@skl_use:sys_forage_noskill'),0)
|
||||
|
||||
#if actor.isForaging()==1:
|
||||
#actor.sendSystemMessage('@skl_use:sys_forage_already',0)
|
||||
#return
|
||||
|
||||
if actor.getCombatFlag()!=0:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_combatfail',0)
|
||||
return
|
||||
|
||||
if actor.getPosture()!=0:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_cant',0)
|
||||
return
|
||||
|
||||
if core.terrainService.isWater(actor.getPlanet(), actor.getPosition().x, actor.getPosition().z):
|
||||
actor.sendSystemMessage('You cannot forage while in water.',0)
|
||||
return
|
||||
|
||||
if actor.getContainer() != None:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_inside',0)
|
||||
return
|
||||
|
||||
if actor.getAction() < 200:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_attrib',0)
|
||||
return
|
||||
|
||||
somepoint = engine.resources.scene.Point3D(0,0,0)
|
||||
if actor.getAttachment('PostForagePosition')==None:
|
||||
actor.setAttachment('PostForagePosition', somepoint)
|
||||
|
||||
oldposition = actor.getAttachment('PostForagePosition')
|
||||
if actor.getPosition().getDistance2D(oldposition)<5:
|
||||
|
||||
actor.sendSystemMessage("@skl_use:sys_forage_empty", 0);
|
||||
return
|
||||
|
||||
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_start', 0)
|
||||
|
||||
actor.setAttachment("PreForagePosition", actor.getPosition())
|
||||
actor.setCurrentAnimation('forage')
|
||||
time.sleep(1) # does NOT stall other python scripts, tested
|
||||
# Each command might be its own thread
|
||||
|
||||
actor.setAttachment("PostForagePosition", actor.getPosition())
|
||||
|
||||
if actor.getCombatFlag()!=0:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_combatfail',0)
|
||||
return
|
||||
|
||||
oldposition = actor.getAttachment("PreForagePosition")
|
||||
if actor.getPosition().getDistance2D(oldposition)>2:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_movefail',0)
|
||||
return
|
||||
|
||||
|
||||
|
||||
forager = resources.common.Forager()
|
||||
forager.handleForageResults(actor)
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
import resources.common.Forager
|
||||
import time
|
||||
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
actor.sendSystemMessage('Test1', 1)
|
||||
time.sleep(1)
|
||||
actor.sendSystemMessage('Test2', 1)
|
||||
time.sleep(1)
|
||||
actor.sendSystemMessage('Test3', 1)
|
||||
time.sleep(1)
|
||||
actor.sendSystemMessage('Test4', 1)
|
||||
time.sleep(1)
|
||||
actor.sendSystemMessage('Test5', 1)
|
||||
time.sleep(1)
|
||||
actor.sendSystemMessage('Test6', 1)
|
||||
time.sleep(1)
|
||||
actor.sendSystemMessage('Test7', 1)
|
||||
time.sleep(1)
|
||||
actor.sendSystemMessage('Test8', 1)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return ''
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Bracelet of Inspired Status (Right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Entertainer'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 80
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_en_inspire_pulse_duration_increase','1']
|
||||
return mods
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Adventurer Hiker & Hunter Counter-Toxin Wristband Prototype IV (right)'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 75
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['absorption_bleeding','8']
|
||||
mods += ['absorption_disease','8']
|
||||
mods += ['absorption_fire','8']
|
||||
mods += ['absorption_poison','8']
|
||||
return mods
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/misc/shared_force_crystal.iff']
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s06_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Corellidyne Personal Insurgency Wris Implantat -BLACK- (Right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Spy'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 75
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_action_line_sp_dm','4']
|
||||
mods += ['expertise_critical_line_sp_dm','4']
|
||||
mods += ['expertise_damage_line_sp_dm','4']
|
||||
mods += ['expertise_freeshot_sp_dm','4']
|
||||
return mods
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Idellian Arrays PLFS-4000 Insurgent Scanner Wrist Module (Right)'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 75
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['detect_hidden','10']
|
||||
return mods
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s04_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Jedi Knight Meditation Bracelet (right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Jedi'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 75
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['jedi_saber_assembly','3']
|
||||
mods += ['jedi_saber_experimentation','10']
|
||||
return mods
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s02_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Jedi Knight\'s Wristguard (Right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Jedi'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 85
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_action_line_fs_dm','4']
|
||||
mods += ['expertise_critical_line_fs_dm','4']
|
||||
mods += ['expertise_damage_line_fs_dm','4']
|
||||
mods += ['expertise_freeshot_fs_dm','4']
|
||||
return mods
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s02_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Jedi\'s Wristguard (Right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Jedi'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 61
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_action_line_fs_dm','3']
|
||||
mods += ['expertise_critical_line_fs_dm','3']
|
||||
mods += ['expertise_damage_line_fs_dm','3']
|
||||
mods += ['expertise_freeshot_fs_dm','3']
|
||||
return mods
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Saldalith Manufacturing Verdicator 200A (Right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Medic'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 85
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_action_line_me_dm','4']
|
||||
mods += ['expertise_critical_line_me_dm','4']
|
||||
mods += ['expertise_damage_line_me_dm','4']
|
||||
mods += ['expertise_healing_all','4']
|
||||
return mods
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/generic_usable/shared_datadisk_generic.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Mysterious Data Disk'
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'SoroSuub Personnel Comlink Wrist-P4 (right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Officer'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 85
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_action_line_of_sure','4']
|
||||
mods += ['expertise_critical_line_of_sure','4']
|
||||
mods += ['expertise_damage_line_of_sure','4']
|
||||
mods += ['expertise_freeshot_of_sure','4']
|
||||
return mods
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Merr-Sonn Targeter Ranging Wrist Assist V4 (right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Smuggler'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 85
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['fast_attack_line_sm_dm','4']
|
||||
mods += ['expertise_critical_line_sm_dm','4']
|
||||
mods += ['expertise_damage_line_sm_dm','4']
|
||||
mods += ['expertise_freeshot_sm_dm','4']
|
||||
return mods
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Traxes BioElectronic Targeting Assist Wrist Implant PTI-IV (Right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Commando'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 85
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_action_line_co_dm','4']
|
||||
mods += ['expertise_critical_line_co_dm','4']
|
||||
mods += ['expertise_damage_line_co_dm','4']
|
||||
mods += ['expertise_freeshot_co_dm','4']
|
||||
return mods
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Blastech Wristek - Wrist Assault Booster Zulu (right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Bounty Hunter'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 85
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['expertise_action_line_fs_dm','4']
|
||||
mods += ['expertise_critical_line_dm','4']
|
||||
mods += ['expertise_damage_line_dm','4']
|
||||
mods += ['expertise_freeshot_dm','4']
|
||||
return mods
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Courier Wrist Communications Scanner SCNv4 (Right)'
|
||||
|
||||
def requiredProfession():
|
||||
|
||||
return 'Bounty Hunter'
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 75
|
||||
|
||||
def itemSkillMods():
|
||||
|
||||
mods = ['droid_find_speed','10']
|
||||
mods += ['expertise_critical_niche_pvp','2']
|
||||
return mods
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/creature_loot/collections/shared_purple_rnd_cut_gem_style1.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Rare Ankarres Sapphire'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 80
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/creature_loot/collections/shared_purple_rnd_cut_gem_style1.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Rare Corusca Gem'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 80
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/creature_loot/collections/shared_purple_rnd_cut_gem_style1.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Rare Nova Crystal'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 80
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/creature_loot/collections/shared_purple_rnd_cut_gem_style1.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Rare Power Gem'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 80
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/creature_loot/collections/shared_purple_rnd_cut_gem_style1.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Rare Rol Stone'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 80
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
def itemTemplate():
|
||||
|
||||
return ['object/tangible/loot/creature_loot/collections/shared_purple_rnd_cut_gem_style1.iff']
|
||||
|
||||
def customItemName():
|
||||
|
||||
return 'Rare Sasho Gem'
|
||||
|
||||
def biolink():
|
||||
|
||||
return 1
|
||||
|
||||
def requiredCL():
|
||||
|
||||
return 80
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
def itemNames():
|
||||
|
||||
return ['adv_agility_stim_80','adv_power_stim_80']
|
||||
|
||||
def itemChances():
|
||||
|
||||
return [50,50]
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
def itemNames():
|
||||
return ['flask_of_elba_water ','flask_of_naris-bud_tea','small_flask_of_nerfmilk']
|
||||
|
||||
def itemChances():
|
||||
return [33,33,33]
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
def itemNames():
|
||||
|
||||
components = ['jedi_relic_1','jedi_relic_2','colorcrystal']
|
||||
components += ['powercrystal_select','powercrystal_premium']
|
||||
components += ['kraytpearl_select','kraytpearl_premium','kraytpearl_flawless','kraytpearl_ancient_flawless']
|
||||
components += ['jedi_holocron_2_5','jedi_holocron_4_5','sith_holocron_4_5']
|
||||
return components
|
||||
|
||||
def itemChances():
|
||||
|
||||
return [48,2,29,3,2,5,4,1,0.1,5.7,0.1,0.1] #11
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
def itemNames():
|
||||
names = ['jedi_wristguard(right)']
|
||||
|
||||
return names
|
||||
|
||||
def itemChances():
|
||||
return [100]
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
def itemNames():
|
||||
names = ['jedi_knight_meditation_bracelet_(right)','wrist_communications_scanner_SCNv4_(right)']
|
||||
names += ['insurgent_scanner_wrist_module_(right)','counter-toxin_wristband_prototype_IV_(right)','insurgency_wrist_implantat-BLACK-(right)']
|
||||
return names
|
||||
|
||||
def itemChances():
|
||||
return [20,20,20,20,20]
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
def itemNames():
|
||||
names = ['jedi_knights_wristguard_(right)','wrist_assault_booster_zulu_(right)','targeting_assist_wrist_implant_PTI-IV_(right)']
|
||||
names += ['personnel_comlink_wrist-P4_(right)','manufacturing_verdicator_200a_(right)']
|
||||
names += ['targeter_ranging_wrist_assist_V4_(right)','bracelet_of_Inspired_Status(right)']
|
||||
|
||||
return names
|
||||
|
||||
def itemChances():
|
||||
return [16,14,14,14,14,14,14]
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
def itemTemplates():
|
||||
names = ['rare_nova_crystal','rare_rol_stone','rare_power_gem']
|
||||
names += ['rare_corusca_gem','rare_sasho_gem','rare_ankarres_sapphire']
|
||||
return names
|
||||
|
||||
def itemChances():
|
||||
return [15,17,17,17,17,17]
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
def itemNames():
|
||||
names = ['mysterious_data_disk']
|
||||
|
||||
return names
|
||||
|
||||
def itemChances():
|
||||
return [100]
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
def itemNames():
|
||||
return ['textiles_survival_backpack_(schematic)','textiles_survival_backpack_V2_(schematic)']
|
||||
|
||||
def itemChances():
|
||||
return [60,40]
|
||||
@@ -0,0 +1,39 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('forage_goon')
|
||||
mobileTemplate.setLevel(1)
|
||||
mobileTemplate.setDifficulty(1)
|
||||
mobileTemplate.setAttackRange(6)
|
||||
mobileTemplate.setAttackSpeed(1.0)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_criminal_assassin_human_female_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_criminal_assassin_human_male_01.iff')
|
||||
templates.add('object/mobile/shared_twilek_male.iff')
|
||||
templates.add('object/mobile/shared_dressed_binayre_pirate_zabrak_male_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_borvos_thug.iff')
|
||||
templates.add('object/mobile/shared_wookiee_male.iff')
|
||||
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_dh17.iff', 1, 0.6)
|
||||
weaponTemplates.add(weapontemplate)
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/pistol/shared_pistol_dl44.iff', 2, 0.4)
|
||||
weaponTemplates.add(weapontemplate)
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_dlt20a.iff', 0, 0.8)
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedshot')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('forage_goon', mobileTemplate)
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('treasure_guard')
|
||||
mobileTemplate.setLevel(1)
|
||||
mobileTemplate.setDifficulty(1)
|
||||
mobileTemplate.setAttackRange(6)
|
||||
mobileTemplate.setAttackSpeed(1.0)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_human_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_human_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_human_03.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_human_04.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_human_05.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_human_06.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_human_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_human_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_human_03.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_human_04.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_twk_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_twk_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_twk_03.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_zab_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_zab_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_male_zab_03.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_twk_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_twk_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_twk_03.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_zab_01.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_zab_02.iff')
|
||||
templates.add('object/mobile/shared_dressed_dark_jedi_female_zab_03.iff')
|
||||
|
||||
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff', 9, 1.0)
|
||||
weaponTemplates.add(weapontemplate)
|
||||
weapontemplate = WeaponTemplate('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff', 10, 1.0)
|
||||
weaponTemplates.add(weapontemplate)
|
||||
weapontemplate = WeaponTemplate('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff', 11, 1.0)
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('saberHit')
|
||||
mobileTemplate.setDefaultAttack('fs_flurry_1')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('treasure_guard', mobileTemplate)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from java.util import Vector
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('forage_worm')
|
||||
mobileTemplate.setLevel(1)
|
||||
mobileTemplate.setDifficulty(1)
|
||||
mobileTemplate.setAttackRange(6)
|
||||
mobileTemplate.setAttackSpeed(1.0)
|
||||
mobileTemplate.setWeaponType(6)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_col_forage_aggravated_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_angry_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_brutal_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_carnivorous_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_ferocious_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_fierce_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_hungry_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_oozing_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_savage_worm.iff')
|
||||
templates.add('object/mobile/shared_col_forage_territorial_worm.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', 6, 1.0)
|
||||
weaponTemplates.add(weapontemplate)
|
||||
#mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('creatureMeleeAttack')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('forage_worm', mobileTemplate)
|
||||
|
||||
@@ -10,6 +10,7 @@ def addTemplate(core):
|
||||
mobileTemplate.setLevel(10)
|
||||
mobileTemplate.setDifficulty(1)
|
||||
mobileTemplate.setAttackRange(24)
|
||||
mobileTemplate.setAttackSpeed(1.0)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_tusken_raider.iff')
|
||||
|
||||
@@ -11,6 +11,10 @@ def addTemplate(core):
|
||||
mobileTemplate.setAttackRange(5)
|
||||
mobileTemplate.setAttackSpeed(5)
|
||||
mobileTemplate.setLevel(5)
|
||||
mobileTemplate.setAttackRange(3)
|
||||
mobileTemplate.setAttackSpeed(1.0)
|
||||
mobileTemplate.setWeaponType(6)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('creatureMeleeAttack')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
from resources.common import RadialOptions
|
||||
from services.sui import SUIWindow
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from java.util import Vector
|
||||
import resources.common.SpawnPoint
|
||||
import engine.resources.scene.Point3D
|
||||
import main.NGECore
|
||||
import resources.common.Forager
|
||||
from resources.objects.waypoint import WaypointObject
|
||||
from engine.resources.common import CRC
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
radials.clear()
|
||||
radials.add(RadialOptions(0, 21, 1, 'Open'))
|
||||
radials.add(RadialOptions(0, 7, 1, 'Examine'))
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
|
||||
if option == 21 and target:
|
||||
|
||||
if target.getAttachment('TreasureExtractorID')!=owner.getObjectID():
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:wrong_player',0);
|
||||
return
|
||||
|
||||
forager = resources.common.Forager()
|
||||
if forager.countAliveGuards(target)>0:
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:kill_guards_message',0);
|
||||
return
|
||||
|
||||
core.simulationService.openContainer(owner, target);
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
from resources.common import RadialOptions
|
||||
from services.sui import SUIWindow
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from java.util import Vector
|
||||
import resources.common.SpawnPoint
|
||||
import engine.resources.scene.Point3D
|
||||
import main.NGECore
|
||||
from resources.objects.waypoint import WaypointObject
|
||||
from engine.resources.common import CRC
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
radials.add(RadialOptions(0, 21, 1, '@treasure_map/treasure_map:use'))
|
||||
radials.add(RadialOptions(0, 7, 1, ''))
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
if option == 21 and target:
|
||||
|
||||
mapPlanet = target.getAttachment('MapPlanet')
|
||||
planet = core.terrainService.getPlanetByID(mapPlanet)
|
||||
if planet==None:
|
||||
owner.sendSystemMessage('The treasure map disk is faulty, no Planet',0)
|
||||
return
|
||||
|
||||
planetName = planet.getName()
|
||||
#if owner.getPlanetId()!=mapPlanet:
|
||||
#owner.sendSystemMessage('The treasure is buried on ' + planetName,0)
|
||||
#return
|
||||
|
||||
window = core.suiService.createSUIWindow('Script.listBox', owner, target, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@treasure_map/treasure_map:title_'+target.getAttachment('MapSTFName'))
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@treasure_map/treasure_map:text_'+target.getAttachment('MapSTFName'))
|
||||
|
||||
window.setProperty('btnCancel:visible', 'True')
|
||||
window.setProperty('btnOk:visible', 'True')
|
||||
window.setProperty('btnCancel:Text', '@treasure_map/treasure_map:close')
|
||||
window.setProperty('btnOk:Text', '@treasure_map/treasure_map:store_waypoint')
|
||||
returnList = Vector()
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, storeWaypoint)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, close)
|
||||
|
||||
owner.setAttachment('LastReadMap',target)
|
||||
|
||||
core.suiService.openSUIWindow(window);
|
||||
|
||||
return
|
||||
|
||||
def storeWaypoint(owner, window, eventType, returnList):
|
||||
planetCenter = engine.resources.scene.Point3D(0,0,0)
|
||||
#treasureLocation = resources.common.SpawnPoint.getRandomPosition(planetCenter, 2000, 6000, owner.getPlanetId());
|
||||
treasureLocation = resources.common.SpawnPoint.getRandomPosition(owner.getPosition(), 1, 50, owner.getPlanetId());
|
||||
waypoint = main.NGECore.getInstance().objectService.createObject('object/waypoint/shared_waypoint.iff', owner.getPlanet(), treasureLocation.x, treasureLocation.z, treasureLocation.y)
|
||||
waypoint.setName('Treasure Map')
|
||||
waypoint.setActive(True)
|
||||
waypoint.setColor(WaypointObject.YELLOW)
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(owner.getPlanet().name))
|
||||
waypoint.setStringAttribute('', '')
|
||||
ghost = owner.getSlottedObject('ghost')
|
||||
ghost.waypointAdd(waypoint)
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_store_waypoint', 0)
|
||||
readMap = owner.getAttachment('LastReadMap')
|
||||
readMap.setAttachment('radial_filename', 'object/treasuremapRead');
|
||||
readMap.setAttachment('MapAreaLocation', treasureLocation);
|
||||
return
|
||||
|
||||
|
||||
def close(owner, window, eventType, returnList):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
from resources.common import RadialOptions
|
||||
from services.sui import SUIWindow
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from java.util import Vector
|
||||
import resources.common.SpawnPoint
|
||||
import engine.resources.scene.Point3D
|
||||
import main.NGECore
|
||||
import resources.common.Forager
|
||||
from resources.objects.waypoint import WaypointObject
|
||||
from engine.resources.common import CRC
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
radials.add(RadialOptions(0, 21, 1, '@treasure_map/treasure_map:extract_treasure'))
|
||||
radials.add(RadialOptions(0, 7, 1, ''))
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
if option == 21 and target and owner:
|
||||
exactLoc = target.getAttachment('MapExactLocation')
|
||||
|
||||
#if owner.getPosition().getDistance2D(owner.getPosition())<20:
|
||||
if owner.getPosition().getDistance2D(exactLoc)<20:
|
||||
|
||||
target.setAttachment('radial_filename', 'object/usable')
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_dist_here',0)
|
||||
#spawn guards
|
||||
forager = resources.common.Forager()
|
||||
forager.handleGuardSpawn(owner,target)
|
||||
else:
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_dist_near',0)
|
||||
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
from resources.common import RadialOptions
|
||||
from services.sui import SUIWindow
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from java.util import Vector
|
||||
import resources.common.SpawnPoint
|
||||
import engine.resources.scene.Point3D
|
||||
import main.NGECore
|
||||
from resources.objects.waypoint import WaypointObject
|
||||
from engine.resources.common import CRC
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
radials.add(RadialOptions(0, 21, 1, '@treasure_map/treasure_map:search_area'))
|
||||
radials.add(RadialOptions(0, 7, 1, ''))
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
if option == 21 and target:
|
||||
|
||||
planetID = target.getAttachment('MapPlanet')
|
||||
if planetID!=owner.getPlanetId():
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:wrong_planet',0)
|
||||
|
||||
if owner.getCombatFlag()!=0:
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_no_combat',0)
|
||||
return
|
||||
|
||||
if owner.getPosture()==10:
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_no_mount',0)
|
||||
return
|
||||
|
||||
|
||||
areaLoc = target.getAttachment('MapAreaLocation');
|
||||
owner.sendSystemMessage('owner.getPosition().getDistance2D(areaLoc) %s' % owner.getPosition().getDistance2D(areaLoc),0)
|
||||
|
||||
if owner.getPosition().getDistance2D(areaLoc)<20:
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_success',0)
|
||||
|
||||
treasureLocation = resources.common.SpawnPoint.getRandomPosition(owner.getPosition(), 1, 100, owner.getPlanetId());
|
||||
waypoint = main.NGECore.getInstance().objectService.createObject('object/waypoint/shared_waypoint.iff', owner.getPlanet(), treasureLocation.x, treasureLocation.z, treasureLocation.y)
|
||||
waypoint.setName('Exact Location of the Treasure')
|
||||
waypoint.setActive(True)
|
||||
waypoint.setColor(WaypointObject.YELLOW)
|
||||
waypoint.setPlanetCRC(CRC.StringtoCRC(owner.getPlanet().name))
|
||||
waypoint.setStringAttribute('', '')
|
||||
ghost = owner.getSlottedObject('ghost')
|
||||
ghost.waypointAdd(waypoint)
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_store_waypoint', 0)
|
||||
readMap = owner.getAttachment('LastReadMap')
|
||||
readMap.setAttachment('radial_filename', 'object/treasuremapExtract');
|
||||
readMap.setAttachment('MapExactLocation', treasureLocation);
|
||||
else:
|
||||
owner.sendSystemMessage('@treasure_map/treasure_map:sys_cant_pinpoint',0)
|
||||
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,520 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
import main.NGECore;
|
||||
import resources.datatables.Options;
|
||||
import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.loot.LootGroup;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import services.ai.AIActor;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
public class Forager {
|
||||
|
||||
public static final int LYASE_ENZYME = 0;
|
||||
public static final int RARE_COMPONENT = 1;
|
||||
public static final int INSECT_BAIT = 2;
|
||||
public static final int GRUB_BAIT = 3;
|
||||
public static final int WORM_BAIT = 4;
|
||||
public static final int MYSTERIOUS_DATA_DISC = 5;
|
||||
|
||||
private int[] mapPlanetIDs = new int[]{6,7,8};
|
||||
|
||||
// consider foraged food food/foraged
|
||||
// tangible/item/treasure_map/shared_relic_buff_s01.iff
|
||||
|
||||
public Forager(){
|
||||
|
||||
}
|
||||
|
||||
public boolean handleForageResults(CreatureObject forager){
|
||||
// determine foraged object
|
||||
SWGObject foragerInventory = forager.getSlottedObject("inventory");
|
||||
|
||||
|
||||
// you can use Kommerken Steak food which increases your
|
||||
// foraging chance by 12% and gives you a
|
||||
// 5% bonus chance of finding a treasure map.
|
||||
|
||||
int randomForageRoll = new Random().nextInt(100);
|
||||
int randomForageObjectRoll = new Random().nextInt(100);
|
||||
int remainder = 0;
|
||||
int forageResultChance = 100;
|
||||
int kommerkenBonus = 0;
|
||||
|
||||
int[] forageChances = new int[]{10,10,25,25,25,5};
|
||||
int[] forageChances2 = new int[]{12,10,21,23,24,10}; // Kommerken Steak
|
||||
int[] forageChances3 = new int[]{20,9,22,22,22,5}; // if you got the pig
|
||||
|
||||
|
||||
int chosenObject = 0;
|
||||
|
||||
// if (forager.hasChuckedIn(KommerkenSteak)){
|
||||
// kommerkenBonus = 12;
|
||||
// forageChances = forageChances2;
|
||||
// }
|
||||
|
||||
// if (forager.gotThePig(pig)){
|
||||
// forageChances = forageChances3;
|
||||
//}
|
||||
//forager.sendSystemMessage("randomForageRoll " + randomForageRoll,(byte) 0);
|
||||
if (randomForageRoll<forageResultChance+kommerkenBonus) {
|
||||
|
||||
for(int i=0;i<forageChances.length;i++) {
|
||||
remainder += forageChances[i];
|
||||
if (randomForageObjectRoll <= remainder){
|
||||
chosenObject = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (forager.getInventoryItemCount()>=80){
|
||||
chosenObject = 6;
|
||||
forager.sendSystemMessage("@skl_use:sys_forage_noroom",(byte) 0);
|
||||
}
|
||||
|
||||
// chosenObject = 5; // To test TMs
|
||||
if(forager.getClient().isGM()) // Always yield a TM for testing
|
||||
chosenObject = 5;
|
||||
|
||||
//forager.sendSystemMessage("chosenObject " + chosenObject,(byte) 0);
|
||||
switch (chosenObject) {
|
||||
|
||||
case LYASE_ENZYME: String template = "object/tangible/loot/beast/shared_enzyme_2.iff";
|
||||
TangibleObject foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet());
|
||||
// determine color here
|
||||
foragedObject.setCustomizationVariable("/private/index_color_1", (byte) new Random().nextInt(10)); // edb_vial.pal
|
||||
foragerInventory.add(foragedObject);
|
||||
forager.sendSystemMessage("",(byte) 0);
|
||||
break;
|
||||
|
||||
case RARE_COMPONENT: template = "object/tangible/loot/beast/shared_enzyme_1.iff"; // for now, must find temp
|
||||
foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet());
|
||||
foragerInventory.add(foragedObject);
|
||||
forager.sendSystemMessage("",(byte) 0);
|
||||
break;
|
||||
|
||||
case INSECT_BAIT: template = "object/tangible/fishing/bait/shared_bait_insect.iff";
|
||||
foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet());
|
||||
foragerInventory.add(foragedObject);
|
||||
forager.sendSystemMessage("",(byte) 0);
|
||||
break;
|
||||
|
||||
case GRUB_BAIT: template = "object/tangible/fishing/bait/shared_bait_grub.iff";
|
||||
foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet());
|
||||
foragerInventory.add(foragedObject);
|
||||
forager.sendSystemMessage("",(byte) 0);
|
||||
break;
|
||||
|
||||
case WORM_BAIT: template = "object/tangible/fishing/bait/shared_bait_worm.iff";
|
||||
foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet());
|
||||
foragerInventory.add(foragedObject);
|
||||
forager.sendSystemMessage("",(byte) 0);
|
||||
break;
|
||||
|
||||
case MYSTERIOUS_DATA_DISC: template = "object/tangible/loot/generic_usable/shared_datadisk_generic.iff";
|
||||
foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet());
|
||||
foragedObject.setCustomName(getLevelDependentMapName(forager.getLevel()));
|
||||
foragedObject.setAttachment("MapLevel", forager.getLevel());
|
||||
foragedObject.setAttachment("MapSTFName", getLevelDependentSTFName(forager.getLevel()));
|
||||
int mapPlanetID = new Random().nextInt(mapPlanetIDs.length-1);
|
||||
foragedObject.setAttachment("MapPlanet", mapPlanetIDs[mapPlanetID]);
|
||||
//System.out.println("mapPlanetID " + mapPlanetIDs[mapPlanetID]);
|
||||
foragedObject.setAttachment("radial_filename", "object/treasuremap");
|
||||
//foragedObject.setAttachment("radial_filename", "object/treasuremapExtract");
|
||||
foragerInventory.add(foragedObject);
|
||||
forager.sendSystemMessage("",(byte) 0);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
///object/tangible/treasure_map/shared_treasure_map_base.iff shared_treasure_map_quest.iff
|
||||
}
|
||||
|
||||
if (chosenObject<6)
|
||||
forager.sendSystemMessage("@skl_use:sys_forage_success",(byte) 0);
|
||||
|
||||
// spawn adversaries
|
||||
int adversaryRoll = new Random().nextInt(100);
|
||||
// A new buff is imaginable that would decrease the chance of running into adversaries here, just an idea
|
||||
|
||||
if (chosenObject>6)
|
||||
adversaryRoll=999;
|
||||
|
||||
// adversaryRoll=999; // To test TMs
|
||||
|
||||
if (adversaryRoll<14) { // 14 100 // To test TMs
|
||||
int adversaryTypeRoll = new Random().nextInt(100);
|
||||
if (adversaryTypeRoll<50){
|
||||
// wormie
|
||||
spawnWormie(forager);
|
||||
} else {
|
||||
// goon
|
||||
spawnGoon(forager);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
forager.sendSystemMessage("@skl_use:sys_forage_fail",(byte) 0);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getLevelDependentMapName(int level){
|
||||
if (level>=1 && level<=10)
|
||||
return "Mysterious Data Disk (Adventurer's Treasure)";
|
||||
if (level>=11 && level<=20)
|
||||
return "Mysterious Data Disk (Villager's Hidden Savings)";
|
||||
if (level>=21 && level<=30)
|
||||
return "A map to a Trader's Hidden Treasure";
|
||||
if (level>=31 && level<=40)
|
||||
return "A map to a Bounty Hunter's Hidden Stash";
|
||||
if (level>=41 && level<=50)
|
||||
return "A droid's data disk with map coordinates";
|
||||
if (level>=51 && level<=60)
|
||||
return "A map to a Jedi Knight's body";
|
||||
if (level>=61 && level<=70)
|
||||
return "A map to Jedi Artifacts";
|
||||
if (level>=71 && level<=80)
|
||||
return "A map to a cursed item";
|
||||
if (level>=81 && level<=90)
|
||||
return "Mysterious Data Disk (Mysterious Container) ";
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getLevelDependentSTFName(int level){
|
||||
if (level>=1 && level<=10)
|
||||
return "treasure_guard_adventurer";
|
||||
if (level>=11 && level<=20)
|
||||
return "treasure_guard_villager";
|
||||
if (level>=21 && level<=30)
|
||||
return "treasure_guard_trader";
|
||||
if (level>=31 && level<=40)
|
||||
return "treasure_guard_bounty_hunter";
|
||||
if (level>=41 && level<=50)
|
||||
return "treasure_guard_droid";
|
||||
if (level>=51 && level<=60)
|
||||
return "treasure_guard_padawan";
|
||||
if (level>=61 && level<=70)
|
||||
return "treasure_guard_jedi";
|
||||
if (level>=71 && level<=80)
|
||||
return "treasure_guard_jedi_elder";
|
||||
if (level>=81 && level<=90)
|
||||
return "treasure_guard_jedi_elite";
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void spawnWormie(CreatureObject forager){
|
||||
int level = forager.getLevel();
|
||||
String name = "";
|
||||
Point3D wormiePosition = SpawnPoint.getRandomPosition(forager.getPosition(), 1, 6, forager.getPlanetId());
|
||||
CreatureObject wormie = NGECore.getInstance().spawnService.spawnCreature("forage_worm", forager.getPlanet().getName(), 0L, wormiePosition.x, wormiePosition.y, wormiePosition.z, (short)level);
|
||||
switch (wormie.getTemplate()) {
|
||||
|
||||
case "object/mobile/shared_col_forage_aggravated_worm.iff":
|
||||
name = "An Aggravated Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_angry_worm.iff":
|
||||
name = "An Angry Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_brutal_worm.iff":
|
||||
name = "A Brutal Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_carnivorous_worm.iff":
|
||||
name = "A Carnivorous Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_ferocious_worm.iff":
|
||||
name = "A Ferocious Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_fierce_worm.iff":
|
||||
name = "A Fierce Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_hungry_worm.iff":
|
||||
name = "A Hungry Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_oozing_worm.iff":
|
||||
name = "An Oozing Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_savage_worm.iff":
|
||||
name = "A Savage Worm";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_col_forage_territorial_worm.iff":
|
||||
name = "A Territorial Worm";
|
||||
break;
|
||||
}
|
||||
wormie.setCustomName(name);
|
||||
wormie.setCustomName2(name);
|
||||
wormie.setLevel(forager.getLevel());
|
||||
wormie.setOptions(Options.AGGRESSIVE, true);
|
||||
wormie.setOptions(Options.ATTACKABLE, true);
|
||||
AIActor actor = (AIActor) wormie.getAttachment("AI");
|
||||
actor.addDefender(forager);
|
||||
}
|
||||
|
||||
public void spawnGoon(CreatureObject forager){
|
||||
System.out.println("GOON");
|
||||
int level = forager.getLevel();
|
||||
String name = "";
|
||||
Point3D wormiePosition = SpawnPoint.getRandomPosition(forager.getPosition(), 1, 6, forager.getPlanetId());
|
||||
CreatureObject goon = NGECore.getInstance().spawnService.spawnCreature("forage_goon", forager.getPlanet().getName(), 0L, wormiePosition.x, wormiePosition.y, wormiePosition.z, (short)level);
|
||||
// thief wookie criminal scavenger @forage_enemy:bark_thief
|
||||
String barkString = "";
|
||||
|
||||
switch (goon.getTemplate()) {
|
||||
|
||||
case "object/mobile/shared_dressed_criminal_assassin_human_female_01.iff":
|
||||
name = "A criminal";
|
||||
barkString = "bark_criminal";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_dressed_criminal_assassin_human_male_01.iff":
|
||||
name = "A Scavenger";
|
||||
barkString = "bark_scavenger";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_twilek_male.iff":
|
||||
name = "A Thief";
|
||||
barkString = "bark_thief";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_dressed_binayre_pirate_zabrak_male_01.iff":
|
||||
name = "A Pirate";
|
||||
barkString = "bark_thief";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_dressed_borvos_thug.iff":
|
||||
name = "A Thug";
|
||||
barkString = "bark_criminal";
|
||||
break;
|
||||
|
||||
case "object/mobile/shared_wookiee_male.iff":
|
||||
name = "A Thug";
|
||||
barkString = "bark_wookiee";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
goon.addObserver(forager);
|
||||
goon.setCustomName(name);
|
||||
goon.setCustomName2(name);
|
||||
goon.setLevel(forager.getLevel());
|
||||
goon.setOptions(Options.AGGRESSIVE, true);
|
||||
goon.setOptions(Options.ATTACKABLE, true);
|
||||
AIActor actor = (AIActor) goon.getAttachment("AI");
|
||||
actor.addDefender(forager);
|
||||
forager.sendSystemMessage("@foraging/forage_enemy:" + barkString,(byte) 0);
|
||||
//OutOfBand oob = new OutOfBand(new ProsePackage("@foraging/forage_enemy",barkString));
|
||||
OutOfBand oob = new OutOfBand(new ProsePackage("@jawa_trader","cant_understand"));
|
||||
forager.sendSystemMessage("@jawa_trader:cant_understand",(byte) 0);
|
||||
NGECore.getInstance().chatService.spatialChat(goon, forager, "", (short)0x0, (short)0x0, 1, oob);
|
||||
}
|
||||
|
||||
public void handleGuardSpawn(CreatureObject owner, TangibleObject map){
|
||||
System.err.println("handleGuardSpawn");
|
||||
short spawnLevel = (short) map.getAttachment("MapLevel");
|
||||
//Point3D exactTreasureLocation = (Point3D) map.getAttachment("MapExactLocation");
|
||||
Point3D exactTreasureLocation = owner.getPosition();
|
||||
|
||||
GroupObject extractorGroup = null;
|
||||
if (owner.getGroupId()!=0)
|
||||
extractorGroup = (GroupObject) NGECore.getInstance().objectService.getObject(owner.getGroupId());
|
||||
|
||||
int extractorGroupSize = 1;
|
||||
if (extractorGroup!=null)
|
||||
extractorGroupSize = extractorGroup.getMemberList().size();
|
||||
|
||||
int guardSpawnNumber = 2 + extractorGroupSize;
|
||||
Vector<CreatureObject> guardList = new Vector<CreatureObject>();
|
||||
for (int i=0;i<guardSpawnNumber;i++){
|
||||
guardList.add(spawnGuard(exactTreasureLocation,owner,map,(short)(spawnLevel+2-80)));
|
||||
}
|
||||
|
||||
//spawn boss if group size is sufficient
|
||||
if (extractorGroupSize==8){
|
||||
int bossRoll = new Random().nextInt(100);
|
||||
if (bossRoll<70){
|
||||
guardList.add(spawnBoss(exactTreasureLocation,owner,map,(short)(spawnLevel+2)));
|
||||
owner.sendSystemMessage("Spawn Boss",(byte)0);
|
||||
}
|
||||
}
|
||||
|
||||
// spawn treasure container
|
||||
TangibleObject treasureContainer = (TangibleObject) NGECore.getInstance().staticService.spawnObject("object/tangible/container/drum/shared_treasure_drum.iff", owner.getPlanet().getName(), 0L, exactTreasureLocation.x, exactTreasureLocation.y, exactTreasureLocation.z, 0.70F, 0.71F);
|
||||
|
||||
// CreatureObject treasureContainer = (CreatureObject) NGECore.getInstance().objectService.createObject("object/tangible/container/drum/shared_treasure_drum.iff", 0, owner.getPlanet(), exactTreasureLocation, owner.getOrientation());
|
||||
// NGECore.getInstance().simulationService.add(treasureContainer, exactTreasureLocation.x, exactTreasureLocation.z, true);
|
||||
|
||||
treasureContainer.setAttachment("radial_filename", "object/treasureContainer");
|
||||
treasureContainer.setAttachment("TreasureExtractorID", owner.getObjectID());
|
||||
treasureContainer.setAttachment("TreasureGuards",guardList);
|
||||
treasureContainer.setAttachment("ChestLevel",new Integer(spawnLevel));
|
||||
configureTreasureLoot(treasureContainer,owner,spawnLevel);
|
||||
NGECore.getInstance().lootService.DropLoot(owner, treasureContainer);
|
||||
|
||||
owner.sendSystemMessage("@treasure_map/treasure_map:sys_time_limit",(byte)0);
|
||||
|
||||
|
||||
// all down: owner.sendSystemMessage("@treasure_map/treasure_map:unlock_chest",(byte)0);
|
||||
}
|
||||
|
||||
public CreatureObject spawnGuard(Point3D exactTreasureLocation, CreatureObject owner, TangibleObject map, short spawnLevel){
|
||||
|
||||
String name = "";
|
||||
// System.out.println("exactTreasureLocation.x + " +exactTreasureLocation.x);
|
||||
// System.out.println("exactTreasureLocation.y + " +exactTreasureLocation.y);
|
||||
// System.out.println("exactTreasureLocation.z + " +exactTreasureLocation.z);
|
||||
|
||||
Point3D guardPosition = SpawnPoint.getRandomPosition(exactTreasureLocation, 5, 12, owner.getPlanetId());
|
||||
CreatureObject guard = NGECore.getInstance().spawnService.spawnCreature("treasure_guard", owner.getPlanet().getName(), 0L, guardPosition.x, guardPosition.y, guardPosition.z, spawnLevel);
|
||||
|
||||
String barkString = "";
|
||||
name = "Treasure Protector";
|
||||
|
||||
guard.addObserver(owner); // ToDo: add any players in aggro range!!!
|
||||
guard.setCustomName(name);
|
||||
guard.setCustomName2(name);
|
||||
guard.setLevel(owner.getLevel());
|
||||
guard.setOptions(Options.AGGRESSIVE, true);
|
||||
guard.setOptions(Options.ATTACKABLE, true);
|
||||
AIActor actor = (AIActor) guard.getAttachment("AI");
|
||||
actor.addDefender(owner);
|
||||
|
||||
barkString = "bark_"+map.getAttachment("MapSTFName");
|
||||
owner.sendSystemMessage("@treasure_map/treasure_map:" + barkString,(byte) 0);
|
||||
OutOfBand oob = new OutOfBand(new ProsePackage("@treasure_map/treasure_map",barkString));
|
||||
NGECore.getInstance().chatService.spatialChat(guard, owner, "", (short)0x0, (short)0x0, 1, oob);
|
||||
return guard;
|
||||
}
|
||||
|
||||
public CreatureObject spawnBoss(Point3D exactTreasureLocation, CreatureObject owner, TangibleObject map, short spawnLevel){
|
||||
|
||||
Point3D treasureLocation = resources.common.SpawnPoint.getRandomPosition(exactTreasureLocation, 1, 10, owner.getPlanetId());
|
||||
return new CreatureObject();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public int countAliveGuards(SWGObject treasureContainer){
|
||||
Vector<CreatureObject> guardList = (Vector<CreatureObject>) treasureContainer.getAttachment("TreasureGuards");
|
||||
int aliveCount = 0;
|
||||
for (CreatureObject guard:guardList){
|
||||
if (guard.getPosture()!=14 && guard.getPosture()!=15)
|
||||
aliveCount++;
|
||||
}
|
||||
return aliveCount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void configureTreasureLoot(TangibleObject treasureContainer, CreatureObject owner, short spawnLevel){
|
||||
List<LootGroup> lootgroups = new ArrayList<LootGroup>();
|
||||
|
||||
String levelRange = "61";
|
||||
|
||||
if (spawnLevel>60 && spawnLevel<=70){
|
||||
levelRange = "61";
|
||||
}
|
||||
if (spawnLevel>70 && spawnLevel<=80){
|
||||
levelRange = "75";
|
||||
}
|
||||
if (spawnLevel>80 && spawnLevel<=90){
|
||||
levelRange = "85";
|
||||
}
|
||||
|
||||
|
||||
// PROFESSION BRACELETS HOUSE FURNITURE WEARABLE BACKPACKS
|
||||
// String[] lootPoolNames = new String[]{"profession_bracelets_"+levelRange,"house_furniture","wearable_backpacks"};
|
||||
// double[] lootPoolChances = new double[]{60,30,10};
|
||||
String[] lootPoolNames = new String[]{"profession_bracelets_"+levelRange};
|
||||
double[] lootPoolChances = new double[]{100};
|
||||
double lootGroupChance = 80;
|
||||
treasureContainer.addToLootGroups(lootPoolNames, lootPoolChances, lootGroupChance);
|
||||
|
||||
// WEAPONSMITH COMPONENTS JEDI COMPONENTS GEM COLLECTION ITEMS TREASURE HUNTER COLLECTION ITEMS
|
||||
//lootPoolNames = new String[]{"weaponsmith_components","jedi_components","gem_collection_items","treasure_hunter_collection_items"};
|
||||
//lootPoolChances = new double[]{15,25,30,30};
|
||||
lootPoolNames = new String[]{"jedi_components_treasure"};
|
||||
lootPoolChances = new double[]{100};
|
||||
lootGroupChance = 80;
|
||||
treasureContainer.addToLootGroups(lootPoolNames, lootPoolChances, lootGroupChance);
|
||||
|
||||
// COMMON LOOTS:
|
||||
// Looted non-wearable Bounty Hunter armor pieces (Used to make Mandalorian armor at the Death Watch Bunker)
|
||||
// Looted clothing (usually 20+)
|
||||
// Looted armors (usually 20+)
|
||||
// Looted weapons (700-800 DPS(Sometimes less, now includes the Nak'tra Crystal Rifle))
|
||||
// Advanced Agility Stim (CL80)
|
||||
// Advanced Power Stim (CL80)
|
||||
// Loot kits adhesives
|
||||
// Various Schematics
|
||||
// lootPoolNames = new String[]{"bh_armor_for_mando","advanced_stims_80","loot_kits_adhesives","various_schematics"};
|
||||
// lootPoolChances = new double[]{15,25,30,30};
|
||||
// lootGroupChance = 80;
|
||||
// treasureContainer.addToLootGroups(lootPoolNames, lootPoolChances, lootGroupChance);
|
||||
//
|
||||
|
||||
//GEM COLLECTION ITEMS CONSUMABLE BUFF ITEMS
|
||||
|
||||
// VERY RARE BUFF ITEMS
|
||||
lootPoolNames = new String[]{"rare_buff_items"};
|
||||
lootPoolChances = new double[]{100};
|
||||
lootGroupChance = 0.1;
|
||||
treasureContainer.addToLootGroups(lootPoolNames, lootPoolChances, lootGroupChance);
|
||||
|
||||
// EXTRA
|
||||
lootPoolNames = new String[]{"treasure_extra"};
|
||||
lootPoolChances = new double[]{100};
|
||||
lootGroupChance = 50;
|
||||
treasureContainer.addToLootGroups(lootPoolNames, lootPoolChances, lootGroupChance);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,20 +31,20 @@ import com.sleepycat.persist.model.Persistent;
|
||||
public class LootGroup {
|
||||
|
||||
private String[] lootPoolNames;
|
||||
private int[] lootPoolChances;
|
||||
private int lootGroupChance;
|
||||
private double[] lootPoolChances;
|
||||
private double lootGroupChance;
|
||||
|
||||
public LootGroup(){
|
||||
|
||||
}
|
||||
|
||||
public LootGroup(String[] lootPoolNames, int[] lootPoolChances, int lootGroupChance){
|
||||
public LootGroup(String[] lootPoolNames, double[] lootPoolChances, double lootGroupChance){
|
||||
this.lootPoolNames = lootPoolNames;
|
||||
this.lootPoolChances = lootPoolChances;
|
||||
this.lootGroupChance = lootGroupChance;
|
||||
}
|
||||
|
||||
public void addLootData(String[] lootPoolNames, int[] lootPoolChances, int lootGroupChance){
|
||||
public void addLootData(String[] lootPoolNames, double[] lootPoolChances, double lootGroupChance){
|
||||
this.lootPoolNames = lootPoolNames;
|
||||
this.lootPoolChances = lootPoolChances;
|
||||
this.lootGroupChance = lootGroupChance;
|
||||
@@ -54,11 +54,11 @@ public class LootGroup {
|
||||
return lootPoolNames;
|
||||
}
|
||||
|
||||
public int[] getLootPoolChances() {
|
||||
public double[] getLootPoolChances() {
|
||||
return lootPoolChances;
|
||||
}
|
||||
|
||||
public int getLootGroupChance() {
|
||||
public double getLootGroupChance() {
|
||||
return lootGroupChance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Persistent(version=11)
|
||||
@Persistent(version=12)
|
||||
public class TangibleObject extends SWGObject {
|
||||
|
||||
// TODO: Thread safety
|
||||
@@ -495,7 +495,7 @@ public class TangibleObject extends SWGObject {
|
||||
return lootGroups;
|
||||
}
|
||||
|
||||
public void addToLootGroups(String[] lootPoolNames, int[] lootPoolChances, int lootGroupChance) {
|
||||
public void addToLootGroups(String[] lootPoolNames, double[] lootPoolChances, double lootGroupChance) {
|
||||
System.out.println("lootPoolNames[0] " + lootPoolNames[0]);
|
||||
LootGroup lootGroup = new LootGroup(lootPoolNames, lootPoolChances, lootGroupChance);
|
||||
this.lootGroups.add(lootGroup);
|
||||
|
||||
@@ -1230,8 +1230,9 @@ public class DevService implements INetworkDispatch {
|
||||
deed.setBMR(15);
|
||||
deed.setAttributes();
|
||||
inventory.add(deed);
|
||||
|
||||
return;
|
||||
|
||||
|
||||
case 125:
|
||||
TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet);
|
||||
genericCraftingTool.setCustomName("Generic Crafting Tool");
|
||||
|
||||
@@ -101,7 +101,15 @@ public class LootService implements INetworkDispatch {
|
||||
|
||||
public void DropLoot(CreatureObject requester, TangibleObject lootedObject) {
|
||||
|
||||
GroupObject group = (GroupObject) core.objectService.getObject(requester.getGroupId());
|
||||
if (requester==null || lootedObject==null)
|
||||
return; //QA
|
||||
|
||||
GroupObject group = null;
|
||||
if(requester.getGroupId()!=0)
|
||||
group = (GroupObject) core.objectService.getObject(requester.getGroupId());
|
||||
|
||||
if (lootedObject.getKiller()==null)
|
||||
lootedObject.setKiller(requester);
|
||||
|
||||
if (lootedObject.isLooted() || lootedObject.isLootLock() || (group == null && !lootedObject.getKiller().equals(requester)) || (group != null && !group.getMemberList().contains(lootedObject.getKiller())))
|
||||
return;
|
||||
@@ -114,18 +122,18 @@ public class LootService implements INetworkDispatch {
|
||||
|
||||
lootSituationAssessment(requester,lootedObject,lootRollSession);
|
||||
|
||||
CreatureObject lootedCreature = (CreatureObject) lootedObject;
|
||||
//CreatureObject lootedCreature = (CreatureObject) lootedObject;
|
||||
|
||||
//TreeSet<TreeMap<String,Integer>> lootSpec = lootedObject.getLootSpecification();
|
||||
List<LootGroup> lootGroups = lootedCreature.getLootGroups();
|
||||
List<LootGroup> lootGroups = lootedObject.getLootGroups();
|
||||
Iterator<LootGroup> iterator = lootGroups.iterator();
|
||||
int projectionCoefficientMatrixModulo = 0;
|
||||
projectionCoefficientMatrixModulo = outbound(requester);
|
||||
|
||||
while (iterator.hasNext()){
|
||||
LootGroup lootGroup = iterator.next();
|
||||
int groupChance = lootGroup.getLootGroupChance();
|
||||
int lootGroupRoll = new Random().nextInt(100);
|
||||
double groupChance = lootGroup.getLootGroupChance();
|
||||
double lootGroupRoll = new Random().nextDouble()*100;
|
||||
if (projectionCoefficientMatrixModulo!=0)
|
||||
lootGroupRoll=groupChance+1;
|
||||
if (lootGroupRoll <= groupChance){
|
||||
@@ -146,14 +154,17 @@ public class LootService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
// set info above corpse
|
||||
float y = 0.5F; // 1.3356977F
|
||||
float qz= 1.06535322E9F;
|
||||
Point3D effectorPosition = new Point3D(0,y,0);
|
||||
Quaternion effectorOrientation = new Quaternion(0,0,0,qz);
|
||||
PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe",effectorPosition,effectorOrientation);
|
||||
requester.getClient().getSession().write(lmsg.serialize());
|
||||
tools.CharonPacketUtils.printAnalysis(lmsg.serialize());
|
||||
|
||||
|
||||
if (lootedObject instanceof CreatureObject){
|
||||
float y = 0.5F; // 1.3356977F
|
||||
float qz= 1.06535322E9F;
|
||||
Point3D effectorPosition = new Point3D(0,y,0);
|
||||
Quaternion effectorOrientation = new Quaternion(0,0,0,qz);
|
||||
PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe",effectorPosition,effectorOrientation);
|
||||
requester.getClient().getSession().write(lmsg.serialize());
|
||||
tools.CharonPacketUtils.printAnalysis(lmsg.serialize());
|
||||
}
|
||||
|
||||
// handle errors
|
||||
if (lootRollSession.getErrorMessages().size()>0){
|
||||
for (String msg : lootRollSession.getErrorMessages()){
|
||||
@@ -165,7 +176,9 @@ public class LootService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory");
|
||||
System.out.println("lootedObjectInventory " + lootedObjectInventory.getTemplate());
|
||||
if (lootedObjectInventory==null || lootedObject.getTemplate().startsWith("object/tangible/container/drum/shared_treasure_drum.iff"))
|
||||
lootedObjectInventory = lootedObject; // In case we don't know what we are dealing with
|
||||
|
||||
// For autoloot
|
||||
//SWGObject requesterInventory = requester.getSlottedObject("inventory");
|
||||
|
||||
@@ -190,7 +203,7 @@ public class LootService implements INetworkDispatch {
|
||||
|
||||
private void handleLootGroup(LootGroup lootGroup,LootRollSession lootRollSession){
|
||||
|
||||
int[] lootPoolChances = lootGroup.getLootPoolChances();
|
||||
double[] lootPoolChances = lootGroup.getLootPoolChances();
|
||||
String[] lootPoolNames = lootGroup.getLootPoolNames();
|
||||
if (lootPoolChances==null || lootPoolNames==null){
|
||||
System.err.println("Lootpools are null!");
|
||||
@@ -201,8 +214,8 @@ public class LootService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
int randomItemFromGroup = new Random().nextInt(100);
|
||||
int remainder = 0; // [10,20,30,34,5,1]
|
||||
double randomItemFromGroup = new Random().nextDouble()*100;
|
||||
double remainder = 0; // [10,20,30,34,5,1]
|
||||
|
||||
for(int i=0;i<lootPoolChances.length;i++) {
|
||||
remainder += lootPoolChances[i];
|
||||
@@ -215,20 +228,21 @@ public class LootService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
private void handleLootPool(String poolName,LootRollSession lootRollSession){
|
||||
|
||||
System.err.println("poolName.toLowerCase() " + poolName.toLowerCase());
|
||||
// Fetch the loot pool data from the poolName.py script
|
||||
String path = "scripts/loot/lootPools/"+poolName.toLowerCase();
|
||||
Vector<String> itemNames = (Vector<String>)core.scriptService.fetchStringVector(path,"itemNames");
|
||||
|
||||
Vector<Integer> itemChances = (Vector<Integer>)core.scriptService.fetchIntegerVector(path,"itemChances");
|
||||
Vector<Double> itemChances = (Vector<Double>)core.scriptService.fetchDoubleVector(path,"itemChances");
|
||||
|
||||
int randomItemFromPool = new Random().nextInt(100);
|
||||
double randomItemFromPool = new Random().nextDouble()*100;
|
||||
int remainder = 0; // [10,20,30,34,5,1]
|
||||
|
||||
for (int i=0;i<itemNames.size();i++){
|
||||
remainder += itemChances.get(i);
|
||||
if (randomItemFromPool<=remainder){
|
||||
// this element has been chosen e.g. kraytpearl_flawless
|
||||
//System.err.println("CHOSEN ITEM " + itemNames.get(i));
|
||||
handleLootPoolItems(itemNames.get(i), lootRollSession);
|
||||
break;
|
||||
}
|
||||
@@ -289,6 +303,7 @@ public class LootService implements INetworkDispatch {
|
||||
Vector<String> customizationAttributes = null;
|
||||
Vector<Integer> customizationValues = null;
|
||||
Vector<String> itemStats = null;
|
||||
Vector<String> itemSkillMods = null;
|
||||
|
||||
if(core.scriptService.getMethod(itemPath,"","itemTemplate")==null){
|
||||
String errorMessage = "Loot item '" + itemName + "' has no template function assigned in its script. Please contact Charon about this issue.";
|
||||
@@ -319,6 +334,9 @@ public class LootService implements INetworkDispatch {
|
||||
if(core.scriptService.getMethod(itemPath,"","itemStats")!=null)
|
||||
itemStats = (Vector<String>)core.scriptService.fetchStringVector(itemPath,"itemStats");
|
||||
|
||||
if(core.scriptService.getMethod(itemPath,"","itemStats")!=null)
|
||||
itemSkillMods = (Vector<String>)core.scriptService.fetchStringVector(itemPath,"itemSkillMods");
|
||||
|
||||
if(core.scriptService.getMethod(itemPath,"","biolink")!=null)
|
||||
biolink = (Integer)core.scriptService.fetchInteger(itemPath,"biolink");
|
||||
|
||||
@@ -373,6 +391,13 @@ public class LootService implements INetworkDispatch {
|
||||
}
|
||||
handleStats(droppedItem, itemStats);
|
||||
}
|
||||
|
||||
if (itemSkillMods!=null){
|
||||
handleSkillMods(droppedItem, itemSkillMods);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (customizationValues!=null)
|
||||
// setCustomization(droppedItem, itemName);
|
||||
|
||||
@@ -385,7 +410,7 @@ public class LootService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
if (requiredProfession.length()>0){
|
||||
droppedItem.setStringAttribute("required_profession", requiredProfession);
|
||||
droppedItem.setStringAttribute("class_required", requiredProfession);
|
||||
}
|
||||
|
||||
if (requiredFaction.length()>0){
|
||||
@@ -529,6 +554,14 @@ public class LootService implements INetworkDispatch {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSkillMods(TangibleObject droppedItem, Vector<String> skillMods) {
|
||||
for (int i=0;i<skillMods.size()/2;i++){
|
||||
String skillMod = skillMods.get(2*i);
|
||||
String skillModValue = skillMods.get(2*i+1);
|
||||
droppedItem.setIntAttribute(skillMod, Integer.parseInt(skillModValue));
|
||||
}
|
||||
}
|
||||
|
||||
public void handleCreditDrop(CreatureObject requester,TangibleObject lootedObject,LootRollSession lootRollSession){
|
||||
int lootedCredits = 0;
|
||||
if (lootedObject.isCreditRelieved())
|
||||
@@ -555,6 +588,29 @@ public class LootService implements INetworkDispatch {
|
||||
if (lootedObject instanceof TangibleObject){
|
||||
// This is for chests etc.
|
||||
// Check the py script
|
||||
|
||||
// Treasure chest
|
||||
if (lootedObject.getTemplate().equals("object/tangible/container/drum/shared_treasure_drum.iff")){
|
||||
GroupObject group = null;
|
||||
if(requester.getGroupId()!=0)
|
||||
group = (GroupObject) core.objectService.getObject(requester.getGroupId());
|
||||
int creditGroupMultiplier = 1;
|
||||
if (group!=null)
|
||||
creditGroupMultiplier = group.getMemberList().size();
|
||||
|
||||
int creatureCL = (int)lootedObject.getAttachment("ChestLevel");
|
||||
|
||||
if (creatureCL<=0)
|
||||
creatureCL=1;
|
||||
//creatureCL = 90;
|
||||
int maximalCredits = (int)Math.floor(4*creatureCL + creatureCL*creatureCL*4/100);
|
||||
int minimalCredits = (int)Math.floor(creatureCL*2 + maximalCredits/2);
|
||||
int spanOfCredits = maximalCredits - minimalCredits;
|
||||
if (spanOfCredits<=0)
|
||||
spanOfCredits=1;
|
||||
|
||||
lootedCredits = creditGroupMultiplier * (minimalCredits + new Random().nextInt(spanOfCredits));
|
||||
}
|
||||
}
|
||||
|
||||
TangibleObject droppedCredits = createDroppedItem("object/tangible/item/shared_loot_cash.iff",requester.getPlanet());
|
||||
@@ -626,7 +682,7 @@ public class LootService implements INetworkDispatch {
|
||||
droppedItem.getAttributes().put("@obj_attr_n:condition", "100/100");
|
||||
droppedItem.getAttributes().put("@obj_attr_n:crystal_owner", "\\#D1F56F UNTUNED \\#FFFFFF ");
|
||||
droppedItem.getAttributes().put("@obj_attr_n:crystal_quality", qualityString);
|
||||
droppedItem.setAttachment("radial_filename", "tunable");
|
||||
droppedItem.setAttachment("radial_filename", "item/tunable");
|
||||
}
|
||||
|
||||
private void handlePowerCrystal(TangibleObject droppedItem) {
|
||||
@@ -666,7 +722,7 @@ public class LootService implements INetworkDispatch {
|
||||
droppedItem.getAttributes().put("@obj_attr_n:condition", "100/100");
|
||||
droppedItem.getAttributes().put("@obj_attr_n:crystal_owner", "\\#D1F56F UNTUNED \\#FFFFFF ");
|
||||
droppedItem.getAttributes().put("@obj_attr_n:crystal_quality", qualityString);
|
||||
droppedItem.setAttachment("radial_filename", "tunable");
|
||||
droppedItem.setAttachment("radial_filename", "item/tunable");
|
||||
}
|
||||
|
||||
private void setWeaponStat(WeaponObject weapon, String statName, String minValue, String maxValue){
|
||||
|
||||
@@ -140,4 +140,14 @@ public class ScriptService {
|
||||
return vector;
|
||||
}
|
||||
|
||||
public Vector<Double> fetchDoubleVector(String path, String method) {
|
||||
Vector<Double> vector = new Vector<Double>();
|
||||
PyObject result = core.scriptService.callScript(path, "", method);
|
||||
Iterable<PyObject> comp = (Iterable<PyObject>)result.asIterable();
|
||||
for (Iterator<PyObject> temp = comp.iterator(); temp.hasNext();){
|
||||
vector.add(temp.next().asDouble());
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package services;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import main.NGECore;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
|
||||
public class TreasureService implements INetworkDispatch {
|
||||
|
||||
private NGECore core;
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
private Vector<SWGObject> allRequesters = new Vector<SWGObject>();
|
||||
|
||||
public TreasureService(NGECore core) {
|
||||
this.core = core;
|
||||
|
||||
scheduleTreasureService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> swgOpcodes, Map<Integer, INetworkRemoteEvent> objControllerOpcodes) {
|
||||
|
||||
}
|
||||
|
||||
public void scheduleTreasureService(){
|
||||
|
||||
final ScheduledFuture<?> task = scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ServiceProcessing();
|
||||
}
|
||||
|
||||
}, 10, 5000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
public void ServiceProcessing(){
|
||||
synchronized(allRequesters){
|
||||
for (SWGObject requester : allRequesters){
|
||||
if (requester!=null)
|
||||
handleRequester(requester);
|
||||
}
|
||||
allRequesters.removeAll(Collections.singleton(null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRequester(SWGObject requester){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,11 +125,15 @@ public class ChatService implements INetworkDispatch {
|
||||
|
||||
Client speakerClient = speaker.getClient();
|
||||
|
||||
if (speakerClient == null || speakerClient.getSession() == null) {
|
||||
return;
|
||||
// if (speakerClient == null || speakerClient.getSession() == null) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (speakerClient != null) {
|
||||
if (speakerClient.getSession() != null)
|
||||
speakerClient.getSession().write(objControllerMessage.serialize());
|
||||
}
|
||||
|
||||
speakerClient.getSession().write(objControllerMessage.serialize());
|
||||
|
||||
if (speaker.getObservers().isEmpty()) {
|
||||
return;
|
||||
@@ -150,6 +154,7 @@ public class ChatService implements INetworkDispatch {
|
||||
SpatialChat spatialChat = new SpatialChat(client.getParent().getObjectId(), speaker.getObjectID(), targetId, message, chatType, moodId, languageId, outOfBand);
|
||||
objControllerMessage = new ObjControllerMessage(0x0B, spatialChat);
|
||||
client.getSession().write(objControllerMessage.serialize());
|
||||
tools.CharonPacketUtils.printAnalysis(objControllerMessage.serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +338,13 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
object = new Player_House_Deed(objectID, planet, Template, position, orientation);
|
||||
|
||||
} else if(Template.startsWith("object/tangible")) {
|
||||
}
|
||||
// else if(Template.startsWith("object/tangible/container/drum/shared_treasure_drum.iff")) {
|
||||
//
|
||||
// object = new CreatureObject(objectID, planet, position, orientation, Template);
|
||||
//
|
||||
// }
|
||||
else if(Template.startsWith("object/tangible")) {
|
||||
|
||||
object = new TangibleObject(objectID, planet, Template, position, orientation);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user