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`;
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';
--
@ -702,7 +702,6 @@ DROP TABLE IF EXISTS `character_queststatus_daily`;
CREATE TABLE `character_queststatus_daily` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier',
`time` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`quest`),
KEY `idx_guid` (`guid`)
) 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 */;
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`
--
@ -830,6 +850,55 @@ LOCK TABLES `character_spell_cooldown` WRITE;
/*!40000 ALTER TABLE `character_spell_cooldown` ENABLE KEYS */;
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`
--
@ -1512,7 +1581,9 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `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';
--

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 \
9661_01_characters_character_talent.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
## Additional files to include when running 'make dist'
@ -184,4 +187,7 @@ EXTRA_DIST = \
9656_02_mangos_mangos_string.sql \
9661_01_characters_character_talent.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

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_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_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_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));

View file

@ -3374,7 +3374,7 @@ void ObjectMgr::LoadQuests()
// 138 139
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
if (result == NULL)
{
barGoLink bar( 1 );
bar.step();
@ -3410,7 +3410,7 @@ void ObjectMgr::LoadQuests()
// 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());
}
@ -3422,21 +3422,36 @@ void ObjectMgr::LoadQuests()
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());
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]
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.",
qinfo->GetQuestId(),j+1,id,j+1);
@ -3446,9 +3461,9 @@ void ObjectMgr::LoadQuests()
}
// 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.",
qinfo->GetQuestId(),qinfo->ZoneOrSort);
@ -3456,30 +3471,30 @@ void ObjectMgr::LoadQuests()
}
}
// client quest log visual (sort case)
if( qinfo->ZoneOrSort < 0 )
if (qinfo->ZoneOrSort < 0)
{
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.",
qinfo->GetQuestId(),qinfo->ZoneOrSort);
// no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check)
}
//check SkillOrClass value (class case).
if( ClassByQuestSort(-int32(qinfo->ZoneOrSort)) )
if (ClassByQuestSort(-int32(qinfo->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.",
qinfo->GetQuestId(),qinfo->ZoneOrSort,qinfo->SkillOrClass);
}
}
//check for proper SkillOrClass value (skill case)
if(int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
{
// skill is positive value in SkillOrClass
if(qinfo->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).",
qinfo->GetQuestId(),qinfo->ZoneOrSort,skill_id);
@ -3489,34 +3504,34 @@ void ObjectMgr::LoadQuests()
}
// 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",
qinfo->GetQuestId(),qinfo->SkillOrClass,-qinfo->SkillOrClass);
}
}
// 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",
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.",
qinfo->GetQuestId(),qinfo->RequiredSkillValue,sWorld.GetConfigMaxSkillValue());
// 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.",
qinfo->GetQuestId(),qinfo->RequiredSkillValue,qinfo->SkillOrClass);
@ -3525,63 +3540,63 @@ void ObjectMgr::LoadQuests()
}
// 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.",
qinfo->GetQuestId(),qinfo->RepObjectiveFaction,qinfo->RepObjectiveFaction);
// 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.",
qinfo->GetQuestId(),qinfo->RequiredMinRepFaction,qinfo->RequiredMinRepFaction);
// 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.",
qinfo->GetQuestId(),qinfo->RequiredMaxRepFaction,qinfo->RequiredMaxRepFaction);
// 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.",
qinfo->GetQuestId(),qinfo->RequiredMinRepValue,ReputationMgr::Reputation_Cap);
// 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.",
qinfo->GetQuestId(),qinfo->RequiredMaxRepValue,qinfo->RequiredMinRepValue);
// 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",
qinfo->GetQuestId(),qinfo->RepObjectiveValue);
// 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",
qinfo->GetQuestId(),qinfo->RequiredMinRepValue);
// 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",
qinfo->GetQuestId(),qinfo->RequiredMaxRepValue);
// 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.",
qinfo->GetQuestId(),qinfo->GetCharTitleId(),qinfo->GetCharTitleId());
@ -3589,38 +3604,38 @@ void ObjectMgr::LoadQuests()
// 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.",
qinfo->GetQuestId(),qinfo->SrcItemId,qinfo->SrcItemId);
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.",
qinfo->GetQuestId(),qinfo->SrcItemId);
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.",
qinfo->GetQuestId(),qinfo->SrcItemCount);
qinfo->SrcItemCount=0; // no quest work changes in fact
}
if(qinfo->SrcSpell)
if (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.",
qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell);
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.",
qinfo->GetQuestId(),qinfo->SrcSpell,qinfo->SrcSpell);
@ -3630,10 +3645,9 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j )
{
uint32 id = qinfo->ReqItemId[j];
if(id)
if (uint32 id = qinfo->ReqItemId[j])
{
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.",
qinfo->GetQuestId(), j+1, id, j+1);
@ -3642,14 +3656,14 @@ void ObjectMgr::LoadQuests()
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.",
qinfo->GetQuestId(), j+1, id, id);
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.",
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 )
{
uint32 id = qinfo->ReqSourceId[j];
if(id)
if (uint32 id = qinfo->ReqSourceId[j])
{
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.",
qinfo->GetQuestId(),j+1,id,id);
@ -3671,7 +3684,7 @@ void ObjectMgr::LoadQuests()
}
else
{
if(qinfo->ReqSourceCount[j]>0)
if (qinfo->ReqSourceCount[j]>0)
{
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = 0 but `ReqSourceCount%d` = %u.",
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 )
{
uint32 id = qinfo->ReqSpell[j];
if(id)
if (uint32 id = qinfo->ReqSpell[j])
{
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.",
qinfo->GetQuestId(),j+1,id,id);
continue;
}
if(!qinfo->ReqCreatureOrGOId[j])
if (!qinfo->ReqCreatureOrGOId[j])
{
bool found = false;
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);
@ -3729,34 +3741,34 @@ void ObjectMgr::LoadQuests()
for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++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.",
qinfo->GetQuestId(),j+1,id,uint32(-id));
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.",
qinfo->GetQuestId(),j+1,id,uint32(id));
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
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.",
qinfo->GetQuestId(),j+1,id,j+1);
// 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.",
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 )
{
uint32 id = qinfo->RewChoiceItemId[j];
if(id)
if (uint32 id = qinfo->RewChoiceItemId[j])
{
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.",
qinfo->GetQuestId(),j+1,id,id);
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.",
qinfo->GetQuestId(),j+1,id,j+1);
// 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.",
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 )
{
uint32 id = qinfo->RewItemId[j];
if(id)
if (uint32 id = qinfo->RewItemId[j])
{
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.",
qinfo->GetQuestId(),j+1,id,id);
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.",
qinfo->GetQuestId(),j+1,id,j+1);
// 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.",
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);
if(!spellInfo)
if (!spellInfo)
{
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->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.",
qinfo->GetQuestId(),qinfo->RewSpell,qinfo->RewSpell);
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.",
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);
if(!spellInfo)
if (!spellInfo)
{
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->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.",
qinfo->GetQuestId(),qinfo->RewSpellCast,qinfo->RewSpellCast);
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.",
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()));
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()));
if(qinfo->LimitTime)
if (qinfo->LimitTime)
qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED);
}
@ -3959,12 +3969,12 @@ void ObjectMgr::LoadQuests()
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
if(!spellInfo)
if (!spellInfo)
continue;
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;
uint32 quest_id = spellInfo->EffectMiscValue[j];
@ -3972,10 +3982,10 @@ void ObjectMgr::LoadQuests()
Quest const* quest = GetQuestTemplate(quest_id);
// some quest referenced in spells not exist (outdated spells)
if(!quest)
if (!quest)
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);

