Exemple #1
0
                public override void ReInit()
                {
                    base.ReInit();
                    Source = Memory.State;
                    if (Source != null && Source.Items != null)
                    {
                        byte pos = 0;
                        for (byte i = 0; pos < rows && i < Source.Items.Length; i++)
                        {
                            Saves.Item item = Source.Items[i];
                            //byte itembo = Source.Itemsbattleorder[i];
                            if (item.ID == 0)
                            {
                                continue;
                            }
                            Kernel_bin.Battle_Items_Data     bitemdata  = Kernel_bin.BattleItemsData.Count > item.ID ? Kernel_bin.BattleItemsData[item.ID] : null;
                            Kernel_bin.Non_battle_Items_Data nbitemdata = bitemdata == null ? Kernel_bin.NonbattleItemsData[item.ID - Kernel_bin.BattleItemsData.Count] : null;
                            Item_In_Menu itemdata = Memory.MItems.Items[item.ID];

                            _helpStr[pos] = bitemdata == null ? nbitemdata.Description : bitemdata.Description;
                            ((IGMDataItem_String)(ITEM[pos, 0])).Data = bitemdata == null ? nbitemdata.Name : bitemdata.Name;
                            ((IGMDataItem_Int)(ITEM[pos, 1])).Data    = item.QTY;
                            pos++;
                        }
                    }
                }
Exemple #2
0
        private void TriggerVictory(ConcurrentDictionary <Characters, int> expextra = null)
        {
            int  exp = 0;
            uint ap  = 0;
            ConcurrentDictionary <byte, byte>     items = new ConcurrentDictionary <byte, byte>();
            ConcurrentDictionary <Cards.ID, byte> cards = new ConcurrentDictionary <Cards.ID, byte>();

            foreach (Enemy e in Enemy.Party)
            {
                exp += e.EXP;
                ap  += e.AP;
                Saves.Item drop     = e.Drop(Memory.State.PartyHasAbility(Kernel_bin.Abilities.RareItem));
                Cards.ID   carddrop = e.CardDrop();
                if (drop.QTY > 0 && drop.ID > 0)
                {
                    if (!items.TryAdd(drop.ID, drop.QTY))
                    {
                        items[drop.ID] += drop.QTY;
                    }
                }
                if (carddrop != Cards.ID.Fail && carddrop != Cards.ID.Immune)
                {
                    if (!cards.TryAdd(carddrop, 1))
                    {
                        cards[carddrop]++;
                    }
                }
            }
            SetMode(Mode.Victory);
            Victory_Menu?.Refresh(exp, ap, expextra, items, cards);
        }
Exemple #3
0
                public override void Refresh()
                {
                    base.Refresh();
                    if (Items != null && Items.Count > 0)
                    {
                        Item = Items.Peek();
                        ((IGMDataItem.Box)ITEM[0, 1]).Data      = Item.DATA?.Name;
                        ((IGMDataItem.Box)ITEM[0, 2]).Data      = $"{Item.QTY}";
                        ((IGMDataItem.Box)ITEM[0, 3]).Data      = Item.DATA?.Description;
                        ((IGMData.Dialog.Small)ITEM[0, 5]).Data = str_Over100.Clone().Replace(DialogSelectedItem, Item.DATA?.Name);
                        ((IGMData.Dialog.Small)ITEM[0, 5]).Data = str_Over100.Clone().Replace(DialogSelectedItem, Item.DATA?.Name);
                        ITEM[0, 1].Show();
                        ITEM[0, 2].Show();
                        ITEM[0, 3].Show();
                        ITEM[0, 4].Hide();
                        ITEM[0, 5].Hide();
                        ITEM[0, 6].Hide();
                    }
                    else
                    if (_cards != null && _cards.Count > 0)
                    {
                        card = _cards.Peek();
                        var name = Memory.Strings.Read(Strings.FileID.MNGRP, 110, (int)card.Key);

                        int pos = 0;
                        for (; pos < name.Length; pos++)
                        {
                            if (name.Value[pos] == 2)
                            {
                                break;
                            }
                        }
                        ((IGMDataItem.Box)ITEM[0, 1]).Data = new FF8String(name.Value.Take(pos - 1).ToArray());
                        //TODO grab card name from start of string
                        ((IGMDataItem.Box)ITEM[0, 2]).Data      = $"{card.Value}";
                        ((IGMDataItem.Box)ITEM[0, 3]).Data      = "";
                        ((IGMData.Dialog.Small)ITEM[0, 5]).Data = str_Over100.Clone().Replace(DialogSelectedItem, Item.DATA?.Name);
                        ((IGMData.Dialog.Small)ITEM[0, 5]).Data = str_Over100.Clone().Replace(DialogSelectedItem, Item.DATA?.Name);
                        ITEM[0, 1].Show();
                        ITEM[0, 2].Show();
                        ITEM[0, 3].Hide();
                        ITEM[0, 4].Hide();
                        ITEM[0, 5].Hide();
                        ITEM[0, 6].Hide();
                    }
                    else
                    {
                        ITEM?[0, 1]?.Hide();
                        ITEM?[0, 2]?.Hide();
                        ITEM?[0, 3]?.Hide();
                        ITEM?[0, 4]?.Show();
                        ITEM?[0, 5]?.Hide();
                        ITEM?[0, 6]?.Hide();
                    }
                }
