Advertisement
crymxz

Agathion Interlude aCis 401 Core

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