@@ -274,6 +274,30 @@ protected function run()
274274 $ this ->readUnits ($ unitCount )
275275 ));
276276 break ;
277+ case self ::COMMAND_STOP :
278+ $ count = ord ($ this ->body [$ this ->position ++]);
279+ $ this ->push (new Actions \StopAction (
280+ $ this ->rec ,
281+ $ this ->currentTime ,
282+ $ this ->readUnits ($ count )
283+ ));
284+ break ;
285+ case self ::COMMAND_WORK :
286+ $ this ->position += 3 ;
287+ $ targetId = $ this ->readBody ('l ' , 4 );
288+ $ count = ord ($ this ->body [$ this ->position ++]);
289+ $ this ->position += 3 ;
290+ $ x = $ this ->readBody ('f ' , 4 );
291+ $ y = $ this ->readBody ('f ' , 4 );
292+ $ this ->push (new Actions \WorkAction (
293+ $ this ->rec ,
294+ $ this ->currentTime ,
295+ $ targetId ,
296+ $ x ,
297+ $ y ,
298+ $ this ->readUnits ($ count )
299+ ));
300+ break ;
277301 case self ::COMMAND_MOVE :
278302 $ playerId = ord ($ this ->body [$ this ->position ++]);
279303 $ this ->position += 2 ;
@@ -288,6 +312,24 @@ protected function run()
288312 $ this ->readUnits ($ count )
289313 ));
290314 break ;
315+ case self ::COMMAND_CREATE :
316+ $ this ->position ++;
317+ $ objectCategory = $ this ->readBody ('v ' , 2 );
318+ $ playerId = ord ($ this ->body [$ this ->position ++]);
319+ $ this ->position += 3 ;
320+ $ x = $ this ->readBody ('f ' , 4 );
321+ $ y = $ this ->readBody ('f ' , 4 );
322+ $ z = $ this ->readBody ('f ' , 4 );
323+ $ this ->push (new Actions \CreateAction (
324+ $ this ->rec ,
325+ $ this ->currentTime ,
326+ $ playerId ,
327+ $ objectCategory ,
328+ $ x ,
329+ $ y ,
330+ $ z
331+ ));
332+ break ;
291333 case self ::COMMAND_UNIT_AI_STATE :
292334 $ numUnits = ord ($ this ->body [$ this ->position ++]);
293335 $ stance = ord ($ this ->body [$ this ->position ++]);
@@ -300,9 +342,9 @@ protected function run()
300342 break ;
301343 // player resign
302344 case self ::COMMAND_RESIGN :
303- $ playerIndex = ord ($ this ->body [$ this ->position ]);
304- $ playerNumber = ord ($ this ->body [$ this ->position + 1 ]);
305- $ dropped = ord ($ this ->body [$ this ->position + 2 ]);
345+ $ playerIndex = ord ($ this ->body [$ this ->position ++ ]);
346+ $ playerNumber = ord ($ this ->body [$ this ->position ++ ]);
347+ $ dropped = ord ($ this ->body [$ this ->position ++ ]);
306348
307349 $ this ->push (new Actions \ResignAction (
308350 $ this ->rec ,
@@ -312,14 +354,27 @@ protected function run()
312354 $ dropped
313355 ));
314356
315- $ this ->position += 3 ;
316357 $ player = $ playersByIndex [$ playerIndex ];
317358 if ($ player && $ player ->resignTime === 0 ) {
318359 $ player ->resignTime = $ this ->currentTime ;
319360 $ message = sprintf ('%s resigned ' , $ player ->name );
320361 $ this ->chatMessages [] = new ChatMessage ($ this ->currentTime , null , $ message );
321362 }
322363 break ;
364+ case self ::COMMAND_FORM_FORMATION :
365+ $ count = ord ($ this ->body [$ this ->position ++]);
366+ $ playerId = ord ($ this ->body [$ this ->position ++]);
367+ $ this ->position += 1 ;
368+ $ formation = $ this ->readBody ('l ' , 4 );
369+
370+ $ this ->push (new Actions \FormFormationAction (
371+ $ this ->rec ,
372+ $ this ->currentTime ,
373+ $ playerId ,
374+ $ formation ,
375+ $ this ->readUnits ($ count )
376+ ));
377+ break ;
323378 // researches
324379 case self ::COMMAND_RESEARCH :
325380 $ this ->position += 3 ;
@@ -387,11 +442,44 @@ protected function run()
387442 case self ::COMMAND_GAME :
388443 $ this ->processGameAction ();
389444 break ;
445+ case self ::COMMAND_BUILD_WALL :
446+ $ count = ord ($ this ->body [$ this ->position ++]);
447+ $ playerId = ord ($ this ->body [$ this ->position ++]);
448+ $ x1 = ord ($ this ->body [$ this ->position ++]);
449+ $ y1 = ord ($ this ->body [$ this ->position ++]);
450+ $ x2 = ord ($ this ->body [$ this ->position ++]);
451+ $ y2 = ord ($ this ->body [$ this ->position ++]);
452+ $ this ->position += 1 ; // Padding
453+ $ objectType = $ this ->readBody ('v ' , 2 );
454+ $ this ->position += 2 ; // Padding
455+ $ this ->position += 4 ; // Always -1
456+
457+ $ this ->push (new Actions \BuildWallAction (
458+ $ this ->rec ,
459+ $ this ->currentTime ,
460+ $ playerId ,
461+ $ objectType ,
462+ [$ x1 , $ y1 ],
463+ [$ x2 , $ y2 ],
464+ $ this ->readUnits ($ count )
465+ ));
466+ break ;
467+ case self ::COMMAND_CANCEL_BUILD :
468+ $ this ->position += 3 ;
469+ $ objectId = $ this ->readBody ('l ' , 4 );
470+ $ playerId = $ this ->readBody ('l ' , 4 );
471+ $ this ->push (new Actions \CancelBuildAction (
472+ $ this ->rec ,
473+ $ this ->currentTime ,
474+ $ playerId ,
475+ $ objectId
476+ ));
477+ break ;
390478 // AI trains unit
391479 case self ::COMMAND_MAKE :
392- $ this ->position += 9 ;
393- $ playerId = - 1 ;
394- $ objectId = - 1 ;
480+ $ this ->position += 3 ;
481+ $ objectId = $ this -> readBody ( ' l ' , 4 ) ;
482+ $ playerId = $ this -> readBody ( ' v ' , 2 ) ;
395483 $ unitType = $ this ->readBody ('v ' , 2 );
396484
397485 $ this ->push (new Actions \MakeAction (
@@ -470,6 +558,105 @@ protected function run()
470558 $ this ->position += 8 ;
471559 }
472560 break ;
561+ case self ::COMMAND_REPAIR :
562+ $ count = ord ($ this ->body [$ this ->position ++]);
563+ $ this ->position += 2 ;
564+ $ targetId = $ this ->readBody ('l ' , 4 );
565+ $ this ->push (new Actions \RepairAction (
566+ $ this ->rec ,
567+ $ this ->currentTime ,
568+ $ targetId ,
569+ $ this ->readUnits ($ count )
570+ ));
571+ break ;
572+ case self ::COMMAND_UNLOAD :
573+ $ count = ord ($ this ->body [$ this ->position ++]);
574+ $ this ->position += 2 ;
575+ $ x = $ this ->readBody ('f ' , 4 );
576+ $ y = $ this ->readBody ('f ' , 4 );
577+ $ flag = ord ($ this ->body [$ this ->position ++]);
578+ $ this ->position += 3 ;
579+ $ unitType = $ this ->readBody ('l ' , 4 );
580+
581+ $ this ->push (new Actions \UnloadAction (
582+ $ this ->rec ,
583+ $ this ->currentTime ,
584+ $ x ,
585+ $ y ,
586+ $ flag ,
587+ $ unitType ,
588+ $ this ->readUnits ($ count )
589+ ));
590+ break ;
591+ case self ::COMMAND_UNIT_ORDER :
592+ $ count = ord ($ this ->body [$ this ->position ++]);
593+ $ this ->position += 2 ;
594+ $ targetId = $ this ->readBody ('l ' , 4 );
595+ $ action = ord ($ this ->body [$ this ->position ++]);
596+ $ this ->position += 3 ;
597+ $ x = $ this ->readBody ('f ' , 4 );
598+ $ y = $ this ->readBody ('f ' , 4 );
599+ $ parameter = $ this ->readBody ('l ' , 4 );
600+
601+ $ this ->push (new Actions \UnitOrderAction (
602+ $ this ->rec ,
603+ $ this ->currentTime ,
604+ $ x ,
605+ $ y ,
606+ $ targetId ,
607+ $ action ,
608+ $ parameter ,
609+ $ this ->readUnits ($ count )
610+ ));
611+ break ;
612+ case self ::COMMAND_SET_GATHER_POINT :
613+ $ count = ord ($ this ->body [$ this ->position ++]);
614+ $ this ->position += 2 ;
615+ $ targetId = $ this ->readBody ('l ' , 4 );
616+ $ targetType = $ this ->readBody ('l ' , 4 );
617+ $ x = $ this ->readBody ('f ' , 4 );
618+ $ y = $ this ->readBody ('f ' , 4 );
619+
620+ $ this ->push (new Actions \SetGatherPointAction (
621+ $ this ->rec ,
622+ $ this ->currentTime ,
623+ $ targetId ,
624+ $ targetType ,
625+ $ x ,
626+ $ y ,
627+ $ this ->readUnits ($ count )
628+ ));
629+ break ;
630+ case self ::COMMAND_SELL_COMMODITY :
631+ $ playerId = ord ($ this ->body [$ this ->position ++]);
632+ $ resourceType = ord ($ this ->body [$ this ->position ++]);
633+ $ amount = ord ($ this ->body [$ this ->position ++]);
634+ $ marketId = $ this ->readBody ('l ' , 4 );
635+
636+ $ this ->push (new Actions \SellCommodityAction (
637+ $ this ->rec ,
638+ $ this ->currentTime ,
639+ $ playerId ,
640+ $ resourceType ,
641+ $ amount ,
642+ $ marketId
643+ ));
644+ break ;
645+ case self ::COMMAND_BUY_COMMODITY :
646+ $ playerId = ord ($ this ->body [$ this ->position ++]);
647+ $ resourceType = ord ($ this ->body [$ this ->position ++]);
648+ $ amount = ord ($ this ->body [$ this ->position ++]);
649+ $ marketId = $ this ->readBody ('l ' , 4 );
650+
651+ $ this ->push (new Actions \BuyCommodityAction (
652+ $ this ->rec ,
653+ $ this ->currentTime ,
654+ $ playerId ,
655+ $ resourceType ,
656+ $ amount ,
657+ $ marketId
658+ ));
659+ break ;
473660 // multiplayer postgame data in UP1.4 RC2+
474661 case self ::COMMAND_POSTGAME :
475662 $ this ->postGameData = $ this ->read (PostgameDataAnalyzer::class);
0 commit comments