Проба вывода информации о принадлежности к событию...
[cswow.git] / module / armory / show_char_inventory.php
blobec9bb68e7a5da13df824f5ba07e5f528fe100d4a
1 <?php
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/";
12 return
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>"
17 ."</tbody></table>";
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;
37 $posx = $slot*48+28;
38 $posy = 229;
39 show_item_by_guid($container['item'], 'armory', $posx, $posy);
41 echo "</div>";
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);
57 echo "</div>";
59 function drawKeyRing($bag)
61 $count = 0;
62 for($id = KEYRING_SLOT_START; $id<KEYRING_SLOT_END;$id++)
63 if (@$bag[$id]) $count=$id-KEYRING_SLOT_START;
64 if (!$count)
65 return;
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);
77 echo "</div>";
79 function drawContainer($guid, $bag)
81 $item_data = getItemData($guid);
82 if ($item_data == 0 || @$item_data[ITEM_FIELD_TYPE]!=TYPE_CONTAINER)
83 return;
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);
97 echo "</div>";
100 function showPlayerInventory($guid, $char_data)
102 global $lang, $cDB;
103 $inventory = $cDB->select(
104 "SELECT
105 `bag` AS ARRAY_KEY_1,
106 `slot` AS ARRAY_KEY_2,
107 `item`,
108 `item_template`
109 FROM `character_inventory`
110 WHERE `guid` = ?d
111 ORDER BY `bag`, `slot`", $guid);
113 echo "<table width=100%><tbody><tr><td>";
114 if ($inventory)
115 foreach($inventory as $id=>$bag)
117 if ($id == 0)
119 drawBankFrame($bag);
120 drawBackPack($bag);
121 drawKeyRing($bag);
123 // foreach($bag as $slot=>$container)
124 // show_item_by_guid($container['item']);
126 else
128 echo "<span style=\"float: left;\">";
129 drawContainer($id, $bag);
130 echo "</span>";
133 echo "</td></tr></tbody></table>";