Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] well if a player dies they get cleared from the threat list dont they?

[DiscordArchive] well if a player dies they get cleared from the threat list dont they?

[DiscordArchive] well if a player dies they get cleared from the threat list dont they?

Pages (3): Previous 1 2 3 Next
rektbyfaith
Administrator
0
12-22-2022, 01:20 AM
#11
Archived author: Rymercyble • Posted: 2022-12-22T01:20:14.702000+00:00
Original source

is there some more convenient way to check if player is in open world ? so far scrolling through methods in player class i can see only getting map id which i could compare to list of open world maps but thats silly
rektbyfaith
12-22-2022, 01:20 AM #11

Archived author: Rymercyble • Posted: 2022-12-22T01:20:14.702000+00:00
Original source

is there some more convenient way to check if player is in open world ? so far scrolling through methods in player class i can see only getting map id which i could compare to list of open world maps but thats silly

rektbyfaith
Administrator
0
12-22-2022, 01:22 AM
#12
Archived author: Rymercyble • Posted: 2022-12-22T01:22:35.920000+00:00
Original source

im sry for my stupid questions but until i will be familiar with code i dont have much choice after trying to search for few keywords i can think of
rektbyfaith
12-22-2022, 01:22 AM #12

Archived author: Rymercyble • Posted: 2022-12-22T01:22:35.920000+00:00
Original source

im sry for my stupid questions but until i will be familiar with code i dont have much choice after trying to search for few keywords i can think of

rektbyfaith
Administrator
0
12-22-2022, 01:31 AM
#13
Archived author: Anchy • Posted: 2022-12-22T01:31:22.239000+00:00
Original source

well what do you consider open world
rektbyfaith
12-22-2022, 01:31 AM #13

Archived author: Anchy • Posted: 2022-12-22T01:31:22.239000+00:00
Original source

well what do you consider open world

rektbyfaith
Administrator
0
12-22-2022, 01:31 AM
#14
Archived author: Anchy • Posted: 2022-12-22T01:31:33.482000+00:00
Original source

not inside an instance?
rektbyfaith
12-22-2022, 01:31 AM #14

Archived author: Anchy • Posted: 2022-12-22T01:31:33.482000+00:00
Original source

not inside an instance?

rektbyfaith
Administrator
0
12-22-2022, 01:32 AM
#15
Archived author: Rymercyble • Posted: 2022-12-22T01:32:20.792000+00:00
Original source

anything that is not raid/dung/arena/bg
rektbyfaith
12-22-2022, 01:32 AM #15

Archived author: Rymercyble • Posted: 2022-12-22T01:32:20.792000+00:00
Original source

anything that is not raid/dung/arena/bg

rektbyfaith
Administrator
0
12-22-2022, 01:34 AM
#16
Archived author: Anchy • Posted: 2022-12-22T01:34:54.280000+00:00
Original source

```cpp
Map* map = player->GetMap();
if (map)
{
if (map->IsBattlegroundOrArena() || map->IsDungeon() || map->IsRaid())
{
return;
}
}```
rektbyfaith
12-22-2022, 01:34 AM #16

Archived author: Anchy • Posted: 2022-12-22T01:34:54.280000+00:00
Original source

```cpp
Map* map = player->GetMap();
if (map)
{
if (map->IsBattlegroundOrArena() || map->IsDungeon() || map->IsRaid())
{
return;
}
}```

rektbyfaith
Administrator
0
12-22-2022, 01:37 AM
#17
Archived author: Rymercyble • Posted: 2022-12-22T01:37:06.066000+00:00
Original source

200iq
rektbyfaith
12-22-2022, 01:37 AM #17

Archived author: Rymercyble • Posted: 2022-12-22T01:37:06.066000+00:00
Original source

200iq

rektbyfaith
Administrator
0
12-22-2022, 01:51 AM
#18
Archived author: Rymercyble • Posted: 2022-12-22T01:51:45.079000+00:00
Original source

