Kolbot to PermIt Integration
Description
After kolbot finishes a mule account, it gets published to PermIt for processing. After PermIt is done processing, it can optionally be configured to publish the expiration date, items, gold, socket quest and imbue quest to iDB. This removes the need to log all your mules manually via iDB or iDB-Web.How To
\d2bs\kolbot\D2BotMule.dbj
At the top of the file, add this:var permItSettings = {
databaseName : "Default", // database name to send to
address : "localhost", // IP Address to connect to
port : 7339, // Port to connect to
loginName : "", // login name
loginPass : "", // login pass
};
databaseName |
Name of the database in iDB that you want to publish to (if it doesn't exist, the database will be created automatically).
Use a blank to force PermIt to use its |
address |
localhost or 127.0.0.1 to point at the local machine Otherwise, use the target's IP or host name Don't forget to open the firewall & setup port forwarding on the target server! |
port | Typically 7339 unless the |
iDBloginName | Leave blank |
iDBloginPass | Leave blank |
function nextAccount() {
var obj = MuleData.read();
if (obj.account) {
try {
let initializationRequest = {
type : "InitializationRequest",
app : "Kolbot",
name : permItSettings.loginName,
password : permItSettings.loginPass,
};
let initializationRequestStr = JSON.stringify(initializationRequest);
let permAccountRequest = {
type : "PermAccountRequest",
server : muleObj.realm.toLowerCase(),
accountName : obj.account,
accountPassword : muleObj.accountPassword,
databaseName : permItSettings.databaseName
};
let permAccountRequestStr = JSON.stringify(permAccountRequest);
let con = Socket.open(permItSettings.address, permItSettings.port);
con.send(String.fromCharCode(2));
con.send(initializationRequestStr + String.fromCharCode(3));
con.send(permAccountRequestStr + String.fromCharCode(3));
print("Sent to PermIt..");
con.read();
con.close();
con = false;
} catch (e) {
print(e);
}
}
obj.accNum = obj.accNum + 1;
obj.account = muleObj.accountPrefix + obj.accNum;
obj.character = "";
obj.charNum = 0;
obj.fullChars = [];
obj.torchChars = [];
MuleData.write(obj);
return obj.account;
}
\d2bs\kolbot\D2BotMuleLog.dbj
At the top of the file, add this and configure it the same way as the other file is configured:var permItSettings = {
databaseName : "Default", // database name to send to
address : "localhost", // IP Address to connect to
port : 7339, // Port to connect to
loginName : "", // login name
loginPass : "", // login pass
};
Half way down, add this code to the splash screen switch:
case 18: // D2 Splash
if (nextAcc) {
try {
let initializationRequest = {
type : "InitializationRequest",
app : "Kolbot",
name : permItSettings.loginName,
password : permItSettings.loginPass,
};
let initializationRequestStr = JSON.stringify(initializationRequest);
let permAccountRequest = {
type : "PermAccountRequest",
server : currAcc[2].toLowerCase(),
accountName : currAcc[0],
accountPassword : currAcc[1],
databaseName : permItSettings.databaseName
};
let permAccountRequestStr = JSON.stringify(permAccountRequest);
let con = Socket.open(permItSettings.address, permItSettings.port);
con.send(String.fromCharCode(2));
con.send(initializationRequestStr + String.fromCharCode(3));
con.send(permAccountRequestStr + String.fromCharCode(3));
print("Sent to PermIt..");
con.read();
con.close();
con = false;
} catch (e) {
print(e);
}
accounts.shift();
chars.shift();
nextAcc = false;
}
Changelog
2020-03-05: v1.1
- ADD Added hook for D2BotMuleLog entry script
2019-11-18: v1.0
- ADD Initial