Addition of weekend and monthly mission handlers.
Contributed by Iris.
This commit is contained in:
@@ -2629,12 +2629,14 @@
|
|||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="224" reward_id="604" name="Login All Weekend" isOneTime="false">
|
<reward id="224" reward_id="604" name="Login All Weekend" isOneTime="false">
|
||||||
|
<handler name="loginweekend" />
|
||||||
<items>
|
<items>
|
||||||
<item id="27593" count="4" />
|
<item id="27593" count="4" />
|
||||||
<item id="27603" count="1" />
|
<item id="27603" count="1" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="225" reward_id="605" name="Login All Month" isOneTime="false">
|
<reward id="225" reward_id="605" name="Login All Month" isOneTime="false">
|
||||||
|
<handler name="loginmonth" />
|
||||||
<items>
|
<items>
|
||||||
<item id="27593" count="15" />
|
<item id="27593" count="15" />
|
||||||
<item id="27603" count="1" />
|
<item id="27603" count="1" />
|
||||||
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -2614,12 +2614,14 @@
|
|||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="224" reward_id="604" name="Login All Weekend" isOneTime="false">
|
<reward id="224" reward_id="604" name="Login All Weekend" isOneTime="false">
|
||||||
|
<handler name="loginweekend" />
|
||||||
<items>
|
<items>
|
||||||
<item id="27593" count="4" />
|
<item id="27593" count="4" />
|
||||||
<item id="27603" count="1" />
|
<item id="27603" count="1" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="225" reward_id="605" name="Login All Month" isOneTime="false">
|
<reward id="225" reward_id="605" name="Login All Month" isOneTime="false">
|
||||||
|
<handler name="loginmonth" />
|
||||||
<items>
|
<items>
|
||||||
<item id="27593" count="15" />
|
<item id="27593" count="15" />
|
||||||
<item id="27603" count="1" />
|
<item id="27603" count="1" />
|
||||||
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -2612,20 +2612,20 @@
|
|||||||
<item id="35987" count="10" />
|
<item id="35987" count="10" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<!--
|
|
||||||
<reward id="224" reward_id="604" name="Login Once During the Weekend" requiredCompletion="1" isMainClassOnly="false" isOneTime="false">
|
<reward id="224" reward_id="604" name="Login Once During the Weekend" requiredCompletion="1" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginweekend" />
|
||||||
<items>
|
<items>
|
||||||
<item id="27593" count="4" />
|
<item id="27593" count="4" />
|
||||||
<item id="27603" count="1" />
|
<item id="27603" count="1" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="225" reward_id="605" name="Login Once During the Month" requiredCompletion="1" isMainClassOnly="false" isOneTime="false">
|
<reward id="225" reward_id="605" name="Login Once During the Month" requiredCompletion="1" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginmonth" />
|
||||||
<items>
|
<items>
|
||||||
<item id="27593" count="15" />
|
<item id="27593" count="15" />
|
||||||
<item id="27603" count="1" />
|
<item id="27603" count="1" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
-->
|
|
||||||
<reward id="226" reward_id="606" name="Complete Quests" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
<reward id="226" reward_id="606" name="Complete Quests" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
||||||
<handler name="quest" />
|
<handler name="quest" />
|
||||||
<items>
|
<items>
|
||||||
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -1175,11 +1175,13 @@
|
|||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="224" reward_id="604" name="Login All Weekend" isOneTime="false">
|
<reward id="224" reward_id="604" name="Login All Weekend" isOneTime="false">
|
||||||
|
<handler name="loginweekend" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="2" />
|
<item id="29648" count="2" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="225" reward_id="605" name="Login All Month" isOneTime="false">
|
<reward id="225" reward_id="605" name="Login All Month" isOneTime="false">
|
||||||
|
<handler name="loginmonth" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="4" />
|
<item id="29648" count="4" />
|
||||||
</items>
|
</items>
|
||||||
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -1631,18 +1631,18 @@
|
|||||||
<item id="70777" count="1" />
|
<item id="70777" count="1" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<!--
|
|
||||||
<reward id="224" reward_id="604" name="Login All Weekend" isMainClassOnly="false" isOneTime="false">
|
<reward id="224" reward_id="604" name="Login All Weekend" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginweekend" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="2" />
|
<item id="29648" count="2" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="225" reward_id="605" name="Login All Month" isMainClassOnly="false" isOneTime="false">
|
<reward id="225" reward_id="605" name="Login All Month" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginmonth" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="4" />
|
<item id="29648" count="4" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
-->
|
|
||||||
<reward id="226" reward_id="606" name="Quest Mania" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
<reward id="226" reward_id="606" name="Quest Mania" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
||||||
<handler name="quest" />
|
<handler name="quest" />
|
||||||
<items>
|
<items>
|
||||||
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -1631,18 +1631,18 @@
|
|||||||
<item id="70777" count="1" />
|
<item id="70777" count="1" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<!--
|
|
||||||
<reward id="224" reward_id="604" name="Login All Weekend" isMainClassOnly="false" isOneTime="false">
|
<reward id="224" reward_id="604" name="Login All Weekend" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginweekend" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="2" />
|
<item id="29648" count="2" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="225" reward_id="605" name="Login All Month" isMainClassOnly="false" isOneTime="false">
|
<reward id="225" reward_id="605" name="Login All Month" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginmonth" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="4" />
|
<item id="29648" count="4" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
-->
|
|
||||||
<reward id="226" reward_id="606" name="Quest Mania" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
<reward id="226" reward_id="606" name="Quest Mania" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
||||||
<handler name="quest" />
|
<handler name="quest" />
|
||||||
<items>
|
<items>
|
||||||
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -1631,18 +1631,18 @@
|
|||||||
<item id="70777" count="1" />
|
<item id="70777" count="1" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<!--
|
|
||||||
<reward id="224" reward_id="604" name="Login All Weekend" isMainClassOnly="false" isOneTime="false">
|
<reward id="224" reward_id="604" name="Login All Weekend" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginweekend" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="2" />
|
<item id="29648" count="2" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
<reward id="225" reward_id="605" name="Login All Month" isMainClassOnly="false" isOneTime="false">
|
<reward id="225" reward_id="605" name="Login All Month" isMainClassOnly="false" isOneTime="false">
|
||||||
|
<handler name="loginmonth" />
|
||||||
<items>
|
<items>
|
||||||
<item id="29648" count="4" />
|
<item id="29648" count="4" />
|
||||||
</items>
|
</items>
|
||||||
</reward>
|
</reward>
|
||||||
-->
|
|
||||||
<reward id="226" reward_id="606" name="Quest Mania" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
<reward id="226" reward_id="606" name="Quest Mania" isMainClassOnly="false" requiredCompletion="2" isOneTime="false">
|
||||||
<handler name="quest" />
|
<handler name="quest" />
|
||||||
<items>
|
<items>
|
||||||
|
@@ -24,6 +24,8 @@ import handlers.dailymissionhandlers.BossDailyMissionHandler;
|
|||||||
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
import handlers.dailymissionhandlers.CeremonyOfChaosDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
import handlers.dailymissionhandlers.FishingDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
import handlers.dailymissionhandlers.LevelDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginMonthDailyMissionHandler;
|
||||||
|
import handlers.dailymissionhandlers.LoginWeekendDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
import handlers.dailymissionhandlers.OlympiadDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
import handlers.dailymissionhandlers.QuestDailyMissionHandler;
|
||||||
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
import handlers.dailymissionhandlers.SiegeDailyMissionHandler;
|
||||||
@@ -38,8 +40,8 @@ public class DailyMissionMasterHandler
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("level", LevelDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllWeek", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginweekend", LoginWeekendDailyMissionHandler::new);
|
||||||
// DailyMissionHandler.getInstance().registerHandler("loginAllMonth", LoginAllWeekDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("loginmonth", LoginMonthDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("quest", QuestDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("olympiad", OlympiadDailyMissionHandler::new);
|
||||||
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
DailyMissionHandler.getInstance().registerHandler("siege", SiegeDailyMissionHandler::new);
|
||||||
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginMonthDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Monthly rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (lastCompleted == 0) // Initial entry.
|
||||||
|
{
|
||||||
|
entry.setLastCompleted(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.dailymissionhandlers;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||||
|
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.Containers;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
|
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Iris, Mobius
|
||||||
|
*/
|
||||||
|
public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||||
|
{
|
||||||
|
public LoginWeekendDailyMissionHandler(DailyMissionDataHolder holder)
|
||||||
|
{
|
||||||
|
super(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable(L2PcInstance player)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
|
||||||
|
if ((entry != null) && (entry.getStatus() == DailyMissionStatus.AVAILABLE))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
Containers.Global().addListener(new ConsumerEventListener(this, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
// Weekend rewards do not reset daily.
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPlayerLogin(OnPlayerLogin event)
|
||||||
|
{
|
||||||
|
final DailyMissionPlayerEntry entry = getPlayerEntry(event.getActiveChar().getObjectId(), true);
|
||||||
|
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||||
|
final long lastCompleted = entry.getLastCompleted();
|
||||||
|
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||||
|
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||||
|
{
|
||||||
|
entry.setProgress(1);
|
||||||
|
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (entry.getStatus() != DailyMissionStatus.AVAILABLE) // Not waiting to be rewarded.
|
||||||
|
{
|
||||||
|
entry.setProgress(0);
|
||||||
|
entry.setStatus(DailyMissionStatus.NOT_AVAILABLE);
|
||||||
|
}
|
||||||
|
storePlayerEntry(entry);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user