L2JMobius
Free Users => Shares/Contributions => Topic started by: seanet on June 08, 2020, 05:22:38 PM
-
Hello, i try to add a price to the noble manager but seems that my experience is very reduced i cannot make the npc to work with my mods this is what i did and is not working and i dont get any errors in gs console
package custom.NoblessMaster;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import ai.AbstractNpcAI;
/**
* @author Mobius
*/
public class NoblessMaster extends AbstractNpcAI
{
private static final int NOBLESS_TIARA = 7694;
private static final int CARADINE_LETTER = 7678;
private NoblessMaster()
{
addStartNpc(Config.NOBLESS_MASTER_NPCID);
addTalkId(Config.NOBLESS_MASTER_NPCID);
addFirstTalkId(Config.NOBLESS_MASTER_NPCID);
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
if (!Config.NOBLESS_MASTER_ENABLED)
{
return null;
}
switch (event)
{
case "noblesse":
{
if (player.isNoble())
{
return "1003000-3.htm";
}
if (player.getLevel() <= Config.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
return "1003000-2.htm";
}
if (getQuestItemsCount(player, CARADINE_LETTER) >= 1)
{
takeItems(player, CARADINE_LETTER, 1);
giveItems(player, NOBLESS_TIARA, 1);
player.setNoble(true);
return "1003000-1.htm";
}
return "1003000-2.htm";
}
}
return null;
}
@Override
public String onFirstTalk(Npc npc, PlayerInstance player)
{
return "1003000.htm";
}
public static void main(String[] args)
{
new NoblessMaster();
}
}
Any help is higly appreciated.
-
I am not using High Five and I don't know if this nobless manager is implemented in the source, but did you enable NOBLESS_MASTER_ENABLED in your configs?
It could be a reason for it to not work without getting any errors.
-
it is enabled it works without my addons it is in scripts/custom/NoblessMaster
-
Try removing the if (getQuestItemsCount(player, CARADINE_LETTER) >= 1) check. Maybe getQuestItemsCount doesn't work.
Also, change if (player.getLevel() <= Config.NOBLESS_MASTER_LEVEL_REQUIREMENT) to if (player.getLevel() < Config.NOBLESS_MASTER_LEVEL_REQUIREMENT)
-
As i said i am a begginer in java programming but when u look closer u see the beginner errors
code is working now the return statement was written wrong
case "noblesse":
{
if (player.isNoble())
{
return "1003000-3.htm";
}
// Here is the mistake
if (player.getLevel() <= Config.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
return "1003000-2.htm"; //<----
}
if (player.getLevel() >= Config.NOBLESS_MASTER_LEVEL_REQUIREMENT)
{
if (getQuestItemsCount(player, CARADINE_LETTER) >= 1)
{
takeItems(player, CARADINE_LETTER, 1);
giveItems(player, NOBLESS_TIARA, 1);
player.setNoble(true);
return "1003000-1.htm";
}
}
return "1003000-2.htm";
}
}