Exemplo n.º 1
0
 public static void lootContainerOpened(TileEntityLootContainer _te, LocalPlayerUI _playerUI, int _entityIdThatOpenedIt)
 {
     if (_playerUI != null)
     {
         bool   flag = true;
         string lootContainerName = string.Empty;
         if (_te.entityId != -1)
         {
             Entity entity = GameManager.Instance.World.GetEntity(_te.entityId);
             if (entity != null)
             {
                 lootContainerName = Localization.Get(EntityClass.list[entity.entityClass].entityClassName, "");
                 if (entity is EntityVehicle)
                 {
                     flag = false;
                 }
             }
         }
         else
         {
             BlockValue block = GameManager.Instance.World.GetBlock(_te.ToWorldPos());
             lootContainerName = Localization.Get(Block.list[block.type].GetBlockName(), "");
         }
         if (flag)
         {
             ((XUiC_LootWindowGroup)((XUiWindowGroup)_playerUI.windowManager.GetWindow("looting")).Controller).SetTileEntityChest(lootContainerName, _te);
             _playerUI.windowManager.Open("looting", true, false, true);
         }
         LootContainer lootContainer = LootContainer.lootList[_te.lootListIndex];
         if (lootContainer != null && _playerUI.entityPlayer != null)
         {
             lootContainer.ExecuteBuffActions(_te.entityId, _playerUI.entityPlayer);
         }
     }
     if (SingletonMonoBehaviour <ConnectionManager> .Instance.IsServer)
     {
         GameManager.Instance.lootManager.LootContainerOpened(_te, _entityIdThatOpenedIt);
         _te.bTouched = true;
         _te.SetModified();
     }
 }