Beispiel #1
0
        public List <IActivity> FeedToAlert(List <FeedDTO> feeds, E_Platforms platform)
        {
            bool newAlert = false;

            List <IActivity> lst = new List <IActivity>();

            foreach (FeedDTO f in feeds)
            {
                if (MainActivitiesList.Where(i => i.Type == E_Activities.Alert && i.Id == f.Id).Count() == 0)
                {
                    switch ((E_Activities)System.Enum.Parse(typeof(E_Activities), f.Author, true))
                    {
                    case E_Activities.Alert:
                        //Information to set similar to other activities
                        //It is separated because of the instantiation of different classes
                        newAlert = true;
                        Alert a = new Alert(f.Title);
                        a.Id               = f.Id;
                        a.PublishDate      = f.PublishDate;
                        a.Platform         = platform;
                        a.PropertyChanged += ActivityStatusChanged;     //This is used to ref

                        //Information to set different from other activities
                        a.Description    = f.Description;
                        a.ExpirationDate = f.ExpireDate;
                        a.Faction        = (E_Factions)System.Enum.Parse(typeof(E_Factions), f.Faction.Split('_')[1], true);

                        //Add the activity to the list
                        lst.Add(a);
                        break;

                    case E_Activities.Outbreak:
                        Outbreak o = new Outbreak(f.Title);
                        o.Id               = f.Id;
                        o.PublishDate      = f.PublishDate;
                        o.Platform         = platform;
                        o.PropertyChanged += ActivityStatusChanged;

                        lst.Add(o);
                        break;

                    case E_Activities.Invasion:
                        Invasion i = new Invasion(f.Title);
                        i.Id               = f.Id;
                        i.PublishDate      = f.PublishDate;
                        i.Platform         = platform;
                        i.PropertyChanged += ActivityStatusChanged;

                        lst.Add(i);
                        break;

                    default:
                        break;
                    }
                }
            }
            //if (newAlert && !_firstUpdate)
            //  PlayNew();
            return(lst);
        }
Beispiel #2
0
    public void save()
    {
        string     filePath   = Application.dataPath + "/Ressources/Save/saveFile.json";
        List <Tip> tipsToSave = GameObject.FindGameObjectWithTag("TipManager").GetComponent <TipsManager>().tipsKnownByPlayer;
        List <MutationManager.MutationData> mutationsToSave = GameObject.FindGameObjectWithTag("MutationManager").GetComponent <MutationManager>().allMutations;
        GameObject _invasionFile = GameObject.Find("Invasion");
        Invasion   _invasion     = _invasionFile.GetComponent <Invasion>();
        int        _wave         = _invasion.invasionSize;

        _tips      = JsonMapper.ToJson(tipsToSave);
        _mutations = JsonMapper.ToJson(mutationsToSave);

        string tmp_file = "{ \"tips\": " + _tips.ToString() + ", \"mutations\" :" + _mutations.ToString() + ", \"wave\":" + _wave + " }";

        if (!Directory.Exists(Application.dataPath + "/Ressources/Save"))
        {
            Directory.CreateDirectory(Application.dataPath + "/Ressources/Save");
        }

        if (File.Exists(filePath))
        {
            //  bool yesWasClicked = EditorUtility.DisplayDialog("Save the game", "Are you sure to replace your previous save?", "Yes", "No");
            //  if (yesWasClicked)
            File.WriteAllText(Application.dataPath + "/Ressources/Save/saveFile.json", tmp_file);
        }
        else
        {
            File.WriteAllText(Application.dataPath + "/Ressources/Save/saveFile.json", tmp_file);
        }
    }
        /// <summary>
        /// Called when the mod is loaded.
        /// </summary>
        public override void OnLoad()
        {
            Invasion.LoadVanilla();
            DateEvent.LoadVanilla();

            LoadBiomes();
            LoadInvasions();
            LoadSpawns();

            base.OnLoad();

            tomeSkillHotkey    = options[0];
            shadowMirrorHotkey = options[1];

            MWorld.managers    = new SkillManager[1];
            MWorld.tomes       = new Item        [1];
            MWorld.accessories = new Item        [1][];

            MWorld.tomes   [0] = new Item();

            for (int i = 0; i < MWorld.accessories.Length; i++)
            {
                MWorld.accessories[i] = new Item[ExtraSlots];

                for (int j = 0; j < MWorld.accessories[i].Length; j++)
                {
                    MWorld.accessories[i][j] = new Item();
                }
            }

            // insert all graphical/UI-related stuff AFTER this check!
            if (Main.dedServ)
            {
                return;
            }

            Texture2D gWings = textures["Resources/Wings/Golden Wings"];

            foreach (Texture2D t in Main.wingsTexture.Values)
            {
                if (gWings == t)
                {
                    addedWings = true;
                    break;
                }
            }

            if (!addedWings)
            {
                GoldenWings = Main.dedServ ? Main.wingsTexture.Count : ObjectLoader.AddWingsToGame(gWings);

                addedWings = true;
            }

            StarterSetSelectionHandler.Init();
        }
 /// <summary>
 /// Creates a new Invasion with values copied from another.
 /// </summary>
 public Invasion(Invasion clone) : base(clone)
 {
     HostEventEntityID     = clone.HostEventEntityID;
     InvasionEventEntityID = clone.InvasionEventEntityID;
     InvasionRegionIndex   = clone.InvasionRegionIndex;
     SoundIDMaybe          = clone.SoundIDMaybe;
     MapEventIDMaybe       = clone.MapEventIDMaybe;
     FlagsMaybe            = clone.FlagsMaybe;
     UnkT18 = clone.UnkT18;
 }
