Jump to content

Recommended Posts

Hello,

I'm looking for some ideas how you would create or what you expect from a heal engine.

We got a list with player objects that will be updated async so we allways have an updated list of party or raid member.
Now it comes to the point we have to priorize the ppl. What would you expect from it?
I never wrote such stuff so it would be helpfull if someone could explain what and why he would add some functions. Also samples are welcome if you know a existing heal engine.

Thanks iMod

Link to comment
https://wrobot.eu/forums/topic/5347-heal-engine-concept/
Share on other sites

9 hours ago, iMod said:

Hello,

I'm looking for some ideas how you would create or what you expect from a heal engine.

We got a list with player objects that will be updated async so we allways have an updated list of party or raid member.
Now it comes to the point we have to priorize the ppl. What would you expect from it?
I never wrote such stuff so it would be helpfull if someone could explain what and why he would add some functions. Also samples are welcome if you know a existing heal engine.

Thanks iMod

  • Prioritize lowest health %, but if a tank is low too, prioritize him first. ( if there are multiple tanks, then prioritize the lowest one )
  • Every tank will have different healing settings. ( spells and % )
  • Check threat, so if a tank loses his aggro for X milliseconds, you can set a focus heal on the non tank player with the highest threat. ( shield, bubble, barkskin, quick heal etc. )
  • Pre hots and shields, if there are encounters of a boss, which will give players a decent amount of damage. ( debuffs, or a cast of the boss )
  • Check debuffs of all players and if you can dispell it. ( prioritize tank ofc. and avoid overheal, if there's a 100% healing reduced debuff, which can't get removed by overheal )
  • At some boss encounters, a certain healer will have to use his cooldown, which will get choosed before. ( example: At the 5th charge of the boss i have to use tranquility )
  • Different settings and spells at high and low mana %.
  • Possibility of only healing certain groups and players, in a raid. ( if they're not alive anymore, switch to the other groups )
Link to comment
https://wrobot.eu/forums/topic/5347-heal-engine-concept/#findComment-24621
Share on other sites

The easiest way is to copy something that was working quite well ( top hps on raids ) from the pqr engine files.

 

Nova_CustomT = { }
PQR_WriteToChat("Custom Table is empty!", "Alert")

function CalculateHP(t)
	incomingheals = UnitGetIncomingHeals(t) and UnitGetIncomingHeals(t) or 0
	return 100 * ( UnitHealth(t) + incomingheals ) / UnitHealthMax(t)
end

function CanHeal(t)
	if UnitExists(t)
	 and UnitInRange(t) 
	 and UnitIsFriend("player", t)
	 and UnitIsConnected(t)
	 and not UnitIsEnemy("player",t) 
	 and not UnitIsCharmed(t) 
	 and not UnitIsDeadOrGhost(t) 
	 and not PQR_IsOutOfSight(t)
	 and not UnitDebuffID(t,104451) -- Ice Tomb
	 and not UnitDebuffID(t,76577)  -- Smoke Bomb 
  then return true end 
end

function SheuronEngine()
	local group, size = nil, nil
	lowhpmembers = 0
	members = { { Unit = "player", HP = CalculateHP("player") } } 
	-- Check if the Player is apart of the Custom Table
	for i=1, #Nova_CustomT do if UnitGUID("player") == Nova_CustomT[i].GUID then Nova_CustomT[i].Unit = "player" Nova_CustomT[i].HP = CalculateHP("player") end end
	--Find the Group Type and Size
	if GetNumRaidMembers() > 0 then 
		group = "raid" 
		size = GetNumRaidMembers() 
	else 
		group = "party" 
		size = GetNumPartyMembers() 
	end
	
	for i = 1, size, 1 do 
		local member, memberhp = group..i, CalculateHP(group..i) 
		if CanHeal(member) then
			if UnitGroupRolesAssigned(member) == "TANK" then memberhp = memberhp - 1 end
			if UnitThreatSituation(member) == 3 then memberhp = memberhp - 3 end
			if UnitBuffID(member, 53563) then memberhp = memberhp + 3 end -- Searing Plasma Check
			for i = 1, #PQ_SP do if UnitDebuffID(member, PQ_SP[i]) then memberhp = memberhp - 9 end end
			for i=1, #Nova_CustomT do if UnitGUID(member) == Nova_CustomT[i].GUID then Nova_CustomT[i].Unit = member Nova_CustomT[i].HP = memberhp end end -- If they are in the Custom Table add their info in
			table.insert(members, { Unit = member, HP = CalculateHP(member) } )
		end
		if CanHeal(group..i.."pet") then
			local memberpet, memberpethp = nil, nil
			if UnitAffectingCombat("player") then
				 memberpet = group..i.."pet" 
				 memberpethp = CalculateHP(group..i.."pet") * 2
			else
				 memberpet = group..i.."pet"
				 memberpethp = CalculateHP(group..i.."pet")
			end
			for i=1, #Nova_CustomT do if UnitGUID(memberpet) == Nova_CustomT[i].GUID then Nova_CustomT[i].Unit = memberpet Nova_CustomT[i].HP = memberpethp end end
			table.insert(members, { Unit = memberpet, HP = memberpethp } )
		end
	end
	table.sort(Nova_CustomT, function(x, y) return x.HP < y.HP end)
	table.sort(members, function(x,y) return x.HP < y.HP end)
	for i=1,#members do if members[i].HP < 85 then lowhpmembers = lowhpmembers + 1 end end 
	if CanHeal("target") then table.sort(members, function(x) return UnitIsUnit("target",x.Unit) end) end 
end                                   
                                             I 

 

it looks like that - SheuronEngine() ( that was the standard system to calculate hp in pqr heal bot up to pandas and pqr ban )  will make global variable that will hold  the lowest hp player with priority on tank with incoming heal counted in. I translated it partially to c# and it's working quite well. ( a bit hacky whacky tho ) . In wrobot there is no translated function like unit threat situation and roles assigned and calling lua from c# is very power hogging process. Idk why but calling lua is eating a lot of  power.

Something like that for example is working but sometimes bugging out ( the name of players sometime canno't be read from memory and you will get Unknown )

public WoWPlayer FindLowestHealth()
    {
Dictionary<WoWPlayer, double> players = new Dictionary<WoWPlayer, double>();

        int playerHp = Convert.ToInt32(ObjectManager.Me.HealthPercent);
        if (playerHp < 100)
        {
            if (UnitThreatSituation(ObjectManager.Me.Name) == 3) { playerHp = playerHp - 3; }
            if (UnitGroupRolesAssigned(ObjectManager.Me.Name) == "TANK") { playerHp = playerHp - 1; }
        }
        players.Add(ObjectManager.Me, playerHp);

        foreach (var wowPlayer in ObjectManager.GetObjectWoWPlayer())
        {
            if (wowPlayer.Name != null && wowPlayer.GetDistance < 40 && wowPlayer.IsAlive && !TraceLine.TraceLineGo(wowPlayer.Position) && UnitIsFriend(wowPlayer.Name) && UnitIsConnected(wowPlayer.Name) && !UnitIsEnemy(wowPlayer.Name) && !UnitIsCharmed(wowPlayer.Name))
            {
                int otherPlayerHp = Convert.ToInt32(wowPlayer.HealthPercent);
                if (playerHp < 100)
                {
                    if (UnitThreatSituation(wowPlayer.Name) == 3) { otherPlayerHp = otherPlayerHp - 3; }
                    if (UnitGroupRolesAssigned(wowPlayer.Name) == "TANK") { otherPlayerHp = otherPlayerHp - 1; }
                }
                players.Add(wowPlayer, otherPlayerHp);
            }
        }
        WoWPlayer minHpPlayer = players.Aggregate((l, r) => l.Value < r.Value ? l : r).Key;
        players = null;
        return minHpPlayer;
}

 

Calling FindLowestHealth() will return player with lowest hp. ( buggy and not the last version what I'm using now )

Link to comment
https://wrobot.eu/forums/topic/5347-heal-engine-concept/#findComment-24717
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...