Пример #1
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     /// <summary>
     /// This is called when a player drops up an item.
     /// </summary>
     plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onplayerdropitem"), ev.Player.Name + " (" + ev.Player.SteamId + plugin.MultiLanguage(28) + ev.Item + ".");
 }
Пример #2
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     if ((ev.Player.TeamRole.Role == Role.NTF_LIEUTENANT) && (ev.Item.ItemType == ItemType.WEAPON_MANAGER_TABLET))
     {
         if (NTFlic4.ContainsKey(ev.Player.SteamId))
         {
             if (NTFlic4[ev.Player.SteamId])
             {
                 GrenadeManager grenadeManager = ((GameObject)ev.Player.GetGameObject()).GetComponent <GrenadeManager>();
                 foreach (GrenadeSettings grenade in grenadeManager.availableGrenades)
                 {
                     grenade.timeUnitilDetonation = 0.2f;
                 }
                 int p = (int)System.Environment.OSVersion.Platform;
                 if ((p == 4) || (p == 6) || (p == 128))
                 {
                     MEC.Timing.RunCoroutine(C4s(ev.Player), MEC.Segment.FixedUpdate);
                 }
                 else
                 {
                     MEC.Timing.RunCoroutine(C4s(ev.Player), 1);
                 }
             }
         }
     }
 }
Пример #3
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     if (hunters.Exists(x => x.PlayerId == ev.Player.PlayerId))
     {
         ev.Item.Remove();
     }
 }
Пример #4
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     if (ev.Item.ItemType != ItemType.MEDKIT)
     {
         ev.ChangeTo = ItemType.NULL;
     }
 }
Пример #5
0
        public void OnPlayerDropItem(PlayerDropItemEvent ev)
        {
            if (CheckSteamIDItemNum.ContainsKey(ev.Player.SteamId))
            {
                if (CheckSteamIDItemNum[ev.Player.SteamId].GetItemAmount((int)ev.Item.ItemType) >= 1)
                {
                    CheckSteamIDItemNum[ev.Player.SteamId].AddItemAmount((int)ev.Item.ItemType, -1);

                    int ItemAmount = CheckSteamIDItemNum[ev.Player.SteamId].GetItemAmount((int)ev.Item.ItemType);

                    if (ItemAmount % stackManager.GetStackSize((int)ev.Item.ItemType) == 0)
                    {
                        ev.Allow = true;
                    }
                    else
                    {
                        Smod2.PluginManager.Manager.Server.Map.SpawnItem(ev.Item.ItemType, ev.Player.GetPosition(), new Vector(0, 0, 0));
                        ev.Allow = false;
                    }
                }
            }
            else
            {
                CheckSteamIDItemNum[ev.Player.SteamId] = new UserStackData();
            }
        }
Пример #6
0
        public void OnPlayerDropItem(PlayerDropItemEvent ev)
        {
            //Class D - [Sigilo de doble filo]//
            if ((ev.Player.TeamRole.Role == Role.CLASSD) && (Classdh[ev.Player.SteamId] == true) && (ev.Item.ItemType == ItemType.FLASHLIGHT))
            {
                ev.ChangeTo = ItemType.NULL;
                if (ev.Player.GetHealth() < 35)
                {
                    ev.Player.Kill(DamageType.FALLDOWN);
                }

                if (ev.Player.GetHealth() >= 35)
                {
                    Classdh[ev.Player.SteamId] = false;
                    ev.Player.AddHealth(-35);
                    int p = (int)System.Environment.OSVersion.Platform;
                    if ((p == 4) || (p == 6) || (p == 128))
                    {
                        MEC.Timing.RunCoroutine(Classd(ev.Player), MEC.Segment.FixedUpdate);
                    }
                    else
                    {
                        MEC.Timing.RunCoroutine(Classd(ev.Player), 1);
                    }
                }
            }

            if ((ev.Player.TeamRole.Role == Role.CHAOS_INSURGENCY))
            {
                if ((Classdh.ContainsKey(ev.Player.SteamId)))
                {
                    if ((Classdh[ev.Player.SteamId] == true) && (ev.Item.ItemType == ItemType.FLASHLIGHT))
                    {
                        ev.ChangeTo = ItemType.NULL;
                        if (ev.Player.GetHealth() <= 20)
                        {
                            ev.Player.Kill(DamageType.FALLDOWN);
                        }


                        if (ev.Player.GetHealth() > 20)

                        {
                            Classdh[ev.Player.SteamId] = false;
                            ev.Player.AddHealth(-20);
                            int p = (int)System.Environment.OSVersion.Platform;
                            if ((p == 4) || (p == 6) || (p == 128))
                            {
                                MEC.Timing.RunCoroutine(Classd(ev.Player), MEC.Segment.FixedUpdate);
                            }
                            else
                            {
                                MEC.Timing.RunCoroutine(Classd(ev.Player), 1);
                            }
                        }
                    }
                }
            }
        }
