当前位置: 首页>>代码示例>>C++>>正文


C++ GetTypeId函数代码示例

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


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


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