CBuffPet::Release - How does it work?

04/12/2016 08:31 Offspringfan1234#1
Hallo Epvpers,

Ich würde gerne wie der Titel schon sagt gerne diese Funktion verstehen:


Die Funktion wird gecallt, wenn man ein normales Pet (Unicorn, Lion, Tiger, etc) deaktiviert. Die Parameter des Pets werden scheinbar mit Buffs gehandelt. HIWORD und LOWORD von GetLevel() holen sich den Parameter sowie den Wert des Parameters vom aktuell aktivierten Pet.

- Wie aber funktioniert das?
- Wäre es möglich hier weitere Parameter des Pets abzufragen - wenn ja wie?

Wäre über jeden Tipp sehr dankbar, gerne auch über andere Messenger oder pn.

Liebe Grüße Offspring
04/12/2016 08:49 Avalion#2
If I recall, LOWORD returns the first 2 bytes of the value inserted into it, and HIWORD returns the last 2 bytes.
04/12/2016 09:14 Mognakor#3
Quote:
Originally Posted by Avalion View Post
If I recall, LOWORD returns the first 2 bytes of the value inserted into it, and HIWORD returns the last 2 bytes.
PC's usually use Little-Endian-Architecture, thus LOWORD returns the last 2 bytes because they store the lower values.


@[Only registered and activated users can see links. Click Here To Register...]:

Was willst du erreichen?
Mit etwas Fantasie und Können geht alles.
04/12/2016 17:34 Offspringfan1234#4
Mehr oder weniger habe ich das ja schon gesagt. Im Moment ruft er damit den einen Parameter und dessen Value vom Pet ab. Wenn man nun aber Pets mit mehreren Parametern hat, wie kann man es dann realisieren? Ich habe das im Moment mit einem ganz anderen Weg gelöst, da mir die Byte Variante aber neu ist würde ich diese gerne verstehen (was ich jetzt tue) und wissen ob es mit der Variante auch möglich ist mehrere Parameter + Value's abzurufen.

Vielen Dank schonmal!
04/12/2016 18:32 Mognakor#5
Die Flyff Methode dass ein Pet ein Buff ist etc. ist designtechnischer Irrsinn.

Objekte die offensichtlich verschieden sind, sollten durch verschiedene Klassen realisiert werden.

Da die Methode ohnehin bereits der Klasse "CBuffPet" angehört gibt es keinen Grund Daten in Variablen zu verpacken die dafür nicht vorgesehen sind. Arbeitsspeicher hat heutzutage jeder Rechner mehr als genug also kommt es auf ein paar Byte mehr oder weniger auch nicht an.

Dafür verhindern eigene Variablen Bugs und funktionieren bei ordentlicher Benennung als Teil der Dokumentation auch ganz ohne Kommentare.

Am besten postest du mal deine Lösung.
04/13/2016 10:23 Avalion#6
Quote:
Originally Posted by Mognakor View Post
PC's usually use Little-Endian-Architecture, thus LOWORD returns the last 2 bytes because they store the lower values.
intsafe.h
Code:
#define LOWORD(_dw)     ((WORD)(((DWORD_PTR)(_dw)) & 0xffff))
#define HIWORD(_dw)     ((WORD)((((DWORD_PTR)(_dw)) >> 16) & 0xffff))
:rolleyes:
04/13/2016 11:17 Mognakor#7
Quote:
Originally Posted by Avalion View Post
intsafe.h
Code:
#define LOWORD(_dw)     ((WORD)(((DWORD_PTR)(_dw)) & 0xffff))
#define HIWORD(_dw)     ((WORD)((((DWORD_PTR)(_dw)) >> 16) & 0xffff))
:rolleyes:
The last bytes are on the right side..

Little-Endian Bit-Pattern:
Code:
fedc ba98 7654 3210
Big-Endian Bit-Pattern:
Code:
0123 4567 89ab cdef
Notice how HIWORD is shifted towards the end before using bit-AND.
04/13/2016 12:04 Avalion#8
Quote:
Originally Posted by Mognakor View Post
The last bytes are on the right side..
I was reading from right to left, which is why I was saying the 'last' two bytes were the 'first' two bytes.:(
04/27/2016 22:39 Offspringfan1234#9
I'm sorry that I haven't answered for such a while, but due to a stupid occurence my source got killed and I had to reset the source x)

Now I'm back on track and still try to make this pet-parameter thingy possible.

The interessting function is this one I guess:


So with the #ifdef's you're able to see what I've changed.
But since all kinds of pets, so also buff-pets are using this function, I have to be really careful if I change something.
So The HasPet() function still returns FALSE, even if the EatPet (Just a normal Pet) is active. And so the Params are added in the tick-time of the worldserver and u get like every second the stats of the pet which should only be added once.

Any suggestion on how to do it the smartest way?

Thanks in advice!

Offspring
04/27/2016 23:53 Mognakor#10
Can you just write a concise description what you are trying to achieve.

aka.

WHY you want to understand the function.


Assuming FlyFF is programmed properly, you should be able to simply add/remove Buffs in the functions for using/unusing the pet.
04/28/2016 09:06 Offspringfan1234#11
Maybe u could just add me on skype? I guess it's easier to explain things :)
04/28/2016 09:55 Mognakor#12
nope :)