Thecamel
Community Developer
- Joined
- Aug 8, 2012
- Messages
- 2,036
Hi Devs,
id like to modify the following plugin,
To perform the same checks it dose on the start of the bot ( Check level and zone) when the bot dies and is released ?
Thanks in advanced.
id like to modify the following plugin,
Code:
using ff14bot;
using ff14bot.Helpers;
using ff14bot.Interfaces;
using ff14bot.Managers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
// The majority of this code was originally from Wheredidigo's FateHunter. I just modified
// it and changed it a bit so that it only had one zone per level range and moved you there when you
// met the appropriate level range.
namespace FateAutoLeveler
{
class FateAutoLeveler : IBotPlugin
{
#region Necessary Stuff
public string Author { get { return "Zamphire"; } }
public Version Version { get { return new Version(1, 0); } }
public string Name { get { return "FateAutoLeveler"; } }
public string Description { get { return "Brings you to the correct zone according to your level."; } }
public bool WantButton { get { return false; } }
public string ButtonText { get { return "FateAutoLeveler"; } }
public void OnButtonPress() { throw new NotImplementedException(); }
public bool Equals(IBotPlugin other) { throw new NotImplementedException(); }
#endregion
#region Variables
public static Dictionary<string, uint> _availableLocations = new Dictionary<string, uint>();
Random _random = new Random(int.Parse(Guid.NewGuid().ToString().Substring(0, 8), System.Globalization.NumberStyles.HexNumber));
private int _currentLevel;
public int CurrentLevel
{
get
{
if (_currentLevel == 0)
{
_currentLevel = (int)Core.Player.ClassLevel;
}
return _currentLevel;
}
}
#endregion
#region On Methods
public void OnPulse()
{
if (BotManager.Current.Name == "Fate Bot")
{
if (_currentLevel == 0)
{
ChangeZone();
}
if (CurrentLevel < Core.Player.ClassLevel)
{
_currentLevel = Core.Player.ClassLevel;
ChangeZone();
}
}
}
public void OnInitialize()
{
foreach (var location in WorldManager.AvailableLocations)
{
_availableLocations.Add(location.Name, location.AetheryteId);
}
}
public void OnShutdown() { }
public void OnEnabled() { }
public void OnDisabled() { }
#endregion
#region Helper Methods
private void ChangeZone()
{
var _nextLocation = NextLocation();
if (_nextLocation == 0)
{
Logging.Write("[FateAutoLeveler] No Valid Locations to Teleport to.");
return;
}
if (WorldManager.ZoneId == _nextLocation)
{ return; }
TreeRoot.Stop();
if (Core.Player.IsMounted)
{
Actionmanager.Dismount();
Thread.Sleep(5000);
}
Logging.Write("Moving to " + _availableLocations.FirstOrDefault(x => x.Value == _nextLocation).Key);
WorldManager.TeleportById(_nextLocation);
Thread.Sleep(15000);
TreeRoot.Start();
}
private uint NextLocation()
{
var currentLevel = (int)Core.Player.ClassLevel;
if (currentLevel >= 1 && currentLevel < 15)
{
return GetZone1Thru15();
}
else if (currentLevel >= 15 && currentLevel < 20)
{
return GetZone15Thru20();
}
else if (currentLevel >= 20 && currentLevel < 25)
{
return GetZone20Thru25();
}
else if (currentLevel >= 25 && currentLevel < 30)
{
return GetZone25Thru30();
}
else if (currentLevel >= 30 && currentLevel < 35)
{
return GetZone30Thru35();
}
else if (currentLevel >= 35 && currentLevel < 40)
{
return GetZone35Thru40();
}
else if (currentLevel >= 40 && currentLevel < 50)
{
return GetZone40Thru50();
}
else
{ return 0; }
}
#region Get Zone By Level
private uint GetZone1Thru15()
{
var zoneList = new List<uint>();
//Middle La Noscea - Summerford Farms
if (_availableLocations.ContainsKey("summerford farms"))
{
zoneList.Add(_availableLocations["summerford farms"]);
}
if (zoneList.Count <= 0)
{
return 0;
}
return zoneList[_random.Next(0, zoneList.Count)];
}
private uint GetZone15Thru20()
{
var zoneList = new List<uint>();
//Western La Noscea - Aleport
if (_availableLocations.ContainsKey("aleport"))
{
zoneList.Add(_availableLocations["aleport"]);
}
if (zoneList.Count <= 0)
{
return 0;
}
return zoneList[_random.Next(0, zoneList.Count)];
}
private uint GetZone20Thru25()
{
var zoneList = new List<uint>();
//Eastern Thanalan - Camp Drybone
if (_availableLocations.ContainsKey("camp drybone"))
{
zoneList.Add(_availableLocations["camp drybone"]);
}
if (zoneList.Count <= 0)
{
return 0;
}
return zoneList[_random.Next(0, zoneList.Count)];
}
private uint GetZone25Thru30()
{
var zoneList = new List<uint>();
//South Shroud - Quarrymill
if (_availableLocations.ContainsKey("quarrymill"))
{
zoneList.Add(_availableLocations["quarrymill"]);
}
if (zoneList.Count <= 0)
{
return 0;
}
return zoneList[_random.Next(0, zoneList.Count)];
}
private uint GetZone30Thru35()
{
var zoneList = new List<uint>();
//Eastern La Noscea - Costa del Sol
if (_availableLocations.ContainsKey("costa del sol"))
{
zoneList.Add(_availableLocations["costa del sol"]);
}
if (zoneList.Count <= 0)
{
return 0;
}
return zoneList[_random.Next(0, zoneList.Count)];
}
private uint GetZone35Thru40()
{
var zoneList = new List<uint>();
//Upper La Noscea - Camp Bronze Lake
if (_availableLocations.ContainsKey("camp bronze lake"))
{
zoneList.Add(_availableLocations["camp bronze lake"]);
}
if (zoneList.Count <= 0)
{
return 0;
}
return zoneList[_random.Next(0, zoneList.Count)];
}
private uint GetZone40Thru50()
{
var zoneList = new List<uint>();
//Coerthas Central Highlands - Camp Dragonhead
if (_availableLocations.ContainsKey("camp dragonhead"))
{
zoneList.Add(_availableLocations["camp dragonhead"]);
}
if (zoneList.Count <= 0)
{
return 0;
}
return zoneList[_random.Next(0, zoneList.Count)];
}
#endregion
#endregion
}
}
To perform the same checks it dose on the start of the bot ( Check level and zone) when the bot dies and is released ?
Thanks in advanced.