View file

@ -390,7 +390,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_currentBuybackSlot = BUYBACK_SLOT_START;
m_DailyQuestChanged = false;
m_lastDailyQuestTime = 0;
m_WeeklyQuestChanged = false;
for (int i=0; i<MAX_TIMERS; ++i)
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
@ -1139,7 +1139,7 @@ void Player::Update( uint32 p_time )
if (!m_timedquests.empty())
{
std::set<uint32>::iterator iter = m_timedquests.begin();
QuestSet::iterator iter = m_timedquests.begin();
while (iter != m_timedquests.end())
{
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_queststatus 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_skills 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:
ApplySpellPowerBonus(int32(val), apply);
break;
case ITEM_MOD_BLOCK_VALUE:
HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply);
break;
// depricated item mods
case ITEM_MOD_FERAL_ATTACK_POWER:
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);
sLog.outDebug("+ %u SPELL_POWER", enchant_amount);
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_SPELL_HEALING_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);
// 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)
else if (pQuest->IsAutoComplete() && pQuest->IsRepeatable() && !pQuest->IsDaily())
else if (pQuest->IsAutoComplete() && pQuest->IsRepeatable() && !pQuest->IsDailyOrWeekly())
PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanCompleteRepeatableQuest(pQuest), true);
else
PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, guid, true);
@ -13003,7 +13010,7 @@ bool Player::CanSeeStartQuest( Quest const *pQuest )
if( SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) &&
SatisfyQuestExclusiveGroup( pQuest, false ) && SatisfyQuestReputation( 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();
}
@ -13018,7 +13025,7 @@ bool Player::CanTakeQuest( Quest const *pQuest, bool msg )
&& SatisfyQuestSkillOrClass( pQuest, msg ) && SatisfyQuestReputation( pQuest, msg )
&& SatisfyQuestPreviousQuest( pQuest, msg ) && SatisfyQuestTimed( 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 )
@ -13130,15 +13137,15 @@ bool Player::CanCompleteRepeatableQuest( Quest const *pQuest )
bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
{
// 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;
// daily quest can't be rewarded (25 daily quest already completed)
if(!SatisfyQuestDay(pQuest,true))
if (!SatisfyQuestDay(pQuest,true) || !SatisfyQuestWeek(pQuest,true))
return false;
// rewarded and not repeatable quest (only cheating case, then ignore without message)
if(GetQuestRewardStatus(pQuest->GetQuestId()))
if (GetQuestRewardStatus(pQuest->GetQuestId()))
return false;
// 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
if(pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) )
if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) )
return false;
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);
}
if (pQuest->IsWeekly())
SetWeeklyQuestStatus(quest_id);
if (!pQuest->IsRepeatable())
SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);
else
@ -13734,7 +13744,7 @@ bool Player::SatisfyQuestTimed(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
if(qInfo->GetExclusiveGroup() <= 0)
if (qInfo->GetExclusiveGroup() <= 0)
return true;
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;
// skip checked quest id, only state of other quests in group is interesting
if(exclude_Id == qInfo->GetQuestId())
if (exclude_Id == qInfo->GetQuestId())
continue;
// not allow have daily quest if daily quest from exclusive group already recently completed
Quest const* Nquest = sObjectMgr.GetQuestTemplate(exclude_Id);
if( !SatisfyQuestDay(Nquest, false) )
if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false))
{
if( msg )
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 );
// alternative quest already started or completed
if( i_exstatus != mQuestStatus.end()
&& (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE) )
if (i_exstatus != mQuestStatus.end()
&& (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE))
{
if( msg )
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 )
{
if(!qInfo->IsDaily())
if (!qInfo->IsDaily())
return true;
bool have_slot = false;
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);
if(qInfo->GetQuestId()==id)
if (qInfo->GetQuestId()==id)
return false;
if(!id)
have_slot = true;
}
if(!have_slot)
if (!have_slot)
{
if( msg )
SendCanTakeQuestResponse( INVALIDREASON_DAILY_QUESTS_REMAINING );
@ -13854,10 +13864,19 @@ bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg )
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 )
{
uint32 srcitem = pQuest->GetSrcItemId();
if( srcitem > 0 )
if (srcitem > 0)
{
uint32 count = pQuest->GetSrcItemCount();
if( count <= 0 )
@ -13865,14 +13884,14 @@ bool Player::GiveQuestSourceItem( Quest const *pQuest )
ItemPosCountVec dest;
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);
SendNewItem(item, count, true, false);
return true;
}
// 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;
else
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
_LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS));
_LoadDailyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS));
_LoadWeeklyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS));
_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)
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)
{
@ -15919,9 +15939,6 @@ void Player::_LoadDailyQuestStatus(QueryResult *result)
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);
if( !pQuest )
continue;
@ -15939,6 +15956,35 @@ void Player::_LoadDailyQuestStatus(QueryResult *result)
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)
{
//QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'",GetGUIDLow());
@ -16517,13 +16563,14 @@ void Player::SaveToDB()
CharacterDatabase.Execute( ss.str().c_str() );
if(m_mailsUpdated) //save mails only when needed
if (m_mailsUpdated) //save mails only when needed
_SaveMail();
_SaveBGData();
_SaveInventory();
_SaveQuestStatus();
_SaveDailyQuestStatus();
_SaveWeeklyQuestStatus();
_SaveSpells();
_SaveSpellCooldowns();
_SaveActions();
@ -16538,8 +16585,13 @@ void Player::SaveToDB()
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).
if(Pet* pet = GetPet())
if (Pet* pet = GetPet())
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
}
@ -16821,21 +16873,36 @@ void Player::_SaveQuestStatus()
void Player::_SaveDailyQuestStatus()
{
if(!m_DailyQuestChanged)
if (!m_DailyQuestChanged)
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.
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)
if(GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest,time) VALUES ('%u', '%u','" UI64FMTD "')",
GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx),uint64(m_lastDailyQuestTime));
if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest) VALUES ('%u', '%u')",
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()
{
@ -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
{
if(!sLog.IsOutDebug()) // optimize disabled debug output
@ -18591,7 +18692,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
if(i == slot)
continue;
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)
{
@ -19497,13 +19598,18 @@ void Player::SetDailyQuestStatus( uint32 quest_id )
if(!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx,quest_id);
m_lastDailyQuestTime = time(NULL); // last daily quest time
m_DailyQuestChanged = true;
break;
}
}
}
void Player::SetWeeklyQuestStatus( uint32 quest_id )
{
m_weeklyquests.insert(quest_id);
m_WeeklyQuestChanged = true;
}
void Player::ResetDailyQuestStatus()
{
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
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
@ -21593,9 +21708,11 @@ void Player::ActivateSpec(uint8 specNum)
// remove any talent rank if talent not listed in temp spec
if (iterTempSpec == tempSpec.end() || iterTempSpec->second.state == PLAYERSPELL_REMOVED)
{
TalentEntry const *talentInfo = talent.m_talentEntry;
for(int r = 0; r < MAX_TALENT_RANK; ++r)
if (talent.m_talentEntry->RankID[r])
removeSpell(talent.m_talentEntry->RankID[r],!IsPassiveSpell(talent.m_talentEntry->RankID[r]),false);
if (talentInfo->RankID[r])
removeSpell(talentInfo->RankID[r],!IsPassiveSpell(talentInfo->RankID[r]),false);
specIter = m_talents[m_activeSpec].begin();
}

View file

@ -910,7 +910,8 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADMAILS = 23,
PLAYER_LOGIN_QUERY_LOADMAILEDITEMS = 24,
PLAYER_LOGIN_QUERY_LOADTALENTS = 25,
MAX_PLAYER_LOGIN_QUERY = 26
PLAYER_LOGIN_QUERY_LOADWEKLYQUESTSTATUS = 26,
MAX_PLAYER_LOGIN_QUERY = 27
};
enum PlayerDelayedOperations
@ -1349,6 +1350,7 @@ class MANGOS_DLL_SPEC Player : public Unit
bool SatisfyQuestNextChain( Quest const* qInfo, bool msg );
bool SatisfyQuestPrevChain( 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 TakeQuestSourceItem( uint32 quest_id, bool msg );
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 SetDailyQuestStatus( uint32 quest_id );
void SetWeeklyQuestStatus( uint32 quest_id );
void ResetDailyQuestStatus();
void ResetWeeklyQuestStatus();
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); }
@ -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.
std::set<uint32> m_timedquests;
typedef std::set<uint32> QuestSet;
QuestSet m_timedquests;
QuestSet m_weeklyquests;
uint64 m_divider;
uint32 m_ingametime;
@ -2333,6 +2339,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void _LoadMailedItems(QueryResult *result);
void _LoadQuestStatus(QueryResult *result);
void _LoadDailyQuestStatus(QueryResult *result);
void _LoadWeeklyQuestStatus(QueryResult *result);
void _LoadGroup(QueryResult *result);
void _LoadSkills(QueryResult *result);
void _LoadSpells(QueryResult *result);
@ -2356,12 +2363,14 @@ class MANGOS_DLL_SPEC Player : public Unit
void _SaveMail();
void _SaveQuestStatus();
void _SaveDailyQuestStatus();
void _SaveWeeklyQuestStatus();
void _SaveSkills();
void _SaveSpells();
void _SaveEquipmentSets();
void _SaveBGData();
void _SaveGlyphs();
void _SaveTalents();
void _SaveStats();
void _SetCreateBits(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;
bool m_DailyQuestChanged;
time_t m_lastDailyQuestTime;
bool m_WeeklyQuestChanged;
uint32 m_drunkTimer;
uint16 m_drunk;

View file

@ -240,6 +240,7 @@ class Quest
uint32 GetFlags() const { return QuestFlags; }
bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; }
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; }
// multiple values

