Beispiel #1
0
        public static string GetAlertRewards(dynamic alert)
        {
            var reward = alert.MissionInfo.missionReward ?? alert.Reward;
            var rtn    = reward.credits != null?reward.credits.ToString("n0") + "cr" : "0cr";

            if (reward.countedItems != null && reward.countedItems.Count > 0)
            {
                for (var i = 0; i < reward.countedItems.Count; i++)
                {
                    string rawtext;
                    var    item = reward.countedItems[i];
                    if (item.ItemCount == 1)
                    {
                        rawtext = FlatFile.GetName((string)item.ItemType);
                    }
                    else
                    {
                        rawtext = item.ItemCount + " " +
                                  FlatFile.GetName((string)item.ItemType);
                    }
                    rtn += " - " + rawtext;
                }
            }
            if (reward.items != null && reward.items.Count > 0)
            {
                for (var i = 0; i < reward.items.Count; i++)
                {
                    var item = reward.items[i];
                    rtn += " - " + FlatFile.GetName((string)item);
                }
            }
            return(rtn);
        }
Beispiel #2
0
        public static string[] GetInvasionRewards(Invasion invasion)
        {
            var atkrewtext = "";

            if (invasion.Faction != "FC_INFESTATION")
            {
                var atkreward = invasion.AttackerReward;
                if (atkreward.countedItems != null && atkreward.countedItems.Count > 0)
                {
                    var item = atkreward.countedItems[0];
                    if (item.ItemCount == 1)
                    {
                        atkrewtext = FlatFile.GetName((string)item.ItemType);
                    }
                    else
                    {
                        atkrewtext = item.ItemCount + " " + FlatFile.GetName((string)item.ItemType);
                    }
                }
                else if (atkreward.credits != null)
                {
                    atkrewtext = ((int)atkreward.credits).ToString("n0") + "cr";
                }
            }
            else
            {
                atkrewtext = "0cr";
            }
            var defreward  = invasion.DefenderReward;
            var defrewtext = "";

            if (defreward.countedItems != null && defreward.countedItems.Count > 0)
            {
                var item = defreward.countedItems[0];
                if (item.ItemCount == 1)
                {
                    defrewtext = FlatFile.GetName(item.ItemType);
                }
                else
                {
                    defrewtext = item.ItemCount + " " + FlatFile.GetName(item.ItemType);
                }
            }
            else if (defreward.credits != null)
            {
                defrewtext = ((int)defreward.credits).ToString("n0") + "cr";
            }
            return(new[] { atkrewtext, defrewtext });
        }