Effect list rework.

Contributed by Liamxroy.
This commit is contained in:
MobiusDev
2017-09-22 17:02:39 +00:00
parent d279eb7aa7
commit d571278f5f
448 changed files with 11336 additions and 7576 deletions

View File

@@ -520,7 +520,7 @@ public final class AteliaManager extends AbstractNpcAI
{
for (L2Npc monster : spawn.getSpawnedNpcs())
{
monster.getEffectList().stopSkillEffects(true, AbnormalType.ALL_ATTACK_DOWN);
monster.getEffectList().stopEffects(AbnormalType.ALL_ATTACK_DOWN);
monster.stopSkillEffects(true, 16526);
}
}
@@ -535,7 +535,7 @@ public final class AteliaManager extends AbstractNpcAI
{
for (L2Npc monster : spawn.getSpawnedNpcs())
{
monster.getEffectList().stopSkillEffects(true, AbnormalType.MAX_HP_DOWN);
monster.getEffectList().stopEffects(AbnormalType.MAX_HP_DOWN);
monster.stopSkillEffects(true, 16542);
}
}
@@ -550,7 +550,7 @@ public final class AteliaManager extends AbstractNpcAI
{
for (L2Npc monster : spawn.getSpawnedNpcs())
{
monster.getEffectList().stopSkillEffects(true, AbnormalType.MAX_HP_DOWN);
monster.getEffectList().stopEffects(AbnormalType.MAX_HP_DOWN);
monster.stopSkillEffects(true, 16542);
}
}

View File

