Prime shop slot validation tempfix.
Contributed by Sero.
This commit is contained in:
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -78,7 +78,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
boolean hasItems = true;
|
boolean hasItems = true;
|
||||||
// First loop to validate all items
|
// First loop to validate all items.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -94,8 +94,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // This is always 0.
|
||||||
{ // this is always 0
|
{
|
||||||
if (player.getPrimePoints() < price)
|
if (player.getPrimePoints() < price)
|
||||||
{
|
{
|
||||||
hasItems = false;
|
hasItems = false;
|
||||||
@@ -111,7 +111,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second loop, only if all criteria has been met!
|
// Second loop, only if all criteria has been met!
|
||||||
// this should always be reached if player has all the coins needed for the purchase
|
// This should always be reached if player has all the coins needed for the purchase.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -232,6 +232,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -239,6 +241,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
@@ -78,7 +78,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
boolean hasItems = true;
|
boolean hasItems = true;
|
||||||
// First loop to validate all items
|
// First loop to validate all items.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -94,8 +94,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // This is always 0.
|
||||||
{ // this is always 0
|
{
|
||||||
if (player.getPrimePoints() < price)
|
if (player.getPrimePoints() < price)
|
||||||
{
|
{
|
||||||
hasItems = false;
|
hasItems = false;
|
||||||
@@ -111,7 +111,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second loop, only if all criteria has been met!
|
// Second loop, only if all criteria has been met!
|
||||||
// this should always be reached if player has all the coins needed for the purchase
|
// This should always be reached if player has all the coins needed for the purchase.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -232,6 +232,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -239,6 +241,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
@@ -78,7 +78,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
boolean hasItems = true;
|
boolean hasItems = true;
|
||||||
// First loop to validate all items
|
// First loop to validate all items.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -94,8 +94,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // This is always 0.
|
||||||
{ // this is always 0
|
{
|
||||||
if (player.getPrimePoints() < price)
|
if (player.getPrimePoints() < price)
|
||||||
{
|
{
|
||||||
hasItems = false;
|
hasItems = false;
|
||||||
@@ -111,7 +111,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second loop, only if all criteria has been met!
|
// Second loop, only if all criteria has been met!
|
||||||
// this should always be reached if player has all the coins needed for the purchase
|
// This should always be reached if player has all the coins needed for the purchase.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -232,6 +232,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -239,6 +241,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
@@ -78,7 +78,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
boolean hasItems = true;
|
boolean hasItems = true;
|
||||||
// First loop to validate all items
|
// First loop to validate all items.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -94,8 +94,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // This is always 0.
|
||||||
{ // this is always 0
|
{
|
||||||
if (player.getPrimePoints() < price)
|
if (player.getPrimePoints() < price)
|
||||||
{
|
{
|
||||||
hasItems = false;
|
hasItems = false;
|
||||||
@@ -111,7 +111,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second loop, only if all criteria has been met!
|
// Second loop, only if all criteria has been met!
|
||||||
// this should always be reached if player has all the coins needed for the purchase
|
// This should always be reached if player has all the coins needed for the purchase.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -232,6 +232,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -239,6 +241,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
@@ -78,7 +78,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
boolean hasItems = true;
|
boolean hasItems = true;
|
||||||
// First loop to validate all items
|
// First loop to validate all items.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -94,8 +94,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // This is always 0.
|
||||||
{ // this is always 0
|
{
|
||||||
if (player.getPrimePoints() < price)
|
if (player.getPrimePoints() < price)
|
||||||
{
|
{
|
||||||
hasItems = false;
|
hasItems = false;
|
||||||
@@ -111,7 +111,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second loop, only if all criteria has been met!
|
// Second loop, only if all criteria has been met!
|
||||||
// this should always be reached if player has all the coins needed for the purchase
|
// This should always be reached if player has all the coins needed for the purchase.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -232,6 +232,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -239,6 +241,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
@@ -78,7 +78,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
boolean hasItems = true;
|
boolean hasItems = true;
|
||||||
// First loop to validate all items
|
// First loop to validate all items.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -94,8 +94,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
hasItems = false;
|
hasItems = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // This is always 0.
|
||||||
{ // this is always 0
|
{
|
||||||
if (player.getPrimePoints() < price)
|
if (player.getPrimePoints() < price)
|
||||||
{
|
{
|
||||||
hasItems = false;
|
hasItems = false;
|
||||||
@@ -111,7 +111,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second loop, only if all criteria has been met!
|
// Second loop, only if all criteria has been met!
|
||||||
// this should always be reached if player has all the coins needed for the purchase
|
// This should always be reached if player has all the coins needed for the purchase.
|
||||||
for (ItemHolder itemHolder : validatePaymentId(item))
|
for (ItemHolder itemHolder : validatePaymentId(item))
|
||||||
{
|
{
|
||||||
final int paymentId = itemHolder.getId();
|
final int paymentId = itemHolder.getId();
|
||||||
@@ -232,6 +232,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -239,6 +241,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -193,6 +193,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -200,6 +202,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -209,7 +217,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -207,6 +207,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -214,6 +216,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -250,7 +258,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -207,6 +207,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -214,6 +216,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -250,7 +258,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
@@ -73,8 +73,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||||
if (validatePlayer(item, _count, player))
|
if (validatePlayer(item, _count, player))
|
||||||
{
|
{
|
||||||
final int price = (item.getPrice() * _count);
|
final int price = item.getPrice() * _count;
|
||||||
final int paymentId = validatePaymentId(item, price);
|
final int paymentId = validatePaymentId(item);
|
||||||
if (paymentId < 0)
|
if (paymentId < 0)
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||||
@@ -207,6 +207,8 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
final int weight = item.getWeight() * count;
|
final int weight = item.getWeight() * count;
|
||||||
final long slots = item.getCount() * count;
|
final long slots = item.getCount() * count;
|
||||||
if (player.getInventory().validateWeight(weight))
|
if (player.getInventory().validateWeight(weight))
|
||||||
|
{
|
||||||
|
if (item.getCount() == 1)
|
||||||
{
|
{
|
||||||
if (!player.getInventory().validateCapacity(slots))
|
if (!player.getInventory().validateCapacity(slots))
|
||||||
{
|
{
|
||||||
@@ -214,6 +216,12 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!player.getInventory().validateCapacity(count))
|
||||||
|
{
|
||||||
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTORY_OVERFLOW));
|
||||||
@@ -250,7 +258,7 @@ public class RequestBRBuyProduct implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int validatePaymentId(PrimeShopGroup item, long amount)
|
private static int validatePaymentId(PrimeShopGroup item)
|
||||||
{
|
{
|
||||||
switch (item.getPaymentType())
|
switch (item.getPaymentType())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user