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


C++ Datapad::getWaypointByName方法代码示例

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


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

示例1: surveyEvent

////=============================================================================
////
//// survey event
////
//
void ArtisanManager::surveyEvent(PlayerObject* player, CurrentResource* resource, SurveyTool* tool)
{
    if(tool && resource && player->isConnected())
    {
        Datapad* datapad					= player->getDataPad();
        ResourceLocation	highestDist		= gMessageLib->sendSurveyMessage(tool->getInternalAttribute<uint16>("survey_range"),tool->getInternalAttribute<uint16>("survey_points"),resource,player);

        // this is 0, if resource is not located
        if(highestDist.position.y == 5.0)
        {
			std::string name("Resource Survey");
			std::u16string name_u16(name.begin(), name.end());

            std::shared_ptr<WaypointObject>	waypoint = datapad->getWaypointByName(name_u16);

            // remove the old one
            if(waypoint)
            {
                datapad->updateWaypoint(waypoint->getId(), waypoint->getName(), glm::vec3(highestDist.position.x,0.0f,highestDist.position.z),
                                        static_cast<uint16>(gWorldManager->getZoneId()), player->getId(), WAYPOINT_ACTIVE);
            
            }
            else
            {
                // create a new one
                if(datapad->getCapacity())
                {
                    gMessageLib->SendSystemMessage(::common::OutOfBand("survey", "survey_waypoint"), player);
                    //gMessageLib->sendSystemMessage(this,L"","survey","survey_waypoint");
                }
                //the datapad automatically checks if there is room and gives the relevant error message
				std::string name("Resource Survey");
				std::u16string name_u16(name.begin(), name.end());
                datapad->requestNewWaypoint(name_u16, glm::vec3(highestDist.position.x,0.0f,highestDist.position.z),static_cast<uint16>(gWorldManager->getZoneId()),Waypoint_blue);
            }

            gMissionManager->checkSurveyMission(player,resource,highestDist);
        }
    }

    player->getSampleData()->mPendingSurvey = false;
}
开发者ID:Rexz,项目名称:mmoserver,代码行数:47,代码来源:ArtisanManager.cpp

示例2: sendGroupMissionUpdate

void GroupManager::sendGroupMissionUpdate(GroupObject* group)
{
	// this procedure ensures, that in case of a change in the mission pool of the group
	// all players get updated Mission waypoints
	// it concerns all players of the group on the zone, but not on other zones


	//get us the mission nearest to the most players on the Zone
	MissionObject* mission = getZoneGroupMission(group->getPlayerList());

	if(!mission)
		return;

	//now set the GroupWaypoint for all onZone groupmembers
	Uint64List::iterator playerListIt = group->getPlayerList()->begin();
	while(playerListIt != group->getPlayerList()->end())
	{
		PlayerObject*	player		= dynamic_cast<PlayerObject*> (gWorldManager->getObjectById((*playerListIt)));
		Datapad*		datapad		= dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
		WaypointObject*	waypoint	= datapad->getWaypointByName("@group:groupwaypoint");

		// remove the old one
		if(waypoint)
		{
			gMessageLib->sendUpdateWaypoint(waypoint,ObjectUpdateAdd,player);
			datapad->removeWaypoint(waypoint);
			gObjectFactory->deleteObjectFromDB(waypoint);

		}
		else
		// create a new one
		if(datapad->getCapacity())
		{
			datapad->requestNewWaypoint("@group:groupwaypoint",mission->getDestination().Coordinates,static_cast<uint16>(gWorldManager->getZoneId()),Waypoint_blue);
			gMessageLib->sendSystemMessage(player,L"","group","groupwaypoint");
		}

		
		playerListIt++;
	}
}
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:41,代码来源:GroupManager.cpp

示例3: handleDatabaseJobComplete