Пример #7
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     Timing.Run(Granandat(ev.Player));
     if ((Jugadoresh[ev.Player.SteamId] >= 2) && (ev.Item.ItemType == ItemType.COIN))
     {
         Timing.Run(Bombatemp(ev.Player, ev.Item.GetPosition()));
     }
 }
Пример #8
0
 void IEventHandlerPlayerDropItem.OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     send(ev, new IdMapping()
          .appendId(Lib.PLAYER_ID, ev.Player)
          .appendId(Lib.PLAYER_EVENT_SCPDATA_ID, ev.Player.Scp079Data)
          .appendId(Lib.PLAYER_EVENT_TEAM_ROLE_ID, ev.Player.TeamRole)
          .appendId(Lib.ITEM_EVENT_ID, ev.Item)
          );
 }
Пример #9
0
 void IEventHandlerPlayerDropItem.OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     if (!waiting || events.ContainsKey(ev.Player.SteamId) || eMan.forceEvent)
     {
         return;
     }
     if (eMan.use_config_files)
     {
         if (items.ContainsKey(ev.Item.ItemType) && eMan.Server.NumPlayers >= eMan.minPlayers)
         {
             ev.Allow = false;
             GameObject.FindObjectOfType <Broadcast>().CallTargetAddElement(((GameObject)ev.Player.GetGameObject()).GetComponent <NetworkIdentity>().connectionToClient, "Set vote as: " + cache[items[ev.Item.ItemType]].name + "!", 4, false);
             ((GameObject)ev.Player.GetGameObject()).GetComponent <Inventory>().ServerDropAll();
             events.Add(ev.Player.SteamId, items[ev.Item.ItemType]);
             //CalcEvent();
         }
         else
         {
             ev.Allow = false;
             //CalcEvent();
             ((GameObject)ev.Player.GetGameObject()).GetComponent <Inventory>().ServerDropAll();
             foreach (var item in items)
             {
                 ev.Player.GiveItem(item.Key);
             }
             GameObject.FindObjectOfType <Broadcast>().CallTargetAddElement(((GameObject)ev.Player.GetGameObject()).GetComponent <NetworkIdentity>().connectionToClient, "Error registering vote: Probably not enough players.", 4, false);
         }
     }
     else
     {
         if (items.ContainsKey(ev.Item.ItemType) && eMan.Server.NumPlayers >= eMan.minPlayers)
         {
             ev.Allow = false;
             GameObject.FindObjectOfType <Broadcast>().CallTargetAddElement(((GameObject)ev.Player.GetGameObject()).GetComponent <NetworkIdentity>().connectionToClient, "Set vote as: " + PluginManager.Manager.GetPlugin(items[ev.Item.ItemType]).Details.name + "!", 4, false);
             ((GameObject)ev.Player.GetGameObject()).GetComponent <Inventory>().ServerDropAll();
             try
             {
                 events.Add(ev.Player.SteamId, items[ev.Item.ItemType]);
             }
             catch (ArgumentException e)
             {
             }
             //CalcEvent();
         }
         else
         {
             ev.Allow = false;
             //CalcEvent();
             ((GameObject)ev.Player.GetGameObject()).GetComponent <Inventory>().ServerDropAll();
             foreach (var item in items)
             {
                 ev.Player.GiveItem(item.Key);
             }
             GameObject.FindObjectOfType <Broadcast>().CallTargetAddElement(((GameObject)ev.Player.GetGameObject()).GetComponent <NetworkIdentity>().connectionToClient, "Error registering vote: Probably not enough players.", 4, false);
         }
     }
 }
        public void OnPlayerDropItem(PlayerDropItemEvent e)
        {
            var @event = new DroppingItemEventArgs(Player.Get(e.Player.gameObject), e.Item);

            Handlers.Player.OnDroppingItem(@event);
            if ([email protected])
            {
                e.Cancelled = true;
            }
        }
