Example #1
0
 private void UpdateArmor()
 {
     if (this.m_ArmorCollider.OverlapPoint(Input.mousePosition))
     {
         this.m_ArmorHL.gameObject.SetActive(true);
         if (Input.GetMouseButtonDown(0))
         {
             this.m_ArmorEnabled = !this.m_ArmorEnabled;
             PlayerArmorModule.Get().SetMeshesVisible(this.m_ArmorEnabled);
             if (this.m_ArmorEnabled)
             {
                 BodyInspectionController.Get().OnArmorMeshesEnabled();
             }
             else
             {
                 BodyInspectionController.Get().OnArmorMeshesDisabled();
             }
         }
     }
     else
     {
         this.m_ArmorHL.gameObject.SetActive(false);
     }
     if (this.m_ArmorEnabled)
     {
         this.m_ArmorOff.gameObject.SetActive(false);
         this.m_ArmorOn.gameObject.SetActive(true);
         return;
     }
     this.m_ArmorOff.gameObject.SetActive(true);
     this.m_ArmorOn.gameObject.SetActive(false);
 }
Example #2
0
    public override string GetLocalizedInfo()
    {
        Localization localization = GreenHellGame.Instance.GetLocalization();
        string       text         = localization.Get("MudChallenge_Collect", true);

        for (int i = 0; i < this.m_RequredItemNames.Count; i++)
        {
            if (!InventoryBackpack.Get().Contains((ItemID)this.m_RequredItemIDs[i]))
            {
                text += "\n";
                text += localization.Get(this.m_RequredItemNames[i].ToString(), true);
            }
        }
        if (this.m_RequireArmorOnAllLimbs != ArmorType.None)
        {
            bool flag = true;
            for (int j = 0; j < 4; j++)
            {
                if (!PlayerArmorModule.Get().IsArmorActive((Limb)j, this.m_RequireArmorOnAllLimbs))
                {
                    flag = false;
                    break;
                }
            }
            if (!flag)
            {
                text += "\n";
                text += localization.Get("MudChallenge_Armor", true);
                text += "\n";
                text += localization.Get(this.m_RequireArmorOnAllLimbs.ToString().ToLower() + "_armor", true);
            }
        }
        return(text);
    }
Example #3
0
    protected override void OnShow()
    {
        base.OnShow();
        this.OnClickLimb(Limb.LArm);
        this.m_LimbCurrentSelections[0].enabled = true;
        this.m_HintBG.gameObject.SetActive(true);
        this.m_HintText.gameObject.SetActive(true);
        PlayerArmorModule.Get().SetMeshesVisible(this.m_ArmorEnabled);
        if (this.m_ArmorEnabled)
        {
            BodyInspectionController.Get().OnArmorMeshesEnabled();
        }
        else
        {
            BodyInspectionController.Get().OnArmorMeshesDisabled();
        }
        this.m_ArmorBG.gameObject.SetActive(true);
        this.m_BackpackHint.SetActive(GreenHellGame.IsPadControllerActive() && !Inventory3DManager.Get().IsActive());
        this.m_SortBackpackHint.SetActive(GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive());
        TextGenerationSettings generationSettings = this.m_SelectLimbText.GetGenerationSettings(this.m_SelectLimbText.rectTransform.rect.size);

        generationSettings.scaleFactor = 1f;
        float preferredWidth = this.m_TextGen.GetPreferredWidth(this.m_SelectLimbText.text, generationSettings);

        this.m_SelectLimgBGSize.Set(Mathf.Max(99.75f, preferredWidth + this.m_SelectLimbW), this.m_SelectLimbBG.rectTransform.rect.size.y);
        this.m_SelectLimbBG.rectTransform.sizeDelta = this.m_SelectLimgBGSize;
        preferredWidth = this.m_TextGen.GetPreferredWidth(this.m_RotateLimbText.text, generationSettings);
        this.m_RotateLimgBGSize.Set(Mathf.Max(80f, preferredWidth + this.m_SelectLimbW), this.m_RotateLimbBG.rectTransform.rect.size.y);
        this.m_RotateLimbBG.rectTransform.sizeDelta = this.m_RotateLimgBGSize;
    }
Example #4
0
    public override void Update()
    {
        base.Update();
        int i = 0;

        while (i < this.m_RequredItemIDs.Count)
        {
            if (InventoryBackpack.Get().Contains((ItemID)this.m_RequredItemIDs[i]))
            {
                this.m_RequredItemIDs.RemoveAt(i);
                this.m_RequredItemNames.RemoveAt(i);
            }
            else
            {
                i++;
            }
        }
        if (this.m_RequireArmorOnAllLimbs != ArmorType.None)
        {
            for (int j = 0; j < 4; j++)
            {
                if (!PlayerArmorModule.Get().IsArmorActive((Limb)j, this.m_RequireArmorOnAllLimbs))
                {
                    return;
                }
            }
        }
        if (this.m_RequredItemIDs.Count == 0)
        {
            this.Success();
        }
    }
Example #5
0
 protected override void OnHide()
 {
     base.OnHide();
     this.m_HintBG.gameObject.SetActive(false);
     this.m_HintText.gameObject.SetActive(false);
     PlayerArmorModule.Get().SetMeshesVisible(true);
     BodyInspectionController.Get().OnArmorMeshesEnabled();
     this.m_ArmorBG.gameObject.SetActive(false);
 }
Example #6
0
 public override void SetupAfterLoad(int index)
 {
     base.SetupAfterLoad(index);
     if (this.m_Limb != Limb.None)
     {
         if (this.m_Info.m_ID == ItemID.broken_armor)
         {
             PlayerArmorModule.Get().InsertArmorDesstroyed(this.m_Limb);
             UnityEngine.Object.Destroy(base.gameObject);
             return;
         }
         PlayerArmorModule.Get().m_LimbMap[(int)this.m_Limb].m_Slot.InsertItem(this);
     }
 }
Example #7
0
 public void DelayedExecute()
 {
     this.ExecuteAction(this.m_ActionToExecute, this.m_Item);
     Player.Get().UnblockMoves();
     Player.Get().UnblockRotation();
     Player.Get().m_Animator.SetBool(TriggerController.Get().m_BDrinkWater, false);
     Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, false);
     Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBow, false);
     Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItem, false);
     PlayerArmorModule.Get().SetMeshesVisible(true);
     BodyInspectionController.Get().OnArmorMeshesEnabled();
     Player.Get().m_Animator.SetBool(Player.Get().m_CleanUpHash, false);
     this.SetActive(false);
     this.m_ExecutionInProgress = false;
 }
