Autor Tema: Mal funcionamiento en skills restringidos a "UNDEADS"  (Leído 148 veces)

canonmagic

  • Jr. Member
  • **
  • Mensajes: 52
  • Karma: +0/-0
    • Ver Perfil
Mal funcionamiento en skills restringidos a "UNDEADS"
« en: Junio 16, 2018, 10:05:23 am »
Buenas, Les escribo para avisarles que me he encontrado un problema con las skills como Disrupt Undead que estan restringidas para atacar solo a los Type undead... Hoy anduve andando un rato jugando con un Cleric y me encontre que al intentar lanzar la habilidad Disrupt Undead a un ghoul me mandaba el mensaje "Target cannot be found" y "Incorrect Target", asi que con un admin probe todas las habilidades hacia los undead y ninguna funciono... tambien probe con otros undead como Strains y nada...
« Última modificación: Junio 22, 2018, 07:31:58 pm por fissban »

fissban

  • Administrador
  • Full Member
  • *
  • Mensajes: 196
  • Karma: +0/-0
    • Ver Perfil
Re:Mal funcionamiento en skills restringidos a "UNDEADS"
« Respuesta #1 en: Junio 16, 2018, 11:53:25 am »
proba este cambio

Código
Index: java/net/sf/l2j/gameserver/data/NpcData.java
===================================================================
--- java/net/sf/l2j/gameserver/data/NpcData.java (revision 1093)
+++ java/net/sf/l2j/gameserver/data/NpcData.java (working copy)
@@ -31,6 +31,7 @@
 import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.gameserver.model.StatsSet;
 import net.sf.l2j.gameserver.model.actor.base.ClassId;
+import net.sf.l2j.gameserver.model.actor.enums.NpcRaceType;
 import net.sf.l2j.gameserver.model.actor.templates.NpcTemplate;
 import net.sf.l2j.gameserver.model.holder.MinionHolder;
 import net.sf.l2j.gameserver.model.skills.Skill;
@@ -190,12 +191,41 @@
  final int id = rset.getInt("skillid");
  final int level = rset.getInt("level");
 
- if (template.getRace() == 0)
+ if (mobId == 12899)
+ {
+ template.setRace(NpcRaceType.CREATURE_VALAKAS);
+ }
+ else if (template.getRace() == NpcRaceType.NONE)
  {
  if ((id >= 4290) && (id <= 4302))
  {
- template.setRace(id);
- continue;
+ switch (id)
+ {
+ case 4290:
+ template.setRace(NpcRaceType.UNDEAD);
+ break;
+ case 4292:
+ template.setRace(NpcRaceType.BEAST);
+ break;
+ case 4293:
+ template.setRace(NpcRaceType.ANIMAL);
+ break;
+ case 4294:
+ template.setRace(NpcRaceType.PLANT);
+ break;
+ case 4299:
+ template.setRace(NpcRaceType.DRAGON);
+ break;
+ case 4300:
+ template.setRace(NpcRaceType.GIANT);
+ break;
+ case 4301:
+ template.setRace(NpcRaceType.BUG);
+ break;
+ case 4302:
+ template.setRace(NpcRaceType.MAGIC_CREATURE);
+ break;
+ }
  }
  }
 
Index: java/net/sf/l2j/gameserver/handler/skill/SkillDisablers.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/skill/SkillDisablers.java (revision 1091)
+++ java/net/sf/l2j/gameserver/handler/skill/SkillDisablers.java (working copy)
@@ -21,6 +21,7 @@
 import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.actor.L2Character;
 import net.sf.l2j.gameserver.model.actor.ai.enums.CtrlEventType;
+import net.sf.l2j.gameserver.model.actor.enums.NpcRaceType;
 import net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.actor.instance.enums.ShotType;
@@ -157,18 +158,19 @@
  // these skills needs to be rechecked
  if (target instanceof L2MonsterInstance)
  {
- if (Formulas.calcEffectSuccess(activeChar, target, skill, true, false, sps, bss))
+ L2MonsterInstance monster = (L2MonsterInstance) target;
+ if (Formulas.calcEffectSuccess(activeChar, monster, skill, true, false, sps, bss))
  {
  if (skill.getTargetType() == SkillTargetType.TARGET_UNDEAD)
  {
- if (target.isUndead())
+ if (monster.getTemplate().getRace() == NpcRaceType.UNDEAD)
  {
- target.getAI().notifyEvent(CtrlEventType.AGGRESSION, null, -((L2MonsterInstance) target).getHating(((L2MonsterInstance) target).getMostHated()));
+ monster.getAI().notifyEvent(CtrlEventType.AGGRESSION, null, -((L2MonsterInstance) target).getHating(((L2MonsterInstance) target).getMostHated()));
  }
  }
  else
  {
- target.getAI().notifyEvent(CtrlEventType.AGGRESSION, null, -((L2MonsterInstance) target).getHating(((L2MonsterInstance) target).getMostHated()));
+ monster.getAI().notifyEvent(CtrlEventType.AGGRESSION, null, -((L2MonsterInstance) target).getHating(((L2MonsterInstance) target).getMostHated()));
  }
  }
  }
