This commit is contained in:
147
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/DevastatedCastle/DevastatedCastle.java
vendored
Normal file
147
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/DevastatedCastle/DevastatedCastle.java
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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 conquerablehalls.DevastatedCastle;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jmobius.gameserver.datatables.SkillData;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.ClanHallSiegeEngine;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
|
||||
/**
|
||||
* Devastated Castle clan hall siege script.
|
||||
* @author BiggBoss
|
||||
*/
|
||||
final class DevastatedCastle extends ClanHallSiegeEngine
|
||||
{
|
||||
private static final int GUSTAV = 35410;
|
||||
private static final int MIKHAIL = 35409;
|
||||
private static final int DIETRICH = 35408;
|
||||
private static final double GUSTAV_TRIGGER_HP = NpcData.getInstance().getTemplate(GUSTAV).getBaseHpMax() / 12;
|
||||
|
||||
private static Map<Integer, Integer> _damageToGustav = new HashMap<>();
|
||||
|
||||
private DevastatedCastle()
|
||||
{
|
||||
super(DevastatedCastle.class.getSimpleName(), "conquerablehalls", DEVASTATED_CASTLE);
|
||||
addKillId(GUSTAV);
|
||||
addSpawnId(MIKHAIL);
|
||||
addSpawnId(DIETRICH);
|
||||
addAttackId(GUSTAV);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
if (npc.getId() == MIKHAIL)
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_SHOUT, NpcStringId.GLORY_TO_ADEN_THE_KINGDOM_OF_THE_LION_GLORY_TO_SIR_GUSTAV_OUR_IMMORTAL_LORD);
|
||||
}
|
||||
else if (npc.getId() == DIETRICH)
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_SHOUT, NpcStringId.SOLDIERS_OF_GUSTAV_GO_FORTH_AND_DESTROY_THE_INVADERS);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
|
||||
{
|
||||
if (!_hall.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
final L2Clan clan = attacker.getClan();
|
||||
|
||||
if ((clan != null) && checkIsAttacker(clan))
|
||||
{
|
||||
final int id = clan.getId();
|
||||
if (_damageToGustav.containsKey(id))
|
||||
{
|
||||
_damageToGustav.put(id, _damageToGustav.get(id) + damage);
|
||||
}
|
||||
else
|
||||
{
|
||||
_damageToGustav.put(id, damage);
|
||||
}
|
||||
}
|
||||
|
||||
if ((npc.getCurrentHp() < GUSTAV_TRIGGER_HP) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST))
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.THIS_IS_UNBELIEVABLE_HAVE_I_REALLY_BEEN_DEFEATED_I_SHALL_RETURN_AND_TAKE_YOUR_HEAD);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, SkillData.getInstance().getSkill(4235, 1), npc);
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
||||
{
|
||||
if (!_hall.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
_missionAccomplished = true;
|
||||
|
||||
if (npc.getId() == GUSTAV)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
cancelSiegeTask();
|
||||
endSiege();
|
||||
}
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Clan getWinner()
|
||||
{
|
||||
int counter = 0;
|
||||
int damagest = 0;
|
||||
for (Entry<Integer, Integer> e : _damageToGustav.entrySet())
|
||||
{
|
||||
final int damage = e.getValue();
|
||||
if (damage > counter)
|
||||
{
|
||||
counter = damage;
|
||||
damagest = e.getKey();
|
||||
}
|
||||
}
|
||||
return ClanTable.getInstance().getClan(damagest);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new DevastatedCastle();
|
||||
}
|
||||
}
|
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* 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 conquerablehalls.FortressOfResistance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jmobius.gameserver.cache.HtmCache;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2Spawn;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.ClanHallSiegeEngine;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Fortress of Resistance clan hall siege Script.
|
||||
* @author BiggBoss
|
||||
*/
|
||||
final class FortressOfResistance extends ClanHallSiegeEngine
|
||||
{
|
||||
private final int MESSENGER = 35382;
|
||||
private final int BLOODY_LORD_NURKA = 35375;
|
||||
|
||||
private final Location[] NURKA_COORDS =
|
||||
{
|
||||
new Location(45109, 112124, -1900), // 30%
|
||||
new Location(47653, 110816, -2110), // 40%
|
||||
new Location(47247, 109396, -2000), // 30%
|
||||
};
|
||||
|
||||
private L2Spawn _nurka;
|
||||
private final Map<Integer, Long> _damageToNurka = new HashMap<>();
|
||||
private NpcHtmlMessage _messengerMsg;
|
||||
|
||||
private FortressOfResistance()
|
||||
{
|
||||
super(FortressOfResistance.class.getSimpleName(), "conquerablehalls", FORTRESS_RESSISTANCE);
|
||||
addFirstTalkId(MESSENGER);
|
||||
addKillId(BLOODY_LORD_NURKA);
|
||||
addAttackId(BLOODY_LORD_NURKA);
|
||||
buildMessengerMessage();
|
||||
|
||||
try
|
||||
{
|
||||
_nurka = new L2Spawn(BLOODY_LORD_NURKA);
|
||||
_nurka.setAmount(1);
|
||||
_nurka.setRespawnDelay(10800);
|
||||
// @formatter:off
|
||||
// int chance = getRandom(100) + 1;
|
||||
// if (chance <= 30)
|
||||
// {
|
||||
// coords = NURKA_COORDS[0];
|
||||
// }
|
||||
// else if ((chance > 30) && (chance <= 70))
|
||||
// {
|
||||
// coords = NURKA_COORDS[1];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// coords = NURKA_COORDS[2];
|
||||
// }
|
||||
// @formatter:on
|
||||
_nurka.setLocation(NURKA_COORDS[0]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ": Couldn't set the Bloody Lord Nurka spawn!");
|
||||
}
|
||||
}
|
||||
|
||||
private final void buildMessengerMessage()
|
||||
{
|
||||
final String html = HtmCache.getInstance().getHtm(null, "scripts/conquerablehalls/FortressOfResistance/partisan_ordery_brakel001.htm");
|
||||
if (html != null)
|
||||
{
|
||||
// FIXME: We don't have an object id to put in here :(
|
||||
_messengerMsg = new NpcHtmlMessage();
|
||||
_messengerMsg.setHtml(html);
|
||||
_messengerMsg.replace("%nextSiege%", Util.formatDate(_hall.getSiegeDate().getTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
player.sendPacket(_messengerMsg);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon)
|
||||
{
|
||||
if (!_hall.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final int clanId = player.getClanId();
|
||||
if (clanId > 0)
|
||||
{
|
||||
_damageToNurka.put(clanId, _damageToNurka.containsKey(clanId) ? _damageToNurka.get(clanId) + damage : damage);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
||||
{
|
||||
if (!_hall.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
_missionAccomplished = true;
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
npc.getSpawn().stopRespawn();
|
||||
npc.deleteMe();
|
||||
cancelSiegeTask();
|
||||
endSiege();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Clan getWinner()
|
||||
{
|
||||
int winnerId = 0;
|
||||
long counter = 0;
|
||||
for (Entry<Integer, Long> e : _damageToNurka.entrySet())
|
||||
{
|
||||
final long dam = e.getValue();
|
||||
if (dam > counter)
|
||||
{
|
||||
winnerId = e.getKey();
|
||||
counter = dam;
|
||||
}
|
||||
}
|
||||
return ClanTable.getInstance().getClan(winnerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSiegeStarts()
|
||||
{
|
||||
_nurka.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSiegeEnds()
|
||||
{
|
||||
buildMessengerMessage();
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FortressOfResistance();
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
<html><body>
|
||||
I shouldn't be telling you this... but our master, Nurka, visits this clan hall on a regular basis.<br>
|
||||
I think his next visit will be around %nextSiege%...
|
||||
</body></html>
|
171
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/FortressOfTheDead/FortressOfTheDead.java
vendored
Normal file
171
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/FortressOfTheDead/FortressOfTheDead.java
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* 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 conquerablehalls.FortressOfTheDead;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jmobius.gameserver.GameTimeController;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.ClanHallSiegeEngine;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
|
||||
/**
|
||||
* Fortress of the Dead clan hall siege script.
|
||||
* @author BiggBoss
|
||||
*/
|
||||
final class FortressOfTheDead extends ClanHallSiegeEngine
|
||||
{
|
||||
private static final int LIDIA = 35629;
|
||||
private static final int ALFRED = 35630;
|
||||
private static final int GISELLE = 35631;
|
||||
|
||||
private static Map<Integer, Integer> _damageToLidia = new HashMap<>();
|
||||
|
||||
public FortressOfTheDead()
|
||||
{
|
||||
super(FortressOfTheDead.class.getSimpleName(), "conquerablehalls", FORTRESS_OF_DEAD);
|
||||
addKillId(LIDIA);
|
||||
addKillId(ALFRED);
|
||||
addKillId(GISELLE);
|
||||
|
||||
addSpawnId(LIDIA);
|
||||
addSpawnId(ALFRED);
|
||||
addSpawnId(GISELLE);
|
||||
|
||||
addAttackId(LIDIA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
if (npc.getId() == LIDIA)
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_SHOUT, NpcStringId.HMM_THOSE_WHO_ARE_NOT_OF_THE_BLOODLINE_ARE_COMING_THIS_WAY_TO_TAKE_OVER_THE_CASTLE_HUMPH_THE_BITTER_GRUDGES_OF_THE_DEAD_YOU_MUST_NOT_MAKE_LIGHT_OF_THEIR_POWER);
|
||||
}
|
||||
else if (npc.getId() == ALFRED)
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_SHOUT, NpcStringId.HEH_HEH_I_SEE_THAT_THE_FEAST_HAS_BEGUN_BE_WARY_THE_CURSE_OF_THE_HELLMANN_FAMILY_HAS_POISONED_THIS_LAND);
|
||||
}
|
||||
else if (npc.getId() == GISELLE)
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_SHOUT, NpcStringId.ARISE_MY_FAITHFUL_SERVANTS_YOU_MY_PEOPLE_WHO_HAVE_INHERITED_THE_BLOOD_IT_IS_THE_CALLING_OF_MY_DAUGHTER_THE_FEAST_OF_BLOOD_WILL_NOW_BEGIN);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
|
||||
{
|
||||
if (!_hall.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
final L2Clan clan = attacker.getClan();
|
||||
|
||||
if ((clan != null) && checkIsAttacker(clan))
|
||||
{
|
||||
final int id = clan.getId();
|
||||
if ((id > 0) && _damageToLidia.containsKey(id))
|
||||
{
|
||||
_damageToLidia.put(id, _damageToLidia.get(id) + damage);
|
||||
}
|
||||
else
|
||||
{
|
||||
_damageToLidia.put(id, damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
||||
{
|
||||
if (!_hall.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final int npcId = npc.getId();
|
||||
|
||||
if ((npcId == ALFRED) || (npcId == GISELLE))
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_SHOUT, NpcStringId.AARGH_IF_I_DIE_THEN_THE_MAGIC_FORCE_FIELD_OF_BLOOD_WILL);
|
||||
}
|
||||
if (npcId == LIDIA)
|
||||
{
|
||||
broadcastNpcSay(npc, ChatType.NPC_SHOUT, NpcStringId.GRARR_FOR_THE_NEXT_2_MINUTES_OR_SO_THE_GAME_ARENA_ARE_WILL_BE_CLEANED_THROW_ANY_ITEMS_YOU_DON_T_NEED_TO_THE_FLOOR_NOW);
|
||||
_missionAccomplished = true;
|
||||
synchronized (this)
|
||||
{
|
||||
cancelSiegeTask();
|
||||
endSiege();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Clan getWinner()
|
||||
{
|
||||
int counter = 0;
|
||||
int damagest = 0;
|
||||
for (Entry<Integer, Integer> e : _damageToLidia.entrySet())
|
||||
{
|
||||
final int damage = e.getValue();
|
||||
if (damage > counter)
|
||||
{
|
||||
counter = damage;
|
||||
damagest = e.getKey();
|
||||
}
|
||||
}
|
||||
return ClanTable.getInstance().getClan(damagest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSiege()
|
||||
{
|
||||
// Siege must start at night
|
||||
final int hoursLeft = (GameTimeController.getInstance().getGameTime() / 60) % 24;
|
||||
|
||||
if ((hoursLeft < 0) || (hoursLeft > 6))
|
||||
{
|
||||
cancelSiegeTask();
|
||||
_siegeTask = ThreadPoolManager.getInstance().scheduleGeneral(new SiegeStarts(), (24 - hoursLeft) * 10 * 60000);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.startSiege();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FortressOfTheDead();
|
||||
}
|
||||
}
|
@@ -0,0 +1,926 @@
|
||||
/*
|
||||
* 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 conquerablehalls.RainbowSpringsChateau;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.cache.HtmCache;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.datatables.SpawnTable;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.instancemanager.CHSiegeManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.L2Spawn;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.ClanHallSiegeEngine;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.SiegableHall;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.SiegeStatus;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Rainbow Springs Chateau clan hall siege script.
|
||||
* @author BiggBoss
|
||||
*/
|
||||
final class RainbowSpringsChateau extends ClanHallSiegeEngine
|
||||
{
|
||||
static class SetFinalAttackers implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_rainbow == null)
|
||||
{
|
||||
_rainbow = CHSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS);
|
||||
}
|
||||
|
||||
int spotLeft = 4;
|
||||
if (_rainbow.getOwnerId() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Clan owner = ClanTable.getInstance().getClan(_rainbow.getOwnerId());
|
||||
if (owner != null)
|
||||
{
|
||||
_rainbow.free();
|
||||
owner.setHideoutId(0);
|
||||
_acceptedClans.add(owner);
|
||||
--spotLeft;
|
||||
}
|
||||
|
||||
for (int i = 0; i < spotLeft; i++)
|
||||
{
|
||||
long counter = 0;
|
||||
L2Clan clan = null;
|
||||
for (int clanId : _warDecreesCount.keySet())
|
||||
{
|
||||
final L2Clan actingClan = ClanTable.getInstance().getClan(clanId);
|
||||
if ((actingClan == null) || (actingClan.getDissolvingExpiryTime() > 0))
|
||||
{
|
||||
_warDecreesCount.remove(clanId);
|
||||
continue;
|
||||
}
|
||||
|
||||
final long count = _warDecreesCount.get(clanId);
|
||||
if (count > counter)
|
||||
{
|
||||
counter = count;
|
||||
clan = actingClan;
|
||||
}
|
||||
}
|
||||
if ((clan != null) && (_acceptedClans.size() < 4))
|
||||
{
|
||||
_acceptedClans.add(clan);
|
||||
final L2PcInstance leader = clan.getLeader().getPlayerInstance();
|
||||
if (leader != null)
|
||||
{
|
||||
leader.sendMessage("Your clan has been accepted to join the RainBow Srpings Chateau siege!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_acceptedClans.size() >= 2)
|
||||
{
|
||||
_nextSiege = ThreadPoolManager.getInstance().scheduleGeneral(new SiegeStart(), 3600000);
|
||||
_rainbow.updateSiegeStatus(SiegeStatus.WAITING_BATTLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("Rainbow Springs Chateau siege aborted due lack of population");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class SiegeStart implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_rainbow == null)
|
||||
{
|
||||
_rainbow = CHSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS);
|
||||
}
|
||||
|
||||
// XXX _rainbow.siegeStarts();
|
||||
|
||||
spawnGourds();
|
||||
_siegeEnd = ThreadPoolManager.getInstance().scheduleGeneral(new SiegeEnd(null), _rainbow.getSiegeLenght() - 120000);
|
||||
}
|
||||
}
|
||||
|
||||
public static L2Clan _winner;
|
||||
|
||||
@Override
|
||||
public L2Clan getWinner()
|
||||
{
|
||||
return _winner;
|
||||
}
|
||||
|
||||
private static class SiegeEnd implements Runnable
|
||||
{
|
||||
private final L2Clan _winner;
|
||||
|
||||
SiegeEnd(L2Clan winner)
|
||||
{
|
||||
_winner = winner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_rainbow == null)
|
||||
{
|
||||
_rainbow = CHSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS);
|
||||
}
|
||||
|
||||
unSpawnGourds();
|
||||
|
||||
if (_winner != null)
|
||||
{
|
||||
_rainbow.setOwner(_winner);
|
||||
}
|
||||
|
||||
// XXX _rainbow.siegeEnds();
|
||||
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new SetFinalAttackers(), _rainbow.getNextSiegeTime());
|
||||
setRegistrationEndString((_rainbow.getNextSiegeTime() + System.currentTimeMillis()) - 3600000);
|
||||
// Teleport out of the arenas is made 2 mins after game ends
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new TeleportBack(), 120000);
|
||||
}
|
||||
}
|
||||
|
||||
static class TeleportBack implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (int arenaId : ARENA_ZONES)
|
||||
{
|
||||
for (L2Character chr : ZoneManager.getInstance().getZoneById(arenaId).getCharactersInside())
|
||||
{
|
||||
if (chr != null)
|
||||
{
|
||||
chr.teleToLocation(TeleportWhereType.TOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final int RAINBOW_SPRINGS = 62;
|
||||
|
||||
private static final int WAR_DECREES = 8034;
|
||||
private static final int RAINBOW_NECTAR = 8030;
|
||||
private static final int RAINBOW_MWATER = 8031;
|
||||
private static final int RAINBOW_WATER = 8032;
|
||||
private static final int RAINBOW_SULFUR = 8033;
|
||||
|
||||
private static final int MESSENGER = 35604;
|
||||
private static final int CARETAKER = 35603;
|
||||
private static final int CHEST = 35593;
|
||||
|
||||
private static final int[] GOURDS =
|
||||
{
|
||||
35588,
|
||||
35589,
|
||||
35590,
|
||||
35591
|
||||
};
|
||||
private static L2Spawn[] _gourds = new L2Spawn[4];
|
||||
|
||||
private static final int[] YETIS =
|
||||
{
|
||||
35596,
|
||||
35597,
|
||||
35598,
|
||||
35599
|
||||
};
|
||||
|
||||
private static final Location[] ARENAS = new Location[]
|
||||
{
|
||||
new Location(151562, -127080, -2214), // Arena 1
|
||||
new Location(153141, -125335, -2214), // Arena 2
|
||||
new Location(153892, -127530, -2214), // Arena 3
|
||||
new Location(155657, -125752, -2214), // Arena 4
|
||||
};
|
||||
|
||||
static final int[] ARENA_ZONES =
|
||||
{
|
||||
112081,
|
||||
112082,
|
||||
112083,
|
||||
112084
|
||||
};
|
||||
|
||||
private static final String[] _textPassages =
|
||||
{
|
||||
"Fight for Rainbow Springs!",
|
||||
"Are you a match for the Yetti?",
|
||||
"Did somebody order a knuckle sandwich?"
|
||||
};
|
||||
|
||||
private static final Skill[] DEBUFFS = {};
|
||||
|
||||
static Map<Integer, Long> _warDecreesCount = new HashMap<>();
|
||||
static List<L2Clan> _acceptedClans = new ArrayList<>(4);
|
||||
private static Map<String, ArrayList<L2Clan>> _usedTextPassages = new HashMap<>();
|
||||
private static Map<L2Clan, Integer> _pendingItemToGet = new HashMap<>();
|
||||
|
||||
static SiegableHall _rainbow;
|
||||
static ScheduledFuture<?> _nextSiege;
|
||||
|
||||
static ScheduledFuture<?> _siegeEnd;
|
||||
private static String _registrationEnds;
|
||||
|
||||
public RainbowSpringsChateau()
|
||||
{
|
||||
super(RainbowSpringsChateau.class.getSimpleName(), "conquerablehalls", RAINBOW_SPRINGS);
|
||||
|
||||
addFirstTalkId(MESSENGER);
|
||||
addTalkId(MESSENGER);
|
||||
addFirstTalkId(CARETAKER);
|
||||
addTalkId(CARETAKER);
|
||||
addFirstTalkId(YETIS);
|
||||
addTalkId(YETIS);
|
||||
|
||||
loadAttackers();
|
||||
|
||||
_rainbow = CHSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS);
|
||||
if (_rainbow == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final long delay = _rainbow.getNextSiegeTime();
|
||||
if (delay > -1)
|
||||
{
|
||||
setRegistrationEndString(delay - 3600000);
|
||||
_nextSiege = ThreadPoolManager.getInstance().scheduleGeneral(new SetFinalAttackers(), delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("CHSiegeManager: No Date setted for RainBow Springs Chateau Clan hall siege!. SIEGE CANCELED!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String html = "";
|
||||
final int npcId = npc.getId();
|
||||
if (npcId == MESSENGER)
|
||||
{
|
||||
final String main = (_rainbow.getOwnerId() > 0) ? "messenger_yetti001.htm" : "messenger_yetti001a.htm";
|
||||
html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "scripts/conquerablehalls/RainbowSpringsChateau/" + main);
|
||||
html = html.replace("%time%", _registrationEnds);
|
||||
if (_rainbow.getOwnerId() > 0)
|
||||
{
|
||||
html = html.replace("%owner%", ClanTable.getInstance().getClan(_rainbow.getOwnerId()).getName());
|
||||
}
|
||||
}
|
||||
else if (npcId == CARETAKER)
|
||||
{
|
||||
html = _rainbow.isInSiege() ? "game_manager003.htm" : "game_manager001.htm";
|
||||
}
|
||||
else if (Util.contains(YETIS, npcId) && _rainbow.isInSiege())
|
||||
{
|
||||
if (!player.isClanLeader())
|
||||
{
|
||||
html = "no_clan_leader.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
final L2Clan clan = player.getClan();
|
||||
if (_acceptedClans.contains(clan) && (npcId == YETIS[_acceptedClans.indexOf(clan)]))
|
||||
{
|
||||
html = "yeti_main.htm";
|
||||
}
|
||||
}
|
||||
}
|
||||
player.setLastQuestNpcObject(npc.getObjectId());
|
||||
return html;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String html = event;
|
||||
final L2Clan clan = player.getClan();
|
||||
switch (npc.getId())
|
||||
{
|
||||
case MESSENGER:
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case "register":
|
||||
{
|
||||
if (!player.isClanLeader())
|
||||
{
|
||||
html = "messenger_yetti010.htm";
|
||||
}
|
||||
else if ((clan.getCastleId() > 0) || (clan.getFortId() > 0) || (clan.getHideoutId() > 0))
|
||||
{
|
||||
html = "messenger_yetti012.htm";
|
||||
}
|
||||
else if (!_rainbow.isRegistering())
|
||||
{
|
||||
html = "messenger_yetti014.htm";
|
||||
}
|
||||
else if (_warDecreesCount.containsKey(clan.getId()))
|
||||
{
|
||||
html = "messenger_yetti013.htm";
|
||||
}
|
||||
else if ((clan.getLevel() < 3) || (clan.getMembersCount() < 5))
|
||||
{
|
||||
html = "messenger_yetti011.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
final L2ItemInstance warDecrees = player.getInventory().getItemByItemId(WAR_DECREES);
|
||||
if (warDecrees == null)
|
||||
{
|
||||
html = "messenger_yetti008.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
final long count = warDecrees.getCount();
|
||||
_warDecreesCount.put(clan.getId(), count);
|
||||
player.destroyItem("Rainbow Springs Registration", warDecrees, npc, true);
|
||||
addAttacker(clan.getId(), count);
|
||||
html = "messenger_yetti009.htm";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "cancel":
|
||||
{
|
||||
if (!player.isClanLeader())
|
||||
{
|
||||
html = "messenger_yetti010.htm";
|
||||
}
|
||||
else if (!_warDecreesCount.containsKey(clan.getId()))
|
||||
{
|
||||
html = "messenger_yetti016.htm";
|
||||
}
|
||||
else if (!_rainbow.isRegistering())
|
||||
{
|
||||
html = "messenger_yetti017.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
removeAttacker(clan.getId());
|
||||
html = "messenger_yetti018.htm";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "unregister":
|
||||
{
|
||||
if (_rainbow.isRegistering())
|
||||
{
|
||||
if (_warDecreesCount.containsKey(clan.getId()))
|
||||
{
|
||||
player.addItem("Rainbow Spring unregister", WAR_DECREES, _warDecreesCount.get(clan.getId()) / 2, npc, true);
|
||||
_warDecreesCount.remove(clan.getId());
|
||||
html = "messenger_yetti019.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "messenger_yetti020.htm";
|
||||
}
|
||||
}
|
||||
else if (_rainbow.isWaitingBattle())
|
||||
{
|
||||
_acceptedClans.remove(clan);
|
||||
html = "messenger_yetti020.htm";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARETAKER:
|
||||
{
|
||||
if (event.equals("portToArena"))
|
||||
{
|
||||
final L2Party party = player.getParty();
|
||||
if (clan == null)
|
||||
{
|
||||
html = "game_manager009.htm";
|
||||
}
|
||||
else if (!player.isClanLeader())
|
||||
{
|
||||
html = "game_manager004.htm";
|
||||
}
|
||||
else if (!player.isInParty())
|
||||
{
|
||||
html = "game_manager005.htm";
|
||||
}
|
||||
else if (party.getLeaderObjectId() != player.getObjectId())
|
||||
{
|
||||
html = "game_manager006.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
final int clanId = player.getClanId();
|
||||
boolean nonClanMemberInParty = false;
|
||||
for (L2PcInstance member : party.getMembers())
|
||||
{
|
||||
if (member.getClanId() != clanId)
|
||||
{
|
||||
nonClanMemberInParty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nonClanMemberInParty)
|
||||
{
|
||||
html = "game_manager007.htm";
|
||||
}
|
||||
else if (party.getMemberCount() < 5)
|
||||
{
|
||||
html = "game_manager008.htm";
|
||||
}
|
||||
else if ((clan.getCastleId() > 0) || (clan.getFortId() > 0) || (clan.getHideoutId() > 0))
|
||||
{
|
||||
html = "game_manager010.htm";
|
||||
}
|
||||
else if (clan.getLevel() < Config.CHS_CLAN_MINLEVEL)
|
||||
{
|
||||
html = "game_manager011.htm";
|
||||
}
|
||||
// else if () // Something about the rules.
|
||||
// {
|
||||
// html = "game_manager012.htm";
|
||||
// }
|
||||
// else if () // Already registered.
|
||||
// {
|
||||
// html = "game_manager013.htm";
|
||||
// }
|
||||
else if (!_acceptedClans.contains(clan))
|
||||
{
|
||||
html = "game_manager014.htm";
|
||||
}
|
||||
// else if () // Not have enough cards to register.
|
||||
// {
|
||||
// html = "game_manager015.htm";
|
||||
// }
|
||||
else
|
||||
{
|
||||
portToArena(player, _acceptedClans.indexOf(clan));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.startsWith("enterText"))
|
||||
{
|
||||
// Shouldn't happen
|
||||
if (!_acceptedClans.contains(clan))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final String[] split = event.split("_ ");
|
||||
if (split.length < 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final String passage = split[1];
|
||||
|
||||
if (!isValidPassage(passage))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_usedTextPassages.containsKey(passage))
|
||||
{
|
||||
final ArrayList<L2Clan> list = _usedTextPassages.get(passage);
|
||||
|
||||
if (list.contains(clan))
|
||||
{
|
||||
html = "yeti_passage_used.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add(clan);
|
||||
synchronized (_pendingItemToGet)
|
||||
{
|
||||
if (_pendingItemToGet.containsKey(clan))
|
||||
{
|
||||
int left = _pendingItemToGet.get(clan);
|
||||
++left;
|
||||
_pendingItemToGet.put(clan, left);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pendingItemToGet.put(clan, 1);
|
||||
}
|
||||
}
|
||||
html = "yeti_item_exchange.htm";
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO(Zoey76): Rewrite this to prevent exploits...
|
||||
// else if (event.startsWith("getItem"))
|
||||
// {
|
||||
// if (!_pendingItemToGet.containsKey(clan))
|
||||
// {
|
||||
// html = "yeti_cannot_exchange.htm";
|
||||
// }
|
||||
//
|
||||
// int left = _pendingItemToGet.get(clan);
|
||||
// if (left > 0)
|
||||
// {
|
||||
// int itemId = Integer.parseInt(event.split("_")[1]);
|
||||
// player.addItem("Rainbow Spring Chateau Siege", itemId, 1, npc, true);
|
||||
// --left;
|
||||
// _pendingItemToGet.put(clan, left);
|
||||
// html = "yeti_main.htm";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// html = "yeti_cannot_exchange.htm";
|
||||
// }
|
||||
// }
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
||||
{
|
||||
if (!_rainbow.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final L2Clan clan = killer.getClan();
|
||||
if ((clan == null) || !_acceptedClans.contains(clan))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final int npcId = npc.getId();
|
||||
final int index = _acceptedClans.indexOf(clan);
|
||||
|
||||
if (npcId == CHEST)
|
||||
{
|
||||
shoutRandomText(npc);
|
||||
}
|
||||
else if (npcId == GOURDS[index])
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (_siegeEnd != null)
|
||||
{
|
||||
_siegeEnd.cancel(false);
|
||||
}
|
||||
ThreadPoolManager.getInstance().executeGeneral(new SiegeEnd(clan));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onItemUse(L2Item item, L2PcInstance player)
|
||||
{
|
||||
if (!_rainbow.isInSiege())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final L2Object target = player.getTarget();
|
||||
|
||||
if ((target == null) || !(target instanceof L2Npc))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final int yeti = target.getId();
|
||||
if (!isYetiTarget(yeti))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final L2Clan clan = player.getClan();
|
||||
if ((clan == null) || !_acceptedClans.contains(clan))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Nectar must spawn the enraged yeti. Dunno if it makes any other thing
|
||||
// Also, the items must execute:
|
||||
// - Reduce gourd hpb ( reduceGourdHp(int, L2PcInstance) )
|
||||
// - Cast debuffs on enemy clans ( castDebuffsOnEnemies(int) )
|
||||
// - Change arena gourds ( moveGourds() )
|
||||
// - Increase gourd hp ( increaseGourdHp(int) )
|
||||
|
||||
final int itemId = item.getId();
|
||||
if (itemId == RAINBOW_NECTAR)
|
||||
{
|
||||
// Spawn enraged (where?)
|
||||
reduceGourdHp(_acceptedClans.indexOf(clan), player);
|
||||
}
|
||||
else if (itemId == RAINBOW_MWATER)
|
||||
{
|
||||
increaseGourdHp(_acceptedClans.indexOf(clan));
|
||||
}
|
||||
else if (itemId == RAINBOW_WATER)
|
||||
{
|
||||
moveGourds();
|
||||
}
|
||||
else if (itemId == RAINBOW_SULFUR)
|
||||
{
|
||||
castDebuffsOnEnemies(_acceptedClans.indexOf(clan));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void portToArena(L2PcInstance leader, int arena)
|
||||
{
|
||||
if ((arena < 0) || (arena > 3))
|
||||
{
|
||||
_log.warning("RainbowSptringChateau siege: Wrong arena ID passed: " + arena);
|
||||
return;
|
||||
}
|
||||
for (L2PcInstance pc : leader.getParty().getMembers())
|
||||
{
|
||||
if (pc != null)
|
||||
{
|
||||
pc.stopAllEffects();
|
||||
final L2Summon pet = pc.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.unSummon(pc);
|
||||
}
|
||||
pc.getServitors().values().forEach(s ->
|
||||
{
|
||||
s.unSummon(pc);
|
||||
});
|
||||
pc.teleToLocation(ARENAS[arena]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void spawnGourds()
|
||||
{
|
||||
for (int i = 0; i < _acceptedClans.size(); i++)
|
||||
{
|
||||
if (_gourds[i] == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_gourds[i] = new L2Spawn(GOURDS[i]);
|
||||
_gourds[i].setX(ARENAS[i].getX() + 150);
|
||||
_gourds[i].setY(ARENAS[i].getY() + 150);
|
||||
_gourds[i].setZ(ARENAS[i].getZ());
|
||||
_gourds[i].setHeading(1);
|
||||
_gourds[i].setAmount(1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// _log.warning("Unable to spawn guard for clan index " + i + "!");
|
||||
}
|
||||
}
|
||||
SpawnTable.getInstance().addNewSpawn(_gourds[i], false);
|
||||
_gourds[i].init();
|
||||
}
|
||||
}
|
||||
|
||||
static void unSpawnGourds()
|
||||
{
|
||||
for (int i = 0; i < _acceptedClans.size(); i++)
|
||||
{
|
||||
_gourds[i].getLastSpawn().deleteMe();
|
||||
SpawnTable.getInstance().deleteSpawn(_gourds[i], false);
|
||||
}
|
||||
}
|
||||
|
||||
private static void moveGourds()
|
||||
{
|
||||
final L2Spawn[] tempArray = _gourds;
|
||||
final int iterator = _acceptedClans.size();
|
||||
for (int i = 0; i < iterator; i++)
|
||||
{
|
||||
final L2Spawn oldSpawn = _gourds[(iterator - 1) - i];
|
||||
final L2Spawn curSpawn = tempArray[i];
|
||||
|
||||
_gourds[(iterator - 1) - i] = curSpawn;
|
||||
|
||||
curSpawn.getLastSpawn().teleToLocation(oldSpawn.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
private static void reduceGourdHp(int index, L2PcInstance player)
|
||||
{
|
||||
_gourds[index].getLastSpawn().reduceCurrentHp(1000, player, null);
|
||||
}
|
||||
|
||||
private static void increaseGourdHp(int index)
|
||||
{
|
||||
final L2Spawn gourd = _gourds[index];
|
||||
final L2Npc gourdNpc = gourd.getLastSpawn();
|
||||
gourdNpc.setCurrentHp(gourdNpc.getCurrentHp() + 1000);
|
||||
}
|
||||
|
||||
private static void castDebuffsOnEnemies(int myArena)
|
||||
{
|
||||
for (int id : ARENA_ZONES)
|
||||
{
|
||||
if (id == myArena)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (L2Character chr : ZoneManager.getInstance().getZoneById(id).getCharactersInside())
|
||||
{
|
||||
if (chr != null)
|
||||
{
|
||||
for (Skill sk : DEBUFFS)
|
||||
{
|
||||
sk.applyEffects(chr, chr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void shoutRandomText(L2Npc npc)
|
||||
{
|
||||
final int length = _textPassages.length;
|
||||
|
||||
if (_usedTextPassages.size() >= length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final int randomPos = getRandom(length);
|
||||
if (_usedTextPassages.containsKey(_textPassages[randomPos]))
|
||||
{
|
||||
shoutRandomText(npc);
|
||||
}
|
||||
else
|
||||
{
|
||||
_usedTextPassages.put(_textPassages[randomPos], new ArrayList<L2Clan>());
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_SHOUT, npc.getId(), _textPassages[randomPos]));
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isValidPassage(String text)
|
||||
{
|
||||
for (String qs : _textPassages)
|
||||
{
|
||||
if (qs.equalsIgnoreCase(text))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isYetiTarget(int npcId)
|
||||
{
|
||||
return Util.contains(YETIS, npcId);
|
||||
}
|
||||
|
||||
private static void removeAttacker(int clanId)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM rainbowsprings_attacker_list WHERE clanId = ?"))
|
||||
{
|
||||
ps.setInt(1, clanId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// _log.warning(RainbowSpringsChateau.class.getSigners() + ": Unable to remove attacker clan ID " + clanId + " from database!");
|
||||
}
|
||||
}
|
||||
|
||||
private static void addAttacker(int clanId, long count)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO rainbowsprings_attacker_list VALUES (?,?)"))
|
||||
{
|
||||
ps.setInt(1, clanId);
|
||||
ps.setLong(2, count);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// _log.warning(RainbowSpringsChateau.class.getSigners() + ": Unable add attakers for clan ID " + clanId + " and count " + count + "!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAttackers()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rset = s.executeQuery("SELECT * FROM rainbowsprings_attacker_list"))
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
_warDecreesCount.put(rset.getInt("clan_id"), rset.getLong("decrees_count"));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(RainbowSpringsChateau.class.getSigners() + ": Unable load attakers!");
|
||||
}
|
||||
}
|
||||
|
||||
static void setRegistrationEndString(long time)
|
||||
{
|
||||
final Calendar c = Calendar.getInstance();
|
||||
c.setTime(new Date(time));
|
||||
final int year = c.get(Calendar.YEAR);
|
||||
final int month = c.get(Calendar.MONTH) + 1;
|
||||
final int day = c.get(Calendar.DAY_OF_MONTH);
|
||||
final int hour = c.get(Calendar.HOUR);
|
||||
final int mins = c.get(Calendar.MINUTE);
|
||||
|
||||
_registrationEnds = year + "-" + month + "-" + day + " " + hour + (mins < 10 ? ":0" : ":") + mins;
|
||||
}
|
||||
|
||||
public static void launchSiege()
|
||||
{
|
||||
_nextSiege.cancel(false);
|
||||
ThreadPoolManager.getInstance().executeGeneral(new SiegeStart());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endSiege()
|
||||
{
|
||||
if (_siegeEnd != null)
|
||||
{
|
||||
_siegeEnd.cancel(false);
|
||||
}
|
||||
ThreadPoolManager.getInstance().executeGeneral(new SiegeEnd(null));
|
||||
}
|
||||
|
||||
public static void updateAdminDate(long date)
|
||||
{
|
||||
if (_rainbow == null)
|
||||
{
|
||||
_rainbow = CHSiegeManager.getInstance().getSiegableHall(RAINBOW_SPRINGS);
|
||||
}
|
||||
|
||||
_rainbow.setNextSiegeDate(date);
|
||||
if (_nextSiege != null)
|
||||
{
|
||||
_nextSiege.cancel(true);
|
||||
}
|
||||
date -= 3600000;
|
||||
setRegistrationEndString(date);
|
||||
_nextSiege = ThreadPoolManager.getInstance().scheduleGeneral(new SetFinalAttackers(), _rainbow.getNextSiegeTime());
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new RainbowSpringsChateau();
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
<html><body>Caretaker:<br>
|
||||
Is everyone ready? Well, let's get moving! Whoever's late doesn't deserve to enjoy the game!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Enter the arena.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must follow the rules to play the game. Entry denied!<br>
|
||||
(1) Are there more than 5 in the party?<br>
|
||||
(2) Is the applicant the Clan Leader?<br>
|
||||
(3) Does the party include non-clan members?<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Caretaker:<br>
|
||||
The arena is closed at this time. Have you applied to participate in the game?
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the rules in order to participate in the game.<br>
|
||||
Requirements for Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br><br>
|
||||
The Clan Leader must be the one to apply for entry to the game.<br>
|
||||
Entry denied!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the following rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br><br>
|
||||
You need more members in your party.<br>
|
||||
Entry denied!<br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the following rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br><br>
|
||||
Your Clan Leader must apply as the party leader.<br>
|
||||
Entry denied!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br>
|
||||
Entry denied!<br>
|
||||
You have a non-clan member in your midst.<br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the following rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font>
|
||||
Entry denied!<br><br>
|
||||
You need at least five people in order to play the game... Why don't you contact some friends?<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the following rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br>
|
||||
Entry denied!<br>
|
||||
You're not a member of a clan.<br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the following rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br>
|
||||
Entry denied!<br>
|
||||
You're an ambitious one! One may own only one Clan Hall!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br><br>
|
||||
You must be a Clan Leader above Clan level 3 in order to apply.<br>
|
||||
Entry denied!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the following rules in order to participate in the game.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br>
|
||||
Entry denied!<br>
|
||||
Read the rules again.<br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Caretaker:<br>
|
||||
You must abide by the following rules in order to participate in the game. It appears that you don't meet the requirements.<br>
|
||||
Rules of Participation: <font color="LEVEL">A party of more than five clan members with a Clan Leader.</font><br>
|
||||
Entry denied!<br>
|
||||
Let's see... You're already registered.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Try to enter again.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,6 @@
|
||||
<html><body>Caretaker:<br>
|
||||
To participate in the game, you must abide by the rules. I'm afraid that I must deny your entry because you do not meet the following requirement:<br>
|
||||
Participation - <font color="LEVEL">You must have a party of at least 5 clan members with a clan leader as the leader of the party.</font><br><br>
|
||||
Have you registered for the game?<br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Attempt re-entry.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,6 @@
|
||||
<html><body>Entrance Manager:<br>
|
||||
To participate in the game, you must abide by the rules. I'm afraid that I must deny your entry because you do not meet the following requirement:<br>
|
||||
Participation - <font color="LEVEL">You must have a party of at least 5 clan members with a clan leader as the leader of the party.</font><br><br>
|
||||
I'm sorry, but your name seems to have been removed from the participants' list. Apparently you didn't have enough cards to register.<br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau portToArena">Attempt re-entry.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,9 @@
|
||||
<html><body>Messenger Yetti:<br>
|
||||
Pettite~ the transparent and energetic building behind me is <font color="LEVEL">Rainbow Spring</font>. Not my type, but very high class nonetheless. It's a place so nice, it's simply overlooked by ignorant adventurers. The winner gets ultimate bragging rights.<br>
|
||||
The last winner was <font color="LEVEL">%owner%</font>, challenge him if you think you can defeat a clan!<br><br>
|
||||
Registration finished at: <font color="LEVEL">%time%</font><br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti002.htm">Hideout battle game instruction</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau register">Hideout battle game registration</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti015.htm">Cancel registration</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti018.htm">Get a refund during game</Button>
|
||||
</body></html>
|
@@ -0,0 +1,8 @@
|
||||
<html><body>Messenger Yetti:<br>
|
||||
Pettite~ the transparent and lively building behind me is called <font color="LEVEL">Rainbow Spring</font>. It's not your ordinary hideout. You won't see a horde of peasants spilling blood for it. This one is special. Very high class...<br>
|
||||
Registration finished at: <font color="LEVEL">%time%</font><br><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti002.htm">Hideout battle game instruction</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau register">Hideout battle game registration</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti015.htm">Cancel registration</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti018.htm">Get a refund during game</Button>
|
||||
</body></html>
|
@@ -0,0 +1,5 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
To register for a Clan Hall War, you must first go fishing in Goddard Territory and obtain Clan Hall War Decrees. They compare the number of decrees submitted and select the four finalists one hour before the game starts. Those selected determine the owner of the Clan Hall by playing the game.<br>
|
||||
Submit as many decrees as possible! There's only one opportunity for registration!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti003.htm">"How do I play the game?"</Button>
|
||||
</body></html>
|
@@ -0,0 +1,6 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
Have you ever played a high stakes event? If so, you'll understand quickly. Once you enter the arena, my good friend, the Game Coordinator, will provide instructions on how the game is played. He will then call out some words, which you must spell by breaking the treasure boxes in the four circles. Combine the letters you find into words, and take them to the Coordinator! You will then get an item for use in the game!<br>
|
||||
You can use this item against the Coordinator, depending on the situation. You may hit a jackpot or impede others, or sometimes my jerk friend...ehh... Well, you'll find out soon enough.<br>
|
||||
Oh, I almost forgot the most important thing! The only way to open the Treasure Boxes is by hitting them with your <font color="LEVEL">bare hands</font>. Don't forget!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau messenger_yetti004.htm">"How many people can participate in the game?"</Button>
|
||||
</body></html>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
It's not a game where you fight, but a game played for fun, so only like-minded people are allowed to participate. You need a fair amount of people... If you have more than five, it will work.<br>
|
||||
(You can participate if your party is composed of more than five members and your Clan level is 3 or above.)
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
It would be fun to play together... Grarr... Too bad.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
Grarr! I am sorry but there is a requirement to participate in the game. In order to apply, you must have Rainbow Springs Clan Hall War Decrees, and you can submit these only once. Players are ranked depending on the number of decrees submitted, so gather as many of them as you can.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
Your application was received. We plan to make an announcement one hour before the game starts as to whether you were successfully registered or not. Don't forget to check back.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
The Clan Leader has to come here himself in order to apply to participate in the game, or to cancel it.
|
||||
</body></html>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
You need many people to have a fun game. You need leaders and also players...<br>
|
||||
(You must be a Clan Leader of a Clan composed of more than five members and be above Clan level 3 in order to apply.)
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
You already own a Clan Hall. You're greedy! You not allowed to participate in the game!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
You're already registered. You can register only once per game! Grarr!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
Registration for the Clan Hall war game is finished, please try the next game. To participate in a game, you must apply one hour before the game starts.
|
||||
</body></html>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
Do you absolutely have to cancel? If you cancel your registration now, we can only return half the decrees you submitted to us.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau cancel">Cancel</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
Grarr! I can't find your name on the applicant list.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yeti:<br>
|
||||
Check back one hour before the game starts when the participating teams are selected in case of a cancellation.
|
||||
</body></html>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>Messenger Yetti:<br>
|
||||
The game is cancelled? Okay, so you get all the applications back.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau unregister">Receive it back</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yetti:<br>
|
||||
Pettite~ here is your application!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Messenger Yetti:<br>
|
||||
The returning application function is how you give back an application to a participant when the game is cancelled.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
I'm only authorized to talk with the clan leader.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>Yeti:<br>
|
||||
I cannot exchange any item with you!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
No data for this html.
|
||||
</body></html>
|
5
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/RainbowSpringsChateau/yeti_main.htm
vendored
Normal file
5
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/RainbowSpringsChateau/yeti_main.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
No data for this html<br>
|
||||
<edit var="passage" width = 60><br1>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest RainbowSpringsChateau enterText_ $passage">Register for Siege</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
That passage have been already used for your clan.
|
||||
</body></html>
|
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* 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 conquerablehalls.flagwar.BanditStronghold;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2ResidenceHallTeleportZone;
|
||||
|
||||
import conquerablehalls.flagwar.FlagWar;
|
||||
|
||||
/**
|
||||
* @author BiggBoss
|
||||
*/
|
||||
final class BanditStronghold extends FlagWar
|
||||
{
|
||||
static
|
||||
{
|
||||
ROYAL_FLAG = 35422;
|
||||
FLAG_RED = 35423;
|
||||
FLAG_YELLOW = 35424;
|
||||
FLAG_GREEN = 35425;
|
||||
FLAG_BLUE = 35426;
|
||||
FLAG_PURPLE = 35427;
|
||||
|
||||
ALLY_1 = 35428;
|
||||
ALLY_2 = 35429;
|
||||
ALLY_3 = 35430;
|
||||
ALLY_4 = 35431;
|
||||
ALLY_5 = 35432;
|
||||
|
||||
TELEPORT_1 = 35560;
|
||||
|
||||
MESSENGER = 35437;
|
||||
|
||||
OUTTER_DOORS_TO_OPEN[0] = 22170001;
|
||||
OUTTER_DOORS_TO_OPEN[1] = 22170002;
|
||||
|
||||
INNER_DOORS_TO_OPEN[0] = 22170003;
|
||||
INNER_DOORS_TO_OPEN[1] = 22170004;
|
||||
|
||||
FLAG_COORDS[0] = new Location(83699, -17468, -1774, 19048);
|
||||
FLAG_COORDS[1] = new Location(82053, -17060, -1784, 5432);
|
||||
FLAG_COORDS[2] = new Location(82142, -15528, -1799, 58792);
|
||||
FLAG_COORDS[3] = new Location(83544, -15266, -1770, 44976);
|
||||
FLAG_COORDS[4] = new Location(84609, -16041, -1769, 35816);
|
||||
FLAG_COORDS[5] = new Location(81981, -15708, -1858, 60392);
|
||||
FLAG_COORDS[6] = new Location(84375, -17060, -1860, 27712);
|
||||
|
||||
final Collection<L2ResidenceHallTeleportZone> zoneList = ZoneManager.getInstance().getAllZones(L2ResidenceHallTeleportZone.class);
|
||||
|
||||
for (L2ResidenceHallTeleportZone teleZone : zoneList)
|
||||
{
|
||||
if (teleZone.getResidenceId() != BANDIT_STRONGHOLD)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int id = teleZone.getResidenceZoneId();
|
||||
|
||||
if ((id < 0) || (id >= 6))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TELE_ZONES[id] = teleZone;
|
||||
}
|
||||
|
||||
QUEST_REWARD = 5009;
|
||||
CENTER = new Location(82882, -16280, -1894, 0);
|
||||
}
|
||||
|
||||
private BanditStronghold()
|
||||
{
|
||||
super(BanditStronghold.class.getSimpleName(), BANDIT_STRONGHOLD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlagHtml(int flag)
|
||||
{
|
||||
String result = null;
|
||||
|
||||
switch (flag)
|
||||
{
|
||||
case 35423:
|
||||
{
|
||||
result = "messenger_flag1.htm";
|
||||
break;
|
||||
}
|
||||
case 35424:
|
||||
{
|
||||
result = "messenger_flag2.htm";
|
||||
break;
|
||||
}
|
||||
case 35425:
|
||||
{
|
||||
result = "messenger_flag3.htm";
|
||||
break;
|
||||
}
|
||||
case 35426:
|
||||
{
|
||||
result = "messenger_flag4.htm";
|
||||
break;
|
||||
}
|
||||
case 35427:
|
||||
{
|
||||
result = "messenger_flag5.htm";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAllyHtml(int ally)
|
||||
{
|
||||
String result = null;
|
||||
|
||||
switch (ally)
|
||||
{
|
||||
case 35428:
|
||||
{
|
||||
result = "messenger_ally1result.htm";
|
||||
break;
|
||||
}
|
||||
case 35429:
|
||||
{
|
||||
result = "messenger_ally2result.htm";
|
||||
break;
|
||||
}
|
||||
case 35430:
|
||||
{
|
||||
result = "messenger_ally3result.htm";
|
||||
break;
|
||||
}
|
||||
case 35431:
|
||||
{
|
||||
result = "messenger_ally4result.htm";
|
||||
break;
|
||||
}
|
||||
case 35432:
|
||||
{
|
||||
result = "messenger_ally5result.htm";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new BanditStronghold();
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
Ol mahum berserkers live for the most appalling aspects of war. An alliance with them would be quite useful to you. They are superior examples of their kind, but their enthusiasm for battle often prevents their proper healing after injury. They are a challenge to handle but are worth the effort.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_allychoose.htm">Select another NPC.</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold select_clan_npc 35428">Form an alliance.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,2 @@
|
||||
<html><body>
|
||||
Ol mahum berserkers live for the most appalling aspects of war. An alliance with them would be quite useful to you. They are superior examples of their kind, but their enthusiasm for battle often prevents their proper healing after injury. They are a challenge to handle but are worth the effort.
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
The ol mahum patrol may not appear to be anything special, but he is a slippery foe. I have never seen one captured by a knight!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_allychoose.htm">Select another NPC.</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold select_clan_npc 35429">Form an alliance.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,2 @@
|
||||
<html><body>
|
||||
The ol mahum patrol may not appear to be anything special, but he is a slippery foe. I have never seen one captured by a knight!
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
The ol mahum prefects possess a powerful magic. They have been known to burn their enemies alive! Ah, yes, the infamous Aura Burn! They are also masters of their staffs, and are strong enough to withstand attack by swords or clubs. Their only weakness is a susceptibility to magic spells...<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_allychoose.htm">Select another NPC.</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold select_clan_npc 35430">Form an alliance.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
The ol mahum prefects possess a powerful magic. They have been known to burn their enemies alive! Ah, yes, the infamous Aura Burn! They are also masters of their staffs, and are strong enough to withstand attack by swords or clubs. Their only weakness is a susceptibility to magic spells...
|
||||
</body></html>
|
@@ -0,0 +1 @@
|
||||
<html><body>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Let me tell you what my opinion is regarding the Oel Mahum Clerics... Ah, even Oel Mahums have a god they worship. It is not the same god called Ein... something that you guys believe in. But, having a god for themselves won't change their natural temperament, will it? They would rather kill than eat. Whenever they get into a fight, they fret themselves to death while trying to blow their enemies' heads off. If an oel mahum feels threatened he will not hesitate to run away and heal himself.... They are the kind of people who always leave a bad taste in your mouth.
|
||||
</body></html>
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
Ol mahum thieves are amusing little fellows. Shorter than the average ol mahum, they are exceptionally lithe. If they think they have the advantage, they will attack a target. But if they feel threatened they will evade direct conflict with the enemy while using a unique method to bind his legs.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_allychoose.htm">Select another NPC.</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold select_clan_npc 35432">Form an alliance.</Button>
|
||||
</body></html>
|
@@ -0,0 +1,2 @@
|
||||
<html><body>
|
||||
Ol mahum thieves are amusing little fellows. Shorter than the average ol mahum, they are exceptionally lithe. If they think they have the advantage, they will attack a target. But if they feel threatened they will evade direct conflict with the enemy while using a unique strategy to bind his legs.
|
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
This siege requires that you ally with an ol mahum warrior for battle. All five of these have good reputations. Now choose!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_ally1choose.htm">ol mahum berserker</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_ally2choose.htm">ol mahum patrol </Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_ally3choose.htm">ol mahum prefect</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_ally4choose.htm">ol mahum cleric</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold messenger_ally5choose.htm">ol mahum thief</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
You are too late! Five clans have already registered. Better luck next time!
|
||||
</body></html>
|
@@ -0,0 +1,2 @@
|
||||
<html><body>
|
||||
Haven't you learned anything? Surely you don't think you can just walk away from our agreement! See you on the battlefield!
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Ah, yes! Here is your registration! You are all set. Don't be late!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
What was the name of your clan again? What is this? You are not even registered for this siege! Do you think that you are above the rules? Or perhaps you are just an idiot!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Oops, sorry, but your clan is already fully manned. 18 have already been registered! You are a privateer, aren't you?
|
||||
</body></html>
|
@@ -0,0 +1,2 @@
|
||||
<html><body>
|
||||
Oh, sir, a master such as yourself need not prove himself! Leave such matters to the youngsters! Enjoy the show!
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
It is very important that you understand that our team fights under the red flag. We will rally there and start the battle! Don't forget!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
It is very important that you understand that our team fights under the yellow flag. We will rally there and start the battle! Don't forget!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Our team fights under the green flag. We will rally there and start the battle! Don't forget!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
It is very important that you understand that our team fights under the blue flag. We will rally there and start the battle! Don't forget!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
It is very important that you understand that our team fights under the purple flag. We will rally there and start the battle! Don't forget!
|
||||
</body></html>
|
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
I'm just here to make sure the siege comes off without a hitch. I'll try to stay out of the way. Knock yourselves out!<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold register_clan wQuest">Register a clan (must be a clan leader)</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold agit_oel_mahum_messenger_6.htm">Select a Clan NPC (must be a clan leader)</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold view_clan_npc">View a Clan NPC (any clan member)</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStrongHold register_member">Register as a clan member. (Any clan member)</Button><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest Q00504_CompetitionForTheBanditStronghold">Quest</Button>
|
||||
</body></html>
|
@@ -0,0 +1,2 @@
|
||||
<html><body>
|
||||
Your clan leader has not yet chosen who he will ally himself with! Go and tell him that his decision is required!
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
You must be a clan member to register one. Your business is elsewhere! Go to it!
|
||||
</body></html>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>
|
||||
So you want to register for free, eh? There is a way... You can take a test if you can't afford the fee...<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest Q00504_CompetitionfortheBanditStronghold">"I want to take the test."</Button>
|
||||
</body></html>
|
@@ -0,0 +1,7 @@
|
||||
<html><body>Messenger:<br>
|
||||
What do you want from me? I don't like that strangers can walk around on this land as they like.<br>
|
||||
Whew~, but the stronghold is under the rule of <font color="00FFFF">%clanName%</font>clans at present...<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest Q00504_CompetitionfortheBanditStronghold">Clan Hall War Registration Qualification Test</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStronghold register_clan">Register for Clan Hall War</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BanditStronghold view_attacker_list">View Clans Participating in Tournaments</Button>
|
||||
</body></html>
|
@@ -0,0 +1,2 @@
|
||||
<html><body>
|
||||
What's that, you want to register without qualifying? Well, maybe we can work something out... 200,000 adena might get this conversation started...<br>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>
|
||||
What a nerve! And not even a clan leader! When someone tries something like that in the ol mahum troops we eat him for dinner!<br>
|
||||
(This option is only available to a clan leader.)
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
You clan leader is dithering on his selection of allies! Go and tell him to hurry up and decide!
|
||||
</body></html>
|
@@ -0,0 +1,10 @@
|
||||
<html><body>Messenger:<br>
|
||||
If you're having second thoughts, now's the time to back out.<br>
|
||||
The following Clans are participating in preliminaries:<br>
|
||||
=== Clans Registered for the Preliminary Contest ===<br>
|
||||
1. <FONT color=00ffff>%clan1%</FONT> (Number of Participants : <FONT color=00ffff>%clanMem1%</FONT>)<br>
|
||||
2. <FONT color=00ffff>%clan2%</FONT> (Number of Participants : <FONT color=00ffff>%clanMem2%</FONT>)<br>
|
||||
3. <FONT color=00ffff>%clan3%</FONT> (Number of Participants : <FONT color=00ffff>%clanMem3%</FONT>)<br>
|
||||
4. <FONT color=00ffff>%clan4%</FONT> (Number of Participants : <FONT color=00ffff>%clanMem4%</FONT>)<br>
|
||||
5. <FONT color=00ffff>%clan5%</FONT> (Number of Participants : <FONT color=00ffff>%clanMem5%</FONT>)
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
You are too late, registration is over. Maybe next time you should get here earlier!
|
||||
</body></html>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>Messenger:<br>
|
||||
I thought I made it clear that registration does not begin until one hour before the next siege at %nextSiege%.
|
||||
</body></html>
|
||||
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
You will be teleporter to the battlefield in 30 seconds.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
You cannot get teleported to the battlefield yet!
|
||||
</body></html>
|
891
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/flagwar/FlagWar.java
vendored
Normal file
891
L2J_Mobius_Test/dist/game/data/scripts/conquerablehalls/flagwar/FlagWar.java
vendored
Normal file
@@ -0,0 +1,891 @@
|
||||
/*
|
||||
* 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 conquerablehalls.flagwar;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.ai.L2SpecialSiegeGuardAI;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.enums.SiegeClanType;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2ClanMember;
|
||||
import com.l2jmobius.gameserver.model.L2SiegeClan;
|
||||
import com.l2jmobius.gameserver.model.L2Spawn;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.ClanHallSiegeEngine;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.SiegeStatus;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2ResidenceHallTeleportZone;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author BiggBoss
|
||||
*/
|
||||
public abstract class FlagWar extends ClanHallSiegeEngine
|
||||
{
|
||||
private static final String SQL_LOAD_ATTACKERS = "SELECT * FROM siegable_hall_flagwar_attackers WHERE hall_id = ?";
|
||||
private static final String SQL_SAVE_ATTACKER = "INSERT INTO siegable_hall_flagwar_attackers_members VALUES (?,?,?)";
|
||||
private static final String SQL_LOAD_MEMEBERS = "SELECT object_id FROM siegable_hall_flagwar_attackers_members WHERE clan_id = ?";
|
||||
private static final String SQL_SAVE_CLAN = "INSERT INTO siegable_hall_flagwar_attackers VALUES(?,?,?,?)";
|
||||
private static final String SQL_SAVE_NPC = "UPDATE siegable_hall_flagwar_attackers SET npc = ? WHERE clan_id = ?";
|
||||
private static final String SQL_CLEAR_CLAN = "DELETE FROM siegable_hall_flagwar_attackers WHERE hall_id = ?";
|
||||
private static final String SQL_CLEAR_CLAN_ATTACKERS = "DELETE FROM siegable_hall_flagwar_attackers_members WHERE hall_id = ?";
|
||||
|
||||
protected static int ROYAL_FLAG;
|
||||
protected static int FLAG_RED;
|
||||
protected static int FLAG_YELLOW;
|
||||
protected static int FLAG_GREEN;
|
||||
protected static int FLAG_BLUE;
|
||||
protected static int FLAG_PURPLE;
|
||||
|
||||
protected static int ALLY_1;
|
||||
protected static int ALLY_2;
|
||||
protected static int ALLY_3;
|
||||
protected static int ALLY_4;
|
||||
protected static int ALLY_5;
|
||||
|
||||
protected static int TELEPORT_1;
|
||||
|
||||
protected static int MESSENGER;
|
||||
|
||||
protected static int[] OUTTER_DOORS_TO_OPEN = new int[2];
|
||||
protected static int[] INNER_DOORS_TO_OPEN = new int[2];
|
||||
protected static Location[] FLAG_COORDS = new Location[7];
|
||||
|
||||
protected static L2ResidenceHallTeleportZone[] TELE_ZONES = new L2ResidenceHallTeleportZone[6];
|
||||
|
||||
protected static int QUEST_REWARD;
|
||||
|
||||
protected static Location CENTER;
|
||||
|
||||
private final Map<Integer, ClanData> _data = new HashMap<>(6);
|
||||
private L2Clan _winner;
|
||||
private boolean _firstPhase;
|
||||
|
||||
public FlagWar(String name, int hallId)
|
||||
{
|
||||
super(name, "conquerablehalls/flagwar", hallId);
|
||||
addStartNpc(MESSENGER);
|
||||
addFirstTalkId(MESSENGER);
|
||||
addTalkId(MESSENGER);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
addFirstTalkId(TELEPORT_1 + i);
|
||||
}
|
||||
|
||||
addKillId(ALLY_1);
|
||||
addKillId(ALLY_2);
|
||||
addKillId(ALLY_3);
|
||||
addKillId(ALLY_4);
|
||||
addKillId(ALLY_5);
|
||||
|
||||
addSpawnId(ALLY_1);
|
||||
addSpawnId(ALLY_2);
|
||||
addSpawnId(ALLY_3);
|
||||
addSpawnId(ALLY_4);
|
||||
addSpawnId(ALLY_5);
|
||||
|
||||
// If siege ends w/ more than 1 flag alive, winner is old owner
|
||||
_winner = ClanTable.getInstance().getClan(_hall.getOwnerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String html = null;
|
||||
if (npc.getId() == MESSENGER)
|
||||
{
|
||||
if (!checkIsAttacker(player.getClan()))
|
||||
{
|
||||
final L2Clan clan = ClanTable.getInstance().getClan(_hall.getOwnerId());
|
||||
String content = getHtm(player.getHtmlPrefix(), "messenger_initial.htm");
|
||||
content = content.replaceAll("%clanName%", (clan == null) ? "no owner" : clan.getName());
|
||||
content = content.replaceAll("%objectId%", String.valueOf(npc.getObjectId()));
|
||||
html = content;
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "messenger_initial.htm";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final int index = npc.getId() - TELEPORT_1;
|
||||
if ((index == 0) && _firstPhase)
|
||||
{
|
||||
html = "teleporter_notyet.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
TELE_ZONES[index].checkTeleporTask();
|
||||
html = "teleporter.htm";
|
||||
}
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String html = event;
|
||||
final L2Clan clan = player.getClan();
|
||||
|
||||
if (event.startsWith("register_clan")) // Register the clan for the siege
|
||||
{
|
||||
if (!_hall.isRegistering())
|
||||
{
|
||||
if (_hall.isInSiege())
|
||||
{
|
||||
html = "messenger_registrationpassed.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
sendRegistrationPageDate(player);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if ((clan == null) || !player.isClanLeader())
|
||||
{
|
||||
html = "messenger_notclannotleader.htm";
|
||||
}
|
||||
else if (getAttackers().size() >= 5)
|
||||
{
|
||||
html = "messenger_attackersqueuefull.htm";
|
||||
}
|
||||
else if (checkIsAttacker(clan))
|
||||
{
|
||||
html = "messenger_clanalreadyregistered.htm";
|
||||
}
|
||||
else if (_hall.getOwnerId() == clan.getId())
|
||||
{
|
||||
html = "messenger_curownermessage.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
final String[] arg = event.split(" ");
|
||||
if (arg.length >= 2)
|
||||
{
|
||||
// Register passing the quest
|
||||
if (arg[1].equals("wQuest"))
|
||||
{
|
||||
if (player.destroyItemByItemId(_hall.getName() + " Siege", QUEST_REWARD, 1, npc, false)) // Quest passed
|
||||
{
|
||||
registerClan(clan);
|
||||
html = getFlagHtml(_data.get(clan.getId()).flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "messenger_noquest.htm";
|
||||
}
|
||||
}
|
||||
// Register paying the fee
|
||||
else if (arg[1].equals("wFee") && canPayRegistration())
|
||||
{
|
||||
if (player.reduceAdena(getName() + " Siege", 200000, npc, false)) // Fee payed
|
||||
{
|
||||
registerClan(clan);
|
||||
html = getFlagHtml(_data.get(clan.getId()).flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "messenger_nomoney.htm";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Select the flag to defend
|
||||
else if (event.startsWith("select_clan_npc"))
|
||||
{
|
||||
if (!player.isClanLeader())
|
||||
{
|
||||
html = "messenger_onlyleaderselectally.htm";
|
||||
}
|
||||
else if (!_data.containsKey(clan.getId()))
|
||||
{
|
||||
html = "messenger_clannotregistered.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
final String[] var = event.split(" ");
|
||||
if (var.length >= 2)
|
||||
{
|
||||
int id = 0;
|
||||
try
|
||||
{
|
||||
id = Integer.parseInt(var[1]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + "->select_clan_npc->Wrong mahum warrior id: " + var[1]);
|
||||
}
|
||||
if ((id > 0) && ((html = getAllyHtml(id)) != null))
|
||||
{
|
||||
_data.get(clan.getId()).npc = id;
|
||||
saveNpc(id, clan.getId());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning(getName() + " Siege: Not enough parameters to save clan npc for clan: " + clan.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// View (and change ? ) the current selected mahum warrior
|
||||
else if (event.startsWith("view_clan_npc"))
|
||||
{
|
||||
ClanData cd = null;
|
||||
if (clan == null)
|
||||
{
|
||||
html = "messenger_clannotregistered.htm";
|
||||
}
|
||||
else if ((cd = _data.get(clan.getId())) == null)
|
||||
{
|
||||
html = "messenger_notclannotleader.htm";
|
||||
}
|
||||
else if (cd.npc == 0)
|
||||
{
|
||||
html = "messenger_leaderdidnotchooseyet.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
html = getAllyHtml(cd.npc);
|
||||
}
|
||||
}
|
||||
// Register a clan member for the fight
|
||||
else if (event.equals("register_member"))
|
||||
{
|
||||
if (clan == null)
|
||||
{
|
||||
html = "messenger_clannotregistered.htm";
|
||||
}
|
||||
else if (!_hall.isRegistering())
|
||||
{
|
||||
html = "messenger_registrationpassed.htm";
|
||||
}
|
||||
else if (!_data.containsKey(clan.getId()))
|
||||
{
|
||||
html = "messenger_notclannotleader.htm";
|
||||
}
|
||||
else if (_data.get(clan.getId()).players.size() >= 18)
|
||||
{
|
||||
html = "messenger_clanqueuefull.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
final ClanData data = _data.get(clan.getId());
|
||||
data.players.add(player.getObjectId());
|
||||
saveMember(clan.getId(), player.getObjectId());
|
||||
if (data.npc == 0)
|
||||
{
|
||||
html = "messenger_leaderdidnotchooseyet.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "messenger_clanregistered.htm";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Show cur attacker list
|
||||
else if (event.equals("view_attacker_list"))
|
||||
{
|
||||
if (_hall.isRegistering())
|
||||
{
|
||||
sendRegistrationPageDate(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
html = getHtm(player.getHtmlPrefix(), "messenger_registeredclans.htm");
|
||||
int i = 0;
|
||||
for (Entry<Integer, ClanData> clanData : _data.entrySet())
|
||||
{
|
||||
final L2Clan attacker = ClanTable.getInstance().getClan(clanData.getKey());
|
||||
if (attacker == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
html = html.replaceAll("%clan" + i + "%", clan.getName());
|
||||
html = html.replaceAll("%clanMem" + i + "%", String.valueOf(clanData.getValue().players.size()));
|
||||
i++;
|
||||
}
|
||||
if (_data.size() < 5)
|
||||
{
|
||||
for (int c = _data.size(); c < 5; c++)
|
||||
{
|
||||
html = html.replaceAll("%clan" + c + "%", "Empty pos. ");
|
||||
html = html.replaceAll("%clanMem" + c + "%", "Empty pos. ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
||||
{
|
||||
if (_hall.isInSiege())
|
||||
{
|
||||
final int npcId = npc.getId();
|
||||
for (int keys : _data.keySet())
|
||||
{
|
||||
if (_data.get(keys).npc == npcId)
|
||||
{
|
||||
removeParticipant(keys, true);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
// TODO: Zoey76: previous bad implementation.
|
||||
// Converting map.keySet() to List and map.values() to List doesn't ensure that
|
||||
// first element in the key's List correspond to the first element in the values' List
|
||||
// That's the reason that values aren't copied to a List, instead using _data.get(clanIds.get(0))
|
||||
final List<Integer> clanIds = new ArrayList<>(_data.keySet());
|
||||
if (_firstPhase)
|
||||
{
|
||||
// Siege ends if just 1 flag is alive
|
||||
// Hall was free before battle or owner didn't set the ally npc
|
||||
if (((clanIds.size() == 1) && (_hall.getOwnerId() <= 0)) || (_data.get(clanIds.get(0)).npc == 0))
|
||||
{
|
||||
_missionAccomplished = true;
|
||||
// _winner = ClanTable.getInstance().getClan(_data.keySet()[0]);
|
||||
// removeParticipant(_data.keySet()[0], false);
|
||||
cancelSiegeTask();
|
||||
endSiege();
|
||||
}
|
||||
else if ((_data.size() == 2) && (_hall.getOwnerId() > 0)) // Hall has defender (owner)
|
||||
{
|
||||
cancelSiegeTask(); // No time limit now
|
||||
_firstPhase = false;
|
||||
_hall.getSiegeZone().setIsActive(false);
|
||||
for (int doorId : INNER_DOORS_TO_OPEN)
|
||||
{
|
||||
_hall.openCloseDoor(doorId, true);
|
||||
}
|
||||
|
||||
for (ClanData data : _data.values())
|
||||
{
|
||||
doUnSpawns(data);
|
||||
}
|
||||
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(() ->
|
||||
{
|
||||
for (int doorId : INNER_DOORS_TO_OPEN)
|
||||
{
|
||||
_hall.openCloseDoor(doorId, false);
|
||||
}
|
||||
|
||||
for (Entry<Integer, ClanData> e : _data.entrySet())
|
||||
{
|
||||
doSpawns(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
_hall.getSiegeZone().setIsActive(true);
|
||||
}, 300000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_missionAccomplished = true;
|
||||
_winner = ClanTable.getInstance().getClan(clanIds.get(0));
|
||||
removeParticipant(clanIds.get(0), false);
|
||||
endSiege();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, CENTER);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Clan getWinner()
|
||||
{
|
||||
return _winner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareOwner()
|
||||
{
|
||||
if (_hall.getOwnerId() > 0)
|
||||
{
|
||||
registerClan(ClanTable.getInstance().getClan(_hall.getOwnerId()));
|
||||
}
|
||||
|
||||
_hall.banishForeigners();
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.THE_REGISTRATION_TERM_FOR_S1_HAS_ENDED);
|
||||
msg.addString(getName());
|
||||
Broadcast.toAllOnlinePlayers(msg);
|
||||
_hall.updateSiegeStatus(SiegeStatus.WAITING_BATTLE);
|
||||
|
||||
_siegeTask = ThreadPoolManager.getInstance().scheduleGeneral(new SiegeStarts(), 3600000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSiege()
|
||||
{
|
||||
if (getAttackers().size() < 2)
|
||||
{
|
||||
onSiegeEnds();
|
||||
getAttackers().clear();
|
||||
_hall.updateNextSiege();
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_SIEGE_OF_S1_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_INTEREST);
|
||||
sm.addString(_hall.getName());
|
||||
Broadcast.toAllOnlinePlayers(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
// Open doors for challengers
|
||||
for (int door : OUTTER_DOORS_TO_OPEN)
|
||||
{
|
||||
_hall.openCloseDoor(door, true);
|
||||
}
|
||||
|
||||
// Teleport owner inside
|
||||
if (_hall.getOwnerId() > 0)
|
||||
{
|
||||
final L2Clan owner = ClanTable.getInstance().getClan(_hall.getOwnerId());
|
||||
final Location loc = _hall.getZone().getSpawns().get(0); // Owner restart point
|
||||
for (L2ClanMember pc : owner.getMembers())
|
||||
{
|
||||
if (pc != null)
|
||||
{
|
||||
final L2PcInstance player = pc.getPlayerInstance();
|
||||
if ((player != null) && player.isOnline())
|
||||
{
|
||||
player.teleToLocation(loc, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Schedule open doors closement and siege start in 2 minutes
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new CloseOutterDoorsTask(), 300000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runnable class to schedule doors closing and siege start.
|
||||
* @author Zoey76
|
||||
*/
|
||||
private class CloseOutterDoorsTask implements Runnable
|
||||
{
|
||||
public CloseOutterDoorsTask()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (int door : OUTTER_DOORS_TO_OPEN)
|
||||
{
|
||||
_hall.openCloseDoor(door, false);
|
||||
}
|
||||
|
||||
_hall.getZone().banishNonSiegeParticipants();
|
||||
_hall.getSiege().startSiege();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSiegeStarts()
|
||||
{
|
||||
for (Entry<Integer, ClanData> clan : _data.entrySet())
|
||||
{
|
||||
// Spawns challengers flags and npcs
|
||||
try
|
||||
{
|
||||
final ClanData data = clan.getValue();
|
||||
doSpawns(clan.getKey(), data);
|
||||
fillPlayerList(data);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
endSiege();
|
||||
_log.warning(getName() + ": Problems in siege initialization!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endSiege()
|
||||
{
|
||||
if (_hall.getOwnerId() > 0)
|
||||
{
|
||||
final L2Clan clan = ClanTable.getInstance().getClan(_hall.getOwnerId());
|
||||
clan.setHideoutId(0);
|
||||
_hall.free();
|
||||
}
|
||||
super.endSiege();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSiegeEnds()
|
||||
{
|
||||
if (_data.size() > 0)
|
||||
{
|
||||
for (int clanId : _data.keySet())
|
||||
{
|
||||
if (_hall.getOwnerId() == clanId)
|
||||
{
|
||||
removeParticipant(clanId, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeParticipant(clanId, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
clearTables();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Location getInnerSpawnLoc(L2PcInstance player)
|
||||
{
|
||||
Location loc = null;
|
||||
if (player.getClanId() == _hall.getOwnerId())
|
||||
{
|
||||
loc = _hall.getZone().getSpawns().get(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
final ClanData cd = _data.get(player.getClanId());
|
||||
if (cd != null)
|
||||
{
|
||||
final int index = cd.flag - FLAG_RED;
|
||||
if ((index >= 0) && (index <= 4))
|
||||
{
|
||||
loc = _hall.getZone().getChallengerSpawns().get(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
}
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean canPlantFlag()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean doorIsAutoAttackable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private void doSpawns(int clanId, ClanData data)
|
||||
{
|
||||
try
|
||||
{
|
||||
int index = 0;
|
||||
if (_firstPhase)
|
||||
{
|
||||
index = data.flag - FLAG_RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = clanId == _hall.getOwnerId() ? 5 : 6;
|
||||
}
|
||||
final Location loc = FLAG_COORDS[index];
|
||||
|
||||
data.flagInstance = new L2Spawn(data.flag);
|
||||
data.flagInstance.setLocation(loc);
|
||||
data.flagInstance.setRespawnDelay(10000);
|
||||
data.flagInstance.setAmount(1);
|
||||
data.flagInstance.init();
|
||||
|
||||
data.warrior = new L2Spawn(data.npc);
|
||||
data.warrior.setLocation(loc);
|
||||
data.warrior.setRespawnDelay(10000);
|
||||
data.warrior.setAmount(1);
|
||||
data.warrior.init();
|
||||
((L2SpecialSiegeGuardAI) data.warrior.getLastSpawn().getAI()).getAlly().addAll(data.players);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ": Could not make clan spawns: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void fillPlayerList(ClanData data)
|
||||
{
|
||||
for (int objId : data.players)
|
||||
{
|
||||
final L2PcInstance plr = L2World.getInstance().getPlayer(objId);
|
||||
if (plr != null)
|
||||
{
|
||||
data.playersInstance.add(plr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void registerClan(L2Clan clan)
|
||||
{
|
||||
final int clanId = clan.getId();
|
||||
|
||||
final L2SiegeClan sc = new L2SiegeClan(clanId, SiegeClanType.ATTACKER);
|
||||
getAttackers().put(clanId, sc);
|
||||
|
||||
final ClanData data = new ClanData();
|
||||
data.flag = ROYAL_FLAG + _data.size();
|
||||
data.players.add(clan.getLeaderId());
|
||||
_data.put(clanId, data);
|
||||
|
||||
saveClan(clanId, data.flag);
|
||||
saveMember(clanId, clan.getLeaderId());
|
||||
}
|
||||
|
||||
private final void doUnSpawns(ClanData data)
|
||||
{
|
||||
if (data.flagInstance != null)
|
||||
{
|
||||
data.flagInstance.stopRespawn();
|
||||
data.flagInstance.getLastSpawn().deleteMe();
|
||||
}
|
||||
if (data.warrior != null)
|
||||
{
|
||||
data.warrior.stopRespawn();
|
||||
data.warrior.getLastSpawn().deleteMe();
|
||||
}
|
||||
}
|
||||
|
||||
private final void removeParticipant(int clanId, boolean teleport)
|
||||
{
|
||||
final ClanData dat = _data.remove(clanId);
|
||||
|
||||
if (dat != null)
|
||||
{
|
||||
// Destroy clan flag
|
||||
if (dat.flagInstance != null)
|
||||
{
|
||||
dat.flagInstance.stopRespawn();
|
||||
if (dat.flagInstance.getLastSpawn() != null)
|
||||
{
|
||||
dat.flagInstance.getLastSpawn().deleteMe();
|
||||
}
|
||||
}
|
||||
|
||||
if (dat.warrior != null)
|
||||
{
|
||||
// Destroy clan warrior
|
||||
dat.warrior.stopRespawn();
|
||||
if (dat.warrior.getLastSpawn() != null)
|
||||
{
|
||||
dat.warrior.getLastSpawn().deleteMe();
|
||||
}
|
||||
}
|
||||
|
||||
dat.players.clear();
|
||||
|
||||
if (teleport)
|
||||
{
|
||||
// Teleport players outside
|
||||
for (L2PcInstance pc : dat.playersInstance)
|
||||
{
|
||||
if (pc != null)
|
||||
{
|
||||
pc.teleToLocation(TeleportWhereType.TOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dat.playersInstance.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPayRegistration()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendRegistrationPageDate(L2PcInstance player)
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setHtml(getHtm(player.getHtmlPrefix(), "siege_date.htm"));
|
||||
msg.replace("%nextSiege%", _hall.getSiegeDate().getTime().toString());
|
||||
player.sendPacket(msg);
|
||||
}
|
||||
|
||||
public abstract String getFlagHtml(int flag);
|
||||
|
||||
public abstract String getAllyHtml(int ally);
|
||||
|
||||
@Override
|
||||
public final void loadAttackers()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_LOAD_ATTACKERS))
|
||||
{
|
||||
ps.setInt(1, _hall.getId());
|
||||
try (ResultSet rset = ps.executeQuery())
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
final int clanId = rset.getInt("clan_id");
|
||||
|
||||
if (ClanTable.getInstance().getClan(clanId) == null)
|
||||
{
|
||||
_log.warning(getName() + ": Loaded an unexistent clan as attacker! Clan ID: " + clanId);
|
||||
continue;
|
||||
}
|
||||
|
||||
final ClanData data = new ClanData();
|
||||
data.flag = rset.getInt("flag");
|
||||
data.npc = rset.getInt("npc");
|
||||
|
||||
_data.put(clanId, data);
|
||||
loadAttackerMembers(clanId);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".loadAttackers()->" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final void loadAttackerMembers(int clanId)
|
||||
{
|
||||
final List<Integer> listInstance = _data.get(clanId).players;
|
||||
if (listInstance == null)
|
||||
{
|
||||
_log.warning(getName() + ": Tried to load unregistered clan with ID " + clanId);
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_LOAD_MEMEBERS))
|
||||
{
|
||||
ps.setInt(1, clanId);
|
||||
try (ResultSet rset = ps.executeQuery())
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
listInstance.add(rset.getInt("object_id"));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".loadAttackerMembers()->" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final void saveClan(int clanId, int flag)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_SAVE_CLAN))
|
||||
{
|
||||
ps.setInt(1, _hall.getId());
|
||||
ps.setInt(2, flag);
|
||||
ps.setInt(3, 0);
|
||||
ps.setInt(4, clanId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".saveClan()->" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final void saveNpc(int npc, int clanId)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_SAVE_NPC))
|
||||
{
|
||||
ps.setInt(1, npc);
|
||||
ps.setInt(2, clanId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".saveNpc()->" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final void saveMember(int clanId, int objectId)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_SAVE_ATTACKER))
|
||||
{
|
||||
ps.setInt(1, _hall.getId());
|
||||
ps.setInt(2, clanId);
|
||||
ps.setInt(3, objectId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".saveMember()->" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void clearTables()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(SQL_CLEAR_CLAN);
|
||||
PreparedStatement ps2 = con.prepareStatement(SQL_CLEAR_CLAN_ATTACKERS))
|
||||
{
|
||||
ps1.setInt(1, _hall.getId());
|
||||
ps1.execute();
|
||||
|
||||
ps2.setInt(1, _hall.getId());
|
||||
ps2.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".clearTables()->" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class ClanData
|
||||
{
|
||||
int flag = 0;
|
||||
int npc = 0;
|
||||
final List<Integer> players = new ArrayList<>(18);
|
||||
final List<L2PcInstance> playersInstance = new ArrayList<>(18);
|
||||
L2Spawn warrior = null;
|
||||
L2Spawn flagInstance = null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* 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 conquerablehalls.flagwar.WildBeastReserve;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2ResidenceHallTeleportZone;
|
||||
|
||||
import conquerablehalls.flagwar.FlagWar;
|
||||
|
||||
/**
|
||||
* @author BiggBoss
|
||||
*/
|
||||
final class WildBeastReserve extends FlagWar
|
||||
{
|
||||
static
|
||||
{
|
||||
ROYAL_FLAG = 35606;
|
||||
FLAG_RED = 35607; // White flag
|
||||
FLAG_YELLOW = 35608; // Red flag
|
||||
FLAG_GREEN = 35609; // Blue flag
|
||||
FLAG_BLUE = 35610; // Green flag
|
||||
FLAG_PURPLE = 35611; // Black flag
|
||||
|
||||
ALLY_1 = 35618;
|
||||
ALLY_2 = 35619;
|
||||
ALLY_3 = 35620;
|
||||
ALLY_4 = 35621;
|
||||
ALLY_5 = 35622;
|
||||
|
||||
TELEPORT_1 = 35612;
|
||||
|
||||
MESSENGER = 35627;
|
||||
|
||||
FLAG_COORDS[0] = new Location(56963, -92211, -1303, 60611);
|
||||
FLAG_COORDS[1] = new Location(58090, -91641, -1303, 47274);
|
||||
FLAG_COORDS[2] = new Location(58908, -92556, -1303, 34450);
|
||||
FLAG_COORDS[3] = new Location(58336, -93600, -1303, 21100);
|
||||
FLAG_COORDS[4] = new Location(57152, -93360, -1303, 8400);
|
||||
FLAG_COORDS[5] = new Location(59116, -93251, -1302, 31000);
|
||||
FLAG_COORDS[6] = new Location(56432, -92864, -1303, 64000);
|
||||
|
||||
OUTTER_DOORS_TO_OPEN[0] = 21150003;
|
||||
OUTTER_DOORS_TO_OPEN[1] = 21150004;
|
||||
|
||||
INNER_DOORS_TO_OPEN[0] = 21150001;
|
||||
INNER_DOORS_TO_OPEN[1] = 21150002;
|
||||
|
||||
final Collection<L2ResidenceHallTeleportZone> zoneList = ZoneManager.getInstance().getAllZones(L2ResidenceHallTeleportZone.class);
|
||||
|
||||
for (L2ResidenceHallTeleportZone teleZone : zoneList)
|
||||
{
|
||||
if (teleZone.getResidenceId() != BEAST_FARM)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int id = teleZone.getResidenceZoneId();
|
||||
|
||||
if ((id < 0) || (id >= 6))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TELE_ZONES[id] = teleZone;
|
||||
}
|
||||
|
||||
QUEST_REWARD = 0;
|
||||
CENTER = new Location(57762, -92696, -1359, 0);
|
||||
}
|
||||
|
||||
private WildBeastReserve()
|
||||
{
|
||||
super(WildBeastReserve.class.getSimpleName(), BEAST_FARM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlagHtml(int flag)
|
||||
{
|
||||
String result = null;
|
||||
|
||||
switch (flag)
|
||||
{
|
||||
case 35607:
|
||||
{
|
||||
result = "messenger_flag1.htm";
|
||||
break;
|
||||
}
|
||||
case 35608:
|
||||
{
|
||||
result = "messenger_flag2.htm";
|
||||
break;
|
||||
}
|
||||
case 35609:
|
||||
{
|
||||
result = "messenger_flag3.htm";
|
||||
break;
|
||||
}
|
||||
case 35610:
|
||||
{
|
||||
result = "messenger_flag4.htm";
|
||||
break;
|
||||
}
|
||||
case 35611:
|
||||
{
|
||||
result = "messenger_flag5.htm";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAllyHtml(int ally)
|
||||
{
|
||||
String result = null;
|
||||
|
||||
switch (ally)
|
||||
{
|
||||
case 35618:
|
||||
{
|
||||
result = "messenger_ally1result.htm";
|
||||
break;
|
||||
}
|
||||
case 35619:
|
||||
{
|
||||
result = "messenger_ally2result.htm";
|
||||
break;
|
||||
}
|
||||
case 35620:
|
||||
{
|
||||
result = "messenger_ally3result.htm";
|
||||
break;
|
||||
}
|
||||
case 35621:
|
||||
{
|
||||
result = "messenger_ally4result.htm";
|
||||
break;
|
||||
}
|
||||
case 35622:
|
||||
{
|
||||
result = "messenger_ally5result.htm";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPayRegistration()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new WildBeastReserve();
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
As you probably guessed, Cougars are known for their bite! They're also much stronger than other beasts... They're worth taming, but if they get hungry, watch out! They fight tirelessly, with no thought to their own safety, or even survival! They require a very special type of handler...<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_allychoose.htm">"I want to choose another NPC."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve selet_npc 35618">"I want to form an alliance."</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Cougars are literally fighting machines, who only know how to rip, twist, destroy and kill! If you form an alliance with them, you'll have a mighty war machine at your disposal! They're far stronger than any other beast! But beware... They're so crazy that they stop at nothing! They'll go after the next enemy even when they're gravely injured! They're quite a challenge to handle...
|
||||
</body></html>
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
Buffaloes may seem slow, but they can run faster than the fastest bull! They're huge and resilient beasts...<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_allychoose.htm">"I want to choose another NPC."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve select_npc 35619">"I want to form an alliance."</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Buffaloes may appear to possess no special abilities, but they are great at running away! I assume you've witnessed these huge beasts stamping on the ground to make their enemies freeze on the spot? I've never seen that trick work on a Buffalo!
|
||||
</body></html>
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
Kookaburras are quite rare. They possess unusually long legs and brilliantly-colored feathers... They peck the enemy with their beaks and use a mysterious and extremely powerful magic. They don't respond well to beatings. The only reason I was able to capture them is their susceptibility to magic.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_allychoose.htm">"I want to choose another NPC."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve 35620">"I want to form an alliance."</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Kookaburras... How to describe them...? They're truly magical beasts! They burn their enemy with supernatural powers! What's it called?... Aura Burn, maybe? Occasionally, they'll peck at their enemy with their beaks! They're strong enough to withstand sword and stick attacks. One drawback, though... they're surprisingly susceptible to magic...
|
||||
</body></html>
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
Baby Buffalos are among the most fearsome beasts. It prefers fighting to food, and lives to break an enemy's head in battle. When it finds itself in danger, it retreats and heals itself with magic... But I must admit, it's not a very attractive beast.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_allychoose.htm">"I want to choose another NPC."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve select_npc 35621">"I want to form an alliance."</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
As for Baby Buffalos... They're truly the king of beasts, though certainly not the most attractive! They actually prefer fighting to food! They're capable of retreating from battle when injured to heal themselves...
|
||||
</body></html>
|
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
Baby Cougars may look cute, but they have sharp claws and are deadly fast! They're almost impossible to hit, and they have the unique ability to ensnare the enemy's legs on the rare occasion that they find themselves at a disadvantage in battle.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_allychoose.htm">"I want to choose another NPC."</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve select_npc 35622">"I want to form an alliance."</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Ah, the Baby Cougars... They may look cute, but they're as fast as lightning with their sharp claws! They're hard to hit, and have a unique ability to restrain the enemy's movements when they find themselves at a disadvantage in battle.
|
||||
</body></html>
|
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
During the coming war, your Clan must ally with one of the following five most vicious types of wild beasts:<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_ally1choose.htm">Frenzied Cougar</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_ally2choose.htm">Frenzied Buffalo</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_ally3choose.htm">Frenzied Kookaburra</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_ally4choose.htm">Frenzied Baby Buffalo</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest WildBeastReserve messenger_ally5choose.htm">Frenzied Baby Cougar</Button>
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
All five clans have already registered for this Clan Hall Battle. You're too late! Next time, get here earlier!
|
||||
</body></html>
|
@@ -0,0 +1,4 @@
|
||||
<html><body>
|
||||
You don't remember what you did in the previous battle? Surely you don't intend to break the alliance... Or do you?<br>
|
||||
Confirm it yourself on the battlefield!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Have you forgotten so soon? You're already registered! If you have the time, you should read a book called "How to Tame Beasts".
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Humm... What did you say your clan name was? Well... Hey! You're not even registered for this Clan Hall Battle! You must follow the proper procedure! Get your act together!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Your clan is no longer accepting new members. All 18 clan members have been registered! You must be a common soldier.
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Registration was successful! Make sure you're not late for the Clan Hall Battle!
|
||||
</body></html>
|
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
There's no need for you to go through the preliminaries designed for common soldiers, master! Enjoy the fights, sir!
|
||||
</body></html>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user