
 
 / /   F i l e :   s r c \ l i b . r s \ l i b . r s   
 
 u s e   s t d : : c o l l e c t i o n s : : H a s h M a p ; 
 
 u s e   o n c e _ c e l l : : s y n c : : L a z y ; 
 
 
 
 m o d   l o a d _ r e s ; 
 
 m o d   m o d e l s ; 
 
 m o d   r e q u e s t s ; 
 
 
 
 p u b   u s e   m o d e l s : : a p i : : { S t a t u s ,   W a r I n f o } ; 
 
 p u b   u s e   m o d e l s : : P l a n e t ; 
 
 p u b   u s e   r e q u e s t s : : { g e t _ s t a t u s ,   g e t _ w a r _ i n f o } ; 
 
 
 
 
 
 p u b   c o n s t   B A S E _ U R L :   & s t r   =   " h t t p s : / / a p i . l i v e . p r o d . t h e h e l l d i v e r s g a m e . c o m / a p i " ; 
 
 
 
 p u b   s t a t i c   P L A N E T S :   L a z y < H a s h M a p < i 6 4 ,   P l a n e t > >   =   L a z y : : n e w ( l o a d _ r e s : : l o a d _ p l a n e t s ) ; 
 
 p u b   s t a t i c   F A C T I O N S :   L a z y < H a s h M a p < i 6 4 ,   m o d e l s : : F a c t i o n > >   =   L a z y : : n e w ( l o a d _ r e s : : l o a d _ f a c t i o n s ) ; 
 
 p u b   s t a t i c   S E C T O R S :   L a z y < H a s h M a p < i 6 4 ,   m o d e l s : : S e c t o r > >   =   L a z y : : n e w ( l o a d _ r e s : : l o a d _ s e c t o r s ) ; 
 
 
 
 
 
 / / /   G e t   t h e   n a m e   o f   a   p l a n e t 
 
 / / / 
 
 / / /   A r g u m e n t s : 
 
 / / /       i d :   i 6 4   -   T h e   I D   o f   t h e   p l a n e t 
 
 p u b   f n   g e t _ p l a n e t _ n a m e ( i d :   i 6 4 )   - >   S t r i n g   { 
 
         m a t c h   P L A N E T S . g e t ( & i d )   { 
 
                 S o m e ( p l a n e t )   = >   p l a n e t . n a m e . c l o n e ( ) , 
 
                 N o n e   = >   f o r m a t ! ( " U n k n o w n   P l a n e t   { } " ,   i d ) , 
 
         } 
 
 } 
 
 
 
 / / /   G e t   t h e   n a m e   o f   a   f a c t i o n 
 
 / / / 
 
 / / /   A r g u m e n t s : 
 
 / / /         i d :   i 6 4   -   T h e   I D   o f   t h e   f a c t i o n 
 
 p u b   f n   g e t _ f a c t i o n _ n a m e ( i d :   i 6 4 )   - >   S t r i n g   { 
 
         m a t c h   F A C T I O N S . g e t ( & i d )   { 
 
                 S o m e ( f a c t i o n )   = >   f a c t i o n . n a m e . c l o n e ( ) , 
 
                 N o n e   = >   f o r m a t ! ( " U n k n o w n   F a c t i o n   { } " ,   i d ) , 
 
         } 
 
 } 
 
 
 
 / / /   G e t   t h e   n a m e   o f   a   s e c t o r 
 
 / / / 
 
 / / /   A r g u m e n t s : 
 
 / / /       i d :   i 6 4   -   T h e   I D   o f   t h e   s e c t o r 
 
 p u b   f n   g e t _ s e c t o r _ n a m e ( i d :   i 6 4 )   - >   S t r i n g   { 
 
         m a t c h   S E C T O R S . g e t ( & i d )   { 
 
                 S o m e ( s e c t o r )   = >   s e c t o r . n a m e . c l o n e ( ) , 
 
                 N o n e   = >   f o r m a t ! ( " U n k n o w n   S e c t o r   { } " ,   i d ) , 
 
         } 
 
 } 
 
 
 
 # [ c f g ( t e s t ) ] 
 
 m o d   t e s t s   { 
 
         u s e   s u p e r : : * ; 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ g e t _ s t a t u s ( )   { 
 
                 l e t   _ s t a t u s   =   m a t c h   g e t _ s t a t u s ( 8 0 1 )   { 
 
                         O k ( s t a t u s )   = >   s t a t u s , 
 
                         E r r ( e )   = >   p a n i c ! ( " E r r o r :   { } " ,   e ) , 
 
                 } ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ g e t _ w a r _ i n f o ( )   { 
 
                 l e t   _ w a r _ i n f o   =   m a t c h   g e t _ w a r _ i n f o ( 8 0 1 )   { 
 
                         O k ( w a r _ i n f o )   = >   w a r _ i n f o , 
 
                         E r r ( e )   = >   p a n i c ! ( " E r r o r :   { } " ,   e ) , 
 
                 } ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ l o a d _ p l a n e t s ( )   { 
 
                 a s s e r t ! ( P L A N E T S . l e n ( )   >   0 ) ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ l o a d _ f a c t i o n s ( )   { 
 
                 a s s e r t ! ( F A C T I O N S . l e n ( )   >   0 ) ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ l o a d _ s e c t o r s ( )   { 
 
                 a s s e r t ! ( S E C T O R S . l e n ( )   >   0 ) ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ g e t _ p l a n e t _ n a m e ( )   { 
 
                 a s s e r t _ e q ! ( g e t _ p l a n e t _ n a m e ( 0 ) ,   " S u p e r   E a r t h " ) ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ g e t _ f a c t i o n _ n a m e ( )   { 
 
                 a s s e r t _ e q ! ( g e t _ f a c t i o n _ n a m e ( 1 ) ,   " H u m a n s " ) ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ g e t _ s e c t o r _ n a m e ( )   { 
 
                 a s s e r t _ e q ! ( g e t _ s e c t o r _ n a m e ( 0 ) ,   " S o l " ) ; 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ w a r _ i n f o _ p l a n e t _ n a m e ( )   { 
 
                 l e t   w a r _ i n f o   =   m a t c h   g e t _ w a r _ i n f o ( 8 0 1 )   { 
 
                         O k ( w a r _ i n f o )   = >   w a r _ i n f o , 
 
                         E r r ( e )   = >   p a n i c ! ( " E r r o r :   { } " ,   e ) , 
 
                 } ; 
 
                 f o r   p l a n e t _ i n f o   i n   w a r _ i n f o . p l a n e t _ i n f o s   { 
 
                         a s s e r t ! ( ! p l a n e t _ i n f o . p l a n e t _ n a m e . i s _ e m p t y ( ) ) 
 
                 } 
 
         } 
 
 
 
         # [ t e s t ] 
 
         f n   t e s t _ s t a t u s _ p l a n e t _ n a m e ( )   { 
 
                 l e t   s t a t u s   =   m a t c h   g e t _ s t a t u s ( 8 0 1 )   { 
 
                         O k ( s t a t u s )   = >   s t a t u s , 
 
                         E r r ( e )   = >   p a n i c ! ( " E r r o r :   { } " ,   e ) , 
 
                 } ; 
 
                 f o r   p l a n e t _ s t a t u s   i n   s t a t u s . p l a n e t _ s t a t u s   { 
 
                         a s s e r t ! ( ! p l a n e t _ s t a t u s . p l a n e t _ n a m e . i s _ e m p t y ( ) ) 
 
                 } 
 
         } 
 
 
 
 } 
 
 
 
 
 
 / /   F i l e :   s r c \ l o a d _ r e s . r s \ l o a d _ r e s . r s   
 
 u s e   s t d : : c o l l e c t i o n s : : h a s h _ m a p : : H a s h M a p ; 
 
 u s e   t o m l : : f r o m _ s t r ; 
 
 
 
 u s e   c r a t e : : m o d e l s : : { P l a n e t ,   F a c t i o n ,   S e c t o r } ; 
 
 
 
 
 
 c o n s t   R A W _ P L A N E T S :   & s t r   =   i n c l u d e _ s t r ! ( " . . / r e s / p l a n e t s . t o m l " ) ; 
 
 
 
 / /   c o n s t   R A W _ E F F E C T S :   & s t r   =   i n c l u d e _ s t r ! ( " . . / r e s / e f f e c t s . t o m l " ) ; 
 
 c o n s t   R A W _ F A C T I O N S :   & s t r   =   i n c l u d e _ s t r ! ( " . . / r e s / f a c t i o n s . t o m l " ) ; 
 
 c o n s t   R A W _ S E C T O R S :   & s t r   =   i n c l u d e _ s t r ! ( " . . / r e s / s e c t o r s . t o m l " ) ; 
 
 
 
 p u b   f n   l o a d _ p l a n e t s ( )   - >   H a s h M a p < i 6 4 ,   P l a n e t >   { 
 
         l e t   p l a n e t s :   H a s h M a p < S t r i n g ,   S t r i n g >   =   f r o m _ s t r ( R A W _ P L A N E T S ) . u n w r a p ( ) ; 
 
         l e t   m u t   p l a n e t _ m a p :   H a s h M a p < i 6 4 ,   P l a n e t >   =   H a s h M a p : : n e w ( ) ; 
 
         f o r   ( i d ,   n a m e )   i n   p l a n e t s   { 
 
                 p l a n e t _ m a p . i n s e r t ( i d . p a r s e ( ) . u n w r a p ( ) ,   P l a n e t { i d :   i d . p a r s e ( ) . u n w r a p ( ) ,   n a m e } ) ; 
 
         } 
 
         p l a n e t _ m a p 
 
 } 
 
 
 
 p u b   f n   l o a d _ f a c t i o n s ( )   - >   H a s h M a p < i 6 4 ,   F a c t i o n >   { 
 
         l e t   f a c t i o n s :   H a s h M a p < S t r i n g ,   S t r i n g >   =   f r o m _ s t r ( R A W _ F A C T I O N S ) . u n w r a p ( ) ; 
 
         l e t   m u t   f a c t i o n _ m a p :   H a s h M a p < i 6 4 ,   F a c t i o n >   =   H a s h M a p : : n e w ( ) ; 
 
         f o r   ( i d ,   n a m e )   i n   f a c t i o n s   { 
 
                 f a c t i o n _ m a p . i n s e r t ( i d . p a r s e ( ) . u n w r a p ( ) ,   F a c t i o n { i d :   i d . p a r s e ( ) . u n w r a p ( ) ,   n a m e } ) ; 
 
         } 
 
         f a c t i o n _ m a p 
 
 } 
 
 
 
 p u b   f n   l o a d _ s e c t o r s ( )   - >   H a s h M a p < i 6 4 ,   S e c t o r >   { 
 
         l e t   s e c t o r s :   H a s h M a p < S t r i n g ,   S t r i n g >   =   f r o m _ s t r ( R A W _ S E C T O R S ) . u n w r a p ( ) ; 
 
         l e t   m u t   s e c t o r _ m a p :   H a s h M a p < i 6 4 ,   S e c t o r >   =   H a s h M a p : : n e w ( ) ; 
 
         f o r   ( i d ,   n a m e )   i n   s e c t o r s   { 
 
                 s e c t o r _ m a p . i n s e r t ( i d . p a r s e ( ) . u n w r a p ( ) ,   S e c t o r { i d :   i d . p a r s e ( ) . u n w r a p ( ) ,   n a m e } ) ; 
 
         } 
 
         s e c t o r _ m a p 
 
 } 
 
 
 
 
 
 / /   F i l e :   s r c \ m o d e l s \ a p i \ m o d . r s \ m o d . r s   
 
 m o d   s t a t u s ; 
 
 m o d   w a r _ i n f o ; 
 
 
 
 p u b   u s e   s t a t u s : : { S t a t u s } ; 
 
 p u b   u s e   w a r _ i n f o : : { W a r I n f o } ; 
 
 
 
 
 
 / /   F i l e :   s r c \ m o d e l s \ a p i \ s t a t u s . r s \ s t a t u s . r s   
 
 u s e   s t d : : c o l l e c t i o n s : : H a s h M a p ; 
 
 u s e   s e r d e : : { D e s e r i a l i z e } ; 
 
 u s e   s e r d e _ j s o n : : V a l u e ; 
 
 
 
 # [ d e r i v e ( D e s e r i a l i z e ,   D e b u g ) ] 
 
 p u b   s t r u c t   S t a t u s   { 
 
         # [ s e r d e ( r e n a m e   =   " w a r I d " ) ] 
 
         p u b   w a r _ i d :   i 6 4 , 
 
         p u b   t i m e :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " i m p a c t M u l t i p l i e r " ) ] 
 
         p u b   i m p a c t _ m u l t i p l i e r :   f 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " s t o r y B e a t I d 3 2 " ) ] 
 
         p u b   s t o r y _ b e a t _ i d 3 2 :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " p l a n e t S t a t u s " ) ] 
 
         p u b   p l a n e t _ s t a t u s :   V e c < P l a n e t S t a t u s > , 
 
         # [ s e r d e ( r e n a m e   =   " p l a n e t A t t a c k s " ) ] 
 
         p u b   p l a n e t _ a t t a c k s :   V e c < P l a n e t A t t a c k > , 
 
         p u b   c a m p a i g n s :   V e c < C a m p a i g n > , 
 
         / /   p u b   c o m m u n i t y _ t a r g e t s :   V e c < S t r i n g > ,   / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   c o m m u n i t y _ t a r g e t s   y e t 
 
         / /   p u b   j o i n t _ o p e r a t i o n s :   V e c < S t r i n g > ,     / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   j o i n t _ o p e r a t i o n s   y e t 
 
         / /   p u b   p l a n e t _ e v e n t s :   V e c < S t r i n g > ,     / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   p l a n e t _ e v e n t s   y e t 
 
         / /   p u b   p l a n e t _ a c t i v e _ e f f e c t s :   V e c < S t r i n g > ,     / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   p l a n e t _ a c t i v e _ e f f e c t s   y e t 
 
         / /   p u b   a c t i v e _ e l e c t i o n _ p o l i c y _ e f f e c t s :   V e c < S t r i n g > ,     / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   a c t i v e _ e l e c t i o n _ p o l i c y _ e f f e c t s   y e t 
 
         # [ s e r d e ( r e n a m e   =   " g l o b a l E v e n t s " ) ] 
 
         p u b   g l o b a l _ e v e n t s :   V e c < G l o b a l E v e n t > , 
 
         / /   p u b   s u p e r _ e a r t h _ w a r _ r e s u l t s :   V e c < S t r i n g > ,     / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   s u p e r _ e a r t h _ w a r _ r e s u l t s   y e t 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
 } 
 
 
 
 # [ d e r i v e ( D e s e r i a l i z e ,   D e b u g ) ] 
 
 p u b   s t r u c t   G l o b a l E v e n t   { 
 
         # [ s e r d e ( r e n a m e   =   " e v e n t I d " ) ] 
 
         p u b   e v e n t _ i d :   i 6 4 , 
 
         p u b   i d 3 2 :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " p o r t r a i t I d 3 2 " ) ] 
 
         p u b   p o r t r a i t _ i d 3 2 :   i 6 4 , 
 
         p u b   t i t l e :   S t r i n g , 
 
         # [ s e r d e ( r e n a m e   =   " t i t l e I d 3 2 " ) ] 
 
         p u b   t i t l e _ i d 3 2 :   i 6 4 , 
 
         p u b   m e s s a g e :   S t r i n g , 
 
         # [ s e r d e ( r e n a m e   =   " m e s s a g e I d 3 2 " ) ] 
 
         p u b   m e s s a g e _ i d 3 2 :   i 6 4 , 
 
         p u b   r a c e :   i 6 4 , 
 
         p u b   f l a g :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " a s s i g n m e n t I d 3 2 " ) ] 
 
         p u b   a s s i g n m e n t _ i d 3 2 :   i 6 4 , 
 
         / /   p u b   e f f e c t _ i d s :   V e c < S t r i n g > ,   / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   e f f e c t _ i d s   y e t 
 
         / /   p u b   p l a n e t _ i n d i c e s :   V e c < S t r i n g > ,   / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   p l a n e t _ i n d i c e s   y e t 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
 } 
 
 
 
 # [ d e r i v e ( D e s e r i a l i z e ,   D e b u g ) ] 
 
 p u b   s t r u c t   C a m p a i g n   { 
 
         p u b   i d :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " p l a n e t I n d e x " ) ] 
 
         p u b   p l a n e t _ i n d e x :   i 6 4 , 
 
         p u b   r # t y p e :   i 6 4 , 
 
         p u b   c o u n t :   i 6 4 , 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
         # [ s e r d e ( s k i p ) ] 
 
         p u b   p l a n e t _ n a m e :   S t r i n g , 
 
 } 
 
 
 
 # [ d e r i v e ( D e s e r i a l i z e ,   D e b u g ) ] 
 
 p u b   s t r u c t   P l a n e t A t t a c k   { 
 
         p u b   s o u r c e :   i 6 4 , 
 
         p u b   t a r g e t :   i 6 4 , 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
 
 
         # [ s e r d e ( s k i p ) ] 
 
         p u b   s o u r c e _ n a m e :   S t r i n g , 
 
         # [ s e r d e ( s k i p ) ] 
 
         p u b   t a r g e t _ n a m e :   S t r i n g , 
 
 } 
 
 
 
 # [ d e r i v e ( D e s e r i a l i z e ,   D e b u g ) ] 
 
 p u b   s t r u c t   P l a n e t S t a t u s   { 
 
         p u b   i n d e x :   i 6 4 , 
 
         p u b   o w n e r :   i 6 4 , 
 
         p u b   h e a l t h :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " r e g e n P e r S e c o n d " ) ] 
 
         p u b   r e g e n _ p e r _ s e c o n d :   f 6 4 , 
 
         p u b   p l a y e r s :   i 6 4 , 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
         # [ s e r d e ( s k i p ) ] 
 
         p u b   p l a n e t _ n a m e :   S t r i n g , 
 
 } 
 
 
 
 
 
 
 
 / /   F i l e :   s r c \ m o d e l s \ a p i \ w a r _ i n f o . r s \ w a r _ i n f o . r s   
 
 u s e   s t d : : c o l l e c t i o n s : : H a s h M a p ; 
 
 u s e   s e r d e : : { D e s e r i a l i z e ,   S e r i a l i z e } ; 
 
 u s e   s e r d e _ j s o n : : V a l u e ; 
 
 
 
 # [ d e r i v e ( S e r i a l i z e ,   D e s e r i a l i z e ) ] 
 
 p u b   s t r u c t   W a r I n f o   { 
 
         # [ s e r d e ( r e n a m e   =   " w a r I d " ) ] 
 
         p u b   w a r _ i d :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " s t a r t D a t e " ) ] 
 
         p u b   s t a r t _ d a t e :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " e n d D a t e " ) ] 
 
         p u b   e n d _ d a t e :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " m i n i m u m C l i e n t V e r s i o n " ) ] 
 
         p u b   m i n i m u m _ c l i e n t _ v e r s i o n :   S t r i n g , 
 
         # [ s e r d e ( r e n a m e   =   " p l a n e t I n f o s " ) ] 
 
         p u b   p l a n e t _ i n f o s :   V e c < P l a n e t I n f o > , 
 
         # [ s e r d e ( r e n a m e   =   " h o m e W o r l d s " ) ] 
 
         p u b   h o m e _ w o r l d s :   V e c < H o m e W o r l d > , 
 
         / /   # [ s e r d e ( r e n a m e   =   " c a p i t a l I n f o s " ) ] 
 
         / /   p u b   c a p i t a l _ i n f o s :   V e c < S t r i n g > ,     / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   c a p i t a l _ i n f o s   y e t 
 
         / /   # [ s e r d e ( r e n a m e   =   " p l a n e t P e r m a n e n t E f f e c t s " ) ] 
 
         / /   p u b   p l a n e t _ p e r m a n e n t _ e f f e c t s :   V e c < S t r i n g > ,   / /   T o D o :   D o n ' t   k n o w   t h e   s t r u c t u r e   o f   p l a n e t _ p e r m a n e n t _ e f f e c t s   y e t 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
 } 
 
 
 
 # [ d e r i v e ( S e r i a l i z e ,   D e s e r i a l i z e ) ] 
 
 p u b   s t r u c t   H o m e W o r l d   { 
 
         p u b   r a c e :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " p l a n e t I n d i c e s " ) ] 
 
         p u b   p l a n e t _ i n d i c e s :   V e c < i 6 4 > , 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
 } 
 
 
 
 # [ d e r i v e ( S e r i a l i z e ,   D e s e r i a l i z e ) ] 
 
 p u b   s t r u c t   P o s i t i o n   { 
 
         p u b   x :   f 6 4 , 
 
         p u b   y :   f 6 4 , 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
 } 
 
 
 
 # [ d e r i v e ( S e r i a l i z e ,   D e s e r i a l i z e ) ] 
 
 p u b   s t r u c t   P l a n e t I n f o   { 
 
         p u b   i n d e x :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " s e t t i n g s H a s h " ) ] 
 
         p u b   s e t t i n g s _ h a s h :   i 6 4 , 
 
         p u b   p o s i t i o n :   P o s i t i o n , 
 
         p u b   w a y p o i n t s :   V e c < i 6 4 > , 
 
         p u b   s e c t o r :   i 6 4 , 
 
         # [ s e r d e ( r e n a m e   =   " m a x H e a l t h " ) ] 
 
         p u b   m a x _ h e a l t h :   i 6 4 , 
 
         p u b   d i s a b l e d :   b o o l , 
 
         # [ s e r d e ( r e n a m e   =   " i n i t i a l O w n e r " ) ] 
 
         p u b   i n i t i a l _ o w n e r :   i 6 4 , 
 
         # [ s e r d e ( s k i p ) ] 
 
         p u b   p l a n e t _ n a m e :   S t r i n g , 
 
         # [ s e r d e ( f l a t t e n ) ] 
 
         p u b   u n k n o w n :   H a s h M a p < S t r i n g ,   V a l u e > , 
 
 } 
 
 
 
 
 
 
 
 / /   F i l e :   s r c \ m o d e l s \ f a c t i o n . r s \ f a c t i o n . r s   
 
 p u b   s t r u c t   F a c t i o n { 
 
         p u b   i d :   i 6 4 , 
 
         p u b   n a m e :   S t r i n g , 
 
 } 
 
 
 
 
 
 / /   F i l e :   s r c \ m o d e l s \ m o d . r s \ m o d . r s   
 
 p u b   m o d   a p i ; 
 
 m o d   p l a n e t ; 
 
 m o d   f a c t i o n ; 
 
 m o d   s e c t o r ; 
 
 
 
 p u b   u s e   p l a n e t : : P l a n e t ; 
 
 p u b   u s e   f a c t i o n : : F a c t i o n ; 
 
 p u b   u s e   s e c t o r : : S e c t o r ; 
 
 
 
 
 
 / /   F i l e :   s r c \ m o d e l s \ p l a n e t . r s \ p l a n e t . r s   
 
 p u b   s t r u c t   P l a n e t { 
 
         p u b   i d :   i 6 4 , 
 
         p u b   n a m e :   S t r i n g , 
 
 } 
 
 
 
 
 
 
 
 / /   F i l e :   s r c \ m o d e l s \ s e c t o r . r s \ s e c t o r . r s   
 
 p u b   s t r u c t   S e c t o r { 
 
         p u b   i d :   i 6 4 , 
 
         p u b   n a m e :   S t r i n g , 
 
 } 
 
 
 
 
 
 / /   F i l e :   s r c \ r e q u e s t s \ m o d . r s \ m o d . r s   
 
 u s e   c r a t e : : B A S E _ U R L ; 
 
 u s e   c r a t e : : m o d e l s : : a p i : : { S t a t u s ,   W a r I n f o } ; 
 
 
 
 
 
 / / /   G e t   t h e   c u r r e n t   s t a t u s   o f   a   w a r 
 
 / / / 
 
 / / /   A r g u m e n t s : 
 
 / / /         w a r _ i d :   u 3 2   -   T h e   I D   o f   t h e   w a r   t o   g e t   t h e   s t a t u s   o f 
 
 p u b   f n   g e t _ s t a t u s ( w a r _ i d :   u 3 2 )   - >   R e s u l t < S t a t u s ,   r e q w e s t : : E r r o r >   { 
 
         l e t   u r l   =   f o r m a t ! ( " { } / W a r S e a s o n / { } / S t a t u s " ,   B A S E _ U R L ,   w a r _ i d ) ; 
 
 
 
         l e t   r e s p o n s e   =   r e q w e s t : : b l o c k i n g : : g e t ( u r l ) . u n w r a p ( ) ; 
 
 
 
         l e t   m u t   s t a t u s :   S t a t u s   =   r e s p o n s e . j s o n ( ) ? ; 
 
 
 
         f o r   c a m p a i g n   i n   & m u t   s t a t u s . c a m p a i g n s   { 
 
                 c a m p a i g n . p l a n e t _ n a m e   =   c r a t e : : g e t _ p l a n e t _ n a m e ( c a m p a i g n . p l a n e t _ i n d e x ) ; 
 
         } 
 
 
 
         f o r   p l a n e t _ a t t a c k   i n   & m u t   s t a t u s . p l a n e t _ a t t a c k s   { 
 
                 p l a n e t _ a t t a c k . s o u r c e _ n a m e   =   c r a t e : : g e t _ p l a n e t _ n a m e ( p l a n e t _ a t t a c k . s o u r c e ) ; 
 
                 p l a n e t _ a t t a c k . t a r g e t _ n a m e   =   c r a t e : : g e t _ p l a n e t _ n a m e ( p l a n e t _ a t t a c k . t a r g e t ) ; 
 
         } 
 
 
 
         f o r   p l a n e t _ s t a t u s   i n   & m u t   s t a t u s . p l a n e t _ s t a t u s   { 
 
                 p l a n e t _ s t a t u s . p l a n e t _ n a m e   =   c r a t e : : g e t _ p l a n e t _ n a m e ( p l a n e t _ s t a t u s . i n d e x ) ; 
 
         } 
 
 
 
         O k ( s t a t u s ) 
 
 } 
 
 
 
 / / /   G e t   t h e   i n f o r m a t i o n   f o r   a   w a r 
 
 / / / 
 
 / / /   A r g u m e n t s : 
 
 / / /       w a r _ i d :   u 3 2   -   T h e   I D   o f   t h e   w a r   t o   g e t   t h e   i n f o r m a t i o n   f o r 
 
 p u b   f n   g e t _ w a r _ i n f o ( w a r _ i d :   u 3 2 )   - >   R e s u l t < W a r I n f o ,   r e q w e s t : : E r r o r >   { 
 
         l e t   u r l   =   f o r m a t ! ( " { } / W a r S e a s o n / { } / W a r I n f o " ,   B A S E _ U R L ,   w a r _ i d ) ; 
 
 
 
         l e t   r e s p o n s e   =   r e q w e s t : : b l o c k i n g : : g e t ( u r l ) . u n w r a p ( ) ; 
 
 
 
         l e t   m u t   w a r _ i n f o :   W a r I n f o   =   r e s p o n s e . j s o n ( ) ? ; 
 
 
 
         f o r   p l a n e t _ i n f o   i n   & m u t   w a r _ i n f o . p l a n e t _ i n f o s   { 
 
                 p l a n e t _ i n f o . p l a n e t _ n a m e   =   c r a t e : : g e t _ p l a n e t _ n a m e ( p l a n e t _ i n f o . i n d e x ) ; 
 
         } 
 
 
 
         O k ( w a r _ i n f o ) 
 
 } 
 
 
 
 