Exemplo n.º 1
0
        protected void LoadSBInfo()
        {
            LastRestock = DateTime.UtcNow;

            for (int i = 0; i < m_ArmorBuyInfo.Count; ++i)
            {
                if (m_ArmorBuyInfo[i] is GenericBuyInfo buy)
                {
                    buy.DeleteDisplayEntity();
                }
            }

            SBInfos.Clear();

            InitSBInfo();

            m_ArmorBuyInfo.Clear();
            m_ArmorSellInfo.Clear();

            for (int i = 0; i < SBInfos.Count; i++)
            {
                SBInfo sbInfo = SBInfos[i];
                m_ArmorBuyInfo.AddRange(sbInfo.BuyInfo);
                m_ArmorSellInfo.Add(sbInfo.SellInfo);
            }
        }
Exemplo n.º 2
0
        protected void LoadSBInfo()
        {
            m_LastRestock = DateTime.Now;

            for (int i = 0; i < m_ArmorBuyInfo.Count; ++i)
            {
                GenericBuyInfo buy = m_ArmorBuyInfo[i] as GenericBuyInfo;

                if (buy != null)
                {
                    buy.DeleteDisplayEntity();
                }
            }

            SBInfos.Clear();

            InitSBInfo();

            m_ArmorBuyInfo.Clear();
            m_ArmorSellInfo.Clear();

            for (int i = 0; i < SBInfos.Count; i++)
            {
                SBInfo sbInfo = (SBInfo)SBInfos[i];
                m_ArmorBuyInfo.AddRange(sbInfo.BuyInfo);
                m_ArmorSellInfo.Add(sbInfo.SellInfo);
            }
        }
Exemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            LoadSBInfo();

            List <SBInfo> sbInfos = this.SBInfos;

            int index;

            while ((index = reader.ReadEncodedInt()) > 0)
            {
                int doubled = reader.ReadEncodedInt();

                if (sbInfos != null)
                {
                    index -= 1;
                    int sbInfoIndex  = index % sbInfos.Count;
                    int buyInfoIndex = index / sbInfos.Count;

                    if (sbInfoIndex >= 0 && sbInfoIndex < sbInfos.Count)
                    {
                        SBInfo sbInfo = sbInfos[sbInfoIndex];
                        List <GenericBuyInfo> buyInfo = sbInfo.BuyInfo;

                        if (buyInfo != null && buyInfoIndex >= 0 && buyInfoIndex < buyInfo.Count)
                        {
                            GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[buyInfoIndex];

                            int amount = 20;

                            switch (doubled)
                            {
                            case 1: amount = 40; break;

                            case 2: amount = 80; break;

                            case 3: amount = 160; break;

                            case 4: amount = 320; break;

                            case 5: amount = 640; break;

                            case 6: amount = 999; break;
                            }

                            gbi.Amount = gbi.MaxAmount = amount;
                        }
                    }
                }
            }

            if (Core.AOS && NameHue == 0x35)
            {
                NameHue = -1;
            }
        }
Exemplo n.º 4
0
        public override void Serialize(IGenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)1);  // version

            List <SBInfo> sbInfos = this.SBInfos;

            for (int i = 0; sbInfos != null && i < sbInfos.Count; ++i)
            {
                SBInfo sbInfo = sbInfos[i];
                List <GenericBuyInfo> buyInfo = sbInfo.BuyInfo;

                for (int j = 0; buyInfo != null && j < buyInfo.Count; ++j)
                {
                    GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[j];

                    int maxAmount = gbi.MaxAmount;
                    int doubled   = 0;

                    switch (maxAmount)
                    {
                    case 40:
                        doubled = 1;
                        break;

                    case 80:
                        doubled = 2;
                        break;

                    case 160:
                        doubled = 3;
                        break;

                    case 320:
                        doubled = 4;
                        break;

                    case 640:
                        doubled = 5;
                        break;

                    case 999:
                        doubled = 6;
                        break;
                    }

                    if (doubled > 0)
                    {
                        writer.WriteEncodedInt(1 + j * sbInfos.Count + i);
                        writer.WriteEncodedInt(doubled);
                    }
                }
            }

            writer.WriteEncodedInt(0);
        }
