Example #1
0
void Player::UpdateArmor()
{
    UnitMods unitMod = UNIT_MOD_ARMOR;

    float value = GetModifierValue(unitMod, BASE_VALUE);    // base armor (from items)
    value *= GetModifierValue(unitMod, BASE_PCT);           // armor percent from items
    value += GetModifierValue(unitMod, TOTAL_VALUE);

    //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));

    Pet* pet = GetPet();
    if (pet)
        pet->UpdateArmor();

    UpdateAttackPowerAndDamage();                           // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
}
Example #2
0
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 += GetStat(STAT_AGILITY) * 2.0f;                  // armor bonus from stats
    value += GetModifierValue(unitMod, TOTAL_VALUE);

    // add dynamic flat mods
    AuraList const& mResbyIntellect = GetAurasByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
    for (AuraList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
    {
        Modifier* mod = (*i)->GetModifier();
        if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
            value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f);
    }

    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));

    Pet* pet = GetPet();
    if (pet)
        pet->UpdateArmor();

    UpdateAttackPowerAndDamage();                           // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
}
Example #3
0
void Pet::UpdateArmor()
{
    float value = 0.0f;
    float bonus_armor = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    Unit *owner = GetOwner();
    // chained, use original owner instead
    if (owner && owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->GetEntry() == GetEntry())
        if (Unit *creator = GetCreator())
            owner = creator;

    // hunter and warlock and shaman pets gain 35% of owner's armor value
    if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET 
        && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_SHAMAN))))
        bonus_armor = 0.35f * float(owner->GetArmor());

    value  = GetModifierValue(unitMod, BASE_VALUE);
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetStat(STAT_AGILITY);
    value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #4
