Prohibit the use of duplicate Rnd methods.

This commit is contained in:
MobiusDev
2018-09-14 01:17:54 +00:00
parent 16ad1d2b48
commit b4e8040541
233 changed files with 596 additions and 594 deletions

View File

@@ -557,8 +557,8 @@ public class L2AttackableAI extends L2CharacterAI
int y1;
int z1;
x1 = (((L2MinionInstance) _actor).getLeader().getX() + Rnd.nextInt((offset - 30) * 2)) - (offset - 30);
y1 = (((L2MinionInstance) _actor).getLeader().getY() + Rnd.nextInt((offset - 30) * 2)) - (offset - 30);
x1 = (((L2MinionInstance) _actor).getLeader().getX() + Rnd.get((offset - 30) * 2)) - (offset - 30);
y1 = (((L2MinionInstance) _actor).getLeader().getY() + Rnd.get((offset - 30) * 2)) - (offset - 30);
z1 = ((L2MinionInstance) _actor).getLeader().getZ();
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
moveTo(x1, y1, z1);
@@ -566,7 +566,7 @@ public class L2AttackableAI extends L2CharacterAI
}
}
// Order to the L2MonsterInstance to random walk (1/100)
else if (!(npc instanceof L2ChestInstance) && (npc.getSpawn() != null) && (Rnd.nextInt(RANDOM_WALK_RATE) == 0))
else if (!(npc instanceof L2ChestInstance) && (npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0))
{
int x1;
int y1;
@@ -610,8 +610,8 @@ public class L2AttackableAI extends L2CharacterAI
}
// If NPC with fixed coord
x1 = (npc.getSpawn().getX() + Rnd.nextInt(Config.MAX_DRIFT_RANGE * 2)) - Config.MAX_DRIFT_RANGE;
y1 = (npc.getSpawn().getY() + Rnd.nextInt(Config.MAX_DRIFT_RANGE * 2)) - Config.MAX_DRIFT_RANGE;
x1 = (npc.getSpawn().getX() + Rnd.get(Config.MAX_DRIFT_RANGE * 2)) - Config.MAX_DRIFT_RANGE;
y1 = (npc.getSpawn().getY() + Rnd.get(Config.MAX_DRIFT_RANGE * 2)) - Config.MAX_DRIFT_RANGE;
z1 = npc.getZ();
}
@@ -772,7 +772,7 @@ public class L2AttackableAI extends L2CharacterAI
// Note from Gnacik:
// On l2js because of that sometimes mobs don't attack player only running
// around player without any sense, so decrease chance for now
if (!_actor.isMovementDisabled() && (Rnd.nextInt(100) <= 3))
if (!_actor.isMovementDisabled() && (Rnd.get(100) <= 3))
{
for (L2Object nearby : _actor.getKnownList().getKnownObjects().values())
{
@@ -879,7 +879,7 @@ public class L2AttackableAI extends L2CharacterAI
if (dist2 > (range * range))
{
// check for long ranged skills and heal/buff skills
if (!_actor.isMuted() && (!Config.ALT_GAME_MOB_ATTACK_AI || ((_actor instanceof L2MonsterInstance) && (Rnd.nextInt(100) <= 5))))
if (!_actor.isMuted() && (!Config.ALT_GAME_MOB_ATTACK_AI || ((_actor instanceof L2MonsterInstance) && (Rnd.get(100) <= 5))))
{
for (L2Skill sk : skills)
{
@@ -891,7 +891,7 @@ public class L2AttackableAI extends L2CharacterAI
_inRange = true;
}
if (((sk.getSkillType() == L2Skill.SkillType.BUFF) || (sk.getSkillType() == L2Skill.SkillType.HEAL) || _inRange) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive() && (Rnd.nextInt(100) <= 5))
if (((sk.getSkillType() == L2Skill.SkillType.BUFF) || (sk.getSkillType() == L2Skill.SkillType.HEAL) || _inRange) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive() && (Rnd.get(100) <= 5))
{
if ((sk.getSkillType() == L2Skill.SkillType.BUFF) || (sk.getSkillType() == L2Skill.SkillType.HEAL))
{
@@ -959,7 +959,7 @@ public class L2AttackableAI extends L2CharacterAI
for (L2Skill sk : skills)
{
if (/* sk.getCastRange() >= dist && sk.getCastRange() <= 70 && */!sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk) && ((Rnd.nextInt(100) <= 8) || ((_actor instanceof L2PenaltyMonsterInstance) && (Rnd.nextInt(100) <= 20))))
if (/* sk.getCastRange() >= dist && sk.getCastRange() <= 70 && */!sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk) && ((Rnd.get(100) <= 8) || ((_actor instanceof L2PenaltyMonsterInstance) && (Rnd.get(100) <= 20))))
{
if ((sk.getSkillType() == L2Skill.SkillType.BUFF) || (sk.getSkillType() == L2Skill.SkillType.HEAL))
{

View File

@@ -63,10 +63,10 @@ public class L2ControllableMobAI extends L2AttackableAI
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = Rnd.nextInt(2) == 0 ? -1 : 1;
final int signY = Rnd.nextInt(2) == 0 ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = Rnd.get(2) == 0 ? -1 : 1;
final int signY = Rnd.get(2) == 0 ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@@ -344,7 +344,7 @@ public class L2ControllableMobAI extends L2AttackableAI
setAttackTarget(hated);
}
if (!_actor.isMuted() && (skills.length > 0) && (Rnd.nextInt(5) == 3))
if (!_actor.isMuted() && (skills.length > 0) && (Rnd.get(5) == 3))
{
for (L2Skill sk : skills)
{
@@ -476,7 +476,7 @@ public class L2ControllableMobAI extends L2AttackableAI
}
// we choose a random target
final int choice = Rnd.nextInt(potentialTarget.size());
final int choice = Rnd.get(potentialTarget.size());
final L2Character target = potentialTarget.get(choice);

View File

@@ -802,7 +802,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
// check for close combat skills && heal/buff skills
if (!_actor.isMuted() && (Rnd.nextInt(100) <= 5))
if (!_actor.isMuted() && (Rnd.get(100) <= 5))
{
for (L2Skill sk : skills)
{

View File

@@ -374,7 +374,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
if (!_actor.isMuted() && (dist_2 > ((range + 20) * (range + 20))))
{
// check for long ranged skills and heal/buff skills
if (!Config.ALT_GAME_MOB_ATTACK_AI || ((_actor instanceof L2MonsterInstance) && (Rnd.nextInt(100) <= 5)))
if (!Config.ALT_GAME_MOB_ATTACK_AI || ((_actor instanceof L2MonsterInstance) && (Rnd.get(100) <= 5)))
{
for (L2Skill sk : skills)
{
@@ -500,7 +500,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
// check for close combat skills && heal/buff skills
if (!_actor.isMuted() && (Rnd.nextInt(100) <= 5))
if (!_actor.isMuted() && (Rnd.get(100) <= 5))
{
for (L2Skill sk : skills)
{

View File

@@ -759,7 +759,7 @@ public class AutoChatHandler implements SpawnListener
}
final int maxIndex = chatDef.getChatTexts().length;
int lastIndex = Rnd.nextInt(maxIndex);
int lastIndex = Rnd.get(maxIndex);
String creatureName = chatNpc.getName();
String text;
@@ -786,7 +786,7 @@ public class AutoChatHandler implements SpawnListener
if (!nearbyPlayers.isEmpty())
{
final int randomPlayerIndex = Rnd.nextInt(nearbyPlayers.size());
final int randomPlayerIndex = Rnd.get(nearbyPlayers.size());
L2PcInstance randomPlayer = nearbyPlayers.get(randomPlayerIndex);

View File

@@ -182,7 +182,7 @@ public class Harvest implements ISkillHandler
basicSuccess = 1;
}
final int rate = Rnd.nextInt(99);
final int rate = Rnd.get(99);
if (rate < basicSuccess)
{

View File

@@ -185,7 +185,7 @@ public class Sow implements ISkillHandler
basicSuccess = 1;
}
final int rate = Rnd.nextInt(99);
final int rate = Rnd.get(99);
return (rate < basicSuccess);
}

View File

@@ -158,7 +158,7 @@ public class L2Territory
if (_procMax > 0)
{
int pos = 0;
final int rnd = Rnd.nextInt(_procMax);
final int rnd = Rnd.get(_procMax);
for (i = 0; i < _points.length; i++)
{
final Point p1 = _points[i];

View File

@@ -149,10 +149,10 @@ public final class MobGroup
{
L2GroupSpawn spawn = new L2GroupSpawn(_npcTemplate);
final int signX = Rnd.nextInt(2) == 0 ? -1 : 1;
final int signY = Rnd.nextInt(2) == 0 ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = Rnd.get(2) == 0 ? -1 : 1;
final int signY = Rnd.get(2) == 0 ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
spawn.setX(x + (signX * randX));
spawn.setY(y + (signY * randY));
@@ -191,8 +191,8 @@ public final class MobGroup
if (!mobInst.isDead())
{
final int x = player.getX() + Rnd.nextInt(50);
final int y = player.getY() + Rnd.nextInt(50);
final int x = player.getX() + Rnd.get(50);
final int y = player.getY() + Rnd.get(50);
mobInst.teleToLocation(x, y, player.getZ(), true);
L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
@@ -210,7 +210,7 @@ public final class MobGroup
return null;
}
final int choice = Rnd.nextInt(getMobs().size());
final int choice = Rnd.get(getMobs().size());
return getMobs().get(choice);
}
@@ -324,10 +324,10 @@ public final class MobGroup
continue;
}
final int signX = Rnd.nextInt(2) == 0 ? -1 : 1;
final int signY = Rnd.nextInt(2) == 0 ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int signX = Rnd.get(2) == 0 ? -1 : 1;
final int signY = Rnd.get(2) == 0 ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.get(MobGroupTable.RANDOM_RANGE);
L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
ai.move(activeChar.getX() + (signX * randX), activeChar.getY() + (signY * randY), activeChar.getZ());

View File

@@ -93,7 +93,7 @@ public final class L2GuardInstance extends L2Attackable
super(objectId, template);
getKnownList(); // init knownlist
ThreadPool.scheduleAtFixedRate(new ReturnTask(), RETURN_INTERVAL, RETURN_INTERVAL + Rnd.nextInt(60000));
ThreadPool.scheduleAtFixedRate(new ReturnTask(), RETURN_INTERVAL, RETURN_INTERVAL + Rnd.get(60000));
}
/*
@@ -290,7 +290,7 @@ public final class L2GuardInstance extends L2Attackable
{
// Send a Server->Client packet SocialAction to the all L2PcInstance on the _knownPlayer of the L2NpcInstance
// to display a social action of the L2GuardInstance on their client
SocialAction sa = new SocialAction(getObjectId(), Rnd.nextInt(8));
SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
broadcastPacket(sa);
// Open a chat window on client with the text of the L2GuardInstance

View File

@@ -91,7 +91,7 @@ public final class L2GuardNoHTMLInstance extends L2Attackable
{
super(objectId, template);
getKnownList(); // init knownlist
ThreadPool.scheduleAtFixedRate(new ReturnTask(), RETURN_INTERVAL, RETURN_INTERVAL + Rnd.nextInt(60000));
ThreadPool.scheduleAtFixedRate(new ReturnTask(), RETURN_INTERVAL, RETURN_INTERVAL + Rnd.get(60000));
}
/*

View File

@@ -204,13 +204,13 @@ public class L2MonsterInstance extends L2Attackable
final int masterZ = getZ();
// Calculate a new random coord for the minion based on the master's coord
int minionX = (masterX + Rnd.nextInt(401)) - 200;
int minionY = (masterY + Rnd.nextInt(401)) - 200;
int minionX = (masterX + Rnd.get(401)) - 200;
int minionY = (masterY + Rnd.get(401)) - 200;
final int minionZ = masterZ;
while (((minionX != (masterX + 30)) && (minionX != (masterX - 30))) || ((minionY != (masterY + 30)) && (minionY != (masterY - 30))))
{
minionX = (masterX + Rnd.nextInt(401)) - 200;
minionY = (masterY + Rnd.nextInt(401)) - 200;
minionX = (masterX + Rnd.get(401)) - 200;
minionY = (masterY + Rnd.get(401)) - 200;
}
// Move the minion to the new coords

View File

@@ -56,7 +56,7 @@ public class L2PenaltyMonsterInstance extends L2MonsterInstance
public void setPlayerToKill(L2PcInstance ptk)
{
if (Rnd.nextInt(100) <= 80)
if (Rnd.get(100) <= 80)
{
CreatureSay cs = new CreatureSay(getObjectId(), Say2.ALL, getName(), "mmm your bait was delicious");
broadcastPacket(cs);
@@ -75,7 +75,7 @@ public class L2PenaltyMonsterInstance extends L2MonsterInstance
return false;
}
if (Rnd.nextInt(100) <= 75)
if (Rnd.get(100) <= 75)
{
CreatureSay cs = new CreatureSay(getObjectId(), Say2.ALL, getName(), "I will tell fishes not to take your bait");
broadcastPacket(cs);

View File

@@ -199,7 +199,7 @@ public class L2SiegeGuardInstance extends L2Attackable
}
else
{
SocialAction sa = new SocialAction(getObjectId(), Rnd.nextInt(8));
SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
broadcastPacket(sa);
sendPacket(sa);
showChatWindow(player, 0);

View File

@@ -48,7 +48,7 @@ public class L2XmassTreeInstance extends L2NpcInstance
{
for (L2PcInstance player : getKnownList().getKnownPlayers().values())
{
final int i = Rnd.nextInt(3);
final int i = Rnd.get(3);
handleCast(player, (4262 + i));
}
}

View File

@@ -68,14 +68,14 @@ public class CTF implements EventTask
/** The _joining location name. */
protected static String _eventName = new String();
/**
* The _joining location name.
* The _joining location name.
*/
protected static String _eventDesc = new String();
/**
* The _joining location name.
* The _joining location name.
*/
protected static String _joiningLocationName = new String();
@@ -84,92 +84,92 @@ public class CTF implements EventTask
/** The _in progress. */
protected static boolean _joining = false;
/**
* The _in progress.
* The _in progress.
*/
protected static boolean _teleport = false;
/**
* The _in progress.
* The _in progress.
*/
protected static boolean _started = false;
/**
* The _in progress.
* The _in progress.
*/
protected static boolean _aborted = false;
/**
* The _in progress.
* The _in progress.
*/
protected static boolean _sitForced = false;
/**
* The _in progress.
* The _in progress.
*/
protected static boolean _inProgress = false;
/** The _max players. */
protected static int _npcId = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _npcX = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _npcY = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _npcZ = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _npcHeading = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _rewardId = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _rewardAmount = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _minlvl = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _maxlvl = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _joinTime = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _eventTime = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _minPlayers = 0;
/**
* The _max players.
* The _max players.
*/
protected static int _maxPlayers = 0;
@@ -193,37 +193,37 @@ public class CTF implements EventTask
/** The _save player teams. */
public static Vector<String> _teams = new Vector<>();
/**
* The _save player teams.
* The _save player teams.
*/
public static Vector<String> _savePlayers = new Vector<>();
/**
* The _save player teams.
* The _save player teams.
*/
public static Vector<String> _savePlayerTeams = new Vector<>();
/** The _teams z. */
public static Vector<Integer> _teamPlayersCount = new Vector<>();
/**
* The _teams z.
* The _teams z.
*/
public static Vector<Integer> _teamColors = new Vector<>();
/**
* The _teams z.
* The _teams z.
*/
public static Vector<Integer> _teamsX = new Vector<>();
/**
* The _teams z.
* The _teams z.
*/
public static Vector<Integer> _teamsY = new Vector<>();
/**
* The _teams z.
* The _teams z.
*/
public static Vector<Integer> _teamsZ = new Vector<>();
@@ -235,53 +235,53 @@ public class CTF implements EventTask
/** The _event offset. */
public static int _eventCenterX = 0;
/**
* The _event offset.
* The _event offset.
*/
public static int _eventCenterY = 0;
/**
* The _event offset.
* The _event offset.
*/
public static int _eventCenterZ = 0;
/**
* The _event offset.
* The _event offset.
*/
public static int _eventOffset = 0;
/** The _ fla g_ i n_ han d_ ite m_ id. */
private static int _FlagNPC = 35062;
/**
* The _ fla g_ i n_ han d_ ite m_ id.
* The _ fla g_ i n_ han d_ ite m_ id.
*/
private static int _FLAG_IN_HAND_ITEM_ID = 6718;
/** The _flags z. */
public static Vector<Integer> _flagIds = new Vector<>();
/**
* The _flags z.
* The _flags z.
*/
public static Vector<Integer> _flagsX = new Vector<>();
/**
* The _flags z.
* The _flags z.
*/
public static Vector<Integer> _flagsY = new Vector<>();
/**
* The _flags z.
* The _flags z.
*/
public static Vector<Integer> _flagsZ = new Vector<>();
/** The _throne spawns. */
public static Vector<L2Spawn> _flagSpawns = new Vector<>();
/**
* The _throne spawns.
* The _throne spawns.
*/
public static Vector<L2Spawn> _throneSpawns = new Vector<>();
@@ -2530,7 +2530,7 @@ public class CTF implements EventTask
break;
}
final int playerToAddIndex = Rnd.nextInt(_playersShuffle.size());
final int playerToAddIndex = Rnd.get(_playersShuffle.size());
L2PcInstance player = null;
player = _playersShuffle.get(playerToAddIndex);

View File

@@ -2240,7 +2240,7 @@ public class TvT implements EventTask
break;
}
final int playerToAddIndex = Rnd.nextInt(_playersShuffle.size());
final int playerToAddIndex = Rnd.get(_playersShuffle.size());
L2PcInstance player = null;
player = _playersShuffle.get(playerToAddIndex);

View File

@@ -387,7 +387,7 @@ class OlympiadManager implements Runnable
return null;
}
return list.get(classList.get(Rnd.nextInt(classList.size())));
return list.get(classList.get(Rnd.get(classList.size())));
}
protected List<L2PcInstance> nextOpponents(List<L2PcInstance> list)
@@ -407,11 +407,11 @@ class OlympiadManager implements Runnable
return opponents;
}
first = Rnd.nextInt(list.size());
first = Rnd.get(list.size());
opponents.add(list.get(first));
list.remove(first);
second = Rnd.nextInt(list.size());
second = Rnd.get(list.size());
opponents.add(list.get(second));
list.remove(second);

View File

@@ -4750,17 +4750,17 @@ public class SevenSignsFestival implements SpawnListener
int x = _startLocation._x;
int y = _startLocation._y;
isPositive = Rnd.nextInt(2) == 1;
isPositive = Rnd.get(2) == 1;
if (isPositive)
{
x += Rnd.nextInt(FESTIVAL_MAX_OFFSET_X);
y += Rnd.nextInt(FESTIVAL_MAX_OFFSET_Y);
x += Rnd.get(FESTIVAL_MAX_OFFSET_X);
y += Rnd.get(FESTIVAL_MAX_OFFSET_Y);
}
else
{
x -= Rnd.nextInt(FESTIVAL_MAX_OFFSET_X);
y -= Rnd.nextInt(FESTIVAL_MAX_OFFSET_Y);
x -= Rnd.get(FESTIVAL_MAX_OFFSET_X);
y -= Rnd.get(FESTIVAL_MAX_OFFSET_Y);
}
participant.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
@@ -4871,20 +4871,20 @@ public class SevenSignsFestival implements SpawnListener
/*
* Random X and Y coords around the player start location, up to half of the maximum allowed offset are generated to prevent the mobs from all moving to the exact same place.
*/
isPositive = Rnd.nextInt(2) == 1;
isPositive = Rnd.get(2) == 1;
if (isPositive)
{
x += Rnd.nextInt(FESTIVAL_MAX_OFFSET_X);
y += Rnd.nextInt(FESTIVAL_MAX_OFFSET_Y);
x += Rnd.get(FESTIVAL_MAX_OFFSET_X);
y += Rnd.get(FESTIVAL_MAX_OFFSET_Y);
}
else
{
x -= Rnd.nextInt(FESTIVAL_MAX_OFFSET_X);
y -= Rnd.nextInt(FESTIVAL_MAX_OFFSET_Y);
x -= Rnd.get(FESTIVAL_MAX_OFFSET_X);
y -= Rnd.get(FESTIVAL_MAX_OFFSET_Y);
}
Location moveTo = new Location(x, y, _startLocation._z, Rnd.nextInt(65536));
Location moveTo = new Location(x, y, _startLocation._z, Rnd.get(65536));
festivalMob.setRunning();
festivalMob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, moveTo);
@@ -4953,7 +4953,7 @@ public class SevenSignsFestival implements SpawnListener
npcSpawn.setX(currSpawn._x);
npcSpawn.setY(currSpawn._y);
npcSpawn.setZ(currSpawn._z);
npcSpawn.setHeading(Rnd.nextInt(65536));
npcSpawn.setHeading(Rnd.get(65536));
npcSpawn.setAmount(1);
npcSpawn.setRespawnDelay(respawnDelay);
@@ -5166,7 +5166,7 @@ public class SevenSignsFestival implements SpawnListener
_z = z;
// Generate a random heading if no positive one given.
_heading = heading < 0 ? Rnd.nextInt(65536) : heading;
_heading = heading < 0 ? Rnd.get(65536) : heading;
_npcId = -1;
}
@@ -5181,7 +5181,7 @@ public class SevenSignsFestival implements SpawnListener
_y = spawnData[1];
_z = spawnData[2];
_heading = spawnData[3] < 0 ? Rnd.nextInt(65536) : spawnData[3];
_heading = spawnData[3] < 0 ? Rnd.get(65536) : spawnData[3];
if (spawnData.length > 4)
{

View File

@@ -1627,7 +1627,8 @@ public class Quest extends ManagedScript
}
// Return random candidate.
return Rnd.get(getPartyMembers(player, npc, var, value));
final List<L2PcInstance> members = getPartyMembers(player, npc, var, value);
return members.get(Rnd.get(members.size()));
}
/**
@@ -1749,7 +1750,8 @@ public class Quest extends ManagedScript
}
// Return random candidate.
return Rnd.get(getPartyMembersState(player, npc, state));
final List<L2PcInstance> members = getPartyMembersState(player, npc, state);
return members.get(Rnd.get(members.size()));
}
/**

View File

@@ -506,7 +506,7 @@ public class AutoSpawn
}
final int locationCount = locationList.length;
int locationIndex = Rnd.nextInt(locationCount);
int locationIndex = Rnd.get(locationCount);
/*
* If random spawning is disabled, the spawn at the next set of co-ordinates after the last. If the index is greater than the number of possible spawns, reset the counter to zero.
@@ -578,7 +578,7 @@ public class AutoSpawn
// To prevent spawning of more than one NPC in the exact
// same spot,
// move it slightly by a small random offset.
npcInst.setXYZ(npcInst.getX() + Rnd.nextInt(50), npcInst.getY() + Rnd.nextInt(50), npcInst.getZ());
npcInst.setXYZ(npcInst.getX() + Rnd.get(50), npcInst.getY() + Rnd.get(50), npcInst.getZ());
// Add the NPC instance to the list of managed
// instances.

View File

@@ -94,7 +94,7 @@ public class L2GroupSpawn extends L2Spawn
if (getHeading() == -1)
{
mob.setHeading(Rnd.nextInt(61794));
mob.setHeading(Rnd.get(61794));
}
else
{

View File

@@ -579,7 +579,7 @@ public class L2Spawn
// Set the heading of the L2NpcInstance (random heading if not defined)
if (_heading == -1)
{
mob.setHeading(Rnd.nextInt(61794));
mob.setHeading(Rnd.get(61794));
}
else
{

View File

@@ -84,7 +84,7 @@ final class EffectConfuseMob extends L2Effect
}
// Choosing randomly a new target
final int nextTargetIdx = Rnd.nextInt(targetList.size());
final int nextTargetIdx = Rnd.get(targetList.size());
final L2Object target = targetList.get(nextTargetIdx);
// Attacking the target

View File

@@ -83,7 +83,7 @@ final class EffectConfusion extends L2Effect
}
// Choosing randomly a new target
final int nextTargetIdx = Rnd.nextInt(targetList.size());
final int nextTargetIdx = Rnd.get(targetList.size());
final L2Object target = targetList.get(nextTargetIdx);
// Attacking the target

View File

@@ -63,8 +63,8 @@ public class L2SkillCreateItem extends L2Skill
final L2PcInstance player = (L2PcInstance) activeChar;
if (activeChar instanceof L2PcInstance)
{
final int count = _createItemCount * (Rnd.nextInt(_randomCount) + 1);
final int rndid = Rnd.nextInt(_createItemId.length);
final int count = _createItemCount * (Rnd.get(_randomCount) + 1);
final int rndid = Rnd.get(_createItemId.length);
giveItems(player, _createItemId[rndid], count);
}
}

View File

@@ -240,18 +240,18 @@ public class MinionList
int spawnConstant;
final int randSpawnLim = 170;
int randPlusMin = 1;
spawnConstant = Rnd.nextInt(randSpawnLim);
spawnConstant = Rnd.get(randSpawnLim);
// randomize +/-
randPlusMin = Rnd.nextInt(2);
randPlusMin = Rnd.get(2);
if (randPlusMin == 1)
{
spawnConstant *= -1;
}
final int newX = master.getX() + spawnConstant;
spawnConstant = Rnd.nextInt(randSpawnLim);
spawnConstant = Rnd.get(randSpawnLim);
// randomize +/-
randPlusMin = Rnd.nextInt(2);
randPlusMin = Rnd.get(2);
if (randPlusMin == 1)
{

View File

@@ -245,7 +245,7 @@ public class GameServerTable
public KeyPair getKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
private byte[] stringToHex(String string)

View File

@@ -87,7 +87,7 @@ public final class L2LoginClient extends MMOClient<MMOConnection<L2LoginClient>>
_scrambledPair = LoginController.getInstance().getScrambledRSAKeyPair();
_blowfishKey = LoginController.getInstance().getBlowfishKey();
_sessionId = Rnd.nextInt(Integer.MAX_VALUE);
_sessionId = Rnd.get(Integer.MAX_VALUE);
_connectionStartTime = System.currentTimeMillis();
_loginCrypt = new LoginCrypt();
_loginCrypt.setKey(_blowfishKey);

View File

@@ -192,7 +192,7 @@ public class LoginController
{
for (int j = 0; j < _blowfishKeys[i].length; j++)
{
_blowfishKeys[i][j] = (byte) (Rnd.nextInt(255) + 1);
_blowfishKeys[i][j] = (byte) (Rnd.get(255) + 1);
}
}
LOGGER.info("Stored " + _blowfishKeys.length + " keys for Blowfish communication");
@@ -561,7 +561,7 @@ public class LoginController
*/
public ScrambledKeyPair getScrambledRSAKeyPair()
{
return _keyPairs[Rnd.nextInt(10)];
return _keyPairs[Rnd.get(10)];
}
/**

View File

@@ -140,22 +140,22 @@ public class Status extends Thread
for (int i = 0; i < length; i++)
{
final int charSet = Rnd.nextInt(3);
final int charSet = Rnd.get(3);
switch (charSet)
{
case 0:
{
password.append(lowerChar.charAt(Rnd.nextInt(lowerChar.length() - 1)));
password.append(lowerChar.charAt(Rnd.get(lowerChar.length() - 1)));
break;
}
case 1:
{
password.append(upperChar.charAt(Rnd.nextInt(upperChar.length() - 1)));
password.append(upperChar.charAt(Rnd.get(upperChar.length() - 1)));
break;
}
case 2:
{
password.append(digits.charAt(Rnd.nextInt(digits.length() - 1)));
password.append(digits.charAt(Rnd.get(digits.length() - 1)));
break;
}
}