1
JavaOp Support Archive / Re: Diablo II Account Names
« 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+.
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;
}
}