void UpdateQuest() { selectQuest = null; playerQuest = PlayerState._instance.GetPlayerQuest(); for (int i = 0; i < questShowList.Count; i++) { NGUITools.Destroy(questShowList[i]); } questShowList.Clear(); foreach (KeyValuePair<int, Quest> item in playerQuest.GetAcceptQuestList()) { if (selectQuest == null) { selectQuest = item.Value; } if (!item.Value.isOver) { goQuest = NGUITools.AddChild(containQuestGrid, prefabQuestButton); goQuest.transform.Find("Title").GetComponent<UILabel>().text = string.Format("Quest:{0}", item.Value.info.name); goQuest.transform.Find("Doing").GetComponent<UILabel>().text = string.Format("Doing : Step {0}", item.Value.stepNow); goQuest.name = item.Key.ToString(); questShowList.Add(goQuest); } } containQuestGrid.GetComponent<UIGrid>().enabled = true; UpdateStep(); }
public CPlayerQuest(PlayerQuest quest) { Id = quest.Id; Name = quest.Name; IsCompleted = quest.IsCompleted; RewardIds = new List <uint>(); foreach (var choice in quest.GetRewardChoices()) { RewardIds.Add(choice.ItemId); } }
public override void OnStart() { PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById(QuestId); if (quest != null) { TreeRoot.GoalText = "Doing: " + quest.Name; } else { TreeRoot.GoalText = "GreaterOfTwoEvils - "; } if (TreeRoot.Current == null) { Log("ERROR - TreeRoot.Current == null"); } else if (TreeRoot.Current.Root == null) { Log("ERROR - TreeRoot.Current.Root == null"); } else if (TreeRoot.Current.Root.LastStatus == RunStatus.Running) { Log("ERROR - TreeRoot.Current.Root.LastStatus == RunStatus.Running"); } else { var currentRoot = TreeRoot.Current.Root; if (!(currentRoot is GroupComposite)) { Log("ERROR - !(currentRoot is GroupComposite)"); } else { if (currentRoot is Sequence) { lastStateReturn = RunStatus.Failure; } else if (currentRoot is PrioritySelector) { lastStateReturn = RunStatus.Success; } else { DLog("unknown type of Group Composite at root"); lastStateReturn = RunStatus.Success; } var root = (GroupComposite)currentRoot; root.InsertChild(0, CreateBehavior()); } } }
public override void OnStart() { PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); if ((QuestId != 0) && (quest == null)) { QBCLog.Error("This behavior has been associated with QuestId({0}), but the quest is not in our log", QuestId); IsAttributeProblem = true; } // This reports problems, and stops BT processing if there was a problem with attributes... // We had to defer this action, as the 'profile line number' is not available during the element's // constructor call. OnStart_HandleAttributeProblem(); // We need to move off boat after quest is complete, so we can't use "quest complete" // as part of the normal IsDone criteria for this behavior. So, we explicitly check for // quest complete here, and set IsDone appropriately. if (!UtilIsProgressRequirementsMet(QuestId, QuestRequirementInLog, QuestRequirementComplete)) { _isBehaviorDone = true; } // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { _configMemento = new ConfigMemento(); // Disable any settings that may interfere with the escort -- // When we escort, we don't want to be distracted by other things. // NOTE: these settings are restored to their normal values when the behavior completes // or the bot is stopped. CharacterSettings.Instance.HarvestHerbs = false; CharacterSettings.Instance.HarvestMinerals = false; CharacterSettings.Instance.LootChests = false; CharacterSettings.Instance.NinjaSkin = false; CharacterSettings.Instance.SkinMobs = false; BlackspotManager.AddBlackspots(Blackspots); State_MainBehavior = StateType_MainBehavior.AssigningTask; _behaviorTreeHook_CombatMain = CreateBehavior_CombatMain(); TreeHooks.Instance.InsertHook("Combat_Main", 0, _behaviorTreeHook_CombatMain); _behaviorTreeHook_CombatOnly = CreateBehavior_CombatOnly(); TreeHooks.Instance.InsertHook("Combat_Only", 0, _behaviorTreeHook_CombatOnly); _behaviorTreeHook_DeathMain = CreateBehavior_DeathMain(); TreeHooks.Instance.InsertHook("Death_Main", 0, _behaviorTreeHook_DeathMain); this.UpdateGoalText(QuestId); } }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => (QuestId != 0 && me.QuestLog.GetQuestById(QuestId) != null && me.QuestLog.GetQuestById(QuestId).IsCompleted), new Action(ret => _isDone = true)), new Decorator(ret => Counter > 1, new Action(ret => _isDone = true)), new PrioritySelector( new Decorator(ret => !MovedToTarget, new Action(delegate { ObjectManager.Update(); npcList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(u => u.Entry == NPCID) .OrderBy(u => u.Distance).ToList(); PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById(QuestId); if (quest.IsCompleted || quest.IsFailed) { Counter++; return RunStatus.Success; } else if (npcList.Count >= 1 && !me.Combat) { Navigator.MoveTo(npcList[0].Location); } else if (npcList.Count <= 0 && !me.Combat) { Counter++; return RunStatus.Success; } if (me.Combat || npcList[0].Combat) { return RunStatus.Success; } return RunStatus.Running; }) ), new Action(ret => Thread.Sleep(100)) ) ))); }
// 9Mar2013-07:55UTC chinajade public static string ToString_FullInfo(this PlayerQuest playerQuest, bool useCompactForm = false, int indentLevel = 0) { var tmp = new StringBuilder(); if (playerQuest != null) { var indent = string.Empty.PadLeft(indentLevel); var fieldSeparator = useCompactForm ? " " : string.Format("\n {0}", indent); tmp.AppendFormat("<PlayerQuest Key_Id=\"{0}\" Key_Name=\"{1}\"", playerQuest.Id, playerQuest.Name); tmp.AppendFormat("{0}CompletionText=\"{1}\"", fieldSeparator, playerQuest.CompletionText); tmp.AppendFormat("{0}Description=\"{1}\"", fieldSeparator, playerQuest.Description); tmp.AppendFormat("{0}FlagsPvP=\"{1}\"", fieldSeparator, playerQuest.FlagsPVP); tmp.AppendFormat("{0}Id=\"{1}\"", fieldSeparator, playerQuest.Id); tmp.AppendFormat("{0}InternalInfo=\"{1}\"", fieldSeparator, playerQuest.InternalInfo); tmp.AppendFormat("{0}IsAutoAccepted=\"{1}\"", fieldSeparator, playerQuest.IsAutoAccepted); tmp.AppendFormat("{0}IsCompleted=\"{1}\"", fieldSeparator, playerQuest.IsCompleted); tmp.AppendFormat("{0}IsDaily=\"{1}\"", fieldSeparator, playerQuest.IsDaily); tmp.AppendFormat("{0}IsFailed=\"{1}\"", fieldSeparator, playerQuest.IsFailed); tmp.AppendFormat("{0}IsPartyQuest=\"{1}\"", fieldSeparator, playerQuest.IsPartyQuest); tmp.AppendFormat("{0}IsSharable=\"{1}\"", fieldSeparator, playerQuest.IsShareable); tmp.AppendFormat("{0}IsStayAliveQuest=\"{1}\"", fieldSeparator, playerQuest.IsStayAliveQuest); tmp.AppendFormat("{0}IsWeekly=\"{1}\"", fieldSeparator, playerQuest.IsWeekly); tmp.AppendFormat("{0}Level=\"{1}\"", fieldSeparator, playerQuest.Level); tmp.AppendFormat("{0}Name=\"{1}\"", fieldSeparator, playerQuest.Name); tmp.AppendFormat("{0}NormalObjectiveRequiredCounts=\"{1}\"", fieldSeparator, (playerQuest.NormalObjectiveRequiredCounts == null) ? "NONE" : string.Join(", ", playerQuest.NormalObjectiveRequiredCounts.Select(c => c.ToString()))); tmp.AppendFormat("{0}Objectives=\"{1}\"", fieldSeparator, (playerQuest.Objectives == null) ? "NONE" : string.Join(",", playerQuest.Objectives.Select(o => string.Format("{0} \"{1}\"", fieldSeparator, o)))); tmp.AppendFormat("{0}ObjectiveText=\"{1}\"", fieldSeparator, playerQuest.ObjectiveText); tmp.AppendFormat("{0}RequiredLevel=\"{1}\"", fieldSeparator, playerQuest.RequiredLevel); tmp.AppendFormat("{0}RewardMoney=\"{1}\"", fieldSeparator, playerQuest.RewardMoney); tmp.AppendFormat("{0}RewardMoneyAtMaxLevel=\"{1}\"", fieldSeparator, playerQuest.RewardMoneyAtMaxLevel); tmp.AppendFormat("{0}RewardNumTalentPoints=\"{1}\"", fieldSeparator, playerQuest.RewardNumTalentPoints); tmp.AppendFormat("{0}RewardSpell=\"{1}\"", fieldSeparator, (playerQuest.RewardSpell == null) ? null : ToString_FullInfo(playerQuest.RewardSpell, false, indentLevel + 4)); tmp.AppendFormat("{0}RewardSpellId=\"{1}\"", fieldSeparator, playerQuest.RewardSpellId); tmp.AppendFormat("{0}RewardTitleId=\"{1}\"", fieldSeparator, playerQuest.RewardTitleId); tmp.AppendFormat("{0}RewardXp=\"{1}\"", fieldSeparator, playerQuest.RewardXp); tmp.AppendFormat("{0}SubDescription=\"{1}\"", fieldSeparator, playerQuest.SubDescription); tmp.AppendFormat("{0}SuggestedPlayers=\"{1}\"", fieldSeparator, playerQuest.SuggestedPlayers); tmp.AppendFormat("{0}/>", fieldSeparator); } return(tmp.ToString()); }
public override void OnStart() { PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById(QuestId); if (quest != null) { TreeRoot.GoalText = "Transport - " + quest.Name; } else { TreeRoot.GoalText = "Transport: Running"; } }
/// <summary> /// <para>This reports problems, and stops BT processing if there was a problem with attributes... /// We had to defer this action, as the 'profile line number' is not available during the element's /// constructor call.</para> /// <para>It also captures the user's configuration, and installs Behavior Tree hooks. The items will /// be restored when the behavior terminates, or Honorbuddy is stopped.</para> /// </summary> /// <param name="extraGoalTextDescription"></param> protected void OnStart_QuestBehaviorCore(string extraGoalTextDescription = null) { UsageCheck_SemanticCoherency(Element, ((QuestObjectiveIndex > 0) && (QuestId <= 0)), context => string.Format("QuestObjectiveIndex of '{0}' specified, but no corresponding QuestId provided", QuestObjectiveIndex)); EvaluateUsage_SemanticCoherency(Element); // Deprecated attributes... // TODO: Do this later, after we've made a sweep through Kick's profiles... EvaluateUsage_DeprecatedAttributes(Element); // This reports problems, and stops BT processing if there was a problem with attributes... // We had to defer this action, as the 'profile line number' is not available during the element's // constructor call. OnStart_HandleAttributeProblem(); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { // The ConfigMemento() class captures the user's existing configuration. // After its captured, we can change the configuration however needed. // When the memento is dispose'd, the user's original configuration is restored. // More info about how the ConfigMemento applies to saving and restoring user configuration // can be found here... // http://www.thebuddyforum.com/mediawiki/index.php?title=Honorbuddy_Programming_Cookbook:_Saving_and_Restoring_User_Configuration _configMemento = new ConfigMemento(); BotEvents.OnBotStop += BotEvents_OnBotStop; PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); TreeRoot.GoalText = string.Format( "{1}: \"{2}\"{0}{3}{0}{0}{4}", Environment.NewLine, GetType().Name, ((quest != null) ? string.Format("\"{0}\" (QuestId: {1})", quest.Name, QuestId) : "In Progress (no associated quest)"), (extraGoalTextDescription ?? string.Empty), GetProfileReference(Element)); _behaviorTreeHook_CombatMain = new ExceptionCatchingWrapper(this, CreateBehavior_CombatMain()); TreeHooks.Instance.InsertHook("Combat_Main", 0, _behaviorTreeHook_CombatMain); _behaviorTreeHook_CombatOnly = new ExceptionCatchingWrapper(this, CreateBehavior_CombatOnly()); TreeHooks.Instance.InsertHook("Combat_Only", 0, _behaviorTreeHook_CombatOnly); _behaviorTreeHook_DeathMain = new ExceptionCatchingWrapper(this, CreateBehavior_DeathMain()); TreeHooks.Instance.InsertHook("Death_Main", 0, _behaviorTreeHook_DeathMain); } }
public override void OnStart() { _timer = null; PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById(QuestId); if (quest != null) { TreeRoot.GoalText = "UseItemOn - " + quest.Name; } else { TreeRoot.GoalText = "UseItemOn: Running"; } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { PlayerQuest player = collision.gameObject.GetComponent <PlayerQuest>(); if (player.Quest == false) { ForgeronController forgeron = GameObject.Find("Forgeron").GetComponent <ForgeronController>(); //forgeron.display.text = "Table de quête : Marteau, rencontrer le forgeron ! Récompense."; //////////////////////////////////////// Marteau.SetActive(true); } player.Quest = true; } }
private void CompleteQuest(PlayerQuest quest) { ShowMessage("Quest completed! You receive:"); ShowMessage(quest.Details.RewardExperiencePoints.ToString() + " EXP"); ShowMessage(quest.Details.RewardGold.ToString() + " Gold"); if (quest.Details.RewardItem != null) { ShowMessage(quest.Details.RewardItem.Name); _player.AddItem(quest.Details.RewardItem, 1); } RewardXP(quest.Details.RewardExperiencePoints); _player.RewardGold(quest.Details.RewardGold); quest.IsCompleted = true; }
public string forgeronTalk(Forgeron context, Collider otherObject) { PlayerQuest player = otherObject.gameObject.GetComponent <PlayerQuest>(); if (player.inventory.Contains("Marteau")) { context.changeState(new ValidateQuest()); return("Genial tu as retrouvé mon Marteau !!! Pour te recompenser je t'offre .... ce Marteau !"); } else { return("Alors tu as trouvé mon marteau ?"); } }
// Use this for initialization void Start() { isShowPanel = false; questShowList = new List<GameObject>(); stepShowList = new List<GameObject>(); playerQuest = PlayerState._instance.GetPlayerQuest(); npcManager =NPCManager._instance; mainControllerUI =UIController._instance; containQuestGrid = transform.Find("QuestBG").Find("Scroll View").Find("Items").gameObject; containStepGrid = transform.Find("StepBG").Find("Scroll View").Find("Items").gameObject; this.gameObject.SetActive(false); }
private void Awake() { if (instance == null) { instance = this; } else { if (instance != this) { Destroy(gameObject); } } DontDestroyOnLoad(gameObject); }
public PlayerQuestUI(Vector2 position, GameManager gameManager, GameDevice gameDevice) { this.offsetPosition = position; this.gameManager = gameManager; input = gameDevice.InputState; renderer = gameDevice.Renderer; enemyName = gameManager.EnemyName; enemyName.Load(); itemManager = gameManager.ItemManager; playerQuest = gameManager.PlayerQuest; playerQuest.UpdateQuestProcess(); quests = playerQuest.CurrentQuest(); InitButtons(); currentQuest = -1; }
public override void OnStart() { // This reports problems, and stops BT processing if there was a problem with attributes... // We had to defer this action, as the 'profile line number' is not available during the element's // constructor call. OnStart_HandleAttributeProblem(); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); TreeRoot.GoalText = this.GetType().Name + ": " + ((quest != null) ? ("\"" + quest.Name + "\"") : "In Progress"); } }
// 28May2013-08:11UTC chinajade public static bool IsQuestComplete(this LocalPlayer localPlayer, int questId) { Contract.Requires(questId >= 0, context => "questId >= 0"); // A QuestId of zero is never complete... if (questId == 0) { return(false); } PlayerQuest quest = localPlayer.QuestLog.GetQuestById((uint)questId); return((quest != null) ? quest.IsCompleted // Immediately complete? : localPlayer.QuestLog.GetCompletedQuests().Contains((uint)questId)); // Historically complete? }
void OnTriggerEnter(Collider other) { Debug.Log("COLLISION"); if (other.gameObject.tag == "Player") { PlayerQuest q = other.GetComponent <PlayerQuest>(); for (int i = 0; i < q.quests.Count; i++) { if (q.quests[i].name == "Big Trouble In Little China!") { q.quests[i].goal.ObjectCollected(); } } } }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => (QuestId != 0 && Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted), new Action(ret => _isBehaviorDone = true)), new Decorator(ret => Counter > 0, new Action(ret => _isBehaviorDone = true)), new PrioritySelector( new Decorator(ret => !MovedToTarget, new Action(delegate { ObjectManager.Update(); _npcList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(u => u.Entry == MobId) .OrderBy(u => u.Distance).ToList(); PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); if (quest.IsCompleted) { Counter++; return RunStatus.Success; } else if (_npcList.Count >= 1) { Navigator.MoveTo(_npcList[0].Location); } else { Navigator.MoveTo(Location); } return RunStatus.Running; }) ), new Action(ret => Navigator.MoveTo(Location)) ) ))); }
void OnTriggerEnter(Collider other) { Debug.Log("COLLISION"); if (other.gameObject.tag == "Player") { PlayerQuest q = other.GetComponent <PlayerQuest>(); for (int i = 0; i < q.quests.Count; i++) { if (q.quests[i].name == "Find Glasses") { q.quests[i].goal.ObjectCollected(); Destroy(gameObject); } } } }
public override void OnStart() { PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); if ((QuestId != 0) && (quest == null)) { QBCLog.Error("This behavior has been associated with QuestId({0}), but the quest is not in our log", QuestId); IsAttributeProblem = true; } // This reports problems, and stops BT processing if there was a problem with attributes... // We had to defer this action, as the 'profile line number' is not available during the element's // constructor call. OnStart_HandleAttributeProblem(); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { _configMemento = new ConfigMemento(); // Disable any settings that may interfere with the escort -- // When we escort, we don't want to be distracted by other things. // NOTE: these settings are restored to their normal values when the behavior completes // or the bot is stopped. CharacterSettings.Instance.HarvestHerbs = false; CharacterSettings.Instance.HarvestMinerals = false; CharacterSettings.Instance.LootChests = false; CharacterSettings.Instance.NinjaSkin = false; CharacterSettings.Instance.SkinMobs = false; // CharacterSettings.Instance.PullDistance = 1; // don't pull anything unless we absolutely must BlackspotManager.AddBlackspots(Blackspots); State_MainBehavior = StateType_MainBehavior.DroppingOffVictim; _behaviorTreeHook_CombatMain = CreateBehavior_CombatMain(); TreeHooks.Instance.InsertHook("Combat_Main", 0, _behaviorTreeHook_CombatMain); _behaviorTreeHook_CombatOnly = CreateBehavior_CombatOnly(); TreeHooks.Instance.InsertHook("Combat_Only", 0, _behaviorTreeHook_CombatOnly); _behaviorTreeHook_DeathMain = CreateBehavior_DeathMain(); TreeHooks.Instance.InsertHook("Death_Main", 0, _behaviorTreeHook_DeathMain); this.UpdateGoalText(QuestId); } }
public PlayerQuest CreatePQuest(Quest quest) { var pQuest = new PlayerQuest(); pQuest.Quest = quest; pQuest.Id = quest.QuestType; pQuest.Name = quest.QuestId; pQuest.Objectives = new List<PlayerQuestObjective>(); foreach (var i in quest.Objectives) { var pObjective = new PlayerQuestObjective(); pObjective.Completed = false; pObjective.Id = i.Id; pObjective.Text = i.Text; pQuest.Objectives.Add(pObjective); } return pQuest; }
private Player LoadSavedPlayer(string xmlData) { try { XmlDocument playerData = new XmlDocument(); playerData.LoadXml(xmlData); string name = playerData.SelectSingleNode("/Player/Stats/Name").InnerText; int currentHp = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/CurrentHitPoint").InnerText); int currentExp = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/CurrentEXP").InnerText); int gold = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Gold").InnerText); int currentLevel = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/CurrentLevel").InnerText); int maxHp = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/MaxHitPoint").InnerText); int maxExp = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/MaxExp").InnerText); int currentLocationId = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/CurrentLocationId").InnerText); Player player = new Player(name, maxHp, currentHp, maxExp, gold, currentExp, currentLevel); player.CurrentLocation = World.LocationById(currentLocationId); foreach (XmlNode node in playerData.SelectNodes("/Player/Inventory/Item")) { int id = Convert.ToInt32(node.Attributes["ID"].Value); int quantity = Convert.ToInt32(node.Attributes["Quantity"].Value); Item itemDetails = World.ItemById(id); player.AddItem(itemDetails, quantity); } foreach (XmlNode node in playerData.SelectNodes("/Player/Quests/Quest")) { int id = Convert.ToInt32(node.Attributes["ID"].Value); bool isCompleted = Convert.ToBoolean(node.Attributes["IsCompleted"].Value); Quest questDetails = World.QuestById(id); PlayerQuest quest = new PlayerQuest(questDetails, isCompleted); player.Quests.Add(quest); } return(player); } catch (Exception e) { Console.WriteLine(e.GetType()); Console.WriteLine(e.GetBaseException()); return(SpawnPlayer(true)); } }
public void TakeDamage(float damageValue) { //Get PlayerQuest component into playerQuest(PlayerQuest) PlayerQuest playerQuest = player.GetComponent <PlayerQuest>(); curHp -= damageValue; mySlider.value = curHp / maxHp; if (curHp <= 0) { Die(); } if (curHp <= 0 && playerQuest.quests[0].state == QuestState.Accepted) { playerQuest.quests[0].goal.EnemyKilled(); Die(); } }
public override void OnStart() { // This reports problems, and stops BT processing if there was a problem with attributes... // We had to defer this action, as the 'profile line number' is not available during the element's // constructor call. OnStart_HandleAttributeProblem(); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { // Semantic coherency... // We had to defer this check (from the constructor) until after OnStart() was called. // If this behavior was used as a consequence of a class-specific action, or a quest // that has already been completed, then having this check in the constructor yields // confusing (and wrong) error messages. Thus, we needed to defer the check until // we actually tried to _use_ the behavior--not just create it. if (!SpellManager.HasSpell(SpellId)) { WoWSpell spell = WoWSpell.FromId(SpellId); LogMessage("fatal", "Toon doesn't know SpellId({0}, \"{1}\")", SpellId, ((spell != null) ? spell.Name : "unknown")); _isBehaviorDone = true; return; } if (TreeRoot.Current != null && TreeRoot.Current.Root != null && TreeRoot.Current.Root.LastStatus != RunStatus.Running) { var currentRoot = TreeRoot.Current.Root; if (currentRoot is GroupComposite) { var root = (GroupComposite)currentRoot; root.InsertChild(0, CreateRootBehavior()); } } PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); TreeRoot.GoalText = this.GetType().Name + ": " + ((quest != null) ? ("\"" + quest.Name + "\"") : "In Progress"); } }
public void HasThisQuestQuestIdMatchesTest() { int currentHitPoints = 100; int maximumHitPoints = 100; int gold = 99; int experiencePoints = 500; int level = 60; Quest zadanie = World.QuestById(1); PlayerQuest zadanieGracza = new PlayerQuest(zadanie); Player createPlayer = new Player(currentHitPoints, maximumHitPoints, gold, experiencePoints, level); createPlayer.Quests.Add(zadanieGracza); Assert.IsTrue(createPlayer.HasThisQuest(zadanie), "'QuestId' does not match the expected"); }
public PlayerQuest CreatePQuest(Quest quest) { var pQuest = new PlayerQuest(); pQuest.Quest = quest; pQuest.Id = quest.QuestType; pQuest.Name = quest.QuestId; pQuest.Objectives = new List <PlayerQuestObjective>(); foreach (var i in quest.Objectives) { var pObjective = new PlayerQuestObjective(); pObjective.Completed = false; pObjective.Id = i.Id; pObjective.Text = i.Text; pQuest.Objectives.Add(pObjective); } return(pQuest); }
public override void OnStart() { var questId = GetQuestId(); PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)questId); if ((questId != 0) && (quest == null)) { QBCLog.Error("This behavior has been associated with QuestId({0}), but the quest is not in our log", questId); IsAttributeProblem = true; } // If the needed item is not in my inventory, report problem... if (!Me.BagItems.Any(i => ItemId_BlindingRageTrap == (int)i.Entry)) { QBCLog.Error("The behavior requires \"Blind Rage Trap\"(ItemId: {0}) to be in our bags; however, it cannot be located)", ItemId_BlindingRageTrap); IsAttributeProblem = true; } // Let QuestBehaviorBase do basic initialization of the behavior, deal with bad or deprecated attributes, // capture configuration state, install BT hooks, etc. This will also update the goal text. var isBehaviorShouldRun = OnStart_QuestBehaviorCore(); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (isBehaviorShouldRun) { // Disable any settings that may interfere with the escort -- // When we escort, we don't want to be distracted by other things. // NOTE: these settings are restored to their normal values when the behavior completes // or the bot is stopped. CharacterSettings.Instance.HarvestHerbs = false; CharacterSettings.Instance.HarvestMinerals = false; CharacterSettings.Instance.LootChests = false; CharacterSettings.Instance.NinjaSkin = false; CharacterSettings.Instance.SkinMobs = false; // don't pull anything unless we absolutely must LevelBot.BehaviorFlags &= ~BehaviorFlags.Pull; _combatContext = new BattlefieldContext(ItemId_BlindingRageTrap, GameObjectId_BlindingRageTrap); this.UpdateGoalText(GetQuestId(), "Looting and Harvesting are disabled while behavior in progress"); } }
public override void OnStart() { OnStart_HandleAttributeProblem(); if (!IsDone) { if (TreeRoot.Current != null && TreeRoot.Current.Root != null && TreeRoot.Current.Root.LastStatus != RunStatus.Running) { var currentRoot = TreeRoot.Current.Root; if (currentRoot is GroupComposite) { var root = (GroupComposite)currentRoot; root.InsertChild(0, CreateBehavior()); } } PlayerQuest Quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); TreeRoot.GoalText = ((Quest != null) ? ("\"" + Quest.Name + "\"") : "In Progress"); } }
public override void OnStart() { // This reports problems, and stops BT processing if there was a problem with attributes... // We had to defer this action, as the 'profile line number' is not available during the element's // constructor call. OnStart_HandleAttributeProblem(); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { // The ConfigMemento() class captures the user's existing configuration. // After its captured, we can change the configuration however needed. // When the memento is dispose'd, the user's original configuration is restored. // More info about how the ConfigMemento applies to saving and restoring user configuration // can be found here... // http://www.thebuddyforum.com/mediawiki/index.php?title=Honorbuddy_Programming_Cookbook:_Saving_and_Restoring_User_Configuration _configMemento = new ConfigMemento(); BotEvents.OnBotStop += BotEvents_OnBotStop; // Disable any settings that may cause distractions -- // When we use transport, we don't want to be distracted by other things. // We also set PullDistance to its minimum value. // NOTE: these settings are restored to their normal values when the behavior completes // or the bot is stopped. CharacterSettings.Instance.HarvestHerbs = false; CharacterSettings.Instance.HarvestMinerals = false; CharacterSettings.Instance.LootChests = false; CharacterSettings.Instance.LootMobs = false; CharacterSettings.Instance.NinjaSkin = false; CharacterSettings.Instance.SkinMobs = false; CharacterSettings.Instance.PullDistance = 1; PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); TreeRoot.GoalText = this.GetType().Name + ": " + ((!string.IsNullOrEmpty(DestName)) ? DestName : (quest != null) ? ("\"" + quest.Name + "\"") : "In Progress"); } }
public override void OnStart() { // This reports problems, and stops BT processing if there was a problem with attributes... // We had to defer this action, as the 'profile line number' is not available during the element's // constructor call. OnStart_HandleAttributeProblem(); // If the quest is complete, this behavior is already done... // So we don't want to falsely inform the user of things that will be skipped. if (!IsDone) { PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId); if (quest == null) { QBCLog.Warning("Cannot find quest with QuestId({0}).", QuestId); _isBehaviorDone = true; } else if (quest.IsCompleted && (Type != AbandonType.All)) { QBCLog.Warning("Quest({0}, \"{1}\") is Complete--skipping abandon.", QuestId, quest.Name); _isBehaviorDone = true; } else if (!quest.IsFailed && (Type == AbandonType.Failed)) { QBCLog.Warning("Quest({0}, \"{1}\") has not Failed--skipping abandon.", QuestId, quest.Name); _isBehaviorDone = true; } else { TreeRoot.GoalText = string.Format("Abandoning QuestId({0}): \"{1}\"", QuestId, quest.Name); StyxWoW.Me.QuestLog.AbandonQuestById((uint)QuestId); QBCLog.Info("Quest({0}, \"{1}\") successfully abandoned", QuestId, quest.Name); _waitTimerAfterAbandon.WaitTime = TimeSpan.FromMilliseconds(WaitTime); _waitTimerAfterAbandon.Reset(); } } }
public void CompletedThisQuestTrueMarkQuestCompletedTrueTest() { int currentHitPoints = 100; int maximumHitPoints = 100; int gold = 99; int experiencePoints = 500; int level = 60; Quest zadanie = World.QuestById(1); PlayerQuest zadanieGracza = new PlayerQuest(zadanie); Player createPlayer = new Player(currentHitPoints, maximumHitPoints, gold, experiencePoints, level); createPlayer.Quests.Add(zadanieGracza); createPlayer.MarkQuestCompleted(zadanie); createPlayer.CompletedThisQuest(zadanie); Assert.IsTrue(zadanieGracza.IsCompleted, "Quest is not marked as completed"); }
public void HasThisQuestQuestIdDoesNotMatchTest() { int currentHitPoints = 100; int maximumHitPoints = 100; int gold = 99; int experiencePoints = 500; int level = 60; Quest zadanie = World.QuestById(1); Quest zadanieFalse = World.QuestById(2); PlayerQuest zadanieGracza = new PlayerQuest(zadanieFalse); Player createPlayer = new Player(currentHitPoints, maximumHitPoints, gold, experiencePoints, level); createPlayer.Quests.Add(zadanieGracza); Assert.IsFalse(createPlayer.HasThisQuest(zadanie), "'QuestId' should be different for two separate quests"); }
//基礎statusを導入 public void LoadData() { //TODO: ファイルから数値を読み取る #region Tempデータ PlayerStateData data = GameController._instance.LoadPlayerState(); EXP = data.EXP; baseSTR = data.BaseSTR; baseDEX = data.BaseDEX; baseINT = data.BaseINT; baseCON = data.BaseCON; baseLUK = data.BaseLUK; money = data.Money; isWalk = data.IsWalk; #endregion playerActionNow = PlayerAction.Free; this.bag = PlayerBag.nowPlayerBag; this.equep = PlayerEquep.nowPlayerEquep; this.quest = PlayerQuest.nowPlayerQuest; }
public static Player CreatePlayerFromXmlString(string xmlPlayerData) { try { XmlDocument playerData = new XmlDocument(); playerData.LoadXml(xmlPlayerData); string name = playerData.SelectSingleNode("/Player/Stats/Name").InnerText; int currentHitPoints = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/CurrentHitPoints").InnerText); int maximumHitPoints = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/MaximumHitPoints").InnerText); int gold = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Gold").InnerText); int experiencePoints = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/ExperiencePoints").InnerText); int str = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Strength").InnerText); int dex = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Dexterity").InnerText); int con = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Constitution").InnerText); int intel = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Intelligence").InnerText); int wis = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Wisdom").InnerText); int charisma = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/Charisma").InnerText); Player player = new Player(currentHitPoints, maximumHitPoints, str, dex, con, intel, wis, charisma, name); int currentLocationID = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/CurrentLocation").InnerText); player.currentLocation = World.LocationByID(currentLocationID); if(playerData.SelectSingleNode("/Player/Stats/CurrentWeapon") != null) { int currentWeaponID = Convert.ToInt32(playerData.SelectSingleNode("/Player/Stats/CurrentWeapon").InnerText); player.currentWeapon = (Weapon)World.ItemByID(currentWeaponID); } foreach (XmlNode node in playerData.SelectNodes("/Player/InventoryItems/InventoryItem")) { int id = Convert.ToInt32(node.Attributes["ID"].Value); int quantity = Convert.ToInt32(node.Attributes["Quantity"].Value); for (int i = 0; i < quantity; i++) { player.AddItemToInventory(World.ItemByID(id)); } } foreach (XmlNode node in playerData.SelectNodes("/Player/PlayerQuests/PlayerQuest")) { int id = Convert.ToInt32(node.Attributes["ID"].Value); bool isCompleted = Convert.ToBoolean(node.Attributes["IsCompleted"].Value); PlayerQuest playerQuest = new PlayerQuest(World.QuestByID(id)); playerQuest.isCompleted = isCompleted; player.quests.Add(playerQuest); } return player; } catch { // If there was an error with the XML data, return a default player object return CreateDefaultPlayer(); } }
void Awake() { quest = this; }
private void ProtectQuestItems(PlayerQuest quest) { //Logging.Write("[Quest Protector] Protecting quest items for quest \"" + quest.Name + "\"..."); foreach (int iID in quest.CollectItemIDs) { if (m_lProtectedItems.Contains(iID)) continue; if (ProfileManager.CurrentProfile.ProtectedItems.Contains((uint)iID)) { //Logging.Write("[Quest Protector] Item \"" + iID + "\" is already protected."); continue; } m_lProtectedItems.Add(iID); ProfileManager.CurrentProfile.ProtectedItems.Add((uint)iID); //Logging.Write("[Quest Protector] Protected item \"" + iID + "\"."); } foreach (int iID in quest.CollectIntermediateItemIDs) { if (m_lProtectedItems.Contains(iID)) continue; if (ProfileManager.CurrentProfile.ProtectedItems.Contains((uint)iID)) { //Logging.Write("[Quest Protector] Item \"" + iID + "\" is already protected."); continue; } m_lProtectedItems.Add(iID); ProfileManager.CurrentProfile.ProtectedItems.Add((uint)iID); //Logging.Write("[Quest Protector] Protected item \"" + iID + "\"."); } }