本文整理汇总了C++中P_PLAYER::party方法的典型用法代码示例。如果您正苦于以下问题:C++ P_PLAYER::party方法的具体用法?C++ P_PLAYER::party怎么用?C++ P_PLAYER::party使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_PLAYER
的用法示例。
在下文中一共展示了P_PLAYER::party方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Dispel
/*!
If source is 0 and silent is true, nothing happens. Otherwise
the canidate is removed from the party without notification.
*/
void Dispel( P_CHAR /*source*/, bool silent )
{
P_PLAYER player = dynamic_cast<P_PLAYER>( World::instance()->findChar( destSer ) );
P_PLAYER leader = dynamic_cast<P_PLAYER>( World::instance()->findChar( this->leader ) );
if ( leader && leader->party() && !silent )
leader->party()->removeMember( player );
}
示例2: Expire
/*!
Remove the canidate from the party and notify him.
*/
void Expire()
{
// Check if the player is still waiting for the party acceptance
P_PLAYER leader = dynamic_cast<P_PLAYER>( World::instance()->findChar( this->leader ) );
P_PLAYER player = dynamic_cast<P_PLAYER>( World::instance()->findChar( destSer ) );
// Only send a decline party invitation packet if the player really is
// still invited to join the party
if ( leader && leader->party() && player && player->socket() && leader->party()->canidates().contains( player ) )
{
player->socket()->log( LOG_TRACE, tr( "Party invitation from '%1' timed out.\n" ).arg( leader->account()->login() ) );
leader->party()->removeMember( player ); // This automatically resends and checks the party
}
}
示例3: addMember
void cParty::addMember( P_PLAYER player, bool update )
{
// Remove him from his old party
if ( player->party() )
player->party()->removeMember( player );
else
removeCanidate( player );
if ( update )
send( 1008094, QString::null, player->name(), true );
members_.append( player );
player->setParty( this );
// Send the new memberlist to all members
if ( update )
{
this->update();
if ( player != leader_ && player->socket() )
player->socket()->clilocMessage( 1005445 );
}
}
示例4: handlePacket
void cParty::handlePacket( cUOSocket* socket, cUOPacket* packet )
{
unsigned char subcommand = ( *packet )[5];
QString message;
P_PLAYER leader = 0;
P_PLAYER player = socket->player();
switch ( subcommand )
{
// Add a member to the party
case 1:
socket->clilocMessage( 1005454 );
socket->attachTarget( new cPartyInvitation( player->serial() ) );
break;
// Remove member from party.
case 2:
if ( packet->size() == 10 )
{
P_PLAYER target = dynamic_cast<P_PLAYER>( World::instance()->findChar( packet->getInt( 6 ) ) );
if ( target && player->party() && target->party() )
{
if ( player->party() == target->party() && player->party()->leader() == player )
{
socket->log( LOG_TRACE, tr( "Removed '%1' from the party.\n" ).arg( target->account()->login() ) );
player->party()->removeMember( target );
}
else if ( target == player )
{
socket->log( LOG_TRACE, tr( "Left the party.\n" ).arg( player->account()->login() ) );
player->party()->removeMember( target );
}
}
}
break;
// Send a single party member a message
case 3:
if ( player->party() )
{
P_PLAYER target = dynamic_cast<P_PLAYER>( World::instance()->findChar( packet->getInt( 6 ) ) );
if ( target )
{
socket->log( LOG_TRACE, tr( "Told '%1' in party '%2'.\n" ).arg( target->account()->login() ).arg( message ) );
QString message = packet->getUnicodeString( 10, packet->size() - 10 );
player->party()->send( player, target, message );
}
}
break;
// Send the whole party a message
case 4:
if ( player->party() )
{
QString message = packet->getUnicodeString( 6, packet->size() - 6 );
socket->log( LOG_TRACE, tr( "Told the whole party: '%1'.\n" ).arg( message ) );
player->party()->send( player, message );
}
break;
// Allow or Disallow my party from looting my corpse
case 6:
if ( player->party() && packet->size() == 7 )
{
bool allowed = ( *packet )[6] != 0;
player->party()->setLootingAllowed( player, allowed );
socket->clilocMessage( allowed ? 1005447 : 1005448 );
}
break;
// Accept party invitation
case 8:
Timers::instance()->dispel( player, 0, "cancelpartyinvitation", true, false );
leader = dynamic_cast<P_PLAYER>( World::instance()->findChar( packet->getInt( 6 ) ) );
if ( leader && leader->party() && leader->party()->canidates().contains( player ) )
{
leader->party()->addMember( player );
socket->log( tr( "Accepted party invitation from '%1'.\n" ).arg( leader->account()->login() ) );
}
break;
// Decline party invitation
case 9:
Timers::instance()->dispel( player, 0, "cancelpartyinvitation", true, false );
leader = dynamic_cast<P_PLAYER>( World::instance()->findChar( packet->getInt( 6 ) ) );
if ( leader && leader->party() && leader->party()->canidates().contains( player ) )
{
leader->socket()->clilocMessageAffix( 1008091, 0, player->name(), 0x3b2, 3, 0, false, true );
leader->party()->removeMember( player );
socket->clilocMessage( 1008092 );
socket->log( LOG_TRACE, tr( "Declined party invitation from '%1'.\n" ).arg( leader->account()->login() ) );
}
break;
default:
message.sprintf( "Receieved unknown party subcommand: 0x%02x", subcommand );
//.........这里部分代码省略.........
示例5: responsed
bool responsed( cUOSocket* socket, cUORxTarget* target )
{
if ( !isCharSerial( target->serial() ) )
{
socket->clilocMessage( 1005442 );
}
else
{
P_PLAYER leader = dynamic_cast<P_PLAYER>( World::instance()->findChar( this->player ) );
P_CHAR character = World::instance()->findChar( target->serial() );
P_NPC npc = dynamic_cast<P_NPC>( character );
P_PLAYER player = dynamic_cast<P_PLAYER>( character );
if ( !leader || ( leader->party() && leader->party()->leader() != leader ) )
{
socket->clilocMessage( 1005453 );
}
else if ( leader->party() && leader->party()->members().count() + leader->party()->canidates().count() >= 10 )
{
socket->clilocMessage( 1008095 );
// NPC targetted
}
else if ( npc )
{
if ( npc->isHuman() )
socket->clilocMessage( 1005443, 0, npc->saycolor(), 3, npc );
else
socket->clilocMessage( 1005444 );
}
else if ( leader == player )
{
socket->clilocMessage( 1005439 );
}
else if ( player && player->party() && player->party() == leader->party() )
{
socket->clilocMessage( 1005440 );
}
else if ( player && leader->party() && leader->party()->canidates().contains( player ) )
{
socket->clilocMessage( 1005440 );
}
else if ( player && player->party() )
{
socket->clilocMessage( 1005441 );
}
else if ( player && player->socket() )
{
if ( !leader->party() )
{
new cParty( leader );
leader->party()->update();
}
player->socket()->clilocMessageAffix( 1008089, 0, leader->name(), 0x3b2, 3, 0, false, true );
leader->party()->addCanidate( player );
socket->log( LOG_TRACE, tr( "Invited '%1' to join his party.\n" ).arg( player->account()->login() ) );
// Send a party invitation request
cUOTxPartyInvitation invitation;
invitation.setSerial( leader->serial() );
player->socket()->send( &invitation );
// Attach a tempeffect that'll cancel the invitation after ten seconds
Timers::instance()->insert( new cPartyCancelInvitation( leader->serial(), player->serial() ) );
}
}
return true;
}
示例6: dbl_click_item
void dbl_click_item(cUOSocket* socket, SERIAL target_serial) throw()
{
SERIAL serial = target_serial;
P_PLAYER pc_currchar = socket->player();
if( !pc_currchar->isGM() && /*pc_currchar->objectDelay() > 10 && ???*/ pc_currchar->objectDelay() >= uiCurrentTime )
{
socket->sysMessage(tr("You must wait to perform another action."));
return;
}
else
pc_currchar->setObjectDelay( SrvParams->objectDelay() * MY_CLOCKS_PER_SEC + uiCurrentTime );
P_ITEM pi = FindItemBySerial( serial );
if( !pi )
return;
if( pi->container() && pi->container()->isItem() && pi->type() != 1 && !pi->isInWorld())
{ // Cant use stuff that isn't in your pack.
P_CHAR pc_p = pi->getOutmostChar();
if( pc_p && pc_currchar != pc_p )
return;
}
else if( pi->container() && pi->container()->isChar() && pi->type() != 1 && !pi->isInWorld() )
{ // in a character.
P_CHAR pc_p = dynamic_cast<P_CHAR>(pi->container());
if (pc_p != NULL)
if( pc_p != pc_currchar && pi->layer() != 15 && pi->type() != 1 )
return;
}
// Criminal for looting an innocent corpse & unhidden if not owner...
if( pi->corpse() )
{
if (!pc_currchar->Owns(pi) && !pc_currchar->isGM()) {
pc_currchar->unhide();
}
// TODO: Add a XML option for this
if(!pc_currchar->Owns(pi) && !pc_currchar->isGM() && pc_currchar->isInnocent())
{
// Innocent Corpse and not in the same party && party allowance for looting?
if (pi->hasTag("notoriety") && pi->getTag("notoriety").toInt() == 0x01) {
P_PLAYER owner = dynamic_cast<P_PLAYER>(pi->owner());
bool allowed = false;
if (owner && owner->party() && owner->party() == pc_currchar->party()) {
// Check if the player allowed looting his corpse by party members
if (owner->party()->lootingAllowed().contains(owner)) {
allowed = true;
}
}
if (!allowed) {
pc_currchar->makeCriminal();
}
}
}
}
// Secure containers
if( pi->isLockedDown() && pi->secured() )
{
if( !pc_currchar->Owns( pi ) && !pc_currchar->isGM() )
{
socket->sysMessage( tr( "That is a secured chest!" ) );
return;
}
}
// Dead ppl can only use ankhs
if( pc_currchar->isDead() && pi->type() != 16 )
{
socket->sysMessage( tr( "Your ghostly hand passes trough the object." ) );
return;
}
// You can only use equipment on your own char
if( !pc_currchar->isGM() && pi->container() && pi->container()->isChar() && pi->container() != pc_currchar )
{
if( pi->layer() != 15 || !SrvParams->stealingEnabled() )
{
socket->sysMessage( tr( "You cannot use items equipped by other players." ) );
return;
}
}
// Call both events here
if( pc_currchar->onUse( pi ) )
return;
if( pi->onUse( pc_currchar ) )
return;
// Check item behaviour by it's tpye
switch (pi->type())
{
case 1: // normal containers
//.........这里部分代码省略.........