Merge branch 'master' into 310

This commit is contained in:
tomrus88 2009-06-05 14:54:05 +04:00
commit 4236f7c75c
21 changed files with 173 additions and 98 deletions

View file

@ -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__

View file

@ -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 <marko.friedemann@bmx-chemnitz.de>
* 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

View file

@ -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)) {

View file

@ -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;

View file

@ -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++;
}

View file

@ -175,6 +175,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);

View file

@ -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<MaNGOS::CallOfHelpCreatureInRangeDo> worker(this, u_do);
TypeContainerVisitor<MaNGOS::CreatureWorker<MaNGOS::CallOfHelpCreatureInRangeDo>, GridTypeMapContainer > grid_creature_searcher(worker);
CellLock<GridReadGuard> 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 :)

View file

@ -608,6 +608,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; }

View file

@ -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<MaNGOS::CallOfHelpCreatureInRangeDo> worker(m_creature, u_do);
TypeContainerVisitor<MaNGOS::CreatureWorker<MaNGOS::CallOfHelpCreatureInRangeDo>, GridTypeMapContainer > grid_creature_searcher(worker);
CellLock<GridReadGuard> 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:

View file

@ -1433,7 +1433,9 @@ struct SpellRangeEntry
{
uint32 ID;
float minRange;
float minRangeFriendly;
float maxRange;
float maxRangeFriendly;
};
struct SpellRuneCostEntry

View file

@ -87,7 +87,7 @@ const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixxx";
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";

View file

@ -30,6 +30,7 @@
#include "GameObject.h"
#include "Player.h"
#include "Unit.h"
#include "CreatureAI.h"
class Player;
//class Map;
@ -766,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:
@ -827,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();
@ -843,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;
@ -850,12 +872,45 @@ namespace MaNGOS
return false;
}
private:
bool i_hitHidden;
bool i_targetForPlayer;
WorldObject const* i_obj;
Unit const* i_funit;
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(); }

View file

@ -1008,7 +1008,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)

View file

@ -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;
}

View file

@ -814,9 +814,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)

View file

@ -1584,7 +1584,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
std::list<Unit *> tempUnitMap;
{
MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range);
MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range, false);
MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(m_caster, tempUnitMap, u_check);
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
@ -4739,14 +4739,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

View file

@ -6453,8 +6453,42 @@ void Aura::PeriodicDummyTick()
}
case SPELLFAMILY_ROGUE:
{
// switch (spell->Id)
// {
switch (spell->Id)
{
case 51690:
{
std::list<Unit*> 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<MaNGOS::AnyUnfriendlyVisibleUnitInObjectRangeCheck> checker(caster,targets, u_check);
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyVisibleUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker);
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyVisibleUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);
CellLock<GridReadGuard> 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<Unit*>::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
@ -6463,7 +6497,7 @@ void Aura::PeriodicDummyTick()
// case 58428: break;
// default:
// break;
// }
}
break;
}
case SPELLFAMILY_HUNTER:

View file

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

View file

@ -5093,8 +5093,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)
@ -11689,4 +11689,4 @@ void Unit::SetPvP( bool state )
if(m_TotemSlot[i])
if(Creature *totem = GetMap()->GetCreature(m_TotemSlot[i]))
totem->SetPvP(state);
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7948"
#define REVISION_NR "7960"
#endif // __REVISION_NR_H__

View file

@ -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;
}