@@ -330,14 +330,37 @@ protected function run()
330330 $ z
331331 ));
332332 break ;
333- case self ::COMMAND_UNIT_AI_STATE :
334- $ numUnits = ord ($ this ->body [$ this ->position ++]);
335- $ stance = ord ($ this ->body [$ this ->position ++]);
336- $ this ->push (new Actions \UnitAiStateAction (
333+ case self ::COMMAND_ADD_ATTRIBUTE :
334+ $ playerId = ord ($ this ->body [$ this ->position ++]);
335+ $ resourceType = ord ($ this ->body [$ this ->position ++]);
336+ $ this ->position += 1 ;
337+ $ amount = $ this ->readBody ('f ' , 4 );
338+
339+ $ this ->push (new Actions \AddAttributeAction (
337340 $ this ->rec ,
338341 $ this ->currentTime ,
339- $ stance ,
340- $ this ->readUnits ($ numUnits )
342+ $ playerId ,
343+ $ resourceType ,
344+ $ amount
345+ ));
346+ break ;
347+ // Old-style tributing.
348+ case self ::COMMAND_GIVE_ATTRIBUTE :
349+ $ playerIdFrom = ord ($ this ->body [$ this ->position ++]);
350+ $ playerIdTo = ord ($ this ->body [$ this ->position ++]);
351+ $ resourceId = ord ($ this ->body [$ this ->position ++]);
352+ $ amount = $ this ->readBody ('f ' , 4 );
353+ // Market fees only apply to COMMAND_GIVE_ATTRIBUTE2.
354+ $ marketFee = 0.0 ;
355+
356+ $ this ->push (new Actions \GiveAttributeAction (
357+ $ this ->rec ,
358+ $ this ->currentTime ,
359+ $ playerIdFrom ,
360+ $ playerIdTo ,
361+ $ resourceId ,
362+ $ amount ,
363+ $ marketFee
341364 ));
342365 break ;
343366 // player resign
@@ -361,8 +384,29 @@ protected function run()
361384 $ this ->chatMessages [] = new ChatMessage ($ this ->currentTime , null , $ message );
362385 }
363386 break ;
387+ case self ::COMMAND_UNIT_AI_STATE :
388+ $ numUnits = ord ($ this ->body [$ this ->position ++]);
389+ $ stance = ord ($ this ->body [$ this ->position ++]);
390+ $ this ->push (new Actions \UnitAiStateAction (
391+ $ this ->rec ,
392+ $ this ->currentTime ,
393+ $ stance ,
394+ $ this ->readUnits ($ numUnits )
395+ ));
396+ break ;
397+ case self ::COMMAND_FOLLOW :
398+ $ numUnits = ord ($ this ->body [$ this ->position ++]);
399+ $ this ->position += 2 ;
400+ $ target = $ this ->readBody ('l ' , 4 );
401+
402+ $ this ->push (new Actions \FollowAction (
403+ $ this ->rec ,
404+ $ this ->currentTime ,
405+ $ target ,
406+ $ this ->readUnits ($ numUnits )
407+ ));
408+ break ;
364409 case self ::COMMAND_PATROL :
365- $ start = $ this ->position - 1 ;
366410 $ numUnits = ord ($ this ->body [$ this ->position ++]);
367411 $ numWaypoints = ord ($ this ->body [$ this ->position ++]);
368412 $ this ->position ++;
@@ -500,6 +544,19 @@ protected function run()
500544 $ objectId
501545 ));
502546 break ;
547+ case self ::COMMAND_ATTACK_GROUND :
548+ $ count = ord ($ this ->body [$ this ->position ++]);
549+ $ this ->position += 2 ;
550+ $ x = $ this ->readBody ('f ' , 4 );
551+ $ y = $ this ->readBody ('f ' , 4 );
552+ $ this ->push (new Actions \AttackGroundAction (
553+ $ this ->rec ,
554+ $ this ->currentTime ,
555+ $ x ,
556+ $ y ,
557+ $ this ->readUnits ($ count )
558+ ));
559+ break ;
503560 // AI trains unit
504561 case self ::COMMAND_MAKE :
505562 $ this ->position += 3 ;
@@ -682,6 +739,18 @@ protected function run()
682739 $ marketId
683740 ));
684741 break ;
742+ case self ::COMMAND_TOWN_BELL :
743+ $ this ->position += 3 ;
744+ $ unitId = $ this ->readBody ('l ' , 4 );
745+ $ active = $ this ->readBody ('l ' , 4 );
746+
747+ $ this ->push (new Actions \TownBellAction (
748+ $ this ->rec ,
749+ $ this ->currentTime ,
750+ $ unitId ,
751+ $ active
752+ ));
753+ break ;
685754 case self ::COMMAND_GO_BACK_TO_WORK :
686755 $ this ->position += 3 ;
687756 $ unitId = $ this ->readBody ('l ' , 4 );
0 commit comments