Exemple #4
0
        private void DeadTime_DoneEvent(object sender, int e)
        {
            bool save(IEnumerable <Characters> hurt, ref EventHandler <Characters> @event)
            {
                if (hurt == null || !hurt.Any())
                {
                    return(false);
                }
                Characters c = hurt.Random();

                @event?.Invoke(this, c);
                return(true);
            }

            //Will Gilgamesh appear?
            if (TestGilgamesh())
            {
                Gilgamesh?.Invoke(this, 0);
            }
            //Will Angelo Recover be used?
            else if (TestAngeloAbilityTriggers(Angelo.Recover) &&
                     save(Memory.State.Party.Where(x => x != Characters.Blank && Memory.State[x].IsCritical), ref AngeloRecover))
            {
            }
            //Will Angelo Reverse be used?
            else if (TestAngeloAbilityTriggers(Angelo.Reverse) &&
                     save(Memory.State.Party.Where(x => x != Characters.Blank && Memory.State[x].IsDead), ref AngeloReverse))
            {
            }
            //Will Angelo Search be used?
            else if (TestAngeloAbilityTriggers(Angelo.Search))
            {
                //Real game has a counter that count to 255 and resets to 0
                //instead of a random number. The counter counts up every 1 tick.
                //60 ticks per second.
                byte rnd = checked ((byte)Memory.Random.Next(256));
                if (rnd < 128)
                {
                    AngeloSearch?.Invoke(this, Algorithm(1));
                }
                else if (rnd < 160)
                {
                    AngeloSearch?.Invoke(this, Algorithm(2));
                }
                else if (rnd < 176)
                {
                    AngeloSearch?.Invoke(this, Algorithm(3));
                }
                else if (rnd < 192)
                {
                    AngeloSearch?.Invoke(this, Algorithm(4));
                }
                else if (rnd < 200)
                {
                    AngeloSearch?.Invoke(this, Algorithm(5));
                }
                else
                {
                    AngeloSearch?.Invoke(this, Algorithm(6));
                }
                Saves.Item Algorithm(byte i)
                {
                    //https://gamefaqs.gamespot.com/ps/197343-final-fantasy-viii/faqs/58936
                    //I'm unsure where in the game files this is.
                    //In remaster they changed this. But unsure how
                    // they added (Ribbon, Friendship, and Mog's Amulet)
                    // using a true random kinda breaks this.
                    // because in game random is a set array of numbers 0-255
                    // so the number you get previous would determine the possible number you get
                    // so these can only select specific numbers. But because we are using a real random
                    // more items are possible. might need to tweak this.

                    //these are added in remaster as possible items.
                    //const byte Ribbon = 100;
                    //const byte Friendship = 32;
                    //const byte Mog's_Amulet = 65;

                    Saves.Item item = new Saves.Item {
                        QTY = 1
                    };
                    rnd = checked ((byte)Memory.Random.Next(256));
                    switch (i)
                    {
                    case 1:     // 1-8
                        item.ID = (byte)(rnd % 8 + 1);
                        break;

                    case 2:     // 102-199
                        item.ID = (byte)(rnd % 98);
                        if (item.ID == 0)
                        {
                            item.ID = 98;
                        }
                        item.ID += 101;
                        break;

                    case 3:     // 102-124
                        item.ID = (byte)(rnd % 23);
                        if (item.ID == 0)
                        {
                            item.ID = 23;
                        }
                        item.ID += 101;
                        break;

                    case 4:     // 67-100
                        item.ID = (byte)(rnd % 34);
                        if (item.ID == 0)
                        {
                            item.ID = 34;
                        }
                        item.ID += 66;
                        break;

                    case 5:     // 33-54
                        item.ID = (byte)(rnd % 32 + 33);
                        break;

                    default:     // 33-40
                        item.ID = (byte)(rnd % 7 + 33);
                        break;
                    }
                    return(item);
                }
            }
        }
            protected override void Init()
            {
                if (CommandFunc == null)
                {
                    CommandFunc = new Dictionary <int, Func <bool> >
                    {
                        //{0,Command00 },
                        { 1, Command01_ATTACK },
                        { 2, Command02_MAGIC },
                        //{3,Command03_GF },
                        { 4, Command04_ITEM },
                        { 5, Command05_RENZOKUKEN },
                        { 6, Command06_DRAW },
                        { 7, Command07_DEVOUR },
                        //{8,Command08_UNNAMED },
                        //{9,Command09_CAST },
                        //{10,Command10_STOCK },
                        { 11, Command11_DUEL },
                        { 12, Command12_MUG },
                        //{13,Command13_NOMSG },
                        { 14, Command14_SHOT },
                        { 15, Command15_BLUE_MAGIC },
                        //{16,Command16_SLOT },
                        { 17, Command17_FIRE_CROSS_NO_MERCY },
                        { 18, Command18_SORCERY_ICE_STRIKE },
                        { 19, Command19_COMBINE },
                        { 20, Command20_DESPERADO },
                        { 21, Command21_BLOOD_PAIN },
                        { 22, Command22_MASSIVE_ANCHOR },
                        //{23,Command23_DEFEND },
                        { 24, Command24_MADRUSH },
                        { 25, Command25_TREATMENT },
                        { 26, Command26_RECOVERY },
                        { 27, Command27_REVIVE },
                        { 28, Command28_DARKSIDE },
                        { 29, Command29_CARD },
                        { 30, Command30_DOOM },
                        { 31, Command31_KAMIKAZI },
                        { 32, Command32_ABSORB },
                        { 33, Command33_LVL_DOWN },
                        { 34, Command34_LVL_UP },
                        { 35, Command35_SINGLE },
                        { 36, Command36_DOUBLE },
                        { 37, Command37_TRIPLE },
                        { 38, Command38_MINIMOG },
                    }
                }
                ;
                base.Init();

                //bool Command00() => throw new NotImplementedException();

                bool Command01_ATTACK()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    Damageable.EndTurn();
                    return(true);
                }

                bool Command02_MAGIC()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} casts {Magic.Name}({Magic.ID}) spell on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();
                    return(true);
                }

                //bool Command03_GF() => throw new NotImplementedException();

                bool Command04_ITEM()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} uses {Item.Name}({Item.ID}) item on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();
                    return(true);
                }

                bool Command05_RENZOKUKEN()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    if (d.First().GetType() == typeof(Enemy))
                    {
                        //Renzokuken
                        byte w    = Memory.State[fromvc].WeaponID;
                        int  hits = 0;
                        if (Memory.State[fromvc].CurrentCrisisLevel > 0)
                        {
                            hits = Memory.State[fromvc].CurrentCrisisLevel < Renzokuken_hits.Length ? Renzokuken_hits[Memory.State[fromvc].CurrentCrisisLevel] : Renzokuken_hits.Last();
                        }
                        //else return false;
                        else
                        {
                            hits = Renzokuken_hits.First();
                        }
                        int  finisherchance = (Memory.State[fromvc].CurrentCrisisLevel + 1) * 60;
                        bool willfinish     = Memory.Random.Next(byte.MaxValue + 1) <= finisherchance;
                        int  choosefinish   = Memory.Random.Next(3 + 1);
                        Kernel_bin.Weapons_Data        wd = Kernel_bin.WeaponsData[w];
                        Kernel_bin.Renzokeken_Finisher r  = wd.Renzokuken;
                        if (r == 0)
                        {
                            willfinish = false;
                        }

                        //per wiki the chance of which finisher is 25% each and the highest value finisher get the remaining of 100 percent.
                        //so rough divide is 100% when you only only have that
                        //when you unlock 2 one is 75% chance
                        //when you onlock 3 last one is 50%
                        //when you unlock all 4 it's 25% each.

                        //finishers each have their own target
                        BattleMenus.GetCurrentBattleMenu().Renzokeken.Reset(hits);
                        BattleMenus.GetCurrentBattleMenu().Renzokeken.Show();
                        if (willfinish)
                        {
                            List <Kernel_bin.Renzokeken_Finisher> flags = Enum.GetValues(typeof(Kernel_bin.Renzokeken_Finisher))
                                                                          .Cast <Kernel_bin.Renzokeken_Finisher>()
                                                                          .Where(f => (f & r) != 0)
                                                                          .ToList();
                            Kernel_bin.Renzokeken_Finisher finisher = choosefinish >= flags.Count ? flags.Last() : flags[choosefinish];
                            Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} hits {hits} times with {Command.Name}({Command.ID}) then uses {Kernel_bin.RenzokukenFinishersData[finisher].Name}.");
                        }
                        else
                        {
                            Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} hits {hits} times with {Command.Name}({Command.ID}) then fails to use a finisher.");
                        }
                    }
                    return(true);
                }

                bool Command06_DRAW()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    //draw
                    //spawn a 1 page 4 row pool of the magic/gfs that the selected enemy has.
                    if (d.First().GetType() == typeof(Enemy))
                    {
                        var e = (Enemy)d.First();
                        DrawMagic(e.DrawList);
                        Draw_Pool.Refresh(e.DrawList);
                        Draw_Pool.Show();
                    }
                    return(true);
                }

                bool Command07_DEVOUR()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    //TODO add devour commands
                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                //bool Command08_UNNAMED() => throw new NotImplementedException();

                //bool Command09_CAST() => throw new NotImplementedException();

                //bool Command10_STOCK() => throw new NotImplementedException();

                bool Command11_DUEL()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command12_MUG()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    if (d.First().GetType() == typeof(Enemy))
                    {
                        var e = (Enemy)d.First();
                        //unsure if party member being ejected or if they need to be in the party for rare item to work
                        Saves.Item i = e.Mug(Memory.State[fromvc].SPD, Memory.State.PartyHasAbility(Kernel_bin.Abilities.RareItem));
                        Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} stole {i.DATA?.Name}({i.ID}) x {i.QTY} from { DebugMessageSuffix(d) }");
                    }
                    Damageable.EndTurn();
                    return(true);
                }

                //bool Command13_NOMSG() => throw new NotImplementedException();

                bool Command14_SHOT()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command15_BLUE_MAGIC()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} casts {BlueMagic.Name}({BlueMagic.ID}) spell on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();
                    return(false);
                }

                //bool Command16_SLOT() => throw new NotImplementedException();

                bool Command17_FIRE_CROSS_NO_MERCY()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command18_SORCERY_ICE_STRIKE()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command19_COMBINE()
                {
                    //perform angelo attack unless angel wing is unlocked and chosen in menu.
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command20_DESPERADO()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command21_BLOOD_PAIN()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command22_MASSIVE_ANCHOR()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                //bool Command23_DEFEND() => throw new NotImplementedException();

                bool Command24_MADRUSH()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command25_TREATMENT()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command26_RECOVERY()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command27_REVIVE()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command28_DARKSIDE()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    Damageable.EndTurn();
                    return(true);
                }

                bool Command29_CARD()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    if (d.First().GetType() == typeof(Enemy))
                    {
                        var      e = (Enemy)d.First();
                        Cards.ID c = e.Card();
                        if (c == Cards.ID.Fail)
                        {
                            Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} Failed to use {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                        }
                        else if (c == Cards.ID.Immune)
                        {
                            Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} Failed to use {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) } because they are immune!");
                        }
                        else
                        {
                            Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) } and got a {c} card");
                        }
                        Damageable.EndTurn();
                    }
                    return(true);
                }

                bool Command30_DOOM()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);
                    Damageable.EndTurn();
                    return(true);
                }

                bool Command31_KAMIKAZI()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command32_ABSORB()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command33_LVL_DOWN()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command34_LVL_UP()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }

                bool Command35_SINGLE() => Command02_MAGIC();

                bool Command36_DOUBLE()
                {
                    // CHOOSE 2X TARGETS
                    throw new NotImplementedException();
                }

                bool Command37_TRIPLE()
                {
                    // CHOOSE 3X TARGETS
                    throw new NotImplementedException();
                }

                bool Command38_MINIMOG()
                {
                    Neededvaribles(out Damageable[] d, out Characters fromvc);

                    Debug.WriteLine($"{Memory.Strings.GetName(fromvc)} used {Command.Name}({Command.ID}) on { DebugMessageSuffix(d) }");
                    Damageable.EndTurn();

                    return(true);
                }
            }
