Skip to content

Commit 76dfcac

Browse files
partial modernization
1 parent e76755d commit 76dfcac

41 files changed

Lines changed: 110 additions & 197 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func ParseConfig(filename string) (*Config, error) {
8888
Locator: false,
8989
Signs: true,
9090
MapserverAirutils: true,
91-
UnifiefMoneyAreaForSale: true,
91+
UnifiedMoneyAreaForSale: true,
9292
Phonograph: true,
9393
}
9494

app/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type MapObjectConfig struct {
6767
Signs bool `json:"signs"`
6868
MapserverAirutils bool `json:"mapserver_airutils"`
6969
Phonograph bool `json:"phonograph"`
70-
UnifiefMoneyAreaForSale bool `json:"um_area_forsale"`
70+
UnifiedMoneyAreaForSale bool `json:"um_area_forsale"`
7171
}
7272

7373
type WebApiConfig struct {

eventbus/eventbus.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ func New() *Eventbus {
2727
return &eb
2828
}
2929

30-
func (this *Eventbus) Emit(eventtype string, o interface{}) {
31-
this.mutex.RLock()
32-
defer this.mutex.RUnlock()
30+
func (b *Eventbus) Emit(eventtype string, o interface{}) {
31+
b.mutex.RLock()
32+
defer b.mutex.RUnlock()
3333

34-
for _, l := range this.listeners {
34+
for _, l := range b.listeners {
3535
l.OnEvent(eventtype, o)
3636
}
3737
}
3838

39-
func (this *Eventbus) AddListener(l Listener) {
40-
this.mutex.Lock()
41-
defer this.mutex.Unlock()
39+
func (b *Eventbus) AddListener(l Listener) {
40+
b.mutex.Lock()
41+
defer b.mutex.Unlock()
4242

43-
this.listeners = append(this.listeners, l)
43+
b.listeners = append(b.listeners, l)
4444
}

luaparser/luaparser.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package luaparser
22

33
import (
44
"errors"
5-
"github.com/yuin/gopher-lua"
65
"strconv"
6+
7+
lua "github.com/yuin/gopher-lua"
78
)
89

910
func New() *LuaParser {
@@ -47,15 +48,15 @@ func parseMap(t *lua.LTable) map[string]interface{} {
4748
return result
4849
}
4950

50-
func (this *LuaParser) ParseList(expr string) ([]map[string]interface{}, error) {
51+
func (lp *LuaParser) ParseList(expr string) ([]map[string]interface{}, error) {
5152
result := make([]map[string]interface{}, 0)
5253

53-
err := this.state.DoString(expr)
54+
err := lp.state.DoString(expr)
5455
if err != nil {
5556
return result, err
5657
}
5758

58-
lv := this.state.Get(-1)
59+
lv := lp.state.Get(-1)
5960

6061
tbl, ok := lv.(*lua.LTable)
6162
if !ok {
@@ -77,15 +78,15 @@ func (this *LuaParser) ParseList(expr string) ([]map[string]interface{}, error)
7778
return result, nil
7879
}
7980

80-
func (this *LuaParser) ParseMap(expr string) (map[string]interface{}, error) {
81+
func (lp *LuaParser) ParseMap(expr string) (map[string]interface{}, error) {
8182
result := make(map[string]interface{})
8283

83-
err := this.state.DoString(expr)
84+
err := lp.state.DoString(expr)
8485
if err != nil {
8586
return result, err
8687
}
8788

88-
lv := this.state.Get(-1)
89+
lv := lp.state.Get(-1)
8990

9091
tbl, ok := lv.(*lua.LTable)
9192
if !ok {

mapobject/atm.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ import (
99

1010
type ATM struct{}
1111

12-
func (this *ATM) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
12+
func (atm *ATM) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
1313
nodename := block.GetNodeName(x, y, z)
1414

1515
o := mapobjectdb.NewMapObject(mbpos, x, y, z, "atm")
1616

1717
switch nodename {
18-
case "atm:wtt", "um_wtt:wtt":
19-
o.Attributes["type"] = "wiretransfer"
20-
case "atm:atm2", "um_atm:atm_2":
21-
o.Attributes["type"] = "atm2"
22-
case "atm:atm3", "um_atm:atm_3":
23-
o.Attributes["type"] = "atm3"
24-
default:
25-
o.Attributes["type"] = "atm"
18+
case "atm:wtt", "um_wtt:wtt":
19+
o.Attributes["type"] = "wiretransfer"
20+
case "atm:atm2", "um_atm:atm_2":
21+
o.Attributes["type"] = "atm2"
22+
case "atm:atm3", "um_atm:atm_3":
23+
o.Attributes["type"] = "atm3"
24+
default:
25+
o.Attributes["type"] = "atm"
2626
}
2727

2828
return o

mapobject/bones.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
type BonesBlock struct{}
1212

13-
func (this *BonesBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
13+
func (bb *BonesBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
1414
md := block.Metadata.GetMetadata(x, y, z)
1515

1616
invMap := block.Metadata.GetInventoryMapAtPos(x, y, z)

mapobject/border.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
type BorderBlock struct{}
1111

12-
func (this *BorderBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
12+
func (bb *BorderBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
1313
md := block.Metadata.GetMetadata(x, y, z)
1414

1515
o := mapobjectdb.NewMapObject(mbpos, x, y, z, "border")

mapobject/digilinelcd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
type DigilineLcdBlock struct{}
1111

12-
func (this *DigilineLcdBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
12+
func (blk *DigilineLcdBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
1313
md := block.Metadata.GetMetadata(x, y, z)
1414

1515
o := mapobjectdb.NewMapObject(mbpos, x, y, z, "digilinelcd")

mapobject/digiterms.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
type DigitermsBlock struct{}
1111

12-
func (this *DigitermsBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
12+
func (blk *DigitermsBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
1313
md := block.Metadata.GetMetadata(x, y, z)
1414

1515
o := mapobjectdb.NewMapObject(mbpos, x, y, z, "digiterm")

mapobject/fancyvend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
type FancyVend struct{}
1515

16-
func (this *FancyVend) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
16+
func (blk *FancyVend) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
1717
md := block.Metadata.GetMetadata(x, y, z)
1818
nodename := block.GetNodeName(x, y, z)
1919
invMap := block.Metadata.GetInventoryMapAtPos(x, y, z)

0 commit comments

Comments
 (0)