kolton / d2bot-with-kolbot

d2bot game manager by D3STROY3R with kolbot libs by kolton for d2bs
346 stars 332 forks source link

Adding each Runeword made to print in console #1863

Closed gstamb closed 5 years ago

gstamb commented 5 years ago

Hi there,

Trying to make the console show ( with picture, as if I kept ) each runeword that the toon has made. This would allow to spot anything that I've messed with the configuration.

I've come across this topic (https://github.com/kolton/d2bot-with-kolbot/issues/250), where the following method is described:

  case "Kept":
  case "Field Kept":
  case "Runeword Kept":
  case "Cubing Kept":
  case "Shopped":
  case "Gambled":
  case "Dropped":
      desc = this.getItemDesc(unit).split("\n").join(" | ").replace(/(\\xff|ÿ)c[0-9!"+<:;.*]|\/|\\/gi, "").trim();

      break;
  case "No room for":
      desc = unit.name;

      break;
  default:
      desc = unit.fname.split("\n").reverse().join(" ").replace(/(\\xff|ÿ)c[0-9!"+<:;.*]|\/|\\/gi, "").trim();

      break;
  }

  if( action == "Dropped" || action == "Sold" ) {   <----Add This
      this.logItem( action, unit );            
  }                                                   

  return this.fileAction("logs/ItemLog.txt", 2, dateString + " <" + me.profile + "> <" + action + "> (" + Pickit.itemQualityToName(unit.quality) + ") " + desc + (text ? " {" + text + "}" : "") + "\n");

},

In Misc.js around line 1320 you have this snippet of code. Add the lines as instructed.

      case "Kept":
      case "Field Kept":
      case "Runeword Kept":
      case "Cubing Kept":
      case "Shopped":
      case "Gambled":
      case "Dropped":
          desc = this.getItemDesc(unit).split("\n").join(" | ").replace(/(\\xff|ÿ)c[0-9!"+<:;.*]|\/|\\/gi, "").trim();

          break;
      case "No room for":
          desc = unit.name;

          break;
      default:
          desc = unit.fname.split("\n").reverse().join(" ").replace(/(\\xff|ÿ)c[0-9!"+<:;.*]|\/|\\/gi, "").trim();

          break;
      }

      if( action == "Dropped" || action == "Sold" ) {   <----Add This
          this.logItem( action, unit );            
      }                                                   

      return this.fileAction("logs/ItemLog.txt", 2, dateString + " <" + me.profile + "> <" + action + "> (" + Pickit.itemQualityToName(unit.quality) + ") " + desc + (text ? " {" + text + "}" : "") + "\n");
  },

Then around lines 1380 you have:

There is no case for "Runeword Made". Would simply defining such case work? Are there other dependencies? Basically asking how I should go about it.

mf022 commented 5 years ago

There is no case for "Runeword Made". Would simply defining such case work? Are there other dependencies?

in Misc.js note that itemLogger function, with those cases, is for writing that info on log file - "logs/ItemLog.txt"

It's ok only to add a line in Runewords.js, under default 392 (inside makeRunewords function):

            Misc.logItem("Runeword Made", items[0]);

only if you need that info written in log file too, you should add

            Misc.itemLogger("Runeword Made", items[0]);

and ofc the "Runeword Made" case in itemLogger function from Misc.js

gstamb commented 5 years ago

Works wonderfully! Thanks a lot mf022 :)