Exemplo n.º 1
0
 public MWItem(MWItem target)
 {
     name    = target.name;
     desc    = target.desc;
     level   = target.level;
     quality = target.quality;
 }
Exemplo n.º 2
0
        public uint deleteCard(MWItem card)
        {
            uint val = (uint)(0.8 * card.getValue());

            if (val <= 0)
            {
                val = 1;
            }
            cards.Remove(card);
            return(val);
        }
Exemplo n.º 3
0
        public void parse(string line)
        {
            try
            {
                var pitems = line.Trim().Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                if (pitems.Length >= 2)
                {
                    userid = long.Parse(pitems[0].Trim());

                    var mitems = pitems[1].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var itemstrs in mitems)
                    {
                        var itemm = itemstrs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        if (itemm.Length >= 2)
                        {
                            string name  = itemm[0].Trim();
                            ulong  level = ulong.Parse(itemm[1].Trim());
                            if (allItems.ContainsKey(name))
                            {
                                MWItem thiscard = new MWItem(allItems[name]);
                                thiscard.name  = name;
                                thiscard.level = level;
                                cards.Add(thiscard);
                            }
                        }
                    }

                    if (pitems.Length >= 3)
                    {
                        try
                        {
                            userGetCardNum = long.Parse(pitems[2].Trim());
                        }
                        catch { }
                    }
                    if (pitems.Length >= 4)
                    {
                        try
                        {
                            userSpendMoney = long.Parse(pitems[3].Trim());
                        }
                        catch { }
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 4
0
        public void init(sendQQGroupMsgHandler _showScene, getQQNickHandler _getQQNick, BTCActor _btc, string _path)
        {
            outputMessage = _showScene;
            getQQNick     = _getQQNick;
            btc           = _btc;
            path          = _path;

            // init videos;
            var videofiles = Directory.GetFiles(path + videoPath, "*.txt");

            foreach (var vf in videofiles)
            {
                string name = Path.GetFileNameWithoutExtension(vf);
                videos[name] = new MWVideo(vf);
            }

            //LoopThread = new Thread(mainloop);
            //run = true;
            //LoopThread.Start();

            lock (dcardMutex)
            {
                // init cards
                var lines = FileIOActor.readLines(path + dcardPath + cardf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWItem card = new MWItem();
                        card.parse(line);
                        if (!string.IsNullOrWhiteSpace(card.name))
                        {
                            cards[card.name] = card;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }

                // init pools
                lines = FileIOActor.readLines(path + dcardPath + poolf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWItemPool pool = new MWItemPool(cards);
                        pool.parse(line);
                        if (!string.IsNullOrWhiteSpace(pool.name))
                        {
                            pools[pool.name] = pool;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }

                // init users
                lines = FileIOActor.readLines(path + dcardPath + userf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWUser user = new MWUser(-1, cards);
                        user.parse(line);
                        if (user.userid > 0)
                        {
                            users[user.userid] = user;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }

                // init servers
                lines = FileIOActor.readLines(path + dcardPath + dcardserverf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWServer server = new MWServer(this);
                        server.parse(line);
                        if (server.group > 0)
                        {
                            servers[server.group] = server;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }
            }
        }
Exemplo n.º 5
0
 public void addCard(MWItem card)
 {
     userGetCardNum += 1;
     cards.Add(card);
 }
Exemplo n.º 6
0
 public void addItem(MWItem _item, int _per)
 {
     items.Add(_item);
     pers.Add(_per);
     maxper += _per;
 }