MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / Get

Method Get

internal/characters/worn.go:21–45  ·  view source on GitHub ↗

Get returns a pointer to the item in the given slot, or nil for an unrecognized slot type. This is the single place that maps an ItemType to a Worn struct field; add new slots here and nowhere else.

(slot items.ItemType)

Source from the content-addressed store, hash-verified

19// unrecognized slot type. This is the single place that maps an ItemType to a
20// Worn struct field; add new slots here and nowhere else.
21func (w *Worn) Get(slot items.ItemType) *items.Item {
22 switch slot {
23 case items.Weapon:
24 return &w.Weapon
25 case items.Offhand:
26 return &w.Offhand
27 case items.Head:
28 return &w.Head
29 case items.Neck:
30 return &w.Neck
31 case items.Body:
32 return &w.Body
33 case items.Belt:
34 return &w.Belt
35 case items.Gloves:
36 return &w.Gloves
37 case items.Ring:
38 return &w.Ring
39 case items.Legs:
40 return &w.Legs
41 case items.Feet:
42 return &w.Feet
43 }
44 return nil
45}
46
47// Set places item into the given slot. Does nothing for an unrecognized slot.
48func (w *Worn) Set(slot items.ItemType, item items.Item) {

Callers 15

TestWorn_GetFunction · 0.95
TestWorn_SetFunction · 0.95
StatModMethod · 0.95
EnableAllMethod · 0.95
GetAllItemsMethod · 0.95
travelCostMethod · 0.45
disallowedTypesMethod · 0.45
disallowedSubtypesMethod · 0.45
buildClawPrizesMethod · 0.45
clawPrizeWeightMethod · 0.45
playClawMethod · 0.45
clawMachineNounDescMethod · 0.45

Calls

no outgoing calls