Example #1
0
    void _Packet(ScEquipDown p)
    {
        if (p.result == 0)
        {
            if (changePitem != null && changePitem.GetPropItem().itemType == PropType.Rune)
            {
                AddAndRemoveData(changePitem, false);
            }
        }

        DispatchModuleEvent(EventChangeEquip, 1, p.result);
    }
Example #2
0
    public void AddItemToWareCollection(PItem item)
    {
        if (item == null || item.itemId == 0)
        {
            return;
        }

        var info = item.GetPropItem();

        if (info == null || !info.IsValidVocation(modulePlayer.proto))
        {
            return;
        }

        WareType t = GetWareType(item);

        if (!m_wareCollections.ContainsKey(t) || m_wareCollections[t] == null)
        {
            Logger.LogError("item id = {0}, find lableType = {1} cannot be finded in propritem lableType", info.itemNameId, t);
            return;
        }
        if (t == WareType.None)
        {
            return;
        }

        var _item = m_wareCollections[t].Find(p => p.itemId == item.itemId);

        if (_item == null)
        {
            m_wareCollections[t].Add(item);
        }
    }
Example #3
0
    private ShowCreatureInfo.SizeAndPos[] GetShowInfoData(PItem item)
    {
        var info = item.GetPropItem();

        if (!info)
        {
            return(null);
        }

        var type   = Module_Equip.GetEquipTypeByItem(item);
        var showId = type == EquipType.Cloth ? 300 : info.subType + 100;

        var showInfo = ConfigManager.Get <ShowCreatureInfo>(showId);

        if (showInfo == null)
        {
            Logger.LogError("can not find config showCreatureInfo, please check config [{0}]", showId);
            return(null);
        }

        var showData = showInfo.GetDataByIndex(info.ID);

        if (showData == null)
        {
            showData = showInfo.forData.Length > 0 ? showInfo.forData[0] : null;
            Logger.LogWarning("cause ShowCreatureInfo.Id = [{0}] with itemTypeId = [{1}] cannot be finded,we use itemTypeId = [{2}] to instead!", showId, info.ID, showData == null ? "null" : showData.index.ToString());
        }
        return(showData?.data);
    }
Example #4
0
    private List <string> GetItemModels(PItem item)
    {
        var l = new List <string>();

        if (item == null)
        {
            return(l);
        }

        var type = Module_Equip.GetEquipTypeByItem(item);
        var info = item.GetPropItem();

        if (type == EquipType.Cloth)
        {
            var model = info?.previewModel;
            if (!string.IsNullOrEmpty(model))
            {
                l.Add(model);
            }
        }
        else if (type == EquipType.Gun || type == EquipType.Weapon)
        {
            var weapon = WeaponInfo.GetWeapon(info.subType, info.ID);
            weapon.GetAllAssets(l);
        }
        return(l);
    }
Example #5
0
    private int DecomposeCompareHandle(PItem a, PItem b)
    {
        var p1 = a.GetPropItem();
        var p2 = b.GetPropItem();

        return(p1.quality.CompareTo(p2.quality));
    }
    private void RefreshDdesc(PItem data)
    {
        var p = data.GetPropItem();

        if (p == null)
        {
            return;
        }
        Util.SetText(m_textDesc, p.desc);
    }
Example #7
0
    public PItem GetEquipSameSubType(PItem item)
    {
        if (IsEquip(item))
        {
            return(null);
        }
        var now = m_currentEquip.Find(p => p.GetPropItem()?.subType == item.GetPropItem()?.subType);

        return(now);
    }
Example #8
0
    public WareType GetWareType(PItem item)
    {
        if (item == null)
        {
            return(WareType.None);
        }
        var info = item?.GetPropItem();

        if (!info)
        {
            return(WareType.None);
        }
        return((WareType)info.lableType);
    }
Example #9
0
    public void RefreshSelectableExpItem(PItem data, int number)
    {
        InitComponent();
        item = data;
        if (item == null)
        {
            InitSelectableExpItem();
            return;
        }

        m_propInfo = item?.GetPropItem();
        Util.SetItemInfo(m_itemObj, m_propInfo, 0, 0, false);
        Util.SetText(m_countText, Util.Format(ConfigText.GetDefalutString(TextForMatType.EquipIntentyUI, 17), number));
        m_delBtn?.gameObject.SetActive(number > 0);
        m_selectBtn?.gameObject.SetActive(number <= 0);
        m_itemObj?.gameObject.SetActive(number > 0);
    }
