Coder Social home page Coder Social logo

bumbleshoot / automate-habitica Goto Github PK

View Code? Open in Web Editor NEW
20.0 6.0 6.0 190 KB

Automate Habitica is a suite of automation tools for Habitica, allowing you to focus on your tasks instead of managing gameplay. Each tool can be enabled, disabled, and configured to suit your needs.

Home Page: https://habitica.fandom.com/wiki/Automate_Habitica

JavaScript 100.00%
automation habitica script google-apps-script

automate-habitica's People

Contributors

bumbleshoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

automate-habitica's Issues

Exception: Service invoked too many times for one day: urlfetch.

What is the bug?
After installing Automate Habitica v0.29.22 yesterday, received "Automate Habitica v0.29.22 failed!" email messages overnight.

Additional context
I installed latest version of Automate Habitica: v0.29.22 yesteday (3/30/2023).

Errors are of 3 different types:

Exception: Service invoked too many times for one day: urlfetch.
at fetch (global:576:32)
at getUser (global:720:14)
at castEarthquake (automations/castMageSkills:55:7)
at useExcessMana (global:532:5)
at processQueue (global:388:11)
at onTrigger (global:27:5)
at GS_INTERNAL_top_function_call.gs:1:8

Exception: Service invoked too many times for one day: urlfetch.
at fetch (global:576:32)
at getContent (global:837:17)
at notifyQuestEnded (automations/notifyQuestEnded:20:3)
at processQueue (global:353:11)
at doPost (global:88:5)
at GS_INTERNAL_top_function_call.gs:1:8

Exception: Service invoked too many times for one day: urlfetch.
at fetch (global:576:32)
at getUser (global:720:14)
at processTrigger (global:115:62)
at onTrigger (global:26:5)
at GS_INTERNAL_top_function_call.gs:1:8

How often does this happen?
I received 59 Automate Habitica failed messages in the past day.

Script version
v0.29.22

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = false;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = false;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = false; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 50000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

Not doing damage during quests - even when I should be out of the Inn

What is the bug?
Please describe the bug in as much detail as you can. If you got an error message from the script, please paste the whole error message here.

I am not doing ANY damage anymore - despite the fact that I should be out of the Inn, since I don't have any pending quests/tasks. This has been going on for about a month, since I changed paties.

Additional context
If applicable, please provide any context you think might be relevant to the bug (eg. what you were doing/trying to do at the time, something that was different this time vs the other times when it worked as expected, any unique circumstances that might make your use of the script different from other users, etc.).

This started to happen once I joined this new party. The only change that I can think of is the fact that I turned off the auto-buff part, as the party said it was making the game less of an incentive for some of them... Up until I joined this party, I was dealing damage every day without a problem.

How often does this happen?
Please provide your best estimate. eg. Only once? Several times a day? A couple times a month?

Every single day

Script version
Please open your copy of the script, copy the version number (it should be at the very top), and paste it here. This should be the version of the script that was running when the bug/error occurred.

v0.29.35 (beta)

Script settings

**Copy #1- in case this is the part you need, see below for all of the code (minus my personal data, ofc)**
Please copy & paste your script settings (consts) here (between the `const AUTO_CRON = true // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = true;
const AUTO_INVITE_UNLOCKABLE_QUESTS = true;
const AUTO_INVITE_PET_QUESTS = true;
const AUTO_INVITE_HOURGLASS_QUESTS = true;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = false;

const AUTO_CAST_SKILLS = false;

const AUTO_PAUSE_RESUME_DAMAGE = true;
const MAX_PLAYER_DAMAGE = 15;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = false;
const RESERVE_GOLD = 10000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = false;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want`
]
`  **but be sure to delete your `USER_ID`, `API_TOKEN`, and `WEBHOOK_URL`!**

`/**

const USER_ID = "";
const API_TOKEN = "";
const WEB_APP_URL = "";

const AUTO_CRON = true // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = true;
const AUTO_INVITE_UNLOCKABLE_QUESTS = true;
const AUTO_INVITE_PET_QUESTS = true;
const AUTO_INVITE_HOURGLASS_QUESTS = true;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = false;

const AUTO_CAST_SKILLS = false;

const AUTO_PAUSE_RESUME_DAMAGE = true;
const MAX_PLAYER_DAMAGE = 15;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = false;
const RESERVE_GOLD = 10000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = false;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

/*************************************\

  • DO NOT EDIT ANYTHING BELOW HERE *
    *************************************/

