News:

Who uses forums anymore?

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Hellmonkeys

#1
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+.

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;
    }
}
#2
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:
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.
#3
JavaOp Support Archive / Diablo II Account Names
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?