@@ -154,9 +154,9 @@ public final class Maguen extends AbstractNpcAI
{
if (npc.getVariables().getInt("TEST_MAGUEN") == 1)
{
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(R_PLASMA1.getSkill().getAbnormalType());
nemoAi().notifyEvent("DECREASE_COUNT", npc, player);
}
npc.doDie(null);
@@ -169,9 +169,9 @@ public final class Maguen extends AbstractNpcAI
@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
{
final BuffInfo b_info = player.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo c_info = player.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo r_info = player.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final BuffInfo b_info = player.getEffectList().getFirstBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo c_info = player.getEffectList().getFirstBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo r_info = player.getEffectList().getFirstBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int b = b_info == null ? 0 : b_info.getSkill().getAbnormalLvl();
final int c = c_info == null ? 0 : c_info.getSkill().getAbnormalLvl();
@@ -180,7 +180,7 @@ public final class Maguen extends AbstractNpcAI
if ((b == 3) && (c == 0) && (r == 0))
{
showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_BISTAKON_HAVE_GATHERED, 2, 4000);
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(B_PLASMA1.getSkill().getAbnormalType());
npc.setTarget(player);
npc.doCast((getRandom(100) < 70) ? B_BUFF_1.getSkill() : B_BUFF_2.getSkill());
maguenPetChance(player);
@@ -189,7 +189,7 @@ public final class Maguen extends AbstractNpcAI
else if ((b == 0) && (c == 3) && (r == 0))
{
showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_KOKRACON_HAVE_GATHERED, 2, 4000);
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(C_PLASMA1.getSkill().getAbnormalType());
npc.setTarget(player);
npc.doCast((getRandom(100) < 70) ? C_BUFF_1.getSkill() : C_BUFF_2.getSkill());
maguenPetChance(player);
@@ -198,7 +198,7 @@ public final class Maguen extends AbstractNpcAI
else if ((b == 0) && (c == 0) && (r == 3))
{
showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_LEPTILIKON_HAVE_GATHERED, 2, 4000);
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(R_PLASMA1.getSkill().getAbnormalType());
npc.setTarget(player);
npc.doCast((getRandom(100) < 70) ? R_BUFF_1.getSkill() : R_BUFF_2.getSkill());
maguenPetChance(player);
@@ -208,9 +208,9 @@ public final class Maguen extends AbstractNpcAI
{
if ((b == 1) && (c == 1) && (r == 1))
{
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(R_PLASMA1.getSkill().getAbnormalType());
showOnScreenMsg(player, NpcStringId.THE_PLASMAS_HAVE_FILLED_THE_AEROSCOPE_AND_ARE_HARMONIZED, 2, 4000);
SkillHolder skillToCast = null;
switch (getRandom(3))
@@ -243,9 +243,9 @@ public final class Maguen extends AbstractNpcAI
else
{
showOnScreenMsg(player, NpcStringId.THE_PLASMAS_HAVE_FILLED_THE_AEROSCOPE_BUT_THEY_ARE_RAMMING_INTO_EACH_OTHER_EXPLODING_AND_DYING, 2, 4000);
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopEffects(R_PLASMA1.getSkill().getAbnormalType());
}
}
else
@@ -263,17 +263,17 @@ public final class Maguen extends AbstractNpcAI
{
if ((npc.getVariables().getInt("NPC_EFFECT") != 0) && (npc.getVariables().getInt("BLOCKED_SKILLSEE") == 0))
{
final BuffInfo i1_info = caster.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i2_info = caster.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i3_info = caster.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i1_info = caster.getEffectList().getFirstBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i2_info = caster.getEffectList().getFirstBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i3_info = caster.getEffectList().getFirstBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int i1 = i1_info == null ? 0 : i1_info.getSkill().getAbnormalLvl();
final int i2 = i2_info == null ? 0 : i2_info.getSkill().getAbnormalLvl();
final int i3 = i3_info == null ? 0 : i3_info.getSkill().getAbnormalLvl();
caster.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopEffects(B_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopEffects(C_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopEffects(R_PLASMA1.getSkill().getAbnormalType());
cancelQuestTimer("FIRST_TIMER", npc, caster);
cancelQuestTimer("SECOND_TIMER", npc, caster);
cancelQuestTimer("THIRD_TIMER", npc, caster);

View File

@@ -515,7 +515,7 @@ public final class Raina extends AbstractNpcAI
{
player.abortCast();
player.stopAllEffectsExceptThoseThatLastThroughDeath();
player.stopAllEffectsNotStayOnSubclassChange();
player.stopAllEffects();
player.stopCubics();
player.setActiveClass(classIndex);
player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
@@ -555,7 +555,7 @@ public final class Raina extends AbstractNpcAI
{
player.abortCast();
player.stopAllEffectsExceptThoseThatLastThroughDeath();
player.stopAllEffectsNotStayOnSubclassChange();
player.stopAllEffects();
player.stopCubics();
player.setActiveClass(classIndex);
player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));

View File

@@ -872,7 +872,7 @@ public class Trasken extends AbstractNpcAI
final BuffInfo traskenBuff = character.getEffectList().getBuffInfoBySkillId(SKILL_TRASKEN_BUFF.getSkillId());
if (traskenBuff != null)
{
character.getEffectList().remove(true, traskenBuff, null);
character.getEffectList().stopSkillEffects(true, traskenBuff.getSkill());
}
}
ThreadPoolManager.schedule(() ->

View File

@@ -371,7 +371,7 @@ public final class Race extends Event
player.standUp();
}
player.getEffectList().stopSkillEffects(true, AbnormalType.SPEED_UP);
player.getEffectList().stopEffects(AbnormalType.SPEED_UP);
player.stopSkillEffects(true, 268);
player.stopSkillEffects(true, 298); // Rabbit Spirit Totem
SkillData.getInstance().getSkill(_skill, 1).applyEffects(player, player);

View File

@@ -133,15 +133,15 @@ public final class HuntForSanta extends LongTimeEvent
final BuffInfo buffSnowman = player.getEffectList().getBuffInfoBySkillId(BUFF_SNOWMAN.getSkillId());
if (buffStocking != null)
{
player.getEffectList().remove(true, buffStocking, null);
player.getEffectList().stopSkillEffects(true, buffStocking.getSkill());
}
if (buffTree != null)
{
player.getEffectList().remove(true, buffTree, null);
player.getEffectList().stopSkillEffects(true, buffTree.getSkill());
}
if (buffSnowman != null)
{
player.getEffectList().remove(true, buffSnowman, null);
player.getEffectList().stopSkillEffects(true, buffSnowman.getSkill());
}
}

View File

@@ -19,6 +19,7 @@ package handlers.admincommandhandlers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import com.l2jmobius.Config;
@@ -29,6 +30,9 @@ import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.html.PageBuilder;
import com.l2jmobius.gameserver.model.html.PageResult;
import com.l2jmobius.gameserver.model.html.styles.ButtonsStyle;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
@@ -39,8 +43,6 @@ import com.l2jmobius.gameserver.util.GMAudit;
public class AdminBuffs implements IAdminCommandHandler
{
private static final int PAGE_LIMIT = 20;
private static final String[] ADMIN_COMMANDS =
{
"admin_buff",
@@ -48,6 +50,7 @@ public class AdminBuffs implements IAdminCommandHandler
"admin_getbuffs_ps",
"admin_stopbuff",
"admin_stopallbuffs",
"admin_viewblockedeffects",
"admin_areacancel",
"admin_removereuse",
"admin_switch_gm_buffs"
@@ -109,7 +112,7 @@ public class AdminBuffs implements IAdminCommandHandler
final L2PcInstance player = L2World.getInstance().getPlayer(playername);
if (player != null)
{
int page = 1;
int page = 0;
if (st.hasMoreTokens())
{
page = Integer.parseInt(st.nextToken());
@@ -122,7 +125,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
else if ((activeChar.getTarget() != null) && activeChar.getTarget().isCharacter())
{
showBuffs(activeChar, (L2Character) activeChar.getTarget(), 1, command.endsWith("_ps"));
showBuffs(activeChar, (L2Character) activeChar.getTarget(), 0, command.endsWith("_ps"));
return true;
}
else
@@ -168,6 +171,23 @@ public class AdminBuffs implements IAdminCommandHandler
return false;
}
}
else if (command.startsWith("admin_viewblockedeffects"))
{
try
{
StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
int objectId = Integer.parseInt(st.nextToken());
viewBlockedEffects(activeChar, objectId);
return true;
}
catch (Exception e)
{
activeChar.sendMessage("Failed viewing blocked effects: " + e.getMessage());
activeChar.sendMessage("Usage: //viewblockedeffects <objectId>");
return false;
}
}
else if (command.startsWith("admin_areacancel"))
{
final StringTokenizer st = new StringTokenizer(command, " ");
@@ -283,115 +303,48 @@ public class AdminBuffs implements IAdminCommandHandler
effects.addAll(target.getEffectList().getPassives());
}
if ((page > ((effects.size() / PAGE_LIMIT) + 1)) || (page < 1))
{
return;
}
final String pageLink = "bypass -h admin_getbuffs" + (passive ? "_ps " : " ") + target.getName();
int max = effects.size() / PAGE_LIMIT;
if (effects.size() > (PAGE_LIMIT * max))
final PageResult result = PageBuilder.newBuilder(effects, 3, pageLink).currentPage(page).style(ButtonsStyle.INSTANCE).bodyHandler((pages, info, sb) ->
{
max++;
}
final StringBuilder html = new StringBuilder(500 + (effects.size() * 200));
html.append("<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center><font color=\"LEVEL\">Effects of ");
html.append(target.getName());
html.append("</font></td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br><table width=\"100%\"><tr><td width=200>Skill</td><td width=30>Rem. Time</td><td width=70>Action</td></tr>");
final int start = ((page - 1) * PAGE_LIMIT);
final int end = Math.min(((page - 1) * PAGE_LIMIT) + PAGE_LIMIT, effects.size());
int count = 0;
for (BuffInfo info : effects)
{
if ((count >= start) && (count < end))
for (AbstractEffect effect : info.getEffects())
{
final Skill skill = info.getSkill();
for (AbstractEffect effect : info.getEffects())
{
html.append("<tr><td>");
html.append(!info.isInUse() ? FONT_RED1 : "");
html.append(skill.getName());
html.append(" Lv ");
html.append(skill.getLevel());
html.append(" (");
html.append(effect.getClass().getSimpleName());
html.append(")");
html.append(!info.isInUse() ? FONT_RED2 : "");
html.append("</td><td>");
html.append(skill.isToggle() ? "T (" + info.getTickCount(effect) + ")" : skill.isPassive() ? "P" : info.getTime() + "s");
html.append("</td><td><button value=\"X\" action=\"bypass -h admin_stopbuff ");
html.append(target.getObjectId());
html.append(" ");
html.append(skill.getId());
html.append("\" width=30 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
}
sb.append("<tr><td>");
sb.append(!info.isInUse() ? FONT_RED1 : "");
sb.append(info.getSkill().getName());
sb.append(" Lv ");
sb.append(info.getSkill().getLevel());
sb.append(" (");
sb.append(effect.getClass().getSimpleName());
sb.append(")");
sb.append(!info.isInUse() ? FONT_RED2 : "");
sb.append("</td><td>");
sb.append(info.getSkill().isToggle() ? "T (" + info.getTickCount(effect) + ")" : info.getSkill().isPassive() ? "P" : info.getTime() + "s");
sb.append("</td><td><button value=\"X\" action=\"bypass -h admin_stopbuff ");
sb.append(target.getObjectId());
sb.append(" ");
sb.append(info.getSkill().getId());
sb.append("\" width=30 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
}
count++;
}).build();
final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
html.setFile(activeChar.getHtmlPrefix(), "data/html/admin/getbuffs.htm");
if (result.getPages() > 0)
{
html.replace("%pages%", "<table width=280 cellspacing=0><tr>" + result.getPagerTemplate() + "</tr></table>");
}
else
{
html.replace("%pages%", "");
}
html.append("</table><table width=300 bgcolor=444444><tr>");
for (int x = 0; x < max; x++)
{
final int pagenr = x + 1;
if (page == pagenr)
{
html.append("<td>Page ");
html.append(pagenr);
html.append("</td>");
}
else
{
html.append("<td><a action=\"bypass -h admin_getbuffs" + (passive ? "_ps " : " "));
html.append(target.getName());
html.append(" ");
html.append(x + 1);
html.append("\"> Page ");
html.append(pagenr);
html.append(" </a></td>");
}
}
html.append("</tr></table>");
// Buttons
html.append("<br><center><button value=\"Refresh\" action=\"bypass -h admin_getbuffs");
html.append(passive ? "_ps " : " ");
html.append(target.getName());
html.append("\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
html.append("<button value=\"Remove All\" action=\"bypass -h admin_stopallbuffs ");
html.append(target.getObjectId());
html.append("\" width=80 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>");
// Legend
if (!passive)
{
html.append(FONT_RED1);
html.append("Inactive buffs: ");
html.append(target.getEffectList().getHiddenBuffsCount());
html.append(FONT_RED2);
html.append("<br>");
}
html.append("Total");
html.append(passive ? " passive" : "");
html.append(" buff count: ");
html.append(effects.size());
if ((target.getEffectList().getBlockedAbnormalTypes() != null) && !target.getEffectList().getBlockedAbnormalTypes().isEmpty())
{
html.append("<br>Blocked buff slots: ");
String slots = "";
for (AbnormalType slot : target.getEffectList().getBlockedAbnormalTypes())
{
slots += slot + ", ";
}
if (!slots.isEmpty() && (slots.length() > 3))
{
html.append(slots.substring(0, slots.length() - 2));
}
}
html.append("</html>");
// Send the packet
activeChar.sendPacket(new NpcHtmlMessage(0, 1, html.toString()));
html.replace("%targetName%", target.getName());
html.replace("%targetObjId%", target.getObjectId());
html.replace("%buffs%", result.getBodyTemplate().toString());
html.replace("%effectSize%", effects.size());
activeChar.sendPacket(html);
if (Config.GMAUDIT)
{
@@ -418,7 +371,7 @@ public class AdminBuffs implements IAdminCommandHandler
activeChar.sendMessage("Removed skill ID: " + skillId + " effects from " + target.getName() + " (" + objId + ").");
}
showBuffs(activeChar, target, 1, false);
showBuffs(activeChar, target, 0, false);
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "stopbuff", target.getName() + " (" + objId + ")", Integer.toString(skillId));
@@ -441,11 +394,54 @@ public class AdminBuffs implements IAdminCommandHandler
{
target.stopAllEffects();
activeChar.sendMessage("Removed all effects from " + target.getName() + " (" + objId + ")");
showBuffs(activeChar, target, 1, false);
showBuffs(activeChar, target, 0, false);
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "stopallbuffs", target.getName() + " (" + objId + ")", "");
}
}
}
private static void viewBlockedEffects(L2PcInstance activeChar, int objId)
{
L2Character target = null;
try
{
target = (L2Character) L2World.getInstance().findObject(objId);
}
catch (Exception e)
{
activeChar.sendMessage("Target with object id " + objId + " not found.");
return;
}
if (target != null)
{
final Set<AbnormalType> blockedAbnormals = target.getEffectList().getBlockedAbnormalTypes();
final int blockedAbnormalsSize = blockedAbnormals != null ? blockedAbnormals.size() : 0;
final StringBuilder html = new StringBuilder(500 + (blockedAbnormalsSize * 50));
html.append("<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center><font color=\"LEVEL\">Blocked effects of ");
html.append(target.getName());
html.append("</font></td><td width=45><button value=\"Back\" action=\"bypass -h admin_getbuffs" + (target.isPlayer() ? (" " + target.getName()) : "") + "\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br>");
if ((blockedAbnormals != null) && !blockedAbnormals.isEmpty())
{
html.append("<br>Blocked buff slots: ");
for (AbnormalType slot : blockedAbnormals)
{
html.append("<br>").append(slot.toString());
}
}
html.append("</html>");
// Send the packet
activeChar.sendPacket(new NpcHtmlMessage(0, 1, html.toString()));
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "viewblockedeffects", target.getName() + " (" + Integer.toString(target.getObjectId()) + ")", "");
}
}
}
}

View File

@@ -39,6 +39,7 @@ import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.Earthquake;
import com.l2jmobius.gameserver.network.serverpackets.ExRedSky;
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoAbnormalVisualEffect;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -100,6 +101,7 @@ public class AdminEffects implements IAdminCommandHandler
"admin_setteam",
"admin_social",
"admin_effect",
"admin_npc_use_skill",
"admin_effect_menu",
"admin_ave_abnormal",
"admin_social_menu",
@@ -126,16 +128,16 @@ public class AdminEffects implements IAdminCommandHandler
{
activeChar.setInvisible(true);
activeChar.broadcastUserInfo();
activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));
activeChar.decayMe();
activeChar.spawnMe();
activeChar.startAbnormalVisualEffect(AbnormalVisualEffect.STEALTH);
activeChar.sendMessage("You are now invisible.");
}
else
{
activeChar.setInvisible(false);
activeChar.broadcastUserInfo();
activeChar.stopAbnormalVisualEffect(AbnormalVisualEffect.STEALTH);
activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));
activeChar.sendMessage("You are now visible.");
}
@@ -146,16 +148,16 @@ public class AdminEffects implements IAdminCommandHandler
{
activeChar.setInvisible(true);
activeChar.broadcastUserInfo();
activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));
activeChar.decayMe();
activeChar.spawnMe();
activeChar.startAbnormalVisualEffect(AbnormalVisualEffect.STEALTH);
activeChar.sendMessage("You are now invisible.");
}
else if (command.startsWith("admin_vis"))
{
activeChar.setInvisible(false);
activeChar.broadcastUserInfo();
activeChar.stopAbnormalVisualEffect(AbnormalVisualEffect.STEALTH);
activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));
activeChar.sendMessage("You are now visible.");
}
else if (command.startsWith("admin_setinvis"))
@@ -236,7 +238,7 @@ public class AdminEffects implements IAdminCommandHandler
{
if (!player.isGM())
{
player.startAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
player.setBlockActions(true);
player.startParalyze();
player.broadcastInfo();
@@ -247,7 +249,7 @@ public class AdminEffects implements IAdminCommandHandler
{
L2World.getInstance().forEachVisibleObject(activeChar, L2PcInstance.class, player ->
{
player.stopAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
player.setBlockActions(false);
player.broadcastInfo();
@@ -272,11 +274,11 @@ public class AdminEffects implements IAdminCommandHandler
player = (L2Character) target;
if (type.equals("1"))
{
player.startAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
}
else
{
player.startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);
}
player.setBlockActions(true);
player.startParalyze();
@@ -306,11 +308,11 @@ public class AdminEffects implements IAdminCommandHandler
player = (L2Character) target;
if (type.equals("1"))
{
player.stopAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.PARALYZE);
}
else
{
player.stopAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);
}
player.setBlockActions(false);
player.broadcastInfo();
@@ -329,7 +331,7 @@ public class AdminEffects implements IAdminCommandHandler
if (target instanceof L2Character)
{
player = (L2Character) target;
player.startAbnormalVisualEffect(AbnormalVisualEffect.BIG_HEAD);
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.BIG_HEAD);
}
}
catch (Exception e)
@@ -345,7 +347,7 @@ public class AdminEffects implements IAdminCommandHandler
if (target instanceof L2Character)
{
player = (L2Character) target;
player.stopAbnormalVisualEffect(AbnormalVisualEffect.BIG_HEAD);
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.BIG_HEAD);
}
}
catch (Exception e)
@@ -604,7 +606,7 @@ public class AdminEffects implements IAdminCommandHandler
return true;
}
}
else if (command.startsWith("admin_effect"))
else if (command.startsWith("admin_effect") || command.startsWith("admin_npc_use_skill"))
{
try
{
@@ -707,13 +709,13 @@ public class AdminEffects implements IAdminCommandHandler
if (target instanceof L2Character)
{
final L2Character character = (L2Character) target;
if (!character.hasAbnormalVisualEffect(ave))
if (!character.getEffectList().hasAbnormalVisualEffect(ave))
{
character.startAbnormalVisualEffect(ave);
character.getEffectList().startAbnormalVisualEffect(ave);
}
else
{
character.stopAbnormalVisualEffect(ave);
character.getEffectList().stopAbnormalVisualEffect(ave);
}
return true;
}

View File

@@ -70,7 +70,7 @@ public final class Detection extends AbstractEffect
}
// Remove Hide.
target.getEffectList().stopSkillEffects(true, AbnormalType.HIDE);
target.getEffectList().stopEffects(AbnormalType.HIDE);
}
}
}