Пример #11
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     if ((Cambiaform.ContainsKey(ev.Player.PlayerId)) && (ev.Item.ItemType == ItemType.COIN))
     {
         ev.ChangeTo = ItemType.NULL;
         if (!ev.Player.HasItem(ItemType.RADIO))
         {
             ev.Player.GiveItem(ItemType.RADIO);
         }
         Timing.Run(MVP2(ev.Player, ev.Player.GetPosition()));
     }
 }
Пример #12
0
        /*public void OnHandcuffed(PlayerHandcuffedEvent ev) // THIS EVENT IS CURRENTLY BROKEN
         * {
         *      //plugin.Info("onhandcuffed");
         *      if (plugin.GetConfigBool("spycup_enabled"))
         *      {
         *              //plugin.Info("spycup enabled");
         *              //plugin.Info("if " + ev.Player.TeamRole.Team.ToString() + " is team ninetailed and " + ev.Player.SteamId);
         *              //foreach (KeyValuePair<string, Role> entry in sc.RoleDict)
         *              //{
         *              //    plugin.Info(entry.Key.ToString());
         *              //}
         *              if (ev.Player.TeamRole.Team.Equals(Team.NINETAILFOX) && sc.RoleDict.ContainsKey(ev.Player.SteamId))
         *              {
         *                      ChangeSpyRole(Team.NINETAILFOX, ev.Player);
         *              }
         *      }
         * }*/

        public void OnPlayerDropItem(PlayerDropItemEvent ev)
        {
            if (plugin.GetConfigBool("spycup_enabled"))
            {
                if (ev.Item.ItemType.Equals(ItemType.CUP))
                {
                    if (ev.Player.TeamRole.Team.Equals(Smod2.API.Team.NINETAILFOX))
                    {
                        ChangeSpyRole(Smod2.API.Team.NINETAILFOX, ev.Player);
                    }
                    else if (ev.Player.TeamRole.Team.Equals(Smod2.API.Team.CHAOS_INSURGENCY))
                    {
                        ChangeSpyRole(Smod2.API.Team.CHAOS_INSURGENCY, ev.Player);
                    }
                }
            }
        }
Пример #13
0
        public void OnPlayerDropItem(PlayerDropItemEvent ev)
        {
            if (ev.Player.TeamRole.Role == Role.TUTORIAL && ev.Item.ItemType == ItemType.COIN)
            {
                List <Player> list = (from item in plugin.pluginManager.Server.GetPlayers()
                                      where (item.PlayerId != ev.Player.PlayerId && item.TeamRole.Role != Role.TUTORIAL && item.TeamRole.Role != Role.SPECTATOR) && !item.OverwatchMode
                                      select item).ToList();

                if (list.Count > 0)
                {
                    Random random = new Random();
                    ev.Player.Teleport(list[random.Next(0, list.Count)].GetPosition());
                }

                ev.ChangeTo = ItemType.NULL;
                ev.Player.GiveItem(ItemType.COIN);
            }
        }
Пример #14
0
        public void OnPlayerDropItem(PlayerDropItemEvent ev)
        {
            /// <summary>
            /// This is called when a player drops up an item.
            /// </summary>
            Dictionary <string, string> variables = new Dictionary <string, string>
            {
                { "item", ev.Item.ToString() },
                { "ipaddress", ev.Player.IpAddress },
                { "name", ev.Player.Name },
                { "playerid", ev.Player.PlayerId.ToString() },
                { "steamid", ev.Player.SteamId },
                { "class", ev.Player.TeamRole.Role.ToString() },
                { "team", ev.Player.TeamRole.Team.ToString() }
            };

            plugin.SendMessage(Config.GetArray("channels.onplayerdropitem"), "player.onplayerdropitem", variables);
        }
