i believe it is saved in the table isn't it?
what i did was create the Table by inserting the Characters GUID into it...
then when we cycle that table we just add in the other information into the same area so it's linked
the sheuron code i was talking about was EnemiesInFront() or w/e
what it did was TargetNextEnemy until your original targets GUID matches up with Current Target again... and that is the number of people in front of u...
only thing it did poorly was also target some people shortly behind u as well... so combine the two codes and it should be exactly what i was looking for
does anyone have a dk frost pve and a druid balance xml profile to download from URL
PQR 2.1.3 BETA - Do not use this unless you are a profile developer and want to test out the new functions.
http://dl.dropbox.com/u/39925787/PQR...QR213_BETA.zip
Do not run PQRUpdater or Download Offsets with this version. It will download old versions.
New Functions:
PQR_BehindTarget() - Are you behind your selected target true/false. (180 degrees behind)
PQR_FacingTarget() - Are you facing your selected target true/false. (Target is within 180 degrees of your forward facing)
PQR_DistanceTarget() - The distance to the target. This uses WoW's internal X/Y/Z and not yards.
Note that these values are not updated the moment you change targets, so you can NOT do something like
TargetUnit("raid1")
if PQR_BehindTarget() then DO THIS else TargetUnit("raid2") etc. There is a slight delay in the update, somewhere along the lines of 10ms.
After enabling PQR you can test it out using this script command:
/script print("Behind: ", PQR_BehindTarget(), ". Facing: ", PQR_FacingTarget(), ". Distance", PQR_DistanceTarget())
This uses new offsets, which are not in the existing MOP beta offset release. I will release a generic MOP beta offset tomorrow for the current release version then eventually update the offsets for 2.1.3.
Please let me know of any issues, there are some major changes in place to make all of this work.Note not having a target will not cause the info to reset, and instead freeze the info at what it was last this is intended for the time being.
Last edited by Xelper; 04-27-2012 at 10:07 PM.
Done some testing on ragefire chasm
PQR_FacingTarget() seem work flawless
PQR_BehindTarget() not working properly. When you aggro a mob and he attacks you return false, but if you walk through him, the mob turn to keep attacking you but function keep return false until mob moves. i guess that happend because you checking mob position and mob didnt moved, just turn around.
PQR_DistanceTarget() always return nil
BTW, this new thing you using to get enemy player position could be used to track nearby mines, herbs, etc...? That would make possible create gathering profiles![]()
Last edited by sheuron; 04-27-2012 at 10:47 PM.
[ Sheuron PQR Profiles Pack ] https://goo.gl/lfAMC
If you like this piece of code feel free to invite me a beer making a donation.
My paypal account: [email protected]
hey i m just looking for perfect fury profile but i cant find it.i tried lots of them . so do u have any advice for me ?
[ Sheuron PQR Profiles Pack ] https://goo.gl/lfAMC
If you like this piece of code feel free to invite me a beer making a donation.
My paypal account: [email protected]
@Crystal_tech
I was wondering if this is possible with the hunters Disengage Spell?
For example when a warrior starts the charge or a rogue uses sprint toward you..the disengage will be used asap:P
please check out this ty:P
local MAJOR_VERSION = "Threat-1.0"
local MINOR_VERSION = tonumber(("$Revision: 41486 $"):match("%d+"))
if MINOR_VERSION > _G.ThreatLib_MINOR_VERSION then
_G.ThreatLib_MINOR_VERSION = MINOR_VERSION
end
local _, c = _G.UnitClass("player")
if c ~= "HUNTER" then return end
ThreatLib_funcs[#ThreatLib_funcs+1] = function()
local _G = _G
local tonumber = _G.tonumber
local getmetatable = _G.getmetatable
local AceLibrary = _G.AceLibrary
local ThreatLib = _G.ThreatLib
local BS = AceLibrary("Babble-Spell-2.2")
local Hunter = ThreatLib:GetModule("ClassCore"):NewModule(c)
local distractThreatAmounts = {110, 160, 250, 350, 465, 600, 900}
local disengageThreatAmounts = {-140, -280, -405, -545}
local FDString
function Hunter:ClassInit()
self.className = "HUNTER"
-- CastHandlers
self.CastHandlers[BS["Distracting Shot"]] = self.DistractingShot
self.CastHandlers[BS["Disengage"]] = self.Disengage
self.CastHandlers[BS["Feign Death"]] = self.FeignDeath
-- ClassBuffs
self.ClassBuffs[BS["Misdirection"]] = self.MisdirectionBuff
-- Needed for FD. Ugly as hell, but it works.
FDString = BS["Feign Death"]
self:RegisterEvent("UNIT_SPELLCAST_SENT")
self:RegisterEvent("UI_ERROR_MESSAGE")
-- ERR_FEIGN_DEATH_RESISTED
end
function HunteristractingShot(rank)
local ranknum = tonumber(rank:match("%d+"))
self:AddTargetThreat(distractThreatAmounts[ranknum] * self:threatMods())
end
function Hunterisengage(rank)
local ranknum = tonumber(rank:match("%d+"))
self:AddTargetThreat(disengageThreatAmounts[ranknum] * self:threatMods())
end
-- Feign is a rather unique case. It's cast on all targets, but may be resisted by any one target. There is no combat log message - only an error event with ERR_FEIGN_DEATH_RESISTED from GlobalStrings
-- ERR_FEIGN_DEATH_RESISTED always happens before SPELLCAST_SUCCESSFUL, so we "prime" FD when we get SENT, then invalidate it if we get a resist, let it through otherwise.
-- The net effect is that a resist on any one target invalidates the threat reset on all targets, but we can't help that since we don't have target data on who resisted
local FeignDeathPrimed = false
function Hunter:FeignDeath()
if FeignDeathPrimed then
FeignDeathPrimed = false
self:_reduceAllThreat(0)
ThreatLibebug("Running FD, clearing threat!")
end
end
function Hunter:UNIT_SPELLCAST_SENT(arg1, arg2, arg3, arg4)
if arg1 == "player" and arg2 == FDString then
ThreatLibebug("FD is primed!")
FeignDeathPrimed = true
elseif arg1 == "player" then
-- call prototype's :UNIT_SPELLCAST_SENT
getmetatable(self).__index.UNIT_SPELLCAST_SENT(self, arg1, arg2, arg3, arg4)
end
end
function Hunter:UI_ERROR_MESSAGE(arg1)
if arg1 == ERR_FEIGN_DEATH_RESISTED then
ThreatLibebug("Canceling FD!")
FeignDeathPrimed = false
end
end
function Hunter:MisdirectionBuff(action, rank, apps)
-- Previous implementation was a bit too clever :P
if action == "lose" then
ThreatLibebug("Lost Misdirection")
self:RedirectThreatTo(nil)
elseif action == "gain" then
ThreatLibebug("Gained misdirection, target is %s", self.currentTarget)
self:RedirectThreatTo(self.currentTarget)
end
end
table.insert(ThreatLib.UpvalueFixers, function(lib)
ThreatLib = lib
Hunter = ThreatLib:GetModule("ClassCore"):GetModule(c)
end)
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
And this for pets attack..
local MAJOR_VERSION = "Threat-1.0"
local MINOR_VERSION = tonumber(("$Revision: 41459 $"):match("%d+"))
if MINOR_VERSION > _G.ThreatLib_MINOR_VERSION then
_G.ThreatLib_MINOR_VERSION = MINOR_VERSION
end
ThreatLib_funcs[#ThreatLib_funcs+1] = function()
local _G = _G
local tonumber = _G.tonumber
local pairs = _G.pairs
local UnitName = _G.UnitName
local UnitAffectingCombat = _G.UnitAffectingCombat
local GetPetActionInfo = _G.GetPetActionInfo
local AceLibrary = _G.AceLibrary
local ThreatLib = _G.ThreatLib
-- local _, c = _G.UnitClass("player")
-- We'll let it load for everyone, because sometimes non-hunter/locks get pets.
-- if c ~= "HUNTER" and c ~= "WARLOCK" then return end
local c = "PET"
local new, del, newHash, newSet = ThreatLib.new, ThreatLib.del, ThreatLib.newHash, ThreatLib.newSet
local BS = AceLibrary("Babble-Spell-2.2")
local Aura = AceLibrary("SpecialEvents-Aura-2.0")
local Pet = ThreatLib:GetModule("ClassCore"):NewModule(c)
-- Most of theses data come from KTM's pet module
local skillData = {
-- Scaling skills
[BS["Growl"]] = {
rankLevel = { 1, 10, 20, 30, 40, 50, 60, 70},
rankThreat = {50, 65, 110, 170, 240, 320, 415, 664},
apBaseBonus = 1235.6,
apLevelMalus = 28.14,
apFactor = 5.7,
},
[BS["Anguish"]] = {
rankLevel = { 50, 60, 69},
rankThreat = {300, 395, 632},
apBaseBonus = 109,
apLevelMalus = 0,
apFactor = 0.698,
},
[BS["Torment"]] = {
rankLevel = {10, 20, 30, 40, 50, 60, 70},
rankThreat = {45, 75, 125, 215, 300, 395, 632},
apBaseBonus = 123,
apLevelMalus = 0,
apFactor = 0.385,
},
[BS["Suffering"]] = {
rankLevel = { 24, 36, 48, 60, 63, 69},
rankThreat = {150, 300, 450, 600, 645, 885},
apBaseBonus = 124,
apLevelMalus = 0,
apFactor = 0.547,
},
-- I think that Intimidation scales, but I don't have any scaling data on it
[BS["Intimidation"]] = {
rankThreat = {580}
},
-- Unscaling skills
[BS["Cower"]] = {
rankThreat = {-30, -55, -85, -125, -175, -225, -360},
},
[BS["Cleave"]] = {
rankThreat = {0, 0, 0, 0, 100, 130},
},
[BS["Soothing Kiss"]] = {
rankThreat = {-45, -75, -127, -165, -275},
},
}
local petAPThreshold = 0
local skillRanks = {}
function Pet:InitHooks()
self:RegisterEvent("LOCALPLAYER_PET_RENAMED")
self:RegisterEvent("UNIT_NAME_UPDATE")
self:RegisterEvent("UNIT_PET")
end
function Pet:ClassInit()
-- CastHandlers
self.petName = UnitName("pet")
self.isPetModule = true
self.unitType = "pet"
local playerClass = select(2, UnitClass("player"))
self.petScaling = (playerClass == "HUNTER") or (playerClass == "WARLOCK")
local function castHandler(self, rank, name) self:AddSkillThreat(name, rank) end
for name in pairs(skillData) do
self.CastHandlers[name] = castHandler
end
for k, v in pairs(skillRanks) do
skillRanks[k] = nil
end
self.skillRanks = skillRanks
self:ScanPetSkillRanks()
self:RegisterEvent("PET_BAR_UPDATE", "ScanPetSkillRanks")
self:RegisterEvent("UNIT_HEALTH")
end
function Pet:ScanPetSkillRanks()
for i = 1,10 do
local name, rank = GetPetActionInfo(i)
if skillData[name] then
self.skillRanks[name] = rank
end
end
end
function Pet:AddSkillThreat(name, rank)
rank = rank or self.skillRanks[name] or "1"
local rankNum = tonumber(rank:match("%d+"))
local skill = skillData[name]
local rankLevel = skill.rankLevel
local rankThreat = skill.rankThreat
local threat, baseThreat = rankThreat[rankNum], rankThreat[rankNum]
-- This could be optimized pretty heavily
local petLevel = UnitLevel("pet")
if skill.apFactor and petLevel then
for i = 1, #rankLevel do
if rankLevel[#rankLevel - i + 1] <= petLevel then
rankNum = #rankLevel - i + 1
break
end
end
local baseThreat = rankThreat[rankNum]
local baseAP, posAPBuff, negAPBuff = UnitAttackPower("pet");
local petAP = baseAP + posAPBuff + negAPBuff;
threat = threat + (max(0, petAP - (baseThreat + petLevel)) * skill.apFactor)
end
-- ThreatLibebug("Adding %s threat for %s, %s", threat, name, rank)
if not threat then return end
self:AddTargetThreat(threat * self:threatMods())
end
function Pet:LOCALPLAYER_PET_RENAMED()
self.petName = UnitName("pet")
end
local function reinitme(self)
ThreatLib:GetModule("ClassCore"):ToggleModuleActive(self, false)
self:InitHooks()
ThreatLib:GetModule("ClassCore"):ToggleModuleActive(self, true)
ThreatLib:PARTY_MEMBERS_CHANGED()
ThreatLib:PLAYER_ENTERING_WORLD()
end
function Pet:UNIT_PET(arg1)
if arg1 == "player" then
self.petName = UnitName("pet")
-- ThreatLibebug("Pet changed. Pet is %s", self.petName)
if self.petName then
self:ScheduleEvent("ThreatReInitPetModule", reinitme, 0.5, self)
else
-- ThreatLibebug("Pet despawn, setting pet out of combat")
self:PLAYER_REGEN_ENABLED()
end
end
end
function Pet:UNIT_NAME_UPDATE(arg1)
if arg1 == "pet" then
self.petName = UnitName("pet")
if self.petName then
self:ScheduleEvent("ThreatReInitPetModule", reinitme, 0.5, self)
ThreatLib:PARTY_MEMBERS_CHANGED()
end
end
end
function Pet:UNIT_HEALTH(arg1)
if arg1 == "pet" and UnitHealth(arg1) == 0 then
-- Pet's dead!
-- ThreatLibebug("Pet died, setting pet out of combat")
self:PLAYER_REGEN_ENABLED()
end
end
table.insert(ThreatLib.UpvalueFixers, function(lib)
ThreatLib = lib
Pet = ThreatLib:GetModule("ClassCore"):GetModule(c)
end)
end
Thanks
Ipass
Last edited by ipass; 04-28-2012 at 12:31 AM.
Yeah I can probably do something like HerbsNearby() (in gather range), etc.
Can you try to restart WoW and try the command again? I downloaded the version I posted and it works fine:
[09:38:16] Behind: false . Facing: true . Distance 20.783248209432
The "BehindTarget" is interesting though, the rotation of the mob internally doesn't actually change when it faces a target (until it actually moves).. I might have to do something like if target IsPlayer use rotation, otherwise use facing to target's target.
Last edited by Xelper; 04-28-2012 at 08:46 AM.
Anyone know who has a good enhancement shaman profile.
New offsets vor Beta Server are out?