source: binary-improvements/webserver/js/inventory_dialog.js@ 251

Last change on this file since 251 was 251, checked in by peter.souza, 9 years ago

Enemies (zombies and hostile animal entities) are now shown on the map as Hostiles and require permission level 'webapi.gethostilelocation' for web viewers to see.

Animals (non-hostile entities) are now shown on the map as Animals and require permission level 'webapi.getanimalslocation' for web viewers to see.

Permission level for 'webapi.viewallclaims' is now required for a viewer to see all claims, otherwise the permission level for 'webapi.getlandclaims' will only show viewer-owned claims. A viewer requires both 'webapi.getlandclaims' and 'webapi.viewallclaims' to be set for all claims to show (you can't just set 'webapi.viewallclaims').
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317405&viewfull=1#post317405

Permission level for 'webapi.viewallplayers' is now required for a viewer to see all players, otherwise the permission level for 'webapi.getplayerslocation' will only show the player for the currently-authenticated viewer. A viewer requires both 'webapi.getplayerslocation' and 'webapi.viewallplayers' to be set for all players to show (you can't just set 'webapi.viewallplayers').
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317405&viewfull=1#post317405

Banned players are now hidden from the web map.
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=320702&viewfull=1#post320702

Items using 'CustomIcon' and 'CustomIconTint' are now supported (although the exact tinting may not be perfectly the same as the game).
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317117&viewfull=1#post317117
https://7daystodie.com/forums/showthread.php?12837-Improvements-for-the-dedicated-server&p=317679&viewfull=1#post317679

Map marker icons for players, hostiles, and animals have been updated.

File size: 3.7 KB
Line 
1var ITEMICONBASEURL = "../itemicons/";
2
3var BAG_COLS = 8;
4var BAG_ROWS = 4;
5var BELT_COLS = 8;
6var INV_ITEM_WIDTH = 58;
7var INV_ITEM_HEIGHT = 40;
8
9function ShowInventoryDialog (steamid) {
10 var SetCellItem = function (containerTypeName, cellIdent, itemdata) {
11 var cell = $("#" + containerTypeName + "Field"+cellIdent);
12 var text = $("#" + containerTypeName + "FieldText"+cellIdent);
13 var qual = $("#" + containerTypeName + "FieldQuality"+cellIdent);
14
15 cell.attr("style", "background-image: none;");
16 cell.removeAttr("title");
17 text.removeClass ("visible");
18 qual.removeClass ("visible");
19
20 if (itemdata !== null) {
21 cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata.icon + "@@" + itemdata.iconcolor + ".png);");
22 if (itemdata.quality >= 0) {
23 cell.attr("title", itemdata.name + " (quality: " + itemdata.quality + ")");
24 qual.attr("style", "background-color: #"+ itemdata.qualitycolor);
25 qual.addClass ("visible");
26 } else {
27 cell.attr("title", itemdata.name);
28 text.text(itemdata.count);
29 text.addClass ("visible");
30 }
31 }
32 }
33
34 var SetEquipmentItem = function (data, name, cellIdent) {
35 if (data.equipment [name] == false) {
36 SetCellItem ("equipment", cellIdent, null);
37 } else {
38 SetCellItem ("equipment", cellIdent, data.equipment [name] );
39 }
40 }
41
42 $.getJSON( "../api/getplayerinventory", { steamid: steamid })
43 .done(function(data) {
44 $("#invPlayerName").text(data.playername);
45
46 for (var y = 0; y < BAG_ROWS; y++) {
47 for (var x = 0; x < BAG_COLS; x++) {
48 SetCellItem ("bag", x + "_" + y, data.bag[y*BAG_COLS+x]);
49 }
50 }
51
52 for (var x = 0; x < BELT_COLS; x++) {
53 SetCellItem ("belt", x, data.belt[x]);
54 }
55
56 SetEquipmentItem (data, "head", "0_0");
57 SetEquipmentItem (data, "eyes", "0_1");
58 SetEquipmentItem (data, "face", "0_2");
59 SetEquipmentItem (data, "armor", "1_0");
60 SetEquipmentItem (data, "jacket", "1_1");
61 SetEquipmentItem (data, "shirt", "1_2");
62 SetEquipmentItem (data, "legarmor", "2_0");
63 SetEquipmentItem (data, "pants", "2_1");
64 SetEquipmentItem (data, "boots", "2_2");
65 SetEquipmentItem (data, "gloves", "0_4");
66 SetEquipmentItem (data, "backpack", "2_4");
67
68 $( "#playerInventoryDialog" ).css("z-index", "1010").dialog({
69 dialogClass: "playerInventoryDialog",
70 modal: true,
71 width: BAG_COLS*(INV_ITEM_WIDTH+14) + 3*(INV_ITEM_WIDTH+14) + 20,
72 buttons: {
73 Ok: function() {
74 $( this ).dialog( "close" );
75 }
76 }
77 });
78 })
79 .fail(function(jqxhr, textStatus, error) {
80 console.log("Error fetching player inventory");
81 })
82 .always(function() {
83 });
84}
85
86function SetupInventoryDialog () {
87 var CreateInvCell = function (containerTypeName, cellIdent) {
88 return "<td class=\"invField\" id=\"" + containerTypeName + "Field"+cellIdent+"\">" +
89 "<div class=\"invFieldQuality\" id=\"" + containerTypeName + "FieldQuality" + cellIdent + "\"></div>" +
90 "<span class=\"invFieldText\" id=\"" + containerTypeName + "FieldText"+cellIdent+"\"></span>" +
91 "</td>";
92 }
93
94 for (var y = 0; y < BAG_ROWS; y++) {
95 $("#bagTable").append("<tr id=\"bagRow"+y+"\"></tr>");
96 for (var x = 0; x < BAG_COLS; x++) {
97 $("#bagRow"+y).append(CreateInvCell ("bag", x + "_" + y));
98 }
99 }
100
101 $("#beltTable").append("<tr id=\"beltRow0\"></tr>");
102 for (var x = 0; x < BELT_COLS; x++) {
103 $("#beltRow0").append(CreateInvCell ("belt", x));
104 }
105
106 for (var y = 0; y < 5; y++) {
107 $("#equipmentTable").append("<tr id=\"equipmentRow"+y+"\"></tr>");
108 if (y == 3) {
109 $("#equipmentRow"+y).append("<td colspan=\"3\"></td>");
110 } else {
111 for (var x = 0; x < 3; x++) {
112 if (y == 4 && x == 1) {
113 $("#equipmentRow"+y).append("<td></td>");
114 } else {
115 $("#equipmentRow"+y).append(CreateInvCell ("equipment", x + "_" + y));
116 }
117 }
118 }
119 }
120}
121
Note: See TracBrowser for help on using the repository browser.