Merge branch 'master' into 330

This commit is contained in:
VladimirMangos 2010-04-07 06:58:42 +04:00
commit 6bcbbc321b
23 changed files with 574 additions and 196 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_9661_01_characters_character_talent` bit(1) default NULL `required_9687_01_characters_character_queststatus_daily` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --
@ -702,7 +702,6 @@ DROP TABLE IF EXISTS `character_queststatus_daily`;
CREATE TABLE `character_queststatus_daily` ( CREATE TABLE `character_queststatus_daily` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier', `quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier',
`time` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`quest`), PRIMARY KEY (`guid`,`quest`),
KEY `idx_guid` (`guid`) KEY `idx_guid` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';
@ -716,6 +715,27 @@ LOCK TABLES `character_queststatus_daily` WRITE;
/*!40000 ALTER TABLE `character_queststatus_daily` ENABLE KEYS */; /*!40000 ALTER TABLE `character_queststatus_daily` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `character_queststatus_weekly`
--
DROP TABLE IF EXISTS `character_queststatus_weekly`;
CREATE TABLE `character_queststatus_weekly` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier',
PRIMARY KEY (`guid`,`quest`),
KEY `idx_guid` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';
--
-- Dumping data for table `character_queststatus_weekly`
--
LOCK TABLES `character_queststatus_weekly` WRITE;
/*!40000 ALTER TABLE `character_queststatus_weekly` DISABLE KEYS */;
/*!40000 ALTER TABLE `character_queststatus_weekly` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `character_reputation` -- Table structure for table `character_reputation`
-- --
@ -830,6 +850,55 @@ LOCK TABLES `character_spell_cooldown` WRITE;
/*!40000 ALTER TABLE `character_spell_cooldown` ENABLE KEYS */; /*!40000 ALTER TABLE `character_spell_cooldown` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `character_stats`
--
DROP TABLE IF EXISTS `character_stats`;
CREATE TABLE `character_stats` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier, Low part',
`maxhealth` int(10) UNSIGNED NOT NULL default '0',
`maxpower1` int(10) UNSIGNED NOT NULL default '0',
`maxpower2` int(10) UNSIGNED NOT NULL default '0',
`maxpower3` int(10) UNSIGNED NOT NULL default '0',
`maxpower4` int(10) UNSIGNED NOT NULL default '0',
`maxpower5` int(10) UNSIGNED NOT NULL default '0',
`maxpower6` int(10) UNSIGNED NOT NULL default '0',
`maxpower7` int(10) UNSIGNED NOT NULL default '0',
`strength` int(10) UNSIGNED NOT NULL default '0',
`agility` int(10) UNSIGNED NOT NULL default '0',
`stamina` int(10) UNSIGNED NOT NULL default '0',
`intellect` int(10) UNSIGNED NOT NULL default '0',
`spirit` int(10) UNSIGNED NOT NULL default '0',
`armor` int(10) UNSIGNED NOT NULL default '0',
`resHoly` int(10) UNSIGNED NOT NULL default '0',
`resFire` int(10) UNSIGNED NOT NULL default '0',
`resNature` int(10) UNSIGNED NOT NULL default '0',
`resFrost` int(10) UNSIGNED NOT NULL default '0',
`resShadow` int(10) UNSIGNED NOT NULL default '0',
`resArcane` int(10) UNSIGNED NOT NULL default '0',
`blockPct` float UNSIGNED NOT NULL default '0',
`dodgePct` float UNSIGNED NOT NULL default '0',
`parryPct` float UNSIGNED NOT NULL default '0',
`critPct` float UNSIGNED NOT NULL default '0',
`rangedCritPct` float UNSIGNED NOT NULL default '0',
`spellCritPct` float UNSIGNED NOT NULL default '0',
`attackPower` int(10) UNSIGNED NOT NULL default '0',
`rangedAttackPower` int(10) UNSIGNED NOT NULL default '0',
`spellPower` int(10) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `character_stats`
--
LOCK TABLES `character_stats` WRITE;
/*!40000 ALTER TABLE `character_stats` DISABLE KEYS */;
/*!40000 ALTER TABLE `character_stats` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `character_talent` -- Table structure for table `character_talent`
-- --
@ -1512,7 +1581,9 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `saved_variables`; DROP TABLE IF EXISTS `saved_variables`;
CREATE TABLE `saved_variables` ( CREATE TABLE `saved_variables` (
`NextArenaPointDistributionTime` bigint(40) UNSIGNED NOT NULL DEFAULT '0' `NextArenaPointDistributionTime` bigint(40) UNSIGNED NOT NULL DEFAULT '0',
`NextDailyQuestResetTime` bigint(40) unsigned NOT NULL default '0',
`NextWeeklyQuestResetTime` bigint(40) unsigned NOT NULL default '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Variable Saves'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Variable Saves';
-- --

View file

@ -0,0 +1,37 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9661_01_characters_character_talent required_9680_01_characters_character_stats bit;
DROP TABLE IF EXISTS `character_stats`;
CREATE TABLE `character_stats` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier, Low part',
`maxhealth` int(10) UNSIGNED NOT NULL default '0',
`maxpower1` int(10) UNSIGNED NOT NULL default '0',
`maxpower2` int(10) UNSIGNED NOT NULL default '0',
`maxpower3` int(10) UNSIGNED NOT NULL default '0',
`maxpower4` int(10) UNSIGNED NOT NULL default '0',
`maxpower5` int(10) UNSIGNED NOT NULL default '0',
`maxpower6` int(10) UNSIGNED NOT NULL default '0',
`maxpower7` int(10) UNSIGNED NOT NULL default '0',
`strength` int(10) UNSIGNED NOT NULL default '0',
`agility` int(10) UNSIGNED NOT NULL default '0',
`stamina` int(10) UNSIGNED NOT NULL default '0',
`intellect` int(10) UNSIGNED NOT NULL default '0',
`spirit` int(10) UNSIGNED NOT NULL default '0',
`armor` int(10) UNSIGNED NOT NULL default '0',
`resHoly` int(10) UNSIGNED NOT NULL default '0',
`resFire` int(10) UNSIGNED NOT NULL default '0',
`resNature` int(10) UNSIGNED NOT NULL default '0',
`resFrost` int(10) UNSIGNED NOT NULL default '0',
`resShadow` int(10) UNSIGNED NOT NULL default '0',
`resArcane` int(10) UNSIGNED NOT NULL default '0',
`blockPct` float UNSIGNED NOT NULL default '0',
`dodgePct` float UNSIGNED NOT NULL default '0',
`parryPct` float UNSIGNED NOT NULL default '0',
`critPct` float UNSIGNED NOT NULL default '0',
`rangedCritPct` float UNSIGNED NOT NULL default '0',
`spellCritPct` float UNSIGNED NOT NULL default '0',
`attackPower` int(10) UNSIGNED NOT NULL default '0',
`rangedAttackPower` int(10) UNSIGNED NOT NULL default '0',
`spellPower` int(10) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View file

@ -0,0 +1,13 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9680_01_characters_character_stats required_9686_01_characters_character_queststatus_weekly bit;
DROP TABLE IF EXISTS `character_queststatus_weekly`;
CREATE TABLE `character_queststatus_weekly` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier',
PRIMARY KEY (`guid`,`quest`),
KEY `idx_guid` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';
ALTER TABLE `saved_variables`
ADD COLUMN `NextWeeklyQuestResetTime` bigint(40) unsigned NOT NULL default '0' AFTER `NextArenaPointDistributionTime`;

View file

@ -0,0 +1,8 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9686_01_characters_character_queststatus_weekly required_9687_01_characters_character_queststatus_daily bit;
ALTER TABLE `character_queststatus_daily`
DROP COLUMN `time`;
ALTER TABLE `saved_variables`
ADD COLUMN `NextDailyQuestResetTime` bigint(40) unsigned NOT NULL default '0' AFTER `NextArenaPointDistributionTime`;

View file

@ -102,6 +102,9 @@ pkgdata_DATA = \
9656_02_mangos_mangos_string.sql \ 9656_02_mangos_mangos_string.sql \
9661_01_characters_character_talent.sql \ 9661_01_characters_character_talent.sql \
9663_01_mangos_mangos_string.sql \ 9663_01_mangos_mangos_string.sql \
9680_01_characters_character_stats.sql \
9686_01_characters_character_queststatus_weekly.sql \
9687_01_characters_character_queststatus_daily.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -184,4 +187,7 @@ EXTRA_DIST = \
9656_02_mangos_mangos_string.sql \ 9656_02_mangos_mangos_string.sql \
9661_01_characters_character_talent.sql \ 9661_01_characters_character_talent.sql \
9663_01_mangos_mangos_string.sql \ 9663_01_mangos_mangos_string.sql \
9680_01_characters_character_stats.sql \
9686_01_characters_character_queststatus_weekly.sql \
9687_01_characters_character_queststatus_daily.sql \
README README

View file

@ -78,7 +78,8 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS,"SELECT quest FROM character_queststatus_weekly WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT spec,button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT spec,button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid));

View file

@ -3374,7 +3374,7 @@ void ObjectMgr::LoadQuests()
// 138 139 // 138 139
"StartScript, CompleteScript" "StartScript, CompleteScript"
" FROM quest_template"); " FROM quest_template");
if(result == NULL) if (result == NULL)
{ {
barGoLink bar( 1 ); barGoLink bar( 1 );
bar.step(); bar.step();
@ -3410,7 +3410,7 @@ void ObjectMgr::LoadQuests()
// additional quest integrity checks (GO, creature_template and item_template must be loaded already) // additional quest integrity checks (GO, creature_template and item_template must be loaded already)
if( qinfo->GetQuestMethod() >= 3 ) if (qinfo->GetQuestMethod() >= 3)
{ {
sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod()); sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod());
} }
@ -3422,21 +3422,36 @@ void ObjectMgr::LoadQuests()
qinfo->QuestFlags &= QUEST_MANGOS_FLAGS_DB_ALLOWED; qinfo->QuestFlags &= QUEST_MANGOS_FLAGS_DB_ALLOWED;
} }
if(qinfo->QuestFlags & QUEST_FLAGS_DAILY) if (qinfo->QuestFlags & QUEST_FLAGS_DAILY && qinfo->QuestFlags & QUEST_FLAGS_WEEKLY)
{ {
if(!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE)) sLog.outErrorDb("Weekly Quest %u is marked as daily quest in `QuestFlags`, removed daily flag.",qinfo->GetQuestId());
qinfo->QuestFlags &= QUEST_FLAGS_DAILY;
}
if (qinfo->QuestFlags & QUEST_FLAGS_DAILY)
{
if (!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE))
{ {
sLog.outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId()); sLog.outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId());
qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE; qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE;
} }
} }
if(qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED) if (qinfo->QuestFlags & QUEST_FLAGS_WEEKLY)
{
if (!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE))
{
sLog.outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId());
qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE;
}
}
if (qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED)
{ {
// at auto-reward can be rewarded only RewChoiceItemId[0] // at auto-reward can be rewarded only RewChoiceItemId[0]
for(int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j ) for(int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
{ {
if(uint32 id = qinfo->RewChoiceItemId[j]) if (uint32 id = qinfo->RewChoiceItemId[j])
{ {
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item from `RewChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.", sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item from `RewChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.",
qinfo->GetQuestId(),j+1,id,j+1); qinfo->GetQuestId(),j+1,id,j+1);
@ -3446,9 +3461,9 @@ void ObjectMgr::LoadQuests()
} }
// client quest log visual (area case) // client quest log visual (area case)
if( qinfo->ZoneOrSort > 0 ) if (qinfo->ZoneOrSort > 0)
{ {
if(!GetAreaEntryByAreaID(qinfo->ZoneOrSort)) if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort))
{ {
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", sLog.outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.",
qinfo->GetQuestId(),qinfo->ZoneOrSort); qinfo->GetQuestId(),qinfo->ZoneOrSort);
@ -3456,30 +3471,30 @@ void ObjectMgr::LoadQuests()
} }
} }
// client quest log visual (sort case) // client quest log visual (sort case)
if( qinfo->ZoneOrSort < 0 ) if (qinfo->ZoneOrSort < 0)
{ {
QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort));
if( !qSort ) if (!qSort)
{ {
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.",
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 SkillOrClass value (class case).
if( ClassByQuestSort(-int32(qinfo->ZoneOrSort)) ) if (ClassByQuestSort(-int32(qinfo->ZoneOrSort)))
{ {
// SkillOrClass should not have class case when class case already set in ZoneOrSort. // SkillOrClass should not have class case when class case already set in ZoneOrSort.
if(qinfo->SkillOrClass < 0) if (qinfo->SkillOrClass < 0)
{ {
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (class sort case) and `SkillOrClass` = %i (class case), redundant.", sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (class sort case) and `SkillOrClass` = %i (class case), redundant.",
qinfo->GetQuestId(),qinfo->ZoneOrSort,qinfo->SkillOrClass); qinfo->GetQuestId(),qinfo->ZoneOrSort,qinfo->SkillOrClass);
} }
} }
//check for proper SkillOrClass value (skill case) //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 // skill is positive value in SkillOrClass
if(qinfo->SkillOrClass != skill_id ) if (qinfo->SkillOrClass != skill_id )
{ {
sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (skill sort case) but `SkillOrClass` does not have a corresponding value (%i).", sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (skill sort case) but `SkillOrClass` does not have a corresponding value (%i).",
qinfo->GetQuestId(),qinfo->ZoneOrSort,skill_id); qinfo->GetQuestId(),qinfo->ZoneOrSort,skill_id);
@ -3489,34 +3504,34 @@ void ObjectMgr::LoadQuests()
} }
// SkillOrClass (class case) // SkillOrClass (class case)
if( qinfo->SkillOrClass < 0 ) if (qinfo->SkillOrClass < 0)
{ {
if( !sChrClassesStore.LookupEntry(-int32(qinfo->SkillOrClass)) ) if (!sChrClassesStore.LookupEntry(-int32(qinfo->SkillOrClass)))
{ {
sLog.outErrorDb("Quest %u has `SkillOrClass` = %i (class case) but class (%i) does not exist", sLog.outErrorDb("Quest %u has `SkillOrClass` = %i (class case) but class (%i) does not exist",
qinfo->GetQuestId(),qinfo->SkillOrClass,-qinfo->SkillOrClass); qinfo->GetQuestId(),qinfo->SkillOrClass,-qinfo->SkillOrClass);
} }
} }
// SkillOrClass (skill case) // SkillOrClass (skill case)
if( qinfo->SkillOrClass > 0 ) if (qinfo->SkillOrClass > 0)
{ {
if( !sSkillLineStore.LookupEntry(qinfo->SkillOrClass) ) if (!sSkillLineStore.LookupEntry(qinfo->SkillOrClass))
{ {
sLog.outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist", sLog.outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist",
qinfo->GetQuestId(),qinfo->SkillOrClass,qinfo->SkillOrClass); qinfo->GetQuestId(),qinfo->SkillOrClass,qinfo->SkillOrClass);
} }
} }
if( qinfo->RequiredSkillValue ) if (qinfo->RequiredSkillValue)
{ {
if( qinfo->RequiredSkillValue > sWorld.GetConfigMaxSkillValue() ) if (qinfo->RequiredSkillValue > sWorld.GetConfigMaxSkillValue())
{ {
sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but max possible skill is %u, quest can't be done.", sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but max possible skill is %u, quest can't be done.",
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->SkillOrClass <= 0 ) if (qinfo->SkillOrClass <= 0)
{ {
sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but `SkillOrClass` = %i (class case), value ignored.", sLog.outErrorDb("Quest %u has `RequiredSkillValue` = %u but `SkillOrClass` = %i (class case), value ignored.",
qinfo->GetQuestId(),qinfo->RequiredSkillValue,qinfo->SkillOrClass); qinfo->GetQuestId(),qinfo->RequiredSkillValue,qinfo->SkillOrClass);
@ -3525,63 +3540,63 @@ void ObjectMgr::LoadQuests()
} }
// else Skill quests can have 0 skill level, this is ok // else Skill quests can have 0 skill level, this is ok
if(qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction)) if (qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction))
{ {
sLog.outErrorDb("Quest %u has `RepObjectiveFaction` = %u but faction template %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `RepObjectiveFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RepObjectiveFaction,qinfo->RepObjectiveFaction); qinfo->GetQuestId(),qinfo->RepObjectiveFaction,qinfo->RepObjectiveFaction);
// no changes, quest can't be done for this requirement // no changes, quest can't be done for this requirement
} }
if(qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction))
{ {
sLog.outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMinRepFaction,qinfo->RequiredMinRepFaction); qinfo->GetQuestId(),qinfo->RequiredMinRepFaction,qinfo->RequiredMinRepFaction);
// no changes, quest can't be done for this requirement // no changes, quest can't be done for this requirement
} }
if(qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction))
{ {
sLog.outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMaxRepFaction,qinfo->RequiredMaxRepFaction); qinfo->GetQuestId(),qinfo->RequiredMaxRepFaction,qinfo->RequiredMaxRepFaction);
// no changes, quest can't be done for this requirement // no changes, quest can't be done for this requirement
} }
if(qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap) if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap)
{ {
sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMinRepValue,ReputationMgr::Reputation_Cap); qinfo->GetQuestId(),qinfo->RequiredMinRepValue,ReputationMgr::Reputation_Cap);
// no changes, quest can't be done for this requirement // no changes, quest can't be done for this requirement
} }
if(qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue) if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue)
{ {
sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
qinfo->GetQuestId(),qinfo->RequiredMaxRepValue,qinfo->RequiredMinRepValue); qinfo->GetQuestId(),qinfo->RequiredMaxRepValue,qinfo->RequiredMinRepValue);
// no changes, quest can't be done for this requirement // no changes, quest can't be done for this requirement
} }
if(!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue > 0 ) if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue > 0 )
{ {
sLog.outErrorDb("Quest %u has `RepObjectiveValue` = %d but `RepObjectiveFaction` is 0, value has no effect", sLog.outErrorDb("Quest %u has `RepObjectiveValue` = %d but `RepObjectiveFaction` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RepObjectiveValue); qinfo->GetQuestId(),qinfo->RepObjectiveValue);
// warning // warning
} }
if(!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0 ) if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0 )
{ {
sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RequiredMinRepValue); qinfo->GetQuestId(),qinfo->RequiredMinRepValue);
// warning // warning
} }
if(!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue > 0 ) if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue > 0 )
{ {
sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RequiredMaxRepValue); qinfo->GetQuestId(),qinfo->RequiredMaxRepValue);
// warning // warning
} }
if(qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId)) if (qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId))
{ {
sLog.outErrorDb("Quest %u has `CharTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", sLog.outErrorDb("Quest %u has `CharTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
qinfo->GetQuestId(),qinfo->GetCharTitleId(),qinfo->GetCharTitleId()); qinfo->GetQuestId(),qinfo->GetCharTitleId(),qinfo->GetCharTitleId());
@ -3589,38 +3604,38 @@ void ObjectMgr::LoadQuests()
// quest can't reward this title // quest can't reward this title
} }
if(qinfo->SrcItemId) if (qinfo->SrcItemId)
{ {
if(!sItemStorage.LookupEntry<ItemPrototype>(qinfo->SrcItemId)) if (!sItemStorage.LookupEntry<ItemPrototype>(qinfo->SrcItemId))
{ {
sLog.outErrorDb("Quest %u has `SrcItemId` = %u but item with entry %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `SrcItemId` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->SrcItemId,qinfo->SrcItemId); qinfo->GetQuestId(),qinfo->SrcItemId,qinfo->SrcItemId);
qinfo->SrcItemId = 0; // quest can't be done for this requirement qinfo->SrcItemId = 0; // quest can't be done for this requirement
} }
else if(qinfo->SrcItemCount==0) else if (qinfo->SrcItemCount==0)
{ {
sLog.outErrorDb("Quest %u has `SrcItemId` = %u but `SrcItemCount` = 0, set to 1 but need fix in DB.", sLog.outErrorDb("Quest %u has `SrcItemId` = %u but `SrcItemCount` = 0, set to 1 but need fix in DB.",
qinfo->GetQuestId(),qinfo->SrcItemId); qinfo->GetQuestId(),qinfo->SrcItemId);
qinfo->SrcItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB qinfo->SrcItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB
} }
} }
else if(qinfo->SrcItemCount>0) else if (qinfo->SrcItemCount>0)
{ {
sLog.outErrorDb("Quest %u has `SrcItemId` = 0 but `SrcItemCount` = %u, useless value.", sLog.outErrorDb("Quest %u has `SrcItemId` = 0 but `SrcItemCount` = %u, useless value.",
qinfo->GetQuestId(),qinfo->SrcItemCount); qinfo->GetQuestId(),qinfo->SrcItemCount);
qinfo->SrcItemCount=0; // no quest work changes in fact qinfo->SrcItemCount=0; // no quest work changes in fact
} }
if(qinfo->SrcSpell) if (qinfo->SrcSpell)
{ {
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->SrcSpell); SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->SrcSpell);
if(!spellInfo) if (!spellInfo)
{ {
sLog.outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.", sLog.outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell); qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell);
qinfo->SrcSpell = 0; // quest can't be done for this requirement qinfo->SrcSpell = 0; // quest can't be done for this requirement
} }
else if(!SpellMgr::IsSpellValid(spellInfo)) else if (!SpellMgr::IsSpellValid(spellInfo))
{ {
sLog.outErrorDb("Quest %u has `SrcSpell` = %u but spell %u is broken, quest can't be done.", sLog.outErrorDb("Quest %u has `SrcSpell` = %u but spell %u is broken, quest can't be done.",
qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell); qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell);
@ -3630,10 +3645,9 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j ) for(int j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j )
{ {
uint32 id = qinfo->ReqItemId[j]; if (uint32 id = qinfo->ReqItemId[j])
if(id)
{ {
if(qinfo->ReqItemCount[j] == 0) if (qinfo->ReqItemCount[j] == 0)
{ {
sLog.outErrorDb("Quest %u has `ReqItemId%d` = %u but `ReqItemCount%d` = 0, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqItemId%d` = %u but `ReqItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1); qinfo->GetQuestId(), j+1, id, j+1);
@ -3642,14 +3656,14 @@ void ObjectMgr::LoadQuests()
qinfo->SetFlag(QUEST_MANGOS_FLAGS_DELIVER); qinfo->SetFlag(QUEST_MANGOS_FLAGS_DELIVER);
if(!sItemStorage.LookupEntry<ItemPrototype>(id)) if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{ {
sLog.outErrorDb("Quest %u has `ReqItemId%d` = %u but item with entry %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id); qinfo->GetQuestId(), j+1, id, id);
qinfo->ReqItemCount[j] = 0; // prevent incorrect work of quest qinfo->ReqItemCount[j] = 0; // prevent incorrect work of quest
} }
} }
else if(qinfo->ReqItemCount[j] > 0) else if (qinfo->ReqItemCount[j] > 0)
{ {
sLog.outErrorDb("Quest %u has `ReqItemId%d` = 0 but `ReqItemCount%d` = %u, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqItemId%d` = 0 but `ReqItemCount%d` = %u, quest can't be done.",
qinfo->GetQuestId(), j+1, j+1, qinfo->ReqItemCount[j]); qinfo->GetQuestId(), j+1, j+1, qinfo->ReqItemCount[j]);
@ -3659,10 +3673,9 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j ) for(int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j )
{ {
uint32 id = qinfo->ReqSourceId[j]; if (uint32 id = qinfo->ReqSourceId[j])
if(id)
{ {
if(!sItemStorage.LookupEntry<ItemPrototype>(id)) if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{ {
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = %u but item with entry %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqSourceId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,id); qinfo->GetQuestId(),j+1,id,id);
@ -3671,7 +3684,7 @@ void ObjectMgr::LoadQuests()
} }
else else
{ {
if(qinfo->ReqSourceCount[j]>0) if (qinfo->ReqSourceCount[j]>0)
{ {
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = 0 but `ReqSourceCount%d` = %u.", sLog.outErrorDb("Quest %u has `ReqSourceId%d` = 0 but `ReqSourceCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->ReqSourceCount[j]); qinfo->GetQuestId(),j+1,j+1,qinfo->ReqSourceCount[j]);
@ -3682,18 +3695,17 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j ) for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
{ {
uint32 id = qinfo->ReqSpell[j]; if (uint32 id = qinfo->ReqSpell[j])
if(id)
{ {
SpellEntry const* spellInfo = sSpellStore.LookupEntry(id); SpellEntry const* spellInfo = sSpellStore.LookupEntry(id);
if(!spellInfo) if (!spellInfo)
{ {
sLog.outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,id); qinfo->GetQuestId(),j+1,id,id);
continue; continue;
} }
if(!qinfo->ReqCreatureOrGOId[j]) if (!qinfo->ReqCreatureOrGOId[j])
{ {
bool found = false; bool found = false;
for(int k = 0; k < MAX_EFFECT_INDEX; ++k) for(int k = 0; k < MAX_EFFECT_INDEX; ++k)
@ -3706,9 +3718,9 @@ void ObjectMgr::LoadQuests()
} }
} }
if(found) if (found)
{ {
if(!qinfo->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) if (!qinfo->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
{ {
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1); sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1);
@ -3729,34 +3741,34 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j ) for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
{ {
int32 id = qinfo->ReqCreatureOrGOId[j]; int32 id = qinfo->ReqCreatureOrGOId[j];
if(id < 0 && !sGOStorage.LookupEntry<GameObjectInfo>(-id)) if (id < 0 && !sGOStorage.LookupEntry<GameObjectInfo>(-id))
{ {
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but gameobject %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but gameobject %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,uint32(-id)); qinfo->GetQuestId(),j+1,id,uint32(-id));
qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement
} }
if(id > 0 && !sCreatureStorage.LookupEntry<CreatureInfo>(id)) if (id > 0 && !sCreatureStorage.LookupEntry<CreatureInfo>(id))
{ {
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but creature with entry %u does not exist, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but creature with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(),j+1,id,uint32(id)); qinfo->GetQuestId(),j+1,id,uint32(id));
qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement
} }
if(id) if (id)
{ {
// In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast // In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast
qinfo->SetFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO); qinfo->SetFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO);
if(!qinfo->ReqCreatureOrGOCount[j]) if (!qinfo->ReqCreatureOrGOCount[j])
{ {
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %u but `ReqCreatureOrGOCount%d` = 0, quest can't be done.", sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %u but `ReqCreatureOrGOCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,id,j+1); qinfo->GetQuestId(),j+1,id,j+1);
// no changes, quest can be incorrectly done, but we already report this // no changes, quest can be incorrectly done, but we already report this
} }
} }
else if(qinfo->ReqCreatureOrGOCount[j]>0) else if (qinfo->ReqCreatureOrGOCount[j]>0)
{ {
sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = 0 but `ReqCreatureOrGOCount%d` = %u.", sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = 0 but `ReqCreatureOrGOCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->ReqCreatureOrGOCount[j]); qinfo->GetQuestId(),j+1,j+1,qinfo->ReqCreatureOrGOCount[j]);
@ -3766,24 +3778,23 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j ) for(int j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j )
{ {
uint32 id = qinfo->RewChoiceItemId[j]; if (uint32 id = qinfo->RewChoiceItemId[j])
if(id)
{ {
if(!sItemStorage.LookupEntry<ItemPrototype>(id)) if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{ {
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(),j+1,id,id); qinfo->GetQuestId(),j+1,id,id);
qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
} }
if(!qinfo->RewChoiceItemCount[j]) if (!qinfo->RewChoiceItemCount[j])
{ {
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but `RewChoiceItemCount%d` = 0, quest can't be done.", sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but `RewChoiceItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,id,j+1); qinfo->GetQuestId(),j+1,id,j+1);
// no changes, quest can't be done // no changes, quest can't be done
} }
} }
else if(qinfo->RewChoiceItemCount[j]>0) else if (qinfo->RewChoiceItemCount[j]>0)
{ {
sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = 0 but `RewChoiceItemCount%d` = %u.", sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = 0 but `RewChoiceItemCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->RewChoiceItemCount[j]); qinfo->GetQuestId(),j+1,j+1,qinfo->RewChoiceItemCount[j]);
@ -3793,24 +3804,23 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_REWARDS_COUNT; ++j ) for(int j = 0; j < QUEST_REWARDS_COUNT; ++j )
{ {
uint32 id = qinfo->RewItemId[j]; if (uint32 id = qinfo->RewItemId[j])
if(id)
{ {
if(!sItemStorage.LookupEntry<ItemPrototype>(id)) if (!sItemStorage.LookupEntry<ItemPrototype>(id))
{ {
sLog.outErrorDb("Quest %u has `RewItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", sLog.outErrorDb("Quest %u has `RewItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(),j+1,id,id); qinfo->GetQuestId(),j+1,id,id);
qinfo->RewItemId[j] = 0; // no changes, quest will not reward this item qinfo->RewItemId[j] = 0; // no changes, quest will not reward this item
} }
if(!qinfo->RewItemCount[j]) if (!qinfo->RewItemCount[j])
{ {
sLog.outErrorDb("Quest %u has `RewItemId%d` = %u but `RewItemCount%d` = 0, quest will not reward this item.", sLog.outErrorDb("Quest %u has `RewItemId%d` = %u but `RewItemCount%d` = 0, quest will not reward this item.",
qinfo->GetQuestId(),j+1,id,j+1); qinfo->GetQuestId(),j+1,id,j+1);
// no changes // no changes
} }
} }
else if(qinfo->RewItemCount[j]>0) else if (qinfo->RewItemCount[j]>0)
{ {
sLog.outErrorDb("Quest %u has `RewItemId%d` = 0 but `RewItemCount%d` = %u.", sLog.outErrorDb("Quest %u has `RewItemId%d` = 0 but `RewItemCount%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->RewItemCount[j]); qinfo->GetQuestId(),j+1,j+1,qinfo->RewItemCount[j]);
@ -3840,23 +3850,23 @@ void ObjectMgr::LoadQuests()
} }
} }
if(qinfo->RewSpell) if (qinfo->RewSpell)
{ {
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpell); SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpell);
if(!spellInfo) if (!spellInfo)
{ {
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u does not exist, spell removed as display reward.", sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u does not exist, spell removed as display reward.",
qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell); qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell);
qinfo->RewSpell = 0; // no spell reward will display for this quest qinfo->RewSpell = 0; // no spell reward will display for this quest
} }
else if(!SpellMgr::IsSpellValid(spellInfo)) else if (!SpellMgr::IsSpellValid(spellInfo))
{ {
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is broken, quest will not have a spell reward.", sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell); qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell);
qinfo->RewSpell = 0; // no spell reward will display for this quest qinfo->RewSpell = 0; // no spell reward will display for this quest
} }
else if(GetTalentSpellCost(qinfo->RewSpell)) else if (GetTalentSpellCost(qinfo->RewSpell))
{ {
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell); qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell);
@ -3864,23 +3874,23 @@ void ObjectMgr::LoadQuests()
} }
} }
if(qinfo->RewSpellCast) if (qinfo->RewSpellCast)
{ {
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpellCast); SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpellCast);
if(!spellInfo) if (!spellInfo)
{ {
sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.", sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast); qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast);
qinfo->RewSpellCast = 0; // no spell will be casted on player qinfo->RewSpellCast = 0; // no spell will be casted on player
} }
else if(!SpellMgr::IsSpellValid(spellInfo)) else if (!SpellMgr::IsSpellValid(spellInfo))
{ {
sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", sLog.outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast); qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast);
qinfo->RewSpellCast = 0; // no spell will be casted on player qinfo->RewSpellCast = 0; // no spell will be casted on player
} }
else if(GetTalentSpellCost(qinfo->RewSpellCast)) else if (GetTalentSpellCost(qinfo->RewSpellCast))
{ {
sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", sLog.outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast); qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast);
@ -3935,7 +3945,7 @@ void ObjectMgr::LoadQuests()
} }
} }
if(qinfo->NextQuestId) if (qinfo->NextQuestId)
{ {
QuestMap::iterator qNextItr = mQuestTemplates.find(abs(qinfo->GetNextQuestId())); QuestMap::iterator qNextItr = mQuestTemplates.find(abs(qinfo->GetNextQuestId()));
if (qNextItr == mQuestTemplates.end()) if (qNextItr == mQuestTemplates.end())
@ -3949,9 +3959,9 @@ void ObjectMgr::LoadQuests()
} }
} }
if(qinfo->ExclusiveGroup) if (qinfo->ExclusiveGroup)
mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId())); mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
if(qinfo->LimitTime) if (qinfo->LimitTime)
qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED); qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED);
} }
@ -3959,12 +3969,12 @@ void ObjectMgr::LoadQuests()
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{ {
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i); SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
if(!spellInfo) if (!spellInfo)
continue; continue;
for(int j = 0; j < MAX_EFFECT_INDEX; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if(spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE) if (spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
continue; continue;
uint32 quest_id = spellInfo->EffectMiscValue[j]; uint32 quest_id = spellInfo->EffectMiscValue[j];
@ -3972,10 +3982,10 @@ void ObjectMgr::LoadQuests()
Quest const* quest = GetQuestTemplate(quest_id); Quest const* quest = GetQuestTemplate(quest_id);
// some quest referenced in spells not exist (outdated spells) // some quest referenced in spells not exist (outdated spells)
if(!quest) if (!quest)
continue; continue;
if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) if (!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
{ {
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.",spellInfo->Id,quest_id); sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.",spellInfo->Id,quest_id);

View file

@ -390,7 +390,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_currentBuybackSlot = BUYBACK_SLOT_START; m_currentBuybackSlot = BUYBACK_SLOT_START;
m_DailyQuestChanged = false; m_DailyQuestChanged = false;
m_lastDailyQuestTime = 0; m_WeeklyQuestChanged = false;
for (int i=0; i<MAX_TIMERS; ++i) for (int i=0; i<MAX_TIMERS; ++i)
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER; m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
@ -1139,7 +1139,7 @@ void Player::Update( uint32 p_time )
if (!m_timedquests.empty()) if (!m_timedquests.empty())
{ {
std::set<uint32>::iterator iter = m_timedquests.begin(); QuestSet::iterator iter = m_timedquests.begin();
while (iter != m_timedquests.end()) while (iter != m_timedquests.end())
{ {
QuestStatusData& q_status = mQuestStatus[*iter]; QuestStatusData& q_status = mQuestStatus[*iter];
@ -4154,6 +4154,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE guid = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE guid = '%u'",guid);
CharacterDatabase.PExecute("DELETE FROM character_queststatus WHERE guid = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_queststatus WHERE guid = '%u'",guid);
CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'",guid);
CharacterDatabase.PExecute("DELETE FROM character_queststatus_weekly WHERE guid = '%u'",guid);
CharacterDatabase.PExecute("DELETE FROM character_reputation WHERE guid = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_reputation WHERE guid = '%u'",guid);
CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u'",guid);
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE guid = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_spell WHERE guid = '%u'",guid);
@ -6896,6 +6897,9 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
case ITEM_MOD_SPELL_POWER: case ITEM_MOD_SPELL_POWER:
ApplySpellPowerBonus(int32(val), apply); ApplySpellPowerBonus(int32(val), apply);
break; break;
case ITEM_MOD_BLOCK_VALUE:
HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply);
break;
// depricated item mods // depricated item mods
case ITEM_MOD_FERAL_ATTACK_POWER: case ITEM_MOD_FERAL_ATTACK_POWER:
case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_HEALING_DONE:
@ -12337,6 +12341,9 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
((Player*)this)->ApplySpellPowerBonus(enchant_amount, apply); ((Player*)this)->ApplySpellPowerBonus(enchant_amount, apply);
sLog.outDebug("+ %u SPELL_POWER", enchant_amount); sLog.outDebug("+ %u SPELL_POWER", enchant_amount);
break; break;
case ITEM_MOD_BLOCK_VALUE:
HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(enchant_amount), apply);
break;
case ITEM_MOD_FERAL_ATTACK_POWER: case ITEM_MOD_FERAL_ATTACK_POWER:
case ITEM_MOD_SPELL_HEALING_DONE: // deprecated case ITEM_MOD_SPELL_HEALING_DONE: // deprecated
case ITEM_MOD_SPELL_DAMAGE_DONE: // deprecated case ITEM_MOD_SPELL_DAMAGE_DONE: // deprecated
@ -12886,7 +12893,7 @@ void Player::SendPreparedQuest(uint64 guid)
PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanRewardQuest(pQuest, false), true); PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanRewardQuest(pQuest, false), true);
// Send completable on repeatable and autoCompletable quest if player don't have quest // Send completable on repeatable and autoCompletable quest if player don't have quest
// TODO: verify if check for !pQuest->IsDaily() is really correct (possibly not) // TODO: verify if check for !pQuest->IsDaily() is really correct (possibly not)
else if (pQuest->IsAutoComplete() && pQuest->IsRepeatable() && !pQuest->IsDaily()) else if (pQuest->IsAutoComplete() && pQuest->IsRepeatable() && !pQuest->IsDailyOrWeekly())
PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanCompleteRepeatableQuest(pQuest), true); PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanCompleteRepeatableQuest(pQuest), true);
else else
PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, guid, true); PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, guid, true);
@ -13003,7 +13010,7 @@ bool Player::CanSeeStartQuest( Quest const *pQuest )
if( SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) && if( SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) &&
SatisfyQuestExclusiveGroup( pQuest, false ) && SatisfyQuestReputation( pQuest, false ) && SatisfyQuestExclusiveGroup( pQuest, false ) && SatisfyQuestReputation( pQuest, false ) &&
SatisfyQuestPreviousQuest( pQuest, false ) && SatisfyQuestNextChain( pQuest, false ) && SatisfyQuestPreviousQuest( pQuest, false ) && SatisfyQuestNextChain( pQuest, false ) &&
SatisfyQuestPrevChain( pQuest, false ) && SatisfyQuestDay( pQuest, false ) ) SatisfyQuestPrevChain( pQuest, false ) && SatisfyQuestDay( pQuest, false ) && SatisfyQuestWeek( pQuest, false ) )
{ {
return getLevel() + sWorld.getConfig(CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF) >= pQuest->GetMinLevel(); return getLevel() + sWorld.getConfig(CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF) >= pQuest->GetMinLevel();
} }
@ -13018,7 +13025,7 @@ bool Player::CanTakeQuest( Quest const *pQuest, bool msg )
&& SatisfyQuestSkillOrClass( pQuest, msg ) && SatisfyQuestReputation( pQuest, msg ) && SatisfyQuestSkillOrClass( pQuest, msg ) && SatisfyQuestReputation( pQuest, msg )
&& SatisfyQuestPreviousQuest( pQuest, msg ) && SatisfyQuestTimed( pQuest, msg ) && SatisfyQuestPreviousQuest( pQuest, msg ) && SatisfyQuestTimed( pQuest, msg )
&& SatisfyQuestNextChain( pQuest, msg ) && SatisfyQuestPrevChain( pQuest, msg ) && SatisfyQuestNextChain( pQuest, msg ) && SatisfyQuestPrevChain( pQuest, msg )
&& SatisfyQuestDay( pQuest, msg ); && SatisfyQuestDay( pQuest, msg ) && SatisfyQuestWeek( pQuest, msg );
} }
bool Player::CanAddQuest( Quest const *pQuest, bool msg ) bool Player::CanAddQuest( Quest const *pQuest, bool msg )
@ -13130,15 +13137,15 @@ bool Player::CanCompleteRepeatableQuest( Quest const *pQuest )
bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
{ {
// not auto complete quest and not completed quest (only cheating case, then ignore without message) // not auto complete quest and not completed quest (only cheating case, then ignore without message)
if(!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE) if (!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE)
return false; return false;
// daily quest can't be rewarded (25 daily quest already completed) // daily quest can't be rewarded (25 daily quest already completed)
if(!SatisfyQuestDay(pQuest,true)) if (!SatisfyQuestDay(pQuest,true) || !SatisfyQuestWeek(pQuest,true))
return false; return false;
// rewarded and not repeatable quest (only cheating case, then ignore without message) // rewarded and not repeatable quest (only cheating case, then ignore without message)
if(GetQuestRewardStatus(pQuest->GetQuestId())) if (GetQuestRewardStatus(pQuest->GetQuestId()))
return false; return false;
// prevent receive reward with quest items in bank // prevent receive reward with quest items in bank
@ -13157,7 +13164,7 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
} }
// prevent receive reward with low money and GetRewOrReqMoney() < 0 // prevent receive reward with low money and GetRewOrReqMoney() < 0
if(pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) ) if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) )
return false; return false;
return true; return true;
@ -13421,6 +13428,9 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST, 1);
} }
if (pQuest->IsWeekly())
SetWeeklyQuestStatus(quest_id);
if (!pQuest->IsRepeatable()) if (!pQuest->IsRepeatable())
SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE); SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);
else else
@ -13734,7 +13744,7 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg)
bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
{ {
// non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed // non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed
if(qInfo->GetExclusiveGroup() <= 0) if (qInfo->GetExclusiveGroup() <= 0)
return true; return true;
ObjectMgr::ExclusiveQuestGroups::const_iterator iter = sObjectMgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::const_iterator iter = sObjectMgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup());
@ -13747,12 +13757,12 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
uint32 exclude_Id = iter->second; uint32 exclude_Id = iter->second;
// skip checked quest id, only state of other quests in group is interesting // skip checked quest id, only state of other quests in group is interesting
if(exclude_Id == qInfo->GetQuestId()) if (exclude_Id == qInfo->GetQuestId())
continue; continue;
// not allow have daily quest if daily quest from exclusive group already recently completed // not allow have daily quest if daily quest from exclusive group already recently completed
Quest const* Nquest = sObjectMgr.GetQuestTemplate(exclude_Id); Quest const* Nquest = sObjectMgr.GetQuestTemplate(exclude_Id);
if( !SatisfyQuestDay(Nquest, false) ) if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false))
{ {
if( msg ) if( msg )
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
@ -13762,8 +13772,8 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id ); QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id );
// alternative quest already started or completed // alternative quest already started or completed
if( i_exstatus != mQuestStatus.end() if (i_exstatus != mQuestStatus.end()
&& (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE) ) && (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE))
{ {
if( msg ) if( msg )
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
@ -13830,21 +13840,21 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg )
bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg )
{ {
if(!qInfo->IsDaily()) if (!qInfo->IsDaily())
return true; return true;
bool have_slot = false; bool have_slot = false;
for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{ {
uint32 id = GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx); uint32 id = GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx);
if(qInfo->GetQuestId()==id) if (qInfo->GetQuestId()==id)
return false; return false;
if(!id) if(!id)
have_slot = true; have_slot = true;
} }
if(!have_slot) if (!have_slot)
{ {
if( msg ) if( msg )
SendCanTakeQuestResponse( INVALIDREASON_DAILY_QUESTS_REMAINING ); SendCanTakeQuestResponse( INVALIDREASON_DAILY_QUESTS_REMAINING );
@ -13854,10 +13864,19 @@ bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg )
return true; return true;
} }
bool Player::SatisfyQuestWeek( Quest const* qInfo, bool msg )
{
if (!qInfo->IsWeekly() || m_weeklyquests.empty())
return true;
// if not found in cooldown list
return m_weeklyquests.find(qInfo->GetQuestId()) == m_weeklyquests.end();
}
bool Player::GiveQuestSourceItem( Quest const *pQuest ) bool Player::GiveQuestSourceItem( Quest const *pQuest )
{ {
uint32 srcitem = pQuest->GetSrcItemId(); uint32 srcitem = pQuest->GetSrcItemId();
if( srcitem > 0 ) if (srcitem > 0)
{ {
uint32 count = pQuest->GetSrcItemCount(); uint32 count = pQuest->GetSrcItemCount();
if( count <= 0 ) if( count <= 0 )
@ -13865,14 +13884,14 @@ bool Player::GiveQuestSourceItem( Quest const *pQuest )
ItemPosCountVec dest; ItemPosCountVec dest;
uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count );
if( msg == EQUIP_ERR_OK ) if (msg == EQUIP_ERR_OK)
{ {
Item * item = StoreNewItem(dest, srcitem, true); Item * item = StoreNewItem(dest, srcitem, true);
SendNewItem(item, count, true, false); SendNewItem(item, count, true, false);
return true; return true;
} }
// player already have max amount required item, just report success // player already have max amount required item, just report success
else if( msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) else if (msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS)
return true; return true;
else else
SendEquipError( msg, NULL, NULL, srcitem ); SendEquipError( msg, NULL, NULL, srcitem );
@ -15154,6 +15173,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// after spell load, learn rewarded spell if need also // after spell load, learn rewarded spell if need also
_LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS)); _LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS));
_LoadDailyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS)); _LoadDailyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS));
_LoadWeeklyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS));
_LoadTalents(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTALENTS)); _LoadTalents(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTALENTS));
@ -15901,7 +15921,7 @@ void Player::_LoadDailyQuestStatus(QueryResult *result)
for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx,0); SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx,0);
//QueryResult *result = CharacterDatabase.PQuery("SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow()); //QueryResult *result = CharacterDatabase.PQuery("SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow());
if(result) if(result)
{ {
@ -15919,9 +15939,6 @@ void Player::_LoadDailyQuestStatus(QueryResult *result)
uint32 quest_id = fields[0].GetUInt32(); uint32 quest_id = fields[0].GetUInt32();
// save _any_ from daily quest times (it must be after last reset anyway)
m_lastDailyQuestTime = (time_t)fields[1].GetUInt64();
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
if( !pQuest ) if( !pQuest )
continue; continue;
@ -15939,6 +15956,35 @@ void Player::_LoadDailyQuestStatus(QueryResult *result)
m_DailyQuestChanged = false; m_DailyQuestChanged = false;
} }
void Player::_LoadWeeklyQuestStatus(QueryResult *result)
{
m_weeklyquests.clear();
//QueryResult *result = CharacterDatabase.PQuery("SELECT quest FROM character_queststatus_weekly WHERE guid = '%u'", GetGUIDLow());
if (result)
{
do
{
Field *fields = result->Fetch();
uint32 quest_id = fields[0].GetUInt32();
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
if (!pQuest)
continue;
m_weeklyquests.insert(quest_id);
sLog.outDebug("Weekly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow());
}
while( result->NextRow() );
delete result;
}
m_WeeklyQuestChanged = false;
}
void Player::_LoadSpells(QueryResult *result) void Player::_LoadSpells(QueryResult *result)
{ {
//QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'",GetGUIDLow()); //QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'",GetGUIDLow());
@ -15975,7 +16021,7 @@ void Player::_LoadTalents(QueryResult *result)
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint32 talent_id = fields[0].GetUInt32(); uint32 talent_id = fields[0].GetUInt32();
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id ); TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id );
@ -16517,13 +16563,14 @@ void Player::SaveToDB()
CharacterDatabase.Execute( ss.str().c_str() ); CharacterDatabase.Execute( ss.str().c_str() );
if(m_mailsUpdated) //save mails only when needed if (m_mailsUpdated) //save mails only when needed
_SaveMail(); _SaveMail();
_SaveBGData(); _SaveBGData();
_SaveInventory(); _SaveInventory();
_SaveQuestStatus(); _SaveQuestStatus();
_SaveDailyQuestStatus(); _SaveDailyQuestStatus();
_SaveWeeklyQuestStatus();
_SaveSpells(); _SaveSpells();
_SaveSpellCooldowns(); _SaveSpellCooldowns();
_SaveActions(); _SaveActions();
@ -16538,8 +16585,13 @@ void Player::SaveToDB()
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
// check if stats should only be saved on logout
// save stats can be out of transaction
if (m_session->isLogingOut() || !sWorld.getConfig(CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT))
_SaveStats();
// save pet (hunter pet level and experience and all type pets health/mana). // save pet (hunter pet level and experience and all type pets health/mana).
if(Pet* pet = GetPet()) if (Pet* pet = GetPet())
pet->SavePetToDB(PET_SAVE_AS_CURRENT); pet->SavePetToDB(PET_SAVE_AS_CURRENT);
} }
@ -16821,21 +16873,36 @@ void Player::_SaveQuestStatus()
void Player::_SaveDailyQuestStatus() void Player::_SaveDailyQuestStatus()
{ {
if(!m_DailyQuestChanged) if (!m_DailyQuestChanged)
return; return;
m_DailyQuestChanged = false;
// save last daily quest time for all quests: we need only mostly reset time for reset check anyway
// we don't need transactions here. // we don't need transactions here.
CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'",GetGUIDLow()); CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'",GetGUIDLow());
for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
if(GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)) if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest,time) VALUES ('%u', '%u','" UI64FMTD "')", CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest) VALUES ('%u', '%u')",
GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx),uint64(m_lastDailyQuestTime)); GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx));
m_DailyQuestChanged = false;
} }
void Player::_SaveWeeklyQuestStatus()
{
if (!m_WeeklyQuestChanged || m_weeklyquests.empty())
return;
// we don't need transactions here.
CharacterDatabase.PExecute("DELETE FROM character_queststatus_weekly WHERE guid = '%u'",GetGUIDLow());
for (QuestSet::const_iterator iter = m_weeklyquests.begin(); iter != m_weeklyquests.end(); ++iter)
{
uint32 quest_id = *iter;
CharacterDatabase.PExecute("INSERT INTO character_queststatus_weekly (guid,quest) VALUES ('%u', '%u')", GetGUIDLow(), quest_id);
}
m_WeeklyQuestChanged = false;
}
void Player::_SaveSkills() void Player::_SaveSkills()
{ {
@ -16927,6 +16994,40 @@ void Player::_SaveTalents()
} }
} }
// save player stats -- only for external usage
// real stats will be recalculated on player login
void Player::_SaveStats()
{
// check if stat saving is enabled and if char level is high enough
if(!sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE) || getLevel() < sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE))
return;
CharacterDatabase.PExecute("DELETE FROM character_stats WHERE guid = '%u'", GetGUIDLow());
std::ostringstream ss;
ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, "
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower) VALUES ("
<< GetGUIDLow() << ", "
<< GetMaxHealth() << ", ";
for(int i = 0; i < MAX_POWERS; ++i)
ss << GetMaxPower(Powers(i)) << ", ";
for(int i = 0; i < MAX_STATS; ++i)
ss << GetStat(Stats(i)) << ", ";
// armor + school resistances
for(int i = 0; i < MAX_SPELL_SCHOOL; ++i)
ss << GetResistance(SpellSchools(i)) << ",";
ss << GetFloatValue(PLAYER_BLOCK_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_DODGE_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_PARRY_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_CRIT_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE) << ", "
<< GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1) << ", "
<< GetUInt32Value(UNIT_FIELD_ATTACK_POWER) << ", "
<< GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) << ", "
<< GetBaseSpellPowerBonus() << ")";
CharacterDatabase.Execute( ss.str().c_str() );
}
void Player::outDebugValues() const void Player::outDebugValues() const
{ {
if(!sLog.IsOutDebug()) // optimize disabled debug output if(!sLog.IsOutDebug()) // optimize disabled debug output
@ -18591,7 +18692,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
if(i == slot) if(i == slot)
continue; continue;
Item *pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); Item *pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if(pItem2 && pItem2->GetProto()->Socket[0].Color) if(pItem2 && !pItem2->IsBroken() && pItem2->GetProto()->Socket[0].Color)
{ {
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot) for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
{ {
@ -19497,13 +19598,18 @@ void Player::SetDailyQuestStatus( uint32 quest_id )
if(!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)) if(!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
{ {
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx,quest_id); SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx,quest_id);
m_lastDailyQuestTime = time(NULL); // last daily quest time
m_DailyQuestChanged = true; m_DailyQuestChanged = true;
break; break;
} }
} }
} }
void Player::SetWeeklyQuestStatus( uint32 quest_id )
{
m_weeklyquests.insert(quest_id);
m_WeeklyQuestChanged = true;
}
void Player::ResetDailyQuestStatus() void Player::ResetDailyQuestStatus()
{ {
for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
@ -19511,7 +19617,16 @@ void Player::ResetDailyQuestStatus()
// DB data deleted in caller // DB data deleted in caller
m_DailyQuestChanged = false; m_DailyQuestChanged = false;
m_lastDailyQuestTime = 0; }
void Player::ResetWeeklyQuestStatus()
{
if (m_weeklyquests.empty())
return;
m_weeklyquests.clear();
// DB data deleted in caller
m_WeeklyQuestChanged = false;
} }
BattleGround* Player::GetBattleGround() const BattleGround* Player::GetBattleGround() const
@ -21281,7 +21396,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
for(PlayerTalentMap::iterator iter = m_talents[specIdx].begin(); iter != m_talents[specIdx].end(); ++iter) for(PlayerTalentMap::iterator iter = m_talents[specIdx].begin(); iter != m_talents[specIdx].end(); ++iter)
{ {
PlayerTalent talent = (*iter).second; PlayerTalent talent = (*iter).second;
if (talent.state == PLAYERSPELL_REMOVED) if (talent.state == PLAYERSPELL_REMOVED)
continue; continue;
@ -21593,15 +21708,17 @@ void Player::ActivateSpec(uint8 specNum)
// remove any talent rank if talent not listed in temp spec // remove any talent rank if talent not listed in temp spec
if (iterTempSpec == tempSpec.end() || iterTempSpec->second.state == PLAYERSPELL_REMOVED) if (iterTempSpec == tempSpec.end() || iterTempSpec->second.state == PLAYERSPELL_REMOVED)
{ {
TalentEntry const *talentInfo = talent.m_talentEntry;
for(int r = 0; r < MAX_TALENT_RANK; ++r) for(int r = 0; r < MAX_TALENT_RANK; ++r)
if (talent.m_talentEntry->RankID[r]) if (talentInfo->RankID[r])
removeSpell(talent.m_talentEntry->RankID[r],!IsPassiveSpell(talent.m_talentEntry->RankID[r]),false); removeSpell(talentInfo->RankID[r],!IsPassiveSpell(talentInfo->RankID[r]),false);
specIter = m_talents[m_activeSpec].begin(); specIter = m_talents[m_activeSpec].begin();
} }
else else
++specIter; ++specIter;
} }
// now new spec data have only talents (maybe different rank) as in temp spec data, sync ranks then. // now new spec data have only talents (maybe different rank) as in temp spec data, sync ranks then.
for (PlayerTalentMap::const_iterator tempIter = tempSpec.begin(); tempIter != tempSpec.end(); ++tempIter) for (PlayerTalentMap::const_iterator tempIter = tempSpec.begin(); tempIter != tempSpec.end(); ++tempIter)

View file

@ -910,7 +910,8 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADMAILS = 23, PLAYER_LOGIN_QUERY_LOADMAILS = 23,
PLAYER_LOGIN_QUERY_LOADMAILEDITEMS = 24, PLAYER_LOGIN_QUERY_LOADMAILEDITEMS = 24,
PLAYER_LOGIN_QUERY_LOADTALENTS = 25, PLAYER_LOGIN_QUERY_LOADTALENTS = 25,
MAX_PLAYER_LOGIN_QUERY = 26 PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS = 26,
MAX_PLAYER_LOGIN_QUERY = 27
}; };
enum PlayerDelayedOperations enum PlayerDelayedOperations
@ -1349,6 +1350,7 @@ class MANGOS_DLL_SPEC Player : public Unit
bool SatisfyQuestNextChain( Quest const* qInfo, bool msg ); bool SatisfyQuestNextChain( Quest const* qInfo, bool msg );
bool SatisfyQuestPrevChain( Quest const* qInfo, bool msg ); bool SatisfyQuestPrevChain( Quest const* qInfo, bool msg );
bool SatisfyQuestDay( Quest const* qInfo, bool msg ); bool SatisfyQuestDay( Quest const* qInfo, bool msg );
bool SatisfyQuestWeek( Quest const* qInfo, bool msg );
bool GiveQuestSourceItem( Quest const *pQuest ); bool GiveQuestSourceItem( Quest const *pQuest );
bool TakeQuestSourceItem( uint32 quest_id, bool msg ); bool TakeQuestSourceItem( uint32 quest_id, bool msg );
bool GetQuestRewardStatus( uint32 quest_id ) const; bool GetQuestRewardStatus( uint32 quest_id ) const;
@ -1356,7 +1358,9 @@ class MANGOS_DLL_SPEC Player : public Unit
void SetQuestStatus( uint32 quest_id, QuestStatus status ); void SetQuestStatus( uint32 quest_id, QuestStatus status );
void SetDailyQuestStatus( uint32 quest_id ); void SetDailyQuestStatus( uint32 quest_id );
void SetWeeklyQuestStatus( uint32 quest_id );
void ResetDailyQuestStatus(); void ResetDailyQuestStatus();
void ResetWeeklyQuestStatus();
uint16 FindQuestSlot( uint32 quest_id ) const; uint16 FindQuestSlot( uint32 quest_id ) const;
uint32 GetQuestSlotQuestId(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET); } uint32 GetQuestSlotQuestId(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET); }
@ -2316,7 +2320,9 @@ class MANGOS_DLL_SPEC Player : public Unit
/*********************************************************/ /*********************************************************/
//We allow only one timed quest active at the same time. Below can then be simple value instead of set. //We allow only one timed quest active at the same time. Below can then be simple value instead of set.
std::set<uint32> m_timedquests; typedef std::set<uint32> QuestSet;
QuestSet m_timedquests;
QuestSet m_weeklyquests;
uint64 m_divider; uint64 m_divider;
uint32 m_ingametime; uint32 m_ingametime;
@ -2333,6 +2339,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void _LoadMailedItems(QueryResult *result); void _LoadMailedItems(QueryResult *result);
void _LoadQuestStatus(QueryResult *result); void _LoadQuestStatus(QueryResult *result);
void _LoadDailyQuestStatus(QueryResult *result); void _LoadDailyQuestStatus(QueryResult *result);
void _LoadWeeklyQuestStatus(QueryResult *result);
void _LoadGroup(QueryResult *result); void _LoadGroup(QueryResult *result);
void _LoadSkills(QueryResult *result); void _LoadSkills(QueryResult *result);
void _LoadSpells(QueryResult *result); void _LoadSpells(QueryResult *result);
@ -2356,12 +2363,14 @@ class MANGOS_DLL_SPEC Player : public Unit
void _SaveMail(); void _SaveMail();
void _SaveQuestStatus(); void _SaveQuestStatus();
void _SaveDailyQuestStatus(); void _SaveDailyQuestStatus();
void _SaveWeeklyQuestStatus();
void _SaveSkills(); void _SaveSkills();
void _SaveSpells(); void _SaveSpells();
void _SaveEquipmentSets(); void _SaveEquipmentSets();
void _SaveBGData(); void _SaveBGData();
void _SaveGlyphs(); void _SaveGlyphs();
void _SaveTalents(); void _SaveTalents();
void _SaveStats();
void _SetCreateBits(UpdateMask *updateMask, Player *target) const; void _SetCreateBits(UpdateMask *updateMask, Player *target) const;
void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; void _SetUpdateBits(UpdateMask *updateMask, Player *target) const;
@ -2454,7 +2463,7 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 tradeGold; uint32 tradeGold;
bool m_DailyQuestChanged; bool m_DailyQuestChanged;
time_t m_lastDailyQuestTime; bool m_WeeklyQuestChanged;
uint32 m_drunkTimer; uint32 m_drunkTimer;
uint16 m_drunk; uint16 m_drunk;

