Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] can some1 explain this to me ?

[DiscordArchive] can some1 explain this to me ?

[DiscordArchive] can some1 explain this to me ?

Pages (4): 1 2 3 4 Next
rektbyfaith
Administrator
0
05-05-2023, 03:17 AM
#1
Archived author: Rymercyble • Posted: 2023-05-05T03:17:40.112000+00:00
Original source

can some1 explain this to me ?
```cpp
int32 thisLevel = getLevelForTarget(victim);
int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
```
these naming ~~schemes~~ mess is too much for me so
`this` is attacker
`victim` is target
`thisLevel` is level of target ?? if so why the hell is it called THISlevel
`getLevelForTarget(victim)` returns level of target
`victim->getLevelForTarget(this)` returns level of attacker ?? if so why its not done like this `getLevelForTarget(this)` ??
rektbyfaith
05-05-2023, 03:17 AM #1

Archived author: Rymercyble • Posted: 2023-05-05T03:17:40.112000+00:00
Original source

can some1 explain this to me ?
```cpp
int32 thisLevel = getLevelForTarget(victim);
int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
```
these naming ~~schemes~~ mess is too much for me so
`this` is attacker
`victim` is target
`thisLevel` is level of target ?? if so why the hell is it called THISlevel
`getLevelForTarget(victim)` returns level of target
`victim->getLevelForTarget(this)` returns level of attacker ?? if so why its not done like this `getLevelForTarget(this)` ??

rektbyfaith
Administrator
0
05-05-2023, 03:19 AM
#2
Archived author: Rymercyble • Posted: 2023-05-05T03:19:04.419000+00:00
Original source

i feel like goal of ppl writing such code was to just confuse every1 so nobody can work on it
rektbyfaith
05-05-2023, 03:19 AM #2

Archived author: Rymercyble • Posted: 2023-05-05T03:19:04.419000+00:00
Original source

i feel like goal of ppl writing such code was to just confuse every1 so nobody can work on it

rektbyfaith
Administrator
0
05-05-2023, 04:48 AM
#3
Archived author: Anchy • Posted: 2023-05-05T04:48:48.808000+00:00
Original source

who wrote that
rektbyfaith
05-05-2023, 04:48 AM #3

Archived author: Anchy • Posted: 2023-05-05T04:48:48.808000+00:00
Original source

who wrote that

rektbyfaith
Administrator
0
05-05-2023, 04:49 AM
#4
Archived author: Anchy • Posted: 2023-05-05T04:49:04.674000+00:00
Original source

was it me
rektbyfaith
05-05-2023, 04:49 AM #4

Archived author: Anchy • Posted: 2023-05-05T04:49:04.674000+00:00
Original source

was it me

rektbyfaith
Administrator
0
05-05-2023, 04:49 AM
#5
Archived author: Anchy • Posted: 2023-05-05T04:49:16.959000+00:00
Original source

also you could PR to fix it
rektbyfaith
05-05-2023, 04:49 AM #5

Archived author: Anchy • Posted: 2023-05-05T04:49:16.959000+00:00
Original source

also you could PR to fix it

rektbyfaith
Administrator
0
05-05-2023, 04:50 AM
#6
Archived author: Anchy • Posted: 2023-05-05T04:50:25.217000+00:00
Original source

if it were me I would just:
```cpp
int32 levelDiff = static_cast<int32>(this->GetLevel()) - victim->GetLevel();
```
rektbyfaith
05-05-2023, 04:50 AM #6

Archived author: Anchy • Posted: 2023-05-05T04:50:25.217000+00:00
Original source

if it were me I would just:
```cpp
int32 levelDiff = static_cast<int32>(this->GetLevel()) - victim->GetLevel();
```

rektbyfaith
Administrator
0
05-05-2023, 04:50 AM
#7
Archived author: Anchy • Posted: 2023-05-05T04:50:34.385000+00:00
Original source

that code is kind of over-engineered
rektbyfaith
05-05-2023, 04:50 AM #7

Archived author: Anchy • Posted: 2023-05-05T04:50:34.385000+00:00
Original source

that code is kind of over-engineered

rektbyfaith
Administrator
0
05-05-2023, 04:51 AM
#8
Archived author: Rymercyble • Posted: 2023-05-05T04:51:13.907000+00:00
Original source

its either from TC or sunwell
rektbyfaith
05-05-2023, 04:51 AM #8

Archived author: Rymercyble • Posted: 2023-05-05T04:51:13.907000+00:00
Original source

its either from TC or sunwell

rektbyfaith
Administrator
0
05-05-2023, 04:51 AM
#9
Archived author: Anchy • Posted: 2023-05-05T04:51:21.624000+00:00
Original source

you might still have to cast though
rektbyfaith
05-05-2023, 04:51 AM #9

Archived author: Anchy • Posted: 2023-05-05T04:51:21.624000+00:00
Original source

you might still have to cast though

rektbyfaith
Administrator
0
05-05-2023, 04:52 AM
#10
Archived author: Rymercyble • Posted: 2023-05-05T04:52:18.338000+00:00
Original source

also name of `getLevelForTarget` itself is weird bcs when u write it like this `victim->getLevelForTarget(this)` it just doesnt make sense
rektbyfaith
05-05-2023, 04:52 AM #10

Archived author: Rymercyble • Posted: 2023-05-05T04:52:18.338000+00:00
Original source

also name of `getLevelForTarget` itself is weird bcs when u write it like this `victim->getLevelForTarget(this)` it just doesnt make sense

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