public bool ChangeCoachControl(int newPosition) { if (CurrentCoachRecord.Position == newPosition) { return(false); } // Assume coach is all cpu controlled CurrentCoachRecord.CPUControlled = true; CurrentCoachRecord.CPUSignDraftPicks = true; CurrentCoachRecord.CPUDraftPlayer = true; CurrentCoachRecord.CPUSignFreeAgents = true; CurrentCoachRecord.CPUFillRosters = true; CurrentCoachRecord.CPUResignPlayers = true; CurrentCoachRecord.CPUManageDepth = true; CurrentCoachRecord.UserControlled = false; if (newPosition == (int)MaddenCoachPosition.HeadCoach) { foreach (OwnerRecord rec in model.TableModels[EditorModel.OWNER_TABLE].GetRecords()) { OwnerRecord owner = (OwnerRecord)rec; if (owner.TeamId != CurrentCoachRecord.TeamId) { continue; } if (owner.UserControlled) { // Coach's Team is user owned so set heach coach to thoss preferences CurrentCoachRecord.CPUControlled = owner.CPUControlled; CurrentCoachRecord.CPUSignDraftPicks = owner.SignDraftPicks; CurrentCoachRecord.CPUDraftPlayer = owner.DraftPlayers; CurrentCoachRecord.CPUSignFreeAgents = owner.SignFreeAgents; CurrentCoachRecord.CPUFillRosters = owner.FillRosters; CurrentCoachRecord.CPUResignPlayers = owner.ResignPlayers; CurrentCoachRecord.CPUManageDepth = owner.ReorderDepthCharts; CurrentCoachRecord.UserControlled = owner.UserControlled; } break; } } return(true); }
public static Quotas Initialize(File file) { Index ownerIndex = file.CreateIndex("$O", (AttributeType)0, AttributeCollationRule.Sid); Index quotaIndox = file.CreateIndex("$Q", (AttributeType)0, AttributeCollationRule.UnsignedLong); IndexView <OwnerKey, OwnerRecord> ownerIndexView = new IndexView <OwnerKey, OwnerRecord>(ownerIndex); IndexView <OwnerRecord, QuotaRecord> quotaIndexView = new IndexView <OwnerRecord, QuotaRecord>(quotaIndox); OwnerKey adminSid = new OwnerKey(new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null)); OwnerRecord adminOwnerId = new OwnerRecord(256); ownerIndexView[adminSid] = adminOwnerId; quotaIndexView[new OwnerRecord(1)] = new QuotaRecord(null); quotaIndexView[adminOwnerId] = new QuotaRecord(adminSid.Sid); return(new Quotas(file)); }
public static Quotas Initialize(File file) { Index ownerIndex = file.CreateIndex("$O", (AttributeType)0, AttributeCollationRule.Sid); Index quotaIndox = file.CreateIndex("$Q", (AttributeType)0, AttributeCollationRule.UnsignedLong); IndexView<OwnerKey, OwnerRecord> ownerIndexView = new IndexView<OwnerKey, OwnerRecord>(ownerIndex); IndexView<OwnerRecord, QuotaRecord> quotaIndexView = new IndexView<OwnerRecord, QuotaRecord>(quotaIndox); OwnerKey adminSid = new OwnerKey(new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null)); OwnerRecord adminOwnerId = new OwnerRecord(256); ownerIndexView[adminSid] = adminOwnerId; quotaIndexView[new OwnerRecord(1)] = new QuotaRecord(null); quotaIndexView[adminOwnerId] = new QuotaRecord(adminSid.Sid); return new Quotas(file); }
public void SetOwner(OwnerRecord or) { this.USER_CONTROLLED = false; if (!or.CPUControlled) { this.USER_CONTROLLED = true; } this.CPU_DRAFT_PLAYER = or.DraftPlayers; this.CPU_SIGN_DRAFT_PICKS = or.SignDraftPicks; this.CPU_SIGN_FREE_AGENTS = or.SignFreeAgents; this.CPU_FILL_ROSTERS = or.FillRosters; this.CPU_RESIGN_PLAYERS = or.ResignPlayers; this.CPU_RESIGN_PLAYERS = or.ResignPlayers; this.CPU_MANAGE_DEPTH = or.ReorderDepthCharts; this.CPU_SIGN_COACHES = false; if (this.POSITION == 0) { this.CPU_SIGN_COACHES = true; } }
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 void InitTeamView() { if (teamview != null) { teamview.Dispose(); } teamview = new DataGridView(); teamview.Bounds = new Rectangle(new Point(1, 1), new Size(658, 760)); teamview.MultiSelect = false; teamview.RowHeadersVisible = false; teamview.AutoGenerateColumns = false; teamview.ScrollBars = ScrollBars.Vertical; teamview.Dock = DockStyle.Fill; teamview.AllowUserToAddRows = false; teamview.ColumnCount = 10; teamview.Columns[0].Name = "Team"; teamview.Columns[0].Width = 100; teamview.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[1].Name = "Owner"; teamview.Columns[1].Width = 50; teamview.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[2].Name = "Coach"; teamview.Columns[2].Width = 50; teamview.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[3].Name = "Draft"; teamview.Columns[3].Width = 50; teamview.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[4].Name = "Sign Picks"; teamview.Columns[4].Width = 70; teamview.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[5].Name = "Sign FA"; teamview.Columns[5].Width = 60; teamview.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[6].Name = "Fill Rosters"; teamview.Columns[6].Width = 70; teamview.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[7].Name = "Re-Sign"; teamview.Columns[7].Width = 60; teamview.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[8].Name = "Reorder"; teamview.Columns[8].Width = 60; teamview.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable; teamview.Columns[9].Name = "Play"; teamview.Columns[9].Width = 50; teamview.Columns[9].SortMode = DataGridViewColumnSortMode.NotSortable; InitTeamPlayGames(); foreach (TableRecordModel rec in model.TableModels[EditorModel.OWNER_TABLE].GetRecords()) { OwnerRecord owner = (OwnerRecord)rec; // coach controlled options are in the coach table, overrides anything set in the owner table if (owner.TeamId > 31) { continue; } string teamname = owner.TeamName; string ownedby = "CPU"; if (owner.UserControlled) { ownedby = "USER"; } string coachcontrol = "CPU"; string draftplayer = "CPU"; string signpicks = "CPU"; string signfreeagents = "CPU"; string fillrosters = "CPU"; string resignplayers = "CPU"; string reorderdepth = "CPU"; string playgames = "NO"; foreach (TableRecordModel record in model.TableModels[EditorModel.COACH_TABLE].GetRecords()) { CoachRecord crec = (CoachRecord)record; if (owner.TeamId == crec.TeamId && crec.Position == 0) // Position 0 is Head coach { if (crec.UserControlled == true) { coachcontrol = "USER"; playgames = "YES"; } if (crec.CPUDraftPlayer == false) { draftplayer = "USER"; } if (crec.CPUSignDraftPicks == false) { signpicks = "USER"; } if (crec.CPUSignFreeAgents == false) { signfreeagents = "USER"; } if (crec.CPUFillRosters == false) { fillrosters = "USER"; } if (crec.CPUResignPlayers == false) { resignplayers = "USER"; } if (crec.CPUManageDepth == false) { reorderdepth = "USER"; } if (PlayGamesList[owner.TeamId].Contains(true)) { playgames = "YES"; } if (!PlayGamesList[owner.TeamId].Contains(true)) { playgames = "NO"; } } } string[] entry = { teamname, ownedby, coachcontrol, draftplayer, signpicks, signfreeagents, fillrosters, resignplayers, reorderdepth, playgames }; teamview.Rows.Add(entry); } teamview.CellClick += teamview_CellClick; panel2.Controls.Add(teamview); }
public void ApplyChanges() { // set owner table for user/cpu controlled teams for (int o = 0; o < teamview.RowCount; o++) { TableRecordModel t = model.TableModels[EditorModel.OWNER_TABLE].GetRecord(o); OwnerRecord owner = (OwnerRecord)t; if ((string)teamview.Rows[o].Cells[1].Value == "USER") { owner.UserControlled = true; } else { owner.UserControlled = false; } foreach (TableRecordModel trm in model.TableModels[EditorModel.COACH_TABLE].GetRecords()) { CoachRecord crec = (CoachRecord)trm; if (owner.TeamId == crec.TeamId && crec.Position == 0) // Position 0 is Head coach { if ((string)teamview.Rows[o].Cells[2].Value == "USER") { crec.UserControlled = true; crec.CPUControlled = false; // not sure what this does, but it needs to be set as user controlled } else { crec.UserControlled = false; crec.CPUControlled = true; // again this needs to be set } if ((string)teamview.Rows[o].Cells[3].Value == "CPU") { crec.CPUDraftPlayer = true; owner.DraftPlayers = true; } else { crec.CPUDraftPlayer = false; owner.DraftPlayers = false; } if ((string)teamview.Rows[o].Cells[4].Value == "CPU") { crec.CPUSignDraftPicks = true; owner.SignDraftPicks = true; } else { crec.CPUSignDraftPicks = false; owner.SignDraftPicks = false; } if ((string)teamview.Rows[o].Cells[5].Value == "CPU") { crec.CPUSignFreeAgents = true; owner.SignFreeAgents = true; } else { crec.CPUSignFreeAgents = false; owner.SignFreeAgents = false; } if ((string)teamview.Rows[o].Cells[6].Value == "CPU") { crec.CPUFillRosters = true; owner.FillRosters = true; } else { crec.CPUFillRosters = false; owner.FillRosters = false; } if ((string)teamview.Rows[o].Cells[7].Value == "CPU") { crec.CPUResignPlayers = true; owner.ResignPlayers = true; } else { crec.CPUResignPlayers = false; owner.ResignPlayers = false; } if ((string)teamview.Rows[o].Cells[8].Value == "CPU") { crec.CPUManageDepth = true; owner.ReorderDepthCharts = true; } else { crec.CPUManageDepth = false; owner.ReorderDepthCharts = false; } if ((string)teamview.Rows[o].Cells[9].Value == "YES" && (string)teamview.Rows[o].Cells[1].Value == "USER") { if (model.FranchiseStage.CurrentStage < 7) // No schedule exists while in training camp { return; } // Fix Scheduled Games foreach (TableRecordModel sch in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords()) { ScheduleRecord sr = (ScheduleRecord)sch; if (sr.WeekType != 25 && sr.WeekType != 0) // regular and pre season { continue; } if (owner.TeamId == sr.AwayTeam.TeamId || owner.TeamId == sr.HomeTeam.TeamId) { TeamRecord team = model.TeamModel.GetTeamRecord(owner.TeamId); if (PlayALLGames_Checkbox.Checked) { sr.HumanControlled = true; } else if (PlayAwayGames_Checkbox.Checked && sr.AwayTeam.TeamId == owner.TeamId) { sr.HumanControlled = true; } else if (PlayHomeGames_Checkbox.Checked && sr.HomeTeam.TeamId == owner.TeamId) { sr.HumanControlled = true; } else if (PlayDIVGames_Checkbox.Checked) { if (team.TeamId != sr.HomeTeam.TeamId && team.DivisionId == sr.HomeTeam.TeamId) { sr.HumanControlled = true; } else if (team.TeamId != sr.AwayTeam.TeamId && team.DivisionId == sr.AwayTeam.DivisionId) { sr.HumanControlled = true; } else { sr.HumanControlled = false; } } else { sr.HumanControlled = false; } } else { sr.HumanControlled = false; } } } break; } } } }