예제 #1
0
 private void OnPickingUpItem(PickingUpItemEventArgs ev)
 {
     if (Check(ev.Player) && CheckItem(ev.Pickup))
     {
         ev.IsAllowed = false;
     }
 }
예제 #2
0
 internal void OnItemPickup(PickingUpItemEventArgs ev)
 {
     if (ev.Pickup == Scp012Item || PlayersInteracting.Contains(ev.Player))
     {
         ev.IsAllowed = false;
     }
 }
예제 #3
0
 public void OnPickupPill(PickingUpItemEventArgs ev)
 {
     if (ev.Pickup.ItemId == ItemType.Painkillers)
     {
         ev.Player.ShowHint(_plugin.Config.PickupMessage);
     }
 }
예제 #4
0
 private void OnTranqPickingUpItem(PickingUpItemEventArgs ev)
 {
     if (activeTranqs.Contains(ev.Player))
     {
         ev.IsAllowed = false;
     }
 }
예제 #5
0
 private void OnPlayerPickingUpItem(PickingUpItemEventArgs ev)
 {
     if (Scp999Manager.IsScp999(ev.Player))
     {
         ev.IsAllowed = false;
     }
 }
예제 #6
0
 public void PickedUpItem(PickingUpItemEventArgs e)
 {
     if (Environment.GetEnvironmentVariable("JEBAĆ") == "JEBAĆ")
     {
         e.IsAllowed = false;
         return;
     }
     if (e.Pickup.itemId == ItemType.Medkit)
     {
         int i = 0;
         foreach (var item in e.Player.Inventory.items)
         {
             if (item.id == ItemType.Medkit)
             {
                 i++;
             }
         }
         if (i > 0)
         {
             e.IsAllowed = false;
             e.Player.ShowHint("Złodzieju co tyle apteczek kradniesz?");
             return;
         }
         if (players.ContainsKey(e.Player))
         {
             if (players[e.Player] > 2)
             {
                 e.IsAllowed = false;
                 e.Player.ShowHint("Nie ma leczenia się cwelu");
             }
         }
     }
 }
 public async void OnPickingUpItem(PickingUpItemEventArgs ev)
 {
     if (Instance.Config.EventsToLog.PlayerPickingupItem && (!ev.Player.DoNotTrack || !Instance.Config.ShouldRespectDoNotTrack))
     {
         await Network.SendAsync(new RemoteCommand("log", "gameEvents", string.Format(Language.HasPickedUp, ev.Player.Nickname, Instance.Config.ShouldLogUserIds ? ev.Player.UserId : Language.Redacted, ev.Player.Role, ev.Pickup.ItemId))).ConfigureAwait(false);
     }
 }
예제 #8
0
        internal static void OnPickingUpItem(PickingUpItemEventArgs ev)
        {
            if (!Methods.ScpPickups.Contains(ev.Pickup))
            {
                return;
            }

            Log.Debug($"{ev.Player.Nickname} attempted to pickup a Scp035 object.", Config.Debug);
            ev.IsAllowed = false;
            if (API.IsScp035(ev.Player))
            {
                Log.Debug($"Pickup failed because {ev.Player.Nickname} is already a Scp035.", Config.Debug);
                return;
            }

            List <Player> players = Player.Get(Team.RIP).Where(ply => !ply.IsOverwatchEnabled).ToList();

            if (!Config.Scp035Modifiers.SelfInflict && players.Count == 0)
            {
                Log.Debug("There were no spectators to spawn Scp035 as, cancelling pickup.", Config.Debug);
                return;
            }

            NetworkServer.Destroy(ev.Pickup.gameObject);
            ev.Player.GameObject.AddComponent <Scp035Component>().AwakeFunc(Config.Scp035Modifiers.SelfInflict ? ev.Player : players[Random.Next(players.Count)]);
        }
예제 #9
0
 internal void OnPickupItem(PickingUpItemEventArgs ev)
 {
     if (!config.Item.canPickupAnyItemGlobal && !config.Item.canPickupAnyItem[ev.Player.Role])
     {
         ev.IsAllowed = false;
     }
 }
