本文整理汇总了C++中PlayerObject::getClient方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getClient方法的具体用法?C++ PlayerObject::getClient怎么用?C++ PlayerObject::getClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _handleDismissGroupMember
void ObjectController::_handleDismissGroupMember(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
// make sure its a fully grouped player
if(player->getGroupId() == 0)
{
return;
}
// lets get the target player
message->setIndex(32);
PlayerObject* targetPlayer = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(message->getUint64()));
// if target is valid
if(targetPlayer == NULL || targetPlayer->getGroupId() != player->getGroupId())
{
gMessageLib->sendSystemMessage(player,L"Invalid Target.");
return;
}
// we advise the chat server about it
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opIsmGroupDismissGroupMember);
gMessageFactory->addUint32(targetPlayer->getAccountId());
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
}
示例2: handleObjectReady
void StructureManager::handleObjectReady(Object* object,DispatchClient* client)
{
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
if(!structure)
{
gLogger->logMsg("StructureManager::handleObjectReady: No structure");
}
if(gWorldManager->getWMState() == WMState_Running)
{
// set timer for deletion of building fence
uint32 account = client->getAccountId();
PlayerObject* player = gWorldManager->getPlayerByAccId(account);
PlayerStructure* fence = gNonPersistantObjectFactory->requestBuildingFenceObject(structure->mPosition.x,structure->mPosition.y,structure->mPosition.z, player);
structure->getTTS()->todo = ttE_BuildingFence;
structure->getTTS()->buildingFence = fence->getId();
structure->getTTS()->playerId = player->getId();
structure->getTTS()->projectedTime = mBuildingFenceInterval + Anh_Utils::Clock::getSingleton()->getLocalTime();
gWorldManager->handleObjectReady(structure,player->getClient());
addStructureforConstruction(structure->getId());
}
else
{
gWorldManager->handleObjectReady(structure,NULL);
}
}
示例3: _handlefindfriend
void ObjectController::_handlefindfriend(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(mObject);
string friendName;
int8 sql[1024],end[16],*sqlPointer;
message->getStringUnicode16(friendName);
if(!friendName.getLength())
{
gMessageLib->sendSystemMessage(playerObject,L"","ui_cmnty","friend_location_failed_usage","","",L"",0,"","",L"");
return;
}
if(playerObject->isConnected())
{
// query the chat server
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opNotifyChatFindFriend);
gMessageFactory->addString(friendName);
Message* message = gMessageFactory->EndMessage();
playerObject->getClient()->SendChannelA(message,playerObject->getAccountId(),CR_Chat,2);
}
return;
string unicodeName = friendName;
friendName.convert(BSTRType_ANSI);
// check if he's our friend
if(!playerObject->checkFriendList(friendName.getCrc()))
{
gMessageLib->sendSystemMessage(playerObject,L"","cmnty","friend_not_found","","",L"",0,"","",unicodeName.getUnicode16());
return;
}
// pull the db query
ObjControllerAsyncContainer* asyncContainer = new(mDBAsyncContainerPool.malloc()) ObjControllerAsyncContainer(OCQuery_FindFriend);
asyncContainer->mString = friendName.getAnsi();
sprintf(sql,"SELECT id from swganh.characters where firstname like '");
sprintf(end,"'");
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->Escape_String(sqlPointer,friendName.getAnsi(),friendName.getLength());
strcat(sql,end);
mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
}
示例4: _handleGroupChat
void ObjectController::_handleGroupChat(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
string msgText;
msgText.setType(BSTRType_Unicode16);
msgText.setLength(512);
//Honey bunnies!
//this is like all handled by the Objectcontroller???
//we just have to look at the Message here !!!!!!!!
//gLogger->hexDump always shows the complete Message!!!!! the Objectcontroller however sets the Index to the first data
//byte AFTER the Objectcontroller header has been dealt with !
/*
data32 = message->getUint32(); // object controller opcode
data32 = message->getUint32(); // Unknown
data32 = message->getUint32(); // command enqueue
playerId = message->getUint64();// player id
data32 = message->getUint32(); // Unknown
uint32 requestId = message->getUint32(); // RequestID
// data32 = message->getUint32(); // Unknown RequestID?????
data32 = message->getUint32(); // command crc (crc of "groupchat")
data64 = message->getUint64(); // empty id field
*/
message->getStringUnicode16(msgText); // unicode string
// make sure its a fully grouped player
if (!player)
{
gLogger->logMsg("ObjectController::_handleGroupChat NO PLAYER\n");
}
if(!player->getGroupId())
{
gLogger->logMsg("ObjectController::_handleGroupChat NO GROUP");
}
// let the chatserver handle this.
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opIsmGroupSay);
gMessageFactory->addUint32(0);
gMessageFactory->addString(msgText);
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
//this should be fastpath as not being Mission critical and we want to prevent the communication protocol overhead with Acks and resends
// Convert since we are going to print it.
// msgText.convert(BSTRType_ANSI);
}
示例5: _checkPlayer
bool MessageLib::_checkPlayer(uint64 playerId) const
{
PlayerObject* tested = dynamic_cast <PlayerObject*> (gWorldManager->getObjectById(playerId));
if(!tested)
{
gLogger->log(LogManager::NOTICE,"Player Id (%I64u) invalid",playerId);
return false;
}
return((tested->isConnected())&&(tested->getClient()));
}
示例6: _handleDisband
void ObjectController::_handleDisband(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(player->getGroupId() == 0)
{
return;
}
// we advise the chat server about the disband
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opIsmGroupDisband);
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
}
示例7: _handleJoin
void ObjectController::_handleJoin(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
// resetting the sender's id
gMessageLib->sendInviteSenderUpdateDeltasCreo6(0,player);
// we advise the chat server that he accepted
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opIsmGroupInviteResponse);
gMessageFactory->addUint8(1);
gMessageFactory->addFloat(player->mPosition.x);
gMessageFactory->addFloat(player->mPosition.z);
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
}
示例8: _handleAddIgnoreDBReply
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);
}
示例9: _handleRemoveFriend
void ObjectController::_handleRemoveFriend(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(player->getContactListUpdatePending())
return;
else
player->setContactListUpdatePending(true);
string friendName;
int8 sql[1024],end[16],*sqlPointer;
message->getStringUnicode16(friendName);
friendName.convert(BSTRType_ANSI);
if(!friendName.getLength())
{
player->setContactListUpdatePending(false);
return;
}
if(player->isConnected())
gMessageLib->sendHeartBeat(player->getClient());
friendName.toLower();
if(!player->checkFriendList(friendName.getCrc()))
{
player->setContactListUpdatePending(false);
return;
}
ObjControllerAsyncContainer* asyncContainer = new(mDBAsyncContainerPool.malloc()) ObjControllerAsyncContainer(OCQuery_RemoveFriend);
asyncContainer->mString = friendName.getAnsi();
sprintf(sql,"SELECT sf_removeFriend(%"PRIu64",'",player->getId());
sprintf(end,"')");
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->Escape_String(sqlPointer,friendName.getAnsi(),friendName.getLength());
strcat(sql,end);
mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
}
示例10: _handleDecline
void ObjectController::_handleDecline(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
// resetting the sender's id
gMessageLib->sendInviteSenderUpdateDeltasCreo6(0,player);
gMessageLib->sendSystemMessage(player, L"","group","decline_self");
// we advise the chat server that he refused
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opIsmGroupInviteResponse);
gMessageFactory->addUint8(0);
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
player->setGroupId(0);
}
示例11: _handleRemoveFriendDBReply
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);
}
示例12: _handleGroupLootMode
void ObjectController::_handleGroupLootMode(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
// disabled for now
//return;
gLogger->logMsg("_handleGroupLootMode");
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
// make sure its a fully grouped player
if(player->getGroupId() == 0)
{
return;
}
// we advise the chat server about it
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opIsmGroupLootModeRequest);
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
}
示例13: _handleInvite
void ObjectController::_handleInvite(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
// lets get the target player
message->setIndex(32);
PlayerObject* target_player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(message->getUint64()));
// if target is valid
if(target_player == NULL || target_player == player)
{
gMessageLib->sendSystemMessage(player,L"","group","invite_no_target_self");
return;
}
gMessageFactory->StartMessage();
Message* newMessage;
gMessageFactory->addUint32(opIsmGroupInviteRequest);
gMessageFactory->addUint32(target_player->getAccountId());
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
}
示例14: handleDatabaseJobComplete
void HarvesterObject::handleDatabaseJobComplete(void* ref,swganh::database::DatabaseResult* result)
{
StructureManagerAsyncContainer* asynContainer = (StructureManagerAsyncContainer*)ref;
switch(asynContainer->mQueryType)
{
case Structure_ResourceRetrieve:
{
PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(asynContainer->mPlayerId));
HarvesterObject* harvester = dynamic_cast<HarvesterObject*>(gWorldManager->getObjectById(asynContainer->mStructureId));
swganh::database::DataBinding* binding = gWorldManager->getKernel()->GetDatabase()->createDataBinding(1);
binding->addField(swganh::database::DFT_uint32,0,4);
uint64 count;
uint32 error;
count = result->getRowCount();
if(!count)
{
assert(false && "HarvesterObject::handleDatabaseJobComplete Structure_ResourceRetrieve did not find any resources");
return;
}
result->getNextRow(binding,&error);
if(error > 0)
{
//mmh there was something fishy ... no changes db side
gMessageLib->sendResourceEmptyHopperResponse(harvester,player,error, asynContainer->command.b1, asynContainer->command.b2);
return;
}
createResourceContainer(asynContainer->command.ResourceId, player, asynContainer->command.Amount);
StructureManagerAsyncContainer* asyncContainer = new StructureManagerAsyncContainer(Structure_ResourceDiscardUpdateHopper,player->getClient());
asyncContainer->mStructureId = asynContainer->mStructureId;
asyncContainer->mPlayerId = asynContainer->mPlayerId;
asyncContainer->command = asynContainer->command;
gWorldManager->getKernel()->GetDatabase()->executeSqlAsync(harvester,asyncContainer,"SELECT hr.resourceID, hr.quantity FROM %s.harvester_resources hr WHERE hr.ID = '%"PRIu64"' ",gWorldManager->getKernel()->GetDatabase()->galaxy(), harvester->getId());
}
break;
case Structure_ResourceDiscard:
{
PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(asynContainer->mPlayerId));
HarvesterObject* harvester = dynamic_cast<HarvesterObject*>(gWorldManager->getObjectById(asynContainer->mStructureId));
swganh::database::DataBinding* binding = gWorldManager->getKernel()->GetDatabase()->createDataBinding(1);
binding->addField(swganh::database::DFT_uint32,0,4);
uint64 count;
uint32 error;
count = result->getRowCount();
if(!count)
{
assert(false && "HarvesterObject::handleDatabaseJobComplete Structure_ResourceDiscard did not find resource");
return;
}
result->getNextRow(binding,&error);
if(result > 0)
{
//mmh there was something fishy ... no changes db side
gMessageLib->sendResourceEmptyHopperResponse(harvester,player,error, asynContainer->command.b1, asynContainer->command.b2);
return;
}
StructureManagerAsyncContainer* asyncContainer = new StructureManagerAsyncContainer(Structure_ResourceDiscardUpdateHopper,player->getClient());
asyncContainer->mStructureId = asynContainer->mStructureId;
asyncContainer->mPlayerId = asynContainer->mPlayerId;
asyncContainer->command = asyncContainer->command;
gWorldManager->getKernel()->GetDatabase()->executeSqlAsync(harvester,asyncContainer,"SELECT hr.resourceID, hr.quantity FROM %s.harvester_resources hr WHERE hr.ID = '%"PRIu64"' ",gWorldManager->getKernel()->GetDatabase()->galaxy(),harvester->getId());
}
break;
case Structure_ResourceDiscardUpdateHopper:
{
uint64 count = result->getRowCount();
HarvesterObject* harvester = dynamic_cast<HarvesterObject*>(gWorldManager->getObjectById(asynContainer->mStructureId));
PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(asynContainer->mPlayerId));
swganh::database::DataBinding* binding = gWorldManager->getKernel()->GetDatabase()->createDataBinding(2);
binding->addField(swganh::database::DFT_uint64,offsetof(HarvesterHopperItem,ResourceID),8,0);
binding->addField(swganh::database::DFT_float,offsetof(HarvesterHopperItem,Quantity),4,1);
HResourceList* hRList = harvester->getResourceList();
hRList->clear();
HarvesterHopperItem hopperTemp;
for(uint64 i=0; i <count; i++)
//.........这里部分代码省略.........
示例15: requestUpdatedWaypoint
//=============================================================================
//
// update existing waypoint
// never call this directly - always go over the datapad!!!!!
//
void ObjectFactory::requestUpdatedWaypoint(ObjectFactoryCallback* ofCallback,uint64 wpId,BString name,
const glm::vec3& coords,uint16 planetId,uint64 ownerId, uint8 activeStatus)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(ownerId));
OFAsyncContainer* asyncContainer = new(mDbAsyncPool.ordered_malloc()) OFAsyncContainer(ofCallback,QFQuery_WaypointUpdate,player->getClient());
asyncContainer->Id = wpId;
int8 sql[512],*sqlPointer;
int8 restStr[128];
name.convert(BSTRType_ANSI);
sprintf(sql,"CALL sp_WaypointUpdate('");
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->escapeString(sqlPointer, name.getAnsi() ,name.getLength());
sprintf(restStr,"',%"PRIu64",%f,%f,%f,%u,%u)",wpId, coords.x, coords.y, coords.z, planetId, activeStatus);
strcat(sql,restStr);
mDatabase->executeProcedureAsync(this,asyncContainer,sql);
}