Example #1
0
        public void Add(Item item)
        {
            // Dupe-check list

            bool stacked = item.StackCount > 1 ||
                           _cache.StackableRecords.Contains(item.BaseRecord) ||
                           _cache.SpecialRecords.Contains(item.BaseRecord); // Special "single seed" items.

            if (stacked)
            {
                Stacked.Add(item);
                All.Add(item);
                return;
            }

            // TODO: Detect slith rings etc


            // We don't have this record at all, unknown to IA. Probably need to parse DB.
            bool unknownItem = !_cache.AllRecords.Contains(item.BaseRecord);

            if (unknownItem)
            {
                if (item.BaseRecord.StartsWith("records/storyelements/rewards/"))
                {
                    Quest.Add(item);
                }
                else
                {
                    Unknown.Add(item);
                }

                All.Add(item);
                return;
            }

            // We already have this item..
            if (All.Any(m => m.Equals(item)))
            {
                Duplicates.Add(item);
                All.Add(item);
                return;
            }

            // We already have this item..
            if (_playerItemDao.Exists(TransferStashService.Map(item, null, false)))
            {
                Duplicates.Add(item);
                All.Add(item);
                return;
            }

            Remaining.Add(item);
            All.Add(item);
        }
        void BeginRound()
        {
            if (Interval == 0)
            {
                SetSpeed("normal");
            }
            string modeSuffix = FreezeMode ? " in freeze mode" : "";

            Map.Message("Starting " + SpeedType + " speed Countdown" + modeSuffix);

            if (FreezeMode)
            {
                Map.Message("You have 20 seconds to stand on a square");
                Map.Message("You won't be able to move from that square once the game starts!");
                DoCountdown("&b{0} &Sseconds left", 20, 20);
            }
            else
            {
                Map.Message("You have 5 seconds before squares start disappearing");
                DoCountdown("&b{0} &Sseconds left", 5, 5);
            }

            if (!Running)
            {
                return;
            }
            Map.Message("GO!!!!!!!");

            Player[] players = Players.Items;
            Remaining.Clear();
            foreach (Player pl in players)
            {
                Remaining.Add(pl);
            }

            if (!Running || !FreezeMode)
            {
                return;
            }
            Map.Message("&bPlayers Frozen");

            foreach (Player pl in players)
            {
                Position pos = pl.Pos;
                pl.Extras["MCG_CD_X"] = pos.X;
                pl.Extras["MCG_CD_Z"] = pos.Z;
            }
            RemoveAllSquareBorders();
        }