PlayerEventStatus.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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.util;
  16. import java.util.List;
  17. import javolution.util.FastList;
  18. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  19. import com.l2jserver.gameserver.model.Location;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. /**
  22. * @author Nik
  23. */
  24. public class PlayerEventStatus
  25. {
  26. public L2PcInstance player = null;
  27. public Location initLoc = new Location(0, 0, 0);
  28. public int initInstanceId = 0;
  29. public int initKarma = 0;
  30. public int initPvpKills = 0;
  31. public int initPkKills = 0;
  32. public String initTitle = "";
  33. public List<L2PcInstance> kills = new FastList<>();
  34. public boolean eventSitForced = false;
  35. public PlayerEventStatus(L2PcInstance player)
  36. {
  37. this.player = player;
  38. initLoc = new Location(player.getX(), player.getY(), player.getZ(), player.getHeading());
  39. initInstanceId = player.getInstanceId();
  40. initKarma = player.getKarma();
  41. initPvpKills = player.getPvpKills();
  42. initPkKills = player.getPkKills();
  43. initTitle = player.getTitle();
  44. }
  45. public void restoreInits()
  46. {
  47. player.teleToLocation(initLoc, true);
  48. if ((initInstanceId > 0) && (InstanceManager.getInstance().getInstance(initInstanceId) != null))
  49. {
  50. player.setInstanceId(initInstanceId);
  51. }
  52. player.setKarma(initKarma);
  53. player.setPvpKills(initPvpKills);
  54. player.setPkKills(initPkKills);
  55. player.setTitle(initTitle);
  56. }
  57. }