Initial release: PokeRogue Type Effectiveness extension
Chrome/Firefox MV3 extension that shows move type effectiveness during PokeRogue battles. Features: - Auto-detects battle state via Phaser game bridge (MAIN world) - Shows effectiveness multiplier, base power, and physical/special category - Supports single and double battles - Manual type calculator mode as fallback - Draggable overlay with dark theme matching PokeRogue aesthetic - Settings popup with position, opacity, and display options - Complete Gen 6+ type chart (18 types) from PokeRogue source data - Type colors matching PokeRogue's own color scheme
This commit is contained in:
40
service-worker.js
Normal file
40
service-worker.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* PokeRogue Type Effectiveness - Service Worker (Background)
|
||||
*
|
||||
* Handles extension lifecycle events and message routing.
|
||||
*/
|
||||
|
||||
// Default settings applied on install
|
||||
const DEFAULT_SETTINGS = {
|
||||
enabled: true,
|
||||
position: 'top-right',
|
||||
opacity: 90,
|
||||
showPower: true,
|
||||
showCategory: true,
|
||||
showMoveNames: true,
|
||||
compactMode: false,
|
||||
manualMode: false,
|
||||
manualEnemyTypes: []
|
||||
};
|
||||
|
||||
// On install, set default settings
|
||||
chrome.runtime.onInstalled.addListener((details) => {
|
||||
if (details.reason === 'install') {
|
||||
chrome.storage.local.set({ settings: DEFAULT_SETTINGS });
|
||||
console.log('[PokeRogue Ext] Installed with default settings');
|
||||
}
|
||||
});
|
||||
|
||||
// Handle messages from popup or content scripts
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message.type === 'GET_SETTINGS') {
|
||||
chrome.storage.local.get(['settings'], (result) => {
|
||||
sendResponse(result.settings || DEFAULT_SETTINGS);
|
||||
});
|
||||
return true; // async response
|
||||
}
|
||||
|
||||
if (message.type === 'PING') {
|
||||
sendResponse({ pong: true, version: '1.0.0' });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user