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

Method playCommand

modules/gambling/gambling.go:176–200  ·  view source on GitHub ↗

playCommand handles "play slots" / "play slot machine" / "play claw machine" / "play claw".

(rest string, user *users.UserRecord, room *rooms.Room, flags events.EventFlag)

Source from the content-addressed store, hash-verified

174
175// playCommand handles "play slots" / "play slot machine" / "play claw machine" / "play claw".
176func (g *GamblingModule) playCommand(rest string, user *users.UserRecord, room *rooms.Room, flags events.EventFlag) (bool, error) {
177
178 arg := strings.TrimSpace(rest)
179
180 if m, c := util.FindMatchIn(arg, `slot machine`, `slots`, `slot`); m != `` || c != `` {
181 if !roomHasSlots(room) {
182 user.SendText(`There is no slot machine here.`)
183 return true, nil
184 }
185 g.playSlots(user, room)
186 return true, nil
187 }
188
189 if m, c := util.FindMatchIn(arg, `claw machine`, `claw`); m != `` || c != `` {
190 if !roomHasClaw(room) {
191 user.SendText(`There is no claw machine here.`)
192 return true, nil
193 }
194 g.playClaw(user, room)
195 return true, nil
196 }
197
198 user.SendText(`Play what? Try <ansi fg="command">play slots</ansi> or <ansi fg="command">play claw machine</ansi>.`)
199 return true, nil
200}

Callers

nothing calls this directly

Calls 6

playSlotsMethod · 0.95
playClawMethod · 0.95
FindMatchInFunction · 0.92
roomHasSlotsFunction · 0.85
roomHasClawFunction · 0.85
SendTextMethod · 0.45

Tested by

no test coverage detected