Example #8
0
 protected override void Start()
 {
     base.Start();
     this.m_ConditionModule = Player.Get().GetComponent <PlayerConditionModule>();
     DebugUtils.Assert(this.m_ConditionModule, true);
     this.m_NoNutritionIconStartScale  = this.m_EnergyUsedByNoNutritionIcon.transform.localScale;
     this.m_WoundsIconStartScale       = this.m_EnergyUsedByWoundsIcon.transform.localScale;
     this.m_FoodPoisonIconStartScale   = this.m_EnergyFoodPoisonIcon.transform.localScale;
     this.m_PoisonIconStartScale       = this.m_EnergyFoodPoisonIcon.transform.localScale;
     this.m_FeverIconStartScale        = this.m_EnergyFeverIcon.transform.localScale;
     this.m_DamagedArmorIconStartScale = this.m_EnergyArmorDamagedIcon.transform.localScale;
     this.m_HealingWoundDummy          = base.transform.FindDeepChild("HUDHealingWoundDummy");
     this.ScrollerInitialize();
     this.m_PIM = PlayerInjuryModule.Get();
     this.m_PDM = Player.Get().GetComponent <PlayerDiseasesModule>();
     this.m_PAM = PlayerArmorModule.Get();
     this.m_HealthRed.enabled = false;
 }
Example #9
0
    protected override void OnEnable()
    {
        base.OnEnable();
        if (this.m_Player.GetCurrentItem(Hand.Right) != null)
        {
            if (this.m_Player.GetCurrentItem(Hand.Right).m_Info.IsHeavyObject())
            {
                this.m_Player.DropItem(this.m_Player.GetCurrentItem(Hand.Right));
            }
            else
            {
                this.m_Player.GetCurrentItem(Hand.Right).gameObject.SetActive(false);
            }
        }
        if (this.m_Player.GetCurrentItem(Hand.Left) != null)
        {
            this.m_Player.GetCurrentItem(Hand.Left).gameObject.SetActive(false);
        }
        InsectsManager.Get().Activate(InsectsManager.InsectType.Ant);
        bool flag  = PlayerArmorModule.Get().IsArmorActive(Limb.LArm);
        bool flag2 = PlayerArmorModule.Get().IsArmorActive(Limb.RArm);

        if (flag && flag2)
        {
            this.m_Animator.SetBool(this.m_BInsectsLRArmorParam, true);
        }
        else if (flag)
        {
            this.m_Animator.SetBool(this.m_BInsectsLArmorParam, true);
        }
        else if (flag2)
        {
            this.m_Animator.SetBool(this.m_BInsectsRArmorParam, true);
        }
        else
        {
            this.m_Animator.SetBool(this.m_BInsectsNoArmorParam, true);
        }
        this.m_EndTime   = Time.time + 2.01663f;
        this.m_StartTime = Time.time;
    }
Example #10
0
 private void UpdateSmallIcons()
 {
     for (int i = 0; i < 4; i++)
     {
         if (PlayerArmorModule.Get().GetArmorData((Limb)i).m_ArmorType != ArmorType.None)
         {
             if (this.m_ArmorEnabled)
             {
                 this.m_ArmorSmallIcons[i].On();
             }
             else
             {
                 this.m_ArmorSmallIcons[i].Off();
             }
         }
         else
         {
             this.m_ArmorSmallIcons[i].Disable();
         }
     }
 }
Example #11
0
 public void OnInputAction(InputActionData action_data)
 {
     if (action_data.m_Action == InputsManager.InputAction.BIShowHideArmor)
     {
         this.m_ArmorEnabled = !this.m_ArmorEnabled;
         PlayerArmorModule.Get().SetMeshesVisible(this.m_ArmorEnabled);
         if (this.m_ArmorEnabled)
         {
             BodyInspectionController.Get().OnArmorMeshesEnabled();
         }
         else
         {
             BodyInspectionController.Get().OnArmorMeshesDisabled();
         }
         if (this.m_ArmorEnabled)
         {
             this.m_ArmorOff.gameObject.SetActive(false);
             this.m_ArmorOn.gameObject.SetActive(true);
             return;
         }
         this.m_ArmorOff.gameObject.SetActive(true);
         this.m_ArmorOn.gameObject.SetActive(false);
     }
 }
Example #12
0
 protected override void OnInsertItem(Item item)
 {
     base.OnInsertItem(item);
     PlayerArmorModule.Get().OnArmorInsert(this, item);
 }
