Make use of script random methods.
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package ai.areas.DragonValley.Fellow;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -71,7 +70,7 @@ public class Fellow extends AbstractNpcAI
|
||||
}
|
||||
case "CHAT_TIMER":
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, TEXT[Rnd.get(TEXT.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, TEXT[getRandom(TEXT.length)]));
|
||||
startQuestTimer("CHAT_TIMER", 30000, npc, null);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package ai.areas.TowerOfInsolence.Arushinai;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.HeavenlyRiftManager;
|
||||
import org.l2jmobius.gameserver.model.Party;
|
||||
@@ -80,7 +79,7 @@ public class Arushinai extends AbstractNpcAI
|
||||
return null; // TODO: Find html?
|
||||
}
|
||||
|
||||
final int riftLevel = Rnd.get(1, 3);
|
||||
final int riftLevel = getRandom(1, 3);
|
||||
GlobalVariablesManager.getInstance().set("heavenly_rift_level", riftLevel);
|
||||
GlobalVariablesManager.getInstance().set("heavenly_rift_complete", 4);
|
||||
switch (riftLevel)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package ai.areas.TowerOfInsolence.Ateld;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -71,7 +70,7 @@ public class Ateld extends AbstractNpcAI
|
||||
}
|
||||
case "CHAT_TIMER":
|
||||
{
|
||||
npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, TEXT[Rnd.get(TEXT.length)]));
|
||||
npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, TEXT[getRandom(TEXT.length)]));
|
||||
startQuestTimer("CHAT_TIMER", 30000, npc, null);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.SpawnData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.ChanceLocation;
|
||||
@@ -150,7 +149,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
|
||||
@Override
|
||||
public String onKill(Npc npc, Player killer, boolean isSummon)
|
||||
{
|
||||
if (CommonUtil.contains(UNIDENTIFIED_STONE_NPC_IDS, npc.getId()) && ((killer.getLevel() - npc.getLevel()) <= LEVEL_MAX_DIFF) && (Rnd.get(100) <= UNIDENTIFIED_STONE_DROP_RATE))
|
||||
if (CommonUtil.contains(UNIDENTIFIED_STONE_NPC_IDS, npc.getId()) && ((killer.getLevel() - npc.getLevel()) <= LEVEL_MAX_DIFF) && (getRandom(100) <= UNIDENTIFIED_STONE_DROP_RATE))
|
||||
{
|
||||
npc.dropItem(killer, UNIDENTIFIED_STONE_ITEM_ID, ENERGY_OF_INSOLENCE_DROP_COUNT);
|
||||
}
|
||||
@@ -171,7 +170,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
|
||||
_scheduleTaskAmon = ThreadPool.schedule(new ScheduleAITask(null, POWER_ANGEL_AMON), TIME_UNTIL_MOVE);
|
||||
}
|
||||
}
|
||||
if (((killer.getLevel() - npc.getLevel()) <= LEVEL_MAX_DIFF) && (Rnd.get(100) <= ENERGY_OF_INSOLENCE_DROP_RATE))
|
||||
if (((killer.getLevel() - npc.getLevel()) <= LEVEL_MAX_DIFF) && (getRandom(100) <= ENERGY_OF_INSOLENCE_DROP_RATE))
|
||||
{
|
||||
npc.dropItem(killer, ENERGY_OF_INSOLENCE_ITEM_ID, ENERGY_OF_INSOLENCE_DROP_COUNT);
|
||||
}
|
||||
@@ -216,7 +215,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
|
||||
final Spawn spawn = new Spawn(_npcId);
|
||||
final List<NpcSpawnTemplate> spawns = SpawnData.getInstance().getNpcSpawns(npcSpawnTemplate -> npcSpawnTemplate.getId() == _npcId);
|
||||
final List<ChanceLocation> locations = spawns.get(0).getLocation();
|
||||
final Location location = locations.get(Rnd.get(locations.size()));
|
||||
final Location location = locations.get(getRandom(locations.size()));
|
||||
spawn.setLocation(location);
|
||||
spawn.doSpawn();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package ai.areas.TowerOfInsolence.HeavenlyRift;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.HeavenlyRiftManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@@ -66,7 +65,7 @@ public class Bomb extends AbstractNpcAI
|
||||
@Override
|
||||
public String onKill(Npc npc, Player killer, boolean isSummon)
|
||||
{
|
||||
if (Rnd.get(100) < 33)
|
||||
if (getRandom(100) < 33)
|
||||
{
|
||||
AbstractScript.addSpawn(DIVINE_ANGEL, npc, false, 1800000);
|
||||
}
|
||||
@@ -76,18 +75,18 @@ public class Bomb extends AbstractNpcAI
|
||||
{
|
||||
if ((creature != null) && !creature.isDead())
|
||||
{
|
||||
creature.reduceCurrentHp(Rnd.get(300, 400), npc, null);
|
||||
creature.reduceCurrentHp(getRandom(300, 400), npc, null);
|
||||
}
|
||||
});
|
||||
if (Rnd.get(100) < 50)
|
||||
if (getRandom(100) < 50)
|
||||
{
|
||||
if (Rnd.get(100) < 90)
|
||||
if (getRandom(100) < 90)
|
||||
{
|
||||
npc.dropItem(killer.getActingPlayer(), ITEM_DROP_1[Rnd.get(ITEM_DROP_1.length)], 1);
|
||||
npc.dropItem(killer.getActingPlayer(), ITEM_DROP_1[getRandom(ITEM_DROP_1.length)], 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.dropItem(killer.getActingPlayer(), ITEM_DROP_2[Rnd.get(ITEM_DROP_2.length)], 1);
|
||||
npc.dropItem(killer.getActingPlayer(), ITEM_DROP_2[getRandom(ITEM_DROP_2.length)], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.MultisellData;
|
||||
import org.l2jmobius.gameserver.enums.CategoryType;
|
||||
import org.l2jmobius.gameserver.handler.BypassHandler;
|
||||
@@ -316,7 +315,7 @@ public class OlyManager extends AbstractNpcAI implements IBypassHandler
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Zone: " + nextArena.getStadium().getZone() + " doesn't have specatator spawns defined!");
|
||||
return false;
|
||||
}
|
||||
final Location loc = spectatorSpawns.get(Rnd.get(spectatorSpawns.size()));
|
||||
final Location loc = spectatorSpawns.get(getRandom(spectatorSpawns.size()));
|
||||
player.enterOlympiadObserverMode(loc, arenaId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package custom.listeners;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
@@ -126,7 +125,7 @@ public class ListenerTest extends AbstractNpcAI
|
||||
private void OnCreatureKill(OnCreatureDeath event)
|
||||
{
|
||||
// 70% chance to drop
|
||||
if (Rnd.get(100) >= 70)
|
||||
if (getRandom(100) >= 70)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -135,7 +134,7 @@ public class ListenerTest extends AbstractNpcAI
|
||||
if ((event.getAttacker() != null) && event.getAttacker().isPlayable() && event.getTarget().isAttackable())
|
||||
{
|
||||
final Attackable monster = (Attackable) event.getTarget();
|
||||
monster.dropItem(event.getAttacker().getActingPlayer(), new ItemHolder(57, Rnd.get(100, 1000)));
|
||||
monster.dropItem(event.getAttacker().getActingPlayer(), new ItemHolder(57, getRandom(100, 1000)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ package events.MerrySquashmas;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
@@ -583,7 +582,7 @@ public class MerrySquashmas extends LongTimeEvent
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Rnd.get(100) < drop[2])
|
||||
if (getRandom(100) < drop[2])
|
||||
{
|
||||
if (ItemTable.getInstance().getTemplate(drop[1]).getCrystalType() != CrystalType.NONE)
|
||||
{
|
||||
@@ -602,7 +601,7 @@ public class MerrySquashmas extends LongTimeEvent
|
||||
|
||||
private void randomSpawn(int low, int medium, int high, Npc npc)
|
||||
{
|
||||
final int _random = Rnd.get(100);
|
||||
final int _random = getRandom(100);
|
||||
if (_random < 5)
|
||||
{
|
||||
spawnNext(low, npc);
|
||||
@@ -623,25 +622,25 @@ public class MerrySquashmas extends LongTimeEvent
|
||||
|
||||
private void ChronoText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
if (getRandom(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[getRandom(_CHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
private void noChronoText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
if (getRandom(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[getRandom(_NOCHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
private void nectarText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 30)
|
||||
if (getRandom(100) < 30)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[getRandom(_NECTAR_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ package events.SquashEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
@@ -582,7 +581,7 @@ public class SquashEvent extends LongTimeEvent
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Rnd.get(100) < drop[2])
|
||||
if (getRandom(100) < drop[2])
|
||||
{
|
||||
if (ItemTable.getInstance().getTemplate(drop[1]).getCrystalType() != CrystalType.NONE)
|
||||
{
|
||||
@@ -601,7 +600,7 @@ public class SquashEvent extends LongTimeEvent
|
||||
|
||||
private void randomSpawn(int low, int medium, int high, Npc npc)
|
||||
{
|
||||
final int _random = Rnd.get(100);
|
||||
final int _random = getRandom(100);
|
||||
if (_random < 5)
|
||||
{
|
||||
spawnNext(low, npc);
|
||||
@@ -622,25 +621,25 @@ public class SquashEvent extends LongTimeEvent
|
||||
|
||||
private void ChronoText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
if (getRandom(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[getRandom(_CHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
private void noChronoText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
if (getRandom(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[getRandom(_NOCHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
private void nectarText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 30)
|
||||
if (getRandom(100) < 30)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[getRandom(_NECTAR_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ package events.WatermelonNinja;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -572,7 +571,7 @@ public class WatermelonNinja extends LongTimeEvent
|
||||
private void dropItem(Npc mob, Player player)
|
||||
{
|
||||
final int npcId = mob.getId();
|
||||
final int chance = Rnd.get(100);
|
||||
final int chance = getRandom(100);
|
||||
for (int[] drop : DROPLIST)
|
||||
{
|
||||
if ((npcId == drop[0]) && (chance < drop[2]))
|
||||
@@ -589,7 +588,7 @@ public class WatermelonNinja extends LongTimeEvent
|
||||
|
||||
private void randomSpawn(int low, int medium, int high, Npc npc)
|
||||
{
|
||||
final int random = Rnd.get(100);
|
||||
final int random = getRandom(100);
|
||||
if (random < 5)
|
||||
{
|
||||
spawnNext(low, npc);
|
||||
@@ -610,25 +609,25 @@ public class WatermelonNinja extends LongTimeEvent
|
||||
|
||||
private void ChronoText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
if (getRandom(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[getRandom(_CHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
private void noChronoText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
if (getRandom(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[getRandom(_NOCHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
private void nectarText(Npc npc)
|
||||
{
|
||||
if (Rnd.get(100) < 30)
|
||||
if (getRandom(100) < 30)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[getRandom(_NECTAR_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user