View file

@ -240,6 +240,7 @@ class Quest
uint32 GetFlags() const { return QuestFlags; } uint32 GetFlags() const { return QuestFlags; }
bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; } bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; }
bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; } bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; }
bool IsDailyOrWeekly() const { return QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
bool IsAutoAccept() const { return QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; } bool IsAutoAccept() const { return QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; }
// multiple values // multiple values

View file

@ -610,7 +610,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32
result2 = DIALOG_STATUS_REWARD_REP; result2 = DIALOG_STATUS_REWARD_REP;
else if (pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + sWorld.getConfig(CONFIG_UINT32_QUEST_LOW_LEVEL_HIDE_DIFF) ) else if (pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + sWorld.getConfig(CONFIG_UINT32_QUEST_LOW_LEVEL_HIDE_DIFF) )
{ {
if (pQuest->HasFlag(QUEST_FLAGS_DAILY)) if (pQuest->HasFlag(QUEST_FLAGS_DAILY) || pQuest->HasFlag(QUEST_FLAGS_WEEKLY))
result2 = DIALOG_STATUS_AVAILABLE_REP; result2 = DIALOG_STATUS_AVAILABLE_REP;
else else
result2 = DIALOG_STATUS_AVAILABLE; result2 = DIALOG_STATUS_AVAILABLE;

View file

@ -290,7 +290,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX2_UNK3 0x00000008 // 3 auto targeting? (e.g. fishing skill enhancement items since 3.3.3) #define SPELL_ATTR_EX2_UNK3 0x00000008 // 3 auto targeting? (e.g. fishing skill enhancement items since 3.3.3)
#define SPELL_ATTR_EX2_UNK4 0x00000010 // 4 #define SPELL_ATTR_EX2_UNK4 0x00000010 // 4
#define SPELL_ATTR_EX2_AUTOREPEAT_FLAG 0x00000020 // 5 #define SPELL_ATTR_EX2_AUTOREPEAT_FLAG 0x00000020 // 5
#define SPELL_ATTR_EX2_UNK6 0x00000040 // 6 #define SPELL_ATTR_EX2_UNK6 0x00000040 // 6 only usable on tabbed by yourself
#define SPELL_ATTR_EX2_UNK7 0x00000080 // 7 #define SPELL_ATTR_EX2_UNK7 0x00000080 // 7
#define SPELL_ATTR_EX2_UNK8 0x00000100 // 8 not set in 3.0.3 #define SPELL_ATTR_EX2_UNK8 0x00000100 // 8 not set in 3.0.3
#define SPELL_ATTR_EX2_UNK9 0x00000200 // 9 #define SPELL_ATTR_EX2_UNK9 0x00000200 // 9
@ -301,7 +301,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX2_UNK14 0x00004000 // 14 #define SPELL_ATTR_EX2_UNK14 0x00004000 // 14
#define SPELL_ATTR_EX2_UNK15 0x00008000 // 15 not set in 3.0.3 #define SPELL_ATTR_EX2_UNK15 0x00008000 // 15 not set in 3.0.3
#define SPELL_ATTR_EX2_UNK16 0x00010000 // 16 #define SPELL_ATTR_EX2_UNK16 0x00010000 // 16
#define SPELL_ATTR_EX2_UNK17 0x00020000 // 17 Hunters Shot and Stings only have this flag #define SPELL_ATTR_EX2_UNK17 0x00020000 // 17 suspend weapon timer instead of resetting it, (?Hunters Shot and Stings only have this flag?)
#define SPELL_ATTR_EX2_UNK18 0x00040000 // 18 Only Revive pet - possible req dead pet #define SPELL_ATTR_EX2_UNK18 0x00040000 // 18 Only Revive pet - possible req dead pet
#define SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT 0x00080000 // 19 does not necessarly need shapeshift #define SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT 0x00080000 // 19 does not necessarly need shapeshift
#define SPELL_ATTR_EX2_UNK20 0x00100000 // 20 #define SPELL_ATTR_EX2_UNK20 0x00100000 // 20
@ -324,7 +324,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX3_UNK4 0x00000010 // 4 Druid Rebirth only this spell have this flag #define SPELL_ATTR_EX3_UNK4 0x00000010 // 4 Druid Rebirth only this spell have this flag
#define SPELL_ATTR_EX3_UNK5 0x00000020 // 5 #define SPELL_ATTR_EX3_UNK5 0x00000020 // 5
#define SPELL_ATTR_EX3_UNK6 0x00000040 // 6 #define SPELL_ATTR_EX3_UNK6 0x00000040 // 6
#define SPELL_ATTR_EX3_UNK7 0x00000080 // 7 #define SPELL_ATTR_EX3_UNK7 0x00000080 // 7 create a separate (de)buff stack for each caster
#define SPELL_ATTR_EX3_UNK8 0x00000100 // 8 #define SPELL_ATTR_EX3_UNK8 0x00000100 // 8
#define SPELL_ATTR_EX3_UNK9 0x00000200 // 9 #define SPELL_ATTR_EX3_UNK9 0x00000200 // 9
#define SPELL_ATTR_EX3_MAIN_HAND 0x00000400 // 10 Main hand weapon required #define SPELL_ATTR_EX3_MAIN_HAND 0x00000400 // 10 Main hand weapon required

View file

@ -235,7 +235,7 @@ enum AuraType
SPELL_AURA_MOD_FACTION_REPUTATION_GAIN = 190, SPELL_AURA_MOD_FACTION_REPUTATION_GAIN = 190,
SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED = 191, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED = 191,
SPELL_AURA_HASTE_MELEE = 192, SPELL_AURA_HASTE_MELEE = 192,
SPELL_AURA_MELEE_SLOW = 193, SPELL_AURA_HASTE_ALL = 193,
SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL = 194, SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL = 194,
SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL = 195, SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL = 195,
SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
@ -294,7 +294,7 @@ enum AuraType
SPELL_AURA_CONVERT_RUNE = 249, SPELL_AURA_CONVERT_RUNE = 249,
SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250, SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
SPELL_AURA_MOD_ENEMY_DODGE = 251, SPELL_AURA_MOD_ENEMY_DODGE = 251,
SPELL_AURA_252 = 252, SPELL_AURA_SLOW_ALL = 252,
SPELL_AURA_MOD_BLOCK_CRIT_CHANCE = 253, SPELL_AURA_MOD_BLOCK_CRIT_CHANCE = 253,
SPELL_AURA_MOD_DISARM_SHIELD = 254, SPELL_AURA_MOD_DISARM_SHIELD = 254,
SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT = 255, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT = 255,

View file

@ -243,7 +243,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNoImmediateEffect, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN implemented in Player::CalculateReputationGain &Aura::HandleNoImmediateEffect, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN implemented in Player::CalculateReputationGain
&Aura::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED &Aura::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
&Aura::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE &Aura::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE
&Aura::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct) &Aura::HandleModCombatSpeedPct, //193 SPELL_AURA_HASTE_ALL (in fact combat (any type attack) speed pct)
&Aura::HandleNoImmediateEffect, //194 SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL implement in Unit::CalcNotIgnoreAbsorbDamage &Aura::HandleNoImmediateEffect, //194 SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL implement in Unit::CalcNotIgnoreAbsorbDamage
&Aura::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL implement in Unit::CalcNotIgnoreAbsorbDamage &Aura::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL implement in Unit::CalcNotIgnoreAbsorbDamage
&Aura::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN (single spell 24818 in 3.2.2a) &Aura::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN (single spell 24818 in 3.2.2a)
@ -302,7 +302,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE &Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
&Aura::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2 &Aura::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
&Aura::HandleNULL, //251 SPELL_AURA_MOD_ENEMY_DODGE &Aura::HandleNULL, //251 SPELL_AURA_MOD_ENEMY_DODGE
&Aura::HandleNULL, //252 haste all? &Aura::HandleModCombatSpeedPct, //252 SPELL_AURA_SLOW_ALL
&Aura::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::CalculateMeleeDamage &Aura::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::CalculateMeleeDamage
&Aura::HandleNULL, //254 SPELL_AURA_MOD_DISARM_SHIELD disarm Shield &Aura::HandleNULL, //254 SPELL_AURA_MOD_DISARM_SHIELD disarm Shield
&Aura::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus &Aura::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus

View file

@ -3002,12 +3002,13 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
switch (spell->DmgClass) switch (spell->DmgClass)
{ {
case SPELL_DAMAGE_CLASS_RANGED:
case SPELL_DAMAGE_CLASS_MELEE:
return MeleeSpellHitResult(pVictim, spell);
case SPELL_DAMAGE_CLASS_NONE: case SPELL_DAMAGE_CLASS_NONE:
return SPELL_MISS_NONE;
case SPELL_DAMAGE_CLASS_MAGIC: case SPELL_DAMAGE_CLASS_MAGIC:
return MagicSpellHitResult(pVictim, spell); return MagicSpellHitResult(pVictim, spell);
case SPELL_DAMAGE_CLASS_MELEE:
case SPELL_DAMAGE_CLASS_RANGED:
return MeleeSpellHitResult(pVictim, spell);
} }
return SPELL_MISS_NONE; return SPELL_MISS_NONE;
} }
@ -8575,17 +8576,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
{ {
SpellEntry const* spellProto = (*itr).second->GetSpellProto(); SpellEntry const* spellProto = (*itr).second->GetSpellProto();
if (spellProto->CasterAuraState == flag) if (spellProto->CasterAuraState == flag)
{
// exceptions (applied at state but not removed at state change)
// Rampage
if(spellProto->SpellIconID==2006 && spellProto->SpellFamilyName==SPELLFAMILY_WARRIOR && spellProto->SpellFamilyFlags==0x100000)
{
++itr;
continue;
}
RemoveAura(itr); RemoveAura(itr);
}
else else
++itr; ++itr;
} }
@ -9046,7 +9037,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
} }
// Torment the weak affected (Arcane Barrage, Arcane Blast, Frostfire Bolt, Arcane Missiles, Fireball) // Torment the weak affected (Arcane Barrage, Arcane Blast, Frostfire Bolt, Arcane Missiles, Fireball)
if ((spellProto->SpellFamilyFlags & UI64LIT(0x0000900020200021)) && if ((spellProto->SpellFamilyFlags & UI64LIT(0x0000900020200021)) &&
(pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || pVictim->HasAuraType(SPELL_AURA_MELEE_SLOW))) (pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || pVictim->HasAuraType(SPELL_AURA_HASTE_ALL)))
{ {
//Search for Torment the weak dummy aura //Search for Torment the weak dummy aura
Unit::AuraList const& ttw = GetAurasByType(SPELL_AURA_DUMMY); Unit::AuraList const& ttw = GetAurasByType(SPELL_AURA_DUMMY);

View file

@ -89,6 +89,7 @@ World::World()
m_maxQueuedSessionCount = 0; m_maxQueuedSessionCount = 0;
m_resultQueue = NULL; m_resultQueue = NULL;
m_NextDailyQuestReset = 0; m_NextDailyQuestReset = 0;
m_NextWeeklyQuestReset = 0;
m_scheduledScripts = 0; m_scheduledScripts = 0;
m_defaultDbcLocale = LOCALE_enUS; m_defaultDbcLocale = LOCALE_enUS;
@ -516,7 +517,9 @@ void World::LoadConfigSettings(bool reload)
setConfigMinMax(CONFIG_UINT32_COMPRESSION, "Compression", 1, 1, 9); setConfigMinMax(CONFIG_UINT32_COMPRESSION, "Compression", 1, 1, 9);
setConfig(CONFIG_BOOL_ADDON_CHANNEL, "AddonChannel", true); setConfig(CONFIG_BOOL_ADDON_CHANNEL, "AddonChannel", true);
setConfig(CONFIG_BOOL_GRID_UNLOAD, "GridUnload", true); setConfig(CONFIG_BOOL_GRID_UNLOAD, "GridUnload", true);
setConfigPos(CONFIG_UINT32_INTERVAL_SAVE, "PlayerSaveInterval", 15 * MINUTE * IN_MILLISECONDS); setConfigPos(CONFIG_UINT32_INTERVAL_SAVE, "PlayerSave.Interval", 15 * MINUTE * IN_MILLISECONDS);
setConfigMinMax(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE, "PlayerSave.Stats.MinLevel", 0, 0, MAX_LEVEL);
setConfig(CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT, "PlayerSave.Stats.SaveOnlyOnLogout", true);
setConfigMin(CONFIG_UINT32_INTERVAL_GRIDCLEAN, "GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS, MIN_GRID_DELAY); setConfigMin(CONFIG_UINT32_INTERVAL_GRIDCLEAN, "GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS, MIN_GRID_DELAY);
if (reload) if (reload)
@ -675,6 +678,10 @@ void World::LoadConfigSettings(bool reload)
if (getConfig(CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF) > MAX_LEVEL) if (getConfig(CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF) > MAX_LEVEL)
setConfig(CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF, MAX_LEVEL); setConfig(CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF, MAX_LEVEL);
setConfigMinMax(CONFIG_UINT32_QUEST_DAILY_RESET_HOUR, "Quests.Daily.ResetHour", 6, 0, 23);
setConfigMinMax(CONFIG_UINT32_QUEST_WEEKLY_RESET_WEEK_DAY, "Quests.Weekly.ResetWeekDay", 3, 0, 6);
setConfigMinMax(CONFIG_UINT32_QUEST_WEEKLY_RESET_HOUR, "Quests.Weekly.ResetHour", 6, 0 , 23);
setConfig(CONFIG_BOOL_DETECT_POS_COLLISION, "DetectPosCollision", true); setConfig(CONFIG_BOOL_DETECT_POS_COLLISION, "DetectPosCollision", true);
setConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL, "Channel.RestrictedLfg", true); setConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL, "Channel.RestrictedLfg", true);
@ -1265,6 +1272,9 @@ void World::SetInitialWorldSettings()
sLog.outString("Calculate next daily quest reset time..." ); sLog.outString("Calculate next daily quest reset time..." );
InitDailyQuestResetTime(); InitDailyQuestResetTime();
sLog.outString("Calculate next weekly quest reset time..." );
InitWeeklyQuestResetTime();
sLog.outString("Starting objects Pooling system..." ); sLog.outString("Starting objects Pooling system..." );
sPoolMgr.Initialize(); sPoolMgr.Initialize();
@ -1327,20 +1337,29 @@ void World::Update(uint32 diff)
{ {
///- Update the different timers ///- Update the different timers
for(int i = 0; i < WUPDATE_COUNT; ++i) for(int i = 0; i < WUPDATE_COUNT; ++i)
if(m_timers[i].GetCurrent()>=0) {
if (m_timers[i].GetCurrent()>=0)
m_timers[i].Update(diff); m_timers[i].Update(diff);
else m_timers[i].SetCurrent(0); else
m_timers[i].SetCurrent(0);
}
///- Update the game time and check for shutdown time ///- Update the game time and check for shutdown time
_UpdateGameTime(); _UpdateGameTime();
/// Handle daily quests reset time /// Handle daily quests reset time
if(m_gameTime > m_NextDailyQuestReset) if (m_gameTime > m_NextDailyQuestReset)
{ {
ResetDailyQuests(); ResetDailyQuests();
m_NextDailyQuestReset += DAY; m_NextDailyQuestReset += DAY;
} }
if(m_gameTime > m_NextWeeklyQuestReset)
{
ResetWeeklyQuests();
m_NextWeeklyQuestReset += WEEK;
}
/// <ul><li> Handle auctions when the timer has passed /// <ul><li> Handle auctions when the timer has passed
if (m_timers[WUPDATE_AUCTIONS].Passed()) if (m_timers[WUPDATE_AUCTIONS].Passed())
{ {
@ -1869,43 +1888,69 @@ void World::_UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId
} }
} }
void World::InitDailyQuestResetTime() void World::InitWeeklyQuestResetTime()
{ {
time_t mostRecentQuestTime; QueryResult * result = CharacterDatabase.Query("SELECT NextWeeklyQuestResetTime FROM saved_variables");
if (!result)
QueryResult* result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily"); m_NextWeeklyQuestReset = time_t(time(NULL)); // game time not yet init
if(result)
{
Field *fields = result->Fetch();
mostRecentQuestTime = (time_t)fields[0].GetUInt64();
delete result;
}
else else
mostRecentQuestTime = 0; m_NextWeeklyQuestReset = time_t((*result)[0].GetUInt64());
// client built-in time for reset is 6:00 AM // generate time by config
// FIX ME: client not show day start time
time_t curTime = time(NULL); time_t curTime = time(NULL);
tm localTm = *localtime(&curTime); tm localTm = *localtime(&curTime);
localTm.tm_hour = 6;
int week_day_offset = localTm.tm_wday - int(getConfig(CONFIG_UINT32_QUEST_WEEKLY_RESET_WEEK_DAY));
// current week reset time
localTm.tm_hour = getConfig(CONFIG_UINT32_QUEST_WEEKLY_RESET_HOUR);
localTm.tm_min = 0;
localTm.tm_sec = 0;
time_t nextWeekResetTime = mktime(&localTm);
nextWeekResetTime -= week_day_offset * DAY; // move time to proper day
// next reset time before current moment
if (curTime >= nextWeekResetTime)
nextWeekResetTime += WEEK;
// normalize reset time
m_NextWeeklyQuestReset = m_NextWeeklyQuestReset < curTime ? nextWeekResetTime - WEEK : nextWeekResetTime;
if (!result)
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextWeeklyQuestResetTime) VALUES ('"UI64FMTD"')", uint64(m_NextWeeklyQuestReset));
else
delete result;
}
void World::InitDailyQuestResetTime()
{
QueryResult * result = CharacterDatabase.Query("SELECT NextDailyQuestResetTime FROM saved_variables");
if (!result)
m_NextDailyQuestReset = time_t(time(NULL)); // game time not yet init
else
m_NextDailyQuestReset = time_t((*result)[0].GetUInt64());
// generate time by config
time_t curTime = time(NULL);
tm localTm = *localtime(&curTime);
localTm.tm_hour = getConfig(CONFIG_UINT32_QUEST_DAILY_RESET_HOUR);
localTm.tm_min = 0; localTm.tm_min = 0;
localTm.tm_sec = 0; localTm.tm_sec = 0;
// current day reset time // current day reset time
time_t curDayResetTime = mktime(&localTm); time_t nextDayResetTime = mktime(&localTm);
// last reset time before current moment // next reset time before current moment
time_t resetTime = (curTime < curDayResetTime) ? curDayResetTime - DAY : curDayResetTime; if (curTime >= nextDayResetTime)
nextDayResetTime += DAY;
// need reset (if we have quest time before last reset time (not processed by some reason) // normalize reset time
if(mostRecentQuestTime && mostRecentQuestTime <= resetTime) m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
m_NextDailyQuestReset = mostRecentQuestTime;
if (!result)
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextDailyQuestResetTime) VALUES ('"UI64FMTD"')", uint64(m_NextDailyQuestReset));
else else
{ delete result;
// plan next reset time
m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime;
}
} }
void World::ResetDailyQuests() void World::ResetDailyQuests()
@ -1913,13 +1958,25 @@ void World::ResetDailyQuests()
sLog.outDetail("Daily quests reset for all characters."); sLog.outDetail("Daily quests reset for all characters.");
CharacterDatabase.Execute("DELETE FROM character_queststatus_daily"); CharacterDatabase.Execute("DELETE FROM character_queststatus_daily");
for(SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) for(SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
if(itr->second->GetPlayer()) if (itr->second->GetPlayer())
itr->second->GetPlayer()->ResetDailyQuestStatus(); itr->second->GetPlayer()->ResetDailyQuestStatus();
} }
void World::ResetWeeklyQuests()
{
sLog.outDetail("Weekly quests reset for all characters.");
CharacterDatabase.Execute("DELETE FROM character_queststatus_weekly");
for(SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
if (itr->second->GetPlayer())
itr->second->GetPlayer()->ResetWeeklyQuestStatus();
m_NextWeeklyQuestReset = time_t(m_NextWeeklyQuestReset + WEEK);
CharacterDatabase.PExecute("UPDATE saved_variables SET NextWeeklyQuestResetTime = '"UI64FMTD"'", uint64(m_NextWeeklyQuestReset));
}
void World::SetPlayerLimit( int32 limit, bool needUpdate ) void World::SetPlayerLimit( int32 limit, bool needUpdate )
{ {
if(limit < -SEC_ADMINISTRATOR) if (limit < -SEC_ADMINISTRATOR)
limit = -SEC_ADMINISTRATOR; limit = -SEC_ADMINISTRATOR;
// lock update need // lock update need
@ -1927,7 +1984,7 @@ void World::SetPlayerLimit( int32 limit, bool needUpdate )
m_playerLimit = limit; m_playerLimit = limit;
if(db_update_need) if (db_update_need)
loginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%d'",uint8(GetPlayerSecurityLimit()),realmID); loginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%d'",uint8(GetPlayerSecurityLimit()),realmID);
} }

View file

@ -148,6 +148,9 @@ enum eConfigUInt32Values
CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF, CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF,
CONFIG_UINT32_QUEST_LOW_LEVEL_HIDE_DIFF, CONFIG_UINT32_QUEST_LOW_LEVEL_HIDE_DIFF,
CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF, CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF,
CONFIG_UINT32_QUEST_DAILY_RESET_HOUR,
CONFIG_UINT32_QUEST_WEEKLY_RESET_WEEK_DAY,
CONFIG_UINT32_QUEST_WEEKLY_RESET_HOUR,
CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY, CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY,
CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK, CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK,
CONFIG_UINT32_CORPSE_DECAY_NORMAL, CONFIG_UINT32_CORPSE_DECAY_NORMAL,
@ -173,6 +176,7 @@ enum eConfigUInt32Values
CONFIG_UINT32_TIMERBAR_BREATH_MAX, CONFIG_UINT32_TIMERBAR_BREATH_MAX,
CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL, CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL,
CONFIG_UINT32_TIMERBAR_FIRE_MAX, CONFIG_UINT32_TIMERBAR_FIRE_MAX,
CONFIG_UINT32_MIN_LEVEL_STAT_SAVE,
CONFIG_UINT32_VALUE_COUNT CONFIG_UINT32_VALUE_COUNT
}; };
@ -302,6 +306,7 @@ enum eConfigBoolValues
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN, CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN,
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT, CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT,
CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET, CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET,
CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT,
CONFIG_BOOL_VALUE_COUNT CONFIG_BOOL_VALUE_COUNT
}; };
@ -319,7 +324,7 @@ enum BillingPlanFlags
SESSION_ENABLE_CAIS = 0x80, SESSION_ENABLE_CAIS = 0x80,
}; };
/// Type of server, this is values from second column of Cfg_Configs.dbc /// Type of server, this is values from second column of Cfg_Configs.dbc (1.12.1 have another numeration)
enum RealmType enum RealmType
{ {
REALM_TYPE_NORMAL = 0, REALM_TYPE_NORMAL = 0,
@ -331,7 +336,7 @@ enum RealmType
// replaced by REALM_PVP in realm list // replaced by REALM_PVP in realm list
}; };
/// This is values from first column of Cfg_Categories.dbc /// This is values from first column of Cfg_Categories.dbc (1.12.1 have another numeration)
enum RealmZone enum RealmZone
{ {
REALM_ZONE_UNKNOWN = 0, // any language REALM_ZONE_UNKNOWN = 0, // any language
@ -365,6 +370,7 @@ enum RealmZone
REALM_ZONE_QA_SERVER = 28, // any language REALM_ZONE_QA_SERVER = 28, // any language
REALM_ZONE_CN9 = 29, // basic-Latin at create, any at login REALM_ZONE_CN9 = 29, // basic-Latin at create, any at login
REALM_ZONE_TEST_SERVER_2 = 30, // any language REALM_ZONE_TEST_SERVER_2 = 30, // any language
// in 3.x
REALM_ZONE_CN10 = 31, // basic-Latin at create, any at login REALM_ZONE_CN10 = 31, // basic-Latin at create, any at login
REALM_ZONE_CTC = 32, REALM_ZONE_CTC = 32,
REALM_ZONE_CNC = 33, REALM_ZONE_CNC = 33,
@ -483,6 +489,7 @@ class World
uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); } uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); }
/// Next daily quests reset time /// Next daily quests reset time
time_t GetNextDailyQuestsResetTime() const { return m_NextDailyQuestReset; } time_t GetNextDailyQuestsResetTime() const { return m_NextDailyQuestReset; }
time_t GetNextWeeklyQuestsResetTime() const { return m_NextWeeklyQuestReset; }
/// Get the maximum skill level a player can reach /// Get the maximum skill level a player can reach
uint16 GetConfigMaxSkillValue() const uint16 GetConfigMaxSkillValue() const
@ -583,7 +590,9 @@ class World
void _UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId); void _UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId);
void InitDailyQuestResetTime(); void InitDailyQuestResetTime();
void InitWeeklyQuestResetTime();
void ResetDailyQuests(); void ResetDailyQuests();
void ResetWeeklyQuests();
private: private:
void setConfig(eConfigUInt32Values index, char const* fieldname, uint32 defvalue); void setConfig(eConfigUInt32Values index, char const* fieldname, uint32 defvalue);
void setConfig(eConfigInt32Values index, char const* fieldname, int32 defvalue); void setConfig(eConfigInt32Values index, char const* fieldname, int32 defvalue);
@ -653,6 +662,7 @@ class World
// next daily quests reset time // next daily quests reset time
time_t m_NextDailyQuestReset; time_t m_NextDailyQuestReset;
time_t m_NextWeeklyQuestReset;
//Player Queue //Player Queue
Queue m_QueuedPlayer; Queue m_QueuedPlayer;

