/// <summary> /// Interface to manage gather. /// </summary> private List <string> Gather() { bool launch = IsSwitchOn("-launch"); bool stats = IsSwitchOn("-stats"); try { if (launch) { account.PerformGather(); result.Add("Récolte de la map..."); } if (stats) { Dictionary <string, int> newStats = account.Gather.Stats; foreach (KeyValuePair <string, int> key in newStats) { result.Add(String.Format("[{1}] : {2}", key.Key, key.Value)); } } } catch (Exception ex) { result.Add("[ERROR] " + ex.Message + "\n"); return(result); } if (!(result.Count > 0)) { return(Usage("gather")); } else { return(result); } }
public static void ObtainedItemMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { ObtainedItemMessage msg = (ObtainedItemMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } if (account.Gather.resourceName == "Unknown") { return; } account.SetStatus(Status.None); account.Log(new ActionTextInformation("Ressource récoltée : " + account.Gather.resourceName + " +" + msg.baseQuantity), 3); if (account.Gather.Stats.ContainsKey(account.Gather.resourceName)) { account.Gather.Stats[account.Gather.resourceName] += msg.baseQuantity; } else { account.Gather.Stats.Add(account.Gather.resourceName, msg.baseQuantity); } account.Gather.Current_Job.ActualizeStats(account.Gather.Stats); if (account.PerformGather() == false && account.Path != null) { account.Path.PerformActionsStack(); } }
public void ConfirmMove() { m_Account.Wait(m_time, m_time + 100); using (BigEndianWriter writer = new BigEndianWriter()) { if (Moving) { m_Account.SocketManager.Send(new GameMapMovementConfirmMessage()); Moving = false; } m_Account.SetStatus(Status.None); if (m_MapId != -1) { LaunchChangeMap(m_MapId); return; } else if (m_elemId != -1 && m_Account.Gather.Id == -1) { UseElement(m_elemId); } if (m_Account.Fight != null && m_Account.FightData.IsFollowingGroup && m_Account.FightData.followingGroup.m_cellId == m_Account.MapData.Character.disposition.cellId) { m_Account.Fight.LaunchFight(m_Account.FightData.followingGroup.m_contextualId); } else if (m_Account.Fight != null && m_Account.FightData.IsFollowingGroup) { m_Account.Fight.SearchFight(); } else if (m_Account.Gather.Id != -1) { //if (m_Account.MapData.CanGatherElement(m_Account.Gather.Id, m_Account.Inventory.WeaponRange)) int distance = m_Account.Gather.GetRessourceDistance(m_Account.Gather.Id); m_Account.Log(new DebugTextInformation("[Gather] New distance from element " + m_Account.Gather.Id + " = " + distance), 0); m_Account.Log(new DebugTextInformation("[CanGatherElement] " + m_Account.MapData.CanGatherElement(m_Account.Gather.Id, m_Account.Inventory.WeaponRange).ToString()), 0); //if (distance <= m_Account.Inventory.WeaponRange) if (m_Account.MapData.CanGatherElement(m_Account.Gather.Id, m_Account.Inventory.WeaponRange)) { m_Account.SetStatus(Status.Gathering); UseElement(m_Account.Gather.Id, m_Account.Gather.SkillInstanceUid); } else if (m_Account.Path != null) { m_Account.Gather.BanElementId(m_Account.Gather.Id); m_Account.Path.PerformFlag(); } else { m_Account.SetStatus(Status.None); m_Account.Gather.BanElementId(m_Account.Gather.Id); m_Account.PerformGather(); } } else { m_Account.SetStatus(Status.None); } } }
/// <summary> /// Perform the action associed with the current path's flag. /// </summary> public void PerformFlag() { if (Account.state == Engine.Enums.Status.Fighting) { return; } switch (Current_Flag) { case "<Move>": //Aucune action spécifique au flag, on éxécute directement les actions if (Account.IsMaster == true && Account.MyGroup != null) { PerformActionsStack(); } else if (Account.IsSlave == false) { PerformActionsStack(); } else { Account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ?)"), 0); } break; case "<Fight>": //On lance un combat, les actions seront effectuées après le combat if (Account.IsMaster == true && Account.MyGroup != null && Account.Fight != null) { if (!Account.Fight.SearchFight()) { PerformActionsStack(); } } else if (Account.IsSlave == false && Account.Fight != null) { if (Account.Fight.SearchFight() == false) { PerformActionsStack(); } } else { Account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ? Aucune IA ?)"), 0); } break; case "<Gather>": //On récolte la map, les actions seront effectuées après la récolte if (!Account.PerformGather()) { PerformActionsStack(); } break; } Account.WatchDog.Update(); }
public static void InteractiveUseEndedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { InteractiveUseEndedMessage msg = (InteractiveUseEndedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } if (account.Gather.Id == -1) { return; } account.SetStatus(Status.None); if (account.PerformGather() == false && account.Path != null) { account.Path.PerformActionsStack(); } }
public static void InteractiveUseErrorMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { InteractiveUseErrorMessage msg = (InteractiveUseErrorMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Log(new ErrorTextInformation("Erreur lors de l'utilisation de l'element numero " + msg.elemId + ". Si vous connaissez la raison, rapportez la sur le forum. Merci ! Poursuite du trajet..."), 0); if (account.Gather.Id != -1 && account.PerformGather() == false) { if (account.Path != null) { account.Path.PerformActionsStack(); } else if (account.Path != null) { account.Path.PerformActionsStack(); } } }
private void PerformFlag(string flag) { switch (flag) { case "<Move>": //Aucune action spécifique au flag, on éxécute directement les actions if (Account.IsMaster == true && Account.MyGroup != null) { PerformActionsStack(); //Account.Path.Stop = true; } else if (Account.IsSlave == false) { PerformActionsStack(); //Account.Path.Stop = true; } else { Account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ?)"), 0); } break; case "<Fight>": //On lance un combat, les actions seront effectuées après le combat if (Account.IsMaster == true && Account.MyGroup != null && Account.Fight != null) { if (Account.Fight.SearchFight() == false) { PerformActionsStack(); } //Account.Path.Stop = true; } else if (Account.IsSlave == false && Account.Fight != null) { if (Account.Fight.SearchFight() == false) { PerformActionsStack(); } //Account.Path.Stop = true; } else { Account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ? Aucune IA ?)"), 0); } break; case "<Gather>": //On récolte la map, les actions seront effectuées après la récolte //Account.Log(new ErrorTextInformation("La récolte n'est pas encore implémentée, veuillez attendre la mise à jour. Tenez vous au courant sur http://forum.bluesheepbot.com "),0); if (Account.PerformGather() == false) { PerformActionsStack(); } //Account.Path.Stop = true; break; //case "<Bank>": // //On rajoute la condition pods et on effectue l'action // Condition c = new Condition(ConditionEnum.PodsPercent, (int)Account.NUDPods.Value, '>', Account); // if (c.CheckCondition() == true) // PerformActionsStack(); // Account.Path.Stop = true; // break; } }