Exemple #6
0
 public override void ReInit()
 {
     if (!eventSet && InGameMenu_Items != null)
     {
         InGameMenu_Items.ModeChangeHandler      += ModeChangeEvent;
         InGameMenu_Items.ReInitCompletedHandler += ReInitCompletedEvent;
         eventSet = true;
     }
     base.ReInit();
     Source = Memory.State;
     if (Source != null && Source.Items != null)
     {
         ((IGMDataItem_Box)CONTAINER).Title = Pages <= 1 ? (Icons.ID?)Icons.ID.ITEM : (Icons.ID?)(Icons.ID.ITEM_PG1 + (byte)Page);
         byte pos  = 0;
         int  skip = Page * rows;
         for (byte i = 0; pos < rows && i < Source.Items.Count; i++)
         {
             Saves.Item item = Source.Items[i];
             if (item.ID == 0 || item.QTY == 0)
             {
                 continue;                                // skip empty values.
             }
             if (skip-- > 0)
             {
                 continue;             //skip items that are on prev pages.
             }
             Item_In_Menu itemdata = item.DATA ?? new Item_In_Menu();
             if (itemdata.ID == 0)
             {
                 continue;                   // skip empty values.
             }
             Font.ColorID color   = Font.ColorID.White;
             byte         palette = itemdata.Palette;
             if (!itemdata.ValidTarget())
             {
                 color       = Font.ColorID.Grey;
                 BLANKS[pos] = true;
                 palette     = itemdata.Faded_Palette;
             }
             else
             {
                 BLANKS[pos] = false;
             }
             ((IGMDataItem_String)(ITEM[pos, 0])).Data    = itemdata.Name;
             ((IGMDataItem_String)(ITEM[pos, 0])).Icon    = itemdata.Icon;
             ((IGMDataItem_String)(ITEM[pos, 0])).Palette = palette;
             ((IGMDataItem_String)(ITEM[pos, 0])).Colorid = color;
             ((IGMDataItem_Int)(ITEM[pos, 1])).Data       = item.QTY;
             ((IGMDataItem_Int)(ITEM[pos, 1])).Show();
             ((IGMDataItem_Int)(ITEM[pos, 1])).Colorid = color;
             _helpStr[pos] = itemdata.Description;
             Contents[pos] = itemdata;
             pos++;
         }
         for (; pos < rows; pos++)
         {
             ((IGMDataItem_Int)(ITEM[pos, 1])).Hide();
             if (pos == 0)
             {
                 return;           // if page turning. this till be enough to trigger a try next page.
             }
             ((IGMDataItem_String)(ITEM[pos, 0])).Data = null;
             ((IGMDataItem_Int)(ITEM[pos, 1])).Data    = 0;
             ((IGMDataItem_String)(ITEM[pos, 0])).Icon = Icons.ID.None;
             BLANKS[pos] = true;
         }
     }
 }