Exemplo n.º 1
0
        void OnPlayerLoot(PlayerLoot lootInventory, UnityEngine.Object entry)
        {
            BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer;

            if (looters.ContainsKey(looter))
            {
                looters.Remove(looter);
            }

            if (entry is BasePlayer)
            {
                BasePlayer target = entry as BasePlayer;
                if (target.IsAlive() && !target.IsSleeping())
                {
                    looter.ChatMessage("Finish him before loot!");
                    looter.SendConsoleCommand("inventory.endloot");
                    looter.UpdateNetworkGroup();
                    looter.SendFullSnapshot();
                }
                else if (target.IsSleeping())
                {
                    looters.Add(looter, target.userID.ToString());
                }
            }
        }
 void OnPlayerLoot(PlayerLoot lootInventory, UnityEngine.Object entry)
 {
     if (entry is BasePlayer)
     {
         BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer;
         BasePlayer target = entry as BasePlayer;
         if (target == null || looter == null)
         {
             return;
         }
         string userID = target.userID.ToString();
         if (protData.ContainsKey(userID))
         {
             timer.Once(0.01f, () =>
             {
                 looter.EndLooting();
                 looter.StartSleeping();
             });
             timer.Once(0.2f, () =>
             {
                 looter.EndSleeping();
             });
             looter.ChatMessage(APHelper["LootAlert"]);
         }
     }
 }
Exemplo n.º 3
0
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            BasePlayer player = inventory.GetComponent <BasePlayer>();

            if (boxCreators.ContainsKey(player.userID))
            {
                StoreBoxData(player);
                boxCreators.Remove(player.userID);
            }
            if (inventory.entitySource != null)
            {
                var box = inventory.entitySource;
                if (boxCache.ContainsKey(box))
                {
                    if (box is LootContainer)
                    {
                        return;
                    }
                    if (box is StorageContainer)
                    {
                        if ((box as StorageContainer).inventory.itemList.Count == 0)
                        {
                            box.KillMessage();
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void OnPlayerLootEnd(PlayerLoot inventory)
        {
            BasePlayer player = inventory.GetComponent <BasePlayer>();

            if (bountyCreator.ContainsKey(player.userID))
            {
                StorageContainer container = inventory.entitySource.GetComponent <StorageContainer>();
                if (container != null)
                {
                    if (container.inventory.itemList.Count == 0)
                    {
                        SendReply(player, msg("no_items_deposited", player.userID));
                    }
                    else
                    {
                        CreateNewBounty(player, bountyCreator[player.userID], 0, 0, container.inventory);
                    }

                    openContainers.Remove(container);
                    ClearContainer(container.inventory);
                    container.DieInstantly();
                }
                bountyCreator.Remove(player.userID);
            }
        }
Exemplo n.º 5
0
        private void IOnLootPlayer(PlayerLoot source, BaseEntity target)
        {
            // Call hook
            Interface.CallHook("OnLootPlayer", source.GetComponent <BasePlayer>(), target);

            // Call depreated hook
            Interface.CallDeprecatedHook("OnPlayerLoot", source, target);
        }
Exemplo n.º 6
0
        private void IOnLootItem(PlayerLoot source, Item item)
        {
            // Call hook
            Interface.CallHook("OnLootItem", source.GetComponent <BasePlayer>(), item);

            // Call depreated hook
            Interface.CallDeprecatedHook("OnPlayerLoot", source, item);
        }
        private void OnPlayerLootEnd(PlayerLoot inventory)
        {
            var player = inventory.GetComponent <BasePlayer>();

            CuiHelper.DestroyUi(player, "BoxUIHeader");
            CuiHelper.DestroyUi(player, "BoxUIContent");
            CuiHelper.DestroyUi(player, "BoxUISort");
        }
Exemplo n.º 8
0
 void OnLootPlayer(PlayerLoot lootInventory, BasePlayer targetPlayer)
 {
     if (hasTag(targetPlayer, "noplayerloot"))
     {
         BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer;
         timer.Once(0.01f, () => looter.EndLooting());
     }
 }
Exemplo n.º 9
0
        private void IOnLootEntity(PlayerLoot source, BaseEntity entity)
        {
            // Call hook
            Interface.CallHook("OnLootEntity", source.GetComponent <BasePlayer>(), entity);

            // Call depreated hook
            Interface.CallDeprecatedHook("OnPlayerLoot", source, entity);
        }
Exemplo n.º 10
0
        private void IOnLootPlayer(PlayerLoot source, BasePlayer target)
        {
            // Call hook
            Interface.CallHook("OnLootPlayer", source.GetComponent <BasePlayer>(), target);

            // Call depreated hook
            Interface.CallDeprecatedHook("OnPlayerLoot", "OnLootPlayer", new DateTime(2016, 6, 3), source, target);
        }
Exemplo n.º 11
0
        private void OnPlayerLootEnd(PlayerLoot inventory)
        {
            BasePlayer player = inventory.GetComponent <BasePlayer>();

            if (player != null)
            {
                DestroyUi(player);
            }
        }
Exemplo n.º 12
0
        /////////////////////////////////////////
        // OnPlayerLoot(PlayerLoot lootInventory,  BasePlayer targetPlayer)
        // Called when a player tries to loot another player
        /////////////////////////////////////////
        void OnPlayerLoot(PlayerLoot lootInventory, object target)
        {
            BasePlayer targetPlayer = target as BasePlayer;

            if (targetPlayer != null)
            {
                OnLootPlayer(lootInventory, targetPlayer); return;
            }
            OnLootBox(lootInventory.GetComponent("BasePlayer") as BasePlayer, target);
        }
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            var player = inventory.GetComponent <BasePlayer>();

            if (player == null)
            {
                return;
            }
            LiftTracker.HandlePlayerLootEnd(player);
            UIManager.DestroyPlayerUI(player);
        }
Exemplo n.º 14
0
        // TODO: Inventory hook.
        // Figure out how to check if a player has their main inventory open, so we can do Looters.Add(player.userID) & GUIDestroy(player);

        private void OnPlayerLootEnd(PlayerLoot inventory)
        {
            if (Economics)
            {
                BasePlayer player = inventory.GetComponent <BasePlayer>();
                if (player != null && Looters.Contains(player.userID))
                {
                    Looters.Remove(player.userID);
                    GUICreate(player);
                }
            }
        }
Exemplo n.º 15
0
        // PlayerLoot.StartLootingPlayer()
        public static void StartLootingPlayer(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent <BasePlayer>();
            var        ple    = new Events.PlayerLootEvent(playerLoot, Server.GetPlayer(looter), Server.GetPlayer(playerLoot.entitySource as BasePlayer));

            OnLootingPlayer.OnNext(ple);

            if (ple.Cancel)
            {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ple.cancelReason));
            }
        }
Exemplo n.º 16
0
        // PlayerLoot.StartLootingItem()
        public static void On_LootingItem(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent <BasePlayer>();
            var        ile    = new Events.ItemLootEvent(playerLoot, Server.GetPlayer(looter), playerLoot.itemSource);

            OnNext("On_LootingItem", ile);

            if (ile.Cancel)
            {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ile.cancelReason));
            }
        }
