From a38078d0c2766e18581099bd1e42118cd55a1919 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 26 Dec 2008 14:21:42 +0300 Subject: [PATCH 01/48] Some 308 changes --- src/game/AddonHandler.cpp | 65 ++++++++++++++++++++++++++------------- src/game/GossipDef.cpp | 10 ++++-- src/game/Spell.cpp | 26 +++++++++++----- 3 files changed, 69 insertions(+), 32 deletions(-) diff --git a/src/game/AddonHandler.cpp b/src/game/AddonHandler.cpp index 1f557dd9e..df2ed01a0 100644 --- a/src/game/AddonHandler.cpp +++ b/src/game/AddonHandler.cpp @@ -64,63 +64,84 @@ bool AddonHandler::BuildAddonPacket(WorldPacket *Source, WorldPacket *Target) if (Source->rpos() + 4 > Source->size()) return false; - *Source >> TempValue; //get real size of the packed structure + *Source >> TempValue; // get real size of the packed structure // empty addon packet, nothing process, can't be received from real client if(!TempValue) return false; - AddonRealSize = TempValue; //temp value because ZLIB only excepts uLongf + AddonRealSize = TempValue; // temp value because ZLIB only excepts uLongf - CurrentPosition = Source->rpos(); //get the position of the pointer in the structure + CurrentPosition = Source->rpos(); // get the position of the pointer in the structure - AddOnPacked.resize(AddonRealSize); //resize target for zlib action + AddOnPacked.resize(AddonRealSize); // resize target for zlib action if (!uncompress(const_cast(AddOnPacked.contents()), &AddonRealSize, const_cast((*Source).contents() + CurrentPosition), (*Source).size() - CurrentPosition)!= Z_OK) { Target->Initialize(SMSG_ADDON_INFO); - while(AddOnPacked.rpos() < AddOnPacked.size()) + uint32 addonsCount; + AddOnPacked >> addonsCount; // addons count? + + for(uint32 i = 0; i < addonsCount; ++i) { - std::string AddonNames; - uint8 unk6; - uint32 crc, unk7; + std::string addonName; + uint8 enabled; + uint32 crc, unk2; // check next addon data format correctness - if(AddOnPacked.rpos()+1+4+4+1 > AddOnPacked.size()) + if(AddOnPacked.rpos()+1 > AddOnPacked.size()) return false; - AddOnPacked >> AddonNames; + AddOnPacked >> addonName; // recheck next addon data format correctness - if(AddOnPacked.rpos()+4+4+1 > AddOnPacked.size()) + if(AddOnPacked.rpos()+1+4+4 > AddOnPacked.size()) return false; - AddOnPacked >> crc >> unk7 >> unk6; + AddOnPacked >> enabled >> crc >> unk2; - //sLog.outDebug("ADDON: Name:%s CRC:%x Unknown1 :%x Unknown2 :%x", AddonNames.c_str(), crc, unk7, unk6); + sLog.outDebug("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2); - *Target << (uint8)2; + uint8 state = (enabled ? 2 : 1); + *Target << uint8(state); - uint8 unk1 = 1; - *Target << (uint8)unk1; + uint8 unk1 = (enabled ? 1 : 0); + *Target << uint8(unk1); if (unk1) { - uint8 unk2 = crc != 0x1c776d01LL; //If addon is Standard addon CRC - *Target << (uint8)unk2; + uint8 unk2 = (crc != 0x4c1c776d); // If addon is Standard addon CRC + *Target << uint8(unk2); if (unk2) Target->append(tdata, sizeof(tdata)); - *Target << (uint32)0; + *Target << uint32(0); } - uint8 unk3 = 0; - *Target << (uint8)unk3; + uint8 unk3 = (enabled ? 0 : 1); + *Target << uint8(unk3); if (unk3) { - // String, 256 + // String, 256 (null terminated?) + *Target << uint8(0); } } + + uint32 unk4; + AddOnPacked >> unk4; + + uint32 count = 0; + *Target << uint32(count); + /*for(uint32 i = 0; i < count; ++i) + { + uint32 + string (16 bytes) + string (16 bytes) + uint32 + }*/ + + if(AddOnPacked.rpos() != AddOnPacked.size()) + sLog.outDebug("packet under read!"); } else { diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index c61ab5e10..1f186f965 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -593,11 +593,17 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) data << uint32(pQuest->ReqCreatureOrGOId[iI]); } data << uint32(pQuest->ReqCreatureOrGOCount[iI]); - data << uint32(pQuest->ReqItemId[iI]); - data << uint32(pQuest->ReqItemCount[iI]); + //data << uint32(pQuest->ReqItemId[iI]); + //data << uint32(pQuest->ReqItemCount[iI]); data << uint32(0); // added in WotLK, dunno if offset if correct } + for (iI = 0; iI < 5; ++iI) // items? + { + data << uint32(0); + data << uint32(0); + } + for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; iI++) data << ObjectiveText[iI]; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f94b22121..d33c3010b 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -170,7 +170,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if(!readGUID(*data, m_unitTargetGUID)) return false; - if( m_targetMask & ( TARGET_FLAG_OBJECT | TARGET_FLAG_OBJECT_UNK )) + if( m_targetMask & ( TARGET_FLAG_OBJECT )) if(!readGUID(*data, m_GOTargetGUID)) return false; @@ -178,6 +178,10 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if(!readGUID(*data, m_itemTargetGUID)) return false; + if( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) + if(!readGUID(*data, m_CorpseTargetGUID)) + return false; + if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) { if(data->rpos()+4+4+4 > data->size()) @@ -190,7 +194,10 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_DEST_LOCATION ) { - if(data->rpos()+4+4+4 > data->size()) + if(data->rpos()+1+4+4+4 > data->size()) + return false; + + if(!readGUID(*data, m_unitTargetGUID)) return false; *data >> m_destX >> m_destY >> m_destZ; @@ -206,10 +213,6 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) *data >> m_strTarget; } - if( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) - if(!readGUID(*data, m_CorpseTargetGUID)) - return false; - // find real units/GOs Update(caster); return true; @@ -219,7 +222,7 @@ void SpellCastTargets::write ( WorldPacket * data ) { *data << uint32(m_targetMask); - if( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_OBJECT_UNK | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2 ) ) + if( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2 ) ) { if(m_targetMask & TARGET_FLAG_UNIT) { @@ -228,7 +231,7 @@ void SpellCastTargets::write ( WorldPacket * data ) else *data << uint8(0); } - else if( m_targetMask & ( TARGET_FLAG_OBJECT | TARGET_FLAG_OBJECT_UNK ) ) + else if( m_targetMask & TARGET_FLAG_OBJECT ) { if(m_GOTarget) data->append(m_GOTarget->GetPackGUID()); @@ -253,7 +256,14 @@ void SpellCastTargets::write ( WorldPacket * data ) *data << m_srcX << m_srcY << m_srcZ; if( m_targetMask & TARGET_FLAG_DEST_LOCATION ) + { + if(m_unitTarget) + data->append(m_unitTarget->GetPackGUID()); + else + *data << uint8(0); + *data << m_destX << m_destY << m_destZ; + } if( m_targetMask & TARGET_FLAG_STRING ) *data << m_strTarget; From 7a5b2f2d7b273a743b15d2aa678764926b7da5f3 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Tue, 13 Jan 2009 20:07:31 +0300 Subject: [PATCH 02/48] Updated opcodes enum, client build number --- src/game/Opcodes.cpp | 7 +++++++ src/game/Opcodes.h | 9 ++++++++- src/realmd/AuthCodes.h | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 928b85ec9..3c4b276ce 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1216,4 +1216,11 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4A3*/ { "SMSG_SERVER_BUCK_DATA_START", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4A4*/ { "CMSG_QUERY_VEHICLE_STATUS", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4A5*/ { "SMSG_PET_GUIDS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4A6*/ { "SMSG_CLIENTCACHE_VERSION", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4A7*/ { "UMSG_UNKNOWN_1191", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4A8*/ { "UMSG_UNKNOWN_1192", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4A9*/ { "UMSG_UNKNOWN_1193", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4AA*/ { "UMSG_UNKNOWN_1194", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4AB*/ { "UMSG_UNKNOWN_1195", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4AC*/ { "UMSG_UNKNOWN_1196", STATUS_NEVER, &WorldSession::Handle_NULL }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 124a03c68..9ff83f852 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1224,7 +1224,14 @@ enum Opcodes SMSG_SERVER_BUCK_DATA_START = 0x4A3, CMSG_QUERY_VEHICLE_STATUS = 0x4A4, SMSG_PET_GUIDS = 0x4A5, - NUM_MSG_TYPES = 0x4A6 + SMSG_CLIENTCACHE_VERSION = 0x4A6, + UMSG_UNKNOWN_1191 = 0x4A7, + UMSG_UNKNOWN_1192 = 0x4A8, + UMSG_UNKNOWN_1193 = 0x4A9, + UMSG_UNKNOWN_1194 = 0x4AA, + UMSG_UNKNOWN_1195 = 0x4AB, + UMSG_UNKNOWN_1196 = 0x4AC, + NUM_MSG_TYPES = 0x4AD }; /// Player state diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 68e10b25c..ff52987b3 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // we need to stick to 1 version or half of the stuff will work for someone // others will not and opposite -// will only support WoW, WoW:TBC and WoW:WotLK 3.0.3 client build 9183... +// will only support WoW, WoW:TBC and WoW:WotLK 3.0.8 client build 9438... -#define EXPECTED_MANGOS_CLIENT_BUILD {9183, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {9438, 0} #endif From b5ba359186f1a0481a4516bf203d4bb9cf5ca1cc Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 21 Jan 2009 11:00:54 +0300 Subject: [PATCH 03/48] Updated client build --- src/realmd/AuthCodes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 89f4cf90b..b8af975c5 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // we need to stick to 1 version or half of the stuff will work for someone // others will not and opposite -// will only support WoW, WoW:TBC and WoW:WotLK 3.0.8 client build 9438... +// will only support WoW, WoW:TBC and WoW:WotLK 3.0.8 client build 9464... -#define EXPECTED_MANGOS_CLIENT_BUILD {9438, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {9464, 0} #endif From 2c2abc42f62a8e5a2a255cd876528db3e399a5e7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 21 Jan 2009 15:33:53 +0300 Subject: [PATCH 04/48] [7134] Make reqirement for DB data for non-player explicit discovery spell optional. --- src/game/LootMgr.cpp | 7 ++++++- src/game/SpellEffects.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index e5ffbbaec..85a4b83cf 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -1277,7 +1277,12 @@ void LoadLootTemplates_Spell() continue; if(!ids_set.count(spell_id)) - LootTemplates_Spell.ReportNotExistedId(spell_id); + { + // not report about not trainable spells (optionally supported by DB) + // 61756 (Northrend Inscription Research (FAST QA VERSION) for example + if(spellInfo->Attributes & SPELL_ATTR_UNK5) + LootTemplates_Spell.ReportNotExistedId(spell_id); + } else ids_set.erase(spell_id); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index d009e299a..17a70ef0e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4839,11 +4839,11 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 60893: // Northrend Alchemy Research case 61177: // Northrend Inscription Research case 61288: // Minor Inscription Research - case 61756: // Northrend Inscription Research (FAST QA VERSION) + case 61756: // Northrend Inscription Research (FAST QA VERSION) { if(!IsExplicitDiscoverySpell(m_spellInfo)) { - sLog.outError("Wrong explicit discowry spell %u structure, or outdated...",m_spellInfo->Id); + sLog.outError("Wrong explicit discovery spell %u structure, or outdated...",m_spellInfo->Id); return; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index bd694f788..c802c75e8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7133" + #define REVISION_NR "7134" #endif // __REVISION_NR_H__ From f0932d70c5c515c6e38df57c5d1cea08f748eb7f Mon Sep 17 00:00:00 2001 From: GriffonHeart Date: Wed, 21 Jan 2009 16:58:12 +0300 Subject: [PATCH 05/48] [7135] Implement support for single taxi master with different path for teams. Side effect: quest taxi flights (without mount id provided) will impossible start from normal taxi master. But for its expected starting from scripts. Signed-off-by: VladimirMangos --- src/game/ObjectMgr.cpp | 4 ++-- src/game/ObjectMgr.h | 2 +- src/game/TaxiHandler.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 3b86397a9..a227e1ab3 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4752,7 +4752,7 @@ void ObjectMgr::LoadAreaTriggerScripts() sLog.outString( ">> Loaded %u areatrigger scripts", count ); } -uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid ) +uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team ) { bool found = false; float dist; @@ -4761,7 +4761,7 @@ uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid ) for(uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i) { TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i); - if(node && node->map_id == mapid) + if(node && node->map_id == mapid && node->MountCreatureID[team == ALLIANCE ? 1 : 0]) { float dist2 = (node->x - x)*(node->x - x)+(node->y - y)*(node->y - y)+(node->z - z)*(node->z - z); if(found) diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index b8b75f0ba..355d8e5ef 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -409,7 +409,7 @@ class ObjectMgr uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const; uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const; - uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid ); + uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team ); void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); uint16 GetTaxiMount( uint32 id, uint32 team ); void GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector& mapIds ); diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index ac8f21542..b8aa614db 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -54,7 +54,7 @@ void WorldSession::SendTaxiStatus( uint64 guid ) return; } - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId()); + uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); // not found nearest if(curloc == 0) @@ -101,7 +101,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data ) void WorldSession::SendTaxiMenu( Creature* unit ) { // find current node - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId()); + uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); if ( curloc == 0 ) return; @@ -134,7 +134,7 @@ void WorldSession::SendDoFlight( uint16 MountId, uint32 path, uint32 pathNode ) bool WorldSession::SendLearnNewTaxiNode( Creature* unit ) { // find current node - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId()); + uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); if ( curloc == 0 ) return true; // `true` send to avoid WorldSession::SendTaxiMenu call with one more curlock seartch with same false result. diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c802c75e8..cbeadd2b7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7134" + #define REVISION_NR "7135" #endif // __REVISION_NR_H__ From 32f3331679c53a1c2fcf88be8c8c9966b2bc0964 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 07:08:38 +0300 Subject: [PATCH 06/48] [7168] Spell shift-link and command improvements. * Support Htrade shift link (it created by client at click by crafting profession spell icon in spellbook) in spell comands. * Support "all" second arg for .learn for learning not provided spell id but it's all ranks. * Drop support range for .unlearn command but support instead "all" second arg for unlearn not specific spell id but it's all ranks. * In .list auras output print spell names as shift links for better readable view. * Add to beggining Chat.cpp lists all supported by commands shift-links (client generated and server-side) --- sql/mangos.sql | 6 +- sql/updates/7168_01_mangos_command.sql | 6 ++ sql/updates/Makefile.am | 2 + src/game/Chat.cpp | 71 ++++++++++---- src/game/Chat.h | 2 + src/game/Level3.cpp | 131 +++++++++++++------------ src/game/Player.cpp | 10 ++ src/game/Player.h | 1 + src/shared/revision_nr.h | 2 +- 9 files changed, 148 insertions(+), 83 deletions(-) create mode 100644 sql/updates/7168_01_mangos_command.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 207e227d4..b2f26f539 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -22,7 +22,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, - `required_7156_01_mangos_spell_proc_event` bit(1) default NULL + `required_7168_01_mangos_command` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -322,7 +322,7 @@ INSERT INTO `command` VALUES ('instance savedata',3,'Syntax: .instance savedata\r\n Save the InstanceData for the current player\'s map to the DB.'), ('itemmove',2,'Syntax: .itemmove #sourceslotid #destinationslotid\r\n\r\nMove an item from slots #sourceslotid to #destinationslotid in your inventory\r\n\r\nNot yet implemented'), ('kick',2,'Syntax: .kick [$charactername]\r\n\r\nKick the given character name from the world. If no character name is provided then the selected player (except for yourself) will be kicked.'), -('learn',3,'Syntax: .learn #parameter\r\n\r\nSelected character learn a spell of id #parameter.'), +('learn',3,'Syntax: .learn #spell [all]\r\n\r\nSelected character learn a spell of id #spell. If \'all\' provided then all ranks learned.'), ('learn all',3,'Syntax: .learn all\r\n\r\nLearn all big set different spell maybe useful for Administaror.'), ('learn all_crafts',2,'Syntax: .learn crafts\r\n\r\nLearn all professions and recipes.'), ('learn all_default',1,'Syntax: .learn all_default [$playername]\r\n\r\nLearn for selected/$playername player all default spells for his race/class and spells rewarded by completed quests.'), @@ -464,7 +464,7 @@ INSERT INTO `command` VALUES ('unban account',3,'Syntax is: unban account $Name\r\nUnban accounts for account name pattern.'), ('unban character',3,'Syntax is: unban character $Name\r\nUnban accounts for character name pattern.'), ('unban ip',3,'Syntax is: unban ip $Ip\r\nUnban accounts for IP pattern.'), -('unlearn',3,'Syntax: .unlearn #startspell #endspell\r\n\r\nUnlearn for selected player the range of spells between id #startspell and #endspell. If no #endspell is provided, just unlearn spell of id #startspell.'), +('unlearn',3,'Syntax: .unlearn #spell [all]\r\n\r\nUnlearn for selected player a spell #spell. If \'all\' provided then all ranks unlearned.'), ('unmute',1,'Syntax: .unmute $playerName\r\n\r\nRestore chat messaging for any character from account of character $playerName.'), ('waterwalk',2,'Syntax: .waterwalk on/off\r\n\r\nSet on/off waterwalk state for selected player.'), ('wchange',3,'Syntax: .wchange #weathertype #status\r\n\r\nSet current weather to #weathertype with an intensity of #status.\r\n\r\n#weathertype can be 1 for rain, 2 for snow, and 3 for sand. #status can be 0 for disabled, and 1 for enabled.'), diff --git a/sql/updates/7168_01_mangos_command.sql b/sql/updates/7168_01_mangos_command.sql new file mode 100644 index 000000000..67bbd5e31 --- /dev/null +++ b/sql/updates/7168_01_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_7156_01_mangos_spell_proc_event required_7168_01_mangos_command bit; + +DELETE FROM `command` WHERE `name` IN ('learn','unlearn'); +INSERT INTO `command` VALUES +('learn',3,'Syntax: .learn #spell [all]\r\n\r\nSelected character learn a spell of id #spell. If \'all\' provided then all ranks learned.'), +('unlearn',3,'Syntax: .unlearn #spell [all]\r\n\r\nUnlearn for selected player a spell #spell. If \'all\' provided then all ranks unlearned.'); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 28315cb65..4819d0cf9 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -150,6 +150,7 @@ pkgdata_DATA = \ 7149_01_mangos_spell_proc_event.sql \ 7150_01_mangos_playercreateinfo_spell.sql \ 7156_01_mangos_spell_proc_event.sql \ + 7168_01_mangos_command.sql \ README ## Additional files to include when running 'make dist' @@ -280,4 +281,5 @@ EXTRA_DIST = \ 7149_01_mangos_spell_proc_event.sql \ 7150_01_mangos_playercreateinfo_spell.sql \ 7156_01_mangos_spell_proc_event.sql \ + 7168_01_mangos_command.sql \ README diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 88522c802..8bbb8da3d 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -33,6 +33,22 @@ #include "CellImpl.h" #include "AccountMgr.h" +// Supported shift-links (client generated and server side) +// |color|Harea:area_id|h[name]|h|r +// |color|Hcreature:creature_guid|h[name]|h|r +// |color|Hcreature_entry:creature_id|h[name]|h|r +// |color|Hgameevent:id|h[name]|h|r +// |color|Hgameobject:go_guid|h[name]|h|r +// |color|Hgameobject_entry:go_id|h[name]|h|r +// |color|Hitem:item_id:perm_ench_id:0:0|h[name]|h|r +// |color|Hitemset:itemset_id|h[name]|h|r +// |color|Hquest:quest_id|h[name]|h|r +// |color|Hskill:skill_id|h[name]|h|r +// |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell icon shift-click +// |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click +// |color|Htele:id|h[name]|h|r +// |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click + bool ChatHandler::load_command_table = true; ChatCommand * ChatHandler::getCommandTable() @@ -1236,9 +1252,18 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid return obj; } -static char const* const spellTalentKeys[] = { - "Hspell", - "Htalent", +enum SpellLinkType +{ + SPELL_LINK_SPELL = 0, + SPELL_LINK_TALENT = 1, + SPELL_LINK_TRADE = 2 +}; + +static char const* const spellKeys[] = +{ + "Hspell", // normal spell + "Htalent", // talent spell + "Htrade", // profession/skill spell 0 }; @@ -1246,31 +1271,41 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) { // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r // number or [name] Shift-click form |color|Htalent:talent_id,rank|h[name]|h|r + // number or [name] Shift-click form |color|Htrade:spell_id,skill_id,max_value,cur_value|h[name]|h|r int type = 0; - char* rankS = NULL; - char* idS = extractKeyFromLink(text,spellTalentKeys,&type,&rankS); + char* param1_str = NULL; + char* idS = extractKeyFromLink(text,spellKeys,&type,¶m1_str); if(!idS) return 0; uint32 id = (uint32)atol(idS); - // spell - if(type==0) - return id; + switch(type) + { + case SPELL_LINK_SPELL: + return id; + case SPELL_LINK_TALENT: + { + // talent + TalentEntry const* talentEntry = sTalentStore.LookupEntry(id); + if(!talentEntry) + return 0; - // talent - TalentEntry const* talentEntry = sTalentStore.LookupEntry(id); - if(!talentEntry) - return 0; + int32 rank = param1_str ? (uint32)atol(param1_str) : 0; + if(rank >= 5) + return 0; - int32 rank = rankS ? (uint32)atol(rankS) : 0; - if(rank >= 5) - return 0; + if(rank < 0) + rank = 0; - if(rank < 0) - rank = 0; + return talentEntry->RankID[rank]; + } + case SPELL_LINK_TRADE: + return id; + } - return talentEntry->RankID[rank]; + // unknown type? + return 0; } GameTele const* ChatHandler::extractGameTeleFromLink(char* text) diff --git a/src/game/Chat.h b/src/game/Chat.h index 13d044892..bf731cada 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -442,8 +442,10 @@ class ChatHandler Player* getSelectedPlayer(); Creature* getSelectedCreature(); Unit* getSelectedUnit(); + char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL); char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL); + uint32 extractSpellIdFromLink(char* text); GameTele const* extractGameTeleFromLink(char* text); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 8ab22b392..a24461cfa 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -876,7 +876,7 @@ bool ChatHandler::HandleSetSkillCommand(const char* args) { // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r char* skill_p = extractKeyFromLink((char*)args,"Hskill"); - if(!skill_p) + if(!skill_p) return false; char *level_p = strtok (NULL, " "); @@ -887,7 +887,6 @@ bool ChatHandler::HandleSetSkillCommand(const char* args) char *max_p = strtok (NULL, " "); int32 skill = atoi(skill_p); - if (skill <= 0) { PSendSysMessage(LANG_INVALID_SKILL_ID, skill); @@ -937,27 +936,12 @@ bool ChatHandler::HandleUnLearnCommand(const char* args) return false; // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r - uint32 min_id = extractSpellIdFromLink((char*)args); - if(!min_id) + uint32 spell_id = extractSpellIdFromLink((char*)args); + if(!spell_id) return false; - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r - char* tail = strtok(NULL,""); - - uint32 max_id = extractSpellIdFromLink(tail); - - if (!max_id) - { - // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r - max_id = min_id+1; - } - else - { - if (max_id < min_id) - std::swap(min_id,max_id); - - max_id=max_id+1; - } + char const* allStr = strtok(NULL," "); + bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; Player* target = getSelectedPlayer(); if(!target) @@ -967,13 +951,13 @@ bool ChatHandler::HandleUnLearnCommand(const char* args) return false; } - for(uint32 spell=min_id;spellHasSpell(spell)) - target->removeSpell(spell); - else - SendSysMessage(LANG_FORGET_SPELL); - } + if(allRanks) + spell_id = spellmgr.GetFirstSpellInChain (spell_id); + + if (target->HasSpell(spell_id)) + target->removeSpell(spell_id); + else + SendSysMessage(LANG_FORGET_SPELL); return true; } @@ -1733,16 +1717,6 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/) return true; } -static void learnAllHighRanks(Player* player, uint32 spellid) -{ - SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); - for(SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spellid); itr != nextMap.upper_bound(spellid); ++itr) - { - player->learnSpell(itr->second,false); - learnAllHighRanks(player,itr->second); - } -} - bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/) { Player* player = m_session->GetPlayer(); @@ -1780,11 +1754,8 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/) if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) continue; - // learn highest rank of talent - player->learnSpell(spellid,false); - - // and learn all non-talent spell ranks (recursive by tree) - learnAllHighRanks(player,spellid); + // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree) + player->learnSpellHighRank(spellid); } SendSysMessage(LANG_COMMAND_LEARN_CLASS_TALENTS); @@ -1851,15 +1822,8 @@ bool ChatHandler::HandleLearnCommand(const char* args) if(!spell || !sSpellStore.LookupEntry(spell)) return false; - if (targetPlayer->HasSpell(spell)) - { - if(targetPlayer == m_session->GetPlayer()) - SendSysMessage(LANG_YOU_KNOWN_SPELL); - else - PSendSysMessage(LANG_TARGET_KNOWN_SPELL,targetPlayer->GetName()); - SetSentErrorMessage(true); - return false; - } + char const* allStr = strtok(NULL," "); + bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer())) @@ -1869,7 +1833,20 @@ bool ChatHandler::HandleLearnCommand(const char* args) return false; } - targetPlayer->learnSpell(spell,false); + if (!allRanks && targetPlayer->HasSpell(spell)) + { + if(targetPlayer == m_session->GetPlayer()) + SendSysMessage(LANG_YOU_KNOWN_SPELL); + else + PSendSysMessage(LANG_TARGET_KNOWN_SPELL,targetPlayer->GetName()); + SetSentErrorMessage(true); + return false; + } + + if(allRanks) + targetPlayer->learnSpellHighRank(spell); + else + targetPlayer->learnSpell(spell,false); return true; } @@ -4244,11 +4221,28 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/) for (Unit::AuraMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr) { bool talent = GetTalentSpellCost(itr->second->GetId()) > 0; - PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffIndex(), - itr->second->GetModifier()->m_auraname, itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(), - itr->second->GetSpellProto()->SpellName[m_session->GetSessionDbcLocale()], - (itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), - IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID())); + + char const* name = itr->second->GetSpellProto()->SpellName[m_session->GetSessionDbcLocale()]; + + if (m_session) + { + std::ostringstream ss_name; + ss_name << "|cffffffff|Hspell:" << itr->second->GetId() << "|h[" << name << "]|h|r"; + + PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffIndex(), + itr->second->GetModifier()->m_auraname, itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(), + ss_name.str().c_str(), + (itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), + IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID())); + } + else + { + PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffIndex(), + itr->second->GetModifier()->m_auraname, itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(), + name, + (itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), + IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID())); + } } for (int i = 0; i < TOTAL_AURAS; i++) { @@ -4258,9 +4252,24 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/) for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) { bool talent = GetTalentSpellCost((*itr)->GetId()) > 0; - PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), - (*itr)->GetSpellProto()->SpellName[m_session->GetSessionDbcLocale()],((*itr)->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), - IS_PLAYER_GUID((*itr)->GetCasterGUID()) ? "player" : "creature",GUID_LOPART((*itr)->GetCasterGUID())); + + char const* name = (*itr)->GetSpellProto()->SpellName[m_session->GetSessionDbcLocale()]; + + if (m_session) + { + std::ostringstream ss_name; + ss_name << "|cffffffff|Hspell:" << (*itr)->GetId() << "|h[" << name << "]|h|r"; + + PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), + ss_name.str().c_str(),((*itr)->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), + IS_PLAYER_GUID((*itr)->GetCasterGUID()) ? "player" : "creature",GUID_LOPART((*itr)->GetCasterGUID())); + } + else + { + PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), + name,((*itr)->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), + IS_PLAYER_GUID((*itr)->GetCasterGUID()) ? "player" : "creature",GUID_LOPART((*itr)->GetCasterGUID())); + } } } return true; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 36573c593..d8ef17804 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19485,3 +19485,13 @@ bool Player::IsAllowUseFlyMountsHere() const uint32 v_map = GetVirtualMapForMapAndZone(GetMapId(), GetZoneId()); return v_map == 530 || v_map == 571 && HasSpell(54197); } + +void Player::learnSpellHighRank(uint32 spellid) +{ + learnSpell(spellid,false); + + SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); + for(SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spellid); itr != nextMap.upper_bound(spellid); ++itr) + learnSpellHighRank(itr->second); +} + diff --git a/src/game/Player.h b/src/game/Player.h index f613b096c..114fcf4b8 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1490,6 +1490,7 @@ class MANGOS_DLL_SPEC Player : public Unit void learnDefaultSpells(); void learnQuestRewardedSpells(); void learnQuestRewardedSpells(Quest const* quest); + void learnSpellHighRank(uint32 spellid); uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); } void SetFreeTalentPoints(uint32 points) { SetUInt32Value(PLAYER_CHARACTER_POINTS1,points); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f2edd74cf..b97be40b7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7167" + #define REVISION_NR "7168" #endif // __REVISION_NR_H__ From b398c3d6b4e6c3bdccbe634b9305073c3f4f0e94 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 08:30:53 +0300 Subject: [PATCH 07/48] [7169] Fixed use castable trainer spells (some from its explictly self-castable). --- src/game/NPCHandler.cpp | 22 ++++++++++------------ src/shared/revision_nr.h | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index db021e0ed..972d0846d 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -240,24 +240,22 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) _player->ModifyMoney( -int32(nSpellCost) ); + WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); // visual effect on trainer + data << uint64(guid) << uint32(0xB3); + SendPacket(&data); + + data.Initialize(SMSG_PLAY_SPELL_IMPACT, 12); // visual effect on player + data << uint64(_player->GetGUID()) << uint32(0x016A); + SendPacket(&data); + // learn explicitly or cast explicitly if(trainer_spell->IsCastable ()) //FIXME: prof. spell entry in trainer list not marked gray until list re-open. - unit->CastSpell(_player,trainer_spell->spell,true); + _player->CastSpell(_player,trainer_spell->spell,true); else - { - WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); // visual effect on trainer - data << uint64(guid) << uint32(0xB3); - SendPacket(&data); - - data.Initialize(SMSG_PLAY_SPELL_IMPACT, 12); // visual effect on player - data << uint64(_player->GetGUID()) << uint32(0x016A); - SendPacket(&data); - _player->learnSpell(spellId,false); - } - WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, 12); + data.Initialize(SMSG_TRAINER_BUY_SUCCEEDED, 12); data << uint64(guid) << uint32(trainer_spell->spell); SendPacket(&data); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b97be40b7..9b3c225a8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7168" + #define REVISION_NR "7169" #endif // __REVISION_NR_H__ From 0834f0e74825d74a35991394e205e3efdbd3f4ca Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 10:00:59 +0300 Subject: [PATCH 08/48] [7170] Implement special default skill levels for created DK character. --- src/game/Player.cpp | 89 +++++++++++++++++++++++++--------------- src/game/Player.h | 3 +- src/shared/revision_nr.h | 2 +- 3 files changed, 59 insertions(+), 35 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d8ef17804..98320918e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14389,24 +14389,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) SetUInt32Value(PLAYER_TRACK_CREATURES, 0 ); SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 ); - // reset skill modifiers and set correct unlearn flags - for (uint32 i = 0; i < PLAYER_MAX_SKILLS; i++) - { - SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0); - - // set correct unlearn bit - uint32 id = GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF; - if(!id) continue; - - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(id); - if(!pSkill) continue; - - // enable unlearn button for primary professions only - if (pSkill->categoryId == SKILL_CATEGORY_PROFESSION) - SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id,1)); - else - SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id,0)); - } + _LoadSkills(); // make sure the unit is considered out of combat for proper loading ClearInCombat(); @@ -14447,7 +14430,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // after spell and quest load InitTalentForLevel(); - learnSkillRewardedSpells(); learnDefaultSpells(); _LoadTutorials(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTUTORIALS)); @@ -18360,20 +18342,6 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value ) } } -void Player::learnSkillRewardedSpells() -{ - for (uint16 i=0; i < PLAYER_MAX_SKILLS; i++) - { - if(!GetUInt32Value(PLAYER_SKILL_INDEX(i))) - continue; - - uint32 pskill = SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_INDEX(i))); - uint32 vskill = SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i))); - - learnSkillRewardedSpells(pskill, vskill); - } -} - void Player::SendAurasForTarget(Unit *target) { if(target->GetVisibleAuras()->empty()) // speedup things @@ -19495,3 +19463,58 @@ void Player::learnSpellHighRank(uint32 spellid) learnSpellHighRank(itr->second); } +void Player::_LoadSkills() +{ + // Note: skill data itself loaded from `data` field. This is only cleanup part of load + + // reset skill modifiers and set correct unlearn flags + for (uint32 i = 0; i < PLAYER_MAX_SKILLS; i++) + { + SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0); + + // set correct unlearn bit + uint32 id = GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF; + if(!id) continue; + + SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(id); + if(!pSkill) continue; + + // enable unlearn button for primary professions only + if (pSkill->categoryId == SKILL_CATEGORY_PROFESSION) + SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id,1)); + else + SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id,0)); + + uint32 vskill = SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i))); + + learnSkillRewardedSpells(id, vskill); + } + + // special settings + if(getClass()==CLASS_DEATH_KNIGHT) + { + uint32 base_level = std::min(getLevel(),sWorld.getConfig (CONFIG_START_HEROIC_PLAYER_LEVEL)); + if(base_level < 1) + base_level = 1; + uint32 base_skill = (base_level-1)*5; // 270 at starting level 55 + if(base_skill < 1) + base_skill = 1; // skill mast be known and then > 0 in any case + + if(GetPureSkillValue (SKILL_FIRST_AID) < base_skill) + SetSkill(SKILL_FIRST_AID,base_skill, base_skill); + if(GetPureSkillValue (SKILL_AXES) < base_skill) + SetSkill(SKILL_AXES, base_skill,base_skill); + if(GetPureSkillValue (SKILL_DEFENSE) < base_skill) + SetSkill(SKILL_DEFENSE, base_skill,base_skill); + if(GetPureSkillValue (SKILL_POLEARMS) < base_skill) + SetSkill(SKILL_POLEARMS, base_skill,base_skill); + if(GetPureSkillValue (SKILL_SWORDS) < base_skill) + SetSkill(SKILL_SWORDS, base_skill,base_skill); + if(GetPureSkillValue (SKILL_2H_AXES) < base_skill) + SetSkill(SKILL_2H_AXES, base_skill,base_skill); + if(GetPureSkillValue (SKILL_2H_SWORDS) < base_skill) + SetSkill(SKILL_2H_SWORDS, base_skill,base_skill); + if(GetPureSkillValue (SKILL_UNARMED) < base_skill) + SetSkill(SKILL_UNARMED, base_skill,base_skill); + } +} diff --git a/src/game/Player.h b/src/game/Player.h index 114fcf4b8..f7c42337e 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1343,6 +1343,7 @@ class MANGOS_DLL_SPEC Player : public Unit /*********************************************************/ bool LoadFromDB(uint32 guid, SqlQueryHolder *holder); + bool MinimalLoadFromDB(QueryResult *result, uint32 guid); static bool LoadValuesArrayFromDB(Tokens& data,uint64 guid); static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index); @@ -1773,7 +1774,6 @@ class MANGOS_DLL_SPEC Player : public Unit int16 GetSkillTempBonusValue(uint32 skill) const; bool HasSkill(uint32 skill) const; void learnSkillRewardedSpells(uint32 id, uint32 value); - void learnSkillRewardedSpells(); void SetDontMove(bool dontMove); bool GetDontMove() const { return m_dontMove; } @@ -2245,6 +2245,7 @@ class MANGOS_DLL_SPEC Player : public Unit void _LoadDailyQuestStatus(QueryResult *result); void _LoadGroup(QueryResult *result); void _LoadReputation(QueryResult *result); + void _LoadSkills(); void _LoadSpells(QueryResult *result); void _LoadTutorials(QueryResult *result); void _LoadFriendList(QueryResult *result); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9b3c225a8..9dd29c959 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7169" + #define REVISION_NR "7170" #endif // __REVISION_NR_H__ From 6c5d69965fb9e29bed7b4834c9bbb73351bad17c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 10:18:15 +0300 Subject: [PATCH 09/48] [7171] "Implement" SPELL_AURA_SCREEN_EFFECT (260). In fact not required code, just comments. --- src/game/SpellAuraDefines.h | 2 +- src/game/SpellAuras.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index be56a1dc5..06fd3509c 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -302,7 +302,7 @@ enum AuraType SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS = 257, SPELL_AURA_258 = 258, SPELL_AURA_259 = 259, - SPELL_AURA_260 = 260, + SPELL_AURA_SCREEN_EFFECT = 260, SPELL_AURA_261 = 261, SPELL_AURA_262 = 262, SPELL_AURA_ALLOW_ONLY_ABILITY = 263, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index bc5c10b99..ec9efb81f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -310,7 +310,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNULL, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select &Aura::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL &Aura::HandleNULL, //259 corrupt healing over time spell - &Aura::HandleNULL, //260 + &Aura::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code &Aura::HandleNULL, //261 out of phase? &Aura::HandleNULL, //262 &Aura::HandleNULL, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilites set in SpellClassMask diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9dd29c959..46dc3ace2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7170" + #define REVISION_NR "7171" #endif // __REVISION_NR_H__ From f4f6e428fbd0aea7e3ad7ea37f6dd764246a3719 Mon Sep 17 00:00:00 2001 From: GriffonHeart Date: Sun, 25 Jan 2009 10:43:43 +0300 Subject: [PATCH 10/48] [7172] Implement area requirements for spell 54119. Signed-off-by: VladimirMangos --- src/game/Player.cpp | 7 +++++++ src/game/SpellMgr.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 98320918e..f2c0c4fd3 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19012,6 +19012,13 @@ void Player::UpdateAreaDependentAuras( uint32 newArea ) if( !HasAura(51721,0) ) CastSpell(this,51721,true); break; + // Mist of the Kvaldir + case 4028: //Riplash Strand + case 4029: //Riplash Ruins + case 4106: //Garrosh's Landing + case 4031: //Pal'ea + CastSpell(this,54119,true); + break; } } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 7414c20b8..4b316e5cb 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2379,6 +2379,8 @@ uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,u case 51721: // Dominion Over Acherus case 54055: // Dominion Over Acherus return area_id == 4281 || area_id == 4342 ? 0 : SPELL_FAILED_INCORRECT_AREA; + case 54119: // Mist of the Kvaldir + return area_id == 4028 || area_id == 4029 || area_id == 4106 || area_id == 4031 ? 0 : SPELL_FAILED_INCORRECT_AREA; } return 0; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 46dc3ace2..82e51efbf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7171" + #define REVISION_NR "7172" #endif // __REVISION_NR_H__ From 3f16f7c13940a1f87985ed8171dd3691762f05be Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 16:19:10 +0300 Subject: [PATCH 11/48] [7173] Some fixes for resent spell learn/unlearn system changes. * Fixed profession unlearn using skill unlearn button in skill list * Update action bar to spell low rank at unlearn spell only for .unlearn command. This will avoid show unexpected "Learned spell" chat message for low rank at unlearing high rank and at all ranks unlearning. --- src/game/Level3.cpp | 2 +- src/game/Player.cpp | 34 ++++++++++++++++++---------------- src/game/Player.h | 2 +- src/shared/revision_nr.h | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index a24461cfa..1063d6be4 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -955,7 +955,7 @@ bool ChatHandler::HandleUnLearnCommand(const char* args) spell_id = spellmgr.GetFirstSpellInChain (spell_id); if (target->HasSpell(spell_id)) - target->removeSpell(spell_id); + target->removeSpell(spell_id,false,!allRanks); else SendSysMessage(LANG_FORGET_SPELL); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f2c0c4fd3..ae58e8b7c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2696,10 +2696,6 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if(!rankSpellId || rankSpellId==spell_id) continue; - // skip unknown ranks - if(!HasSpell(rankSpellId)) - continue; - removeSpell(rankSpellId); } } @@ -2943,7 +2939,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent) GetSession()->SendPacket(&data); } -void Player::removeSpell(uint32 spell_id, bool disabled) +void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_for_low_rank) { PlayerSpellMap::iterator itr = m_spells.find(spell_id); if (itr == m_spells.end()) @@ -3079,13 +3075,13 @@ void Player::removeSpell(uint32 spell_id, bool disabled) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); - // if talent then lesser rank also talen and need learn + // if talent then lesser rank also talent and need learn if(talentCosts) learnSpell (prev_id,false); - // if ranked non-stackable spell: need activate lesser rank and update dendence state + // if ranked non-stackable spell: need activate lesser rank and update dendence state else if(cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) { - // need manually update dependence state (learn spell ignore like attempts) + // need manually update dependence state (learn spell ignore like attempts) PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id); if (prev_itr != m_spells.end()) { @@ -3101,12 +3097,15 @@ void Player::removeSpell(uint32 spell_id, bool disabled) { if(addSpell(prev_id,true,false,prev_itr->second->dependent,prev_itr->second->disabled)) { - // downgrade spell ranks in spellbook and action bar - WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); - data << uint16(spell_id); - data << uint16(prev_id); - GetSession()->SendPacket( &data ); - prev_activate = true; + if(update_action_bar_for_low_rank) + { + // downgrade spell ranks in spellbook and action bar + WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); + data << uint16(spell_id); + data << uint16(prev_id); + GetSession()->SendPacket( &data ); + prev_activate = true; + } } } } @@ -5107,8 +5106,11 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),0); SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0); - // remove spells that depend on this skill when removing the skill - learnSkillRewardedSpells(id, 0); + // remove all spells that related to this skill + for (uint32 j=0; jskillId==id) + removeSpell(spellmgr.GetFirstSpellInChain(pAbility->spellId)); } } else if(currVal) //add diff --git a/src/game/Player.h b/src/game/Player.h index f7c42337e..d6ec3e289 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1486,7 +1486,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendInitialSpells(); bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled); void learnSpell(uint32 spell_id, bool dependent); - void removeSpell(uint32 spell_id, bool disabled = false); + void removeSpell(uint32 spell_id, bool disabled = false, bool update_action_bar_for_low_rank = false); void resetSpells(); void learnDefaultSpells(); void learnQuestRewardedSpells(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 82e51efbf..8ac3891dc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7172" + #define REVISION_NR "7173" #endif // __REVISION_NR_H__ From 0d40cb4348f4154cbe9e8b047fac436783032935 Mon Sep 17 00:00:00 2001 From: Gorlum13 Date: Sun, 25 Jan 2009 16:23:53 +0300 Subject: [PATCH 12/48] [7174] Implement new option GM.Visible for set original GM visibility state at login. Signed-off-by: VladimirMangos --- src/game/Player.cpp | 11 +++++++++++ src/game/World.cpp | 1 + src/game/World.h | 1 + src/mangosd/mangosd.conf.dist.in | 7 +++++++ src/shared/revision_nr.h | 2 +- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ae58e8b7c..350be0a6a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14535,6 +14535,17 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) break; } + switch(sWorld.getConfig(CONFIG_GM_VISIBLE_STATE)) + { + default: + case 0: SetGMVisible(false); break; // invisible + case 1: break; // visible + case 2: // save state + if(extraflags & PLAYER_EXTRA_GM_INVISIBLE) + SetGMVisible(false); + break; + } + switch(sWorld.getConfig(CONFIG_GM_ACCEPT_TICKETS)) { default: diff --git a/src/game/World.cpp b/src/game/World.cpp index e7bfc2e7a..5f72785e3 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -778,6 +778,7 @@ void World::LoadConfigSettings(bool reload) } m_configs[CONFIG_GM_LOGIN_STATE] = sConfig.GetIntDefault("GM.LoginState", 2); + m_configs[CONFIG_GM_VISIBLE_STATE] = sConfig.GetIntDefault("GM.Visible", 2); m_configs[CONFIG_GM_ACCEPT_TICKETS] = sConfig.GetIntDefault("GM.AcceptTickets", 2); m_configs[CONFIG_GM_CHAT] = sConfig.GetIntDefault("GM.Chat", 2); m_configs[CONFIG_GM_WISPERING_TO] = sConfig.GetIntDefault("GM.WhisperingTo", 2); diff --git a/src/game/World.h b/src/game/World.h index dc4210685..19ec4e921 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -122,6 +122,7 @@ enum WorldConfigs CONFIG_MAX_PRIMARY_TRADE_SKILL, CONFIG_MIN_PETITION_SIGNS, CONFIG_GM_LOGIN_STATE, + CONFIG_GM_VISIBLE_STATE, CONFIG_GM_ACCEPT_TICKETS, CONFIG_GM_CHAT, CONFIG_GM_WISPERING_TO, diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 0f897d45a..e8b916ce8 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -833,6 +833,12 @@ Channel.SilentlyGMJoin = 0 # 0 (disable) # 1 (enable) # +# GM.Visible +# GM visibility at login +# Default: 2 (last save state) +# 0 (invisible) +# 1 (visible) +# # GM.AcceptTickets # Is GM accepting tickets from player by default or not. # Default: 2 (last save state) @@ -883,6 +889,7 @@ Channel.SilentlyGMJoin = 0 ################################################################################################################### GM.LoginState = 2 +GM.Visible = 2 GM.AcceptTickets = 2 GM.Chat = 2 GM.WhisperingTo = 2 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8ac3891dc..18686ea5d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7173" + #define REVISION_NR "7174" #endif // __REVISION_NR_H__ From b827e0f2c3a6eef349318dbbaf53a240bca6768b Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 25 Jan 2009 17:31:17 +0300 Subject: [PATCH 13/48] Restore some spells animation Signed-off-by: DiSlord --- src/game/Spell.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 62d362287..657d75ac0 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1566,7 +1566,14 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) }break; case TARGET_CASTER_COORDINATES: { - m_targets.setDestination(m_targets.m_srcX, m_targets.m_srcY, m_targets.m_srcZ); + // Check original caster is GO - set its coordinates as dst cast + WorldObject *caster = NULL; + if (m_originalCasterGUID) + caster = ObjectAccessor::GetGameObject(*m_caster, m_originalCasterGUID); + if (!caster) + caster = m_caster; + // Set dest for targets + m_targets.setDestination(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()); }break; case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER: { @@ -2038,18 +2045,6 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) m_spellState = SPELL_STATE_PREPARING; - if (!(m_targets.m_targetMask & TARGET_FLAG_SOURCE_LOCATION)) - { - // Check original caster is GO - set its coordinates as src cast - WorldObject *caster = NULL; - if (m_originalCasterGUID) - caster = ObjectAccessor::GetGameObject(*m_caster, m_originalCasterGUID); - if (!caster) - caster = m_caster; - // Set cast source for targets - m_targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()); - } - m_castPositionX = m_caster->GetPositionX(); m_castPositionY = m_caster->GetPositionY(); m_castPositionZ = m_caster->GetPositionZ(); From 7d90c7eb87f53309c3f5095dfc76ee098a65f818 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 25 Jan 2009 17:35:53 +0300 Subject: [PATCH 14/48] Replace some variables Signed-off-by: DiSlord --- src/game/Unit.cpp | 85 ++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 929fd2a29..d374dc06c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4372,7 +4372,8 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) { SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); - uint32 effIndex = triggeredByAura->GetEffIndex (); + uint32 effIndex = triggeredByAura->GetEffIndex(); + int32 triggerAmount = triggeredByAura->GetModifier()->m_amount; Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL; @@ -4396,7 +4397,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // return damage % to attacker but < 50% own total health - basepoints0 = triggeredByAura->GetModifier()->m_amount*int32(damage)/100; + basepoints0 = triggerAmount*int32(damage)/100; if(basepoints0 > GetMaxHealth()/2) basepoints0 = GetMaxHealth()/2; @@ -4718,7 +4719,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 48504: { triggered_spell_id = 48503; - basepoints0 = triggeredByAura->GetModifier()->m_amount; + basepoints0 = triggerAmount; target = this; break; } @@ -4736,7 +4737,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 31872: { // Roll chane - if (!roll_chance_i(triggeredByAura->GetModifier()->m_amount)) + if (!roll_chance_i(triggerAmount)) return false; // Remove any stun effect on target @@ -4767,7 +4768,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // mana reward - basepoints0 = (triggeredByAura->GetModifier()->m_amount * GetMaxPower(POWER_MANA) / 100); + basepoints0 = (triggerAmount * GetMaxPower(POWER_MANA) / 100); target = this; triggered_spell_id = 29442; break; @@ -4780,7 +4781,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // mana cost save int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; - basepoints0 = cost * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = cost * triggerAmount/100; if( basepoints0 <=0 ) return false; @@ -4791,7 +4792,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Hot Streak if (dummySpell->SpellIconID == 2999) { - if (triggeredByAura->GetEffIndex()!=0) + if (effIndex!=0) return true; Aura *counter = GetAura(triggeredByAura->GetId(), 1); if (!counter) @@ -4805,7 +4806,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (mod->m_amount < 100) // not enough return true; // Crititcal counted -> roll chance - if (roll_chance_i(triggeredByAura->GetModifier()->m_amount)) + if (roll_chance_i(triggerAmount)) CastSpell(this, 48108, true, castItem, triggeredByAura); } mod->m_amount = 25; @@ -4818,7 +4819,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; - basepoints0 = cost * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = cost * triggerAmount/100; if( basepoints0 <=0 ) return false; triggered_spell_id = 44450; @@ -4914,7 +4915,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 3214) { triggered_spell_id = 59653; - basepoints0 = GetShieldBlockValue() * triggeredByAura->GetModifier()->m_amount / 100; + basepoints0 = GetShieldBlockValue() * triggerAmount / 100; break; } break; @@ -4971,7 +4972,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!target) return false; triggered_spell_id = 54181; - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount / 100; + basepoints0 = damage * triggerAmount / 100; break; } switch(dummySpell->Id) @@ -4990,7 +4991,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 30296: { // health - basepoints0 = int32(damage*triggeredByAura->GetModifier()->m_amount/100); + basepoints0 = int32(damage*triggerAmount/100); target = this; triggered_spell_id = 30294; break; @@ -5009,7 +5010,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = damage * triggerAmount/100; triggered_spell_id = 37382; break; } @@ -5035,14 +5036,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // energize amount - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; pVictim->CastCustomSpell(pVictim,34919,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); return true; // no hidden cooldown } // Divine Aegis if (dummySpell->SpellIconID == 2820) { - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = damage * triggerAmount/100; triggered_spell_id = 47753; break; } @@ -5059,7 +5060,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; pVictim->CastCustomSpell(pVictim,15290,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); return true; // no hidden cooldown } @@ -5094,7 +5095,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = damage * triggerAmount/100; target = this; triggered_spell_id = 39373; break; @@ -5182,7 +5183,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!procSpell) return false; // Only 0 aura can proc - if (triggeredByAura->GetEffIndex()!=0) + if (effIndex!=0) return true; // Wrath crit if (procSpell->SpellFamilyFlags & 0x0000000000000001LL) @@ -5206,7 +5207,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu else if (dummySpell->SpellIconID == 2860) { triggered_spell_id = 48504; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; break; } break; @@ -5258,7 +5259,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // energy cost save - basepoints0 = procSpell->manaCost * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = procSpell->manaCost * triggerAmount/100; if(basepoints0 <= 0) return false; @@ -5319,7 +5320,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_PALADIN: { // Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage) - if (dummySpell->SpellFamilyFlags&0x000000008000000LL && triggeredByAura->GetEffIndex()==0) + if (dummySpell->SpellFamilyFlags&0x000000008000000LL && effIndex==0) { triggered_spell_id = 25742; float ap = GetTotalAttackPowerValue(BASE_ATTACK); @@ -5339,7 +5340,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 3025) { // 4 damage tick - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/400; + basepoints0 = triggerAmount*damage/400; triggered_spell_id = 61840; break; } @@ -5347,7 +5348,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 3030) { // 4 healing tick - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/400; + basepoints0 = triggerAmount*damage/400; triggered_spell_id = 54203; break; } @@ -5423,7 +5424,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; target = this; triggered_spell_id = 31786; break; @@ -5431,13 +5432,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Seal of Blood do damage trigger case 31892: { - if (triggeredByAura->GetEffIndex() == 0) // 0 effect - is proc on enemy + if (effIndex == 0) // 0 effect - is proc on enemy triggered_spell_id = 31893; - else if (triggeredByAura->GetEffIndex() == 1) // 1 effect - is proc on self + else if (effIndex == 1) // 1 effect - is proc on self { // add spell damage from prev effect (27%) damage += CalculateDamage(BASE_ATTACK, false) * 27 / 100; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; triggered_spell_id = 32221; } @@ -5448,13 +5449,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Seal of the Martyr do damage trigger case 53720: { - if (triggeredByAura->GetEffIndex() == 0) // 0 effect - is proc on enemy + if (effIndex == 0) // 0 effect - is proc on enemy triggered_spell_id = 53719; - else if (triggeredByAura->GetEffIndex() == 1) // 1 effect - is proc on self + else if (effIndex == 1) // 1 effect - is proc on self { // add spell damage from prev effect (27%) damage += CalculateDamage(BASE_ATTACK, false) * 27 / 100; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; triggered_spell_id = 53718; } @@ -5507,14 +5508,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 54936: { triggered_spell_id = 54957; - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; break; } // Glyph of Holy Light case 54937: { triggered_spell_id = 54968; - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; break; } } @@ -5667,7 +5668,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Not proc from self heals if (this==pVictim) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; triggered_spell_id = 55533; break; @@ -5679,7 +5680,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu target = GetOwner(); if(!target) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 58879; break; } @@ -5689,14 +5690,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { // TODO: frite dummy fot triggered spell triggered_spell_id = 52759; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; break; } // Earth Shield if(dummySpell->SpellFamilyFlags & 0x0000040000000000LL) { - basepoints0 = triggeredByAura->GetModifier()->m_amount; + basepoints0 = triggerAmount; target = this; triggered_spell_id = 379; break; @@ -5830,14 +5831,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { if (GetTypeId() != TYPEID_PLAYER || !((Player*)this)->isHonorOrXPTarget(pVictim)) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 53168; break; } // Butchery if (dummySpell->SpellIconID == 2664) { - basepoints0 = triggeredByAura->GetModifier()->m_amount; + basepoints0 = triggerAmount; triggered_spell_id = 50163; target = this; break; @@ -5846,7 +5847,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->Id == 49028) { // 1 dummy aura for dismiss rune blade - if (triggeredByAura->GetEffIndex()!=2) + if (effIndex!=2) return false; // TODO: wite script for this "fights on its own, doing the same attacks" // NOTE: Trigger here on every attack and spell cast @@ -5862,7 +5863,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Vendetta if (dummySpell->SpellFamilyFlags & 0x0000000000010000LL) { - basepoints0 = triggeredByAura->GetModifier()->m_amount * GetMaxHealth() / 100; + basepoints0 = triggerAmount * GetMaxHealth() / 100; triggered_spell_id = 50181; target = this; break; @@ -5870,7 +5871,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Necrosis if (dummySpell->SpellIconID == 2709) { - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 51460; break; } @@ -5892,7 +5893,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { if (!roll_chance_f(GetUnitCriticalChance(BASE_ATTACK, pVictim))) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 50526; break; } From b99bc7918d7e313864f98715e5d0f162713db3cb Mon Sep 17 00:00:00 2001 From: pasdVn Date: Sun, 25 Jan 2009 17:46:37 +0300 Subject: [PATCH 15/48] [7175] Fix some hunter abilites 56342 and ranks - proc on trap activation 34497 and ranks - mana restor amount 56333 and ranks add some cast as trap activation Signed-off-by: DiSlord --- sql/mangos.sql | 5 ++++- sql/updates/7175_01_mangos_spell_proc_event.sql | 13 +++++++++++++ sql/updates/Makefile.am | 2 ++ src/game/Spell.cpp | 2 +- src/game/SpellMgr.cpp | 2 +- src/game/Unit.cpp | 15 +++++++++++---- src/shared/revision_nr.h | 2 +- 7 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 sql/updates/7175_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index b2f26f539..682539521 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -22,7 +22,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, - `required_7168_01_mangos_command` bit(1) default NULL + `required_7175_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -17106,6 +17106,9 @@ INSERT INTO `spell_proc_event` VALUES (55680, 0x00000000, 6, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (55689, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (56218, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56333, 0x00000000, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56336, 0x00000000, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56337, 0x00000000, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56342, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56343, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56344, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), diff --git a/sql/updates/7175_01_mangos_spell_proc_event.sql b/sql/updates/7175_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..57e02defe --- /dev/null +++ b/sql/updates/7175_01_mangos_spell_proc_event.sql @@ -0,0 +1,13 @@ +ALTER TABLE db_version CHANGE COLUMN required_7168_01_mangos_command required_7175_01_mangos_spell_proc_event bit; + +-- (56333) T.N.T. (Rank 1) +DELETE FROM `spell_proc_event` WHERE `entry` IN (56333); +INSERT INTO `spell_proc_event` VALUES (56333, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +-- (56336) T.N.T. (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (56336); +INSERT INTO `spell_proc_event` VALUES (56336, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +-- (56337) T.N.T. (Rank 3) +DELETE FROM `spell_proc_event` WHERE `entry` IN (56337); +INSERT INTO `spell_proc_event` VALUES (56337, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 4819d0cf9..8b81f825a 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -151,6 +151,7 @@ pkgdata_DATA = \ 7150_01_mangos_playercreateinfo_spell.sql \ 7156_01_mangos_spell_proc_event.sql \ 7168_01_mangos_command.sql \ + 7175_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -282,4 +283,5 @@ EXTRA_DIST = \ 7150_01_mangos_playercreateinfo_spell.sql \ 7156_01_mangos_spell_proc_event.sql \ 7168_01_mangos_command.sql \ + 7175_01_mangos_spell_proc_event.sql \ README diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 657d75ac0..4cd470d1c 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -760,7 +760,7 @@ void Spell::prepareDataForTriggerSystem() } // Hunter traps spells (for Entrapment trigger) // Gives your Immolation Trap, Frost Trap, Explosive Trap, and Snake Trap .... - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->SpellFamilyFlags & 0x0000200000000014LL) + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->SpellFamilyFlags & 0x000020000000001CLL) m_procAttacker |= PROC_FLAG_ON_TRAP_ACTIVATION; } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 4b316e5cb..e7253a7cc 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -888,7 +888,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellP return false; // Always trigger for this - if (EventProcFlag & (PROC_FLAG_KILLED | PROC_FLAG_KILL)) + if (EventProcFlag & (PROC_FLAG_KILLED | PROC_FLAG_KILL | PROC_FLAG_ON_TRAP_ACTIVATION)) return true; if (spellProcEvent) // Exist event data diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d374dc06c..b64828e75 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5278,7 +5278,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // mana cost save - basepoints0 = procSpell->manaCost * 40/100; + int32 mana = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; + basepoints0 = mana * 40/100; if(basepoints0 <= 0) return false; @@ -5297,9 +5298,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if ( dummySpell->SpellIconID == 3579 ) { // Proc only from periodic (from trap activation proc another aura of this spell) - if (!(procFlag & PROC_FLAG_ON_DO_PERIODIC)) - return false; - if (!roll_chance_i(triggeredByAura->GetModifier()->m_amount)) + if (!(procFlag & PROC_FLAG_ON_DO_PERIODIC) || !roll_chance_i(triggerAmount)) return false; triggered_spell_id = 56453; target = this; @@ -6615,6 +6614,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; break; } + // Lock and Load + case 56453: + { + // Proc only from trap activation (from periodic proc another aura of this spell) + if (!(procFlags & PROC_FLAG_ON_TRAP_ACTIVATION) || !roll_chance_i(triggerAmount)) + return false; + break; + } } if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 18686ea5d..3184a7a35 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7174" + #define REVISION_NR "7175" #endif // __REVISION_NR_H__ From 7348249104e59b52cc87f55568362c10699f9259 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 25 Jan 2009 18:57:58 +0300 Subject: [PATCH 16/48] [7176] Implement full work priest 47580 and ranks Signed-off-by: DiSlord --- src/game/SpellAuras.cpp | 22 ++++++++++++++++++++++ src/game/SpellEffects.cpp | 28 ++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ec9efb81f..e358b611f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2220,6 +2220,28 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { break; } + case SPELLFAMILY_PRIEST: + { + // Pain and Suffering + if( m_spellProto->SpellIconID == 2874 && m_target->GetTypeId()==TYPEID_PLAYER ) + { + if(apply) + { + // Reduce backfire damage (dot damage) from Shadow Word: Death + SpellModifier *mod = new SpellModifier; + mod->op = SPELLMOD_DOT; + mod->value = m_modifier.m_amount; + mod->type = SPELLMOD_PCT; + mod->spellId = GetId(); + mod->mask = 0x0000000200000000LL; + mod->mask2= 0LL; + m_spellmod = mod; + } + ((Player*)m_target)->AddSpellMod(m_spellmod, apply); + return; + } + break; + } case SPELLFAMILY_DRUID: { // Lifebloom diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index da33aa8cc..e056cee0e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4937,6 +4937,34 @@ void Spell::EffectScriptEffect(uint32 effIndex) } break; } + case SPELLFAMILY_PRIEST: + { + switch(m_spellInfo->Id) + { + // Pain and Suffering + case 47948: + { + if (!unitTarget) + return; + // Refresh Shadow Word: Pain on target + Unit::AuraList const &mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for(Unit::AuraList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) + { + if( (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST && + (*i)->GetSpellProto()->SpellFamilyFlags & 0x0000000000008000LL && + (*i)->GetCasterGUID()==m_caster->GetGUID() ) + { + (*i)->RefreshAura(); + return; + } + } + return; + } + default: + break; + } + break; + } case SPELLFAMILY_HUNTER: { switch(m_spellInfo->Id) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3184a7a35..8580b45b8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7175" + #define REVISION_NR "7176" #endif // __REVISION_NR_H__ From 923e986fbd0fbdf059820fc29af4b7a38261003b Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 19:19:37 +0300 Subject: [PATCH 17/48] [7177] Fixed unexpected error output in logs. --- src/game/AchievementMgr.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 0561daf1a..6cc793ec5 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -934,7 +934,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() } sLog.outString(); - sLog.outErrorDb(">> Loaded %u achievement criteria.",m_AchievementCriteriasByType->size()); + sLog.outString(">> Loaded %u achievement criteria.",m_AchievementCriteriasByType->size()); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8580b45b8..5bbf9d20e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7176" + #define REVISION_NR "7177" #endif // __REVISION_NR_H__ From 523038b04ef6ba32ab97342f92ddefb809215d97 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 19:31:12 +0300 Subject: [PATCH 18/48] [7178] Fixed character save fail at spell save in special case. Case description: Spell save fail at attempt save into `character_spell` "new" spell loaded from DB with exactly same settings after it learned from spell cast triggered by loading another spell from DB. Reapeatable for shamans with known talent 16268. Also speedup code with remove redundent Player::_removeSpell function. --- src/game/Player.cpp | 32 +++++++++++++++----------------- src/game/Player.h | 1 - src/shared/revision_nr.h | 2 +- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 350be0a6a..eb1322953 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2601,7 +2601,12 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // not do anything if already known in expected state if(itr->second->state != PLAYERSPELL_REMOVED && itr->second->active == active && itr->second->dependent == dependent && itr->second->disabled == disabled) + { + if(!IsInWorld() && !learning) // explicitly load from DB and then exist in it already and set correctly + itr->second->state = PLAYERSPELL_UNCHANGED; + return false; + } // dependent spell known as not dependent, overwrite state if (itr->second->state != PLAYERSPELL_REMOVED && !itr->second->dependent && dependent) @@ -2617,8 +2622,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen { itr->second->active = active; - // !IsInWorld() && !learning == explicitly load from DB and then exist in it already and set correctly - if(!IsInWorld() && !learning && !dependent_set) + if(!IsInWorld() && !learning && !dependent_set) // explicitly load from DB and then exist in it already and set correctly itr->second->state = PLAYERSPELL_UNCHANGED; else if(itr->second->state != PLAYERSPELL_NEW) itr->second->state = PLAYERSPELL_CHANGED; @@ -3341,18 +3345,6 @@ bool Player::resetTalents(bool no_cost) return true; } -bool Player::_removeSpell(uint16 spell_id) -{ - PlayerSpellMap::iterator itr = m_spells.find(spell_id); - if (itr != m_spells.end()) - { - delete itr->second; - m_spells.erase(itr); - return true; - } - return false; -} - Mail* Player::GetMail(uint32 id) { for(PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) @@ -16005,9 +15997,8 @@ void Player::_SaveReputation() void Player::_SaveSpells() { - for (PlayerSpellMap::const_iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end(); itr = next) + for (PlayerSpellMap::const_iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end();) { - ++next; if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) CharacterDatabase.PExecute("DELETE FROM character_spell WHERE guid = '%u' and spell = '%u'", GetGUIDLow(), itr->first); @@ -16016,9 +16007,16 @@ void Player::_SaveSpells() CharacterDatabase.PExecute("INSERT INTO character_spell (guid,spell,active,disabled) VALUES ('%u', '%u', '%u', '%u')", GetGUIDLow(), itr->first, itr->second->active ? 1 : 0,itr->second->disabled ? 1 : 0); if (itr->second->state == PLAYERSPELL_REMOVED) - _removeSpell(itr->first); + { + delete itr->second; + m_spells.erase(itr++); + } else + { itr->second->state = PLAYERSPELL_UNCHANGED; + ++itr; + } + } } diff --git a/src/game/Player.h b/src/game/Player.h index d6ec3e289..1bdf2718f 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2287,7 +2287,6 @@ class MANGOS_DLL_SPEC Player : public Unit time_t m_lastHonorUpdateTime; void outDebugValues() const; - bool _removeSpell(uint16 spell_id); uint64 m_lootGuid; uint32 m_race; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5bbf9d20e..1776583a5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7177" + #define REVISION_NR "7178" #endif // __REVISION_NR_H__ From f3c5e6019577c6ed285db9e8217ba47d1b455929 Mon Sep 17 00:00:00 2001 From: ApoC Date: Sun, 25 Jan 2009 20:25:04 +0300 Subject: [PATCH 19/48] [7179] Fixed build at Unix/Linux. --- src/game/Player.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index eb1322953..4a61fbcdc 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15997,7 +15997,7 @@ void Player::_SaveReputation() void Player::_SaveSpells() { - for (PlayerSpellMap::const_iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end();) + for (PlayerSpellMap::iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end();) { if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) CharacterDatabase.PExecute("DELETE FROM character_spell WHERE guid = '%u' and spell = '%u'", GetGUIDLow(), itr->first); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1776583a5..40ca32ec9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7178" + #define REVISION_NR "7179" #endif // __REVISION_NR_H__ From a54586ed93ce145e49d3f2d020c26876b58b1739 Mon Sep 17 00:00:00 2001 From: balrok Date: Sun, 25 Jan 2009 20:27:40 +0300 Subject: [PATCH 20/48] [7180] 303 changes in PvpLogDataPacket. Signed-off-by: VladimirMangos --- src/game/BattleGroundMgr.cpp | 32 ++++++++++++-------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 66c03df3b..ee4af3866 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1242,17 +1242,18 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) { uint8 type = (bg->isArena() ? 1 : 0); - // last check on 2.4.1 + // last check on 3.0.3 data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize())); - *data << uint8(type); // seems to be type (battleground=0/arena=1) + *data << uint8(type); // type (battleground=0/arena=1) if(type) // arena { // it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H for(int i = 1; i >= 0; --i) { - *data << uint32(3000-bg->m_ArenaTeamRatingChanges[i]); // rating change: showed value - 3000 + *data << uint32(bg->m_ArenaTeamRatingChanges[i]); *data << uint32(3999); // huge thanks for TOM_RUS for this! + *data << uint32(0); // unknown - new in 3.0.3 sLog.outDebug("rating change: %d", bg->m_ArenaTeamRatingChanges[i]); } for(int i = 1; i >= 0; --i) @@ -1266,9 +1267,9 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) } } - if(bg->GetWinner() == 2) + if(bg->GetStatus() != STATUS_WAIT_LEAVE) { - *data << uint8(0); // bg in progress + *data << uint8(0); // bg not ended } else { @@ -1282,9 +1283,6 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) { *data << (uint64)itr->first; *data << (int32)itr->second->KillingBlows; - Player *plr = objmgr.GetPlayer(itr->first); - uint32 team = bg->GetPlayerTeam(itr->first); - if(!team && plr) team = plr->GetTeam(); if(type == 0) { *data << (int32)itr->second->HonorableKills; @@ -1293,18 +1291,12 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) } else { - // that part probably wrong - if(plr) - { - if(team == HORDE) - *data << uint8(0); - else if(team == ALLIANCE) - { - *data << uint8(1); - } - else - *data << uint8(0); - } + Player *plr = objmgr.GetPlayer(itr->first); + uint32 team = bg->GetPlayerTeam(itr->first); + if(!team && plr) + team = plr->GetTeam(); + if( ( bg->GetWinner()==0 && team == ALLIANCE ) || ( bg->GetWinner()==1 && team==HORDE ) ) + *data << uint8(1); else *data << uint8(0); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 40ca32ec9..b07f4e7e0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7179" + #define REVISION_NR "7180" #endif // __REVISION_NR_H__ From 8611eadccafe8f2e1c51c07fe69194712cad3584 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 25 Jan 2009 21:48:28 +0300 Subject: [PATCH 21/48] Restore work priest 15286 after client switch Signed-off-by: DiSlord --- src/game/Unit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b64828e75..62207c8d2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5060,8 +5060,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = triggerAmount*damage/100; - pVictim->CastCustomSpell(pVictim,15290,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); + int32 team = triggerAmount*damage/500; + int32 self = triggerAmount*damage/100 - team; + pVictim->CastCustomSpell(pVictim,15290,&team,&self,NULL,true,castItem,triggeredByAura); return true; // no hidden cooldown } // Priest Tier 6 Trinket (Ashtongue Talisman of Acumen) From eceae8dc9905ee703f92c5acee659788ad8bb95c Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 25 Jan 2009 21:54:39 +0300 Subject: [PATCH 22/48] [7181] Fix mana regen on priest 47585 use Signed-off-by: DiSlord --- src/game/Spell.cpp | 2 ++ src/game/SpellMgr.cpp | 4 ++++ src/shared/revision_nr.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 4cd470d1c..37d28db7d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2214,6 +2214,8 @@ void Spell::cast(bool skipCheck) if (m_spellInfo->Mechanic == MECHANIC_SHIELD && m_spellInfo->SpellIconID == 566) // Power Word: Shield m_preCastSpell = 6788; // Weakened Soul + if (m_spellInfo->Id == 47585) // Dispersion (transform) + m_preCastSpell = 60069; // Dispersion (mana regen) break; } case SPELLFAMILY_PALADIN: diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index e7253a7cc..b62a2c8b6 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1262,6 +1262,10 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if( (spellInfo_1->SpellFamilyFlags & 0x200000) && (spellInfo_2->SpellFamilyFlags & 0x8000) || (spellInfo_2->SpellFamilyFlags & 0x200000) && (spellInfo_1->SpellFamilyFlags & 0x8000) ) return false; + // Dispersion + if( (spellInfo_1->Id == 47585 && spellInfo_2->Id == 60069) || + (spellInfo_2->Id == 47585 && spellInfo_1->Id == 60069) ) + return false; } break; case SPELLFAMILY_DRUID: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b07f4e7e0..7b4700b6e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7180" + #define REVISION_NR "7181" #endif // __REVISION_NR_H__ From de4c5ebbaa676588516e01c3d9d2c9328d4c59e9 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 25 Jan 2009 21:57:06 +0300 Subject: [PATCH 23/48] [7182] Finally remove vanity pet slots related code. Vanity pets stored as learned spells. --- src/game/Player.cpp | 86 ++++------------------------------------ src/game/Player.h | 4 +- src/shared/revision_nr.h | 2 +- 3 files changed, 10 insertions(+), 82 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 4a61fbcdc..d690b995d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -8895,8 +8895,8 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV if(slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START+GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - // vanitypet case (disabled until proper implement) - if(slot >= VANITYPET_SLOT_START && slot < VANITYPET_SLOT_END && !(false /*pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS*/)) + // vanitypet case (not use, vanity pets stored as spells) + if(slot >= VANITYPET_SLOT_START && slot < VANITYPET_SLOT_END) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; // currencytoken case (disabled until proper implement) @@ -9239,28 +9239,9 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } - /* until proper implementation - else if(pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS) - { - res = _CanStoreItem_InInventorySlots(VANITYPET_SLOT_START,VANITYPET_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) - { - if(no_space_count) - *no_space_count = count + no_similar_count; - return res; - } - if(count==0) - { - if(no_similar_count==0) - return EQUIP_ERR_OK; + // Vanity pet case skipped as not used - if(no_space_count) - *no_space_count = count + no_similar_count; - return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; - } - } - */ /* until proper implementation else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -9452,28 +9433,9 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } } - /* until proper implementation - else if(false pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS) - { - res = _CanStoreItem_InInventorySlots(VANITYPET_SLOT_START,VANITYPET_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) - { - if(no_space_count) - *no_space_count = count + no_similar_count; - return res; - } - if(count==0) - { - if(no_similar_count==0) - return EQUIP_ERR_OK; + // Vanity pet case skipped as not used - if(no_space_count) - *no_space_count = count + no_similar_count; - return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; - } - } - */ /* until proper implementation else if(false pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -9588,14 +9550,12 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const int inv_slot_items[INVENTORY_SLOT_ITEM_END-INVENTORY_SLOT_ITEM_START]; int inv_bags[INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START][MAX_BAG_SIZE]; int inv_keys[KEYRING_SLOT_END-KEYRING_SLOT_START]; - int inv_pets[VANITYPET_SLOT_END-VANITYPET_SLOT_START]; int inv_tokens[CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START]; int inv_quests[QUESTBAG_SLOT_END-QUESTBAG_SLOT_START]; memset(inv_slot_items,0,sizeof(int)*(INVENTORY_SLOT_ITEM_END-INVENTORY_SLOT_ITEM_START)); memset(inv_bags,0,sizeof(int)*(INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START)*MAX_BAG_SIZE); memset(inv_keys,0,sizeof(int)*(KEYRING_SLOT_END-KEYRING_SLOT_START)); - memset(inv_pets,0,sizeof(int)*(VANITYPET_SLOT_END-VANITYPET_SLOT_START)); memset(inv_tokens,0,sizeof(int)*(CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START)); memset(inv_quests,0,sizeof(int)*(QUESTBAG_SLOT_END-QUESTBAG_SLOT_START)); @@ -9619,15 +9579,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - for(int i = VANITYPET_SLOT_START; i < VANITYPET_SLOT_END; i++) - { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - - if (pItem2 && !pItem2->IsInTrade()) - { - inv_pets[i-VANITYPET_SLOT_START] = pItem2->GetCount(); - } - } + // Vanity pet case skipped as not used for(int i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { @@ -9708,17 +9660,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - for(int t = VANITYPET_SLOT_START; t < VANITYPET_SLOT_END; t++) - { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_pets[t-VANITYPET_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) - { - inv_pets[t-VANITYPET_SLOT_START] += pItem->GetCount(); - b_found = true; - break; - } - } - if (b_found) continue; + // Vanity pet case skipped as not used for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; t++) { @@ -9796,22 +9738,8 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if (b_found) continue; - /* until proper implementation - if(pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS) - { - for(uint32 t = VANITYPET_SLOT_START; t < VANITYPET_SLOT_END; ++t) - { - if( inv_pets[t-VANITYPET_SLOT_START] == 0 ) - { - inv_pets[t-VANITYPET_SLOT_START] = 1; - b_found = true; - break; - } - } - } + // Vanity pet case skipped as not used - if (b_found) continue; - */ /* until proper implementation if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { diff --git a/src/game/Player.h b/src/game/Player.h index 1bdf2718f..f1d16025e 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -730,8 +730,8 @@ enum KeyRingSlots enum VanityPetSlots { - VANITYPET_SLOT_START = 118, - VANITYPET_SLOT_END = 136 + VANITYPET_SLOT_START = 118, // not use, vanity pets stored as spells + VANITYPET_SLOT_END = 136 // not alloed any content in. }; enum CurrencyTokenSlots diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7b4700b6e..78d8c0ea2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7181" + #define REVISION_NR "7182" #endif // __REVISION_NR_H__ From f8463bef69a00d2cc94d1e4d5ee96c3a7055db0a Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sun, 25 Jan 2009 23:24:37 +0300 Subject: [PATCH 24/48] [7183] Updated spell casting pushback system. Signed-off-by: VladimirMangos --- src/game/Spell.cpp | 32 ++++++++++++++++++++------------ src/game/Spell.h | 9 ++++++++- src/game/SpellAuraDefines.h | 2 +- src/game/SpellAuras.cpp | 2 +- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 37d28db7d..b3308e243 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5192,18 +5192,22 @@ void Spell::Delayed() if (m_spellState == SPELL_STATE_DELAYED) return; // spell is active and can't be time-backed + if(isDelayableNoMore()) // Spells may only be delayed twice + return; + // spells not loosing casting time ( slam, dynamites, bombs.. ) if(!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE)) return; - //check resist chance - int32 resistChance = 100; //must be initialized to 100 for percent modifiers - ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,resistChance, this); - resistChance += m_caster->GetTotalAuraModifier(SPELL_AURA_RESIST_PUSHBACK) - 100; - if (roll_chance_i(resistChance)) + //check pushback reduce + int32 delaytime = 500; // spellcasting delay is normally 500ms + int32 delayReduce = 100; // must be initialized to 100 for percent modifiers + ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); + delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; + if(delayReduce >= 100) return; - int32 delaytime = GetNextDelayAtDamageMsTime(); + delaytime = delaytime * (100 - delayReduce) / 100; if(int32(m_timer) + delaytime > m_casttime) { @@ -5227,14 +5231,18 @@ void Spell::DelayedChannel() if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER || getState() != SPELL_STATE_CASTING) return; - //check resist chance - int32 resistChance = 100; //must be initialized to 100 for percent modifiers - ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,resistChance, this); - resistChance += m_caster->GetTotalAuraModifier(SPELL_AURA_RESIST_PUSHBACK) - 100; - if (roll_chance_i(resistChance)) + if(isDelayableNoMore()) // Spells may only be delayed twice return; - int32 delaytime = GetNextDelayAtDamageMsTime(); + //check pushback reduce + int32 delaytime = GetSpellDuration(m_spellInfo) * 25 / 100; // channeling delay is normally 25% of its time per hit + int32 delayReduce = 100; // must be initialized to 100 for percent modifiers + ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,delayReduce, this); + delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; + if(delayReduce >= 100) + return; + + delaytime = delaytime * (100 - delayReduce) / 100; if(int32(m_timer) < delaytime) { diff --git a/src/game/Spell.h b/src/game/Spell.h index beb69af16..dfb73e1ff 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -455,7 +455,14 @@ class Spell uint8 m_runesState; uint8 m_delayAtDamageCount; - int32 GetNextDelayAtDamageMsTime() { return m_delayAtDamageCount < 5 ? 1000 - (m_delayAtDamageCount++)* 200 : 200; } + bool isDelayableNoMore() + { + if(m_delayAtDamageCount >= 2) + return true; + + m_delayAtDamageCount++; + return false; + } // Delayed spells system uint64 m_delayStart; // time of spell delay start, filled by event handler, zero = just started diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 06fd3509c..a0cc70711 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -191,7 +191,7 @@ enum AuraType SPELL_AURA_ALLOW_TAME_PET_TYPE = 146, SPELL_AURA_ADD_CREATURE_IMMUNITY = 147, SPELL_AURA_RETAIN_COMBO_POINTS = 148, - SPELL_AURA_RESIST_PUSHBACK = 149, // Resist Pushback + SPELL_AURA_REDUCE_PUSHBACK = 149, // Reduce Pushback SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT = 150, SPELL_AURA_TRACK_STEALTHED = 151, // Track Stealthed SPELL_AURA_MOD_DETECTED_RANGE = 152, // Mod Detected Range diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index e358b611f..f47fe36ee 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -199,7 +199,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE &Aura::HandleNULL, //147 SPELL_AURA_ADD_CREATURE_IMMUNITY &Aura::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS - &Aura::HandleNoImmediateEffect, //149 SPELL_AURA_RESIST_PUSHBACK + &Aura::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK &Aura::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT &Aura::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED &Aura::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 62207c8d2..1bc557487 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10305,7 +10305,7 @@ bool InitTriggerAuraData() isTriggerAura[SPELL_AURA_MOD_DAMAGE_FROM_CASTER] = true; isNonTriggerAura[SPELL_AURA_MOD_POWER_REGEN]=true; - isNonTriggerAura[SPELL_AURA_RESIST_PUSHBACK]=true; + isNonTriggerAura[SPELL_AURA_REDUCE_PUSHBACK]=true; return true; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 78d8c0ea2..aecd6e404 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7182" + #define REVISION_NR "7183" #endif // __REVISION_NR_H__ From babd025652bd4c261bc929c108070e8a6a925fe4 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 00:45:46 +0300 Subject: [PATCH 25/48] [7184] Implement more generic work for some SPELL_AURA_OVERRIDE_CLASS_SCRIPTS auras Fix warlock 17804 and ranks Implement druid 643 set bonus Shaman 23199, 28248, 32330 item (totems) DK 49202 and ranks, 49024 and ranks Priest 47573 and ranks Hunter 53241 and ranks Signed-off-by: DiSlord --- src/game/SpellAuras.cpp | 53 ---------------- src/game/Unit.cpp | 132 +++++++++++++++++++++++++++++++++++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 127 insertions(+), 60 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index f47fe36ee..47b6f2c4b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5748,59 +5748,6 @@ void Aura::PeriodicTick() pdamage = pCaster->SpellDamageBonus(m_target,GetSpellProto(),pdamage,DOT); - // talent Soul Siphon add bonus to Drain Life spells - if( GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & 0x8) ) - { - // find talent max bonus percentage - Unit::AuraList const& mClassScriptAuras = pCaster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator i = mClassScriptAuras.begin(); i != mClassScriptAuras.end(); ++i) - { - if ((*i)->GetModifier()->m_miscvalue == 4992 || (*i)->GetModifier()->m_miscvalue == 4993) - { - if((*i)->GetEffIndex()!=1) - { - sLog.outError("Expected spell %u structure change, need code update",(*i)->GetId()); - break; - } - - // effect 1 m_amount - int32 maxPercent = (*i)->GetModifier()->m_amount; - // effect 0 m_amount - int32 stepPercent = pCaster->CalculateSpellDamage((*i)->GetSpellProto(),0,(*i)->GetSpellProto()->EffectBasePoints[0],pCaster); - - // count affliction effects and calc additional damage in percentage - int32 modPercent = 0; - Unit::AuraMap const& victimAuras = m_target->GetAuras(); - for (Unit::AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) - { - Aura* aura = itr->second; - if (aura->IsPositive())continue; - SpellEntry const* m_spell = aura->GetSpellProto(); - if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK) - continue; - - SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(m_spell->Id); - SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(m_spell->Id); - - for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx) - { - if(_spell_idx->second->skillId == SKILL_AFFLICTION) - { - modPercent += stepPercent; - if (modPercent >= maxPercent) - { - modPercent = maxPercent; - break; - } - } - } - } - pdamage += (pdamage*modPercent/100); - break; - } - } - } - //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit // Reduce dot damage from resilience for players if (m_target->GetTypeId()==TYPEID_PLAYER) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1bc557487..9e04d2b7d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7477,19 +7477,139 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) ) TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; - // .. taken pct: scripted (increases damage of * against targets *) + // done scripted mod AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { + if (!(*i)->isAffectedOnSpell(spellProto)) + continue; switch((*i)->GetModifier()->m_miscvalue) { - //Molten Fury - case 4920: case 4919: + // Molten Fury + case 4920: + case 4919: + { if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; break; + TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + break; + } + // Soul Siphon + case 4992: + case 4993: + { + // effect 1 m_amount + int32 maxPercent = (*i)->GetModifier()->m_amount; + // effect 0 m_amount + int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[0], this); + // count affliction effects and calc additional damage in percentage + int32 modPercent = 0; + Unit::AuraMap const& victimAuras = pVictim->GetAuras(); + for (Unit::AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) + { + SpellEntry const* m_spell = itr->second->GetSpellProto(); + if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags & 0x0004071B8044C402LL)) + continue; + modPercent += stepPercent; + if (modPercent >= maxPercent) + { + modPercent = maxPercent; + break; + } + } + DoneTotalMod *= (modPercent+100.0f)/100.0f; + break; + } + // Starfire Bonus + case 5481: + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_DRUID && + m_spell->SpellFamilyFlags & 0x0000000000200002LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; + } + // Increased Lightning Damage + case 4554: + case 5142: + case 6008: + { + pdamage+=(*i)->GetModifier()->m_amount; + break; + } + // Tundra Stalker + // Merciless Combat + case 7277: + { + // Merciless Combat + if ((*i)->GetSpellProto()->SpellIconID == 2656) + { + if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) + TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + } + else // Tundra Stalker + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && + m_spell->SpellFamilyFlags & 0x0400000000000000LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + } + break; + } + // Twisted Faith + case 7377: + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_PRIEST && + m_spell->SpellFamilyFlags & 0x0000000000008000LL && + (*itr)->GetCasterGUID()==GetGUID()) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; + } + } + } + // taken scripted mod + AuraList const& mOverrideClassScriptTaken = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(AuraList::const_iterator i = mOverrideClassScriptTaken.begin(); i != mOverrideClassScriptTaken.end(); ++i) + { + if (!(*i)->isAffectedOnSpell(spellProto)) + continue; + switch((*i)->GetModifier()->m_miscvalue) + { + // Marked for Death + case 7598: + case 7599: + case 7600: + case 7601: + case 7602: + { + if ((*i)->GetCasterGUID()==GetGUID() || // Self + (*i)->GetCasterGUID()==GetOwnerGUID()) // Owner + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } } } - // .. taken pct: dummy auras AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); for(AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) @@ -7508,7 +7628,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 TakenTotalMod *= (mod+100.0f)/100.0f; } break; - //Mangle + // Mangle case 2312: for(int j=0;j<3;j++) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index aecd6e404..102e3a390 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7183" + #define REVISION_NR "7184" #endif // __REVISION_NR_H__ From 58840eb61e9cd01eb691c55aca870c9258708879 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 01:57:55 +0300 Subject: [PATCH 26/48] [7185] More fixes for SPELL_AURA_OVERRIDE_CLASS_SCRIPTS aura spells Signed-off-by: DiSlord --- src/game/Unit.cpp | 56 ++++++++++++++++++++++++++-------------- src/shared/revision_nr.h | 2 +- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9e04d2b7d..d4f3a7193 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7477,8 +7477,10 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) ) TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; - // done scripted mod - AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + // done scripted mod (take it from owner) + Unit *owner = GetOwner(); + if (!owner) owner = this; + AuraList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { if (!(*i)->isAffectedOnSpell(spellProto)) @@ -7535,10 +7537,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } break; } - // Increased Lightning Damage - case 4554: - case 5142: - case 6008: + case 4418: // Increased Shock Damage + case 4554: // Increased Lightning Damage + case 4555: // Improved Moonfire + case 5142: // Increased Lightning Damage + case 5147: // Improved Consecration + case 5148: // Idol of the Shooting Star + case 6008: // Increased Lightning Damage / Totem of Hex { pdamage+=(*i)->GetModifier()->m_amount; break; @@ -7569,6 +7574,21 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } break; } + case 7293: + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && + m_spell->SpellFamilyFlags & 0x0200000000000000LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; + } // Twisted Faith case 7377: { @@ -7586,16 +7606,6 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } break; } - } - } - // taken scripted mod - AuraList const& mOverrideClassScriptTaken = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(AuraList::const_iterator i = mOverrideClassScriptTaken.begin(); i != mOverrideClassScriptTaken.end(); ++i) - { - if (!(*i)->isAffectedOnSpell(spellProto)) - continue; - switch((*i)->GetModifier()->m_miscvalue) - { // Marked for Death case 7598: case 7599: @@ -7603,9 +7613,17 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 case 7601: case 7602: { - if ((*i)->GetCasterGUID()==GetGUID() || // Self - (*i)->GetCasterGUID()==GetOwnerGUID()) // Owner - DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_MOD_STALKED); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_HUNTER && + m_spell->SpellFamilyFlags & 0x0000000000000400LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } break; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 102e3a390..78ba8244f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7184" + #define REVISION_NR "7185" #endif // __REVISION_NR_H__ From cec3da69fd16ad426b4a1b9e4adc9d592c4e6dd9 Mon Sep 17 00:00:00 2001 From: Energy Date: Mon, 26 Jan 2009 14:33:43 +0300 Subject: [PATCH 27/48] [7186] Implement instance reset time show in calender. Signed-off-by: VladimirMangos --- src/game/CalendarHandler.cpp | 41 ++++++++++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index fd2858646..225e598e6 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -22,11 +22,52 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "Opcodes.h" +#include "InstanceSaveMgr.h" + + void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); recv_data.hexlike(); + + time_t cur_time = time(NULL); + + WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4); + + // TODO: calendar invite event output + data << (uint32) 0; //invite node count + // TODO: calendar event output + data << (uint32) 0; //event count + + data << (uint32) 0; //wtf?? + data << (uint32) secsToTimeBitFields(cur_time); // current time + + uint32 counter = 0; + size_t p_counter = data.wpos(); + data << uint32(counter); // instance save count + + for(int i = 0; i < TOTAL_DIFFICULTIES; ++i) + { + for (Player::BoundInstancesMap::iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr) + { + if(itr->second.perm) + { + InstanceSave *save = itr->second.save; + data << uint32(save->GetMapId()); + data << uint32(save->GetDifficulty()); + data << uint32(save->GetResetTime() - cur_time); + data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id + ++counter; + } + } + } + data.put(p_counter,counter); + + data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00) + sLog.outDebug("Sending calendar"); + //data.hexlike(); + SendPacket(&data); } void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 78ba8244f..5027a654e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7185" + #define REVISION_NR "7186" #endif // __REVISION_NR_H__ From 512747db7ffbd57669d5d879efc932977e20311b Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 26 Jan 2009 15:06:36 +0300 Subject: [PATCH 28/48] [7187] Replace some tabs in sources. --- src/game/CalendarHandler.cpp | 18 +++++++++--------- src/game/Level2.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index 225e598e6..6b1484bcb 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -33,15 +33,15 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) time_t cur_time = time(NULL); - WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4); + WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4); // TODO: calendar invite event output - data << (uint32) 0; //invite node count + data << (uint32) 0; //invite node count // TODO: calendar event output - data << (uint32) 0; //event count + data << (uint32) 0; //event count - data << (uint32) 0; //wtf?? - data << (uint32) secsToTimeBitFields(cur_time); // current time + data << (uint32) 0; //wtf?? + data << (uint32) secsToTimeBitFields(cur_time); // current time uint32 counter = 0; size_t p_counter = data.wpos(); @@ -64,10 +64,10 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) } data.put(p_counter,counter); - data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00) - sLog.outDebug("Sending calendar"); - //data.hexlike(); - SendPacket(&data); + data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00) + sLog.outDebug("Sending calendar"); + //data.hexlike(); + SendPacket(&data); } void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index c8efc8367..84c452449 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1705,7 +1705,7 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args) } // check online security - Player* player = ObjectAccessor::Instance().FindPlayerByName(name.c_str()); + Player* player = ObjectAccessor::Instance().FindPlayerByName(name.c_str()); if (player && HasLowerSecurity(player, 0)) return false; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5027a654e..7b21feb01 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7186" + #define REVISION_NR "7187" #endif // __REVISION_NR_H__ From 5cdedd8e2a23dea4e4c0bd68965248170f1aeebf Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 26 Jan 2009 20:01:19 +0300 Subject: [PATCH 29/48] [7188] Drop now unneeded hack code. --- src/game/Unit.cpp | 121 +++++++++++++++------------------------ src/shared/revision_nr.h | 2 +- 2 files changed, 46 insertions(+), 77 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d4f3a7193..75bc8d297 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3535,50 +3535,56 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) for(int j = 0; j < 3; ++j) if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id) is_triggered_by_spell = true; - if (is_triggered_by_spell) continue; - for(int j = 0; j < 3; ++j) + if (is_triggered_by_spell) + continue; + + SpellSpecific i_spellId_spec = GetSpellSpecific(i_spellId); + + bool is_sspc = IsSingleFromSpellSpecificPerCaster(spellId_spec,i_spellId_spec); + + if( is_sspc && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() ) { - // prevent remove dummy triggered spells at next effect aura add - switch(spellProto->Effect[j]) // main spell auras added added after triggered spell - { - case SPELL_EFFECT_DUMMY: - switch(spellId) - { - case 5420: if(i_spellId==34123) is_triggered_by_spell = true; break; - } - break; - } + // cannot remove higher rank + if (spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) + if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) + return false; - if(is_triggered_by_spell) + // Its a parent aura (create this aura in ApplyModifier) + if ((*i).second->IsInUse()) + { + sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); + continue; + } + RemoveAurasDueToSpell(i_spellId); + + if( m_Auras.empty() ) break; - - // prevent remove form main spell by triggered passive spells - switch(i_spellProto->EffectApplyAuraName[j]) // main aura added before triggered spell - { - case SPELL_AURA_MOD_SHAPESHIFT: - switch(i_spellId) - { - case 24858: if(spellId==24905) is_triggered_by_spell = true; break; - case 33891: if(spellId==5420 || spellId==34123) is_triggered_by_spell = true; break; - case 34551: if(spellId==22688) is_triggered_by_spell = true; break; - } - break; - } + else + next = m_Auras.begin(); } - - if(!is_triggered_by_spell) + else if( !is_sspc && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) { - SpellSpecific i_spellId_spec = GetSpellSpecific(i_spellId); - - bool is_sspc = IsSingleFromSpellSpecificPerCaster(spellId_spec,i_spellId_spec); - - if( is_sspc && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() ) + // Its a parent aura (create this aura in ApplyModifier) + if ((*i).second->IsInUse()) { - // cannot remove higher rank - if (spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) - if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) - return false; + sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); + continue; + } + RemoveAurasDueToSpell(i_spellId); + + if( m_Auras.empty() ) + break; + else + next = m_Auras.begin(); + } + // Potions stack aura by aura (elixirs/flask already checked) + else if( spellProto->SpellFamilyName == SPELLFAMILY_POTION && i_spellProto->SpellFamilyName == SPELLFAMILY_POTION ) + { + if (IsNoStackAuraDueToAura(spellId, effIndex, i_spellId, i_effIndex)) + { + if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) + return false; // cannot remove higher rank // Its a parent aura (create this aura in ApplyModifier) if ((*i).second->IsInUse()) @@ -3586,45 +3592,8 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); continue; } - RemoveAurasDueToSpell(i_spellId); - - if( m_Auras.empty() ) - break; - else - next = m_Auras.begin(); - } - else if( !is_sspc && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) - { - // Its a parent aura (create this aura in ApplyModifier) - if ((*i).second->IsInUse()) - { - sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); - continue; - } - RemoveAurasDueToSpell(i_spellId); - - if( m_Auras.empty() ) - break; - else - next = m_Auras.begin(); - } - // Potions stack aura by aura (elixirs/flask already checked) - else if( spellProto->SpellFamilyName == SPELLFAMILY_POTION && i_spellProto->SpellFamilyName == SPELLFAMILY_POTION ) - { - if (IsNoStackAuraDueToAura(spellId, effIndex, i_spellId, i_effIndex)) - { - if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) - return false; // cannot remove higher rank - - // Its a parent aura (create this aura in ApplyModifier) - if ((*i).second->IsInUse()) - { - sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex()); - continue; - } - RemoveAura(i); - next = i; - } + RemoveAura(i); + next = i; } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7b21feb01..91aa587da 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7187" + #define REVISION_NR "7188" #endif // __REVISION_NR_H__ From 72aa7bc5567356ea9901edb17ebdd78e284744e8 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 26 Jan 2009 22:03:36 +0300 Subject: [PATCH 30/48] [7189] Prevent use wrong security levels (>= SEC_CONSOLE) --- src/game/WorldSocket.cpp | 25 ++++++++++++++----------- src/shared/revision_nr.h | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 5bc447d25..4a74b5d75 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -791,17 +791,17 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) QueryResult *result = loginDatabase.PQuery ("SELECT " - "id, " //0 - "gmlevel, " //1 - "sessionkey, " //2 - "last_ip, " //3 - "locked, " //4 - "sha_pass_hash, " //5 - "v, " //6 - "s, " //7 - "expansion, " //8 - "mutetime, " //9 - "locale " //10 + "id, " //0 + "gmlevel, " //1 + "sessionkey, " //2 + "last_ip, " //3 + "locked, " //4 + "sha_pass_hash, " //5 + "v, " //6 + "s, " //7 + "expansion, " //8 + "mutetime, " //9 + "locale " //10 "FROM account " "WHERE username = '%s'", safe_account.c_str ()); @@ -891,6 +891,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) id = fields[0].GetUInt32 (); security = fields[1].GetUInt16 (); + if(security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB + security = SEC_ADMINISTRATOR; + K.SetHexStr (fields[2].GetString ()); time_t mutetime = time_t (fields[9].GetUInt64 ()); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 91aa587da..8b9bbd4e5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7188" + #define REVISION_NR "7189" #endif // __REVISION_NR_H__ From 1b99e1864ae71aedcde40cb41b6fdf198e8f5766 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 21:47:34 +0300 Subject: [PATCH 31/48] Restore some shaman totem work (implement 55441 gluph) Signed-off-by: DiSlord --- src/game/SpellEffects.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index e056cee0e..6dfb5217a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1727,12 +1727,29 @@ void Spell::EffectDummy(uint32 i) } return; } - - if(m_spellInfo->Id == 39610) // Mana-Tide Totem effect + // Healing Stream Totem + if(m_spellInfo->SpellFamilyFlags & 0x0000000000002000LL) + { + m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); + return; + } + // Mana Spring Totem + if(m_spellInfo->SpellFamilyFlags & 0x0000000000004000LL) + { + if(unitTarget->getPowerType()!=POWER_MANA) + return; + m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); + return; + } + if(m_spellInfo->Id == 39610) // Mana Tide Totem effect { if(!unitTarget || unitTarget->getPowerType() != POWER_MANA) return; - + // Glyph of Mana Tide + Unit *owner = m_caster->GetOwner(); + if (owner) + if (Aura *dummy = owner->GetDummyAura(55441)) + damage+=dummy->GetModifier()->m_amount; // Regenerate 6% of Total Mana Every 3 secs int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100; m_caster->CastCustomSpell(unitTarget,39609,&EffectBasePoints0,NULL,NULL,true,NULL,NULL,m_originalCasterGUID); From f96d29469a55adeb7698cbd6674d259109f00bd1 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 21:51:39 +0300 Subject: [PATCH 32/48] Implement 50 PELL_AURA_MOD_CRITICAL_HEALING_BONUS aura Signed-off-by: DiSlord --- src/game/Spell.cpp | 2 +- src/game/SpellAuraDefines.h | 2 +- src/game/SpellAuras.cpp | 2 +- src/game/Unit.cpp | 34 ++++++++++++++++++++++++++++++++-- src/game/Unit.h | 3 ++- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b3308e243..dd176713a 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -967,7 +967,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if (crit) { procEx |= PROC_EX_CRITICAL_HIT; - addhealth = caster->SpellCriticalBonus(m_spellInfo, addhealth, NULL); + addhealth = caster->SpellCriticalHealingBonus(m_spellInfo, addhealth, NULL); } else procEx |= PROC_EX_NORMAL_HIT; diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index a0cc70711..0e6dc12b0 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -92,7 +92,7 @@ enum AuraType SPELL_AURA_MOD_PARRY_PERCENT = 47, SPELL_AURA_MOD_DODGE_SKILL = 48, SPELL_AURA_MOD_DODGE_PERCENT = 49, - SPELL_AURA_MOD_BLOCK_SKILL = 50, + SPELL_AURA_MOD_CRITICAL_HEALING_BONUS = 50, SPELL_AURA_MOD_BLOCK_PERCENT = 51, SPELL_AURA_MOD_CRIT_PERCENT = 52, SPELL_AURA_PERIODIC_LEECH = 53, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 47b6f2c4b..ab20fc96b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -100,7 +100,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT &Aura::HandleUnused, // 48 SPELL_AURA_MOD_DODGE_SKILL obsolete? &Aura::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT - &Aura::HandleUnused, // 50 SPELL_AURA_MOD_BLOCK_SKILL obsolete? + &Aura::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_BONUS &Aura::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT &Aura::HandleAuraModCritPercent, // 52 SPELL_AURA_MOD_CRIT_PERCENT &Aura::HandlePeriodicLeech, // 53 SPELL_AURA_PERIODIC_LEECH diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 75bc8d297..6220f4443 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1078,7 +1078,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S if (crit) { damageInfo->HitInfo|= SPELL_HIT_TYPE_CRIT; - damage = SpellCriticalBonus(spellInfo, damage, pVictim); + damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim); // Resilience - reduce crit damage if (pVictim->GetTypeId()==TYPEID_PLAYER) damage -= ((Player*)pVictim)->GetSpellCritDamageReduction(damage); @@ -8033,7 +8033,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM return false; } -uint32 Unit::SpellCriticalBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim) +uint32 Unit::SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim) { // Calculate critical bonus int32 crit_bonus; @@ -8065,6 +8065,36 @@ uint32 Unit::SpellCriticalBonus(SpellEntry const *spellProto, uint32 damage, Uni return damage; } +uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim) +{ + // Calculate critical bonus + int32 crit_bonus; + switch(spellProto->DmgClass) + { + case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100% + case SPELL_DAMAGE_CLASS_RANGED: + // TODO: write here full calculation for melee/ranged spells + crit_bonus = damage; + break; + default: + crit_bonus = damage / 2; // for spells is 50% + break; + } + + crit_bonus = int32(crit_bonus * GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_BONUS)); + + if(pVictim) + { + uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); + crit_bonus = int32(crit_bonus * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask)); + } + + if(crit_bonus > 0) + damage += crit_bonus; + + return damage; +} + uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, Unit *pVictim) { // For totems get healing bonus from owner (statue isn't totem in fact) diff --git a/src/game/Unit.h b/src/game/Unit.h index cee454f89..760d1e5c4 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1297,7 +1297,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject uint32 SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, Unit *pVictim); bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK); - uint32 SpellCriticalBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); + uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); + uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; } bool IsUnderLastManaUseEffect() const; From 87085646f2618efe3e206ef7204ef5ad7e4c72c3 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 21:52:39 +0300 Subject: [PATCH 33/48] Remove dead code Signed-off-by: DiSlord --- src/game/SpellAuras.h | 9 --------- src/game/Unit.cpp | 13 +------------ 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 7b4ee52d3..a1ba34f24 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -20,15 +20,6 @@ #include "SpellAuraDefines.h" -struct DamageManaShield -{ - uint32 m_spellId; - uint32 m_modType; - int32 m_schoolType; - uint32 m_totalAbsorb; - uint32 m_currAbsorb; -}; - struct Modifier { AuraType m_auraname; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6220f4443..b6d5274da 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6545,7 +6545,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB if(!procSpell) return false; // For trigger from Blizzard need exist Improved Blizzard - if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && procSpell->SpellFamilyFlags & 0x0000000000000080) + if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && procSpell->SpellFamilyFlags & 0x0000000000000080LL) { bool found = false; AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); @@ -7615,17 +7615,6 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 TakenTotalMod *= (mod+100.0f)/100.0f; } break; - // Mangle - case 2312: - for(int j=0;j<3;j++) - { - if(GetEffectMechanic(spellProto, j)==MECHANIC_BLEED) - { - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; - break; - } - } - break; } } From b5fefe7d866427dee513acb61100ee37efbf2246 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 21:57:59 +0300 Subject: [PATCH 34/48] Implement warrior 1464 and ranks Signed-off-by: DiSlord --- src/game/SpellEffects.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 6dfb5217a..31578207d 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1271,6 +1271,15 @@ void Spell::EffectDummy(uint32 i) m_caster->SetPower(POWER_RAGE,0); return; } + // Slam + if(m_spellInfo->SpellFamilyFlags & 0x0000000000200000LL) + { + if(!unitTarget) + return; + m_damage+=m_caster->CalculateDamage(m_attackType, false); + m_damage+=damage; + return; + } switch(m_spellInfo->Id) { // Warrior's Wrath From e0b59c21ec5e24b47f66c0b9f2670466a4b9c570 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 21:58:51 +0300 Subject: [PATCH 35/48] Implement 3 TARGET_RANDOM_FRIEND_CHAIN_IN_AREA target type Signed-off-by: DiSlord --- src/game/SharedDefines.h | 1 + src/game/Spell.cpp | 67 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index ae456ce79..711823895 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -797,6 +797,7 @@ enum Targets { TARGET_SELF = 1, TARGET_RANDOM_ENEMY_CHAIN_IN_AREA = 2, // only one spell has that, but regardless, it's a target type after all + TARGET_RANDOM_FRIEND_CHAIN_IN_AREA = 3, TARGET_PET = 5, TARGET_CHAIN_DAMAGE = 6, TARGET_AREAEFFECT_CUSTOM = 8, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index dd176713a..2aa793449 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1378,6 +1378,73 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) --t; } }break; + case TARGET_RANDOM_FRIEND_CHAIN_IN_AREA: + { + m_targets.m_targetMask = 0; + unMaxTargets = EffectChainTarget; + float max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS; + CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + std::list tempUnitMap; + { + MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, max_range); + MaNGOS::UnitListSearcher searcher(tempUnitMap, u_check); + + TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); + + CellLock cell_lock(cell, p); + cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap()); + } + + if(tempUnitMap.empty()) + break; + + tempUnitMap.sort(TargetDistanceOrder(m_caster)); + + //Now to get us a random target that's in the initial range of the spell + uint32 t = 0; + std::list::iterator itr = tempUnitMap.begin(); + while(itr!= tempUnitMap.end() && (*itr)->GetDistance(m_caster) < radius) + ++t, ++itr; + + if(!t) + break; + + itr = tempUnitMap.begin(); + std::advance(itr, rand()%t); + Unit *pUnitTarget = *itr; + TagUnitMap.push_back(pUnitTarget); + + tempUnitMap.erase(itr); + + tempUnitMap.sort(TargetDistanceOrder(pUnitTarget)); + + t = unMaxTargets - 1; + Unit *prev = pUnitTarget; + std::list::iterator next = tempUnitMap.begin(); + + while(t && next != tempUnitMap.end() ) + { + if(prev->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS) + break; + + if(!prev->IsWithinLOSInMap(*next)) + { + ++next; + continue; + } + prev = *next; + TagUnitMap.push_back(prev); + tempUnitMap.erase(next); + tempUnitMap.sort(TargetDistanceOrder(prev)); + next = tempUnitMap.begin(); + --t; + } + }break; case TARGET_PET: { Pet* tmpUnit = m_caster->GetPet(); From 6c51a318fdb168a941be972f2b77cda342961cf8 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 21:59:40 +0300 Subject: [PATCH 36/48] Fix some typos in SPELL_AURA_ADD_TARGET_TRIGGER aura work Signed-off-by: DiSlord --- src/game/Spell.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 2aa793449..a8283b1ee 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2740,29 +2740,27 @@ void Spell::finish(bool ok) if (m_caster->GetTypeId() == TYPEID_PLAYER) ((Player*)m_caster)->RemoveSpellMods(this); - //handle SPELL_AURA_ADD_TARGET_TRIGGER auras + // handle SPELL_AURA_ADD_TARGET_TRIGGER auras Unit::AuraList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER); for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i) { - SpellEntry const *auraSpellInfo = (*i)->GetSpellProto(); - uint32 auraSpellIdx = (*i)->GetEffIndex(); - if (IsAffectedByAura((*i))) - { - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) - if( ihit->effectMask & (1<isAffectedOnSpell(m_spellInfo)) + continue; + for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + if( ihit->missCondition == SPELL_MISS_NONE ) { // check m_caster->GetGUID() let load auras at login and speedup most often case Unit *unit = m_caster->GetGUID()== ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit && unit->isAlive()) { + SpellEntry const *auraSpellInfo = (*i)->GetSpellProto(); + uint32 auraSpellIdx = (*i)->GetEffIndex(); // Calculate chance at that moment (can be depend for example from combo points) int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(),unit); - if(roll_chance_i(chance)) m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i)); } } - } } // Heal caster for all health leech from all targets From a49ea2404716f12ffeac48cb322faee90906bf11 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 22:01:15 +0300 Subject: [PATCH 37/48] Remove not need code (implemented by another way) Signed-off-by: DiSlord --- src/game/SpellAuras.cpp | 49 --------------------------------------- src/game/SpellEffects.cpp | 32 ------------------------- 2 files changed, 81 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ab20fc96b..a9eb157e8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4092,40 +4092,6 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real) void Aura::HandlePeriodicHeal(bool apply, bool Real) { m_isPeriodic = apply; - - // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); - - if(!loading && apply) - { - switch (m_spellProto->SpellFamilyName) - { - case SPELLFAMILY_DRUID: - { - // Rejuvenation - if(m_spellProto->SpellFamilyFlags & 0x0000000000000010LL) - { - if(Unit* caster = GetCaster()) - { - Unit::AuraList const& classScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator k = classScripts.begin(); k != classScripts.end(); ++k) - { - int32 tickcount = GetSpellDuration(m_spellProto) / m_spellProto->EffectAmplitude[m_effIndex]; - switch((*k)->GetModifier()->m_miscvalue) - { - case 4953: // Increased Rejuvenation Healing - Harold's Rejuvenating Broach Aura - case 4415: // Increased Rejuvenation Healing - Idol of Rejuvenation Aura - { - m_modifier.m_amount += (*k)->GetModifier()->m_amount / tickcount; - break; - } - } - } - } - } - } - } - } } void Aura::HandlePeriodicDamage(bool apply, bool Real) @@ -4284,21 +4250,6 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) int32 holy = caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) + caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellProto), m_target); m_modifier.m_amount += int32(0.04f*holy + 0.04f*ap); - - // Improved Consecration - Libram of the Eternal Rest - Unit::AuraList const& classScripts = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator k = classScripts.begin(); k != classScripts.end(); ++k) - { - switch((*k)->GetModifier()->m_miscvalue) - { - case 5147: - { - int32 tickcount = GetSpellDuration(m_spellProto) / m_spellProto->EffectAmplitude[m_effIndex]; - m_modifier.m_amount += (*k)->GetModifier()->m_amount / tickcount; - break; - } - } - } return; } // Seal of Vengeance 0.013*$SPH+0.025*$AP per tick (also can stack) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 31578207d..e40373033 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -435,38 +435,6 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.08f); } - // Starfire - else if ( m_spellInfo->SpellFamilyFlags & 0x0004LL ) - { - Unit::AuraList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator i = m_OverrideClassScript.begin(); i != m_OverrideClassScript.end(); ++i) - { - // Starfire Bonus (caster) - switch((*i)->GetModifier()->m_miscvalue) - { - case 5481: // Nordrassil Regalia - bonus - { - Unit::AuraList const& m_periodicDamageAuras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator itr = m_periodicDamageAuras.begin(); itr != m_periodicDamageAuras.end(); ++itr) - { - // Moonfire or Insect Swarm (target debuff from any casters) - if ( (*itr)->GetSpellProto()->SpellFamilyFlags & 0x00200002LL ) - { - int32 mod = (*i)->GetModifier()->m_amount; - damage += damage*mod/100; - break; - } - } - break; - } - case 5148: //Improved Starfire - Ivory Idol of the Moongoddes Aura - { - damage += (*i)->GetModifier()->m_amount; - break; - } - } - } - } //Mangle Bonus for the initial damage of Lacerate and Rake if((m_spellInfo->SpellFamilyFlags==0x0000000000001000LL && m_spellInfo->SpellIconID==494) || (m_spellInfo->SpellFamilyFlags==0x0000010000000000LL && m_spellInfo->SpellIconID==2246)) From a56c9a11a1ae112f094309332dc012ea280ba8d9 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 22:02:06 +0300 Subject: [PATCH 38/48] Remove warrior debuff after some auras end Signed-off-by: DiSlord --- src/game/SpellAuras.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a9eb157e8..bf747be48 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5466,6 +5466,14 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real ) void Aura::CleanupTriggeredSpells() { + if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags & 0x0000001000000020LL) + { + // Blood Frenzy remove + m_target->RemoveAurasDueToSpell(30069); + m_target->RemoveAurasDueToSpell(30070); + return; + } + uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()]; if(!tSpellId) return; From 37abcf28f35fecd366efaaf5dfd298114017142a Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 22:03:23 +0300 Subject: [PATCH 39/48] Implement some SPELL_AURA_OVERRIDE_CLASS_SCRIPTS for crit mods Signed-off-by: DiSlord --- src/game/Unit.cpp | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b6d5274da..aaf409dc8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7963,30 +7963,38 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM // Modify by player victim resilience if (pVictim->GetTypeId() == TYPEID_PLAYER) crit_chance -= ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL); + // scripted (increase crit chance ... against ... target by x% - if(pVictim->isFrozen()) // Shatter + AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { - AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) + if (!((*i)->isAffectedOnSpell(spellProto))) + continue; + switch((*i)->GetModifier()->m_miscvalue) { - switch((*i)->GetModifier()->m_miscvalue) - { - case 849: crit_chance+= 17.0f; break; //Shatter Rank 1 - case 910: crit_chance+= 34.0f; break; //Shatter Rank 2 - case 911: crit_chance+= 50.0f; break; //Shatter Rank 3 - } + case 849: if (pVictim->isFrozen()) crit_chance+= 17.0f; break; //Shatter Rank 1 + case 910: if (pVictim->isFrozen()) crit_chance+= 34.0f; break; //Shatter Rank 2 + case 911: if (pVictim->isFrozen()) crit_chance+= 50.0f; break; //Shatter Rank 3 + case 7917: // Glyph of Shadowburn + if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) + crit_chance+=(*i)->GetModifier()->m_amount; + break; + case 7997: // Renewed Hope + case 7998: + if (pVictim->HasAura(6788)) + crit_chance+=(*i)->GetModifier()->m_amount; + break; + case 21: // Test of Faith + case 6935: + case 6918: + if (pVictim->GetHealth() < pVictim->GetMaxHealth()/2) + crit_chance+=(*i)->GetModifier()->m_amount; + break; + default: + break; } } - // Glyph of Shadowburn - if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && - spellProto->SpellFamilyFlags & 0x0000000000000080LL && - pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - { - AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) - if((*i)->GetModifier()->m_miscvalue == 7917) - crit_chance+=(*i)->GetModifier()->m_amount; - } + // Sacred Shield if (spellProto->SpellFamilyName == SPELLFAMILY_PALADIN && spellProto->SpellFamilyFlags & 0x0000000040000000LL) From 026a12d224f78c01bdbb0e172f880adb6d70e088 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 22:08:44 +0300 Subject: [PATCH 40/48] Rewrite code for Unit::SpellDamageBonus (no big changes) Signed-off-by: DiSlord --- src/game/Unit.cpp | 165 +++++++++++++++++++++++----------------------- 1 file changed, 84 insertions(+), 81 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index aaf409dc8..108bd404b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7360,67 +7360,24 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if(!spellProto || !pVictim || damagetype==DIRECT_DAMAGE ) return pdamage; - int32 BonusDamage = 0; - if( GetTypeId()==TYPEID_UNIT ) + // For totems get damage bonus from owner (statue isn't totem in fact) + if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) { - // Pets just add their bonus damage to their spell damage - // note that their spell damage is just gain of their own auras - if (((Creature*)this)->isPet()) - { - BonusDamage = ((Pet*)this)->GetBonusDamage(); - } - // For totems get damage bonus from owner (statue isn't totem in fact) - else if (((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) - { - if(Unit* owner = GetOwner()) - return owner->SpellDamageBonus(pVictim, spellProto, pdamage, damagetype); - } - } - - // Damage Done - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - - // Taken/Done fixed damage bonus auras - int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto))+BonusDamage; - int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); - - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if(damagetype == DOT) - { - int32 DotDuration = GetSpellDuration(spellProto); - // 200% limit - if(DotDuration > 0) - { - if(DotDuration > 30000) DotDuration = 30000; - if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f; - int x = 0; - for(int j = 0; j < 3; j++) - { - if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) - { - x = j; - break; - } - } - int DotTicks = 6; - if(spellProto->EffectAmplitude[x] != 0) - DotTicks = DotDuration / spellProto->EffectAmplitude[x]; - if(DotTicks) - { - DoneAdvertisedBenefit /= DotTicks; - TakenAdvertisedBenefit /= DotTicks; - } - } + if(Unit* owner = GetOwner()) + return owner->SpellDamageBonus(pVictim, spellProto, pdamage, damagetype); } // Taken/Done total percent damage auras float DoneTotalMod = 1.0f; float TakenTotalMod = 1.0f; + uint32 DoneTotal = 0; + uint32 TakenTotal = 0; // ..done + // Pet damage + if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet() ) + DoneTotalMod *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank); + AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for(AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { @@ -7435,17 +7392,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); + // Add flat bonus from spell damage versus + DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask); AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; - // ..taken - AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); - for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) - if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) ) - TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; - // done scripted mod (take it from owner) Unit *owner = GetOwner(); if (!owner) owner = this; @@ -7456,12 +7409,14 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 continue; switch((*i)->GetModifier()->m_miscvalue) { - // Molten Fury - case 4920: + case 4920: // Molten Fury case 4919: + case 6917: // Death's Embrace + case 6926: + case 6928: { if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; break; } // Soul Siphon @@ -7474,13 +7429,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[0], this); // count affliction effects and calc additional damage in percentage int32 modPercent = 0; - Unit::AuraMap const& victimAuras = pVictim->GetAuras(); - for (Unit::AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) + AuraMap const& victimAuras = pVictim->GetAuras(); + for (AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) { SpellEntry const* m_spell = itr->second->GetSpellProto(); if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags & 0x0004071B8044C402LL)) continue; - modPercent += stepPercent; + modPercent += stepPercent * itr->second->GetStackAmount(); if (modPercent >= maxPercent) { modPercent = maxPercent; @@ -7490,8 +7445,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 DoneTotalMod *= (modPercent+100.0f)/100.0f; break; } - // Starfire Bonus - case 5481: + case 6916: // Death's Embrace + case 6925: + case 6927: + if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT)) + DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + break; + case 5481: // Starfire Bonus { AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) @@ -7510,11 +7470,11 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 case 4554: // Increased Lightning Damage case 4555: // Improved Moonfire case 5142: // Increased Lightning Damage - case 5147: // Improved Consecration + case 5147: // Improved Consecration / Libram of Resurgence case 5148: // Idol of the Shooting Star case 6008: // Increased Lightning Damage / Totem of Hex { - pdamage+=(*i)->GetModifier()->m_amount; + DoneTotal+=(*i)->GetModifier()->m_amount; break; } // Tundra Stalker @@ -7525,7 +7485,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if ((*i)->GetSpellProto()->SpellIconID == 2656) { if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; } else // Tundra Stalker { @@ -7543,7 +7503,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } break; } - case 7293: + case 7293: // Rage of Rivendare { AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) @@ -7597,6 +7557,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } } } + + // ..taken + AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); + for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) + if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) ) + TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + // .. taken pct: dummy auras AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); for(AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) @@ -7634,6 +7601,49 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; } + // Damage Done from spell damage bonus + uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); + + // Taken/Done fixed damage bonus auras + int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto)); + int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); + + // Pets just add their bonus damage to their spell damage + // note that their spell damage is just gain of their own auras + if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) + DoneAdvertisedBenefit += ((Pet*)this)->GetBonusDamage(); + + // Damage over Time spells bonus calculation + float DotFactor = 1.0f; + if(damagetype == DOT) + { + int32 DotDuration = GetSpellDuration(spellProto); + // 200% limit + if(DotDuration > 0) + { + if(DotDuration > 30000) DotDuration = 30000; + if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f; + int x = 0; + for(int j = 0; j < 3; j++) + { + if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( + spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || + spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) + { + x = j; + break; + } + } + int DotTicks = 6; + if(spellProto->EffectAmplitude[x] != 0) + DotTicks = DotDuration / spellProto->EffectAmplitude[x]; + if(DotTicks) + { + DoneAdvertisedBenefit /= DotTicks; + TakenAdvertisedBenefit /= DotTicks; + } + } + } // Distribute Damage over multiple effects, reduce by AoE CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); @@ -7853,19 +7863,12 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 float DoneActualBenefit = DoneAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * SpellModSpellDamage * LvlPenalty; float TakenActualBenefit = TakenAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty; - float tmpDamage = (float(pdamage)+DoneActualBenefit)*DoneTotalMod; - - // Add flat bonus from spell damage versus - tmpDamage += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask); - - // apply spellmod to Done damage + float tmpDamage = (float(pdamage)+DoneActualBenefit + DoneTotal)*DoneTotalMod; + // apply spellmod to Done damage (flat and pct) if(Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage); - tmpDamage = (tmpDamage+TakenActualBenefit)*TakenTotalMod; - - if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet() ) - tmpDamage *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank); + tmpDamage = (tmpDamage + TakenActualBenefit + TakenTotal)*TakenTotalMod; return tmpDamage > 0 ? uint32(tmpDamage) : 0; } From 7cefa74f8b4a989829116f57c2c7ae46bb77d541 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 22:10:37 +0300 Subject: [PATCH 41/48] [7190] Rewrite code for Unit::SpellHealingBonus (no big changes) Implement SPELL_AURA_OVERRIDE_CLASS_SCRIPTS auras for healing mod Remove dead code Implement SPELL_AURA_MOD_HEALING_RECEIVED aura Signed-off-by: DiSlord --- src/game/SpellAuras.cpp | 2 +- src/game/Unit.cpp | 153 ++++++++++++++++++++++++++++----------- src/shared/revision_nr.h | 2 +- 3 files changed, 114 insertions(+), 43 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index bf747be48..ba6c10424 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -333,7 +333,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNULL, //280 SPELL_AURA_MOD_TARGET_ARMOR_PCT &Aura::HandleNULL, //281 SPELL_AURA_MOD_HONOR_GAIN &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT - &Aura::HandleNULL //283 SPD/heal from AP? + &Aura::HandleNoImmediateEffect //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus }; Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) : diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 108bd404b..61e88cc5d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8110,33 +8110,101 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, spellProto->Id == 38395 || spellProto->Id == 40972) return healamount; - int32 AdvertisedBenefit = SpellBaseHealingBonus(GetSpellSchoolMask(spellProto)); - uint32 CastingTime = GetSpellCastTime(spellProto); + // Taken/Done total percent damage auras + float DoneTotalMod = 1.0f; + float TakenTotalMod = 1.0f; + uint32 DoneTotal = 0; + uint32 TakenTotal = 0; - // Healing Taken - AdvertisedBenefit += SpellBaseHealingBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); + // Healing done percent + AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); + for(AuraList::const_iterator i = mHealingDonePct.begin();i != mHealingDonePct.end(); ++i) + DoneTotalMod *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; - // Blessing of Light dummy effects healing taken from Holy Light and Flash of Light - if (spellProto->SpellFamilyName == SPELLFAMILY_PALADIN && (spellProto->SpellFamilyFlags & 0x00000000C0000000LL)) + // done scripted mod (take it from owner) + Unit *owner = GetOwner(); + if (!owner) owner = this; + AuraList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { - AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); - for(AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) + if (!(*i)->isAffectedOnSpell(spellProto)) + continue; + switch((*i)->GetModifier()->m_miscvalue) { - if((*i)->GetSpellProto()->SpellVisual[0] == 9180) + case 4415: // Increased Rejuvenation Healing + case 4953: + case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind + DoneTotal+=(*i)->GetModifier()->m_amount; + break; + case 7997: // Renewed Hope + case 7998: + if (pVictim->HasAura(6788)) + DoneTotalMod *=((*i)->GetModifier()->m_amount + 100.0f)/100.0f; + break; + case 21: // Test of Faith + case 6935: + case 6918: + if (pVictim->GetHealth() < pVictim->GetMaxHealth()/2) + DoneTotalMod *=((*i)->GetModifier()->m_amount + 100.0f)/100.0f; + break; + case 7798: // Glyph of Regrowth { - // Flash of Light - if ((spellProto->SpellFamilyFlags & 0x0000000040000000LL) && (*i)->GetEffIndex() == 1) - AdvertisedBenefit += (*i)->GetModifier()->m_amount; - // Holy Light - else if ((spellProto->SpellFamilyFlags & 0x0000000080000000LL) && (*i)->GetEffIndex() == 0) - AdvertisedBenefit += (*i)->GetModifier()->m_amount; + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_HEAL); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_DRUID && + m_spell->SpellFamilyFlags & 0x0000000000000040LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; } + case 8477: // Nourish Heal Boost + { + int32 stepPercent = (*i)->GetModifier()->m_amount; + int32 modPercent = 0; + AuraMap const& victimAuras = pVictim->GetAuras(); + for (AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) + { + if (itr->second->GetCasterGUID()!=GetGUID()) + continue; + SpellEntry const* m_spell = itr->second->GetSpellProto(); + if ( m_spell->SpellFamilyName != SPELLFAMILY_DRUID || + !(m_spell->SpellFamilyFlags & 0x0000001000000050LL)) + continue; + modPercent += stepPercent * itr->second->GetStackAmount(); + } + DoneTotalMod *= (modPercent+100.0f)/100.0f; + break; + } + case 7871: // Glyph of Lesser Healing Wave + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + if ((*itr)->GetCasterGUID()!=GetGUID()) + continue; + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_SHAMAN && + m_spell->SpellFamilyFlags & 0x0000040000000000LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; + } + default: + break; } } - float ActualBenefit = 0.0f; - - if (AdvertisedBenefit != 0) + int32 DoneAdvertisedBenefit = SpellBaseHealingBonus(GetSpellSchoolMask(spellProto)); + int32 TakenAdvertisedBenefit = SpellBaseHealingBonusForVictim(GetSpellSchoolMask(spellProto), pVictim); + if (DoneAdvertisedBenefit != 0 && TakenAdvertisedBenefit!=0) { // Healing over Time spells float DotFactor = 1.0f; @@ -8163,9 +8231,13 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, if(spellProto->EffectAmplitude[x] != 0) DotTicks = DotDuration / spellProto->EffectAmplitude[x]; if(DotTicks) - AdvertisedBenefit /= DotTicks; + { + DoneAdvertisedBenefit /= DotTicks; + TakenAdvertisedBenefit /= DotTicks; + } } } + uint32 CastingTime = GetSpellCastTime(spellProto); // distribute healing to all effects, reduce AoE damage CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); @@ -8184,12 +8256,15 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, // Exception switch (spellProto->SpellFamilyName) { - case SPELLFAMILY_SHAMAN: + case SPELLFAMILY_GENERIC: // Healing stream from totem (add 6% per tick from hill bonus owner) - if (spellProto->SpellFamilyFlags & 0x000000002000LL) + // Possibly need do it on apply dummy aura + if (spellProto->Id == 52042) CastingTime = 210; + break; + case SPELLFAMILY_SHAMAN: // Earth Shield 30% per charge - else if (spellProto->SpellFamilyFlags & 0x40000000000LL) + if (spellProto->SpellFamilyFlags & 0x40000000000LL) CastingTime = 1050; break; case SPELLFAMILY_DRUID: @@ -8239,48 +8314,44 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, SpellModSpellDamage /= 100.0f; - ActualBenefit = (float)AdvertisedBenefit * ((float)CastingTime / 3500.0f) * DotFactor * SpellModSpellDamage * LvlPenalty; + DoneTotal += (float)DoneAdvertisedBenefit * ((float)CastingTime / 3500.0f) * DotFactor * SpellModSpellDamage * LvlPenalty; + TakenTotal += (float)TakenAdvertisedBenefit * ((float)CastingTime / 3500.0f) * DotFactor * SpellModSpellDamage * LvlPenalty; } // use float as more appropriate for negative values and percent applying - float heal = healamount + ActualBenefit; - - // TODO: check for ALL/SPELLS type - // Healing done percent - AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); - for(AuraList::const_iterator i = mHealingDonePct.begin();i != mHealingDonePct.end(); ++i) - heal *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; - + float heal = (healamount + DoneTotal)*DoneTotalMod; // apply spellmod to Done amount if(Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); + // Taken mods // Healing Wave cast if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags & 0x0000000000000040LL) { - // Search for Healing Way on Victim (stack up to 3 time) - int32 pctMod = 0; + // Search for Healing Way on Victim Unit::AuraList const& auraDummy = pVictim->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr!=auraDummy.end(); ++itr) if((*itr)->GetId() == 29203) - pctMod += (*itr)->GetModifier()->m_amount; - // Apply bonus - if (pctMod) - heal = heal * (100 + pctMod) / 100; + TakenTotalMod *= (*itr)->GetModifier()->m_amount; } // Healing taken percent float minval = pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if(minval) - heal *= (100.0f + minval) / 100.0f; + TakenTotalMod *= (100.0f + minval) / 100.0f; float maxval = pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if(maxval) - heal *= (100.0f + maxval) / 100.0f; + TakenTotalMod *= (100.0f + maxval) / 100.0f; - if (heal < 0) heal = 0; + AuraList const& mHealingGet= pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); + for(AuraList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) + if ((*i)->isAffectedOnSpell(spellProto)) + TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; - return uint32(heal); + heal = (heal + TakenTotal) * TakenTotalMod; + + return heal < 0 ? 0 : uint32(heal); } int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8b9bbd4e5..71d4d56a9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7189" + #define REVISION_NR "7190" #endif // __REVISION_NR_H__ From 661cc9bf5b18904cc71dabd18436bab2623ea0dc Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 26 Jan 2009 22:18:46 +0300 Subject: [PATCH 42/48] Disable recently added at master CMSG_CALENDAR_GET_CALENDAR sent, not compatiable with client. --- src/game/CalendarHandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index 6b1484bcb..8a5bc78e8 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -30,7 +30,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); recv_data.hexlike(); - +/* not compatible with 3.0.8? client crash at receive... :( time_t cur_time = time(NULL); WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4); @@ -68,6 +68,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) sLog.outDebug("Sending calendar"); //data.hexlike(); SendPacket(&data); +*/ } void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data) From 3f0b117062bcaad63f79f3a8608c745db4fd2b95 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 26 Jan 2009 22:33:42 +0300 Subject: [PATCH 43/48] Remove trailing whitespaces. --- src/game/Level3.cpp | 2 +- src/game/Unit.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 1063d6be4..267c1c83e 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -876,7 +876,7 @@ bool ChatHandler::HandleSetSkillCommand(const char* args) { // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r char* skill_p = extractKeyFromLink((char*)args,"Hskill"); - if(!skill_p) + if(!skill_p) return false; char *level_p = strtok (NULL, " "); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 61e88cc5d..ecc6d321f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8172,7 +8172,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, if (itr->second->GetCasterGUID()!=GetGUID()) continue; SpellEntry const* m_spell = itr->second->GetSpellProto(); - if ( m_spell->SpellFamilyName != SPELLFAMILY_DRUID || + if ( m_spell->SpellFamilyName != SPELLFAMILY_DRUID || !(m_spell->SpellFamilyFlags & 0x0000001000000050LL)) continue; modPercent += stepPercent * itr->second->GetStackAmount(); @@ -8258,7 +8258,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, { case SPELLFAMILY_GENERIC: // Healing stream from totem (add 6% per tick from hill bonus owner) - // Possibly need do it on apply dummy aura + // Possibly need do it on apply dummy aura if (spellProto->Id == 52042) CastingTime = 210; break; @@ -8347,7 +8347,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, AuraList const& mHealingGet= pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); for(AuraList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) if ((*i)->isAffectedOnSpell(spellProto)) - TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; + TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; heal = (heal + TakenTotal) * TakenTotalMod; From d88bf2643b234e73d9ba2dd9ec5aa4185f08b15c Mon Sep 17 00:00:00 2001 From: Woweur Date: Mon, 26 Jan 2009 23:57:35 +0300 Subject: [PATCH 44/48] Fixed SMSG_ARENA_TEAM_ROSTER structure. --- src/game/ArenaTeam.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 8fa06e38b..67b816ac9 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -306,6 +306,7 @@ void ArenaTeam::Roster(WorldSession *session) WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100); data << uint32(GetId()); // arena team id + data << uint8(0); // unknow 3.0.8 data << uint32(GetMembersSize()); // members count data << uint32(GetType()); // arena team type? @@ -325,6 +326,7 @@ void ArenaTeam::Roster(WorldSession *session) data << uint32(itr->wins_season); // wins this season data << uint32(itr->personal_rating); // personal rating } + session->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_ROSTER"); } From 09162d082ce0336f0b70b09090c68047b3d910af Mon Sep 17 00:00:00 2001 From: balrok Date: Mon, 26 Jan 2009 23:09:07 +0300 Subject: [PATCH 45/48] Some more info about SMSG_ARENA_TEAM_ROSTER structure. --- src/game/ArenaTeam.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 67b816ac9..a8bd08113 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -304,9 +304,11 @@ void ArenaTeam::Roster(WorldSession *session) { Player *pl = NULL; + uint8 unk308 = 0; + WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100); data << uint32(GetId()); // arena team id - data << uint8(0); // unknow 3.0.8 + data << uint8(unk308); // 308 unknown value but affect packet structure data << uint32(GetMembersSize()); // members count data << uint32(GetType()); // arena team type? @@ -314,17 +316,22 @@ void ArenaTeam::Roster(WorldSession *session) { pl = objmgr.GetPlayer(itr->guid); - data << uint64(itr->guid); // guid - data << uint8((pl ? 1 : 0)); // online flag - data << itr->name; // member name + data << uint64(itr->guid); // guid + data << uint8((pl ? 1 : 0)); // online flag + data << itr->name; // member name data << uint32((itr->guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member - data << uint8((pl ? pl->getLevel() : 0)); // unknown, level? - data << uint8(itr->Class); // class - data << uint32(itr->games_week); // played this week - data << uint32(itr->wins_week); // wins this week - data << uint32(itr->games_season); // played this season - data << uint32(itr->wins_season); // wins this season - data << uint32(itr->personal_rating); // personal rating + data << uint8((pl ? pl->getLevel() : 0)); // unknown, level? + data << uint8(itr->Class); // class + data << uint32(itr->games_week); // played this week + data << uint32(itr->wins_week); // wins this week + data << uint32(itr->games_season); // played this season + data << uint32(itr->wins_season); // wins this season + data << uint32(itr->personal_rating); // personal rating + if(unk308) + { + data << float(0.0); // 308 unk + data << float(0.0); // 308 unk + } } session->SendPacket(&data); From 889817235dd21dedcdd07d7bd2ad60ad6bd0a6fb Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 28 Jan 2009 06:14:43 +0300 Subject: [PATCH 46/48] Fixed quest items objectived show in quest description SMSG_QUEST_QUERY_RESPONSE. Original patch provided by traponinet. TODO: implement 5 item objective use in ciode and DB. --- src/game/GossipDef.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index c7c770bfa..f8b346805 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -593,17 +593,18 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) data << uint32(pQuest->ReqCreatureOrGOId[iI]); } data << uint32(pQuest->ReqCreatureOrGOCount[iI]); - //data << uint32(pQuest->ReqItemId[iI]); - //data << uint32(pQuest->ReqItemCount[iI]); data << uint32(0); // added in WotLK, dunno if offset if correct } - for (iI = 0; iI < 5; ++iI) // items? + for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI) { - data << uint32(0); - data << uint32(0); + data << uint32(pQuest->ReqItemId[iI]); + data << uint32(pQuest->ReqItemCount[iI]); } + data << uint32(0); // TODO: 5 item objective + data << uint32(0); + for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; iI++) data << ObjectiveText[iI]; From 9ba229213f9fa8c7e54f2a6123616262d812fc97 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 28 Jan 2009 07:40:42 +0300 Subject: [PATCH 47/48] Updated client build --- src/realmd/AuthCodes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index b8af975c5..ade1629c8 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // we need to stick to 1 version or half of the stuff will work for someone // others will not and opposite -// will only support WoW, WoW:TBC and WoW:WotLK 3.0.8 client build 9464... +// will only support WoW, WoW:TBC and WoW:WotLK 3.0.8 client build 9506... -#define EXPECTED_MANGOS_CLIENT_BUILD {9464, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {9506, 0} #endif From fb317f5aaa30b502d8b32a9893014e23f2acd923 Mon Sep 17 00:00:00 2001 From: Energy Date: Thu, 29 Jan 2009 02:21:30 +0300 Subject: [PATCH 48/48] Update CMSG_CALENDAR_GET_CALENDAR structure and re-enable for 3.0.8. Signed-off-by: VladimirMangos --- src/game/CalendarHandler.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index 8a5bc78e8..daf3adb5e 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -24,13 +24,10 @@ #include "Opcodes.h" #include "InstanceSaveMgr.h" - - void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) { sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); recv_data.hexlike(); -/* not compatible with 3.0.8? client crash at receive... :( time_t cur_time = time(NULL); WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4); @@ -65,10 +62,11 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) data.put(p_counter,counter); data << (uint32) 1135753200; //wtf?? (28.12.2005 12:00) - sLog.outDebug("Sending calendar"); + data << (uint32) 0; // unk counter 4 + data << (uint32) 0; // unk counter 5 + //sLog.outDebug("Sending calendar"); //data.hexlike(); SendPacket(&data); -*/ } void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data)