Example #13
0
    public bool Activate(Item item)
    {
        if (this.m_Active)
        {
            return(false);
        }
        if (!item || !item.CanExecuteActions())
        {
            return(false);
        }
        this.ResetItems();
        this.m_Item = item;
        this.ClearSlots();
        if (GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive() && Inventory3DManager.Get().CanSetCarriedItem(true))
        {
            this.AddSlot(HUDItem.Action.Pick);
            this.AddSlot(HUDItem.Action.PickStack);
        }
        if (this.m_Item.m_Info.IsArmor() && ((Armor)this.m_Item).m_Limb != Limb.None)
        {
            this.AddSlot(HUDItem.Action.TakeOffArmor);
            this.Activate();
            return(true);
        }
        bool flag = Player.Get().m_SwimController.IsActive();

        if (this.m_Item.m_Info.m_Craftable && !this.m_Item.m_OnCraftingTable && Player.Get().CanStartCrafting())
        {
            this.AddSlot(HUDItem.Action.Craft);
        }
        if (this.m_Item.IsStorage())
        {
            this.AddSlot(HUDItem.Action.Use);
        }
        else if (item.IsAcre())
        {
            this.AddSlot(HUDItem.Action.Plow);
        }
        else if (this.m_Item.m_Info.IsHeavyObject() && !this.m_Item.m_Info.m_CanBeAddedToInventory)
        {
            if (!MakeFireController.Get().IsActive())
            {
                this.AddSlot(HUDItem.Action.PickUp);
            }
        }
        else if (this.m_Item.m_Info.m_CanEquip)
        {
            if (this.m_Item.IsFireTool())
            {
                if (!InventoryBackpack.Get().Contains(this.m_Item))
                {
                    this.AddSlot(HUDItem.Action.Take);
                }
                if (!MakeFireController.Get().IsActive() && !Player.Get().IsInWater())
                {
                    this.AddSlot(HUDItem.Action.Use);
                }
            }
            else if (this.m_Item.m_InInventory || this.m_Item.m_InStorage)
            {
                if (item != InventoryBackpack.Get().m_EquippedItem)
                {
                    this.AddSlot(HUDItem.Action.Equip);
                }
            }
            else if (InventoryBackpack.Get().FindFreeSlot(this.m_Item))
            {
                this.AddSlot(HUDItem.Action.Take);
            }
            else
            {
                this.AddSlot(HUDItem.Action.Swap);
            }
        }
        else if (this.m_Item.m_Info.m_CanBeAddedToInventory && !InventoryBackpack.Get().Contains(this.m_Item))
        {
            this.AddSlot(HUDItem.Action.Take);
        }
        if (MakeFireController.Get().IsActive() && MakeFireController.Get().CanUseItemAsKindling(item))
        {
            this.AddSlot(HUDItem.Action.Use);
        }
        if (this.m_Item.m_Info.m_Eatable && !flag)
        {
            this.AddSlot(HUDItem.Action.Eat);
        }
        if (this.m_Item.m_Info.CanDrink() && !flag)
        {
            this.AddSlot(HUDItem.Action.Drink);
        }
        if (this.m_Item.m_Info.IsLiquidContainer() && ((LiquidContainerInfo)this.m_Item.m_Info).CanSpill())
        {
            this.AddSlot(HUDItem.Action.Spill);
        }
        if (this.m_Item.m_Info.m_Harvestable && !flag && (!this.m_Item.RequiresToolToHarvest() || Player.Get().HasBlade()))
        {
            this.AddSlot(HUDItem.Action.Harvest);
        }
        if (this.m_Item.m_Info.IsArmor() && BodyInspectionController.Get().IsActive())
        {
            Limb selectedLimb = HUDBodyInspection.Get().GetSelectedLimb();
            if (PlayerArmorModule.Get().IsArmorActive(selectedLimb))
            {
                this.AddSlot(HUDItem.Action.SwapArmor);
            }
            else
            {
                this.AddSlot(HUDItem.Action.EquipArmor);
            }
        }
        if (HUDItemSlot.Get().m_SelectedSlotData != null && HUDItemSlot.Get().m_SelectedSlotData.slot.CanInsertItem(this.m_Item))
        {
            this.AddSlot(HUDItem.Action.Insert);
        }
        if (GreenHellGame.IsPadControllerActive() && (item.m_InInventory || item.m_InStorage))
        {
            this.AddSlot(HUDItem.Action.Drop);
        }
        if (this.m_Item.m_Info.IsStand())
        {
            Stand stand = (Stand)this.m_Item;
            if (stand.GetNumitems() > 0)
            {
                this.AddSlot(HUDItem.Action.Take);
            }
            if (stand.GetNumitems() >= 3)
            {
                this.AddSlot(HUDItem.Action.Take3);
            }
            if (stand.GetNumitems() >= 2)
            {
                this.AddSlot(HUDItem.Action.TakeAll);
            }
        }
        else if (!item.m_Info.m_CantDestroy && !item.m_AttachedToSpear && item.m_Info.m_ID != ItemID.Chellange_Battery && item.m_Info.m_ID != ItemID.Chellange_WalkieTalkie && !item.IsStorage() && !item.IsAcre())
        {
            this.AddSlot(HUDItem.Action.Destroy);
            if ((item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0) || (item.m_CurrentSlot && item.m_CurrentSlot.IsStack()))
            {
                this.AddSlot(HUDItem.Action.DestroyStack);
            }
        }
        this.Activate();
        return(true);
    }
Example #14
0
    public override void OnTakeDamage(DamageInfo info)
    {
        base.OnTakeDamage(info);
        if (info.m_Blocked)
        {
            return;
        }
        float num = info.m_Damage;

        info.m_InjuryPlace = this.GetInjuryPlaceFromHit(info);
        if (!info.m_FromInjury)
        {
            Limb limb = EnumTools.ConvertInjuryPlaceToLimb(info.m_InjuryPlace);
            if (limb == Limb.None)
            {
                limb = Limb.LArm;
            }
            if (info.m_DamageType != DamageType.Fall && info.m_DamageType != DamageType.SnakePoison && info.m_DamageType != DamageType.VenomPoison && info.m_DamageType != DamageType.Insects && info.m_DamageType != DamageType.Infection)
            {
                num = info.m_Damage * (1f - PlayerArmorModule.Get().GetAbsorption(limb));
            }
            PlayerArmorModule.Get().SetPhaseCompleted(ArmorTakeDamagePhase.InjuryModule);
        }
        float num2 = 5f;

        if ((num > num2 && PlayerArmorModule.Get().NoArmorAfterDamage(info)) || info.m_DamageType == DamageType.Insects || info.m_DamageType == DamageType.SnakePoison || info.m_DamageType == DamageType.VenomPoison || info.m_DamageType == DamageType.Fall || info.m_DamageType == DamageType.Infection)
        {
            BIWoundSlot biwoundSlot = null;
            DamageType  damageType  = info.m_DamageType;
            InjuryType  injuryType;
            if (damageType <= DamageType.Claws)
            {
                if (damageType <= DamageType.Melee)
                {
                    if (damageType - DamageType.Cut > 1)
                    {
                        if (damageType == DamageType.Melee)
                        {
                            injuryType = InjuryType.SmallWoundAbrassion;
                            goto IL_17F;
                        }
                    }
                    else
                    {
                        if (info.m_CriticalHit)
                        {
                            injuryType = InjuryType.Laceration;
                            goto IL_17F;
                        }
                        injuryType = InjuryType.SmallWoundScratch;
                        goto IL_17F;
                    }
                }
                else
                {
                    if (damageType == DamageType.VenomPoison)
                    {
                        injuryType = InjuryType.VenomBite;
                        goto IL_17F;
                    }
                    if (damageType == DamageType.Claws)
                    {
                        injuryType = InjuryType.LacerationCat;
                        goto IL_17F;
                    }
                }
            }
            else if (damageType <= DamageType.Fall)
            {
                if (damageType == DamageType.Insects)
                {
                    injuryType = InjuryType.Rash;
                    goto IL_17F;
                }
                if (damageType == DamageType.Fall)
                {
                    injuryType = InjuryType.SmallWoundAbrassion;
                    goto IL_17F;
                }
            }
            else
            {
                if (damageType == DamageType.Critical)
                {
                    injuryType = InjuryType.Laceration;
                    goto IL_17F;
                }
                if (damageType == DamageType.SnakePoison)
                {
                    injuryType = InjuryType.SnakeBite;
                    goto IL_17F;
                }
            }
            injuryType = InjuryType.SmallWoundAbrassion;
IL_17F:
            if (!info.m_FromInjury && (injuryType == InjuryType.VenomBite || injuryType == InjuryType.SnakeBite))
            {
                Disease disease = PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.Fever);
                if (disease != null && disease.IsActive())
                {
                    disease.IncreaseLevel(1);
                }
                else
                {
                    PlayerDiseasesModule.Get().RequestDisease(ConsumeEffect.Fever, 0f, 1);
                }
            }
            if (info.m_DamageType == DamageType.Insects && GreenHellGame.TWITCH_DEMO)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LHand, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.LLeg)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LLeg, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.RLeg)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.RLeg, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.LHand)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LHand, injuryType, true);
            }
            else if (info.m_InjuryPlace == InjuryPlace.RHand)
            {
                biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.RHand, injuryType, true);
            }
            if (biwoundSlot != null)
            {
                InjuryState state = InjuryState.Open;
                if (injuryType == InjuryType.Laceration || injuryType == InjuryType.LacerationCat)
                {
                    state = InjuryState.Bleeding;
                }
                else if (injuryType == InjuryType.WormHole)
                {
                    state = InjuryState.WormInside;
                }
                this.AddInjury(injuryType, biwoundSlot.m_InjuryPlace, biwoundSlot, state, info.m_PoisonLevel, null, info);
                return;
            }
            if (info.m_DamageType == DamageType.VenomPoison)
            {
                for (int i = 0; i < this.m_Injuries.Count; i++)
                {
                    if (this.m_Injuries[i].m_Type == InjuryType.VenomBite)
                    {
                        this.m_Injuries[i].m_PoisonLevel += info.m_PoisonLevel;
                        return;
                    }
                }
                return;
            }
            if (info.m_DamageType == DamageType.SnakePoison)
            {
                for (int j = 0; j < this.m_Injuries.Count; j++)
                {
                    if (this.m_Injuries[j].m_Type == InjuryType.SnakeBite)
                    {
                        this.m_Injuries[j].m_PoisonLevel += info.m_PoisonLevel;
                        return;
                    }
                }
            }
        }
    }
