示例#1
0
 public static PlayerLootModel Map(PlayerLoot player) => new PlayerLootModel
 {
     PlayerLootId = player.PlayerLootId,
     PlayerId     = player.PlayerId,
     LootId       = player.LootId,
     Quantity     = player.Quantity,
 };
示例#2
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();
                        }
                    }
                }
            }
        }
示例#3
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());
                }
            }
        }
示例#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);
            }
        }
 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"]);
         }
     }
 }
示例#6
0
 void OnLootPlayer(PlayerLoot lootInventory, BasePlayer targetPlayer)
 {
     if (hasTag(targetPlayer, "noplayerloot"))
     {
         BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer;
         timer.Once(0.01f, () => looter.EndLooting());
     }
 }
        private void OnPlayerLootEnd(PlayerLoot inventory)
        {
            var player = inventory.GetComponent <BasePlayer>();

            CuiHelper.DestroyUi(player, "BoxUIHeader");
            CuiHelper.DestroyUi(player, "BoxUIContent");
            CuiHelper.DestroyUi(player, "BoxUISort");
        }
示例#8
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);
        }
示例#9
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);
        }
示例#10
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);
        }
示例#11
0
        // PlayerLoot.StartLootingEntity()
        public static void StartLootingEntity(PlayerLoot playerLoot, BasePlayer looter, BaseEntity entity)
        {
            // not tested, what is a lootable entity anyway?

            var ele = new Events.EntityLootEvent(playerLoot, new Player(looter), new Entity(entity));

            OnLootingEntity.OnNext(ele);
        }
 public RustPlayerLootedItemEvent(
     RustPlayer player,
     PlayerLoot playerLoot,
     Item item) : base(player)
 {
     PlayerLoot = playerLoot;
     Item       = item;
 }
示例#13
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);
        }
示例#14
0
        // PlayerLoot.StartLootingItem()
        public static void StartLootingItem(PlayerLoot playerLoot, BasePlayer looter, Item item)
        {
            // works, event needed

            var ile = new Events.ItemLootEvent(playerLoot, new Player(looter), item);

            OnLootingItem.OnNext(ile);
        }
示例#15
0
        // PlayerLoot.StartLootingPlayer()
        public static void StartLootingPlayer(PlayerLoot playerLoot, BasePlayer looter, BasePlayer looted)
        {
            // not tested

            var ple = new Events.PlayerLootEvent(playerLoot, new Player(looter), new Player(looted));

            OnLootingPlayer.OnNext(ple);
        }
示例#16
0
        void OnPlayerLootEnd(PlayerLoot loot)
        {
            var entity = loot.entitySource as SupplyDrop;

            if (entity?.inventory?.itemList?.Count == 0 && timers.ContainsKey(loot.entitySource))
            {
                timers[loot.entitySource]?.Destroy();
            }
        }
示例#17
0
        private void OnPlayerLootEnd(PlayerLoot inventory)
        {
            BasePlayer player = inventory.GetComponent <BasePlayer>();

            if (player != null)
            {
                DestroyUi(player);
            }
        }
示例#18
0
        private void OnPlayerLootEnd(PlayerLoot playerLoot)
        {
            var player = (BasePlayer)playerLoot.gameObject.ToBaseEntity();

            if (_openBackpacks.ContainsKey(player))
            {
                _openBackpacks[player].OnClose(player);
            }
        }
示例#19
0
 private void Awake()
 {
     playerInput                = GetComponent <PlayerInput>();
     playerMovement             = GetComponent <PlayerMovement>();
     playerShoot                = GetComponent <PlayerShoot>();
     playerProjectileController = GetComponent <PlayerProjectileController>();
     playerImmunity             = GetComponent <PlayerImmunity>();
     playerLoot = GetComponent <PlayerLoot>();
     animator   = GetComponent <Animator>();
 }
示例#20
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);
        }
