-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathGetPopupContent.php
More file actions
140 lines (131 loc) · 5.73 KB
/
GetPopupContent.php
File metadata and controls
140 lines (131 loc) · 5.73 KB
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
<?php
require __DIR__ . "/components/Menus.php";
include "./Libraries/HTTPLibraries.php";
$gameName = $_GET["gameName"];
if (!IsGameNameValid($gameName)) {
echo ("Invalid game name.");
exit;
}
$playerID = $_GET["playerID"];
$authKey = TryGet("authKey", "");
$popupType = $_GET["popupType"];
$chainLinkIndex = TryGet("chainLinkIndex", "");
ob_start();
include "./ParseGamestate.php";
include "./GameLogic.php";
include "./Libraries/SHMOPLibraries.php";
include "./Libraries/UILibraries2.php";
include "./Libraries/StatFunctions.php";
include "./Libraries/PlayerSettings.php";
include_once 'Assets/patreon-php-master/src/PatreonDictionary.php';
include "./GameTerms.php";
include "./HostFiles/Redirector.php";
include_once "./includes/functions.inc.php";
ob_end_clean();
session_start();
$cardSize = 120;
$params = explode("-", $popupType);
$popupType = $params[0];
switch ($popupType) {
case "myPitchPopup":
echo (CreatePopup("myPitchPopup", $myPitch, 1, 0, "Your Pitch"));
break;
case "myResourcePopup":
if($playerID == 3) echo (CreatePopup("myResourcePopup", $myArsenal, 1, 0, "Your Resources", ResourcePieces()));
else echo (CreatePopup("myResourcePopup", [], 1, 0, "Your Resources", 1, ResourceUI()));
break;
case "myDiscardPopup":
if($playerID == 3) echo (CreatePopup("myDiscardPopup", $myDiscard, 1, 0, "Your Discard", DiscardPieces()));
else echo (CreatePopup("myDiscardPopup", [], 1, 0, "Your Discard", 1, DiscardUI($playerID)));
break;
case "myBanishPopup":
if ($playerID == 3) {
$myBanishDisplay = GetMyBanishForDisplay($playerID);
echo (CreatePopup("myBanishPopup", $myBanishDisplay, 1, 0, "Banish Zone"));
}
else echo (CreatePopup("myBanishPopup", [], 1, 0, "Your Banish", 1, BanishUI()));
break;
case "myDeckPopup":
echo (CreatePopup("myDeckPopup", $myDeck, 1, 0, "Your Deck (In order from top to bottom"));
break;
case "myStatsPopup":
echo (CreatePopup("myStatsPopup", [], 1, 0, "Your Game Stats", 1, CardStats($playerID), "./", true));
break;
case "menuPopup":
if (IsGameOver()) {
if($roguelikeGameID != "")
{
$content = CreateButton($playerID, "Continue Adventure", 100011, 0, "24px", "", "", false, true);
}
else
{
$otherP = ($playerID == 1 ? 2 : 1);
$parsedFormat = GetCurrentFormat();
$isPremierStrict = $parsedFormat === Formats::$PremierStrict || $parsedFormat === Formats::$PreviewStrict;
$endBo3 = BestOf3IsOver();
$myWins = GetCachePiece($gameName, $playerID + 24);
$theirWins = GetCachePiece($gameName, $otherP + 24);
$content = "";
$content .= EndGameRematchButtons($playerID, $endBo3, $myWins, $theirWins, $gameName, $isPremierStrict, $isPremierQuick);
$content .= CreateButton($playerID, "Report Bug", 100003, 0, "24px") . "<BR>";
$content .= BlockOpponentButtons($playerID);
}
$content .= "</div>";
$time = ($playerID == 1 ? $p1TotalTime : $p2TotalTime);
$totalTime = $p1TotalTime + $p2TotalTime;
$content .= "<BR><span class='Time-Span'>Your Play Time: " . intval($time / 60) . "m" . $time % 60 . "s - Game Time: " . intval($totalTime / 60) . "m" . $totalTime % 60 . "s</span>";
$content .= CardStats($playerID);
$verb = $playerID == $winner ? "Won!" : "Lost";
echo CreatePopup("OVER", [], 1, 1, "You {$verb}", 1, $content, "./", true);
} else {
echo (CreatePopup("menuPopup", [], 1, 0, "Main Menu", 1, MainMenuUI(), "./", true));
}
break;
case "leaveGame":
echo (CreatePopup("leaveGame", [], 1, 0, "Leave Game", 1, LeaveGameUI(), "./", true));
break;
case "mySoulPopup":
echo (CreatePopup("mySoulPopup", $mySoul, 1, 0, "My Soul"));
break;
case "theirBanishPopup":
$theirBanishDisplay = GetTheirBanishForDisplay($playerID);
echo (CreatePopup("theirBanishPopup", $theirBanishDisplay, 1, 0, "Opponent's Banish Zone"));
break;
case "theirPitchPopup":
echo (CreatePopup("theirPitchPopup", $theirPitch, 1, 0, "Opponent's Pitch Zone"));
break;
case "theirDiscardPopup":
$otherPlayer = ($playerID == 1 ? 2 : 1);
if($playerID == 3) echo (CreatePopup("theirDiscardPopup", $theirDiscard, 1, 0, "Opponent's Discard Zone", DiscardPieces()));
else echo (CreatePopup("theirDiscardPopup", [], 1, 0, "Opponent's Discard", 1, DiscardUI($otherPlayer)));
break;
case "theirSoulPopup":
echo (CreatePopup("theirSoulPopup", $theirSoul, 1, 0, "Opponent's Soul"));
break;
case "chainLinkPopup":
$popupIndex = intval(($chainLinkIndex != "" ? $chainLinkIndex : $params[1]));
echo (CreatePopup("chainLinkPopup-" . $popupIndex, [], 1, 0, "Summary Chain Link " . $popupIndex + 1, 1, ChainLinkPopup($popupIndex), "./", false, false, "Total Damage Dealt: " . $chainLinkSummary[$popupIndex * ChainLinkSummaryPieces()]));
break;
case "concedeGame":
echo (CreatePopup("concedeGame", [], 1, 0, "Concede Game", 1, ConcedeGameUI(), "./", true));
break;
default:
break;
}
function ChainLinkPopup($link)
{
global $chainLinks, $cardSize, $playerID, $mainPlayer, $defPlayer;
$rv = "";
for ($i = 0; $i < count($chainLinks[$link]); $i += ChainLinksPieces()) {
if ($chainLinks[$link][$i + 1] == $mainPlayer && CardType($chainLinks[$link][$i]) != "AR")
{
$attackValue = SpecificCardPower(AttackerMZID(), $mainPlayer) + $chainLinks[$link][$i + 4];
}
else $attackValue = 0;
if ($chainLinks[$link][$i + 1] == $defPlayer) $blockValue = BlockValue($chainLinks[$link][$i]) + $chainLinks[$link][$i + 5];
else $blockValue = 0;
$rv .= Card($chainLinks[$link][$i], "concat", $cardSize, 0, 1, 0, ($chainLinks[$link][$i + 1] == $playerID ? 1 : 2), 0, "", "", false, 0, $blockValue, $attackValue);
//$rv .= $chainLinks[$link][$i] . " ";
}
return $rv;
}