Animation::Animation() { SetState(true); SetType(OBJ_TYPE_ANIMATION); SetPosition(Point2D(512, 512)); sprite = NULL; source = NULL; color = White; AllocateUInt32Values(ANIM_UINT32_VARS); AllocateFloatValues(ANIM_FLOAT_VARS); SetFloatValue(ANIM_VAR_BASE_SCALE, 1.0); }
void Player::UpdateAllRunesRegen() { for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i) { if (uint32 cooldown = GetRuneTypeBaseCooldown(RuneType(i))) { float regen = float(1 * IN_MILLISECONDS) / float(cooldown); if (regen < 0.0099999998f) regen = 0.01f; SetFloatValue(PLAYER_RUNE_REGEN_1 + i, regen); } } }
void Player::UpdateSpellCritChance(uint32 school) { // For normal school set zero crit chance if (school == SPELL_SCHOOL_NORMAL) { SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1, 0.0f); return; } // For others recalculate it from: float crit = 0.0f; // Crit from Intellect crit += GetSpellCritFromIntellect(); // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE crit += GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); // Increase crit from SPELL_AURA_MOD_CRIT_PCT crit += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL crit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, 1<<school); // Increase crit from spell crit ratings crit += GetRatingBonusValue(CR_CRIT_SPELL); // Store crit value SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, crit); }
bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) { Relocate(x, y, z, ang); // instance id and phaseMask isn't set to values different from std. if (!IsPositionValid()) { sLog->outError( "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, x, y); return false; } Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT); GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(entry); if (!goinfo) { sLog->outErrorDb( "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); return false; } m_goInfo = goinfo; SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetEntry(goinfo->id); SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); SetGoState(GO_STATE_READY); SetGoType(GameobjectTypes(goinfo->type)); SetGoAnimProgress(animprogress); if (dynflags) SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags)); SetName(goinfo->name); SetZoneScript(); return true; }
bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type, uint32 spellXSpellVisualId) { _spellXSpellVisualId = spellXSpellVisualId; SetMap(caster->GetMap()); Relocate(pos); if (!IsPositionValid()) { TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY()); return false; } WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow)); SetPhaseMask(caster->GetPhaseMask(), false); SetEntry(spell->Id); SetObjectScale(1.0f); SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID()); SetUInt32Value(DYNAMICOBJECT_TYPE, type); SetUInt32Value(DYNAMICOBJECT_SPELL_X_SPELL_VISUAL_ID, spellXSpellVisualId); SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id); SetFloatValue(DYNAMICOBJECT_RADIUS, radius); SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime()); if (IsWorldObject()) setActive(true); //must before add to map to be put in world container Transport* transport = caster->GetTransport(); if (transport) { float x, y, z, o; pos.GetPosition(x, y, z, o); transport->CalculatePassengerOffset(x, y, z, &o); m_movementInfo.transport.pos.Relocate(x, y, z, o); // This object must be added to transport before adding to map for the client to properly display it transport->AddPassenger(this); } if (!GetMap()->AddToMap(this)) { // Returning false will cause the object to be deleted - remove from transport if (transport) transport->RemovePassenger(this); return false; } return true; }
void Player::UpdateSpellCritChance(uint32 school) { float crit = 0.0f; // Base spell crit and spell crit from Intellect crit += GetSpellCritFromIntellect(); // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE crit += GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE); // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL crit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, (1 << school)); // Increase crit from spell crit ratings crit += GetRatingBonusValue(CR_CRIT_SPELL); // Set current crit chance m_modSpellCritChance[school] = crit; // Set UI display value: SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, std::max(0.0f, std::min(crit, 100.0f))); }
Container::Container(uint32 high,uint32 low) : Item() { m_objectTypeId = TYPEID_CONTAINER; internal_object_type = INTERNAL_OBJECT_TYPE_CONTAINER; m_valuesCount = CONTAINER_END; m_uint32Values = __fields; memset(m_uint32Values, 0,(CONTAINER_END)*sizeof(uint32)); m_updateMask.SetCount(CONTAINER_END); SetUInt32Value( OBJECT_FIELD_TYPE,TYPE_CONTAINER|TYPE_ITEM|TYPE_OBJECT); SetUInt32Value( OBJECT_FIELD_GUID,low); SetUInt32Value( OBJECT_FIELD_GUID+1,high); m_wowGuid.Init(GetGUID()); SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );//always 1 random_suffix=random_prop=0; }
bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type) { WorldObject::_Create(ObjectGuid(HIGHGUID_DYNAMICOBJECT, guidlow), caster->GetPhaseMask()); Relocate(WorldLocation(caster->GetMapId(), x, y, z, 0.0f, caster->GetPhaseMask(), caster->GetInstanceId())); SetMap(caster->GetMap()); if (!IsPositionValid()) { sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, effIndex, GetPositionX(), GetPositionY()); return false; } SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId); if (!spellProto) { sLog.outError("DynamicObject (spell %u) not created. Spell not exist!", spellId); return false; } SetEntry(spellId); SetObjectScale(DEFAULT_OBJECT_SCALE); if (type == DYNAMIC_OBJECT_RAID_MARKER) { MANGOS_ASSERT(caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->GetGroup() && "DYNAMIC_OBJECT_RAID_MARKER must only be casted by players and that are in group."); SetGuidValue(DYNAMICOBJECT_CASTER, ((Player*)caster)->GetGroup()->GetObjectGuid()); } else SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetObjectGuid()); SetUInt32Value(DYNAMICOBJECT_BYTES, spellProto->GetSpellVisual() | (type << 28)); SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId); SetFloatValue(DYNAMICOBJECT_RADIUS, radius); SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime()); // new 2.4.0 m_aliveDuration = duration; m_radius = radius; m_effIndex = effIndex; m_spellId = spellId; m_positive = IsPositiveEffect(spellProto, m_effIndex); return true; }
bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehicleId, uint32 team, const CreatureData *data) { SetMapId(map->GetId()); SetInstanceId(map->GetInstanceId()); SetPhaseMask(phaseMask,false); CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry); if(!cinfo) { sLog.outErrorDb("Creature entry %u does not exist.", Entry); return false; } Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE); if(!UpdateEntry(Entry, team, data)) return false; if(!vehicleId) { CreatureDataAddon const *cainfo = GetCreatureAddon(); if(!cainfo) return false; vehicleId = cainfo->vehicle_id; } if(!SetVehicleId(vehicleId)) return false; LoadCreaturesAddon(); m_regenHealth = false; m_creation_time = getMSTime(); SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); //RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); //Notify the map's instance data. //Only works if you create the object in it, not if it is moves to that map. //Normally non-players do not teleport to other maps. if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData()) { ((InstanceMap*)map)->GetInstanceData()->OnCreatureCreate(this); } return true; }
void CGUISliderControl::SetFromPosition(const CPoint &point, bool guessSelector /* = false */) { float fPercent; if (m_orientation == HORIZONTAL) fPercent = (point.x - m_guiBackground.GetXPosition()) / m_guiBackground.GetWidth(); else fPercent = (m_guiBackground.GetYPosition() + m_guiBackground.GetHeight() - point.y) / m_guiBackground.GetHeight(); if (fPercent < 0) fPercent = 0; if (fPercent > 1) fPercent = 1; if (m_rangeSelection && guessSelector) { // choose selector which value is closer to value calculated from position if (fabs(GetPercentage(RangeSelectorLower) - 100 * fPercent) <= fabs(GetPercentage(RangeSelectorUpper) - 100 * fPercent)) m_currentSelector = RangeSelectorLower; else m_currentSelector = RangeSelectorUpper; } switch (m_iType) { case SLIDER_CONTROL_TYPE_FLOAT: { float fValue = m_fStart + (m_fEnd - m_fStart) * fPercent; SetFloatValue(fValue, m_currentSelector, true); break; } case SLIDER_CONTROL_TYPE_INT: { int iValue = (int)(m_iStart + (float)(m_iEnd - m_iStart) * fPercent + 0.49f); SetIntValue(iValue, m_currentSelector, true); break; } case SLIDER_CONTROL_TYPE_PERCENTAGE: default: { SetPercentage(fPercent * 100, m_currentSelector, true); break; } } SendClick(); }
bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) { Relocate(x,y,z,ang); SetMapId(mapid); if (!IsPositionValid()) { sLog.outLog(LOG_DEFAULT, "ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow,x,y); return false; } Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT); GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(guidlow); if (!goinfo) { sLog.outLog(LOG_DB_ERR, "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang); return false; } m_goInfo = goinfo; SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(OBJECT_FIELD_ENTRY, goinfo->id); SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); SetGoState(GO_STATE_READY); SetGoType(GameobjectTypes(goinfo->type)); SetGoAnimProgress(animprogress); if (dynflags) SetUInt32Value(GAMEOBJECT_DYN_FLAGS, dynflags); SetName(goinfo->name); return true; }
void Player::UpdateMastery() { if (HasAuraType(SPELL_AURA_MASTERY)) { if(HasAura(76671)) GetAura(76671)->RecalculateAmountOfEffects();//Paladin Protection Mastery if(HasAura(77514)) GetAura(77514)->RecalculateAmountOfEffects();//DK Frost Mastery if(HasAura(48517)) GetAura(48517)->RecalculateAmountOfEffects();// Druid Balance Mastery if(HasAura(48518)) GetAura(48518)->RecalculateAmountOfEffects();// Druid Balance Mastery if(HasAura(76857)) GetAura(76857)->RecalculateAmountOfEffects();// Warrior Protection Mastery SetInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_MASTERY, m_baseRatingValue[CR_MASTERY]); SetFloatValue(PLAYER_MASTERY, GetMasteryPoints()); } }
Corpse::Corpse(uint32 high, uint32 low) { m_objectTypeId = TYPEID_CORPSE; m_valuesCount = CORPSE_END; m_uint32Values = _fields; memset(m_uint32Values, 0,(CORPSE_END)*sizeof(uint32)); m_updateMask.SetCount(CORPSE_END); SetUInt32Value( OBJECT_FIELD_TYPE,TYPE_CORPSE|TYPE_OBJECT); SetUInt32Value( OBJECT_FIELD_GUID,low); SetUInt32Value( OBJECT_FIELD_GUID+1,high); m_wowGuid.Init(GetGUID()); SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );//always 1 m_state = CORPSE_STATE_BODY; _loadedfromdb = false; }
bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) { Relocate(x,y,z,ang); SetMapId(mapid); if(!IsPositionValid()) { sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow,x,y); return false; } Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT); GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow); if (!goinfo) { sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang); return false; } m_goInfo = goinfo; SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetEntry(goinfo->id); SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); SetGoState(1); SetGoType(GameobjectTypes(goinfo->type)); SetGoAnimProgress(animprogress); if(dynflags) SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags)); return true; }
void Item::Create( uint32 guidlow, uint32 itemid, Player *owner ) { Object::_Create( guidlow, HIGHGUID_ITEM ); SetUInt32Value( OBJECT_FIELD_ENTRY, itemid ); SetFloatValue( OBJECT_FIELD_SCALE_X, 1.0f ); SetUInt64Value( ITEM_FIELD_OWNER, owner->GetGUID() ); SetUInt64Value( ITEM_FIELD_CONTAINED, owner->GetGUID() ); SetUInt32Value( ITEM_FIELD_STACK_COUNT, 1 ); m_itemProto = objmgr.GetItemPrototype( itemid ); ASSERT(m_itemProto); //for(int i=5;i<m_valuesCount;i++) // SetUInt32Value( i, 1 ); SetUInt32Value( ITEM_FIELD_MAXDURABILITY, m_itemProto->MaxDurability); SetUInt32Value( ITEM_FIELD_DURABILITY, m_itemProto->MaxDurability); /* ITEM_FIELD_OWNER = 6, // 2 UINT64 ITEM_FIELD_CONTAINED = 8, // 2 UINT64 ITEM_FIELD_CREATOR = 10, // 2 UINT64 ITEM_FIELD_GIFTCREATOR = 12, // 2 UINT64 ITEM_FIELD_STACK_COUNT = 14, // 1 UINT32 ITEM_FIELD_DURATION = 15, // 1 UINT32 ITEM_FIELD_SPELL_CHARGES = 16, // 5 SPELLCHARGES ITEM_FIELD_FLAGS = 21, // 1 UINT32 ITEM_FIELD_ENCHANTMENT = 22, // 21 ENCHANTMENT ITEM_FIELD_PROPERTY_SEED = 43, // 1 UINT32 ITEM_FIELD_RANDOM_PROPERTIES_ID = 44, // 1 UINT32 ITEM_FIELD_ITEM_TEXT_ID = 45, // 1 UINT32 ITEM_FIELD_DURABILITY = 46, // 1 UINT32 ITEM_FIELD_MAXDURABILITY = 47, // 1 UINT32 */ SetUInt32Value( ITEM_FIELD_SPELL_CHARGES, m_itemProto->SpellCharges[0]); SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+1, m_itemProto->SpellCharges[1]); SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+2, m_itemProto->SpellCharges[2]); SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+3, m_itemProto->SpellCharges[3]); SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+4, m_itemProto->SpellCharges[4]); SetUInt32Value( ITEM_FIELD_FLAGS, m_itemProto->Flags); SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID, m_itemProto->DisplayInfoID); m_owner = owner; }
void Item::Create( uint32 guidlow, uint32 itemid, Player *owner ) { Object::_Create( guidlow, HIGHGUID_ITEM ); SetUInt32Value( OBJECT_FIELD_ENTRY, itemid ); SetFloatValue( OBJECT_FIELD_SCALE_X, 1.0f ); SetUInt64Value( ITEM_FIELD_OWNER, owner->GetGUID() ); SetUInt64Value( ITEM_FIELD_CONTAINED, owner->GetGUID() ); SetUInt32Value( ITEM_FIELD_STACK_COUNT, 1 ); m_itemProto = objmgr.GetItemPrototype( itemid ); ASSERT(m_itemProto); SetUInt32Value( ITEM_FIELD_MAXDURABILITY, m_itemProto->MaxDurability); SetUInt32Value( ITEM_FIELD_DURABILITY, m_itemProto->MaxDurability); m_owner = owner; }
void Player::UpdateMeleeHitChances() { m_modMeleeHitChance = 0; AuraEffectList const & alist = GetAuraEffectsByType(SPELL_AURA_MOD_HIT_CHANCE); Item *weapon = this->GetWeaponForAttack(BASE_ATTACK); for (AuraEffectList::const_iterator itr = alist.begin(); itr != alist.end(); ++itr) { if ((*itr)->GetSpellInfo()->EquippedItemSubClassMask && !weapon) continue; if (weapon && !weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo())) continue; m_modMeleeHitChance += (*itr)->GetAmount(); } SetFloatValue(PLAYER_FIELD_UI_HIT_MODIFIER, m_modMeleeHitChance); m_modMeleeHitChance += GetRatingBonusValue(CR_HIT_MELEE); if (Pet* pet = GetPet()) pet->m_modMeleeHitChance = m_modMeleeHitChance; }
void Container::Create( uint32 guidlow, uint32 itemid, Player *owner ) { Object::_Create( guidlow, HIGHGUID_CONTAINER ); m_itemProto = objmgr.GetItemPrototype( itemid ); ASSERT(m_itemProto); SetUInt32Value( OBJECT_FIELD_ENTRY, itemid ); SetFloatValue( OBJECT_FIELD_SCALE_X, 1.0f ); SetUInt64Value( ITEM_FIELD_OWNER, owner->GetGUID() ); SetUInt64Value( ITEM_FIELD_CONTAINED, owner->GetGUID() ); SetUInt32Value( ITEM_FIELD_STACK_COUNT, 1 ); SetUInt32Value( CONTAINER_FIELD_NUM_SLOTS, m_itemProto->ContainerSlots); m_Slot = new Item*[m_itemProto->ContainerSlots]; memset(m_Slot, 0, sizeof(Item*)*(m_itemProto->ContainerSlots)); m_owner = owner; }
void MFCQuaRotor::SetKnobParams() { int wScale=0; int hScale=0; int wKnob=0; int hKnob=0; int wDot=0; int hDot=0; BOOL kValid = knobBitmap.GetSize(wKnob, hKnob); BOOL dValid = dotBitmap.GetSize(wDot, hDot); BOOL sValid = scaleBitmap.GetSize(wScale, hScale); if (!sValid) { if (kValid) { wScale = wKnob; hScale = hKnob; } else { wScale = bounds.right-labelWidth; hScale = bounds.bottom; } } if (!dValid) { wDot = hDot = 0; } if (!kValid) { wKnob = bounds.right-labelWidth; hKnob = bounds.bottom; } ptCenter.x = labelWidth + wScale / 2; ptCenter.y = bounds.bottom / 2; ptScale.x = ptCenter.x - (wScale / 2); ptScale.y = ptCenter.y - (hScale / 2); ptKnob.x = ptCenter.x - (wKnob / 2); ptKnob.y = ptCenter.y - (hKnob / 2); knobRadius = wDot?(wKnob/2 - wDot/2 -3):(wKnob/2-1); SetFloatValue(fValue); RedrawWindow(); }
float UGAAttributesBase::AttributeOperation(const FGAAttribute& AttributeIn, float ValueIn, EGAAttributeMod Operation) { switch (Operation) { case EGAAttributeMod::Add: return AddAttributeFloat(GetFloatValue(AttributeIn), ValueIn); //don't want to set. case EGAAttributeMod::Subtract: return SubtractAttributeFloat(GetFloatValue(AttributeIn), ValueIn); case EGAAttributeMod::Multiply: return MultiplyAttributeFloat(GetFloatValue(AttributeIn), ValueIn); case EGAAttributeMod::Divide: return DivideAttributeFloat(GetFloatValue(AttributeIn), ValueIn); case EGAAttributeMod::Set: return SetFloatValue(AttributeIn, ValueIn); default: return 0; } return 0; }
bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius ) { WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask()); SetMap(caster->GetMap()); Relocate(x, y, z, 0); if(!IsPositionValid()) { sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,effIndex,GetPositionX(),GetPositionY()); return false; } SetEntry(spellId); SetObjectScale(DEFAULT_OBJECT_SCALE); SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetObjectGuid()); /* Bytes field, so it's really 4 bit fields. These flags are unknown, but we do know that 0x00000001 is set for most. Farsight for example, does not have this flag, instead it has 0x80000002. Flags are set dynamically with some conditions, so one spell may have different flags set, depending on those conditions. The size of the visual may be controlled to some degree with these flags. uint32 bytes = 0x00000000; bytes |= 0x01; bytes |= 0x00 << 8; bytes |= 0x00 << 16; bytes |= 0x00 << 24; */ SetUInt32Value(DYNAMICOBJECT_BYTES, 0x00000001); SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId); SetFloatValue(DYNAMICOBJECT_RADIUS, radius); SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime()); // new 2.4.0 m_aliveDuration = duration; m_radius = radius; m_effIndex = effIndex; m_spellId = spellId; m_positive = IsPositiveEffect(m_spellId, m_effIndex); return true; }
bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type) { SetMap(caster->GetMap()); Relocate(pos); if (!IsPositionValid()) { sLog->outError(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY()); return false; } WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask()); SetEntry(spellId); SetObjectScale(1.0f); SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID()); // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden // by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane. // If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but // precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells // I saw sniffed... // Blizz set visual spell Id in 3 first byte of DYNAMICOBJECT_BYTES after 5.X SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (spellInfo) { uint32 visual = spellInfo->SpellVisual[0] ? spellInfo->SpellVisual[0] : spellInfo->SpellVisual[1]; SetUInt32Value(DYNAMICOBJECT_BYTES, 0x10000000 | visual); } SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId); SetFloatValue(DYNAMICOBJECT_RADIUS, radius); SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime()); if (IsWorldObject()) setActive(true); //must before add to map to be put in world container if (!GetMap()->AddToMap(this)) return false; return true; }
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) { if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) { nsCSSValue* width = aData->ValueForWidth(); if (width->GetUnit() == eCSSUnit_Null) { // width: int (html4 attribute == nav4 cols) const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width); if (!value || value->Type() != nsAttrValue::eInteger) { // cols: int (nav4 attribute) value = aAttributes->GetAttr(nsGkAtoms::cols); } if (value && value->Type() == nsAttrValue::eInteger) width->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Char); } } if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) { nsCSSValue* whiteSpace = aData->ValueForWhiteSpace(); if (whiteSpace->GetUnit() == eCSSUnit_Null) { // wrap: empty if (aAttributes->GetAttr(nsGkAtoms::wrap)) whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated); // width: int (html4 attribute == nav4 cols) const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width); if (!value || value->Type() != nsAttrValue::eInteger) { // cols: int (nav4 attribute) value = aAttributes->GetAttr(nsGkAtoms::cols); } if (value && value->Type() == nsAttrValue::eInteger) { // Force wrap property on since we want to wrap at a width // boundary not just a newline. whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated); } } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); }
void Player::UpdateRuneRegen(RuneType rune) { if (rune >= NUM_RUNE_TYPES) return; uint32 cooldown = 0; for (uint32 i = 0; i < MAX_RUNES; ++i) if (GetBaseRune(i) == rune) { cooldown = GetRuneBaseCooldown(i); break; } if (cooldown <= 0) return; float regen = float(1 * IN_MILLISECONDS) / float(cooldown); SetFloatValue(PLAYER_FIELD_RUNE_REGEN + uint8(rune), regen); }
GameObject::GameObject(uint64 guid) { m_objectTypeId = TYPEID_GAMEOBJECT; m_valuesCount = GAMEOBJECT_END; m_uint32Values = _fields; memset(m_uint32Values, 0, (GAMEOBJECT_END)*sizeof(uint32)); m_updateMask.SetCount(GAMEOBJECT_END); SetUInt32Value(OBJECT_FIELD_TYPE,TYPE_GAMEOBJECT|TYPE_OBJECT); SetUInt64Value(OBJECT_FIELD_GUID,guid); m_wowGuid.Init(GetGUID()); SetFloatValue( OBJECT_FIELD_SCALE_X, 1); // info->Size ); SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_ANIMPROGRESS, 100); counter = 0; // not needed at all but to prevent errors that var was not inited, can be removed in release bannerslot = bannerauraslot = -1; m_summonedGo = false; invisible = false; invisibilityFlag = INVIS_FLAG_NORMAL; spell = 0; m_summoner = NULL; charges = -1; m_ritualcaster = 0; m_ritualtarget = 0; m_ritualmembers = NULL; m_ritualspell = 0; m_rotation = 0; m_quests = NULL; pInfo = NULL; myScript = NULL; m_spawn = 0; m_deleted = false; mines_remaining = 1; m_respawnCell = NULL; m_battleground = NULL; }
bool MFCQuaRotor::CreateRotor(char *lbl, CRect &r, CWnd *w, UINT id, float ini, float fmin, float fmid, float fmax, int angmi, int angmx, int lw) { if (!CreateEx(NULL, WS_CHILD|WS_VISIBLE|TBS_TOOLTIPS, r, w, id)) { return false; } SetDlgCtrlID(id); CToolTipCtrl *t=GetToolTips(); if (t) { t->SetDelayTime(0); } label = lbl; bounds = r; bounds.MoveToXY(0,0); SetFloatRange(fmin, fmid, fmax); SetAngleRange(angmi, angmx); SetPixelScaleLength(200); // causes a messy z-order redrawing issue!!!! // ModifyStyleEx(NULL, WS_EX_TRANSPARENT, NULL); if (!SetKnobResource(IDB_ROT_SM_K)) { return false; } if (lw >= 0) { labelWidth = lw; } else { labelWidth = bounds.right-knobBitmap.GetWidth(); if (labelWidth < 0) { labelWidth = 0; } } bgColor = rgb_orange; SetKnobParams(); SetFloatValue(ini); return true; }
bool Transport::Create(uint32 guidlow, uint32 displayId, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) { Relocate(x,y,z,ang); SetMapId(mapid); if(!IsPositionValid()) { sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %d Y: ^%d)",guidlow,x,y); return false; } Object::_Create(guidlow, HIGHGUID_TRANSPORT); GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow); if (!goinfo) { sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang); return false; } SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); m_flags = goinfo->flags; SetUInt32Value (OBJECT_FIELD_ENTRY, goinfo->id); SetUInt32Value (GAMEOBJECT_DISPLAYID, goinfo->displayId); SetUInt32Value (GAMEOBJECT_STATE, 1); SetUInt32Value (GAMEOBJECT_TYPE_ID, goinfo->type); SetUInt32Value (GAMEOBJECT_ANIMPROGRESS, animprogress); SetUInt32Value (GAMEOBJECT_DYN_FLAGS, dynflags); return true; }
void Player::UpdateMasteryPercentage() { // No mastery float value = 0.0f; if (CanMastery() && getLevel() >= 80) { // Mastery from SPELL_AURA_MASTERY aura value += GetTotalAuraModifier(SPELL_AURA_MASTERY); // Mastery from rating value += GetRatingBonusValue(CR_MASTERY); value = value < 0.0f ? 0.0f : value; } SetFloatValue(PLAYER_MASTERY, value); // Custom MoP Script // 76671 - Mastery : Divine Bulwark - Update Block Percentage // 76857 - Mastery : Critical Block - Update Block Percentage if (HasAura(76671) || HasAura(76857)) UpdateBlockPercentage(); // 77494 - Mastery : Nature's Guardian - Update Armor if (HasAura(77494)) UpdateArmor(); }
Item::Item( uint32 high, uint32 low ) { m_objectTypeId = TYPEID_ITEM; m_valuesCount = ITEM_END; m_uint32Values = _fields; memset( m_uint32Values, 0, (ITEM_END) * sizeof( uint32 ) ); m_updateMask.SetCount(ITEM_END); SetUInt32Value( OBJECT_FIELD_TYPE,TYPE_ITEM | TYPE_OBJECT ); SetUInt32Value( OBJECT_FIELD_GUID, low ); SetUInt32Value( OBJECT_FIELD_GUID + 1, high ); m_wowGuid.Init( GetGUID() ); SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );//always 1 m_itemProto = NULL; m_owner = NULLPLR; locked = false; m_isDirty = true; random_prop = 0; random_suffix = 0; wrapped_item_id = 0; }
GameObject::GameObject(uint32 high, uint32 low) { m_objectTypeId = TYPEID_GAMEOBJECT; m_valuesCount = GAMEOBJECT_END; m_uint32Values = _fields; memset(m_uint32Values, 0,(GAMEOBJECT_END)*sizeof(uint32)); m_updateMask.SetCount(GAMEOBJECT_END); SetUInt32Value( OBJECT_FIELD_TYPE,TYPE_GAMEOBJECT|TYPE_OBJECT); SetUInt32Value( OBJECT_FIELD_GUID,low); SetUInt32Value( OBJECT_FIELD_GUID+1,high); m_wowGuid.Init(GetGUID()); SetFloatValue( OBJECT_FIELD_SCALE_X, 1);//info->Size ); counter=0;//not needed at all but to prevent errors that var was not inited, can be removed in release pcbannerAura = NULL; bannerslot = -1; m_summonedGo = false; invisible = false; invisibilityFlag = INVISIBILTY_FLAG_NONE; spell = 0; m_summoner = NULL; charges = (uint32)-1; m_ritualcaster = 0; m_ritualtarget = 0; m_ritualmembers = NULL; m_ritualspell = 0; m_quests = NULL; pInfo = NULL; myScript = NULL; spawnid = 0; m_spawn = 0; loot.gold = 0; m_deleted = false; }