save stuff

This commit is contained in:
sirjonasxx 2020-05-24 21:35:20 +02:00
parent cfe6b23c33
commit d90326938e

View File

@ -2,6 +2,9 @@ package gearth.extensions.parsers;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;
import java.util.ArrayList;
import java.util.List;
public class HEntity { public class HEntity {
private int id; private int id;
private int index; private int index;
@ -13,6 +16,7 @@ public class HEntity {
private String figureId; private String figureId;
private String favoriteGroup = null; private String favoriteGroup = null;
private HEntityUpdate lastUpdate = null; private HEntityUpdate lastUpdate = null;
private Object[] stuff = new Object[0];
public HEntity(HPacket packet) { public HEntity(HPacket packet) {
id = packet.readInteger(); id = packet.readInteger();
@ -29,37 +33,41 @@ public class HEntity {
switch (entityTypeId) { switch (entityTypeId) {
case 1: case 1:
stuff = new Object[5];
gender = HGender.fromString(packet.readString()); gender = HGender.fromString(packet.readString());
packet.readInteger(); stuff[0] = packet.readInteger();
packet.readInteger(); stuff[1] = packet.readInteger();
favoriteGroup = packet.readString(); favoriteGroup = packet.readString();
packet.readString(); stuff[2] = packet.readString();
packet.readInteger(); stuff[3] = packet.readInteger();
packet.readBoolean(); stuff[4] = packet.readBoolean();
break; break;
case 2: case 2:
packet.readInteger(); stuff = new Object[20];
packet.readInteger(); stuff[0] = packet.readInteger();
packet.readString(); stuff[1] = packet.readInteger();
packet.readInteger(); stuff[2] = packet.readString();
packet.readBoolean(); stuff[3] = packet.readInteger();
packet.readBoolean(); stuff[4] = packet.readBoolean();
packet.readBoolean(); stuff[5] = packet.readBoolean();
packet.readBoolean(); stuff[6] = packet.readBoolean();
packet.readBoolean(); stuff[7] = packet.readBoolean();
packet.readBoolean(); stuff[8] = packet.readBoolean();
packet.readInteger(); stuff[9] = packet.readBoolean();
packet.readString(); stuff[10] = packet.readInteger();
stuff[11] = packet.readString();
break; break;
case 4: case 4:
stuff = new Object[4];
packet.readString(); stuff[0] = packet.readString();
packet.readInteger(); stuff[1] = packet.readInteger();
packet.readString(); stuff[2] = packet.readString();
List<Short> list = new ArrayList<>();
for (int j = packet.readInteger(); j > 0; j--) for (int j = packet.readInteger(); j > 0; j--)
{ {
packet.readShort(); list.add(packet.readShort());
} }
stuff[3] = list;
break; break;
} }
} }
@ -120,4 +128,8 @@ public class HEntity {
public HEntityUpdate getLastUpdate() { public HEntityUpdate getLastUpdate() {
return lastUpdate; return lastUpdate;
} }
public Object[] getStuff() {
return stuff;
}
} }