Interlude branch.

This commit is contained in:
MobiusDev
2018-03-03 00:51:38 +00:00
parent ae7660220a
commit e013196428
17475 changed files with 1039393 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,715 @@
/*
* 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 static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPoolManager;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.datatables.SkillTable;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.L2Effect;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2Skill;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.entity.Announcements;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.quest.QuestTimer;
import com.l2jmobius.gameserver.model.zone.type.L2BossZone;
import com.l2jmobius.gameserver.network.serverpackets.Earthquake;
import com.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
import com.l2jmobius.gameserver.network.serverpackets.PlaySound;
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.templates.StatsSet;
import com.l2jmobius.gameserver.util.Util;
/**
* Baium AI Note1: if the server gets rebooted while players are still fighting Baium, there is no lock, but players also lose their ability to wake baium up. However, should another person enter the room and wake him up, the players who had stayed inside may join the raid. This can be helpful for
* players who became victims of a reboot (they only need 1 new player to enter and wake up baium) and is not too exploitable since any player wishing to exploit it would have to suffer 5 days of being parked in an empty room. Note2: Neither version of Baium should be a permanent spawn. This script
* is fully capable of spawning the statue-version when the lock expires and switching it to the mob version promptly. Additional notes ( source http://aleenaresron.blogspot.com/2006_08_01_archive.html ): * Baium only first respawns five days after his last death. And from those five days he will
* respawn within 1-8 hours of his last death. So, you have to know his last time of death. * If by some freak chance you are the only one in Baium's chamber and NO ONE comes in [ha, ha] you or someone else will have to wake Baium. There is a good chance that Baium will automatically kill whoever
* wakes him. There are some people that have been able to wake him and not die, however if you've already gone through the trouble of getting the bloody fabric and camped him out and researched his spawn time, are you willing to take that chance that you'll wake him and not be able to finish your
* quest? Doubtful. [ this powerful attack vs the player who wakes him up is NOT yet implemented here] * once someone starts attacking Baium no one else can port into the chamber where he is. Unlike with the other raid bosses, you can just show up at any time as long as you are there when they die.
* Not true with Baium. Once he gets attacked, the port to Baium closes. byebye, see you in 5 days. If nobody attacks baium for 30 minutes, he auto-despawns and unlocks the vortex
* @author Fulminus version 0.1
*/
public class Baium extends Quest
{
protected static final Logger LOGGER = Logger.getLogger(Baium.class.getName());
private L2Character _target;
private L2Skill _skill;
private static final int STONE_BAIUM = 29025;
private static final int ANGELIC_VORTEX = 31862;
private static final int LIVE_BAIUM = 29020;
private static final int ARCHANGEL = 29021;
// Baium status tracking
private static final byte ASLEEP = 0; // baium is in the stone version, waiting to be woken up. Entry is unlocked
private static final byte AWAKE = 1; // baium is awake and fighting. Entry is locked.
private static final byte DEAD = 2; // baium has been killed and has not yet spawned. Entry is locked
// fixed archangel spawnloc
private static final int ANGEL_LOCATION[][] =
{
{
114239,
17168,
10080,
63544
},
{
115780,
15564,
10080,
13620
},
{
114880,
16236,
10080,
5400
},
{
115168,
17200,
10080,
0
},
{
115792,
16608,
10080,
0
},
};
private long _LastAttackVsBaiumTime = 0;
private final List<L2NpcInstance> _Minions = new CopyOnWriteArrayList<>();
protected L2BossZone _Zone;
public Baium(int questId, String name, String descr)
{
super(questId, name, descr);
final int[] mob =
{
LIVE_BAIUM
};
registerMobs(mob);
// Quest NPC starter initialization
addStartNpc(STONE_BAIUM);
addStartNpc(ANGELIC_VORTEX);
addTalkId(STONE_BAIUM);
addTalkId(ANGELIC_VORTEX);
_Zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
final StatsSet info = GrandBossManager.getInstance().getStatsSet(LIVE_BAIUM);
final Integer status = GrandBossManager.getInstance().getBossStatus(LIVE_BAIUM);
if (status == DEAD)
{
// load the unlock date and time for baium from DB
final long temp = (info.getLong("respawn_time") - System.currentTimeMillis());
if (temp > 0)
{
// the unlock time has not yet expired. Mark Baium as currently locked (dead). Setup a timer
// to fire at the correct time (calculate the time between now and the unlock time,
// setup a timer to fire after that many msec)
startQuestTimer("baium_unlock", temp, null, null);
}
else
{
// the time has already expired while the server was offline. Delete the saved time and
// immediately spawn the stone-baium. Also the state need not be changed from ASLEEP
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss Baium Stone spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, ASLEEP);
}
}
else if (status == AWAKE)
{
final int loc_x = info.getInteger("loc_x");
final int loc_y = info.getInteger("loc_y");
final int loc_z = info.getInteger("loc_z");
final int heading = info.getInteger("heading");
final int hp = info.getInteger("currentHP");
final int mp = info.getInteger("currentMP");
final L2GrandBossInstance baium = (L2GrandBossInstance) addSpawn(LIVE_BAIUM, loc_x, loc_y, loc_z, heading, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + baium.getName() + " spawned in world.");
}
GrandBossManager.getInstance().addBoss(baium);
final L2NpcInstance _baium = baium;
ThreadPoolManager.schedule(() ->
{
try
{
_baium.setCurrentHpMp(hp, mp);
_baium.setIsInvul(true);
// _baium.setIsImobilised(true);
_baium.broadcastPacket(new SocialAction(_baium.getObjectId(), 2));
startQuestTimer("baium_wakeup", 15000, _baium, null);
}
catch (Exception e)
{
e.printStackTrace();
}
}, 100L);
}
else
{
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss Baium Stone spawned in world.");
}
}
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
if (event.equals("baium_unlock"))
{
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, ASLEEP);
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss Baium Stone spawned in world.");
}
}
else if (event.equals("skill_range") && (npc != null))
{
callSkillAI(npc);
}
else if (event.equals("clean_player"))
{
_target = getRandomTarget(npc);
}
else if (event.equals("baium_wakeup") && (npc != null))
{
if (npc.getNpcId() == LIVE_BAIUM)
{
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
npc.broadcastPacket(new Earthquake(npc.getX(), npc.getY(), npc.getZ(), 40, 5));
// start monitoring baium's inactivity
_LastAttackVsBaiumTime = System.currentTimeMillis();
if (!npc.getSpawn().is_customBossInstance())
{
startQuestTimer("baium_despawn", 60000, npc, null, true);
}
if (player != null)
{
player.reduceCurrentHp(99999999, player);
}
npc.setRunning();
startQuestTimer("skill_range", 500, npc, null, true);
final L2NpcInstance baium = npc;
ThreadPoolManager.schedule(() ->
{
try
{
baium.setIsInvul(false);
// baium.setIsImobilised(false);
// for (L2NpcInstance minion : _Minions)
// minion.setShowSummonAnimation(false);
baium.getAttackByList().addAll(_Zone.getCharactersInside().values());
}
catch (Exception e)
{
LOGGER.warning(e.getMessage());
}
}, 11100L);
// TODO: the person who woke baium up should be knocked across the room, onto a wall, and
// lose massive amounts of HP.
for (int[] element : ANGEL_LOCATION)
{
final L2MonsterInstance angel = (L2MonsterInstance) addSpawn(ARCHANGEL, element[0], element[1], element[2], element[3], false, 0);
angel.setIsInvul(true);
_Minions.add(angel);
angel.getAttackByList().addAll(_Zone.getCharactersInside().values());
angel.isAggressive();
}
}
// despawn the live baium after 30 minutes of inactivity
// also check if the players are cheating, having pulled Baium outside his zone...
}
else if (event.equals("baium_despawn") && (npc != null))
{
if (npc.getNpcId() == LIVE_BAIUM)
{
// just in case the zone reference has been lost (somehow...), restore the reference
if (_Zone == null)
{
_Zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
}
if ((_LastAttackVsBaiumTime + (Config.BAIUM_SLEEP * 1000)) < System.currentTimeMillis())
{
npc.deleteMe(); // despawn the live-baium
for (L2NpcInstance minion : _Minions)
{
if (minion != null)
{
minion.getSpawn().stopRespawn();
minion.deleteMe();
}
}
_Minions.clear();
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0); // spawn stone-baium
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, ASLEEP); // mark that Baium is not awake any more
_Zone.oustAllPlayers();
cancelQuestTimer("baium_despawn", npc, null);
}
else if (((_LastAttackVsBaiumTime + 300000) < System.currentTimeMillis()) && (npc.getCurrentHp() < ((npc.getMaxHp() * 3) / 4.0)))
{
// npc.setIsCastingNow(false); //just in case
npc.setTarget(npc);
npc.doCast(SkillTable.getInstance().getInfo(4135, 1));
// npc.setIsCastingNow(true);
}
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onTalk(L2NpcInstance npc, L2PcInstance player)
{
final int npcId = npc.getNpcId();
String htmltext = "";
if (_Zone == null)
{
_Zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
}
if (_Zone == null)
{
return "<html><body>Angelic Vortex:<br>You may not enter while admin disabled this zone</body></html>";
}
final Integer status = GrandBossManager.getInstance().getBossStatus(LIVE_BAIUM);
if ((npcId == STONE_BAIUM) && (status == ASLEEP))
{
if (Config.ALLOW_DIRECT_TP_TO_BOSS_ROOM || _Zone.isPlayerAllowed(player))
{
// once Baium is awaken, no more people may enter until he dies, the server reboots, or
// 30 minutes pass with no attacks made against Baium.
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, AWAKE);
npc.deleteMe();
final L2GrandBossInstance baium = (L2GrandBossInstance) addSpawn(LIVE_BAIUM, npc);
GrandBossManager.getInstance().addBoss(baium);
final L2NpcInstance _baium = baium;
ThreadPoolManager.schedule(() ->
{
try
{
_baium.setIsInvul(true);
_baium.setRunning();
_baium.broadcastPacket(new SocialAction(_baium.getObjectId(), 2));
startQuestTimer("baium_wakeup", 15000, _baium, player);
// _baium.setShowSummonAnimation(false);
}
catch (Throwable e)
{
LOGGER.warning(e.getMessage());
}
}, 100L);
}
else
{
htmltext = "Conditions are not right to wake up Baium";
}
}
else if (npcId == ANGELIC_VORTEX)
{
if (player.isFlying())
{
// print "Player "+player.getName()+" attempted to enter Baium's lair while flying!";
return "<html><body>Angelic Vortex:<br>You may not enter while flying a wyvern</body></html>";
}
if ((status == ASLEEP) && (player.getQuestState("baium").getQuestItemsCount(4295) > 0)) // bloody fabric
{
player.getQuestState("baium").takeItems(4295, 1);
// allow entry for the player for the next 30 secs (more than enough time for the TP to happen)
// Note: this just means 30secs to get in, no limits on how long it takes before we get out.
_Zone.allowPlayerEntry(player, 30);
player.teleToLocation(113100, 14500, 10077);
}
else
{
npc.showChatWindow(player, 1);
}
}
return htmltext;
}
@Override
public String onSpellFinished(L2NpcInstance npc, L2PcInstance player, L2Skill skill)
{
if (npc.isInvul())
{
npc.getAI().setIntention(AI_INTENTION_IDLE);
return null;
}
else if ((npc.getNpcId() == LIVE_BAIUM) && !npc.isInvul())
{
callSkillAI(npc);
}
return super.onSpellFinished(npc, player, skill);
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
if (!_Zone.isInsideZone(attacker))
{
attacker.reduceCurrentHp(attacker.getCurrentHp(), attacker, false);
return super.onAttack(npc, attacker, damage, isPet);
}
if (npc.isInvul())
{
npc.getAI().setIntention(AI_INTENTION_IDLE);
return super.onAttack(npc, attacker, damage, isPet);
}
else if ((npc.getNpcId() == LIVE_BAIUM) && !npc.isInvul())
{
if (attacker.getMountType() == 1)
{
int sk_4258 = 0;
final L2Effect[] effects = attacker.getAllEffects();
if ((effects != null) && (effects.length != 0))
{
for (L2Effect e : effects)
{
if (e.getSkill().getId() == 4258)
{
sk_4258 = 1;
}
}
}
if (sk_4258 == 0)
{
npc.setTarget(attacker);
npc.doCast(SkillTable.getInstance().getInfo(4258, 1));
}
}
// update a variable with the last action against baium
_LastAttackVsBaiumTime = System.currentTimeMillis();
callSkillAI(npc);
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
npc.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
if (!npc.getSpawn().is_customBossInstance())
{
cancelQuestTimer("baium_despawn", npc, null);
// spawn the "Teleportation Cubic" for 15 minutes (to allow players to exit the lair)
addSpawn(29055, 115203, 16620, 10078, 0, false, 900000); // //should we teleport everyone out if the cubic despawns??
// "lock" baium for 5 days and 1 to 8 hours [i.e. 432,000,000 + 1*3,600,000 + random-less-than(8*3,600,000) millisecs]
final long respawnTime = (Config.BAIUM_RESP_FIRST + Rnd.get(Config.BAIUM_RESP_SECOND)) * 3600000;
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, DEAD);
startQuestTimer("baium_unlock", respawnTime, null, null);
// also save the respawn time so that the info is maintained past reboots
final StatsSet info = GrandBossManager.getInstance().getStatsSet(LIVE_BAIUM);
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
GrandBossManager.getInstance().setStatsSet(LIVE_BAIUM, info);
}
for (L2NpcInstance minion : _Minions)
{
if (minion != null)
{
minion.getSpawn().stopRespawn();
minion.deleteMe();
}
}
_Minions.clear();
if (getQuestTimer("skill_range", npc, null) != null)
{
getQuestTimer("skill_range", npc, null).cancel();
}
return super.onKill(npc, killer, isPet);
}
public L2Character getRandomTarget(L2NpcInstance npc)
{
final List<L2Character> result = new ArrayList<>();
final Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
{
for (L2Object obj : objs)
{
if (obj instanceof L2Character)
{
if (((((L2Character) obj).getZ() < (npc.getZ() - 100)) && (((L2Character) obj).getZ() > (npc.getZ() + 100))) || !GeoData.getInstance().canSeeTarget(obj, npc))
{
continue;
}
}
if (obj instanceof L2PcInstance)
{
if (Util.checkIfInRange(9000, npc, obj, true) && !((L2Character) obj).isDead())
{
result.add((L2PcInstance) obj);
}
}
if (obj instanceof L2Summon)
{
if (Util.checkIfInRange(9000, npc, obj, true) && !((L2Character) obj).isDead())
{
result.add((L2Summon) obj);
}
}
}
}
if (result.isEmpty())
{
for (L2NpcInstance minion : _Minions)
{
if (minion != null)
{
result.add(minion);
}
}
}
if (result.isEmpty())
{
return null;
}
final Object[] characters = result.toArray();
final QuestTimer timer = getQuestTimer("clean_player", npc, null);
if (timer != null)
{
timer.cancel();
}
startQuestTimer("clean_player", 20000, npc, null);
final L2Character target = (L2Character) characters[Rnd.get(characters.length)];
return target;
}
public synchronized void callSkillAI(L2NpcInstance npc)
{
if (npc.isInvul() || npc.isCastingNow())
{
return;
}
if ((_target == null) || _target.isDead() || !(_Zone.isInsideZone(_target)))
{
_target = getRandomTarget(npc);
if (_target != null)
{
_skill = SkillTable.getInstance().getInfo(getRandomSkill(npc), 1);
}
}
final L2Character target = _target;
L2Skill skill = _skill;
if (skill == null)
{
skill = SkillTable.getInstance().getInfo(getRandomSkill(npc), 1);
}
if ((target == null) || target.isDead() || !(_Zone.isInsideZone(target)))
{
// npc.setIsCastingNow(false);
return;
}
if (Util.checkIfInRange(skill.getCastRange(), npc, target, true))
{
npc.getAI().setIntention(AI_INTENTION_IDLE);
npc.setTarget(target);
// npc.setIsCastingNow(true);
if (getDist(skill.getCastRange()) > 0)
{
npc.broadcastPacket(new MoveToPawn(npc, target, getDist(skill.getCastRange())));
}
try
{
wait(1000);
npc.stopMove(null);
npc.doCast(skill);
}
catch (Exception e)
{
e.printStackTrace();
}
}
else
{
npc.getAI().setIntention(AI_INTENTION_FOLLOW, target, null);
// npc.setIsCastingNow(false);
}
}
public int getRandomSkill(L2NpcInstance npc)
{
int skill;
if (npc.getCurrentHp() > ((npc.getMaxHp() * 3) / 4.0))
{
if (Rnd.get(100) < 10)
{
skill = 4128;
}
else if (Rnd.get(100) < 10)
{
skill = 4129;
}
else
{
skill = 4127;
}
}
else if (npc.getCurrentHp() > ((npc.getMaxHp() * 2) / 4.0))
{
if (Rnd.get(100) < 10)
{
skill = 4131;
}
else if (Rnd.get(100) < 10)
{
skill = 4128;
}
else if (Rnd.get(100) < 10)
{
skill = 4129;
}
else
{
skill = 4127;
}
}
else if (npc.getCurrentHp() > ((npc.getMaxHp() * 1) / 4.0))
{
if (Rnd.get(100) < 10)
{
skill = 4130;
}
else if (Rnd.get(100) < 10)
{
skill = 4131;
}
else if (Rnd.get(100) < 10)
{
skill = 4128;
}
else if (Rnd.get(100) < 10)
{
skill = 4129;
}
else
{
skill = 4127;
}
}
else if (Rnd.get(100) < 10)
{
skill = 4130;
}
else if (Rnd.get(100) < 10)
{
skill = 4131;
}
else if (Rnd.get(100) < 10)
{
skill = 4128;
}
else if (Rnd.get(100) < 10)
{
skill = 4129;
}
else
{
skill = 4127;
}
return skill;
}
@Override
public String onSkillUse(L2NpcInstance npc, L2PcInstance caster, L2Skill skill)
{
if (npc.isInvul())
{
npc.getAI().setIntention(AI_INTENTION_IDLE);
return null;
}
npc.setTarget(caster);
return super.onSkillUse(npc, caster, skill);
}
public int getDist(int range)
{
int dist = 0;
switch (range)
{
case -1:
{
break;
}
case 100:
{
dist = 85;
break;
}
default:
{
dist = range - 85;
break;
}
}
return dist;
}
public static void main(String[] args)
{
new Baium(-1, "baium", "ai");
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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 com.l2jmobius.gameserver.model.quest.Quest;
/*
* @author m095 (L2EmuRT)
*/
public class Barakiel extends Quest
{
// Barakiel NpcID
private static final int BARAKIEL = 25325;
public Barakiel(int questId, String name, String descr)
{
super(questId, name, descr);
addEventId(BARAKIEL, Quest.QuestEventType.ON_ATTACK);
}
// FIXME: Mobius - AI does nothing?
public static void main(String[] args)
{
new Barakiel(-1, "Barakiel", "ai");
}
}

View File

@@ -0,0 +1,257 @@
/*
* 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 com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.entity.Announcements;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import com.l2jmobius.gameserver.network.serverpackets.PlaySound;
import com.l2jmobius.gameserver.templates.StatsSet;
/**
* Core AI
* @author qwerty
*/
public class Core extends Quest
{
private static final int CORE = 29006;
private static final int DEATH_KNIGHT = 29007;
private static final int DOOM_WRAITH = 29008;
// private static final int DICOR = 29009;
// private static final int VALIDUS = 29010;
private static final int SUSCEPTOR = 29011;
// private static final int PERUM = 29012;
// private static final int PREMO = 29013;
// CORE Status Tracking :
private static final byte ALIVE = 0; // Core is spawned.
private static final byte DEAD = 1; // Core has been killed.
private static boolean _FirstAttacked;
List<L2Attackable> Minions = new CopyOnWriteArrayList<>();
// private static final Logger LOGGER = Logger.getLogger(Core.class);
public Core(int id, String name, String descr)
{
super(id, name, descr);
final int[] mobs =
{
CORE,
DEATH_KNIGHT,
DOOM_WRAITH,
SUSCEPTOR
};
for (int mob : mobs)
{
addEventId(mob, Quest.QuestEventType.ON_KILL);
addEventId(mob, Quest.QuestEventType.ON_ATTACK);
}
_FirstAttacked = false;
final StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE);
final Integer status = GrandBossManager.getInstance().getBossStatus(CORE);
if (status == DEAD)
{
// load the unlock date and time for Core from DB
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
if (temp > 0)
{
startQuestTimer("core_unlock", temp, null, null);
}
else
{
// the time has already expired while the server was offline. Immediately spawn Core.
final L2GrandBossInstance core = (L2GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + core.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(CORE, ALIVE);
spawnBoss(core);
}
}
else
{
final String test = loadGlobalQuestVar("Core_Attacked");
if (test.equalsIgnoreCase("true"))
{
_FirstAttacked = true;
}
/*
* int loc_x = info.getInteger("loc_x"); int loc_y = info.getInteger("loc_y"); int loc_z = info.getInteger("loc_z"); int heading = info.getInteger("heading"); int hp = info.getInteger("currentHP"); int mp = info.getInteger("currentMP"); L2GrandBossInstance core = (L2GrandBossInstance)
* addSpawn(CORE,loc_x,loc_y,loc_z,heading,false,0); core.setCurrentHpMp(hp,mp);
*/
final L2GrandBossInstance core = (L2GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + core.getName() + " spawned in world.");
}
spawnBoss(core);
}
}
@Override
public void saveGlobalData()
{
final String val = "" + _FirstAttacked;
saveGlobalQuestVar("Core_Attacked", val);
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
final Integer status = GrandBossManager.getInstance().getBossStatus(CORE);
if (event.equals("core_unlock"))
{
final L2GrandBossInstance core = (L2GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + core.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(CORE, ALIVE);
spawnBoss(core);
}
else if (status == null)
{
LOGGER.warning("GrandBoss with Id " + CORE + " has not valid status into GrandBossManager");
}
else if (event.equals("spawn_minion") && (status == ALIVE))
{
Minions.add((L2Attackable) addSpawn(npc.getNpcId(), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0));
}
else if (event.equals("despawn_minions"))
{
for (int i = 0; i < Minions.size(); i++)
{
final L2Attackable mob = Minions.get(i);
if (mob != null)
{
mob.decayMe();
}
}
Minions.clear();
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
if (npc.getNpcId() == CORE)
{
if (_FirstAttacked)
{
if (Rnd.get(100) == 0)
{
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Removing intruders."));
}
}
else
{
_FirstAttacked = true;
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "A non-permitted target has been discovered."));
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Starting intruder removal system."));
}
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
final int npcId = npc.getNpcId();
final String name = npc.getName();
if (npcId == CORE)
{
final int objId = npc.getObjectId();
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, objId, npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new CreatureSay(objId, 0, name, "A fatal error has occurred."));
npc.broadcastPacket(new CreatureSay(objId, 0, name, "System is being shut down..."));
npc.broadcastPacket(new CreatureSay(objId, 0, name, "......"));
_FirstAttacked = false;
if (!npc.getSpawn().is_customBossInstance())
{
addSpawn(31842, 16502, 110165, -6394, 0, false, 900000);
addSpawn(31842, 18948, 110166, -6397, 0, false, 900000);
GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
// time is 60hour +/- 23hour
final long respawnTime = (Config.CORE_RESP_FIRST + Rnd.get(Config.CORE_RESP_SECOND)) * 3600000;
startQuestTimer("core_unlock", respawnTime, null, null);
// also save the respawn time so that the info is maintained past reboots
final StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE);
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
GrandBossManager.getInstance().setStatsSet(CORE, info);
startQuestTimer("despawn_minions", 20000, null, null);
}
}
else
{
final Integer status = GrandBossManager.getInstance().getBossStatus(CORE);
if ((status == ALIVE) && Minions.contains(npc))
{
Minions.remove(npc);
startQuestTimer("spawn_minion", Config.CORE_RESP_MINION * 1000, npc, null);
}
}
return super.onKill(npc, killer, isPet);
}
public void spawnBoss(L2GrandBossInstance npc)
{
GrandBossManager.getInstance().addBoss(npc);
npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
// Spawn minions
for (int i = 0; i < 5; i++)
{
final int x = 16800 + (i * 360);
Minions.add((L2Attackable) addSpawn(DEATH_KNIGHT, x, 110000, npc.getZ(), 280 + Rnd.get(40), false, 0));
Minions.add((L2Attackable) addSpawn(DEATH_KNIGHT, x, 109000, npc.getZ(), 280 + Rnd.get(40), false, 0));
final int x2 = 16800 + (i * 600);
Minions.add((L2Attackable) addSpawn(DOOM_WRAITH, x2, 109300, npc.getZ(), 280 + Rnd.get(40), false, 0));
}
for (int i = 0; i < 4; i++)
{
final int x = 16800 + (i * 450);
Minions.add((L2Attackable) addSpawn(SUSCEPTOR, x, 110300, npc.getZ(), 280 + Rnd.get(40), false, 0));
}
}
public static void main(String[] args)
{
new Core(-1, "core", "ai");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
/*
* 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 com.l2jmobius.gameserver.model.quest.Quest;
/*
* @author m095 (L2EmuRT)
*/
public class Golkonda extends Quest
{
// Golkonda NpcID
private static final int GOLKONDA = 25126;
public Golkonda(int questId, String name, String descr)
{
super(questId, name, descr);
addEventId(GOLKONDA, Quest.QuestEventType.ON_ATTACK);
}
// FIXME: Mobius - AI does nothing?
public static void main(String[] args)
{
new Golkonda(-1, "Golkonda", "ai");
}
}

View File

@@ -0,0 +1,514 @@
/*
* 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 com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.sql.SpawnTable;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.position.Location;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.spawn.L2Spawn;
/**
* Gordon AI
* @author TOFIZ
* @version $Revision: 1.1 $ $Date: 2008/08/21 $
*/
public class Gordon extends Quest
{
private static final int GORDON = 29095;
private static int _npcMoveX = 0;
private static int _npcMoveY = 0;
private static int _isWalkTo = 0;
private static int _npcBlock = 0;
private static int X = 0;
private static int Y = 0;
private static int Z = 0;
private static final int[][] WALKS =
{
{
141569,
-45908,
-2387
},
{
142494,
-45456,
-2397
},
{
142922,
-44561,
-2395
},
{
143672,
-44130,
-2398
},
{
144557,
-43378,
-2325
},
{
145839,
-43267,
-2301
},
{
147044,
-43601,
-2307
},
{
148140,
-43206,
-2303
},
{
148815,
-43434,
-2328
},
{
149862,
-44151,
-2558
},
{
151037,
-44197,
-2708
},
{
152555,
-42756,
-2836
},
{
154808,
-39546,
-3236
},
{
155333,
-39962,
-3272
},
{
156531,
-41240,
-3470
},
{
156863,
-43232,
-3707
},
{
156783,
-44198,
-3764
},
{
158169,
-45163,
-3541
},
{
158952,
-45479,
-3473
},
{
160039,
-46514,
-3634
},
{
160244,
-47429,
-3656
},
{
159155,
-48109,
-3665
},
{
159558,
-51027,
-3523
},
{
159396,
-53362,
-3244
},
{
160872,
-56556,
-2789
},
{
160857,
-59072,
-2613
},
{
160410,
-59888,
-2647
},
{
158770,
-60173,
-2673
},
{
156368,
-59557,
-2638
},
{
155188,
-59868,
-2642
},
{
154118,
-60591,
-2731
},
{
153571,
-61567,
-2821
},
{
153457,
-62819,
-2886
},
{
152939,
-63778,
-3003
},
{
151816,
-64209,
-3120
},
{
147655,
-64826,
-3433
},
{
145422,
-64576,
-3369
},
{
144097,
-64320,
-3404
},
{
140780,
-61618,
-3096
},
{
139688,
-61450,
-3062
},
{
138267,
-61743,
-3056
},
{
138613,
-58491,
-3465
},
{
138139,
-57252,
-3517
},
{
139555,
-56044,
-3310
},
{
139107,
-54537,
-3240
},
{
139279,
-53781,
-3091
},
{
139810,
-52687,
-2866
},
{
139657,
-52041,
-2793
},
{
139215,
-51355,
-2698
},
{
139334,
-50514,
-2594
},
{
139817,
-49715,
-2449
},
{
139824,
-48976,
-2263
},
{
140130,
-47578,
-2213
},
{
140483,
-46339,
-2382
},
{
141569,
-45908,
-2387
}
};
private static boolean _isAttacked = false;
private static boolean _isSpawned = false;
public Gordon(int id, String name, String descr)
{
super(id, name, descr);
addEventId(GORDON, Quest.QuestEventType.ON_KILL);
addEventId(GORDON, Quest.QuestEventType.ON_ATTACK);
addEventId(GORDON, Quest.QuestEventType.ON_SPAWN);
// wait 2 minutes after Start AI
startQuestTimer("check_ai", 120000, null, null, true);
_isSpawned = false;
_isAttacked = false;
_isWalkTo = 1;
_npcMoveX = 0;
_npcMoveY = 0;
_npcBlock = 0;
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
X = WALKS[_isWalkTo - 1][0];
Y = WALKS[_isWalkTo - 1][1];
Z = WALKS[_isWalkTo - 1][2];
if (event.equals("time_isAttacked"))
{
_isAttacked = false;
if (npc.getNpcId() == GORDON)
{
npc.setWalking();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(X, Y, Z, 0));
}
}
else if (event.equals("check_ai"))
{
cancelQuestTimer("check_ai", null, null);
if (!_isSpawned)
{
final L2NpcInstance gordon_ai = findTemplate(GORDON);
if (gordon_ai != null)
{
_isSpawned = true;
startQuestTimer("Start", 1000, gordon_ai, null, true);
return super.onAdvEvent(event, npc, player);
}
}
}
else if (event.equals("Start"))
{
// startQuestTimer("Start", 1000, npc, null);
if ((npc != null) && _isSpawned)
{
// check if player have Cursed Weapon and in radius
if (npc.getNpcId() == GORDON)
{
final Collection<L2PcInstance> chars = npc.getKnownList().getKnownPlayers().values();
if ((chars != null) && (chars.size() > 0))
{
for (L2PcInstance pc : chars)
{
if (pc.isCursedWeaponEquipped() && pc.isInsideRadius(npc, 5000, false, false))
{
npc.setRunning();
((L2Attackable) npc).addDamageHate(pc, 0, 9999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, pc);
_isAttacked = true;
cancelQuestTimer("time_isAttacked", null, null);
startQuestTimer("time_isAttacked", 180000, npc, null);
return super.onAdvEvent(event, npc, player);
}
}
}
}
// end check
if (_isAttacked)
{
return super.onAdvEvent(event, npc, player);
}
if ((npc.getNpcId() == GORDON) && ((npc.getX() - 50) <= X) && ((npc.getX() + 50) >= X) && ((npc.getY() - 50) <= Y) && ((npc.getY() + 50) >= Y))
{
_isWalkTo++;
if (_isWalkTo > 55)
{
_isWalkTo = 1;
}
X = WALKS[_isWalkTo - 1][0];
Y = WALKS[_isWalkTo - 1][1];
Z = WALKS[_isWalkTo - 1][2];
npc.setWalking();
// TODO: find better way to prevent teleporting to the home location
npc.getSpawn().setX(X);
npc.getSpawn().setY(Y);
npc.getSpawn().setZ(Z);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(X, Y, Z, 0));
}
// Test for unblock Npc
if ((npc.getX() != _npcMoveX) && (npc.getY() != _npcMoveY))
{
_npcMoveX = npc.getX();
_npcMoveY = npc.getY();
_npcBlock = 0;
}
else if (npc.getNpcId() == GORDON)
{
_npcBlock++;
if (_npcBlock > 2)
{
npc.teleToLocation(X, Y, Z);
return super.onAdvEvent(event, npc, player);
}
if (_npcBlock > 0)
{
// TODO: find better way to prevent teleporting to the home location
npc.getSpawn().setX(X);
npc.getSpawn().setY(Y);
npc.getSpawn().setZ(Z);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(X, Y, Z, 0));
}
}
// End Test unblock Npc
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onSpawn(L2NpcInstance npc)
{
if ((npc.getNpcId() == GORDON) && (_npcBlock == 0))
{
_isSpawned = true;
_isWalkTo = 1;
startQuestTimer("Start", 1000, npc, null);
}
return super.onSpawn(npc);
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance player, int damage, boolean isPet)
{
if (npc.getNpcId() == GORDON)
{
_isAttacked = true;
cancelQuestTimer("time_isAttacked", null, null);
startQuestTimer("time_isAttacked", 180000, npc, null);
if (player != null)
{
npc.setRunning();
((L2Attackable) npc).addDamageHate(player, 0, 100);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
}
}
return super.onAttack(npc, player, damage, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
if (npc.getNpcId() == GORDON)
{
cancelQuestTimer("Start", null, null);
cancelQuestTimer("time_isAttacked", null, null);
_isSpawned = false;
}
return super.onKill(npc, killer, isPet);
}
public L2NpcInstance findTemplate(int npcId)
{
L2NpcInstance npc = null;
for (L2Spawn spawn : SpawnTable.getInstance().getSpawnTable().values())
{
if ((spawn != null) && (spawn.getNpcId() == npcId))
{
npc = spawn.getLastSpawn();
break;
}
}
return npc;
}
public static void main(String[] args)
{
new Gordon(-1, "Gordon", "ai");
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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 com.l2jmobius.gameserver.model.quest.Quest;
/*
* @author m095 (L2EmuRT)
*/
public class Hallate extends Quest
{
// Hallate NpcID
private static final int HALLATE = 25220;
public Hallate(int questId, String name, String descr)
{
super(questId, name, descr);
addEventId(HALLATE, Quest.QuestEventType.ON_ATTACK);
}
// FIXME: Mobius - AI does nothing?
public static void main(String[] args)
{
new Hallate(-1, "Hallate", "ai");
}
}

View File

@@ -0,0 +1,454 @@
/*
* 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 java.util.concurrent.Future;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.datatables.csv.DoorTable;
import com.l2jmobius.gameserver.datatables.sql.NpcTable;
import com.l2jmobius.gameserver.datatables.sql.SpawnTable;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.spawn.L2Spawn;
import com.l2jmobius.gameserver.model.zone.type.L2BossZone;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate;
/**
* Ice Fairy Sirra AI
* @author Kerberos
*/
public class IceFairySirra extends Quest
{
private static final int STEWARD = 32029;
private static final int SILVER_HEMOCYTE = 8057;
private static L2BossZone _freyasZone;
private static L2PcInstance _player = null;
protected List<L2NpcInstance> _allMobs = new CopyOnWriteArrayList<>();
protected Future<?> _onDeadEventTask = null;
public IceFairySirra(int id, String name, String descr)
{
super(id, name, descr);
final int[] mobs =
{
STEWARD,
22100,
22102,
22104
};
for (int mob : mobs)
{
// TODO:
addEventId(mob, Quest.QuestEventType.QUEST_START);
addEventId(mob, Quest.QuestEventType.QUEST_TALK);
addEventId(mob, Quest.QuestEventType.NPC_FIRST_TALK);
}
init();
}
@Override
public String onFirstTalk(L2NpcInstance npc, L2PcInstance player)
{
if (player.getQuestState("IceFairySirra") == null)
{
newQuestState(player);
}
player.setLastQuestNpcObject(npc.getObjectId());
String filename = "";
if (npc.isBusy())
{
filename = getHtmlPath(10);
}
else
{
filename = getHtmlPath(0);
}
sendHtml(npc, player, filename);
return null;
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
if (event.equals("check_condition"))
{
if (npc.isBusy())
{
return super.onAdvEvent(event, npc, player);
}
String filename = "";
if (player.isInParty() && (player.getParty().getPartyLeaderOID() == player.getObjectId()))
{
if (checkItems(player))
{
startQuestTimer("start", 100000, null, player);
_player = player;
destroyItems(player);
player.getInventory().addItem("Scroll", 8379, 3, player, null);
npc.setBusy(true);
screenMessage(player, "Steward: Please wait a moment.", 100000);
filename = getHtmlPath(3);
}
else
{
filename = getHtmlPath(2);
}
}
else
{
filename = getHtmlPath(1);
}
sendHtml(npc, player, filename);
}
else if (event.equals("start"))
{
if (_freyasZone == null)
{
LOGGER.warning("IceFairySirraManager: Failed to load zone");
cleanUp();
return super.onAdvEvent(event, npc, player);
}
_freyasZone.setZoneEnabled(true);
closeGates();
doSpawns();
startQuestTimer("Party_Port", 2000, null, player);
startQuestTimer("End", 1802000, null, player);
}
else if (event.equals("Party_Port"))
{
teleportInside(player);
screenMessage(player, "Steward: Please restore the Queen's appearance!", 10000);
startQuestTimer("30MinutesRemaining", 300000, null, player);
}
else if (event.equals("30MinutesRemaining"))
{
screenMessage(player, "30 minute(s) are remaining.", 10000);
startQuestTimer("20minutesremaining", 600000, null, player);
}
else if (event.equals("20MinutesRemaining"))
{
screenMessage(player, "20 minute(s) are remaining.", 10000);
startQuestTimer("10minutesremaining", 600000, null, player);
}
else if (event.equals("10MinutesRemaining"))
{
screenMessage(player, "Steward: Waste no time! Please hurry!", 10000);
}
else if (event.equals("End"))
{
screenMessage(player, "Steward: Was it indeed too much to ask.", 10000);
cleanUp();
}
return super.onAdvEvent(event, npc, player);
}
public void init()
{
_freyasZone = GrandBossManager.getInstance().getZone(105546, -127892, -2768);
if (_freyasZone == null)
{
LOGGER.warning("IceFairySirraManager: Failed to load zone");
return;
}
_freyasZone.setZoneEnabled(false);
final L2NpcInstance steward = findTemplate(STEWARD);
if (steward != null)
{
steward.setBusy(false);
}
openGates();
}
public void cleanUp()
{
init();
cancelQuestTimer("30MinutesRemaining", null, _player);
cancelQuestTimer("20MinutesRemaining", null, _player);
cancelQuestTimer("10MinutesRemaining", null, _player);
cancelQuestTimer("End", null, _player);
for (L2NpcInstance mob : _allMobs)
{
try
{
mob.getSpawn().stopRespawn();
mob.deleteMe();
}
catch (Exception e)
{
LOGGER.warning("IceFairySirraManager: Failed deleting mob. " + e);
}
}
_allMobs.clear();
}
public L2NpcInstance findTemplate(int npcId)
{
L2NpcInstance npc = null;
for (L2Spawn spawn : SpawnTable.getInstance().getSpawnTable().values())
{
if ((spawn != null) && (spawn.getNpcId() == npcId))
{
npc = spawn.getLastSpawn();
break;
}
}
return npc;
}
protected void openGates()
{
for (int i = 23140001; i < 23140003; i++)
{
try
{
final L2DoorInstance door = DoorTable.getInstance().getDoor(i);
if (door != null)
{
door.openMe();
}
else
{
LOGGER.warning("IceFairySirraManager: Attempted to open undefined door. doorId: " + i);
}
}
catch (Exception e)
{
LOGGER.warning("IceFairySirraManager: Failed closing door " + e);
}
}
}
protected void closeGates()
{
for (int i = 23140001; i < 23140003; i++)
{
try
{
final L2DoorInstance door = DoorTable.getInstance().getDoor(i);
if (door != null)
{
door.closeMe();
}
else
{
LOGGER.warning("IceFairySirraManager: Attempted to close undefined door. doorId: " + i);
}
}
catch (Exception e)
{
LOGGER.warning("IceFairySirraManager: Failed closing door " + e);
}
}
}
public boolean checkItems(L2PcInstance player)
{
if (player.getParty() != null)
{
for (L2PcInstance pc : player.getParty().getPartyMembers())
{
final L2ItemInstance i = pc.getInventory().getItemByItemId(SILVER_HEMOCYTE);
if ((i == null) || (i.getCount() < 10))
{
return false;
}
}
}
else
{
return false;
}
return true;
}
public void destroyItems(L2PcInstance player)
{
if (player.getParty() != null)
{
for (L2PcInstance pc : player.getParty().getPartyMembers())
{
final L2ItemInstance i = pc.getInventory().getItemByItemId(SILVER_HEMOCYTE);
pc.destroyItem("Hemocytes", i.getObjectId(), 10, null, false);
}
}
else
{
cleanUp();
}
}
public void teleportInside(L2PcInstance player)
{
if (player.getParty() != null)
{
for (L2PcInstance pc : player.getParty().getPartyMembers())
{
pc.teleToLocation(113533, -126159, -3488, false);
if (_freyasZone == null)
{
LOGGER.warning("IceFairySirraManager: Failed to load zone");
cleanUp();
return;
}
_freyasZone.allowPlayerEntry(pc, 2103);
}
}
else
{
cleanUp();
}
}
public void screenMessage(L2PcInstance player, String text, int time)
{
if (player.getParty() != null)
{
for (L2PcInstance pc : player.getParty().getPartyMembers())
{
pc.sendPacket(new ExShowScreenMessage(text, time));
}
}
else
{
cleanUp();
}
}
public void doSpawns()
{
final int[][] mobs =
{
{
29060,
105546,
-127892,
-2768
},
{
29056,
102779,
-125920,
-2840
},
{
22100,
111719,
-126646,
-2992
},
{
22102,
109509,
-128946,
-3216
},
{
22104,
109680,
-125756,
-3136
}
};
L2Spawn spawnDat;
L2NpcTemplate template;
try
{
for (int i = 0; i < 5; i++)
{
template = NpcTable.getInstance().getTemplate(mobs[i][0]);
if (template != null)
{
spawnDat = new L2Spawn(template);
spawnDat.setAmount(1);
spawnDat.setX(mobs[i][1]);
spawnDat.setY(mobs[i][2]);
spawnDat.setZ(mobs[i][3]);
spawnDat.setHeading(0);
spawnDat.setRespawnDelay(60);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
_allMobs.add(spawnDat.doSpawn());
spawnDat.stopRespawn();
}
else
{
LOGGER.warning("IceFairySirraManager: Data missing in NPC table for ID: " + mobs[i][0]);
}
}
}
catch (Exception e)
{
LOGGER.warning("IceFairySirraManager: Spawns could not be initialized: " + e);
}
}
public String getHtmlPath(int val)
{
String pom = "";
pom = "32029-" + val;
if (val == 0)
{
pom = "32029";
}
final String temp = "data/html/default/" + pom + ".htm";
if (!Config.LAZY_CACHE)
{
// If not running lazy cache the file must be in the cache or it doesnt exist
if (HtmCache.getInstance().contains(temp))
{
return temp;
}
}
else if (HtmCache.getInstance().isLoadable(temp))
{
return temp;
}
// If the file is not found, the standard message "I have nothing to say to you" is returned
return "data/html/npcdefault.htm";
}
public void sendHtml(L2NpcInstance npc, L2PcInstance player, String filename)
{
final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
html.setFile(filename);
html.replace("%objectId%", String.valueOf(npc.getObjectId()));
player.sendPacket(html);
player.sendPacket(ActionFailed.STATIC_PACKET);
}
public static void main(String[] args)
{
new IceFairySirra(-1, "IceFairySirra", "ai");
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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 com.l2jmobius.gameserver.model.quest.Quest;
/*
* @author m095 (L2EmuRT)
*/
public class Kernon extends Quest
{
// Kernon NpcID
private static final int KERNON = 25054;
public Kernon(int questId, String name, String descr)
{
super(questId, name, descr);
addEventId(KERNON, Quest.QuestEventType.ON_ATTACK);
}
// FIXME: Mobius - AI does nothing?
public static void main(String[] args)
{
new Kernon(-1, "Kernon", "ai");
}
}

View File

@@ -0,0 +1,267 @@
/*
* 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 com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.SkillTable;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.entity.Announcements;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.PlaySound;
import com.l2jmobius.gameserver.templates.StatsSet;
/**
* @author Shyla
*/
public class Orfen extends Quest
{
private static final int ORFEN = 29014;
private static final int LIVE = 0;
private static final int DEAD = 1;
private boolean FirstAttacked = false;
private boolean Teleported = false;
L2GrandBossInstance orfen = null;
enum Event
{
ORFEN_SPAWN,
ORFEN_REFRESH,
ORFEN_RETURN
}
/**
* @param questId
* @param name
* @param descr
*/
public Orfen(int questId, String name, String descr)
{
super(questId, name, descr);
final StatsSet info = GrandBossManager.getInstance().getStatsSet(ORFEN);
final Integer status = GrandBossManager.getInstance().getBossStatus(ORFEN);
addEventId(ORFEN, Quest.QuestEventType.ON_KILL);
addEventId(ORFEN, Quest.QuestEventType.ON_ATTACK);
switch (status)
{
case DEAD:
{
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
if (temp > 0)
{
startQuestTimer("ORFEN_SPAWN", temp, null, null);
}
else
{
final int loc_x = 55024;
final int loc_y = 17368;
final int loc_z = -5412;
final int heading = 0;
orfen = (L2GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + orfen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(ORFEN, LIVE);
GrandBossManager.getInstance().addBoss(orfen);
}
}
break;
case LIVE:
{
/*
* int loc_x = info.getInteger("loc_x"); int loc_y = info.getInteger("loc_y"); int loc_z = info.getInteger("loc_z"); int heading = info.getInteger("heading");
*/
final int loc_x = 55024;
final int loc_y = 17368;
final int loc_z = -5412;
final int heading = 0;
final int hp = info.getInteger("currentHP");
final int mp = info.getInteger("currentMP");
orfen = (L2GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + orfen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().addBoss(orfen);
orfen.setCurrentHpMp(hp, mp);
}
break;
default:
{
final int loc_x = 55024;
final int loc_y = 17368;
final int loc_z = -5412;
final int heading = 0;
orfen = (L2GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + orfen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(ORFEN, LIVE);
GrandBossManager.getInstance().addBoss(orfen);
}
}
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
final Event event_enum = Event.valueOf(event.toUpperCase());
switch (event_enum)
{
case ORFEN_SPAWN:
{
final int loc_x = 55024;
final int loc_y = 17368;
final int loc_z = -5412;
final int heading = 0;
orfen = (L2GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + orfen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(ORFEN, LIVE);
GrandBossManager.getInstance().addBoss(orfen);
}
break;
case ORFEN_REFRESH:
{
if ((npc == null) || (npc.getSpawn() == null))
{
cancelQuestTimer("ORFEN_REFRESH", npc, null);
break;
}
double saved_hp = -1;
if ((npc.getNpcId() == ORFEN) && !npc.getSpawn().is_customBossInstance())
{
saved_hp = GrandBossManager.getInstance().getStatsSet(ORFEN).getDouble("currentHP");
if (saved_hp < npc.getCurrentHp())
{
npc.setCurrentHp(saved_hp);
GrandBossManager.getInstance().getStatsSet(ORFEN).set("currentHP", npc.getMaxHp());
}
}
if ((Teleported && (npc.getCurrentHp() > (npc.getMaxHp() * 0.95))))
{
cancelQuestTimer("ORFEN_REFRESH", npc, null);
startQuestTimer("ORFEN_RETURN", 10000, npc, null);
}
else
{ // restart the refresh scheduling
startQuestTimer("ORFEN_REFRESH", 10000, npc, null);
}
}
break;
case ORFEN_RETURN:
{
if ((npc == null) || (npc.getSpawn() == null))
{
break;
}
Teleported = false;
FirstAttacked = false;
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.getSpawn().setX(55024);
npc.getSpawn().setY(17368);
npc.getSpawn().setZ(-5412);
npc.teleToLocation(55024, 17368, -5412, false);
}
break;
default:
{
LOGGER.info("ORFEN: Not defined event: " + event + "!");
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
final int npcId = npc.getNpcId();
if (npcId == ORFEN)
{
if (FirstAttacked)
{
if (((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2)) && !Teleported)
{
GrandBossManager.getInstance().getStatsSet(ORFEN).set("currentHP", npc.getCurrentHp());
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
Teleported = true;
npc.getSpawn().setX(43577);
npc.getSpawn().setY(15985);
npc.getSpawn().setZ(-4396);
npc.teleToLocation(43577, 15985, -4396, false);
startQuestTimer("ORFEN_REFRESH", 10000, npc, null);
}
else if (npc.isInsideRadius(attacker, 1000, false, false) && !npc.isInsideRadius(attacker, 300, false, false) && (Rnd.get(10) == 0))
{
attacker.teleToLocation(npc.getX(), npc.getY(), npc.getZ());
npc.setTarget(attacker);
npc.doCast(SkillTable.getInstance().getInfo(4064, 1));
}
}
else
{
FirstAttacked = true;
}
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
if (npc.getNpcId() == ORFEN)
{
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
if (!npc.getSpawn().is_customBossInstance())
{
GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD);
// time is 48hour +/- 20hour
final long respawnTime = (long) (Config.ORFEN_RESP_FIRST + Rnd.get(Config.ORFEN_RESP_SECOND)) * 3600000;
cancelQuestTimer("ORFEN_REFRESH", npc, null);
startQuestTimer("ORFEN_SPAWN", respawnTime, null, null);
// also save the respawn time so that the info is maintained past reboots
final StatsSet info = GrandBossManager.getInstance().getStatsSet(ORFEN);
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
GrandBossManager.getInstance().setStatsSet(ORFEN, info);
}
}
return super.onKill(npc, killer, isPet);
}
public static void main(String[] args)
{
new Orfen(-1, "Orfen", "ai");
}
}

View File

@@ -0,0 +1,439 @@
/*
* 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 com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.SkillTable;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.entity.Announcements;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.zone.type.L2BossZone;
import com.l2jmobius.gameserver.network.serverpackets.PlaySound;
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.templates.StatsSet;
public class QueenAnt extends Quest
{
private static final int QUEEN = 29001;
private static final int LARVA = 29002;
private static final int NURSE = 29003;
private static final int GUARD = 29004;
private static final int ROYAL = 29005;
// QUEEN Status Tracking :
private static final int LIVE = 0; // Queen Ant is spawned.
private static final int DEAD = 1; // Queen Ant has been killed.
@SuppressWarnings("unused")
private static L2BossZone _Zone;
private L2MonsterInstance _larva = null;
private L2MonsterInstance _queen = null;
private final List<L2MonsterInstance> _Minions = new CopyOnWriteArrayList<>();
private final List<L2MonsterInstance> _Nurses = new CopyOnWriteArrayList<>();
enum Event
{
QUEEN_SPAWN, /* CHECK_QA_ZONE, */
CHECK_MINIONS_ZONE,
CHECK_NURSE_ALIVE,
ACTION,
DESPAWN_MINIONS,
SPAWN_ROYAL,
NURSES_SPAWN,
RESPAWN_ROYAL,
RESPAWN_NURSE,
LARVA_DESPAWN,
HEAL
}
public QueenAnt(int questId, String name, String descr)
{
super(questId, name, descr);
final int[] mobs =
{
QUEEN,
LARVA,
NURSE,
GUARD,
ROYAL
};
for (int mob : mobs)
{
addEventId(mob, Quest.QuestEventType.ON_KILL);
addEventId(mob, Quest.QuestEventType.ON_ATTACK);
}
_Zone = GrandBossManager.getInstance().getZone(-21610, 181594, -5734);
final StatsSet info = GrandBossManager.getInstance().getStatsSet(QUEEN);
final Integer status = GrandBossManager.getInstance().getBossStatus(QUEEN);
switch (status)
{
case DEAD:
{
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
if (temp > 0)
{
startQuestTimer("QUEEN_SPAWN", temp, null, null);
}
else
{
final L2GrandBossInstance queen = (L2GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(QUEEN, LIVE);
GrandBossManager.getInstance().addBoss(queen);
spawnBoss(queen);
}
}
break;
case LIVE:
{
/*
* int loc_x = info.getInteger("loc_x"); int loc_y = info.getInteger("loc_y"); int loc_z = info.getInteger("loc_z"); int heading = info.getInteger("heading");
*/
final int hp = info.getInteger("currentHP");
final int mp = info.getInteger("currentMP");
final L2GrandBossInstance queen = (L2GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().addBoss(queen);
queen.setCurrentHpMp(hp, mp);
spawnBoss(queen);
}
break;
default:
{
final L2GrandBossInstance queen = (L2GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(QUEEN, LIVE);
GrandBossManager.getInstance().addBoss(queen);
spawnBoss(queen);
}
}
}
private void spawnBoss(L2GrandBossInstance npc)
{
startQuestTimer("ACTION", 10000, npc, null, true);
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
startQuestTimer("SPAWN_ROYAL", 1000, npc, null);
startQuestTimer("NURSES_SPAWN", 1000, npc, null);
startQuestTimer("CHECK_MINIONS_ZONE", 30000, npc, null, true);
startQuestTimer("HEAL", 1000, null, null, true);
_queen = npc;
_larva = (L2MonsterInstance) addSpawn(LARVA, -21600, 179482, -5846, Rnd.get(360), false, 0);
_larva.setIsUnkillable(true);
_larva.setIsImobilised(true);
_larva.setIsAttackDisabled(true);
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
final Event event_enum = Event.valueOf(event);
switch (event_enum)
{
case QUEEN_SPAWN:
{
final L2GrandBossInstance queen = (L2GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
{
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
}
GrandBossManager.getInstance().setBossStatus(QUEEN, LIVE);
GrandBossManager.getInstance().addBoss(queen);
spawnBoss(queen);
}
break;
case LARVA_DESPAWN:
{
_larva.decayMe();
}
break;
case NURSES_SPAWN:
{
final int radius = 400;
for (int i = 0; i < 6; i++)
{
final int x = (int) (radius * Math.cos(i * 1.407)); // 1.407~2pi/6
final int y = (int) (radius * Math.sin(i * 1.407));
_Nurses.add((L2MonsterInstance) addSpawn(NURSE, npc.getX() + x, npc.getY() + y, npc.getZ(), 0, false, 0));
_Nurses.get(i).setIsAttackDisabled(true);
}
}
break;
case SPAWN_ROYAL:
{
final int radius = 400;
for (int i = 0; i < 8; i++)
{
final int x = (int) (radius * Math.cos(i * .7854)); // .7854~2pi/8
final int y = (int) (radius * Math.sin(i * .7854));
_Minions.add((L2MonsterInstance) addSpawn(ROYAL, npc.getX() + x, npc.getY() + y, npc.getZ(), 0, false, 0));
}
}
break;
case RESPAWN_ROYAL:
{
_Minions.add((L2MonsterInstance) addSpawn(ROYAL, npc.getX(), npc.getY(), npc.getZ(), 0, true, 0));
}
case RESPAWN_NURSE:
{
_Nurses.add((L2MonsterInstance) addSpawn(NURSE, npc.getX(), npc.getY(), npc.getZ(), 0, true, 0));
}
break;
case DESPAWN_MINIONS:
{
for (int i = 0; i < _Minions.size(); i++)
{
final L2Attackable mob = _Minions.get(i);
if (mob != null)
{
mob.decayMe();
}
}
for (int k = 0; k < _Nurses.size(); k++)
{
final L2MonsterInstance _nurse = _Nurses.get(k);
if (_nurse != null)
{
_nurse.decayMe();
}
}
_Nurses.clear();
_Minions.clear();
}
break;
case CHECK_MINIONS_ZONE:
{
for (int i = 0; i < _Minions.size(); i++)
{
final L2Attackable mob = _Minions.get(i);
if ((mob != null) && !mob.isInsideRadius(npc.getX(), npc.getY(), 700, false))/* !_Zone.isInsideZone(mob)) */
{
mob.teleToLocation(npc.getX(), npc.getY(), npc.getZ());
}
}
}
break;
case CHECK_NURSE_ALIVE:
{
int deadNurses = 0;
for (L2MonsterInstance nurse : _Nurses)
{
if (nurse.isDead())
{
deadNurses++;
}
}
if (deadNurses == _Nurses.size())
{
startQuestTimer("RESPAWN_NURSE", Config.QA_RESP_NURSE * 1000, npc, null);
}
}
break;
/*
* case CHECK_QA_ZONE:{ int loc_x = -21610; int loc_y = 181594; int loc_z = -5734; if(!npc.isInsideRadius(loc_x,loc_y,3000,false)){ npc.teleToLocation(loc_x, loc_y, loc_z); } startQuestTimer("CHECK_MINIONS_ZONE", 1000, npc, null); } break;
*/
case ACTION:
{
if (Rnd.get(3) == 0)
{
if (Rnd.get(2) == 0)
{
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 3));
}
else
{
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 4));
}
}
/*
* if(Math.abs(npc.getX() + 21610) > 1000 || Math.abs(npc.getY() - 181594) > 2500) { ((L2Attackable) npc).clearAggroList(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); npc.teleToLocation(-21610, 181594, -5740); }
*/
// startQuestTimer("ACTION", 10000, npc, null);
}
break;
case HEAL:
{
boolean notCasting;
final boolean larvaNeedHeal = (_larva != null) && (_larva.getCurrentHp() < _larva.getMaxHp());
final boolean queenNeedHeal = (_queen != null) && (_queen.getCurrentHp() < _queen.getMaxHp());
boolean nurseNeedHeal = false;
for (L2MonsterInstance nurse : _Nurses)
{
nurseNeedHeal = (nurse != null) && (nurse.getCurrentHp() < nurse.getMaxHp());
if ((nurse == null) || nurse.isDead() || nurse.isCastingNow())
{
continue;
}
notCasting = nurse.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST;
if (larvaNeedHeal)
{
if ((nurse.getTarget() != _larva) || notCasting)
{
getIntoPosition(nurse, _larva);
nurse.setTarget(_larva);
nurse.doCast(SkillTable.getInstance().getInfo(4020, 1));
nurse.doCast(SkillTable.getInstance().getInfo(4024, 1));
}
continue;
}
if (queenNeedHeal)
{
if ((nurse.getTarget() != _queen) || notCasting)
{
getIntoPosition(nurse, _queen);
nurse.setTarget(_queen);
nurse.doCast(SkillTable.getInstance().getInfo(4020, 1));
}
continue;
}
if (nurseNeedHeal)
{
if ((nurse.getTarget() != nurse) || notCasting)
{
for (int k = 0; k < _Nurses.size(); k++)
{
getIntoPosition(_Nurses.get(k), nurse);
_Nurses.get(k).setTarget(nurse);
_Nurses.get(k).doCast(SkillTable.getInstance().getInfo(4020, 1));
}
}
}
if (notCasting && (nurse.getTarget() != null))
{
nurse.setTarget(null);
}
}
}
break;
default:
{
LOGGER.info("QUEEN: Not defined event: " + event + "!");
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
final int npcId = npc.getNpcId();
if (npcId == NURSE)
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null);
return null;
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
final int npcId = npc.getNpcId();
final Integer status = GrandBossManager.getInstance().getBossStatus(QUEEN);
if (npcId == QUEEN)
{
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
if (!npc.getSpawn().is_customBossInstance())
{
GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD);
// time is 36hour +/- 17hour
final long respawnTime = (Config.QA_RESP_FIRST + Rnd.get(Config.QA_RESP_SECOND)) * 3600000;
startQuestTimer("QUEEN_SPAWN", respawnTime, null, null);
startQuestTimer("LARVA_DESPAWN", 4 * 60 * 60 * 1000, null, null);
cancelQuestTimer("ACTION", npc, null);
cancelQuestTimer("SPAWN_ROYAL", npc, null);
cancelQuestTimer("CHECK_MINIONS_ZONE", npc, null);
cancelQuestTimer("CHECK_NURSE_ALIVE", npc, null);
cancelQuestTimer("HEAL", null, null);
// cancelQuestTimer("CHECK_QA_ZONE", npc, null);
// also save the respawn time so that the info is maintained past reboots
final StatsSet info = GrandBossManager.getInstance().getStatsSet(QUEEN);
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
GrandBossManager.getInstance().setStatsSet(QUEEN, info);
}
startQuestTimer("DESPAWN_MINIONS", 10000, null, null);
}
else if (status == LIVE)
{
if ((npcId == ROYAL) || (npcId == NURSE))
{
npc.decayMe();
if (_Minions.contains(npc))
{
_Minions.remove(npc);
}
else
{
_Nurses.remove(npc);
}
if (npcId == ROYAL)
{
startQuestTimer("RESPAWN_ROYAL", (Config.QA_RESP_ROYAL + Rnd.get(40)) * 1000, npc, null);
}
else if (npcId == NURSE)
{
startQuestTimer("CHECK_NURSE_ALIVE", 1000, npc, null);
}
}
}
return super.onKill(npc, killer, isPet);
}
public void getIntoPosition(L2MonsterInstance nurse, L2MonsterInstance caller)
{
if (!nurse.isInsideRadius(caller, 300, false, false))
{
nurse.getAI().moveToPawn(caller, 300);
}
}
public static void main(String[] args)
{
new QueenAnt(-1, "queen_ant", "ai");
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,202 @@
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.datatables.csv import DoorTable
from com.l2jmobius.gameserver.instancemanager import CastleManager
from com.l2jmobius.gameserver.instancemanager import GrandBossManager
from com.l2jmobius.gameserver.model.actor.position import Location
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.gameserver.network.serverpackets import SocialAction
from com.l2jmobius.gameserver.network.serverpackets import SpecialCamera
from com.l2jmobius.commons.util import Rnd
from java.lang import System
Benom = 29054
BenomTeleport = 13101
BenomSpeak = [ "You should have finished me when you had the chance!!!", "I will crush all of you!!!", "I am not finished here, come face me!!!", "You cowards!!! I will torture each and everyone of you!!!" ]
WalkTimes = [ 18000,17000,4500,16000,22000,14000,10500,14000,9500,12500,20500,14500,17000,20000,22000,11000,11000,20000,8000,5500,20000,18000,25000,28000,25000,25000,25000,25000,10000,24000,7000,12000,20000 ]
# Benom status tracking
LIVE = 0
DEAD = 1
benomWalkRoutes = {
0: [ 12565, -49739, -547 ],
1: [ 11242, -49689, -33 ],
2: [ 10751, -49702, 83 ],
3: [ 10824, -50808, 316 ],
4: [ 9084, -50786, 972 ],
5: [ 9095, -49787, 1252 ],
6: [ 8371, -49711, 1252 ],
7: [ 8423, -48545, 1252 ],
8: [ 9105, -48474, 1252 ],
9: [ 9085, -47488, 972 ],
10: [ 10858, -47527, 316 ],
11: [ 10842, -48626, 75 ],
12: [ 12171, -48464, -547 ],
13: [ 13565, -49145, -535 ],
14: [ 15653, -49159, -1059 ],
15: [ 15423, -48402, -839 ],
16: [ 15066, -47438, -419 ],
17: [ 13990, -46843, -292 ],
18: [ 13685, -47371, -163 ],
19: [ 13384, -47470, -163 ],
20: [ 14609, -48608, 346 ],
21: [ 13878, -47449, 747 ],
22: [ 12894, -49109, 980 ],
23: [ 10135, -49150, 996 ],
24: [ 12894, -49109, 980 ],
25: [ 13738, -50894, 747 ],
26: [ 14579, -49698, 347 ],
27: [ 12896, -51135, -166 ],
28: [ 12971, -52046, -292, ],
29: [ 15140, -50781, -442, ],
30: [ 15328, -50406, -603 ],
31: [ 15594, -49192, -1059 ],
32: [ 13175, -49153, -537 ],
}
class benom (JQuest):
def __init__(self, id, name, descr) :
JQuest.__init__(self, id, name, descr)
self.Teleport = []
self.Benomm = []
castleOwner = CastleManager.getInstance().getCastleById(8).getOwnerId()
siegeDate = CastleManager.getInstance().getCastleById(8).getSiegeDate().getTimeInMillis()
benomTeleporterSpawn = (siegeDate - System.currentTimeMillis()) - 86400000
benomRaidRoomSpawn = (siegeDate - System.currentTimeMillis()) - 86400000
benomRaidSiegeSpawn = (siegeDate - System.currentTimeMillis())
if benomTeleporterSpawn < 0 :
benomTeleporterSpawn = 1
if benomRaidSiegeSpawn < 0 :
benomRaidSiegeSpawn = 1
self.BenomWalkRouteStep = 0
self.BenomIsSpawned = 0
if castleOwner > 0 :
if benomTeleporterSpawn >= 1 :
self.startQuestTimer("BenomTeleSpawn", benomTeleporterSpawn, None, None)
if (siegeDate - System.currentTimeMillis()) > 0 :
self.startQuestTimer("BenomRaidRoomSpawn", benomRaidRoomSpawn, None, None)
self.startQuestTimer("BenomRaidSiegeSpawn", benomRaidSiegeSpawn, None, None)
self.Benom = Benom
def onTalk(self, npc, player) :
npcId = npc.getNpcId()
castleOwner = CastleManager.getInstance().getCastleById(8).getOwnerId()
clanId = player.getClanId()
if castleOwner and clanId :
if castleOwner == clanId :
X = 12558 + (Rnd.get(200) - 100)
Y = -49279 + (Rnd.get(200) - 100)
player.teleToLocation(X, Y, -3007)
return
else :
htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>"
else :
htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>"
return htmltext
def onAdvEvent(self, event, npc, player) :
status = GrandBossManager.getInstance().getBossStatus(Benom)
if event == "BenomTeleSpawn" :
self.Teleport = self.addSpawn(BenomTeleport, 11013, -49629, -547, 13400, False, 0)
elif event == "BenomRaidRoomSpawn" :
if self.BenomIsSpawned == 0 and status == 0 :
self.Benomm = self.addSpawn(Benom, 12047, -49211, -3009, 0, False, 0)
self.BenomIsSpawned = 1
elif event == "BenomRaidSiegeSpawn" :
if status == 0 :
if self.BenomIsSpawned == 0 :
self.Benomm = self.addSpawn(Benom, 11025, -49152, -537, 0, False, 0)
self.BenomIsSpawned = 1
elif self.BenomIsSpawned == 1 :
self.Benomm.teleToLocation(11025, -49152, -537)
self.startQuestTimer("BenomSpawnEffect", 100, None, None)
self.startQuestTimer("BenomBossDespawn", 5400000, None, None)
self.Teleport.deleteMe()
elif event == "BenomSpawnEffect" :
self.Benomm.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE)
self.Benomm.broadcastPacket(SpecialCamera(self.Benomm.getObjectId(), 200, 0, 150, 0, 5000))
self.Benomm.broadcastPacket(SocialAction(self.Benomm.getObjectId(), 3))
self.startQuestTimer("BenomWalk", 5000, self.Benomm, None)
self.BenomWalkRouteStep = 0
elif event == "Attacking" :
NumPlayers = []
for player in npc.getKnownList().getKnownPlayers().values() :
NumPlayers.append(player)
if len(NumPlayers) > 0 :
target = NumPlayers[Rnd.get(len(NumPlayers))]
npc.addDamageHate(target, 0, 999)
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target)
self.startQuestTimer("Attacking", 2000, npc, player)
elif len(NumPlayers) == 0 :
self.startQuestTimer("BenomWalkFinish", 2000, npc, None)
elif event == "BenomWalkFinish" :
if npc.getCastle().getSiege().getIsInProgress() :
self.cancelQuestTimer("Attacking", npc, player)
X = benomWalkRoutes[self.BenomWalkRouteStep][0]
Y = benomWalkRoutes[self.BenomWalkRouteStep][1]
Z = benomWalkRoutes[self.BenomWalkRouteStep][2]
npc.teleToLocation(X, Y, Z)
npc.setWalking()
self.BenomWalkRouteStep = 0
self.startQuestTimer("BenomWalk", 2200, npc, None)
elif event == "BenomWalk" :
if self.BenomWalkRouteStep == 33 :
self.BenomWalkRouteStep = 0
self.startQuestTimer("BenomWalk", 100, npc, None)
else :
self.startQuestTimer("Talk", 100, npc, None)
if self.BenomWalkRouteStep == 14 :
self.startQuestTimer("DoorOpen", 15000, None, None)
self.startQuestTimer("DoorClose", 23000, None, None)
if self.BenomWalkRouteStep == 32 :
self.startQuestTimer("DoorOpen", 500, None, None)
self.startQuestTimer("DoorClose", 4000, None, None)
Time = WalkTimes[self.BenomWalkRouteStep]
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE)
X = benomWalkRoutes[self.BenomWalkRouteStep][0]
Y = benomWalkRoutes[self.BenomWalkRouteStep][1]
Z = benomWalkRoutes[self.BenomWalkRouteStep][2]
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, Location(X, Y, Z, 0))
self.BenomWalkRouteStep = int(self.BenomWalkRouteStep) + 1
self.startQuestTimer("BenomWalk", Time, npc, None)
elif event == "DoorOpen" :
DoorTable.getInstance().getDoor(20160005).openMe()
elif event == "DoorClose" :
DoorTable.getInstance().getDoor(20160005).closeMe()
elif event == "Talk" :
if Rnd.get(100) < 40 :
npc.broadcastPacket(CreatureSay(npc.getObjectId(), 0, "Benom", BenomSpeak[Rnd.get(4)]))
elif event == "BenomBossDespawn" :
GrandBossManager.getInstance().setBossStatus(Benom,LIVE)
self.BenomIsSpawned = 0
self.Benomm.deleteMe()
return
def onAttack (self,npc,player,damage,isPet) :
self.cancelQuestTimer("BenomWalk", npc, None)
self.cancelQuestTimer("BenomWalkFinish", npc, None)
self.startQuestTimer("Attacking", 100, npc, player)
return
def onKill(self, npc, player, isPet) :
GrandBossManager.getInstance().setBossStatus(Benom,DEAD)
self.cancelQuestTimer("BenomWalk", npc, None)
self.cancelQuestTimer("BenomWalkFinish", npc, None)
self.cancelQuestTimer("BenomBossDespawn", npc, None)
self.cancelQuestTimer("Talk", npc, None)
self.cancelQuestTimer("Attacking", npc, None)
return
QUEST = benom(-1, "benom", "ai")
QUEST.addStartNpc(BenomTeleport)
QUEST.addTalkId(BenomTeleport)
QUEST.addAttackId(Benom)
QUEST.addKillId(Benom)

View File

@@ -0,0 +1,76 @@
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.datatables.sql import SpawnTable
from com.l2jmobius.gameserver.model.actor.position import Location
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import ActionFailed
from com.l2jmobius.gameserver.network.serverpackets import PlaySound
from com.l2jmobius.gameserver.network.serverpackets import SocialAction
from com.l2jmobius.gameserver.network.serverpackets import SpecialCamera
Doctor_Chaos = 32033
Strange_Machine = 32032
Chaos_Golem = 25512
class Quest (JQuest) :
def __init__(self,id,name,descr):
JQuest.__init__(self,id,name,descr)
self.isGolemSpawned = 0
self.isChaosSpawned = 1
def FindTemplate (self, npcId) :
npcinstance = 0
for spawn in SpawnTable.getInstance().getSpawnTable().values():
if spawn :
if spawn.getNpcId() == npcId:
npcinstance = spawn.getLastSpawn()
break
return npcinstance
def onAdvEvent (self,event,npc, player) :
if event == "1" :
machine_instance = self.FindTemplate(Strange_Machine)
if machine_instance :
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, machine_instance)
machine_instance.broadcastPacket(SpecialCamera(machine_instance.getObjectId(),1,-200,15,10000,20000))
else :
print "Dr Chaos AI: problem finding Strange Machine (npcid = "+Strange_Machine+"). Error: not spawned!"
self.startQuestTimer("2",2000,npc,player)
self.startQuestTimer("3",10000,npc,player)
if self.isChaosSpawned == 0 :
chaos = self.addSpawn(32033,96471,-111425,-3334,0,False,0)
self.isChaosSpawned == 1
self.startQuestTimer("2",2000,npc,player)
self.startQuestTimer("3",10000,npc,player)
elif event == "2" :
npc.broadcastPacket(SocialAction(npc.getObjectId(),3))
elif event == "3" :
npc.broadcastPacket(SpecialCamera(npc.getObjectId(),1,-150,10,3000,20000))
self.startQuestTimer("4",2500,npc,player)
elif event == "4" :
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, Location(96055,-110759,-3312,0))
self.startQuestTimer("5",2000,npc,player)
elif event == "5" :
player.teleToLocation(94832,-112624,-3304)
npc.teleToLocation(-113091,-243942,-15536)
if self.isGolemSpawned == 0 :
golem = self.addSpawn(25512,94640,-112496,-3336,0,False,0)
self.isGolemSpawned == 1
self.startQuestTimer("6",1000,golem,player)
player.sendPacket(PlaySound(1,"Rm03_A",0,0,0,0,0))
elif event == "6" :
npc.broadcastPacket(SpecialCamera(npc.getObjectId(),30,-200,20,6000,8000))
return
def onFirstTalk (self,npc,player):
npcId = npc.getNpcId()
if npcId == Doctor_Chaos :
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, Location(96323,-110914,-3328,0))
self.startQuestTimer("1",3000,npc,player)
return ""
QUEST = Quest(-1,"Doctor Chaos","ai")
QUEST.addFirstTalkId(32033)

View File

@@ -0,0 +1,59 @@
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.model.entity.siege.clanhalls import DevastatedCastle
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.instancemanager import ClanHallManager
from com.l2jmobius.commons.util import Rnd
from com.l2jmobius.gameserver.model import L2Clan
from com.l2jmobius.gameserver.model import L2ClanMember
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

@@ -0,0 +1,58 @@
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.model.entity.siege.clanhalls import FortressOfResistance
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.instancemanager import ClanHallManager
from com.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)

View File

@@ -0,0 +1,106 @@
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.instancemanager import GrandBossManager
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import SocialAction
from com.l2jmobius.gameserver.network.serverpackets import SpecialCamera
from com.l2jmobius.commons.util import Rnd
from java.lang import System
STATUE = 32109
SAILREN = 29065
VELO = 22196
PTERO = 22199
TREX = 22215
STONE = 8784
class Sailren(JQuest) :
def __init__(self,id,name,descr):
self.vlc = []
self.ptr = []
self.trx = []
self.slrn = []
JQuest.__init__(self,id,name,descr)
def onAdvEvent (self,event,npc,player):
if event == "start" :
self.vlc = self.addSpawn(VELO,27845,-5567,-1982,45000,False,0)
self.startQuestTimer("camera",2000, self.vlc, player)
self.cancelQuestTimer("start",npc,None)
if event == "round2" :
self.ptr = self.addSpawn(PTERO,27838,-5578,-1982,45000,False,0)
self.startQuestTimer("camera",2000, self.ptr, player)
self.cancelQuestTimer("round2",npc,None)
if event == "round3" :
self.trx = self.addSpawn(TREX,27838,-5578,-1982,45000,False,0)
self.startQuestTimer("camera",2000, self.trx, player)
self.cancelQuestTimer("round3",npc,None)
if event == "sailren" :
self.slrn = self.addSpawn(SAILREN,27489,-6223,-1982,45000,False,0)
self.startQuestTimer("camera",2000, self.slrn, player)
self.startQuestTimer("vkrovatku",1200000, self.slrn, None)
self.cancelQuestTimer("round4",npc,None)
elif event == "camera" :
player.broadcastPacket(SpecialCamera(npc.getObjectId(),400,-75,3,-150,5000))
npc.broadcastPacket(SocialAction(npc.getObjectId(),1))
elif event == "open" :
self.deleteGlobalQuestVar("close")
self.cancelQuestTimer("open",npc,None)
elif event == "vkrovatku" :
npc.deleteMe()
self.deleteGlobalQuestVar("close")
self.cancelQuestTimer("open",npc,None)
self.cancelQuestTimer("vkrovatku",npc,None)
return
def onTalk (self,npc,player):
st = player.getQuestState("sailren")
npcId = npc.getNpcId()
close = self.loadGlobalQuestVar("close")
time = self.loadGlobalQuestVar("time")
party = player.getParty()
if npcId == STATUE :
if st.getQuestItemsCount(STONE) >= 1:
if close == "" :
if party:
for player in party.getPartyMembers() :
st.takeItems(STONE,1)
self.saveGlobalQuestVar("close", "1")
zone = GrandBossManager.getInstance().getZone(27244,-7026,-1974)
if zone:
zone.allowPlayerEntry(player, 3600)
player.teleToLocation(27244,-7026,-1974)
self.startQuestTimer("start",30000,npc,player)
self.startQuestTimer("open",1800000,npc,None)
else :
return "<html><body><font color=LEVEL>Only with party...</font></body></html>"
else :
return "<html><body><font color=LEVEL>Some one else is inside...</font></body></html>"
else :
return "<html><body>You need quest item: <font color=LEVEL>Gazkh...</font></body></html>"
return
def onKill(self,npc,player,isPet):
if npc == self.vlc :
self.startQuestTimer("round2",30000,npc,player)
if npc == self.ptr :
self.startQuestTimer("round3",60000,npc,player)
if npc == self.trx :
self.startQuestTimer("sailren",180000,npc,player)
if npc == self.slrn :
self.deleteGlobalQuestVar("close")
self.cancelQuestTimer("open",npc,None)
return
QUEST = Sailren(-1,"sailren","ai")
QUEST.addStartNpc(STATUE)
QUEST.addTalkId(STATUE)
QUEST.addKillId(VELO)
QUEST.addKillId(PTERO)
QUEST.addKillId(TREX)
QUEST.addKillId(SAILREN)

View File

@@ -0,0 +1,53 @@
/*
* 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.others;
import com.l2jmobius.gameserver.datatables.SkillTable;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
/**
* @author Mobius
* @note Based on python script
*/
public class AncientEgg extends Quest
{
// NPC
private static final int EGG = 18344; // Ancient Egg
// Skill
private static final int SIGNAL = 5088; // Signal
private AncientEgg(int questId, String name, String descr)
{
super(questId, name, descr);
addAttackId(EGG);
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
attacker.setTarget(attacker);
attacker.doCast(SkillTable.getInstance().getInfo(SIGNAL, 1));
return null;
}
public static void main(String[] args)
{
new AncientEgg(-1, "AncientEgg", "ai");
}
}

View File

@@ -0,0 +1,192 @@
/*
* 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.others;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.SkillTable;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2Skill;
import com.l2jmobius.gameserver.model.L2Skill.SkillType;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import com.l2jmobius.gameserver.util.Util;
public class Monastery extends Quest
{
static final int[] mobs1 =
{
22124,
22125,
22126,
22127,
22129
};
static final int[] mobs2 =
{
22134,
22135
};
// TODO: npcstring
static final String[] text =
{
"You cannot carry a weapon without authorization!",
"name, why would you choose the path of darkness?!",
"name! How dare you defy the will of Einhasad!"
};
public Monastery(int questId, String name, String descr)
{
super(questId, name, descr);
registerMobs(mobs1, QuestEventType.ON_AGGRO_RANGE_ENTER, QuestEventType.ON_SPAWN, QuestEventType.ON_SPELL_FINISHED);
registerMobs(mobs2, QuestEventType.ON_SPELL_FINISHED);
}
@Override
public String onAggroRangeEnter(L2NpcInstance npc, L2PcInstance player, boolean isPet)
{
if (Util.contains(mobs1, npc.getNpcId()) && !npc.isInCombat() && (npc.getTarget() == null))
{
if ((player.getActiveWeaponInstance() != null) && !player.isSilentMoving())
{
npc.setTarget(player);
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), text[0]));
switch (npc.getNpcId())
{
case 22124:
case 22126:
{
final L2Skill skill = SkillTable.getInstance().getInfo(4589, 8);
npc.doCast(skill);
break;
}
default:
{
npc.setIsRunning(true);
((L2Attackable) npc).addDamageHate(player, 0, 999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
break;
}
}
}
else if (((L2Attackable) npc).getMostHated() == null)
{
return null;
}
}
return super.onAggroRangeEnter(npc, player, isPet);
}
@Override
public String onSpawn(L2NpcInstance npc)
{
if (Util.contains(mobs1, npc.getNpcId()))
{
final List<L2Playable> result = new ArrayList<>();
final Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
for (L2Object obj : objs)
{
if ((obj instanceof L2PcInstance) || (obj instanceof L2PetInstance))
{
if (Util.checkIfInRange(npc.getAggroRange(), npc, obj, true) && !((L2Character) obj).isDead())
{
result.add((L2Playable) obj);
}
}
}
if (!result.isEmpty() && (result.size() != 0))
{
final Object[] characters = result.toArray();
for (Object obj : characters)
{
final L2Playable target = (L2Playable) (obj instanceof L2PcInstance ? obj : ((L2Summon) obj).getOwner());
if ((target.getActiveWeaponInstance() == null) || ((target instanceof L2PcInstance) && ((L2PcInstance) target).isSilentMoving()) || ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isSilentMoving()))
{
continue;
}
if ((target.getActiveWeaponInstance() != null) && !npc.isInCombat() && (npc.getTarget() == null))
{
npc.setTarget(target);
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), text[0]));
switch (npc.getNpcId())
{
case 22124:
case 22126:
case 22127:
{
final L2Skill skill = SkillTable.getInstance().getInfo(4589, 8);
npc.doCast(skill);
break;
}
default:
{
npc.setIsRunning(true);
((L2Attackable) npc).addDamageHate(target, 0, 999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
break;
}
}
}
}
}
}
return super.onSpawn(npc);
}
@Override
public String onSpellFinished(L2NpcInstance npc, L2PcInstance player, L2Skill skill)
{
if (Util.contains(mobs1, npc.getNpcId()) && (skill.getId() == 4589))
{
npc.setIsRunning(true);
((L2Attackable) npc).addDamageHate(player, 0, 999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
}
if (Util.contains(mobs2, npc.getNpcId()))
{
if (skill.getSkillType() == SkillType.AGGDAMAGE)
{
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), text[Rnd.get(2) + 1].replace("name", player.getName())));
((L2Attackable) npc).addDamageHate(player, 0, 999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
}
}
return super.onSpellFinished(npc, player, skill);
}
public static void main(String[] args)
{
new Monastery(-1, "monastery", "ai");
}
}

View File

@@ -0,0 +1,274 @@
/*
* 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.others;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
public class SummonMinions extends Quest
{
private static int HasSpawned;
private static Set<Integer> myTrackingSet = new CopyOnWriteArraySet<>(); // Used to track instances of npcs
private final Map<Integer, List<L2PcInstance>> _attackersList = new ConcurrentHashMap<>();
private static final Map<Integer, Integer[]> MINIONS = new HashMap<>();
static
{
MINIONS.put(20767, new Integer[]
{
20768,
20769,
20770
}); // Timak Orc Troop
// MINIONS.put(22030, new Integer[]{22045, 22047, 22048}); //Ragna Orc Shaman
// MINIONS.put(22032, new Integer[]{22036}); //Ragna Orc Warrior - summons shaman but not 22030 ><
// MINIONS.put(22038, new Integer[]{22037}); //Ragna Orc Hero
MINIONS.put(21524, new Integer[]
{
21525
}); // Blade of Splendor
MINIONS.put(21531, new Integer[]
{
21658
}); // Punishment of Splendor
MINIONS.put(21539, new Integer[]
{
21540
}); // Wailing of Splendor
MINIONS.put(22257, new Integer[]
{
18364,
18364
}); // Island Guardian
MINIONS.put(22258, new Integer[]
{
18364,
18364
}); // White Sand Mirage
MINIONS.put(22259, new Integer[]
{
18364,
18364
}); // Muddy Coral
MINIONS.put(22260, new Integer[]
{
18364,
18364
}); // Kleopora
MINIONS.put(22261, new Integer[]
{
18365,
18365
}); // Seychelles
MINIONS.put(22262, new Integer[]
{
18365,
18365
}); // Naiad
MINIONS.put(22263, new Integer[]
{
18365,
18365
}); // Sonneratia
MINIONS.put(22264, new Integer[]
{
18366,
18366
}); // Castalia
MINIONS.put(22265, new Integer[]
{
18366,
18366
}); // Chrysocolla
MINIONS.put(22266, new Integer[]
{
18366,
18366
}); // Pythia
}
public SummonMinions(int questId, String name, String descr)
{
super(questId, name, descr);
final int[] mobs =
{
20767,
21524,
21531,
21539,
22257,
22258,
22259,
22260,
22261,
22262,
22263,
22264,
22265,
22266
};
for (int mob : mobs)
{
addEventId(mob, Quest.QuestEventType.ON_KILL);
addEventId(mob, Quest.QuestEventType.ON_ATTACK);
}
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
final int npcId = npc.getNpcId();
final int npcObjId = npc.getObjectId();
if (MINIONS.containsKey(npcId))
{
if (!myTrackingSet.contains(npcObjId)) // this allows to handle multiple instances of npc
{
myTrackingSet.add(npcObjId);
HasSpawned = npcObjId;
}
if (HasSpawned == npcObjId)
{
if ((npcId == 22030) || (npcId == 22032) || (npcId == 22038)) // mobs that summon minions only on certain hp
{
if (npc.getStatus().getCurrentHp() < (npc.getMaxHp() / 2))
{
HasSpawned = 0;
if (Rnd.get(100) < 33) // mobs that summon minions only on certain chance
{
Integer[] minions = MINIONS.get(npcId);
for (Integer minion : minions)
{
final L2Attackable newNpc = (L2Attackable) addSpawn(minion, (npc.getX() + Rnd.get(-150, 150)), (npc.getY() + Rnd.get(-150, 150)), npc.getZ(), 0, false, 0);
newNpc.setRunning();
newNpc.addDamageHate(attacker, 0, 999);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
}
}
}
}
else if ((npcId == 22257) || (npcId == 22258) || (npcId == 22259) || (npcId == 22260) || (npcId == 22261) || (npcId == 22262) || (npcId == 22263) || (npcId == 22264) || (npcId == 22265) || (npcId == 22266))
{
if (isPet)
{
attacker = attacker.getPet().getOwner();
}
if (attacker.getParty() != null)
{
for (L2PcInstance member : attacker.getParty().getPartyMembers())
{
if (_attackersList.get(npcObjId) == null)
{
final List<L2PcInstance> player = new ArrayList<>();
player.add(member);
_attackersList.put(npcObjId, player);
}
else if (!_attackersList.get(npcObjId).contains(member))
{
_attackersList.get(npcObjId).add(member);
}
}
}
else if (_attackersList.get(npcObjId) == null)
{
final List<L2PcInstance> player = new ArrayList<>();
player.add(attacker);
_attackersList.put(npcObjId, player);
}
else if (!_attackersList.get(npcObjId).contains(attacker))
{
_attackersList.get(npcObjId).add(attacker);
}
if (((attacker.getParty() != null) && (attacker.getParty().getMemberCount() > 2)) || (_attackersList.get(npcObjId).size() > 2)) // Just to make sure..
{
HasSpawned = 0;
Integer[] minions = MINIONS.get(npcId);
for (Integer minion : minions)
{
final L2Attackable newNpc = (L2Attackable) addSpawn(minion, npc.getX() + Rnd.get(-150, 150), npc.getY() + Rnd.get(-150, 150), npc.getZ(), 0, false, 0);
newNpc.setRunning();
newNpc.addDamageHate(attacker, 0, 999);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
}
}
}
else
// mobs without special conditions
{
HasSpawned = 0;
Integer[] minions = MINIONS.get(npcId);
if (npcId != 20767)
{
for (Integer minion : minions)
{
final L2Attackable newNpc = (L2Attackable) addSpawn(minion, npc.getX() + Rnd.get(-150, 150), npc.getY() + Rnd.get(-150, 150), npc.getZ(), 0, false, 0);
newNpc.setRunning();
newNpc.addDamageHate(attacker, 0, 999);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
}
}
else
{
for (Integer minion : minions)
{
addSpawn(minion, (npc.getX() + Rnd.get(-100, 100)), (npc.getY() + Rnd.get(-100, 100)), npc.getZ(), 0, false, 0);
}
}
if (npcId == 20767)
{
npc.broadcastPacket(new CreatureSay(npcObjId, 0, npc.getName(), "Come out, you children of darkness!"));
}
}
}
}
if (_attackersList.get(npcObjId) != null)
{
_attackersList.get(npcObjId).clear();
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
final int npcId = npc.getNpcId();
final int npcObjId = npc.getObjectId();
if (MINIONS.containsKey(npcId))
{
myTrackingSet.remove(npcObjId);
}
return super.onKill(npc, killer, isPet);
}
public static void main(String[] args)
{
new SummonMinions(-1, "SummonMinions", "ai");
}
}

View File

@@ -0,0 +1,233 @@
/*
* 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.others;
import java.util.ArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
public class Transform extends Quest
{
private final ArrayList<Transformer> _mobs = new ArrayList<>();
private static class Transformer
{
private final int _id;
private final int _idPoly;
private final int _chance;
private final int _message;
protected Transformer(int id, int idPoly, int chance, int message)
{
_id = id;
_idPoly = idPoly;
_chance = chance;
_message = message;
}
protected int getId()
{
return _id;
}
protected int getIdPoly()
{
return _idPoly;
}
protected int getChance()
{
return _chance;
}
protected int getMessage()
{
return _message;
}
}
private static String[] Message =
{
"I cannot despise the fellow! I see his sincerity in the duel.",
"Nows we truly begin!",
"Fool! Right now is only practice!",
"Have a look at my true strength.",
"This time at the last! The end!"
};
public Transform(int questId, String name, String descr)
{
super(questId, name, descr);
_mobs.add(new Transformer(21261, 21262, 1, 5)); // 1st mutation Ol Mahum Transcender
_mobs.add(new Transformer(21262, 21263, 1, 5)); // 2st mutation Ol Mahum Transcender
_mobs.add(new Transformer(21263, 21264, 1, 5)); // 3rd mutation Ol Mahum Transcender
_mobs.add(new Transformer(21258, 21259, 100, 5)); // always mutation on atk Fallen Orc Shaman
_mobs.add(new Transformer(20835, 21608, 1, 5)); // zaken's seer to zaken's watchman
_mobs.add(new Transformer(21608, 21609, 1, 5)); // zaken's watchman
_mobs.add(new Transformer(20832, 21602, 1, 5)); // Zaken's pikeman
_mobs.add(new Transformer(21602, 21603, 1, 5)); // Zaken's pikeman
_mobs.add(new Transformer(20833, 21605, 1, 5)); // Zaken's archet
_mobs.add(new Transformer(21605, 21606, 1, 5)); // Zaken's archet
_mobs.add(new Transformer(21625, 21623, 1, 5)); // zaken's Elite Guard to zaken's Guard
_mobs.add(new Transformer(21623, 21624, 1, 5)); // zaken's Guard
_mobs.add(new Transformer(20842, 21620, 1, 5)); // Musveren
_mobs.add(new Transformer(21620, 21621, 1, 5)); // Musveren
_mobs.add(new Transformer(20830, 20859, 100, 0)); //
_mobs.add(new Transformer(21067, 21068, 100, 0)); //
_mobs.add(new Transformer(21062, 21063, 100, 0)); // Angels
_mobs.add(new Transformer(20831, 20860, 100, 0)); //
_mobs.add(new Transformer(21070, 21071, 100, 0)); //
final int[] mobsKill =
{
20830,
21067,
21062,
20831,
21070
};
for (int mob : mobsKill)
{
addEventId(mob, Quest.QuestEventType.ON_KILL);
}
final int[] mobsAttack =
{
21620,
20842,
21623,
21625,
21605,
20833,
21602,
20832,
21608,
20835,
21258
};
for (int mob : mobsAttack)
{
addEventId(mob, Quest.QuestEventType.ON_ATTACK);
}
}
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
for (Transformer monster : _mobs)
{
if (npc.getNpcId() == monster.getId())
{
if (Rnd.get(100) <= (monster.getChance() * Config.RATE_DROP_QUEST))
{
if (monster.getMessage() != 0)
{
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), Message[Rnd.get(monster.getMessage())]));
}
npc.onDecay();
final L2Attackable newNpc = (L2Attackable) addSpawn(monster.getIdPoly(), npc);
final L2Character originalAttacker = isPet ? attacker.getPet() : attacker;
newNpc.setRunning();
newNpc.addDamageHate(originalAttacker, 0, 999);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
// NPC Spawn Effect L2OFF
final NPCSpawnTask spawnEffectTask = new NPCSpawnTask(newNpc, 4000, 800000);
final Thread effectThread = new Thread(spawnEffectTask);
effectThread.start();
// Like L2OFF auto target new mob (like an aggression)
originalAttacker.setTargetTrasformedNpc(newNpc);
}
}
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
for (Transformer monster : _mobs)
{
if (npc.getNpcId() == monster.getId())
{
if (monster.getMessage() != 0)
{
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), Message[Rnd.get(monster.getMessage())]));
}
final L2Attackable newNpc = (L2Attackable) addSpawn(monster.getIdPoly(), npc);
final L2Character originalAttacker = isPet ? killer.getPet() : killer;
newNpc.setRunning();
newNpc.addDamageHate(originalAttacker, 0, 999);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
}
}
return super.onKill(npc, killer, isPet);
}
private class NPCSpawnTask implements Runnable
{
private final L2NpcInstance spawn;
private final long spawnEffectTime;
private final int spawnAbnormalEffect;
/**
* @param spawn
* @param spawnEffectTime
* @param spawnAbnormalEffect
*/
public NPCSpawnTask(L2NpcInstance spawn, long spawnEffectTime, int spawnAbnormalEffect)
{
super();
this.spawn = spawn;
this.spawnEffectTime = spawnEffectTime;
this.spawnAbnormalEffect = Integer.decode("0x" + spawnAbnormalEffect);
}
@Override
public void run()
{
spawn.startAbnormalEffect(spawnAbnormalEffect);
try
{
Thread.sleep(spawnEffectTime);
}
catch (InterruptedException e)
{
}
spawn.stopAbnormalEffect(spawnAbnormalEffect);
}
}
public static void main(String[] args)
{
new Transform(-1, "transform", "ai");
}
}

View File

@@ -0,0 +1,113 @@
/*
* 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.others;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
public class ZombieGatekeepers extends Quest
{
public ZombieGatekeepers(int questId, String name, String descr)
{
super(questId, name, descr);
addAttackId(22136);
addAggroRangeEnterId(22136);
}
private final Map<Integer, List<L2Character>> _attackersList = new ConcurrentHashMap<>();
@Override
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
final int npcObjId = npc.getObjectId();
final L2Character target = isPet ? attacker.getPet() : attacker;
if (_attackersList.get(npcObjId) == null)
{
final List<L2Character> player = new ArrayList<>();
player.add(target);
_attackersList.put(npcObjId, player);
}
else if (!_attackersList.get(npcObjId).contains(target))
{
_attackersList.get(npcObjId).add(target);
}
return super.onAttack(npc, attacker, damage, isPet);
}
@Override
public String onAggroRangeEnter(L2NpcInstance npc, L2PcInstance player, boolean isPet)
{
final int npcObjId = npc.getObjectId();
final L2Character target = isPet ? player.getPet() : player;
final L2ItemInstance VisitorsMark = player.getInventory().getItemByItemId(8064);
final L2ItemInstance FadedVisitorsMark = player.getInventory().getItemByItemId(8065);
final L2ItemInstance PagansMark = player.getInventory().getItemByItemId(8067);
final long mark1 = VisitorsMark == null ? 0 : VisitorsMark.getCount();
final long mark2 = FadedVisitorsMark == null ? 0 : FadedVisitorsMark.getCount();
final long mark3 = PagansMark == null ? 0 : PagansMark.getCount();
if ((mark1 == 0) && (mark2 == 0) && (mark3 == 0))
{
((L2Attackable) npc).addDamageHate(target, 0, 999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
else if ((_attackersList.get(npcObjId) == null) || !_attackersList.get(npcObjId).contains(target))
{
((L2Attackable) npc).getAggroList().remove(target);
}
else
{
((L2Attackable) npc).addDamageHate(target, 0, 999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
return super.onAggroRangeEnter(npc, player, isPet);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
final int npcObjId = npc.getObjectId();
if (_attackersList.get(npcObjId) != null)
{
_attackersList.get(npcObjId).clear();
}
return super.onKill(npc, killer, isPet);
}
public static void main(String[] args)
{
new ZombieGatekeepers(-1, "ZombieGatekeepers", "ai");
}
}

View File

@@ -0,0 +1,42 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# Cats_Eye_Bandit
class cats_eye_bandit(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.cats_eye_bandit = 27038
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You childish fool, do you think you can catch me?"))
else :
self.FirstAttacked = True
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.cats_eye_bandit:
objId=npc.getObjectId()
if Rnd.get(80) : npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I must do something about this shameful incident..."))
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ())
return
QUEST = cats_eye_bandit(-1,"cats_eye_bandit","ai")
QUEST.addKillId(QUEST.cats_eye_bandit)
QUEST.addAttackId(QUEST.cats_eye_bandit)

View File

@@ -0,0 +1,103 @@
# # # # # # # # # # #
# Chest AI implementation.
# Written by Fulminus
# # # # # # # # # # #
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.commons.util import Rnd
SKILL_DELUXE_KEY = 2229
#Base chance for BOX to be opened
BASE_CHANCE = 100
# Percent to decrease base chance when grade of DELUXE key not match
LEVEL_DECREASE = 40
# Chance for a chest to actually be a BOX (as opposed to being a mimic).
IS_BOX = 40
#print "Chests"
class chests(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
# firstly, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
self.chests = [18265,18266,18267,18268,18269,18270,18271,18272,18273,18274, \
18275,18276,18277,18278,18279,18280,18281,18282,18283,18284, \
18285,18286,18287,18288,18289,18290,18291,18292,18293,18294, \
18295,18296,18297,18298,21671,21694,21717,21740,21763,21786, \
21801,21802,21803,21804,21805,21806,21807,21808,21809,21810, \
21811,21812,21813,21814,21815,21816,21817,21818,21819,21820, \
21821,21822]
for i in self.chests :
self.addSkillUseId(i)
self.addAttackId(i)
def onSkillUse (self,npc,player,skill):
npcId = npc.getNpcId()
skillId = skill.getId()
skillLevel= skill.getLevel()
# check if the npc and skills used are valid for this script. Exit if invalid.
if npcId not in self.chests : return
# if this has already been interacted, no further ai decisions are needed
# if it's the first interaction, check if this is a box or mimic
if not npc.isInteracted() :
npc.setInteracted()
if Rnd.get(100) < IS_BOX :
# if it's a box, either it will be successfully openned by a proper key, or instantly disappear
if skillId == SKILL_DELUXE_KEY :
# check the chance to open the box
keyLevelNeeded = int(npc.getLevel()/10)
levelDiff = keyLevelNeeded - skillLevel
if levelDiff < 0 :
levelDiff = levelDiff * (-1)
chance = BASE_CHANCE - levelDiff * LEVEL_DECREASE
# success, pretend-death with rewards: npc.reduceCurrentHp(99999999, player)
if Rnd.get(100) < chance :
npc.setMustRewardExpSp(False)
npc.setSpecialDrop();
npc.reduceCurrentHp(99999999, player)
return
# used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards
npc.onDecay()
else :
attacker = player
if npc.getAttackByList().contains(player.getPet()):
attacker = player.getPet()
npc.setRunning()
npc.addDamageHate(attacker,0,999)
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker)
return
def onAttack(self,npc,player,damage,isPet) :
npcId = npc.getNpcId()
# check if the npc and skills used are valid for this script. Exit if invalid.
if npcId not in self.chests : return
# if this was a mimic, set the target, start the skills and become agro
if not npc.isInteracted() :
npc.setInteracted()
if Rnd.get(100) < IS_BOX :
npc.onDecay()
else : # if this weren't a box, upon interaction start the mimic behaviors...
# todo: perhaps a self-buff (skill id 4245) with random chance goes here?
attacker = player
if isPet:
attacker = player.getPet()
npc.setRunning()
npc.addDamageHate(attacker,0,(damage*100)/(npc.getLevel()+7))
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker)
return
# now call the constructor (starts up the ai)
QUEST = chests(-1,"chests","ai")

View File

@@ -0,0 +1,41 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# delu_lizardman_special_agent
class delu_lizardman_special_agent(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.delu_lizardman_special_agent = 21105
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Hey! Were having a duel here!"))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"How dare you interrupt our fight! Hey guys, help!"))
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.delu_lizardman_special_agent:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = delu_lizardman_special_agent(-1,"delu_lizardman_special_agent","ai")
QUEST.addKillId(QUEST.delu_lizardman_special_agent)
QUEST.addAttackId(QUEST.delu_lizardman_special_agent)

View File

@@ -0,0 +1,41 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# delu_lizardman_special_commander
class delu_lizardman_special_commander(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.delu_lizardman_special_commander = 21107
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Come on, Ill take you on!"))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"How dare you interrupt a sacred duel! You must be taught a lesson!"))
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.delu_lizardman_special_commander:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = delu_lizardman_special_commander(-1,"delu_lizardman_special_commander","ai")
QUEST.addKillId(QUEST.delu_lizardman_special_commander)
QUEST.addAttackId(QUEST.delu_lizardman_special_commander)

View File

@@ -0,0 +1,34 @@
# By Evil33t
import sys
from com.l2jmobius.gameserver.datatables.xml import ItemTable
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.commons.util import Rnd
KISS_OF_EVA = [1073,3141,3252]
BOX = 32342
REWARDS = [9692,9693]
def dropItem(npc,itemId,count,player):
ditem = ItemTable.getInstance().createItem("Loot", itemId, count, player)
ditem.dropMe(npc, npc.getX(),npc.getY(),npc.getZ());
class evabox(JQuest):
def __init__(self,id,name,descr):
self.isSpawned = False
JQuest.__init__(self,id,name,descr)
def onKill (self,npc,player,isPet):
found = False
for effect in player.getAllEffects():
if effect.getSkill().getId() in KISS_OF_EVA:
found = True
if found:
dropid = Rnd.get(len(REWARDS))
dropItem(npc,REWARDS[dropid],1,player)
return
QUEST = evabox(-1, "evabox", "ai")
QUEST.addKillId(BOX)

View File

@@ -0,0 +1,273 @@
# Growth-capable mobs: Polymorphing upon successful feeding.
# Written by Fulminus
# # # # # # # # # # #
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.datatables.sql import NpcTable
from com.l2jmobius.gameserver.idfactory import IdFactory
from com.l2jmobius.gameserver.model.actor.instance import L2TamedBeastInstance
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.gameserver.network.serverpackets import SocialAction
from com.l2jmobius.commons.util import Rnd
GOLDEN_SPICE = 6643
CRYSTAL_SPICE = 6644
SKILL_GOLDEN_SPICE = 2188
SKILL_CRYSTAL_SPICE = 2189
foodSkill = {GOLDEN_SPICE:SKILL_GOLDEN_SPICE, CRYSTAL_SPICE:SKILL_CRYSTAL_SPICE}
#print "Feedable beasts"
class feedable_beasts(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
# firstly, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
# DEFINE MEMBER VARIABLES FOR THIS AI
# all mobs that can eat...
self.tamedBeasts = range(16013,16019)
self.feedableBeasts = range(21451,21508)+range(21824,21830)+ self.tamedBeasts
# all mobs that grow by eating
# mobId: current_growth_level, {food: [list of possible mobs[possible sublist of tamed pets]]}, chance of growth
self.growthCapableMobs = {
# Alpen Kookabura
21451: [0,{GOLDEN_SPICE:[21452,21453, 21454, 21455],CRYSTAL_SPICE:[21456,21457, 21458, 21459]},100],
21452: [1,{GOLDEN_SPICE:[21460,21462],CRYSTAL_SPICE:[]},40],
21453: [1,{GOLDEN_SPICE:[21461,21463],CRYSTAL_SPICE:[]},40],
21454: [1,{GOLDEN_SPICE:[21460,21462],CRYSTAL_SPICE:[]},40],
21455: [1,{GOLDEN_SPICE:[21461,21463],CRYSTAL_SPICE:[]},40],
21456: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21464,21466]},40],
21457: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21465,21467]},40],
21458: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21464,21466]},40],
21459: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21465,21467]},40],
21460: [2,{GOLDEN_SPICE:[[21468,21824],[16017,16018]],CRYSTAL_SPICE:[]},25],
21461: [2,{GOLDEN_SPICE:[[21469,21825],[16017,16018]],CRYSTAL_SPICE:[]},25],
21462: [2,{GOLDEN_SPICE:[[21468,21824],[16017,16018]],CRYSTAL_SPICE:[]},25],
21463: [2,{GOLDEN_SPICE:[[21469,21825],[16017,16018]],CRYSTAL_SPICE:[]},25],
21464: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21468,21824],[16017,16018]]},25],
21465: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21469,21825],[16017,16018]]},25],
21466: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21468,21824],[16017,16018]]},25],
21467: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21469,21825],[16017,16018]]},25],
# Alpen Buffalo
21470: [0,{GOLDEN_SPICE:[21471,21472, 21473, 21474],CRYSTAL_SPICE:[21475,21476, 21477, 21478]},100],
21471: [1,{GOLDEN_SPICE:[21479,21481],CRYSTAL_SPICE:[]},40],
21472: [1,{GOLDEN_SPICE:[21481,21482],CRYSTAL_SPICE:[]},40],
21473: [1,{GOLDEN_SPICE:[21479,21481],CRYSTAL_SPICE:[]},40],
21474: [1,{GOLDEN_SPICE:[21480,21482],CRYSTAL_SPICE:[]},40],
21475: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21483,21485]},40],
21476: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21484,21486]},40],
21477: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21483,21485]},40],
21478: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21484,21486]},40],
21479: [2,{GOLDEN_SPICE:[[21487,21826],[16013,16014]],CRYSTAL_SPICE:[]},25],
21480: [2,{GOLDEN_SPICE:[[21488,21827],[16013,16014]],CRYSTAL_SPICE:[]},25],
21481: [2,{GOLDEN_SPICE:[[21487,21826],[16013,16014]],CRYSTAL_SPICE:[]},25],
21482: [2,{GOLDEN_SPICE:[[21488,21827],[16013,16014]],CRYSTAL_SPICE:[]},25],
21483: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21487,21826],[16013,16014]]},25],
21484: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21488,21827],[16013,16014]]},25],
21485: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21487,21826],[16013,16014]]},25],
21486: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21488,21827],[16013,16014]]},25],
# Alpen Cougar
21489: [0,{GOLDEN_SPICE:[21490,21491, 21492, 21493],CRYSTAL_SPICE:[21494,21495, 21496, 21497]},100],
21490: [1,{GOLDEN_SPICE:[21498,21500],CRYSTAL_SPICE:[]},40],
21491: [1,{GOLDEN_SPICE:[21499,21501],CRYSTAL_SPICE:[]},40],
21492: [1,{GOLDEN_SPICE:[21498,21500],CRYSTAL_SPICE:[]},40],
21493: [1,{GOLDEN_SPICE:[21499,21501],CRYSTAL_SPICE:[]},40],
21494: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21502,21504]},40],
21495: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21503,21505]},40],
21496: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21502,21504]},40],
21497: [1,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[21503,21505]},40],
21498: [2,{GOLDEN_SPICE:[[21506,21828],[16015,16016]],CRYSTAL_SPICE:[]},25],
21499: [2,{GOLDEN_SPICE:[[21507,21829],[16015,16016]],CRYSTAL_SPICE:[]},25],
21500: [2,{GOLDEN_SPICE:[[21506,21828],[16015,16016]],CRYSTAL_SPICE:[]},25],
21501: [2,{GOLDEN_SPICE:[[21507,21829],[16015,16016]],CRYSTAL_SPICE:[]},25],
21502: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21506,21828],[16015,16016]]},25],
21503: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21507,21829],[16015,16016]]},25],
21504: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21506,21828],[16015,16016]]},25],
21505: [2,{GOLDEN_SPICE:[],CRYSTAL_SPICE:[[21507,21829],[16015,16016]]},25]
}
self.madCowPolymorph = {21824:21468,21825:21469,21826:21487,21827:21488,21828:21506,21829:21507}
self.Text = [["What did you just do to me?","You want to tame me, huh?","Do not give me this. Perhaps you will be in danger.","Bah bah. What is this unpalatable thing?","My belly has been complaining. This hit the spot.","What is this? Can I eat it?","You don't need to worry about me.","Delicious food, thanks.","I am starting to like you!","Gulp"],
["I do not think you have given up on the idea of taming me.","That is just food to me. Perhaps I can eat your hand too.","Will eating this make me fat? Ha ha","Why do you always feed me?","Do not trust me. I may betray you"],
["Destroy","Look what you have done!","Strange feeling...! Evil intentions grow in my heart...!","It is happenning!","This is sad...Good is sad...!"]]
self.feedInfo = {} # : feedInfo[objectId of mob] = objectId of player feeding it
for i in self.feedableBeasts :
self.addSkillUseId(i)
self.addKillId(i)
def onAdvEvent(self,event,npc,player) :
if event == "polymorph Mad Cow" and npc and player:
if npc.getNpcId() in self.madCowPolymorph.keys() :
# remove the feed info from the previous mob
if self.feedInfo[npc.getObjectId()] == player.getObjectId() :
self.feedInfo.pop(npc.getObjectId())
# despawn the mad cow
npc.deleteMe()
# spawn the new mob
nextNpc = self.addSpawn(self.madCowPolymorph[npc.getNpcId()],npc)
# register the player in the feedinfo for the mob that just spawned
self.feedInfo[nextNpc.getObjectId()] = player.getObjectId()
nextNpc.setRunning()
nextNpc.addDamageHate(player,0,99999)
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
def spawnNext(self, npc, growthLevel,player,food) :
npcId = npc.getNpcId()
nextNpcId = 0
# find the next mob to spawn, based on the current npcId, growthlevel, and food.
if growthLevel == 2:
rand = Rnd.get(2)
# if tamed, the mob that will spawn depends on the class type (fighter/mage) of the player!
if rand == 1 :
if player.getClassId().isMage() :
nextNpcId = self.growthCapableMobs[npcId][1][food][1][1]
else :
nextNpcId = self.growthCapableMobs[npcId][1][food][1][0]
# if not tamed, there is a small chance that have "mad cow" disease.
# that is a stronger-than-normal animal that attacks its feeder
else :
if Rnd.get(5) == 0 :
nextNpcId = self.growthCapableMobs[npcId][1][food][0][1]
else :
nextNpcId = self.growthCapableMobs[npcId][1][food][0][0]
# all other levels of growth are straight-forward
else :
nextNpcId = self.growthCapableMobs[npcId][1][food][Rnd.get(len(self.growthCapableMobs[npcId][1][food]))]
# remove the feedinfo of the mob that got despawned, if any
if self.feedInfo.has_key(npc.getObjectId()) :
if self.feedInfo[npc.getObjectId()] == player.getObjectId() :
self.feedInfo.pop(npc.getObjectId())
# despawn the old mob
if self.growthCapableMobs[npcId][0] == 0 :
npc.onDecay()
else :
npc.deleteMe()
# if this is finally a trained mob, then despawn any other trained mobs that the
# player might have and initialize the Tamed Beast.
if nextNpcId in self.tamedBeasts :
oldTrained = player.getTrainedBeast()
if oldTrained :
oldTrained.doDespawn()
#the following 5 commented lines are not needed, but they provide a plausible alternate implementation...just in case...
#nextNpc = self.addSpawn(nextNpcId,npc)
#nextNpc.setOwner(player)
#nextNpc.setFoodType(foodSkill[food])
#nextNpc.setHome(npc)
template = NpcTable.getInstance().getTemplate(nextNpcId)
nextNpc = L2TamedBeastInstance(IdFactory.getInstance().getNextId(), template, player, foodSkill[food], npc.getX(), npc.getY(), npc.getZ())
nextNpc.setRunning()
objectId = nextNpc.getObjectId()
st = player.getQuestState("20_BringUpWithLove")
if st :
if Rnd.get(100) <= 5 and st.getQuestItemsCount(7185) == 0 :
st.giveItems(7185,1) #if player has quest 20 going, give quest item
st.set("cond","2") #it's easier to hardcode it in here than to try and repeat this stuff in the quest
# also, perform a rare random chat
rand = Rnd.get(20)
if rand > 4 : pass
elif rand == 0 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", will you show me your hideaway?"))
elif rand == 1 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", whenever I look at spice, I think about you."))
elif rand == 2 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", you do not need to return to the village. I will give you strength"))
elif rand == 3 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), "Thanks, "+player.getName()+". I hope I can help you"))
elif rand == 4 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", what can I do to help you?"))
# if not trained, the newly spawned mob will automatically be agro against its feeder
# (what happened to "never bite the hand that feeds you" anyway?!)
else :
# spawn the new mob
nextNpc = self.addSpawn(nextNpcId,npc)
if nextNpcId in self.madCowPolymorph :
self.startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player)
# register the player in the feedinfo for the mob that just spawned
self.feedInfo[nextNpc.getObjectId()] = player.getObjectId()
nextNpc.setRunning()
nextNpc.addDamageHate(player,0,99999)
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
def onSkillUse (self,npc,player,skill):
# gather some values on local variables
npcId = npc.getNpcId()
skillId = skill.getId()
# check if the npc and skills used are valid for this script. Exit if invalid.
if npcId not in self.feedableBeasts : return
if skillId not in [SKILL_GOLDEN_SPICE,SKILL_CRYSTAL_SPICE] : return
# first gather some values on local variables
objectId = npc.getObjectId()
growthLevel = 3 # if a mob is in feedableBeasts but not in growthCapableMobs, then it's at max growth (3)
if self.growthCapableMobs.has_key(npcId) :
growthLevel = self.growthCapableMobs[npcId][0]
# prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast
# If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder!
if (growthLevel==0) and self.feedInfo.has_key(objectId):
return
else :
self.feedInfo[objectId] = player.getObjectId()
food = 0
if skillId == SKILL_GOLDEN_SPICE :
food = GOLDEN_SPICE
elif skillId == SKILL_CRYSTAL_SPICE :
food = CRYSTAL_SPICE
# display the social action of the beast eating the food.
npc.broadcastPacket(SocialAction(objectId,2))
# if this pet can't grow, it's all done.
if npcId in self.growthCapableMobs.keys() :
# do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect).
if len(self.growthCapableMobs[npcId][1][food]) == 0 : return
# rare random talk...
if Rnd.get(20) == 0 :
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),self.Text[growthLevel][Rnd.get(len(self.Text[growthLevel]))]))
if growthLevel > 0 :
# check if this is the same player as the one who raised it from growth 0.
# if no, then do not allow a chance to raise the pet (food gets consumed but has no effect).
if self.feedInfo[objectId] != player.getObjectId() : return
# Polymorph the mob, with a certain chance, given its current growth level
if Rnd.get(100) < self.growthCapableMobs[npcId][2] :
self.spawnNext(npc, growthLevel,player,food)
elif npcId in self.tamedBeasts :
if skillId == npc.getFoodType() :
npc.onReceiveFood()
mytext = ["Refills! Yeah!","I am such a gluttonous beast, it is embarrassing! Ha ha",
"Your cooperative feeling has been getting better and better.",
"I will help you!",
"The weather is really good. Wanna go for a picnic?",
"I really like you! This is tasty...",
"If you do not have to leave this place, then I can help you.",
"What can I help you with?",
"I am not here only for food!",
"Yam, yam, yam, yam, yam!"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
return
def onKill (self,npc,player,isPet):
# remove the feedinfo of the mob that got killed, if any
if self.feedInfo.has_key(npc.getObjectId()) :
self.feedInfo.pop(npc.getObjectId())
# now call the constructor (starts up the ai)
QUEST = feedable_beasts(-1,"feedable_beasts","ai")

View File

@@ -0,0 +1,42 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# karul_bugbear
class karul_bugbear(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.karul_bugbear = 20600
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(4) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Your rear is practically unguarded!"))
else :
self.FirstAttacked = True
if Rnd.get(4) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Watch your back!"))
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.karul_bugbear:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = karul_bugbear(-1,"karul_bugbear","ai")
QUEST.addKillId(QUEST.karul_bugbear)
QUEST.addAttackId(QUEST.karul_bugbear)

View File

@@ -0,0 +1,41 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# ol_mahum_general
class ol_mahum_general(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.ol_mahum_general = 20438
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(100) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I will definitely repay this humiliation!"))
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.ol_mahum_general:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = ol_mahum_general(-1,"ol_mahum_general","ai")
QUEST.addKillId(QUEST.ol_mahum_general)
QUEST.addAttackId(QUEST.ol_mahum_general)

View File

@@ -0,0 +1,62 @@
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.model.actor.position import Location
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# flee onAttack (current version is rather fear than retreat)
# ToDo: find a way to check position instead of using a timer to stop fleeing
# make zones or a list of "basements" for mobs to retreat to
class retreat_onattack(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.MobSpawns ={
20432: {'HP': 100, 'chance': 100}, # Elpy
20058: {'HP': 50, 'chance': 10} # Ol Mahum Guard
}
# made a second dictionary for the texts
self.MobTexts ={
20058: ["I'll be back", "You are stronger than expected"] # I don't recall the retail text they say, so I made custom ones to test it
}
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAdvEvent(self,event,npc,player) :
if event == "Retreat" and npc and player:
npc.setIsAfraid(0)
npc.addDamageHate(player,0,100)
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
def onAttack(self,npc,player,damage,isPet) :
npcId = npc.getNpcId()
objId = npc.getObjectId()
if self.MobSpawns.has_key(npcId) :
if npc.getStatus().getCurrentHp() <= npc.getMaxHp() * self.MobSpawns[npcId]['HP'] / 100 and Rnd.get(100) < self.MobSpawns[npcId]['chance'] :
if self.MobTexts.has_key(npcId) :
text = self.MobTexts[npcId][Rnd.get(len(self.MobTexts[npcId]))]
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),text))
posX = npc.getX()
posY = npc.getY()
posZ = npc.getZ()
signX = -500
signY = -500
if npc.getX() > player.getX() :
signX = 500
if npc.getY() > player.getY() :
signY = 500
posX = posX + signX
posY = posY + signY
npc.setIsAfraid(1)
npc.setRunning()
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,Location(posX,posY,posZ,0))
self.startQuestTimer("Retreat", 10000, npc, player)
return
QUEST = retreat_onattack(-1,"retreat_onattack","ai")
for i in QUEST.MobSpawns.keys() :
QUEST.addAttackId(i)

View File

@@ -0,0 +1,28 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.commons.util import Rnd
class scarlet_stokate_noble(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.scarlet_stokate_noble = 21378
self.scarlet_stokate_noble_b = 21652
JQuest.__init__(self,id,name,descr)
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.scarlet_stokate_noble:
if Rnd.get(100) <= 20:
self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = scarlet_stokate_noble(-1,"scarlet_stokate_noble","ai")
QUEST.addKillId(QUEST.scarlet_stokate_noble)

View File

@@ -0,0 +1,63 @@
import sys
from com.l2jmobius import Config
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.commons.util import Rnd
SplendorId ={ # Npc:[NewNpc,% for chance by shot,ModeSpawn]
# Modespawn 1=> delete and spawn the news npc
# Modespawn 2=> just add 1 spawn the news npc
# if Quest_Drop = 5 => 25% by shot to change mob
21521:[21522,5,1], # Claw of Splendor
21524:[21525,5,1], # Blade of Splendor
21527:[21528,5,1], # Anger of Splendor
21537:[21538,5,1], # Fang of Splendor
21539:[21540,100,2] # Wailing of Splendor
}
# Main Quest Code
class splendor(JQuest):
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.AlwaysSpawn = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack(self,npc,player,isPet,damage):
npcId = npc.getNpcId()
NewMob,chance,ModeSpawn = SplendorId[npcId]
if Rnd.get(100) <= chance*Config.RATE_DROP_QUEST :
if SplendorId.has_key(npcId) :
if ModeSpawn == 1 :
npc.deleteMe()
newNpc = self.addSpawn(NewMob,npc)
newNpc.addDamageHate(player,0,999)
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
elif self.AlwaysSpawn :
return
elif ModeSpawn == 2 :
self.AlwaysSpawn = True
newNpc1 = self.addSpawn(NewMob,npc)
newNpc1.addDamageHate(player,0,999)
newNpc1.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
NewMob,chance,ModeSpawn = SplendorId[npcId]
if SplendorId.has_key(npcId) :
if ModeSpawn == 2 :
self.AlwaysSpawn = False
return
QUEST = splendor(-1,"splendor","ai")
for i in SplendorId.keys() :
QUEST.addAttackId(i)
for j in SplendorId.keys() :
QUEST.addKillId(j)

View File

@@ -0,0 +1,202 @@
import sys
from com.l2jmobius.gameserver.ai import CtrlIntention
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
POLLEN = 6391
SKILL_NECTAR = 9998
# Поливаемые
WATERED_SQUASH = [12774,12775,12776,12777,12778,12779]
class squash(JQuest) :
def __init__(self,id,name,descr):
JQuest.__init__(self,id,name,descr)
# Выросшие
self.adultSmallSquash = [12775,12776]
self.adultLargeSquash = [12778,12779]
def onAdvEvent(self,event,npc,player) :
objId = npc.getObjectId()
if event == "Good By" and npc and player :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Good By!! LOL."))
npc.onDecay()
elif event == "Good By1" and npc and player :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Всем, до свидания... Большая тыква сказала до свидания ..."))
npc.onDecay()
elif event == "Good By2" and npc and player :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Вы можете быстрее? Через 30 секунд я сбегу ..."))
elif event == "Good By3" and npc and player :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Я прерву отношения с Вами через 20 секунд!"))
elif event == "Good By4" and npc and player :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"У меня осталось всего 10 секунд! 9. 8. 7 ..!"))
elif event == "Good By5" and npc and player :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Эй! Счастливо оставаться! Идиот, забудь обо мне!"))
return
def onSkillUse(self,npc,player,skill):
npcId = npc.getNpcId()
skillId = skill.getId()
if skillId != SKILL_NECTAR : return
if npcId not in WATERED_SQUASH : return
objectId = npc.getObjectId()
if skillId == SKILL_NECTAR :
# Первый полив
if npc.getNectar() == 0 :
if Rnd.get(2) == 1 :
mytext = ["Чтобы быть способной расти, я должна пить только нектар ... причем чаще",
"Если ты будеш быстрее выливать мне нектар - я быстрее выросту!",
"Ну, верьте мне, прыскайте нектар! Я могу конечно превратиться в большую тыкву!!!",
"Принеси нектар, чтобы вырастить тыкву!",
"Плод прекрасной молодой тыквы начинает блестеть, когда семя предано земле! С этого времени будет способен стать здоровым и сильным!",
"О, давно не виделись?",
"Неожидал увидеть мое красивое появление?",
"Отлично! Это - нечто! Нектар?",
"Дозаправка! Заправь 5 бутылок, чтобы я смогла превратиться в большую тыкву! О!"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
npc.addGood()
else :
mytext = ["Не спеши! Слишком часто, я не успеваю!",
"Я же не автомат, меня скорострельностью не напоиш",
"Да куда же ты торопишься! Слишком часто, я не успеваю!",
"Упс, опять слишком быстро",
"Давай чуток помедленней, не спеши, медленно достань бутылку и медленно ее вылей!",
"У тебя нет чувства скорости? Медленнее давай"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
# Второй полив
elif npc.getNectar() == 1 :
if Rnd.get(2) == 1 :
mytext = ["Желаю стать большой тыквой!",
"Ням, ням, ням! Вышло! Заботится - хорошо!",
"Как думаеш, я зрелая или гнилая?",
"Нектар - только лучшее! Ха! Ха! Ха!"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
npc.addGood()
else :
mytext = ["О! Опять мимо! Может слишком быстро расходуеш нектар?",
"Если я умру такой как сейчас, Вы получите только молодую тыкву ...",
"Выращивают немного быстрее! Неплохо было бы стать большой тыквой, молодая тыква не хороша!",
"Tакую маленькую тыкву вы все должны есть? Принесите нектар, я могу быть больше!"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
# Третий полив
elif npc.getNectar() == 2 :
if Rnd.get(2) == 1 :
mytext = ["Tыква, изголодалась! Просит утолить жажду!",
"Ну наконец-то ..., это действительно вкусно! Есть еще?",
"Ухаживаешь за мной только для того, чтобы есть? Отлично, является случайным ваш ..., чтобы не дать манну на самоубийство"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
npc.addGood()
else :
mytext = ["Не воду ли Вы добавляете? Какой вкус?",
"Хозяин, спасите меня... Я не имею аромата нектара, я должна умереть ..."]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
# Четвертый полив
elif npc.getNectar() == 3 :
if Rnd.get(2) == 1 :
mytext = ["Очень хорошо, делаешь чрезвычайно хорошо! Знаешь что следующим шагом должен делать?",
"Если Вы поймаете меня, я даю Вам 10 миллионов adena!!! Согласны?"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
npc.addGood()
else :
mytext = ["Я голодна, Tы хочеш чтоб я засохла?",
"Tребую нектар, чтобы расти немного быстрее."]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.addNectar()
# Пятый полив
elif npc.getNectar() == 4 :
if Rnd.get(2) == 1 :
npc.addGood()
if npc.getGood() >= 3 :
if npcId == 12774 :
newGourd = self.addSpawn(12775,npc)
newGourd.setOwner(player.getName())
self.startQuestTimer("Good By", 120000, newGourd, player) # Через 2 минуты исчезновение
self.startQuestTimer("Good By2", 90000, newGourd, player) # 30 секунд до исчезновения
self.startQuestTimer("Good By3", 100000, newGourd, player) # 20 секунд до исчезновения
self.startQuestTimer("Good By4", 110000, newGourd, player) # 10 секунд до исчезновения
mytext = ["Молодая тыква, жаждящая! Как, уже выросла?",
"Я убегу через 2 минуты"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.onDecay()
else :
newGourd = self.addSpawn(12778,npc)
newGourd.setOwner(player.getName())
self.startQuestTimer("Good By1", 120000, newGourd, player) # Через 2 минуты исчезновение
self.startQuestTimer("Good By2", 90000, newGourd, player) # 30 секунд до исчезновения
self.startQuestTimer("Good By3", 100000, newGourd, player) # 20 секунд до исчезновения
self.startQuestTimer("Good By4", 110000, newGourd, player) # 10 секунд до исчезновения
mytext = ["Милосердность является очень хорошей чертой. Tеперь посмотрите, я чувствую себя все более хорошо",
"Я убегу через 2 минуты"]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.onDecay()
else :
if npcId == 12774 :
newGourd = self.addSpawn(12776,npc)
newGourd.setOwner(player.getName())
mytext = ["Эй! Была - не была! Есть! Сейчас же! Tы не можешь должным образом заботиться? Я же так сгнию!",
"Ничего себе, остановки? За что тебя благодарить",
"Жажду нектара о ...",
"Вы хотите большую тыкву? Но я хочу остаться маленькой тыковкой ..."]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.onDecay()
if npcId == 12777 :
newGourd = self.addSpawn(12779,npc)
newGourd.setOwner(player.getName())
mytext = ["Эй! Была - не была! Есть! Сейчас же! Tы не можешь должным образом заботиться? Я так сгнию!",
"Ничего себе, остановки? За что тебя благодарить",
"Жажду нектара о ...",
"Вы хотите большую тыкву? Но я хочу остаться маленькой тыковкой ..."]
npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
npc.onDecay()
return
def onAttack(self,npc,player,damage,isPet) :
npcId = npc.getNpcId()
objId = npc.getObjectId()
if npcId not in WATERED_SQUASH : return
if npcId in self.adultLargeSquash :
if Rnd.get(30) < 2 :
mytext = ["Укусы плетут кружево крысой ..., чтобы заменить ... тело ...!",
"Ха ха, росла! Полностью на всех!",
"Не можете чтоли все прицелиться? Смотрите все, чтобы не сбежала ...",
"Я считаю ваши удары! О, напоминает удар снова!",
"Не тратьте впустую ваше время!",
"Ха, этот звук действительно приятно слышать?",
"Я потребляю ваши атаки, чтобы расти!",
"Время, чтобы ударить снова! Ударь еще разок!",
"Tолько полезная музыка может открыть большую тыкву... Меня нельзя открыть с оружием!"]
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
return
def onKill(self,npc,player,isPet) :
npcId = npc.getNpcId()
objId = npc.getObjectId()
if npcId not in WATERED_SQUASH : return
if npcId in self.adultSmallSquash :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Tыква открывается!!"))
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Ееее! Открывается! Много хороших вещей ..."))
elif npcId in self.adultLargeSquash :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Tыква открывается!!"))
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Ееее! Открывается! Много хороших вещей ..."))
else :
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"За что, хозяин?!"))
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Ой, кишки вывалились!!"))
return
QUEST = squash(-1,"group_template","ai")
for i in WATERED_SQUASH:
QUEST.addSkillUseId(i)
QUEST.addAttackId(i)
QUEST.addKillId(i)

View File

@@ -0,0 +1,40 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# timak_orc_overlord
class timak_orc_overlord(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.timak_orc_overlord = 20588
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(50) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Dear ultimate power!!!"))
else :
self.FirstAttacked = True
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.timak_orc_overlord:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = timak_orc_overlord(-1,"timak_orc_overlord","ai")
QUEST.addKillId(QUEST.timak_orc_overlord)
QUEST.addAttackId(QUEST.timak_orc_overlord)

View File

@@ -0,0 +1,40 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# timak_orc_troop_leader
class timak_orc_troop_leader(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.timak_orc_troop_leader = 20767
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(50) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Destroy the enemy, my brothers!"))
else :
self.FirstAttacked = True
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.timak_orc_troop_leader:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = timak_orc_troop_leader(-1,"timak_orc_troop_leader","ai")
QUEST.addKillId(QUEST.timak_orc_troop_leader)
QUEST.addAttackId(QUEST.timak_orc_troop_leader)

View File

@@ -0,0 +1,41 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# turek_orc_footman
class turek_orc_footman(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.turek_orc_footman = 20499
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"There is no reason for you to kill me! I have nothing you need!"))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.turek_orc_footman:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = turek_orc_footman(-1,"turek_orc_footman","ai")
QUEST.addKillId(QUEST.turek_orc_footman)
QUEST.addAttackId(QUEST.turek_orc_footman)

View File

@@ -0,0 +1,41 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# turek_orc_supplier
class turek_orc_supplier(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.turek_orc_supplier = 20498
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You wont take me down easily."))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.turek_orc_supplier:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = turek_orc_supplier(-1,"turek_orc_supplier","ai")
QUEST.addKillId(QUEST.turek_orc_supplier)
QUEST.addAttackId(QUEST.turek_orc_supplier)

View File

@@ -0,0 +1,41 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.network.serverpackets import CreatureSay
from com.l2jmobius.commons.util import Rnd
# turek_orc_warlord
class turek_orc_warlord(JQuest) :
# init function. Add in here variables that you'd like to be inherited by subclasses (if any)
def __init__(self,id,name,descr):
self.turek_orc_warlord = 20495
self.FirstAttacked = False
# finally, don't forget to call the parent constructor to prepare the event triggering
# mechanisms etc.
JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
objId=npc.getObjectId()
if self.FirstAttacked:
if Rnd.get(40) : return
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You wont take me down easily."))
else :
self.FirstAttacked = True
npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"The battle has just begun!"))
return
def onKill (self,npc,player,isPet):
npcId = npc.getNpcId()
if npcId == self.turek_orc_warlord:
objId=npc.getObjectId()
self.FirstAttacked = False
elif self.FirstAttacked :
self.addSpawn(npcId,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0)
return
QUEST = turek_orc_warlord(-1,"turek_orc_warlord","ai")
QUEST.addKillId(QUEST.turek_orc_warlord)
QUEST.addAttackId(QUEST.turek_orc_warlord)

View File

@@ -0,0 +1,8 @@
Most of the scripts found within the jscript folder are initialized on server start, but
do not run anything except when triggered by a player. For scripts that need to be ran
automatically, without any player interaction, cron can be used.
Using the format demonstrated in the example.py script, one can setup tasks that run
automatically at server boot. In addition, advanced users can include other classes from java
and setup timed tasks, such as special events that have universal drops for a certain period of time.
The server admins can feel free to add more folders like cron and include them in their servers.

View File

@@ -0,0 +1,25 @@
/*
* 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 cron;
public class example
{
public static void main(String[] args)
{
System.out.println("Hello world!");
}
}

View File

@@ -0,0 +1,5 @@
##############################################
### Author: Layane (andrashe@gmail.com)
##############################################
print "Hi world!"

View File

@@ -0,0 +1,18 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
NoblessTrader:<br>
Do you know the story of the seventeen heroes who challenged the Land
Dragon Antharas? It's fascinating! Such a heroic sacrifice! It could be
an epic poem! In fact, it's one of my all-time favorite stories! It's
what motivated me to become a bohemian poet! It's always been my dream
to write a great epic poem tying all the pieces of this story together.<br>
Well forget all that because we have made the quest simple !!<br>
I will make you Noblesse if you have a second Subclass at Level
70+ and if you have 2 gold bars in your inventory.<br>
<a action="bypass -h Quest 6666_NoblessTrader 31739-3.htm">"Make
me Noblesse."</a>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
NoblessTrader:<br>
Sorry but I will make you Noblesse only if you have a second Subclass at Level
70+ and if you have not 2 gold bars in your inventory.<br>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
Talien:<br>
Awesome! Thank you! For comming to see me, we have saved you a lot of
time you are now Noblesse.! Only at Titan energy:}
</body>
</html>

View File

@@ -0,0 +1,67 @@
import sys
from com.l2jmobius.gameserver.model.actor.instance import L2PcInstance
from com.l2jmobius.gameserver.model.actor.instance import L2NpcInstance
from java.util import Iterator
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
qn = "6666_NoblessTrader"
NPC=[66666]
NOBLESS_TIARA=7694
GOLD_BAR=3470
QuestId = 6666
QuestName = "NoblessTrade"
QuestDesc = "custom"
InitialHtml = "31739-1.htm"
print "INFO Nobless Trader (66666) Enabled..."
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = "<html><head><body>I have nothing to say you</body></html>"
cond = st.getInt("cond")
count=st.getQuestItemsCount(GOLD_BAR)
if event == "31739-3.htm" :
if cond == 0 and st.getPlayer().isSubClassActive() :
if st.getPlayer().getLevel() >= 70 and count > 1:
htmltext=event
st.set("cond","0")
st.getPlayer().setNoble(True)
st.giveItems(NOBLESS_TIARA,1)
st.playSound("ItemSound.quest_finish")
st.exitQuest(1)
st.takeItems(GOLD_BAR,2)
else :
htmltext="31739-2.htm"
st.exitQuest(1)
else :
htmltext="31739-2.htm"
st.exitQuest(1)
return htmltext
def onTalk (self,npc,player):
htmltext = "<html><head><body>I have nothing to say you</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
if id == State.CREATED :
st.set("cond","0")
htmltext="31739-1.htm"
elif id == State.COMPLETED :
htmltext = "<html><head><body>This quest have already been completed.</body></html>"
else :
st.exitQuest(1)
return htmltext
QUEST = Quest(6666,qn,"custom")
for npcId in NPC:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)

View File

@@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
Clan Manager:<br>
Do you know the story of the seventeen heroes who challenged the Land
Dragon Antharas? It's fascinating! Such a heroic sacrifice! It could be
an epic poem! In fact, it's one of my all-time favorite stories! It's
what motivated me to become a bohemian poet! It's always been my dream
to write a great epic poem tying all the pieces of this story together.<br>
Well forget all that because we have made the quest simple !!<br>
I will make your clan Level 8 if you are Noble and have 13 Gold Bar... <br>
<a action="bypass -h Quest 6667_ClanManager 66667-clanOk.htm">"Make Clan Lvl 8"</a><br>
I will give to your clan 3kk Reputation Points if you are Noble and 13 Gold Bar<br>
have ...
<a action="bypass -h Quest 6667_ClanManager 66667-repOk.htm">"Give me 3kk Rep. Points"</a><br>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
Clan Manager:<br>
Awesome! Thank you! For comming to see me, we have saved you a lot of
time! Your clan has now lvl 8!!!
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
Clan Manager:<br>
Sorry but I can't give you lvl 8 Clan: check requirements!<br>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
Clan Manager:<br>
Sorry but I can't give you 3kk Reputation Points: check requirements!<br>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
Clan Manager:<br>
Awesome! Thank you! For comming to see me, we have saved you a lot of
time! Your clan has now 3kk Reputation Points!!!
</body>
</html>

View File

@@ -0,0 +1,76 @@
import sys
from com.l2jmobius.gameserver.model.actor.instance import L2PcInstance
from com.l2jmobius.gameserver.model.actor.instance import L2NpcInstance
from java.util import Iterator
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
qn = "6667_ClanManager"
NPC=[66667]
REQUESTED_ITEM=3470
REQUESTED_AMOUNT=2
NEW_REP_SCORE=3000000
QuestId = 6667
QuestName = "ClanManager"
QuestDesc = "custom"
InitialHtml = "66667-1.htm"
print "INFO Clan Manager (66667) Enabled..."
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = "<html><head><body>I have nothing to say you</body></html>"
count=st.getQuestItemsCount(REQUESTED_ITEM)
if event == "66667-clanOk.htm" :
if st.getPlayer().isClanLeader() and st.getPlayer().getClan().getLevel()<8:
if st.getPlayer().isNoble() and count >= REQUESTED_AMOUNT:
htmltext=event
st.getPlayer().getClan().changeLevel(8)
st.playSound("ItemSound.quest_finish")
st.takeItems(REQUESTED_ITEM,REQUESTED_AMOUNT)
else :
htmltext="66667-no_clan.htm"
st.exitQuest(1)
else :
htmltext="66667-no_clan.htm"
st.exitQuest(1)
elif event == "66667-repOk.htm" :
if st.getPlayer().isClanLeader() and st.getPlayer().getClan().getLevel() >= 5 and st.getPlayer().getClan().getReputationScore() < NEW_REP_SCORE :
if st.getPlayer().isNoble() and count > REQUESTED_AMOUNT:
htmltext=event
st.getPlayer().getClan().setReputationScore(NEW_REP_SCORE, 1);
st.playSound("ItemSound.quest_finish")
st.takeItems(REQUESTED_ITEM,REQUESTED_AMOUNT)
else :
htmltext="66667-no_points.htm"
st.exitQuest(1)
else :
htmltext="66667-no_points.htm"
st.exitQuest(1)
return htmltext
def onTalk (self,npc,player):
htmltext = "<html><head><body>I have nothing to say you</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
if id == State.CREATED :
htmltext="66667-1.htm"
elif id == State.COMPLETED :
htmltext = "<html><head><body>This quest have already been completed.</body></html>"
else :
st.exitQuest(1)
return htmltext
QUEST = Quest(6667,qn,"custom")
for npcId in NPC:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)

View File

@@ -0,0 +1,4 @@
<html><body>Angelic Vortex:<br>
The Angelic Vortex emits a faint light, and in the midst of the light an image appears. In the deepest part of a specious area, a gigantic stone statue is visible. The statue has a human-like appearance and is in a seated position, as though it was being held by some invisible force against its will.<br>
<a action="bypass -h npc_%objectId%_Quest baium">Go where the Angelic Vortex leads.</a>
</body></html>

View File

@@ -0,0 +1,34 @@
# Created by L2Emu Team
import sys
from com.l2jmobius.gameserver.instancemanager import GrandBossManager
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
qn = "8003_MeetBaium"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onFirstTalk (self,npc,player):
st = player.getQuestState(qn)
if not st : st = self.newQuestState(player)
baiumStatus = GrandBossManager.getInstance().getBossStatus(29020)
if baiumStatus != 2 and st.getQuestItemsCount(4295) :
st.exitQuest(1)
return "31862.htm"
else :
npc.showChatWindow(player)
st.exitQuest(1)
return
return
QUEST = Quest(-1,qn,"custom")
QUEST.addStartNpc(31862)
QUEST.addFirstTalkId(31862)
QUEST.addTalkId(31862)

View File

@@ -0,0 +1,51 @@
import sys
from com.l2jmobius.gameserver.model.quest import State
from com.l2jmobius.gameserver.model.quest import QuestState
from com.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jmobius.gameserver.datatables import SkillTable
from com.l2jmobius.gameserver.model import L2Effect
from com.l2jmobius.commons.util import Rnd
qn = "8009_HotSpringsBuffs"
#print "HotSpringsBuffs"
HSMOBS = [21316, 21321, 21314, 21319]
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onAttack (self,npc,player,damage,isPet):
npcId = npc.getNpcId()
if npcId in HSMOBS:
if (Rnd.get(2) == 1):
if (Rnd.get(2) == 1):
if player.getFirstEffect(int(4552)):
holera = player.getFirstEffect(int(4552)).getLevel()
if (Rnd.get(100) < 30):
if holera < 10:
newholera = int(holera + 1)
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4552,newholera))
else:
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4552,1))
else:
if player.getFirstEffect(int(4554)):
malaria = player.getFirstEffect(int(4554)).getLevel()
if (Rnd.get(100) < 15):
if malaria < 10:
newmalaria = int(malaria + 1)
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4554,newmalaria))
else:
npc.setTarget(player)
npc.doCast(SkillTable.getInstance().getInfo(4554,1))
return
QUEST = Quest(8009,qn,"custom")
for i in HSMOBS:
QUEST.addAttackId(i)

View File

@@ -0,0 +1,11 @@
<html><body><table width=200>
<tr><td align="center">Echo Crystals </td></tr>
</table><br>
<a action="bypass -h Quest EchoCrystals 4410">[Create an Echo Crystal - Theme of Journey]</a><br>
<a action="bypass -h Quest EchoCrystals 4409">[Create an Echo Crystal - Theme of Battle]</a><br>
<a action="bypass -h Quest EchoCrystals 4408">[Create an Echo Crystal - Theme of Love]</a><br>
<a action="bypass -h Quest EchoCrystals 4420">[Create an Echo Crystal - Theme of Solitude]</a><br>
<a action="bypass -h Quest EchoCrystals 4421">[Create an Echo Crystal - Theme of Feast]</a><br>
<a action="bypass -h Quest EchoCrystals 4419">[Create an Echo Crystal - Theme of Comedy]</a><br>
<a action="bypass -h Quest EchoCrystals 4418">[Create an Echo Crystal - Theme of Celebration]</a>
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Kantabilon:<br>
What soothing music! Ideal for a traveler such as yourself...<br>
Here is your crystal! Enjoy!</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
Hi there! If you want an Echo Crystal, it'll cost you 200 adena.</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
How do you expect me to make a crystal if you don't bring me a score?</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Kantabilon:<br>
Oh, how noble! It brings to mind thousands of orcs marching bravely off to war...<br>
Your crystal is complete! Enjoy it!</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
If you want me to create an Echo Crystal, it'll cost you 200 adena.</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Kantabilon:<br>
As you are well aware, I cannot make an Echo Crystal for you if you don't bring me a score!<br>
A fellow once told me that he was able to obtain an old score by talking to a fake alchemist in Oren...</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Kantabilon:<br>
Oh, how romantic! And melancholy at the same time... Like love, wouldn't you agree? Yes, this definitely has an Elven quality to it... Perhaps I should add a female Elven voice to the crystal?~<br>
It is complete. Enjoy!</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
Well, if you want an Echo Crystal it will cost you 200 adena.</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Kantabilon:<br>
I already told you that I cannot make an Echo Crystal for you if you don't bring me a score!<br>
A fellow once told me that he was able to obtain an old score by talking to a fake alchemist in Oren...</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Kantabilon:<br>
How sad! It reminds me of the feeling I get when I'm drinking alone on a rainy night... My, oh my, am I blue!<br>
Here is your crystal. Enjoy it!</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
If you want an Echo Crystal it'll cost you 200 adena.</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
How do you expect me to make a crystal if you don't bring me a score?</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Kantabilon:<br>
This music makes me want to get up and dance! I haven't felt this good in years! All it needs is an accordion!<br>
Your crystal is complete. Enjoy it!</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
If you want me to create an Echo Crystal it'll cost you 200 adena.</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Kantabilon:<br>
How do you expect me to make an Echo Crystal if you don't bring me a score?</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Melody Maestro Kantabilon:<br>
This is such a happy tune! I especially like the last part! It reminds me of watching a clown at the circus... <br>
It's done! Enjoy!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Melody Maestro Kantabilon:<br>
Hmm...! Is there a happy occasion in the offing? My, what heartwarming music! <br>
It's done! Enjoy!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
Music and travel are my two favorite things! Music makes travel twice as exciting!<br>
Your crystal is finished! Tra la la~!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
I'm trying to make a living here! If you won't pay for the ingredients, who do you think will?<br>
An Echo Crystal will cost you 200 adena.</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
How do you expect me to make an Echo Crystal without a score? Unless you want a silent Echo Crystal~!!<br>
Bard Swan has a lovely travel score you might like... Tra la la~ la la~!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
Oh, my! What a bellicose theme! I feel like marching off to war! Da dum da dum dum~!<br>
La la~! Your crystal is finished~! Tra la la~ la la~!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
I'm trying to make a living here! If you won't pay for the ingredients, who do you think will?<br>
An Echo Crystal will cost you 200 adena.</body></html>

View File

@@ -0,0 +1,2 @@
<html><body>Octavia:<br>
How can I make an Echo Crystal without a score~? Unless you want me to make a silent Echo Crystal~!!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
What is the taste of love? Is it sweet like honey or bitter like black beer? I'll bet it tastes like a Dion potato! Yum!<br>
Your crystal is finished! I hope you enjoy it!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
I'm trying to make a living here! If you won't pay for the ingredients, do you expect me to?<br>
An Echo Crystal will cost you 200 adena.</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
How do you expect me to make an Echo Crystal without a score? Unless you want a silent Echo Crystal~!!<br>
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
Oh, the lonely moon! My aching heart! This isn't my style at all!~<br>
Your crystal is finished!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
I'm trying to make a living here! If you won't pay for the ingredients, do you expect me to?<br>
An Echo Crystal will cost you 200 adena.</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
How do you expect me to make an Echo Crystal without a score? Unless you a silent Echo Crystal!!<br>
A fellow once told me that an excellent theme of solitude can be obtained from Musician Nanarin. He has quite a fondness for beards. Tra la la la la!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
Shake that booty! Yeah, baby! Go! Dance, you slug! You self-centered buffoon! Shake your body! Feel the beat!<br>
Your crystal is finished!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
I'm trying to make a living here! If you won't pay for the ingredients, who do you think will?<br>
An Echo Crystal will cost you 200 adena.</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
How do you expect me to make an Echo Crystal without a score? Unless you want a silent Echo Crystal!!<br>
Barbado has a lovely score with a theme of feast!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
Come out and play with me! Forget your troubles! Come on! Get happy!<br>
It's finished! This is really my kind of music!</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Octavia:<br>
Ah, what a touching melody! Such heart-felt sentiments. And just think, it was made especially for you!<br>
Enjoy!</body></html>

View File

@@ -0,0 +1,140 @@
/*
* 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 custom.EchoCrystals;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.quest.QuestState;
import com.l2jmobius.gameserver.util.Util;
/**
* @authors DrLecter (python), Plim (java)
* @notes Formerly based on Elektra's script
*/
public class EchoCrystals extends Quest
{
private static final String qn = "EchoCrystals";
private static final int ADENA = 57;
private static final int COST = 200;
private static final Map<Integer, ScoreData> SCORES = new HashMap<>();
{
SCORES.put(4410, new ScoreData(4411, "01", "02", "03"));
SCORES.put(4409, new ScoreData(4412, "04", "05", "06"));
SCORES.put(4408, new ScoreData(4413, "07", "08", "09"));
SCORES.put(4420, new ScoreData(4414, "10", "11", "12"));
SCORES.put(4421, new ScoreData(4415, "13", "14", "15"));
SCORES.put(4419, new ScoreData(4417, "16", "05", "06"));
SCORES.put(4418, new ScoreData(4416, "17", "05", "06"));
}
public EchoCrystals()
{
super(-1, qn, "custom");
addStartNpc(31042, 31043);
addTalkId(31042, 31043);
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
String htmltext = "";
QuestState st = player.getQuestState(qn);
if ((st != null) && Util.isDigit(event))
{
int score = Integer.parseInt(event);
if (SCORES.containsKey(score))
{
int crystal = SCORES.get(score).getCrystalId();
String ok = SCORES.get(score).getOkMsg();
String noadena = SCORES.get(score).getNoAdenaMsg();
String noscore = SCORES.get(score).getNoScoreMsg();
if (st.getQuestItemsCount(score) == 0)
{
htmltext = npc.getNpcId() + "-" + noscore + ".htm";
}
else if (st.getQuestItemsCount(ADENA) < COST)
{
htmltext = npc.getNpcId() + "-" + noadena + ".htm";
}
else
{
st.takeItems(ADENA, COST);
st.giveItems(crystal, 1);
htmltext = npc.getNpcId() + "-" + ok + ".htm";
}
}
}
return htmltext;
}
@Override
public String onTalk(L2NpcInstance npc, L2PcInstance player)
{
return "1.htm";
}
private class ScoreData
{
private final int _crystalId;
private final String _okMsg;
private final String _noAdenaMsg;
private final String _noScoreMsg;
public ScoreData(int crystalId, String okMsg, String noAdenaMsg, String noScoreMsg)
{
_crystalId = crystalId;
_okMsg = okMsg;
_noAdenaMsg = noAdenaMsg;
_noScoreMsg = noScoreMsg;
}
public int getCrystalId()
{
return _crystalId;
}
public String getOkMsg()
{
return _okMsg;
}
public String getNoAdenaMsg()
{
return _noAdenaMsg;
}
public String getNoScoreMsg()
{
return _noScoreMsg;
}
}
public static void main(String[] args)
{
new EchoCrystals();
}
}

View File

@@ -0,0 +1,68 @@
/*
* 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 custom.HeroCirclet;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.quest.QuestState;
public class HeroCirclet extends Quest
{
public HeroCirclet()
{
super(-1, "HeroCirclet", "custom");
addStartNpc(31690, 31769, 31770, 31771, 31772);
addTalkId(31690, 31769, 31770, 31771, 31772);
}
@Override
public String onTalk(L2NpcInstance npc, L2PcInstance player)
{
String htmltext = "";
QuestState st = player.getQuestState(getName());
if (st == null)
{
st = newQuestState(player);
}
if (player.isHero())
{
if (player.getInventory().getItemByItemId(6842) == null)
{
st.giveItems(6842, 1);
}
else
{
htmltext = "already_have_circlet.htm";
}
}
else
{
htmltext = "no_hero.htm";
}
st.exitQuest(true);
return htmltext;
}
public static void main(String[] args)
{
new HeroCirclet();
}
}

View File

@@ -0,0 +1,4 @@
<html><body>Monument of Heroes:<br>
You've already received a Wings of Destiny Circlet and cannot have another one.<br>
<a action="bypass -h npc_%objectId%_Chat 0">Back</a>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Monument of Heroes:<br>
You're not a Hero and aren't eligible to receive the Wings of Destiny Circlet. Better luck next time.<br>
<a action="bypass -h npc_%objectId%_Chat 0">Return</a>
</body></html>

View File

@@ -0,0 +1,116 @@
/*
* 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 custom.HeroWeapon;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.quest.QuestState;
import com.l2jmobius.gameserver.util.Util;
public class HeroWeapon extends Quest
{
private static final int[] WEAPON_IDS =
{
6611,
6612,
6613,
6614,
6615,
6616,
6617,
6618,
6619,
6620,
6621
};
public HeroWeapon()
{
super(-1, "HeroWeapon", "custom");
addStartNpc(31690, 31769, 31770, 31771, 31772, 31773);
addTalkId(31690, 31769, 31770, 31771, 31772, 31773);
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
QuestState st = player.getQuestState(getName());
int weaponId = Integer.valueOf(event);
if (Util.contains(WEAPON_IDS, weaponId))
{
st.giveItems(weaponId, 1);
}
st.exitQuest(true);
return null;
}
@Override
public String onTalk(L2NpcInstance npc, L2PcInstance player)
{
String htmltext = "";
QuestState st = player.getQuestState(getName());
if (st == null)
{
newQuestState(player);
}
if (st != null)
{
if (player.isHero())
{
if (hasHeroWeapon(player))
{
htmltext = "already_have_weapon.htm";
st.exitQuest(true);
}
else
{
htmltext = "weapon_list.htm";
}
}
else
{
htmltext = "no_hero.htm";
st.exitQuest(true);
}
}
return htmltext;
}
private static boolean hasHeroWeapon(L2PcInstance player)
{
for (int i : WEAPON_IDS)
{
if (player.getInventory().getItemByItemId(i) != null)
{
return true;
}
}
return false;
}
public static void main(String[] args)
{
new HeroWeapon();
}
}

View File

@@ -0,0 +1,4 @@
<html><body>Monument of Heroes:<br>
You've already received a weapon and cannot have another one.<br>
<a action="bypass -h npc_%objectId%_Chat 0">Back</a>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Monument of Heroes:<br>
You do not meet the requirements. You must become a Hero first!<br>
<a action="bypass -h npc_%objectId%_Chat 0">Back</a>
</body></html>

Some files were not shown because too many files have changed in this diff Show More