Exemple #1
0
 private void GetStorageBoxCode(BasePlayer player, StorageContainer box)
 {
     if (box.HasSlot(BaseEntity.Slot.Lock))
     {
         BaseLock thelock = box.GetSlot(BaseEntity.Slot.Lock) as BaseLock;
         if (thelock as CodeLock)
         {
             List <ulong> whitelisted = codelockwhitelist.GetValue(thelock as CodeLock) as List <ulong>;
             string       codevalue   = codenum.GetValue(thelock as CodeLock) as string;
             SendReply(player, string.Format(boxCode, codevalue));
             SendReply(player, codeLockList);
             if (whitelisted.Count == 0)
             {
                 SendReply(player, noCodeAccess);
                 return;
             }
             foreach (ulong userid in whitelisted)
             {
                 SendBasePlayerFind(player, userid);
             }
             return;
         }
     }
     SendReply(player, boxNeedsCode);
 }
Exemple #2
0
 private void GetStorageBoxCode(BasePlayer player, StorageContainer box)
 {
     if (box.HasSlot(BaseEntity.Slot.Lock))
     {
         BaseLock thelock = box.GetSlot(BaseEntity.Slot.Lock) as BaseLock;
         if (thelock as CodeLock)
         {
             List<ulong> whitelisted = codelockwhitelist.GetValue(thelock as CodeLock) as List<ulong>;
             SendReply(player, codeLockList);
             if (whitelisted.Count == 0)
             {
                 SendReply(player, noCodeAccess);
                 return;
             }
             foreach (ulong userid in whitelisted)
             {
                 SendBasePlayerFind(player, userid);
             }
             return;
         }
     }
     SendReply(player, boxNeedsCode);
 }
Exemple #3
0
 public DeployableComponent(Deployable deployable, SerializedVector3 v3, SerializedQuaternion q)
 {
     Prefab        = deployable.GetComponent <BaseNetworkable>().LookupPrefabName();
     LocalPosition = v3;
     LocalRotation = q;
     if (deployable.GetComponent <SleepingBag>())
     {
         SleepingBag sleepingBag = deployable.GetComponent <SleepingBag>();
         DeployedBy  = sleepingBag.deployerUserID;
         BagName     = sleepingBag.niceName;
         HasOwner    = true;
         HasStorage  = false;
         HasPainting = false;
         IsCupBoard  = false;
     }
     else if (deployable.GetComponent <BuildingPrivlidge>())
     {
         IsCupBoard = true;
         BuildingPrivlidge buildingPrivlidge = deployable.GetComponent <BuildingPrivlidge>();
         AuthedPlayers = new List <ProtoBuf.PlayerNameID>();
         AuthedPlayers = buildingPrivlidge.authorizedPlayers;
     }
     else if (deployable.GetComponent <StorageContainer>())
     {
         HasOwner    = false;
         HasStorage  = true;
         HasPainting = false;
         IsCupBoard  = false;
         StorageContainer storageContainer = deployable.GetComponent <StorageContainer>();
         ItemList = new List <Dictionary <string, object> >();
         foreach (Item item in storageContainer.inventory.itemList)
         {
             var itemData = new Dictionary <string, object>();
             itemData.Add("blueprint", item.IsBlueprint());
             itemData.Add("id", item.info.itemid);
             itemData.Add("amount", item.amount);
             ItemList.Add(itemData);
         }
         if (storageContainer.HasSlot(BaseEntity.Slot.Lock))
         {
             var baseLock = storageContainer.GetSlot(BaseEntity.Slot.Lock) as BaseLock;
             if (baseLock == null)
             {
                 HasCodeLock = false;
                 HasKeyLock  = false;
             }
             else if (baseLock.GetComponent <CodeLock>())
             {
                 HasCodeLock = true;
                 HasKeyLock  = false;
                 CodeLock codeLock = baseLock.GetComponent <CodeLock>();
                 if (!string.IsNullOrEmpty((string)codeLock.GetFieldValue("code")))
                 {
                     LockCode  = (string)codeLock.GetFieldValue("code");
                     LockWList = new List <ulong>();
                     LockWList = (List <ulong>)codeLock.GetFieldValue("whitelistPlayers");
                 }
             }
             else if (baseLock.GetComponent <KeyLock>())
             {
                 HasCodeLock = false;
                 HasKeyLock  = true;
                 KeyLock keyLock = baseLock.GetComponent <KeyLock>();
                 int     keyCode = (int)keyLock.GetFieldValue("keyCode");
                 keyCode  = (bool)keyLock.GetFieldValue("firstKeyCreated") ? keyCode |= 0x80 : (int)keyLock.GetFieldValue("keyCode");
                 LockCode = keyCode.ToString();
             }
         }
     }
     else if (deployable.GetComponent <Signage>())
     {
         HasOwner    = false;
         HasStorage  = false;
         HasPainting = true;
         IsCupBoard  = false;
         Signage signage = deployable.GetComponent <Signage>();
         byte[]  tempImg = FileStorage.server.Get(signage.textureID, FileStorage.Type.png, signage.net.ID);
         if (signage.textureID > 0 && tempImg != null)
         {
             Painting = tempImg;
         }
         PaintingLocked = signage.IsLocked();
     }
     else
     {
         HasOwner    = false;
         HasStorage  = false;
         HasPainting = false;
         IsCupBoard  = false;
     }
 }