本文整理汇总了C++中IsOn函数的典型用法代码示例。如果您正苦于以下问题:C++ IsOn函数的具体用法?C++ IsOn怎么用?C++ IsOn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsOn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Modify
void ProjectionModifierTriesch::Modify()
{
if(IsOn() == false) return;
int processId = m_projectionFixed->PreLayer()->network()->MPIGetNodeId(); // will be put in mpi-class
if(processId == 0)
{
cout<<".";
cout.flush();
}
vector<float> postValues = m_projectionFixed->GetPostValues();
vector<vector<long> >* preIds;// = m_projectionFixed->PreIds(); // move to initializer (until Invalidate().. called)
long preId, postId;
float weight;
double totWeights;
float dw, normW;
float x,y;
// need max post id for N-function
vector<long> maxPostIds;// m_projectionFixed->PostLayer()->MPI()->MPIGetMaxIdInHypercolumns(); // usually only one
bool isMaxValue;
for(int j=0;j<postValues.size();j++)
{
if(postValues[j] == 1) // temporary test
{
vector<float> preValues = m_projectionFixed->GetPreValues(m_idsPost[j]);
postId = m_idsPost[j];
y = postValues[j];
isMaxValue = false;
for(int k=0;k<maxPostIds.size();k++)
{
if(postId == maxPostIds[k])
{
isMaxValue = true;
break;
}
}
float Ny = N(y,isMaxValue);
for(int i=0;i<preValues.size();i++)
{
preId = (*preIds)[j][i];
x = preValues[i];
weight = network()->GetWeight(preId,postId);
dw = x*y*Ny; // (alt: N implemented as an outside WTA)
weight = weight + m_etaHebb*dw;
network()->SetWeight(weight,preId,postId);
}
// weight normalization
totWeights = 0;
for(int i=0;i<preValues.size();i++)
{
preId = (*preIds)[j][i];
weight = network()->GetWeight(preId,postId);
totWeights += weight*weight;//pow((double)weight,2.0); // fabs(weight); // += weight;
}
totWeights = sqrt(totWeights);
if(totWeights > 0.0)
for(int i=0;i<preValues.size();i++)
{
preId = (*preIds)[j][i];
weight = network()->GetWeight(preId,postId);
weight = weight/totWeights;
network()->SetWeight(weight,preId,postId);
}
}
}
}
开发者ID:bernhardkaplan,项目名称:nexa,代码行数:85,代码来源:NetworkTriesch.cpp
示例2: Join
void Channel::Join(uint64 p, const char *pass)
{
WorldPacket data;
if (IsOn(p))
{
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
}
return;
}
if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
return;
}
Player *plr = ObjectAccessor::FindPlayer(p);
if (plr)
{
if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld->getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && plr->GetGroup())
{
MakeNotInLfg(&data);
SendToOne(&data, p);
return;
}
plr->JoinedChannel(this);
}
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld->getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
MakeJoined(&data, p);
SendToAll(&data);
}
data.clear();
PlayerInfo pinfo;
pinfo.player = p;
pinfo.flags = MEMBER_FLAG_NONE;
players[p] = pinfo;
MakeYouJoined(&data);
SendToOne(&data, p);
JoinNotify(p);
// if no owner first logged will become
if (!IsConstant() && !m_ownerGUID)
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}
/*
else if (!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID()))
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}*/
}
开发者ID:Bootz,项目名称:SkyFire_one,代码行数:73,代码来源:Channel.cpp
示例3: MakeNotMember
void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
{
AccountTypes sec = SEC_PLAYER;
Player *gplr = sObjectMgr->GetPlayer(good);
if (gplr)
sec = gplr->GetSession()->GetSecurity();
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
}
else
{
Player *bad = sObjectMgr->GetPlayer(badname);
if (bad == NULL || !IsOn(bad->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
}
else if (sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
SendToOne(&data, good);
}
else
{
bool changeowner = (m_ownerGUID == bad->GetGUID());
WorldPacket data;
if (ban && !IsBanned(bad->GetGUID()))
{
banned.insert(bad->GetGUID());
MakePlayerBanned(&data, bad->GetGUID(), good);
UpdateChannelInDB();
}
else
MakePlayerKicked(&data, bad->GetGUID(), good);
SendToAll(&data);
players.erase(bad->GetGUID());
bad->LeftChannel(this);
if (changeowner && m_ownership && !players.empty())
{
uint64 newowner = good;
players[newowner].SetModerator(true);
SetOwner(newowner);
}
}
}
}
开发者ID:Ekmek,项目名称:Antiker,代码行数:63,代码来源:Channel.cpp
示例4: Join
void Channel::Join(uint64 p, const char *pass)
{
WorldPacket data;
if (IsOn(p))
{
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
}
return;
}
if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
return;
}
Player *player = ObjectAccessor::FindPlayer(p);
if (player)
{
if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup())
{
MakeNotInLfg(&data);
SendToOne(&data, p);
return;
}
player->JoinedChannel(this);
}
if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
MakeJoined(&data, p);
SendToAll(&data);
}
data.clear();
PlayerInfo pinfo;
pinfo.player = p;
pinfo.flags = MEMBER_FLAG_NONE;
players[p] = pinfo;
MakeYouJoined(&data);
SendToOne(&data, p);
JoinNotify(p);
// Custom channel handling
if (!IsConstant())
{
// Update last_used timestamp in db
if (!players.empty())
UpdateChannelUseageInDB();
// If the channel has no owner yet and ownership is allowed, set the new owner.
if (!m_ownerGUID && m_ownership)
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}
}
}
开发者ID:Tiburan,项目名称:SkyFireEMU_rebase,代码行数:75,代码来源:Channel.cpp
示例5: MakeNotMember
void Channel::KickOrBan(Player* player, const char* targetName, bool ban)
{
ObjectGuid guid = player->GetObjectGuid();
if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, guid);
return;
}
if (!m_players[guid].IsModerator() && player->GetSession()->GetSecurity() < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, guid);
return;
}
Player* target = sObjectMgr.GetPlayer(targetName);
if (!target)
{
WorldPacket data;
MakePlayerNotFound(&data, targetName);
SendToOne(&data, guid);
return;
}
ObjectGuid targetGuid = target->GetObjectGuid();
if (!IsOn(targetGuid))
{
WorldPacket data;
MakePlayerNotFound(&data, targetName);
SendToOne(&data, guid);
return;
}
bool changeowner = m_ownerGuid == targetGuid;
if (player->GetSession()->GetSecurity() < SEC_GAMEMASTER && changeowner && guid != m_ownerGuid)
{
WorldPacket data;
MakeNotOwner(&data);
SendToOne(&data, guid);
return;
}
// kick or ban player
WorldPacket data;
if (ban && !IsBanned(targetGuid))
{
m_banned.insert(targetGuid);
MakePlayerBanned(&data, targetGuid, guid);
}
else
MakePlayerKicked(&data, targetGuid, guid);
SendToAll(&data);
m_players.erase(targetGuid);
target->LeftChannel(this);
if (changeowner)
{
ObjectGuid newowner = !m_players.empty() ? guid : ObjectGuid();
SetOwner(newowner);
}
}
开发者ID:249CAAFE40,项目名称:mangos-tbc,代码行数:69,代码来源:Channel.cpp
示例6: Join
void Channel::Join(Player* player, const char* password)
{
ObjectGuid guid = player->GetObjectGuid();
WorldPacket data;
if (IsOn(guid))
{
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, guid);
SendToOne(&data, guid);
}
return;
}
if (IsBanned(guid))
{
MakeBanned(&data);
SendToOne(&data, guid);
return;
}
if (m_password.length() > 0 && strcmp(password, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, guid);
return;
}
if (HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && player->GetSession()->GetSecurity() == SEC_PLAYER &&
(player->GetGroup() || player->m_lookingForGroup.Empty()))
{
MakeNotInLfg(&data);
SendToOne(&data, guid);
return;
}
if (player->GetGuildId() && (GetFlags() == 0x38))
return;
// join channel
player->JoinedChannel(this);
if (m_announce && (player->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
MakeJoined(&data, guid);
SendToAll(&data);
}
data.clear();
PlayerInfo& pinfo = m_players[guid];
pinfo.player = guid;
pinfo.flags = MEMBER_FLAG_NONE;
MakeYouJoined(&data);
SendToOne(&data, guid);
JoinNotify(guid);
// if no owner first logged will become
if (!IsConstant() && !m_ownerGuid)
{
SetOwner(guid, (m_players.size() > 1 ? true : false));
m_players[guid].SetModerator(true);
}
}
开发者ID:249CAAFE40,项目名称:mangos-tbc,代码行数:67,代码来源:Channel.cpp
示例7: MakeNotMember
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
AccountTypes sec = player->GetSession()->GetSecurity();
uint64 good = player->GetGUID();
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
return;
}
if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
return;
}
Player* bad = sObjectAccessor->FindPlayerByName(badname);
uint64 victim = bad ? bad->GetGUID() : 0;
if (!victim || !IsOn(victim))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
return;
}
bool changeowner = _ownerGUID == victim;
if (!AccountMgr::IsGMAccount(sec) && changeowner && good != _ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
SendToOne(&data, good);
return;
}
bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
if (ban && !IsBanned(victim))
{
bannedStore.insert(victim);
UpdateChannelInDB();
if (notify)
{
WorldPacket data;
MakePlayerBanned(&data, victim, good);
SendToAll(&data);
}
}
else if (notify)
{
WorldPacket data;
MakePlayerKicked(&data, victim, good);
SendToAll(&data);
}
playersStore.erase(victim);
bad->LeftChannel(this);
if (changeowner && _ownership && !playersStore.empty())
{
uint64 newowner = good;
playersStore[newowner].SetModerator(true);
SetOwner(newowner);
}
}
开发者ID:Amit86,项目名称:TrinityCore,代码行数:72,代码来源:Channel.cpp
示例8: IsOn
bool mitk::Overlay::IsVisible(mitk::BaseRenderer* renderer, const std::string& propertyKey, bool defaultIsOn) const
{
return IsOn(propertyKey, renderer, defaultIsOn);
}
开发者ID:AndreasFetzer,项目名称:MITK,代码行数:4,代码来源:mitkOverlay.cpp
示例9: MakeNotMember
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
ObjectGuid const& good = player->GetGUID();
if (!IsOn(good))
{
WorldPackets::Channel::ChannelNotify notify;
MakeNotMember(notify);
player->SendDirectMessage(notify.Write());
return;
}
if (!_playersStore[good].IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
WorldPackets::Channel::ChannelNotify notify;
MakeNotModerator(notify);
player->SendDirectMessage(notify.Write());
return;
}
Player* bad = ObjectAccessor::FindConnectedPlayerByName(badname);
ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim))
{
WorldPackets::Channel::ChannelNotify notify;
MakePlayerNotFound(notify, badname);
player->SendDirectMessage(notify.Write());
return;
}
bool changeowner = _ownerGUID == victim;
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && changeowner && good != _ownerGUID)
{
WorldPackets::Channel::ChannelNotify notify;
MakeNotOwner(notify);
player->SendDirectMessage(notify.Write());
return;
}
if (ban && !IsBanned(victim))
{
_bannedStore.insert(victim);
UpdateChannelInDB();
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
WorldPackets::Channel::ChannelNotify notify;
MakePlayerBanned(notify, victim, good);
SendToAll(notify.Write());
}
}
else if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
WorldPackets::Channel::ChannelNotify notify;
MakePlayerKicked(notify, victim, good);
SendToAll(notify.Write());
}
_playersStore.erase(victim);
bad->LeftChannel(this);
if (changeowner && _ownership && !_playersStore.empty())
{
_playersStore[good].SetModerator(true);
SetOwner(good);
}
}
开发者ID:Rastrian,项目名称:DeathCore_6.x-1,代码行数:68,代码来源:Channel.cpp
示例10: OffsetRect
AUI_ERRCODE TextSwitch::DrawThis( aui_Surface *surface, sint32 x, sint32 y )
{
if ( IsHidden() ) return AUI_ERRCODE_OK;
if ( !surface ) surface = m_window->TheSurface();
RECT rect = { 0, 0, m_width, m_height };
OffsetRect( &rect, m_x + x, m_y + y );
ToWindow( &rect );
if ( m_pattern )
m_pattern->Draw( surface, &rect );
primitives_FrameRect16(surface, &rect, g_colorSet->GetColor(COLOR_BLACK));
if ( IsOn() )
primitives_BevelRect16( surface, &rect, 2, 1, 16, 16 );
else
primitives_BevelRect16( surface, &rect, 2, 0, 16, 16 );
if ( IsActive() )
{
if ( IsOn() )
{
}
else
{
}
if (m_text) {
textutils_CenteredDropString(surface, m_text, &rect, 9, COLOR_BUTTON_TEXT_HILITE, 0);
}
}
else
{
if (m_text) {
textutils_CenteredDropString(surface, m_text, &rect, 9, COLOR_BUTTON_TEXT_PLAIN, 0);
}
}
if ( surface == m_window->TheSurface() )
m_window->AddDirtyRect( &rect );
return AUI_ERRCODE_OK;
}
开发者ID:talentlesshack,项目名称:C2P2,代码行数:76,代码来源:textswitch.cpp
示例11: JoinChannel
void Channel::JoinChannel(Player* player, std::string const& pass)
{
ObjectGuid const& guid = player->GetGUID();
if (IsOn(guid))
{
// Do not send error message for built-in channels
if (!IsConstant())
{
WorldPackets::Channel::ChannelNotify notify;
MakePlayerAlreadyMember(notify, guid);
player->SendDirectMessage(notify.Write());
}
return;
}
if (IsBanned(guid))
{
WorldPackets::Channel::ChannelNotify notify;
MakeBanned(notify);
player->SendDirectMessage(notify.Write());
return;
}
if (!_password.empty() && pass != _password)
{
WorldPackets::Channel::ChannelNotify notify;
MakeWrongPassword(notify);
player->SendDirectMessage(notify.Write());
return;
}
if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && //FIXME: Move to RBAC
player->GetGroup())
{
WorldPackets::Channel::ChannelNotify notify;
MakeNotInLfg(notify);
player->SendDirectMessage(notify.Write());
return;
}
player->JoinedChannel(this);
if (_announce && !player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
WorldPackets::Channel::ChannelNotify notify;
MakeJoined(notify, guid);
SendToAll(notify.Write());
}
PlayerInfo playerInfo;
playerInfo.PlayerGuid = guid;
_playersStore[guid] = playerInfo;
/*
WorldPackets::Channel::ChannelNotify notify;
MakeYouJoined(notify);
player->SendDirectMessage(notify.Write());
*/
WorldPackets::Channel::ChannelNotifyJoined notify;
//notify.ChannelWelcomeMsg = "";
notify.ChatChannelID = _channelId;
//notify.InstanceID = 0;
notify._ChannelFlags = _flags;
notify._Channel = _name;
player->SendDirectMessage(notify.Write());
JoinNotify(player);
// Custom channel handling
if (!IsConstant())
{
// Update last_used timestamp in db
if (!_playersStore.empty())
UpdateChannelUseageInDB();
// If the channel has no owner yet and ownership is allowed, set the new owner.
if (_ownerGUID.IsEmpty() && _ownership)
{
SetOwner(guid, _playersStore.size() > 1);
_playersStore[guid].SetModerator(true);
}
}
}
开发者ID:Rastrian,项目名称:DeathCore_6.x-1,代码行数:86,代码来源:Channel.cpp
示例12: VPROF_BUDGET
//===============================================================================
// Actualiza el estado (la configuración) de la proyección
//===============================================================================
bool CInternalLight::UpdateState( FlashlightState_t& state, const Vector &vecPos, const Vector &vecForward, const Vector &vecRight, const Vector &vecUp )
{
VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
// No esta encendida
if ( !IsOn() )
return false;
// Calculamos la posición y la orientación
if ( !m_nState.m_bGlobalLight ) {
if ( !ComputeLightPosAndOrientation( vecPos, vecForward, vecRight, vecUp, state.m_vecLightOrigin, state.m_quatOrientation ) )
return false;
}
//
state.m_fQuadraticAtten = m_nState.m_fQuadraticAtten;
state.m_fConstantAtten = m_nState.m_fConstantAtten;
state.m_fLinearAtten = m_nState.m_fLinearAtten;
// Color de la luz
state.m_Color[0] = m_nState.m_Color[0];
state.m_Color[1] = m_nState.m_Color[1];
state.m_Color[2] = m_nState.m_Color[2];
state.m_Color[3] = m_nState.m_Color[3];
state.m_fBrightnessScale = m_nState.m_fBrightnessScale;
// Distancia y FOV
state.m_NearZ = m_nState.m_NearZ + r_projectedtexture_nearoffsetscale.GetFloat() * m_flCurrentPullBackDist;
state.m_FarZ = m_nState.m_FarZ;
state.m_FarZAtten = m_nState.m_FarZAtten;
state.m_fHorizontalFOVDegrees = m_nState.m_fHorizontalFOVDegrees;
state.m_fVerticalFOVDegrees = m_nState.m_fVerticalFOVDegrees;
// Textura proyectada
state.m_pSpotlightTexture = m_nLightTexture;
state.m_pProjectedMaterial = NULL;
state.m_nSpotlightTextureFrame = 0;
// Luz Global
state.m_bGlobalLight = m_nState.m_bGlobalLight;
if ( state.m_bGlobalLight ) {
state.m_vecLightOrigin = vecPos;
state.m_quatOrientation = m_nState.m_quatOrientation;
}
// Ortho
state.m_bOrtho = m_nState.m_bOrtho;
if ( state.m_bOrtho ) {
state.m_fOrthoLeft = m_nState.m_fOrthoLeft;
state.m_fOrthoTop = m_nState.m_fOrthoTop;
state.m_fOrthoRight = m_nState.m_fOrthoRight;
state.m_fOrthoBottom = m_nState.m_fOrthoBottom;
}
// Propiedades de las sombras generadas
state.m_bEnableShadows = m_nState.m_bEnableShadows;
state.m_flShadowSlopeScaleDepthBias = g_pMaterialSystemHardwareConfig->GetShadowSlopeScaleDepthBias();
state.m_flShadowDepthBias = g_pMaterialSystemHardwareConfig->GetShadowDepthBias();
// Calidad de las sombras
if ( state.m_bEnableShadows ) {
state.m_flShadowAtten = r_projectedtexture_shadowatten.GetFloat();
state.m_bShadowHighRes = m_nState.m_bShadowHighRes;
state.m_nShadowQuality = m_nState.m_nShadowQuality;
state.m_flShadowFilterSize = (m_nState.m_flShadowFilterSize > 0) ? m_nState.m_flShadowFilterSize : r_projectedtexture_filter.GetFloat();
ConVarRef r_flashlightdepthreshigh( "r_flashlightdepthreshigh" );
ConVarRef r_flashlightdepthres( "r_flashlightdepthres" );
if ( state.m_bShadowHighRes ) {
state.m_flShadowMapResolution = r_flashlightdepthreshigh.GetFloat();
}
else {
state.m_flShadowMapResolution = r_flashlightdepthres.GetFloat();
}
}
/*state.m_flNoiseStrength = 0.8f;
state.m_nNumPlanes = 64;
state.m_flPlaneOffset = 0.0f;
state.m_bVolumetric = true;
state.m_flVolumetricIntensity = 1.0f;*/
return true;
}
开发者ID:WootsMX,项目名称:InSource,代码行数:90,代码来源:c_projectedlight.cpp
示例13: FadeUp
boolean Segment::On () {
if (!IsOn()) {
FadeUp();
}
return IsOn();
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:6,代码来源:segment.c
示例14: JoinChannel
void Channel::JoinChannel(Player* player, std::string const& pass)
{
ObjectGuid const& guid = player->GetGUID();
if (IsOn(guid))
{
// Do not send error message for built-in channels
if (!IsConstant())
{
PlayerAlreadyMemberAppend appender(guid);
ChannelNameBuilder<PlayerAlreadyMemberAppend> builder(this, appender);
SendToOne(builder, guid);
}
return;
}
if (IsBanned(guid))
{
BannedAppend appender;
ChannelNameBuilder<BannedAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
if (!_channelPassword.empty() && pass != _channelPassword)
{
WrongPasswordAppend appender;
ChannelNameBuilder<WrongPasswordAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && //FIXME: Move to RBAC
player->GetGroup())
{
NotInLFGAppend appender;
ChannelNameBuilder<NotInLFGAppend> builder(this, appender);
SendToOne(builder, guid);
return;
}
player->JoinedChannel(this);
if (_announceEnabled && !player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
JoinedAppend appender(guid);
ChannelNameBuilder<JoinedAppend> builder(this, appender);
SendToAll(builder);
}
bool newChannel = _playersStore.empty();
PlayerInfo& playerInfo = _playersStore[guid];
playerInfo.SetInvisible(!player->isGMVisible());
/*
YouJoinedAppend appender;
ChannelNameBuilder<YouJoinedAppend> builder(this, appender);
SendToOne(builder, guid);
*/
auto builder = [&](LocaleConstant /*locale*/)
{
WorldPackets::Channel::ChannelNotifyJoined* notify = new WorldPackets::Channel::ChannelNotifyJoined();
//notify->ChannelWelcomeMsg = "";
notify->ChatChannelID = _channelId;
//notify->InstanceID = 0;
notify->_ChannelFlags = _channelFlags;
notify->_Channel = _channelName;
return notify;
};
SendToOne(builder, guid);
JoinNotify(player);
// Custom channel handling
if (!IsConstant())
{
// Update last_used timestamp in db
if (!_playersStore.empty())
UpdateChannelUseageInDB();
// If the channel has no owner yet and ownership is allowed, set the new owner.
// or if the owner was a GM with .gm visible off
// don't do this if the new player is, too, an invis GM, unless the channel was empty
if (_ownershipEnabled && (newChannel || !playerInfo.IsInvisible()) && (_ownerGuid.IsEmpty() || _isOwnerInvisible))
{
_isOwnerInvisible = playerInfo.IsInvisible();
SetOwner(guid, !newChannel && !_isOwnerInvisible);
playerInfo.SetModerator(true);
}
}
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:96,代码来源:Channel.cpp
示例15: Say
void Channel::Say(Player* player, const char* text, uint32 lang)
{
if (!text)
return;
uint32 sec = 0;
ObjectGuid guid = player->GetObjectGuid();
Player* plr = sObjectMgr.GetPlayer(guid);
bool speakInLocalDef = false;
bool speakInWorldDef = false;
if (plr)
{
sec = plr->GetSession()->GetSecurity();
if (plr->isGameMaster())
{
speakInLocalDef = true;
speakInWorldDef = true;
}
HonorRankInfo honorInfo = plr->GetHonorRankInfo();
//We can speak in local defense if we're above this rank (see .h file)
if (honorInfo.rank >= SPEAK_IN_LOCALDEFENSE_RANK)
speakInLocalDef = true;
// Are we not allowed to speak in WorldDefense at all?
// if (honorInfo.rank >= SPEAK_IN_WORLDDEFENSE_RANK)
// speakInWorldDef = true;
}
if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, guid);
return;
}
else if (m_players[guid].IsMuted() ||
(GetChannelId() == CHANNEL_ID_LOCAL_DEFENSE && !speakInLocalDef) ||
(GetChannelId() == CHANNEL_ID_WORLD_DEFENSE && !speakInWorldDef))
{
WorldPacket data;
MakeMuted(&data);
SendToOne(&data, guid);
return;
}
if (m_moderate && !m_players[guid].IsModerator() && player->GetSession()->GetSecurity() < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, guid);
return;
}
// send channel message
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, text, Language(lang), player->GetChatTag(), guid, player->GetName(), ObjectGuid(), "", m_name.c_str(), player->GetHonorRankInfo().rank);
SendToAll(&data, !m_players[guid].IsModerator() ? guid : ObjectGuid());
}
开发者ID:muscnx,项目名称:Mangos021SD2,代码行数:61,代码来源:Channel.cpp
示例16: LeaveChannel
void Channel::LeaveChannel(Player* player, bool send)
{
ObjectGuid const& guid = player->GetGUID();
if (!IsOn(guid))
{
if (send)
{
NotMemberAppend appender;
ChannelNameBuilder<NotMemberAppend> builder(this, appender);
SendToOne(builder, guid);
}
return;
}
player->LeftChannel(this);
if (send)
{
/*
YouLeftAppend appender;
ChannelNameBuilder<YouLeftAppend> builder(this, appender);
SendToOne(builder, guid);
*/
auto builder = [&](LocaleConstant locale)
{
LocaleConstant localeIdx = sWorld->GetAvailableDbcLocale(locale);
WorldPackets::Channel::ChannelNotifyLeft* notify = new WorldPackets::Channel::ChannelNotifyLeft();
notify->Channel = GetName(localeIdx);
notify->ChatChannelID = 0;
//notify->Suspended = false;
return notify;
};
SendToOne(builder, guid);
}
PlayerInfo& info = _playersStore.at(guid);
bool changeowner = info.IsOwner();
_playersStore.erase(guid);
if (_announceEnabled && !player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
LeftAppend appender(guid);
ChannelNameBuilder<LeftAppend> builder(this, appender);
SendToAll(builder);
}
LeaveNotify(player);
if (!IsConstant())
{
// Update last_used timestamp in db
UpdateChannelUseageInDB();
// If the channel owner left and there are still playersStore inside, pick a new owner
// do not pick invisible gm owner unless there are only invisible gms in that channel (rare)
if (changeowner && _ownershipEnabled && !_playersStore.empty())
{
PlayerContainer::iterator itr;
for (itr = _playersStore.begin(); itr != _playersStore.end(); ++itr)
{
if (!itr->second.IsInvisible())
break;
}
if (itr == _playersStore.end())
itr = _playersStore.begin();
ObjectGuid const& newowner = itr->first;
itr->second.SetModerator(true);
SetOwner(newowner);
// if the new owner is invisible gm, set flag to automatically choose a new owner
if (itr->second.IsInvisible())
_isOwnerInvisible = true;
}
}
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:81,代码来源:Channel.cpp
示例17: builder
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
ObjectGuid const& good = player->GetGUID();
if (!IsOn(good))
{
NotMemberAppend appender;
ChannelNameBuilder<NotMemberAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
PlayerInfo& info = _playersStore.at(good);
if (!info.IsModerator() && !player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
NotModeratorAppend appender;
ChannelNameBuilder<NotModeratorAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
Player* bad = ObjectAccessor::FindConnectedPlayerByName(badname);
ObjectGuid const& victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim))
{
PlayerNotFoundAppend appender(badname);
ChannelNameBuilder<PlayerNotFoundAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
bool changeowner = _ownerGuid == victim;
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && changeowner && good != _ownerGuid)
{
NotOwnerAppend appender;
ChannelNameBuilder<NotOwnerAppend> builder(this, appender);
SendToOne(builder, good);
return;
}
if (ban && !IsBanned(victim))
{
_bannedStore.insert(victim);
UpdateChannelInDB();
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
PlayerBannedAppend appender(good, victim);
ChannelNameBuilder<PlayerBannedAppend> builder(this, appender);
SendToAll(builder);
}
}
else if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_SILENTLY_JOIN_CHANNEL))
{
PlayerKickedAppend appender(good, victim);
ChannelNameBuilder<PlayerKickedAppend> builder(this, appender);
SendToAll(builder);
}
_playersStore.erase(victim);
bad->LeftChannel(this);
if (changeowner && _ownershipEnabled && !_playersStore.empty())
{
info.SetModerator(true);
SetOwner(good);
}
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:69,代码来源:Channel.cpp
示例18: Join
void Channel::Join(ObjectGuid p, const char* pass)
{
WorldPacket data;
if (IsOn(p))
{
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
}
return;
}
if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
return;
}
Player* plr = sObjectMgr.GetPlayer(p);
if (plr)
{
if (HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER)
{
MakeNotInLfg(&data);
SendToOne(&data, p);
return;
}
if (plr->GetGuildId() && (GetFlags() == 0x38))
return;
plr->JoinedChannel(this);
}
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
MakeJoined(&data, p);
SendToAll(&data);
}
data.clear();
PlayerInfo& pinfo = m_players[p];
pinfo.player = p;
pinfo.flags = 0;
MakeYouJoined(&data);
SendToOne(&data, p);
JoinNotify(p);
// if no owner first logged will become
if (!IsConstant() && !m_ownerGuid)
{
SetOwner(p, (m_players.size() > 1 ? true : false));
m_players[p].SetModerator(true);
}
}
开发者ID:Chuck5ta,项目名称:server-4,代码行数:68,代码来源:Channel.cpp
示例19: IsOn
bool CPrefsDialog::OKClicked()
{
font_family defFamily;
font_style defStyle;
be_plain_font->GetFamilyAndStyle(&defFamily, &defStyle);
gPrefs->SetPrefString("defdoc font family", fNewFontFamily);
gPrefs->SetPrefString("defdoc font style", defStyle);
gPrefs->SetPrefDouble("defdoc font size", fNewFontSize);
be_bold_font->GetFamilyAndStyle(&defFamily, &defStyle);
gPrefs->SetPrefString("border font family", fNewBFontFamily);
gPrefs->SetPrefString("border font style", defStyle);
gPrefs->SetPrefDouble("border font size", fNewBFontSize);
gPrefs->SetPrefInt("decimal point", *GetText("decsep"));
gPrefs->SetPrefInt("thousands separator", *GetText("thoussep"));
gPrefs->SetPrefInt("list separator", *GetText("listsep"));
gPrefs->SetPrefInt("date separator", *GetText("datesep"));
gPrefs->SetPrefInt("time separator", *GetText("timesep"));
gPrefs->SetPrefString("date order", fDMY->FindMarked()->Label());
gPrefs->SetPrefInt("24 hours", IsOn("24 hours"));
gPrefs->SetPrefInt("Excel keys", IsOn("excel"));
gPrefs->SetPrefInt("Select Gray", IsOn("grayselect"));
gPrefs->SetPrefInt("start with new", IsOn("donew"));
gWithEqualSign = IsOn("formula starts with equal");
gPrefs->SetPrefInt("formula starts with equal", gWithEqualSign);
gPrefs->SetPrefInt("dark gridlines", IsOn("dark gridlines"));
if (gPrefs->GetPrefInt("dark gridlines", 0))
gGridColor = 10;
else
gGridColor = 6;
gPrefs->SetPrefString("c_symbol", GetText("c_symbol"));
gPrefs->SetPrefInt("c_before", IsOn("c_before"));
gPrefs->SetPrefInt("c_neg_par", IsOn("c_neg_par"));
gPrefs->SetPrefInt("c_digits", atoi(GetText("c_digits")));
if (fPageSetup)
{
char *ps = Bin2Hex(fPageSetup, fPageSetupSize);
gPrefs->SetPrefString("default page setup", ps);
FREE(ps);
}
BMessage msg(msg_WindowOptions);
msg.AddString("docfamily", fDocFontFamily);
msg.AddString("docstyle", "Roman");
msg.AddFloat("docsize", fDocFontSize);
msg.AddString("borderfamily", fDocBFontFamily);
msg.AddString("borderstyle", "Bold");
msg.AddFloat("bordersize", fDocBFontSize);
msg.AddBool("autorecalc", IsOn("autorecalc"));
msg.AddBool("displayzero", IsOn("displayzero"));
msg.AddBool("dispgrid", IsOn("dispgrid"));
msg.AddBool("disphead", IsOn("disphead"));
msg.AddBool("prgrid", IsOn("prgrid"));
msg.AddBool("prhead", IsOn("prhead"));
fOwner->PostMessage(&msg, fOwner->GetCellView());
BButton *b;
b = (BButton *)FindView("ok");
b->SetEnabled(false);
b = (BButton *)FindView("cancel");
b->SetEnabled(false);
InitFormatter();
return false;
} /* CPrefsDialog::OKClicked */
开发者ID:ModeenF,项目名称:OpenSumIt,
|
请发表评论