From daae9343a9bb00da04689e411955e0d50bbc1ad4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 4 Jun 2009 02:44:16 +0400 Subject: [PATCH 01/12] [7949] Fixed crash at use .send message with offline player name. --- src/game/Level3.cpp | 5 ++--- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index aa1a392a3..115f3341a 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -6459,8 +6459,7 @@ bool ChatHandler::HandleSendMessageCommand(const char* args) { ///- Find the player Player *rPlayer; - std::string rName; - if(!extractPlayerTarget((char*)args,&rPlayer,NULL,&rName)) + if(!extractPlayerTarget((char*)args,&rPlayer)) return false; char* msg_str = strtok(NULL, ""); @@ -6481,7 +6480,7 @@ bool ChatHandler::HandleSendMessageCommand(const char* args) rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); //Confirmation message - std::string nameLink = playerLink(rName); + std::string nameLink = GetNameLink(rPlayer); PSendSysMessage(LANG_SENDMESSAGE,nameLink.c_str(),msg_str); return true; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index aad32fbb2..dc664f88b 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 "7948" + #define REVISION_NR "7949" #endif // __REVISION_NR_H__ From 0b3a4bf5a575421df034f3180c0efc34509c24c7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 4 Jun 2009 04:05:43 +0400 Subject: [PATCH 02/12] [7950] Make clear in error output 2 cases of fail CMSG_ITEM_NAME_QUERY: DB absent data and not expected to exist item. --- src/game/ItemHandler.cpp | 8 +++++++- src/game/ObjectMgr.cpp | 3 --- src/shared/revision_nr.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 61c377b33..f84bba9b6 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -1007,7 +1007,13 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) return; } else - sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item)", itemid); + { + // listed in dbc or not expected to exist unknown item + if(sItemStore.LookupEntry(itemid)) + sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid); + else + sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid); + } } void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 0f1fbdb04..219d138d5 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -813,9 +813,6 @@ void ObjectMgr::LoadEquipmentTemplates() } sLog.outString( ">> Loaded %u equipment template", sEquipmentStorage.RecordCount ); sLog.outString(); - - // Creature items can be not listed in item_template - //sItemStore.Clear(); -- so used in spell casting } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelid) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index dc664f88b..399e8b46d 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 "7949" + #define REVISION_NR "7950" #endif // __REVISION_NR_H__ From 48fee42129cd37b5a61d11a17ff93d281a48ccd7 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Thu, 4 Jun 2009 04:59:38 +0400 Subject: [PATCH 03/12] [7951] Mope call for help code to function form Event AI code to allow use it from C++ scripts also. Signed-off-by: VladimirMangos --- src/game/Creature.cpp | 19 ++++++++++++++ src/game/Creature.h | 1 + src/game/CreatureEventAI.cpp | 51 +----------------------------------- src/game/GridNotifiers.h | 33 +++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 5 files changed, 55 insertions(+), 51 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 0ac9995c9..1a9512487 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1777,6 +1777,25 @@ void Creature::CallAssistance() } } +void Creature::CallForHelp(float fRadius) +{ + if (fRadius <= 0.0f || !getVictim() || isPet() || isCharmed()) + return; + + CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius); + MaNGOS::CreatureWorker worker(this, u_do); + + TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(worker); + + CellLock cell_lock(cell, p); + cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap()); +} + bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const { // we don't need help from zombies :) diff --git a/src/game/Creature.h b/src/game/Creature.h index 15c90874b..07623c5e1 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -604,6 +604,7 @@ class MANGOS_DLL_SPEC Creature : public Unit float GetAttackDistance(Unit const* pl) const; void DoFleeToGetAssistance(); + void CallForHelp(float fRadius); void CallAssistance(); void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; } void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; } diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index e895595d1..05b2cac1b 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -27,43 +27,8 @@ #include "GameEventMgr.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "WorldPacket.h" #include "InstanceData.h" -namespace MaNGOS -{ - class CallOfHelpCreatureInRangeDo // do attack at call of help to friendly crearture - { - public: - CallOfHelpCreatureInRangeDo(Unit* funit, Unit* enemy, float range) - : i_funit(funit), i_enemy(enemy), i_range(range) - {} - void operator()(Creature* u) - { - if (u == i_funit) - return; - - if (!u->CanAssistTo(i_funit, i_enemy, false)) - return; - - // too far - if( !i_funit->IsWithinDistInMap(u, i_range) ) - return; - - // only if see assisted creature - if( !i_funit->IsWithinLOSInMap(u) ) - return; - - if(u->AI()) - u->AI()->AttackStart(i_enemy); - } - private: - Unit* const i_funit; - Unit* const i_enemy; - float i_range; - }; -} - bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeatMin, uint32 repeatMax ) { if (repeatMin == repeatMax) @@ -780,21 +745,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; case ACTION_T_CALL_FOR_HELP: { - if (!m_creature->getVictim()) - return; - - CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); - - MaNGOS::CallOfHelpCreatureInRangeDo u_do(m_creature, m_creature->getVictim(), action.call_for_help.radius); - MaNGOS::CreatureWorker worker(m_creature, u_do); - - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(worker); - - CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature->GetMap()); + m_creature->CallForHelp(action.call_for_help.radius); break; } case ACTION_T_SET_SHEATH: diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 18de7f857..20e46dd65 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -30,6 +30,7 @@ #include "GameObject.h" #include "Player.h" #include "Unit.h" +#include "CreatureAI.h" class Player; //class Map; @@ -856,6 +857,38 @@ namespace MaNGOS float i_range; }; + // do attack at call of help to friendly crearture + class CallOfHelpCreatureInRangeDo + { + public: + CallOfHelpCreatureInRangeDo(Unit* funit, Unit* enemy, float range) + : i_funit(funit), i_enemy(enemy), i_range(range) + {} + void operator()(Creature* u) + { + if (u == i_funit) + return; + + if (!u->CanAssistTo(i_funit, i_enemy, false)) + return; + + // too far + if (!i_funit->IsWithinDistInMap(u, i_range)) + return; + + // only if see assisted creature + if (!i_funit->IsWithinLOSInMap(u)) + return; + + if (u->AI()) + u->AI()->AttackStart(i_enemy); + } + private: + Unit* const i_funit; + Unit* const i_enemy; + float i_range; + }; + struct AnyDeadUnitCheck { bool operator()(Unit* u) { return !u->isAlive(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 399e8b46d..8a203e84c 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 "7950" + #define REVISION_NR "7951" #endif // __REVISION_NR_H__ From 35271fe488c9ed9cc0123b23be94caba4bd0fc78 Mon Sep 17 00:00:00 2001 From: Lightguard Date: Thu, 4 Jun 2009 06:20:09 +0400 Subject: [PATCH 04/12] [7952] Implement rogue talent 51690. Signed-off-by: VladimirMangos --- src/game/GridNotifiers.h | 19 +++++++++++++++++++ src/game/SpellAuras.cpp | 40 +++++++++++++++++++++++++++++++++++++--- src/shared/revision_nr.h | 2 +- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 20e46dd65..b6e6c4779 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -767,6 +767,25 @@ namespace MaNGOS float i_range; }; + class AnyUnfriendlyVisibleUnitInObjectRangeCheck + { + public: + AnyUnfriendlyVisibleUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) + : i_obj(obj), i_funit(funit), i_range(range) {} + + bool operator()(Unit* u) + { + return u->isAlive() + && i_obj->IsWithinDistInMap(u, i_range) + && !i_funit->IsFriendlyTo(u) + && u->isVisibleForOrDetect(i_funit, false); + } + private: + WorldObject const* i_obj; + Unit const* i_funit; + float i_range; + }; + class AnyFriendlyUnitInObjectRangeCheck { public: diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index eca3292bd..6cb7a79fc 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6449,8 +6449,42 @@ void Aura::PeriodicDummyTick() } case SPELLFAMILY_ROGUE: { -// switch (spell->Id) -// { + switch (spell->Id) + { + case 51690: + { + std::list targets; + { + // eff_radius ==0 + float radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spell->rangeIndex)); + + CellPair p(MaNGOS::ComputeCellPair(caster->GetPositionX(),caster->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + + MaNGOS::AnyUnfriendlyVisibleUnitInObjectRangeCheck u_check(caster, caster, radius); + MaNGOS::UnitListSearcher checker(caster,targets, u_check); + + TypeContainerVisitor, GridTypeMapContainer > grid_object_checker(checker); + TypeContainerVisitor, WorldTypeMapContainer > world_object_checker(checker); + + CellLock cell_lock(cell, p); + + cell_lock->Visit(cell_lock, grid_object_checker, *caster->GetMap()); + cell_lock->Visit(cell_lock, world_object_checker, *caster->GetMap()); + } + + if(targets.empty()) + return; + + std::list::const_iterator itr = targets.begin(); + std::advance(itr, rand()%targets.size()); + Unit* target = *itr; + + caster->CastSpell(target, 57840, true); + caster->CastSpell(target, 57841, true); + return; + } // Master of Subtlety // case 31666: break; // Killing Spree @@ -6459,7 +6493,7 @@ void Aura::PeriodicDummyTick() // case 58428: break; // default: // break; -// } + } break; } case SPELLFAMILY_HUNTER: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8a203e84c..78f3faa17 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 "7951" + #define REVISION_NR "7952" #endif // __REVISION_NR_H__ From a3fff9b2cb9056d00e37ea1a077a8edbc067c9cb Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 4 Jun 2009 11:28:14 +0400 Subject: [PATCH 05/12] [7953] Some space and formating cleanups in vmap_extractor_v2 --- .../vmap_extractor_v2/stormlib/StormPort.h | 2 +- .../stormlib/StormPortLinux.cpp | 8 ++++---- .../stormlib/bzip2/blocksort.c | 16 ++++++++-------- .../vmap_extractor_v2/stormlib/bzip2/bzlib.c | 2 +- .../stormlib/bzip2/compress.c | 19 +++++++++---------- src/shared/revision_nr.h | 2 +- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/contrib/vmap_extractor_v2/stormlib/StormPort.h b/contrib/vmap_extractor_v2/stormlib/StormPort.h index 4cb8d84bd..6254f84e7 100644 --- a/contrib/vmap_extractor_v2/stormlib/StormPort.h +++ b/contrib/vmap_extractor_v2/stormlib/StormPort.h @@ -20,7 +20,7 @@ /* 12.11.03 1.02 Dan Macintosh compatibility */ /* 24.07.04 1.03 Sam Mac OS X compatibility */ /* 22.11.06 1.04 Sam Mac OS X compatibility (for StormLib 6.0) */ -/* 31.12.06 1.05 XPinguin Full GNU/Linux compatibility */ +/* 31.12.06 1.05 XPinguin Full GNU/Linux compatibility */ /*****************************************************************************/ #ifndef __STORMPORT_H__ diff --git a/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp b/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp index 0cd827fde..afbbd985a 100644 --- a/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp +++ b/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp @@ -2,7 +2,7 @@ * * Description: implementation for StormLib - linux port * intended to be used in GLdiablo -* +* * ----> StormLib was originally developed for Windows by * Ladislav Zezula (www.zezula.net), and he did * a _great_ job! Thanks Ladislav! @@ -17,9 +17,9 @@ * * Author: Marko Friedemann * Created at: Mon Jan 29 19:01:37 CEST 2001 -* Computer: whiplash.flachland-chemnitz.de +* Computer: whiplash.flachland-chemnitz.de * System: Linux 2.4.0 on i686 -* +* * Copyright (c) 2001 BMX-Chemnitz.DE All rights reserved. * ********************************************************************/ @@ -163,6 +163,6 @@ BOOL DeleteFile(const char *lpFileName) BOOL MoveFile(const char *lpExistingFileName, const char *lpNewFileName) { return rename(lpExistingFileName, lpNewFileName); -} +} #endif diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c b/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c index 33ec9f5dc..906124b97 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -57,8 +57,8 @@ For more information on these sources, see the manual. - To get some idea how the block sorting algorithms in this file - work, read my paper + To get some idea how the block sorting algorithms in this file + work, read my paper On the Performance of BWT Sorting Algorithms in Proceedings of the IEEE Data Compression Conference 2000, Snowbird, Utah, USA, 27-30 March 2000. The main sort in this @@ -321,7 +321,7 @@ void fallbackSort ( UInt32* fmap, r = -1; while (1) { - /*-- find the next non-singleton bucket --*/ + /*-- find the next non-singleton bucket --*/ k = r + 1; while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; if (ISSET_BH(k)) { diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c index 195f51a78..3d405f932 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c @@ -471,7 +471,7 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; } else - if (action == BZ_FLUSH) { + if (action == BZ_FLUSH) { s->avail_in_expect = strm->avail_in; s->mode = BZ_M_FLUSHING; goto preswitch; diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c b/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c index 7e0c29155..156056fb3 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c @@ -373,14 +373,14 @@ void sendMTFValues ( EState* s ) /*--- Set up an auxiliary length table which is used to fast-track - the common case (nGroups == 6). + the common case (nGroups == 6). ---*/ if (nGroups == 6) { for (v = 0; v < alphaSize; v++) { s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; - } + } } nSelectors = 0; @@ -429,14 +429,14 @@ void sendMTFValues ( EState* s ) cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) { UInt16 icv = mtfv[i]; for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; } } - - /*-- + + /*-- Find the coding table which is best for this group, and record its identity in the selector table. --*/ @@ -470,7 +470,7 @@ void sendMTFValues ( EState* s ) # undef BZ_ITUR } else { - /*--- slow version which correctly handles all situations ---*/ + /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) s->rfreq[bt][ mtfv[i] ]++; } @@ -623,15 +623,14 @@ void sendMTFValues ( EState* s ) # undef BZ_ITAH } else { - /*--- slow version which correctly handles all situations ---*/ + /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) { - bsW ( s, + bsW ( s, s->len [s->selector[selCtr]] [mtfv[i]], s->code [s->selector[selCtr]] [mtfv[i]] ); } } - gs = ge+1; selCtr++; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 78f3faa17..d6285af33 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 "7952" + #define REVISION_NR "7953" #endif // __REVISION_NR_H__ From eaad24d8d568ab2c468f23158e94dc1fb7ddd13b Mon Sep 17 00:00:00 2001 From: pasdVn Date: Fri, 29 May 2009 11:45:51 +0200 Subject: [PATCH 06/12] [7954] Added support for spellranges at friendly targets. Signed-off-by: ApoC --- src/game/DBCStructure.h | 2 ++ src/game/DBCfmt.h | 2 +- src/game/Spell.cpp | 8 ++++---- src/game/SpellMgr.h | 14 ++++++++++++-- src/shared/revision_nr.h | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 089d2c189..f3c3b0714 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1429,7 +1429,9 @@ struct SpellRangeEntry { uint32 ID; float minRange; + float minRangeFriendly; float maxRange; + float maxRangeFriendly; }; struct SpellRuneCostEntry diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index a6c99b838..148b90bec 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -87,7 +87,7 @@ const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx"; const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixx"; const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; const char SpellRadiusfmt[]="nfxf"; -const char SpellRangefmt[]="nfxfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellRuneCostfmt[]="niiii"; const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxx"; const char StableSlotPricesfmt[] = "ni"; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 51eb5685c..6786248c2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4740,14 +4740,14 @@ SpellCastResult Spell::CheckRange(bool strict) range_mod = 6.25; SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); - float max_range = GetSpellMaxRange(srange) + range_mod; - float min_range = GetSpellMinRange(srange); + Unit *target = m_targets.getUnitTarget(); + bool friendly = target ? target->IsFriendlyTo(m_caster) : false; + float max_range = GetSpellMaxRange(srange, friendly) + range_mod; + float min_range = GetSpellMinRange(srange, friendly); if(Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this); - Unit *target = m_targets.getUnitTarget(); - if(target && target != m_caster) { // distance from target in checks diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index a6d238e0f..81393d980 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -104,8 +104,18 @@ SpellSpecific GetSpellSpecific(uint32 spellId); // Different spell properties inline float GetSpellRadius(SpellRadiusEntry const *radius) { return (radius ? radius->Radius : 0); } uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL); -inline float GetSpellMinRange(SpellRangeEntry const *range) { return (range ? range->minRange : 0); } -inline float GetSpellMaxRange(SpellRangeEntry const *range) { return (range ? range->maxRange : 0); } +inline float GetSpellMinRange(SpellRangeEntry const *range, bool friendly = false) +{ + if(!range) + return 0; + return (friendly ? range->minRangeFriendly : range->minRange); +} +inline float GetSpellMaxRange(SpellRangeEntry const *range, bool friendly = false) +{ + if(!range) + return 0; + return (friendly ? range->maxRangeFriendly : range->maxRange); +} inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime; } int32 GetSpellDuration(SpellEntry const *spellInfo); int32 GetSpellMaxDuration(SpellEntry const *spellInfo); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d6285af33..fe29e1a63 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 "7953" + #define REVISION_NR "7954" #endif // __REVISION_NR_H__ From 07fe1cfd040c95b48d3cd3db1a0a18832c931ff4 Mon Sep 17 00:00:00 2001 From: Lightguard Date: Thu, 4 Jun 2009 21:41:52 +0200 Subject: [PATCH 07/12] [7955] Fixed healing amount of 47230 and ranks. Signed-off-by: ApoC --- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3bdb02d9b..455bb0285 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5087,8 +5087,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu target = GetPet(); if (!target) return false; + basepoints0 = damage * 15 / 100; triggered_spell_id = 54181; - basepoints0 = damage * triggerAmount / 100; break; } switch(dummySpell->Id) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fe29e1a63..d1036b258 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 "7954" + #define REVISION_NR "7955" #endif // __REVISION_NR_H__ From 0a413723ece9c0bed64abaf37e5eb806b955d87a Mon Sep 17 00:00:00 2001 From: ApoC Date: Fri, 5 Jun 2009 02:22:28 +0200 Subject: [PATCH 08/12] [7956] Fixed possible runtime crash. Signed-off-by: ApoC --- src/shared/revision_nr.h | 2 +- src/shared/vmap/TileAssembler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d1036b258..a6c10d3ea 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 "7955" + #define REVISION_NR "7956" #endif // __REVISION_NR_H__ diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp index b8434a7ef..89afe2df7 100644 --- a/src/shared/vmap/TileAssembler.cpp +++ b/src/shared/vmap/TileAssembler.cpp @@ -371,7 +371,7 @@ namespace VMAP if(!rf) { printf("ERROR: Can't open model file in form: %s",pModelFilename.c_str()); - printf("... or form: %s",filename ); + printf("... or form: %s",filename.c_str() ); return false; } From 72f16ab34200bf8a4b6bb21ee6b33c937aa9ff53 Mon Sep 17 00:00:00 2001 From: ApoC Date: Fri, 5 Jun 2009 03:00:11 +0200 Subject: [PATCH 09/12] [7957] Implemented for AnyAoETargetUnitInObjectRangeCheck possibility to allow/disallow selecting hidden units. Signed-off-by: ApoC --- src/game/GridNotifiers.h | 7 +++++-- src/shared/revision_nr.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index b6e6c4779..ae34ed7e0 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -847,8 +847,8 @@ namespace MaNGOS class AnyAoETargetUnitInObjectRangeCheck { public: - AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) - : i_obj(obj), i_funit(funit), i_range(range) + AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool hitHidden = true) + : i_obj(obj), i_funit(funit), i_range(range), i_hitHidden(hitHidden) { Unit const* check = i_funit; Unit const* owner = i_funit->GetOwner(); @@ -863,6 +863,8 @@ namespace MaNGOS return false; if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; + if (!i_hitHidden && !u->isVisibleForOrDetect(i_funit, false)) + return false; if(( i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range)) return true; @@ -870,6 +872,7 @@ namespace MaNGOS return false; } private: + bool i_hitHidden; bool i_targetForPlayer; WorldObject const* i_obj; Unit const* i_funit; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a6c10d3ea..9778bcd45 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 "7956" + #define REVISION_NR "7957" #endif // __REVISION_NR_H__ From b1d70d4078d256ffbe127be2dc19db4e0f7715c2 Mon Sep 17 00:00:00 2001 From: ApoC Date: Fri, 5 Jun 2009 03:02:40 +0200 Subject: [PATCH 10/12] [7958] Disable targeting hidden units for TARGET_CHAIN_DAMAGE. This will fix hidden unit damaging by 2643 and similar spells. Signed-off-by: ApoC --- src/game/Spell.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6786248c2..319ad16dc 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1584,7 +1584,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) std::list tempUnitMap; { - MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range); + MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range, false); MaNGOS::UnitListSearcher searcher(m_caster, tempUnitMap, u_check); TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9778bcd45..59f7400d7 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 "7957" + #define REVISION_NR "7958" #endif // __REVISION_NR_H__ From fb21b00480b8699907f4f5aa7b02953a92004015 Mon Sep 17 00:00:00 2001 From: ApoC Date: Fri, 5 Jun 2009 03:09:06 +0200 Subject: [PATCH 11/12] [7959] Inserted newline to make gcc happy. Signed-off-by: ApoC --- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 455bb0285..d0d78ceea 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11683,4 +11683,4 @@ void Unit::SetPvP( bool state ) if(m_TotemSlot[i]) if(Creature *totem = GetMap()->GetCreature(m_TotemSlot[i])) totem->SetPvP(state); -} \ No newline at end of file +} diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 59f7400d7..c6643130c 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 "7958" + #define REVISION_NR "7959" #endif // __REVISION_NR_H__ From 5b02b071562b305b83d05155fe205da0a978c46c Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 5 Jun 2009 14:52:34 +0400 Subject: [PATCH 12/12] [7960] Fixed client error #132. --- src/game/Corpse.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index f8ee0aa5c..f1a4ad115 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -179,6 +179,8 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields) float ort = fields[3].GetFloat(); uint32 mapid = fields[4].GetUInt32(); + Object::_Create(guid, 0, HIGHGUID_CORPSE); + if(!LoadValues( fields[5].GetString() )) { sLog.outError("Corpse #%d have broken data in `data` field. Can't be loaded.",guid); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c6643130c..70301aa2d 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 "7959" + #define REVISION_NR "7960" #endif // __REVISION_NR_H__