let installing;
function install() {

installing = true;

// if settings are valid
if (validateConstants()) {

// delete triggers & webhooks
deleteTriggers();
deleteWebhooks();

// empty queue
for (let property of Object.keys(scriptProperties.getProperties())) {
  if (property.match(/^[a-z]/) !== null) {
    scriptProperties.deleteProperty(property);
  }
}

// queue enabled automations
processTrigger();
processWebhook({
  webhookType: "scored",
  taskType: "daily",
  isDue: true,
  gp: getUser(true).stats.gp,
  dropType: "All"
});
processWebhook({
  webhookType: "leveledUp",
  statPoints: user.stats.points,
  lvl: user.stats.lvl
});
processWebhook({
  webhookType: "questInvited",
  questKey: user.party.quest.key
});
processWebhook({ webhookType: "questStarted" });
processWebhook({ webhookType: "questFinished" });
if (HIDE_PARTY_NOTIFICATIONS === true && typeof user.party?._id !== "undefined") {
  hidePartyNotification();
}
processWebhook({ webhookType: "groupChatReceived" });

// process queue
processQueue();

// create trigger & webhooks
createTrigger();
createWebhooks();

console.log("Success!");

}
}

function uninstall() {

// delete triggers & webhooks
deleteTriggers();
deleteWebhooks();

console.log("Done!");
}

function validateConstants() {

let valid = true;

if (typeof USER_ID !== "string" || USER_ID == "") {
console.log("ERROR: USER_ID must equal your Habitica User ID.\n\neg. const USER_ID = "abcd1234-ef56-gh78-ij90-abcdef123456";\n\nYour Habitica User ID can be found at https://habitica.com/user/settings/api");
valid = false;
}

if (typeof API_TOKEN !== "string" || API_TOKEN == "") {
console.log("ERROR: API_TOKEN must equal your Habitica API Token.\n\neg. const API_TOKEN = "abcd1234-ef56-gh78-ij90-abcdef123456";\n\nYour Habitica API Token can be found at https://habitica.com/user/settings/api");
valid = false;
}

if (valid) {
try {
getUser(true);
} catch (e) {
if (e.stack.includes("There is no account that uses those credentials")) {
console.log("ERROR: Your USER_ID and/or API_TOKEN is incorrect. Both of these can be found at https://habitica.com/user/settings/api");
valid = false;
} else {
throw e;
}
}
}

if (typeof WEB_APP_URL !== "string" || WEB_APP_URL == "") {
console.log("ERROR: WEB_APP_URL must equal the web app url of this project's deployment.\n\neg. const WEB_APP_URL = "https://script.google.com/macros/s/abc123def456ghi789jkl012abc345de/exec\";");
valid = false;
}

if (AUTO_CRON !== true && AUTO_CRON !== false) {
console.log("ERROR: AUTO_CRON must equal either true or false.\n\neg. const AUTO_CRON = true;\n const AUTO_CRON = false;");
valid = false;
}

if (AUTO_ACCEPT_QUEST_INVITES !== true && AUTO_ACCEPT_QUEST_INVITES !== false) {
console.log("ERROR: AUTO_ACCEPT_QUEST_INVITES must equal either true or false.\n\neg. const AUTO_ACCEPT_QUEST_INVITES = true;\n const AUTO_ACCEPT_QUEST_INVITES = false;");
valid = false;
}

if (FORCE_START_QUESTS !== true && FORCE_START_QUESTS !== false) {
console.log("ERROR: FORCE_START_QUESTS must equal either true or false.\n\neg. const FORCE_START_QUESTS = true;\n const FORCE_START_QUESTS = false;");
valid = false;
}

if (FORCE_START_QUESTS === true) {

if (typeof getParty() === "undefined" || party.leader.id !== USER_ID) {
  console.log("ERROR: FORCE_START_QUESTS can only be run by party leaders.");
  valid = false;
}

if (typeof FORCE_START_QUESTS_AFTER_HOURS !== "number" || !Number.isInteger(FORCE_START_QUESTS_AFTER_HOURS) || FORCE_START_QUESTS_AFTER_HOURS < 1) {
  console.log("ERROR: FORCE_START_QUESTS_AFTER_HOURS must be a whole number greater than 0.\n\neg. const FORCE_START_QUESTS_AFTER_HOURS = 1;\n    const FORCE_START_QUESTS_AFTER_HOURS = 8;");
  valid = false;
}

if (NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST !== true && NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST !== false) {
  console.log("ERROR: NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST must equal either true or false.\n\neg. const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;\n    const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = false;");
}

}

if (AUTO_INVITE_GOLD_QUESTS !== true && AUTO_INVITE_GOLD_QUESTS !== false) {
console.log("ERROR: AUTO_INVITE_GOLD_QUESTS must equal either true or false.\n\neg. const AUTO_INVITE_GOLD_QUESTS = true;\n const AUTO_INVITE_GOLD_QUESTS = false;");
valid = false;
}

if (AUTO_INVITE_UNLOCKABLE_QUESTS !== true && AUTO_INVITE_UNLOCKABLE_QUESTS !== false) {
console.log("ERROR: AUTO_INVITE_UNLOCKABLE_QUESTS must equal either true or false.\n\neg. const AUTO_INVITE_UNLOCKABLE_QUESTS = true;\n const AUTO_INVITE_UNLOCKABLE_QUESTS = false;");
valid = false;
}

if (AUTO_INVITE_PET_QUESTS !== true && AUTO_INVITE_PET_QUESTS !== false) {
console.log("ERROR: AUTO_INVITE_PET_QUESTS must equal either true or false.\n\neg. const AUTO_INVITE_PET_QUESTS = true;\n const AUTO_INVITE_PET_QUESTS = false;");
valid = false;
}

if (AUTO_INVITE_HOURGLASS_QUESTS !== true && AUTO_INVITE_HOURGLASS_QUESTS !== false) {
console.log("ERROR: AUTO_INVITE_HOURGLASS_QUESTS must equal either true or false.\n\neg. const AUTO_INVITE_HOURGLASS_QUESTS = true;\n const AUTO_INVITE_HOURGLASS_QUESTS = false;");
valid = false;
}

if (AUTO_INVITE_GOLD_QUESTS === true || AUTO_INVITE_UNLOCKABLE_QUESTS === true || AUTO_INVITE_PET_QUESTS === true || AUTO_INVITE_HOURGLASS_QUESTS === true) {
if (PM_WHEN_OUT_OF_QUEST_SCROLLS !== true && PM_WHEN_OUT_OF_QUEST_SCROLLS !== false) {
console.log("ERROR: PM_WHEN_OUT_OF_QUEST_SCROLLS must equal either true or false.\n\neg. const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;\n const PM_WHEN_OUT_OF_QUEST_SCROLLS = false;");
valid = false;
}
}

if (NOTIFY_ON_QUEST_END !== true && NOTIFY_ON_QUEST_END !== false) {
console.log("ERROR: NOTIFY_ON_QUEST_END must equal either true or false.\n\neg. const NOTIFY_ON_QUEST_END = true;\n const NOTIFY_ON_QUEST_END = false;");
valid = false;
}

if (AUTO_CAST_SKILLS !== true && AUTO_CAST_SKILLS !== false) {
console.log("ERROR: AUTO_CAST_SKILLS must equal either true or false.\n\neg. const AUTO_CAST_SKILLS = true;\n const AUTO_CAST_SKILLS = false;");
valid = false;
}

if (AUTO_PAUSE_RESUME_DAMAGE !== true && AUTO_PAUSE_RESUME_DAMAGE !== false) {
console.log("ERROR: AUTO_PAUSE_RESUME_DAMAGE must equal either true or false.\n\neg. const AUTO_PAUSE_RESUME_DAMAGE = true;\n const AUTO_PAUSE_RESUME_DAMAGE = false;");
valid = false;
}

if (AUTO_PAUSE_RESUME_DAMAGE === true) {
if (typeof MAX_PLAYER_DAMAGE !== "number" || MAX_PLAYER_DAMAGE < 0 || MAX_PLAYER_DAMAGE > 50) {
console.log("ERROR: MAX_PLAYER_DAMAGE must be a number between 0 and 50.\n\neg. const MAX_PLAYER_DAMAGE = 0;\n const MAX_PLAYER_DAMAGE = 22.5;\n const MAX_PLAYER_DAMAGE = 50;");
valid = false;
}

if (typeof MAX_PARTY_DAMAGE !== "number" || MAX_PARTY_DAMAGE < 0 || MAX_PARTY_DAMAGE > 50) {
  console.log("ERROR: MAX_PARTY_DAMAGE must be a number between 0 and 50.\n\neg. const MAX_PARTY_DAMAGE = 0;\n    const MAX_PARTY_DAMAGE = 22.5;\n    const MAX_PARTY_DAMAGE = 50;");
  valid = false;
}

}

if (AUTO_ALLOCATE_STAT_POINTS !== true && AUTO_ALLOCATE_STAT_POINTS !== false) {
console.log("ERROR: AUTO_ALLOCATE_STAT_POINTS must equal either true or false.\n\neg. const AUTO_ALLOCATE_STAT_POINTS = true;\n const AUTO_ALLOCATE_STAT_POINTS = false;");
valid = false;
}

if (AUTO_ALLOCATE_STAT_POINTS === true) {
if (!["str", "int", "con", "per"].includes(STAT_TO_ALLOCATE)) {
console.log("ERROR: STAT_TO_ALLOCATE must be one of either "str", "int", "con", or "per".\n\neg. const STAT_TO_ALLOCATE = "int";\n const STAT_TO_ALLOCATE = "per";");
valid = false;
}
}

if (AUTO_PURCHASE_GEMS !== true && AUTO_PURCHASE_GEMS !== false) {
console.log("ERROR: AUTO_PURCHASE_GEMS must equal either true or false.\n\neg. const AUTO_PURCHASE_GEMS = true;\n const AUTO_PURCHASE_GEMS = false;");
valid = false;
}

if (AUTO_PURCHASE_GEMS === true) {
if (typeof getUser().purchased.plan.dateTerminated === "undefined" || (user.purchased.plan.dateTerminated && new Date(user.purchased.plan.dateTerminated).getTime() <= new Date().getTime())) {
console.log("ERROR: Only subscribers can purchase gems with gold. Since you are not a subscriber, you should set AUTO_PURCHASE_GEMS to false.\n\neg. const AUTO_PURCHASE_GEMS = false;");
valid = false;
}
}

if (AUTO_PURCHASE_ARMOIRES !== true && AUTO_PURCHASE_ARMOIRES !== false) {
console.log("ERROR: AUTO_PURCHASE_ARMOIRES must equal either true or false.\n\neg. const AUTO_PURCHASE_ARMOIRES = true;\n const AUTO_PURCHASE_ARMOIRES = false;");
valid = false;
}

if (AUTO_PURCHASE_ARMOIRES === true) {
if (typeof RESERVE_GOLD !== "number" || RESERVE_GOLD < 0) {
console.log("ERROR: RESERVE_GOLD must be a number greater than or equal to 0.\n\neg. const RESERVE_GOLD = 0;\n const RESERVE_GOLD = 10000;\n const RESERVE_GOLD = 235.25;");
valid = false;
}
}

if (AUTO_SELL_EGGS !== true && AUTO_SELL_EGGS !== false) {
console.log("ERROR: AUTO_SELL_EGGS must equal either true or false.\n\neg. const AUTO_SELL_EGGS = true;\n const AUTO_SELL_EGGS = false;");
valid = false;
}

if (AUTO_SELL_EGGS === true) {
if (typeof RESERVE_EGGS !== "number" || !Number.isInteger(RESERVE_EGGS) || RESERVE_EGGS < 0) {
console.log("ERROR: RESERVE_EGGS must be a whole number greater than or equal to 0.\n\neg. const RESERVE_EGGS = 0;\n const RESERVE_EGGS = 50;\n const RESERVE_EGGS = 99;");
valid = false;
}
}

if (AUTO_SELL_HATCHING_POTIONS !== true && AUTO_SELL_HATCHING_POTIONS !== false) {
console.log("ERROR: AUTO_SELL_HATCHING_POTIONS must equal either true or false.\n\neg. const AUTO_SELL_HATCHING_POTIONS = true;\n const AUTO_SELL_HATCHING_POTIONS = false;");
valid = false;
}

if (AUTO_SELL_HATCHING_POTIONS === true) {
if (typeof RESERVE_HATCHING_POTIONS !== "number" || !Number.isInteger(RESERVE_HATCHING_POTIONS) || RESERVE_HATCHING_POTIONS < 0) {
console.log("ERROR: RESERVE_HATCHING_POTIONS must be a whole number greater than or equal to 0.\n\neg. const RESERVE_HATCHING_POTIONS = 0;\n const RESERVE_HATCHING_POTIONS = 50;\n const RESERVE_HATCHING_POTIONS = 999;");
valid = false;
}
}

if (AUTO_SELL_FOOD !== true && AUTO_SELL_FOOD !== false) {
console.log("ERROR: AUTO_SELL_FOOD must equal either true or false.\n\neg. const AUTO_SELL_FOOD = true;\n const AUTO_SELL_FOOD = false;");
valid = false;
}

if (AUTO_SELL_FOOD === true) {
if (typeof RESERVE_FOOD !== "number" || !Number.isInteger(RESERVE_FOOD) || RESERVE_FOOD < 0) {
console.log("ERROR: RESERVE_FOOD must be a whole number greater than or equal to 0.\n\neg. const RESERVE_FOOD = 0;\n const RESERVE_FOOD = 50;\n const RESERVE_FOOD = 999;");
valid = false;
}
}

if (AUTO_HATCH_FEED_PETS !== true && AUTO_HATCH_FEED_PETS !== false) {
console.log("ERROR: AUTO_HATCH_FEED_PETS must equal either true or false.\n\neg. const AUTO_HATCH_FEED_PETS = true;\n const AUTO_HATCH_FEED_PETS = false;");
valid = false;
}

if (AUTO_HATCH_FEED_PETS === true) {
if (ONLY_USE_DROP_FOOD !== true && ONLY_USE_DROP_FOOD !== false) {
console.log("ERROR: ONLY_USE_DROP_FOOD must equal either true or false.\n\neg. const ONLY_USE_DROP_FOOD = true;\n const ONLY_USE_DROP_FOOD = false;");
valid = false;
}
}

if (HIDE_PARTY_NOTIFICATIONS !== true && HIDE_PARTY_NOTIFICATIONS !== false) {
console.log("ERROR: HIDE_PARTY_NOTIFICATIONS must equal either true or false.\n\neg. const HIDE_PARTY_NOTIFICATIONS = true;\n const HIDE_PARTY_NOTIFICATIONS = false;");
valid = false;
}

if (HIDE_ALL_GUILD_NOTIFICATIONS !== true && HIDE_ALL_GUILD_NOTIFICATIONS !== false) {
console.log("ERROR: HIDE_ALL_GUILD_NOTIFICATIONS must equal either true or false.\n\neg. const HIDE_ALL_GUILD_NOTIFICATIONS = true;\n const HIDE_ALL_GUILD_NOTIFICATIONS = false;");
valid = false;
}

if (HIDE_ALL_GUILD_NOTIFICATIONS === false) {
if (!Array.isArray(HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS)) {
console.log("ERROR: HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS must equal an array (list) of guild IDs.\n\neg. const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [\n "f2db2a7f-13c5-454d-b3ee-ea1f5089e601",\n "5481ccf3-5d2d-48a9-a871-70a7380cee5a",\n "694b15e1-19b0-4ea8-ac71-ce9f27031330"\n ]");
valid = false;

} else {
  let inGuilds = true;
  for (let guildId of HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS) {
    if (typeof guildId !== "string" || (guildId !== "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" && guildId.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/) === null)) {
      console.log("ERROR: HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS must equal an array (list) of guild IDs.\n\neg. const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [\n      \"f2db2a7f-13c5-454d-b3ee-ea1f5089e601\",\n      \"5481ccf3-5d2d-48a9-a871-70a7380cee5a\",\n      \"694b15e1-19b0-4ea8-ac71-ce9f27031330\"\n    ]");
      valid = false;
      break;
    }

    if (inGuilds && guildId !== "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" && !getUser().guilds.includes(guildId)) {
      inGuilds = false;
      valid = false;
    }
  }
  if (!inGuilds) {
    console.log("ERROR: You must be a member of each guild in the HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS list.");
  }
}

}

if (!valid) {
console.log("Please fix the above errors, create a new version of the deployment, and run the install function again. If you aren't sure how to do this, see "Changing the Settings" in the documentation for this script.");
}

return valid;
}