Index: java/net/sf/l2j/gameserver/handler/target/TargetAreaCorpseMob.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/target/TargetAreaCorpseMob.java (revision 1091)
+++ java/net/sf/l2j/gameserver/handler/target/TargetAreaCorpseMob.java (working copy)
@@ -60,6 +60,11 @@
 
  L2PcInstance src = activeChar.getActingPlayer();
 
+ if (src == null)
+ {
+ return EMPTY_TARGET_LIST;
+ }
+
  for (L2Character obj : target.getKnownList().getObjectTypeInRadius(L2Character.class, skill.getSkillRadius()))
  {
  if (!((obj instanceof L2Attackable) || (obj instanceof L2Playable)) || obj.isDead() || (obj == activeChar))
@@ -67,66 +72,63 @@
  continue;
  }
 
- if (src != null)
+ if (!GeoEngine.getInstance().canSeeTarget(target, obj))
+ {
+ continue;
+ }
+
+ L2PcInstance trg = obj.getActingPlayer();
+
+ if (trg != null)
  {
- L2PcInstance trg = obj.getActingPlayer();
+ if (trg == src)
+ {
+ continue;
+ }
 
- if (trg != null)
+ if (trg.isInsideZone(ZoneType.PEACE))
  {
- if (trg == src)
+ continue;
+ }
+
+ if ((src.getParty() != null) && (trg.getParty() != null))
+ {
+ if (src.getParty().getLeader().getObjectId() == trg.getParty().getLeader().getObjectId())
  {
  continue;
  }
 
- if ((src.getParty() != null) && (trg.getParty() != null))
+ if ((src.getParty().getCommandChannel() != null) && (trg.getParty().getCommandChannel() != null))
  {
- if (src.getParty().getLeader().getObjectId() == trg.getParty().getLeader().getObjectId())
+ if (src.getParty().getCommandChannel() == trg.getParty().getCommandChannel())
  {
  continue;
  }
-
- if ((src.getParty().getCommandChannel() != null) && (trg.getParty().getCommandChannel() != null))
- {
- if (src.getParty().getCommandChannel() == trg.getParty().getCommandChannel())
- {
- continue;
- }
- }
  }
-
- if (trg.isInsideZone(ZoneType.PEACE))
+ }
+
+ if (!srcInArena && !(trg.isInsideZone(ZoneType.PVP) && !trg.isInsideZone(ZoneType.SIEGE)))
+ {
+ if ((src.getAllyId() == trg.getAllyId()) && (src.getAllyId() != 0))
  {
  continue;
  }
 
- if (!srcInArena && !(trg.isInsideZone(ZoneType.PVP) && !trg.isInsideZone(ZoneType.SIEGE)))
+ if ((src.getClan() != null) && (trg.getClan() != null))
  {
- if ((src.getAllyId() == trg.getAllyId()) && (src.getAllyId() != 0))
- {
- continue;
- }
-
- if ((src.getClan() != null) && (trg.getClan() != null))
- {
- if (src.getClan().getId() == trg.getClan().getId())
- {
- continue;
- }
- }
-
- if (!src.checkPvpSkill(obj, skill, activeChar instanceof L2Summon))
+ if (src.getClan().getId() == trg.getClan().getId())
  {
  continue;
  }
  }
+
+ if (!src.checkPvpSkill(obj, skill, activeChar instanceof L2Summon))
+ {
+ continue;
+ }
  }
  }
 
- if (!GeoEngine.getInstance().canSeeTarget(target, obj))
- {
- continue;
- }
-
  targetList.add(obj);
  }
 
Index: java/net/sf/l2j/gameserver/handler/target/TargetAuraUndead.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/target/TargetAuraUndead.java (revision 1091)
+++ java/net/sf/l2j/gameserver/handler/target/TargetAuraUndead.java (working copy)
@@ -25,6 +25,7 @@
 import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.actor.L2Character;
 import net.sf.l2j.gameserver.model.actor.L2Npc;
+import net.sf.l2j.gameserver.model.actor.enums.NpcRaceType;
 import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance;
 import net.sf.l2j.gameserver.model.skills.Skill;
 import net.sf.l2j.gameserver.model.skills.enums.SkillTargetType;
