L2JMobius
Public Development => Bug Reports => Topic started by: Robotukas5 on March 02, 2026, 09:15:07 PM
-
Description
In the NoblessMaster script the required items are removed before checking the player level requirement
If a player has the required items but is below the required level for example level 78 or 79 when the requirement is 80 the script removes the items and then denies Noblesse
Expected behavior
The script should first check the level requirement and only remove items after the level condition is satisfied
-
Description
In the NoblessMaster script the required items are removed before checking the player level requirement
If a player has the required items but is below the required level for example level 78 or 79 when the requirement is 80 the script removes the items and then denies Noblesse
Expected behavior
The script should first check the level requirement and only remove items after the level condition is satisfied
Put the script in an AI.
Tell it what it should be done.
Share the result with us.
:D
-
Description
In the NoblessMaster script the required items are removed before checking the player level requirement
If a player has the required items but is below the required level for example level 78 or 79 when the requirement is 80 the script removes the items and then denies Noblesse
Expected behavior
The script should first check the level requirement and only remove items after the level condition is satisfied
If you give me the quest ID I will do it
-
If you give me the quest ID I will do it
This is not a quest ID. It is your custom script (costum) NoblessMaster.
Path: data/scripts/custom/NoblessMaster/NoblessMaster.java
Bug: items are taken before the level requirement check. Please swap the order so level is checked first, then items are removed.
-
This is not a quest ID. It is your custom script (costum) NoblessMaster.
Path: data/scripts/custom/NoblessMaster/NoblessMaster.java
Bug: items are taken before the level requirement check. Please swap the order so level is checked first, then items are removed.
Already are checked first level and then items...
1.- If player already is nobles
2.- If player have the level
3.- The items
Try with else if
### Eclipse Workspace Patch 1.0
#P L2J_Mobius_CT_0_Interlude
Index: dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
===================================================================
--- dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
+++ dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
@@ -59,12 +59,12 @@
return "1003000-3.htm";
}
- if (player.getLevel() < NoblessMasterConfig.NOBLESS_MASTER_LEVEL_REQUIREMENT)
+ else if (player.getLevel() < NoblessMasterConfig.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
return "1003000-2.htm";
}
- if (NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT > 0)
+ else if (NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT > 0)
{
if (getQuestItemsCount(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID) < NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT)
{
-
Already are checked first level and then items...
1.- If player already is nobles
2.- If player have the level
3.- The items
Try with else if
Your patch does not solve the issue.
The problem is not the if/else structure.
The real issue is that takeItems() is executed before validating the level requirement.
Because of that, the required item is removed even if the player does not meet the level requirement, and noblesse is not granted.
The correct logic is to check the level first, and only then validate and remove the required items.
### Eclipse Workspace Patch 1.0
#P L2J_Mobius_CT_0_Interlude
Index: dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
===================================================================
--- dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
+++ dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
@@ -59,12 +59,12 @@
return "1003000-3.htm";
}
- if (player.getLevel() < NoblessMasterConfig.NOBLESS_MASTER_LEVEL_REQUIREMENT)
+ else if (player.getLevel() < NoblessMasterConfig.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
return "1003000-2.htm";
}
- if (NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT > 0)
+ else if (NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT > 0)
{
if (getQuestItemsCount(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID) < NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT)
{
Your patch does not solve the issue.
The problem is not the if/else structure.
The real issue is that takeItems() is executed before validating the level requirement.
Because of that, the required item is removed even if the player does not meet the level requirement, and noblesse is not granted.
The correct logic is to check the level first, and only then validate and remove the required items.
-
Here is the correct and tested version.
It fixes the issue properly.
Feel free to use it if needed.
/**
* @author Mobius
*/
public class NoblessMaster extends Script
{
// Item
private static final int NOBLESS_TIARA = 7694;
private NoblessMaster()
{
addStartNpc(NoblessMasterConfig.NOBLESS_MASTER_NPCID);
addTalkId(NoblessMasterConfig.NOBLESS_MASTER_NPCID);
addFirstTalkId(NoblessMasterConfig.NOBLESS_MASTER_NPCID);
}
@Override
public String onEvent(String event, Npc npc, Player player)
{
if (!NoblessMasterConfig.NOBLESS_MASTER_ENABLED)
{
return null;
}
switch (event)
{
case "noblesse":
{
if (player.isNoble())
{
return "1003000-3.htm";
}
// Level check FIRST (prevents item loss)
if (player.getLevel() < NoblessMasterConfig.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
return "1003000-2.htm";
}
// Item check + take items AFTER level check
if (NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT > 0)
{
if (getQuestItemsCount(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID) < NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT)
{
player.sendMessage(NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT + " unit(s) of the item " + ItemData.getInstance().getTemplate(NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID).getName() + " is/are required.");
return "1003000-4.htm";
}
takeItems(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID, NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT);
}
if (NoblessMasterConfig.NOBLESS_MASTER_REWARD_TIARA)
{
giveItems(player, NOBLESS_TIARA, 1);
}
player.setNoble(true);
player.sendPacket(QuestSound.ITEMSOUND_QUEST_FINISH.getPacket());
return "1003000-1.htm";
}
}
return null;
}
@Override
public String onFirstTalk(Npc npc, Player player)
{
return "1003000.htm";
}
public static void main(String[] args)
{
new NoblessMaster();
}
}
-
Here is the correct and tested version.
It fixes the issue properly.
Feel free to use it if needed.
/**
* @author Mobius
*/
public class NoblessMaster extends Script
{
// Item
private static final int NOBLESS_TIARA = 7694;
private NoblessMaster()
{
addStartNpc(NoblessMasterConfig.NOBLESS_MASTER_NPCID);
addTalkId(NoblessMasterConfig.NOBLESS_MASTER_NPCID);
addFirstTalkId(NoblessMasterConfig.NOBLESS_MASTER_NPCID);
}
@Override
public String onEvent(String event, Npc npc, Player player)
{
if (!NoblessMasterConfig.NOBLESS_MASTER_ENABLED)
{
return null;
}
switch (event)
{
case "noblesse":
{
if (player.isNoble())
{
return "1003000-3.htm";
}
// Level check FIRST (prevents item loss)
if (player.getLevel() < NoblessMasterConfig.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
return "1003000-2.htm";
}
// Item check + take items AFTER level check
if (NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT > 0)
{
if (getQuestItemsCount(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID) < NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT)
{
player.sendMessage(NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT + " unit(s) of the item " + ItemData.getInstance().getTemplate(NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID).getName() + " is/are required.");
return "1003000-4.htm";
}
takeItems(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID, NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT);
}
if (NoblessMasterConfig.NOBLESS_MASTER_REWARD_TIARA)
{
giveItems(player, NOBLESS_TIARA, 1);
}
player.setNoble(true);
player.sendPacket(QuestSound.ITEMSOUND_QUEST_FINISH.getPacket());
return "1003000-1.htm";
}
}
return null;
}
@Override
public String onFirstTalk(Npc npc, Player player)
{
return "1003000.htm";
}
public static void main(String[] args)
{
new NoblessMaster();
}
}
You post the same fuck script with some IA comment....on the current verison already are checed first the level......
public String onEvent(String event, Npc npc, Player player)
{
if (!NoblessMasterConfig.NOBLESS_MASTER_ENABLED)
{
return null;
}
switch (event)
{
case "noblesse":
{
if (player.isNoble())
{
return "1003000-3.htm";
}
if (player.getLevel() < NoblessMasterConfig.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
return "1003000-2.htm";
}
if (NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT > 0)
{
if (getQuestItemsCount(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID) < NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT)
{
player.sendMessage(NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT + " unit(s) of the item " + ItemData.getInstance().getTemplate(NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID).getName() + " is/are required.");
return "1003000-4.htm";
}
takeItems(player, NoblessMasterConfig.NOBLESS_MASTER_ITEM_ID, NoblessMasterConfig.NOBLESS_MASTER_ITEM_COUNT);
}
if (NoblessMasterConfig.NOBLESS_MASTER_REWARD_TIARA)
{
giveItems(player, NOBLESS_TIARA, 1);
}
player.setNoble(true);
player.sendPacket(QuestSound.ITEMSOUND_QUEST_FINISH.getPacket());
return "1003000-1.htm";
}
}
return null;
}
So 2 things you use a old version as fuck or are on drugs....
-
So 2 things you use a old version as fuck or are on drugs....
Apparently the released version does not have our change yet.
-
Apparently the released version does not have our change yet.
I see now my bad :(
-
It is scheduled to be released on April.
(https://i.ibb.co/xtX039X8/image.png) (https://ibb.co/Jwm4C6mF)