예제 #1
0
        public Instance(ushort zoneid, ushort id, byte realm, Instance_Lockouts lockouts)
        {
            Lockout = lockouts;
            ID      = id;
            ZoneID  = zoneid;
            Realm   = realm;
            Region  = new RegionMgr(zoneid, ZoneService.GetZoneRegion(zoneid), "", new ApocCommunications());
            InstanceService._InstanceInfo.TryGetValue(zoneid, out Info);
            LoadBossSpawns();
            LoadSpawns(); // todo get the saved progress from group
            _running      = true;
            _evtInterface = new EventInterface();
            closetime     = (TCPManager.GetTimeStamp() + 7200);

            // instancing stuff
            InstanceService.SaveLockoutInstanceID(ZoneID + ":" + ID, Lockout);

            new Thread(Update).Start();

            Log.Success("Opening Instance", "Instance ID " + ID + "  Map: " + Info.Name);
            // TOVL
            if (zoneid == 179)
            {
                foreach (var p in GameObjectService.GameObjectSpawns.Where(e => e.Value.ZoneId == 179))
                {
                    if (p.Value.Entry == 98908)
                    {
                        GameObject go = new GameObject(p.Value);

                        _Objects.Add(go);
                        Region.AddObject(go, zoneid, true);
                    }
                }

                if (Info != null && Info.Objects.Count > 0)
                {
                    LoadObjects();
                }
                _evtInterface.AddEvent(UpdatePendulums, 7000, 0);
            }
        }
예제 #2
0
        public void ApplyLockout(List <Player> subGroup)
        {
            if (Lockout == null) // instance hasn't got any lockouts
            {
                Lockout = new Instance_Lockouts
                {
                    InstanceID   = "~" + ZoneID + ":" + (TCPManager.GetTimeStamp() + Info.LockoutTimer * 60),
                    Bosseskilled = CurrentBossId.ToString()
                };
                InstanceService._InstanceLockouts.Add(Lockout.InstanceID, Lockout);
                Lockout.Dirty = true;
                WorldMgr.Database.AddObject(Lockout);
                InstanceService.SaveLockoutInstanceID(ZoneID + ":" + ID, Lockout);
            }
            else             // instance has got already lockouts
            {
                List <string> bossList = Lockout.Bosseskilled.Split(':').Distinct().ToList();
                if (!bossList.Contains(CurrentBossId.ToString()))
                {
                    bossList.Add(CurrentBossId.ToString());
                }
                Lockout.Bosseskilled = string.Empty;
                foreach (string boss in bossList)
                {
                    Lockout.Bosseskilled += ":" + boss;
                }
                if (Lockout.Bosseskilled.StartsWith(":"))
                {
                    Lockout.Bosseskilled = Lockout.Bosseskilled.Substring(1);
                }
                Lockout.Dirty = true;
                WorldMgr.Database.SaveObject(Lockout);
            }

            foreach (Player pl in subGroup)
            {
                pl._Value.AddLockout(Lockout);
                pl.SendLockouts();
            }
        }