示例#1
0
        /// <summary>
        /// Checks if the player has received their modified items.
        /// </summary>
        private void CheckDrops(object sender, PlayerSlotArgs e)
        {
            if (!PvPModifier.Config.EnablePlugin)
            {
                return;
            }

            if (e.Player.TPlayer.dead)
            {
                return;
            }
            if (!e.Player.TPlayer.hostile)
            {
                return;
            }

            //This method runs right after the replacement method, and since the PlayerSlotArgs will be the same,
            //we add this check so the item doesn't instantly get checked off as being modified
            if (e.Player.InvTracker.StartPvPInventoryCheck)
            {
                e.Player.InvTracker.StartPvPInventoryCheck = false;
                return;
            }

            e.Player.InvTracker.CheckFinishedModifications(e.NetID);
        }
示例#2
0
        /// <summary>
        /// Replaces items placed into the inventory into the pvp versions.
        /// </summary>
        private void CheckIncomingItems(object sender, PlayerSlotArgs e)
        {
            if (!PvPModifier.Config.EnablePlugin)
            {
                return;
            }

            if (!e.Player.TPlayer.hostile)
            {
                return;
            }
            if (e.SlotId >= 58)
            {
                return;
            }

            //Only runs after initial pvp check
            if (e.Player.InvTracker.OnPvPInventoryChecked)
            {
                if (e.Player.InvTracker.LockModifications)
                {
                    return;
                }

                //If the item is being consumed, don't modify the item
                if (Math.Abs(e.Player.TPlayer.inventory[e.SlotId].stack - e.Stack) <= 1 &&
                    e.Player.TPlayer.inventory[e.SlotId].netID == e.NetID)
                {
                    return;
                }

                //If the item is modified, fill empty spaces and add it to queue
                if (PvPUtils.IsModifiedItem(e.NetID))
                {
                    SSCUtils.FillInventoryToIndex(e.Player, Constants.EmptyItem, Constants.JunkItem, e.SlotId);
                    SSCUtils.SetItem(e.Player, e.SlotId, Constants.EmptyItem);
                    e.Player.InvTracker.AddItem(PvPUtils.GetCustomWeapon(e.Player, e.NetID, e.Prefix, e.Stack));
                    e.Player.InvTracker.StartDroppingItems();
                }
            }
        }