Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Striker Fox2: download it
      Today at 03:26:06 AM
    • Zezuma09: how do i get this game started ?
      October 22, 2017, 03:24:27 AM
    • Striker Fox2: Much more on General Board
      October 21, 2017, 04:30:25 AM
    • Striker Fox2: New price guide link [link]
      October 21, 2017, 04:30:18 AM
    • Striker Fox2: New discord link [link]
      October 21, 2017, 04:30:03 AM
    • Saltyspade10: If you are new and reading this, stick around becaus it's a great server and community! Hope to see you in-game :)
      October 21, 2017, 02:44:16 AM
    • damian6: hello i wanne buy this server can u add me
      October 20, 2017, 03:54:38 PM
    • Wilkooo: lol jks
      October 20, 2017, 02:39:53 PM
    • Wilkooo: ilyall
      October 20, 2017, 02:39:48 PM
    • tm4dz: why cant i see any download links??
      October 20, 2017, 10:46:55 AM
    • stCky: u dont need to its fudgeing sick
      October 19, 2017, 08:13:13 PM
    • odin stormborn: how do i change my username
      October 19, 2017, 12:16:51 PM
    • qazplm102938: everyone play manicps its best server out there loads to do its badboyyyy - manicps manicps shout out kiteshield
      October 19, 2017, 10:28:21 AM
    • qazplm102938: everyone play manicps its best server out there loads to do its badboyyyy - manicps manicps
      October 19, 2017, 10:11:08 AM
    • Travas: wtf
      October 19, 2017, 07:37:52 AM
    • stCky: Adaro, you are a threat to the communities image, yes
      October 18, 2017, 02:53:43 PM
    • Krackkid: Hello everyone it is I, Krackkid.
      October 18, 2017, 07:21:56 AM
    • soma_: Does anyone have an updated link to a blank Source / Client? 317/508
      October 18, 2017, 04:57:44 AM
    • michaeltrailer: olm t pst
      October 18, 2017, 04:52:48 AM
    • Adaro: Strange that staff think I'm a threat when I'm not threatening anyone
      October 18, 2017, 03:07:16 AM

    Author Topic: New Level Interface  (Read 1723 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineWanted Mangija

    • Member
    • **
    • Posts: 6
    • Thanks: +0/-0
      • View Profile
    New Level Interface
    « on: January 10, 2015, 06:51:21 AM »
    This is the edited version I made:

    Code: [Select]
    package com.rs.game.player.dialogues;

    import java.util.HashMap;
    import java.util.Map;

    import com.rs.game.Graphics;
    import com.rs.game.World;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;

    public final class LevelUp extends Dialogue {

    public enum Configs {
    ATTACK(1, 0),
    STRENGTH(2, 2),
    DEFENCE(5, 1),
    HITPOINTS(6, 3),
    RANGE(3, 4),
    MAGIC(4, 6),
    PRAYER(7, 5),
    AGILITY(8, 16),
    HERBLORE(9, 15),
    THIEVING(10, 17),
    CRAFTING(11, 12),
    RUNECRAFTING(12, 20),
    MINING(13, 14),
    SMITHING(14, 13),
    FISHING(15, 10),
    COOKING(16, 7),
    FIREMAKING(17, 11),
    WOODCUTTING(18, 8),
    FLETCHING(19, 9),
    SLAYER(20, 18),
    FARMING(21, 19),
    CONSTRUCTION(22, 22),
    HUNTER(23, 21),
    SUMMONING(24, 23),
    DUNGEONEERING(25, 24);

    private int configId;
    private int skillId;

    private Configs(int configId, int skillId) {
    this.configId = configId;
    this.skillId = skillId;
    }

    public int getConfigId() {
    return configId;
    }

    private static Map<Integer, Configs> configs = new HashMap<Integer, Configs>();

    public static Configs levelup(int skill) {
    return configs.get(skill);
    }

    static {
    for (Configs config : Configs.values()) {
    configs.put(config.skillId, config);
    }
    }
    }

        public static final int[] SKILL_LEVEL_UP_MUSIC_EFFECTS = { 30, 38, 66, 48,
            58, 56, 52, 34, 70, 44, 42, 40, 36, 64, 54, 46, 28, 68, 61, 10, 60,
            50, 32, 301, 417 };

    private int skill;

    @Override
    public void start() {
    skill = (Integer) parameters[0];
    int level = player.getSkills().getLevelForXp(skill);
    player.getTemporaryAttributtes().put("leveledUp", skill);
    player.getTemporaryAttributtes().put("leveledUp[" + skill + "]",
    Boolean.TRUE);
    player.setNextGraphics(new Graphics(199));
    if (level == 99 || level == 120)
    player.setNextGraphics(new Graphics(1765));
    String name = Skills.SKILL_NAME[skill];
    player.getPackets().sendGameMessage("You've just advanced a" + (name.startsWith("A") ? "n" : "") + " " + name + " level! You are now level " + level + ".");
    player.getPackets().sendConfigByFile(4757, getIconValue(skill));
    player.getInterfaceManager().sendTab(player.getInterfaceManager().hasRezizableScreen() ?  10 : 1, 1216);
       Configs levelup = Configs.levelup(skill);
        player.getPackets().sendGlobalConfig(1756, levelup.getConfigId());
    switchFlash(player, skill, true);
    int musicEffect = SKILL_LEVEL_UP_MUSIC_EFFECTS[skill];
    if (musicEffect != -1)
    player.getPackets().sendMusicEffect(musicEffect);
    if (player.getRights() < 2 && (level == 99 || level == 120) && skill > 6 && skill != 23) {
    sendNews(player, skill, level);
    }
    }

    public static void sendNews(Player player, int skill, int level) {
    boolean reachedAll = true;
    for (int i = 0; i < Skills.SKILL_NAME.length; i++) {
    if (player.getSkills().getLevelForXp(i) < 99) {
    reachedAll = false;
    break;
    }
    }
    if(!reachedAll) {
    World.sendWorldMessage("<img=6><col=ff8c38>News: "+player.getDisplayName()+" has achieved "+level+" "+Skills.SKILL_NAME[skill]+".", true);
    return;
    }
    if(player.getSkills().getLevelForXp(Skills.DUNGEONEERING) == 120) {
    World.sendWorldMessage("<img=7><col=ff0000>News: "+player.getDisplayName()+" has been awarded the Completionist Cape!", true);
    return;
    }
    World.sendWorldMessage("<img=7><col=ff0000>News: "+player.getDisplayName()+" has just achieved at least level 99 in all skills!", true);
    }

    public static int getIconValue(int skill) {
    if (skill == Skills.ATTACK)
    return 1;
    if (skill == Skills.STRENGTH)
    return 2;
    if (skill == Skills.RANGE)
    return 3;
    if (skill == Skills.MAGIC)
    return 4;
    if (skill == Skills.DEFENCE)
    return 5;
    if (skill == Skills.HITPOINTS)
    return 6;
    if (skill == Skills.PRAYER)
    return 7;
    if (skill == Skills.AGILITY)
    return 8;
    if (skill == Skills.HERBLORE)
    return 9;
    if (skill == Skills.THIEVING)
    return 10;
    if (skill == Skills.CRAFTING)
    return 11;
    if (skill == Skills.RUNECRAFTING)
    return 12;
    if (skill == Skills.MINING)
    return 13;
    if (skill == Skills.SMITHING)
    return 14;
    if (skill == Skills.FISHING)
    return 15;
    if (skill == Skills.COOKING)
    return 16;
    if (skill == Skills.FIREMAKING)
    return 17;
    if (skill == Skills.WOODCUTTING)
    return 18;
    if (skill == Skills.FLETCHING)
    return 19;
    if (skill == Skills.SLAYER)
    return 20;
    if (skill == Skills.FARMING)
    return 21;
    if (skill == Skills.CONSTRUCTION)
    return 22;
    if (skill == Skills.SLAYER)
    return 23;
    if (skill == Skills.SUMMONING)
    return 24;
    return 25;
    }

    public static void switchFlash(Player player, int skill, boolean on) {
    int id;
    if (skill == Skills.ATTACK)
    id = 4732;
    else if (skill == Skills.STRENGTH)
    id = 4733;
    else if (skill == Skills.DEFENCE)
    id = 4734;
    else if (skill == Skills.RANGE)
    id = 4735;
    else if (skill == Skills.PRAYER)
    id = 4736;
    else if (skill == Skills.MAGIC)
    id = 4737;
    else if (skill == Skills.HITPOINTS)
    id = 4738;
    else if (skill == Skills.AGILITY)
    id = 4739;
    else if (skill == Skills.HERBLORE)
    id = 4740;
    else if (skill == Skills.THIEVING)
    id = 4741;
    else if (skill == Skills.CRAFTING)
    id = 4742;
    else if (skill == Skills.FLETCHING)
    id = 4743;
    else if (skill == Skills.MINING)
    id = 4744;
    else if (skill == Skills.SMITHING)
    id = 4745;
    else if (skill == Skills.FISHING)
    id = 4746;
    else if (skill == Skills.COOKING)
    id = 4747;
    else if (skill == Skills.FIREMAKING)
    id = 4748;
    else if (skill == Skills.WOODCUTTING)
    id = 4749;
    else if (skill == Skills.RUNECRAFTING)
    id = 4750;
    else if (skill == Skills.SLAYER)
    id = 4751;
    else if (skill == Skills.FARMING)
    id = 4752;
    else if (skill == Skills.CONSTRUCTION)
    id = 4753;
    else if (skill == Skills.HUNTER)
    id = 4754;
    else if (skill == Skills.SUMMONING)
    id = 4755;
    else
    id = 7756;
    player.getPackets().sendConfigByFile(id, on ? 1 : 0);
    }

    @Override
    public void run(int interfaceId, int componentId) {
    end();
    }

    @Override
    public void finish() {
    // player.getPackets().sendConfig(1179, SKILL_ICON[skill]); //removes
    // random flash
    }
    }

    WHAT'S NEW?
    + Fixed Fullscreen Problem.

    Offlineprorsps

    • First Time Poster
    • *
    • Posts: 2
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #1 on: January 10, 2015, 09:08:22 AM »
    This isn't a tutorial.

    OfflineWanted Mangija

    • Member
    • **
    • Posts: 6
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #2 on: January 10, 2015, 09:09:24 AM »
    I made the tutorial before, lol  :palm:

    Offlineprorsps

    • First Time Poster
    • *
    • Posts: 2
    • Thanks: +0/-0
      • View Profile

    OfflineWanted Mangija

    • Member
    • **
    • Posts: 6
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #4 on: January 10, 2015, 09:25:47 AM »
    ah phfudge.

    Offlineimthenull

    • Member
    • ****
    • Posts: 2,511
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #5 on: January 10, 2015, 09:39:59 AM »
    Your code is pretty bad. I don't know why everyone in the rs2 community thinks that they have to squeeze enumerations in wherever they can, it often results in ugly and just plain retarded code. Though you used a somewhat OOP design (by using an enumeration incorrectly), you still left huge blocks of comparison statements. You couldn't think of any better way to incorporate those checks elsewhere?

    OfflineWanted Mangija

    • Member
    • **
    • Posts: 6
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #6 on: January 10, 2015, 10:57:20 AM »
    Your code is pretty bad. I don't know why everyone in the rs2 community thinks that they have to squeeze enumerations in wherever they can, it often results in ugly and just plain retarded code. Though you used a somewhat OOP design (by using an enumeration incorrectly), you still left huge blocks of comparison statements. You couldn't think of any better way to incorporate those checks elsewhere?
    Yeah, there's a problem indeed.
    This is the problem:
    +XP magnets in front of interface but real RS +XP magnets behind the interface.
    the ....textbox there appears to freeze when you hold the hover long time.

    Offlineimthenull

    • Member
    • ****
    • Posts: 2,511
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #7 on: January 10, 2015, 05:27:08 PM »
    I'm speaking strictly about the appearance of the code - not the functionality.

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #8 on: January 10, 2015, 05:31:17 PM »
    Why does everyone use a Map when they use Enums? Is there really a performance gain by putting it into a map?

    Offlinejummppy

    • Member
    • ****
    • Posts: 254
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #9 on: February 01, 2015, 05:48:56 PM »
    I think an enum Map would be the only performance difference. I never put my enums in a map either. Don't see the point in doing it.

    OfflineHcoJustin

    • Member
    • ****
    • Posts: 2,400
    • Thanks: +0/-0
      • View Profile
    Re: New Level Interface
    « Reply #10 on: February 01, 2015, 08:48:57 PM »
    I don't know why everyone in the rs2 community thinks that they have to squeeze enumerations in wherever they can
    Think Javascript. It is the closest syntactic sugar we have for their form of anonymous(?) objects.
    Code: [Select]
    skills = {
        attack: { id: 0, configId: 1 },
        strength: { id: 1, configId: 2}
    };

    Why does everyone use a Map when they use Enums? Is there really a performance gain by putting it into a map?
    In this case OP was being retarded and used it wrong, although most people use it as a form of an associative array. It is the closest we can get to one in Java.

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal