@@ -438,12 +438,16 @@ class LinksAwakeningContext(CommonContext):
438
438
found_checks = []
439
439
last_resend = time .time ()
440
440
441
- magpie = MagpieBridge ()
441
+ magpie_enabled = False
442
+ magpie = None
442
443
magpie_task = None
443
444
won = False
444
445
445
- def __init__ (self , server_address : typing .Optional [str ], password : typing .Optional [str ]) -> None :
446
+ def __init__ (self , server_address : typing .Optional [str ], password : typing .Optional [str ], magpie : typing . Optional [ bool ] ) -> None :
446
447
self .client = LinksAwakeningClient ()
448
+ if magpie :
449
+ self .magpie_enabled = True
450
+ self .magpie = MagpieBridge ()
447
451
super ().__init__ (server_address , password )
448
452
449
453
def run_gui (self ) -> None :
@@ -462,16 +466,17 @@ class LADXManager(GameManager):
462
466
def build (self ):
463
467
b = super ().build ()
464
468
465
- button = Button (text = "" , size = (30 , 30 ), size_hint_x = None ,
466
- on_press = lambda _ : webbrowser .open ('https://magpietracker.us/?enable_autotracker=1' ))
467
- image = Image (size = (16 , 16 ), texture = magpie_logo ())
468
- button .add_widget (image )
469
+ if self .ctx .magpie_enabled :
470
+ button = Button (text = "" , size = (30 , 30 ), size_hint_x = None ,
471
+ on_press = lambda _ : webbrowser .open ('https://magpietracker.us/?enable_autotracker=1' ))
472
+ image = Image (size = (16 , 16 ), texture = magpie_logo ())
473
+ button .add_widget (image )
469
474
470
- def set_center (_ , center ):
471
- image .center = center
472
- button .bind (center = set_center )
475
+ def set_center (_ , center ):
476
+ image .center = center
477
+ button .bind (center = set_center )
473
478
474
- self .connect_layout .add_widget (button )
479
+ self .connect_layout .add_widget (button )
475
480
return b
476
481
477
482
self .ui = LADXManager (self )
@@ -506,7 +511,8 @@ async def on_deathlink(self, data: typing.Dict[str, typing.Any]) -> None:
506
511
def new_checks (self , item_ids , ladxr_ids ):
507
512
self .found_checks += item_ids
508
513
create_task_log_exception (self .send_checks ())
509
- create_task_log_exception (self .magpie .send_new_checks (ladxr_ids ))
514
+ if self .magpie_enabled :
515
+ create_task_log_exception (self .magpie .send_new_checks (ladxr_ids ))
510
516
511
517
async def server_auth (self , password_requested : bool = False ):
512
518
if password_requested and not self .password :
@@ -537,7 +543,8 @@ async def victory():
537
543
async def deathlink ():
538
544
await self .send_deathlink ()
539
545
540
- self .magpie_task = asyncio .create_task (self .magpie .serve ())
546
+ if self .magpie_enabled :
547
+ self .magpie_task = asyncio .create_task (self .magpie .serve ())
541
548
542
549
# yield to allow UI to start
543
550
await asyncio .sleep (0 )
@@ -558,9 +565,10 @@ async def deathlink():
558
565
if self .last_resend + 5.0 < now :
559
566
self .last_resend = now
560
567
await self .send_checks ()
561
- self .magpie .set_checks (self .client .tracker .all_checks )
562
- await self .magpie .set_item_tracker (self .client .item_tracker )
563
- await self .magpie .send_gps (self .client .gps_tracker )
568
+ if self .magpie_enabled :
569
+ self .magpie .set_checks (self .client .tracker .all_checks )
570
+ await self .magpie .set_item_tracker (self .client .item_tracker )
571
+ await self .magpie .send_gps (self .client .gps_tracker )
564
572
565
573
except GameboyException :
566
574
time .sleep (1.0 )
@@ -570,9 +578,11 @@ async def deathlink():
570
578
async def main ():
571
579
parser = get_base_parser (description = "Link's Awakening Client." )
572
580
parser .add_argument ("--url" , help = "Archipelago connection url" )
581
+ parser .add_argument ("--no-magpie" , dest = 'magpie' , default = True , action = 'store_false' , help = "Disable magpie bridge" )
573
582
574
583
parser .add_argument ('diff_file' , default = "" , type = str , nargs = "?" ,
575
584
help = 'Path to a .apladx Archipelago Binary Patch file' )
585
+
576
586
args = parser .parse_args ()
577
587
logger .info (args )
578
588
@@ -590,7 +600,7 @@ async def main():
590
600
if url .password :
591
601
args .password = urllib .parse .unquote (url .password )
592
602
593
- ctx = LinksAwakeningContext (args .connect , args .password )
603
+ ctx = LinksAwakeningContext (args .connect , args .password , args . magpie )
594
604
595
605
ctx .server_task = asyncio .create_task (server_loop (ctx ), name = "server loop" )
596
606
0 commit comments