@@ -47,7 +48,9 @@
  {
  if ((character instanceof L2Npc) || (character instanceof L2SummonInstance))
  {
- if (!character.isUndead())
+ L2Npc npc = (L2Npc) character;
+
+ if (npc.getTemplate().getRace() != NpcRaceType.UNDEAD)
  {
  continue;
  }
Index: java/net/sf/l2j/gameserver/handler/target/TargetUndead.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/target/TargetUndead.java (revision 1091)
+++ java/net/sf/l2j/gameserver/handler/target/TargetUndead.java (working copy)
@@ -22,6 +22,7 @@
 import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.actor.L2Character;
 import net.sf.l2j.gameserver.model.actor.L2Npc;
+import net.sf.l2j.gameserver.model.actor.enums.NpcRaceType;
 import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance;
 import net.sf.l2j.gameserver.model.skills.Skill;
 import net.sf.l2j.gameserver.model.skills.enums.SkillTargetType;
@@ -47,7 +48,15 @@
  return EMPTY_TARGET_LIST;
  }
 
- if (!target.isUndead() || target.isDead())
+ L2Npc npc = (L2Npc) target;
+
+ if (npc.getTemplate().getRace() != NpcRaceType.UNDEAD)
+ {
+ activeChar.sendPacket(SystemMessage.INCORRECT_TARGET);
+ return EMPTY_TARGET_LIST;
+ }
+
+ if (target.isDead())
  {
  activeChar.sendPacket(SystemMessage.INCORRECT_TARGET);
  return EMPTY_TARGET_LIST;
Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 1094)
+++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
@@ -1664,11 +1664,6 @@
  isSingleSpear = value;
  }
 
- public boolean isUndead()
- {
- return template.isUndead();
- }
-
  public CharTemplate getTemplate()
  {
  return template;
Index: java/net/sf/l2j/gameserver/model/actor/L2Npc.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Npc.java (revision 1091)
+++ java/net/sf/l2j/gameserver/model/actor/L2Npc.java (working copy)
@@ -306,15 +306,6 @@
  }
 
  /**
- * Return True if this npc is undead in function of the L2NpcTemplate.
- */
- @Override
- public boolean isUndead()
- {
- return getTemplate().isUndead();
- }
-
- /**
  * @return True if this npc is quest monster in function of the L2NpcTemplate.
  */
  public boolean isQuestMonster()
Index: java/net/sf/l2j/gameserver/model/actor/enums/NpcRaceType.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/enums/NpcRaceType.java (revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/enums/NpcRaceType.java (revision 0)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014-2018 L2jAdmins
+ *
+ * This file is part of L2jAdmins.
+ *
+ * L2jAdmins is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2jAdmins is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.actor.enums;
+
+/**
+ * @author fissban
+ */
+public enum NpcRaceType
+{
+ NONE,
+ UNDEAD,
+ BEAST,
+ ANIMAL,
+ PLANT,
+ DRAGON,
+ GIANT,
+ MAGIC_CREATURE,
+ CREATURE_VALAKAS,
+ BUG
+}
Index: java/net/sf/l2j/gameserver/model/actor/templates/CharTemplate.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/templates/CharTemplate.java (revision 1091)
+++ java/net/sf/l2j/gameserver/model/actor/templates/CharTemplate.java (working copy)
@@ -77,8 +77,6 @@
  private final double baseHolyVuln;
  private final double baseDarkVuln;
 
- private final boolean isUndead;
-
  // C4 Stats
  private final int baseMpConsumeRate;
  private final int baseHpConsumeRate;
@@ -140,8 +138,6 @@
  baseHolyVuln = set.getDouble("holyVuln", 1.0);
  baseDarkVuln = set.getDouble("darkVuln", 1.0);
 
- isUndead = (set.getInteger("isUndead", 0) == 1);
-
  // C4 Stats
  baseMpConsumeRate = set.getInteger("mpConsumeRate", 0);
  baseHpConsumeRate = set.getInteger("hpConsumeRate", 0);
@@ -350,11 +346,6 @@
  return baseDarkVuln;
  }
 
- public boolean isUndead()
- {
- return isUndead;
- }
-
  public int getBaseMpConsumeRate()
  {
  return baseMpConsumeRate;
Index: java/net/sf/l2j/gameserver/model/actor/templates/NpcTemplate.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/templates/NpcTemplate.java (revision 1093)
+++ java/net/sf/l2j/gameserver/model/actor/templates/NpcTemplate.java (working copy)
@@ -28,6 +28,7 @@
 
 import net.sf.l2j.gameserver.model.StatsSet;
 import net.sf.l2j.gameserver.model.actor.base.ClassId;
+import net.sf.l2j.gameserver.model.actor.enums.NpcRaceType;
 import net.sf.l2j.gameserver.model.drop.DropCategory;
 import net.sf.l2j.gameserver.model.drop.DropInstance;
 import net.sf.l2j.gameserver.model.holder.MinionHolder;
@@ -68,7 +69,7 @@
  private boolean isAuctioner = false;
  private boolean isWarehouse = false;
 
- private int race;
+ private NpcRaceType race;
  private final String jClass;
 
  /** The table containing all Item that can be dropped by L2NpcInstance using this L2NpcTemplate */
@@ -120,7 +121,7 @@
  ss = (short) set.getInteger("ss", 0);
  bss = (short) set.getInteger("bss", 0);
  ssRate = (short) set.getInteger("ssRate", 0);
- race = 0;
+ race = NpcRaceType.NONE;
  jClass = set.getString("jClass");
  }
 
