Beispiel #1
0
func GetNpcByName(name string) types.NPC {
	id := db.FindOne(types.NpcType, bson.M{"name": utils.FormatName(name)})
	if id != nil {
		return GetNpc(id)
	}
	return nil
}
Beispiel #2
0
func GetWorld() types.World {
	id := db.FindOne(types.WorldType, bson.M{})
	if id == nil {
		return db.NewWorld()
	}
	return db.Retrieve(id, types.WorldType).(types.World)
}
Beispiel #3
0
func GetPlayerCharacterByName(name string) types.PC {
	id := db.FindOne(types.PcType, bson.M{"name": utils.FormatName(name)})
	if id != nil {
		return GetPlayerCharacter(id)
	}
	return nil
}
Beispiel #4
0
func GetSkillByName(name string) types.Skill {
	id := db.FindOne(types.SkillType, bson.M{"name": utils.FormatName(name)})
	if id != nil {
		return GetSkill(id)
	}
	return nil
}
Beispiel #5
0
func GetUserByName(username string) types.User {
	id := db.FindOne(types.UserType, bson.M{"name": utils.FormatName(username)})
	if id != nil {
		return GetUser(id)
	}
	return nil
}
Beispiel #6
0
func GetAreaByName(name string) types.Area {
	id := db.FindOne(types.AreaType, bson.M{"name": utils.FormatName(name)})
	if id != nil {
		return GetArea(id)
	}
	return nil
}
Beispiel #7
0
func StoreIn(roomId types.Id) types.Store {
	id := db.FindOne(types.StoreType, bson.M{"roomid": roomId})

	if id != nil {
		return GetStore(id)
	}
	return nil
}
Beispiel #8
0
func GetRoomByLocation(coordinate types.Coordinate, zoneId types.Id) types.Room {
	id := db.FindOne(types.RoomType, bson.M{
		"zoneid":   zoneId,
		"location": coordinate,
	})
	if id != nil {
		return GetRoom(id)
	}
	return nil
}