Kolbot to iDB Integration
Description
After kolbot finishes a mule character, its expiration date, items, gold, socket quest and imbue quest get published to iDB. This removes the need to log all your mules manually via iDB or iDB-Web.Tips
If kolbot fails to send to iDB, it will write details into file: \d2bs\kolbot\iDB-Failed-[database name].txt in format: [realm]/[account]/[password]/[character name].How To
\d2bs\kolbot\libs\OOG.js
Make sure you are loading iDB.js on bot initialization:var D2Bot = {
handle: 0,
init: function() {
var handle = DataFile.getStats().handle;
if (handle) {
this.handle = handle;
}
var s = getScript("tools/iDB.js");
if (!s || !s.running) {
load("tools/iDB.js");
}
return this.handle;
},
Or if you already have a script like AutoPerm:
var D2Bot = {
handle: 0,
init: function() {
var handle = DataFile.getStats().handle;
if (handle) {
this.handle = handle;
}
var s = getScript("tools/AutoPerm.js");
if (!s || !s.running) {
if (FileTools.exists("tools/AutoPerm.js")) {
load("tools/AutoPerm.js");
}
}
s = getScript("tools/iDB.js");
if (!s || !s.running) {
load("tools/iDB.js");
}
return this.handle;
},
\d2bs\kolbot\libs\MuleLogger.js
Add LogToiDB flag:LogToiDB: true,
LogToShop: false,
SendToSite: false,
LogGame: ["", ""],
LogNames: false,
LogItemLevel: true,
LogEquipped: false,
LogMerc: false,
SaveScreenShot: false,
IngameTime: rand(10, 20),
getItemDesc: function (unit, logIlvl) {
Near the very bottom, add the code to trigger logging:
if (this.LogToiDB) {
var iDBDoneLogging, tick = getTickCount();
addEventListener("scriptmsg", function (msg) {
if (msg && typeof msg === "string" && msg === "iDBDoneLogging") {
iDBDoneLogging = true;
}
});
scriptBroadcast("iDBLog");
while (!iDBDoneLogging && getTickCount() ‐ tick < 10000) {
delay(100);
}
}
FileTools.writeText("mules/" + realm + "/" + me.account + "/" + me.name + …
print("Item logging done.");
If you want to save Horadric Cube data, comment or remove this line:
trash = [
..
547, //Golden Bird
548, //Lamesen's Tome
// 549, //Horadric Cube
550, //Horadric Scroll
551, //Mephisto's Soulstone
..
];
\d2bs\kolbot\libs\common\Misc.js
Search for "randomString", if you don't have it, add it into the Misc definition:var Misc = {
randomString: function (len, num) {
let possible = 'abcdefghijklmnopqrstuvwxyz';
if (num) {
possible += '0123456789';
}
let text = '';
for (let i = 0; i < len; i += 1) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
},
\d2bs\kolbot\tools\iDB.js
DownloadExtract and place iDB.js into tools folder then configure the top section.
iDBdatabaseName | Name of the database in iDB that you want to publish to (if it doesn't exist, the database will be created automatically) |
iDBaddress |
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! |
iDBport | Typically 7337 unless the |
iDBloginName | Leave blank |
iDBloginPass | Leave blank |
defPass | Default password to use in case password lookup fails (it's a good idea to use fail or something similar so you know when the script is having trouble looking up the correct password from your mule config) |
whitelistedProfiles | List of all the profiles that should publish to iDB (automules, muleloggers and droppers do not have to be listed!)
|
blacklistedProfiles | List of all the profiles that should not publish to iDB (even if they are automules, muleloggers, droppers, etc.)
|
Changelog
2020-10-05: v1.10
- UPD Accounts are logged to file when password determination fails
2020-07-31: v1.9
- ADD Added logging by default for automule, mulelogger and dropper profiles as well as support for profile whitelisting / blacklisting
2020-02-03: v1.8
- ADD Added support for gold, imbue, socket
2019-12-28: v1.7
- ADD Added character name to the failure logging
2019-12-16: v1.6
- FIX Wait for all incoming packets to process before publishing to iDB
2019-12-16: v1.5
- ADD Added logging on failure
2019-05-30: v1.0
- ADD Initial