mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-27 17:57:22 -04:00
Added expertise, added AoE/Cone combat, added some commando expertise boxes as an example for expertise scripts
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
import sys
|
||||
|
||||
def setup(core, actor, target, command):
|
||||
return
|
||||
|
||||
def preRun(core, actor, target, command):
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
if actor and target:
|
||||
core.buffService.addBuffToCreature(target, 'me_rheumatic_calamity_1')
|
||||
return
|
||||
@@ -0,0 +1,47 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_deflective_armor_1')
|
||||
|
||||
actor.addSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_deflective_armor_1')
|
||||
|
||||
actor.removeSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_deflective_armor_2')
|
||||
|
||||
actor.addSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_deflective_armor_2')
|
||||
|
||||
actor.removeSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_deflective_armor_3')
|
||||
|
||||
actor.addSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_deflective_armor_3')
|
||||
|
||||
actor.removeSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_deflective_armor_4')
|
||||
|
||||
actor.addSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_deflective_armor_4')
|
||||
|
||||
actor.removeSkillMod('damage_decrease_percentage', 2)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_pinpoint_shielding_1')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_pinpoint_shielding_1')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_pinpoint_shielding_2')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_pinpoint_shielding_2')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_pinpoint_shielding_3')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_pinpoint_shielding_3')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_pinpoint_shielding_4')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_pinpoint_shielding_4')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_powered_armor_1')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_powered_armor_1')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_powered_armor_2')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_powered_armor_2')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_powered_armor_3')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_powered_armor_3')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_powered_armor_4')
|
||||
|
||||
actor.addSkillMod('energy', 250)
|
||||
actor.addSkillMod('kinetic', 250)
|
||||
actor.addSkillMod('acid', 250)
|
||||
actor.addSkillMod('heat', 250)
|
||||
actor.addSkillMod('cold', 250)
|
||||
actor.addSkillMod('electricity', 250)
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_powered_armor_4')
|
||||
|
||||
actor.removeSkillMod('energy', 250)
|
||||
actor.removeSkillMod('kinetic', 250)
|
||||
actor.removeSkillMod('acid', 250)
|
||||
actor.removeSkillMod('heat', 250)
|
||||
actor.removeSkillMod('cold', 250)
|
||||
actor.removeSkillMod('electricity', 250)
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import sys
|
||||
|
||||
def addExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.addSkill('expertise_co_stand_fast_1')
|
||||
|
||||
addAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
def removeExpertisePoint(core, actor):
|
||||
|
||||
player = actor.getSlottedObject('ghost')
|
||||
|
||||
if not player:
|
||||
return
|
||||
|
||||
if not player.getProfession() == 'commando_1a':
|
||||
return
|
||||
|
||||
actor.removeSkill('expertise_co_stand_fast_1')
|
||||
|
||||
removeAbilities(core, actor, player)
|
||||
|
||||
return
|
||||
|
||||
# this checks what abilities the player gets by level, need to also call this on level-up
|
||||
def addAbilities(core, actor, player):
|
||||
|
||||
actor.addAbility('co_stand_fast')
|
||||
|
||||
return
|
||||
|
||||
def removeAbilities(core, actor, player):
|
||||
|
||||
actor.removeAbility('co_stand_fast')
|
||||
|
||||
return
|
||||
|
||||
@@ -140,7 +140,7 @@ public class NGECore {
|
||||
if (!(config.loadConfigFile())) {
|
||||
config = DefaultConfig.getConfig();
|
||||
}
|
||||
|
||||
|
||||
// Database
|
||||
databaseConnection = new DatabaseConnection();
|
||||
databaseConnection.connect(config.getString("DB.URL"), config.getString("DB.NAME"), config.getString("DB.USER"), config.getString("DB.PASS"), "postgresql");
|
||||
@@ -234,7 +234,7 @@ public class NGECore {
|
||||
didServerCrash = false;
|
||||
System.out.println("Started Server.");
|
||||
setGalaxyStatus(2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -369,6 +369,10 @@ public class NGECore {
|
||||
clients.remove(connectionID);
|
||||
}
|
||||
|
||||
// for python scripts
|
||||
public Thread getCurrentThread() {
|
||||
return Thread.currentThread();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package protocol.swg;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
public class ExpertiseRequestMessage extends SWGMessage {
|
||||
|
||||
private List<String> expertiseSkills = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer buffer) {
|
||||
|
||||
buffer.getShort();
|
||||
buffer.getInt();
|
||||
|
||||
int size = buffer.getInt();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
|
||||
short length = buffer.getShort();
|
||||
try {
|
||||
String skill = new String(ByteBuffer.allocate(length).put(buffer.array(), buffer.position(), length).array(), "US-ASCII");
|
||||
System.out.println(skill);
|
||||
expertiseSkills.add(skill);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
buffer.position(buffer.position() + length);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getExpertiseSkills() {
|
||||
return expertiseSkills;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,5 +50,6 @@ public class Opcodes {
|
||||
public static int GcwRegionsReq = CRC.StringtoCRC("GcwRegionsReq");
|
||||
public static int GcwRegionsRsp = CRC.StringtoCRC("GcwRegionsRsp");
|
||||
public static int GcwGroupsRsp = CRC.StringtoCRC("GcwGroupsRsp");
|
||||
public static int ExpertiseRequestMessage = 0xC19085D5;
|
||||
|
||||
}
|
||||
|
||||
@@ -793,9 +793,80 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildAddSkillDelta(String name) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) object;
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(11 + name.length(), false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(1);
|
||||
buffer.putInt(creature.getSkillsUpdateCounter());
|
||||
buffer.put((byte) 1);
|
||||
buffer.put(getAsciiString(name));
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 1, (short) 1, (short) 3, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildRemoveSkillDelta(String name) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) object;
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(11 + name.length(), false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(1);
|
||||
buffer.putInt(creature.getSkillsUpdateCounter());
|
||||
buffer.put((byte) 0);
|
||||
buffer.put(getAsciiString(name));
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 1, (short) 1, (short) 3, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildAddAbilityDelta(String name) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) object;
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(15 + name.length(), false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(1);
|
||||
buffer.putInt(creature.getAbilitiesUpdateCounter());
|
||||
buffer.put((byte) 0);
|
||||
buffer.put(getAsciiString(name));
|
||||
buffer.putInt(1);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 0x0E, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildRemoveAbilityDelta(String name) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) object;
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(15 + name.length(), false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(1);
|
||||
buffer.putInt(creature.getAbilitiesUpdateCounter());
|
||||
buffer.put((byte) 1);
|
||||
buffer.put(getAsciiString(name));
|
||||
buffer.putInt(1);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 0x0E, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
|
||||
@@ -205,6 +205,34 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.skillsUpdateCounter = skillsUpdateCounter;
|
||||
}
|
||||
}
|
||||
|
||||
public void addSkill(String skill) {
|
||||
|
||||
if(skills.contains(skill))
|
||||
return;
|
||||
|
||||
skills.add(skill);
|
||||
|
||||
if(getClient() != null) {
|
||||
setSkillsUpdateCounter((short) (getSkillsUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildAddSkillDelta(skill));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeSkill(String skill) {
|
||||
|
||||
if(!skills.contains(skill))
|
||||
return;
|
||||
|
||||
skills.remove(skill);
|
||||
|
||||
if(getClient() != null) {
|
||||
setSkillsUpdateCounter((short) (getSkillsUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildRemoveSkillDelta(skill));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionsBitmask(int optionBitmask) {
|
||||
@@ -391,8 +419,10 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
if(mod.getBase() <= 0) {
|
||||
removeSkillMod(mod);
|
||||
} else {
|
||||
setSkillModsUpdateCounter((short) (getSkillModsUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildAddSkillModDelta(name, mod.getBase()));
|
||||
if(getClient() != null) {
|
||||
setSkillModsUpdateCounter((short) (getSkillModsUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildAddSkillModDelta(name, mod.getBase()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -554,9 +584,35 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addAbility(String abilityName) {
|
||||
|
||||
if(abilities.contains(abilityName))
|
||||
return;
|
||||
|
||||
abilities.add(abilityName);
|
||||
|
||||
if(getClient() != null) {
|
||||
setAbilitiesUpdateCounter((short) (getAbilitiesUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildAddAbilityDelta(abilityName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeAbility(String abilityName) {
|
||||
|
||||
if(!abilities.contains(abilityName))
|
||||
return;
|
||||
|
||||
abilities.remove(abilityName);
|
||||
|
||||
if(getClient() != null) {
|
||||
setAbilitiesUpdateCounter((short) (getAbilitiesUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildRemoveAbilityDelta(abilityName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public SWGList<MissionCriticalObject> getMissionCriticalObjects() {
|
||||
return missionCriticalObjects;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
******************************************************************************/
|
||||
package services;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -29,7 +30,10 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
|
||||
import protocol.swg.ClientIdMsg;
|
||||
import protocol.swg.ExpertiseRequestMessage;
|
||||
import protocol.swg.ServerTimeMessage;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.common.Opcodes;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
@@ -121,6 +125,47 @@ public class PlayerService implements INetworkDispatch {
|
||||
|
||||
});
|
||||
|
||||
swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() {
|
||||
|
||||
@Override
|
||||
public void handlePacket(IoSession session, IoBuffer buffer) throws Exception {
|
||||
|
||||
buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.position(0);
|
||||
|
||||
ExpertiseRequestMessage expertise = new ExpertiseRequestMessage();
|
||||
expertise.deserialize(buffer);
|
||||
|
||||
Client client = core.getClient((Integer) session.getAttribute("connectionId"));
|
||||
if(client == null) {
|
||||
System.out.println("NULL Client");
|
||||
return;
|
||||
}
|
||||
|
||||
if(client.getParent() == null)
|
||||
return;
|
||||
|
||||
CreatureObject creature = (CreatureObject) client.getParent();
|
||||
|
||||
for(String expertiseName : expertise.getExpertiseSkills()) {
|
||||
handleExpertiseSkillBox(creature, expertiseName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void handleExpertiseSkillBox(CreatureObject creature, String expertiseBox) {
|
||||
|
||||
if(!FileUtilities.doesFileExist("scripts/expertise/" + expertiseBox + ".py"))
|
||||
return;
|
||||
|
||||
core.scriptService.callScript("scripts/expertise", "addExpertisePoint", expertiseBox, core, creature);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
******************************************************************************/
|
||||
package services.combat;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -31,12 +32,14 @@ import protocol.swg.objectControllerObjects.CombatAction;
|
||||
import protocol.swg.objectControllerObjects.CombatSpam;
|
||||
import protocol.swg.objectControllerObjects.CommandEnqueueRemove;
|
||||
import protocol.swg.objectControllerObjects.StartTask;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
import services.command.CombatCommand;
|
||||
import main.NGECore;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
|
||||
@@ -75,9 +78,13 @@ public class CombatService implements INetworkDispatch {
|
||||
if(!applySpecialCost(attacker, weapon, command))
|
||||
return;
|
||||
|
||||
if(!attemptCombat(attacker, target))
|
||||
if((command.getAttackType() == 0 || command.getAttackType() == 1 || command.getAttackType() == 3) && !attemptCombat(attacker, target))
|
||||
return;
|
||||
|
||||
// use preRun for delayed effects like officer orbital strike, grenades etc.
|
||||
if(FileUtilities.doesFileExist("scripts/commands/combat" + command.getCommandName() + ".py"))
|
||||
core.scriptService.callScript("scripts/commands/combat", command.getCommandName(), "preRun", core, attacker, target, command);
|
||||
|
||||
if(command.getAttackType() == 1)
|
||||
doSingleTargetCombat(attacker, target, weapon, command, actionCounter);
|
||||
else if(command.getAttackType() == 0 || command.getAttackType() == 2 || command.getAttackType() == 3)
|
||||
@@ -103,6 +110,38 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
private void doAreaCombat(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) {
|
||||
|
||||
float x = attacker.getWorldPosition().x;
|
||||
float z = attacker.getWorldPosition().z;
|
||||
|
||||
float dirX = target.getWorldPosition().x - x;
|
||||
float dirZ = target.getWorldPosition().z - z;
|
||||
|
||||
float range = command.getConeLength();
|
||||
|
||||
|
||||
List<SWGObject> inRangeObjects = core.simulationService.get(attacker.getPlanet(), target.getWorldPosition().x, target.getWorldPosition().z, (int) range);
|
||||
|
||||
for(SWGObject obj : inRangeObjects) {
|
||||
|
||||
if(!(obj instanceof TangibleObject) || obj == attacker)
|
||||
continue;
|
||||
|
||||
if(obj instanceof CreatureObject && (((CreatureObject) obj).getPosture() == 13 || ((CreatureObject) obj).getPosture() == 14))
|
||||
continue;
|
||||
|
||||
if(command.getAttackType() == 0 && !isInConeAngle(attacker, obj, (int) command.getConeLength(), (int) command.getConeWidth(), dirX, dirZ))
|
||||
continue;
|
||||
|
||||
if(!core.simulationService.checkLineOfSight(target, obj))
|
||||
continue;
|
||||
|
||||
if(!attemptCombat(attacker, (TangibleObject) obj))
|
||||
continue;
|
||||
|
||||
doSingleTargetCombat(attacker, (TangibleObject) obj, weapon, command, actionCounter);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doSingleTargetCombat(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) {
|
||||
@@ -159,6 +198,9 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
sendCombatPackets(attacker, target, weapon, command, actionCounter, damage, armorAbsorbed, hitType);
|
||||
|
||||
if(FileUtilities.doesFileExist("scripts/commands/combat" + command.getCommandName() + ".py"))
|
||||
core.scriptService.callScript("scripts/commands/combat", command.getCommandName(), "run", core, attacker, target, null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -491,7 +533,7 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
private boolean isInConeAngle(CreatureObject attacker, CreatureObject target, int coneLength, int coneWidth, float directionX, float directionZ) {
|
||||
private boolean isInConeAngle(CreatureObject attacker, SWGObject target, int coneLength, int coneWidth, float directionX, float directionZ) {
|
||||
|
||||
float radius = coneWidth / 2;
|
||||
float angle = (float) (2 * Math.atan(coneLength / radius));
|
||||
|
||||
@@ -23,7 +23,7 @@ package services.command;
|
||||
|
||||
import engine.resources.common.CRC;
|
||||
|
||||
public class BaseSWGCommand {
|
||||
public class BaseSWGCommand implements Cloneable {
|
||||
|
||||
private String commandName;
|
||||
private String clientEffectSelf;
|
||||
@@ -75,5 +75,9 @@ public class BaseSWGCommand {
|
||||
public void setCommandCRC(int commandCRC) {
|
||||
this.commandCRC = commandCRC;
|
||||
}
|
||||
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public class CombatCommand extends BaseSWGCommand {
|
||||
private int damageType, elementalType, elementalValue;
|
||||
private String performanceSpam;
|
||||
private byte hitSpam;
|
||||
private float cooldown;
|
||||
|
||||
public CombatCommand(String commandName) {
|
||||
super(commandName);
|
||||
@@ -584,6 +585,14 @@ public class CombatCommand extends BaseSWGCommand {
|
||||
return animations[new Random().nextInt(animations.length)];
|
||||
|
||||
}
|
||||
|
||||
public float getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
public void setCooldown(float cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ package services.command;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
@@ -89,13 +88,15 @@ public class CommandService implements INetworkDispatch {
|
||||
System.out.println("NULL Object");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CreatureObject actor = (CreatureObject) client.getParent();
|
||||
|
||||
SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID());
|
||||
|
||||
if(command instanceof CombatCommand) {
|
||||
processCombatCommand(actor, target, (CombatCommand) command, commandEnqueue.getActionCounter());
|
||||
CombatCommand command2 = (CombatCommand) command.clone();
|
||||
core.scriptService.callScript("scripts/commands/combat", command.getCommandName(), "setup", core, actor, target, command2);
|
||||
processCombatCommand(actor, target, command2, commandEnqueue.getActionCounter(), commandEnqueue.getCommandArguments());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,6 @@ public class CommandService implements INetworkDispatch {
|
||||
|
||||
CombatCommand command = new CombatCommand(name);
|
||||
commandLookup.add(command);
|
||||
|
||||
return command;
|
||||
|
||||
}
|
||||
@@ -139,12 +139,19 @@ public class CommandService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
private void processCombatCommand(CreatureObject attacker, SWGObject target, CombatCommand command, int actionCounter) {
|
||||
private void processCombatCommand(CreatureObject attacker, SWGObject target, CombatCommand command, int actionCounter, String commandArgs) {
|
||||
|
||||
boolean success = true;
|
||||
|
||||
if(target == null || !(target instanceof TangibleObject) || target == attacker)
|
||||
success = false;
|
||||
if(!(command.getAttackType() == 0) && !(command.getAttackType() == 2) && !(command.getAttackType() == 3)) {
|
||||
if(target == null || !(target instanceof TangibleObject) || target == attacker)
|
||||
success = false;
|
||||
} else {
|
||||
if(target == null)
|
||||
target = attacker;
|
||||
else if(!(target instanceof TangibleObject))
|
||||
return;
|
||||
}
|
||||
|
||||
if(attacker.getPosture() == 13 || attacker.getPosture() == 14)
|
||||
success = false;
|
||||
@@ -167,7 +174,7 @@ public class CommandService implements INetworkDispatch {
|
||||
maxRange = weapon.getMaxRange();
|
||||
else
|
||||
maxRange = command.getMaxRange();
|
||||
|
||||
|
||||
Point3D attackerPos = attacker.getWorldPosition();
|
||||
Point3D defenderPos = attacker.getWorldPosition();
|
||||
|
||||
@@ -179,7 +186,8 @@ public class CommandService implements INetworkDispatch {
|
||||
success = false;
|
||||
}
|
||||
|
||||
if(!core.simulationService.checkLineOfSight(attacker, target)) {
|
||||
|
||||
if(target != attacker && success && !core.simulationService.checkLineOfSight(attacker, target)) {
|
||||
|
||||
ShowFlyText los = new ShowFlyText(attacker.getObjectID(), attacker.getObjectID(), "combat_effects", "cant_see", (float) 1.5, (float) 429664.031250);
|
||||
ObjControllerMessage objController = new ObjControllerMessage(0x1B, los);
|
||||
|
||||
Reference in New Issue
Block a user