• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetTypeId函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetTypeId函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTypeId函数的具体用法?C++ GetTypeId怎么用?C++ GetTypeId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetTypeId函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetTotalAuraModifier

void Player::UpdateBlockPercentage()
{
    // No block
    float value = 0.0f;
    if (CanBlock())
    {
        // Base value
        value = 5.0f;
        // Increase from SPELL_AURA_MOD_BLOCK_PERCENT aura
        value += GetTotalAuraModifier(SPELL_AURA_MOD_BLOCK_PERCENT);

        // Custom MoP Script
        // 76671 - Mastery : Divine Bulwark - Block Percentage
        if (GetTypeId() == TYPEID_PLAYER && HasAura(76671))
            value += GetFloatValue(PLAYER_MASTERY);

        // Custom MoP Script
        // 76857 - Mastery : Critical Block - Block Percentage
        if (GetTypeId() == TYPEID_PLAYER && HasAura(76857))
            value += GetFloatValue(PLAYER_MASTERY) / 2.0f;

        // Increase from rating
        value += GetRatingBonusValue(CR_BLOCK);

         if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
             value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_BLOCK) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_BLOCK) : value;

        value = value < 0.0f ? 0.0f : value;
    }
    SetStatFloatValue(PLAYER_BLOCK_PERCENTAGE, value);
}
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:31,代码来源:StatSystem.cpp


示例2: TEST_F

TEST_F(TypeTests, GetInstanceTest) {
  for (auto col_type : typeTestTypes) {
    auto t = type::Type::GetInstance(col_type);
    EXPECT_NE(nullptr, t);
    EXPECT_EQ(col_type, t->GetTypeId());
  }
}
开发者ID:jessesleeping,项目名称:iso_peloton,代码行数:7,代码来源:type_test.cpp


示例3: GetModifierValue

void Player::UpdateArmor()
{
 float value = 0.0f;
UnitMods unitMod = UNIT_MOD_ARMOR;
value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items)
value *= GetModifierValue(unitMod, BASE_PCT); // armor percent from items
value += GetModifierValue(unitMod, TOTAL_VALUE);
// Custom MoP Script
// 77494 - Mastery : Nature's Guardian
if (GetTypeId() == TYPEID_PLAYER && HasAura(77494))
{
float Mastery = 1.0f + GetFloatValue(PLAYER_MASTERY) * 1.25f / 100.0f;
value *= Mastery;
}
//add dynamic flat mods
AuraEffectList const& mResbyIntellect = GetAuraEffectsByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
{
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
}
value *= GetModifierValue(unitMod, TOTAL_PCT);
SetArmor(int32(value));
    UpdateAttackPowerAndDamage();                           // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
}
开发者ID:xIchigox,项目名称:SoDCore.434,代码行数:25,代码来源:StatSystem.cpp


示例4: switch

    BOOL RecyclableObject::GetDiagTypeString(StringBuilder<ArenaAllocator>* stringBuilder, ScriptContext* requestContext)
    {
        switch(GetTypeId())
        {
        case TypeIds_Undefined:
            stringBuilder->AppendCppLiteral(_u("Undefined"));
            break;
        case TypeIds_Null:
            stringBuilder->AppendCppLiteral(_u("Null"));
            break;
        case TypeIds_Integer:
        case TypeIds_Number:
            stringBuilder->AppendCppLiteral(_u("Number"));
            break;
        case TypeIds_Boolean:
            stringBuilder->AppendCppLiteral(_u("Boolean"));
            break;
        case TypeIds_String:
            stringBuilder->AppendCppLiteral(_u("String"));
            break;
        default:
            stringBuilder->AppendCppLiteral(_u("Object, (Static Type)"));
            break;
        }

        return TRUE;
    }
开发者ID:280185386,项目名称:ChakraCore,代码行数:27,代码来源:StaticType.cpp


示例5: CanInteract

