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

Method GetExits

internal/scripting/room_func.go:293–334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

291}
292
293func (r ScriptRoom) GetExits() []map[string]any {
294
295 exits := []map[string]any{}
296
297 seed := string(configs.GetServerConfig().Seed)
298 for exitName, exitInfo := range r.roomRecord.Exits {
299
300 exitMap := map[string]any{
301 "Name": exitName,
302 "RoomId": exitInfo.RoomId,
303 "Secret": exitInfo.Secret,
304 "Lock": false,
305 "temporary": false,
306 }
307
308 if exitInfo.HasLock() {
309 lockId := fmt.Sprintf(`%d-%s`, r.roomId, exitName)
310 exitMap["Lock"] = map[string]any{
311 "LockId": lockId,
312 "Difficulty": exitInfo.Lock.Difficulty,
313 "Sequence": util.GetLockSequence(lockId, int(exitInfo.Lock.Difficulty), seed),
314 }
315 } else {
316 exitMap["Lock"] = nil
317 }
318
319 exits = append(exits, exitMap)
320 }
321
322 for _, exitInfo := range r.roomRecord.ExitsTemp {
323 exitMap := map[string]any{
324 "Name": exitInfo.Title,
325 "RoomId": exitInfo.RoomId,
326 "Secret": false,
327 "Lock": false,
328 "temporary": true,
329 }
330 exits = append(exits, exitMap)
331 }
332
333 return exits
334}
335
336func (r ScriptRoom) IsLocked(exitName string) bool {
337

Callers 2

onCommandFunction · 0.80
onCommandFunction · 0.80

Calls 3

GetServerConfigFunction · 0.92
GetLockSequenceFunction · 0.92
HasLockMethod · 0.45

Tested by

no test coverage detected