Advertisement
Guest User

Untitled

a guest
Apr 24th, 2010
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 21.93 KB | None | 0 0
  1. Index: config/altsettings.properties
  2. ===================================================================
  3. --- config/altsettings.properties   (revision 4751)
  4. +++ config/altsettings.properties   (working copy)
  5. @@ -520,3 +520,19 @@
  6.  # -------------------------------------------------------------
  7.  # Allow usage of mana potions
  8.  AllowManaPotions = False
  9. +
  10. +# -------------------------------------------------------------
  11. +# Away System Config
  12. +# -------------------------------------------------------------
  13. +# Allow Players to change status Away
  14. +AllowAwayStatus = True
  15. +#Allow other Player target Away Player's
  16. +AwayAllowInterference = False
  17. +# Player take mobs aggro if he is Away
  18. +AwayPlayerTakeAggro = False
  19. +# Away status title Color (red 0000FF)
  20. +AwayTitleColor = 0000FF
  21. +# how many sec till player goes in away mode
  22. +AwayTimer = 30
  23. +# how many sec till player goes back from away mode
  24. +BackTimer = 30
  25. \ No newline at end of file
  26. Index: src/main/java/com/l2jfree/Config.java
  27. ===================================================================
  28. --- src/main/java/com/l2jfree/Config.java   (revision 4751)
  29. +++ src/main/java/com/l2jfree/Config.java   (working copy)
  30. @@ -1449,6 +1449,12 @@
  31.     public static boolean               ALT_ITEM_SKILLS_NOT_INFLUENCED;
  32.     public static boolean               ALT_MANA_POTIONS;
  33.     public static int                   ALT_AUTOCHAT_DELAY;
  34. +   public static boolean               ALT_ALLOW_AWAY_STATUS;
  35. +   public static int                   ALT_AWAY_TIMER;
  36. +   public static int                   ALT_BACK_TIMER;
  37. +   public static int                   ALT_AWAY_TITLE_COLOR;
  38. +   public static boolean               ALT_AWAY_ALLOW_INTERFERENCE;
  39. +   public static boolean               ALT_AWAY_PLAYER_TAKE_AGGRO;
  40.  
  41.     // *******************************************************************************************
  42.     // *******************************************************************************************
  43. @@ -1662,6 +1668,12 @@
  44.  
  45.             ALT_MANA_POTIONS = Boolean.parseBoolean(altSettings.getProperty("AllowManaPotions", "false"));
  46.             ALT_AUTOCHAT_DELAY = Integer.parseInt(altSettings.getProperty("AutoChatDelay", "30000"));
  47. +           ALT_ALLOW_AWAY_STATUS = Boolean.parseBoolean(altSettings.getProperty("AllowAwayStatus", "False"));
  48. +           ALT_AWAY_ALLOW_INTERFERENCE = Boolean.parseBoolean(altSettings.getProperty("AwayAllowInterference", "False"));
  49. +           ALT_AWAY_PLAYER_TAKE_AGGRO = Boolean.parseBoolean(altSettings.getProperty("AwayPlayerTakeAggro", "False"));
  50. +           ALT_AWAY_TITLE_COLOR = Integer.decode("0x" + altSettings.getProperty("AwayTitleColor", "0000FF"));
  51. +           ALT_AWAY_TIMER = Integer.parseInt(altSettings.getProperty("AwayTimer", "30"));
  52. +           ALT_BACK_TIMER = Integer.parseInt(altSettings.getProperty("BackTimer", "30"));
  53.         }
  54.         catch (Exception e)
  55.         {
  56. Index: src/main/java/com/l2jfree/gameserver/ai/L2AttackableAI.java
  57. ===================================================================
  58. --- src/main/java/com/l2jfree/gameserver/ai/L2AttackableAI.java (revision 4751)
  59. +++ src/main/java/com/l2jfree/gameserver/ai/L2AttackableAI.java (working copy)
  60. @@ -200,10 +200,12 @@
  61.             //event playere are also ignored
  62.             if(player.isInFunEvent())
  63.                 return false;
  64. -              
  65.             // check if the target is within the grace period for JUST getting up from fake death
  66.             if (player.isRecentFakeDeath())
  67.                 return false;
  68. +           // check player is in away mod
  69. +           if(player.isAway() && !Config.ALT_AWAY_PLAYER_TAKE_AGGRO)
  70. +               return false;
  71.         }
  72.         // Check if the target is a L2Summon
  73.         if (target instanceof L2Summon)
  74. Index: src/main/java/com/l2jfree/gameserver/communitybbs/Manager/RegionBBSManager.java
  75. ===================================================================
  76. --- src/main/java/com/l2jfree/gameserver/communitybbs/Manager/RegionBBSManager.java (revision 4751)
  77. +++ src/main/java/com/l2jfree/gameserver/communitybbs/Manager/RegionBBSManager.java (working copy)
  78. @@ -225,6 +225,11 @@
  79.                     return;
  80.                 }
  81.  
  82. +               if (receiver.isAway())
  83. +               {
  84. +                   activeChar.sendMessage(receiver.getName() + " is Away please try again later.");
  85. +                   return;
  86. +               }
  87.                 if (Config.LOG_CHAT)
  88.                 {
  89.                     LogRecord record = new LogRecord(Level.INFO, ar3);
  90. @@ -452,6 +457,8 @@
  91.  
  92.                     if (player.isGM())
  93.                         htmlCode.append("<font color=\"LEVEL\">" + player.getName() + "</font>");
  94. +                   else if(player.isAway() && Config.ALT_ALLOW_AWAY_STATUS)
  95. +                       htmlCode.append(player.getName() + "*Away*");
  96.                     else if (player.getClan() != null && player.isClanLeader() && Config.SHOW_CLAN_LEADER
  97.                             && player.getClan().getLevel() >= Config.SHOW_CLAN_LEADER_CLAN_LEVEL)
  98.                         htmlCode.append("<font color=\"00FF00\">" + player.getName() + "</font>");
  99. Index: src/main/java/com/l2jfree/gameserver/GameServer.java
  100. ===================================================================
  101. --- src/main/java/com/l2jfree/gameserver/GameServer.java    (revision 4751)
  102. +++ src/main/java/com/l2jfree/gameserver/GameServer.java    (working copy)
  103. @@ -67,6 +67,7 @@
  104. import com.l2jfree.gameserver.handler.VoicedCommandHandler;
  105. import com.l2jfree.gameserver.idfactory.IdFactory;
  106. import com.l2jfree.gameserver.instancemanager.AuctionManager;
  107. +import com.l2jfree.gameserver.instancemanager.AwayManager;
  108. import com.l2jfree.gameserver.instancemanager.BoatManager;
  109. import com.l2jfree.gameserver.instancemanager.CastleManager;
  110. import com.l2jfree.gameserver.instancemanager.CastleManorManager;
  111. @@ -328,6 +329,11 @@
  112.             FactionManager.getInstance();
  113.             FactionQuestManager.getInstance();
  114.         }
  115. +       if (Config.ALT_ALLOW_AWAY_STATUS)
  116. +       {
  117. +           Util.printSection("Away System");
  118. +           AwayManager.getInstance();
  119. +       }
  120.         try
  121.         {
  122.             DynamicExtension.getInstance();
  123. Index: src/main/java/com/l2jfree/gameserver/handler/chathandlers/ChatWhisper.java
  124. ===================================================================
  125. --- src/main/java/com/l2jfree/gameserver/handler/chathandlers/ChatWhisper.java  (revision 4751)
  126. +++ src/main/java/com/l2jfree/gameserver/handler/chathandlers/ChatWhisper.java  (working copy)
  127. @@ -52,6 +52,14 @@
  128.         {
  129.             if ((!receiver.getMessageRefusal() && !BlockList.isBlocked(receiver, activeChar)) || activeChar.isGM())
  130.             {
  131. +               if (receiver.isAway())
  132. +               {
  133. +                   receiver.sendPacket(new CreatureSay(activeChar.getObjectId(), chatType.getId(), activeChar.getName(), text));
  134. +                   activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(),  chatType.getId(), "->" + receiver.getName(), text));
  135. +                   SystemMessage sm = new SystemMessage(SystemMessageId.S1);
  136. +                   sm.addString(target + " is Away try again later");
  137. +                   activeChar.sendPacket(sm);
  138. +               }
  139.                 if (Config.JAIL_DISABLE_CHAT && receiver.isInJail())
  140.                 {
  141.                     activeChar.sendMessage(receiver.getName()+" is currently in jail.");
  142. Index: src/main/java/com/l2jfree/gameserver/handler/VoicedCommandHandler.java
  143. ===================================================================
  144. --- src/main/java/com/l2jfree/gameserver/handler/VoicedCommandHandler.java  (revision 4751)
  145. +++ src/main/java/com/l2jfree/gameserver/handler/VoicedCommandHandler.java  (working copy)
  146. @@ -45,6 +45,10 @@
  147.     private VoicedCommandHandler()
  148.     {
  149.         _datatable = new FastMap<String, IVoicedCommandHandler>();
  150. +       if (Config.ALT_ALLOW_AWAY_STATUS)
  151. +       {
  152. +           registerVoicedCommandHandler(new Away());
  153. +       }
  154.         registerVoicedCommandHandler(new CastleDoors());
  155.         registerVoicedCommandHandler(new Hellbound());
  156.         registerVoicedCommandHandler(new VersionInfo());
  157. Index: src/main/java/com/l2jfree/gameserver/handler/voicedcommandhandlers/Away.java
  158. ===================================================================
  159. --- src/main/java/com/l2jfree/gameserver/handler/voicedcommandhandlers/Away.java    (revision 0)
  160. +++ src/main/java/com/l2jfree/gameserver/handler/voicedcommandhandlers/Away.java    (revision 0)
  161. @@ -0,0 +1,140 @@
  162. +/*
  163. + * This program is free software: you can redistribute it and/or modify it under
  164. + * the terms of the GNU General Public License as published by the Free Software
  165. + * Foundation, either version 3 of the License, or (at your option) any later
  166. + * version.
  167. + *
  168. + * This program is distributed in the hope that it will be useful, but WITHOUT
  169. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  170. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  171. + * details.
  172. + *
  173. + * You should have received a copy of the GNU General Public License along with
  174. + * this program. If not, see <http://www.gnu.org/licenses/>.
  175. + */
  176. +package com.l2jfree.gameserver.handler.voicedcommandhandlers;
  177. +
  178. +import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
  179. +import com.l2jfree.gameserver.instancemanager.AwayManager;
  180. +import com.l2jfree.gameserver.instancemanager.SiegeManager;
  181. +import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
  182. +import com.l2jfree.gameserver.model.entity.Siege;
  183. +
  184. +/**
  185. + * @author Michiru
  186. + *
  187. + */
  188. +public class Away implements IVoicedCommandHandler
  189. +{
  190. +   private static final String[]   VOICED_COMMANDS =
  191. +                                                   { "away", "back" };
  192. +
  193. +   /* (non-Javadoc)
  194. +    * @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, com.l2jfree.gameserver.model.L2PcInstance), String)
  195. +    */
  196. +   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String text)
  197. +   {
  198. +       if (command.startsWith("away"))
  199. +           return away(activeChar, text);
  200. +       else if (command.startsWith("back"))
  201. +           return back(activeChar);
  202. +       return false;
  203. +   }
  204. +
  205. +   /* (non-Javadoc)
  206. +    * @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
  207. +    */
  208. +
  209. +   private boolean away(L2PcInstance activeChar, String text)
  210. +   {
  211. +       Siege siege = SiegeManager.getInstance().getSiege(activeChar);
  212. +       //check char is all ready in away mode
  213. +       if (activeChar.isAway())
  214. +       {
  215. +           activeChar.sendMessage("You are allready Away");
  216. +           return false;
  217. +       }
  218. +
  219. +       //check player is death/fake death and movement disable
  220. +       if (activeChar.isMovementDisabled() || activeChar.isAlikeDead())
  221. +           return false;
  222. +       // Check if player is in Siege
  223. +       if (siege != null && siege.getIsInProgress())
  224. +       {
  225. +           activeChar.sendMessage("You are in siege, you can't go Afk.");
  226. +           return false;
  227. +       }
  228. +       // Check if player is a Cursed Weapon owner
  229. +       if (activeChar.isCursedWeaponEquipped())
  230. +       {
  231. +           activeChar.sendMessage("You can't go Afk! You are currently holding a cursed weapon.");
  232. +           return false;
  233. +       }
  234. +       // Check if player is in Duel
  235. +       if (activeChar.isInDuel())
  236. +       {
  237. +           activeChar.sendMessage("You can't go Afk! You are in a duel!");
  238. +           return false;
  239. +       }
  240. +       //check is in DimensionsRift
  241. +       if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
  242. +       {
  243. +           activeChar.sendMessage("You can't go Afk! You are in the dimensional rift.");
  244. +           return false;
  245. +       }
  246. +       // Check to see if the player is in an event
  247. +       if (activeChar.isInFunEvent())
  248. +       {
  249. +           activeChar.sendMessage("You can't go Afk! You are in event now.");
  250. +           return false;
  251. +       }
  252. +       //check player is in Olympiade
  253. +       if (activeChar.isInOlympiadMode())
  254. +       {
  255. +           activeChar.sendMessage("You can't go Afk! Your are fighting in Olympiad!");
  256. +           return false;
  257. +       }
  258. +       // Check player is in observer mode
  259. +       if (activeChar.inObserverMode())
  260. +       {
  261. +           activeChar.sendMessage("You can't go Afk in Observer mode!");
  262. +           return false;
  263. +       }
  264. +       //check player have karma/pk/pvp status
  265. +       if (activeChar.getKarma() > 0 || activeChar.getPvpFlag() > 0)
  266. +       {
  267. +           activeChar.sendMessage("Player in PVP or with Karma can't use the Away command!");
  268. +           return false;
  269. +       }
  270. +       if (activeChar.isImmobilized())
  271. +           return false;
  272. +       //check away text have not more then 10 letter
  273. +       if (text.length() > 10)
  274. +       {
  275. +           activeChar.sendMessage("You can't set your status Away with more then 10 letters");
  276. +           return false;
  277. +       }
  278. +       // check if player have no one in target
  279. +       if (activeChar.getTarget() == null && text.length() <= 1 || text.length() <= 10)
  280. +
  281. +           //set this Player status away in AwayManager
  282. +           AwayManager.getInstance().setAway(activeChar, text);
  283. +       return true;
  284. +   }
  285. +
  286. +   private boolean back(L2PcInstance activeChar)
  287. +   {
  288. +       if (!activeChar.isAway())
  289. +       {
  290. +           activeChar.sendMessage("You are not Away!");
  291. +           return false;
  292. +       }
  293. +       AwayManager.getInstance().setBack(activeChar);
  294. +       return true;
  295. +   }
  296. +
  297. +   public String[] getVoicedCommandList()
  298. +   {
  299. +       return VOICED_COMMANDS;
  300. +   }
  301. +}
  302. Index: src/main/java/com/l2jfree/gameserver/instancemanager/AwayManager.java
  303. ===================================================================
  304. --- src/main/java/com/l2jfree/gameserver/instancemanager/AwayManager.java   (revision 0)
  305. +++ src/main/java/com/l2jfree/gameserver/instancemanager/AwayManager.java   (revision 0)
  306. @@ -0,0 +1,186 @@
  307. +/*
  308. + * This program is free software: you can redistribute it and/or modify it under
  309. + * the terms of the GNU General Public License as published by the Free Software
  310. + * Foundation, either version 3 of the License, or (at your option) any later
  311. + * version.
  312. + *
  313. + * This program is distributed in the hope that it will be useful, but WITHOUT
  314. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  315. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  316. + * details.
  317. + *
  318. + * You should have received a copy of the GNU General Public License along with
  319. + * this program. If not, see <http://www.gnu.org/licenses/>.
  320. + */
  321. +package com.l2jfree.gameserver.instancemanager;
  322. +
  323. +import java.util.Collections;
  324. +import java.util.Map;
  325. +import java.util.WeakHashMap;
  326. +
  327. +import org.apache.commons.logging.Log;
  328. +import org.apache.commons.logging.LogFactory;
  329. +
  330. +import com.l2jfree.Config;
  331. +import com.l2jfree.gameserver.ThreadPoolManager;
  332. +import com.l2jfree.gameserver.ai.CtrlIntention;
  333. +import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
  334. +import com.l2jfree.gameserver.network.serverpackets.SetupGauge;
  335. +import com.l2jfree.gameserver.network.serverpackets.SocialAction;
  336. +
  337. +/**
  338. + * @author Michiru
  339. + *
  340. + */
  341. +public final class AwayManager
  342. +{
  343. +   private static final Log                _log    = LogFactory.getLog(AwayManager.class.getName());
  344. +   private static AwayManager              _instance;
  345. +   private Map<L2PcInstance, RestoreData>  _awayPlayers;
  346. +
  347. +   public static final AwayManager getInstance()
  348. +   {
  349. +       if (_instance == null)
  350. +       {
  351. +           _instance = new AwayManager();
  352. +           _log.info("AwayManager: initialized.");
  353. +       }
  354. +       return _instance;
  355. +   }
  356. +
  357. +   private final class RestoreData
  358. +   {
  359. +       private final String    _originalTitle;
  360. +       private final int       _originalTitleColor;
  361. +       private final boolean   _sitForced;
  362. +
  363. +       public RestoreData(L2PcInstance activeChar)
  364. +       {
  365. +           _originalTitle = activeChar.getTitle();
  366. +           _originalTitleColor = activeChar.getAppearance().getTitleColor();
  367. +           _sitForced = !activeChar.isSitting();
  368. +       }
  369. +
  370. +       public boolean isSitForced()
  371. +       {
  372. +           return _sitForced;
  373. +       }
  374. +
  375. +       public void restore(L2PcInstance activeChar)
  376. +       {
  377. +           activeChar.getAppearance().setTitleColor(_originalTitleColor);
  378. +           activeChar.setTitle(_originalTitle);
  379. +       }
  380. +   }
  381. +
  382. +   private AwayManager()
  383. +   {
  384. +       _awayPlayers = Collections.synchronizedMap(new WeakHashMap<L2PcInstance, RestoreData>());
  385. +   }
  386. +
  387. +   /**
  388. +    * @param activeChar
  389. +    * @param text
  390. +    */
  391. +   public void setAway(L2PcInstance activeChar, String text)
  392. +   {
  393. +       activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 9));
  394. +       activeChar.sendMessage("Your status is Away in " + Config.ALT_AWAY_TIMER + " Sec.");
  395. +       activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  396. +       SetupGauge sg = new SetupGauge(SetupGauge.BLUE, Config.ALT_AWAY_TIMER * 1000);
  397. +       activeChar.sendPacket(sg);
  398. +       activeChar.setIsImmobilized(true);
  399. +       ThreadPoolManager.getInstance().scheduleGeneral(new setPlayerAwayTask(activeChar, text), Config.ALT_AWAY_TIMER * 1000);
  400. +   }
  401. +
  402. +   /**
  403. +    * @param activeChar
  404. +    */
  405. +   public void setBack(L2PcInstance activeChar)
  406. +   {
  407. +       activeChar.sendMessage("You are back from Away Status in " + Config.ALT_BACK_TIMER + " Sec.");
  408. +       SetupGauge sg = new SetupGauge(SetupGauge.BLUE, Config.ALT_BACK_TIMER * 1000);
  409. +       activeChar.sendPacket(sg);
  410. +       ThreadPoolManager.getInstance().scheduleGeneral(new setPlayerBackTask(activeChar), Config.ALT_BACK_TIMER * 1000);
  411. +   }
  412. +
  413. +   class setPlayerAwayTask implements Runnable
  414. +   {
  415. +
  416. +       private final L2PcInstance  _activeChar;
  417. +       private final String        _awayText;
  418. +
  419. +       setPlayerAwayTask(L2PcInstance activeChar, String awayText)
  420. +       {
  421. +           _activeChar = activeChar;
  422. +           _awayText = awayText;
  423. +       }
  424. +
  425. +       public void run()
  426. +       {
  427. +           if (_activeChar == null)
  428. +               return;
  429. +           if (_activeChar.isAttackingNow() || _activeChar.isCastingNow())
  430. +               return;
  431. +
  432. +           _awayPlayers.put(_activeChar, new RestoreData(_activeChar));
  433. +
  434. +           _activeChar.disableAllSkills();
  435. +           _activeChar.abortAttack();
  436. +           _activeChar.abortCast();
  437. +           _activeChar.setTarget(null);
  438. +           _activeChar.setIsImmobilized(false);
  439. +           if (!_activeChar.isSitting())
  440. +               _activeChar.sitDown(true);
  441. +           if (_awayText.length() <= 1)
  442. +           {
  443. +               _activeChar.sendMessage("You are now *Away*");
  444. +           }
  445. +           else
  446. +           {
  447. +               _activeChar.sendMessage("You are now Away *" + _awayText + "*");
  448. +           }
  449. +           _activeChar.getAppearance().setTitleColor(Config.ALT_AWAY_TITLE_COLOR);
  450. +           if (_awayText.length() <= 1)
  451. +           {
  452. +               _activeChar.setTitle("*Away*");
  453. +           }
  454. +           else
  455. +           {
  456. +               _activeChar.setTitle("Away*" + _awayText + "*");
  457. +           }
  458. +           _activeChar.broadcastUserInfo();
  459. +           _activeChar.setIsParalyzed(true);
  460. +           _activeChar.setIsAway(true);
  461. +       }
  462. +   }
  463. +
  464. +   class setPlayerBackTask implements Runnable
  465. +   {
  466. +
  467. +       private final L2PcInstance  _activeChar;
  468. +
  469. +       setPlayerBackTask(L2PcInstance activeChar)
  470. +       {
  471. +           _activeChar = activeChar;
  472. +       }
  473. +
  474. +       public void run()
  475. +       {
  476. +           if (_activeChar == null)
  477. +               return;
  478. +           RestoreData rd = _awayPlayers.get(_activeChar);
  479. +           if (rd == null)
  480. +               return;
  481. +           _activeChar.setIsParalyzed(false);
  482. +           _activeChar.enableAllSkills();
  483. +           _activeChar.setIsAway(false);
  484. +           if (rd.isSitForced())
  485. +               _activeChar.standUp();
  486. +           rd.restore(_activeChar);
  487. +           _awayPlayers.remove(_activeChar);
  488. +           _activeChar.broadcastUserInfo();
  489. +           _activeChar.sendMessage("You are Back now!");
  490. +       }
  491. +   }
  492. +}
  493. Index: src/main/java/com/l2jfree/gameserver/model/actor/instance/L2PcInstance.java
  494. ===================================================================
  495. --- src/main/java/com/l2jfree/gameserver/model/actor/instance/L2PcInstance.java (revision 4751)
  496. +++ src/main/java/com/l2jfree/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  497. @@ -752,6 +752,11 @@
  498.  
  499.     private int                             _clientRevision         = 0;
  500.  
  501. +   /** character away mode **/
  502. +   private boolean                         _isAway                 = false;
  503. +   public int                              _originalTitleColorAway;
  504. +   public String                           _originalTitleAway;
  505. +
  506.     private FactionMember                   _faction;
  507.  
  508.     /* Flag to disable equipment/skills while wearing formal wear **/
  509. @@ -2784,6 +2789,8 @@
  510.         {
  511.             sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
  512.         }
  513. +       else if (isAway())
  514. +           sendMessage("You can't stand up if your Status is Away");
  515.         else if (TvT._sitForced && _inEventTvT || CTF._sitForced && _inEventCTF || DM._sitForced && _inEventDM || VIP._sitForced && _inEventVIP)
  516.             sendMessage("The Admin/GM handle if you sit or stand in this match!");
  517.         else if (_waitTypeSitting && !isInStoreMode() && !isAlikeDead() && (!_protectedSitStand || force))
  518. @@ -3735,6 +3742,12 @@
  519.             return;
  520.         }
  521.  
  522. +       if (isAway() && !Config.ALT_AWAY_ALLOW_INTERFERENCE)
  523. +       {
  524. +           sendMessage("You can't target Away Players");
  525. +           sendPacket(ActionFailed.STATIC_PACKET);
  526. +           return;
  527. +       }
  528.         if (Config.SIEGE_ONLY_REGISTERED)
  529.         {
  530.             if (!canBeTargetedByAtSiege(player))
  531. @@ -12995,7 +13008,17 @@
  532.     {
  533.         _olympiadOpponentId = value;
  534.     }
  535. -  
  536. +
  537. +   public boolean isAway()
  538. +   {
  539. +       return _isAway;
  540. +   }
  541. +
  542. +   public void setIsAway(boolean state)
  543. +   {
  544. +       _isAway = state;
  545. +   }
  546. +
  547.     private ImmutableReference<L2PcInstance> _immutableReference;
  548.     private ClearableReference<L2PcInstance> _clearableReference;
  549.    
  550. Index: src/main/java/com/l2jfree/gameserver/network/clientpackets/Logout.java
  551. ===================================================================
  552. --- src/main/java/com/l2jfree/gameserver/network/clientpackets/Logout.java  (revision 4751)
  553. +++ src/main/java/com/l2jfree/gameserver/network/clientpackets/Logout.java  (working copy)
  554. @@ -78,6 +78,13 @@
  555.             player.sendMessage("You can not log out while flying.");
  556.             return;
  557.         }
  558. +
  559. +       if (player.isAway())
  560. +       {
  561. +           player.sendMessage("You can't logout in Away mode.");
  562. +           return;
  563. +       }
  564. +
  565.         // [L2J_JP ADD END]
  566.  
  567.         if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !player.isGM())
  568. Index: src/main/java/com/l2jfree/gameserver/network/clientpackets/RequestRestart.java
  569. ===================================================================
  570. --- src/main/java/com/l2jfree/gameserver/network/clientpackets/RequestRestart.java  (revision 4751)
  571. +++ src/main/java/com/l2jfree/gameserver/network/clientpackets/RequestRestart.java  (working copy)
  572. @@ -66,6 +66,12 @@
  573.             return;
  574.         }
  575.  
  576. +       if (player.isAway())
  577. +       {
  578. +           player.sendMessage("You can't restart in Away mode.");
  579. +           return;
  580. +       }
  581. +
  582.         if(player.atEvent)
  583.         {
  584.             player.sendMessage("A superior power doesn't allow you to leave the event.");
  585. Index: src/main/java/com/l2jfree/gameserver/network/L2IrcClient.java
  586. ===================================================================
  587. --- src/main/java/com/l2jfree/gameserver/network/L2IrcClient.java   (revision 4751)
  588. +++ src/main/java/com/l2jfree/gameserver/network/L2IrcClient.java   (working copy)
  589. @@ -337,8 +337,11 @@
  590.                     boolean _isFirst = true;
  591.                     for (L2PcInstance player : L2World.getInstance().getAllPlayers())
  592.                     {
  593. -                       _onlineNames = _onlineNames + (_isFirst ? " " : ", ") + player.getName();
  594. -                       _isFirst = false;
  595. +                       if (player.isAway())
  596. +                           _onlineNames = _onlineNames + (_isFirst ? " " : ", ") + player.getName() + "*Away*";
  597. +                       else
  598. +                           _onlineNames = _onlineNames + (_isFirst ? " " : ", ") + player.getName();
  599. +                           _isFirst = false;
  600.                     }
  601.                     sendChan(_onlineNames);
  602.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement