From b32b45e725eb6a1f6ae3193ec5ede9b58473e2fc Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Sat, 23 Feb 2019 17:07:53 +0100 Subject: [PATCH] shop fixes --- server/mapobject/fancyvend.go | 18 ++++++++++++++---- .../static/js/overlays/TechnicQuarryOverlay.js | 2 +- .../static/js/overlays/TechnicSwitchOverlay.js | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/server/mapobject/fancyvend.go b/server/mapobject/fancyvend.go index 62cc659..461c532 100644 --- a/server/mapobject/fancyvend.go +++ b/server/mapobject/fancyvend.go @@ -5,6 +5,7 @@ import ( "mapserver/mapblockparser" "mapserver/mapobjectdb" "strconv" + "github.com/sirupsen/logrus" ) @@ -26,6 +27,14 @@ func (this *FancyVend) onMapObject(x, y, z int, block *mapblockparser.MapBlock) giveInv := invMap["given_item"] mainInv := invMap["main"] + if payInv == nil || giveInv == nil { + return nil + } + + if payInv.Items == nil || giveInv.Items == nil { + return nil + } + if payInv.Items[0].IsEmpty() || giveInv.Items[0].IsEmpty() { return nil } @@ -33,10 +42,10 @@ func (this *FancyVend) onMapObject(x, y, z int, block *mapblockparser.MapBlock) settings, err := parser.ParseMap(md["settings"]) if err != nil { fields := logrus.Fields{ - "x": x, - "y": y, - "z": z, - "pos": block.Pos, + "x": x, + "y": y, + "z": z, + "pos": block.Pos, "err": err, } log.WithFields(fields).Error("Fancyvend setting error") @@ -76,6 +85,7 @@ func (this *FancyVend) onMapObject(x, y, z int, block *mapblockparser.MapBlock) o := mapobjectdb.NewMapObject(block.Pos, x, y, z, "shop") o.Attributes["owner"] = md["owner"] + o.Attributes["type"] = md["fancyvend"] o.Attributes["in_item"] = in_item o.Attributes["in_count"] = strconv.Itoa(in_count) diff --git a/server/static/js/overlays/TechnicQuarryOverlay.js b/server/static/js/overlays/TechnicQuarryOverlay.js index 3a6c300..a425325 100644 --- a/server/static/js/overlays/TechnicQuarryOverlay.js +++ b/server/static/js/overlays/TechnicQuarryOverlay.js @@ -1,7 +1,7 @@ 'use strict'; var TechnicQuarryIcon = L.icon({ - iconUrl: 'pics/default_tool_mesepick.png.png', + iconUrl: 'pics/default_tool_mesepick.png', iconSize: [16, 16], iconAnchor: [8, 8], diff --git a/server/static/js/overlays/TechnicSwitchOverlay.js b/server/static/js/overlays/TechnicSwitchOverlay.js index ad653d3..127a6db 100644 --- a/server/static/js/overlays/TechnicSwitchOverlay.js +++ b/server/static/js/overlays/TechnicSwitchOverlay.js @@ -1,7 +1,7 @@ 'use strict'; var TechnicSwitchIcon = L.icon({ - iconUrl: 'pics/technic_water_mill_top_active.png.png', + iconUrl: 'pics/technic_water_mill_top_active.png', iconSize: [16, 16], iconAnchor: [8, 8], @@ -10,7 +10,7 @@ var TechnicSwitchIcon = L.icon({ var TechnicSwitchOverlay = AbstractIconOverlay.extend({ initialize: function(wsChannel, layerMgr) { - AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "technicswitch", TechnicQuarryIcon); + AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "technicswitch", TechnicSwitchIcon); }, createPopup: function(sw){