Thread: Implementation light snippets for elvarg.

Results 1 to 2 of 2
  1. #1 Implementation light snippets for elvarg. 
    Donator

    Join Date
    Feb 2017
    Posts
    99
    Thanks given
    0
    Thanks received
    10
    Rep Power
    36
    I decided a little while ago I want to do some work on RSPS servers specifically on the Elvarg base. I already created a couple snippets which I have pulled into this thread. Mods you can delete the old posts I left hyperlinks above them. I plan to post many more snippets here using this thread.

    Install guides for Elvarg servers are commented in the code itself.

    I'm currently working on : Binging league and second life.
    My current pace : Jumping ranks / Everyone thinks I'm someones alt.

    Spoiler for Toys:


    Spoiler for GFX Orb:

    Sooo in my old server I had an epic housing system that kinda blew jag out of the water TBH anyways you could build an obelisk that allowed you to play with graphics this thing spewed projectiles all over the place. It had different configurable patterns and settings that modified how it behaved. This is a smaller itemized version of that. Unfortunately it seems I have forgotten how to send a projectile from one tile to another so this uses still GFX.

    Features:
    - Dialogue based settings menu allowing you to change the GFX, range(How far from the player the gfx can spawn), and duration(A timer system sends the gfx's in waves about 2 seconds apart duration adds waves).
    - Item option allows players to open a website containing a GFX list.
    - Spam safety. The orb is instantiated and has a boolean preventing scripting from infinitely spawning graphics objects.

    Obvious potential improvements:
    - Add projectiles.
    - Add patterns of randomization.
    - Add an OPTION to toggle between still GFX and Projectiles.
    - Add speeds.
    - Add configurable gfx count with gfx max variable.

    Code:
    package com.elvarg.game.content.lazarus.item.toys;
    
    import com.elvarg.game.entity.impl.player.Player;
    import com.elvarg.game.model.Graphic;
    import com.elvarg.game.model.Position;
    import com.elvarg.game.model.dialogue.*;
    import com.elvarg.game.model.syntax.EnterSyntax;
    import com.elvarg.game.task.Task;
    import com.elvarg.game.task.TaskManager;
    
    import java.util.Random;
    
    /* @Author - xscapersps / lazarus */
    
    public class GFXOrb {
    
        /* Server Side - Player.Java
    
            private GFXOrb gfxOrb = new GFXOrb();
            public GFXOrb getGFXOrb() {
                return gfxOrb;
            }
         */
    
        /* Server Side - ItemActionPacketListener.java
    
            //These must be placed under the correct method.
    
            if(player.getGFXOrb().handleFirstOption(player, itemId))
    			return;
            if(player.getGFXOrb().handleSecondOption(player, itemId))
    			return;
    		if(player.getGFXOrb().handleThirdOption(player, itemId))
    			return;
         */
    
        /*  Server Side - EquipPacketListener.java
    
            Find:
            if(equipmentSlot == -1) {
    			Server.getLogger().info("Attempting to equip item "+item.getId()+" which has no defined equipment slot.");
    			return;
    		}
    
            Replace:
            if(equipmentSlot == -1) {
                if(player.getGFXOrb().handleFourthOption(player, item.getId()))
    				return;
    			Server.getLogger().info("Attempting to equip item "+item.getId()+" which has no defined equipment slot.");
    			return;
    		}
    
    		^^^ And never do that again. Actually you should fix that later but I'm to lazy right now.
         */
    
        /*  Client Sided - ItemDefinition.java
    
            case 14000:
    				ItemDefinition toClone = ItemDefinition.lookup(6635);
    				itemDef.inventory_model = toClone.inventory_model;
    				itemDef.model_zoom = toClone.model_zoom;
    				itemDef.name = "GFX Orb";
    				itemDef.actions = new String[] { "Options", "GFX List", "Check", "Cast", null};
    		break;
    
         */
    
        private static final int ORB_ID = 14000;
        private static final int GFX_COUNT = 5;
        private static final int MAX_RANGE = 5;
        private static final int MAX_DURATION = 5;
    
        private static final String GFX_LIST_URL = "https://everythingrs.com/tools/runescape/graphics";
    
        private int range = 5;
        private int gfxId = 280;
        private int duration = 3;
    
        private boolean active = false;
    
        public boolean handleFirstOption(Player player, int itemId) {
            if(itemId == ORB_ID) {
    
                final int[] player_choice = {-1};
    
                player.setDialogueOptions(new DialogueOptions() {
                    @Override
                    public void handleOption(Player player, int option) {
                        player_choice[0] = option;
                        player.getPacketSender().sendEnterAmountPrompt("Enter new value:");
                    }
                });
    
                player.setEnterSyntax(new EnterSyntax() {
                    @Override
                    public void handleSyntax(Player player, String input) {
    
                    }
    
                    @Override
                    public void handleSyntax(Player player, int input) {
                        if(input <= 0) {
                            return;
                        }
    
                        switch (player_choice[0]) {
                            case 1:
                                gfxId = input;
                                break;
                            case 2:
                                duration = Math.min(input, MAX_DURATION);
                                break;
                            case 3:
                                range = Math.min(input, MAX_RANGE);
                                break;
                        }
    
                        player.getPacketSender().sendMessage("Settings Updated! New Settings:");
                        player.getPacketSender().sendMessage(player.getGFXOrb().toString());
                        player.getPacketSender().sendInterfaceRemoval();
    
                    }
                });
    
                DialogueManager.start(player, new Dialogue() {
                    @Override
                    public DialogueType type() {
                        return DialogueType.OPTION;
                    }
    
                    @Override
                    public DialogueExpression animation() {
                        return DialogueExpression.DEFAULT;
                    }
    
                    @Override
                    public String[] dialogue() {
                        return new String[] {
                                "Set GFX", "Set Duration (Max " + String.valueOf(MAX_DURATION) + ")", "Set Range (Max " + String.valueOf(MAX_RANGE) + ")"
                        };
                    }
                });
                return true;
            }
            return false;
        }
    
        public boolean handleSecondOption(Player player, int itemId) {
    
            if(active)
                return itemId == ORB_ID;
    
            active = true;
    
            if(itemId == ORB_ID) {
                Position origin = player.getPosition();
    
                for (int d = 0; d < duration; d++) {
                    int finalD = d;
                    TaskManager.submit(new Task(2 * finalD + 2) {
                        @Override
                        protected void execute() {
                            for (int i = 0; i < GFX_COUNT; i++) {
                                Position next = randomize(origin);
                                player.getPacketSender().sendGlobalGraphic(new Graphic(gfxId), next);
                                if(finalD == duration - 1) {
                                    active = false;
                                }
                            }
                            stop();
                        }
                    });
                }
                return true;
            }
            return false;
        }
    
        public boolean handleThirdOption(Player player, int itemId) {
            if(itemId == ORB_ID) {
                player.getPacketSender().sendMessage(toString());
                return true;
            }
            return false;
        }
    
        public boolean handleFourthOption(Player player, int itemId) {
            if(itemId == ORB_ID) {
                player.setDialogueOptions(new DialogueOptions() {
                    @Override
                    public void handleOption(Player player, int option) {
                        if(option == 1) {
                            player.getPacketSender().sendURL(GFX_LIST_URL);
                        }
                        player.getPacketSender().sendInterfaceRemoval();
                    }
                });
                DialogueManager.start(player, new Dialogue() {
                    @Override
                    public DialogueType type() {
                        return DialogueType.OPTION;
                    }
    
                    @Override
                    public DialogueExpression animation() {
                        return DialogueExpression.DEFAULT;
                    }
    
                    @Override
                    public String[] dialogue() {
                        return new String[] {
                                "Confirm attempt to open external url.", "Nevermind."
                        };
                    }
                });
                player.getPacketSender().sendMessage("Attempting to open external url:");
                player.getPacketSender().sendMessage(GFX_LIST_URL);
                return true;
            }
            return false;
        }
    
        private Position randomize(Position origin) {
            final Random random = new Random();
            int xMod = random.nextInt(range);
            int yMod = random.nextInt(range);
    
            if(random.nextInt(2) == 1)
                xMod = -xMod;
    
            if(random.nextInt(2) == 1)
                yMod = -yMod;
    
            return new Position(origin.getX() + xMod, origin.getY() + yMod, origin.getZ());
        }
    
        @Override
        public String toString() {
            return "GFX = " + gfxId + ", Range = " + range + ", Count = " + GFX_COUNT + ", Duration = " + duration;
        }
    }


    [Only registered and activated users can see links. ]
    Spoiler for Beacon Ring: Perhaps the most obnoxious, ill-concieved, innacurate item ever:

    Well I set out to recreate the beacon ring which is used in the what lies below quest. You probably don't know or remember this but you used to be able to spam summon Zaff in the GE which was harmless but a ton of fun because people always freaked out. I wanted to recreate that... But failed miserably...

    Problems:
    - I can't remember the dialogues. D:
    - I don't even remember what exactly happened when you used the ring.
    - It has since changed.
    - Not tested with scripting auto clickers.

    To install: Place file in correct package, Open up item option handler or whatever the file that does that is called and add...

    Code:
    if(BeaconRing.handleRing(player, whatevertheitemidvariableis))
    return;
    ... To the third item option.

    Spoiler for Code:

    Code:
    package com.elvarg.game.model;
    
    import com.elvarg.game.World;
    import com.elvarg.game.entity.impl.npc.NPC;
    import com.elvarg.game.entity.impl.player.Player;
    import com.elvarg.game.task.Task;
    import com.elvarg.game.task.TaskManager;
    import com.elvarg.util.Misc;
    
    public class BeaconRing {
    
        private static final int BEACON_RING = 11014;
        private static final int GFX_ID = 110;
        private static final int NPC_ID = 532;
    
        private static final boolean zaffSpeaks = true;
        private static final boolean euroMode = false; //Because why not XD
    
        private static final String[] inLibraryDialogues = new String[2];
        private static final String[] outLibraryDialogues = new String[2];
    
        private static int zaffs = 0;
        private static final int MAX_ZAFFS = 10;
    
        static {
            inLibraryDialogues[0] = "Nice Library.";
            inLibraryDialogues[1] = "Bye Now.";
            outLibraryDialogues[0] = euroMode ? "Oi this ain't the bloody Varrock library mate why have ye summoned me?" : "This isn't the Varrock library why have you summoned me here?";
            outLibraryDialogues[1] = "Geologically challenged eh? I'll be on my way then...";
        }
    
        public static boolean handleRing(Player player, int itemId) {
            if(itemId == BEACON_RING) {
                summonZaff(player);
                return true;
            }
            return false;
        }
    
        private static void summonZaff(Player player) {
    
            if(zaffs >= MAX_ZAFFS)
                return;
    
            Position center = player.getPosition();
    
            int xMod = Misc.getRandom(5);
            int yMod = Misc.getRandom(5);
            boolean xModNegative = Misc.getRandom(2) == 1;
            boolean yModNegative = Misc.getRandom(2) == 1;
    
            Position target = new Position(center.getX() + (xModNegative ? -xMod : xMod), center.getY() + (yModNegative ? -yMod : yMod), center.getZ());
    
            NPC zaff = new NPC(NPC_ID, target);
            zaff.setPositionToFace(center);
            player.setPositionToFace(target);
    
            player.getPacketSender().sendGlobalGraphic(new Graphic(GFX_ID), target);
    
            TaskManager.submit(new Task(1, false) {
                @Override
                protected void execute() {
                    World.getAddNPCQueue().add(zaff);
                    zaffs++;
                    if(zaffSpeaks)
                        sendDialogues(zaff, inLibrary(center) ? inLibraryDialogues : outLibraryDialogues);
                    stop();
                }
            });
    
            TaskManager.submit(new Task(10, false) {
                @Override
                protected void execute() {
                    World.getRemoveNPCQueue().add(zaff);
                    zaffs--;
                    stop();
                }
            });
    
        }
    
        private static boolean inLibrary(Position center) {
            return center.getX() > 3206 && center.getY() < 3498 && center.getY() > 3489 && center.getX() < 3218;
        }
    
        private static void sendDialogues(NPC zaff, String[] dialogues) {
            zaff.forceChat(dialogues[0]);
            TaskManager.submit(new Task(5, false) {
                @Override
                protected void execute() {
                    zaff.forceChat(dialogues[1]);
                    stop();
                }
            });
        }
    
    }





    Spoiler for Game Objects:

    [Only registered and activated users can see links. ]
    Spoiler for Wardrobe: Drop-in configurable dialogue based robe set spawning object. :

    My code basically allows you to turn any object with a click option into a vending machine for robes. By default all canifis and gnome robes (basic colored robes with no stats or significant value) are enabled and free. To add or remove the robes or change their price simply edit the enum. The dialogues are built off the enum values and will update automatically. This was designed to be added to Elvarg servers with minimal effort just drag and drop the file into the correct package (or edit the package) and add these two lines of code to your object handler. Don't forget to change the objectId from -1. For more details and redundant details open the spoiler and read the comments I left in the file.

    Code:
    if(Wardrobe.handleObjectClick(player, object))
    return;
    Spoiler for Wardrobe.java:

    Code:
    package com.elvarg.game.model;
    
    import com.elvarg.game.entity.impl.object.GameObject;
    import com.elvarg.game.entity.impl.player.Player;
    import com.elvarg.game.model.dialogue.*;
    import com.elvarg.util.Misc;
    
    import java.util.ArrayList;
    import java.util.Optional;
    
    public class Wardrobe {
    
        /**
         *
         ** What is this?:
         *
         * When I made my server I had an idea to create an interface for a wardrobe which you allow players to change the colors of their robes for a small fee.
         * Well this is a far less fancy and uses dialogues to allow players to choose which robes they want to spawn.
         *
         **
         *
         * Features:
         * - Item sets can be turned on or off and automatically added or removed from the dialogue menu by means of boolean in the enum.
         * - Configurable buy price for each item set.
         * - Easy to add more item sets.
         * - Easy to install.
         *
         **
         *
         * Installing:
         * - This was developed for elvarg if you have another source and want to adapt it figure it out.
         * - Drop this file in Wardrobe.java at com.elvarg.game.model
         * - Stick the following code in your object handler packet:
         *
         *          if(Wardrobe.handleObjectClick(player, object))
         * 					return;
         *
         * - The wardrobe is currently set to the edgeville bank booth ids. You may wish to change this.
         *
         **
         *
         * Why is my code so hideously cringy?:
         * - I'm a hobbyist. Not a pro.
         * - It was designed for light weight plug and play.
         * - I habitually overcomplicate my life.
         * - I wanted it fast and dirty.
         * - Rewrite it yourself if you care to.
         *
         **
         */
    
        /** Custom Settings **/
        //For sets without gloves hats or boots (-1 in the enum) add these
        //Default: Gloves: (False, Leather Gloves), Boots: (False, Leather Boots), Hat: (False, Unspecified)
        private final boolean enAddGloves = false;
        private final int addGloveId = 1059;
        private final boolean enAddBoots = false;
        private final int addBootId = 1061;
        private final boolean enAddHat = false;
        private final int addHatId = -1;
    
        //Wardrobe Settings
        private static final int wardrobeId = 6943;
        private static final boolean checkPosition = false;
        private static final Position[] wardrobePositions = new Position[] {
            //If you want only certain wardrobes in certain locations to function place their positions here and turn checkPosition to true.
        };
    
        //Financial Settings
        //The point at which the player is shown a confirmation dialogue before being allowed to purchase.
        private static final int purchaseWarningThreshold = 25_000;
    
        //Message Settings
        private final boolean sendBlankSetMsg = true;
        private final String blankSetMsg = "More sets coming soon.";
    
        //If enabled will give wizard boots with the wizard sets. Warning: Could break economy. May wanna look into that first.
        private final boolean giveWizardBoots = false;
    
        /**
         * The boolean value determines if the set shows up in the dialogue.
         * The integers are hat, top, bottom, gloves, boots respectively.
         * The last value is the price. 0 = free.
         */
        private enum WardrobeData {
    
            GNOME_PINK(656, 646, 636, -1, 626, true, 0),
            GNOME_GREEN(658, 648, 638, -1, 628, true, 0),
            GNOME_BLUE(660, 650, 640, -1, 630, true, 0),
            GNOME_CREAM(662, 652, 642, -1, 632, true, 0),
            GNOME_TURQUOISE(664, 654, 644, -1, 634, true, 0),
    
            CANIFIS_GREY(2900, 2896, 2898, 2902, 2894, true, 0),
            CANIFIS_RED(2910, 2906, 2908, 2912, 2904, true, 0),
            CANIFIS_YELLOW(2920, 2916, 2918, 2922, 2914, true, 0),
            CANIFIS_TEAL(2930, 2926, 2928, 2932, 2924, true, 0),
            CANIFIS_PURPLE(2940, 2936, 2938, 2942, 2934, true, 0),
    
            BLUE_WIZARD(579, 577, 1011, -1, 2579, false, 0),
            BLUE_WIZARD_T(7396, 7392, 7388, -1, 2579, false, 0),
            BLUE_WIZARD_G(7394, 7390, 7386, -1, 2579, false, 0),
    
            BLACK_WIZARD_T(12455, 12451, 12447, -1, -1, false, 0),
            BLACK_WIZARD_G(12453, 12449, 12445, -1, -1, false, 0),
    
            MONK(-1, 544, 542, -1, -1, false, 0),
            MONK_G(-1, 20199, 20202, -1, -1, false, 0),
    
            PRIEST(-1, 428, 426, -1, -1, false, 0),
            SHADE(-1, 546, 548, -1, -1, false, 0),
            DRUID(-1, 540, 538, -1, -1, false, 0),
    
            ARMADYL(-1, 12253, 12255, -1, -1, false, 0),
            GUTHIX(-1, 10462, 10466, -1, -1, false, 0),
            SARADOMIN(-1, 10458, 10464, -1, -1, false, 0),
            ZAMORAK(-1, 10786, 10468, -1, -1, false, 0);
    
            private int hatId;
            private int topId;
            private int bottomsId;
            private int glovesId;
            private int bootsId;
            private boolean isActive;
            private int price;
    
            WardrobeData(int hatId, int topId, int bottomsId, int glovesId, int bootsId, boolean isActive, int price) {
                this.hatId = hatId;
                this.topId = topId;
                this.bottomsId = bottomsId;
                this.glovesId = glovesId;
                this.bootsId = bootsId;
                this.isActive = isActive;
                this.price = price;
            }
    
        }
    
        /**
         * End Custom Settings everything beyond this point is necessary for script no touchy!
         * **/
        private static final Dialogue[] dialogues = new Dialogue[getActiveSets() / 4 + 1];
        private static int optionPage = 1;
    
        static {
            for (int i = 0; i < dialogues.length; i++) {
                dialogues[i] = createDialogue(i * 4);
            }
        }
    
        private static int getActiveSets() {
            int active = 0;
            for (WardrobeData value : WardrobeData.values()) {
                if(value.isActive)
                    active++;
            }
            return active;
        }
    
        public static boolean handleObjectClick(Player player, Optional<GameObject> object) {
            GameObject obj = object.get();
            if(obj.getId() == wardrobeId) {
                if(checkPosition) {
                    for (Position wardrobePosition : wardrobePositions) {
                        if(wardrobePosition.equals(obj.getPosition())) {
                            new Wardrobe().openMenu(player);
                            return true;
                        }
                    }
                    return false;
                }
                new Wardrobe().openMenu(player);
                return true;
            }
            return false;
        }
    
        private void openMenu(Player player) {
            setOptionHandler(player);
            openDialogueByLastOption(player, 0);
        }
    
        private void setOptionHandler(Player player) {
            optionPage = 1;
            player.setDialogueOptions(new DialogueOptions() {
                @Override
                public void handleOption(Player player, int option) {
                    String playerSelection = player.getDialogue().dialogue()[option - 1];
                    if(playerSelection.equalsIgnoreCase("Next")) {
                        openDialogueByLastOption(player, (option - 1) * optionPage++);
                    } else {
                        if(!playerSelection.equalsIgnoreCase("---")) {
                            for (WardrobeData value : WardrobeData.values()) {
                                if(value.toString().equalsIgnoreCase(playerSelection.toUpperCase().replace(" (" + Misc.insertCommasToNumber(String.valueOf(value.price)) + ")", "").replace(" ", "_"))) {
                                    if(value.price > purchaseWarningThreshold) {
                                        confirmAdd(player, value);
                                    } else {
                                        addItems(player, value);
                                        player.getPacketSender().sendInterfaceRemoval();
                                    }
                                }
                            }
                        } else if(sendBlankSetMsg) {
                            player.getPacketSender().sendMessage(blankSetMsg);
                            player.getPacketSender().sendInterfaceRemoval();
                        }
                    }
                }
            });
        }
    
        private void confirmAdd(Player player, WardrobeData value) {
            player.setDialogueOptions(new DialogueOptions() {
                @Override
                public void handleOption(Player player, int option) {
                    switch (option) {
                        case 1:
                            if(player.getInventory().contains(new Item(995, value.price))) {
                                player.getPacketSender().sendInterfaceRemoval();
                                player.getInventory().delete(995, value.price);
                                addItems(player, value);
                            } else {
                                player.getPacketSender().sendMessage("You don't have enough gold in your inventory to purchase the robes.");
                                player.getPacketSender().sendInterfaceRemoval();
                            }
                            break;
                        case 2:
                            player.getPacketSender().sendInterfaceRemoval();
                            break;
                    }
                }
            });
            DialogueManager.start(player, new Dialogue() {
                @Override
                public DialogueType type() {
                    return DialogueType.OPTION;
                }
    
                @Override
                public DialogueExpression animation() {
                    return DialogueExpression.DEFAULT;
                }
    
                @Override
                public String[] dialogue() {
                    return new String[] {
                            "Confirm Purchase ("+Misc.insertCommasToNumber(String.valueOf(value.price))+")", "Nevermind",
                    };
                }
            });
        }
    
        private static Dialogue createDialogue(int lastOptionClicked) {
            return new Dialogue() {
                @Override
                public DialogueType type() {
                    return DialogueType.OPTION;
                }
    
                @Override
                public DialogueExpression animation() {
                    return DialogueExpression.DEFAULT;
                }
    
                @Override
                public String[] dialogue() {
                    return refineDialogueOptionsForPage(lastOptionClicked);
                }
            };
        }
    
        private void openDialogueByLastOption(Player player, int lastOptionClicked) {
            int toOpen = lastOptionClicked / 4;
            if(dialogues.length > toOpen)
                DialogueManager.start(player, dialogues[toOpen]);
        }
    
        /** Uses the last option clicked to determine what should be on the next page of options. **/
        private static String[] refineDialogueOptionsForPage(int lastOptionClicked) {
            ArrayList<String> options = buildAllDialogueOptionsFromEnum();
            ArrayList<String> smallOptions = new ArrayList<>();
    
            for (int i = 0; i < 4; i++) {
                smallOptions.add(i, "---");
                int index = (lastOptionClicked == 0 ? i : lastOptionClicked + i);
                if(options.size() > index) {
                    smallOptions.set(i, options.get(index));
                }
            }
    
            return new String[] {
                    smallOptions.get(0), smallOptions.get(1), smallOptions.get(2), smallOptions.get(3), "Next"
            };
        }
    
        private void addItems(Player player, WardrobeData data) {
            int reqSlots = getRequiredSlots(data);
            boolean playerHasSpace = player.getInventory().getFreeSlots() > reqSlots;
            if(playerHasSpace) {
                if(setHasHat(data)) {
                    int hatId = data.hatId == -1 ? addHatId : data.hatId;
                    player.getInventory().add(hatId, 1);
                }
                if(setHasTop(data))
                    player.getInventory().add(data.topId, 1);
                if(setHasBottoms(data))
                    player.getInventory().add(data.bottomsId, 1);
                if(setHasGloves(data)) {
                    int glovesId = data.glovesId == -1 ? addGloveId : data.glovesId;
                    player.getInventory().add(glovesId, 1);
                }
                if(setHasBoots(data)) {
                    int bootsId = data.bootsId == -1 ? addBootId : data.bootsId;
                    if(data.bootsId == 2579 && giveWizardBoots) {
                        player.getInventory().add(bootsId, 1);
                    } else if(data.bootsId != 2579) {
                        player.getInventory().add(bootsId, 1);
                    }
                }
            } else {
                player.getPacketSender().sendMessage("You don't have enough space for this item set. Required spaces: " + reqSlots + ".");
            }
        }
    
        private boolean setHasBoots(WardrobeData data) {
            return data.bootsId > -1 || enAddBoots;
        }
    
        private boolean setHasGloves(WardrobeData data) {
            return data.glovesId > -1 || enAddGloves;
        }
    
        private boolean setHasBottoms(WardrobeData data) {
            return data.bottomsId > -1;
        }
    
        private boolean setHasTop(WardrobeData data) {
            return data.topId > -1;
        }
    
        private boolean setHasHat(WardrobeData data) {
            return data.hatId > -1 || enAddHat;
        }
    
        /** Calculates the amount of space required for the set. **/
        private int getRequiredSlots(WardrobeData data) {
            int slots = 0;
            if(setHasHat(data))
                slots++;
            if(setHasTop(data))
                slots++;
            if(setHasBottoms(data))
                slots++;
            if(setHasGloves(data))
                slots++;
            if(setHasBoots(data))
                slots++;
            return slots;
        }
    
        private static ArrayList<String> buildAllDialogueOptionsFromEnum() {
            ArrayList<String> strings = new ArrayList<>();
            for (WardrobeData value : WardrobeData.values())
                if(value.isActive)
                    strings.add(value.toString().toLowerCase().replace("_", " ") + " (" + Misc.insertCommasToNumber(String.valueOf(value.price)) + ")");
            return strings;
        }
    
    }



    Last edited by XScapeRsps; 02-27-2019 at 05:05 PM.
    Reply With Quote  
     

  2. #2  
    Registered Member Vito the Don's Avatar
    Join Date
    Feb 2019
    Age
    21
    Posts
    75
    Thanks given
    6
    Thanks received
    4
    Rep Power
    62
    Thanks for the contributions
    The Dons
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 75
    Last Post: 08-03-2011, 12:30 AM
  2. Pk Shop Snippet for Emulous
    By addinol in forum Help
    Replies: 2
    Last Post: 04-08-2010, 02:58 PM
  3. Replies: 3
    Last Post: 01-07-2010, 12:52 AM
  4. PK SHop Snippet for Emulous
    By addinol in forum Help
    Replies: 15
    Last Post: 12-28-2009, 11:59 PM
  5. my light saber for cerbrus
    By Grep in forum Showcase
    Replies: 4
    Last Post: 11-06-2008, 07:54 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •