mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-31 12:52:36 +01:00
setter methods in parsers
This commit is contained in:
parent
567e4e1543
commit
3f8121e157
@ -56,6 +56,57 @@ public class HFloorItem implements IFurni {
|
||||
|
||||
}
|
||||
|
||||
public void appendToPacket(HPacket packet) {
|
||||
// id = packet.readInteger();
|
||||
packet.appendInt(id);
|
||||
|
||||
// typeId = packet.readInteger();
|
||||
packet.appendInt(typeId);
|
||||
|
||||
// int x = packet.readInteger();
|
||||
packet.appendInt(tile.getX());
|
||||
|
||||
// int y = packet.readInteger();
|
||||
packet.appendInt(tile.getY());
|
||||
|
||||
// facing = HDirection.values()[packet.readInteger()];
|
||||
packet.appendInt(facing.ordinal());
|
||||
|
||||
// tile = new HPoint(x, y, Double.parseDouble(packet.readString()));
|
||||
packet.appendString(tile.getZ() + "");
|
||||
|
||||
|
||||
// ignore1 = packet.readString();
|
||||
packet.appendString(ignore1);
|
||||
|
||||
// ignore2 = packet.readInteger();
|
||||
packet.appendInt(ignore2);
|
||||
|
||||
// category = packet.readInteger();
|
||||
packet.appendInt(category);
|
||||
|
||||
|
||||
// stuff = HStuff.readData(packet, category);
|
||||
for (Object object : stuff) {
|
||||
packet.appendObject(object);
|
||||
}
|
||||
|
||||
// secondsToExpiration = packet.readInteger();
|
||||
packet.appendInt(secondsToExpiration);
|
||||
|
||||
// usagePolicy = packet.readInteger();
|
||||
packet.appendInt(usagePolicy);
|
||||
|
||||
// ownerId = packet.readInteger();
|
||||
packet.appendInt(ownerId);
|
||||
|
||||
|
||||
if (typeId < 0) {
|
||||
// ignore3 = packet.readString();
|
||||
packet.appendString(ignore3);
|
||||
}
|
||||
}
|
||||
|
||||
public static HFloorItem[] parse(HPacket packet) {
|
||||
int ownersCount = packet.readInteger();
|
||||
Map<Integer, String> owners = new HashMap<>(ownersCount);
|
||||
@ -66,7 +117,7 @@ public class HFloorItem implements IFurni {
|
||||
HFloorItem[] furniture = new HFloorItem[packet.readInteger()];
|
||||
for (int i = 0; i < furniture.length; i++) {
|
||||
HFloorItem furni = new HFloorItem(packet);
|
||||
furni.ownerName = owners.get(furni.ownerId);
|
||||
furni.setOwnerName(owners.get(furni.ownerId));
|
||||
|
||||
furniture[i] = furni;
|
||||
}
|
||||
@ -88,54 +139,7 @@ public class HFloorItem implements IFurni {
|
||||
|
||||
packet.appendInt(floorItems.length);
|
||||
for (HFloorItem floorItem : floorItems) {
|
||||
// id = packet.readInteger();
|
||||
packet.appendInt(floorItem.id);
|
||||
|
||||
// typeId = packet.readInteger();
|
||||
packet.appendInt(floorItem.typeId);
|
||||
|
||||
// int x = packet.readInteger();
|
||||
packet.appendInt(floorItem.tile.getX());
|
||||
|
||||
// int y = packet.readInteger();
|
||||
packet.appendInt(floorItem.tile.getY());
|
||||
|
||||
// facing = HDirection.values()[packet.readInteger()];
|
||||
packet.appendInt(floorItem.facing.ordinal());
|
||||
|
||||
// tile = new HPoint(x, y, Double.parseDouble(packet.readString()));
|
||||
packet.appendString(floorItem.tile.getZ() + "");
|
||||
|
||||
|
||||
// ignore1 = packet.readString();
|
||||
packet.appendString(floorItem.ignore1);
|
||||
|
||||
// ignore2 = packet.readInteger();
|
||||
packet.appendInt(floorItem.ignore2);
|
||||
|
||||
// category = packet.readInteger();
|
||||
packet.appendInt(floorItem.category);
|
||||
|
||||
|
||||
// stuff = HStuff.readData(packet, category);
|
||||
for (Object object : floorItem.stuff) {
|
||||
packet.appendObject(object);
|
||||
}
|
||||
|
||||
// secondsToExpiration = packet.readInteger();
|
||||
packet.appendInt(floorItem.secondsToExpiration);
|
||||
|
||||
// usagePolicy = packet.readInteger();
|
||||
packet.appendInt(floorItem.usagePolicy);
|
||||
|
||||
// ownerId = packet.readInteger();
|
||||
packet.appendInt(floorItem.ownerId);
|
||||
|
||||
|
||||
if (floorItem.typeId < 0) {
|
||||
// ignore3 = packet.readString();
|
||||
packet.appendString(floorItem.ignore3);
|
||||
}
|
||||
floorItem.appendToPacket(packet);
|
||||
}
|
||||
|
||||
return packet;
|
||||
@ -181,4 +185,48 @@ public class HFloorItem implements IFurni {
|
||||
public HPoint getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
public Object[] getStuff() {
|
||||
return stuff;
|
||||
}
|
||||
|
||||
public void setOwnerName(String ownerName) {
|
||||
this.ownerName = ownerName;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTypeId(int typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public void setTile(HPoint tile) {
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public void setFacing(HDirection facing) {
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public void setCategory(int category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public void setSecondsToExpiration(int secondsToExpiration) {
|
||||
this.secondsToExpiration = secondsToExpiration;
|
||||
}
|
||||
|
||||
public void setUsagePolicy(int usagePolicy) {
|
||||
this.usagePolicy = usagePolicy;
|
||||
}
|
||||
|
||||
public void setOwnerId(int ownerId) {
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
|
||||
public void setStuff(Object[] stuff) {
|
||||
this.stuff = stuff;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,29 @@ public class HWallItem implements IFurni {
|
||||
ownerId = packet.readInteger();
|
||||
}
|
||||
|
||||
public void appendToPacket(HPacket packet) {
|
||||
// id = Integer.decode(packet.readString());
|
||||
packet.appendString(id + "");
|
||||
|
||||
// typeId = packet.readInteger();
|
||||
packet.appendInt(typeId);
|
||||
|
||||
// location = packet.readString();
|
||||
packet.appendString(location);
|
||||
|
||||
// state = packet.readString();
|
||||
packet.appendString(state);
|
||||
|
||||
// secondsToExpiration = packet.readInteger();
|
||||
packet.appendInt(secondsToExpiration);
|
||||
|
||||
// usagePolicy = packet.readInteger();
|
||||
packet.appendInt(usagePolicy);
|
||||
|
||||
// ownerId = packet.readInteger();
|
||||
packet.appendInt(ownerId);
|
||||
}
|
||||
|
||||
public static HWallItem[] parse(HPacket packet) {
|
||||
int ownersCount = packet.readInteger();
|
||||
HashMap<Integer, String> owners = new HashMap<>(ownersCount);
|
||||
@ -40,7 +63,7 @@ public class HWallItem implements IFurni {
|
||||
|
||||
for (int i = 0; i < furniture.length; i++) {
|
||||
HWallItem furni = new HWallItem(packet);
|
||||
furni.ownerName = owners.get(furni.ownerId);
|
||||
furni.setOwnerName(owners.get(furni.ownerId));
|
||||
|
||||
furniture[i] = furni;
|
||||
}
|
||||
@ -62,26 +85,7 @@ public class HWallItem implements IFurni {
|
||||
|
||||
packet.appendInt(wallItems.length);
|
||||
for (HWallItem wallItem : wallItems) {
|
||||
// id = Integer.decode(packet.readString());
|
||||
packet.appendString(wallItem.id + "");
|
||||
|
||||
// typeId = packet.readInteger();
|
||||
packet.appendInt(wallItem.typeId);
|
||||
|
||||
// location = packet.readString();
|
||||
packet.appendString(wallItem.location);
|
||||
|
||||
// state = packet.readString();
|
||||
packet.appendString(wallItem.state);
|
||||
|
||||
// secondsToExpiration = packet.readInteger();
|
||||
packet.appendInt(wallItem.secondsToExpiration);
|
||||
|
||||
// usagePolicy = packet.readInteger();
|
||||
packet.appendInt(wallItem.usagePolicy);
|
||||
|
||||
// ownerId = packet.readInteger();
|
||||
packet.appendInt(wallItem.ownerId);
|
||||
wallItem.appendToPacket(packet);
|
||||
}
|
||||
|
||||
return packet;
|
||||
@ -118,4 +122,36 @@ public class HWallItem implements IFurni {
|
||||
public int getSecondsToExpiration() {
|
||||
return secondsToExpiration;
|
||||
}
|
||||
|
||||
public void setOwnerName(String ownerName) {
|
||||
this.ownerName = ownerName;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTypeId(int typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public void setUsagePolicy(int usagePolicy) {
|
||||
this.usagePolicy = usagePolicy;
|
||||
}
|
||||
|
||||
public void setSecondsToExpiration(int secondsToExpiration) {
|
||||
this.secondsToExpiration = secondsToExpiration;
|
||||
}
|
||||
|
||||
public void setOwnerId(int ownerId) {
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user