azerothcore / mod-eluna-lua-engine

DEPRECATED

Home Page:https://www.azerothcore.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Expose ModifyThreatPct

55Honey opened this issue · comments

This needs to be added in https://github.com/azerothcore/Eluna first if anyone wants to pick it up.

I tried this in UnitMethods.h

    /**
    * Modifies threat in pct to the [Unit] from the victim
    *
    * @param [Unit] victim : [Unit] that caused the threat
    * @param int32 percent : threat amount in pct
    */
    int ModifyThreatPct(lua_State* L, Unit* unit)
    {
        Unit* victim = Eluna::CHECKOBJ<Unit>(L, 2);
        int32 threatPct = Eluna::CHECKVAL<int32>(L, 3, true);

#ifdef AZEROTHCORE
        unit->GetThreatManager().ModifyThreatPct(victim, threatPct);
#endif
        return 0;
    }

which was copied over from https://github.com/azerothcore/Eluna/blob/796dff57b50b1bbf98adfc9ee4ccd1de65f752be/UnitMethods.h#L2961

and

    { "ModifyThreatPct", &LuaUnit::ModifyThreatPct },

in LuaFunctions.cpp

But it turns out that 'GetThreatManager': is not a member of 'Unit'