Olympiad points restriction for matches

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Maylorian
Posts: 23
Joined: Sun Sep 09, 2012 11:01 am

Olympiad points restriction for matches

Post 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;    } 
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Olympiad points restriction for matches

Post by UnAfraid »

Looks like it will be working fine.
Image
Post Reply