Jump to content

Alex/AT

Members
  • Posts

    2
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Everything posted by Alex/AT

  1. Instance renumbering routine requires some cleanup to work properly. Currently it can left over some instance IDs causing them to reapper in DB each time server is run and sometimes leads to wrong instance associations for corpses and/or characters. The patch is here: Index: trunk/src/game/ObjectMgr.cpp =================================================================== --- trunk/src/game/ObjectMgr.cpp (revision 5732) +++ trunk/src/game/ObjectMgr.cpp (working copy) @@ -4860,8 +4860,21 @@ delete result; } + // corpse + result = CharacterDatabase.PQuery("SELECT DISTINCT(instance) FROM corpse WHERE instance <> 0"); + if( result ) + { + do + { + Field *fields = result->Fetch(); + InstanceSet.insert(fields[0].GetUInt32()); + } + while (result->NextRow()); + delete result; + } + // character_instance - result = CharacterDatabase.PQuery("SELECT DISTINCT(instance) FROM character_instance"); + result = CharacterDatabase.PQuery("SELECT DISTINCT(instance) FROM character_instance WHERE instance <> 0"); if( result ) { do @@ -4874,7 +4887,7 @@ } // instance - result = CharacterDatabase.PQuery("SELECT id FROM instance"); + result = CharacterDatabase.PQuery("SELECT id FROM instance WHERE id <> 0"); if( result ) { do @@ -4890,7 +4903,7 @@ // instances considered valid: // 1) reset time > current time // 2) bound to at least one character (id is found in character_instance table) - result = CharacterDatabase.PQuery("SELECT DISTINCT(instance.id) AS id FROM instance LEFT JOIN character_instance ON (character_instance.instance = instance.id) WHERE (instance.id = character_instance.instance) AND (instance.resettime > " I64FMTD ")", (uint64)time(NULL)); + result = CharacterDatabase.PQuery("SELECT DISTINCT(instance.id) AS id FROM instance INNER JOIN character_instance ON (character_instance.instance = instance.id) WHERE (instance.id = character_instance.instance) AND (instance.resettime > " I64FMTD ")", (uint64)time(NULL)); if( result ) { do @@ -4917,6 +4930,7 @@ WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE instance = '%u'", *i); WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'", *i); CharacterDatabase.PExecute("DELETE FROM corpse WHERE instance = '%u'", *i); + CharacterDatabase.PExecute("DELETE FROM character_instance WHERE instance = '%u'", *i); CharacterDatabase.PExecute("DELETE FROM instance WHERE id = '%u'", *i); bar.step();
  2. Unit.cpp contains small mistake which can cause wrong object typization and calls to non-existent methods when the object is player and it has no group. Look: if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) will fail if unit is not TYPEID_PLAYER or if it has no group. In both cases it goes to else, and then: if(((Creature*)this)->isPet()) executes. When unit is TYPEID_PLAYER without group, it is (Player*) and has no isPet function. Calls to nowhere are surely bad Fix here [4692+]: --- src/game/Unit.cpp 2008-04-27 12:40:49.000000000 +0400 +++ src/game/Unit.cpp 2008-04-27 20:52:05.000000000 +0400 @@ -6193,8 +6193,11 @@ { SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9014,8 +9020,11 @@ SetUInt32Value(UNIT_FIELD_HEALTH, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9033,8 +9042,11 @@ SetUInt32Value(UNIT_FIELD_MAXHEALTH, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9058,8 +9070,11 @@ SetStatInt32Value(UNIT_FIELD_POWER1 + power, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9077,8 +9092,11 @@ SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + power, val); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9098,8 +9116,11 @@ ApplyModUInt32Value(UNIT_FIELD_POWER1+power, val, apply); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this); @@ -9116,8 +9137,11 @@ ApplyModUInt32Value(UNIT_FIELD_MAXPOWER1+power, val, apply); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if (GetTypeId() == TYPEID_PLAYER) + { + if (((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); + } else if(((Creature*)this)->isPet()) { Pet *pet = ((Pet*)this);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use