Ejemplo n.º 1
0
        private ItemRecord GetItemRecord(string itemName, uint aetheryteId)
        {
            try
            {
                bool isValid = true;
                DataRow[] itemRows = this.itemsTable.Select(string.Format("ItemName = '{0}' AND AetheryteId = '{1}'", FixQueryField(itemName, 1), aetheryteId));
                int itemCount = itemRows.Count<DataRow>();

                if (itemCount == 0)
                {
                    this.Log(LogErrorColor, string.Format("CONTACT DEVELOPER! Requested item name {0} does not exist in the item table; plesae create a record for this item before continuing.", itemName));
                    gatherAssistTimer.Stop();
                    this.BotStop();
                }
                else
                {
                    foreach (DataRow curRow in itemRows)
                    {
                        if (WorldManager.HasAetheryteId(Convert.ToUInt32(curRow["AetheryteId"])))
                        {
                            DataRow itemRow = itemRows[0];
                            ItemRecord itemRecord = new ItemRecord();
                            itemRecord.ItemName = Convert.ToString(itemRow["ItemName"]);
                            itemRecord.ClassName = Convert.ToString(itemRow["ClassName"]);
                            itemRecord.AetheryteId = Convert.ToInt32(itemRow["AetheryteId"]);

                            itemRecord.GatherObject = Convert.ToString(itemRow["GatherObject"]);
                            itemRecord.ObjectLevel = Convert.ToInt32(itemRow["ObjectLevel"]);
                            itemRecord.HotspotRadius = Convert.ToInt32(itemRow["HotspotRadius"]);
                            itemRecord.Location = Convert.ToString(itemRow["Location"]);
                            itemRecord.SlotNumber = Convert.ToInt32(itemRow["SlotNumber"]);
                            itemRecord.Stealth = Convert.ToInt32(itemRow["Stealth"]);
                            itemRecord.StealthPoint = Convert.ToString(itemRow["StealthPoint"]);

                            DataRow[] mapRows = this.mapsTable.Select(string.Format("AetheryteId = '{0}'", itemRecord.AetheryteId));
                            int mapCount = mapRows.Count<DataRow>();

                            if (mapCount > 1)
                            {
                                this.Log(LogErrorColor, string.Format("CONTACT DEVELOPER!  Requested Aetheryte ID {0} exists in {1} records; remove duplicates for this aetheryte before continuing.", itemRecord.AetheryteId, mapCount));
                                isValid = false;
                            }
                            else if (mapCount == 0)
                            {
                                this.Log(LogErrorColor, string.Format("CONTACT DEVELOPER!  Requested Aetheryte ID {0} does not exist in the maps table; please create a record for this aetheryte before continuing.", itemRecord.AetheryteId));
                                isValid = false;
                            }

                            if (!isValid)
                            {
                                gatherAssistTimer.Stop();
                                this.BotStop();
                            }
                            else
                            {
                                DataRow mapRow = mapRows[0];
                                itemRecord.AetheryteName = Convert.ToString(mapRow["AetheryteName"]);
                                itemRecord.MapNumber = Convert.ToInt32(mapRow["MapNumber"]);
                                return itemRecord; // return completed itemRow
                            }
                        }
                        else
                        {
                            this.Log(LogMinorColor, string.Format("Aetheryte ID {0} is not available, skipping this item record"), true);
                        }
                    }

                    this.Log(LogErrorColor, string.Format("No items records existed that could be gathered by this user.  Please check available Aetheryte IDs and update before continuing.", itemName));
                    gatherAssistTimer.Stop();
                    this.BotStop();
                }
            }
            catch (Exception ex)
            {
                this.LogException(ex);
            }

            return null; // if valid ItemRecord was not returned or error was thrown, return null here
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Supplies an appropriate gathering spell for the current class and specified gather item.
        /// </summary>
        /// <param name="itemRecord">The record for the gather item desired.</param>
        /// <returns>A single spell that will work for the specified class name.</returns>
        private string GetGatheringSpell(ItemRecord itemRecord)
        {
            SpellLock = false;
            try
            {
                // handle shard-specific spells.  Allows for any class, if the cross-class skills are enabled.
                switch (itemRecord.ItemName)
                {
                    case "Fire Shard":
                    case "Fire Crystal":
                    case "Fire Cluster":
                        if (Actionmanager.HasSpell("Nald'thal's Ward"))
                        {
                            SpellLock = true;
                            return "Nald'thal's Ward";
                        }

                        break;
                    case "Lightning Shard":
                    case "Lightning Crystal":
                    case "Lightning Cluster":
                        if (Actionmanager.HasSpell("Byregot's Ward"))
                        {
                            SpellLock = true;
                            return "Byregot's Ward";
                        }

                        break;
                    case "Water Shard":
                    case "Water Crystal":
                    case "Water Cluster":
                        if (Actionmanager.HasSpell("Thaliak's Ward"))
                        {
                            SpellLock = true;
                            return "Thaliak's Ward";
                        }

                        break;
                    case "Ice Shard":
                    case "Ice Crystal":
                    case "Ice Cluster":
                        if (Actionmanager.HasSpell("Menphina's Ward"))
                        {
                            SpellLock = true;
                            return "Menphina's Ward";
                        }

                        break;
                    case "Wind Shard":
                    case "Wind Crystal":
                    case "Wind Cluster":
                        if (Actionmanager.HasSpell("Llymlaen's Ward"))
                        {
                            SpellLock = true;
                            return "Llymlaen's Ward";
                        }

                        break;
                    case "Earth Shard":
                    case "Earth Crystal":
                    case "Earth Cluster":
                        if (Actionmanager.HasSpell("Nophica's Ward"))
                        {
                            SpellLock = true;
                            return "Nophica's Ward";
                        }

                        break;
                }

                // handle HQ spells
                if (settings.HqOnly)
                {
                    if (Core.Me.ClassLevel >= 35 && Core.Me.MaxGP >= 300)
                    {
                        SpellLock = true;
                        return Core.Me.CurrentJob.ToString() == "Miner" ? "Unearth II" : "Leaf Turn II";
                    }
                    else if (Core.Me.ClassLevel >= 15 && Core.Me.MaxGP >= 100)
                    {
                        SpellLock = true;
                        return Core.Me.CurrentJob.ToString() == "Miner" ? "Unearth" : "Leaf Turn";
                    }
                    else
                    {
                        return Core.Me.CurrentJob.ToString() == "Miner" ? "Prospect" : "Triangulate";
                    }
                }

                // handle NQ spells
                if (!settings.HqOnly)
                {
                    if (Core.Me.ClassLevel >= 10 && Core.Me.MaxGP >= 250)
                    {
                        return Core.Me.CurrentJob.ToString() == "Miner" ? "Sharp Vision III" : "Field Mastery III";
                    }
                    else if (Core.Me.ClassLevel >= 5 && Core.Me.MaxGP >= 100)
                    {
                        return Core.Me.CurrentJob.ToString() == "Miner" ? "Sharp Vision II" : "Field Mastery II";
                    }
                    else if (Core.Me.ClassLevel >= 4 && Core.Me.MaxGP >= 50)
                    {
                        return Core.Me.CurrentJob.ToString() == "Miner" ? "Sharp Vision" : "Field Mastery";
                    }
                    else
                    {
                        return Core.Me.CurrentJob.ToString() == "Miner" ? "Prospect" : "Triangulate";
                    }
                }
                    throw new ApplicationException(string.Format("CONTACT DEVELOPER!  Could not determine a gathering spell for class {0} and item {1}; please update code.", Core.Me.CurrentJob.ToString(), itemRecord.ItemName));
                }

            catch (Exception ex)
            {
                this.LogException(ex);
                return null;
            }
        }