Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users

    Recommended Posts

    Posted

    How should i approach this? do i really just have to get the attacking players equipment and then match the equipped weapon against list of known pvp weapons and handle prayers accordingly or is there another more robust method? somehow determining what type of weapon the attacker is wielding like range, mage, melee etc would be huge help

    Posted

    The first one. Get the list of the attacking player's equipment and use some kind of matrix or something to determine what style that weapon correlates with

    Posted
    39 minutes ago, Diggington said:

    The first one. Get the list of the attacking player's equipment and use some kind of matrix or something to determine what style that weapon correlates with

    ugh that is a lot of work and there will be a lot of edge cases due to it being pretty hard to predict every single item pkers would be wearing but i guess if that is the only way... maybe i can find some premade id lists somewhere if im lucky.

    Posted

    incase anyone else was looking for something like this i found this from some pvp plugins github page, seems to be pretty accurate from a quick glance, just missing some newer weapons like voidwaker etc.

     

        private static final String[] meleeWeaponNames = {
            "sword",
            "scimitar",
            "dagger",
            "spear",
            "mace",
            "axe",
            "whip",
            "tentacle",
            "-ket-",
            "-xil-",
            "warhammer",
            "halberd",
            "claws",
            "hasta",
            "scythe",
            "maul",
            "anchor",
            "sabre",
            "excalibur",
            "machete",
            "dragon hunter lance",
            "event rpg",
            "silverlight",
            "darklight",
            "arclight",
            "flail",
            "granite hammer",
            "rapier",
            "bulwark"
        };
    
        private static final String[] rangedWeaponNames = {
            "bow",
            "blowpipe",
            "xil-ul",
            "knife",
            "dart",
            "thrownaxe",
            "chinchompa",
            "ballista"
        };
    
        private static final String[] magicWeaponNames = {
            "staff",
            "trident",
            "wand"
        };

     

    • 2 weeks later...
    Posted

    What I would do is get the item IDs of each weapon style melee, ranged and magic and sort them into an array. Then use binarySearch to check if the opponents weapon slot equipment is included in one of the arrays. Next I would check the distance of the opponent from myself to determine if he is not staff bashing or casting a spell. Pour this into a separate thread which calls every 600ms (1 tick) and change a variable concurrently using AtomicReference in the main thread for thread safety to grab whichever attack style the opponent is using. You would only do this for the character interacting with yourself through Players.getLocal().getCharacterInteractingWithMe()

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.