Example #1
0
        public TeamDefinition UpdateTeamDefinition(TeamDefinition teamDefinition)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamDefinitionRepository teamDefinitionRepository = _DataRepositoryFactory.GetDataRepository <ITeamDefinitionRepository>();

                TeamDefinition updatedEntity = null;

                if (teamDefinition.TeamDefinitionId == 0)
                {
                    updatedEntity = teamDefinitionRepository.Add(teamDefinition);
                }
                else
                {
                    updatedEntity = teamDefinitionRepository.Update(teamDefinition);
                }

                return updatedEntity;
            }));
        }
Example #2
0
        public static void DisplayUnlocks(string category, Unlock[] unlocks, string start = "")
        {
            if (unlocks == null || unlocks.Length == 0)
            {
                return;
            }
            Log($"{start}\t{category} Unlocks");

            foreach (Unlock unlock in unlocks)
            {
                Log($"{start}\t\t{unlock.GetName()} ({unlock.Rarity} {unlock.Type})");
                if (!string.IsNullOrEmpty(unlock.Description))
                {
                    Log($"{start}\t\t\t{unlock.Description}");
                }

                if (!string.IsNullOrEmpty(unlock.AvailableIn))
                {
                    Log($"{start}\t\t\t{unlock.AvailableIn}");
                }

                if (unlock.STU.m_0B1BA7C1 != null)
                {
                    TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1);
                    Log($"{start}\t\t\tTeam: {teamDef.FullName}");
                #if DEBUG
                    // todo
                    //System.Diagnostics.Debug.Assert(teamDef.Division < Enum_5A789F71.WorldCup, "teamDef.Division >= Enum_5A789F71.x063F4077");
                #endif
                }
            }
        }
        public HttpResponseMessage UpdateTeamDefinition(HttpRequestMessage request, [FromBody] TeamDefinition teamdefinitionModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var teamdefinition = _MPRCoreService.UpdateTeamDefinition(teamdefinitionModel);

                return request.CreateResponse <TeamDefinition>(HttpStatusCode.OK, teamdefinition);
            }));
        }
        public HttpResponseMessage GetTeamDefinitionByCode(HttpRequestMessage request, string definitionCode)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                TeamDefinition teamDefinition = _MPRCoreService.GetTeamDefinitionByCode(definitionCode);

                // notice no need to create a seperate model object since TeamDefinition entity will do just fine
                response = request.CreateResponse <TeamDefinition>(HttpStatusCode.OK, teamDefinition);

                return response;
            }));
        }
        public Ship SpawnShip(Vector3 pos, Quaternion rot, TeamDefinition team)
        {
            var ship = ShipType.CreateShip(pos, rot);
            ship.name = Name;

            var targetable = ship.gameObject.AddComponent<Targetable>();
            targetable.Faction = team.Name;

            if (modulePreset)
            {
                modulePreset.Apply(ship);
            }

            return ship;
        }
Example #6
0
        public void Parse(ICLIFlags toolFlags)
        {
            foreach (ulong key in TrackedFiles[0xEC])
            {
                TeamDefinition teamDef = new TeamDefinition(key);

                Log($"{teamDef.FullName} ({teamDef.Abbreviation})");
                Log($"    Division: {teamDef.Division}");


                // todo: fix later or something
                // tbh i don't think anyone is that interested
                //Log($"\t     Color: {teamColors/.Hex()}");
                //Log($"\t    Colors:");
                //Log($"\t\tColor 1: {teamColors.m_D74D5F6F.Color1?.Hex() ?? "N/A"}");
                //Log($"\t\tColor 2: {teamColors.m_D74D5F6F.Color2?.Hex() ?? "N/A"}");
                //Log($"\t\tColor 3: {teamColors.m_D74D5F6F.Color3?.Hex() ?? "N/A"}");
                //Log($"\t\tColor 4: {teamColors.m_D74D5F6F.Color4?.Hex() ?? "N/A"}");
                //Log();
            }
        }
Example #7
0
        public TeamDefinition GetTeamDefinition(int teamDefinitionId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamDefinitionRepository teamDefinitionRepository = _DataRepositoryFactory.GetDataRepository <ITeamDefinitionRepository>();

                TeamDefinition teamDefinitionEntity = teamDefinitionRepository.Get(teamDefinitionId);
                if (teamDefinitionEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("TeamDefinition with ID of {0} is not in database", teamDefinitionId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return teamDefinitionEntity;
            }));
        }
        public HttpResponseMessage DeleteTeamDefinition(HttpRequestMessage request, [FromBody] int teamDefinitionId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                TeamDefinition teamDefinition = _MPRCoreService.GetTeamDefinition(teamDefinitionId);

                if (teamDefinition != null)
                {
                    _MPRCoreService.DeleteTeamDefinition(teamDefinitionId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No teamDefinition found under that ID.");
                }

                return response;
            }));
        }