Exemplo n.º 17
0
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            var player = inventory.GetComponent <BasePlayer>();

            if (player == null)
            {
                return;
            }

            if (player.IsAdmin || PermissionService.HasPermission(player.userID, permAccess))
            {
                DestroyUI(player);
            }
        }
Exemplo n.º 18
0
        void OnPlayerLoot(PlayerLoot lootInventory, object lootable)
        {
            var looter = lootInventory.GetComponent <BasePlayer>();

            if (looter == null)
            {
                return;
            }

            BaseEntity container = lootable as BaseEntity;

            if (container == null)
            {
                return;
            }
            if (container.LookupShortPrefabName() != "box.wooden.large.prefab")
            {
                return;
            }

            string command = GetActiveCommand(looter);

            if (command == null)
            {
                var currentTradeList = GetActiveList(container);

                if (currentTradeList == "recycling")
                {
                    looter.ChatMessage("You found a <color=yellow>Moegic Recycling Box!</color>!");
                }
                else if (currentTradeList != null)
                {
                    var list = GetList(currentTradeList);
                    looter.ChatMessage("You found a <color=yellow>Moegic Tradebox</color>!" + list.ToString());
                }
                return;
            }

            var sb = new StringBuilder();

            ClearActiveCommand(looter);
            sb.Append($"<color=yellow>{command}</color> mode is now <color=red>OFF</color>");
            looter.ChatMessage(sb.ToString());

            RunCommand(looter, command, container);
        }
