Participant.java 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.model.olympiad;
  16. import com.l2jserver.gameserver.model.L2World;
  17. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  18. import com.l2jserver.gameserver.templates.StatsSet;
  19. /**
  20. *
  21. * @author DS
  22. *
  23. */
  24. public final class Participant
  25. {
  26. public final int objectId;
  27. public L2PcInstance player;
  28. public final String name;
  29. public final int side;
  30. public final int baseClass;
  31. public boolean disconnected = false;
  32. public boolean defaulted = false;
  33. public final StatsSet stats;
  34. public Participant(L2PcInstance plr, int olympiadSide)
  35. {
  36. objectId = plr.getObjectId();
  37. player = plr;
  38. name = plr.getName();
  39. side = olympiadSide;
  40. baseClass = plr.getBaseClass();
  41. stats = Olympiad.getNobleStats(objectId);
  42. }
  43. public final void updatePlayer()
  44. {
  45. if (player == null || !player.isOnline())
  46. player = L2World.getInstance().getPlayer(objectId);
  47. }
  48. public final void updateStat(String statName, int increment)
  49. {
  50. stats.set(statName, Math.max(stats.getInteger(statName) + increment, 0));
  51. }
  52. public final void updateNobleStats()
  53. {
  54. Olympiad.updateNobleStats(objectId, stats);
  55. }
  56. }