Addition of generic getRandomEntry method.
This commit is contained in:
parent
60b7afe5e3
commit
dde3a7274f
@ -101,7 +101,7 @@ public class CemeteryMonsters extends AbstractNpcAI
|
||||
{
|
||||
if (getRandom(25) < 5)
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), SHOUT_MSG[getRandom(SHOUT_MSG.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(SHOUT_MSG)));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class BeastFarm extends AbstractNpcAI
|
||||
{
|
||||
final TamedBeastInstance nextNpc = new TamedBeastInstance(nextNpcId, player, food, npc.getX(), npc.getY(), npc.getZ(), true);
|
||||
|
||||
final TamedBeast beast = TAMED_BEAST_DATA.get(getRandom(TAMED_BEAST_DATA.size()));
|
||||
final TamedBeast beast = getRandomEntry(TAMED_BEAST_DATA);
|
||||
String name = beast.getName();
|
||||
switch (nextNpcId)
|
||||
{
|
||||
|
@ -552,7 +552,7 @@ public class FeedableBeasts extends AbstractNpcAI
|
||||
// rare random talk...
|
||||
if (getRandom(20) == 0)
|
||||
{
|
||||
final NpcStringId message = TEXT[growthLevel][getRandom(TEXT[growthLevel].length)];
|
||||
final NpcStringId message = getRandomEntry(TEXT[growthLevel]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, message, message.getParamCount() > 0 ? caster.getName() : null);
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ public class FeedableBeasts extends AbstractNpcAI
|
||||
if (skillId == beast.getFoodType())
|
||||
{
|
||||
beast.onReceiveFood();
|
||||
final NpcStringId message = TAMED_TEXT[getRandom(TAMED_TEXT.length)];
|
||||
final NpcStringId message = getRandomEntry(TAMED_TEXT);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, message, message.getParamCount() > 0 ? caster.getName() : null);
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class DenOfEvil extends AbstractNpcAI
|
||||
addSpawnId(EYE_IDS);
|
||||
for (Location loc : EYE_SPAWNS)
|
||||
{
|
||||
addSpawn(EYE_IDS[getRandom(EYE_IDS.length)], loc, false, 0);
|
||||
addSpawn(getRandomEntry(EYE_IDS), loc, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public class DenOfEvil extends AbstractNpcAI
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
addSpawn(EYE_IDS[getRandom(EYE_IDS.length)], _loc, false, 0);
|
||||
addSpawn(getRandomEntry(EYE_IDS), _loc, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class Rooney extends AbstractNpcAI
|
||||
private Rooney()
|
||||
{
|
||||
addSeeCreatureId(ROONEY);
|
||||
addSpawn(ROONEY, LOCATIONS[getRandom(LOCATIONS.length)], false, 0);
|
||||
addSpawn(ROONEY, getRandomEntry(LOCATIONS), false, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -113,7 +113,7 @@ public class Rooney extends AbstractNpcAI
|
||||
}
|
||||
default:
|
||||
{
|
||||
npc.teleToLocation(LOCATIONS[getRandom(LOCATIONS.length)], false);
|
||||
npc.teleToLocation(getRandomEntry(LOCATIONS), false);
|
||||
npc.setScriptValue(0);
|
||||
return null;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_BLOODY_SUCCUBUS[getRandom(ON_ATTACK_MSG_BLOODY_SUCCUBUS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_BLOODY_SUCCUBUS));
|
||||
break;
|
||||
}
|
||||
case "say1":
|
||||
@ -139,7 +139,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say1", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_DEATH[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_DEATH.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_DEATH));
|
||||
break;
|
||||
}
|
||||
case "say2":
|
||||
@ -149,7 +149,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say2", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_DARKNESS[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_DARKNESS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_DARKNESS));
|
||||
break;
|
||||
}
|
||||
case "say3":
|
||||
@ -159,7 +159,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say3", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_LUNACY[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_LUNACY.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_LUNACY));
|
||||
break;
|
||||
}
|
||||
case "say4":
|
||||
@ -169,7 +169,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say4", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_SILENCE[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_SILENCE.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_SILENCE));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -238,31 +238,31 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
case BLOODY_SUCCUBUS:
|
||||
{
|
||||
cancelQuestTimer("say", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_BLOODY_SUCCUBUS[getRandom(ON_FAILED_MSG_BLOODY_SUCCUBUS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_BLOODY_SUCCUBUS));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_DEATH:
|
||||
{
|
||||
cancelQuestTimer("say1", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_DEATH[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_DEATH.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_DEATH));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_DARKNESS:
|
||||
{
|
||||
cancelQuestTimer("say2", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_DARKNESS[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_DARKNESS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_DARKNESS));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_LUNACY:
|
||||
{
|
||||
cancelQuestTimer("say3", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_LUNACY[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_LUNACY.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_LUNACY));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_SILENCE:
|
||||
{
|
||||
cancelQuestTimer("say4", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_SILENCE[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_SILENCE.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_SILENCE));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ public class FourSepulchers extends AbstractNpcAI implements IXmlReader
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, VICTIM_MSG[getRandom(VICTIM_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(VICTIM_MSG));
|
||||
startQuestTimer("VICTIM_FLEE", 3000, npc, null, false);
|
||||
}
|
||||
return null;
|
||||
|
@ -72,7 +72,7 @@ public class GeneralDilios extends AbstractNpcAI
|
||||
else
|
||||
{
|
||||
value = -1;
|
||||
_general.broadcastSay(ChatType.NPC_SHOUT, DILIOS_TEXT[getRandom(DILIOS_TEXT.length)]);
|
||||
_general.broadcastSay(ChatType.NPC_SHOUT, getRandomEntry(DILIOS_TEXT));
|
||||
}
|
||||
startQuestTimer("command_" + (value + 1), 60000, null, null);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class PlainsOfLizardman extends AbstractNpcAI
|
||||
}
|
||||
if (random <= 25)
|
||||
{
|
||||
buffer.doCast(BUFFS[BUFF_LIST[getRandom(BUFF_LIST.length)]].getSkill());
|
||||
buffer.doCast(BUFFS[getRandomEntry(BUFF_LIST)].getSkill());
|
||||
}
|
||||
if (random <= 10)
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ public class SeedOfAnnihilation extends AbstractNpcAI
|
||||
{
|
||||
if (CommonUtil.contains(element.elite_mob_ids, npc.getId()))
|
||||
{
|
||||
spawnGroupOfMinion((MonsterInstance) npc, element.minion_lists[getRandom(element.minion_lists.length)]);
|
||||
spawnGroupOfMinion((MonsterInstance) npc, getRandomEntry(element.minion_lists));
|
||||
}
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
|
@ -65,7 +65,7 @@ public class Seyo extends AbstractNpcAI
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
npc.setScriptValue(0);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, TEXT[getRandom(TEXT.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(TEXT));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class DrillSergeant extends AbstractNpcAI
|
||||
{
|
||||
if (event.equals("SOCIAL_SHOW"))
|
||||
{
|
||||
final int socialActionId = SOCIAL_ACTIONS[getRandom(SOCIAL_ACTIONS.length)];
|
||||
final int socialActionId = getRandomEntry(SOCIAL_ACTIONS);
|
||||
npc.broadcastSocialAction(socialActionId);
|
||||
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, Npc.class, 500, chars ->
|
||||
|
@ -59,7 +59,7 @@ public class HurnakMobMsg extends AbstractNpcAI
|
||||
{
|
||||
if (event.equals("ATTACK"))
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG[getRandom(ON_ATTACK_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG));
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class HurnakMobMsg extends AbstractNpcAI
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance attacker, boolean isSummon)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG[getRandom(ON_FAILED_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG));
|
||||
return super.onKill(npc, attacker, isSummon);
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
*/
|
||||
package ai.areas.TalkingIsland;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
@ -50,14 +48,10 @@ public class YeSagiraGuards extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
final List<MonsterInstance> nearbyMonsters = World.getInstance().getVisibleObjectsInRange(npc, MonsterInstance.class, 1000);
|
||||
if (!nearbyMonsters.isEmpty())
|
||||
final MonsterInstance monster = getRandomEntry(World.getInstance().getVisibleObjectsInRange(npc, MonsterInstance.class, 1000));
|
||||
if ((monster != null) && !monster.isDead() && !monster.isInCombat())
|
||||
{
|
||||
final MonsterInstance monster = nearbyMonsters.get(getRandom(nearbyMonsters.size()));
|
||||
if ((monster != null) && !monster.isDead() && !monster.isInCombat())
|
||||
{
|
||||
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
|
||||
}
|
||||
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
|
||||
}
|
||||
}
|
||||
startQuestTimer("GUARD_AGGRO", 10000, npc, null);
|
||||
|
@ -461,7 +461,7 @@ public class Beleth extends AbstractNpcAI
|
||||
ym[15] = (ym[7] + ym[0]) / 2;
|
||||
_minions.add(addSpawn(FAKE_BELETH, new Location(xm[15], ym[15], -9357, 49152)));
|
||||
|
||||
_allowedObjId = _minions.get(getRandom(_minions.size())).getObjectId();
|
||||
_allowedObjId = getRandomEntry(_minions).getObjectId();
|
||||
break;
|
||||
}
|
||||
case "SPAWN_REAL":
|
||||
|
@ -267,12 +267,7 @@ public class ScarletVanHalisha extends AbstractNpcAI
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result.isEmpty() && (result.size() != 0))
|
||||
{
|
||||
final Object[] characters = result.toArray();
|
||||
return (Creature) characters[getRandom(characters.length)];
|
||||
}
|
||||
return null;
|
||||
return getRandomEntry(result);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
|
@ -774,7 +774,7 @@ public class Lindvior extends AbstractNpcAI
|
||||
guard.setIsInvul(false);
|
||||
if (!guard.isDead())
|
||||
{
|
||||
guard.broadcastSay(ChatType.NPC_GENERAL, GUARD_MSG_1[getRandom(GUARD_MSG_1.length)]);
|
||||
guard.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(GUARD_MSG_1));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -894,7 +894,7 @@ public class Lindvior extends AbstractNpcAI
|
||||
{
|
||||
if ((npc != null) && !npc.isDead())
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, GUARD_MSG[getRandom(GUARD_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(GUARD_MSG));
|
||||
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
|
||||
}
|
||||
}
|
||||
@ -925,7 +925,7 @@ public class Lindvior extends AbstractNpcAI
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_monsterSpawn.add(addSpawn(npcIds[getRandom(npcIds.length)], x, y, loc.getZ(), loc.getHeading(), true, 0, true));
|
||||
_monsterSpawn.add(addSpawn(getRandomEntry(npcIds), x, y, loc.getZ(), loc.getHeading(), true, 0, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,12 +293,9 @@ public class OctavisWarzone extends AbstractInstance
|
||||
}
|
||||
case "BEASTS_MINIONS_SPAWN":
|
||||
{
|
||||
final Location loc = BEASTS_MINIONS_LOC[getRandom(BEASTS_MINIONS_LOC.length)];
|
||||
final int count = getRandom(10);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
for (int i = 0; i < getRandom(10); i++)
|
||||
{
|
||||
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), loc, false, 0, false, world.getId());
|
||||
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
|
||||
beast.setRunning();
|
||||
((Attackable) beast).setCanReturnToSpawnPoint(false);
|
||||
addMoveToDesire(beast, Util.getRandomPosition(BEASTS_RANDOM_POINT, 500, 500), 23);
|
||||
|
@ -58,6 +58,12 @@ public class TeredorWarzone extends AbstractInstance
|
||||
private static final int HATCHET_UNDERBUG = 18994; // Hatched Underbug
|
||||
private static final int TEREDOR_LARVA = 19016; // Teredor's Larva
|
||||
private static final int MUTANTED_MILLIPADE = 19000; // Mutated Millipede
|
||||
private static final int[] MILLIPADES =
|
||||
{
|
||||
MUTANTED_MILLIPADE,
|
||||
HATCHET_UNDERBUG,
|
||||
HATCHET_MILLIPADE
|
||||
};
|
||||
// Items
|
||||
private static final int FAKE_TEREDOR_WEAPON = 15280;
|
||||
// Skill
|
||||
@ -427,7 +433,7 @@ public class TeredorWarzone extends AbstractInstance
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
npcId = getRandomEntry(MUTANTED_MILLIPADE, HATCHET_UNDERBUG, HATCHET_MILLIPADE);
|
||||
npcId = getRandomEntry(MILLIPADES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -543,13 +543,12 @@ public class Stage1 extends AbstractInstance implements IXmlReader
|
||||
case "Spawn":
|
||||
{
|
||||
final List<PlayerInstance> players = new ArrayList<>(world.getPlayers());
|
||||
final PlayerInstance target = players.get(getRandom(players.size()));
|
||||
final int deviceCount = world.getParameters().getInt("deviceCount", 0);
|
||||
if ((deviceCount < MAX_DEVICESPAWNEDMOBCOUNT) && !target.isDead())
|
||||
if ((deviceCount < MAX_DEVICESPAWNEDMOBCOUNT) && !getRandomEntry(players).isDead())
|
||||
{
|
||||
world.setParameter("deviceCount", deviceCount + 1);
|
||||
|
||||
final Attackable mob = (Attackable) addSpawn(SPAWN_MOB_IDS[getRandom(SPAWN_MOB_IDS.length)], npc.getSpawn().getLocation(), false, 0, false, world.getId());
|
||||
final Attackable mob = (Attackable) addSpawn(getRandomEntry(SPAWN_MOB_IDS), npc.getSpawn().getLocation(), false, 0, false, world.getId());
|
||||
mob.setSeeThroughSilentMove(true);
|
||||
mob.setRunning();
|
||||
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, (world.getStatus() >= 7) ? MOVE_TO_TIAT : MOVE_TO_DOOR);
|
||||
|
@ -560,7 +560,7 @@ public class Trasken extends AbstractNpcAI
|
||||
}
|
||||
if ((npc.getId() == LAVRA_1) || (npc.getId() == LAVRA_2) || (npc.getId() == LAVRA_3) || (npc.getId() == TRADJAN))
|
||||
{
|
||||
addAttackPlayerDesire(npc, _zoneLair.getPlayersInside().get(getRandom(_zoneLair.getPlayersInside().size())));
|
||||
addAttackPlayerDesire(npc, getRandomEntry(_zoneLair.getPlayersInside()));
|
||||
}
|
||||
else if ((npc.getId() == TIE) || (npc.getId() == BIG_TIE))
|
||||
{
|
||||
|
@ -527,15 +527,15 @@ public class Valakas extends AbstractNpcAI
|
||||
// Valakas will use mass spells if he feels surrounded.
|
||||
if (World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 1200).size() >= 20)
|
||||
{
|
||||
return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
|
||||
return getRandomEntry(VALAKAS_AOE_SKILLS);
|
||||
}
|
||||
|
||||
if (hpRatio > 50)
|
||||
{
|
||||
return VALAKAS_REGULAR_SKILLS[getRandom(VALAKAS_REGULAR_SKILLS.length)];
|
||||
return getRandomEntry(VALAKAS_REGULAR_SKILLS);
|
||||
}
|
||||
|
||||
return VALAKAS_LOWHP_SKILLS[getRandom(VALAKAS_LOWHP_SKILLS.length)];
|
||||
return getRandomEntry(VALAKAS_LOWHP_SKILLS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -559,7 +559,7 @@ public class Valakas extends AbstractNpcAI
|
||||
}
|
||||
});
|
||||
|
||||
return result.isEmpty() ? null : result.get(getRandom(result.size()));
|
||||
return getRandomEntry(result);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
|
@ -76,7 +76,7 @@ public class DelusionTeleport extends AbstractNpcAI
|
||||
{
|
||||
final int locId = npc.getParameters().getInt("Level", -1);
|
||||
player.getVariables().set(PlayerVariables.DELUSION_RETURN, RETURN_LOCATIONS.containsKey(locId) ? locId : 0);
|
||||
player.teleToLocation(HALL_LOCATIONS[getRandom(HALL_LOCATIONS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(HALL_LOCATIONS), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ public class Mammons extends AbstractNpcAI
|
||||
|
||||
if (blacksmith != null)
|
||||
{
|
||||
blacksmith.broadcastSay(ChatType.NPC_GENERAL, RANDOM_SAY[getRandom(RANDOM_SAY.length)]);
|
||||
blacksmith.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(RANDOM_SAY));
|
||||
|
||||
if (Config.ANNOUNCE_MAMMON_SPAWN)
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ public class TeleportToFantasy extends AbstractNpcAI
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(ISLE_LOCATIONS[getRandom(ISLE_LOCATIONS.length)]);
|
||||
player.teleToLocation(getRandomEntry(ISLE_LOCATIONS));
|
||||
player.getVariables().set(FANTASY_RETURN, npc.getId());
|
||||
}
|
||||
return super.onTalk(npc, player);
|
||||
|
@ -102,12 +102,12 @@ public class TeleportToUndergroundColiseum extends AbstractNpcAI
|
||||
}
|
||||
else if (event.equals("return"))
|
||||
{
|
||||
player.teleToLocation(RETURN_LOCS[getRandom(RETURN_LOCS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(RETURN_LOCS), false);
|
||||
}
|
||||
else if (Util.isDigit(event))
|
||||
{
|
||||
final int val = Integer.parseInt(event) - 1;
|
||||
player.teleToLocation(MANAGERS_LOCS[val][getRandom(MANAGERS_LOCS[val].length)], false);
|
||||
player.teleToLocation(getRandomEntry(MANAGERS_LOCS[val]), false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -117,11 +117,11 @@ public class TeleportToUndergroundColiseum extends AbstractNpcAI
|
||||
{
|
||||
if (CommonUtil.contains(MANAGERS, npc.getId()))
|
||||
{
|
||||
player.teleToLocation(RETURN_LOCS[getRandom(RETURN_LOCS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(RETURN_LOCS), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(COLISEUM_LOCS[getRandom(COLISEUM_LOCS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(COLISEUM_LOCS), false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class TersisHerald extends AbstractNpcAI
|
||||
}
|
||||
else if (event.equals("TEXT_SPAM"))
|
||||
{
|
||||
SPAWNED_NPCS.stream().forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, SPAM_MSGS[getRandom(SPAM_MSGS.length)]));
|
||||
SPAWNED_NPCS.stream().forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SPAM_MSGS)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class TimakOrcTroopLeader extends AbstractNpcAI
|
||||
{
|
||||
addMinion((MonsterInstance) npc, is.getId());
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG[getRandom(ON_ATTACK_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class WarriorFishingBlock extends AbstractNpcAI
|
||||
else
|
||||
{
|
||||
final PlayerInstance target = obj.getActingPlayer();
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NPC_STRINGS_ON_SPAWN[getRandom(NPC_STRINGS_ON_SPAWN.length)], target.getName());
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(NPC_STRINGS_ON_SPAWN), target.getName());
|
||||
((Attackable) npc).addDamageHate(target, 0, 2000);
|
||||
npc.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, target);
|
||||
npc.addAttackerToAttackByList(target);
|
||||
@ -112,7 +112,7 @@ public class WarriorFishingBlock extends AbstractNpcAI
|
||||
{
|
||||
if (getRandom(100) < CHANCE_TO_SHOUT_ON_ATTACK)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NPC_STRINGS_ON_ATTACK[getRandom(NPC_STRINGS_ON_ATTACK.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(NPC_STRINGS_ON_ATTACK));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class WarriorFishingBlock extends AbstractNpcAI
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NPC_STRINGS_ON_KILL[getRandom(NPC_STRINGS_ON_KILL.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(NPC_STRINGS_ON_KILL));
|
||||
cancelQuestTimer("DESPAWN", npc, killer);
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class FactionSystem extends AbstractNpcAI
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, TEXTS[getRandom(TEXTS.length)], 1500);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(TEXTS), 1500);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -95,8 +95,7 @@ public class Elpies extends Event
|
||||
|
||||
EVENT_ACTIVE = true;
|
||||
|
||||
final EventLocation[] locations = EventLocation.values();
|
||||
final EventLocation randomLoc = locations[getRandom(locations.length)];
|
||||
final EventLocation randomLoc = getRandomEntry(EventLocation.values());
|
||||
|
||||
CURRENT_ELPY_COUNT = 0;
|
||||
final long despawnDelay = EVENT_DURATION_MINUTES * 60000;
|
||||
|
@ -85,7 +85,7 @@ public class EveTheFortuneTeller extends LongTimeEvent
|
||||
}
|
||||
case "JAYCE_SHOUT":
|
||||
{
|
||||
Broadcast.toKnownPlayersInRadius(npc, new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), JAYCE_TEXT[getRandom(JAYCE_TEXT.length)]), 1000);
|
||||
Broadcast.toKnownPlayersInRadius(npc, new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(JAYCE_TEXT)), 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class FreyaCelebration extends LongTimeEvent
|
||||
}
|
||||
else if (getRandom(10) < 2)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), getRandomEntry(FREYA_TEXT)));
|
||||
}
|
||||
}
|
||||
return super.onSkillSee(npc, caster, skill, targets, isSummon);
|
||||
|
@ -216,19 +216,19 @@ public class LetterCollector extends LongTimeEvent
|
||||
{
|
||||
if (getRandom(100) < 1)
|
||||
{
|
||||
return REWARDS_TAUTI[getRandom(REWARDS_TAUTI.length)];
|
||||
return getRandomEntry(REWARDS_TAUTI);
|
||||
}
|
||||
else if (getRandom(100) < 3)
|
||||
{
|
||||
return REWARDS_SPECTER[getRandom(REWARDS_SPECTER.length)];
|
||||
return getRandomEntry(REWARDS_SPECTER);
|
||||
}
|
||||
else if (getRandom(100) < 3)
|
||||
{
|
||||
return REWARDS_SERAPH[getRandom(REWARDS_SERAPH.length)];
|
||||
return getRandomEntry(REWARDS_SERAPH);
|
||||
}
|
||||
else
|
||||
{
|
||||
return REWARDS_OTHER[getRandom(REWARDS_OTHER.length)];
|
||||
return getRandomEntry(REWARDS_OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public class AltarOfShilen extends AbstractInstance
|
||||
{
|
||||
if (getRandom(30) < 3)
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), SHOUT_MSG[getRandom(SHOUT_MSG.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(SHOUT_MSG)));
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
|
@ -210,17 +210,17 @@ public class CastleDungeon extends AbstractInstance
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
npcId = RAIDS1[getRandom(RAIDS1.length)];
|
||||
npcId = getRandomEntry(RAIDS1);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
npcId = RAIDS2[getRandom(RAIDS2.length)];
|
||||
npcId = getRandomEntry(RAIDS2);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
npcId = RAIDS3[getRandom(RAIDS3.length)];
|
||||
npcId = getRandomEntry(RAIDS3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
}
|
||||
case "CHAT":
|
||||
{
|
||||
world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n.isScriptValue(1)).forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, DECAY_CHAT[getRandom(DECAY_CHAT.length)]));
|
||||
world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n.isScriptValue(1)).forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(DECAY_CHAT)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
}
|
||||
else
|
||||
{
|
||||
addSpawn(MONOLITH_PRIVATES[getRandom(MONOLITH_PRIVATES.length)], npc, false, 0, false, world.getId());
|
||||
addSpawn(getRandomEntry(MONOLITH_PRIVATES), npc, false, 0, false, world.getId());
|
||||
}
|
||||
world.openCloseDoor(ROOM_B_DOOR, false);
|
||||
}
|
||||
@ -264,7 +264,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
world.openCloseDoor(ROOM_D_DOOR, false);
|
||||
if (npc.isHpBlocked() && (getRandom(100) < 12))
|
||||
{
|
||||
addSpawn(BELETH_SUBORDINATE[getRandom(BELETH_SUBORDINATE.length)], npc, false, 0, false, world.getId());
|
||||
addSpawn(getRandomEntry(BELETH_SUBORDINATE), npc, false, 0, false, world.getId());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -391,7 +391,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
final List<Npc> npcs = world.spawnGroup("roomE");
|
||||
for (Npc n : npcs)
|
||||
{
|
||||
n.broadcastSay(ChatType.NPC_GENERAL, SPAWN_CHAT[getRandom(SPAWN_CHAT.length)]);
|
||||
n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SPAWN_CHAT));
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
@ -413,7 +413,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
world.setParameter("found", found);
|
||||
|
||||
npc.setScriptValue(-1);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, SUCCESS_CHAT[getRandom(SUCCESS_CHAT.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SUCCESS_CHAT));
|
||||
|
||||
if (found != 3)
|
||||
{
|
||||
@ -431,7 +431,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
world.setParameter("blocked", true);
|
||||
world.setParameter("found", 0);
|
||||
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, FAIL_CHAT[getRandom(FAIL_CHAT.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(FAIL_CHAT));
|
||||
npc.setScriptValue(-1);
|
||||
startQuestTimer("CHAT", 4000, npc, null);
|
||||
startQuestTimer("DELETE", 4500, npc, null);
|
||||
|
@ -57,7 +57,7 @@ public class DimensionalArchon extends AbstractNpcAI
|
||||
{
|
||||
if (event.equals("NPC_SHOUT"))
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), ARCHON_MSG[getRandom(ARCHON_MSG.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(ARCHON_MSG)));
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
@ -233,17 +233,17 @@ public class FortressDungeon extends AbstractInstance
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
npcId = RAIDS1[getRandom(RAIDS1.length)];
|
||||
npcId = getRandomEntry(RAIDS1);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
npcId = RAIDS2[getRandom(RAIDS2.length)];
|
||||
npcId = getRandomEntry(RAIDS2);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
npcId = RAIDS3[getRandom(RAIDS3.length)];
|
||||
npcId = getRandomEntry(RAIDS3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
if (npcVars.getBoolean("CAN_TELEPORT", true))
|
||||
{
|
||||
npc.teleToLocation(WARP_POINT_RANDOM_LOCS[getRandom(WARP_POINT_RANDOM_LOCS.length)]);
|
||||
npc.teleToLocation(getRandomEntry(WARP_POINT_RANDOM_LOCS));
|
||||
showOnScreenMsg(instance, NpcStringId.THE_LOCATION_OF_THE_ESCAPE_DEVICE_IS_MOVED, ExShowScreenMessage.TOP_CENTER, 4000);
|
||||
|
||||
switch (npcVars.getInt("TIME_MULTIPLER", 5))
|
||||
@ -333,7 +333,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
case WARP_POINT:
|
||||
{
|
||||
npc.teleToLocation(WARP_POINT_RANDOM_LOCS[getRandom(WARP_POINT_RANDOM_LOCS.length)]);
|
||||
npc.teleToLocation(getRandomEntry(WARP_POINT_RANDOM_LOCS));
|
||||
getTimers().addTimer("CHANGE_POSITION", (60000 * npcVars.getInt("TIME_MULTIPLER", 5)), npc, null);
|
||||
break;
|
||||
}
|
||||
@ -366,7 +366,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
case 0:
|
||||
takeItems(creature.getActingPlayer(), GIANT_CANNONBALL, -1);
|
||||
creature.teleToLocation(PLAYERS_RANDOM_LOCS[getRandom(PLAYERS_RANDOM_LOCS.length)]);
|
||||
creature.teleToLocation(getRandomEntry(PLAYERS_RANDOM_LOCS));
|
||||
showOnScreenMsg(creature.getActingPlayer(), NpcStringId.YOU_NEED_TO_FIND_ESCAPE_DEVICE_RE_ENTRY_IS_NOT_ALLOWED_ONCE_YOU_VE_LEFT_THE_INSTANT_ZONE, ExShowScreenMessage.TOP_CENTER, 4000);
|
||||
instance.getParameters().increaseInt("PLAYERS_COUNT", 0, 1);
|
||||
break;
|
||||
@ -401,7 +401,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
if ((skill == TELEPORT.getSkill()) && (player != null) && (npc.calculateDistance3D(player) < 1000) && (npc.getCurrentHpPercent() > 10))
|
||||
{
|
||||
player.teleToLocation(PLAYERS_TELEPORT_RANDOM_LOCS[getRandom(PLAYERS_TELEPORT_RANDOM_LOCS.length)]);
|
||||
player.teleToLocation(getRandomEntry(PLAYERS_TELEPORT_RANDOM_LOCS));
|
||||
}
|
||||
}
|
||||
return super.onSpellFinished(npc, player, skill);
|
||||
|
@ -89,7 +89,7 @@ public class SSQLibraryOfSages extends AbstractInstance
|
||||
{
|
||||
npc.setRunning();
|
||||
npc.getAI().startFollow(player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ELCADIA_DIALOGS));
|
||||
startQuestTimer("FOLLOW", 10000, npc, player);
|
||||
break;
|
||||
}
|
||||
|
@ -199,18 +199,18 @@ public class SSQMonasteryOfSilence extends AbstractInstance
|
||||
if (player.isInCombat())
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_GUARDIAN_OF_THE_SEAL_DOESN_T_SEEM_TO_GET_INJURED_AT_ALL_UNTIL_THE_BARRIER_IS_DESTROYED);
|
||||
SkillCaster.triggerCast(npc, player, BUFFS[getRandom(BUFFS.length)].getSkill());
|
||||
SkillCaster.triggerCast(npc, player, getRandomEntry(BUFFS).getSkill());
|
||||
}
|
||||
else
|
||||
{
|
||||
final QuestState qs = player.getQuestState(Q10295_SevenSignsSolinasTomb.class.getSimpleName());
|
||||
if ((qs != null) && (qs.getCond() < 2) && !qs.isCompleted())
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ELCADIA_DIALOGS2[getRandom(ELCADIA_DIALOGS2.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ELCADIA_DIALOGS2));
|
||||
}
|
||||
else if (qs == null)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ELCADIA_DIALOGS));
|
||||
}
|
||||
}
|
||||
startQuestTimer("FOLLOW", 10000, npc, player);
|
||||
|
@ -163,7 +163,7 @@ public class TaintedDimension extends AbstractInstance
|
||||
}
|
||||
case "MONSTER_SAY":
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, MONSTER_SAY[getRandom(MONSTER_SAY.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(MONSTER_SAY));
|
||||
break;
|
||||
}
|
||||
case "HUMAN_1_SAY":
|
||||
|
@ -327,15 +327,15 @@ public class Q00456_DontKnowDontCare extends Quest
|
||||
|
||||
if (chance < 170)
|
||||
{
|
||||
reward = ARMOR[getRandom(ARMOR.length)];
|
||||
reward = getRandomEntry(ARMOR);
|
||||
}
|
||||
else if (chance < 200)
|
||||
{
|
||||
reward = ACCESSORIES[getRandom(ACCESSORIES.length)];
|
||||
reward = getRandomEntry(ACCESSORIES);
|
||||
}
|
||||
else if (chance < 270)
|
||||
{
|
||||
reward = WEAPONS[getRandom(WEAPONS.length)];
|
||||
reward = getRandomEntry(WEAPONS);
|
||||
}
|
||||
else if (chance < 325)
|
||||
{
|
||||
@ -347,7 +347,7 @@ public class Q00456_DontKnowDontCare extends Quest
|
||||
}
|
||||
else if (chance < 925)
|
||||
{
|
||||
reward = ATTRIBUTE_CRYSTALS[getRandom(ATTRIBUTE_CRYSTALS.length)];
|
||||
reward = getRandomEntry(ATTRIBUTE_CRYSTALS);
|
||||
}
|
||||
else if (chance < 1100)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ public class Q00617_GatherTheFlames extends Quest
|
||||
{
|
||||
return getNoQuestMsg(player);
|
||||
}
|
||||
giveItems(player, REWARD[getRandom(REWARD.length)], 1);
|
||||
giveItems(player, getRandomEntry(REWARD), 1);
|
||||
takeItems(player, TORCH, 1000);
|
||||
break;
|
||||
}
|
||||
|
@ -120,32 +120,32 @@ public class Q00631_DeliciousTopChoiceMeat extends Quest
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
rewardItems(player, RECIPE[getRandom(RECIPE.length)], 1);
|
||||
rewardItems(player, getRandomEntry(RECIPE), 1);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
rewardItems(player, PIECE[getRandom(PIECE.length)], 1);
|
||||
rewardItems(player, getRandomEntry(PIECE), 1);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
rewardItems(player, PIECE[getRandom(PIECE.length)], 2);
|
||||
rewardItems(player, getRandomEntry(PIECE), 2);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
rewardItems(player, PIECE[getRandom(PIECE.length)], 3);
|
||||
rewardItems(player, getRandomEntry(PIECE), 3);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
rewardItems(player, PIECE[getRandom(PIECE.length)], getRandom(5) + 2);
|
||||
rewardItems(player, getRandomEntry(PIECE), getRandom(5) + 2);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
rewardItems(player, PIECE[getRandom(PIECE.length)], getRandom(7) + 2);
|
||||
rewardItems(player, getRandomEntry(PIECE), getRandom(7) + 2);
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
|
@ -168,7 +168,7 @@ public class Q00643_RiseAndFallOfTheElrokiTribe extends Quest
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(player, PIECE[getRandom(PIECE.length)], 5);
|
||||
rewardItems(player, getRandomEntry(PIECE), 5);
|
||||
takeItems(player, BONES_OF_A_PLAINS_DINOSAUR, 300);
|
||||
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
|
||||
htmltext = "32117-05.html";
|
||||
|
@ -101,7 +101,7 @@ public class Q00647_InfluxOfMachines extends Quest
|
||||
{
|
||||
if (qs.isCond(2) && (getQuestItemsCount(player, BROKEN_GOLEM_FRAGMENT) >= FRAGMENT_COUNT))
|
||||
{
|
||||
giveItems(player, RECIPES[getRandom(RECIPES.length)], 1);
|
||||
giveItems(player, getRandomEntry(RECIPES), 1);
|
||||
qs.exitQuest(true, true);
|
||||
htmltext = event;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class Q10303_CrossroadsBetweenLightAndDarkness extends Quest
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
giveAdena(player, 465855, true);
|
||||
giveItems(player, JOHAN_REWARD[getRandom(JOHAN_REWARD.length)], 1);
|
||||
giveItems(player, getRandomEntry(JOHAN_REWARD), 1);
|
||||
addExpAndSp(player, 6730155, 2847330);
|
||||
qs.exitQuest(false, true);
|
||||
htmltext = event;
|
||||
@ -141,7 +141,7 @@ public class Q10303_CrossroadsBetweenLightAndDarkness extends Quest
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
giveAdena(player, 465855, true);
|
||||
giveItems(player, PRIEST_REWARD[getRandom(PRIEST_REWARD.length)], 1);
|
||||
giveItems(player, getRandomEntry(PRIEST_REWARD), 1);
|
||||
addExpAndSp(player, 6730155, 2847330);
|
||||
qs.exitQuest(false, true);
|
||||
htmltext = event;
|
||||
|
@ -87,7 +87,7 @@ public class Q10306_TheCorruptedLeader extends Quest
|
||||
{
|
||||
addExpAndSp(player, 9_479_594, 2_275);
|
||||
giveItems(player, ENCHANT_ARMOR_R, 2);
|
||||
giveItems(player, REWARD_CRYSTALS[getRandom(REWARD_CRYSTALS.length)], 1);
|
||||
giveItems(player, getRandomEntry(REWARD_CRYSTALS), 1);
|
||||
qs.exitQuest(false, true);
|
||||
htmltext = "32895-09.html";
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class Q10783_TracesOfAnAmbush extends Quest
|
||||
{
|
||||
final Npc mob = addSpawn(EMBRYO_PREDATOR, npc, false, 120000);
|
||||
addAttackPlayerDesire(mob, killer);
|
||||
mob.broadcastSay(ChatType.NPC_GENERAL, MESSAGES[getRandom(MESSAGES.length)]);
|
||||
mob.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(MESSAGES));
|
||||
}
|
||||
}
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
|
@ -3030,22 +3030,43 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
||||
|
||||
/**
|
||||
* Get a random entry.<br>
|
||||
* @param entry array with values.
|
||||
* @return random one value from array entry.
|
||||
* @param <T>
|
||||
* @param array of values.
|
||||
* @return one value from array.
|
||||
*/
|
||||
public static String getRandomEntry(String... entry)
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getRandomEntry(T... array)
|
||||
{
|
||||
return entry[getRandom(entry.length)];
|
||||
if (array.length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return array[getRandom(array.length)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a random entry.<br>
|
||||
* @param entry array with values.
|
||||
* @return random one value from array entry.
|
||||
* @param <T>
|
||||
* @param list of values.
|
||||
* @return one value from list.
|
||||
*/
|
||||
public static int getRandomEntry(int... entry)
|
||||
public static <T> T getRandomEntry(List<T> list)
|
||||
{
|
||||
return entry[getRandom(entry.length)];
|
||||
if (list.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list.get(getRandom(list.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a random entry.<br>
|
||||
* @param array of Integers.
|
||||
* @return one Integer from array.
|
||||
*/
|
||||
public static int getRandomEntry(int... array)
|
||||
{
|
||||
return array[getRandom(array.length)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +101,7 @@ public class CemeteryMonsters extends AbstractNpcAI
|
||||
{
|
||||
if (getRandom(25) < 5)
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), SHOUT_MSG[getRandom(SHOUT_MSG.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(SHOUT_MSG)));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ public class AteliaManager extends AbstractNpcAI
|
||||
if (!npc.isCastingNow() && (chance <= 20))
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(ATELIA_POISON[getRandom(ATELIA_POISON.length)].getSkill());
|
||||
npc.doCast(getRandomEntry(ATELIA_POISON).getSkill());
|
||||
}
|
||||
}
|
||||
else if (CommonUtil.contains(FLOOR_MOBS, npc.getId()) && (chance > 90))
|
||||
|
@ -251,7 +251,7 @@ public class BeastFarm extends AbstractNpcAI
|
||||
{
|
||||
final TamedBeastInstance nextNpc = new TamedBeastInstance(nextNpcId, player, food, npc.getX(), npc.getY(), npc.getZ(), true);
|
||||
|
||||
final TamedBeast beast = TAMED_BEAST_DATA.get(getRandom(TAMED_BEAST_DATA.size()));
|
||||
final TamedBeast beast = getRandomEntry(TAMED_BEAST_DATA);
|
||||
String name = beast.getName();
|
||||
switch (nextNpcId)
|
||||
{
|
||||
|
@ -552,7 +552,7 @@ public class FeedableBeasts extends AbstractNpcAI
|
||||
// rare random talk...
|
||||
if (getRandom(20) == 0)
|
||||
{
|
||||
final NpcStringId message = TEXT[growthLevel][getRandom(TEXT[growthLevel].length)];
|
||||
final NpcStringId message = getRandomEntry(TEXT[growthLevel]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, message, message.getParamCount() > 0 ? caster.getName() : null);
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ public class FeedableBeasts extends AbstractNpcAI
|
||||
if (skillId == beast.getFoodType())
|
||||
{
|
||||
beast.onReceiveFood();
|
||||
final NpcStringId message = TAMED_TEXT[getRandom(TAMED_TEXT.length)];
|
||||
final NpcStringId message = getRandomEntry(TAMED_TEXT);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, message, message.getParamCount() > 0 ? caster.getName() : null);
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class DenOfEvil extends AbstractNpcAI
|
||||
addSpawnId(EYE_IDS);
|
||||
for (Location loc : EYE_SPAWNS)
|
||||
{
|
||||
addSpawn(EYE_IDS[getRandom(EYE_IDS.length)], loc, false, 0);
|
||||
addSpawn(getRandomEntry(EYE_IDS), loc, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public class DenOfEvil extends AbstractNpcAI
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
addSpawn(EYE_IDS[getRandom(EYE_IDS.length)], _loc, false, 0);
|
||||
addSpawn(getRandomEntry(EYE_IDS), _loc, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class Rooney extends AbstractNpcAI
|
||||
private Rooney()
|
||||
{
|
||||
addSeeCreatureId(ROONEY);
|
||||
addSpawn(ROONEY, LOCATIONS[getRandom(LOCATIONS.length)], false, 0);
|
||||
addSpawn(ROONEY, getRandomEntry(LOCATIONS), false, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -113,7 +113,7 @@ public class Rooney extends AbstractNpcAI
|
||||
}
|
||||
default:
|
||||
{
|
||||
npc.teleToLocation(LOCATIONS[getRandom(LOCATIONS.length)], false);
|
||||
npc.teleToLocation(getRandomEntry(LOCATIONS), false);
|
||||
npc.setScriptValue(0);
|
||||
return null;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class GainakSiege extends AbstractNpcAI
|
||||
{
|
||||
for (Location loc : ASSASSIN_SPAWNS)
|
||||
{
|
||||
addSpawn(ASSASSIN_IDS[getRandom(ASSASSIN_IDS.length)], loc, true, 1800000);
|
||||
addSpawn(getRandomEntry(ASSASSIN_IDS), loc, true, 1800000);
|
||||
}
|
||||
_isInSiege = true;
|
||||
GAINAK_TOWN_ZONE.broadcastPacket(new OnEventTrigger(SIEGE_EFFECT, true));
|
||||
@ -156,7 +156,7 @@ public class GainakSiege extends AbstractNpcAI
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
addSpawn(ASSASSIN_IDS[getRandom(ASSASSIN_IDS.length)], _loc, true, 1800000);
|
||||
addSpawn(getRandomEntry(ASSASSIN_IDS), _loc, true, 1800000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_BLOODY_SUCCUBUS[getRandom(ON_ATTACK_MSG_BLOODY_SUCCUBUS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_BLOODY_SUCCUBUS));
|
||||
break;
|
||||
}
|
||||
case "say1":
|
||||
@ -139,7 +139,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say1", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_DEATH[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_DEATH.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_DEATH));
|
||||
break;
|
||||
}
|
||||
case "say2":
|
||||
@ -149,7 +149,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say2", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_DARKNESS[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_DARKNESS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_DARKNESS));
|
||||
break;
|
||||
}
|
||||
case "say3":
|
||||
@ -159,7 +159,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say3", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_LUNACY[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_LUNACY.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_LUNACY));
|
||||
break;
|
||||
}
|
||||
case "say4":
|
||||
@ -169,7 +169,7 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
cancelQuestTimer("say4", npc, null);
|
||||
return null;
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG_SUCCUBUS_OF_SILENCE[getRandom(ON_ATTACK_MSG_SUCCUBUS_OF_SILENCE.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG_SUCCUBUS_OF_SILENCE));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -238,31 +238,31 @@ public class BloodySuccubus extends AbstractNpcAI
|
||||
case BLOODY_SUCCUBUS:
|
||||
{
|
||||
cancelQuestTimer("say", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_BLOODY_SUCCUBUS[getRandom(ON_FAILED_MSG_BLOODY_SUCCUBUS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_BLOODY_SUCCUBUS));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_DEATH:
|
||||
{
|
||||
cancelQuestTimer("say1", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_DEATH[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_DEATH.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_DEATH));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_DARKNESS:
|
||||
{
|
||||
cancelQuestTimer("say2", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_DARKNESS[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_DARKNESS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_DARKNESS));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_LUNACY:
|
||||
{
|
||||
cancelQuestTimer("say3", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_LUNACY[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_LUNACY.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_LUNACY));
|
||||
break;
|
||||
}
|
||||
case SUCCUBUS_OF_SILENCE:
|
||||
{
|
||||
cancelQuestTimer("say4", npc, player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG_SUCCUBUS_OF_SILENCE[getRandom(ON_FAILED_MSG_SUCCUBUS_OF_SILENCE.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG_SUCCUBUS_OF_SILENCE));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ public class FourSepulchers extends AbstractNpcAI implements IXmlReader
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, VICTIM_MSG[getRandom(VICTIM_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(VICTIM_MSG));
|
||||
startQuestTimer("VICTIM_FLEE", 3000, npc, null, false);
|
||||
}
|
||||
return null;
|
||||
|
@ -72,7 +72,7 @@ public class GeneralDilios extends AbstractNpcAI
|
||||
else
|
||||
{
|
||||
value = -1;
|
||||
_general.broadcastSay(ChatType.NPC_SHOUT, DILIOS_TEXT[getRandom(DILIOS_TEXT.length)]);
|
||||
_general.broadcastSay(ChatType.NPC_SHOUT, getRandomEntry(DILIOS_TEXT));
|
||||
}
|
||||
startQuestTimer("command_" + (value + 1), 60000, null, null);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class PlainsOfLizardman extends AbstractNpcAI
|
||||
}
|
||||
if (random <= 25)
|
||||
{
|
||||
buffer.doCast(BUFFS[BUFF_LIST[getRandom(BUFF_LIST.length)]].getSkill());
|
||||
buffer.doCast(BUFFS[getRandomEntry(BUFF_LIST)].getSkill());
|
||||
}
|
||||
if (random <= 10)
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ public class SeedOfAnnihilation extends AbstractNpcAI
|
||||
{
|
||||
if (CommonUtil.contains(element.elite_mob_ids, npc.getId()))
|
||||
{
|
||||
spawnGroupOfMinion((MonsterInstance) npc, element.minion_lists[getRandom(element.minion_lists.length)]);
|
||||
spawnGroupOfMinion((MonsterInstance) npc, getRandomEntry(element.minion_lists));
|
||||
}
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
|
@ -65,7 +65,7 @@ public class Seyo extends AbstractNpcAI
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
npc.setScriptValue(0);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, TEXT[getRandom(TEXT.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(TEXT));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class DrillSergeant extends AbstractNpcAI
|
||||
{
|
||||
if (event.equals("SOCIAL_SHOW"))
|
||||
{
|
||||
final int socialActionId = SOCIAL_ACTIONS[getRandom(SOCIAL_ACTIONS.length)];
|
||||
final int socialActionId = getRandomEntry(SOCIAL_ACTIONS);
|
||||
npc.broadcastSocialAction(socialActionId);
|
||||
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, Npc.class, 500, chars ->
|
||||
|
@ -59,7 +59,7 @@ public class HurnakMobMsg extends AbstractNpcAI
|
||||
{
|
||||
if (event.equals("ATTACK"))
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG[getRandom(ON_ATTACK_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG));
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class HurnakMobMsg extends AbstractNpcAI
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance attacker, boolean isSummon)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_FAILED_MSG[getRandom(ON_FAILED_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_FAILED_MSG));
|
||||
return super.onKill(npc, attacker, isSummon);
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
*/
|
||||
package ai.areas.TalkingIsland;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
@ -50,14 +48,10 @@ public class YeSagiraGuards extends AbstractNpcAI
|
||||
{
|
||||
if (!npc.isInCombat())
|
||||
{
|
||||
final List<MonsterInstance> nearbyMonsters = World.getInstance().getVisibleObjectsInRange(npc, MonsterInstance.class, 1000);
|
||||
if (!nearbyMonsters.isEmpty())
|
||||
final MonsterInstance monster = getRandomEntry(World.getInstance().getVisibleObjectsInRange(npc, MonsterInstance.class, 1000));
|
||||
if ((monster != null) && !monster.isDead() && !monster.isInCombat())
|
||||
{
|
||||
final MonsterInstance monster = nearbyMonsters.get(getRandom(nearbyMonsters.size()));
|
||||
if ((monster != null) && !monster.isDead() && !monster.isInCombat())
|
||||
{
|
||||
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
|
||||
}
|
||||
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
|
||||
}
|
||||
}
|
||||
startQuestTimer("GUARD_AGGRO", 10000, npc, null);
|
||||
|
@ -461,7 +461,7 @@ public class Beleth extends AbstractNpcAI
|
||||
ym[15] = (ym[7] + ym[0]) / 2;
|
||||
_minions.add(addSpawn(FAKE_BELETH, new Location(xm[15], ym[15], -9357, 49152)));
|
||||
|
||||
_allowedObjId = _minions.get(getRandom(_minions.size())).getObjectId();
|
||||
_allowedObjId = getRandomEntry(_minions).getObjectId();
|
||||
break;
|
||||
}
|
||||
case "SPAWN_REAL":
|
||||
|
@ -267,12 +267,7 @@ public class ScarletVanHalisha extends AbstractNpcAI
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result.isEmpty() && (result.size() != 0))
|
||||
{
|
||||
final Object[] characters = result.toArray();
|
||||
return (Creature) characters[getRandom(characters.length)];
|
||||
}
|
||||
return null;
|
||||
return getRandomEntry(result);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
|
@ -774,7 +774,7 @@ public class Lindvior extends AbstractNpcAI
|
||||
guard.setIsInvul(false);
|
||||
if (!guard.isDead())
|
||||
{
|
||||
guard.broadcastSay(ChatType.NPC_GENERAL, GUARD_MSG_1[getRandom(GUARD_MSG_1.length)]);
|
||||
guard.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(GUARD_MSG_1));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -894,7 +894,7 @@ public class Lindvior extends AbstractNpcAI
|
||||
{
|
||||
if ((npc != null) && !npc.isDead())
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, GUARD_MSG[getRandom(GUARD_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(GUARD_MSG));
|
||||
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
|
||||
}
|
||||
}
|
||||
@ -925,7 +925,7 @@ public class Lindvior extends AbstractNpcAI
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_monsterSpawn.add(addSpawn(npcIds[getRandom(npcIds.length)], x, y, loc.getZ(), loc.getHeading(), true, 0, true));
|
||||
_monsterSpawn.add(addSpawn(getRandomEntry(npcIds), x, y, loc.getZ(), loc.getHeading(), true, 0, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,12 +293,9 @@ public class OctavisWarzone extends AbstractInstance
|
||||
}
|
||||
case "BEASTS_MINIONS_SPAWN":
|
||||
{
|
||||
final Location loc = BEASTS_MINIONS_LOC[getRandom(BEASTS_MINIONS_LOC.length)];
|
||||
final int count = getRandom(10);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
for (int i = 0; i < getRandom(10); i++)
|
||||
{
|
||||
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), loc, false, 0, false, world.getId());
|
||||
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
|
||||
beast.setRunning();
|
||||
((Attackable) beast).setCanReturnToSpawnPoint(false);
|
||||
addMoveToDesire(beast, Util.getRandomPosition(BEASTS_RANDOM_POINT, 500, 500), 23);
|
||||
|
@ -58,6 +58,12 @@ public class TeredorWarzone extends AbstractInstance
|
||||
private static final int HATCHET_UNDERBUG = 18994; // Hatched Underbug
|
||||
private static final int TEREDOR_LARVA = 19016; // Teredor's Larva
|
||||
private static final int MUTANTED_MILLIPADE = 19000; // Mutated Millipede
|
||||
private static final int[] MILLIPADES =
|
||||
{
|
||||
MUTANTED_MILLIPADE,
|
||||
HATCHET_UNDERBUG,
|
||||
HATCHET_MILLIPADE
|
||||
};
|
||||
// Items
|
||||
private static final int FAKE_TEREDOR_WEAPON = 15280;
|
||||
// Skill
|
||||
@ -427,7 +433,7 @@ public class TeredorWarzone extends AbstractInstance
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
npcId = getRandomEntry(MUTANTED_MILLIPADE, HATCHET_UNDERBUG, HATCHET_MILLIPADE);
|
||||
npcId = getRandomEntry(MILLIPADES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -543,13 +543,12 @@ public class Stage1 extends AbstractInstance implements IXmlReader
|
||||
case "Spawn":
|
||||
{
|
||||
final List<PlayerInstance> players = new ArrayList<>(world.getPlayers());
|
||||
final PlayerInstance target = players.get(getRandom(players.size()));
|
||||
final int deviceCount = world.getParameters().getInt("deviceCount", 0);
|
||||
if ((deviceCount < MAX_DEVICESPAWNEDMOBCOUNT) && !target.isDead())
|
||||
if ((deviceCount < MAX_DEVICESPAWNEDMOBCOUNT) && !getRandomEntry(players).isDead())
|
||||
{
|
||||
world.setParameter("deviceCount", deviceCount + 1);
|
||||
|
||||
final Attackable mob = (Attackable) addSpawn(SPAWN_MOB_IDS[getRandom(SPAWN_MOB_IDS.length)], npc.getSpawn().getLocation(), false, 0, false, world.getId());
|
||||
final Attackable mob = (Attackable) addSpawn(getRandomEntry(SPAWN_MOB_IDS), npc.getSpawn().getLocation(), false, 0, false, world.getId());
|
||||
mob.setSeeThroughSilentMove(true);
|
||||
mob.setRunning();
|
||||
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, (world.getStatus() >= 7) ? MOVE_TO_TIAT : MOVE_TO_DOOR);
|
||||
|
@ -560,7 +560,7 @@ public class Trasken extends AbstractNpcAI
|
||||
}
|
||||
if ((npc.getId() == LAVRA_1) || (npc.getId() == LAVRA_2) || (npc.getId() == LAVRA_3) || (npc.getId() == TRADJAN))
|
||||
{
|
||||
addAttackPlayerDesire(npc, _zoneLair.getPlayersInside().get(getRandom(_zoneLair.getPlayersInside().size())));
|
||||
addAttackPlayerDesire(npc, getRandomEntry(_zoneLair.getPlayersInside()));
|
||||
}
|
||||
else if ((npc.getId() == TIE) || (npc.getId() == BIG_TIE))
|
||||
{
|
||||
|
@ -527,15 +527,15 @@ public class Valakas extends AbstractNpcAI
|
||||
// Valakas will use mass spells if he feels surrounded.
|
||||
if (World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 1200).size() >= 20)
|
||||
{
|
||||
return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
|
||||
return getRandomEntry(VALAKAS_AOE_SKILLS);
|
||||
}
|
||||
|
||||
if (hpRatio > 50)
|
||||
{
|
||||
return VALAKAS_REGULAR_SKILLS[getRandom(VALAKAS_REGULAR_SKILLS.length)];
|
||||
return getRandomEntry(VALAKAS_REGULAR_SKILLS);
|
||||
}
|
||||
|
||||
return VALAKAS_LOWHP_SKILLS[getRandom(VALAKAS_LOWHP_SKILLS.length)];
|
||||
return getRandomEntry(VALAKAS_LOWHP_SKILLS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -559,7 +559,7 @@ public class Valakas extends AbstractNpcAI
|
||||
}
|
||||
});
|
||||
|
||||
return result.isEmpty() ? null : result.get(getRandom(result.size()));
|
||||
return getRandomEntry(result);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
|
@ -76,7 +76,7 @@ public class DelusionTeleport extends AbstractNpcAI
|
||||
{
|
||||
final int locId = npc.getParameters().getInt("Level", -1);
|
||||
player.getVariables().set(PlayerVariables.DELUSION_RETURN, RETURN_LOCATIONS.containsKey(locId) ? locId : 0);
|
||||
player.teleToLocation(HALL_LOCATIONS[getRandom(HALL_LOCATIONS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(HALL_LOCATIONS), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ public class Mammons extends AbstractNpcAI
|
||||
|
||||
if (blacksmith != null)
|
||||
{
|
||||
blacksmith.broadcastSay(ChatType.NPC_GENERAL, RANDOM_SAY[getRandom(RANDOM_SAY.length)]);
|
||||
blacksmith.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(RANDOM_SAY));
|
||||
|
||||
if (Config.ANNOUNCE_MAMMON_SPAWN)
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ public class TeleportToFantasy extends AbstractNpcAI
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(ISLE_LOCATIONS[getRandom(ISLE_LOCATIONS.length)]);
|
||||
player.teleToLocation(getRandomEntry(ISLE_LOCATIONS));
|
||||
player.getVariables().set(FANTASY_RETURN, npc.getId());
|
||||
}
|
||||
return super.onTalk(npc, player);
|
||||
|
@ -102,12 +102,12 @@ public class TeleportToUndergroundColiseum extends AbstractNpcAI
|
||||
}
|
||||
else if (event.equals("return"))
|
||||
{
|
||||
player.teleToLocation(RETURN_LOCS[getRandom(RETURN_LOCS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(RETURN_LOCS), false);
|
||||
}
|
||||
else if (Util.isDigit(event))
|
||||
{
|
||||
final int val = Integer.parseInt(event) - 1;
|
||||
player.teleToLocation(MANAGERS_LOCS[val][getRandom(MANAGERS_LOCS[val].length)], false);
|
||||
player.teleToLocation(getRandomEntry(MANAGERS_LOCS[val]), false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -117,11 +117,11 @@ public class TeleportToUndergroundColiseum extends AbstractNpcAI
|
||||
{
|
||||
if (CommonUtil.contains(MANAGERS, npc.getId()))
|
||||
{
|
||||
player.teleToLocation(RETURN_LOCS[getRandom(RETURN_LOCS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(RETURN_LOCS), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(COLISEUM_LOCS[getRandom(COLISEUM_LOCS.length)], false);
|
||||
player.teleToLocation(getRandomEntry(COLISEUM_LOCS), false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class TersisHerald extends AbstractNpcAI
|
||||
}
|
||||
else if (event.equals("TEXT_SPAM"))
|
||||
{
|
||||
SPAWNED_NPCS.stream().forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, SPAM_MSGS[getRandom(SPAM_MSGS.length)]));
|
||||
SPAWNED_NPCS.stream().forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SPAM_MSGS)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class TimakOrcTroopLeader extends AbstractNpcAI
|
||||
{
|
||||
addMinion((MonsterInstance) npc, is.getId());
|
||||
}
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ON_ATTACK_MSG[getRandom(ON_ATTACK_MSG.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class WarriorFishingBlock extends AbstractNpcAI
|
||||
else
|
||||
{
|
||||
final PlayerInstance target = obj.getActingPlayer();
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NPC_STRINGS_ON_SPAWN[getRandom(NPC_STRINGS_ON_SPAWN.length)], target.getName());
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(NPC_STRINGS_ON_SPAWN), target.getName());
|
||||
((Attackable) npc).addDamageHate(target, 0, 2000);
|
||||
npc.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, target);
|
||||
npc.addAttackerToAttackByList(target);
|
||||
@ -112,7 +112,7 @@ public class WarriorFishingBlock extends AbstractNpcAI
|
||||
{
|
||||
if (getRandom(100) < CHANCE_TO_SHOUT_ON_ATTACK)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NPC_STRINGS_ON_ATTACK[getRandom(NPC_STRINGS_ON_ATTACK.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(NPC_STRINGS_ON_ATTACK));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class WarriorFishingBlock extends AbstractNpcAI
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NPC_STRINGS_ON_KILL[getRandom(NPC_STRINGS_ON_KILL.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(NPC_STRINGS_ON_KILL));
|
||||
cancelQuestTimer("DESPAWN", npc, killer);
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class FactionSystem extends AbstractNpcAI
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, TEXTS[getRandom(TEXTS.length)], 1500);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(TEXTS), 1500);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -95,8 +95,7 @@ public class Elpies extends Event
|
||||
|
||||
EVENT_ACTIVE = true;
|
||||
|
||||
final EventLocation[] locations = EventLocation.values();
|
||||
final EventLocation randomLoc = locations[getRandom(locations.length)];
|
||||
final EventLocation randomLoc = getRandomEntry(EventLocation.values());
|
||||
|
||||
CURRENT_ELPY_COUNT = 0;
|
||||
final long despawnDelay = EVENT_DURATION_MINUTES * 60000;
|
||||
|
@ -85,7 +85,7 @@ public class EveTheFortuneTeller extends LongTimeEvent
|
||||
}
|
||||
case "JAYCE_SHOUT":
|
||||
{
|
||||
Broadcast.toKnownPlayersInRadius(npc, new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), JAYCE_TEXT[getRandom(JAYCE_TEXT.length)]), 1000);
|
||||
Broadcast.toKnownPlayersInRadius(npc, new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(JAYCE_TEXT)), 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class FreyaCelebration extends LongTimeEvent
|
||||
}
|
||||
else if (getRandom(10) < 2)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), getRandomEntry(FREYA_TEXT)));
|
||||
}
|
||||
}
|
||||
return super.onSkillSee(npc, caster, skill, targets, isSummon);
|
||||
|
@ -216,19 +216,19 @@ public class LetterCollector extends LongTimeEvent
|
||||
{
|
||||
if (getRandom(100) < 1)
|
||||
{
|
||||
return REWARDS_TAUTI[getRandom(REWARDS_TAUTI.length)];
|
||||
return getRandomEntry(REWARDS_TAUTI);
|
||||
}
|
||||
else if (getRandom(100) < 3)
|
||||
{
|
||||
return REWARDS_SPECTER[getRandom(REWARDS_SPECTER.length)];
|
||||
return getRandomEntry(REWARDS_SPECTER);
|
||||
}
|
||||
else if (getRandom(100) < 3)
|
||||
{
|
||||
return REWARDS_SERAPH[getRandom(REWARDS_SERAPH.length)];
|
||||
return getRandomEntry(REWARDS_SERAPH);
|
||||
}
|
||||
else
|
||||
{
|
||||
return REWARDS_OTHER[getRandom(REWARDS_OTHER.length)];
|
||||
return getRandomEntry(REWARDS_OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public class AltarOfShilen extends AbstractInstance
|
||||
{
|
||||
if (getRandom(30) < 3)
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), SHOUT_MSG[getRandom(SHOUT_MSG.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(SHOUT_MSG)));
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
|
@ -180,7 +180,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
|
||||
{
|
||||
world.setStatus(1);
|
||||
world.spawnGroup("wave_1");
|
||||
final Npc questGiver = addSpawn(QUEST_GIVERS[getRandom(QUEST_GIVERS.length)], QUEST_GIVER_LOCATION, false, 0, false, world.getId());
|
||||
final Npc questGiver = addSpawn(getRandomEntry(QUEST_GIVERS), QUEST_GIVER_LOCATION, false, 0, false, world.getId());
|
||||
questGiver.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THERE_S_NO_ONE_RIGHT);
|
||||
if (questGiver.getId() == 34098) // Blacksmith Kluto
|
||||
{
|
||||
@ -202,7 +202,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
|
||||
}
|
||||
else if (getRandom(10) < 3)
|
||||
{
|
||||
addSpawn(SPY_DWARF, SPY_DWARF_LOCATION[getRandom(SPY_DWARF_LOCATION.length)], false, 0, false, world.getId());
|
||||
addSpawn(SPY_DWARF, getRandomEntry(SPY_DWARF_LOCATION), false, 0, false, world.getId());
|
||||
}
|
||||
showOnScreenMsg(world, NpcStringId.ASHEN_SHADOW_REVOLUTIONARIES_KEEP_THE_FORMATION, ExShowScreenMessage.TOP_CENTER, 10000, false);
|
||||
}
|
||||
@ -249,7 +249,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
|
||||
final int id = npc.getId();
|
||||
if (id == SIGNALMAN)
|
||||
{
|
||||
addSpawn(COMMANDERS[getRandom(COMMANDERS.length)], world.isStatus(1) ? COMMANDER_LOCATION_1 : COMMANDER_LOCATION_2, false, 0, false, world.getId());
|
||||
addSpawn(getRandomEntry(COMMANDERS), world.isStatus(1) ? COMMANDER_LOCATION_1 : COMMANDER_LOCATION_2, false, 0, false, world.getId());
|
||||
}
|
||||
else if (CommonUtil.contains(COMMANDERS, id))
|
||||
{
|
||||
@ -283,7 +283,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
|
||||
{
|
||||
if (getRandom(10) < 1)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, DWARF_SPY_TEXT[getRandom(DWARF_SPY_TEXT.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(DWARF_SPY_TEXT));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
@ -210,17 +210,17 @@ public class CastleDungeon extends AbstractInstance
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
npcId = RAIDS1[getRandom(RAIDS1.length)];
|
||||
npcId = getRandomEntry(RAIDS1);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
npcId = RAIDS2[getRandom(RAIDS2.length)];
|
||||
npcId = getRandomEntry(RAIDS2);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
npcId = RAIDS3[getRandom(RAIDS3.length)];
|
||||
npcId = getRandomEntry(RAIDS3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
}
|
||||
case "CHAT":
|
||||
{
|
||||
world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n.isScriptValue(1)).forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, DECAY_CHAT[getRandom(DECAY_CHAT.length)]));
|
||||
world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n.isScriptValue(1)).forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(DECAY_CHAT)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
}
|
||||
else
|
||||
{
|
||||
addSpawn(MONOLITH_PRIVATES[getRandom(MONOLITH_PRIVATES.length)], npc, false, 0, false, world.getId());
|
||||
addSpawn(getRandomEntry(MONOLITH_PRIVATES), npc, false, 0, false, world.getId());
|
||||
}
|
||||
world.openCloseDoor(ROOM_B_DOOR, false);
|
||||
}
|
||||
@ -264,7 +264,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
world.openCloseDoor(ROOM_D_DOOR, false);
|
||||
if (npc.isHpBlocked() && (getRandom(100) < 12))
|
||||
{
|
||||
addSpawn(BELETH_SUBORDINATE[getRandom(BELETH_SUBORDINATE.length)], npc, false, 0, false, world.getId());
|
||||
addSpawn(getRandomEntry(BELETH_SUBORDINATE), npc, false, 0, false, world.getId());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -391,7 +391,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
final List<Npc> npcs = world.spawnGroup("roomE");
|
||||
for (Npc n : npcs)
|
||||
{
|
||||
n.broadcastSay(ChatType.NPC_GENERAL, SPAWN_CHAT[getRandom(SPAWN_CHAT.length)]);
|
||||
n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SPAWN_CHAT));
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
@ -413,7 +413,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
world.setParameter("found", found);
|
||||
|
||||
npc.setScriptValue(-1);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, SUCCESS_CHAT[getRandom(SUCCESS_CHAT.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SUCCESS_CHAT));
|
||||
|
||||
if (found != 3)
|
||||
{
|
||||
@ -431,7 +431,7 @@ public class DarkCloudMansion extends AbstractInstance
|
||||
world.setParameter("blocked", true);
|
||||
world.setParameter("found", 0);
|
||||
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, FAIL_CHAT[getRandom(FAIL_CHAT.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(FAIL_CHAT));
|
||||
npc.setScriptValue(-1);
|
||||
startQuestTimer("CHAT", 4000, npc, null);
|
||||
startQuestTimer("DELETE", 4500, npc, null);
|
||||
|
@ -57,7 +57,7 @@ public class DimensionalArchon extends AbstractNpcAI
|
||||
{
|
||||
if (event.equals("NPC_SHOUT"))
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), ARCHON_MSG[getRandom(ARCHON_MSG.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(ARCHON_MSG)));
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
@ -233,17 +233,17 @@ public class FortressDungeon extends AbstractInstance
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
npcId = RAIDS1[getRandom(RAIDS1.length)];
|
||||
npcId = getRandomEntry(RAIDS1);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
npcId = RAIDS2[getRandom(RAIDS2.length)];
|
||||
npcId = getRandomEntry(RAIDS2);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
npcId = RAIDS3[getRandom(RAIDS3.length)];
|
||||
npcId = getRandomEntry(RAIDS3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
if (npcVars.getBoolean("CAN_TELEPORT", true))
|
||||
{
|
||||
npc.teleToLocation(WARP_POINT_RANDOM_LOCS[getRandom(WARP_POINT_RANDOM_LOCS.length)]);
|
||||
npc.teleToLocation(getRandomEntry(WARP_POINT_RANDOM_LOCS));
|
||||
showOnScreenMsg(instance, NpcStringId.THE_LOCATION_OF_THE_ESCAPE_DEVICE_IS_MOVED, ExShowScreenMessage.TOP_CENTER, 4000);
|
||||
|
||||
switch (npcVars.getInt("TIME_MULTIPLER", 5))
|
||||
@ -333,7 +333,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
case WARP_POINT:
|
||||
{
|
||||
npc.teleToLocation(WARP_POINT_RANDOM_LOCS[getRandom(WARP_POINT_RANDOM_LOCS.length)]);
|
||||
npc.teleToLocation(getRandomEntry(WARP_POINT_RANDOM_LOCS));
|
||||
getTimers().addTimer("CHANGE_POSITION", (60000 * npcVars.getInt("TIME_MULTIPLER", 5)), npc, null);
|
||||
break;
|
||||
}
|
||||
@ -366,7 +366,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
case 0:
|
||||
takeItems(creature.getActingPlayer(), GIANT_CANNONBALL, -1);
|
||||
creature.teleToLocation(PLAYERS_RANDOM_LOCS[getRandom(PLAYERS_RANDOM_LOCS.length)]);
|
||||
creature.teleToLocation(getRandomEntry(PLAYERS_RANDOM_LOCS));
|
||||
showOnScreenMsg(creature.getActingPlayer(), NpcStringId.YOU_NEED_TO_FIND_ESCAPE_DEVICE_RE_ENTRY_IS_NOT_ALLOWED_ONCE_YOU_VE_LEFT_THE_INSTANT_ZONE, ExShowScreenMessage.TOP_CENTER, 4000);
|
||||
instance.getParameters().increaseInt("PLAYERS_COUNT", 0, 1);
|
||||
break;
|
||||
@ -401,7 +401,7 @@ public class PrisonOfDarkness extends AbstractInstance
|
||||
{
|
||||
if ((skill == TELEPORT.getSkill()) && (player != null) && (npc.calculateDistance3D(player) < 1000) && (npc.getCurrentHpPercent() > 10))
|
||||
{
|
||||
player.teleToLocation(PLAYERS_TELEPORT_RANDOM_LOCS[getRandom(PLAYERS_TELEPORT_RANDOM_LOCS.length)]);
|
||||
player.teleToLocation(getRandomEntry(PLAYERS_TELEPORT_RANDOM_LOCS));
|
||||
}
|
||||
}
|
||||
return super.onSpellFinished(npc, player, skill);
|
||||
|
@ -89,7 +89,7 @@ public class SSQLibraryOfSages extends AbstractInstance
|
||||
{
|
||||
npc.setRunning();
|
||||
npc.getAI().startFollow(player);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ELCADIA_DIALOGS));
|
||||
startQuestTimer("FOLLOW", 10000, npc, player);
|
||||
break;
|
||||
}
|
||||
|
@ -199,18 +199,18 @@ public class SSQMonasteryOfSilence extends AbstractInstance
|
||||
if (player.isInCombat())
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_GUARDIAN_OF_THE_SEAL_DOESN_T_SEEM_TO_GET_INJURED_AT_ALL_UNTIL_THE_BARRIER_IS_DESTROYED);
|
||||
SkillCaster.triggerCast(npc, player, BUFFS[getRandom(BUFFS.length)].getSkill());
|
||||
SkillCaster.triggerCast(npc, player, getRandomEntry(BUFFS).getSkill());
|
||||
}
|
||||
else
|
||||
{
|
||||
final QuestState qs = player.getQuestState(Q10295_SevenSignsSolinasTomb.class.getSimpleName());
|
||||
if ((qs != null) && (qs.getCond() < 2) && !qs.isCompleted())
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ELCADIA_DIALOGS2[getRandom(ELCADIA_DIALOGS2.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ELCADIA_DIALOGS2));
|
||||
}
|
||||
else if (qs == null)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ELCADIA_DIALOGS));
|
||||
}
|
||||
}
|
||||
startQuestTimer("FOLLOW", 10000, npc, player);
|
||||
|
@ -163,7 +163,7 @@ public class TaintedDimension extends AbstractInstance
|
||||
}
|
||||
case "MONSTER_SAY":
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, MONSTER_SAY[getRandom(MONSTER_SAY.length)]);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(MONSTER_SAY));
|
||||
break;
|
||||
}
|
||||
case "HUMAN_1_SAY":
|
||||
|
@ -327,15 +327,15 @@ public class Q00456_DontKnowDontCare extends Quest
|
||||
|
||||
if (chance < 170)
|
||||
{
|
||||
reward = ARMOR[getRandom(ARMOR.length)];
|
||||
reward = getRandomEntry(ARMOR);
|
||||
}
|
||||
else if (chance < 200)
|
||||
{
|
||||
reward = ACCESSORIES[getRandom(ACCESSORIES.length)];
|
||||
reward = getRandomEntry(ACCESSORIES);
|
||||
}
|
||||
else if (chance < 270)
|
||||
{
|
||||
reward = WEAPONS[getRandom(WEAPONS.length)];
|
||||
reward = getRandomEntry(WEAPONS);
|
||||
}
|
||||
else if (chance < 325)
|
||||
{
|
||||
@ -347,7 +347,7 @@ public class Q00456_DontKnowDontCare extends Quest
|
||||
}
|
||||
else if (chance < 925)
|
||||
{
|
||||
reward = ATTRIBUTE_CRYSTALS[getRandom(ATTRIBUTE_CRYSTALS.length)];
|
||||
reward = getRandomEntry(ATTRIBUTE_CRYSTALS);
|
||||
}
|
||||
else if (chance < 1100)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ public class Q00617_GatherTheFlames extends Quest
|
||||
{
|
||||
return getNoQuestMsg(player);
|
||||
}
|
||||
giveItems(player, REWARD[getRandom(REWARD.length)], 1);
|
||||
giveItems(player, getRandomEntry(REWARD), 1);
|
||||
takeItems(player, TORCH, 1000);
|
||||
break;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user