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
|
<?php
###################################################################
###### Battle Mania ######
###################################################################
###### Script by: LOVER$BOY ######
###### Description: Please leave this header. Thanks! ######
###### Contact: zodiacsohma1@gmail.com ######
###################################################################
function OnlineSyncDetails()
{
$sync_done = false;
$sync_msg = "";
//debugExecute("Syncing script with server...");
if (startswith(Base::$base->line, "ONLINE_PLAYERS_NUMBER"))
{
$humans = Base::$base->pieces[1];
$ais = Base::$base->pieces[2];
$h_alive = Base::$base->pieces[3];
$a_alive = Base::$base->pieces[4];
if ($humans != Base::$base->humans)
{
Base::$base->humans = $humans;
$sync_done = true;
$sync_msg = "Updated humans count";
}
if ($ais != Base::$base->ais)
{
Base::$base->ais = $ais;
$sync_done = true;
$sync_msg = "Updated ais count";
}
if ($h_alive != Base::$base->humans_alive)
{
Base::$base->humans_alive = $h_alive;
$synched = true;
$sync_msg = "Updated humans alive count";
}
if ($a_alive != Base::$base->ai_alive)
{
Base::$base->ai_alive = $a_alive;
$sync_done = true;
$sync_msg = "Updated ai alive count";
}
}
if (startswith(Base::$base->line, "ONLINE_PLAYERS_ALIVE"))
{
for ($i = 1; $i < count(Base::$base->pieces); $i++)
{
$player = Base::$base->pieces[$i];
$p = getPlayerByLog($player);
if (isset($p) && $p instanceof Player)
{
if (isset($p->cycle) && $p->cycle instanceof Cycle)
{
if (!$p->cycle->alive)
{
$p->cycle->alive = true;
$sync_done = true;
$sync_msg = "Set the cycle for ".$p." to alive";
}
}
else
{
new Cycle(new Coord(), new Coord(), $p, $p->team);
$sync_done = true;
$sync_msg = "Created new cycle for ".$p;
}
}
}
// declaring round winner under normal circumstances
if ((Base::$base->game_mode == 0) && (count(Base::$base->pieces) == 2) && (count(Base::$base->players_respawn) == 0) && !Base::$base->roundFinished && !Base::$base->winner)
{
debugExecute("Winner Script: 0xff9999Assigning a round winner");
$winner = getPlayerByLog(Base::$base->pieces[1]);
assign_round_winner($winner);
}
}
if (startswith(Base::$base->line, "ONLINE_PLAYERS_DEAD"))
{
for ($i = 1; $i < count(Base::$base->pieces); $i++)
{
$player = Base::$base->pieces[$i];
$p = getPlayerByLog($player);
if (isset($p) && $p instanceof Player)
{
if (isset($p->cycle) && $p->cycle instanceof Cycle)
{
if ($p->cycle->alive)
{
$p->cycle->alive = false;
$sync_done = true;
$sync_msg = "Set the cycle for ".$p." to dead";
}
}
}
}
}
if ($sync_done)
debugExecute("0xaa77aaScript Sync: 0x77ff22".$sync_msg);
}
|