Merge branch 'master' of git@github.com:mangos/mangos into procflag

This commit is contained in:
DiSlord 2008-12-28 00:41:47 +03:00
commit fd5a994659
6 changed files with 44 additions and 49 deletions

View file

@ -171,7 +171,7 @@ void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/
if(!at) if(!at)
return; return;
if(_player->GetArenaTeamIdFromDB(_player->GetGUIDLow(), at->GetType())) if(_player->GetArenaTeamId(at->GetType()))
{ {
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size
return; return;

View file

@ -3521,27 +3521,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
} }
// remove from arena teams // remove from arena teams
uint32 at_id = GetArenaTeamIdFromDB(playerguid,ARENA_TEAM_2v2); LeaveAllArenaTeams(playerguid);
if(at_id != 0)
{
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
if(at)
at->DelMember(playerguid);
}
at_id = GetArenaTeamIdFromDB(playerguid,ARENA_TEAM_3v3);
if(at_id != 0)
{
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
if(at)
at->DelMember(playerguid);
}
at_id = GetArenaTeamIdFromDB(playerguid,ARENA_TEAM_5v5);
if(at_id != 0)
{
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
if(at)
at->DelMember(playerguid);
}
// the player was uninvited already on logout so just remove from group // the player was uninvited already on logout so just remove from group
QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid); QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
@ -6145,24 +6125,18 @@ void Player::ModifyArenaPoints( int32 value )
uint32 Player::GetGuildIdFromDB(uint64 guid) uint32 Player::GetGuildIdFromDB(uint64 guid)
{ {
std::ostringstream ss; QueryResult* result = CharacterDatabase.PQuery("SELECT guildid FROM guild_member WHERE guid='%u'", GUID_LOPART(guid));
ss<<"SELECT guildid FROM guild_member WHERE guid='"<<guid<<"'"; if(!result)
QueryResult *result = CharacterDatabase.Query( ss.str().c_str() );
if( result )
{
uint32 v = result->Fetch()[0].GetUInt32();
delete result;
return v;
}
else
return 0; return 0;
uint32 id = result->Fetch()[0].GetUInt32();
delete result;
return id;
} }
uint32 Player::GetRankFromDB(uint64 guid) uint32 Player::GetRankFromDB(uint64 guid)
{ {
std::ostringstream ss; QueryResult *result = CharacterDatabase.PQuery( "SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid) );
ss<<"SELECT rank FROM guild_member WHERE guid='"<<guid<<"'";
QueryResult *result = CharacterDatabase.Query( ss.str().c_str() );
if( result ) if( result )
{ {
uint32 v = result->Fetch()[0].GetUInt32(); uint32 v = result->Fetch()[0].GetUInt32();
@ -6186,10 +6160,8 @@ uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
uint32 Player::GetZoneIdFromDB(uint64 guid) uint32 Player::GetZoneIdFromDB(uint64 guid)
{ {
std::ostringstream ss; uint32 guidLow = GUID_LOPART(guid);
QueryResult *result = CharacterDatabase.PQuery( "SELECT zone FROM characters WHERE guid='%u'", guidLow );
ss<<"SELECT zone FROM characters WHERE guid='"<<GUID_LOPART(guid)<<"'";
QueryResult *result = CharacterDatabase.Query( ss.str().c_str() );
if (!result) if (!result)
return 0; return 0;
Field* fields = result->Fetch(); Field* fields = result->Fetch();
@ -6199,22 +6171,18 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
if (!zone) if (!zone)
{ {
// stored zone is zero, use generic and slow zone detection // stored zone is zero, use generic and slow zone detection
ss.str(""); result = CharacterDatabase.PQuery("SELECT map,position_x,position_y FROM characters WHERE guid='%u'", guidLow);
ss<<"SELECT map,position_x,position_y FROM characters WHERE guid='"<<GUID_LOPART(guid)<<"'";
result = CharacterDatabase.Query(ss.str().c_str());
if( !result ) if( !result )
return 0; return 0;
fields = result->Fetch(); fields = result->Fetch();
uint32 map = fields[0].GetUInt32(); uint32 map = fields[0].GetUInt32();
float posx = fields[1].GetFloat(); float posx = fields[1].GetFloat();
float posy = fields[2].GetFloat(); float posy = fields[2].GetFloat();
delete result; delete result;
zone = MapManager::Instance().GetZoneId(map,posx,posy); zone = MapManager::Instance().GetZoneId(map,posx,posy);
ss.str(""); CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow);
ss << "UPDATE characters SET zone='"<<zone<<"' WHERE guid='"<<GUID_LOPART(guid)<<"'";
CharacterDatabase.Execute(ss.str().c_str());
} }
return zone; return zone;
@ -16629,6 +16597,27 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
} }
void Player::LeaveAllArenaTeams(uint64 guid)
{
QueryResult *result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u'", GUID_LOPART(guid));
if(!result)
return;
do
{
Field *fields = result->Fetch();
uint32 at_id = fields[0].GetUInt32();
if(at_id != 0)
{
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
if(at)
at->DelMember(guid);
}
} while (result->NextRow());
delete result;
}
void Player::SetRestBonus (float rest_bonus_new) void Player::SetRestBonus (float rest_bonus_new)
{ {
// Prevent resting on max level // Prevent resting on max level

View file

@ -1598,6 +1598,7 @@ class MANGOS_DLL_SPEC Player : public Unit
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; } void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; } uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }
static void LeaveAllArenaTeams(uint64 guid);
void SetDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; } void SetDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
uint8 GetDifficulty() { return m_dungeonDifficulty; } uint8 GetDifficulty() { return m_dungeonDifficulty; }

View file

@ -1204,7 +1204,10 @@ void Aura::HandleAddModifier(bool apply, bool Real)
{ {
case 17941: // Shadow Trance case 17941: // Shadow Trance
case 22008: // Netherwind Focus case 22008: // Netherwind Focus
case 31834: // Light's Grace
case 34754: // Clearcasting
case 34936: // Backlash case 34936: // Backlash
case 48108: // Hot Streak
m_procCharges = 1; m_procCharges = 1;
break; break;
} }

View file

@ -1750,8 +1750,10 @@ void SpellMgr::LoadSpellLearnSpells()
if(!sSpellStore.LookupEntry(dbc_node.spell)) if(!sSpellStore.LookupEntry(dbc_node.spell))
continue; continue;
// talent or passive spells or skill-step spells auto-casted, other required explicit dependent learning // talent or passive spells or skill-step spells auto-casted and not need dependent learning,
dbc_node.autoLearned = GetTalentSpellCost(spell) > 0 || IsPassiveSpell(spell) || IsSpellHaveEffect(entry,SPELL_EFFECT_SKILL_STEP); // pet teaching spells don't must be dependent learning (casted)
// other required explicit dependent learning
dbc_node.autoLearned = entry->EffectImplicitTargetA[i]==TARGET_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(spell) || IsSpellHaveEffect(entry,SPELL_EFFECT_SKILL_STEP);
SpellLearnSpellMap::const_iterator db_node_begin = GetBeginSpellLearnSpell(spell); SpellLearnSpellMap::const_iterator db_node_begin = GetBeginSpellLearnSpell(spell);
SpellLearnSpellMap::const_iterator db_node_end = GetEndSpellLearnSpell(spell); SpellLearnSpellMap::const_iterator db_node_end = GetEndSpellLearnSpell(spell);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "6953" #define REVISION_NR "6957"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__