Exemplo n.º 5
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)2);               // version

            writer.Write((int)m_Budgets.Count);
            foreach (var keyValue in m_Budgets)
            {
                writer.Write((int)keyValue.Key);
                Budget.WriteBudget(writer, keyValue.Value);
            }

            List <SBInfo> sbInfos = this.SBInfos;

            for (int i = 0; sbInfos != null && i < sbInfos.Count; ++i)
            {
                SBInfo sbInfo = sbInfos[i];
                List <GenericBuyInfo> buyInfo = sbInfo.BuyInfo;

                for (int j = 0; buyInfo != null && j < buyInfo.Count; ++j)
                {
                    GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[j];

                    int maxAmount = gbi.MaxAmount;
                    int doubled   = 0;

                    switch (maxAmount)
                    {
                    case  40: doubled = 1; break;

                    case  80: doubled = 2; break;

                    case 160: doubled = 3; break;

                    case 320: doubled = 4; break;

                    case 640: doubled = 5; break;

                    case 999: doubled = 6; break;
                    }

                    if (doubled > 0)
                    {
                        writer.WriteEncodedInt(1 + ((j * sbInfos.Count) + i));
                        writer.WriteEncodedInt(doubled);
                    }
                }
            }

            writer.WriteEncodedInt(0);
        }
Exemplo n.º 6
0
        protected void LoadSBInfo()
        {
            m_LastRestock = DateTime.Now;

            InitSBInfo();

            m_ArmorBuyInfo.Clear();
            m_ArmorSellInfo.Clear();

            for (int i = 0; i < SBInfos.Count; i++)
            {
                SBInfo sbInfo = (SBInfo)SBInfos[i];
                m_ArmorBuyInfo.AddRange(sbInfo.BuyInfo);
                m_ArmorSellInfo.Add(sbInfo.SellInfo);
            }
        }
Exemplo n.º 7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            LoadSBInfo();

            ArrayList sbInfos = this.SBInfos;

            switch (version)
            {
            case 1:
            {
                int index;

                while ((index = reader.ReadEncodedInt()) > 0)
                {
                    int doubled = reader.ReadEncodedInt();

                    if (sbInfos != null)
                    {
                        index -= 1;
                        int sbInfoIndex  = index % sbInfos.Count;
                        int buyInfoIndex = index / sbInfos.Count;

                        if (sbInfoIndex >= 0 && sbInfoIndex < sbInfos.Count)
                        {
                            SBInfo    sbInfo  = (SBInfo)sbInfos[sbInfoIndex];
                            ArrayList buyInfo = sbInfo.BuyInfo;

                            if (buyInfo != null && buyInfoIndex >= 0 && buyInfoIndex < buyInfo.Count)
                            {
                                GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[buyInfoIndex];

                                int amount = 20;

                                switch (doubled)
                                {
                                case 1: amount = 40; break;

                                case 2: amount = 80; break;

                                case 3: amount = 160; break;

                                case 4: amount = 320; break;

                                case 5: amount = 640; break;

                                case 6: amount = 999; break;
                                }

                                gbi.Amount = gbi.MaxAmount = amount;
                            }
                        }
                    }
                }

                break;
            }
            }

            if (IsParagon)
            {
                IsParagon = false;
            }

            if (Core.AOS && NameHue == 0x35)
            {
                NameHue = -1;
            }

            Timer.DelayCall(TimeSpan.Zero, new TimerCallback(CheckMorph));
        }
Exemplo n.º 8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            LoadSBInfo();

            List <SBInfo> sbInfos = this.SBInfos;

            switch (version)
            {
            case 2:
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; ++i)
                {
                    Serial serial = (Serial)reader.ReadInt();
                    Budget budget = Budget.ReadBudget(reader);

                    m_Budgets.Add(serial, budget);
                }

                goto case 1;
            }

            case 1:
            {
                int index;

                while ((index = reader.ReadEncodedInt()) > 0)
                {
                    int doubled = reader.ReadEncodedInt();

                    if (sbInfos != null)
                    {
                        index -= 1;
                        int sbInfoIndex  = index % sbInfos.Count;
                        int buyInfoIndex = index / sbInfos.Count;

                        if (sbInfoIndex >= 0 && sbInfoIndex < sbInfos.Count)
                        {
                            SBInfo sbInfo = sbInfos[sbInfoIndex];
                            List <GenericBuyInfo> buyInfo = sbInfo.BuyInfo;

                            if (buyInfo != null && buyInfoIndex >= 0 && buyInfoIndex < buyInfo.Count)
                            {
                                GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[buyInfoIndex];

                                int amount = 20;

                                switch (doubled)
                                {
                                case 1: amount = 40; break;

                                case 2: amount = 80; break;

                                case 3: amount = 160; break;

                                case 4: amount = 320; break;

                                case 5: amount = 640; break;

                                case 6: amount = 999; break;
                                }

                                gbi.Amount = gbi.MaxAmount = amount;
                            }
                        }
                    }
                }

                break;
            }
            }

            if (IsParagon)
            {
                IsParagon = false;
            }
        }