本文整理汇总了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);
}
示例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());
}