Sync with L2JServer Jan 24th 2015.

This commit is contained in:
mobius
2015-01-24 20:02:32 +00:00
parent d349bd3924
commit 1c6301c46d
1012 changed files with 23069 additions and 6307 deletions

View File

@@ -18,7 +18,6 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.Location;
@@ -72,17 +71,14 @@ public final class Blink extends AbstractEffect
int x = effected.getX() + x1;
int y = effected.getY() + y1;
int z = effected.getZ();
Location loc = new Location(x, y, z);
if (Config.GEODATA > 0)
{
loc = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
}
final Location destination = GeoData.getInstance().moveCheck(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId());
effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
effected.broadcastPacket(new FlyToLocation(effected, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));
effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.DUMMY));
effected.abortAttack();
effected.abortCast();
effected.setXYZ(loc);
effected.setXYZ(destination);
effected.broadcastPacket(new ValidateLocation(effected));
}
}

View File

@@ -18,7 +18,6 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
@@ -94,16 +93,12 @@ public final class EnemyCharge extends AbstractEffect
int y = curY + (int) ((distance - offset) * sin);
int z = info.getEffected().getZ();
if (Config.GEODATA > 0)
{
Location destiny = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
x = destiny.getX();
y = destiny.getY();
}
info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), x, y, z, FlyType.CHARGE));
final Location destination = GeoData.getInstance().moveCheck(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId());
info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), destination, FlyType.CHARGE));
// maybe is need force set X,Y,Z
info.getEffector().setXYZ(x, y, z);
info.getEffector().setXYZ(destination);
info.getEffector().broadcastPacket(new ValidateLocation(info.getEffector()));
}
}

View File

@@ -18,7 +18,6 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention;
@@ -101,18 +100,12 @@ public final class Fear extends AbstractEffect
int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians)));
int posZ = info.getEffected().getZ();
if (Config.GEODATA > 0)
{
Location destiny = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
posX = destiny.getX();
posY = destiny.getY();
}
if (!info.getEffected().isPet())
{
info.getEffected().setRunning();
}
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ));
final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
}
}

View File

@@ -18,7 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.gameserver.datatables.NpcData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
import com.l2jserver.gameserver.instancemanager.CastleManager;

View File

@@ -18,7 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.gameserver.datatables.FishingRodsData;
import com.l2jserver.gameserver.data.xml.impl.FishingRodsData;
import com.l2jserver.gameserver.enums.ShotType;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;

View File

@@ -74,12 +74,18 @@ public final class RebalanceHP extends AbstractEffect
currentHPs += member.getCurrentHp();
}
final L2Summon summon = member.getSummon();
final L2Summon summon = member.getPet();
if ((summon != null) && (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true)))
{
fullHP += summon.getMaxHp();
currentHPs += summon.getCurrentHp();
}
for (L2Summon servitors : member.getServitors().values())
{
fullHP += servitors.getMaxHp();
currentHPs += servitors.getCurrentHp();
}
}
double percentHP = currentHPs / fullHP;
@@ -104,7 +110,7 @@ public final class RebalanceHP extends AbstractEffect
member.setCurrentHp(newHP);
}
final L2Summon summon = member.getSummon();
final L2Summon summon = member.getPet();
if ((summon != null) && (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true)))
{
double newHP = summon.getMaxHp() * percentHP;
@@ -122,6 +128,27 @@ public final class RebalanceHP extends AbstractEffect
}
summon.setCurrentHp(newHP);
}
for (L2Summon servitors : member.getServitors().values())
{
if (!servitors.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true))
{
double newHP = servitors.getMaxHp() * percentHP;
if (newHP > servitors.getCurrentHp()) // The target gets healed
{
// The heal will be blocked if the current hp passes the limit
if (servitors.getCurrentHp() > servitors.getMaxRecoverableHp())
{
newHP = servitors.getCurrentHp();
}
else if (newHP > servitors.getMaxRecoverableHp())
{
newHP = servitors.getMaxRecoverableHp();
}
}
servitors.setCurrentHp(newHP);
}
}
}
}
}