Beispiel #5
0
 public InvasionViewModel(Invasion invasion, FiltersEvent filtersEvent, IItemStore itemStore)
 {
     this.invasion = invasion;
     Id            = invasion.Id;
     isDefenderFactionInfestation = invasion.DefenderMissionInfo.Faction == "FC_INFESTATION";
     AttackerFaction = FactionViewModel.ById(invasion.AttackerMissionInfo.Faction);
     DefenderFaction = FactionViewModel.ById(invasion.DefenderMissionInfo.Faction);
     Faction         = FactionViewModel.ById(invasion.Faction);
     Sector          = SectorViewModel.FromSector(invasion.Node);
     LocTag          = Model.Filters.ExpandMission(invasion.LocTag)?.Name ?? invasion.LocTag;
     DefenderReward  = new InvasionRewardViewModel(invasion.DefenderReward, itemStore);
     AttackerReward  = new InvasionRewardViewModel(invasion.AttackerReward, itemStore);
     Update();
     SectorsUpdatedWeakEventManager.AddHandler(filtersEvent, OnSectorsFilterUpdated);
     MissionsUpdatedWeakEventManager.AddHandler(filtersEvent, OnMissionsFilterUpdated);
 }
Beispiel #6
0
        public InvasionScoresOverviewGump(
            PlayerMobile user,
            Invasion invasion,
            Gump parent = null)
            : base(user, parent, 150, 100, emptyText: "No Scores to Display.", title: "")
        {
            PlayerScores = invasion.ParticipantsScores;
            Invasion     = invasion;

            EntriesPerPage = 10;

            Modal    = false;
            CanClose = true;
            CanMove  = true;
            //ForceRecompile = true;
        }