View file

@ -1,7 +1,7 @@
##################################### #####################################
# MaNGOS Configuration file # # MaNGOS Configuration file #
##################################### #####################################
ConfVersion=2010030401 ConfVersion=2010040601
################################################################################################################### ###################################################################################################################
# CONNECTIONS AND DIRECTORIES # CONNECTIONS AND DIRECTORIES
@ -112,10 +112,20 @@ BindIP = "0.0.0.0"
# Weather update interval (in milliseconds) # Weather update interval (in milliseconds)
# Default: 600000 (10 min) # Default: 600000 (10 min)
# #
# PlayerSaveInterval # PlayerSave.Interval
# Player save interval (in milliseconds) # Player save interval (in milliseconds)
# Default: 900000 (15 min) # Default: 900000 (15 min)
# #
# PlayerSave.Stats.MinLevel
# Minimum level for saving character stats for external usage in database
# Default: 0 (do not save character stats)
# 1+ (save stats for characters with level 1+)
#
# PlayerSave.Stats.SaveOnlyOnLogout
# Enable/Disable saving of character stats only on logout
# Default: 1 (only save on logout)
# 0 (save on every player save)
#
# vmap.enableLOS # vmap.enableLOS
# vmap.enableHeight # vmap.enableHeight
# Enable/Disable VMmap support for line of sight and height calculation # Enable/Disable VMmap support for line of sight and height calculation
@ -159,6 +169,7 @@ BindIP = "0.0.0.0"
# Default: 1 (permit addon channel) # Default: 1 (permit addon channel)
# 0 (do not permit addon channel) # 0 (do not permit addon channel)
# #
#
################################################################################################################### ###################################################################################################################
UseProcessors = 0 UseProcessors = 0
@ -172,7 +183,9 @@ SocketSelectTime = 10000
GridCleanUpDelay = 300000 GridCleanUpDelay = 300000
MapUpdateInterval = 100 MapUpdateInterval = 100
ChangeWeatherInterval = 600000 ChangeWeatherInterval = 600000
PlayerSaveInterval = 900000 PlayerSave.Interval = 900000
PlayerSave.Stats.MinLevel = 0
PlayerSave.Stats.SaveOnlyOnLogout = 1
vmap.enableLOS = 0 vmap.enableLOS = 0
vmap.enableHeight = 0 vmap.enableHeight = 0
vmap.ignoreMapIds = "369" vmap.ignoreMapIds = "369"
@ -545,6 +558,18 @@ LogColors = ""
# Default: 7 # Default: 7
# -1 (show all available quests marks) # -1 (show all available quests marks)
# #
# Quests.Daily.ResetHour
# Hour when daily quests reset (0..23)
# Default: 6
#
# Quests.Weekly.ResetWeekDay
# Week day when daily quests reset (0..6) 0 == Sunday
# Default: 3
#
# Quests.Weekly.ResetHour
# Hour in one from weekly days when weekly quests reset (0..23)
# Default: 6
#
# Guild.EventLogRecordsCount # Guild.EventLogRecordsCount
# Count of guild event log records stored in guild_eventlog table # Count of guild event log records stored in guild_eventlog table
# Increase to store more guild events in table, minimum is 100 # Increase to store more guild events in table, minimum is 100
@ -672,6 +697,9 @@ Instance.ResetTimeHour = 4
Instance.UnloadDelay = 1800000 Instance.UnloadDelay = 1800000
Quests.LowLevelHideDiff = 4 Quests.LowLevelHideDiff = 4
Quests.HighLevelHideDiff = 7 Quests.HighLevelHideDiff = 7
Quests.Daily.ResetHour = 6
Quests.Weekly.ResetWeekDay = 3
Quests.Weekly.ResetHour = 6
Guild.EventLogRecordsCount = 100 Guild.EventLogRecordsCount = 100
Guild.BankEventLogRecordsCount = 25 Guild.BankEventLogRecordsCount = 25
TimerBar.Fatigue.GMLevel = 4 TimerBar.Fatigue.GMLevel = 4

