Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis
- diff --git aCis_game/config/npcs.properties aCis_game/config/npcs.properties
- index c05f8a9..2eea0f1 100644
- --- aCis_game/config/npcs.properties
- +++ aCis_game/config/npcs.properties
- @@ -201,4 +201,19 @@
- MinNPCAnimation = 20
- MaxNPCAnimation = 40
- MinMonsterAnimation = 10
- -MaxMonsterAnimation = 40
- \ No newline at end of file
- +MaxMonsterAnimation = 40
- +
- +# id of the skill to cast when the summon item is used, the standard skill is 2046 of all pets
- +SkillIdUseCastAgathion = 2046
- +
- +# It just follows the owner without doing any random social actions or movements.
- +AgathionOnlyFollow = False
- +
- +# Allow social action if the npc has any, every 1s has a 10% chance to perform a social action
- +AgathionAllowSocial = True
- +
- +# Heal the owner, only heal when he is not in certain conditions, pvp, with karma, oly, duel, pvp zone.
- +AgathionHealOwner = False
- +
- +# Percentage of health for when it will start healing the owner. 0.25 = 25%
- +AgathionPercentToHeal = 0.25
- \ No newline at end of file
- diff --git aCis_game/java/net/sf/l2j/Config.java aCis_game/java/net/sf/l2j/Config.java
- index 65daaa6..c0b79d0 100644
- --- aCis_game/java/net/sf/l2j/Config.java
- +++ aCis_game/java/net/sf/l2j/Config.java
- @@ -326,6 +326,13 @@
- public static int MIN_MONSTER_ANIMATION;
- public static int MAX_MONSTER_ANIMATION;
- + /** Agathion */
- + public static int SKILL_ID_AGATHION;
- + public static boolean AGATHION_ONLY_FOLLOW;
- + public static boolean AGATHION_ALLOW_SOCIAL;
- + public static boolean AGATHION_HEAL_OWNER;
- + public static double AGATHION_PERCENT_TO_HEAL;
- +
- // --------------------------------------------------
- // Players
- // --------------------------------------------------
- @@ -949,6 +956,12 @@
- MAX_NPC_ANIMATION = npcs.getProperty("MaxNPCAnimation", 40);
- MIN_MONSTER_ANIMATION = npcs.getProperty("MinMonsterAnimation", 10);
- MAX_MONSTER_ANIMATION = npcs.getProperty("MaxMonsterAnimation", 40);
- +
- + SKILL_ID_AGATHION = npcs.getProperty("SkillIdUseCastAgathion", 2046);
- + AGATHION_ONLY_FOLLOW = npcs.getProperty("AgathionOnlyFollow", false);
- + AGATHION_ALLOW_SOCIAL = npcs.getProperty("AgathionAllowSocial", true);
- + AGATHION_HEAL_OWNER = npcs.getProperty("AgathionHealOwner", false);
- + AGATHION_PERCENT_TO_HEAL = npcs.getProperty("AgathionPercentToHeal", 0.25);
- }
- /**
- diff --git aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
- index 1792260..268ba86 100644
- --- aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
- +++ aCis_game/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
- @@ -2,6 +2,7 @@
- import java.util.List;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.SkillTable;
- import net.sf.l2j.gameserver.data.xml.NpcData;
- import net.sf.l2j.gameserver.data.xml.SummonItemData;
- @@ -41,6 +42,25 @@
- final IntIntHolder sitem = SummonItemData.getInstance().getSummonItem(item.getItemId());
- + final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(sitem.getId());
- + if (npcTemplate == null)
- + return;
- +
- + if (npcTemplate.getType().equalsIgnoreCase("Agathion"))
- + {
- + if (player.getAgathion() != null)
- + {
- + player.getAgathion().unSummon(player);
- + item.setAgathion(player, false);
- + player.sendMessage("Agathion has been unsummoned");
- + return;
- + }
- + item.setAgathion(player, true);
- + item.checkProtected(player);
- + player.getAI().tryToCast(player, SkillTable.getInstance().getInfo(Config.SKILL_ID_AGATHION, 1), false, false, item.getObjectId());
- + return;
- + }
- +
- if ((player.getSummon() != null || player.isMounted()) && sitem.getValue() > 0)
- {
- player.sendPacket(SystemMessageId.SUMMON_ONLY_ONE);
- @@ -53,10 +73,6 @@
- return;
- }
- - final NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(sitem.getId());
- - if (npcTemplate == null)
- - return;
- -
- switch (sitem.getValue())
- {
- case 0: // static summons (like Christmas tree)
- diff --git aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java
- index 30cc469..3881cd3 100644
- --- aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java
- +++ aCis_game/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonCreature.java
- @@ -6,10 +6,12 @@
- import net.sf.l2j.gameserver.enums.skills.SkillType;
- import net.sf.l2j.gameserver.geoengine.GeoEngine;
- import net.sf.l2j.gameserver.handler.ISkillHandler;
- +import net.sf.l2j.gameserver.idfactory.IdFactory;
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.WorldObject;
- import net.sf.l2j.gameserver.model.actor.Creature;
- import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
- import net.sf.l2j.gameserver.model.actor.instance.Pet;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- import net.sf.l2j.gameserver.model.holder.IntIntHolder;
- @@ -41,10 +43,6 @@
- if (item.getOwnerId() != player.getObjectId() || item.getLocation() != ItemLocation.INVENTORY)
- return;
- - // Owner has a pet listed in world.
- - if (World.getInstance().getPet(player.getObjectId()) != null)
- - return;
- -
- // Check summon item validity.
- final IntIntHolder summonItem = SummonItemData.getInstance().getSummonItem(item.getItemId());
- if (summonItem == null)
- @@ -55,6 +53,34 @@
- if (npcTemplate == null)
- return;
- + if (npcTemplate.getType().equalsIgnoreCase("Agathion"))
- + {
- + if (player.getAgathion() != null)
- + player.getAgathion().unSummon(player);
- +
- + Agathion summon;
- + summon = new Agathion(IdFactory.getInstance().getNextId(), npcTemplate, player);
- + player.setAgathion(summon);
- +
- + summon.getStatus().setMaxHpMp();
- + summon.forceRunStance();
- +
- + final SpawnLocation spawnLoc = activeChar.getPosition().clone();
- + spawnLoc.addStrictOffset(40);
- + spawnLoc.setHeadingTo(activeChar.getPosition());
- + spawnLoc.set(GeoEngine.getInstance().getValidLocation(activeChar, spawnLoc));
- +
- + summon.spawnMe(spawnLoc);
- + summon.setInvul(true);
- + summon.getAI().setFollowStatus(true);
- + item.setAgathionItem(player);
- + return;
- + }
- +
- + // Owner has a pet listed in world.
- + if (World.getInstance().getPet(player.getObjectId()) != null)
- + return;
- +
- // Add the pet instance to world.
- final Pet pet = Pet.restore(item, npcTemplate, player);
- if (pet == null)
- diff --git aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java
- index 023516a..64c28dd 100644
- --- aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java
- +++ aCis_game/java/net/sf/l2j/gameserver/model/actor/Player.java
- @@ -107,6 +107,7 @@
- import net.sf.l2j.gameserver.model.actor.container.player.Request;
- import net.sf.l2j.gameserver.model.actor.container.player.ShortcutList;
- import net.sf.l2j.gameserver.model.actor.container.player.SubClass;
- +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
- import net.sf.l2j.gameserver.model.actor.instance.Door;
- import net.sf.l2j.gameserver.model.actor.instance.FestivalMonster;
- import net.sf.l2j.gameserver.model.actor.instance.Folk;
- @@ -373,6 +374,7 @@
- private final QuestList _questList = new QuestList(this);
- private Summon _summon;
- + private Agathion aga;
- private TamedBeast _tamedBeast;
- private int _partyRoom;
- @@ -6489,6 +6491,9 @@
- else if (_summon != null)
- _summon.unSummon(this);
- + if (getAgathion() != null)
- + aga.unSummon(this);
- +
- // Stop all scheduled tasks.
- stopChargeTask();
- @@ -7407,4 +7412,14 @@
- return gms;
- }
- +
- + public void setAgathion(Agathion aga)
- + {
- + this.aga = aga;
- + }
- +
- + public Agathion getAgathion()
- + {
- + return aga;
- + }
- }
- \ No newline at end of file
- 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
- index f666547..778fc12 100644
- --- aCis_game/java/net/sf/l2j/gameserver/model/actor/cast/PlayerCast.java
- +++ aCis_game/java/net/sf/l2j/gameserver/model/actor/cast/PlayerCast.java
- @@ -273,7 +273,7 @@
- switch (skill.getSkillType())
- {
- case SUMMON:
- - if (!((L2SkillSummon) skill).isCubic() && (_actor.getSummon() != null || _actor.isMounted()))
- + if (!((L2SkillSummon) skill).isAgathion() && !((L2SkillSummon) skill).isCubic() && (_actor.getSummon() != null || _actor.isMounted()))
- {
- _actor.sendPacket(SystemMessageId.SUMMON_ONLY_ONE);
- return false;
- 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
- new file mode 100644
- index 0000000..584ac24
- --- /dev/null
- +++ aCis_game/java/net/sf/l2j/gameserver/model/actor/instance/Agathion.java
- @@ -0,0 +1,133 @@
- +package net.sf.l2j.gameserver.model.actor.instance;
- +
- +import java.util.concurrent.Future;
- +
- +import net.sf.l2j.commons.math.MathUtil;
- +import net.sf.l2j.commons.pool.ThreadPool;
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.enums.ZoneId;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- +import net.sf.l2j.gameserver.model.location.Location;
- +import net.sf.l2j.gameserver.model.location.SpawnLocation;
- +import net.sf.l2j.gameserver.network.serverpackets.PetDelete;
- +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
- +
- +/**
- + * @author maxi5
- + *
- + */
- +public class Agathion extends Npc
- +{
- + private Player _owner;
- + private Future<?> _followTask;
- +
- + private ItemInstance item;
- +
- + public Agathion(int objectId, NpcTemplate template, Player owner)
- + {
- + super(objectId, template);
- +
- + // Set the magical circle animation.
- + setShowSummonAnimation(true);
- +
- + // Set the Player owner.
- + _owner = owner;
- + }
- +
- + @Override
- + public void onSpawn()
- + {
- + followToOwner();
- + super.onSpawn();
- + }
- +
- + public void unSummon(Player owner)
- + {
- + // Abort attack, cast and move.
- + abortAll(true);
- +
- + if (item != null)
- + item.setAgathion(owner, false);
- +
- + owner.sendPacket(new PetDelete(2, getObjectId()));
- + owner.setAgathion(null);
- +
- + if (owner.getSummon() != null)
- + owner.getSummon().sendInfo(owner);
- + owner.broadcastUserInfo();
- +
- + if (_followTask != null)
- + _followTask.cancel(true);
- +
- + decayMe();
- + deleteMe();
- +
- + super.deleteMe();
- + }
- +
- + public void followToOwner()
- + {
- + if (_followTask == null)
- + _followTask = ThreadPool.scheduleAtFixedRate(new Follow(this), 1000, 1000);
- +
- + SpawnLocation loc = _owner.getPosition();
- + final int rnd = Rnd.get(-30, +30);
- + final boolean action = Rnd.get(100) < 15;
- +
- + if (!checkIfInRange(2000, this, _owner))
- + teleportTo(_owner.getPosition(), 30);
- + else if (!checkIfInRange(1000, this, _owner))
- + instantTeleportTo(_owner.getPosition(), 30);
- +
- + if (_owner.isMoving())
- + getAI().tryToFollow(_owner, false);
- + else
- + {
- + if (checkIfInRange(30, this, _owner))
- + getAI().tryToIdle();
- + if (!Config.AGATHION_ONLY_FOLLOW && (!checkIfInRange(75, this, _owner) || action))
- + getAI().tryToMoveTo(new Location(loc.getX()+rnd, loc.getY()+rnd, loc.getZ()), null);
- + if (Config.AGATHION_HEAL_OWNER && !action && !getCast().isCastingNow())
- + {
- + if (_owner.isInOlympiadMode() || _owner.isInDuel() || _owner.getPvpFlag() != 0 || _owner.isInsideZone(ZoneId.PVP) || _owner.getKarma() != 0)
- + return;
- +
- + if ((_owner.getStatus().getHpRatio() < Config.AGATHION_PERCENT_TO_HEAL))
- + getAI().tryToCast(_owner, 1011, 18);
- + }
- + else if (!Config.AGATHION_ONLY_FOLLOW && Config.AGATHION_ALLOW_SOCIAL && !isMoving() && action && !getCast().isCastingNow())
- + broadcastPacket(new SocialAction(this, 1));
- + }
- + }
- +
- + private static class Follow implements Runnable
- + {
- + private final Agathion agathion;
- +
- + protected Follow(Agathion aga)
- + {
- + agathion = aga;
- + }
- +
- + @Override
- + public void run()
- + {
- + agathion.followToOwner();
- + }
- + }
- +
- + public static boolean checkIfInRange(int range, Npc npc, Player player)
- + {
- + return MathUtil.checkIfInRange((int) (range + npc.getCollisionRadius()), npc, player, true);
- + }
- +
- + public void setAgathionItem(ItemInstance item)
- + {
- + this.item = item;
- + }
- +}
- \ No newline at end of file
- 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
- index 8429f78..940e74b 100644
- --- aCis_game/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
- +++ aCis_game/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
- @@ -4,6 +4,7 @@
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.util.List;
- +import java.util.concurrent.Future;
- import java.util.concurrent.ScheduledFuture;
- import java.util.concurrent.locks.ReentrantLock;
- import java.util.logging.Level;
- @@ -104,6 +105,9 @@
- private int _shotsMask = 0;
- + private boolean isAgathion;
- + private Future<?> _protectedTask;
- +
- /**
- * Constructor of the ItemInstance from the objectId and the itemId.
- * @param objectId : int designating the ID of the object in the world
- @@ -487,7 +491,7 @@
- */
- public boolean isDropable()
- {
- - return isAugmented() ? false : _item.isDropable();
- + return isAgathion || isAugmented() ? false : _item.isDropable();
- }
- /**
- @@ -495,7 +499,7 @@
- */
- public boolean isDestroyable()
- {
- - return isQuestItem() ? false : _item.isDestroyable();
- + return isAgathion || isQuestItem() ? false : _item.isDestroyable();
- }
- /**
- @@ -503,7 +507,7 @@
- */
- public boolean isTradable()
- {
- - return isAugmented() ? false : _item.isTradable();
- + return isAgathion || isAugmented() ? false : _item.isTradable();
- }
- /**
- @@ -521,7 +525,7 @@
- public boolean isDepositable(boolean isPrivateWareHouse)
- {
- // equipped, hero and quest items
- - if (isEquipped() || !_item.isDepositable())
- + if (isEquipped() || !_item.isDepositable() || isAgathion)
- return false;
- if (!isPrivateWareHouse)
- @@ -1275,4 +1279,47 @@
- return Integer.compare(item.getObjectId(), getObjectId());
- }
- +
- + public void setAgathion(Player player, boolean isAgathion)
- + {
- + this.isAgathion = isAgathion;
- + }
- +
- + public void checkProtected(Player player)
- + {
- + if (_protectedTask != null)
- + _protectedTask.cancel(true);
- + _protectedTask = ThreadPool.schedule(new Protected(player), 5500);
- + }
- +
- + public boolean isAgathion()
- + {
- + return isAgathion;
- + }
- +
- + public void setAgathionItem(Player player)
- + {
- + player.getAgathion().setAgathionItem(this);
- + }
- +
- + private class Protected implements Runnable
- + {
- + private final Player player;
- +
- + protected Protected(Player player)
- + {
- + this.player = player;
- + }
- +
- + @Override
- + public void run()
- + {
- + if (player.getAgathion() != null)
- + isAgathion = true;
- + else
- + isAgathion = false;
- + if (_protectedTask != null)
- + _protectedTask.cancel(true);
- + }
- + }
- }
- \ No newline at end of file
- diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
- index e963ca2..781a634 100644
- --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
- +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
- @@ -3,6 +3,7 @@
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.WorldObject;
- import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
- import net.sf.l2j.gameserver.model.entity.Duel.DuelState;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- @@ -57,6 +58,12 @@
- return;
- }
- + if (target instanceof Agathion)
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- target.onAction(player, false, _isShiftAction);
- }
- diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
- index 5bbd7e8..e091a24 100644
- --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
- +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/AttackRequest.java
- @@ -3,6 +3,7 @@
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.WorldObject;
- import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- @@ -54,6 +55,12 @@
- return;
- }
- + if (target instanceof Agathion)
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- // (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.
- target.onAction(player, (player.getTarget() == target), _isShiftAction);
- }
- diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java
- index b9c239f..b603b41 100644
- --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java
- +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDestroyItem.java
- @@ -58,6 +58,12 @@
- return;
- }
- + if (itemToRemove.isAgathion())
- + {
- + player.sendPacket(SystemMessageId.CANNOT_DISCARD_THIS_ITEM);
- + return;
- + }
- +
- if (itemToRemove.isEquipped() && (!itemToRemove.isStackable() || (itemToRemove.isStackable() && _count >= itemToRemove.getCount())))
- {
- final ItemInstance[] unequipped = player.getInventory().unequipItemInSlotAndRecord(itemToRemove.getLocationSlot());
- diff --git aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java
- index 6fc1ab5..1f91749 100644
- --- aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java
- +++ aCis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestDropItem.java
- @@ -48,7 +48,7 @@
- if (item.isQuestItem())
- return;
- - if (_count > item.getCount())
- + if (_count > item.getCount() || item.isAgathion())
- {
- player.sendPacket(SystemMessageId.CANNOT_DISCARD_THIS_ITEM);
- return;
- diff --git aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java
- index cf1d5e5..d0942ad 100644
- --- aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java
- +++ aCis_game/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java
- @@ -13,6 +13,7 @@
- import net.sf.l2j.gameserver.model.actor.Creature;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.actor.Summon;
- +import net.sf.l2j.gameserver.model.actor.instance.Agathion;
- import net.sf.l2j.gameserver.model.actor.instance.Servitor;
- import net.sf.l2j.gameserver.model.actor.instance.SiegeSummon;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- @@ -25,6 +26,7 @@
- private final int _npcId;
- private final float _expPenalty;
- private final boolean _isCubic;
- + private final boolean _isAgathion;
- private final int _activationTime;
- private final int _activationChance;
- @@ -47,6 +49,7 @@
- _npcId = set.getInteger("npcId", 0); // default for undescribed skills
- _expPenalty = set.getFloat("expPenalty", 0.f);
- _isCubic = set.getBool("isCubic", false);
- + _isAgathion = set.getBool("isAgathion", false);
- _activationTime = set.getInteger("activationtime", 8);
- _activationChance = set.getInteger("activationchance", 30);
- @@ -84,7 +87,7 @@
- if (player.isInObserverMode())
- return false;
- - if (player.getSummon() != null)
- + if (!_isAgathion && player.getSummon() != null)
- {
- player.sendPacket(SystemMessageId.SUMMON_ONLY_ONE);
- return false;
- @@ -130,6 +133,34 @@
- }
- else
- {
- + if (_isAgathion)
- + {
- + NpcTemplate summonTemplate = NpcData.getInstance().getTemplate(_npcId);
- +
- + if (summonTemplate == null)
- + {
- + LOGGER.warn("Couldn't properly spawn with id {} ; the template is missing.", _npcId);
- + return;
- + }
- + if (activeChar.getAgathion() != null)
- + activeChar.getAgathion().unSummon(activeChar);
- + Agathion summon;
- + summon = new Agathion(IdFactory.getInstance().getNextId(), summonTemplate, activeChar);
- + activeChar.setAgathion(summon);
- + summon.getStatus().setMaxHpMp();
- + summon.forceRunStance();
- +
- + final SpawnLocation spawnLoc = activeChar.getPosition().clone();
- + spawnLoc.addStrictOffset(40);
- + spawnLoc.setHeadingTo(activeChar.getPosition());
- + spawnLoc.set(GeoEngine.getInstance().getValidLocation(activeChar, spawnLoc));
- +
- + summon.spawnMe(spawnLoc);
- + summon.setInvul(true);
- + summon.getAI().setFollowStatus(true);
- + return;
- + }
- +
- if (activeChar.getSummon() != null || activeChar.isMounted())
- return;
- @@ -174,6 +205,11 @@
- return _isCubic;
- }
- + public final boolean isAgathion()
- + {
- + return _isAgathion;
- + }
- +
- public final int getTotalLifeTime()
- {
- return _summonTotalLifeTime;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement