Example #1
0
        public AnimaCharacter(ExcelWorksheet excelWorksheet, string player)
        {
            Player    = player;
            IsCurrent = false;
            ImageUrl  = excelWorksheet.Cells["AK1"].Text;

            //Character info
            Name    = excelWorksheet.Cells["E1"].Text;
            Origine = excelWorksheet.Cells["P1"].Text;
            Class   = excelWorksheet.Cells["F3"].Text;
            Level   = Convert.ToInt32(excelWorksheet.Cells["E5"].Value);
            Hp      = Convert.ToInt32(excelWorksheet.Cells["B12"].Value);
            string temp = excelWorksheet.Cells["B13"].Text;

            CurrentHp = string.IsNullOrEmpty(temp) ? Hp : Convert.ToInt32(temp);

            Regeneration   = Convert.ToInt32(excelWorksheet.Cells["J18"].Value);
            Fatigue        = Convert.ToInt32(excelWorksheet.Cells["B18"].Value);
            temp           = excelWorksheet.Cells["B19"].Text;
            CurrentFatigue = string.IsNullOrEmpty(temp) ? Fatigue : Convert.ToInt32(temp);
            Movement       = Convert.ToInt32(excelWorksheet.Cells["F18"].Value);

            TotalKiPoints = Convert.ToInt32(excelWorksheet.Cells["V39"].Value);
            temp          = excelWorksheet.Cells["Z39"].Text;
            CurrentKi     = string.IsNullOrEmpty(temp) ? TotalKiPoints : Convert.ToInt32(temp);

            ArmorPoint = Convert.ToInt32(excelWorksheet.Cells["AC55"].Value);

            ZeonPoints  = Convert.ToInt32(excelWorksheet.Cells["U15"].Value);
            temp        = excelWorksheet.Cells["U16"].Text;
            CurrentZeon = string.IsNullOrEmpty(temp) ? ZeonPoints : Convert.ToInt32(temp);
            Amr         = Convert.ToInt32(excelWorksheet.Cells["U21"].Value);
            AmrRegen    = Convert.ToInt32(excelWorksheet.Cells["U24"].Value);
            InnateMagic = Convert.ToInt32(excelWorksheet.Cells["U27"].Value);
            MagicLevel  = Convert.ToInt32(excelWorksheet.Cells["AD8"].Value);

            PppFree       = Convert.ToInt32(excelWorksheet.Cells["Q21"].Value);
            temp          = excelWorksheet.Cells["Q22"].Text;
            CurrentPpp    = string.IsNullOrEmpty(temp) ? PppFree : Convert.ToInt32(temp);
            IsLucky       = Convert.ToBoolean(excelWorksheet.Cells["DC30"].Value);
            IsUnlucky     = Convert.ToBoolean(excelWorksheet.Cells["DC153"].Value);
            DestinFuneste = Convert.ToBoolean(excelWorksheet.Cells["DC165"].Value);
            //Base stats
            foreach (var cell in excelWorksheet.Cells[22, 2, 30, 2])
            {
                BaseStats.Add(new Roll10Stat(StatGroups[0], cell.Text, Convert.ToInt32(cell.Offset(0, 9).Value)));
            }

            //Resistances
            foreach (var cell in excelWorksheet.Cells[32, 2, 36, 2])
            {
                Resistances.Add(new ResistanceStat(StatGroups[1], cell.Text, Convert.ToInt32(cell.Offset(0, 2).Value)));
            }

            //Battle stats
            BattleStats.Add(new Roll100Stat(StatGroups[2], excelWorksheet.Cells["B14"].Text, Convert.ToInt32(excelWorksheet.Cells["B15"].Value)));
            BattleStats.Add(new Roll100Stat(StatGroups[2], excelWorksheet.Cells["B52"].Text, Convert.ToInt32(excelWorksheet.Cells["AC52"].Value)));
            BattleStats.Add(new Roll100Stat(StatGroups[2], excelWorksheet.Cells["B53"].Text, Convert.ToInt32(excelWorksheet.Cells["AC53"].Value)));
            BattleStats.Add(new Roll100Stat(StatGroups[2], excelWorksheet.Cells["B54"].Text, Convert.ToInt32(excelWorksheet.Cells["AC54"].Value)));
            Roll100Stat defence = BattleStats.Where(x => x.Name == "Esquive" || x.Name == "Parade").OrderByDescending(x => x.Value).First();

            BattleStats.Add(new Roll100Stat(StatGroups[2], $"Défense : {defence.Name}", defence.Value));
            foreach (var cell in excelWorksheet.Cells[64, 2, 68, 2])
            {
                BattleStats.Add(new Roll100Stat(StatGroups[2], cell.Text, Convert.ToInt32(cell.Offset(0, 27).Value)));
            }

            BattleStats.Add(new Roll100Stat(StatGroups[2], excelWorksheet.Cells["B71"].Text, Convert.ToInt32(excelWorksheet.Cells["AC71"].Value)));
            try
            {//TODO pourquoi ????
                BattleStats.Add(new Roll100Stat(StatGroups[2], excelWorksheet.Cells["Q23"].Text, Convert.ToInt32(excelWorksheet.Cells["Q24"].Value)));
            }
            catch (Exception ex)
            {
            }

            //Secondary stats
            foreach (var cell in excelWorksheet.Cells[75, 2, 143, 2])
            {
                if (!cell.Style.Font.Bold)
                {
                    SecondaryStats.Add(new Roll100Stat(StatGroups[3], cell.Text, Convert.ToInt32(cell.Offset(0, 27).Value)));
                }
            }
            SecondaryStats.Add(new Roll100Stat(StatGroups[3], excelWorksheet.Cells["G34"].Text, Convert.ToInt32(excelWorksheet.Cells["N34"].Value)));
            SecondaryStats.Add(new Roll100Stat(StatGroups[3], excelWorksheet.Cells["G35"].Text, Convert.ToInt32(excelWorksheet.Cells["N35"].Value)));
            SecondaryStats.RemoveAll(x => string.IsNullOrWhiteSpace(x.Name));

            base.AllStats.AddRange(BaseStats);
            base.AllStats.AddRange(Resistances);
            base.AllStats.AddRange(BattleStats);
            base.AllStats.AddRange(SecondaryStats);
        }