/////////////////////////////////////////////////
/// Interaction: Unit can interact with another unit (generic)
///
/// @note Relations API Tier 1
///
/// Client-side counterpart: <tt>CGUnit_C::CanInteract(const CGUnit_C *this, const CGUnit_C *unit)</tt>
/////////////////////////////////////////////////
bool Unit::CanInteract(const Unit* unit) const
{
    // Simple sanity check
    if (!unit)
        return false;

    // Original logic

    // Unit must be selectable
    if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
        return false;

    // Unit must have NPC flags so we can actually interact in some way
    if (!unit->GetUInt32Value(UNIT_NPC_FLAGS))
        return false;

    // We can't interact with anyone as a ghost except specially flagged NPCs
    if (GetTypeId() == TYPEID_PLAYER && static_cast<const Player*>(this)->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
    {
        if (unit->GetTypeId() != TYPEID_UNIT || !(static_cast<const Creature*>(unit)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_GHOST_VISIBLE))
            return false;
    }

    return (GetReactionTo(unit) > REP_UNFRIENDLY && unit->GetReactionTo(this) > REP_UNFRIENDLY);
}
开发者ID:Tobschinski,项目名称:mangos-classic,代码行数:32,代码来源:Relations.cpp


示例6: PL_ASSERT

CmpBool BooleanType::CompareGreaterThanEquals(const Value& left,
                                              const Value& right) const {
  PL_ASSERT(GetTypeId() == TypeId::BOOLEAN);
  PL_ASSERT(left.CheckComparable(right));
  if (left.IsNull() || right.IsNull()) return CMP_NULL;
  return BOOLEAN_COMPARE_FUNC(>=);
}
开发者ID:wy4515,项目名称:peloton,代码行数:7,代码来源:boolean_type.cpp


示例7: CheckInteger

std::string IntegerValue::ToString() const {
  CheckInteger();
  switch(GetTypeId()) {
    case Type::TINYINT:
      if (IsNull())
        return "tinyint_null";
      return std::to_string(value_.tinyint);
    case Type::SMALLINT:
      if (IsNull())
        return "smallint_null";
      return std::to_string(value_.smallint);
    case Type::INTEGER:
    case Type::PARAMETER_OFFSET:
      if (IsNull())
        return "integer_null";
      return std::to_string(value_.integer);
    case Type::BIGINT:
      if (IsNull())
        return "bigint_null";
      return std::to_string(value_.bigint);
    default:
      break;
  }
  throw Exception("type error");
}
开发者ID:ranxian,项目名称:peloton,代码行数:25,代码来源:numeric_value.cpp


示例8: PL_ASSERT

Value *BooleanValue::CompareGreaterThanEquals(const Value &o) const {
  PL_ASSERT(GetTypeId() == Type::BOOLEAN);
  CheckComparable(o);
  if (IsNull() || o.IsNull())
    return new BooleanValue(PELOTON_BOOLEAN_NULL);
  return new BooleanValue(value_.boolean >= o.GetAs<int8_t>());
}
开发者ID:ranxian,项目名称:peloton-1,代码行数:7,代码来源:boolean_value.cpp


示例9: PL_ASSERT

Value DecimalType::Modulo(const Value& left, const Value &right) const {
  PL_ASSERT(GetTypeId() == Type::DECIMAL);
  PL_ASSERT(left.CheckComparable(right));
  if (left.IsNull() || right.IsNull())
    return left.OperateNull(right);
  
  if (right.IsZero()) {
    throw Exception(EXCEPTION_TYPE_DIVIDE_BY_ZERO,
                    "Division by zero.");
  }
  switch(right.GetTypeId()) {
    case Type::TINYINT:
      return ValueFactory::GetDecimalValue(ValMod(left.value_.decimal, right.GetAs<int8_t>()));
    case Type::SMALLINT:
      return ValueFactory::GetDecimalValue(ValMod(left.value_.decimal, right.GetAs<int16_t>()));
    case Type::INTEGER:
      return ValueFactory::GetDecimalValue(ValMod(left.value_.decimal, right.GetAs<int32_t>()));
    case Type::BIGINT:
      return ValueFactory::GetDecimalValue(ValMod(left.value_.decimal, right.GetAs<int64_t>()));
    case Type::DECIMAL:
      return ValueFactory::GetDecimalValue(ValMod(left.value_.decimal, right.GetAs<double>()));
    default:
      throw Exception("type error");
  }
}
开发者ID:Michael-Tieying-Zhang,项目名称:peloton,代码行数:25,代码来源:decimal_type.cpp


示例10: CanInteractNow

/////////////////////////////////////////////////
/// Interaction: Unit can interact with another unit (immediate response)
///
/// @note Relations API Tier 1
///
/// Client-side counterpart: <tt>CGUnit_C::CanInteractNow(const CGUnit_C *this, const CGUnit_C *unit)</tt>
/////////////////////////////////////////////////
bool Unit::CanInteractNow(const Unit* unit) const
{
    // Simple sanity check
    if (!unit)
        return false;

    // Original logic

    // We can't intract while on taxi
    if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT))
        return false;

    // We can't interact while being charmed
    if (GetCharmerGuid())
        return false;

    // We can't interact with anyone while being dead (this does not apply to player ghosts, which allow very limited interactions)
    if (!isAlive() && (GetTypeId() == TYPEID_UNIT || !(static_cast<const Player*>(this)->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))))
        return false;

    // We can't interact with anyone while being shapeshifted, unless form flags allow us to do so
    if (IsShapeShifted())
    {
        if (SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm()))
        {
            if (!(formEntry->flags1 & SHAPESHIFT_FORM_FLAG_ALLOW_NPC_INTERACT))
                return false;
        }
    }

    // We can't interact with dead units, unless it's a creature with special flag
    if (!unit->isAlive())
    {
        if (GetTypeId() != TYPEID_UNIT || !(static_cast<const Creature*>(unit)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_INTERACT_DEAD))
            return false;
    }

    // We can't interact with charmed units
    if (unit->GetCharmerGuid())
        return false;

    // We can't interact with units who are currently fighting
    if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT) ||  unit->getVictim())
        return false;

    return CanInteract(unit);
}
开发者ID:Tobschinski,项目名称:mangos-classic,代码行数:54,代码来源:Relations.cpp


