Exemplo n.º 1
0
        public void InitPlayerAccount()
        {
            var autoSellItem = IniHelper.Account.GetString(Id.ToString(), "AutoSellItem");
            var spSellItem   = autoSellItem.Split('|');

            foreach (var item in spSellItem)
            {
                if (ushort.TryParse(item, out var id))
                {
                    AutoSellItemList.Add(id);
                }
            }
            var isAutoSell = IniHelper.Account.GetString(Id.ToString(), "IsAutoSell");

            if (bool.TryParse(isAutoSell, out var result))
            {
                IsAutoSell = result;
            }

            var isSellWhenFull = IniHelper.Account.GetString(Id.ToString(), "IsSellWhenFull");

            if (bool.TryParse(isSellWhenFull, out result))
            {
                IsSellWhenFull = result;
            }

            var autoDropItem = IniHelper.Account.GetString(Id.ToString(), "AutoDropItem");
            var spDropItem   = autoDropItem.Split('|');

            foreach (var item in spDropItem)
            {
                if (ushort.TryParse(item, out var id))
                {
                    AutoDropItemList.Add(id);
                }
            }
            var isAutoDrop = IniHelper.Account.GetString(Id.ToString(), "IsAutoDrop");

            if (bool.TryParse(isAutoDrop, out result))
            {
                IsAutoDrop = result;
            }

            var eventNoStr = IniHelper.Account.GetString(Id.ToString(), "WoodManEventNo");

            if (byte.TryParse(eventNoStr, out var eventNo))
            {
                _socket.WoodManInfo.EventNo = eventNo;
            }

            InfoUpdated?.Invoke();

            AutoSellItemUpdated?.Invoke();
            AutoDropItemUpdated?.Invoke();

            AutoSellItemUpdated += PlayerInfo_AutoSellItemUpdated;
            AutoDropItemUpdated += PlayerInfo_AutoDropItemUpdated;
        }
Exemplo n.º 2
0
        public void AddAutoSellItemIdx(int idx)
        {
            if (idx <= 0 || idx >= BagItems.Length || BagItems[idx].Id == 0)
            {
                return;
            }
            if (AutoSellItemList.Contains(BagItems[idx].Id))
            {
                return;
            }
            AutoSellItemList.Add(BagItems[idx].Id);

            AutoSellItemUpdated?.Invoke();
        }