當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。