public static void PlayerSelection_ShowOutline_Prefix_HighlightLoot(PlayerSelection __instance, EntityComponent entity, ref PlayerSelection.SelectionType type, Single intensity = 0f, Single outline = 0.002f)
        {
            const PlayerSelection.SelectionType GrayColor   = unchecked ((PlayerSelection.SelectionType) 0xFF____80_80_80);
            const PlayerSelection.SelectionType VioletColor = unchecked ((PlayerSelection.SelectionType) 0xFF__EA_04_FF);

            if (type != PlayerSelection.SelectionType.Select)
            {
                return;
            }

            if (entity is CharacterComponent charComp)
            {
                if (!charComp.IsDead())
                {
                    return;
                }

                const String key = "AtomRPG.NuclearEdition.ShowOutline_Prefix_HighlightLoot.OnDeadLoot";

                if (!charComp.Character.HasKey(key))
                {
                    charComp.Character.AddKey(key);

                    Boolean fromCannibal = Game.World.Player.CharacterComponent.Character.CharProto.Stats.HasPerk(CharacterStats.Perk.Cannibal);
                    charComp.OnDeadLoot(fromCannibal);
                }

                if (charComp.Character.GetItemsCost() == 0)
                {
                    type = GrayColor;
                }
            }
            else if (entity is ChestComponent chestComp)
            {
                Chest chest = chestComp.chest;
                if (chest.lockLevel != 0)
                {
                    type = VioletColor;
                    return;
                }

                if (chest.Inventory.Count == 0)
                {
                    type = GrayColor;
                }
            }
        }
        public static void Prefix(PlayerSelection __instance, EntityComponent entity, ref PlayerSelection.SelectionType type, Single intensity = 0f)
        {
            const PlayerSelection.SelectionType GrayColor   = unchecked ((PlayerSelection.SelectionType) 0xFF____80_80_80);
            const PlayerSelection.SelectionType VioletColor = unchecked ((PlayerSelection.SelectionType) 0xFF__EA_04_FF);

            if (type != PlayerSelection.SelectionType.Select)
            {
                return;
            }

            if (Game.World.Player.CharacterComponent.Character.Hallucinating.Level != ConditionLevel.Normal)
            {
                return;
            }

            if (entity is CharacterComponent characterComponent)
            {
                if (CharacterComponentHelper.TryGetLootCost(characterComponent, out var cost) && cost == 0)
                {
                    type = GrayColor;
                }
            }
            else if (entity is ChestComponent chestComponent)
            {
                Chest chest = chestComponent.chest;
                if (chest.lockLevel != 0)
                {
                    type = VioletColor;
                    return;
                }

                if (chest.Inventory.Count == 0)
                {
                    type = GrayColor;
                }
            }
            else if (entity is DoorComponent doorComponent)
            {
                var door = doorComponent.door;
                if (door.lockLevel != 0)
                {
                    type = VioletColor;
                    return;
                }
            }
        }
Пример #3
0
        public static Boolean Prefix(PlayerSelection __instance, PlayerSelection.SelectionType type, ref Color __result)
        {
            UInt32 colorBits = (UInt32)type;

            if (colorBits < 0x01000000)
            {
                return(HarmonyPrefixResult.CallOriginal);
            }

            Single a = ((colorBits & 0xFF_00_00_00) >> 24) / 256.0f;
            Single r = ((colorBits & 0x00_FF_00_00) >> 16) / 256.0f;
            Single g = ((colorBits & 0x00_00_FF_00) >> 8) / 256.0f;
            Single b = (colorBits & 0x00_00_00_FF) / 256.0f;

            __result = new Color(r, g, b, a);
            return(HarmonyPrefixResult.SkipOriginal);
        }
        public static Boolean PlayerSelection_GetColorBySelection_Prefix_HighlightLoot(PlayerSelection __instance, PlayerSelection.SelectionType type, ref Color __result)
        {
            UInt32 colorBits = (UInt32)type;

            if (colorBits < 0x01000000)
            {
                return(true);
            }

            Single a = ((colorBits & 0xFF_00_00_00) >> 24) / 256.0f;
            Single r = ((colorBits & 0x00_FF_00_00) >> 16) / 256.0f;
            Single g = ((colorBits & 0x00_00_FF_00) >> 8) / 256.0f;
            Single b = (colorBits & 0x00_00_00_FF) / 256.0f;

            __result = new Color(r, g, b, a);
            return(false);
        }