mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10110] Add function Get/SetObjectScale and update code where scale is set.
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
bb3b0bd598
commit
2375a1cb71
14 changed files with 35 additions and 16 deletions
|
|
@ -68,7 +68,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||||
Object::_Create( guidlow, 0, HIGHGUID_CONTAINER );
|
Object::_Create( guidlow, 0, HIGHGUID_CONTAINER );
|
||||||
|
|
||||||
SetEntry(itemid);
|
SetEntry(itemid);
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
|
SetObjectScale(DEFAULT_OBJECT_SCALE);
|
||||||
|
|
||||||
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
|
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
|
||||||
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
|
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );
|
SetObjectScale(DEFAULT_OBJECT_SCALE);
|
||||||
SetUInt64Value( CORPSE_FIELD_OWNER, owner->GetGUID() );
|
SetUInt64Value( CORPSE_FIELD_OWNER, owner->GetGUID() );
|
||||||
|
|
||||||
m_grid = MaNGOS::ComputeGridPair(GetPositionX(), GetPositionY());
|
m_grid = MaNGOS::ComputeGridPair(GetPositionX(), GetPositionY());
|
||||||
|
|
@ -185,7 +185,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
|
||||||
SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_CORPSE));
|
SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_CORPSE));
|
||||||
SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(playerGuid, 0, HIGHGUID_PLAYER));
|
SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(playerGuid, 0, HIGHGUID_PLAYER));
|
||||||
|
|
||||||
SetFloatValue( OBJECT_FIELD_SCALE_X, 1.0f );
|
SetObjectScale(DEFAULT_OBJECT_SCALE);
|
||||||
|
|
||||||
PlayerInfo const *info = sObjectMgr.GetPlayerInfo(race, _class);
|
PlayerInfo const *info = sObjectMgr.GetPlayerInfo(race, _class);
|
||||||
if(!info)
|
if(!info)
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,8 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
SetEntry(Entry); // normal entry always
|
SetEntry(Entry); // normal entry always
|
||||||
m_creatureInfo = cinfo; // map mode related always
|
m_creatureInfo = cinfo; // map mode related always
|
||||||
|
|
||||||
|
SetObjectScale(cinfo->scale);
|
||||||
|
|
||||||
// equal to player Race field, but creature does not have race
|
// equal to player Race field, but creature does not have race
|
||||||
SetByteValue(UNIT_FIELD_BYTES_0, 0, 0);
|
SetByteValue(UNIT_FIELD_BYTES_0, 0, 0);
|
||||||
|
|
||||||
|
|
@ -272,8 +274,6 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
SetSpeedRate(MOVE_SWIM, 1.0f); // using 1.0 rate
|
SetSpeedRate(MOVE_SWIM, 1.0f); // using 1.0 rate
|
||||||
SetSpeedRate(MOVE_FLIGHT, 1.0f); // using 1.0 rate
|
SetSpeedRate(MOVE_FLIGHT, 1.0f); // using 1.0 rate
|
||||||
|
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->scale);
|
|
||||||
|
|
||||||
// checked at loading
|
// checked at loading
|
||||||
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
|
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,8 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEntry(spellId);
|
SetEntry(spellId);
|
||||||
SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );
|
SetObjectScale(DEFAULT_OBJECT_SCALE);
|
||||||
|
|
||||||
SetUInt64Value( DYNAMICOBJECT_CASTER, caster->GetGUID() );
|
SetUInt64Value( DYNAMICOBJECT_CASTER, caster->GetGUID() );
|
||||||
SetUInt32Value( DYNAMICOBJECT_BYTES, 0x00000001 );
|
SetUInt32Value( DYNAMICOBJECT_BYTES, 0x00000001 );
|
||||||
SetUInt32Value( DYNAMICOBJECT_SPELLID, spellId );
|
SetUInt32Value( DYNAMICOBJECT_SPELLID, spellId );
|
||||||
|
|
|
||||||
|
|
@ -126,13 +126,13 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetObjectScale(goinfo->size);
|
||||||
|
|
||||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+0, rotation0);
|
SetFloatValue(GAMEOBJECT_PARENTROTATION+0, rotation0);
|
||||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+1, rotation1);
|
SetFloatValue(GAMEOBJECT_PARENTROTATION+1, rotation1);
|
||||||
|
|
||||||
UpdateRotationFields(rotation2,rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3
|
UpdateRotationFields(rotation2,rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3
|
||||||
|
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
|
|
||||||
|
|
||||||
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
||||||
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
|
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner)
|
||||||
Object::_Create( guidlow, 0, HIGHGUID_ITEM );
|
Object::_Create( guidlow, 0, HIGHGUID_ITEM );
|
||||||
|
|
||||||
SetEntry(itemid);
|
SetEntry(itemid);
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
|
SetObjectScale(DEFAULT_OBJECT_SCALE);
|
||||||
|
|
||||||
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
|
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
|
||||||
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
|
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
|
||||||
|
|
|
||||||
|
|
@ -1335,7 +1335,7 @@ bool ChatHandler::HandleModifyScaleCommand(const char* args)
|
||||||
ChatHandler((Player*)target).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, GetNameLink().c_str(), Scale);
|
ChatHandler((Player*)target).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, GetNameLink().c_str(), Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
target->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
|
target->SetObjectScale(Scale);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,14 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh )
|
||||||
m_PackGUID.Set(guid);
|
m_PackGUID.Set(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Object::SetObjectScale(float newScale)
|
||||||
|
{
|
||||||
|
if (newScale <= 0.0f)
|
||||||
|
newScale = DEFAULT_OBJECT_SCALE;
|
||||||
|
|
||||||
|
SetFloatValue(OBJECT_FIELD_SCALE_X, newScale);
|
||||||
|
}
|
||||||
|
|
||||||
void Object::BuildMovementUpdateBlock(UpdateData * data, uint16 flags ) const
|
void Object::BuildMovementUpdateBlock(UpdateData * data, uint16 flags ) const
|
||||||
{
|
{
|
||||||
ByteBuffer buf(500);
|
ByteBuffer buf(500);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@
|
||||||
#define DEFAULT_VISIBILITY_BGARENAS 180.0f // default visible distance in BG/Arenas, 180 yards
|
#define DEFAULT_VISIBILITY_BGARENAS 180.0f // default visible distance in BG/Arenas, 180 yards
|
||||||
|
|
||||||
#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
|
#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
|
||||||
|
#define DEFAULT_OBJECT_SCALE 1.0f // player/item scale as default, npc/go from database, pets from dbc
|
||||||
|
|
||||||
#define MAX_STEALTH_DETECT_RANGE 45.0f
|
#define MAX_STEALTH_DETECT_RANGE 45.0f
|
||||||
|
|
||||||
uint32 GuidHigh2TypeId(uint32 guid_hi);
|
uint32 GuidHigh2TypeId(uint32 guid_hi);
|
||||||
|
|
@ -116,6 +118,13 @@ class MANGOS_DLL_SPEC Object
|
||||||
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||||
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
|
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
|
||||||
|
|
||||||
|
float GetObjectScale() const
|
||||||
|
{
|
||||||
|
return m_floatValues[OBJECT_FIELD_SCALE_X] ? m_floatValues[OBJECT_FIELD_SCALE_X] : DEFAULT_OBJECT_SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetObjectScale(float newScale);
|
||||||
|
|
||||||
uint8 GetTypeId() const { return m_objectTypeId; }
|
uint8 GetTypeId() const { return m_objectTypeId; }
|
||||||
bool isType(uint16 mask) const { return (mask & m_objectType); }
|
bool isType(uint16 mask) const { return (mask & m_objectType); }
|
||||||
|
|
||||||
|
|
@ -366,6 +375,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
{
|
{
|
||||||
return ( m_valuesCount > UNIT_FIELD_BOUNDINGRADIUS ) ? m_floatValues[UNIT_FIELD_BOUNDINGRADIUS] : DEFAULT_WORLD_OBJECT_SIZE;
|
return ( m_valuesCount > UNIT_FIELD_BOUNDINGRADIUS ) ? m_floatValues[UNIT_FIELD_BOUNDINGRADIUS] : DEFAULT_WORLD_OBJECT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPositionValid() const;
|
bool IsPositionValid() const;
|
||||||
void UpdateGroundPositionZ(float x, float y, float &z) const;
|
void UpdateGroundPositionZ(float x, float y, float &z) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -754,7 +754,7 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
if(displayScaleEntry)
|
if(displayScaleEntry)
|
||||||
const_cast<CreatureInfo*>(cInfo)->scale = displayScaleEntry->scale;
|
const_cast<CreatureInfo*>(cInfo)->scale = displayScaleEntry->scale;
|
||||||
else
|
else
|
||||||
const_cast<CreatureInfo*>(cInfo)->scale = 1.0f;
|
const_cast<CreatureInfo*>(cInfo)->scale = DEFAULT_OBJECT_SCALE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -834,7 +834,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
|
||||||
else
|
else
|
||||||
scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale);
|
scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale);
|
||||||
|
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X, scale);
|
SetObjectScale(scale);
|
||||||
}
|
}
|
||||||
m_bonusdamage = 0;
|
m_bonusdamage = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2704,8 +2704,8 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||||
// set default cast time multiplier
|
// set default cast time multiplier
|
||||||
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
|
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
|
||||||
|
|
||||||
// reset size before reapply auras
|
// reset scale before reapply auras
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X,1.0f);
|
SetObjectScale(DEFAULT_OBJECT_SCALE);
|
||||||
|
|
||||||
// save base values (bonuses already included in stored stats
|
// save base values (bonuses already included in stored stats
|
||||||
for(int i = STAT_STRENGTH; i < MAX_STATS; ++i)
|
for(int i = STAT_STRENGTH; i < MAX_STATS; ++i)
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
|
||||||
|
|
||||||
m_goInfo = goinfo;
|
m_goInfo = goinfo;
|
||||||
|
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
|
SetObjectScale(goinfo->size);
|
||||||
|
|
||||||
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
||||||
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
|
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10109"
|
#define REVISION_NR "10110"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue