Changed item count to integer.

This commit is contained in:
MobiusDevelopment
2022-05-04 11:12:58 +00:00
parent 7ab04da480
commit 5103871cce
155 changed files with 661 additions and 663 deletions
@@ -23,8 +23,8 @@ import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.ItemChanceHolder; import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
import ai.AbstractNpcAI; import ai.AbstractNpcAI;
@@ -124,7 +124,7 @@ public class Alexandria extends AbstractNpcAI
{ {
private final int _additionalId; private final int _additionalId;
AdditionalItemChanceHolder(int id, int chance, long count, int additionalId) AdditionalItemChanceHolder(int id, int chance, int count, int additionalId)
{ {
super(id, chance, count); super(id, chance, count);
_additionalId = additionalId; _additionalId = additionalId;
@@ -803,7 +803,7 @@ public class CastleChamberlain extends AbstractNpcAI
{ {
if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES))
{ {
final long amount = (st.hasMoreTokens()) ? Long.parseLong(st.nextToken()) : 0; final int amount = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0;
if ((amount > 0) && (amount < Inventory.MAX_ADENA)) if ((amount > 0) && (amount < Inventory.MAX_ADENA))
{ {
if (player.getAdena() >= amount) if (player.getAdena() >= amount)
@@ -828,7 +828,7 @@ public class CastleChamberlain extends AbstractNpcAI
{ {
if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES)) if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_TAXES))
{ {
final long amount = (st.hasMoreTokens()) ? Long.parseLong(st.nextToken()) : 0; final int amount = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0;
if (amount <= castle.getTreasury()) if (amount <= castle.getTreasury())
{ {
castle.addToTreasuryNoTax((-1) * amount); castle.addToTreasuryNoTax((-1) * amount);
@@ -1276,7 +1276,7 @@ public class CastleChamberlain extends AbstractNpcAI
final int ticketCount = castle.getTicketBuyCount(); final int ticketCount = castle.getTicketBuyCount();
if (ticketCount < (Config.SSQ_DAWN_TICKET_QUANTITY / Config.SSQ_DAWN_TICKET_BUNDLE)) if (ticketCount < (Config.SSQ_DAWN_TICKET_QUANTITY / Config.SSQ_DAWN_TICKET_BUNDLE))
{ {
final long totalCost = Config.SSQ_DAWN_TICKET_PRICE * Config.SSQ_DAWN_TICKET_BUNDLE; final int totalCost = Config.SSQ_DAWN_TICKET_PRICE * Config.SSQ_DAWN_TICKET_BUNDLE;
if (player.getAdena() >= totalCost) if (player.getAdena() >= totalCost)
{ {
takeItems(player, Inventory.ADENA_ID, totalCost); takeItems(player, Inventory.ADENA_ID, totalCost);
@@ -87,9 +87,9 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
for (int i = 0; i < spotLeft; i++) for (int i = 0; i < spotLeft; i++)
{ {
long counter = 0; int counter = 0;
Clan clan = null; Clan clan = null;
for (Entry<Integer, Long> entry : _warDecreesCount.entrySet()) for (Entry<Integer, Integer> entry : _warDecreesCount.entrySet())
{ {
final Clan actingClan = ClanTable.getInstance().getClan(entry.getKey()); final Clan actingClan = ClanTable.getInstance().getClan(entry.getKey());
if ((actingClan == null) || (actingClan.getDissolvingExpiryTime() > 0)) if ((actingClan == null) || (actingClan.getDissolvingExpiryTime() > 0))
@@ -98,7 +98,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
continue; continue;
} }
final long count = entry.getValue(); final int count = entry.getValue();
if (count > counter) if (count > counter)
{ {
counter = count; counter = count;
@@ -259,7 +259,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
private static final Skill[] DEBUFFS = {}; private static final Skill[] DEBUFFS = {};
protected static Map<Integer, Long> _warDecreesCount = new HashMap<>(); protected static Map<Integer, Integer> _warDecreesCount = new HashMap<>();
protected static List<Clan> _acceptedClans = new ArrayList<>(4); protected static List<Clan> _acceptedClans = new ArrayList<>(4);
private static Map<String, List<Clan>> _usedTextPassages = new HashMap<>(); private static Map<String, List<Clan>> _usedTextPassages = new HashMap<>();
private static Map<Clan, Integer> _pendingItemToGet = new HashMap<>(); private static Map<Clan, Integer> _pendingItemToGet = new HashMap<>();
@@ -393,7 +393,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
} }
else else
{ {
final long count = warDecrees.getCount(); final int count = warDecrees.getCount();
_warDecreesCount.put(clan.getId(), count); _warDecreesCount.put(clan.getId(), count);
player.destroyItem("Rainbow Springs Registration", warDecrees, npc, true); player.destroyItem("Rainbow Springs Registration", warDecrees, npc, true);
updateAttacker(clan.getId(), count, false); updateAttacker(clan.getId(), count, false);
@@ -832,7 +832,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
return false; return false;
} }
private void updateAttacker(int clanId, long count, boolean remove) private void updateAttacker(int clanId, int count, boolean remove)
{ {
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection())
{ {
@@ -846,7 +846,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
{ {
statement = con.prepareStatement("INSERT INTO rainbowsprings_attacker_list VALUES (?,?)"); statement = con.prepareStatement("INSERT INTO rainbowsprings_attacker_list VALUES (?,?)");
statement.setInt(1, clanId); statement.setInt(1, clanId);
statement.setLong(2, count); statement.setInt(2, count);
} }
statement.execute(); statement.execute();
statement.close(); statement.close();
@@ -867,7 +867,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
while (rset.next()) while (rset.next())
{ {
final int clanId = rset.getInt("clan_id"); final int clanId = rset.getInt("clan_id");
final long count = rset.getLong("decrees_count"); final int count = rset.getInt("decrees_count");
_warDecreesCount.put(clanId, count); _warDecreesCount.put(clanId, count);
} }
rset.close(); rset.close();
@@ -266,7 +266,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
final StringTokenizer st = new StringTokenizer(params, " "); final StringTokenizer st = new StringTokenizer(params, " ");
int skillId = -1; int skillId = -1;
long price = -1; int price = -1;
if (st.hasMoreTokens()) if (st.hasMoreTokens())
{ {
@@ -59,7 +59,7 @@ public class AdminCreateItem implements IAdminCommandHandler
final String id = st.nextToken(); final String id = st.nextToken();
final int idval = Integer.parseInt(id); final int idval = Integer.parseInt(id);
final String num = st.nextToken(); final String num = st.nextToken();
final long numval = Long.parseLong(num); final int numval = Integer.parseInt(num);
createItem(activeChar, activeChar, idval, numval); createItem(activeChar, activeChar, idval, numval);
} }
else if (st.countTokens() == 1) else if (st.countTokens() == 1)
@@ -92,7 +92,7 @@ public class AdminCreateItem implements IAdminCommandHandler
if (idval > 0) if (idval > 0)
{ {
final String num = st.nextToken(); final String num = st.nextToken();
final long numval = Long.parseLong(num); final int numval = Integer.parseInt(num);
createItem(activeChar, activeChar, idval, numval); createItem(activeChar, activeChar, idval, numval);
} }
} }
@@ -131,7 +131,7 @@ public class AdminCreateItem implements IAdminCommandHandler
final String id = st.nextToken(); final String id = st.nextToken();
final int idval = Integer.parseInt(id); final int idval = Integer.parseInt(id);
final String num = st.nextToken(); final String num = st.nextToken();
final long numval = Long.parseLong(num); final int numval = Integer.parseInt(num);
createItem(activeChar, (Player) target, idval, numval); createItem(activeChar, (Player) target, idval, numval);
} }
else if (st.countTokens() == 1) else if (st.countTokens() == 1)
@@ -156,13 +156,13 @@ public class AdminCreateItem implements IAdminCommandHandler
final String val = command.substring(22); final String val = command.substring(22);
final StringTokenizer st = new StringTokenizer(val); final StringTokenizer st = new StringTokenizer(val);
int idval = 0; int idval = 0;
long numval = 0; int numval = 0;
if (st.countTokens() == 2) if (st.countTokens() == 2)
{ {
final String id = st.nextToken(); final String id = st.nextToken();
idval = Integer.parseInt(id); idval = Integer.parseInt(id);
final String num = st.nextToken(); final String num = st.nextToken();
numval = Long.parseLong(num); numval = Integer.parseInt(num);
} }
else if (st.countTokens() == 1) else if (st.countTokens() == 1)
{ {
@@ -202,7 +202,7 @@ public class AdminCreateItem implements IAdminCommandHandler
return ADMIN_COMMANDS; return ADMIN_COMMANDS;
} }
private void createItem(Player activeChar, Player target, int id, long num) private void createItem(Player activeChar, Player target, int id, int num)
{ {
final ItemTemplate template = ItemTable.getInstance().getTemplate(id); final ItemTemplate template = ItemTable.getInstance().getTemplate(id);
if (template == null) if (template == null)
@@ -172,14 +172,14 @@ public class Festival implements IBypassHandler
player.sendMessage("You do not have any blood offerings to contribute."); player.sendMessage("You do not have any blood offerings to contribute.");
return true; return true;
} }
final long offeringScore = bloodOfferings.getCount() * SevenSignsFestival.FESTIVAL_OFFERING_VALUE; final int offeringScore = bloodOfferings.getCount() * SevenSignsFestival.FESTIVAL_OFFERING_VALUE;
if (!player.destroyItem("SevenSigns", bloodOfferings, npc, false)) if (!player.destroyItem("SevenSigns", bloodOfferings, npc, false))
{ {
return true; return true;
} }
final boolean isHighestScore = SevenSignsFestival.getInstance().setFinalScore(player, npc.getFestivalOracle(), npc.getFestivalType(), offeringScore); final boolean isHighestScore = SevenSignsFestival.getInstance().setFinalScore(player, npc.getFestivalOracle(), npc.getFestivalType(), offeringScore);
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CONTRIBUTION_SCORE_HAS_INCREASED_BY_S1); final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CONTRIBUTION_SCORE_HAS_INCREASED_BY_S1);
sm.addLong(offeringScore); sm.addInt(offeringScore);
player.sendPacket(sm); player.sendPacket(sm);
if (isHighestScore) if (isHighestScore)
{ {
@@ -188,7 +188,7 @@ public class Loto implements IBypassHandler
return; return;
} }
final long price = Config.ALT_LOTTERY_TICKET_PRICE; final int price = Config.ALT_LOTTERY_TICKET_PRICE;
final int lotonumber = Lottery.getInstance().getId(); final int lotonumber = Lottery.getInstance().getId();
int enchant = 0; int enchant = 0;
int type2 = 0; int type2 = 0;
@@ -270,10 +270,10 @@ public class Loto implements IBypassHandler
{ {
message += numbers[i] + " "; message += numbers[i] + " ";
} }
final long[] check = Lottery.getInstance().checkTicket(item); final int[] check = Lottery.getInstance().checkTicket(item);
if (check[0] > 0) if (check[0] > 0)
{ {
switch ((int) check[0]) switch (check[0])
{ {
case 1: case 1:
{ {
@@ -320,13 +320,13 @@ public class Loto implements IBypassHandler
{ {
return; return;
} }
final long[] check = Lottery.getInstance().checkTicket(item); final int[] check = Lottery.getInstance().checkTicket(item);
sm = new SystemMessage(SystemMessageId.S1_HAS_DISAPPEARED); sm = new SystemMessage(SystemMessageId.S1_HAS_DISAPPEARED);
sm.addItemName(4442); sm.addItemName(4442);
player.sendPacket(sm); player.sendPacket(sm);
final long adena = check[1]; final int adena = check[1];
if (adena > 0) if (adena > 0)
{ {
player.addAdena("Loto", adena, npc, true); player.addAdena("Loto", adena, npc, true);
@@ -124,7 +124,7 @@ public class Observation implements IBypassHandler
} }
final int[] locCost = LOCATIONS[param]; final int[] locCost = LOCATIONS[param];
final Location loc = new Location(locCost[0], locCost[1], locCost[2]); final Location loc = new Location(locCost[0], locCost[1], locCost[2]);
final long cost = locCost[3]; final int cost = locCost[3];
switch (_command) switch (_command)
{ {
@@ -154,7 +154,7 @@ public class Observation implements IBypassHandler
return false; return false;
} }
private void doObserve(Player player, Npc npc, Location pos, long cost) private void doObserve(Player player, Npc npc, Location pos, int cost)
{ {
if (player.reduceAdena("Broadcast", cost, npc, true)) if (player.reduceAdena("Broadcast", cost, npc, true))
{ {
@@ -90,7 +90,7 @@ public class RentPet implements IBypassHandler
} }
int petId; int petId;
double price = 1; int price = 1;
final int[] cost = final int[] cost =
{ {
1800, 1800,
@@ -125,7 +125,7 @@ public class RentPet implements IBypassHandler
price *= cost[value - 1]; price *= cost[value - 1];
final int time = ridetime[value - 1]; final int time = ridetime[value - 1];
if (!player.reduceAdena("Rent", (long) price, player.getLastFolkNPC(), true)) if (!player.reduceAdena("Rent", price, player.getLastFolkNPC(), true))
{ {
return; return;
} }
@@ -79,7 +79,7 @@ public class Harvesting extends AbstractEffect
{ {
sm = new SystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S2_S1); sm = new SystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S2_S1);
sm.addItemName(item.getId()); sm.addItemName(item.getId());
sm.addLong(item.getCount()); sm.addInt(item.getCount());
} }
player.sendPacket(sm); player.sendPacket(sm);
@@ -96,7 +96,7 @@ public class Harvesting extends AbstractEffect
{ {
sm = new SystemMessage(SystemMessageId.C1_HARVESTED_S3_S2_S); sm = new SystemMessage(SystemMessageId.C1_HARVESTED_S3_S2_S);
sm.addString(player.getName()); sm.addString(player.getName());
sm.addLong(item.getCount()); sm.addInt(item.getCount());
sm.addItemName(item.getId()); sm.addItemName(item.getId());
} }
player.getParty().broadcastToPartyMembers(player, sm); player.getParty().broadcastToPartyMembers(player, sm);
@@ -111,7 +111,7 @@ public class RestorationRandom extends AbstractEffect
continue; continue;
} }
final long itemCount = (long) (item.getCount() * Config.RATE_EXTRACTABLE); final int itemCount = (int) (item.getCount() * Config.RATE_EXTRACTABLE);
final ItemTemplate template = ItemTable.getInstance().getTemplate(item.getId()); final ItemTemplate template = ItemTable.getInstance().getTemplate(item.getId());
if (template.isStackable()) if (template.isStackable())
{ {
@@ -53,14 +53,14 @@ public class Give implements ITelnetCommand
if (player != null) if (player != null)
{ {
final int itemId = Integer.parseInt(args[1]); final int itemId = Integer.parseInt(args[1]);
long amount = 1; int amount = 1;
int enchanted = 0; int enchanted = 0;
if (args.length > 2) if (args.length > 2)
{ {
String token = args[2]; String token = args[2];
if (Util.isDigit(token)) if (Util.isDigit(token))
{ {
amount = Long.parseLong(token); amount = Integer.parseInt(token);
} }
if (args.length > 3) if (args.length > 3)
{ {
@@ -90,7 +90,7 @@ public class Wedding implements IVoicedCommandHandler
final int partnerId = activeChar.getPartnerId(); final int partnerId = activeChar.getPartnerId();
final int coupleId = activeChar.getCoupleId(); final int coupleId = activeChar.getCoupleId();
long adenaAmount = 0; int adenaAmount = 0;
if (activeChar.isMarried()) if (activeChar.isMarried())
{ {
activeChar.sendMessage("You are now divorced."); activeChar.sendMessage("You are now divorced.");
@@ -279,7 +279,7 @@ public class Q00045_ToTalkingIsland extends Quest
final int cond = i.getId(); final int cond = i.getId();
if (qs.isCond(cond)) if (qs.isCond(cond))
{ {
final int itemId = (int) i.getCount(); final int itemId = i.getCount();
if (hasQuestItems(talker, itemId)) if (hasQuestItems(talker, itemId))
{ {
htmltext = npc.getId() + "-01.html"; htmltext = npc.getId() + "-01.html";
@@ -279,7 +279,7 @@ public class Q00046_OnceMoreInTheArmsOfTheMotherTree extends Quest
final int cond = i.getId(); final int cond = i.getId();
if (qs.isCond(cond)) if (qs.isCond(cond))
{ {
final int itemId = (int) i.getCount(); final int itemId = i.getCount();
if (hasQuestItems(talker, itemId)) if (hasQuestItems(talker, itemId))
{ {
htmltext = npc.getId() + "-01.html"; htmltext = npc.getId() + "-01.html";
@@ -279,7 +279,7 @@ public class Q00047_IntoTheDarkElvenForest extends Quest
final int cond = i.getId(); final int cond = i.getId();
if (qs.isCond(cond)) if (qs.isCond(cond))
{ {
final int itemId = (int) i.getCount(); final int itemId = i.getCount();
if (hasQuestItems(talker, itemId)) if (hasQuestItems(talker, itemId))
{ {
htmltext = npc.getId() + "-01.html"; htmltext = npc.getId() + "-01.html";
@@ -279,7 +279,7 @@ public class Q00048_ToTheImmortalPlateau extends Quest
final int cond = i.getId(); final int cond = i.getId();
if (qs.isCond(cond)) if (qs.isCond(cond))
{ {
final int itemId = (int) i.getCount(); final int itemId = i.getCount();
if (hasQuestItems(talker, itemId)) if (hasQuestItems(talker, itemId))
{ {
htmltext = npc.getId() + "-01.html"; htmltext = npc.getId() + "-01.html";
@@ -279,7 +279,7 @@ public class Q00049_TheRoadHome extends Quest
final int cond = i.getId(); final int cond = i.getId();
if (qs.isCond(cond)) if (qs.isCond(cond))
{ {
final int itemId = (int) i.getCount(); final int itemId = i.getCount();
if (hasQuestItems(talker, itemId)) if (hasQuestItems(talker, itemId))
{ {
htmltext = npc.getId() + "-01.html"; htmltext = npc.getId() + "-01.html";
@@ -40,7 +40,7 @@ public class Q00257_TheGuardIsBusy extends Quest
private final int _chance; private final int _chance;
private final int _random; private final int _random;
public MobDrop(int random, int chance, int id, long count) public MobDrop(int random, int chance, int id, int count)
{ {
super(id, count); super(id, count);
_random = random; _random = random;
@@ -157,8 +157,8 @@ public class Q00257_TheGuardIsBusy extends Quest
{ {
if (hasAtLeastOneQuestItem(player, ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG)) if (hasAtLeastOneQuestItem(player, ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG))
{ {
final long amulets = getQuestItemsCount(player, ORC_AMULET); final int amulets = getQuestItemsCount(player, ORC_AMULET);
final long common = getQuestItemsCount(player, ORC_NECKLACE, WEREWOLF_FANG); final int common = getQuestItemsCount(player, ORC_NECKLACE, WEREWOLF_FANG);
giveAdena(player, ((amulets * 10) + (common * 20) + (((amulets + common) >= 10) ? 1000 : 0)), true); giveAdena(player, ((amulets * 10) + (common * 20) + (((amulets + common) >= 10) ? 1000 : 0)), true);
takeItems(player, -1, ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG); takeItems(player, -1, ORC_AMULET, ORC_NECKLACE, WEREWOLF_FANG);
htmltext = "30039-07.html"; htmltext = "30039-07.html";
@@ -154,7 +154,7 @@ public class Q00259_RequestFromTheFarmOwner extends Quest
{ {
if (hasQuestItems(player, SPIDER_SKIN)) if (hasQuestItems(player, SPIDER_SKIN))
{ {
final long skins = getQuestItemsCount(player, SPIDER_SKIN); final int skins = getQuestItemsCount(player, SPIDER_SKIN);
giveAdena(player, (skins * SKIN_REWARD) + ((skins >= 10) ? SKIN_BONUS : 0), true); giveAdena(player, (skins * SKIN_REWARD) + ((skins >= 10) ? SKIN_BONUS : 0), true);
takeItems(player, SPIDER_SKIN, -1); takeItems(player, SPIDER_SKIN, -1);
htmltext = "30497-05.html"; htmltext = "30497-05.html";
@@ -122,8 +122,8 @@ public class Q00260_OrcHunting extends Quest
{ {
if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) if (hasAtLeastOneQuestItem(player, getRegisteredItemIds()))
{ {
final long amulets = getQuestItemsCount(player, ORC_AMULET); final int amulets = getQuestItemsCount(player, ORC_AMULET);
final long necklaces = getQuestItemsCount(player, ORC_NECKLACE); final int necklaces = getQuestItemsCount(player, ORC_NECKLACE);
giveAdena(player, ((amulets * 12) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1000 : 0)), true); giveAdena(player, ((amulets * 12) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1000 : 0)), true);
takeItems(player, -1, getRegisteredItemIds()); takeItems(player, -1, getRegisteredItemIds());
htmltext = "30221-06.html"; htmltext = "30221-06.html";
@@ -120,8 +120,8 @@ public class Q00263_OrcSubjugation extends Quest
{ {
if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) if (hasAtLeastOneQuestItem(player, getRegisteredItemIds()))
{ {
final long amulets = getQuestItemsCount(player, ORC_AMULET); final int amulets = getQuestItemsCount(player, ORC_AMULET);
final long necklaces = getQuestItemsCount(player, ORC_NECKLACE); final int necklaces = getQuestItemsCount(player, ORC_NECKLACE);
giveAdena(player, ((amulets * 20) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1100 : 0)), true); giveAdena(player, ((amulets * 20) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1100 : 0)), true);
takeItems(player, -1, getRegisteredItemIds()); takeItems(player, -1, getRegisteredItemIds());
htmltext = "30346-06.html"; htmltext = "30346-06.html";
@@ -117,7 +117,7 @@ public class Q00265_BondsOfSlavery extends Quest
{ {
if (hasQuestItems(player, IMP_SHACKLES)) if (hasQuestItems(player, IMP_SHACKLES))
{ {
final long shackles = getQuestItemsCount(player, IMP_SHACKLES); final int shackles = getQuestItemsCount(player, IMP_SHACKLES);
giveAdena(player, (shackles * 12) + (shackles >= 10 ? 500 : 0), true); giveAdena(player, (shackles * 12) + (shackles >= 10 ? 500 : 0), true);
takeItems(player, IMP_SHACKLES, -1); takeItems(player, IMP_SHACKLES, -1);
htmltext = "30357-06.html"; htmltext = "30357-06.html";
@@ -109,7 +109,7 @@ public class Q00267_WrathOfVerdure extends Quest
{ {
if (hasQuestItems(player, GOBLIN_CLUB)) if (hasQuestItems(player, GOBLIN_CLUB))
{ {
final long count = getQuestItemsCount(player, GOBLIN_CLUB); final int count = getQuestItemsCount(player, GOBLIN_CLUB);
rewardItems(player, SILVERY_LEAF, count); rewardItems(player, SILVERY_LEAF, count);
if (count >= 10) if (count >= 10)
{ {
@@ -124,8 +124,8 @@ public class Q00273_InvadersOfTheHolyLand extends Quest
{ {
if (hasAtLeastOneQuestItem(player, BLACK_SOULSTONE, RED_SOULSTONE)) if (hasAtLeastOneQuestItem(player, BLACK_SOULSTONE, RED_SOULSTONE))
{ {
final long black = getQuestItemsCount(player, BLACK_SOULSTONE); final int black = getQuestItemsCount(player, BLACK_SOULSTONE);
final long red = getQuestItemsCount(player, RED_SOULSTONE); final int red = getQuestItemsCount(player, RED_SOULSTONE);
giveAdena(player, (red * 10) + (black * 3) + ((red > 0) ? (((red + black) >= 10) ? 1800 : 0) : ((black >= 10) ? 1500 : 0)), true); giveAdena(player, (red * 10) + (black * 3) + ((red > 0) ? (((red + black) >= 10) ? 1800 : 0) : ((black >= 10) ? 1500 : 0)), true);
takeItems(player, -1, BLACK_SOULSTONE, RED_SOULSTONE); takeItems(player, -1, BLACK_SOULSTONE, RED_SOULSTONE);
htmltext = (red > 0) ? "30566-07.html" : "30566-06.html"; htmltext = (red > 0) ? "30566-07.html" : "30566-06.html";
@@ -120,10 +120,10 @@ public class Q00274_SkirmishWithTheWerewolves extends Quest
} }
case 2: case 2:
{ {
final long heads = getQuestItemsCount(player, WEREWOLF_HEAD); final int heads = getQuestItemsCount(player, WEREWOLF_HEAD);
if (heads >= 40) if (heads >= 40)
{ {
final long totems = getQuestItemsCount(player, WEREWOLF_TOTEM); final int totems = getQuestItemsCount(player, WEREWOLF_TOTEM);
giveAdena(player, (heads * 30) + (totems * 600) + 2300, true); giveAdena(player, (heads * 30) + (totems * 600) + 2300, true);
qs.exitQuest(true, true); qs.exitQuest(true, true);
htmltext = (totems > 0) ? "30569-07.html" : "30569-06.html"; htmltext = (totems > 0) ? "30569-07.html" : "30569-06.html";
@@ -145,7 +145,7 @@ public class Q00275_DarkWingedSpies extends Quest
} }
case 2: case 2:
{ {
final long count = getQuestItemsCount(talker, DARKWING_BAT_FANG); final int count = getQuestItemsCount(talker, DARKWING_BAT_FANG);
if (count >= MAX_BAT_FANG_COUNT) if (count >= MAX_BAT_FANG_COUNT)
{ {
giveAdena(talker, count * FANG_PRICE, true); giveAdena(talker, count * FANG_PRICE, true);
@@ -165,10 +165,10 @@ public class Q00292_BrigandsSweep extends Quest
} }
else else
{ {
final long necklaces = getQuestItemsCount(talker, GOBLIN_NECKLACE); final int necklaces = getQuestItemsCount(talker, GOBLIN_NECKLACE);
final long pendants = getQuestItemsCount(talker, GOBLIN_PENDANT); final int pendants = getQuestItemsCount(talker, GOBLIN_PENDANT);
final long lordPendants = getQuestItemsCount(talker, GOBLIN_LORD_PENDANT); final int lordPendants = getQuestItemsCount(talker, GOBLIN_LORD_PENDANT);
final long sum = necklaces + pendants + lordPendants; final int sum = necklaces + pendants + lordPendants;
if (sum > 0) if (sum > 0)
{ {
giveAdena(talker, (necklaces * 12) + (pendants * 36) + (lordPendants * 33) + (sum >= 10 ? 1000 : 0), true); giveAdena(talker, (necklaces * 12) + (pendants * 36) + (lordPendants * 33) + (sum >= 10 ? 1000 : 0), true);
@@ -144,8 +144,8 @@ public class Q00293_TheHiddenVeins extends Quest
{ {
if (hasAtLeastOneQuestItem(player, CHRYSOLITE_ORE, HIDDEN_ORE_MAP)) if (hasAtLeastOneQuestItem(player, CHRYSOLITE_ORE, HIDDEN_ORE_MAP))
{ {
final long ores = getQuestItemsCount(player, CHRYSOLITE_ORE); final int ores = getQuestItemsCount(player, CHRYSOLITE_ORE);
final long maps = getQuestItemsCount(player, HIDDEN_ORE_MAP); final int maps = getQuestItemsCount(player, HIDDEN_ORE_MAP);
giveAdena(player, (ores * 5) + (maps * 500) + (((ores + maps) >= 10) ? 2000 : 0), true); giveAdena(player, (ores * 5) + (maps * 500) + (((ores + maps) >= 10) ? 2000 : 0), true);
takeItems(player, -1, CHRYSOLITE_ORE, HIDDEN_ORE_MAP); takeItems(player, -1, CHRYSOLITE_ORE, HIDDEN_ORE_MAP);
htmltext = (ores > 0) ? (maps > 0) ? "30535-10.html" : "30535-06.html" : "30535-09.html"; htmltext = (ores > 0) ? (maps > 0) ? "30535-10.html" : "30535-06.html" : "30535-09.html";
@@ -145,7 +145,7 @@ public class Q00296_TarantulasSpiderSilk extends Quest
{ {
if (npc.getId() == TRADER_MION) if (npc.getId() == TRADER_MION)
{ {
final long silk = getQuestItemsCount(talker, TARANTULA_SPIDER_SILK); final int silk = getQuestItemsCount(talker, TARANTULA_SPIDER_SILK);
if (silk >= 1) if (silk >= 1)
{ {
giveAdena(talker, (silk * 30) + (silk >= 10 ? 2000 : 0), true); giveAdena(talker, (silk * 30) + (silk >= 10 ? 2000 : 0), true);
@@ -137,8 +137,8 @@ public class Q00306_CrystalOfFireAndIce extends Quest
{ {
if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) if (hasAtLeastOneQuestItem(player, getRegisteredItemIds()))
{ {
final long flame = getQuestItemsCount(player, FLAME_SHARD); final int flame = getQuestItemsCount(player, FLAME_SHARD);
final long ice = getQuestItemsCount(player, ICE_SHARD); final int ice = getQuestItemsCount(player, ICE_SHARD);
giveAdena(player, ((flame * 40) + (ice * 40) + ((flame + ice) >= 10 ? 5000 : 0)), true); giveAdena(player, ((flame * 40) + (ice * 40) + ((flame + ice) >= 10 ? 5000 : 0)), true);
takeItems(player, -1, getRegisteredItemIds()); takeItems(player, -1, getRegisteredItemIds());
htmltext = "30004-07.html"; htmltext = "30004-07.html";
@@ -152,8 +152,8 @@ public class Q00316_DestroyPlagueCarriers extends Quest
{ {
if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) if (hasAtLeastOneQuestItem(player, getRegisteredItemIds()))
{ {
final long wererars = getQuestItemsCount(player, WERERAT_FANG); final int wererars = getQuestItemsCount(player, WERERAT_FANG);
final long foulclaws = getQuestItemsCount(player, VAROOL_FOULCLAW_FANG); final int foulclaws = getQuestItemsCount(player, VAROOL_FOULCLAW_FANG);
giveAdena(player, ((wererars * 30) + (foulclaws * 10000) + ((wererars + foulclaws) >= 10 ? 5000 : 0)), true); giveAdena(player, ((wererars * 30) + (foulclaws * 10000) + ((wererars + foulclaws) >= 10 ? 5000 : 0)), true);
takeItems(player, -1, getRegisteredItemIds()); takeItems(player, -1, getRegisteredItemIds());
htmltext = "30155-07.html"; htmltext = "30155-07.html";
@@ -74,7 +74,7 @@ public class Q00317_CatchTheWind extends Quest
case "30361-08.html": case "30361-08.html":
case "30361-09.html": case "30361-09.html":
{ {
final long shardCount = getQuestItemsCount(player, WIND_SHARD); final int shardCount = getQuestItemsCount(player, WIND_SHARD);
if (shardCount > 0) if (shardCount > 0)
{ {
giveAdena(player, ((shardCount * 40) + (shardCount >= 10 ? 2988 : 0)), true); giveAdena(player, ((shardCount * 40) + (shardCount >= 10 ? 2988 : 0)), true);
@@ -133,19 +133,19 @@ public class Q00325_GrimCollector extends Quest
case "30434-06.html": case "30434-06.html":
case "30434-07.html": case "30434-07.html":
{ {
final long head = getQuestItemsCount(player, ZOMBIE_HEAD); final int head = getQuestItemsCount(player, ZOMBIE_HEAD);
final long heart = getQuestItemsCount(player, ZOMBIE_HEART); final int heart = getQuestItemsCount(player, ZOMBIE_HEART);
final long liver = getQuestItemsCount(player, ZOMBIE_LIVER); final int liver = getQuestItemsCount(player, ZOMBIE_LIVER);
final long skull = getQuestItemsCount(player, SKULL); final int skull = getQuestItemsCount(player, SKULL);
final long rib = getQuestItemsCount(player, RIB_BONE); final int rib = getQuestItemsCount(player, RIB_BONE);
final long spine = getQuestItemsCount(player, SPINE); final int spine = getQuestItemsCount(player, SPINE);
final long arm = getQuestItemsCount(player, ARM_BONE); final int arm = getQuestItemsCount(player, ARM_BONE);
final long thigh = getQuestItemsCount(player, THIGH_BONE); final int thigh = getQuestItemsCount(player, THIGH_BONE);
final long complete = getQuestItemsCount(player, COMPLETE_SKELETON); final int complete = getQuestItemsCount(player, COMPLETE_SKELETON);
final long totalCount = (head + heart + liver + skull + rib + spine + arm + thigh + complete); final int totalCount = (head + heart + liver + skull + rib + spine + arm + thigh + complete);
if (totalCount > 0) if (totalCount > 0)
{ {
long sum = ((head * 30) + (heart * 20) + (liver * 20) + (skull * 100) + (rib * 40) + (spine * 14) + (arm * 14) + (thigh * 14)); int sum = ((head * 30) + (heart * 20) + (liver * 20) + (skull * 100) + (rib * 40) + (spine * 14) + (arm * 14) + (thigh * 14));
if (totalCount >= 10) if (totalCount >= 10)
{ {
sum += 1629; sum += 1629;
@@ -171,7 +171,7 @@ public class Q00325_GrimCollector extends Quest
} }
case "30434-09.html": case "30434-09.html":
{ {
final long complete = getQuestItemsCount(player, COMPLETE_SKELETON); final int complete = getQuestItemsCount(player, COMPLETE_SKELETON);
if (complete > 0) if (complete > 0)
{ {
giveAdena(player, ((complete * 341) + 543), true); giveAdena(player, ((complete * 341) + 543), true);
@@ -124,10 +124,10 @@ public class Q00326_VanquishRemnants extends Quest
} }
case State.STARTED: case State.STARTED:
{ {
final long red_badges = getQuestItemsCount(player, RED_CROSS_BADGE); final int red_badges = getQuestItemsCount(player, RED_CROSS_BADGE);
final long blue_badges = getQuestItemsCount(player, BLUE_CROSS_BADGE); final int blue_badges = getQuestItemsCount(player, BLUE_CROSS_BADGE);
final long black_badges = getQuestItemsCount(player, BLACK_CROSS_BADGE); final int black_badges = getQuestItemsCount(player, BLACK_CROSS_BADGE);
final long sum = red_badges + blue_badges + black_badges; final int sum = red_badges + blue_badges + black_badges;
if (sum > 0) if (sum > 0)
{ {
if ((sum >= 100) && !hasQuestItems(player, BLACK_LION_MARK)) if ((sum >= 100) && !hasQuestItems(player, BLACK_LION_MARK))
@@ -415,9 +415,9 @@ public class Q00327_RecoverTheFarmland extends Quest
else else
{ {
html = "30597-05.html"; html = "30597-05.html";
final long dogTags = getQuestItemsCount(player, TUREK_DOG_TAG); final int dogTags = getQuestItemsCount(player, TUREK_DOG_TAG);
final long medallions = getQuestItemsCount(player, TUREK_MEDALLION); final int medallions = getQuestItemsCount(player, TUREK_MEDALLION);
final long rewardCount = (dogTags * 40) + (medallions * 50) + (((dogTags + medallions) >= 10) ? 619 : 0); final int rewardCount = (dogTags * 40) + (medallions * 50) + (((dogTags + medallions) >= 10) ? 619 : 0);
giveAdena(player, rewardCount, true); giveAdena(player, rewardCount, true);
takeItems(player, TUREK_DOG_TAG, -1); takeItems(player, TUREK_DOG_TAG, -1);
takeItems(player, TUREK_MEDALLION, -1); takeItems(player, TUREK_MEDALLION, -1);
@@ -109,9 +109,9 @@ public class Q00328_SenseForBusiness extends Quest
} }
case State.STARTED: case State.STARTED:
{ {
final long carcass = getQuestItemsCount(player, MONSTER_EYE_CARCASS); final int carcass = getQuestItemsCount(player, MONSTER_EYE_CARCASS);
final long lens = getQuestItemsCount(player, MONSTER_EYE_LENS); final int lens = getQuestItemsCount(player, MONSTER_EYE_LENS);
final long gizzards = getQuestItemsCount(player, BASILISK_GIZZARD); final int gizzards = getQuestItemsCount(player, BASILISK_GIZZARD);
if ((carcass + lens + gizzards) > 0) if ((carcass + lens + gizzards) > 0)
{ {
giveAdena(player, ((carcass * MONSTER_EYE_CARCASS_ADENA) + (lens * MONSTER_EYE_LENS_ADENA) + (gizzards * BASILISK_GIZZARD_ADENA) + ((carcass + lens + gizzards) >= BONUS_COUNT ? BONUS : 0)), true); giveAdena(player, ((carcass * MONSTER_EYE_CARCASS_ADENA) + (lens * MONSTER_EYE_LENS_ADENA) + (gizzards * BASILISK_GIZZARD_ADENA) + ((carcass + lens + gizzards) >= BONUS_COUNT ? BONUS : 0)), true);
@@ -131,8 +131,8 @@ public class Q00329_CuriosityOfADwarf extends Quest
{ {
if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) if (hasAtLeastOneQuestItem(player, getRegisteredItemIds()))
{ {
final long broken = getQuestItemsCount(player, BROKEN_HEARTSTONE); final int broken = getQuestItemsCount(player, BROKEN_HEARTSTONE);
final long golem = getQuestItemsCount(player, GOLEM_HEARTSTONE); final int golem = getQuestItemsCount(player, GOLEM_HEARTSTONE);
giveAdena(player, ((broken * 50) + (golem * 1000) + ((broken + golem) >= 10 ? 1183 : 0)), true); giveAdena(player, ((broken * 50) + (golem * 1000) + ((broken + golem) >= 10 ? 1183 : 0)), true);
takeItems(player, -1, getRegisteredItemIds()); takeItems(player, -1, getRegisteredItemIds());
htmltext = "30437-05.html"; htmltext = "30437-05.html";
@@ -108,9 +108,9 @@ public class Q00331_ArrowOfVengeance extends Quest
} }
case State.STARTED: case State.STARTED:
{ {
final long harpyFeathers = getQuestItemsCount(player, HARPY_FEATHER); final int harpyFeathers = getQuestItemsCount(player, HARPY_FEATHER);
final long medusaVenoms = getQuestItemsCount(player, MEDUSA_VENOM); final int medusaVenoms = getQuestItemsCount(player, MEDUSA_VENOM);
final long wyrmsTeeth = getQuestItemsCount(player, WYRMS_TOOTH); final int wyrmsTeeth = getQuestItemsCount(player, WYRMS_TOOTH);
if ((harpyFeathers + medusaVenoms + wyrmsTeeth) > 0) if ((harpyFeathers + medusaVenoms + wyrmsTeeth) > 0)
{ {
giveAdena(player, ((harpyFeathers * HARPY_FEATHER_ADENA) + (medusaVenoms * MEDUSA_VENOM_ADENA) + (wyrmsTeeth * WYRMS_TOOTH_ADENA) + ((harpyFeathers + medusaVenoms + wyrmsTeeth) >= BONUS_COUNT ? BONUS : 0)), true); giveAdena(player, ((harpyFeathers * HARPY_FEATHER_ADENA) + (medusaVenoms * MEDUSA_VENOM_ADENA) + (wyrmsTeeth * WYRMS_TOOTH_ADENA) + ((harpyFeathers + medusaVenoms + wyrmsTeeth) >= BONUS_COUNT ? BONUS : 0)), true);
@@ -1064,10 +1064,10 @@ public class Q00333_HuntOfTheBlackLion extends Quest
{ {
giveItems(player, LIONS_CLAW, 3); giveItems(player, LIONS_CLAW, 3);
} }
final long ash = getQuestItemsCount(player, UNDEAD_ASH); final int ash = getQuestItemsCount(player, UNDEAD_ASH);
final long insignia = getQuestItemsCount(player, BLOODY_AXE_INSIGNIA); final int insignia = getQuestItemsCount(player, BLOODY_AXE_INSIGNIA);
final long fang = getQuestItemsCount(player, DELU_LIZARDMAN_FANG); final int fang = getQuestItemsCount(player, DELU_LIZARDMAN_FANG);
final long talon = getQuestItemsCount(player, STAKATO_TALON); final int talon = getQuestItemsCount(player, STAKATO_TALON);
giveAdena(player, ((ash * 35) + (insignia * 35) + ((fang + 35) + (talon * 35))), true); giveAdena(player, ((ash * 35) + (insignia * 35) + ((fang + 35) + (talon * 35))), true);
takeItems(player, UNDEAD_ASH, -1); takeItems(player, UNDEAD_ASH, -1);
takeItems(player, BLOODY_AXE_INSIGNIA, -1); takeItems(player, BLOODY_AXE_INSIGNIA, -1);
@@ -114,7 +114,7 @@ public class Q00344_1000YearsTheEndOfLamentation extends Quest
{ {
if (qs.isCond(1)) if (qs.isCond(1))
{ {
final long count = getQuestItemsCount(player, ARTICLES); final int count = getQuestItemsCount(player, ARTICLES);
if (count < 1) if (count < 1)
{ {
htmltext = "30754-07.html"; htmltext = "30754-07.html";
@@ -103,7 +103,7 @@ public class Q00345_MethodToRaiseTheDead extends Quest
} }
case "30971-03.html": case "30971-03.html":
{ {
final long uselessBonePiecesCount = getQuestItemsCount(player, USELESS_BONE_PIECES); final int uselessBonePiecesCount = getQuestItemsCount(player, USELESS_BONE_PIECES);
if (uselessBonePiecesCount > 0) if (uselessBonePiecesCount > 0)
{ {
giveAdena(player, uselessBonePiecesCount * 104, true); giveAdena(player, uselessBonePiecesCount * 104, true);
@@ -318,7 +318,7 @@ public class Q00345_MethodToRaiseTheDead extends Quest
case 8: case 8:
{ {
final int memoStateEx = qs.getMemoStateEx(1); final int memoStateEx = qs.getMemoStateEx(1);
final long uselessBonePiecesCount = getQuestItemsCount(player, USELESS_BONE_PIECES); final int uselessBonePiecesCount = getQuestItemsCount(player, USELESS_BONE_PIECES);
if ((memoStateEx == 1) || (memoStateEx == 2)) if ((memoStateEx == 1) || (memoStateEx == 2))
{ {
giveItems(player, BILL_OF_IASON_HEINE, 3); giveItems(player, BILL_OF_IASON_HEINE, 3);
@@ -931,7 +931,7 @@ public class Q00348_AnArrogantSearch extends Quest
} }
else else
{ {
final long bloodedFabricCount = getQuestItemsCount(player, BLOODED_FABRIC); final int bloodedFabricCount = getQuestItemsCount(player, BLOODED_FABRIC);
if (bloodedFabricCount >= 10) if (bloodedFabricCount >= 10)
{ {
htmltext = "30864-46.html"; htmltext = "30864-46.html";
@@ -95,14 +95,14 @@ public class Q00351_BlackSwan extends Quest
} }
case "30969-02.html": case "30969-02.html":
{ {
final long lizardFangCount = getQuestItemsCount(player, LIZARD_FANG); final int lizardFangCount = getQuestItemsCount(player, LIZARD_FANG);
if (lizardFangCount == 0) if (lizardFangCount == 0)
{ {
htmltext = event; htmltext = event;
} }
else else
{ {
final long adenaBonus = (lizardFangCount >= 10) ? 3880 : 0; final int adenaBonus = (lizardFangCount >= 10) ? 3880 : 0;
giveAdena(player, adenaBonus + (20 * lizardFangCount), true); giveAdena(player, adenaBonus + (20 * lizardFangCount), true);
takeItems(player, LIZARD_FANG, -1); takeItems(player, LIZARD_FANG, -1);
htmltext = "30969-04.html"; htmltext = "30969-04.html";
@@ -111,7 +111,7 @@ public class Q00351_BlackSwan extends Quest
} }
case "30969-05.html": case "30969-05.html":
{ {
final long barrelOfLeagueCount = getQuestItemsCount(player, BARREL_OF_LEAGUE); final int barrelOfLeagueCount = getQuestItemsCount(player, BARREL_OF_LEAGUE);
if (barrelOfLeagueCount == 0) if (barrelOfLeagueCount == 0)
{ {
htmltext = event; htmltext = event;
@@ -149,29 +149,29 @@ public class Q00352_HelpRoodRaiseANewPet extends Quest
} }
else if (qs.isStarted()) else if (qs.isStarted())
{ {
final long LienrikEgg1Count = getQuestItemsCount(player, LIENRIK_EGG1); final int lienrikEgg1Count = getQuestItemsCount(player, LIENRIK_EGG1);
final long LienrikEgg2Count = getQuestItemsCount(player, LIENRIK_EGG2); final int lienrikEgg2Count = getQuestItemsCount(player, LIENRIK_EGG2);
if ((LienrikEgg1Count == 0) && (LienrikEgg2Count == 0)) if ((lienrikEgg1Count == 0) && (lienrikEgg2Count == 0))
{ {
htmltext = "31067-06.html"; htmltext = "31067-06.html";
} }
else if ((LienrikEgg1Count >= 1) && (LienrikEgg2Count == 0)) else if ((lienrikEgg1Count >= 1) && (lienrikEgg2Count == 0))
{ {
if (LienrikEgg1Count >= 10) if (lienrikEgg1Count >= 10)
{ {
giveAdena(player, (LienrikEgg1Count * 34) + 4000, true); giveAdena(player, (lienrikEgg1Count * 34) + 4000, true);
} }
else else
{ {
giveAdena(player, (LienrikEgg1Count * 34) + 2000, true); giveAdena(player, (lienrikEgg1Count * 34) + 2000, true);
} }
takeItems(player, LIENRIK_EGG1, -1); takeItems(player, LIENRIK_EGG1, -1);
htmltext = "31067-10.html"; htmltext = "31067-10.html";
} }
else if (LienrikEgg1Count >= 1) else if (lienrikEgg1Count >= 1)
{ {
giveAdena(player, 4000 + ((LienrikEgg1Count * 34) + (LienrikEgg2Count * 1025)), true); giveAdena(player, 4000 + ((lienrikEgg1Count * 34) + (lienrikEgg2Count * 1025)), true);
takeItems(player, LIENRIK_EGG1, -1); takeItems(player, LIENRIK_EGG1, -1);
takeItems(player, LIENRIK_EGG2, -1); takeItems(player, LIENRIK_EGG2, -1);
htmltext = "31067-11.html"; htmltext = "31067-11.html";
@@ -78,7 +78,7 @@ public class Q00353_PowerOfDarkness extends Quest
} }
case State.STARTED: case State.STARTED:
{ {
final long stones = getQuestItemsCount(player, STONE); final int stones = getQuestItemsCount(player, STONE);
if (stones == 0) if (stones == 0)
{ {
htmltext = "31044-05.htm"; htmltext = "31044-05.htm";
@@ -88,7 +88,7 @@ public class Q00354_ConquestOfAlligatorIsland extends Quest
} }
case "ADENA": case "ADENA":
{ {
final long count = getQuestItemsCount(player, ALLIGATOR_TOOTH); final int count = getQuestItemsCount(player, ALLIGATOR_TOOTH);
if (count >= 100) if (count >= 100)
{ {
giveAdena(player, (count * 220) + 10700, true); giveAdena(player, (count * 220) + 10700, true);
@@ -113,7 +113,7 @@ public class Q00355_FamilyHonor extends Quest
} }
case "30181-06.html": case "30181-06.html":
{ {
final long galfredoRomersBustCount = getQuestItemsCount(player, GALFREDO_ROMERS_BUST); final int galfredoRomersBustCount = getQuestItemsCount(player, GALFREDO_ROMERS_BUST);
if (galfredoRomersBustCount < 1) if (galfredoRomersBustCount < 1)
{ {
htmltext = event; htmltext = event;
@@ -134,7 +134,7 @@ public class Q00355_FamilyHonor extends Quest
} }
case "30181-10.html": case "30181-10.html":
{ {
final long galfredoRomersBustCount = getQuestItemsCount(player, GALFREDO_ROMERS_BUST); final int galfredoRomersBustCount = getQuestItemsCount(player, GALFREDO_ROMERS_BUST);
if (galfredoRomersBustCount > 0) if (galfredoRomersBustCount > 0)
{ {
giveAdena(player, galfredoRomersBustCount * 120, true); giveAdena(player, galfredoRomersBustCount * 120, true);
@@ -83,10 +83,10 @@ public class Q00357_WarehouseKeepersAmbition extends Quest
} }
case "30686-09.html": case "30686-09.html":
{ {
final long crystalCount = getQuestItemsCount(player, JADE_CRYSTAL); final int crystalCount = getQuestItemsCount(player, JADE_CRYSTAL);
if (crystalCount > 0) if (crystalCount > 0)
{ {
long adenaReward = crystalCount * 425; int adenaReward = crystalCount * 425;
if (crystalCount < 100) if (crystalCount < 100)
{ {
adenaReward += 13500; adenaReward += 13500;
@@ -104,7 +104,7 @@ public class Q00357_WarehouseKeepersAmbition extends Quest
} }
case "30686-11.html": case "30686-11.html":
{ {
final long crystalCount = getQuestItemsCount(player, JADE_CRYSTAL); final int crystalCount = getQuestItemsCount(player, JADE_CRYSTAL);
if (crystalCount > 0) if (crystalCount > 0)
{ {
giveAdena(player, (crystalCount * 425) + ((crystalCount >= 100) ? 40500 : 0), true); giveAdena(player, (crystalCount * 425) + ((crystalCount >= 100) ? 40500 : 0), true);
@@ -138,8 +138,8 @@ public class Q00360_PlunderTheirSupplies extends Quest
} }
case State.STARTED: case State.STARTED:
{ {
final long supplyCount = getQuestItemsCount(player, SUPPLY_ITEMS); final int supplyCount = getQuestItemsCount(player, SUPPLY_ITEMS);
final long recipeCount = getQuestItemsCount(player, RECIPE_OF_SUPPLY); final int recipeCount = getQuestItemsCount(player, RECIPE_OF_SUPPLY);
if (supplyCount == 0) if (supplyCount == 0)
{ {
if (recipeCount == 0) if (recipeCount == 0)
@@ -224,7 +224,7 @@ public class Q00365_DevilsLegacy extends Quest
{ {
if (hasQuestItems(player, PIRATES_TREASURE_CHEST)) if (hasQuestItems(player, PIRATES_TREASURE_CHEST))
{ {
final long chestCount = getQuestItemsCount(player, PIRATES_TREASURE_CHEST); final int chestCount = getQuestItemsCount(player, PIRATES_TREASURE_CHEST);
giveAdena(player, (chestCount * 400) + 19800, true); giveAdena(player, (chestCount * 400) + 19800, true);
takeItems(player, PIRATES_TREASURE_CHEST, -1); takeItems(player, PIRATES_TREASURE_CHEST, -1);
htmltext = "30095-04.html"; htmltext = "30095-04.html";
@@ -121,7 +121,7 @@ public class Q00366_SilverHairedShaman extends Quest
{ {
if (hasQuestItems(player, SAIRONS_SILVER_HAIR)) if (hasQuestItems(player, SAIRONS_SILVER_HAIR))
{ {
final long itemCount = getQuestItemsCount(player, SAIRONS_SILVER_HAIR); final int itemCount = getQuestItemsCount(player, SAIRONS_SILVER_HAIR);
giveAdena(player, (itemCount * 500) + 29000, true); giveAdena(player, (itemCount * 500) + 29000, true);
takeItems(player, SAIRONS_SILVER_HAIR, -1); takeItems(player, SAIRONS_SILVER_HAIR, -1);
htmltext = "30111-04.html"; htmltext = "30111-04.html";
@@ -128,8 +128,8 @@ public class Q00368_TrespassingIntoTheHolyGround extends Quest
{ {
if (hasQuestItems(player, BLADE_STAKATO_FANG)) if (hasQuestItems(player, BLADE_STAKATO_FANG))
{ {
final long count = getQuestItemsCount(player, BLADE_STAKATO_FANG); final int count = getQuestItemsCount(player, BLADE_STAKATO_FANG);
final long bonus = (count >= 10 ? 9450 : 2000); final int bonus = (count >= 10 ? 9450 : 2000);
giveAdena(player, (count * 250) + bonus, true); giveAdena(player, (count * 250) + bonus, true);
takeItems(player, BLADE_STAKATO_FANG, -1); takeItems(player, BLADE_STAKATO_FANG, -1);
htmltext = "30926-04.html"; htmltext = "30926-04.html";
@@ -167,19 +167,19 @@ public class Q00370_AnElderSowsSeeds extends Quest
return htmltext; return htmltext;
} }
private final boolean exchangeChapters(Player player, boolean takeAllItems) private boolean exchangeChapters(Player player, boolean takeAllItems)
{ {
final long waterChapters = getQuestItemsCount(player, CHAPTER_OF_WATER); final int waterChapters = getQuestItemsCount(player, CHAPTER_OF_WATER);
final long earthChapters = getQuestItemsCount(player, CHAPTER_OF_EARTH); final int earthChapters = getQuestItemsCount(player, CHAPTER_OF_EARTH);
final long windChapters = getQuestItemsCount(player, CHAPTER_OF_WIND); final int windChapters = getQuestItemsCount(player, CHAPTER_OF_WIND);
final long fireChapters = getQuestItemsCount(player, CHAPTER_OF_FIRE); final int fireChapters = getQuestItemsCount(player, CHAPTER_OF_FIRE);
final long minCount = Util.min(waterChapters, earthChapters, windChapters, fireChapters); final int minCount = Util.min(waterChapters, earthChapters, windChapters, fireChapters);
if (minCount > 0) if (minCount > 0)
{ {
giveAdena(player, minCount * 3600, true); giveAdena(player, minCount * 3600, true);
} }
final long countToTake = (takeAllItems ? -1 : minCount); final int countToTake = (takeAllItems ? -1 : minCount);
takeItems(player, (int) countToTake, CHAPTER_OF_WATER, CHAPTER_OF_EARTH, CHAPTER_OF_WIND, CHAPTER_OF_FIRE); takeItems(player, countToTake, CHAPTER_OF_WATER, CHAPTER_OF_EARTH, CHAPTER_OF_WIND, CHAPTER_OF_FIRE);
return (minCount > 0); return (minCount > 0);
} }
} }
@@ -104,7 +104,7 @@ public class Q00371_ShrieksOfGhosts extends Quest
} }
case "30867-05.html": case "30867-05.html":
{ {
final long ancientAshUrnCount = getQuestItemsCount(player, ANCIENT_ASH_URN); final int ancientAshUrnCount = getQuestItemsCount(player, ANCIENT_ASH_URN);
if (ancientAshUrnCount < 1) if (ancientAshUrnCount < 1)
{ {
htmltext = event; htmltext = event;
@@ -230,7 +230,7 @@ public class Q00378_GrandFeast extends Quest
takeItems(player, RITRONS_DESSERT_RECIPE, 1); takeItems(player, RITRONS_DESSERT_RECIPE, 1);
int item = 0; int item = 0;
int adena = 0; int adena = 0;
long quantity = 0; int quantity = 0;
switch (qs.getMemoStateEx(1)) switch (qs.getMemoStateEx(1))
{ {
case 11: case 11:
@@ -136,7 +136,7 @@ public class Q00510_AClansPrestige extends Quest
} }
else else
{ {
final int count = (int) getQuestItemsCount(player, TYRANNOSAURUS_CLAW); final int count = getQuestItemsCount(player, TYRANNOSAURUS_CLAW);
final int reward = (count < 10) ? (30 * count) : (59 + (30 * count)); final int reward = (count < 10) ? (30 * count) : (59 + (30 * count));
playSound(player, QuestSound.ITEMSOUND_QUEST_FANFARE_1); playSound(player, QuestSound.ITEMSOUND_QUEST_FANFARE_1);
takeItems(player, TYRANNOSAURUS_CLAW, -1); takeItems(player, TYRANNOSAURUS_CLAW, -1);
@@ -104,7 +104,7 @@ public class Q00624_TheFinestIngredientsPart1 extends Quest
if ((partyMember != null) && partyMember.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) if ((partyMember != null) && partyMember.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
{ {
final int item = MONSTER_DROPS.get(npc.getId()); final int item = MONSTER_DROPS.get(npc.getId());
final long count = getQuestItemsCount(partyMember, item); final int count = getQuestItemsCount(partyMember, item);
if ((count + 1) >= 50) if ((count + 1) >= 50)
{ {
if (count < 50) if (count < 50)
@@ -145,8 +145,8 @@ public class Q00648_AnIceMerchantsDream extends Quest
{ {
if (qs.getCond() >= 1) if (qs.getCond() >= 1)
{ {
final long silverCryCount = getQuestItemsCount(player, SILVER_ICE_CRYSTAL); final int silverCryCount = getQuestItemsCount(player, SILVER_ICE_CRYSTAL);
final long blackCryCount = getQuestItemsCount(player, BLACK_ICE_CRYSTAL); final int blackCryCount = getQuestItemsCount(player, BLACK_ICE_CRYSTAL);
if ((silverCryCount + blackCryCount) > 0) if ((silverCryCount + blackCryCount) > 0)
{ {
giveAdena(player, (silverCryCount * 300) + (blackCryCount * 1200), true); giveAdena(player, (silverCryCount * 300) + (blackCryCount * 1200), true);
@@ -78,8 +78,8 @@ public class Q00659_IdRatherBeCollectingFairyBreath extends Quest
{ {
if (hasQuestItems(player, FAIRY_BREATH)) if (hasQuestItems(player, FAIRY_BREATH))
{ {
final long count = getQuestItemsCount(player, FAIRY_BREATH); final int count = getQuestItemsCount(player, FAIRY_BREATH);
final long bonus = ((count >= 10) ? 5365 : 0); final int bonus = ((count >= 10) ? 5365 : 0);
takeItems(player, FAIRY_BREATH, -1); takeItems(player, FAIRY_BREATH, -1);
giveAdena(player, (count * 50) + bonus, true); giveAdena(player, (count * 50) + bonus, true);
htmltext = "30634-05.html"; htmltext = "30634-05.html";
@@ -131,7 +131,7 @@ public class Q00660_AidingTheFloranVillage extends Quest
} }
case "30291-06.html": case "30291-06.html":
{ {
final long itemCount = getQuestItemsCount(player, WATCHING_EYES) + getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD) + getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final int itemCount = getQuestItemsCount(player, WATCHING_EYES) + getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD) + getQuestItemsCount(player, DELU_LIZARDMANS_SCALE);
if (itemCount > 0) if (itemCount > 0)
{ {
giveAdena(player, itemCount * 100, true); giveAdena(player, itemCount * 100, true);
@@ -153,10 +153,10 @@ public class Q00660_AidingTheFloranVillage extends Quest
} }
case "30291-12.html": case "30291-12.html":
{ {
final long itemCount1 = getQuestItemsCount(player, WATCHING_EYES); final int itemCount1 = getQuestItemsCount(player, WATCHING_EYES);
final long itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD); final int itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD);
final long itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final int itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE);
final long itemCount = itemCount1 + itemCount2 + itemCount3; final int itemCount = itemCount1 + itemCount2 + itemCount3;
if (itemCount < 100) if (itemCount < 100)
{ {
htmltext = "30291-11.html"; htmltext = "30291-11.html";
@@ -180,10 +180,10 @@ public class Q00660_AidingTheFloranVillage extends Quest
} }
case "30291-16.html": case "30291-16.html":
{ {
final long itemCount1 = getQuestItemsCount(player, WATCHING_EYES); final int itemCount1 = getQuestItemsCount(player, WATCHING_EYES);
final long itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD); final int itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD);
final long itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final int itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE);
final long itemCount = itemCount1 + itemCount2 + itemCount3; final int itemCount = itemCount1 + itemCount2 + itemCount3;
if (itemCount < 200) if (itemCount < 200)
{ {
htmltext = "30291-15.html"; htmltext = "30291-15.html";
@@ -214,10 +214,10 @@ public class Q00660_AidingTheFloranVillage extends Quest
} }
case "30291-20.html": case "30291-20.html":
{ {
final long itemCount1 = getQuestItemsCount(player, WATCHING_EYES); final int itemCount1 = getQuestItemsCount(player, WATCHING_EYES);
final long itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD); final int itemCount2 = getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD);
final long itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final int itemCount3 = getQuestItemsCount(player, DELU_LIZARDMANS_SCALE);
final long itemCount = itemCount1 + itemCount2 + itemCount3; final int itemCount = itemCount1 + itemCount2 + itemCount3;
if (itemCount < 500) if (itemCount < 500)
{ {
htmltext = "30291-19.html"; htmltext = "30291-19.html";
@@ -241,7 +241,7 @@ public class Q00660_AidingTheFloranVillage extends Quest
} }
case "30291-22.html": case "30291-22.html":
{ {
final long itemCount = getQuestItemsCount(player, WATCHING_EYES) + getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD) + getQuestItemsCount(player, DELU_LIZARDMANS_SCALE); final int itemCount = getQuestItemsCount(player, WATCHING_EYES) + getQuestItemsCount(player, ROUGHLY_HEWN_ROCK_GOLEM_SHARD) + getQuestItemsCount(player, DELU_LIZARDMANS_SCALE);
if (itemCount <= 0) if (itemCount <= 0)
{ {
htmltext = "30291-23.html"; htmltext = "30291-23.html";
@@ -341,9 +341,9 @@ public class Q00660_AidingTheFloranVillage extends Quest
return htmltext; return htmltext;
} }
private void tradeItems(Player player, long requiredValue, long itemCount1, long itemCount2, long itemCount3) private void tradeItems(Player player, int requiredValue, int itemCount1, int itemCount2, int itemCount3)
{ {
long required = requiredValue; int required = requiredValue;
if (itemCount1 < required) if (itemCount1 < required)
{ {
takeItems(player, WATCHING_EYES, itemCount1); takeItems(player, WATCHING_EYES, itemCount1);
@@ -89,10 +89,10 @@ public class Q00661_MakingTheHarvestGroundsSafe extends Quest
} }
case "30210-08.html": case "30210-08.html":
{ {
final long stingCount = getQuestItemsCount(player, BIG_HORNET_STING); final int stingCount = getQuestItemsCount(player, BIG_HORNET_STING);
final long gemCount = getQuestItemsCount(player, CLOUD_GEM); final int gemCount = getQuestItemsCount(player, CLOUD_GEM);
final long clawCount = getQuestItemsCount(player, YOUNG_ARANEID_CLAW); final int clawCount = getQuestItemsCount(player, YOUNG_ARANEID_CLAW);
long reward = (57 * stingCount) + (56 * gemCount) + (60 * clawCount); int reward = (57 * stingCount) + (56 * gemCount) + (60 * clawCount);
if ((stingCount + gemCount + clawCount) >= 10) if ((stingCount + gemCount + clawCount) >= 10)
{ {
reward += 5773; reward += 5773;
@@ -264,10 +264,10 @@ public class Config
public static int ALT_PARTY_RANGE; public static int ALT_PARTY_RANGE;
public static boolean ALT_LEAVE_PARTY_LEADER; public static boolean ALT_LEAVE_PARTY_LEADER;
public static boolean INITIAL_EQUIPMENT_EVENT; public static boolean INITIAL_EQUIPMENT_EVENT;
public static long STARTING_ADENA; public static int STARTING_ADENA;
public static byte STARTING_LEVEL; public static byte STARTING_LEVEL;
public static int STARTING_SP; public static int STARTING_SP;
public static long MAX_ADENA; public static int MAX_ADENA;
public static boolean AUTO_LOOT; public static boolean AUTO_LOOT;
public static boolean AUTO_LOOT_RAIDS; public static boolean AUTO_LOOT_RAIDS;
public static boolean AUTO_LOOT_SLOT_LIMIT; public static boolean AUTO_LOOT_SLOT_LIMIT;
@@ -618,12 +618,12 @@ public class Config
public static int ALT_MANOR_MAINTENANCE_MIN; public static int ALT_MANOR_MAINTENANCE_MIN;
public static boolean ALT_MANOR_SAVE_ALL_ACTIONS; public static boolean ALT_MANOR_SAVE_ALL_ACTIONS;
public static int ALT_MANOR_SAVE_PERIOD_RATE; public static int ALT_MANOR_SAVE_PERIOD_RATE;
public static long ALT_LOTTERY_PRIZE; public static int ALT_LOTTERY_PRIZE;
public static long ALT_LOTTERY_TICKET_PRICE; public static int ALT_LOTTERY_TICKET_PRICE;
public static float ALT_LOTTERY_5_NUMBER_RATE; public static float ALT_LOTTERY_5_NUMBER_RATE;
public static float ALT_LOTTERY_4_NUMBER_RATE; public static float ALT_LOTTERY_4_NUMBER_RATE;
public static float ALT_LOTTERY_3_NUMBER_RATE; public static float ALT_LOTTERY_3_NUMBER_RATE;
public static long ALT_LOTTERY_2_AND_1_NUMBER_PRIZE; public static int ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;
public static boolean ALT_FISH_CHAMPIONSHIP_ENABLED; public static boolean ALT_FISH_CHAMPIONSHIP_ENABLED;
public static int ALT_FISH_CHAMPIONSHIP_REWARD_ITEM; public static int ALT_FISH_CHAMPIONSHIP_REWARD_ITEM;
public static int ALT_FISH_CHAMPIONSHIP_REWARD_1; public static int ALT_FISH_CHAMPIONSHIP_REWARD_1;
@@ -1841,13 +1841,13 @@ public class Config
ALT_PARTY_RANGE = characterConfig.getInt("AltPartyRange", 1500); ALT_PARTY_RANGE = characterConfig.getInt("AltPartyRange", 1500);
ALT_LEAVE_PARTY_LEADER = characterConfig.getBoolean("AltLeavePartyLeader", false); ALT_LEAVE_PARTY_LEADER = characterConfig.getBoolean("AltLeavePartyLeader", false);
INITIAL_EQUIPMENT_EVENT = characterConfig.getBoolean("InitialEquipmentEvent", false); INITIAL_EQUIPMENT_EVENT = characterConfig.getBoolean("InitialEquipmentEvent", false);
STARTING_ADENA = characterConfig.getLong("StartingAdena", 0); STARTING_ADENA = characterConfig.getInt("StartingAdena", 0);
STARTING_LEVEL = characterConfig.getByte("StartingLevel", (byte) 1); STARTING_LEVEL = characterConfig.getByte("StartingLevel", (byte) 1);
STARTING_SP = characterConfig.getInt("StartingSP", 0); STARTING_SP = characterConfig.getInt("StartingSP", 0);
MAX_ADENA = characterConfig.getLong("MaxAdena", 2000000000); MAX_ADENA = characterConfig.getInt("MaxAdena", 2000000000);
if (MAX_ADENA < 0) if (MAX_ADENA < 0)
{ {
MAX_ADENA = Long.MAX_VALUE; MAX_ADENA = Integer.MAX_VALUE;
} }
AUTO_LOOT = characterConfig.getBoolean("AutoLoot", false); AUTO_LOOT = characterConfig.getBoolean("AutoLoot", false);
AUTO_LOOT_RAIDS = characterConfig.getBoolean("AutoLootRaids", false); AUTO_LOOT_RAIDS = characterConfig.getBoolean("AutoLootRaids", false);
@@ -2043,12 +2043,12 @@ public class Config
ALT_MANOR_MAINTENANCE_MIN = generalConfig.getInt("AltManorMaintenanceMin", 6); ALT_MANOR_MAINTENANCE_MIN = generalConfig.getInt("AltManorMaintenanceMin", 6);
ALT_MANOR_SAVE_ALL_ACTIONS = generalConfig.getBoolean("AltManorSaveAllActions", false); ALT_MANOR_SAVE_ALL_ACTIONS = generalConfig.getBoolean("AltManorSaveAllActions", false);
ALT_MANOR_SAVE_PERIOD_RATE = generalConfig.getInt("AltManorSavePeriodRate", 2); ALT_MANOR_SAVE_PERIOD_RATE = generalConfig.getInt("AltManorSavePeriodRate", 2);
ALT_LOTTERY_PRIZE = generalConfig.getLong("AltLotteryPrize", 50000); ALT_LOTTERY_PRIZE = generalConfig.getInt("AltLotteryPrize", 50000);
ALT_LOTTERY_TICKET_PRICE = generalConfig.getLong("AltLotteryTicketPrice", 2000); ALT_LOTTERY_TICKET_PRICE = generalConfig.getInt("AltLotteryTicketPrice", 2000);
ALT_LOTTERY_5_NUMBER_RATE = generalConfig.getFloat("AltLottery5NumberRate", 0.6f); ALT_LOTTERY_5_NUMBER_RATE = generalConfig.getFloat("AltLottery5NumberRate", 0.6f);
ALT_LOTTERY_4_NUMBER_RATE = generalConfig.getFloat("AltLottery4NumberRate", 0.2f); ALT_LOTTERY_4_NUMBER_RATE = generalConfig.getFloat("AltLottery4NumberRate", 0.2f);
ALT_LOTTERY_3_NUMBER_RATE = generalConfig.getFloat("AltLottery3NumberRate", 0.2f); ALT_LOTTERY_3_NUMBER_RATE = generalConfig.getFloat("AltLottery3NumberRate", 0.2f);
ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = generalConfig.getLong("AltLottery2and1NumberPrize", 200); ALT_LOTTERY_2_AND_1_NUMBER_PRIZE = generalConfig.getInt("AltLottery2and1NumberPrize", 200);
ALT_FISH_CHAMPIONSHIP_ENABLED = generalConfig.getBoolean("AltFishChampionshipEnabled", true); ALT_FISH_CHAMPIONSHIP_ENABLED = generalConfig.getBoolean("AltFishChampionshipEnabled", true);
ALT_FISH_CHAMPIONSHIP_REWARD_ITEM = generalConfig.getInt("AltFishChampionshipRewardItemId", 57); ALT_FISH_CHAMPIONSHIP_REWARD_ITEM = generalConfig.getInt("AltFishChampionshipRewardItemId", 57);
ALT_FISH_CHAMPIONSHIP_REWARD_1 = generalConfig.getInt("AltFishChampionshipReward1", 800000); ALT_FISH_CHAMPIONSHIP_REWARD_1 = generalConfig.getInt("AltFishChampionshipReward1", 800000);
@@ -257,7 +257,7 @@ public class ItemTable
* @param reference : Object Object referencing current action like NPC selling item or previous item in transformation * @param reference : Object Object referencing current action like NPC selling item or previous item in transformation
* @return Item corresponding to the new item * @return Item corresponding to the new item
*/ */
public Item createItem(String process, int itemId, long count, Creature actor, Object reference) public Item createItem(String process, int itemId, int count, Creature actor, Object reference)
{ {
// Create and Init the Item corresponding to the Item Identifier // Create and Init the Item corresponding to the Item Identifier
final Item item = new Item(IdManager.getInstance().getNextId(), itemId); final Item item = new Item(IdManager.getInstance().getNextId(), itemId);
@@ -89,8 +89,8 @@ public class OfflineTraderTable
{ {
stmItems.setInt(1, pc.getObjectId()); stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getItem().getId()); stmItems.setInt(2, i.getItem().getId());
stmItems.setLong(3, i.getCount()); stmItems.setInt(3, i.getCount());
stmItems.setLong(4, i.getPrice()); stmItems.setInt(4, i.getPrice());
stmItems.executeUpdate(); stmItems.executeUpdate();
stmItems.clearParameters(); stmItems.clearParameters();
} }
@@ -110,8 +110,8 @@ public class OfflineTraderTable
{ {
stmItems.setInt(1, pc.getObjectId()); stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, holder.getSkillId()); stmItems.setInt(2, holder.getSkillId());
stmItems.setLong(3, 0); stmItems.setInt(3, 0);
stmItems.setLong(4, holder.getPrice()); stmItems.setInt(4, holder.getPrice());
stmItems.executeUpdate(); stmItems.executeUpdate();
stmItems.clearParameters(); stmItems.clearParameters();
} }
@@ -122,8 +122,8 @@ public class OfflineTraderTable
{ {
stmItems.setInt(1, pc.getObjectId()); stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getObjectId()); stmItems.setInt(2, i.getObjectId());
stmItems.setLong(3, i.getCount()); stmItems.setInt(3, i.getCount());
stmItems.setLong(4, i.getPrice()); stmItems.setInt(4, i.getPrice());
stmItems.executeUpdate(); stmItems.executeUpdate();
stmItems.clearParameters(); stmItems.clearParameters();
} }
@@ -141,8 +141,8 @@ public class OfflineTraderTable
{ {
stmItems.setInt(1, pc.getObjectId()); stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getRecipeId()); stmItems.setInt(2, i.getRecipeId());
stmItems.setLong(3, 0); stmItems.setInt(3, 0);
stmItems.setLong(4, i.getCost()); stmItems.setInt(4, i.getCost());
stmItems.executeUpdate(); stmItems.executeUpdate();
stmItems.clearParameters(); stmItems.clearParameters();
} }
@@ -239,7 +239,7 @@ public class OfflineTraderTable
{ {
while (items.next()) while (items.next())
{ {
if (player.getBuyList().addItemByItemId(items.getInt(2), items.getLong(3), items.getLong(4)) == null) if (player.getBuyList().addItemByItemId(items.getInt(2), items.getInt(3), items.getInt(4)) == null)
{ {
continue; continue;
// throw new NullPointerException(); // throw new NullPointerException();
@@ -255,14 +255,14 @@ public class OfflineTraderTable
{ {
while (items.next()) while (items.next())
{ {
player.getSellingBuffs().add(new SellBuffHolder(items.getInt("item"), items.getLong("price"))); player.getSellingBuffs().add(new SellBuffHolder(items.getInt("item"), items.getInt("price")));
} }
} }
else else
{ {
while (items.next()) while (items.next())
{ {
if (player.getSellList().addItem(items.getInt(2), items.getLong(3), items.getLong(4)) == null) if (player.getSellList().addItem(items.getInt(2), items.getInt(3), items.getInt(4)) == null)
{ {
continue; continue;
// throw new NullPointerException(); // throw new NullPointerException();
@@ -277,7 +277,7 @@ public class OfflineTraderTable
{ {
while (items.next()) while (items.next())
{ {
player.getManufactureItems().put(items.getInt(2), new ManufactureItem(items.getInt(2), items.getLong(4))); player.getManufactureItems().put(items.getInt(2), new ManufactureItem(items.getInt(2), items.getInt(4)));
} }
player.setStoreName(rs.getString("title")); player.setStoreName(rs.getString("title"));
break; break;
@@ -360,8 +360,8 @@ public class OfflineTraderTable
{ {
stm3.setInt(1, trader.getObjectId()); stm3.setInt(1, trader.getObjectId());
stm3.setInt(2, i.getItem().getId()); stm3.setInt(2, i.getItem().getId());
stm3.setLong(3, i.getCount()); stm3.setInt(3, i.getCount());
stm3.setLong(4, i.getPrice()); stm3.setInt(4, i.getPrice());
stm3.executeUpdate(); stm3.executeUpdate();
stm3.clearParameters(); stm3.clearParameters();
} }
@@ -380,8 +380,8 @@ public class OfflineTraderTable
{ {
stm3.setInt(1, trader.getObjectId()); stm3.setInt(1, trader.getObjectId());
stm3.setInt(2, holder.getSkillId()); stm3.setInt(2, holder.getSkillId());
stm3.setLong(3, 0); stm3.setInt(3, 0);
stm3.setLong(4, holder.getPrice()); stm3.setInt(4, holder.getPrice());
stm3.executeUpdate(); stm3.executeUpdate();
stm3.clearParameters(); stm3.clearParameters();
} }
@@ -392,8 +392,8 @@ public class OfflineTraderTable
{ {
stm3.setInt(1, trader.getObjectId()); stm3.setInt(1, trader.getObjectId());
stm3.setInt(2, i.getObjectId()); stm3.setInt(2, i.getObjectId());
stm3.setLong(3, i.getCount()); stm3.setInt(3, i.getCount());
stm3.setLong(4, i.getPrice()); stm3.setInt(4, i.getPrice());
stm3.executeUpdate(); stm3.executeUpdate();
stm3.clearParameters(); stm3.clearParameters();
} }
@@ -410,8 +410,8 @@ public class OfflineTraderTable
{ {
stm3.setInt(1, trader.getObjectId()); stm3.setInt(1, trader.getObjectId());
stm3.setInt(2, i.getRecipeId()); stm3.setInt(2, i.getRecipeId());
stm3.setLong(3, 0); stm3.setInt(3, 0);
stm3.setLong(4, i.getCost()); stm3.setInt(4, i.getCost());
stm3.executeUpdate(); stm3.executeUpdate();
stm3.clearParameters(); stm3.clearParameters();
} }
@@ -75,7 +75,7 @@ public class BuyListData implements IXmlReader
{ {
final int buyListId = rs.getInt("buylist_id"); final int buyListId = rs.getInt("buylist_id");
final int itemId = rs.getInt("item_id"); final int itemId = rs.getInt("item_id");
final long count = rs.getLong("count"); final int count = rs.getInt("count");
final long nextRestockTime = rs.getLong("next_restock_time"); final long nextRestockTime = rs.getLong("next_restock_time");
final BuyListHolder buyList = getBuyList(buyListId); final BuyListHolder buyList = getBuyList(buyListId);
if (buyList == null) if (buyList == null)
@@ -118,16 +118,16 @@ public class BuyListData implements IXmlReader
if ("item".equalsIgnoreCase(list_node.getNodeName())) if ("item".equalsIgnoreCase(list_node.getNodeName()))
{ {
int itemId = -1; int itemId = -1;
long price = -1; int price = -1;
long restockDelay = -1; long restockDelay = -1;
long count = -1; int count = -1;
final NamedNodeMap attrs = list_node.getAttributes(); final NamedNodeMap attrs = list_node.getAttributes();
Node attr = attrs.getNamedItem("id"); Node attr = attrs.getNamedItem("id");
itemId = Integer.parseInt(attr.getNodeValue()); itemId = Integer.parseInt(attr.getNodeValue());
attr = attrs.getNamedItem("price"); attr = attrs.getNamedItem("price");
if (attr != null) if (attr != null)
{ {
price = Long.parseLong(attr.getNodeValue()); price = Integer.parseInt(attr.getNodeValue());
} }
attr = attrs.getNamedItem("restock_delay"); attr = attrs.getNamedItem("restock_delay");
if (attr != null) if (attr != null)
@@ -137,7 +137,7 @@ public class BuyListData implements IXmlReader
attr = attrs.getNamedItem("count"); attr = attrs.getNamedItem("count");
if (attr != null) if (attr != null)
{ {
count = Long.parseLong(attr.getNodeValue()); count = Integer.parseInt(attr.getNodeValue());
} }
final ItemTemplate item = ItemTable.getInstance().getTemplate(itemId); final ItemTemplate item = ItemTable.getInstance().getTemplate(itemId);
if (item != null) if (item != null)
@@ -253,10 +253,10 @@ public class MultisellData implements IXmlReader
list.getEntries().forEach(entry -> list.getEntries().forEach(entry ->
{ {
// Math.max used here to avoid dropping count to 0 // Math.max used here to avoid dropping count to 0
entry.getProducts().forEach(product -> product.setItemCount((long) Math.max(product.getItemCount() * productMultiplier, 1))); entry.getProducts().forEach(product -> product.setItemCount((int) Math.max(product.getItemCount() * productMultiplier, 1)));
// Math.max used here to avoid dropping count to 0 // Math.max used here to avoid dropping count to 0
entry.getIngredients().forEach(ingredient -> ingredient.setItemCount((long) Math.max(ingredient.getItemCount() * ingredientMultiplier, 1))); entry.getIngredients().forEach(ingredient -> ingredient.setItemCount((int) Math.max(ingredient.getItemCount() * ingredientMultiplier, 1)));
}); });
} }
int index = 0; int index = 0;
@@ -320,27 +320,27 @@ public class MultisellData implements IXmlReader
return false; return false;
} }
public static boolean takeSpecialIngredient(int id, long amount, Player player) public static boolean takeSpecialIngredient(int id, int amount, Player player)
{ {
switch (id) switch (id)
{ {
case PC_CAFE_POINTS: case PC_CAFE_POINTS:
{ {
player.setPcCafePoints((player.getPcCafePoints() - (int) amount)); player.setPcCafePoints((player.getPcCafePoints() - amount));
player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) -amount, 0)); player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), -amount, 0));
break; break;
} }
case CLAN_REPUTATION: case CLAN_REPUTATION:
{ {
player.getClan().takeReputationScore((int) amount); player.getClan().takeReputationScore(amount);
final SystemMessage smsg = new SystemMessage(SystemMessageId.S1_POINTS_HAVE_BEEN_DEDUCTED_FROM_THE_CLAN_S_REPUTATION_SCORE); final SystemMessage smsg = new SystemMessage(SystemMessageId.S1_POINTS_HAVE_BEEN_DEDUCTED_FROM_THE_CLAN_S_REPUTATION_SCORE);
smsg.addLong(amount); smsg.addInt(amount);
player.sendPacket(smsg); player.sendPacket(smsg);
return true; return true;
} }
case FAME: case FAME:
{ {
player.setFame(player.getFame() - (int) amount); player.setFame(player.getFame() - amount);
player.sendPacket(new UserInfo(player)); player.sendPacket(new UserInfo(player));
// player.sendPacket(new ExBrExtraUserInfo(player)); // player.sendPacket(new ExBrExtraUserInfo(player));
return true; return true;
@@ -181,7 +181,7 @@ public class CastleManorManager implements IXmlReader, IStorable
final int seedId = rs.getInt("seed_id"); final int seedId = rs.getInt("seed_id");
if (_seeds.containsKey(seedId)) // Don't load unknown seeds if (_seeds.containsKey(seedId)) // Don't load unknown seeds
{ {
final SeedProduction sp = new SeedProduction(seedId, rs.getLong("amount"), rs.getLong("price"), rs.getInt("start_amount")); final SeedProduction sp = new SeedProduction(seedId, rs.getInt("amount"), rs.getInt("price"), rs.getInt("start_amount"));
if (rs.getBoolean("next_period")) if (rs.getBoolean("next_period"))
{ {
pNext.add(sp); pNext.add(sp);
@@ -212,7 +212,7 @@ public class CastleManorManager implements IXmlReader, IStorable
final int cropId = rs.getInt("crop_id"); final int cropId = rs.getInt("crop_id");
if (cropIds.contains(cropId)) // Don't load unknown crops if (cropIds.contains(cropId)) // Don't load unknown crops
{ {
final CropProcure cp = new CropProcure(cropId, rs.getLong("amount"), rs.getInt("reward_type"), rs.getLong("start_amount"), rs.getLong("price")); final CropProcure cp = new CropProcure(cropId, rs.getInt("amount"), rs.getInt("reward_type"), rs.getInt("start_amount"), rs.getInt("price"));
if (rs.getBoolean("next_period")) if (rs.getBoolean("next_period"))
{ {
next.add(cp); next.add(cp);
@@ -303,7 +303,7 @@ public class CastleManorManager implements IXmlReader, IStorable
// Adding bought crops to clan warehouse // Adding bought crops to clan warehouse
if (crop.getStartAmount() != crop.getAmount()) if (crop.getStartAmount() != crop.getAmount())
{ {
long count = (long) ((crop.getStartAmount() - crop.getAmount()) * 0.9); int count = (int) ((crop.getStartAmount() - crop.getAmount()) * 0.9);
if ((count < 1) && (Rnd.get(99) < 90)) if ((count < 1) && (Rnd.get(99) < 90))
{ {
count = 1; count = 1;
@@ -445,9 +445,9 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
ips.setInt(1, castleId); ips.setInt(1, castleId);
ips.setInt(2, sp.getId()); ips.setInt(2, sp.getId());
ips.setLong(3, sp.getAmount()); ips.setInt(3, sp.getAmount());
ips.setLong(4, sp.getStartAmount()); ips.setInt(4, sp.getStartAmount());
ips.setLong(5, sp.getPrice()); ips.setInt(5, sp.getPrice());
ips.setBoolean(6, true); ips.setBoolean(6, true);
ips.addBatch(); ips.addBatch();
} }
@@ -481,9 +481,9 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
ips.setInt(1, castleId); ips.setInt(1, castleId);
ips.setInt(2, cp.getId()); ips.setInt(2, cp.getId());
ips.setLong(3, cp.getAmount()); ips.setInt(3, cp.getAmount());
ips.setLong(4, cp.getStartAmount()); ips.setInt(4, cp.getStartAmount());
ips.setLong(5, cp.getPrice()); ips.setInt(5, cp.getPrice());
ips.setInt(6, cp.getReward()); ips.setInt(6, cp.getReward());
ips.setBoolean(7, true); ips.setBoolean(7, true);
ips.addBatch(); ips.addBatch();
@@ -505,7 +505,7 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
for (SeedProduction sp : items) for (SeedProduction sp : items)
{ {
ps.setLong(1, sp.getAmount()); ps.setInt(1, sp.getAmount());
ps.setInt(2, castleId); ps.setInt(2, castleId);
ps.setInt(3, sp.getId()); ps.setInt(3, sp.getId());
ps.addBatch(); ps.addBatch();
@@ -525,7 +525,7 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
for (CropProcure sp : items) for (CropProcure sp : items)
{ {
ps.setLong(1, sp.getAmount()); ps.setInt(1, sp.getAmount());
ps.setInt(2, castleId); ps.setInt(2, castleId);
ps.setInt(3, sp.getId()); ps.setInt(3, sp.getId());
ps.addBatch(); ps.addBatch();
@@ -608,9 +608,9 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
is.setInt(1, entry.getKey()); is.setInt(1, entry.getKey());
is.setInt(2, sp.getId()); is.setInt(2, sp.getId());
is.setLong(3, sp.getAmount()); is.setInt(3, sp.getAmount());
is.setLong(4, sp.getStartAmount()); is.setInt(4, sp.getStartAmount());
is.setLong(5, sp.getPrice()); is.setInt(5, sp.getPrice());
is.setBoolean(6, false); is.setBoolean(6, false);
is.addBatch(); is.addBatch();
} }
@@ -623,9 +623,9 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
is.setInt(1, entry.getKey()); is.setInt(1, entry.getKey());
is.setInt(2, sp.getId()); is.setInt(2, sp.getId());
is.setLong(3, sp.getAmount()); is.setInt(3, sp.getAmount());
is.setLong(4, sp.getStartAmount()); is.setInt(4, sp.getStartAmount());
is.setLong(5, sp.getPrice()); is.setInt(5, sp.getPrice());
is.setBoolean(6, true); is.setBoolean(6, true);
is.addBatch(); is.addBatch();
} }
@@ -644,9 +644,9 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
ip.setInt(1, entry.getKey()); ip.setInt(1, entry.getKey());
ip.setInt(2, cp.getId()); ip.setInt(2, cp.getId());
ip.setLong(3, cp.getAmount()); ip.setInt(3, cp.getAmount());
ip.setLong(4, cp.getStartAmount()); ip.setInt(4, cp.getStartAmount());
ip.setLong(5, cp.getPrice()); ip.setInt(5, cp.getPrice());
ip.setInt(6, cp.getReward()); ip.setInt(6, cp.getReward());
ip.setBoolean(7, false); ip.setBoolean(7, false);
ip.addBatch(); ip.addBatch();
@@ -660,9 +660,9 @@ public class CastleManorManager implements IXmlReader, IStorable
{ {
ip.setInt(1, entry.getKey()); ip.setInt(1, entry.getKey());
ip.setInt(2, cp.getId()); ip.setInt(2, cp.getId());
ip.setLong(3, cp.getAmount()); ip.setInt(3, cp.getAmount());
ip.setLong(4, cp.getStartAmount()); ip.setInt(4, cp.getStartAmount());
ip.setLong(5, cp.getPrice()); ip.setInt(5, cp.getPrice());
ip.setInt(6, cp.getReward()); ip.setInt(6, cp.getReward());
ip.setBoolean(7, true); ip.setBoolean(7, true);
ip.addBatch(); ip.addBatch();
@@ -73,7 +73,7 @@ public class CustomMailManager
final String itemCount = str.split(" ")[1]; final String itemCount = str.split(" ")[1];
if (Util.isDigit(itemId) && Util.isDigit(itemCount)) if (Util.isDigit(itemId) && Util.isDigit(itemCount))
{ {
itemHolders.add(new ItemHolder(Integer.parseInt(itemId), Long.parseLong(itemCount))); itemHolders.add(new ItemHolder(Integer.parseInt(itemId), Integer.parseInt(itemCount)));
} }
} }
else if (Util.isDigit(str)) else if (Util.isDigit(str))
@@ -78,7 +78,7 @@ public class EventDropManager
if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance())) if ((monsterLevel >= drop.getMinLevel()) && (monsterLevel <= drop.getMaxLevel()) && (Rnd.get(100d) < drop.getChance()))
{ {
final int itemId = drop.getItemId(); final int itemId = drop.getItemId();
final long itemCount = Rnd.get(drop.getMin(), drop.getMax()); final int itemCount = Rnd.get(drop.getMin(), drop.getMax());
if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying()) if (Config.AUTO_LOOT_ITEM_IDS.contains(itemId) || Config.AUTO_LOOT || attackable.isFlying())
{ {
player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable. player.doAutoLoot(attackable, itemId, itemCount); // Give the item to the player that has killed the attackable.
@@ -213,7 +213,7 @@ public class ItemsOnGroundManager implements Runnable
{ {
ps.setInt(1, item.getObjectId()); ps.setInt(1, item.getObjectId());
ps.setInt(2, item.getId()); ps.setInt(2, item.getId());
ps.setLong(3, item.getCount()); ps.setInt(3, item.getCount());
ps.setInt(4, item.getEnchantLevel()); ps.setInt(4, item.getEnchantLevel());
ps.setInt(5, item.getX()); ps.setInt(5, item.getX());
ps.setInt(6, item.getY()); ps.setInt(6, item.getY());
@@ -177,7 +177,7 @@ public class RecipeManager
protected int _itemGrab; protected int _itemGrab;
protected int _exp = -1; protected int _exp = -1;
protected int _sp = -1; protected int _sp = -1;
protected long _price; protected int _price;
protected int _totalItems; protected int _totalItems;
protected int _delay; protected int _delay;
@@ -400,12 +400,12 @@ public class RecipeManager
SystemMessage msg = new SystemMessage(SystemMessageId.YOUR_ATTEMPT_TO_CREATE_S2_FOR_C1_AT_THE_PRICE_OF_S3_ADENA_HAS_FAILED); SystemMessage msg = new SystemMessage(SystemMessageId.YOUR_ATTEMPT_TO_CREATE_S2_FOR_C1_AT_THE_PRICE_OF_S3_ADENA_HAS_FAILED);
msg.addString(_target.getName()); msg.addString(_target.getName());
msg.addItemName(_recipeList.getItemId()); msg.addItemName(_recipeList.getItemId());
msg.addLong(_price); msg.addInt(_price);
_player.sendPacket(msg); _player.sendPacket(msg);
msg = new SystemMessage(SystemMessageId.C1_HAS_FAILED_TO_CREATE_S2_AT_THE_PRICE_OF_S3_ADENA); msg = new SystemMessage(SystemMessageId.C1_HAS_FAILED_TO_CREATE_S2_AT_THE_PRICE_OF_S3_ADENA);
msg.addString(_player.getName()); msg.addString(_player.getName());
msg.addItemName(_recipeList.getItemId()); msg.addItemName(_recipeList.getItemId());
msg.addLong(_price); msg.addInt(_price);
_target.sendPacket(msg); _target.sendPacket(msg);
} }
else else
@@ -470,7 +470,7 @@ public class RecipeManager
if (_target == _player) if (_target == _player)
{ {
final SystemMessage sm = new SystemMessage(SystemMessageId.EQUIPPED_S1_S2); final SystemMessage sm = new SystemMessage(SystemMessageId.EQUIPPED_S1_S2);
sm.addLong(count); sm.addInt(count);
sm.addItemName(item.getItemId()); sm.addItemName(item.getItemId());
_player.sendPacket(sm); _player.sendPacket(sm);
} }
@@ -582,14 +582,14 @@ public class RecipeManager
if (recipe.getQuantity() > 0) if (recipe.getQuantity() > 0)
{ {
final Item item = inv.getItemByItemId(recipe.getItemId()); final Item item = inv.getItemByItemId(recipe.getItemId());
final long itemQuantityAmount = item == null ? 0 : item.getCount(); final int itemQuantityAmount = item == null ? 0 : item.getCount();
// check materials // check materials
if (itemQuantityAmount < recipe.getQuantity()) if (itemQuantityAmount < recipe.getQuantity())
{ {
sm = new SystemMessage(SystemMessageId.YOU_ARE_MISSING_S2_S1_REQUIRED_TO_CREATE_THAT); sm = new SystemMessage(SystemMessageId.YOU_ARE_MISSING_S2_S1_REQUIRED_TO_CREATE_THAT);
sm.addItemName(recipe.getItemId()); sm.addItemName(recipe.getItemId());
sm.addLong(recipe.getQuantity() - itemQuantityAmount); sm.addInt(recipe.getQuantity() - itemQuantityAmount);
_target.sendPacket(sm); _target.sendPacket(sm);
abort(); abort();
@@ -610,7 +610,7 @@ public class RecipeManager
{ {
sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(tmp.getItemId()); sm.addItemName(tmp.getItemId());
sm.addLong(tmp.getQuantity()); sm.addInt(tmp.getQuantity());
} }
else else
{ {
@@ -656,13 +656,13 @@ public class RecipeManager
sm = new SystemMessage(SystemMessageId.S2_HAS_BEEN_CREATED_FOR_C1_AFTER_THE_PAYMENT_OF_S3_ADENA_WAS_RECEIVED); sm = new SystemMessage(SystemMessageId.S2_HAS_BEEN_CREATED_FOR_C1_AFTER_THE_PAYMENT_OF_S3_ADENA_WAS_RECEIVED);
sm.addString(_target.getName()); sm.addString(_target.getName());
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(_price); sm.addInt(_price);
_player.sendPacket(sm); _player.sendPacket(sm);
sm = new SystemMessage(SystemMessageId.C1_CREATED_S2_AFTER_RECEIVING_S3_ADENA); sm = new SystemMessage(SystemMessageId.C1_CREATED_S2_AFTER_RECEIVING_S3_ADENA);
sm.addString(_player.getName()); sm.addString(_player.getName());
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(_price); sm.addInt(_price);
_target.sendPacket(sm); _target.sendPacket(sm);
} }
else else
@@ -671,14 +671,14 @@ public class RecipeManager
sm.addString(_target.getName()); sm.addString(_target.getName());
sm.addInt(itemCount); sm.addInt(itemCount);
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(_price); sm.addInt(_price);
_player.sendPacket(sm); _player.sendPacket(sm);
sm = new SystemMessage(SystemMessageId.C1_CREATED_S2_S3_AT_THE_PRICE_OF_S4_ADENA); sm = new SystemMessage(SystemMessageId.C1_CREATED_S2_S3_AT_THE_PRICE_OF_S4_ADENA);
sm.addString(_player.getName()); sm.addString(_player.getName());
sm.addInt(itemCount); sm.addInt(itemCount);
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(_price); sm.addInt(_price);
_target.sendPacket(sm); _target.sendPacket(sm);
} }
} }
@@ -687,7 +687,7 @@ public class RecipeManager
{ {
sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S); sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(itemCount); sm.addInt(itemCount);
} }
else else
{ {
@@ -49,7 +49,7 @@ public class Lottery
private static final String SELECT_LOTTERY_TICKET = "SELECT number1, number2, prize1, prize2, prize3 FROM lottery WHERE id = 1 and idnr = ?"; private static final String SELECT_LOTTERY_TICKET = "SELECT number1, number2, prize1, prize2, prize3 FROM lottery WHERE id = 1 and idnr = ?";
protected int _number; protected int _number;
protected long _prize; protected int _prize;
protected boolean _isSellingTickets; protected boolean _isSellingTickets;
protected boolean _isStarted; protected boolean _isStarted;
protected long _enddate; protected long _enddate;
@@ -93,8 +93,8 @@ public class Lottery
try (Connection con = DatabaseFactory.getConnection(); try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_PRICE)) PreparedStatement ps = con.prepareStatement(UPDATE_PRICE))
{ {
ps.setLong(1, _prize); ps.setInt(1, _prize);
ps.setLong(2, _prize); ps.setInt(2, _prize);
ps.setInt(3, _number); ps.setInt(3, _number);
ps.execute(); ps.execute();
} }
@@ -134,11 +134,11 @@ public class Lottery
if (rset.getInt("finished") == 1) if (rset.getInt("finished") == 1)
{ {
_number++; _number++;
_prize = rset.getLong("newprize"); _prize = rset.getInt("newprize");
} }
else else
{ {
_prize = rset.getLong("prize"); _prize = rset.getInt("prize");
_enddate = rset.getLong("enddate"); _enddate = rset.getLong("enddate");
if (_enddate <= (System.currentTimeMillis() + (2 * MINUTE))) if (_enddate <= (System.currentTimeMillis() + (2 * MINUTE)))
{ {
@@ -194,8 +194,8 @@ public class Lottery
ps.setInt(1, 1); ps.setInt(1, 1);
ps.setInt(2, _number); ps.setInt(2, _number);
ps.setLong(3, _enddate); ps.setLong(3, _enddate);
ps.setLong(4, _prize); ps.setInt(4, _prize);
ps.setLong(5, _prize); ps.setInt(5, _prize);
ps.execute(); ps.execute();
} }
catch (SQLException e) catch (SQLException e)
@@ -329,54 +329,54 @@ public class Lottery
LOGGER.log(Level.WARNING, "Lottery: Could restore lottery data: " + e.getMessage(), e); LOGGER.log(Level.WARNING, "Lottery: Could restore lottery data: " + e.getMessage(), e);
} }
final long prize4 = count4 * Config.ALT_LOTTERY_2_AND_1_NUMBER_PRIZE; final int prize4 = count4 * Config.ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;
long prize1 = 0; int prize1 = 0;
long prize2 = 0; int prize2 = 0;
long prize3 = 0; int prize3 = 0;
if (count1 > 0) if (count1 > 0)
{ {
prize1 = (long) (((_prize - prize4) * Config.ALT_LOTTERY_5_NUMBER_RATE) / count1); prize1 = (int) (((_prize - prize4) * Config.ALT_LOTTERY_5_NUMBER_RATE) / count1);
} }
if (count2 > 0) if (count2 > 0)
{ {
prize2 = (long) (((_prize - prize4) * Config.ALT_LOTTERY_4_NUMBER_RATE) / count2); prize2 = (int) (((_prize - prize4) * Config.ALT_LOTTERY_4_NUMBER_RATE) / count2);
} }
if (count3 > 0) if (count3 > 0)
{ {
prize3 = (long) (((_prize - prize4) * Config.ALT_LOTTERY_3_NUMBER_RATE) / count3); prize3 = (int) (((_prize - prize4) * Config.ALT_LOTTERY_3_NUMBER_RATE) / count3);
} }
final long newprize = _prize - (prize1 + prize2 + prize3 + prize4); final int newprize = _prize - (prize1 + prize2 + prize3 + prize4);
SystemMessage sm; SystemMessage sm;
if (count1 > 0) if (count1 > 0)
{ {
// There are winners. // There are winners.
sm = new SystemMessage(SystemMessageId.THE_PRIZE_AMOUNT_FOR_THE_WINNER_OF_LOTTERY_S1_IS_S2_ADENA_WE_HAVE_S3_FIRST_PRIZE_WINNERS); sm = new SystemMessage(SystemMessageId.THE_PRIZE_AMOUNT_FOR_THE_WINNER_OF_LOTTERY_S1_IS_S2_ADENA_WE_HAVE_S3_FIRST_PRIZE_WINNERS);
sm.addInt(_number); sm.addInt(_number);
sm.addLong(_prize); sm.addInt(_prize);
sm.addLong(count1); sm.addInt(count1);
} }
else else
{ {
// There are no winners. // There are no winners.
sm = new SystemMessage(SystemMessageId.THE_PRIZE_AMOUNT_FOR_LUCKY_LOTTERY_S1_IS_S2_ADENA_THERE_WAS_NO_FIRST_PRIZE_WINNER_IN_THIS_DRAWING_THEREFORE_THE_JACKPOT_WILL_BE_ADDED_TO_THE_NEXT_DRAWING); sm = new SystemMessage(SystemMessageId.THE_PRIZE_AMOUNT_FOR_LUCKY_LOTTERY_S1_IS_S2_ADENA_THERE_WAS_NO_FIRST_PRIZE_WINNER_IN_THIS_DRAWING_THEREFORE_THE_JACKPOT_WILL_BE_ADDED_TO_THE_NEXT_DRAWING);
sm.addInt(_number); sm.addInt(_number);
sm.addLong(_prize); sm.addInt(_prize);
} }
Broadcast.toAllOnlinePlayers(sm); Broadcast.toAllOnlinePlayers(sm);
try (Connection con = DatabaseFactory.getConnection(); try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_LOTTERY)) PreparedStatement ps = con.prepareStatement(UPDATE_LOTTERY))
{ {
ps.setLong(1, _prize); ps.setInt(1, _prize);
ps.setLong(2, newprize); ps.setInt(2, newprize);
ps.setInt(3, enchant); ps.setInt(3, enchant);
ps.setInt(4, type2); ps.setInt(4, type2);
ps.setLong(5, prize1); ps.setInt(5, prize1);
ps.setLong(6, prize2); ps.setInt(6, prize2);
ps.setLong(7, prize3); ps.setInt(7, prize3);
ps.setInt(8, _number); ps.setInt(8, _number);
ps.execute(); ps.execute();
} }
@@ -429,14 +429,14 @@ public class Lottery
return res; return res;
} }
public long[] checkTicket(Item item) public int[] checkTicket(Item item)
{ {
return checkTicket(item.getCustomType1(), item.getEnchantLevel(), item.getCustomType2()); return checkTicket(item.getCustomType1(), item.getEnchantLevel(), item.getCustomType2());
} }
public long[] checkTicket(int id, int enchant, int type2) public int[] checkTicket(int id, int enchant, int type2)
{ {
final long[] res = final int[] res =
{ {
0, 0,
0 0
@@ -482,19 +482,19 @@ public class Lottery
case 5: case 5:
{ {
res[0] = 1; res[0] = 1;
res[1] = rs.getLong("prize1"); res[1] = rs.getInt("prize1");
break; break;
} }
case 4: case 4:
{ {
res[0] = 2; res[0] = 2;
res[1] = rs.getLong("prize2"); res[1] = rs.getInt("prize2");
break; break;
} }
case 3: case 3:
{ {
res[0] = 3; res[0] = 3;
res[1] = rs.getLong("prize3"); res[1] = rs.getInt("prize3");
break; break;
} }
default: default:
@@ -77,7 +77,7 @@ public class MonsterRace
protected final List<Integer> _npcTemplates = new ArrayList<>(); // List holding npc templates, shuffled on a new race. protected final List<Integer> _npcTemplates = new ArrayList<>(); // List holding npc templates, shuffled on a new race.
protected final List<HistoryInfo> _history = new ArrayList<>(); // List holding old race records. protected final List<HistoryInfo> _history = new ArrayList<>(); // List holding old race records.
protected final Map<Integer, Long> _betsPerLane = new ConcurrentHashMap<>(); // Map holding all bets for each lane ; values setted to 0 after every race. protected final Map<Integer, Integer> _betsPerLane = new ConcurrentHashMap<>(); // Map holding all bets for each lane ; values setted to 0 after every race.
protected final List<Double> _odds = new ArrayList<>(); // List holding sorted odds per lane ; cleared at new odds calculation. protected final List<Double> _odds = new ArrayList<>(); // List holding sorted odds per lane ; cleared at new odds calculation.
protected int _raceNumber = 1; protected int _raceNumber = 1;
@@ -468,7 +468,7 @@ public class MonsterRace
while (rset.next()) while (rset.next())
{ {
setBetOnLane(rset.getInt("lane_id"), rset.getLong("bet"), false); setBetOnLane(rset.getInt("lane_id"), rset.getInt("bet"), false);
} }
rset.close(); rset.close();
@@ -485,13 +485,13 @@ public class MonsterRace
* @param lane : The lane to affect. * @param lane : The lane to affect.
* @param sum : The sum to set. * @param sum : The sum to set.
*/ */
protected void saveBet(int lane, long sum) protected void saveBet(int lane, int sum)
{ {
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection())
{ {
PreparedStatement statement = con.prepareStatement("REPLACE INTO mdt_bets (lane_id, bet) VALUES (?,?)"); PreparedStatement statement = con.prepareStatement("REPLACE INTO mdt_bets (lane_id, bet) VALUES (?,?)");
statement.setInt(1, lane); statement.setInt(1, lane);
statement.setLong(2, sum); statement.setInt(2, sum);
statement.execute(); statement.execute();
statement.close(); statement.close();
} }
@@ -508,7 +508,7 @@ public class MonsterRace
{ {
for (int key : _betsPerLane.keySet()) for (int key : _betsPerLane.keySet())
{ {
_betsPerLane.put(key, 0L); _betsPerLane.put(key, 0);
} }
try (Connection con = DatabaseFactory.getConnection()) try (Connection con = DatabaseFactory.getConnection())
@@ -529,9 +529,9 @@ public class MonsterRace
* @param amount : The amount to add. * @param amount : The amount to add.
* @param saveOnDb : Should it be saved on db or not. * @param saveOnDb : Should it be saved on db or not.
*/ */
public void setBetOnLane(int lane, long amount, boolean saveOnDb) public void setBetOnLane(int lane, int amount, boolean saveOnDb)
{ {
final long sum = (_betsPerLane.containsKey(lane)) ? _betsPerLane.get(lane) + amount : amount; final int sum = (_betsPerLane.containsKey(lane)) ? _betsPerLane.get(lane) + amount : amount;
_betsPerLane.put(lane, sum); _betsPerLane.put(lane, sum);
@@ -550,7 +550,7 @@ public class MonsterRace
_odds.clear(); _odds.clear();
// Sort bets lanes per lane. // Sort bets lanes per lane.
final Map<Integer, Long> sortedLanes = new TreeMap<>(_betsPerLane); final Map<Integer, Integer> sortedLanes = new TreeMap<>(_betsPerLane);
// Pass a first loop in order to calculate total sum of all lanes. // Pass a first loop in order to calculate total sum of all lanes.
long sumOfAllLanes = 0; long sumOfAllLanes = 0;
@@ -23,7 +23,7 @@ public class CropProcure extends SeedProduction
{ {
private final int _rewardType; private final int _rewardType;
public CropProcure(int id, long amount, int type, long startAmount, long price) public CropProcure(int id, int amount, int type, int startAmount, int price)
{ {
super(id, amount, price, startAmount); super(id, amount, price, startAmount);
_rewardType = type; _rewardType = type;
@@ -37,7 +37,7 @@ public class ItemInfo
private int _augmentation; private int _augmentation;
/** The quantity of Item */ /** The quantity of Item */
private long _count; private int _count;
/** The price of the Item */ /** The price of the Item */
private int _price; private int _price;
@@ -185,7 +185,7 @@ public class ItemInfo
return _augmentation; return _augmentation;
} }
public long getCount() public int getCount()
{ {
return _count; return _count;
} }
@@ -16,24 +16,21 @@
*/ */
package org.l2jmobius.gameserver.model; package org.l2jmobius.gameserver.model;
/**
*
*/
public class ItemRequest public class ItemRequest
{ {
int _objectId; int _objectId;
int _itemId; int _itemId;
long _count; int _count;
long _price; int _price;
public ItemRequest(int objectId, long count, long price) public ItemRequest(int objectId, int count, int price)
{ {
_objectId = objectId; _objectId = objectId;
_count = count; _count = count;
_price = price; _price = price;
} }
public ItemRequest(int objectId, int itemId, long count, long price) public ItemRequest(int objectId, int itemId, int count, int price)
{ {
_objectId = objectId; _objectId = objectId;
_itemId = itemId; _itemId = itemId;
@@ -51,17 +48,17 @@ public class ItemRequest
return _itemId; return _itemId;
} }
public void setCount(long count) public void setCount(int count)
{ {
_count = count; _count = count;
} }
public long getCount() public int getCount()
{ {
return _count; return _count;
} }
public long getPrice() public int getPrice()
{ {
return _price; return _price;
} }
@@ -21,10 +21,10 @@ import org.l2jmobius.gameserver.data.xml.RecipeData;
public class ManufactureItem public class ManufactureItem
{ {
private final int _recipeId; private final int _recipeId;
private final long _cost; private final int _cost;
private final boolean _isDwarven; private final boolean _isDwarven;
public ManufactureItem(int recipeId, long cost) public ManufactureItem(int recipeId, int cost)
{ {
_recipeId = recipeId; _recipeId = recipeId;
_cost = cost; _cost = cost;
@@ -36,7 +36,7 @@ public class ManufactureItem
return _recipeId; return _recipeId;
} }
public long getCost() public int getCost()
{ {
return _cost; return _cost;
} }
@@ -601,7 +601,7 @@ public class Party extends AbstractPlayerGroup
msg = new SystemMessage(SystemMessageId.C1_HAS_OBTAINED_S3_S2); msg = new SystemMessage(SystemMessageId.C1_HAS_OBTAINED_S3_S2);
msg.addString(target.getName()); msg.addString(target.getName());
msg.addItemName(item); msg.addItemName(item);
msg.addLong(item.getCount()); msg.addInt(item.getCount());
} }
else else
{ {
@@ -620,7 +620,7 @@ public class Party extends AbstractPlayerGroup
* @param spoil {@code true} if it's spoil loot * @param spoil {@code true} if it's spoil loot
* @param target the NPC target * @param target the NPC target
*/ */
public void distributeItem(Player player, int itemId, long itemCount, boolean spoil, Attackable target) public void distributeItem(Player player, int itemId, int itemCount, boolean spoil, Attackable target)
{ {
if (itemId == Inventory.ADENA_ID) if (itemId == Inventory.ADENA_ID)
{ {
@@ -641,7 +641,7 @@ public class Party extends AbstractPlayerGroup
msg = spoil ? new SystemMessage(SystemMessageId.C1_HAS_OBTAINED_S3_S2_BY_USING_SWEEPER) : new SystemMessage(SystemMessageId.C1_HAS_OBTAINED_S3_S2); msg = spoil ? new SystemMessage(SystemMessageId.C1_HAS_OBTAINED_S3_S2_BY_USING_SWEEPER) : new SystemMessage(SystemMessageId.C1_HAS_OBTAINED_S3_S2);
msg.addString(looter.getName()); msg.addString(looter.getName());
msg.addItemName(itemId); msg.addItemName(itemId);
msg.addLong(itemCount); msg.addInt(itemCount);
} }
else else
{ {
@@ -653,7 +653,7 @@ public class Party extends AbstractPlayerGroup
} }
/** /**
* Method overload for {@link Party#distributeItem(Player, int, long, boolean, Attackable)} * Method overload for {@link Party#distributeItem(Player, int, int, boolean, Attackable)}
* @param player the reference player * @param player the reference player
* @param item the item holder * @param item the item holder
* @param spoil {@code true} if it's spoil loot * @param spoil {@code true} if it's spoil loot
@@ -670,7 +670,7 @@ public class Party extends AbstractPlayerGroup
* @param adena * @param adena
* @param target * @param target
*/ */
public void distributeAdena(Player player, long adena, Creature target) public void distributeAdena(Player player, int adena, Creature target)
{ {
// Check the number of party members that must be rewarded // Check the number of party members that must be rewarded
// (The party member must be in range to receive its reward) // (The party member must be in range to receive its reward)
@@ -687,7 +687,7 @@ public class Party extends AbstractPlayerGroup
{ {
// Now we can actually distribute the adena reward // Now we can actually distribute the adena reward
// (Total adena splitted by the number of party members that are in range and must be rewarded) // (Total adena splitted by the number of party members that are in range and must be rewarded)
final long count = adena / toReward.size(); final int count = adena / toReward.size();
for (Player member : toReward) for (Player member : toReward)
{ {
member.addAdena("Party", count, player, true); member.addAdena("Party", count, player, true);
@@ -16,7 +16,7 @@
*/ */
package org.l2jmobius.gameserver.model; package org.l2jmobius.gameserver.model;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicInteger;
/** /**
* @author xban1x * @author xban1x
@@ -24,14 +24,14 @@ import java.util.concurrent.atomic.AtomicLong;
public class SeedProduction public class SeedProduction
{ {
private final int _seedId; private final int _seedId;
private final long _price; private final int _price;
private final long _startAmount; private final int _startAmount;
private final AtomicLong _amount; private final AtomicInteger _amount;
public SeedProduction(int id, long amount, long price, long startAmount) public SeedProduction(int id, int amount, int price, int startAmount)
{ {
_seedId = id; _seedId = id;
_amount = new AtomicLong(amount); _amount = new AtomicInteger(amount);
_price = price; _price = price;
_startAmount = startAmount; _startAmount = startAmount;
} }
@@ -41,30 +41,30 @@ public class SeedProduction
return _seedId; return _seedId;
} }
public long getAmount() public int getAmount()
{ {
return _amount.get(); return _amount.get();
} }
public long getPrice() public int getPrice()
{ {
return _price; return _price;
} }
public long getStartAmount() public int getStartAmount()
{ {
return _startAmount; return _startAmount;
} }
public void setAmount(long amount) public void setAmount(int amount)
{ {
_amount.set(amount); _amount.set(amount);
} }
public boolean decreaseAmount(long value) public boolean decreaseAmount(int value)
{ {
long current; int current;
long next; int next;
do do
{ {
current = _amount.get(); current = _amount.get();
@@ -27,12 +27,12 @@ public class TradeItem
private int _enchant; private int _enchant;
private final int _type1; private final int _type1;
private final int _type2; private final int _type2;
private long _count; private int _count;
private long _storeCount; private int _storeCount;
private long _price; private int _price;
private final int[] _enchantOptions; private final int[] _enchantOptions;
public TradeItem(Item item, long count, long price) public TradeItem(Item item, int count, int price)
{ {
_objectId = item.getObjectId(); _objectId = item.getObjectId();
_item = item.getTemplate(); _item = item.getTemplate();
@@ -45,7 +45,7 @@ public class TradeItem
_enchantOptions = item.getEnchantOptions(); _enchantOptions = item.getEnchantOptions();
} }
public TradeItem(ItemTemplate item, long count, long price) public TradeItem(ItemTemplate item, int count, int price)
{ {
_objectId = 0; _objectId = 0;
_item = item; _item = item;
@@ -59,7 +59,7 @@ public class TradeItem
_enchantOptions = Item.DEFAULT_ENCHANT_OPTIONS; _enchantOptions = Item.DEFAULT_ENCHANT_OPTIONS;
} }
public TradeItem(TradeItem item, long count, long price) public TradeItem(TradeItem item, int count, int price)
{ {
_objectId = item.getObjectId(); _objectId = item.getObjectId();
_item = item.getItem(); _item = item.getItem();
@@ -113,27 +113,27 @@ public class TradeItem
return _type2; return _type2;
} }
public void setCount(long count) public void setCount(int count)
{ {
_count = count; _count = count;
} }
public long getCount() public int getCount()
{ {
return _count; return _count;
} }
public long getStoreCount() public int getStoreCount()
{ {
return _storeCount; return _storeCount;
} }
public void setPrice(long price) public void setPrice(int price)
{ {
_price = price; _price = price;
} }
public long getPrice() public int getPrice()
{ {
return _price; return _price;
} }
@@ -163,7 +163,7 @@ public class TradeList
* @param count : int * @param count : int
* @return * @return
*/ */
public TradeItem addItem(int objectId, long count) public TradeItem addItem(int objectId, int count)
{ {
return addItem(objectId, count, 0); return addItem(objectId, count, 0);
} }
@@ -175,7 +175,7 @@ public class TradeList
* @param price : long * @param price : long
* @return * @return
*/ */
public synchronized TradeItem addItem(int objectId, long count, long price) public synchronized TradeItem addItem(int objectId, int count, int price)
{ {
if (_locked) if (_locked)
{ {
@@ -237,7 +237,7 @@ public class TradeList
* @param price * @param price
* @return * @return
*/ */
public synchronized TradeItem addItemByItemId(int itemId, long count, long price) public synchronized TradeItem addItemByItemId(int itemId, int count, int price)
{ {
if (_locked) if (_locked)
{ {
@@ -284,7 +284,7 @@ public class TradeList
* @param count : int * @param count : int
* @return * @return
*/ */
private synchronized TradeItem removeItem(int objectId, int itemId, long count) private synchronized TradeItem removeItem(int objectId, int itemId, int count)
{ {
if (_locked) if (_locked)
{ {
@@ -635,7 +635,7 @@ public class TradeList
int slots = 0; int slots = 0;
int weight = 0; int weight = 0;
long totalPrice = 0; int totalPrice = 0;
final PlayerInventory ownerInventory = _owner.getInventory(); final PlayerInventory ownerInventory = _owner.getInventory();
final PlayerInventory playerInventory = player.getInventory(); final PlayerInventory playerInventory = player.getInventory();
@@ -796,12 +796,12 @@ public class TradeList
msg = new SystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg = new SystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S);
msg.addString(player.getName()); msg.addString(player.getName());
msg.addItemName(newItem); msg.addItemName(newItem);
msg.addLong(item.getCount()); msg.addInt(item.getCount());
_owner.sendPacket(msg); _owner.sendPacket(msg);
msg = new SystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg = new SystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1);
msg.addString(_owner.getName()); msg.addString(_owner.getName());
msg.addItemName(newItem); msg.addItemName(newItem);
msg.addLong(item.getCount()); msg.addInt(item.getCount());
} }
else else
{ {
@@ -843,7 +843,7 @@ public class TradeList
// Prepare inventory update packet // Prepare inventory update packet
final InventoryUpdate ownerIU = new InventoryUpdate(); final InventoryUpdate ownerIU = new InventoryUpdate();
final InventoryUpdate playerIU = new InventoryUpdate(); final InventoryUpdate playerIU = new InventoryUpdate();
long totalPrice = 0; int totalPrice = 0;
for (ItemRequest item : items) for (ItemRequest item : items)
{ {
// searching item in tradelist using itemId // searching item in tradelist using itemId
@@ -879,7 +879,7 @@ public class TradeList
break; break;
} }
final long _totalPrice = totalPrice + (item.getCount() * item.getPrice()); final int _totalPrice = totalPrice + (item.getCount() * item.getPrice());
// check for overflow of the total price // check for overflow of the total price
if ((MAX_ADENA < _totalPrice) || (_totalPrice < 0)) if ((MAX_ADENA < _totalPrice) || (_totalPrice < 0))
{ {
@@ -960,12 +960,12 @@ public class TradeList
msg = new SystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg = new SystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1);
msg.addString(player.getName()); msg.addString(player.getName());
msg.addItemName(newItem); msg.addItemName(newItem);
msg.addLong(item.getCount()); msg.addInt(item.getCount());
_owner.sendPacket(msg); _owner.sendPacket(msg);
msg = new SystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg = new SystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S);
msg.addString(_owner.getName()); msg.addString(_owner.getName());
msg.addItemName(newItem); msg.addItemName(newItem);
msg.addLong(item.getCount()); msg.addInt(item.getCount());
} }
else else
{ {
@@ -1108,7 +1108,7 @@ public class Attackable extends Npc
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_DIED_AND_DROPPED_S3_S2); final SystemMessage sm = new SystemMessage(SystemMessageId.C1_DIED_AND_DROPPED_S3_S2);
sm.addString(getName()); sm.addString(getName());
sm.addItemName(item); sm.addItemName(item);
sm.addLong(drop.getCount()); sm.addInt(drop.getCount());
broadcastPacket(sm); broadcastPacket(sm);
} }
} }
@@ -387,14 +387,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return null; return null;
} }
public boolean destroyItemByItemId(String process, int itemId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItemByItemId(String process, int itemId, int count, WorldObject reference, boolean sendMessage)
{ {
// Default: NPCs consume virtual items for their skills // Default: NPCs consume virtual items for their skills
// TODO: should be logged if even happens.. should be false // TODO: should be logged if even happens.. should be false
return true; return true;
} }
public boolean destroyItem(String process, int objectId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItem(String process, int objectId, int count, WorldObject reference, boolean sendMessage)
{ {
// Default: NPCs consume virtual items for their skills // Default: NPCs consume virtual items for their skills
// TODO: should be logged if even happens.. should be false // TODO: should be logged if even happens.. should be false
@@ -1720,7 +1720,7 @@ public class Npc extends Creature
* @param itemCount the item count * @param itemCount the item count
* @return the dropped item * @return the dropped item
*/ */
public Item dropItem(Creature creature, int itemId, long itemCount) public Item dropItem(Creature creature, int itemId, int itemCount)
{ {
Item item = null; Item item = null;
for (int i = 0; i < itemCount; i++) for (int i = 0; i < itemCount; i++)
@@ -1766,7 +1766,7 @@ public class Npc extends Creature
} }
/** /**
* Method overload for {@link Attackable#dropItem(Creature, int, long)} * Method overload for {@link Attackable#dropItem(Creature, int, int)}
* @param creature the last attacker or main damage dealer * @param creature the last attacker or main damage dealer
* @param item the item holder * @param item the item holder
* @return the dropped item * @return the dropped item
@@ -2886,7 +2886,7 @@ public class Player extends Playable
/** /**
* @return the Adena amount of the Player. * @return the Adena amount of the Player.
*/ */
public long getAdena() public int getAdena()
{ {
return _inventory.getAdena(); return _inventory.getAdena();
} }
@@ -2894,7 +2894,7 @@ public class Player extends Playable
/** /**
* @return the Ancient Adena amount of the Player. * @return the Ancient Adena amount of the Player.
*/ */
public long getAncientAdena() public int getAncientAdena()
{ {
return _inventory.getAncientAdena(); return _inventory.getAncientAdena();
} }
@@ -2906,12 +2906,12 @@ public class Player extends Playable
* @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation * @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation
* @param sendMessage : boolean Specifies whether to send message to Client about this action * @param sendMessage : boolean Specifies whether to send message to Client about this action
*/ */
public void addAdena(String process, long count, WorldObject reference, boolean sendMessage) public void addAdena(String process, int count, WorldObject reference, boolean sendMessage)
{ {
if (sendMessage) if (sendMessage)
{ {
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1_ADENA); final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1_ADENA);
sm.addLong(count); sm.addInt(count);
sendPacket(sm); sendPacket(sm);
} }
@@ -2942,7 +2942,7 @@ public class Player extends Playable
* @param sendMessage : boolean Specifies whether to send message to Client about this action * @param sendMessage : boolean Specifies whether to send message to Client about this action
* @return boolean informing if the action was successful * @return boolean informing if the action was successful
*/ */
public boolean reduceAdena(String process, long count, WorldObject reference, boolean sendMessage) public boolean reduceAdena(String process, int count, WorldObject reference, boolean sendMessage)
{ {
if (count > _inventory.getAdena()) if (count > _inventory.getAdena())
{ {
@@ -2976,7 +2976,7 @@ public class Player extends Playable
if (sendMessage) if (sendMessage)
{ {
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_ADENA_DISAPPEARED); final SystemMessage sm = new SystemMessage(SystemMessageId.S1_ADENA_DISAPPEARED);
sm.addLong(count); sm.addInt(count);
sendPacket(sm); sendPacket(sm);
} }
} }
@@ -2991,13 +2991,13 @@ public class Player extends Playable
* @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation * @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation
* @param sendMessage : boolean Specifies whether to send message to Client about this action * @param sendMessage : boolean Specifies whether to send message to Client about this action
*/ */
public void addAncientAdena(String process, long count, WorldObject reference, boolean sendMessage) public void addAncientAdena(String process, int count, WorldObject reference, boolean sendMessage)
{ {
if (sendMessage) if (sendMessage)
{ {
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S); final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
sm.addItemName(Inventory.ANCIENT_ADENA_ID); sm.addItemName(Inventory.ANCIENT_ADENA_ID);
sm.addLong(count); sm.addInt(count);
sendPacket(sm); sendPacket(sm);
} }
@@ -3027,7 +3027,7 @@ public class Player extends Playable
* @param sendMessage : boolean Specifies whether to send message to Client about this action * @param sendMessage : boolean Specifies whether to send message to Client about this action
* @return boolean informing if the action was successful * @return boolean informing if the action was successful
*/ */
public boolean reduceAncientAdena(String process, long count, WorldObject reference, boolean sendMessage) public boolean reduceAncientAdena(String process, int count, WorldObject reference, boolean sendMessage)
{ {
if (count > _inventory.getAncientAdena()) if (count > _inventory.getAncientAdena())
{ {
@@ -3064,7 +3064,7 @@ public class Player extends Playable
{ {
sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(Inventory.ANCIENT_ADENA_ID); sm.addItemName(Inventory.ANCIENT_ADENA_ID);
sm.addLong(count); sm.addInt(count);
} }
else else
{ {
@@ -3097,7 +3097,7 @@ public class Player extends Playable
{ {
sm = new SystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S2_S1); sm = new SystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S2_S1);
sm.addItemName(item); sm.addItemName(item);
sm.addLong(item.getCount()); sm.addInt(item.getCount());
} }
else if (item.getEnchantLevel() > 0) else if (item.getEnchantLevel() > 0)
{ {
@@ -3154,7 +3154,7 @@ public class Player extends Playable
* @param sendMessage : boolean Specifies whether to send message to Client about this action * @param sendMessage : boolean Specifies whether to send message to Client about this action
* @return * @return
*/ */
public Item addItem(String process, int itemId, long count, WorldObject reference, boolean sendMessage) public Item addItem(String process, int itemId, int count, WorldObject reference, boolean sendMessage)
{ {
if (count > 0) if (count > 0)
{ {
@@ -3173,14 +3173,14 @@ public class Player extends Playable
{ {
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S); final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(count); sm.addInt(count);
sendPacket(sm); sendPacket(sm);
} }
else else
{ {
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S2_S1); final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S2_S1);
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(count); sm.addInt(count);
sendPacket(sm); sendPacket(sm);
} }
} }
@@ -3264,7 +3264,7 @@ public class Player extends Playable
* @param sendMessage : boolean Specifies whether to send message to Client about this action * @param sendMessage : boolean Specifies whether to send message to Client about this action
* @return boolean informing if the action was successful * @return boolean informing if the action was successful
*/ */
public boolean destroyItem(String process, Item item, long count, WorldObject reference, boolean sendMessage) public boolean destroyItem(String process, Item item, int count, WorldObject reference, boolean sendMessage)
{ {
final Item destoyedItem = _inventory.destroyItem(process, item, count, this, reference); final Item destoyedItem = _inventory.destroyItem(process, item, count, this, reference);
if (destoyedItem == null) if (destoyedItem == null)
@@ -3301,7 +3301,7 @@ public class Player extends Playable
{ {
sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(destoyedItem); sm.addItemName(destoyedItem);
sm.addLong(count); sm.addInt(count);
} }
else else
{ {
@@ -3324,7 +3324,7 @@ public class Player extends Playable
* @return boolean informing if the action was successful * @return boolean informing if the action was successful
*/ */
@Override @Override
public boolean destroyItem(String process, int objectId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItem(String process, int objectId, int count, WorldObject reference, boolean sendMessage)
{ {
final Item item = _inventory.getItemByObjectId(objectId); final Item item = _inventory.getItemByObjectId(objectId);
if (item != null) if (item != null)
@@ -3347,7 +3347,7 @@ public class Player extends Playable
* @param sendMessage : boolean Specifies whether to send message to Client about this action * @param sendMessage : boolean Specifies whether to send message to Client about this action
* @return boolean informing if the action was successful * @return boolean informing if the action was successful
*/ */
public boolean destroyItemWithoutTrace(String process, int objectId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItemWithoutTrace(String process, int objectId, int count, WorldObject reference, boolean sendMessage)
{ {
final Item item = _inventory.getItemByObjectId(objectId); final Item item = _inventory.getItemByObjectId(objectId);
if ((item != null) && (item.getCount() >= count)) if ((item != null) && (item.getCount() >= count))
@@ -3371,7 +3371,7 @@ public class Player extends Playable
* @return boolean informing if the action was successful * @return boolean informing if the action was successful
*/ */
@Override @Override
public boolean destroyItemByItemId(String process, int itemId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItemByItemId(String process, int itemId, int count, WorldObject reference, boolean sendMessage)
{ {
if (itemId == Inventory.ADENA_ID) if (itemId == Inventory.ADENA_ID)
{ {
@@ -3379,7 +3379,7 @@ public class Player extends Playable
} }
final Item item = _inventory.getItemByItemId(itemId); final Item item = _inventory.getItemByItemId(itemId);
final long quantity = (count < 0) && (item != null) ? item.getCount() : count; final int quantity = (count < 0) && (item != null) ? item.getCount() : count;
if ((item == null) || (item.getCount() < quantity) || (quantity <= 0) || (_inventory.destroyItemByItemId(process, itemId, quantity, this, reference) == null)) if ((item == null) || (item.getCount() < quantity) || (quantity <= 0) || (_inventory.destroyItemByItemId(process, itemId, quantity, this, reference) == null))
{ {
if (sendMessage) if (sendMessage)
@@ -3414,7 +3414,7 @@ public class Player extends Playable
{ {
sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(itemId); sm.addItemName(itemId);
sm.addLong(count); sm.addInt(count);
} }
else else
{ {
@@ -3436,7 +3436,7 @@ public class Player extends Playable
* @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation * @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation
* @return Item corresponding to the new item or the updated item in inventory * @return Item corresponding to the new item or the updated item in inventory
*/ */
public Item transferItem(String process, int objectId, long count, Inventory target, WorldObject reference) public Item transferItem(String process, int objectId, int count, Inventory target, WorldObject reference)
{ {
final Item oldItem = checkItemManipulation(objectId, count, "transfer"); final Item oldItem = checkItemManipulation(objectId, count, "transfer");
if (oldItem == null) if (oldItem == null)
@@ -3517,7 +3517,7 @@ public class Player extends Playable
} }
/** /**
* Use instead of calling {@link #addItem(String, Item, WorldObject, boolean)} and {@link #destroyItemByItemId(String, int, long, WorldObject, boolean)}<br> * Use instead of calling {@link #addItem(String, Item, WorldObject, boolean)} and {@link #destroyItemByItemId(String, int, int, WorldObject, boolean)}<br>
* This method validates slots and weight limit, for stackable and non-stackable items. * This method validates slots and weight limit, for stackable and non-stackable items.
* @param process a generic string representing the process that is exchanging this items * @param process a generic string representing the process that is exchanging this items
* @param reference the (probably NPC) reference, could be null * @param reference the (probably NPC) reference, could be null
@@ -3528,7 +3528,7 @@ public class Player extends Playable
* @param sendMessage if {@code true} it will send messages to the acting player * @param sendMessage if {@code true} it will send messages to the acting player
* @return {@code true} if the player successfully exchanged the items, {@code false} otherwise * @return {@code true} if the player successfully exchanged the items, {@code false} otherwise
*/ */
public boolean exchangeItemsById(String process, WorldObject reference, int coinId, long cost, int rewardId, long count, boolean sendMessage) public boolean exchangeItemsById(String process, WorldObject reference, int coinId, int cost, int rewardId, int count, boolean sendMessage)
{ {
if (!_inventory.validateCapacityByItemId(rewardId, count)) if (!_inventory.validateCapacityByItemId(rewardId, count))
{ {
@@ -3645,7 +3645,7 @@ public class Player extends Playable
* @param protectItem * @param protectItem
* @return Item corresponding to the new item or the updated item in inventory * @return Item corresponding to the new item or the updated item in inventory
*/ */
public Item dropItem(String process, int objectId, long count, int x, int y, int z, WorldObject reference, boolean sendMessage, boolean protectItem) public Item dropItem(String process, int objectId, int count, int x, int y, int z, WorldObject reference, boolean sendMessage, boolean protectItem)
{ {
final Item invitem = _inventory.getItemByObjectId(objectId); final Item invitem = _inventory.getItemByObjectId(objectId);
final Item item = _inventory.dropItem(process, objectId, count, this, reference); final Item item = _inventory.dropItem(process, objectId, count, this, reference);
@@ -3706,7 +3706,7 @@ public class Player extends Playable
return item; return item;
} }
public Item checkItemManipulation(int objectId, long count, String action) public Item checkItemManipulation(int objectId, int count, String action)
{ {
// TODO: if we remove objects that are not visible from the World, we'll have to remove this check // TODO: if we remove objects that are not visible from the World, we'll have to remove this check
if (World.getInstance().findObject(objectId) == null) if (World.getInstance().findObject(objectId) == null)
@@ -4219,7 +4219,7 @@ public class Player extends Playable
* @param itemId the item ID * @param itemId the item ID
* @param itemCount the item count * @param itemCount the item count
*/ */
public void doAutoLoot(Attackable target, int itemId, long itemCount) public void doAutoLoot(Attackable target, int itemId, int itemCount)
{ {
if (isInParty() && !ItemTable.getInstance().getTemplate(itemId).hasExImmediateEffect()) if (isInParty() && !ItemTable.getInstance().getTemplate(itemId).hasExImmediateEffect())
{ {
@@ -4236,7 +4236,7 @@ public class Player extends Playable
} }
/** /**
* Method overload for {@link Player#doAutoLoot(Attackable, int, long)} * Method overload for {@link Player#doAutoLoot(Attackable, int, int)}
* @param target the NPC dropping the item * @param target the NPC dropping the item
* @param item the item holder * @param item the item holder
*/ */
@@ -4313,13 +4313,13 @@ public class Player extends Playable
if (target.getId() == Inventory.ADENA_ID) if (target.getId() == Inventory.ADENA_ID)
{ {
smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S1_ADENA); smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S1_ADENA);
smsg.addLong(target.getCount()); smsg.addInt(target.getCount());
} }
else if (target.getCount() > 1) else if (target.getCount() > 1)
{ {
smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S2_S1_S); smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S2_S1_S);
smsg.addItemName(target); smsg.addItemName(target);
smsg.addLong(target.getCount()); smsg.addInt(target.getCount());
} }
else else
{ {
@@ -7737,7 +7737,7 @@ public class Player extends Playable
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S); final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
sm.addItemName(henna.getDyeItemId()); sm.addItemName(henna.getDyeItemId());
sm.addLong(henna.getCancelCount()); sm.addInt(henna.getCancelCount());
sendPacket(sm); sendPacket(sm);
sendPacket(SystemMessageId.THE_SYMBOL_HAS_BEEN_DELETED); sendPacket(SystemMessageId.THE_SYMBOL_HAS_BEEN_DELETED);
@@ -12385,7 +12385,7 @@ public class Player extends Playable
{ {
while (rs.next()) while (rs.next())
{ {
getManufactureItems().put(rs.getInt("recipeId"), new ManufactureItem(rs.getInt("recipeId"), rs.getLong("price"))); getManufactureItems().put(rs.getInt("recipeId"), new ManufactureItem(rs.getInt("recipeId"), rs.getInt("price")));
} }
} }
} }
@@ -94,10 +94,10 @@ public class Auctioneer extends Npc
try try
{ {
final SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm"); final SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
long bid = 0; int bid = 0;
if (st.countTokens() >= 1) if (st.countTokens() >= 1)
{ {
bid = Math.min(Long.parseLong(st.nextToken()), MAX_ADENA); bid = Math.min(Integer.parseInt(st.nextToken()), MAX_ADENA);
} }
final ClanHallAuction a = new ClanHallAuction(player.getClan().getHideoutId(), player.getClan(), days * 86400000, bid, ClanHallTable.getInstance().getClanHallByOwner(player.getClan()).getName()); final ClanHallAuction a = new ClanHallAuction(player.getClan().getHideoutId(), player.getClan(), days * 86400000, bid, ClanHallTable.getInstance().getClanHallByOwner(player.getClan()).getName());
@@ -204,10 +204,10 @@ public class Auctioneer extends Npc
final int auctionId = Integer.parseInt(val); final int auctionId = Integer.parseInt(val);
try try
{ {
long bid = 0; int bid = 0;
if (st.countTokens() >= 1) if (st.countTokens() >= 1)
{ {
bid = Math.min(Long.parseLong(st.nextToken()), MAX_ADENA); bid = Math.min(Integer.parseInt(st.nextToken()), MAX_ADENA);
} }
ClanHallAuctionManager.getInstance().getAuction(auctionId).setBid(player, bid); ClanHallAuctionManager.getInstance().getAuction(auctionId).setBid(player, bid);
@@ -362,7 +362,7 @@ public class Pet extends Summon
* @return boolean informing if the action was successfull * @return boolean informing if the action was successfull
*/ */
@Override @Override
public boolean destroyItem(String process, int objectId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItem(String process, int objectId, int count, WorldObject reference, boolean sendMessage)
{ {
final Item item = _inventory.destroyItem(process, objectId, count, getOwner(), reference); final Item item = _inventory.destroyItem(process, objectId, count, getOwner(), reference);
if (item == null) if (item == null)
@@ -386,7 +386,7 @@ public class Pet extends Summon
{ {
sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(item.getId()); sm.addItemName(item.getId());
sm.addLong(count); sm.addInt(count);
} }
else else
{ {
@@ -407,7 +407,7 @@ public class Pet extends Summon
* @return boolean informing if the action was successfull * @return boolean informing if the action was successfull
*/ */
@Override @Override
public boolean destroyItemByItemId(String process, int itemId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItemByItemId(String process, int itemId, int count, WorldObject reference, boolean sendMessage)
{ {
final Item item = _inventory.destroyItemByItemId(process, itemId, count, getOwner(), reference); final Item item = _inventory.destroyItemByItemId(process, itemId, count, getOwner(), reference);
if (item == null) if (item == null)
@@ -431,7 +431,7 @@ public class Pet extends Summon
{ {
sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(item.getId()); sm.addItemName(item.getId());
sm.addLong(count); sm.addInt(count);
} }
else else
{ {
@@ -506,13 +506,13 @@ public class Pet extends Summon
if (target.getId() == Inventory.ADENA_ID) if (target.getId() == Inventory.ADENA_ID)
{ {
smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S1_ADENA); smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S1_ADENA);
smsg.addLong(target.getCount()); smsg.addInt(target.getCount());
} }
else if (target.getCount() > 1) else if (target.getCount() > 1)
{ {
smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S2_S1_S); smsg = new SystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_PICK_UP_S2_S1_S);
smsg.addItemName(target); smsg.addItemName(target);
smsg.addLong(target.getCount()); smsg.addInt(target.getCount());
} }
else else
{ {
@@ -559,7 +559,7 @@ public class Pet extends Summon
if (target.getId() == Inventory.ADENA_ID) if (target.getId() == Inventory.ADENA_ID)
{ {
smsg = new SystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S1_ADENA); smsg = new SystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S1_ADENA);
smsg.addLong(target.getCount()); smsg.addInt(target.getCount());
sendPacket(smsg); sendPacket(smsg);
} }
else if (target.getEnchantLevel() > 0) else if (target.getEnchantLevel() > 0)
@@ -572,7 +572,7 @@ public class Pet extends Summon
else if (target.getCount() > 1) else if (target.getCount() > 1)
{ {
smsg = new SystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S2_S1_S); smsg = new SystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S2_S1_S);
smsg.addLong(target.getCount()); smsg.addInt(target.getCount());
smsg.addItemName(target); smsg.addItemName(target);
sendPacket(smsg); sendPacket(smsg);
} }
@@ -668,7 +668,7 @@ public class Pet extends Summon
* @param reference Object referencing current action like NPC selling item or previous item in transformation * @param reference Object referencing current action like NPC selling item or previous item in transformation
* @return Item corresponding to the new item or the updated item in inventory * @return Item corresponding to the new item or the updated item in inventory
*/ */
public Item transferItem(String process, int objectId, long count, Inventory target, Player actor, WorldObject reference) public Item transferItem(String process, int objectId, int count, Inventory target, Player actor, WorldObject reference)
{ {
final Item oldItem = _inventory.getItemByObjectId(objectId); final Item oldItem = _inventory.getItemByObjectId(objectId);
final Item playerOldItem = target.getItemByItemId(oldItem.getId()); final Item playerOldItem = target.getItemByItemId(oldItem.getId());
@@ -363,13 +363,13 @@ public class Servitor extends Summon implements Runnable
} }
@Override @Override
public boolean destroyItem(String process, int objectId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItem(String process, int objectId, int count, WorldObject reference, boolean sendMessage)
{ {
return getOwner().destroyItem(process, objectId, count, reference, sendMessage); return getOwner().destroyItem(process, objectId, count, reference, sendMessage);
} }
@Override @Override
public boolean destroyItemByItemId(String process, int itemId, long count, WorldObject reference, boolean sendMessage) public boolean destroyItemByItemId(String process, int itemId, int count, WorldObject reference, boolean sendMessage)
{ {
return getOwner().destroyItemByItemId(process, itemId, count, reference, sendMessage); return getOwner().destroyItemByItemId(process, itemId, count, reference, sendMessage);
} }
@@ -302,19 +302,19 @@ public class SignsPriest extends Npc
final Item contribBlueStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID); final Item contribBlueStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
final Item contribGreenStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID); final Item contribGreenStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
final Item contribRedStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID); final Item contribRedStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID);
final long contribBlueStoneCount = contribBlueStones == null ? 0 : contribBlueStones.getCount(); final int contribBlueStoneCount = contribBlueStones == null ? 0 : contribBlueStones.getCount();
final long contribGreenStoneCount = contribGreenStones == null ? 0 : contribGreenStones.getCount(); final int contribGreenStoneCount = contribGreenStones == null ? 0 : contribGreenStones.getCount();
final long contribRedStoneCount = contribRedStones == null ? 0 : contribRedStones.getCount(); final int contribRedStoneCount = contribRedStones == null ? 0 : contribRedStones.getCount();
long score = SevenSigns.getInstance().getPlayerContribScore(player.getObjectId()); int score = SevenSigns.getInstance().getPlayerContribScore(player.getObjectId());
long contributionCount = 0; int contributionCount = 0;
boolean contribStonesFound = false; boolean contribStonesFound = false;
long redContrib = 0; int redContrib = 0;
long greenContrib = 0; int greenContrib = 0;
long blueContrib = 0; int blueContrib = 0;
try try
{ {
contributionCount = Long.parseLong(command.substring(19).trim()); contributionCount = Integer.parseInt(command.substring(19).trim());
} }
catch (Exception nfe) catch (Exception nfe)
{ {
@@ -365,7 +365,7 @@ public class SignsPriest extends Npc
contribStonesFound = true; contribStonesFound = true;
final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
msg.addItemName(SevenSigns.SEAL_STONE_RED_ID); msg.addItemName(SevenSigns.SEAL_STONE_RED_ID);
msg.addLong(redContrib); msg.addInt(redContrib);
player.sendPacket(msg); player.sendPacket(msg);
} }
if ((greenContrib > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_GREEN_ID, greenContrib, this, false)) if ((greenContrib > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_GREEN_ID, greenContrib, this, false))
@@ -373,7 +373,7 @@ public class SignsPriest extends Npc
contribStonesFound = true; contribStonesFound = true;
final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
msg.addItemName(SevenSigns.SEAL_STONE_GREEN_ID); msg.addItemName(SevenSigns.SEAL_STONE_GREEN_ID);
msg.addLong(greenContrib); msg.addInt(greenContrib);
player.sendPacket(msg); player.sendPacket(msg);
} }
if ((blueContrib > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_BLUE_ID, blueContrib, this, false)) if ((blueContrib > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_BLUE_ID, blueContrib, this, false))
@@ -381,7 +381,7 @@ public class SignsPriest extends Npc
contribStonesFound = true; contribStonesFound = true;
final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
msg.addItemName(SevenSigns.SEAL_STONE_BLUE_ID); msg.addItemName(SevenSigns.SEAL_STONE_BLUE_ID);
msg.addLong(blueContrib); msg.addInt(blueContrib);
player.sendPacket(msg); player.sendPacket(msg);
} }
@@ -400,7 +400,7 @@ public class SignsPriest extends Npc
{ {
score = SevenSigns.getInstance().addPlayerStoneContrib(player.getObjectId(), blueContrib, greenContrib, redContrib); score = SevenSigns.getInstance().addPlayerStoneContrib(player.getObjectId(), blueContrib, greenContrib, redContrib);
sm = new SystemMessage(SystemMessageId.YOUR_CONTRIBUTION_SCORE_HAS_INCREASED_BY_S1); sm = new SystemMessage(SystemMessageId.YOUR_CONTRIBUTION_SCORE_HAS_INCREASED_BY_S1);
sm.addLong(score); sm.addInt(score);
player.sendPacket(sm); player.sendPacket(sm);
if (this instanceof DawnPriest) if (this instanceof DawnPriest)
@@ -421,10 +421,10 @@ public class SignsPriest extends Npc
final Item blueStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID); final Item blueStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
final Item greenStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID); final Item greenStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
final Item redStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID); final Item redStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID);
final long blueStoneCount = blueStones == null ? 0 : blueStones.getCount(); final int blueStoneCount = blueStones == null ? 0 : blueStones.getCount();
final long greenStoneCount = greenStones == null ? 0 : greenStones.getCount(); final int greenStoneCount = greenStones == null ? 0 : greenStones.getCount();
final long redStoneCount = redStones == null ? 0 : redStones.getCount(); final int redStoneCount = redStones == null ? 0 : redStones.getCount();
long contribScore = SevenSigns.getInstance().getPlayerContribScore(player.getObjectId()); int contribScore = SevenSigns.getInstance().getPlayerContribScore(player.getObjectId());
boolean stonesFound = false; boolean stonesFound = false;
if (contribScore == Config.ALT_MAXIMUM_PLAYER_CONTRIB) if (contribScore == Config.ALT_MAXIMUM_PLAYER_CONTRIB)
{ {
@@ -432,12 +432,12 @@ public class SignsPriest extends Npc
} }
else else
{ {
long redContribCount = 0; int redContribCount = 0;
long greenContribCount = 0; int greenContribCount = 0;
long blueContribCount = 0; int blueContribCount = 0;
String contribStoneColor = null; String contribStoneColor = null;
String stoneColorContr = null; String stoneColorContr = null;
long stoneCountContr = 0; int stoneCountContr = 0;
int stoneIdContr = 0; int stoneIdContr = 0;
switch (stoneType) switch (stoneType)
@@ -468,7 +468,7 @@ public class SignsPriest extends Npc
} }
case 4: case 4:
{ {
long tempContribScore = contribScore; int tempContribScore = contribScore;
redContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.RED_CONTRIB_POINTS; redContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.RED_CONTRIB_POINTS;
if (redContribCount > redStoneCount) if (redContribCount > redStoneCount)
{ {
@@ -494,7 +494,7 @@ public class SignsPriest extends Npc
stonesFound = true; stonesFound = true;
final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
msg.addItemName(SevenSigns.SEAL_STONE_RED_ID); msg.addItemName(SevenSigns.SEAL_STONE_RED_ID);
msg.addLong(redContribCount); msg.addInt(redContribCount);
player.sendPacket(msg); player.sendPacket(msg);
} }
if ((greenContribCount > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_GREEN_ID, greenContribCount, this, false)) if ((greenContribCount > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_GREEN_ID, greenContribCount, this, false))
@@ -502,7 +502,7 @@ public class SignsPriest extends Npc
stonesFound = true; stonesFound = true;
final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
msg.addItemName(SevenSigns.SEAL_STONE_GREEN_ID); msg.addItemName(SevenSigns.SEAL_STONE_GREEN_ID);
msg.addLong(greenContribCount); msg.addInt(greenContribCount);
player.sendPacket(msg); player.sendPacket(msg);
} }
if ((blueContribCount > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_BLUE_ID, blueContribCount, this, false)) if ((blueContribCount > 0) && player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_BLUE_ID, blueContribCount, this, false))
@@ -510,7 +510,7 @@ public class SignsPriest extends Npc
stonesFound = true; stonesFound = true;
final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage msg = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
msg.addItemName(SevenSigns.SEAL_STONE_BLUE_ID); msg.addItemName(SevenSigns.SEAL_STONE_BLUE_ID);
msg.addLong(blueContribCount); msg.addInt(blueContribCount);
player.sendPacket(msg); player.sendPacket(msg);
} }
@@ -529,7 +529,7 @@ public class SignsPriest extends Npc
{ {
contribScore = SevenSigns.getInstance().addPlayerStoneContrib(player.getObjectId(), blueContribCount, greenContribCount, redContribCount); contribScore = SevenSigns.getInstance().addPlayerStoneContrib(player.getObjectId(), blueContribCount, greenContribCount, redContribCount);
sm = new SystemMessage(SystemMessageId.YOUR_CONTRIBUTION_SCORE_HAS_INCREASED_BY_S1); sm = new SystemMessage(SystemMessageId.YOUR_CONTRIBUTION_SCORE_HAS_INCREASED_BY_S1);
sm.addLong(contribScore); sm.addInt(contribScore);
player.sendPacket(sm); player.sendPacket(sm);
if (this instanceof DawnPriest) if (this instanceof DawnPriest)
@@ -576,11 +576,11 @@ public class SignsPriest extends Npc
} }
case 7: // Exchange Ancient Adena for Adena - SevenSigns 7 xxxxxxx case 7: // Exchange Ancient Adena for Adena - SevenSigns 7 xxxxxxx
{ {
long ancientAdenaConvert = 0; int ancientAdenaConvert = 0;
try try
{ {
ancientAdenaConvert = Long.parseLong(command.substring(13).trim()); ancientAdenaConvert = Integer.parseInt(command.substring(13).trim());
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
@@ -650,7 +650,7 @@ public class SignsPriest extends Npc
final int x = Integer.parseInt(st.nextToken()); final int x = Integer.parseInt(st.nextToken());
final int y = Integer.parseInt(st.nextToken()); final int y = Integer.parseInt(st.nextToken());
final int z = Integer.parseInt(st.nextToken()); final int z = Integer.parseInt(st.nextToken());
final long ancientAdenaCost = Long.parseLong(st.nextToken()); final int ancientAdenaCost = Integer.parseInt(st.nextToken());
if ((ancientAdenaCost > 0) && !player.reduceAncientAdena("SevenSigns", ancientAdenaCost, this, true)) if ((ancientAdenaCost > 0) && !player.reduceAncientAdena("SevenSigns", ancientAdenaCost, this, true))
{ {
break; break;
@@ -712,10 +712,10 @@ public class SignsPriest extends Npc
final Item blueStonesAll = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID); final Item blueStonesAll = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
final Item greenStonesAll = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID); final Item greenStonesAll = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
final Item redStonesAll = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID); final Item redStonesAll = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID);
final long blueStoneCountAll = blueStonesAll == null ? 0 : blueStonesAll.getCount(); final int blueStoneCountAll = blueStonesAll == null ? 0 : blueStonesAll.getCount();
final long greenStoneCountAll = greenStonesAll == null ? 0 : greenStonesAll.getCount(); final int greenStoneCountAll = greenStonesAll == null ? 0 : greenStonesAll.getCount();
final long redStoneCountAll = redStonesAll == null ? 0 : redStonesAll.getCount(); final int redStoneCountAll = redStonesAll == null ? 0 : redStonesAll.getCount();
long ancientAdenaRewardAll = 0; int ancientAdenaRewardAll = 0;
ancientAdenaRewardAll = SevenSigns.calcAncientAdenaReward(blueStoneCountAll, greenStoneCountAll, redStoneCountAll); ancientAdenaRewardAll = SevenSigns.calcAncientAdenaReward(blueStoneCountAll, greenStoneCountAll, redStoneCountAll);
if (ancientAdenaRewardAll == 0) if (ancientAdenaRewardAll == 0)
{ {
@@ -793,11 +793,11 @@ public class SignsPriest extends Npc
case 18: // Exchange Seal Stones for Ancient Adena - SevenSigns 18 xxxx xxxxxx case 18: // Exchange Seal Stones for Ancient Adena - SevenSigns 18 xxxx xxxxxx
{ {
final int convertStoneId = Integer.parseInt(command.substring(14, 18)); final int convertStoneId = Integer.parseInt(command.substring(14, 18));
long convertCount = 0; int convertCount = 0;
try try
{ {
convertCount = Long.parseLong(command.substring(19).trim()); convertCount = Integer.parseInt(command.substring(19).trim());
} }
catch (Exception nfe) catch (Exception nfe)
{ {
@@ -815,8 +815,8 @@ public class SignsPriest extends Npc
final Item convertItem = player.getInventory().getItemByItemId(convertStoneId); final Item convertItem = player.getInventory().getItemByItemId(convertStoneId);
if (convertItem != null) if (convertItem != null)
{ {
long ancientAdenaReward = 0; int ancientAdenaReward = 0;
final long totalCount = convertItem.getCount(); final int totalCount = convertItem.getCount();
if ((convertCount <= totalCount) && (convertCount > 0)) if ((convertCount <= totalCount) && (convertCount > 0))
{ {
switch (convertStoneId) switch (convertStoneId)
@@ -995,7 +995,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
// finally // finally
return new ItemHolder(itemId, (long) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount)); return new ItemHolder(itemId, (int) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount));
} }
/** /**
@@ -1106,7 +1106,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
// finally // finally
return new ItemHolder(itemId, (long) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount)); return new ItemHolder(itemId, (int) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount));
} }
break; break;
} }
@@ -1132,7 +1132,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
// finally // finally
return new ItemHolder(dropItem.getItemId(), (long) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount)); return new ItemHolder(dropItem.getItemId(), (int) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount));
} }
break; break;
} }
@@ -18,7 +18,7 @@ package org.l2jmobius.gameserver.model.buylist;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@@ -35,12 +35,12 @@ public class Product
private final int _buyListId; private final int _buyListId;
private final ItemTemplate _item; private final ItemTemplate _item;
private final long _price; private final int _price;
private final long _restockDelay; private final long _restockDelay;
private final long _maxCount; private final int _maxCount;
private AtomicLong _count = null; private AtomicInteger _count = null;
public Product(int buyListId, ItemTemplate item, long price, long restockDelay, long maxCount) public Product(int buyListId, ItemTemplate item, int price, long restockDelay, int maxCount)
{ {
_buyListId = buyListId; _buyListId = buyListId;
_item = item; _item = item;
@@ -49,7 +49,7 @@ public class Product
_maxCount = maxCount; _maxCount = maxCount;
if (hasLimitedStock()) if (hasLimitedStock())
{ {
_count = new AtomicLong(maxCount); _count = new AtomicInteger(maxCount);
} }
} }
@@ -68,7 +68,7 @@ public class Product
return _item.getId(); return _item.getId();
} }
public long getPrice() public int getPrice()
{ {
return _price < 0 ? _item.getReferencePrice() : _price; return _price < 0 ? _item.getReferencePrice() : _price;
} }
@@ -83,26 +83,26 @@ public class Product
return _maxCount; return _maxCount;
} }
public long getCount() public int getCount()
{ {
if (_count == null) if (_count == null)
{ {
return 0; return 0;
} }
final long count = _count.get(); final int count = _count.get();
return count > 0 ? count : 0; return count > 0 ? count : 0;
} }
public void setCount(long currentCount) public void setCount(int currentCount)
{ {
if (_count == null) if (_count == null)
{ {
_count = new AtomicLong(); _count = new AtomicInteger();
} }
_count.set(currentCount); _count.set(currentCount);
} }
public boolean decreaseCount(long value) public boolean decreaseCount(int value)
{ {
if (_count == null) if (_count == null)
{ {
@@ -147,8 +147,8 @@ public class Product
{ {
statement.setInt(1, _buyListId); statement.setInt(1, _buyListId);
statement.setInt(2, _item.getId()); statement.setInt(2, _item.getId());
statement.setLong(3, getCount()); statement.setInt(3, getCount());
statement.setLong(5, getCount()); statement.setInt(5, getCount());
final long nextRestockTime = BuyListTaskManager.getInstance().getRestockDelay(this); final long nextRestockTime = BuyListTaskManager.getInstance().getRestockDelay(this);
if (nextRestockTime > 0) if (nextRestockTime > 0)
@@ -2559,7 +2559,7 @@ public class Clan implements IIdentifiable, INamable
player.sendPacket(cr); player.sendPacket(cr);
final SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(9910); sm.addItemName(9910);
sm.addLong(150); sm.addInt(150);
player.sendPacket(sm); player.sendPacket(sm);
increaseClanLevel = true; increaseClanLevel = true;
} }
@@ -2579,7 +2579,7 @@ public class Clan implements IIdentifiable, INamable
player.sendPacket(cr); player.sendPacket(cr);
final SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED); final SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(9911); sm.addItemName(9911);
sm.addLong(5); sm.addInt(5);
player.sendPacket(sm); player.sendPacket(sm);
increaseClanLevel = true; increaseClanLevel = true;
} }
@@ -1931,7 +1931,7 @@ public abstract class AbstractScript extends ManagedScript
* @param itemId the ID of the item whose amount to get * @param itemId the ID of the item whose amount to get
* @return the amount of the specified item in player's inventory * @return the amount of the specified item in player's inventory
*/ */
public static long getQuestItemsCount(Player player, int itemId) public static int getQuestItemsCount(Player player, int itemId)
{ {
return player.getInventory().getInventoryItemCount(itemId, -1); return player.getInventory().getInventoryItemCount(itemId, -1);
} }
@@ -1942,9 +1942,9 @@ public abstract class AbstractScript extends ManagedScript
* @param itemIds a list of IDs of items whose amount to get * @param itemIds a list of IDs of items whose amount to get
* @return the summary amount of all listed items in player's inventory * @return the summary amount of all listed items in player's inventory
*/ */
public long getQuestItemsCount(Player player, int... itemIds) public int getQuestItemsCount(Player player, int... itemIds)
{ {
long count = 0; int count = 0;
for (Item item : player.getInventory().getItems()) for (Item item : player.getInventory().getItems())
{ {
if (item == null) if (item == null)
@@ -1956,9 +1956,9 @@ public abstract class AbstractScript extends ManagedScript
{ {
if (item.getId() == itemId) if (item.getId() == itemId)
{ {
if ((count + item.getCount()) > Long.MAX_VALUE) if ((count + item.getCount()) > Integer.MAX_VALUE)
{ {
return Long.MAX_VALUE; return Integer.MAX_VALUE;
} }
count += item.getCount(); count += item.getCount();
} }
@@ -2143,7 +2143,7 @@ public abstract class AbstractScript extends ManagedScript
* @param count the amount of Adena to give * @param count the amount of Adena to give
* @param applyRates if {@code true} quest rates will be applied to the amount * @param applyRates if {@code true} quest rates will be applied to the amount
*/ */
public static void giveAdena(Player player, long count, boolean applyRates) public static void giveAdena(Player player, int count, boolean applyRates)
{ {
if (applyRates) if (applyRates)
{ {
@@ -2171,7 +2171,7 @@ public abstract class AbstractScript extends ManagedScript
* @param itemId the ID of the item to give * @param itemId the ID of the item to give
* @param countValue the amount of items to give * @param countValue the amount of items to give
*/ */
public static void rewardItems(Player player, int itemId, long countValue) public static void rewardItems(Player player, int itemId, int countValue)
{ {
if (countValue <= 0) if (countValue <= 0)
{ {
@@ -2184,7 +2184,7 @@ public abstract class AbstractScript extends ManagedScript
return; return;
} }
long count = countValue; int count = countValue;
try try
{ {
if (itemId == Inventory.ADENA_ID) if (itemId == Inventory.ADENA_ID)
@@ -2233,7 +2233,7 @@ public abstract class AbstractScript extends ManagedScript
} }
catch (Exception e) catch (Exception e)
{ {
count = Long.MAX_VALUE; count = Integer.MAX_VALUE;
} }
// Add items to player's inventory // Add items to player's inventory
@@ -2252,13 +2252,13 @@ public abstract class AbstractScript extends ManagedScript
* @param item the item obtain by the player * @param item the item obtain by the player
* @param count the item count * @param count the item count
*/ */
private static void sendItemGetMessage(Player player, Item item, long count) private static void sendItemGetMessage(Player player, Item item, int count)
{ {
// If item for reward is gold, send message of gold reward to client // If item for reward is gold, send message of gold reward to client
if (item.getId() == Inventory.ADENA_ID) if (item.getId() == Inventory.ADENA_ID)
{ {
final SystemMessage smsg = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1_ADENA); final SystemMessage smsg = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1_ADENA);
smsg.addLong(count); smsg.addInt(count);
player.sendPacket(smsg); player.sendPacket(smsg);
} }
// Otherwise, send message of object reward to client // Otherwise, send message of object reward to client
@@ -2268,7 +2268,7 @@ public abstract class AbstractScript extends ManagedScript
{ {
final SystemMessage smsg = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S); final SystemMessage smsg = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
smsg.addItemName(item); smsg.addItemName(item);
smsg.addLong(count); smsg.addInt(count);
player.sendPacket(smsg); player.sendPacket(smsg);
} }
else else
@@ -2290,7 +2290,7 @@ public abstract class AbstractScript extends ManagedScript
* @param itemId * @param itemId
* @param count * @param count
*/ */
public static void giveItems(Player player, int itemId, long count) public static void giveItems(Player player, int itemId, int count)
{ {
giveItems(player, itemId, count, 0); giveItems(player, itemId, count, 0);
} }
@@ -2311,7 +2311,7 @@ public abstract class AbstractScript extends ManagedScript
* @param count * @param count
* @param enchantlevel * @param enchantlevel
*/ */
public static void giveItems(Player player, int itemId, long count, int enchantlevel) public static void giveItems(Player player, int itemId, int count, int enchantlevel)
{ {
if (count <= 0) if (count <= 0)
{ {
@@ -2345,7 +2345,7 @@ public abstract class AbstractScript extends ManagedScript
* @param playSound if true, plays ItemSound.quest_itemget when items are given and ItemSound.quest_middle when the limit is reached * @param playSound if true, plays ItemSound.quest_itemget when items are given and ItemSound.quest_middle when the limit is reached
* @return {@code true} if limit > 0 and the limit was reached or if limit <= 0 and items were given; {@code false} in all other cases * @return {@code true} if limit > 0 and the limit was reached or if limit <= 0 and items were given; {@code false} in all other cases
*/ */
public static boolean giveItemRandomly(Player player, int itemId, long amountToGive, long limit, double dropChance, boolean playSound) public static boolean giveItemRandomly(Player player, int itemId, int amountToGive, int limit, double dropChance, boolean playSound)
{ {
return giveItemRandomly(player, null, itemId, amountToGive, amountToGive, limit, dropChance, playSound); return giveItemRandomly(player, null, itemId, amountToGive, amountToGive, limit, dropChance, playSound);
} }
@@ -2362,7 +2362,7 @@ public abstract class AbstractScript extends ManagedScript
* @param playSound if true, plays ItemSound.quest_itemget when items are given and ItemSound.quest_middle when the limit is reached * @param playSound if true, plays ItemSound.quest_itemget when items are given and ItemSound.quest_middle when the limit is reached
* @return {@code true} if limit > 0 and the limit was reached or if limit <= 0 and items were given; {@code false} in all other cases * @return {@code true} if limit > 0 and the limit was reached or if limit <= 0 and items were given; {@code false} in all other cases
*/ */
public static boolean giveItemRandomly(Player player, Npc npc, int itemId, long amountToGive, long limit, double dropChance, boolean playSound) public static boolean giveItemRandomly(Player player, Npc npc, int itemId, int amountToGive, int limit, double dropChance, boolean playSound)
{ {
return giveItemRandomly(player, npc, itemId, amountToGive, amountToGive, limit, dropChance, playSound); return giveItemRandomly(player, npc, itemId, amountToGive, amountToGive, limit, dropChance, playSound);
} }
@@ -2380,16 +2380,16 @@ public abstract class AbstractScript extends ManagedScript
* @param playSound if true, plays ItemSound.quest_itemget when items are given and ItemSound.quest_middle when the limit is reached * @param playSound if true, plays ItemSound.quest_itemget when items are given and ItemSound.quest_middle when the limit is reached
* @return {@code true} if limit > 0 and the limit was reached or if limit <= 0 and items were given; {@code false} in all other cases * @return {@code true} if limit > 0 and the limit was reached or if limit <= 0 and items were given; {@code false} in all other cases
*/ */
public static boolean giveItemRandomly(Player player, Npc npc, int itemId, long minAmount, long maxAmount, long limit, double dropChance, boolean playSound) public static boolean giveItemRandomly(Player player, Npc npc, int itemId, int minAmount, int maxAmount, int limit, double dropChance, boolean playSound)
{ {
final long currentCount = getQuestItemsCount(player, itemId); final int currentCount = getQuestItemsCount(player, itemId);
if ((limit > 0) && (currentCount >= limit)) if ((limit > 0) && (currentCount >= limit))
{ {
return true; return true;
} }
long minAmountWithBonus = (long) (minAmount * Config.RATE_QUEST_DROP); int minAmountWithBonus = (int) (minAmount * Config.RATE_QUEST_DROP);
long maxAmountWithBonus = (long) (maxAmount * Config.RATE_QUEST_DROP); int maxAmountWithBonus = (int) (maxAmount * Config.RATE_QUEST_DROP);
double dropChanceWithBonus = dropChance * Config.RATE_QUEST_DROP; // TODO separate configs for rate and amount double dropChanceWithBonus = dropChance * Config.RATE_QUEST_DROP; // TODO separate configs for rate and amount
if ((npc != null) && Config.CHAMPION_ENABLE && npc.isChampion()) if ((npc != null) && Config.CHAMPION_ENABLE && npc.isChampion())
{ {
@@ -2407,7 +2407,7 @@ public abstract class AbstractScript extends ManagedScript
} }
} }
long amountToGive = (minAmountWithBonus == maxAmountWithBonus) ? minAmountWithBonus : Rnd.get(minAmountWithBonus, maxAmountWithBonus); int amountToGive = (minAmountWithBonus == maxAmountWithBonus) ? minAmountWithBonus : Rnd.get(minAmountWithBonus, maxAmountWithBonus);
final double random = Rnd.nextDouble(); final double random = Rnd.nextDouble();
// Inventory slot check (almost useless for non-stacking items) // Inventory slot check (almost useless for non-stacking items)
if ((dropChanceWithBonus >= random) && (amountToGive > 0) && player.getInventory().validateCapacityByItemId(itemId)) if ((dropChanceWithBonus >= random) && (amountToGive > 0) && player.getInventory().validateCapacityByItemId(itemId))
@@ -2452,7 +2452,7 @@ public abstract class AbstractScript extends ManagedScript
* @param amount the amount to take * @param amount the amount to take
* @return {@code true} if any items were taken, {@code false} otherwise * @return {@code true} if any items were taken, {@code false} otherwise
*/ */
public static boolean takeItems(Player player, int itemId, long amount) public static boolean takeItems(Player player, int itemId, int amount)
{ {
final Collection<Item> items = player.getInventory().getAllItemsByItemId(itemId); final Collection<Item> items = player.getInventory().getAllItemsByItemId(itemId);
if (amount < 0) if (amount < 0)
@@ -2461,10 +2461,10 @@ public abstract class AbstractScript extends ManagedScript
} }
else else
{ {
long currentCount = 0; int currentCount = 0;
for (Item i : items) for (Item i : items)
{ {
long toDelete = i.getCount(); int toDelete = i.getCount();
if ((currentCount + toDelete) > amount) if ((currentCount + toDelete) > amount)
{ {
toDelete = amount - currentCount; toDelete = amount - currentCount;
@@ -2479,7 +2479,7 @@ public abstract class AbstractScript extends ManagedScript
return true; return true;
} }
private static boolean takeItem(Player player, Item item, long toDelete) private static boolean takeItem(Player player, Item item, int toDelete)
{ {
if (item.isEquipped()) if (item.isEquipped())
{ {
@@ -29,7 +29,7 @@ public class ItemChanceHolder extends ItemHolder
this(id, chance, 1); this(id, chance, 1);
} }
public ItemChanceHolder(int id, double chance, long count) public ItemChanceHolder(int id, double chance, int count)
{ {
super(id, count); super(id, count);
_chance = chance; _chance = chance;
@@ -25,9 +25,9 @@ import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
public class ItemHolder implements IIdentifiable public class ItemHolder implements IIdentifiable
{ {
private final int _id; private final int _id;
private final long _count; private final int _count;
public ItemHolder(int id, long count) public ItemHolder(int id, int count)
{ {
_id = id; _id = id;
_count = count; _count = count;
@@ -45,7 +45,7 @@ public class ItemHolder implements IIdentifiable
/** /**
* @return the count of items contained in this object * @return the count of items contained in this object
*/ */
public long getCount() public int getCount()
{ {
return _count; return _count;
} }
@@ -23,9 +23,9 @@ package org.l2jmobius.gameserver.model.holders;
public class SellBuffHolder public class SellBuffHolder
{ {
private final int _skillId; private final int _skillId;
private long _price; private int _price;
public SellBuffHolder(int skillId, long price) public SellBuffHolder(int skillId, int price)
{ {
_skillId = skillId; _skillId = skillId;
_price = price; _price = price;
@@ -41,7 +41,7 @@ public class SellBuffHolder
_price = price; _price = price;
} }
public long getPrice() public int getPrice()
{ {
return _price; return _price;
} }
@@ -31,7 +31,7 @@ public class UniqueItemHolder extends ItemHolder implements IUniqueId
this(id, objectId, 1); this(id, objectId, 1);
} }
public UniqueItemHolder(int id, int objectId, long count) public UniqueItemHolder(int id, int objectId, int count)
{ {
super(id, count); super(id, count);
_objectId = objectId; _objectId = objectId;
@@ -95,9 +95,9 @@ public class Item extends WorldObject
private int _dropperObjectId = 0; private int _dropperObjectId = 0;
/** Quantity of the item */ /** Quantity of the item */
private long _count; private int _count;
/** Initial Quantity of the item */ /** Initial Quantity of the item */
private long _initCount; private int _initCount;
/** Remaining time (in miliseconds) */ /** Remaining time (in miliseconds) */
private long _time; private long _time;
/** Quantity of the item can decrease */ /** Quantity of the item can decrease */
@@ -409,7 +409,7 @@ public class Item extends WorldObject
* Sets the quantity of the item. * Sets the quantity of the item.
* @param count the new count to set * @param count the new count to set
*/ */
public void setCount(long count) public void setCount(int count)
{ {
if (_count == count) if (_count == count)
{ {
@@ -423,7 +423,7 @@ public class Item extends WorldObject
/** /**
* @return Returns the count. * @return Returns the count.
*/ */
public long getCount() public int getCount()
{ {
return _count; return _count;
} }
@@ -436,14 +436,14 @@ public class Item extends WorldObject
* @param creator : Player Player requesting the item creation * @param creator : Player Player requesting the item creation
* @param reference : Object Object referencing current action like NPC selling item or previous item in transformation * @param reference : Object Object referencing current action like NPC selling item or previous item in transformation
*/ */
public void changeCount(String process, long count, Player creator, Object reference) public void changeCount(String process, int count, Player creator, Object reference)
{ {
if (count == 0) if (count == 0)
{ {
return; return;
} }
final long old = _count; final int old = _count;
final long max = _itemId == ADENA_ID ? MAX_ADENA : Long.MAX_VALUE; final int max = _itemId == ADENA_ID ? MAX_ADENA : Integer.MAX_VALUE;
if ((count > 0) && (_count > (max - count))) if ((count > 0) && (_count > (max - count)))
{ {
@@ -1224,13 +1224,13 @@ public class Item extends WorldObject
int customType2; int customType2;
int manaLeft; int manaLeft;
long time; long time;
long count; int count;
ItemLocation loc; ItemLocation loc;
try try
{ {
objectId = rs.getInt(1); objectId = rs.getInt(1);
itemId = rs.getInt("item_id"); itemId = rs.getInt("item_id");
count = rs.getLong("count"); count = rs.getInt("count");
loc = ItemLocation.valueOf(rs.getString("loc")); loc = ItemLocation.valueOf(rs.getString("loc"));
locData = rs.getInt("loc_data"); locData = rs.getInt("loc_data");
enchantLevel = rs.getInt("enchant_level"); enchantLevel = rs.getInt("enchant_level");
@@ -1352,7 +1352,7 @@ public class Item extends WorldObject
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?")) PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{ {
ps.setInt(1, _ownerId); ps.setInt(1, _ownerId);
ps.setLong(2, _count); ps.setInt(2, _count);
ps.setString(3, _loc.name()); ps.setString(3, _loc.name());
ps.setInt(4, _locData); ps.setInt(4, _locData);
ps.setInt(5, _enchantLevel); ps.setInt(5, _enchantLevel);
@@ -1386,7 +1386,7 @@ public class Item extends WorldObject
{ {
ps.setInt(1, _ownerId); ps.setInt(1, _ownerId);
ps.setInt(2, _itemId); ps.setInt(2, _itemId);
ps.setLong(3, _count); ps.setInt(3, _count);
ps.setString(4, _loc.name()); ps.setString(4, _loc.name());
ps.setInt(5, _locData); ps.setInt(5, _locData);
ps.setInt(6, _enchantLevel); ps.setInt(6, _enchantLevel);
@@ -80,7 +80,7 @@ public class ClanWarehouse extends Warehouse
} }
@Override @Override
public Item addItem(String process, int itemId, long count, Player actor, Object reference) public Item addItem(String process, int itemId, int count, Player actor, Object reference)
{ {
final Item item = super.addItem(process, itemId, count, actor, reference); final Item item = super.addItem(process, itemId, count, actor, reference);
@@ -98,7 +98,7 @@ public class ClanWarehouse extends Warehouse
} }
@Override @Override
public Item destroyItem(String process, Item item, long count, Player actor, Object reference) public Item destroyItem(String process, Item item, int count, Player actor, Object reference)
{ {
// Notify to scripts // Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerClanWHItemDestroy(process, actor, item, count, this), item.getTemplate()); EventDispatcher.getInstance().notifyEventAsync(new OnPlayerClanWHItemDestroy(process, actor, item, count, this), item.getTemplate());
@@ -106,7 +106,7 @@ public class ClanWarehouse extends Warehouse
} }
@Override @Override
public Item transferItem(String process, int objectId, long count, ItemContainer target, Player actor, Object reference) public Item transferItem(String process, int objectId, int count, ItemContainer target, Player actor, Object reference)
{ {
final Item item = getItemByObjectId(objectId); final Item item = getItemByObjectId(objectId);

Some files were not shown because too many files have changed in this diff Show More