View file

@ -610,7 +610,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32
result2 = DIALOG_STATUS_REWARD_REP;
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;
else
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_UNK4 0x00000010 // 4
#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_UNK8 0x00000100 // 8 not set in 3.0.3
#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_UNK15 0x00008000 // 15 not set in 3.0.3
#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_NOT_NEED_SHAPESHIFT 0x00080000 // 19 does not necessarly need shapeshift
#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_UNK5 0x00000020 // 5
#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_UNK9 0x00000200 // 9
#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_USE_NORMAL_MOVEMENT_SPEED = 191,
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_FOR_SPELL = 195,
SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
@ -294,7 +294,7 @@ enum AuraType
SPELL_AURA_CONVERT_RUNE = 249,
SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
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_DISARM_SHIELD = 254,
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::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
&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, //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)
@ -302,7 +302,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
&Aura::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
&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::HandleNULL, //254 SPELL_AURA_MOD_DISARM_SHIELD disarm Shield
&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)
{
case SPELL_DAMAGE_CLASS_RANGED:
case SPELL_DAMAGE_CLASS_MELEE:
return MeleeSpellHitResult(pVictim, spell);
case SPELL_DAMAGE_CLASS_NONE:
return SPELL_MISS_NONE;
case SPELL_DAMAGE_CLASS_MAGIC:
return MagicSpellHitResult(pVictim, spell);
case SPELL_DAMAGE_CLASS_MELEE:
case SPELL_DAMAGE_CLASS_RANGED:
return MeleeSpellHitResult(pVictim, spell);
}
return SPELL_MISS_NONE;
}
@ -8575,17 +8576,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
{
SpellEntry const* spellProto = (*itr).second->GetSpellProto();
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);
}
else
++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)
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
Unit::AuraList const& ttw = GetAurasByType(SPELL_AURA_DUMMY);

