void Player::Reputation_OnKilledUnit(Unit* pUnit, bool InnerLoop) { // add rep for on kill if ( pUnit->GetTypeId() != TYPEID_UNIT || pUnit->IsPet() || !pUnit->m_factionDBC ) return; Group * m_Group = GetGroup(); // Why would this be accessed if the group didn't exist? if ( !InnerLoop && m_Group != NULL ) { /* loop the rep for group members */ m_Group->getLock().Acquire(); GroupMembersSet::iterator it; for ( uint32 i = 0; i < m_Group->GetSubGroupCount(); i++ ) { for ( it = m_Group->GetSubGroup(i)->GetGroupMembersBegin(); it != m_Group->GetSubGroup(i)->GetGroupMembersEnd(); ++it ) { if ( (*it)->m_loggedInPlayer && (*it)->m_loggedInPlayer->isInRange( this, 100.0f ) ) (*it)->m_loggedInPlayer->Reputation_OnKilledUnit( pUnit, true ); } } m_Group->getLock().Release(); return; } uint32 team = GetTeam(); ReputationModifier * modifier = objmgr.GetReputationModifier( pUnit->GetEntry(), pUnit->m_factionDBC->ID ); if( modifier != 0 ) { // Apply this data. for( vector<ReputationMod>::iterator itr = modifier->mods.begin(); itr != modifier->mods.end(); itr++ ) { if ( !(*itr).faction[team] ) continue; /* rep limit? */ if ( !IS_INSTANCE( GetMapId() ) || ( IS_INSTANCE( GetMapId() ) && iInstanceType != MODE_5PLAYER_HEROIC) ) { if ( (*itr).replimit ) { if ( GetStanding( (*itr).faction[team] ) >= (int32)(*itr).replimit ) continue; } } ModStanding( itr->faction[team], float2int32( itr->value * sWorld.getRate( RATE_KILLREPUTATION ) ) ); } } else { if ( IS_INSTANCE( GetMapId() ) && objmgr.HandleInstanceReputationModifiers( this, pUnit ) ) return; if ( pUnit->m_factionDBC->RepListId < 0 ) return; int32 change = int32( -5.0f * sWorld.getRate( RATE_KILLREPUTATION ) ); ModStanding( pUnit->m_factionDBC->ID, change ); } }
/*************************************************************************** * PrintAll * ------------------------------------------------------------------------- * This method will print the attributes of the object * * Returns: none ***************************************************************************/ void Student::PrintAll() const { const int WIDTH = 17; cout << fixed << setprecision(2) << left; cout << "Student Information" << endl; cout << "-------------------" << endl; cout << setw(WIDTH) << "Name: " << GetName() << endl; cout << setw(WIDTH) << "ID: " << GetId() << endl; cout << setw(WIDTH) << "Number: " << GetNumber() << endl; cout << setw(WIDTH) << "Age: " << GetAge() << endl; cout << setw(WIDTH) << "Gender: " << GetGender() << endl; cout << setw(WIDTH) << "Standing: " << GetStanding()<< endl; cout << setw(WIDTH) << "GPA: " << GetGpa() << endl; cout << setw(WIDTH) << "Graduation Date: "<< GetDate() << endl; cout << right; }
Standing Player::GetStandingRank(uint32 Faction) { return Standing(GetReputationRankFromStanding(GetStanding(Faction))); }
void Player::Reputation_OnKilledUnit(Unit* pUnit, bool InnerLoop) { // add rep for on kill if(pUnit->GetTypeId() != TYPEID_UNIT || pUnit->IsPet()) return; Group * m_Group = m_playerInfo->m_Group; if(!InnerLoop && m_Group) { /* loop the rep for group members */ m_Group->getLock().Acquire(); GroupMembersSet::iterator it; for(uint32 i = 0; i < m_Group->GetSubGroupCount(); ++i) { for(it = m_Group->GetSubGroup(i)->GetGroupMembersBegin(); it != m_Group->GetSubGroup(i)->GetGroupMembersEnd(); ++it) { if((*it)->m_loggedInPlayer && (*it)->m_loggedInPlayer->isInRange(TO_PLAYER(this),100.0f)) (*it)->m_loggedInPlayer->Reputation_OnKilledUnit(pUnit, true); } } m_Group->getLock().Release(); return; } int team = GetTeam(); ReputationModifier * modifier = objmgr.GetReputationModifier(pUnit->GetEntry(), pUnit->m_factionDBC->ID); if(modifier != 0) { // Apply this data. for(vector<ReputationMod>::iterator itr = modifier->mods.begin(); itr != modifier->mods.end(); ++itr) { if(!(*itr).faction[team]) continue; /* rep limit? */ if (!IS_INSTANCE(GetMapId()) || (IS_INSTANCE(GetMapId()) && this->iInstanceType != MODE_5PLAYER_HEROIC)) { if((*itr).replimit) { if(GetStanding((*itr).faction[team]) >= (int32)(*itr).replimit) continue; } } int32 value = int32(float(itr->value) * sWorld.getRate(RATE_KILLREPUTATION)); //value *= sWorld.getRate(RATE_KILLREPUTATION); ModStanding(itr->faction[team], value); } } else { if(IS_INSTANCE(GetMapId()) && objmgr.HandleInstanceReputationModifiers(TO_PLAYER(this), pUnit)) return; if(pUnit->m_factionDBC->RepListId < 0) return; // decrease rep by 5. int change = -5; change = int32((float(change) * sWorld.getRate(RATE_KILLREPUTATION))); ModStanding(pUnit->m_factionDBC->ID, change); } }