@@ -257,14 +258,14 @@
  return scriptEvents;
  }
 
- public int getRace()
+ public NpcRaceType getRace()
  {
  return race;
  }
 
- public void setRace(int race)
+ public void setRace(NpcRaceType npcRaceType)
  {
- this.race = race;
+ this.race = npcRaceType;
  }
 
  public int getId()
Index: java/net/sf/l2j/gameserver/model/skills/stats/Formulas.java
===================================================================
--- java/net/sf/l2j/gameserver/model/skills/stats/Formulas.java (revision 1094)
+++ java/net/sf/l2j/gameserver/model/skills/stats/Formulas.java (working copy)
@@ -30,6 +30,7 @@
 import net.sf.l2j.gameserver.model.actor.L2Character;
 import net.sf.l2j.gameserver.model.actor.L2Npc;
 import net.sf.l2j.gameserver.model.actor.L2Playable;
+import net.sf.l2j.gameserver.model.actor.enums.NpcRaceType;
 import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
@@ -498,9 +499,9 @@
 
  if (attacker instanceof L2Npc)
  {
- int raceId = ((L2Npc) attacker).getTemplate().getRace();
+ NpcRaceType raceId = ((L2Npc) attacker).getTemplate().getRace();
  // Skill Race : Undead
- if (raceId == 4290)
+ if (raceId == NpcRaceType.UNDEAD)
  {
  pAtk /= attacker.calcStat(StatsType.PHYSICAL_DEF_UNDEAD, 1, target, null);
  }
@@ -512,43 +513,33 @@
  }
  if (target instanceof L2Npc)
  {
- int raceId = ((L2Npc) target).getTemplate().getRace();
-
- if (raceId == 4290)// Skill Race : Undead
- {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_MONSTERS, 1, target, null);
- }
- if (raceId == 4292) // Skill Race : Beast
+ switch (((L2Npc) target).getTemplate().getRace())
  {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_MONSTERS, 1, target, null);
- }
- if (raceId == 4293)// Skill Race : Animal
- {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_ANIMALS, 1, target, null);
- }
- if (raceId == 4294)// Skill Race : Plant
- {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_PLANTS, 1, target, null);
- }
- if (raceId == 4299)// Skill Race : Dragon
- {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_DRAGONS, 1, target, null);
- }
- if (raceId == 4300)// Skill Race : Giant
- {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_GIANTS, 1, target, null);
- }
- if (raceId == 4301)// Skill Race : Bug
- {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_INSECTS, 1, target, null);
- }
- if (raceId == 4302)// Skill Race : Magic Creatures
- {
- pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_MAGIC_CREATURES, 1, target, null);
- }
- if (((L2Npc) target).getId() == 12899)// For amulets of Valakas
- {
- pAtk *= attacker.calcStat(StatsType.VALAKAS_PHYSICAL_DMG, 1, null, null);
+ case UNDEAD:
+ case BEAST:
+ pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_MONSTERS, 1, target, null);
+ break;
+ case ANIMAL:
+ pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_ANIMALS, 1, target, null);
+ break;
+ case PLANT:
+ pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_PLANTS, 1, target, null);
+ break;
+ case DRAGON:
+ pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_DRAGONS, 1, target, null);
+ break;
+ case GIANT:
+ pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_GIANTS, 1, target, null);
+ break;
+ case MAGIC_CREATURE:
+ pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_MAGIC_CREATURES, 1, target, null);
+ break;
+ case BUG:
+ pAtk *= attacker.calcStat(StatsType.PHYSICAL_ATK_INSECTS, 1, target, null);
+ break;
+ case CREATURE_VALAKAS:
+ pAtk *= attacker.calcStat(StatsType.VALAKAS_PHYSICAL_DMG, 1, null, null);
+ break;
  }
  }
 


canonmagic

  • Jr. Member
  • **
  • Mensajes: 52
  • Karma: +0/-0
    • Ver Perfil
Re:Mal funcionamiento en skills restringidos a "UNDEADS"
« Respuesta #2 en: Junio 16, 2018, 02:43:27 pm »
Funciono perfectamente   :), gracias nuevamente por tu atencion fissban; ya te aviso si consigo algun otro problema mientras sigo testeandolo.