aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp418
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h7
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp91
-rwxr-xr-xsrc/server/game/Quests/QuestDef.cpp147
-rwxr-xr-xsrc/server/game/Quests/QuestDef.h6
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/CharacterHandler.cpp2
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.cpp16
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.h3
8 files changed, 385 insertions, 305 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 24e83da78d5..2fe2cb4de61 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -279,10 +279,8 @@ uint32 PlayerTaxi::GetCurrentTaxiPath() const
std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
{
- ss << '\'';
for (uint8 i = 0; i < TaxiMaskSize; ++i)
ss << taxi.m_taximask[i] << ' ';
- ss << '\'';
return ss;
}
@@ -14515,7 +14513,7 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
bool Player::CanSeeStartQuest(Quest const* quest)
{
- if (SatisfyQuestRace(quest, false) && SatisfyQuestSkillOrClass(quest, false) &&
+ if (SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) && SatisfyQuestSkill(quest, false) &&
SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
@@ -14530,8 +14528,8 @@ bool Player::CanSeeStartQuest(Quest const* quest)
bool Player::CanTakeQuest(Quest const* quest, bool msg)
{
return SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
- && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
- && SatisfyQuestSkillOrClass(quest, msg) && SatisfyQuestReputation(quest, msg)
+ && SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
+ && SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
&& SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
@@ -15062,47 +15060,21 @@ void Player::FailQuest(uint32 questId)
}
}
-bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg)
+bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const
{
- int32 zoneOrSort = qInfo->GetZoneOrSort();
- int32 skillOrClassMask = qInfo->GetSkillOrClassMask();
+ uint32 skill = qInfo->GetRequiredSkill();
- // skip zone zoneOrSort and 0 case skillOrClass
- if (zoneOrSort >= 0 && skillOrClassMask == 0)
+ // skip 0 case RequiredSkill
+ if (skill == 0)
return true;
- int32 questSort = -zoneOrSort;
- uint8 reqSortClass = ClassByQuestSort(questSort);
-
- // check class sort cases in zoneOrSort
- if (reqSortClass != 0 && getClass() != reqSortClass)
+ // check skill value
+ if (GetSkillValue(skill) < qInfo->GetRequiredSkillValue())
{
if (msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
- // check class
- if (skillOrClassMask < 0)
- {
- uint32 reqClassMask = -int32(skillOrClassMask);
- if (!(reqClassMask & getClassMask()))
- {
- if (msg)
- SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
- }
- // check skill
- else if (skillOrClassMask > 0)
- {
- uint32 reqSkill = skillOrClassMask;
- if (GetSkillValue(reqSkill) < qInfo->GetRequiredSkillValue())
- {
- if (msg)
- SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
+ return false;
}
return true;
@@ -15230,6 +15202,24 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
return false;
}
+bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const
+{
+ uint32 reqClass = qInfo->GetRequiredClasses();
+
+ if (reqClass == 0)
+ return true;
+
+ if ((reqClass & getClassMask()) == 0)
+ {
+ if (msg)
+ SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+
+ return false;
+ }
+
+ return true;
+}
+
bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg)
{
uint32 reqraces = qInfo->GetRequiredRaces();
@@ -16201,7 +16191,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id)
}
}
-void Player::SendCanTakeQuestResponse(uint32 msg)
+void Player::SendCanTakeQuestResponse(uint32 msg) const
{
WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4);
data << uint32(msg);
@@ -18264,7 +18254,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
/*** SAVE SYSTEM ***/
/*********************************************************/
-void Player::SaveToDB()
+void Player::SaveToDB(bool create /*=false*/)
{
// delay auto save at any saves (manual, in code, or autosave)
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
@@ -18282,156 +18272,232 @@ void Player::SaveToDB()
sLog->outDebug(LOG_FILTER_UNITS, "The value of player %s at save: ", m_name.c_str());
outDebugValues();
- std::string sql_name = m_name;
- CharacterDatabase.EscapeString(sql_name);
+ PreparedStatement* stmt = NULL;
+ uint16 index = 0;
- std::ostringstream ss;
- ss << "REPLACE INTO characters (guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
- "map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, "
- "taximask, online, cinematic, "
- "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, "
- "trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
- "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
- "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
- "power4, power5, power6, power7, latency, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels) VALUES ("
- << GetGUIDLow() << ','
- << GetSession()->GetAccountId() << ", '"
- << sql_name << "', "
- << uint32(getRace()) << ','
- << uint32(getClass()) << ','
- << uint32(getGender()) << ','
- << uint32(getLevel()) << ','
- << GetUInt32Value(PLAYER_XP) << ','
- << GetMoney() << ','
- << GetUInt32Value(PLAYER_BYTES) << ','
- << GetUInt32Value(PLAYER_BYTES_2) << ','
- << GetUInt32Value(PLAYER_FLAGS) << ',';
-
- if (!IsBeingTeleported())
- {
- ss << GetMapId() << ','
- << (uint32)GetInstanceId() << ','
- << uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ','
- << finiteAlways(GetPositionX()) << ','
- << finiteAlways(GetPositionY()) << ','
- << finiteAlways(GetPositionZ()) << ','
- << finiteAlways(GetOrientation()) << ',';
- }
- else
+ if (create)
{
- ss << GetTeleportDest().GetMapId() << ','
- << (uint32)0 << ','
- << uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ','
- << finiteAlways(GetTeleportDest().GetPositionX()) << ','
- << finiteAlways(GetTeleportDest().GetPositionY()) << ','
- << finiteAlways(GetTeleportDest().GetPositionZ()) << ','
- << finiteAlways(GetTeleportDest().GetOrientation()) << ',';
- }
-
- ss << m_taxi << ','; // string with TaxiMaskSize numbers
-
- ss << (IsInWorld() ? 1 : 0) << ',';
-
- ss << uint32(m_cinematic) << ',';
+ //! Insert query
+ //! TO DO: Filter out more redundant fields that can take their default value at player create
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHARACTER);
+ stmt->setUInt32(index++, GetGUIDLow());
+ stmt->setUInt32(index++, GetSession()->GetAccountId());
+ stmt->setString(index++, GetName());
+ stmt->setUInt8(index++, getRace());
+ stmt->setUInt8(index++, getClass());
+ stmt->setUInt8(index++, getGender());
+ stmt->setUInt8(index++, getLevel());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_XP));
+ stmt->setUInt32(index++, GetMoney());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES_2));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
+ stmt->setUInt16(index++, (uint16)GetMapId());
+ stmt->setUInt32(index++ , (uint32)GetInstanceId());
+ stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
+ stmt->setFloat(index++, finiteAlways(GetPositionX()));
+ stmt->setFloat(index++, finiteAlways(GetPositionY()));
+ stmt->setFloat(index++, finiteAlways(GetPositionZ()));
+ stmt->setFloat(index++, finiteAlways(GetOrientation()));
+
+ std::ostringstream ss;
+ ss << m_taxi;
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, m_cinematic);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
+ stmt->setFloat(index++, finiteAlways(m_rest_bonus));
+ stmt->setUInt32(index++, uint32(time(NULL)));
+ stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
+ //save, far from tavern/city
+ //save, but in tavern/city
+ stmt->setUInt32(index++, m_resetTalentsCost);
+ stmt->setUInt32(index++, m_resetTalentsTime);
+ stmt->setUInt16(index++, (uint16)m_ExtraFlags);
+ stmt->setUInt8(index++, m_stableSlots);
+ stmt->setUInt16(index++, (uint16)m_atLoginFlags);
+ stmt->setUInt16(index++, GetZoneId());
+ stmt->setUInt32(index++, m_deathExpireTime);
+
+ ss.str().clear();
+ ss << m_taxi.SaveTaxiDestinationsToString();
+
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetArenaPoints());
+ stmt->setUInt32(index++, GetHonorPoints());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
+ stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
+ stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt32(index++, GetHealth());
+
+ for (uint32 i = 0; i < MAX_POWERS; ++i)
+ stmt->setUInt32(index++, GetPower(Powers(i)));
+
+ stmt->setUInt32(index++, GetSession()->GetLatency());
+
+ stmt->setUInt8(index++, m_specsCount);
+ stmt->setUInt8(index++, m_activeSpec);
+
+ ss.str().clear();
+ for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
+ stmt->setString(index++, ss.str());
+
+ ss.str().clear();
+ // cache equipment...
+ for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
+ ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
+ stmt->setString(index++, ss.str());
+
+ ss.str().clear();
+ // ...and bags for enum opcode
+ for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
+ {
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ ss << item->GetEntry();
+ else
+ ss << '0';
+ ss << " 0 ";
+ }
- ss << m_Played_time[PLAYED_TIME_TOTAL] << ',';
- ss << m_Played_time[PLAYED_TIME_LEVEL] << ',';
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
- ss << finiteAlways(m_rest_bonus) << ',';
- ss << uint32(time(NULL)) << ',';
- ss << (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0) << ',';
- //save, far from tavern/city
- //save, but in tavern/city
- ss << m_resetTalentsCost << ',';
- ss << uint32(m_resetTalentsTime) << ',';
+ ss.str().clear();
+ for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
+ ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i);
- ss << finiteAlways(m_movementInfo.t_pos.GetPositionX()) << ',';
- ss << finiteAlways(m_movementInfo.t_pos.GetPositionY()) << ',';
- ss << finiteAlways(m_movementInfo.t_pos.GetPositionZ()) << ',';
- ss << finiteAlways(m_movementInfo.t_pos.GetOrientation()) << ',';
- if (m_transport)
- ss << m_transport->GetGUIDLow();
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
+ stmt->setUInt32(index++, m_grantableLevels);
+ }
else
- ss << '0';
- ss << ',';
-
- ss << m_ExtraFlags << ',';
-
- ss << uint32(m_stableSlots) << ','; // to prevent save uint8 as char
-
- ss << uint32(m_atLoginFlags) << ',';
-
- ss << GetZoneId() << ',';
-
- ss << uint32(m_deathExpireTime) << ", '";
-
- ss << m_taxi.SaveTaxiDestinationsToString() << "', ";
-
- ss << GetArenaPoints() << ',';
-
- ss << GetHonorPoints() << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION) << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION) << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) << ',';
-
- ss << GetUInt16Value(PLAYER_FIELD_KILLS, 0) << ',';
-
- ss << GetUInt16Value(PLAYER_FIELD_KILLS, 1) << ',';
-
- ss << GetUInt32Value(PLAYER_CHOSEN_TITLE) << ',';
-
- ss << GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES) << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX) << ',';
-
- ss << (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE) << ',';
-
- ss << GetHealth();
-
- for (uint32 i = 0; i < MAX_POWERS; ++i)
- ss << ',' << GetPower(Powers(i));
- ss << ',';
- ss << GetSession()->GetLatency();
- ss << ',';
- ss << uint32(m_specsCount);
- ss << ',';
- ss << uint32(m_activeSpec) << ", '";
- for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
- ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
-
- // cache equipment...
- ss << "', '";
- for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
- ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
-
- // ...and bags for enum opcode
- for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{
- if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- ss << item->GetEntry();
+ // Update query
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER);
+ stmt->setString(index++, GetName());
+ stmt->setUInt8(index++, getRace());
+ stmt->setUInt8(index++, getClass());
+ stmt->setUInt8(index++, getGender());
+ stmt->setUInt8(index++, getLevel());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_XP));
+ stmt->setUInt32(index++, GetMoney());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES_2));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
+
+ if (!IsBeingTeleported())
+ {
+ stmt->setUInt16(index++, (uint16)GetMapId());
+ stmt->setUInt32(index++, (uint32)GetInstanceId());
+ stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
+ stmt->setFloat(index++, finiteAlways(GetPositionX()));
+ stmt->setFloat(index++, finiteAlways(GetPositionY()));
+ stmt->setFloat(index++, finiteAlways(GetPositionZ()));
+ stmt->setFloat(index++, finiteAlways(GetOrientation()));
+ }
else
- ss << '0';
- ss << " 0 ";
- }
+ {
+ stmt->setUInt16(index++, (uint16)GetTeleportDest().GetMapId());
+ stmt->setUInt32(index++, (uint32)0);
+ stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionX()));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionY()));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionZ()));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetOrientation()));
+ }
+
+ std::ostringstream ss;
+ ss << m_taxi;
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, m_cinematic);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
+ stmt->setFloat(index++, finiteAlways(m_rest_bonus));
+ stmt->setUInt32(index++, uint32(time(NULL)));
+ stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
+ //save, far from tavern/city
+ //save, but in tavern/city
+ stmt->setUInt32(index++, m_resetTalentsCost);
+ stmt->setUInt32(index++, m_resetTalentsTime);
+ stmt->setUInt16(index++, (uint16)m_ExtraFlags);
+ stmt->setUInt8(index++, m_stableSlots);
+ stmt->setUInt16(index++, (uint16)m_atLoginFlags);
+ stmt->setUInt16(index++, GetZoneId());
+ stmt->setUInt32(index++, m_deathExpireTime);
+
+ ss.str().clear();
+ ss << m_taxi.SaveTaxiDestinationsToString();
+
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetArenaPoints());
+ stmt->setUInt32(index++, GetHonorPoints());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
+ stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
+ stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt32(index++, GetHealth());
+
+ for (uint32 i = 0; i < MAX_POWERS; ++i)
+ stmt->setUInt32(index++, GetPower(Powers(i)));
+
+ stmt->setUInt32(index++, GetSession()->GetLatency());
+
+ stmt->setUInt8(index++, m_specsCount);
+ stmt->setUInt8(index++, m_activeSpec);
+
+ ss.str().clear();
+ for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
+ stmt->setString(index++, ss.str());
+
+ ss.str().clear();
+ // cache equipment...
+ for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
+ ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
+ stmt->setString(index++, ss.str());
+
+ ss.str().clear();
+ // ...and bags for enum opcode
+ for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
+ {
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ ss << item->GetEntry();
+ else
+ ss << '0';
+ ss << " 0 ";
+ }
- ss << "',";
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
- ss << GetUInt32Value(PLAYER_AMMO_ID) << ", '";
- for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
- ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << ' ';
+ ss.str().clear();
+ for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
+ ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i);
- ss << "',";
- ss << uint32(GetByteValue(PLAYER_FIELD_BYTES, 2));
- ss << ",";
- ss << uint32(m_grantableLevels);
- ss << ')';
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
+ stmt->setUInt32(index++, m_grantableLevels);
+
+ stmt->setUInt8(index++, IsInWorld() ? 1 : 0);
+ // Index
+ stmt->setUInt32(index++, GetGUIDLow());
+ }
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- trans->Append(ss.str().c_str());
+ trans->Append(stmt);
if (m_mailsUpdated) //save mails only when needed
_SaveMail(trans);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 0fc67499bb5..b81d1c975f2 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1410,10 +1410,11 @@ class Player : public Unit, public GridObject<Player>
void IncompleteQuest(uint32 quest_id);
void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true);
void FailQuest(uint32 quest_id);
- bool SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg);
+ bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
bool SatisfyQuestLevel(Quest const* qInfo, bool msg);
bool SatisfyQuestLog(bool msg);
bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg);
+ bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
bool SatisfyQuestRace(Quest const* qInfo, bool msg);
bool SatisfyQuestReputation(Quest const* qInfo, bool msg);
bool SatisfyQuestStatus(Quest const* qInfo, bool msg);
@@ -1493,7 +1494,7 @@ class Player : public Unit, public GridObject<Player>
void SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver);
void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK);
void SendQuestTimerFailed(uint32 quest_id);
- void SendCanTakeQuestResponse(uint32 msg);
+ void SendCanTakeQuestResponse(uint32 msg) const;
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendPushToPartyResponse(Player* player, uint32 msg);
void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count);
@@ -1530,7 +1531,7 @@ class Player : public Unit, public GridObject<Player>
/*** SAVE SYSTEM ***/
/*********************************************************/
- void SaveToDB();
+ void SaveToDB(bool create = false);
void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing
void SaveGoldToDB(SQLTransaction& trans);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 1047ff90174..c1af7bcfed4 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -3691,41 +3691,41 @@ void ObjectMgr::LoadQuests()
mExclusiveQuestGroups.clear();
- // 0 1 2 3 4 5 6 7 8 9
- QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClassMask, MinLevel, MaxLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue, "
- // 10 11 12 13 14 15 16 17 18 19
+ // 0 1 2 3 4 5 6 7 8 9 10
+ QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, MinLevel, MaxLevel, QuestLevel, Type, RequiredClasses, RequiredRaces, RequiredSkill, RequiredSkillValue, "
+ // 11 12 13 14 15 16 17 18 19 20
"RepObjectiveFaction, RepObjectiveValue, RepObjectiveFaction2, RepObjectiveValue2, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime, "
- // 20 21 22 23 24 25 26 27 28 29 30 31 32 33
+ // 21 22 23 24 25 26 27 28 29 30 31 32 33 34
"QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, RewardArenaPoints, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, RewXPId, SrcItemId, SrcItemCount, SrcSpell, "
- // 34 35 36 37 38 39 40 41 42 43 44
+ // 35 36 37 38 39 40 41 42 43 44 45
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, "
- // 45 46 47 48 49 50 51 52 53 54 55 56
+ // 46 47 48 49 50 51 52 53 54 55 56 57
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6, "
- // 57 58 59 60 61 62 63 64
+ // 58 59 60 61 62 63 64 65
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4, "
- // 65 66 67 68 69 70 71 72
+ // 66 67 68 69 70 71 72 73
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4, "
- // 73 74 75 76
+ // 74 75 76 77
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4, "
- // 77 78 79 80 81 82
+ // 78 79 80 81 82 83
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6, "
- // 83 84 85 86 87 88
+ // 84 85 86 87 88 89
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6, "
- // 89 90 91 92 93 94 95 96
+ // 90 91 92 93 94 95 96 97
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4, "
- // 97 98 99 100 101 102 103 104 105 106
+ // 98 99 100 101 102 103 104 105 106 107
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValueId1, RewRepValueId2, RewRepValueId3, RewRepValueId4, RewRepValueId5, "
- // 107 108 109 110 111
+ // 108 109 110 111 112
"RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5, "
- // 112 113 114 115 116 117 118 119 120 121 122 123
+ // 113 114 115 116 117 118 119 120 121 122 123 124
"RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt, "
- // 124 125 126 127 128 129 130 131
+ // 125 126 127 128 129 130 131 132
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, "
- // 132 133 134 135 136 137
+ // 133 134 135 136 137 138
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, "
- // 138 139 140 141
+ // 139 140 141 142
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, "
- // 142 143
+ // 143 144
"StartScript, CompleteScript"
" FROM quest_template");
if (!result)
@@ -3829,45 +3829,43 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(), qinfo->ZoneOrSort);
// no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check)
}
- //check SkillOrClass value (class case).
- if (ClassByQuestSort(-int32(qinfo->ZoneOrSort)))
- {
- // SkillOrClass should not have class case when class case already set in ZoneOrSort.
- if (qinfo->SkillOrClassMask < 0)
- {
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (class sort case) and `SkillOrClassMask` = %i (class case), redundant.",
- qinfo->GetQuestId(), qinfo->ZoneOrSort, qinfo->SkillOrClassMask);
- }
- }
- //check for proper SkillOrClass value (skill case)
+ //check for proper RequiredSkill value (skill case)
if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
{
- // skill is positive value in SkillOrClass
- if (qinfo->SkillOrClassMask != skill_id)
+ if (qinfo->RequiredSkill != skill_id)
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (skill sort case) but `SkillOrClassMask` does not have a corresponding value (%i).",
+ sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkill` does not have a corresponding value (%i).",
qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id);
//override, and force proper value here?
}
}
}
- // SkillOrClassMask (class case)
- if (qinfo->SkillOrClassMask < 0)
+ // RequiredClasses, can be 0/CLASSMASK_ALL_PLAYABLE to allow any class
+ if (qinfo->RequiredClasses)
{
- if (!(-int32(qinfo->SkillOrClassMask) & CLASSMASK_ALL_PLAYABLE))
+ if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Quest %u has `SkillOrClassMask` = %i (class case) but classmask does not have valid class",
- qinfo->GetQuestId(), qinfo->SkillOrClassMask);
+ sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
+ qinfo->RequiredClasses = 0;
}
}
- // SkillOrClassMask (skill case)
- if (qinfo->SkillOrClassMask > 0)
+ // RequiredRaces, can be 0/RACEMASK_ALL_PLAYABLE to allow any race
+ if (qinfo->RequiredRaces)
+ {
+ if (!(qinfo->RequiredRaces & RACEMASK_ALL_PLAYABLE))
+ {
+ sLog->outErrorDb("Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces);
+ qinfo->RequiredRaces = 0;
+ }
+ }
+ // RequiredSkill, can be 0
+ if (qinfo->RequiredSkill)
{
- if (!sSkillLineStore.LookupEntry(qinfo->SkillOrClassMask))
+ if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkill))
{
- sLog->outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist",
- qinfo->GetQuestId(), qinfo->SkillOrClassMask, qinfo->SkillOrClassMask);
+ sLog->outErrorDb("Quest %u has `RequiredSkill` = %u but this skill does not exist",
+ qinfo->GetQuestId(), qinfo->RequiredSkill);
}
}
@@ -3879,13 +3877,6 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(), qinfo->RequiredSkillValue, sWorld->GetConfigMaxSkillValue());
// no changes, quest can't be done for this requirement
}
-
- if (qinfo->SkillOrClassMask <= 0)
- {
- sLog->outErrorDb("Quest %u has `RequiredSkillValue` = %u but `SkillOrClass` = %i (class case), value ignored.",
- qinfo->GetQuestId(), qinfo->RequiredSkillValue, qinfo->SkillOrClassMask);
- // no changes, quest can't be done for this requirement (fail at wrong skill id)
- }
}
// else Skill quests can have 0 skill level, this is ok
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 9650afb60e2..7cd442cd9f9 100755
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -25,120 +25,121 @@ Quest::Quest(Field* questRecord)
QuestId = questRecord[0].GetUInt32();
QuestMethod = questRecord[1].GetUInt32();
ZoneOrSort = questRecord[2].GetInt32();
- SkillOrClassMask = questRecord[3].GetInt32();
- MinLevel = questRecord[4].GetUInt32();
- MaxLevel = questRecord[5].GetUInt32();
- QuestLevel = questRecord[6].GetInt32();
- Type = questRecord[7].GetUInt32();
+ MinLevel = questRecord[3].GetUInt32();
+ MaxLevel = questRecord[4].GetUInt32();
+ QuestLevel = questRecord[5].GetInt32();
+ Type = questRecord[6].GetUInt32();
+ RequiredClasses = questRecord[7].GetUInt32();
RequiredRaces = questRecord[8].GetUInt32();
- RequiredSkillValue = questRecord[9].GetUInt32();
- RepObjectiveFaction = questRecord[10].GetUInt32();
- RepObjectiveValue = questRecord[11].GetInt32();
- RepObjectiveFaction2 = questRecord[12].GetUInt32();
- RepObjectiveValue2 = questRecord[13].GetInt32();
- RequiredMinRepFaction = questRecord[14].GetUInt32();
- RequiredMinRepValue = questRecord[15].GetInt32();
- RequiredMaxRepFaction = questRecord[16].GetUInt32();
- RequiredMaxRepValue = questRecord[17].GetInt32();
- SuggestedPlayers = questRecord[18].GetUInt32();
- LimitTime = questRecord[19].GetUInt32();
- QuestFlags = questRecord[20].GetUInt32();
- uint32 SpecialFlags = questRecord[21].GetUInt16();
- CharTitleId = questRecord[22].GetUInt32();
- PlayersSlain = questRecord[23].GetUInt32();
- BonusTalents = questRecord[24].GetUInt32();
- RewArenaPoints = questRecord[25].GetInt32();
- PrevQuestId = questRecord[26].GetInt32();
- NextQuestId = questRecord[27].GetInt32();
- ExclusiveGroup = questRecord[28].GetInt32();
- NextQuestInChain = questRecord[29].GetUInt32();
- XPId = questRecord[30].GetUInt32();
- SrcItemId = questRecord[31].GetUInt32();
- SrcItemCount = questRecord[32].GetUInt32();
- SrcSpell = questRecord[33].GetUInt32();
- Title = questRecord[34].GetString();
- Details = questRecord[35].GetString();
- Objectives = questRecord[36].GetString();
- OfferRewardText = questRecord[37].GetString();
- RequestItemsText = questRecord[38].GetString();
- EndText = questRecord[39].GetString();
- CompletedText = questRecord[40].GetString();
+ RequiredSkill = questRecord[9].GetUInt32();
+ RequiredSkillValue = questRecord[10].GetUInt32();
+ RepObjectiveFaction = questRecord[11].GetUInt32();
+ RepObjectiveValue = questRecord[12].GetInt32();
+ RepObjectiveFaction2 = questRecord[13].GetUInt32();
+ RepObjectiveValue2 = questRecord[14].GetInt32();
+ RequiredMinRepFaction = questRecord[15].GetUInt32();
+ RequiredMinRepValue = questRecord[16].GetInt32();
+ RequiredMaxRepFaction = questRecord[17].GetUInt32();
+ RequiredMaxRepValue = questRecord[18].GetInt32();
+ SuggestedPlayers = questRecord[19].GetUInt32();
+ LimitTime = questRecord[20].GetUInt32();
+ QuestFlags = questRecord[21].GetUInt32();
+ uint32 SpecialFlags = questRecord[22].GetUInt16();
+ CharTitleId = questRecord[23].GetUInt32();
+ PlayersSlain = questRecord[24].GetUInt32();
+ BonusTalents = questRecord[25].GetUInt32();
+ RewArenaPoints = questRecord[26].GetInt32();
+ PrevQuestId = questRecord[27].GetInt32();
+ NextQuestId = questRecord[28].GetInt32();
+ ExclusiveGroup = questRecord[29].GetInt32();
+ NextQuestInChain = questRecord[30].GetUInt32();
+ XPId = questRecord[31].GetUInt32();
+ SrcItemId = questRecord[32].GetUInt32();
+ SrcItemCount = questRecord[33].GetUInt32();
+ SrcSpell = questRecord[34].GetUInt32();
+ Title = questRecord[35].GetString();
+ Details = questRecord[36].GetString();
+ Objectives = questRecord[37].GetString();
+ OfferRewardText = questRecord[38].GetString();
+ RequestItemsText = questRecord[39].GetString();
+ EndText = questRecord[40].GetString();
+ CompletedText = questRecord[41].GetString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ObjectiveText[i] = questRecord[41+i].GetString();
+ ObjectiveText[i] = questRecord[42+i].GetString();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- ReqItemId[i] = questRecord[45+i].GetUInt32();
+ ReqItemId[i] = questRecord[46+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- ReqItemCount[i] = questRecord[51+i].GetUInt32();
+ ReqItemCount[i] = questRecord[52+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- ReqSourceId[i] = questRecord[57+i].GetUInt32();
+ ReqSourceId[i] = questRecord[58+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- ReqSourceCount[i] = questRecord[61+i].GetUInt32();
+ ReqSourceCount[i] = questRecord[62+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ReqCreatureOrGOId[i] = questRecord[65+i].GetInt32();
+ ReqCreatureOrGOId[i] = questRecord[66+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ReqCreatureOrGOCount[i] = questRecord[69+i].GetUInt32();
+ ReqCreatureOrGOCount[i] = questRecord[70+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ReqSpell[i] = questRecord[73+i].GetUInt32();
+ ReqSpell[i] = questRecord[74+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewChoiceItemId[i] = questRecord[77+i].GetUInt32();
+ RewChoiceItemId[i] = questRecord[78+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewChoiceItemCount[i] = questRecord[83+i].GetUInt32();
+ RewChoiceItemCount[i] = questRecord[84+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewItemId[i] = questRecord[89+i].GetUInt32();
+ RewItemId[i] = questRecord[90+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewItemCount[i] = questRecord[93+i].GetUInt32();
+ RewItemCount[i] = questRecord[94+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewRepFaction[i] = questRecord[97+i].GetUInt32();
+ RewRepFaction[i] = questRecord[98+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewRepValueId[i] = questRecord[102+i].GetInt32();
+ RewRepValueId[i] = questRecord[103+i].GetInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewRepValue[i] = questRecord[107+i].GetInt32();
-
- RewHonorAddition = questRecord[112].GetUInt32();
- RewHonorMultiplier = questRecord[113].GetFloat();
- RewOrReqMoney = questRecord[114].GetInt32();
- RewMoneyMaxLevel = questRecord[115].GetUInt32();
- RewSpell = questRecord[116].GetUInt32();
- RewSpellCast = questRecord[117].GetInt32();
- RewMailTemplateId = questRecord[118].GetUInt32();
- RewMailDelaySecs = questRecord[119].GetUInt32();
- PointMapId = questRecord[120].GetUInt32();
- PointX = questRecord[121].GetFloat();
- PointY = questRecord[122].GetFloat();
- PointOpt = questRecord[123].GetUInt32();
+ RewRepValue[i] = questRecord[108+i].GetInt32();
+
+ RewHonorAddition = questRecord[113].GetUInt32();
+ RewHonorMultiplier = questRecord[114].GetFloat();
+ RewOrReqMoney = questRecord[115].GetInt32();
+ RewMoneyMaxLevel = questRecord[116].GetUInt32();
+ RewSpell = questRecord[117].GetUInt32();
+ RewSpellCast = questRecord[118].GetInt32();
+ RewMailTemplateId = questRecord[119].GetUInt32();
+ RewMailDelaySecs = questRecord[120].GetUInt32();
+ PointMapId = questRecord[121].GetUInt32();
+ PointX = questRecord[122].GetFloat();
+ PointY = questRecord[123].GetFloat();
+ PointOpt = questRecord[124].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmote[i] = questRecord[124+i].GetUInt32();
+ DetailsEmote[i] = questRecord[125+i].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmoteDelay[i] = questRecord[128+i].GetUInt32();
+ DetailsEmoteDelay[i] = questRecord[129+i].GetUInt32();
- IncompleteEmote = questRecord[132].GetUInt32();
- CompleteEmote = questRecord[133].GetUInt32();
+ IncompleteEmote = questRecord[133].GetUInt32();
+ CompleteEmote = questRecord[134].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmote[i] = questRecord[134+i].GetInt32();
+ OfferRewardEmote[i] = questRecord[135+i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmoteDelay[i] = questRecord[138+i].GetInt32();
+ OfferRewardEmoteDelay[i] = questRecord[139+i].GetInt32();
- QuestStartScript = questRecord[142].GetUInt32();
- QuestCompleteScript = questRecord[143].GetUInt32();
+ QuestStartScript = questRecord[143].GetUInt32();
+ QuestCompleteScript = questRecord[144].GetUInt32();
QuestFlags |= SpecialFlags << 20;
if (QuestFlags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 90e52660160..895b87f4465 100755
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -192,12 +192,13 @@ class Quest
uint32 GetQuestId() const { return QuestId; }
uint32 GetQuestMethod() const { return QuestMethod; }
int32 GetZoneOrSort() const { return ZoneOrSort; }
- int32 GetSkillOrClassMask() const { return SkillOrClassMask; }
uint32 GetMinLevel() const { return MinLevel; }
uint32 GetMaxLevel() const { return MaxLevel; }
uint32 GetQuestLevel() const { return QuestLevel; }
uint32 GetType() const { return Type; }
+ uint32 GetRequiredClasses() const { return RequiredClasses; }
uint32 GetRequiredRaces() const { return RequiredRaces; }
+ uint32 GetRequiredSkill() const { return RequiredSkill; }
uint32 GetRequiredSkillValue() const { return RequiredSkillValue; }
uint32 GetRepObjectiveFaction() const { return RepObjectiveFaction; }
int32 GetRepObjectiveValue() const { return RepObjectiveValue; }
@@ -300,12 +301,13 @@ class Quest
uint32 QuestId;
uint32 QuestMethod;
int32 ZoneOrSort;
- int32 SkillOrClassMask;
uint32 MinLevel;
uint32 MaxLevel;
int32 QuestLevel;
uint32 Type;
+ uint32 RequiredClasses;
uint32 RequiredRaces;
+ uint32 RequiredSkill;
uint32 RequiredSkillValue;
uint32 RepObjectiveFaction;
int32 RepObjectiveValue;
diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
index 1037bf1e9f2..83b9ab048ad 100755
--- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
@@ -658,7 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login
// Player created, save it now
- newChar.SaveToDB();
+ newChar.SaveToDB(true);
createInfo->CharCount += 1;
SQLTransaction trans = LoginDatabase.BeginTransaction();
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 816dc25f1b3..f93c4a70d7c 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -300,4 +300,20 @@ void CharacterDatabaseConnection::DoPrepareStatements()
// For loading and deleting expired auctions at startup
PREPARE_STATEMENT(CHAR_LOAD_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH)
+ // Player saving
+ PREPARE_STATEMENT(CHAR_ADD_CHARACTER, "INSERT INTO characters (guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
+ "map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, "
+ "taximask, cinematic, "
+ "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, "
+ "extra_flags, stable_slots, at_login, zone, "
+ "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
+ "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
+ "power4, power5, power6, power7, latency, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,playerBytes=?,playerBytes2=?,playerFlags=?,"
+ "map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,"
+ "logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?,"
+ "arenaPoints=?,totalHonorPoints=?,todayHonorPoints=?,yesterdayHonorPoints=?,totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,knownCurrencies=?,"
+ "watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,power7=?,latency=?,speccount=?,activespec=?,exploredZones=?,"
+ "equipmentCache=?,ammoId=?,knownTitles=?,actionBars=?,grantableLevels=?,online=? WHERE guid=?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index dd752914138..f06a17aa924 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -275,6 +275,9 @@ enum CharacterDatabaseStatements
CHAR_LOAD_EXPIRED_AUCTIONS,
+ CHAR_ADD_CHARACTER,
+ CHAR_UPD_CHARACTER,
+
MAX_CHARACTERDATABASE_STATEMENTS,
};