示例11: DoPetCastSpell

void Unit::DoPetCastSpell(Player* owner, uint8 cast_count, SpellCastTargets targets, const SpellEntry* spellInfo)
{
	// chained
    if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
        if (Pet *chainedPet = GetPet())
            if (((Creature*)this)->GetEntry() == chainedPet->GetEntry())
                chainedPet->DoPetCastSpell(owner, cast_count, targets, spellInfo);

	if(GetTypeId() != TYPEID_UNIT)
		return;

	Creature* pet = dynamic_cast<Creature*>(this);
	uint32 spellid = spellInfo->Id;

	clearUnitState(UNIT_STAT_MOVING);

    Spell *spell = new Spell(pet, spellInfo, false);
    spell->m_cast_count = cast_count;                       // probably pending spell cast
    spell->m_targets = targets;

    SpellCastResult result = spell->CheckPetCast(NULL);
    if (result == SPELL_CAST_OK)
    {
        pet->AddCreatureSpellCooldown(spellid);
        if (pet->isPet())
        {
            //10% chance to play special pet attack talk, else growl
            //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
            if(((Pet*)pet)->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
                pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
            else
                pet->SendPetAIReaction(pet->GetGUID());
        }

        spell->prepare(&(spell->m_targets));
    }
    else
    {
        pet->SendPetCastFail(spellid, result);
        if (!pet->HasSpellCooldown(spellid))
            owner->SendClearCooldown(spellid, pet);

        spell->finish(false);
        delete spell;
    }
}
开发者ID:AwkwardDev,项目名称:MangosFX,代码行数:46,代码来源:PetHandler.cpp


示例12: CheckIdResolver

            BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const
            {
                CheckIdResolver();

                int32_t fieldId = idRslvr->GetFieldId(GetTypeId(), name);
                int32_t pos = FindField(fieldId);

                return FromMemory(*mem, pos, metaMgr);
            }
开发者ID:ascherbakoff,项目名称:ignite,代码行数:9,代码来源:binary_object_impl.cpp


示例13: GetTotalAuraModValue

void Creature::UpdateMaxHealth()
{
    float value = GetTotalAuraModValue(UNIT_MOD_HEALTH);
    float hpDiff = GetMaxHealth() - GetHealth();
    SetMaxHealth((uint32)value);

    if (GetTypeId() == TYPEID_UNIT)
        SetHealth((uint32)(value - hpDiff));
}
开发者ID:Looking4Group,项目名称:L4G_Core,代码行数:9,代码来源:StatSystem.cpp


示例14: GetMap

void Corpse::RemoveFromWorld()
{
    ///- Remove the corpse from the accessor
    if(IsInWorld())
        sObjectAccessor.RemoveObject(this);

    Object::RemoveFromWorld();

    if (GetMap())
        GetMap()->AddProcessedObject(GetTypeId(), false);
}
开发者ID:xyuan,项目名称:mangos,代码行数:11,代码来源:Corpse.cpp


示例15: CopyFrom

int asCScriptObject::CopyFrom(asIScriptObject *other)
{
	if( other == 0 ) return asINVALID_ARG;

	if( GetTypeId() != other->GetTypeId() )
		return asINVALID_TYPE;

	*this = *(asCScriptObject*)other;

	return 0;
}
开发者ID:acremean,项目名称:urho3d,代码行数:11,代码来源:as_scriptobject.cpp


示例16: GetLength

std::string VarlenType::ToString(const Value &val) const {
  uint32_t len = GetLength(val);

  if (val.IsNull()) return "varlen_null";
  if (len == PELOTON_VARCHAR_MAX_LEN) return "varlen_max";
  if (len == 0) {
    return "";
  }
  if (GetTypeId() == TypeId::VARBINARY) return std::string(GetData(val), len);
  return std::string(GetData(val), len - 1);
}
开发者ID:wy4515,项目名称:peloton,代码行数:11,代码来源:varlen_type.cpp


示例17: CloneTooltip

VTooltip* VTooltip::CloneTooltip()
{
  VTooltip *pClone = (VTooltip *)GetTypeId()->CreateInstance();
  COPY_MEMBER(m_pContext);
  COPY_MEMBER(m_fDelay);
  *pClone->m_pText = *m_pText; // assignment operator
  COPY_MEMBER(m_iBackgroundColor);
  COPY_MEMBER(m_iBorderColor);
  COPY_MEMBER(m_fBorderSize);
  COPY_MEMBER(m_fTextBorder);

  return pClone;
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:13,代码来源:VTooltip.cpp


示例18: TEST_F

TEST_F(TimestampValueTests, CastTest) {
  type::Value result;

  auto strNull = type::ValueFactory::GetNullValueByType(type::TypeId::VARCHAR);
  auto valNull = type::ValueFactory::GetNullValueByType(type::TypeId::TIMESTAMP);

  result = valNull.CastAs(type::TypeId::TIMESTAMP);
  EXPECT_TRUE(result.IsNull());
  EXPECT_EQ(result.CompareEquals(valNull) == type::CMP_NULL, true);
  EXPECT_EQ(result.GetTypeId(), valNull.GetTypeId());

  result = valNull.CastAs(type::TypeId::VARCHAR);
  EXPECT_TRUE(result.IsNull());
  EXPECT_EQ(result.CompareEquals(strNull) == type::CMP_NULL, true);
  EXPECT_EQ(result.GetTypeId(), strNull.GetTypeId());

  EXPECT_THROW(valNull.CastAs(type::TypeId::BOOLEAN), peloton::Exception);

  auto valValid =
      type::ValueFactory::GetTimestampValue(static_cast<uint64_t>(1481746648));
  result = valValid.CastAs(type::TypeId::VARCHAR);
  EXPECT_FALSE(result.IsNull());
}
开发者ID:wy4515,项目名称:peloton,代码行数:23,代码来源:timestamp_value_test.cpp


示例19: OnApply

        void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
        {
            auto caster = GetCaster();
            auto target = GetTarget();
            if (!caster || !target)
                return;

            if (target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 60925 && !target->HasAura(106246))
            {
                if (auto player = caster->ToPlayer())
                    player->KilledMonsterCredit(target->GetEntry());
                target->CastSpell(target, 106246, true);
            }
        }
开发者ID:Exodius,项目名称:chuspi,代码行数:14,代码来源:townlong_steppes.cpp


示例20: printf

void Unit::CastSpell(Unit* victim, uint32 spellId)
{
    SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);

    if (!spellInfo)
    {
        printf("CastSpell: unknown spell id %i by caster: %s\n", spellId, (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"));
        return;
    }

    Spell* spell = new Spell(this, spellInfo);

    spell->prepare(victim);
}
开发者ID:Fredi,项目名称:Cpp,代码行数:14,代码来源:unit.cpp



注:本文中的GetTypeId函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetU16函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTypeID函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap