mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
Update UpdateFields.h. Drop redundant powers and happiness.
thx Strawberry Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
parent
53b2e576d1
commit
e9bee9b0b0
13 changed files with 602 additions and 660 deletions
16
sql/434/02_characters.sql
Normal file
16
sql/434/02_characters.sql
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
ALTER TABLE `characters`
|
||||
DROP COLUMN `power6`,
|
||||
DROP COLUMN `power7`,
|
||||
DROP COLUMN `power8`,
|
||||
DROP COLUMN `power9`,
|
||||
DROP COLUMN `power10`;
|
||||
|
||||
ALTER TABLE `character_stats`
|
||||
DROP COLUMN `maxpower6`,
|
||||
DROP COLUMN `maxpower7`,
|
||||
DROP COLUMN `maxpower8`,
|
||||
DROP COLUMN `maxpower9`,
|
||||
DROP COLUMN `maxpower10`;
|
||||
|
||||
ALTER TABLE `character_pet`
|
||||
DROP COLUMN `curhappiness`;
|
||||
|
|
@ -73,7 +73,7 @@ bool LoginQueryHolder::Initialize()
|
|||
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost,"
|
||||
"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty,"
|
||||
"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk,"
|
||||
"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars FROM characters WHERE guid = '%u'", m_guid.GetCounter());
|
||||
"health, power1, power2, power3, power4, power5, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars FROM characters WHERE guid = '%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT groupId FROM group_member WHERE memberGuid ='%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", m_guid.GetCounter());
|
||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,item_guid,spell,stackcount,remaincharges,basepoints0,basepoints1,basepoints2,periodictime0,periodictime1,periodictime2,maxduration,remaintime,effIndexMask FROM character_aura WHERE guid = '%u'", m_guid.GetCounter());
|
||||
|
|
|
|||
|
|
@ -411,6 +411,10 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
if (!target)
|
||||
return;
|
||||
|
||||
uint32 valuesCount = m_valuesCount;
|
||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||
valuesCount = PLAYER_END_NOT_SELF;
|
||||
|
||||
bool IsActivateToQuest = false;
|
||||
bool IsPerCasterAuraState = false;
|
||||
|
||||
|
|
@ -460,7 +464,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
// 2 specialized loops for speed optimization in non-unit case
|
||||
if (isType(TYPEMASK_UNIT)) // unit (creature/player) case
|
||||
{
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
for (uint16 index = 0; index < valuesCount; ++index)
|
||||
{
|
||||
if (updateMask->GetBit(index))
|
||||
{
|
||||
|
|
@ -546,7 +550,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
}
|
||||
else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case
|
||||
{
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
for (uint16 index = 0; index < valuesCount; ++index)
|
||||
{
|
||||
if (updateMask->GetBit(index))
|
||||
{
|
||||
|
|
@ -593,7 +597,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
}
|
||||
else // other objects case (no special index checks)
|
||||
{
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
for (uint16 index = 0; index < valuesCount; ++index)
|
||||
{
|
||||
if (updateMask->GetBit(index))
|
||||
{
|
||||
|
|
@ -642,18 +646,26 @@ bool Object::LoadValues(const char* data)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const
|
||||
void Object::_SetUpdateBits(UpdateMask *updateMask, Player* target) const
|
||||
{
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
uint32 valuesCount = m_valuesCount;
|
||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||
valuesCount = PLAYER_END_NOT_SELF;
|
||||
|
||||
for( uint16 index = 0; index < valuesCount; ++index )
|
||||
{
|
||||
if (m_uint32Values_mirror[index] != m_uint32Values[index])
|
||||
updateMask->SetBit(index);
|
||||
}
|
||||
}
|
||||
|
||||
void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const
|
||||
void Object::_SetCreateBits(UpdateMask *updateMask, Player* target) const
|
||||
{
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
uint32 valuesCount = m_valuesCount;
|
||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||
valuesCount = PLAYER_END_NOT_SELF;
|
||||
|
||||
for (uint16 index = 0; index < valuesCount; ++index)
|
||||
{
|
||||
if (GetUInt32Value(index) != 0)
|
||||
updateMask->SetBit(index);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
Pet::Pet(PetType type) :
|
||||
Creature(CREATURE_SUBTYPE_PET),
|
||||
m_resetTalentsCost(0), m_resetTalentsTime(0), m_usedTalentCount(0),
|
||||
m_removed(false), m_happinessTimer(7500), m_petType(type), m_duration(0),
|
||||
m_removed(false), m_petType(type), m_duration(0),
|
||||
m_bonusdamage(0), m_auraUpdateMask(0), m_loading(false),
|
||||
m_declinedname(NULL), m_petModeFlags(PET_MODE_DEFAULT)
|
||||
{
|
||||
|
|
@ -82,27 +82,27 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
QueryResult* result;
|
||||
|
||||
if (petnumber)
|
||||
// known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
ownerid, petnumber);
|
||||
// known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
ownerid, petnumber);
|
||||
else if (current)
|
||||
// current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND slot = '%u'",
|
||||
ownerid, PET_SAVE_AS_CURRENT);
|
||||
// current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND slot = '%u'",
|
||||
ownerid, PET_SAVE_AS_CURRENT );
|
||||
else if (petentry)
|
||||
// known petentry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets)
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '%u' OR slot > '%u') ",
|
||||
ownerid, petentry, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '%u' OR slot > '%u') ",
|
||||
ownerid, petentry,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
else
|
||||
// any current or other non-stabled pet (for hunter "call pet")
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u') ",
|
||||
ownerid, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u') ",
|
||||
ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
|
||||
if (!result)
|
||||
return false;
|
||||
|
|
@ -126,7 +126,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
}
|
||||
|
||||
|
||||
uint32 summon_spell_id = fields[17].GetUInt32();
|
||||
uint32 summon_spell_id = fields[16].GetUInt32();
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(summon_spell_id);
|
||||
|
||||
bool is_temporary_summoned = spellInfo && GetSpellDuration(spellInfo) > 0;
|
||||
|
|
@ -138,7 +138,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
return false;
|
||||
}
|
||||
|
||||
PetType pet_type = PetType(fields[18].GetUInt8());
|
||||
PetType pet_type = PetType(fields[17].GetUInt8());
|
||||
if (pet_type == HUNTER_PET)
|
||||
{
|
||||
if (!creatureInfo->isTameable(owner->CanTameExoticPets()))
|
||||
|
|
@ -198,8 +198,6 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
break;
|
||||
case HUNTER_PET:
|
||||
SetByteFlag(UNIT_FIELD_BYTES_2, 2, fields[9].GetBool() ? UNIT_CAN_BE_ABANDONED : UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED);
|
||||
SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
|
||||
SetPower(POWER_HAPPINESS, fields[12].GetUInt32());
|
||||
setPowerType(POWER_FOCUS);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -247,13 +245,13 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
|
||||
// load action bar, if data broken will fill later by default spells.
|
||||
if (!is_temporary_summoned)
|
||||
m_charmInfo->LoadPetActionBar(fields[13].GetCppString());
|
||||
m_charmInfo->LoadPetActionBar(fields[12].GetCppString());
|
||||
|
||||
// since last save (in seconds)
|
||||
uint32 timediff = uint32(time(NULL) - fields[14].GetUInt64());
|
||||
uint32 timediff = uint32(time(NULL) - fields[13].GetUInt64());
|
||||
|
||||
m_resetTalentsCost = fields[15].GetUInt32();
|
||||
m_resetTalentsTime = fields[16].GetUInt64();
|
||||
m_resetTalentsCost = fields[14].GetUInt32();
|
||||
m_resetTalentsTime = fields[15].GetUInt64();
|
||||
|
||||
delete result;
|
||||
|
||||
|
|
@ -405,8 +403,8 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
|
||||
// save pet
|
||||
SqlStatement savePet = CharacterDatabase.CreateStatement(insPet, "INSERT INTO character_pet ( id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, "
|
||||
"curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) "
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
"curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) "
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
savePet.addUInt32(m_charmInfo->GetPetNumber());
|
||||
savePet.addUInt32(GetEntry());
|
||||
|
|
@ -420,7 +418,6 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
savePet.addUInt32(uint32(HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ? 0 : 1));
|
||||
savePet.addUInt32((curhealth < 1 ? 1 : curhealth));
|
||||
savePet.addUInt32(curmana);
|
||||
savePet.addUInt32(GetPower(POWER_HAPPINESS));
|
||||
|
||||
std::ostringstream ss;
|
||||
for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i)
|
||||
|
|
@ -491,12 +488,6 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual
|
|||
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)
|
||||
|
|
@ -587,17 +578,6 @@ void Pet::RegenerateAll(uint32 update_diff)
|
|||
}
|
||||
else
|
||||
m_regenTimer -= update_diff;
|
||||
|
||||
if (getPetType() != HUNTER_PET)
|
||||
return;
|
||||
|
||||
if (m_happinessTimer <= update_diff)
|
||||
{
|
||||
LooseHappiness();
|
||||
m_happinessTimer = 7500;
|
||||
}
|
||||
else
|
||||
m_happinessTimer -= update_diff;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -638,27 +618,6 @@ void Pet::Regenerate(Powers power)
|
|||
ModifyPower(power, (int32)addvalue);
|
||||
}
|
||||
|
||||
void Pet::LooseHappiness()
|
||||
{
|
||||
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.5);
|
||||
ModifyPower(POWER_HAPPINESS, -addvalue);
|
||||
}
|
||||
|
||||
HappinessState Pet::GetHappinessState()
|
||||
{
|
||||
if (GetPower(POWER_HAPPINESS) < HAPPINESS_LEVEL_SIZE)
|
||||
return UNHAPPY;
|
||||
else if (GetPower(POWER_HAPPINESS) >= HAPPINESS_LEVEL_SIZE * 2)
|
||||
return HAPPY;
|
||||
else
|
||||
return CONTENT;
|
||||
}
|
||||
|
||||
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
||||
{
|
||||
uint8 activecount = 1;
|
||||
|
|
@ -860,8 +819,6 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
}
|
||||
SetDisplayId(creature->GetDisplayId());
|
||||
SetNativeDisplayId(creature->GetNativeDisplayId());
|
||||
SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
|
||||
SetPower(POWER_HAPPINESS, 166500);
|
||||
setPowerType(POWER_FOCUS);
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
|
|
|
|||
|
|
@ -58,13 +58,6 @@ enum PetModeFlags
|
|||
PET_MODE_DEFAULT = PET_MODE_UNKNOWN_0 | PET_MODE_UNKNOWN_2,
|
||||
};
|
||||
|
||||
enum HappinessState
|
||||
{
|
||||
UNHAPPY = 1,
|
||||
CONTENT = 2,
|
||||
HAPPY = 3
|
||||
};
|
||||
|
||||
enum PetSpellState
|
||||
{
|
||||
PETSPELL_UNCHANGED = 0,
|
||||
|
|
@ -170,8 +163,6 @@ class MANGOS_DLL_SPEC Pet : public Creature
|
|||
|
||||
void RegenerateAll(uint32 update_diff) override; // overwrite Creature::RegenerateAll
|
||||
void Regenerate(Powers power);
|
||||
void LooseHappiness();
|
||||
HappinessState GetHappinessState();
|
||||
void GivePetXP(uint32 xp);
|
||||
void GivePetLevel(uint32 level);
|
||||
void SynchronizeLevelWithOwner();
|
||||
|
|
@ -249,7 +240,6 @@ class MANGOS_DLL_SPEC Pet : public Creature
|
|||
|
||||
bool m_removed; // prevent overwrite pet state in DB at next Pet::Update if pet already removed(saved)
|
||||
protected:
|
||||
uint32 m_happinessTimer;
|
||||
PetType m_petType;
|
||||
int32 m_duration; // time until unsummon (used mostly for summoned guardians and not used for controlled pets)
|
||||
int32 m_bonusdamage;
|
||||
|
|
|
|||
|
|
@ -554,12 +554,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recv_data)
|
|||
if (Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid))
|
||||
{
|
||||
if (pet->IsPet())
|
||||
{
|
||||
if (pet->GetObjectGuid() == _player->GetPetGuid())
|
||||
pet->ModifyPower(POWER_HAPPINESS, -50000);
|
||||
|
||||
((Pet*)pet)->Unsummon(PET_SAVE_AS_DELETED, _player);
|
||||
}
|
||||
else if (pet->GetObjectGuid() == _player->GetCharmGuid())
|
||||
{
|
||||
_player->Uncharm();
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@
|
|||
|
||||
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
|
||||
|
||||
#define PLAYER_SKILL_INDEX(x) (PLAYER_SKILL_INFO_1_1 + ((x)*3))
|
||||
// FIXME
|
||||
#define PLAYER_SKILL_INDEX(x) (PLAYER_SKILL_LINEID_0 + ((x)*3))
|
||||
#define PLAYER_SKILL_VALUE_INDEX(x) (PLAYER_SKILL_INDEX(x)+1)
|
||||
#define PLAYER_SKILL_BONUS_INDEX(x) (PLAYER_SKILL_INDEX(x)+2)
|
||||
|
||||
|
|
@ -2094,7 +2095,6 @@ void Player::Regenerate(Powers power, uint32 diff)
|
|||
}
|
||||
}
|
||||
} break;
|
||||
case POWER_HAPPINESS:
|
||||
case POWER_HEALTH:
|
||||
break;
|
||||
}
|
||||
|
|
@ -2510,14 +2510,12 @@ void Player::GiveLevel(uint32 level)
|
|||
WorldPacket data(SMSG_LEVELUP_INFO, (4 + 4 + MAX_POWERS * 4 + MAX_STATS * 4));
|
||||
data << uint32(level);
|
||||
data << uint32(int32(classInfo.basehealth) - int32(GetCreateHealth()));
|
||||
// for(int i = 0; i < MAX_POWERS; ++i) // Powers loop (0-6)
|
||||
// for(int i = 0; i < MAX_POWERS; ++i) // Powers loop (0-4)
|
||||
data << uint32(int32(classInfo.basemana) - int32(GetCreateMana()));
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
// end for
|
||||
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4)
|
||||
data << uint32(int32(info.stats[i]) - GetCreateStat(Stats(i)));
|
||||
|
|
@ -2556,7 +2554,6 @@ void Player::GiveLevel(uint32 level)
|
|||
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
|
||||
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
|
||||
SetPower(POWER_FOCUS, 0);
|
||||
SetPower(POWER_HAPPINESS, 0);
|
||||
|
||||
_ApplyAllLevelScaleItemMods(true);
|
||||
|
||||
|
|
@ -2762,7 +2759,6 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
|
||||
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
|
||||
SetPower(POWER_FOCUS, 0);
|
||||
SetPower(POWER_HAPPINESS, 0);
|
||||
SetPower(POWER_RUNIC_POWER, 0);
|
||||
|
||||
// update level to hunter/summon pet
|
||||
|
|
@ -3873,6 +3869,8 @@ void Player::InitVisibleBits()
|
|||
updateVisualBits.SetBit(OBJECT_FIELD_GUID);
|
||||
updateVisualBits.SetBit(OBJECT_FIELD_TYPE);
|
||||
updateVisualBits.SetBit(OBJECT_FIELD_ENTRY);
|
||||
updateVisualBits.SetBit(OBJECT_FIELD_DATA + 0);
|
||||
updateVisualBits.SetBit(OBJECT_FIELD_DATA + 1);
|
||||
updateVisualBits.SetBit(OBJECT_FIELD_SCALE_X);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_CHARM + 0);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_CHARM + 1);
|
||||
|
|
@ -3891,22 +3889,12 @@ void Player::InitVisibleBits()
|
|||
updateVisualBits.SetBit(UNIT_FIELD_POWER3);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER4);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER5);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER6);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER7);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER8);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER9);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER10);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXHEALTH);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER1);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER2);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER3);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER4);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER5);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER6);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER7);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER8);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER9);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER10);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_LEVEL);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE);
|
||||
updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 0);
|
||||
|
|
@ -3937,11 +3925,13 @@ void Player::InitVisibleBits()
|
|||
updateVisualBits.SetBit(PLAYER_FLAGS);
|
||||
//updateVisualBits.SetBit(PLAYER_GUILDID);
|
||||
updateVisualBits.SetBit(PLAYER_GUILDRANK);
|
||||
updateVisualBits.SetBit(PLAYER_GUILDLEVEL);
|
||||
updateVisualBits.SetBit(PLAYER_BYTES);
|
||||
updateVisualBits.SetBit(PLAYER_BYTES_2);
|
||||
updateVisualBits.SetBit(PLAYER_BYTES_3);
|
||||
updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
|
||||
updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP);
|
||||
updateVisualBits.SetBit(UNIT_NPC_FLAGS);
|
||||
|
||||
// PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
|
||||
for (uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
|
||||
|
|
@ -15532,8 +15522,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
//"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty,"
|
||||
// 39 40 41 42 43 44 45 46 47 48 49
|
||||
//"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk,"
|
||||
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
||||
//"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
// 50 51 52 53 54 55 56 57 58 59 60 61
|
||||
//"health, power1, power2, power3, power4, power5, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
|
||||
|
||||
if (!result)
|
||||
|
|
@ -15583,8 +15573,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
|
||||
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
|
||||
|
||||
_LoadIntoDataField(fields[63].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[65].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
_LoadIntoDataField(fields[58].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[60].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
|
||||
InitDisplayIds(); // model, scale and model data
|
||||
|
||||
|
|
@ -15612,7 +15602,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
//SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());
|
||||
|
||||
// Action bars state
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[66].GetUInt8());
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[61].GetUInt8());
|
||||
|
||||
// cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
|
||||
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
|
||||
|
|
@ -15947,8 +15937,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
_LoadMailedItems(holder->GetResult(PLAYER_LOGIN_QUERY_LOADMAILEDITEMS));
|
||||
UpdateNextMailTimeAndUnreads();
|
||||
|
||||
m_specsCount = fields[61].GetUInt8();
|
||||
m_activeSpec = fields[62].GetUInt8();
|
||||
m_specsCount = fields[56].GetUInt8();
|
||||
m_activeSpec = fields[57].GetUInt8();
|
||||
|
||||
_LoadGlyphs(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGLYPHS));
|
||||
|
||||
|
|
@ -18159,10 +18149,10 @@ void Player::_SaveStats()
|
|||
SqlStatement stmt = CharacterDatabase.CreateStatement(delStats, "DELETE FROM character_stats WHERE guid = ?");
|
||||
stmt.PExecute(GetGUIDLow());
|
||||
|
||||
stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, maxpower8, maxpower9, maxpower10"
|
||||
stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5"
|
||||
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
|
||||
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower) "
|
||||
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
stmt.addUInt32(GetGUIDLow());
|
||||
stmt.addUInt32(GetMaxHealth());
|
||||
|
|
|
|||
|
|
@ -148,16 +148,17 @@ enum Powers
|
|||
POWER_RAGE = 1,
|
||||
POWER_FOCUS = 2,
|
||||
POWER_ENERGY = 3,
|
||||
POWER_HAPPINESS = 4,
|
||||
//POWER_HAPPINESS = 4, unused 4.x.x
|
||||
POWER_RUNE = 5,
|
||||
POWER_RUNIC_POWER = 6,
|
||||
POWER_SOUL_SHARDS = 7,
|
||||
POWER_ECLIPSE = 8,
|
||||
POWER_HOLY_POWER = 9,
|
||||
POWER_ALTERNATE = 10,
|
||||
POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value)
|
||||
};
|
||||
|
||||
#define MAX_POWERS 10
|
||||
#define MAX_POWERS 5
|
||||
|
||||
enum SpellSchools
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6485,7 +6485,6 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel
|
|||
case POWER_RAGE:
|
||||
case POWER_FOCUS:
|
||||
case POWER_ENERGY:
|
||||
case POWER_HAPPINESS:
|
||||
powerCost += manaCostPct * caster->GetMaxPower(Powers(spellInfo->powerType)) / 100;
|
||||
break;
|
||||
case POWER_RUNE:
|
||||
|
|
|
|||
|
|
@ -1120,27 +1120,6 @@ void Pet::UpdateDamagePhysical(WeaponAttackType attType)
|
|||
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct;
|
||||
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct;
|
||||
|
||||
// Pet's base damage changes depending on happiness
|
||||
if (getPetType() == HUNTER_PET && attType == BASE_ATTACK)
|
||||
{
|
||||
switch (GetHappinessState())
|
||||
{
|
||||
case HAPPY:
|
||||
// 125% of normal damage
|
||||
mindamage = mindamage * 1.25f;
|
||||
maxdamage = maxdamage * 1.25f;
|
||||
break;
|
||||
case CONTENT:
|
||||
// 100% of normal damage, nothing to modify
|
||||
break;
|
||||
case UNHAPPY:
|
||||
// 75% of normal damage
|
||||
mindamage = mindamage * 0.75f;
|
||||
maxdamage = maxdamage * 0.75f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage);
|
||||
SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5403,10 +5403,6 @@ void Unit::setPowerType(Powers new_powertype)
|
|||
case POWER_ENERGY:
|
||||
SetMaxPower(POWER_ENERGY, GetCreatePowers(POWER_ENERGY));
|
||||
break;
|
||||
case POWER_HAPPINESS:
|
||||
SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
|
||||
SetPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9144,7 +9140,6 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
|
|||
case UNIT_MOD_RAGE:
|
||||
case UNIT_MOD_FOCUS:
|
||||
case UNIT_MOD_ENERGY:
|
||||
case UNIT_MOD_HAPPINESS:
|
||||
case UNIT_MOD_RUNE:
|
||||
case UNIT_MOD_RUNIC_POWER: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break;
|
||||
|
||||
|
|
@ -9265,7 +9260,6 @@ Powers Unit::GetPowerTypeByAuraGroup(UnitMods unitMod) const
|
|||
case UNIT_MOD_RAGE: return POWER_RAGE;
|
||||
case UNIT_MOD_FOCUS: return POWER_FOCUS;
|
||||
case UNIT_MOD_ENERGY: return POWER_ENERGY;
|
||||
case UNIT_MOD_HAPPINESS: return POWER_HAPPINESS;
|
||||
case UNIT_MOD_RUNE: return POWER_RUNE;
|
||||
case UNIT_MOD_RUNIC_POWER: return POWER_RUNIC_POWER;
|
||||
default: return POWER_MANA;
|
||||
|
|
@ -9397,12 +9391,6 @@ void Unit::SetPower(Powers power, uint32 val)
|
|||
if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
|
||||
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER);
|
||||
}
|
||||
|
||||
// Update the pet's character sheet with happiness damage bonus
|
||||
if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
|
||||
{
|
||||
pet->UpdateDamagePhysical(BASE_ATTACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9497,7 +9485,6 @@ uint32 Unit::GetCreatePowers(Powers power) const
|
|||
return 100;
|
||||
return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
|
||||
case POWER_ENERGY: return 100;
|
||||
case POWER_HAPPINESS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
|
||||
case POWER_RUNE: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 8 : 0);
|
||||
case POWER_RUNIC_POWER: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 1000 : 0);
|
||||
case POWER_SOUL_SHARDS: return 0; // TODO: fix me
|
||||
|
|
|
|||
|
|
@ -332,7 +332,6 @@ enum UnitMods
|
|||
UNIT_MOD_RAGE,
|
||||
UNIT_MOD_FOCUS,
|
||||
UNIT_MOD_ENERGY,
|
||||
UNIT_MOD_HAPPINESS,
|
||||
UNIT_MOD_RUNE,
|
||||
UNIT_MOD_RUNIC_POWER,
|
||||
UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existing order, it's accessed by index values of SpellSchools enum.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue