Hey i was just wondering, since RoM run in LUA and the player can write macro in the game, can we just write a bot using the game macro?
I found this addon in RoM forums. So m thinking mayb can we write a bot ad-on or something
Code: Select all
-- pbMobInfo
-- v0.06
-- by p.b. a.k.a. novayuna
-- released under the Creative Commons License By-Nc-Sa: http://creativecommons.org/licenses/by-nc-sa/3.0/
--
-- Many thanks to the following people for their ideas and/or code:
-- "dr00gz" - http://www.forum.romla.de/ : Tooltip idea and lot's of hints
-- "gastro19" - http://forum.runesofmagic.com/member.php?u=78657: Slash command idea
--
-- Hover your mouse over a target to get some detailed information.
--
-- In the target frame, the target's health bar now shows the real actual and maximum halth points.
-- (Only available if target was hovered or targetted once before the combat.)
--
-- Create a new macro and put "/mobinfo" into it. Select a mob, player or NPC and press the macro button.
-- Or just use /mi in the chat window.
-- This sends information about the target to your chat window or, if you are in a group, in group chat.
--
-- Have fun!
--if (GetLocale() == "deDE") then -- I don't know the real function and return values .. . :/
-- pbLocale = {
-- HP = "Lebenspunkte",
-- NVT = "Kein g\195\188ltiges Ziel ausgew\195\164hlt!",
-- LVL = "Stufe",
-- TYPE1 = "Mana",
-- TYPE2 = "Wut",
-- TYPE3 = "Fokus",
-- TYPE4 = "Energie"
-- };
--else
pbLocale = {
HP = "Health",
NVT = "No valid target selected!",
LVL = "Level",
TYPE1 = "Mana",
TYPE2 = "Rage",
TYPE3 = "Focus",
TYPE4 = "Energy"
};
--end;
classColors = {
Magier = "FFC000", -- german class descriptions...
Kundschafter = "92D050",
Priester = "0070C0",
Ritter = "FFFF48",
Schurke = "009999",
Krieger = "FF0000",
Mage = "FFC000", -- ... and the english ones
Scout = "92D050",
Priest = "0070C0",
Knight = "FFFF48",
Rogue = "009999",
Warrior = "FF0000"
};
pbMobsMaxHP, pbLastGUID = {}, 0;
function pbMobInfoHover() -- thx to dr00gz for the idea and the hints!
if (UnitExists("mouseover") and (UnitIsPlayer("mouseover") or UnitLevel("mouseover") > 1)) then -- get rid of messages for level 1 NPCs and other level 1 stuff, except players
local mC, sC = UnitClass("mouseover");
local mL, sL = UnitLevel("mouseover");
local health, healthMax, healthRatio = 0, 0, 0;
local mana, manaMax, manaType = UnitMana("mouseover"), UnitMaxMana("mouseover"), UnitManaType("mouseover");
local skill, skillMax, skillType = UnitSkill("mouseover"), UnitMaxSkill("mouseover"), UnitSkillType("mouseover");
local healthText, manaText, skillText = "", "";
local unitQuestMsg = UnitQuestMsg("mouseover");
-- clears GameTooltip
GameTooltip:SetText(UnitName("mouseover"), 1.0, 1.0, 0.0);
-- adding class information to GameTooltip
local mColor = ""; -- colorize the following output for the primary class
if (classColors[mC] ~= nil) then
mColor = "|cff" .. classColors[mC];
end;
GameTooltip:AddLine(mColor .. mC .. "|r (" .. pbLocale["LVL"] .. " " .. mColor .. mL .. "|r)", 1.0, 1.0, 1.0);
if (sL > 0 and sC ~= "") then -- do the same for the secondary class, if available
local sColor = "";
if (classColors[sC] ~= nil) then
sColor = "|cff" .. classColors[sC];
end;
GameTooltip:AddLine(sColor .. sC .. "|r (" .. pbLocale["LVL"] .. " " .. sColor .. sL .. "|r)", 1.0, 1.0, 1.0);
end;
-- adding healthpoint information to GameTooltip
if (not UnitIsPlayer("mouseover")) then -- calculate or get the current healthpoints for mobs and NPCs
unitGUID = UnitGUID("mouseover");
healthRatio = UnitHealth("mouseover");
if (pbMobsMaxHP[unitGUID] ~= nil) then
healthMax = pbMobsMaxHP[unitGUID];
health = math.ceil(healthMax * healthRatio / 100);
healthText = health .. " / " .. healthMax .. " (" .. healthRatio .. "%)", 1.0, 1.0, 1.0;
else
healthText = healthRatio .. "%", 1.0, 1.0, 1.0;
end;
if (healthRatio == 100) then -- that's how I save the unit's maximum healtpoints
pbMobsMaxHP[unitGUID] = UnitChangeHealth("mouseover");
end;
manaText = mana .. "%";
skillText = skill .. "%";
else -- players? That's easy .. .
health = UnitHealth("mouseover");
healthMax = UnitMaxHealth("mouseover");
healthRatio = UnitMaxHealth("mouseover");
healthText = health .. " / " .. healthMax .. " (" .. math.ceil(100 * health/healthMax) .. "%)", 1.0, 1.0, 1.0;
manaText = mana .. " / " .. manaMax;
if (manaType == 1) then
manaText = manaText .. " (" .. math.ceil(100 * mana/manaMax) .. "%)";
end;
skillText = skill .. " / " .. skillMax;
if (skillType == 1) then
skillText = skillText .. " (" .. math.ceil(100 * skill/skillMax) .. "%)";
end;
end;
GameTooltip:AddLine(pbLocale["HP"] .. ": " .. healthText, 1.0, 1.0, 1.0);
-- adding mana and skill information to GameTooltip, if available - unfortunately, UnitChangeMana() and UnitChangeSkill() don't work
if (manaMax > 0 and manaType > 0) then
GameTooltip:AddLine(pbLocale["TYPE" .. manaType] .. ": " .. manaText, 1.0, 1.0, 1.0);
end;
if (skillMax > 0 and skillType > 0) then
GameTooltip:AddLine(pbLocale["TYPE" .. skillType] .. ": " .. skillText, 1.0, 1.0, 1.0);
end;
-- (re-)adding quest information to GameTooltip, if available
if (unitQuestMsg ~= nil) then
GameTooltip:AddLine("\n" .. unitQuestMsg, 1.0, 1.0, 1.0);
end;
end;
end;
-- used to set a mob's maximum healthpoints if "Target next enemy" (TAB or similar) is used
function pbMobInfoUpdateOnUnitTargetChange(player)
unitGUID = UnitGUID("target");
if (player == "player" and not UnitIsPlayer("target") and UnitHealth("target") == 100 and unitGUID ~= nil) then
pbMobsMaxHP[unitGUID] = UnitChangeHealth("target");
end;
end;
-- updates the health bar in target frame, if a mob's maximum healthpoints are available
function pbMobInfoUpdateOnTargetChangeHealth()
if (not UnitIsPlayer("target")) then
unitGUID = UnitGUID("target");
healthMax = pbMobsMaxHP[unitGUID];
if (healthMax ~= nil) then
TargetHealthBarValueText:SetText(math.ceil((UnitHealth("target") * healthMax) / 100) .. "/" .. pbMobsMaxHP[unitGUID])
end;
end;
end;
-- Teh oldsql way in chat window
function pbMobInfoChat()
if (UnitName("target") ~= nil) then
local mC, sC = UnitClass("target");
local mL, sL = UnitLevel("target");
local health, healthRatio = 0, 0;
local sub, message = "", "";
if (not UnitIsPlayer("target")) then
local unitGUID = UnitGUID("target");
healthRatio = UnitHealth("target");
if (pbMobsMaxHP[unitGUID] ~= nil) then
health = pbMobsMaxHP[unitGUID] * healthRatio / 100;
else
health = UnitChangeHealth("target");
end;
if (healthRatio == 100) then
pbMobsMaxHP[unitGUID] = UnitChangeHealth("target");
end;
else
health = UnitHealth("target");
healthRatio = math.ceil(1000 * UnitHealth("target")/UnitMaxHealth("target")) / 10;
end;
if (UnitInRaid("raid1") or UnitInParty("party1")) then
if (sL > 0 and sC ~= "") then
sub = " / " .. sC .. " (" .. sL .. ")";
end;
message = "[ " .. UnitName("target") .. " - " .. pbLocale["HP"] .. ": " .. health .. " (" .. healthRatio .. "%) - " .. mC .. " (" .. mL .. ")" .. sub .. " ]";
SendChatMessage(message,"PARTY");
else
local mColor, sColor = "", "";
if (classColors[mC] ~= nil) then
mColor = "|cff" .. classColors[mC];
end;
if (sL > 0 and sC ~= "") then
if (classColors[sC] ~= nil) then
sColor = "|cff" .. classColors[sC];
end;
sub = " / " .. sColor .. sC .. "|r (" .. sColor .. sL .. "|r)";
end;
message = "[pbMobInfo]: [ " .. UnitName("target") .. " - " .. pbLocale["HP"] .. ": " .. health .. " (" .. healthRatio .. "%) - " .. mColor .. mC .. "|r (" .. mColor .. mL .. "|r)" .. sub .. " ]";
DEFAULT_CHAT_FRAME:AddMessage(message, 1, 1, 1);
end;
ChatFrame2:AddMessage(message, 1, 1, 1); -- combat log
else
local message = "[pbMobInfo]: " .. pbLocale["NVT"];
DEFAULT_CHAT_FRAME:AddMessage(message, 1, 1, 1);
ChatFrame2:AddMessage(message, 1, 1, 1); -- combat log
end;
end;
SLASH_PBMOBINFO1 = "/mobinfo"; -- thx to gastro19 for the idea!
SLASH_PBMOBINFO2 = "/mi";
SlashCmdList["PBMOBINFO"] = pbMobInfoChat;