Replacements for last other AI python scripts.
This commit is contained in:
parent
02e86e4a02
commit
f72cfd90c0
74
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/CatsEyeBandit.java
vendored
Normal file
74
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/CatsEyeBandit.java
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class CatsEyeBandit extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int CATS_EYE_BANDIT = 27038;
|
||||
|
||||
private CatsEyeBandit()
|
||||
{
|
||||
super(-1, "CatsEyeBandit", "ai/others");
|
||||
|
||||
addKillId(CATS_EYE_BANDIT);
|
||||
addAttackId(CATS_EYE_BANDIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "You childish fool, do you think you can catch me?"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if (Rnd.get(100) < 80)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "I must do something about this shameful incident..."));
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new CatsEyeBandit();
|
||||
}
|
||||
}
|
135
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/Chests.java
vendored
Normal file
135
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/Chests.java
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ChestInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Chests extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int[] CHESTS =
|
||||
{// @formatter:off
|
||||
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
|
||||
};// @formatter:on
|
||||
// Skill
|
||||
private static final int SKILL_DELUXE_KEY = 2229;
|
||||
// Misc
|
||||
private static final int BASE_CHANCE = 100;
|
||||
// Percent to decrease base chance when grade of DELUXE key not match.
|
||||
private static final int LEVEL_DECREASE = 40;
|
||||
// Chance for a chest to actually be a BOX (as opposed to being a mimic).
|
||||
private static final int IS_BOX = 40;
|
||||
|
||||
private Chests()
|
||||
{
|
||||
super(-1, "Chests", "ai/others");
|
||||
|
||||
addSkillUseId(CHESTS);
|
||||
addAttackId(CHESTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillUse(NpcInstance npc, PlayerInstance caster, Skill skill)
|
||||
{
|
||||
// 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
|
||||
final ChestInstance chest = (ChestInstance) npc;
|
||||
if (chest.isInteracted())
|
||||
{
|
||||
chest.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 (skill.getId() == SKILL_DELUXE_KEY)
|
||||
{
|
||||
// check the chance to open the box
|
||||
final int keyLevelNeeded = chest.getLevel() / 10;
|
||||
int levelDiff = keyLevelNeeded - skill.getLevel();
|
||||
if (levelDiff < 0)
|
||||
{
|
||||
levelDiff = levelDiff * (-1);
|
||||
}
|
||||
final int chance = BASE_CHANCE - (levelDiff * LEVEL_DECREASE);
|
||||
|
||||
// success, pretend-death with rewards: npc.reduceCurrentHp(99999999, player)
|
||||
if (Rnd.get(100) < chance)
|
||||
{
|
||||
chest.setMustRewardExpSp(false);
|
||||
chest.setSpecialDrop();
|
||||
chest.reduceCurrentHp(99999999, caster);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards
|
||||
chest.onDecay();
|
||||
}
|
||||
else
|
||||
{
|
||||
final Creature target = chest.getAttackByList().contains(caster.getPet()) ? caster.getPet() : caster;
|
||||
chest.setRunning();
|
||||
chest.addDamageHate(target, 0, 999);
|
||||
chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
}
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final ChestInstance chest = (ChestInstance) npc;
|
||||
if (!chest.isInteracted())
|
||||
{
|
||||
chest.setInteracted();
|
||||
if (Rnd.get(100) < IS_BOX)
|
||||
{
|
||||
chest.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?
|
||||
final Creature target = isPet ? attacker.getPet() : attacker;
|
||||
chest.setRunning();
|
||||
chest.addDamageHate(target, 0, (damage * 100) / (chest.getLevel() + 7));
|
||||
chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Chests();
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class DeluLizardmanSpecialAgent extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int DELU_LIZARDMAN_SPECIAL_AGENT = 21105;
|
||||
|
||||
private DeluLizardmanSpecialAgent()
|
||||
{
|
||||
super(-1, "DeluLizardmanSpecialAgent", "ai/others");
|
||||
|
||||
addAttackId(DELU_LIZARDMAN_SPECIAL_AGENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Hey! We're having a duel here!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "How dare you interrupt our fight! Hey guys, help!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new DeluLizardmanSpecialAgent();
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class DeluLizardmanSpecialCommander extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int DELU_LIZARDMAN_SPECIAL_COMMANDER = 21107;
|
||||
|
||||
private DeluLizardmanSpecialCommander()
|
||||
{
|
||||
super(-1, "DeluLizardmanSpecialCommander", "ai/others");
|
||||
|
||||
addAttackId(DELU_LIZARDMAN_SPECIAL_COMMANDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Come on, Ill take you on!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "How dare you interrupt a sacred duel! You must be taught a lesson!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new DeluLizardmanSpecialCommander();
|
||||
}
|
||||
}
|
79
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/EvaBox.java
vendored
Normal file
79
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/EvaBox.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ItemTable;
|
||||
import org.l2jmobius.gameserver.model.Effect;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class EvaBox extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int BOX = 32342;
|
||||
// Skills
|
||||
private static final List<Integer> KISS_OF_EVA = new ArrayList<>();
|
||||
static
|
||||
{
|
||||
KISS_OF_EVA.add(1073);
|
||||
KISS_OF_EVA.add(3141);
|
||||
KISS_OF_EVA.add(3252);
|
||||
}
|
||||
// Items
|
||||
private static final int[] REWARDS =
|
||||
{
|
||||
9692,
|
||||
9693
|
||||
};
|
||||
|
||||
private EvaBox()
|
||||
{
|
||||
super(-1, "EvaBox", "ai/others");
|
||||
|
||||
addKillId(BOX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
for (Effect effect : killer.getAllEffects())
|
||||
{
|
||||
if (KISS_OF_EVA.contains(effect.getSkill().getId()))
|
||||
{
|
||||
final ItemInstance reward = ItemTable.getInstance().createItem("EvaBox", Rnd.get(REWARDS.length), 1, killer);
|
||||
reward.dropMe(npc, npc.getX(), npc.getY(), npc.getZ());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new EvaBox();
|
||||
}
|
||||
}
|
560
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/FeedableBeasts.java
vendored
Normal file
560
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/FeedableBeasts.java
vendored
Normal file
@ -0,0 +1,560 @@
|
||||
/*
|
||||
* 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.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.TamedBeastInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import org.l2jmobius.gameserver.templates.creatures.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import quests.Q020_BringUpWithLove.Q020_BringUpWithLove;
|
||||
|
||||
/**
|
||||
* Growth-capable mobs: Polymorphing upon successful feeding.
|
||||
* @author Fulminus, Mobius
|
||||
*/
|
||||
public class FeedableBeasts extends Quest
|
||||
{
|
||||
private static final int GOLDEN_SPICE = 6643;
|
||||
private static final int CRYSTAL_SPICE = 6644;
|
||||
private static final int SKILL_GOLDEN_SPICE = 2188;
|
||||
private static final int SKILL_CRYSTAL_SPICE = 2189;
|
||||
|
||||
// @formatter:off
|
||||
private static final int[] TAMED_BEASTS =
|
||||
{
|
||||
16013, 16014, 16015, 16016, 16017, 16018
|
||||
};
|
||||
|
||||
private static final int[] FEEDABLE_BEASTS =
|
||||
{
|
||||
21451, 21452, 21453, 21454, 21455, 21456, 21457, 21458, 21459, 21460, 21461, 21462, 21463, 21464, 21465, 21466, 21467, 21468, 21469, // Alpen Kookaburra
|
||||
21470, 21471, 21472, 21473, 21474, 21475, 21476, 21477, 21478, 21479, 21480, 21481, 21482, 21483, 21484, 21485, 21486, 21487, 21488, // Alpen Buffalo
|
||||
21489, 21490, 21491, 21492, 21493, 21494, 21495, 21496, 21497, 21498, 21499, 21500, 21501, 21502, 21503, 21504, 21505, 21506, 21507, // Alpen Cougar
|
||||
21824, 21825, 21826, 21827, 21828, 21829 // Alpen Kookaburra, Buffalo, Cougar
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private static final Map<Integer, Integer> MAD_COW_POLYMORPH = new HashMap<>();
|
||||
{
|
||||
MAD_COW_POLYMORPH.put(21824, 21468);
|
||||
MAD_COW_POLYMORPH.put(21825, 21469);
|
||||
MAD_COW_POLYMORPH.put(21826, 21487);
|
||||
MAD_COW_POLYMORPH.put(21827, 21488);
|
||||
MAD_COW_POLYMORPH.put(21828, 21506);
|
||||
MAD_COW_POLYMORPH.put(21829, 21507);
|
||||
}
|
||||
|
||||
private static final String[][] 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 happening!",
|
||||
"This is sad...Good is sad...!"
|
||||
}
|
||||
};
|
||||
|
||||
private static final String[] SPAWN_CHATS =
|
||||
{
|
||||
"$s1, will you show me your hideaway?",
|
||||
"$s1, whenever I look at spice, I think about you.",
|
||||
"$s1, you do not need to return to the village. I will give you strength.",
|
||||
"Thanks, $s1. I hope I can help you.",
|
||||
"$s1, what can I do to help you?",
|
||||
};
|
||||
|
||||
private static final Map<Integer, Integer> FEED_INFO = new ConcurrentHashMap<>();
|
||||
private static final Map<Integer, GrowthCapableMob> GROWTH_CAPABLE_MONSTERS = new HashMap<>();
|
||||
|
||||
private static class GrowthCapableMob
|
||||
{
|
||||
private final int _growthLevel;
|
||||
private final int _chance;
|
||||
|
||||
private final Map<Integer, int[][]> _spiceToMob = new HashMap<>();
|
||||
|
||||
public GrowthCapableMob(int growthLevel, int chance)
|
||||
{
|
||||
_growthLevel = growthLevel;
|
||||
_chance = chance;
|
||||
}
|
||||
|
||||
public void addMobs(int spice, int[][] Mobs)
|
||||
{
|
||||
_spiceToMob.put(spice, Mobs);
|
||||
}
|
||||
|
||||
public Integer getMob(int spice, int mobType, int classType)
|
||||
{
|
||||
if (_spiceToMob.containsKey(spice))
|
||||
{
|
||||
return _spiceToMob.get(spice)[mobType][classType];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getRandomMob(int spice)
|
||||
{
|
||||
int[][] temp;
|
||||
temp = _spiceToMob.get(spice);
|
||||
return temp[0][Rnd.get(temp[0].length)];
|
||||
}
|
||||
|
||||
public Integer getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
public Integer getGrowthLevel()
|
||||
{
|
||||
return _growthLevel;
|
||||
}
|
||||
}
|
||||
|
||||
private FeedableBeasts()
|
||||
{
|
||||
super(-1, "FeedableBeasts", "ai/others");
|
||||
|
||||
addKillId(FEEDABLE_BEASTS);
|
||||
addSkillUseId(FEEDABLE_BEASTS);
|
||||
|
||||
// TODO: no grendels?
|
||||
GrowthCapableMob temp;
|
||||
|
||||
//@formatter:off
|
||||
final int[][] Kookabura_0_Gold = {{ 21452, 21453, 21454, 21455 }};
|
||||
final int[][] Kookabura_0_Crystal = {{ 21456, 21457, 21458, 21459 }};
|
||||
final int[][] Kookabura_1_Gold_1= {{ 21460, 21462 }};
|
||||
final int[][] Kookabura_1_Gold_2 = {{ 21461, 21463 }};
|
||||
final int[][] Kookabura_1_Crystal_1 = {{ 21464, 21466 }};
|
||||
final int[][] Kookabura_1_Crystal_2 = {{ 21465, 21467 }};
|
||||
final int[][] Kookabura_2_1 = {{ 21468, 21824}, { 16017, 16018 }};
|
||||
final int[][] Kookabura_2_2 = {{ 21469, 21825}, { 16017, 16018 }};
|
||||
|
||||
final int[][] Buffalo_0_Gold = {{ 21471, 21472, 21473, 21474 }};
|
||||
final int[][] Buffalo_0_Crystal = {{ 21475, 21476, 21477, 21478 }};
|
||||
final int[][] Buffalo_1_Gold_1 = {{ 21479, 21481 }};
|
||||
final int[][] Buffalo_1_Gold_2 = {{ 21481, 21482 }};
|
||||
final int[][] Buffalo_1_Crystal_1 = {{ 21483, 21485 }};
|
||||
final int[][] Buffalo_1_Crystal_2 = {{ 21484, 21486 }};
|
||||
final int[][] Buffalo_2_1 = {{ 21487,21826}, {16013, 16014 }};
|
||||
final int[][] Buffalo_2_2 = {{ 21488,21827}, {16013, 16014 }};
|
||||
|
||||
final int[][] Cougar_0_Gold = {{ 21490, 21491, 21492, 21493 }};
|
||||
final int[][] Cougar_0_Crystal = {{ 21494,21495, 21496, 21497 }};
|
||||
final int[][] Cougar_1_Gold_1 = {{ 21498, 21500 }};
|
||||
final int[][] Cougar_1_Gold_2 = {{ 21499, 21501 }};
|
||||
final int[][] Cougar_1_Crystal_1 = {{ 21502,21504 }};
|
||||
final int[][] Cougar_1_Crystal_2 = {{ 21503,21505 }};
|
||||
final int[][] Cougar_2_1 = {{ 21506, 21828 }, { 16015,16016 }};
|
||||
final int[][] Cougar_2_2 = {{ 21507, 21829 }, { 16015,16016 }};
|
||||
//@formatter:on
|
||||
|
||||
// Alpen Kookabura
|
||||
temp = new GrowthCapableMob(0, 100);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_0_Gold);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_0_Crystal);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21451, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_1_Gold_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21452, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21454, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_1_Gold_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21453, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21455, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_1_Crystal_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21456, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21458, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_1_Crystal_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21457, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21459, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21460, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21462, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21461, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21463, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21464, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21466, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21465, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21467, temp);
|
||||
|
||||
// Alpen Buffalo
|
||||
temp = new GrowthCapableMob(0, 100);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_0_Gold);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_0_Crystal);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21470, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_1_Gold_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21471, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21473, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_1_Gold_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21472, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21474, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_1_Crystal_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21475, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21477, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_1_Crystal_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21476, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21478, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21479, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21481, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21480, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21482, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21483, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21485, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21484, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21486, temp);
|
||||
|
||||
// Alpen Cougar
|
||||
temp = new GrowthCapableMob(0, 100);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_0_Gold);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_0_Crystal);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21489, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_1_Gold_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21490, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21492, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_1_Gold_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21491, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21493, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_1_Crystal_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21494, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21496, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_1_Crystal_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21495, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21497, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21498, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21500, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21499, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21501, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21502, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21504, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21503, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21505, temp);
|
||||
}
|
||||
|
||||
private void spawnNext(NpcInstance npc, int growthLevel, PlayerInstance player, int food)
|
||||
{
|
||||
int npcId = npc.getNpcId();
|
||||
int nextNpcId = 0;
|
||||
|
||||
// Find the next mob to spawn, based on the current npcId, growthlevel, and food.
|
||||
if (growthLevel == 2)
|
||||
{
|
||||
// If tamed, the mob that will spawn depends on the class type (fighter/mage) of the player!
|
||||
if (Rnd.get(2) == 0)
|
||||
{
|
||||
if (player.isMageClass())
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* If not tamed, there is a small chance that have "mad cow" disease. that is a stronger-than-normal animal that attacks its feeder
|
||||
*/
|
||||
if (Rnd.get(5) == 0)
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// All other levels of growth are straight-forward
|
||||
else
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getRandomMob(food);
|
||||
}
|
||||
|
||||
// Remove the feedinfo of the mob that got despawned, if any
|
||||
if (FEED_INFO.getOrDefault(npc.getObjectId(), 0) == player.getObjectId())
|
||||
{
|
||||
FEED_INFO.remove(npc.getObjectId());
|
||||
}
|
||||
|
||||
// Despawn the old mob
|
||||
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 (Util.contains(TAMED_BEASTS, nextNpcId))
|
||||
{
|
||||
if (player.getTrainedBeast() != null)
|
||||
{
|
||||
player.getTrainedBeast().deleteMe();
|
||||
}
|
||||
|
||||
final NpcTemplate template = NpcTable.getInstance().getTemplate(nextNpcId);
|
||||
final TamedBeastInstance nextNpc = new TamedBeastInstance(IdFactory.getInstance().getNextId(), template, player, food, npc.getX(), npc.getY(), npc.getZ());
|
||||
|
||||
nextNpc.setRunning();
|
||||
|
||||
// If player has Q020 going, give quest item
|
||||
QuestState st = player.getQuestState(Q020_BringUpWithLove.qn);
|
||||
if ((st != null) && (Rnd.get(100) < 5) && !st.hasQuestItems(7185))
|
||||
{
|
||||
st.giveItems(7185, 1);
|
||||
st.set("cond", "2");
|
||||
}
|
||||
|
||||
// Also, perform a rare random chat
|
||||
int rand = Rnd.get(20);
|
||||
if (rand < 5)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(nextNpc.getObjectId(), 0, nextNpc.getName(), SPAWN_CHATS[rand].replace("$s1", player.getName())));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not trained, the newly spawned mob will automatically be aggro against its feeder
|
||||
// (what happened to "never bite the hand that feeds you" anyway?!)
|
||||
Attackable nextNpc = (Attackable) addSpawn(nextNpcId, npc);
|
||||
|
||||
if (MAD_COW_POLYMORPH.containsKey(nextNpcId))
|
||||
{
|
||||
startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player, false);
|
||||
}
|
||||
|
||||
// Register the player in the feedinfo for the mob that just spawned
|
||||
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
|
||||
|
||||
nextNpc.setRunning();
|
||||
nextNpc.addDamageHate(player, 0, 99999);
|
||||
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equalsIgnoreCase("polymorph Mad Cow") && (npc != null) && (player != null))
|
||||
{
|
||||
if (MAD_COW_POLYMORPH.containsKey(npc.getNpcId()))
|
||||
{
|
||||
// remove the feed info from the previous mob
|
||||
if (FEED_INFO.getOrDefault(npc.getObjectId(), 0) == player.getObjectId())
|
||||
{
|
||||
FEED_INFO.remove(npc.getObjectId());
|
||||
}
|
||||
|
||||
// despawn the mad cow
|
||||
npc.deleteMe();
|
||||
|
||||
// spawn the new mob
|
||||
Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getNpcId()), npc);
|
||||
|
||||
// register the player in the feedinfo for the mob that just spawned
|
||||
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
|
||||
|
||||
nextNpc.setRunning();
|
||||
nextNpc.addDamageHate(player, 0, 99999);
|
||||
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
}
|
||||
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillUse(NpcInstance npc, PlayerInstance caster, Skill skill)
|
||||
{
|
||||
// Gather some values on local variables
|
||||
int npcId = npc.getNpcId();
|
||||
int skillId = skill.getId();
|
||||
|
||||
// Check if the npc and skills used are valid for this script. Exit if invalid.
|
||||
if (!Util.contains(FEEDABLE_BEASTS, npcId) || ((skillId != SKILL_GOLDEN_SPICE) && (skillId != SKILL_CRYSTAL_SPICE)))
|
||||
{
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
// First gather some values on local variables
|
||||
int objectId = npc.getObjectId();
|
||||
int growthLevel = 3; // if a mob is in FEEDABLE_BEASTS but not in GROWTH_CAPABLE_MOBS, then it's at max growth (3)
|
||||
|
||||
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
|
||||
{
|
||||
growthLevel = GROWTH_CAPABLE_MONSTERS.get(npcId).getGrowthLevel();
|
||||
}
|
||||
|
||||
// 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) && FEED_INFO.containsKey(objectId))
|
||||
{
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
FEED_INFO.put(objectId, caster.getObjectId());
|
||||
|
||||
int food = 0;
|
||||
if (skillId == SKILL_GOLDEN_SPICE)
|
||||
{
|
||||
food = GOLDEN_SPICE;
|
||||
}
|
||||
else if (skillId == SKILL_CRYSTAL_SPICE)
|
||||
{
|
||||
food = CRYSTAL_SPICE;
|
||||
}
|
||||
|
||||
// Display the social action of the beast eating the food.
|
||||
npc.broadcastPacket(new SocialAction(objectId, 2));
|
||||
|
||||
// If the pet can grow
|
||||
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
|
||||
{
|
||||
// Do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect).
|
||||
if (GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0) == null)
|
||||
{
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
// Rare random talk...
|
||||
if (Rnd.get(20) == 0)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(objectId, 0, npc.getName(), TEXT[growthLevel][Rnd.get(TEXT[growthLevel].length)]));
|
||||
}
|
||||
|
||||
if ((growthLevel > 0) && (FEED_INFO.getOrDefault(objectId, 0) != caster.getObjectId()))
|
||||
{
|
||||
// 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).
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
// Polymorph the mob, with a certain chance, given its current growth level
|
||||
if (Rnd.get(100) < GROWTH_CAPABLE_MONSTERS.get(npcId).getChance())
|
||||
{
|
||||
spawnNext(npc, growthLevel, caster, food);
|
||||
}
|
||||
}
|
||||
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
// Remove the feedinfo of the mob that got killed, if any
|
||||
FEED_INFO.remove(npc.getObjectId());
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FeedableBeasts();
|
||||
}
|
||||
}
|
66
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/KarulBugbear.java
vendored
Normal file
66
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/KarulBugbear.java
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class KarulBugbear extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int KARUL_BUGBEAR = 20600;
|
||||
|
||||
private KarulBugbear()
|
||||
{
|
||||
super(-1, "KarulBugbear", "ai/others");
|
||||
|
||||
addAttackId(KARUL_BUGBEAR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 4)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Your rear is practically unguarded!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
if (Rnd.get(100) < 4)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Watch your back!"));
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new KarulBugbear();
|
||||
}
|
||||
}
|
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/OlMahumGeneral.java
vendored
Normal file
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/OlMahumGeneral.java
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class OlMahumGeneral extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int OL_MAHUM_GENERAL = 20438;
|
||||
|
||||
private OlMahumGeneral()
|
||||
{
|
||||
super(-1, "OlMahumGeneral", "ai/others");
|
||||
|
||||
addAttackId(OL_MAHUM_GENERAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 10)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "We shall see about that!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "I will definitely repay this humiliation!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new OlMahumGeneral();
|
||||
}
|
||||
}
|
100
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/RetreatOnAttack.java
vendored
Normal file
100
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/RetreatOnAttack.java
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.position.Location;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class RetreatOnAttack extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int EPLY = 20432;
|
||||
private static final int OL_MAHUM_GUARD = 20058;
|
||||
// Misc
|
||||
private static final String[] OL_MAHUM_GUARD_TEXT =
|
||||
{
|
||||
"I'll be back!",
|
||||
"You are stronger than expected..."
|
||||
};
|
||||
|
||||
private RetreatOnAttack()
|
||||
{
|
||||
super(-1, "RetreatOnAttack", "ai/others");
|
||||
|
||||
addAttackId(EPLY, OL_MAHUM_GUARD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equals("Retreat") && (npc != null) && (player != null))
|
||||
{
|
||||
npc.setIsAfraid(false);
|
||||
((Attackable) npc).addDamageHate(player, 0, 100);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
if ((npcId == EPLY) || ((npc.getStatus().getCurrentHp() <= ((npc.getMaxHp() * 50) / 100)) && (Rnd.get(100) < 10)))
|
||||
{
|
||||
if (npcId == OL_MAHUM_GUARD)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), OL_MAHUM_GUARD_TEXT[Rnd.get(OL_MAHUM_GUARD_TEXT.length)]));
|
||||
}
|
||||
int posX = npc.getX();
|
||||
int posY = npc.getY();
|
||||
int posZ = npc.getZ();
|
||||
int signX = -500;
|
||||
int signY = -500;
|
||||
if (npc.getX() > attacker.getX())
|
||||
{
|
||||
signX = 500;
|
||||
}
|
||||
if (npc.getY() > attacker.getY())
|
||||
{
|
||||
signY = 500;
|
||||
}
|
||||
posX = posX + signX;
|
||||
posY = posY + signY;
|
||||
npc.setIsAfraid(true);
|
||||
npc.setRunning();
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ));
|
||||
startQuestTimer("Retreat", 10000, npc, attacker);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new RetreatOnAttack();
|
||||
}
|
||||
}
|
59
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/ScarletStakatoNoble.java
vendored
Normal file
59
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/ScarletStakatoNoble.java
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class ScarletStakatoNoble extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int SCARLET_STAKATO_NOBLE = 21378;
|
||||
private static final int SCARLET_STAKATO_NOBLE_B = 21652;
|
||||
|
||||
private ScarletStakatoNoble()
|
||||
{
|
||||
super(-1, "ScarletStakatoNoble", "ai/others");
|
||||
|
||||
addKillId(SCARLET_STAKATO_NOBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new ScarletStakatoNoble();
|
||||
}
|
||||
}
|
95
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/Splendor.java
vendored
Normal file
95
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/Splendor.java
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Splendor extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final Map<Integer, List<Integer>> NPCS = new HashMap<>();
|
||||
static
|
||||
{
|
||||
// Npc, [NewNpc,% for chance by shot,ModeSpawn]
|
||||
// Modespawn 1=> delete and spawn the new npc
|
||||
// Modespawn 2=> just add 1 spawn
|
||||
// if Quest_Drop = 5 => 25% by shot to change mob
|
||||
NPCS.put(21521, Arrays.asList(21522, 5, 1)); // Claw of Splendor
|
||||
NPCS.put(21524, Arrays.asList(21525, 5, 1)); // Blade of Splendor
|
||||
NPCS.put(21527, Arrays.asList(21528, 5, 1)); // Anger of Splendor
|
||||
NPCS.put(21537, Arrays.asList(21538, 5, 1)); // Fang of Splendor
|
||||
NPCS.put(21539, Arrays.asList(21540, 100, 2)); // Wailing of Splendor
|
||||
}
|
||||
|
||||
private Splendor()
|
||||
{
|
||||
super(-1, "Splendor", "ai/others");
|
||||
|
||||
for (int npcId : NPCS.keySet())
|
||||
{
|
||||
addAttackId(npcId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final List<Integer> npcData = NPCS.get(npc.getNpcId());
|
||||
if (Rnd.get(100) < (npcData.get(1) * Config.RATE_DROP_QUEST))
|
||||
{
|
||||
if (npcData.get(2) == 1)
|
||||
{
|
||||
npc.deleteMe();
|
||||
final MonsterInstance newNpc = (MonsterInstance) addSpawn(npcData.get(0), npc);
|
||||
newNpc.addDamageHate(attacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
|
||||
}
|
||||
else if (npc.isScriptValue(1))
|
||||
{
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
else if (npcData.get(2) == 2)
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
final MonsterInstance newNpc = (MonsterInstance) addSpawn(npcData.get(0), npc);
|
||||
newNpc.addDamageHate(attacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Splendor();
|
||||
}
|
||||
}
|
62
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TimakOrcOverlord.java
vendored
Normal file
62
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TimakOrcOverlord.java
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TimakOrcOverlord extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TIMAK_ORC_OVERLORD = 20588;
|
||||
|
||||
private TimakOrcOverlord()
|
||||
{
|
||||
super(-1, "TimakOrcOverlord", "ai/others");
|
||||
|
||||
addAttackId(TIMAK_ORC_OVERLORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 50)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Dear ultimate power!!!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TimakOrcOverlord();
|
||||
}
|
||||
}
|
62
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TimakOrcTroopLeader.java
vendored
Normal file
62
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TimakOrcTroopLeader.java
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TimakOrcTroopLeader extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TIMAK_ORC_TROOP_LEADER = 20767;
|
||||
|
||||
private TimakOrcTroopLeader()
|
||||
{
|
||||
super(-1, "TimakOrcTroopLeader", "ai/others");
|
||||
|
||||
addAttackId(TIMAK_ORC_TROOP_LEADER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 50)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "Destroy the enemy, my brothers!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TimakOrcTroopLeader();
|
||||
}
|
||||
}
|
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TurekOrcFootman.java
vendored
Normal file
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TurekOrcFootman.java
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TurekOrcFootman extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TUREK_ORC_FOOTMAN = 20499;
|
||||
|
||||
private TurekOrcFootman()
|
||||
{
|
||||
super(-1, "TurekOrcFootman", "ai/others");
|
||||
|
||||
addAttackId(TUREK_ORC_FOOTMAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "There is no reason for you to kill me! I have nothing you need!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "We shall see about that!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TurekOrcFootman();
|
||||
}
|
||||
}
|
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TurekOrcSupplier.java
vendored
Normal file
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TurekOrcSupplier.java
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TurekOrcSupplier extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TUREK_ORC_SUPPLIER = 20498;
|
||||
|
||||
private TurekOrcSupplier()
|
||||
{
|
||||
super(-1, "TurekOrcFootman", "ai/others");
|
||||
|
||||
addAttackId(TUREK_ORC_SUPPLIER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "You wont take me down easily."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "We shall see about that!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TurekOrcSupplier();
|
||||
}
|
||||
}
|
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TurekOrcWarlord.java
vendored
Normal file
63
L2J_Mobius_C6_Interlude_OpenJDK12/dist/game/data/scripts/ai/others/TurekOrcWarlord.java
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TurekOrcWarlord extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TUREK_ORC_WARLORD = 20495;
|
||||
|
||||
private TurekOrcWarlord()
|
||||
{
|
||||
super(-1, "TurekOrcWarlord", "ai/others");
|
||||
|
||||
addAttackId(TUREK_ORC_WARLORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "You wont take me down easily."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), "The battle has just begun!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TurekOrcWarlord();
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,103 +0,0 @@
|
||||
# # # # # # # # # # #
|
||||
# Chest AI implementation.
|
||||
# Written by Fulminus
|
||||
# # # # # # # # # # #
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.ai import CtrlIntention
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.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")
|
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,34 +0,0 @@
|
||||
# By Evil33t
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.datatables.xml import ItemTable
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.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)
|
@ -1,273 +0,0 @@
|
||||
# Growth-capable mobs: Polymorphing upon successful feeding.
|
||||
# Written by Fulminus
|
||||
# # # # # # # # # # #
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.ai import CtrlIntention
|
||||
from org.l2jmobius.gameserver.datatables.sql import NpcTable
|
||||
from org.l2jmobius.gameserver.idfactory import IdFactory
|
||||
from org.l2jmobius.gameserver.model.actor.instance import TamedBeastInstance
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.l2jmobius.gameserver.network.serverpackets import SocialAction
|
||||
from org.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 = TamedBeastInstance(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")
|
@ -1,42 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,62 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.ai import CtrlIntention
|
||||
from org.l2jmobius.gameserver.model.actor.position import Location
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,28 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.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)
|
@ -1,63 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius import Config
|
||||
from org.l2jmobius.gameserver.ai import CtrlIntention
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.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)
|
@ -1,40 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,40 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
from org.l2jmobius.gameserver.model.quest import State
|
||||
from org.l2jmobius.gameserver.model.quest import QuestState
|
||||
from org.l2jmobius.gameserver.model.quest.jython import QuestJython as JQuest
|
||||
from org.l2jmobius.gameserver.network.serverpackets import CreatureSay
|
||||
from org.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)
|
@ -512,6 +512,9 @@ public class Spawn
|
||||
// Set the HP and MP of the NpcInstance to the max
|
||||
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
|
||||
|
||||
// Clear script value.
|
||||
npc.setScriptValue(0);
|
||||
|
||||
// Set the heading of the NpcInstance (random heading if not defined)
|
||||
if (_heading == -1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user