/// <summary> /// Takes a control and make it blink until Condition is false. /// </summary> /// <param name="ctrl"></param> /// <param name="Condition"></param> private async void BlinkControl(Control[] ctrls, CustomCondition Condition) { while (Condition()) { foreach (Control ctrl in ctrls) { ctrl.ForeColor = ctrl.ForeColor == Color.Red ? Color.LimeGreen : Color.Red; } await Task.Delay(500); } foreach (Control ctrl in ctrls) { ctrl.ForeColor = Color.LimeGreen; } }
public bool IsVisible(IPlayer player) { if (!TestPlayerCondition(player)) { return(false); } var powers = player.Powers; if (!TestEquippedSkills(powers)) { return(false); } if (!TestMissingSkills(powers)) { return(false); } if (!TestEquippedPassives(powers)) { return(false); } if (!TestMissingPassives(powers)) { return(false); } if (!TestActiveBuffs(powers)) { return(false); } if (!TestInactiveBuffs(powers)) { return(false); } if (!TestActors()) { return(false); } if (!TestInvocations()) { return(false); } return(CustomCondition == null || CustomCondition.Invoke(player)); }
private static QuestCondition ShowConditionInfo(QuestCondition condition) { var oldtype = condition.ConditionType; condition.ConditionType = (ConditionType)RPGMakerGUI.EnumPopup("Condition Type:", condition.ConditionType); if (condition.ConditionType != oldtype) { //TODO: if no longer interact node tree than delete that node tree switch (condition.ConditionType) { case ConditionType.Kill: condition = new KillCondition(); break; case ConditionType.Item: condition = new ItemCondition(); break; case ConditionType.Interact: condition = new InteractCondition(); break; case ConditionType.Deliver: condition = new DeliverCondition(); break; case ConditionType.Custom: condition = new CustomCondition(); break; default: throw new ArgumentOutOfRangeException(); } } var killCondition = condition as KillCondition; var itemCondition = condition as ItemCondition; var interactCondition = condition as InteractCondition; var deliverCondition = condition as DeliverCondition; var customCondition = condition as CustomCondition; if (killCondition != null) { if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs) { RPGMakerGUI.Toggle("Is NPC?", ref killCondition.IsNPC); } else { killCondition.IsNPC = false; } if (killCondition.IsNPC) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to Kill:", ref killCondition.CombatantID); } else { RPGMakerGUI.PopupID <CombatCharacter>("Enemy to Kill:", ref killCondition.CombatantID); } killCondition.NumberToKill = RPGMakerGUI.IntField("Number To Kill:", killCondition.NumberToKill); } if (itemCondition != null) { itemCondition.ItemType = (ItemConditionType)RPGMakerGUI.EnumPopup("Required Item Type:", itemCondition.ItemType); if (itemCondition.ItemType == ItemConditionType.CraftItem) { RPGMakerGUI.PopupID <Item>("CraftItem To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Craft"); } else if (itemCondition.ItemType == ItemConditionType.QuestItem) { RPGMakerGUI.PopupID <Item>("Quest Item To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Quest"); if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs) { RPGMakerGUI.Toggle("NPC Drops Items?", ref itemCondition.NPCDropsItem); } else { itemCondition.NPCDropsItem = false; } if (itemCondition.NPCDropsItem) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC that Drops Item:", ref itemCondition.CombatantIDThatDropsItem); } else { RPGMakerGUI.PopupID <CombatCharacter>("Enemy that Drops Item:", ref itemCondition.CombatantIDThatDropsItem); } } else if (itemCondition.ItemType == ItemConditionType.Item) { RPGMakerGUI.PopupID <Item>("Item To Collect:", ref itemCondition.ItemToCollectID); } itemCondition.NumberToObtain = RPGMakerGUI.IntField("Number To Obtain:", itemCondition.NumberToObtain); } if (interactCondition != null) { if (RPGMakerGUI.Toggle("Talk to NPC?", ref interactCondition.IsNpc)) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to talk to:", ref interactCondition.InteractableID); } else { RPGMakerGUI.PopupID <Interactable>("Object to interact with:", ref interactCondition.InteractableID); } if (GUILayout.Button("Open Interaction Node Tree", "genericButton", GUILayout.MaxHeight(30))) { var trees = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees; var existingTree = trees.FirstOrDefault(t => t.ID == interactCondition.InteractionNodeTreeID); if (existingTree == null) { existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog); Debug.Log("ExistingTree null? " + existingTree == null); existingTree.ID = interactCondition.ID; Debug.Log(existingTree.ID + ":::" + existingTree.Name); var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest; //todo: need unique name existingTree.Name = curSelectedQuest.Name + "Interact"; trees.Add(existingTree); } DialogNodeWindow.ShowWindow(interactCondition.ID); interactCondition.InteractionNodeTreeID = existingTree.ID; } } if (deliverCondition != null) { RPGMakerGUI.PopupID <Item>("Quest Item To Deliver:", ref deliverCondition.ItemToDeliverID, "ID", "Name", "Quest"); if (RPGMakerGUI.Toggle("Deliver to NPC?", ref deliverCondition.DeliverToNPC)) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to deliver to:", ref deliverCondition.InteractableToDeliverToID); } else { RPGMakerGUI.PopupID <Interactable>("Object to deliver with:", ref deliverCondition.InteractableToDeliverToID); } if (GUILayout.Button("Open Interaction On Deliver", "genericButton", GUILayout.MaxHeight(30))) { var trees = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees; var existingTree = trees.FirstOrDefault(t => t.ID == deliverCondition.InteractionNodeTreeID); if (existingTree == null) { existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog); existingTree.ID = deliverCondition.ID; //todo: need unique name var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest; existingTree.Name = curSelectedQuest.Name + "Interact"; trees.Add(existingTree); } DialogNodeWindow.ShowWindow(deliverCondition.ID); deliverCondition.InteractionNodeTreeID = existingTree.ID; } } if (customCondition != null) { var customVar = customCondition.CustomVariableRequirement; RPGMakerGUI.PopupID <Rmh_CustomVariable>("Custom Variable:", ref customVar.VariableID); var foundCvar = Rm_RPGHandler.Instance.DefinedVariables.Vars.FirstOrDefault(v => v.ID == customCondition.CustomVariableRequirement.VariableID); if (foundCvar != null) { switch (foundCvar.VariableType) { case Rmh_CustomVariableType.Float: customVar.FloatValue = RPGMakerGUI.FloatField("Required Value:", customVar.FloatValue); break; case Rmh_CustomVariableType.Int: customVar.IntValue = RPGMakerGUI.IntField("Required Value:", customVar.IntValue); break; case Rmh_CustomVariableType.String: customVar.StringValue = RPGMakerGUI.TextField("Required Value:", customVar.StringValue); break; case Rmh_CustomVariableType.Bool: selectedVarSetterBoolResult = customVar.BoolValue ? 0 : 1; selectedVarSetterBoolResult = EditorGUILayout.Popup("Required Value:", selectedVarSetterBoolResult, new[] { "True", "False" }); customVar.BoolValue = selectedVarSetterBoolResult == 0; break; default: throw new ArgumentOutOfRangeException(); } } } if (condition.ConditionType != ConditionType.Custom) { RPGMakerGUI.Toggle("Use Custom Tracking Text:", ref condition.UseCustomText); } else { condition.UseCustomText = true; } if (condition.UseCustomText) { condition.CustomText = RPGMakerGUI.TextField("Custom Incomplete Text:", condition.CustomText); condition.CustomCompletedText = RPGMakerGUI.TextField("Custom Completed Text:", condition.CustomCompletedText); } GUILayout.Space(5); return(condition); }
public bool IsVisible(IController controller) { if (HeroClass != HeroClass.None && Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass) { return(false); } if (controller.Game.IsInTown && !ShowInTown) { return(false); } //return true; var visible = true; var player = controller.Game.Me; var powers = player.Powers; if (EquippedSkills != null) { visible = AllEquippedSkills ? EquippedSkills.All(skill => powers.UsedSkills.Any(playerSkill => (skill.Icon.HasValue ? playerSkill.SnoPower.Sno == skill.Sno && playerSkill.Rune == skill.Icon.Value : playerSkill.SnoPower.Sno == skill.Sno) && (!playerSkill.IsOnCooldown || !CheckSkillCooldowns))) : EquippedSkills.Any(skill => powers.UsedSkills.Any(playerSkill => (skill.Icon.HasValue ? playerSkill.SnoPower.Sno == skill.Sno && playerSkill.Rune == skill.Icon.Value : playerSkill.SnoPower.Sno == skill.Sno) && (!playerSkill.IsOnCooldown || !CheckSkillCooldowns))); } if (visible && MissingSkills != null) { visible = MissingSkills.Any(skill => powers.UsedSkills.All(playerSkill => playerSkill.SnoPower.Sno != skill.Sno)); } if (visible && EquippedPassives != null) { visible = EquippedPassives.All(passive => powers.UsedPassives.Any(playerPassive => playerPassive.Sno == passive)); } if (visible && MissingPassives != null) { visible = MissingPassives.Any(passive => powers.UsedPassives.All(playerPassive => playerPassive.Sno != passive)); } if (visible && ActiveBuffs != null) { visible = AllActiveBuffs ? ActiveBuffs.All(buff => buff.Icon.HasValue ? powers.BuffIsActive(buff.Sno, buff.Icon.Value) : powers.BuffIsActive(buff.Sno)) : ActiveBuffs.Any(buff => buff.Icon.HasValue ? powers.BuffIsActive(buff.Sno, buff.Icon.Value) : powers.BuffIsActive(buff.Sno)); } if (visible && InactiveBuffs != null) { visible = AllInactiveBuffs ? InactiveBuffs.All(buff => buff.Icon.HasValue ? !powers.BuffIsActive(buff.Sno, buff.Icon.Value) : !powers.BuffIsActive(buff.Sno)) : InactiveBuffs.Any(buff => buff.Icon.HasValue ? !powers.BuffIsActive(buff.Sno, buff.Icon.Value) : !powers.BuffIsActive(buff.Sno)); } if (visible && ActorSnoIds != null) { visible = Hud.Game.Actors.Any(a => ActorSnoIds.Contains(a.SnoActor.Sno)); } if (visible && InvocationActorSnoIds != null) { visible = !Hud.Game.Actors.Any(a => a.SummonerAcdDynamicId == Hud.Game.Me.SummonerId && InvocationActorSnoIds.Contains(a.SnoActor.Sno)); } if (visible && CustomCondition != null) { visible = CustomCondition.Invoke(Hud); } return(visible); }