View File

@@ -18,7 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.gameserver.datatables.FishingRodsData;
import com.l2jserver.gameserver.data.xml.impl.FishingRodsData;
import com.l2jserver.gameserver.enums.ShotType;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;

View File

@@ -21,6 +21,7 @@ package handlers.effecthandlers;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.conditions.Condition;
import com.l2jserver.gameserver.model.effects.AbstractEffect;
import com.l2jserver.gameserver.model.effects.EffectFlag;
@@ -73,7 +74,8 @@ public final class ServitorShare extends AbstractEffect
@Override
public void onExit(BuffInfo info)
{
final L2Character effected = info.getEffected().isPlayer() ? info.getEffected().getSummon() : info.getEffected().getActingPlayer();
final L2Character effected = info.getEffected().isSummon() ? ((L2Summon) info.getEffected()).getOwner() : info.getEffected();
if (effected != null)
{
ThreadPoolManager.getInstance().scheduleEffect(new ScheduledEffectExitTask(effected, info.getSkill().getId()), 100);

View File

@@ -60,14 +60,13 @@ public final class Spoil extends AbstractEffect
}
final L2MonsterInstance target = (L2MonsterInstance) info.getEffected();
if (target.isSpoil())
if (target.isSpoiled())
{
info.getEffector().sendPacket(SystemMessageId.IT_HAS_ALREADY_BEEN_SPOILED);
return;
}
target.setSpoil(true);
target.setIsSpoiledBy(info.getEffector().getObjectId());
target.setSpoilerObjectId(info.getEffector().getObjectId());
info.getEffector().sendPacket(SystemMessageId.THE_SPOIL_CONDITION_HAS_BEEN_ACTIVATED);
target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, info.getEffector());
}

View File

@@ -18,8 +18,8 @@
*/
package handlers.effecthandlers;
import com.l2jserver.gameserver.datatables.ExperienceTable;
import com.l2jserver.gameserver.datatables.NpcData;
import com.l2jserver.gameserver.data.xml.impl.ExperienceData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.StatsSet;
@@ -42,6 +42,7 @@ public final class Summon extends AbstractEffect
private final ItemHolder _consumeItem;
private final int _lifeTime;
private final int _consumeItemInterval;
private final int _summonPoints;
public Summon(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
@@ -57,6 +58,7 @@ public final class Summon extends AbstractEffect
_consumeItem = new ItemHolder(params.getInt("consumeItemId", 0), params.getInt("consumeItemCount", 1));
_consumeItemInterval = params.getInt("consumeItemInterval", 0);
_lifeTime = params.getInt("lifeTime", 3600) * 1000;
_summonPoints = params.getInt("summonPoints", 0);
}
@Override
@@ -68,7 +70,7 @@ public final class Summon extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffected().isPlayer() || info.getEffected().hasSummon())
if (!info.getEffected().isPlayer())
{
return;
}
@@ -86,22 +88,30 @@ public final class Summon extends AbstractEffect
summon.setItemConsume(_consumeItem);
summon.setItemConsumeInterval(consumeItemInterval);
if (summon.getLevel() >= ExperienceTable.getInstance().getMaxPetLevel())
if (summon.getLevel() >= ExperienceData.getInstance().getMaxPetLevel())
{
summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(ExperienceTable.getInstance().getMaxPetLevel() - 1));
_log.warning(Summon.class.getSimpleName() + ": (" + summon.getName() + ") NpcID: " + summon.getId() + " has a level above " + ExperienceTable.getInstance().getMaxPetLevel() + ". Please rectify.");
summon.getStat().setExp(ExperienceData.getInstance().getExpForLevel(ExperienceData.getInstance().getMaxPetLevel() - 1));
_log.warning(Summon.class.getSimpleName() + ": (" + summon.getName() + ") NpcID: " + summon.getId() + " has a level above " + ExperienceData.getInstance().getMaxPetLevel() + ". Please rectify.");
}
else
{
summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(summon.getLevel() % ExperienceTable.getInstance().getMaxPetLevel()));
summon.getStat().setExp(ExperienceData.getInstance().getExpForLevel(summon.getLevel() % ExperienceData.getInstance().getMaxPetLevel()));
}
summon.setCurrentHp(summon.getMaxHp());
summon.setCurrentMp(summon.getMaxMp());
summon.setHeading(player.getHeading());
summon.setSummonPoints(_summonPoints);
player.setPet(summon);
if (summon.isPet())
{
player.setPet(summon);
}
else
{
player.addServitor(summon);
}
summon.setShowSummonAnimation(true);
summon.setRunning();
summon.spawnMe();
}

