func DeleteUser(userId types.Id) { for _, character := range GetUserCharacters(userId) { DeleteCharacter(character.GetId()) } db.DeleteObject(userId) }
func DeleteRoom(room types.Room) { db.DeleteObject(room.GetId()) // Disconnect all exits leading to this room loc := room.GetLocation() updateRoom := func(dir types.Direction) { next := loc.Next(dir) room := GetRoomByLocation(next, room.GetZoneId()) if room != nil { room.SetExitEnabled(dir.Opposite(), false) } } updateRoom(types.DirectionNorth) updateRoom(types.DirectionNorthEast) updateRoom(types.DirectionEast) updateRoom(types.DirectionSouthEast) updateRoom(types.DirectionSouth) updateRoom(types.DirectionSouthWest) updateRoom(types.DirectionWest) updateRoom(types.DirectionNorthWest) updateRoom(types.DirectionUp) updateRoom(types.DirectionDown) }
func DeleteZone(zoneId types.Id) { rooms := GetRoomsInZone(zoneId) for _, room := range rooms { DeleteRoom(room) } db.DeleteObject(zoneId) }
func DeleteStore(id types.Id) { // TODO - Delete or drop items db.DeleteObject(id) }
func DeleteSkill(id types.Id) { db.DeleteObject(id) }
func DeleteItem(itemId types.Id) { db.DeleteObject(itemId) }
func DeleteArea(areaId types.Id) { // TODO - Remove room references to area db.DeleteObject(areaId) }
func DeleteCharacter(charId types.Id) { // TODO: Delete (or drop) inventory db.DeleteObject(charId) }