Example #15
0
 public override bool CanInsertItem(Item item)
 {
     if (this.m_Injury == null)
     {
         return(false);
     }
     if (this.m_Injury.m_ParentInjury != null)
     {
         return(false);
     }
     if (PlayerArmorModule.Get().IsArmorActive(EnumTools.ConvertInjuryPlaceToLimb(this.m_InjuryPlace)) && HUDBodyInspection.Get().m_ArmorEnabled)
     {
         return(false);
     }
     if (this.m_Injury.m_State == InjuryState.Infected)
     {
         return(!(this.m_Injury.m_Bandage != null) && this.m_Injury.m_Slot.m_Maggots == null && (item.m_Info.m_ID == ItemID.Maggots || item.m_Info.m_ID == ItemID.Honey_Dressing));
     }
     if (this.m_Injury.m_Type == InjuryType.SmallWoundAbrassion || this.m_Injury.m_Type == InjuryType.SmallWoundScratch || this.m_Injury.m_Type == InjuryType.WormHole)
     {
         if (this.m_Injury.m_Type == InjuryType.WormHole && this.m_Injury.m_State == InjuryState.WormInside && (item.m_Info.m_ID == ItemID.Fish_Bone || item.m_Info.m_ID == ItemID.Bone_Needle))
         {
             return(true);
         }
         if (this.m_Injury.m_Bandage != null)
         {
             return(false);
         }
         if (item.m_Info.m_Type == ItemType.Dressing)
         {
             return(true);
         }
     }
     else if (this.m_Injury.m_Type == InjuryType.Worm || (this.m_Injury.m_Type == InjuryType.WormHole && this.m_Injury.m_State == InjuryState.WormInside))
     {
         if (item.m_Info.m_ID == ItemID.Fish_Bone || item.m_Info.m_ID == ItemID.Bone_Needle)
         {
             return(true);
         }
     }
     else if (this.m_Injury.m_Type == InjuryType.VenomBite || this.m_Injury.m_Type == InjuryType.SnakeBite)
     {
         if (item.m_Info.m_ID == ItemID.Tabaco_Dressing || item.m_Info.m_ID == ItemID.lily_dressing)
         {
             return(true);
         }
     }
     else if ((this.m_Injury.m_Type == InjuryType.Laceration || this.m_Injury.m_Type == InjuryType.LacerationCat) && (this.m_Injury.m_State == InjuryState.Bleeding || this.m_Injury.m_State == InjuryState.Open))
     {
         if (item.m_Info.m_ID == ItemID.Ants)
         {
             return(true);
         }
         if (item.m_Info.m_ID == ItemID.ash_dressing || item.m_Info.m_ID == ItemID.Goliath_dressing || item.m_Info.m_ID == ItemID.Honey_Dressing || item.m_Info.m_ID == ItemID.Leaf_Bandage)
         {
             return(true);
         }
     }
     if (this.m_Injury.m_Type == InjuryType.Rash)
     {
         if (this.m_Injury.m_Bandage != null)
         {
             return(false);
         }
         if (item.m_Info.m_ID == ItemID.lily_dressing || item.m_Info.m_ID == ItemID.Honey_Dressing)
         {
             return(true);
         }
     }
     return(false);
 }