Пример #15
0
        internal void InvokePlayerDropItemPatch(Player player, Items.SynapseItem item, out bool allow)
        {
            allow = true;
            if (PlayerDropItemEvent == null)
            {
                return;
            }

            var ev = new PlayerDropItemEventArgs
            {
                Player = player,
                Item   = item,
                Allow  = true,
            };

            PlayerDropItemEvent.Invoke(ev);

            allow = ev.Allow;
        }
Пример #16
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     if (!isQueue)
     {
         return;
     }
     try
     {
         Alives vc = alives.Find(x => x.Player.UserId == ev.Player.UserId);
         if (vc.IsMenuOpen)
         {
             ev.Item.Remove();
         }
     }
     catch
     {
         PluginHandler.Shared.Error("[TTT] Menu item remove failed!");
     }
 }
Пример #17
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     //Scientistsssssss [Café mañanero]//
     if ((ev.Player.TeamRole.Role == Role.SCIENTIST) && (Scientisth[ev.Player.SteamId]) && (ev.Item.ItemType == ItemType.CUP))
     {
         Scientisth[ev.Player.SteamId] = false;
         if (ev.Player.GetHealth() <= 100)
         {
             ev.Player.AddHealth(25);
         }
         int p = (int)System.Environment.OSVersion.Platform;
         if ((p == 4) || (p == 6) || (p == 128))
         {
             MEC.Timing.RunCoroutine(ScientistTimer(ev.Player), MEC.Segment.FixedUpdate);
         }
         else
         {
             MEC.Timing.RunCoroutine(ScientistTimer(ev.Player), 1);
         }
     }
 }
Пример #18
0
        private static void Inventory_CallCmdDropItem(On.Inventory.orig_CallCmdDropItem orig, Inventory self, int itemInventoryIndex)
        {
            var evnt = new PlayerDropItemEvent(new LabPlayer(self.gameObject), new LabItem(self.items[itemInventoryIndex]), (Smod2.API.ItemType)self.items[itemInventoryIndex].id, true);

            EventManager.Manager.HandleEvent <IEventHandlerPlayerDropItem>(evnt);
            if (evnt.Allow)
            {
                if (evnt.ChangeTo != (Smod2.API.ItemType)self.items[itemInventoryIndex].id)
                {
                    self.items.RemoveAt(itemInventoryIndex);
                    self.items.Add(new Inventory.SyncItemInfo()
                    {
                        id = (ItemType)evnt.ChangeTo
                    });
                    orig(self, self.items.Count - 1);
                }
                else
                {
                    orig(self, itemInventoryIndex);
                }
            }
        }
Пример #19
0
        public void OnPlayerDropItem(PlayerDropItemEvent ev)
        {
            if (ev.Item.ItemType == Smod2.API.ItemType.CUP)
            {
                if (playerSteamId.Contains(ev.Player.SteamId))
                {
                    playerSteamId.Remove(ev.Player.SteamId);

                    plugin.Info($"Player {ev.Player.Name} (rank {ev.Player.GetRankName()}) has been removed from the blessing of the Cup God.");

                    ev.Player.SendConsoleMessage("Your blessing of the Cup God has been revoked.");

                    CupGod.CupGods = 0;

                    ev.Player.SetRank(playerColor, playerRank);
                }
                else if (CupGod.CupGods == 0 && !playerSteamId.Contains(ev.Player.SteamId))
                {
                    playerSteamId.Add(ev.Player.SteamId);

                    plugin.Info($"Player {ev.Player.Name} (rank {ev.Player.GetRankName()}) has been added to the blessing of the Cup God");

                    ev.Player.SendConsoleMessage("You have been granted the blessing of the Cup God.");

                    CupGod.CupGods++;

                    playerRank  = ev.Player.GetUserGroup().Name;
                    playerColor = ev.Player.GetUserGroup().Color;

                    ev.Player.SetRank("blue_green", "Blessing of the Cup God");
                }
                else if (CupGod.CupGods > 0 && !playerSteamId.Contains(ev.Player.SteamId))
                {
                    plugin.Info($"Player {ev.Player.Name} (rank {ev.Player.GetRankName()}) tried to obtain the blessing but someone beat them to it.");

                    ev.Player.SendConsoleMessage($"I am sorry, but {playerSteamId.First()} is already Cup God.");
                }
            }
        }
