private IEntityInfo GenerateEntityInfo(EntityRace race, EntityOccupation occupation) { if (occupation == EntityOccupation.None) { occupation = GetRandomOccupation(); } if (race == EntityRace.None) { race = GetRandomRace(); } string firstName = ""; string lastName = ""; if (race.HasFlag(EntityRace.Male)) { int nameIndex = GameGlobal.RandomInt(0, Names[EntityRace.Human | EntityRace.Male].Length); firstName = Names[EntityRace.Human | EntityRace.Male][nameIndex]; nameIndex = GameGlobal.RandomInt(0, Names[EntityRace.Human | EntityRace.Family].Length); lastName = Names[EntityRace.Human | EntityRace.Family][nameIndex]; } else if (race.HasFlag(EntityRace.Female)) { int nameIndex = GameGlobal.RandomInt(0, Names[EntityRace.Human | EntityRace.Female].Length); firstName = Names[EntityRace.Human | EntityRace.Male][nameIndex]; nameIndex = GameGlobal.RandomInt(0, Names[EntityRace.Human | EntityRace.Family].Length); lastName = Names[EntityRace.Human | EntityRace.Family][nameIndex]; } return(new EntityInfo(race, occupation, 25 * 365, firstName, lastName)); }
public EntityInfo(EntityRace race, EntityOccupation occupation, int daysOld, string firstName, string lastName = null) { this.FirstName = firstName; this.LastName = lastName; this.Race = race; this.Occupation = occupation; this.DayOfBirth = (Globals.WorldDayCurrent - daysOld); // this generates the full name of the entity as it will be referenced in most places within the game if (!string.IsNullOrEmpty(LastName)) { if (Occupation != EntityOccupation.None) { Name = FirstName + " " + LastName + " the " + Occupation.ToString(); } else { Name = FirstName + " " + LastName; } } else { if (Occupation != EntityOccupation.None) { Name = FirstName + " the " + Occupation.ToString(); } else { Name = FirstName; } } }
protected void BtnSave_Click(object sender, EventArgs e) { int lintcnt = 0; EntityOccupation entOccupation = new EntityOccupation(); if (string.IsNullOrEmpty(txtOccupationDesc.Text.Trim())) { Commons.ShowMessage("Enter Occupation Description", this.Page); } else { entOccupation.OccupationDesc = txtOccupationDesc.Text.Trim(); entOccupation.EntryBy = SessionWrapper.UserName; lintcnt = mobjOccupationBLL.InsertOccupation(entOccupation); if (lintcnt > 0) { GetOccupation(); Commons.ShowMessage("Record Inserted Successfully", this.Page); //this.programmaticModalPopup.Hide(); } else { Commons.ShowMessage("Record Not Inserted", this.Page); } } }
protected void BtnEdit_Click(object sender, EventArgs e) { int lintCnt = 0; try { EntityOccupation entOccupation = new EntityOccupation(); int OccupationCode = Convert.ToInt32(Session["PKId"].ToString()); entOccupation.PKId = OccupationCode; entOccupation.OccupationDesc = txtEditOccupationDesc.Text; entOccupation.ChangeBy = SessionWrapper.UserName; lintCnt = mobjOccupationBLL.UpdateOccupation(entOccupation); if (lintCnt > 0) { GetOccupation(); Commons.ShowMessage("Record Updated Successfully", this.Page); //this.programmaticModalPopup.Hide(); } else { Commons.ShowMessage("Record Not Updated", this.Page); } } catch (Exception ex) { Commons.FileLog("frmOccupationMaster - BtnEdit_Click(object sender, EventArgs e)", ex); } }
public EntityProfile(int level, EntityOccupation occupation, EntityRace race, float difficulty) { Level = level; Race = race; Occupation = occupation; Difficulty = difficulty; }
public ItemProfile(int level, EntityOccupation entityOccupation, NewItemCode code) { Level = level; EntityOccupation = entityOccupation; qualityCode = (ItemQualityCode)0; itemCode = code; Type = (ItemType)0; ProfileType = ItemProfileType.Inventory; }
public ItemProfile(int level, ItemType type, ItemQualityCode quality) { Level = level; Type = type; qualityCode = quality; itemCode = (NewItemCode)0; EntityOccupation = EntityOccupation.None; ProfileType = ItemProfileType.Specific; }
public void AddOccupation(IEntity entity, EntityOccupation occupation) { if (this.inventoryItemProfiles.Keys.Contains(occupation)) { // get the item profile var itemProfileArray = this.inventoryItemProfiles[occupation].NextWithReplacement(); for (int i = 0; i < itemProfileArray.Length; i++) { IItem item = weaponFactory.Create(new ItemProfile(1, occupation, itemProfileArray[i])); if (item != null) { entity.Inventory.Set(item, InventorySlot.Any, entity.Stats); } } } }
public int DeleteOccupation(EntityOccupation entOccupation) { int cnt = 0; try { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@PKId", DbType.Int32, entOccupation.PKId); cnt = mobjDataAcces.ExecuteQuery("sp_DeleteOccupation", lstParam); } catch (Exception ex) { Commons.FileLog("OccupationBLL - DeleteOccupation(EntityOccupation entOccupation)", ex); } return(cnt); }
public int InsertOccupation(EntityOccupation entOccupation) { int cnt = 0; try { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@OccupationDesc", DbType.String, entOccupation.OccupationDesc); Commons.ADDParameter(ref lstParam, "@EntryBy", DbType.String, entOccupation.EntryBy); cnt = mobjDataAcces.ExecuteQuery("sp_InsertOccupation ", lstParam); } catch (Exception ex) { Commons.FileLog("OccupationBLL - InsertOccupation(EntityOccupation entOccupation)", ex); } return(cnt); }
protected void BtnDeleteOk_Click(object sender, EventArgs e) { EntityOccupation entOccupation = new EntityOccupation(); int cnt = 0; try { foreach (GridViewRow drv in dgvOccupation.Rows) { CheckBox chkDelete = (CheckBox)drv.FindControl("chkDelete"); if (chkDelete.Checked) { LinkButton lnkOccupationCode = (LinkButton)drv.FindControl("lnkOccupationCode"); int lintOccupationCode = Convert.ToInt32(lnkOccupationCode.Text); entOccupation.PKId = lintOccupationCode; cnt = mobjOccupationBLL.DeleteOccupation(entOccupation); if (cnt > 0) { //this.modalpopupDelete.Hide(); Commons.ShowMessage("Record Deleted Successfully....", this.Page); if (dgvOccupation.Rows.Count <= 0) { pnlShow.Style.Add(HtmlTextWriterStyle.Display, "none"); hdnPanel.Value = "none"; } } else { Commons.ShowMessage("Record Not Deleted....", this.Page); } } } GetOccupation(); } catch (System.Threading.ThreadAbortException) { } catch (Exception ex) { Commons.FileLog("frmOccupationMaster - BtnDeleteOk_Click(object sender, EventArgs e)", ex); } }
public codeProbability(EntityOccupation type, float probability) { this.probability = probability; this.type = (int)type; }
public IEntityStats GetStatsPoints(EntityOccupation occupation, float pointsToDistribute) { return(new EntityStats(this.occupationBaseStatsMultiple[occupation].Select(i => (float)Math.Floor((i * (pointsToDistribute - 16.0f) + 2.0f))).ToArray())); }