コード例 #1
0
        public void RespawnInstanceGroup(uint GroupID, bool rezall = false)
        {
            lock (GroupsinCombat)
            {
                if (!GroupsinCombat.Contains(GroupID) || rezall)
                {
                    return;
                }
                GroupsinCombat.Remove(GroupID);

                _Spawns.TryGetValue(GroupID, out List <InstanceSpawn> spawns);
                if (spawns == null)
                {
                    spawns = new List <InstanceSpawn>();
                }
                for (int i = 0; i < spawns.Count; i++)
                {
                    if (spawns[i].IsDead)
                    {
                        InstanceSpawn IS = spawns[i].RezInstanceSpawn();
                        spawns[i] = IS;
                    }
                }
                _Spawns[GroupID] = spawns;
            }
        }
コード例 #2
0
        public InstanceSpawn RezInstanceSpawn()
        {
            InstanceSpawn newCreature = new InstanceSpawn(Spawn, bossId, Instance);

            Region.AddObject(newCreature, Spawn.ZoneId);
            Destroy();
            return(newCreature);
        }
コード例 #3
0
        private void LoadSpawns()
        {
            InstanceService._InstanceSpawns.TryGetValue(ZoneID, out List <Instance_Spawn> Obj);

            List <uint> deadbossIds = new List <uint>();

            if (Lockout != null)
            {
                for (int i = 0; i < Lockout.Bosseskilled.Split(';').Count(); i++)
                {
                    deadbossIds.Add(uint.Parse(Lockout.Bosseskilled.Split(';')[i].Split(':')[1]));
                }
            }

            if (Obj == null)
            {
                return;
            }

            foreach (var obj in Obj)
            {
                if (deadbossIds.Contains(obj.ConnectedbossId))
                {
                    continue;
                }

                if (obj.Realm == 0 || obj.Realm == Realm)
                {
                    Creature_spawn spawn = new Creature_spawn
                    {
                        Guid = (uint)CreatureService.GenerateCreatureSpawnGUID()
                    };
                    spawn.BuildFromProto(CreatureService.GetCreatureProto(obj.Entry));
                    if (spawn.Proto == null)
                    {
                        Log.Error("Creature Proto not found", " " + obj.Entry);
                        continue;
                    }

                    spawn.WorldO  = (int)obj.WorldO;
                    spawn.WorldY  = obj.WorldY;
                    spawn.WorldZ  = obj.WorldZ;
                    spawn.WorldX  = obj.WorldX;
                    spawn.ZoneId  = obj.ZoneID;
                    spawn.Enabled = 1;

                    InstanceSpawn IS = new InstanceSpawn(spawn, obj.ConnectedbossId, this);

                    if (obj.SpawnGroupID > 0)
                    {
                        _Spawns.TryGetValue(obj.SpawnGroupID, out List <InstanceSpawn> spawns);
                        if (spawns == null)
                        {
                            spawns = new List <InstanceSpawn>();
                        }
                        spawns.Add(IS);
                        _Spawns[obj.SpawnGroupID] = spawns;
                    }
                    Region.AddObject(IS, obj.ZoneID);
                }
            }
        }