當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetBaseReputation函數代碼示例

本文整理匯總了C++中GetBaseReputation函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetBaseReputation函數的具體用法?C++ GetBaseReputation怎麽用?C++ GetBaseReputation使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetBaseReputation函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: Initialize

void ReputationMgr::LoadFromDB(PreparedQueryResult result)
{
    // Set initial reputations (so everything is nifty before DB data load)
    Initialize();

    //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUIDLow());

    if (result)
    {
        do
        {
            Field* fields = result->Fetch();

            FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
            if (factionEntry && (factionEntry->reputationListID >= 0))
            {
                FactionState* faction = &_factions[factionEntry->reputationListID];

                // update standing to current
                faction->Standing = int32(fields[1].GetUInt32());

                // update counters
                int32 BaseRep = GetBaseReputation(factionEntry);
                ReputationRank old_rank = ReputationToRank(BaseRep);
                ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
                UpdateRankCounters(old_rank, new_rank);

                uint32 dbFactionFlags = fields[2].GetUInt16();

                if (dbFactionFlags & FACTION_FLAG_VISIBLE)
                    SetVisible(faction);                    // have internal checks for forced invisibility

                if (dbFactionFlags & FACTION_FLAG_INACTIVE)
                    SetInactive(faction, true);              // have internal checks for visibility requirement

                if (dbFactionFlags & FACTION_FLAG_AT_WAR)  // DB at war
                    SetAtWar(faction, true);                 // have internal checks for FACTION_FLAG_PEACE_FORCED
                else                                        // DB not at war
                {
                    // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN)
                    if (faction->Flags & FACTION_FLAG_VISIBLE)
                        SetAtWar(faction, false);            // have internal checks for FACTION_FLAG_PEACE_FORCED
                }

                // set atWar for hostile
                if (GetRank(factionEntry) <= REP_HOSTILE)
                    SetAtWar(faction, true);

                // reset changed flag if values similar to saved in DB
                if (faction->Flags == dbFactionFlags)
                {
                    faction->needSend = false;
                    faction->needSave = false;
                }
            }
        }
        while (result->NextRow());
    }
}
開發者ID:AwkwardDev,項目名稱:Darkcore-Rebase,代碼行數:59,代碼來源:ReputationMgr.cpp

示例2: GetBaseReputation

bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry,
		int32 standing, bool incremental) {
	FactionStateList::iterator itr = m_factions.find(
			factionEntry->reputationListID);
	if (itr != m_factions.end()) {
		int32 BaseRep = GetBaseReputation(factionEntry);

		if (incremental) {
			// int32 *= float cause one point loss?
			standing = int32(
					floor(
							(float) standing
									* sWorld->getRate(RATE_REPUTATION_GAIN)
									+ 0.5));
			standing += itr->second.Standing + BaseRep;
		}

		if (standing > Reputation_Cap)
			standing = Reputation_Cap;
		else if (standing < Reputation_Bottom)
			standing = Reputation_Bottom;

		ReputationRank old_rank = ReputationToRank(
				itr->second.Standing + BaseRep);
		ReputationRank new_rank = ReputationToRank(standing);

		itr->second.Standing = standing - BaseRep;
		itr->second.needSend = true;
		itr->second.needSave = true;

		SetVisible(&itr->second);

		if (new_rank <= REP_HOSTILE)
			SetAtWar(&itr->second, true);

		UpdateRankCounters(old_rank, new_rank);

		m_player->ReputationChanged(factionEntry);
		m_player->GetAchievementMgr().UpdateAchievementCriteria(
				ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
		m_player->GetAchievementMgr().UpdateAchievementCriteria(
				ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
		m_player->GetAchievementMgr().UpdateAchievementCriteria(
				ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION,
				factionEntry->ID);
		m_player->GetAchievementMgr().UpdateAchievementCriteria(
				ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION,
				factionEntry->ID);
		m_player->GetAchievementMgr().UpdateAchievementCriteria(
				ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION,
				factionEntry->ID);

		return true;
	}
	return false;
}
開發者ID:dsstest,項目名稱:ArkCORE,代碼行數:56,代碼來源:ReputationMgr.cpp

示例3: GetBaseReputation

int32 ReputationMgr::GetReputation(FactionEntry const* factionEntry) const
{
    if (!factionEntry)
        return 0;

    if (FactionState const* state = GetState(factionEntry))
        return GetBaseReputation(factionEntry) + state->Standing;

    return 0;
}
開發者ID:cala,項目名稱:mangos-classic,代碼行數:10,代碼來源:ReputationMgr.cpp

示例4: faction

int32 ReputationMgr::GetBaseReputation(uint32 faction_id) const
{
    FactionEntry const *factionEntry = sFactionStore.LookupEntry(faction_id);

    if (!factionEntry)
    {
        sLog.outError("ReputationMgr::GetBaseReputation: Can't get reputation of %s for unknown faction (faction id) #%u.",m_player->GetName(), faction_id);
        return 0;
    }

    return GetBaseReputation(factionEntry);
}
開發者ID:Xemp,項目名稱:server,代碼行數:12,代碼來源:ReputationMgr.cpp

示例5: GetBaseReputation

bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
{
    FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
    if (itr != m_factions.end())
    {
        FactionState &faction = itr->second;
        int32 BaseRep = GetBaseReputation(factionEntry);

        if (incremental)
            standing += faction.Standing + BaseRep;

        if (standing > Reputation_Cap)
            standing = Reputation_Cap;
        else if (standing < Reputation_Bottom)
            standing = Reputation_Bottom;

        ReputationRank old_rank = ReputationToRank(faction.Standing + BaseRep);
        ReputationRank new_rank = ReputationToRank(standing);

        faction.Standing = standing - BaseRep;
        faction.needSend = true;
        faction.needSave = true;

        SetVisible(&faction);

        if (new_rank <= REP_HOSTILE)
            SetAtWar(&faction, true);

        UpdateRankCounters(old_rank, new_rank);

        m_player->ReputationChanged(factionEntry);

        AchievementMgr &achievementManager = m_player->GetAchievementMgr();
        achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS,         factionEntry->ID);
        achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION,        factionEntry->ID);
        achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID);
        achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
        achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);

        if (new_rank > old_rank)
            return true;
    }
    return false;
}
開發者ID:mangos-wotlk,項目名稱:mangos-wotlk,代碼行數:44,代碼來源:ReputationMgr.cpp

示例6: GetBaseReputation

ReputationRank ReputationMgr::GetBaseRank(FactionEntry const* factionEntry) const
{
    int32 reputation = GetBaseReputation(factionEntry);
    return ReputationToRank(reputation);
}
開發者ID:Hlkz2,項目名稱:ACoreOld,代碼行數:5,代碼來源:ReputationMgr.cpp


注:本文中的GetBaseReputation函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。