diff --git a/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/Gustav.java b/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/Gustav.java new file mode 100644 index 0000000000..4f616c18b7 --- /dev/null +++ b/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/Gustav.java @@ -0,0 +1,103 @@ +/* + * 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 . + */ +package ai.bosses; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.l2jmobius.gameserver.model.actor.instance.NpcInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.entity.siege.clanhalls.DevastatedCastle; +import org.l2jmobius.gameserver.model.quest.Quest; + +/** + * @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 List _clans = new CopyOnWriteArrayList<>(); + + private Gustav() + { + super(-1, "Gustav", "ai/bosses"); + + addTalkId(MESSENGER); + addStartNpc(MESSENGER); + addAttackId(GUSTAV); + addKillId(GUSTAV); + } + + @Override + public String onTalk(NpcInstance npc, PlayerInstance player) + { + final Clan playerClan = player.getClan(); + for (Clan clan : _clans) + { + if (clan == playerClan) + { + return "You already registered!"; + } + } + + if (DevastatedCastle.getInstance().Conditions(player)) + { + if (!_clans.contains(playerClan)) + { + _clans.add(playerClan); + } + return "You have successful registered on a siege."; + } + + return "You are not allowed to do that!"; + } + + @Override + public String onAttack(NpcInstance npc, PlayerInstance 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(NpcInstance npc, PlayerInstance killer, boolean isPet) + { + DevastatedCastle.getInstance().SiegeFinish(); + return super.onKill(npc, killer, isPet); + } + + public static void main(String[] args) + { + new Gustav(); + } +} diff --git a/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/Nurka.java b/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/Nurka.java new file mode 100644 index 0000000000..07f69934c7 --- /dev/null +++ b/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/Nurka.java @@ -0,0 +1,103 @@ +/* + * 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 . + */ +package ai.bosses; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.l2jmobius.gameserver.model.actor.instance.NpcInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.clan.Clan; +import org.l2jmobius.gameserver.model.entity.siege.clanhalls.FortressOfResistance; +import org.l2jmobius.gameserver.model.quest.Quest; + +/** + * @author Mobius + * @note Based on python script + */ +public class Nurka extends Quest +{ + // NPCs + private static final int NURKA = 35368; + private static final int MESSENGER = 35382; + // Misc + private static final List _clans = new CopyOnWriteArrayList<>(); + + private Nurka() + { + super(-1, "Nurka", "ai/bosses"); + + addTalkId(MESSENGER); + addStartNpc(MESSENGER); + addAttackId(NURKA); + addKillId(NURKA); + } + + @Override + public String onTalk(NpcInstance npc, PlayerInstance player) + { + final Clan playerClan = player.getClan(); + for (Clan clan : _clans) + { + if (clan == playerClan) + { + return "You already registered!"; + } + } + + if (FortressOfResistance.getInstance().Conditions(player)) + { + if (!_clans.contains(playerClan)) + { + _clans.add(playerClan); + } + return "You have successful registered on a siege."; + } + + return "You are not allowed to do that!"; + } + + @Override + public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet) + { + final Clan playerClan = attacker.getClan(); + if (playerClan != null) + { + for (Clan clan : _clans) + { + if (clan == playerClan) + { + FortressOfResistance.getInstance().addSiegeDamage(clan, damage); + break; + } + } + } + return super.onAttack(npc, attacker, damage, isPet); + } + + @Override + public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet) + { + FortressOfResistance.getInstance().CaptureFinish(); + return super.onKill(npc, killer, isPet); + } + + public static void main(String[] args) + { + new Nurka(); + } +} diff --git a/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/gustav.py b/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/gustav.py deleted file mode 100644 index 3e1da7c15f..0000000000 --- a/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/gustav.py +++ /dev/null @@ -1,59 +0,0 @@ -import sys -from org.l2jmobius.gameserver.ai import CtrlIntention -from org.l2jmobius.gameserver.model.entity.siege.clanhalls import DevastatedCastle -from org.l2jmobius.gameserver.model.quest import State -from org.l2jmobius.gameserver.model.quest import QuestState -from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest -from org.l2jmobius.gameserver.instancemanager import ClanHallManager -from org.l2jmobius.commons.util import Rnd -from org.l2jmobius.gameserver.model.clan import Clan -from org.l2jmobius.gameserver.model.clan import ClanMember -from java.lang import System - -GUSTAV = 35410 -MESSENGER = 35420 -CLANLEADERS = [] - -class Gustav(JQuest): - - def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) - - def onTalk (self,npc,player): - global CLANLEADERS - npcId = npc.getNpcId() - if npcId == MESSENGER : - for clname in CLANLEADERS: - if player.getName() == clname : - return "You already registered!" - if DevastatedCastle.getInstance().Conditions(player) : - CLANLEADERS.append(player.getName()) - return "You have successful registered on a siege" - else: - return "Condition are not allow to do that!" - return - - def onAttack (self,npc,player,damage,isPet): - CLAN = player.getClan() - if CLAN == None : - return - CLANLEADER = CLAN.getLeader() - if CLANLEADER == None : - return - global CLANLEADERS - for clname in CLANLEADERS: - if clname <> None : - if CLANLEADER.getName() == clname : - DevastatedCastle.getInstance().addSiegeDamage(CLAN,damage) - return - - def onKill(self,npc,player,isPet): - DevastatedCastle.getInstance().SiegeFinish() - return - -QUEST = Gustav(-1, "gustav", "ai") - -QUEST.addTalkId(MESSENGER) -QUEST.addStartNpc(MESSENGER) - -QUEST.addAttackId(GUSTAV) -QUEST.addKillId(GUSTAV) \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/nurka.py b/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/nurka.py deleted file mode 100644 index acf5cda415..0000000000 --- a/L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/bosses/nurka.py +++ /dev/null @@ -1,58 +0,0 @@ -import sys -from org.l2jmobius.gameserver.ai import CtrlIntention -from org.l2jmobius.gameserver.model.entity.siege.clanhalls import FortressOfResistance -from org.l2jmobius.gameserver.model.quest import State -from org.l2jmobius.gameserver.model.quest import QuestState -from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest -from org.l2jmobius.gameserver.instancemanager import ClanHallManager -from org.l2jmobius.commons.util import Rnd -from java.lang import System - -NURKA = 35368 -MESSENGER = 35382 -CLANLEADERS = [] - -class Nurka(JQuest): - - def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) - - def onTalk (self,npc,player): - global CLANLEADERS - npcId = npc.getNpcId() - if npcId == MESSENGER : - for clname in CLANLEADERS: - if player.getName() == clname : - return "You already registered!" - if FortressOfResistance.getInstance().Conditions(player) : - CLANLEADERS.append(player.getName()) - return "You have successful registered on a battle" - else: - return "Condition are not allow to do that!" - return - - def onAttack (self,npc,player,damage,isPet): - CLAN = player.getClan() - if CLAN == None : - return - CLANLEADER = CLAN.getLeader() - if CLANLEADER == None : - return - global CLANLEADERS - for clname in CLANLEADERS: - if clname <> None : - if CLANLEADER.getName() == clname : - FortressOfResistance.getInstance().addSiegeDamage(CLAN,damage) - return - - - def onKill(self,npc,player,isPet): - FortressOfResistance.getInstance().CaptureFinish() - return - -QUEST = Nurka(-1, "nurka", "ai") - -QUEST.addTalkId(MESSENGER) -QUEST.addStartNpc(MESSENGER) - -QUEST.addAttackId(NURKA) -QUEST.addKillId(NURKA) \ No newline at end of file