示例#1
0
文件: Item.cs 项目: yaqisheng/Meteor
        /// <summary>
        /// Initialize the item data
        /// </summary>
        /// <param name="lt"></param>
        /// <returns></returns>
        public ItemData Initialize(LuaTable lt)
        {
            this.ID        = Convert.ToUInt32((Double)(lt["ID"]));
            this.Name      = (String)lt["Name"];
            this.PackMax   = Convert.ToInt16((Double)(lt["PackMax"]));
            this.ItemKind1 = Convert.ToInt16((Double)(lt["ItemKind1"]));
            this.ItemKind2 = Convert.ToInt16((Double)(lt["ItemKind2"]));
            if (lt["ItemKind3"] != null)
            {
                this.ItemKind3 = Convert.ToInt16((Double)(lt["ItemKind3"]));
            }
            else
            {
                this.ItemKind3 = -1;
            }
            if (lt["Series"] != null)
            {
                this.Series = Convert.ToSByte((Double)(lt["Series"]));
            }
            if (lt["ItemJob"] != null)
            {
                this.ItemJob = Convert.ToSByte((Double)(lt["ItemJob"]));
            }
            else
            {
                this.ItemJob = -1;
            }
            if (lt["ItemSex"] != null)
            {
                this.ItemSex = Convert.ToSByte((Double)(lt["ItemSex"]));
            }
            else
            {
                this.ItemSex = -1;
            }
            if (lt["Permanence"] != null)
            {
                this.Permanence = Convert.ToSByte((Double)(lt["Permanence"]));
            }
            if (lt["Charged"] != null)
            {
                this.Charged = Convert.ToByte((Double)(lt["Charged"]));
            }
            if (lt["Lock"] != null)
            {
                this.Lock = Convert.ToSByte((Double)(lt["Lock"]));
            }
            else
            {
                this.Lock = -1;
            }
            if (lt["ShopAble"] != null)
            {
                this.ShopAble = Convert.ToByte((Double)(lt["ShopAble"]));
            }
            if (lt["Dropable"] != null)
            {
                this.Dropable = Convert.ToByte((Double)(lt["Dropable"]));
            }
            if (lt["Broadcast"] != null)
            {
                this.Broadcast = Convert.ToByte((Double)(lt["Broadcast"]));
            }
            if (lt["Delete"] != null)
            {
                this.Delete = Convert.ToByte((Double)(lt["Delete"]));
            }
            if (lt["ShopIn"] != null)
            {
                this.ShopIn = Convert.ToByte((Double)(lt["ShopIn"]));
            }
            if (lt["TradingpostIn"] != null)
            {
                this.TradingpostIn = Convert.ToByte((Double)(lt["TradingpostIn"]));
            }
            if (lt["MailIn"] != null)
            {
                this.MailIn = Convert.ToByte((Double)(lt["MailIn"]));
            }
            if (lt["Trade"] != null)
            {
                this.Trade = Convert.ToByte((Double)(lt["Trade"]));
            }
            if (lt["Sell"] != null)
            {
                this.Sell = Convert.ToByte((Double)(lt["Sell"]));
            }
            if (lt["ForceBank"] != null)
            {
                this.ForceBank = Convert.ToByte((Double)(lt["ForceBank"]));
            }
            if (lt["BankIn"] != null)
            {
                this.BankIn = Convert.ToByte((Double)(lt["BankIn"]));
            }
            if (lt["Info"] != null)
            {
                this.Info = Convert.ToByte((Double)(lt["Info"]));
            }
            if (lt["Repair"] != null)
            {
                this.Repair = Convert.ToByte((Double)(lt["Repair"]));
            }
            if (lt["Produceable"] != null)
            {
                this.Produceable = Convert.ToByte((Double)(lt["Produceable"]));
            }
            if (lt["BFUsable"] != null)
            {
                this.BFUsable = Convert.ToByte((Double)(lt["BFUsable"]));
            }
            if (lt["TimeWay"] != null)
            {
                this.TimeWay = Convert.ToByte((Double)(lt["TimeWay"]));
            }
            if (lt["UseableDate"] != null)
            {
                this.UseableDate = Convert.ToInt32((Double)(lt["UseableDate"]));
            }
            if (lt["TradePoint"] != null)
            {
                this.TradePoint = Convert.ToInt32((Double)(lt["TradePoint"]));
            }
            if (lt["RmbTrade"] != null)
            {
                this.RmbTrade = Convert.ToInt32((Double)(lt["RmbTrade"]));
            }
            if (lt["Cost"] != null)
            {
                this.Cost = Convert.ToInt32((Double)(lt["Cost"]));
            }
            if (lt["SellCost"] != null)
            {
                this.SellCost = Convert.ToInt32((Double)(lt["SellCost"]));
            }
            if (lt["TaxQuota"] != null)
            {
                this.TaxQuota = Convert.ToByte((Double)(lt["TaxQuota"]));
            }
            if (lt["ItemLV"] != null)
            {
                this.ItemLV = Convert.ToSByte((Double)(lt["ItemLV"]));
            }
            this.LimitLevel1 = Convert.ToInt16((Double)(lt["LimitLevel1"]));
            if (lt["LimitLevel2"] != null)
            {
                this.LimitLevel2 = Convert.ToByte((Double)(lt["LimitLevel2"]));
            }
            if (lt["ItemRare"] != null)
            {
                this.ItemRare = Convert.ToByte((Double)(lt["ItemRare"]));
            }
            if (lt["Quality"] != null)
            {
                this.Quality = Convert.ToByte((Double)(lt["Quality"]));
            }
            if (lt["SkillReadyType"] != null)
            {
                this.SkillReadyType = Convert.ToInt32((Double)(lt["SkillReadyType"]));
            }
            else
            {
                this.SkillReadyType = -1;
            }
            if (lt["SkillReady"] != null)
            {
                this.SkillReady = Convert.ToInt32((Double)(lt["SkillReady"]));
            }
            else
            {
                this.SkillReady = -1;
            }
            if (lt["SkillTime"] != null)
            {
                this.SkillTime = Convert.ToInt32((Double)(lt["SkillTime"]));
            }
            else
            {
                this.SkillTime = -1;
            }
            if (lt["CircleTime"] != null)
            {
                this.CircleTime = Convert.ToInt32((Double)(lt["CircleTime"]));
            }
            else
            {
                this.CircleTime = -1;
            }
            if (lt["UseMotion"] != null)
            {
                this.UseMotion = Convert.ToInt16((Double)(lt["UseMotion"]));
            }
            else
            {
                this.UseMotion = -1;
            }
            if (lt["SfxObj"] != null)
            {
                this.SfxObj = Convert.ToInt32((Double)(lt["SfxObj"]));
            }
            else
            {
                this.SfxObj = -1;
            }
            if (lt["SfxObj2"] != null)
            {
                this.SfxObj2 = Convert.ToInt32((Double)(lt["SfxObj2"]));
            }
            else
            {
                this.SfxObj2 = -1;
            }
            if (lt["SfxObj3"] != null)
            {
                this.SfxObj3 = Convert.ToInt32((Double)(lt["SfxObj3"]));
            }
            else
            {
                this.SfxObj3 = -1;
            }
            if (lt["AbilityMin"] != null)
            {
                this.AbilityMin = Convert.ToInt32((Double)(lt["AbilityMin"]));
            }
            else
            {
                this.AbilityMin = -1;
            }

            if (lt["AbilityMax"] != null)
            {
                this.AbilityMax = Convert.ToInt16((Double)(lt["AbilityMax"]));
            }
            else
            {
                this.AbilityMax = -1;
            }
            if (lt["DestParam1"] != null)
            {
                LuaTable _dest  = (LuaTable)lt["DestParam1"];
                Int32    _count = 0;
                foreach (DictionaryEntry pair in _dest)
                {
                    ++_count;
                }
                this.DestParam1 = new DestParam[_count];
                if (_count > 1)
                {
                    _count = 0;
                    foreach (DictionaryEntry de in _dest)
                    {
                        LuaTable  ltable = (LuaTable)de.Value;
                        DestParam param  = new DestParam();
                        param.Type              = (String)ltable[1.0];
                        param.Attribute         = Convert.ToInt16((Double)ltable[2.0]);
                        param.Value             = Convert.ToInt32((Double)ltable[3.0]);
                        this.DestParam1[_count] = param;
                        ++_count;
                    }
                }
                else
                {
                    LuaTable  _table = (LuaTable)_dest.Values;
                    DestParam _param = new DestParam();
                    _param.Type        = (String)_table[1.0];
                    _param.Attribute   = Convert.ToInt16((Double)_table[2.0]);
                    _param.Value       = Convert.ToInt32((Double)_table[3.0]);
                    this.DestParam1[0] = _param;
                }
            }

            if (lt["DestParam2"] != null)
            {
                LuaTable _table = (LuaTable)(lt["DestParam2"]);
                Int32    _count = 0;
                foreach (DictionaryEntry pair in _table)
                {
                    ++_count;
                }
                this.DestParam2 = new DestParam[_count];
                if (_count > 1)
                {
                    _count = 0;
                    foreach (DictionaryEntry de in _table)
                    {
                        LuaTable  _table2 = (LuaTable)de.Value;
                        DestParam _param  = new DestParam();
                        _param.Type             = (String)_table2[1.0];
                        _param.Attribute        = Convert.ToInt16((Double)_table2[2.0]);
                        _param.Value            = Convert.ToInt32((Double)_table2[3.0]);
                        this.DestParam1[_count] = _param;
                        ++_count;
                    }
                }
                else
                {
                    LuaTable  _table2 = (LuaTable)_table.Values;
                    DestParam _param  = new DestParam();
                    _param.Type        = (String)_table2[1.0];
                    _param.Attribute   = Convert.ToInt16((Double)_table2[2.0]);
                    _param.Value       = Convert.ToInt32((Double)_table2[3.0]);
                    this.DestParam2[0] = _param;
                }
            }
            return(this);
        }