View File

@@ -17,18 +17,15 @@
package handlers.effecthandlers;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
@@ -42,10 +39,10 @@ public final class DispelBySlot extends AbstractEffect
public DispelBySlot(StatsSet params)
{
_dispel = params.getString("dispel", null);
_dispel = params.getString("dispel");
if ((_dispel != null) && !_dispel.isEmpty())
{
_dispelAbnormals = new EnumMap<>(AbnormalType.class);
_dispelAbnormals = new HashMap<>();
for (String ngtStack : _dispel.split(";"))
{
final String[] ngt = ngtStack.split(",");
@@ -78,32 +75,27 @@ public final class DispelBySlot extends AbstractEffect
return;
}
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
// Continue only if target has any of the abnormals. Save useless cycles.
if (effected.getEffectList().hasAbnormalType(_dispelAbnormals.keySet()))
{
// Dispel transformations (buff and by GM)
if ((entry.getKey() == AbnormalType.TRANSFORM))
final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM);
if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0)))
{
if ((entry.getValue() == effected.getTransformationId()) || (entry.getValue() < 0))
effected.stopTransformation(true);
}
effected.getEffectList().stopEffects(info ->
{
// We have already dealt with transformation from above.
if (info.isAbnormalType(AbnormalType.TRANSFORM))
{
effected.stopTransformation(true);
continue;
return false;
}
}
final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
if (toDispel == null)
{
continue;
}
if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && ((entry.getValue() < 0) || (entry.getValue() >= toDispel.getSkill().getAbnormalLvl())))
{
effectList.stopSkillEffects(true, entry.getKey());
}
final Short abnormalLevel = _dispelAbnormals.get(info.getSkill().getAbnormalType());
return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl()));
}, true);
}
}
}

View File

@@ -20,7 +20,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
@@ -39,7 +38,7 @@ public final class DispelBySlotMyself extends AbstractEffect
public DispelBySlotMyself(StatsSet params)
{
final String dispel = params.getString("dispel", null);
String dispel = params.getString("dispel");
if ((dispel != null) && !dispel.isEmpty())
{
_dispelAbnormals = new HashSet<>();
@@ -74,14 +73,7 @@ public final class DispelBySlotMyself extends AbstractEffect
return;
}
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (AbnormalType entry : _dispelAbnormals)
{
// The effectlist should already check if it has buff with this abnormal type or not.
effectList.stopSkillEffects(true, entry);
}
// The effectlist should already check if it has buff with this abnormal type or not.
effected.getEffectList().stopEffects(info -> !info.getSkill().isIrreplacableBuff() && _dispelAbnormals.contains(info.getSkill().getAbnormalType()), true);
}
}

View File

@@ -17,19 +17,16 @@
package handlers.effecthandlers;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.model.CharEffectList;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
@@ -44,14 +41,14 @@ public final class DispelBySlotProbability extends AbstractEffect
public DispelBySlotProbability(StatsSet params)
{
_dispel = params.getString("dispel", null);
_dispel = params.getString("dispel");
_rate = params.getInt("rate", 100);
if ((_dispel != null) && !_dispel.isEmpty())
{
_dispelAbnormals = new EnumMap<>(AbnormalType.class);
_dispelAbnormals = new HashMap<>();
for (String ngtStack : _dispel.split(";"))
{
final String[] ngt = ngtStack.split(",");
String[] ngt = ngtStack.split(",");
_dispelAbnormals.put(AbnormalType.getAbnormalType(ngt[0]), Short.MAX_VALUE);
}
}
@@ -81,34 +78,26 @@ public final class DispelBySlotProbability extends AbstractEffect
return;
}
final CharEffectList effectList = effected.getEffectList();
// There is no need to iterate over all buffs,
// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
// Dispel transformations (buff and by GM)
if ((Rnd.get(100) < _rate))
{
if ((Rnd.get(100) < _rate))
final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM);
if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0)))
{
// Dispel transformations (buff and by GM)
if ((entry.getKey() == AbnormalType.TRANSFORM))
{
if ((entry.getValue() == effected.getTransformationId()) || (entry.getValue() < 0))
{
effected.stopTransformation(true);
}
}
final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
if (toDispel == null)
{
continue;
}
if ((toDispel.getSkill().getAbnormalType() == entry.getKey()) && (entry.getValue() >= toDispel.getSkill().getAbnormalLvl()))
{
effectList.stopSkillEffects(true, entry.getKey());
}
effected.stopTransformation(true);
}
}
effected.getEffectList().stopEffects(info ->
{
// We have already dealt with transformation from above.
if (info.isAbnormalType(AbnormalType.TRANSFORM))
{
return false;
}
final Short abnormalLevel = (Rnd.get(100) < _rate) ? _dispelAbnormals.get(info.getSkill().getAbnormalType()) : null;
return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl()));
}, true);
}
}

View File

@@ -59,7 +59,7 @@ public final class MagicalAbnormalDispelAttack extends AbstractEffect
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
// First dispells the effect, then does damage. Sometimes the damage is evaded, but debuff is still dispelled.
if (effector.isAlikeDead() || (_abnormalType == AbnormalType.NONE) || !effected.getEffectList().stopSkillEffects(true, _abnormalType))
if (effector.isAlikeDead() || (_abnormalType == AbnormalType.NONE) || !effected.getEffectList().stopEffects(_abnormalType))
{
return;
}

View File

@@ -82,7 +82,7 @@ public final class MagicalAttack extends AbstractEffect
double damage = Formulas.calcMagicDam(effector, effected, skill, effector.getMAtk(), _power, effected.getMDef(), sps, bss, mcrit);
// Apply debuff mod
if (effected.getEffectList().hasDebuffs())
if (effected.getEffectList().getDebuffCount() > 0)
{
damage *= _debuffModifier;
}

View File

@@ -76,7 +76,7 @@ public final class StealAbnormal extends AbstractEffect
stolen.setAbnormalTime(infoToSteal.getTime()); // Copy the remaining time.
// To include all the effects, it's required to go through the template rather the buff info.
infoToSteal.getSkill().applyEffectScope(EffectScope.GENERAL, stolen, true, true);
effected.getEffectList().remove(true, infoToSteal, null);
effected.getEffectList().remove(infoToSteal, true, true);
effector.getEffectList().add(stolen);
}
}