function deleteTriggers() {
let triggers = ScriptApp.getProjectTriggers();
if (triggers.length > 0) {

console.log("Deleting triggers");

for (let trigger of triggers) {
  ScriptApp.deleteTrigger(trigger);
}

}
}

function createTrigger() {

// create trigger if needed for enabled automations
if (AUTO_CRON === true || AUTO_ACCEPT_QUEST_INVITES === true || FORCE_START_QUESTS === true || AUTO_CAST_SKILLS === true || AUTO_PAUSE_RESUME_DAMAGE === true || AUTO_PURCHASE_GEMS === true || AUTO_PURCHASE_ARMOIRES === true) {

console.log("Creating trigger");

ScriptApp.newTrigger("onTrigger")
  .timeBased()
  .everyMinutes(10)
  .create();

}
}

function deleteWebhooks(groupChatReceived) {
let webhooks = JSON.parse(fetch("https://habitica.com/api/v3/user/webhook", GET_PARAMS)).data;
if (webhooks.length > 0) {

if (!groupChatReceived) {
  console.log("Deleting webhooks");
} else {
  console.log("Deleting groupChatReceived webhooks");
}

for (let webhook of webhooks) {
  if (webhook.url == WEB_APP_URL && (!groupChatReceived || webhook.type == "groupChatReceived")) {
    fetch("https://habitica.com/api/v3/user/webhook/" + webhook.id, DELETE_PARAMS);
  }
}

}
}