hmm i just noticed if i have `hostileRef->GetOwner()->UpdateAllStats();` there it resets it back to base hp
rektbyfaith
12-22-2022, 01:51 AM #18

Archived author: Rymercyble • Posted: 2022-12-22T01:51:45.079000+00:00
Original source

hmm i just noticed if i have `hostileRef->GetOwner()->UpdateAllStats();` there it resets it back to base hp

rektbyfaith
Administrator
0
12-22-2022, 01:54 AM
#19
Archived author: Anchy • Posted: 2022-12-22T01:54:40.863000+00:00
Original source

you probably dont need it actually
rektbyfaith
12-22-2022, 01:54 AM #19

Archived author: Anchy • Posted: 2022-12-22T01:54:40.863000+00:00
Original source

you probably dont need it actually

rektbyfaith
Administrator
0
12-22-2022, 01:57 AM
#20
Archived author: Rymercyble • Posted: 2022-12-22T01:57:29.026000+00:00
Original source

so for any1 interested this is whole script
```cpp
if (!hostileRef->GetVictim()) {
return;
}

if (!hostileRef->GetVictim()->IsPlayer()) {
return;
}

Map *map = hostileRef->GetVictim()->ToPlayer()->GetMap();

if (map) {
if (map->IsBattlegroundOrArena() || map->IsRaid() || map->IsDungeon()) {
return;
}
}

int count = 0;

auto threat_list = hostileRef->GetOwner()->GetThreatMgr().GetThreatList();

for (const auto ref: threat_list) {
if (!ref->GetVictim()) {
continue;
}

if (ref->GetVictim()->IsPlayer()) {
count++;
}
}

if (count > 1) {
std::int_fast64_t max_hp = hostileRef->GetOwner()->GetMaxHealth();
std::int_fast64_t current_hp = hostileRef->GetOwner()->GetHealth();

auto ratio = sConfigMgr->GetOption<float>("Mellian.ratio", .2f);

std::int_fast64_t new_max_hp = max_hp + (max_hp * (count - 1) * ratio);

if (new_max_hp <= max_hp) {
return;
}

hostileRef->GetOwner()->SetMaxHealth(new_max_hp);
hostileRef->GetOwner()->SetHealth(current_hp + (current_hp * (count - 1) * ratio));
}
```
i dont have setup prepared to create PRs so i will make it public sometime later
rektbyfaith
12-22-2022, 01:57 AM #20

Archived author: Rymercyble • Posted: 2022-12-22T01:57:29.026000+00:00
Original source

so for any1 interested this is whole script
```cpp
if (!hostileRef->GetVictim()) {
return;
}

if (!hostileRef->GetVictim()->IsPlayer()) {
return;
}

Map *map = hostileRef->GetVictim()->ToPlayer()->GetMap();

if (map) {
if (map->IsBattlegroundOrArena() || map->IsRaid() || map->IsDungeon()) {
return;
}
}

int count = 0;

auto threat_list = hostileRef->GetOwner()->GetThreatMgr().GetThreatList();

for (const auto ref: threat_list) {
if (!ref->GetVictim()) {
continue;
}

if (ref->GetVictim()->IsPlayer()) {
count++;
}
}

if (count > 1) {
std::int_fast64_t max_hp = hostileRef->GetOwner()->GetMaxHealth();
std::int_fast64_t current_hp = hostileRef->GetOwner()->GetHealth();

auto ratio = sConfigMgr->GetOption<float>("Mellian.ratio", .2f);

std::int_fast64_t new_max_hp = max_hp + (max_hp * (count - 1) * ratio);

if (new_max_hp <= max_hp) {
return;
}

hostileRef->GetOwner()->SetMaxHealth(new_max_hp);
hostileRef->GetOwner()->SetHealth(current_hp + (current_hp * (count - 1) * ratio));
}
```
i dont have setup prepared to create PRs so i will make it public sometime later

Pages (3): Previous 1 2 3 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)