Author Topic: Diablo II Account Names  (Read 4404 times)

0 Members and 2 Guests are viewing this topic.

Offline Hellmonkeys

  • Newbie
  • *
  • Posts: 3
    • View Profile
Diablo II Account Names
« on: June 26, 2007, 04:31:18 am »
Is there any way to fix the Diablo II account names when you are logged into Battle.net through a Diablo II bot?  Currently what it is doing is showing their accounts in the channel as:  [D2CharName]@[Realm]*[AcctName].  However, the bot is apparently setup for only *[AcctName], because anytime someone does .help or any other command it says that user is not logged in.  SO, is there any way to fix this?

Offline Newby

  • x86
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Diablo II Account Names
« Reply #1 on: June 26, 2007, 01:51:35 pm »
Parse it yourself. :)
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Hellmonkeys

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Diablo II Account Names
« Reply #2 on: June 28, 2007, 08:07:59 pm »
Well, if anyone cares, I made a workaround for this bug.  Simply, what this does is filters out any Character Name and Realm combination on any outgoing messages, so it leaves just the account name.  I.E -- It makes the bot able to whisper people, but doesn't actually change it in the channel listing or anything.  I am looking into a permanent fix such that it will display correctly in the channel listing as well.  If anyone has any information to point me in the right direction, let me know :P.

Anyways, here is the code I have so far:
Code: [Select]
import java.io.IOException;
import java.util.Properties;
import javax.swing.JComponent;

import callback_interfaces.PluginCallbackRegister;
import callback_interfaces.PublicExposedFunctions;
import callback_interfaces.StaticExposedFunctions;
import plugin_interfaces.GenericPluginInterface;
import plugin_interfaces.OutgoingTextCallback;
/**
 * @author Hellmonkeys
 *
 */
public class PluginMain extends GenericPluginInterface implements OutgoingTextCallback
{
    private PublicExposedFunctions out;
   
    public void load(StaticExposedFunctions staticFuncs)
    {
    }

    public void activate(PublicExposedFunctions out, PluginCallbackRegister register)
    {
        this.out = out;
        register.registerOutgoingTextPlugin(this, null);
    }

    public void deactivate(PluginCallbackRegister register)
    {
    }


    public String getName()
    {
        return "D2 Account Fix";
    }

    public String getVersion()
    {
        return "v1.0";
    }

    public String getAuthorName()
    {
        return "Hellmonkeys";
    }

    public String getAuthorWebsite()
    {
        return "www.google.com";
    }

    public String getAuthorEmail()
    {
        return "Hellmonkeys@GMail.com";
    }

    public String getShortDescription()
    {
        return "Fixes D2 Account Names";
    }

    public String getLongDescription()
    {
        return "Fixes the account names in Diablo II to allow whispers, etc.";
    }

    public Properties getSettingsDescription()
    {
        return new Properties();
    }

    public Properties getDefaultSettingValues()
    {
        return new Properties();
    }

public JComponent getComponent(String settingName, String value)
{
return null;
}
   

   
    public Properties getGlobalDefaultSettingValues()
    {
        Properties p = new Properties();
        return p;
    }
    public Properties getGlobalSettingsDescription()
    {
        Properties p = new Properties();
        return p;
    }
    public JComponent getGlobalComponent(String settingName, String value)
    {
        return null;
    }
   
    public String queuingText(String text, Object data)
    {
    String find[] = {"@USEast*","@USWest*","@Europe*"};
   
    int loop = 0;
    String finalText = text;
   
    while(loop < find.length)
    {
    int index;
    index = (finalText.toLowerCase()).indexOf(find[loop].toLowerCase());
   
    while(index > -1)
    {
    int space = finalText.lastIndexOf(' ', index);

    if(space > -1)
    {
    finalText = finalText.substring(0,space + 1) + finalText.substring(index + find[loop].length() - 1);    
    index = finalText.indexOf(find[loop]);
    }
    else
    {
    index = -1;    
    }
    }
       
        loop = loop + 1;
    }
   
        return finalText;
    }

    public void queuedText(String text, Object data)
    {
    }

    public String nextInLine(String text, Object data)
    {
        return text;
    }
   
    public long getDelay(String text, Object data)
    {
        return 0;
    }

    public boolean sendingText(String text, Object data)
    {
        return true;
    }

    public void sentText(String text, Object data)
    {
    }
}

P.S -- Yes, I know, this is quite a shitty method of fixing this problem, however, it is a start and is simply a workaround, not a fix.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Diablo II Account Names
« Reply #3 on: June 29, 2007, 02:29:46 am »
You've gotta love Diablo II's mangling. Blizzard screwed that up majorly. ^_^
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Ajan

  • Newbie
  • *
  • Posts: 17
  • I have visited my profile
    • View Profile
    • War Masters clan
