Daily reset for LimitShopData.
Contributed by nasseka.
This commit is contained in:
@@ -31,15 +31,18 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
|||||||
import org.l2jmobius.commons.threads.ThreadPool;
|
import org.l2jmobius.commons.threads.ThreadPool;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
||||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.AccountVariables;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt;
|
import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt;
|
||||||
@@ -100,10 +103,10 @@ public class DailyTaskManager
|
|||||||
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
||||||
{
|
{
|
||||||
clanLeaderApply();
|
clanLeaderApply();
|
||||||
resetVitalityWeekly();
|
|
||||||
resetClanContribution();
|
resetClanContribution();
|
||||||
resetDailyMissionRewards();
|
resetDailyMissionRewards();
|
||||||
resetTimedHuntingZonesWeekly();
|
resetTimedHuntingZonesWeekly();
|
||||||
|
resetVitalityWeekly();
|
||||||
}
|
}
|
||||||
else // All days, except Wednesday.
|
else // All days, except Wednesday.
|
||||||
{
|
{
|
||||||
@@ -111,14 +114,15 @@ public class DailyTaskManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Daily tasks.
|
// Daily tasks.
|
||||||
resetDailySkills();
|
|
||||||
resetWorldChatPoints();
|
|
||||||
resetRecommends();
|
|
||||||
resetTrainingCamp();
|
|
||||||
resetThroneOfHeroes();
|
|
||||||
resetTimedHuntingZones();
|
|
||||||
resetHomunculusResetPoints();
|
|
||||||
resetAttendanceRewards();
|
resetAttendanceRewards();
|
||||||
|
resetDailySkills();
|
||||||
|
resetDailyLimitShopData();
|
||||||
|
resetHomunculusResetPoints();
|
||||||
|
resetRecommends();
|
||||||
|
resetTimedHuntingZones();
|
||||||
|
resetThroneOfHeroes();
|
||||||
|
resetTrainingCamp();
|
||||||
|
resetWorldChatPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSave()
|
private void onSave()
|
||||||
@@ -590,6 +594,32 @@ public class DailyTaskManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetDailyLimitShopData()
|
||||||
|
{
|
||||||
|
for (LimitShopProductHolder holder : LimitShopData.getInstance().getProducts())
|
||||||
|
{
|
||||||
|
// Update data for offline players.
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var=?"))
|
||||||
|
{
|
||||||
|
ps.setString(1, AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
ps.executeUpdate();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not reset LimitShopData: " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update data for online players.
|
||||||
|
for (Player player : World.getInstance().getPlayers())
|
||||||
|
{
|
||||||
|
player.getVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
player.getAccountVariables().storeMe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOGGER.info("LimitShopData has been resetted.");
|
||||||
|
}
|
||||||
|
|
||||||
public static DailyTaskManager getInstance()
|
public static DailyTaskManager getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
@@ -41,8 +41,8 @@ public class AccountVariables extends AbstractVariables
|
|||||||
// Public variable names
|
// Public variable names
|
||||||
public static final String HWID = "HWID";
|
public static final String HWID = "HWID";
|
||||||
public static final String HWIDSLIT_VAR = " ";
|
public static final String HWIDSLIT_VAR = " ";
|
||||||
public static final String LCOIN_SHOP_PRODUCT_TIME = "LCSTime";
|
|
||||||
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
||||||
|
public static final String LCOIN_SHOP_PRODUCT_DAILY_COUNT = "LCSDailyCount";
|
||||||
|
|
||||||
private final String _accountName;
|
private final String _accountName;
|
||||||
|
|
||||||
|
@@ -21,7 +21,6 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
@@ -115,16 +114,11 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
||||||
{
|
{
|
||||||
if ((player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
||||||
{
|
player.removeRequest(PrimeShopRequest.class);
|
||||||
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
return;
|
||||||
player.removeRequest(PrimeShopRequest.class);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Reset limit.
|
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
@@ -251,8 +245,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Update account variables.
|
// Update account variables.
|
||||||
if (_product.getAccountDailyLimit() > 0)
|
if (_product.getAccountDailyLimit() > 0)
|
||||||
{
|
{
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), Chronos.currentTimeMillis());
|
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) + _amount);
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) + _amount);
|
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0)
|
else if (_product.getAccountBuyLimit() > 0)
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,6 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
@@ -91,21 +90,13 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||||
{
|
{
|
||||||
if ((_player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
packet.writeD(0);
|
||||||
{
|
|
||||||
packet.writeD(0);
|
|
||||||
}
|
|
||||||
else // Reset limit.
|
|
||||||
{
|
|
||||||
_player.getAccountVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId());
|
|
||||||
packet.writeD(product.getAccountDailyLimit());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
|
@@ -30,6 +30,7 @@ import org.l2jmobius.commons.threads.ThreadPool;
|
|||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||||
import org.l2jmobius.gameserver.data.xml.DailyMissionData;
|
import org.l2jmobius.gameserver.data.xml.DailyMissionData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
@@ -37,6 +38,7 @@ import org.l2jmobius.gameserver.model.actor.Player;
|
|||||||
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
||||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||||
@@ -102,8 +104,8 @@ public class DailyTaskManager
|
|||||||
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
||||||
{
|
{
|
||||||
clanLeaderApply();
|
clanLeaderApply();
|
||||||
resetVitalityWeekly();
|
|
||||||
resetTimedHuntingZonesWeekly();
|
resetTimedHuntingZonesWeekly();
|
||||||
|
resetVitalityWeekly();
|
||||||
}
|
}
|
||||||
else // All days, except Wednesday.
|
else // All days, except Wednesday.
|
||||||
{
|
{
|
||||||
@@ -113,6 +115,7 @@ public class DailyTaskManager
|
|||||||
// Daily tasks.
|
// Daily tasks.
|
||||||
resetClanBonus();
|
resetClanBonus();
|
||||||
resetDailySkills();
|
resetDailySkills();
|
||||||
|
resetDailyLimitShopData();
|
||||||
resetWorldChatPoints();
|
resetWorldChatPoints();
|
||||||
resetRecommends();
|
resetRecommends();
|
||||||
resetTrainingCamp();
|
resetTrainingCamp();
|
||||||
@@ -493,6 +496,32 @@ public class DailyTaskManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetDailyLimitShopData()
|
||||||
|
{
|
||||||
|
for (LimitShopProductHolder holder : LimitShopData.getInstance().getProducts())
|
||||||
|
{
|
||||||
|
// Update data for offline players.
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var=?"))
|
||||||
|
{
|
||||||
|
ps.setString(1, AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
ps.executeUpdate();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not reset LimitShopData: " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update data for online players.
|
||||||
|
for (Player player : World.getInstance().getPlayers())
|
||||||
|
{
|
||||||
|
player.getVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
player.getAccountVariables().storeMe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOGGER.info("LimitShopData has been resetted.");
|
||||||
|
}
|
||||||
|
|
||||||
public static DailyTaskManager getInstance()
|
public static DailyTaskManager getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
@@ -42,8 +42,8 @@ public class AccountVariables extends AbstractVariables
|
|||||||
// Public variable names
|
// Public variable names
|
||||||
public static final String HWID = "HWID";
|
public static final String HWID = "HWID";
|
||||||
public static final String HWIDSLIT_VAR = " ";
|
public static final String HWIDSLIT_VAR = " ";
|
||||||
public static final String LCOIN_SHOP_PRODUCT_TIME = "LCSTime";
|
|
||||||
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
||||||
|
public static final String LCOIN_SHOP_PRODUCT_DAILY_COUNT = "LCSDailyCount";
|
||||||
public static final String VIP_POINTS = "VipPoints";
|
public static final String VIP_POINTS = "VipPoints";
|
||||||
public static final String VIP_TIER = "VipTier";
|
public static final String VIP_TIER = "VipTier";
|
||||||
public static final String VIP_EXPIRATION = "VipExpiration";
|
public static final String VIP_EXPIRATION = "VipExpiration";
|
||||||
|
@@ -22,7 +22,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
@@ -115,16 +114,11 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
||||||
{
|
{
|
||||||
if ((player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
||||||
{
|
player.removeRequest(PrimeShopRequest.class);
|
||||||
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
return;
|
||||||
player.removeRequest(PrimeShopRequest.class);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Reset limit.
|
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
@@ -242,8 +236,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Update account variables.
|
// Update account variables.
|
||||||
if (_product.getAccountDailyLimit() > 0)
|
if (_product.getAccountDailyLimit() > 0)
|
||||||
{
|
{
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), Chronos.currentTimeMillis());
|
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) + _amount);
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) + _amount);
|
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0)
|
else if (_product.getAccountBuyLimit() > 0)
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,6 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
@@ -83,21 +82,13 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||||
{
|
{
|
||||||
if ((_player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
packet.writeD(0);
|
||||||
{
|
|
||||||
packet.writeD(0);
|
|
||||||
}
|
|
||||||
else // Reset limit.
|
|
||||||
{
|
|
||||||
_player.getAccountVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId());
|
|
||||||
packet.writeD(product.getAccountDailyLimit());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
|
@@ -30,6 +30,7 @@ import org.l2jmobius.commons.threads.ThreadPool;
|
|||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||||
import org.l2jmobius.gameserver.data.xml.DailyMissionData;
|
import org.l2jmobius.gameserver.data.xml.DailyMissionData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
@@ -37,6 +38,7 @@ import org.l2jmobius.gameserver.model.actor.Player;
|
|||||||
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
||||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||||
@@ -102,9 +104,9 @@ public class DailyTaskManager
|
|||||||
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
||||||
{
|
{
|
||||||
clanLeaderApply();
|
clanLeaderApply();
|
||||||
resetVitalityWeekly();
|
|
||||||
resetMonsterArenaWeekly();
|
resetMonsterArenaWeekly();
|
||||||
resetTimedHuntingZonesWeekly();
|
resetTimedHuntingZonesWeekly();
|
||||||
|
resetVitalityWeekly();
|
||||||
}
|
}
|
||||||
else // All days, except Wednesday.
|
else // All days, except Wednesday.
|
||||||
{
|
{
|
||||||
@@ -116,6 +118,7 @@ public class DailyTaskManager
|
|||||||
resetClanContributionList();
|
resetClanContributionList();
|
||||||
resetClanDonationPoints();
|
resetClanDonationPoints();
|
||||||
resetDailySkills();
|
resetDailySkills();
|
||||||
|
resetDailyLimitShopData();
|
||||||
resetWorldChatPoints();
|
resetWorldChatPoints();
|
||||||
resetRecommends();
|
resetRecommends();
|
||||||
resetTrainingCamp();
|
resetTrainingCamp();
|
||||||
@@ -533,6 +536,32 @@ public class DailyTaskManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetDailyLimitShopData()
|
||||||
|
{
|
||||||
|
for (LimitShopProductHolder holder : LimitShopData.getInstance().getProducts())
|
||||||
|
{
|
||||||
|
// Update data for offline players.
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var=?"))
|
||||||
|
{
|
||||||
|
ps.setString(1, AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
ps.executeUpdate();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not reset LimitShopData: " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update data for online players.
|
||||||
|
for (Player player : World.getInstance().getPlayers())
|
||||||
|
{
|
||||||
|
player.getVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
player.getAccountVariables().storeMe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOGGER.info("LimitShopData has been resetted.");
|
||||||
|
}
|
||||||
|
|
||||||
public static DailyTaskManager getInstance()
|
public static DailyTaskManager getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
@@ -42,8 +42,8 @@ public class AccountVariables extends AbstractVariables
|
|||||||
// Public variable names
|
// Public variable names
|
||||||
public static final String HWID = "HWID";
|
public static final String HWID = "HWID";
|
||||||
public static final String HWIDSLIT_VAR = " ";
|
public static final String HWIDSLIT_VAR = " ";
|
||||||
public static final String LCOIN_SHOP_PRODUCT_TIME = "LCSTime";
|
|
||||||
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
||||||
|
public static final String LCOIN_SHOP_PRODUCT_DAILY_COUNT = "LCSDailyCount";
|
||||||
public static final String VIP_POINTS = "VipPoints";
|
public static final String VIP_POINTS = "VipPoints";
|
||||||
public static final String VIP_TIER = "VipTier";
|
public static final String VIP_TIER = "VipTier";
|
||||||
public static final String VIP_EXPIRATION = "VipExpiration";
|
public static final String VIP_EXPIRATION = "VipExpiration";
|
||||||
|
@@ -22,7 +22,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
@@ -122,16 +121,11 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
||||||
{
|
{
|
||||||
if ((player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
||||||
{
|
player.removeRequest(PrimeShopRequest.class);
|
||||||
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
return;
|
||||||
player.removeRequest(PrimeShopRequest.class);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Reset limit.
|
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
@@ -262,8 +256,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Update account variables.
|
// Update account variables.
|
||||||
if (_product.getAccountDailyLimit() > 0)
|
if (_product.getAccountDailyLimit() > 0)
|
||||||
{
|
{
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), Chronos.currentTimeMillis());
|
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) + _amount);
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) + _amount);
|
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0)
|
else if (_product.getAccountBuyLimit() > 0)
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,6 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
@@ -97,21 +96,13 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||||
{
|
{
|
||||||
if ((_player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
packet.writeD(0);
|
||||||
{
|
|
||||||
packet.writeD(0);
|
|
||||||
}
|
|
||||||
else // Reset limit.
|
|
||||||
{
|
|
||||||
_player.getAccountVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId());
|
|
||||||
packet.writeD(product.getAccountDailyLimit());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
|
@@ -30,6 +30,7 @@ import org.l2jmobius.commons.threads.ThreadPool;
|
|||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||||
import org.l2jmobius.gameserver.data.xml.DailyMissionData;
|
import org.l2jmobius.gameserver.data.xml.DailyMissionData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
@@ -37,6 +38,7 @@ import org.l2jmobius.gameserver.model.actor.Player;
|
|||||||
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
|
||||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||||
@@ -102,9 +104,9 @@ public class DailyTaskManager
|
|||||||
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
|
||||||
{
|
{
|
||||||
clanLeaderApply();
|
clanLeaderApply();
|
||||||
resetVitalityWeekly();
|
|
||||||
resetMonsterArenaWeekly();
|
resetMonsterArenaWeekly();
|
||||||
resetTimedHuntingZonesWeekly();
|
resetTimedHuntingZonesWeekly();
|
||||||
|
resetVitalityWeekly();
|
||||||
}
|
}
|
||||||
else // All days, except Wednesday.
|
else // All days, except Wednesday.
|
||||||
{
|
{
|
||||||
@@ -116,6 +118,7 @@ public class DailyTaskManager
|
|||||||
resetClanContributionList();
|
resetClanContributionList();
|
||||||
resetClanDonationPoints();
|
resetClanDonationPoints();
|
||||||
resetDailySkills();
|
resetDailySkills();
|
||||||
|
resetDailyLimitShopData();
|
||||||
resetWorldChatPoints();
|
resetWorldChatPoints();
|
||||||
resetRecommends();
|
resetRecommends();
|
||||||
resetTrainingCamp();
|
resetTrainingCamp();
|
||||||
@@ -533,6 +536,32 @@ public class DailyTaskManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetDailyLimitShopData()
|
||||||
|
{
|
||||||
|
for (LimitShopProductHolder holder : LimitShopData.getInstance().getProducts())
|
||||||
|
{
|
||||||
|
// Update data for offline players.
|
||||||
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
|
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var=?"))
|
||||||
|
{
|
||||||
|
ps.setString(1, AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
ps.executeUpdate();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not reset LimitShopData: " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update data for online players.
|
||||||
|
for (Player player : World.getInstance().getPlayers())
|
||||||
|
{
|
||||||
|
player.getVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + holder.getProductionId());
|
||||||
|
player.getAccountVariables().storeMe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOGGER.info("LimitShopData has been resetted.");
|
||||||
|
}
|
||||||
|
|
||||||
public static DailyTaskManager getInstance()
|
public static DailyTaskManager getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
@@ -42,8 +42,8 @@ public class AccountVariables extends AbstractVariables
|
|||||||
// Public variable names
|
// Public variable names
|
||||||
public static final String HWID = "HWID";
|
public static final String HWID = "HWID";
|
||||||
public static final String HWIDSLIT_VAR = " ";
|
public static final String HWIDSLIT_VAR = " ";
|
||||||
public static final String LCOIN_SHOP_PRODUCT_TIME = "LCSTime";
|
|
||||||
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
||||||
|
public static final String LCOIN_SHOP_PRODUCT_DAILY_COUNT = "LCSDailyCount";
|
||||||
public static final String VIP_POINTS = "VipPoints";
|
public static final String VIP_POINTS = "VipPoints";
|
||||||
public static final String VIP_TIER = "VipTier";
|
public static final String VIP_TIER = "VipTier";
|
||||||
public static final String VIP_EXPIRATION = "VipExpiration";
|
public static final String VIP_EXPIRATION = "VipExpiration";
|
||||||
|
@@ -22,7 +22,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
@@ -122,16 +121,11 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
if (_product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) >= (_product.getAccountDailyLimit() * _amount))
|
||||||
{
|
{
|
||||||
if ((player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
||||||
{
|
player.removeRequest(PrimeShopRequest.class);
|
||||||
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
return;
|
||||||
player.removeRequest(PrimeShopRequest.class);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Reset limit.
|
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
else if (_product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
@@ -262,8 +256,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
// Update account variables.
|
// Update account variables.
|
||||||
if (_product.getAccountDailyLimit() > 0)
|
if (_product.getAccountDailyLimit() > 0)
|
||||||
{
|
{
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + _product.getProductionId(), Chronos.currentTimeMillis());
|
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + _product.getProductionId(), 0) + _amount);
|
||||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + _product.getProductionId(), 0) + _amount);
|
|
||||||
}
|
}
|
||||||
else if (_product.getAccountBuyLimit() > 0)
|
else if (_product.getAccountBuyLimit() > 0)
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,6 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopClanData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopCraftData;
|
||||||
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
import org.l2jmobius.gameserver.data.xml.LimitShopData;
|
||||||
@@ -97,21 +96,13 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
|||||||
// Check limits.
|
// Check limits.
|
||||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
{
|
{
|
||||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||||
{
|
{
|
||||||
if ((_player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
packet.writeD(0);
|
||||||
{
|
|
||||||
packet.writeD(0);
|
|
||||||
}
|
|
||||||
else // Reset limit.
|
|
||||||
{
|
|
||||||
_player.getAccountVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId());
|
|
||||||
packet.writeD(product.getAccountDailyLimit());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_DAILY_COUNT + product.getProductionId(), 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||||
|
Reference in New Issue
Block a user