Example #9
0
        public static void SaveUnlock(ICLIFlags flags, Unlock unlock, string path, string eventKey,
                                      Dictionary <string, ParsedArg> config,
                                      Dictionary <string, TagExpectedValue> tags, VoiceSet voiceSet, STUHero hero)
        {
            string rarity;

            if (tags != null)
            {
                if (unlock.STU.m_0B1BA7C1 == null)
                {
                    rarity             = unlock.Rarity.ToString();
                    tags["leagueTeam"] = new TagExpectedValue("none");
                }
                else
                {
                    TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1);
                    tags["leagueTeam"] = new TagExpectedValue(teamDef.Abbreviation, // NY
                                                              teamDef.Location,     // New York
                                                              teamDef.Name,         // Excelsior
                                                              teamDef.FullName,     // New York Excelsior
                                                              (teamDef.Division == Enum_5A789F71.None && teamDef.Abbreviation == null) ? "none" : "*",
                                                              "*");                 // all

                    // nice file structure
                    rarity   = "";
                    eventKey = "League";
                }
                tags["rarity"] = new TagExpectedValue(unlock.Rarity.ToString());

                tags["special"] = new TagExpectedValue(unlock.Tag ?? "none");
            }
            else
            {
                rarity = ""; // for general unlocks
            }

            var eventMap = GetEventConfig();

            if (unlock.STU.m_BEE9BCDA != null)
            {
                var formalEventKey = unlock.STU.m_BEE9BCDA.FirstOrDefault(x => eventMap.ContainsKey(x));
                if (eventMap.ContainsKey(formalEventKey))
                {
                    eventKey = eventMap[formalEventKey];
                }
            }

            string thisPath = Path.Combine(path, unlock.GetTypeNameEnum(), eventKey, rarity, GetValidFilename(unlock.GetName()));

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SprayPaint)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_AvatarPortrait)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_POTGAnimation)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Emote)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Pose)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_VoiceLine)))
            {
                VoiceLine.Save(flags, thisPath, unlock, voiceSet);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SkinTheme)))
            {
                SkinTheme.Save(flags, thisPath, unlock, hero);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_PortraitFrame)))
            {
                thisPath = Path.Combine(path, unlock.Type);
                PortraitFrame.Save(flags, thisPath, unlock);
            }
        }
Example #10
0
 public TeamDefinition UpdateTeamDefinition(TeamDefinition teamDefinition)
 {
     return(Channel.UpdateTeamDefinition(teamDefinition));
 }
Example #11
0
        private List <TeamDeepModel> GetSelectedTeams(IEnumerable <TeamDeepModel> items, TeamDefinition teamDefinition)
        {
            var nodes = new List <TeamDeepModel>();

            foreach (var item in items)
            {
                if (item.Depth == teamDefinition.Position)
                {
                    nodes.Add(item);
                }
                else
                {
                    nodes.AddRange(GetSelectedTeams(item.Children, teamDefinition));
                }
            }

            return(nodes);
        }
Example #12
0
 public void AddTeam(TeamDefinition team)
 {
     Teams.Add(team);
 }