示例#2
0
文件: Item.cs 项目: Eastrall/Meteor
        /// <summary>
        /// Initialize the item data
        /// </summary>
        /// <param name="lt"></param>
        /// <returns></returns>
        public ItemData Initialize(LuaTable lt)
        {
            this.ID = Convert.ToUInt32((Double)(lt["ID"]));
            this.Name = (String)lt["Name"];
            this.PackMax = Convert.ToInt16((Double)(lt["PackMax"]));
            this.ItemKind1 = Convert.ToInt16((Double)(lt["ItemKind1"]));
            this.ItemKind2 = Convert.ToInt16((Double)(lt["ItemKind2"]));
            if (lt["ItemKind3"] != null)
                this.ItemKind3 = Convert.ToInt16((Double)(lt["ItemKind3"]));
            else
                this.ItemKind3 = -1;
            if (lt["Series"] != null)
                this.Series = Convert.ToSByte((Double)(lt["Series"]));
            if (lt["ItemJob"] != null)
                this.ItemJob = Convert.ToSByte((Double)(lt["ItemJob"]));
            else
                this.ItemJob = -1;
            if (lt["ItemSex"] != null)
                this.ItemSex = Convert.ToSByte((Double)(lt["ItemSex"]));
            else
                this.ItemSex = -1;
            if (lt["Permanence"] != null)
                this.Permanence = Convert.ToSByte((Double)(lt["Permanence"]));
            if (lt["Charged"] != null)
                this.Charged = Convert.ToByte((Double)(lt["Charged"]));
            if (lt["Lock"] != null)
                this.Lock = Convert.ToSByte((Double)(lt["Lock"]));
            else
                this.Lock = -1;
            if (lt["ShopAble"] != null)
                this.ShopAble = Convert.ToByte((Double)(lt["ShopAble"]));
            if (lt["Dropable"] != null)
                this.Dropable = Convert.ToByte((Double)(lt["Dropable"]));
            if (lt["Broadcast"] != null)
                this.Broadcast = Convert.ToByte((Double)(lt["Broadcast"]));
            if (lt["Delete"] != null)
                this.Delete = Convert.ToByte((Double)(lt["Delete"]));
            if (lt["ShopIn"] != null)
                this.ShopIn = Convert.ToByte((Double)(lt["ShopIn"]));
            if (lt["TradingpostIn"] != null)
                this.TradingpostIn = Convert.ToByte((Double)(lt["TradingpostIn"]));
            if (lt["MailIn"] != null)
                this.MailIn = Convert.ToByte((Double)(lt["MailIn"]));
            if (lt["Trade"] != null)
                this.Trade = Convert.ToByte((Double)(lt["Trade"]));
            if (lt["Sell"] != null)
                this.Sell = Convert.ToByte((Double)(lt["Sell"]));
            if (lt["ForceBank"] != null)
                this.ForceBank = Convert.ToByte((Double)(lt["ForceBank"]));
            if (lt["BankIn"] != null)
                this.BankIn = Convert.ToByte((Double)(lt["BankIn"]));
            if (lt["Info"] != null)
                this.Info = Convert.ToByte((Double)(lt["Info"]));
            if (lt["Repair"] != null)
                this.Repair = Convert.ToByte((Double)(lt["Repair"]));
            if (lt["Produceable"] != null)
                this.Produceable = Convert.ToByte((Double)(lt["Produceable"]));
            if (lt["BFUsable"] != null)
                this.BFUsable = Convert.ToByte((Double)(lt["BFUsable"]));
            if (lt["TimeWay"] != null)
                this.TimeWay = Convert.ToByte((Double)(lt["TimeWay"]));
            if (lt["UseableDate"] != null)
                this.UseableDate = Convert.ToInt32((Double)(lt["UseableDate"]));
            if (lt["TradePoint"] != null)
                this.TradePoint = Convert.ToInt32((Double)(lt["TradePoint"]));
            if (lt["RmbTrade"] != null)
                this.RmbTrade = Convert.ToInt32((Double)(lt["RmbTrade"]));
            if (lt["Cost"] != null)
                this.Cost = Convert.ToInt32((Double)(lt["Cost"]));
            if (lt["SellCost"] != null)
                this.SellCost = Convert.ToInt32((Double)(lt["SellCost"]));
            if (lt["TaxQuota"] != null)
                this.TaxQuota = Convert.ToByte((Double)(lt["TaxQuota"]));
            if (lt["ItemLV"] != null)
                this.ItemLV = Convert.ToSByte((Double)(lt["ItemLV"]));
            this.LimitLevel1 = Convert.ToInt16((Double)(lt["LimitLevel1"]));
            if (lt["LimitLevel2"] != null)
                this.LimitLevel2 = Convert.ToByte((Double)(lt["LimitLevel2"]));
            if (lt["ItemRare"] != null)
                this.ItemRare = Convert.ToByte((Double)(lt["ItemRare"]));
            if (lt["Quality"] != null)
                this.Quality = Convert.ToByte((Double)(lt["Quality"]));
            if (lt["SkillReadyType"] != null)
                this.SkillReadyType = Convert.ToInt32((Double)(lt["SkillReadyType"]));
            else
                this.SkillReadyType = -1;
            if (lt["SkillReady"] != null)
                this.SkillReady = Convert.ToInt32((Double)(lt["SkillReady"]));
            else
                this.SkillReady = -1;
            if (lt["SkillTime"] != null)
                this.SkillTime = Convert.ToInt32((Double)(lt["SkillTime"]));
            else
                this.SkillTime = -1;
            if (lt["CircleTime"] != null)
                this.CircleTime = Convert.ToInt32((Double)(lt["CircleTime"]));
            else
                this.CircleTime = -1;
            if (lt["UseMotion"] != null)
                this.UseMotion = Convert.ToInt16((Double)(lt["UseMotion"]));
            else
                this.UseMotion = -1;
            if (lt["SfxObj"] != null)
                this.SfxObj = Convert.ToInt32((Double)(lt["SfxObj"]));
            else
                this.SfxObj = -1;
            if (lt["SfxObj2"] != null)
                this.SfxObj2 = Convert.ToInt32((Double)(lt["SfxObj2"]));
            else
                this.SfxObj2 = -1;
            if (lt["SfxObj3"] != null)
                this.SfxObj3 = Convert.ToInt32((Double)(lt["SfxObj3"]));
            else
                this.SfxObj3 = -1;
            if (lt["AbilityMin"] != null)
                this.AbilityMin = Convert.ToInt32((Double)(lt["AbilityMin"]));
            else
                this.AbilityMin = -1;

            if (lt["AbilityMax"] != null)
                this.AbilityMax = Convert.ToInt16((Double)(lt["AbilityMax"]));
            else
                this.AbilityMax = -1;
            if (lt["DestParam1"] != null)
            {
                LuaTable _dest = (LuaTable)lt["DestParam1"];
                Int32 _count = 0;
                foreach (DictionaryEntry pair in _dest)
                    ++_count;
                this.DestParam1 = new DestParam[_count];
                if (_count > 1)
                {
                    _count = 0;
                    foreach (DictionaryEntry de in _dest)
                    {
                        LuaTable ltable = (LuaTable)de.Value;
                        DestParam param = new DestParam();
                        param.Type = (String)ltable[1.0];
                        param.Attribute = Convert.ToInt16((Double)ltable[2.0]);
                        param.Value = Convert.ToInt32((Double)ltable[3.0]);
                        this.DestParam1[_count] = param;
                        ++_count;
                    }
                }
                else
                {
                    LuaTable _table = (LuaTable)_dest.Values;
                    DestParam _param = new DestParam();
                    _param.Type = (String)_table[1.0];
                    _param.Attribute = Convert.ToInt16((Double)_table[2.0]);
                    _param.Value = Convert.ToInt32((Double)_table[3.0]);
                    this.DestParam1[0] = _param;
                }
            }

            if (lt["DestParam2"] != null)
            {
                LuaTable _table = (LuaTable)(lt["DestParam2"]);
                Int32 _count = 0;
                foreach (DictionaryEntry pair in _table)
                    ++_count;
                this.DestParam2 = new DestParam[_count];
                if (_count > 1)
                {
                    _count = 0;
                    foreach (DictionaryEntry de in _table)
                    {
                        LuaTable _table2 = (LuaTable)de.Value;
                        DestParam _param = new DestParam();
                        _param.Type = (String)_table2[1.0];
                        _param.Attribute = Convert.ToInt16((Double)_table2[2.0]);
                        _param.Value = Convert.ToInt32((Double)_table2[3.0]);
                        this.DestParam1[_count] = _param;
                        ++_count;
                    }
                }
                else
                {
                    LuaTable _table2 = (LuaTable)_table.Values;
                    DestParam _param = new DestParam();
                    _param.Type = (String)_table2[1.0];
                    _param.Attribute = Convert.ToInt16((Double)_table2[2.0]);
                    _param.Value =