Addition of dailyReset mission parameter.
This commit is contained in:
@ -71,21 +71,34 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
|
||||
|
||||
public synchronized void reset()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
|
||||
if (_holder.dailyReset())
|
||||
{
|
||||
ps.setInt(1, _holder.getId());
|
||||
ps.setInt(2, DailyMissionStatus.COMPLETED.getClientId());
|
||||
ps.execute();
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
|
||||
{
|
||||
ps.setInt(1, _holder.getId());
|
||||
ps.setInt(2, DailyMissionStatus.COMPLETED.getClientId());
|
||||
ps.execute();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Error while clearing data for: " + getClass().getSimpleName(), e);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Error while clearing data for: " + getClass().getSimpleName(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_entries.clear();
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = 3"))
|
||||
{
|
||||
ps.setInt(1, _holder.getId());
|
||||
ps.execute();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Error while clearing data for: " + getClass().getSimpleName(), e);
|
||||
}
|
||||
}
|
||||
_entries.clear();
|
||||
}
|
||||
|
||||
public boolean requestReward(PlayerInstance player)
|
||||
|
@ -37,6 +37,7 @@ public class DailyMissionDataHolder
|
||||
private final List<ClassId> _classRestriction;
|
||||
private final int _requiredCompletions;
|
||||
private final StatsSet _params;
|
||||
private final boolean _dailyReset;
|
||||
private final boolean _isOneTime;
|
||||
private final AbstractDailyMissionHandler _handler;
|
||||
|
||||
@ -50,6 +51,7 @@ public class DailyMissionDataHolder
|
||||
_rewardsItems = set.getList("items", ItemHolder.class);
|
||||
_classRestriction = set.getList("classRestriction", ClassId.class);
|
||||
_params = set.getObject("params", StatsSet.class);
|
||||
_dailyReset = set.getBoolean("dailyReset", true);
|
||||
_isOneTime = set.getBoolean("isOneTime", true);
|
||||
_handler = handler != null ? handler.apply(this) : null;
|
||||
}
|
||||
@ -84,6 +86,11 @@ public class DailyMissionDataHolder
|
||||
return _params;
|
||||
}
|
||||
|
||||
public boolean dailyReset()
|
||||
{
|
||||
return _dailyReset;
|
||||
}
|
||||
|
||||
public boolean isOneTime()
|
||||
{
|
||||
return _isOneTime;
|
||||
|
Reference in New Issue
Block a user