mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-16 23:34:50 +01:00
Limit some types of items that the player can get
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user