mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8190] Update killing quest objectives base at creature_template KillCredit fields.
Note: for avoid double counting must be removed C++ scripts and EventAI scripts that do same thing in old way. Signed-off-by: VladimirMangos <vladimir@getmangos.com> Also implement KillCreditN field check at loading.
This commit is contained in:
parent
ad67efefad
commit
cbfbd13146
11 changed files with 49 additions and 17 deletions
|
|
@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
|
||||||
CREATE TABLE `db_version` (
|
CREATE TABLE `db_version` (
|
||||||
`version` varchar(120) default NULL,
|
`version` varchar(120) default NULL,
|
||||||
`creature_ai_version` varchar(120) default NULL,
|
`creature_ai_version` varchar(120) default NULL,
|
||||||
`required_8158_01_mangos_playercreateinfo_action` bit(1) default NULL
|
`required_8190_01_mangos_creature_template` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
@ -789,8 +789,8 @@ DROP TABLE IF EXISTS `creature_template`;
|
||||||
CREATE TABLE `creature_template` (
|
CREATE TABLE `creature_template` (
|
||||||
`entry` mediumint(8) unsigned NOT NULL default '0',
|
`entry` mediumint(8) unsigned NOT NULL default '0',
|
||||||
`heroic_entry` mediumint(8) unsigned NOT NULL default '0',
|
`heroic_entry` mediumint(8) unsigned NOT NULL default '0',
|
||||||
`unk1` int(11) UNSIGNED DEFAULT '0' NOT NULL,
|
`KillCredit1` int(11) unsigned NOT NULL default '0',
|
||||||
`unk2` int(11) UNSIGNED DEFAULT '0' NOT NULL,
|
`KillCredit2` int(11) unsigned NOT NULL default '0',
|
||||||
`modelid_A` mediumint(8) unsigned NOT NULL default '0',
|
`modelid_A` mediumint(8) unsigned NOT NULL default '0',
|
||||||
`modelid_A2` mediumint(8) unsigned NOT NULL default '0',
|
`modelid_A2` mediumint(8) unsigned NOT NULL default '0',
|
||||||
`modelid_H` mediumint(8) unsigned NOT NULL default '0',
|
`modelid_H` mediumint(8) unsigned NOT NULL default '0',
|
||||||
|
|
|
||||||
5
sql/updates/8190_01_mangos_creature_template.sql
Normal file
5
sql/updates/8190_01_mangos_creature_template.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_8158_01_mangos_playercreateinfo_action required_8190_01_mangos_creature_template bit;
|
||||||
|
|
||||||
|
ALTER TABLE `creature_template`
|
||||||
|
CHANGE COLUMN `unk1` `KillCredit1` int(11) unsigned NOT NULL default '0',
|
||||||
|
CHANGE COLUMN `unk2` `KillCredit2` int(11) unsigned NOT NULL default '0';
|
||||||
|
|
@ -244,6 +244,7 @@ pkgdata_DATA = \
|
||||||
8115_01_mangos_playercreateinfo_action.sql \
|
8115_01_mangos_playercreateinfo_action.sql \
|
||||||
8140_01_mangos_spell_proc_event.sql \
|
8140_01_mangos_spell_proc_event.sql \
|
||||||
8158_01_mangos_playercreateinfo_action.sql \
|
8158_01_mangos_playercreateinfo_action.sql \
|
||||||
|
8190_01_mangos_creature_template.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -468,4 +469,5 @@ EXTRA_DIST = \
|
||||||
8115_01_mangos_playercreateinfo_action.sql \
|
8115_01_mangos_playercreateinfo_action.sql \
|
||||||
8140_01_mangos_spell_proc_event.sql \
|
8140_01_mangos_spell_proc_event.sql \
|
||||||
8158_01_mangos_playercreateinfo_action.sql \
|
8158_01_mangos_playercreateinfo_action.sql \
|
||||||
|
8190_01_mangos_creature_template.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -152,13 +152,14 @@ enum CreatureFlagsExtra
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAX_KILL_CREDIT 2
|
||||||
|
|
||||||
// from `creature_template` table
|
// from `creature_template` table
|
||||||
struct CreatureInfo
|
struct CreatureInfo
|
||||||
{
|
{
|
||||||
uint32 Entry;
|
uint32 Entry;
|
||||||
uint32 HeroicEntry;
|
uint32 HeroicEntry;
|
||||||
uint32 unk1;
|
uint32 KillCredit[MAX_KILL_CREDIT];
|
||||||
uint32 unk2;
|
|
||||||
uint32 DisplayID_A[2];
|
uint32 DisplayID_A[2];
|
||||||
uint32 DisplayID_H[2];
|
uint32 DisplayID_H[2];
|
||||||
char* Name;
|
char* Name;
|
||||||
|
|
|
||||||
|
|
@ -4835,8 +4835,9 @@ bool ChatHandler::HandleQuestComplete(const char* args)
|
||||||
}
|
}
|
||||||
else if(creature > 0)
|
else if(creature > 0)
|
||||||
{
|
{
|
||||||
|
if(CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creature))
|
||||||
for(uint16 z = 0; z < creaturecount; ++z)
|
for(uint16 z = 0; z < creaturecount; ++z)
|
||||||
player->KilledMonster(creature,0);
|
player->KilledMonster(cInfo,0);
|
||||||
}
|
}
|
||||||
else if(creature < 0)
|
else if(creature < 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -640,6 +640,18 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
if (!displayScaleEntry)
|
if (!displayScaleEntry)
|
||||||
sLog.outErrorDb("Creature (Entry: %u) not has any existed display id in DisplayID_A/DisplayID_A2/DisplayID_H/DisplayID_H2", cInfo->Entry);
|
sLog.outErrorDb("Creature (Entry: %u) not has any existed display id in DisplayID_A/DisplayID_A2/DisplayID_H/DisplayID_H2", cInfo->Entry);
|
||||||
|
|
||||||
|
for(int k = 0; k < MAX_KILL_CREDIT; ++k)
|
||||||
|
{
|
||||||
|
if(cInfo->KillCredit[k])
|
||||||
|
{
|
||||||
|
if(!GetCreatureTemplate(cInfo->KillCredit[k]))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Creature (Entry: %u) has not existed creature entry in `KillCredit%d` (%u)",cInfo->Entry,k+1,cInfo->KillCredit[k]);
|
||||||
|
const_cast<CreatureInfo*>(cInfo)->KillCredit[k] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cInfo->unit_class && ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
|
if (cInfo->unit_class && ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
|
||||||
sLog.outErrorDb("Creature (Entry: %u) has invalid unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class);
|
sLog.outErrorDb("Creature (Entry: %u) has invalid unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13396,7 +13396,17 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
|
||||||
UpdateForQuestWorldObjects();
|
UpdateForQuestWorldObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::KilledMonster( uint32 entry, uint64 guid )
|
void Player::KilledMonster( CreatureInfo const* cInfo, uint64 guid )
|
||||||
|
{
|
||||||
|
if(cInfo->Entry)
|
||||||
|
KilledMonsterCredit(cInfo->Entry,guid);
|
||||||
|
|
||||||
|
for(int i = 0; i < MAX_KILL_CREDIT; ++i)
|
||||||
|
if(cInfo->KillCredit[i])
|
||||||
|
KilledMonsterCredit(cInfo->KillCredit[i],guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::KilledMonsterCredit( uint32 entry, uint64 guid )
|
||||||
{
|
{
|
||||||
uint32 addkillcount = 1;
|
uint32 addkillcount = 1;
|
||||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, entry, addkillcount);
|
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, entry, addkillcount);
|
||||||
|
|
@ -18914,7 +18924,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
|
||||||
{
|
{
|
||||||
// normal creature (not pet/etc) can be only in !PvP case
|
// normal creature (not pet/etc) can be only in !PvP case
|
||||||
if(pVictim->GetTypeId()==TYPEID_UNIT)
|
if(pVictim->GetTypeId()==TYPEID_UNIT)
|
||||||
pGroupGuy->KilledMonster(pVictim->GetEntry(), pVictim->GetGUID());
|
pGroupGuy->KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetGUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -18939,7 +18949,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
|
||||||
|
|
||||||
// normal creature (not pet/etc) can be only in !PvP case
|
// normal creature (not pet/etc) can be only in !PvP case
|
||||||
if(pVictim->GetTypeId()==TYPEID_UNIT)
|
if(pVictim->GetTypeId()==TYPEID_UNIT)
|
||||||
KilledMonster(pVictim->GetEntry(),pVictim->GetGUID());
|
KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetGUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return xp || honored_kill;
|
return xp || honored_kill;
|
||||||
|
|
@ -18963,11 +18973,11 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
|
||||||
|
|
||||||
// quest objectives updated only for alive group member or dead but with not released body
|
// quest objectives updated only for alive group member or dead but with not released body
|
||||||
if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
|
if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
|
||||||
pGroupGuy->KilledMonster(creature_id, creature_guid);
|
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // if (!pGroup)
|
else // if (!pGroup)
|
||||||
KilledMonster(creature_id, creature_guid);
|
KilledMonsterCredit(creature_id, creature_guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const
|
bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const
|
||||||
|
|
|
||||||
|
|
@ -1289,7 +1289,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void GroupEventHappens( uint32 questId, WorldObject const* pEventObject );
|
void GroupEventHappens( uint32 questId, WorldObject const* pEventObject );
|
||||||
void ItemAddedQuestCheck( uint32 entry, uint32 count );
|
void ItemAddedQuestCheck( uint32 entry, uint32 count );
|
||||||
void ItemRemovedQuestCheck( uint32 entry, uint32 count );
|
void ItemRemovedQuestCheck( uint32 entry, uint32 count );
|
||||||
void KilledMonster( uint32 entry, uint64 guid );
|
void KilledMonster( CreatureInfo const* cInfo, uint64 guid );
|
||||||
|
void KilledMonsterCredit( uint32 entry, uint64 guid );
|
||||||
void CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id );
|
void CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id );
|
||||||
void TalkedToCreature( uint32 entry, uint64 guid );
|
void TalkedToCreature( uint32 entry, uint64 guid );
|
||||||
void MoneyChanged( uint32 value );
|
void MoneyChanged( uint32 value );
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,8 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
|
||||||
data << uint32(ci->type); // CreatureType.dbc
|
data << uint32(ci->type); // CreatureType.dbc
|
||||||
data << uint32(ci->family); // CreatureFamily.dbc
|
data << uint32(ci->family); // CreatureFamily.dbc
|
||||||
data << uint32(ci->rank); // Creature Rank (elite, boss, etc)
|
data << uint32(ci->rank); // Creature Rank (elite, boss, etc)
|
||||||
data << uint32(ci->unk1); // new in 3.1, creature entry?
|
data << uint32(ci->KillCredit[0]); // new in 3.1, kill credit
|
||||||
data << uint32(ci->unk2); // new in 3.1, creature entry?
|
data << uint32(ci->KillCredit[1]); // new in 3.1, kill credit
|
||||||
data << uint32(ci->DisplayID_A[0]); // modelid_male1
|
data << uint32(ci->DisplayID_A[0]); // modelid_male1
|
||||||
data << uint32(ci->DisplayID_H[0]); // modelid_female1 ?
|
data << uint32(ci->DisplayID_H[0]); // modelid_female1 ?
|
||||||
data << uint32(ci->DisplayID_A[1]); // modelid_male2 ?
|
data << uint32(ci->DisplayID_A[1]); // modelid_male2 ?
|
||||||
|
|
|
||||||
|
|
@ -450,7 +450,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||||
|
|
||||||
// some critters required for quests
|
// some critters required for quests
|
||||||
if(GetTypeId() == TYPEID_PLAYER)
|
if(GetTypeId() == TYPEID_PLAYER)
|
||||||
((Player*)this)->KilledMonster(pVictim->GetEntry(),pVictim->GetGUID());
|
((Player*)this)->KilledMonster(cInfo ,pVictim->GetGUID());
|
||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8189"
|
#define REVISION_NR "8190"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue