Code improvements.
This commit is contained in:
@@ -202,12 +202,7 @@ public class L2Attackable extends L2Npc
|
||||
*/
|
||||
public void useMagic(Skill skill)
|
||||
{
|
||||
if ((skill == null) || isAlikeDead() || skill.isPassive() || isCastingNow() || isSkillDisabled(skill))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((getCurrentMp() < (getStat().getMpConsume(skill) + getStat().getMpInitialConsume(skill))) || (getCurrentHp() <= skill.getHpConsume()))
|
||||
if ((skill == null) || isAlikeDead() || skill.isPassive() || isCastingNow() || isSkillDisabled(skill) || (getCurrentMp() < (getStat().getMpConsume(skill) + getStat().getMpInitialConsume(skill))) || (getCurrentHp() <= skill.getHpConsume()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -351,8 +346,7 @@ public class L2Attackable extends L2Npc
|
||||
final int hpRestore = (int) killer.getStat().calcStat(Stats.HP_RESTORE_ON_KILL, 0, null, null);
|
||||
if (hpRestore > 0)
|
||||
{
|
||||
double amount = (killer.getMaxHp() * hpRestore) / 100;
|
||||
amount = Math.max(Math.min(amount, killer.getMaxRecoverableHp() - killer.getCurrentHp()), 0);
|
||||
final double amount = Math.max(Math.min(((killer.getMaxHp() * hpRestore) / 100), killer.getMaxRecoverableHp() - killer.getCurrentHp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
killer.setCurrentHp(amount + killer.getCurrentHp());
|
||||
@@ -366,8 +360,7 @@ public class L2Attackable extends L2Npc
|
||||
final L2MonsterInstance mob = (L2MonsterInstance) this;
|
||||
if ((mob.getLeader() != null) && mob.getLeader().hasMinions())
|
||||
{
|
||||
final int respawnTime = Config.MINIONS_RESPAWN_TIME.containsKey(getId()) ? Config.MINIONS_RESPAWN_TIME.get(getId()) * 1000 : -1;
|
||||
mob.getLeader().getMinionList().onMinionDie(mob, respawnTime);
|
||||
mob.getLeader().getMinionList().onMinionDie(mob, (Config.MINIONS_RESPAWN_TIME.containsKey(getId()) ? Config.MINIONS_RESPAWN_TIME.get(getId()) * 1000 : -1));
|
||||
}
|
||||
|
||||
if (mob.hasMinions())
|
||||
@@ -571,14 +564,7 @@ public class L2Attackable extends L2Npc
|
||||
|
||||
if (partyPlayer.getLevel() > partyLvl)
|
||||
{
|
||||
if (attackerParty.isInCommandChannel())
|
||||
{
|
||||
partyLvl = attackerParty.getCommandChannel().getLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
partyLvl = partyPlayer.getLevel();
|
||||
}
|
||||
partyLvl = attackerParty.isInCommandChannel() ? attackerParty.getCommandChannel().getLevel() : partyPlayer.getLevel();
|
||||
}
|
||||
}
|
||||
rewards.remove(partyPlayer); // Remove the L2PcInstance from the L2Attackable rewards
|
||||
@@ -592,14 +578,7 @@ public class L2Attackable extends L2Npc
|
||||
rewardedMembers.add(partyPlayer);
|
||||
if (partyPlayer.getLevel() > partyLvl)
|
||||
{
|
||||
if (attackerParty.isInCommandChannel())
|
||||
{
|
||||
partyLvl = attackerParty.getCommandChannel().getLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
partyLvl = partyPlayer.getLevel();
|
||||
}
|
||||
partyLvl = attackerParty.isInCommandChannel() ? attackerParty.getCommandChannel().getLevel() : partyPlayer.getLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1037,32 +1016,34 @@ public class L2Attackable extends L2Npc
|
||||
}
|
||||
|
||||
// Apply Special Item drop with random(rnd) quantity(qty) for champions.
|
||||
if (Config.L2JMOD_CHAMPION_ENABLE && isChampion() && ((Config.L2JMOD_CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE > 0) || (Config.L2JMOD_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE > 0)))
|
||||
if (!Config.L2JMOD_CHAMPION_ENABLE || !isChampion() || ((Config.L2JMOD_CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE <= 0) && (Config.L2JMOD_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE <= 0)))
|
||||
{
|
||||
int champqty = Rnd.get(Config.L2JMOD_CHAMPION_REWARD_QTY);
|
||||
final ItemHolder item = new ItemHolder(Config.L2JMOD_CHAMPION_REWARD_ID, ++champqty);
|
||||
|
||||
if ((player.getLevel() <= getLevel()) && (Rnd.get(100) < Config.L2JMOD_CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE))
|
||||
return;
|
||||
}
|
||||
|
||||
int champqty = Rnd.get(Config.L2JMOD_CHAMPION_REWARD_QTY);
|
||||
final ItemHolder item = new ItemHolder(Config.L2JMOD_CHAMPION_REWARD_ID, ++champqty);
|
||||
|
||||
if ((player.getLevel() <= getLevel()) && (Rnd.get(100) < Config.L2JMOD_CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE))
|
||||
{
|
||||
if (Config.AUTO_LOOT || isFlying())
|
||||
{
|
||||
if (Config.AUTO_LOOT || isFlying())
|
||||
{
|
||||
player.addItem("ChampionLoot", item.getId(), item.getCount(), this, true); // Give the item(s) to the L2PcInstance that has killed the L2Attackable
|
||||
}
|
||||
else
|
||||
{
|
||||
dropItem(player, item);
|
||||
}
|
||||
player.addItem("ChampionLoot", item.getId(), item.getCount(), this, true); // Give the item(s) to the L2PcInstance that has killed the L2Attackable
|
||||
}
|
||||
else if ((player.getLevel() > getLevel()) && (Rnd.get(100) < Config.L2JMOD_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE))
|
||||
else
|
||||
{
|
||||
if (Config.AUTO_LOOT || isFlying())
|
||||
{
|
||||
player.addItem("ChampionLoot", item.getId(), item.getCount(), this, true); // Give the item(s) to the L2PcInstance that has killed the L2Attackable
|
||||
}
|
||||
else
|
||||
{
|
||||
dropItem(player, item);
|
||||
}
|
||||
dropItem(player, item);
|
||||
}
|
||||
}
|
||||
else if ((player.getLevel() > getLevel()) && (Rnd.get(100) < Config.L2JMOD_CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE))
|
||||
{
|
||||
if (Config.AUTO_LOOT || isFlying())
|
||||
{
|
||||
player.addItem("ChampionLoot", item.getId(), item.getCount(), this, true); // Give the item(s) to the L2PcInstance that has killed the L2Attackable
|
||||
}
|
||||
else
|
||||
{
|
||||
dropItem(player, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1091,12 +1072,7 @@ public class L2Attackable extends L2Npc
|
||||
final L2PcInstance player = lastAttacker.getActingPlayer();
|
||||
|
||||
// Don't drop anything if the last attacker or owner isn't L2PcInstance
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getLevel() - getLevel()) > 9)
|
||||
if ((player == null) || ((player.getLevel() - getLevel()) > 9))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1202,15 +1178,15 @@ public class L2Attackable extends L2Npc
|
||||
*/
|
||||
public boolean isOldCorpse(L2PcInstance attacker, int remainingTime, boolean sendMessage)
|
||||
{
|
||||
if (isDead() && (DecayTaskManager.getInstance().getRemainingTime(this) < remainingTime))
|
||||
if (!isDead() || (DecayTaskManager.getInstance().getRemainingTime(this) >= remainingTime))
|
||||
{
|
||||
if (sendMessage && (attacker != null))
|
||||
{
|
||||
attacker.sendPacket(SystemMessageId.THE_CORPSE_IS_TOO_OLD_THE_SKILL_CANNOT_BE_USED);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
if (sendMessage && (attacker != null))
|
||||
{
|
||||
attacker.sendPacket(SystemMessageId.THE_CORPSE_IS_TOO_OLD_THE_SKILL_CANNOT_BE_USED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1220,15 +1196,15 @@ public class L2Attackable extends L2Npc
|
||||
*/
|
||||
public boolean checkSpoilOwner(L2PcInstance sweeper, boolean sendMessage)
|
||||
{
|
||||
if ((sweeper.getObjectId() != getSpoilerObjectId()) && !sweeper.isInLooterParty(getSpoilerObjectId()))
|
||||
if ((sweeper.getObjectId() == getSpoilerObjectId()) || sweeper.isInLooterParty(getSpoilerObjectId()))
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
sweeper.sendPacket(SystemMessageId.THERE_ARE_NO_PRIORITY_RIGHTS_ON_A_SWEEPER);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
if (sendMessage)
|
||||
{
|
||||
sweeper.sendPacket(SystemMessageId.THERE_ARE_NO_PRIORITY_RIGHTS_ON_A_SWEEPER);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1407,13 +1383,7 @@ public class L2Attackable extends L2Npc
|
||||
overhitPercentage = 25;
|
||||
}
|
||||
|
||||
// Get the overhit exp bonus according to the above over-hit damage percentage
|
||||
// (1/1 basis - 13% of over-hit damage, 13% of extra exp is given, and so on...)
|
||||
final double overhitExp = ((overhitPercentage / 100) * normalExp);
|
||||
|
||||
// Return the rounded ammount of exp points to be added to the player's normal exp reward
|
||||
final long bonusOverhit = Math.round(overhitExp);
|
||||
return bonusOverhit;
|
||||
return Math.round(((overhitPercentage / 100) * normalExp));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1448,12 +1418,9 @@ public class L2Attackable extends L2Npc
|
||||
setWalking();
|
||||
|
||||
// check the region where this mob is, do not activate the AI if region is inactive.
|
||||
if (!isInActiveRegion())
|
||||
if (!isInActiveRegion() && hasAI())
|
||||
{
|
||||
if (hasAI())
|
||||
{
|
||||
getAI().stopAITask();
|
||||
}
|
||||
getAI().stopAITask();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1490,66 +1457,67 @@ public class L2Attackable extends L2Npc
|
||||
*/
|
||||
public final void setSeeded(L2PcInstance seeder)
|
||||
{
|
||||
if ((_seed != null) && (_seederObjId == seeder.getObjectId()))
|
||||
if ((_seed == null) || (_seederObjId != seeder.getObjectId()))
|
||||
{
|
||||
_seeded = true;
|
||||
|
||||
int count = 1;
|
||||
for (int skillId : getTemplate().getSkills().keySet())
|
||||
return;
|
||||
}
|
||||
|
||||
_seeded = true;
|
||||
int count = 1;
|
||||
for (int skillId : getTemplate().getSkills().keySet())
|
||||
{
|
||||
switch (skillId)
|
||||
{
|
||||
switch (skillId)
|
||||
case 4303: // Strong type x2
|
||||
{
|
||||
case 4303: // Strong type x2
|
||||
{
|
||||
count *= 2;
|
||||
break;
|
||||
}
|
||||
case 4304: // Strong type x3
|
||||
{
|
||||
count *= 3;
|
||||
break;
|
||||
}
|
||||
case 4305: // Strong type x4
|
||||
{
|
||||
count *= 4;
|
||||
break;
|
||||
}
|
||||
case 4306: // Strong type x5
|
||||
{
|
||||
count *= 5;
|
||||
break;
|
||||
}
|
||||
case 4307: // Strong type x6
|
||||
{
|
||||
count *= 6;
|
||||
break;
|
||||
}
|
||||
case 4308: // Strong type x7
|
||||
{
|
||||
count *= 7;
|
||||
break;
|
||||
}
|
||||
case 4309: // Strong type x8
|
||||
{
|
||||
count *= 8;
|
||||
break;
|
||||
}
|
||||
case 4310: // Strong type x9
|
||||
{
|
||||
count *= 9;
|
||||
break;
|
||||
}
|
||||
count *= 2;
|
||||
break;
|
||||
}
|
||||
case 4304: // Strong type x3
|
||||
{
|
||||
count *= 3;
|
||||
break;
|
||||
}
|
||||
case 4305: // Strong type x4
|
||||
{
|
||||
count *= 4;
|
||||
break;
|
||||
}
|
||||
case 4306: // Strong type x5
|
||||
{
|
||||
count *= 5;
|
||||
break;
|
||||
}
|
||||
case 4307: // Strong type x6
|
||||
{
|
||||
count *= 6;
|
||||
break;
|
||||
}
|
||||
case 4308: // Strong type x7
|
||||
{
|
||||
count *= 7;
|
||||
break;
|
||||
}
|
||||
case 4309: // Strong type x8
|
||||
{
|
||||
count *= 8;
|
||||
break;
|
||||
}
|
||||
case 4310: // Strong type x9
|
||||
{
|
||||
count *= 9;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// hi-lvl mobs bonus
|
||||
final int diff = getLevel() - _seed.getLevel() - 5;
|
||||
if (diff > 0)
|
||||
{
|
||||
count += diff;
|
||||
}
|
||||
_harvestItem.set(new ItemHolder(_seed.getCropId(), count * Config.RATE_DROP_MANOR));
|
||||
}
|
||||
|
||||
// hi-lvl mobs bonus
|
||||
final int diff = getLevel() - _seed.getLevel() - 5;
|
||||
if (diff > 0)
|
||||
{
|
||||
count += diff;
|
||||
}
|
||||
_harvestItem.set(new ItemHolder(_seed.getCropId(), count * Config.RATE_DROP_MANOR));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1559,11 +1527,12 @@ public class L2Attackable extends L2Npc
|
||||
*/
|
||||
public final void setSeeded(L2Seed seed, L2PcInstance seeder)
|
||||
{
|
||||
if (!_seeded)
|
||||
if (_seeded)
|
||||
{
|
||||
_seed = seed;
|
||||
_seederObjId = seeder.getObjectId();
|
||||
return;
|
||||
}
|
||||
_seed = seed;
|
||||
_seederObjId = seeder.getObjectId();
|
||||
}
|
||||
|
||||
public final int getSeederId()
|
||||
@@ -1655,13 +1624,9 @@ public class L2Attackable extends L2Npc
|
||||
}
|
||||
|
||||
final float divider = (getLevel() > 0) && (getExpReward() > 0) ? (getTemplate().getBaseHpMax() * 9 * getLevel() * getLevel()) / (100 * getExpReward()) : 0;
|
||||
if (divider == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// negative value - vitality will be consumed
|
||||
return (int) (-Math.min(damage, getMaxHp()) / divider);
|
||||
return divider == 0 ? 0 : (int) (-Math.min(damage, getMaxHp()) / divider);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1669,12 +1634,7 @@ public class L2Attackable extends L2Npc
|
||||
*/
|
||||
public boolean useVitalityRate()
|
||||
{
|
||||
if (isChampion() && !Config.L2JMOD_CHAMPION_ENABLE_VITALITY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return (!isChampion() || Config.L2JMOD_CHAMPION_ENABLE_VITALITY);
|
||||
}
|
||||
|
||||
/** Return True if the L2Character is RaidBoss or his minion. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2CharTemplate;
|
||||
@@ -57,9 +55,7 @@ public abstract class L2Decoy extends L2Character
|
||||
@Override
|
||||
public void updateAbnormalVisualEffects()
|
||||
{
|
||||
final Collection<L2PcInstance> plrs = getKnownList().getKnownPlayers().values();
|
||||
|
||||
for (L2PcInstance player : plrs)
|
||||
for (L2PcInstance player : getKnownList().getKnownPlayers().values())
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
@@ -130,16 +126,17 @@ public abstract class L2Decoy extends L2Character
|
||||
|
||||
public synchronized void unSummon(L2PcInstance owner)
|
||||
{
|
||||
if (isVisible() && !isDead())
|
||||
if (!isVisible() || isDead())
|
||||
{
|
||||
if (getWorldRegion() != null)
|
||||
{
|
||||
getWorldRegion().removeFromZones(this);
|
||||
}
|
||||
owner.setDecoy(null);
|
||||
decayMe();
|
||||
getKnownList().removeAllKnownObjects();
|
||||
return;
|
||||
}
|
||||
if (getWorldRegion() != null)
|
||||
{
|
||||
getWorldRegion().removeFromZones(this);
|
||||
}
|
||||
owner.setDecoy(null);
|
||||
decayMe();
|
||||
getKnownList().removeAllKnownObjects();
|
||||
}
|
||||
|
||||
public final L2PcInstance getOwner()
|
||||
|
||||
@@ -433,9 +433,7 @@ public class L2Npc extends L2Character
|
||||
@Override
|
||||
public void updateAbnormalVisualEffects()
|
||||
{
|
||||
// Send a Server->Client packet NpcInfo with state of abnormal effect to all L2PcInstance in the _KnownPlayers of the L2NpcInstance
|
||||
final Collection<L2PcInstance> plrs = getKnownList().getKnownPlayers().values();
|
||||
for (L2PcInstance player : plrs)
|
||||
for (L2PcInstance player : getKnownList().getKnownPlayers().values())
|
||||
{
|
||||
if ((player == null) || !isVisibleFor(player))
|
||||
{
|
||||
@@ -541,15 +539,13 @@ public class L2Npc extends L2Character
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
if (player.isLockedTarget() && (player.getLockedTarget() != this))
|
||||
if (!player.isLockedTarget() || (player.getLockedTarget() == this))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.FAILED_TO_CHANGE_ENMITY);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
// TODO: More checks...
|
||||
|
||||
return true;
|
||||
player.sendPacket(SystemMessageId.FAILED_TO_CHANGE_ENMITY);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canInteract(L2PcInstance player)
|
||||
@@ -647,13 +643,7 @@ public class L2Npc extends L2Character
|
||||
public final Castle getCastle(long maxDistance)
|
||||
{
|
||||
final int index = CastleManager.getInstance().findNearestCastleIndex(this, maxDistance);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return CastleManager.getInstance().getCastles().get(index);
|
||||
return index < 0 ? null : CastleManager.getInstance().getCastles().get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -676,12 +666,7 @@ public class L2Npc extends L2Character
|
||||
}
|
||||
}
|
||||
|
||||
if (_fortIndex < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return FortManager.getInstance().getForts().get(_fortIndex);
|
||||
return _fortIndex < 0 ? null : FortManager.getInstance().getForts().get(_fortIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -692,13 +677,7 @@ public class L2Npc extends L2Character
|
||||
public final Fort getFort(long maxDistance)
|
||||
{
|
||||
final int index = FortManager.getInstance().findNearestFortIndex(this, maxDistance);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return FortManager.getInstance().getForts().get(index);
|
||||
return index < 0 ? null : FortManager.getInstance().getForts().get(index);
|
||||
}
|
||||
|
||||
public final boolean getIsInTown()
|
||||
@@ -776,12 +755,7 @@ public class L2Npc extends L2Character
|
||||
// Get the weapon item equipped in the right hand of the L2NpcInstance
|
||||
final L2Item item = ItemTable.getInstance().getTemplate(getTemplate().getRHandId());
|
||||
|
||||
if (!(item instanceof L2Weapon))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (L2Weapon) item;
|
||||
return !(item instanceof L2Weapon) ? null : (L2Weapon) item;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -809,12 +783,7 @@ public class L2Npc extends L2Character
|
||||
// Get the weapon item equipped in the right hand of the L2NpcInstance
|
||||
final L2Item item = ItemTable.getInstance().getTemplate(getTemplate().getLHandId());
|
||||
|
||||
if (!(item instanceof L2Weapon))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (L2Weapon) item;
|
||||
return !(item instanceof L2Weapon) ? null : (L2Weapon) item;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -842,16 +811,7 @@ public class L2Npc extends L2Character
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
final String pom = val == 0 ? "" + npcId : npcId + "-" + val;
|
||||
|
||||
final String temp = "html/default/" + pom + ".htm";
|
||||
|
||||
@@ -889,13 +849,13 @@ public class L2Npc extends L2Character
|
||||
private boolean showPkDenyChatWindow(L2PcInstance player, String type)
|
||||
{
|
||||
final String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "html/" + type + "/" + getId() + "-pk.htm");
|
||||
if (html != null)
|
||||
if (html == null)
|
||||
{
|
||||
insertObjectIdAndShowChatWindow(player, html);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
insertObjectIdAndShowChatWindow(player, html);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -965,14 +925,7 @@ public class L2Npc extends L2Character
|
||||
{
|
||||
case 31688:
|
||||
{
|
||||
if (player.isNoble())
|
||||
{
|
||||
filename = Olympiad.OLYMPIAD_HTML_PATH + "noble_main.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
}
|
||||
filename = player.isNoble() ? Olympiad.OLYMPIAD_HTML_PATH + "noble_main.htm" : getHtmlPath(npcId, val);
|
||||
break;
|
||||
}
|
||||
case 31690:
|
||||
@@ -981,38 +934,17 @@ public class L2Npc extends L2Character
|
||||
case 31771:
|
||||
case 31772:
|
||||
{
|
||||
if (player.isHero() || player.isNoble())
|
||||
{
|
||||
filename = Olympiad.OLYMPIAD_HTML_PATH + "hero_main.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
}
|
||||
filename = player.isHero() || player.isNoble() ? Olympiad.OLYMPIAD_HTML_PATH + "hero_main.htm" : getHtmlPath(npcId, val);
|
||||
break;
|
||||
}
|
||||
case 36402:
|
||||
{
|
||||
if (player.getOlympiadBuffCount() > 0)
|
||||
{
|
||||
filename = (player.getOlympiadBuffCount() == Config.ALT_OLY_MAX_BUFFS ? Olympiad.OLYMPIAD_HTML_PATH + "olympiad_buffs.htm" : Olympiad.OLYMPIAD_HTML_PATH + "olympiad_5buffs.htm");
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = Olympiad.OLYMPIAD_HTML_PATH + "olympiad_nobuffs.htm";
|
||||
}
|
||||
filename = player.getOlympiadBuffCount() > 0 ? player.getOlympiadBuffCount() == Config.ALT_OLY_MAX_BUFFS ? Olympiad.OLYMPIAD_HTML_PATH + "olympiad_buffs.htm" : Olympiad.OLYMPIAD_HTML_PATH + "olympiad_5buffs.htm" : Olympiad.OLYMPIAD_HTML_PATH + "olympiad_nobuffs.htm";
|
||||
break;
|
||||
}
|
||||
case 30298: // Blacksmith Pinter
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
}
|
||||
filename = player.isAcademyMember() ? getHtmlPath(npcId, 1) : getHtmlPath(npcId, val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1031,12 +963,9 @@ public class L2Npc extends L2Character
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), filename);
|
||||
|
||||
if (this instanceof L2MerchantInstance)
|
||||
if ((this instanceof L2MerchantInstance) && Config.LIST_PET_RENT_NPC.contains(npcId))
|
||||
{
|
||||
if (Config.LIST_PET_RENT_NPC.contains(npcId))
|
||||
{
|
||||
html.replace("_Quest", "_RentPet\">Rent Pet</a><br><a action=\"bypass -h npc_%objectId%_Quest");
|
||||
}
|
||||
html.replace("_Quest", "_RentPet\">Rent Pet</a><br><a action=\"bypass -h npc_%objectId%_Quest");
|
||||
}
|
||||
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
@@ -1265,11 +1194,12 @@ public class L2Npc extends L2Character
|
||||
|
||||
public void endDecayTask()
|
||||
{
|
||||
if (!isDecayed())
|
||||
if (isDecayed())
|
||||
{
|
||||
DecayTaskManager.getInstance().cancel(this);
|
||||
onDecay();
|
||||
return;
|
||||
}
|
||||
DecayTaskManager.getInstance().cancel(this);
|
||||
onDecay();
|
||||
}
|
||||
|
||||
public boolean isMob() // rather delete this check
|
||||
@@ -1338,21 +1268,23 @@ public class L2Npc extends L2Character
|
||||
@Override
|
||||
public void sendInfo(L2PcInstance activeChar)
|
||||
{
|
||||
if (isVisibleFor(activeChar))
|
||||
if (!isVisibleFor(activeChar))
|
||||
{
|
||||
if (Config.CHECK_KNOWN && activeChar.isGM())
|
||||
{
|
||||
activeChar.sendMessage("Added NPC: " + getName());
|
||||
}
|
||||
|
||||
if (getRunSpeed() == 0)
|
||||
{
|
||||
activeChar.sendPacket(new ServerObjectInfo(this, activeChar));
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new NpcInfo(this));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.CHECK_KNOWN && activeChar.isGM())
|
||||
{
|
||||
activeChar.sendMessage("Added NPC: " + getName());
|
||||
}
|
||||
|
||||
if (getRunSpeed() == 0)
|
||||
{
|
||||
activeChar.sendPacket(new ServerObjectInfo(this, activeChar));
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new NpcInfo(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1423,11 +1355,12 @@ public class L2Npc extends L2Character
|
||||
|
||||
public void setDisplayEffect(int val)
|
||||
{
|
||||
if (val != _displayEffect)
|
||||
if (val == _displayEffect)
|
||||
{
|
||||
_displayEffect = val;
|
||||
broadcastPacket(new ExChangeNpcState(getObjectId(), val));
|
||||
return;
|
||||
}
|
||||
_displayEffect = val;
|
||||
broadcastPacket(new ExChangeNpcState(getObjectId(), val));
|
||||
}
|
||||
|
||||
public int getDisplayEffect()
|
||||
@@ -1484,37 +1417,27 @@ public class L2Npc extends L2Character
|
||||
@Override
|
||||
public void rechargeShots(boolean physical, boolean magic)
|
||||
{
|
||||
if ((_soulshotamount > 0) || (_spiritshotamount > 0))
|
||||
if ((_soulshotamount <= 0) && (_spiritshotamount <= 0))
|
||||
{
|
||||
if (physical)
|
||||
{
|
||||
if (_soulshotamount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (Rnd.get(100) > getSoulShotChance())
|
||||
{
|
||||
return;
|
||||
}
|
||||
_soulshotamount--;
|
||||
Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2154, 1, 0, 0), 600);
|
||||
setChargedShot(ShotType.SOULSHOTS, true);
|
||||
}
|
||||
if (magic)
|
||||
{
|
||||
if (_spiritshotamount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (Rnd.get(100) > getSpiritShotChance())
|
||||
{
|
||||
return;
|
||||
}
|
||||
_spiritshotamount--;
|
||||
Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2061, 1, 0, 0), 600);
|
||||
setChargedShot(ShotType.SPIRITSHOTS, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (physical)
|
||||
{
|
||||
if ((_soulshotamount == 0) || (Rnd.get(100) > getSoulShotChance()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_soulshotamount--;
|
||||
Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2154, 1, 0, 0), 600);
|
||||
setChargedShot(ShotType.SOULSHOTS, true);
|
||||
}
|
||||
if (!magic || (_spiritshotamount == 0) || (Rnd.get(100) > getSpiritShotChance()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_spiritshotamount--;
|
||||
Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2061, 1, 0, 0), 600);
|
||||
setChargedShot(ShotType.SPIRITSHOTS, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1681,12 +1604,9 @@ public class L2Npc extends L2Character
|
||||
item.dropMe(this, newX, newY, newZ);
|
||||
|
||||
// Add drop to auto destroy item task.
|
||||
if (!Config.LIST_PROTECTED_ITEMS.contains(itemId))
|
||||
if (!Config.LIST_PROTECTED_ITEMS.contains(itemId) && (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect())))
|
||||
{
|
||||
if (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect()))
|
||||
{
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
item.setProtected(false);
|
||||
|
||||
@@ -1815,11 +1735,7 @@ public class L2Npc extends L2Character
|
||||
*/
|
||||
public final L2Npc getSummonedNpc(int objectId)
|
||||
{
|
||||
if (_summonedNpcs != null)
|
||||
{
|
||||
return _summonedNpcs.get(objectId);
|
||||
}
|
||||
return null;
|
||||
return _summonedNpcs != null ? _summonedNpcs.get(objectId) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -402,63 +402,65 @@ public abstract class L2Summon extends L2Playable
|
||||
|
||||
public void unSummon(L2PcInstance owner)
|
||||
{
|
||||
if (isVisible() && !isDead())
|
||||
if (!isVisible() || isDead())
|
||||
{
|
||||
getAI().stopFollow();
|
||||
if (owner != null)
|
||||
return;
|
||||
}
|
||||
|
||||
getAI().stopFollow();
|
||||
if (owner != null)
|
||||
{
|
||||
owner.sendPacket(new PetDelete(getSummonType(), getObjectId()));
|
||||
final L2Party party = owner.getParty();
|
||||
if (party != null)
|
||||
{
|
||||
owner.sendPacket(new PetDelete(getSummonType(), getObjectId()));
|
||||
final L2Party party = owner.getParty();
|
||||
if (party != null)
|
||||
{
|
||||
party.broadcastToPartyMembers(owner, new ExPartyPetWindowDelete(this));
|
||||
}
|
||||
|
||||
if ((getInventory() != null) && (getInventory().getSize() > 0))
|
||||
{
|
||||
getOwner().setPetInvItems(true);
|
||||
sendPacket(SystemMessageId.THERE_ARE_ITEMS_IN_YOUR_PET_INVENTORY_RENDERING_YOU_UNABLE_TO_SELL_TRADE_DROP_PET_SUMMONING_ITEMS_PLEASE_EMPTY_YOUR_PET_INVENTORY);
|
||||
}
|
||||
else
|
||||
{
|
||||
getOwner().setPetInvItems(false);
|
||||
}
|
||||
}
|
||||
abortAttack();
|
||||
abortCast();
|
||||
storeMe();
|
||||
storeEffect(true);
|
||||
if (owner != null)
|
||||
{
|
||||
if (isPet())
|
||||
{
|
||||
owner.setPet(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
owner.removeServitor(getObjectId());
|
||||
}
|
||||
party.broadcastToPartyMembers(owner, new ExPartyPetWindowDelete(this));
|
||||
}
|
||||
|
||||
// Stop AI tasks
|
||||
if (hasAI())
|
||||
if ((getInventory() != null) && (getInventory().getSize() > 0))
|
||||
{
|
||||
getAI().stopAITask();
|
||||
getOwner().setPetInvItems(true);
|
||||
sendPacket(SystemMessageId.THERE_ARE_ITEMS_IN_YOUR_PET_INVENTORY_RENDERING_YOU_UNABLE_TO_SELL_TRADE_DROP_PET_SUMMONING_ITEMS_PLEASE_EMPTY_YOUR_PET_INVENTORY);
|
||||
}
|
||||
|
||||
stopAllEffects();
|
||||
final L2WorldRegion oldRegion = getWorldRegion();
|
||||
decayMe();
|
||||
if (oldRegion != null)
|
||||
else
|
||||
{
|
||||
oldRegion.removeFromZones(this);
|
||||
getOwner().setPetInvItems(false);
|
||||
}
|
||||
getKnownList().removeAllKnownObjects();
|
||||
setTarget(null);
|
||||
if (owner != null)
|
||||
}
|
||||
abortAttack();
|
||||
abortCast();
|
||||
storeMe();
|
||||
storeEffect(true);
|
||||
if (owner != null)
|
||||
{
|
||||
if (isPet())
|
||||
{
|
||||
owner.setUsedSummonPoints(owner.getUsedSummonPoints() - _summonPoints);
|
||||
owner.setPet(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
owner.removeServitor(getObjectId());
|
||||
}
|
||||
}
|
||||
|
||||
// Stop AI tasks
|
||||
if (hasAI())
|
||||
{
|
||||
getAI().stopAITask();
|
||||
}
|
||||
|
||||
stopAllEffects();
|
||||
final L2WorldRegion oldRegion = getWorldRegion();
|
||||
decayMe();
|
||||
if (oldRegion != null)
|
||||
{
|
||||
oldRegion.removeFromZones(this);
|
||||
}
|
||||
getKnownList().removeAllKnownObjects();
|
||||
setTarget(null);
|
||||
if (owner != null)
|
||||
{
|
||||
owner.setUsedSummonPoints(owner.getUsedSummonPoints() - _summonPoints);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,12 +557,7 @@ public abstract class L2Summon extends L2Playable
|
||||
@Override
|
||||
public L2Party getParty()
|
||||
{
|
||||
if (_owner == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _owner.getParty();
|
||||
return _owner == null ? null : _owner.getParty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -590,21 +587,7 @@ public abstract class L2Summon extends L2Playable
|
||||
@Override
|
||||
public boolean useMagic(Skill skill, boolean forceUse, boolean dontMove)
|
||||
{
|
||||
// Null skill, dead summon or null owner are reasons to prevent casting.
|
||||
if ((skill == null) || isDead() || (getOwner() == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the skill is active
|
||||
if (skill.isPassive())
|
||||
{
|
||||
// just ignore the passive skill request. why does the client send it anyway ??
|
||||
return false;
|
||||
}
|
||||
|
||||
// If a skill is currently being used
|
||||
if (isCastingNow())
|
||||
if ((skill == null) || isDead() || (getOwner() == null) || skill.isPassive() || isCastingNow())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -718,14 +701,8 @@ public abstract class L2Summon extends L2Playable
|
||||
}
|
||||
else
|
||||
{
|
||||
// Summons can cast skills on NPCs inside peace zones.
|
||||
if (!target.canBeAttacked() && !getOwner().getAccessLevel().allowPeaceAttack())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if a Forced attack is in progress on non-attackable target
|
||||
if (!target.isAutoAttackable(this) && !forceUse && !target.isNpc() && (skill.getTargetType() != L2TargetType.AURA) && (skill.getTargetType() != L2TargetType.FRONT_AURA) && (skill.getTargetType() != L2TargetType.BEHIND_AURA) && (skill.getTargetType() != L2TargetType.CLAN) && (skill.getTargetType() != L2TargetType.PARTY) && (skill.getTargetType() != L2TargetType.SELF))
|
||||
if ((!target.canBeAttacked() && !getOwner().getAccessLevel().allowPeaceAttack())//
|
||||
|| (!target.isAutoAttackable(this) && !forceUse && !target.isNpc() && (skill.getTargetType() != L2TargetType.AURA) && (skill.getTargetType() != L2TargetType.FRONT_AURA) && (skill.getTargetType() != L2TargetType.BEHIND_AURA) && (skill.getTargetType() != L2TargetType.CLAN) && (skill.getTargetType() != L2TargetType.PARTY) && (skill.getTargetType() != L2TargetType.SELF)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -765,62 +742,56 @@ public abstract class L2Summon extends L2Playable
|
||||
@Override
|
||||
public void sendDamageMessage(L2Character target, int damage, boolean mcrit, boolean pcrit, boolean miss)
|
||||
{
|
||||
if (miss || (getOwner() == null))
|
||||
if (miss || (getOwner() == null) || (target.getObjectId() == getOwner().getObjectId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevents the double spam of system messages, if the target is the owning player.
|
||||
if (target.getObjectId() != getOwner().getObjectId())
|
||||
if (pcrit || mcrit)
|
||||
{
|
||||
if (pcrit || mcrit)
|
||||
if (isServitor())
|
||||
{
|
||||
if (isServitor())
|
||||
{
|
||||
sendPacket(SystemMessageId.SUMMONED_MONSTER_S_CRITICAL_HIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendPacket(SystemMessageId.PET_S_CRITICAL_HIT);
|
||||
}
|
||||
}
|
||||
|
||||
if (getOwner().isInOlympiadMode() && (target instanceof L2PcInstance) && ((L2PcInstance) target).isInOlympiadMode() && (((L2PcInstance) target).getOlympiadGameId() == getOwner().getOlympiadGameId()))
|
||||
{
|
||||
OlympiadGameManager.getInstance().notifyCompetitorDamage(getOwner(), damage);
|
||||
}
|
||||
|
||||
final SystemMessage sm;
|
||||
|
||||
if (target.isInvul() && !(target instanceof L2NpcInstance))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_ATTACK_HAS_BEEN_BLOCKED);
|
||||
sendPacket(SystemMessageId.SUMMONED_MONSTER_S_CRITICAL_HIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_INFLICTED_S3_DAMAGE_ON_C2_S4);
|
||||
sm.addNpcName(this);
|
||||
sm.addCharName(target);
|
||||
sm.addInt(damage);
|
||||
sm.addPopup(target.getObjectId(), getObjectId(), (damage * -1));
|
||||
sendPacket(SystemMessageId.PET_S_CRITICAL_HIT);
|
||||
}
|
||||
|
||||
sendPacket(sm);
|
||||
}
|
||||
|
||||
if (getOwner().isInOlympiadMode() && (target instanceof L2PcInstance) && ((L2PcInstance) target).isInOlympiadMode() && (((L2PcInstance) target).getOlympiadGameId() == getOwner().getOlympiadGameId()))
|
||||
{
|
||||
OlympiadGameManager.getInstance().notifyCompetitorDamage(getOwner(), damage);
|
||||
}
|
||||
final SystemMessage sm;
|
||||
if (target.isInvul() && !(target instanceof L2NpcInstance))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_ATTACK_HAS_BEEN_BLOCKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_INFLICTED_S3_DAMAGE_ON_C2_S4);
|
||||
sm.addNpcName(this);
|
||||
sm.addCharName(target);
|
||||
sm.addInt(damage);
|
||||
sm.addPopup(target.getObjectId(), getObjectId(), (damage * -1));
|
||||
}
|
||||
|
||||
sendPacket(sm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reduceCurrentHp(double damage, L2Character attacker, Skill skill)
|
||||
{
|
||||
super.reduceCurrentHp(damage, attacker, skill);
|
||||
if ((getOwner() != null) && (attacker != null))
|
||||
if ((getOwner() == null) || (attacker == null))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RECEIVED_S3_DAMAGE_FROM_C2);
|
||||
sm.addNpcName(this);
|
||||
sm.addCharName(attacker);
|
||||
sm.addInt((int) damage);
|
||||
sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RECEIVED_S3_DAMAGE_FROM_C2);
|
||||
sm.addNpcName(this);
|
||||
sm.addCharName(attacker);
|
||||
sm.addInt((int) damage);
|
||||
sendPacket(sm);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -999,16 +970,13 @@ public abstract class L2Summon extends L2Playable
|
||||
{
|
||||
final L2PcInstance owner = getOwner();
|
||||
final L2Object target = getOwner().getTarget();
|
||||
|
||||
if ((owner != null) && (target != null))
|
||||
if ((owner == null) || (target == null)//
|
||||
|| (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((owner.isGood() && target.getActingPlayer().isGood()) || (owner.isEvil() && target.getActingPlayer().isEvil()))))
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((owner.isGood() && target.getActingPlayer().isGood()) || (owner.isEvil() && target.getActingPlayer().isEvil())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
setTarget(target);
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
return;
|
||||
}
|
||||
setTarget(target);
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1164,27 +1132,21 @@ public abstract class L2Summon extends L2Playable
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (magic)
|
||||
if (magic && (item.getItem().getDefaultAction() == ActionType.SUMMON_SPIRITSHOT))
|
||||
{
|
||||
if (item.getItem().getDefaultAction() == ActionType.SUMMON_SPIRITSHOT)
|
||||
handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
|
||||
if (handler != null)
|
||||
{
|
||||
handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
|
||||
if (handler != null)
|
||||
{
|
||||
handler.useItem(getOwner(), item, false);
|
||||
}
|
||||
handler.useItem(getOwner(), item, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (physical)
|
||||
if (physical && (item.getItem().getDefaultAction() == ActionType.SUMMON_SOULSHOT))
|
||||
{
|
||||
if (item.getItem().getDefaultAction() == ActionType.SUMMON_SOULSHOT)
|
||||
handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
|
||||
if (handler != null)
|
||||
{
|
||||
handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
|
||||
if (handler != null)
|
||||
{
|
||||
handler.useItem(getOwner(), item, false);
|
||||
}
|
||||
handler.useItem(getOwner(), item, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,10 @@ public abstract class L2Tower extends L2Npc
|
||||
// Set the target of the L2PcInstance player
|
||||
player.setTarget(this);
|
||||
}
|
||||
else if (interact)
|
||||
else if (interact && isAutoAttackable(player) && (Math.abs(player.getZ() - getZ()) < 100) && GeoData.getInstance().canSeeTarget(player, this))
|
||||
{
|
||||
if (isAutoAttackable(player) && (Math.abs(player.getZ() - getZ()) < 100) && GeoData.getInstance().canSeeTarget(player, this))
|
||||
{
|
||||
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
|
||||
}
|
||||
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
|
||||
}
|
||||
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
||||
@@ -132,13 +132,7 @@ public abstract class L2Vehicle extends L2Character
|
||||
final VehiclePathPoint point = _currentPath[_runState];
|
||||
if (!isMovementDisabled())
|
||||
{
|
||||
if (point.getMoveSpeed() == 0)
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
if (point.getMoveSpeed() != 0)
|
||||
{
|
||||
if (point.getMoveSpeed() > 0)
|
||||
{
|
||||
@@ -171,6 +165,9 @@ public abstract class L2Vehicle extends L2Character
|
||||
GameTimeController.getInstance().registerMovingObject(this);
|
||||
return true;
|
||||
}
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -241,13 +238,7 @@ public abstract class L2Vehicle extends L2Character
|
||||
|
||||
public boolean addPassenger(L2PcInstance player)
|
||||
{
|
||||
if ((player == null) || _passengers.contains(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// already in other vehicle
|
||||
if ((player.getVehicle() != null) && (player.getVehicle() != this))
|
||||
if ((player == null) || _passengers.contains(player) || ((player.getVehicle() != null) && (player.getVehicle() != this)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -299,33 +290,35 @@ public abstract class L2Vehicle extends L2Character
|
||||
public void payForRide(int itemId, int count, int oustX, int oustY, int oustZ)
|
||||
{
|
||||
final Collection<L2PcInstance> passengers = getKnownList().getKnownPlayersInRadius(1000);
|
||||
if ((passengers != null) && !passengers.isEmpty())
|
||||
if ((passengers == null) || passengers.isEmpty())
|
||||
{
|
||||
L2ItemInstance ticket;
|
||||
InventoryUpdate iu;
|
||||
for (L2PcInstance player : passengers)
|
||||
return;
|
||||
}
|
||||
|
||||
L2ItemInstance ticket;
|
||||
InventoryUpdate iu;
|
||||
for (L2PcInstance player : passengers)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
if (player == null)
|
||||
continue;
|
||||
}
|
||||
if (player.isInBoat() && (player.getBoat() == this))
|
||||
{
|
||||
if (itemId > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (player.isInBoat() && (player.getBoat() == this))
|
||||
{
|
||||
if (itemId > 0)
|
||||
ticket = player.getInventory().getItemByItemId(itemId);
|
||||
if ((ticket == null) || (player.getInventory().destroyItem("Boat", ticket, count, player, this) == null))
|
||||
{
|
||||
ticket = player.getInventory().getItemByItemId(itemId);
|
||||
if ((ticket == null) || (player.getInventory().destroyItem("Boat", ticket, count, player, this) == null))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_POSSESS_THE_CORRECT_TICKET_TO_BOARD_THE_BOAT);
|
||||
player.teleToLocation(new Location(oustX, oustY, oustZ), true);
|
||||
continue;
|
||||
}
|
||||
iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(ticket);
|
||||
player.sendPacket(iu);
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_POSSESS_THE_CORRECT_TICKET_TO_BOARD_THE_BOAT);
|
||||
player.teleToLocation(new Location(oustX, oustY, oustZ), true);
|
||||
continue;
|
||||
}
|
||||
addPassenger(player);
|
||||
iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(ticket);
|
||||
player.sendPacket(iu);
|
||||
}
|
||||
addPassenger(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,7 @@ public class PcAppearance
|
||||
*/
|
||||
public final String getVisibleName()
|
||||
{
|
||||
if (_visibleName == null)
|
||||
{
|
||||
return getOwner().getName();
|
||||
}
|
||||
return _visibleName;
|
||||
return _visibleName == null ? getOwner().getName() : _visibleName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,11 +85,7 @@ public class PcAppearance
|
||||
*/
|
||||
public final String getVisibleTitle()
|
||||
{
|
||||
if (_visibleTitle == null)
|
||||
{
|
||||
return getOwner().getTitle();
|
||||
}
|
||||
return _visibleTitle;
|
||||
return _visibleTitle == null ? getOwner().getTitle() : _visibleTitle;
|
||||
}
|
||||
|
||||
public final byte getFace()
|
||||
@@ -171,11 +163,7 @@ public class PcAppearance
|
||||
|
||||
public int getNameColor()
|
||||
{
|
||||
if (_owner.getReputation() != 0)
|
||||
{
|
||||
return 0xFFFFFF; // Using 0xFFFFFF value in case _nameColor has changed.
|
||||
}
|
||||
return _nameColor;
|
||||
return _owner.getReputation() != 0 ? 0xFFFFFF : _nameColor; // Using 0xFFFFFF value in case _nameColor has changed.
|
||||
}
|
||||
|
||||
public void setNameColor(int nameColor)
|
||||
|
||||
@@ -35,17 +35,6 @@ public class L2AdventurerInstance extends L2NpcInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/adventurer_guildsman/" + pom + ".htm";
|
||||
return "html/adventurer_guildsman/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
}
|
||||
@@ -76,12 +76,7 @@ public final class L2AuctioneerInstance extends L2Npc
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
final String actualCommand = st.nextToken(); // Get actual command
|
||||
|
||||
String val = "";
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
val = st.nextToken();
|
||||
}
|
||||
|
||||
final String val = st.countTokens() >= 1 ? st.nextToken() : "";
|
||||
if (actualCommand.equalsIgnoreCase("auction"))
|
||||
{
|
||||
if (val.isEmpty())
|
||||
@@ -95,12 +90,7 @@ public final class L2AuctioneerInstance extends L2Npc
|
||||
try
|
||||
{
|
||||
final SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
|
||||
long bid = 0;
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
bid = Math.min(Long.parseLong(st.nextToken()), MAX_ADENA);
|
||||
}
|
||||
|
||||
final long bid = st.countTokens() >= 1 ? Math.min(Long.parseLong(st.nextToken()), MAX_ADENA) : 0;
|
||||
final Auction a = new Auction(player.getClan().getHideoutId(), player.getClan(), days * 86400000L, bid, ClanHallManager.getInstance().getClanHallByOwner(player.getClan()).getName());
|
||||
if (_pendingAuctions.get(a.getId()) != null)
|
||||
{
|
||||
@@ -215,13 +205,7 @@ public final class L2AuctioneerInstance extends L2Npc
|
||||
final int auctionId = Integer.parseInt(val);
|
||||
try
|
||||
{
|
||||
long bid = 0;
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
bid = Math.min(Long.parseLong(st.nextToken()), MAX_ADENA);
|
||||
}
|
||||
|
||||
ClanHallAuctionManager.getInstance().getAuction(auctionId).setBid(player, bid);
|
||||
ClanHallAuctionManager.getInstance().getAuction(auctionId).setBid(player, (st.countTokens() >= 1 ? Math.min(Long.parseLong(st.nextToken()), MAX_ADENA) : 0));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -325,21 +309,15 @@ public final class L2AuctioneerInstance extends L2Npc
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i > limit)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (i < start)
|
||||
i++;
|
||||
if (i < start)
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
items.append("<tr>");
|
||||
items.append("<td>");
|
||||
items.append(ClanHallManager.getInstance().getAuctionableHallById(a.getItemId()).getLocation());
|
||||
|
||||
@@ -93,12 +93,7 @@ public final class L2BabyPetInstance extends L2PetInstance
|
||||
}
|
||||
|
||||
final Skill skill = SkillData.getInstance().getSkill(id, lvl);
|
||||
if (skill == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((skill.getId() == BUFF_CONTROL) || (skill.getId() == AWAKENING))
|
||||
if ((skill == null) || (skill.getId() == BUFF_CONTROL) || (skill.getId() == AWAKENING))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -208,11 +203,12 @@ public final class L2BabyPetInstance extends L2PetInstance
|
||||
|
||||
private final void stopCastTask()
|
||||
{
|
||||
if (_castTask != null)
|
||||
if (_castTask == null)
|
||||
{
|
||||
_castTask.cancel(false);
|
||||
_castTask = null;
|
||||
return;
|
||||
}
|
||||
_castTask.cancel(false);
|
||||
_castTask = null;
|
||||
}
|
||||
|
||||
protected void castSkill(Skill skill)
|
||||
@@ -285,26 +281,20 @@ public final class L2BabyPetInstance extends L2PetInstance
|
||||
if ((isImprovedBaby && (hpPercent < 0.3)) || (!isImprovedBaby && (hpPercent < 0.15)))
|
||||
{
|
||||
skill = _majorHeal.getSkill();
|
||||
if (!_baby.isSkillDisabled(skill) && (Rnd.get(100) <= 75))
|
||||
if (!_baby.isSkillDisabled(skill) && (Rnd.get(100) <= 75) && (_baby.getCurrentMp() >= skill.getMpConsume()))
|
||||
{
|
||||
if (_baby.getCurrentMp() >= skill.getMpConsume())
|
||||
{
|
||||
castSkill(skill);
|
||||
return;
|
||||
}
|
||||
castSkill(skill);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((_majorHeal.getSkill() != _minorHeal.getSkill()) && ((isImprovedBaby && (hpPercent < 0.7)) || (!isImprovedBaby && (hpPercent < 0.8))))
|
||||
{
|
||||
// Cast _minorHeal only if it's different than _majorHeal, then pet has two heals available.
|
||||
skill = _minorHeal.getSkill();
|
||||
if (!_baby.isSkillDisabled(skill) && (Rnd.get(100) <= 25))
|
||||
if (!_baby.isSkillDisabled(skill) && (Rnd.get(100) <= 25) && (_baby.getCurrentMp() >= skill.getMpConsume()))
|
||||
{
|
||||
if (_baby.getCurrentMp() >= skill.getMpConsume())
|
||||
{
|
||||
castSkill(skill);
|
||||
return;
|
||||
}
|
||||
castSkill(skill);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,25 +308,15 @@ public final class L2BabyPetInstance extends L2PetInstance
|
||||
for (SkillHolder buff : _buffs)
|
||||
{
|
||||
skill = buff.getSkill();
|
||||
if (_baby.isSkillDisabled(skill))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_baby.getCurrentMp() < skill.getMpConsume())
|
||||
if (_baby.isSkillDisabled(skill) || (_baby.getCurrentMp() < skill.getMpConsume()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If owner already have the buff, continue.
|
||||
final BuffInfo buffInfo = owner.getEffectList().getBuffInfoByAbnormalType(skill.getAbnormalType());
|
||||
if ((buffInfo != null) && (skill.getAbnormalLvl() <= buffInfo.getSkill().getAbnormalLvl()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If owner have the buff blocked, continue.
|
||||
if ((owner.getEffectList().getAllBlockedBuffSlots() != null) && owner.getEffectList().getAllBlockedBuffSlots().contains(skill.getAbnormalType()))
|
||||
if (((buffInfo != null) && (skill.getAbnormalLvl() <= buffInfo.getSkill().getAbnormalLvl()))//
|
||||
|| ((owner.getEffectList().getAllBlockedBuffSlots() != null) && owner.getEffectList().getAllBlockedBuffSlots().contains(skill.getAbnormalType())))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -56,22 +56,11 @@ public class L2BlockInstance extends L2MonsterInstance
|
||||
synchronized (this)
|
||||
{
|
||||
final BlockCheckerEngine event = holder.getEvent();
|
||||
if (_colorEffect == 0x53)
|
||||
{
|
||||
// Change color
|
||||
_colorEffect = 0x00;
|
||||
// BroadCast to all known players
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
increaseTeamPointsAndSend(attacker, team, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Change color
|
||||
_colorEffect = 0x53;
|
||||
// BroadCast to all known players
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
increaseTeamPointsAndSend(attacker, team, event);
|
||||
}
|
||||
// Change color
|
||||
_colorEffect = _colorEffect == 0x53 ? 0x00 : 0x53;
|
||||
// BroadCast to all known players
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
increaseTeamPointsAndSend(attacker, team, event);
|
||||
// 30% chance to drop the event items
|
||||
final int random = Rnd.get(100);
|
||||
// Bond
|
||||
@@ -107,11 +96,7 @@ public class L2BlockInstance extends L2MonsterInstance
|
||||
@Override
|
||||
public boolean isAutoAttackable(L2Character attacker)
|
||||
{
|
||||
if (attacker instanceof L2PcInstance)
|
||||
{
|
||||
return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1);
|
||||
}
|
||||
return true;
|
||||
return !(attacker instanceof L2PcInstance) || ((attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,12 +83,9 @@ public class L2CastleDoormenInstance extends L2DoormenInstance
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (getCastle() != null)
|
||||
else if ((getCastle() != null) && (player.getClanId() == getCastle().getOwnerId()))
|
||||
{
|
||||
if (player.getClanId() == getCastle().getOwnerId())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -98,10 +95,6 @@ public class L2CastleDoormenInstance extends L2DoormenInstance
|
||||
protected final boolean isUnderSiege()
|
||||
{
|
||||
final SiegableHall hall = getConquerableHall();
|
||||
if (hall != null)
|
||||
{
|
||||
return hall.isInSiege();
|
||||
}
|
||||
return getCastle().getZone().isActive();
|
||||
return hall != null ? hall.isInSiege() : getCastle().getZone().isActive();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,58 +66,48 @@ public class L2ClanHallDoormenInstance extends L2DoormenInstance
|
||||
@Override
|
||||
public void onBypassFeedback(L2PcInstance player, String command)
|
||||
{
|
||||
if (_hasEvolve && command.startsWith("evolve"))
|
||||
if (_hasEvolve && command.startsWith("evolve") && isOwnerClan(player))
|
||||
{
|
||||
if (isOwnerClan(player))
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
if (st.countTokens() < 2)
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
if (st.countTokens() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
st.nextToken();
|
||||
boolean ok = false;
|
||||
switch (Integer.parseInt(st.nextToken()))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 9882, 10307, 55);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 4422, 10308, 55);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 4423, 10309, 55);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 4424, 10310, 55);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 10426, 10611, 70);
|
||||
break;
|
||||
}
|
||||
}
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (ok)
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/evolve-ok.htm");
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/evolve-no.htm");
|
||||
}
|
||||
player.sendPacket(html);
|
||||
return;
|
||||
}
|
||||
|
||||
st.nextToken();
|
||||
boolean ok = false;
|
||||
switch (Integer.parseInt(st.nextToken()))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 9882, 10307, 55);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 4422, 10308, 55);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 4423, 10309, 55);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 4424, 10310, 55);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
ok = Evolve.doEvolve(player, this, 10426, 10611, 70);
|
||||
break;
|
||||
}
|
||||
}
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), ok ? "html/clanHallDoormen/evolve-ok.htm" : "html/clanHallDoormen/evolve-no.htm");
|
||||
player.sendPacket(html);
|
||||
return;
|
||||
}
|
||||
super.onBypassFeedback(player, command);
|
||||
}
|
||||
@@ -129,40 +119,30 @@ public class L2ClanHallDoormenInstance extends L2DoormenInstance
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
|
||||
if (getClanHall() != null)
|
||||
if (getClanHall() == null)
|
||||
{
|
||||
final L2Clan owner = ClanTable.getInstance().getClan(getClanHall().getOwnerId());
|
||||
if (isOwnerClan(player))
|
||||
{
|
||||
if (_hasEvolve)
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/doormen2.htm");
|
||||
html.replace("%clanname%", owner.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/doormen1.htm");
|
||||
html.replace("%clanname%", owner.getName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((owner != null) && (owner.getLeader() != null))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/doormen-no.htm");
|
||||
html.replace("%leadername%", owner.getLeaderName());
|
||||
html.replace("%clanname%", owner.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/emptyowner.htm");
|
||||
html.replace("%hallname%", getClanHall().getName());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Clan owner = ClanTable.getInstance().getClan(getClanHall().getOwnerId());
|
||||
if (isOwnerClan(player))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), _hasEvolve ? "html/clanHallDoormen/doormen2.htm" : "html/clanHallDoormen/doormen1.htm");
|
||||
html.replace("%clanname%", owner.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
if ((owner != null) && (owner.getLeader() != null))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/doormen-no.htm");
|
||||
html.replace("%leadername%", owner.getLeaderName());
|
||||
html.replace("%clanname%", owner.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallDoormen/emptyowner.htm");
|
||||
html.replace("%hallname%", getClanHall().getName());
|
||||
}
|
||||
}
|
||||
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
@@ -212,13 +192,6 @@ public class L2ClanHallDoormenInstance extends L2DoormenInstance
|
||||
@Override
|
||||
protected final boolean isOwnerClan(L2PcInstance player)
|
||||
{
|
||||
if ((player.getClan() != null) && (getClanHall() != null))
|
||||
{
|
||||
if (player.getClanId() == getClanHall().getOwnerId())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return (player.getClan() != null) && (getClanHall() != null) && (player.getClanId() == getClanHall().getOwnerId());
|
||||
}
|
||||
}
|
||||
@@ -82,13 +82,8 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
if (condition == COND_OWNER)
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
final String actualCommand = st.nextToken(); // Get actual command
|
||||
String val = "";
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
val = st.nextToken();
|
||||
}
|
||||
|
||||
final String actualCommand = st.nextToken();
|
||||
String val = st.countTokens() >= 1 ? st.nextToken() : "";
|
||||
if (actualCommand.equalsIgnoreCase("banish_foreigner"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -111,7 +106,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("manage_vault"))
|
||||
if (actualCommand.equalsIgnoreCase("manage_vault"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CL_VIEW_WAREHOUSE))
|
||||
@@ -126,16 +121,15 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
html.replace("%rent%", String.valueOf(getClanHall().getLease()));
|
||||
html.replace("%date%", format.format(getClanHall().getPaidUntil()));
|
||||
}
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/not_authorized.htm");
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("door"))
|
||||
if (actualCommand.equalsIgnoreCase("door"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CH_OPEN_DOOR))
|
||||
@@ -154,16 +148,15 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/door.htm");
|
||||
}
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/not_authorized.htm");
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("functions"))
|
||||
if (actualCommand.equalsIgnoreCase("functions"))
|
||||
{
|
||||
if (val.equalsIgnoreCase("tele"))
|
||||
{
|
||||
@@ -191,8 +184,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
return;
|
||||
}
|
||||
final int valbuy = Integer.parseInt(st.nextToken()) + (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getLvl() * 100000);
|
||||
showBuyWindow(player, valbuy);
|
||||
showBuyWindow(player, (Integer.parseInt(st.nextToken()) + (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getLvl() * 100000)));
|
||||
}
|
||||
else if (val.equalsIgnoreCase("support"))
|
||||
{
|
||||
@@ -216,35 +208,14 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP) != null)
|
||||
{
|
||||
html.replace("%xp_regen%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl()));
|
||||
}
|
||||
else
|
||||
{
|
||||
html.replace("%xp_regen%", "0");
|
||||
}
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP) != null)
|
||||
{
|
||||
html.replace("%hp_regen%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLvl()));
|
||||
}
|
||||
else
|
||||
{
|
||||
html.replace("%hp_regen%", "0");
|
||||
}
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP) != null)
|
||||
{
|
||||
html.replace("%mp_regen%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLvl()));
|
||||
}
|
||||
else
|
||||
{
|
||||
html.replace("%mp_regen%", "0");
|
||||
}
|
||||
html.replace("%xp_regen%", getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP) != null ? String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl()) : "0");
|
||||
html.replace("%hp_regen%", getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP) != null ? String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLvl()) : "0");
|
||||
html.replace("%mp_regen%", getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP) != null ? String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLvl()) : "0");
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("manage"))
|
||||
if (actualCommand.equalsIgnoreCase("manage"))
|
||||
{
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CH_SET_FUNCTIONS))
|
||||
{
|
||||
@@ -266,7 +237,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("mp_cancel"))
|
||||
if (val.equalsIgnoreCase("mp_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-cancel.htm");
|
||||
@@ -274,7 +245,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("exp_cancel"))
|
||||
if (val.equalsIgnoreCase("exp_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-cancel.htm");
|
||||
@@ -282,7 +253,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_hp"))
|
||||
if (val.equalsIgnoreCase("edit_hp"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -358,14 +329,13 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.CH_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
|
||||
html.replace("%use%", "Provides additional HP recovery for clan members in the clan hall.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
|
||||
html.replace("%apply%", "recovery hp " + String.valueOf(percent));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_mp"))
|
||||
if (val.equalsIgnoreCase("edit_mp"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -407,7 +377,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_exp"))
|
||||
if (val.equalsIgnoreCase("edit_exp"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -459,7 +429,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("hp"))
|
||||
if (val.equalsIgnoreCase("hp"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -471,15 +441,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP) != null) && (getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int percent = Integer.parseInt(val);
|
||||
switch (percent)
|
||||
@@ -569,7 +536,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("mp"))
|
||||
if (val.equalsIgnoreCase("mp"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -581,15 +548,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP) != null) && (getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int percent = Integer.parseInt(val);
|
||||
switch (percent)
|
||||
@@ -639,7 +603,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("exp"))
|
||||
if (val.equalsIgnoreCase("exp"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -651,15 +615,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP) != null) && (getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int percent = Integer.parseInt(val);
|
||||
switch (percent)
|
||||
@@ -738,8 +699,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%hp_recovery%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLease()) + "</font>Adena /" + String.valueOf(Config.CH_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
|
||||
html.replace("%hp_period%", "Withdraw the fee for the next time at " + format.format(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getEndTime()));
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -767,8 +727,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%hp_recovery%", "none");
|
||||
html.replace("%hp_period%", "none");
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -796,8 +755,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%exp_recovery%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLease()) + "</font>Adena /" + String.valueOf(Config.CH_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
|
||||
html.replace("%exp_period%", "Withdraw the fee for the next time at " + format.format(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getEndTime()));
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -825,8 +783,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%exp_recovery%", "none");
|
||||
html.replace("%exp_period%", "none");
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -854,8 +811,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%mp_recovery%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLease()) + "</font>Adena /" + String.valueOf(Config.CH_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
|
||||
html.replace("%mp_period%", "Withdraw the fee for the next time at " + format.format(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getEndTime()));
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -883,8 +839,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%mp_recovery%", "none");
|
||||
html.replace("%mp_period%", "none");
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -928,7 +883,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("tele_cancel"))
|
||||
if (val.equalsIgnoreCase("tele_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-cancel.htm");
|
||||
@@ -936,7 +891,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("support_cancel"))
|
||||
if (val.equalsIgnoreCase("support_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-cancel.htm");
|
||||
@@ -944,7 +899,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_item"))
|
||||
if (val.equalsIgnoreCase("edit_item"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -976,7 +931,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_support"))
|
||||
if (val.equalsIgnoreCase("edit_support"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -1033,7 +988,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_tele"))
|
||||
if (val.equalsIgnoreCase("edit_tele"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -1060,7 +1015,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("item"))
|
||||
if (val.equalsIgnoreCase("item"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -1076,15 +1031,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE) != null) && (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
int fee;
|
||||
final int lvl = Integer.parseInt(val);
|
||||
@@ -1125,7 +1077,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("tele"))
|
||||
if (val.equalsIgnoreCase("tele"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -1137,15 +1089,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_TELEPORT) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_TELEPORT) != null) && (getClanHall().getFunction(ClanHall.FUNC_TELEPORT).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_TELEPORT).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int lvl = Integer.parseInt(val);
|
||||
switch (lvl)
|
||||
@@ -1180,7 +1129,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("support"))
|
||||
if (val.equalsIgnoreCase("support"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -1192,15 +1141,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_SUPPORT) != null) && (getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int lvl = Integer.parseInt(val);
|
||||
switch (lvl)
|
||||
@@ -1290,8 +1236,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%support%", "Stage " + String.valueOf(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl()) + "</font> (<font color=\"FFAABB\">" + String.valueOf(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLease()) + "</font>Adena /" + String.valueOf(Config.CH_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
|
||||
html.replace("%support_period%", "Withdraw the fee for the next time at " + format.format(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getEndTime()));
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -1319,8 +1264,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
html.replace("%support%", "none");
|
||||
html.replace("%support_period%", "none");
|
||||
final int grade = getClanHall().getGrade();
|
||||
switch (grade)
|
||||
switch (getClanHall().getGrade())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@@ -1376,7 +1320,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("fixtures_cancel"))
|
||||
if (val.equalsIgnoreCase("fixtures_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-cancel.htm");
|
||||
@@ -1384,7 +1328,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_curtains"))
|
||||
if (val.equalsIgnoreCase("edit_curtains"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -1411,7 +1355,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_fixtures"))
|
||||
if (val.equalsIgnoreCase("edit_fixtures"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -1438,7 +1382,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("curtains"))
|
||||
if (val.equalsIgnoreCase("curtains"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -1450,15 +1394,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS) != null) && (getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int lvl = Integer.parseInt(val);
|
||||
switch (lvl)
|
||||
@@ -1493,7 +1434,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("fixtures"))
|
||||
if (val.equalsIgnoreCase("fixtures"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -1505,15 +1446,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-apply_confirmed.htm");
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM) != null)
|
||||
if ((getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM) != null) && (getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int lvl = Integer.parseInt(val);
|
||||
switch (lvl)
|
||||
@@ -1598,7 +1536,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("support"))
|
||||
if (actualCommand.equalsIgnoreCase("support"))
|
||||
{
|
||||
if (player.isCursedWeaponEquipped())
|
||||
{
|
||||
@@ -1618,11 +1556,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
final int skill_id = Integer.parseInt(val);
|
||||
try
|
||||
{
|
||||
int skill_lvl = 0;
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
skill_lvl = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
final int skill_lvl = st.countTokens() >= 1 ? Integer.parseInt(st.nextToken()) : 0;
|
||||
skill = SkillData.getInstance().getSkill(skill_id, skill_lvl);
|
||||
if (skill.hasEffectType(L2EffectType.SUMMON))
|
||||
{
|
||||
@@ -1630,13 +1564,8 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
else
|
||||
{
|
||||
final int mpCost = skill.getMpConsume() + skill.getMpInitialConsume();
|
||||
// If Clan Hall Buff are free or current MP is greater than MP cost, the skill should be casted.
|
||||
if ((getCurrentMp() >= mpCost) || Config.CH_BUFF_FREE)
|
||||
{
|
||||
doCast(skill);
|
||||
}
|
||||
else
|
||||
if ((getCurrentMp() < (skill.getMpConsume() + skill.getMpInitialConsume())) && !Config.CH_BUFF_FREE)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/clanHallManager/support-no_mana.htm");
|
||||
@@ -1644,6 +1573,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
doCast(skill);
|
||||
}
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT) == null)
|
||||
{
|
||||
@@ -1669,21 +1599,17 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("list_back"))
|
||||
if (actualCommand.equalsIgnoreCase("list_back"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
String file = "html/clanHallManager/chamberlain-" + getId() + ".htm";
|
||||
if (!HtmCache.getInstance().isLoadable(file))
|
||||
{
|
||||
file = "html/clanHallManager/chamberlain.htm";
|
||||
}
|
||||
final String file = !HtmCache.getInstance().isLoadable(("html/clanHallManager/chamberlain-" + getId() + ".htm")) ? "html/clanHallManager/chamberlain.htm" : "html/clanHallManager/chamberlain-" + getId() + ".htm";
|
||||
html.setFile(player.getHtmlPrefix(), file);
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
html.replace("%npcname%", getName());
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("support_back"))
|
||||
if (actualCommand.equalsIgnoreCase("support_back"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl() == 0)
|
||||
@@ -1695,7 +1621,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("goto"))
|
||||
if (actualCommand.equalsIgnoreCase("goto"))
|
||||
{
|
||||
final int whereTo = Integer.parseInt(val);
|
||||
doTeleport(player, whereTo);
|
||||
@@ -1799,7 +1725,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_WHILE_IN_POSSESSION_OF_A_WARD);
|
||||
return;
|
||||
}
|
||||
else if (player.destroyItemByItemId("Teleport", list.getItemId(), list.getPrice(), this, true))
|
||||
if (player.destroyItemByItemId("Teleport", list.getItemId(), list.getPrice(), this, true))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
@@ -1822,7 +1748,6 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
return;
|
||||
}
|
||||
final AgitDecoInfo bl = new AgitDecoInfo(ch);
|
||||
player.sendPacket(bl);
|
||||
player.sendPacket(new AgitDecoInfo(ch));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,18 +55,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/classmaster/" + pom + ".htm";
|
||||
return "html/classmaster/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,8 +144,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
|
||||
|
||||
try
|
||||
{
|
||||
final int val = Integer.parseInt(request.substring(21));
|
||||
checkAndChangeClass(player, val);
|
||||
checkAndChangeClass(player, Integer.parseInt(request.substring(21)));
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
@@ -182,12 +170,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
|
||||
}
|
||||
|
||||
final ClassId classId = player.getClassId();
|
||||
if (getMinLevel(classId.level(), player) > player.getLevel())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Config.CLASS_MASTER_SETTINGS.isAllowed(classId.level() + 1))
|
||||
if ((getMinLevel(classId.level(), player) > player.getLevel()) || !Config.CLASS_MASTER_SETTINGS.isAllowed(classId.level() + 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -356,9 +339,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "html/classmaster/tutorialtemplate.htm");
|
||||
msg = msg.replaceAll("%name%", ClassListData.getInstance().getClass(currentClassId).getEscapedClientCode());
|
||||
|
||||
String msg = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "html/classmaster/tutorialtemplate.htm").replaceAll("%name%", ClassListData.getInstance().getClass(currentClassId).getEscapedClientCode());
|
||||
final StringBuilder menu = new StringBuilder(100);
|
||||
for (ClassId cid : ClassId.values())
|
||||
{
|
||||
@@ -380,12 +361,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
|
||||
private static final boolean checkAndChangeClass(L2PcInstance player, int val)
|
||||
{
|
||||
final ClassId currentClassId = player.getClassId();
|
||||
if ((getMinLevel(currentClassId.level(), player) > player.getLevel()) && !Config.ALLOW_ENTIRE_TREE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!validateClassId(currentClassId, val))
|
||||
if (((getMinLevel(currentClassId.level(), player) > player.getLevel()) && !Config.ALLOW_ENTIRE_TREE) || !validateClassId(currentClassId, val))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -307,17 +307,19 @@ public class L2ControllableAirShipInstance extends L2AirShipInstance
|
||||
public void run()
|
||||
{
|
||||
int fuel = getFuel();
|
||||
if (fuel > 0)
|
||||
if (fuel <= 0)
|
||||
{
|
||||
fuel -= 10;
|
||||
if (fuel < 0)
|
||||
{
|
||||
fuel = 0;
|
||||
}
|
||||
|
||||
setFuel(fuel);
|
||||
updateAbnormalVisualEffects();
|
||||
return;
|
||||
}
|
||||
|
||||
fuel -= 10;
|
||||
if (fuel < 0)
|
||||
{
|
||||
fuel = 0;
|
||||
}
|
||||
|
||||
setFuel(fuel);
|
||||
updateAbnormalVisualEffects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -350,11 +350,12 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
|
||||
public void cancelDisappear()
|
||||
{
|
||||
if (_disappearTask != null)
|
||||
if (_disappearTask == null)
|
||||
{
|
||||
_disappearTask.cancel(true);
|
||||
_disappearTask = null;
|
||||
return;
|
||||
}
|
||||
_disappearTask.cancel(true);
|
||||
_disappearTask = null;
|
||||
}
|
||||
|
||||
/** this sets the enemy target for a cubic */
|
||||
@@ -431,12 +432,9 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
_target = PlayerA;
|
||||
}
|
||||
}
|
||||
if ((_target == PlayerA) || (_target == PlayerB))
|
||||
if (((_target == PlayerA) || (_target == PlayerB)) && (_target == ownerTarget))
|
||||
{
|
||||
if (_target == ownerTarget)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (partyEnemy != null)
|
||||
{
|
||||
@@ -463,15 +461,12 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
// Olympiad targeting
|
||||
if (_owner.isInOlympiadMode())
|
||||
{
|
||||
if (_owner.isOlympiadStart())
|
||||
if (_owner.isOlympiadStart() && ownerTarget.isPlayable())
|
||||
{
|
||||
if (ownerTarget.isPlayable())
|
||||
final L2PcInstance targetPlayer = ownerTarget.getActingPlayer();
|
||||
if ((targetPlayer != null) && (targetPlayer.getOlympiadGameId() == _owner.getOlympiadGameId()) && (targetPlayer.getOlympiadSide() != _owner.getOlympiadSide()))
|
||||
{
|
||||
final L2PcInstance targetPlayer = ownerTarget.getActingPlayer();
|
||||
if ((targetPlayer != null) && (targetPlayer.getOlympiadGameId() == _owner.getOlympiadGameId()) && (targetPlayer.getOlympiadSide() != _owner.getOlympiadSide()))
|
||||
{
|
||||
_target = (L2Character) ownerTarget;
|
||||
}
|
||||
_target = (L2Character) ownerTarget;
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -527,12 +522,9 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
else if (_owner.getParty().getCommandChannel() != null)
|
||||
else if ((_owner.getParty().getCommandChannel() != null) && _owner.getParty().getCommandChannel().getMembers().contains(enemy))
|
||||
{
|
||||
if (_owner.getParty().getCommandChannel().getMembers().contains(enemy))
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
targetIt = false;
|
||||
}
|
||||
}
|
||||
if ((_owner.getClan() != null) && !_owner.isInsideZone(ZoneId.PVP))
|
||||
@@ -541,12 +533,9 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
if ((_owner.getAllyId() > 0) && (enemy.getAllyId() > 0))
|
||||
if ((_owner.getAllyId() > 0) && (enemy.getAllyId() > 0) && (_owner.getAllyId() == enemy.getAllyId()))
|
||||
{
|
||||
if (_owner.getAllyId() == enemy.getAllyId())
|
||||
{
|
||||
targetIt = false;
|
||||
}
|
||||
targetIt = false;
|
||||
}
|
||||
}
|
||||
if ((enemy.getPvpFlag() == 0) && !enemy.isInsideZone(ZoneId.PVP))
|
||||
@@ -814,16 +803,9 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
{
|
||||
L2Character target = null;
|
||||
double percentleft = 100.0;
|
||||
L2Party party = _owner.getParty();
|
||||
|
||||
// if owner is in a duel but not in a party duel, then it is the same as he does not have a party
|
||||
if (_owner.isInDuel())
|
||||
{
|
||||
if (!DuelManager.getInstance().getDuel(_owner.getDuelId()).isPartyDuel())
|
||||
{
|
||||
party = null;
|
||||
}
|
||||
}
|
||||
final L2Party party = _owner.isInDuel() && !DuelManager.getInstance().getDuel(_owner.getDuelId()).isPartyDuel() ? null : _owner.getParty();
|
||||
|
||||
if ((party != null) && !_owner.isInOlympiadMode())
|
||||
{
|
||||
@@ -831,22 +813,10 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
// Get a list of Party Members
|
||||
for (L2Character partyMember : party.getMembers())
|
||||
{
|
||||
if (!partyMember.isDead())
|
||||
if (!partyMember.isDead() && isInCubicRange(_owner, partyMember) && (partyMember.getCurrentHp() < partyMember.getMaxHp()) && (percentleft > (partyMember.getCurrentHp() / partyMember.getMaxHp())))
|
||||
{
|
||||
// if party member not dead, check if he is in cast range of heal cubic
|
||||
if (isInCubicRange(_owner, partyMember))
|
||||
{
|
||||
// member is in cubic casting range, check if he need heal and if he have
|
||||
// the lowest HP
|
||||
if (partyMember.getCurrentHp() < partyMember.getMaxHp())
|
||||
{
|
||||
if (percentleft > (partyMember.getCurrentHp() / partyMember.getMaxHp()))
|
||||
{
|
||||
percentleft = (partyMember.getCurrentHp() / partyMember.getMaxHp());
|
||||
target = partyMember;
|
||||
}
|
||||
}
|
||||
}
|
||||
percentleft = (partyMember.getCurrentHp() / partyMember.getMaxHp());
|
||||
target = partyMember;
|
||||
}
|
||||
final L2Summon pet = partyMember.getPet();
|
||||
if (pet != null)
|
||||
@@ -858,13 +828,10 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
|
||||
// member's pet is in cubic casting range, check if he need heal and if he have
|
||||
// the lowest HP
|
||||
if (pet.getCurrentHp() < pet.getMaxHp())
|
||||
if ((pet.getCurrentHp() < pet.getMaxHp()) && (percentleft > (pet.getCurrentHp() / pet.getMaxHp())))
|
||||
{
|
||||
if (percentleft > (pet.getCurrentHp() / pet.getMaxHp()))
|
||||
{
|
||||
percentleft = (pet.getCurrentHp() / pet.getMaxHp());
|
||||
target = pet;
|
||||
}
|
||||
percentleft = (pet.getCurrentHp() / pet.getMaxHp());
|
||||
target = pet;
|
||||
}
|
||||
}
|
||||
for (L2Summon s : partyMember.getServitors().values())
|
||||
@@ -876,13 +843,10 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
|
||||
// member's pet is in cubic casting range, check if he need heal and if he have
|
||||
// the lowest HP
|
||||
if (s.getCurrentHp() < s.getMaxHp())
|
||||
if ((s.getCurrentHp() < s.getMaxHp()) && (percentleft > (s.getCurrentHp() / s.getMaxHp())))
|
||||
{
|
||||
if (percentleft > (s.getCurrentHp() / s.getMaxHp()))
|
||||
{
|
||||
percentleft = (s.getCurrentHp() / s.getMaxHp());
|
||||
target = s;
|
||||
}
|
||||
percentleft = (s.getCurrentHp() / s.getMaxHp());
|
||||
target = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -902,12 +866,9 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
}
|
||||
}
|
||||
final L2Summon pet = _owner.getPet();
|
||||
if (pet != null)
|
||||
if ((pet != null) && !pet.isDead() && (pet.getCurrentHp() < pet.getMaxHp()) && (percentleft > (pet.getCurrentHp() / pet.getMaxHp())) && isInCubicRange(_owner, pet))
|
||||
{
|
||||
if (!pet.isDead() && (pet.getCurrentHp() < pet.getMaxHp()) && (percentleft > (pet.getCurrentHp() / pet.getMaxHp())) && isInCubicRange(_owner, pet))
|
||||
{
|
||||
target = _owner.getPet();
|
||||
}
|
||||
target = _owner.getPet();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,8 +100,7 @@ public class L2DecoyInstance extends L2Decoy
|
||||
try
|
||||
{
|
||||
_Decoy.decTimeRemaining(1000);
|
||||
final double newTimeRemaining = _Decoy.getTimeRemaining();
|
||||
if (newTimeRemaining < 0)
|
||||
if (_Decoy.getTimeRemaining() < 0)
|
||||
{
|
||||
_Decoy.unSummon(_activeChar);
|
||||
}
|
||||
|
||||
@@ -118,27 +118,19 @@ public class L2DefenderInstance extends L2Attackable
|
||||
@Override
|
||||
public void returnHome()
|
||||
{
|
||||
if (getWalkSpeed() <= 0)
|
||||
if ((getWalkSpeed() <= 0) || (getSpawn() == null) || isInsideRadius(getSpawn(), 40, false, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getSpawn() == null)
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
return;
|
||||
_log.info(getObjectId() + ": moving home");
|
||||
}
|
||||
if (!isInsideRadius(getSpawn(), 40, false, false))
|
||||
setisReturningToSpawnPoint(true);
|
||||
clearAggroList();
|
||||
if (hasAI())
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info(getObjectId() + ": moving home");
|
||||
}
|
||||
setisReturningToSpawnPoint(true);
|
||||
clearAggroList();
|
||||
|
||||
if (hasAI())
|
||||
{
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, getSpawn().getLocation());
|
||||
}
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, getSpawn().getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,20 +173,14 @@ public class L2DefenderInstance extends L2Attackable
|
||||
}
|
||||
else if (interact)
|
||||
{
|
||||
if (isAutoAttackable(player) && !isAlikeDead())
|
||||
if (isAutoAttackable(player) && !isAlikeDead() && (Math.abs(player.getZ() - getZ()) < 600)) // this max heigth difference might need some tweaking
|
||||
{
|
||||
if (Math.abs(player.getZ() - getZ()) < 600) // this max heigth difference might need some tweaking
|
||||
{
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
|
||||
}
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
|
||||
}
|
||||
if (!isAutoAttackable(player))
|
||||
if (!isAutoAttackable(player) && !canInteract(player))
|
||||
{
|
||||
if (!canInteract(player))
|
||||
{
|
||||
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
|
||||
}
|
||||
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
|
||||
}
|
||||
}
|
||||
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
|
||||
|
||||
@@ -102,15 +102,17 @@ public class L2DoorInstance extends L2Character
|
||||
}
|
||||
|
||||
final int clanhallId = template.getClanHallId();
|
||||
if (clanhallId > 0)
|
||||
if (clanhallId <= 0)
|
||||
{
|
||||
final ClanHall hall = ClanHallManager.getAllClanHalls().get(clanhallId);
|
||||
if (hall != null)
|
||||
{
|
||||
setClanHall(hall);
|
||||
hall.getDoors().add(this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
final ClanHall hall = ClanHallManager.getAllClanHalls().get(clanhallId);
|
||||
if (hall == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
setClanHall(hall);
|
||||
hall.getDoors().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,17 +243,18 @@ public class L2DoorInstance extends L2Character
|
||||
public void setOpen(boolean open)
|
||||
{
|
||||
_open = open;
|
||||
if (getChildId() > 0)
|
||||
if (getChildId() <= 0)
|
||||
{
|
||||
final L2DoorInstance sibling = getSiblingDoor(getChildId());
|
||||
if (sibling != null)
|
||||
{
|
||||
sibling.notifyChildEvent(open);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Cannot find child id: " + getChildId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
final L2DoorInstance sibling = getSiblingDoor(getChildId());
|
||||
if (sibling != null)
|
||||
{
|
||||
sibling.notifyChildEvent(open);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Cannot find child id: " + getChildId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,11 +294,7 @@ public class L2DoorInstance extends L2Character
|
||||
{
|
||||
_castleIndex = CastleManager.getInstance().getCastleIndex(this);
|
||||
}
|
||||
if (_castleIndex < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return CastleManager.getInstance().getCastles().get(_castleIndex);
|
||||
return _castleIndex < 0 ? null : CastleManager.getInstance().getCastles().get(_castleIndex);
|
||||
}
|
||||
|
||||
// TODO: Replace index with the fort id itself.
|
||||
@@ -305,11 +304,7 @@ public class L2DoorInstance extends L2Character
|
||||
{
|
||||
_fortIndex = FortManager.getInstance().getFortIndex(this);
|
||||
}
|
||||
if (_fortIndex < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return FortManager.getInstance().getForts().get(_fortIndex);
|
||||
return _fortIndex < 0 ? null : FortManager.getInstance().getForts().get(_fortIndex);
|
||||
}
|
||||
|
||||
public void setClanHall(ClanHall clanhall)
|
||||
@@ -324,15 +319,9 @@ public class L2DoorInstance extends L2Character
|
||||
|
||||
public boolean isEnemy()
|
||||
{
|
||||
if ((getCastle() != null) && (getCastle().getResidenceId() > 0) && getCastle().getZone().isActive() && getIsShowHp())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ((getFort() != null) && (getFort().getResidenceId() > 0) && getFort().getZone().isActive() && getIsShowHp())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ((getClanHall() != null) && getClanHall().isSiegableHall() && ((SiegableHall) getClanHall()).getSiegeZone().isActive() && getIsShowHp())
|
||||
if (((getCastle() != null) && (getCastle().getResidenceId() > 0) && getCastle().getZone().isActive() && getIsShowHp())//
|
||||
|| ((getFort() != null) && (getFort().getResidenceId() > 0) && getFort().getZone().isActive() && getIsShowHp())//
|
||||
|| ((getClanHall() != null) && getClanHall().isSiegableHall() && ((SiegableHall) getClanHall()).getSiegeZone().isActive() && getIsShowHp()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -435,12 +424,7 @@ public class L2DoorInstance extends L2Character
|
||||
final StaticObject su = new StaticObject(this, false);
|
||||
final StaticObject targetableSu = new StaticObject(this, true);
|
||||
final DoorStatusUpdate dsu = new DoorStatusUpdate(this);
|
||||
OnEventTrigger oe = null;
|
||||
if (getEmitter() > 0)
|
||||
{
|
||||
oe = new OnEventTrigger(getEmitter(), getOpen());
|
||||
}
|
||||
|
||||
final OnEventTrigger oe = getEmitter() > 0 ? new OnEventTrigger(getEmitter(), getOpen()) : null;
|
||||
for (L2PcInstance player : knownPlayers)
|
||||
{
|
||||
if ((player == null) || !isVisibleFor(player))
|
||||
@@ -618,20 +602,10 @@ public class L2DoorInstance extends L2Character
|
||||
@Override
|
||||
public void reduceCurrentHp(double damage, L2Character attacker, boolean awake, boolean isDOT, Skill skill)
|
||||
{
|
||||
if (isWall() && (getInstanceId() == 0))
|
||||
if (isWall() && (getInstanceId() == 0) && (!attacker.isServitor() || (((L2ServitorInstance) attacker).getTemplate().getRace() != Race.SIEGE_WEAPON)))
|
||||
{
|
||||
if (!attacker.isServitor())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ServitorInstance servitor = (L2ServitorInstance) attacker;
|
||||
if (servitor.getTemplate().getRace() != Race.SIEGE_WEAPON)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
super.reduceCurrentHp(damage, attacker, awake, isDOT, skill);
|
||||
}
|
||||
|
||||
@@ -683,15 +657,15 @@ public class L2DoorInstance extends L2Character
|
||||
@Override
|
||||
public void sendInfo(L2PcInstance activeChar)
|
||||
{
|
||||
if (isVisibleFor(activeChar))
|
||||
if (!isVisibleFor(activeChar))
|
||||
{
|
||||
if (getEmitter() > 0)
|
||||
{
|
||||
activeChar.sendPacket(new OnEventTrigger(getEmitter(), getOpen()));
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new StaticObject(this, activeChar.isGM()));
|
||||
return;
|
||||
}
|
||||
if (getEmitter() > 0)
|
||||
{
|
||||
activeChar.sendPacket(new OnEventTrigger(getEmitter(), getOpen()));
|
||||
}
|
||||
activeChar.sendPacket(new StaticObject(this, activeChar.isGM()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -723,14 +697,8 @@ public class L2DoorInstance extends L2Character
|
||||
{
|
||||
return DoorData.getInstance().getDoor(doorId);
|
||||
}
|
||||
|
||||
final Instance inst = InstanceManager.getInstance().getInstance(getInstanceId());
|
||||
if (inst != null)
|
||||
{
|
||||
return inst.getDoor(doorId);
|
||||
}
|
||||
|
||||
return null; // 2 late
|
||||
return inst != null ? inst.getDoor(doorId) : null;
|
||||
}
|
||||
|
||||
private void startAutoCloseTask()
|
||||
|
||||
@@ -46,7 +46,7 @@ public class L2DoormenInstance extends L2NpcInstance
|
||||
showChatWindow(player);
|
||||
return;
|
||||
}
|
||||
else if (command.startsWith("open_doors"))
|
||||
if (command.startsWith("open_doors"))
|
||||
{
|
||||
if (isOwnerClan(player))
|
||||
{
|
||||
@@ -61,7 +61,7 @@ public class L2DoormenInstance extends L2NpcInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (command.startsWith("close_doors"))
|
||||
if (command.startsWith("close_doors"))
|
||||
{
|
||||
if (isOwnerClan(player))
|
||||
{
|
||||
@@ -76,7 +76,7 @@ public class L2DoormenInstance extends L2NpcInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (command.startsWith("tele"))
|
||||
if (command.startsWith("tele"))
|
||||
{
|
||||
if (isOwnerClan(player))
|
||||
{
|
||||
|
||||
@@ -46,18 +46,7 @@ public final class L2FishermanInstance extends L2MerchantInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/fisherman/" + pom + ".htm";
|
||||
return "html/fisherman/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,8 +62,7 @@ public class L2FlameTowerInstance extends L2Tower
|
||||
{
|
||||
if ((_zoneList != null) && (_upgradeLevel != 0))
|
||||
{
|
||||
final int maxIndex = _upgradeLevel * 2;
|
||||
for (int i = 0; i < maxIndex; i++)
|
||||
for (int i = 0; i < (_upgradeLevel * 2); i++)
|
||||
{
|
||||
final L2ZoneType zone = ZoneManager.getInstance().getZoneById(_zoneList.get(i));
|
||||
if (zone != null)
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
@@ -60,10 +58,8 @@ public class L2FortCommanderInstance extends L2DefenderInstance
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean isFort = ((getFort() != null) && (getFort().getResidenceId() > 0) && getFort().getSiege().isInProgress() && !getFort().getSiege().checkIsDefender(((L2PcInstance) attacker).getClan()));
|
||||
|
||||
// Attackable during siege by all except defenders
|
||||
return (isFort);
|
||||
return ((getFort() != null) && (getFort().getResidenceId() > 0) && getFort().getSiege().isInProgress() && !getFort().getSiege().checkIsDefender(((L2PcInstance) attacker).getClan()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,19 +98,19 @@ public class L2FortCommanderInstance extends L2DefenderInstance
|
||||
@Override
|
||||
public void returnHome()
|
||||
{
|
||||
if (!isInsideRadius(getSpawn(), 200, false, false))
|
||||
if (isInsideRadius(getSpawn(), 200, false, false))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info(getObjectId() + ": moving home");
|
||||
}
|
||||
setisReturningToSpawnPoint(true);
|
||||
clearAggroList();
|
||||
|
||||
if (hasAI())
|
||||
{
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, getSpawn().getLocation());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info(getObjectId() + ": moving home");
|
||||
}
|
||||
setisReturningToSpawnPoint(true);
|
||||
clearAggroList();
|
||||
if (hasAI())
|
||||
{
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, getSpawn().getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,8 +120,7 @@ public class L2FortCommanderInstance extends L2DefenderInstance
|
||||
final L2Spawn spawn = getSpawn();
|
||||
if ((spawn != null) && canTalk())
|
||||
{
|
||||
final List<FortSiegeSpawn> commanders = FortSiegeManager.getInstance().getCommanderSpawnList(getFort().getResidenceId());
|
||||
for (FortSiegeSpawn spawn2 : commanders)
|
||||
for (FortSiegeSpawn spawn2 : FortSiegeManager.getInstance().getCommanderSpawnList(getFort().getResidenceId()))
|
||||
{
|
||||
if (spawn2.getId() == spawn.getId())
|
||||
{
|
||||
@@ -159,7 +154,6 @@ public class L2FortCommanderInstance extends L2DefenderInstance
|
||||
{
|
||||
ns.addStringParameter(attacker.getName());
|
||||
}
|
||||
|
||||
broadcastPacket(ns);
|
||||
setCanTalk(false);
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleTalkTask(), 10000);
|
||||
|
||||
@@ -86,14 +86,7 @@ public class L2FortDoormenInstance extends L2DoormenInstance
|
||||
@Override
|
||||
protected final boolean isOwnerClan(L2PcInstance player)
|
||||
{
|
||||
if ((player.getClan() != null) && (getFort() != null) && (getFort().getOwnerClan() != null))
|
||||
{
|
||||
if (player.getClanId() == getFort().getOwnerClan().getId())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return (player.getClan() != null) && (getFort() != null) && (getFort().getOwnerClan() != null) && (player.getClanId() == getFort().getOwnerClan().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -189,47 +189,20 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
||||
String filename;
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
filename = "html/fortress/logistics.htm";
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = "html/fortress/logistics-" + val + ".htm";
|
||||
}
|
||||
final String filename = val == 0 ? "html/fortress/logistics.htm" : "html/fortress/logistics-" + val + ".htm";
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), filename);
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
html.replace("%npcId%", String.valueOf(getId()));
|
||||
if (getFort().getOwnerClan() != null)
|
||||
{
|
||||
html.replace("%clanname%", getFort().getOwnerClan().getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
html.replace("%clanname%", "NPC");
|
||||
}
|
||||
html.replace("%clanname%", getFort().getOwnerClan() != null ? getFort().getOwnerClan().getName() : "NPC");
|
||||
player.sendPacket(html);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "logistics";
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = "logistics-" + val;
|
||||
}
|
||||
|
||||
return "html/fortress/" + pom + ".htm";
|
||||
return "html/fortress/" + (val == 0 ? "logistics" : "logistics-" + val) + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -92,30 +92,16 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
final String actualCommand = st.nextToken(); // Get actual command
|
||||
|
||||
String val = "";
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
val = st.nextToken();
|
||||
}
|
||||
String val = st.countTokens() >= 1 ? st.nextToken() : "";
|
||||
if (actualCommand.equalsIgnoreCase("expel"))
|
||||
{
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CS_DISMISS))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/foreman-expel.htm");
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
player.sendPacket(html);
|
||||
}
|
||||
else
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/foreman-noprivs.htm");
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
player.sendPacket(html);
|
||||
}
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), player.hasClanPrivilege(ClanPrivilege.CS_DISMISS) ? "html/fortress/foreman-expel.htm" : "html/fortress/foreman-noprivs.htm");
|
||||
player.sendPacket(html);
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("banish_foreigner"))
|
||||
if (actualCommand.equalsIgnoreCase("banish_foreigner"))
|
||||
{
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CS_DISMISS))
|
||||
{
|
||||
@@ -134,7 +120,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("receive_report"))
|
||||
if (actualCommand.equalsIgnoreCase("receive_report"))
|
||||
{
|
||||
if (getFort().getFortState() < 2)
|
||||
{
|
||||
@@ -167,16 +153,14 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
hour = (int) Math.floor(getFort().getTimeTillRebelArmy() / 3600);
|
||||
minutes = (int) (Math.floor(getFort().getTimeTillRebelArmy() - (hour * 3600)) / 60);
|
||||
html.replace("%hr%", String.valueOf(hour));
|
||||
html.replace("%min%", String.valueOf(minutes));
|
||||
}
|
||||
else
|
||||
{
|
||||
hour = (int) Math.floor(getFort().getOwnedTime() / 3600);
|
||||
minutes = (int) (Math.floor(getFort().getOwnedTime() - (hour * 3600)) / 60);
|
||||
html.replace("%hr%", String.valueOf(hour));
|
||||
html.replace("%min%", String.valueOf(minutes));
|
||||
}
|
||||
html.replace("%min%", String.valueOf(minutes));
|
||||
html.replace("%hr%", String.valueOf(hour));
|
||||
hour = (int) Math.floor(getFort().getTimeTillNextFortUpdate() / 3600);
|
||||
minutes = (int) (Math.floor(getFort().getTimeTillNextFortUpdate() - (hour * 3600)) / 60);
|
||||
html.replace("%castle%", getFort().getContractedCastle().getName());
|
||||
@@ -186,8 +170,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("operate_door")) // door
|
||||
// control
|
||||
if (actualCommand.equalsIgnoreCase("operate_door"))
|
||||
{
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CS_OPEN_DOOR))
|
||||
{
|
||||
@@ -198,20 +181,10 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
getFort().openCloseDoor(player, Integer.parseInt(st.nextToken()), open);
|
||||
}
|
||||
if (open)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/foreman-opened.htm");
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
player.sendPacket(html);
|
||||
}
|
||||
else
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/foreman-closed.htm");
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
player.sendPacket(html);
|
||||
}
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), open ? "html/fortress/foreman-opened.htm" : "html/fortress/foreman-closed.htm");
|
||||
player.sendPacket(html);
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -231,7 +204,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("manage_vault"))
|
||||
if (actualCommand.equalsIgnoreCase("manage_vault"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CL_VIEW_WAREHOUSE))
|
||||
@@ -276,36 +249,25 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.startsWith("WithdrawSortedC"))
|
||||
if (actualCommand.startsWith("WithdrawSortedC"))
|
||||
{
|
||||
final String param[] = command.split("_");
|
||||
if (param.length > 2)
|
||||
{
|
||||
showVaultWindowWithdraw(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
|
||||
}
|
||||
else if (param.length > 1)
|
||||
{
|
||||
showVaultWindowWithdraw(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
showVaultWindowWithdraw(player, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
|
||||
showVaultWindowWithdraw(player, param.length > 1 ? WarehouseListType.valueOf(param[1]) : WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("functions"))
|
||||
if (actualCommand.equalsIgnoreCase("functions"))
|
||||
{
|
||||
if (val.equalsIgnoreCase("tele"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (getFort().getFunction(Fort.FUNC_TELEPORT) == null)
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/foreman-nac.htm");
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/" + getId() + "-t" + getFort().getFunction(Fort.FUNC_TELEPORT).getLvl() + ".htm");
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), getFort().getFunction(Fort.FUNC_TELEPORT) == null ? "html/fortress/foreman-nac.htm" : "html/fortress/" + getId() + "-t" + getFort().getFunction(Fort.FUNC_TELEPORT).getLvl() + ".htm");
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
else if (val.equalsIgnoreCase("support"))
|
||||
@@ -330,35 +292,14 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/foreman-functions.htm");
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_EXP) != null)
|
||||
{
|
||||
html.replace("%xp_regen%", String.valueOf(getFort().getFunction(Fort.FUNC_RESTORE_EXP).getLvl()));
|
||||
}
|
||||
else
|
||||
{
|
||||
html.replace("%xp_regen%", "0");
|
||||
}
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_HP) != null)
|
||||
{
|
||||
html.replace("%hp_regen%", String.valueOf(getFort().getFunction(Fort.FUNC_RESTORE_HP).getLvl()));
|
||||
}
|
||||
else
|
||||
{
|
||||
html.replace("%hp_regen%", "0");
|
||||
}
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_MP) != null)
|
||||
{
|
||||
html.replace("%mp_regen%", String.valueOf(getFort().getFunction(Fort.FUNC_RESTORE_MP).getLvl()));
|
||||
}
|
||||
else
|
||||
{
|
||||
html.replace("%mp_regen%", "0");
|
||||
}
|
||||
html.replace("%xp_regen%", getFort().getFunction(Fort.FUNC_RESTORE_EXP) != null ? String.valueOf(getFort().getFunction(Fort.FUNC_RESTORE_EXP).getLvl()) : "0");
|
||||
html.replace("%hp_regen%", getFort().getFunction(Fort.FUNC_RESTORE_HP) != null ? String.valueOf(getFort().getFunction(Fort.FUNC_RESTORE_HP).getLvl()) : "0");
|
||||
html.replace("%mp_regen%", getFort().getFunction(Fort.FUNC_RESTORE_MP) != null ? String.valueOf(getFort().getFunction(Fort.FUNC_RESTORE_MP).getLvl()) : "0");
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("manage"))
|
||||
if (actualCommand.equalsIgnoreCase("manage"))
|
||||
{
|
||||
if (player.hasClanPrivilege(ClanPrivilege.CS_SET_FUNCTIONS))
|
||||
{
|
||||
@@ -380,7 +321,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("mp_cancel"))
|
||||
if (val.equalsIgnoreCase("mp_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-cancel.htm");
|
||||
@@ -388,7 +329,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("exp_cancel"))
|
||||
if (val.equalsIgnoreCase("exp_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-cancel.htm");
|
||||
@@ -396,7 +337,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_hp"))
|
||||
if (val.equalsIgnoreCase("edit_hp"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -417,14 +358,13 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
|
||||
html.replace("%use%", "Provides additional HP recovery for clan members in the fortress.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
|
||||
html.replace("%apply%", "recovery hp " + String.valueOf(percent));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_mp"))
|
||||
if (val.equalsIgnoreCase("edit_mp"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -451,7 +391,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_exp"))
|
||||
if (val.equalsIgnoreCase("edit_exp"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -478,7 +418,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("hp"))
|
||||
if (val.equalsIgnoreCase("hp"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -490,15 +430,12 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-apply_confirmed.htm");
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_HP) != null)
|
||||
if ((getFort().getFunction(Fort.FUNC_RESTORE_HP) != null) && (getFort().getFunction(Fort.FUNC_RESTORE_HP).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_HP).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int percent = Integer.parseInt(val);
|
||||
switch (percent)
|
||||
@@ -529,7 +466,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("mp"))
|
||||
if (val.equalsIgnoreCase("mp"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -541,15 +478,12 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-apply_confirmed.htm");
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_MP) != null)
|
||||
if ((getFort().getFunction(Fort.FUNC_RESTORE_MP) != null) && (getFort().getFunction(Fort.FUNC_RESTORE_MP).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_MP).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int percent = Integer.parseInt(val);
|
||||
switch (percent)
|
||||
@@ -580,7 +514,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("exp"))
|
||||
if (val.equalsIgnoreCase("exp"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -592,15 +526,12 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-apply_confirmed.htm");
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_EXP) != null)
|
||||
if ((getFort().getFunction(Fort.FUNC_RESTORE_EXP) != null) && (getFort().getFunction(Fort.FUNC_RESTORE_EXP).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getFort().getFunction(Fort.FUNC_RESTORE_EXP).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", String.valueOf(val) + "%");
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int percent = Integer.parseInt(val);
|
||||
switch (percent)
|
||||
@@ -693,7 +624,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("support_cancel"))
|
||||
if (val.equalsIgnoreCase("support_cancel"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-cancel.htm");
|
||||
@@ -701,7 +632,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_support"))
|
||||
if (val.equalsIgnoreCase("edit_support"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -728,7 +659,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("edit_tele"))
|
||||
if (val.equalsIgnoreCase("edit_tele"))
|
||||
{
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -755,7 +686,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("tele"))
|
||||
if (val.equalsIgnoreCase("tele"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -767,15 +698,12 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-apply_confirmed.htm");
|
||||
if (getFort().getFunction(Fort.FUNC_TELEPORT) != null)
|
||||
if ((getFort().getFunction(Fort.FUNC_TELEPORT) != null) && (getFort().getFunction(Fort.FUNC_TELEPORT).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getFort().getFunction(Fort.FUNC_TELEPORT).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int lvl = Integer.parseInt(val);
|
||||
switch (lvl)
|
||||
@@ -806,7 +734,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (val.equalsIgnoreCase("support"))
|
||||
if (val.equalsIgnoreCase("support"))
|
||||
{
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
@@ -818,15 +746,12 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
val = st.nextToken();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-apply_confirmed.htm");
|
||||
if (getFort().getFunction(Fort.FUNC_SUPPORT) != null)
|
||||
if ((getFort().getFunction(Fort.FUNC_SUPPORT) != null) && (getFort().getFunction(Fort.FUNC_SUPPORT).getLvl() == Integer.parseInt(val)))
|
||||
{
|
||||
if (getFort().getFunction(Fort.FUNC_SUPPORT).getLvl() == Integer.parseInt(val))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/functions-used.htm");
|
||||
html.replace("%val%", "Stage " + String.valueOf(val));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
final int lvl = Integer.parseInt(val);
|
||||
switch (lvl)
|
||||
@@ -851,12 +776,8 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
if (!getFort().updateFunctions(player, Fort.FUNC_SUPPORT, lvl, fee, Config.FS_SUPPORT_FEE_RATIO, (getFort().getFunction(Fort.FUNC_SUPPORT) == null)))
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/low_adena.htm");
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
sendHtmlMessage(player, html);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -910,7 +831,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("support"))
|
||||
if (actualCommand.equalsIgnoreCase("support"))
|
||||
{
|
||||
setTarget(player);
|
||||
Skill skill;
|
||||
@@ -918,26 +839,17 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final int skill_id = Integer.parseInt(val);
|
||||
try
|
||||
{
|
||||
if (getFort().getFunction(Fort.FUNC_SUPPORT) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getFort().getFunction(Fort.FUNC_SUPPORT).getLvl() == 0)
|
||||
if ((getFort().getFunction(Fort.FUNC_SUPPORT) == null) || (getFort().getFunction(Fort.FUNC_SUPPORT).getLvl() == 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
int skill_lvl = 0;
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
skill_lvl = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
final int skill_lvl = st.countTokens() >= 1 ? Integer.parseInt(st.nextToken()) : 0;
|
||||
skill = SkillData.getInstance().getSkill(skill_id, skill_lvl);
|
||||
if (skill.hasEffectType(L2EffectType.SUMMON))
|
||||
{
|
||||
@@ -945,17 +857,14 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!((skill.getMpConsume() + skill.getMpInitialConsume()) > getCurrentMp()))
|
||||
{
|
||||
this.doCast(skill);
|
||||
}
|
||||
else
|
||||
if ((skill.getMpConsume() + skill.getMpInitialConsume()) > getCurrentMp())
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/support-no_mana.htm");
|
||||
html.replace("%mp%", String.valueOf((int) getCurrentMp()));
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
this.doCast(skill);
|
||||
}
|
||||
html.setFile(player.getHtmlPrefix(), "html/fortress/support-done.htm");
|
||||
html.replace("%mp%", String.valueOf((int) getCurrentMp()));
|
||||
@@ -972,7 +881,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("support_back"))
|
||||
if (actualCommand.equalsIgnoreCase("support_back"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (getFort().getFunction(Fort.FUNC_SUPPORT).getLvl() == 0)
|
||||
@@ -984,7 +893,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
sendHtmlMessage(player, html);
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("goto"))
|
||||
if (actualCommand.equalsIgnoreCase("goto"))
|
||||
{
|
||||
final int whereTo = Integer.parseInt(val);
|
||||
doTeleport(player, whereTo);
|
||||
@@ -1047,18 +956,15 @@ public class L2FortManagerInstance extends L2MerchantInstance
|
||||
|
||||
protected int validateCondition(L2PcInstance player)
|
||||
{
|
||||
if ((getFort() != null) && (getFort().getResidenceId() > 0))
|
||||
if ((getFort() != null) && (getFort().getResidenceId() > 0) && (player.getClan() != null))
|
||||
{
|
||||
if (player.getClan() != null)
|
||||
if (getFort().getZone().isActive())
|
||||
{
|
||||
if (getFort().getZone().isActive())
|
||||
{
|
||||
return COND_BUSY_BECAUSE_OF_SIEGE; // Busy because of siege
|
||||
}
|
||||
else if ((getFort().getOwnerClan() != null) && (getFort().getOwnerClan().getId() == player.getClanId()))
|
||||
{
|
||||
return COND_OWNER; // Owner
|
||||
}
|
||||
return COND_BUSY_BECAUSE_OF_SIEGE; // Busy because of siege
|
||||
}
|
||||
if ((getFort().getOwnerClan() != null) && (getFort().getOwnerClan().getId() == player.getClanId()))
|
||||
{
|
||||
return COND_OWNER; // Owner
|
||||
}
|
||||
}
|
||||
return COND_ALL_FALSE;
|
||||
|
||||
@@ -106,16 +106,7 @@ public class L2GuardInstance extends L2Attackable
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
return "html/guard/" + pom + ".htm";
|
||||
return "html/guard/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,18 +54,7 @@ public class L2MerchantInstance extends L2NpcInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/merchant/" + pom + ".htm";
|
||||
return "html/merchant/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -172,14 +172,7 @@ public class L2PetInstance extends L2Summon
|
||||
stopFeed();
|
||||
return;
|
||||
}
|
||||
else if (getCurrentFed() > getFeedConsume())
|
||||
{
|
||||
setCurrentFed(getCurrentFed() - getFeedConsume());
|
||||
}
|
||||
else
|
||||
{
|
||||
setCurrentFed(0);
|
||||
}
|
||||
setCurrentFed(getCurrentFed() > getFeedConsume() ? getCurrentFed() - getFeedConsume() : 0);
|
||||
|
||||
broadcastStatusUpdate();
|
||||
|
||||
@@ -238,12 +231,7 @@ public class L2PetInstance extends L2Summon
|
||||
|
||||
private int getFeedConsume()
|
||||
{
|
||||
// if pet is attacking
|
||||
if (isAttackingNow())
|
||||
{
|
||||
return getPetLevelData().getPetFeedBattle();
|
||||
}
|
||||
return getPetLevelData().getPetFeedNormal();
|
||||
return isAttackingNow() ? getPetLevelData().getPetFeedBattle() : getPetLevelData().getPetFeedNormal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,13 +334,7 @@ public class L2PetInstance extends L2Summon
|
||||
public L2Weapon getActiveWeaponItem()
|
||||
{
|
||||
final L2ItemInstance weapon = getActiveWeaponInstance();
|
||||
|
||||
if (weapon == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (L2Weapon) weapon.getItem();
|
||||
return weapon == null ? null : (L2Weapon) weapon.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -406,19 +388,19 @@ public class L2PetInstance extends L2Summon
|
||||
|
||||
if (sendMessage)
|
||||
{
|
||||
final SystemMessage sm;
|
||||
if (count > 1)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_S_DISAPPEARED);
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_S_DISAPPEARED);
|
||||
sm.addItemName(item.getId());
|
||||
sm.addLong(count);
|
||||
sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
|
||||
sm.addItemName(item.getId());
|
||||
sendPacket(sm);
|
||||
}
|
||||
sendPacket(sm);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -453,19 +435,19 @@ public class L2PetInstance extends L2Summon
|
||||
|
||||
if (sendMessage)
|
||||
{
|
||||
final SystemMessage sm;
|
||||
if (count > 1)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_S_DISAPPEARED);
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_S_DISAPPEARED);
|
||||
sm.addItemName(item.getId());
|
||||
sm.addLong(count);
|
||||
sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
|
||||
sm.addItemName(item.getId());
|
||||
sendPacket(sm);
|
||||
}
|
||||
sendPacket(sm);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -501,7 +483,7 @@ public class L2PetInstance extends L2Summon
|
||||
sendPacket(smsg);
|
||||
return;
|
||||
}
|
||||
else if (FortSiegeManager.getInstance().isCombat(target.getId()))
|
||||
if (FortSiegeManager.getInstance().isCombat(target.getId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -601,35 +583,30 @@ public class L2PetInstance extends L2Summon
|
||||
smsg.addItemName(target);
|
||||
sendPacket(smsg);
|
||||
}
|
||||
else if (target.getCount() > 1)
|
||||
{
|
||||
smsg = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S2_S1_S);
|
||||
smsg.addLong(target.getCount());
|
||||
smsg.addItemName(target);
|
||||
sendPacket(smsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
smsg = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S1);
|
||||
smsg.addItemName(target);
|
||||
if (target.getCount() > 1)
|
||||
{
|
||||
smsg = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S2_S1_S);
|
||||
smsg.addLong(target.getCount());
|
||||
}
|
||||
else
|
||||
{
|
||||
smsg = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_PICKED_UP_S1);
|
||||
}
|
||||
sendPacket(smsg);
|
||||
smsg.addItemName(target);
|
||||
}
|
||||
|
||||
// If owner is in party and it isnt finders keepers, distribute the item instead of stealing it -.-
|
||||
if (getOwner().isInParty() && (getOwner().getParty().getDistributionType() != PartyDistributionType.FINDERS_KEEPERS))
|
||||
{
|
||||
getOwner().getParty().distributeItem(getOwner(), target);
|
||||
}
|
||||
else
|
||||
{
|
||||
final L2ItemInstance item = getInventory().addItem("Pickup", target, getOwner(), this);
|
||||
// sendPacket(new PetItemList(getInventory().getItems()));
|
||||
sendPacket(new PetInventoryUpdate(item));
|
||||
sendPacket(new PetInventoryUpdate(getInventory().addItem("Pickup", target, getOwner(), this)));
|
||||
}
|
||||
}
|
||||
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
|
||||
if (follow)
|
||||
{
|
||||
followOwner();
|
||||
@@ -824,15 +801,16 @@ public class L2PetInstance extends L2Summon
|
||||
{
|
||||
dropit = getInventory().dropItem("Drop", dropit.getObjectId(), dropit.getCount(), getOwner(), this);
|
||||
|
||||
if (dropit != null)
|
||||
if (dropit == null)
|
||||
{
|
||||
if (protect)
|
||||
{
|
||||
dropit.getDropProtection().protect(getOwner());
|
||||
}
|
||||
_logPet.finer("Item id to drop: " + dropit.getId() + " amount: " + dropit.getCount());
|
||||
dropit.dropMe(this, getX(), getY(), getZ() + 100);
|
||||
return;
|
||||
}
|
||||
if (protect)
|
||||
{
|
||||
dropit.getDropProtection().protect(getOwner());
|
||||
}
|
||||
_logPet.finer("Item id to drop: " + dropit.getId() + " amount: " + dropit.getCount());
|
||||
dropit.dropMe(this, getX(), getY(), getZ() + 100);
|
||||
}
|
||||
|
||||
public void dropItemHere(L2ItemInstance dropit)
|
||||
@@ -942,16 +920,7 @@ public class L2PetInstance extends L2Summon
|
||||
_restoreSummon = false;
|
||||
}
|
||||
|
||||
String req;
|
||||
if (!isRespawned())
|
||||
{
|
||||
req = "INSERT INTO pets (name,level,curHp,curMp,exp,sp,fed,ownerId,restore,item_obj_id) VALUES (?,?,?,?,?,?,?,?,?,?)";
|
||||
}
|
||||
else
|
||||
{
|
||||
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
|
||||
}
|
||||
|
||||
final String req = !isRespawned() ? "INSERT INTO pets (name,level,curHp,curMp,exp,sp,fed,ownerId,restore,item_obj_id) VALUES (?,?,?,?,?,?,?,?,?,?)" : "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(req))
|
||||
{
|
||||
@@ -1025,24 +994,7 @@ public class L2PetInstance extends L2Summon
|
||||
}
|
||||
|
||||
final Skill skill = info.getSkill();
|
||||
// Do not save heals.
|
||||
if (skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (skill.isToggle())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Dances and songs are not kept in retail.
|
||||
if (skill.isDance() && !Config.ALT_STORE_DANCES)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (storedSkills.contains(skill.getReuseHashCode()))
|
||||
if ((skill.getAbnormalType() == AbnormalType.LIFE_FORCE_OTHERS) || skill.isToggle() || (skill.isDance() && !Config.ALT_STORE_DANCES) || storedSkills.contains(skill.getReuseHashCode()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1111,11 +1063,12 @@ public class L2PetInstance extends L2Summon
|
||||
|
||||
public synchronized void stopFeed()
|
||||
{
|
||||
if (_feedTask != null)
|
||||
if (_feedTask == null)
|
||||
{
|
||||
_feedTask.cancel(false);
|
||||
_feedTask = null;
|
||||
return;
|
||||
}
|
||||
_feedTask.cancel(false);
|
||||
_feedTask = null;
|
||||
}
|
||||
|
||||
public synchronized void startFeed()
|
||||
@@ -1318,32 +1271,20 @@ public class L2PetInstance extends L2Summon
|
||||
public final int getWeapon()
|
||||
{
|
||||
final L2ItemInstance weapon = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
|
||||
if (weapon != null)
|
||||
{
|
||||
return weapon.getId();
|
||||
}
|
||||
return 0;
|
||||
return weapon != null ? weapon.getId() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getArmor()
|
||||
{
|
||||
final L2ItemInstance weapon = getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
|
||||
if (weapon != null)
|
||||
{
|
||||
return weapon.getId();
|
||||
}
|
||||
return 0;
|
||||
return weapon != null ? weapon.getId() : 0;
|
||||
}
|
||||
|
||||
public final int getJewel()
|
||||
{
|
||||
final L2ItemInstance weapon = getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK);
|
||||
if (weapon != null)
|
||||
{
|
||||
return weapon.getId();
|
||||
}
|
||||
return 0;
|
||||
return weapon != null ? weapon.getId() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,29 +37,13 @@ public class L2PetManagerInstance extends L2MerchantInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/petmanager/" + pom + ".htm";
|
||||
return "html/petmanager/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showChatWindow(L2PcInstance player)
|
||||
{
|
||||
String filename = "html/petmanager/" + getId() + ".htm";
|
||||
if ((getId() == 36478) && player.hasSummon())
|
||||
{
|
||||
filename = "html/petmanager/restore-unsummonpet.htm";
|
||||
}
|
||||
|
||||
final String filename = (getId() == 36478) && player.hasSummon() ? "html/petmanager/restore-unsummonpet.htm" : "html/petmanager/" + getId() + ".htm";
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player.getHtmlPrefix(), filename);
|
||||
if (Config.ALLOW_RENTPET && Config.LIST_PET_RENT_NPC.contains(getId()))
|
||||
@@ -76,9 +60,7 @@ public class L2PetManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
if (command.startsWith("exchange"))
|
||||
{
|
||||
final String[] params = command.split(" ");
|
||||
final int val = Integer.parseInt(params[1]);
|
||||
switch (val)
|
||||
switch (Integer.parseInt(command.split(" ")[1]))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
@@ -196,12 +178,11 @@ public class L2PetManagerInstance extends L2MerchantInstance
|
||||
{
|
||||
player.addItem("", itemIdgive, 1, this, true);
|
||||
html.setFile(player.getHtmlPrefix(), "html/petmanager/" + getId() + ".htm");
|
||||
player.sendPacket(html);
|
||||
}
|
||||
else
|
||||
{
|
||||
html.setFile(player.getHtmlPrefix(), "html/petmanager/exchange_no.htm");
|
||||
player.sendPacket(html);
|
||||
}
|
||||
player.sendPacket(html);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,5 +548,4 @@ public class L2RaceManagerInstance extends L2Npc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -127,12 +127,9 @@ public class L2RaidBossInstance extends L2MonsterInstance
|
||||
final int spawnY = spawn.getY();
|
||||
final int spawnZ = spawn.getZ();
|
||||
|
||||
if (!isInCombat() && !isMovementDisabled())
|
||||
if (!isInCombat() && !isMovementDisabled() && !isInsideRadius(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200), true, false))
|
||||
{
|
||||
if (!isInsideRadius(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200), true, false))
|
||||
{
|
||||
teleToLocation(spawnX, spawnY, spawnZ, false);
|
||||
}
|
||||
teleToLocation(spawnX, spawnY, spawnZ, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -375,12 +375,7 @@ public class L2SepulcherMonsterInstance extends L2MonsterInstance
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_activeChar.isDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_activeChar.isVisible())
|
||||
if (_activeChar.isDead() || !_activeChar.isVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -401,12 +396,7 @@ public class L2SepulcherMonsterInstance extends L2MonsterInstance
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_activeChar.isDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_activeChar.isVisible())
|
||||
if (_activeChar.isDead() || !_activeChar.isVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -261,17 +261,7 @@ public class L2SepulcherNpcInstance extends L2Npc
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return HTML_FILE_PATH + pom + ".htm";
|
||||
return HTML_FILE_PATH + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -212,12 +212,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
@Override
|
||||
public void storeEffect(boolean storeEffects)
|
||||
{
|
||||
if (!Config.SUMMON_STORE_SKILL_COOLTIME)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((getOwner() == null) || getOwner().isInOlympiadMode())
|
||||
if (!Config.SUMMON_STORE_SKILL_COOLTIME || (getOwner() == null) || getOwner().isInOlympiadMode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -382,31 +377,19 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
@Override
|
||||
public byte getAttackElement()
|
||||
{
|
||||
if (getOwner() != null)
|
||||
{
|
||||
return getOwner().getAttackElement();
|
||||
}
|
||||
return super.getAttackElement();
|
||||
return getOwner() != null ? getOwner().getAttackElement() : super.getAttackElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAttackElementValue(byte attackAttribute)
|
||||
{
|
||||
if (getOwner() != null)
|
||||
{
|
||||
return (getOwner().getAttackElementValue(attackAttribute));
|
||||
}
|
||||
return super.getAttackElementValue(attackAttribute);
|
||||
return getOwner() != null ? getOwner().getAttackElementValue(attackAttribute) : super.getAttackElementValue(attackAttribute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefenseElementValue(byte defenseAttribute)
|
||||
{
|
||||
if (getOwner() != null)
|
||||
{
|
||||
return (getOwner().getDefenseElementValue(defenseAttribute));
|
||||
}
|
||||
return super.getDefenseElementValue(defenseAttribute);
|
||||
return getOwner() != null ? getOwner().getDefenseElementValue(defenseAttribute) : super.getDefenseElementValue(defenseAttribute);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -166,19 +166,14 @@ public class L2SiegeFlagInstance extends L2Npc
|
||||
public void reduceCurrentHp(double damage, L2Character attacker, Skill skill)
|
||||
{
|
||||
super.reduceCurrentHp(damage, attacker, skill);
|
||||
if (canTalk())
|
||||
if (!canTalk() || (((getCastle() == null) || !getCastle().getSiege().isInProgress()) && ((getFort() == null) || !getFort().getSiege().isInProgress()) && ((getConquerableHall() == null) || !getConquerableHall().isInSiege())) || (_clan == null))
|
||||
{
|
||||
if (((getCastle() != null) && getCastle().getSiege().isInProgress()) || ((getFort() != null) && getFort().getSiege().isInProgress()) || ((getConquerableHall() != null) && getConquerableHall().isInSiege()))
|
||||
{
|
||||
if (_clan != null)
|
||||
{
|
||||
// send warning to owners of headquarters that theirs base is under attack
|
||||
_clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.YOUR_BASE_IS_BEING_ATTACKED));
|
||||
setCanTalk(false);
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleTalkTask(), 20000);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.YOUR_BASE_IS_BEING_ATTACKED));
|
||||
setCanTalk(false);
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleTalkTask(), 20000);
|
||||
}
|
||||
|
||||
private class ScheduleTalkTask implements Runnable
|
||||
|
||||
@@ -142,18 +142,20 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
|
||||
|
||||
public void setFoodType(int foodItemId)
|
||||
{
|
||||
if (foodItemId > 0)
|
||||
if (foodItemId <= 0)
|
||||
{
|
||||
_foodSkillId = foodItemId;
|
||||
|
||||
// start the duration checks
|
||||
// start the buff tasks
|
||||
if (_durationCheckTask != null)
|
||||
{
|
||||
_durationCheckTask.cancel(true);
|
||||
}
|
||||
_durationCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckDuration(this), DURATION_CHECK_INTERVAL, DURATION_CHECK_INTERVAL);
|
||||
return;
|
||||
}
|
||||
|
||||
_foodSkillId = foodItemId;
|
||||
|
||||
// start the duration checks
|
||||
// start the buff tasks
|
||||
if (_durationCheckTask != null)
|
||||
{
|
||||
_durationCheckTask.cancel(true);
|
||||
}
|
||||
_durationCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckDuration(this), DURATION_CHECK_INTERVAL, DURATION_CHECK_INTERVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,17 +372,9 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
|
||||
// for lower HP ranges, heal or recharge the owner with 1 skill use per attack.
|
||||
else if (HPRatio < 0.5)
|
||||
{
|
||||
int chance = 1;
|
||||
if (HPRatio < 0.25)
|
||||
{
|
||||
chance = 2;
|
||||
}
|
||||
|
||||
// if the owner has a lot of HP, then debuff the enemy with a random debuff among the available skills
|
||||
for (Skill skill : getTemplate().getSkills().values())
|
||||
{
|
||||
// if the skill is a buff, check if the owner has it already [ owner.getEffect(L2Skill skill) ]
|
||||
if ((Rnd.get(5) < chance) && skill.hasEffectType(L2EffectType.CPHEAL, L2EffectType.HEAL, L2EffectType.MANAHEAL_BY_LEVEL, L2EffectType.MANAHEAL_PERCENT))
|
||||
if ((Rnd.get(5) < (HPRatio < 0.25 ? 2 : 1)) && skill.hasEffectType(L2EffectType.CPHEAL, L2EffectType.HEAL, L2EffectType.MANAHEAL_BY_LEVEL, L2EffectType.MANAHEAL_PERCENT))
|
||||
{
|
||||
sitCastAndFollow(skill, _owner);
|
||||
}
|
||||
|
||||
@@ -74,8 +74,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
public void onBypassFeedback(L2PcInstance player, String command)
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
final String cmd = st.nextToken();
|
||||
switch (cmd)
|
||||
switch (st.nextToken())
|
||||
{
|
||||
case "showNoblesSelect":
|
||||
{
|
||||
@@ -290,7 +289,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
{
|
||||
return "<fstring>1000308</fstring>";
|
||||
}
|
||||
else if (itemId == Inventory.ANCIENT_ADENA_ID)
|
||||
if (itemId == Inventory.ANCIENT_ADENA_ID)
|
||||
{
|
||||
return "<fstring>1000309</fstring>";
|
||||
}
|
||||
@@ -343,7 +342,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
player.sendPacket(html);
|
||||
return;
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("goto"))
|
||||
if (actualCommand.equalsIgnoreCase("goto"))
|
||||
{
|
||||
final int npcId = getId();
|
||||
|
||||
@@ -372,14 +371,10 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
doTeleport(player, whereTo);
|
||||
return;
|
||||
}
|
||||
else if (condition == COND_OWNER)
|
||||
if (condition == COND_OWNER)
|
||||
{
|
||||
// TODO: Replace 0 with highest level when privilege level is implemented
|
||||
int minPrivilegeLevel = 0;
|
||||
if (st.countTokens() >= 1)
|
||||
{
|
||||
minPrivilegeLevel = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
final int minPrivilegeLevel = st.countTokens() >= 1 ? Integer.parseInt(st.nextToken()) : 0;
|
||||
|
||||
// TODO: Replace 10 with privilege level of player
|
||||
if (10 >= minPrivilegeLevel)
|
||||
@@ -413,7 +408,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
showNewbieHtml(player);
|
||||
return;
|
||||
}
|
||||
else if ((val == 1) && (cal.get(Calendar.HOUR_OF_DAY) >= 20) && (cal.get(Calendar.HOUR_OF_DAY) <= 23) && ((cal.get(Calendar.DAY_OF_WEEK) == 1) || (cal.get(Calendar.DAY_OF_WEEK) == 7)))
|
||||
if ((val == 1) && (cal.get(Calendar.HOUR_OF_DAY) >= 20) && (cal.get(Calendar.HOUR_OF_DAY) <= 23) && ((cal.get(Calendar.DAY_OF_WEEK) == 1) || (cal.get(Calendar.DAY_OF_WEEK) == 7)))
|
||||
{
|
||||
showHalfPriceHtml(player);
|
||||
return;
|
||||
@@ -426,17 +421,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/teleporter/" + pom + ".htm";
|
||||
return "html/teleporter/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
private void showNewbieHtml(L2PcInstance player)
|
||||
@@ -469,12 +454,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
|
||||
String filename = "html/teleporter/half/" + getId() + ".htm";
|
||||
if (!HtmCache.getInstance().isLoadable(filename))
|
||||
{
|
||||
filename = "html/teleporter/" + getId() + "-1.htm";
|
||||
}
|
||||
|
||||
final String filename = !HtmCache.getInstance().isLoadable(("html/teleporter/half/" + getId() + ".htm")) ? "html/teleporter/" + getId() + "-1.htm" : "html/teleporter/half/" + getId() + ".htm";
|
||||
html.setFile(player.getHtmlPrefix(), filename);
|
||||
html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
html.replace("%npcname%", getName());
|
||||
@@ -492,7 +472,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
super.showChatWindow(player);
|
||||
return;
|
||||
}
|
||||
else if (condition > COND_ALL_FALSE)
|
||||
if (condition > COND_ALL_FALSE)
|
||||
{
|
||||
if (condition == COND_BUSY_BECAUSE_OF_SIEGE)
|
||||
{
|
||||
@@ -522,27 +502,27 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
|
||||
return;
|
||||
}
|
||||
else if (TownManager.townHasCastleInSiege(list.getLocX(), list.getLocY()) && isInsideZone(ZoneId.TOWN))
|
||||
if (TownManager.townHasCastleInSiege(list.getLocX(), list.getLocY()) && isInsideZone(ZoneId.TOWN))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
|
||||
return;
|
||||
}
|
||||
else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && (player.getReputation() < 0))
|
||||
if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && (player.getReputation() < 0))
|
||||
{
|
||||
player.sendMessage("Go away, you're not welcome here.");
|
||||
return;
|
||||
}
|
||||
else if (!Config.ALT_GAME_FLAGGED_PLAYER_CAN_USE_GK && (player.getPvpFlag() > 0))
|
||||
if (!Config.ALT_GAME_FLAGGED_PLAYER_CAN_USE_GK && (player.getPvpFlag() > 0))
|
||||
{
|
||||
player.sendMessage("I don't speak with angry people.");
|
||||
return;
|
||||
}
|
||||
else if (player.isCombatFlagEquipped())
|
||||
if (player.isCombatFlagEquipped())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_WHILE_IN_POSSESSION_OF_A_WARD);
|
||||
return;
|
||||
}
|
||||
else if (list.getIsForNoble() && !player.isNoble())
|
||||
if (list.getIsForNoble() && !player.isNoble())
|
||||
{
|
||||
final String filename = "html/teleporter/nobles_not.htm";
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
@@ -552,7 +532,7 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
player.sendPacket(html);
|
||||
return;
|
||||
}
|
||||
else if (player.isAlikeDead())
|
||||
if (player.isAlikeDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -598,17 +578,14 @@ public final class L2TeleporterInstance extends L2Npc
|
||||
return COND_REGULAR; // Regular access
|
||||
}
|
||||
// Teleporter is on castle ground and siege is in progress
|
||||
else if (getCastle().getSiege().isInProgress())
|
||||
if (getCastle().getSiege().isInProgress())
|
||||
{
|
||||
return COND_BUSY_BECAUSE_OF_SIEGE; // Busy because of siege
|
||||
}
|
||||
// Teleporter is on castle ground and player is in a clan
|
||||
else if (player.getClan() != null)
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId()))
|
||||
{
|
||||
if (getCastle().getOwnerId() == player.getClanId())
|
||||
{
|
||||
return COND_OWNER; // Owner
|
||||
}
|
||||
return COND_OWNER;
|
||||
}
|
||||
|
||||
return COND_ALL_FALSE;
|
||||
|
||||
@@ -34,16 +34,6 @@ public class L2TrainerInstance extends L2NpcInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/trainer/" + pom + ".htm";
|
||||
return "html/trainer/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
}
|
||||
@@ -427,15 +427,17 @@ public final class L2TrapInstance extends L2Npc
|
||||
_owner = null;
|
||||
}
|
||||
|
||||
if (isVisible() && !isDead())
|
||||
if (!isVisible() || isDead())
|
||||
{
|
||||
if (getWorldRegion() != null)
|
||||
{
|
||||
getWorldRegion().removeFromZones(this);
|
||||
}
|
||||
|
||||
deleteMe();
|
||||
return;
|
||||
}
|
||||
|
||||
if (getWorldRegion() != null)
|
||||
{
|
||||
getWorldRegion().removeFromZones(this);
|
||||
}
|
||||
|
||||
deleteMe();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,11 +34,6 @@ public final class L2VillageMasterDElfInstance extends L2VillageMasterInstance
|
||||
@Override
|
||||
protected final boolean checkVillageMasterRace(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfRace(Race.DARK_ELF);
|
||||
return (pclass != null) && pclass.isOfRace(Race.DARK_ELF);
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,6 @@ public final class L2VillageMasterDwarfInstance extends L2VillageMasterInstance
|
||||
@Override
|
||||
protected final boolean checkVillageMasterRace(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfRace(Race.DWARF);
|
||||
return (pclass != null) && pclass.isOfRace(Race.DWARF);
|
||||
}
|
||||
}
|
||||
@@ -35,22 +35,12 @@ public final class L2VillageMasterFighterInstance extends L2VillageMasterInstanc
|
||||
@Override
|
||||
protected final boolean checkVillageMasterRace(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfRace(Race.HUMAN) || pclass.isOfRace(Race.ELF);
|
||||
return (pclass != null) && (pclass.isOfRace(Race.HUMAN) || pclass.isOfRace(Race.ELF));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean checkVillageMasterTeachType(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfType(ClassType.Fighter);
|
||||
return (pclass != null) && pclass.isOfType(ClassType.Fighter);
|
||||
}
|
||||
}
|
||||
@@ -70,18 +70,7 @@ public class L2VillageMasterInstance extends L2NpcInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/villagemaster/" + pom + ".htm";
|
||||
return "html/villagemaster/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,11 +34,6 @@ public final class L2VillageMasterKamaelInstance extends L2VillageMasterInstance
|
||||
@Override
|
||||
protected final boolean checkVillageMasterRace(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfRace(Race.KAMAEL);
|
||||
return (pclass != null) && pclass.isOfRace(Race.KAMAEL);
|
||||
}
|
||||
}
|
||||
@@ -35,22 +35,12 @@ public final class L2VillageMasterMysticInstance extends L2VillageMasterInstance
|
||||
@Override
|
||||
protected final boolean checkVillageMasterRace(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfRace(Race.HUMAN) || pclass.isOfRace(Race.ELF);
|
||||
return (pclass != null) && (pclass.isOfRace(Race.HUMAN) || pclass.isOfRace(Race.ELF));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean checkVillageMasterTeachType(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfType(ClassType.Mystic);
|
||||
return (pclass != null) && pclass.isOfType(ClassType.Mystic);
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,6 @@ public final class L2VillageMasterOrcInstance extends L2VillageMasterInstance
|
||||
@Override
|
||||
protected final boolean checkVillageMasterRace(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfRace(Race.ORC);
|
||||
return (pclass != null) && pclass.isOfRace(Race.ORC);
|
||||
}
|
||||
}
|
||||
@@ -35,22 +35,12 @@ public final class L2VillageMasterPriestInstance extends L2VillageMasterInstance
|
||||
@Override
|
||||
protected final boolean checkVillageMasterRace(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfRace(Race.HUMAN) || pclass.isOfRace(Race.ELF);
|
||||
return (pclass != null) && (pclass.isOfRace(Race.HUMAN) || pclass.isOfRace(Race.ELF));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean checkVillageMasterTeachType(PlayerClass pclass)
|
||||
{
|
||||
if (pclass == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return pclass.isOfType(ClassType.Priest);
|
||||
return (pclass != null) && pclass.isOfType(ClassType.Priest);
|
||||
}
|
||||
}
|
||||
@@ -40,17 +40,6 @@ public class L2WarehouseInstance extends L2NpcInstance
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
pom = "" + npcId;
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = npcId + "-" + val;
|
||||
}
|
||||
|
||||
return "html/warehouse/" + pom + ".htm";
|
||||
return "html/warehouse/" + (val == 0 ? "" + npcId : npcId + "-" + val) + ".htm";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ public class AttackableKnownList extends NpcKnownList
|
||||
return object.getKnownList().getDistanceToWatchObject(getActiveObject());
|
||||
}
|
||||
|
||||
final int max = Math.max(300, Math.max(getActiveChar().getAggroRange(), getActiveChar().getTemplate().getClanHelpRange()));
|
||||
|
||||
return max;
|
||||
return Math.max(300, Math.max(getActiveChar().getAggroRange(), getActiveChar().getTemplate().getClanHelpRange()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,12 +212,9 @@ public class CharKnownList extends ObjectKnownList
|
||||
final List<L2Character> result = new LinkedList<>();
|
||||
for (L2Object obj : getKnownObjects().values())
|
||||
{
|
||||
if (obj instanceof L2Character)
|
||||
if ((obj instanceof L2Character) && Util.checkIfInRange((int) radius, getActiveChar(), obj, true))
|
||||
{
|
||||
if (Util.checkIfInRange((int) radius, getActiveChar(), obj, true))
|
||||
{
|
||||
result.add((L2Character) obj);
|
||||
}
|
||||
result.add((L2Character) obj);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -73,21 +73,17 @@ public class GuardKnownList extends AttackableKnownList
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((Config.GUARD_ATTACK_AGGRO_MOB && getActiveChar().isInActiveRegion()) && object.isMonster())
|
||||
else if ((Config.GUARD_ATTACK_AGGRO_MOB && getActiveChar().isInActiveRegion()) && object.isMonster() && ((L2MonsterInstance) object).isAggressive())
|
||||
{
|
||||
// Check if the object added is an aggressive L2MonsterInstance
|
||||
if (((L2MonsterInstance) object).isAggressive())
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine(getActiveChar().getObjectId() + ": Aggressive mob " + object.getObjectId() + " entered scan range");
|
||||
}
|
||||
|
||||
// Set the L2GuardInstance Intention to AI_INTENTION_ACTIVE
|
||||
if (getActiveChar().getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
|
||||
{
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, null);
|
||||
}
|
||||
_log.fine(getActiveChar().getObjectId() + ": Aggressive mob " + object.getObjectId() + " entered scan range");
|
||||
}
|
||||
|
||||
// Set the L2GuardInstance Intention to AI_INTENTION_ACTIVE
|
||||
if (getActiveChar().getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
|
||||
{
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,13 +99,9 @@ public class GuardKnownList extends AttackableKnownList
|
||||
}
|
||||
|
||||
// Check if the aggression list of this guard is empty.
|
||||
if (getActiveChar().getAggroList().isEmpty())
|
||||
if (getActiveChar().getAggroList().isEmpty() && getActiveChar().hasAI() && !getActiveChar().isWalker())
|
||||
{
|
||||
// Set the L2GuardInstance to AI_INTENTION_IDLE
|
||||
if (getActiveChar().hasAI() && !getActiveChar().isWalker())
|
||||
{
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);
|
||||
}
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -102,11 +102,12 @@ public class NpcKnownList extends CharKnownList
|
||||
// Support for Walking monsters aggro
|
||||
public void stopTrackingTask()
|
||||
{
|
||||
if (_trackingTask != null)
|
||||
if (_trackingTask == null)
|
||||
{
|
||||
_trackingTask.cancel(true);
|
||||
_trackingTask = null;
|
||||
return;
|
||||
}
|
||||
_trackingTask.cancel(true);
|
||||
_trackingTask = null;
|
||||
}
|
||||
|
||||
// Support for Walking monsters aggro
|
||||
|
||||
@@ -83,14 +83,9 @@ public class PcKnownList extends PlayableKnownList
|
||||
{
|
||||
object.sendInfo(getActiveChar());
|
||||
|
||||
if (object instanceof L2Character)
|
||||
if ((object instanceof L2Character) && ((L2Character) object).hasAI())
|
||||
{
|
||||
// Update the state of the L2Character object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance
|
||||
final L2Character obj = (L2Character) object;
|
||||
if (obj.hasAI())
|
||||
{
|
||||
obj.getAI().describeStateToPlayer(getActiveChar());
|
||||
}
|
||||
((L2Character) object).getAI().describeStateToPlayer(getActiveChar());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,12 +667,9 @@ public class CharStat
|
||||
}
|
||||
double mpConsume = skill.getMpConsume();
|
||||
final double nextDanceMpCost = Math.ceil(skill.getMpConsume() / 2.);
|
||||
if (skill.isDance())
|
||||
if (skill.isDance() && Config.DANCE_CONSUME_ADDITIONAL_MP && (_activeChar != null) && (_activeChar.getDanceCount() > 0))
|
||||
{
|
||||
if (Config.DANCE_CONSUME_ADDITIONAL_MP && (_activeChar != null) && (_activeChar.getDanceCount() > 0))
|
||||
{
|
||||
mpConsume += _activeChar.getDanceCount() * nextDanceMpCost;
|
||||
}
|
||||
mpConsume += _activeChar.getDanceCount() * nextDanceMpCost;
|
||||
}
|
||||
|
||||
mpConsume = calcStat(Stats.MP_CONSUME, mpConsume, null, skill);
|
||||
@@ -681,14 +678,11 @@ public class CharStat
|
||||
{
|
||||
return (int) calcStat(Stats.DANCE_MP_CONSUME_RATE, mpConsume);
|
||||
}
|
||||
else if (skill.isMagic())
|
||||
if (skill.isMagic())
|
||||
{
|
||||
return (int) calcStat(Stats.MAGICAL_MP_CONSUME_RATE, mpConsume);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) calcStat(Stats.PHYSICAL_MP_CONSUME_RATE, mpConsume);
|
||||
}
|
||||
return (int) calcStat(Stats.PHYSICAL_MP_CONSUME_RATE, mpConsume);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -697,12 +691,7 @@ public class CharStat
|
||||
*/
|
||||
public final int getMpInitialConsume(Skill skill)
|
||||
{
|
||||
if (skill == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (int) calcStat(Stats.MP_CONSUME, skill.getMpInitialConsume(), null, skill);
|
||||
return skill == null ? 1 : (int) calcStat(Stats.MP_CONSUME, skill.getMpInitialConsume(), null, skill);
|
||||
}
|
||||
|
||||
public byte getAttackElement()
|
||||
@@ -879,11 +868,7 @@ public class CharStat
|
||||
public int getMaxBuffCount()
|
||||
{
|
||||
final int extraSlots = _activeChar.getSkillLevel(DIVINE_INSPIRATION);
|
||||
if (extraSlots > -1)
|
||||
{
|
||||
return _maxBuffCount + extraSlots;
|
||||
}
|
||||
return _maxBuffCount;
|
||||
return extraSlots > -1 ? _maxBuffCount + extraSlots : _maxBuffCount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,12 +77,7 @@ public class PcStat extends PlayableStat
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
|
||||
// Allowed to gain exp?
|
||||
if (!getActiveChar().getAccessLevel().canGainExp())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!super.addExp(value))
|
||||
if (!getActiveChar().getAccessLevel().canGainExp() || !super.addExp(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -191,23 +191,13 @@ public class PetStat extends SummonStat
|
||||
@Override
|
||||
public double getPAtkSpd()
|
||||
{
|
||||
double val = super.getPAtkSpd();
|
||||
if (getActiveChar().isHungry())
|
||||
{
|
||||
val = val / 2;
|
||||
}
|
||||
return val;
|
||||
return getActiveChar().isHungry() ? super.getPAtkSpd() / 2 : super.getPAtkSpd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMAtkSpd()
|
||||
{
|
||||
int val = super.getMAtkSpd();
|
||||
if (getActiveChar().isHungry())
|
||||
{
|
||||
val = val / 2;
|
||||
}
|
||||
return val;
|
||||
return getActiveChar().isHungry() ? super.getMAtkSpd() / 2 : super.getMAtkSpd();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -312,9 +312,7 @@ public class CharStatus
|
||||
|
||||
public final void setCurrentHpMp(double newHp, double newMp)
|
||||
{
|
||||
boolean hpOrMpWasChanged = setCurrentHp(newHp, false);
|
||||
hpOrMpWasChanged |= setCurrentMp(newMp, false);
|
||||
if (hpOrMpWasChanged)
|
||||
if (setCurrentHp(newHp, false) | setCurrentMp(newMp, false))
|
||||
{
|
||||
getActiveChar().broadcastStatusUpdate();
|
||||
}
|
||||
|
||||
@@ -46,14 +46,7 @@ public class PcStatus extends PlayableStatus
|
||||
@Override
|
||||
public final void reduceCp(int value)
|
||||
{
|
||||
if (getCurrentCp() > value)
|
||||
{
|
||||
setCurrentCp(getCurrentCp() - value);
|
||||
}
|
||||
else
|
||||
{
|
||||
setCurrentCp(0);
|
||||
}
|
||||
setCurrentCp(getCurrentCp() > value ? getCurrentCp() - value : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,12 +94,9 @@ public class PcStatus extends PlayableStatus
|
||||
getActiveChar().standUp();
|
||||
}
|
||||
|
||||
if (!isDOT)
|
||||
if (!isDOT && getActiveChar().isStunned() && (Rnd.get(10) == 0))
|
||||
{
|
||||
if (getActiveChar().isStunned() && (Rnd.get(10) == 0))
|
||||
{
|
||||
getActiveChar().stopStunning(true);
|
||||
}
|
||||
getActiveChar().stopStunning(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,10 +175,8 @@ public class PcStatus extends PlayableStatus
|
||||
final L2PcInstance caster = getActiveChar().getTransferingDamageTo();
|
||||
if ((caster != null) && (getActiveChar().getParty() != null) && Util.checkIfInRange(1000, getActiveChar(), caster, true) && !caster.isDead() && (getActiveChar() != caster) && getActiveChar().getParty().getMembers().contains(caster))
|
||||
{
|
||||
int transferDmg = 0;
|
||||
int transferDmg = Math.min((int) caster.getCurrentHp() - 1, (((int) value * (int) getActiveChar().getStat().calcStat(Stats.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100));
|
||||
|
||||
transferDmg = ((int) value * (int) getActiveChar().getStat().calcStat(Stats.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100;
|
||||
transferDmg = Math.min((int) caster.getCurrentHp() - 1, transferDmg);
|
||||
if (transferDmg > 0)
|
||||
{
|
||||
int membersInRange = 0;
|
||||
@@ -294,39 +282,41 @@ public class PcStatus extends PlayableStatus
|
||||
setCurrentHp(value);
|
||||
}
|
||||
|
||||
if ((getActiveChar().getCurrentHp() < 0.5) && !isHPConsumption && getActiveChar().isMortal())
|
||||
if ((getActiveChar().getCurrentHp() >= 0.5) || isHPConsumption || !getActiveChar().isMortal())
|
||||
{
|
||||
getActiveChar().abortAttack();
|
||||
getActiveChar().abortCast();
|
||||
|
||||
if (getActiveChar().isInOlympiadMode())
|
||||
{
|
||||
stopHpMpRegeneration();
|
||||
getActiveChar().setIsDead(true);
|
||||
getActiveChar().setIsPendingRevive(true);
|
||||
final L2Summon pet = getActiveChar().getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);
|
||||
}
|
||||
getActiveChar().getServitors().values().forEach(s -> s.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((attacker != null) && (attacker.isPlayer()))
|
||||
{
|
||||
final int hpRestore = (int) attacker.getStat().calcStat(Stats.HP_RESTORE_ON_KILL, 0, null, null);
|
||||
if (hpRestore > 0)
|
||||
{
|
||||
final double amount = Math.max(Math.min((attacker.getMaxHp() * hpRestore) / 100, attacker.getMaxRecoverableHp() - attacker.getCurrentHp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
attacker.setCurrentHp(amount + attacker.getCurrentHp());
|
||||
}
|
||||
}
|
||||
}
|
||||
getActiveChar().doDie(attacker);
|
||||
return;
|
||||
}
|
||||
|
||||
getActiveChar().abortAttack();
|
||||
getActiveChar().abortCast();
|
||||
|
||||
if (getActiveChar().isInOlympiadMode())
|
||||
{
|
||||
stopHpMpRegeneration();
|
||||
getActiveChar().setIsDead(true);
|
||||
getActiveChar().setIsPendingRevive(true);
|
||||
final L2Summon pet = getActiveChar().getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);
|
||||
}
|
||||
getActiveChar().getServitors().values().forEach(s -> s.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((attacker != null) && (attacker.isPlayer()))
|
||||
{
|
||||
final int hpRestore = (int) attacker.getStat().calcStat(Stats.HP_RESTORE_ON_KILL, 0, null, null);
|
||||
if (hpRestore > 0)
|
||||
{
|
||||
final double amount = Math.max(Math.min((attacker.getMaxHp() * hpRestore) / 100, attacker.getMaxRecoverableHp() - attacker.getCurrentHp()), 0);
|
||||
if (amount != 0)
|
||||
{
|
||||
attacker.setCurrentHp(amount + attacker.getCurrentHp());
|
||||
}
|
||||
}
|
||||
}
|
||||
getActiveChar().doDie(attacker);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,17 +47,19 @@ public class PetStatus extends SummonStatus
|
||||
|
||||
super.reduceHp(value, attacker, awake, isDOT, isHpConsumption);
|
||||
|
||||
if (attacker != null)
|
||||
if (attacker == null)
|
||||
{
|
||||
if (!isDOT && (getActiveChar().getOwner() != null))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_RECEIVED_S2_DAMAGE_BY_C1);
|
||||
sm.addCharName(attacker);
|
||||
sm.addInt((int) value);
|
||||
getActiveChar().sendPacket(sm);
|
||||
}
|
||||
getActiveChar().getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, attacker);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDOT && (getActiveChar().getOwner() != null))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_RECEIVED_S2_DAMAGE_BY_C1);
|
||||
sm.addCharName(attacker);
|
||||
sm.addInt((int) value);
|
||||
getActiveChar().sendPacket(sm);
|
||||
}
|
||||
getActiveChar().getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, attacker);
|
||||
}
|
||||
|
||||
public int getCurrentFed()
|
||||
|
||||
@@ -56,10 +56,8 @@ public class SummonStatus extends PlayableStatus
|
||||
{
|
||||
if ((caster != null) && Util.checkIfInRange(1000, getActiveChar(), caster, true) && !caster.isDead() && getActiveChar().getParty().getMembers().contains(caster))
|
||||
{
|
||||
int transferDmg = 0;
|
||||
int transferDmg = Math.min((int) caster.getCurrentHp() - 1, (((int) value * (int) getActiveChar().getStat().calcStat(Stats.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100));
|
||||
|
||||
transferDmg = ((int) value * (int) getActiveChar().getStat().calcStat(Stats.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100;
|
||||
transferDmg = Math.min((int) caster.getCurrentHp() - 1, transferDmg);
|
||||
if (transferDmg > 0)
|
||||
{
|
||||
int membersInRange = 0;
|
||||
@@ -92,10 +90,8 @@ public class SummonStatus extends PlayableStatus
|
||||
}
|
||||
else if ((caster != null) && (caster == getActiveChar().getOwner()) && Util.checkIfInRange(1000, getActiveChar(), caster, true) && !caster.isDead()) // when no party, transfer only to owner (caster)
|
||||
{
|
||||
int transferDmg = 0;
|
||||
int transferDmg = Math.min((int) caster.getCurrentHp() - 1, (((int) value * (int) getActiveChar().getStat().calcStat(Stats.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100));
|
||||
|
||||
transferDmg = ((int) value * (int) getActiveChar().getStat().calcStat(Stats.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100;
|
||||
transferDmg = Math.min((int) caster.getCurrentHp() - 1, transferDmg);
|
||||
if (transferDmg > 0)
|
||||
{
|
||||
if ((attacker instanceof L2Playable) && (caster.getCurrentCp() > 0))
|
||||
|
||||
@@ -51,5 +51,4 @@ public final class CommandChannelTimer implements Runnable
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(this, 10000); // 10sec
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,22 +69,20 @@ public final class CubicAction implements Runnable
|
||||
|
||||
if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_cubic.getOwner()))
|
||||
{
|
||||
if (_cubic.getOwner().hasSummon())
|
||||
{
|
||||
for (L2Summon servitor : _cubic.getOwner().getServitors().values())
|
||||
{
|
||||
if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(servitor))
|
||||
{
|
||||
_cubic.stopAction();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!_cubic.getOwner().hasSummon())
|
||||
{
|
||||
_cubic.stopAction();
|
||||
return;
|
||||
}
|
||||
|
||||
for (L2Summon servitor : _cubic.getOwner().getServitors().values())
|
||||
{
|
||||
if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(servitor))
|
||||
{
|
||||
_cubic.stopAction();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The cubic has already reached its limit and it will stay idle until its duration ends.
|
||||
|
||||
@@ -72,22 +72,20 @@ public final class CubicBuff implements Runnable
|
||||
{
|
||||
if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_cubic.getOwner()))
|
||||
{
|
||||
if (_cubic.getOwner().hasSummon())
|
||||
{
|
||||
for (L2Summon servitor : _cubic.getOwner().getServitors().values())
|
||||
{
|
||||
if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(servitor))
|
||||
{
|
||||
_cubic.stopAction();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!_cubic.getOwner().hasSummon())
|
||||
{
|
||||
_cubic.stopAction();
|
||||
return;
|
||||
}
|
||||
|
||||
for (L2Summon servitor : _cubic.getOwner().getServitors().values())
|
||||
{
|
||||
if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(servitor))
|
||||
{
|
||||
_cubic.stopAction();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Rnd.get(1, 100) < _chance)
|
||||
|
||||
@@ -127,15 +127,12 @@ public class CubicHeal implements Runnable
|
||||
{
|
||||
_cubic.cubicTargetForHeal();
|
||||
final L2Character target = _cubic.getTarget();
|
||||
if ((target != null) && !target.isDead())
|
||||
if ((target != null) && !target.isDead() && ((target.getMaxHp() - target.getCurrentHp()) > skill.getPower()))
|
||||
{
|
||||
if ((target.getMaxHp() - target.getCurrentHp()) > skill.getPower())
|
||||
{
|
||||
skill.activateSkill(_cubic.getOwner(), target);
|
||||
_cubic.getOwner().broadcastPacket(new MagicSkillUse(_cubic.getOwner(), target, skill.getId(), skill.getLevel(), 0, 0));
|
||||
// The cubic has done an action, increase the current count
|
||||
_currentCount.incrementAndGet();
|
||||
}
|
||||
skill.activateSkill(_cubic.getOwner(), target);
|
||||
_cubic.getOwner().broadcastPacket(new MagicSkillUse(_cubic.getOwner(), target, skill.getId(), skill.getLevel(), 0, 0));
|
||||
// The cubic has done an action, increase the current count
|
||||
_currentCount.incrementAndGet();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -143,15 +140,12 @@ public class CubicHeal implements Runnable
|
||||
case L2CubicInstance.SKILL_MIND_CUBIC_GREAT_RECHARGE:
|
||||
{
|
||||
final L2Character owner = _cubic.getOwner();
|
||||
if ((owner != null) && !owner.isDead())
|
||||
if ((owner != null) && !owner.isDead() && ((owner.getMaxMp() - owner.getCurrentMp()) > skill.getPower()))
|
||||
{
|
||||
if ((owner.getMaxMp() - owner.getCurrentMp()) > skill.getPower())
|
||||
{
|
||||
skill.activateSkill(owner, owner);
|
||||
owner.broadcastPacket(new MagicSkillUse(owner, owner, skill.getId(), skill.getLevel(), 0, 0));
|
||||
// The cubic has done an action, increase the current count
|
||||
_currentCount.incrementAndGet();
|
||||
}
|
||||
skill.activateSkill(owner, owner);
|
||||
owner.broadcastPacket(new MagicSkillUse(owner, owner, skill.getId(), skill.getLevel(), 0, 0));
|
||||
// The cubic has done an action, increase the current count
|
||||
_currentCount.incrementAndGet();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -160,15 +154,12 @@ public class CubicHeal implements Runnable
|
||||
case L2CubicInstance.SKILL_BUFF_CUBIC_GREAT_HEAL:
|
||||
{
|
||||
final L2Character _owner = _cubic.getOwner();
|
||||
if ((_owner != null) && !_owner.isDead())
|
||||
if ((_owner != null) && !_owner.isDead() && ((_owner.getMaxHp() - _owner.getCurrentHp()) > skill.getPower()))
|
||||
{
|
||||
if ((_owner.getMaxHp() - _owner.getCurrentHp()) > skill.getPower())
|
||||
{
|
||||
skill.activateSkill(_owner, _owner);
|
||||
_owner.broadcastPacket(new MagicSkillUse(_owner, _owner, skill.getId(), skill.getLevel(), 0, 0));
|
||||
// The cubic has done an action, increase the current count
|
||||
_currentCount.incrementAndGet();
|
||||
}
|
||||
skill.activateSkill(_owner, _owner);
|
||||
_owner.broadcastPacket(new MagicSkillUse(_owner, _owner, skill.getId(), skill.getLevel(), 0, 0));
|
||||
// The cubic has done an action, increase the current count
|
||||
_currentCount.incrementAndGet();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -41,16 +41,19 @@ public class GameGuardCheckTask implements Runnable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if ((_player != null))
|
||||
if (_player == null)
|
||||
{
|
||||
final L2GameClient client = _player.getClient();
|
||||
if ((client != null) && !client.isAuthedGG() && _player.isOnline())
|
||||
{
|
||||
AdminData.getInstance().broadcastMessageToGMs("Client " + client + " failed to reply GameGuard query and is being kicked!");
|
||||
_log.info("Client " + client + " failed to reply GameGuard query and is being kicked!");
|
||||
|
||||
client.close(LeaveWorld.STATIC_PACKET);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final L2GameClient client = _player.getClient();
|
||||
if ((client == null) || client.isAuthedGG() || !_player.isOnline())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdminData.getInstance().broadcastMessageToGMs("Client " + client + " failed to reply GameGuard query and is being kicked!");
|
||||
_log.info("Client " + client + " failed to reply GameGuard query and is being kicked!");
|
||||
client.close(LeaveWorld.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,23 +44,23 @@ public class LookingForFishTask implements Runnable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_player != null)
|
||||
if (_player == null)
|
||||
{
|
||||
if (System.currentTimeMillis() >= _endTaskTime)
|
||||
{
|
||||
_player.endFishing(false, true);
|
||||
return;
|
||||
}
|
||||
if (_fishGroup == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final int check = Rnd.get(100);
|
||||
if (_fishGutsCheck > check)
|
||||
{
|
||||
_player.stopLookingForFishTask();
|
||||
_player.startFishCombat(_isNoob, _isUpperGrade);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() >= _endTaskTime)
|
||||
{
|
||||
_player.endFishing(false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_fishGroup == -1) || (_fishGutsCheck <= Rnd.get(100)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_player.stopLookingForFishTask();
|
||||
_player.startFishCombat(_isNoob, _isUpperGrade);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,23 +37,25 @@ public class RecoGiveTask implements Runnable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_player != null)
|
||||
if (_player == null)
|
||||
{
|
||||
// 10 recommendations to give out after 2 hours of being logged in
|
||||
// 1 more recommendation to give out every hour after that.
|
||||
int recoToGive = 1;
|
||||
if (!_player.isRecoTwoHoursGiven())
|
||||
{
|
||||
recoToGive = 10;
|
||||
_player.setRecoTwoHoursGiven(true);
|
||||
}
|
||||
|
||||
_player.setRecomLeft(_player.getRecomLeft() + recoToGive);
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_OBTAINED_S1_RECOMMENDATION_S);
|
||||
sm.addInt(recoToGive);
|
||||
_player.sendPacket(sm);
|
||||
_player.sendPacket(new UserInfo(_player));
|
||||
return;
|
||||
}
|
||||
|
||||
// 10 recommendations to give out after 2 hours of being logged in
|
||||
// 1 more recommendation to give out every hour after that.
|
||||
int recoToGive = 1;
|
||||
if (!_player.isRecoTwoHoursGiven())
|
||||
{
|
||||
recoToGive = 10;
|
||||
_player.setRecoTwoHoursGiven(true);
|
||||
}
|
||||
|
||||
_player.setRecomLeft(_player.getRecomLeft() + recoToGive);
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_OBTAINED_S1_RECOMMENDATION_S);
|
||||
sm.addInt(recoToGive);
|
||||
_player.sendPacket(sm);
|
||||
_player.sendPacket(new UserInfo(_player));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,12 @@ public class StandUpTask implements Runnable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_player != null)
|
||||
if (_player == null)
|
||||
{
|
||||
_player.setIsSitting(false);
|
||||
_player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
return;
|
||||
}
|
||||
|
||||
_player.setIsSitting(false);
|
||||
_player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,7 @@ public final class WarnUserTakeBreakTask implements Runnable
|
||||
{
|
||||
if (_player.isOnline())
|
||||
{
|
||||
final long hours = TimeUnit.MILLISECONDS.toHours(_player.getUptime());
|
||||
_player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PLAYED_FOR_S1_HOUR_S_PLEASE_TAKE_A_BREAK).addLong(hours));
|
||||
_player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PLAYED_FOR_S1_HOUR_S_PLEASE_TAKE_A_BREAK).addLong(TimeUnit.MILLISECONDS.toHours(_player.getUptime())));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -36,20 +36,16 @@ public class WaterTask implements Runnable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_player != null)
|
||||
if (_player == null)
|
||||
{
|
||||
double reduceHp = _player.getMaxHp() / 100.0;
|
||||
|
||||
if (reduceHp < 1)
|
||||
{
|
||||
reduceHp = 1;
|
||||
}
|
||||
|
||||
_player.reduceCurrentHp(reduceHp, _player, false, false, null);
|
||||
// reduced hp, becouse not rest
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_TAKEN_S1_DAMAGE_BECAUSE_YOU_WERE_UNABLE_TO_BREATHE);
|
||||
sm.addInt((int) reduceHp);
|
||||
_player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
final double reduceHp = (_player.getMaxHp() / 100.0) < 1 ? 1 : _player.getMaxHp() / 100.0;
|
||||
_player.reduceCurrentHp(reduceHp, _player, false, false, null);
|
||||
// reduced hp, becouse not rest
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_TAKEN_S1_DAMAGE_BECAUSE_YOU_WERE_UNABLE_TO_BREATHE);
|
||||
sm.addInt((int) reduceHp);
|
||||
_player.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,8 +512,7 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
|
||||
|
||||
public List<IDropItem> getDropList(DropListScope dropListScope)
|
||||
{
|
||||
final Map<DropListScope, List<IDropItem>> dropLists = _dropLists;
|
||||
return dropLists != null ? dropLists.get(dropListScope) : null;
|
||||
return _dropLists != null ? _dropLists.get(dropListScope) : null;
|
||||
}
|
||||
|
||||
public Collection<ItemHolder> calculateDrops(DropListScope dropListScope, L2Character victim, L2Character killer)
|
||||
@@ -560,8 +559,7 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
|
||||
if (clazz.isInterface())
|
||||
{
|
||||
// check if obj implements the clazz interface
|
||||
final Class<?>[] interfaces = sub.getInterfaces();
|
||||
for (Class<?> interface1 : interfaces)
|
||||
for (Class<?> interface1 : sub.getInterfaces())
|
||||
{
|
||||
if (clazz.getName().equals(interface1.getName()))
|
||||
{
|
||||
@@ -599,8 +597,7 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
|
||||
|
||||
public boolean canTeach(ClassId classId)
|
||||
{
|
||||
// If the player is on a third class, fetch the class teacher
|
||||
// information for its parent class.
|
||||
// If the player is on a third class, fetch the class teacher information for its parent class.
|
||||
if (classId.level() == 3)
|
||||
{
|
||||
return _teachInfo.contains(classId.getParent());
|
||||
|
||||
@@ -204,146 +204,144 @@ public final class Transform implements IIdentifiable
|
||||
public void onTransform(L2PcInstance player)
|
||||
{
|
||||
final TransformTemplate template = getTemplate(player);
|
||||
if (template != null)
|
||||
if (template == null)
|
||||
{
|
||||
// Start flying.
|
||||
if (isFlying())
|
||||
return;
|
||||
}
|
||||
|
||||
// Start flying.
|
||||
if (isFlying())
|
||||
{
|
||||
player.setIsFlying(true);
|
||||
}
|
||||
|
||||
if (getName() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleName(getName());
|
||||
}
|
||||
if (getTitle() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleTitle(getTitle());
|
||||
}
|
||||
|
||||
// Set inventory blocks if needed.
|
||||
if (!template.getAdditionalItems().isEmpty())
|
||||
{
|
||||
final List<Integer> allowed = new ArrayList<>();
|
||||
final List<Integer> notAllowed = new ArrayList<>();
|
||||
for (AdditionalItemHolder holder : template.getAdditionalItems())
|
||||
{
|
||||
player.setIsFlying(true);
|
||||
}
|
||||
|
||||
if (getName() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleName(getName());
|
||||
}
|
||||
if (getTitle() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleTitle(getTitle());
|
||||
}
|
||||
|
||||
// Set inventory blocks if needed.
|
||||
if (!template.getAdditionalItems().isEmpty())
|
||||
{
|
||||
final List<Integer> allowed = new ArrayList<>();
|
||||
final List<Integer> notAllowed = new ArrayList<>();
|
||||
for (AdditionalItemHolder holder : template.getAdditionalItems())
|
||||
if (holder.isAllowedToUse())
|
||||
{
|
||||
if (holder.isAllowedToUse())
|
||||
{
|
||||
allowed.add(holder.getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
notAllowed.add(holder.getId());
|
||||
}
|
||||
allowed.add(holder.getId());
|
||||
}
|
||||
|
||||
if (!allowed.isEmpty())
|
||||
else
|
||||
{
|
||||
final int[] items = new int[allowed.size()];
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i] = allowed.get(i);
|
||||
}
|
||||
player.getInventory().setInventoryBlock(items, 1);
|
||||
}
|
||||
|
||||
if (!notAllowed.isEmpty())
|
||||
{
|
||||
final int[] items = new int[notAllowed.size()];
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i] = notAllowed.get(i);
|
||||
}
|
||||
player.getInventory().setInventoryBlock(items, 2);
|
||||
notAllowed.add(holder.getId());
|
||||
}
|
||||
}
|
||||
|
||||
// Send basic action list.
|
||||
if (template.hasBasicActionList())
|
||||
if (!allowed.isEmpty())
|
||||
{
|
||||
player.sendPacket(template.getBasicActionList());
|
||||
final int[] items = new int[allowed.size()];
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i] = allowed.get(i);
|
||||
}
|
||||
player.getInventory().setInventoryBlock(items, 1);
|
||||
}
|
||||
|
||||
if (!notAllowed.isEmpty())
|
||||
{
|
||||
final int[] items = new int[notAllowed.size()];
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i] = notAllowed.get(i);
|
||||
}
|
||||
player.getInventory().setInventoryBlock(items, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Send basic action list.
|
||||
if (template.hasBasicActionList())
|
||||
{
|
||||
player.sendPacket(template.getBasicActionList());
|
||||
}
|
||||
}
|
||||
|
||||
public void onUntransform(L2PcInstance player)
|
||||
{
|
||||
final TransformTemplate template = getTemplate(player);
|
||||
if (template != null)
|
||||
if (template == null)
|
||||
{
|
||||
// Stop flying.
|
||||
if (isFlying())
|
||||
{
|
||||
player.setIsFlying(false);
|
||||
}
|
||||
|
||||
if (getName() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleName(null);
|
||||
}
|
||||
if (getTitle() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleTitle(null);
|
||||
}
|
||||
|
||||
// Remove common skills.
|
||||
if (!template.getSkills().isEmpty())
|
||||
{
|
||||
for (SkillHolder holder : template.getSkills())
|
||||
{
|
||||
final Skill skill = holder.getSkill();
|
||||
if (!SkillTreesData.getInstance().isSkillAllowed(player, skill))
|
||||
{
|
||||
player.removeSkill(skill, false, skill.isPassive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove skills depending on level.
|
||||
if (!template.getAdditionalSkills().isEmpty())
|
||||
{
|
||||
for (AdditionalSkillHolder holder : template.getAdditionalSkills())
|
||||
{
|
||||
final Skill skill = holder.getSkill();
|
||||
if ((player.getLevel() >= holder.getMinLevel()) && !SkillTreesData.getInstance().isSkillAllowed(player, skill))
|
||||
{
|
||||
player.removeSkill(skill, false, skill.isPassive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove transformation skills.
|
||||
player.removeAllTransformSkills();
|
||||
|
||||
// Remove inventory blocks if needed.
|
||||
if (!template.getAdditionalItems().isEmpty())
|
||||
{
|
||||
player.getInventory().unblock();
|
||||
}
|
||||
|
||||
player.sendPacket(ExBasicActionList.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop flying.
|
||||
if (isFlying())
|
||||
{
|
||||
player.setIsFlying(false);
|
||||
}
|
||||
|
||||
if (getName() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleName(null);
|
||||
}
|
||||
if (getTitle() != null)
|
||||
{
|
||||
player.getAppearance().setVisibleTitle(null);
|
||||
}
|
||||
|
||||
// Remove common skills.
|
||||
if (!template.getSkills().isEmpty())
|
||||
{
|
||||
for (SkillHolder holder : template.getSkills())
|
||||
{
|
||||
final Skill skill = holder.getSkill();
|
||||
if (!SkillTreesData.getInstance().isSkillAllowed(player, skill))
|
||||
{
|
||||
player.removeSkill(skill, false, skill.isPassive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove skills depending on level.
|
||||
if (!template.getAdditionalSkills().isEmpty())
|
||||
{
|
||||
for (AdditionalSkillHolder holder : template.getAdditionalSkills())
|
||||
{
|
||||
final Skill skill = holder.getSkill();
|
||||
if ((player.getLevel() >= holder.getMinLevel()) && !SkillTreesData.getInstance().isSkillAllowed(player, skill))
|
||||
{
|
||||
player.removeSkill(skill, false, skill.isPassive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove transformation skills.
|
||||
player.removeAllTransformSkills();
|
||||
|
||||
// Remove inventory blocks if needed.
|
||||
if (!template.getAdditionalItems().isEmpty())
|
||||
{
|
||||
player.getInventory().unblock();
|
||||
}
|
||||
|
||||
player.sendPacket(ExBasicActionList.STATIC_PACKET);
|
||||
}
|
||||
|
||||
public void onLevelUp(L2PcInstance player)
|
||||
{
|
||||
final TransformTemplate template = getTemplate(player);
|
||||
if (template != null)
|
||||
// Add skills depending on level.
|
||||
if ((template != null) && !template.getAdditionalSkills().isEmpty())
|
||||
{
|
||||
// Add skills depending on level.
|
||||
if (!template.getAdditionalSkills().isEmpty())
|
||||
for (AdditionalSkillHolder holder : template.getAdditionalSkills())
|
||||
{
|
||||
for (AdditionalSkillHolder holder : template.getAdditionalSkills())
|
||||
if ((player.getLevel() >= holder.getMinLevel()) && (player.getSkillLevel(holder.getSkillId()) < holder.getSkillLvl()))
|
||||
{
|
||||
if (player.getLevel() >= holder.getMinLevel())
|
||||
{
|
||||
if (player.getSkillLevel(holder.getSkillId()) < holder.getSkillLvl())
|
||||
{
|
||||
player.addSkill(holder.getSkill(), false);
|
||||
player.addTransformSkill(holder.getSkill());
|
||||
}
|
||||
}
|
||||
player.addSkill(holder.getSkill(), false);
|
||||
player.addTransformSkill(holder.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,11 +371,7 @@ public final class Transform implements IIdentifiable
|
||||
public int getBaseDefBySlot(L2PcInstance player, int slot)
|
||||
{
|
||||
final TransformTemplate template = getTemplate(player);
|
||||
if (template != null)
|
||||
{
|
||||
return template.getDefense(slot);
|
||||
}
|
||||
return player.getTemplate().getBaseDefBySlot(slot);
|
||||
return template != null ? template.getDefense(slot) : player.getTemplate().getBaseDefBySlot(slot);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user