本文整理汇总了C++中PlayerObject::checkIgnoreList方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::checkIgnoreList方法的具体用法?C++ PlayerObject::checkIgnoreList怎么用?C++ PlayerObject::checkIgnoreList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::checkIgnoreList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _handleRemoveIgnore
void ObjectController::_handleRemoveIgnore(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(player->getContactListUpdatePending())
return;
else
player->setContactListUpdatePending(true);
string ignoreName;
int8 sql[2048],end[16],*sqlPointer;
message->getStringUnicode16(ignoreName);
ignoreName.convert(BSTRType_ANSI);
if(!ignoreName.getLength())
{
player->setContactListUpdatePending(false);
return;
}
if(player->isConnected())
gMessageLib->sendHeartBeat(player->getClient());
ignoreName.toLower();
if(!player->checkIgnoreList(ignoreName.getCrc()))
{
player->setContactListUpdatePending(false);
return;
}
ObjControllerAsyncContainer* asyncContainer = new(mDBAsyncContainerPool.malloc()) ObjControllerAsyncContainer(OCQuery_RemoveIgnore);
asyncContainer->mString = ignoreName.getAnsi();
sprintf(sql,"SELECT sf_removeIgnore(%"PRIu64",'",player->getId());
sprintf(end,"')");
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->Escape_String(sqlPointer,ignoreName.getAnsi(),ignoreName.getLength());
strcat(sql,end);
mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
}
示例2: handleSecureTradeInvitation
void ObjectController::handleSecureTradeInvitation(uint64 targetId,Message* message)
{
//targetId is the Id of the one who IS INVITING
//receiverId is the Id of the one who GETS INVITED
uint32 unknown,error;
uint64 receiverId,unknown64;
message->getUint32(unknown);
message->getUint32(error);
message->getUint64(unknown64);//sender (target) id
message->getUint64(receiverId);
PlayerObject* invitingPlayer = dynamic_cast<PlayerObject*>(mObject);
//PlayerObject* invitingPlayer =
PlayerObject* invitedPlayer = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(receiverId));
switch(error)
{
case 2:
{
// snd invitation returns error as 2 and the id of the invited as 0 :(
invitedPlayer = dynamic_cast<PlayerObject*>(invitingPlayer->GetCreature()->getTarget());
error = 0;
}
break;
case 0:
{
//first invitation set the setInvite to the Inviter
//invitedPlayer = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(receiverId));
}
break;
default:
{
// Always use a default if message damaged....
DLOG(info) << "ObjController:: Error in trade invitation";
// Since receiver is default NULL, we can use the error message below
// return;
}
}
if(!invitedPlayer)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("ui_trade", "start_fail_target_not_player"), invitingPlayer);
return;
}
if(invitedPlayer->GetCreature()->states.checkStatesEither(CreatureState_Combat | CreatureState_Tumbling | CreatureState_Swimming))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "wrong_state"), invitingPlayer);
return;
}
// Can NOT use bitwise operation on non bitwise constants. CreaturePostures are used exclusive.
// if(invitedPlayer->states.checkPosturesEither(CreaturePosture_Dead | CreaturePosture_Incapacitated))
if (invitedPlayer->GetCreature()->states.checkPosture(CreaturePosture_Dead) || invitedPlayer->GetCreature()->states.checkPosture(CreaturePosture_Incapacitated))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "wrong_state"), invitingPlayer);
return;
}
// Can NOT use bitwise operation on non bitwise constants.
// if(invitingPlayer->states.checkPosturesEither(CreaturePosture_Dead | CreaturePosture_Incapacitated))
if (invitingPlayer->GetCreature()->states.checkPosture(CreaturePosture_Dead) || invitingPlayer->GetCreature()->states.checkPosture(CreaturePosture_Incapacitated))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "wrong_state"), invitingPlayer);
return;
}
if (error == 0)
{
if (invitedPlayer->getTradeStatus() == false )
{
// If sender is invited by receiver already, then accept even if receiver have sender in the Ignore-list.
if (!invitingPlayer->getTrade()->verifyInvitation(invitedPlayer))
{
// We are not invited, check Ignore.
// If receiver have sender ignored, auto decline trade request.
BString ignoreName = invitingPlayer->GetCreature()->getFirstName().c_str();
ignoreName.toLower();
// check receivers ignorelist
if (invitedPlayer->checkIgnoreList(ignoreName.getCrc()))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("ui_trade", "request_player_denied_prose", invitedPlayer->getId(), 0, 0), invitingPlayer);
return;
}
}
gTradeManager->addTradeInvitation(invitedPlayer,invitingPlayer);
}
else
{
gMessageLib->SendSystemMessage(::common::OutOfBand("ui_trade", "request_player_busy_prose", invitedPlayer->getId(), 0, 0), invitingPlayer);
}
}
}
示例3: _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);
}