Sarada-L2

modo de nao recebe item offline AutoReward

Jan 31st, 2021 (edited)
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  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 .
  14. + */
  15. +package com.l2jfrozen.gameserver.model.entity.event;
  16. +
  17. +import java.util.Collection;
  18. +
  19. +import com.l2jfrozen.Config;
  20. +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  21. +import com.l2jfrozen.gameserver.model.L2World;
  22. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  23. +import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage;
  24. +
  25. +public class AutoRewarder
  26. +{
  27. + public static void getInstance()
  28. + {
  29. + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  30. + {
  31. + @Override
  32. + public void run()
  33. + {
  34. + AutoReward();
  35. + }
  36. +
  37. + }, 0,Config.AUTO_REWARD_DELAY * 1000);
  38. + }
  39. + public static void AutoReward()
  40. + {
  41. + Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
  42. + for (L2PcInstance player : pls)
  43. + {
  44. + if (!(player != null))
  45. + return;
  46. + L2PcInstance activeChar = player;
  47. + if(activeChar.isOnline() == 1)
  48. + {
  49. + player.sendPacket(new ExShowScreenMessage( "AutoReward: Voce ganhou um premio por estar online: " + Config.AUTO_REWARD_COUNT, 4000));
  50. + player.getInventory().addItem("", Config.AUTO_REWARD_ID, Config.AUTO_REWARD_COUNT, player, null);
  51. + }
  52. + }
  53. + }
  54. +
  55. +}
  56.  
  57. Index: package com/l2jfrozen/gameserver/datatables/OfflineTradeTable.java
  58.  
  59.  
  60. }
  61. items.close();
  62. stm_items.close();
  63.  
  64. player.sitDown();
  65. if (Config.OFFLINE_SET_NAME_COLOR)
  66. {
  67. player._originalNameColorOffline = player.getAppearance().getNameColor();
  68. player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);
  69. }
  70. player.setPrivateStoreType(type);
  71. - player.setOnlineStatus(true);
  72. + player.setOnlineStatus(false);
  73. player.restoreEffects();
  74. player.broadcastUserInfo();
  75. nTraders++;
  76. }
  77.  
  78.  
  79.  
Add Comment
Please, Sign In to add comment