Four Sepulchers rework.

Thanks to Stayway and gigilo1968.
This commit is contained in:
MobiusDev
2016-08-07 16:38:58 +00:00
parent df9d1379fd
commit 49d0d680a0
85 changed files with 1700 additions and 4845 deletions

View File

@@ -1,95 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.tasks;
import java.util.Calendar;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.instancemanager.FourSepulchersManager;
/**
* Four Sepulchers change attack time task.
* @author xban1x
*/
public final class FourSepulchersChangeAttackTimeTask implements Runnable
{
@Override
public void run()
{
final FourSepulchersManager manager = FourSepulchersManager.getInstance();
manager.setIsEntryTime(false);
manager.setIsWarmUpTime(false);
manager.setIsAttackTime(true);
manager.setIsCoolDownTime(false);
manager.locationShadowSpawns();
manager.spawnMysteriousBox(31921);
manager.spawnMysteriousBox(31922);
manager.spawnMysteriousBox(31923);
manager.spawnMysteriousBox(31924);
if (!manager.isFirstTimeRun())
{
manager.setWarmUpTimeEnd(Calendar.getInstance().getTimeInMillis());
}
long interval = 0;
// say task
if (manager.isFirstTimeRun())
{
for (double min = Calendar.getInstance().get(Calendar.MINUTE); min < manager.getCycleMin(); min++)
{
// looking for next shout time....
if ((min % 5) == 0)// check if min can be divided by 5
{
final Calendar inter = Calendar.getInstance();
inter.set(Calendar.MINUTE, (int) min);
ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersManagerSayTask(), inter.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
break;
}
}
}
else
{
ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersManagerSayTask(), 5 * 60400);
}
// searching time when attack time will be ended:
// counting difference between time when attack time ends and
// current time
// and then launching change time task
if (manager.isFirstTimeRun())
{
interval = manager.getAttackTimeEnd() - Calendar.getInstance().getTimeInMillis();
}
else
{
interval = Config.FS_TIME_ATTACK * 60000L;
}
manager.setChangeCoolDownTimeTask(ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersChangeCoolDownTimeTask(), interval));
final ScheduledFuture<?> changeAttackTimeTask = manager.getChangeAttackTimeTask();
if (changeAttackTimeTask != null)
{
changeAttackTimeTask.cancel(true);
manager.setChangeAttackTimeTask(null);
}
}
}

View File

@@ -1,66 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.tasks;
import java.util.Calendar;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.instancemanager.FourSepulchersManager;
/**
* Four Sepulchers change cool down time task.
* @author xban1x
*/
public final class FourSepulchersChangeCoolDownTimeTask implements Runnable
{
@Override
public void run()
{
final FourSepulchersManager manager = FourSepulchersManager.getInstance();
manager.setIsEntryTime(false);
manager.setIsWarmUpTime(false);
manager.setIsAttackTime(false);
manager.setIsCoolDownTime(true);
manager.clean();
final Calendar time = Calendar.getInstance();
// one hour = 55th min to 55 min of next hour, so we check for this,
// also check for first launch
if (!manager.isFirstTimeRun() && (Calendar.getInstance().get(Calendar.MINUTE) > manager.getCycleMin()))
{
time.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) + 1);
}
time.set(Calendar.MINUTE, manager.getCycleMin());
if (manager.isFirstTimeRun())
{
manager.setIsFirstTimeRun(false);
}
final long interval = time.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
manager.setChangeEntryTimeTask(ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersChangeEntryTimeTask(), interval));
final ScheduledFuture<?> changeCoolDownTimeTask = manager.getChangeCoolDownTimeTask();
if (changeCoolDownTimeTask != null)
{
changeCoolDownTimeTask.cancel(true);
manager.setChangeCoolDownTimeTask(null);
}
}
}

View File

@@ -1,68 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.tasks;
import java.util.Calendar;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.instancemanager.FourSepulchersManager;
/**
* Four Sepulchers change entry time task.
* @author xban1x
*/
public final class FourSepulchersChangeEntryTimeTask implements Runnable
{
@Override
public void run()
{
final FourSepulchersManager manager = FourSepulchersManager.getInstance();
manager.setIsEntryTime(true);
manager.setIsWarmUpTime(false);
manager.setIsAttackTime(false);
manager.setIsCoolDownTime(false);
long interval = 0;
// if this is first launch - search time whFourSepulchersManager_inEntryTime = true;naFourSepulchersManager_inEntryTime = true;maen entry time will be
// ended:
// counting difference between time when entry time ends and current
// time
// and then launching change time task
if (manager.isFirstTimeRun())
{
interval = manager.getEntrytTimeEnd() - Calendar.getInstance().getTimeInMillis();
}
else
{
interval = Config.FS_TIME_ENTRY * 60000L; // else use stupid
// method
}
// launching saying process...
ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersManagerSayTask(), 0);
manager.setChangeWarmUpTimeTask(ThreadPoolManager.getInstance().scheduleEffect(new FourSepulchersChangeWarmUpTimeTask(), interval));
final ScheduledFuture<?> changeEntryTimeTask = manager.getChangeEntryTimeTask();
if (changeEntryTimeTask != null)
{
changeEntryTimeTask.cancel(true);
manager.setChangeEntryTimeTask(null);
}
}
}

View File

@@ -1,64 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.tasks;
import java.util.Calendar;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.instancemanager.FourSepulchersManager;
/**
* Four Sepulchers change warm up time task.
* @author xban1x
*/
public final class FourSepulchersChangeWarmUpTimeTask implements Runnable
{
@Override
public void run()
{
final FourSepulchersManager manager = FourSepulchersManager.getInstance();
manager.setIsEntryTime(true);
manager.setIsWarmUpTime(false);
manager.setIsAttackTime(false);
manager.setIsCoolDownTime(false);
long interval = 0;
// searching time when warmup time will be ended:
// counting difference between time when warmup time ends and
// current time
// and then launching change time task
if (manager.isFirstTimeRun())
{
interval = manager.getWarmUpTimeEnd() - Calendar.getInstance().getTimeInMillis();
}
else
{
interval = Config.FS_TIME_WARMUP * 60000L;
}
manager.setChangeAttackTimeTask(ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersChangeAttackTimeTask(), interval));
final ScheduledFuture<?> changeWarmUpTimeTask = manager.getChangeWarmUpTimeTask();
if (changeWarmUpTimeTask != null)
{
changeWarmUpTimeTask.cancel(true);
manager.setChangeWarmUpTimeTask(null);
}
}
}

View File

@@ -1,59 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager.tasks;
import java.util.Calendar;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.instancemanager.FourSepulchersManager;
/**
* Four Sepulchers manager say task.
* @author xban1x
*/
public final class FourSepulchersManagerSayTask implements Runnable
{
@Override
public void run()
{
if (FourSepulchersManager.getInstance().isAttackTime())
{
final Calendar tmp = Calendar.getInstance();
tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - FourSepulchersManager.getInstance().getWarmUpTimeEnd());
if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
{
FourSepulchersManager.getInstance().managerSay((byte) tmp.get(Calendar.MINUTE)); // byte
// because
// minute
// cannot be
// more than
// 59
ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersManagerSayTask(), 5 * 60000);
}
// attack time ending chat
else if ((tmp.get(Calendar.MINUTE) + 5) >= Config.FS_TIME_ATTACK)
{
FourSepulchersManager.getInstance().managerSay((byte) 90); // sending a unique id :D
}
}
else if (FourSepulchersManager.getInstance().isEntryTime())
{
FourSepulchersManager.getInstance().managerSay((byte) 0);
}
}
}