本文整理汇总了C++中PlayerObject::checkFriendList方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::checkFriendList方法的具体用法?C++ PlayerObject::checkFriendList怎么用?C++ PlayerObject::checkFriendList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::checkFriendList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _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);
}
}
示例2: _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);
}
示例3: _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);
}
示例4: _handleAddFriend
void ObjectController::_handleAddFriend(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();
// check if he's already our friend
if(player->checkFriendList(friendName.getCrc()))
{
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_duplicate","","",L"",0,"","",friendName.getUnicode16());
player->setContactListUpdatePending(false);
return;
}
// or ignored
if(player->checkIgnoreList(friendName.getCrc()))
{
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_fail_is_ignored","","",L"",0,"","",friendName.getUnicode16());
player->setContactListUpdatePending(false);
return;
}
// check our own name
string firstName = player->getFirstName().getAnsi();
firstName.toLower();
if(strcmp(firstName.getAnsi(),friendName.getAnsi()) == 0)
{
player->setContactListUpdatePending(false);
return;
}
// pull the db query
ObjControllerAsyncContainer* asyncContainer = new(mDBAsyncContainerPool.malloc()) ObjControllerAsyncContainer(OCQuery_AddFriend);
asyncContainer->mString = friendName.getAnsi();
sprintf(sql,"SELECT sf_addFriend(%"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);
}