mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-12 22:45:31 -04:00
All structure terminal menus and functionalities implemented
Dropped items add nowto the buildings itemlist Some databse work for permissions
This commit is contained in:
@@ -22,8 +22,12 @@
|
||||
package resources.objects.building;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.harvester.HarvesterObject;
|
||||
|
||||
public class BuildingMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
@@ -122,6 +126,26 @@ public class BuildingMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildPermissionListCreate(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();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,10 +21,13 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.building;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import main.NGECore;
|
||||
import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
|
||||
import com.sleepycat.je.Environment;
|
||||
import com.sleepycat.je.Transaction;
|
||||
@@ -40,7 +43,7 @@ import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Entity(version=2)
|
||||
@Entity(version=5)
|
||||
public class BuildingObject extends TangibleObject implements IPersistent {
|
||||
|
||||
@NotPersistent
|
||||
@@ -49,7 +52,16 @@ public class BuildingObject extends TangibleObject implements IPersistent {
|
||||
private Transaction txn;
|
||||
|
||||
private float maintenanceAmount = 0;
|
||||
private String deedTemplate;
|
||||
private int BMR = 0;
|
||||
private String deedTemplate="";
|
||||
private boolean residency=false;
|
||||
private byte privacy=(byte)0;
|
||||
public static byte PRIVATE = (byte)0;
|
||||
public static byte PUBLIC = (byte)1;
|
||||
private Vector<TangibleObject> itemsList = new Vector<TangibleObject>();
|
||||
private short maximumStorageCapacity=0;
|
||||
private Vector<Long> entryList = new Vector<Long>(); // Preferably the OIDs should be stored, because of name changes
|
||||
private Vector<Long> banList = new Vector<Long>();
|
||||
|
||||
public BuildingObject() {
|
||||
super();
|
||||
@@ -93,6 +105,117 @@ public class BuildingObject extends TangibleObject implements IPersistent {
|
||||
public String getDeedTemplate(){
|
||||
return this.deedTemplate;
|
||||
}
|
||||
|
||||
public String getBuildingName() {
|
||||
return this.getCustomName();
|
||||
}
|
||||
|
||||
public void setBuildingName(String buildingName, CreatureObject owner) {
|
||||
//owner.getClient().getSession().write(messageBuilder.buildCustomNameDelta(this,buildingName));
|
||||
this.setCustomName(buildingName);
|
||||
((CreatureObject)owner).sendSystemMessage("Structure renamed.", (byte) 0);
|
||||
}
|
||||
|
||||
public int getBMR() {
|
||||
return BMR;
|
||||
}
|
||||
|
||||
public void setBMR(int BMR) {
|
||||
this.BMR = BMR;
|
||||
}
|
||||
|
||||
public void setResidency(CreatureObject owner){
|
||||
owner.sendSystemMessage("@player_structure:declared_residency", (byte) 1);
|
||||
residency = true;
|
||||
}
|
||||
|
||||
public boolean getResidency(){
|
||||
return this.residency;
|
||||
}
|
||||
|
||||
public byte getPrivacy() {
|
||||
return privacy;
|
||||
}
|
||||
|
||||
public String getPrivacyString() {
|
||||
if (privacy==PRIVATE)
|
||||
return "private";
|
||||
if (privacy==PUBLIC)
|
||||
return "public";
|
||||
return "42";
|
||||
}
|
||||
|
||||
public void setPrivacy(byte privacy) {
|
||||
this.privacy = privacy;
|
||||
}
|
||||
|
||||
public Vector<TangibleObject> getItemsList() {
|
||||
return itemsList;
|
||||
}
|
||||
|
||||
public void setItemsList(Vector<TangibleObject> itemsList) {
|
||||
this.itemsList = itemsList;
|
||||
}
|
||||
|
||||
public short getMaximumStorageCapacity() {
|
||||
return maximumStorageCapacity;
|
||||
}
|
||||
|
||||
public void setMaximumStorageCapacity(short maximumStorageCapacity) {
|
||||
this.maximumStorageCapacity = maximumStorageCapacity;
|
||||
}
|
||||
|
||||
public void setPermissionEntry(String name,CreatureObject owner){
|
||||
Vector<String> entryListFirstNames = new Vector<String>();
|
||||
for (long oid : entryList){
|
||||
String firstName = NGECore.getInstance().characterService.getPlayerFirstName(oid);
|
||||
entryListFirstNames.add(firstName);
|
||||
}
|
||||
entryListFirstNames.add("Peter");
|
||||
entryListFirstNames.add("Jackson");
|
||||
owner.getClient().getSession().write(messageBuilder.buildPermissionListCreate(entryListFirstNames, name));
|
||||
}
|
||||
|
||||
public void setPermissionBan(String name,CreatureObject owner){
|
||||
Vector<String> banListFirstNames = new Vector<String>();
|
||||
for (long oid : banList){
|
||||
String firstName = NGECore.getInstance().characterService.getPlayerFirstName(oid);
|
||||
banListFirstNames.add(firstName);
|
||||
}
|
||||
banListFirstNames.add("Peter");
|
||||
banListFirstNames.add("Smith");
|
||||
owner.getClient().getSession().write(messageBuilder.buildPermissionListCreate(banListFirstNames, name));
|
||||
}
|
||||
|
||||
public void addPlayerToEntryList(CreatureObject owner,long oid, String firstName){
|
||||
if (!entryList.contains(oid)){
|
||||
this.entryList.add(oid);
|
||||
owner.sendSystemMessage(firstName+ " added to the list.", (byte)1); // player_added %NO added to the list.
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayerFromEntryList(CreatureObject owner,long oid, String firstName){
|
||||
if (entryList.contains(oid)){
|
||||
this.entryList.remove(oid);
|
||||
owner.sendSystemMessage(firstName+ " removed to the list.", (byte)1); // player_removed %NO removed from the list.
|
||||
}
|
||||
}
|
||||
|
||||
public void addPlayerToBanList(CreatureObject owner,long oid, String firstName){
|
||||
if (!banList.contains(oid)){
|
||||
this.banList.add(oid);
|
||||
owner.sendSystemMessage(firstName+ " added to the list.", (byte)1);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayerFromBanList(CreatureObject owner,long oid, String firstName){
|
||||
if (banList.contains(oid)){
|
||||
this.banList.remove(oid);
|
||||
owner.sendSystemMessage(firstName+ " removed to the list.", (byte)1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
@@ -115,5 +238,4 @@ public class BuildingObject extends TangibleObject implements IPersistent {
|
||||
txn = env.beginTransaction(null, null);
|
||||
txn.setLockTimeout(500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user