Exemple #1
0
        //public static bool ChangeEquip(Pathea.PeEntity entity, EeqSelect select)
        //{
        //    List<ItemObject> objs = entity.GetEquipObjs(select);
        //    if (objs.Count > 0 && GameUI.Instance.mServantWndCtrl.ServantIsNotNull)
        //    {
        //        EquipmentCmpt.Receiver receiver = entity.packageCmpt;
        //        if (GameUI.Instance.mServantWndCtrl.EquipItem(objs[0], receiver))
        //        {
        //            return entity.RemoveFromBag(objs[0]);
        //        }
        //    }
        //    return false;
        //}

        public static bool EquipByObj(Pathea.PeEntity entity, ItemObject obj)
        {
            if (obj == null || entity.equipmentCmpt == null)
            {
                return(false);
            }

            EquipmentCmpt.Receiver receiver = entity.packageCmpt;
            if (GameConfig.IsMultiMode)
            {
                if (entity.equipmentCmpt.NetTryPutOnEquipment(obj, true, receiver))
                {
                    entity.netCmpt.RequestUseItem(obj.instanceId);
                    //entity.RemoveFromBag(obj);
                    return(true);
                }
            }
            else
            {
                if (entity.equipmentCmpt.PutOnEquipment(obj, true, receiver))
                {
                    if (SelectItem_N.Instance.ItemObj != null && SelectItem_N.Instance.ItemObj.Equals(obj))
                    {
                        SelectItem_N.Instance.SetItem(null);
                    }

                    entity.RemoveFromBag(obj);
                    return(true);
                }
            }
            return(false);
        }