View file

@ -89,6 +89,7 @@ World::World()
m_maxQueuedSessionCount = 0;
m_resultQueue = NULL;
m_NextDailyQuestReset = 0;
m_NextWeeklyQuestReset = 0;
m_scheduledScripts = 0;
m_defaultDbcLocale = LOCALE_enUS;
@ -516,7 +517,9 @@ void World::LoadConfigSettings(bool reload)
setConfigMinMax(CONFIG_UINT32_COMPRESSION, "Compression", 1, 1, 9);
setConfig(CONFIG_BOOL_ADDON_CHANNEL, "AddonChannel", 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);
if (reload)
@ -675,6 +678,10 @@ void World::LoadConfigSettings(bool reload)
if (getConfig(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_RESTRICTED_LFG_CHANNEL, "Channel.RestrictedLfg", true);
@ -1265,6 +1272,9 @@ void World::SetInitialWorldSettings()
sLog.outString("Calculate next daily quest reset time..." );
InitDailyQuestResetTime();
sLog.outString("Calculate next weekly quest reset time..." );
InitWeeklyQuestResetTime();
sLog.outString("Starting objects Pooling system..." );
sPoolMgr.Initialize();
@ -1327,20 +1337,29 @@ void World::Update(uint32 diff)
{
///- Update the different timers
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);
else m_timers[i].SetCurrent(0);
else
m_timers[i].SetCurrent(0);
}
///- Update the game time and check for shutdown time
_UpdateGameTime();
/// Handle daily quests reset time
if(m_gameTime > m_NextDailyQuestReset)
if (m_gameTime > m_NextDailyQuestReset)
{
ResetDailyQuests();
m_NextDailyQuestReset += DAY;
}
if(m_gameTime > m_NextWeeklyQuestReset)
{
ResetWeeklyQuests();
m_NextWeeklyQuestReset += WEEK;
}
/// <ul><li> Handle auctions when the timer has 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 MAX(time) FROM character_queststatus_daily");
if(result)
{
Field *fields = result->Fetch();
mostRecentQuestTime = (time_t)fields[0].GetUInt64();
delete result;
}
QueryResult * result = CharacterDatabase.Query("SELECT NextWeeklyQuestResetTime FROM saved_variables");
if (!result)
m_NextWeeklyQuestReset = time_t(time(NULL)); // game time not yet init
else
mostRecentQuestTime = 0;
m_NextWeeklyQuestReset = time_t((*result)[0].GetUInt64());
// client built-in time for reset is 6:00 AM
// FIX ME: client not show day start time
// generate time by config
time_t curTime = time(NULL);
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_sec = 0;
// current day reset time
time_t curDayResetTime = mktime(&localTm);
time_t nextDayResetTime = mktime(&localTm);
// last reset time before current moment
time_t resetTime = (curTime < curDayResetTime) ? curDayResetTime - DAY : curDayResetTime;
// next reset time before current moment
if (curTime >= nextDayResetTime)
nextDayResetTime += DAY;
// need reset (if we have quest time before last reset time (not processed by some reason)
if(mostRecentQuestTime && mostRecentQuestTime <= resetTime)
m_NextDailyQuestReset = mostRecentQuestTime;
// normalize reset time
m_NextDailyQuestReset = m_NextDailyQuestReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
if (!result)
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextDailyQuestResetTime) VALUES ('"UI64FMTD"')", uint64(m_NextDailyQuestReset));
else
{
// plan next reset time
m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime;
}
delete result;
}
void World::ResetDailyQuests()
@ -1913,13 +1958,25 @@ void World::ResetDailyQuests()
sLog.outDetail("Daily quests reset for all characters.");
CharacterDatabase.Execute("DELETE FROM character_queststatus_daily");
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();
}
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 )
{
if(limit < -SEC_ADMINISTRATOR)
if (limit < -SEC_ADMINISTRATOR)
limit = -SEC_ADMINISTRATOR;
// lock update need
@ -1927,7 +1984,7 @@ void World::SetPlayerLimit( int32 limit, bool needUpdate )
m_playerLimit = limit;
if(db_update_need)
if (db_update_need)
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_QUEST_LOW_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_KICK,
CONFIG_UINT32_CORPSE_DECAY_NORMAL,
@ -173,6 +176,7 @@ enum eConfigUInt32Values
CONFIG_UINT32_TIMERBAR_BREATH_MAX,
CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL,
CONFIG_UINT32_TIMERBAR_FIRE_MAX,
CONFIG_UINT32_MIN_LEVEL_STAT_SAVE,
CONFIG_UINT32_VALUE_COUNT
};
@ -302,6 +306,7 @@ enum eConfigBoolValues
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN,
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT,
CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET,
CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT,
CONFIG_BOOL_VALUE_COUNT
};
@ -319,7 +324,7 @@ enum BillingPlanFlags
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
{
REALM_TYPE_NORMAL = 0,
@ -331,7 +336,7 @@ enum RealmType
// 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
{
REALM_ZONE_UNKNOWN = 0, // any language
@ -365,6 +370,7 @@ enum RealmZone
REALM_ZONE_QA_SERVER = 28, // any language
REALM_ZONE_CN9 = 29, // basic-Latin at create, any at login
REALM_ZONE_TEST_SERVER_2 = 30, // any language
// in 3.x
REALM_ZONE_CN10 = 31, // basic-Latin at create, any at login
REALM_ZONE_CTC = 32,
REALM_ZONE_CNC = 33,
@ -483,6 +489,7 @@ class World
uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); }
/// Next daily quests reset time
time_t GetNextDailyQuestsResetTime() const { return m_NextDailyQuestReset; }
time_t GetNextWeeklyQuestsResetTime() const { return m_NextWeeklyQuestReset; }
/// Get the maximum skill level a player can reach
uint16 GetConfigMaxSkillValue() const
@ -583,7 +590,9 @@ class World
void _UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId);
void InitDailyQuestResetTime();
void InitWeeklyQuestResetTime();
void ResetDailyQuests();
void ResetWeeklyQuests();
private:
void setConfig(eConfigUInt32Values index, char const* fieldname, uint32 defvalue);
void setConfig(eConfigInt32Values index, char const* fieldname, int32 defvalue);
@ -653,6 +662,7 @@ class World
// next daily quests reset time
time_t m_NextDailyQuestReset;
time_t m_NextWeeklyQuestReset;
//Player Queue
Queue m_QueuedPlayer;

