ValacialX/Vencillio: Help with teleports interface. Crashes other players but no PCs on LAN have an issue

 
Dec 4, 2011
300
3
0
This will freeze other players clients that are connecting from outside ip's, but it won't freeze localhost or another pc connecting from LAN. Absolutely confused.

Client Side:
Spoiler for Client:

Java:
    public static void teleportInterfaceNew(TextDrawingArea[] tda) {
        RSInterface tab = addInterface(45800);
        addSpriteLoader(45801, 1250);
        addPet(45802,100);

        addText(45803, "", tda, 2, 0xffbf59, false, true);
        addText(45804, "@whi@Target", tda, 2, 0xffbf59, false, true);
        addText(45805, "@whi@Drops", tda, 2, 0xffbf59, false, true);
        addText(45806, "@whi@Information", tda, 2, 0xffbf59, false, true);
        addText(45807, "@whi@Attack with:", tda, 1, 0xed9507, false, true);
        addText(45808, "Hp:", tda, 1, 0xed9507, false, true);
        addText(45809, "@whi@Maxhit:", tda, 1, 0xed9507, false, true);
        addText(45810, "Tier:", tda, 1, 0xffbf59, true, true);
        addText(45843, "@whi@-@mag@Hop in@whi@-", tda, 1, 0xed9507, false, true);

        addText(45836, "@whi@Monsters", tda, 2, 0xed9507, false, true);
        addText(45837, "@whi@Bosses", tda, 2, 0xed9507, false, true);
        addText(45838, "@whi@Extras", tda, 2, 0xed9507, false, true);
        addText(45839, "@whi@Global", tda, 2, 0xed9507, false, true);
        addText(45935, "@whi@Top Bosses", tda, 2, 0xed9507, false, true);

        addText(45840, "Maxhit", tda, 1, 0xed9507, false, true);
        addText(45841, "Players here", tda, 1, 0xed9507, false, true);
        addText(45934, "@whi@~@mag@Void@whi@~", tda, 2, 0xed9507, true, true);


        int interfaceId = 45811;
        for (int i = 0; i < 5; i++) {
            int interfaceId2 = interfaceId + 1;
            int interfaceId3 = interfaceId + 2;
            addHoverButtonWSpriteLoader(interfaceId, 1248, 88, 24, "Add", -1, interfaceId2, 1);
            addHoveredSpriteLoaderButton(interfaceId2, 88, 24, interfaceId3, 1248);

            interfaceId += 3;
        }

        addHoverButtonWSpriteLoader(45830, 1020, 21, 21, "Add", -1, 45831, 3);
        addHoveredSpriteLoaderButton(45831, 21, 21, 45832, 1021);

        addHoverButtonWSpriteLoader(45833, 1249, 151, 29, "Add", -1, 45834, 1);
        addHoveredSpriteLoaderButton(45834, 151, 29, 45835, 1249);

        tab.totalChildren(35);

        tab.child(0, 45801, 5, 5);
        tab.child(1, 45900, 12, 86);
        tab.child(2, 45802, 190, 135);
        tab.child(3, 45803, 50, 67);
        tab.child(4, 45804, 205, 68);
        tab.child(5, 45805, 390, 68);
        tab.child(6, 45806, 205, 240);
        tab.child(7, 45807, 175, 263);
        tab.child(8, 45808, 175, 263 + 13);
        tab.child(9, 45809, 175, 263 + 14 + 13);
        tab.child(10, 45810, 403, 245);

        int tabId = 11;
        interfaceId = 45811;
        int x = 0;
        for (int i = 0; i < 5; i++) {
            tab.child(tabId, interfaceId, 14 + x, 40);
            tabId++;
            interfaceId++;
            tab.child(tabId, interfaceId, 14 + x, 32);
            interfaceId += 2;
            tabId++;
            x += 93;
        }

        tab.child(21, 45830, 475, 12);
        tab.child(22, 45831, 475, 12);
        tab.child(23, 45833, 355, 205);
        tab.child(24, 45834, 355, 205);

            tab.child(25, 45836, 20, 44);
            tab.child(26, 45837, 20+93, 44);
            tab.child(27, 45838, 20+93+93, 44);
            tab.child(28, 45839, 20+93+93+93, 44);
            tab.child(29, 45935, 20+93+93+93+93, 44);

        tab.child(30, 45843, 338 + 20 + 20 + 20, 85 + 20 + 20 + 20 + 20 + 40 + 5 + 1);
        tab.child(31, 45700, 347, 83);


        tab.child(31, 45840, 338 + 20 + 20, 263);
        tab.child(32, 45841, 338 + 20 + 20, 263 + 13);
        tab.child(33,45934,268-10,16-3);
        tab.child(34,45500,351,90);

        RSInterface items = addInterface(45700);
        items.height = 120;
        items.width = 342;


        int child = 45701;
        for (int k = 0; k < 50; k++) {
            addItemOnInterface(child, 45700, new String[]{null, null});
            child++;
        }

        child = 45701;
        items.totalChildren(50);
        x = 0;
        int y = 0;

        for (int i = 0; i < 50; i++) {
            items.child(i, child, 15 + x, 10 + y);
            child++;
            x += 42;
            if (i == 2 || i == 5) {
                x = 0;
                y += 40;
            }
        }


        RSInterface test = addInterface(45900);
        test.scrollMax = 250;
        test.height = 218;
        test.width = 135;

        int childId = 45901;

        for (int i = 0; i < 15; i++) {
            addHoverButtonWSpriteLoader(childId++, 1244, 151, 20, "@gre@Teleport", -1, -1, 1);
            addHoverButtonWSpriteLoader(childId++, 1245, 151, 20, "@gre@Teleport", -1, -1, 1);

        }

        //this bugs out
        childId = 45962;
        for (int j = 0; j < 30; j++) {
            addText(childId++, "", tda, 1, 0xed9507, false, true);

        }


        test.totalChildren(60);
        y = 0;
        for (int j = 0; j < 30; j++) {
            test.child(j, 45901 + j, 5, 3 + y);
            y += 20;
        }
        y = 5;
        for (int j = 30; j < 60; j++) {
            test.child(j, 45932 + j, 10, y);
            y += 20;
        }


        RSInterface scroll2 = addInterface(45500);
        scroll2.scrollMax = 200;
        scroll2.height = 113;
        scroll2.width = 120;

        addToItemGroup(45501, 3, 30, 8, 8, true, null, null, null);

        scroll2.totalChildren(1);
        scroll2.child(0,45501,6,3);


    }


