|
@@ -1,18 +1,7 @@
|
|
|
-/*
|
|
|
- * 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.BanditStrongHold;
|
|
|
+package conquerablehalls.flagwar;
|
|
|
|
|
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
|
|
|
|
@@ -25,18 +14,21 @@ import com.l2jserver.L2DatabaseFactory;
|
|
|
import com.l2jserver.gameserver.Announcements;
|
|
|
import com.l2jserver.gameserver.ai.CtrlIntention;
|
|
|
import com.l2jserver.gameserver.ai.L2SpecialSiegeGuardAI;
|
|
|
+import com.l2jserver.gameserver.cache.HtmCache;
|
|
|
import com.l2jserver.gameserver.datatables.ClanTable;
|
|
|
import com.l2jserver.gameserver.datatables.NpcTable;
|
|
|
import com.l2jserver.gameserver.instancemanager.MapRegionManager.TeleportWhereType;
|
|
|
import com.l2jserver.gameserver.model.L2CharPosition;
|
|
|
import com.l2jserver.gameserver.model.L2Clan;
|
|
|
import com.l2jserver.gameserver.model.L2SiegeClan;
|
|
|
-import com.l2jserver.gameserver.model.L2SiegeClan.SiegeClanType;
|
|
|
import com.l2jserver.gameserver.model.L2Spawn;
|
|
|
import com.l2jserver.gameserver.model.L2World;
|
|
|
+import com.l2jserver.gameserver.model.L2SiegeClan.SiegeClanType;
|
|
|
+import com.l2jserver.gameserver.model.Location;
|
|
|
import com.l2jserver.gameserver.model.actor.L2Npc;
|
|
|
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
|
|
import com.l2jserver.gameserver.model.entity.clanhall.ClanHallSiegeEngine;
|
|
|
+import com.l2jserver.gameserver.model.zone.type.L2ResidenceHallTeleportZone;
|
|
|
import com.l2jserver.gameserver.network.SystemMessageId;
|
|
|
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
|
|
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
|
@@ -44,102 +36,102 @@ import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
|
|
|
|
|
|
/**
|
|
|
* @author BiggBoss
|
|
|
- * Bandit Stronghold hall siege script
|
|
|
*/
|
|
|
-public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
+public abstract class FlagWar extends ClanHallSiegeEngine
|
|
|
{
|
|
|
- private class ClanData
|
|
|
- {
|
|
|
- int flag = 0;
|
|
|
- int npc = 0;
|
|
|
- ArrayList<Integer> players = new ArrayList<Integer>(18);
|
|
|
- ArrayList<L2PcInstance> playersInstance = new ArrayList<L2PcInstance>(18);
|
|
|
- L2Spawn warrior = null;
|
|
|
- L2Spawn flagInstance = null;
|
|
|
- }
|
|
|
+ protected static String qn;
|
|
|
|
|
|
- private static final String qn = "BanditStrongHold";
|
|
|
+ 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 FLAG_RED;
|
|
|
+ protected static int FLAG_YELLOW;
|
|
|
+ protected static int FLAG_GREEN;
|
|
|
+ protected static int FLAG_BLUE;
|
|
|
+ protected static int FLAG_PURPLE;
|
|
|
|
|
|
- private static final String SQL_LOAD_ATTACKERS = "SELECT * FROM bandit_stronghold_attackers";
|
|
|
- private static final String SQL_SAVE_ATTACKER = "INSERT INTO bandit_stronghold_attackers_members VALUES (?,?)";
|
|
|
- private static final String SQL_LOAD_MEMEBERS = "SELECT object_id FROM bandit_stronghold_attackers_members WHERE clan_id = ?";
|
|
|
- private static final String SQL_SAVE_CLAN = "INSERT INTO bandit_stronghold_attackers VALUES(?,?,?)";
|
|
|
- private static final String SQL_SAVE_NPC = "UPDATE bandit_stronghold_attackers SET npc = ? WHERE clan_id = ?";
|
|
|
- private static final String SQL_CLEAR_CLAN = "DELETE FROM bandit_stronghold_attackers";
|
|
|
- private static final String SQL_CLEAR_CLAN_ATTACKERS = "DELETE FROM bandit_stronghold_attackers_members";
|
|
|
+ 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;
|
|
|
|
|
|
- private static final int RED_FLAG = 35423;
|
|
|
- private static final int YELLOW_FLAG = 35424;
|
|
|
- private static final int GREEN_FLAG = 35425;
|
|
|
- private static final int BLUE_FLAG = 35426;
|
|
|
- private static final int PURPLE_FLAG = 35427;
|
|
|
+ protected static int TELEPORT_1;
|
|
|
|
|
|
- private static final int OEL_MAHUM_BERSERKER = 35428;
|
|
|
- private static final int OEL_MAHUM_SCOUT = 35429;
|
|
|
- private static final int OEL_MAHUM_LEADER = 35430;
|
|
|
- private static final int OEL_MAHUM_CLERIC = 35431;
|
|
|
- private static final int OEL_MAHUM_THIEF = 35432;
|
|
|
+ protected static int MESSENGER;
|
|
|
|
|
|
- private static final int MESSENGER = 35437;
|
|
|
+ protected static int[][] FLAG_COORDS = new int[5][3];
|
|
|
+ protected static int[][] ALLY_COORDS = new int[5][3];
|
|
|
|
|
|
- // Custom values
|
|
|
- private static final int[][] FLAGS_COORDS =
|
|
|
- {
|
|
|
- {83607,-17541,-1829},
|
|
|
- {84095,-15478,-1829},
|
|
|
- {81768,-17036,-1826},
|
|
|
- {81287,-16025,-1843},
|
|
|
- {83243,-15077,-1829}
|
|
|
- };
|
|
|
+ protected static L2ResidenceHallTeleportZone[] TELE_ZONES = new L2ResidenceHallTeleportZone[5];
|
|
|
|
|
|
- // Custom values
|
|
|
- private static final int[][] MAHUM_COORDS =
|
|
|
- {
|
|
|
- {83658,-17337,-1829},
|
|
|
- {84076,-15846,-1825},
|
|
|
- {81990,-16900,-1839},
|
|
|
- {81527,-15965,-1860},
|
|
|
- {83168,-15319,-1848}
|
|
|
- };
|
|
|
+ protected static int QUEST_REWARD;
|
|
|
|
|
|
- // Custom values
|
|
|
- private static final L2CharPosition CENTER = new L2CharPosition(82882,-16280,-1894,0);
|
|
|
+ protected static L2CharPosition CENTER;
|
|
|
|
|
|
- private TIntObjectHashMap<ClanData> _data = new TIntObjectHashMap<ClanData>();
|
|
|
- private L2Clan _winner;
|
|
|
+ protected TIntObjectHashMap<ClanData> _data = new TIntObjectHashMap<ClanData>();
|
|
|
+ protected L2Clan _winner;
|
|
|
|
|
|
- public BanditStrongHold(int questId, String name, String descr, final int hallId)
|
|
|
+ public FlagWar(int questId, String name, String descr, int hallId)
|
|
|
{
|
|
|
super(questId, name, descr, hallId);
|
|
|
+
|
|
|
addStartNpc(MESSENGER);
|
|
|
addFirstTalkId(MESSENGER);
|
|
|
addTalkId(MESSENGER);
|
|
|
|
|
|
- addKillId(RED_FLAG);
|
|
|
- addKillId(YELLOW_FLAG);
|
|
|
- addKillId(GREEN_FLAG);
|
|
|
- addKillId(BLUE_FLAG);
|
|
|
- addKillId(PURPLE_FLAG);
|
|
|
+ for(int i = 0; i < 5; i++)
|
|
|
+ addFirstTalkId(TELEPORT_1 + i);
|
|
|
|
|
|
- addSpawnId(OEL_MAHUM_BERSERKER);
|
|
|
- addSpawnId(OEL_MAHUM_SCOUT);
|
|
|
- addSpawnId(OEL_MAHUM_LEADER);
|
|
|
- addSpawnId(OEL_MAHUM_CLERIC);
|
|
|
- addSpawnId(OEL_MAHUM_THIEF);
|
|
|
-
|
|
|
- // Load alredy registered attackers
|
|
|
- loadAttackers();
|
|
|
+ addKillId(FLAG_RED);
|
|
|
+ addKillId(FLAG_YELLOW);
|
|
|
+ addKillId(FLAG_GREEN);
|
|
|
+ addKillId(FLAG_BLUE);
|
|
|
+ addKillId(FLAG_PURPLE);
|
|
|
|
|
|
+ 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(player.getQuestState(qn) == null)
|
|
|
newQuestState(player);
|
|
|
- return "agit_oel_mahum_messenger_1.htm";
|
|
|
+ */
|
|
|
+ if(npc.getNpcId() == MESSENGER)
|
|
|
+ {
|
|
|
+ if(!checkIsAttacker(player.getClan()))
|
|
|
+ {
|
|
|
+ L2Clan clan = ClanTable.getInstance().getClan(_hall.getOwnerId());
|
|
|
+ String content = HtmCache.getInstance().getHtm(null, "data/scripts/conquerablehalls/flagwar/"+qn+"/messenger_initial.htm");
|
|
|
+ content.replaceAll("%clanName%", clan == null? "no owner" : clan.getName());
|
|
|
+ content.replaceAll("%objectId%", String.valueOf(npc.getObjectId()));
|
|
|
+ html = content;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ html = "messenger_initial.htm";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int index = npc.getNpcId() - TELEPORT_1;
|
|
|
+ TELE_ZONES[index].checkTeleporTask();
|
|
|
+ html = "teleporter.htm";
|
|
|
+ }
|
|
|
+ return html;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -148,27 +140,27 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
String html = event;
|
|
|
L2Clan clan = player.getClan();
|
|
|
|
|
|
- // Register the clan for the siege
|
|
|
- if(event.startsWith("register_clan"))
|
|
|
+ if(event.startsWith("register_clan")) // Register the clan for the siege
|
|
|
{
|
|
|
- if(!_hall.isWaitingBattle())
|
|
|
+ if(!_hall.isRegistering())
|
|
|
{
|
|
|
- NpcHtmlMessage msg = new NpcHtmlMessage(5);
|
|
|
- msg.setFile(null, "data/scripts/conquerablehalls/BanditStrongHold/azit_messenger_q0504_09.htm");
|
|
|
- msg.replace("%objectId%", String.valueOf(npc.getObjectId()));
|
|
|
- msg.replace("%nextSiege%", _hall.getSiegeDate().getTime().toString());
|
|
|
- player.sendPacket(msg);
|
|
|
- return null;
|
|
|
+ if(_hall.isInSiege())
|
|
|
+ html = "messenger_registrationpassed.htm";
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sendRegistrationPageDate(player);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
else if(clan == null || !player.isClanLeader())
|
|
|
- html = "agit_oel_mahum_messenger_2.htm";
|
|
|
+ html = "messenger_notclannotleader.htm";
|
|
|
else if((_hall.getOwnerId() > 0 && getAttackers().size() >= 4)
|
|
|
|| getAttackers().size() >= 5)
|
|
|
- html = "agit_oel_mahum_messenger_21.htm";
|
|
|
+ html = "messenger_attackersqueuefull.htm";
|
|
|
else if(checkIsAttacker(clan))
|
|
|
- html = "agit_oel_mahum_messenger_9.htm";
|
|
|
+ html = "messenger_clanalreadyregistered.htm";
|
|
|
else if(_hall.getOwnerId() == clan.getClanId())
|
|
|
- html = "agit_oel_mahum_messenger_22.htm";
|
|
|
+ html = "messenger_curownermessage.htm";
|
|
|
else
|
|
|
{
|
|
|
String[] arg = event.split(" ");
|
|
@@ -177,24 +169,24 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
// Register passing the quest
|
|
|
if(arg[1].equals("wQuest"))
|
|
|
{
|
|
|
- if(player.destroyItemByItemId("BanditStrongHold Siege", 5009, 1, npc, false)) // Quest passed
|
|
|
+ if(player.destroyItemByItemId(_hall.getName()+" Siege", QUEST_REWARD, 1, npc, false)) // Quest passed
|
|
|
{
|
|
|
registerClan(clan);
|
|
|
html = getFlagHtml(_data.get(clan.getClanId()).flag);
|
|
|
}
|
|
|
else // Quest not accoplished, try by paying
|
|
|
- html = "agit_oel_mahum_messenger_24.htm";
|
|
|
+ html = "messenger_noquest.htm";
|
|
|
}
|
|
|
// Register paying the fee
|
|
|
- else if(arg[1].equals("wFee"))
|
|
|
+ else if(arg[1].equals("wFee") && canPayRegistration())
|
|
|
{
|
|
|
- if(player.reduceAdena("Bandit Stronghold registration", 200000, npc, true)) // Fee payed
|
|
|
+ if(player.reduceAdena(qn+" Siege", 200000, npc, false)) // Fee payed
|
|
|
{
|
|
|
registerClan(clan);
|
|
|
html = getFlagHtml(_data.get(clan.getClanId()).flag);
|
|
|
}
|
|
|
else // Fee couldnt be payed, try with quest
|
|
|
- html = "agit_oel_mahum_messenger_26.htm";
|
|
|
+ html = "messenger_nomoney.htm";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -203,9 +195,9 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
else if(event.startsWith("select_clan_npc"))
|
|
|
{
|
|
|
if(!player.isClanLeader())
|
|
|
- html = "agit_oel_mahum_messenger_2.htm";
|
|
|
+ html = "messenger_onlyleaderselectally.htm";
|
|
|
else if(!_data.containsKey(clan.getClanId()))
|
|
|
- html = "agit_oel_mahum_messenger_7.htm";
|
|
|
+ html = "messenger_clannotregistered.htm";
|
|
|
else
|
|
|
{
|
|
|
String[] var = event.split(" ");
|
|
@@ -215,51 +207,71 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
try { id = Integer.parseInt(var[1]); }
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
- _log.warning("BanditStronghold->select_clan_npc->Wrong mahum warrior id: "+var[1]);
|
|
|
+ _log.warning(qn+"->select_clan_npc->Wrong mahum warrior id: "+var[1]);
|
|
|
}
|
|
|
- if(id > 0 && (html = getMahumHtml(id)) != null)
|
|
|
+ if(id > 0 && (html = getAllyHtml(id)) != null)
|
|
|
{
|
|
|
_data.get(clan.getClanId()).npc = id;
|
|
|
saveNpc(id, clan.getClanId());
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
- _log.warning("BanditStrongHold Siege: Not enough parameters to save clan npc for clan: "+clan.getName());
|
|
|
+ _log.warning(qn+" 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 = "agit_oel_mahum_messenger_2.htm";
|
|
|
- ClanData cd = _data.get(clan.getClanId());
|
|
|
- if(cd == null)
|
|
|
- html = "agit_oel_mahum_messenger_7.htm";
|
|
|
+ html = "messenger_clannotregistered.htm";
|
|
|
+ else if((cd = _data.get(clan.getClanId())) == null)
|
|
|
+ html = "messenger_notclannotleader.htm";
|
|
|
else if(cd.npc == 0)
|
|
|
- html = "agit_oel_mahum_messenger_10.htm";
|
|
|
+ html = "messenger_leaderdidnotchooseyet.htm";
|
|
|
else
|
|
|
- html = getMahumHtml(cd.npc);
|
|
|
+ html = getAllyHtml(cd.npc);
|
|
|
}
|
|
|
// Register a clan member for the fight
|
|
|
else if(event.equals("register_member"))
|
|
|
{
|
|
|
if(clan == null)
|
|
|
- html = "agit_oel_mahm_messenger_5.htm";
|
|
|
+ html = "messenger_clannotregistered.htm";
|
|
|
else if(!_hall.isRegistering())
|
|
|
- html = "agit_oel_mahum_messenger_3.htm";
|
|
|
+ html = "messenger_registrationpassed.htm";
|
|
|
else if(!_data.containsKey(clan.getClanId()))
|
|
|
- html = "agit_oel_mahum_messenger_7.htm";
|
|
|
+ html = "messenger_notclannotleader.htm";
|
|
|
else if(_data.get(clan.getClanId()).players.size() >= 18)
|
|
|
- html = "agit_oel_mahum_messenger_8.htm";
|
|
|
+ html = "messenger_clanqueuefull.htm";
|
|
|
else
|
|
|
{
|
|
|
ClanData data = _data.get(clan.getClanId());
|
|
|
data.players.add(player.getObjectId());
|
|
|
saveMember(clan.getClanId(), player.getObjectId());
|
|
|
if(data.npc == 0)
|
|
|
- html = "agit_oel_mahum_messenger_16.htm";
|
|
|
+ html = "messenger_leaderdidnotchooseyet.htm";
|
|
|
else
|
|
|
- html = "agit_oel_mahum_messenger_9.htm";
|
|
|
+ html = "messenger_clanregistered.htm";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // Show cur attacker list
|
|
|
+ else if(event.equals("view_attacker_list"))
|
|
|
+ {
|
|
|
+ if(_hall.isRegistering())
|
|
|
+ sendRegistrationPageDate(player);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ html = HtmCache.getInstance().getHtm(null, "data/scripts/conquerablehalls/flagwar/"+qn+"/messenger_registeredclans.htm");
|
|
|
+ for(int i = 0; i < _data.size(); i++)
|
|
|
+ {
|
|
|
+ L2Clan attacker = ClanTable.getInstance().getClan(_data.keys()[i]);
|
|
|
+ if(attacker == null)
|
|
|
+ continue;
|
|
|
+ html.replaceAll("%clan"+i+"%", clan.getName());
|
|
|
+ html.replaceAll("%clanMem"+i+"%", String.valueOf(((ClanData)_data.values()[i]).players.size()));
|
|
|
+ }
|
|
|
+ html.replaceAll("%clan", "Empty pos. ");
|
|
|
+ html.replaceAll("%clanMem", "Empty pos. ");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -296,10 +308,9 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
public String onSpawn(L2Npc npc)
|
|
|
{
|
|
|
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, CENTER);
|
|
|
- npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
|
|
- return super.onSpawn(npc);
|
|
|
+ return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public L2Clan getWinner()
|
|
|
{
|
|
@@ -326,7 +337,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
@Override
|
|
|
public void onSiegeStarts()
|
|
|
{
|
|
|
- for(ClanData data : _data.valueCollection())
|
|
|
+ for(ClanData data : _data.values())
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -335,18 +346,18 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
|
|
|
if(flagTemplate == null)
|
|
|
{
|
|
|
- _log.warning("BanditStrongHoldSiege: Flag L2NpcTemplate["+data.flag+"] does not exist!");
|
|
|
+ _log.warning(qn+": Flag L2NpcTemplate["+data.flag+"] does not exist!");
|
|
|
continue;
|
|
|
}
|
|
|
if(mahumTemplate == null)
|
|
|
{
|
|
|
- _log.warning("BanditStrongHoldSiege: Mahum L2NpcTemplate["+data.npc+"] does not exist!");
|
|
|
+ _log.warning(qn+": Ally L2NpcTemplate["+data.npc+"] does not exist!");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
data.flagInstance = new L2Spawn(flagTemplate);
|
|
|
- int index = data.flag - 35423;
|
|
|
- int[] flagCoords = FLAGS_COORDS[index];
|
|
|
+ int index = data.flag - FLAG_RED;
|
|
|
+ int[] flagCoords = FLAG_COORDS[index];
|
|
|
data.flagInstance.setLocx(flagCoords[0]);
|
|
|
data.flagInstance.setLocy(flagCoords[1]);
|
|
|
data.flagInstance.setLocz(flagCoords[2]);
|
|
@@ -365,10 +376,10 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
}
|
|
|
|
|
|
data.warrior = new L2Spawn(mahumTemplate);
|
|
|
- int indexx = data.npc - 35428;
|
|
|
- data.warrior.setLocx(MAHUM_COORDS[indexx][0]);
|
|
|
- data.warrior.setLocy(MAHUM_COORDS[indexx][1]);
|
|
|
- data.warrior.setLocz(MAHUM_COORDS[indexx][2]);
|
|
|
+ int indexx = data.npc - ALLY_1;
|
|
|
+ data.warrior.setLocx(ALLY_COORDS[indexx][0]);
|
|
|
+ data.warrior.setLocy(ALLY_COORDS[indexx][1]);
|
|
|
+ data.warrior.setLocz(ALLY_COORDS[indexx][2]);
|
|
|
data.warrior.setRespawnDelay(10000);
|
|
|
data.warrior.setAmount(1);
|
|
|
data.warrior.init();
|
|
@@ -378,7 +389,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
endSiege();
|
|
|
- _log.warning(_hall.getName()+": Problems in siege initialization!");
|
|
|
+ _log.warning(qn+": Problems in siege initialization!");
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
@@ -400,6 +411,29 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
clearTables();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public final Location getInnerSpawnLoc(final L2PcInstance player)
|
|
|
+ {
|
|
|
+ Location loc = null;
|
|
|
+ ClanData cd = _data.get(player.getClanId());
|
|
|
+ if(cd != null)
|
|
|
+ {
|
|
|
+ // 0 is owner inner spawn point during no siege
|
|
|
+ int index = cd.npc - ALLY_1 + 1;
|
|
|
+ if(index >= 1 && index <= 5)
|
|
|
+ loc = _hall.getZone().getSpawns().get(index);
|
|
|
+ else
|
|
|
+ throw new ArrayIndexOutOfBoundsException();
|
|
|
+ }
|
|
|
+ return loc;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public final boolean canPlantFlag()
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
private void registerClan(L2Clan clan)
|
|
|
{
|
|
|
final int clanId = clan.getClanId();
|
|
@@ -408,7 +442,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
getAttackers().put(clanId, sc);
|
|
|
|
|
|
ClanData data = new ClanData();
|
|
|
- data.flag = 35423 + _data.size();
|
|
|
+ data.flag = FLAG_RED + _data.size();
|
|
|
data.players.add(clan.getLeaderId());
|
|
|
_data.put(clanId, data);
|
|
|
|
|
@@ -452,72 +486,34 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private String getFlagHtml(int flag)
|
|
|
+ public boolean canPayRegistration()
|
|
|
{
|
|
|
- String result = null;
|
|
|
-
|
|
|
- switch(flag)
|
|
|
- {
|
|
|
- case RED_FLAG:
|
|
|
- result = "agit_oel_mahum_messenger_4a.htm";
|
|
|
- break;
|
|
|
- case YELLOW_FLAG:
|
|
|
- result = "agit_oel_mahum_messenger_4b.htm";
|
|
|
- break;
|
|
|
- case GREEN_FLAG:
|
|
|
- result = "agit_oel_mahum_messenger_4c.htm";
|
|
|
- break;
|
|
|
- case BLUE_FLAG:
|
|
|
- result = "agit_oel_mahum_messenger_4d.htm";
|
|
|
- break;
|
|
|
- case PURPLE_FLAG:
|
|
|
- result = "agit_oel_mahum_messenger_4e.htm";
|
|
|
- break;
|
|
|
- default:
|
|
|
- result = "<html><body>Are you kidding me?</body></html>";
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- private String getMahumHtml(int mahum)
|
|
|
+ private void sendRegistrationPageDate(L2PcInstance player)
|
|
|
{
|
|
|
- String result = null;
|
|
|
-
|
|
|
- switch(mahum)
|
|
|
- {
|
|
|
- case OEL_MAHUM_BERSERKER:
|
|
|
- result = "agit_oel_mahum_messenger_17.htm";
|
|
|
- break;
|
|
|
- case OEL_MAHUM_SCOUT:
|
|
|
- result = "agit_oel_mahum_messenger_18.htm";
|
|
|
- break;
|
|
|
- case OEL_MAHUM_LEADER:
|
|
|
- result = "agit_oel_mahum_messenger_19.htm";
|
|
|
- break;
|
|
|
- case OEL_MAHUM_CLERIC:
|
|
|
- result = "agit_oel_mahum_messenger_20.htm";
|
|
|
- break;
|
|
|
- case OEL_MAHUM_THIEF:
|
|
|
- result = "agit_oel_mahum_messenger_23.htm";
|
|
|
- break;
|
|
|
- default:
|
|
|
- result = "<html><body>Are you kidding me?</body></html>";
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
+ NpcHtmlMessage msg = new NpcHtmlMessage(5);
|
|
|
+ msg.setFile(null, "data/scripts/conquerablehalls/flagwar/"+qn+"/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);
|
|
|
+
|
|
|
// =============================================
|
|
|
// Database access methods
|
|
|
// =============================================
|
|
|
- private final void loadAttackers()
|
|
|
+ @Override
|
|
|
+ public final void loadAttackers()
|
|
|
{
|
|
|
Connection con = null;
|
|
|
try
|
|
|
{
|
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
|
PreparedStatement statement = con.prepareStatement(SQL_LOAD_ATTACKERS);
|
|
|
+ statement.setInt(1, _hall.getId());
|
|
|
ResultSet rset = statement.executeQuery();
|
|
|
while(rset.next())
|
|
|
{
|
|
@@ -525,7 +521,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
|
|
|
if(ClanTable.getInstance().getClan(clanId) == null)
|
|
|
{
|
|
|
- _log.warning("BanditStronghold: Loaded an unexistent clan as attacker! Clan Id: "+clanId);
|
|
|
+ _log.warning(qn+": Loaded an unexistent clan as attacker! Clan Id: "+clanId);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -541,7 +537,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
}
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
- _log.warning("BanditStrongHold.loadAttackers()->"+e.getMessage());
|
|
|
+ _log.warning(qn+".loadAttackers()->"+e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
finally
|
|
@@ -559,7 +555,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
|
|
|
if(listInstance == null)
|
|
|
{
|
|
|
- _log.warning("BanditStronghold: Tried to load unregistered clan: "+clanId+"[clan Id]");
|
|
|
+ _log.warning(qn+": Tried to load unregistered clan: "+clanId+"[clan Id]");
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -577,7 +573,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
}
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
- _log.warning("BanditStrongHold.loadAttackerMembers()->"+e.getMessage());
|
|
|
+ _log.warning(qn+".loadAttackerMembers()->"+e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
finally
|
|
@@ -593,15 +589,16 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
{
|
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
|
PreparedStatement statement = con.prepareStatement(SQL_SAVE_CLAN);
|
|
|
- statement.setInt(1, flag);
|
|
|
- statement.setInt(2, 0);
|
|
|
- statement.setInt(3, clanId);
|
|
|
+ statement.setInt(1, _hall.getId());
|
|
|
+ statement.setInt(2, flag);
|
|
|
+ statement.setInt(3, 0);
|
|
|
+ statement.setInt(4, clanId);
|
|
|
statement.execute();
|
|
|
statement.close();
|
|
|
}
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
- _log.warning("BanditStrongHold.saveClan()->"+e.getMessage());
|
|
|
+ _log.warning(qn+".saveClan()->"+e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
finally
|
|
@@ -624,7 +621,7 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
}
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
- _log.warning("BanditStrongHold.saveNpc()->"+e.getMessage());
|
|
|
+ _log.warning(qn+".saveNpc()->"+e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
finally
|
|
@@ -640,14 +637,15 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
{
|
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
|
PreparedStatement statement = con.prepareStatement(SQL_SAVE_ATTACKER);
|
|
|
- statement.setInt(1, clanId);
|
|
|
- statement.setInt(2, objectId);
|
|
|
+ statement.setInt(1, _hall.getId());
|
|
|
+ statement.setInt(2, clanId);
|
|
|
+ statement.setInt(3, objectId);
|
|
|
statement.execute();
|
|
|
statement.close();
|
|
|
}
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
- _log.warning("BanditStronghold.saveMember()->"+e.getMessage());
|
|
|
+ _log.warning(qn+".saveMember()->"+e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
finally
|
|
@@ -664,16 +662,18 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
|
|
|
|
PreparedStatement stat1 = con.prepareStatement(SQL_CLEAR_CLAN);
|
|
|
+ stat1.setInt(1, _hall.getId());
|
|
|
stat1.execute();
|
|
|
stat1.close();
|
|
|
|
|
|
PreparedStatement stat2 = con.prepareStatement(SQL_CLEAR_CLAN_ATTACKERS);
|
|
|
+ stat2.setInt(1, _hall.getId());
|
|
|
stat2.execute();
|
|
|
stat2.close();
|
|
|
}
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
- _log.warning("BanditStrongHold.clearTables()->"+e.getMessage());
|
|
|
+ _log.warning(qn+".clearTables()->"+e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
finally
|
|
@@ -682,8 +682,13 @@ public final class BanditStrongHold extends ClanHallSiegeEngine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args)
|
|
|
+ class ClanData
|
|
|
{
|
|
|
- new BanditStrongHold(-1, qn, "conquerablehalls", BANDIT_STRONGHOLD);
|
|
|
+ int flag = 0;
|
|
|
+ int npc = 0;
|
|
|
+ ArrayList<Integer> players = new ArrayList<Integer>(18);
|
|
|
+ ArrayList<L2PcInstance> playersInstance = new ArrayList<L2PcInstance>(18);
|
|
|
+ L2Spawn warrior = null;
|
|
|
+ L2Spawn flagInstance = null;
|
|
|
}
|
|
|
-}
|
|
|
+}
|