2 //==============================================================================
3 // Скрипт предназначен для вывода инвенторя/содержимого банка/сумок банка игрока
4 //==============================================================================
6 function generateBagTable($slot)
8 $top = ($slot&3)?
"bag_top_2.gif":"bag_top_0.gif";
9 $height= ((($slot +
2)>>2)-1)*41;
10 $sub = ($slot&3)?
21:0;
11 $imgdir="images/player_info/bank/";
13 "<table class=noborder width=185px cellSpacing=0 cellPadding=0><tbody>"
14 ."<tr><td style=\"background: url(".$imgdir.$top.") no-repeat bottom; height: ".(88-$sub)."px;\"></dt></tr>"
15 ."<tr><td style=\"background: url(".$imgdir."bag_middle.gif) bottom; height: ".$height."px;\"></dt></tr>"
16 ."<tr><td style=\"background: url(".$imgdir."bag_bottom.gif) no-repeat bottom; height: 3px;\"></dt></tr>"
20 function drawBankFrame($bag)
22 $img="images/player_info/bank/bankframe.gif";
23 echo "<div style=\"position: relative; width: 392px; height: 354px\">";
24 echo "<img src=$img style=\"position: absolute; left: 0px; top: 0px;\">";
25 for($id = BANK_SLOT_ITEM_START
; $id<BANK_SLOT_ITEM_END
;$id++
)
26 if ($container = @$bag[$id])
28 $slot = $id-BANK_SLOT_ITEM_START
;
29 $posx = ($slot%7
)*48+
28;
30 $posy = ((int)($slot/7))*44+
28;
31 show_item_by_guid($container['item'], 'armory', $posx, $posy);
33 for($id = BANK_SLOT_BAG_START
; $id<BANK_SLOT_BAG_END
;$id++
)
34 if ($container = @$bag[$id])
36 $slot = $id-BANK_SLOT_BAG_START
;
39 show_item_by_guid($container['item'], 'armory', $posx, $posy);
43 function drawBackPack($bag)
45 echo "<div style=\"position: relative; width: 185px;\">";
46 echo generateBagTable(16);
47 $bagico = "images/icons/inv_misc_bag_08.jpg";
48 echo "<img src=$bagico width=38 style=\"position: absolute; left: 3px; top: 3px;\">";
49 for($id = INVENTORY_SLOT_ITEM_START
; $id<INVENTORY_SLOT_ITEM_END
;$id++
)
50 if ($container = @$bag[$id])
52 $slot = $id-INVENTORY_SLOT_ITEM_START
;
53 $posx = ($slot &3)*41+
16;
54 $posy = ($slot>>2)*41+
49;
55 show_item_by_guid($container['item'], 'armory', $posx, $posy);
59 function drawKeyRing($bag)
62 for($id = KEYRING_SLOT_START
; $id<KEYRING_SLOT_END
;$id++
)
63 if (@$bag[$id]) $count=$id-KEYRING_SLOT_START
;
66 $count = ($count+
3)&(~
3);
67 echo "<div style=\"position: relative; width: 185px;\">";
68 echo generateBagTable($count);
69 for($id = KEYRING_SLOT_START
; $id<KEYRING_SLOT_END
;$id++
)
70 if ($container = @$bag[$id])
72 $slot = $id-KEYRING_SLOT_START
;
73 $posx = ($slot &3)*41+
16;
74 $posy = ($slot>>2)*41+
49;
75 show_item_by_guid($container['item'], 'armory', $posx, $posy);
79 function drawContainer($guid, $bag)
81 $item_data = getItemData($guid);
82 if ($item_data == 0 ||
@$item_data[ITEM_FIELD_TYPE
]!=TYPE_CONTAINER
)
84 $slot = $item_data[CONTAINER_FIELD_NUM_SLOTS
];
85 echo "<div style=\"position: relative; width: 185px;\">";
86 echo generateBagTable($slot);
87 $bagico = getItemIconFromItemId($item_data[ITEM_FIELD_ENTRY
]);
88 echo "<img src=$bagico width=38 style=\"position: absolute; left: 3px; top: 3px;\">";
89 $sub = ($slot&3)?
21:0;
90 foreach($bag as $id=>$container)
92 $pos = $id +
($slot&3);
93 $posx = ($pos &3)*41+
16;
94 $posy = ($pos>>2)*41+
49-$sub;
95 show_item_by_guid($container['item'], 'armory', $posx, $posy);
100 function showPlayerInventory($guid, $char_data)
103 $inventory = $cDB->select(
105 `bag` AS ARRAY_KEY_1,
106 `slot` AS ARRAY_KEY_2,
109 FROM `character_inventory`
111 ORDER BY `bag`, `slot`", $guid);
113 echo "<table width=100%><tbody><tr><td>";
115 foreach($inventory as $id=>$bag)
123 // foreach($bag as $slot=>$container)
124 // show_item_by_guid($container['item']);
128 echo "<span style=\"float: left;\">";
129 drawContainer($id, $bag);
133 echo "</td></tr></tbody></table>";