Example #1
0
void AdminManager::cancelAdminRequest(uint64 requestType, string message)
{
	// We will only handle one request at the time for each type.
	gWorldManager->cancelAdminRequest(static_cast<uint8>(requestType));	// Even though map's fix duplicate issues, the lower level implementation may change.

	AdminRequests::iterator adminRequestIterator = mAdminRequests.find(requestType);
	if (adminRequestIterator != mAdminRequests.end())
	{
		delete ((*adminRequestIterator).second);
		mAdminRequests.erase(adminRequestIterator);

		message.convert(BSTRType_Unicode16);
		PlayerAccMap::const_iterator it = gWorldManager->getPlayerAccMap()->begin();

		while (it != gWorldManager->getPlayerAccMap()->end())
		{
			const PlayerObject* const player = (*it).second;
			if (player->isConnected())
			{
				gMessageLib->sendSystemMessage((PlayerObject*)player, L"Server shutdown canceled.");
				if (message.getLength())
				{
					gMessageLib->sendSystemMessage((PlayerObject*)player, message);
				}
			}
			++it;
		}
	}
	mPendingShutdown = false;
}
void ObjectController::_handleFindFriendDBReply(uint64 retCode,string friendName)
{
	PlayerObject*	player	= dynamic_cast<PlayerObject*>(mObject);
	friendName.convert(BSTRType_Unicode16);
	if(retCode == 0)
	{
		gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed_noname","","",L"",0,"","",friendName.getUnicode16());
		return;
	}

	PlayerObject*	searchObject	= dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(retCode));

	if(!searchObject)
	{
		gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed","","",L"",0,"","",friendName.getUnicode16());
		return;
	}

	//are we on our targets friendlist???
	if(!searchObject->checkFriendList(player->getFirstName().getCrc()))
	{
		gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed","","",L"",0,"","",friendName.getUnicode16());
		return;
	}

	Datapad* thePad = dynamic_cast<Datapad*>(searchObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));

	if(thePad && thePad->getCapacity())
	{
		//the datapad automatically checks for waypoint caspacity and gives the relevant error messages
		thePad->requestNewWaypoint(searchObject->getFirstName().getAnsi(),searchObject->mPosition,static_cast<uint16>(gWorldManager->getZoneId()),Waypoint_blue);
	}
}
void ObjectController::_handleAddIgnoreDBReply(uint32 retCode,string ignoreName)
{
	
	PlayerObject*	player	= dynamic_cast<PlayerObject*>(mObject);

	// gLogger->logMsgF("_handleAddIgnoreDBReply retCode = %u",MSG_NORMAL, retCode);

	switch(retCode)
	{
		// no such name
		case 0:
		default:
		{
			ignoreName.convert(BSTRType_Unicode16);
			gMessageLib->sendSystemMessage(player,L"","cmnty","ignore_not_found","","",L"",0,"","",ignoreName.getUnicode16());
		}
		break;

		// add ok
		case 1:
		{
			// update list
			player->addIgnore(ignoreName.getAnsi());
			gMessageLib->sendIgnoreListPlay9(player);

			// send notification
			ignoreName.convert(BSTRType_Unicode16);
			gMessageLib->sendSystemMessage(player,L"","cmnty","ignore_added","","",L"",0,"","",ignoreName.getUnicode16());

			// notify chat server
			if(player->isConnected())
			{
				gMessageFactory->StartMessage();
				gMessageFactory->addUint32(opNotifyChatAddIgnore);
				gMessageFactory->addString(ignoreName);
				Message* message = gMessageFactory->EndMessage();

				player->getClient()->SendChannelA(message,player->getAccountId(),CR_Chat,2);
			}
		}
		break;
	}

	player->setContactListUpdatePending(false);
}
void ObjectController::_handleRemoveFriendDBReply(uint32 retCode,string friendName)
{
	PlayerObject*	player	= dynamic_cast<PlayerObject*>(mObject);

	switch(retCode)
	{
		// no such name
		case 0:
		default:
		{
			friendName.convert(BSTRType_Unicode16);
			gMessageLib->sendSystemMessage(player,L"","cmnty","friend_not_found","","",L"",0,"","",friendName.getUnicode16());
		}
		break;

		// remove ok
		case 1:
		{
			// update list
			player->removeFriend(friendName.getCrc());
			gMessageLib->sendFriendListPlay9(player);

			// send notification
			friendName.convert(BSTRType_Unicode16);
			gMessageLib->sendSystemMessage(player,L"","cmnty","friend_removed","","",L"",0,"","",friendName.getUnicode16());

			if(player->isConnected())
			{
				// notify chat server
				gMessageFactory->StartMessage();
				gMessageFactory->addUint32(opNotifyChatRemoveFriend);
				gMessageFactory->addString(friendName);
				Message* message = gMessageFactory->EndMessage();

				player->getClient()->SendChannelA(message,player->getAccountId(),CR_Chat,2);
			}
		}
		break;
	}

	player->setContactListUpdatePending(false);
}
Example #5
0
void FireworkShow::handleUIEvent(string strAvailable, string strDelay, UIWindow* window)
{
	if(window == NULL)
	{
		return;
	}
	//uint32 delay = atoi(strDelay.getAnsi());
	strDelay.convert(BSTRType_ANSI);
	int32 delay = atoi(strDelay.getAnsi());
	gLogger->logMsgF("strDealay atoi = %i",MSG_NORMAL,delay);
	fireworkShowList.at(this->fireworkShowListModify).delay = delay;

}