Minimum range for private stores.

This commit is contained in:
mobius 2015-01-02 11:43:45 +00:00
parent 45e2a035cd
commit ffc1c885bc
9 changed files with 138 additions and 0 deletions

View File

@ -554,3 +554,13 @@ MaxSpawnMobRange = 150
# Example: No random spawns for Kasha's Eye.
# MobsSpawnNotRandom = 18812,18813,18814
MobsSpawnNotRandom = 18812,18813,18814
# ---------------------------------------------------------------------------
# Minimum Range for Private Stores
# ---------------------------------------------------------------------------
# Minimum distance from player / npc to open a new private store
# Default: 0
ShopMinRangeFromPlayer = 50
ShopMinRangeFromNpc = 100

View File

@ -74,4 +74,78 @@
<node X="146233" Y="25938" />
<node X="148729" Y="25553" />
</zone>
<!-- EXTRA -->
<zone name="Giran - Luxury noshop" type="NoStoreZone" shape="Cuboid" minZ="-3700" maxZ="-2700">
<node X="79195" Y="146333" />
<node X="81220" Y="144785" />
</zone>
<zone name="Giran - Luxury noshop entrance" type="NoStoreZone" shape="Cuboid" minZ="-3700" maxZ="-2700">
<node X="81204" Y="145667" />
<node X="81477" Y="145428" />
</zone>
<zone name="Giran - Church noshop" type="NoStoreZone" shape="Cuboid" minZ="-3350" maxZ="-3450">
<node X="83743" Y="149247" />
<node X="85810" Y="147964" />
</zone>
<zone name="Aden - Square mid noshop" type="NoStoreZone" shape="Cuboid" minZ="-2150" maxZ="-2300">
<node X="147222" Y="27368" />
<node X="147703" Y="27805" />
</zone>
<zone name="Aden - Church stairs noshop" type="NoStoreZone" shape="Cuboid" minZ="-1900" maxZ="-2150">
<node X="146832" Y="22534" />
<node X="148199" Y="25661" />
</zone>
<!-- GIRAN HARBOR -->
<!--<zone name="Giran Harbor - Square" type="NoStoreZone" shape="NPoly" minZ="-3750" maxZ="-3330">
<node X="46005" Y="187291" />
<node X="46211" Y="187695" />
<node X="48611" Y="186414" />
<node X="49067" Y="185820" />
<node X="49168" Y="185913" />
<node X="50197" Y="184704" />
<node X="49266" Y="183908" />
<node X="47791" Y="185642" />
<node X="46130" Y="186520" />
<node X="46226" Y="186672" />
<node X="45798" Y="186897" />
<node X="45855" Y="187023" />
<node X="45667" Y="186988" />
<node X="45482" Y="186626" />
<node X="47714" Y="185410" />
<node X="49281" Y="183657" />
<node X="50403" Y="184666" />
<node X="48642" Y="186655" />
<node X="46183" Y="187946" />
<node X="45940" Y="187486" />
</zone>-->
<zone name="Giran Harbor - Main Entrance" type="NoStoreZone" shape="NPoly" minZ="-3750" maxZ="-3330">
<node X="47325" Y="185778" />
<node X="47627" Y="185615" />
<node X="47554" Y="185474" />
<node X="47250" Y="185631" />
</zone>
<zone name="Giran Harbor - Stairs 1" type="NoStoreZone" shape="NPoly" minZ="-3750" maxZ="-3330">
<node X="49353" Y="186074" />
<node X="50206" Y="185119" />
<node X="50049" Y="184978" />
<node X="49189" Y="185924" />
</zone>
<zone name="Giran Harbor - Stairs 2" type="NoStoreZone" shape="NPoly" minZ="-3750" maxZ="-3330">
<node X="47710" Y="187094" />
<node X="46586" Y="187701" />
<node X="46671" Y="187870" />
<node X="47799" Y="187265" />
</zone>
<zone name="Giran Harbor - Docks 1" type="NoStoreZone" shape="NPoly" minZ="-3750" maxZ="-3330">
<node X="49559" Y="185610" />
<node X="49763" Y="185382" />
<node X="52108" Y="187460" />
<node X="51891" Y="187699" />
</zone>
<zone name="Giran Harbor - Docks 2" type="NoStoreZone" shape="NPoly" minZ="-3750" maxZ="-3330">
<node X="47032" Y="187497" />
<node X="47304" Y="187361" />
<node X="48913" Y="190360" />
<node X="48638" Y="190508" />
</zone>
</list>

View File

@ -812,6 +812,8 @@ public final class Config
public static int MOB_MIN_SPAWN_RANGE;
public static int MOB_MAX_SPAWN_RANGE;
public static List<Integer> MOBS_LIST_NOT_RANDOM;
public static int SHOP_MIN_RANGE_FROM_NPC;
public static int SHOP_MIN_RANGE_FROM_PLAYER;
// --------------------------------------------------
// NPC Settings
@ -2594,6 +2596,9 @@ public final class Config
}
}
SHOP_MIN_RANGE_FROM_PLAYER = CustomSettings.getInt("ShopMinRangeFromPlayer", 50);
SHOP_MIN_RANGE_FROM_NPC = CustomSettings.getInt("ShopMinRangeFromNpc", 100);
// Load PvP L2Properties file (if exists)
final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE);

View File

@ -7073,4 +7073,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
return getTemplate().getRace();
}
public int getMinShopDistance()
{
return 0;
}
}

View File

@ -1939,4 +1939,10 @@ public class L2Npc extends L2Character
_summonedNpcs.clear();
}
}
@Override
public int getMinShopDistance()
{
return Config.SHOP_MIN_RANGE_FROM_NPC;
}
}

View File

@ -4712,9 +4712,27 @@ public final class L2PcInstance extends L2Playable
public boolean canOpenPrivateStore()
{
if ((Config.SHOP_MIN_RANGE_FROM_NPC > 0) || (Config.SHOP_MIN_RANGE_FROM_PLAYER > 0))
{
for (L2Character cha : getKnownList().getKnownCharacters())
{
if (Util.checkIfInRange(cha.getMinShopDistance(), this, cha, true))
{
sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_OPEN_A_PRIVATE_STORE_HERE));
return false;
}
}
}
return !isAlikeDead() && !isInOlympiadMode() && !isMounted() && !isInsideZone(ZoneId.NO_STORE) && !isCastingNow();
}
@Override
public int getMinShopDistance()
{
return (isSitting()) ? Config.SHOP_MIN_RANGE_FROM_PLAYER : 0;
}
public void tryOpenPrivateBuyStore()
{
// Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)

View File

@ -101,6 +101,12 @@ public final class RequestRecipeShopListSet extends L2GameClientPacket
return;
}
if (!player.canOpenPrivateStore())
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
List<L2RecipeList> dwarfRecipes = Arrays.asList(player.getDwarvenRecipeBook());
List<L2RecipeList> commonRecipes = Arrays.asList(player.getCommonRecipeBook());

View File

@ -116,6 +116,13 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
return;
}
if (!player.canOpenPrivateStore())
{
player.sendPacket(new PrivateStoreManageListBuy(player));
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
TradeList tradeList = player.getBuyList();
tradeList.clear();

View File

@ -111,6 +111,13 @@ public class SetPrivateStoreListSell extends L2GameClientPacket
return;
}
if (!player.canOpenPrivateStore())
{
player.sendPacket(new PrivateStoreManageListSell(player, _packageSale));
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// Check maximum number of allowed slots for pvt shops
if (_items.length > player.getPrivateSellStoreLimit())
{