Jump to content

Quest Function - Get Party Leader Name


Recommended Posts

  • Bronze

M2 Download Center

This is the hidden content, please
( Internal )

Hey guys,

 

I'v added a little function to source that will retrieve party leader name.

Very useful for party/dungeon bosses hunt,you can notice everyone the name of the party leader when performing an action(kill boss,finish dungeon,etc).

Open party.h

look for

Spoiler

DWORD        GetLeaderPID();

add below:

Spoiler

const char *    GetLeaderName();

open party.cpp

look for:

Spoiler

DWORD CParty::GetLeaderPID()

add below this function:

Spoiler

const char * CParty::GetLeaderName()
{
    LPCHARACTER leader_ch = CHARACTER_MANAGER::instance().FindByPID(m_dwLeaderPID);
    return  leader_ch->GetName();
}

open questlua_party.cpp

look for:

Spoiler

int party_get_leader_pid(lua_State* L)

add below this function:

Spoiler

int party_get_leader_name(lua_State* L)
    {
        LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
        if (ch->GetParty())
        {
            
            lua_pushstring(L, ch->GetParty()->GetLeaderName());
            
        }
        else
        {
            lua_pushnumber(L, -1);
        }
        return 1;
    }
 

look for:

Spoiler

{ "get_leader_pid",    party_get_leader_pid},

add below:

Spoiler

{"get_leader_name",    party_get_leader_name},

open quest_function file

add there: party.get_leader_name

Example how to use in quest:

Spoiler

 

when 6091.kill begin

notice_all(party.get_leader_name().." Group has killed razador!")

end

 

 

Enjoy!

  • Love 7
Link to comment
Share on other sites

  • Bronze

The whole purpose of this function is to use while in party.

Anyway,it is easy to fix.

change function int party_get_leader_name inside questlua_party.cpp  to this:

int party_get_leader_name(lua_State* L)
    {
        LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
        if (ch->GetParty())
        {
            
            lua_pushstring(L, ch->GetParty()->GetLeaderName());
            
        }
        else
        {
           lua_pushstring(L, ch->GetName());
        }
        return 1;
    }

  • Love 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.