Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Perfect World
You last visited: Today at 08:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



PWI Java API

Discussion on PWI Java API within the Perfect World forum part of the MMORPGs category.

Reply
 
Old 08/06/2013, 18:55   #16
 
elite*gold: 0
Join Date: Jul 2013
Posts: 10
Received Thanks: 2
Quote:
Originally Posted by Interest07 View Post
I love open source development (when it comes to external 'tools' for games) and I still wish you the best of luck with your botting business, nothing strange about it

I'm also not a very big fan of Java, but unless you run 30+ bots, I doubt the language of choice will matter much, assuming you're not looking for 1ms response times in decision taking by bots.

My C# bot would require pretty much 0% CPU running 4 simultaneous clients and it was at no point coded for efficiency, I'd imagine Java would have no trouble reaching pretty much the same.
I believe what should be a bigger performance concern is that I am bringing all the functionality up to JavaScript

But if you ask me, I claim it's too insignificant and my time or user's time spent coding is
nb-ben is offline  
Old 08/06/2013, 19:52   #17
 
elite*gold: 10
Join Date: Sep 2010
Posts: 400
Received Thanks: 234
Yeah, kinda glossed over the Javascript part... Should be fun making that cross-browser compatible lmao. Are you a *********?

I used to do quite a bit of web dev, mostly php and js, but I started to lose interest in js in the end because M$ kept making new fricking browsers. I still love php though, just don't really get much oppurtunity to use it these days.
dumbfck is offline  
Old 08/06/2013, 20:01   #18
 
Interest07's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
Quote:
Originally Posted by nb-ben View Post
I believe what should be a bigger performance concern is that I am bringing all the functionality up to JavaScript

But if you ask me, I claim it's too insignificant and my time or user's time spent coding is
Oh yeah, I fully agree
Interest07 is offline  
Old 08/06/2013, 21:56   #19
 
elite*gold: 0
Join Date: Nov 2012
Posts: 96
Received Thanks: 81
just some words to java...
the main reason not to program in java are the security holes and xyz exploits dropping some virus/trojans to your computer maybe by visiting a website.
so me and a lot more ppl dont have java on there computers.


the reason to program in java for me is, you can port the tools easy to android as example.



that would be some good thing for dumbfck, maybe he finish his pw messenger and port this to android, so ppl can talk in pw chat over handy
Murmuring is offline  
Old 08/06/2013, 23:59   #20
 
elite*gold: 0
Join Date: Jul 2013
Posts: 10
Received Thanks: 2
Quote:
Originally Posted by dumbfck View Post
Yeah, kinda glossed over the Javascript part... Should be fun making that cross-browser compatible lmao. Are you a masochist?

I used to do quite a bit of web dev, mostly php and js, but I started to lose interest in js in the end because M$ kept making new fricking browsers. I still love php though, just don't really get much oppurtunity to use it these days.
There is no browser :P

I am running this using Rhino (the JavaScript implementation of Mozilla), and the only API that will ever exist for it is the API I expose

I have actually been working in web development professionally, more specifically towards mobile browsers. And then just when you think you've finally reached a market where browsers are standard compliant, based on good ol' webkit, you get IE on Windows Phone to your face. Yes, Microsoft makes it pretty rough for web developers indeed. Good thing in this case Microsoft is not involved in regards to my JavaScript API

Quote:
Originally Posted by Murmuring View Post
just some words to java...
the main reason not to program in java are the security holes and xyz exploits dropping some virus/trojans to your computer maybe by visiting a website.
so me and a lot more ppl dont have java on there computers.


the reason to program in java for me is, you can port the tools easy to android as example.



that would be some good thing for dumbfck, maybe he finish his pw messenger and port this to android, so ppl can talk in pw chat over handy
Well, those vulnerabilities you are mentioning are applet related, which 99% of the Java enthusiasts themselves (me included) will admit, was perhaps the most spectacular failure in the software industry to ever reach this much recognition. But this is web related, not Java related.. you could in the same fashion specify C++ is bad because you can run its produce through ActiveX on supporting browsers (IE) and get viruses. The person who wrote this article mistakenly wrote "Java" instead of "Java Applet" and overgeneralized it, in the same way I would specify "eating candy is bad for you" as "eating food is bad for you". You can disable applets in your browser's settings :P


