コード例 #1
0
 public void OnItemConainerUpdate()
 {
     if (this.EntityOwner is BasePlayer playerOwner)
     {
         ProtoBuf.UpdateItemContainer container = new ProtoBuf.UpdateItemContainer
         {
             container = new List <ProtoBuf.ItemContainer> {
                 this.GetProtobufObject()
             },
             type = (this.HasFlag(E_ItemContainerType.Belt) ? 1 : (this.HasFlag(E_ItemContainerType.Clothing) ? 2 : 0))
         };
         if (playerOwner.IsConnected)
         {
             playerOwner.ClientRPCEx <ProtoBuf.UpdateItemContainer>(new SendInfo(playerOwner.Network.NetConnection), null, ERPCMethodType.UpdatedItemContainer, container);
         }
         if (this.HasFlag(E_ItemContainerType.Clothing) || this.HasFlag(E_ItemContainerType.Belt))
         {
             playerOwner.ClientRPCEx <ProtoBuf.UpdateItemContainer>(new SendInfo(playerOwner.ListViewToMe.ToConnectionsList()), null, ERPCMethodType.UpdatedItemContainer, container);
         }
     }
 }
コード例 #2
0
        private void OnInventoryNetworkUpdate(PlayerInventory inventory, ItemContainer container, ProtoBuf.UpdateItemContainer updatedItemContainer, PlayerInventory.Type inventoryType)
        {
            if (inventoryType != PlayerInventory.Type.Main)
            {
                return;
            }

            var ruleset = GetPlayerRuleset(inventory.baseEntity.UserIDString);

            if (ruleset == null)
            {
                return;
            }

            AddItems(updatedItemContainer.container[0], ruleset);
        }