Server Side:
Spoiler for Server:

Java:
public static void buildInterface(int index, Player player, int tier) {
    int childId = 45701;

    for (int i = 0; i < 9; i++) {
        player.getPacketSender().sendItemOnInterface(childId, 0, 0);
        childId++;
    }

    player.teleportIndex = index;
    TeleportEnum teleport = player.teleports.get(index);
    NpcDefinition npcdef = NpcDefinition.forId(teleport.getNpcId());
        player.getPacketSender().sendNpcHeadOnInterface(teleport.getNpcId(), 0);

    for (int i = 0; i < 90; ++i) {
        player.getPacketSender().sendItemOnInterface(45501,-1,i,0);

    }
   // System.out.println("Teleport: " + teleport.getNpcId());
    //System.out.println("For Id:" +NPCDrops.forId(teleport.getNpcId()));
   // System.out.println("Drop list: " + NPCDrops.forId(teleport.getNpcId()).getDropList());
    if(NPCDrops.forId(teleport.getNpcId()) != null && NPCDrops.forId(teleport.getNpcId()).getDropList() != null) {
    //if(NPCDrops.forId(teleport.getNpcId()).getDropList() != null) {
        for (int i = 0; i < NPCDrops.forId(teleport.getNpcId()).getDropList().length; ++i) {
           //im sure it deosnt suppose to work like that :?
            player.getPacketSender().sendItemOnInterface(45501, NPCDrops.forId(teleport.getNpcId()).getDropList()[i].getId(), i, NPCDrops.forId(teleport.getNpcId()).getDropList()[i].getItem().getAmount());

        }
    }


    player.getPacketSender().sendString(45803, "" + getTitle(player.tier));

    player.getPacketSender().sendString(45807, "@whi@Attacks With: " + teleport.getAttackWith());
    player.getPacketSender().sendString(45808, "@whi@Weakness: " + teleport.getWeakness());
    player.getPacketSender().sendString(45809, "@whi@Health: " + (npcdef.getHitpoints()));///10
    player.getPacketSender().sendString(45810, ""+teleport.getDifficulty());
    player.getPacketSender().sendString(45840, "@whi@Maxhit: "+npcdef.getMaxHit());
    player.getPacketSender().sendString(45841, "@whi@Players here: "+ getPlayersInLocation(index,tier));
    //player.getPacketSender().sendString(45843, "Difficulty: " + teleport.getDifficulty());

    childId = 45701;
    if (NPCDrops.forId(teleport.getNpcId()) != null) {
        if (NPCDrops.forId(teleport.getNpcId()).getDropList().length > 0) {
            if(NPCDrops.forId(teleport.getNpcId()).getDropList().length < 9) {
                for (int i = 0; i < NPCDrops.forId(teleport.getNpcId()).getDropList().length; i++) {

                    player.getPacketSender().sendItemOnInterface(childId, NPCDrops.forId(teleport.getNpcId()).getDropList()[i].getId(), NPCDrops.forId(teleport.getNpcId()).getDropList()[i].getItem().getAmount());
                    childId++;
                }
            } else {
                for (int i = 0; i < 9; i++) {

                    player.getPacketSender().sendItemOnInterface(childId, NPCDrops.forId(teleport.getNpcId()).getDropList()[8-i].getId(), NPCDrops.forId(teleport.getNpcId()).getDropList()[8-i].getItem().getAmount());
                    childId++;
                }
            }
        }

    }
}
[/SPOILER]

I'm not getting any errors when this happens or I might be able to solve it
 
Last edited:
Is the freezing happening once they player is loaded into the game or when they click on the interface?

I would put an exception catch at the point the interface is loaded into the tablist to see if some kind of error is printed out.
If the client is freezing there is an error to go along with it. If no error appears i would add once at the end of each method until it shows up.
I want to assume there some packet that is getting messed up.

Code:
catch(Exception e) {
e.printStackTrace();
}
 

Users who are viewing this thread (total: 1, members: 0, guests: 1)

Who read this thread (total members: 6)