Limit some types of items that the player can get

This commit is contained in:
Melledy
2023-12-05 06:19:38 -08:00
parent 107c592522
commit b2f9168076
4 changed files with 14 additions and 10 deletions

View File

@@ -10,13 +10,13 @@ public enum ItemMainType {
AvatarCard (2), AvatarCard (2),
Equipment (3, InventoryTabType.EQUIPMENT), Equipment (3, InventoryTabType.EQUIPMENT),
Relic (4, InventoryTabType.RELIC), Relic (4, InventoryTabType.RELIC),
Usable (5), Usable (5, InventoryTabType.MATERIAL),
Material (6), Material (6, InventoryTabType.MATERIAL),
Mission (7), Mission (7, InventoryTabType.MATERIAL),
Display (8); Display (8);
private int val; private int val;
private InventoryTabType tabType = InventoryTabType.MATERIAL; private InventoryTabType tabType;
private ItemMainType(int value) { private ItemMainType(int value) {
this.val = value; this.val = value;

View File

@@ -58,11 +58,11 @@ public class Inventory extends BasePlayerManager {
// Inventory tabs // Inventory tabs
public InventoryTab getTabByItemType(ItemMainType type) { public InventoryTab getTabByItemType(ItemMainType type) {
if (type == null) return null;
return getTab(type.getTabType()); return getTab(type.getTabType());
} }
public InventoryTab getTab(InventoryTabType type) { public InventoryTab getTab(InventoryTabType type) {
if (type == null) return null;
return this.inventoryTypes.get(type.getVal()); return this.inventoryTypes.get(type.getVal());
} }
@@ -207,6 +207,11 @@ public class Inventory extends BasePlayerManager {
getPlayer().addHeadIcon(item.getItemId()); getPlayer().addHeadIcon(item.getItemId());
return item; return item;
} }
// Skip if not food item
if (subType != ItemSubType.Food) {
return null;
}
default: default:
if (tab == null) { if (tab == null) {
return null; return null;

View File

@@ -4,9 +4,10 @@ import lombok.Getter;
@Getter @Getter
public enum InventoryTabType { public enum InventoryTabType {
MATERIAL (0), NONE (0),
EQUIPMENT (1), MATERIAL (1),
RELIC (2); EQUIPMENT (2),
RELIC (3);
private int val; private int val;

View File

@@ -31,8 +31,6 @@ public class CmdIdUtils {
* Packet ids that will NOT be caught by the spam filter * Packet ids that will NOT be caught by the spam filter
*/ */
public static final IntSet ALLOWED_FILTER_PACKETS = IntOpenHashSet.of( public static final IntSet ALLOWED_FILTER_PACKETS = IntOpenHashSet.of(
CmdId.PlayerGetTokenCsReq,
CmdId.PlayerLoginCsReq,
CmdId.PlayerHeartBeatCsReq, CmdId.PlayerHeartBeatCsReq,
CmdId.GetMissionStatusCsReq, CmdId.GetMissionStatusCsReq,
CmdId.GetMissionStatusCsReq, CmdId.GetMissionStatusCsReq,