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),
Equipment (3, InventoryTabType.EQUIPMENT),
Relic (4, InventoryTabType.RELIC),
Usable (5),
Material (6),
Mission (7),
Usable (5, InventoryTabType.MATERIAL),
Material (6, InventoryTabType.MATERIAL),
Mission (7, InventoryTabType.MATERIAL),
Display (8);
private int val;
private InventoryTabType tabType = InventoryTabType.MATERIAL;
private InventoryTabType tabType;
private ItemMainType(int value) {
this.val = value;

View File

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

View File

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

View File

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