Master merge fix

This commit is contained in:
CharonInferar
2014-06-08 01:18:37 +02:00
1873 changed files with 15975 additions and 8263 deletions
+10
View File
@@ -68,4 +68,14 @@ public class MathUtilities {
BigDecimal dec = new BigDecimal(seconds);
return dec.remainder(new BigDecimal(3600)).divide(new BigDecimal(60), BigDecimal.ROUND_FLOOR).intValue();
}
public float fastInverseSqrt(float x) {
float xHalf = 0.5F * x;
int temp = Float.floatToRawIntBits(x);
temp = 0x5F3759DF - (temp >> 1); // magic
float newX = Float.intBitsToFloat(temp);
newX = newX * (1.5F - xHalf * newX * newX);
return newX;
}
}
+47
View File
@@ -0,0 +1,47 @@
/*******************************************************************************
* 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;
public class GcwRank {
// Shared ranks
public static final int PRIVATE = 1;
public static final int SERGEANT = 4;
public static final int SERGEANTMAJOR = 6;
public static final int LIEUTENANT = 7;
public static final int CAPTAIN = 8;
public static final int MAJOR = 9;
public static final int COLONEL = 11;
public static final int GENERAL = 12;
// Rebel ranks
public static final int TROOPER = 2;
public static final int HIGHTROOPER = 3;
public static final int SENIORSERGEANT = 5;
public static final int COMMANDER = 10;
// Imperial ranks
public static final int CORPORAL = 2;
public static final int LANCECORPORAL = 3;
public static final int MASTERSERGEANT = 5;
public static final int LTCOLONEL = 10;
}
+1 -1
View File
@@ -335,7 +335,7 @@ public class SWGMultiMap<K, V> implements Multimap<K, V>, Serializable {
throw new IllegalArgumentException();
}
int size = 1 + ((useIndex) ? (2 + Baseline.toBytes(index).length) : 0) + ((useData) ? data.length : 0);
int size = 1 + ((useIndex) ? (Baseline.toBytes(index).length) : 0) + ((useData) ? data.length : 0);
IoBuffer buffer = Delta.createBuffer(size);
buffer.put((byte) type);
@@ -157,9 +157,9 @@ public class BuildingObject extends TangibleObject implements IPersistent, Seria
try {
PortalVisitor portal = ClientFileManager.loadFile(portalLayoutFilename, PortalVisitor.class);
for (int i = 1; i <= portal.cellCount; i++) {
for (int i = 0; i <= portal.cellCount; i++) {
if (cellName.equals(portal.cells.get(i).name)) {
return getCellByCellNumber(i);
return getCellByCellNumber(i + 1);
}
}
} catch (InstantiationException | IllegalAccessException e) {
@@ -289,7 +289,13 @@ public class CreatureMessageBuilder extends TangibleMessageBuilder {
buffer.putInt(0);
buffer.putInt(creature.getEquipmentListUpdateCounter());
} else {
buffer.putInt(creature.getEquipmentList().size());
int size = 0;
for (Long objId : creature.getEquipmentList().get()) {
size += ((NGECore.getInstance().objectService.getObject(objId) == null) ? 0 : 1);
}
buffer.putInt(size);
buffer.putInt(creature.getEquipmentListUpdateCounter());
for(Long objId : creature.getEquipmentList().get()) {
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.Vector;
import java.util.concurrent.TimeUnit;
import org.apache.mina.core.buffer.IoBuffer;
@@ -110,7 +111,7 @@ public class PlayerObject extends IntangibleObject implements Serializable {
profileFlagsList.add(0);
baseline.put("profileFlagsList", profileFlagsList);
baseline.put("title", "");
baseline.put("bornDate", (int) (System.currentTimeMillis() / 1000L)); //Integer.parseInt(new SimpleDateFormat("yyyymmdd", Locale.ENGLISH).format(Calendar.getInstance().getTime())));
baseline.put("bornDate", (int) TimeUnit.DAYS.convert((System.currentTimeMillis() - 978220800000L), TimeUnit.MILLISECONDS));
baseline.put("totalPlayTime", 0);
baseline.put("professionIcon", 0);
baseline.put("profession", "trader_0a");
+1 -1
View File
@@ -291,7 +291,7 @@ public class CharacterService implements INetworkDispatch {
player.setProfession(clientCreateCharacter.getProfession());
player.setProfessionIcon(Professions.get(clientCreateCharacter.getProfession()));
player.setProfessionWheelPosition(clientCreateCharacter.getProfessionWheelPosition());
player.setNextUpdateTime(core.gcwService.calculateNextUpdateTime() + player.getBornDate());
player.setNextUpdateTime(core.gcwService.calculateNextUpdateTime());
if(clientCreateCharacter.getHairObject().length() > 0) {
String sharedHairTemplate = clientCreateCharacter.getHairObject().replace("/hair_", "/shared_hair_");
TangibleObject hair = (TangibleObject) core.objectService.createObject(sharedHairTemplate, object.getPlanet());
+2 -3
View File
@@ -70,6 +70,7 @@ import engine.resources.service.INetworkRemoteEvent;
* @author Charon
*/
@SuppressWarnings("unused")
public class LootService implements INetworkDispatch {
private NGECore core;
@@ -570,7 +571,6 @@ public class LootService implements INetworkDispatch {
return null;
}
@SuppressWarnings("unused")
private void handleLootPoolItems(String itemName,LootRollSession lootRollSession){
final Vector<String> foundPath = new Vector<String>();
@@ -1638,7 +1638,7 @@ public class LootService implements INetworkDispatch {
int finalMinDmg = 0;
int finalMaxDmg = 0;
@SuppressWarnings("unused") String tunableObjectName = "";
String tunableObjectName = "";
if (objectType.contains("powercrystal")){
tunableObjectName = "Power Crystal";
@@ -2620,7 +2620,6 @@ public class LootService implements INetworkDispatch {
// util method
@SuppressWarnings("unused")
private void printArrayElements(TangibleObject[] array){
System.out.print("Array [");
for (int i=0;i<array.length;i++){
@@ -164,8 +164,6 @@ public class EquipmentService implements INetworkDispatch {
PyObject func = core.scriptService.getMethod("scripts/" + serverTemplate.split("shared_" , 2)[0].replace("shared_", ""), serverTemplate.split("shared_" , 2)[1], "equip");
if(func != null) func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item));
// TODO: bio-link (assign it by objectID with setAttachment and then just display the customName for that objectID).
if(!actor.getEquipmentList().contains(item.getObjectId()))
{
actor.addObjectToEquipList(item);
+1 -1
View File
@@ -366,7 +366,7 @@ public class FactionService implements INetworkDispatch {
try {
for (int i = 0; i < pvpFactions.getRowCount(); i++) {
if (pvpFactions.getObject(i, 0) != null) {
if (((String) pvpFactions.getObject(i, 0)).equals(faction)) {
if (((String) pvpFactions.getObject(i, 1)).equals(faction)) {
return true;
}
}
+16 -5
View File
@@ -51,6 +51,7 @@ import resources.common.OutOfBand;
import resources.common.collidables.CollidableCircle;
import resources.datatables.DisplayType;
import resources.datatables.FactionStatus;
import resources.datatables.GcwRank;
import resources.datatables.GcwType;
import resources.gcw.CurrentServerGCWZoneHistory;
import resources.gcw.CurrentServerGCWZonePercent;
@@ -354,7 +355,7 @@ public class GCWService implements INetworkDispatch {
player.setHighestImperialRank(player.getCurrentRank());
}
player.setNextUpdateTime(nextUpdateTime - player.getBornDate());
player.setNextUpdateTime(nextUpdateTime);
}
}
@@ -461,6 +462,10 @@ public class GCWService implements INetworkDispatch {
PlayerObject player = (PlayerObject) actor.getSlottedObject("ghost");
int gcwBonus = actor.getSkillModBase("flush_with_success");
gcwPoints += ((gcwPoints * gcwBonus) / 100);
String planet = actor.getPlanet().getName();
String prefix = ((planet.startsWith("space")) ? (planet + "_space") : planet);
@@ -539,14 +544,14 @@ public class GCWService implements INetworkDispatch {
newranktotal = oldranktotal + newprogress;
if (oldrank == 7 && newprogress < 0 && newranktotal < 30000) {
if (oldrank == GcwRank.LIEUTENANT && newprogress < 0 && newranktotal < 30000) {
newranktotal = 29999;
}
newrank = (int) (Math.floor(newranktotal / 5000) + 1);
if (newrank > 12) {
newrank = 12;
if (newrank > GcwRank.GENERAL) {
newrank = GcwRank.GENERAL;
newranktotal = 12 * 5000 - 1;
}
@@ -555,6 +560,12 @@ public class GCWService implements INetworkDispatch {
player.setCurrentRank(newrank);
player.setRankProgress((float) Math.floor(newprogress));
if (newrank > oldrank) {
core.scriptService.callScript("scripts/gcw/", "gcwrank_" + actor.getFaction(), "handleRankUp", core, actor, newrank);
} else {
core.scriptService.callScript("scripts/gcw/", "gcwrank_" + actor.getFaction(), "handleRankDown", actor, newrank);
}
}
public List<SWGObject> getSFPlayers() {
@@ -654,7 +665,7 @@ public class GCWService implements INetworkDispatch {
PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost");
player.setNextUpdateTime(player.getBornDate() + calculateNextUpdateTime());
player.setNextUpdateTime(calculateNextUpdateTime());
}
cursor.close();
+20 -16
View File
@@ -679,17 +679,21 @@ public class ObjectService implements INetworkDispatch {
return;
}
// Bio-Linking
String template = ((object.getAttachment("customServerTemplate") == null) ? object.getTemplate() : (object.getTemplate().split("shared_")[0] + "shared_" + ((String) object.getAttachment("customServerTemplate")) + ".iff"));
String bl = object.getStringAttribute("bio_link");
if (bl!=null){
if (! object.getContainer().getTemplate().contains("shared_character_inventory")){
creature.sendSystemMessage("@base_player:must_biolink_to_use_from_inventory", (byte)1);
return;
}
if (! bl.contains("@obj_attr_n:bio_link_pending") && ! bl.contains(creature.getCustomName())){
creature.sendSystemMessage("@base_player:not_linked_to_holder", (byte)1);
if (bl != null) {
if (!object.getContainer().getTemplate().contains("shared_character_inventory")){
creature.sendSystemMessage("@base_player:must_biolink_to_use_from_inventory", DisplayType.Screen);
return;
}
if (!bl.contains("@obj_attr_n:bio_link_pending") && ! bl.contains(creature.getCustomName())){
creature.sendSystemMessage("@base_player:not_linked_to_holder", DisplayType.Screen);
return;
}
if (bl.contains("@obj_attr_n:bio_link_pending")){
creature.setAttachment("BioLinkItemCandidate", object.getObjectID());
SUIWindow window = core.suiService.createSUIWindow("Script.messageBox", creature, creature, 0);
@@ -705,7 +709,7 @@ public class ObjectService implements INetworkDispatch {
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
@Override
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
((CreatureObject)owner).sendSystemMessage("@base_player:item_bio_linked", (byte)1);
((CreatureObject)owner).sendSystemMessage("@base_player:item_bio_linked", (byte) 1);
object.setStringAttribute("bio_link", owner.getCustomName());
object.setAttachment("bio_link_PlayerID", owner.getObjectID());
return;
@@ -769,11 +773,11 @@ public class ObjectService implements INetworkDispatch {
}
if (!foundTemplate && reuse_time > 0) {
if (creature.hasCooldown(object.getTemplate())) {
if (creature.hasCooldown(template)) {
return;
}
creature.addCooldown(object.getTemplate(), reuse_time);
creature.addCooldown(template, reuse_time);
}
} catch (Exception e) {
e.printStackTrace();
@@ -796,14 +800,14 @@ public class ObjectService implements INetworkDispatch {
core.buffService.addBuffToCreature(creature, object.getStringAttribute("proc_name").replace("@ui_buff:", ""), creature);
}
String filePath = "scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", "") + object.getTemplate().split("shared_" , 2)[1].replace(".iff", "") + ".py";
String filePath = "scripts/" + template.split("shared_" , 2)[0].replace("shared_", "") + template.split("shared_" , 2)[1].replace(".iff", "") + ".py";
if (FileUtilities.doesFileExist(filePath)) {
filePath = "scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", "");
String fileName = object.getTemplate().split("shared_" , 2)[1].replace(".iff", "");
filePath = "scripts/" + template.split("shared_" , 2)[0].replace("shared_", "");
String fileName = template.split("shared_" , 2)[1].replace(".iff", "");
PyObject method1 = core.scriptService.getMethod("scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", ""), object.getTemplate().split("shared_" , 2)[1].replace(".iff", ""), "use");
PyObject method2 = core.scriptService.getMethod("scripts/" + object.getTemplate().split("shared_" , 2)[0].replace("shared_", ""), object.getTemplate().split("shared_" , 2)[1].replace(".iff", ""), "useObject");
PyObject method1 = core.scriptService.getMethod("scripts/" + template.split("shared_" , 2)[0].replace("shared_", ""), template.split("shared_" , 2)[1].replace(".iff", ""), "use");
PyObject method2 = core.scriptService.getMethod("scripts/" + template.split("shared_" , 2)[0].replace("shared_", ""), template.split("shared_" , 2)[1].replace(".iff", ""), "useObject");
if (method1 != null && method1.isCallable()) {
method1.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(object));
+4
View File
@@ -676,6 +676,10 @@ public class MountService implements INetworkDispatch {
if (isMounted(owner, mount)) {
//storer.sendSystemMessage(OutOfBand.ProsePackage("@pet/pet_menu:must_dismount"), DisplayType.Broadcast);
//return;
<<<<<<< HEAD
=======
dismount(storer, mount);
>>>>>>> origin/master
}
if (owner.getTefTime() > 0) {
-46
View File
@@ -42,16 +42,10 @@ public class MobileTemplate implements Cloneable {
private short maxLevel;
private Vector<String> attacks;
private String defaultAttack;
private int minDamage = 0;
private int maxDamage = 0;
private float attackSpeed = 0;
private int weaponType = 0;
private int difficulty = 0;
private int health, action;
private String creatureName;
private float scale = 1;
// this is a custom attack Range setting to use for large mobs like krayts
private int attackRange;
private Vector<String> weaponTemplates = new Vector<String>();
private Vector<WeaponTemplate> weaponTemplateVector = new Vector<WeaponTemplate>();
private int minSpawnDistance = 0;
@@ -122,22 +116,6 @@ public class MobileTemplate implements Cloneable {
this.attacks = attacks;
}
public int getMinDamage() {
return minDamage;
}
public void setMinDamage(int minDamage) {
this.minDamage = minDamage;
}
public int getMaxDamage() {
return maxDamage;
}
public void setMaxDamage(int maxDamage) {
this.maxDamage = maxDamage;
}
public int getDifficulty() {
return difficulty;
}
@@ -185,14 +163,6 @@ public class MobileTemplate implements Cloneable {
public void setScale(float scale) {
this.scale = scale;
}
public int getAttackRange() {
return attackRange;
}
public void setAttackRange(int attackRange) {
this.attackRange = attackRange;
}
public Vector<String> getWeaponTemplates() {
return weaponTemplates;
@@ -202,22 +172,6 @@ public class MobileTemplate implements Cloneable {
this.weaponTemplates = weaponTemplates;
}
public float getAttackSpeed() {
return attackSpeed;
}
public void setAttackSpeed(float attackSpeed) {
this.attackSpeed = attackSpeed;
}
public int getWeaponType() {
return weaponType;
}
public void setWeaponType(int weaponType) {
this.weaponType = weaponType;
}
public Vector<WeaponTemplate> getWeaponTemplateVector() {
return weaponTemplateVector;
}
+18 -23
View File
@@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledExecutorService;
import resources.common.collidables.CollidableCircle;
import resources.datatables.Options;
import resources.datatables.PvpStatus;
import resources.datatables.WeaponType;
import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
import resources.objects.tangible.TangibleObject;
@@ -129,42 +130,36 @@ public class SpawnService {
creature.setLevel(level);
}
//WeaponObject defaultWeapon = (mobileTemplate.getWeaponTemplates().size() > 0) ? (WeaponObject) core.objectService.createObject(mobileTemplate.getWeaponTemplates().get(new Random().nextInt(mobileTemplate.getWeaponTemplates().size())), creature.getPlanet()) : (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet());
WeaponObject defaultWeapon = null;
Vector<WeaponTemplate> weaponTemplates = mobileTemplate.getWeaponTemplateVector();
if (weaponTemplates.size()==0){
int rnd = 0;
if (weaponTemplates.size() > 0 )
rnd = new Random().nextInt(weaponTemplates.size());
if (weaponTemplates.size() == 0){
defaultWeapon = (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet());
defaultWeapon.setAttackSpeed(1.0F);
defaultWeapon.setWeaponType(6);
defaultWeapon.setWeaponType(WeaponType.UNARMED);
defaultWeapon.setDamageType("kinetic");
defaultWeapon.setMaxRange(5);
} else {
int rnd = new Random().nextInt(weaponTemplates.size());
defaultWeapon = (WeaponObject) core.objectService.createObject(weaponTemplates.get(rnd).getTemplate(), creature.getPlanet());
defaultWeapon = (WeaponObject) core.objectService.createObject(weaponTemplates.get(rnd).getTemplate(), creature.getPlanet());
defaultWeapon.setAttackSpeed(weaponTemplates.get(rnd).getAttackSpeed());
defaultWeapon.setWeaponType(weaponTemplates.get(rnd).getWeaponType());
defaultWeapon.setMaxRange(weaponTemplates.get(rnd).getMaxRange());
defaultWeapon.setDamageType(weaponTemplates.get(rnd).getDamageType());
}
// QA
if (mobileTemplate.getAttackSpeed()==0)
System.err.println("Error in mobile spawn template for " + mobileTemplate.getCreatureName() + ". Missing attackspeed parameter");
if (mobileTemplate.getAttackRange()==0)
System.err.println("Error in mobile spawn template for " + mobileTemplate.getCreatureName() + ". Missing attackrange parameter");
defaultWeapon.setAttackSpeed(mobileTemplate.getAttackSpeed());
defaultWeapon.setWeaponType(mobileTemplate.getWeaponType());
defaultWeapon.setDamageType("@obj_attr_n:armor_eff_kinetic");
defaultWeapon.setStringAttribute("cat_wpn_damage.damage", "0-0");
if(mobileTemplate.getAttackRange() > 0)
defaultWeapon.setMaxRange(mobileTemplate.getAttackRange());
if(mobileTemplate.getMaxDamage() != 0) {
defaultWeapon.setMaxDamage(mobileTemplate.getMaxDamage());
defaultWeapon.setMinDamage(mobileTemplate.getMinDamage());
if (weaponTemplates.get(rnd).getMinDamage() != 0 && weaponTemplates.get(rnd).getMaxDamage() != 0) {
defaultWeapon.setMaxDamage(weaponTemplates.get(rnd).getMinDamage());
defaultWeapon.setMinDamage(weaponTemplates.get(rnd).getMaxDamage());
} else {
defaultWeapon.setMaxDamage(creature.getLevel() * 24);
defaultWeapon.setMinDamage(creature.getLevel() * 22);
}
creature.addObjectToEquipList(defaultWeapon);
creature.add(defaultWeapon);
creature.setWeaponId(defaultWeapon.getObjectID());
+52 -4
View File
@@ -2,18 +2,34 @@ package services.spawn;
public class WeaponTemplate {
private String template="";
private float attackSpeed=0;
private int weaponType=0;
private String template = "";
private int weaponType = 0;
private float attackSpeed = 0;
private int minDamage = 0;
private int maxDamage = 0;
private float maxRange = 0;
private String damageType = "";
public WeaponTemplate(){
}
public WeaponTemplate(String template, int weaponType, float attackSpeed){
public WeaponTemplate(String template, int weaponType, float attackSpeed, float maxRange, int minDamage, int maxDamage, String damageType){
this.template = template;
this.weaponType = weaponType;
this.attackSpeed = attackSpeed;
this.maxRange = maxRange;
this.minDamage = minDamage;
this.maxDamage = maxDamage;
this.damageType = damageType;
}
public WeaponTemplate(String template, int weaponType, float attackSpeed, float maxRange, String damageType){
this.template = template;
this.weaponType = weaponType;
this.attackSpeed = attackSpeed;
this.maxRange = maxRange;
this.damageType = damageType;
}
public String getTemplate() {
@@ -39,4 +55,36 @@ public class WeaponTemplate {
public void setWeaponType(int weaponType) {
this.weaponType = weaponType;
}
public float getMaxRange() {
return maxRange;
}
public void setMaxRange(float maxRange) {
this.maxRange = maxRange;
}
public int getMinDamage() {
return minDamage;
}
public void setMinDamage(int minDamage) {
this.minDamage = minDamage;
}
public int getMaxDamage() {
return maxDamage;
}
public void setMaxDamage(int maxDamage) {
this.maxDamage = maxDamage;
}
public String getDamageType() {
return damageType;
}
public void setDamageType(String damageType) {
this.damageType = damageType;
}
}