~armagetronad-ap/armagetronad/BattleMania

« back to all changes in this revision

Viewing changes to src/tron/deaths.php

  • Committer: zodiacsohma1 at gmail
  • Date: 2014-03-02 08:09:55 UTC
  • Revision ID: zodiacsohma1@gmail.com-20140302080955-r5ot6eipfe0nlpww
Simplified all fields and code in all areas for better as they seem to repeat themselves.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    if ((startswith(Base::$base->line, "DEATH_SUICIDE"))/* || (startswith(Base::$base->line, "DEATH_DEATHZONE"))*/)
15
15
    {
16
16
        $killed = getPlayerByLog(Base::$base->pieces[1]);
17
 
        if (isset($killed) && !is_null($killed) && $killed instanceof Player)
 
17
        if (isset($killed) && $killed instanceof Player)
18
18
        {
19
19
            $killed_record = getRecord($killed->log);
20
20
            switch (Base::$base->game_mode)
21
21
            {
22
22
                //  zombie challenge
23
23
                case 1:
24
 
                    if (isset($killed_record) && !is_null($killed_record) && $killed_record instanceof Record)
 
24
                    if (isset($killed_record) && $killed_record instanceof Record)
25
25
                    {
26
26
                        if ($killed_record->bag->survive->time == 0)
27
27
                        {
55
55
                            respawn_player($killed, $killed->cycle->spawn_pos, $killed->cycle->spawn_dir);
56
56
                    }
57
57
 
58
 
                    if (isset($killed_record) && !is_null($killed_record) && $killed_record instanceof Record)
 
58
                    if (isset($killed_record) && $killed_record instanceof Record)
59
59
                    {
60
60
                        $killed_record->kills->suicide += 1;
61
61
 
94
94
                        errorLog($ex);
95
95
                    }
96
96
 
97
 
                    if (isset($killed_record) && !is_null($killed_record) && $killed_record instanceof Record)
 
97
                    if (isset($killed_record) && $killed_record instanceof Record)
98
98
                    {
99
99
                        $killed_record->kills->suicide += 1;
100
100
 
114
114
 
115
115
        try
116
116
        {
117
 
            if ((isset($killed) && !is_null($killed) && $killed instanceof Player) && (isset($killer) && !is_null($killer) && $killer instanceof Player))
 
117
            if ((isset($killed) && $killed instanceof Player) && (isset($killer) && !is_null($killer) && $killer instanceof Player))
118
118
            {
119
119
                $killed_record = getRecord($killed->log);
120
120
                $killer_record = getRecord($killer->log);
122
122
                //  no need to parse this if its done during zombie challenge
123
123
                if (Base::$base->game_mode != 1)
124
124
                {
125
 
                    if ($killed->human && isset($killed_record) && !is_null($killed_record) && ($killed_record instanceof Record))
 
125
                    if ($killed->human && isset($killed_record) && ($killed_record instanceof Record))
126
126
                    {
127
127
                        $killed_record->kills->bkilled++;
128
128
 
141
141
 
142
142
                        $gainExp   = $killer_record->experience->gainExp(2);
143
143
                        $gainMoney = $killer_record->money->Gain(1);
144
 
                        if (isset($killed_record) && !is_null($killed_record) && $killed_record instanceof Record)
 
144
                        if (isset($killed_record) && $killed_record instanceof Record)
145
145
                        {
146
146
                            $gainExp   = $killer_record->experience->gainExp($killed_record->experience->level, 3);
147
147
                            $gainMoney = $killer_record->money->Gain($killed_record->experience->level);
167
167
        $killed = getPlayerByLog(Base::$base->pieces[1]);
168
168
        $killer = getPlayerByLog(Base::$base->pieces[2]);
169
169
 
170
 
        if ((isset($killed) && !is_null($killed) && $killed instanceof Player) && (isset($killer) && !is_null($killer) && $killer instanceof Player))
 
170
        if ((isset($killed) && $killed instanceof Player) && (isset($killer) && !is_null($killer) && $killer instanceof Player))
171
171
        {
172
172
            $killed_record = getRecord($killed->log);
173
173
            $killer_record = getRecord($killer->log);