Exemplo n.º 19
0
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            BasePlayer player;

            if ((player = inventory.GetComponent <BasePlayer> ()) == null)
            {
                return;
            }

            if (onlinePlayers.ContainsKey(player) && onlinePlayers [player].View != null)
            {
                if (onlinePlayers [player].View == inventory.entitySource)
                {
                    CloseBank(player, (StorageContainer)inventory.entitySource);
                }
            }
        }
Exemplo n.º 20
0
        void OnPlayerLoot(PlayerLoot lootInventory, UnityEngine.Object targetObject)
        {
            var player = lootInventory.GetComponent <BasePlayer>();
            var target = targetObject as BasePlayer;

            if (!target)
            {
                return;
            }
            if (gods[target.userID] != null)
            {
                NextTick(() =>
                {
                    player.EndLooting();
                    SendChatMessage(player, noGodLoot);
                });
            }
        }
Exemplo n.º 21
0
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            BasePlayer player;

            if ((player = inventory.GetComponent <BasePlayer> ()) == null)
            {
                return;
            }

            OnlinePlayer onlinePlayer;

            if (onlinePlayers.TryGetValue(player, out onlinePlayer) && onlinePlayer.View != null)
            {
                if (onlinePlayer.View == inventory.entitySource)
                {
                    CloseBoxView(player, (StorageContainer)inventory.entitySource);
                }
            }
        }
Exemplo n.º 22
0
 private void OnPlayerLoot(PlayerLoot lootInventory, BaseEntity targetEntity)
 {
     if ((bool)setting["IsEnabled"])
     {
         if (targetEntity is BasePlayer)
         {
             BasePlayer targetPlayer = (BasePlayer)targetEntity;
             if (!(bool)setting["SleepLoot"] && targetPlayer.HasFlag(BaseEntity.Flags.Locked))
             {
                 BasePlayer player = lootInventory.GetComponent <BasePlayer>();
                 player.ChatMessage(message["DoNotLoot"]);
                 NextTick(() =>
                 {
                     player.EndLooting();
                 });
             }
         }
     }
 }
Exemplo n.º 23
0
        void OnPlayerLoot(PlayerLoot lootInventory, object lootable)
        {
            var looter = lootInventory.GetComponent("BasePlayer") as BasePlayer;

            if (looter == null)
            {
                return;
            }

            BaseEntity container = lootable as BaseEntity;

            if (container == null)
            {
                return;
            }
            if (container.LookupShortPrefabName() != "repairbench_deployed.prefab")
            {
                return;
            }

            string command = GetActiveCommand(looter);

            if (command == null)
            {
                ulong owner = GetSalvagerOwner(container);
                if (owner != 0)
                {
                    looter.ChatMessage("You found a <color=yellow>Salvaging Bench!</color>!");
                }
                g_lootCache[UniqueId(container)] = looter;
                return;
            }

            var sb = new StringBuilder();

            ClearActiveCommand(looter);
            sb.Append($"<color=yellow>{command}</color> mode is now <color=red>OFF</color>");
            looter.ChatMessage(sb.ToString());

            RunCommand(looter, command, container);
        }
Exemplo n.º 24
0
        void OnPlayerLoot(PlayerLoot lootInventory, BaseEntity targetEntity)
        {
            if (!(targetEntity is BasePlayer))
            {
                return;
            }

            var targetPlayer = (BasePlayer)targetEntity;
            var player       = lootInventory.GetComponent("BasePlayer") as BasePlayer;
            var amount       = config.Settings.Rewards[PluginRewards.Corpse];

            if (!player || amount <= 0)
            {
                return;
            }

            Economics.CallHook("Deposit", player.userID, amount);

            if (config.Settings.ShowMessages)
            {
                PrintToChat(player, string.Format(config.Messages[PluginMessage.ReceivedForLoot], amount, targetPlayer.displayName));
            }
        }
Exemplo n.º 25
0
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            var player = inventory.GetComponent <BasePlayer> ();

            if (player == null)
            {
                return;
            }

            OnlinePlayer onlinePlayer;

            if (onlinePlayers.TryGetValue(player, out onlinePlayer) && onlinePlayer.View != null)
            {
                if (onlinePlayer.View == inventory.entitySource && onlinePlayer.Trade != null)
                {
                    OpenTrade t = onlinePlayer.Trade;

                    if (!t.closing)
                    {
                        t.closing = true;
                        if (!onlinePlayer.Trade.complete)
                        {
                            if (onlinePlayer.Trade.sourcePlayer == player)
                            {
                                TradeReply(t, "Status: They Interrupted", "Status: You Interrupted");
                            }
                            else
                            {
                                TradeReply(t, "Status: You Interrupted", "Status: They Interrupted");
                            }
                        }
                        CloseBoxView(player, (StorageContainer)inventory.entitySource);
                    }
                }
            }
        }
