diff options
56 files changed, 455 insertions, 117 deletions
diff --git a/sql/updates/world/2013_12_14_00_world_sai.sql b/sql/updates/world/2013_12_14_00_world_sai.sql new file mode 100644 index 00000000000..6c5e03d1709 --- /dev/null +++ b/sql/updates/world/2013_12_14_00_world_sai.sql @@ -0,0 +1,8 @@ +-- Bladespire Mystic SAI +SET @ENTRY := 20766; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,0,0,0,600000,600000,11,12550,0,0,0,0,0,1,0,0,0,0,0,0,0,"Bladespire Mystic - OOC - Cast Lightning Shield"), +(@ENTRY,0,1,0,16,0,100,0,37599,30,600000,600000,11,37599,0,0,0,0,0,9,0,0,0,0,0,0,0,"Bladespire Mystic - OOC - Friendly in range Cast Bloodlust"), +(@ENTRY,0,2,0,74,0,100,0,0,70,7500,14000,11,11986,0,0,0,0,0,9,0,0,0,0,0,0,0,"Bladespire Mystic - Friendly HP below 70% - Cast Healing Wave"); diff --git a/sql/updates/world/2013_12_14_01_world_misc.sql b/sql/updates/world/2013_12_14_01_world_misc.sql new file mode 100644 index 00000000000..284a2b46946 --- /dev/null +++ b/sql/updates/world/2013_12_14_01_world_misc.sql @@ -0,0 +1,34 @@ +UPDATE `creature_template` SET `ScriptName`="npc_king_jokkum_vehicle" WHERE `entry`=30331; + +-- Pathing for King Jokkum Entry: 30331 +-- by malcrom +SET @PATH := 2072200; +DELETE FROM `waypoint_data` WHERE `id` IN (@PATH, @PATH+1); +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +-- Path to event +(@PATH,1,7357.088,-2865.398,803.5008,0,0,1,0,100,0), +(@PATH,2,7357.088,-2865.398,803.5008,0,0,1,0,100,0), +(@PATH,3,7355.184,-2904.322,821.0084,0,0,1,0,100,0), +(@PATH,4,7355.473,-2946.654,833.0916,0,0,1,0,100,0), +(@PATH,5,7360.866,-2994.785,845.9886,0,0,1,0,100,0), +(@PATH,6,7378.764,-3035.887,840.6003,0,0,1,0,100,0), +(@PATH,7,7411.658,-3072.211,837.5768,0,0,1,0,100,0), +(@PATH,8,7453.996,-3088.695,837.5768,0,0,1,0,100,0), +(@PATH,9,7496.08,-3113.922,837.5829,0,0,1,0,100,0), +(@PATH,10,7536.843,-3136.489,837.5808,0,0,1,0,100,0), +(@PATH,11,7564.738,-3145.144,844.8308,0,0,1,0,100,0), +(@PATH,12,7604.358,-3171.258,850.8867,0,0,1,0,100,0), +(@PATH,13,7635.467,-3207.211,857.19,0,0,1,0,100,0), +(@PATH,14,7657.858,-3219.258,863.19,0,0,1,0,100,0), +(@PATH,15,7706.542,-3219.742,864.3326,0,0,1,0,100,0), +(@PATH,16,7747.335,-3226.993,862.4576,0,0,1,0,100,0), +(@PATH,17,7796.658,-3221.782,860.6461,0,0,1,0,100,0), +(@PATH,18,7827.596,-3229.273,856.4147,0,0,1,0,100,0), +(@PATH,19,7846.174,-3253.239,852.1281,0,0,1,0,100,0), +(@PATH,20,7846.174,-3253.239,852.1281,0.418879,0,1,0,100,0), +-- Path after event and despawn +(@PATH+1,1,7837.094,-3235.536,853.8781,0,0,1,0,100,0), +(@PATH+1,2,7828.622,-3230.38,855.9147,0,0,1,0,100,0), +(@PATH+1,3,7793.782,-3219.743,861.1461,0,0,1,0,100,0), +(@PATH+1,4,7765.224,-3225.374,864.0826,0,0,1,0,100,0), +(@PATH+1,5,7736.733,-3226.5,861.4576,0,0,1,0,100,0); diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 9abdf9e8cfc..1b6cdee737c 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -28,6 +28,7 @@ void UnitAI::AttackStart(Unit* victim) { + if (victim && me->Attack(victim, true)) me->GetMotionMaster()->MoveChase(victim); } @@ -44,14 +45,18 @@ void UnitAI::DoMeleeAttackIfReady() return; Unit* victim = me->GetVictim(); + + if (!me->IsWithinMeleeRange(victim)) + return; + //Make sure our attack is ready and we aren't currently casting before checking distance - if (me->isAttackReady() && me->IsWithinMeleeRange(victim)) + if (me->isAttackReady()) { me->AttackerStateUpdate(victim); me->resetAttackTimer(); } - if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK) && me->IsWithinMeleeRange(victim)) + if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) { me->AttackerStateUpdate(victim, OFF_ATTACK); me->resetAttackTimer(OFF_ATTACK); diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index c367ba0a5ed..1c78b97866f 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -67,7 +67,10 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mFollowCredit = 0; mFollowArrivedEntry = 0; mFollowCreditType = 0; + mFollowArrivedTimer = 0; mInvincibilityHpLevel = 0; + + mJustReset = false; } void SmartAI::UpdateDespawn(const uint32 diff) @@ -88,13 +91,6 @@ void SmartAI::UpdateDespawn(const uint32 diff) } else mDespawnTime -= diff; } -void SmartAI::Reset() -{ - if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat - SetRun(mRun); - GetScript()->OnReset(); -} - WayPoint* SmartAI::GetNextWayPoint() { if (!mWayPoints || mWayPoints->empty()) @@ -476,7 +472,8 @@ void SmartAI::EnterEvadeMode() else me->GetMotionMaster()->MoveTargetedHome(); - Reset(); + if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat + SetRun(mRun); } void SmartAI::MoveInLineOfSight(Unit* who) @@ -567,7 +564,8 @@ void SmartAI::JustRespawned() if (me->getFaction() != me->GetCreatureTemplate()->faction_A) me->RestoreFaction(); GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); - Reset(); + mJustReset = true; + JustReachedHome(); mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade mFollowDist = 0; mFollowAngle = 0; @@ -586,10 +584,17 @@ int SmartAI::Permissible(const Creature* creature) void SmartAI::JustReachedHome() { - GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME); + GetScript()->OnReset(); - if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath()) - me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true); + if (!mJustReset) + { + GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME); + + if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath()) + me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true); + } + + mJustReset = false; } void SmartAI::EnterCombat(Unit* enemy) @@ -597,6 +602,9 @@ void SmartAI::EnterCombat(Unit* enemy) me->InterruptNonMeleeSpells(false); // must be before ProcessEvents GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy); me->GetPosition(&mLastOOCPos); + SetRun(mRun); + if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); } void SmartAI::JustDied(Unit* killer) @@ -618,16 +626,10 @@ void SmartAI::JustSummoned(Creature* creature) void SmartAI::AttackStart(Unit* who) { - if (who && me->Attack(who, true)) + if (who && me->Attack(who, me->IsWithinMeleeRange(who))) { - SetRun(mRun); - if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); - if (mCanCombatMove) me->GetMotionMaster()->MoveChase(who); - - me->GetPosition(&mLastOOCPos); } } @@ -692,7 +694,8 @@ void SmartAI::InitializeAI() { GetScript()->OnInitialize(me); if (!me->isDead()) - Reset(); + mJustReset = true; + JustReachedHome(); GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 92637b17f25..085859a6d85 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -71,10 +71,7 @@ class SmartAI : public CreatureAI // Called when creature is spawned or respawned void JustRespawned(); - // Called after InitializeAI(), EnterEvadeMode() for resetting variables - void Reset(); - - // Called at reaching home after evade + // Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables void JustReachedHome(); // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) @@ -232,6 +229,7 @@ class SmartAI : public CreatureAI uint32 mDespawnState; void UpdateDespawn(const uint32 diff); uint32 mEscortInvokerCheckTimer; + bool mJustReset; }; class SmartGameObjectAI : public GameObjectAI diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index a1042a25c01..138c610ac46 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -369,7 +369,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsPlayer(*itr)) if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest)) { - (*itr)->ToPlayer()->AddQuest(q, NULL); + (*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, NULL); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u", (*itr)->GetGUIDLow(), e.action.quest.quest); } @@ -973,12 +973,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_UPDATE_TEMPLATE: { - if (!me || me->GetEntry() == e.action.updateTemplate.creature) + ObjectList* targets = GetTargets(e, unit); + + if (!targets) break; - me->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_UPDATE_TEMPLATE: Creature %u, Template: %u, Team: %u", - me->GetGUIDLow(), me->GetEntry(), e.action.updateTemplate.team ? HORDE : ALLIANCE); + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + if (IsCreature(*itr)) + (*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE); + + delete targets; break; } case SMART_ACTION_DIE: @@ -1042,8 +1046,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_INGAME_PHASE_MASK: { - if (GetBaseObject()) - GetBaseObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + if (WorldObject* baseObj = GetBaseObject()) + baseObj->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + break; } case SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 3835220b453..414e204ad5a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -805,7 +805,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_ACTION_UPDATE_TEMPLATE: - if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature)) + if (!IsCreatureValid(e, e.action.updateTemplate.creature)) return false; break; case SMART_ACTION_SET_SHEATH: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 2ad68474f8a..c470fdac906 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1037,6 +1037,10 @@ struct SmartTarget raw.param1 = p1; raw.param2 = p2; raw.param3 = p3; + x = 0.0f; + y = 0.0f; + z = 0.0f; + o = 0.0f; } SMARTAI_TARGETS type; float x, y, z, o; diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 1e21b640ddb..374447daa10 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -46,8 +46,10 @@ Battlefield::Battlefield() m_MapId = 0; m_MaxPlayer = 0; m_MinPlayer = 0; + m_MinLevel = 0; m_BattleTime = 0; m_NoWarBattleTime = 0; + m_RestartAfterCrash = 0; m_TimeForAcceptInvite = 20; m_uiKickDontAcceptTimer = 1000; diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index fbc27dc47aa..a5602a1b415 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -1064,4 +1064,5 @@ void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/) BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield) { m_Bf = battlefield; + m_GossipTextId = 0; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index f6bc701f166..6fc6584fa21 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1481,6 +1481,7 @@ struct WGWorkshop bf = _bf; workshopId = _workshopId; teamControl = BATTLEFIELD_WG_TEAM_NEUTRAL; + state = BATTLEFIELD_WG_OBJECTSTATE_NONE; } void GiveControlTo(uint8 team, bool init /* for first call in setup*/) diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 473303dc5ee..9bb074ed9df 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -150,6 +150,7 @@ Battleground::Battleground() m_ResetStatTimer = 0; m_ValidStartPositionTimer = 0; m_Events = 0; + m_StartDelayTime = 0; m_IsRated = false; m_BuffChange = false; m_IsRandom = false; @@ -167,6 +168,7 @@ Battleground::Battleground() m_MapId = 0; m_Map = NULL; m_StartMaxDist = 0.0f; + ScriptId = 0; m_TeamStartLocX[TEAM_ALLIANCE] = 0; m_TeamStartLocX[TEAM_HORDE] = 0; @@ -186,6 +188,9 @@ Battleground::Battleground() m_ArenaTeamRatingChanges[TEAM_ALLIANCE] = 0; m_ArenaTeamRatingChanges[TEAM_HORDE] = 0; + m_ArenaTeamMMR[TEAM_ALLIANCE] = 0; + m_ArenaTeamMMR[TEAM_HORDE] = 0; + m_BgRaids[TEAM_ALLIANCE] = NULL; m_BgRaids[TEAM_HORDE] = NULL; @@ -196,6 +201,7 @@ Battleground::Battleground() m_TeamScores[TEAM_HORDE] = 0; m_PrematureCountDown = false; + m_PrematureCountDownTimer = 0; m_HonorMode = BG_NORMAL; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index a26b9dbaa2f..e5d93dd9300 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -35,6 +35,27 @@ BattlegroundAB::BattlegroundAB() BgObjects.resize(BG_AB_OBJECT_MAX); BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers + for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + { + m_Nodes[i] = 0; + m_prevNodes[i] = 0; + m_NodeTimers[i] = 0; + m_BannerTimers[i].timer = 0; + m_BannerTimers[i].type = 0; + m_BannerTimers[i].teamIndex = 0; + } + + for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) + { + m_lastTick[i] = 0; + m_HonorScoreTics[i] = 0; + m_ReputationScoreTics[i] = 0; + m_TeamScores500Disadvantage[i] = false; + } + + m_HonorTics = 0; + m_ReputationTics = 0; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 7a54317032b..8edf5ea0bdb 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -33,6 +33,25 @@ BattlegroundAV::BattlegroundAV() BgObjects.resize(BG_AV_OBJECT_MAX); BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX); + for (uint8 i = 0; i < 2; i++) + { + for (uint8 j = 0; j < 9; j++) + m_Team_QuestStatus[i][j] = 0; + m_Team_Scores[i] = 0; + m_IsInformedNearVictory[i] = false; + m_CaptainAlive[i] = true; + m_CaptainBuffTimer[i] = 0; + m_Mine_Owner[i] = 0; + m_Mine_PrevOwner[i] = 0; + m_Mine_Reclaim_Timer[i] = 0; + } + + m_Mine_Timer = 0; + m_MaxLevel = 0; + + for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + InitNode(i, 0, false); + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 4eed8b05c25..567b3c248f7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -29,6 +29,12 @@ BattlegroundDS::BattlegroundDS() BgObjects.resize(BG_DS_OBJECT_MAX); BgCreatures.resize(BG_DS_NPC_MAX); + _waterfallTimer = 0; + _waterfallStatus = 0; + _waterfallKnockbackTimer = 0; + _pipeKnockBackTimer = 0; + _pipeKnockBackCount = 0; + StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index d73242388c8..d4035f95cda 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -43,6 +43,28 @@ BattlegroundEY::BattlegroundEY() m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF; m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; + m_HonorScoreTics[TEAM_ALLIANCE] = 0; + m_HonorScoreTics[TEAM_HORDE] = 0; + m_TeamPointsCount[TEAM_ALLIANCE] = 0; + m_TeamPointsCount[TEAM_HORDE] = 0; + m_FlagKeeper = 0; + m_DroppedFlagGUID = 0; + m_FlagCapturedBgObjectType = 0; + m_FlagState = BG_EY_FLAG_STATE_ON_BASE; + m_FlagsTimer = 0; + m_TowerCapCheckTimer = 0; + m_PointAddingTimer = 0; + m_HonorTics = 0; + + for (uint8 i = 0; i < EY_POINTS_MAX; ++i) + { + m_PointOwnedByTeam[i] = EY_POINT_NO_OWNER; + m_PointState[i] = EY_POINT_STATE_UNCONTROLLED; + m_PointBarStatus[i] = BG_EY_PROGRESS_BAR_STATE_MIDDLE; + } + + for (uint8 i = 0; i < 2 * EY_POINTS_MAX; ++i) + m_CurrentPointPlayersCount[i] = 0; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 5e5007d18a1..79b732026cc 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -28,6 +28,10 @@ BattlegroundRV::BattlegroundRV() { BgObjects.resize(BG_RV_OBJECT_MAX); + Timer = 0; + State = 0; + PillarCollision = false; + StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 767acb7f445..6fb75adf278 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -37,6 +37,22 @@ BattlegroundSA::BattlegroundSA() SignaledRoundTwo = false; SignaledRoundTwoHalfMin = false; InitSecondRound = false; + gateDestroyed = false; + Attackers = TEAM_ALLIANCE; + TotalTime = 0; + EndRoundTimer = 0; + ShipsStarted = false; + Status = BG_SA_NOTSTARTED; + + for (uint8 i = 0; i < 6; i++) + GateStatus[i] = BG_SA_GATE_OK; + + for (uint8 i = 0; i < 2; i++) + { + RoundScores[i].winner = TEAM_ALLIANCE; + RoundScores[i].time = 0; + _allVehiclesAlive[i] = true; + } //! This is here to prevent an uninitialised variable warning //! The warning only occurs when SetUpBattleGround fails though. diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index cda3bc4f036..41e26cf7e25 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -54,6 +54,21 @@ BattlegroundWS::BattlegroundWS() _flagSpellForceTimer = 0; _bothFlagsKept = false; _flagDebuffState = 0; + m_FlagKeepers[TEAM_ALLIANCE] = 0; + m_FlagKeepers[TEAM_HORDE] = 0; + m_DroppedFlagGUID[TEAM_ALLIANCE] = 0; + m_DroppedFlagGUID[TEAM_HORDE] = 0; + _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + _flagsTimer[TEAM_ALLIANCE] = 0; + _flagsTimer[TEAM_HORDE] = 0; + _flagsDropTimer[TEAM_ALLIANCE] = 0; + _flagsDropTimer[TEAM_HORDE] = 0; + _lastFlagCaptureTeam = 0; + m_ReputationCapture = 0; + m_HonorWinKills = 0; + m_HonorEndKills = 0; + _minutesElapsed = 0; } BattlegroundWS::~BattlegroundWS() { } diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index e1be2be0b09..36a0c49d990 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -34,7 +34,7 @@ CalendarEvent::~CalendarEvent() sCalendarMgr->FreeEventId(_eventId); } -CalendarMgr::CalendarMgr() { } +CalendarMgr::CalendarMgr() : _maxEventId(0), _maxInviteId(0) { } CalendarMgr::~CalendarMgr() { diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 4245f41031e..7ed0dec3a27 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -192,6 +192,7 @@ struct Condition SourceType = CONDITION_SOURCE_TYPE_NONE; SourceGroup = 0; SourceEntry = 0; + SourceId = 0; ElseGroup = 0; ConditionType = CONDITION_NONE; ConditionTarget = 0; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 08236fb70b5..b14d22e77b2 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -147,7 +147,7 @@ m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemov m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL) +m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 23ff89f383a..5a10ea238aa 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -244,7 +244,10 @@ typedef UNORDERED_MAP<uint32, EquipmentInfoContainerInternal> EquipmentInfoConta // from `creature` table struct CreatureData { - CreatureData() : dbData(true) { } + CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0), + posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0), + spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0), + spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), dbData(true) { } uint32 id; // entry in creature_template uint16 mapid; uint32 phaseMask; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index f25b9af9820..1af9b7fa73a 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -27,6 +27,7 @@ GossipMenu::GossipMenu() { _menuId = 0; + _locale = DEFAULT_LOCALE; } GossipMenu::~GossipMenu() diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index e1265f688cc..033b1892182 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -590,7 +590,9 @@ enum GOState // from `gameobject` struct GameObjectData { - explicit GameObjectData() : dbData(true) { } + explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), + rotation0(0.0f), rotation1(0.0f), rotation2(0.0f), rotation3(0.0f), spawntimesecs(0), + animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), dbData(true) { } uint32 id; // entry in gamobject_template uint16 mapid; uint32 phaseMask; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 5111f6825e9..af26522c305 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1264,7 +1264,7 @@ void MovementInfo::OutDebug() TC_LOG_INFO("misc", "splineElevation: %f", splineElevation); } -WorldObject::WorldObject(bool isWorldObject): WorldLocation(), +WorldObject::WorldObject(bool isWorldObject) : WorldLocation(), LastUsedScriptID(0), m_name(""), m_isActive(false), m_isWorldObject(isWorldObject), m_zoneScript(NULL), m_transport(NULL), m_currMap(NULL), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_notifyflags(0), m_executed_notifies(0) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 09a7b9ff7da..9f8fb0a1064 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -79,6 +79,7 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "MovementStructures.h" +#include "GameObjectAI.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) @@ -683,6 +684,7 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this) m_session = session; m_divider = 0; + m_ingametime = 0; m_ExtraFlags = 0; @@ -708,6 +710,7 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this) m_zoneUpdateTimer = 0; m_areaUpdateId = 0; + m_team = 0; m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); @@ -769,6 +772,8 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this) m_logintime = time(NULL); m_Last_tick = m_logintime; + m_Played_time[PLAYED_TIME_TOTAL] = 0; + m_Played_time[PLAYED_TIME_LEVEL] = 0; m_WeaponProficiency = 0; m_ArmorProficiency = 0; m_canParry = false; @@ -811,6 +816,7 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this) m_InstanceValid = true; m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL; m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; + m_raidMapDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; m_lastPotionId = 0; _talentMgr = new PlayerTalentInfo(); @@ -845,6 +851,18 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this) m_movedPlayer = this; m_seer = this; + m_recallMap = 0; + m_recallX = 0; + m_recallY = 0; + m_recallZ = 0; + m_recallO = 0; + + m_homebindMapId = 0; + m_homebindAreaId = 0; + m_homebindX = 0; + m_homebindY = 0; + m_homebindZ = 0; + m_contestedPvPTimer = 0; m_declinedname = NULL; @@ -864,7 +882,11 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this) m_ChampioningFaction = 0; - for (uint8 i = 0; i < MAX_POWERS_PER_CLASS; ++i) + m_timeSyncTimer = 0; + m_timeSyncClient = 0; + m_timeSyncServer = 0; + + for (uint8 i = 0; i < MAX_POWERS; ++i) m_powerFraction[i] = 0; isDebugAreaTriggers = false; @@ -14803,11 +14825,7 @@ void Player::SendPreparedQuest(uint64 guid) } if (quest->IsAutoAccept() && CanAddQuest(quest, true) && CanTakeQuest(quest, true)) - { - AddQuest(quest, object); - if (CanCompleteQuest(questId)) - CompleteQuest(questId); - } + AddQuestAndCheckCompletion(quest, object); if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, CanCompleteRepeatableQuest(quest), true); @@ -15095,6 +15113,53 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg) return true; } +void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver) +{ + AddQuest(quest, questGiver); + + if (CanCompleteQuest(quest->GetQuestId())) + CompleteQuest(quest->GetQuestId()); + + if (!questGiver) + return; + + switch (questGiver->GetTypeId()) + { + case TYPEID_UNIT: + sScriptMgr->OnQuestAccept(this, (questGiver->ToCreature()), quest); + questGiver->ToCreature()->AI()->sQuestAccept(this, quest); + break; + case TYPEID_ITEM: + case TYPEID_CONTAINER: + { + Item* item = (Item*)questGiver; + sScriptMgr->OnQuestAccept(this, item, quest); + + // destroy not required for quest finish quest starting item + bool destroyItem = true; + for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + { + if (quest->RequiredItemId[i] == item->GetEntry() && item->GetTemplate()->MaxCount > 0) + { + destroyItem = false; + break; + } + } + + if (destroyItem) + DestroyItem(item->GetBagSlot(), item->GetSlot(), true); + + break; + } + case TYPEID_GAMEOBJECT: + sScriptMgr->OnQuestAccept(this, questGiver->ToGameObject(), quest); + questGiver->ToGameObject()->AI()->QuestAccept(this, quest); + break; + default: + break; + } +} + bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg) { // prevent receive reward with quest items in bank or for not completed quest @@ -15403,7 +15468,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, if (quest->GetRewSpellCast() > 0) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpellCast()); - if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + if (questGiver->isType(TYPEMASK_UNIT) && (!spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) || !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM))) { if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID())) creature->CastSpell(this, quest->GetRewSpellCast(), true); @@ -15414,7 +15479,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, else if (quest->GetRewSpell() > 0) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpell()); - if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + if (questGiver->isType(TYPEMASK_UNIT) && (!spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) || !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM))) { if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID())) creature->CastSpell(this, quest->GetRewSpell(), true); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a96c6fd281d..dcb3a55e485 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1534,6 +1534,7 @@ class Player : public Unit, public GridObject<Player> bool CanCompleteRepeatableQuest(Quest const* quest); bool CanRewardQuest(Quest const* quest, bool msg); bool CanRewardQuest(Quest const* quest, uint32 reward, bool msg); + void AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver); void AddQuest(Quest const* quest, Object* questGiver); void CompleteQuest(uint32 quest_id); void IncompleteQuest(uint32 quest_id); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0911a5e99e3..9fd9e1f3606 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -165,7 +165,7 @@ Unit::Unit(bool isWorldObject) : IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0), m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0), - m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_ThreatManager(this), + m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this), _lastDamagedTime(0) { @@ -11841,8 +11841,8 @@ void Unit::DeleteCharmInfo() } CharmInfo::CharmInfo(Unit* unit) -: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false), - _isCommandAttack(false), _isAtStay(false), _isFollowing(false), _isReturning(false), +: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false), _oldReactState(REACT_PASSIVE), + _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false), _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f) { for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i) diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index e6303a5d5b6..c7819e15cdd 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -35,7 +35,7 @@ #include "Battleground.h" Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : -UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE) +UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE), _lastShootPos() { for (uint32 i = 0; i < MAX_VEHICLE_SEATS; ++i) { diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index bad27983235..d2999bbbe34 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.h @@ -55,7 +55,8 @@ typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventCon struct GameEventData { - GameEventData() : start(1), end(0), nextstart(0), occurence(0), length(0), holiday_id(HOLIDAY_NONE), state(GAMEEVENT_NORMAL) { } + GameEventData() : start(1), end(0), nextstart(0), occurence(0), length(0), holiday_id(HOLIDAY_NONE), state(GAMEEVENT_NORMAL), + announce(0) { } time_t start; // occurs after this time time_t end; // occurs before this time time_t nextstart; // after this time the follow-up events count this phase completed diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 7f2b219942f..a1ece86de09 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -239,6 +239,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) default: break; } + _player->PlayerTalkClass->SendCloseGossip(); if (quest->GetSrcSpell() > 0) @@ -278,11 +279,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData) return; if (quest->IsAutoAccept() && _player->CanAddQuest(quest, true)) - { - _player->AddQuest(quest, object); - if (_player->CanCompleteQuest(questId)) - _player->CompleteQuest(questId); - } + _player->AddQuestAndCheckCompletion(quest, object); if (quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, object->GetGUID(), _player->CanCompleteQuest(quest->GetQuestId()), true); @@ -361,9 +358,10 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) { if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) { - _player->AddQuest(nextQuest, object); - if (_player->CanCompleteQuest(nextQuest->GetQuestId())) - _player->CompleteQuest(nextQuest->GetQuestId()); + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) + _player->AddQuestAndCheckCompletion(nextQuest, object); + + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); } _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); @@ -382,9 +380,10 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) { if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) { - _player->AddQuest(nextQuest, object); - if (_player->CanCompleteQuest(nextQuest->GetQuestId())) - _player->CompleteQuest(nextQuest->GetQuestId()); + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) + _player->AddQuestAndCheckCompletion(nextQuest, object); + + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); } _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); @@ -507,7 +506,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) return; if (_player->CanAddQuest(quest, true)) - _player->AddQuest(quest, NULL); // NULL, this prevent DB script from duplicate running + _player->AddQuestAndCheckCompletion(quest, NULL); // NULL, this prevent DB script from duplicate running _player->SetDivider(0); } @@ -631,11 +630,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_SHARING_QUEST); if (quest->IsAutoAccept() && receiver->CanAddQuest(quest, true) && receiver->CanTakeQuest(quest, true)) - { - receiver->AddQuest(quest, sender); - if (receiver->CanCompleteQuest(questId)) - receiver->CompleteQuest(questId); - } + receiver->AddQuestAndCheckCompletion(quest, sender); if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) receiver->PlayerTalkClass->SendQuestGiverRequestItems(quest, sender->GetGUID(), receiver->CanCompleteRepeatableQuest(quest), true); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 8f658986123..6c703e404ab 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -364,6 +364,7 @@ LootItem::LootItem(LootStoreItem const& li) randomSuffix = GenerateEnchSuffixFactor(itemid); randomPropertyId = Item::GenerateItemRandomPropertyId(itemid); + count = 0; is_looted = 0; is_blocked = 0; is_underthreshold = 0; diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 895d09fe7ad..9f7a08c3c6c 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -148,7 +148,9 @@ struct LootItem explicit LootItem(LootStoreItem const& li); // Empty constructor for creating an empty LootItem to be filled in with DB data - LootItem() : canSave(true){ }; + LootItem() : itemid(0), randomSuffix(0), randomPropertyId(0), count(0), is_looted(false), is_blocked(false), + freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false), + canSave(true){ }; // Basic checks for player/item compatibility - if false no chance to see the item in the loot bool AllowedForPlayer(Player const* player) const; @@ -303,7 +305,7 @@ struct Loot // Only set for inventory items that can be right-click looted uint32 containerID; - Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { } + Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { } ~Loot() { clear(); } // For deleting items at loot removal since there is no backward interface to the Item() diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 85d80f3a420..3c0837676c2 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -1375,6 +1375,7 @@ GridMap::GridMap() // Height level data _gridHeight = INVALID_HEIGHT; _gridGetHeight = &GridMap::getHeightFromFlat; + _gridIntHeightMultiplier = 0; m_V9 = NULL; m_V8 = NULL; // Liquid data diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 05047e9bcf6..1837546d375 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -43,6 +43,9 @@ MapManager::MapManager() { i_gridCleanUpDelay = sWorld->getIntConfig(CONFIG_INTERVAL_GRIDCLEAN); i_timer.SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE)); + memset(i_GridStates, 0, sizeof(i_GridStates)); + i_GridStateErrorCount = 0; + _nextInstanceId = 0; } MapManager::~MapManager() { } diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 6b45d5cf09c..ef7c9f714df 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -130,6 +130,9 @@ void MotionMaster::DirectClean(bool reset) if (curr) DirectDelete(curr); } + if (empty()) + return; + if (needInitTop()) InitTop(); else if (reset) @@ -156,7 +159,7 @@ void MotionMaster::DirectExpire(bool reset) DirectDelete(curr); } - while (!top()) + while (!empty() && !top()) --_top; if (empty()) @@ -176,7 +179,7 @@ void MotionMaster::DelayedExpire() DelayedDelete(curr); } - while (!top()) + while (!empty() && !top()) --_top; } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 156813f56fb..f7ec1d8c169 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -87,13 +87,21 @@ class MotionMaster //: private std::stack<MovementGenerator *> void pop() { + if (empty()) + return; + Impl[_top] = NULL; - while (!top()) + while (!empty() && !top()) --_top; } void push(_Ty _Val) { ++_top; Impl[_top] = _Val; } - bool needInitTop() const { return _needInit[_top]; } + bool needInitTop() const + { + if (empty()) + return false; + return _needInit[_top]; + } void InitTop(); public: @@ -112,8 +120,16 @@ class MotionMaster //: private std::stack<MovementGenerator *> bool empty() const { return (_top < 0); } int size() const { return _top + 1; } - _Ty top() const { return Impl[_top]; } - _Ty GetMotionSlot(int slot) const { return Impl[slot]; } + _Ty top() const + { + ASSERT(!empty()); + return Impl[_top]; + } + _Ty GetMotionSlot(int slot) const + { + ASSERT(slot >= 0); + return Impl[slot]; + } void DirectDelete(_Ty curr); void DelayedDelete(_Ty curr); diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h index 1fa9465d6e8..ac5e2428652 100755 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h @@ -26,7 +26,7 @@ template<class T> class ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> > { public: - explicit ConfusedMovementGenerator() : i_nextMoveTime(0) { } + explicit ConfusedMovementGenerator() : i_nextMoveTime(0), i_x(0), i_y(0), i_z(0) { } void DoInitialize(T*); void DoFinalize(T*); diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h index ef2807a5f48..beb6f09194c 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h @@ -37,7 +37,6 @@ class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovemen private: TimeTrackerSmall i_nextMoveTime; - uint32 i_nextMove; float wander_distance; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index c22b0c5296f..357fbd0307c 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -117,6 +117,10 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig { i_path = &pathnodes; i_currentNode = startNode; + _endGridX = 0.0f; + _endGridY = 0.0f; + _endMapId = 0; + _preloadTargetNode = 0; } void DoInitialize(Player*); void DoReset(Player*); diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 8daafc44d3a..cf14cc2eb56 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -231,7 +231,7 @@ void OutdoorPvP::DeleteSpawns() m_capturePoints.clear(); } -OutdoorPvP::OutdoorPvP() : m_sendUpdate(true) { } +OutdoorPvP::OutdoorPvP() : m_TypeId(0), m_sendUpdate(true) { } OutdoorPvP::~OutdoorPvP() { diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 100658d7958..f61cec6f396 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -103,6 +103,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 m_muteTime(mute_time), m_timeOutTime(0), AntiDOS(this), + m_GUIDLow(0), _player(NULL), m_Socket(sock), _security(sec), @@ -126,6 +127,8 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 timeLastWhoCommand(0), _RBACData(NULL) { + memset(m_Tutorials, 0, sizeof(m_Tutorials)); + if (sock) { m_Address = sock->GetRemoteAddress(); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 1f2542de0be..a984ee7b035 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -353,6 +353,7 @@ m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false) m_duration = m_maxDuration; m_procCharges = CalcMaxCharges(caster); m_isUsingCharges = m_procCharges != 0; + memset(m_effects, 0, sizeof(m_effects)); // m_casterLevel = cast item level/caster level, caster level should be saved to db, confirmed with sniffs } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index aa4c672c0c4..08d500ec666 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -72,12 +72,14 @@ SpellDestination::SpellDestination(float x, float y, float z, float orientation, _position.Relocate(x, y, z, orientation); _transportGUID = 0; _position.m_mapId = mapId; + _transportOffset.Relocate(0, 0, 0, 0); } SpellDestination::SpellDestination(Position const& pos) { _position.Relocate(pos); _transportGUID = 0; + _transportOffset.Relocate(0, 0, 0, 0); } SpellDestination::SpellDestination(WorldObject const& wObj) @@ -504,6 +506,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme m_applyMultiplierMask = 0; m_auraScaleMask = 0; + memset(m_damageMultipliers, 0, sizeof(m_damageMultipliers)); // Get data for type of attack switch (m_spellInfo->DmgClass) @@ -559,6 +562,16 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme unitTarget = NULL; itemTarget = NULL; gameObjTarget = NULL; + destTarget = NULL; + damage = 0; + effectHandleMode = SPELL_EFFECT_HANDLE_LAUNCH; + m_diminishLevel = DIMINISHING_LEVEL_1; + m_diminishGroup = DIMINISHING_NONE; + m_damage = 0; + m_healing = 0; + m_procAttacker = 0; + m_procVictim = 0; + m_procEx = 0; focusObject = NULL; m_cast_count = 0; m_glyphIndex = 0; @@ -574,6 +587,8 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme m_casttime = 0; // setup to correct value in Spell::prepare, must not be used before. m_timer = 0; // will set to castime in prepare + m_immediateHandled = false; + m_channelTargetEffectMask = 0; // Determine if spell can be reflected back to the caster diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 621c4e2bce0..33bfc042889 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5308,12 +5308,8 @@ void Spell::EffectQuestStart(SpellEffIndex effIndex) Player* player = unitTarget->ToPlayer(); if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(m_spellInfo->Effects[effIndex].MiscValue)) - { if (player->CanTakeQuest(qInfo, false) && player->CanAddQuest(qInfo, false)) - { - player->AddQuest(qInfo, NULL); - } - } + player->AddQuestAndCheckCompletion(qInfo, NULL); } void Spell::EffectActivateRune(SpellEffIndex effIndex) diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index ebae8edd0b5..1d702fd0570 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -258,7 +258,10 @@ public: float DeltaScalingMultiplier; float ComboScalingMultiplier; - SpellEffectInfo() { } + SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), Amplitude(0), DieSides(0), + RealPointsPerLevel(0), BasePoints(0), PointsPerComboPoint(0), ValueMultiplier(0), DamageMultiplier(0), + BonusMultiplier(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(NULL), ChainTarget(0), + ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) {} SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex, SpellEffectEntry const* effect); bool IsEffect() const; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 9a01b86af00..6d58da9095b 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3403,6 +3403,11 @@ void SpellMgr::LoadSpellInfoCorrections() case 34471: // The Beast Within spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_CONFUSED | SPELL_ATTR5_USABLE_WHILE_FEARED | SPELL_ATTR5_USABLE_WHILE_STUNNED; break; + case 56606: // Ride Jokkum + case 61791: // Ride Vehicle (Yogg-Saron) + /// @todo: remove this when basepoints of all Ride Vehicle auras are calculated correctly + spellInfo->Effects[EFFECT_0].BasePoints = 1; + break; // ULDUAR SPELLS // case 62374: // Pursued (Flame Leviathan) @@ -3441,10 +3446,6 @@ void SpellMgr::LoadSpellInfoCorrections() // that will be clear if we get more spells with problem like this spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; break; - case 61791: // Ride Vehicle (Yogg-Saron) - // TODO: remove this when basepoints of all Ride Vehicle auras are calculated correctly - spellInfo->Effects[EFFECT_0].BasePoints = 1; - break; case 64468: // Empowering Shadows (Yogg-Saron) case 64486: // Empowering Shadows (Yogg-Saron) spellInfo->MaxAffectedTargets = 3; // same for both modes? diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index fe5f102dbe9..0d5643bc50c 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -60,7 +60,7 @@ class _SpellScript virtual bool _Validate(SpellInfo const* entry); public: - _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE) { } + _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(NULL), m_scriptSpellId(0) {} virtual ~_SpellScript() { } virtual void _Register(); virtual void _Unload(); diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 45c45cd10e4..2f981d7f1ec 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -32,9 +32,11 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } /////////////////////////////////////////////////////////////////////////////////////////////////// // GM ticket -GmTicket::GmTicket() { } +GmTicket::GmTicket() : _id(0), _playerGuid(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), + _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), + _needResponse(false), _haveTicket(false) { } -GmTicket::GmTicket(Player* player, WorldPacket& recvData) : _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _haveTicket(false) +GmTicket::GmTicket(Player* player, WorldPacket& recvData) : _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _haveTicket(false) { _id = sTicketMgr->GenerateTicketId(); _playerName = player->GetName(); diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index f7f71647d71..6ff2f0f562f 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -30,7 +30,13 @@ #include "Warden.h" #include "AccountMgr.h" -Warden::Warden() : _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0), _dataSent(false), _initialized(false) { } +Warden::Warden() : _session(NULL), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0), + _dataSent(false), _previousTimestamp(0), _module(NULL), _initialized(false) +{ + memset(_inputKey, 0, sizeof(_inputKey)); + memset(_outputKey, 0, sizeof(_outputKey)); + memset(_seed, 0, sizeof(_seed)); +} Warden::~Warden() { diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index ca20f4ca8e3..d3225fe445b 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -34,7 +34,7 @@ #include "WardenCheckMgr.h" #include "AccountMgr.h" -WardenWin::WardenWin() : Warden() { } +WardenWin::WardenWin() : Warden(), _serverTicks(0) {} WardenWin::~WardenWin() { } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 701fb144165..fa6ecfaafe8 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -111,17 +111,29 @@ World::World() m_MaxPlayerCount = 0; m_NextDailyQuestReset = 0; m_NextWeeklyQuestReset = 0; + m_NextMonthlyQuestReset = 0; + m_NextRandomBGReset = 0; + m_NextGuildReset = 0; m_NextCurrencyReset = 0; m_defaultDbcLocale = LOCALE_enUS; m_availableDbcLocaleMask = 0; + mail_timer = 0; + mail_timer_expires = 0; + m_updateTime = 0; m_updateTimeSum = 0; m_updateTimeCount = 0; + m_currentTime = 0; m_isClosed = false; m_CleaningFlags = 0; + + memset(rate_values, 0, sizeof(rate_values)); + memset(m_int_configs, 0, sizeof(m_int_configs)); + memset(m_bool_configs, 0, sizeof(m_bool_configs)); + memset(m_float_configs, 0, sizeof(m_float_configs)); } /// World destructor diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 84adeb3417c..83e65d2f01f 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -92,7 +92,7 @@ public: // ok, normal (creature/GO starting) quest if (player->CanAddQuest(quest, true)) { - player->AddQuest(quest, NULL); + player->AddQuestAndCheckCompletion(quest, NULL); if (player->CanCompleteQuest(entry)) player->CompleteQuest(entry); diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 7a2afe5505f..c09c817a2bf 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -163,7 +163,8 @@ public: ## npc_brunnhildar_prisoner ######*/ -enum BrunnhildarPrisoner { +enum BrunnhildarPrisoner +{ SPELL_ICE_PRISON = 54894, SPELL_ICE_LANCE = 55046, SPELL_FREE_PRISONER = 55048, @@ -635,14 +636,13 @@ class spell_close_rift : public SpellScriptLoader }; /*##### -# spell_jokkum_scriptcast +# Krolmir, Hammer of Storms #####*/ enum JokkumScriptcast { SPELL_JOKKUM_KILL_CREDIT = 56545, SPELL_JOKKUM_SUMMON = 56541, - SPELL_RIDE_JOKKUM = 56606, NPC_KINGJOKKUM = 30331, SAY_HOLD_ON = 0, PATH_JOKKUM = 2072200 @@ -658,29 +658,15 @@ class spell_jokkum_scriptcast : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_JOKKUM_KILL_CREDIT) || !sSpellMgr->GetSpellInfo(SPELL_JOKKUM_SUMMON)) + if (!sSpellMgr->GetSpellInfo(SPELL_JOKKUM_SUMMON)) return false; return true; } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Player* player = GetTarget()->ToPlayer()) - { - player->CastSpell(player, SPELL_JOKKUM_KILL_CREDIT, true); - player->CastSpell(player, SPELL_JOKKUM_SUMMON, true); - - if (Creature* kingjokkum = GetClosestCreatureWithEntry(player, NPC_KINGJOKKUM, 10.0f)) - { - kingjokkum->setFaction(player->getFaction()); - player->CastSpell(kingjokkum, SPELL_RIDE_JOKKUM, true); - player->SetUInt64Value(PLAYER_FARSIGHT, player->GetGUID()); - kingjokkum->AI()->Talk(0, player->GetGUID()); - kingjokkum->ToPlayer()->SetClientControl(kingjokkum, 1); - kingjokkum->GetMotionMaster()->MovePath(PATH_JOKKUM, false); - kingjokkum->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - } - } + Unit* target = GetTarget(); + target->CastSpell(target, SPELL_JOKKUM_SUMMON, true); } void Register() OVERRIDE @@ -695,6 +681,45 @@ class spell_jokkum_scriptcast : public SpellScriptLoader } }; +class npc_king_jokkum_vehicle : public CreatureScript +{ + public: + npc_king_jokkum_vehicle() : CreatureScript("npc_king_jokkum_vehicle") { } + + struct npc_king_jokkum_vehicleAI : public VehicleAI + { + npc_king_jokkum_vehicleAI(Creature* creature) : VehicleAI(creature) { } + + void OnCharmed(bool /*apply*/) OVERRIDE { } + + void PassengerBoarded(Unit* who, int8 /*seat*/, bool apply) OVERRIDE + { + if (apply) + { + Talk(SAY_HOLD_ON, who->GetGUID()); + me->CastSpell(who, SPELL_JOKKUM_KILL_CREDIT, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->GetMotionMaster()->MovePath(PATH_JOKKUM, false); + } + } + + void MovementInform(uint32 type, uint32 id) OVERRIDE + { + if (type != WAYPOINT_MOTION_TYPE) + return; + + // PointId in WaypointMovementGenerator doesn't match with PointId in DB + if (id == 19) + me->GetVehicleKit()->RemoveAllPassengers(); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_king_jokkum_vehicleAI(creature); + } +}; + void AddSC_storm_peaks() { new npc_injured_goblin(); @@ -706,4 +731,5 @@ void AddSC_storm_peaks() new npc_brann_bronzebeard_keystone(); new spell_close_rift(); new spell_jokkum_scriptcast(); + new npc_king_jokkum_vehicle(); } diff --git a/src/server/shared/Utilities/EventProcessor.h b/src/server/shared/Utilities/EventProcessor.h index 8abf0f09dfe..f341019395d 100644 --- a/src/server/shared/Utilities/EventProcessor.h +++ b/src/server/shared/Utilities/EventProcessor.h @@ -28,7 +28,12 @@ class BasicEvent { public: - BasicEvent() { to_Abort = false; } + BasicEvent() + { + to_Abort = false; + m_addTime = 0; + m_execTime = 0; + } virtual ~BasicEvent() { } // override destructor to perform some actions on event removal // this method executes when the event is triggered |