Merge remote branch 'origin/master' into 330

This commit is contained in:
tomrus88 2009-12-17 16:13:37 +03:00
commit eba214eb8a
15 changed files with 58 additions and 56 deletions

View file

@ -592,7 +592,8 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
data << uint32(0); // 1=link supplied string as player name, 0=display plain string
sWorld.SendGlobalMessage(&data);
}
else
// if player is in world he can tell his friends about new achievement
else if (GetPlayer()->IsInWorld())
{
CellPair p = MaNGOS::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY());

View file

@ -471,22 +471,11 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
switch(Trigger)
{
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
break;
case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_2];
break;
case 3706: // Alliance elixir of regeneration spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_1];
break;
case 3708: // Horde elixir of regeneration spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_2];
break;
case 3707: // Alliance elixir of berserk spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_1];
break;
case 3709: // Horde elixir of berserk spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
break;
case 3646: // Alliance Flag spawn
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
@ -508,9 +497,6 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
//if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
}
bool BattleGroundWS::SetupBattleGround()

View file

@ -1495,7 +1495,7 @@ struct SpellShapeshiftEntry
uint32 modelID_H; // 24 horde modelid (but only for one form)
//uint32 unk3; // 25 unused always 0
//uint32 unk4; // 26 unused always 0
//uint32 spell[8]; // 27-34 unused, spells which appear in the bar after shapeshifting
uint32 spellId[8]; // 27-34 spells which appear in the bar after shapeshifting
};
struct SpellDurationEntry

View file

@ -91,7 +91,7 @@ const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
const char SpellRadiusfmt[]="nfxf";
const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellRuneCostfmt[]="niiii";
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxxxxxxxxx";
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
const char StableSlotPricesfmt[] = "ni";
const char SummonPropertiesfmt[] = "niiiii";
const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";

View file

@ -221,7 +221,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
Player* playerGroup = itr->getSource();
if(!playerGroup)
continue;
if (player->IsWithinDist(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
if (player->IsWithinDistInMap(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
playersNear.push_back(playerGroup);
}

View file

@ -636,7 +636,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
if(corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType()==CORPSE_RESURRECTABLE_PVP) > time(NULL))
return;
if (!corpse->IsWithinDist(GetPlayer(), CORPSE_RECLAIM_RADIUS, true))
if (!corpse->IsWithinDistInMap(GetPlayer(), CORPSE_RECLAIM_RADIUS, true))
return;
uint64 guid;

View file

@ -1429,6 +1429,16 @@ bool WorldObject::isInBackInMap(WorldObject const* target, float distance, float
return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target );
}
bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const
{
return IsWithinDist(target, distance) && HasInArc( arc, target );
}
bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const
{
return IsWithinDist(target, distance) && !HasInArc( 2 * M_PI - arc, target );
}
void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const
{
if(distance == 0)

View file

@ -436,11 +436,13 @@ class MANGOS_DLL_SPEC WorldObject : public Object
bool IsWithinDist3d(float x, float y, float z, float dist2compare) const;
bool IsWithinDist2d(float x, float y, float dist2compare) const;
bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const;
// use only if you will sure about placing both object at same map
bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const
// use only if you will sure about placing both object at same map
{
return obj && _IsWithinDist(obj,dist2compare,is3D);
}
bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const
{
return obj && IsInMap(obj) && _IsWithinDist(obj,dist2compare,is3D);
@ -457,6 +459,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object
bool HasInArc( const float arcangle, const WorldObject* obj ) const;
bool isInFrontInMap(WorldObject const* target,float distance, float arc = M_PI) const;
bool isInBackInMap(WorldObject const* target, float distance, float arc = M_PI) const;
bool isInFront(WorldObject const* target,float distance, float arc = M_PI) const;
bool isInBack(WorldObject const* target, float distance, float arc = M_PI) const;
virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units

View file

@ -3187,7 +3187,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent)
GetSession()->SendPacket(&data);
}
void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bool sendUpdate)
{
PlayerSpellMap::iterator itr = m_spells.find(spell_id);
if (itr == m_spells.end())
@ -3366,7 +3366,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
}
// remove from spell book if not replaced by lesser rank
if(!prev_activate)
if (!prev_activate && sendUpdate)
{
WorldPacket data(SMSG_REMOVED_SPELL, 4);
data << uint32(spell_id);
@ -21287,4 +21287,4 @@ void Player::SetHomebindToCurrentPos()
// update sql homebind
CharacterDatabase.PExecute("UPDATE character_homebind SET map = '%u', zone = '%u', position_x = '%f', position_y = '%f', position_z = '%f' WHERE guid = '%u'",
m_homebindMapId, m_homebindZoneId, m_homebindX, m_homebindY, m_homebindZ, GetGUIDLow());
}
}

View file

@ -1562,7 +1562,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, bool learn_low_rank = true);
void removeSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true, bool sendUpdate = true);
void resetSpells();
void learnDefaultSpells();
void learnQuestRewardedSpells();

View file