Beispiel #7
0
        private List <IActivity> FeedToActivity(List <FeedDTO> feeds, Enum platform)
        {
            List <IActivity> lst = new List <IActivity>();

            foreach (FeedDTO f in feeds)
            {
                IActivity activity = _mData.Activities.Where(i => i.Id == f.Id).FirstOrDefault();
                if (activity == null)
                {
                    switch ((GAME.Modules.Warframe.Common.Missions.Enums.Type)System.Enum.Parse(typeof(GAME.Modules.Warframe.Common.Missions.Enums.Type), f.Author, true))
                    {
                    case GAME.Modules.Warframe.Common.Missions.Enums.Type.Alert:
                        //Information to set different from other activities
                        //It is separated because of the instantiation of different classes
                        activity = new Alert(f.Title);

                        ((Alert)activity).Description    = f.Description;
                        ((Alert)activity).ExpirationDate = f.ExpireDate;
                        //a.Faction = (E_Factions)System.Enum.Parse(typeof(E_Factions), f.Faction.Split('_')[1], true);
                        break;

                    case GAME.Modules.Warframe.Common.Missions.Enums.Type.Outbreak:
                        activity = new Outbreak(f.Title);
                        break;

                    case GAME.Modules.Warframe.Common.Missions.Enums.Type.Invasion:
                        activity = new Invasion(f.Title);
                        break;

                    default:
                        break;
                    }

                    activity.Id          = f.Id;
                    activity.PublishDate = f.PublishDate;
                    activity.Platform    = platform;
                    activity.Viewed      = _oData.ViewedActivities.Contains(activity.Id);
                    activity.Done        = false;
                    activity.Marked      = false;
                }
                //a.PropertyChanged += ActivityStatusChanged; //This is used to ref

                //Add the activity to the list
                lst.Add(activity);
            }
            return(lst);
        }
        private static bool IsInterestingInvasion(Invasion invasion)
        {
            bool IsCrappyReward(Reward reward)
            {
                return(reward.CountedItems.Any(i =>
                                               i.Type.Contains("Detonite Injector", StringComparison.CurrentCultureIgnoreCase) ||
                                               i.Type.Contains("Fieldron", StringComparison.CurrentCultureIgnoreCase)
                                               //|| i.Type.Contains("Mutagen Mass", StringComparison.CurrentCultureIgnoreCase)
                                               || i.Type.Contains("Mutalist Alad V Nav Coordinate", StringComparison.CurrentCultureIgnoreCase)
                                               ));
            }

            // phorid assassinations are fastest
            return((invasion.IsVsInfestation ? invasion.Description.Contains("Phorid", StringComparison.CurrentCultureIgnoreCase) : true) &&
                   !IsCrappyReward(invasion.AttackerReward) &&
                   !IsCrappyReward(invasion.DefenderReward));
        }
        private static string FormatInvasion(Invasion invasion)
        {
            string FormatFaction(bool isAttacker)
            {
                var faction = isAttacker ? invasion.AttackingFaction : invasion.DefendingFaction;
                var reward  = isAttacker ? invasion.AttackerReward : invasion.DefenderReward;

                return($"{FormatReward(reward)} ({faction})"); // FormatCountedItems(reward.CountedItems); // (reward.CountedItems.Count > 0 ? ((reward.CountedItems.Count > 1 ? $" x{reward.CountedItems.Count}" : string.Empty) + $" ({reward.CountedItems[0].Type})") : string.Empty);
            }

            string attackerReward;

            // infested are always the attacker and can't be sided with, hence no rewards
            if (invasion.IsVsInfestation)
            {
                attackerReward = string.Empty;
            }
            else
            {
                attackerReward = FormatFaction(true) + " vs ";
            }

            return($"> {FormatPercentage(invasion.Completion)} | {attackerReward}{FormatFaction(false)} | {invasion.Node}");
        }
Beispiel #10
0
 public static void AddInvasion(Platform platform, Invasion invasion)
 {
     InvasionDictionary[platform].Add(invasion._id.id, invasion);
     SerializeInvasion(platform);
 }
Beispiel #11
0
 public ParsedInvasion(Invasion invasion)
 {
     this.invasion = invasion;
     reward        = new ParsedReward(invasion);
     node          = new ParsedNode(invasion);
 }
 public static string ToTitle(Invasion inv)
 {
     return(inv.AttackingFaction + "(" + ToTitle(inv.AttackerReward) + ") vs. " + inv.DefendingFaction + "(" + ToTitle(inv.DefenderReward) + ") - " + inv.Node + " - " + inv.Description + " - " + inv.Completion + "%");
 }
 static void LoadInvasions()
 {
     Invasion.Load(Instance, "Wraiths", Wraiths = new WraithInvasion());
 }
Beispiel #14
0
 public ParsedNode(Invasion invasion)
 {
     LoadFromNode(invasion.Node, out Sector, out Planet);
 }
Beispiel #15
0
 public ParsedReward(Invasion invasion)
 {
     SetRewards("Invasion", invasion.AttackerReward, invasion.DefenderReward);
 }