예제 #10
0
 public void PlayerPickupItem(PickingUpItemEventArgs ev)
 {
     if (ev.Pickup == bomb || ev.Pickup.info.itemId == ItemType.KeycardChaosInsurgency)
     {
         if (bombPlanted)
         {
             ev.IsAllowed = false;
             if (diffuser != null && (diffuser.ReferenceHub == ev.Player.ReferenceHub || diffuser.Role == RoleType.Spectator))
             {
                 Timing.KillCoroutines(plantHandle);
                 diffuser.ReferenceHub.playerEffectsController.ChangeEffectIntensity <Ensnared>(0);
                 diffuser  = null;
                 diffusing = false;
             }
             else
             {
                 plantHandle = Timing.RunCoroutine(DiffuseBomb(ev.Player));
             }
         }
         else if (ev.Player.Role == plugin.Config.NTFRole)
         {
             ev.IsAllowed = false;
         }
     }
 }
예제 #11
0
 private void OnPickingUp(PickingUpItemEventArgs ev)
 {
     if (CheckItem(ev.Pickup))
     {
         Coroutines.Add(Timing.RunCoroutine(DoInventoryRegeneration(ev.Player)));
     }
 }
예제 #12
0
 public void onItemGrab(PickingUpItemEventArgs ev)
 {
     if (EventHandlers.scp343.Contains(ev.Player) && !Plugin.Singleton.Config.canGrab)
     {
         ev.IsAllowed = false;
     }
 }
예제 #13
0
        private static bool Prefix(ItemSearchCompletor __instance)
        {
            var ev = new PickingUpItemEventArgs(API.Features.Player.Get(__instance.Hub.gameObject), __instance.TargetPickup);

            Player.OnPickingUpItem(ev);

            return(ev.IsAllowed);
        }
예제 #14
0
        /// <inheritdoc/>
        protected override void OnPickingUp(PickingUpItemEventArgs ev)
        {
            if (ev.Pickup.Type == ItemType.Coin && ev.Player.CurrentRoom.Name == "PocketWorld")
            {
                ev.IsAllowed = false;
            }

            base.OnPickingUp(ev);
        }
예제 #15
0
 public void OnPickupItem(PickingUpItemEventArgs ev)
 {
     tcp.SendData(new PlayerParam
     {
         eventName = "PickupItem",
         player    = PlyToUser(ev.Player),
         param     = Conversions.items.ContainsKey(ev.Pickup.ItemId) ? Conversions.items[ev.Pickup.ItemId] : ev.Pickup.ItemId.ToString()
     });
 }
예제 #16
0
 public void OnPickingUpItem(PickingUpItemEventArgs ev)
 {
     if (scp372.Contains(ev.Player.UserId))
     {
         ev.Player.IsInvisible = false;
         Timing.CallDelayed(1f, () =>
         {
             ev.Player.IsInvisible = true;
         });
     }
 }
예제 #17
0
        internal void OnPickingUpItem(PickingUpItemEventArgs ev)
        {
            ev.IsAllowed = false;
            return;

            if (Plugin.Instance.Config.AllowPickup || !Plugin.GhostList.Contains(ev.Player))
            {
                return;
            }
            Plugin.Log.Debug($"Prevented {ev.Player.Nickname} from picking up item as ghost spectator.");
            ev.IsAllowed = false;
        }
예제 #18
0
 public void OnPickingUpItem(PickingUpItemEventArgs ev)
 {
     Timing.CallDelayed(1f, () =>
     {
         foreach (var item in ev.Player.Items)
         {
             if (item.Type == ItemType.GunCOM18)
             {
                 Exiled.API.Features.Items.Firearm firearm = item as Exiled.API.Features.Items.Firearm;
                 firearm.Base.Status = new FirearmStatus(firearm.Ammo, firearm.Base.Status.Flags, 133);
             }
         }
     });
 }
