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


C++ Bank::getCredits方法代码示例

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


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

示例1: missionComplete

void MissionManager::missionComplete(PlayerObject* player, MissionObject* mission)
{
	wchar_t sm[100];
	swprintf(sm,100, L"","mission/mission_generic",L"success_w_amount",mission->getReward());
	gMessageLib->sendSystemMessage(player,sm);

	//remove mission
	gMessageLib->sendSetWaypointActiveStatus(mission->getWaypoint(),false,player);
	gMessageLib->sendDestroyObject(mission->getId(),player);

	//Give the player the credit reward
	gMessageLib->sendPlayMusicMessage(2501,player); //sound/music_mission_complete.snd
	gMessageLib->sendMissionComplete(player);
	Bank* bank = dynamic_cast<Bank*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Bank));
	bank->setCredits(bank->getCredits() + mission->getReward());
	gTreasuryManager->saveAndUpdateBankCredits(player);

return;
}
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:19,代码来源:MissionManager.cpp

示例2: handleUIEvent

void InsuranceTerminal::handleUIEvent(uint32 action,int32 element,string inputStr,UIWindow* window)
{
	// gLogger->logMsgF("InsuranceTerminal::handleUIEvent You are here!",MSG_NORMAL);

	if(window == NULL)
	{
		return;
	}

	PlayerObject* playerObject = window->getOwner(); // window owner

	if(playerObject == NULL || !playerObject->isConnected() || playerObject->getSamplingState() || playerObject->isIncapacitated() || playerObject->isDead()|| playerObject->checkState(CreatureState_Combat))
	{
		return;
	}

	switch(window->getWindowType())
	{
		case SUI_Window_Insurance_Newbie_MessageBox:		// Tried to insure item when still having free rounds left.
		{
			switch(action)
			{
				case 0: // Yes
				{
					// Player selected to continue with insurance of item even if no need for.
					// gLogger->logMsgF("SUI_Window_Insurance_Newbie_MessageBox Yes",MSG_NORMAL);

					// Build the items list and optional use error-messages if needed.
					BStringVector insuranceList;
					this->getUninsuredItems(playerObject, &insuranceList);
					
					// We should display all uninsured items that can be insured, and that are wearing or carrying in our inventory.
					// Items in backpackage or in other containers within our inventory shall also be handled.
					gUIManager->createNewListBox(this,"insure","@sui:mnu_insure","Select an item to insure.",insuranceList,playerObject,SUI_Window_Insurance_ListBox, SUI_MB_OKCANCEL);
				}
				break;

				case 1: // No
				{
					// Player selected to abort, since all items are still treated as insured.
					// gLogger->logMsgF("SUI_Window_Insurance_Newbie_MessageBox No",MSG_NORMAL);
				}
				break;

				default:
				{
					gLogger->logMsgF("SUI_Window_Insurance_Newbie_MessageBox Invalid selection!",MSG_NORMAL);
				}
				break;
			}
		}
		break;

		case SUI_Window_Insurance_ListBox:
		{
			switch (action)
			{
				case 0: // OK
				{
					// Insure one item.
					// gLogger->logMsgF("SUI_Window_Insurance_ListBox OK",MSG_NORMAL);
					
					Inventory* inventoryObject = dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory)); 
					Bank* bankObject = dynamic_cast<Bank*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Bank));

					if(!inventoryObject || !bankObject)
						return;

					int32 creditsInInventory = inventoryObject->getCredits();
					int32 creditsAtBank = bankObject->getCredits();

					if (mSortedInsuranceList.size() ==  0)
					{
						// You have no insurable items.
						gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "no_insurables");
					}
					else if (element > (int32)mSortedInsuranceList.size() - 1 || element < 0)
					{
						// Unable to process insure item request.
						gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "bad_insure_request");
					}
					else
					{
						string selectedItemm((mSortedInsuranceList.at(element).first).getAnsi());
						selectedItemm.convert(BSTRType_Unicode16);

						Object* object = gWorldManager->getObjectById(mSortedInsuranceList.at(element).second);
						if (!object)
						{
							// Invalid object.
							// Insure attempt failed.
							gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "insure_fail");
							break;
						}
						TangibleObject* tangibleObject = dynamic_cast<TangibleObject*>(object);
						if (!tangibleObject)
						{
							// Not a tangible object.
							// Insure attempt failed.
							gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "insure_fail");
//.........这里部分代码省略.........
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:101,代码来源:InsuranceTerminal.cpp


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