function createWebhooks(groupChatReceived) {

let webhooks = [];

if (!groupChatReceived) {

// task scored
if (AUTO_CAST_SKILLS === true || AUTO_PAUSE_RESUME_DAMAGE === true || AUTO_ALLOCATE_STAT_POINTS === true || AUTO_PURCHASE_GEMS === true || AUTO_PURCHASE_ARMOIRES === true || AUTO_SELL_EGGS === true || AUTO_SELL_HATCHING_POTIONS === true || AUTO_SELL_FOOD === true || AUTO_HATCH_FEED_PETS === true) {
  webhooks.push({
    "type": "taskActivity",
    "options": {
      "scored": true
    }
  });
}

// level up
if (AUTO_PAUSE_RESUME_DAMAGE === true || AUTO_ALLOCATE_STAT_POINTS === true) {
  webhooks.push({
    "type": "userActivity",
    "options": {
      "leveledUp": true
    }
  });
}

let questActivityOptions = {};

// quest invited
if (AUTO_ACCEPT_QUEST_INVITES === true || FORCE_START_QUESTS === true || NOTIFY_ON_QUEST_END === true || AUTO_PAUSE_RESUME_DAMAGE === true) {
  Object.assign(questActivityOptions, {
    "questInvited": true
  });
}

// quest started
if (FORCE_START_QUESTS === true) {
  Object.assign(questActivityOptions, {
    "questStarted": true
  });
}

// quest finished
if (AUTO_INVITE_GOLD_QUESTS === true || AUTO_INVITE_UNLOCKABLE_QUESTS === true || AUTO_INVITE_PET_QUESTS === true || AUTO_INVITE_HOURGLASS_QUESTS === true || NOTIFY_ON_QUEST_END === true || AUTO_PURCHASE_GEMS === true || AUTO_PURCHASE_ARMOIRES === true || AUTO_SELL_EGGS === true || AUTO_SELL_HATCHING_POTIONS === true || AUTO_SELL_FOOD === true || AUTO_HATCH_FEED_PETS === true) {
  Object.assign(questActivityOptions, {
    "questFinished": true
  });
}
if (Object.keys(questActivityOptions).length > 0) {
  webhooks.push({
    "type": "questActivity",
    "options": questActivityOptions
  });
}

}

// group chat received
if (HIDE_PARTY_NOTIFICATIONS === true && getUser().party._id) {
scriptProperties.setProperty("HIDE_NOTIFICATIONS_PARTY", user.party._id);
webhooks.push({
"type": "groupChatReceived",
"options": {
"groupId": user.party._id
}
});
}
if (HIDE_ALL_GUILD_NOTIFICATIONS === true) {
scriptProperties.setProperty("HIDE_NOTIFICATIONS_GUILDS", getUser().guilds.join());
for (let guild of user.guilds) {
webhooks.push({
"type": "groupChatReceived",
"options": {
"groupId": guild
}
});
}
} else {
for (let guild of HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS) {
if (guild !== "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") {
webhooks.push({
"type": "groupChatReceived",
"options": {
"groupId": guild
}
});
}
}
}

// create webhooks
if (webhooks.length > 0) {

if (!groupChatReceived) {
  console.log("Creating webhooks");
} else {
  console.log("Creating groupChatReceived webhooks");
}

for (let webhook of webhooks) {
  webhook = Object.assign({
    "url": WEB_APP_URL,
    "label": DriveApp.getFileById(ScriptApp.getScriptId()).getName()
  }, webhook);
  webhook = Object.assign({
    "contentType": "application/json",
    "payload": JSON.stringify(webhook)
  }, POST_PARAMS);
  fetch("https://habitica.com/api/v3/user/webhook", webhook);
}

}
}`

Before Cron skills not working

What is the bug?
Before Cron skills are not working, if the user has his day start at 00:00 / 12 am and AUTO_CRON is disabled

Additional context
After some debugging I found nowAdjusted.getHours() == dayStart-1 not to be working, since dayStart will be 0 and Date.getHours() will never return 0 - 1 = -1.

How often does this happen?
Every time given

  • AUTO_CRON is disabled
  • AND
  • day start is at 00:00

Script version
Automate Habitica v0.29.32 (beta) by @bumbleshoot

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = false;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = false;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = true;
const STAT_TO_ALLOCATE = "str"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 10000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

Auto Cast Skills documentation unclear

I'm not sure if this is user error or a bug, but I've noticed that the script doesn't seem to leave 45 mana to cast stealth, it still casts tools of the trade perfectly though.

Exception: Service invoked too many times for one day: urlfetch.

What is the bug?

Exception: Service invoked too many times for one day: urlfetch.
at fetch (global:576:32)
at getUser (global:720:14)
at pauseResumeDamage (automations/pauseResumeDamage:23:17)
at processQueue (global:341:13)
at doPost (global:88:5)
at GS_INTERNAL_top_function_call.gs:1:8

Exception: Service invoked too many times for one day: urlfetch.
at fetch (global:576:32)
at getUser (global:720:14)
at getTotalStat (global:664:13)
at castValorousPresence (automations/castWarriorSkills:33:17)
at useExcessMana (global:530:5)
at processQueue (global:388:11)
at onTrigger (global:27:5)
at GS_INTERNAL_top_function_call.gs:1:8

Additional context

This is happening on only one of my email addresses that has Automate Habitica running. I have two other scripts running on really sparse triggers (once per day, and 3x per day).

How often does this happen?

On my account, this happens daily, and when it starts, it will send me anywhere from 50-150 emails over the course of the day, with several varitations on the above error message, one apparently for each function trying to run.

Script version

v0.29.15

Script settings

const AUTO_CRON = true; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = false;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = false;

const NOTIFY_ON_QUEST_END = false;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = true;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "str"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 1000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = false;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

Error: "You already have maximum health."

What is the bug?
received an error message -- yep, I'm at full health... why'd it try?
---------- Forwarded message ---------- From: [email protected] Date: Mar 27, 2023, 08:05 -0700 To: [email protected] Subject: Automate Habitica failed!

Error: Request failed for https://habitica.com/ returned code 401. Truncated server response: {"success":false,"error":"NotAuthorized","message":"You already have maximum health."} at fetch (global:604:13) at healParty (automations/castHealerSkills:131:7) at processQueue (global:358:11) at onTrigger (global:27:5) at GS_INTERNAL_top_function_call.gs:1:8

Additional context
Umm it was just a normal day.

How often does this happen?
it only happened once.

Script version
Umm it was pretty up to date. I don't know & have deleted to get the latest version

Script settings


const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = true; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 2; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = true;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = false; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 300;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = true;
const HIDE_ALL_GUILD_NOTIFICATIONS = true;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

Getting error "Task not found" in Automate Habitica v0.29.22

What is the bug?
Receiving emails:
Automate Habitica v0.29.22 failed!

Error: Request failed for https://habitica.com returned code 404. Truncated
server response: {"success":false,"error":"NotFound","message":"Task not
found."}
at fetch (global:604:13)
at burnBossAndDumpMana (automations/castMageSkills:146:11)
at beforeCronSkills (global:493:5)
at processQueue (global:368:11)
at onTrigger (global:27:5)
at GS_INTERNAL_top_function_call.gs:1:8

Additional context
I upgraded the Automate Habitica to version v0.29.22 on April 2 and started receiving the error message shown above via email.
Note that I'm a party leader and have FORCE_START_QUESTS enabled.

How often does this happen?
The timestamps on the emails were approximately every 10 minutes. They stopped once I set auto_cast_skills to false.

Script version
v0.29.22

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = true; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = true;
const AUTO_INVITE_HOURGLASS_QUESTS = true;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = true;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = false; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 1000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = false;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]```

