当前位置: 首页>>代码示例>>C++>>正文


C++ CreatureObject::getLevel方法代码示例

本文整理汇总了C++中CreatureObject::getLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::getLevel方法的具体用法?C++ CreatureObject::getLevel怎么用?C++ CreatureObject::getLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CreatureObject的用法示例。


在下文中一共展示了CreatureObject::getLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calcGroupLevel

void GroupObjectImplementation::calcGroupLevel() {
	int highestPlayer = 0;
	groupLevel = 0;

	for (int i = 0; i < getGroupSize(); i++) {
		Reference<SceneObject*> member = getGroupMember(i);

		if (member->isPet()) {
			CreatureObject* creature = cast<CreatureObject*>(member.get());

			groupLevel += creature->getLevel() / 5;

		} else if (member->isPlayerCreature()) {
			CreatureObject* creature = cast<CreatureObject*>(member.get());

			int memberLevel = creature->getLevel();

			if (memberLevel > highestPlayer) {
				groupLevel += (memberLevel - highestPlayer + (highestPlayer / 5));
				highestPlayer = memberLevel;
			} else {
				groupLevel += memberLevel / 5;
			}
		}
	}

	GroupObjectDeltaMessage6* msg = new GroupObjectDeltaMessage6(_this.getReferenceUnsafeStaticCast());

	msg->updateLevel(this->groupLevel);
	msg->close();

	broadcastMessage(msg);
}
开发者ID:grtest,项目名称:testgit,代码行数:33,代码来源:GroupObjectImplementation.cpp

示例2: isAllowed

bool BuildingObject::isAllowed(CreatureObject const &who) const
{
	if (who.getMasterId() != NetworkId::cms_invalid)
	{
		ServerObject const *master = ServerWorld::findObjectByNetworkId(who.getMasterId());
		if (master && master != &who && master->asCreatureObject())
			return isAllowed(*master->asCreatureObject());
	}

	if (!playersWithAlignedEnemyFlagsAllowed() && (Pvp::hasAnyAlignedTimedEnemyFlag(who) || Pvp::hasAnyBountyDuelEnemyFlag(who)))
		return false;

	if (getIsPublic())
		return !CellPermissions::isOnList(m_banned.get(), who);
	else
	{
		// allow non-player-controlled creatures in private buildings with no owner
		if (!who.isPlayerControlled() && getOwnerId() == NetworkId::cms_invalid)
			return true;
		// allow vendor-creatures to be placed in the building
		if (who.hasCondition(static_cast<int>(ServerTangibleObjectTemplate::C_vendor)))
			return true;
		// JU_TODO: test
#if 1
		// allow non-player-controlled creatures in private buildings if the *creature* has no owner
		if (!who.isPlayerControlled() 
			&& who.getMasterId() == NetworkId::cms_invalid 
			&& who.getLevel() < 10 // temp change to < 0 after testing holo item
			)
		{
			return true;
		}
#endif
		// JU_TODO: end test
		return CellPermissions::isOnList(m_allowed.get(), who);
	}
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:37,代码来源:BuildingObject.cpp

示例3: calcGroupLevel

void GroupObjectImplementation::calcGroupLevel() {
	groupLevel = 0;

	for (int i = 0; i < getGroupSize(); i++) {
		SceneObject* member = getGroupMember(i);

		if (member->isCreatureObject()) {
			CreatureObject* creature = cast<CreatureObject*>(member);

			int currentlevel = groupLevel - getGroupSize();
			int memberlevel = creature->getLevel();

			if (memberlevel > currentlevel)
				groupLevel = memberlevel + getGroupSize();
		}
	}

	GroupObjectDeltaMessage6* msg = new GroupObjectDeltaMessage6(_this.get());

	msg->updateLevel(this->groupLevel);
	msg->close();

	broadcastMessage(msg);
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:24,代码来源:GroupObjectImplementation.cpp


注:本文中的CreatureObject::getLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。