Fixes for most script warnings.

This commit is contained in:
MobiusDev
2017-08-05 13:41:36 +00:00
parent 24c3adced1
commit ceef4087e6
294 changed files with 29 additions and 2205 deletions

View File

@@ -36,18 +36,8 @@ public final class FleeMonsters extends AbstractNpcAI
// NPCs
private static final int[] MOBS =
{
18150, // Victim
18151, // Victim
18152, // Victim
18153, // Victim
18154, // Victim
18155, // Victim
18156, // Victim
18157, // Victim
20002, // Rabbit
20432, // Elpy
22228, // Grey Elpy
25604, // Mutated Elpy
};
// Misc
private static final int FLEE_DISTANCE = 500;

View File

@@ -36,15 +36,8 @@ import ai.AbstractNpcAI;
*/
public final class MonumentOfHeroes extends AbstractNpcAI
{
// NPCs
private static final int[] MONUMENTS =
{
31690,
31769,
31770,
31771,
31772,
};
// NPC
private static final int MONUMENT = 31690;
// Items
private static final int HERO_CLOAK = 30372;
// private static final int GLORIOUS_CLOAK = 30373;
@@ -65,9 +58,9 @@ public final class MonumentOfHeroes extends AbstractNpcAI
private MonumentOfHeroes()
{
addStartNpc(MONUMENTS);
addFirstTalkId(MONUMENTS);
addTalkId(MONUMENTS);
addStartNpc(MONUMENT);
addFirstTalkId(MONUMENT);
addTalkId(MONUMENT);
}
@Override

View File

@@ -1,95 +0,0 @@
/*
* 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.NpcBuffers;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class NpcBufferAI implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(NpcBufferAI.class.getName());
private final L2Npc _npc;
private final NpcBufferSkillData _skillData;
protected NpcBufferAI(L2Npc npc, NpcBufferSkillData skill)
{
_npc = npc;
_skillData = skill;
}
private Skill getSkill(L2PcInstance player)
{
if (_skillData.getScaleToLevel() < 1)
{
return _skillData.getSkill();
}
final BuffInfo currentBuff = player.getEffectList().getBuffInfoBySkillId(_skillData.getSkill().getId());
if (currentBuff != null)
{
int level = currentBuff.getSkill().getLevel();
if (_skillData.getScaleToLevel() > level)
{
level++;
}
final Skill skill = SkillData.getInstance().getSkill(_skillData.getSkill().getId(), level);
if (skill == null)
{
LOGGER.warning("Requested non existing skill level: " + level + " for id: " + _skillData.getSkill().getId());
}
return skill;
}
return _skillData.getSkill();
}
@Override
public void run()
{
if ((_npc == null) || !_npc.isSpawned() || _npc.isDecayed() || _npc.isDead() || (_skillData == null) || (_skillData.getSkill() == null))
{
return;
}
if ((_npc.getSummoner() == null) || !_npc.getSummoner().isPlayer())
{
return;
}
final L2PcInstance player = _npc.getSummoner().getActingPlayer();
final Skill skill = getSkill(player);
if (skill == null)
{
return;
}
_npc.doCast(skill);
ThreadPoolManager.getInstance().scheduleGeneral(this, skill.getReuseDelay());
}
}

View File

@@ -1,49 +0,0 @@
/*
* 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.NpcBuffers;
import java.util.ArrayList;
import java.util.List;
/**
* @author UnAfraid
*/
public class NpcBufferData
{
private final int _id;
private final List<NpcBufferSkillData> _skills = new ArrayList<>();
public NpcBufferData(int id)
{
_id = id;
}
public int getId()
{
return _id;
}
public void addSkill(NpcBufferSkillData skill)
{
_skills.add(skill);
}
public List<NpcBufferSkillData> getSkills()
{
return _skills;
}
}

View File

@@ -1,53 +0,0 @@
/*
* 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.NpcBuffers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class NpcBufferSkillData
{
private final SkillHolder _skill;
private final int _scaleToLevel;
private final int _initialDelay;
public NpcBufferSkillData(StatsSet set)
{
_skill = new SkillHolder(set.getInt("id"), set.getInt("level"));
_scaleToLevel = set.getInt("scaleToLevel", -1);
_initialDelay = set.getInt("initialDelay", 0) * 1000;
}
public Skill getSkill()
{
return _skill.getSkill();
}
public int getScaleToLevel()
{
return _scaleToLevel;
}
public int getInitialDelay()
{
return _initialDelay;
}
}

View File

@@ -1,65 +0,0 @@
/*
* 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.NpcBuffers;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import ai.AbstractNpcAI;
/**
* @author UnAfraid
*/
public final class NpcBuffers extends AbstractNpcAI
{
private final NpcBuffersData _npcBuffers = new NpcBuffersData();
private NpcBuffers()
{
for (int npcId : _npcBuffers.getNpcBufferIds())
{
// TODO: Cleanup once npc rework is finished and default html is configurable.
addFirstTalkId(npcId);
addSpawnId(npcId);
}
}
// TODO: Cleanup once npc rework is finished and default html is configurable.
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return null;
}
@Override
public String onSpawn(L2Npc npc)
{
final NpcBufferData data = _npcBuffers.getNpcBuffer(npc.getId());
for (NpcBufferSkillData skill : data.getSkills())
{
ThreadPoolManager.getInstance().scheduleAi(new NpcBufferAI(npc, skill), skill.getInitialDelay());
}
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new NpcBuffers();
}
}

View File

@@ -1,110 +0,0 @@
/*
* 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.NpcBuffers;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet;
/**
* @author UnAfraid
*/
public class NpcBuffersData implements IGameXmlReader
{
private static final Logger LOGGER = Logger.getLogger(NpcBuffersData.class.getName());
private final Map<Integer, NpcBufferData> _npcBuffers = new HashMap<>();
protected NpcBuffersData()
{
load();
}
@Override
public void load()
{
parseDatapackFile("data/scripts/ai/others/NpcBuffers/NpcBuffersData.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _npcBuffers.size() + " buffers data.");
}
@Override
public void parseDocument(Document doc, File f)
{
StatsSet set;
Node attr;
NamedNodeMap attrs;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
{
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if ("npc".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
final int npcId = parseInteger(attrs, "id");
final NpcBufferData npc = new NpcBufferData(npcId);
for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling())
{
switch (c.getNodeName())
{
case "skill":
{
attrs = c.getAttributes();
set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
attr = attrs.item(i);
set.set(attr.getNodeName(), attr.getNodeValue());
}
npc.addSkill(new NpcBufferSkillData(set));
break;
}
}
}
_npcBuffers.put(npcId, npc);
}
}
}
}
}
public NpcBufferData getNpcBuffer(int npcId)
{
return _npcBuffers.get(npcId);
}
public Collection<NpcBufferData> getNpcBuffers()
{
return _npcBuffers.values();
}
public Set<Integer> getNpcBufferIds()
{
return _npcBuffers.keySet();
}
}

View File

@@ -1,20 +0,0 @@
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="NpcBuffersData.xsd">
<npc id="106"> <!-- Birthday Cake -->
<skill id="22250" level="1" initialDelay="1" /> <!-- Birthday Cake Vitality Buff -->
</npc>
<npc id="139"> <!-- Birthday Cake -->
<skill id="22035" level="1" initialDelay="1" /> <!-- Birthday Cake Vitality Buff -->
</npc>
<npc id="13007"> <!-- Special Christmas Tree -->
<skill id="2139" level="1" initialDelay="1" /> <!-- Special Tree Recovery Bonus -->
</npc>
<npc id="13423"> <!-- Protection Stone -->
<skill id="11360" level="1" scaleToLevel="3" initialDelay="3" /> <!-- Arcane Protection -->
</npc>
<npc id="13424"> <!-- Protection Stone -->
<skill id="11367" level="1" scaleToLevel="3" initialDelay="3" /> <!-- Arcane Protection -->
</npc>
<npc id="13425"> <!-- Protection Stone -->
<skill id="11368" level="1" scaleToLevel="3" initialDelay="3" /> <!-- Arcane Protection -->
</npc>
</list>

View File

@@ -1,23 +0,0 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="npc" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="skill" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:positiveInteger" name="id" use="required" />
<xs:attribute type="xs:positiveInteger" name="level" use="required" />
<xs:attribute type="xs:positiveInteger" name="scaleToLevel" use="optional" />
<xs:attribute type="xs:positiveInteger" name="initialDelay" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:positiveInteger" name="id" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -51,10 +51,6 @@ public final class PolymorphingOnAttack extends AbstractNpcAI
MOBSPAWNS.put(21267, Arrays.asList(21270, 100, 100, -1)); // Cave Ant Larva -> Cave Ant Soldier (always polymorphs)
MOBSPAWNS.put(21271, Arrays.asList(21272, 66, 10, 1)); // Cave Ant -> Cave Ant Soldier
MOBSPAWNS.put(21272, Arrays.asList(21273, 33, 5, 2)); // Cave Ant Soldier -> Cave Noble Ant
MOBSPAWNS.put(21521, Arrays.asList(21522, 100, 30, -1)); // Claws of Splendor
MOBSPAWNS.put(21527, Arrays.asList(21528, 100, 30, -1)); // Anger of Splendor
MOBSPAWNS.put(21533, Arrays.asList(21534, 100, 30, -1)); // Alliance of Splendor
MOBSPAWNS.put(21537, Arrays.asList(21538, 100, 30, -1)); // Fang of Splendor
}
protected static final NpcStringId[][] MOBTEXTS =

View File

@@ -30,11 +30,7 @@ public class SeeThroughSilentMove extends AbstractNpcAI
//@formatter:off
private static final int[] MONSTERS =
{
18001, 18002, 22199, 22215, 22216, 22217, 22327, 22746, 22747, 22748,
22749, 22750, 22751, 22752, 22753, 22754, 22755, 22756, 22757, 22758,
22759, 22760, 22761, 22762, 22763, 22764, 22765, 22794, 22795, 22796,
22797, 22798, 22799, 22800, 22843, 22857, 25725, 25726, 25727, 29009,
29010, 29011, 29012, 29013
18001, 18002, 29009, 29010, 29011, 29012, 29013
};
//@formatter:on

View File

@@ -1,115 +0,0 @@
/*
* 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.Servitors;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import ai.AbstractNpcAI;
/**
* Death Gate AI.
* @author Sdw
*/
public final class GateOfUnlimitedSummoning extends AbstractNpcAI
{
// NPCs
private static final Map<Integer, Integer> DEATH_GATE = new HashMap<>();
static
{
DEATH_GATE.put(14927, 1); // Death Gate
DEATH_GATE.put(15200, 2); // Death Gate
DEATH_GATE.put(15201, 3); // Death Gate
DEATH_GATE.put(15202, 4); // Death Gate
}
// Skills
private static final int GATE_ROOT = 11289;
private static final int GATE_VORTEX = 11291;
private GateOfUnlimitedSummoning()
{
addSpawnId(DEATH_GATE.keySet());
}
@Override
public String onSpawn(L2Npc npc)
{
final L2Character summoner = npc.getSummoner();
if ((summoner != null) && summoner.isPlayer())
{
final L2PcInstance player = summoner.getActingPlayer();
getTimers().addTimer("SKILL_CAST_SLOW", 1000, npc, player);
getTimers().addTimer("SKILL_CAST_DAMAGE", 2000, npc, player);
getTimers().addTimer("END_OF_LIFE", 30000, npc, player);
}
return super.onSpawn(npc);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "SKILL_CAST_SLOW":
{
final int skillLevel = DEATH_GATE.get(npc.getId());
if (skillLevel > 0)
{
final Skill skill = SkillData.getInstance().getSkill(GATE_ROOT, skillLevel);
if (skill != null)
{
npc.doCast(skill);
}
}
getTimers().addTimer("SKILL_CAST_SLOW", 3000, npc, player);
break;
}
case "SKILL_CAST_DAMAGE":
{
final Skill skill = SkillData.getInstance().getSkill(GATE_VORTEX, 1);
if (skill != null)
{
npc.doCast(skill);
}
getTimers().addTimer("SKILL_CAST_DAMAGE", 2000, npc, player);
break;
}
case "END_OF_LIFE":
{
getTimers().cancelTimer("SKILL_CAST_SLOW", npc, player);
getTimers().cancelTimer("SKILL_CAST_DAMAGE", npc, player);
npc.deleteMe();
break;
}
}
}
public static void main(String[] args)
{
new GateOfUnlimitedSummoning();
}
}

View File

@@ -40,9 +40,6 @@ public final class SymbolMaker extends AbstractNpcAI
31051, // Keach
31052, // Heid
31053, // Kidder
31264, // Olsun
31308, // Achim
31953, // Rankar
};
private SymbolMaker()

View File

@@ -55,7 +55,6 @@ public final class TeleportToRaceTrack extends AbstractNpcAI
};
// Misc
private static final Map<Integer, Integer> TELEPORTERS = new HashMap<>();
static
{
TELEPORTERS.put(30059, 2); // Trisha
@@ -66,9 +65,6 @@ public final class TeleportToRaceTrack extends AbstractNpcAI
TELEPORTERS.put(30320, 0); // Richlin
TELEPORTERS.put(30848, 6); // Elisa
TELEPORTERS.put(30899, 4); // Flauen
TELEPORTERS.put(31320, 8); // Ilyana
TELEPORTERS.put(31275, 9); // Tatiana
TELEPORTERS.put(31964, 10); // Bilia
}
// Player Variables

View File

@@ -71,28 +71,6 @@ public final class WyvernManager extends AbstractNpcAI
MANAGERS.put(35536, ManagerType.CASTLE);
MANAGERS.put(35556, ManagerType.CASTLE);
MANAGERS.put(35419, ManagerType.CLAN_HALL);
MANAGERS.put(35638, ManagerType.CLAN_HALL);
MANAGERS.put(36457, ManagerType.FORT);
MANAGERS.put(36458, ManagerType.FORT);
MANAGERS.put(36459, ManagerType.FORT);
MANAGERS.put(36460, ManagerType.FORT);
MANAGERS.put(36461, ManagerType.FORT);
MANAGERS.put(36462, ManagerType.FORT);
MANAGERS.put(36463, ManagerType.FORT);
MANAGERS.put(36464, ManagerType.FORT);
MANAGERS.put(36465, ManagerType.FORT);
MANAGERS.put(36466, ManagerType.FORT);
MANAGERS.put(36467, ManagerType.FORT);
MANAGERS.put(36468, ManagerType.FORT);
MANAGERS.put(36469, ManagerType.FORT);
MANAGERS.put(36470, ManagerType.FORT);
MANAGERS.put(36471, ManagerType.FORT);
MANAGERS.put(36472, ManagerType.FORT);
MANAGERS.put(36473, ManagerType.FORT);
MANAGERS.put(36474, ManagerType.FORT);
MANAGERS.put(36475, ManagerType.FORT);
MANAGERS.put(36476, ManagerType.FORT);
MANAGERS.put(36477, ManagerType.FORT);
}
private WyvernManager()