protected static void CollectCompositions(List <Item> allOptions, BandSkill skill, List <Guitar.Composition> regularCompositions, List <Guitar.Composition> masterCompositions) { if (skill == null) { return; } List <Guitar.Composition> compositions = new List <Guitar.Composition>(regularCompositions); compositions.AddRange(masterCompositions); foreach (Guitar.Composition song in compositions) { if (song.InstrumentSkillNameKey != skill.Guid) { continue; } if ((skill.KnownCompositions.Contains(song)) || (skill.KnownMasterCompositions.Contains(song))) { allOptions.Add(new Item(skill, song, 1)); } else { allOptions.Add(new Item(skill, song, 0)); } } }
public static float GetPay(Sim sim, SkillNames skillName) { BandSkill skill = sim.SkillManager.GetSkill <BandSkill>(skillName); if (skill == null) { return(0); } float cashPerHour = skill.SkillLevel + skill.KnownCompositions.Count; cashPerHour *= (skill.KnownMasterCompositions.Count + 1); int listeners = 0; foreach (Sim other in sim.LotCurrent.GetSims()) { if (other.SimDescription.AssignedRole != null) { continue; } if (other.RoomId == sim.RoomId) { listeners++; } } cashPerHour *= listeners; return(cashPerHour); }
protected static bool GiveTip(BandInstrument ths, Sim tipper, Sim player, int moneyPerLevel, int moneyPerComposition) { if (ths.mTipJar == null) { return(false); } Route r = tipper.CreateRoute(); RadialRangeDestination destination = new RadialRangeDestination(); destination.mCenterPoint = ths.mTipJar.Position; destination.mConeVector = ths.mTipJar.ForwardVector; destination.mFacingPreference = RouteOrientationPreference.TowardsObject; destination.mfConeAngle = 3.141593f; destination.mfMinRadius = 1.25f; destination.mfPreferredSpacing = 0.1f; destination.mTargetObject = ths.mTipJar; r.AddDestination(destination); r.SetValidRooms(0x0L, null); r.ExitReasonsInterrupt &= -33; r.Plan(); if (!tipper.DoRoute(r)) { return(false); } tipper.PlaySoloAnimation("a2o_guitar_tip_x", true); BandSkill skill = player.SkillManager.GetSkill <BandSkill>(ths.SkillName); int delta = skill.SkillLevel * moneyPerLevel; delta += skill.NumberCompositionsPlayed() * moneyPerComposition; delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25); delta++; RockBand.GiveXpForMoney(player, delta); NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta); int original = skill.mMoneyMadeFromGuitarPlaying; skill.MadeTips(delta, false); delta = skill.mMoneyMadeFromGuitarPlaying - original; NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta); return(true); }
public Item(BandSkill skill, Guitar.Composition song, int count) : base(song, song.Name, count) { mSkill = skill; }
protected override bool Run(SimDescription me, bool singleSelection) { if (!ApplyAll) { List <Item> allOptions = new List <Item>(); allOptions.Add(null); CollectCompositions(allOptions, me.SkillManager.GetElement(SkillNames.Guitar) as BandSkill, Guitar.GuitarCompositions, Guitar.GuitarMasterCompositions); CollectCompositions(allOptions, me.SkillManager.GetElement(SkillNames.Drums) as BandSkill, DrumSkill.DrumsCompositions, DrumSkill.DrumsMasterCompositions); CollectCompositions(allOptions, me.SkillManager.GetElement(SkillNames.Piano) as BandSkill, Piano.PianoCompositions, Piano.PianoMasterCompositions); CollectCompositions(allOptions, me.SkillManager.GetElement(SkillNames.BassGuitar) as BandSkill, BassGuitarSkill.BassGuitarCompositions, BassGuitarSkill.BassGuitarMasterCompositions); CollectCompositions(allOptions, me.SkillManager.GetElement(SkillNames.LaserHarp) as BandSkill, LaserHarpSkill.LaserHarpCompositions, LaserHarpSkill.LaserHarpMasterCompositions); mSelection = new CommonSelection <Item>(Name, me.FullName, allOptions, -40, new SkillNameColumn()).SelectMultiple(); if ((mSelection == null) || (mSelection.Count == 0)) { return(false); } CommonSelection <Item> .HandleAllOrNothing(mSelection); } foreach (Item item in mSelection) { if (item == null) { continue; } BandSkill skill = item.mSkill; Guitar.Composition song = item.Value; if (!item.IsSet) { skill.CompositionLearned(song.AudioClip); } else if (song.IsMasterTrack) { skill.KnownMasterCompositions.Remove(song); } else { skill.KnownCompositions.Remove(song); } } List <BandSkill> skills = new List <BandSkill>(); skills.Add(me.SkillManager.GetElement(SkillNames.Guitar) as BandSkill); skills.Add(me.SkillManager.GetElement(SkillNames.Drums) as BandSkill); skills.Add(me.SkillManager.GetElement(SkillNames.Piano) as BandSkill); skills.Add(me.SkillManager.GetElement(SkillNames.BassGuitar) as BandSkill); skills.Add(me.SkillManager.GetElement(SkillNames.LaserHarp) as LaserHarpSkill); foreach (SheetMusicData music in BookData.SheetMusicDataList.Values) { bool found = false; foreach (BandSkill skill in skills) { if (skill == null) { continue; } if (skill.KnownCompositions.Contains(music.Composition)) { found = true; break; } } if (!found) { me.ReadBookDataList.Remove(music.ID); } } return(true); }