mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-17 07:02:53 -04:00
Merge pull request #462 from Ziggeh/master
Weapon particle effects, misc enhancements
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from resources.datatables import WeaponType
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttackSpeed(1)
|
||||
@@ -6,6 +7,6 @@ def setup(core, object):
|
||||
object.setMinDamage(50)
|
||||
object.setMaxDamage(100)
|
||||
object.setMaxRange(5)
|
||||
object.setWeaponType(6)
|
||||
object.setWeaponType(WeaponType.UNARMED)
|
||||
|
||||
return
|
||||
@@ -0,0 +1,52 @@
|
||||
/*******************************************************************************
|
||||
* 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.datatables;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.bidimap.DualHashBidiMap;
|
||||
|
||||
public final class Elemental {
|
||||
|
||||
|
||||
static BidiMap map = new DualHashBidiMap();
|
||||
|
||||
static {
|
||||
map.put("kinetic", 1);
|
||||
map.put("energy", 2);
|
||||
map.put("blast", 4);
|
||||
map.put("stun", 8);
|
||||
map.put("heat", 32);
|
||||
map.put("cold", 64);
|
||||
map.put("acid", 128);
|
||||
map.put("electricity", 256);
|
||||
}
|
||||
|
||||
|
||||
public static int getElementalNum(String elementalName) {
|
||||
return (int) map.get(elementalName);
|
||||
}
|
||||
|
||||
public static String getElementalName(int elementalNum) {
|
||||
return (String) map.getKey(elementalNum);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,18 +23,18 @@ package resources.datatables;
|
||||
|
||||
public class WeaponType {
|
||||
|
||||
public static int RIFLE = 0;
|
||||
public static int CARBINE = 1;
|
||||
public static int PISTOL = 2;
|
||||
public static int ONEHANDEDMELEE = 4;
|
||||
public static int TWOHANDEDMELEE = 5;
|
||||
public static int UNARMED = 6;
|
||||
public static int POLEARMMELEE = 7;
|
||||
public static int THROWN = 8;
|
||||
public static int ONEHANDEDSABER = 9;
|
||||
public static int TWOHANDEDSABER = 10;
|
||||
public static int POLEARMSABER = 11;
|
||||
public static int HEAVYWEAPON = 12;
|
||||
public static int FLAMETHROWER = 13;
|
||||
public static final int RIFLE = 0;
|
||||
public static final int CARBINE = 1;
|
||||
public static final int PISTOL = 2;
|
||||
public static final int ONEHANDEDMELEE = 4;
|
||||
public static final int TWOHANDEDMELEE = 5;
|
||||
public static final int UNARMED = 6;
|
||||
public static final int POLEARMMELEE = 7;
|
||||
public static final int THROWN = 8;
|
||||
public static final int ONEHANDEDSABER = 9;
|
||||
public static final int TWOHANDEDSABER = 10;
|
||||
public static final int POLEARMSABER = 11;
|
||||
public static final int HEAVYWEAPON = 12;
|
||||
public static final int FLAMETHROWER = 13;
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,14 @@ import java.nio.ByteOrder;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
|
||||
import resources.datatables.Elemental;
|
||||
|
||||
public class WeaponMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
public WeaponMessageBuilder(WeaponObject weaponObject) {
|
||||
setObject(weaponObject);
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildBaseline3() {
|
||||
WeaponObject weapon = (WeaponObject) object;
|
||||
IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
@@ -68,11 +68,12 @@ public class WeaponMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.putInt(0);
|
||||
buffer.putFloat(weapon.getMaxRange());
|
||||
buffer.putInt(0);
|
||||
|
||||
if( weapon.getElementalType() != null) // Weapon particle effect
|
||||
buffer.putInt(Elemental.getElementalNum(weapon.getElementalType()));
|
||||
else
|
||||
buffer.putInt(Elemental.getElementalNum(weapon.getDamageType()));
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0); // those 2 ints have something to do with particle color
|
||||
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.weapon;
|
||||
|
||||
import resources.datatables.WeaponType;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
@@ -196,7 +197,7 @@ public class WeaponObject extends TangibleObject {
|
||||
|
||||
int weaponType = getWeaponType();
|
||||
|
||||
if(weaponType == 4 || weaponType == 5 || weaponType == 6 || weaponType == 7 || weaponType == 9 || weaponType == 10 || weaponType == 11)
|
||||
if(weaponType == WeaponType.ONEHANDEDMELEE || weaponType == WeaponType.TWOHANDEDMELEE || weaponType == WeaponType.UNARMED || weaponType == WeaponType.POLEARMMELEE || weaponType == WeaponType.ONEHANDEDSABER || weaponType == WeaponType.TWOHANDEDSABER || weaponType == WeaponType.POLEARMSABER)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -207,7 +208,7 @@ public class WeaponObject extends TangibleObject {
|
||||
|
||||
int weaponType = getWeaponType();
|
||||
|
||||
if(weaponType == 0 || weaponType == 1 || weaponType == 2 || weaponType == 3)
|
||||
if(weaponType == WeaponType.RIFLE || weaponType == WeaponType.CARBINE || weaponType == WeaponType.PISTOL || weaponType == WeaponType.FLAMETHROWER || weaponType == WeaponType.HEAVYWEAPON)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -36,6 +36,7 @@ import resources.common.Console;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.common.Opcodes;
|
||||
import resources.common.SpawnPoint;
|
||||
import resources.datatables.WeaponType;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.deed.Harvester_Deed;
|
||||
@@ -213,7 +214,7 @@ public class DevService implements INetworkDispatch {
|
||||
lightsaber1.setMaxRange(5);
|
||||
lightsaber1.setMinDamage(689);
|
||||
lightsaber1.setMaxDamage(1379);
|
||||
lightsaber1.setWeaponType(9);
|
||||
lightsaber1.setWeaponType(WeaponType.ONEHANDEDSABER);
|
||||
|
||||
WeaponObject lightsaber2 = (WeaponObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet);
|
||||
lightsaber2.setIntAttribute("required_combat_level", 90);
|
||||
@@ -223,7 +224,7 @@ public class DevService implements INetworkDispatch {
|
||||
lightsaber2.setMaxRange(5);
|
||||
lightsaber2.setMinDamage(689);
|
||||
lightsaber2.setMaxDamage(1379);
|
||||
lightsaber2.setWeaponType(10);
|
||||
lightsaber2.setWeaponType(WeaponType.TWOHANDEDSABER);
|
||||
|
||||
WeaponObject lightsaber3 = (WeaponObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet);
|
||||
lightsaber3.setIntAttribute("required_combat_level", 90);
|
||||
@@ -233,7 +234,7 @@ public class DevService implements INetworkDispatch {
|
||||
lightsaber3.setMaxRange(5);
|
||||
lightsaber3.setMinDamage(689);
|
||||
lightsaber3.setMaxDamage(1379);
|
||||
lightsaber3.setWeaponType(11);
|
||||
lightsaber3.setWeaponType(WeaponType.POLEARMSABER);
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
@@ -253,7 +254,7 @@ public class DevService implements INetworkDispatch {
|
||||
sword1.setDamageType("kinetic");
|
||||
sword1.setMinDamage(1100);
|
||||
sword1.setMaxDamage(1200);
|
||||
sword1.setWeaponType(4);
|
||||
sword1.setWeaponType(WeaponType.ONEHANDEDMELEE);
|
||||
|
||||
inventory.add(sword1);
|
||||
return;
|
||||
@@ -265,7 +266,7 @@ public class DevService implements INetworkDispatch {
|
||||
rifle1.setDamageType("energy");
|
||||
rifle1.setMinDamage(800);
|
||||
rifle1.setMaxDamage(1250);
|
||||
rifle1.setWeaponType(0);
|
||||
rifle1.setWeaponType(WeaponType.RIFLE);
|
||||
|
||||
inventory.add(rifle1);
|
||||
|
||||
@@ -276,7 +277,7 @@ public class DevService implements INetworkDispatch {
|
||||
carbine1.setDamageType("energy");
|
||||
carbine1.setMinDamage(600);
|
||||
carbine1.setMaxDamage(937);
|
||||
carbine1.setWeaponType(1);
|
||||
carbine1.setWeaponType(WeaponType.CARBINE);
|
||||
|
||||
inventory.add(carbine1);
|
||||
|
||||
@@ -287,7 +288,7 @@ public class DevService implements INetworkDispatch {
|
||||
pistol.setDamageType("energy");
|
||||
pistol.setMinDamage(400);
|
||||
pistol.setMaxDamage(625);
|
||||
pistol.setWeaponType(2);
|
||||
pistol.setWeaponType(WeaponType.PISTOL);
|
||||
|
||||
inventory.add(pistol);
|
||||
return;
|
||||
@@ -304,7 +305,7 @@ public class DevService implements INetworkDispatch {
|
||||
heavy1.setAttackSpeed(1);
|
||||
heavy1.setElementalType("heat");
|
||||
heavy1.setElementalDamage(200);
|
||||
heavy1.setWeaponType(12);
|
||||
heavy1.setWeaponType(WeaponType.HEAVYWEAPON);
|
||||
|
||||
inventory.add(heavy1);
|
||||
|
||||
@@ -319,7 +320,7 @@ public class DevService implements INetworkDispatch {
|
||||
heavy2.setAttackSpeed((float) 0.25);
|
||||
heavy2.setElementalType("heat");
|
||||
heavy2.setElementalDamage(28);
|
||||
heavy2.setWeaponType(13);
|
||||
heavy2.setWeaponType(WeaponType.FLAMETHROWER);
|
||||
|
||||
inventory.add(heavy2);
|
||||
return;
|
||||
|
||||
@@ -41,7 +41,9 @@ import protocol.swg.objectControllerObjects.CombatSpam;
|
||||
import protocol.swg.objectControllerObjects.CommandEnqueueRemove;
|
||||
import protocol.swg.objectControllerObjects.StartTask;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.datatables.Elemental;
|
||||
import resources.datatables.Posture;
|
||||
import resources.datatables.WeaponType;
|
||||
import resources.objects.Buff;
|
||||
import resources.objects.DamageOverTime;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
@@ -68,7 +70,7 @@ public class CombatService implements INetworkDispatch {
|
||||
private NGECore core;
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
private CombatEvents events = new CombatEvents();
|
||||
|
||||
|
||||
public CombatService(NGECore core) {
|
||||
this.core = core;
|
||||
CombatCommands.registerCommands(core);
|
||||
@@ -381,7 +383,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 && command.getBuffNameTarget().length() > 0) {
|
||||
core.buffService.addBuffToCreature(target, command.getBuffNameTarget());
|
||||
core.buffService.addBuffToCreature(target, command.getBuffNameTarget(), attacker);
|
||||
}
|
||||
if(command.getDotIntensity() > 0) {
|
||||
addDotToCreature(attacker, target, command, target.getBuffByName(command.getBuffNameTarget()));
|
||||
@@ -395,7 +397,7 @@ public class CombatService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
if(command.getAddedDamage() == 0 && command.getPercentFromWeapon() == 0 && command.getBuffNameTarget().length() > 0)
|
||||
core.buffService.addBuffToCreature(target, command.getBuffNameTarget());
|
||||
core.buffService.addBuffToCreature(target, command.getBuffNameTarget(), attacker);
|
||||
|
||||
sendCombatPackets(attacker, target, weapon, command, actionCounter, damage, 0, HitType.HIT);
|
||||
|
||||
@@ -450,40 +452,23 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
private float getArmorReduction(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, byte hitType) {
|
||||
|
||||
int elementalType = 1;
|
||||
String elementalName = "";
|
||||
|
||||
if(command.getPercentFromWeapon() > 0) {
|
||||
|
||||
// TODO: elemental mitigation and damage
|
||||
|
||||
elementalName = weapon.getDamageType();
|
||||
|
||||
if(weapon.getStringAttribute("cat_wpn_damage.wpn_damage_type").equals("@obj_attr_n:armor_eff_kinetic"))
|
||||
elementalType = ElementalType.KINETIC;
|
||||
else if(weapon.getStringAttribute("cat_wpn_damage.wpn_damage_type").equals("@obj_attr_n:armor_eff_energy"))
|
||||
elementalType = ElementalType.ENERGY;
|
||||
|
||||
} else {
|
||||
|
||||
elementalType = command.getElementalType();
|
||||
|
||||
elementalName = Elemental.getElementalName(command.getElementalType());
|
||||
|
||||
}
|
||||
|
||||
int baseArmor = 0;
|
||||
|
||||
switch(elementalType) {
|
||||
|
||||
case ElementalType.KINETIC:
|
||||
baseArmor = target.getSkillModBase("kinetic");
|
||||
case ElementalType.ENERGY:
|
||||
baseArmor = target.getSkillModBase("energy");
|
||||
case ElementalType.HEAT:
|
||||
baseArmor = target.getSkillModBase("heat");
|
||||
case ElementalType.COLD:
|
||||
baseArmor = target.getSkillModBase("cold");
|
||||
case ElementalType.ACID:
|
||||
baseArmor = target.getSkillModBase("acid");
|
||||
case ElementalType.ELECTRICITY:
|
||||
baseArmor = target.getSkillModBase("electricity");
|
||||
}
|
||||
baseArmor = target.getSkillModBase(elementalName);
|
||||
|
||||
if(target.getSkillMod("expertise_innate_reduction_all_player") != null)
|
||||
baseArmor *= (100 - target.getSkillModBase("expertise_innate_reduction_all_player")) / 100;
|
||||
@@ -1328,24 +1313,10 @@ public class CombatService implements INetworkDispatch {
|
||||
int weaponType = weapon.getWeaponType();
|
||||
int actionReduction;
|
||||
|
||||
switch(weaponType) {
|
||||
|
||||
case 0: actionReduction = attacker.getSkillModBase("expertise_action_weapon_0");
|
||||
case 1: actionReduction = attacker.getSkillModBase("expertise_action_weapon_1");
|
||||
case 2: actionReduction = attacker.getSkillModBase("expertise_action_weapon_2");
|
||||
case 4: actionReduction = attacker.getSkillModBase("expertise_action_weapon_4");
|
||||
case 5: actionReduction = attacker.getSkillModBase("expertise_action_weapon_5");
|
||||
case 6: actionReduction = attacker.getSkillModBase("expertise_action_weapon_6");
|
||||
case 7: actionReduction = attacker.getSkillModBase("expertise_action_weapon_7");
|
||||
case 8: actionReduction = attacker.getSkillModBase("expertise_action_weapon_8");
|
||||
case 9: actionReduction = attacker.getSkillModBase("expertise_action_weapon_9");
|
||||
case 10: actionReduction = attacker.getSkillModBase("expertise_action_weapon_10");
|
||||
case 11: actionReduction = attacker.getSkillModBase("expertise_action_weapon_11");
|
||||
case 12: actionReduction = attacker.getSkillModBase("expertise_action_weapon_3");
|
||||
|
||||
default: actionReduction = 0;
|
||||
|
||||
}
|
||||
if(weaponType == WeaponType.HEAVYWEAPON || weaponType == WeaponType.FLAMETHROWER)
|
||||
actionReduction = attacker.getSkillModBase("expertise_action_weapon_3");
|
||||
else
|
||||
actionReduction = attacker.getSkillModBase("expertise_action_weapon_" + Integer.toString(weaponType));
|
||||
|
||||
actionReduction += attacker.getSkillModBase("expertise_action_all");
|
||||
|
||||
@@ -1358,24 +1329,16 @@ public class CombatService implements INetworkDispatch {
|
||||
int weaponType = weapon.getWeaponType();
|
||||
int weaponDmgIncrease;
|
||||
|
||||
switch(weaponType) {
|
||||
|
||||
case 0: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_0");
|
||||
case 1: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_1");
|
||||
case 2: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_2");
|
||||
case 4: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_4");
|
||||
case 5: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_5");
|
||||
case 6: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_6");
|
||||
case 7: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_7");
|
||||
case 8: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_8");
|
||||
case 9: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_9");
|
||||
case 10: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_10");
|
||||
case 11: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_11");
|
||||
case 12: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_3");
|
||||
|
||||
default: weaponDmgIncrease = 0;
|
||||
if(weaponType == WeaponType.HEAVYWEAPON || weaponType == WeaponType.FLAMETHROWER)
|
||||
weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_3");
|
||||
else
|
||||
weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_" + Integer.toString(weaponType));
|
||||
|
||||
}
|
||||
if(weapon.isRanged())
|
||||
weaponDmgIncrease += attacker.getSkillModBase("expertise_damage_ranged");
|
||||
|
||||
if(weapon.isMelee())
|
||||
weaponDmgIncrease += attacker.getSkillModBase("expertise_damage_melee");
|
||||
|
||||
weaponDmgIncrease += attacker.getSkillModBase("expertise_damage_all");
|
||||
|
||||
@@ -1419,6 +1382,4 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user