Re: Diablo II Account Names
« Reply #4 on: July 01, 2007, 07:47:37 am »
Well, since you can log on D2 acc multiple times, I guess it is reasonable to identify them in specific way. Too bad it causes problems with JO though. I look forward to that fix too. Surely it'd simplify some matters.
We are but packets in this Internet of life.

Offline Hellmonkeys

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Diablo II Account Names
« Reply #5 on: July 01, 2007, 08:42:36 am »
Below is quite a bit better fix.  I think this should be implemented in JavaOp itself.  Granted, it's a bit of an overkill to do this to all events, but whatever...  I don't feel like spending the time to find what's necessary.  Also, JavaOp has * as a wildcard for user names, which will really mess this thing up, so pretty soon I am going to change this to not include the *, but add it in for any outgoing whispers... won't be hard.

But yeah, I am sure doing this to all packets may mess some things up, but so far my bot has been running fine with it for a day+.

Code: [Select]
import java.io.IOException;
import java.util.Properties;
import javax.swing.JComponent;

import callback_interfaces.PluginCallbackRegister;
import callback_interfaces.PublicExposedFunctions;
import callback_interfaces.StaticExposedFunctions;
import exceptions.PluginException;
import plugin_interfaces.GenericPluginInterface;

import plugin_interfaces.RawEventCallback;
import util.BNetEvent;
/**
 * @author Hellmonkeys
 *
 */
public class PluginMain extends GenericPluginInterface implements RawEventCallback
{
    private PublicExposedFunctions out;
   
    public void load(StaticExposedFunctions staticFuncs)
    {
    }

    public void activate(PublicExposedFunctions out, PluginCallbackRegister register)
    {
        this.out = out;
       
        register.registerRawEventPlugin(this, EID_SHOWUSER, null);
        register.registerRawEventPlugin(this, EID_JOIN, null);
        register.registerRawEventPlugin(this, EID_LEAVE, null);
        register.registerRawEventPlugin(this, EID_WHISPER, null);
        register.registerRawEventPlugin(this, EID_TALK, null);
        register.registerRawEventPlugin(this, EID_BROADCAST, null);
        register.registerRawEventPlugin(this, EID_CHANNEL, null);
        register.registerRawEventPlugin(this, EID_USERFLAGS, null);
        register.registerRawEventPlugin(this, EID_WHISPERSENT, null);
        register.registerRawEventPlugin(this, EID_CHANNELFULL, null);
        register.registerRawEventPlugin(this, EID_CHANNELDOESNOTEXIST, null);
        register.registerRawEventPlugin(this, EID_INFO, null);
        register.registerRawEventPlugin(this, EID_ERROR, null);
        register.registerRawEventPlugin(this, EID_EMOTE, null);
    }

    public void deactivate(PluginCallbackRegister register)
    {
    }


    public String getName()
    {
        return "D2 Account Fix";
    }

    public String getVersion()
    {
        return "v1.0";
    }

    public String getAuthorName()
    {
        return "Hellmonkeys";
    }

    public String getAuthorWebsite()
    {
        return "www.google.com";
    }

    public String getAuthorEmail()
    {
        return "Hellmonkeys@GMail.com";
    }

    public String getShortDescription()
    {
        return "Fixes D2 Account Names";
    }

    public String getLongDescription()
    {
        return "Fixes the account names in Diablo II to allow whispers, etc.";
    }

    public Properties getSettingsDescription()
    {
        return new Properties();
    }

    public Properties getDefaultSettingValues()
    {
        return new Properties();
    }

public JComponent getComponent(String settingName, String value)
{
return null;
}

    public Properties getGlobalDefaultSettingValues()
    {
        Properties p = new Properties();
        return p;
    }
    public Properties getGlobalSettingsDescription()
    {
        Properties p = new Properties();
        return p;
    }
    public JComponent getGlobalComponent(String settingName, String value)
    {
        return null;
    }
   
    public BNetEvent eventOccurring(BNetEvent event, Object data) throws IOException, PluginException
    {
        String username = stripAccount(event.getUsername());
       
        return new BNetEvent(event.getCode(), username, event.getMessage(), event.getPing(), event.getFlags());
    }
   
    public void eventOccurred(BNetEvent event, Object data) throws IOException, PluginException
    {
    }

    private String stripAccount(String user)
    {
    String account = user;
    int index = user.indexOf('*');
   
    if(index > -1)
    account = user.substring(index);
   
    return account;
    }
}

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Diablo II Account Names
« Reply #6 on: July 01, 2007, 01:00:17 pm »
Feel free to build it into a JAR and attach it (if you can -- if you're not allowed to, get a hold of me). I'm not really interested in maintaining anything JavaOp-related right now.
I'd personally do as Joe suggests

You might be right about that, Joe.