private void onPreviewPlant(PlantType type) { Debug.Log("Previewing plant"); // TODO: change prefab base on position float rangeRadius = 0; switch (type) { case PlantType.PLANT1: rangeRadius = plant1Prefab.GetComponent <CircleCollider2D>().radius; break; case PlantType.PLANT2: rangeRadius = plant2Prefab.GetComponent <CircleCollider2D>().radius; break; case PlantType.PLANT3: rangeRadius = plant3Prefab.GetComponent <CircleCollider2D>().radius; break; } float currentRadius = rangePreview.GetComponent <Renderer>().bounds.size.x / 2; float scaleRatio = rangeRadius / currentRadius; rangePreview.transform.localScale *= scaleRatio; rangePreview.SetActive(true); }
public async Task <ActionResult <PlantType> > PostPlantType(PlantType plantType) { _context.PlantTypes.Add(plantType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPlantType", new { id = plantType.PlantTypeId }, plantType)); }
private void onCreatePlant(GameObject selector, PlantType plantType) { Destroy(plantSelector); plantSelector = null; switch (plantType) { case PlantType.PLANT1: plant = (GameObject)Instantiate(plant1Prefab, transform.position, Quaternion.identity); break; case PlantType.PLANT2: plant = (GameObject)Instantiate(plant2Prefab, transform.position, Quaternion.identity); break; case PlantType.PLANT3: plant = (GameObject)Instantiate(plant3Prefab, transform.position, Quaternion.identity); break; } if (plant != null) { if (isAmbientEnabled) { AudioSource audioSource = gameObject.GetComponent <AudioSource>(); audioSource.PlayOneShot(audioSource.clip); } gameManager.Gold -= plant.GetComponent <PlantData>().CurrentLevel.cost; } rangePreview.SetActive(false); // Disable idle animation GetComponent <Animator>().SetBool("HasPlant", true); }
private async void LoadForm(string transaction, PlantType type = null) { PlantTypeForm form = new PlantTypeForm() { TransactionForm = transaction, PlantTypeData = (type == null) ? new PlantType() : type, PrimaryButtonText = (transaction == "Add Plant Type") ? "Save" : "Update" }; var result = await form.ShowAsync(); if (result == ContentDialogResult.Primary) { string message = ""; switch (form.TransactionResult) { case 0: message = (form.TransactionForm == "Add Plant Type") ? "Plant Type Inserted to the Database" : "Plant Type Updated in the Database"; break; case 1: message = "The System had run to an Error"; break; case 2: message = "Information is Already Exists in the Database"; break; } MessageDialog dialog = new MessageDialog(message); await dialog.ShowAsync(); this.InitializePage(); } }
private List <string> GetToxisityAray(PlantType type) { List <string> toxisity = new List <string>(); if (type.ToxicToCats) { toxisity.Add("Cats"); } if (type.ToxicToDogs) { toxisity.Add("Dogs"); } if (type.ToxicToSmallAnimals) { toxisity.Add("Small-Animals"); } if (toxisity.Count == 0) { toxisity.Add("Pet-Safe"); } return(toxisity); }
/// <summary> /// Counts the non diagonal neighbouring plants of the given type /// </summary> private int CountNonDiagonalPlants(IZone zone, PlantType plantType, int x, int y, int origX, int origY) { var counter = 0; for (var i = 0; i <= 3; i++) { var xo = _nonDiagonalNeighbours[i * 2]; var yo = _nonDiagonalNeighbours[i * 2 + 1]; var tx = x + xo < zone.Size.Width ? x + xo : x; var ty = y + yo < zone.Size.Height ? y + yo : y; if (tx == origX && ty == origY) { counter++; continue; } var plantInfo = zone.Terrain.Plants.GetValue(tx, ty); if (plantInfo.type == plantType) { counter++; } } return(counter); }
static Cypress() { _id = ItemID.Cypress; _name = "檜木"; _description = ""; _type = PlantType.Wood; }
public IQueryable <Temp> GetMetaData(string tableName) { switch (tableName) { case "Plants": Plant Plant = new Plant(); return(Plant.GetMetaData().AsQueryable()); case "PlantTypes": PlantType PlantType = new PlantType(); return(PlantType.GetMetaData().AsQueryable()); case "PlantCodes": PlantCode PlantCode = new PlantCode(); return(PlantCode.GetMetaData().AsQueryable()); default: //no table exists for the given tablename given... List <Temp> tempList = new List <Temp>(); Temp temp = new Temp(); temp.ID = 0; temp.Int_1 = 0; temp.Bool_1 = true; //bool_1 will flag it as an error... temp.Name = "Error"; temp.ShortChar_1 = "Table " + tableName + " Is Not A Valid Table Within The Given Entity Collection, Or Meta Data Was Not Defined For The Given Table Name"; tempList.Add(temp); return(tempList.AsQueryable()); } }
public IdentifiedSeed(string name, PlantType type) { Name = name; Type = type; Thirst = 0.0f; }
static Hemp() { _id = ItemID.Hemp; _name = "麻草"; _description = ""; _type = PlantType.Herb; }
public async Task <IActionResult> PutPlantType([FromRoute] int id, [FromBody] PlantType plantType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != plantType.Id) { return(BadRequest()); } _context.Entry(plantType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlantTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void Start() { string url, location; if (GetViewName() == PLANTS_VIEW) { Plant currentPlant = PlantsService.plant; location = currentPlant._request.GetAddress(); url = ENV.GOOGLE_MAPS_COORD_URL.Replace("PLACE", location); } else if (GetViewName() == SUBMISSIONS_VIEW) { MissionAnswer currentAnswer = MissionsService.missionAnswer; location_lat = (currentAnswer.location_lat != null ? currentAnswer.location_lat : "0"); location_lng = (currentAnswer.location_lng != null ? currentAnswer.location_lng : "0"); location = location_lat + "," + location_lng; url = ENV.GOOGLE_MAPS_COORD_URL.Replace("PLACE", location); } else { PlantType plantType = PlantsService.type; url = plantType.photo; } if (url != null) { StartCoroutine(_ShowImage(url)); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: { m_Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { if (version < 1) { m_Level = SecureLevel.CoOwners; } m_PlantStatus = (PlantStatus)reader.ReadInt(); m_PlantType = (PlantType)reader.ReadInt(); m_PlantHue = (PlantHue)reader.ReadInt(); m_ShowType = reader.ReadBool(); if (m_PlantStatus < PlantStatus.DecorativePlant) { m_PlantSystem = new PlantSystem(this, reader); } break; } } }
static RawRubber() { _id = ItemID.Rubber; _name = "生橡膠"; _description = ""; _type = PlantType.Product; }
public LevelInfo(Dictionary<PlantType, int> target, Currency startingFunds, PlantType[] disabled) { this.target = target; this.startingFunds = startingFunds; isComplete = false; this.disabled = new List<PlantType>(disabled); }
static Cotton() { _id = ItemID.Cotton; _name = "棉花"; _description = ""; _type = PlantType.Product; }
public IActionResult Create([FromBody] UserPlantCreateViewModel model) { if (!ModelState.IsValid) { return(UnprocessableEntity(new ValidationErrorModel(ModelState))); } PlantType type = _plantData.GetPlantType(model.PlantTypeID); UserPlant plant = new UserPlant { OwnerID = model.OwnerID, NickName = model.NickName, WherePurchased = model.WherePurchased, PlantType = type, LastWatered = model.LastWatered, WaterAgain = GetNextWater(model.LastWatered, type), LastFertalized = model.LastFertalized, FertalizeAgain = GetNextFeed(model.LastFertalized, type), Birtdhday = model.Birthday, IsDeleted = false, ReceiveNotifications = model.ReceiveNotifications, IsFavorite = false, PrimaryImageID = model.PrimaryImageID ?? type.StockImageID }; _plantData.Add(plant); _plantData.Commit(); return(Created("", new UserPlantDisplayViewModel(plant))); }
public static List <Temp> GetMetaData(this PlantType entityObject) { XERP.Server.DAL.PlantDAL.DALUtility dalUtility = new DALUtility(); List <Temp> tempList = new List <Temp>(); int id = 0; using (PlantEntities ctx = new PlantEntities(dalUtility.EntityConectionString)) { var c = ctx.PlantTypes.FirstOrDefault(); var queryResults = from meta in ctx.MetadataWorkspace.GetItems(DataSpace.CSpace) .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType) from query in (meta as EntityType).Properties .Where(p => p.DeclaringType.Name == entityObject.GetType().Name) select query; if (queryResults.Count() > 0) { foreach (var queryResult in queryResults.ToList()) { Temp temp = new Temp(); temp.ID = id; temp.Name = queryResult.Name.ToString(); temp.ShortChar_1 = queryResult.TypeUsage.EdmType.Name; if (queryResult.TypeUsage.EdmType.Name == "String") { temp.Int_1 = Convert.ToInt32(queryResult.TypeUsage.Facets["MaxLength"].Value); } temp.Bool_1 = false; //we use this as a error trigger false = not an error... tempList.Add(temp); id++; } } } return(tempList); }
List <Vector2> GetValidCoordsForType(PlantType typ) { List <Vector2> list = new List <Vector2> (); // now populate the world! for (int i = 0; i < worldX; i++) { for (int j = 0; j < worldY; j++) { // i want a functor and a filter here :s bool isValid = false; // skip if not a plant if (world [i, j].tileType != TileType.plant) { continue; } // can't spawn a plant on top of another plant if (world [i, j].hasPlant) { continue; } // welcome to the imperative version! switch (typ) { case PlantType.corn: isValid = CheckCornValid(i, j); break; case PlantType.potato: isValid = CheckPotatoValid(i, j); break; case PlantType.onion: isValid = CheckOnionValid(i, j); break; case PlantType.garlic: isValid = CheckGarlicValid(i, j); break; case PlantType.shroom: isValid = CheckPotatoValid(i, j); break; case PlantType.any: isValid = true; break; } if (isValid) { list.Add(new Vector2(i, j)); } } } return(list); }
// Randomly decide plant type // Okay, so, this is janky. I know. But let me explain. // All plants essentially have the exact same behavior. // Legit. There's not change in behavior at all. // So, I figured, lets just like, keep a list of all possible models they could use, then when the plant is created, set the appropriate models and get rid of the rest // It works. It's janky. Not sure if it is scalable but it seemed the simplest method at the time and game jam time is running out private void SetPlantType() { typeIndex = Random.Range(0, listBrokenModels.Count); brokenModel = listBrokenModels[typeIndex]; repairedModel = listRepairedModels[typeIndex]; plantType = (PlantType)typeIndex; // Destroy models for (int i = 0; i < listBrokenModels.Count; i++) { if (i != typeIndex) { Destroy(listBrokenModels[i]); } } // Destroy models for (int i = 0; i < listBrokenModels.Count; i++) { if (i != typeIndex) { Destroy(listRepairedModels[i]); } } // Clear the lists we don't need them listBrokenModels.Clear(); listRepairedModels.Clear(); }
private void Refresh() {//refetch current records... long selectedAutoID = SelectedPlantType.AutoID; string autoIDs = ""; //bool isFirstItem = true; foreach (PlantType itemType in PlantTypeList) {//auto seeded starts at 1 any records at 0 or less or not valid records... if (itemType.AutoID > 0) { autoIDs = autoIDs + itemType.AutoID.ToString() + ","; } } if (autoIDs.Length > 0) { //ditch the extra comma... autoIDs = autoIDs.Remove(autoIDs.Length - 1, 1); PlantTypeList = new BindingList <PlantType>(_serviceAgent.RefreshPlantType(autoIDs).ToList()); SelectedPlantType = (from q in PlantTypeList where q.AutoID == selectedAutoID select q).FirstOrDefault(); Dirty = false; AllowCommit = false; } }
private async void Save() { if (string.IsNullOrEmpty(PlantName) || string.IsNullOrEmpty(PlantStage) || string.IsNullOrEmpty(PlantMedium)) { EmptyFields = "Red"; } else { await App.Database.SavePlantAsync(new Plant { PlantName = PlantName, PlantStage = PlantStage, PlantMedium = PlantMedium, PlantDate = PlantDate, PlantStrain = PlantStrain, PlantType = PlantType.ToString(), }); await Shell.Current.GoToAsync("//PlantsTab"); PlantName = string.Empty; PlantStage = emptyfields; PlantDate = System.DateTime.Now; IsVisible = false; EmptyFields = "Transparent"; } }
//PlantType Object Scope Validation check the entire object for validity... private byte PlantTypeIsValid(PlantType item, out string errorMessage) { //validate key errorMessage = ""; if (string.IsNullOrEmpty(item.PlantTypeID)) { errorMessage = "ID Is Required."; return(1); } EntityStates entityState = GetPlantTypeState(item); if (entityState == EntityStates.Added && PlantTypeExists(item.PlantTypeID, ClientSessionSingleton.Instance.CompanyID)) { errorMessage = "Item All Ready Exists."; return(1); } //check cached list for duplicates... int count = PlantTypeList.Count(q => q.PlantTypeID == item.PlantTypeID); if (count > 1) { errorMessage = "Item All Ready Exists."; return(1); } //validate Description if (string.IsNullOrEmpty(item.Description)) { errorMessage = "Description Is Required."; return(1); } //a value of 2 is pending changes... //On Commit we will give it a value of 0... return(2); }
private void ChangeKeyLogic() { if (!string.IsNullOrEmpty(SelectedPlantType.PlantTypeID)) {//check to see if key is part of the current companylist... PlantType query = PlantTypeList.Where(company => company.PlantTypeID == SelectedPlantType.PlantTypeID && company.AutoID != SelectedPlantType.AutoID).FirstOrDefault(); if (query != null) {//revert it back... SelectedPlantType.PlantTypeID = SelectedPlantTypeMirror.PlantTypeID; //change to the newly selected company... SelectedPlantType = query; return; } //it is not part of the existing list try to fetch it from the db... PlantTypeList = GetPlantTypeByID(SelectedPlantType.PlantTypeID, XERP.Client.ClientSessionSingleton.Instance.CompanyID); if (PlantTypeList.Count == 0)//it was not found do new record required logic... { NotifyNewRecordNeeded("Record " + SelectedPlantType.PlantTypeID + " Does Not Exist. Create A New Record?"); } else { SelectedPlantType = PlantTypeList.FirstOrDefault(); } } else { string errorMessage = "ID Is Required."; NotifyMessage(errorMessage); //revert back to the value it was before it was changed... if (SelectedPlantType.PlantTypeID != SelectedPlantTypeMirror.PlantTypeID) { SelectedPlantType.PlantTypeID = SelectedPlantTypeMirror.PlantTypeID; } } }
static Log() { _id = ItemID.Log; _name = "木頭"; _description = ""; _type = PlantType.Wood; }
public async Task <ApiResult <bool> > UpdatePlantType(int id, PlantType plantType) { try { var stopwatch = Stopwatch.StartNew(); _logger.LogInformation("Update plantType"); plantType.Id = id; var result = await _treeService.UpdatePlantType(plantType); _logger.LogInformation("Update plantType complete"); stopwatch.Stop(); result.ExecutionTime = stopwatch.Elapsed.TotalMilliseconds; _logger.LogInformation($"Execution time: {result.ExecutionTime}ms"); return(result); } catch (Exception ex) { _logger.LogInformation($"Update plantType error: {ex}"); return(new ApiResult <bool> { Result = false, ApiCode = ApiCode.UnknownError, ErrorMessage = ex.ToString() }); } }
static Bamboo() { _id = ItemID.Bamboo; _name = "竹子"; _description = ""; _type = PlantType.Wood; }
public IActionResult Update(int id, [FromBody] UserPlantUpdateViewModel model) { UserPlant plant = _plantData.Get(id); if (plant == null) { return(NotFound()); } if (!ModelState.IsValid) { return(UnprocessableEntity(new ValidationErrorModel(ModelState))); } PlantType plantType = _plantData.GetPlantType(model.TypeID); plant.NickName = model.NickName; plant.WherePurchased = model.WherePurchased; plant.PlantType = plantType; plant.ReceiveNotifications = model.ReceiveNotifications; plant.IsFavorite = model.IsFavorite; plant.PrimaryImageID = model.PrimaryImageID; UserPlantDisplayViewModel updated = new UserPlantDisplayViewModel(plant); _plantData.Update(plant); _plantData.Commit(); return(Ok(updated)); }
private void Exterminate(PlantType plantType) { while (m_PlantMap.ContainsKey(plantType) && m_PlantMap[plantType].Count > 0) { KillPlant(m_PlantMap[plantType].First()); } }
static Coconut() { _id = ItemID.Coconut; _name = "椰子"; _description = ""; _type = PlantType.Product; }
private IEnumerable <TPlant> GetPlants <TPlant>(PlantType type) where TPlant : PlantBase { return(!m_PlantMap.ContainsKey(type) ? Enumerable.Empty <TPlant>() : m_PlantMap[type].Select(pb => (TPlant)pb)); }
private async void Save_Clicked(object sender, EventArgs e) { PlantType newType; if (enterNewType.IsToggled) { newType = new PlantType() { PlantTypeName = typeEntry.Text, }; MainPage.conn.Insert(newType); } else { newType = (PlantType)typePicker.SelectedItem; } SubType newSubType = new SubType() { SubTypeName = subTypeEntry.Text, DaysToHarvest = Int32.Parse(daysEntry.SelectedItem.ToString()), PlantTypeId = newType.PlantTypeId, Description = descEntry.Text }; MainPage.conn.Insert(newSubType); MainPage.LoadListFromTables(); await Navigation.PopAsync(); }
public void UnregisterLifeform(PlantType pt) { if (islandFlora != null) { islandFlora.Remove(pt); } }
public void PlantSeed(Mobile from, Seed seed) { if (m_PlantStatus >= PlantStatus.FullGrownPlant) { LabelTo(from, 1061919); // You must use a seed on a bowl of dirt! } else if (!IsUsableBy(from)) { LabelTo(from, 1061921); // The bowl of dirt must be in your pack, or you must lock it down. } else if (m_PlantStatus != PlantStatus.BowlOfDirt) { from.SendLocalizedMessage(1080389, "#" + GetLocalizedPlantStatus().ToString()); // This bowl of dirt already has a ~1_val~ in it! } else if (m_PlantSystem.Water < 2) { LabelTo(from, 1061920); // The dirt in this bowl needs to be softened first. } else { m_PlantType = seed.PlantType; m_PlantHue = seed.PlantHue; m_ShowType = seed.ShowType; seed.Delete(); PlantStatus = PlantStatus.Seed; m_PlantSystem.Reset(false); LabelTo(from, 1061922); // You plant the seed in the bowl of dirt. } }
public static int GetBonsaiTitle(PlantType plantType) { switch (plantType) { case PlantType.CommonGreenBonsai: case PlantType.CommonPinkBonsai: return(1063335); // common case PlantType.UncommonGreenBonsai: case PlantType.UncommonPinkBonsai: return(1063336); // uncommon case PlantType.RareGreenBonsai: case PlantType.RarePinkBonsai: return(1063337); // rare case PlantType.ExceptionalBonsai: return(1063341); // exceptional case PlantType.ExoticBonsai: return(1063342); // exotic default: return(0); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_PlantType = (PlantType)reader.ReadInt(); m_PlantHue = (PlantHue)reader.ReadInt(); m_ShowType = reader.ReadBool(); if (Weight != 1.0) { Weight = 1.0; } if (version < 1) { Stackable = true; } if (version < 2 && PlantHueInfo.IsCrossable(m_PlantHue)) { m_PlantHue |= PlantHue.Reproduces; } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] PlantType plantType) { if (id != plantType.PlantTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(plantType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlantTypeExists(plantType.PlantTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(plantType)); }
public static void Generate(Point2D[] points, TileType type, PlantType tSpring, PlantType tSummer, PlantType tAutomn, PlantType tWinter, int range) { for (int i = 0; i < points.Length; ++i) { Point2D p = points[i]; //Console.WriteLine(p.ToString()); int count; if (range == 80) { count = 10; } else if (range == 60) { count = 7; } else if (range == 40) { count = 3; } else { count = 1; } PlantSpawner ps = new PlantSpawner(p, type, tSpring, tSummer, tAutomn, tWinter, range, count, BaseMinDelay, BaseMaxDelay); } }
static Oak() { _id = ItemID.Oak; _name = "橡木"; _description = ""; _type = PlantType.Wood; }
public Plant(PlantType type, decimal age, decimal size) { Type = type; Size = size; Age = age; Construct (); }
public void PlantSpawned(PlantType type) { if(!plants.ContainsKey(type)) { plants[type] = 0; } plants[type]++; CheckLevelComplete(); }
public static PlantTypeInfo GetInfo( PlantType plantType ) { int index = (int)plantType; if ( index >= 0 && index < m_Table.Length ) return m_Table[index]; else return m_Table[0]; }
private PlantTypeInfo( int itemID, int offsetX, int offsetY, PlantType plantType, bool containsPlant, bool flowery, bool crossable ) { m_ItemID = itemID; m_OffsetX = offsetX; m_OffsetY = offsetY; m_PlantType = plantType; m_ContainsPlant = containsPlant; m_Flowery = flowery; m_Crossable = crossable; }
public static PlantResourceInfo GetInfo( PlantType plantType, PlantHue plantHue ) { foreach ( PlantResourceInfo info in m_ResourceList ) { if ( info.PlantType == plantType && info.PlantHue == plantHue ) return info; } return null; }
public Seed( PlantType plantType, PlantHue plantHue, bool showType ) : base( 0xDCF ) { Weight = 1.0; m_PlantType = plantType; m_PlantHue = plantHue; m_ShowType = showType; Hue = PlantHueInfo.GetInfo( plantHue ).Hue; }
public Seed(PlantType plantType, PlantHue plantHue, bool showType) : base(0xDCF) { this.Weight = 1.0; this.Stackable = Core.SA; this.m_PlantType = plantType; this.m_PlantHue = plantHue; this.m_ShowType = showType; this.Hue = PlantHueInfo.GetInfo(plantHue).Hue; }
public void PlantSeed( Mobile from, Seed seed ) { if ( m_PlantStatus >= PlantStatus.FullGrownPlant ) { LabelTo( from, 1061919 ); // You must use a seed on a bowl of dirt! } else if ( !IsUsableBy( from ) ) { LabelTo( from, 1061921 ); // The bowl of dirt must be in your pack, or you must lock it down. } else if ( m_PlantStatus != PlantStatus.BowlOfDirt ) { from.SendLocalizedMessage( 1080389, "#" + GetLocalizedPlantStatus().ToString() ); // This bowl of dirt already has a ~1_val~ in it! } else if ( m_PlantSystem.Water < 2 ) { LabelTo( from, 1061920 ); // The dirt in this bowl needs to be softened first. } else { m_PlantType = seed.PlantType; m_PlantHue = seed.PlantHue; m_ShowType = seed.ShowType; seed.Consume(); PlantStatus = PlantStatus.Seed; m_PlantSystem.Reset( false ); LabelTo( from, 1061922 ); // You plant the seed in the bowl of dirt. } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 2: case 1: { m_Level = (SecureLevel) reader.ReadInt(); goto case 0; } case 0: { if ( version < 1 ) m_Level = SecureLevel.CoOwners; m_PlantStatus = (PlantStatus) reader.ReadInt(); m_PlantType = (PlantType) reader.ReadInt(); m_PlantHue = (PlantHue) reader.ReadInt(); m_ShowType = reader.ReadBool(); if ( m_PlantStatus < PlantStatus.DecorativePlant ) m_PlantSystem = new PlantSystem( this, reader ); if ( version < 2 && PlantHueInfo.IsCrossable( m_PlantHue ) ) m_PlantHue |= PlantHue.Reproduces; break; } } m_Instances.Add( this ); }
private void AppendPlantQuality(PlantType pType, PlantQualityType plantQualityType) { UserPlantQuality plant = new UserPlantQuality() { UserID = ContextUser.UserID, GeneralID = generalID, PlantType = pType, PlantQuality = plantQualityType, RefreshNum = 1, RefreshDate = DateTime.Now }; new GameDataCacheSet<UserPlantQuality>().Add(plant, GameEnvironment.CacheUserPeriod); }
protected override object this[string index] { get { #region switch (index) { case "UserID": return UserID; case "GeneralID": return GeneralID; case "PlantType": return PlantType; case "PlantQuality": return PlantQuality; case "RefreshNum": return RefreshNum; case "RefreshDate": return RefreshDate; default: throw new ArgumentException(string.Format("UserPlantQuality index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToNotNullString(); break; case "GeneralID": _GeneralID = value.ToInt(); break; case "PlantType": _PlantType = value.ToEnum<PlantType>(); break; case "PlantQuality": _PlantQuality = value.ToEnum<PlantQualityType>(); break; case "RefreshNum": _RefreshNum = value.ToInt(); break; case "RefreshDate": _RefreshDate = value.ToDateTime(); break; default: throw new ArgumentException(string.Format("UserPlantQuality index[{0}] isn't exist.", index)); } #endregion } }
public static int ConvertType( PlantType type ) { //convert from distro plant type switch( type ) { case PlantType.CampionFlowers : return 0 ; // campion flowers 1st case PlantType.Poppies : return 1 ; // poppies case PlantType.Snowdrops : return 2 ; // snowdrops case PlantType.Bulrushes : return 3 ; // bulrushes case PlantType.Lilies : return 4 ; // lilies case PlantType.PampasGrass : return 5 ; // pampas grass case PlantType.Rushes : return 6 ; // rushes case PlantType.ElephantEarPlant : return 7 ; // elephant ear plant case PlantType.Fern : return 8 ; // fern 1st case PlantType.PonytailPalm : return 9 ; // ponytail palm case PlantType.SmallPalm : return 10; // small palm case PlantType.CenturyPlant : return 11; // century plant case PlantType.WaterPlant : return 12; // water plant case PlantType.SnakePlant : return 13; // snake plant case PlantType.PricklyPearCactus: return 14; // prickly pear cactus case PlantType.BarrelCactus : return 15; // barrel cactus case PlantType.TribarrelCactus : return 16; // tribarrel cactus 1st default : return 0 ; } }
public static bool IsCrossable( PlantType plantType ) { return GetInfo( plantType ).Crossable; }
public LevelInfo(Dictionary<PlantType, int> target, PlantType[] disabled) : this(target, new Currency(0, 0, 0), disabled) { }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch ( version ) { case 1: { this.m_Level = (SecureLevel)reader.ReadInt(); goto case 0; } case 0: { if (version < 1) this.m_Level = SecureLevel.CoOwners; this.m_PlantStatus = (PlantStatus)reader.ReadInt(); this.m_PlantType = (PlantType)reader.ReadInt(); this.m_PlantHue = (PlantHue)reader.ReadInt(); this.m_ShowType = reader.ReadBool(); if (this.m_PlantStatus < PlantStatus.DecorativePlant) this.m_PlantSystem = new PlantSystem(this, reader); break; } } m_Instances.Add(this); }
public static int GetBonsaiTitle( PlantType plantType ) { switch ( plantType ) { case PlantType.CommonGreenBonsai: case PlantType.CommonPinkBonsai: return 1063335; // common case PlantType.UncommonGreenBonsai: case PlantType.UncommonPinkBonsai: return 1063336; // uncommon case PlantType.RareGreenBonsai: case PlantType.RarePinkBonsai: return 1063337; // rare case PlantType.ExceptionalBonsai: return 1063341; // exceptional case PlantType.ExoticBonsai: return 1063342; // exotic default: return 0; } }
public PlantSystem( PlantItem plant, GenericReader reader ) { m_Plant = plant; int version = reader.ReadInt(); m_FertileDirt = reader.ReadBool(); if ( version >= 1 ) m_NextGrowth = reader.ReadDateTime(); else m_NextGrowth = reader.ReadDeltaTime(); m_GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt(); m_Water = reader.ReadInt(); m_Hits = reader.ReadInt(); m_Infestation = reader.ReadInt(); m_Fungus = reader.ReadInt(); m_Poison = reader.ReadInt(); m_Disease = reader.ReadInt(); m_PoisonPotion = reader.ReadInt(); m_CurePotion = reader.ReadInt(); m_HealPotion = reader.ReadInt(); m_StrengthPotion = reader.ReadInt(); m_Pollinated = reader.ReadBool(); m_SeedType = (PlantType)reader.ReadInt(); m_SeedHue = (PlantHue)reader.ReadInt(); m_AvailableSeeds = reader.ReadInt(); m_LeftSeeds = reader.ReadInt(); m_AvailableResources = reader.ReadInt(); m_LeftResources = reader.ReadInt(); if ( version < 2 && PlantHueInfo.IsCrossable( m_SeedHue ) ) m_SeedHue |= PlantHue.Reproduces; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_PlantType = (PlantType)reader.ReadInt(); m_PlantHue = (PlantHue)reader.ReadInt(); m_ShowType = reader.ReadBool(); if ( Weight != 1.0 ) Weight = 1.0; }
public static PlantType Cross( PlantType first, PlantType second ) { if ( !IsCrossable( first ) || !IsCrossable( second ) ) return PlantType.CampionFlowers; int firstIndex = (int)first; int secondIndex = (int)second; if ( firstIndex + 1 == secondIndex || firstIndex == secondIndex + 1 ) return Utility.RandomBool() ? first : second; else return (PlantType)( (firstIndex + secondIndex) / 2 ); }
public static int GetBonsaiTitle( PlantType plantType ) { switch ( plantType ) { case PlantType.Cactus: case PlantType.FlaxFlowers: case PlantType.FoxgloveFlowers: case PlantType.HopsEast: case PlantType.OrfluerFlowers: case PlantType.CypressTwisted: case PlantType.HedgeShort: case PlantType.JuniperBush: case PlantType.SnowdropPatch: case PlantType.Cattails: case PlantType.PoppyPatch: case PlantType.SpiderTree: case PlantType.WaterLily: case PlantType.CypressStraight: case PlantType.HedgeTall: case PlantType.HopsSouth: case PlantType.SugarCanes: return 1080528; // peculiar case PlantType.CommonGreenBonsai: case PlantType.CommonPinkBonsai: return 1063335; // common case PlantType.UncommonGreenBonsai: case PlantType.UncommonPinkBonsai: return 1063336; // uncommon case PlantType.RareGreenBonsai: case PlantType.RarePinkBonsai: return 1063337; // rare case PlantType.ExceptionalBonsai: return 1063341; // exceptional case PlantType.ExoticBonsai: return 1063342; // exotic default: return 0; } }
public void PlantSeed( Mobile from, Seed seed ) { if ( m_PlantStatus >= PlantStatus.FullGrownPlant ) { LabelTo( from, 1061919 ); // You must use a seed on a bowl of dirt! } else if ( !IsUsableBy( from ) ) { LabelTo( from, 1061921 ); // The bowl of dirt must be in your pack, or you must lock it down. } else if ( m_PlantStatus != PlantStatus.BowlOfDirt ) { if ( m_PlantStatus >= PlantStatus.Plant ) LabelTo( from, "This bowl of dirt already has a plant in it!" ); else if ( m_PlantStatus >= PlantStatus.Sapling ) LabelTo( from, "This bowl of dirt already has a sapling in it!" ); else LabelTo( from, "This bowl of dirt already has a seed in it!" ); } else if ( m_PlantSystem.Water < 2 ) { LabelTo( from, 1061920 ); // The dirt in this bowl needs to be softened first. } else { m_PlantType = seed.PlantType; m_PlantHue = seed.PlantHue; m_ShowType = seed.ShowType; seed.Delete(); PlantStatus = PlantStatus.Seed; m_PlantSystem.Reset( false ); LabelTo( from, 1061922 ); // You plant the seed in the bowl of dirt. } }