Exemple #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
}
Exemple #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)
}
Exemple #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
}
Exemple #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
}
Exemple #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
}
Exemple #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
}
Exemple #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
}
Exemple #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
}