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

Method FindKeyInBackpack

internal/characters/character.go:307–323  ·  view source on GitHub ↗
(lockId string)

Source from the content-addressed store, hash-verified

305}
306
307func (c *Character) FindKeyInBackpack(lockId string) (items.Item, bool) {
308
309 lockId = strings.ToLower(lockId)
310
311 for _, itm := range c.GetAllBackpackItems() {
312 itmSpec := itm.GetSpec()
313 if itmSpec.Type != items.Key {
314 continue
315 }
316
317 if itmSpec.KeyLockId == lockId {
318 return itm, true
319 }
320 }
321
322 return items.Item{}, false
323}
324
325func (c *Character) HasKey(lockId string, difficulty int) (hasKey bool, hasSequence bool) {
326

Callers 3

GoFunction · 0.80
UnlockFunction · 0.80
LockFunction · 0.80

Calls 2

GetAllBackpackItemsMethod · 0.95
GetSpecMethod · 0.45

Tested by

no test coverage detected