Example #1
0
 public static void EndMyClientsBind()
 {
     GM.ENDMODZ();
     VSAT.ENDMODZ();
     Speed.ENDMODZ();
     NightVision.ENDMODZ();
     RandomWeapon.ENDMODZ();
     RandomCamo.ENDMODZ();
 }
Example #2
0
    private void Awake()
    {
        // There should be only one NighVision script in the hub level, and it's applied to the main camera.
        nightVision = Camera.main.GetComponent <NightVision>();

        // The main camera also has a glitch effect script.
        glitchEffect = Camera.main.GetComponent <GlitchEffect>();

        if (zoneType == ZoneType.Switch)
        {
            connectedPowerable = GetComponentInParent <PowerableObject>();
        }
    }
 private static void NightVision()
 {
     if (Main.LocalPlayer == null || Main.MainCamera == null)
     {
         return;
     }
     if (Settings.NightVison)
     {
         NV = Main.MainCamera.GetComponent <NightVision>();
         NV.DiffuseIntensity    = 0f;
         NV.TextureMask.Color   = new Color(0f, 0f, 0f, 0f);
         NV.TextureMask.Stretch = false;
         NV.TextureMask.Size    = 0f;
         NV.Intensity           = 0f;
         NV.NoiseIntensity      = 0f;
         NV.StartSwitch(true);
         NV.enabled = true;
         return;
     }
     Main.MainCamera.GetComponent <NightVision>().StartSwitch(false);
     Main.MainCamera.GetComponent <NightVision>().enabled = true;
 }
Example #4
0
        private static Effect GetEffect(EffectType prim)
        {
            Effect eff = null;

            switch (prim)
            {
            case EffectType.Speed:
                eff = new Speed();
                break;

            case EffectType.Slowness:
                eff = new Slowness();
                break;

            case EffectType.Haste:
                eff = new Haste();
                break;

            case EffectType.MiningFatigue:
                eff = new MiningFatigue();
                break;

            case EffectType.Strength:
                eff = new Strength();
                break;

            case EffectType.InstantHealth:
                eff = new InstantHealth();
                break;

            case EffectType.InstantDamage:
                eff = new InstantDamage();
                break;

            case EffectType.JumpBoost:
                eff = new JumpBoost();
                break;

            case EffectType.Nausea:
                eff = new Nausea();
                break;

            case EffectType.Regeneration:
                eff = new Regeneration();
                break;

            case EffectType.Resistance:
                eff = new Resistance();
                break;

            case EffectType.FireResistance:
                eff = new FireResistance();
                break;

            case EffectType.WaterBreathing:
                eff = new WaterBreathing();
                break;

            case EffectType.Invisibility:
                eff = new Invisibility();
                break;

            case EffectType.Blindness:
                eff = new Blindness();
                break;

            case EffectType.NightVision:
                eff = new NightVision();
                break;

            case EffectType.Hunger:
                eff = new Hunger();
                break;

            case EffectType.Weakness:
                eff = new Weakness();
                break;

            case EffectType.Poison:
                eff = new Poison();
                break;

            case EffectType.Wither:
                eff = new Wither();
                break;

            case EffectType.HealthBoost:
                eff = new HealthBoost();
                break;

            case EffectType.Absorption:
                eff = new Absorption();
                break;

            case EffectType.Saturation:
                eff = new Saturation();
                break;
            }
            return(eff);
        }
Example #5
0
        public virtual void Consume(Player player)
        {
            Effect e = null;

            switch (Metadata)
            {
            case 5:
                e = new NightVision
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 6:
                e = new NightVision
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 7:
                e = new Invisibility
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 8:
                e = new Invisibility
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 9:
                e = new JumpBoost
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 10:
                e = new JumpBoost
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 11:
                e = new JumpBoost
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 12:
                e = new FireResistance
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 13:
                e = new FireResistance
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 14:
                e = new Speed
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 15:
                e = new Speed
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 16:
                e = new Speed
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 17:
                e = new Slowness
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 18:
                e = new Slowness
                {
                    Duration = 4800,
                    Level    = 0
                };
                break;

            case 19:
                e = new WaterBreathing
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 20:
                e = new WaterBreathing
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 21:
                e = new InstantHealth
                {
                    Duration = 0,
                    Level    = 0
                };
                break;

            case 22:
                e = new InstantHealth
                {
                    Duration = 0,
                    Level    = 1
                };
                break;

            case 23:
                e = new InstantDamage
                {
                    Duration = 0,
                    Level    = 0
                };
                break;

            case 24:
                e = new InstantDamage
                {
                    Duration = 0,
                    Level    = 1
                };
                break;

            case 25:
                e = new Poison
                {
                    Duration = 900,
                    Level    = 0
                };
                break;

            case 26:
                e = new Poison
                {
                    Duration = 2400,
                    Level    = 0
                };
                break;

            case 27:
                e = new Poison
                {
                    Duration = 440,
                    Level    = 1
                };
                break;

            case 28:
                e = new Regeneration
                {
                    Duration = 900,
                    Level    = 0
                };
                break;

            case 29:
                e = new Regeneration
                {
                    Duration = 2400,
                    Level    = 0
                };
                break;

            case 30:
                e = new Regeneration
                {
                    Duration = 440,
                    Level    = 1
                };
                break;

            case 31:
                e = new Strength
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 32:
                e = new Strength
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 33:
                e = new Strength
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 34:
                e = new Weakness
                {
                    Duration = 1800,
                    Level    = 0
                };
                break;

            case 35:
                e = new Weakness
                {
                    Duration = 4800,
                    Level    = 0
                };
                break;
            }

            if (e != null)
            {
                player.SetEffect(e);
            }
        }
