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


C++ ManagedReference::addBankCredits方法代码示例

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


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

示例1: handleWithdrawMaintanence

void VendorDataComponent::handleWithdrawMaintanence(int value) {
	ManagedReference<SceneObject*> strongParent = parent.get();
	if (strongParent == NULL || strongParent->getZoneServer() == NULL)
		return;

	ManagedReference<CreatureObject*> owner = strongParent->getZoneServer()->getObject(getOwnerId()).castTo<CreatureObject*>();
	if(owner == NULL)
		return;

	if(value > maintAmount) {
		StringIdChatParameter message("@player_structure:vendor_withdraw_fail"); // The vendor maintenance pool doesn't have %DI credits!
		message.setDI(value);
		owner->sendSystemMessage(message);
		return;
	}

	if(value <= 0) {
		owner->sendSystemMessage("@player_structure:amt_greater_than_zero"); // The amount must be greater than zero.
		return;
	}

	maintAmount -= value;
	owner->addBankCredits(value, true);

	StringIdChatParameter message("@player_structure:vendor_withdraw"); // You successfully withdraw %DI credits from the maintenance pool.
	message.setDI(value);
	owner->sendSystemMessage(message);
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:28,代码来源:VendorDataComponent.cpp

示例2: awardReward

void MissionObjectiveImplementation::awardReward() {
	Vector<ManagedReference<CreatureObject*> > players;
	PlayMusicMessage* pmm = new PlayMusicMessage("sound/music_mission_complete.snd");

	Vector3 missionEndPoint = getEndPosition();

	ManagedReference<CreatureObject*> owner = getPlayerOwner();

	ManagedReference<GroupObject*> group = owner->getGroup();

	if (group != NULL) {
		Locker lockerGroup(group, _this.get());

		for(int i = 0; i < group->getGroupSize(); i++) {
			Reference<CreatureObject*> groupMember = group->getGroupMember(i)->isPlayerCreature() ? (group->getGroupMember(i)).castTo<CreatureObject*>() : NULL;

			if (groupMember != NULL) {
				//Play mission complete sound.
				groupMember->sendMessage(pmm->clone());

				if (groupMember->getWorldPosition().distanceTo(missionEndPoint) < 128) {
					players.add(groupMember);
				}
			}
		}

		delete pmm;
	} else {
		//Play mission complete sound.
		owner->sendMessage(pmm);
		players.add(owner);
	}

	if (players.size() == 0) {
		players.add(owner);
	}

	ManagedReference<MissionObject* > mission = this->mission.get();

	int dividedReward = mission->getRewardCredits() / players.size();

	for (int i = 0; i < players.size(); i++) {
		ManagedReference<CreatureObject*> player = players.get(i);
		StringIdChatParameter stringId("mission/mission_generic", "success_w_amount");
		stringId.setDI(dividedReward);
		player->sendSystemMessage(stringId);

		Locker lockerPl(player, _this.get());
		player->addBankCredits(dividedReward, true);
	}

	StatisticsManager::instance()->completeMission(mission->getTypeCRC() ,mission->getRewardCredits());
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:53,代码来源:MissionObjectiveImplementation.cpp


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