Skip to content

Commit

Permalink
Removed non-working membership configs
Browse files Browse the repository at this point in the history
The game client ignores custom item masks and does not allow trading items with custom allow flags.
  • Loading branch information
neon-dev committed Jul 11, 2024
1 parent 1eba620 commit d551db0
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 110 deletions.
24 changes: 0 additions & 24 deletions game-server/config/main/membership.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,6 @@ gameserver.instances.quest.requirement = 10
# Default: 10
gameserver.instances.cooldown = 10

# All items can be storable in warehouse
# Default: 10
gameserver.store.wh.all = 10

# All items can be storable in account warehouse
# Default: 10
gameserver.store.accountwh.all = 10

# All items can be storable in legion warehouse
# Default: 10
gameserver.store.legionwh.all = 10

# All items can be tradeable
# Default: 10
gameserver.trade.all = 10

# Soulbound items can be tradeable
# Default: 10
gameserver.disable.soulbind = 10

# All items can be remodelable
# Default: 10
gameserver.remodel.all = 10

# All emotions available
# Default: 10
gameserver.emotions.all = 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ public class MembershipConfig {
@Property(key = "gameserver.instances.cooldown", defaultValue = "10")
public static byte INSTANCES_COOLDOWN;

@Property(key = "gameserver.store.wh.all", defaultValue = "10")
public static byte STORE_WH_ALL;

@Property(key = "gameserver.store.accountwh.all", defaultValue = "10")
public static byte STORE_AWH_ALL;

@Property(key = "gameserver.store.legionwh.all", defaultValue = "10")
public static byte STORE_LWH_ALL;

@Property(key = "gameserver.trade.all", defaultValue = "10")
public static byte TRADE_ALL;

@Property(key = "gameserver.disable.soulbind", defaultValue = "10")
public static byte DISABLE_SOULBIND;

@Property(key = "gameserver.remodel.all", defaultValue = "10")
public static byte REMODEL_ALL;

@Property(key = "gameserver.emotions.all", defaultValue = "10")
public static byte EMOTIONS_ALL;

Expand Down
61 changes: 12 additions & 49 deletions game-server/src/com/aionemu/gameserver/model/gameobjects/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.aionemu.gameserver.configs.main.MembershipConfig;
import com.aionemu.gameserver.dao.ItemStoneListDAO;
import com.aionemu.gameserver.dataholders.DataManager;
import com.aionemu.gameserver.model.Expirable;
Expand Down Expand Up @@ -550,13 +549,6 @@ public boolean isSoulBound() {
return isSoulBound;
}

private boolean isSoulBound(Player player) {
if (player.hasPermission(MembershipConfig.DISABLE_SOULBIND)) {
return false;
} else
return isSoulBound;
}

public void setSoulBound(boolean isSoulBound) {
this.isSoulBound = isSoulBound;
setPersistentState(PersistentState.UPDATE_REQUIRED);
Expand Down Expand Up @@ -630,57 +622,28 @@ public int getSockets(boolean isFusionItem) {
return 0;
}

public int getItemMask(Player player) {
return checkConfig(player, itemTemplate.getMask());
}

private int checkConfig(Player player, int mask) {
int newMask = mask;
if (player.hasPermission(MembershipConfig.STORE_WH_ALL)) {
newMask = newMask | ItemMask.STORABLE_IN_WH;
}
if (player.hasPermission(MembershipConfig.STORE_AWH_ALL)) {
newMask = newMask | ItemMask.STORABLE_IN_AWH;
}
if (player.hasPermission(MembershipConfig.STORE_LWH_ALL)) {
newMask = newMask | ItemMask.STORABLE_IN_LWH;
}
if (player.hasPermission(MembershipConfig.TRADE_ALL)) {
newMask = newMask | ItemMask.TRADEABLE;
}
if (player.hasPermission(MembershipConfig.REMODEL_ALL)) {
newMask = newMask | ItemMask.REMODELABLE;
}

return newMask;
}

public boolean isStorableinWarehouse(Player player) {
return (getItemMask(player) & ItemMask.STORABLE_IN_WH) == ItemMask.STORABLE_IN_WH;
public boolean isStorableInWarehouse() {
return (getItemMask() & ItemMask.STORABLE_IN_WH) == ItemMask.STORABLE_IN_WH;
}

public boolean isStorableinAccWarehouse(Player player) {
return (getItemMask(player) & ItemMask.STORABLE_IN_AWH) == ItemMask.STORABLE_IN_AWH && !isSoulBound(player);
public boolean isStorableInAccWarehouse() {
return (getItemMask() & ItemMask.STORABLE_IN_AWH) == ItemMask.STORABLE_IN_AWH && !isSoulBound();
}

public boolean isStorableinLegWarehouse(Player player) {
return (getItemMask(player) & ItemMask.STORABLE_IN_LWH) == ItemMask.STORABLE_IN_LWH && !isSoulBound(player);
public boolean isStorableInLegWarehouse() {
return (getItemMask() & ItemMask.STORABLE_IN_LWH) == ItemMask.STORABLE_IN_LWH && !isSoulBound();
}

public boolean isTradeable(Player player) {
return (getItemMask(player) & ItemMask.TRADEABLE) == ItemMask.TRADEABLE && !isSoulBound(player);
public boolean isTradeable() {
return (getItemMask() & ItemMask.TRADEABLE) == ItemMask.TRADEABLE && !isSoulBound();
}

public boolean isLegionTradeable(Player player, Player partner) {
if ((getItemMask(player) & ItemMask.LEGION_TRADEABLE) != ItemMask.LEGION_TRADEABLE || isSoulBound(player))
return false;
if (player.getLegion() == null || partner.getLegion() == null)
return false;
return player.getLegion().getLegionId() == partner.getLegion().getLegionId();
public boolean isLegionTradeable() {
return (getItemMask() & ItemMask.LEGION_TRADEABLE) == ItemMask.LEGION_TRADEABLE && !isSoulBound();
}

public boolean isRemodelable(Player player) {
return (getItemMask(player) & ItemMask.REMODELABLE) == ItemMask.REMODELABLE;
public boolean isRemodelable() {
return (getItemMask() & ItemMask.REMODELABLE) == ItemMask.REMODELABLE;
}

public boolean isSellable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GeneralInfoBlobEntry extends ItemBlobEntry {

@Override
public void writeThisBlob(ByteBuffer buf) {// TODO what with kinah?
writeH(buf, ownerItem.getItemMask(owner));
writeH(buf, ownerItem.getItemMask());
writeQ(buf, ownerItem.getItemCount());
writeS(buf, ownerItem.getItemCreator());// Creator name
writeC(buf, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public void registerItem(Player player, int itemUniqueId, long count, long price
}

// Check Trade Hack
if (itemToRegister.getPackCount() <= 0 && !itemToRegister.isTradeable(player))
if (itemToRegister.getPackCount() <= 0 && !itemToRegister.isTradeable())
return;

if (!AdminService.getInstance().canOperate(player, null, itemToRegister, "broker"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ public void addKinah(Player activePlayer, long itemCount) {
}
}

/**
* @param activePlayer
* @param itemObjId
* @param itemCount
*/
public void addItem(Player activePlayer, int itemObjId, long itemCount) {
Item item = activePlayer.getInventory().getItemByObjId(itemObjId);
if (item == null)
Expand All @@ -140,11 +135,10 @@ public void addItem(Player activePlayer, int itemObjId, long itemCount) {
Player partner = getCurrentParter(activePlayer);
if (partner == null)
return;
if (!TemporaryTradeTimeTask.getInstance().canTrade(item, partner.getObjectId()))
if (item.getPackCount() <= 0 && !item.isTradeable(activePlayer)) {
if (!item.isLegionTradeable(activePlayer, partner))
return;
}
if (item.getPackCount() <= 0 && !item.isTradeable() && !TemporaryTradeTimeTask.getInstance().canTrade(item, partner.getObjectId())) {
if (!item.isLegionTradeable() || activePlayer.getLegion() == null || !activePlayer.getLegion().equals(partner.getLegion()))
return;
}

if (itemCount < 1)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static boolean validateItem(PrivateStore store, Item item, TradePSItem p
PacketSendUtility.sendPacket(store.getOwner(), SM_SYSTEM_MESSAGE.STR_PERSONAL_SHOP_FULL_BASKET());
return false;
}
if (item.getPackCount() <= 0 && !item.isTradeable(store.getOwner())) {
if (item.getPackCount() <= 0 && !item.isTradeable()) {
PacketSendUtility.sendPacket(store.getOwner(), SM_SYSTEM_MESSAGE.STR_PERSONAL_SHOP_CANNOT_BE_EXCHANGED());
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ public static void remodelItem(Player player, int keepItemObjId, int extractItem
return;
}

if (!keepItem.isRemodelable(player)) {
if (!keepItem.isRemodelable()) {
PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_CHANGE_ITEM_SKIN_NOT_SKIN_CHANGABLE_ITEM(keepItem.getItemTemplate().getL10n()));
return;
}

if (!extractItem.isRemodelable(player)) {
if (!extractItem.isRemodelable()) {
PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_CHANGE_ITEM_SKIN_CAN_NOT_REMOVE_SKIN_ITEM(extractItem.getItemTemplate().getL10n()));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ public static boolean isItemRestrictedTo(Player player, Item item, byte storage)
StorageType type = StorageType.getStorageTypeById(storage);
switch (type) {
case REGULAR_WAREHOUSE:
if (!item.isStorableinWarehouse(player)) {
if (!item.isStorableInWarehouse()) {
// You cannot store this in the warehouse.
PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_WAREHOUSE_CANT_DEPOSIT_ITEM());
return true;
}
break;
case ACCOUNT_WAREHOUSE:
if (!item.isStorableinAccWarehouse(player)) {
if (!item.isStorableInAccWarehouse()) {
// You cannot store this item in the account warehouse.
PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_WAREHOUSE_CANT_ACCOUNT_DEPOSIT());
return true;
}
break;
case LEGION_WAREHOUSE:
if (!item.isStorableinLegWarehouse(player) || !LegionConfig.LEGION_WAREHOUSE) {
if (!item.isStorableInLegWarehouse() || !LegionConfig.LEGION_WAREHOUSE) {
// You cannot store this item in the Legion warehouse.
PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_WAREHOUSE_CANT_LEGION_DEPOSIT());
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static void sendMail(Player sender, String recipientName, String title, S
Item attachedItem = null;
if (senderItem != null) {
// Check Mailing untradables with Cash items (Special courier passes)
if (senderItem.getPackCount() <= 0 && !senderItem.isTradeable(sender)) {
if (senderItem.getPackCount() <= 0 && !senderItem.isTradeable()) {
Disposition dispo = senderItem.getItemTemplate().getDisposition();
if (dispo == null || dispo.getId() == 0 || dispo.getCount() == 0) // can not be traded, hack
return;
Expand Down

0 comments on commit d551db0

Please sign in to comment.