Checks into inn, setting set to false.

What is the bug?
The script auto checks me into the inn several times a day even though the auto resume damage is set to false. I followed the instructions to change the settings but it did not resolve the issue.

Additional context
There is always a quest invited or currently running when it happens, but again, the setting is set to false.

How often does this happen?
Several times a day

Script version
29.32

Script settings

const AUTO_CRON = true; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = true; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 24; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = false;
const RESERVE_GOLD = 50000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want

Subscriber gems not bought

What is the bug?
When trying to buy subscriber gems, my active subscription isn't detected properly.

Additional context
I already debugged the function purchaseGems() and the first if clause evaluates to false.
For reference, here is the content of my plan (without customerId):

{ consecutive: { count: 2, offset: 10, gemCapExtra: 20, trinkets: 0 },
  quantity: 1,
  extraMonths: 0,
  perkMonthCount: 0,
  gemsBought: 0,
  mysteryItems: [],
  dateUpdated: '2023-05-01T07:03:10.349Z',
  customerId: '######################',
  dateCreated: '2023-03-28T17:51:15.650Z',
  dateCurrentTypeCreated: '2023-03-28T17:51:15.650Z',
  dateTerminated: null,
  lastReminderDate: null,
  owner: 'b477462a-5bb5-4040-9505-f0b049b4f0bb',
  paymentMethod: 'Paypal',
  planId: 'basic_12mo' }

