/// <summary> /// Gets armour prototype. /// </summary> /// <param name="model"> /// Model of armour prototype requested. /// </param> public async Task <ArmourProtModel> Get(ArmourProtModel model) { var prot = Translate(model); var protEntry = await _access.Get(prot); var modelEntry = await Translate(protEntry); return(modelEntry); }
/// <summary> /// Gets room object. /// </summary> /// <param name="room"> /// Model of room to get. /// </param> public async Task <RoomModel> Get(RoomModel room) { var save = new Room { RoomID = room.Id }; //get a save armour with given id save = await _gameDataAccess.Get(save); //if one doesn't exist return if (save == null) { return(null); } room.Id = save.RoomID; room.Seen = save.Seen == 1; room.TTL = save.TTL; room.Level = save.Level; room.Type = save.RoomType; //get a prototype of a room var prot = await _protDataAccess.Get(new RoomProt { RoomType = room.Type }); //if prototype has any items or enchant in it if (prot.Items > 0 || prot.Enchanting == 1) { //get shop object for room room = await GetShop(room, save); } //if room prototype has an enemy in it and it's the first tame player has entered that room if (prot.Enemy == 1 && !room.Seen) { //set fightevent as not null room.FightEvent = new FightModel(); } //fill a list of adjacent rooms room = await FillExits(room); return(room); }