From: Deluge <ant...@us...> - 2013-07-30 22:20:21
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/player In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25481/src/games/stendhal/server/entity/player Modified Files: Player.java Log Message: Created list to add portal IDs. Player can use portals requiring passwords if ID if found in list. Index: Player.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/player/Player.java,v retrieving revision 1.382 retrieving revision 1.383 diff -C2 -d -r1.382 -r1.383 *** Player.java 27 Jul 2013 09:02:44 -0000 1.382 --- Player.java 30 Jul 2013 22:20:16 -0000 1.383 *************** *** 98,102 **** private int tradescore; ! /** --- 98,105 ---- private int tradescore; ! /** ! * List of portals that have been "unlocked" for this player. ! */ ! private List<Integer> unlockedPortals; /** *************** *** 290,293 **** --- 293,298 ---- statuses = new LinkedList<Status>(); + unlockedPortals = new LinkedList<Integer>(); + updateModifiedAttributes(); } *************** *** 475,479 **** return karma; } ! /** * Use some of the player's karma. A positive value indicates good --- 480,484 ---- return karma; } ! /** * Use some of the player's karma. A positive value indicates good *************** *** 593,596 **** --- 598,642 ---- return this.tradescore; } + + /** + * + * @return + * List of portals that have been unlocked for this player. + */ + public List<Integer> getUnlockedPortals() { + return unlockedPortals; + } + + /** + * Removes the portal from the list of unlocked portals. + * + * @param ID + * Portal's ID + */ + public void lockPortal(final int ID) { + int index = unlockedPortals.size() - 1; + if (unlockedPortals.contains(ID)) { + while (index <= 0) { + if (unlockedPortals.get(index) == ID) { + unlockedPortals.remove(index); + logger.info("Removed portal ID " + Integer.toString(ID) + " from player " + getName() + "."); + } + } + } + } + + /** + * Adds a portal ID to a list of "unlocked" portals for player. + * + * @param ID + * Portal's ID + */ + public void unlockPortal(final int ID) { + if (!unlockedPortals.contains(ID)) { + unlockedPortals.add(ID); + logger.info("Added portal ID " + Integer.toString(ID) + " to unlocked portals for player " + getName() + "."); + } + } + /** * Process changes that to the object attributes. This may be called several |