• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetBaseReputation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetBitmap函数代码示例发布时间:2022-05-30
下一篇:
C++ GetBase函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap