/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_xcsScript">The install script.</param> /// <param name="p_hifHeaderInfo">Information describing the form header.</param> /// <param name="p_csmStateManager">The install state manager.</param> /// <param name="p_lstInstallSteps">The install steps.</param> public OptionsForm(XmlScript p_xcsScript, HeaderInfo p_hifHeaderInfo, ConditionStateManager p_csmStateManager, IList <InstallStep> p_lstInstallSteps) { m_xcsScript = p_xcsScript; m_csmStateManager = p_csmStateManager; InitializeComponent(); hplTitle.Text = p_hifHeaderInfo.Title; hplTitle.Image = p_hifHeaderInfo.ShowImage ? p_csmStateManager.GetImage(p_hifHeaderInfo.ImagePath) : null; hplTitle.ShowFade = p_hifHeaderInfo.ShowFade; hplTitle.ForeColor = p_hifHeaderInfo.TextColour; hplTitle.TextPosition = p_hifHeaderInfo.TextPosition; if (p_hifHeaderInfo.Height > hplTitle.Height) { hplTitle.Height = p_hifHeaderInfo.Height; } foreach (InstallStep stpStep in p_lstInstallSteps) { OptionFormStep ofsStep = new OptionFormStep(m_csmStateManager, stpStep.OptionGroups); ofsStep.Dock = DockStyle.Fill; ofsStep.Visible = false; ofsStep.ItemChecked += new EventHandler(ofsStep_ItemChecked); pnlWizardSteps.Controls.Add(ofsStep); m_lstInstallSteps.Add(new KeyValuePair <InstallStep, OptionFormStep>(stpStep, ofsStep)); } m_intCurrentStep = -1; StepForward(); }
public override void OnSpeech(SpeechEventArgs e) { if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech)) { return; } Mobile from = e.Mobile; if (!e.Handled && from is PlayerMobile && from.InRange(this.Location, 2) && e.HasKeyword(0x1F)) // *disguise* { PlayerMobile pm = (PlayerMobile)from; if (pm.NpcGuild == NpcGuild.ThievesGuild) { SayTo(from, 501839); // That particular item costs 700 gold pieces. } else { SayTo(from, 501838); // I don't know what you're talking about. } e.Handled = true; } base.OnSpeech(e); }
public static void CommandUseReq(Mobile from, Item item) { if (from == null || item == null || item.Deleted) { return; } if (from.AccessLevel >= AccessLevel.GameMaster || DateTime.UtcNow >= from.NextActionTime) { bool blockdefaultonuse = false; blockdefaultonuse = (XmlScript.HasTrigger(from, TriggerName.onUse) && UberScriptTriggers.Trigger(from, from, TriggerName.onUse, item)) || (XmlScript.HasTrigger(item, TriggerName.onUse) && UberScriptTriggers.Trigger(item, from, TriggerName.onUse)); // need to check the item again in case it was modified in the OnUse or OnUser method if (!blockdefaultonuse && item != null && !item.Deleted) { from.Use(item); } from.NextActionTime = DateTime.UtcNow + Mobile.ServerWideObjectDelay; } else { from.SendActionMessage(); } }
public override void OnSpeech(SpeechEventArgs e) { if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech)) { return; } if (!e.Handled && m_NewsTimer == null && e.HasKeyword(0x30) && e.Mobile.Alive && InRange(e.Mobile, 12)) // *news* { Direction = GetDirectionTo(e.Mobile); TownCrierEntry tce = GetRandomEntry(); if (tce == null) { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1005643); // I have no news at this time. } else { m_NewsTimer = Timer.DelayCall( TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(3.0), ShoutNews_Callback, new NewsInfo(tce)); PublicOverheadMessage(MessageType.Regular, 0x3B2, 502978); // Some of the latest news! } } }
public InstallStepsEditorVM(XmlScript p_xscScript) { Script = p_xscScript; SortOrders = Enum.GetValues(typeof(SortOrder)); Errors = new ErrorContainer(); }
public override bool OnDragDrop(Mobile from, Item dropped) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped)) { return(true); } var player = from as PlayerMobile; if (player != null) { QuestSystem qs = player.Quest; if (qs is TheSummoningQuest) { if (dropped is DaemonBone) { var bones = (DaemonBone)dropped; QuestObjective obj = qs.FindObjective(typeof(CollectBonesObjective)); if (obj != null && !obj.Completed) { int need = obj.MaxProgress - obj.CurProgress; if (bones.Amount < need) { obj.CurProgress += bones.Amount; bones.Delete(); qs.ShowQuestLogUpdated(); } else { obj.Complete(); bones.Consume(need); if (!bones.Deleted) { // TODO: Accurate? SayTo(from, 1050038); // You have already given me all the Daemon bones necessary to weave the spell. Keep these for a later time. } } } else { // TODO: Accurate? SayTo(from, 1050038); // You have already given me all the Daemon bones necessary to weave the spell. Keep these for a later time. } return(false); } } } return(base.OnDragDrop(from, dropped)); }
public override void OnRemoved(object parent) { if (parent is Mobile) { if (XmlScript.HasTrigger(this, TriggerName.onUnequip)) { UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onUnequip); } Mobile from = (Mobile)parent; m_AosSkillBonuses.Remove(); m_AosAttributes.RemoveStatBonuses(from); if (m_Creature != null && !m_Creature.Deleted) { Effects.SendLocationParticles(EffectItem.Create(m_Creature.Location, m_Creature.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m_Creature, m_Creature.Map, 0x201); m_Creature.Delete(); } StopTimer(); } else if (parent is Item) { Item parentItem = (Item)parent; if (XmlScript.HasTrigger(this, TriggerName.onRemove)) { UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onRemove, parentItem); } } InvalidateProperties(); }
protected override void OnTarget(Mobile from, object targeted) { IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Inscribe, from.Skills[SkillName.Inscribe].Value)) { return; } BaseBook book = targeted as BaseBook; if (book == null) { from.SendLocalizedMessage(1046296); // That is not a book } else if (Inscribe.IsEmpty(book)) { from.SendLocalizedMessage(501611); // Can't copy an empty book. } else if (Inscribe.GetUser(book) != null) { from.SendLocalizedMessage(501621); // Someone else is inscribing that item. } else { Target target = new InternalTargetDst(book); from.Target = target; from.SendLocalizedMessage(501612); // Select a book to copy this to. target.BeginTimeout(from, TimeSpan.FromMinutes(1.0)); Inscribe.SetUser(book, from); } }
public override void OnRemoved(object parent) { Mobile mob = parent as Mobile; if (mob != null) { string modName = this.Serial.ToString(); mob.RemoveStatMod(modName + "Str"); mob.RemoveStatMod(modName + "Dex"); mob.RemoveStatMod(modName + "Int"); mob.CheckStatTimers(); if (XmlScript.HasTrigger(this, TriggerName.onUnequip)) { UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onUnequip); } } else if (parent is Item) { Item parentItem = (Item)parent; if (XmlScript.HasTrigger(this, TriggerName.onRemove)) { UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onRemove, parentItem); } } base.OnRemoved(parent); }
public override bool OnDragDrop(Mobile from, Item dropped) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped)) { return(true); } PlayerMobile player = from as PlayerMobile; if (player != null) { if (dropped is DaemonDust) { DaemonDust dust = ( DaemonDust )dropped; int amount = (dust.Amount * 5); this.PlaySound(665); this.KP += amount; dust.Delete(); this.Say("*" + this.Name + " absorbs the daemon dust*"); return(false); } else { } } return(base.OnDragDrop(from, dropped)); }
public override bool OnDragDrop(Mobile from, Item item) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, item)) { return(true); } if (m_Pay != 0) { // Is the creature already hired if (!Controlled) { // Is the item the payment in gold if (item is Gold) { // Is the payment in gold sufficient if (item.Amount >= m_Pay) { // Check if this mobile already has a hire BaseHire hire; m_HireTable.TryGetValue(from, out hire); if (hire != null && !hire.Deleted && hire.GetOwner() == from) { SayTo(from, 500896); // I see you already have an escort. } // Try to add the hireling as a follower else if (AddHire(from)) { SayTo(from, 1043258, string.Format("{0}", (int)item.Amount / m_Pay)); //"I thank thee for paying me. I will work for thee for ~1_NUMBER~ days.", (int)item.Amount / m_Pay ); m_HireTable[from] = this; m_HoldGold += item.Amount; m_PayTimer = new PayTimer(this); m_PayTimer.Start(); return(true); } return(false); } else { this.SayHireCost(); } } else { SayTo(from, 1043268); // Tis crass of me, but I want gold } } else { Say(1042495); // I have already been hired. } } else { SayTo(from, 500200); // I have no need for that. } return(base.OnDragDrop(from, item)); }
public RoyalAlchemist() : base("") { Name = "Erasmus"; Body = 400; Hue = 33777; SpecialTitle = "Royal Alchemist"; TitleHue = 1926; Blessed = true; CantWalk = true; SpeechHue = YellHue = 34; VirtualArmor = 36; AddItem(new Robe(Utility.RandomMetalHue())); AddItem(new Sandals(Utility.RandomMetalHue())); HairItemID = 8265; FacialHairItemID = 8254; XmlScript script = new XmlScript("Quests/CrippledKing/alchemist.us"); XmlAttach.AttachTo(this, script); HairHue = Utility.RandomMetalHue(); FacialHairHue = Utility.RandomMetalHue(); }
public override void OnAdded(object parent) { if (parent is Mobile) { if (XmlScript.HasTrigger(this, TriggerName.onEquip) && UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onEquip)) { ((Mobile)parent).AddToBackpack(this); // override, put it in their pack base.OnAdded(parent); return; } if (Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, (Mobile)parent)) { Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, (Mobile)parent); } else { ((Mobile)parent).AddToBackpack(this); } } else if (parent is Item) { Item parentItem = (Item)parent; if (XmlScript.HasTrigger(this, TriggerName.onAdded)) { UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onAdded, parentItem); } } base.OnAdded(parent); }
public override bool OnDragDrop(Mobile from, Item dropped) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped)) { return(true); } PlayerMobile player = from as PlayerMobile; if (player != null) { QuestSystem qs = player.Quest; if (qs is EminosUndertakingQuest) { if (dropped is NoteForZoel) { QuestObjective obj = qs.FindObjective(typeof(GiveZoelNoteObjective)); if (obj != null && !obj.Completed) { dropped.Delete(); obj.Complete(); return(true); } } } } return(base.OnDragDrop(from, dropped)); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_xcsScript">The install script.</param> /// <param name="p_hifHeaderInfo">Information describing the form header.</param> /// <param name="p_csmStateManager">The install state manager.</param> /// <param name="p_lstInstallSteps">The install steps.</param> public OptionsForm(XmlScript p_xcsScript, HeaderInfo p_hifHeaderInfo, ConditionStateManager p_csmStateManager, IList<InstallStep> p_lstInstallSteps) { m_xcsScript = p_xcsScript; m_csmStateManager = p_csmStateManager; InitializeComponent(); hplTitle.Text = p_hifHeaderInfo.Title; hplTitle.Image = p_hifHeaderInfo.ShowImage ? p_csmStateManager.GetImage(p_hifHeaderInfo.ImagePath) : null; hplTitle.ShowFade = p_hifHeaderInfo.ShowFade; hplTitle.ForeColor = p_hifHeaderInfo.TextColour; hplTitle.TextPosition = p_hifHeaderInfo.TextPosition; if (p_hifHeaderInfo.Height > hplTitle.Height) hplTitle.Height = p_hifHeaderInfo.Height; foreach (InstallStep stpStep in p_lstInstallSteps) { OptionFormStep ofsStep = new OptionFormStep(m_csmStateManager, stpStep.OptionGroups); ofsStep.Dock = DockStyle.Fill; ofsStep.Visible = false; ofsStep.ItemChecked += new EventHandler(ofsStep_ItemChecked); pnlWizardSteps.Controls.Add(ofsStep); m_lstInstallSteps.Add(new KeyValuePair<InstallStep, OptionFormStep>(stpStep, ofsStep)); } m_intCurrentStep = -1; StepForward(); }
public virtual void OnComponentUsed(AddonComponent c, Mobile from) { if (XmlScript.HasTrigger(this, TriggerName.onUse) && UberScriptTriggers.Trigger(this, from, TriggerName.onUse)) { return; } }
public override bool OnDragDrop(Mobile from, Item dropped) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped)) { return(true); } if (dropped is BlankScroll && UzeraanTurmoilQuest.HasLostScrollOfPower(from)) { FocusTo(from); Item scroll = new SchmendrickScrollOfPower(); if (!from.PlaceInBackpack(scroll)) { scroll.Delete(); from.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. return(false); } else { dropped.Consume(); from.SendLocalizedMessage(1049346); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product. return(dropped.Deleted); } } return(base.OnDragDrop(from, dropped)); }
public override void OnSpeech(SpeechEventArgs e) { if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech)) { return; } Mobile m = e.Mobile; Faction fact = Faction.Find(m); if (!e.Handled && m.Alive && e.HasKeyword(0x38)) // *appraise* { if (FactionAllegiance != null && fact != null && FactionAllegiance != fact) { Say("I will not do business with the enemy!"); } else if (!TestCenter.Enabled) { PublicOverheadMessage(MessageType.Regular, 0x3B2, 500608); // Which deed would you like appraised? m.BeginTarget(12, false, TargetFlags.None, Appraise_OnTarget); e.Handled = true; } } base.OnSpeech(e); }
public override void OnAdded(object parent) { Mobile mob = parent as Mobile; if (mob != null) { AddStatBonuses(mob); mob.CheckStatTimers(); if (XmlScript.HasTrigger(this, TriggerName.onEquip) && UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onEquip)) { ((Mobile)parent).AddToBackpack(this); // override, put it in their pack base.OnAdded(parent); return; } } else if (parent is Item) { Item parentItem = (Item)parent; if (XmlScript.HasTrigger(this, TriggerName.onAdded)) { UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onAdded, parentItem); } } base.OnAdded(parent); }
public UberGumpTree(Mobile owner, XmlNode current, XmlDocument document, string fileName, XmlScript script = null, TriggerName triggerName = TriggerName.NoTrigger) : base(150, 50) { m_CurrentNode = current; m_ParentDocument = document; m_Owner = owner; m_FileName = fileName; m_Script = script; m_TriggerName = triggerName; Closable = true; Disposable = true; Dragable = true; Resizable = false; AddPage(0); int height = CalculateHeight(document.FirstChild) + 40; AddBackground(0, 0, 168, height, 9300); AddLabel(10, 10, 38, "UberGump Tree Elements"); int penY = 10; int buttonID = 0; Traverse(document.FirstChild, 10, ref penY, ref buttonID); }
public override void OnDelete() { if (XmlScript.HasTrigger(this, TriggerName.onDelete)) { UberScriptTriggers.Trigger(this, this.RootParentEntity as Mobile, TriggerName.onDelete); } base.OnDelete(); }
protected void HandleInstallStepsPropertyChange(XmlScriptTreeNode p_stnNode, XmlScript p_xscScript, string p_strPropertyName) { if (p_strPropertyName.Equals(ObjectHelper.GetPropertyName <XmlScript>(x => x.InstallSteps))) { SelectedNode = p_stnNode; AddInstallSteps((XmlScriptTreeNode <XmlScript>)p_stnNode); } }
/// <summary> /// Parses the <see cref="Script"/> from an XML document. /// </summary> /// <returns>The XML representation of the <see cref="Script"/>.</returns> public XmlScript Parse() { HeaderInfo hdrHeader = GetHeaderInfo(); ICondition cndModPrerequisites = GetModPrerequisites(); List <InstallableFile> lstRequiredInstallFiles = GetRequiredInstallFiles(); List <InstallStep> lstInstallSteps = GetInstallSteps(); List <ConditionallyInstalledFileSet> lstConditionallyInstalledFileSets = GetConditionallyInstalledFileSets(); XmlScript xscScript = new XmlScript(ScriptType, ScriptType.GetXmlScriptVersion(Script), hdrHeader, cndModPrerequisites, lstRequiredInstallFiles, lstInstallSteps, GetInstallStepSortOrder(), lstConditionallyInstalledFileSets); return(xscScript); }
public ShipRepairTools(int uses) : base(uses, 0x1EB8) { Weight = 1.0; if (UberScriptFileName != null) { XmlScript script = new XmlScript(UberScriptFileName); script.Name = "shiprepair"; XmlAttach.AttachTo(this, script); } }
public override bool OnDragDrop(Mobile from, Item item) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, item)) { return(true); } return(XmlQuest.RegisterGive(from, this, item)); //return base.OnDragDrop(from, item); }
public override void OnSpeech(SpeechEventArgs e) { if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech)) { return; } if (!e.Handled && e.HasKeyword(Keyword) && e.Mobile.InRange(Location, 2)) { e.Handled = true; Mobile from = e.Mobile; var g = from.Guild as Guild; var ethic = Ethics.Player.Find(e.Mobile); if (g == null && ethic == null || g != null && g.Type != Type && ethic == null) { Say(SignupNumber); } else if (ethic != null && Shield is OrderShield && ethic.Ethic is EvilEthic || ethic != null && Shield is ChaosShield && ethic.Ethic is HeroEthic) { Say("Begone! You do not follow the proper ethic to wield one of our order's shields."); } else { Container pack = from.Backpack; BaseShield shield = Shield; Item twoHanded = from.FindItemOnLayer(Layer.TwoHanded); if ((pack != null && pack.FindItemByType(shield.GetType()) != null) || (twoHanded != null && shield.GetType().IsInstanceOfType(twoHanded))) { Say(1007110); // Why dost thou ask about virtue guards when thou art one? shield.Delete(); } else if (from.PlaceInBackpack(shield)) { Say(Utility.Random(1007101, 5)); Say(1007139); // I see you are in need of our shield, Here you go. from.AddToBackpack(shield); } else { from.SendLocalizedMessage(502868); // Your backpack is too full. shield.Delete(); } } } base.OnSpeech(e); }
protected override void OnTarget(Mobile from, object o) { IEntity entity = o as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner)) { return; } if (o is Mobile) { m_Owner.Target((Mobile)o); } }
protected override void OnTarget(Mobile from, object o) { IEntity entity = o as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner)) { return; } if (o is RecallRune) { RecallRune rune = (RecallRune)o; if (rune.Marked) { m_Owner.Effect(rune.Target, rune.TargetMap, true); } else { from.SendLocalizedMessage(501805); // That rune is not yet marked. } } else if (o is Runebook) { RunebookEntry e = ((Runebook)o).Default; if (e != null) { m_Owner.Effect(e.Location, e.Map, true); } else { from.SendLocalizedMessage(502354); // Target is not marked. } } else if (o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat) { BaseBoat boat = ((Key)o).Link as BaseBoat; if (!boat.Deleted && boat.CheckKey(((Key)o).KeyValue)) { m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false); } else { from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object. } } else { from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object. } }
// Alan Mod =================================== // this is when THIS container is added or removed from something public override void OnAdded(object parent) { if (parent is Item) { Item parentItem = (Item)parent; if (XmlScript.HasTrigger(this, TriggerName.onAdded)) { UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onAdded, parentItem); } } base.OnAdded(parent); }
public ShipCannon(BaseBoat boat, Point3D offset, ShipCannonDirection dir) : base(boat, offset, null) { m_CannonDirection = dir; SetFacing(boat.Facing); if (UberScriptFileName != null) { XmlScript script = new XmlScript(UberScriptFileName); script.Name = "cannon"; XmlAttach.AttachTo(this, script); } boat.BoatComponents.Add(this); CanBeChoppedDateTime = DateTime.UtcNow + TimeSpan.FromMinutes(1.0); }
protected override void OnTarget(Mobile from, object o) { IEntity entity = o as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.ItemID, from.Skills[SkillName.ItemID].Value)) { return; } if (o is Item && !(o is HouseSign)) { Item item = o as Item; if (from.CheckTargetSkill(SkillName.ItemID, o, 0, 100)) { if (o is BaseWeapon) { ((BaseWeapon)o).Identified = true; } else if (o is BaseArmor) { ((BaseArmor)o).Identified = true; } else if (o is BaseClothing) { ((BaseClothing)o).Identified = true; } else if (o is BaseTreasureChest) { BaseTreasureChest tchest = (BaseTreasureChest)o; from.SendMessage("{0} container with {1} treasure.", tchest.Locked ? "a locked" : "an unlocked", m_TreasureValue[(int)tchest.Level]); } //if ( !Core.AOS ) item.OnSingleClick(from); } else { from.SendLocalizedMessage(500353); // You are not certain... } } else if (o is Mobile) { ((Mobile)o).OnSingleClick(from); } else { from.SendLocalizedMessage(500353); // You are not certain... } //allows the identify skill to reveal attachments //Server.Engines.XmlSpawner2.XmlAttach.RevealAttachments(from, o); // we don't care about this -Alan }
/// <summary> /// Performs the mod installation based on the XML script. /// </summary> /// <param name="p_strModName">The name of the mod whose script in executing.</param> /// <param name="p_xscScript">The script that is executing.</param> /// <param name="p_csmStateManager">The state manager managing the install state.</param> /// <param name="p_colFilesToInstall">The list of files to install.</param> /// <param name="p_colPluginsToActivate">The list of plugins to activate.</param> /// <returns><c>true</c> if the installation succeeded; /// <c>false</c> otherwise.</returns> public bool Install(string p_strModName, XmlScript p_xscScript, ConditionStateManager p_csmStateManager, ICollection<InstallableFile> p_colFilesToInstall, ICollection<InstallableFile> p_colPluginsToActivate) { OverallMessage = String.Format("Installing {0}", p_strModName); OverallProgressStepSize = 1; ItemProgressStepSize = 1; ShowItemProgress = true; bool booSuccess = false; try { booSuccess = InstallFiles(p_xscScript, p_csmStateManager, p_colFilesToInstall, p_colPluginsToActivate); Status = Status == TaskStatus.Cancelling ? TaskStatus.Cancelled : TaskStatus.Complete; } catch (Exception ex) { booSuccess = false; Status = TaskStatus.Error; throw new Exception(ex.Message); } OnTaskEnded(booSuccess); return booSuccess; }
/// <summary> /// Adds a new <see cref="InstallStep"/> to the script. /// </summary> /// <param name="p_xscScript">The script to which to add the <see cref="InstallStep"/>.</param> protected void AddInstallStep(XmlScript p_xscScript) { string strStepName = null; for (Int32 i = 1; i < Int32.MaxValue; i++) { strStepName = String.Format("New Install Step {0}", i); if (!p_xscScript.InstallSteps.Contains(x => strStepName.Equals(x.Name))) break; strStepName = null; } if (strStepName == null) throw new Exception("Unable to new new Install Step: too many steps exist."); p_xscScript.InstallSteps.Add(new InstallStep(strStepName, null, SortOrder.Ascending)); }
protected void HandleInstallStepsPropertyChange(XmlScriptTreeNode p_stnNode, XmlScript p_xscScript, string p_strPropertyName) { if (p_strPropertyName.Equals(ObjectHelper.GetPropertyName<XmlScript>(x => x.InstallSteps))) { SelectedNode = p_stnNode; AddInstallSteps((XmlScriptTreeNode<XmlScript>)p_stnNode); } }
protected void FormatInstallSteps(XmlScriptTreeNode p_stnNode, XmlScript p_xscScript) { Int32 intStepCount = (Script.Version > new Version(3, 0, 0, 0)) ? p_xscScript.InstallSteps.Count : 1; p_stnNode.Text = String.Format("Install Steps ({0})", intStepCount); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_xscScript">The script to unparse.</param> public Unparser(XmlScript p_xscScript) { Script = p_xscScript; }
public InstallStepsVM(XmlScript p_xscScript) { Script = p_xscScript; Reset(); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_xscScript">The script to unparse.</param> public Unparser10(XmlScript p_xscScript) : base(p_xscScript) { }
/// <summary> /// Installs and activates files are required. This method is used by the background worker. /// </summary> /// <param name="p_scpScript">The XMl Script to execute.</param> protected bool InstallFiles(XmlScript p_xscScript, ConditionStateManager p_csmStateManager, ICollection<InstallableFile> p_colFilesToInstall, ICollection<InstallableFile> p_colPluginsToActivate) { IList<InstallableFile> lstRequiredFiles = p_xscScript.RequiredInstallFiles; IList<ConditionallyInstalledFileSet> lstConditionallyInstalledFileSets = p_xscScript.ConditionallyInstalledFileSets; OverallProgressMaximum = lstRequiredFiles.Count + p_colFilesToInstall.Count + lstConditionallyInstalledFileSets.Count; foreach (InstallableFile iflRequiredFile in lstRequiredFiles) { if (Status == TaskStatus.Cancelling) return false; if (!InstallFile(iflRequiredFile, true)) return false; StepOverallProgress(); } foreach (InstallableFile ilfFile in p_colFilesToInstall) { if (Status == TaskStatus.Cancelling) return false; if (!InstallFile(ilfFile, p_colPluginsToActivate.Contains(ilfFile))) return false; StepOverallProgress(); } foreach (ConditionallyInstalledFileSet cisFileSet in lstConditionallyInstalledFileSets) { if (cisFileSet.Condition.GetIsFulfilled(p_csmStateManager)) foreach (InstallableFile ilfFile in cisFileSet.Files) { if (Status == TaskStatus.Cancelling) return false; if (!InstallFile(ilfFile, true)) return false; } StepOverallProgress(); } return true; }
/// <summary> /// A simple constructor that initializes the object with the required dependencies /// </summary> /// <param name="p_xscScript">The <see cref="XmlScript"/> being viewed.</param> public XmlScriptTreeViewVM(XmlScript p_xscScript) : this((XmlScriptType)p_xscScript.Type) { Script = p_xscScript; }
protected void FormatPrerequisites(XmlScriptTreeNode p_stnNode, XmlScript p_xscScript) { Int32 intPrerequisiteCount = 0; if (p_xscScript.ModPrerequisites != null) { intPrerequisiteCount = 1; if (p_xscScript.ModPrerequisites is CompositeCondition) intPrerequisiteCount = ((CompositeCondition)p_xscScript.ModPrerequisites).Conditions.Count; } p_stnNode.Text = String.Format("Prerequisites ({0})", intPrerequisiteCount); }
/// <summary> /// Gets a unparser for the given script. /// </summary> /// <param name="p_xscScript">The script for which to get an unparser.</param> /// <returns>An unparser for the given script.</returns> protected virtual IUnparser GetUnparser(XmlScript p_xscScript) { switch (p_xscScript.Version.ToString()) { case "1.0": return new Unparser10(p_xscScript); case "2.0": return new Unparser20(p_xscScript); case "3.0": return new Unparser30(p_xscScript); case "4.0": return new Unparser40(p_xscScript); case "5.0": return new Unparser50(p_xscScript); } throw new ParserException("Unrecognized XML Script version (" + p_xscScript.Version + "). Perhaps a newer version of the mod manager is required."); }
public PrerequisitesEditorVM(CPLEditorVM p_edtEditorViewModel, CPLConverter p_ctrCPLConverter, XmlScript p_xscScript) : base(p_edtEditorViewModel, p_ctrCPLConverter, null) { Script = p_xscScript; }
/// <summary> /// Parses the <see cref="Script"/> from an XML document. /// </summary> /// <returns>The XML representation of the <see cref="Script"/>.</returns> public XmlScript Parse() { HeaderInfo hdrHeader = GetHeaderInfo(); ICondition cndModPrerequisites = GetModPrerequisites(); List<InstallableFile> lstRequiredInstallFiles = GetRequiredInstallFiles(); List<InstallStep> lstInstallSteps = GetInstallSteps(); List<ConditionallyInstalledFileSet> lstConditionallyInstalledFileSets = GetConditionallyInstalledFileSets(); XmlScript xscScript = new XmlScript(ScriptType, ScriptType.GetXmlScriptVersion(Script), hdrHeader, cndModPrerequisites, lstRequiredInstallFiles, lstInstallSteps, GetInstallStepSortOrder(), lstConditionallyInstalledFileSets); return xscScript; }