File size: 1,542 Bytes
4c75d73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
"""

Test script for the auto-discovery system

"""

from src.core.game_engine import GameEngine
from src.interfaces.npc_addon import get_registered_addons

def test_autodiscovery():
    print("Testing auto-discovery system...")
    
    # Create game engine to trigger addon discovery
    engine = GameEngine()
    engine.start()
    
    # Check what addons were discovered
    addons = get_registered_addons()
    print(f"\nDiscovered addons: {len(addons)}")
    
    for addon_id, addon in addons.items():
        print(f"  - {addon_id}: {addon.addon_name}")
        
        if hasattr(addon, 'npc_config') and addon.npc_config:
            config = addon.npc_config
            print(f"    NPC: {config['id']} at position ({config['x']}, {config['y']})")
            
        if hasattr(addon, 'ui_tab_name') and addon.ui_tab_name:
            print(f"    UI Tab: {addon.ui_tab_name}")
    
    # Check if weather oracle was discovered
    if 'weather_oracle' in addons:
        print("\n✅ Weather Oracle addon successfully auto-discovered!")
    else:
        print("\n❌ Weather Oracle addon NOT discovered")
    
    # Check if fortune teller was discovered
    if 'fortune_teller' in addons:
        print("✅ Fortune Teller addon successfully auto-discovered!")
    else:
        print("❌ Fortune Teller addon NOT discovered")
    
    print(f"\nTotal addons discovered: {len(addons)}")
    engine.stop()

if __name__ == "__main__":
    test_autodiscovery()