toolbar scrolling
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
cfcaa23a3d
commit
e0e90cdd1e
@ -856,6 +856,7 @@ Filter toolbar slots out of equip menu
|
|||||||
(09/30/2024)
|
(09/30/2024)
|
||||||
Fix attack tree checks
|
Fix attack tree checks
|
||||||
Disable client equip tests until can review
|
Disable client equip tests until can review
|
||||||
|
Toolbar scrolling
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|||||||
@ -112,6 +112,13 @@
|
|||||||
"entityId"
|
"entityId"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"messageName" : "clientUpdateToolbar",
|
||||||
|
"description" : "Updates the server on the selected toolbar option",
|
||||||
|
"data" : [
|
||||||
|
"toolbarId"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"messageName" : "clientRequestPerformItemAction",
|
"messageName" : "clientRequestPerformItemAction",
|
||||||
"description" : "Requests that the server have the entity perform its equipped item's action for the given equip point",
|
"description" : "Requests that the server have the entity perform its equipped item's action for the given equip point",
|
||||||
|
|||||||
@ -90,9 +90,8 @@ import electrosphere.engine.Main;
|
|||||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
import electrosphere.entity.state.attack.ClientAttackTree;
|
|
||||||
import electrosphere.entity.state.attack.ShooterTree;
|
|
||||||
import electrosphere.entity.state.equip.ClientEquipState;
|
import electrosphere.entity.state.equip.ClientEquipState;
|
||||||
|
import electrosphere.entity.state.equip.ClientToolbarState;
|
||||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
||||||
@ -140,6 +139,7 @@ public class ControlHandler {
|
|||||||
public static final String ITEM_SECONDARY = "actionItemSecondary";
|
public static final String ITEM_SECONDARY = "actionItemSecondary";
|
||||||
public static final String INPUT_CODE_PLACE_TERRAIN = "placeTerrain";
|
public static final String INPUT_CODE_PLACE_TERRAIN = "placeTerrain";
|
||||||
public static final String INPUT_CODE_REMOVE_TERRAIN = "removeTerrain";
|
public static final String INPUT_CODE_REMOVE_TERRAIN = "removeTerrain";
|
||||||
|
public static final String TOOLBAR_SCROLL = "toolbarScroll";
|
||||||
|
|
||||||
|
|
||||||
//menu navigation
|
//menu navigation
|
||||||
@ -327,6 +327,7 @@ public class ControlHandler {
|
|||||||
handler.addControl(INPUT_CODE_DROP, new Control(ControlType.KEY,GLFW_KEY_Y,false,"Drop","Drops the currently equipped item"));
|
handler.addControl(INPUT_CODE_DROP, new Control(ControlType.KEY,GLFW_KEY_Y,false,"Drop","Drops the currently equipped item"));
|
||||||
handler.addControl(INPUT_CODE_INVENTORY_OPEN, new Control(ControlType.KEY,GLFW.GLFW_KEY_TAB,false,"Inventory","Opens the player's inventory"));
|
handler.addControl(INPUT_CODE_INVENTORY_OPEN, new Control(ControlType.KEY,GLFW.GLFW_KEY_TAB,false,"Inventory","Opens the player's inventory"));
|
||||||
handler.addControl(ITEM_SECONDARY, new Control(ControlType.MOUSE_BUTTON,GLFW_MOUSE_BUTTON_RIGHT,false,"Secondary","Uses the secondary equipped item"));
|
handler.addControl(ITEM_SECONDARY, new Control(ControlType.MOUSE_BUTTON,GLFW_MOUSE_BUTTON_RIGHT,false,"Secondary","Uses the secondary equipped item"));
|
||||||
|
handler.addControl(TOOLBAR_SCROLL, new Control(ControlType.MOUSE_SCROLL,0,false,"",""));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Map the menu navigation controls
|
Map the menu navigation controls
|
||||||
@ -883,6 +884,21 @@ public class ControlHandler {
|
|||||||
controls.get(ITEM_SECONDARY).setOnRelease(new ControlMethod() {public void execute() {
|
controls.get(ITEM_SECONDARY).setOnRelease(new ControlMethod() {public void execute() {
|
||||||
ItemActions.releaseSecondaryItemAction();
|
ItemActions.releaseSecondaryItemAction();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toolbar scrolling
|
||||||
|
*/
|
||||||
|
mainGameControlList.add(controls.get(TOOLBAR_SCROLL));
|
||||||
|
controls.get(TOOLBAR_SCROLL).setOnScroll(new Control.ScrollCallback() {public void execute(ScrollEvent scrollEvent){
|
||||||
|
if(Globals.playerEntity != null && ClientToolbarState.getClientToolbarState(Globals.playerEntity) != null){
|
||||||
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
||||||
|
if(scrollEvent.getScrollAmount() > 0){
|
||||||
|
clientToolbarState.attemptChangeSelection(clientToolbarState.getSelectedSlot() + 1);
|
||||||
|
} else {
|
||||||
|
clientToolbarState.attemptChangeSelection(clientToolbarState.getSelectedSlot() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Interact
|
Interact
|
||||||
|
|||||||
@ -405,7 +405,7 @@ public class ClientAttackTree implements BehaviorTree {
|
|||||||
if(ClientToolbarState.getClientToolbarState(parent) != null){
|
if(ClientToolbarState.getClientToolbarState(parent) != null){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(parent);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(parent);
|
||||||
Entity item = clientToolbarState.getCurrentPrimaryItem();
|
Entity item = clientToolbarState.getCurrentPrimaryItem();
|
||||||
if(ItemUtils.isWeapon(item)){
|
if(item != null && ItemUtils.isWeapon(item)){
|
||||||
currentWeapon = item;
|
currentWeapon = item;
|
||||||
switch(ItemUtils.getWeaponClass(item)){
|
switch(ItemUtils.getWeaponClass(item)){
|
||||||
case "sword1h":
|
case "sword1h":
|
||||||
|
|||||||
@ -38,6 +38,11 @@ import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
|||||||
*/
|
*/
|
||||||
@SynchronizedBehaviorTree(name = "clientToolbarState", isServer = false, correspondingTree="serverToolbarState")
|
@SynchronizedBehaviorTree(name = "clientToolbarState", isServer = false, correspondingTree="serverToolbarState")
|
||||||
public class ClientToolbarState implements BehaviorTree {
|
public class ClientToolbarState implements BehaviorTree {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum number of toolbar slots
|
||||||
|
*/
|
||||||
|
public static final int MAX_TOOLBAR_SIZE = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The selected toolbar slot
|
* The selected toolbar slot
|
||||||
@ -237,6 +242,18 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
public Entity getCurrentPrimaryItem(){
|
public Entity getCurrentPrimaryItem(){
|
||||||
return this.equippedEntity;
|
return this.equippedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to change the selection to a new value
|
||||||
|
* @param value The value
|
||||||
|
*/
|
||||||
|
public void attemptChangeSelection(int value){
|
||||||
|
while(value < 0){
|
||||||
|
value = value + MAX_TOOLBAR_SIZE;
|
||||||
|
}
|
||||||
|
value = value % MAX_TOOLBAR_SIZE;
|
||||||
|
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientUpdateToolbarMessage(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -295,6 +295,20 @@ public class ServerToolbarState implements BehaviorTree {
|
|||||||
return realWorldItem;
|
return realWorldItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to change the selection to a new value
|
||||||
|
* @param value The value
|
||||||
|
*/
|
||||||
|
public void attemptChangeSelection(int value){
|
||||||
|
while(value < 0){
|
||||||
|
value = value + ClientToolbarState.MAX_TOOLBAR_SIZE;
|
||||||
|
}
|
||||||
|
value = value % ClientToolbarState.MAX_TOOLBAR_SIZE;
|
||||||
|
this.removeVisuals();
|
||||||
|
this.setSelectedSlot(value);
|
||||||
|
this.visuallyEquipCurrentSlot();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p> (initially) Automatically generated </p>
|
* <p> (initially) Automatically generated </p>
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import electrosphere.entity.Entity;
|
|||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
import electrosphere.entity.state.equip.ClientEquipState;
|
import electrosphere.entity.state.equip.ClientEquipState;
|
||||||
import electrosphere.entity.state.equip.ClientToolbarState;
|
import electrosphere.entity.state.equip.ClientToolbarState;
|
||||||
|
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
||||||
import electrosphere.net.parser.net.message.InventoryMessage;
|
import electrosphere.net.parser.net.message.InventoryMessage;
|
||||||
import electrosphere.net.server.protocol.InventoryProtocol;
|
import electrosphere.net.server.protocol.InventoryProtocol;
|
||||||
|
|
||||||
@ -143,12 +144,45 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case SERVERCOMMANDEQUIPITEM: {
|
||||||
|
//translate equipper id
|
||||||
|
Entity equipper = Globals.clientSceneWrapper.getEntityFromServerId(message.getequipperId());
|
||||||
|
//spawn in world id
|
||||||
|
Entity inWorldEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
||||||
|
if(inWorldEntity != null){
|
||||||
|
//translate id
|
||||||
|
Globals.clientSceneWrapper.mapIdToId(inWorldEntity.getId(), message.getentityId());
|
||||||
|
switch(message.getcontainerType()){
|
||||||
|
case electrosphere.net.server.protocol.InventoryProtocol.INVENTORY_TYPE_NATURAL: {
|
||||||
|
throw new UnsupportedOperationException("unsupported!");
|
||||||
|
}
|
||||||
|
case electrosphere.net.server.protocol.InventoryProtocol.INVENTORY_TYPE_EQUIP: {
|
||||||
|
//grab equip state
|
||||||
|
ClientEquipState equipState = ClientEquipState.getEquipState(equipper);
|
||||||
|
//create entity from template in message
|
||||||
|
//get equippoint
|
||||||
|
String equipPointName = message.getequipPointId();
|
||||||
|
EquipPoint equipPoint = equipState.getEquipPoint(equipPointName);
|
||||||
|
//attach
|
||||||
|
equipState.attemptEquip(inWorldEntity, equipPoint);
|
||||||
|
}
|
||||||
|
case electrosphere.net.server.protocol.InventoryProtocol.INVENTORY_TYPE_TOOLBAR: {
|
||||||
|
//grab toolbar state
|
||||||
|
ClientToolbarState toolbarState = ClientToolbarState.getClientToolbarState(equipper);
|
||||||
|
//attach
|
||||||
|
toolbarState.attemptEquip(inWorldEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new UnsupportedOperationException("todo");
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case CLIENTUPDATETOOLBAR:
|
||||||
case CLIENTREQUESTADDNATURAL:
|
case CLIENTREQUESTADDNATURAL:
|
||||||
case CLIENTREQUESTADDTOOLBAR:
|
case CLIENTREQUESTADDTOOLBAR:
|
||||||
case CLIENTREQUESTEQUIPITEM:
|
case CLIENTREQUESTEQUIPITEM:
|
||||||
case CLIENTREQUESTUNEQUIPITEM:
|
case CLIENTREQUESTUNEQUIPITEM:
|
||||||
case CLIENTREQUESTPERFORMITEMACTION:
|
case CLIENTREQUESTPERFORMITEMACTION:
|
||||||
case SERVERCOMMANDEQUIPITEM:
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,10 @@ public class ServerInventoryState implements BehaviorTree {
|
|||||||
ServerToolbarState serverToolbarState = ServerToolbarState.getServerToolbarState(parent);
|
ServerToolbarState serverToolbarState = ServerToolbarState.getServerToolbarState(parent);
|
||||||
serverToolbarState.attemptEquip(itemEnt, message.gettoolbarId());
|
serverToolbarState.attemptEquip(itemEnt, message.gettoolbarId());
|
||||||
} break;
|
} break;
|
||||||
|
case CLIENTUPDATETOOLBAR: {
|
||||||
|
ServerToolbarState serverToolbarState = ServerToolbarState.getServerToolbarState(parent);
|
||||||
|
serverToolbarState.attemptChangeSelection(message.gettoolbarId());
|
||||||
|
} break;
|
||||||
case CLIENTREQUESTPERFORMITEMACTION:
|
case CLIENTREQUESTPERFORMITEMACTION:
|
||||||
case SERVERCOMMANDUNEQUIPITEM:
|
case SERVERCOMMANDUNEQUIPITEM:
|
||||||
case SERVERCOMMANDEQUIPITEM:
|
case SERVERCOMMANDEQUIPITEM:
|
||||||
|
|||||||
@ -1,12 +1,8 @@
|
|||||||
package electrosphere.net.client.protocol;
|
package electrosphere.net.client.protocol;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
|
||||||
import electrosphere.entity.state.equip.ClientEquipState;
|
|
||||||
import electrosphere.entity.state.equip.ClientToolbarState;
|
|
||||||
import electrosphere.entity.state.inventory.ClientInventoryState;
|
import electrosphere.entity.state.inventory.ClientInventoryState;
|
||||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.net.parser.net.message.InventoryMessage;
|
import electrosphere.net.parser.net.message.InventoryMessage;
|
||||||
import electrosphere.net.template.ClientProtocolTemplate;
|
import electrosphere.net.template.ClientProtocolTemplate;
|
||||||
@ -35,36 +31,11 @@ public class InventoryProtocol implements ClientProtocolTemplate<InventoryMessag
|
|||||||
break;
|
break;
|
||||||
case SERVERCOMMANDEQUIPITEM: {
|
case SERVERCOMMANDEQUIPITEM: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] EQUIP ITEM " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] EQUIP ITEM " + message.getentityId());
|
||||||
//translate equipper id
|
if(Globals.playerEntity != null){
|
||||||
Entity equipper = Globals.clientSceneWrapper.getEntityFromServerId(message.getequipperId());
|
ClientInventoryState inventoryState;
|
||||||
//spawn in world id
|
if((inventoryState = InventoryUtils.clientGetInventoryState(Globals.playerEntity))!=null){
|
||||||
Entity inWorldEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
inventoryState.addNetworkMessage(message);
|
||||||
if(inWorldEntity != null){
|
|
||||||
//translate id
|
|
||||||
Globals.clientSceneWrapper.mapIdToId(inWorldEntity.getId(), message.getentityId());
|
|
||||||
switch(message.getcontainerType()){
|
|
||||||
case electrosphere.net.server.protocol.InventoryProtocol.INVENTORY_TYPE_NATURAL: {
|
|
||||||
throw new UnsupportedOperationException("unsupported!");
|
|
||||||
}
|
|
||||||
case electrosphere.net.server.protocol.InventoryProtocol.INVENTORY_TYPE_EQUIP: {
|
|
||||||
//grab equip state
|
|
||||||
ClientEquipState equipState = ClientEquipState.getEquipState(equipper);
|
|
||||||
//create entity from template in message
|
|
||||||
//get equippoint
|
|
||||||
String equipPointName = message.getequipPointId();
|
|
||||||
EquipPoint equipPoint = equipState.getEquipPoint(equipPointName);
|
|
||||||
//attach
|
|
||||||
equipState.attemptEquip(inWorldEntity, equipPoint);
|
|
||||||
}
|
|
||||||
case electrosphere.net.server.protocol.InventoryProtocol.INVENTORY_TYPE_TOOLBAR: {
|
|
||||||
//grab toolbar state
|
|
||||||
ClientToolbarState toolbarState = ClientToolbarState.getClientToolbarState(equipper);
|
|
||||||
//attach
|
|
||||||
toolbarState.attemptEquip(inWorldEntity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new UnsupportedOperationException("todo");
|
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case REMOVEITEMFROMINVENTORY:
|
case REMOVEITEMFROMINVENTORY:
|
||||||
@ -95,6 +66,7 @@ public class InventoryProtocol implements ClientProtocolTemplate<InventoryMessag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CLIENTUPDATETOOLBAR:
|
||||||
case CLIENTREQUESTADDNATURAL:
|
case CLIENTREQUESTADDNATURAL:
|
||||||
case CLIENTREQUESTADDTOOLBAR:
|
case CLIENTREQUESTADDTOOLBAR:
|
||||||
case CLIENTREQUESTPERFORMITEMACTION:
|
case CLIENTREQUESTPERFORMITEMACTION:
|
||||||
|
|||||||
@ -17,6 +17,7 @@ public class InventoryMessage extends NetworkMessage {
|
|||||||
CLIENTREQUESTUNEQUIPITEM,
|
CLIENTREQUESTUNEQUIPITEM,
|
||||||
CLIENTREQUESTADDTOOLBAR,
|
CLIENTREQUESTADDTOOLBAR,
|
||||||
CLIENTREQUESTADDNATURAL,
|
CLIENTREQUESTADDNATURAL,
|
||||||
|
CLIENTUPDATETOOLBAR,
|
||||||
CLIENTREQUESTPERFORMITEMACTION,
|
CLIENTREQUESTPERFORMITEMACTION,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +140,12 @@ public class InventoryMessage extends NetworkMessage {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
case TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTUPDATETOOLBAR:
|
||||||
|
if(byteBuffer.getRemaining() >= TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTUPDATETOOLBAR_SIZE){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTREQUESTPERFORMITEMACTION:
|
case TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTREQUESTPERFORMITEMACTION:
|
||||||
return InventoryMessage.canParseclientRequestPerformItemActionMessage(byteBuffer);
|
return InventoryMessage.canParseclientRequestPerformItemActionMessage(byteBuffer);
|
||||||
}
|
}
|
||||||
@ -447,6 +454,20 @@ public class InventoryMessage extends NetworkMessage {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static InventoryMessage parseclientUpdateToolbarMessage(CircularByteBuffer byteBuffer){
|
||||||
|
InventoryMessage rVal = new InventoryMessage(InventoryMessageType.CLIENTUPDATETOOLBAR);
|
||||||
|
stripPacketHeader(byteBuffer);
|
||||||
|
rVal.settoolbarId(ByteStreamUtils.popIntFromByteQueue(byteBuffer));
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InventoryMessage constructclientUpdateToolbarMessage(int toolbarId){
|
||||||
|
InventoryMessage rVal = new InventoryMessage(InventoryMessageType.CLIENTUPDATETOOLBAR);
|
||||||
|
rVal.settoolbarId(toolbarId);
|
||||||
|
rVal.serialize();
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean canParseclientRequestPerformItemActionMessage(CircularByteBuffer byteBuffer){
|
public static boolean canParseclientRequestPerformItemActionMessage(CircularByteBuffer byteBuffer){
|
||||||
int currentStreamLength = byteBuffer.getRemaining();
|
int currentStreamLength = byteBuffer.getRemaining();
|
||||||
List<Byte> temporaryByteQueue = new LinkedList<Byte>();
|
List<Byte> temporaryByteQueue = new LinkedList<Byte>();
|
||||||
@ -666,6 +687,17 @@ public class InventoryMessage extends NetworkMessage {
|
|||||||
rawBytes[2+i] = intValues[i];
|
rawBytes[2+i] = intValues[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CLIENTUPDATETOOLBAR:
|
||||||
|
rawBytes = new byte[2+4];
|
||||||
|
//message header
|
||||||
|
rawBytes[0] = TypeBytes.MESSAGE_TYPE_INVENTORY;
|
||||||
|
//entity messaage header
|
||||||
|
rawBytes[1] = TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTUPDATETOOLBAR;
|
||||||
|
intValues = ByteStreamUtils.serializeIntToBytes(toolbarId);
|
||||||
|
for(int i = 0; i < 4; i++){
|
||||||
|
rawBytes[2+i] = intValues[i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CLIENTREQUESTPERFORMITEMACTION:
|
case CLIENTREQUESTPERFORMITEMACTION:
|
||||||
rawBytes = new byte[2+4+equipPointId.length()+4+4];
|
rawBytes = new byte[2+4+equipPointId.length()+4+4];
|
||||||
//message header
|
//message header
|
||||||
|
|||||||
@ -322,6 +322,11 @@ COMBAT_MESSAGE,
|
|||||||
rVal = InventoryMessage.parseclientRequestAddNaturalMessage(byteBuffer);
|
rVal = InventoryMessage.parseclientRequestAddNaturalMessage(byteBuffer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTUPDATETOOLBAR:
|
||||||
|
if(InventoryMessage.canParseMessage(byteBuffer,secondByte)){
|
||||||
|
rVal = InventoryMessage.parseclientUpdateToolbarMessage(byteBuffer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTREQUESTPERFORMITEMACTION:
|
case TypeBytes.INVENTORY_MESSAGE_TYPE_CLIENTREQUESTPERFORMITEMACTION:
|
||||||
if(InventoryMessage.canParseMessage(byteBuffer,secondByte)){
|
if(InventoryMessage.canParseMessage(byteBuffer,secondByte)){
|
||||||
rVal = InventoryMessage.parseclientRequestPerformItemActionMessage(byteBuffer);
|
rVal = InventoryMessage.parseclientRequestPerformItemActionMessage(byteBuffer);
|
||||||
|
|||||||
@ -138,13 +138,15 @@ Message categories
|
|||||||
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTUNEQUIPITEM = 6;
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTUNEQUIPITEM = 6;
|
||||||
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDTOOLBAR = 7;
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDTOOLBAR = 7;
|
||||||
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDNATURAL = 8;
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDNATURAL = 8;
|
||||||
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTPERFORMITEMACTION = 9;
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTUPDATETOOLBAR = 9;
|
||||||
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTPERFORMITEMACTION = 10;
|
||||||
/*
|
/*
|
||||||
Inventory packet sizes
|
Inventory packet sizes
|
||||||
*/
|
*/
|
||||||
public static final byte INVENTORY_MESSAGE_TYPE_REMOVEITEMFROMINVENTORY_SIZE = 6;
|
public static final byte INVENTORY_MESSAGE_TYPE_REMOVEITEMFROMINVENTORY_SIZE = 6;
|
||||||
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDTOOLBAR_SIZE = 10;
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDTOOLBAR_SIZE = 10;
|
||||||
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDNATURAL_SIZE = 6;
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTREQUESTADDNATURAL_SIZE = 6;
|
||||||
|
public static final byte INVENTORY_MESSAGE_TYPE_CLIENTUPDATETOOLBAR_SIZE = 6;
|
||||||
/*
|
/*
|
||||||
Synchronization subcategories
|
Synchronization subcategories
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -74,6 +74,12 @@ public class InventoryProtocol implements ServerProtocolTemplate<InventoryMessag
|
|||||||
InventoryUtils.serverGetInventoryState(target).addNetworkMessage(message);
|
InventoryUtils.serverGetInventoryState(target).addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case CLIENTUPDATETOOLBAR: {
|
||||||
|
target = EntityLookupUtils.getEntityById(connectionHandler.getPlayerEntityId());
|
||||||
|
if(target != null && InventoryUtils.hasToolbarInventory(target)){
|
||||||
|
InventoryUtils.serverGetInventoryState(target).addNetworkMessage(message);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
case SERVERCOMMANDUNEQUIPITEM:
|
case SERVERCOMMANDUNEQUIPITEM:
|
||||||
case SERVERCOMMANDMOVEITEMCONTAINER:
|
case SERVERCOMMANDMOVEITEMCONTAINER:
|
||||||
case SERVERCOMMANDEQUIPITEM:
|
case SERVERCOMMANDEQUIPITEM:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user