Exemplo n.º 26
0
 private void IOnLootPlayer(PlayerLoot source, BasePlayer target) => Interface.Call("OnLootPlayer", source.GetComponent <BasePlayer>(), target);
Exemplo n.º 27
0
 private void IOnLootEntity(PlayerLoot source, BaseEntity entity) => Interface.Call("OnLootEntity", source.GetComponent<BasePlayer>(), entity);
Exemplo n.º 28
0
 /////////////////////////////////////////
 // OnPlayerLoot(PlayerLoot lootInventory,  BasePlayer targetPlayer)
 // Called when a player tries to loot another player
 /////////////////////////////////////////
 void OnPlayerLoot(PlayerLoot lootInventory, object target)
 {
     BasePlayer targetPlayer = target as BasePlayer;
     if (targetPlayer != null) { OnLootPlayer( lootInventory, targetPlayer); return; }
     OnLootBox( lootInventory.GetComponent("BasePlayer") as BasePlayer, target);
 }
Exemplo n.º 29
0
 void OnLootPlayer(PlayerLoot lootInventory, BasePlayer targetPlayer)
 {
     if(hasTag(targetPlayer,"noplayerloot"))
     {
         BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer;
         timer.Once(0.01f, () => looter.EndLooting());
     }
 }
Exemplo n.º 30
0
 private void IOnLootItem(PlayerLoot source, Item item) => Interface.Call("OnLootItem", source.GetComponent<BasePlayer>(), item);
Exemplo n.º 31
0
        private void IOnLootPlayer(PlayerLoot source, BaseEntity target)
        {
            // Call hook
            Interface.CallHook("OnLootPlayer", source.GetComponent<BasePlayer>(), target);

            // Call depreated hook
            Interface.CallDeprecatedHook("OnPlayerLoot", source, target);
        }
Exemplo n.º 32
0
        private void IOnLootItem(PlayerLoot source, Item item)
        {
            // Call hook
            Interface.CallHook("OnLootItem", source.GetComponent<BasePlayer>(), item);

            // Call depreated hook
            Interface.CallDeprecatedHook("OnPlayerLoot", source, item);
        }
Exemplo n.º 33
0
        private void IOnLootEntity(PlayerLoot source, BaseEntity entity)
        {
            // Call hook
            Interface.CallHook("OnLootEntity", source.GetComponent<BasePlayer>(), entity);

            // Call depreated hook
            Interface.CallDeprecatedHook("OnPlayerLoot", source, entity);
        }
Exemplo n.º 34
0
 private void IOnLootItem(PlayerLoot source, Item item) => Interface.Call("OnLootItem", source.GetComponent <BasePlayer>(), item);
Exemplo n.º 35
0
 private void IOnLootEntity(PlayerLoot source, BaseEntity entity) => Interface.Call("OnLootEntity", source.GetComponent <BasePlayer>(), entity);
Exemplo n.º 36
0
 private void IOnLootPlayer(PlayerLoot source, BasePlayer target) => Interface.Call("OnLootPlayer", source.GetComponent<BasePlayer>(), target);
Exemplo n.º 37
0
        /// <summary>
        /// Called from <c>PlayerLoot.StartLootingItem(BasePlayer)</c> .
        /// </summary>
        public static void On_LootingPlayer(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent<BasePlayer>();
            var ple = new PlayerLootEvent(playerLoot,
                                          Server.GetPlayer(looter),
                                          Server.GetPlayer(playerLoot.entitySource as BasePlayer));

            OnNext("On_LootingPlayer", ple);

            if (ple.Cancel) {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add",
                                          0,
                                          String.Format("{0}: {1}",
                                                        Server.server_message_name.ColorText("fa5"),
                                                        ple.cancelReason));
            }
        }
Exemplo n.º 38
0
        // PlayerLoot.StartLootingItem()
        public static void StartLootingItem(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent<BasePlayer>();
            var ile = new Events.ItemLootEvent(playerLoot, Server.GetPlayer(looter), playerLoot.itemSource);
            OnLootingItem.OnNext(ile);

            if (ile.Cancel) {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ile.cancelReason));
            }
        }