Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lunar Spells Enum

Featured Replies

well i finished it and decided to share because I'm  nice took like 20 mins to write this shit down!!!

    enum Spells {
        HomeTeleport("Lunar Home Teleport", 0, 16),
        BakePie("Bake Pie", 65, 15),
        CurePlant("Cure Plant", 66, 31),
        MonsterExamine("Monster Examine", 66, 6),
        NpcContact("NPC Contact", 67, 4),
        CureOther("Cure Other", 68, 1),
        Humidify("Humidify", 68, 7),
        MoonClanTeleport("Moonclan Teleport", 69,20),
        TeleGroupMoonclan("Tele Group Moonclan", 70, 32),
        CureMe("Cure Me", 71, 23),
        HunterKit("Hunter Kit", 71, 8),
        WaterbirthTeleport("Waterbirth Teleport", 72, 24),
        TeleGroupWaterbirth("Tele Group Waterbirth",73,33),
        CureGroup("Cure Group",74,3),
        StatSpy("Stat Spy",75,9),
        BarbarianTeleport("Barbarian Teleport",75,0),
        TeleGroupBarbarian("Tele Group Barbarian",76,34),
        SuperglassMake("Superglass Make",77,25),
        KhazardTeleport("Khazard Teleport",78,18),
        TeleGroupKhazard("Tele Group Khazard",79,35),
        Dream("Dream",79,10),
        StringJewellery("String Jewellery",80,22),
        StatRestorePotShare("Stat Restore Pot Share",81,27),
        MagicImbue("Magic Imbue",82,13),
        FertileSoil("Fertile Soil",83,2),
        BoostPotionShare("Boost Potion Share",84,26),
        FishingGuildTeleport("Fishing Guild Teleport",85,17),
        TeleGroupFishingGuild("Tele Group Fishing Guild",86,36),
        PlankMake("Plank Make",86,11),
        CatherbyTeleport("Catherby Teleport",87,21),
        TeleGroupCatherby("Tele Group Catherby",88,37),
        IcePlateauTeleport("Ice Plateau Teleport",89,28),
        TeleGroupIcePlateau("Tele Group Ice Plateau",90,38),
        EnergyTransfer("Energy Transfer",91,5),
        HealOther("Heal Other",92,29),
        VengeanceOther("Vengance Other",93,19),
        Vengance("Vengance",94,14),
        HealGroup("Heal Group",95,30),
        SpellbookSwap("Spellbook Swap",96,12);

        private final int level;
        private final int childid;
        private final String name;

        Spells(String name, int level, int childid) {
            this.name = name;
            this.level = level;
            this.childid = childid;
        }

        public String getName() {
            return name;
        }

        public int getLevel() {
            return level;
        }

        public int getChild() {
            return childid;
        }

        public int getParent() {
            return 430;
        }

    }

 

Enums suck. tongue.png gj though

 

how so?

 

 

Looks good. You could try adding in an id value as first argument so the enum can be easily used in combination with a comboBox.

good work looks nice happy.png

tho enum instances should be uppercase and separated by "_" underscore as they are static final

anyway you should override toString() to return the name rather than the instance name for those who will use this with ComboBox

 

 

Enums suck. tongue.png gj though

 

how so?

 

 

Looks good. You could try adding in an id value as first argument so the enum can be easily used in combination with a comboBox.

 

why isn't the name better? the users wont know what the id mean or did i misunderstood you?

 

 

Edited by Cyro

 

good work looks nice happy.png

tho enum instances should be uppercase and separated by "_" underscore as they are static final

anyway you should override toString() to return the name rather than the instance name for those who will use this with ComboBox

 

 

Enums suck. tongue.png gj though

 

how so?

 

 

Looks good. You could try adding in an id value as first argument so the enum can be easily used in combination with a comboBox.

 

why isn't the name better? the users wont know what the id mean or did i misunderstood you?

 

Yes, you misunderstood him.

Theese ID's he's talking about, is the ID's from the ComboBoxes from the Swing class (for generating GUI's).

I can't explain this much further, but I hope I helped.

You can still have the name.

