Example #1
0
func DeleteUser(userId types.Id) {
	for _, character := range GetUserCharacters(userId) {
		DeleteCharacter(character.GetId())
	}

	db.DeleteObject(userId)
}
Example #2
0
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)
}
Example #3
0
func DeleteZone(zoneId types.Id) {
	rooms := GetRoomsInZone(zoneId)

	for _, room := range rooms {
		DeleteRoom(room)
	}

	db.DeleteObject(zoneId)
}
Example #4
0
func DeleteStore(id types.Id) {
	// TODO - Delete or drop items
	db.DeleteObject(id)
}
Example #5
0
func DeleteSkill(id types.Id) {
	db.DeleteObject(id)
}
Example #6
0
func DeleteItem(itemId types.Id) {
	db.DeleteObject(itemId)
}
Example #7
0
func DeleteArea(areaId types.Id) {
	// TODO - Remove room references to area
	db.DeleteObject(areaId)
}
Example #8
0
func DeleteCharacter(charId types.Id) {
	// TODO: Delete (or drop) inventory
	db.DeleteObject(charId)
}