Example #16
0
    protected override bool UpdateCollisions(Triangle blade_t0, Triangle blade_t1, Triangle handle_t0, Triangle handle_t1, Vector3 hit_dir, bool damage_window, out CJObject cj_obj, out Collider collider, out bool collision_with_handle, float damage_window_start, float damage_window_end, out Vector3 hit_pos)
    {
        collision_with_handle = false;
        Vector3    zero     = Vector3.zero;
        Vector3    zero2    = Vector3.zero;
        Quaternion identity = Quaternion.identity;

        cj_obj   = null;
        collider = null;
        hit_pos  = Vector3.zero;
        Item currentItem = this.m_Player.GetCurrentItem(Hand.Right);

        if (currentItem == null || currentItem.m_Info == null)
        {
            return(false);
        }
        ItemID id = currentItem.m_Info.m_ID;

        if (!this.m_PredictionData.ContainsKey((int)id))
        {
            return(base.UpdateCollisions(blade_t0, blade_t1, handle_t0, handle_t1, hit_dir, damage_window, out cj_obj, out collider, out collision_with_handle, damage_window_start, damage_window_end, out hit_pos));
        }
        AnimatorClipInfo[] currentAnimatorClipInfo = this.m_Animator.GetCurrentAnimatorClipInfo(1);
        AnimationClip      animationClip           = null;

        for (int i = 0; i < currentAnimatorClipInfo.Length; i++)
        {
            if (this.m_PredictionData[(int)id].ContainsKey(currentAnimatorClipInfo[i].clip))
            {
                animationClip = currentAnimatorClipInfo[i].clip;
            }
        }
        if (animationClip == null)
        {
            return(base.UpdateCollisions(blade_t0, blade_t1, handle_t0, handle_t1, hit_dir, damage_window, out cj_obj, out collider, out collision_with_handle, damage_window_start, damage_window_end, out hit_pos));
        }
        List <MeleeAttackPredictionData> list      = this.m_PredictionData[(int)id][animationClip];
        AnimatorStateInfo currentAnimatorStateInfo = this.m_Animator.GetCurrentAnimatorStateInfo(1);
        float             num  = 0.02f;
        float             num2 = (this.m_LastAnimFrame >= 0f) ? (this.m_LastAnimFrame / currentAnimatorStateInfo.length) : 0f;
        float             time = num2;
        float             num3 = currentAnimatorStateInfo.normalizedTime - num2;
        int num4 = (int)(num3 / num);

        if (num4 < 1)
        {
            num4 = 1;
        }
        num3 /= (float)num4;
        for (int j = 0; j < num4; j++)
        {
            float num5 = num2 + num3 * (float)(j + 1);
            if (num5 < damage_window_start || num5 > damage_window_end)
            {
                this.m_LastAnimFrame = this.m_Animator.GetCurrentAnimatorStateInfo(1).length *num5;
                cj_obj   = null;
                collider = null;
                time     = num5;
            }
            else
            {
                Vector3 damagerStartPos  = this.GetDamagerStartPos(num5, ref list);
                Vector3 damagerEndPos    = this.GetDamagerEndPos(num5, ref list);
                Vector3 damagerStartPos2 = this.GetDamagerStartPos(time, ref list);
                Vector3 damagerEndPos2   = this.GetDamagerEndPos(time, ref list);
                this.m_BladeT0Triangle.p0 = damagerStartPos;
                this.m_BladeT0Triangle.p1 = damagerStartPos2;
                this.m_BladeT0Triangle.p2 = damagerEndPos;
                this.m_BladeT1Triangle.p0 = damagerStartPos2;
                this.m_BladeT1Triangle.p1 = damagerEndPos2;
                this.m_BladeT1Triangle.p2 = damagerEndPos;
                base.GetBoxParameters(this.m_BladeT0Triangle, this.m_BladeT1Triangle, out zero2, out zero, out identity);
                int num6 = Physics.OverlapBoxNonAlloc(zero2, zero, this.m_HitCollidersTmp, identity);
                this.SortCollisions(this.m_HitCollidersTmp, num6);
                for (int k = 0; k < num6; k++)
                {
                    bool     flag      = false;
                    Collider collider2 = this.m_HitCollidersTmp[k];
                    if (!(collider2 == this.m_Player.m_CharacterController.m_Controller))
                    {
                        if (collider2.gameObject.IsWater())
                        {
                            this.OnHitWater(collider2);
                        }
                        if ((!collider2.isTrigger || collider2.gameObject.IsAI() || collider2.gameObject.IsFish() || collider2.gameObject.GetComponent <Spikes>()) && !(collider2.gameObject == this.m_Player.gameObject) && !(collider2.gameObject == currentItem.gameObject) && !(collider2.transform.parent == Player.Get().transform.GetChild(0)) && !this.m_HitObjects.Contains(collider2.gameObject) && !(collider2.gameObject.GetComponent <Player>() != null) && !PlayerArmorModule.Get().IsgameObjectEquipedArmor(collider2.gameObject))
                        {
                            Item component = collider2.gameObject.GetComponent <Item>();
                            if (!(component != null) || component.m_Info == null || (!component.m_Info.IsParasite() && !component.m_Info.IsArmor()))
                            {
                                ItemReplacer component2 = collider2.gameObject.GetComponent <ItemReplacer>();
                                if (component2)
                                {
                                    string text = component2.m_ReplaceInfoName.ToString().ToLower();
                                    if ((text.Contains("plant") && text != "plantain_lily_leaf") || text.Contains("leaf"))
                                    {
                                        goto IL_62D;
                                    }
                                }
                                ItemHold component3 = collider2.gameObject.GetComponent <ItemHold>();
                                if (component3)
                                {
                                    string text2 = component3.m_InfoName.ToString().ToLower();
                                    if ((text2.Contains("plant") && text2 != "plantain_lily_leaf") || text2.Contains("leaf"))
                                    {
                                        goto IL_62D;
                                    }
                                }
                                AI component4 = collider2.gameObject.GetComponent <AI>();
                                if (!component4 || !component4.m_GoalsModule || component4.m_GoalsModule.m_ActiveGoal == null || component4.m_GoalsModule.m_ActiveGoal.m_Type != AIGoalType.HumanJumpBack || component4.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 0.5f)
                                {
                                    CJObject component5 = collider2.gameObject.GetComponent <CJObject>();
                                    if (component5 == null)
                                    {
                                        Transform parent = collider2.gameObject.transform.parent;
                                        while (parent != null)
                                        {
                                            component5 = parent.GetComponent <CJObject>();
                                            if (component5)
                                            {
                                                break;
                                            }
                                            parent = parent.parent;
                                        }
                                    }
                                    if (component5 != null && component5.GetHitCollisionType() == HitCollisionType.Bones)
                                    {
                                        if (base.CheckBonesIntersection(blade_t0, blade_t1, component5))
                                        {
                                            flag = true;
                                        }
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    if (flag && damage_window)
                                    {
                                        float anim_frame = num5 * currentAnimatorStateInfo.length;
                                        this.SetupAnimFrameForHit(zero2, zero, identity, anim_frame, collider2);
                                        this.m_LastBoxHalfSizes  = zero;
                                        this.m_LastBoxPos        = zero2;
                                        this.m_LastBoxQuaternion = identity;
                                        this.m_LastAnimFrame     = this.m_Animator.GetCurrentAnimatorStateInfo(1).length *num5;
                                        cj_obj   = component5;
                                        collider = collider2;
                                        hit_pos  = this.m_BladeT0Triangle.p0;
                                        float proportionalClamp = CJTools.Math.GetProportionalClamp(0f, 1f, num5, num2, currentAnimatorStateInfo.normalizedTime);
                                        this.m_AnimationStoppedHandPos = Vector3.Lerp(this.m_LastHandPos, this.m_RHand.transform.position, proportionalClamp);
                                        this.m_LastHandPos             = this.m_RHand.position;
                                        return(true);
                                    }
                                }
                            }
                        }
                    }
                    IL_62D :;
                }
                time = num5;
            }
        }
        this.m_LastBoxHalfSizes  = zero;
        this.m_LastBoxPos        = zero2;
        this.m_LastBoxQuaternion = identity;
        this.m_LastAnimFrame     = this.m_Animator.GetCurrentAnimatorStateInfo(1).length *this.m_Animator.GetCurrentAnimatorStateInfo(1).normalizedTime;
        this.m_LastHandPos       = this.m_RHand.position;
        cj_obj   = null;
        collider = null;
        return(false);
    }
Example #17
0
 public void Execute()
 {
     if (this.m_ExecutionInProgress)
     {
         return;
     }
     if (this.m_ActiveButton == null)
     {
         this.Deactivate();
         return;
     }
     if (!Inventory3DManager.Get().gameObject.activeSelf&& this.m_ActiveButton.action != HUDItem.Action.Harvest && this.m_ActiveButton.action != HUDItem.Action.Destroy && this.m_ActiveButton.action != HUDItem.Action.DestroyStack)
     {
         this.m_ActionToExecute = this.m_ActiveButton.action;
         switch (this.m_ActionToExecute)
         {
         case HUDItem.Action.Take:
         case HUDItem.Action.PickUp:
         case HUDItem.Action.Eat:
         case HUDItem.Action.Drink:
         case HUDItem.Action.Harvest:
         case HUDItem.Action.Craft:
         case HUDItem.Action.Use:
         case HUDItem.Action.Take3:
         case HUDItem.Action.TakeAll:
         case HUDItem.Action.TakeClay:
         case HUDItem.Action.CleanUp:
         case HUDItem.Action.Pick:
         case HUDItem.Action.TakeOffArmor:
         case HUDItem.Action.Plow:
         case HUDItem.Action.PickStack:
             if (WalkieTalkieController.Get().IsActive())
             {
                 WalkieTalkieController.Get().Stop();
             }
             break;
         }
         Player.Get().BlockMoves();
         Player.Get().BlockRotation();
         if (this.m_ActionToExecute == HUDItem.Action.Drink && this.m_LiquidSource)
         {
             Player.Get().HideWeapon();
             Player.Get().m_Animator.SetBool(TriggerController.Get().m_BDrinkWater, true);
         }
         else if (this.m_ActionToExecute == HUDItem.Action.CleanUp)
         {
             Player.Get().HideWeapon();
             Player.Get().m_Animator.SetBool(Player.Get().m_CleanUpHash, true);
             PlayerArmorModule.Get().SetMeshesVisible(false);
             BodyInspectionController.Get().OnArmorMeshesDisabled();
             Player.Get().OnStartWashinghands();
         }
         else
         {
             Item currentItem = Player.Get().GetCurrentItem(Hand.Left);
             if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bow)
             {
                 Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBow, true);
             }
             else if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bamboo_Bow)
             {
                 Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, true);
             }
             else if (currentItem && currentItem.m_Info.IsBow())
             {
                 Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBow, true);
             }
             else
             {
                 Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItem, true);
             }
         }
         this.m_ExecutionInProgress = true;
         return;
     }
     if (!this.ExecuteAction(this.m_ActiveButton.action, this.m_Item))
     {
         return;
     }
     base.Invoke("DelayDeactivate", this.m_DelayDeactivate);
     this.m_DelayDeactivateRequested = true;
     this.m_ElemGroup.SetActive(false);
 }
Example #18
0
    protected virtual bool UpdateCollisions(Triangle blade_t0, Triangle blade_t1, Triangle handle_t0, Triangle handle_t1, Vector3 hit_dir, bool damage_window, out CJObject cj_obj, out Collider collider, out bool collision_with_handle, float damage_window_start, float damage_window_end, out Vector3 hit_pos)
    {
        collision_with_handle = false;
        Vector3    zero     = Vector3.zero;
        Vector3    zero2    = Vector3.zero;
        Quaternion identity = Quaternion.identity;

        hit_pos = blade_t0.p0;
        this.GetBoxParameters(blade_t0, blade_t1, out zero2, out zero, out identity);
        if (!damage_window)
        {
            this.m_LastBoxHalfSizes  = zero;
            this.m_LastBoxPos        = zero2;
            this.m_LastBoxQuaternion = identity;
            this.m_LastAnimFrame     = this.m_Animator.GetCurrentAnimatorStateInfo(1).length *this.m_Animator.GetCurrentAnimatorStateInfo(1).normalizedTime;
            cj_obj   = null;
            collider = null;
            hit_pos  = Vector3.zero;
            return(false);
        }
        int num = Physics.OverlapBoxNonAlloc(zero2, zero, this.m_HitCollidersTmp, identity);

        for (int i = 0; i < num; i++)
        {
            bool     flag      = false;
            Collider collider2 = this.m_HitCollidersTmp[i];
            if (collider2.gameObject.IsWater())
            {
                this.OnHitWater(collider2);
            }
            if (!(collider2 == this.m_Player.m_CharacterController.m_Controller) && (!collider2.isTrigger || collider2.gameObject.IsAI() || collider2.gameObject.IsFish()) && !(collider2.gameObject == this.m_Player.gameObject) && !(collider2.gameObject == this.m_Player.GetCurrentItem(Hand.Right).gameObject) && !(collider2.gameObject.GetComponent <Player>() != null) && !PlayerArmorModule.Get().IsgameObjectEquipedArmor(collider2.gameObject))
            {
                CJObject component = collider2.gameObject.GetComponent <CJObject>();
                if (!this.m_HitObjects.Contains(collider2.gameObject))
                {
                    Item component2 = collider2.gameObject.GetComponent <Item>();
                    if (!component2 || !component2.m_Info.IsParasite())
                    {
                        AI component3 = collider2.gameObject.GetComponent <AI>();
                        if (!component3 || !component3.m_GoalsModule || component3.m_GoalsModule.m_ActiveGoal == null || component3.m_GoalsModule.m_ActiveGoal.m_Type != AIGoalType.HumanJumpBack || component3.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 0.5f)
                        {
                            if (component == null && collider2.gameObject.transform.parent != null)
                            {
                                component = collider2.gameObject.transform.parent.GetComponent <CJObject>();
                            }
                            if (component != null && component.GetHitCollisionType() == HitCollisionType.Bones)
                            {
                                if (this.CheckBonesIntersection(blade_t0, blade_t1, component))
                                {
                                    flag = true;
                                }
                            }
                            else
                            {
                                flag = true;
                            }
                            if (flag)
                            {
                                float anim_frame = this.m_Animator.GetCurrentAnimatorStateInfo(1).length *this.m_Animator.GetCurrentAnimatorStateInfo(1).normalizedTime;
                                this.SetupAnimFrameForHit(zero2, zero, identity, anim_frame, collider2);
                                this.m_LastBoxHalfSizes  = zero;
                                this.m_LastBoxPos        = zero2;
                                this.m_LastBoxQuaternion = identity;
                                this.m_LastAnimFrame     = this.m_Animator.GetCurrentAnimatorStateInfo(1).length *this.m_Animator.GetCurrentAnimatorStateInfo(1).normalizedTime;
                                cj_obj   = component;
                                collider = collider2;
                                hit_pos  = blade_t0.p0;
                                return(true);
                            }
                        }
                    }
                }
            }
        }
        this.m_LastBoxHalfSizes  = zero;
        this.m_LastBoxPos        = zero2;
        this.m_LastBoxQuaternion = identity;
        this.m_LastAnimFrame     = this.m_Animator.GetCurrentAnimatorStateInfo(1).length *this.m_Animator.GetCurrentAnimatorStateInfo(1).normalizedTime;
        cj_obj   = null;
        collider = null;
        return(false);
    }
