Since we all agree that moving from python to java will be overall better
for the project... I'll start with converting AI files 1by1.
Any ideas on how to improve the code are welcome.
scripts.cfg
...group_template/TowerOfInsolence.java
for the project... I'll start with converting AI files 1by1.
Any ideas on how to improve the code are welcome.
scripts.cfg
- Code:
Index: scripts.cfg
===================================================================
--- scripts.cfg (revision 620)
+++ scripts.cfg (working copy)
@@ -14,7 +14,7 @@
ai/group_template/feedable_beasts.py
ai/group_template/FleeingNpc.java
ai/group_template/FrenzyOnAttack.java
-ai/group_template/polymorphing_angel.py
ai/group_template/SearchingMaster.java
+ai/group_template/TowerOfInsolence.java
ai/group_template/ValleyOfSaints.java
...group_template/TowerOfInsolence.java
- Code:
/*
* 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.group_template;
import java.util.HashMap;
import java.util.Map;
import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.L2Attackable;
import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
/**
* Tower of Insolence Angels AI
* By Karakan for L2J-Lisvus
*
*/
public class TowerOfInsolence extends Quest
{
private static final Map<Integer,Integer[]> ANGELSPAWNS = new HashMap<>();
static
{
ANGELSPAWNS.put(830, new Integer[]{859, 100}); //Guardian Angel
ANGELSPAWNS.put(831, new Integer[]{860, 100}); //Seal Angel
ANGELSPAWNS.put(1062, new Integer[]{1063, 100}); //Messenger Angel
ANGELSPAWNS.put(1067, new Integer[]{1068, 100}); //Guardian Archangel
ANGELSPAWNS.put(1070, new Integer[]{1071, 100}); //Seal Archangel
}
public TowerOfInsolence(int questId, String name, String descr)
{
super(questId, name, descr);
int[] mobs = { 830, 1067, 1062, 831, 1070 };
registerMobs(mobs);
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
int npcId = npc.getNpcId();
Integer[] spawnData = ANGELSPAWNS.get(npc.getNpcId());
if (ANGELSPAWNS.containsKey(npcId))
{
L2Attackable newNpc = (L2Attackable) addSpawn (spawnData[0], npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0);
newNpc.onAction(killer);
newNpc.addDamageHate(killer, 0, 100);
newNpc.setRunning();
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, killer);
}
return super.onKill(npc, killer, isPet);
}
public static void main(String[] args)
{
// Quest class and state definition
new TowerOfInsolence(-1, "towerofinsolence", "ai/group_template");
}
}
Last edited by Karakan on 12th July 2019, 15:36; edited 1 time in total