This commit is contained in:
Subv2112
2012-01-22 08:04:39 -05:00
62 changed files with 859 additions and 393 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
// spawn in run mode
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
mRun = true;
mRun = false;
me->GetPosition(&mLastOOCPos);
@@ -282,6 +282,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_HOSTILE_RANDOM:
case SMART_TARGET_HOSTILE_RANDOM_NOT_TOP:
case SMART_TARGET_ACTION_INVOKER:
case SMART_TARGET_INVOKER_PARTY:
case SMART_TARGET_POSITION:
case SMART_TARGET_NONE:
case SMART_TARGET_ACTION_INVOKER_VEHICLE:
@@ -202,6 +202,9 @@ void BattlegroundAB::StartingEventOpenDoors()
}
DoorOpen(BG_AB_OBJECT_GATE_A);
DoorOpen(BG_AB_OBJECT_GATE_H);
// Achievement: Let's Get This Done
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, AB_EVENT_START_BATTLE);
}
void BattlegroundAB::AddPlayer(Player* player)
@@ -181,6 +181,8 @@ enum BG_AB_Objectives
#define BG_AB_NotABBGWeekendReputationTicks 200
#define BG_AB_ABBGWeekendReputationTicks 150
#define AB_EVENT_START_BATTLE 9158 // Achievement: Let's Get This Done
// x, y, z, o
const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
{1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables
@@ -420,6 +420,9 @@ void BattlegroundAV::StartingEventOpenDoors()
DoorOpen(BG_AV_OBJECT_DOOR_H);
DoorOpen(BG_AV_OBJECT_DOOR_A);
// Achievement: The Alterac Blitz
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, AV_EVENT_START_BATTLE);
}
void BattlegroundAV::AddPlayer(Player* player)
@@ -50,6 +50,8 @@ class Battleground;
#define BG_AV_KILL_SURVIVING_CAPTAIN 2
#define BG_AV_REP_SURVIVING_CAPTAIN 125
#define AV_EVENT_START_BATTLE 9166 // Achievement: The Alterac Blitz
enum BG_AV_Sounds
{ //TODO: get out if there comes a sound when neutral team captures mine
@@ -120,6 +120,9 @@ void BattlegroundEY::StartingEventOpenDoors()
uint8 buff = urand(0, 2);
SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + buff + i * 3, RESPAWN_IMMEDIATELY);
}
// Achievement: Flurry
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EY_EVENT_START_BATTLE);
}
void BattlegroundEY::AddPoints(uint32 Team, uint32 Points)
@@ -220,6 +220,8 @@ enum EYBattlegroundObjectTypes
#define BG_EY_NotEYWeekendHonorTicks 330
#define BG_EY_EYWeekendHonorTicks 200
#define EY_EVENT_START_BATTLE 13180 // Achievement: Flurry
enum BG_EY_Score
{
BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400,
+1 -1
View File
@@ -63,7 +63,7 @@ bool Condition::Meets(Player* player, Unit* invoker)
case CONDITION_REPUTATION_RANK:
{
if (FactionEntry const* faction = sFactionStore.LookupEntry(mConditionValue1))
condMeets = uint32(player->GetReputationMgr().GetRank(faction)) == mConditionValue2;
condMeets = (mConditionValue2 & (1 << player->GetReputationMgr().GetRank(faction)));
break;
}
case CONDITION_ACHIEVEMENT:
+1 -1
View File
@@ -483,7 +483,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player)
void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment)
{
if (!player || !player->GetSession() || selectedDungeons.empty())
return;
return;
Group* grp = player->GetGroup();
uint64 guid = player->GetGUID();
+21 -4
View File
@@ -296,15 +296,24 @@ Item* TradeData::GetItem(TradeSlots slot) const
return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : NULL;
}
bool TradeData::HasItem(uint64 item_guid) const
bool TradeData::HasItem(uint64 itemGuid) const
{
for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i)
if (m_items[i] == item_guid)
if (m_items[i] == itemGuid)
return true;
return false;
}
TradeSlots const TradeData::GetTradeSlotForItem(uint64 itemGuid)
{
for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i)
if (m_items[i] == itemGuid)
return TradeSlots(i);
return TRADE_SLOT_INVALID;
}
Item* TradeData::GetSpellCastItem() const
{
return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL;
@@ -12805,6 +12814,14 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
return;
}
//! If trading
if (TradeData* tradeData = GetTradeData())
{
//! If current item is in trade window (only possible with packet spoofing - silent return)
if (tradeData->GetTradeSlotForItem(pSrcItem->GetGUID()) != TRADE_SLOT_INVALID)
return;
}
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count);
Item* pNewItem = pSrcItem->CloneItem(count, this);
if (!pNewItem)
@@ -12833,7 +12850,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
pSrcItem->SetState(ITEM_CHANGED, this);
StoreItem(dest, pNewItem, true);
}
else if (IsBankPos (dst))
else if (IsBankPos(dst))
{
// change item amount before check (for unique max count check)
pSrcItem->SetCount(pSrcItem->GetCount() - count);
@@ -12853,7 +12870,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
pSrcItem->SetState(ITEM_CHANGED, this);
BankItem(dest, pNewItem, true);
}
else if (IsEquipmentPos (dst))
else if (IsEquipmentPos(dst))
{
// change item amount before check (for unique max count check), provide space for splitted items
pSrcItem->SetCount(pSrcItem->GetCount() - count);
+4 -2
View File
@@ -686,7 +686,8 @@ enum TradeSlots
{
TRADE_SLOT_COUNT = 7,
TRADE_SLOT_TRADED_COUNT = 6,
TRADE_SLOT_NONTRADED = 6
TRADE_SLOT_NONTRADED = 6,
TRADE_SLOT_INVALID = -1,
};
enum TransferAbortReason
@@ -1001,7 +1002,8 @@ class TradeData
TradeData* GetTraderData() const;
Item* GetItem(TradeSlots slot) const;
bool HasItem(uint64 item_guid) const;
bool HasItem(uint64 itemGuid) const;
TradeSlots const GetTradeSlotForItem(uint64 itemGuid);
void SetItem(TradeSlots slot, Item* item);
uint32 GetSpell() const { return m_spell; }
+6 -2
View File
@@ -2114,12 +2114,12 @@ void Unit::SendMeleeAttackStart(Unit* victim)
void Unit::SendMeleeAttackStop(Unit* victim)
{
WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); // we guess size
WorldPacket data(SMSG_ATTACKSTOP, (8+8+4));
data.append(GetPackGUID());
data.append(victim ? victim->GetPackGUID() : 0); // can be 0x00...
data << uint32(0); // can be 0x1
SendMessageToSet(&data, true);
sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART");
sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTOP");
if (victim)
sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
@@ -7068,6 +7068,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
basepoints0 = CalculatePctN(int32(damage), triggerAmount);
triggered_spell_id = 58879;
// Cast on spirit wolf
CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, NULL, triggeredByAura);
break;
}
// Shaman T8 Elemental 4P Bonus
@@ -15847,6 +15849,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
case CHARM_TYPE_VEHICLE:
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
charmer->ToPlayer()->SetClientControl(this, 1);
charmer->ToPlayer()->SetMover(this);
charmer->ToPlayer()->SetViewpoint(this, true);
charmer->ToPlayer()->VehicleSpellInitialize();
break;
@@ -15855,6 +15858,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
charmer->ToPlayer()->SetClientControl(this, 1);
charmer->ToPlayer()->SetMover(this);
charmer->ToPlayer()->SetViewpoint(this, true);
charmer->ToPlayer()->PossessSpellInitialize();
break;
@@ -359,7 +359,6 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
{
if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
ASSERT(false);
unit->ToPlayer()->SetMover(this->GetBase());
}
if (_me->IsInWorld())
@@ -411,10 +410,7 @@ void Vehicle::RemovePassenger(Unit* unit)
unit->ClearUnitState(UNIT_STAT_ONVEHICLE);
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
{
_me->RemoveCharmedBy(unit);
unit->ToPlayer()->SetMover(unit->ToPlayer());
}
if (_me->IsInWorld())
{
+3 -1
View File
@@ -203,7 +203,9 @@ void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup,
// skip non-existed member
if (!sObjectMgr->GetPlayerNameByGUID(member.guid, member.name))
{
CharacterDatabase.PQuery("DELETE FROM group_member WHERE memberGuid=%u", guidLow);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
stmt->setUInt32(0, guidLow);
CharacterDatabase.Execute(stmt);
return;
}
+6 -3
View File
@@ -307,7 +307,7 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed)
init.SetVelocity(speed);
init.SetAnimation(Movement::ToGround);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
}
void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed)
@@ -322,7 +322,7 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed)
init.SetVelocity(speed);
init.SetAnimation(Movement::ToFly);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
}
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
@@ -365,7 +365,10 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
init.SetParabolic(max_height,0);
init.SetVelocity(speedXY);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
if (i_owner->GetTypeId() == TYPEID_PLAYER)
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
else
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
}
void MotionMaster::MoveFall(uint32 id/*=0*/)
@@ -211,6 +211,19 @@ void ChaseMovementGenerator<T>::Reset(T &owner)
Initialize(owner);
}
template<class T>
void ChaseMovementGenerator<T>::MovementInform(T & /*unit*/)
{
}
template<>
void ChaseMovementGenerator<Creature>::MovementInform(Creature &unit)
{
// Pass back the GUIDLow of the target. If it is pet's owner then PetAI will handle
if (unit.AI())
unit.AI()->MovementInform(CHASE_MOTION_TYPE, i_target.getTarget()->GetGUIDLow());
}
//-----------------------------------------------//
template<>
bool FollowMovementGenerator<Creature>::EnableWalking() const
@@ -300,6 +313,7 @@ template void ChaseMovementGenerator<Player>::Finalize(Player &);
template void ChaseMovementGenerator<Creature>::Finalize(Creature &);
template void ChaseMovementGenerator<Player>::Reset(Player &);
template void ChaseMovementGenerator<Creature>::Reset(Creature &);
template void ChaseMovementGenerator<Player>::MovementInform(Player &unit);
template void FollowMovementGenerator<Player>::Finalize(Player &);
template void FollowMovementGenerator<Creature>::Finalize(Creature &);
@@ -76,7 +76,7 @@ class ChaseMovementGenerator : public TargetedMovementGeneratorMedium<T, ChaseMo
void Initialize(T &);
void Finalize(T &);
void Reset(T &);
void MovementInform(T &){}
void MovementInform(T &);
static void _clearUnitStateMove(T &u) { u.ClearUnitState(UNIT_STAT_CHASE_MOVE); }
static void _addUnitStateMove(T &u) { u.AddUnitState(UNIT_STAT_CHASE_MOVE); }
@@ -84,6 +84,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
// Inform script
MovementInform(creature);
creature.UpdateWaypointID(i_currentNode);
Stop(i_path->at(i_currentNode)->delay);
}
@@ -94,13 +95,11 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
if (Stopped())
return true;
const WaypointData *node = i_path->at(i_currentNode);
if (m_isArrivalDone)
{
if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint
{
creature.SetHomePosition(node->x, node->y, node->z, creature.GetOrientation());
creature.SetHomePosition(i_path->at(i_currentNode)->x, i_path->at(i_currentNode)->y, i_path->at(i_currentNode)->z, creature.GetOrientation());
creature.GetMotionMaster()->Initialize();
return false;
}
@@ -108,6 +107,8 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
i_currentNode = (i_currentNode+1) % i_path->size();
}
const WaypointData *node = i_path->at(i_currentNode);
m_isArrivalDone = false;
creature.AddUnitState(UNIT_STAT_ROAMING_MOVE);
@@ -101,14 +101,14 @@ void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auction
//this void causes on client to display: "Your auction sold"
void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
{
WorldPacket data(SMSG_AUCTION_OWNER_NOTIFICATION, (7*4));
data << auction->Id;
data << auction->bid;
data << (uint32) 0; //unk
data << (uint32) 0; //unk
data << (uint32) 0; //unk
data << auction->item_template;
data << (uint32) 0; //unk
WorldPacket data(SMSG_AUCTION_OWNER_NOTIFICATION, (8*4));
data << uint32(auction->Id);
data << uint32(auction->bid);
data << uint32(0); //unk
data << uint64(0); //unk (bidder guid?)
data << uint32(auction->item_template);
data << uint32(0); //unk
data << float(0); //unk (time?)
SendPacket(&data);
}
@@ -3096,17 +3096,9 @@ void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, boo
}
if (apply)
{
if (target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp))
caster->ToPlayer()->SetMover(target);
}
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
else
{
target->RemoveCharmedBy(caster);
caster->ToPlayer()->SetMover(caster);
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->SetMover(target);
}
}
// only one spell has this aura
@@ -3134,13 +3126,11 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
if (caster->ToPlayer()->GetPet() != pet)
return;
if (pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp))
caster->ToPlayer()->SetMover(pet);
pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
}
else
{
pet->RemoveCharmedBy(caster);
caster->ToPlayer()->SetMover(caster);
if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
+12 -2
View File
@@ -1963,6 +1963,13 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
if (!sSpellMgr->CanSpellTriggerProcOnEvent(*procEntry, eventInfo))
return false;
// TODO:
// - do checks using conditions table for eventInfo->GetActor() and eventInfo->GetActionTarget()
// - add DoCheckProc() AuraScript hook
// to allow additional requirements for procs
// this is needed because this is the last moment in which you can prevent aura charge drop on proc
// and possibly a way to prevent default checks (if there're going to be any)
// Check if current equipment meets aura requirements
// do that only for passive spells
// TODO: this needs to be unified for all kinds of auras
@@ -2023,11 +2030,14 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event
void Aura::TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo)
{
// TODO: script hooks here (allowing prevention of selected effects)
// TODO: OnProc hook here
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (aurApp->HasEffect(i))
// TODO: OnEffectProc hook here (allowing prevention of selected effects)
GetEffect(i)->HandleProc(aurApp, eventInfo);
// TODO: script hooks here
// TODO: AfterEffectProc hook here
// TODO: AfterProc hook here
// Remove aura if we've used last charge to proc
if (IsUsingCharges() && !GetCharges())
@@ -186,6 +186,9 @@ class Aura
bool CanStackWith(Aura const* existingAura) const;
// Proc system
// this subsystem is not yet in use - the core of it is functional, but still some research has to be done
// and some dependant problems fixed before it can replace old proc system (for example cooldown handling)
// currently proc system functionality is implemented in Unit::ProcDamageAndSpell
bool IsProcOnCooldown() const;
void AddProcCooldown(uint32 msec);
bool IsUsingCharges() const { return m_isUsingCharges; }