Merge commit 'origin/master' into 310

Hope it works with live 3.1.2.9901 client
This commit is contained in:
tomrus88 2009-05-20 10:47:48 +04:00
commit ebb03b7b9f
32 changed files with 1709 additions and 2123 deletions

View file

@ -1421,8 +1421,8 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
*p_data << uint8(getLevel()); // player level
// do not use GetMap! it will spawn a new instance since the bound instances are not loaded
uint32 zoneId = MapManager::Instance().GetZoneId(GetMapId(), GetPositionX(),GetPositionY(),GetPositionZ());
sLog.outDebug("Player::BuildEnumData: m:%u, x:%f, y:%f, z:%f zone:%u", GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), zoneId);
uint32 zoneId = fields[10].GetUInt32();
sLog.outDebug("Player::BuildEnumData: map:%u, x:%f, y:%f, z:%f zone:%u", GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), zoneId);
*p_data << uint32(zoneId);
*p_data << uint32(GetMapId());
@ -1431,7 +1431,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
*p_data << GetPositionZ();
// guild id
*p_data << (result ? fields[13].GetUInt32() : 0);
*p_data << uint32(fields[14].GetUInt32());
uint32 char_flags = 0;
if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM))
@ -1444,7 +1444,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
char_flags |= CHARACTER_FLAG_RENAME;
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
{
if(!fields[14].GetCppString().empty())
if(!fields[15].GetCppString().empty())
char_flags |= CHARACTER_FLAG_DECLINED;
}
else
@ -1464,12 +1464,12 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
// show pet at selection character in character list only for non-ghost character
if (result && isAlive() && (pClass == CLASS_WARLOCK || pClass == CLASS_HUNTER || pClass == CLASS_DEATH_KNIGHT))
{
uint32 entry = fields[10].GetUInt32();
uint32 entry = fields[11].GetUInt32();
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(entry);
if(cInfo)
{
petDisplayId = fields[11].GetUInt32();
petLevel = fields[12].GetUInt32();
petDisplayId = fields[12].GetUInt32();
petLevel = fields[13].GetUInt32();
petFamily = cInfo->family;
}
}
@ -2070,11 +2070,17 @@ void Player::SetGameMaster(bool on)
setFaction(35);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
if (Pet* pet = GetPet())
{
pet->setFaction(35);
pet->getHostilRefManager().setOnlineOfflineState(false);
}
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
ResetContestedPvP();
getHostilRefManager().setOnlineOfflineState(false);
CombatStop();
CombatStopWithPets();
SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases
}
@ -2088,6 +2094,12 @@ void Player::SetGameMaster(bool on)
setFactionForRace(getRace());
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
if (Pet* pet = GetPet())
{
pet->setFaction(getFaction());
pet->getHostilRefManager().setOnlineOfflineState(true);
}
// restore FFA PvP Server state
if(sWorld.IsFFAPvPRealm())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
@ -11583,6 +11595,14 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot, bool apply, bool
sLog.outDebug("Adding %u to stat nb %u",enchant_amount,enchant_spell_id);
switch (enchant_spell_id)
{
case ITEM_MOD_MANA:
sLog.outDebug("+ %u MANA",enchant_amount);
HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, float(enchant_amount), apply);
break;
case ITEM_MOD_HEALTH:
sLog.outDebug("+ %u HEALTH",enchant_amount);
HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, float(enchant_amount), apply);
break;
case ITEM_MOD_AGILITY:
sLog.outDebug("+ %u AGILITY",enchant_amount);
HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply);
@ -13632,20 +13652,23 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u
bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
{
bool delete_result = true;
if(!result)
if (!result)
{
// 0 1 2 3 4 5 6 7 8 9
result = CharacterDatabase.PQuery("SELECT guid, data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login FROM characters WHERE guid = '%u'",guid);
if(!result) return false;
// 0 1 2 3 4 5 6 7 8 9 10
result = CharacterDatabase.PQuery("SELECT guid, data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login, zone FROM characters WHERE guid = '%u'",guid);
if (!result)
return false;
}
else delete_result = false;
else
delete_result = false;
Field *fields = result->Fetch();
if(!LoadValues( fields[1].GetString()))
if (!LoadValues( fields[1].GetString()))
{
sLog.outError("Player #%d have broken data in `data` field. Can't be loaded for character list.",GUID_LOPART(guid));
if(delete_result) delete result;
if (delete_result)
delete result;
return false;
}
@ -13668,12 +13691,13 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
_LoadBoundInstances();*/
if (delete_result) delete result;
if (delete_result)
delete result;
for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i)
m_items[i] = NULL;
if( HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) )
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
m_deathState = DEAD;
return true;