@ -5260,11 +5260,11 @@ SpellCastResult Spell::CheckItems()
{
uint32 itemid = m_CastItem->GetEntry();
if( !p_caster->HasItemCount(itemid, 1) )
return SPELL_FAILED_ITEM_NOT_READY;
return SPELL_FAILED_ITEM_NOT_FOUND;
ItemPrototype const *proto = m_CastItem->GetProto();
if(!proto)
return SPELL_FAILED_ITEM_NOT_READY;
return SPELL_FAILED_ITEM_NOT_FOUND;
for (int i = 0; i < 5; ++i)
if (proto->Spells[i].SpellCharges)
@ -5380,7 +5380,7 @@ SpellCastResult Spell::CheckItems()
{
ItemPrototype const *proto = m_CastItem->GetProto();
if(!proto)
return SPELL_FAILED_ITEM_NOT_READY;
return SPELL_FAILED_REAGENTS;
for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
{
// CastItem will be used up and does not count as reagent
@ -5393,7 +5393,7 @@ SpellCastResult Spell::CheckItems()
}
}
if( !p_caster->HasItemCount(itemid, itemcount) )
return SPELL_FAILED_ITEM_NOT_READY; //0x54
return SPELL_FAILED_REAGENTS;
}
}

View file

@ -705,26 +705,27 @@ namespace MaNGOS
default: continue;
}
// we don't need to check InMap here, it's already done some lines above
switch(i_push_type)
{
case PUSH_IN_FRONT:
if(i_spell.GetCaster()->isInFrontInMap((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_FRONT_90:
if(i_spell.GetCaster()->isInFrontInMap((Unit*)(itr->getSource()), i_radius, M_PI/2 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/2 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_FRONT_30:
if(i_spell.GetCaster()->isInFrontInMap((Unit*)(itr->getSource()), i_radius, M_PI/6 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/6 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_FRONT_15:
if(i_spell.GetCaster()->isInFrontInMap((Unit*)(itr->getSource()), i_radius, M_PI/12 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/12 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_BACK:
if(i_spell.GetCaster()->isInBackInMap((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 ))
if(i_spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 ))
i_data->push_back(itr->getSource());
break;
case PUSH_SELF_CENTER:

View file

@ -2925,7 +2925,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue);
SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form);
if(ssEntry && ssEntry->modelID_A)
if (!ssEntry)
{
sLog.outError("Unknown shapeshift form %u in spell %u", form, GetId());
return;
}
if (ssEntry->modelID_A)
{
// i will asume that creatures will always take the defined model from the dbc
// since no field in creature_templates describes wether an alliance or
@ -3112,6 +3118,14 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
m_target->m_ShapeShiftFormSpellId = GetId();
m_target->m_form = form;
// a form can give the player a new castbar with some spells.. this is a clientside process..
// serverside just needs to register the new spells so that player isn't kicked as cheater
if (m_target->GetTypeId() == TYPEID_PLAYER)
for (uint32 i = 0; i < 8; ++i)
if (ssEntry->spellId[i])
((Player*)m_target)->addSpell(ssEntry->spellId[i], true, false, false, false);
}
else
{
@ -3140,6 +3154,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
default:
break;
}
// look at the comment in apply-part
if (m_target->GetTypeId() == TYPEID_PLAYER)
for (uint32 i = 0; i < 8; ++i)
if (ssEntry->spellId[i])
((Player*)m_target)->removeSpell(ssEntry->spellId[i], false, false, false);
}
// adding/removing linked auras

View file

@ -43,27 +43,6 @@ enum eAuthResults
REALM_AUTH_PARENTAL_CONTROL = 0x0f ///< Access to this account has been blocked by parental controls. Your settings may be changed in your account preferences at <site>
};
enum LoginResult
{
LOGIN_OK = 0x00,
LOGIN_FAILED = 0x01,
LOGIN_FAILED2 = 0x02,
LOGIN_BANNED = 0x03,
LOGIN_UNKNOWN_ACCOUNT = 0x04,
LOGIN_UNKNOWN_ACCOUNT3 = 0x05,
LOGIN_ALREADYONLINE = 0x06,
LOGIN_NOTIME = 0x07,
LOGIN_DBBUSY = 0x08,
LOGIN_BADVERSION = 0x09,
LOGIN_DOWNLOAD_FILE = 0x0A,
LOGIN_FAILED3 = 0x0B,
LOGIN_SUSPENDED = 0x0C,
LOGIN_FAILED4 = 0x0D,
LOGIN_CONNECTED = 0x0E,
LOGIN_PARENTALCONTROL = 0x0F,
LOGIN_LOCKED_ENFORCED = 0x10,
};
// will only support WoW 1.12.1/1.12.2 , WoW:TBC 2.4.3 and WoW:WotLK 3.2.2a, client builds 10505, 8606, 6005, 5875
// if you need more from old build then add it in cases in relamd sources code
// list sorted from high to low build and first build used as low bound for accepted by default range (any > it will accepted by realmd at least)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9010"
#define REVISION_NR "9013"
#endif // __REVISION_NR_H__