/*public string storyoptions(string key,string alt){
         *      List<string> output = new List<string>();
         *      foreach(acegiak_RomancePreference preferece in preferences){
         *              string newstring = preferece.getstoryoption(key);
         *              if(newstring != null){
         *                      output.Add(newstring);
         *              }
         *      }
         *      if(output.Count > 0){
         *              return output[Stat.Rnd2.Next(output.Count)];
         *      }
         *      return alt;
         * }*/

        public void AssessDate(GameObject Date, GameObject DateObject)
        {
            havePreference();
            float  value  = (Stat.Rnd2.Next(1, 4) - 2);
            string output = ParentObject.The + ParentObject.ShortDisplayName + " joins you at " + DateObject.the + DateObject.ShortDisplayName;

            foreach (acegiak_RomancePreference preferece in preferences)
            {
                acegiak_RomancePreferenceResult result = preferece.DateAssess(Date, DateObject);

                if (result != null)
                {
                    value  += result.amount;
                    output += "\n" + result.explanation;
                    //IPart.AddPlayerMessage("" + ParentObject.the + ParentObject.DisplayNameOnly + "&Y "+result.explanation);
                }
            }
            Popup.Show(output);
            ParentObject.pBrain.AdjustFeeling(Date, (int)(value * 10));
            Date.GetPart <acegiak_Romancable>().date = null;
            if (value < 1)
            {
                this.patience -= 2;
            }
            else
            {
                this.patience -= 1;
            }
            JournalAPI.AddAccomplishment("&y You took " + ParentObject.a + ParentObject.DisplayNameOnlyDirect + " on a date to " + DateObject.the + DateObject.DisplayNameOnlyDirect + " and " + ParentObject.it + (value > 0?" was&G":" was &rnot") + " impressed&y.", "general", null, -1L);
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
 public acegiak_RomanceChatNode NameCheck(acegiak_RomanceChatNode node)
 {
     if (!ParentObject.HasProperName &&
         namegenerated == null &&
         ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) > 7)
     {
         namegenerated = HeroMaker.MakeHeroName(ParentObject, new string[0], new string[0], bIncludeTitle: false);
         ParentObject.SetIntProperty("ProperNoun", 1);
         ParentObject.SetIntProperty("Renamed", 1);
         node.Text = "[" + ParentObject.The + ParentObject.pRender.DisplayName + " tells you " + ParentObject.its + " name: " + namegenerated + "]\n\n" + node.Text;
         ParentObject.pRender.DisplayName = namegenerated + ", " + ParentObject.pRender.DisplayName;
         JournalAPI.AddAccomplishment("&y" + ParentObject.pRender.DisplayName + " shared " + ParentObject.its + " name with you.", "general", null);
     }
     return(node);
 }
