本文整理汇总了C++中CGuild::getAllegiance方法的典型用法代码示例。如果您正苦于以下问题:C++ CGuild::getAllegiance方法的具体用法?C++ CGuild::getAllegiance怎么用?C++ CGuild::getAllegiance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGuild
的用法示例。
在下文中一共展示了CGuild::getAllegiance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _inviteCharacterInGuild
//----------------------------------------------------------------------------
void CGuildMemberModule::_inviteCharacterInGuild(CGuildCharProxy& invitor, CGuildCharProxy& target)const
{
CGuild * guild = EGS_PD_CAST<CGuild*>( _GuildMemberCore->getGuild() );
EGS_PD_AST( guild );
SM_STATIC_PARAMS_1( params1, STRING_MANAGER::player );
params1[0].setEIdAIAlias( target.getId(), CAIAliasTranslator::getInstance()->getAIAlias( target.getId()) );
/// check invitor grade
if ( !canInvite() )
{
CCharacter::sendDynamicSystemMessage( invitor.getRowId(), "GUILD_INSUFFICIENT_GRADE",params1 );
return;
}
/// target must not have a guild
CGuildMemberModule * guildModule;
if ( target.getModule( guildModule ) )
{
invitor.sendSystemMessage("GUILD_ALREADY_MEMBER",params1);
return;
}
/// target must not be invited
CGuildInvitationModule * inviteModule;
if ( target.getModule(inviteModule) )
{
CCharacter::sendDynamicSystemMessage( invitor.getRowId(), "GUILD_ALREADY_HAS_JOIN_PROPOSAL",params1 );
return;
}
/// the invitor must not be in the ignore list of the target
{
CCharacter * invitedChar = PlayerManager.getChar(target.getId());
if( invitedChar == 0 ) return;
if(invitedChar->hasInIgnoreList(invitor.getId()))
{
// Use the standard "player declines your offer". Don't use specific message because
// maybe not a good idea to inform a player that someone ignores him
CCharacter::sendDynamicSystemMessage( invitor.getRowId(), "GUILD_REFUSE_JOIN",params1 );
return;
}
}
/// target must not be an outpost pvp enemy of the invitor's guild
CCharacter * invitorPlayer = PlayerManager.getChar( invitor.getEntityRowId() );
if( invitorPlayer )
{
CEntityBase * targetEntity = CEntityBaseManager::getEntityBasePtr( target.getEntityRowId() );
if(targetEntity)
{
if( targetEntity->getOutpostAlias() !=0 )
{
CSmartPtr<COutpost> outpost = COutpostManager::getInstance().getOutpostFromAlias( targetEntity->getOutpostAlias() );
if( outpost )
{
if( (outpost->getOwnerGuild()==invitorPlayer->getGuildId() && targetEntity->getOutpostSide()==OUTPOSTENUMS::OutpostAttacker) ||
(outpost->getAttackerGuild()==invitorPlayer->getGuildId() && targetEntity->getOutpostSide()==OUTPOSTENUMS::OutpostOwner) )
{
CCharacter::sendDynamicSystemMessage( invitor.getRowId(), "GUILD_CANT_INVITE_OUTPOST_ENEMY" );
return;
}
}
else
{
nlwarning("<CGuildMemberModule::inviteTargetInGuild> can't get outpost %d of target",targetEntity->getOutpostAlias() );
}
}
}
else
{
nlwarning("<CGuildMemberModule::inviteTargetInGuild> can't get target %s",target.getId().toString().c_str() );
}
}
else
{
nlwarning("<CGuildMemberModule::inviteTargetInGuild> can't get char from invitor %s",invitor.getId().toString().c_str() );
}
/// check if there is room in the guild
if ( guild->getMemberCount() >= GuildMaxMemberCount )
{
SM_STATIC_PARAMS_1(params,STRING_MANAGER::integer);
params[0].Int = GuildMaxMemberCount;
CCharacter::sendDynamicSystemMessage( invitor.getRowId(), "GUILD_MAX_MEMBER_COUNT", params);
return;
}
/// check guild and invited member allegiances compatibilities
CGuild::TAllegiances guildAllegiance, invitedAllegiance;
guildAllegiance = guild->getAllegiance();
CCharacter * invitedChar = PlayerManager.getChar(target.getId());
if( invitedChar == 0 ) return;
invitedAllegiance = invitedChar->getAllegiance();
if( invitedAllegiance.first != guildAllegiance.first && invitedAllegiance.first != PVP_CLAN::Neutral )
{
SM_STATIC_PARAMS_2( params, STRING_MANAGER::player, STRING_MANAGER::faction );
params[0].setEIdAIAlias( target.getId(), CAIAliasTranslator::getInstance()->getAIAlias( target.getId()) );
params[1].Enum = PVP_CLAN::getFactionIndex(invitedAllegiance.first);
//.........这里部分代码省略.........