예제 #1
0
        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));
        }
예제 #2
0
 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;
         }
     }
 }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
 public EntityProfile(int level, EntityOccupation occupation, EntityRace race, float difficulty)
 {
     Level      = level;
     Race       = race;
     Occupation = occupation;
     Difficulty = difficulty;
 }
예제 #6
0
 public ItemProfile(int level, EntityOccupation entityOccupation, NewItemCode code)
 {
     Level            = level;
     EntityOccupation = entityOccupation;
     qualityCode      = (ItemQualityCode)0;
     itemCode         = code;
     Type             = (ItemType)0;
     ProfileType      = ItemProfileType.Inventory;
 }
예제 #7
0
 public ItemProfile(int level, ItemType type, ItemQualityCode quality)
 {
     Level            = level;
     Type             = type;
     qualityCode      = quality;
     itemCode         = (NewItemCode)0;
     EntityOccupation = EntityOccupation.None;
     ProfileType      = ItemProfileType.Specific;
 }
예제 #8
0
 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);
             }
         }
     }
 }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
            }
        }
예제 #12
0
 public codeProbability(EntityOccupation type, float probability)
 {
     this.probability = probability;
     this.type        = (int)type;
 }
예제 #13
0
 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()));
 }