icyman2
06-01-2009, 11:34 AM
So, I am happily camping a_misc_thing00 over the weekend, and with various other groups in the zone camping an_other_misc_thing00, I start to see things in my Spawn Point List I don't want/need/care to see. These things are auras, mounts and mercenaries. The spawn time is a little on the long side for the named I am camping, and I haven't been into SEQ code for years, so here's an excuse to start to familiarize myself again with the code.
(Great to see some smart use of Qt containers/lists, and things properly being handed around via [const] reference, etc, etc. It's looking a lot more professional/efficient than I recall years ago.) :)
So I decide that to match the current style of the classes, I should add a few is*() inline methods to Spawn. Pretty easy, not totally satisfied with my logic, but there doesn't seem to be any "low" level recognition of auras, mounts nor mercenaries. So, I filter based upon the name and class information available.
(When I mention name below, I am referring to Spawn::m_name. Class refers to Spawn::m_class.)
An aura, has "Aura" somewhere in the name, and is class 62 (an LDON Object).
A mount, has a name ending in "s_Mount00", and is level 30 (this seems to be true of any mount).
A mercenary, as far as I can tell, has a name like Bob1234 or Bob12345 (I bet this starts at 001 upon a server restart, but I will probably never be able to check this, I work fulltime, unless I experience a server crash some day). I'd prefer to detect this via some kind of bit from spawnStruct, or wherever (my low level knowledge of these structures is almost non-existant). Since it appears mobs only ever have two digits at the end of their name (ie, 00), it may be ok to filter on any name that ends in 3 or more digits. Dunno, haven't checked this out yet. It currently looks for 4 or more digits (since this is what I have personally seen).
To take advantage of these new checks in the Spawn class, I added a second if to SpawnMonitor::checkSpawnPoint(..). I could (and probably should) have combined those two ifs, as part of the first one attempts to filter on mounts. I've used it all weekend, with no auras, mounts nor mercs in my Spawn Point List, and no crashes in SEQ.
These changes were made against the latest in subversion at the time. (5.13.4.1 / revision 730)
Index: spawnmonitor.cpp
================================================== =================
--- spawnmonitor.cpp (revision 730)
+++ spawnmonitor.cpp (working copy)
@@ -231,7 +231,12 @@
// ignore everything but mobs
if ( ( spawn->NPC() != SPAWN_NPC ) || ( spawn->petOwnerID() != 0 ) || (spawn->level() == 30 && spawn->race() == 216) )
return;
-
+
+ if ( spawn->isMount() == true || spawn->isAura() == true || spawn->isMercenary() == true ){
+ seqWarn("+++ TOSSED -> mount || aura || merc -> %s", spawn->name().ascii());
+ return;
+ }
+
QString key = SpawnPoint::key( *spawn );
SpawnPoint* sp;
Index: spawn.h
================================================== =================
--- spawn.h (revision 730)
+++ spawn.h (working copy)
@@ -284,6 +284,18 @@
{ return (raceTeam() == spawn->raceTeam()); }
bool isSameDeityTeam(const Spawn* spawn) const
{ return (deityTeam() == spawn->deityTeam()); }
+ bool isMount() const {
+ // Example: Bob`s_Mount00
+ return this->m_level == 30 && this->m_name.endsWith("s_Mount00") == true;
+ }
+ bool isAura() const {
+ // Example: Aura_of_the_Zealot00
+ return this->m_class == 62 && this->m_name.contains("Aura") > 0;
+ }
+ bool isMercenary() const {
+ // Example: Bob12345
+ return this->m_name.length() > 5 && this->m_name.right(4).toUInt() > 0;
+ }
// virtual set method overload
void setPos(int16_t x, int16_t Pos, int16_t z,
(Great to see some smart use of Qt containers/lists, and things properly being handed around via [const] reference, etc, etc. It's looking a lot more professional/efficient than I recall years ago.) :)
So I decide that to match the current style of the classes, I should add a few is*() inline methods to Spawn. Pretty easy, not totally satisfied with my logic, but there doesn't seem to be any "low" level recognition of auras, mounts nor mercenaries. So, I filter based upon the name and class information available.
(When I mention name below, I am referring to Spawn::m_name. Class refers to Spawn::m_class.)
An aura, has "Aura" somewhere in the name, and is class 62 (an LDON Object).
A mount, has a name ending in "s_Mount00", and is level 30 (this seems to be true of any mount).
A mercenary, as far as I can tell, has a name like Bob1234 or Bob12345 (I bet this starts at 001 upon a server restart, but I will probably never be able to check this, I work fulltime, unless I experience a server crash some day). I'd prefer to detect this via some kind of bit from spawnStruct, or wherever (my low level knowledge of these structures is almost non-existant). Since it appears mobs only ever have two digits at the end of their name (ie, 00), it may be ok to filter on any name that ends in 3 or more digits. Dunno, haven't checked this out yet. It currently looks for 4 or more digits (since this is what I have personally seen).
To take advantage of these new checks in the Spawn class, I added a second if to SpawnMonitor::checkSpawnPoint(..). I could (and probably should) have combined those two ifs, as part of the first one attempts to filter on mounts. I've used it all weekend, with no auras, mounts nor mercs in my Spawn Point List, and no crashes in SEQ.
These changes were made against the latest in subversion at the time. (5.13.4.1 / revision 730)
Index: spawnmonitor.cpp
================================================== =================
--- spawnmonitor.cpp (revision 730)
+++ spawnmonitor.cpp (working copy)
@@ -231,7 +231,12 @@
// ignore everything but mobs
if ( ( spawn->NPC() != SPAWN_NPC ) || ( spawn->petOwnerID() != 0 ) || (spawn->level() == 30 && spawn->race() == 216) )
return;
-
+
+ if ( spawn->isMount() == true || spawn->isAura() == true || spawn->isMercenary() == true ){
+ seqWarn("+++ TOSSED -> mount || aura || merc -> %s", spawn->name().ascii());
+ return;
+ }
+
QString key = SpawnPoint::key( *spawn );
SpawnPoint* sp;
Index: spawn.h
================================================== =================
--- spawn.h (revision 730)
+++ spawn.h (working copy)
@@ -284,6 +284,18 @@
{ return (raceTeam() == spawn->raceTeam()); }
bool isSameDeityTeam(const Spawn* spawn) const
{ return (deityTeam() == spawn->deityTeam()); }
+ bool isMount() const {
+ // Example: Bob`s_Mount00
+ return this->m_level == 30 && this->m_name.endsWith("s_Mount00") == true;
+ }
+ bool isAura() const {
+ // Example: Aura_of_the_Zealot00
+ return this->m_class == 62 && this->m_name.contains("Aura") > 0;
+ }
+ bool isMercenary() const {
+ // Example: Bob12345
+ return this->m_name.length() > 5 && this->m_name.right(4).toUInt() > 0;
+ }
// virtual set method overload
void setPos(int16_t x, int16_t Pos, int16_t z,