Added some medic specials, minor combat fixes

This commit is contained in:
Light2
2013-09-23 18:02:31 +02:00
parent 718880dfcf
commit fbcbc26065
19 changed files with 355 additions and 37 deletions
+11
View File
@@ -0,0 +1,11 @@
import sys
def setup(core, actor, buff):
actor.playEffectObject('clienteffect/medic_stasis.cef', 'me_stasis_1')
actor.setSpeedMultiplierBase(0.2)
return
def removeBuff(core, actor, buff):
actor.setSpeedMultiplierBase(1)
return
+11
View File
@@ -0,0 +1,11 @@
import sys
def setup(core, actor, buff):
actor.playEffectObject('clienteffect/medic_stasis.cef', 'me_stasis_self_1')
actor.setSpeedMultiplierBase(0.2)
return
def removeBuff(core, actor, buff):
actor.setSpeedMultiplierBase(1)
return
+11
View File
@@ -0,0 +1,11 @@
import sys
def setup(core, actor, target, command):
command.setBuffNameTarget('me_stasis_1')
return
def preRun(core, actor, target, command):
return
def run(core, actor, target, commandString):
return
+18
View File
@@ -0,0 +1,18 @@
import sys
def setup():
return
def run(core, actor, target, commandString):
if actor.getGroupId() == 0:
return
group = core.objectService.getObject(actor.getGroupId())
for creature in group.getMemberList():
if creature.getPosture() == 14:
core.simulationService.teleport(creature, actor.getPosition(), actor.getOrientation(), actor.getParentId())
return
@@ -0,0 +1,25 @@
import sys
from services.command import CombatCommand
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
combatSvc = core.combatService
weapon = core.objectService.getObject(actor.getWeaponId())
if not weapon:
weapon = actor.getSlottedObject('default_weapon')
command = core.commandService.getCommandByName('me_reckless_stimulation_1')
if not combatSvc.applySpecialCost(actor, weapon, CombatCommand('me_reckless_stimulation_1')):
return
actor.playEffectObject('clienteffect/medic_reckless_stimulation.cef', 'root')
actor.setAction(actor.getAction() + 1000)
return
@@ -0,0 +1,25 @@
import sys
from services.command import CombatCommand
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
combatSvc = core.combatService
weapon = core.objectService.getObject(actor.getWeaponId())
if not weapon:
weapon = actor.getSlottedObject('default_weapon')
command = core.commandService.getCommandByName('me_reckless_stimulation_2')
if not combatSvc.applySpecialCost(actor, weapon, CombatCommand('me_reckless_stimulation_2')):
return
actor.playEffectObject('clienteffect/medic_reckless_stimulation.cef', 'root')
actor.setAction(actor.getAction() + 1500)
return
@@ -0,0 +1,25 @@
import sys
from services.command import CombatCommand
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
combatSvc = core.combatService
weapon = core.objectService.getObject(actor.getWeaponId())
if not weapon:
weapon = actor.getSlottedObject('default_weapon')
command = core.commandService.getCommandByName('me_reckless_stimulation_3')
if not combatSvc.applySpecialCost(actor, weapon, CombatCommand('me_reckless_stimulation_3')):
return
actor.playEffectObject('clienteffect/medic_reckless_stimulation.cef', 'root')
actor.setAction(actor.getAction() + 2000)
return
@@ -0,0 +1,25 @@
import sys
from services.command import CombatCommand
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
combatSvc = core.combatService
weapon = core.objectService.getObject(actor.getWeaponId())
if not weapon:
weapon = actor.getSlottedObject('default_weapon')
command = core.commandService.getCommandByName('me_reckless_stimulation_4')
if not combatSvc.applySpecialCost(actor, weapon, CombatCommand('me_reckless_stimulation_4')):
return
actor.playEffectObject('clienteffect/medic_reckless_stimulation.cef', 'root')
actor.setAction(actor.getAction() + 2500)
return
@@ -0,0 +1,25 @@
import sys
from services.command import CombatCommand
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
combatSvc = core.combatService
weapon = core.objectService.getObject(actor.getWeaponId())
if not weapon:
weapon = actor.getSlottedObject('default_weapon')
command = core.commandService.getCommandByName('me_reckless_stimulation_5')
if not combatSvc.applySpecialCost(actor, weapon, CombatCommand('me_reckless_stimulation_5')):
return
actor.playEffectObject('clienteffect/medic_reckless_stimulation.cef', 'root')
actor.setAction(actor.getAction() + 3000)
return
@@ -0,0 +1,25 @@
import sys
from services.command import CombatCommand
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
combatSvc = core.combatService
weapon = core.objectService.getObject(actor.getWeaponId())
if not weapon:
weapon = actor.getSlottedObject('default_weapon')
command = core.commandService.getCommandByName('me_reckless_stimulation_6')
if not combatSvc.applySpecialCost(actor, weapon, CombatCommand('me_reckless_stimulation_6')):
return
actor.playEffectObject('clienteffect/medic_reckless_stimulation.cef', 'root')
actor.setAction(actor.getAction() + 3500)
return
+24
View File
@@ -0,0 +1,24 @@
import sys
from services.command import CombatCommand
def setup(core, actor, buff):
return
def run(core, actor, target, commandString):
combatSvc = core.combatService
weapon = core.objectService.getObject(actor.getWeaponId())
if not weapon:
weapon = actor.getSlottedObject('default_weapon')
command = core.commandService.getCommandByName('me_stasis_self_1')
if not combatSvc.applySpecialCost(actor, weapon, CombatCommand('me_stasis_self_1')):
return
core.buffService.addBuffToCreature(actor, 'me_stasis_self_1')
return
@@ -0,0 +1,64 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
public class PlayClientEffectObjectMessage extends SWGMessage {
private long objectId;
private String effectFile;
private String commandString;
public PlayClientEffectObjectMessage(String effectFile, long objectId, String commandString) {
this.effectFile = effectFile;
this.objectId = objectId;
this.commandString = commandString;
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(20 + effectFile.length() + commandString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.putShort((short) 5);
result.putInt(0x8855434A);
result.put(getAsciiString(effectFile));
result.putShort((short) 0);
result.putLong(objectId);
result.put(getAsciiString(commandString));
return result.flip();
}
@Override
public void deserialize(IoBuffer data) {
// TODO Auto-generated method stub
}
}
@@ -29,6 +29,7 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ChatSystemMessage;
import protocol.swg.ObjControllerMessage;
import protocol.swg.PlayClientEffectObjectMessage;
import protocol.swg.UpdatePVPStatusMessage;
import protocol.swg.UpdatePostureMessage;
import protocol.swg.objectControllerObjects.Posture;
@@ -927,27 +928,15 @@ public class CreatureObject extends TangibleObject implements IPersistent {
}
IoBuffer delta;
// IoBuffer delta2;
int counter;
synchronized(objectMutex) {
if(health > maxHealth)
health = maxHealth;
this.health = health;
counter = getHamListCounter() + 1;
setHamListCounter(getHamListCounter() + 1);
delta = messageBuilder.buildUpdateHAMListDelta();
/*if(health == 1)
delta2 = messageBuilder.buildHealthDelta(0);
else
delta2 = delta;*/
delta = messageBuilder.buildHealthDelta(health);
notifyObservers(delta, true);
/*if(getClient() != null)
getClient().getSession().write(delta2);*/
this.health = health;
}
if(counter != getHamListCounter())
System.out.println("test");
}
@@ -959,18 +948,14 @@ public class CreatureObject extends TangibleObject implements IPersistent {
public void setAction(int action) {
IoBuffer delta;
int counter;
synchronized(objectMutex) {
if(action > maxAction)
action = maxAction;
this.action = action;
counter = getHamListCounter() + 1;
setHamListCounter(getHamListCounter() + 1);
delta = messageBuilder.buildUpdateHAMListDelta();
delta = messageBuilder.buildActionDelta(action);
notifyObservers(delta, true);
this.action = action;
}
if(counter != getHamListCounter())
System.out.println("test");
}
public int getHamListCounter() {
@@ -1096,6 +1081,10 @@ public class CreatureObject extends TangibleObject implements IPersistent {
notifyObservers(messageBuilder.buildResetHAMListDelta(), true);
}
}
public void playEffectObject(String effectFile, String commandString) {
notifyObservers(new PlayClientEffectObjectMessage(effectFile, getObjectID(), commandString), true);
}
}
+10 -7
View File
@@ -64,7 +64,7 @@ import engine.resources.service.INetworkRemoteEvent;
public class PlayerService implements INetworkDispatch {
private NGECore core;
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
public PlayerService(final NGECore core) {
this.core = core;
@@ -106,9 +106,10 @@ public class PlayerService implements INetworkDispatch {
@Override
public void run() {
if(creature.getAction() < creature.getMaxAction() && creature.getPosture() != 14)
creature.setAction(creature.getAction() + 200);
synchronized(creature.getMutex()) {
if(creature.getAction() < creature.getMaxAction() && creature.getPosture() != 14)
creature.setAction(creature.getAction() + 200);
}
}
}, 0, 1000, TimeUnit.MILLISECONDS);
@@ -118,12 +119,14 @@ public class PlayerService implements INetworkDispatch {
@Override
public void run() {
if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14)
creature.setHealth(creature.getHealth() + 300);
synchronized(creature.getMutex()) {
if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14)
creature.setHealth(creature.getHealth() + 300);
}
}
}, 0, 1100, TimeUnit.MILLISECONDS);
}, 0, 1000, TimeUnit.MILLISECONDS);
/*scheduler.scheduleAtFixedRate(new Runnable() {
+11 -5
View File
@@ -616,14 +616,20 @@ public class SimulationService implements INetworkDispatch {
}
public void teleport(SWGObject obj, Point3D position, Quaternion orientation) {
public void teleport(SWGObject obj, Point3D position, Quaternion orientation, long cellId) {
if(position.x >= -8192 && position.x <= 8192 && position.z >= -8192 && position.z <= 8192) {
DataTransform dataTransform = new DataTransform(new Point3D(position.x, position.y, position.z), orientation, 1, obj.getObjectID());
if(cellId == 0) {
if(position.x >= -8192 && position.x <= 8192 && position.z >= -8192 && position.z <= 8192) {
obj.setMovementCounter(obj.getMovementCounter() + 1);
DataTransform dataTransform = new DataTransform(new Point3D(position.x, position.y, position.z), orientation, obj.getMovementCounter(), obj.getObjectID());
ObjControllerMessage objController = new ObjControllerMessage(0x1B, dataTransform);
obj.notifyObservers(objController, true);
}
} else {
obj.setMovementCounter(obj.getMovementCounter() + 1);
DataTransformWithParent dataTransform = new DataTransformWithParent(new Point3D(position.x, position.y, position.z), orientation, obj.getMovementCounter(), obj.getObjectID(), cellId);
ObjControllerMessage objController = new ObjControllerMessage(0x1B, dataTransform);
obj.notifyObservers(objController, true);
}
}
+9
View File
@@ -417,6 +417,15 @@ public class CombatCommands {
core.commandService.registerCombatCommand("me_traumatize_3");
core.commandService.registerCombatCommand("me_traumatize_4");
core.commandService.registerCombatCommand("me_traumatize_5");
core.commandService.registerCombatCommand("me_stasis_1");
core.commandService.registerCommand("me_stasis_self_1");
core.commandService.registerCommand("me_drag_1");
core.commandService.registerCommand("me_reckless_stimulation_1");
core.commandService.registerCommand("me_reckless_stimulation_2");
core.commandService.registerCommand("me_reckless_stimulation_3");
core.commandService.registerCommand("me_reckless_stimulation_4");
core.commandService.registerCommand("me_reckless_stimulation_5");
core.commandService.registerCommand("me_reckless_stimulation_6");
// Officer
+5 -5
View File
@@ -79,10 +79,10 @@ public class CombatService implements INetworkDispatch {
boolean success = true;
if(!applySpecialCost(attacker, weapon, command))
if((command.getAttackType() == 0 || command.getAttackType() == 1 || command.getAttackType() == 3) && !attemptCombat(attacker, target))
success = false;
if((command.getAttackType() == 0 || command.getAttackType() == 1 || command.getAttackType() == 3) && !attemptCombat(attacker, target))
if(!applySpecialCost(attacker, weapon, command))
success = false;
if(!success) {
@@ -328,7 +328,7 @@ public class CombatService implements INetworkDispatch {
sendCombatPackets(attacker, target, weapon, command, actionCounter, damage, armorAbsorbed, hitType);
if(hitType != HitType.MISS && hitType != HitType.DODGE && hitType != HitType.PARRY)
if((hitType != HitType.MISS && hitType != HitType.DODGE && hitType != HitType.PARRY) || (command.getAddedDamage() == 0 && command.getPercentFromWeapon() == 0))
core.buffService.addBuffToCreature(target, command.getBuffNameTarget());
if(FileUtilities.doesFileExist("scripts/commands/combat/" + command.getCommandName() + ".py"))
@@ -456,7 +456,7 @@ public class CombatService implements INetworkDispatch {
}
private boolean applySpecialCost(CreatureObject attacker, WeaponObject weapon, CombatCommand command) {
public boolean applySpecialCost(CreatureObject attacker, WeaponObject weapon, CombatCommand command) {
float actionCost = command.getActionCost();
float healthCost = command.getHealthCost();
@@ -765,7 +765,7 @@ public class CombatService implements INetworkDispatch {
success = false;
if((command.getAttackType() == 0 || command.getAttackType() == 1 || command.getAttackType() == 3) && !attemptHeal(healer, target))
success = false;
target = healer;
if(!success) {
IoSession session = healer.getClient().getSession();
+10
View File
@@ -77,6 +77,7 @@ public class CombatCommand extends BaseSWGCommand {
private String cooldownGroup;
private float executeTime;
private float warmupTime;
private float vigorCost; // for commando kill meter and bm specials
public CombatCommand(String commandName) {
super(commandName);
@@ -135,6 +136,7 @@ public class CombatCommand extends BaseSWGCommand {
bypassArmor = (Float) visitor.getObject(i, 48);
healthCost = (Float) visitor.getObject(i, 54);
actionCost = (Float) visitor.getObject(i, 55);
setVigorCost((Float) visitor.getObject(i, 56));
dotType = (String) visitor.getObject(i, 60);
dotIntensity = (Integer) visitor.getObject(i, 61);
dotDuration = (Integer) visitor.getObject(i, 62);
@@ -695,6 +697,14 @@ public class CombatCommand extends BaseSWGCommand {
public void setWarmupTime(float warmupTime) {
this.warmupTime = warmupTime;
}
public float getVigorCost() {
return vigorCost;
}
public void setVigorCost(float vigorCost) {
this.vigorCost = vigorCost;
}
+12
View File
@@ -140,6 +140,18 @@ public class CommandService implements INetworkDispatch {
}
public BaseSWGCommand getCommandByName(String name) {
Vector<BaseSWGCommand> commands = new Vector<BaseSWGCommand>(commandLookup); // copy for thread safety
for(BaseSWGCommand command : commands) {
if(command.getCommandName().equalsIgnoreCase(name))
return command;
}
return null;
}
private void processCombatCommand(CreatureObject attacker, SWGObject target, CombatCommand command, int actionCounter, String commandArgs) {
boolean success = true;