Пример #20
0
        public void OnPlayerDropItem(PlayerDropItemEvent ev)
        {
            System.Random objeto   = new System.Random();
            int           evento1b = objeto.Next(0, 30);

            if ((evento1b == 0) || (evento1b == 1))
            {
                ev.Allow = false;
            }
            if (evento1b == 2)
            {
                ev.ChangeTo = ItemType.NULL;
            }
            if (evento1b == 3)
            {
                ev.ChangeTo = ItemType.MTF_LIEUTENANT_KEYCARD;
            }
            if (evento1b == 4)
            {
                ev.ChangeTo = ItemType.MTF_COMMANDER_KEYCARD;
            }
            if (evento1b == 5)
            {
                ev.ChangeTo = ItemType.MP7;
            }
            if (evento1b == 6)
            {
                ev.ChangeTo = ItemType.MICROHID;
            }
            if (evento1b == 7)
            {
                ev.ChangeTo = ItemType.MEDKIT;
            }
            if (evento1b == 8)
            {
                ev.ChangeTo = ItemType.MAJOR_SCIENTIST_KEYCARD;
            }
            if (evento1b == 9)
            {
                ev.ChangeTo = ItemType.LOGICER;
            }
            if (evento1b == 10)
            {
                ev.ChangeTo = ItemType.JANITOR_KEYCARD;
            }
            if (evento1b == 11)
            {
                ev.ChangeTo = ItemType.GUARD_KEYCARD;
            }
            if (evento1b == 12)
            {
                ev.ChangeTo = ItemType.FRAG_GRENADE;
            }
            if (evento1b == 13)
            {
                ev.ChangeTo = ItemType.FLASHLIGHT;
            }
            if (evento1b == 14)
            {
                ev.ChangeTo = ItemType.FLASHBANG;
            }
            if (evento1b == 15)
            {
                ev.ChangeTo = ItemType.FACILITY_MANAGER_KEYCARD;
            }
            if (evento1b == 16)
            {
                ev.ChangeTo = ItemType.E11_STANDARD_RIFLE;
            }
            if (evento1b == 17)
            {
                ev.ChangeTo = ItemType.DISARMER;
            }
            if (evento1b == 18)
            {
                ev.ChangeTo = ItemType.CONTAINMENT_ENGINEER_KEYCARD;
            }
            if (evento1b == 19)
            {
                ev.ChangeTo = ItemType.COM15;
            }
            if (evento1b == 20)
            {
                ev.ChangeTo = ItemType.CHAOS_INSURGENCY_DEVICE;
            }
            if (evento1b == 21)
            {
                ev.ChangeTo = ItemType.COIN;
            }
            if (evento1b == 22)
            {
                ev.ChangeTo = ItemType.ZONE_MANAGER_KEYCARD;
            }
            if (evento1b == 23)
            {
                ev.ChangeTo = ItemType.WEAPON_MANAGER_TABLET;
            }
            if (evento1b == 24)
            {
                ev.ChangeTo = ItemType.USP;
            }
            if (evento1b == 25)
            {
                ev.ChangeTo = ItemType.SENIOR_GUARD_KEYCARD;
            }
            if (evento1b == 26)
            {
                ev.ChangeTo = ItemType.SCIENTIST_KEYCARD;
            }
            if (evento1b == 27)
            {
                ev.ChangeTo = ItemType.RADIO;
            }
            if (evento1b == 28)
            {
                ev.ChangeTo = ItemType.P90;
            }
            if (evento1b == 29)
            {
                ev.ChangeTo = ItemType.O5_LEVEL_KEYCARD;
            }
            if (evento1b == 30)
            {
                ev.Player.Kill(DamageType.POCKET);
            }
        }
Пример #21
0
 public void OnPlayerDropItem(PlayerDropItemEvent ev)
 {
     plugin.luaHookCall.Function.Call("OnPlayerDropItem", ev.Player, ev.Item, ev.Allow, ev.ChangeTo);
 }