Example #10
0
    public void GetNewProp(PItem item)
    {
        PropItemInfo p = item?.GetPropItem();

        if (p == null || !p.IsValidVocation(modulePlayer.proto))
        {
            return;
        }

        var have = newProp.Find(a => a.itemId == item.itemId);

        if (have != null)
        {
            return;
        }
        newProp.Add(item);

        SetLocalNew(item.itemId);
    }
Example #11
0
    private void RefreshItem(RectTransform rt, PItem item)
    {
        if (m_cacheItems.ContainsKey(rt.gameObject))
        {
            m_cacheItems[rt.gameObject] = item;
        }
        else
        {
            m_cacheItems.Add(rt.gameObject, item);
        }

        PropItemInfo info  = item?.GetPropItem();
        int          count = moduleEquip.GetPropCount(item.itemTypeId);

        Util.SetItemInfo(rt, info, 0, count, false);
        Text countText = rt.GetComponent <Text>("numberdi/count");

        Util.SetText(countText, Util.Format(ConfigText.GetDefalutString(TextForMatType.EquipIntentyUI, 17), count));

        UpdateSelectCount(rt.gameObject, m_matList.Get(item));
    }
Example #12
0
    private List <PItemAttachAttr> GetAttributePreview(PItem data)
    {
        List <PItemAttachAttr> list = new List <PItemAttachAttr>();

        if (data.GetIntentyLevel() > 0 && !data.InvalidGrowAttr())
        {
            PItemAttachAttr[] attris = data.growAttr.equipAttr.fixedAttrs;
            foreach (var attr in attris)
            {
                list.Add(attr);
            }
        }
        else
        {
            PropItemInfo info = data.GetPropItem();
            if (info && info.attributes != null)
            {
                foreach (var a in info.attributes)
                {
                    PItemAttachAttr attr = PacketObject.Create <PItemAttachAttr>();
                    attr.id    = a.id;
                    attr.value = a.value;
                    list.Add(attr);
                }
            }
        }

        var nowLevel = item.growAttr.equipAttr.level;

        if (nowLevel > 0)
        {
            var             value = moduleForging.Insoul_Info[nowLevel].attribute;
            PItemAttachAttr a     = PacketObject.Create <PItemAttachAttr>();
            a.id    = 18;
            a.value = value;
            list.Add(a);
        }
        return(list);
    }
Example #13
0
    public void Init(PItem rItem, bool rIsDressOn)
    {
        var prop = rItem?.GetPropItem();

        if (null == prop)
        {
            return;
        }

        Util.SetText(name, prop.itemName);
        Util.SetText(level, $"+{rItem.growAttr.equipAttr.level}");
        if (stars?.Length > 0)
        {
            for (var i = 0; i < stars.Length; i++)
            {
                stars[i].SafeSetActive(i < rItem.growAttr.equipAttr.star);
            }
        }

        Util.SetEquipTypeIcon(typeIcons, prop.itemType, prop.subType);
        model?.LoadItemModel(rItem);
        equiped.SafeSetActive(rIsDressOn);
    }
