public static LiquidVolume GetPuddle(Cell cell) { LiquidVolume ret = null; foreach (GameObject GO in cell.GetObjects()) { LiquidVolume volume = GO.GetPart <LiquidVolume>(); if (volume != null) { if (ret != null) { ret.MixWith(volume); GO.Destroy(); } else { ret = volume; } if (volume.MaxVolume == -1) { volume.MaxVolume = 10000; } } } return(ret); }
public void Operate(GameObject who) { Inventory part2 = who.GetPart <Inventory>(); List <XRL.World.GameObject> ObjectChoices = new List <XRL.World.GameObject>(); List <string> ChoiceList = new List <string>(); List <char> HotkeyList = new List <char>(); char ch = 'a'; part2.ForeachObject(delegate(XRL.World.GameObject GO) { if (GO != null && (GO.GetPart <acegiak_DismemberSearcher>() != null || PartWas(GO) != null)) { ObjectChoices.Add(GO); HotkeyList.Add(ch); ChoiceList.Add(GO.DisplayName); ch = (char)(ch + 1); } }); if (ObjectChoices.Count == 0) { Popup.Show("You have nothing with which to augment yourself."); return; } int choicenum = Popup.ShowOptionList(string.Empty, ChoiceList.ToArray(), HotkeyList.ToArray(), 0, "With what shall you augment yourself?", 60, false, true); if (choicenum >= 0) { Augment(who, ObjectChoices[choicenum]); } }
public LiquidVolume GetPuddle() { Cell cell = ParentObject.CurrentCell; foreach (GameObject GO in cell.GetObjects()) { LiquidVolume volume = GO.GetPart <LiquidVolume>(); if (volume != null) { return(volume); } } return(null); }
public void Paint(XRL.World.GameObject Canvas, XRL.World.GameObject Artist) { //choose colour if (Artist.IsPlayer()) { // CHOOSE DESIGN List <string> ChoiceList = new List <string>(); List <char> HotkeyList = new List <char>(); char ch = 'a'; ChoiceList.Add("Custom design."); HotkeyList.Add(ch); ch = (char)(ch + 1); List <acegiak_PaintingRecipe> recipes = new List <acegiak_PaintingRecipe>(); foreach (acegiak_PaintingRecipe observation in Recipes) { if (observation is acegiak_PaintingRecipe) { acegiak_PaintingRecipe recipe = observation as acegiak_PaintingRecipe; if (recipe.revealed) { recipes.Add(recipe); ChoiceList.Add(recipe.FormName + ": \n" + recipe.FormDescription + "\n"); HotkeyList.Add(ch); ch = (char)(ch + 1); } } } string BaseColour = ""; string DetailColour = ""; List <string> chosenStuffs = new List <string>(); int designNumber = Popup.ShowOptionList(string.Empty, ChoiceList.ToArray(), HotkeyList.ToArray(), 0, "Choose a design.", 60, false, true); if (designNumber < 0) { return; } // CHOOSE BODY PART ChoiceList = new List <string>(); HotkeyList = new List <char>(); ch = 'a'; BodyPart paintingpart = null; if (Canvas.GetPart <Body>() != null) { List <BodyPart> parts = new List <BodyPart>(); ch = 'a'; foreach (BodyPart part in Canvas.GetPart <Body>()._Body.GetParts()) { if (!part.Abstract && !part.Extrinsic) { if (designNumber <= 0 || recipes[designNumber - 1].PartType == null || part.Type == recipes[designNumber - 1].PartType) { parts.Add(part); HotkeyList.Add(ch); ChoiceList.Add(part.Name); ch = (char)(ch + 1); } } } if (parts.Count == 0) { Popup.Show("They don't have the body part required for this pattern."); return; } int partChoice = Popup.ShowOptionList(string.Empty, ChoiceList.ToArray(), HotkeyList.ToArray(), 0, "Which part of " + Canvas.the + Canvas.DisplayNameOnly + " will you paint?", 60, false, true); if (partChoice >= 0) { paintingpart = parts[partChoice]; } } // CHOOSE BASE COLOR Inventory part2 = Artist.GetPart <Inventory>(); List <XRL.World.GameObject> ObjectChoices = new List <XRL.World.GameObject>(); ChoiceList = new List <string>(); HotkeyList = new List <char>(); ch = 'a'; part2.ForeachObject(delegate(XRL.World.GameObject GO) { if (GO != null && GO.GetPart <LiquidVolume>() != null && GO.GetPart <LiquidVolume>().GetPrimaryLiquid() != null && GO.GetPart <LiquidVolume>().GetPrimaryLiquid().Name != "water") { if (designNumber <= 0 || recipes[designNumber - 1].BaseColor == null || (recipes[designNumber - 1].BaseColor.Length == 1 && GO.GetPart <LiquidVolume>().GetPrimaryLiquidColor() == recipes[designNumber - 1].BaseColor) || (recipes[designNumber - 1].BaseColor.Length > 1 && GO.GetPart <LiquidVolume>().GetPrimaryLiquid().Name == recipes[designNumber - 1].BaseColor)) { ObjectChoices.Add(GO); HotkeyList.Add(ch); ChoiceList.Add(GO.DisplayName); ch = (char)(ch + 1); } } }); if (ObjectChoices.Count == 0) { if (designNumber > 0) { Popup.Show("You have no " + acegiak_LiquidDye.ColorNames[recipes[designNumber - 1].BaseColor] + " pigments."); } else { Popup.Show("You have nothing to paint with."); } return; } int baseColor = Popup.ShowOptionList(string.Empty, ChoiceList.ToArray(), HotkeyList.ToArray(), 0, "Choose your base colour.", 60, false, true); if (baseColor >= 0) { BaseColour = ObjectChoices[baseColor].GetPart <LiquidVolume>().GetPrimaryLiquidColor(); if (ObjectChoices[baseColor].GetPart <LiquidVolume>().GetPrimaryLiquid() is acegiak_LiquidDye) { //that's fine } else { StringBuilder b = new StringBuilder(); ObjectChoices[baseColor].GetPart <LiquidVolume>().AppendLiquidName(b); chosenStuffs.Add(b.ToString()); } } if (BaseColour == "") { BaseColour = Canvas.pRender.TileColor == String.Empty?Canvas.pRender.GetForegroundColor().Replace("&", ""):Canvas.pRender.TileColor.Replace("&", ""); } //CHOOSE DETAIL COLOR List <XRL.World.GameObject> ObjectChoices2 = new List <XRL.World.GameObject>(); ChoiceList = new List <string>(); HotkeyList = new List <char>(); ch = 'a'; part2.ForeachObject(delegate(XRL.World.GameObject GO) { if (GO != null && GO.GetPart <LiquidVolume>() != null && GO.GetPart <LiquidVolume>().GetPrimaryLiquid() != null && GO.GetPart <LiquidVolume>().GetPrimaryLiquid().Name != "water") { if (designNumber <= 0 || recipes[designNumber - 1].DetailColor == null || (recipes[designNumber - 1].DetailColor.Length == 1 && GO.GetPart <LiquidVolume>().GetPrimaryLiquidColor() == recipes[designNumber - 1].DetailColor) || (recipes[designNumber - 1].DetailColor.Length > 1 && GO.GetPart <LiquidVolume>().GetPrimaryLiquid().Name == recipes[designNumber - 1].DetailColor)) { ObjectChoices2.Add(GO); HotkeyList.Add(ch); ChoiceList.Add(GO.DisplayName); ch = (char)(ch + 1); } } }); if (ObjectChoices2.Count == 0) { if (designNumber > 0) { Popup.Show("You have no " + acegiak_LiquidDye.ColorNames[recipes[designNumber - 1].DetailColor] + " pigments."); } else { Popup.Show("You have nothing to paint with."); } return; } int detailColor = Popup.ShowOptionList(string.Empty, ChoiceList.ToArray(), HotkeyList.ToArray(), 0, "Choose your detail colour.", 60, false, true); if (detailColor >= 0) { DetailColour = ObjectChoices[detailColor].GetPart <LiquidVolume>().GetPrimaryLiquidColor(); if (ObjectChoices[detailColor].GetPart <LiquidVolume>().GetPrimaryLiquid() is acegiak_LiquidDye) { //that's fine } else { StringBuilder c = new StringBuilder(); ObjectChoices[detailColor].GetPart <LiquidVolume>().AppendLiquidName(c); chosenStuffs.Add(c.ToString()); } } if (DetailColour == "") { DetailColour = Canvas.pRender.DetailColor; } if (detailColor < 0 && baseColor < 0) { return; } // DO THE PAINTING if (paintingpart != null) { List <Effect> list = new List <Effect>(); foreach (Effect effect in Canvas.Effects) { list.Add(effect); } foreach (Effect e in list) { if (e is acegiak_ModHandPainted) { int?bpid = ((acegiak_ModHandPainted)e).BodyPartId; if (bpid != null && Canvas.GetPart <Body>() != null) { if ( Canvas.GetPart <Body>()._Body.GetPartByID(bpid.Value) == paintingpart) { Canvas.RemoveEffect(e); } } } } } acegiak_ModHandPainted painting = new acegiak_ModHandPainted(); if (designNumber > 0 && recipes[designNumber - 1].className != null) { Type t = typeof(acegiak_ModHandPainted); painting = Activator.CreateInstance(Type.GetType(recipes[designNumber - 1].className)) as acegiak_ModHandPainted; // painting = (acegiak_ModHandPainted)Activator.CreateInstance(null, recipes[designNumber-1].className ).Unwrap(); } painting.Engraving = "mysterious shapes"; if (designNumber == 0) { painting.Engraving = Popup.AskString("What do you depict?", string.Empty, 999); } if (designNumber > 0) { painting.Engraving = recipes[designNumber - 1].FormDescription; painting.Faction = recipes[designNumber - 1].FormFaction; painting.DisplayName = recipes[designNumber - 1].FormName; } painting.BaseColour = BaseColour; painting.DetailColour = DetailColour; if (paintingpart != null) { painting.BodyPartId = paintingpart.ID; } if (chosenStuffs.Count > 0) { painting.With = String.Join(" and ", chosenStuffs.ToArray()); } if (baseColor >= 0) { ObjectChoices[baseColor].GetPart <LiquidVolume>().GetPrimaryLiquid().PouredOn(new LiquidVolume(ObjectChoices[baseColor].GetPart <LiquidVolume>().GetPrimaryLiquid().ID, 1), Canvas); ObjectChoices[baseColor].GetPart <LiquidVolume>().UseDrams(1); } if (detailColor >= 0) { ObjectChoices2[detailColor].GetPart <LiquidVolume>().GetPrimaryLiquid().PouredOn(new LiquidVolume(ObjectChoices2[detailColor].GetPart <LiquidVolume>().GetPrimaryLiquid().ID, 1), Canvas); ObjectChoices2[detailColor].GetPart <LiquidVolume>().UseDrams(1); } Canvas.ApplyEffect(painting); } }
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)); }