示例#22
0
    void OnTriggerEnter2D(Collider2D other)
    {
        Coin otherCoin = other.gameObject.GetComponent <Coin>();

        if (otherCoin != null)
        {
            PlayerLoot lootEvent = new PlayerLoot(otherCoin.gameObject);
            Events.instance.Raise(lootEvent);
            otherCoin.isTook();
        }
    }
        // 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);
                }
            }
        }
示例#24
0
        private void OnPlayerLootEnd(PlayerLoot loot)
        {
            var player = loot.gameObject.GetComponent <BasePlayer>();

            if (player != loot.entitySource)
            {
                return;
            }

            PrintDebug("OnLootEntityEnd: Closing container");
            ContainerController.Find(player)?.Close();
        }
示例#25
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));
            }
        }
示例#26
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));
            }
        }
示例#27
0
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            var player = inventory.GetComponent <BasePlayer>();

            if (player == null)
            {
                return;
            }

            if (player.IsAdmin || PermissionService.HasPermission(player.userID, permAccess))
            {
                DestroyUI(player);
            }
        }
示例#28
0
        void OnPlayerLootEnd(PlayerLoot inventory)
        {
            var player = inventory.gameObject.ToBaseEntity();

            if (player == null)
            {
                return;
            }
            var box = m_Boxes.Select(p => p.Value).FirstOrDefault(p => p.player1 == player || p.player2 == player);

            if (box != null)
            {
                OnDepositCanceled(box.guid);
            }
        }
示例#29
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);
        }
示例#30
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);
                }
            }
        }
示例#31
0
 public PlayerLootEvent(PlayerLoot playerLoot, Player looter, Player looted)
     : base(playerLoot, looter)
 {
     Target = looted;
 }
示例#32
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);
 }
示例#33
0
 private void IOnLootEntity(PlayerLoot source, BaseEntity entity) => Interface.Call("OnLootEntity", source.GetComponent<BasePlayer>(), entity);
示例#34
0
 private void IOnLootItem(PlayerLoot source, Item item) => Interface.Call("OnLootItem", source.GetComponent<BasePlayer>(), item);
示例#35
0
 void OnLootPlayer(PlayerLoot lootInventory, BasePlayer targetPlayer)
 {
     if(hasTag(targetPlayer,"noplayerloot"))
     {
         BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer;
         timer.Once(0.01f, () => looter.EndLooting());
     }
 }
示例#36
0
 public EntityLootEvent(PlayerLoot playerLoot, Player looter, Entity looted)
     : base(playerLoot, looter)
 {
     Target = looted;
 }
示例#37
0
 private void IOnLootPlayer(PlayerLoot source, BasePlayer target) => Interface.Call("OnLootPlayer", source.GetComponent<BasePlayer>(), target);
示例#38
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);
        }
示例#39
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);
        }
示例#40
0
文件: Hooks.cs 项目: 906507516/Oxide
 private void OnPlayerLoot(PlayerLoot inventory, BaseEntity entity)
 //private void OnPlayerLoot(PlayerLoot inventory, BasePlayer target)
 //private void OnPlayerLoot(PlayerLoot inventory, Item item)
 {
     HookCalled("OnPlayerLoot");
 }
示例#41
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);
        }
示例#42
0
 public LootEvent(PlayerLoot playerLoot, Player looter)
 {
     Looter = looter;
     pLoot = playerLoot;
 }
示例#43
0
文件: Hooks.cs 项目: Viproz/Pluton
        // 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));
            }
        }
示例#44
0
 public ItemLootEvent(PlayerLoot pl, Player looter, Item looted)
     : base(pl, looter)
 {
     Target = looted;
 }
示例#45
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));
            }
        }
示例#46
0
 //private void OnPlayerLoot(PlayerLoot lootInventory, BasePlayer targetPlayer)
 //private void OnPlayerLoot(PlayerLoot lootInventory, Item targetItem)
 private void OnPlayerLoot(PlayerLoot lootInventory, BaseEntity targetEntity)
 {
     HookCalled("OnPlayerLoot");
 }