Edit: I wonder if you guys figured out how to log in yet, I could find out how to log out through sending packet but not how to log back in o.o
nb-ben is offline  
Old 08/12/2013, 11:33   #21
 
elite*gold: 10
Join Date: Sep 2010
Posts: 400
Received Thanks: 234
Quote:
Originally Posted by nb-ben View Post
Edit: I wonder if you guys figured out how to log in yet, I could find out how to log out through sending packet but not how to log back in o.o
Swoosh is the guy for that
Not sure if anyone else around here knows much about the whole RC4 / MPPC thing... All I do know is that you can't use the standard sendPacket function injection to log in...
dumbfck is offline  
Old 08/12/2013, 12:01   #22
 
elite*gold: 0
Join Date: Jul 2013
Posts: 10
Received Thanks: 2
Quote:
Originally Posted by dumbfck View Post
Swoosh is the guy for that
Not sure if anyone else around here knows much about the whole RC4 / MCCP thing... All I do know is that you can't use the standard sendPacket function injection to log in...
Yes, I would figure what's needed is the function being called when you press the log in button and the function being called when you select a character.

I suppose in that case debug to find out what reads from username/password and what reads some of the presented character's parameters, I would figure they probably store the character ID somewhere and select the character by that
nb-ben is offline  
Old 08/12/2013, 12:10   #23
 
elite*gold: 10
Join Date: Sep 2010
Posts: 400
Received Thanks: 234
I had an auto logger a while ago that just manipulated the GUI dialogues... but it wasn't very elegant lol.
But yeah, I expect there's a function that can be hooked which just takes username, password and character ID or something
dumbfck is offline  
Old 08/16/2013, 21:54   #24
 
ntldr32's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 75
Received Thanks: 34
why not just use J#. ? its Java on .Net, with it you can use C# function that used by many ppl here, i use they C# function (in *.dll compiled) along with VB.net (w/o convert), when my function look good, i compile it into *.dll so other .Net user can use it XD.
this is what i made write in VB, used Memfunctions and PacketSender class (C#) from interest07 .
ntldr32 is offline  
Old 08/17/2013, 10:42   #25
 
elite*gold: 0
Join Date: Jul 2013
Posts: 10
Received Thanks: 2
Quote:
Originally Posted by ntldr32 View Post
why not just use J#. ? its Java on .Net, with it you can use C# function that used by many ppl here, i use they C# function (in *.dll compiled) along with VB.net (w/o convert), when my function look good, i compile it into *.dll so other .Net user can use it XD.
this is what i made write in VB, used Memfunctions and PacketSender class (C#) from interest07 .
I understand what you are saying,
however I have already made those things in Java on top my underlying framework (along with plenty other functions).

sendPacket function in JIT assembly:
Code:
package pwbot.module.functions;

import jnr.x86asm.Asm;
import jnr.x86asm.Assembler;
import jnr.x86asm.SEGMENT;
import botfw.injection.AsmFunction;

import java.util.Properties;

/**
 * A function for sending a packet in Perfect World International elementclient.exe
 */
public class SendPacketFunction extends AsmFunction {

    /**
     * The size of the buffer for packets.
     */
    // Make that 1kB
    public static final int BUFFER_SIZE = 1024;

    /**
     * The buffer that contains the packet data to send
     */
    Parameter packetBuffer;

    /**
     * The size of the packet
     */
    Parameter packetSize;

    /**
     * Constructs a new <code>SendPacketFunction</code> using the specified settings
     * @param sendPacketAddress The address of the send packet function in memory
     * @param realBaseAddress   The base address
     */
    public SendPacketFunction(Properties addressMap) {
        super(addressMap);
        packetBuffer = new Parameter("buffer", "The buffer containing the packet data", BUFFER_SIZE);
        packetSize = new Parameter("size", "The size of the packet to send", 4);
    }

    @Override
    public void assemble(Assembler assembler) {
        assembler.pushad();
        assembler.mov(Asm.eax, Asm.imm(addressOf("sendpacket")));
        assembler.mov(Asm.ecx, Asm.dword_ptr_abs(addressOf("realbaseaddress"), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(Asm.ecx, Asm.dword_ptr(Asm.ecx, 0x20));
        assembler.mov(Asm.edi, Asm.imm(addressOf(packetBuffer)));
        assembler.push(Asm.dword_ptr_abs(addressOf(packetSize), 0, SEGMENT.SEGMENT_NONE));
        assembler.push(Asm.edi);
        assembler.call(Asm.eax);
        assembler.popad();
        assembler.ret();
    }
}
moveTo function in JIT assembly:
Code:
package pwbot.module.functions;

import botfw.injection.AsmFunction;
import jnr.x86asm.Asm;
import jnr.x86asm.Assembler;
import jnr.x86asm.Register;
import jnr.x86asm.SEGMENT;

import java.util.Properties;

/**
 * 
 */
public class MoveToFunction extends AsmFunction {

    /**
     * The destination X position
     */
    Parameter destX;

    /**
     * The destination Y position
     */
    Parameter destY;

    /**
     * The destination Z position
     */
    Parameter destZ;

    /**
     * The height to fly at
     */
    Parameter height;

    /**
     * 26625 to fly, 26624 to not fly
     */
    Parameter fly1;

    /**
     * 256 to fly, 65536 to not fly
     */
    Parameter fly2;

    /**
     * Constructs this <code>MoveToFunction</code>
     */
    public MoveToFunction(Properties addressMap) {
        super(addressMap);

        // Set up parameters
        destX = new Parameter("x", "The destination X coord", 4);
        destY = new Parameter("y", "The destination Y coord", 4);
        destZ = new Parameter("z", "The destination Z coord", 4);
        height = new Parameter("height", "The height to fly at", 4);
        fly1 = new Parameter("fly1", "26625 to fly, 26624 to not fly", 4);
        fly2 = new Parameter("fly2", "256 to fly, 65536 to not fly", 4);
    }

    @Override
    protected void assemble(Assembler assembler) {
        // Name our registers in a way that makes sense
        Register actionStruct = Asm.eax;
        Register moveAction = Asm.ecx;
        Register buffer = Asm.edi;

        // Put the action struct address into eax register
        assembler.mov(actionStruct, Asm.dword_ptr_abs(addressOf("baseaddress"), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(actionStruct, Asm.dword_ptr(actionStruct, addressOf("actionbase")));
        assembler.mov(actionStruct, Asm.dword_ptr(actionStruct, addressOf("actionstruct")));

        // Put the move action struct into ebx
        assembler.mov(moveAction, Asm.dword_ptr(actionStruct, addressOf("actionlist")));
        assembler.mov(moveAction, Asm.dword_ptr(moveAction, addressOf("moveaction")));

        // Specify we have not finished and that we would like to start
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("actionfinished")), Asm.imm(0));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("actionstart")), Asm.imm(1));

        // Specify the X coordinate
        assembler.mov(buffer, Asm.dword_ptr_abs(addressOf(destX), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("movex")), buffer);

        // Specify the Y coordinate
        assembler.mov(buffer, Asm.dword_ptr_abs(addressOf(destY), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("movey")), buffer);

        // Specify the Z coordinate
        assembler.mov(buffer, Asm.dword_ptr_abs(addressOf(destZ), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("movez")), buffer);

        // Specify the height
        assembler.mov(buffer, Asm.dword_ptr_abs(addressOf(height), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("moveh")), buffer);

        // Specify flight1
        assembler.mov(buffer, Asm.dword_ptr_abs(addressOf(fly1), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("flyup1")), buffer);

        // Specify flight2
        assembler.mov(buffer, Asm.dword_ptr_abs(addressOf(fly2), 0, SEGMENT.SEGMENT_NONE));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("flyup2")), buffer);

        // Specify move type (always 0)
        assembler.mov(buffer, Asm.imm(0));
        assembler.mov(Asm.dword_ptr(moveAction, addressOf("movetype")), buffer);

        // Set current action1
        assembler.mov(Asm.dword_ptr(actionStruct, addressOf("currentaction1")), moveAction);

        // Set current position in the action list
        assembler.mov(Asm.dword_ptr(actionStruct, addressOf("actionposition")), Asm.imm(1));

        // Set current action2
        assembler.mov(Asm.dword_ptr(actionStruct, addressOf("currentaction2")), moveAction);

        // Return
        assembler.ret();
    }
}
sendPacket convenience method:
Code:
    /**
     * Sends a packet to the server
     * @param buffer    The buffer containing packet data
     */
    private void sendPacket(byte[] buffer) {
        RemoteFunction fn = super.getFunction("sendpacket");

        Memory memory = new Memory(buffer.length);
        memory.write(0,buffer,0,buffer.length);
        fn.setParameter("buffer", memory);

        memory = new Memory(4);
        memory.setInt(0, buffer.length);
        fn.setParameter("size", memory);

        fn.call();
    }