void Tutorial::handleDatabaseJobComplete(void* ref,swganh::database::DatabaseResult* result)
{
    TutorialQueryContainer* asyncContainer = reinterpret_cast<TutorialQueryContainer*>(ref);

    switch(asyncContainer->mQueryType)
    {
    case TutorialQuery_MainData:
    {
        swganh::database::DataBinding* binding = gWorldManager->getKernel()->GetDatabase()->createDataBinding(3);
        binding->addField(swganh::database::DFT_uint32,offsetof(Tutorial,mState),4,0);
        binding->addField(swganh::database::DFT_int32,offsetof(Tutorial,mSubState),4,1);
        binding->addField(swganh::database::DFT_bstring,offsetof(Tutorial,mStartingProfession),64,2);

        uint64 count = result->getRowCount();

        if (count == 1)
        {
            result->getNextRow(binding,this);
        }
        else if (count == 0)
        {
            // First time, no tutorial data saved.
            mSubState = 1;
            mState = 1;

            // Save the state.
            (gWorldManager->getKernel()->GetDatabase())->executeSqlAsync(0,0,"INSERT INTO %s.character_tutorial VALUES (%"PRIu64",%u,%u)",gWorldManager->getKernel()->GetDatabase()->galaxy(),asyncContainer->mId,mState, mSubState);
    
        }
        gWorldManager->getKernel()->GetDatabase()->destroyDataBinding(binding);

        // Here we go...
        this->startScript();
    }
    break;

    case TutorialQuery_PlanetLocation:
    {
        PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(asyncContainer->mId));
        if (player)
        {
            swganh::database::DataBinding* binding = gWorldManager->getKernel()->GetDatabase()->createDataBinding(4);
            TutorialStartingLocation startingLocation;

            binding->addField(swganh::database::DFT_uint32, offsetof(TutorialStartingLocation, destinationPlanet), 4, 0);
            binding->addField(swganh::database::DFT_float, offsetof(TutorialStartingLocation, destX), 4, 1);
            binding->addField(swganh::database::DFT_float, offsetof(TutorialStartingLocation, destY), 4, 2);
            binding->addField(swganh::database::DFT_float, offsetof(TutorialStartingLocation, destZ), 4, 3);

            result->getNextRow(binding, &startingLocation);

            startingLocation.destX += (gRandom->getRand()%5 - 2);
            startingLocation.destZ += (gRandom->getRand()%5 - 2);

            gMessageLib->sendClusterZoneTransferRequestByPosition(player,
                    glm::vec3(startingLocation.destX, startingLocation.destY, startingLocation.destZ),
                    startingLocation.destinationPlanet);

            // create waypoint at starting location.
            glm::vec3 position;
            position.x = startingLocation.destX;
            position.z = startingLocation.destZ;

            Datapad* datapad = player->getDataPad();

			std::string name("@ui:cpt_avatar_location");
			std::u16string name_u16(name.begin(), name.end());

            std::shared_ptr<WaypointObject> wp = datapad->getWaypointByName(name_u16);
            
			if(wp)
            {
				datapad->RemoveWaypoint(wp->getId());
            }
			
            datapad->requestNewWaypoint(name_u16, position, startingLocation.destinationPlanet, Waypoint_blue);

            //send starting emails
            sendStartingMails();
        }
        else
        {
        }
    }
    break;

    default:
    {
    }
    break;
    }
    delete asyncContainer;

}
开发者ID:ELMERzark,项目名称:mmoserver,代码行数:94,代码来源:Tutorial.cpp

示例4: handleDatabaseJobComplete

void Tutorial::handleDatabaseJobComplete(void* ref,DatabaseResult* result)
{
    TutorialQueryContainer* asyncContainer = reinterpret_cast<TutorialQueryContainer*>(ref);

    switch(asyncContainer->mQueryType)
    {
    case TutorialQuery_MainData:
    {
        DataBinding* binding = gWorldManager->getDatabase()->CreateDataBinding(3);
        binding->addField(DFT_uint32,offsetof(Tutorial,mState),4,0);
        binding->addField(DFT_int32,offsetof(Tutorial,mSubState),4,1);
        binding->addField(DFT_bstring,offsetof(Tutorial,mStartingProfession),64,2);

        uint64 count = result->getRowCount();

        if (count == 1)
        {
            result->GetNextRow(binding,this);
            gLogger->log(LogManager::DEBUG,"Tutorial::handleDatabaseJobComplete: Starting profession = %s", mStartingProfession.getAnsi());
        }
        else if (count == 0)
        {
            // First time, no tutorial data saved.
            mSubState = 1;
            mState = 1;

            // Save the state.
            (gWorldManager->getDatabase())->ExecuteSqlAsync(0,0,"INSERT INTO character_tutorial VALUES (%"PRIu64",%u,%u)",asyncContainer->mId,mState, mSubState);
    
        }
        gWorldManager->getDatabase()->DestroyDataBinding(binding);

        // Here we go...
        this->startScript();
    }
    break;

    case TutorialQuery_PlanetLocation:
    {
        PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(asyncContainer->mId));
        if (player)
        {
            DataBinding* binding = gWorldManager->getDatabase()->CreateDataBinding(4);
            TutorialStartingLocation startingLocation;

            binding->addField(DFT_uint32, offsetof(TutorialStartingLocation, destinationPlanet), 4, 0);
            binding->addField(DFT_float, offsetof(TutorialStartingLocation, destX), 4, 1);
            binding->addField(DFT_float, offsetof(TutorialStartingLocation, destY), 4, 2);
            binding->addField(DFT_float, offsetof(TutorialStartingLocation, destZ), 4, 3);

            result->GetNextRow(binding, &startingLocation);

            startingLocation.destX += (gRandom->getRand()%5 - 2);
            startingLocation.destZ += (gRandom->getRand()%5 - 2);

            gLogger->log(LogManager::DEBUG,"Tutorial::handleDatabaseJobComplete: New destination planet = %u", startingLocation.destinationPlanet);

            gMessageLib->sendClusterZoneTransferRequestByPosition(player,
                    glm::vec3(startingLocation.destX, startingLocation.destY, startingLocation.destZ),
                    startingLocation.destinationPlanet);

            // create waypoint at starting location.
            glm::vec3 position;
            position.x = startingLocation.destX;
            position.z = startingLocation.destZ;

            Datapad* datapad = player->getDataPad();

            WaypointObject* wp = datapad->getWaypointByName("@ui:cpt_avatar_location");
            if(wp)
            {
                datapad->removeWaypoint(wp->getId());
            }

            datapad->requestNewWaypoint("@ui:cpt_avatar_location", position, startingLocation.destinationPlanet, Waypoint_blue);

            //send starting emails
            sendStartingMails();
        }
        else
        {
            gLogger->log(LogManager::DEBUG,"Tutorial::handleDatabaseJobComplete: Player gone!");
        }
    }
    break;

    default:
    {
        gLogger->log(LogManager::DEBUG,"Tutorial::handleDatabaseJobComplete: Unknown query = %u\n",  asyncContainer->mQueryType);
    }
    break;
    }
    delete asyncContainer;

}
开发者ID:,项目名称:,代码行数:95,代码来源:


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