enum Spells {
        HOMETELEPORT("Lunar Home Teleport", 0, 0, 16),
        BAKEPIE("Bake Pie", 1, 65, 15),
        CUREPLANT("Cure Plant", 2, 66, 31);

        private final String name;
        private final int comboBoxPos;
        private final int level;
        private final int childid;
        

        Spells(String name, int comboBoxPos, int level, int childid) {
            this.name = name;
            this.combo = comboBoxPos;
            this.level = level;
            this.childid = childid;
        }

        public String getName() {
            return name;
        }

        public int getLevel() {
            return level;
        }

        public int getChild() {
            return childid;
        }

        public int getParent() {
            return 430;
        }

    }

Something like that if I remember correct smile.png.

 

PS. Enums are written in case-letters :P. (I don't  know the right word here..)

Edited by Zuup

  • Author

Thanks guys i understand that there meant to be upper case like the oracle doc example "MONDAY","TUESDAY" etc just forgot

 

 

idk what you guy's are meaning by the id's as it's the interface child id and should be used in you're casting method as such

 

 

just a quick example i wrote up

    private void castSpell(Spells i) throws InterruptedException {
        if (!mageTabIsOpen()) {
            magicTab.open();
            sleep(300);
        } else if (mageTabIsOpen()) {
            if (client.getInterface(i.getParent()) != null) {
                RS2InterfaceChild s = client.getInterface(430).getChild(i.getChild());
                if (s.isVisible() && s != null) {
                    s.interact("Cast");
                    sleep(300);
                }
            }

        }
    }

 as you can see i used static sleeps as this is only an example but you see how it works

 

also with the name i thought you had to have the name to use the spell but you don't but you can use it like other people said for combo boxs etc really nice idea!

Nice job man. I sure will use this. 

 

tho enum instances should be uppercase and separated by "_" underscore as they are static final

 

You don't truly need to do that..... Honestly no one gives a shit about that

 

 

good work looks nice happy.png

tho enum instances should be uppercase and separated by "_" underscore as they are static final

anyway you should override toString() to return the name rather than the instance name for those who will use this with ComboBox

 

 

Enums suck. tongue.png gj though

 

how so?

 

 

Looks good. You could try adding in an id value as first argument so the enum can be easily used in combination with a comboBox.

 

why isn't the name better? the users wont know what the id mean or did i misunderstood you?

 

Yes, you misunderstood him.

Theese ID's he's talking about, is the ID's from the ComboBoxes from the Swing class (for generating GUI's).

I can't explain this much further, but I hope I helped.

You can still have the name.

enum Spells {
        HOMETELEPORT("Lunar Home Teleport", 0, 0, 16),
        BAKEPIE("Bake Pie", 1, 65, 15),
        CUREPLANT("Cure Plant", 2, 66, 31);

        private final String name;
        private final int comboBoxPos;
        private final int level;
        private final int childid;
        

        Spells(String name, int comboBoxPos, int level, int childid) {
            this.name = name;
            this.combo = comboBoxPos;
            this.level = level;
            this.childid = childid;
        }

        public String getName() {
            return name;
        }

        public int getLevel() {
            return level;
        }

        public int getChild() {
            return childid;
        }

        public int getParent() {
            return 430;
        }

    }

Something like that if I remember correct smile.png.

 

PS. Enums are written in case-letters tongue.png. (I don't  know the right word here..)

 

idk they way i do it is add the enum instances as items of the  combobox

JComboBox<Spells> combo = new JComboBox<Spells>(Spells.values());

and also there is Spells#BAKEPIE#ordinal(); which returns 1 (the position of the constant in the enum)

Nice job man. I sure will use this. 

 

tho enum instances should be uppercase and separated by "_" underscore as they are static final

 

You don't truly need to do that..... Honestly no one gives a shit about that

well it was just a tip idc really

and that wasnt the cause at one of the forums i posted a similar code contains enum and some things were off like conventions of the enum instances and people were annoying due to that

the instances of an enum must be all caps with underscores seperating words. Instances of an enum are public static final so that's why the naming convention applys. 

You should also show user how to use it with a jcombobox in a gui with action listener.

JComboBox<Spells> spell = new JComboBox<>(Spells.values())

addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        final Spells selected = (Spells) getSelectedItem();
        
    }
});
Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.