Deed placement (ObjectActionMsgHandler, PlaceAssetMsgHandler) reads deed_structure_id from DeedTemplate._deeds. The deed, employment contract and charter type checks (PlaceAssetMsgHandler, ActivateNPCMsgHandler, GuildCreationFinalizeHandler, UseCharterMsg, Item.serialize) read item_type through the cache template bridge. Charters go through the shared getter rather than _deeds because template 545 "Charter" is a CHARTER in the ITEM folder. Parity (offline, static_item_templates vs COBJECTS, scripts/p13.py, 881 templates: all 880 DEED plus ITEM 545): 0 differences in item_type and deed_structure_id. Every DB DEED, EMPLOYMENTCONTRACT, PETTOTEM and FURNITUREDEED id is in the DEED folder. No value changes expected. No pet totem or furniture deed consumer reads template fields, so neither changes. JSON-Refactor-Plan Task 1.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
106 lines
3.4 KiB
Java
106 lines
3.4 KiB
Java
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
// Magicbane Emulator Project © 2013 - 2026
|
|
// https://www.magicbane.com
|
|
|
|
|
|
package engine.net.client.msg;
|
|
|
|
import engine.mbEnums.ItemType;
|
|
import engine.net.AbstractConnection;
|
|
import engine.net.ByteBufferReader;
|
|
import engine.net.ByteBufferWriter;
|
|
import engine.net.Protocol;
|
|
import engine.objects.Item;
|
|
import engine.objects.PlayerCharacter;
|
|
|
|
|
|
public class UseCharterMsg extends ClientNetMsg {
|
|
|
|
private int unknown01;
|
|
private int unknown02;
|
|
private int unknown03;
|
|
private String type;
|
|
private int unknown04;
|
|
private int unknown05;
|
|
private int unknown06;
|
|
private boolean close = false;
|
|
private PlayerCharacter player;
|
|
private int charterUUID;
|
|
|
|
/**
|
|
* This is the general purpose constructor.
|
|
*/
|
|
public UseCharterMsg() {
|
|
super(Protocol.USECHARTER);
|
|
}
|
|
|
|
public UseCharterMsg(PlayerCharacter player, boolean close) {
|
|
super(Protocol.USECHARTER);
|
|
this.close = close;
|
|
this.player = player;
|
|
|
|
}
|
|
|
|
/**
|
|
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
|
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
|
* past the limit) then this constructor Throws that Exception to the
|
|
* caller.
|
|
*/
|
|
public UseCharterMsg(AbstractConnection origin, ByteBufferReader reader) {
|
|
super(Protocol.USECHARTER, origin, reader);
|
|
}
|
|
|
|
/**
|
|
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
|
*/
|
|
|
|
public void configure() {
|
|
|
|
if (close) {
|
|
for (Item i : player.getInventory()) {
|
|
if (i.template.cacheTemplate.getItemType().equals(ItemType.CHARTER)) {
|
|
charterUUID = i.getObjectUUID();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected void _serialize(ByteBufferWriter writer) {
|
|
writer.putInt(this.unknown01);
|
|
writer.putInt(this.unknown02);
|
|
writer.putInt(this.unknown03);
|
|
writer.putString(this.type);
|
|
writer.putInt(this.unknown04);
|
|
writer.putInt(this.unknown05);
|
|
writer.putInt(this.unknown06);
|
|
}
|
|
|
|
/**
|
|
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
|
*/
|
|
@Override
|
|
protected void _deserialize(ByteBufferReader reader) {
|
|
this.unknown01 = reader.getInt();
|
|
this.unknown02 = reader.getInt();
|
|
this.unknown03 = reader.getInt();
|
|
this.type = reader.getString();
|
|
this.unknown04 = reader.getInt();
|
|
this.unknown05 = reader.getInt();
|
|
this.unknown06 = reader.getInt();
|
|
}
|
|
|
|
/**
|
|
* @return the unknown01
|
|
*/
|
|
public void setUnknown02(int unknown02) {
|
|
this.unknown02 = unknown02;
|
|
}
|
|
}
|