Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
237 commits
Select commit Hold shift + click to select a range
7b81ad9
Add comprehensive documentation for Arena Auto-Attack feature
mailming Oct 19, 2025
4b9d07b
Fix arena auto-attack error handling and API response validation
mailming Oct 19, 2025
6740c02
Fix arena peace time handling and add missing I18N constants
mailming Oct 19, 2025
9f6aa35
Fix Arena Auto-Attack error handling for API error responses
mailming Oct 19, 2025
a6fd5ee
Improve Arena Auto-Attack error handling with detailed error messages
mailming Oct 19, 2025
2488b64
Add fallback mechanism for Grand Arena API and improve error handling…
mailming Oct 19, 2025
b35ed40
Add detailed logging for Arena API responses and errors
mailming Oct 19, 2025
050beb5
Fix Arena Auto-Attack to use correct API calls (arenaCheckTargetRange)
mailming Oct 19, 2025
aa6e12f
Update Arena Auto-Attack API calls to match real game API structure
mailming Oct 19, 2025
2e342b2
Add enhanced API monitoring with captureAllAPICalls function
mailming Oct 19, 2025
97a15fc
Update Arena Auto-Attack with correct API structure
mailming Oct 19, 2025
9c496d7
Fix Arena Auto-Attack errors
mailming Oct 20, 2025
e9ead03
Fix Arena Auto-Attack with correct API calls
mailming Oct 20, 2025
bab7eaa
Fix Arena Auto-Attack userId error
mailming Oct 20, 2025
7a6f4ba
Implement proper opponent list retrieval for Arena Auto-Attack
mailming Oct 20, 2025
5162faf
Fix Arena Auto-Attack API compatibility issues
mailming Oct 20, 2025
044037a
Fix Arena Auto-Attack opponent processing
mailming Oct 20, 2025
fd9c13b
Fix Arena Auto-Attack opponent data assignment
mailming Oct 20, 2025
02ed715
Fix Arena Auto-Attack opponent data structure
mailming Oct 20, 2025
72f55a1
Fix Arena Auto-Attack opponent team data
mailming Oct 20, 2025
3fcbfcf
Fix Arena Auto-Attack hero data structure
mailming Oct 20, 2025
c159d9e
Fix Arena Auto-Attack battle execution
mailming Oct 20, 2025
736d37d
Fix Arena Auto-Attack API response validation
mailming Oct 20, 2025
f86c760
Improve Arena Auto-Attack error handling
mailming Oct 20, 2025
9957f65
Update Arena Auto-Attack opponent IDs
mailming Oct 20, 2025
98029a2
Use real opponent IDs from Network tab
mailming Oct 20, 2025
7504f00
Add development workflow documentation
mailming Oct 20, 2025
fd90f98
Fix Grand Arena API integration
mailming Oct 21, 2025
da8e4e4
Update Arena and Grand Arena functionality with correct API calls
mailming Oct 26, 2025
c8777cb
Add comprehensive API monitoring Tampermonkey script
mailming Oct 27, 2025
5d69f0f
Add file logging functionality to API monitor
mailming Oct 27, 2025
1c629d5
Fix API monitor button onclick errors and optimize for file logging
mailming Oct 27, 2025
96e59cb
Add debug logging to troubleshoot file download issues
mailming Oct 27, 2025
e3314be
Add debug test for GM_download function
mailming Oct 27, 2025
1d3fb30
Enable UI for testing and debugging
mailming Oct 27, 2025
c9d2760
Add simple test script to verify Tampermonkey is working
mailming Oct 27, 2025
c8308e8
Fix TrustedHTML errors and improve API monitoring
mailming Oct 27, 2025
1b17aad
Add log file management system for project directory
mailming Oct 27, 2025
b29c10b
Fix PowerShell script syntax errors
mailming Oct 27, 2025
5a3ae79
Fix HAR export Object.entries error
mailming Oct 27, 2025
732c764
Rename script to generic API Monitor
mailming Oct 27, 2025
12d7b18
Fix manual Write Logs button to capture all data
mailming Oct 27, 2025
372ffe4
Disable test API calls to httpbin.org
mailming Oct 27, 2025
cbbca02
Add auto-update URLs for Tampermonkey
mailming Oct 27, 2025
1b06dbd
Fix syntax error - remove extra closing brace
mailming Oct 27, 2025
6e69ad5
Fix syntax issues in api-monitor.user.js
mailming Oct 27, 2025
1f09bf5
Update api-monitor.user.js v3.0 with lib.data monitoring for hero-war…
mailming Oct 27, 2025
3912e51
Fix download mechanism - replace GM_download with proper Blob download
mailming Oct 27, 2025
96fe39c
Disable lib.data monitoring by default
mailming Oct 27, 2025
25bf2ed
Remove automatic test file generation
mailming Oct 27, 2025
2efba75
Add debugging and expand match patterns for API monitoring
mailming Oct 27, 2025
a5773cf
Revert match patterns and add comprehensive debugging for logging issue
mailming Oct 27, 2025
0ea37b9
Fix arena team configuration to use system pre-configured teams
mailming Oct 28, 2025
d4bc1db
Add comprehensive TeamGetAll API documentation
mailming Oct 28, 2025
5dd51fe
Fix code formatting and whitespace
mailming Oct 28, 2025
7800685
Add Tuesday auto-run feature for minions attack
mailming Oct 28, 2025
dd8f8bb
Change minions auto-run from Tuesday to Monday
mailming Oct 28, 2025
a056e4d
Add debugging and fix potential arena issues
mailming Oct 28, 2025
a79afdd
Revert "Add debugging and fix potential arena issues"
mailming Oct 28, 2025
4bf76ee
Implement Guild War auto attack feature
mailming Oct 28, 2025
b9ceae4
Add project documentation and cleanup
mailming Oct 28, 2025
1582383
Simplify Guild War attack logic to use arena team configuration
mailming Oct 28, 2025
b55b3b8
Update updateURL to point to GitHub repository
mailming Oct 29, 2025
bd83442
Fix auto raid mission execution order and add comprehensive logging
Oct 29, 2025
01ae3b1
Add debug logging for auto raid mission execution
Oct 29, 2025
5d41209
Add debug logging for raid missions API and filtering
Oct 29, 2025
8681709
Fix auto raid mission: convert missions object to array and filter by…
Oct 29, 2025
8b2cd58
Simplify auto raid mission: use direct API call based on HAR file
Oct 29, 2025
b872bf1
Update Guild War: Add Titan battles support for slots 8 and 9, update…
mailming Nov 3, 2025
5ad615e
Merge branch 'develop' of https://github.com/mailming/AutoHero into d…
mailming Nov 3, 2025
7f1d2e1
Add Secret Wealth Shop extension with manual purchase buttons for con…
mailming Nov 4, 2025
d989ce7
Add Secret Wealth Shop API documentation and extension v1.1 with fixe…
mailming Nov 4, 2025
26aa721
Revert "Add Secret Wealth Shop API documentation and extension v1.1 w…
mailming Nov 4, 2025
886650a
Update Secret Wealth Shop extension v1.2: Always auto-purchase slot 6…
mailming Nov 4, 2025
b5d22be
Update Secret Wealth Shop extension: Fix downloadURL to point to GitH…
mailming Nov 4, 2025
1ea9846
Fix Secret Wealth Shop extension popup bug: Properly await popup prom…
mailming Nov 4, 2025
5026d14
Add AutoBattle extension and Secret Wealth Shop API documentation
mailming Nov 4, 2025
8091dc3
Add cursor rules and extension development documentation
mailming Nov 4, 2025
9b3da00
Add Titan Artifact Shop API documentation and update Advanced Auto-Bu…
mailming Nov 4, 2025
1113f44
Fix popup closing issue and add bulk purchase amount setting for Tita…
mailming Nov 4, 2025
c311085
Fix purchase result detection and submit individual API calls per item
mailming Nov 4, 2025
229544d
Add COW API documentation, requirements.txt, and schedule processing …
mailming Nov 5, 2025
9d176ef
Move Gmail credentials to .env file for security
Nov 5, 2025
5439bc7
Add comprehensive Hero Wars API documentation
mailming Nov 6, 2025
5ed3b3f
Merge branch 'develop' of https://github.com/mailming/AutoHero into d…
mailming Nov 6, 2025
c013f18
Consolidate all API documentation into HERO_WARS_API_DOCUMENTATION.md
mailming Nov 7, 2025
ff519c4
Add Guild Raid Boss API documentation with all 5 attack examples
Nov 7, 2025
01dd1c3
Add API Debugger extension for testing and debugging all Hero Wars AP…
mailming Nov 8, 2025
114b880
Add Raid Boss auto-attack feature and update documentation
mailming Nov 8, 2025
303f76c
Add HeroWarsHelper Auto Daily Extension v3.0.2
mailming Nov 9, 2025
b0018a3
Merge branch 'develop' of https://github.com/mailming/AutoHero into d…
mailming Nov 9, 2025
af7ad4a
Fix insertBefore error in createCustomOthersButton - verify reference…
mailming Nov 9, 2025
d081087
Fix null reference errors in applySyncButtonState - add null checks f…
mailming Nov 9, 2025
890985a
Bump version to 3.0.3 and rename file
mailming Nov 9, 2025
2cfb489
Fix executeQuestAllFarm to check quest state before farming - prevent…
mailming Nov 9, 2025
8b65529
Improve executeQuestAllFarm with stricter validation and debug loggin…
mailming Nov 9, 2025
a74cad8
Revert executeQuestAllFarm to match working version - use loose equal…
mailming Nov 9, 2025
1fbed0a
Update executeQuestAllFarm to use API state check - only collect ques…
mailming Nov 9, 2025
af2d5c1
Fix executeSingleTask to check quest state before executing - prevent…
mailming Nov 9, 2025
9e89695
Match main script quest state logic - only execute quests with state …
mailming Nov 9, 2025
81ba984
Add detailed console logging to executeSingleTask for debugging quest…
mailming Nov 9, 2025
acc2edd
Add dynamic Secret Wealth Shop detection by pattern matching (ends wi…
Nov 11, 2025
44c5afb
Add pre-check for List view and reduce XPath debug verbosity in scrap…
Nov 12, 2025
75d6ebd
Fix Advanced Auto-Buyer menu blocking issue - Move auto-execution aft…
mailming Nov 13, 2025
f00de84
Fix popup interference causing all menu buttons to show autobuy form …
mailming Nov 13, 2025
cb0b25f
Clean up unused code and improve popup cleanup - Remove unused Send i…
mailming Nov 13, 2025
2e68ec1
Redesign menu buttons using HWHhuntFragmentExt pattern - Fix popup in…
mailming Nov 13, 2025
bbdd56a
Fix auto-buy button visibility - Revert to scriptMenu.addCombinedButt…
mailming Nov 14, 2025
9468931
Fix: Update version to 2.405 and fix extintionsList scope issue
Nov 14, 2025
8cffb8e
Update quest completion checks to use API documentation pattern - Use…
Nov 14, 2025
52d4687
Fix quest lookup issues in Auto Daily Extension - Add null checks, fi…
mailming Nov 14, 2025
e8381b5
Add HWHhuntFragmentExt reference file and questGetAll API debug results
mailming Nov 14, 2025
6b1bcbf
Reduce noise for missing quests - Silently skip quests not found in q…
mailming Nov 14, 2025
14f2cab
Fix quest execution - Try numeric keys first, execute even if isWeCan…
mailming Nov 14, 2025
0c2e31f
Revert "Fix quest execution - Try numeric keys first, execute even if…
mailming Nov 14, 2025
ab9b8af
Restore quest execution improvements - Try numeric keys first, add de…
mailming Nov 14, 2025
9b033b5
Improve quest status messages - Clear messages for completed quests, …
mailming Nov 14, 2025
920d679
Rename file and bump version to 3.1 - Improved quest status messages …
mailming Nov 14, 2025
8bcba29
Remove unused file - HeroWarsHelper - Auto Daily Extension-3.0ok.user.js
mailming Nov 14, 2025
c0f61b7
Optimize questGetAll API calls and improve task status messages - Add…
mailming Nov 14, 2025
9e6b668
Change 'Not available' message to 'No Quest' for better clarity
mailming Nov 14, 2025
6be06fb
Add dungeon task to Auto Daily Extension - Add executeTestDungeon fun…
Nov 16, 2025
3912863
Add gacha_refill API to Auto Daily Extension and update API documenta…
Nov 16, 2025
33e5a8f
Bump version to 3.1.1 - Update @version metadata and EXTENSION_VERSIO…
Nov 16, 2025
190bc5d
Add API Repeater Extension - Record and replay API calls with auto-ex…
mailming Nov 17, 2025
5a4348b
Fix API Repeater initialization - wait for scriptMenu.mainMenu to be …
mailming Nov 17, 2025
1204a99
Add TOE (Tournament of Elements) auto-execution to AutoBattle extension
mailming Nov 17, 2025
7aa1ef2
Fix API Repeater: Change to document-start, improve XHR interception,…
mailming Nov 17, 2025
a845671
Improve API Repeater error handling: continue execution on failures, …
mailming Nov 17, 2025
347909a
Merge REWARDS_API_DOCUMENTATION.md into HERO_WARS_API_DOCUMENTATION.m…
mailming Nov 17, 2025
4cca518
Update Auto Daily Extension: Reuse doYourBest functions, integrate su…
mailming Nov 17, 2025
ecc2017
Add HWHAdvExt adventure extension with predefined paths
mailming Nov 17, 2025
ffbc0b2
Fix HWHAdvExt format issues: rename to .user.js, add proper HWH wait …
mailming Nov 17, 2025
86c7cc4
Add myTries validation for clanWarAttack and enhance API documentation
mailming Nov 17, 2025
fc54e84
Add API skip list to API Repeater extension - filter out specialOffer…
mailming Nov 17, 2025
5f52f65
Add auto-execution logic to HWHAdvExt: raid adventure if available, o…
mailming Nov 18, 2025
8e9ab86
Fix stashClient skip logic in API Repeater - add case-insensitive che…
mailming Nov 18, 2025
fc6385d
Add adventure configuration menu button with level input and auto-sta…
mailming Nov 18, 2025
16e982d
Update API Repeater: Rename menu button to 'Repeater' and add dedicat…
Nov 19, 2025
468b4d7
Update API documentation and remove old recording file
mailming Nov 19, 2025
1f6e95f
Optimize API Repeater extension performance: O(1) skip lookup, early …
mailming Nov 19, 2025
1c45195
Fix recording button state update and save popup: force button update…
mailming Nov 19, 2025
82fb9fd
Update API Repeater: merge imports with sequential IDs for duplicates…
mailming Nov 19, 2025
6bbda01
Add drag-and-drop reordering for recordings and API calls, expandable…
mailming Nov 19, 2025
1dc8516
Fix NotFound error in AutoBattle: Remove stashClient call that was ca…
Nov 19, 2025
a4d62c9
Update adventure extension: add default paths, start adventure button…
mailming Nov 19, 2025
0d771ea
Merge branch 'develop' of https://github.com/mailming/AutoHero into d…
mailming Nov 19, 2025
8a2673a
Rename HWHAdvExt to AutoAdventureExt and update version to 0.1.0
mailming Nov 23, 2025
a73320f
Update AutoAdventureExt and remove debug result files
mailming Nov 23, 2025
f04df47
Update arena simulator to match API documentation and fix opponent pr…
mailming Nov 23, 2025
9c5b47b
Auto-collect rewards and end adventure when 2 other players leave
mailming Nov 25, 2025
50b47c9
Fix reward collection: use total team points, ensure all rewards coll…
mailming Nov 25, 2025
3c768a2
Allow ending adventure when other players left, even if not all rewar…
mailming Nov 25, 2025
dceb6e0
Fix adventure end when other players leave - correct API response err…
mailming Nov 26, 2025
975a71d
Fix arena battle simulation: use first battle ID as parentId, improve…
mailming Dec 1, 2025
7ca90fa
Fix Guild War attempts tracking and clean up unused code
mailming Dec 1, 2025
fb97a9e
Add Guild War titan demo battle simulation and update attack slots
mailming Dec 1, 2025
2fd5f02
Fix Guild War error handling: log instead of throw exceptions
mailming Dec 1, 2025
e3c2990
Add Battle Simulation Recorder extension - Records demo battle result…
mailming Dec 1, 2025
cc58522
Update extensions and documentation, remove unused files
mailming Dec 2, 2025
d32644c
Add AutoGetPower feature to HWHGiftOfTheElementsExt - Auto-execute ge…
mailming Dec 2, 2025
b504e67
Fix dungeon NotFound error by ensuring dungeon functions execute last
Dec 4, 2025
5cdf0d4
Add arena team scraping script with email functionality
mailming Dec 7, 2025
134b908
Guild War: skip slot when team power < 50% of opponent
mailming Dec 14, 2025
255ef9d
Update docs/data + auto daily helper improvements
mailming Dec 14, 2025
484469d
Merge dungeon optimization algorithm and resolve conflicts
mailming Dec 15, 2025
7f5cedf
Fix: Edit popup now properly reopens main popup after updating recording
mailming Dec 15, 2025
13f72b6
Add Quest Farm API documentation and auto-quest collection feature
mailming Dec 16, 2025
6d70bcc
Merge version 3.9 updates into HWHGiftOfTheElementsExt
mailming Dec 16, 2025
a13e7c0
Fix XMLHttpRequest.send API contract violation in API Repeater
mailming Dec 16, 2025
018d99b
Fix quest collection when Auto Get Power amount is 0
mailming Dec 16, 2025
8ffb068
Add error handling for quests that don't meet farm requirements
mailming Dec 16, 2025
09a3533
Fix ReferenceError and add manual quest collection button
mailming Dec 16, 2025
62335a4
Update quest reward collection to use individual questFarm calls
mailming Dec 16, 2025
9fa4af0
Refactor and optimize HWHGiftOfTheElementsExt script
mailming Dec 16, 2025
59a3310
Update quest collection to only collect quests with ID > 1780000000
mailming Dec 16, 2025
c32581c
Add repeat count feature to API Repeater extension - Add repeat count…
mailming Dec 17, 2025
54d73be
Merge improved dungeon algorithm from HWD extension RED-1.0.7
mailming Dec 17, 2025
b465178
Add comprehensive Titan Data documentation
mailming Dec 17, 2025
01c83ed
Fix code issues and translate Russian text to English in Auto Daily E…
mailming Dec 17, 2025
ee3ec6f
API Repeater: fix duplicate recording, listener leaks, and bump to 1.1.1
mailming Dec 20, 2025
c73096e
Rename API Repeater to Action Replay (sequential auto-run + UI wording)
mailming Dec 20, 2025
868b22a
Add Cross Clan War auto-attack feature with popup menu for manual tri…
mailming Jan 2, 2026
50092aa
Fix Cross Clan War favor validation - ensure favor is always an object
mailming Jan 2, 2026
fd839ce
Refactor schedule parser and add auto-correction for date errors
Jan 8, 2026
7383938
Fix Cross Clan War favor parsing and add comprehensive error handling…
mailming Jan 12, 2026
8599e98
Fix Cross Clan War: Continue through all assigned battles and handle …
Jan 15, 2026
aa8eed6
Update HWHGiftOfTheElementsExt.user.js
mailming Jan 23, 2026
7f45266
Remove quest auto-collection feature and clean up unused code from HW…
mailming Feb 2, 2026
915b425
Fix const variable assignment error in upgradeTitanGifts function
mailming Feb 3, 2026
2b25a38
Improve dungeon healing titan priority and add documentation
Feb 18, 2026
035eb74
Merge branch 'develop' of https://github.com/mailming/AutoHero into d…
Feb 18, 2026
25722e2
Fix dungeon healer priority and battle logging
Feb 19, 2026
62d6c18
Skip guild and team allies in Arena and Grand Arena auto-battle.
mailming Jun 15, 2026
a8ef562
Use all arena attempts and fix Grand Arena target range ID handling.
mailming Jun 15, 2026
70909c9
Auto Daily: dungeon batch matches HWH (titanGetAll + inventory indices).
mailming Jun 17, 2026
11d1994
Replace Auto Daily dungeon runner with Stealther algorithm.
mailming Jul 1, 2026
18775d2
Fix dungeon hero battles and corrupted Auto Daily menu icons.
mailming Jul 1, 2026
d005d9a
Fix dungeonStartBattle API calls and bump Auto Daily to 3.2.0.
mailming Jul 1, 2026
846e7fc
Fix dungeon loop safety and batch door sims; bump to 3.2.1.
mailming Jul 1, 2026
af050e2
Add LLM Controller extension for external HeroWarsHelper automation.
mailming Jul 2, 2026
f56cf3d
Revert "Fix dungeon loop safety and batch door sims; bump to 3.2.1."
mailming Jul 10, 2026
089f712
Stabilize and speed up Auto Daily dungeon runner; bump to 3.2.3.
mailming Jul 15, 2026
e5ef636
Fix dungeon NotFound handling and auto-run interference; bump to 3.2.4.
mailming Jul 15, 2026
435932d
Coordinate AutoBattle and dungeon to prevent NotFound API conflicts.
mailming Jul 15, 2026
e421541
Restore Stealther-quality dungeon sim and door execution; bump to 3.2.6.
mailming Jul 15, 2026
296a3b6
Match Stealther bruteforce search and battle wait; bump to 3.2.7.
mailming Jul 17, 2026
5caa27f
Add Hero Wars Stealther v1.006 reference for dungeon algorithm.
mailming Jul 17, 2026
c3b84d8
Add localhost bridge for Cursor control and bump LLM Controller to v1.1.
mailming Aug 15, 2026
7cf534c
Add API recording for manual UI playthroughs and fix LLM dungeon exec…
mailming Aug 16, 2026
3d6c1dd
Add arena combo training with demo battles and bridge integration.
mailming Aug 16, 2026
220a7d4
Add loop arena training with automatic result saving to the bridge.
mailming Aug 16, 2026
22dcdd7
Add PostgreSQL arena training storage and topGet opponent sourcing.
mailming Aug 16, 2026
fdcf46d
Restructure arena training DB around opponent combo matchups.
mailming Aug 16, 2026
dda4124
Add scrollable training results UI and improve arena training defaults.
mailming Aug 17, 2026
b2c1909
Search exhaustively for 80%+ win rate combos per opponent.
mailming Aug 17, 2026
9920345
Add phased arena testing and DB skip-check for solved opponents.
mailming Aug 17, 2026
2f53a58
Add arena training setup runbook for bridge, PostgreSQL, and userscri…
mailming Aug 17, 2026
a9571af
Stop arena training loop on fatal InvalidSession errors.
mailming Aug 17, 2026
0b0bfda
Fix missing sleep helper breaking arena training loop after skipped r…
mailming Aug 17, 2026
54830e8
Add hw-recruit meta team scraping with HTML view and DB snapshots.
mailming Aug 17, 2026
9da36df
Add meta team phase to arena training after grand arena teams.
mailming Aug 17, 2026
917606d
Sync remaining local changes for multi-machine setup.
mailming Aug 17, 2026
5c15a70
Fix meta scrape pets, add training result filters, and raise win thre…
mailming Aug 18, 2026
b50217d
Add training results analytics and meta opponents phase to arena trai…
mailming Aug 18, 2026
c49f831
Fix Grand Arena selection when my combo filter is active.
mailming Aug 19, 2026
44c0ec2
Reorganize training results page layout and improve readability.
mailming Aug 20, 2026
c4b4543
Add local hero icons and searchable filter pickers on training view.
mailming Aug 20, 2026
d1d2822
Add optional auto-start for arena training one minute after game load.
mailming Aug 20, 2026
b9e9e6b
Move arena training auto-start into HWH settings next to Auto Expedit…
mailming Aug 20, 2026
b8dedba
Register arena training auto-start checkbox from the extension (v1.16).
mailming Aug 20, 2026
bf105d3
Skip incomplete arena opponent teams instead of failing training roun…
mailming Aug 22, 2026
f327c69
Update Get Power to prioritize highest-power heroes up to gift level 29.
mailming Sep 1, 2026
e62a60e
Add automatic pruning of meta team snapshots older than 30 days.
mailming Sep 1, 2026
e71c78e
Add user-team validation loop and tester tracking for arena training.
mailming Sep 2, 2026
13f21d2
Skip duplicate user-team arena tests using a 30-day cache.
mailming Sep 2, 2026
c3e8214
Fix arena training skip cache for already-tested opponents.
mailming Sep 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Cursor Rules for AutoHero Project

## Extension Development Guidelines

### Creating HeroWarsHelper Extensions

When creating a new extension for HeroWarsHelper, follow this pattern:

1. **File Structure**: Create a `.user.js` file with the extension name
- Example: `Secret Wealth Shop HwH Ext.user.js`

2. **UserScript Header**: Include proper metadata
```javascript
// ==UserScript==
// @name Extension Name HwH Ext
// @namespace HeroWarsHelper.ExtensionName
// @version 1.0
// @description Brief description of the extension
// @author YourName
// @match https://www.hero-wars.com/*
// @match https://apps-1701433570146040.apps.fbsbx.com/*
// @grant none
// @run-at document-end
// @downloadURL https://github.com/mailming/AutoHero/raw/refs/heads/develop/Extension%20Name%20HwH%20Ext.user.js
// @updateURL https://github.com/mailming/AutoHero/raw/refs/heads/develop/Extension%20Name%20HwH%20Ext.user.js
// ==/UserScript==
```

3. **Initialization Pattern**: Always wait for HWH to be ready
```javascript
(function() {
'use strict';

const waitForHWH = setInterval(() => {
if (window.HWHClasses && window.HWHClasses.ScriptMenu && window.lib && window.cheats) {
const scriptMenu = window.HWHClasses.ScriptMenu.getInst();
if (scriptMenu && scriptMenu.mainMenu) {
clearInterval(waitForHWH);
initializeExtension();
}
}
}, 200);

function initializeExtension() {
console.log('Extension Name: HWH UI is ready, initializing extension...');

const { HWHClasses, HWHFuncs, Send, cheats, Caller, lib } = window;

// Your extension code here

// Add menu button
const { ScriptMenu } = HWHClasses;
const scriptMenu = ScriptMenu.getInst();
scriptMenu.addCombinedButton([
{ name: 'Extension Name', title: 'Description', onClick: yourFunction, color: 'purple' }
]);
}
})();
```

4. **Auto-Load on Script Run**: To execute code automatically when the script loads:
```javascript
function initializeExtension() {
// ... setup code ...

// Auto-execute function on script load
autoExecuteFunction().catch(error => {
console.error('Extension: Failed to auto-execute:', error);
});

// Add menu button
scriptMenu.addCombinedButton([...]);
}
```

5. **Popup Handling**: When using popups, always await the promise properly:
```javascript
async function openPopup() {
const popupContent = document.createElement('div');
// ... build popup content ...

// Use confirm with proper async handling
const popupPromise = HWHFuncs.popup.confirm('', [{ msg: 'Close', result: true, isClose: true }]);

// Wait a tick for popup to initialize
await new Promise(resolve => setTimeout(resolve, 0));

const popupBody = document.querySelector('.PopUp_Container');
if (popupBody) {
popupBody.innerHTML = '';
popupBody.appendChild(popupContent);
}

// Wait for popup to close before returning
await popupPromise;
}
```

6. **Available HWH APIs**:
- `HWHClasses.ScriptMenu` - Menu system
- `HWHFuncs.setProgress(text, hide)` - Progress messages
- `HWHFuncs.popup.confirm()` - Popup dialogs
- `Caller` - API call wrapper
- `cheats.translate(key)` - Translation system
- `Send()` - Direct API sending

7. **Best Practices**:
- Always check if HWH is ready before initializing
- Use proper error handling with try/catch
- Log important events to console
- Use HWHFuncs.setProgress for user feedback
- Follow existing code patterns from other extensions
- Use async/await for API calls
- Properly handle popup promises to prevent menu interference

8. **API Call Requirements**:
- **NEVER mock or fake API calls** - All API calls must be real and functional
- **Always verify API calls against documentation** - Check the relevant API documentation files:
- `ARENA_API_DOCUMENTATION.md` for Arena and Grand Arena APIs
- `GUILD_WAR_API_DOCUMENTATION.md` for Guild War APIs
- `CLAN_RAID_API_DOCUMENTATION.md` for Raid APIs
- `SECRET_WEALTH_SHOP_API_DOCUMENTATION.md` for Shop APIs
- **Follow exact API structure** - Match the request format exactly as documented:
- Include `name`, `args`, `context` (with `actionTs`), and `ident` fields
- Use correct parameter names and types as specified in documentation
- Ensure response handling matches documented response structure
- **Verify against working code** - If documentation is incomplete, verify against existing working implementations in `HeroWarsHelper.user.js`
- **Test API calls** - Ensure all API calls are tested and working before committing
- **No placeholder APIs** - Never use placeholder or example API calls that don't actually work

## Code Style

- Use meaningful variable names
- Add comments for complex logic
- Follow existing indentation (spaces, not tabs)
- Use consistent naming conventions
- Handle errors gracefully with user-friendly messages

2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# PostgreSQL connection for arena training results
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/autohero
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Virtual environments
venv/
env/
ENV/

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Logs and temporary files
*.log
*.tmp
*.bak

# Generated files (optional - uncomment if you don't want to track these)
# schedule_extracted.csv
# hero_wars_events_email.txt
# hero_wars_schedule.ics

# Node
node_modules/

# Environment variables
.env
Loading