Core/Mechanics:
- Add basic support for focus used by players (hunters) - Drop all support for pet happieness (as it has been completely removed) - Add new fields to characters db to store new power values (Should now be able to create characters again)
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
|
||||
Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner),
|
||||
m_usedTalentCount(0), m_removed(false), m_owner(owner),
|
||||
m_happinessTimer(7500), m_petType(type), m_duration(0),
|
||||
m_petType(type), m_duration(0),
|
||||
m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL)
|
||||
{
|
||||
m_unitTypeMask |= UNIT_MASK_PET;
|
||||
@@ -102,25 +102,25 @@ 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
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType "
|
||||
// known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, 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
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType "
|
||||
// current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, 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
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType "
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, 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
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType "
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u') ",
|
||||
ownerid, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
|
||||
@@ -137,7 +137,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
if (!petentry)
|
||||
return false;
|
||||
|
||||
uint32 summon_spell_id = fields[15].GetUInt32();
|
||||
uint32 summon_spell_id = fields[14].GetUInt32();
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summon_spell_id);
|
||||
|
||||
bool is_temporary_summoned = spellInfo && spellInfo->GetDuration() > 0;
|
||||
@@ -146,7 +146,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
if (current && is_temporary_summoned)
|
||||
return false;
|
||||
|
||||
PetType pet_type = PetType(fields[16].GetUInt8());
|
||||
PetType pet_type = PetType(fields[15].GetUInt8());
|
||||
if (pet_type == HUNTER_PET)
|
||||
{
|
||||
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petentry);
|
||||
@@ -213,8 +213,6 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
|
||||
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||
// this enables popup window (pet abandon, cancel)
|
||||
SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
|
||||
SetPower(POWER_HAPPINESS, fields[12].GetUInt32());
|
||||
setPowerType(POWER_FOCUS);
|
||||
break;
|
||||
default:
|
||||
@@ -283,13 +281,13 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
|
||||
InitTalentForLevel(); // set original talents points before spell loading
|
||||
|
||||
uint32 timediff = uint32(time(NULL) - fields[14].GetUInt32());
|
||||
uint32 timediff = uint32(time(NULL) - fields[13].GetUInt32());
|
||||
_LoadAuras(timediff);
|
||||
|
||||
// load action bar, if data broken will fill later by default spells.
|
||||
if (!is_temporary_summoned)
|
||||
{
|
||||
m_charmInfo->LoadPetActionBar(fields[13].GetString());
|
||||
m_charmInfo->LoadPetActionBar(fields[12].GetString());
|
||||
|
||||
_LoadSpells();
|
||||
InitTalentForLevel(); // re-init to check talent count
|
||||
@@ -400,7 +398,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||
ownerLowGUID, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
// save pet
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType) "
|
||||
ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType) "
|
||||
<< "VALUES ("
|
||||
<< m_charmInfo->GetPetNumber() << ','
|
||||
<< GetEntry() << ','
|
||||
@@ -413,8 +411,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||
<< name.c_str() << "', "
|
||||
<< uint32(HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ? 0 : 1) << ','
|
||||
<< curhealth << ','
|
||||
<< curmana << ','
|
||||
<< GetPower(POWER_HAPPINESS) << ", '";
|
||||
<< curmana << ", '";
|
||||
|
||||
for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i)
|
||||
{
|
||||
@@ -459,12 +456,6 @@ void Pet::setDeathState(DeathState s) // overwrite virtual
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
@@ -552,18 +543,6 @@ void Pet::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getPetType() != HUNTER_PET)
|
||||
break;
|
||||
|
||||
if (m_happinessTimer <= diff)
|
||||
{
|
||||
LoseHappiness();
|
||||
m_happinessTimer = 7500;
|
||||
}
|
||||
else
|
||||
m_happinessTimer -= diff;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -611,27 +590,6 @@ void Creature::Regenerate(Powers power)
|
||||
ModifyPower(power, int32(addvalue));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void Pet::Remove(PetSaveMode mode, bool returnreagent)
|
||||
{
|
||||
m_owner->RemovePet(this, mode, returnreagent);
|
||||
@@ -744,8 +702,6 @@ bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phas
|
||||
if (!Create(guid, map, phaseMask, cinfo->Entry, pet_number))
|
||||
return false;
|
||||
|
||||
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);
|
||||
|
||||
@@ -42,13 +42,6 @@ enum PetSaveMode
|
||||
PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100
|
||||
};
|
||||
|
||||
enum HappinessState
|
||||
{
|
||||
UNHAPPY = 1,
|
||||
CONTENT = 2,
|
||||
HAPPY = 3
|
||||
};
|
||||
|
||||
enum PetSpellState
|
||||
{
|
||||
PETSPELL_UNCHANGED = 0,
|
||||
@@ -108,8 +101,6 @@ enum PetNameInvalidReason
|
||||
typedef UNORDERED_MAP<uint32, PetSpell> PetSpellMap;
|
||||
typedef std::vector<uint32> AutoSpellList;
|
||||
|
||||
#define HAPPINESS_LEVEL_SIZE 333000
|
||||
|
||||
#define ACTIVE_SPELLS_MAX 4
|
||||
|
||||
#define PET_FOLLOW_DIST 1.0f
|
||||
@@ -156,8 +147,6 @@ class Pet : public Guardian
|
||||
return m_autospells[pos];
|
||||
}
|
||||
|
||||
void LoseHappiness();
|
||||
HappinessState GetHappinessState();
|
||||
void GivePetXP(uint32 xp);
|
||||
void GivePetLevel(uint8 level);
|
||||
void SynchronizeLevelWithOwner();
|
||||
@@ -226,7 +215,6 @@ class Pet : public Guardian
|
||||
Player* GetOwner() { return m_owner; }
|
||||
protected:
|
||||
Player* m_owner;
|
||||
uint32 m_happinessTimer;
|
||||
PetType m_petType;
|
||||
int32 m_duration; // time until unsummon (used mostly for summoned guardians and not used for controlled pets)
|
||||
uint64 m_auraRaidUpdateMask;
|
||||
|
||||
@@ -2490,7 +2490,7 @@ void Player::RegenerateAll()
|
||||
m_regenTimerCount += m_regenTimer;
|
||||
|
||||
Regenerate(POWER_ENERGY);
|
||||
|
||||
Regenerate(POWER_FOCUS);
|
||||
Regenerate(POWER_MANA);
|
||||
|
||||
// Runes act as cooldowns, and they don't need to send any data
|
||||
@@ -2547,7 +2547,8 @@ void Player::Regenerate(Powers power)
|
||||
addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
|
||||
else
|
||||
addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case POWER_RAGE: // Regenerate rage
|
||||
{
|
||||
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
|
||||
@@ -2555,7 +2556,8 @@ void Player::Regenerate(Powers power)
|
||||
float RageDecreaseRate = sWorld->getRate(RATE_POWER_RAGE_LOSS);
|
||||
addvalue += -20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case POWER_ENERGY: // Regenerate energy (rogue)
|
||||
addvalue += 0.01f * m_regenTimer * sWorld->getRate(RATE_POWER_ENERGY);
|
||||
break;
|
||||
@@ -2566,10 +2568,12 @@ void Player::Regenerate(Powers power)
|
||||
float RunicPowerDecreaseRate = sWorld->getRate(RATE_POWER_RUNICPOWER_LOSS);
|
||||
addvalue += -30 * RunicPowerDecreaseRate; // 3 RunicPower by tick
|
||||
}
|
||||
} break;
|
||||
case POWER_RUNE:
|
||||
}
|
||||
break;
|
||||
case POWER_FOCUS:
|
||||
case POWER_HAPPINESS:
|
||||
addvalue += 4.0f * m_modAttackSpeedPct[RANGED_ATTACK] * sWorld->getRate(RATE_POWER_FOCUS);
|
||||
break;
|
||||
case POWER_RUNE:
|
||||
case POWER_HEALTH:
|
||||
break;
|
||||
default:
|
||||
@@ -3058,7 +3062,7 @@ void Player::GiveLevel(uint8 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-10)
|
||||
data << uint32(int32(classInfo.basemana) - int32(GetCreateMana()));
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
@@ -3066,6 +3070,10 @@ void Player::GiveLevel(uint8 level)
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
// end for
|
||||
for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4)
|
||||
data << uint32(int32(info.stats[i]) - GetCreateStat(Stats(i)));
|
||||
@@ -3106,7 +3114,6 @@ void Player::GiveLevel(uint8 level)
|
||||
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
|
||||
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
|
||||
SetPower(POWER_FOCUS, 0);
|
||||
SetPower(POWER_HAPPINESS, 0);
|
||||
|
||||
_ApplyAllLevelScaleItemMods(true);
|
||||
|
||||
@@ -3292,7 +3299,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||
|
||||
// save new stats
|
||||
for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||
SetMaxPower(Powers(i), uint32(GetCreatePowers(Powers(i))));
|
||||
SetMaxPower(Powers(i), GetCreatePowers(Powers(i)));
|
||||
|
||||
SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later
|
||||
|
||||
@@ -3329,8 +3336,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
|
||||
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
|
||||
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
|
||||
SetPower(POWER_FOCUS, 0);
|
||||
SetPower(POWER_HAPPINESS, 0);
|
||||
SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS));
|
||||
SetPower(POWER_RUNIC_POWER, 0);
|
||||
|
||||
// update level to hunter/summon pet
|
||||
@@ -5137,6 +5143,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
||||
SetPower(POWER_MANA, uint32(GetMaxPower(POWER_MANA)*restore_percent));
|
||||
SetPower(POWER_RAGE, 0);
|
||||
SetPower(POWER_ENERGY, uint32(GetMaxPower(POWER_ENERGY)*restore_percent));
|
||||
SetPower(POWER_FOCUS, uint32(GetMaxPower(POWER_FOCUS)*restore_percent));
|
||||
}
|
||||
|
||||
// trigger update zone for alive state zone updates
|
||||
@@ -16638,8 +16645,10 @@ bool Player::LoadFromDB(uint32 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, instance_mode_mask, "
|
||||
// 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, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid);
|
||||
// 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, power11, instance_id, speccount, activespec, exploredZones, equipmentCache, "
|
||||
// 67 68 69 70
|
||||
//"ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid);
|
||||
PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADFROM);
|
||||
|
||||
if (!result)
|
||||
@@ -16698,8 +16707,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
|
||||
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
|
||||
|
||||
_LoadIntoDataField(fields[61].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[64].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
_LoadIntoDataField(fields[65].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[68].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
|
||||
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
|
||||
@@ -16721,10 +16730,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
|
||||
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());
|
||||
|
||||
SetUInt32Value(PLAYER_AMMO_ID, fields[63].GetUInt32());
|
||||
SetUInt32Value(PLAYER_AMMO_ID, fields[67].GetUInt32());
|
||||
|
||||
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[65].GetUInt8());
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[69].GetUInt8());
|
||||
|
||||
InitDisplayIds();
|
||||
|
||||
@@ -16755,7 +16764,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
uint32 transGUID = uint32(fields[30].GetUInt64()); // field type is uint64 but lowguid is saved
|
||||
Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat());
|
||||
uint32 mapId = fields[15].GetUInt16();
|
||||
uint32 instanceId = fields[58].GetUInt8();
|
||||
uint32 instanceId = fields[62].GetUInt8();
|
||||
|
||||
uint32 dungeonDiff = fields[38].GetUInt32() & 0x0F;
|
||||
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
|
||||
@@ -17117,8 +17126,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
//mails are loaded only when needed ;-) - when player in game click on mailbox.
|
||||
//_LoadMail();
|
||||
|
||||
m_specsCount = fields[59].GetUInt8();
|
||||
m_activeSpec = fields[60].GetUInt8();
|
||||
m_specsCount = fields[63].GetUInt8();
|
||||
m_activeSpec = fields[64].GetUInt8();
|
||||
|
||||
// sanity check
|
||||
if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS)
|
||||
@@ -17248,7 +17257,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
}
|
||||
|
||||
// RaF stuff.
|
||||
m_grantableLevels = fields[66].GetUInt32();
|
||||
m_grantableLevels = fields[70].GetUInt32();
|
||||
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
|
||||
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND);
|
||||
|
||||
@@ -19133,7 +19142,7 @@ void Player::_SaveStats(SQLTransaction& trans)
|
||||
|
||||
trans->PAppend("DELETE FROM character_stats WHERE guid = '%u'", GetGUIDLow());
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, "
|
||||
ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, maxpower8, maxpower9, maxpower10, maxpower11, "
|
||||
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
|
||||
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower, resilience) VALUES ("
|
||||
<< GetGUIDLow() << ','
|
||||
@@ -22670,8 +22679,8 @@ void Player::ResurectUsingRequestData()
|
||||
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
|
||||
|
||||
SetPower(POWER_RAGE, 0);
|
||||
|
||||
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
|
||||
SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS));
|
||||
|
||||
SpawnCorpseBones();
|
||||
}
|
||||
|
||||
@@ -1384,27 +1384,6 @@ void Guardian::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 (isHunterPet() && attType == BASE_ATTACK)
|
||||
{
|
||||
switch (ToPet()->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;
|
||||
}
|
||||
}
|
||||
|
||||
Unit::AuraEffectList const& mDummy = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACKSPEED);
|
||||
for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
|
||||
{
|
||||
|
||||
@@ -9193,10 +9193,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13398,7 +13394,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;
|
||||
|
||||
@@ -13518,7 +13513,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:
|
||||
@@ -13621,12 +13615,12 @@ void Unit::SetMaxHealth(uint32 val)
|
||||
SetHealth(val);
|
||||
}
|
||||
|
||||
void Unit::SetPower(Powers power, uint32 val)
|
||||
void Unit::SetPower(Powers power, int32 val)
|
||||
{
|
||||
if (GetPower(power) == val)
|
||||
return;
|
||||
|
||||
uint32 maxPower = GetMaxPower(power);
|
||||
int32 maxPower = (int32)GetMaxPower(power);
|
||||
if (maxPower < val)
|
||||
val = maxPower;
|
||||
|
||||
@@ -13634,8 +13628,9 @@ void Unit::SetPower(Powers power, uint32 val)
|
||||
|
||||
WorldPacket data(SMSG_POWER_UPDATE);
|
||||
data.append(GetPackGUID());
|
||||
data << int32(1); // Unk
|
||||
data << uint8(power);
|
||||
data << uint32(val);
|
||||
data << int32(val);
|
||||
SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER ? true : false);
|
||||
|
||||
// group update
|
||||
@@ -13652,16 +13647,12 @@ void Unit::SetPower(Powers power, uint32 val)
|
||||
if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
|
||||
owner->ToPlayer()->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);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SetMaxPower(Powers power, uint32 val)
|
||||
void Unit::SetMaxPower(Powers power, int32 val)
|
||||
{
|
||||
uint32 cur_power = GetPower(power);
|
||||
int32 cur_power = GetPower(power);
|
||||
SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + power, val);
|
||||
|
||||
// group update
|
||||
@@ -13684,19 +13675,32 @@ void Unit::SetMaxPower(Powers power, uint32 val)
|
||||
SetPower(power, val);
|
||||
}
|
||||
|
||||
uint32 Unit::GetCreatePowers(Powers power) const
|
||||
int32 Unit::GetCreatePowers(Powers power) const
|
||||
{
|
||||
// POWER_FOCUS and POWER_HAPPINESS only have hunter pet
|
||||
switch (power)
|
||||
{
|
||||
case POWER_MANA: return GetCreateMana();
|
||||
case POWER_RAGE: return 1000;
|
||||
case POWER_FOCUS: 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_RUNIC_POWER: return 1000;
|
||||
case POWER_RUNE: return 0;
|
||||
case POWER_HEALTH: return 0;
|
||||
case POWER_MANA:
|
||||
return GetCreateMana();
|
||||
case POWER_RAGE:
|
||||
return 1000;
|
||||
case POWER_FOCUS:
|
||||
if (GetTypeId() == TYPEID_PLAYER && getClass() == CLASS_HUNTER)
|
||||
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_RUNIC_POWER:
|
||||
return 1000;
|
||||
case POWER_RUNE:
|
||||
return 0;
|
||||
case POWER_SOULSHARD:
|
||||
return 3;
|
||||
case POWER_ECLIPSE:
|
||||
return 0;
|
||||
case POWER_HOLY_POWER:
|
||||
return 0;
|
||||
case POWER_HEALTH:
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -417,7 +417,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 existed order, it's accessed by index values of SpellSchools enum.
|
||||
@@ -1370,10 +1369,10 @@ class Unit : public WorldObject
|
||||
|
||||
Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }
|
||||
void setPowerType(Powers power);
|
||||
uint32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); }
|
||||
int32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1+power); }
|
||||
uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1+power); }
|
||||
void SetPower(Powers power, uint32 val);
|
||||
void SetMaxPower(Powers power, uint32 val);
|
||||
void SetPower(Powers power, int32 val);
|
||||
void SetMaxPower(Powers power, int32 val);
|
||||
// returns the change in power
|
||||
int32 ModifyPower(Powers power, int32 val);
|
||||
int32 ModifyPowerPct(Powers power, float pct, bool apply = true);
|
||||
@@ -1870,7 +1869,7 @@ class Unit : public WorldObject
|
||||
uint32 GetCreateHealth() const { return GetUInt32Value(UNIT_FIELD_BASE_HEALTH); }
|
||||
void SetCreateMana(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_MANA, val); }
|
||||
uint32 GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA); }
|
||||
uint32 GetCreatePowers(Powers power) const;
|
||||
int32 GetCreatePowers(Powers power) const;
|
||||
float GetPosStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_POSSTAT0+stat); }
|
||||
float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0+stat); }
|
||||
float GetCreateStat(Stats stat) const { return m_createStats[stat]; }
|
||||
|
||||
@@ -673,15 +673,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recv_data)
|
||||
if (pet)
|
||||
{
|
||||
if (pet->isPet())
|
||||
{
|
||||
if (pet->GetGUID() == _player->GetPetGUID())
|
||||
{
|
||||
uint32 feelty = pet->GetPower(POWER_HAPPINESS);
|
||||
pet->SetPower(POWER_HAPPINESS, feelty > 50000 ? (feelty-50000) : 0);
|
||||
}
|
||||
|
||||
_player->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
|
||||
}
|
||||
else if (pet->GetGUID() == _player->GetCharmGUID())
|
||||
_player->StopCastingCharm();
|
||||
}
|
||||
|
||||
@@ -6195,6 +6195,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
|
||||
player->SetPower(POWER_MANA, mana);
|
||||
player->SetPower(POWER_RAGE, 0);
|
||||
player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY));
|
||||
player->SetPower(POWER_FOCUS, 0);
|
||||
|
||||
player->SpawnCorpseBones();
|
||||
}
|
||||
|
||||
@@ -2170,7 +2170,6 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
|
||||
case POWER_RAGE:
|
||||
case POWER_FOCUS:
|
||||
case POWER_ENERGY:
|
||||
case POWER_HAPPINESS:
|
||||
powerCost += int32(CalculatePctU(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
|
||||
break;
|
||||
case POWER_RUNE:
|
||||
|
||||
@@ -42,7 +42,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
"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, instance_mode_mask, "
|
||||
"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, "
|
||||
"health, power1, power2, power3, power4, power5, power6, power7, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = ?", CONNECTION_ASYNC)
|
||||
"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, power11, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = ?", CONNECTION_ASYNC)
|
||||
PREPARE_STATEMENT(CHAR_LOAD_PLAYER_GROUP, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_ASYNC)
|
||||
PREPARE_STATEMENT(CHAR_LOAD_PLAYER_BOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = ?", CONNECTION_ASYNC)
|
||||
PREPARE_STATEMENT(CHAR_LOAD_PLAYER_AURAS, "SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, "
|
||||
|
||||
Reference in New Issue
Block a user