Update CharacterHandler, Channels System for 322a
--HG-- branch : trunk
This commit is contained in:
@@ -45,7 +45,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data)
|
|||||||
size_t p_counter = data.wpos();
|
size_t p_counter = data.wpos();
|
||||||
data << uint32(counter); // instance save count
|
data << uint32(counter); // instance save count
|
||||||
|
|
||||||
for (int i = 0; i < TOTAL_DIFFICULTIES; ++i)
|
for (int i = 0; i < MAX_DIFFICULTY; ++i)
|
||||||
{
|
{
|
||||||
for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
|
for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-11
@@ -298,6 +298,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
|
|||||||
banned.insert(bad->GetGUID());
|
banned.insert(bad->GetGUID());
|
||||||
MakePlayerBanned(&data, bad->GetGUID(), good);
|
MakePlayerBanned(&data, bad->GetGUID(), good);
|
||||||
_UpdateBanListInDB();
|
_UpdateBanListInDB();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
MakePlayerKicked(&data, bad->GetGUID(), good);
|
MakePlayerKicked(&data, bad->GetGUID(), good);
|
||||||
@@ -351,6 +352,7 @@ void Channel::UnBan(uint64 good, const char *badname)
|
|||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
MakePlayerUnbanned(&data, bad->GetGUID(), good);
|
MakePlayerUnbanned(&data, bad->GetGUID(), good);
|
||||||
SendToAll(&data);
|
SendToAll(&data);
|
||||||
|
//save banlist
|
||||||
_UpdateBanListInDB();
|
_UpdateBanListInDB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,6 +594,7 @@ void Channel::Announce(uint64 p)
|
|||||||
SendToAll(&data);
|
SendToAll(&data);
|
||||||
if (m_IsSaved && _UpdateIntInDB("m_announce", m_announce ? 1 : 0))
|
if (m_IsSaved && _UpdateIntInDB("m_announce", m_announce ? 1 : 0))
|
||||||
sLog.outDebug("Channel(%s) announce saved", m_name.c_str());
|
sLog.outDebug("Channel(%s) announce saved", m_name.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -624,8 +627,8 @@ void Channel::Moderate(uint64 p)
|
|||||||
else
|
else
|
||||||
MakeModerationOff(&data, p);
|
MakeModerationOff(&data, p);
|
||||||
SendToAll(&data);
|
SendToAll(&data);
|
||||||
if (m_IsSaved && _UpdateIntInDB("m_moderate", m_moderate ? 1 : 0))
|
if (m_IsSaved && _UpdateIntInDB("m_announce", m_announce ? 1 : 0))
|
||||||
sLog.outDebug("Channel(%s) moderate saved", m_name.c_str());
|
sLog.outDebug("Channel(%s) announce saved", m_name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,15 +757,8 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
|
|||||||
MakeOwnerChanged(&data, m_ownerGUID);
|
MakeOwnerChanged(&data, m_ownerGUID);
|
||||||
SendToAll(&data);
|
SendToAll(&data);
|
||||||
}
|
}
|
||||||
/*if(m_IsSaved)
|
if (m_IsSaved && _UpdateIntInDB("m_moderate", m_moderate ? 1 : 0))
|
||||||
{
|
sLog.outDebug("Channel(%s) moderate saved", m_name.c_str());
|
||||||
std::ostringstream ss;
|
|
||||||
ss << "UPDATE channels SET m_ownerGUID = '" << guid << "' WHERE m_name = '"<<m_name.c_str()<<"' AND m_team = '"<<m_Team<<"'";
|
|
||||||
if(CharacterDatabase.PExecute( ss.str( ).c_str( ) ))
|
|
||||||
{
|
|
||||||
sLog.outDebug("Channel(%s) owner saved", m_name.c_str());
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ bool LoginQueryHolder::Initialize()
|
|||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid));
|
||||||
// in other case still be dummy query
|
// in other case still be dummy query
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, wons_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid));
|
||||||
@@ -102,6 +102,7 @@ bool LoginQueryHolder::Initialize()
|
|||||||
// instead pass an account id to this handler
|
// instead pass an account id to this handler
|
||||||
class CharacterHandler
|
class CharacterHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void HandleCharEnumCallback(QueryResult * result, uint32 account)
|
void HandleCharEnumCallback(QueryResult * result, uint32 account)
|
||||||
{
|
{
|
||||||
@@ -229,19 +230,19 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prevent character creating Expansion race without Expansion account
|
// prevent character creating Expansion race without Expansion account
|
||||||
if (raceEntry->addon > Expansion())
|
if (raceEntry->expansion > Expansion())
|
||||||
{
|
{
|
||||||
data << (uint8)CHAR_CREATE_EXPANSION;
|
data << (uint8)CHAR_CREATE_EXPANSION;
|
||||||
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)",Expansion(),GetAccountId(),raceEntry->addon,race_);
|
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)",Expansion(),GetAccountId(),raceEntry->expansion,race_);
|
||||||
SendPacket( &data );
|
SendPacket( &data );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent character creating Expansion class without Expansion account
|
// prevent character creating Expansion class without Expansion account
|
||||||
if (classEntry->addon > Expansion())
|
if (classEntry->expansion > Expansion())
|
||||||
{
|
{
|
||||||
data << (uint8)CHAR_CREATE_EXPANSION_CLASS;
|
data << (uint8)CHAR_CREATE_EXPANSION_CLASS;
|
||||||
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)",Expansion(),GetAccountId(),classEntry->addon,class_);
|
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)",Expansion(),GetAccountId(),classEntry->expansion,class_);
|
||||||
SendPacket( &data );
|
SendPacket( &data );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -437,13 +438,8 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||||||
|
|
||||||
// extract other data required for player creating
|
// extract other data required for player creating
|
||||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
|
uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
|
||||||
recv_data >> gender;
|
recv_data >> gender >> skin >> face;
|
||||||
recv_data >> skin;
|
recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
|
||||||
recv_data >> face;
|
|
||||||
recv_data >> hairStyle;
|
|
||||||
recv_data >> hairColor;
|
|
||||||
recv_data >> facialHair;
|
|
||||||
recv_data >> outfitId;
|
|
||||||
|
|
||||||
if(recv_data.rpos() < recv_data.wpos())
|
if(recv_data.rpos() < recv_data.wpos())
|
||||||
{
|
{
|
||||||
@@ -604,7 +600,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|||||||
|
|
||||||
// load player specific part before send times
|
// load player specific part before send times
|
||||||
LoadAccountData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA),PER_CHARACTER_CACHE_MASK);
|
LoadAccountData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA),PER_CHARACTER_CACHE_MASK);
|
||||||
SendAccountDataTimes();
|
SendAccountDataTimes(PER_CHARACTER_CACHE_MASK);
|
||||||
|
|
||||||
data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0
|
data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0
|
||||||
data << uint8(2); // unknown value
|
data << uint8(2); // unknown value
|
||||||
@@ -649,11 +645,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|||||||
DEBUG_LOG( "WORLD: Sent server info" );
|
DEBUG_LOG( "WORLD: Sent server info" );
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4);
|
|
||||||
data << uint32(0);
|
|
||||||
data << uint32(0);
|
|
||||||
SendPacket(&data);
|
|
||||||
|
|
||||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
|
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
|
||||||
QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
|
QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
|
||||||
|
|
||||||
@@ -701,6 +692,11 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4);
|
||||||
|
data << uint32(0);
|
||||||
|
data << uint32(0);
|
||||||
|
SendPacket(&data);
|
||||||
|
|
||||||
if(!pCurrChar->isAlive())
|
if(!pCurrChar->isAlive())
|
||||||
pCurrChar->SendCorpseReclaimDelay(true);
|
pCurrChar->SendCorpseReclaimDelay(true);
|
||||||
|
|
||||||
@@ -1102,8 +1098,8 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
|
|||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_ALTER_APPEARANCE");
|
sLog.outDebug("CMSG_ALTER_APPEARANCE");
|
||||||
|
|
||||||
uint32 Hair, Color, FacialHair;
|
uint32 Hair, Color, FacialHair, SkinColor;
|
||||||
recv_data >> Hair >> Color >> FacialHair;
|
recv_data >> Hair >> Color >> FacialHair >> SkinColor;
|
||||||
|
|
||||||
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
|
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
|
||||||
|
|
||||||
@@ -1115,7 +1111,12 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
|
|||||||
if(!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
|
if(!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id);
|
BarberShopStyleEntry const* bs_skinColor = sBarberShopStyleStore.LookupEntry(SkinColor);
|
||||||
|
|
||||||
|
if( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
|
||||||
|
|
||||||
// 0 - ok
|
// 0 - ok
|
||||||
// 1,3 - not enough money
|
// 1,3 - not enough money
|
||||||
@@ -1140,6 +1141,8 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
|
|||||||
_player->SetByteValue(PLAYER_BYTES, 2, uint8(bs_hair->hair_id));
|
_player->SetByteValue(PLAYER_BYTES, 2, uint8(bs_hair->hair_id));
|
||||||
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
|
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
|
||||||
_player->SetByteValue(PLAYER_BYTES_2, 0, uint8(bs_facialHair->hair_id));
|
_player->SetByteValue(PLAYER_BYTES_2, 0, uint8(bs_facialHair->hair_id));
|
||||||
|
if (bs_skinColor)
|
||||||
|
_player->SetByteValue(PLAYER_BYTES, 0, uint8(bs_skinColor->hair_id));
|
||||||
|
|
||||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1);
|
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user