Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] Yeah, your code made this easy. But how should GetCompletedAchievementsCount act? Do I include or om

[DiscordArchive] Yeah, your code made this easy. But how should GetCompletedAchievementsCount act? Do I include or om

[DiscordArchive] Yeah, your code made this easy. But how should GetCompletedAchievementsCount act? Do I include or om

rektbyfaith
Administrator
0
09-17-2023, 04:19 PM
#1
Archived author: syco • Posted: 2023-09-17T16:19:49.547000+00:00
Original source

Yeah, your code made this easy. But how should GetCompletedAchievementsCount act? Do I include or omit like blizzard does?
rektbyfaith
09-17-2023, 04:19 PM #1

Archived author: syco • Posted: 2023-09-17T16:19:49.547000+00:00
Original source

Yeah, your code made this easy. But how should GetCompletedAchievementsCount act? Do I include or omit like blizzard does?

rektbyfaith
Administrator
0
09-17-2023, 04:22 PM
#2
Archived author: Roboto • Posted: 2023-09-17T16:22:15.013000+00:00
Original source

I'd do an optional boolean argument `countFeatsOfStrength`
rektbyfaith
09-17-2023, 04:22 PM #2

Archived author: Roboto • Posted: 2023-09-17T16:22:15.013000+00:00
Original source

I'd do an optional boolean argument `countFeatsOfStrength`

rektbyfaith
Administrator
0
09-17-2023, 04:22 PM
#3
Archived author: Roboto • Posted: 2023-09-17T16:22:19.155000+00:00
Original source

would be false by default
rektbyfaith
09-17-2023, 04:22 PM #3

Archived author: Roboto • Posted: 2023-09-17T16:22:19.155000+00:00
Original source

would be false by default

rektbyfaith
Administrator
0
09-17-2023, 05:46 PM
#4
Archived author: syco • Posted: 2023-09-17T17:46:40.998000+00:00
Original source

Added the optional argument, not sure if code structure is correct.
rektbyfaith
09-17-2023, 05:46 PM #4

Archived author: syco • Posted: 2023-09-17T17:46:40.998000+00:00
Original source

Added the optional argument, not sure if code structure is correct.

rektbyfaith
Administrator
0
09-17-2023, 05:50 PM
#5
Archived author: syco • Posted: 2023-09-17T17:50:26.887000+00:00
Original source

```c
int GetCompletedAchievementsCount(lua_State* L, Player* player)
{
uint32 count = 0;
bool countFeatsOfStrength = Eluna::CHECKVAL<bool>(L, 2, false);
const CompletedAchievementMap& completedAchievements = player->GetAchievementMgr()->GetCompletedAchievements();
for (auto& pair : completedAchievements)
{
AchievementEntry const* achievement = sAchievementStore.LookupEntry(pair.first);
if (achievement && countFeatsOfStrength == false)
{
if (achievement->categoryId != 81)
{
count++;
}
}
else if (achievement)
{
count++;
}
}

Eluna:Tongueush(L, count);
return 1;
}
```
rektbyfaith
09-17-2023, 05:50 PM #5

Archived author: syco • Posted: 2023-09-17T17:50:26.887000+00:00
Original source

```c
int GetCompletedAchievementsCount(lua_State* L, Player* player)
{
uint32 count = 0;
bool countFeatsOfStrength = Eluna::CHECKVAL<bool>(L, 2, false);
const CompletedAchievementMap& completedAchievements = player->GetAchievementMgr()->GetCompletedAchievements();
for (auto& pair : completedAchievements)
{
AchievementEntry const* achievement = sAchievementStore.LookupEntry(pair.first);
if (achievement && countFeatsOfStrength == false)
{
if (achievement->categoryId != 81)
{
count++;
}
}
else if (achievement)
{
count++;
}
}

Eluna:Tongueush(L, count);
return 1;
}
```

rektbyfaith
Administrator
0
09-17-2023, 05:58 PM
#6
Archived author: syco • Posted: 2023-09-17T17:58:27.168000+00:00
Original source


[Image: image.png?ex=690c3903&is=690ae783&hm=962...97f2477a8&]
rektbyfaith
09-17-2023, 05:58 PM #6

Archived author: syco • Posted: 2023-09-17T17:58:27.168000+00:00
Original source


[Image: image.png?ex=690c3903&is=690ae783&hm=962...97f2477a8&]

rektbyfaith
Administrator
0
09-17-2023, 06:15 PM
#7
Archived author: Roboto • Posted: 2023-09-17T18:15:27.188000+00:00
Original source

You can trim it down a bit. If my bool algebra is correct:
```cpp
AchievementEntry const* achievement = sAchievementStore.LookupEntry(pair.first);
if (achievement && (achievement->categoryId != 81 || countFeatsOfStrength))
{
count++;
}
```
rektbyfaith
09-17-2023, 06:15 PM #7

Archived author: Roboto • Posted: 2023-09-17T18:15:27.188000+00:00
Original source

You can trim it down a bit. If my bool algebra is correct:
```cpp
AchievementEntry const* achievement = sAchievementStore.LookupEntry(pair.first);
if (achievement && (achievement->categoryId != 81 || countFeatsOfStrength))
{
count++;
}
```

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)