void Pet::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState { Creature::setDeathState(s); if (getDeathState() == CORPSE) { if (getPetType() == HUNTER_PET) { // pet corpse non lootable and non skinnable SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); //lose happiness when died and not in BG/Arena MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); if (!mapEntry || (mapEntry->map_type != MAP_ARENA && mapEntry->map_type != MAP_BATTLEGROUND)) ModifyPower(POWER_HAPPINESS, -HAPPINESS_LEVEL_SIZE); //SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } } else if (getDeathState() == ALIVE) { //RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); CastPetAuras(true); } }
void Vehicle::RegeneratePower(Powers power) { uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); if (curValue >= maxValue) return; float addvalue = 0.0f; // hack: needs more research of power type from the dbc. // It must contains some info about vehicles like Salvaged Chopper. if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE) return; addvalue = 10.0f; ModifyPower(power, (int32)addvalue); for(int i =0; i != MAX_SEAT; i++) { if(Unit *pPassanger = GetPassenger(i)) { if(pPassanger->GetTypeId() == TYPEID_PLAYER) SendCreateUpdateToPlayer((Player*)pPassanger); } } }
void Vehicle::RegeneratePower(Powers power) { uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); if (curValue >= maxValue) return; float addvalue = 0.0f; // hack: needs more research of power type from the dbc. // It must contains some info about vehicles like Salvaged Chopper. if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE) return; addvalue = 10.0; ModifyPower(power, (int32)addvalue); WorldPacket data(SMSG_POWER_UPDATE); data << GetPackGUID(); data << uint8(power); data << uint32(addvalue+curValue); SendMessageToSet(&data, true); }
void Vehicle::Update(uint32 diff) { Creature::Update(diff); //310 if(getPowerType() == POWER_ENERGY) // m_vehicleInfo->36 ModifyPower(POWER_ENERGY, 100); }
void Pet::LoseHappiness() { uint32 curValue = GetPower(POWER_HAPPINESS); if (curValue <= 0) return; int32 addvalue = 670; //value is 70/35/17/8/4 (per min) * 1000 / 8 (timer 7.5 secs) if (isInCombat()) //we know in combat happiness fades faster, multiplier guess addvalue = int32(addvalue * 1.5f); ModifyPower(POWER_HAPPINESS, -addvalue); }
void Vehicle::RegeneratePower(Powers power) { uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); if (curValue >= maxValue) return; float addvalue = 0.0f; // hack: needs more research of power type from the dbc. // It must contains some info about vehicles like Salvaged Chopper. if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE) return; addvalue = 20.0f; ModifyPower(power, (int32)addvalue); }
void Creature::RegenerateMana() { uint32 curValue = GetPower(POWER_MANA); uint32 maxValue = GetMaxPower(POWER_MANA); if (curValue >= maxValue) return; float ManaIncreaseRate = sWorld.getRate(RATE_POWER_MANA); float Spirit = GetStat(STAT_SPIRIT); if( ManaIncreaseRate <= 0 ) ManaIncreaseRate = 1; uint32 addvalue = 0; if (isInCombat() || isPet()) addvalue = uint32((Spirit/5 + 17) * ManaIncreaseRate); else addvalue = maxValue/3; ModifyPower(POWER_MANA, addvalue); }
void Creature::Regenerate(Powers power) { uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); if (curValue >= maxValue) return; float addvalue = 0.0f; switch (power) { case POWER_FOCUS: { // For hunter pets. addvalue = 24 * sWorld->getRate(RATE_POWER_FOCUS); break; } case POWER_ENERGY: { // For deathknight's ghoul. addvalue = 20; break; } default: return; } // Apply modifiers (if any). AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) if (Powers((*i)->GetMiscValue()) == power) AddPctN(addvalue, (*i)->GetAmount()); addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS); ModifyPower(power, int32(addvalue)); }