Suvarii commited on
Commit
c1fa2f5
·
verified ·
1 Parent(s): 99613fc

Update bot.js

Browse files
Files changed (1) hide show
  1. bot.js +3 -10
bot.js CHANGED
@@ -11,8 +11,8 @@ const logger = loggers.logger;
11
 
12
  // --- AYARLAR (İstersen buradan değiştir) ---
13
  const HOME_ARRIVAL_DELAY_MS = 5000; // /home sonrası bekleme (ışınlanma tamamlanması için)
14
- const POST_ACTION_DELAY_MS = 2500; // besleme/işlem sonrası kısa bekleme (panel kapandıktan sonra dönmeden önce)
15
- const WINDOW_OPEN_TIMEOUT_MS = 2500; // panel açılmasını bekleme süresi (ms)
16
  const PERIODIC_CHECK_INTERVAL_MS = 5 * 60 * 1000; // 5 dakika
17
  // ------------------------------------------------
18
 
@@ -355,7 +355,6 @@ function createBot() {
355
  // custom_data -> data.value.display.value.Lore.value (string array)
356
  if (c.type === "custom_data" && c.data && c.data.value && c.data.value.display && c.data.value.display.value && c.data.value.display.value.Lore) {
357
  const loreObj = c.data.value.display.value.Lore;
358
- // loreObj.value genelde array of strings
359
  if (loreObj && loreObj.value && Array.isArray(loreObj.value)) {
360
  for (const s of loreObj.value) {
361
  const parsed = tryParseLoreText(String(s));
@@ -367,7 +366,6 @@ function createBot() {
367
  }
368
  }
369
 
370
- // 'lore' component tipi varsa
371
  if (c.type === "lore" && Array.isArray(c.data)) {
372
  for (const entry of c.data) {
373
  const text = safeGet(entry, ["value", "text", "value"]) || safeGet(entry, ["value", "extra", "value", 0, "value", "text", "value"]) || (entry && entry.toString && entry.toString());
@@ -382,7 +380,6 @@ function createBot() {
382
  // 3) componentMap içinde 'custom_data' veya 'lore' anahtarlarını kontrol et
383
  try {
384
  if (slot.componentMap && typeof slot.componentMap === "object") {
385
- // Map olabilir
386
  const getFromMap = (m, key) => {
387
  try {
388
  if (m.get) return m.get(key);
@@ -703,11 +700,10 @@ function createBot() {
703
  } catch (e) {}
704
  });
705
 
706
- // Güvenli windowOpen handler: başlık, slot ve lore debug logları ekli (log minimal)
707
  bot.on("windowOpen", function (window) {
708
  try {
709
  let titleStr = parseWindowTitleToString(window.title);
710
- logger.info(`[${config["bot-account"]["username"]}] windowOpen başlığı: ${titleStr}`);
711
 
712
  const panelMatch = (titleStr && (titleStr.toLowerCase().includes("besleyici") || titleStr.includes("ʙᴇsʟᴇʏiᴄi")));
713
  if (!panelMatch) {
@@ -722,7 +718,6 @@ function createBot() {
722
  }
723
 
724
  const beefSlots = window.slots.filter(xx => xx?.name && xx?.name === "cooked_beef");
725
- logger.info(`[${config["bot-account"]["username"]}] windowOpen: beefSlots=${beefSlots.length}`);
726
 
727
  if (beefSlots.length > 0) {
728
  const beefSlot = beefSlots[0];
@@ -735,11 +730,9 @@ function createBot() {
735
  } else if (minyoncani <= 2) {
736
  bot.clickWindow(36, 0, 0);
737
  logger.info(`[${config["bot-account"]["username"]}] Minyon canı ${minyoncani} olduğu için besleyici minyon beslendi.`);
738
- logger.info(`Minyon canı ${minyoncani} olduğu için besleyici ile beslendi.`);
739
  bot.closeWindow(window);
740
  } else {
741
  logger.info(`[${config["bot-account"]["username"]}] Minyon canı ${minyoncani} olduğu için yenilenmedi.`);
742
- logger.info(`Minyon canı ${minyoncani} olduğu için yenilenmedi.`);
743
  bot.closeWindow(window);
744
  }
745
  } else {
 
11
 
12
  // --- AYARLAR (İstersen buradan değiştir) ---
13
  const HOME_ARRIVAL_DELAY_MS = 5000; // /home sonrası bekleme (ışınlanma tamamlanması için)
14
+ const POST_ACTION_DELAY_MS = 1500; // besleme/işlem sonrası kısa bekleme (panel kapandıktan sonra dönmeden önce)
15
+ const WINDOW_OPEN_TIMEOUT_MS = 1500; // panel açılmasını bekleme süresi (ms)
16
  const PERIODIC_CHECK_INTERVAL_MS = 5 * 60 * 1000; // 5 dakika
17
  // ------------------------------------------------
18
 
 
355
  // custom_data -> data.value.display.value.Lore.value (string array)
356
  if (c.type === "custom_data" && c.data && c.data.value && c.data.value.display && c.data.value.display.value && c.data.value.display.value.Lore) {
357
  const loreObj = c.data.value.display.value.Lore;
 
358
  if (loreObj && loreObj.value && Array.isArray(loreObj.value)) {
359
  for (const s of loreObj.value) {
360
  const parsed = tryParseLoreText(String(s));
 
366
  }
367
  }
368
 
 
369
  if (c.type === "lore" && Array.isArray(c.data)) {
370
  for (const entry of c.data) {
371
  const text = safeGet(entry, ["value", "text", "value"]) || safeGet(entry, ["value", "extra", "value", 0, "value", "text", "value"]) || (entry && entry.toString && entry.toString());
 
380
  // 3) componentMap içinde 'custom_data' veya 'lore' anahtarlarını kontrol et
381
  try {
382
  if (slot.componentMap && typeof slot.componentMap === "object") {
 
383
  const getFromMap = (m, key) => {
384
  try {
385
  if (m.get) return m.get(key);
 
700
  } catch (e) {}
701
  });
702
 
703
+ // Güvenli windowOpen handler: minimal log (gereksiz başlık/beefSlots logları kaldırıldı)
704
  bot.on("windowOpen", function (window) {
705
  try {
706
  let titleStr = parseWindowTitleToString(window.title);
 
707
 
708
  const panelMatch = (titleStr && (titleStr.toLowerCase().includes("besleyici") || titleStr.includes("ʙᴇsʟᴇʏiᴄi")));
709
  if (!panelMatch) {
 
718
  }
719
 
720
  const beefSlots = window.slots.filter(xx => xx?.name && xx?.name === "cooked_beef");
 
721
 
722
  if (beefSlots.length > 0) {
723
  const beefSlot = beefSlots[0];
 
730
  } else if (minyoncani <= 2) {
731
  bot.clickWindow(36, 0, 0);
732
  logger.info(`[${config["bot-account"]["username"]}] Minyon canı ${minyoncani} olduğu için besleyici minyon beslendi.`);
 
733
  bot.closeWindow(window);
734
  } else {
735
  logger.info(`[${config["bot-account"]["username"]}] Minyon canı ${minyoncani} olduğu için yenilenmedi.`);
 
736
  bot.closeWindow(window);
737
  }
738
  } else {