public override bool FireEvent(Event E) { if (E.ID == "ShowConversationChoices") { if (XRLCore.Core.Game.Player.Body.GetPart <acegiak_CustomsPainting>() != null) { if (this.GetPaintingRecipe() != null && !this.GetPaintingRecipe().revealed) { if (E.GetParameter <ConversationNode>("CurrentNode") != null && E.GetParameter <ConversationNode>("CurrentNode") is WaterRitualNode) { WaterRitualNode wrnode = E.GetParameter <ConversationNode>("CurrentNode") as WaterRitualNode; List <ConversationChoice> Choices = E.GetParameter <List <ConversationChoice> >("Choices") as List <ConversationChoice>; if (Choices.Where(b => b.ID == "LearnPaintingStyle").Count() <= 0) { bool canlearn = XRLCore.Core.Game.PlayerReputation.get(ParentObject.pBrain.GetPrimaryFaction()) > 50; ConversationChoice conversationChoice = new ConversationChoice(); conversationChoice.Text = (canlearn?"&G":"&K") + "Teach me to paint &W" + this.GetPaintingRecipe().FormName + (canlearn?"&g":"&K") + " [" + (canlearn?"&C":"&r") + "-50" + (canlearn?"&g":"&K") + " reputation]"; conversationChoice.GotoID = "End"; conversationChoice.ParentNode = wrnode; conversationChoice.ID = "LearnPaintingStyle"; conversationChoice.onAction = delegate() { if (!canlearn) { Popup.Show("You do not have enough reputation."); return(false); } this.GetPaintingRecipe().revealed = true; Popup.Show("You learned to paint: " + this.GetPaintingRecipe().FormName); JournalAPI.AddAccomplishment("You learned to paint " + this.GetPaintingRecipe().FormName); JournalAPI.AddObservation(this.GetPaintingRecipe().FormName + ":\n" + this.GetPaintingRecipe().FormDescription, this.GetPaintingRecipe().FormName, "Painting Forms", null, null, true); XRLCore.Core.Game.PlayerReputation.modify(Factions.get(ParentObject.pBrain.GetPrimaryFaction()).Name, -50, false); return(true); }; Choices.Add(conversationChoice); Choices.Sort(new ConversationChoice.Sorter()); // wrnode.Choices.Add(conversationChoice); // wrnode.SortEndChoicesToEnd(); E.SetParameter("CurrentNode", wrnode); } } } } } return(base.FireEvent(E)); }
public void Compose(GameObject who) { List <UnityEngine.GameObject> GOs = new List <UnityEngine.GameObject>(); foreach (string voice in SoundName.Split(';')) { string[] bits = voice.Split(':'); UnityEngine.GameObject gameObject; gameObject = new UnityEngine.GameObject(); gameObject.transform.position = new Vector3(0f, 0f, 1f); gameObject.name = "MusicPlayer"; gameObject.AddComponent <acegiak_AudioSequencer>(); gameObject.GetComponent <acegiak_AudioSequencer>().recordVoice = bits[0]; if (bits.Length > 1) { gameObject.GetComponent <acegiak_AudioSequencer>().recordVolume = Int32.Parse(bits[1]) / 100f; } UnityEngine.Object.DontDestroyOnLoad(gameObject); GOs.Add(gameObject); } foreach (UnityEngine.GameObject GO in GOs) { acegiak_AudioSequencer component = GO.GetComponent <acegiak_AudioSequencer>(); component.Record(); } Popup.AskString("Play with 0-9", "", 300); // acegiak_ScreenBufferMaker p = delegate(ScreenBuffer sb, int charcode) // { // ConsoleChar c = new ConsoleChar(); // c.Tile = "Tiles/sw_box.bmp"; // sb[1,1] = c; // ConsoleChar f = new ConsoleChar(); // f.Tile = "Tiles/sw_box.bmp"; // sb[3,3] = f; // //IPart.AddPlayerMessage("Boxy?"); // return sb; // }; // acegiak_CustomPopup.CustomRender(p,20,10); if (XRLCore.Core.Game.Player.Body.HasSkill("acegiak_Customs_Music")) { string songname = Popup.AskString("Name this song. (leave blank to forget)", "", 140); if (songname != null && songname.Length > 0) { acegiak_SongBook book = who.GetPart <acegiak_SongBook>(); if (book == null) { Popup.Show(who.The + who.DisplayNameOnly + " can't remember songs."); } else { acegiak_Song song = new acegiak_Song(); song.Name = songname; song.Notes = GOs[0].GetComponent <acegiak_AudioSequencer>().Print(); book.Songs.Add(song); JournalAPI.AddAccomplishment("You wrote a song: " + song.Name); JournalAPI.AddObservation(song.Name, song.Name, "Songs", null, null, true); } } } who.FireEvent(Event.New("PlayedSong", "Object", ParentObject)); }
public override bool FireEvent(Event E) { if (E.ID == "AIBored") { if (ParentObject.GetPart <Inventory>() != null) { if (XRLCore.Core.Game.TimeTicks - lastPlayed > 100) { lastPlayed = XRLCore.Core.Game.TimeTicks; foreach (GameObject GO in ParentObject.GetPart <Inventory>().GetObjects()) { if (GO.GetPart <acegiak_Musical>() != null) { GO.FireEvent(XRL.World.Event.New("InvCommandPlayTune", "Owner", ParentObject, "Object", GO)); } } } } } if (E.ID == "ShowConversationChoices" && !ParentObject.IsPlayer()) { if (XRLCore.Core.Game.Player.Body.GetPart <acegiak_SongBook>() != null && XRLCore.Core.Game.Player.Body.HasSkill("acegiak_Customs_Music")) { //IPart.AddPlayerMessage("My tags are:" + String.Join(", ", FactionTags(ParentObject.pBrain.GetPrimaryFaction()).ToArray())); if (this.Songs.Count > 0 && !this.learnedFrom) { if (E.GetParameter <ConversationNode>("CurrentNode") != null && E.GetParameter <ConversationNode>("CurrentNode") is WaterRitualNode) { WaterRitualNode wrnode = E.GetParameter <ConversationNode>("CurrentNode") as WaterRitualNode; List <ConversationChoice> Choices = E.GetParameter <List <ConversationChoice> >("Choices") as List <ConversationChoice>; if (Choices.Where(b => b.ID == "LearnSong").Count() <= 0) { bool canlearn = XRLCore.Core.Game.PlayerReputation.get(ParentObject.pBrain.GetPrimaryFaction()) >= 50; ConversationChoice conversationChoice = new ConversationChoice(); conversationChoice.Text = (canlearn?"&G":"&K") + "Teach me to play &W" + this.Songs[0].Name + (canlearn?"&g":"&K") + " [" + (canlearn?"&C":"&r") + "-50" + (canlearn?"&g":"&K") + " reputation]"; conversationChoice.GotoID = "End"; conversationChoice.ParentNode = wrnode; conversationChoice.ID = "LearnSong"; conversationChoice.onAction = delegate() { if (!canlearn) { Popup.Show("You do not have enough reputation."); return(false); } XRLCore.Core.Game.Player.Body.GetPart <acegiak_SongBook>().Songs.Add(this.Songs[0]); this.learnedFrom = true; Popup.Show("You learned to play " + this.Songs[0].Name); JournalAPI.AddAccomplishment("You learned to play " + this.Songs[0].Name); JournalAPI.AddObservation(Faction.getFormattedName(ParentObject.pBrain.GetPrimaryFaction()) + " play a song called \"" + this.Songs[0].Name + "\"", this.Songs[0].Name, "Songs", null, null, true); XRLCore.Core.Game.PlayerReputation.modify(Factions.get(ParentObject.pBrain.GetPrimaryFaction()).Name, -50, false); return(true); }; Choices.Add(conversationChoice); Choices.Sort(new ConversationChoice.Sorter()); // wrnode.Choices.Add(conversationChoice); // wrnode.SortEndChoicesToEnd(); E.SetParameter("CurrentNode", wrnode); } } } } } return(base.FireEvent(E)); }