Example #13
0
        private static void ProcessHeroNames(DynamicChoicesContainer container)
        {
            var heroContainer = container.GetType(VALID_HERO_NAMES);
            var npcContainer  = container.GetType(VALID_NPC_NAMES);
            var owlTeams      = container.GetType(VALID_OWL_TEAMS);

            HashSet <string> handledTeams = new HashSet <string>();

            Dictionary <ulong, STUHero> heroes          = new Dictionary <ulong, STUHero>();
            Dictionary <string, int>    nameOccurrances = new Dictionary <string, int>();

            foreach (ulong heroGUID in Program.TrackedFiles[0x75])
            {
                var hero = STUHelper.GetInstance <STUHero>(heroGUID);
                if (hero == null)
                {
                    continue;
                }

                string heroNameActual = Hero.GetCleanName(hero);
                if (heroNameActual == null)
                {
                    continue;
                }

                heroes[heroGUID] = hero;
                if (nameOccurrances.TryGetValue(heroNameActual, out _))
                {
                    nameOccurrances[heroNameActual]++;
                }
                else
                {
                    nameOccurrances[heroNameActual] = 0;
                }
            }

            foreach (ulong heroGUID in Program.TrackedFiles[0x75])
            {
                if (!heroes.TryGetValue(heroGUID, out var hero))
                {
                    continue;
                }
                string heroNameActual = Hero.GetCleanName(hero);

                var doGuidName = nameOccurrances[heroNameActual] > 1;
                if (doGuidName)
                {
                    heroNameActual += $" ({teResourceGUID.Index(heroGUID):X})";
                }

                ProgressionUnlocks progressionUnlocks = new ProgressionUnlocks(hero);

                var choice = new DynamicChoice {
                    DisplayName = heroNameActual,
                    QueryName   = $"{teResourceGUID.Index(heroGUID):X}"
                };

                if (progressionUnlocks.LevelUnlocks == null)
                {
                    npcContainer.Choices.Add(choice);
                }
                else
                {
                    heroContainer.Choices.Add(choice);
                }

                foreach (var unlock in progressionUnlocks.IterateUnlocks())
                {
                    if (string.IsNullOrWhiteSpace(unlock.Name))
                    {
                        continue;
                    }

                    if (unlock.STU.m_0B1BA7C1 != null)
                    {
                        TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1);
                        if (!(teamDef.Division == Enum_5A789F71.None && teamDef.Location == null))
                        {
                            if (handledTeams.Add(teamDef.FullName))
                            {
                                owlTeams.Choices.Add(new DynamicChoice {
                                    DisplayName = teamDef.FullName,
                                    QueryName   = teamDef.FullName
                                });
                            }
                            continue;
                        }
                    }

                    var key = "datatool.ux.valid_" + Unlock.GetTypeName(unlock.STU.GetType()).ToLowerInvariant() + "_names";

                    if (choice.Children == null)
                    {
                        choice.Children = new DynamicChoicesContainer();
                    }

                    var test = choice.Children.GetType(key);
                    test.Choices.Add(new DynamicChoice {
                        QueryName   = unlock.Name,
                        DisplayName = unlock.Name
                    });
                }
            }
        }
Example #14
0
        public static void SaveUnlock(ICLIFlags flags, Unlock unlock, string path, string eventKey,
                                      Dictionary <string, ParsedArg> config,
                                      Dictionary <string, TagExpectedValue> tags, VoiceSet voiceSet, STUHero hero)
        {
            string rarity;

            if (tags != null)
            {
                if (unlock.STU.m_0B1BA7C1 == null)
                {
                    rarity             = unlock.Rarity.ToString();
                    tags["leagueTeam"] = new TagExpectedValue("none");
                }
                else
                {
                    TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1);
                    tags["leagueTeam"] = new TagExpectedValue(teamDef.Abbreviation, // NY
                                                              teamDef.Location,     // New York
                                                              teamDef.Name,         // Excelsior
                                                              teamDef.FullName,     // New York Excelsior
                                                              "*");                 // all

                    // nice file structure
                    rarity   = "";
                    eventKey = "League";
                }
                tags["rarity"] = new TagExpectedValue(unlock.Rarity.ToString());

                //if (UnlockData.SummerGames2016.Contains(unlock.GUID)) {
                //    tags["special"] = new TagExpectedValue("sg2016");
                //} if (UnlockData.SummerGames2017.Contains(unlock.GUID)) {
                //    tags["special"] = new TagExpectedValue("sg2017");
                //} else
                if (UnlockData.SummerGames2018.Contains(unlock.GUID))
                {
                    tags["special"] = new TagExpectedValue("sg2018");
                }
                else
                {
                    tags["special"] = new TagExpectedValue("none");
                }
            }
            else
            {
                rarity = ""; // for general unlocks
            }

            string thisPath = Path.Combine(path, unlock.Type, eventKey, rarity, GetValidFilename(unlock.GetName()));

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SprayPaint)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_AvatarPortrait)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_POTGAnimation)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Emote)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Pose)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_VoiceLine)))
            {
                VoiceLine.Save(flags, thisPath, unlock, voiceSet);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SkinTheme)))
            {
                SkinTheme.Save(flags, thisPath, unlock, hero);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_PortraitFrame)))
            {
                thisPath = Path.Combine(path, unlock.Type);
                PortraitFrame.Save(flags, thisPath, unlock);
            }
        }