mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Enable creation of both faction charaters on PvP realms.
This commit is contained in:
parent
d24461e300
commit
3b67be525d
1 changed files with 44 additions and 44 deletions
|
|
@ -69,13 +69,13 @@ bool LoginQueryHolder::Initialize()
|
|||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid), (uint64)time(NULL));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
|
||||
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
|
||||
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, wons_season, personal_rating FROM arena_team_member WHERE guid='%u'", GUID_LOPART(m_guid));
|
||||
|
|
@ -131,7 +131,7 @@ void WorldSession::HandleCharEnum(QueryResult * result)
|
|||
do
|
||||
{
|
||||
uint32 guidlow = (*result)[0].GetUInt32();
|
||||
sLog.outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId());
|
||||
sLog.outDetail("Loading char guid %u from account %u.", guidlow, GetAccountId());
|
||||
if(Player::BuildEnumData(result, &data))
|
||||
++num;
|
||||
}
|
||||
|
|
@ -172,20 +172,20 @@ void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ )
|
|||
"LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid "
|
||||
"LEFT JOIN guild_member ON characters.guid = guild_member.guid "
|
||||
"WHERE characters.account = '%u' ORDER BY characters.guid",
|
||||
PET_SAVE_AS_CURRENT,GetAccountId());
|
||||
PET_SAVE_AS_CURRENT, GetAccountId());
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,1+1+1+1+1+1+1+1+1+1);
|
||||
CHECK_PACKET_SIZE(recv_data, 1+1+1+1+1+1+1+1+1+1);
|
||||
|
||||
std::string name;
|
||||
uint8 race_,class_;
|
||||
uint8 race_, class_;
|
||||
|
||||
recv_data >> name;
|
||||
|
||||
// recheck with known string size
|
||||
CHECK_PACKET_SIZE(recv_data,(name.size()+1)+1+1+1+1+1+1+1+1+1);
|
||||
CHECK_PACKET_SIZE(recv_data, (name.size()+1)+1+1+1+1+1+1+1+1+1);
|
||||
|
||||
recv_data >> race_;
|
||||
recv_data >> class_;
|
||||
|
|
@ -201,8 +201,8 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
uint32 team = Player::TeamForRace(race_);
|
||||
switch(team)
|
||||
{
|
||||
case ALLIANCE: disabled = mask & (1<<0); break;
|
||||
case HORDE: disabled = mask & (1<<1); break;
|
||||
case ALLIANCE: disabled = mask & (1 << 0); break;
|
||||
case HORDE: disabled = mask & (1 << 1); break;
|
||||
}
|
||||
|
||||
if(disabled)
|
||||
|
|
@ -229,7 +229,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
if (raceEntry->expansion > Expansion())
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_EXPANSION;
|
||||
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)",Expansion(),GetAccountId(),raceEntry->expansion,race_);
|
||||
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
|
||||
SendPacket( &data );
|
||||
return;
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
if (classEntry->expansion > Expansion())
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_EXPANSION_CLASS;
|
||||
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)",Expansion(),GetAccountId(),classEntry->expansion,class_);
|
||||
sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_);
|
||||
SendPacket( &data );
|
||||
return;
|
||||
}
|
||||
|
|
@ -248,12 +248,12 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
data << (uint8)CHAR_NAME_NO_NAME;
|
||||
SendPacket( &data );
|
||||
sLog.outError("Account:[%d] but tried to Create character with empty [name] ",GetAccountId());
|
||||
sLog.outError("Account:[%d] but tried to Create character with empty [name]", GetAccountId());
|
||||
return;
|
||||
}
|
||||
|
||||
// check name limitations
|
||||
uint8 res = ObjectMgr::CheckPlayerName(name,true);
|
||||
uint8 res = ObjectMgr::CheckPlayerName(name, true);
|
||||
if (res != CHAR_NAME_SUCCESS)
|
||||
{
|
||||
data << uint8(res);
|
||||
|
|
@ -294,7 +294,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
uint8 charcount = 0;
|
||||
if ( result )
|
||||
{
|
||||
Field *fields=result->Fetch();
|
||||
Field *fields = result->Fetch();
|
||||
charcount = fields[0].GetUInt8();
|
||||
delete result;
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
|
||||
// speedup check for heroic class disabled case
|
||||
uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
|
||||
if(heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
if(heroic_free_slots == 0 && GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
|
||||
SendPacket( &data );
|
||||
|
|
@ -317,14 +317,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
|
||||
// speedup check for heroic class disabled case
|
||||
uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING);
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
|
||||
SendPacket( &data );
|
||||
return;
|
||||
}
|
||||
|
||||
bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER;
|
||||
bool AllowTwoSideAccounts = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER;
|
||||
uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS);
|
||||
|
||||
bool have_same_race = false;
|
||||
|
|
@ -343,7 +343,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
Field* field = result2->Fetch();
|
||||
uint8 acc_race = field[1].GetUInt32();
|
||||
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
uint8 acc_class = field[2].GetUInt32();
|
||||
if(acc_class == CLASS_DEATH_KNIGHT)
|
||||
|
|
@ -351,7 +351,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
if(heroic_free_slots > 0)
|
||||
--heroic_free_slots;
|
||||
|
||||
if(heroic_free_slots==0)
|
||||
if(heroic_free_slots == 0)
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
|
||||
SendPacket( &data );
|
||||
|
|
@ -371,7 +371,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
// TODO: what to if account already has characters of both races?
|
||||
if (!AllowTwoSideAccounts)
|
||||
{
|
||||
uint32 acc_team=0;
|
||||
uint32 acc_team = 0;
|
||||
if(acc_race > 0)
|
||||
acc_team = Player::TeamForRace(acc_race);
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
if(!have_same_race)
|
||||
have_same_race = race_ == acc_race;
|
||||
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
uint8 acc_class = field[2].GetUInt32();
|
||||
if(acc_class == CLASS_DEATH_KNIGHT)
|
||||
|
|
@ -405,7 +405,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
if(heroic_free_slots > 0)
|
||||
--heroic_free_slots;
|
||||
|
||||
if(heroic_free_slots==0)
|
||||
if(heroic_free_slots == 0)
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
|
||||
SendPacket( &data );
|
||||
|
|
@ -425,7 +425,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
|
||||
if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
|
||||
SendPacket( &data );
|
||||
|
|
@ -437,7 +437,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
recv_data >> gender >> skin >> face;
|
||||
recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
|
||||
|
||||
Player * pNewChar = new Player(this);
|
||||
Player *pNewChar = new Player(this);
|
||||
if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
|
||||
{
|
||||
// Player not create (race/class problem?)
|
||||
|
|
@ -454,7 +454,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
|
||||
// Player created, save it now
|
||||
pNewChar->SaveToDB();
|
||||
charcount+=1;
|
||||
charcount += 1;
|
||||
|
||||
loginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", GetAccountId(), realmID);
|
||||
loginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID);
|
||||
|
|
@ -465,13 +465,13 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
SendPacket( &data );
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
|
||||
sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
|
||||
sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]", GetAccountId(), IP_str.c_str(), name.c_str());
|
||||
sLog.outChar("Account: %d (IP: %s) Create Character:[%s]", GetAccountId(), IP_str.c_str(), name.c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8);
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
|
@ -515,13 +515,13 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog.outBasic("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
|
||||
sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
|
||||
sLog.outBasic("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
|
||||
sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
|
||||
|
||||
if(sLog.IsOutCharDump()) // optimize GetPlayerDump call
|
||||
{
|
||||
std::string dump = PlayerDumpWriter().GetDump(GUID_LOPART(guid));
|
||||
sLog.outCharDump(dump.c_str(),GetAccountId(),GUID_LOPART(guid),name.c_str());
|
||||
sLog.outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
|
||||
}
|
||||
|
||||
Player::DeleteFromDB(guid, GetAccountId());
|
||||
|
|
@ -533,11 +533,11 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8);
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
if(PlayerLoading() || GetPlayer() != NULL)
|
||||
{
|
||||
sLog.outError("Player tryes to login again, AccountId = %d",GetAccountId());
|
||||
sLog.outError("Player tryes to login again, AccountId = %d", GetAccountId());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -559,11 +559,11 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
|
|||
CharacterDatabase.DelayQueryHolder(&chrHandler, &CharacterHandler::HandlePlayerLoginCallback, holder);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
||||
void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
||||
{
|
||||
uint64 playerGuid = holder->GetGuid();
|
||||
|
||||
Player* pCurrChar = new Player(this);
|
||||
Player *pCurrChar = new Player(this);
|
||||
pCurrChar->GetMotionMaster()->Initialize();
|
||||
|
||||
// "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
|
||||
|
|
@ -614,13 +614,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|||
{
|
||||
if (nextpos != pos)
|
||||
{
|
||||
data << str_motd.substr(pos,nextpos-pos);
|
||||
data << str_motd.substr(pos, nextpos-pos);
|
||||
++linecount;
|
||||
}
|
||||
pos = nextpos+1;
|
||||
pos = nextpos + 1;
|
||||
}
|
||||
|
||||
if (pos<str_motd.length())
|
||||
if (pos < str_motd.length())
|
||||
{
|
||||
data << str_motd.substr(pos);
|
||||
++linecount;
|
||||
|
|
@ -834,7 +834,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)",
|
||||
GetAccountId(),IP_str.c_str(),pCurrChar->GetName() ,pCurrChar->GetGUIDLow());
|
||||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow());
|
||||
|
||||
if(!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
|
||||
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
|
@ -845,7 +845,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
|||
|
||||
void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4+1);
|
||||
CHECK_PACKET_SIZE(recv_data, 4+1);
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_SET_FACTION_ATWAR" );
|
||||
|
||||
|
|
@ -855,7 +855,7 @@ void WorldSession::HandleSetFactionAtWar( WorldPacket & recv_data )
|
|||
recv_data >> repListID;
|
||||
recv_data >> flag;
|
||||
|
||||
GetPlayer()->GetReputationMgr().SetAtWar(repListID,flag);
|
||||
GetPlayer()->GetReputationMgr().SetAtWar(repListID, flag);
|
||||
}
|
||||
|
||||
//I think this function is never used :/ I dunno, but i guess this opcode not exists
|
||||
|
|
@ -895,7 +895,7 @@ void WorldSession::HandleMeetingStoneInfo( WorldPacket & /*recv_data*/ )
|
|||
|
||||
void WorldSession::HandleTutorialFlag( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4);
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 iFlag;
|
||||
recv_data >> iFlag;
|
||||
|
|
@ -929,7 +929,7 @@ void WorldSession::HandleTutorialReset( WorldPacket & /*recv_data*/ )
|
|||
|
||||
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4);
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
DEBUG_LOG("WORLD: Received CMSG_SET_WATCHED_FACTION");
|
||||
uint32 fact;
|
||||
|
|
@ -939,7 +939,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data)
|
|||
|
||||
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4+1);
|
||||
CHECK_PACKET_SIZE(recv_data, 4+1);
|
||||
|
||||
DEBUG_LOG("WORLD: Received CMSG_SET_FACTION_INACTIVE");
|
||||
uint32 replistid;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue