Removed Devastated Castle and Wild Beast Reserve.

This commit is contained in:
MobiusDevelopment
2023-02-04 02:57:41 +02:00
parent fecb1728ff
commit e8d6f2d037
11 changed files with 6 additions and 1691 deletions

View File

@@ -31,6 +31,9 @@ DELETE FROM spawnlist WHERE (locx>=98304 AND locy>=-131072 AND locx<=131071 AND
-- Remove Monastery of Silence (23_15) spawns. -- Remove Monastery of Silence (23_15) spawns.
DELETE FROM spawnlist WHERE (locx>=98304 AND locy>=-98304 AND locx<=131071 AND locy<=-65537); DELETE FROM spawnlist WHERE (locx>=98304 AND locy>=-98304 AND locx<=131071 AND locy<=-65537);
-- Remove Devastated Castle and Wild Beast Reserve spawns.
DELETE FROM `spawnlist` WHERE `npc_templateid` IN ('35638', '75003', '75004', '75005', '75006', '75007', '75008', '75009', '75010', '75011', '75012');
-- Remove NPCs not supported by C4 client. -- Remove NPCs not supported by C4 client.
DELETE FROM `spawnlist` WHERE `npc_templateid` IN ('13015', '13018', '13019', '13020', '13021', '13022', '13023', '13024', '13025', '13026', '13027', '13028', '13029', '13030', '13031', '13032', '13033', '13034', '13035', '13036', '14836', '14837', '14838', '14839', '14840', '14841', '14842', '14843', '14844', '14845', '14846', '14847', '14848', '14849', '14850', '14851', '14852', '14853', '14854', '14855', '14856', '14857', '14858', '14859', '14860', '14861', '14862', '14863', '14864', '14865', '14866', '14867', '14868', '14869', '18333', '18335', '18338', '18340', '18341', '18343', '18344', '18345', '18346', '22003', '22005', '22006', '22008', '22028', '22050', '22052', '22053', '22054', '22055', '22056', '22058', '22059', '22060', '22061', '22062', '22063', '22064', '22065', '22066', '22067', '22068', '22069', '22070', '22071', '22072', '22073', '22074', '22075', '22076', '22077', '22078', '22107', '22108', '22110', '22111', '22112', '22113', '22114', '22119', '22120', '22121', '22124', '22125', '22126', '22127', '22128', '22129', '22134', '22135', '22136', '22137', '22138', '22139', '22140', '22141', '22142', '22143', '22144', '22145', '22146', '22147', '22148', '22149', '22150', '22151', '22152', '22153', '22154', '22155', '22156', '22157', '22158', '22159', '22160', '22161', '22162', '22163', '22164', '22165', '22166', '22167', '22168', '22169', '22170', '22171', '22172', '22173', '22174', '22175', '22176', '22188', '22189', '22190', '22191', '22192', '22193', '22194', '22195', '22196', '22197', '22198', '22199', '22200', '22201', '22202', '22203', '22204', '22205', '22208', '22209', '22210', '22211', '22212', '22213', '22214', '22215', '22216', '22217', '22218', '22219', '22220', '22221', '22222', '22223', '22224', '22225', '22226', '22227', '25176', '25249', '25501', '25502', '25503', '25504', '25512', '25514', '25515', '25516', '25517', '25518', '25519', '25523', '25527', '27318', '29045', '29046', '29047', '29048', '29049', '29050', '29051', '29054', '29056', '29062', '29063', '29064', '29065', '29069', '29070', '29071', '29072', '29073', '29074', '29075', '29076', '29095', '29096', '29097', '29098', '32009', '32012', '32021', '32022', '32023', '32027', '32028', '32030', '32031', '32032', '32033', '32034', '32035', '32036', '32037', '32039', '32040', '32042', '32043', '32044', '32045', '32051', '32058', '32059', '32060', '32061', '32062', '32063', '32064', '32065', '32066', '32067', '32068', '32070', '32071', '32072', '32073', '32077', '32078', '32079', '32104', '32108', '32109', '32111', '32112', '32114', '32115', '32116', '32117', '32118', '32119', '32120', '32121', '32122', '32129', '32130', '35469', '35606', '35629', '35630', '35643', '35648', '35649', '35650', '35651', '35652', '35653', '35654', '35655', '35656'); DELETE FROM `spawnlist` WHERE `npc_templateid` IN ('13015', '13018', '13019', '13020', '13021', '13022', '13023', '13024', '13025', '13026', '13027', '13028', '13029', '13030', '13031', '13032', '13033', '13034', '13035', '13036', '14836', '14837', '14838', '14839', '14840', '14841', '14842', '14843', '14844', '14845', '14846', '14847', '14848', '14849', '14850', '14851', '14852', '14853', '14854', '14855', '14856', '14857', '14858', '14859', '14860', '14861', '14862', '14863', '14864', '14865', '14866', '14867', '14868', '14869', '18333', '18335', '18338', '18340', '18341', '18343', '18344', '18345', '18346', '22003', '22005', '22006', '22008', '22028', '22050', '22052', '22053', '22054', '22055', '22056', '22058', '22059', '22060', '22061', '22062', '22063', '22064', '22065', '22066', '22067', '22068', '22069', '22070', '22071', '22072', '22073', '22074', '22075', '22076', '22077', '22078', '22107', '22108', '22110', '22111', '22112', '22113', '22114', '22119', '22120', '22121', '22124', '22125', '22126', '22127', '22128', '22129', '22134', '22135', '22136', '22137', '22138', '22139', '22140', '22141', '22142', '22143', '22144', '22145', '22146', '22147', '22148', '22149', '22150', '22151', '22152', '22153', '22154', '22155', '22156', '22157', '22158', '22159', '22160', '22161', '22162', '22163', '22164', '22165', '22166', '22167', '22168', '22169', '22170', '22171', '22172', '22173', '22174', '22175', '22176', '22188', '22189', '22190', '22191', '22192', '22193', '22194', '22195', '22196', '22197', '22198', '22199', '22200', '22201', '22202', '22203', '22204', '22205', '22208', '22209', '22210', '22211', '22212', '22213', '22214', '22215', '22216', '22217', '22218', '22219', '22220', '22221', '22222', '22223', '22224', '22225', '22226', '22227', '25176', '25249', '25501', '25502', '25503', '25504', '25512', '25514', '25515', '25516', '25517', '25518', '25519', '25523', '25527', '27318', '29045', '29046', '29047', '29048', '29049', '29050', '29051', '29054', '29056', '29062', '29063', '29064', '29065', '29069', '29070', '29071', '29072', '29073', '29074', '29075', '29076', '29095', '29096', '29097', '29098', '32009', '32012', '32021', '32022', '32023', '32027', '32028', '32030', '32031', '32032', '32033', '32034', '32035', '32036', '32037', '32039', '32040', '32042', '32043', '32044', '32045', '32051', '32058', '32059', '32060', '32061', '32062', '32063', '32064', '32065', '32066', '32067', '32068', '32070', '32071', '32072', '32073', '32077', '32078', '32079', '32104', '32108', '32109', '32111', '32112', '32114', '32115', '32116', '32117', '32118', '32119', '32120', '32121', '32122', '32129', '32130', '35469', '35606', '35629', '35630', '35643', '35648', '35649', '35650', '35651', '35652', '35653', '35654', '35655', '35656');
DELETE FROM `grandboss_data` WHERE `boss_id` IN ('13015', '13018', '13019', '13020', '13021', '13022', '13023', '13024', '13025', '13026', '13027', '13028', '13029', '13030', '13031', '13032', '13033', '13034', '13035', '13036', '14836', '14837', '14838', '14839', '14840', '14841', '14842', '14843', '14844', '14845', '14846', '14847', '14848', '14849', '14850', '14851', '14852', '14853', '14854', '14855', '14856', '14857', '14858', '14859', '14860', '14861', '14862', '14863', '14864', '14865', '14866', '14867', '14868', '14869', '18333', '18335', '18338', '18340', '18341', '18343', '18344', '18345', '18346', '22003', '22005', '22006', '22008', '22028', '22050', '22052', '22053', '22054', '22055', '22056', '22058', '22059', '22060', '22061', '22062', '22063', '22064', '22065', '22066', '22067', '22068', '22069', '22070', '22071', '22072', '22073', '22074', '22075', '22076', '22077', '22078', '22107', '22108', '22110', '22111', '22112', '22113', '22114', '22119', '22120', '22121', '22124', '22125', '22126', '22127', '22128', '22129', '22134', '22135', '22136', '22137', '22138', '22139', '22140', '22141', '22142', '22143', '22144', '22145', '22146', '22147', '22148', '22149', '22150', '22151', '22152', '22153', '22154', '22155', '22156', '22157', '22158', '22159', '22160', '22161', '22162', '22163', '22164', '22165', '22166', '22167', '22168', '22169', '22170', '22171', '22172', '22173', '22174', '22175', '22176', '22188', '22189', '22190', '22191', '22192', '22193', '22194', '22195', '22196', '22197', '22198', '22199', '22200', '22201', '22202', '22203', '22204', '22205', '22208', '22209', '22210', '22211', '22212', '22213', '22214', '22215', '22216', '22217', '22218', '22219', '22220', '22221', '22222', '22223', '22224', '22225', '22226', '22227', '25176', '25249', '25501', '25502', '25503', '25504', '25512', '25514', '25515', '25516', '25517', '25518', '25519', '25523', '25527', '27318', '29045', '29046', '29047', '29048', '29049', '29050', '29051', '29054', '29056', '29062', '29063', '29064', '29065', '29069', '29070', '29071', '29072', '29073', '29074', '29075', '29076', '29095', '29096', '29097', '29098', '32009', '32012', '32021', '32022', '32023', '32027', '32028', '32030', '32031', '32032', '32033', '32034', '32035', '32036', '32037', '32039', '32040', '32042', '32043', '32044', '32045', '32051', '32058', '32059', '32060', '32061', '32062', '32063', '32064', '32065', '32066', '32067', '32068', '32070', '32071', '32072', '32073', '32077', '32078', '32079', '32104', '32108', '32109', '32111', '32112', '32114', '32115', '32116', '32117', '32118', '32119', '32120', '32121', '32122', '32129', '32130', '35469', '35606', '35629', '35630', '35643', '35648', '35649', '35650', '35651', '35652', '35653', '35654', '35655', '35656'); DELETE FROM `grandboss_data` WHERE `boss_id` IN ('13015', '13018', '13019', '13020', '13021', '13022', '13023', '13024', '13025', '13026', '13027', '13028', '13029', '13030', '13031', '13032', '13033', '13034', '13035', '13036', '14836', '14837', '14838', '14839', '14840', '14841', '14842', '14843', '14844', '14845', '14846', '14847', '14848', '14849', '14850', '14851', '14852', '14853', '14854', '14855', '14856', '14857', '14858', '14859', '14860', '14861', '14862', '14863', '14864', '14865', '14866', '14867', '14868', '14869', '18333', '18335', '18338', '18340', '18341', '18343', '18344', '18345', '18346', '22003', '22005', '22006', '22008', '22028', '22050', '22052', '22053', '22054', '22055', '22056', '22058', '22059', '22060', '22061', '22062', '22063', '22064', '22065', '22066', '22067', '22068', '22069', '22070', '22071', '22072', '22073', '22074', '22075', '22076', '22077', '22078', '22107', '22108', '22110', '22111', '22112', '22113', '22114', '22119', '22120', '22121', '22124', '22125', '22126', '22127', '22128', '22129', '22134', '22135', '22136', '22137', '22138', '22139', '22140', '22141', '22142', '22143', '22144', '22145', '22146', '22147', '22148', '22149', '22150', '22151', '22152', '22153', '22154', '22155', '22156', '22157', '22158', '22159', '22160', '22161', '22162', '22163', '22164', '22165', '22166', '22167', '22168', '22169', '22170', '22171', '22172', '22173', '22174', '22175', '22176', '22188', '22189', '22190', '22191', '22192', '22193', '22194', '22195', '22196', '22197', '22198', '22199', '22200', '22201', '22202', '22203', '22204', '22205', '22208', '22209', '22210', '22211', '22212', '22213', '22214', '22215', '22216', '22217', '22218', '22219', '22220', '22221', '22222', '22223', '22224', '22225', '22226', '22227', '25176', '25249', '25501', '25502', '25503', '25504', '25512', '25514', '25515', '25516', '25517', '25518', '25519', '25523', '25527', '27318', '29045', '29046', '29047', '29048', '29049', '29050', '29051', '29054', '29056', '29062', '29063', '29064', '29065', '29069', '29070', '29071', '29072', '29073', '29074', '29075', '29076', '29095', '29096', '29097', '29098', '32009', '32012', '32021', '32022', '32023', '32027', '32028', '32030', '32031', '32032', '32033', '32034', '32035', '32036', '32037', '32039', '32040', '32042', '32043', '32044', '32045', '32051', '32058', '32059', '32060', '32061', '32062', '32063', '32064', '32065', '32066', '32067', '32068', '32070', '32071', '32072', '32073', '32077', '32078', '32079', '32104', '32108', '32109', '32111', '32112', '32114', '32115', '32116', '32117', '32118', '32119', '32120', '32121', '32122', '32129', '32130', '35469', '35606', '35629', '35630', '35643', '35648', '35649', '35650', '35651', '35652', '35653', '35654', '35655', '35656');

View File

@@ -2,19 +2,6 @@
# Conquerable Clan Halls # Conquerable Clan Halls
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# -------------------------------
# Devastated castle
# -------------------------------
# Day of week for the siege "Devastated castle".
# 1 - Monday, 2 - Tuesday, 3 - Wednesday, etc.
# NOT recommended to put siege
# In the day that Tan and siege castles (Saturday, Sunday)
DevastatedDay = 1
# Time start registration siege "Devastated castle", in hours.
DevastatedHour = 18
# Time to gain "Devastated castle", in minutes.
DevastatedMinutes = 0
# ------------------------------ # ------------------------------
# Partisan Hideout # Partisan Hideout
# ------------------------------ # ------------------------------

View File

@@ -1,103 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.bosses;
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.siege.clanhalls.DevastatedCastle;
/**
* @author Mobius
* @note Based on python script
*/
public class Gustav extends Quest
{
// NPCs
private static final int GUSTAV = 35410;
private static final int MESSENGER = 35420;
// Misc
private static final Collection<Clan> _clans = ConcurrentHashMap.newKeySet();
private Gustav()
{
super(-1, "ai/bosses");
addTalkId(MESSENGER);
addStartNpc(MESSENGER);
addAttackId(GUSTAV);
addKillId(GUSTAV);
}
@Override
public String onTalk(Npc npc, Player player)
{
final Clan playerClan = player.getClan();
for (Clan clan : _clans)
{
if (clan == playerClan)
{
return "<html><body>You already registered!</body></html>";
}
}
if (DevastatedCastle.getInstance().Conditions(player))
{
if (!_clans.contains(playerClan))
{
_clans.add(playerClan);
}
return "<html><body>You have successful registered on a siege.</body></html>";
}
return "<html><body>You are not allowed to do that!</body></html>";
}
@Override
public String onAttack(Npc npc, Player attacker, int damage, boolean isPet)
{
final Clan playerClan = attacker.getClan();
if (playerClan != null)
{
for (Clan clan : _clans)
{
if (clan == playerClan)
{
DevastatedCastle.getInstance().addSiegeDamage(clan, damage);
break;
}
}
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(Npc npc, Player killer, boolean isPet)
{
DevastatedCastle.getInstance().SiegeFinish();
return super.onKill(npc, killer, isPet);
}
public static void main(String[] args)
{
new Gustav();
}
}

View File

@@ -434,9 +434,6 @@ public class Config
public static int CH_FRONT1_FEE; public static int CH_FRONT1_FEE;
public static int CH_FRONT2_FEE; public static int CH_FRONT2_FEE;
public static int DEVASTATED_DAY;
public static int DEVASTATED_HOUR;
public static int DEVASTATED_MINUTES;
public static int PARTISAN_DAY; public static int PARTISAN_DAY;
public static int PARTISAN_HOUR; public static int PARTISAN_HOUR;
public static int PARTISAN_MINUTES; public static int PARTISAN_MINUTES;
@@ -1593,9 +1590,6 @@ public class Config
public static void loadElitCHConfig() public static void loadElitCHConfig()
{ {
final PropertiesParser conquerableConfig = new PropertiesParser(CONQUERABLE_CLANHALL_CONFIG_FILE); final PropertiesParser conquerableConfig = new PropertiesParser(CONQUERABLE_CLANHALL_CONFIG_FILE);
DEVASTATED_DAY = conquerableConfig.getInt("DevastatedDay", 1);
DEVASTATED_HOUR = conquerableConfig.getInt("DevastatedHour", 18);
DEVASTATED_MINUTES = conquerableConfig.getInt("DevastatedMinutes", 0);
PARTISAN_DAY = conquerableConfig.getInt("PartisanDay", 5); PARTISAN_DAY = conquerableConfig.getInt("PartisanDay", 5);
PARTISAN_HOUR = conquerableConfig.getInt("PartisanHour", 21); PARTISAN_HOUR = conquerableConfig.getInt("PartisanHour", 21);
PARTISAN_MINUTES = conquerableConfig.getInt("PartisanMinutes", 0); PARTISAN_MINUTES = conquerableConfig.getInt("PartisanMinutes", 0);

View File

@@ -113,7 +113,6 @@ import org.l2jmobius.gameserver.model.partymatching.PartyMatchWaitingList;
import org.l2jmobius.gameserver.model.sevensigns.SevenSigns; import org.l2jmobius.gameserver.model.sevensigns.SevenSigns;
import org.l2jmobius.gameserver.model.sevensigns.SevenSignsFestival; import org.l2jmobius.gameserver.model.sevensigns.SevenSignsFestival;
import org.l2jmobius.gameserver.model.siege.clanhalls.BanditStrongholdSiege; import org.l2jmobius.gameserver.model.siege.clanhalls.BanditStrongholdSiege;
import org.l2jmobius.gameserver.model.siege.clanhalls.DevastatedCastle;
import org.l2jmobius.gameserver.model.siege.clanhalls.FortressOfResistance; import org.l2jmobius.gameserver.model.siege.clanhalls.FortressOfResistance;
import org.l2jmobius.gameserver.model.spawn.AutoSpawnHandler; import org.l2jmobius.gameserver.model.spawn.AutoSpawnHandler;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
@@ -249,7 +248,6 @@ public class GameServer
printSection("Clan Halls"); printSection("Clan Halls");
ClanHallTable.getInstance(); ClanHallTable.getInstance();
FortressOfResistance.getInstance(); FortressOfResistance.getInstance();
DevastatedCastle.getInstance();
BanditStrongholdSiege.getInstance(); BanditStrongholdSiege.getInstance();
AuctionManager.getInstance(); AuctionManager.getInstance();

View File

@@ -157,7 +157,6 @@ import org.l2jmobius.gameserver.model.sevensigns.SevenSignsFestival;
import org.l2jmobius.gameserver.model.siege.Castle; import org.l2jmobius.gameserver.model.siege.Castle;
import org.l2jmobius.gameserver.model.siege.FortSiege; import org.l2jmobius.gameserver.model.siege.FortSiege;
import org.l2jmobius.gameserver.model.siege.Siege; import org.l2jmobius.gameserver.model.siege.Siege;
import org.l2jmobius.gameserver.model.siege.clanhalls.DevastatedCastle;
import org.l2jmobius.gameserver.model.skill.BaseStat; import org.l2jmobius.gameserver.model.skill.BaseStat;
import org.l2jmobius.gameserver.model.skill.Formulas; import org.l2jmobius.gameserver.model.skill.Formulas;
import org.l2jmobius.gameserver.model.skill.SkillTargetType; import org.l2jmobius.gameserver.model.skill.SkillTargetType;
@@ -8978,7 +8977,7 @@ public class Player extends Playable
if (getClan() != null) if (getClan() != null)
{ {
final Siege siege = SiegeManager.getInstance().getSiege(this); final Siege siege = SiegeManager.getInstance().getSiege(this);
return ((siege != null) && siege.checkIsAttacker(getClan())) || DevastatedCastle.getInstance().isInProgress(); return ((siege != null) && siege.checkIsAttacker(getClan()));
} }
} }
else if (attacker instanceof FortSiegeGuard) else if (attacker instanceof FortSiegeGuard)

View File

@@ -27,7 +27,6 @@ import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.clan.ClanMember; import org.l2jmobius.gameserver.model.clan.ClanMember;
import org.l2jmobius.gameserver.model.residences.ClanHall; import org.l2jmobius.gameserver.model.residences.ClanHall;
import org.l2jmobius.gameserver.model.siege.clanhalls.BanditStrongholdSiege; import org.l2jmobius.gameserver.model.siege.clanhalls.BanditStrongholdSiege;
import org.l2jmobius.gameserver.model.siege.clanhalls.WildBeastFarmSiege;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected; import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -165,51 +164,6 @@ public class ClanHallSiegeInfo extends Npc
} }
break; break;
} }
case 35627:
{
if (!WildBeastFarmSiege.getInstance().isRegistrationPeriod())
{
showMessageWindow(player, 3);
return;
}
if ((playerClan == null) || !playerClan.getLeaderName().equalsIgnoreCase(player.getName()) || (playerClan.getLevel() < 4))
{
showMessageWindow(player, 1);
return;
}
if (WildBeastFarmSiege.getInstance().clanhall.getOwnerClan() == playerClan)
{
str += "Your clan is already registered for the siege, what more do you want from me?<br>";
str += "<a action=\"bypass -h npc_%objectId%_PlayerList\">Add / remove a member of the siege</a><br>";
}
else if (WildBeastFarmSiege.getInstance().isClanOnSiege(playerClan))
{
str += "Your clan is already registered for the siege, what more do you want from me?<br>";
str += "<a action=\"bypass -h npc_%objectId%_UnRegister\">Unsubscribe</a><br>";
str += "<a action=\"bypass -h npc_%objectId%_PlayerList\">Add / remove a member of the siege</a><br>";
}
else
{
final int res = WildBeastFarmSiege.getInstance().registerClanOnSiege(player, playerClan);
if (res == 0)
{
str += "Your clan : <font color=\"LEVEL\">" + player.getClan().getName() + "</font>, successfully registered for the siege clan hall.<br>";
str += "Now you need to select no more than 18 igokov who will take part in the siege, a member of your clan.<br>";
str += "<a action=\"bypass -h npc_%objectId%_PlayerList\">Select members of the siege</a><br>";
}
else if (res == 1)
{
str += "You have not passed the test and did not qualify for participation in the siege of Robbers<br>";
str += "Come back when you're done.";
}
else if (res == 2)
{
str += "Unfortunately, you are late. Five tribal leaders have already filed an application for registration.<br>";
str += "Next time be more raztoropny.";
}
}
break;
}
} }
str += "</body></html>"; str += "</body></html>";

