Пример #1
0
        public static List <ShopAvailability> GetAllAvailabilities(Context context)
        {
            if (all == null)
            {
                all = new List <ShopAvailability>(256);
                for (byte i = 0; i < PSPResources.Lists.ShopAvailabilities.Count; i++)
                {
                    ShopAvailability a = new ShopAvailability();
                    a.b          = i;
                    a.name       = PSPResources.Lists.ShopAvailabilities[i];
                    a.psxName    = PSXResources.Lists.ShopAvailabilities[i];
                    a.ourContext = context;
                    all.Add(a);
                }
                for (int i = PSPResources.Lists.ShopAvailabilities.Count; i <= 0xFF; i++)
                {
                    ShopAvailability a = new ShopAvailability();
                    a.b          = (byte)i;
                    a.name       = string.Format("Unknown ({0})", i);
                    a.psxName    = a.name;
                    a.ourContext = context;
                    all.Add(a);
                }
            }

            return(all);
        }
Пример #2
0
        protected List <byte> ToByteArray()
        {
            List <byte> result = new List <byte>(12);

            result.Add(Palette);
            result.Add(Graphic);
            result.Add(EnemyLevel);
            result.Add(PatcherLib.Utilities.Utilities.ByteFromBooleans(weapon, shield, head, body, accessory, blank1, rare, blank2));
            result.Add(SecondTableId);
            result.Add((byte)ItemType);
            result.Add(Unknown1);
            result.Add(SIA);
            result.AddRange(Price.ToBytes());
            result.Add(ShopAvailability.ToByte());
            result.Add(Unknown2);
            return(result);
        }
Пример #3
0
        protected Item(UInt16 offset, IList <byte> bytes, Context context)
        {
            Name       = GetItemNames(context)[offset];
            Offset     = offset;
            Palette    = bytes[0];
            Graphic    = bytes[1];
            EnemyLevel = bytes[2];
            PatcherLib.Utilities.Utilities.CopyByteToBooleans(bytes[3], ref weapon, ref shield, ref head, ref body, ref accessory, ref blank1, ref rare, ref blank2);
            SecondTableId    = bytes[4];
            ItemType         = (ItemSubType)bytes[5];
            Unknown1         = bytes[6];
            SIA              = bytes[7];
            Price            = PatcherLib.Utilities.Utilities.BytesToUShort(bytes[8], bytes[9]);
            ShopAvailability = ShopAvailability.GetAllAvailabilities(context)[bytes[10]];
            Unknown2         = bytes[11];

            OldSIA = SIA;
        }
Пример #4
0
        public Proposition(string name, IList <byte> bytes, Proposition _default, Context context)
        {
            Default = _default;
            Name    = name;

            byte propositionByte = bytes[0];

            Type = (PropositionType)propositionByte;
            //Type = propositionByte >= minPropositionByte && propositionByte <= maxPropositionByte ?
            //    (PropositionType)propositionByte :
            //    PropositionType.Unknown;

            byte braveFaithByte = bytes[1];

            BraveFaith = (BraveFaithNeutral)braveFaithByte;
            //BraveFaith = braveFaithByte >= minBraveFaithByte && braveFaithByte <= maxBraveFaithByte ?
            //    (BraveFaithNeutral)braveFaithByte :
            //    BraveFaithNeutral.Unknown;

            idBytes[0] = bytes[2];
            idBytes[1] = bytes[3];

            PriceIndex1 = bytes[4];
            PriceIndex2 = bytes[5];

            MinDays = bytes[6];
            MaxDays = bytes[7];

            idBytes[2] = bytes[8];

            byte baseSmallRewardByte = bytes[9];

            BaseSmallReward = baseSmallRewardByte >= (byte)BonusIndex.Nothing && baseSmallRewardByte <= (byte)BonusIndex._Eight ?
                              (BonusIndex)baseSmallRewardByte :
                              BonusIndex.Nothing;

            byte rewardByte = bytes[10];

            //Reward = (Reward)rewardByte;
            internalReward = rewardByte >= minRewardByte && rewardByte <= maxRewardByte ?
                             (Reward)rewardByte :
                             Reward.Nothing;

            EligibleForBonusCash = bytes[11] == 0x01;

            byte baseLargeRewardByte = bytes[12];

            BaseLargeReward = baseLargeRewardByte >= (byte)BonusIndex.Nothing && baseLargeRewardByte <= (byte)BonusIndex._Eight ?
                              (BonusIndex)baseLargeRewardByte :
                              BonusIndex.Nothing;

            idBytes[3] = bytes[13];
            idBytes[4] = bytes[14];

            Unknown0x0F = bytes[15];

            Town       = (Town)bytes[16];
            PrereqType = (PrereqType)bytes[17];

            idBytes[5]   = bytes[18];
            dontCareByte = bytes[19];

            byte randomSuccessByte = bytes[20];

            RandomSuccessClass = randomSuccessByte >= (byte)RandomSuccessClass.None && randomSuccessByte <= (byte)RandomSuccessClass.Mime ?
                                 (RandomSuccessClass)randomSuccessByte :
                                 RandomSuccessClass.None;

            WhenUnlocked = ShopAvailability.GetAllAvailabilities(context)[bytes[21]];

            PrereqByte = bytes[22];
        }