moveTo convenience method:
Code:
    /**
     * Moves the player to the specified location
     * @param x         The X coordinate to move to
     * @param y         The Y coordinate to move to
     * @param z         The Z coordinate to move to
     * @param height    The height to fly at
     */
    public void moveTo(float x, float y, float z, float height) {
        RemoteFunction fn = super.getFunction("moveto");
        Memory memory;

        // Specify X
        memory = new Memory(4);
        memory.setFloat(0,x);
        fn.setParameter("x", memory);

        // Specify Y
        memory = new Memory(4);
        memory.setFloat(0,y);
        fn.setParameter("y", memory);

        // Specify Z
        memory = new Memory(4);
        memory.setFloat(0,z);
        fn.setParameter("z", memory);

        // Specify height
        memory = new Memory(4);
        memory.setFloat(0,height);
        fn.setParameter("height", memory);

        // Specify fly1
        memory = new Memory(4);
        memory.setInt(0,height>0?26625:26624);
        fn.setParameter("fly1",memory);

        // Specify fly2
        memory = new Memory(4);
        memory.setInt(0,height>0?256:65536);
        fn.setParameter("fly2",memory);

        // Call the function
        fn.call();
    }
Usage of sendPacket:
Code:
    /**
     * Picks up an item
     * @param itemIndex The index of the item, some would call that the "unique id"
     * @param typeId    The ID of the item type to pick
     */
    public void pickUp(int itemIndex, int typeId) {
        ByteBuffer buffer = ByteBuffer.allocate(10);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putShort(0, (short)0x6);
        buffer.putInt(2, itemIndex);
        buffer.putInt(6, typeId);
        sendPacket(buffer.array());
    }
Those things have a small creation cost but after they are made, they are pretty damn fast. I recon executing my JITed moveTo function would beat the current way of doing it in terms of performance, since I'm resolving absolutely no pointers and issuing a single write to overwrite the parameter stack, along with that I already have a suspended thread waiting to execute it (I am not creating and killing threads for every call).

It's convenient, doesn't require much more time for me to use (if at all), and has all of the features .NET has to offer.

Check this out, in-bot IDE:


Annotated function:
Code:
    @FuncDesc(description = "Walks (or runs) to the specified ground location")
    public void walkTo(
        @ParamDesc(name="x",description="The destination X coordinate",type="Number")
        float x,

        @ParamDesc(name="y",description="The destination Y coordinate",type="Number")
        float y,

        @ParamDesc(name="z",description="The destination Z coordinate",type="Number")
        float z
    ) {
        moveTo(x,y,z,-1);
    }
nb-ben is offline  
Old 12/06/2013, 15:18   #26
 
elite*gold: 0
Join Date: Dec 2013
Posts: 1
Received Thanks: 0
I just saw this and was interested.

Is this project still on the go? No posts for 4 months so I'm not sure. As a java programmer it's interesting!
tempomaster is offline  
Reply


Similar Threads Similar Threads
[JAVA Error] Could not create the java virtual machine
07/21/2013 - Technical Support - 10 Replies
Schönen Abend! Leider hat es sich aus einem unerfindlichen Grund ergeben, dass sobald ich die Minecraft.exe starten will die Errormeldung kommt. Die Tips auf Minecraft.net habe ich schon ohne Erfolg befolgt. Hoffe ihr könnt mir weiterhelfen... Mein PC:
recompile Problem (Block.java, item.java)
04/13/2013 - Minecraft - 1 Replies
Guten Morgen liebe Com (: Ich versuche etwas neues in Minecraft.. für mich einzubauen.. neuer Block + das Item dazu, des eingepflanzt werden muss.. wie bei einer Karotte oder einer Kartoffel. Ich zeige euch den Inhalt meiner BlockOnion.java package net.minecraft.src;
[Java] Could not create the Java virtual machine
06/22/2011 - Minecraft - 1 Replies
hallo ihr minecraftler ^^ habe seit heute das problem das wenn ich minecraft starte original als auch cracked das diese fehlermeldung kommt: Java virtual machine Launcher Could not create the Java virtual machine



All times are GMT +1. The time now is 08:38.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.