mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-06 21:12:59 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
Conflicts: src/main/NGECore.java
This commit is contained in:
@@ -21,9 +21,7 @@
|
||||
******************************************************************************/
|
||||
package resources.common;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Cooldown {
|
||||
private long startTimestamp;
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
******************************************************************************/
|
||||
package resources.common;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class IDAttribute {
|
||||
|
||||
private float floatValue;
|
||||
|
||||
@@ -42,5 +42,6 @@ public class ObjControllerOpcodes {
|
||||
public static final int STOP_NPC_CONVERSATION = 0xDE000000;
|
||||
public static final int NPC_CONVERSATION_OPTIONS = 0xE0000000;
|
||||
public static final int SET_PROFESSION_TEMPLATE = 0x5C040000;
|
||||
|
||||
public static final int RESOURCE_EMPTY_HOPPER = 0xED000000;
|
||||
|
||||
}
|
||||
|
||||
@@ -187,7 +187,8 @@ public class ThreadMonitor {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void parseMBeanInfo() throws IOException {
|
||||
@SuppressWarnings("unused")
|
||||
private void parseMBeanInfo() throws IOException {
|
||||
try {
|
||||
MBeanOperationInfo[] mopis = server.getMBeanInfo(objname).getOperations();
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ import resources.objects.creature.CreatureObject;
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.clientdata.ClientFileManager;
|
||||
import engine.clientdata.visitors.DatatableVisitor;
|
||||
import engine.resources.common.CRC;
|
||||
|
||||
@Persistent(version=10)
|
||||
|
||||
@@ -30,9 +30,7 @@ import resources.objects.tangible.TangibleObject;
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.container.Traverser;
|
||||
import engine.resources.objects.IPersistent;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.apache.mina.core.buffer.IoBuffer;
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.resources.common.CRC;
|
||||
import resources.common.StringUtilities;
|
||||
import resources.objects.Buff;
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.SkillMod;
|
||||
|
||||
@@ -22,25 +22,21 @@
|
||||
package resources.objects.creature;
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import protocol.swg.ChatSystemMessage;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayClientEffectObjectMessage;
|
||||
import protocol.swg.PlayMusicMessage;
|
||||
import protocol.swg.UpdatePostureMessage;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import protocol.swg.chat.ChatSystemMessage;
|
||||
import protocol.swg.objectControllerObjects.Animation;
|
||||
import protocol.swg.objectControllerObjects.Posture;
|
||||
|
||||
@@ -63,8 +59,8 @@ import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
|
||||
@Entity(version=6)
|
||||
public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
@@ -1090,8 +1086,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
appearanceEquipmentList.get().remove(object);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
@@ -1777,6 +1772,11 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public PlayerObject getPlayerObject()
|
||||
{
|
||||
return (PlayerObject) this.getSlottedObject("ghost");
|
||||
}
|
||||
|
||||
//public float getCooldown(String cooldownGroup) {
|
||||
//return ((float) getCooldown(cooldownGroup) / (float) 1000);
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*******************************************************************************
|
||||
* 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.objects.deed;
|
||||
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
public class Deed extends TangibleObject {
|
||||
|
||||
public Deed(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
|
||||
super(objectID, planet, template, position, orientation);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/*******************************************************************************
|
||||
* 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.objects.deed;
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
@Persistent(version=0)
|
||||
public class Harvester_Deed extends Deed {
|
||||
|
||||
private String name;
|
||||
private String structureTemplate;
|
||||
private String constructorTemplate;
|
||||
private int outputHopperCapacity=0;
|
||||
private int BER=0;
|
||||
private int BMR=0;
|
||||
private int surplusMaintenance=0;
|
||||
private int surplusPower=0;
|
||||
private int lotRequirement;
|
||||
|
||||
|
||||
public Harvester_Deed(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
|
||||
super(objectID, planet, template, position, orientation);
|
||||
}
|
||||
|
||||
public int getOutputHopperCapacity() {
|
||||
return outputHopperCapacity;
|
||||
}
|
||||
public void setOutputHopperCapacity(int outputHopperCapacity) {
|
||||
this.outputHopperCapacity = outputHopperCapacity;
|
||||
}
|
||||
public int getBER() {
|
||||
return BER;
|
||||
}
|
||||
public void setBER(int bER) {
|
||||
this.BER = bER;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getStructureTemplate() {
|
||||
return structureTemplate;
|
||||
}
|
||||
public void setStructureTemplate(String structureTemplate) {
|
||||
this.structureTemplate = structureTemplate;
|
||||
}
|
||||
public int getLotRequirement() {
|
||||
return lotRequirement;
|
||||
}
|
||||
public void setLotRequirement(int lotRequirement) {
|
||||
this.lotRequirement = lotRequirement;
|
||||
}
|
||||
public String getConstructorTemplate() {
|
||||
return constructorTemplate;
|
||||
}
|
||||
public void setConstructorTemplate(String constructorTemplate) {
|
||||
this.constructorTemplate = constructorTemplate;
|
||||
}
|
||||
public int getBMR() {
|
||||
return BMR;
|
||||
}
|
||||
public void setBMR(int BMR) {
|
||||
this.BMR = BMR;
|
||||
}
|
||||
public int getSurplusMaintenance() {
|
||||
return surplusMaintenance;
|
||||
}
|
||||
public void setSurplusMaintenance(int surplusMaintenance) {
|
||||
this.surplusMaintenance = surplusMaintenance;
|
||||
}
|
||||
|
||||
public int getSurplusPower() {
|
||||
return surplusPower;
|
||||
}
|
||||
|
||||
public void setSurplusPower(int surplusPower) {
|
||||
this.surplusPower = surplusPower;
|
||||
}
|
||||
|
||||
|
||||
public void setAttributes() {
|
||||
this.getAttributes().put("@obj_attr_n:volume", "1");
|
||||
this.getAttributes().put("@obj_attr_n:examine_maintenance_rate", ""+this.getBMR() + "/hour");
|
||||
if (this.getSurplusMaintenance()>0)
|
||||
this.getAttributes().put("@obj_attr_n:examine_maintenance", ""+this.getSurplusMaintenance());
|
||||
|
||||
//this.getAttributes().put("@obj_attr_n:energy_maintenance", "0");
|
||||
if (this.getSurplusPower()>0)
|
||||
this.getAttributes().put("@obj_attr_n:examine_power", ""+this.getSurplusPower());
|
||||
|
||||
this.getAttributes().put("@obj_attr_n:examine_hoppersize", ""+this.getOutputHopperCapacity());
|
||||
this.getAttributes().put("@obj_attr_n:examine_extractionrate", ""+this.getBER());
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,11 @@ public class GroupObject extends UniverseObject {
|
||||
private GroupMessageBuilder messageBuilder;
|
||||
private int chatRoomId;
|
||||
|
||||
public static int FREE_FOR_ALL = 0;
|
||||
public static int MASTER_LOOTER = 1;
|
||||
public static int LOTTERY = 2;
|
||||
|
||||
|
||||
public GroupObject(long objectId) {
|
||||
super(objectId, null, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), "object/group/shared_group_object.iff");
|
||||
messageBuilder = new GroupMessageBuilder(this);
|
||||
|
||||
@@ -21,6 +21,807 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.harvester;
|
||||
|
||||
public class HarvesterMessageBuilder {
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.objects.SWGObject;
|
||||
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.resource.GalacticResource;
|
||||
import resources.objects.resource.ResourceContainerObject;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
public class HarvesterMessageBuilder extends ObjectMessageBuilder{
|
||||
|
||||
public HarvesterMessageBuilder(HarvesterObject harvesterObject) {
|
||||
setObject(harvesterObject);
|
||||
}
|
||||
|
||||
public IoBuffer buildBaseline3() {
|
||||
|
||||
HarvesterObject building = (HarvesterObject) object;
|
||||
IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
|
||||
buffer.putShort((short) 0x0D);
|
||||
buffer.putFloat(building.getComplexity());
|
||||
buffer.put(getAsciiString(building.getStfFilename()));
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString(building.getStfName()));
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0xFF);
|
||||
//buffer.putInt(0x64);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putShort((short) 0);
|
||||
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
// buffer.putInt(16777216);
|
||||
buffer.putInt(0x100);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(64);
|
||||
buffer.putInt(0x201C);
|
||||
buffer.put((byte) 1);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
|
||||
buffer.flip();
|
||||
buffer = createBaseline("BUIO", (byte) 3, buffer, size);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildHINO3Delta(HarvesterObject harvester,byte state) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)3);
|
||||
buffer.putInt(0xB);
|
||||
buffer.putShort((short)2);
|
||||
buffer.putShort((short)8);
|
||||
buffer.put((byte)1);
|
||||
buffer.putShort((short)1);
|
||||
buffer.put((byte)0);
|
||||
buffer.putShort((short)0xD);
|
||||
buffer.put(state);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
// 0000: 05 00 53 21 86 12 33 01 0E BE 41 00 00 00 4F 4E ..S!..3...A...ON
|
||||
// 0010: 49 48 03 0B 00 00 00 02 00 08 00 01 01 00 00 0D IH..............
|
||||
// 0020: 00 01
|
||||
|
||||
|
||||
public IoBuffer buildHINO3Delta2(HarvesterObject harvester,byte state) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)3);
|
||||
buffer.putInt(0xB);
|
||||
buffer.putShort((short)2);
|
||||
buffer.putShort((short)8);
|
||||
buffer.put((byte)0);
|
||||
buffer.putShort((short)1);
|
||||
buffer.put((byte)0);
|
||||
buffer.putShort((short)0xD);
|
||||
buffer.put(state);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildBaseline6() {
|
||||
|
||||
HarvesterObject building = (HarvesterObject) object;
|
||||
IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
|
||||
buffer.putShort((short) 8);
|
||||
buffer.putInt(0x43);
|
||||
|
||||
buffer.put(getAsciiString(building.getDetailFilename()));
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString(building.getDetailName()));
|
||||
buffer.putInt(0);
|
||||
buffer.put((byte) 0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
|
||||
buffer.flip();
|
||||
buffer = createBaseline("BUIO", (byte) 6, buffer, size);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildHINO7Delta(HarvesterObject harvester,byte state) {
|
||||
|
||||
Vector<ResourceContainerObject> outputHopperContent = harvester.getOutputHopperContent();
|
||||
int hopperContentSize = outputHopperContent.size();
|
||||
int iHopperList = 1;
|
||||
if (hopperContentSize==0) {
|
||||
iHopperList = 0;
|
||||
}
|
||||
//int sizeP = 30 + 15*hopperContentSize;
|
||||
int sizeP = 30-2-4-4;
|
||||
//System.out.println("sizeP " + sizeP);
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
buffer.putInt(sizeP);
|
||||
// dOut.writeInt(0x2D);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putShort((short)6);
|
||||
buffer.put(state);
|
||||
buffer.putShort((short)9);
|
||||
buffer.putFloat(harvester.getActualExtractionRate());
|
||||
buffer.putShort((short)0x0C);
|
||||
buffer.put(harvester.getUpdateCount());
|
||||
// buffer.putShort((short)0x0D);
|
||||
// buffer.putInt(iHopperList);
|
||||
// buffer.putInt(harvester.getResourceUpdateCount());
|
||||
int sumOfHopper = 0;
|
||||
int i = 0;
|
||||
sumOfHopper = 0;
|
||||
Vector<ResourceContainerObject> outputHopper = harvester.getOutputHopperContent();
|
||||
for (ResourceContainerObject cont : outputHopper){
|
||||
sumOfHopper += cont.getStackCount();
|
||||
i++;
|
||||
}
|
||||
|
||||
buffer.putShort((short)0x0A);
|
||||
buffer.putInt(sumOfHopper);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildHINO7Delta2(HarvesterObject harvester,byte state) {
|
||||
|
||||
Vector<ResourceContainerObject> outputHopperContent = harvester.getOutputHopperContent();
|
||||
int hopperContentSize = outputHopperContent.size();
|
||||
int iHopperList = 1;
|
||||
if (hopperContentSize==0) {
|
||||
iHopperList = 0;
|
||||
}
|
||||
int sizeP = 30 + 15*hopperContentSize;
|
||||
//System.out.println("sizeP " + sizeP);
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
buffer.putInt(sizeP);
|
||||
// dOut.writeInt(0x2D);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putShort((short)6);
|
||||
buffer.put(state);
|
||||
buffer.putShort((short)9);
|
||||
buffer.putFloat(harvester.getActualExtractionRate());
|
||||
buffer.putShort((short)0x0C);
|
||||
buffer.put(harvester.getUpdateCount());
|
||||
buffer.putShort((short)0x0D);
|
||||
buffer.putInt(iHopperList);
|
||||
buffer.putInt(harvester.getResourceUpdateCount());
|
||||
int sumOfHopper = 0;
|
||||
|
||||
byte i = 0;
|
||||
for (ResourceContainerObject container : outputHopperContent){
|
||||
buffer.putShort((short)harvester.getResourceUpdateCount());
|
||||
buffer.put(i);
|
||||
buffer.putLong(container.getReferenceID());
|
||||
buffer.putInt(container.getStackCount());
|
||||
sumOfHopper += container.getStackCount();
|
||||
i++;
|
||||
}
|
||||
|
||||
buffer.putShort((short)0x0A);
|
||||
buffer.putInt(sumOfHopper);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
// 2 + 2 + 1 + 2 + 4 + 2 + 1 + 2 + 4 + 4 + (hoppersize* 2+1+8+4=15) + 2 + 4
|
||||
|
||||
// 0000: 05 00 53 21 86 12 33 01 0E BE 41 00 00 00 4F 4E ..S!..3...A...ON
|
||||
// 0010: 49 48 07 2D 00 00 00 05 00 06 00 01 09 00 3F AE IH.-..........?.
|
||||
// 0020: 2D 42 0C 00 02 0D 00 01 00 00 00 01 00 00 00 02 -B..............
|
||||
// 0030: 00 00 5E C8 62 AB 41 00 00 00 CC F1 0A 40 0A 00 ..^.b.A......@..
|
||||
// 0040: CC F1 0A 40 ...@
|
||||
|
||||
public IoBuffer buildHINO7EmptyHopperDelta(HarvesterObject harvester) {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
buffer.putInt(21);
|
||||
buffer.putShort((short)3);
|
||||
buffer.putShort((short)0x0C);
|
||||
buffer.put((byte)harvester.getResourceUpdateCount());
|
||||
buffer.putShort((short)0x0D);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(harvester.getResourceUpdateCount());
|
||||
buffer.putShort((short)0x0A);
|
||||
buffer.putFloat(harvester.getOutputHopperContent().size());
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildHINO7ExperimentalDelta(HarvesterObject harvester) {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
buffer.putInt(0x18);
|
||||
buffer.putShort((short)3);
|
||||
buffer.putShort((short)0x0C);
|
||||
buffer.put((byte)harvester.getResourceUpdateCount());
|
||||
buffer.putShort((short)0x0D);
|
||||
buffer.putInt(1);
|
||||
buffer.putInt(0x1E);
|
||||
buffer.put((byte)0);
|
||||
buffer.putShort((short)0);
|
||||
buffer.putInt(harvester.getResourceUpdateCount());
|
||||
buffer.putShort((short)0x0A);
|
||||
buffer.putFloat(0); // since it's 0 outputhoppercontent
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
// 0000: 05 00 53 21 86 12 53 D0 AC 41 3F 00 00 00 4F 4E ..S!..S..A?...ON
|
||||
// 0010: 49 48 07 18 00 00 00 03 00 0C 00 25 0D 00 01 00 IH.........%....
|
||||
// 0020: 00 00 1E 00 00 00 00 00 00 0A 00 00 00 00 00 ...............
|
||||
|
||||
|
||||
public IoBuffer buildHINO7ExperimentalDelta2(HarvesterObject harvester) {
|
||||
|
||||
int iHopperList = 0;
|
||||
if (harvester.getOutputHopperContent().size() >= 1) {
|
||||
iHopperList = 1;
|
||||
}
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
|
||||
buffer.putInt(36);
|
||||
buffer.putShort((short)3);
|
||||
buffer.putShort((short)0x0C);
|
||||
buffer.put(harvester.getUpdateCount());
|
||||
buffer.putShort((short)0x0D);
|
||||
buffer.putInt(iHopperList);
|
||||
buffer.putInt(harvester.getResourceUpdateCount());
|
||||
int i = 0;
|
||||
int totalStackCount = 0;
|
||||
Vector<ResourceContainerObject> outputHopper = harvester.getOutputHopperContent();
|
||||
for (ResourceContainerObject cont : outputHopper){
|
||||
totalStackCount += cont.getStackCount();
|
||||
if (cont.getReferenceID() == harvester.getSelectedHarvestResource().getId()) {
|
||||
buffer.put((byte)2);
|
||||
buffer.putShort((short) i);
|
||||
buffer.putLong(cont.getReferenceID());
|
||||
buffer.putFloat((float)cont.getStackCount());
|
||||
//System.out.println("TOTAL STACKCOUNT " + (float)cont.getStackCount());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
buffer.putShort((short)0x0A);
|
||||
buffer.putFloat((float)totalStackCount);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildHINO7ActivateDelta(HarvesterObject harvester) {
|
||||
|
||||
int iHopperList = 0;
|
||||
if (harvester.getOutputHopperContent().size() >= 1) {
|
||||
iHopperList = 1;
|
||||
}
|
||||
int factor = 0;
|
||||
Vector<ResourceContainerObject> outputHopper = harvester.getOutputHopperContent();
|
||||
for (ResourceContainerObject cont : outputHopper){
|
||||
if (cont.getReferenceID() == harvester.getSelectedHarvestResource().getId()) {
|
||||
factor = 1;
|
||||
}
|
||||
}
|
||||
|
||||
byte iHopperUpdateCounter = harvester.getResourceUpdateCount();
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
buffer.putInt(5+19+(15*factor));
|
||||
buffer.putShort((short)5);
|
||||
buffer.putShort((short)6);
|
||||
buffer.put((byte)1);
|
||||
// 2 + 4 + 4 + 2 + 4 + (15*h) = 16 + 2 + 1 = 19
|
||||
buffer.putShort((short)0x0C);
|
||||
buffer.put(harvester.getUpdateCount());
|
||||
buffer.putShort((short)0x0D);
|
||||
buffer.putInt(iHopperList);
|
||||
buffer.putInt(iHopperUpdateCounter);
|
||||
int totalStackCount = 0;
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (ResourceContainerObject cont : outputHopper){
|
||||
totalStackCount += cont.getStackCount();
|
||||
if (cont.getReferenceID() == harvester.getSelectedHarvestResource().getId()) {
|
||||
buffer.put((byte)2);
|
||||
buffer.putShort((short) i);
|
||||
buffer.putLong(cont.getReferenceID());
|
||||
buffer.putFloat((float)cont.getStackCount());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
buffer.putShort((short)0x0A);
|
||||
buffer.putFloat((float)totalStackCount);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildHINO7ActivateDelta2(HarvesterObject harvester) {
|
||||
|
||||
int iHopperList = 0;
|
||||
if (harvester.getOutputHopperContent().size() >= 1) {
|
||||
iHopperList = 1;
|
||||
}
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
|
||||
buffer.putInt(11);
|
||||
buffer.putShort((short)2);
|
||||
buffer.putShort((short)6);
|
||||
buffer.put((byte)1);
|
||||
buffer.putShort((short)9);
|
||||
buffer.putFloat(harvester.getActualExtractionRate());
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
//
|
||||
// 02 00 06 00 01 09 00 43 94 IH............C.
|
||||
// 0020: 59 42 YB
|
||||
|
||||
public IoBuffer buildHINO7ActivateDelta2old(HarvesterObject harvester) {
|
||||
|
||||
int iHopperList = 0;
|
||||
if (harvester.getOutputHopperContent().size() >= 1) {
|
||||
iHopperList = 1;
|
||||
}
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
|
||||
buffer.putInt(5);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putShort((short)6);
|
||||
buffer.put((byte)1);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildHINO7DeactivateDelta(HarvesterObject harvester) {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
|
||||
buffer.putInt(14);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putShort((short)6);
|
||||
buffer.put((byte)0);
|
||||
buffer.putShort((short)9);
|
||||
buffer.putFloat(0);
|
||||
buffer.putShort((short)0xC);
|
||||
buffer.put((byte)5);
|
||||
|
||||
// new
|
||||
// buffer.putShort((short)6);
|
||||
// buffer.put((byte)0);
|
||||
// buffer.putShort((short)9);
|
||||
// buffer.put((byte)0);
|
||||
// buffer.putShort((short)0xC);
|
||||
// buffer.put((byte)5);
|
||||
|
||||
//
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildHINO7DeactivateDeltaold(HarvesterObject harvester) {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
|
||||
buffer.putInt(5);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putShort((short)6);
|
||||
buffer.put((byte)0);
|
||||
|
||||
// new
|
||||
buffer.putShort((short)6);
|
||||
buffer.put((byte)0);
|
||||
buffer.putShort((short)9);
|
||||
buffer.put((byte)0);
|
||||
buffer.putShort((short)0xC);
|
||||
buffer.put((byte)5);
|
||||
|
||||
//
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildHINO7ClearDelta(HarvesterObject harvester) {
|
||||
|
||||
int iHopperList = 0;
|
||||
if (harvester.getOutputHopperContent().size() >= 1) {
|
||||
iHopperList = 1;
|
||||
}
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x48494E4F);
|
||||
buffer.put((byte)7);
|
||||
|
||||
buffer.putInt(36);
|
||||
buffer.putShort((short)3);
|
||||
buffer.putShort((short)0x0C);
|
||||
buffer.put(harvester.getUpdateCount());
|
||||
buffer.putShort((short)0x0D);
|
||||
buffer.putInt(iHopperList);
|
||||
buffer.putInt(harvester.getResourceUpdateCount());
|
||||
buffer.put((byte)4);
|
||||
buffer.putShort((short)0x0A);
|
||||
buffer.putFloat((float)0.0F);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildDiscardResourceResponse(HarvesterObject harvester, byte actionMode, byte actionCounter,CreatureObject owner) {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x80CE5E46);
|
||||
buffer.putInt(0x0B);
|
||||
buffer.putInt(0xEE);
|
||||
buffer.putLong(owner.getObjectID());
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0xED);
|
||||
buffer.put((byte)1);
|
||||
buffer.put(actionCounter);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
//0000: 05 00 46 5E CE 80 0B 00 00 00 EE 00 00 00 62 5F ..F^..........b_
|
||||
//0010: 02 15 00 00 01 00 00 00 00 00 ED 00 00 00 01 01 ................
|
||||
// ^^ weird but works, should be zero allowed too
|
||||
|
||||
public IoBuffer buildBaseline8() {
|
||||
IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putShort((short) 0);
|
||||
int size = buffer.position();
|
||||
buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
|
||||
buffer.flip();
|
||||
buffer = createBaseline("TANO", (byte) 8, buffer, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildBaseline9() {
|
||||
IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putShort((short) 0);
|
||||
int size = buffer.position();
|
||||
buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
|
||||
buffer.flip();
|
||||
buffer = createBaseline("TANO", (byte) 9, buffer, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildHINOBaseline7(HarvesterObject harvester,Vector<GalacticResource> vSRD) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
int sizeP = 74;
|
||||
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x68A75F0C);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x4F4E4948);
|
||||
buffer.put((byte)7);
|
||||
|
||||
int iResourceCount = vSRD.size();
|
||||
Vector<ResourceContainerObject> outputHopperContent = harvester.getOutputHopperContent();
|
||||
int hopperContentSize = outputHopperContent.size();
|
||||
float outputHopperCount = 0;
|
||||
|
||||
//y = a + 4x + 16x + 12z = a + 20x + 12z
|
||||
sizeP += (iResourceCount * 4);
|
||||
sizeP += (iResourceCount * 16);
|
||||
|
||||
sizeP += (hopperContentSize * 12);
|
||||
|
||||
for (int i = 0; i < iResourceCount; i++) {
|
||||
sizeP += vSRD.get(i).getName().length();
|
||||
sizeP += vSRD.get(i).getFileName().length();
|
||||
}
|
||||
|
||||
buffer.putInt(sizeP);
|
||||
|
||||
for (ResourceContainerObject container : outputHopperContent){
|
||||
outputHopperCount += container.getStackCount();
|
||||
}
|
||||
|
||||
buffer.putShort((short)0x0F);
|
||||
buffer.put((byte)1);
|
||||
buffer.putInt(iResourceCount);
|
||||
buffer.putInt(iResourceCount);
|
||||
|
||||
for (int i = 0; i < iResourceCount; i++) {
|
||||
buffer.putLong(vSRD.get(i).getId());
|
||||
}
|
||||
buffer.putInt(iResourceCount);
|
||||
|
||||
buffer.putInt(iResourceCount);
|
||||
|
||||
for (int i = 0; i < iResourceCount; i++) {
|
||||
buffer.putLong(vSRD.get(i).getId());
|
||||
}
|
||||
|
||||
buffer.putInt(iResourceCount);
|
||||
|
||||
buffer.putInt(iResourceCount);
|
||||
|
||||
for (int i = 0; i < iResourceCount; i++) {
|
||||
buffer.put(getAsciiString(vSRD.get(i).getName()));
|
||||
}
|
||||
|
||||
buffer.putInt(iResourceCount);
|
||||
buffer.putInt(iResourceCount);
|
||||
for (int i = 0; i < iResourceCount; i++) {
|
||||
buffer.put(getAsciiString(vSRD.get(i).getFileName()));
|
||||
|
||||
}
|
||||
|
||||
if (harvester.getSelectedHarvestResource() != null) {
|
||||
buffer.putLong(harvester.getSelectedHarvestResource().getId());
|
||||
} else {
|
||||
buffer.putLong(0);
|
||||
}
|
||||
|
||||
buffer.put(harvester.isActivated() ? (byte)1 : (byte)0);
|
||||
|
||||
buffer.putInt(harvester.getSpecRate()); // SPEC RATE buffer.putInt(harvester.getBER());
|
||||
|
||||
buffer.putFloat(harvester.getBER());
|
||||
|
||||
buffer.putFloat(harvester.getActualExtractionRate());
|
||||
buffer.putFloat(outputHopperCount);
|
||||
buffer.putInt(harvester.getOutputHopperCapacity());
|
||||
buffer.put(harvester.getUpdateCount());
|
||||
buffer.putInt(hopperContentSize);
|
||||
buffer.putInt(0);
|
||||
for (ResourceContainerObject container : outputHopperContent){
|
||||
buffer.putLong(container.getReferenceID());
|
||||
buffer.putFloat(container.getStackCount());
|
||||
}
|
||||
buffer.put(harvester.getStructuralCondition());
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildCustomNameDelta(HarvesterObject harvester, String customName) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
int sizeP = 8;
|
||||
sizeP += 2*customName.length();
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
buffer.putInt(0x54414E4F);
|
||||
buffer.put((byte)3);
|
||||
buffer.putInt(sizeP);
|
||||
buffer.putShort((short)1);
|
||||
buffer.putShort((short)2);
|
||||
buffer.put(getUnicodeString(customName));
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildPermissionListCreate(HarvesterObject harvester, Vector<String> permissionList, String listName) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
int listSize = permissionList.size();
|
||||
buffer.putShort((short)4);
|
||||
buffer.putInt(0x52F364B8);
|
||||
buffer.putInt(listSize);
|
||||
for (String name : permissionList){
|
||||
buffer.put(getUnicodeString(name));
|
||||
}
|
||||
//buffer.putInt(0x61);
|
||||
buffer.putInt(0);
|
||||
//buffer.putShort((short)0);
|
||||
buffer.put(getUnicodeString(listName));
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
/*
|
||||
0000: 04 00 B8 64 F3 52 01 00 00 00 06 00 00 00 63 00 ...d.R........c.
|
||||
0010: 68 00 61 00 72 00 6F 00 6E 00 00 00 00 00 05 00 h.a.r.o.n.......
|
||||
0020: 00 00 41 00 44 00 4D 00 49 00 4E 00 ..A.D.M.I.N.
|
||||
*/
|
||||
|
||||
// Send this in response to the Radial Menu to manage harvesters,
|
||||
// it is necessary to send this *before* the 07 Baseline!
|
||||
//ResourceHarvesterActivatePageMessage (BD18C679)
|
||||
public IoBuffer buildResourceHarvesterActivatePageMessage(HarvesterObject harvester) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)2);
|
||||
buffer.putInt(0xBD18C679);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildHarvesterGetResourceData(HarvesterObject harvester,SWGObject owner,Vector<GalacticResource> planetResources) {
|
||||
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x80CE5E46);
|
||||
buffer.putInt(0x0B);
|
||||
buffer.putInt(0x000000EA);
|
||||
buffer.putLong(owner.getObjectID());
|
||||
buffer.putInt(0);
|
||||
buffer.putLong(harvester.getObjectID());
|
||||
if (planetResources == null || planetResources.isEmpty()) {
|
||||
buffer.putInt(0);
|
||||
} else {
|
||||
buffer.putInt(planetResources.size());
|
||||
for (int i = 0; i < planetResources.size(); i++) {
|
||||
float localConcentration = planetResources.get(i).deliverConcentrationForSurvey(owner.getPlanetId(), owner.getPosition().x, owner.getPosition().z);
|
||||
buffer.putLong(planetResources.get(i).getId());
|
||||
buffer.put(getAsciiString(planetResources.get(i).getName()));
|
||||
buffer.put(getAsciiString(planetResources.get(i).getFileName()));
|
||||
buffer.put((byte)localConcentration);
|
||||
}
|
||||
}
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,501 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.harvester;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.SceneCreateObjectByCrc;
|
||||
import protocol.swg.SceneDestroyObject;
|
||||
import protocol.swg.SceneEndBaselines;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import services.chat.WaypointAttachment;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.installation.InstallationMessageBuilder;
|
||||
import resources.objects.installation.InstallationObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.resource.GalacticResource;
|
||||
import resources.objects.resource.ResourceContainerObject;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
import services.chat.Mail;
|
||||
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
@Persistent(version=0)
|
||||
public class HarvesterObject extends InstallationObject {
|
||||
|
||||
private HarvesterMessageBuilder messageBuilder;
|
||||
private InstallationMessageBuilder installationMessageBuilder;
|
||||
|
||||
public final static byte HARVESTER_TYPE_MINERAL = 0;
|
||||
public final static byte HARVESTER_TYPE_CHEMICAL = 1;
|
||||
public final static byte HARVESTER_TYPE_FLORA = 2;
|
||||
public final static byte HARVESTER_TYPE_GAS = 3;
|
||||
public final static byte HARVESTER_TYPE_WATER = 4;
|
||||
public final static byte HARVESTER_TYPE_SOLAR = 5;
|
||||
public final static byte HARVESTER_TYPE_WIND = 6;
|
||||
public final static byte HARVESTER_TYPE_FUSION = 7;
|
||||
public final static byte HARVESTER_TYPE_GEO = 8;
|
||||
|
||||
public String[] mineral_type_iff = new String[]{"object/installation/mining_ore/shared_mining_ore_harvester_style_1.iff",
|
||||
"object/installation/mining_ore/shared_mining_ore_harvester_style_2.iff",
|
||||
"object/installation/mining_ore/shared_mining_ore_harvester_heavy.iff",
|
||||
"object/installation/mining_ore/shared_mining_ore_harvester_elite.iff"};
|
||||
|
||||
public String[] chemical_type_iff = new String[]{"object/installation/mining_liquid/shared_mining_liquid_harvester_style_1.iff",
|
||||
"object/installation/mining_liquid/shared_mining_liquid_harvester_style_2.iff",
|
||||
"object/installation/mining_liquid/shared_mining_liquid_harvester_style_3.iff",
|
||||
"object/installation/mining_liquid/shared_mining_liquid_harvester_style_4.iff"};
|
||||
|
||||
public String[] flora_type_iff = new String[]{"object/installation/mining_organic/shared_mining_organic_flora_farm.iff",
|
||||
"object/installation/mining_organic/shared_mining_organic_flora_farm_medium.iff",
|
||||
"object/installation/mining_organic/shared_mining_organic_flora_farm_heavy.iff",
|
||||
"object/installation/mining_organic/shared_mining_organic_flora_farm_elite.iff"};
|
||||
|
||||
public String[] water_type_iff = new String[]{"object/installation/mining_liquid/shared_mining_liquid_moisture_harvester.iff",
|
||||
"object/installation/mining_liquid/shared_mining_liquid_moisture_harvester_medium.iff",
|
||||
"object/installation/mining_liquid/shared_mining_liquid_moisture_harvester_heavy.iff",
|
||||
"object/installation/mining_liquid/shared_mining_liquid_moisture_harvester_elite.iff"};
|
||||
|
||||
public String[] gas_type_iff = new String[]{"object/installation/mining_gas/shared_mining_gas_harvester_style_1.iff",
|
||||
"object/installation/mining_gas/shared_mining_gas_harvester_style_2.iff",
|
||||
"object/installation/mining_gas/shared_mining_gas_harvester_style_3.iff",
|
||||
"object/installation/mining_gas/shared_mining_gas_harvester_style_4.iff"};
|
||||
|
||||
public String[] wind_type_iff = new String[]{"object/installation/generators/shared_power_generator_wind_style_1.iff"};
|
||||
|
||||
public String[] solar_type_iff = new String[]{"object/installation/generators/shared_power_generator_solar_style_1.iff"};
|
||||
|
||||
public String[] fusion_type_iff = new String[]{"object/installation/generators/shared_power_generator_fusion_style_1.iff"};
|
||||
|
||||
public String[] geo_type_iff = new String[]{"object/installation/generators/shared_power_generator_geothermal_style_1.iff"};
|
||||
|
||||
//for nothing "object/installation/generators/shared_power_generator_photo_bio_style_1.iff"
|
||||
|
||||
|
||||
public byte harvester_type = 0;
|
||||
public byte harvester_size = 0;
|
||||
private Vector<ResourceContainerObject> outputHopperContent = new Vector<ResourceContainerObject>();
|
||||
private int outputHopperCapacity = 0;
|
||||
private int BER = 0;
|
||||
private float maintenanceAmount = 0;
|
||||
private float powerLevel = 0;
|
||||
private int powerCost = 0;
|
||||
private int maintenanceCost = 0;
|
||||
private byte structuralCondition = 100;
|
||||
private boolean activated = false;
|
||||
private boolean generator = false;
|
||||
private GalacticResource selectedHarvestResource;
|
||||
private float selectedResourceConcentration;
|
||||
private byte updateCount;
|
||||
private byte resourceUpdateCount;
|
||||
private Vector<String> adminList = new Vector<String>();
|
||||
private Vector<String> hopperList = new Vector<String>();
|
||||
private SWGObject owner;
|
||||
private float currentHarvestedCountFloat=0.0F;
|
||||
private String deedTemplate;
|
||||
|
||||
private int specRate;
|
||||
|
||||
|
||||
public HarvesterObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
|
||||
super(objectID, planet, template, position, orientation);
|
||||
this.setConditionDamage(100);
|
||||
messageBuilder = new HarvesterMessageBuilder(this);
|
||||
installationMessageBuilder = new InstallationMessageBuilder((InstallationObject)this);
|
||||
}
|
||||
|
||||
public int getBER() {
|
||||
return BER;
|
||||
}
|
||||
|
||||
|
||||
public void setBER(int baseExtractionRate) {
|
||||
this.BER = baseExtractionRate;
|
||||
}
|
||||
|
||||
|
||||
public float getActualExtractionRate() {
|
||||
//float resourceDraw = (getBER() * getSelectedResourceConcentration()) / 400; // /100
|
||||
float resourceDraw = 1.5F*(getBER() * getSelectedResourceConcentration()) / 100;
|
||||
// BER * concentration * publish 27 bonus * profession buffs = AER
|
||||
// 14* 0.83 * 1.5 * 1.05 = 18.3015 AER
|
||||
return resourceDraw;
|
||||
}
|
||||
|
||||
public int getSpecRate() {
|
||||
return specRate;
|
||||
}
|
||||
|
||||
public void setSpecRate(int specRate) {
|
||||
this.specRate = specRate;
|
||||
}
|
||||
|
||||
|
||||
public GalacticResource getSelectedHarvestResource() {
|
||||
return selectedHarvestResource;
|
||||
}
|
||||
|
||||
|
||||
public void setSelectedHarvestResource(GalacticResource selectedHarvestResource,CreatureObject owner) {
|
||||
this.selectedHarvestResource = selectedHarvestResource;
|
||||
setSelectedResourceConcentration(selectedHarvestResource.deliverConcentrationForSurvey(this.getPlanetId(), this.getPosition().x, this.getPosition().z));
|
||||
|
||||
owner.getClient().getSession().write(installationMessageBuilder.constructINSO7Var1((InstallationObject) this,selectedHarvestResource.getObjectId()));
|
||||
owner.getClient().getSession().write(installationMessageBuilder.constructINSO7Var2((InstallationObject) this,selectedHarvestResource.getObjectId()));
|
||||
}
|
||||
|
||||
|
||||
public float getSelectedResourceConcentration() {
|
||||
return selectedResourceConcentration;
|
||||
}
|
||||
|
||||
|
||||
private void setSelectedResourceConcentration(float selectedResourceConcentration) {
|
||||
this.selectedResourceConcentration = selectedResourceConcentration;
|
||||
}
|
||||
|
||||
|
||||
public void activateHarvester(CreatureObject owner){
|
||||
activated = true;
|
||||
this.setOwner(owner);
|
||||
owner.getClient().getSession().write(messageBuilder.buildHINO3Delta(this,(byte)1));
|
||||
owner.getClient().getSession().write(messageBuilder.buildHINO7ActivateDelta2(this));
|
||||
}
|
||||
|
||||
|
||||
public void deactivateHarvester(CreatureObject owner){
|
||||
activated = false;
|
||||
owner.getClient().getSession().write(messageBuilder.buildHINO3Delta2(this,(byte)0));
|
||||
owner.getClient().getSession().write(messageBuilder.buildHINO7DeactivateDelta(this));
|
||||
}
|
||||
|
||||
|
||||
public boolean isActivated(){
|
||||
return this.activated;
|
||||
}
|
||||
|
||||
|
||||
public byte getHarvester_type() {
|
||||
return harvester_type;
|
||||
}
|
||||
|
||||
|
||||
public void setHarvester_type(byte harvester_type) {
|
||||
this.harvester_type = harvester_type;
|
||||
}
|
||||
|
||||
|
||||
public Vector<ResourceContainerObject> getOutputHopperContent() {
|
||||
return outputHopperContent;
|
||||
}
|
||||
|
||||
|
||||
public void setOutputHopperContent(Vector<ResourceContainerObject> outputHopperContent) {
|
||||
this.outputHopperContent = outputHopperContent;
|
||||
}
|
||||
|
||||
|
||||
public byte getStructuralCondition() {
|
||||
return structuralCondition;
|
||||
}
|
||||
|
||||
|
||||
public void setStructuralCondition(byte structuralCondition) {
|
||||
this.structuralCondition = structuralCondition;
|
||||
}
|
||||
|
||||
|
||||
public int getOutputHopperCapacity() {
|
||||
return outputHopperCapacity;
|
||||
}
|
||||
|
||||
|
||||
public void setOutputHopperCapacity(int outputHopperCapacity) {
|
||||
this.outputHopperCapacity = outputHopperCapacity;
|
||||
}
|
||||
|
||||
|
||||
public byte getUpdateCount() {
|
||||
if (updateCount>254) updateCount = 0;
|
||||
return updateCount++;
|
||||
}
|
||||
|
||||
public byte getResourceUpdateCount() {
|
||||
if (resourceUpdateCount>254) resourceUpdateCount = 0;
|
||||
return resourceUpdateCount++;
|
||||
}
|
||||
|
||||
|
||||
public void setUpdateCount(byte updateCount) {
|
||||
this.updateCount = updateCount;
|
||||
}
|
||||
|
||||
|
||||
public Vector<String> getAdminList() {
|
||||
return adminList;
|
||||
}
|
||||
|
||||
|
||||
public void setAdminList(Vector<String> adminList) {
|
||||
this.adminList = adminList;
|
||||
}
|
||||
|
||||
|
||||
public Vector<String> getHopperList() {
|
||||
return hopperList;
|
||||
}
|
||||
|
||||
|
||||
public void setHopperList(Vector<String> hopperList) {
|
||||
this.hopperList = hopperList;
|
||||
}
|
||||
|
||||
|
||||
public float getPowerLevel() {
|
||||
return powerLevel;
|
||||
}
|
||||
|
||||
|
||||
public void setPowerLevel(float energyLevel) {
|
||||
this.powerLevel = energyLevel;
|
||||
}
|
||||
|
||||
|
||||
public float getMaintenanceAmount() {
|
||||
return maintenanceAmount;
|
||||
}
|
||||
|
||||
|
||||
public void setMaintenanceAmount(float maintenanceAmount) {
|
||||
this.maintenanceAmount = maintenanceAmount;
|
||||
}
|
||||
|
||||
public int getPowerCost() {
|
||||
return powerCost;
|
||||
}
|
||||
|
||||
|
||||
public void setPowerCost(int powerCost) {
|
||||
this.powerCost = powerCost;
|
||||
}
|
||||
|
||||
|
||||
public int getMaintenanceCost() {
|
||||
return maintenanceCost;
|
||||
}
|
||||
|
||||
|
||||
public void setMaintenanceCost(int maintenanceCost) {
|
||||
this.maintenanceCost = maintenanceCost;
|
||||
}
|
||||
|
||||
|
||||
public float getCurrentHarvestedCountFloat() {
|
||||
return currentHarvestedCountFloat;
|
||||
}
|
||||
|
||||
|
||||
public void setCurrentHarvestedCountFloat(float currentHarvestedCountFloat) {
|
||||
this.currentHarvestedCountFloat = currentHarvestedCountFloat;
|
||||
}
|
||||
|
||||
|
||||
public SWGObject getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
||||
public void setOwner(SWGObject owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public void setDeedTemplate(String deedTemplate){
|
||||
this.deedTemplate = deedTemplate;
|
||||
}
|
||||
|
||||
public String getDeedTemplate(){
|
||||
return this.deedTemplate;
|
||||
}
|
||||
|
||||
|
||||
public boolean isGenerator() {
|
||||
return generator;
|
||||
}
|
||||
|
||||
public void setGenerator(boolean generator) {
|
||||
this.generator = generator;
|
||||
}
|
||||
|
||||
|
||||
public void setHarvesterName(String name,CreatureObject owner){
|
||||
owner.getClient().getSession().write(messageBuilder.buildCustomNameDelta(this,name));
|
||||
this.setCustomName(name);
|
||||
((CreatureObject)owner).sendSystemMessage("Structure renamed.", (byte) 0);
|
||||
}
|
||||
|
||||
public void setPermissionAdmin(String name,CreatureObject owner){
|
||||
Vector<String> permissionList = this.getAdminList();
|
||||
owner.getClient().getSession().write(messageBuilder.buildPermissionListCreate(this, permissionList, name));
|
||||
}
|
||||
|
||||
public void setPermissionHopper(String name,CreatureObject owner){
|
||||
Vector<String> permissionList = this.getAdminList();
|
||||
owner.getClient().getSession().write(messageBuilder.buildPermissionListCreate(this, permissionList, name));
|
||||
}
|
||||
|
||||
public void operateMachinery(CreatureObject owner){
|
||||
owner.getClient().getSession().write(messageBuilder.buildResourceHarvesterActivatePageMessage(this));
|
||||
// Assemble resources at that spot
|
||||
// For later, it might be needed to also pass the template to differentiate liquid resources
|
||||
Vector<GalacticResource> planetResourcesVector = NGECore.getInstance().resourceService.getSpawnedResourcesByPlanetAndHarvesterType(this.getPlanetId(),this.getHarvester_type());
|
||||
owner.getClient().getSession().write(messageBuilder.buildHarvesterGetResourceData(this, owner, planetResourcesVector));
|
||||
owner.getClient().getSession().write(messageBuilder.buildHINOBaseline7(this, planetResourcesVector));
|
||||
}
|
||||
|
||||
public void deActivate(){
|
||||
owner.getClient().getSession().write(messageBuilder.buildResourceHarvesterActivatePageMessage(this));
|
||||
}
|
||||
|
||||
public void placeHarvester(){
|
||||
owner.getClient().getSession().write(messageBuilder.buildResourceHarvesterActivatePageMessage(this));
|
||||
}
|
||||
|
||||
public static void createAndPlaceHarvester(SWGObject object){
|
||||
CreatureObject actor = (CreatureObject) object.getAttachment("Owner");
|
||||
|
||||
String structureTemplate = (String)object.getAttachment("Deed_StructureTemplate");
|
||||
HarvesterObject harvester = (HarvesterObject) NGECore.getInstance().objectService.createObject(structureTemplate, actor.getPlanet());
|
||||
long objectId = harvester.getObjectID();
|
||||
|
||||
Vector<String> adminList = harvester.getAdminList();
|
||||
String[] fullName = ((CreatureObject)actor).getCustomName().split(" ");
|
||||
adminList.add(fullName[0]);
|
||||
harvester.setAdminList(adminList);
|
||||
// Set BER and outputhopper capacity here, take it from deed
|
||||
harvester.setBER((int)object.getAttachment("Deed_BER"));
|
||||
harvester.setSpecRate((int)(1.5F*(int)object.getAttachment("Deed_BER")));
|
||||
harvester.setOutputHopperCapacity((int)object.getAttachment("Deed_Capacity"));
|
||||
harvester.setDeedTemplate((String)object.getAttachment("Deed_DeedTemplate"));
|
||||
if ((int)object.getAttachment("Deed_SurplusMaintenance")>0){
|
||||
harvester.setMaintenanceAmount((int)object.getAttachment("Deed_SurplusMaintenance"));
|
||||
}
|
||||
if ((int)object.getAttachment("Deed_SurplusPower")>0){
|
||||
harvester.setPowerLevel((int)object.getAttachment("Deed_SurplusPower"));
|
||||
}
|
||||
|
||||
|
||||
// build harvester
|
||||
int resCRC = CRC.StringtoCRC(structureTemplate);
|
||||
float positionY = NGECore.getInstance().terrainService.getHeight(actor.getPlanetId(), object.getPosition().x, object.getPosition().z);
|
||||
SceneCreateObjectByCrc createObjectMsg = new SceneCreateObjectByCrc(objectId, object.getOrientation().x, object.getOrientation().y, object.getOrientation().z, object.getOrientation().w, object.getPosition().x, positionY, object.getPosition().z, resCRC, (byte) 0);
|
||||
actor.getClient().getSession().write(createObjectMsg.serialize());
|
||||
tools.CharonPacketUtils.printAnalysis(createObjectMsg.serialize());
|
||||
|
||||
harvester.setPosition(new Point3D(object.getPosition().x,positionY, object.getPosition().z));
|
||||
|
||||
resources.objects.installation.InstallationMessageBuilder messenger = new resources.objects.installation.InstallationMessageBuilder((InstallationObject)harvester);
|
||||
actor.getClient().getSession().write(messenger.buildBaseline3((InstallationObject)harvester));
|
||||
SceneEndBaselines sceneEndBaselinesMsg = new SceneEndBaselines(harvester.getObjectID());
|
||||
actor.getClient().getSession().write(sceneEndBaselinesMsg.serialize());
|
||||
tools.CharonPacketUtils.printAnalysis(sceneEndBaselinesMsg.serialize());
|
||||
|
||||
PlayerObject player = (PlayerObject) actor.getSlottedObject("ghost");
|
||||
WaypointObject constructionWaypoint = (WaypointObject)NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", actor.getPlanet(), harvester.getPosition().x, 0 ,harvester.getPosition().z);
|
||||
String displayname = "@installation_n:"+harvester.getStfName();
|
||||
constructionWaypoint.setName(displayname);
|
||||
constructionWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
constructionWaypoint.setPosition(new Point3D(object.getPosition().x,0, object.getPosition().z));
|
||||
player.waypointAdd(constructionWaypoint);
|
||||
constructionWaypoint.setPosition(new Point3D(object.getPosition().x,0, object.getPosition().z));
|
||||
constructionWaypoint.setActive(true);
|
||||
constructionWaypoint.setColor((byte)1);
|
||||
constructionWaypoint.setStringAttribute("", "");
|
||||
player.waypointAdd(constructionWaypoint);
|
||||
constructionWaypoint.setName(displayname);
|
||||
constructionWaypoint.setPlanetCRC(engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName()));
|
||||
player.setLastSurveyWaypoint(constructionWaypoint);
|
||||
|
||||
List<WaypointAttachment> attachments = new ArrayList<WaypointAttachment>();
|
||||
WaypointAttachment attachment = new WaypointAttachment();
|
||||
attachment.active = true;
|
||||
attachment.cellID = constructionWaypoint.getCellId();
|
||||
attachment.color = (byte)1;
|
||||
attachment.name = displayname;
|
||||
attachment.planetCRC = engine.resources.common.CRC.StringtoCRC(actor.getPlanet().getName());
|
||||
attachment.positionX = object.getPosition().x;
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = object.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
|
||||
// remove constructor
|
||||
NGECore.getInstance().objectService.destroyObject(object);
|
||||
SceneDestroyObject destroyObjectMsg = new SceneDestroyObject(object.getObjectID());
|
||||
actor.getClient().getSession().write(destroyObjectMsg.serialize());
|
||||
|
||||
// ToDo: waypoint attachment fix
|
||||
Date date = new Date();
|
||||
Mail constructionNotificationMail = new Mail();
|
||||
constructionNotificationMail.setSenderName("Structure Service");
|
||||
constructionNotificationMail.setSubject("Your structure");
|
||||
constructionNotificationMail.setRecieverId(actor.getObjectID());
|
||||
constructionNotificationMail.setTimeStamp((int) (date.getTime() / 1000));
|
||||
constructionNotificationMail.setMailId(NGECore.getInstance().chatService.generateMailId());
|
||||
String message = "Your construction is ready";
|
||||
constructionNotificationMail.setMessage(message);
|
||||
constructionNotificationMail.setStatus(Mail.NEW);
|
||||
constructionNotificationMail.setAttachments(attachments);
|
||||
//NGECore.getInstance().chatService.sendPersistentMessage(actor.getClient(), constructionNotificationMail);
|
||||
NGECore.getInstance().chatService.storePersistentMessage(constructionNotificationMail);
|
||||
NGECore.getInstance().chatService.sendPersistentMessageHeader(actor.getClient(), constructionNotificationMail);
|
||||
|
||||
}
|
||||
|
||||
public void createNewHopperContainer(){
|
||||
Vector<GalacticResource> planetResourcesVector = NGECore.getInstance().resourceService.getSpawnedResourcesByPlanetAndHarvesterType(this.getPlanetId(),this.getHarvester_type());
|
||||
((CreatureObject)this.getOwner()).getClient().getSession().write(messageBuilder.buildHINOBaseline7(this, planetResourcesVector));
|
||||
((CreatureObject)this.getOwner()).getClient().getSession().write(messageBuilder.buildHINO7Delta(this,(byte)1));
|
||||
}
|
||||
|
||||
public void continueHopperContainer(){
|
||||
Vector<GalacticResource> planetResourcesVector = NGECore.getInstance().resourceService.getSpawnedResourcesByPlanetAndHarvesterType(this.getPlanetId(),this.getHarvester_type());
|
||||
((CreatureObject)this.getOwner()).getClient().getSession().write(messageBuilder.buildHarvesterGetResourceData(this, owner, planetResourcesVector));
|
||||
((CreatureObject)this.getOwner()).getClient().getSession().write(messageBuilder.buildHINOBaseline7(this, planetResourcesVector));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
|
||||
if(destination == null || destination.getSession() == null) {
|
||||
System.out.println("NULL destination");
|
||||
return;
|
||||
}
|
||||
|
||||
destination.getSession().write(messageBuilder.buildBaseline3());
|
||||
destination.getSession().write(messageBuilder.buildBaseline6());
|
||||
destination.getSession().write(messageBuilder.buildBaseline8());
|
||||
destination.getSession().write(messageBuilder.buildBaseline9());
|
||||
|
||||
if(getPvPBitmask() != 0) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral);
|
||||
upvpm.setStatus(getPvPBitmask());
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,205 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.installation;
|
||||
|
||||
public class InstallationMessageBuilder {
|
||||
import java.nio.ByteOrder;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.harvester.HarvesterObject;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
public class InstallationMessageBuilder extends ObjectMessageBuilder{
|
||||
|
||||
public InstallationMessageBuilder(InstallationObject installationObject) {
|
||||
setObject(installationObject);
|
||||
}
|
||||
|
||||
public IoBuffer buildBaseline3(InstallationObject installationObject) {
|
||||
IoBuffer buffer = bufferPool.allocate(10, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
int packSize = 66;
|
||||
packSize += installationObject.getStfName().length();
|
||||
packSize += installationObject.getStfFilename().length();
|
||||
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x68A75F0C);
|
||||
buffer.putLong(installationObject.getObjectID());
|
||||
buffer.putInt(0x494E534F);
|
||||
buffer.put((byte)3);
|
||||
buffer.putInt(packSize);
|
||||
buffer.putShort((short) 0x05);
|
||||
buffer.putFloat(installationObject.getComplexity());
|
||||
buffer.put(getAsciiString(installationObject.getStfFilename())); // installation_n
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString(installationObject.getStfName()));
|
||||
buffer.put(getUnicodeString(""));//buffer.put(getUnicodeString(installationObject.getCustomName()));
|
||||
buffer.putInt(1);// int 1 // oper 3
|
||||
buffer.putShort((short)0);
|
||||
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putLong(0);
|
||||
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.put((byte)1);
|
||||
buffer.put((byte)0);
|
||||
buffer.putFloat(0.0F);
|
||||
buffer.putFloat(0.0F);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
// 0000: 05 00 0C 5F A7 68 82 EC 7D 16 00 00 02 00 4F 53 ..._.h..}.....OS
|
||||
// 0010: 4E 49 06 0E 00 00 00 05 00 76 00 00 00 00 00 00 NI.......v......
|
||||
// 0020: 00 01 00 00 00 .....
|
||||
|
||||
public IoBuffer buildBaseline6(InstallationObject installationObject) {
|
||||
IoBuffer buffer = bufferPool.allocate(10, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
int packSize = 14;
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x68A75F0C);
|
||||
buffer.putLong(installationObject.getObjectID());
|
||||
buffer.putInt(0x494E534F);
|
||||
buffer.put((byte)6);
|
||||
buffer.putInt(packSize);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x76);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(1);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildBaseline7() {
|
||||
IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putShort((short) 0);
|
||||
int size = buffer.position();
|
||||
buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
|
||||
buffer.flip();
|
||||
buffer = createBaseline("INSO", (byte) 7, buffer, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildBaseline8() {
|
||||
IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putShort((short) 0);
|
||||
int size = buffer.position();
|
||||
buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
|
||||
buffer.flip();
|
||||
buffer = createBaseline("INSO", (byte) 8, buffer, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildBaseline9() {
|
||||
IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putShort((short) 0);
|
||||
int size = buffer.position();
|
||||
buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
|
||||
buffer.flip();
|
||||
buffer = createBaseline("INSO", (byte) 9, buffer, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildDelta3(InstallationObject installationObject,IoBuffer packet,int packSize) {
|
||||
IoBuffer buffer = bufferPool.allocate(10, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(installationObject.getObjectID());
|
||||
buffer.putInt(0x494E534F);
|
||||
buffer.put((byte)3);
|
||||
buffer.putInt(packSize);
|
||||
buffer.put(packet);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer buildDelta7(InstallationObject installationObject,IoBuffer packet,int packSize) {
|
||||
IoBuffer buffer = bufferPool.allocate(10, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)5);
|
||||
buffer.putInt(0x12862153);
|
||||
buffer.putLong(installationObject.getObjectID());
|
||||
buffer.putInt(0x494E534F);
|
||||
buffer.put((byte)7);
|
||||
buffer.putInt(packSize);
|
||||
buffer.put(packet);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
tools.CharonPacketUtils.printAnalysis(IoBuffer.allocate(size).put(buffer.array(), 0, size).flip());
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
public IoBuffer constructINSO7Var1(InstallationObject installationObject,long selectedResource) {
|
||||
IoBuffer buffer = bufferPool.allocate(10, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
int hopperContentsSize = ((HarvesterObject)installationObject).getOutputHopperContent().size()+1;
|
||||
byte updateCounter = ((HarvesterObject)installationObject).getUpdateCount();
|
||||
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)2); // buffer.putShort((short)updateCounter);
|
||||
buffer.putShort((short)0xC);
|
||||
buffer.put((byte)1);
|
||||
buffer.putShort((short)0xD);
|
||||
|
||||
buffer.putInt(1);//buffer.putInt(hopperContentsSize); // works once with 1! HopperContentsSize->Number of resources in hopper
|
||||
buffer.putInt(2); // UpdateCounter works once with 2!
|
||||
buffer.put((byte)1); // subtype : ADD
|
||||
buffer.putShort((short)0); // index was 0 buffer.putShort((short)(hopperContentsSize-1));
|
||||
buffer.putLong(selectedResource);
|
||||
buffer.putFloat(0);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
return buildDelta7(installationObject,IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(),size);
|
||||
}
|
||||
|
||||
// 0000: 05 00 53 21 86 12 82 EC 7D 16 00 00 02 00 4F 53 ..S!....}.....OS
|
||||
// 0010: 4E 49 07 1E 00 00 00 02 00 0C 00 01 0D 00 01 00 NI..............
|
||||
// 0020: 00 00 02 00 00 00 01 00 00 8A D3 79 16 00 00 0F ...........y....
|
||||
// 0030: 00 00 00 00 00 .....
|
||||
|
||||
public IoBuffer constructINSO7Var2(InstallationObject installationObject,long selectedResource) {
|
||||
IoBuffer buffer = bufferPool.allocate(10, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short)2);
|
||||
buffer.putShort((short)0x9);
|
||||
buffer.putFloat(0);
|
||||
buffer.putShort((short)0x5);
|
||||
buffer.putLong(selectedResource);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
return buildDelta7(installationObject,IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(),size);
|
||||
}
|
||||
|
||||
// 0000: 05 00 53 21 86 12 82 EC 7D 16 00 00 02 00 4F 53 ..S!....}.....OS
|
||||
// 0010: 4E 49 07 12 00 00 00 02 00 09 00 00 00 00 00 05 NI..............
|
||||
// 0020: 00 8A D3 79 16 00 00 0F 00 ...y.....
|
||||
|
||||
@Override
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,16 @@ package resources.objects.installation;
|
||||
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
@Persistent(version=0)
|
||||
public class InstallationObject extends TangibleObject {
|
||||
|
||||
}
|
||||
|
||||
public InstallationObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
|
||||
super(objectID, planet, template, position, orientation);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* 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.objects.loot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LootDrop {
|
||||
|
||||
private List<String> elements = new ArrayList<String>();
|
||||
private String droppedItemTemplate;
|
||||
|
||||
public LootDrop(){
|
||||
|
||||
}
|
||||
|
||||
public void addElement(String element){
|
||||
elements.add(element);
|
||||
}
|
||||
|
||||
public List<String> getElements(){
|
||||
return elements;
|
||||
}
|
||||
|
||||
public String getDroppedItemTemplate() {
|
||||
return droppedItemTemplate;
|
||||
}
|
||||
|
||||
public void setDroppedItemTemplate(String droppedItemTemplate) {
|
||||
this.droppedItemTemplate = droppedItemTemplate;
|
||||
}
|
||||
}
|
||||
@@ -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 resources.objects.loot;
|
||||
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
@Persistent(version=0)
|
||||
public class LootGroup {
|
||||
|
||||
private String[] lootPoolNames;
|
||||
private int[] lootPoolChances;
|
||||
private int lootGroupChance;
|
||||
|
||||
public LootGroup(){
|
||||
|
||||
}
|
||||
|
||||
public LootGroup(String[] lootPoolNames, int[] lootPoolChances, int lootGroupChance){
|
||||
this.lootPoolNames = lootPoolNames;
|
||||
this.lootPoolChances = lootPoolChances;
|
||||
this.lootGroupChance = lootGroupChance;
|
||||
}
|
||||
|
||||
public void addLootData(String[] lootPoolNames, int[] lootPoolChances, int lootGroupChance){
|
||||
this.lootPoolNames = lootPoolNames;
|
||||
this.lootPoolChances = lootPoolChances;
|
||||
this.lootGroupChance = lootGroupChance;
|
||||
}
|
||||
|
||||
public String[] getLootPoolNames() {
|
||||
return lootPoolNames;
|
||||
}
|
||||
|
||||
public int[] getLootPoolChances() {
|
||||
return lootPoolChances;
|
||||
}
|
||||
|
||||
public int getLootGroupChance() {
|
||||
return lootGroupChance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*******************************************************************************
|
||||
* 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.objects.loot;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
public class LootPool {
|
||||
|
||||
public LootPool(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*******************************************************************************
|
||||
* 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.objects.loot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import engine.resources.scene.Planet;
|
||||
import main.NGECore;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
public class LootRollSession {
|
||||
|
||||
private String SessionID; // leaderName-SystemTime
|
||||
private boolean sessionValid;
|
||||
private GroupObject playerGroup;
|
||||
private List<TangibleObject> droppedItems;
|
||||
private Planet sessionPlanet;
|
||||
private List<String> errorMessages;
|
||||
private int sessionLootMode;
|
||||
private boolean allowRareLoot;
|
||||
private boolean increasedRLSChance;
|
||||
|
||||
public LootRollSession(){
|
||||
}
|
||||
|
||||
public LootRollSession(CreatureObject requester, TangibleObject lootedObject){
|
||||
long requesterGroupId = requester.getGroupId();
|
||||
if (requesterGroupId>0){
|
||||
this.playerGroup = (GroupObject) NGECore.getInstance().objectService.getObject(requesterGroupId);
|
||||
this.SessionID = playerGroup.getGroupLeader().getCustomName()+"-"+System.currentTimeMillis();
|
||||
|
||||
} else {
|
||||
this.SessionID = requester.getCustomName()+"-"+System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if (lootedObject instanceof CreatureObject){
|
||||
CreatureObject lootedCreature = (CreatureObject)lootedObject;
|
||||
// Exclude rare loot depending on creature level
|
||||
// For groups maybe average CL?
|
||||
if (requester.getLevel()-lootedCreature.getLevel()<=6){
|
||||
this.setAllowRareLoot(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Group situation
|
||||
if (this.getPlayerGroup()!=null){
|
||||
if (this.getPlayerGroup().getMemberList().size()>=4)
|
||||
this.setIncreasedRLSChance(true);
|
||||
}
|
||||
|
||||
// Possible AFKer check here
|
||||
|
||||
|
||||
droppedItems = new ArrayList<TangibleObject>();
|
||||
errorMessages = new ArrayList<String>();
|
||||
sessionPlanet = requester.getPlanet();
|
||||
allowRareLoot = false;
|
||||
}
|
||||
|
||||
public List<TangibleObject> getDroppedItems() {
|
||||
return droppedItems;
|
||||
}
|
||||
|
||||
public void addDroppedItem(TangibleObject droppedItem) {
|
||||
this.droppedItems.add(droppedItem);
|
||||
}
|
||||
|
||||
public String getSessionID() {
|
||||
return SessionID;
|
||||
}
|
||||
|
||||
public void setSessionID(String sessionID) {
|
||||
SessionID = sessionID;
|
||||
}
|
||||
|
||||
public void generateSessionID(String sessionID) {
|
||||
SessionID = sessionID;
|
||||
}
|
||||
|
||||
public Planet getSessionPlanet() {
|
||||
return sessionPlanet;
|
||||
}
|
||||
|
||||
public List<String> getErrorMessages() {
|
||||
return errorMessages;
|
||||
}
|
||||
|
||||
public void addErrorMessage(String errorMessage) {
|
||||
this.errorMessages.add(errorMessage);
|
||||
}
|
||||
|
||||
public int getSessionLootMode() {
|
||||
return sessionLootMode;
|
||||
}
|
||||
|
||||
public void setSessionLootMode(int sessionLootMode) {
|
||||
this.sessionLootMode = sessionLootMode;
|
||||
}
|
||||
|
||||
public boolean isAllowRareLoot() {
|
||||
return allowRareLoot;
|
||||
}
|
||||
|
||||
public void setAllowRareLoot(boolean allowRareLoot) {
|
||||
this.allowRareLoot = allowRareLoot;
|
||||
}
|
||||
|
||||
public GroupObject getPlayerGroup() {
|
||||
return playerGroup;
|
||||
}
|
||||
|
||||
public boolean isIncreasedRLSChance() {
|
||||
return increasedRLSChance;
|
||||
}
|
||||
|
||||
public void setIncreasedRLSChance(boolean increasedRLSChance) {
|
||||
this.increasedRLSChance = increasedRLSChance;
|
||||
}
|
||||
|
||||
public boolean isSessionValid() {
|
||||
return sessionValid;
|
||||
}
|
||||
|
||||
public void setSessionValid(boolean sessionValid) {
|
||||
this.sessionValid = sessionValid;
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,6 @@ import java.util.Map.Entry;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.common.CRC;
|
||||
import resources.common.StringUtilities;
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import resources.common.Console;
|
||||
import resources.objects.intangible.IntangibleObject;
|
||||
import resources.objects.resource.ResourceContainerObject;
|
||||
import resources.objects.tool.SurveyTool;
|
||||
@@ -45,7 +44,7 @@ import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Persistent(version=9)
|
||||
@Persistent(version=10)
|
||||
public class PlayerObject extends IntangibleObject {
|
||||
|
||||
// PLAY 3
|
||||
@@ -127,6 +126,8 @@ public class PlayerObject extends IntangibleObject {
|
||||
private String holoEmote;
|
||||
private int holoEmoteUses;
|
||||
|
||||
private int lotsRemaining = 10;
|
||||
|
||||
@NotPersistent
|
||||
private PlayerMessageBuilder messageBuilder;
|
||||
|
||||
@@ -822,4 +823,30 @@ public class PlayerObject extends IntangibleObject {
|
||||
public void setRecentContainer(ResourceContainerObject recentContainer) {
|
||||
this.recentContainer = recentContainer;
|
||||
}
|
||||
|
||||
public void setLotsRemaining(int amount)
|
||||
{
|
||||
this.lotsRemaining = amount;
|
||||
}
|
||||
|
||||
public boolean addLots(int amount)
|
||||
{
|
||||
this.lotsRemaining += amount;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean deductLots(int amount)
|
||||
{
|
||||
if(this.lotsRemaining - amount >= 0)
|
||||
{
|
||||
this.lotsRemaining -= amount;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLotsRemaining()
|
||||
{
|
||||
return this.lotsRemaining;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,20 +24,17 @@ package resources.objects.resource;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.SurveyMapUpdateMessage;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
|
||||
import com.sleepycat.je.Environment;
|
||||
import com.sleepycat.je.Transaction;
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.IPersistent;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ResourceConcentration {
|
||||
return coordsZ;
|
||||
}
|
||||
|
||||
public void setCoordsZ(float coordsY) {
|
||||
public void setCoordsZ(float coordsZ) {
|
||||
this.coordsZ = coordsZ;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ResourceContainerObject extends TangibleObject {
|
||||
|
||||
private CreatureObject proprietor;
|
||||
private String resourceType;
|
||||
private String resourceClass;
|
||||
private String resourceClass="";
|
||||
private String resourceName;
|
||||
private byte generalType;
|
||||
private long referenceID;
|
||||
@@ -70,6 +70,7 @@ public class ResourceContainerObject extends TangibleObject {
|
||||
private short overallQuality;
|
||||
private short flavor;
|
||||
|
||||
/*
|
||||
private static byte CONTAINER_TYPE_INORGANIC_MINERALS = 0;
|
||||
private static byte CONTAINER_TYPE_INORGANIC_CHEMICALS = 1;
|
||||
private static byte CONTAINER_TYPE_INORGANIC_GAS = 2;
|
||||
@@ -127,6 +128,7 @@ public class ResourceContainerObject extends TangibleObject {
|
||||
"object/resource_container/shared_resource_container_energy_radioactive.iff",
|
||||
"object/resource_container/shared_resource_container_energy_solid.iff"
|
||||
};
|
||||
*/
|
||||
|
||||
@NotPersistent
|
||||
public static int maximalStackCapacity = 100000;
|
||||
@@ -146,7 +148,7 @@ public class ResourceContainerObject extends TangibleObject {
|
||||
|
||||
public void initializeStats(GalacticResource resource){
|
||||
this.setResourceName(resource.getName());
|
||||
this.setResourceClass(resource.getResourceClass());
|
||||
this.setResourceClass(resource.getCategory());
|
||||
this.setColdResistance(resource.getResourceStats()[0]);
|
||||
this.setConductivity(resource.getResourceStats()[1]);
|
||||
this.setDecayResistance(resource.getResourceStats()[2]);
|
||||
|
||||
@@ -31,8 +31,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayClientEffectObjectMessage;
|
||||
@@ -41,8 +39,8 @@ import protocol.swg.UpdatePVPStatusMessage;
|
||||
import protocol.swg.objectControllerObjects.ShowFlyText;
|
||||
import resources.common.RGB;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.loot.LootGroup;
|
||||
import resources.visitors.IDManagerVisitor;
|
||||
import services.ai.AIActor;
|
||||
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
@@ -54,7 +52,7 @@ import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Persistent(version=1)
|
||||
@Persistent(version=5)
|
||||
public class TangibleObject extends SWGObject {
|
||||
|
||||
// TODO: Thread safety
|
||||
@@ -77,6 +75,12 @@ public class TangibleObject extends SWGObject {
|
||||
private int respawnTime = 0;
|
||||
private Point3D spawnCoordinates = new Point3D(0, 0, 0);
|
||||
|
||||
//private TreeSet<TreeMap<String,Integer>> lootSpecification = new TreeSet<TreeMap<String,Integer>>();
|
||||
private List<LootGroup> lootGroups = new ArrayList<LootGroup>();
|
||||
|
||||
private boolean looted = false;
|
||||
private boolean lootLock = false;
|
||||
|
||||
@NotPersistent
|
||||
private TangibleObject killer = null;
|
||||
|
||||
@@ -444,6 +448,33 @@ public class TangibleObject extends SWGObject {
|
||||
}
|
||||
}
|
||||
|
||||
public List<LootGroup> getLootGroups() {
|
||||
return lootGroups;
|
||||
}
|
||||
|
||||
public void addToLootGroups(String[] lootPoolNames, int[] lootPoolChances, int lootGroupChance) {
|
||||
System.out.println("lootPoolNames[0] " + lootPoolNames[0]);
|
||||
LootGroup lootGroup = new LootGroup(lootPoolNames, lootPoolChances, lootGroupChance);
|
||||
this.lootGroups.add(lootGroup);
|
||||
}
|
||||
|
||||
public boolean isLooted() {
|
||||
return looted;
|
||||
}
|
||||
|
||||
public void setLooted(boolean looted) {
|
||||
this.looted = looted;
|
||||
}
|
||||
|
||||
public boolean isLootLock() {
|
||||
return lootLock;
|
||||
}
|
||||
|
||||
public void setLootLock(boolean lootLock) {
|
||||
this.lootLock = lootLock;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
@@ -467,5 +498,5 @@ public class TangibleObject extends SWGObject {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user