Example #19
0
    private bool ExecuteAction(HUDItem.Action action, Item item)
    {
        if (action != HUDItem.Action.Close && this.m_ItemReplacer != null)
        {
            item = this.m_ItemReplacer.ReplaceItem();
            this.m_ItemReplacer = null;
        }
        switch (action)
        {
        case HUDItem.Action.Close:
            this.SetActive(false);
            break;

        case HUDItem.Action.Take:
            if (item)
            {
                item.Take();
            }
            else if (this.m_PlantFruit)
            {
                this.m_PlantFruit.Take();
            }
            break;

        case HUDItem.Action.PickUp:
            item.PickUp(true);
            break;

        case HUDItem.Action.Eat:
            if (item)
            {
                item.Eat();
            }
            else if (this.m_PlantFruit)
            {
                this.m_PlantFruit.Eat();
            }
            break;

        case HUDItem.Action.Drink:
            if (item)
            {
                item.Drink();
            }
            else if (this.m_LiquidSource)
            {
                this.m_LiquidSource.Drink();
            }
            break;

        case HUDItem.Action.Harvest:
            Player.Get().HideWeapon();
            HarvestingSmallAnimalController.Get().SetItem(item);
            Player.Get().StartController(PlayerControllerType.HarvestingSmallAnimal);
            break;

        case HUDItem.Action.Craft:
            if (Player.Get().CanStartCrafting())
            {
                if (WalkieTalkieController.Get().IsActive())
                {
                    WalkieTalkieController.Get().Stop();
                }
                if (Player.Get().GetCurrentItem(Hand.Left) == item)
                {
                    Player.Get().SetWantedItem(Hand.Left, null, true);
                }
                else if (Player.Get().GetCurrentItem(Hand.Right) == item)
                {
                    Player.Get().SetWantedItem(Hand.Right, null, true);
                }
                else if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0)
                {
                    item.m_InventorySlot.RemoveItem(item, false);
                }
                else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot)
                {
                    item.m_CurrentSlot.RemoveItem(item, false);
                }
                else if (item.m_CurrentSlot && item.m_CurrentSlot.m_WeaponRackParent)
                {
                    item.m_CurrentSlot.RemoveItem(item, false);
                }
                if (InventoryBackpack.Get().m_EquippedItem == item)
                {
                    InventoryBackpack.Get().m_EquippedItem = null;
                }
                InventoryBackpack.Get().RemoveItem(item, false);
                Storage3D.Get().RemoveItem(item, false);
                CraftingManager.Get().Activate();
                CraftingManager.Get().AddItem(item, true);
            }
            break;

        case HUDItem.Action.Fill:
            this.m_LiquidSource.TakeLiquid();
            break;

        case HUDItem.Action.Equip:
            Player.Get().Equip(item.m_CurrentSlot);
            break;

        case HUDItem.Action.Drop:
            if (CraftingManager.Get().gameObject.activeSelf&& CraftingManager.Get().ContainsItem(item))
            {
                CraftingManager.Get().RemoveItem(item, false);
            }
            if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0)
            {
                item.m_InventorySlot.RemoveItem(item, false);
            }
            else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot)
            {
                item.m_CurrentSlot.RemoveItem(item, false);
            }
            if (InventoryBackpack.Get().m_EquippedItem == item)
            {
                InventoryBackpack.Get().m_EquippedItem = null;
            }
            InventoryBackpack.Get().RemoveItem(item, false);
            Inventory3DManager.Get().DropItem(item);
            break;

        case HUDItem.Action.Swap:
            item.Swap();
            break;

        case HUDItem.Action.Use:
            if (this.m_Item.IsStorage())
            {
                Storage3D.Get().Activate((Storage)this.m_Item);
            }
            else if (MakeFireController.Get().IsActive())
            {
                InventoryBackpack.Get().RemoveItem(this.m_Item, false);
                MakeFireController.Get().InsertItemToKindlingSlot(this.m_Item);
            }
            else
            {
                Item currentItem = Player.Get().GetCurrentItem();
                if (currentItem)
                {
                    InventoryBackpack.Get().InsertItem(currentItem, InventoryBackpack.Get().m_EquippedItemSlot, null, true, true, true, true, false);
                    Player.Get().SetWantedItem(currentItem.m_Info.IsBow() ? Hand.Left : Hand.Right, null, true);
                    if (Player.Get().m_ControllerToStart != PlayerControllerType.Unknown)
                    {
                        Player.Get().StartControllerInternal();
                    }
                }
                Player.Get().SetWantedItem(this.m_Item, true);
            }
            break;

        case HUDItem.Action.Spill:
            ((LiquidContainer)this.m_Item).Spill(-1f);
            break;

        case HUDItem.Action.Destroy:
            if (GreenHellGame.IsPadControllerActive() && !this.m_DestroyButton.confirm.gameObject.activeSelf)
            {
                this.m_DestroyButton.confirm.gameObject.SetActive(true);
                this.m_DestroyButton.confirm_sel.gameObject.SetActive(true);
                return(false);
            }
            if (!this.m_DestroyButton.confirm_sel.gameObject.activeSelf)
            {
                return(true);
            }
            if (CraftingManager.Get().gameObject.activeSelf&& CraftingManager.Get().ContainsItem(item))
            {
                CraftingManager.Get().RemoveItem(item, false);
            }
            if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0)
            {
                item.m_InventorySlot.RemoveItem(item, false);
            }
            else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot)
            {
                item.m_CurrentSlot.RemoveItem(item, false);
            }
            if (InventoryBackpack.Get().m_EquippedItem == item)
            {
                InventoryBackpack.Get().m_EquippedItem = null;
            }
            InventoryBackpack.Get().RemoveItem(item, false);
            UnityEngine.Object.Destroy(item.gameObject);
            break;

        case HUDItem.Action.Take3:
            if (item)
            {
                item.Take3();
            }
            break;

        case HUDItem.Action.TakeAll:
            if (item)
            {
                item.TakeAll();
            }
            break;

        case HUDItem.Action.TakeClay:
            if (this.m_LiquidSource)
            {
                this.m_LiquidSource.TakeClay();
            }
            break;

        case HUDItem.Action.CleanUp:
            PlayerArmorModule.Get().SetMeshesVisible(true);
            BodyInspectionController.Get().OnArmorMeshesEnabled();
            Player.Get().m_Animator.SetBool(Player.Get().m_CleanUpHash, false);
            break;

        case HUDItem.Action.DestroyStack:
            if (GreenHellGame.IsPadControllerActive() && !this.m_DestroyStackButton.confirm.gameObject.activeSelf)
            {
                this.m_DestroyStackButton.confirm.gameObject.SetActive(true);
                this.m_DestroyStackButton.confirm_sel.gameObject.SetActive(true);
                return(false);
            }
            if (!this.m_DestroyStackButton.confirm_sel.gameObject.activeSelf)
            {
                return(true);
            }
            if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0)
            {
                UnityEngine.Object.Destroy(item.gameObject);
            }
            else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot)
            {
                UnityEngine.Object.Destroy(item.m_CurrentSlot.m_ItemParent.gameObject);
            }
            else if (item.m_CurrentSlot && item.m_CurrentSlot.m_BackpackSlot && item.m_CurrentSlot.IsStack())
            {
                for (int i = 0; i < ((ItemSlotStack)item.m_CurrentSlot).m_Items.Count; i++)
                {
                    UnityEngine.Object.Destroy(((ItemSlotStack)item.m_CurrentSlot).m_Items[i].gameObject);
                }
            }
            break;

        case HUDItem.Action.SwapArmor:
        {
            Limb      selectedLimb  = HUDBodyInspection.Get().GetSelectedLimb();
            ArmorData armorData     = PlayerArmorModule.Get().GetArmorData(selectedLimb);
            Item      attachedArmor = armorData.m_AttachedArmor;
            ItemSlot  currentSlot   = attachedArmor.m_CurrentSlot;
            if (currentSlot != null)
            {
                currentSlot.RemoveItem();
            }
            PlayerArmorModule.Get().ArmorCarryStarted(attachedArmor);
            InventoryCellsGroup inventoryCellsGroup = this.m_Item.m_Info.m_InventoryCellsGroup;
            InventoryBackpack.Get().RemoveItem(this.m_Item, false);
            if (attachedArmor.m_Info.m_InventoryRotated != this.m_Item.m_Info.m_InventoryRotated)
            {
                Inventory3DManager.Get().RotateItem(attachedArmor, false);
            }
            InventoryBackpack.Get().InsertItem(attachedArmor, null, inventoryCellsGroup, true, true, true, true, true);
            armorData.m_Slot.InsertItem(this.m_Item);
            break;
        }

        case HUDItem.Action.EquipArmor:
            InventoryBackpack.Get().RemoveItem(this.m_Item, false);
            PlayerArmorModule.Get().GetArmorData(HUDBodyInspection.Get().GetSelectedLimb()).m_Slot.InsertItem(this.m_Item);
            break;

        case HUDItem.Action.Insert:
            if (HUDItemSlot.Get().m_SelectedSlotData == null)
            {
                return(false);
            }
            if (!HUDItemSlot.Get().m_SelectedSlotData.slot.CanInsertItem(this.m_Item))
            {
                ((HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages))).AddMessage(GreenHellGame.Instance.GetLocalization().Get("HUD_CannotInsertItem", true), new Color?(Color.red), HUDMessageIcon.None, "", null);
                return(true);
            }
            if (this.m_Item.m_Storage)
            {
                this.m_Item.m_Storage.RemoveItem(this.m_Item, false);
            }
            InventoryBackpack.Get().RemoveItem(this.m_Item, false);
            HUDItemSlot.Get().m_SelectedSlotData.slot.InsertItem(this.m_Item);
            break;

        case HUDItem.Action.Pick:
            Inventory3DManager.Get().StartCarryItem(this.m_Item, false);
            break;

        case HUDItem.Action.TakeOffArmor:
        {
            Item attachedArmor2 = PlayerArmorModule.Get().GetArmorData(HUDBodyInspection.Get().GetSelectedLimb()).m_AttachedArmor;
            if (attachedArmor2)
            {
                PlayerArmorModule.Get().ArmorCarryStarted(attachedArmor2);
                InventoryBackpack.Get().InsertItem(attachedArmor2, null, null, true, true, true, true, true);
            }
            break;
        }

        case HUDItem.Action.Plow:
        {
            Acre acre = (this.m_Item && this.m_Item.IsAcre()) ? ((Acre)this.m_Item) : null;
            if (!acre)
            {
                return(true);
            }
            acre.Plow();
            break;
        }

        case HUDItem.Action.PickStack:
            Inventory3DManager.Get().StartCarryItem(this.m_Item, true);
            break;
        }
        return(true);
    }