88
99from rcon .connection import HLLCommandError , HLLConnection , Handle , Response
1010from rcon .maps import LAYERS , MAPS , UNKNOWN_MAP_NAME , Environment , GameMode , LayerType
11- from rcon .types import MapSequenceResponse , ServerInfoType , SlotsType , VipId , GameStateType , AdminType
11+ from rcon .types import MapRotationResponse , MapSequenceResponse , ServerInfoType , SlotsType , VipId , GameStateType , AdminType
1212from rcon .utils import exception_in_chain
1313
1414logger = logging .getLogger (__name__ )
@@ -347,8 +347,12 @@ def get_votekick_thresholds(self) -> list[list[int]]:
347347 thresholds = self .exchange ("GetVoteKickThreshold" , 2 ).content_dict ["voteThresholdList" ]
348348 return [[int (x ["playerCount" ]), int (x ["voteThreshold" ])] for x in thresholds ]
349349
350- def get_map_rotation (self ) -> list [str ]:
351- return [x ["iD" ] for x in self .exchange ("GetServerInformation" , 2 , {"Name" : "maprotation" , "Value" : "" }).content_dict ["mAPS" ]]
350+ def get_map_rotation (self ) -> MapRotationResponse :
351+ data = self .exchange ("GetServerInformation" , 2 , {"Name" : "maprotation" , "Value" : "" }).content_dict
352+ return {
353+ "maps" : [x ["iD" ] for x in data ["mAPS" ]],
354+ "current_index" : data ["currentIndex" ]
355+ }
352356
353357 def get_map_sequence (self ) -> MapSequenceResponse :
354358 data = self .exchange ("GetServerInformation" , 2 , {"Name" : "mapsequence" , "Value" : "" }).content_dict
@@ -481,7 +485,7 @@ def add_map_to_rotation(
481485 map_name : str ,
482486 after_map_name : str | None = None ,
483487 ):
484- rotation = self .get_map_rotation ()
488+ rotation = self .get_map_rotation ()[ "maps" ]
485489
486490 map_index = len (rotation )
487491 if after_map_name :
@@ -496,7 +500,7 @@ def add_map_to_rotation_at_index(self, map_name: str, map_index: int):
496500 self .exchange ("AddMapToRotation" , 2 , {"MapName" : map_name , "Index" : map_index })
497501
498502 def remove_map_from_rotation (self , map_name : str ):
499- rotation = self .get_map_rotation ()
503+ rotation = self .get_map_rotation ()[ "maps" ]
500504 try :
501505 map_index = rotation .index (map_name )
502506 except ValueError :
0 commit comments