~armagetronad-ap/armagetronad/BattleMania

« back to all changes in this revision

Viewing changes to src/special/shop.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:
29
29
    $type = $name = "";
30
30
 
31
31
    $record = getRecord($player->log);
32
 
    if (isset($record) && !is_null($record) && $record instanceof Record)
 
32
    if (isset($record) && $record instanceof Record)
33
33
    {
34
34
        if (isset(Base::$base->pieces[5]))
35
35
            $type = Filter(Base::$base->pieces[5]);
61
61
                    if (isset(Item::$items[$start]))
62
62
                    {
63
63
                        $item = Item::$items[$start];
64
 
                        if (isset($item) && !is_null($item) && $item instanceof Item)
 
64
                        if (isset($item) && $item instanceof Item)
65
65
                        {
66
66
                            pm($player, "0x44ccff$".$item->money." 0xffff7f- 0x77ff99".$item);
67
67
                        }
79
79
 
80
80
            case "buy":
81
81
                $item_obj = Item::GetItem($name);
82
 
                if (isset($item_obj) && !is_null($item_obj) && $item_obj instanceof Item && ($item_obj->money > 0))
 
82
                if (isset($item_obj) & $item_obj instanceof Item && ($item_obj->money > 0))
83
83
                {
84
84
                    if ($record->money->amount >= $item_obj->money)
85
85
                    {
93
93
                        else
94
94
                        {
95
95
                            $item = $record->bag->getItem($item_obj);
96
 
                            if (isset($item) && !is_null($item) && $item instanceof Item)
 
96
                            if (isset($item) && $item instanceof Item)
97
97
                            {
98
98
                                if ($item->num < $item->max)
99
99
                                {
120
120
 
121
121
            case "sell":
122
122
                $items = Item::GetItem($name);
123
 
                if (isset($items) && !is_null($items) && $items instanceof Item)
 
123
                if (isset($items) && $items instanceof Item)
124
124
                {
125
125
                    $amount = $items->money / 2;
126
126
                    if ($record->bag->itemExists($items))
127
127
                    {
128
128
                        $item = $record->bag->getItem($items);
129
 
                        if (isset($item) && !is_null($item) && $item instanceof Item)
 
129
                        if (isset($item) && $item instanceof Item)
130
130
                        {
131
131
                            if (($item->num > 0) && ($item->num <= $item->max))
132
132
                            {