public override void OnStart() { if (!ObjectManager.IsInGame) { return; } Print("Attempting jump via lua"); WoWLua.ExecuteBuffer("JumpOrAscendStart()"); Print("\nGetting Player Name via lua"); string luaCommand = "nameString = GetUnitName(\"PLAYER\", true)"; WoWLua.ExecuteBuffer(luaCommand); var name = WoWLua.GetLocalizedText("nameString"); Print("\t - {0}", name); Print("\n Getting free bag slots via WoWLua.GetReturnValues"); string[] results = WoWLua.GetReturnValues("nbSlots = 0; for i = 0, 4 do if GetContainerNumFreeSlots(i) ~= nil then nbSlots = nbSlots + GetContainerNumFreeSlots(i); end end ", "nbSlots"); foreach (var r in results) { Print("\t - {0}", r); } Stop(); }
public void Cast(WoWUnit target) { if (!IsValid) { return; } if (target == null || !target.IsValid) { return; } WoWFunctions._setTarget(target.Guid); WoWLua.ExecuteBuffer(string.Format("CastSpellByID(\"{0}\")", Id)); }
public WoWSpell GetWoWSpellFromId(uint id) { WoWSpell tempSpell = CachedSpellRequests.FirstOrDefault(x => x.Id == id); if (tempSpell == null) { string LuaString = "local t = {}; "; LuaString = LuaString + string.Format("name{0} = GetSpellInfo({1}) table.insert(t, name{2}); ", id, id, id); LuaString = LuaString + "w = table.concat(t, '|'); return w"; string[] ret = WoWLua.GetReturnValues(LuaString, "w"); string[] nameSplit = ret[0].Split(Convert.ToChar("|")); WoWSpell t = new WoWSpell(nameSplit[0], id); CachedSpellRequests.Add(t); return(t); } else { return(tempSpell); } }
private void UpdateSpellbook() { List <uint> foundIds = new List <uint>(); List <WoWSpell> tempList = new List <WoWSpell>(); uint nbSpells = GeneralHelper.Memory.Read <uint>(Offsets.SpellBook.NumberOfSpells); uint SpellBookInfoPtr = GeneralHelper.Memory.Read <uint>(Offsets.SpellBook.Book); for (uint index = 0U; index < nbSpells; ++index) { uint Struct = GeneralHelper.Memory.Read <uint>(SpellBookInfoPtr + index * 4U); //uint IsKnown = GeneralHelper.Memory.Read<uint>(Struct); uint ID = GeneralHelper.Memory.Read <uint>(Struct + 0x4); foundIds.Add(ID); } string LuaString = "local t = {}; "; foreach (var foundId in foundIds) { LuaString = LuaString + string.Format("name{0} = GetSpellInfo({1}) table.insert(t, name{2}); ", foundId, foundId, foundId); } LuaString = LuaString + "w = table.concat(t, '|'); return w"; string[] ret = WoWLua.GetReturnValues(LuaString, "w"); string[] nameSplit = ret[0].Split(Convert.ToChar("|")); for (int i = 0; i < foundIds.Count; i++) { tempList.Add(new WoWSpell(nameSplit[i], foundIds[i])); } KnownSpells = tempList; }