-
Notifications
You must be signed in to change notification settings - Fork 0
/
_ide_helper.php
1878 lines (1675 loc) · 64.2 KB
/
_ide_helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/** @noinspection PhpDocRedundantThrowsInspection */
/** @noinspection PhpInconsistentReturnPointsInspection */
/** @noinspection PhpUnreachableStatementInspection */
namespace Bga\GameFramework\Actions {
#[\Attribute]
class CheckAction {
public function __construct(
public bool $enabled = true,
) {}
}
}
namespace Bga\GameFramework\Actions\Types {
#[\Attribute]
class IntParam {
public function __construct(
?string $name = null,
public ?int $min = null,
public ?int $max = null,
) {}
public function getValue(string $paramName): int { return 0; }
}
#[\Attribute]
class BoolParam {
public function __construct(
?string $name = null,
) {}
public function getValue(string $paramName): bool { return false; }
}
#[\Attribute]
class FloatParam {
public function __construct(
?string $name = null,
public ?float $min = null,
public ?float $max = null,
) {}
public function getValue(string $paramName): float { return 0; }
}
#[\Attribute]
class IntArrayParam {
public function __construct(
?string $name = null,
public ?int $min = null,
public ?int $max = null,
) {}
public function getValue(string $paramName): array { return []; }
}
#[\Attribute]
class StringParam {
public function __construct(
?string $name = null,
public ?bool $alphanum = false,
public ?bool $alphanum_dash = false,
public ?bool $base64 = false,
public ?array $enum = null,
) {}
public function getValue(string $paramName): string { return ''; }
}
#[\Attribute]
class JsonParam {
public function __construct(
?string $name = null,
public ?bool $associative = true,
public ?bool $alphanum = true,
) {}
public function getValue(string $paramName): mixed { return []; }
}
}
namespace {
exit("This file should not be included, only analyzed by your IDE");
/**
* Dummy value, for autocomplete.
*/
const APP_GAMEMODULE_PATH = "";
/**
* Dummy value, for autocomplete.
*/
const APP_BASE_PATH = "";
/**
* This function is transparent: it will return the original English string without any change. Its only purpose is
* to mark this string as "must be translated", and to make sure the translated version of the string will be
* available on client side.
*
* **Do not put any HTML tag inside the `$text` argument. Use notification argument, instead.**
*/
function clienttranslate(string $text): string
{
return '';
}
/**
* This function works exactly like 'clienttranslate', except it tells BGA that the string is not needed on client
* side.
*/
function totranslate(string $text): string
{
return '';
}
function bga_rand(int $min, int $max): int {
return 0;
}
abstract class APP_Object
{
/**
* Debug message. Appear only if needed.
*/
final public function debug(string $message): void
{
//
}
/**
* Dump an object with a custom prefix.
*/
final public function dump(string $prefix, mixed $object): void
{
//
}
/**
* Error message. Appear in production.
*/
final public function error(string $message): void
{
//
}
/**
* Standard log message (INFO level).
*/
final public function trace(string $message): void
{
//
}
/**
* Warning message. Appear in production.
*/
final public function warn(string $message): void
{
//
}
}
abstract class APP_Template
{
/**
* TBD.
*/
final public function begin_block(string $template_name, string $block_name): void
{
//
}
/**
* TBD.
*/
final public function begin_subblock(string $template_name, string $block_name): void
{
//
}
/**
* TBD.
*/
final public function insert_block(string $block_name, array $tpl = []): void
{
//
}
/**
* TBD.
*/
final public function insert_subblock(string $block_name, array $tpl = []): void
{
//
}
}
abstract class game_view
{
/**
* Underlying access to the table game.
*/
readonly protected Table $game;
/**
* Underlying access to the template.
*/
readonly protected APP_Template $page;
/**
* Variables to inject into the template.
*
* @var array<string, mixed>
*/
protected array $tpl;
/**
* @param array $viewArgs
* @return void
*/
abstract public function build_page($viewArgs);
/**
* Translation function using appropriate gettext domain.
*/
final protected function _(string $text): string
{
return '';
}
/**
* @return string
*/
abstract protected function getGameName();
final protected function raw(string $string): array
{
return [];
}
}
abstract class GameState extends APP_Object
{
/**
* You can call this method to make any player active.
*
* NOTE: you CANNOT use this method in an "activeplayer" or "multipleactiveplayer" state. You must use a "game"
* type game state for this.
*/
final public function changeActivePlayer(int $playerId): void
{
//
}
/**
* This works exactly like `Table::checkAction()`, except that it does NOT check if the current player is
* active.
*/
final public function checkPossibleAction(string $actionName): void
{
//
}
/**
* With this method you can retrieve the list of the active player at any time.
*
* - During a "game" type game state, it will return a void array.
* - During an "activeplayer" type game state, it will return an array with one value (the active player id).
* - During a "multipleactiveplayer" type game state, it will return an array of the active players' id.
*
* NOTE: You should only use this method in the latter case.
*/
final public function getActivePlayerList(): array
{
return [];
}
/**
* This return the private state or null if not initialized or not in private state.
*/
final public function getPrivateState(int $playerId): array
{
return [];
}
/**
* Player with the specified id is entering a first private state defined in the master state initial private
* parameter.
*
* Everytime you need to start a private parallel states you need to call this or similar methods above
*
* - Note: player needs to be active (see above) and current game state must be a multiactive state with initial
* private parameter defined
* - Note: initial private parameter of master state should be set to the id of the first private state. This
* private state needs to be defined in states.php with the type set to 'private'.
* - Note: this method is usually preceded with activating that player
* - Note: initializing private state can run action or args methods of the initial private state
*/
final public function initializePrivateState(int $playerId): void
{
//
}
/**
* All active players in a multiactive state are entering a first private state defined in the master state's
* initialprivate parameter.
*
* Every time you need to start a private parallel states you need to call this or similar methods below.
*
* - Note: at least one player needs to be active (see above) and current game state must be a multiactive state
* with initialprivate parameter defined
* - Note: initialprivate parameter of master state should be set to the id of the first private state. This
* private state needs to be defined in states.php with the type set to 'private'.
* - Note: this method is usually preceded with activating some or all players
* - Note: initializing private state can run action or args methods of the initial private state
*/
final public function initializePrivateStateForAllActivePlayers(): void
{
//
}
/**
* Players with specified ids are entering a first private state defined in the master state initialprivate
* parameter.
*
* @param array<int> $playerIds
*/
final public function initializePrivateStateForPlayers(array $playerIds): void
{
//
}
/**
* Return true if we are in multipleactiveplayer state, false otherwise.
*/
final public function isMutiactiveState(): bool
{
return false;
}
/**
* Return true if specified player is active right now.
*
* This method take into account game state type, ie nobody is active if game state is "game" and several
* players can be active if game state is "multiplayer".
*/
final public function isPlayerActive(int $player_id): bool
{
return false;
}
/**
* Change current state to a new state. Important: the $stateNum parameter is the key of the state.
*
* NOTE: This is very advanced method, it should not be used in normal cases. Specific advanced cases
* include - jumping to specific state from "do_anytime" actions, jumping to dispatcher state or jumping to
* recovery state from zombie player function.
*/
final public function jumpToState(int $nextState, bool $bWithActions = true): void
{
//
}
/**
* Player with specified id will transition to next private state specified by provided transition.
*
* - Note: game needs to be in a master state which allows private parallel states
* - Note: transition should lead to another private state (i.e. a state with type defined as 'private'
* - Note: transition should be defined in private state in which the players currently are.
* - Note: this method can run action or args methods of the target state for specified player
* - Note: this is usually used after some player actions to move to next private state
*/
final public function nextPrivateState(int $playerId, string $transition): void
{
//
}
/**
* All active players will transition to next private state by specified transition.
*
* - Note: game needs to be in a master state which allows private parallel states
* - Note: transition should lead to another private state (i.e. a state with type defined as 'private'
* - Note: transition should be defined in private state in which the players currently are.
* - Note: this method can run action or args methods of the target state
* - Note: this is usually used after initializing the private state to move players to specific private state
* according to the game logic
*/
final public function nextPrivateStateForAllActivePlayers(string $transition): void
{
//
}
/**
* Players with specified ids will transition to next private state specified by provided transition.
* Same considerations apply as for the method above.
*
* @param array<int> $playerIds
*/
final public function nextPrivateStateForPlayers(array $playerIds, string $transition): void
{
//
}
/**
* Change current state to a new state.
*
* NOTE: the `$transition` parameter is the name of the transition, and NOT the name of the target game state.
*
* @see states.inc.php
*/
final public function nextState(string $transition): void
{
//
}
/**
* Reload the current state.
*/
final public function reloadState(): void
{
//
}
/**
* All playing players are made active. Update notification is sent to all players (this will trigger
* `onUpdateActionButtons`).
*
* Usually, you use this method at the beginning of a game state (e.g., `stGameState`) which transitions to a
* `multipleactiveplayer` state in which multiple players have to perform some action. Do not use this method if
* you're going to make some more changes in the active player list. (I.e., if you want to take away
* `multipleactiveplayer` status immediately afterward, use `setPlayersMultiactive` instead).
*/
final public function setAllPlayersMultiactive(): void
{
//
}
/**
* All playing players are made inactive. Transition to next state.
*/
final public function setAllPlayersNonMultiactive(string $nextState): void
{
//
}
/**
* During a multi-active game state, make the specified player inactive.
*
* Usually, you call this method during a multi-active game state after a player did his action. It is also
* possible to call it directly from multiplayer action handler. If this player was the last active player, the
* method trigger the "next_state" transition to go to the next game state.
*/
final public function setPlayerNonMultiactive(int $player, string $nextState): bool
{
return false;
}
/**
* Make a specific list of players active during a multiactive game state. Update notification is sent to all
* players whose state changed.
*
* - "players" is the array of player id that should be made active. If "players" is not empty the value of
* "next_state" will be ignored (you can put whatever you want).
* - If "bExclusive" parameter is not set or false it doesn't deactivate other previously active players. If
* it's set to true, the players who will be multiactive at the end are only these in "$players" array.
* - In case "players" is empty, the method trigger the "next_state" transition to go to the next game state.
*
* Returns true if state transition happened, false otherwise.
*/
final public function setPlayersMultiactive(array $players, string $nextState, bool $bInactivePlayersNotOnTheList = false): bool
{
return false;
}
/**
* For player with specified id a new private state would be set.
*
* - Note: game needs to be in a master state which allows private parallel states
* - Note: this should be rarely used as it doesn't check if the transition is allowed (it doesn't even specify
* transition). This can be useful in very complex cases when standard state machine is not adequate (i.e.
* specific cards can lead to some micro action in various states where defining transitions back and forth can
* become very tedious.)
* - Note: this method can run action or args methods of the target state for specified player
*/
final public function setPrivateState(int $playerId, int $newStateId): void
{
//
}
/**
* Get an associative array of current game state attributes.
*
* @see states.inc.php
*/
final public function state(bool $bSkipStateArgs = false, bool $bOnlyVariableContent = false, bool $bSkipReflexionTimeLoad = false): array
{
return [];
}
/**
* Get the id of the current game state (rarely useful, it's best to use name, unless you use constants for
* state ids).
*/
final public function state_id(): string|int
{
return '0';
}
/**
* For player with specified id private state will be reset to null, which means they will get out of private
* parallel states and be in a master state like the private states are not used.
*
* - Note: game needs to be in a master state which allows private parallel states
* - Note: this is usually used when deactivating player to clean up their parallel state
* - Note: After unseating private state only actions on master state are possible
* - Note: Usually it is not necessary to unset private state as it will be initialized to first private state
* when private states are needed again. Nevertheless, it is generally better to clean private state when not
* needed to avoid bugs.
*/
final public function unsetPrivateState(int $playerId): void
{
//
}
/**
* All players private state will be reset to null, which means they will get out of private parallel states and
* be in a master state like the private states are not used.
*
* - Note: game needs to be in a master state which allows private parallel states
* - Note: this is usually used to clean up after leaving a master state in which private states were used, but
* can be used in other cases when we want to exit private parallel states and use a regular multiactive state
* for all players
* - Note: After unseating private state only actions on master state are possible
* - Note: Usually it is not necessary to unset private states as they will be initialized to first private
* state when private states are needed again. Nevertheless, it is generally better to clean private state after
* exiting private parallel states to avoid bugs.
*/
final public function unsetPrivateStateForAllPlayers(): void
{
//
}
/**
* For players with specified ids private state will be reset to null, which means they will get out of private
* parallel states and be in a master state like the private states are not used.
*
* @param array<int> $playerIds
*/
final public function unsetPrivateStateForPlayers(array $playerIds): void
{
//
}
/**
* Sends update notification about multiplayer changes. All multiactive set* functions above do that, however if
* you want to change state manually using db queries for complex calculations, you have to call this yourself
* after.
*
* Do not call this if you're calling one of the other setters above.
*/
final public function updateMultiactiveOrNextState(string $nextStateIfNone): void
{
//
}
}
abstract class Globals
{
/**
* Delete global variables.
*
* @param string[] ...$names
*/
public function delete(...$names): void
{
//
}
/**
* Returns the value of `$name` if it exists. Otherwise, fallback on `$defaultValue`.
*/
public function get(string $name, mixed $defaultValue = null): mixed
{
return null;
}
/**
* Returns true if globals has a key `$name`.
*/
public function has(string $name): bool
{
return false;
}
/**
* Increment the global `$name` by `$step`.
*
* @throws BgaSystemException if the global `$name` is not a numeric value.
*/
public function inc(string $name, int $step): int
{
return 0;
}
/**
* Set `$name` with the value `$value`.
*/
public function set(string $name, mixed $value): void
{
//
}
}
abstract class Table extends APP_Object
{
/**
* Access the underlying game state object.
*/
readonly public GameState $gamestate;
/**
* Access the underlying global values.
*/
readonly public Globals $globals;
/**
* Default constructor.
*/
public function __construct()
{
//
}
/**
* Return the number of row affected by the last operation.
*
* @see mysql_affected_rows()
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final static public function DbAffectedRow(): int
{
return 0;
}
/**
* Return the PRIMARY key of the last inserted row
*
* @see mysql_insert_id()
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final static public function DbGetLastId(): int
{
return 0;
}
/**
* Performs a query on the database.
*
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final static public function DbQuery(string $sql): null|mysqli_result|bool
{
return null;
}
/**
* You must use this function on every string type data in your database that contains unsafe data (unsafe = can
* be modified by a player). This method makes sure that no SQL injection will be done through the string used.
*
* NOTE: if you are using standard types in ajax actions, like `AT_alphanum` it is sanitized before arrival,
* this is only needed if you manage to get unchecked string, like in the games where user has to enter text as
* a response.
*
* @see mysql_real_escape_string()
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final static public function escapeStringForDB(string $string): string
{
return '';
}
/**
* Return an array of rows for a sql SELECT query. The result is the same as `getCollectionFromDB` except that
* the result is a simple array (and not an associative array). The result can be empty.
*
* If you specified `$bUniqueValue = true` and if your SQL query request 1 field, the method returns directly an
* array of values.
*
* @see Table::getCollectionFromDB
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final static public function getObjectListFromDB(string $sql, bool $bUniqueValue = false): array
{
return [];
}
/**
* Returns a unique value from the database, or `null` if no value is found.
*
* @throws BgaSystemException Raise an exception if more than 1 row is returned.
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final static public function getUniqueValueFromDB(string $sql): mixed
{
return null;
}
/**
* Make the next player active in the natural player order.
*
* NOTE: You **cannot** use this method in an `activeplayer` or `multipleactiveplayer` state. You must use a
* `game` type game state for this.
*
* @return void
*/
final public function activeNextPlayer(): int|string
{
return '0';
}
/**
* Check if the current player can perform a specific action in the current game state, and optionally throw an
* exception if they can't.
*
* The action is valid if it is listed in the "possibleactions" array for the current game state (see game
* state description). This method MUST be the first one called in ALL your PHP methods that handle player
* actions, in order to make sure a player doesn't perform an action not allowed by the rules at the point in
* the game. It should not be called from methods where the current player is not necessarily the active player,
* otherwise it may fail with an "It is not your turn" exception.
*
* If `bThrowException` is set to `false`, the function returns false in case of failure instead of throwing an
* exception. This is useful when several actions are possible, in order to test each of them without throwing
* exceptions.
*
* @throws BgaSystemException if `$bThrowException` is true and a failure occurs
*/
final public function checkAction(string $actionName, bool $bThrowException = true): mixed
{
return null;
}
/**
* In some games, this is useful to eliminate a player from the game in order he/she can start another game
* without waiting for the current game end.
*
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Player_elimination
*/
final public function eliminatePlayer(int $playerId): void
{
//
}
/**
* Get the "active_player", whatever what is the current state type.
*
* Note: it does NOT mean that this player is active right now, because state type could be "game" or
* "multiplayer".
*
* Note: avoid using this method in a "multiplayer" state because it does not mean anything.
*/
final public function getActivePlayerId(): string|int
{
return '0';
}
/**
* Get the "active_player" name
*
* Note: avoid using this method in a "multiplayer" state because it does not mean anything.
*/
final public function getActivePlayerName(): string
{
return '';
}
/**
***************************************************************************************************************
* Globals.
**************************************************************************************************************
*/
/**
* Returns an associative array of rows for a SQL SELECT statement.
*
* The key of the resulting associative array is the first field specified in the SELECT query. The value of the
* resulting associative array is an associative array with all the field specified in the SELECT query and
* associated values. First column must be a primary or alternate key (semantically, it does not actually have
* to declared in sql as such). The resulting collection can be empty (it won't be null). If you specified
* `$bSingleValue = true` and if your SQL query requests 2 fields `A` and `B`, the method returns an associative
* array `A => B`, otherwise its `A => [A,B]`.
*
* NOTE: The name a bit misleading, it really returns associative array, i.e. map and NOT a collection. You
* cannot use it to get list of values which may have duplicates (hence primary key requirement on first
* column). If you need simple array use `getObjectListFromDB()` method.
*
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final public function getCollectionFromDB(string $sql, bool $bSingleValue = false): array
{
return [];
}
/**
* Get the "current_player". The current player is the one from which the action originated (the one who sent
* the request). In general, you shouldn't use this method, unless you are in "multiplayer" state.
*
* **NOTE: This is not necessarily the active player!**
*
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#File-Structure
*/
final public function getCurrentPlayerId(bool $bReturnNullIfNotLogged = false): string|int
{
return '0';
}
/**
* Return an associative array of associative array, from a SQL SELECT query. First array level correspond to
* first column specified in SQL query. Second array level correspond to second column specified in SQL query.
*
* If `$bSingleValue = true`, keep only third column on result
*
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final public function getDoubleKeyCollectionFromDB(string $sql, bool $bSingleValue = false): array
{
return [];
}
/**
* Returns an index of the selected language as defined in gameinfos.inc.php.
*/
final public function getGameLanguage(): string
{
return '';
}
/**
* Compute and return the current game progression.
*
* The number returned must be an integer between 0 and 100.
*
* This method is called each time we are in a game state with the "updateGameProgression" property set to true.
*
* @return int
* @see ./states.inc.php
*/
public function getGameProgression()
{
//
}
/**
* Retrieve the value of a global. Returns $default if global has not been initialized (by
* `setGameStateInitialValue`).
*
* NOTE: this method use globals "cache" if you directly manipulated globals table OR call this function after
* `undoRestorePoint()` - it won't work as expected.
*/
final public function getGameStateValue(string $label, int $default = 0): int|string
{
return '0';
}
/**
* Returns the value of a user preference for a player. It will return the value currently selected in the
* select combo box, in the top-right menu.
*/
final public function getGameUserPreference(int $playerId, int $prefId): ?int
{
return 0;
}
/**
* Returns game information. Please refer to `gameinfos.inc.php` for more information and returned array
* attributes.
*
* @return array{
* game_name: string,
* publisher: string,
* publisher_website: string,
* publisher_bgg_id: string,
* bgg_id: int,
* players: array<int>,
* suggest_player_number: ?array<int>,
* not_recommend_player_number: ?array<int>,
* estimated_duration: int,
* fast_additional_time: int,
* medium_additional_time: int,
* slow_additional_time: int,
* tie_breaker_description: string,
* losers_not_raned: bool,
* solo_mode_ranked: bool,
* is_beta: int,
* is_coop: int,
* language_dependency: bool,
* player_colors: array<string>,
* favorite_colors_support: bool,
* disable_player_order_swap_on_rematch: bool,
* game_interface_width: array{
* min: int,
* }
* }
* @see gameinfos.inc.php
*/
final public function getGameinfos(): array
{
return [];
}
/**
* Return an associative array which associate each player with the next player around the table.
*
* In addition, key 0 is associated to the first player to play.
*
* @return array<int, int>
*/
final public function getNextPlayerTable(): array
{
return [];
}
/**
* Same as `getCollectionFromDB`, but raises an exception if the collection is empty.
*
* @throws BgaSystemException if the collection is empty.
* @see Table::getCollectionFromDB()
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final public function getNonEmptyCollectionFromDB(string $sql): array
{
return [];
}
/**
* Returns one row for the sql SELECT query as an associative array or null if there is no result (where fields
* are keys mapped to values).
*
* @throws BgaSystemException if the query return no row.
* @see Table::getObjectFromDB()
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final public function getNonEmptyObjectFromDB(string $sql): array
{
return [];
}
/**
* Returns one row for the sql SELECT query as an associative array or null if there is no result (where fields
* are keys mapped to values).
*
* @throws BgaSystemException if the query return more than one row.
* @see https://en.doc.boardgamearena.com/Main_game_logic:_yourgamename.game.php#Accessing_the_database
*/
final public function getObjectFromDB(string $sql): array
{
return [];
}
/**
* Get player playing after given player in natural playing order.
*/
final public function getPlayerAfter(int $playerId): int
{
return 0;
}
/**
* Get player playing before given player in natural playing order.
*/
final public function getPlayerBefore(int $playerId): int
{
return 0;
}
/**
* Get the player color by player id;
*/
final public function getPlayerColorById(int $playerId): string
{
return '';
}
/**
* Get the player name by player id.
*/
final public function getPlayerNameById(int $playerId): string
{
return '';
}
/**
* Get 'player_no' (number) by player id.
*/
final public function getPlayerNoById(int $playerId): int
{
return 0;
}