L2JMobius

Free Users => Solved/Invalid Bug Reports => Topic started by: ver on January 18, 2021, 11:25:31 PM

Title: Mobs race
Post by: ver on January 18, 2021, 11:25:31 PM
It looks like mobs race is not set properly.

It suppose to be taken from skill 4416 where level is a race ID, however in java/org/l2jmobius/gameserver/datatables/sql/NpcTable.java you see something like:
Code: [Select]
if ((npcDat.getRace() == null) && skillId == 4416) {
npcDat.setRace(level);
continue;
}

Unfortnatelly npcDat.getRace() returns Race.UNKNOWN so .. its not null. If not, then race was not set at all.

I have changed it to:
Code: [Select]
if (skillId == 4416) {
npcDat.setRace(level);
continue;
}

Since the mobs are just getting loading and have no race set yet (well, even if they had race it can be overwriten) we can set no matter what.

And race fixes problems with for example Banish Seraphin skill - race based skill.

Best regards
Title: Re: Mobs race
Post by: Mobius on January 19, 2021, 03:39:02 AM
That forces the race to change even if it exists.
Also I see no point on not adding race skill to NPC. (removed the continue)

Try this if you can.
Code: [Select]
Index: java/org/l2jmobius/gameserver/data/sql/NpcTable.java
===================================================================
--- java/org/l2jmobius/gameserver/data/sql/NpcTable.java (revision 8154)
+++ java/org/l2jmobius/gameserver/data/sql/NpcTable.java (working copy)
@@ -36,6 +36,7 @@
 import org.l2jmobius.gameserver.model.Skill;
 import org.l2jmobius.gameserver.model.StatSet;
 import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
+import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate.Race;
 import org.l2jmobius.gameserver.model.skills.BaseStat;
 import org.l2jmobius.gameserver.model.skills.Stat;
 
@@ -105,16 +106,19 @@
 
  final int skillId = npcskills.getInt("skillid");
  final int level = npcskills.getInt("level");
- if ((npcDat.getRace() == null) && (skillId == 4416))
+ npcSkill = SkillTable.getInstance().getSkill(skillId, level);
+ if (npcSkill == null)
  {
- npcDat.setRace(level);
  continue;
  }
 
- npcSkill = SkillTable.getInstance().getSkill(skillId, level);
- if (npcSkill == null)
+ if (skillId == 4416)
  {
- continue;
+ final Race race = npcDat.getRace();
+ if ((race == null) || (race == Race.UNKNOWN))
+ {
+ npcDat.setRace(level);
+ }
  }
 
  npcDat.addSkill(npcSkill);
Title: Re: Mobs race
Post by: ver on January 19, 2021, 09:31:56 PM
Yes, u might be right with that "not adding race skill" - but tbh... is it used anywhere later? guess not.

Anyway - your patch is working, except the path is incorrect
should be:
java/org/l2jmobius/gameserver/datatables/sql/NpcTable.java
not
java/org/l2jmobius/gameserver/data/sql/NpcTable.java

At least it is like that in my case. Hope I didnt miss any important commits.
Title: Re: Mobs race
Post by: Mobius on January 21, 2021, 01:12:01 AM
Fixed with https://bitbucket.org/MobiusDev/l2j_mobius/commits/5953d08e9e78d1b3cd272e94a4c969f3467b41a3
Thanks :D