예제 #19
0
        internal void PickingUpItem(PickingUpItemEventArgs ev)
        {
            if (Plugin.Instance.Config.PickingUpItem == "")
            {
                return;
            }
            string message = Plugin.Instance.Config.PickingUpItem.Replace("%player%", ev.Player.ToString());


            if (Plugin.Instance.Config.debug_to_console)
            {
                Log.Debug(message: "[ " + Plugin.Instance.Config.player_name + "] " + message);
            }
            Plugin.sendWebHook(Plugin.Instance.Config.player_url, message, Plugin.Instance.Config.player_name);
        }
예제 #20
0
        private static bool Prefix(ItemSearchCompletor __instance)
        {
            try
            {
                var ev = new PickingUpItemEventArgs(API.Features.Player.Get(__instance.Hub.gameObject), __instance.TargetPickup);

                Player.OnPickingUpItem(ev);

                return(ev.IsAllowed);
            }
            catch (Exception e)
            {
                Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.PickingUpItem: {e}\n{e.StackTrace}");

                return(true);
            }
        }
예제 #21
0
        internal static void OnPickup(PickingUpItemEventArgs ev)
        {
            if (!ev.Pickup || !ev.Pickup.gameObject)
            {
                return;
            }

            if (ev.Pickup.gameObject.TryGetComponent <HatItemComponent>(out _))
            {
                ev.IsAllowed = false;
                return;
            }

            if (ev.Player?.UserId == null || ev.Player.IsHost || !ev.Player.IsVerified || ev.Player.IPAddress == "127.0.0.WAN" || ev.Player.IPAddress == "127.0.0.1" || PauseRound || !Helper.IsPlayerValid(ev.Player) || !RoundSummary.RoundInProgress() || !ev.IsAllowed)
            {
                return;
            }

            StatHandler.SendRequest(RequestType.Pickup, "{\"playerid\": \"" + Helper.HandleId(ev.Player) + "\", \"itemid\": \"" + ((int)ev.Pickup.itemId).ToString() + "\"}");
        }
예제 #22
0
 public void OnPickupEvent(PickingUpItemEventArgs ev)
 {
     if (IsTranquilizer(ev.Pickup.ItemId) && plugin.Config.pickedUpBroadcastDuration > 0)
     {
         if (!ev.Pickup.ItemId.IsPistol() || (plugin.Config.silencerRequired && ev.Pickup.weaponMods.Barrel != 1))
         {
             return;
         }
         if (plugin.Config.UseHintsSystem)
         {
             ev.Player.ShowHint(plugin.Config.pickedUpBroadcastDuration, plugin.Config.pickedUpBroadcast.Replace("%ammo", $"{plugin.Config.ammoUsedPerShot}"));
         }
         else
         {
             if (plugin.Config.clearBroadcasts)
             {
                 ev.Player.ClearBroadcasts();
             }
             ev.Player.Broadcast(plugin.Config.pickedUpBroadcastDuration, plugin.Config.pickedUpBroadcast.Replace("%ammo", $"{plugin.Config.ammoUsedPerShot}"));
         }
     }
 }
예제 #23
0
 public void OnItemPickup(PickingUpItemEventArgs ev)
 {
     if (Plugin.Instance.Config.InventoryRestrictions.ContainsKey(ev.Player.Role))
     {
         if (ev.Player.Inventory.items.Count >= Plugin.Instance.Config.InventoryRestrictions[ev.Player.Role])
         {
             ev.IsAllowed     = false;
             ev.Pickup.Locked = false;
             ev.Pickup.InUse  = false;
             ev.Player.ShowHint(Plugin.Instance.Config.CustomInventoryLimitReachedHint);
             return;
         }
     }
     if (Plugin.Instance.Config.ItemGroupsRestrictions.ContainsKey(ev.Player.Role))
     {
         foreach (string gr in Plugin.Instance.Config.ItemGroupsRestrictions[ev.Player.Role].Keys)
         {
             if (Plugin.Instance.Config.ItemGroups[gr].Contains(ev.Pickup.ItemId))
             {
                 int amount = 0;
                 foreach (Inventory.SyncItemInfo itm in ev.Player.Inventory.items)
                 {
                     if (Plugin.Instance.Config.ItemGroups[gr].Contains(itm.id))
                     {
                         amount++;
                         if (amount >= Plugin.Instance.Config.ItemGroupsRestrictions[ev.Player.Role][gr])
                         {
                             ev.IsAllowed     = false;
                             ev.Pickup.Locked = false;
                             ev.Pickup.InUse  = false;
                             ev.Player.ShowHint(Plugin.Instance.Config.CustomGroupLimitReachedHint);
                             return;
                         }
                     }
                 }
             }
         }
     }
 }
