Handy's Block Checker Event related improvements.

This commit is contained in:
MobiusDev
2016-08-23 21:42:58 +00:00
parent fc19d4cf01
commit 2823174ded
9 changed files with 117 additions and 75 deletions

View File

@@ -44,6 +44,7 @@ public enum InstanceType
L2GuardInstance(L2Attackable),
L2QuestGuardInstance(L2GuardInstance),
L2MonsterInstance(L2Attackable),
L2BlockInstance(L2Attackable),
L2ChestInstance(L2MonsterInstance),
L2ControllableMobInstance(L2MonsterInstance),
L2FeedableBeastInstance(L2MonsterInstance),

View File

@@ -45,7 +45,7 @@ public enum NpcInfoType implements IUpdateTypeComponent
ENCHANT(0x10, 4),
FLYING(0x11, 4),
CLONE(0x12, 4),
UNKNOWN8(0x13, 4),
COLOR_EFFECT(0x13, 4),
DISPLAY_EFFECT(0x16, 4),
TRANSFORMATION(0x17, 4),

View File

@@ -42,13 +42,10 @@ import com.l2jmobius.gameserver.handler.AffectScopeHandler;
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
import com.l2jmobius.gameserver.handler.ITargetTypeHandler;
import com.l2jmobius.gameserver.handler.TargetHandler;
import com.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
import com.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2BlockInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.cubic.CubicInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
@@ -1404,71 +1401,31 @@ public final class Skill implements IIdentifiable
*/
public final void activateSkill(L2Character caster, CubicInstance cubic, L2ItemInstance item, L2Object... targets)
{
// TODO: replace with AI
switch (getId())
for (L2Object targetObject : targets)
{
case 5852:
case 5853:
if (!targetObject.isCharacter())
{
final L2BlockInstance block = targets[0] instanceof L2BlockInstance ? (L2BlockInstance) targets[0] : null;
final L2PcInstance player = caster.isPlayer() ? (L2PcInstance) caster : null;
if ((block == null) || (player == null))
{
return;
}
final int arena = player.getBlockCheckerArena();
if (arena != -1)
{
final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena);
if (holder == null)
{
return;
}
final int team = holder.getPlayerTeam(player);
final int color = block.getColorEffect();
if ((team == 0) && (color == 0x00))
{
block.changeColor(player, holder, team);
}
else if ((team == 1) && (color == 0x53))
{
block.changeColor(player, holder, team);
}
}
break;
continue;
}
default:
final L2Character target = (L2Character) targetObject;
if (Formulas.calcBuffDebuffReflection(target, this))
{
for (L2Object targetObject : targets)
{
if (!targetObject.isCharacter())
{
continue;
}
final L2Character target = (L2Character) targetObject;
if (Formulas.calcBuffDebuffReflection(target, this))
{
// if skill is reflected instant effects should be casted on target
// and continuous effects on caster
applyEffects(target, caster, false, 0);
final BuffInfo info = new BuffInfo(caster, target, this, false, item, null);
applyEffectScope(EffectScope.GENERAL, info, true, false);
final EffectScope pvpOrPveEffectScope = caster.isPlayable() && target.isAttackable() ? EffectScope.PVE : caster.isPlayable() && target.isPlayable() ? EffectScope.PVP : null;
applyEffectScope(pvpOrPveEffectScope, info, true, false);
applyEffectScope(EffectScope.CHANNELING, info, true, false);
}
else
{
applyEffects(caster, target, item);
}
}
break;
// if skill is reflected instant effects should be casted on target
// and continuous effects on caster
applyEffects(target, caster, false, 0);
final BuffInfo info = new BuffInfo(caster, target, this, false, item, null);
applyEffectScope(EffectScope.GENERAL, info, true, false);
final EffectScope pvpOrPveEffectScope = caster.isPlayable() && target.isAttackable() ? EffectScope.PVE : caster.isPlayable() && target.isPlayable() ? EffectScope.PVP : null;
applyEffectScope(pvpOrPveEffectScope, info, true, false);
applyEffectScope(EffectScope.CHANNELING, info, true, false);
}
else
{
applyEffects(caster, target, item);
}
}

View File

@@ -158,7 +158,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
addComponentType(NpcInfoType.CLAN);
}
addComponentType(NpcInfoType.UNKNOWN8);
addComponentType(NpcInfoType.COLOR_EFFECT);
// TODO: Confirm me
if (summon.isInCombat())
@@ -312,7 +312,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
{
packet.writeD(0x00); // Player ObjectId with Decoy
}
if (containsMask(NpcInfoType.UNKNOWN8))
if (containsMask(NpcInfoType.COLOR_EFFECT))
{
// No visual effect
packet.writeD(0x00); // Unknown

View File

@@ -184,7 +184,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
}
}
addComponentType(NpcInfoType.UNKNOWN8);
addComponentType(NpcInfoType.COLOR_EFFECT);
if (npc.getPvpFlag() > 0)
{
@@ -345,10 +345,9 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
{
packet.writeD(_npc.getCloneObjId()); // Player ObjectId with Decoy
}
if (containsMask(NpcInfoType.UNKNOWN8))
if (containsMask(NpcInfoType.COLOR_EFFECT))
{
// No visual effect
packet.writeD(0x00); // Unknown
packet.writeD(_npc.getColorEffect()); // Color effect
}
if (containsMask(NpcInfoType.DISPLAY_EFFECT))
{

View File

@@ -158,7 +158,7 @@ public class SummonInfo extends AbstractMaskPacket<NpcInfoType>
addComponentType(NpcInfoType.CLAN);
}
addComponentType(NpcInfoType.UNKNOWN8);
addComponentType(NpcInfoType.COLOR_EFFECT);
// TODO: Confirm me
if (summon.isInCombat())
@@ -312,7 +312,7 @@ public class SummonInfo extends AbstractMaskPacket<NpcInfoType>
{
packet.writeD(0x00); // Player ObjectId with Decoy
}
if (containsMask(NpcInfoType.UNKNOWN8))
if (containsMask(NpcInfoType.COLOR_EFFECT))
{
// No visual effect
packet.writeD(0x00); // Unknown