diff options
author | megamage <none@none> | 2009-01-12 10:53:53 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-12 10:53:53 -0600 |
commit | 4daadd712f46e85ee8754428dfc92e9ac91c9c47 (patch) | |
tree | d8f81f4a10f3bc4087b05a02d2e5b93f42d601bb /src | |
parent | 218f4c4c4b6cf3a91ad696d08d09085f480ccea8 (diff) |
*Update to Mangos 7072.
*Remove some duplicated functions of possess.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Chat.cpp | 8 | ||||
-rw-r--r-- | src/game/Creature.h | 2 | ||||
-rw-r--r-- | src/game/LootHandler.cpp | 16 | ||||
-rw-r--r-- | src/game/MovementHandler.cpp | 4 | ||||
-rw-r--r-- | src/game/Object.h | 3 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 4 | ||||
-rw-r--r-- | src/game/Player.cpp | 124 | ||||
-rw-r--r-- | src/game/Player.h | 46 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 7 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 7 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 8 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 5 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 1 | ||||
-rw-r--r-- | src/game/Unit.cpp | 14 | ||||
-rw-r--r-- | src/game/WorldSession.h | 2 | ||||
-rw-r--r-- | src/shared/revision_nr.h | 2 |
16 files changed, 146 insertions, 107 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 3ee8a3255a9..2b7b8fbbe41 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -712,14 +712,14 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac { uint32 target_sec; - // ignore only for non-players for non strong checks (when allow apply command at least to same sec level) - if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld.getConfig(CONFIG_GM_LOWER_SECURITY)) - return false; - // allow everything from console and RA console if (!m_session) return false; + // ignore only for non-players for non strong checks (when allow apply command at least to same sec level) + if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld.getConfig(CONFIG_GM_LOWER_SECURITY)) + return false; + if (target) target_sec = target->GetSecurity(); else if (target_account) diff --git a/src/game/Creature.h b/src/game/Creature.h index b3ebe87de92..9d963d80a1f 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -219,6 +219,8 @@ struct CreatureInfo return SKILL_HERBALISM; else if(type_flags & CREATURE_TYPEFLAGS_MININGLOOT) return SKILL_MINING; + else if(type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT) + return SKILL_ENGINERING; else return SKILL_SKINNING; // normal case } diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index f1110ca3853..8f8b5d2b6e9 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -384,14 +384,22 @@ void WorldSession::DoLootRelease( uint64 lguid ) Item *pItem = player->GetItemByGuid(lguid ); if(!pItem) return; - if( (pItem->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) && - pItem->GetProto()->Class == ITEM_CLASS_TRADE_GOODS && - pItem->GetCount() >= 5) + + ItemPrototype const* proto = pItem->GetProto(); + + // destroy only 5 items from stack in case prospecting and milling + if( (proto->BagFamily & (BAG_FAMILY_MASK_MINING_SUPP|BAG_FAMILY_MASK_HERBS)) && + proto->Class == ITEM_CLASS_TRADE_GOODS) { pItem->m_lootGenerated = false; pItem->loot.clear(); - uint32 count = 5; + uint32 count = pItem->GetCount(); + + // >=5 checked in spell code, but will work for cheating cases also with removing from another stacks. + if(count > 5) + count = 5; + player->DestroyItemCount(pItem, count, true); } else diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 29f673061b4..3dcabf77dd2 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -301,7 +301,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) GetPlayer()->HandleFallUnderMap(); } -void WorldSession::HandlePossessedMovement(WorldPacket& recv_data, MovementInfo& movementInfo, uint32& MovementFlags) +/*void WorldSession::HandlePossessedMovement(WorldPacket& recv_data, MovementInfo& movementInfo, uint32& MovementFlags) { // Whatever the client is controlling, it will send the GUID of the original player. // If current player is controlling, it must be handled like the controlled player sent these opcodes @@ -359,7 +359,7 @@ void WorldSession::HandlePossessedMovement(WorldPacket& recv_data, MovementInfo& Map* map = MapManager::Instance().GetMap(pos_unit->GetMapId(), pos_unit); map->CreatureRelocation((Creature*)pos_unit, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); } -} +}*/ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) { diff --git a/src/game/Object.h b/src/game/Object.h index fec06ec8419..56c931cc3b8 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -56,7 +56,8 @@ enum TypeMask TYPEMASK_DYNAMICOBJECT = 0x0040, TYPEMASK_CORPSE = 0x0080, TYPEMASK_AIGROUP = 0x0100, - TYPEMASK_AREATRIGGER = 0x0200 + TYPEMASK_AREATRIGGER = 0x0200, + TYPEMASK_FARSIGHTOBJ = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT }; enum TypeID diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 3e7a9d2925f..8f8fc418118 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -2325,7 +2325,7 @@ void ObjectMgr::LoadPlayerInfo() if(sWorld.getConfig(CONFIG_START_ALL_SPELLS)) result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom"); else - result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell"); + result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell"); uint32 count = 0; @@ -2360,7 +2360,7 @@ void ObjectMgr::LoadPlayerInfo() } PlayerInfo* pInfo = &playerInfo[current_race][current_class]; - pInfo->spell.push_back(CreateSpellPair(fields[2].GetUInt16(), fields[3].GetUInt8())); + pInfo->spell.push_back(fields[2].GetUInt32()); bar.step(); ++count; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e106073fb0c..e1e7c0b9e44 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -715,7 +715,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 } // original spells - learnDefaultSpells(true); + learnDefaultSpells(); // original action bar std::list<uint16>::const_iterator action_itr[4]; @@ -2636,13 +2636,13 @@ void Player::AddNewMailDeliverTime(time_t deliver_time) } } -bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, bool disabled) +bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool disabled) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) { // do character spell book cleanup (all characters) - if(loading && !learning) // spell load case + if(!IsInWorld() && !learning) // spell load case { sLog.outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.",spell_id); CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'",spell_id); @@ -2656,7 +2656,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, if(!SpellMgr::IsSpellValid(spellInfo,this,false)) { // do character spell book cleanup (all characters) - if(loading && !learning) // spell load case + if(!IsInWorld() && !learning) // spell load case { sLog.outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.",spell_id); CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'",spell_id); @@ -2680,8 +2680,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, { itr->second->active = active; - // loading && !learning == explicitly load from DB and then exist in it already and set correctly - if(loading && !learning) + // !IsInWorld() && !learning == explicitly load from DB and then exist in it already and set correctly + if(!IsInWorld() && !learning) itr->second->state = PLAYERSPELL_UNCHANGED; else if(itr->second->state != PLAYERSPELL_NEW) itr->second->state = PLAYERSPELL_CHANGED; @@ -2720,7 +2720,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, default: // known not saved yet spell (new or modified) { // can be in case spell loading but learned at some previous spell loading - if(loading && !learning) + if(!IsInWorld() && !learning) itr->second->state = PLAYERSPELL_UNCHANGED; return false; @@ -2753,8 +2753,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, // non talent spell: learn low ranks (recursive call) else if(uint32 prev_spell = spellmgr.GetPrevSpellInChain(spell_id)) { - if(loading) // at spells loading, no output, but allow save - addSpell(prev_spell,active,true,loading,disabled); + if(!IsInWorld()) // at spells loading, no output, but allow save + addSpell(prev_spell,active,true,disabled); else // at normal learning learnSpell(prev_spell); } @@ -2779,7 +2779,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, { if(spellmgr.IsHighRankOfSpell(spell_id,itr->first)) { - if(!loading) // not send spell (re-/over-)learn packets at loading + if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); data << uint16(itr->first); @@ -2794,7 +2794,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, } else if(spellmgr.IsHighRankOfSpell(itr->first,spell_id)) { - if(!loading) // not send spell (re-/over-)learn packets at loading + if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); data << uint16(spell_id); @@ -2831,23 +2831,27 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, // also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks else if (IsPassiveSpell(spell_id)) { - // if spell doesn't require a stance or the player is in the required stance - if( ( !spellInfo->Stances && - spell_id != 5420 && spell_id != 5419 && spell_id != 7376 && - spell_id != 7381 && spell_id != 21156 && spell_id != 21009 && - spell_id != 21178 && spell_id != 33948 && spell_id != 40121 ) || - m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))) || - (spell_id == 5420 && m_form == FORM_TREE) || - (spell_id == 5419 && m_form == FORM_TRAVEL) || - (spell_id == 7376 && m_form == FORM_DEFENSIVESTANCE) || - (spell_id == 7381 && m_form == FORM_BERSERKERSTANCE) || - (spell_id == 21156 && m_form == FORM_BATTLESTANCE)|| - (spell_id == 21178 && (m_form == FORM_BEAR || m_form == FORM_DIREBEAR) ) || - (spell_id == 33948 && m_form == FORM_FLIGHT) || - (spell_id == 40121 && m_form == FORM_FLIGHT_EPIC) ) + bool need_cast = false; + + switch(spell_id) + { + // some spells not have stance data expacted cast at form change or present + case 5420: need_cast = (m_form == FORM_TREE); break; + case 5419: need_cast = (m_form == FORM_TRAVEL); break; + case 7376: need_cast = (m_form == FORM_DEFENSIVESTANCE); break; + case 7381: need_cast = (m_form == FORM_BERSERKERSTANCE); break; + case 21156: need_cast = (m_form == FORM_BATTLESTANCE); break; + case 21178: need_cast = (m_form == FORM_BEAR || m_form == FORM_DIREBEAR); break; + case 33948: need_cast = (m_form == FORM_FLIGHT); break; + case 34764: need_cast = (m_form == FORM_FLIGHT); break; + case 40121: need_cast = (m_form == FORM_FLIGHT_EPIC); break; + case 40122: need_cast = (m_form == FORM_FLIGHT_EPIC); break; + // another spells have proper stance data + default: need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); break; + } //Check CasterAuraStates - if (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))) - CastSpell(this, spell_id, true); + if (need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)))) + CastSpell(this, spell_id, true); } else if( IsSpellHaveEffect(spellInfo,SPELL_EFFECT_SKILL_STEP) ) { @@ -2930,14 +2934,14 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading, { if(!itr->second.autoLearned) { - if(loading) // at spells loading, no output, but allow save - addSpell(itr->second.spell,true,true,loading); + if(!IsInWorld() || !itr->second.active) // at spells loading, no output, but allow save + addSpell(itr->second.spell,itr->second.active,true,false); else // at normal learning learnSpell(itr->second.spell); } } - if(!loading) + if(IsInWorld()) { GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS); @@ -2954,7 +2958,7 @@ void Player::learnSpell(uint32 spell_id) bool disabled = (itr != m_spells.end()) ? itr->second->disabled : false; bool active = disabled ? itr->second->active : true; - bool learning = addSpell(spell_id,active); + bool learning = addSpell(spell_id,active,true,false); // learn all disabled higher ranks (recursive) SpellChainNode const* node = spellmgr.GetSpellChainNode(spell_id); @@ -2965,8 +2969,8 @@ void Player::learnSpell(uint32 spell_id) learnSpell(node->next); } - // prevent duplicated entires in spell book - if(!learning) + // prevent duplicated entires in spell book, also not send if not in world (loading) + if(!learning || !IsInWorld ()) return; WorldPacket data(SMSG_LEARNED_SPELL, 4); @@ -14244,6 +14248,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) //Other way is to saves m_team into characters table. setFactionForRace(m_race); SetCharm(0); + SetMover(this); m_class = fields[5].GetUInt8(); @@ -14494,6 +14499,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // clear charm/summon related fields SetCharm(NULL); + SetMover(NULL); SetPet(NULL); SetCharmerGUID(NULL); SetOwnerGUID(NULL); @@ -14558,6 +14564,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // after spell load InitTalentForLevel(); learnSkillRewardedSpells(); + learnDefaultSpells(); + // after spell load, learn rewarded spell if need also _LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS)); @@ -15322,7 +15330,7 @@ void Player::_LoadSpells(QueryResult *result) { Field *fields = result->Fetch(); - addSpell(fields[0].GetUInt16(), fields[1].GetBool(), false, true, fields[2].GetBool()); + addSpell(fields[0].GetUInt16(), fields[1].GetBool(), false, fields[2].GetBool()); } while( result->NextRow() ); @@ -18451,22 +18459,18 @@ void Player::resetSpells() learnQuestRewardedSpells(); } -void Player::learnDefaultSpells(bool loading) +void Player::learnDefaultSpells() { // learn default race/class spells PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(),getClass()); - std::list<CreateSpellPair>::const_iterator spell_itr; - for (spell_itr = info->spell.begin(); spell_itr!=info->spell.end(); ++spell_itr) + for (PlayerCreateInfoSpells::const_iterator itr = info->spell.begin(); itr!=info->spell.end(); ++itr) { - uint16 tspell = spell_itr->first; - if (tspell) - { - sLog.outDebug("PLAYER: Adding initial spell, id = %u",tspell); - if(loading || !spell_itr->second) // not care about passive spells or loading case - addSpell(tspell,spell_itr->second); - else // but send in normal spell in game learn case - learnSpell(tspell); - } + uint32 tspell = *itr; + sLog.outDebug("PLAYER (Class: %u Race: %u): Adding initial spell, id = %u",uint32(getClass()),uint32(getRace()), tspell); + if(!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add + addSpell(tspell,true,true,false); + else // but send in normal spell in game learn case + learnSpell(tspell); } } @@ -19550,38 +19554,46 @@ void Player::RemovePossess(bool attack) }*/ } -void Player::SetViewport(uint64 guid, bool moveable) +/*void Player::SetViewport(uint64 guid, bool moveable) { WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, 8+1); data.appendPackGUID(guid); // Packed guid of object to set client's view to data << (moveable ? uint8(0x01) : uint8(0x00)); // 0 - can't move; 1 - can move m_session->SendPacket(&data); sLog.outDetail("Viewport for "I64FMT" (%s) changed to "I64FMT, GetGUID(), GetName(), guid); +}*/ + +void Player::SetBindSight(Unit *target) +{ + if(target) + target->AddPlayerToVision(this); + else + target->RemovePlayerFromVision(this); } WorldObject* Player::GetFarsightTarget() const { // Players can have in farsight field another player's guid, a creature's guid, or a dynamic object's guid - if (uint64 guid = GetUInt64Value(PLAYER_FARSIGHT)) - return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT); + if(uint64 guid = GetFarSight()) + return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_FARSIGHTOBJ); return NULL; } void Player::RemoveFarsightTarget() { - if (WorldObject* fTarget = GetFarsightTarget()) + if (WorldObject* target = GetFarsightTarget()) { - if (fTarget->isType(TYPEMASK_PLAYER | TYPEMASK_UNIT)) - ((Unit*)fTarget)->RemovePlayerFromVision(this); + if (target->isType(TYPEMASK_PLAYER | TYPEMASK_UNIT)) + ((Unit*)target)->RemovePlayerFromVision(this); } ClearFarsight(); } void Player::ClearFarsight() { - if (GetUInt64Value(PLAYER_FARSIGHT)) + if(GetFarSight()) { - SetUInt64Value(PLAYER_FARSIGHT, 0); + SetFarSight(0); WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0); GetSession()->SendPacket(&data); } @@ -19595,7 +19607,7 @@ void Player::SetFarsightTarget(WorldObject* obj) // Remove the current target if there is one RemoveFarsightTarget(); - SetUInt64Value(PLAYER_FARSIGHT, obj->GetGUID()); + SetFarSight(obj->GetGUID()); } bool Player::isAllowUseBattleGroundObject() @@ -19684,6 +19696,7 @@ void Player::EnterVehicle(Vehicle *vehicle) vehicle->setFaction(getFaction()); SetCharm(vehicle); // charm + SetMover(vehicle); SetFarSight(vehicle->GetGUID()); // set view SetClientControl(vehicle, 1); // redirect controls to vehicle @@ -19735,6 +19748,7 @@ void Player::ExitVehicle(Vehicle *vehicle) vehicle->setFaction((GetTeam() == ALLIANCE) ? vehicle->GetCreatureInfo()->faction_A : vehicle->GetCreatureInfo()->faction_H); SetCharm(NULL); + SetMover(NULL); SetFarSight(NULL); SetClientControl(vehicle, 0); diff --git a/src/game/Player.h b/src/game/Player.h index 19bf2e22906..6643b3c2615 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -143,8 +143,6 @@ enum ActionButtonType typedef std::map<uint8,ActionButton> ActionButtonList; -typedef std::pair<uint16, uint8> CreateSpellPair; - struct PlayerCreateInfoItem { PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) {} @@ -176,6 +174,8 @@ struct PlayerLevelInfo uint8 stats[MAX_STATS]; }; +typedef std::list<uint32> PlayerCreateInfoSpells; + struct PlayerInfo { // existence checked by displayId != 0 // existence checked by displayId != 0 @@ -191,7 +191,7 @@ struct PlayerInfo uint16 displayId_m; uint16 displayId_f; PlayerCreateInfoItems item; - std::list<CreateSpellPair> spell; + PlayerCreateInfoSpells spell; std::list<uint16> action[4]; PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1 @@ -961,23 +961,6 @@ class TRINITY_DLL_SPEC Player : public Unit void AddToWorld(); void RemoveFromWorld(); - void SetViewport(uint64 guid, bool movable); - void RemovePossess(bool attack = true); - void StopCharmOrPossess() - { - if(isPossessing()) - RemovePossess(true); - else if(GetCharm()) - Uncharm(); - } - WorldObject* GetFarsightTarget() const; - void ClearFarsight(); - void RemoveFarsightTarget(); - void SetFarsightTarget(WorldObject* target); - // Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode - void SetFarsightVision(bool apply) { m_farsightVision = apply; } - bool HasFarsightVision() const { return m_farsightVision; } - bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0); bool TeleportTo(WorldLocation const &loc, uint32 options = 0) @@ -1484,11 +1467,11 @@ class TRINITY_DLL_SPEC Player : public Unit void SendProficiency(uint8 pr1, uint32 pr2); void SendInitialSpells(); - bool addSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, bool disabled = false); + bool addSpell(uint32 spell_id, bool active, bool learning, bool disabled); void learnSpell(uint32 spell_id); void removeSpell(uint32 spell_id, bool disabled = false); void resetSpells(); - void learnDefaultSpells(bool loading = false); + void learnDefaultSpells(); void learnQuestRewardedSpells(); void learnQuestRewardedSpells(Quest const* quest); @@ -2061,8 +2044,27 @@ class TRINITY_DLL_SPEC Player : public Unit void EnterVehicle(Vehicle *vehicle); void ExitVehicle(Vehicle *vehicle); + //void SetViewport(uint64 guid, bool movable); + void SetMover(Unit* target) { m_mover = target ? target : this; } + void RemovePossess(bool attack = true); + void StopCharmOrPossess() + { + if(isPossessing()) + RemovePossess(true); + else if(GetCharm()) + Uncharm(); + } + uint64 GetFarSight() const { return GetUInt64Value(PLAYER_FARSIGHT); } void SetFarSight(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); } + void SetBindSight(Unit *target); + WorldObject* GetFarsightTarget() const; + void ClearFarsight(); + void RemoveFarsightTarget(); + void SetFarsightTarget(WorldObject* target); + // Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode + void SetFarsightVision(bool apply) { m_farsightVision = apply; } + bool HasFarsightVision() const { return m_farsightVision; } // Transports Transport * GetTransport() const { return m_transport; } diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index c19777653e6..0cf98fe33f9 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1651,9 +1651,10 @@ enum CreatureFamily enum CreatureTypeFlags { - CREATURE_TYPEFLAGS_TAMEABLE = 0x0001, - CREATURE_TYPEFLAGS_HERBLOOT = 0x0100, - CREATURE_TYPEFLAGS_MININGLOOT = 0x0200 + CREATURE_TYPEFLAGS_TAMEABLE = 0x0001, + CREATURE_TYPEFLAGS_HERBLOOT = 0x0100, + CREATURE_TYPEFLAGS_MININGLOOT = 0x0200, + CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x8000 }; enum CreatureEliteType diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ddf67982a2f..4b42c07f01c 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -681,6 +681,7 @@ void AreaAura::Update(uint32 diff) aur = new AreaAura(actualSpellInfo, m_effIndex, &m_modifier.m_amount, (*tIter), caster, NULL); else aur = new AreaAura(actualSpellInfo, m_effIndex, NULL, (*tIter), caster, NULL); + aur->SetAuraDuration(GetAuraDuration()); (*tIter)->AddAura(aur); } } @@ -2915,10 +2916,7 @@ void Aura::HandleBindSight(bool apply, bool Real) if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - if (apply) - m_target->AddPlayerToVision((Player*)caster); - else - m_target->RemovePlayerFromVision((Player*)caster); + ((Player*)caster)->SetBindSight(apply ? m_target : NULL); } void Aura::HandleFarSight(bool apply, bool Real) @@ -5160,6 +5158,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) break; case FORM_FLIGHT: spellId = 33948; + spellId2 = 34764; break; case FORM_FLIGHT_EPIC: spellId = 40122; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 605bf3b73d0..0b59a82e966 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -407,6 +407,14 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) // Heroic Throw ${$m1+$AP*.50} else if(m_spellInfo->SpellFamilyFlags & 0x0000000100000000LL) damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f); + // Shockwave ${$m3/100*$AP} + else if(m_spellInfo->SpellFamilyFlags & 0x0000800000000000LL) + { + int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget); + if (pct > 0) + damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100); + break; + } break; } case SPELLFAMILY_WARLOCK: diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index e3f8808cc4e..6585de79355 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1709,7 +1709,8 @@ void SpellMgr::LoadSpellLearnSpells() { mSpellLearnSpells.clear(); // need for reload case - QueryResult *result = WorldDatabase.Query("SELECT entry, SpellID FROM spell_learn_spell"); + // 0 1 2 + QueryResult *result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if(!result) { barGoLink bar( 1 ); @@ -1733,6 +1734,7 @@ void SpellMgr::LoadSpellLearnSpells() SpellLearnSpellNode node; node.spell = fields[1].GetUInt32(); + node.active = fields[2].GetBool(); node.autoLearned= false; if(!sSpellStore.LookupEntry(spell_id)) @@ -1769,6 +1771,7 @@ void SpellMgr::LoadSpellLearnSpells() { SpellLearnSpellNode dbc_node; dbc_node.spell = entry->EffectTriggerSpell[i]; + dbc_node.active = true; // all dbc based learned spells is active (show in spell book or hide by client itself) // ignore learning not existed spells (broken/outdated/or generic learnig spell 483 if(!sSpellStore.LookupEntry(dbc_node.spell)) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index a8b7f08e476..7cf41480f9a 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -715,6 +715,7 @@ typedef std::map<uint32, SpellLearnSkillNode> SpellLearnSkillMap; struct SpellLearnSpellNode { uint32 spell; + bool active; // show in spellbook or not bool autoLearned; }; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5a69f29a927..1bba08fcad6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7183,6 +7183,7 @@ Unit* Unit::GetCharm() const sLog.outError("Unit::GetCharm: Charmed creature %u not exist.",GUID_LOPART(charm_guid)); const_cast<Unit*>(this)->SetCharm(0); + const_cast<Unit*>(this)->SetMover(0); } return NULL; @@ -7201,10 +7202,7 @@ void Unit::SetPet(Pet* pet) void Unit::SetCharm(Unit* pet) { if(GetTypeId() == TYPEID_PLAYER) - { SetUInt64Value(UNIT_FIELD_CHARM, pet ? pet->GetGUID() : 0); - ((Player*)this)->m_mover = pet ? pet : this; - } } void Unit::AddPlayerToVision(Player* plr) @@ -11636,7 +11634,7 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess) { if(((Player*)this)->isAFK()) ((Player*)this)->ToggleAFK(); - ((Player*)this)->SetViewport(GetGUID(), false); + ((Player*)this)->SetClientControl(this, 0); } // Pets already have a properly initialized CharmInfo, don't overwrite it. @@ -11656,7 +11654,8 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess) addUnitState(UNIT_STAT_POSSESSED); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5); AddPlayerToVision((Player*)charmer); - ((Player*)charmer)->SetViewport(GetGUID(), true); + ((Player*)charmer)->SetClientControl(this, 1); + ((Player*)charmer)->SetMover(this); charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } // Charm demon @@ -11726,7 +11725,7 @@ void Unit::RemoveCharmedOrPossessedBy(Unit *charmer) } } else - ((Player*)this)->SetViewport(GetGUID(), true); + ((Player*)this)->SetClientControl(this, 1); // If charmer still exists if(!charmer) @@ -11738,7 +11737,8 @@ void Unit::RemoveCharmedOrPossessedBy(Unit *charmer) if(possess) { RemovePlayerFromVision((Player*)charmer); - ((Player*)charmer)->SetViewport(charmer->GetGUID(), true); + ((Player*)charmer)->SetClientControl(charmer, 1); + ((Player*)charmer)->SetMover(charmer); charmer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } // restore UNIT_FIELD_BYTES_0 diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index d1f4a877dbb..8a50ff2d84e 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -341,7 +341,7 @@ class TRINITY_DLL_SPEC WorldSession void HandleMoveWorldportAckOpcode(); // for server-side calls void HandleMovementOpcodes(WorldPacket& recvPacket); - void HandlePossessedMovement(WorldPacket& recv_data, MovementInfo& movementInfo, uint32& MovementFlags); + //void HandlePossessedMovement(WorldPacket& recv_data, MovementInfo& movementInfo, uint32& MovementFlags); void HandleSetActiveMoverOpcode(WorldPacket &recv_data); void HandleMoveNotActiveMover(WorldPacket &recv_data); void HandleDismissControlledVehicle(WorldPacket &recv_data); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3b84da0a421..db52acd82a6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7063" + #define REVISION_NR "7072" #endif // __REVISION_NR_H__ |