Beispiel #4
0
 public void EvolveSludge()
 {
     if (this.newLiquid != (byte)99)
     {
         Mutations part1 = this.ParentObject.GetPart("Mutations") as Mutations;
         if (!part1.HasMutation("LiquidSpitter"))
         {
             part1.AddMutation((BaseMutation) new LiquidSpitter(LiquidVolume.ComponentLiquidTypes[this.newLiquid].GetName((LiquidVolume)null).Substring(2)), 1);
         }
         LiquidSpitter mutation = part1.GetMutation("LiquidSpitter") as LiquidSpitter;
         mutation.extraLiquids.Add(this.newLiquid);
         if (mutation.extraLiquids.Count == 1 && this.newLiquid == (byte)18)
         {
             mutation.extraLiquids.Add((byte)0);
         }
         this.ComponentLiquids.Add(this.newLiquid);
         string displayName = this.ParentObject.DisplayName;
         this.ParentObject.DisplayName = string.Empty;
         foreach (byte componentLiquid in this.ComponentLiquids)
         {
             GameObject parentObject = this.ParentObject;
             parentObject.DisplayName = parentObject.DisplayName + LiquidVolume.ComponentLiquidTypes[componentLiquid].GetAdjective((LiquidVolume)null) + "&y ";
         }
         GameObject parentObject1 = this.ParentObject;
         parentObject1.DisplayName = parentObject1.DisplayName + Evolution.GetPrefix(this.ComponentLiquids.Count) + "sludge";
         if (this.ComponentLiquids.Count >= 5)
         {
             JournalAPI.AddAccomplishment("You witnessed the rare formation of " + Grammar.A(Evolution.GetPrefix(this.ComponentLiquids.Count) + "sludge", false) + ".", "general", (string)null, -1L);
         }
         MessageQueue.AddPlayerMessage("The " + LiquidVolume.ComponentLiquidTypes[this.newLiquid].GetName((LiquidVolume)null) + " &ycatalyzes " + this.ParentObject.the + displayName + " into " + this.ParentObject.a + this.ParentObject.DisplayName + ".");
         bool flag  = false;
         Body part2 = this.ParentObject.GetPart <Body>();
         foreach (BodyPart bodyPart in part2.GetPart("Hand"))
         {
             if (bodyPart.Equipped == null)
             {
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             this.totalHands += 2;
             BodyPart body        = part2.GetBody();
             BodyPart InsertAfter = body.AddPartAt("Pseudopod", 0, (string)null, (string)null, (string)null, (string)null, new int?(), new int?(), new int?(), new bool?(), new bool?(), new bool?(), new bool?(), new bool?(), "Hand", "Missile Weapon");
             body.AddPartAt(InsertAfter, "Pseudopod", 0, (string)null, (string)null, (string)null, (string)null, new int?(), new int?(), new int?(), new bool?(), new bool?(), new bool?(), new bool?(), new bool?());
         }
         if (this.newLiquid == (byte)0)
         {
             this.ParentObject.TakeObject("Watery Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)1)
         {
             this.ParentObject.TakeObject("Salty Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)2)
         {
             this.ParentObject.TakeObject("Tarry Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)3)
         {
             this.ParentObject.TakeObject("Magmatic Pseudopod", false, new int?(0));
             this.ParentObject.Statistics["HeatResistance"].BaseValue += 100;
             this.ParentObject.pPhysics.Temperature = 1000;
         }
         else if (this.newLiquid == (byte)4)
         {
             this.ParentObject.TakeObject("Slimy Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)5)
         {
             this.ParentObject.TakeObject("Oily Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)6)
         {
             this.ParentObject.TakeObject("Bloody Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <LifeDrainOnHit>(new LifeDrainOnHit("15-20", 100), true);
         }
         else if (this.newLiquid == (byte)7)
         {
             this.ParentObject.TakeObject("Acidic Pseudopod", false, new int?(0));
             this.ParentObject.Statistics["AcidResistance"].BaseValue += 100;
         }
         else if (this.newLiquid == (byte)8)
         {
             this.ParentObject.TakeObject("Honeyed Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)9)
         {
             this.ParentObject.TakeObject("Lush Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)10)
         {
             this.ParentObject.TakeObject("Sludgy Pseudopod2", false, new int?(0));
         }
         else if (this.newLiquid == (byte)11)
         {
             this.ParentObject.TakeObject("Gooey Pseudopod2", false, new int?(0));
         }
         else if (this.newLiquid == (byte)12)
         {
             this.ParentObject.TakeObject("Putrid Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)13)
         {
             this.ParentObject.TakeObject("Unctuous Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)14)
         {
             this.ParentObject.TakeObject("Oozing Pseudopod2", false, new int?(0));
         }
         else if (this.newLiquid == (byte)15)
         {
             this.ParentObject.TakeObject("Spiced Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)16)
         {
             this.ParentObject.TakeObject("Luminous Pseudopod2", false, new int?(0));
             this.ParentObject.AddPart <LightSource>(new LightSource(), true);
             (this.ParentObject.GetPart("LightSource") as LightSource).Radius = 6;
             this.ParentObject.Statistics["ColdResistance"].BaseValue        += 100;
         }
         else if (this.newLiquid == (byte)17)
         {
             this.ParentObject.TakeObject("Neutronic Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)18)
         {
             this.ParentObject.TakeObject("Homogenized Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <CloneOnHit>(new CloneOnHit(), true);
         }
         else if (this.newLiquid == (byte)20)
         {
             this.ParentObject.TakeObject("Waxen Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)21)
         {
             this.ParentObject.TakeObject("Inky Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)22)
         {
             this.ParentObject.TakeObject("Sugary Pseudopod", false, new int?(0));
         }
         this.ParentObject.pBrain.PerformReequip(false);
         this.newLiquid = (byte)99;
     }
     this.isCatalyzing = false;
     if (this.ComponentLiquids.Count != 1)
     {
         return;
     }
     MessageQueue.AddPlayerMessage("The reacting liquids congeal into a " + this.ParentObject.ShortDisplayName + ".");
     this.C.AddObject(this.ParentObject);
     XRLCore.Core.Game.ActionManager.AddActiveObject(this.ParentObject);
 }
Beispiel #5
0
        public bool Kiss(GameObject who)
        {
            if (!hasPart(ParentObject, "face"))
            {
                if (who.IsPlayer())
                {
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y doesn't have a face.");
                }
                return(true);
            }
            if (!hasPart(who, "face"))
            {
                if (who.IsPlayer())
                {
                    Popup.Show("You don't have a face.");
                }
                return(true);
            }

            string beguiled  = "";
            string hbeguiled = " &Mkissed you back&y.";

            if (ParentObject.GetIntProperty("BeguilingBonusApplied") > 0)
            {
                beguiled  = "\n" + ParentObject.It + ParentObject.GetVerb("quake") + " with fear and manic ecstasy.";
                hbeguiled = " could not resist.";
            }
            else
            {
                if (kissableIfPositiveFeeling && ParentObject.pBrain.GetFeeling(who) < 55)
                {
                    if (who.IsPlayer())
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("shy") + " away from you.");
                    }
                    ParentObject.pBrain.AdjustFeeling(who, -5);

                    if (ParentObject.pBrain.GetFeeling(who) < 0)
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!");
                    }
                    return(true);
                }
                if (!isAttractedTo(who))
                {
                    if (who.IsPlayer())
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y isn't attracted to you.");
                    }
                    ParentObject.pBrain.AdjustFeeling(who, -10);

                    if (ParentObject.pBrain.GetFeeling(who) < 0)
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!");
                    }
                    return(true);
                }
            }

            if (ParentObject.GetPart <acegiak_Romancable>() != null)
            {
                if (ParentObject.GetPart <acegiak_Romancable>().patience <= 0)
                {
                    ParentObject.pBrain.AdjustFeeling(who, -5);
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y doesn't want to kiss you right now.");

                    if (ParentObject.pBrain.GetFeeling(who) < 0)
                    {
                        Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!");
                    }
                }
                ParentObject.GetPart <acegiak_Romancable>().patience--;
            }



            string     verb         = "kiss";
            GameObject parentObject = ParentObject;

            IPart.XDidYToZ(who, verb, parentObject, null, null, true);
            if (who.IsPlayer())
            {
                if (ParentObject.HasPropertyOrTag("SpecialKissResponse"))
                {
                    Popup.Show(ParentObject.GetTag("SpecialKissResponse"));
                }
                else
                {
                    KissBuff(who);
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y " + ParentObject.GetPropertyOrTag("KissResponse", "&Mkisses you back") + "." + beguiled);
                    JournalAPI.AddAccomplishment("&y You kissed " + ParentObject.a + ParentObject.DisplayNameOnlyDirect + " and " + ParentObject.it + hbeguiled, "general", null, -1L);
                }
            }
            ParentObject.Heartspray();
            who.UseEnergy(1000, "Kissing");
            ParentObject.FireEvent(Event.New("ObjectKissed", "Object", ParentObject, "Kisser", who));
            return(true);
        }
        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 bool HandleDeathEvent(IDeathEvent E)
        {
            // AddPlayerMessage("Starting Scio Grab.");

            var DyingEgo  = E.Dying.Statistics["Ego"].Modifier;
            var KillerEgo = ParentObject.Statistics["Ego"].Modifier;

            // AddPlayerMessage("Got Ego Parameters.");

            var OwnersLevel  = ParentObject.Statistics["Level"].Value;
            var TargetsLevel = E.Dying.Statistics["Level"].Value;

            // AddPlayerMessage("Got Level Parameters.");

            var LevelDifference = TargetsLevel - OwnersLevel;
            var DevourNumerator = Stat.Random(1, 100);
            var DevourChance    = DevourNumerator <= 9 + Level + (LevelDifference * 0.50);

            // AddPlayerMessage("Setting Varitability.");

            var Killed = E.Dying;

            // AddPlayerMessage("Got target");
            // AddPlayerMessage("Devour Roll: " + DevourNumerator);

            if (E.Killer == ParentObject && E.Killer.IsPlayer() && DyingEgo > KillerEgo)
            {
                // AddPlayerMessage("Setting Kill Bool.");
                if (DevourChance)
                {
                    // AddPlayerMessage("Devour Chance Procced");

                    if (Popup.ShowYesNo("&yAt the moment of victory, your swelling ego curves the psychic aether and causes the psyche of " + Killed.the + Killed.ShortDisplayName + "&y, to collide with your own. As the weaker of the two, its binding energy is exceeded and it explodes. Would you like to encode its psionic bits on the holographic boundary of your own psyche? \n\n(+1 Ego permanently)") == DialogResult.Yes)
                    {
                        // AddPlayerMessage("You Chose Yes");
                        IComponent <GameObject> .ThePlayer.Statistics["Ego"].BaseValue += 1;
                        Popup.Show("&yYou encode the psyche of " + Killed.the + Killed.DisplayNameOnlyDirect + " and gain +&C1 &YEgo&y!");
                        JournalAPI.AddAccomplishment("You slew " + Killed.the + Killed.DisplayNameOnlyDirect + " and encoded their psyche's psionic bits on the holographic boundary of your own psyche.", "After a climactic battle of wills, =name= slew " + Killed.the + Killed.DisplayNameOnlyDirect + " and absorbed " + Killed.its + " psyche, thickening toward Godhood.", "general", JournalAccomplishment.MuralCategory.Slays, JournalAccomplishment.MuralWeight.High, null, -1L);
                    }
                    else
                    {
                        Popup.Show("&yYou pause as the psyche of " + Killed.the + Killed.DisplayNameOnlyDirect + " radiates into nothingness.");
                        JournalAPI.AddAccomplishment("You slew " + Killed.the + Killed.DisplayNameOnlyDirect + " and watched their psyche radiate into nothingness.", "After a climactic battle of wills, =name= slew " + Killed.the + Killed.DisplayNameOnlyDirect + " and watched " + Killed.its + " their psyche radiate into nothingness.", "general", JournalAccomplishment.MuralCategory.Slays, JournalAccomplishment.MuralWeight.Medium, null, -1L);
                    }
                }
                else
                {
                    JournalAPI.AddAccomplishment("You slew " + Killed.DisplayNameOnly + ".", "After a climactic battle of wills, =name= slew " + Killed.the + Killed.DisplayNameOnlyDirect + ".", "general", JournalAccomplishment.MuralCategory.Slays, JournalAccomplishment.MuralWeight.Medium, null, -1L);
                }
            }
            else if (E.Dying == ParentObject && ParentObject.IsPlayer())
            {
                if (DevourChance)
                {
                    string value = (E.Killer.pBrain.GetPrimaryFaction() == "Seekers") ? "You were resorbed into the Mass Mind." : ((!DevourChance) ? ("You were killed by " + ParentObject.DisplayNameOnly + "&Y.") : ("Your psyche exploded, and its psionic bits were encoded on the holographic boundary surrounding the psyche of " + Grammar.MakePossessive(ParentObject.DisplayNameOnly) + "&Y."));
                    E.Reason = value;
                }
            }
            else if (E.Killer == ParentObject && !E.Killer.IsPlayer() && DyingEgo > KillerEgo)
            {
                if (DevourChance)
                {
                    ParentObject.Statistics["Ego"].BaseValue += 1;
                    ParentObject.ParticleBlip("{{violet|*}}", 1, true);
                }
            }
            return(true);
        }
Beispiel #8
0
        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));
        }
Beispiel #9
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "GetInventoryActions")
            {
                if (
                    //ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body)>5 &&
                    !ParentObject.IsPlayer())
                {
                    E.GetParameter <EventParameterGetInventoryActions>("Actions").AddAction("Gift", 'G', false, "&Wg&yift", "InvCommandGift", 10);
                }
            }
            if (E.ID == "InvCommandGift" && Gift(E.GetGameObjectParameter("Owner"), FromDialog: true))
            {
                E.RequestInterfaceExit();
            }
            if (E.ID == "PlayerBeginConversation")
            {
                if (ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) > 0)
                {
                    HandleBeginConversation(E.GetParameter <Conversation>("Conversation"), E.GetParameter <GameObject>("Speaker"));
                    GameObject speaker = E.GetParameter <GameObject>("Speaker");
                    if (speaker.GetPart <acegiak_Romancable>() != null)
                    {
                        float patienceRate = 200f;                         //DEFAULT: 1200
                        long  ticks        = XRLCore.Core.Game.TimeTicks - speaker.GetPart <acegiak_Romancable>().lastseen;
                        int   newPatience  = (int)Math.Floor((float)(ticks) / patienceRate);
                        //IPart.AddPlayerMessage("patience earned:"+(newPatience).ToString());
                        if (speaker.GetPart <acegiak_Romancable>().lastseen == 0)
                        {
                            newPatience = 0;
                        }
                        if (newPatience > 5)
                        {
                            newPatience = 10;
                        }
                        speaker.GetPart <acegiak_Romancable>().lastseen = (int)XRLCore.Core.Game.TimeTicks;
                        speaker.GetPart <acegiak_Romancable>().patience = speaker.GetPart <acegiak_Romancable>().patience + newPatience;
                        //IPart.AddPlayerMessage("Ticks passed:"+(ticks).ToString());
                        //IPart.AddPlayerMessage("patience earned:"+(newPatience).ToString());
                    }
                    // if(patience > 5 && ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body)>0 && ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body)<5){
                    //  ParentObject.pBrain.AdjustFeeling(XRLCore.Core.Game.Player.Body,(int)Math.Min(5,patience-5));
                    // }
                }
            }
            if (E.ID == "VisitConversationNode")
            {
                if (E.GetParameter <ConversationNode>("CurrentNode") != null && E.GetParameter <ConversationNode>("CurrentNode") is acegiak_RomanceChatNode)
                {
                    E.SetParameter("CurrentNode", BuildNode((acegiak_RomanceChatNode)E.GetParameter <ConversationNode>("CurrentNode")));
                }
            }


            if (E.ID == "OwnerGetInventoryActions")
            {
                GameObject         gameObjectParameter2 = E.GetGameObjectParameter("Object");
                acegiak_Romancable romancable           = gameObjectParameter2.GetPart <acegiak_Romancable>();
                if (romancable != null && gameObjectParameter2.pBrain.GetFeeling(ParentObject) > 25 && gameObjectParameter2 != ParentObject)
                {
                    E.GetParameter <EventParameterGetInventoryActions>("Actions").AddAction("ArrangeDate", 'r', true, "A&Wr&yrange a Date", "InvCommandArrangeDate");
                }
            }
            if (E.ID == "InvCommandArrangeDate")
            {
                GameObject         gameObjectParameter2 = E.GetGameObjectParameter("Object");
                acegiak_Romancable romancable           = gameObjectParameter2.GetPart <acegiak_Romancable>();
                if (romancable != null && gameObjectParameter2.pBrain.GetFeeling(ParentObject) > 25 && gameObjectParameter2 != ParentObject)
                {
                    this.date = gameObjectParameter2;
                    Popup.Show(gameObjectParameter2.ShortDisplayName + " seems amenable to the idea.");
                }
            }

            if (E.ID == "OwnerGetInventoryActions")
            {
                GameObject gameObjectParameter2 = E.GetGameObjectParameter("Object");
                if (date != null && date.pBrain.GetFeeling(ParentObject) > 25 && date != ParentObject)
                {
                    E.GetParameter <EventParameterGetInventoryActions>("Actions").AddAction("BeginDate", 'j', true, "Invite " + this.date.ShortDisplayName + " to &Wj&yoin you", "InvCommandBeginDate");
                }
            }
            if (E.ID == "InvCommandBeginDate")
            {
                GameObject         GO         = E.GetGameObjectParameter("Object");
                acegiak_Romancable romancable = this.date.GetPart <acegiak_Romancable>();
                if (romancable != null && date.pBrain.GetFeeling(ParentObject) > 25)
                {
                    this.date.pBrain.PushGoal(new acegiak_WaitWith(10, ParentObject));
                    this.date.pBrain.PushGoal(new acegiak_DateAssess(ParentObject, GO));
                    this.date.pBrain.PushGoal(new MoveTo(GO, true));
                    E.RequestInterfaceExit();

                    IPart.AddPlayerMessage(date.ShortDisplayName + " comes to join you at " + GO.the + GO.ShortDisplayName);
                    JournalAPI.AddAccomplishment("&y" + date.a + date.DisplayNameOnlyDirect + " joined you for a date at " + GO.the + GO.DisplayNameOnlyDirect, "general", null);
                }
            }
            if (E.ID == "CommandRemoveObject" && XRLCore.Core.Game != null && !ParentObject.IsPlayer() && ParentObject != null && ParentObject.id != null)
            {
                GameObject G = E.GetGameObjectParameter("Object");
                if (G.GetPropertyOrTag("GiftedTo") == ParentObject.id && assessGift(G, ParentObject).amount > 0)
                {
                    Popup.Show(ParentObject.The + ParentObject.DisplayNameOnly + " cannot bear to part with " + G.the + G.DisplayNameOnly + ".");
                }
            }



            return(base.FireEvent(E));
        }