本文整理汇总了C++中Datapad类的典型用法代码示例。如果您正苦于以下问题:C++ Datapad类的具体用法?C++ Datapad怎么用?C++ Datapad使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Datapad类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkDancerMission
void MissionManager::checkDancerMission(PlayerObject* player)
{
Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
if(datapad->hasMission()) //player has a mission
{
MissionList::iterator it = datapad->getMissions()->begin();
while(it != datapad->getMissions()->end())
{
MissionObject* mission = dynamic_cast<MissionObject*>(*it);
if(mission->getMissionType() == dancer)
{
if(mission->getInProgress()) { ++it; continue; }
if(glm::distance(player->mPosition, mission->getDestination().Coordinates) < 20)
{
BuffAttribute* performance_timer = new BuffAttribute(Mission_Timer, 0,0,0);
Buff* timer = Buff::SimpleBuff(player, player, 600000, 0, gWorldManager->GetCurrentGlobalTick());
timer->AddAttribute(performance_timer);
player->AddBuff(timer);
mission->setInProgress(true);
}
}
++it;
}
}
return;
}
示例2: missionFailedEntertainer
void MissionManager::missionFailedEntertainer(PlayerObject* player)
{
Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
if(datapad->hasMission()) //player has a mission
{
MissionList::iterator it = datapad->getMissions()->begin();
while(it != datapad->getMissions()->end())
{
MissionObject* mission = dynamic_cast<MissionObject*>(*it);
if(mission->getMissionType() == dancer || mission->getMissionType() == musician)
{
if(!mission->getInProgress()) { ++it; continue; }
if(glm::distance(player->mPosition, mission->getDestination().Coordinates) < 20)
{
missionFailed(player,mission);
it = datapad->removeMission(it);
delete mission;
return;
}
}
++it;
}
}
}
示例3: _handleFindFriendDBReply
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);
}
}
示例4: _handleRequestWaypointAtPosition
void ObjectController::_handleRequestWaypointAtPosition(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
Datapad* datapad = player->getDataPad();
//if(!datapad->getCapacity())
//{
// gMessageLib->sendSystemMessage(player,L"","base_player","too_many_waypoints");
// return;
//}
BStringVector dataElements;
BString dataStr;
std::string nameStr;
message->getStringUnicode16(dataStr);
// Have to convert BEFORE using split, since the conversion done there is removed It will assert().. evil grin...
// Either do the conversion HERE, or better fix the split so it handles unicoe also.
dataStr.convert(BSTRType_ANSI);
uint32 elementCount = dataStr.split(dataElements,' ');
if(elementCount < 5)
{
if(elementCount < 4)
{
return;
}
else
{
nameStr = gWorldManager->getPlanetNameThis();
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), &tolower);
}
}
else
{
for(uint i = 4; i < elementCount; i++)
{
nameStr.append(dataElements[i].getAnsi());
if(i + 1 < elementCount)
nameStr.append(" ");
}
}
BString planetStr = dataElements[0].getAnsi();
//gLogger->log(LogManager::DEBUG,"ObjController::handleCreateWaypointAtPosition: planet %s",planetStr.getAnsi());
float x = static_cast<float>(atof(dataElements[1].getAnsi()));
float y = static_cast<float>(atof(dataElements[2].getAnsi()));
float z = static_cast<float>(atof(dataElements[3].getAnsi()));
int32 planetId = gWorldManager->getPlanetIdByName(planetStr);
if(planetId == -1)
{
return;
}
datapad->requestNewWaypoint(nameStr.c_str(), glm::vec3(x,y,z),static_cast<uint16>(planetId),Waypoint_blue);
}
示例5: _handleSetWaypointName
void ObjectController::_handleSetWaypointName(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
BString name;
Datapad* datapad = player->getDataPad();
WaypointObject* waypoint = datapad->getWaypointById(targetId);
int8 sql[1024],restStr[64],*sqlPointer;
if(waypoint == NULL)
{
DLOG(info) << "ObjController::handlesetwaypointname: could not find waypoint "<< targetId;
return;
}
message->getStringUnicode16(name);
if(!(name.getLength()))
return;
waypoint->setName(name);
name.convert(BSTRType_ANSI);
sprintf(sql,"UPDATE %s.waypoints SET name='",mDatabase->galaxy());
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->escapeString(sqlPointer,name.getAnsi(),name.getLength());
sprintf(restStr,"' WHERE waypoint_id=%" PRIu64 "",targetId);
strcat(sql,restStr);
mDatabase->executeSqlAsync(NULL,NULL,sql);
gMessageLib->sendUpdateWaypoint(waypoint,ObjectUpdateChange,player);
}
示例6: checkCraftingMission
bool MissionManager::checkCraftingMission(PlayerObject* player,NPCObject* npc)
{
Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
if(datapad->hasMission()) //player has a mission
{
MissionList::iterator it = datapad->getMissions()->begin();
while(it != datapad->getMissions()->end())
{
MissionObject* mission = dynamic_cast<MissionObject*>(*it);
if(mission->getMissionType() == crafting)
{
if(mission->getStartNPC() == npc)
{
//This is the start npc for the deliver mission
char mp[10];
sprintf(mp,"m%dp",mission->getNum());
gMessageLib->sendSpatialChat(npc,player,L"",mission->getTitleFile(),mp);
mission->setStartNPC(NULL);
gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","deliver_received_data");
MissionObject* updater = new MissionObject();
updater->clear();
updater->setId(mission->getId());
updater->getWaypoint()->setId(mission->getId()+1);
updater->getWaypoint()->setCoords(mission->getDestination().Coordinates);
updater->getWaypoint()->setPlanetCRC(mission->getDestination().PlanetCRC);
char name[150];
sprintf(name, "@%s:%s",mission->getTitleFile().getRawData(),mission->getTitle().getRawData());
updater->getWaypoint()->setName(name);
updater->getWaypoint()->setActive(true);
gMessageLib->sendMISO_Delta(updater,player);
delete updater;
return true;
}
else if(mission->getDestinationNPC() == npc && mission->getStartNPC() == NULL)
{
//This is the end npc for the deliver mission.
char mr[10];
sprintf(mr,"m%dr",mission->getNum());
gMessageLib->sendSpatialChat(npc,player,L"",mission->getTitleFile(),mr);
missionComplete(player,mission);
mission->setDestinationNPC(NULL);
it = datapad->removeMission(it);
delete mission;
return true;
}
}
++it;
}
}
return false;
}
示例7: _handleWaypoint
void ObjectController::_handleWaypoint(uint64 targetId, Message* message, ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
Datapad* datapad = player->getDataPad();
BString waypoint_data;
glm::vec3 waypoint_position;
// Before anything else verify the datapad can hold another waypoint.
if(! datapad->getCapacity()) {
gMessageLib->SendSystemMessage(::common::OutOfBand("base_player", "too_many_waypoints"), player);
return;
}
// Read in any waypoint data that may have been sent:
// [SYNTAX] /waypoint <x> <z> or /waypoint <x> <y> <z>
message->getStringUnicode16(waypoint_data);
// Check and see if any parameters were passed to the /waypoint command. For
// immediate purposes the length can be used to tell if anything or nothing was passed.
if (waypoint_data.getLength()) {
int count = swscanf(waypoint_data.getUnicode16(), L"%f %f %f", &waypoint_position.x, &waypoint_position.y, &waypoint_position.z);
// If there are an invalid number of items then disregard and notify the player of the correct
// format for the /waypoint command.
if (count < 2 || count > 3) {
gMessageLib->SendSystemMessage(L"[SYNTAX] /waypoint <x> <z> or /waypoint <x> <y> <z>", player);
return;
}
// If the item count is 2 it means no y value was set in the /waypoint command so
// update the waypoint_position data values accordingly.
if (count == 2) {
waypoint_position.z = waypoint_position.y;
waypoint_position.y = 0;
}
// Validate the position values.
if (waypoint_position.x < -8192 || waypoint_position.x > 8192 ||
waypoint_position.y < -500 || waypoint_position.y > 500 ||
waypoint_position.z < -8192 || waypoint_position.z > 8192) {
gMessageLib->SendSystemMessage( L"[SYNTAX] Invalid range for /waypoint. x = -8192/8192 y = -500/500 z = -8192/8192", player);
return;
}
} else {
// If no parameters were passed to the /waypoint command use the current world position.
waypoint_position = player->getWorldPosition();
}
datapad->requestNewWaypoint("Waypoint", waypoint_position, static_cast<uint16>(gWorldManager->getZoneId()), Waypoint_blue);
}
示例8: Datapad
Datapad* DatapadFactory::_createDatapad(DatabaseResult* result)
{
if (!result->getRowCount()) {
return nullptr;
}
Datapad* datapad = new Datapad();
// get our results
result->getNextRow(mDatapadBinding,(void*)datapad);
datapad->setParentId(datapad->mId - 3);
gWorldManager->addObject(datapad, true);
return datapad;
}
示例9: checkReconMission
bool MissionManager::checkReconMission(MissionObject* mission)
{
if (mission->getMissionType() != recon) return false;
if(glm::distance(mission->getOwner()->mPosition, mission->getDestination().Coordinates) < 20)
{
Datapad* datapad = dynamic_cast<Datapad*>(mission->getOwner()->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
missionComplete(mission->getOwner(),mission);
gWorldManager->removeMissionFromProcess(mission->getTaskId());
datapad->removeMission(mission);
delete mission;
}
return true;
}
示例10: checkSurveyMission
void MissionManager::checkSurveyMission(PlayerObject* player,CurrentResource* resource,ResourceLocation highestDist)
{
Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
if(datapad->hasMission()) //player has a mission
{
MissionList::iterator it = datapad->getMissions()->begin();
while(it != datapad->getMissions()->end())
{
MissionObject* mission = dynamic_cast<MissionObject*>(*it);
if(mission->getMissionType() == survey)
{
if(mission->getTargetResource() == resource->getType())
{
if(mission->getDifficulty() <= (highestDist.ratio*100))
{
if(glm::distance(mission->getIssuingTerminal()->mPosition, highestDist.position) > 1024)
{
gLogger->logMsg("PE > 500: ready to apply new BF/wound dmg");
missionComplete(player,mission);
it = datapad->removeMission(it);
delete mission;
return;
}
else
{
int8 sm[500];
sprintf(sm,"That resource pocket is too close (%"PRIu32" meters) to the mission giver to be useful to them. Go find one at least %"PRIu32" meters away to complete your survey mission. ",
static_cast<uint32>(glm::distance(mission->getIssuingTerminal()->mPosition, highestDist.position)),
(1024 - (int)glm::distance(mission->getIssuingTerminal()->mPosition, highestDist.position)));
string s = BString(sm);
s.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,s);
}
}
}
}
++it;
}
}
}
示例11: _handleSetWaypointActiveStatus
void ObjectController::_handleSetWaypointActiveStatus(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
WaypointObject* waypoint = NULL;
Datapad* datapad = player->getDataPad();
waypoint = datapad->getWaypointById(targetId);
if(waypoint)
{
waypoint->toggleActive();
mDatabase->executeSqlAsync(0,0,"UPDATE %s.waypoints set active=%u WHERE waypoint_id=%" PRIu64 "",mDatabase->galaxy(),(uint8)waypoint->getActive(),targetId);
}
else
{
DLOG(info) << "ObjController::handleSetWaypointStatus: could not find waypoint " << targetId;
}
}
示例12: 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;
}
示例13: getZoneGroupMission
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++;
}
}
示例14: assert
void MountObject::handleObjectMenuSelect(uint8 message_type, Object* source_object) {
PlayerObject* player = dynamic_cast<PlayerObject*>(source_object);
if (!player) {
// Verify the data passed in is what is expected. In debug mode the assert will
// trigger and crash the server.
assert(false && "MountObject::handleObjectMenuSelect - Menu selection requested from a non-player object.");
return;
}
switch (message_type) {
case radId_vehicleStore:
{
Datapad* datapad = player->getDataPad();
if(datapad) {
if(VehicleController* vehicle = dynamic_cast<VehicleController*>(datapad->getDataById(mId-1))) {
vehicle->Store();
}
}
}
break;
case radId_serverVehicleEnter:
case radId_serverVehicleExit:
{
gLogger->log(LogManager::DEBUG, "MountObject::handleObjectMenuSelect - still in radial selection");
}
break;
default:
{
gLogger->log(LogManager::DEBUG, "MountObject::handleObjectMenuSelect - unknown radial selection: %d",message_type);
}
break;
}
}
示例15: missionAbort
/*
* Player aborted the mission
*/
void MissionManager::missionAbort(PlayerObject* player, uint64 mission_id)
{
gLogger->logMsg("ABORT MISSION");
Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
MissionObject* mission = datapad->getMissionById(mission_id);
if(mission)
{
datapad->removeMission(mission);
gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","incomplete");
gMessageLib->sendSetWaypointActiveStatus(mission->getWaypoint(),false,player);
gMessageLib->sendMissionAbort(mission,player);
gMessageLib->sendContainmentMessage(mission->getId(), datapad->getId(), 4, player);
gMessageLib->sendDestroyObject(mission_id,player);
delete mission;
}
else
{
gLogger->logMsg("ERROR: Attempt to abort an invalid mission, with id %.8X, from the datapad.", static_cast<int>(mission_id));
}
return;
}