Ejemplo n.º 1
0
        private static void OnModuleRespawn()
        {
            NWPlayer oPC = _.GetLastRespawnButtonPresser();

            ApplyDurabilityLoss(oPC);

            int amount = oPC.MaxHP / 2;

            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectResurrection(), oPC.Object);
            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(amount), oPC.Object);

            NWArea area = oPC.Area;

            TeleportPlayerToBindPoint(oPC);

            // If player is the last person in an instance, destroy the instance.
            if (area.IsInstance)
            {
                int playersInArea = NWModule.Get().Players.Count(x => x.Area == oPC.Area && x != oPC);

                if (playersInArea <= 0)
                {
                    _.DelayCommand(12.0f, () =>
                    {
                        AreaService.DestroyAreaInstance(area);
                    });
                }
            }
        }
Ejemplo n.º 2
0
        public static Location GetRandomSpawnPoint(NWArea area)
        {
            var walkmeshes = AreaService.GetAreaWalkmeshes(area);
            int count      = walkmeshes.Count;
            var index      = count <= 0 ? 0 : RandomService.Random(count);

            var spawnPoint = walkmeshes[index];

            return(Location(area.Object,
                            Vector((float)spawnPoint.LocationX, (float)spawnPoint.LocationY, (float)spawnPoint.LocationZ),
                            RandomService.RandomFloat(0, 360)));
        }