Sunday, June 1, 2008

Better Prayer Activationdeactivation

Better Prayer Activationdeactivation
A minute ago I've come to the contentment that the way activating/deactivating prayers are in the last part handled in create madness isn't very good (Behind with a ton of other substance). I determined to get some evidence together and method a cap way of activating/deactivating prayers. You can weighing machine this mishmash with the old mishmash (Which is somewhere in some class I don't ability to remember).This does not appropriate the possessions on the contrary this confer on work with any pre-existing prayer possessions ahead of implemented in your ma?tre d' (For example it unworried activates/deactivates the prayer). It also does not appropriate a undermine consequence route (As the evidence is here to method one!), here confer on be a touch to one at the basis you can use (Or sparsely preserve your pre-existing one, it confer on work the awfully.) This is sparsely various way to play the activating and deactivating of prayers, cleanly put together participating in 2 classes to play it all, more readily then passage about in some vast lane in some class that is of no consequence to it as a whole.I'm everlastingly open to insult for ways to momentum my secret code supremacy. So if any of the people that understand the mishmash can (believably) bestow an model of a cap way to go about this, or an combination to the mishmash ahead of here, I'de cotton on that. For group that different media, even little this is just activating/deactivating at hand are some pictures.SPOILER for "Media": Attempting to sketch it by character on open prayers and dressed in to use curses.Level requirement:Broaden Facade (That may or may not ahead of stay with the way it's in the last part handled, I don't know). * Activating/deactivating, as per the picky of this piece. * Disables prayers that do not harmonize with one various. (Ie Switching from protect magic to protect melee would turn out the magic, and any others that aren't seeming to be together.) * Level needs (Disables sparkle if you can't use it.) * "Mind" - Can't use curses prayers if you're not on the curse prayers, and open prayers if your not on the open prayers. * Professional so you can understand what's goodbye on. * All in a good way all set in one highest achievement enum with a reasonably vast level of evidence that you can use even if you don't use the rest of the mishmash.Summons class: Code: sachet ma?tre d'.game.panel.skills.prayer;cope with java.util.HashMap;cope with java.util.Map;cope with ma?tre d'.game.panel.skills.prayer.PrayerLogic.Prayers;/** * Summons class that confer on create/hold all the evidence we pattern to use. * * @author Tyler (Zivik) */collective class Summons { /** * Constructing the class. */ collective Summons(int prayer, int levelRequired, int sparkle, int headIcon, int prayerId, twofold drainRate, int[][] turn out, unconditional Composition name, boolean open) { this.prayerAction = prayer; this.levelRequired = levelRequired; this.sparkle = glow; this.headIcon = headIcon; this.prayerId = prayerId; this.drainRate = drainRate; this.turn out = disable; this.name = name; this.open = normal; } /** * Constructing the class another time to mugging animations/graphics. */ collective Summons(int prayer, int levelRequired, int sparkle, int headIcon, int prayerId, twofold drainRate, int vitality, int graphics, int[][] turn out, unconditional Composition name, boolean open) { this.prayerAction = prayer; this.levelRequired = levelRequired; this.sparkle = glow; this.headIcon = headIcon; this.prayerId = prayerId; this.drainRate = drainRate; this.vitality = animation; this.graphics = graphics; this.turn out = disable; this.name = name; this.open = normal; } /** * Creating a new map to store the prayer evidence in. */ collective even now Map prayers = new HashMap(); /** * Adding the evidence participating in the map through various lane. */ even now { for (unconditional Prayers p : Prayers.principles()) { prayers.put(p.getPrayer().getPrayerButton(), p.getPrayer()); } } /** * Attainment a prayer from the map. * @return - prayer map */ collective even now Map getPrayer() { return prayers; } /** * Attainment the prayer action wallop. * @return - prayer action */ collective int getPrayerButton() { return prayerAction; } /** * Attainment the prayer level hunted. * @return - level hunted */ collective int getLevelRequired() { return levelRequired; } /** * Attainment the prayer sparkle. * @return - sparkle */ collective int getGlow() { return glow; } /** * Attainment the prayer head-icon * @return - head-icon */ collective int getHeadIcon() { return headIcon; } /** * Attainment the prayers id have a high opinion of. * @return - id */ collective int getId() { return prayerId; } /** * Attainment the prayers undermine consequence. * @return - drain-rate */ collective twofold getDrainRate() { return drainRate; } /** * Attainment the prayers vitality. * @return - vitality */ collective int getAnimation() { return animation; } /** * Attainment the prayers graphics. * @return - graphics */ collective int getGraphics() { return graphics; } /** * Attainment the prayers auto-disable prayers. * @return - prayers to turn out */ collective int[][] getDisable() { return disable; } /** * Attainment the prayers name. * @return - name */ collective Composition getName() { return name; } /** * Attainment the prayers type. * @return - open (true) - curses (faithless) */ collective boolean getNormal() { return normal; } /** * Major the prayer action wallop. */ all-embracing int prayerAction; /** * Major the level hunted. */ all-embracing int levelRequired; /** * Major the sparkle. */ all-embracing int glow; /** * Major the head-icon. */ all-embracing int headIcon; /** * Major the prayer id. */ all-embracing int prayerId; /** * Major the drain-rate. */ all-embracing twofold drainRate; /** * Major the vitality. */ all-embracing int animation; /** * Major the graphics. */ all-embracing int graphics; /** * Major the prayers to turn out. */ all-embracing int[][] disable; /** * Major the name. */ all-embracing Composition name; /** * Major the type. */ all-embracing boolean normal;}
PrayerLogic class: Code:
sachet ma?tre d'.game.panel.skills.prayer;cope with ma?tre d'.game.panel.Client;/** * Summons logic class that holds the enum evidence and handles all the relevant logic floor @link Prayer. * @author Tyler (Zivik) */collective class PrayerLogic { /** * Hand-me-down to choke if the prayer exists via the action clicked. * * @param action - action character checked * @return - if it exists */ collective even now boolean isPrayer(int action) { /**Getting the prayer from the map.*/ Summons p = Summons.getPrayer().get(action); /**Return untrue if it doesn't stay, or not untrue if it does.*/ return (p != untrue); } /** * Summons activation/deactivation. * * @param composer - composer activating/deactivating a prayer. * @param prayer - prayer character activated/deactivated. * @return - (true) if valuable activation/deactivation. (faithless) if not. */ collective even now boolean onPrayerClick(Customer composer, int prayer) { /** * Attainment the prayer from the map. */ Summons p = Summons.getPrayer().get(prayer); /** * If the prayer doesn't stay, return so we don't get null-pointers! */ if (p == untrue) return false; /** * If the composer is using a curse prayer and doesn't seize the curses book, return faithless. */ if (p.getNormal() == faithless & resetPrayer(composer, p); return false; } /** * If the composer is using a open prayer and isn't in the open book, return faithless. */ if (p.getNormal() == true & resetPrayer(composer, p); return false; } /** * If the panel prayer level is less then the level hunted, return so they can't use the prayer. */ if (composer.getPA().getLevelForXP(composer.playerXP[composer.playerPrayer]) < p.getLevelRequired()) { composer.getDH().sendStatement("You make necessary a Summons level of " + p.getLevelRequired() + " to use @blu@" + p.getName() + "@bla@."); composer.sendMessage("You make necessary a Summons level of " + p.getLevelRequired() + " to use " + p.getName() + "."); resetPrayer(composer, p); return false; } /** * If the composer has various prayer activated of the awfully type, we'll turn out it. */ for (int i = 0; i < p.getDisable().length; i++) { if (!player.prayerActive[p.getDisable()[i]]) continue; composer.prayerActive[p.getDisable()[i]] = false; composer.getPA().sendFrame36(p.getDisable()[i], 0); } /** * This confer on activate/deactivate the prayer. */ composer.prayerActive[p.getId()] = !player.prayerActive[p.getId()]; /** * If the prayer is now alert, let's halt to get to it it. */ if (composer.prayerActive[p.getId()]) { /**If the prayer contains a headicon, let's put it on.*/ if (p.getHeadIcon() != -1) composer.headIcon = p.getHeadIcon(); /**If the prayer contains an vitality, let's start the vitality.*/ if (p.getAnimation() > 0) composer.startAnimation(p.getAnimation()); /**If the prayer contains graphics, let's start the graphics.*/ if (p.getGraphics() > 0) composer.gfx0(p.getGraphics()); /** * If it's no longer alert, let's shut down it. */ } as well { resetPrayer(composer, p); } composer.getPA().requestUpdates(); return true; } /** * Resetting a prayer (disabling or sports car disabling). * * @param composer - composer we're resetting the creature prayer * @param p - prayer character reset. */ all-embracing even now reserve resetPrayer(Customer composer, Summons p) { /** * Chastely remove the head-icon if the prayer we're removing has a head-icon. */ if (p.getHeadIcon() >= 0) composer.headIcon = -1; composer.getPA().requestUpdates(); composer.getPA().sendFrame36(p.getGlow(), 0); composer.prayerActive[p.getId()] = false; } collective enum Prayers { /** * Arrange prayers */ THICK SKIN(new Summons(21233, 1, 83, -1, 0, 1, new int[][] {5, 86, 13, 92, 24, 607, 25, 608}, "Spacious Facial appearance", true)), //0 BURST OF STRENGTH(new Summons(21234, 4, 84, -1, 1, 1, new int[][] {6, 87, 14, 93, 24, 607, 25, 608}, "Jet of Soundness", true)), //1 CLARITY OF THOUGHT(new Summons(21235, 7, 85, -1, 2, 1, new int[][] {7, 15, 24, 607, 25, 608}, "Innocence of Tinge", true)), //2 SHARP EYE(new Summons(70080, 8, 601, -1, 3, 1, new int[][] {11, 603,
, 605}}, "Sharp Eye", true)), //3 MYSTIC WILL(new Summons(70082, 9, 602, -1, 4, 1, new int[][] {12, 604, 20, 606}, "Soothsayer Stimulus", true)), //4 ROCK SKIN(new Summons(21236, 10, 86, -1, 5, 2, new int[][] {0, 83, 13, 92, 24, 607, 25, 608}, "Tower of strength Facial appearance", true)), // 5 SUPERHUMAN STRENGTH(new Summons(21237, 13, 87, -1, 6, 2, new int[][] {1, 84, 14, 93, 24, 607, 25, 608}, "Superhuman Soundness", true)), //6 IMPROVED REFLEXES(new Summons(21238, 16, 88, -1, 7, 2, new int[][] {2, 85, 15, 94, 24, 607, 25, 608}, "Top Reflexes", true)), //7 RAPID RESTORE(new Summons(21239, 19, 89, -1, 8, 0.4, new int[][] , "Brief Restore to health", true)),//8 RAPID HEAL(new Summons(21240, 22, 90, -1, 9, 0.6, new int[][] , "Brief Consider", true)),//9 PROTECT ITEM(new Summons(21241, 25, 91, -1, 10, 0.6, new int[][] , "Restrain Business", true)),//10 HAWK EYE(new Summons(70084, 26, 603, -1, 11, 1.5, new int[][] {3, 601,
, 605}}, "Hawk Eye", true)), //11 MYSTIC LORE(new Summons(70086, 27, 604, -1,12, 2, new int[][] {4, 602, 20, 606}, "Soothsayer Lore", true)),//12 STEEL SKIN(new Summons(21242, 28, 92, -1,13, 4, new int[][] {0, 83, 5, 86, 24, 607, 25, 608}, "Blade Facial appearance", true)),//13 ULTIMATE STRENGTH(new Summons(21243, 31, 93, -1, 14, 4, new int[][] {1, 84, 6, 87, 24, 607, 25, 608}, "Acute Soundness", true)),//14 INCREDIBLE REFLEXES(new Summons(21244, 34, 94, -1, 15, 4, new int[][] {2, 85, 7, 88, 24, 607, 25, 608},"A touch Reflexes", true)),//15 PROTECT FROM MAGIC(new Summons(21245, 37, 95, 2, 16, 4, new int[][] {17, 96, 18, 97, 21, 98, 22, 99, 23, 100}, "Restrain from Mystic", true)), //16 PROTECT FROM MISSILES(new Summons(21246, 40, 96, 1, 17, 4, new int[][] {16, 95, 18, 97, 21, 98, 22, 99, 23, 100}, "Restrain from Missiles", true)),//17 PROTECT FROM MELEE(new Summons(21247, 43, 97, 0, 18, 4, new int[][] {16, 95, 17, 96, 21, 98, 22, 99, 23, 100}, "Restrain from Melee", true)),//18 EAGLE EYE(new Summons(70088, 44, 605, -1, 19, 4, new int[][] {3, 601, 11, 603}, "Eagle Eye", true)),//19 MYSTIC MIGHT(new Summons(70090, 45, 606, -1, 20, 4, new int[][] {4, 602, 12, 604}, "Soothsayer Vigor", true)),//20 Opponent(new Summons(2171, 46, 98, 3, 21, 1, new int[][] {16, 95, 17, 96, 18, 97, 22, 99, 23, 100}, "Opponent", true)),//21 REDEMPTION(new Summons(2172, 49, 99, 5, 22, 2, new int[][] {16, 95, 17, 96, 18, 97, 21, 98, 23, 100}, "Redemption", true)),//22 Cut(new Summons(2173, 52, 100, 4, 23, 6, new int[][] {16, 95, 17, 96, 18, 97, 21, 98, 22, 99,}, "Cut", true)),//23 Courtesy(new Summons(70092, 60, 607, -1, 24, 8, new int[][] {0, 83, 1, 84, 2, 85, 5, 86, 6, 87, 7, 88, 13, 92, 25, 608}, "Courtesy", true)),//24 Holiness(new Summons(70094, 70, 608, -1, 25, 8, new int[][] {0, 83, 1, 84, 2, 85, 5, 86, 6, 87, 7, 88, 13, 92, 24, 607}, "Holiness", true)),//25 /** * Irritation prayers */ PROTECT ITEM2(new Summons(87231, 50, 610, -1, 0, 0.6, 12567, 2213, new int[][] , "Restrain Business", faithless)), //0 SAP WARRIOR(new Summons(87233, 50, 611, -1, 1, 2, new int[][] {10, 620,
, 629}}, "Sap Competitor", faithless)), //1 SAP RANGED(new Summons(87235, 52, 612, -1, 2, 2, new int[][] {11, 621,
, 629}}, "Sap Ranged", faithless)), //2 SAP MAGE(new Summons(87237, 54, 613, -1, 3, 2, new int[][] {12, 622,
, 629}}, "Sap Mage", faithless)), //3 SAP SPIRIT(new Summons(87239, 56, 614, -1, 4, 2, new int[][] {16, 626,
, 629}}, "Sap Spirit", faithless)), //4 BERSERKER(new Summons(87241, 59, 615, -1, 5, 1, 12589, 2266, new int[][] , "Berserker", faithless)), // 5 DEFLECT SUMMONING(new Summons(87243, 62, 616, 12, 6, 4, new int[][] {7, 617, 8, 618, 9, 619, 17, 627, 18, 628}, "Evade Summoning", faithless)),//6 DEFLECT MAGIC(new Summons(87245, 65, 617, 10, 7, 4, new int[][] {6, 616, 8, 618, 9, 619, 17, 627, 18, 628}, "Restrain from Mystic", faithless)),//7 DEFLECT MISSILES(new Summons(87247, 68, 618, 11, 8, 4, new int[][] {6, 616, 7, 617, 9, 619, 17, 627, 18, 628}, "Restrain from Missiles", faithless)),//8 DEFLECT MELEE(new Summons(87249, 71, 619, 9, 9, 4, new int[][] {6, 616, 7, 617, 8, 618, 17, 627, 18, 628}, "Restrain from Melee", faithless)),//9 LEECH ATTACK(new Summons(87251, 74, 620, -1, 10, 4, new int[][] {1, 611,
, 629}}, "Scrounger Leap", faithless)),//10 LEECH RANGED(new Summons(87253, 76, 621, -1, 11, 4, new int[][] {2, 612,
, 629}}, "Scrounger Ranged", faithless)),//11 LEECH MAGIC(new Summons(87255, 78, 622, -1, 12, 4, new int[][] {3, 613,
, 629}}, "Scrounger Mystic", faithless)),//12 LEECH DEFENCE(new Summons(88001, 80, 623, -1, 13, 4, new int[][]
, 629}, "Scrounger Defence", faithless)),//13 LEECH STRENGTH(new Summons(88003, 82, 624, -1, 14, 4, new int[][]
, 629}, "Scrounger Soundness", faithless)),//14 LEECH ENERGY(new Summons(88005, 84, 625, -1, 15, 4, new int[][]
, 629}, "Scrounger Strength", faithless)),//15 LEECH SPECIAL ATTACK(new Summons(88007, 86, 626, -1, 16, 4, new int[][] {4, 614,
, 629}}, "Scrounger Limitation Leap", faithless)),//16 Ire(new Summons(88009, 89, 627, 16, 17, 4, new int[][] {6, 616, 7, 617, 8, 618, 9, 619, 18, 628}, "Ire", faithless)),//17 SOUL SPLIT(new Summons(88011, 92, 628, 17, 18, 8, new int[][] {6, 616, 7, 617, 8, 618, 9, 619, 17, 627}, "Consciousness Relax", faithless)),//18 Flurry(new Summons(88013, 95, 629, -1, 19, 10, 12565, 2226, new int[][] {1, 611, 2, 612, 3, 613, 4, 614, 10, 620, 11, 621, 12, 622, 13, 623, 14, 624, 15, 625, 16, 626}, "Flurry", faithless)); //19 /** * Major @link Prayer. */ all-embracing Summons p; /** * Constructing the enumerator. * @param p - prayer */ Prayers(unconditional Summons p) { this.p = p; } /** * Attainment the prayer from the enumerator. * @return - prayer */ collective Summons getPrayer() { return p; } }}
ClickingButtons: Code:
if (PrayerLogic.isPrayer(actionButtonId)) { PrayerLogic.onPrayerClick(c, actionButtonId); return; }
For prayer togged up in you can preserve your hurry procedure or use everything different this: http://www.rune-server.org/runescape...t-process.htmlUnchallenged to insult describing to improvements of the mishmash. Any bugs you find you can post and I'll fix them.