private static int SortFunc(GoodsMountEquip a, GoodsMountEquip b)
 {
     if (a.is_equipUp && b.is_equipUp == false)
     {
         return(-1);
     }
     else if (a.is_equipUp == false && b.is_equipUp)
     {
         return(1);
     }
     if (a.sort_id < b.sort_id)
     {
         return(-1);
     }
     else if (a.sort_id > b.sort_id)
     {
         return(1);
     }
     if (a.id < b.id)
     {
         return(-1);
     }
     else if (a.id > b.id)
     {
         return(1);
     }
     return(0);
 }
        /// <summary>
        /// 这个装备是否更好比身上的
        /// </summary>
        /// <param name="goods"></param>
        /// <returns></returns>
        public static bool IsBetterMountEquip(GoodsMountEquip goods)
        {
            if (SysConfigManager.Instance.CheckSysHasOpened(GameConst.SYS_OPEN_MOUNT_EQUIP, false) == false)
            {
                return(false);
            }


            int             mountLv     = GetMountLv();
            GoodsMountEquip mount_equip = ItemManager.Instance.GetWearingMountEquipGoods(goods.pos_id);

            if (mountLv >= goods.lv_step)
            {
                if (mount_equip == null)
                {
                    return(true);
                }
                else
                {
                    if (goods.Score > mount_equip.Score)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #3
0
        public override void RefreshEquipUp()
        {
            is_equipUp   = false;
            is_equipDown = false;
            if (LocalPlayerManager.Instance.LocalActorAttribute.Vocation != this.use_job && this.use_job != 0)
            {
                return;
            }
            if (this.IsInEnableTime() == false)
            {//物品过期
                is_equipUp   = false;
                is_equipDown = false;
                return;
            }
            GoodsMountEquip equip = ItemManager.Instance.GetWearingMountEquipGoods(pos_id);

            if (equip == null)
            {
                is_equipUp   = true;
                is_equipDown = false;
                return;
            }
            uint this_equipRank = this.Score;
            uint equip_rank     = equip.Score;

            if (this_equipRank > equip_rank)
            {
                is_equipUp = true;
            }
            else if (this_equipRank < equip_rank)
            {
                is_equipDown = true;
            }
        }
Exemple #4
0
        public new GoodsMountEquip Clone()
        {
            GoodsMountEquip equip = new GoodsMountEquip(this.type_idx, this._netInfo);

            equip.id         = this.id;
            equip.BasicAttrs = this.BasicAttrs;
            equip.lv         = this.lv;
            equip.suit_lv    = this.suit_lv;
            return(equip);
        }
        /// <summary>
        /// 有没有更好的装备可以穿
        /// </summary>
        /// <returns></returns>
        public static GoodsMountEquip GetBestMountEquip()
        {
            if (SysConfigManager.Instance.CheckSysHasOpened(GameConst.SYS_OPEN_MOUNT_EQUIP, false) == false)
            {
                return(null);
            }

            GoodsMountEquip intall_equip = null;
            int             mountLv      = GetMountLv();
            List <uint>     pos_list     = DBMountEquipGoods.Instance.GetPosList();

            for (int i = 0; i < pos_list.Count; i++)
            {
                uint pos_id = pos_list[i];
                intall_equip = ItemManager.Instance.GetWearingMountEquipGoods(pos_id);

                if (ItemManager.Instance.CheckHavePos(GameConst.GIVE_TYPE_RIDE_EQUIP, pos_id))
                {
                    continue;
                }

                foreach (GoodsMountEquip value in ItemManager.Instance.MountEquipGoodsOid.Values)
                {
                    if (ItemManager.Instance.mCloseQuickUseGoodsIdArray.ContainsKey(value.type_idx))
                    {
                        continue;
                    }

                    if (value.pos_id == pos_id && value.lv_step <= mountLv)
                    {
                        if (intall_equip == null)
                        {
                            intall_equip = value;
                        }
                        else
                        {
                            if (value.Score > intall_equip.Score)
                            {
                                intall_equip = value;
                            }
                        }
                    }
                }
                if (intall_equip != null && intall_equip != ItemManager.Instance.GetWearingMountEquipGoods(pos_id))
                {
                    return(intall_equip);
                }
            }
            return(null);
        }
Exemple #6
0
        public static Goods Create(uint mainType, uint typeId, Net.PkgGoodsInfo info)
        {
            Goods goods = null;

            switch (mainType)
            {
            case GameConst.GIVE_TYPE_EQUIP:
            {
                goods = new GoodsEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_SOUL:
            {
                goods = new GoodsSoul(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_DECORATE:
            {
                goods = new GoodsDecorate(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_GOD_EQUIP:
            {
                goods = new GoodsGodEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_RIDE_EQUIP:
            {
                goods = new GoodsMountEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_LIGHT_SOUL:
            {
                if (info != null)
                {
                    goods = new GoodsLightWeaponSoul(info);
                    break;
                }
                goods = new GoodsLightWeaponSoul(typeId);
                break;
            }

            case GameConst.GIVE_TYPE_MAGIC_EQUIP:
            {
                goods = new GoodsMagicEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_ARCHIVE:
            {
                if (info != null)
                {
                    goods = new GoodsItem(info)
                    {
                        bag_type = GameConst.BAG_TYPE_ARCHIVE
                    };
                }
                else
                {
                    goods = new GoodsItem(typeId)
                    {
                        bag_type = GameConst.BAG_TYPE_ARCHIVE
                    };
                }
                break;
            }

            default:
            {
                var goods_info = GoodsHelper.GetGoodsInfo(typeId);
                if (goods_info != null)
                {
                    string luaScript = GoodsHelper.GetGoodsLuaScriptByGoodsId(typeId);
                    if (!string.IsNullOrEmpty(luaScript))
                    {
                        if (LuaScriptMgr.Instance == null)
                        {
                            goods = new GoodsItem(typeId);
                        }
                        if (LuaScriptMgr.Instance.IsLuaScriptExist(luaScript))
                        {
                            goods = new GoodsLuaEx(typeId, luaScript);
                        }
                        else
                        {
                            Debug.LogWarning(string.Format("{0}未找到名字为的组件", luaScript));
                            goods = null;
                        }
                    }
                    else
                    {
                        if (info != null)
                        {
                            goods = new GoodsItem(info);
                            break;
                        }
                        goods = new GoodsItem(typeId);
                    }
                }
                break;
            }
            }
            if (goods == null)
            {//无法正常创建物品
                goods = GetDefaultGoods(typeId);
            }
            return(goods);
        }