Advertisement
lengend

Untitled

Nov 23rd, 2012
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var MuleLogger = {
  2.     LogAccounts: {
  3.         /* Format:
  4.             "account1/password1/realm": ["charname1", "charname2 etc"],
  5.             "account2/password2/realm": ["charnameX", "charnameY etc"],
  6.             "account3/password3/realm": ["all"]
  7.  
  8.             To log a full account, put "accountname/password/realm": ["all"]
  9.  
  10.             realm = useast, uswest, europe or asia
  11.         */
  12.  
  13.         "account/password/realm": ["all"]
  14.     },
  15.  
  16.     LogGame: ["muleloggame", "password"], // ["gamename", "password"]
  17.     LogNames: true, // Put account/character name on the picture
  18.     LogItemLevel: true, // Add item level to the picture
  19.     SaveScreenShot: false, // Save pictures in jpg format (saved in 'Images' folder)
  20.     IngameTime: 20, // Time to wait after leaving game
  21.  
  22.     // don't edit
  23.     getItemDesc: function (unit) {
  24.         var i, code, desc,
  25.             stringColor = "",
  26.             gid = "",
  27.             header = "",
  28.             name = unit.fname.split("\n").reverse().join(" ").replace(/ÿc[0-9!"+<;.*]|^ /, "");
  29.  
  30.         desc = unit.description.split("\n");
  31.  
  32.         // Lines are normally in reverse. Add color tags if needed and reverse order.
  33.         for (i = 0; i < desc.length; i += 1) {
  34.             if (desc[i].match(/^ÿ/)) {
  35.                 stringColor = desc[i].substring(0, 3);
  36.             } else {
  37.                 desc[i] = stringColor + desc[i];
  38.             }
  39.  
  40.             // process line for d2bot
  41.             desc[i] = desc[i].replace("ÿ", "\\xff").replace("\xFF", "\\xff");
  42.         }
  43.  
  44.         desc = desc.reverse().join("\\n");
  45.  
  46.         if (this.LogItemLevel) {
  47.             desc += ("\\n\\xffc0Item Level: " + unit.ilvl);
  48.         }
  49.  
  50.         code = getBaseStat(0, unit.classid, 'normcode') || unit.code;
  51.         code = code.replace(" ", "");
  52.  
  53.         if ([10, 12, 58, 82, 83, 84].indexOf(unit.itemType) > -1) {
  54.             code += (unit.gfx + 1);
  55.         }
  56.  
  57.         if (this.LogNames && me.account) {
  58.             header = me.account + " / " + me.name;
  59.         }
  60.  
  61.         // d2bot# optimization for runes, gems and set/unique items
  62.         if ([5, 7].indexOf(unit.quality) > -1 || [74, 96, 97, 98, 99, 100, 101, 102].indexOf(unit.itemType) > -1) {
  63.             gid = unit.gid;
  64.         }
  65.  
  66.         return (name + "$" + desc + "$" + code + "$" + header + "$" + gid);
  67.     },
  68.  
  69.     logChar: function () {
  70.         while (!me.gameReady) {
  71.             delay(500);
  72.         }
  73.  
  74.         var i, folder,
  75.             items = me.getItems(),
  76.             color = -1,
  77.             realm = me.realm || "Single Player",
  78.             finalString = "",
  79.             screenShot = "";
  80.  
  81.         if (!FileTools.exists("mules/" + realm)) {
  82.             folder = dopen("mules");
  83.  
  84.             folder.create(realm);
  85.         }
  86.  
  87.         if (!FileTools.exists("mules/" + realm + "/" + me.account)) {
  88.             folder = dopen("mules/" + realm);
  89.  
  90.             folder.create(me.account);
  91.         }
  92.  
  93.         if (!items || !items.length) {
  94.             return;
  95.         }
  96.  
  97.         for (i = 0; i < items.length; i += 1) {
  98.             if (items[i].mode === 0) {
  99.                 color = items[i].getColor();
  100.                 finalString += (this.getItemDesc(items[i]) + ";" + "0" + ";" + color + "\n");
  101.  
  102.                 if (this.SaveScreenShot) {
  103.                     screenShot = items[i].itemType + this.getItemDesc(items[i]) + ";" + color;
  104.                     sendCopyData(null, "D2Bot #", 0, "saveItem;" + screenShot);
  105.                     delay(500);
  106.                 }
  107.             }
  108.         }
  109.  
  110.         FileTools.writeText("mules/" + realm + "/" + me.account + "/" + me.name + ".txt", finalString);
  111.     }
  112. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement