aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/authserver/Realms/RealmList.cpp4
-rwxr-xr-xsrc/server/authserver/Realms/RealmList.h2
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp12
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp6
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp4
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.cpp5
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp12
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp2
-rw-r--r--src/server/game/Grids/GridDefines.h3
-rwxr-xr-xsrc/server/game/World/World.cpp18
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp16
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp2
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp2
-rwxr-xr-xsrc/server/worldserver/Master.cpp11
16 files changed, 57 insertions, 48 deletions
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp
index efcced51089..f856156825d 100755
--- a/src/server/authserver/Realms/RealmList.cpp
+++ b/src/server/authserver/Realms/RealmList.cpp
@@ -31,7 +31,7 @@ void RealmList::Initialize(uint32 updateInterval)
UpdateRealms(true);
}
-void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
+void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
{
// Create new if not exist or update existed
Realm& realm = m_realms[name];
@@ -82,7 +82,7 @@ void RealmList::UpdateRealms(bool init)
uint32 realmId = fields[0].GetUInt32();
const std::string& name = fields[1].GetString();
const std::string& address = fields[2].GetString();
- uint32 port = fields[3].GetUInt32();
+ uint16 port = fields[3].GetUInt16();
uint8 icon = fields[4].GetUInt8();
RealmFlags flag = RealmFlags(fields[5].GetUInt8());
uint8 timezone = fields[6].GetUInt8();
diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h
index 4d258953ae0..c8407b0fea1 100755
--- a/src/server/authserver/Realms/RealmList.h
+++ b/src/server/authserver/Realms/RealmList.h
@@ -71,7 +71,7 @@ public:
private:
void UpdateRealms(bool init=false);
- void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
+ void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
RealmMap m_realms;
uint32 m_UpdateInterval;
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index 11887611ae8..7a2b83273c9 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -95,7 +95,7 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c)
m_AttackDistance = 0.0f;
m_AttackAngle = 0.0f;
- m_InvinceabilityHpLevel = 0;
+ m_InvincibilityHpLevel = 0;
//Handle Spawned Events
if (!m_bEmptyList)
@@ -816,9 +816,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
{
if (action.invincibility_hp_level.is_percent)
- m_InvinceabilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level);
+ m_InvincibilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level);
else
- m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
+ m_InvincibilityHpLevel = action.invincibility_hp_level.hp_level;
break;
}
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
@@ -1350,12 +1350,12 @@ void CreatureEventAI::ReceiveEmote(Player* player, uint32 textEmote)
void CreatureEventAI::DamageTaken(Unit* /*done_by*/, uint32& damage)
{
- if (m_InvinceabilityHpLevel > 0 && me->GetHealth() < m_InvinceabilityHpLevel+damage)
+ if (m_InvincibilityHpLevel > 0 && me->GetHealth() < m_InvincibilityHpLevel+damage)
{
- if (me->GetHealth() <= m_InvinceabilityHpLevel)
+ if (me->GetHealth() <= m_InvincibilityHpLevel)
damage = 0;
else
- damage = me->GetHealth() - m_InvinceabilityHpLevel;
+ damage = me->GetHealth() - m_InvincibilityHpLevel;
}
}
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index c4daf2563e0..3d2bcf888c8 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -641,6 +641,6 @@ class CreatureEventAI : public CreatureAI
bool m_MeleeEnabled; // If we allow melee auto attack
float m_AttackDistance; // Distance to attack from
float m_AttackAngle; // Angle of attack
- uint32 m_InvinceabilityHpLevel; // Minimal health level allowed at damage apply
+ uint32 m_InvincibilityHpLevel; // Minimal health level allowed at damage apply
};
#endif
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 2ff25544b2c..4eb7f8a7f50 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -68,7 +68,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mFollowCredit = 0;
mFollowArrivedEntry = 0;
mFollowCreditType = 0;
- mInvinceabilityHpLevel = 0;
+ mInvincibilityHpLevel = 0;
}
void SmartAI::UpdateDespawn(const uint32 diff)
@@ -640,8 +640,8 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
- if ((me->GetHealth() - damage) <= mInvinceabilityHpLevel)
- damage -= mInvinceabilityHpLevel;
+ if ((me->GetHealth() - damage) <= mInvincibilityHpLevel)
+ damage = me->GetHealth() - mInvincibilityHpLevel;
}
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 0b925f852f4..94e5e65cf8b 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -174,7 +174,7 @@ class SmartAI : public CreatureAI
void SetSwim(bool swim = true);
- void SetInvinceabilityHpLevel(uint32 level) { mInvinceabilityHpLevel = level; }
+ void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; }
void sGossipHello(Player* player);
void sGossipSelect(Player* player, uint32 sender, uint32 action);
@@ -223,7 +223,7 @@ class SmartAI : public CreatureAI
bool mCanAutoAttack;
bool mCanCombatMove;
bool mForcedPaused;
- uint32 mInvinceabilityHpLevel;
+ uint32 mInvincibilityHpLevel;
bool AssistPlayerInCombat(Unit* who);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 5eaa1577642..b2c4fd29868 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1043,9 +1043,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
if (e.action.invincHP.percent)
- ai->SetInvinceabilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent));
+ ai->SetInvincibilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent));
else
- ai->SetInvinceabilityHpLevel(e.action.invincHP.minHP);
+ ai->SetInvincibilityHpLevel(e.action.invincHP.minHP);
break;
}
case SMART_ACTION_SET_DATA:
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index b236bd41210..6d784488aad 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -37,6 +37,11 @@ BattlegroundSA::BattlegroundSA()
SignaledRoundTwo = false;
SignaledRoundTwoHalfMin = false;
InitSecondRound = false;
+
+ //! This is here to prevent an uninitialised variable warning
+ //! The warning only occurs when SetUpBattleGround fails though.
+ //! In the future this function should be called BEFORE sending initial worldstates.
+ memset(&GraveyardStatus, 0, sizeof(GraveyardStatus));
}
BattlegroundSA::~BattlegroundSA()
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index f25d90855d4..7d2c62feb73 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -858,6 +858,10 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
isDebugAreaTriggers = false;
+ m_WeeklyQuestChanged = false;
+
+ m_SeasonalQuestChanged = false;
+
SetPendingBind(0, 0);
}
@@ -17958,14 +17962,8 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
QuestStatusData& questStatusData = m_QuestStatus[quest_id];
uint8 qstatus = fields[1].GetUInt8();
- if (qstatus < MAX_QUEST_STATUS && qstatus > QUEST_STATUS_NONE)
+ if (qstatus < MAX_QUEST_STATUS)
questStatusData.Status = QuestStatus(qstatus);
- else if (qstatus == QUEST_STATUS_NONE)
- {
- sLog->outError("Player %s (GUID: %u) has QUEST_STATUS_NONE for quest %u and should be removed from character_queststatus.",
- GetName(), GetGUIDLow(), quest_id);
- continue;
- }
else
{
questStatusData.Status = QUEST_STATUS_INCOMPLETE;
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index b15ffc361d7..bf7bc13345a 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -823,7 +823,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- int8 event_id = fields[0].GetInt8();
+ uint8 event_id = fields[0].GetUInt8();
if (event_id >= mGameEventVendors.size())
{
diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h
index 99bb20fe9f6..7bd0da34a46 100644
--- a/src/server/game/Grids/GridDefines.h
+++ b/src/server/game/Grids/GridDefines.h
@@ -215,8 +215,7 @@ namespace Trinity
inline bool IsValidMapCoord(float c)
{
- //! Since we visit grids in circles, we cannot allow players to relocate to grids on the edge of a map - thus the use of CENTER_GRID_OFFSET
- return finite(c) && (std::fabs(c) <= MAP_HALFSIZE - CENTER_GRID_OFFSET - 0.5f);
+ return finite(c) && (std::fabs(c) <= MAP_HALFSIZE - 0.5f);
}
inline bool IsValidMapCoord(float x, float y)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 3e730bd27af..a842c288c89 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1666,18 +1666,10 @@ void World::SetInitialWorldSettings()
///- Initialize game time and timers
sLog->outString("Initialize game time and timers");
m_gameTime = time(NULL);
- m_startTime=m_gameTime;
-
- tm local;
- time_t curr;
- time(&curr);
- local=*(localtime(&curr)); // dereference and assign
- char isoDate[128];
- sprintf(isoDate, "%04d-%02d-%02d %02d:%02d:%02d",
- local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec);
+ m_startTime = m_gameTime;
- LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime, revision) VALUES('%u', " UI64FMTD ", '%s', 0, '%s')",
- realmID, uint64(m_startTime), isoDate, _FULLVERSION); // One-time query
+ LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')",
+ realmID, uint32(m_startTime), _FULLVERSION); // One-time query
m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILLISECONDS);
m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE*IN_MILLISECONDS);
@@ -1962,10 +1954,10 @@ void World::Update(uint32 diff)
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_UPTIME_PLAYERS);
- stmt->setUInt64(0, uint64(tmpDiff));
+ stmt->setUInt32(0, tmpDiff);
stmt->setUInt16(1, uint16(maxOnlinePlayers));
stmt->setUInt32(2, realmID);
- stmt->setUInt64(3, uint64(m_startTime));
+ stmt->setUInt32(3, uint32(m_startTime));
LoginDatabase.Execute(stmt);
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index b012fe5f183..a327a200c98 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -185,6 +185,11 @@ class spell_pri_penance : public SpellScriptLoader
{
PrepareSpellScript(spell_pri_penance_SpellScript);
+ bool Load()
+ {
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
bool Validate(SpellInfo const* spellEntry)
{
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_PENANCE_R1))
@@ -219,10 +224,21 @@ class spell_pri_penance : public SpellScriptLoader
}
}
+ SpellCastResult CheckCast()
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ if (GetTargetUnit())
+ if (Player* target = GetTargetUnit()->ToPlayer())
+ if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target))
+ return SPELL_FAILED_BAD_TARGETS;
+ return SPELL_CAST_OK;
+ }
+
void Register()
{
// add dummy effect spell handler to Penance
OnEffectHitTarget += SpellEffectFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnCheckCast += SpellCheckCastFn(spell_pri_penance_SpellScript::CheckCast);
}
};
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 3d30e97544a..a9754cfc73d 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -71,7 +71,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges FROM character_aura WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SPELL, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, "
- "itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ?", CONNECTION_ASYNC)
+ "itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ? AND status <> 0", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_DAILYQUESTSTATUS, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SEASONALQUESTSTATUS, "SELECT quest, event FROM character_queststatus_seasonal WHERE guid = ?", CONNECTION_ASYNC)
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index a9bb282cf86..0a53706fea2 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -382,7 +382,7 @@ void Log::outDB(LogTypes type, const char * str)
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
stmt->setInt32(0, realm);
- stmt->setInt32(1, type);
+ stmt->setUInt8(1, uint8(type));
stmt->setString(2, logStr);
LoginDatabase.Execute(stmt);
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index f4945e025b0..03b2859c514 100755
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -270,7 +270,11 @@ int Master::Run()
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION);
- sWorldSocketMgr->Wait();
+
+ // when the main thread closes the singletons get unloaded
+ // since worldrunnable uses them, it will crash if unloaded after master
+ world_thread.wait();
+ rar_thread.wait();
if (soap_thread)
{
@@ -282,11 +286,6 @@ int Master::Run()
// set server offline
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
- // when the main thread closes the singletons get unloaded
- // since worldrunnable uses them, it will crash if unloaded after master
- world_thread.wait();
- rar_thread.wait();
-
///- Clean database before leaving
ClearOnlineAccounts();