View file

@ -1022,10 +1022,10 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid)
/*if(realmFlags & REALM_FLAG_SPECIFYBUILD) /*if(realmFlags & REALM_FLAG_SPECIFYBUILD)
{ {
pkt << uint8(3); // major pkt << uint8(0); // major
pkt << uint8(3); // minor pkt << uint8(0); // minor
pkt << uint8(3); // revision pkt << uint8(0); // revision
pkt << uint16(11723); // build pkt << uint16(0); // build
}*/ }*/
} }

View file

@ -164,6 +164,7 @@ enum TimeConstants
MINUTE = 60, MINUTE = 60,
HOUR = MINUTE*60, HOUR = MINUTE*60,
DAY = HOUR*24, DAY = HOUR*24,
WEEK = DAY*7,
MONTH = DAY*30, MONTH = DAY*30,
YEAR = MONTH*12, YEAR = MONTH*12,
IN_MILLISECONDS = 1000 IN_MILLISECONDS = 1000

View file

@ -191,6 +191,24 @@ inline bool isNumericOrSpace(wchar_t wchar)
return isNumeric(wchar) || wchar == L' '; return isNumeric(wchar) || wchar == L' ';
} }
inline bool isNumeric(std::string const& str)
{
for(std::string::const_iterator itr = str.begin(); itr != str.end(); ++itr)
if (!isNumeric(*itr))
return false;
return true;
}
inline bool isNumeric(std::wstring const& str)
{
for(std::wstring::const_iterator itr = str.begin(); itr != str.end(); ++itr)
if (!isNumeric(*itr))
return false;
return true;
}
inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace) inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
{ {
for(size_t i = 0; i < wstr.size(); ++i) for(size_t i = 0; i < wstr.size(); ++i)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9673" #define REVISION_NR "9688"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9661_01_characters_character_talent" #define REVISION_DB_CHARACTERS "required_9687_01_characters_character_queststatus_daily"
#define REVISION_DB_MANGOS "required_9663_01_mangos_mangos_string" #define REVISION_DB_MANGOS "required_9663_01_mangos_mangos_string"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__