Ejemplo n.º 1
0
            protected void FillData(Icons.ID starticon, Kernel.Stat statatk, Kernel.Stat statdef)
            {
                if (Damageable.GetCharacterData(out var c))
                {
                    for (byte pos = 0; pos < Count; pos++)
                    {
                        var stat = pos != 0 ? statdef + pos - 1 : statatk;
                        Contents[pos] = stat;
                        getColor(pos, out var palette, out var _colorid, out var unlocked);
                        var name = GetName(stat);
                        UpdateItems();

                        FF8String GetName(Kernel.Stat key)
                        {
                            var _name = Memory.KernelBin.MagicData[c.StatJ[key]].Name;

                            if (_name == null || _name.Length == 0)
                            {
                                _name = Strings.Name._;
                            }
                            return(_name);
                        }

                        void UpdateItems()
                        {
                            ((IGMDataItem.Icon)ITEM[pos, 0]).Data      = starticon + 1;
                            ((IGMDataItem.Icon)ITEM[pos, 0]).Palette   = palette;
                            ((IGMDataItem.Text)ITEM[pos, 1]).Data      = name;
                            ((IGMDataItem.Text)ITEM[pos, 1]).FontColor = _colorid;
                            BLANKS[pos] = !unlocked;
                        }
                    }
                }
            }
Ejemplo n.º 2
0
        private void UpdateOnEvent(object sender, Junction.Mode?mode = null, Kernel.Stat?stat = null)
        {
            mode = mode ?? (Junction.Mode)Menu.Junction.GetMode();
            if ((
                    mode == Junction.Mode.Mag_Pool_ST_A ||
                    mode == Junction.Mode.Mag_Pool_ST_D ||
                    mode == Junction.Mode.Mag_Pool_EL_A ||
                    mode == Junction.Mode.Mag_Pool_EL_D ||
                    mode == Junction.Mode.Mag_Pool_Stat) || Battle && Enabled)

            {
                Cursor_Status |= Cursor_Status.Enabled;
            }
            else
            {
                Cursor_Status &= ~Cursor_Status.Enabled;
            }
            if (Memory.State.Characters && Damageable != null)
            {
                Get_Sort_Stat();
                Stat = stat ?? Stat;
                Get_Slots_Values();
                if (SortMode != LastMode || this.Stat != LastStat || Damageable != LastCharacter)
                {
                    Get_Sort();
                }
                var skipundo = false;
                if (Battle || !(SortMode == LastMode && Damageable == LastCharacter && this.Stat == LastStat && Page == LastPage))
                {
                    // goal of these checks were to avoid updating the whole list if we don't need to.
                    LastCharacter = Damageable;
                    LastStat      = this.Stat;
                    LastPage      = Page;
                    LastMode      = SortMode;
                    skipundo      = Undo();
                    FillMagic();
                    UpdateTitle();
                }
                if (!Battle && (
                        mode == Junction.Mode.Mag_Pool_ST_A ||
                        mode == Junction.Mode.Mag_Pool_ST_D ||
                        mode == Junction.Mode.Mag_Pool_EL_A ||
                        mode == Junction.Mode.Mag_Pool_EL_D ||
                        mode == Junction.Mode.Mag_Pool_Stat))
                {
                    Generate_Preview(skipundo);
                }
            }
        }
Ejemplo n.º 3
0
        private void Get_Sort_Stat()
        {
            if (Battle)
            {
                //SortMode = IGM_Junction.Mode.Mag_Pool_Stat;
            }
            else
            {
                SortMode = (Junction.Mode)Menu.Junction.GetMode();
                switch (SortMode)
                {
                default:
                case Junction.Mode.Mag_Stat:
                case Junction.Mode.Mag_Pool_Stat:
                    SortMode = Junction.Mode.Mag_Pool_Stat;
                    break;

                case Junction.Mode.Mag_ST_D:
                case Junction.Mode.Mag_Pool_ST_D:
                    SortMode = Junction.Mode.Mag_Pool_ST_D;
                    break;

                case Junction.Mode.Mag_ST_A:
                case Junction.Mode.Mag_Pool_ST_A:
                    SortMode = Junction.Mode.Mag_Pool_ST_A;
                    Stat     = Kernel.Stat.StAtk;
                    break;

                case Junction.Mode.Mag_EL_D:
                case Junction.Mode.Mag_Pool_EL_D:
                    SortMode = Junction.Mode.Mag_Pool_EL_D;
                    break;

                case Junction.Mode.Mag_EL_A:
                case Junction.Mode.Mag_Pool_EL_A:
                    SortMode = Junction.Mode.Mag_Pool_EL_A;
                    Stat     = Kernel.Stat.ElAtk;
                    break;
                }
            }
        }
Ejemplo n.º 4
0
            protected Dictionary <T, byte> getTotal <T>(out Enum[] availableFlagsarray, byte max, Kernel.Stat stat, params byte[] spells) where T : Enum
            {
                const int maxspellcount  = 100;
                var       total          = new Dictionary <T, byte>(8);
                var       availableFlags = Enum.GetValues(typeof(T)).Cast <Enum>();

                foreach (var flag in availableFlags.Where(d => !total.ContainsKey((T)d)))
                {
                    total.Add((T)flag, 0);
                }
                for (var i = 0; i < spells.Length; i++)
                {
                    Enum flags      = null;
                    var  spell      = spells[i];
                    var  magic_Data = Memory.KernelBin.MagicData[spell];
                    switch (stat)
                    {
                    case Kernel.Stat.ElAtk:
                        flags = magic_Data.ElAtk;
                        break;

                    case Kernel.Stat.ElDef1:
                    case Kernel.Stat.ElDef2:
                    case Kernel.Stat.ElDef3:
                    case Kernel.Stat.ElDef4:
                        flags = magic_Data.ElDef;
                        break;

                    case Kernel.Stat.StAtk:
                        flags = magic_Data.StAtk;
                        break;

                    case Kernel.Stat.StDef1:
                    case Kernel.Stat.StDef2:
                    case Kernel.Stat.StDef3:
                    case Kernel.Stat.StDef4:
                        flags = magic_Data.StDef;
                        break;
                    }
                    if (flags != null && Damageable.GetCharacterData(out var c))
                    {
                        foreach (var flag in availableFlags.Where(flags.HasFlag))
                        {
                            if (c.Magics.TryGetByKey(spell, out var count) && magic_Data.JVal.TryGetValue(stat, out var value))
                            {
                                var t = total[(T)flag] + (value * count / maxspellcount);
                                total[(T)flag] = (byte)MathHelper.Clamp(t, 0, max);
                            }
                        }
                    }
                    else
                    {
                        throw new Exception($"Unknown stat, {stat}");
                    }
                }
                availableFlagsarray = availableFlags.ToArray();
                return(total);
            }
Ejemplo n.º 5
0
 public static void ChangeStat(Kernel.Stat stat) => StatEventListener?.Invoke(null, stat);
Ejemplo n.º 6
0
 private void StatChangeEvent(object sender, Kernel.Stat e) => UpdateOnEvent(sender, null, e);
Ejemplo n.º 7
0
 public override ushort TotalStat(Kernel.Stat s) => 0;
Ejemplo n.º 8
0
 public abstract ushort TotalStat(Kernel.Stat s);