Expect multisell NPC id to be properly set.

This commit is contained in:
MobiusDevelopment 2019-08-09 12:17:57 +00:00
parent efbbe7a3b7
commit f9031d41f9
56 changed files with 459 additions and 584 deletions

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<!-- Pc Bang Point --> <!-- Pc Bang Point -->
<ingredient count="600" id="-100" /> <ingredient count="600" id="-100" />

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<!-- PC - Apocalypse Weapons --> <!-- PC - Apocalypse Weapons -->
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="20000" id="-100" /> <ingredient count="20000" id="-100" />
<production count="1" id="34509" /> <production count="1" id="34509" />

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -113,7 +115,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -125,6 +129,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
final MultisellEntryHolder entry = list.getEntries().get(_entryId - 1); // Entry Id begins from 1. We currently use entry IDs as index pointer. final MultisellEntryHolder entry = list.getEntries().get(_entryId - 1); // Entry Id begins from 1. We currently use entry IDs as index pointer.
if (entry == null) if (entry == null)
@ -606,30 +620,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<!-- Pc Bang Point --> <!-- Pc Bang Point -->
<ingredient count="600" id="-100" /> <ingredient count="600" id="-100" />

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<!-- PC - Apocalypse Weapons --> <!-- PC - Apocalypse Weapons -->
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="20000" id="-100" /> <ingredient count="20000" id="-100" />
<production count="1" id="34509" /> <production count="1" id="34509" />

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<!-- Pc Bang Point --> <!-- Pc Bang Point -->
<ingredient count="600" id="-100" /> <ingredient count="600" id="-100" />

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<!-- PC - Apocalypse Weapons --> <!-- PC - Apocalypse Weapons -->
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="20000" id="-100" /> <ingredient count="20000" id="-100" />
<production count="1" id="34509" /> <production count="1" id="34509" />

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<!-- Pc Bang Point --> <!-- Pc Bang Point -->
<ingredient count="600" id="-100" /> <ingredient count="600" id="-100" />

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<!-- PC - Apocalypse Weapons --> <!-- PC - Apocalypse Weapons -->
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="20000" id="-100" /> <ingredient count="20000" id="-100" />
<production count="1" id="34509" /> <production count="1" id="34509" />

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="10000" id="-100" /> <!-- Pc Bang Point --> <ingredient count="10000" id="-100" /> <!-- Pc Bang Point -->
<production count="1" id="24357" /> <!-- Draco's Hat - Warrior --> <production count="1" id="24357" /> <!-- Draco's Hat - Warrior -->

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<!-- PC - Apocalypse Weapons --> <!-- PC - Apocalypse Weapons -->
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="20000" id="-100" /> <ingredient count="20000" id="-100" />
<production count="1" id="34509" /> <production count="1" id="34509" />

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="10000" id="-100" /> <!-- Pc Bang Point --> <ingredient count="10000" id="-100" /> <!-- Pc Bang Point -->
<production count="1" id="24357" /> <!-- Draco's Hat - Warrior --> <production count="1" id="24357" /> <!-- Draco's Hat - Warrior -->

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<!-- PC - Apocalypse Weapons --> <!-- PC - Apocalypse Weapons -->
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="20000" id="-100" /> <ingredient count="20000" id="-100" />
<production count="1" id="34509" /> <production count="1" id="34509" />

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="10000" id="-100" /> <!-- Pc Bang Point --> <ingredient count="10000" id="-100" /> <!-- Pc Bang Point -->
<production count="1" id="24357" /> <!-- Draco's Hat - Warrior --> <production count="1" id="24357" /> <!-- Draco's Hat - Warrior -->

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd"> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/multisell.xsd">
<!-- PC - Apocalypse Weapons --> <!-- PC - Apocalypse Weapons -->
<npcs>
<npc>-1</npc>
</npcs>
<item> <item>
<ingredient count="20000" id="-100" /> <ingredient count="20000" id="-100" />
<production count="1" id="34509" /> <production count="1" id="34509" />

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -241,11 +241,21 @@ public class MultisellData implements IXmlReader
return; 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!"); 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; return;
} }
}
}
final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc); final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc);

View File

@ -95,11 +95,6 @@ public class ListContainer
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -119,11 +119,21 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (((npc != null) && !list.isNpcAllowed(npc.getId())) || ((npc == null) && list.isNpcOnly())) if (!list.isNpcAllowed(-1))
{
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); player.setMultiSell(null);
return; return;
} }
}
}
if (!player.isGM() && (npc != null)) if (!player.isGM() && (npc != null))
{ {

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }

View File

@ -239,7 +239,9 @@ public class MultisellData implements IXmlReader
return; return;
} }
if (!template.isNpcAllowed(-1) && (((npc != null) && !template.isNpcAllowed(npc.getId())) || ((npc == null) && template.isNpcOnly()))) if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -251,6 +253,7 @@ public class MultisellData implements IXmlReader
return; return;
} }
} }
}
// Check if ingredient/product multipliers are set, if not, set them to the template value. // Check if ingredient/product multipliers are set, if not, set them to the template value.
ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier); ingredientMultiplier = (Double.isNaN(ingredientMultiplier) ? template.getIngredientMultiplier() : ingredientMultiplier);

View File

@ -102,11 +102,6 @@ public class MultisellListHolder implements IIdentifiable
public boolean isNpcAllowed(int npcId) public boolean isNpcAllowed(int npcId)
{ {
return (_npcsAllowed == null) || _npcsAllowed.contains(npcId); return (_npcsAllowed != null) && _npcsAllowed.contains(npcId);
}
public boolean isNpcOnly()
{
return _npcsAllowed != null;
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets; package org.l2jmobius.gameserver.network.clientpackets;
import static org.l2jmobius.gameserver.model.actor.Npc.INTERACTION_DISTANCE;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -130,7 +132,9 @@ public class MultiSellChoose implements IClientIncomingPacket
} }
final Npc npc = player.getLastFolkNPC(); final Npc npc = player.getLastFolkNPC();
if (!list.isNpcAllowed(-1) && !isAllowedToUse(player, npc, list)) if (!list.isNpcAllowed(-1))
{
if ((npc == null) || !list.isNpcAllowed(npc.getId()))
{ {
if (player.isGM()) if (player.isGM())
{ {
@ -142,6 +146,16 @@ public class MultiSellChoose implements IClientIncomingPacket
return; return;
} }
} }
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius3D(npc, INTERACTION_DISTANCE) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null))) if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
{ {
@ -650,30 +664,4 @@ public class MultiSellChoose implements IClientIncomingPacket
return true; return true;
} }
/**
* @param player
* @param npc
* @param list
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
*/
private boolean isAllowedToUse(PlayerInstance player, Npc npc, PreparedMultisellListHolder list)
{
if (npc != null)
{
if (!list.isNpcAllowed(npc.getId()))
{
return false;
}
else if (list.isNpcOnly() && (!list.checkNpcObjectId(npc.getObjectId()) || (npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius3D(npc, Npc.INTERACTION_DISTANCE)))
{
return false;
}
}
else if (list.isNpcOnly())
{
return false;
}
return true;
}
} }