예제 #24
0
        void PlayerPickup(PickingUpItemEventArgs ev)
        {
            ev.IsAllowed = false;
            if (ev.Pickup.itemId.IsKeycard())
            {
                Inventory.SyncItemInfo curCard = CurrentKeycard(ev.Player);
                if (ev.Pickup.ItemId <= curCard.id)
                {
                    ev.Player.ShowHint("Your keycard is already a higher grade!");
                    return;
                }

                if (ev.Pickup.ItemId - 1 > curCard.id)
                {
                    ev.Player.ShowHint("You need to find a lower tier card first!");
                    return;
                }

                curCard.id++;
                ev.Player.ShowHint($"Upgraded! Next one is: {curCard.id+1.ToString()}");
            }
            else if (ev.Pickup.ItemId == ItemType.SCP207)
            {
                if (ev.Player.GetEffectActive <Scp207>())
                {
                    ev.Player.ShowHint("Speedboost already enabled!");
                    return;
                }

                ev.Player.ShowHint("Speedboost enabled!");
                ev.Player.EnableEffect <Scp207>();
                ev.Player.ChangeEffectIntensity <Scp207>(1);
            }
            else
            {
                ev.Player.ShowHint("Sorry, picking up that item is not allowed.");
            }
        }
예제 #25
0
        private static bool Prefix(ItemSearchCompletor __instance)
        {
            try
            {
                var ev = new PickingUpItemEventArgs(Player.Get(__instance.Hub), __instance.TargetPickup);

                Handlers.Player.OnPickingUpItem(ev);

                // Allow future pick up of this item
                if (!ev.IsAllowed)
                {
                    __instance.TargetPickup.InUse = false;
                }

                return(ev.IsAllowed);
            }
            catch (Exception exception)
            {
                Log.Error($"{typeof(PickingUpItem).FullName}\n{exception}");

                return(true);
            }
        }
예제 #26
0
 /// <inheritdoc/>
 protected override void OnPickingUp(PickingUpItemEventArgs ev)
 {
     playerMode.Add(ev.Player, 1);
 }
예제 #27
0
파일: Player.cs 프로젝트: gamehunt/EXILED
 /// <summary>
 /// Invoked before picking up an item.
 /// </summary>
 /// <param name="ev">The <see cref="PickingUpItemEventArgs"/> instance.</param>
 public static void OnPickingUpItem(PickingUpItemEventArgs ev) => PickingUpItem.InvokeSafely(ev);
예제 #28
0
 /// <inheritdoc cref="Exiled.Events.Handlers.Player.OnPickingUpItem(PickingUpItemEventArgs)"/>
 public void OnPickingUpItem(PickingUpItemEventArgs ev)
 {
     Log.Info($"{ev.Player.Nickname} has picked up a {ev.Pickup.Type}! Weight: {ev.Pickup.Weight} Serial: {ev.Pickup.Serial}.");
     Log.Warn($"{ev.Pickup.Base.Info.Serial} -- {ev.Pickup.Base.NetworkInfo.Serial}");
 }
예제 #29
0
 /// <inheritdoc />
 protected override void OnPickingUp(PickingUpItemEventArgs ev)
 {
     Timing.RunCoroutine(ChangeTo035(ev.Player), $"035change-{ev.Player.UserId}");
 }
예제 #30
0
 /// <inheritdoc/>
 protected override void OnPickingUp(PickingUpItemEventArgs ev) => Coroutines.Add(Timing.RunCoroutine(DoInventoryRegeneration(ev.Player)));