How often does this happen?
On every try.

Script version
Automate Habitica v0.29.32 (beta) by @bumbleshoot

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = false;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = false;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = true;
const STAT_TO_ALLOCATE = "str"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 10000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

Error message email: "SyntaxError: Expected double-quoted property name in JSON at position 25821957"

What is the bug?
SyntaxError: Expected double-quoted property name in JSON at position
25821957
at JSON.parse ()
at getUser (global:722:21)
at getTotalStat (global:674:39)
at pauseResumeDamage (automations/pauseResumeDamage:33:13)
at processQueue (global:339:13)
at onTrigger (global:27:5)
at GS_INTERNAL_top_function_call.gs:1:8

Additional context
None.

How often does this happen?
I've only seen this error once.

Script version
v0.29.20 (beta)

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = true;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = false;
const RESERVE_GOLD = 50000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want

After Habitica update, pauseResumeDamage not functioning

What is the bug?
My party members have experienced not being checked into the inn when exceeding max damage limits and not being checked out of the inn otherwise

Additional context
Multiple party members have been using this script and their settings for months. Not sure why it stopped working recently. Maybe the new Habitica update?

How often does this happen?
Every cron

Script version
v0.29.35 (beta) - I believe this is the last available version

Script settings

const AUTO_CRON = true; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = true; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = true;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 49;
const MAX_PARTY_DAMAGE = 10;

const AUTO_ALLOCATE_STAT_POINTS = true;
const STAT_TO_ALLOCATE = "str"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 5000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = false;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

Improvement: Implement `STAT_TO_ALLOCATE = "auto"`

What is the suggestion?
Provide an automatic selection mode for STAT_TO_ALLOCATE, that allocates stat points depending on the current class of the user.

Additional context
Every class has a different main stat, that its skills are based on. When changing classes, one must remember to change the configuration of Automate Habitica. It would be quite easy to implement an automatic mode, that simply allocates the main stat for the current class of the user.

Script settings
The settings could then look like this:

const STAT_TO_ALLOCATE = "auto"; // str, int, con, per, auto

