|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Smr\Pages\Player; |
|
4
|
|
|
|
|
5
|
|
|
use AbstractSmrPlayer; |
|
6
|
|
|
use Menu; |
|
7
|
|
|
use Smr\Database; |
|
8
|
|
|
use Smr\Page\PlayerPage; |
|
9
|
|
|
use Smr\Page\ReusableTrait; |
|
10
|
|
|
use Smr\Template; |
|
11
|
|
|
use SmrGame; |
|
12
|
|
|
|
|
13
|
|
|
class AllianceOptions extends PlayerPage { |
|
14
|
|
|
|
|
15
|
|
|
use ReusableTrait; |
|
16
|
|
|
|
|
17
|
|
|
public string $file = 'alliance_option.php'; |
|
18
|
|
|
|
|
19
|
|
|
public function build(AbstractSmrPlayer $player, Template $template): void { |
|
20
|
|
|
$alliance = $player->getAlliance(); |
|
21
|
|
|
$template->assign('PageTopic', $alliance->getAllianceDisplayName(false, true)); |
|
22
|
|
|
Menu::alliance($alliance->getAllianceID()); |
|
23
|
|
|
|
|
24
|
|
|
// Create an array of links with descriptions |
|
25
|
|
|
$links = []; |
|
26
|
|
|
|
|
27
|
|
|
$isDraftGame = $player->getGame()->isGameType(SmrGame::GAME_TYPE_DRAFT); |
|
28
|
|
|
|
|
29
|
|
|
if ($isDraftGame && $player->isDraftLeader()) { |
|
30
|
|
|
// Draft leaders get to pick members |
|
31
|
|
|
$container = new AllianceDraftMember(); |
|
32
|
|
|
$links[] = [ |
|
33
|
|
|
'link' => create_link($container, 'Draft Members'), |
|
34
|
|
|
'text' => 'Choose members to join your alliance.', |
|
35
|
|
|
]; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
if (!$isDraftGame) { |
|
39
|
|
|
// Players can choose to leave their alliance (except in Draft games) |
|
40
|
|
|
$container = new AllianceLeaveConfirm(); |
|
41
|
|
|
$links[] = [ |
|
42
|
|
|
'link' => create_link($container, 'Leave Alliance'), |
|
43
|
|
|
'text' => 'Leave the alliance. Alliance leaders must hand over leadership before leaving.', |
|
44
|
|
|
]; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
$container = new AllianceShareMapsProcessor(); |
|
48
|
|
|
$links[] = [ |
|
49
|
|
|
'link' => create_link($container, 'Share Maps'), |
|
50
|
|
|
'text' => 'Share your knowledge of the universe with your alliance mates.', |
|
51
|
|
|
]; |
|
52
|
|
|
|
|
53
|
|
|
$role_id = $player->getAllianceRole($alliance->getAllianceID()); |
|
54
|
|
|
|
|
55
|
|
|
$db = Database::getInstance(); |
|
56
|
|
|
$dbResult = $db->read('SELECT * FROM alliance_has_roles WHERE alliance_id = ' . $db->escapeNumber($player->getAllianceID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND role_id = ' . $db->escapeNumber($role_id)); |
|
57
|
|
|
$dbRecord = $dbResult->record(); |
|
58
|
|
|
|
|
59
|
|
|
if ($dbRecord->getBoolean('change_pass')) { |
|
60
|
|
|
$container = new AllianceInvitePlayer(); |
|
61
|
|
|
$links[] = [ |
|
62
|
|
|
'link' => create_link($container, 'Invite Player'), |
|
63
|
|
|
'text' => 'Invite a player to the alliance.', |
|
64
|
|
|
]; |
|
65
|
|
|
} |
|
66
|
|
|
if ($dbRecord->getBoolean('remove_member')) { |
|
67
|
|
|
$container = new AllianceRemoveMember(); |
|
68
|
|
|
$links[] = [ |
|
69
|
|
|
'link' => create_link($container, 'Remove Member'), |
|
70
|
|
|
'text' => 'Remove a trader from alliance roster.', |
|
71
|
|
|
]; |
|
72
|
|
|
} |
|
73
|
|
|
if ($player->isAllianceLeader()) { |
|
74
|
|
|
$container = new AllianceLeadership(); |
|
75
|
|
|
$links[] = [ |
|
76
|
|
|
'link' => create_link($container, 'Handover Leadership'), |
|
77
|
|
|
'text' => 'Hand over leadership of the alliance to an alliance mate.', |
|
78
|
|
|
]; |
|
79
|
|
|
} |
|
80
|
|
|
if ($dbRecord->getBoolean('change_pass') || $dbRecord->getBoolean('change_mod')) { |
|
81
|
|
|
$container = new AllianceGovernance($alliance->getAllianceID()); |
|
82
|
|
|
$links[] = [ |
|
83
|
|
|
'link' => create_link($container, 'Govern Alliance'), |
|
84
|
|
|
'text' => 'Change the password, description or message of the day for the alliance.', |
|
85
|
|
|
]; |
|
86
|
|
|
} |
|
87
|
|
|
if ($dbRecord->getBoolean('change_roles')) { |
|
88
|
|
|
$container = new AllianceRoles(); |
|
89
|
|
|
$links[] = [ |
|
90
|
|
|
'link' => create_link($container, 'Define Alliance Roles'), |
|
91
|
|
|
'text' => 'Each member in your alliance can fit into a specific role, a task. Here you can define the roles that you can assign to them.', |
|
92
|
|
|
]; |
|
93
|
|
|
} |
|
94
|
|
|
if ($dbRecord->getBoolean('exempt_with')) { |
|
95
|
|
|
$container = new AllianceExemptAuthorize(); |
|
96
|
|
|
$links[] = [ |
|
97
|
|
|
'link' => create_link($container, 'Exempt Bank Transactions'), |
|
98
|
|
|
'text' => 'Here you can set certain alliance account transactions as exempt. This makes them not count against, or for, the player making the transaction in the bank report.', |
|
99
|
|
|
]; |
|
100
|
|
|
} |
|
101
|
|
|
if ($dbRecord->getBoolean('treaty_entry')) { |
|
102
|
|
|
$container = new AllianceTreaties(); |
|
103
|
|
|
$links[] = [ |
|
104
|
|
|
'link' => create_link($container, 'Negotiate Treaties'), |
|
105
|
|
|
'text' => 'Negotitate treaties with other alliances.', |
|
106
|
|
|
]; |
|
107
|
|
|
} |
|
108
|
|
|
if ($dbRecord->getBoolean('op_leader')) { |
|
109
|
|
|
$container = new AllianceSetOp(); |
|
110
|
|
|
$links[] = [ |
|
111
|
|
|
'link' => create_link($container, 'Schedule Operation'), |
|
112
|
|
|
'text' => 'Schedule and manage the next alliance operation and designate an alliance flagship.', |
|
113
|
|
|
]; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
$template->assign('Links', $links); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
} |
|
120
|
|
|
|