Nurka and Gustav AI replacements.

This commit is contained in:
MobiusDevelopment 2019-07-26 21:18:24 +00:00
parent 1b893e8977
commit 71cb1e4d49
4 changed files with 206 additions and 117 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Clan> _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 "<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(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();
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Clan> _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 "<html><body>You already registered!</body></html>";
}
}
if (FortressOfResistance.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(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();
}
}

View File

@ -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 "<html><body>You already registered!</body></html>"
if DevastatedCastle.getInstance().Conditions(player) :
CLANLEADERS.append(player.getName())
return "<html><body>You have successful registered on a siege</body></html>"
else:
return "<html><body>Condition are not allow to do that!</body></html>"
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)

View File

@ -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 "<html><body>You already registered!</body></html>"
if FortressOfResistance.getInstance().Conditions(player) :
CLANLEADERS.append(player.getName())
return "<html><body>You have successful registered on a battle</body></html>"
else:
return "<html><body>Condition are not allow to do that!</body></html>"
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)