trouble with cron

What is the bug?
I'm unable to cron. Everything else seem fine, The script casts skills.

Additional context
Yesterday, I received the following email. But after that things seems okay and the script was able to cast skills. Today, the character didn't cron when I open the app (and then browser). My cron time is +2. In tool.habitica it seems I completed some of dailies Thursday (yesterday) and some them on Friday (my late dailies are marked on friday). I marked some of my dailies around 1 am. More explicitly, let's say the I have dailies A,B,C. The daily A seems completed on Thursday while daily B (the one I clicked around 1 am) seems completed on Friday. And the daily A on Friday seems like gray (-). But in Habitica I can only see the daily C which I didn't complete and it didn't damage me. And my Friday-specific dailies didn't appear.

Error: Request failed for https://habitica.com/ returned code 502. Truncated
server response:

<title>502 Server Error</title>

Error: Server Error

The server encountered a temporary error and could not complete your request.

Please try again in 30 seconds.

 at fetch (global:638:13)
 at castEarthquake (automations/castMageSkills:55:7)
 at afterCronSkills (global:526:7)
 at processQueue (global:374:11)
 at onTrigger (global:27:5)
 at __GS_INTERNAL_top_function_call__.gs:1:8

How often does this happen?
Only once

Script version/**

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = true;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = false; // subscribers only

const AUTO_PURCHASE_ARMOIRES = false;
const RESERVE_GOLD = 50000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = false;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

Auto inn with no quest or damage pending

What is the bug?
The script automatically checks me into the in even though there is not a quest running therefore no damage pending.

Additional context
If I check myself out it just puts me right back in.

How often does this happen?
Several times a day

Script version
0.29.32

Script settings

const AUTO_CRON = true; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = true; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 24; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = false;
const RESERVE_GOLD = 50000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

After Cron skills not working

What is the bug?
After Cron skills are not working, if AUTO_CRON is disabled.

Additional context
Comparing lastCron to lastAfterCron always leads to a false result, since let lastAfterCron = new Date(properties["LAST_AFTER_CRON"]); never gives a valid date object - the only place the property is set is within the if clause that is not working due to the property not being set.

How often does this happen?
Every time given AUTO_CRON is disabled.

Script version
Automate Habitica v0.29.32 (beta) by @bumbleshoot

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = false;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = false;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = false;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = true;
const STAT_TO_ALLOCATE = "str"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = true;
const RESERVE_GOLD = 10000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want
]

"When a quest is finished or the user is invited to a quest" webhook disabled

What is the bug?
"When a quest is finished or the user is invited to a quest" webhook disabled repeatedly.

Additional context
None...

How often does this happen?
Once every few days, for the last 6 weeks or so.

Script version
Version: v0.29.20 (beta)

Script settings

const AUTO_CRON = false; // true or false

const AUTO_ACCEPT_QUEST_INVITES = true;

const FORCE_START_QUESTS = false; // party leaders only
const FORCE_START_QUESTS_AFTER_HOURS = 1; // eg. if set to 1, quests will force start after 1h
const NOTIFY_MEMBERS_EXCLUDED_FROM_QUEST = true;

const AUTO_INVITE_GOLD_QUESTS = false;
const AUTO_INVITE_UNLOCKABLE_QUESTS = false;
const AUTO_INVITE_PET_QUESTS = false;
const AUTO_INVITE_HOURGLASS_QUESTS = false;
const PM_WHEN_OUT_OF_QUEST_SCROLLS = true;

const NOTIFY_ON_QUEST_END = true;

const AUTO_CAST_SKILLS = true;

const AUTO_PAUSE_RESUME_DAMAGE = true;
const MAX_PLAYER_DAMAGE = 20;
const MAX_PARTY_DAMAGE = 5;

const AUTO_ALLOCATE_STAT_POINTS = false;
const STAT_TO_ALLOCATE = "int"; // str, int, con, per

const AUTO_PURCHASE_GEMS = true; // subscribers only

const AUTO_PURCHASE_ARMOIRES = false;
const RESERVE_GOLD = 50000;

const AUTO_SELL_EGGS = false;
const RESERVE_EGGS = 999;

const AUTO_SELL_HATCHING_POTIONS = false;
const RESERVE_HATCHING_POTIONS = 999;

const AUTO_SELL_FOOD = false;
const RESERVE_FOOD = 999;

const AUTO_HATCH_FEED_PETS = true;
const ONLY_USE_DROP_FOOD = true;

const HIDE_PARTY_NOTIFICATIONS = false;
const HIDE_ALL_GUILD_NOTIFICATIONS = false;
const HIDE_NOTIFICATIONS_FROM_SPECIFIC_GUILDS = [ // only used if HIDE_ALL_GUILD_NOTIFICATIONS is false
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // enter a guild ID between the quotes to hide notifications from that guild
  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // repeat for as many guilds as you want

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.