Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.x

This commit is contained in:
Machiavelli
2011-11-25 15:14:38 +01:00
10 changed files with 427 additions and 308 deletions
@@ -0,0 +1,38 @@
ALTER TABLE `quest_template` ADD COLUMN `RequiredClasses` smallint(5) unsigned NOT NULL default '0' AFTER `Type`;
UPDATE `quest_template`
SET `RequiredClasses` = `RequiredClasses`|
CASE `SkillOrClassMask`
WHEN -1 THEN 1 -- warrior
WHEN -2 THEN 2 -- paladin
WHEN -3 THEN 4 -- hunter
WHEN -4 THEN 8 -- rogue
WHEN -5 THEN 16 -- priest
WHEN -6 THEN 32 -- dk
WHEN -7 THEN 64 -- shaman
WHEN -8 THEN 128 -- mage
WHEN -9 THEN 256 -- warlock
WHEN -11 THEN 1024 -- druid
ELSE 0
END
WHERE `SkillOrClassMask` < 0;
UPDATE `quest_template`
SET `RequiredClasses` = `RequiredClasses`|
CASE `ZoneOrSort`
WHEN -81 THEN 1 -- warrior
WHEN -141 THEN 2 -- paladin
WHEN -261 THEN 4 -- hunter
WHEN -162 THEN 8 -- rogue
WHEN -262 THEN 16 -- priest
WHEN -372 THEN 32 -- dk
WHEN -82 THEN 64 -- shaman
WHEN -161 THEN 128 -- mage
WHEN -61 THEN 256 -- warlock
WHEN -263 THEN 1024 -- druid
ELSE 0
END
WHERE `ZoneOrSort` < 0;
UPDATE `quest_template` SET `SkillOrClassMask`=0 WHERE `SkillOrClassMask`<0;
ALTER TABLE `quest_template` CHANGE COLUMN `SkillOrClassMask` `RequiredSkill` smallint(5) unsigned NOT NULL default '0' AFTER `RequiredRaces`;
@@ -0,0 +1 @@
UPDATE `quest_template` SET `RequiredClasses`=0 WHERE `entry`=8249; -- Junkboxes Needed
+245 -179
View File
@@ -280,10 +280,8 @@ uint32 PlayerTaxi::GetCurrentTaxiPath() const
std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi) std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
{ {
ss << '\'';
for (uint8 i = 0; i < TaxiMaskSize; ++i) for (uint8 i = 0; i < TaxiMaskSize; ++i)
ss << taxi.m_taximask[i] << ' '; ss << taxi.m_taximask[i] << ' ';
ss << '\'';
return ss; return ss;
} }
@@ -14694,7 +14692,7 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
bool Player::CanSeeStartQuest(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) && SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) && SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) && SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
@@ -14709,8 +14707,8 @@ bool Player::CanSeeStartQuest(Quest const* quest)
bool Player::CanTakeQuest(Quest const* quest, bool msg) bool Player::CanTakeQuest(Quest const* quest, bool msg)
{ {
return SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg) return SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
&& SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg) && SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
&& SatisfyQuestSkillOrClass(quest, msg) && SatisfyQuestReputation(quest, msg) && SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
&& SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg) && SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg) && SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg) && SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
@@ -15241,47 +15239,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(); uint32 skill = qInfo->GetRequiredSkill();
int32 skillOrClassMask = qInfo->GetSkillOrClassMask();
// skip zone zoneOrSort and 0 case skillOrClass // skip 0 case RequiredSkill
if (zoneOrSort >= 0 && skillOrClassMask == 0) if (skill == 0)
return true; return true;
int32 questSort = -zoneOrSort; // check skill value
uint8 reqSortClass = ClassByQuestSort(questSort); if (GetSkillValue(skill) < qInfo->GetRequiredSkillValue())
// check class sort cases in zoneOrSort
if (reqSortClass != 0 && getClass() != reqSortClass)
{ {
if (msg) if (msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
return false;
}
// check class return false;
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 true; return true;
@@ -15409,6 +15381,24 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
return false; 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) bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg)
{ {
uint32 reqraces = qInfo->GetRequiredRaces(); uint32 reqraces = qInfo->GetRequiredRaces();
@@ -16380,7 +16370,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); WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4);
data << uint32(msg); data << uint32(msg);
@@ -18443,7 +18433,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
/*** SAVE SYSTEM ***/ /*** SAVE SYSTEM ***/
/*********************************************************/ /*********************************************************/
void Player::SaveToDB() void Player::SaveToDB(bool create /*=false*/)
{ {
// delay auto save at any saves (manual, in code, or autosave) // delay auto save at any saves (manual, in code, or autosave)
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
@@ -18461,156 +18451,232 @@ void Player::SaveToDB()
sLog->outDebug(LOG_FILTER_UNITS, "The value of player %s at save: ", m_name.c_str()); sLog->outDebug(LOG_FILTER_UNITS, "The value of player %s at save: ", m_name.c_str());
outDebugValues(); outDebugValues();
std::string sql_name = m_name; PreparedStatement* stmt = NULL;
CharacterDatabase.EscapeString(sql_name); uint16 index = 0;
std::ostringstream ss; if (create)
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() << ',' //! Insert query
<< (uint32)GetInstanceId() << ',' //! TO DO: Filter out more redundant fields that can take their default value at player create
<< uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ',' stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHARACTER);
<< finiteAlways(GetPositionX()) << ',' stmt->setUInt32(index++, GetGUIDLow());
<< finiteAlways(GetPositionY()) << ',' stmt->setUInt32(index++, GetSession()->GetAccountId());
<< finiteAlways(GetPositionZ()) << ',' stmt->setString(index++, GetName());
<< finiteAlways(GetOrientation()) << ','; 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 ";
}
stmt->setString(index++, ss.str());
stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
ss.str().clear();
for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i);
stmt->setString(index++, ss.str());
stmt->setUInt8(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
stmt->setUInt32(index++, m_grantableLevels);
} }
else else
{ {
ss << GetTeleportDest().GetMapId() << ',' // Update query
<< (uint32)0 << ',' stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER);
<< uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ',' stmt->setString(index++, GetName());
<< finiteAlways(GetTeleportDest().GetPositionX()) << ',' stmt->setUInt8(index++, getRace());
<< finiteAlways(GetTeleportDest().GetPositionY()) << ',' stmt->setUInt8(index++, getClass());
<< finiteAlways(GetTeleportDest().GetPositionZ()) << ',' stmt->setUInt8(index++, getGender());
<< finiteAlways(GetTeleportDest().GetOrientation()) << ','; 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));
ss << m_taxi << ','; // string with TaxiMaskSize numbers if (!IsBeingTeleported())
{
ss << (IsInWorld() ? 1 : 0) << ','; stmt->setUInt16(index++, (uint16)GetMapId());
stmt->setUInt32(index++, (uint32)GetInstanceId());
ss << uint32(m_cinematic) << ','; stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
stmt->setFloat(index++, finiteAlways(GetPositionX()));
ss << m_Played_time[PLAYED_TIME_TOTAL] << ','; stmt->setFloat(index++, finiteAlways(GetPositionY()));
ss << m_Played_time[PLAYED_TIME_LEVEL] << ','; stmt->setFloat(index++, finiteAlways(GetPositionZ()));
stmt->setFloat(index++, finiteAlways(GetOrientation()));
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 << 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();
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();
else 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 ";
}
stmt->setString(index++, ss.str());
stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
ss.str().clear();
for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i);
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());
} }
ss << "',";
ss << GetUInt32Value(PLAYER_AMMO_ID) << ", '";
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 << ')';
SQLTransaction trans = CharacterDatabase.BeginTransaction(); SQLTransaction trans = CharacterDatabase.BeginTransaction();
trans->Append(ss.str().c_str()); trans->Append(stmt);
if (m_mailsUpdated) //save mails only when needed if (m_mailsUpdated) //save mails only when needed
_SaveMail(trans); _SaveMail(trans);
+4 -3
View File
@@ -1433,10 +1433,11 @@ class Player : public Unit, public GridObject<Player>
void IncompleteQuest(uint32 quest_id); void IncompleteQuest(uint32 quest_id);
void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true); void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true);
void FailQuest(uint32 quest_id); 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 SatisfyQuestLevel(Quest const* qInfo, bool msg);
bool SatisfyQuestLog(bool msg); bool SatisfyQuestLog(bool msg);
bool SatisfyQuestPreviousQuest(Quest const* qInfo, 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 SatisfyQuestRace(Quest const* qInfo, bool msg);
bool SatisfyQuestReputation(Quest const* qInfo, bool msg); bool SatisfyQuestReputation(Quest const* qInfo, bool msg);
bool SatisfyQuestStatus(Quest const* qInfo, bool msg); bool SatisfyQuestStatus(Quest const* qInfo, bool msg);
@@ -1516,7 +1517,7 @@ class Player : public Unit, public GridObject<Player>
void SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver); void SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver);
void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK); void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK);
void SendQuestTimerFailed(uint32 quest_id); void SendQuestTimerFailed(uint32 quest_id);
void SendCanTakeQuestResponse(uint32 msg); void SendCanTakeQuestResponse(uint32 msg) const;
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver); void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendPushToPartyResponse(Player* player, uint32 msg); void SendPushToPartyResponse(Player* player, uint32 msg);
void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count); void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count);
@@ -1553,7 +1554,7 @@ class Player : public Unit, public GridObject<Player>
/*** SAVE SYSTEM ***/ /*** SAVE SYSTEM ***/
/*********************************************************/ /*********************************************************/
void SaveToDB(); void SaveToDB(bool create = false);
void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing
void SaveGoldToDB(SQLTransaction& trans); void SaveGoldToDB(SQLTransaction& trans);
+42 -51
View File
@@ -3693,41 +3693,41 @@ void ObjectMgr::LoadQuests()
mExclusiveQuestGroups.clear(); mExclusiveQuestGroups.clear();
// 0 1 2 3 4 5 6 7 8 9 // 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClassMask, MinLevel, MaxLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue, " QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, MinLevel, MaxLevel, QuestLevel, Type, RequiredClasses, RequiredRaces, RequiredSkill, RequiredSkillValue, "
// 10 11 12 13 14 15 16 17 18 19 // 11 12 13 14 15 16 17 18 19 20
"RepObjectiveFaction, RepObjectiveValue, RepObjectiveFaction2, RepObjectiveValue2, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime, " "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, " "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, " "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, " "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, " "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, " "ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4, "
// 73 74 75 76 // 74 75 76 77
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4, " "ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4, "
// 77 78 79 80 81 82 // 78 79 80 81 82 83
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6, " "RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6, "
// 83 84 85 86 87 88 // 84 85 86 87 88 89
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6, " "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, " "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, " "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, " "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, " "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, " "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, " "IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, "
// 138 139 140 141 // 139 140 141 142
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, " "OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, "
// 142 143 // 143 144
"StartScript, CompleteScript" "StartScript, CompleteScript"
" FROM quest_template"); " FROM quest_template");
if (!result) if (!result)
@@ -3831,45 +3831,43 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(), qinfo->ZoneOrSort); 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) // 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). //check for proper RequiredSkill value (skill 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)
if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
{ {
// skill is positive value in SkillOrClass if (qinfo->RequiredSkill != skill_id)
if (qinfo->SkillOrClassMask != 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); qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id);
//override, and force proper value here? //override, and force proper value here?
} }
} }
} }
// SkillOrClassMask (class case) // RequiredClasses, can be 0/CLASSMASK_ALL_PLAYABLE to allow any class
if (qinfo->SkillOrClassMask < 0) 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", sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
qinfo->GetQuestId(), qinfo->SkillOrClassMask); qinfo->RequiredClasses = 0;
} }
} }
// SkillOrClassMask (skill case) // RequiredRaces, can be 0/RACEMASK_ALL_PLAYABLE to allow any race
if (qinfo->SkillOrClassMask > 0) if (qinfo->RequiredRaces)
{
if (!sSkillLineStore.LookupEntry(qinfo->SkillOrClassMask))
{ {
sLog->outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist", if (!(qinfo->RequiredRaces & RACEMASK_ALL_PLAYABLE))
qinfo->GetQuestId(), qinfo->SkillOrClassMask, qinfo->SkillOrClassMask); {
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->RequiredSkill))
{
sLog->outErrorDb("Quest %u has `RequiredSkill` = %u but this skill does not exist",
qinfo->GetQuestId(), qinfo->RequiredSkill);
} }
} }
@@ -3881,13 +3879,6 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(), qinfo->RequiredSkillValue, sWorld->GetConfigMaxSkillValue()); qinfo->GetQuestId(), qinfo->RequiredSkillValue, sWorld->GetConfigMaxSkillValue());
// no changes, quest can't be done for this requirement // 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 // else Skill quests can have 0 skill level, this is ok
+73 -72
View File
@@ -25,120 +25,121 @@ Quest::Quest(Field* questRecord)
QuestId = questRecord[0].GetUInt32(); QuestId = questRecord[0].GetUInt32();
QuestMethod = questRecord[1].GetUInt32(); QuestMethod = questRecord[1].GetUInt32();
ZoneOrSort = questRecord[2].GetInt32(); ZoneOrSort = questRecord[2].GetInt32();
SkillOrClassMask = questRecord[3].GetInt32(); MinLevel = questRecord[3].GetUInt32();
MinLevel = questRecord[4].GetUInt32(); MaxLevel = questRecord[4].GetUInt32();
MaxLevel = questRecord[5].GetUInt32(); QuestLevel = questRecord[5].GetInt32();
QuestLevel = questRecord[6].GetInt32(); Type = questRecord[6].GetUInt32();
Type = questRecord[7].GetUInt32(); RequiredClasses = questRecord[7].GetUInt32();
RequiredRaces = questRecord[8].GetUInt32(); RequiredRaces = questRecord[8].GetUInt32();
RequiredSkillValue = questRecord[9].GetUInt32(); RequiredSkill = questRecord[9].GetUInt32();
RepObjectiveFaction = questRecord[10].GetUInt32(); RequiredSkillValue = questRecord[10].GetUInt32();
RepObjectiveValue = questRecord[11].GetInt32(); RepObjectiveFaction = questRecord[11].GetUInt32();
RepObjectiveFaction2 = questRecord[12].GetUInt32(); RepObjectiveValue = questRecord[12].GetInt32();
RepObjectiveValue2 = questRecord[13].GetInt32(); RepObjectiveFaction2 = questRecord[13].GetUInt32();
RequiredMinRepFaction = questRecord[14].GetUInt32(); RepObjectiveValue2 = questRecord[14].GetInt32();
RequiredMinRepValue = questRecord[15].GetInt32(); RequiredMinRepFaction = questRecord[15].GetUInt32();
RequiredMaxRepFaction = questRecord[16].GetUInt32(); RequiredMinRepValue = questRecord[16].GetInt32();
RequiredMaxRepValue = questRecord[17].GetInt32(); RequiredMaxRepFaction = questRecord[17].GetUInt32();
SuggestedPlayers = questRecord[18].GetUInt32(); RequiredMaxRepValue = questRecord[18].GetInt32();
LimitTime = questRecord[19].GetUInt32(); SuggestedPlayers = questRecord[19].GetUInt32();
QuestFlags = questRecord[20].GetUInt32(); LimitTime = questRecord[20].GetUInt32();
uint32 SpecialFlags = questRecord[21].GetUInt16(); QuestFlags = questRecord[21].GetUInt32();
CharTitleId = questRecord[22].GetUInt32(); uint32 SpecialFlags = questRecord[22].GetUInt16();
PlayersSlain = questRecord[23].GetUInt32(); CharTitleId = questRecord[23].GetUInt32();
BonusTalents = questRecord[24].GetUInt32(); PlayersSlain = questRecord[24].GetUInt32();
RewArenaPoints = questRecord[25].GetInt32(); BonusTalents = questRecord[25].GetUInt32();
PrevQuestId = questRecord[26].GetInt32(); RewArenaPoints = questRecord[26].GetInt32();
NextQuestId = questRecord[27].GetInt32(); PrevQuestId = questRecord[27].GetInt32();
ExclusiveGroup = questRecord[28].GetInt32(); NextQuestId = questRecord[28].GetInt32();
NextQuestInChain = questRecord[29].GetUInt32(); ExclusiveGroup = questRecord[29].GetInt32();
XPId = questRecord[30].GetUInt32(); NextQuestInChain = questRecord[30].GetUInt32();
SrcItemId = questRecord[31].GetUInt32(); XPId = questRecord[31].GetUInt32();
SrcItemCount = questRecord[32].GetUInt32(); SrcItemId = questRecord[32].GetUInt32();
SrcSpell = questRecord[33].GetUInt32(); SrcItemCount = questRecord[33].GetUInt32();
Title = questRecord[34].GetString(); SrcSpell = questRecord[34].GetUInt32();
Details = questRecord[35].GetString(); Title = questRecord[35].GetString();
Objectives = questRecord[36].GetString(); Details = questRecord[36].GetString();
OfferRewardText = questRecord[37].GetString(); Objectives = questRecord[37].GetString();
RequestItemsText = questRecord[38].GetString(); OfferRewardText = questRecord[38].GetString();
EndText = questRecord[39].GetString(); RequestItemsText = questRecord[39].GetString();
CompletedText = questRecord[40].GetString(); EndText = questRecord[40].GetString();
CompletedText = questRecord[41].GetString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[107+i].GetInt32(); RewRepValue[i] = questRecord[108+i].GetInt32();
RewHonorAddition = questRecord[112].GetUInt32(); RewHonorAddition = questRecord[113].GetUInt32();
RewHonorMultiplier = questRecord[113].GetFloat(); RewHonorMultiplier = questRecord[114].GetFloat();
RewOrReqMoney = questRecord[114].GetInt32(); RewOrReqMoney = questRecord[115].GetInt32();
RewMoneyMaxLevel = questRecord[115].GetUInt32(); RewMoneyMaxLevel = questRecord[116].GetUInt32();
RewSpell = questRecord[116].GetUInt32(); RewSpell = questRecord[117].GetUInt32();
RewSpellCast = questRecord[117].GetInt32(); RewSpellCast = questRecord[118].GetInt32();
RewMailTemplateId = questRecord[118].GetUInt32(); RewMailTemplateId = questRecord[119].GetUInt32();
RewMailDelaySecs = questRecord[119].GetUInt32(); RewMailDelaySecs = questRecord[120].GetUInt32();
PointMapId = questRecord[120].GetUInt32(); PointMapId = questRecord[121].GetUInt32();
PointX = questRecord[121].GetFloat(); PointX = questRecord[122].GetFloat();
PointY = questRecord[122].GetFloat(); PointY = questRecord[123].GetFloat();
PointOpt = questRecord[123].GetUInt32(); PointOpt = questRecord[124].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) 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) 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(); IncompleteEmote = questRecord[133].GetUInt32();
CompleteEmote = questRecord[133].GetUInt32(); CompleteEmote = questRecord[134].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) 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) 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(); QuestStartScript = questRecord[143].GetUInt32();
QuestCompleteScript = questRecord[143].GetUInt32(); QuestCompleteScript = questRecord[144].GetUInt32();
QuestFlags |= SpecialFlags << 20; QuestFlags |= SpecialFlags << 20;
if (QuestFlags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT) if (QuestFlags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
+4 -2
View File
@@ -192,12 +192,13 @@ class Quest
uint32 GetQuestId() const { return QuestId; } uint32 GetQuestId() const { return QuestId; }
uint32 GetQuestMethod() const { return QuestMethod; } uint32 GetQuestMethod() const { return QuestMethod; }
int32 GetZoneOrSort() const { return ZoneOrSort; } int32 GetZoneOrSort() const { return ZoneOrSort; }
int32 GetSkillOrClassMask() const { return SkillOrClassMask; }
uint32 GetMinLevel() const { return MinLevel; } uint32 GetMinLevel() const { return MinLevel; }
uint32 GetMaxLevel() const { return MaxLevel; } uint32 GetMaxLevel() const { return MaxLevel; }
uint32 GetQuestLevel() const { return QuestLevel; } uint32 GetQuestLevel() const { return QuestLevel; }
uint32 GetType() const { return Type; } uint32 GetType() const { return Type; }
uint32 GetRequiredClasses() const { return RequiredClasses; }
uint32 GetRequiredRaces() const { return RequiredRaces; } uint32 GetRequiredRaces() const { return RequiredRaces; }
uint32 GetRequiredSkill() const { return RequiredSkill; }
uint32 GetRequiredSkillValue() const { return RequiredSkillValue; } uint32 GetRequiredSkillValue() const { return RequiredSkillValue; }
uint32 GetRepObjectiveFaction() const { return RepObjectiveFaction; } uint32 GetRepObjectiveFaction() const { return RepObjectiveFaction; }
int32 GetRepObjectiveValue() const { return RepObjectiveValue; } int32 GetRepObjectiveValue() const { return RepObjectiveValue; }
@@ -300,12 +301,13 @@ class Quest
uint32 QuestId; uint32 QuestId;
uint32 QuestMethod; uint32 QuestMethod;
int32 ZoneOrSort; int32 ZoneOrSort;
int32 SkillOrClassMask;
uint32 MinLevel; uint32 MinLevel;
uint32 MaxLevel; uint32 MaxLevel;
int32 QuestLevel; int32 QuestLevel;
uint32 Type; uint32 Type;
uint32 RequiredClasses;
uint32 RequiredRaces; uint32 RequiredRaces;
uint32 RequiredSkill;
uint32 RequiredSkillValue; uint32 RequiredSkillValue;
uint32 RepObjectiveFaction; uint32 RepObjectiveFaction;
int32 RepObjectiveValue; int32 RepObjectiveValue;
@@ -729,7 +729,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login
// Player created, save it now // Player created, save it now
newChar.SaveToDB(); newChar.SaveToDB(true);
createInfo->CharCount += 1; createInfo->CharCount += 1;
SQLTransaction trans = LoginDatabase.BeginTransaction(); SQLTransaction trans = LoginDatabase.BeginTransaction();
@@ -300,4 +300,20 @@ void CharacterDatabaseConnection::DoPrepareStatements()
// For loading and deleting expired auctions at startup // 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) 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);
} }
@@ -275,6 +275,9 @@ enum CharacterDatabaseStatements
CHAR_LOAD_EXPIRED_AUCTIONS, CHAR_LOAD_EXPIRED_AUCTIONS,
CHAR_ADD_CHARACTER,
CHAR_UPD_CHARACTER,
MAX_CHARACTERDATABASE_STATEMENTS, MAX_CHARACTERDATABASE_STATEMENTS,
}; };