0
void Player::UpdateArmor()
{
    UnitMods unitMod = UNIT_MOD_ARMOR;

    float value = GetModifierValue(unitMod, BASE_VALUE);    // base armor (from items)
    value *= GetModifierValue(unitMod, BASE_PCT);           // armor percent from items
    value += GetModifierValue(unitMod, TOTAL_VALUE);

    //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());
    }

    if (GetShapeshiftForm() == FORM_BEAR)
        // Thick Hide
        if (AuraEffect* thickHide = GetDummyAuraEffect(SPELLFAMILY_GENERIC, 1558, EFFECT_1))
            AddPct(value, thickHide->GetAmount());

    value *= GetModifierValue(unitMod, TOTAL_PCT);
    SetArmor(int32(value));
    RecalculatePetsScalingResistance(SPELL_SCHOOL_NORMAL);
    UpdateAttackPowerAndDamage();                           // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
}
Example #5
0
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 += GetStat(STAT_AGILITY) * 2.0f;                  // armor bonus from stats
    value += GetModifierValue(unitMod, TOTAL_VALUE);

    //add dynamic flat mods
    AuraList const& mResbyIntellect = GetAurasByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
    for (AuraList::const_iterator i = mResbyIntellect.begin();i != mResbyIntellect.end(); ++i)
    {
        Modifier* mod = (*i)->GetModifier();
        if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
            value += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetModifierValue() / 100.0f);
    }

    value *= GetModifierValue(unitMod, TOTAL_PCT);

    if (HasAura(5229,0))
        value -= HasAura(9634,0) ? 0.16*value : 0.27*value;

    SetArmor(int32(value));

    Pet *pet = GetPet();
    if (pet)
        pet->UpdateArmor();
}
Example #6
0
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
}
Example #7
0
void Guardian::UpdateArmor()
{ 
    float value = GetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE);
    value *= GetModifierValue(UNIT_MOD_ARMOR, BASE_PCT);
	value += std::max<float>(GetStat(STAT_AGILITY) - GetCreateStat(STAT_AGILITY), 0.0f) * 2.0f;
    value += GetModifierValue(UNIT_MOD_ARMOR, TOTAL_VALUE);
    value *= GetModifierValue(UNIT_MOD_ARMOR, TOTAL_PCT);
    SetArmor(int32(value));
}
Example #8
0
void Guardian::UpdateArmor()
{
    float value = GetTotalAuraModValue(UNIT_MOD_ARMOR);
    UnitMods unitMod = UNIT_MOD_ARMOR;

    // All pets gain 100% of owner's armor value
    value += float(CalculatePct(m_owner->GetArmor(), 70));

    SetArmor(int32(value));
}
Example #9
0
void CCheatMgr::SetKFA()
{
    s_CheatInfo[CHEAT_KFA].bActive = LTTRUE;

	// Give us all weapons, ammo, armor, and health...
	SetFullWeapons(); // Gives us all ammo too
	SetHealth(LTFALSE);
	SetArmor();

    g_pChatMsgs->AddMessage("Knock em out the box Luke...",kMsgCheatConfirm);
}
Example #10
0
void CCheatMgr::SetKFA()
{
    s_CheatInfo[CHEAT_KFA].bActive = true;

	// Give us all weapons, ammo, armor, and health...
	SetFullWeapons(); // Gives us all ammo too
	SetHealth(false);
	SetArmor();

//    g_pGameMsgs->AddMessage(L"Knock em out the box Luke...",kMsgCheatConfirm);
}
Example #11
0
void Guardian::UpdateArmor()
{
    float value = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    value  = GetModifierValue(unitMod, BASE_VALUE);
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE);
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #12
0
void Pet::UpdateArmor()
{
    float value = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    value  = GetModifierValue(unitMod, BASE_VALUE) + GetStat(STAT_AGILITY) * 2.0f;
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE);
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #13
0
void Guardian::UpdateArmor()
{
    float value = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    // All pets gain 100% of owner's armor value
    value = m_owner->GetArmor();
    value *= GetModifierValue(unitMod, BASE_PCT);
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #14
0
void Guardian::UpdateArmor()
{
    float value = 0.0f;
    float bonus_armor = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    // hunter and warlock pets gain 35% of owner's armor value
    if (isPet())
        bonus_armor = float(CalculatePctN(m_owner->GetArmor(), 35));

    value  = GetModifierValue(unitMod, BASE_VALUE);
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #15
0
void Guardian::UpdateArmor()
{
    float value = 0.0f;
    float bonus_armor = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    // hunter and warlock pets gain 35% of owner's armor value
    if(isPet()&&!IsPetGhoul())
        bonus_armor = 0.35f * float(m_owner->GetArmor());

    value  = GetModifierValue(unitMod, BASE_VALUE);
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetStat(STAT_AGILITY) * 2.0f;
    value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #16
0
void Enemy::Reset(int index, BulletManager * bulletManager)
{
	//1 = enemy, 2 = boss
	if (index == 1)
	{
		position.y = -32;
		position.x = (rand()%150)+1;
	}
	
	if (index == 2)
	{
		position.x = (rand()%150)+1;
		position.y = -64;
		SetHull(GetMaxHull());
		SetShields(GetMaxShields());
		SetArmor(GetMaxArmor());
	}
}
Example #17
0
void Pet::UpdateArmor()
{
    float bonus_armor = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    Unit* owner = GetOwner();
    // hunter and warlock pets gain 35% of owner's armor value
    if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
        bonus_armor = 0.35f * float(owner->GetArmor());

    float value = GetModifierValue(unitMod, BASE_VALUE);
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetStat(STAT_AGILITY) * 2.0f;
    value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #18
0
bool CArmor::MyTouch( CBasePlayer *pPlayer )
{
	if ( SetArmor(pPlayer) )
	{
		CSingleUserRecipientFilter user( pPlayer );
		user.MakeReliable();

		UserMessageBegin( user, "ItemPickup" );
			WRITE_STRING( GetClassname() );
		MessageEnd();

		if(Q_strcmp(this->GetClassname(), "item_armor_small") == 0)
		{
			CPASAttenuationFilter filter( pPlayer, "Armor_Small.Touch" );
			EmitSound( filter, pPlayer->entindex(), "Armor_Small.Touch" );
		}
		else if(Q_strcmp(this->GetClassname(), "item_armor_medium") == 0)
		{
			CPASAttenuationFilter filter( pPlayer, "Armor_Medium.Touch" );
			EmitSound( filter, pPlayer->entindex(), "Armor_Medium.Touch" );
		}
		else
		{
			CPASAttenuationFilter filter( pPlayer, "Armor_Large.Touch" );
			EmitSound( filter, pPlayer->entindex(), "Armor_Large.Touch" );

		}

		if ( g_pGameRules->ItemShouldRespawn( this ) )
		{
			Respawn();
		}
		else
		{
			UTIL_Remove(this);	
		}

		return true;
	}

	return false;
}
CHeavyInfantry::CHeavyInfantry(void) : CEnemy(WEP_PISTOL)
{
    SetEnemyID(ENEMY_HEAVY);
    SetMaxHealth(200);
    SetHealth(GetMaxHealth());
//	SetImageID(CSGD_TextureManager::GetInstance()->LoadTexture("Resource\\Graphics\\HeavyInfantry_editor.png"));
    SetAnimation(CAnimationManager::GetInstance()->LoadAnimation("Resource\\Data\\Animations\\JeG_HeavyInfantry.bin"));
    GetAnimation()->currAnimation->Play();
    SetMoneyReward(25);
    SetRepReward(10);
    SetWidth(32);
    SetHeight(32);
    SetArmor(25);
    SetSpeed(25.0f);
    CEventSystem::GetInstance()->RegisterClient("big.bang",this);
    CEventSystem::GetInstance()->RegisterClient("form.up",this);
    CEventSystem::GetInstance()->RegisterClient("engage.player",this);
    CEventSystem::GetInstance()->RegisterClient("over.here",this);
    CEventSystem::GetInstance()->RegisterClient("player.detected",this);
    CEventSystem::GetInstance()->RegisterClient("fire.bullet",this);
}
Example #20
0
void Player::UpdateArmor()
{
    float value;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    value  = GetModifierValue(unitMod, BASE_VALUE);         // base armor (from items)
    value *= GetModifierValue(unitMod, BASE_PCT);           // armor percent from items
    value += GetStat(STAT_AGILITY) * 2.0f;                  // armor bonus from stats
    value += GetModifierValue(unitMod, TOTAL_VALUE);

    // add dynamic flat mods
    AuraList const& mResbyIntellect = GetAurasByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
    for (AuraList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
    {
        Modifier* mod = (*i)->GetModifier();
        if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
            { value += int32(GetStat(STAT_INTELLECT) * mod->m_amount / 100.0f); }
    }

    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #21
0
void Creature::UpdateArmor()
{
    float value = GetTotalAuraModValue(UNIT_MOD_ARMOR);
    SetArmor(int32(value));
}
Example #22
0
bool Creature::CreateFromProto(uint32 guidlow,uint32 Entry)
{
    Object::_Create(guidlow, HIGHGUID_UNIT);

    m_DBTableGuid = guidlow;

    SetUInt32Value(OBJECT_FIELD_ENTRY,Entry);
    CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry);
    if(!cinfo)
    {
        sLog.outError("Error: creature entry %u does not exist.",Entry);
        return false;
    }
    uint32 rank = isPet()? 0 : cinfo->rank;
    float damagemod = _GetDamageMod(rank);;

    uint32 display_id = cinfo->randomDisplayID();

    SetUInt32Value(UNIT_FIELD_DISPLAYID,display_id );
    SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID,display_id );
    SetUInt32Value(UNIT_FIELD_BYTES_2,1);                   // let creature used equiped weapon in fight

    SetName(GetCreatureInfo()->Name);

    SelectLevel(cinfo);

    SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction);

    SetUInt32Value(UNIT_NPC_FLAGS,cinfo->npcflag);

    SetFloatValue(UNIT_FIELD_MINDAMAGE,cinfo->mindmg * damagemod);
    SetFloatValue(UNIT_FIELD_MAXDAMAGE,cinfo->maxdmg * damagemod);

    SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE,cinfo->minrangedmg * damagemod);
    SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE,cinfo->maxrangedmg * damagemod);

    SetAttackTime(BASE_ATTACK,  cinfo->baseattacktime);
    SetAttackTime(RANGED_ATTACK,cinfo->rangeattacktime);

    SetUInt32Value(UNIT_FIELD_FLAGS,cinfo->Flags);
    SetUInt32Value(UNIT_DYNAMIC_FLAGS,cinfo->dynamicflags);

    SetArmor(cinfo->armor);
    SetResistance(SPELL_SCHOOL_HOLY,cinfo->resistance1);
    SetResistance(SPELL_SCHOOL_FIRE,cinfo->resistance2);
    SetResistance(SPELL_SCHOOL_NATURE,cinfo->resistance3);
    SetResistance(SPELL_SCHOOL_FROST,cinfo->resistance4);
    SetResistance(SPELL_SCHOOL_SHADOW,cinfo->resistance5);
    SetResistance(SPELL_SCHOOL_ARCANE,cinfo->resistance6);

    //this is probably wrong
    SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, cinfo->equipmodel[0]);
    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO , cinfo->equipinfo[0]);
    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO  + 1, cinfo->equipslot[0]);

    SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, cinfo->equipmodel[1]);
    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 2, cinfo->equipinfo[1]);
    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 2 + 1, cinfo->equipslot[1]);

    SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+2, cinfo->equipmodel[2]);
    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 4, cinfo->equipinfo[2]);
    SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + 4 + 1, cinfo->equipslot[2]);

    SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->size);

    SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,cinfo->bounding_radius);
    SetFloatValue(UNIT_FIELD_COMBATREACH,cinfo->combat_reach );

    FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cinfo->faction);
    if (factionTemplate)
    {
        FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction);
        if (factionEntry)
            if (cinfo->civilian != 1 && (factionEntry->team == ALLIANCE || factionEntry->team == HORDE))
                SetPvP(true);
    } else
    sLog.outErrorDb("Error: invalid faction (%u) for creature (GUIDLow: %u Entry: %u)", cinfo->faction, GetGUIDLow(),Entry);

    if (cinfo->mount != 0)
        Mount(cinfo->mount);

    m_spells[0] = cinfo->spell1;
    m_spells[1] = cinfo->spell2;
    m_spells[2] = cinfo->spell3;
    m_spells[3] = cinfo->spell4;

    SetSpeed(MOVE_WALK,     cinfo->speed );
    SetSpeed(MOVE_RUN,      cinfo->speed );
    SetSpeed(MOVE_WALKBACK, cinfo->speed );
    SetSpeed(MOVE_SWIM,     cinfo->speed);
    SetSpeed(MOVE_SWIMBACK, cinfo->speed);

    if(cinfo->MovementType < MAX_DB_MOTION_TYPE)
        m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
    else
    {
        m_defaultMovementType = IDLE_MOTION_TYPE;
        sLog.outErrorDb("Creature template %u have wrong movement generator type value %u, ignore and set to IDLE.",Entry,cinfo->MovementType);
    }

    return true;
}
Example #23
0
bool CCheatMgr::Process( CheatCode nCheatCode, CParsedMsgW const& cMsg )
{
	if ( nCheatCode <= CHEAT_NONE || nCheatCode >= CHEAT_MAX ) return false;

#ifdef _FINAL
	// Don't do cheats in multiplayer...
    if (IsMultiplayerGameClient())
	{
		// Well, okay, let them toggle between 1st and 3rd person ;)
		// and, well, blood is pretty cool...
		switch ( nCheatCode )
		{
			case CHEAT_EXITLEVEL:	// exit the current level
				SetExitLevel();
			break;

			case CHEAT_NEXTMISSION:	// exit the current mission
				NextMission();
			break;

			case CHEAT_BOOT:		// boot players
				BootPlayer(cMsg);
			break;

			default :
				return false;
			break;
		}

		m_bPlayerCheated = true;
		return true;
	}

#else // _FINAL

	// Only allow cheats in MP if console variable turned on.
	if( IsMultiplayerGameClient( ))
	{
		float fVal = 0.0f;
		g_pLTClient->GetSConValueFloat( "AllowMPCheats", fVal );
		bool bAllowMPCheats = fVal != 0.0f;
		if( !bAllowMPCheats )
			return false;
	}

#endif // _FINAL

	// process cheat codes
	switch ( nCheatCode )
	{
		case CHEAT_GOD:			// god mode toggle
			SetGodMode(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_ARMOR:		// full armor
			SetArmor();
		break;

		case CHEAT_HEALTH:		// full health
			SetHealth();
		break;

		case CHEAT_EXITLEVEL:	// exit the current level
			SetExitLevel();
		break;

		case CHEAT_VERSION:		// display version info
			Version();
		break;

		case CHEAT_INVISIBLE:	// time to mess with the AI
			SetInvisible(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_BODYGOLFING:	// bodies fly far
			//currently unimplemented...
//			BodyGolfing(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_POS:			// show/hide player position
			SetPos(!s_CheatInfo[nCheatCode].bActive);
		break;

#ifndef _DEMO
		
		case CHEAT_KFA:			// give em everything
			SetKFA();
		break;

		case CHEAT_AMMO:		// full ammo
			SetAmmo();
		break;

		case CHEAT_MODSQUAD:	// give all mods for current weapons
			ModSquad();
		break;

		case CHEAT_CONSOLE:
			SetConsole(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_NEXTMISSION:	// exit the current mission
			NextMission();
		break;

		case CHEAT_BOOT:	// exit the current mission
			BootPlayer(cMsg);
		break;

		case CHEAT_FULL_WEAPONS:   // give all weapons
			SetFullWeapons();
		break;

		case CHEAT_FULL_GEAR:	// give all gear
			FullGear();
		break;

		case CHEAT_TEARS:	      // toggle tears cheat
			Tears(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_GIMMEGUN:
			GimmeGun( cMsg );
		break;

		case CHEAT_GIMMEMOD:
			GimmeMod( cMsg );
		break;

		case CHEAT_GIMMEGEAR:
			GimmeGear( cMsg );
		break;

		case CHEAT_GIMMEAMMO:
			GimmeAmmo( cMsg );
		break;

		case CHEAT_ENDGAME:
			ToggleEndgameFlag();
		break;

#ifndef _FINAL

		case CHEAT_CHASETOGGLE:	   // toggle 3rd person view
			ChaseToggle();
		break;

		case CHEAT_CLIP:		// toggle clipping mode
			SetClipMode(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_TELEPORT:	// teleport to beginning
			Teleport();
		break;

		case CHEAT_CAM_POSROT:    // show/hide camera position/rotation
			SetCamPosRot(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_POSWEAPON:		    // toggle adjust of weapon pos
			PosWeapon(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_REMOVEAI:	  // remove all ai
			RemoveAI(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_TRIGGERBOX:	  // toggle trigger boxes on/off
			TriggerBox(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_POS1STCAM:	  // toggle 1st person camera adjust on/off
			Pos1stCam(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_SAVEVEHICLE:		// save the vehicle tweaks to the bute file
			SaveVehicle( );
		break;

#endif  // _FINAL
#endif // _DEMO

		default:
			return false;			// skip setting global cheat indicator for unhandled cheats
	}

    m_bPlayerCheated = true;

	return true;
}
Example #24
0
void Guardian::UpdateArmor()
{
    float value = 0.0f;
    float bonus_armor = 0.0f;
    UnitMods unitMod = UNIT_MOD_ARMOR;

    // hunter pets gain 35% of owner's armor value, warlock pets gain 100% of owner's armor
    if (isHunterPet())
    {
        int pct = 50;

        // Looks for creature template
        if(CreatureTemplate const* cinfo = GetCreatureTemplate())
        {
            // Checks the pet talent type
            CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(cinfo->family);
            if (pet_family)
            {
                switch(pet_family->petTalentType)
                {
                    // Ferocity
                    case 0:
                        pct = 50;
                        break;
                    // Tenacity
                    case 1:
                        pct = 70;
                        break;
                    // Cunning
                    case 2:
                        pct = 60;
                        break;
                }
            }
        }

        bonus_armor = float(CalculatePct(m_owner->GetArmor(), pct));
    }
    else if (isPet() && !IsPetGhoul())
    {
        bonus_armor = m_owner->GetArmor();

        switch(m_owner->getClass())
        {
            case CLASS_SHAMAN:
            case CLASS_MAGE:
            case CLASS_WARLOCK:
                bonus_armor = CalculatePct(m_owner->GetArmor(), 35);
                break;
        }
    }
    else
    {
        if(m_owner)
        {
            switch(m_owner->getClass())
            {
                case CLASS_SHAMAN:
                    bonus_armor = CalculatePct(m_owner->GetArmor(), 35);
                    break;
            }
        }
    }

    value  = GetModifierValue(unitMod, BASE_VALUE);
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetArmor(int32(value));
}
Example #25
0
bool CCheatMgr::Process( CheatCode nCheatCode, CParsedMsg &cMsg )
{
	if ( nCheatCode <= CHEAT_NONE || nCheatCode >= CHEAT_MAX ) return false;

#ifdef _FINAL
	// Don't do cheats in multiplayer...
    if (IsMultiplayerGame())
	{
		// Well, okay, let them toggle between 1st and 3rd person ;)
		// and, well, blood is pretty cool...
		switch ( nCheatCode )
		{
			case CHEAT_CHASETOGGLE:
				ChaseToggle();
			break;

			case CHEAT_EXITLEVEL:	// exit the current level
				SetExitLevel();
			break;

			case CHEAT_NEXTMISSION:	// exit the current mission
				NextMission();
			break;

			case CHEAT_BOOT:		// boot players
				BootPlayer(cMsg);
			break;

			default :
				return false;
			break;
		}

		m_bPlayerCheated = LTTRUE;
		return true;
	}
#endif // _FINAL

	// process cheat codes
	switch ( nCheatCode )
	{
		case CHEAT_GOD:			// god mode toggle
			SetGodMode(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_SKILLZ:		// give em skill points
			GetSkills();
		break;

		case CHEAT_ARMOR:		// full armor
			SetArmor();
		break;

		case CHEAT_HEALTH:		// full health
			SetHealth();
		break;

		case CHEAT_EXITLEVEL:	// exit the current level
			SetExitLevel();
		break;

		case CHEAT_VERSION:		// display version info
			Version();
		break;

		case CHEAT_BUILDGUID:	// display build guid
			BuildGuid();
		break;

		case CHEAT_INVISIBLE:	// time to mess with the AI
			SetInvisible(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_BODYGOLFING:	// bodies fly far	
			BodyGolfing(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_POS:			// show/hide player position
			SetPos(!s_CheatInfo[nCheatCode].bActive);
		break;

#ifndef _TO2DEMO
		
		case CHEAT_KFA:			// give em everything
			SetKFA();
		break;

		case CHEAT_AMMO:		// full ammo
			SetAmmo();
		break;

		case CHEAT_MODSQUAD:	// give all mods for current weapons
			ModSquad();
		break;

		case CHEAT_CONSOLE:
			SetConsole(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_NEXTMISSION:	// exit the current mission
			NextMission();
		break;

		case CHEAT_BOOT:	// exit the current mission
			BootPlayer(cMsg);
		break;

		case CHEAT_FULL_WEAPONS:   // give all weapons
			SetFullWeapons();
		break;

		case CHEAT_SNOWMOBILE:	  // spawn in snowmobile
			Snowmobile(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_FULL_GEAR:	// give all gear
			FullGear();
		break;

		case CHEAT_TEARS:	      // toggle tears cheat
			Tears(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_GIMMEGUN:
			GimmeGun( cMsg );
		break;

		case CHEAT_GIMMEMOD:
			GimmeMod( cMsg );
		break;

		case CHEAT_GIMMEGEAR:
			GimmeGear( cMsg );
		break;

		case CHEAT_GIMMEAMMO:
			GimmeAmmo( cMsg );
		break;

		case CHEAT_ENDGAME:
			ToggleEndgameFlag();
		break;

#ifndef _FINAL

		case CHEAT_CHASETOGGLE:	   // toggle 3rd person view
			ChaseToggle();
		break;

		case CHEAT_CLIP:		// toggle clipping mode
			SetClipMode(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_TELEPORT:	// teleport to beginning
			Teleport();
		break;

		case CHEAT_CAM_POSROT:    // show/hide camera position/rotation
			SetCamPosRot(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_POSWEAPON:		    // toggle adjust of weapon pos
			PosWeapon(!s_CheatInfo[nCheatCode].bActive);
		break;

  		case CHEAT_POSWEAPON_MUZZLE:	// toggle adjust of weapon muzzle pos
  			PosWeaponMuzzle(!s_CheatInfo[nCheatCode].bActive);
  		break;

  		case CHEAT_WEAPON_BREACHOFFSET:	// toggle adjust of weapon breach offset pos
  			WeaponBreachOffset(!s_CheatInfo[nCheatCode].bActive);
  		break;

		case CHEAT_LIGHTSCALE:	      // toggle client light scale offset
			LightScale(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_LIGHTADD:	      // toggle client light add offset
			LightAdd(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_FOV:				// toggle fov cheat
			FOV(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_REMOVEAI:	  // remove all ai
			RemoveAI(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_TRIGGERBOX:	  // toggle trigger boxes on/off
			TriggerBox(!s_CheatInfo[nCheatCode].bActive);
		break;

		case CHEAT_POS1STCAM:	  // toggle 1st person camera adjust on/off
			Pos1stCam(!s_CheatInfo[nCheatCode].bActive);
		break;

#endif  // _FINAL
#endif // _TO2DEMO

		default:
			return false;			// skip setting global cheat indicator for unhandled cheats
	}

    m_bPlayerCheated = LTTRUE;

	return true;
}