Example #6
0
        public void Effect(Player player, string effect, int level, int duration)
        {
            if ("clear".Equals(effect, StringComparison.InvariantCultureIgnoreCase))
            {
                player.Level.BroadcastMessage($"Removed all effects for {player.Username}.", MessageType.Raw);
                player.RemoveAllEffects();
                return;
            }

            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strength:
                    eff = new Strength();
                    break;

                case EffectType.InstantHealth:
                    eff = new InstantHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level     = level;
                    eff.Duration  = duration;
                    eff.Particles = false;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage($"{player.Username} added effect {effectType} with strenght {level}", MessageType.Raw);
                }
            }
        }
Example #7
0
        public void Effect(Player player, string effect, int level = 1, int duration = 20)
        {
            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strenght:
                    eff = new Strength();
                    break;

                case EffectType.InstandHealth:
                    eff = new InstandHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;

                case EffectType.Glowing:
                    eff = new Glowing();
                    break;

                case EffectType.Levitation:
                    eff = new Levitation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level     = level;
                    eff.Duration  = duration;
                    eff.Particles = false;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage(string.Format("{0} added effect {1} with strenght {2}", player.Username, effectType, level), MessageType.Raw);
                }
            }
        }
Example #8
0
        public override void InitializePlayer(GameLevel gameLevel, SkyPlayer player)
        {
            if (!player.Effects.ContainsKey(EffectType.NightVision))
            {
                NightVision nightVision = new NightVision
                {
                    Duration  = int.MaxValue,
                    Level     = 0,
                    Particles = false
                };
                player.SetEffect(nightVision);
            }

            if (!(player.Inventory.Slots[4] is ItemNavigationCompass))
            {
                player.Inventory.SetInventorySlot(4, new ItemNavigationCompass());

                //Wait until the compass has appeared to change held slots
                RunnableTask.RunTaskLater(() =>
                {
                    player.Inventory.SetHeldItemSlot(4);
                }, 500);
            }

            /*try
             * {
             *      ISet<long> mapIds = MapUtil.GetLevelMapIds(gameLevel);
             *      if (mapIds == null)
             *      {
             *              SkyUtil.log(
             *                      $"Attempted to respawn missing maps for {player.Username}, but no maps were registered for {gameLevel.GameId}");
             *      }
             *      else
             *      {
             *              RunnableTask.RunTaskLater(() =>
             *              {
             *                      //Murder one as example
             *                      Block block = gameLevel.GetBlock(new BlockCoordinates(260, 77, 270));
             *
             *                      var message = McpeUpdateBlock.CreateObject();
             *                      message.blockId = block.Id;
             *                      message.coordinates = block.Coordinates;
             *                      message.blockMetaAndPriority = (byte)(0xb << 4 | (block.Metadata & 0xf));
             *                      player.SendPackage(message);
             *
             *                      /*MapUtil.SpawnMapImage(@"C:\Users\Administrator\Desktop\dl\map-images\comingsoonmapimage.png", 1, 1, this,
             *                              new BlockCoordinates(249, 77, 268), MapUtil.MapDirection.West);
             *                      MapUtil.SpawnMapImage(@"C:\Users\Administrator\Desktop\dl\map-images\buildbattlemapimage.png", 1, 1, this,
             *                              new BlockCoordinates(252, 77, 270), MapUtil.MapDirection.West);
             *                      MapUtil.SpawnMapImage(@"C:\Users\Administrator\Desktop\dl\map-images\murdermapimage.png", 1, 1, this,
             *                              new BlockCoordinates(260, 77, 270), MapUtil.MapDirection.West);
             *                      MapUtil.SpawnMapImage(@"C:\Users\Administrator\Desktop\dl\map-images\comingsoonmapimage.png", 1, 1, this,
             *                              new BlockCoordinates(263, 77, 268), MapUtil.MapDirection.West);#1#
             *
             *                      /*foreach (long mapEntityId in mapIds)
             *                      {
             *                              if (gameLevel.GetEntity(mapEntityId) is MapEntity mapEntity)
             *                              {
             *                                      player.SendPackage(((MapImageProvider)mapEntity.ImageProvider).Batch);
             *                              }
             *                      }#1#
             *              }, 1000);
             *      }
             * }
             * catch (Exception e)
             * {
             *      Console.WriteLine(e);
             * }*/
        }