Example #14
0
    /// <summary>
    /// 需要把玩家自己的信息记录到字典中去,保证自己的位置信息能够更新
    /// </summary>
    public PNmlPlayer AddSelfPlayerData()
    {
        PRoleInfo info = modulePlayer.roleInfo;

        if (m_bordlandPlayers.ContainsKey(info.roleId))
        {
            return(m_bordlandPlayers[info.roleId]);
        }

        PNmlPlayer self = PacketObject.Create <PNmlPlayer>();

        self.roleId    = info.roleId;
        self.roleProto = (byte)modulePlayer.proto;
        self.roleName  = info.roleName;
        self.level     = (sbyte)info.level;
        self.gender    = (sbyte)modulePlayer.gender;
        self.state     = (byte)EnumBordlandCreatureState.Idle;
        self.pos       = selfInitPosition.ToPPostion();
        self.fashion   = PacketObject.Create <PFashion>();
        self.pet       = modulePet.FightingPet != null ? modulePet.FightingPet.Item :null;
        for (int i = 0, count = moduleEquip.currentDressClothes.Count; i < count; i++)
        {
            PItem        item     = moduleEquip.currentDressClothes[i];
            PropItemInfo itemInfo = item?.GetPropItem();
            if (itemInfo == null)
            {
                continue;
            }

            switch (itemInfo.itemType)
            {
            case PropType.Weapon:
                if (itemInfo.subType != (byte)WeaponSubType.Gun)
                {
                    self.fashion.weapon = item.itemTypeId;
                }
                else
                {
                    self.fashion.gun = item.itemTypeId;
                }
                break;

            case PropType.FashionCloth:
                switch ((FashionSubType)itemInfo.subType)
                {
                case FashionSubType.UpperGarment:
                case FashionSubType.FourPieceSuit:
                case FashionSubType.TwoPieceSuit:
                    self.fashion.clothes = item.itemTypeId;
                    break;

                case FashionSubType.Pants:
                    self.fashion.trousers = item.itemTypeId;
                    break;

                case FashionSubType.Glove:
                    self.fashion.glove = item.itemTypeId;
                    break;

                case FashionSubType.Shoes:
                    self.fashion.shoes = item.itemTypeId;
                    break;

                case FashionSubType.Hair:
                    self.fashion.hair = item.itemTypeId;
                    break;

                case FashionSubType.ClothGuise:
                    self.fashion.guiseId = item.itemTypeId;
                    break;

                case FashionSubType.HeadDress:
                    self.fashion.headdress = item.itemTypeId;
                    break;

                case FashionSubType.HairDress:
                    self.fashion.hairdress = item.itemTypeId;
                    break;

                case FashionSubType.FaceDress:
                    self.fashion.facedress = item.itemTypeId;
                    break;

                case FashionSubType.NeckDress:
                    self.fashion.neckdress = item.itemTypeId;
                    break;
                }
                break;
            }
        }

        AddPlayerData(self);
        return(self);
    }
Example #15
0
 public void RefreshData(bool isEquiped)
 {
     Util.SetItemInfo(transform, OriginData.GetPropItem(), OriginData.growAttr.equipAttr.level, (int)OriginData.num, true, OriginData.growAttr.equipAttr.star);
     transform.GetComponent <Transform>("equiped").SafeSetActive(isEquiped);
 }
Example #16
0
    public PFashion GetSelfFashion()
    {
        PFashion fashion = PacketObject.Create <PFashion>();

        for (int i = 0, count = moduleEquip.currentDressClothes.Count; i < count; i++)
        {
            PItem        item     = moduleEquip.currentDressClothes[i];
            PropItemInfo itemInfo = item?.GetPropItem();
            if (itemInfo == null)
            {
                continue;
            }

            switch (itemInfo.itemType)
            {
            case PropType.Weapon:
                if (itemInfo.subType != (byte)WeaponSubType.Gun)
                {
                    fashion.weapon = item.itemTypeId;
                }
                else
                {
                    fashion.gun = item.itemTypeId;
                }
                break;

            case PropType.FashionCloth:
                switch ((FashionSubType)itemInfo.subType)
                {
                case FashionSubType.UpperGarment:
                case FashionSubType.FourPieceSuit:
                case FashionSubType.TwoPieceSuit:
                    fashion.clothes = item.itemTypeId;
                    break;

                case FashionSubType.Pants:
                    fashion.trousers = item.itemTypeId;
                    break;

                case FashionSubType.Glove:
                    fashion.glove = item.itemTypeId;
                    break;

                case FashionSubType.Shoes:
                    fashion.shoes = item.itemTypeId;
                    break;

                case FashionSubType.Hair:
                    fashion.hair = item.itemTypeId;
                    break;

                case FashionSubType.ClothGuise:
                    fashion.guiseId = item.itemTypeId;
                    break;

                case FashionSubType.HeadDress:
                    fashion.headdress = item.itemTypeId;
                    break;

                case FashionSubType.HairDress:
                    fashion.hairdress = item.itemTypeId;
                    break;

                case FashionSubType.FaceDress:
                    fashion.facedress = item.itemTypeId;
                    break;

                case FashionSubType.NeckDress:
                    fashion.neckdress = item.itemTypeId;
                    break;
                }
                break;
            }
        }

        return(fashion);
    }