View file

@ -1,7 +1,7 @@
#####################################
# MaNGOS Configuration file #
#####################################
ConfVersion=2010030401
ConfVersion=2010040601
###################################################################################################################
# CONNECTIONS AND DIRECTORIES
@ -112,10 +112,20 @@ BindIP = "0.0.0.0"
# Weather update interval (in milliseconds)
# Default: 600000 (10 min)
#
# PlayerSaveInterval
# PlayerSave.Interval
# Player save interval (in milliseconds)
# 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.enableHeight
# 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)
# 0 (do not permit addon channel)
#
#
###################################################################################################################
UseProcessors = 0
@ -172,7 +183,9 @@ SocketSelectTime = 10000
GridCleanUpDelay = 300000
MapUpdateInterval = 100
ChangeWeatherInterval = 600000
PlayerSaveInterval = 900000
PlayerSave.Interval = 900000
PlayerSave.Stats.MinLevel = 0
PlayerSave.Stats.SaveOnlyOnLogout = 1
vmap.enableLOS = 0
vmap.enableHeight = 0
vmap.ignoreMapIds = "369"
@ -545,6 +558,18 @@ LogColors = ""
# Default: 7
# -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
# Count of guild event log records stored in guild_eventlog table
# Increase to store more guild events in table, minimum is 100
@ -672,6 +697,9 @@ Instance.ResetTimeHour = 4
Instance.UnloadDelay = 1800000
Quests.LowLevelHideDiff = 4
Quests.HighLevelHideDiff = 7
Quests.Daily.ResetHour = 6
Quests.Weekly.ResetWeekDay = 3
Quests.Weekly.ResetHour = 6
Guild.EventLogRecordsCount = 100
Guild.BankEventLogRecordsCount = 25
TimerBar.Fatigue.GMLevel = 4

View file

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

View file

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

View file

@ -191,6 +191,24 @@ inline bool isNumericOrSpace(wchar_t wchar)
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)
{
for(size_t i = 0; i < wstr.size(); ++i)

View file

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

View file

@ -1,6 +1,6 @@
#ifndef __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_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__