public CoachRecord GetCoachById(int id)
        {
            currentstreamedID = -1;
            currentCoachID    = -1;

            // we want to return the ROS/FRA coach record if it exists
            foreach (TableRecordModel record in model.TableModels[EditorModel.COACH_TABLE].GetRecords())
            {
                if (((CoachRecord)record).CoachId == id)
                {
                    currentCoachID = id;
                    CoachRecord cr = (CoachRecord)record;
                    return(cr);
                }
            }

            // Doesnt exist in ROS/FRA so let's see if it is in the streameddata coch table
            if (manager.stream_model != null)
            {
                foreach (TableRecordModel rec in manager.stream_model.TableModels[EditorModel.COACH_COLLECTIONS_TABLE].GetRecords())
                {
                    if (rec.Deleted)
                    {
                        continue;
                    }
                    CoachCollection coachc = (CoachCollection)rec;
                    if (coachc.CoachId == id)
                    {
                        currentstreamedID = id;
                        CoachRecord cr = SetCoachFromCollection(coachc);
                        return(cr);
                    }
                }
            }

            return(null);
        }
예제 #2
0
        public TableRecordModel ConstructRecordModel(int recno)
        {
            TableRecordModel newRecord = null;
            string           tablename = name;

            // Need to reverse the name if BE
            if (BigEndian)
            {
                string rev = ConvertBE(name);
                tablename = rev;
            }

            switch (tablename)
            {
            case EditorModel.CITY_TABLE:
                newRecord = new CityRecord(recno, this, parentModel);
                break;

            case EditorModel.COACH_TABLE:
            {
                // coch table in streameddata is different than ros/fra
                if (parentModel.FileType == MaddenFileType.Streameddata)
                {
                    newRecord = new CoachCollection(recno, this, parentModel);
                }
                else
                {
                    newRecord = new CoachRecord(recno, this, parentModel);
                }
                break;
            }

            case EditorModel.SALARY_CAP_TABLE:
                newRecord = new SalaryCapRecord(recno, this, parentModel);
                break;

            case EditorModel.COACH_SLIDER_TABLE:
                newRecord = new CoachPrioritySliderRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_CAPTAIN_TABLE:
                newRecord = new TeamCaptainRecord(recno, this, parentModel);
                break;

            case EditorModel.OWNER_TABLE:
                newRecord = new OwnerRecord(recno, this, parentModel);
                break;

            case EditorModel.DEPTH_CHART_TABLE:
                newRecord = new DepthChartRecord(recno, this, parentModel);
                break;

            case EditorModel.INJURY_TABLE:
                newRecord = new InjuryRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_TABLE:
                newRecord = new PlayerRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_TABLE:
                newRecord = new TeamRecord(recno, this, parentModel);
                break;

            case EditorModel.SCHEDULE_TABLE:
                newRecord = new ScheduleRecord(recno, this, parentModel);
                break;

            case EditorModel.STADIUM_TABLE:
                newRecord = new StadiumRecord(recno, this, parentModel);
                break;

            case EditorModel.UNIFORM_TABLE:
                newRecord = new UniformRecord(recno, this, parentModel);
                break;

            // MADDEN DRAFT EDIT
            case EditorModel.DRAFT_PICK_TABLE:
                newRecord = new DraftPickRecord(recno, this, parentModel);
                break;

            case EditorModel.DRAFTED_PLAYERS_TABLE:
                newRecord = new RookieRecord(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_DEFENSE_TABLE:
                newRecord = new BoxScoreDefenseRecord(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_OFFENSE_TABLE:
                newRecord = new BoxScoreOffenseRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_DEFENSE_TABLE:
                newRecord = new CareerStatsDefenseRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_OFFENSE_TABLE:
                newRecord = new CareerStatsOffenseRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_DEFENSE_TABLE:
                newRecord = new SeasonStatsDefenseRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_OFFENSE_TABLE:
                newRecord = new SeasonStatsOffenseRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_SEASON_STATS:
                newRecord = new TeamSeasonStatsRecord(recno, this, parentModel);
                break;

            case EditorModel.FRANCHISE_TIME_TABLE:
                newRecord = new FranchiseTimeRecord(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_TEAM_TABLE:
                newRecord = new BoxScoreTeamStats(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_OFFENSIVE_LINE_TABLE:
                newRecord = new BoxScoreOffensiveLineRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_OFFENSIVE_LINE_TABLE:
                newRecord = new SeasonStatsOffensiveLineRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_OFFENSIVE_LINE_TABLE:
                newRecord = new CareerStatsOffensiveLineRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_GAMES_PLAYED_TABLE:
                newRecord = new CareerGamesPlayedRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_GAMES_PLAYED_TABLE:
                newRecord = new SeasonGamesPlayedRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_KICKPUNT_TABLE:
                newRecord = new CareerPuntKickRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_KICKPUNT_TABLE:
                newRecord = new SeasonPuntKickRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_KICKPUNT_RETURN_TABLE:
                newRecord = new CareerPKReturnRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_KICKPUNT_RETURN_TABLE:
                newRecord = new SeasonPKReturnRecord(recno, this, parentModel);
                break;

            case EditorModel.SCOUTING_STATE_TABLE:
                newRecord = new ScoutingStateRecord(recno, this, parentModel);
                break;

            case EditorModel.RFA_STATE_TABLE:
                newRecord = new RFAStateRecord(recno, this, parentModel);
                break;

            case EditorModel.RFA_PLAYERS:
                newRecord = new RestrictedFreeAgentPlayers(recno, this, parentModel);
                break;

            case EditorModel.RFA_SALARY_TENDERS:
                newRecord = new RestrictedFreeAgentSigningTenders(recno, this, parentModel);
                break;

            case EditorModel.RESIGN_PLAYERS_STATE_TABLE:
                newRecord = new ResignPlayersStateRecord(recno, this, parentModel);
                break;

            case EditorModel.FREE_AGENCY_STATE_TABLE:
                newRecord = new FreeAgencyStateRecord(recno, this, parentModel);
                break;

            case EditorModel.DRAFT_STATE_TABLE:
                newRecord = new DraftStateRecord(recno, this, parentModel);
                break;

            case EditorModel.FRANCHISE_STAGE_TABLE:
                newRecord = new FranchiseStageRecord(recno, this, parentModel);
                break;

            case EditorModel.GAME_OPTIONS_TABLE:
                newRecord = new GameOptionRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_AWARDS_TABLE:
                newRecord = new YearlyAwards(recno, this, parentModel);
                break;

            case EditorModel.FREE_AGENT_PLAYERS:
                newRecord = new FreeAgentPlayers(recno, this, parentModel);
                break;

            case EditorModel.COACHES_EXPECTED_SALARY:
                newRecord = new CoachExpectedSalary(recno, this, parentModel);
                break;

            case EditorModel.COACHING_HISTORY_TABLE:
                newRecord = new CoachHistory(recno, this, parentModel);
                break;

            case EditorModel.PROGRESSION_SCHEDULE:
                newRecord = new ProgressionSchedule(recno, this, parentModel);
                break;

            case EditorModel.USER_OPTIONS_TABLE:
                newRecord = new UserOptionRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_RIVAL_HISTORY:
                newRecord = new TeamRivalHistory(recno, this, parentModel);
                break;

            case EditorModel.PRO_BOWL_PLAYERS:
                newRecord = new ProBowlPlayer(recno, this, parentModel);
                break;

            case EditorModel.USER_INFO_TABLE:
                newRecord = new UserInfoRecord(recno, this, parentModel);
                break;

                #region Streamed Data
            case EditorModel.COLLEGES_TABLE:
                newRecord = new CollegesRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_FIRST_NAMES:
                newRecord = new FirstNames(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_LAST_NAMES:
                newRecord = new LastNames(recno, this, parentModel);
                break;

            case EditorModel.ROLES_DEFINE:
                newRecord = new PRDF(recno, this, parentModel);
                break;

            case EditorModel.ROLES_INFO:
                newRecord = new RoleInfo(recno, this, parentModel);
                break;

            case EditorModel.ROLES_PLAYER_EFFECTS:
                newRecord = new RolePlayerEffects(recno, this, parentModel);
                break;

            case EditorModel.ROLES_TEAM_EFFECTS:
                newRecord = new RoleTeamEffects(recno, this, parentModel);
                break;

            case EditorModel.STATS_REQUIRED:
                newRecord = new SuperStarStatsRequired(recno, this, parentModel);
                break;

            case EditorModel.PROGRESSION:
                newRecord = new PlayerProgression(recno, this, parentModel);
                break;

            case EditorModel.REGRESSION:
                newRecord = new PlayerRegression(recno, this, parentModel);
                break;

            case EditorModel.PTCB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTCE:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTDE:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTDT:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTFB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTFS:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTGA:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTHB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTKI:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTKP:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTMB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTOB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTPU:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTQB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTSS:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTTA:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTTE:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTWR:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

                #endregion

            case EditorModel.POSITION_SUBS:
                newRecord = new PlayerSubs(recno, this, parentModel);
                break;

            case EditorModel.DEPTH_CHART_SUBS:
                newRecord = new DepthChartSubs(recno, this, parentModel);
                break;

            case EditorModel.SALARY_CAP_INCREASE:
                newRecord = new SalaryCapIncrease(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_MINIMUM_SALARY_TABLE:
                newRecord = new SalaryYearsPro(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_SALARY_DEMAND_TABLE:
                newRecord = new PlayerSalaryDemands(recno, this, parentModel);
                break;

            case EditorModel.INACTIVE_TABLE:
                newRecord = new InactiveRecord(recno, this, parentModel);
                break;

            case EditorModel.LEAGUE_REVENUE_TABLE:
                newRecord = new LeagueRevenue(recno, this, parentModel);
                break;

            case EditorModel.OWNER_REVENUE_TABLE:
                newRecord = new OwnerRevenue(recno, this, parentModel);
                break;

            case EditorModel.WEEKLY_INCOME_TABLE:
                newRecord = new Income(recno, this, parentModel);
                break;

            case EditorModel.TEAM_WIN_LOSS_RECORD:
                newRecord = new TeamWinLossRecord(recno, this, parentModel);
                break;

            // DB Templates
            case EditorModel.PLAYER_OVERALL_CALC:
                newRecord = new OverallRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYBOOK_TABLE:
                newRecord = new FRAPlayBooks(recno, this, parentModel);
                break;

            default:
                newRecord = new TableRecordModel(recno, this, parentModel);
                break;
            }

            //Add the new record to our list of records
            recordList.Add(newRecord);

            return(newRecord);
        }
        public CoachRecord SetCoachFromCollection(CoachCollection collection)
        {
            CoachRecord newcoach = (CoachRecord)model.TableModels[EditorModel.COACH_TABLE].CreateNewRecord(true);

            newcoach.wasinstreamed = true;

            newcoach.Age                 = collection.Age;
            newcoach.BodySize            = collection.BodySize;
            newcoach.Chemistry           = collection.Chemistry;
            newcoach.CoachId             = collection.CoachId;
            newcoach.ContractLength      = collection.ContractLength;
            newcoach.CareerLosses        = collection.CareerLosses;
            newcoach.PlayoffLosses       = collection.PlayoffLosses;
            newcoach.PlayoffsMade        = collection.PlayoffsMade;
            newcoach.PlayoffWins         = collection.PlayoffWins;
            newcoach.Cctc                = collection.Cctc;
            newcoach.CareerTies          = collection.CareerTies;
            newcoach.CareerWins          = collection.CareerWins;
            newcoach.WinningSeasons      = collection.WinningSeasons;
            newcoach.DefenseRating       = collection.DefenseRating;
            newcoach.DefensivePlaybook   = collection.DefensivePlaybook;
            newcoach.DefensiveAggression = collection.DefensiveAggression;
            newcoach.DefensiveStrategy   = collection.DefensiveStrategy;
            newcoach.Ethics              = collection.Ethics;
            newcoach.CPUDraftPlayer      = collection.CPUDraftPlayer;
            newcoach.CPUSignDraftPicks   = collection.CPUSignDraftPicks;
            newcoach.CPUControlled       = collection.CPUControlled;
            newcoach.CPUSignFreeAgents   = collection.CPUSignFreeAgents;
            newcoach.CPUFillRosters      = collection.CPUFillRosters;
            newcoach.cfhl                = collection.cfhl;
            newcoach.CPUResignPlayers    = collection.CPUResignPlayers;
            newcoach.CPUManageDepth      = collection.CPUManageDepth;
            newcoach.Cfsh                = collection.Cfsh;
            newcoach.UserControlled      = collection.UserControlled;
            newcoach.Char                = collection.Char;
            newcoach.height              = collection.height;
            newcoach.HeadHair            = collection.HeadHair;
            newcoach.Chsd                = collection.Chsd;
            newcoach.Chty                = collection.Chty;
            newcoach.Knowledge           = collection.Knowledge;
            newcoach.Name                = collection.Name;
            newcoach.LastTeamFranchise   = collection.LastTeamFranchise;
            newcoach.LastTeamRelocated   = collection.LastTeamRelocated;
            newcoach.Motivation          = collection.Motivation;
            newcoach.Offense             = collection.Offense;
            newcoach.Position            = collection.Position;
            newcoach.OffensiveAggression = collection.OffensiveAggression;
            newcoach.OffensiveStrategy   = collection.OffensiveStrategy;
            newcoach.CoachOfTheYear      = collection.CoachOfTheYear;
            newcoach.OffensivePlaybook   = collection.OffensivePlaybook;
            newcoach.FaceId              = collection.FaceId;
            newcoach.RBCarryDist         = collection.RBCarryDist;
            newcoach.CoachDB             = collection.CoachDB;
            newcoach.CoachDL             = collection.CoachDL;
            newcoach.KickerRating        = collection.CoachKS;
            newcoach.CoachLB             = collection.CoachLB;
            newcoach.CoachOL             = collection.CoachOL;
            newcoach.CoachPS             = collection.CoachPS;
            newcoach.CoachQB             = collection.CoachQB;
            newcoach.CoachRB             = collection.CoachRB;
            newcoach.CoachS              = collection.CoachS;
            newcoach.CoachWR             = collection.CoachWR;
            newcoach.Salary              = collection.Salary;
            newcoach.SuperBowlLoses      = collection.SuperBowlLoses;
            newcoach.SuperBowlWins       = collection.SuperBowlWins;
            newcoach.SkinColor           = collection.SkinColor;
            newcoach.Cspc                = collection.Cspc;
            newcoach.Coachpic            = collection.Coachpic;
            newcoach.CoachGlasses        = collection.CoachGlasses;
            newcoach.Cthg                = collection.Cthg;
            newcoach.WasPlayer           = collection.WasPlayer;
            newcoach.TeamId              = collection.TeamId;

            return(newcoach);
        }
        public void InitCoachList()
        {
            if (coachlist == null)
            {
                coachlist = new List <int>();
            }
            else
            {
                coachlist.Clear();
            }
            if (CoachNames == null)
            {
                CoachNames = new Dictionary <int, string>();
            }
            else
            {
                CoachNames.Clear();
            }
            Duplicates.Clear();
            currentstreamedID = -1;
            currentCoachID    = -1;

            if (FilterCoachTeam == -2)
            {
                if (manager.stream_model == null)
                {
                    return;
                }
                foreach (CoachCollection coll in manager.stream_model.TableModels[EditorModel.COACH_COLLECTIONS_TABLE].GetRecords())
                {
                    if (coll.Deleted)
                    {
                        continue;
                    }
                    else if (coll.TeamId == 1023 && !coachlist.Contains(coll.CoachId))
                    {
                        coachlist.Add(coll.CoachId);
                    }
                    else
                    {
                        continue;
                    }
                }

                coachlist.Sort();
                foreach (int i in coachlist)
                {
                    foreach (TableRecordModel rec in manager.stream_model.TableModels[EditorModel.COACH_COLLECTIONS_TABLE].GetRecords())
                    {
                        if (rec.Deleted)
                        {
                            continue;
                        }

                        CoachCollection coachcoll = (CoachCollection)rec;
                        if (i == coachcoll.CoachId && !CoachNames.ContainsKey(coachcoll.CoachId))
                        {
                            CoachNames.Add(coachcoll.CoachId, coachcoll.Name);
                        }
                    }
                }

                bool stop = true;
            }

            else
            {
                foreach (TableRecordModel rec in model.TableModels[EditorModel.COACH_TABLE].GetRecords())
                {
                    if (rec.Deleted)
                    {
                        continue;
                    }
                    else
                    {
                        bool        add   = false;
                        CoachRecord coach = (CoachRecord)rec;

                        if (FilterCoachTeam == -1 && FilterCoachPosition == -1)
                        {
                            add = true;
                        }

                        else if (FilterCoachPosition == -1 || FilterCoachTeam == -1)
                        {
                            if (FilterCoachPosition == -1 && FilterCoachTeam == coach.TeamId)
                            {
                                add = true;
                            }

                            else if (FilterCoachTeam == -1 && FilterCoachPosition == coach.Position)
                            {
                                //if (coach.TeamId >=0 && coach.TeamId <= 31)   // Most coaches are listed as head coaches
                                add = true;
                            }
                            else
                            {
                                continue;
                            }
                        }

                        else if (FilterCoachPosition == coach.Position && FilterCoachTeam == coach.TeamId)
                        {
                            add = true;
                        }

                        else
                        {
                            continue;
                        }

                        if (add)
                        {
                            if (!coachlist.Contains(coach.CoachId))
                            {
                                coachlist.Add(coach.CoachId);
                            }
                            else
                            {
                                if (!Duplicates.ContainsKey(coach.CoachId))
                                {
                                    Duplicates.Add(coach.CoachId, coach.Name);
                                }
                            }
                        }
                    }
                }


                coachlist.Sort();

                foreach (int i in coachlist)
                {
                    if (!CoachNames.ContainsKey(i))
                    {
                        CoachNames.Add(i, GetCoachById(i).Name);
                    }
                    else
                    {
                        if (!Duplicates.ContainsKey(i))
                        {
                            Duplicates.Add(i, GetCoachById(i).Name);
                        }
                    }
                }
            }
        }
예제 #5
0
        public Coach(CoachCollection rec)
        {
            NAME                 = rec.Name;
            COACH_ID             = rec.CoachId;
            TEAM_ID              = rec.TeamId;
            POSITION             = rec.Position;
            LAST_TEAM            = rec.LastTeam;
            CONTRACT_LENGTH      = rec.ContractLength;
            SALARY               = rec.Salary;
            years_exp            = 0;
            USER_CONTROLLED      = rec.UserControlled;
            CPU_CONTROLLED       = rec.CPUControlled;
            CPU_DRAFT_PLAYER     = rec.CPUDraftPlayer;
            CPU_SIGN_DRAFT_PICKS = rec.CPUSignDraftPicks;
            CPU_SIGN_FREE_AGENTS = rec.CPUSignFreeAgents;
            CPU_FILL_ROSTERS     = rec.CPUFillRosters;
            CPU_RESIGN_PLAYERS   = rec.CPUResignPlayers;
            CPU_MANAGE_DEPTH     = rec.CPUManageDepth;
            if (POSITION == 0)
            {
                CPU_SIGN_COACHES = true;
            }
            else
            {
                CPU_SIGN_COACHES = false;
            }
            EGO              = 50;
            PATIENCE         = 50;
            KNOWLEDGE        = rec.Knowledge;
            SPENDING         = 50;
            LOYALTY          = 50;
            RISK             = 50;
            ETHICS           = rec.Ethics;
            MORALE           = 50;
            CHEMISTRY        = rec.Chemistry;
            DEFENSE          = rec.DefenseRating;
            DEF_AGGR         = rec.DefensiveAggression;
            DEF_STRAT        = rec.DefensiveStrategy;
            MOTIVATION       = rec.Motivation;
            OFFENSE          = rec.Offense;
            OFF_AGGR         = rec.OffensiveAggression;
            OFF_STRAT        = rec.OffensiveStrategy;
            RB_CARRY_DIST    = rec.RBCarryDist;
            DB_RATING        = rec.CoachDB;
            DL_RATING        = rec.CoachDL;
            K_RATING         = rec.CoachKS;
            LB_RATING        = rec.CoachLB;
            OL_RATING        = rec.CoachOL;
            P_RATING         = rec.CoachPS;
            QB_RATING        = rec.CoachQB;
            RB_RATING        = rec.CoachRB;
            S_RATING         = rec.CoachS;
            WR_RATING        = rec.CoachWR;
            HC_GM            = false;
            HC_OC            = false;
            HC_DC            = false;
            CanBeInterviewed = true;
            CanBeHired       = true;
            InPlayoffs       = false;

            History    = new Dictionary <int, CoachHistory>();
            Priorities = new Dictionary <int, Pri>();
            Interviews = new List <int>();
            Offers     = new Dictionary <int, Dictionary <int, double> >();
        }