Exemplo n.º 1
0
        public void SetItem(BountyInfo info)
        {
            BountyInfo = info;

            var displayName = GetDisplayName();
            var canUse      = BountyInfo.State == BountyState.Available || BountyInfo.State == BountyState.Complete;

            NameText.text  = displayName;
            NameText.color = canUse ? Color.white : Color.gray;

            RewardTextIron.text = BountyInfo.RewardIron.ToString();
            RewardTextIron.transform.parent.gameObject.SetActive(BountyInfo.RewardIron > 0);
            RewardTextGold.text = BountyInfo.RewardGold.ToString();
            RewardTextGold.transform.parent.gameObject.SetActive(BountyInfo.RewardGold > 0);
            RewardTextCoin.text = BountyInfo.RewardCoins.ToString();
            RewardTextCoin.transform.parent.gameObject.SetActive(BountyInfo.RewardCoins > 0);

            Icon.sprite = AdventureDataManager.GetTrophyIconForMonster(BountyInfo.Target.MonsterID, BountyInfo.RewardGold > 0);
            Icon.color  = canUse ? Color.white : new Color(1.0f, 0.0f, 1.0f, 0.0f);

            RewardLabel.SetActive(BountyInfo.State == BountyState.Available);
            InProgressLabel.SetActive(BountyInfo.State == BountyState.InProgress);
            CompleteLabel.SetActive(BountyInfo.State == BountyState.Complete);

            Button.onClick.RemoveAllListeners();
            Button.onClick.AddListener(() => OnSelected?.Invoke(BountyInfo));

            if (Tooltip != null)
            {
                Tooltip.m_topic = displayName;
                Tooltip.m_text  = Localization.instance.Localize(GetTooltip());
            }
        }
Exemplo n.º 2
0
        private string GetTooltip()
        {
            _sb.Clear();
            var biome       = $"$biome_{BountyInfo.Biome.ToString().ToLower()}";
            var monsterName = AdventureDataManager.GetMonsterName(BountyInfo.Target.MonsterID).ToLowerInvariant();
            var targetName  = string.IsNullOrEmpty(BountyInfo.TargetName) ? "" : $"<color=orange>{BountyInfo.TargetName}</color>, ";
            var slayMessage = BountyInfo.Adds.Count > 0 ? "$mod_epicloot_bounties_tooltip_slaymultiple" : "$mod_epicloot_bounties_tooltip_slay";

            //"mod_epicloot_bounties_tooltip": "Travel to the <color=#31eb41>$1</color> and locate $2 the <color=#f03232>$3</color>. $4. Return to me when it is done.",
            var tooltipText = Localization.instance.Localize("$mod_epicloot_bounties_tooltip", biome, targetName, monsterName, slayMessage);

            _sb.AppendLine(tooltipText);
            _sb.AppendLine();

            _sb.AppendLine("<color=#ffc400>$mod_epicloot_bounties_tooltip_rewards</color>");
            if (BountyInfo.RewardIron > 0)
            {
                _sb.AppendLine($"  {MerchantPanel.GetIronBountyTokenName()} x{BountyInfo.RewardIron}");
            }
            if (BountyInfo.RewardGold > 0)
            {
                _sb.AppendLine($"  {MerchantPanel.GetGoldBountyTokenName()} x{BountyInfo.RewardGold}");
            }
            if (BountyInfo.RewardCoins > 0)
            {
                _sb.AppendLine($"  {MerchantPanel.GetCoinsName()} x{BountyInfo.RewardCoins}");
            }

            _sb.AppendLine();
            _sb.AppendLine("<color=#ffc400>$mod_epicloot_bounties_tooltip_status</color>");
            switch (BountyInfo.State)
            {
            case BountyState.Available:
                _sb.AppendLine($"  {Localization.instance.Localize("$mod_epicloot_bounties_tooltip_available")}");
                break;

            case BountyState.InProgress:
                _sb.AppendLine("  <color=#00f0ff>$mod_epicloot_bounties_tooltip_inprogress</color>");
                break;

            case BountyState.Complete:
                _sb.AppendLine("  <color=#70f56c>$mod_epicloot_bounties_tooltip_vanquished</color>");
                break;

            case BountyState.Claimed:
                _sb.AppendLine("  $mod_epicloot_bounties_tooltip_claimed");
                break;
            }

            return(Localization.instance.Localize(_sb.ToString()));
        }
