Expect multisell NPC id to be properly set.
This commit is contained in:
@@ -241,10 +241,20 @@ public class MultisellData implements IXmlReader
|
||||
return;
|
||||
}
|
||||
|
||||
if (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))
|
||||
if (!template.isNpcAllowed(-1))
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": player " + player + " attempted to open multisell " + listId + " from npc " + npc + " which is not allowed!");
|
||||
return;
|
||||
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("Multisell " + listId + " is restricted. Under current conditions cannot be used. Only GMs are allowed to use it.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Player " + player + " attempted to open multisell " + listId + " from npc " + npc + " which is not allowed!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc);
|
||||
|
||||
@@ -95,11 +95,6 @@ public class ListContainer
|
||||
|
||||
public boolean isNpcAllowed(int npcId)
|
||||
{
|
||||
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId);
|
||||
}
|
||||
|
||||
public boolean isNpcOnly()
|
||||
{
|
||||
return _npcsAllowed != null;
|
||||
return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
|
||||
}
|
||||
}
|
||||
@@ -119,10 +119,20 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
final Npc npc = player.getLastFolkNPC();
|
||||
if (((npc != null) && !list.isNpcAllowed(npc.getId())) || ((npc == null) && list.isNpcOnly()))
|
||||
if (!list.isNpcAllowed(-1))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("Multisell " + _listId + " is restricted. Under current conditions cannot be used. Only GMs are allowed to use it.");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.isGM() && (npc != null))
|
||||
|
||||
Reference in New Issue
Block a user