Page 1 of 1

Olympiad points restriction for matches

Posted: Fri Sep 28, 2012 1:24 pm
by Maylorian
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number: last
L2JDP Revision Number: last

I was wandering this might work for the olympiad? to start matches with players with similar points:

Code: Select all

protected static final Participant[] createListOfParticipants(List<Integer> list)    {        if ((list == null) || list.isEmpty() || (list.size() < 2))        {            return null;        }                int playerOneObjectId = 0;        L2PcInstance playerOne = null;        L2PcInstance playerTwo = null;                while (list.size() > 1)        {            playerOneObjectId = list.remove(Rnd.nextInt(list.size()));            playerOne = L2World.getInstance().getPlayer(playerOneObjectId);            if ((playerOne == null) || !playerOne.isOnline())            {                continue;            }                        playerTwo = L2World.getInstance().getPlayer(list.remove(Rnd.nextInt(list.size())));            if ((playerTwo == null) || !playerTwo.isOnline())            {                list.add(playerOneObjectId);                continue;            }if (list.size() > 2) {final int playeronepoints = _playerOne.getStats().getInteger(POINTS);final int playerTwoPoints = _playerTwo.getStats().getInteger(POINTS);final int pointsdifferent = playeronepoints - playertwopoints; if (math.abs(pointsdiffernt) < 10) {              Participant[] result = new Participant[2];            result[0] = new Participant(playerOne, 1);            result[1] = new Participant(playerTwo, 2);            return result;        }  } else         return null;    } 

Re: Olympiad points restriction for matches

Posted: Fri Sep 28, 2012 7:36 pm
by UnAfraid
Looks like it will be working fine.