View File

@@ -20,7 +20,6 @@ import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.ISkillCondition;
import com.l2jmobius.gameserver.model.skills.Skill;
@@ -45,12 +44,8 @@ public class OpCheckAbnormalSkillCondition implements ISkillCondition
{
if (target.isCharacter())
{
final BuffInfo info = ((L2Character) target).getEffectList().getBuffInfoByAbnormalType(_type);
if (_hasAbnormal)
{
return (info != null) && (info.getSkill().getAbnormalLvl() >= _level);
}
return (info == null) || (info.getSkill().getAbnormalLvl() < _level);
final boolean hasAbnormal = ((L2Character) target).getEffectList().hasAbnormalType(_type, info -> (info.getSkill().getAbnormalLvl() >= _level));
return _hasAbnormal ? hasAbnormal : !hasAbnormal;
}
return false;
}

View File

@@ -21,7 +21,6 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.logging.Level;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
@@ -34,7 +33,6 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -492,25 +490,8 @@ public final class Kamaloka extends AbstractInstance
*/
private static final void removeBuffs(L2Character ch)
{
final Function<BuffInfo, Boolean> removeBuffs = info ->
{
if ((info != null) && !info.getSkill().isStayAfterDeath() && (Arrays.binarySearch(BUFFS_WHITELIST, info.getSkill().getId()) < 0))
{
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
return true;
}
return false;
};
ch.getEffectList().forEach(removeBuffs, false);
if (ch.hasSummon())
{
for (L2Npc s : ch.getSummonedNpcs())
{
s.getEffectList().forEach(removeBuffs, false);
}
}
// Stop all buffs.
ch.getEffectList().stopEffects(info -> (info != null) && !info.getSkill().isStayAfterDeath() && (Arrays.binarySearch(BUFFS_WHITELIST, info.getSkill().getId()) < 0), true);
}
/**

View File

@@ -164,7 +164,7 @@ public final class Nursery extends AbstractInstance
}
}
final BuffInfo energyInfo = player.getEffectList().getBuffInfoByAbnormalType(ENERGY_SKILL_1.getSkill().getAbnormalType());
final BuffInfo energyInfo = player.getEffectList().getFirstBuffInfoByAbnormalType(ENERGY_SKILL_1.getSkill().getAbnormalType());
final int energyLv = energyInfo == null ? 0 : energyInfo.getSkill().getAbnormalLvl();
if ((energyLv > 0) && (gameStage == 1) && (energyInfo != null))

View File

@@ -101,16 +101,16 @@ public final class SSQMonasteryOfSilence extends AbstractInstance
startQuestTimer("FOLLOW", 3000, elcadia, player);
final L2Npc guardianStaff = player.getInstanceWorld().getNpc(GUARDIAN_STAFF);
guardianStaff.startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianStaff.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianStaff.setIsInvul(true);
final L2Npc guardianSword = player.getInstanceWorld().getNpc(GUARDIAN_SWORD);
guardianSword.startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianSword.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianSword.setIsInvul(true);
final L2Npc guardianShield = player.getInstanceWorld().getNpc(GUARDIAN_SHIELD);
guardianShield.startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianShield.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianShield.setIsInvul(true);
final L2Npc guardianScroll = player.getInstanceWorld().getNpc(GUARDIAN_SCROLL);
guardianScroll.startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianScroll.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardianScroll.setIsInvul(true);
}
else

View File

@@ -206,7 +206,7 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest
takeItems(player, STAFF_RELIC, -1);
final L2Npc guardian = player.getInstanceWorld().getNpc(GUARDIAN_STAFF);
guardian.setIsInvul(false);
guardian.stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardian.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
}
return null;
}
@@ -217,7 +217,7 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest
takeItems(player, SWORD_RELIC, -1);
final L2Npc guardian = player.getInstanceWorld().getNpc(GUARDIAN_SWORD);
guardian.setIsInvul(false);
guardian.stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardian.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
}
return null;
}
@@ -228,7 +228,7 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest
takeItems(player, SHIELD_RELIC, -1);
final L2Npc guardian = player.getInstanceWorld().getNpc(GUARDIAN_SHIELD);
guardian.setIsInvul(false);
guardian.stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardian.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
}
return null;
}
@@ -239,7 +239,7 @@ public final class Q10295_SevenSignsSolinasTomb extends Quest
takeItems(player, SCROLL_RELIC, -1);
final L2Npc guardian = player.getInstanceWorld().getNpc(GUARDIAN_SCROLL);
guardian.setIsInvul(false);
guardian.stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
guardian.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.INVINCIBILITY);
}
return null;
}