View File

@@ -46,7 +46,6 @@ import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.residences.ClanHall; import org.l2jmobius.gameserver.model.residences.ClanHall;
import org.l2jmobius.gameserver.model.siege.Castle; import org.l2jmobius.gameserver.model.siege.Castle;
import org.l2jmobius.gameserver.model.siege.Fort; import org.l2jmobius.gameserver.model.siege.Fort;
import org.l2jmobius.gameserver.model.siege.clanhalls.DevastatedCastle;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.ConfirmDlg; import org.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
@@ -433,7 +432,7 @@ public class Door extends Creature
return false; return false;
} }
} }
return isCastle || isFort || DevastatedCastle.getInstance().isInProgress(); return isCastle || isFort;
} }
/** /**

View File

@@ -26,7 +26,6 @@ import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.knownlist.SiegeGuardKnownList; import org.l2jmobius.gameserver.model.actor.knownlist.SiegeGuardKnownList;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.siege.clanhalls.DevastatedCastle;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected; import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected;
import org.l2jmobius.gameserver.network.serverpackets.SocialAction; import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
@@ -80,7 +79,7 @@ public class SiegeGuard extends Attackable
public boolean isAutoAttackable(Creature attacker) public boolean isAutoAttackable(Creature attacker)
{ {
// Attackable during siege by all except defenders ( Castle or Fort ) // Attackable during siege by all except defenders ( Castle or Fort )
return (attacker instanceof Player) && (((getCastle() != null) && (getCastle().getCastleId() > 0) && getCastle().getSiege().isInProgress() && !getCastle().getSiege().checkIsDefender(((Player) attacker).getClan())) || DevastatedCastle.getInstance().isInProgress()); return (attacker instanceof Player) && ((getCastle() != null) && (getCastle().getCastleId() > 0) && getCastle().getSiege().isInProgress() && !getCastle().getSiege().checkIsDefender(((Player) attacker).getClan()));
} }
@Override @Override

View File

@@ -1,867 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.siege.clanhalls;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
import org.l2jmobius.gameserver.data.sql.ClanHallTable;
import org.l2jmobius.gameserver.data.sql.NpcTable;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.residences.ClanHall;
import org.l2jmobius.gameserver.model.spawn.Spawn;
public class DevastatedCastle
{
private static final Logger LOGGER = Logger.getLogger(DevastatedCastle.class.getName());
private final Map<Integer, DamageInfo> _clansDamageInfo;
private static int START_DAY = 1;
private static int HOUR = Config.DEVASTATED_HOUR;
private static int MINUTES = Config.DEVASTATED_MINUTES;
private static final int BOSS_ID = 35410; // Gustav @Boss@
private static final int BOSS1_ID = 35408; // Dietrich @Minion@
private static final int BOSS2_ID = 35409; // Mikhail @Minion@
private static final int MESSENGER_ID = 35420;
private ScheduledFuture<?> _gustav;
private ScheduledFuture<?> _dietrich;
private ScheduledFuture<?> _mikhail;
private ScheduledFuture<?> _monsterdespawn;
private Npc _minion1 = null;
private Npc _minion2 = null;
private final List<MonsterLocation> _monsters = new ArrayList<>();
private List<Spawn> _spawns = new ArrayList<>();
private final Calendar _siegetime = Calendar.getInstance();
public boolean _progress = false;
protected class DamageInfo
{
public Clan _clan;
public long _damage;
}
protected DevastatedCastle()
{
if (Config.DEVASTATED_DAY == 1)
{
START_DAY = Calendar.MONDAY;
}
else if (Config.DEVASTATED_DAY == 2)
{
START_DAY = Calendar.TUESDAY;
}
else if (Config.DEVASTATED_DAY == 3)
{
START_DAY = Calendar.WEDNESDAY;
}
else if (Config.DEVASTATED_DAY == 4)
{
START_DAY = Calendar.THURSDAY;
}
else if (Config.DEVASTATED_DAY == 5)
{
START_DAY = Calendar.FRIDAY;
}
else if (Config.DEVASTATED_DAY == 6)
{
START_DAY = Calendar.SATURDAY;
}
else if (Config.DEVASTATED_DAY == 7)
{
START_DAY = Calendar.SUNDAY;
}
else
{
START_DAY = Calendar.MONDAY;
}
if ((HOUR < 0) || (HOUR > 23))
{
HOUR = 18;
}
if ((MINUTES < 0) || (MINUTES > 59))
{
MINUTES = 0;
}
_clansDamageInfo = new HashMap<>();
synchronized (this)
{
setCalendarForNextSiege();
final long milliToSiege = getMilliToSiege();
final RunMessengerSpawn rms = new RunMessengerSpawn();
ThreadPool.schedule(rms, milliToSiege);
final long total_millis = System.currentTimeMillis() + milliToSiege;
final GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance();
cal.setTimeInMillis(total_millis);
final String next_ch_siege_date = new SimpleDateFormat("yyyy/MM/dd HH:mm").format(cal.getTimeInMillis());
LOGGER.info("Devastated Castle: siege will start the " + next_ch_siege_date);
}
}
private void setCalendarForNextSiege()
{
int daysToChange = getDaysToSiege();
if (daysToChange == 7)
{
if (_siegetime.get(Calendar.HOUR_OF_DAY) < HOUR)
{
daysToChange = 0;
}
else if ((_siegetime.get(Calendar.HOUR_OF_DAY) == HOUR) && (_siegetime.get(Calendar.MINUTE) < MINUTES))
{
daysToChange = 0;
}
}
if (daysToChange > 0)
{
_siegetime.add(Calendar.DATE, daysToChange);
}
_siegetime.set(Calendar.HOUR_OF_DAY, HOUR);
_siegetime.set(Calendar.MINUTE, MINUTES);
}
private int getDaysToSiege()
{
final int numDays = _siegetime.get(Calendar.DAY_OF_WEEK) - START_DAY;
if (numDays < 0)
{
return 0 - numDays;
}
return 7 - numDays;
}
private long getMilliToSiege()
{
final long currTimeMillis = System.currentTimeMillis();
final long siegeTimeMillis = _siegetime.getTimeInMillis();
return siegeTimeMillis - currTimeMillis;
}
protected class RunMessengerSpawn implements Runnable
{
@Override
public void run()
{
MessengerSpawn();
}
}
public void MessengerSpawn()
{
if (!ClanHallTable.getInstance().isFree(34))
{
ClanHallTable.getInstance().setFree(34);
}
Announce("Siege registration of Devastated castle has begun!");
Announce("Now its open for 2 hours!");
Npc result = null;
try
{
final NpcTemplate template = NpcTable.getInstance().getTemplate(MESSENGER_ID);
final Spawn spawn = new Spawn(template);
spawn.setX(179040);
spawn.setY(-13717);
spawn.setZ(-2263);
spawn.stopRespawn();
result = spawn.doSpawn();
}
catch (Exception e)
{
LOGGER.warning(e.toString());
}
final RunSiege rs = new RunSiege();
ThreadPool.schedule(rs, 14400000); // 4 * 60 * 60 * 1000
ThreadPool.schedule(new DeSpawnTimer(result), 7200000); // 2 * 60 * 60 * 1000
ThreadPool.schedule(new AnnounceInfo("Siege registration of Devastated castle is over!"), 7200000);
ThreadPool.schedule(new AnnounceInfo("2 hours until siege begin."), 7200000);
}
protected class AnnounceInfo implements Runnable
{
String _message;
public AnnounceInfo(String message)
{
_message = message;
}
@Override
public void run()
{
Announce(_message);
}
}
public void Announce(String message)
{
AnnouncementsTable.getInstance().announceToAll(message);
}
protected class RunSiege implements Runnable
{
@Override
public void run()
{
Siege();
}
}
public void Siege()
{
Npc result = null;
NpcTemplate template = null;
Spawn spawn = null;
final ClanHall ch = ClanHallTable.getInstance().getClanHallById(34);
ch.banishForeigners();
ch.spawnDoor();
setInProgress(true);
try
{
fillMonsters();
template = NpcTable.getInstance().getTemplate(BOSS_ID);
spawn = new Spawn(template);
spawn.setX(178298);
spawn.setY(-17624);
spawn.setZ(-2194);
spawn.stopRespawn();
result = spawn.doSpawn();
_gustav = ThreadPool.schedule(new DeSpawnTimer(result), 3600000); // 60 * 60 * 1000
template = NpcTable.getInstance().getTemplate(BOSS1_ID);
spawn = new Spawn(template);
spawn.setX(178306);
spawn.setY(-17535);
spawn.setZ(-2195);
spawn.stopRespawn();
_minion1 = spawn.doSpawn();
_dietrich = ThreadPool.schedule(new DeSpawnTimer(_minion1), 3600000); // 60 * 60 * 1000
template = NpcTable.getInstance().getTemplate(BOSS2_ID);
spawn = new Spawn(template);
spawn.setX(178304);
spawn.setY(-17712);
spawn.setZ(-2194);
spawn.stopRespawn();
_minion2 = spawn.doSpawn();
_mikhail = ThreadPool.schedule(new DeSpawnTimer(_minion2), 3600000); // 60 * 60 * 1000
spawnMonsters();
}
catch (Exception e)
{
LOGGER.warning(e.toString());
}
Announce("Siege of Devastated castle has begun!");
}
private static class MonsterLocation
{
private final int _id;
private final int _x;
private final int _y;
private final int _z;
private final int _heading;
protected MonsterLocation(int id, int x, int y, int z, int heading)
{
_id = id;
_x = x;
_y = y;
_z = z;
_heading = heading;
}
protected int getId()
{
return _id;
}
protected int getX()
{
return _x;
}
protected int getY()
{
return _y;
}
protected int getZ()
{
return _z;
}
protected int getHeading()
{
return _heading;
}
}
private void addMonster(int id, int x, int y, int z, int heading)
{
_monsters.add(new MonsterLocation(id, x, y, z, heading));
}
private void fillMonsters()
{
addMonster(35413, 178288, -14924, -2200, 6320);
addMonster(35412, 178255, -14884, -2200, 6320);
addMonster(35413, 178222, -14924, -2200, 6320);
addMonster(35412, 178222, -14884, -2200, 6320);
addMonster(35412, 178420, -14904, -2200, 6320);
addMonster(35412, 178387, -14904, -2200, 6320);
addMonster(35412, 178288, -14884, -2200, 6320);
addMonster(35412, 178387, -14884, -2200, 6320);
addMonster(35413, 178354, -14944, -2200, 6320);
addMonster(35412, 178321, -14884, -2200, 6320);
addMonster(35413, 178222, -14944, -2200, 6320);
addMonster(35412, 178354, -14904, -2200, 6320);
addMonster(35413, 178255, -14924, -2200, 6320);
addMonster(35413, 178387, -14924, -2200, 6320);
addMonster(35413, 178354, -14924, -2200, 6320);
addMonster(35413, 178420, -14924, -2200, 6320);
addMonster(35412, 178354, -14884, -2200, 6320);
addMonster(35412, 178420, -14884, -2200, 6320);
addMonster(35413, 178454, -14944, -2200, 6320);
addMonster(35413, 178454, -14924, -2200, 6320);
addMonster(35413, 178420, -14944, -2200, 6320);
addMonster(35412, 178222, -14904, -2200, 6320);
addMonster(35413, 178321, -14944, -2200, 6320);
addMonster(35413, 178321, -14924, -2200, 6320);
addMonster(35412, 178288, -14904, -2200, 6320);
addMonster(35412, 178321, -14904, -2200, 6320);
addMonster(35413, 178255, -14944, -2200, 6320);
addMonster(35412, 178255, -14904, -2200, 6320);
addMonster(35413, 178288, -14944, -2200, 6320);
addMonster(35412, 178454, -14884, -2200, 6320);
addMonster(35413, 178387, -14944, -2200, 6320);
addMonster(35412, 178454, -14904, -2200, 6320);
addMonster(35413, 179052, -15226, -2221, 6320);
addMonster(35413, 179260, -15341, -2221, 6320);
addMonster(35413, 179101, -15253, -2221, 6320);
addMonster(35413, 179073, -15203, -2221, 6320);
addMonster(35413, 179144, -15271, -2221, 6320);
addMonster(35413, 179246, -15285, -2221, 6320);
addMonster(35413, 179164, -15247, -2221, 6320);
addMonster(35413, 179226, -15309, -2221, 6320);
addMonster(35413, 179322, -15349, -2221, 6320);
addMonster(35413, 179302, -15372, -2221, 6320);
addMonster(35413, 179189, -15286, -2221, 6320);
addMonster(35413, 179391, -15439, -2221, 6320);
addMonster(35413, 179341, -15406, -2221, 6320);
addMonster(35415, 179503, -15925, -2256, 6320);
addMonster(35415, 179562, -15984, -2256, 6320);
addMonster(35415, 179491, -15981, -2256, 6320);
addMonster(35415, 179370, -16196, -2256, 6320);
addMonster(35411, 179426, -16009, -2253, 6320);
addMonster(35415, 179544, -15882, -2256, 6320);
addMonster(35415, 179599, -15943, -2256, 6320);
addMonster(35415, 179570, -15901, -2256, 6320);
addMonster(35415, 179408, -16158, -2256, 6320);
addMonster(35415, 179279, -16219, -2256, 6320);
addMonster(35411, 179327, -16101, -2253, 6320);
addMonster(35411, 179540, -16876, -2246, 6320);
addMonster(35413, 179009, -15201, -2221, 6320);
addMonster(35413, 178951, -14699, -2080, 6320);
addMonster(35413, 178801, -14975, -2080, 6320);
addMonster(35413, 178865, -14857, -2080, 6320);
addMonster(35413, 178822, -14936, -2080, 6320);
addMonster(35413, 178843, -14897, -2080, 6320);
addMonster(35413, 178929, -14739, -2080, 6320);
addMonster(35413, 178908, -14778, -2080, 6320);
addMonster(35413, 178886, -14818, -2080, 6320);
addMonster(35411, 177719, -15951, -2253, 6320);
addMonster(35413, 177838, -15664, -2226, 6320);
addMonster(35411, 177627, -15953, -2250, 6320);
addMonster(35411, 177387, -15955, -2250, 6320);
addMonster(35411, 177667, -15921, -2253, 6320);
addMonster(35413, 177859, -15812, -2226, 6320);
addMonster(35411, 177661, -16014, -2253, 6320);
addMonster(35411, 177608, -15985, -2250, 6320);
addMonster(35415, 177663, -16154, -2250, 6320);
addMonster(35415, 177530, -16079, -2250, 6320);
addMonster(35411, 177709, -16043, -2253, 6320);
addMonster(35411, 177703, -15999, -2250, 6320);
addMonster(35411, 177810, -16145, -2253, 6320);
addMonster(35415, 177571, -16105, -2250, 6320);
addMonster(35415, 177473, -16011, -2250, 6320);
addMonster(35415, 177612, -16090, -2250, 6320);
addMonster(35415, 177657, -16113, -2250, 6320);
addMonster(35415, 177387, -15996, -2250, 6320);
addMonster(35411, 177564, -15963, -2250, 6320);
addMonster(35411, 177606, -16035, -2253, 6320);
addMonster(35411, 177470, -15856, -2250, 6320);
addMonster(35415, 177428, -15981, -2250, 6320);
addMonster(35411, 177506, -15887, -2250, 6320);
addMonster(35411, 177517, -15930, -2250, 6320);
addMonster(35411, 177308, -15861, -2253, 6320);
addMonster(35411, 177861, -16164, -2253, 6320);
addMonster(35413, 177906, -15791, -2226, 6320);
addMonster(35413, 177765, -15643, -2226, 6320);
addMonster(35413, 177880, -15744, -2226, 6320);
addMonster(35413, 177788, -15578, -2226, 6320);
addMonster(35413, 177811, -15622, -2226, 6320);
addMonster(35413, 177859, -15704, -2226, 6320);
addMonster(35413, 177769, -15540, -2226, 6320);
addMonster(35413, 177813, -15726, -2226, 6320);
addMonster(35413, 177707, -15427, -2226, 6320);
addMonster(35413, 177680, -15485, -2226, 6320);
addMonster(35413, 177722, -15561, -2226, 6320);
addMonster(35413, 177745, -15498, -2226, 6320);
addMonster(35413, 177803, -14971, -2210, 6320);
addMonster(35413, 177727, -15464, -2226, 6320);
addMonster(35415, 177433, -16026, -2250, 6320);
addMonster(35413, 177649, -14750, -2210, 6320);
addMonster(35413, 177619, -14705, -2210, 6320);
addMonster(35413, 177711, -14838, -2210, 6320);
addMonster(35413, 177834, -15015, -2210, 6320);
addMonster(35413, 177741, -14883, -2210, 6320);
addMonster(35413, 177772, -14927, -2210, 6320);
addMonster(35413, 177680, -14794, -2210, 6320);
addMonster(35411, 177400, -15854, -2250, 6320);
addMonster(35415, 179697, -17781, -2256, 6320);
addMonster(35411, 179479, -17133, -2256, 6320);
addMonster(35411, 179485, -17213, -2246, 6320);
addMonster(35411, 179593, -16876, -2246, 6320);
addMonster(35411, 179468, -17280, -2256, 6320);
addMonster(35411, 179433, -16991, -2246, 6320);
addMonster(35411, 179514, -17281, -2256, 6320);
addMonster(35411, 179525, -17135, -2256, 6320);
addMonster(35411, 179444, -16937, -2256, 6320);
addMonster(35411, 179438, -16875, -2246, 6320);
addMonster(35415, 179633, -17137, -2256, 6320);
addMonster(35411, 179537, -17214, -2246, 6320);
addMonster(35411, 179594, -17453, -2246, 6320);
addMonster(35415, 179576, -17137, -2256, 6320);
addMonster(35415, 179508, -17341, -2252, 6320);
addMonster(35415, 179446, -17391, -2252, 6320);
addMonster(35415, 179437, -17522, -2252, 6320);
addMonster(35415, 179536, -17842, -2252, 6320);
addMonster(35415, 179432, -17719, -2252, 6320);
addMonster(35415, 179436, -17841, -2252, 6320);
addMonster(35411, 179542, -17453, -2246, 6320);
addMonster(35415, 179436, -17776, -2256, 6320);
addMonster(35415, 179534, -17892, -2252, 6320);
addMonster(35415, 179482, -17841, -2252, 6320);
addMonster(35415, 179696, -17844, -2252, 6320);
addMonster(35415, 179604, -17525, -2252, 6320);
addMonster(35415, 179707, -17722, -2252, 6320);
addMonster(35411, 179715, -17454, -2246, 6320);
addMonster(35411, 179641, -17215, -2246, 6320);
addMonster(35415, 179665, -17527, -2252, 6320);
addMonster(35415, 179557, -17524, -2252, 6320);
addMonster(35415, 179636, -17780, -2256, 6320);
addMonster(35415, 179694, -17897, -2252, 6320);
addMonster(35414, 178682, -18200, -2200, 6320);
addMonster(35413, 178577, -18422, -2250, 6320);
addMonster(35412, 178745, -18186, -2200, 6320);
addMonster(35413, 178528, -18499, -2250, 6320);
addMonster(35414, 178640, -18196, -2200, 6320);
addMonster(35413, 178766, -18228, -2200, 6320);
addMonster(35412, 178724, -18184, -2200, 6320);
addMonster(35412, 178703, -18182, -2200, 6320);
addMonster(35413, 178575, -18500, -2250, 6320);
addMonster(35413, 178703, -18222, -2200, 6320);
addMonster(35413, 178530, -18421, -2250, 6320);
addMonster(35413, 178523, -18696, -2250, 6320);
addMonster(35412, 178661, -18178, -2200, 6320);
addMonster(35414, 178661, -18198, -2200, 6320);
addMonster(35413, 178788, -18229, -2200, 6320);
addMonster(35414, 178724, -18204, -2200, 6320);
addMonster(35413, 178574, -18539, -2250, 6320);
addMonster(35413, 178578, -18383, -2250, 6320);
addMonster(35413, 178573, -18577, -2250, 6320);
addMonster(35413, 178530, -18382, -2250, 6320);
addMonster(35413, 178528, -18461, -2250, 6320);
addMonster(35413, 178526, -18538, -2250, 6320);
addMonster(35413, 178526, -18576, -2250, 6320);
addMonster(35413, 178570, -18736, -2250, 6320);
addMonster(35413, 178524, -18618, -2250, 6320);
addMonster(35413, 178571, -18657, -2250, 6320);
addMonster(35413, 178523, -18656, -2250, 6320);
addMonster(35413, 178523, -18735, -2250, 6320);
addMonster(35413, 178571, -18618, -2250, 6320);
addMonster(35413, 178571, -18697, -2250, 6320);
addMonster(35413, 178576, -18461, -2250, 6320);
addMonster(35413, 178682, -18220, -2200, 6320);
addMonster(35413, 178661, -18218, -2200, 6320);
addMonster(35414, 178745, -18206, -2200, 6320);
addMonster(35412, 178682, -18180, -2200, 6320);
addMonster(35414, 178703, -18202, -2200, 6320);
addMonster(35412, 178640, -18176, -2200, 6320);
addMonster(35414, 178788, -18209, -2200, 6320);
addMonster(35413, 178640, -18216, -2200, 6320);
addMonster(35412, 178788, -18189, -2200, 6320);
addMonster(35413, 178745, -18226, -2200, 6320);
addMonster(35414, 178766, -18208, -2200, 6320);
addMonster(35412, 178766, -18188, -2200, 6320);
addMonster(35413, 178724, -18224, -2200, 6320);
addMonster(35413, 178430, -16901, -2217, 6320);
addMonster(35415, 178285, -16832, -2217, 6320);
addMonster(35413, 178153, -16914, -2217, 6320);
addMonster(35411, 178398, -16781, -2218, 6320);
addMonster(35415, 178363, -16768, -2217, 6320);
addMonster(35413, 178437, -16587, -2217, 6320);
addMonster(35413, 178431, -16784, -2217, 6320);
addMonster(35411, 178120, -16714, -2218, 6320);
addMonster(35415, 178366, -16721, -2217, 6320);
addMonster(35413, 178433, -16742, -2217, 6320);
addMonster(35413, 178430, -16862, -2217, 6320);
addMonster(35411, 178395, -16865, -2218, 6320);
addMonster(35415, 178288, -16783, -2217, 6320);
addMonster(35411, 178397, -16824, -2218, 6320);
addMonster(35415, 178090, -16878, -2217, 6320);
addMonster(35413, 178154, -16797, -2217, 6320);
addMonster(35415, 178027, -16773, -2217, 6320);
addMonster(35413, 178435, -16665, -2217, 6320);
addMonster(35413, 178433, -16704, -2217, 6320);
addMonster(35411, 178060, -16868, -2218, 6320);
addMonster(35413, 178156, -16718, -2217, 6320);
addMonster(35411, 178324, -16762, -2218, 6320);
addMonster(35413, 177869, -16832, -2217, 6320);
addMonster(35411, 178117, -16885, -2218, 6320);
addMonster(35415, 178366, -16674, -2217, 6320);
addMonster(35413, 178435, -16627, -2217, 6320);
addMonster(35415, 178366, -16582, -2217, 6320);
addMonster(35411, 178403, -16566, -2218, 6320);
addMonster(35413, 178437, -16548, -2217, 6320);
addMonster(35415, 178290, -16550, -2217, 6320);
addMonster(35413, 178160, -16600, -2217, 6320);
addMonster(35411, 178122, -16759, -2218, 6320);
addMonster(35411, 178122, -16672, -2218, 6320);
addMonster(35415, 178095, -16736, -2217, 6320);
addMonster(35411, 178324, -16804, -2218, 6320);
addMonster(35415, 178029, -16587, -2217, 6320);
addMonster(35415, 178290, -16690, -2217, 6320);
addMonster(35415, 178027, -16820, -2217, 6320);
addMonster(35413, 178431, -16822, -2217, 6320);
addMonster(35411, 178326, -16720, -2218, 6320);
addMonster(35413, 178158, -16679, -2217, 6320);
addMonster(35413, 178161, -16562, -2217, 6320);
addMonster(35413, 178158, -16640, -2217, 6320);
addMonster(35413, 177872, -16714, -2217, 6320);
addMonster(35411, 178061, -16738, -2218, 6320);
addMonster(35413, 177871, -16752, -2217, 6320);
addMonster(35413, 177876, -16597, -2217, 6320);
addMonster(35413, 177873, -16675, -2217, 6320);
addMonster(35413, 177869, -16873, -2217, 6320);
addMonster(35413, 177874, -16637, -2217, 6320);
addMonster(35411, 178060, -16826, -2218, 6320);
addMonster(35411, 178063, -16784, -2218, 6320);
addMonster(35415, 178029, -16727, -2217, 6320);
addMonster(35413, 177876, -16558, -2217, 6320);
addMonster(35413, 177870, -16794, -2217, 6320);
addMonster(35413, 177868, -16911, -2217, 6320);
addMonster(35413, 178156, -16756, -2217, 6320);
addMonster(35415, 178092, -16782, -2217, 6320);
addMonster(35413, 178153, -16876, -2217, 6320);
addMonster(35413, 178154, -16836, -2217, 6320);
addMonster(35412, 177217, -17168, -2200, 6320);
addMonster(35413, 177187, -17128, -2200, 6320);
addMonster(35413, 177276, -17128, -2200, 6320);
addMonster(35413, 177335, -17128, -2200, 6320);
addMonster(35414, 177246, -17148, -2200, 6320);
addMonster(35412, 177246, -17168, -2200, 6320);
addMonster(35412, 177129, -17168, -2200, 6320);
addMonster(35412, 177158, -17168, -2200, 6320);
addMonster(35413, 177217, -17128, -2200, 6320);
addMonster(35413, 177158, -17128, -2200, 6320);
addMonster(35413, 177129, -17128, -2200, 6320);
addMonster(35414, 177129, -17148, -2200, 6320);
addMonster(35412, 177276, -17168, -2200, 6320);
addMonster(35414, 177158, -17148, -2200, 6320);
addMonster(35413, 177305, -17128, -2200, 6320);
addMonster(35412, 177187, -17168, -2200, 6320);
addMonster(35414, 177305, -17148, -2200, 6320);
addMonster(35413, 177396, -17452, -2207, 6320);
addMonster(35413, 177397, -17634, -2207, 6320);
addMonster(35416, 177664, -17599, -2219, 6320);
addMonster(35416, 177721, -17813, -2219, 6320);
addMonster(35416, 177501, -17424, -2219, 6320);
addMonster(35415, 177632, -17788, -2215, 6320);
addMonster(35413, 177466, -17445, -2207, 6320);
addMonster(35414, 177217, -17148, -2200, 6320);
addMonster(35413, 177396, -17545, -2207, 6320);
addMonster(35414, 177187, -17148, -2200, 6320);
addMonster(35414, 177335, -17148, -2200, 6320);
addMonster(35412, 177335, -17168, -2200, 6320);
addMonster(35412, 177305, -17168, -2200, 6320);
addMonster(35415, 177439, -17426, -2215, 6320);
addMonster(35415, 177438, -17472, -2215, 6320);
addMonster(35416, 177662, -17685, -2219, 6320);
addMonster(35415, 177527, -17578, -2215, 6320);
addMonster(35415, 177531, -17399, -2215, 6320);
addMonster(35415, 177561, -17563, -2215, 6320);
addMonster(35413, 177604, -17718, -2207, 6320);
addMonster(35413, 177466, -17537, -2207, 6320);
addMonster(35416, 177500, -17469, -2219, 6320);
addMonster(35415, 177527, -17537, -2215, 6320);
addMonster(35413, 177467, -17809, -2207, 6320);
addMonster(35413, 177466, -17716, -2207, 6320);
addMonster(35416, 177496, -17645, -2219, 6320);
addMonster(35413, 177398, -17817, -2207, 6320);
addMonster(35416, 177560, -17849, -2219, 6320);
addMonster(35415, 177524, -17763, -2215, 6320);
addMonster(35415, 177432, -17791, -2215, 6320);
addMonster(35413, 177397, -17723, -2207, 6320);
addMonster(35415, 177523, -17810, -2215, 6320);
addMonster(35416, 177501, -17384, -2219, 6320);
addMonster(35413, 177603, -17539, -2207, 6320);
addMonster(35416, 177725, -17503, -2219, 6320);
addMonster(35416, 177666, -17508, -2219, 6320);
addMonster(35415, 177564, -17425, -2215, 6320);
addMonster(35413, 177749, -17538, -2207, 6320);
addMonster(35413, 177603, -17446, -2207, 6320);
addMonster(35413, 177749, -17446, -2207, 6320);
addMonster(35416, 177728, -17377, -2219, 6320);
addMonster(35415, 177440, -17380, -2215, 6320);
addMonster(35416, 177567, -17376, -2219, 6320);
addMonster(35414, 177276, -17148, -2200, 6320);
addMonster(35416, 177724, -17594, -2219, 6320);
addMonster(35415, 177436, -17605, -2215, 6320);
addMonster(35415, 177636, -17516, -2215, 6320);
addMonster(35413, 177601, -17811, -2207, 6320);
addMonster(35413, 177693, -17718, -2207, 6320);
addMonster(35416, 177722, -17728, -2219, 6320);
addMonster(35415, 177559, -17708, -2215, 6320);
addMonster(35416, 177662, -17644, -2219, 6320);
addMonster(35415, 177635, -17603, -2215, 6320);
addMonster(35413, 177694, -17811, -2207, 6320);
addMonster(35415, 177558, -17755, -2215, 6320);
addMonster(35413, 177693, -17447, -2207, 6320);
addMonster(35413, 177693, -17629, -2207, 6320);
addMonster(35416, 177664, -17559, -2219, 6320);
addMonster(35413, 177466, -17397, -2207, 6320);
addMonster(35413, 177466, -17627, -2207, 6320);
addMonster(35416, 177724, -17553, -2219, 6320);
addMonster(35413, 177750, -17628, -2207, 6320);
addMonster(35413, 177751, -17810, -2207, 6320);
addMonster(35416, 177661, -17818, -2219, 6320);
addMonster(35416, 177496, -17686, -2219, 6320);
addMonster(35413, 177750, -17717, -2207, 6320);
addMonster(35415, 177633, -17740, -2215, 6320);
addMonster(35413, 177693, -17539, -2207, 6320);
addMonster(35413, 177604, -17628, -2207, 6320);
addMonster(35415, 177431, -17836, -2215, 6320);
addMonster(35415, 177631, -17835, -2215, 6320);
addMonster(35416, 177722, -17768, -2219, 6320);
addMonster(35413, 177246, -17128, -2200, 6320);
}
public void spawnMonsters()
{
for (MonsterLocation ml : _monsters)
{
try
{
final NpcTemplate template = NpcTable.getInstance().getTemplate(ml.getId());
final Spawn sp = new Spawn(template);
sp.setAmount(1);
sp.setX(ml.getX());
sp.setY(ml.getY());
sp.setZ(ml.getZ());
sp.setHeading(ml.getHeading());
sp.setRespawnDelay(300); // 3 * 60
sp.setLocation(0);
sp.init();
_spawns.add(sp);
}
catch (Exception e)
{
LOGGER.warning(e.toString());
}
}
_monsterdespawn = ThreadPool.schedule(new DeSpawnMonsters(), 3600000); // 60 * 60 * 1000
}
protected class DeSpawnMonsters implements Runnable
{
@Override
public void run()
{
DeSpawn();
}
}
public void DeSpawn()
{
for (Spawn sp : _spawns)
{
sp.stopRespawn();
sp.getLastSpawn().doDie(sp.getLastSpawn());
}
_spawns.clear();
setInProgress(false);
_spawns = null;
}
protected class DeSpawnTimer implements Runnable
{
Npc _npc = null;
public DeSpawnTimer(Npc npc)
{
_npc = npc;
}
@Override
public void run()
{
if (_npc.getNpcId() == 35410)
{
Announce("Siege of Devastated castle is over.");
Announce("Nobody won! ClanHall belong to NPC until next siege.");
final ClanHall ch = ClanHallTable.getInstance().getClanHallById(34);
ch.banishForeigners();
ch.spawnDoor();
}
_npc.onDecay();
}
}
public boolean Conditions(Player player)
{
return (player != null) && (player.getClan() != null) && player.isClanLeader() && (player.getClan().getAuctionBiddedAt() <= 0) && (ClanHallTable.getInstance().getClanHallByOwner(player.getClan()) == null) && (player.getClan().getLevel() > 3);
}
public boolean isInProgress()
{
return _progress;
}
public void setInProgress(boolean is)
{
_progress = is;
}
public void SiegeFinish()
{
Clan clanIdMaxDamage = null;
long tempMaxDamage = 0;
for (DamageInfo damageInfo : _clansDamageInfo.values())
{
if ((damageInfo != null) && (damageInfo._damage > tempMaxDamage))
{
tempMaxDamage = damageInfo._damage;
clanIdMaxDamage = damageInfo._clan;
}
}
if (clanIdMaxDamage != null)
{
ClanHallTable.getInstance().setOwner(34, clanIdMaxDamage);
clanIdMaxDamage.setReputationScore(clanIdMaxDamage.getReputationScore() + 600);
update();
Announce("Siege of Devastated castle is over.");
Announce("Now its belong to: '" + clanIdMaxDamage.getName() + "' until next siege.");
}
else
{
Announce("Siege of Devastated castle is over..");
Announce("Nobody won! ClanHall belong to NPC until next siege.");
}
DeSpawn();
_minion1.onDecay();
_minion2.onDecay();
_gustav.cancel(true);
_dietrich.cancel(true);
_mikhail.cancel(true);
_monsterdespawn.cancel(true);
final ClanHall ch = ClanHallTable.getInstance().getClanHallById(34);
ch.banishForeigners();
ch.spawnDoor();
}
public void addSiegeDamage(Clan clan, long damage)
{
DamageInfo clanDamage = _clansDamageInfo.get(clan.getClanId());
if (clanDamage != null)
{
clanDamage._damage += damage;
}
else
{
clanDamage = new DamageInfo();
clanDamage._clan = clan;
clanDamage._damage += damage;
_clansDamageInfo.put(clan.getClanId(), clanDamage);
}
}
private void update()
{
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("UPDATE clanhall SET paidUntil=?, paid=? WHERE id=?");
statement.setLong(1, System.currentTimeMillis() + 59760000);
statement.setInt(2, 1);
statement.setInt(3, 34);
statement.execute();
statement.close();
}
catch (Exception e)
{
LOGGER.info("Exception: updateOwnerInDB(Pledge clan): " + e);
}
}
public static DevastatedCastle getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final DevastatedCastle INSTANCE = new DevastatedCastle();
}
}

View File

@@ -1,648 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.siege.clanhalls;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;
import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.data.sql.ClanHallTable;
import org.l2jmobius.gameserver.data.sql.ClanTable;
import org.l2jmobius.gameserver.data.sql.NpcTable;
import org.l2jmobius.gameserver.data.xml.DoorData;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.instancemanager.IdManager;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.instance.Deco;
import org.l2jmobius.gameserver.model.actor.instance.Monster;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.residences.ClanHall;
import org.l2jmobius.gameserver.model.siege.ClanHallSiege;
import org.l2jmobius.gameserver.model.zone.type.ClanHallZone;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.taskmanager.ExclusiveTask;
public class WildBeastFarmSiege extends ClanHallSiege
{
protected static final Logger LOGGER = Logger.getLogger(WildBeastFarmSiege.class.getName());
boolean _registrationPeriod = false;
private int _clanCounter = 0;
protected Map<Integer, clanPlayersInfo> _clansInfo = new HashMap<>();
public ClanHall clanhall = ClanHallTable.getInstance().getClanHallById(63);
protected clanPlayersInfo _ownerClanInfo = new clanPlayersInfo();
protected boolean _finalStage = false;
protected ScheduledFuture<?> _midTimer;
protected WildBeastFarmSiege()
{
LOGGER.info("SiegeManager of Wild Beasts Farm");
final long siegeDate = restoreSiegeDate(63);
final Calendar tmpDate = Calendar.getInstance();
tmpDate.setTimeInMillis(siegeDate);
setSiegeDate(tmpDate);
setNewSiegeDate(siegeDate, 63, 22);
// Schedule siege auto start
_startSiegeTask.schedule(1000);
}
public void startSiege()
{
setRegistrationPeriod(false);
if (_clansInfo.isEmpty())
{
endSiege(false);
return;
}
if ((_clansInfo.size() == 1) && (clanhall.getOwnerClan() == null))
{
endSiege(false);
return;
}
if ((_clansInfo.size() == 1) && (clanhall.getOwnerClan() != null))
{
Clan clan = null;
for (clanPlayersInfo a : _clansInfo.values())
{
clan = ClanTable.getInstance().getClanByName(a._clanName);
}
setInProgress(true);
startSecondStep(clan);
anonce("Take place at the siege of his headquarters.", 1);
_siegeEndDate = Calendar.getInstance();
_siegeEndDate.add(Calendar.MINUTE, 30);
_endSiegeTask.schedule(1000);
return;
}
setInProgress(true);
spawnFlags();
gateControl(1);
anonce("Take place at the siege of his headquarters.", 1);
ThreadPool.schedule(new startFirstStep(), 5 * 60000);
_midTimer = ThreadPool.schedule(new midSiegeStep(), 25 * 60000);
_siegeEndDate = Calendar.getInstance();
_siegeEndDate.add(Calendar.MINUTE, 60);
_endSiegeTask.schedule(1000);
}
public void startSecondStep(Clan winner)
{
final List<String> winPlayers = getInstance().getRegisteredPlayers(winner);
unSpawnAll();
_clansInfo.clear();
final clanPlayersInfo regPlayers = new clanPlayersInfo();
regPlayers._clanName = winner.getName();
regPlayers._players = winPlayers;
_clansInfo.put(winner.getClanId(), regPlayers);
_clansInfo.put(clanhall.getOwnerClan().getClanId(), _ownerClanInfo);
spawnFlags();
gateControl(1);
_finalStage = true;
anonce("Take place at the siege of his headquarters.", 1);
ThreadPool.schedule(new startFirstStep(), 5 * 60000);
}
public void endSiege(boolean par)
{
_mobControlTask.cancel();
_finalStage = false;
if (par)
{
final Clan winner = checkHaveWinner();
if (winner != null)
{
ClanHallTable.getInstance().setOwner(clanhall.getId(), winner);
anonce("Attention! Clan hall, farm beasts was conquered by the clan " + winner.getName(), 2);
}
else
{
anonce("Attention! Clan hall, farm wild animals did not get new owner", 2);
}
}
setInProgress(false);
unSpawnAll();
_clansInfo.clear();
_clanCounter = 0;
teleportPlayers();
setNewSiegeDate(getSiegeDate().getTimeInMillis(), 63, 22);
_startSiegeTask.schedule(1000);
}
public void unSpawnAll()
{
for (String clanName : getRegisteredClans())
{
final Clan clan = ClanTable.getInstance().getClanByName(clanName);
final Monster mob = getQuestMob(clan);
final Deco flag = getSiegeFlag(clan);
if (mob != null)
{
mob.deleteMe();
}
if (flag != null)
{
flag.deleteMe();
}
}
}
public void gateControl(int value)
{
if (value == 1)
{
DoorData.getInstance().getDoor(21150003).openMe();
DoorData.getInstance().getDoor(21150004).openMe();
DoorData.getInstance().getDoor(21150001).closeMe();
DoorData.getInstance().getDoor(21150002).closeMe();
}
else if (value == 2)
{
DoorData.getInstance().getDoor(21150001).closeMe();
DoorData.getInstance().getDoor(21150002).closeMe();
DoorData.getInstance().getDoor(21150003).closeMe();
DoorData.getInstance().getDoor(21150004).closeMe();
}
}
public void teleportPlayers()
{
final ClanHallZone zone = clanhall.getZone();
for (Creature creature : zone.getCharactersInside())
{
if (creature instanceof Player)
{
final Clan clan = ((Player) creature).getClan();
if (!isPlayerRegister(clan, creature.getName()))
{
creature.teleToLocation(53468, -94092, -1634);
}
}
}
}
public Clan checkHaveWinner()
{
Clan res = null;
int questMobCount = 0;
for (String clanName : getRegisteredClans())
{
final Clan clan = ClanTable.getInstance().getClanByName(clanName);
if (getQuestMob(clan) != null)
{
res = clan;
questMobCount++;
}
}
if (questMobCount > 1)
{
return null;
}
return res;
}
protected class midSiegeStep implements Runnable
{
@Override
public void run()
{
_mobControlTask.cancel();
final Clan winner = checkHaveWinner();
if (winner != null)
{
if (clanhall.getOwnerClan() == null)
{
ClanHallTable.getInstance().setOwner(clanhall.getId(), winner);
anonce("Attention! Hall clan Fkrma wild animals was conquered by the clan " + winner.getName(), 2);
endSiege(false);
}
else
{
startSecondStep(winner);
}
}
else
{
endSiege(true);
}
}
}
protected class startFirstStep implements Runnable
{
@Override
public void run()
{
teleportPlayers();
gateControl(2);
int mobCounter = 1;
for (String clanName : getRegisteredClans())
{
NpcTemplate template;
final Clan clan = ClanTable.getInstance().getClanByName(clanName);
template = NpcTable.getInstance().getTemplate(35617 + mobCounter);
final Monster questMob = new Monster(IdManager.getInstance().getNextId(), template);
questMob.setHeading(100);
questMob.getStatus().setCurrentHpMp(questMob.getMaxHp(), questMob.getMaxMp());
if (mobCounter == 1)
{
questMob.spawnMe(57069, -91797, -1360);
}
else if (mobCounter == 2)
{
questMob.spawnMe(58838, -92232, -1354);
}
else if (mobCounter == 3)
{
questMob.spawnMe(57327, -93373, -1365);
}
else if (mobCounter == 4)
{
questMob.spawnMe(57820, -91740, -1354);
}
else if (mobCounter == 5)
{
questMob.spawnMe(58728, -93487, -1360);
}
final clanPlayersInfo regPlayers = _clansInfo.get(clan.getClanId());
regPlayers._mob = questMob;
mobCounter++;
}
_mobControlTask.schedule(3000);
anonce("The battle began. Kill the enemy NPC", 1);
}
}
public void spawnFlags()
{
int flagCounter = 1;
for (String clanName : getRegisteredClans())
{
NpcTemplate template;
final Clan clan = ClanTable.getInstance().getClanByName(clanName);
if (clan == clanhall.getOwnerClan())
{
template = NpcTable.getInstance().getTemplate(35422);
}
else
{
template = NpcTable.getInstance().getTemplate(35422 + flagCounter);
}
final Deco flag = new Deco(IdManager.getInstance().getNextId(), template);
flag.setTitle(clan.getName());
flag.setHeading(100);
flag.getStatus().setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
if (clan == clanhall.getOwnerClan())
{
flag.spawnMe(58782, -93180, -1354);
final clanPlayersInfo regPlayers = _clansInfo.get(clan.getClanId());
regPlayers._flag = flag;
continue;
}
if (flagCounter == 1)
{
flag.spawnMe(56769, -92097, -1360);
}
else if (flagCounter == 2)
{
flag.spawnMe(59138, -92532, -1354);
}
else if (flagCounter == 3)
{
flag.spawnMe(57027, -93673, -1365);
}
else if (flagCounter == 4)
{
flag.spawnMe(58120, -91440, -1354);
}
else if (flagCounter == 5)
{
flag.spawnMe(58428, -93787, -1360);
}
final clanPlayersInfo regPlayers = _clansInfo.get(clan.getClanId());
regPlayers._flag = flag;
flagCounter++;
}
}
public void setRegistrationPeriod(boolean par)
{
_registrationPeriod = par;
}
public boolean isRegistrationPeriod()
{
return _registrationPeriod;
}
public boolean isPlayerRegister(Clan playerClan, String playerName)
{
if (playerClan == null)
{
return false;
}
final clanPlayersInfo regPlayers = _clansInfo.get(playerClan.getClanId());
return (regPlayers != null) && regPlayers._players.contains(playerName);
}
public boolean isClanOnSiege(Clan playerClan)
{
if (playerClan == clanhall.getOwnerClan())
{
return true;
}
final clanPlayersInfo regPlayers = _clansInfo.get(playerClan.getClanId());
return regPlayers != null;
}
public synchronized int registerClanOnSiege(Player player, Clan playerClan)
{
if (_clanCounter == 5)
{
return 2;
}
final Item item = player.getInventory().getItemByItemId(8293);
if ((item != null) && player.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false))
{
_clanCounter++;
clanPlayersInfo regPlayers = _clansInfo.get(playerClan.getClanId());
if (regPlayers == null)
{
regPlayers = new clanPlayersInfo();
regPlayers._clanName = playerClan.getName();
_clansInfo.put(playerClan.getClanId(), regPlayers);
}
}
else
{
return 1;
}
return 0;
}
public boolean unRegisterClan(Clan playerClan)
{
if (_clansInfo.remove(playerClan.getClanId()) != null)
{
_clanCounter--;
return true;
}
return false;
}
public List<String> getRegisteredClans()
{
final List<String> clans = new ArrayList<>();
for (clanPlayersInfo a : _clansInfo.values())
{
clans.add(a._clanName);
}
return clans;
}
public List<String> getRegisteredPlayers(Clan playerClan)
{
if (playerClan == clanhall.getOwnerClan())
{
return _ownerClanInfo._players;
}
final clanPlayersInfo regPlayers = _clansInfo.get(playerClan.getClanId());
if (regPlayers != null)
{
return regPlayers._players;
}
return null;
}
public Deco getSiegeFlag(Clan playerClan)
{
final clanPlayersInfo clanInfo = _clansInfo.get(playerClan.getClanId());
if (clanInfo != null)
{
return clanInfo._flag;
}
return null;
}
public Monster getQuestMob(Clan clan)
{
final clanPlayersInfo clanInfo = _clansInfo.get(clan.getClanId());
if (clanInfo != null)
{
return clanInfo._mob;
}
return null;
}
public int getPlayersCount(String playerClan)
{
for (clanPlayersInfo a : _clansInfo.values())
{
if (a._clanName.equalsIgnoreCase(playerClan))
{
return a._players.size();
}
}
return 0;
}
public void addPlayer(Clan playerClan, String playerName)
{
if ((playerClan == clanhall.getOwnerClan()) && (_ownerClanInfo._players.size() < 18) && !_ownerClanInfo._players.contains(playerName))
{
_ownerClanInfo._players.add(playerName);
return;
}
final clanPlayersInfo regPlayers = _clansInfo.get(playerClan.getClanId());
if ((regPlayers != null) && (regPlayers._players.size() < 18) && !regPlayers._players.contains(playerName))
{
regPlayers._players.add(playerName);
}
}
public void removePlayer(Clan playerClan, String playerName)
{
if ((playerClan == clanhall.getOwnerClan()) && _ownerClanInfo._players.contains(playerName))
{
_ownerClanInfo._players.remove(playerName);
return;
}
final clanPlayersInfo regPlayers = _clansInfo.get(playerClan.getClanId());
if ((regPlayers != null) && regPlayers._players.contains(playerName))
{
regPlayers._players.remove(playerName);
}
}
private final ExclusiveTask _startSiegeTask = new ExclusiveTask()
{
@Override
protected void onElapsed()
{
if (isInProgress())
{
cancel();
return;
}
final Calendar siegeStart = Calendar.getInstance();
siegeStart.setTimeInMillis(getSiegeDate().getTimeInMillis());
final long registerTimeRemaining = siegeStart.getTimeInMillis() - System.currentTimeMillis();
siegeStart.add(Calendar.HOUR, 1);
final long siegeTimeRemaining = siegeStart.getTimeInMillis() - System.currentTimeMillis();
long remaining = registerTimeRemaining;
if ((registerTimeRemaining <= 0) && !_registrationPeriod)
{
if (clanhall.getOwnerClan() != null)
{
_ownerClanInfo._clanName = clanhall.getOwnerClan().getName();
}
else
{
_ownerClanInfo._clanName = "";
}
setRegistrationPeriod(true);
anonce("Attention! The period of registration at the siege clan hall, farm wild animals.", 2);
remaining = siegeTimeRemaining;
}
if (siegeTimeRemaining <= 0)
{
startSiege();
cancel();
return;
}
schedule(remaining);
}
};
public void anonce(String text, int type)
{
if (type == 1)
{
final CreatureSay cs = new CreatureSay(0, ChatType.SHOUT, "Journal", text);
for (String clanName : getRegisteredClans())
{
final Clan clan = ClanTable.getInstance().getClanByName(clanName);
for (String playerName : getRegisteredPlayers(clan))
{
final Player cha = World.getInstance().getPlayer(playerName);
if (cha != null)
{
cha.sendPacket(cs);
}
}
}
}
else
{
final CreatureSay cs = new CreatureSay(0, ChatType.SHOUT, "Journal", text);
for (Player player : World.getInstance().getAllPlayers())
{
if (player.getInstanceId() == 0)
{
player.sendPacket(cs);
}
}
}
}
protected final ExclusiveTask _endSiegeTask = new ExclusiveTask()
{
@Override
protected void onElapsed()
{
if (!isInProgress())
{
cancel();
return;
}
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
if (timeRemaining <= 0)
{
endSiege(true);
cancel();
return;
}
schedule(timeRemaining);
}
};
protected final ExclusiveTask _mobControlTask = new ExclusiveTask()
{
@Override
protected void onElapsed()
{
int mobCount = 0;
for (clanPlayersInfo cl : _clansInfo.values())
{
if (cl._mob.isDead())
{
final Clan clan = ClanTable.getInstance().getClanByName(cl._clanName);
unRegisterClan(clan);
}
else
{
mobCount++;
}
}
teleportPlayers();
if (mobCount < 2)
{
if (_finalStage)
{
_siegeEndDate = Calendar.getInstance();
_endSiegeTask.cancel();
_endSiegeTask.schedule(5000);
}
else
{
_midTimer.cancel(false);
ThreadPool.schedule(new midSiegeStep(), 5000);
}
}
else
{
schedule(3000);
}
}
};
protected class clanPlayersInfo
{
public String _clanName;
public Deco _flag = null;
public Monster _mob = null;
public List<String> _players = new ArrayList<>();
}
public static WildBeastFarmSiege getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final WildBeastFarmSiege INSTANCE = new WildBeastFarmSiege();
}
}