Exemplo n.º 3
0
        public static void UpdateDynamicPins_Postfix(Minimap __instance)
        {
            var player = Player.m_localPlayer;

            if (player == null)
            {
                return;
            }

            var adventureSaveData = player.GetAdventureSaveData();

            if (adventureSaveData == null)
            {
                return;
            }

            var unfoundTreasureChests = adventureSaveData.GetUnfoundTreasureChests();
            var oldPins = TreasureMapPins.Where(pinEntry => !unfoundTreasureChests.Exists(x => x.Interval == pinEntry.Key.Item1 && x.Biome == pinEntry.Key.Item2)).ToList();

            foreach (var pinEntry in oldPins)
            {
                __instance.RemovePin(pinEntry.Value.Pin);
                __instance.RemovePin(pinEntry.Value.Area);
                if (pinEntry.Value.DebugPin != null)
                {
                    __instance.RemovePin(pinEntry.Value.DebugPin);
                }
                TreasureMapPins.Remove(pinEntry.Key);
            }

            foreach (var chestInfo in unfoundTreasureChests)
            {
                var key = new Tuple <int, Heightmap.Biome>(chestInfo.Interval, chestInfo.Biome);
                if (!TreasureMapPins.ContainsKey(key))
                {
                    var position = chestInfo.Position + chestInfo.MinimapCircleOffset;
                    var area     = __instance.AddPin(position, Minimap.PinType.EventArea, string.Empty, false, false);
                    area.m_worldSize = AdventureDataManager.Config.TreasureMap.MinimapAreaRadius * AreaScale;
                    var label = Localization.instance.Localize("$mod_epicloot_treasurechest_minimappin", Localization.instance.Localize($"$biome_{chestInfo.Biome.ToString().ToLowerInvariant()}"), (chestInfo.Interval + 1).ToString());
                    var pin   = __instance.AddPin(position, EpicLoot.TreasureMapPinType, label, false, false);

                    if (DebugMode)
                    {
                        var debugPin = __instance.AddPin(chestInfo.Position, Minimap.PinType.Icon3, $"{chestInfo.Position.x:0.0}, {chestInfo.Position.z:0.0}", false, false);
                        TreasureMapPins.Add(key, new AreaPinInfo()
                        {
                            Pin = pin, Area = area, DebugPin = debugPin
                        });
                    }
                    else
                    {
                        TreasureMapPins.Add(key, new AreaPinInfo()
                        {
                            Pin = pin, Area = area
                        });
                    }
                }
            }

            var currentBounties = adventureSaveData.GetInProgressBounties();
            var oldBountyPins   = BountyPins.Where(pinEntry => !currentBounties.Exists(x => x.ID == pinEntry.Key)).ToList();

            foreach (var pinEntry in oldBountyPins)
            {
                __instance.RemovePin(pinEntry.Value.Pin);
                __instance.RemovePin(pinEntry.Value.Area);
                BountyPins.Remove(pinEntry.Key);
            }

            foreach (var bounty in currentBounties)
            {
                var key = bounty.ID;
                if (!BountyPins.ContainsKey(key))
                {
                    var position = bounty.Position + bounty.MinimapCircleOffset;
                    var area     = __instance.AddPin(position, Minimap.PinType.EventArea, string.Empty, false, false);
                    area.m_worldSize = AdventureDataManager.Config.TreasureMap.MinimapAreaRadius * AreaScale;
                    var label = Localization.instance.Localize("$mod_epicloot_bounties_minimappin", AdventureDataManager.GetBountyName(bounty));
                    var pin   = __instance.AddPin(position, EpicLoot.BountyPinType, label, false, false);

                    if (DebugMode)
                    {
                        var debugPin = __instance.AddPin(bounty.Position, Minimap.PinType.Icon3, $"{bounty.Position.x:0.0}, {bounty.Position.z:0.0}", false, false);
                        BountyPins.Add(key, new AreaPinInfo()
                        {
                            Pin = pin, Area = area, DebugPin = debugPin
                        });
                    }
                    else
                    {
                        BountyPins.Add(key, new AreaPinInfo()
                        {
                            Pin = pin, Area = area
                        });
                    }
                }
            }
        }
Exemplo n.º 4
0
 private string GetDisplayName()
 {
     return(Localization.instance.Localize(AdventureDataManager.GetBountyName(BountyInfo)));
 }