mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[10665] Allow use faction data for cases raceMask==0
Also some related code cleanup Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
549b44d8ec
commit
3ada9f635f
3 changed files with 22 additions and 18 deletions
|
|
@ -821,6 +821,20 @@ struct FactionEntry
|
|||
// 39 string flags
|
||||
//char* description[16]; // 40-55 m_description_lang
|
||||
// 56 string flags
|
||||
|
||||
// helpers
|
||||
|
||||
int GetIndexFitTo(uint32 raceMask, uint32 classMask) const
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if ((BaseRepRaceMask[i] == 0 || (BaseRepRaceMask[i] & raceMask)) &&
|
||||
(BaseRepClassMask[i] == 0 || (BaseRepClassMask[i] & classMask)))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
struct FactionTemplateEntry
|
||||
|
|
|
|||
|
|
@ -56,16 +56,10 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
|
|||
|
||||
uint32 raceMask = m_player->getRaceMask();
|
||||
uint32 classMask = m_player->getClassMask();
|
||||
for (int i=0; i < 4; i++)
|
||||
{
|
||||
if( (factionEntry->BaseRepRaceMask[i] & raceMask) &&
|
||||
(factionEntry->BaseRepClassMask[i]==0 ||
|
||||
(factionEntry->BaseRepClassMask[i] & classMask) ) )
|
||||
return factionEntry->BaseRepValue[i];
|
||||
}
|
||||
|
||||
// in faction.dbc exist factions with (RepListId >=0, listed in character reputation list) with all BaseRepRaceMask[i]==0
|
||||
return 0;
|
||||
int idx = factionEntry->GetIndexFitTo(raceMask, classMask);
|
||||
|
||||
return idx >= 0 ? factionEntry->BaseRepValue[idx] : 0;
|
||||
}
|
||||
|
||||
int32 ReputationMgr::GetReputation(FactionEntry const* factionEntry) const
|
||||
|
|
@ -107,14 +101,10 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con
|
|||
|
||||
uint32 raceMask = m_player->getRaceMask();
|
||||
uint32 classMask = m_player->getClassMask();
|
||||
for (int i=0; i < 4; i++)
|
||||
{
|
||||
if( (factionEntry->BaseRepRaceMask[i] & raceMask) &&
|
||||
(factionEntry->BaseRepClassMask[i]==0 ||
|
||||
(factionEntry->BaseRepClassMask[i] & classMask) ) )
|
||||
return factionEntry->ReputationFlags[i];
|
||||
}
|
||||
return 0;
|
||||
|
||||
int idx = factionEntry->GetIndexFitTo(raceMask, classMask);
|
||||
|
||||
return idx >= 0 ? factionEntry->ReputationFlags[idx] : 0;
|
||||
}
|
||||
|
||||
void ReputationMgr::SendForceReactions()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10664"
|
||||
#define REVISION_NR "10665"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue