This commit is contained in:
Light2
2014-06-09 02:38:36 +02:00
2050 changed files with 20797 additions and 8841 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;
}
@@ -47,4 +47,8 @@ public final class Professions {
return map.get(profession);
}
public static boolean isProfession(String profession) {
return map.containsKey(profession);
}
}
+8 -15
View File
@@ -194,21 +194,14 @@ public class SWGMap<K, V> implements Map<K, V>, Serializable {
K key = entry.getKey();
V value = entry.getValue();
if (valid(key) && valid(value))
{
if (map.containsKey(key))
{
if (map.put(key, value) != null)
{
buffer.add(item(2, key, Baseline.toBytes(value), true, true));
}
}
else
{
if(map.put(key, value) == null)
{
buffer.add(item(0, key, Baseline.toBytes(value), true, true));
}
if (key != null && valid(key) && value != null && valid(value)) {
if (map.containsKey(key)) {
map.put(key, value);
buffer.add(item(2, key, Baseline.toBytes(value), true, true));
} else {
map.put(key, value);
buffer.add(item(0, key, Baseline.toBytes(value), true, true));
}
}
}
+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");