View File

@@ -18,7 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.gameserver.datatables.NpcData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.Location;

View File

@@ -20,8 +20,8 @@ package handlers.effecthandlers;
import java.util.logging.Level;
import com.l2jserver.gameserver.datatables.NpcData;
import com.l2jserver.gameserver.datatables.PetDataTable;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.data.xml.impl.PetDataTable;
import com.l2jserver.gameserver.model.L2PetData;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -69,7 +69,7 @@ public final class SummonPet extends AbstractEffect
final L2PcInstance player = info.getEffector().getActingPlayer();
if ((player.hasSummon() || player.isMounted()))
if (player.hasPet() || player.isMounted())
{
player.sendPacket(SystemMessageId.YOU_ALREADY_HAVE_A_PET);
return;

View File

@@ -18,7 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.gameserver.datatables.NpcData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

View File

@@ -18,7 +18,6 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.Location;
@@ -80,11 +79,8 @@ public final class TeleportToTarget extends AbstractEffect
int x = (int) (px + (25 * Math.cos(ph)));
int y = (int) (py + (25 * Math.sin(ph)));
int z = target.getZ();
Location loc = new Location(x, y, z);
if (Config.GEODATA > 0)
{
loc = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceId());
}
final Location loc = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
activeChar.broadcastPacket(new FlyToLocation(activeChar, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY));

View File

@@ -18,7 +18,6 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
@@ -98,16 +97,11 @@ public final class ThrowUp extends AbstractEffect
int y = info.getEffector().getY() - (int) (offset * sin);
int z = info.getEffected().getZ();
if (Config.GEODATA > 0)
{
Location destiny = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
x = destiny.getX();
y = destiny.getY();
}
final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId());
info.getEffected().broadcastPacket(new FlyToLocation(info.getEffected(), x, y, z, FlyType.THROW_UP));
info.getEffected().broadcastPacket(new FlyToLocation(info.getEffected(), destination, FlyType.THROW_UP));
// TODO: Review.
info.getEffected().setXYZ(x, y, z);
info.getEffected().setXYZ(destination);
info.getEffected().broadcastPacket(new ValidateLocation(info.getEffected()));
}
}

View File

@@ -18,7 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.gameserver.datatables.TransformData;
import com.l2jserver.gameserver.data.xml.impl.TransformData;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.conditions.Condition;
import com.l2jserver.gameserver.model.effects.AbstractEffect;

View File

@@ -74,17 +74,16 @@ public final class Unsummon extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
final L2Summon summon = info.getEffected().getSummon();
if (summon != null)
if (info.getEffected().isServitor())
{
final L2PcInstance summonOwner = summon.getOwner();
final L2Summon servitor = (L2Summon) info.getEffected();
final L2PcInstance summonOwner = servitor.getOwner();
summon.abortAttack();
summon.abortCast();
summon.stopAllEffects();
servitor.abortAttack();
servitor.abortCast();
servitor.stopAllEffects();
summon.unSummon(summonOwner);
servitor.unSummon(summonOwner);
summonOwner.sendPacket(SystemMessageId.YOUR_SERVITOR_HAS_VANISHED_YOU_LL_NEED_TO_SUMMON_A_NEW_ONE);
}
}