Untitled

 avatar
unknown
plain_text
11 days ago
1.5 kB
3
Indexable
package l2e.scripts.custom;

// ... (imports)

public class MonumentOfHeroes extends AbstractNpcAI {
    // ... (other constants)

    private static final int HERO_CLOAK = 9999; // Replace with the actual cloak ID

    // ... (constructor and other methods)

    @Override
    public String onAdvEvent(String event, Npc npc, Player player) {
        String htmltext = "";
        switch (event) {
            // ... (HeroWeapon and HeroCirclet cases)

            case "HeroCloak":
                if (!player.isHero()) {
                    htmltext = "no_hero_cloak.htm"; // New HTML for non-heroes
                } else if (hasQuestItems(player, HERO_CLOAK)) {
                    htmltext = "already_have_cloak.htm"; // New HTML if they have it
                } else {
                    giveItems(player, HERO_CLOAK, 1);
                    htmltext = "cloak_given.htm"; // New HTML for successful give
                }
                break;

            // ... (default case for weapons)
        }
        return htmltext;
    }

    @Override
    public String onTalk(Npc npc, Player player) {
        return getHtmlPath(player, npc);
    }

    @Override
    public String onFirstTalk(Npc npc, Player player) {
        return getHtmlPath(player, npc);
    }

    private String getHtmlPath(Player player, Npc npc) {
        if (!player.isHero()) {
            return "no_hero.htm"; // Generic "no hero" page
        }
        return "monument.htm"; // Main monument interaction page
    }

    // ... (main method)
}
Leave a Comment