mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Complete set of item options and actions.
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@
|
||||
<chain />
|
||||
</event>
|
||||
<event>
|
||||
<type>org.apollo.game.event.impl.EquipEvent</type>
|
||||
<type>org.apollo.game.event.impl.ItemOptionEvent</type>
|
||||
<chain>
|
||||
<handler>org.apollo.game.event.handler.impl.EquipEventHandler</handler>
|
||||
</chain>
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.apollo.game.event.handler.impl;
|
||||
|
||||
import org.apollo.game.event.handler.EventHandler;
|
||||
import org.apollo.game.event.handler.EventHandlerContext;
|
||||
import org.apollo.game.event.impl.EquipEvent;
|
||||
import org.apollo.game.event.impl.ItemOptionEvent;
|
||||
import org.apollo.game.model.EquipmentConstants;
|
||||
import org.apollo.game.model.Inventory;
|
||||
import org.apollo.game.model.Item;
|
||||
@@ -15,13 +15,14 @@ import org.apollo.util.LanguageUtil;
|
||||
/**
|
||||
* An event handler which equips items.
|
||||
*
|
||||
* @author Major
|
||||
* @author Graham
|
||||
*/
|
||||
public final class EquipEventHandler extends EventHandler<EquipEvent> {
|
||||
public final class EquipEventHandler extends EventHandler<ItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public void handle(EventHandlerContext ctx, Player player, EquipEvent event) {
|
||||
if (event.getInterfaceId() == SynchronizationInventoryListener.INVENTORY_ID) {
|
||||
public void handle(EventHandlerContext ctx, Player player, ItemOptionEvent event) {
|
||||
if (event.getOption() == 2 && event.getInterfaceId() == SynchronizationInventoryListener.INVENTORY_ID) {
|
||||
int inventorySlot = event.getSlot();
|
||||
Item equipping = player.getInventory().get(inventorySlot);
|
||||
int equippingId = equipping.getId();
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
import org.apollo.game.event.Event;
|
||||
|
||||
/**
|
||||
* An event sent by the client to request that an item is equipped.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public final class EquipEvent extends Event {
|
||||
|
||||
/**
|
||||
* The interface id.
|
||||
*/
|
||||
private final int interfaceId;
|
||||
|
||||
/**
|
||||
* The item id.
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* The item's slot.
|
||||
*/
|
||||
private final int slot;
|
||||
|
||||
/**
|
||||
* Creates the equip event.
|
||||
*
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public EquipEvent(int interfaceId, int id, int slot) {
|
||||
this.interfaceId = interfaceId;
|
||||
this.id = id;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item id.
|
||||
*
|
||||
* @return The item id.
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the interface id.
|
||||
*
|
||||
* @return The interface id.
|
||||
*/
|
||||
public int getInterfaceId() {
|
||||
return interfaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slot.
|
||||
*
|
||||
* @return The slot.
|
||||
*/
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
/**
|
||||
* The fifth {@link ItemOptionEvent}, used mainly for dropping items.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public final class FifthItemOptionEvent extends ItemOptionEvent {
|
||||
|
||||
/**
|
||||
* Creates the fifth item option event.
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public FifthItemOptionEvent(int interfaceId, int id, int slot) {
|
||||
super(5, interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
/**
|
||||
* The first {@link ItemOptionEvent}, used for eating food or identifying herbs (amongst others).
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public final class FirstItemOptionEvent extends ItemOptionEvent {
|
||||
|
||||
/**
|
||||
* Creates the first item option event.
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public FirstItemOptionEvent(int interfaceId, int id, int slot) {
|
||||
super(1, interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
/**
|
||||
* The fourth {@link ItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public final class FourthItemOptionEvent extends ItemOptionEvent {
|
||||
|
||||
/**
|
||||
* Creates the fourth item option event.
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public FourthItemOptionEvent(int interfaceId, int id, int slot) {
|
||||
super(4, interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
import org.apollo.game.event.Event;
|
||||
|
||||
/**
|
||||
* An {@link Event} which represents some sort of action on an item in an inventory. Note that this is the parent of
|
||||
* both the item option and action event classes, and so cannot be used to determine when one of those events is fired.
|
||||
*
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public abstract class InventoryItemEvent extends Event {
|
||||
|
||||
/**
|
||||
* The option number (1-5).
|
||||
*/
|
||||
private final int option;
|
||||
|
||||
/**
|
||||
* The interface id.
|
||||
*/
|
||||
private final int interfaceId;
|
||||
|
||||
/**
|
||||
* The item id.
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* The item's slot.
|
||||
*/
|
||||
private final int slot;
|
||||
|
||||
/**
|
||||
* Creates the item action event.
|
||||
*
|
||||
* @param option The option number.
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
protected InventoryItemEvent(int option, int interfaceId, int id, int slot) {
|
||||
this.option = option;
|
||||
this.interfaceId = interfaceId;
|
||||
this.id = id;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the option number.
|
||||
*
|
||||
* @return The option number.
|
||||
*/
|
||||
public final int getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the interface id.
|
||||
*
|
||||
* @return The interface id.
|
||||
*/
|
||||
public final int getInterfaceId() {
|
||||
return interfaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item id.
|
||||
*
|
||||
* @return The item id.
|
||||
*/
|
||||
public final int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slot.
|
||||
*
|
||||
* @return The slot.
|
||||
*/
|
||||
public final int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,29 +5,9 @@ import org.apollo.game.event.Event;
|
||||
/**
|
||||
* An {@link Event} which represents some sort of action on an item.
|
||||
*
|
||||
* @author Graham
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public abstract class ItemActionEvent extends Event {
|
||||
|
||||
/**
|
||||
* The option number (1-5).
|
||||
*/
|
||||
private final int option;
|
||||
|
||||
/**
|
||||
* The interface id.
|
||||
*/
|
||||
private final int interfaceId;
|
||||
|
||||
/**
|
||||
* The item id.
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* The item's slot.
|
||||
*/
|
||||
private final int slot;
|
||||
public abstract class ItemActionEvent extends InventoryItemEvent {
|
||||
|
||||
/**
|
||||
* Creates the item action event.
|
||||
@@ -38,46 +18,7 @@ public abstract class ItemActionEvent extends Event {
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public ItemActionEvent(int option, int interfaceId, int id, int slot) {
|
||||
this.option = option;
|
||||
this.interfaceId = interfaceId;
|
||||
this.id = id;
|
||||
this.slot = slot;
|
||||
super(option, interfaceId, id, slot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item id.
|
||||
*
|
||||
* @return The item id.
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the interface id.
|
||||
*
|
||||
* @return The interface id.
|
||||
*/
|
||||
public int getInterfaceId() {
|
||||
return interfaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the option number.
|
||||
*
|
||||
* @return The option number.
|
||||
*/
|
||||
public int getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slot.
|
||||
*
|
||||
* @return The slot.
|
||||
*/
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
/**
|
||||
* An {@link InventoryItemEvent} which is sent by the client when an item's option is clicked (e.g. equip,
|
||||
* eat, drink, etc).
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public abstract class ItemOptionEvent extends InventoryItemEvent {
|
||||
|
||||
/**
|
||||
* Creates the item option event.
|
||||
*
|
||||
* @param option The option number.
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public ItemOptionEvent(int option, int interfaceId, int id, int slot) {
|
||||
super(option, interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
/**
|
||||
* The second {@link ItemOptionEvent}, used for equipping an item (amongst others?).
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public final class SecondItemOptionEvent extends ItemOptionEvent {
|
||||
|
||||
/**
|
||||
* Creates the second item option event.
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public SecondItemOptionEvent(int interfaceId, int id, int slot) {
|
||||
super(2, interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.apollo.game.event.impl;
|
||||
|
||||
/**
|
||||
* The third {@link ItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
public final class ThirdItemOptionEvent extends ItemOptionEvent {
|
||||
|
||||
/**
|
||||
* Creates the third item option event.
|
||||
* @param interfaceId The interface id.
|
||||
* @param id The id.
|
||||
* @param slot The slot.
|
||||
*/
|
||||
public ThirdItemOptionEvent(int interfaceId, int id, int slot) {
|
||||
super(3, interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.apollo.net.release.r317;
|
||||
|
||||
import org.apollo.game.event.impl.FifthItemOptionEvent;
|
||||
import org.apollo.net.codec.game.DataTransformation;
|
||||
import org.apollo.net.codec.game.DataType;
|
||||
import org.apollo.net.codec.game.GamePacket;
|
||||
import org.apollo.net.codec.game.GamePacketReader;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link FifthItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
final class FifthItemOptionEventDecoder extends EventDecoder<FifthItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public FifthItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT);
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
|
||||
return new FifthItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r317;
|
||||
|
||||
import org.apollo.game.event.impl.FirstItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link FirstItemOptionEvent}.
|
||||
* @author Graham
|
||||
*/
|
||||
final class FirstItemOptionEventDecoder extends EventDecoder<FirstItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public FirstItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int interfaceId = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
int id = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
|
||||
return new FirstItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r317;
|
||||
|
||||
import org.apollo.game.event.impl.FourthItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link FourthItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
final class FourthItemOptionEventDecoder extends EventDecoder<FourthItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public FourthItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int interfaceId = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
int slot = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
|
||||
return new FourthItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,7 +82,11 @@ public final class Release317 extends Release {
|
||||
register(132, new FirstObjectActionEventDecoder());
|
||||
register(252, new SecondObjectActionEventDecoder());
|
||||
register(70, new ThirdObjectActionEventDecoder());
|
||||
register(41, new EquipEventDecoder());
|
||||
register(122, new FirstItemOptionEventDecoder());
|
||||
register(41, new SecondItemOptionEventDecoder());
|
||||
register(16, new ThirdItemOptionEventDecoder());
|
||||
register(75, new FourthItemOptionEventDecoder());
|
||||
register(87, new FifthItemOptionEventDecoder());
|
||||
register(145, new FirstItemActionEventDecoder());
|
||||
register(117, new SecondItemActionEventDecoder());
|
||||
register(43, new ThirdItemActionEventDecoder());
|
||||
|
||||
+5
-6
@@ -1,6 +1,6 @@
|
||||
package org.apollo.net.release.r317;
|
||||
|
||||
import org.apollo.game.event.impl.EquipEvent;
|
||||
import org.apollo.game.event.impl.SecondItemOptionEvent;
|
||||
import org.apollo.net.codec.game.DataTransformation;
|
||||
import org.apollo.net.codec.game.DataType;
|
||||
import org.apollo.net.codec.game.GamePacket;
|
||||
@@ -8,19 +8,18 @@ import org.apollo.net.codec.game.GamePacketReader;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link EquipEvent}.
|
||||
*
|
||||
* An {@link EventDecoder} for the {@link SecondItemOptionEvent}.
|
||||
* @author Graham
|
||||
*/
|
||||
public final class EquipEventDecoder extends EventDecoder<EquipEvent> {
|
||||
final class SecondItemOptionEventDecoder extends EventDecoder<SecondItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public EquipEvent decode(GamePacket packet) {
|
||||
public SecondItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT);
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
return new EquipEvent(interfaceId, id, slot);
|
||||
return new SecondItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r317;
|
||||
|
||||
import org.apollo.game.event.impl.ThirdItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link ThirdItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
final class ThirdItemOptionEventDecoder extends EventDecoder<ThirdItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public ThirdItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
int slot = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
int interfaceId = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
|
||||
return new ThirdItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package org.apollo.net.release.r377;
|
||||
|
||||
import org.apollo.game.event.impl.EquipEvent;
|
||||
import org.apollo.net.codec.game.DataOrder;
|
||||
import org.apollo.net.codec.game.DataTransformation;
|
||||
import org.apollo.net.codec.game.DataType;
|
||||
import org.apollo.net.codec.game.GamePacket;
|
||||
import org.apollo.net.codec.game.GamePacketReader;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link EquipEvent}.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public final class EquipEventDecoder extends EventDecoder<EquipEvent> {
|
||||
|
||||
@Override
|
||||
public EquipEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
return new EquipEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r377;
|
||||
|
||||
import org.apollo.game.event.impl.FifthItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link FifthItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
final class FifthItemOptionEventDecoder extends EventDecoder<FifthItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public FifthItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
|
||||
return new FifthItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r377;
|
||||
|
||||
import org.apollo.game.event.impl.FirstItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link FirstItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
final class FirstItemOptionEventDecoder extends EventDecoder<FirstItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public FirstItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
|
||||
return new FirstItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r377;
|
||||
|
||||
import org.apollo.game.event.impl.FourthItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link FourthItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
final class FourthItemOptionEventDecoder extends EventDecoder<FourthItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public FourthItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT);
|
||||
|
||||
return new FourthItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,7 +82,11 @@ public final class Release377 extends Release {
|
||||
register(181, new FirstObjectActionEventDecoder());
|
||||
register(241, new SecondObjectActionEventDecoder());
|
||||
register(50, new ThirdObjectActionEventDecoder());
|
||||
register(24, new EquipEventDecoder());
|
||||
register(203, new FirstItemOptionEventDecoder());
|
||||
register(24, new SecondItemOptionEventDecoder());
|
||||
register(161, new ThirdItemOptionEventDecoder());
|
||||
register(228, new FourthItemOptionEventDecoder());
|
||||
register(4, new FifthItemOptionEventDecoder());
|
||||
register(3, new FirstItemActionEventDecoder());
|
||||
register(177, new SecondItemActionEventDecoder());
|
||||
register(91, new ThirdItemActionEventDecoder());
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r377;
|
||||
|
||||
import org.apollo.game.event.impl.SecondItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link SecondItemOptionEvent}.
|
||||
* @author Graham
|
||||
*/
|
||||
final class SecondItemOptionEventDecoder extends EventDecoder<SecondItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public SecondItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
|
||||
|
||||
return new SecondItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apollo.net.release.r377;
|
||||
|
||||
import org.apollo.game.event.impl.ThirdItemOptionEvent;
|
||||
import org.apollo.net.codec.game.*;
|
||||
import org.apollo.net.release.EventDecoder;
|
||||
|
||||
/**
|
||||
* An {@link EventDecoder} for the {@link ThirdItemOptionEvent}.
|
||||
* @author Chris Fletcher
|
||||
*/
|
||||
final class ThirdItemOptionEventDecoder extends EventDecoder<ThirdItemOptionEvent> {
|
||||
|
||||
@Override
|
||||
public ThirdItemOptionEvent decode(GamePacket packet) {
|
||||
GamePacketReader reader = new GamePacketReader(packet);
|
||||
|
||||
int slot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
|
||||
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
|
||||
|
||||
return new ThirdItemOptionEvent(interfaceId, id, slot);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user