Advertisement
crymxz

Agathion Interlude aCis 401 minor changes

Jul 10th, 2023
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 20.50 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis
  3. diff --git aCis_game/config/npcs.properties aCis_game/config/npcs.properties
  4. index c05f8a9..db91ab8 100644
  5. --- aCis_game/config/npcs.properties
  6. +++ aCis_game/config/npcs.properties
  7. @@ -201,4 +201,7 @@
  8.  MinNPCAnimation = 20
  9.  MaxNPCAnimation = 40
  10.  MinMonsterAnimation = 10
  11. -MaxMonsterAnimation = 40
  12. \ No newline at end of file
  13. +MaxMonsterAnimation = 40
  14. +
  15. +# id of the skill to cast when the summon item is used, the standard skill is 2046 of all pets
  16. +SkillIdUseCastAgathion = 2046
  17. \ No newline at end of file
  18. diff --git aCis_game/java/net/sf/l2j/Config.java aCis_game/java/net/sf/l2j/Config.java
  19. index 65daaa6..bfdf47b 100644
  20. --- aCis_game/java/net/sf/l2j/Config.java
  21. +++ aCis_game/java/net/sf/l2j/Config.java
  22. @@ -35,6 +35,8 @@
  23.     public static final String PLAYERS_FILE = "./config/players.properties";
  24.     public static final String SERVER_FILE = "./config/server.properties";
  25.     public static final String SIEGE_FILE = "./config/siege.properties";
  26. +
  27. +   public static int SKILL_ID_AGATHION;
  28.    
  29.     // --------------------------------------------------
  30.     // Clans settings
  31. @@ -949,6 +951,8 @@
  32.         MAX_NPC_ANIMATION = npcs.getProperty("MaxNPCAnimation", 40);
  33.         MIN_MONSTER_ANIMATION = npcs.getProperty("MinMonsterAnimation", 10);
  34.         MAX_MONSTER_ANIMATION = npcs.getProperty("MaxMonsterAnimation", 40);
  35. +      
  36. +       SKILL_ID_AGATHION = npcs.getProperty("SkillIdUseCastAgathion", 2046);
  37.     }
  38.    
  39.     /**
  40. diff --git aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
  41. index 1792260..268ba86 100644
  42. --- aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
  43. +++ aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
  44. @@ -2,6 +2,7 @@
  45.  
  46.  import java.util.List;
  47.  
  48. +import net.sf.l2j.Config;
  49.  import net.sf.l2j.gameserver.data.SkillTable;
  50.  import net.sf.l2j.gameserver.data.xml.NpcData;
  51.  import net.sf.l2j.gameserver.data.xml.SummonItemData;
  52. @@ -41,6 +42,25 @@
  53.        
  54.         final IntIntHolder sitem = SummonItemData.getInstance().getSummonItem(item.getItemId());
  55.        
  56. +       final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(sitem.getId());
  57. +       if (npcTemplate == null)
  58. +           return;
  59. +      
  60. +       if (npcTemplate.getType().equalsIgnoreCase("Agathion"))
  61. +       {
  62. +           if (player.getAgathion() != null)
  63. +           {
  64. +               player.getAgathion().unSummon(player);
  65. +               item.setAgathion(player, false);
  66. +               player.sendMessage("Agathion has been unsummoned");
  67. +               return;
  68. +           }
  69. +           item.setAgathion(player, true);
  70. +           item.checkProtected(player);
  71. +           player.getAI().tryToCast(player, SkillTable.getInstance().getInfo(Config.SKILL_ID_AGATHION, 1), false, false, item.getObjectId());
  72. +           return;
  73. +       }
  74. +      
  75.         if ((player.getSummon() != null || player.isMounted()) && sitem.getValue() > 0)
  76.         {
  77.             player.sendPacket(SystemMessageId.SUMMON_ONLY_ONE);
  78. @@ -53,10 +73,6 @@
  79.             return;
  80.         }
  81.        
  82. -       final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(sitem.getId());
  83. -       if (npcTemplate == null)
  84. -           return;
  85. -      
  86.         switch (sitem.getValue())
  87.         {
  88.             case 0: // static summons (like Christmas tree)
  89. diff --git aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java
  90. index 30cc469..3881cd3 100644
  91. --- aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java
  92. +++ aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java
  93. @@ -6,10 +6,12 @@
  94.  import net.sf.l2j.gameserver.enums.skills.SkillType;
  95.  import net.sf.l2j.gameserver.geoengine.GeoEngine;
  96.  import net.sf.l2j.gameserver.handler.ISkillHandler;
  97. +import net.sf.l2j.gameserver.idfactory.IdFactory;
  98.  import net.sf.l2j.gameserver.model.World;
  99.  import net.sf.l2j.gameserver.model.WorldObject;
  100.  import net.sf.l2j.gameserver.model.actor.Creature;
  101.  import net.sf.l2j.gameserver.model.actor.Player;
  102. +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
  103.  import net.sf.l2j.gameserver.model.actor.instance.Pet;
  104.  import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  105.  import net.sf.l2j.gameserver.model.holder.IntIntHolder;
  106. @@ -41,10 +43,6 @@
  107.         if (item.getOwnerId() != player.getObjectId() || item.getLocation() != ItemLocation.INVENTORY)
  108.             return;
  109.        
  110. -       // Owner has a pet listed in world.
  111. -       if (World.getInstance().getPet(player.getObjectId()) != null)
  112. -           return;
  113. -      
  114.         // Check summon item validity.
  115.         final IntIntHolder summonItem = SummonItemData.getInstance().getSummonItem(item.getItemId());
  116.         if (summonItem == null)
  117. @@ -55,6 +53,34 @@
  118.         if (npcTemplate == null)
  119.             return;
  120.        
  121. +       if (npcTemplate.getType().equalsIgnoreCase("Agathion"))
  122. +       {
  123. +           if (player.getAgathion() != null)
  124. +               player.getAgathion().unSummon(player);
  125. +          
  126. +           Agathion summon;
  127. +           summon = new Agathion(IdFactory.getInstance().getNextId(), npcTemplate, player);
  128. +           player.setAgathion(summon);
  129. +          
  130. +           summon.getStatus().setMaxHpMp();
  131. +           summon.forceRunStance();
  132. +          
  133. +           final SpawnLocation spawnLoc = activeChar.getPosition().clone();
  134. +           spawnLoc.addStrictOffset(40);
  135. +           spawnLoc.setHeadingTo(activeChar.getPosition());
  136. +           spawnLoc.set(GeoEngine.getInstance().getValidLocation(activeChar, spawnLoc));
  137. +          
  138. +           summon.spawnMe(spawnLoc);
  139. +           summon.setInvul(true);
  140. +           summon.getAI().setFollowStatus(true);
  141. +           item.setAgathionItem(player);
  142. +           return;
  143. +       }
  144. +      
  145. +       // Owner has a pet listed in world.
  146. +       if (World.getInstance().getPet(player.getObjectId()) != null)
  147. +           return;
  148. +      
  149.         // Add the pet instance to world.
  150.         final Pet pet = Pet.restore(item, npcTemplate, player);
  151.         if (pet == null)
  152. diff --git aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java
  153. index 023516a..64c28dd 100644
  154. --- aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java
  155. +++ aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java
  156. @@ -107,6 +107,7 @@
  157.  import net.sf.l2j.gameserver.model.actor.container.player.Request;
  158.  import net.sf.l2j.gameserver.model.actor.container.player.ShortcutList;
  159.  import net.sf.l2j.gameserver.model.actor.container.player.SubClass;
  160. +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
  161.  import net.sf.l2j.gameserver.model.actor.instance.Door;
  162.  import net.sf.l2j.gameserver.model.actor.instance.FestivalMonster;
  163.  import net.sf.l2j.gameserver.model.actor.instance.Folk;
  164. @@ -373,6 +374,7 @@
  165.     private final QuestList _questList = new QuestList(this);
  166.    
  167.     private Summon _summon;
  168. +   private Agathion aga;
  169.     private TamedBeast _tamedBeast;
  170.    
  171.     private int _partyRoom;
  172. @@ -6489,6 +6491,9 @@
  173.             else if (_summon != null)
  174.                 _summon.unSummon(this);
  175.            
  176. +           if (getAgathion() != null)
  177. +               aga.unSummon(this);
  178. +          
  179.             // Stop all scheduled tasks.
  180.             stopChargeTask();
  181.            
  182. @@ -7407,4 +7412,14 @@
  183.        
  184.         return gms;
  185.     }
  186. +  
  187. +   public void setAgathion(Agathion aga)
  188. +   {
  189. +       this.aga = aga;
  190. +   }
  191. +  
  192. +   public Agathion getAgathion()
  193. +   {
  194. +       return aga;
  195. +   }
  196.  }
  197. \ No newline at end of file
  198. diff --git aCis_game/java/net/sf/l2j/gameserver/model/actor/cast/PlayerCast.java aCis_game/java/net/sf/l2j/gameserver/model/actor/cast/PlayerCast.java
  199. index f666547..778fc12 100644
  200. --- aCis_game/java/net/sf/l2j/gameserver/model/actor/cast/PlayerCast.java
  201. +++ aCis_game/java/net/sf/l2j/gameserver/model/actor/cast/PlayerCast.java
  202. @@ -273,7 +273,7 @@
  203.         switch (skill.getSkillType())
  204.         {
  205.             case SUMMON:
  206. -               if (!((L2SkillSummon) skill).isCubic() && (_actor.getSummon() != null || _actor.isMounted()))
  207. +               if (!((L2SkillSummon) skill).isAgathion() && !((L2SkillSummon) skill).isCubic() && (_actor.getSummon() != null || _actor.isMounted()))
  208.                 {
  209.                     _actor.sendPacket(SystemMessageId.SUMMON_ONLY_ONE);
  210.                     return false;
  211. diff --git aCis_game/java/net/sf/l2j/gameserver/model/actor/instance/Agathion.java aCis_game/java/net/sf/l2j/gameserver/model/actor/instance/Agathion.java
  212. new file mode 100644
  213. index 0000000..47fb2ab
  214. --- /dev/null
  215. +++ aCis_game/java/net/sf/l2j/gameserver/model/actor/instance/Agathion.java
  216. @@ -0,0 +1,136 @@
  217. +package net.sf.l2j.gameserver.model.actor.instance;
  218. +
  219. +import java.util.concurrent.Future;
  220. +
  221. +import net.sf.l2j.commons.math.MathUtil;
  222. +import net.sf.l2j.commons.pool.ThreadPool;
  223. +import net.sf.l2j.commons.random.Rnd;
  224. +
  225. +import net.sf.l2j.gameserver.model.actor.Npc;
  226. +import net.sf.l2j.gameserver.model.actor.Player;
  227. +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  228. +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  229. +import net.sf.l2j.gameserver.model.location.Location;
  230. +import net.sf.l2j.gameserver.model.location.SpawnLocation;
  231. +import net.sf.l2j.gameserver.network.serverpackets.PetDelete;
  232. +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
  233. +
  234. +/**
  235. + * @author maxi5
  236. + *
  237. + */
  238. +public class Agathion extends Npc
  239. +{
  240. +   private Player _owner;
  241. +   private Future<?> _followTask;
  242. +  
  243. +   private ItemInstance item;
  244. +  
  245. +   public Agathion(int objectId, NpcTemplate template, Player owner)
  246. +   {
  247. +       super(objectId, template);
  248. +      
  249. +        // Set the magical circle animation.
  250. +       setShowSummonAnimation(true);
  251. +      
  252. +       // Set the Player owner.
  253. +       _owner = owner;
  254. +   }
  255. +  
  256. +   @Override
  257. +   public void onSpawn()
  258. +   {
  259. +       setTitle(_owner.getName());
  260. +       followToOwner();
  261. +       super.onSpawn();
  262. +   }
  263. +  
  264. +   public void unSummon(Player owner)
  265. +   {
  266. +       // Abort attack, cast and move.
  267. +       abortAll(true);
  268. +      
  269. +       if (item != null)
  270. +           item.setAgathion(owner, false);
  271. +      
  272. +       owner.sendPacket(new PetDelete(2, getObjectId()));
  273. +       owner.setAgathion(null);
  274. +      
  275. +       if (owner.getSummon() != null)
  276. +           owner.getSummon().sendInfo(owner);
  277. +       owner.broadcastUserInfo();
  278. +      
  279. +       if (_followTask != null)
  280. +           _followTask.cancel(true);
  281. +      
  282. +       decayMe();
  283. +       deleteMe();
  284. +      
  285. +       super.deleteMe();
  286. +   }
  287. +  
  288. +   @Override
  289. +   public void onTeleported()
  290. +   {
  291. +       getAI().tryToFollow(_owner, false);
  292. +       super.onTeleported();
  293. +   }
  294. +  
  295. +   public void followToOwner()
  296. +   {
  297. +       if (_followTask == null)
  298. +           _followTask = ThreadPool.scheduleAtFixedRate(new Follow(this), 1000, 1000);
  299. +      
  300. +       // TODO Auto-generated method stub
  301. +
  302. +       SpawnLocation loc = _owner.getPosition();
  303. +       int rnd = Rnd.get(-20, +30);
  304. +       boolean action = Rnd.get(10) < 2;
  305. +
  306. +       if (!checkIfInRange(2000, this, _owner))
  307. +           teleportTo(_owner.getPosition(), 30);
  308. +       else if (!checkIfInRange(1000, this, _owner))
  309. +           instantTeleportTo(_owner.getPosition(), 30);
  310. +      
  311. +       if (_owner.isMoving())
  312. +           getAI().tryToFollow(_owner, false);
  313. +       else
  314. +       {
  315. +           if (checkIfInRange(30, this, _owner))
  316. +           {
  317. +               getAI().tryToIdle();
  318. +               if (action)
  319. +                   broadcastPacket(new SocialAction(this, 1));
  320. +           }
  321. +           if (!checkIfInRange(75, this, _owner) || action)
  322. +               getAI().tryToMoveTo(new Location(loc.getX()+rnd, loc.getY()+rnd, loc.getZ()), null);
  323. +       }
  324. +   }
  325. +
  326. +   private static class Follow implements Runnable
  327. +   {
  328. +       private final Agathion agathion;
  329. +      
  330. +       protected Follow(Agathion aga)
  331. +       {
  332. +           agathion = aga;
  333. +       }
  334. +      
  335. +       @Override
  336. +       public void run()
  337. +       {
  338. +           agathion.followToOwner();
  339. +       }  
  340. +   }
  341. +  
  342. +   public static boolean checkIfInRange(int range, Npc npc, Player player)
  343. +   {
  344. +       return MathUtil.checkIfInRange((int) (range + npc.getCollisionRadius()), npc, player, true);
  345. +   }
  346. +  
  347. +   public void setAgathionItem(ItemInstance item)
  348. +   {
  349. +       this.item = item;
  350. +       // TODO Auto-generated method stub
  351. +   }
  352. +}
  353. \ No newline at end of file
  354. diff --git aCis_game/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java aCis_game/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
  355. index 8429f78..940e74b 100644
  356. --- aCis_game/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
  357. +++ aCis_game/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
  358. @@ -4,6 +4,7 @@
  359.  import java.sql.PreparedStatement;
  360.  import java.sql.ResultSet;
  361.  import java.util.List;
  362. +import java.util.concurrent.Future;
  363.  import java.util.concurrent.ScheduledFuture;
  364.  import java.util.concurrent.locks.ReentrantLock;
  365.  import java.util.logging.Level;
  366. @@ -104,6 +105,9 @@
  367.    
  368.     private int _shotsMask = 0;
  369.    
  370. +   private boolean isAgathion;
  371. +   private Future<?> _protectedTask;
  372. +  
  373.     /**
  374.      * Constructor of the ItemInstance from the objectId and the itemId.
  375.      * @param objectId : int designating the ID of the object in the world
  376. @@ -487,7 +491,7 @@
  377.      */
  378.     public boolean isDropable()
  379.     {
  380. -       return isAugmented() ? false : _item.isDropable();
  381. +       return isAgathion || isAugmented() ? false : _item.isDropable();
  382.     }
  383.    
  384.     /**
  385. @@ -495,7 +499,7 @@
  386.      */
  387.     public boolean isDestroyable()
  388.     {
  389. -       return isQuestItem() ? false : _item.isDestroyable();
  390. +       return isAgathion || isQuestItem() ? false : _item.isDestroyable();
  391.     }
  392.    
  393.     /**
  394. @@ -503,7 +507,7 @@
  395.      */
  396.     public boolean isTradable()
  397.     {
  398. -       return isAugmented() ? false : _item.isTradable();
  399. +       return isAgathion || isAugmented() ? false : _item.isTradable();
  400.     }
  401.    
  402.     /**
  403. @@ -521,7 +525,7 @@
  404.     public boolean isDepositable(boolean isPrivateWareHouse)
  405.     {
  406.         // equipped, hero and quest items
  407. -       if (isEquipped() || !_item.isDepositable())
  408. +       if (isEquipped() || !_item.isDepositable() || isAgathion)
  409.             return false;
  410.        
  411.         if (!isPrivateWareHouse)
  412. @@ -1275,4 +1279,47 @@
  413.        
  414.         return Integer.compare(item.getObjectId(), getObjectId());
  415.     }
  416. +  
  417. +   public void setAgathion(Player player, boolean isAgathion)
  418. +   {
  419. +       this.isAgathion = isAgathion;
  420. +   }
  421. +  
  422. +   public void checkProtected(Player player)
  423. +   {
  424. +       if (_protectedTask != null)
  425. +           _protectedTask.cancel(true);
  426. +       _protectedTask = ThreadPool.schedule(new Protected(player), 5500);
  427. +   }
  428. +
  429. +   public boolean isAgathion()
  430. +   {
  431. +       return isAgathion;
  432. +   }
  433. +  
  434. +   public void setAgathionItem(Player player)
  435. +   {
  436. +       player.getAgathion().setAgathionItem(this);
  437. +   }  
  438. +
  439. +   private class Protected implements Runnable
  440. +   {
  441. +       private final Player player;
  442. +      
  443. +       protected Protected(Player player)
  444. +       {
  445. +           this.player = player;
  446. +       }
  447. +      
  448. +       @Override
  449. +       public void run()
  450. +       {
  451. +           if (player.getAgathion() != null)
  452. +               isAgathion = true;
  453. +           else
  454. +               isAgathion = false;
  455. +           if (_protectedTask != null)
  456. +               _protectedTask.cancel(true);
  457. +       }
  458. +   }
  459.  }
  460. \ No newline at end of file
  461. diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
  462. index e963ca2..781a634 100644
  463. --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
  464. +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
  465. @@ -3,6 +3,7 @@
  466.  import net.sf.l2j.gameserver.model.World;
  467.  import net.sf.l2j.gameserver.model.WorldObject;
  468.  import net.sf.l2j.gameserver.model.actor.Player;
  469. +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
  470.  import net.sf.l2j.gameserver.model.entity.Duel.DuelState;
  471.  import net.sf.l2j.gameserver.network.SystemMessageId;
  472.  import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  473. @@ -57,6 +58,12 @@
  474.             return;
  475.         }
  476.        
  477. +       if (target instanceof Agathion)
  478. +       {
  479. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  480. +           return;
  481. +       }
  482. +      
  483.         target.onAction(player, false, _isShiftAction);
  484.     }
  485.    
  486. diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
  487. index 5bbd7e8..e091a24 100644
  488. --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
  489. +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
  490. @@ -3,6 +3,7 @@
  491.  import net.sf.l2j.gameserver.model.World;
  492.  import net.sf.l2j.gameserver.model.WorldObject;
  493.  import net.sf.l2j.gameserver.model.actor.Player;
  494. +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
  495.  import net.sf.l2j.gameserver.network.SystemMessageId;
  496.  import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  497.  
  498. @@ -54,6 +55,12 @@
  499.             return;
  500.         }
  501.        
  502. +       if (target instanceof Agathion)
  503. +       {
  504. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  505. +           return;
  506. +       }
  507. +      
  508.         // (player.getTarget() == target) -> This happens when you control + click a target without having had it selected beforehand. Behaves as the Action packet and will NOT trigger an attack.
  509.         target.onAction(player, (player.getTarget() == target), _isShiftAction);
  510.     }
  511. diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java
  512. index b9c239f..b603b41 100644
  513. --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java
  514. +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java
  515. @@ -58,6 +58,12 @@
  516.             return;
  517.         }
  518.        
  519. +       if (itemToRemove.isAgathion())
  520. +       {
  521. +           player.sendPacket(SystemMessageId.CANNOT_DISCARD_THIS_ITEM);
  522. +           return;
  523. +       }
  524. +      
  525.         if (itemToRemove.isEquipped() && (!itemToRemove.isStackable() || (itemToRemove.isStackable() && _count >= itemToRemove.getCount())))
  526.         {
  527.             final ItemInstance[] unequipped = player.getInventory().unequipItemInSlotAndRecord(itemToRemove.getLocationSlot());
  528. diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java
  529. index 6fc1ab5..1f91749 100644
  530. --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java
  531. +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java
  532. @@ -48,7 +48,7 @@
  533.         if (item.isQuestItem())
  534.             return;
  535.        
  536. -       if (_count > item.getCount())
  537. +       if (_count > item.getCount() || item.isAgathion())
  538.         {
  539.             player.sendPacket(SystemMessageId.CANNOT_DISCARD_THIS_ITEM);
  540.             return;
  541. diff --git aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java
  542. index cf1d5e5..d0942ad 100644
  543. --- aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java
  544. +++ aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java
  545. @@ -13,6 +13,7 @@
  546.  import net.sf.l2j.gameserver.model.actor.Creature;
  547.  import net.sf.l2j.gameserver.model.actor.Player;
  548.  import net.sf.l2j.gameserver.model.actor.Summon;
  549. +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
  550.  import net.sf.l2j.gameserver.model.actor.instance.Servitor;
  551.  import net.sf.l2j.gameserver.model.actor.instance.SiegeSummon;
  552.  import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  553. @@ -25,6 +26,7 @@
  554.     private final int _npcId;
  555.     private final float _expPenalty;
  556.     private final boolean _isCubic;
  557. +   private final boolean _isAgathion;
  558.    
  559.     private final int _activationTime;
  560.     private final int _activationChance;
  561. @@ -47,6 +49,7 @@
  562.         _npcId = set.getInteger("npcId", 0); // default for undescribed skills
  563.         _expPenalty = set.getFloat("expPenalty", 0.f);
  564.         _isCubic = set.getBool("isCubic", false);
  565. +       _isAgathion = set.getBool("isAgathion", false);
  566.        
  567.         _activationTime = set.getInteger("activationtime", 8);
  568.         _activationChance = set.getInteger("activationchance", 30);
  569. @@ -84,7 +87,7 @@
  570.                 if (player.isInObserverMode())
  571.                     return false;
  572.                
  573. -               if (player.getSummon() != null)
  574. +               if (!_isAgathion && player.getSummon() != null)
  575.                 {
  576.                     player.sendPacket(SystemMessageId.SUMMON_ONLY_ONE);
  577.                     return false;
  578. @@ -130,6 +133,34 @@
  579.         }
  580.         else
  581.         {
  582. +           if (_isAgathion)
  583. +           {
  584. +               NpcTemplate summonTemplate = NpcData.getInstance().getTemplate(_npcId);
  585. +
  586. +               if (summonTemplate == null)
  587. +               {
  588. +                   LOGGER.warn("Couldn't properly spawn with id {} ; the template is missing.", _npcId);
  589. +                   return;
  590. +               }
  591. +               if (activeChar.getAgathion() != null)
  592. +                   activeChar.getAgathion().unSummon(activeChar);
  593. +               Agathion summon;
  594. +               summon = new Agathion(IdFactory.getInstance().getNextId(), summonTemplate, activeChar);
  595. +               activeChar.setAgathion(summon);
  596. +               summon.getStatus().setMaxHpMp();
  597. +               summon.forceRunStance();
  598. +              
  599. +               final SpawnLocation spawnLoc = activeChar.getPosition().clone();
  600. +               spawnLoc.addStrictOffset(40);
  601. +               spawnLoc.setHeadingTo(activeChar.getPosition());
  602. +               spawnLoc.set(GeoEngine.getInstance().getValidLocation(activeChar, spawnLoc));
  603. +              
  604. +               summon.spawnMe(spawnLoc);
  605. +               summon.setInvul(true);
  606. +               summon.getAI().setFollowStatus(true);
  607. +               return;
  608. +           }
  609. +          
  610.             if (activeChar.getSummon() != null || activeChar.isMounted())
  611.                 return;
  612.            
  613. @@ -174,6 +205,11 @@
  614.         return _isCubic;
  615.     }
  616.    
  617. +   public final boolean isAgathion()
  618. +   {
  619. +       return _isAgathion;
  620. +   }
  621. +  
  622.     public final int getTotalLifeTime()
  623.     {
  624.         return _summonTotalLifeTime;
  625.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement