Merge branch 'master' into 303

I hope it merged correctly...

Conflicts:
	contrib/extractor/ad.exe
	src/game/MovementHandler.cpp
	src/game/Player.h
This commit is contained in:
tomrus88 2008-12-11 12:22:37 +03:00
commit db64bf6b80
9 changed files with 47 additions and 91 deletions

View file

@ -209,7 +209,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
if(ban && !IsBanned(bad->GetGUID()))
{
banned.push_back(bad->GetGUID());
banned.insert(bad->GetGUID());
MakePlayerBanned(&data, bad->GetGUID(), good);
}
else
@ -258,7 +258,7 @@ void Channel::UnBan(uint64 good, const char *badname)
}
else
{
banned.remove(bad->GetGUID());
banned.erase(bad->GetGUID());
WorldPacket data;
MakePlayerUnbanned(&data, bad->GetGUID(), good);

View file

@ -147,7 +147,7 @@ class Channel
typedef std::map<uint64, PlayerInfo> PlayerList;
PlayerList players;
typedef std::list<uint64> BannedList;
typedef std::set<uint64> BannedList;
BannedList banned;
bool m_announce;
bool m_moderate;
@ -202,15 +202,9 @@ class Channel
void SendToAllButOne(WorldPacket *data, uint64 who);
void SendToOne(WorldPacket *data, uint64 who);
bool IsOn(uint64 who) const { return players.count(who) > 0; }
bool IsOn(uint64 who) const { return players.count(who) != 0; }
bool IsBanned(const uint64 guid) const
{
for(BannedList::const_iterator i = banned.begin(); i != banned.end(); ++i)
if(*i == guid)
return true;
return false;
}
bool IsBanned(const uint64 guid) const {return banned.count(guid) != 0; }
bool IsFirst() const { return !(players.size() > 1); }

View file

@ -925,12 +925,19 @@ void WorldSession::HandleChangePlayerNameOpcode(WorldPacket& recv_data)
recv_data >> guid;
recv_data >> newname;
QueryResult *result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
if (result)
QueryResult *result = CharacterDatabase.PQuery("SELECT at_login, name FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
if (!result)
{
WorldPacket data(SMSG_CHAR_RENAME, 1);
data << (uint8)CHAR_CREATE_ERROR;
SendPacket( &data );
return;
}
uint32 at_loginFlags;
Field *fields = result->Fetch();
at_loginFlags = fields[0].GetUInt32();
oldname = fields[1].GetCppString();
delete result;
if (!(at_loginFlags & AT_LOGIN_RENAME))
@ -940,22 +947,6 @@ void WorldSession::HandleChangePlayerNameOpcode(WorldPacket& recv_data)
SendPacket( &data );
return;
}
}
else
{
WorldPacket data(SMSG_CHAR_RENAME, 1);
data << (uint8)CHAR_CREATE_ERROR;
SendPacket( &data );
return;
}
if(!objmgr.GetPlayerNameByGUID(guid, oldname)) // character not exist, because we have no name for this guid
{
WorldPacket data(SMSG_CHAR_RENAME, 1);
data << (uint8)CHAR_LOGIN_NO_CHARACTER;
SendPacket( &data );
return;
}
// prevent character rename to invalid name
if(!normalizePlayerName(newname))

View file

@ -929,44 +929,7 @@ void Creature::OnPoiSelect(Player* player, GossipOption const *gossip)
{
if(gossip->GossipId==GOSSIP_GUARD_SPELLTRAINER || gossip->GossipId==GOSSIP_GUARD_SKILLTRAINER)
{
//float x,y;
//bool findnpc=false;
Poi_Icon icon = ICON_POI_0;
//QueryResult *result;
//Field *fields;
uint32 mapid=GetMapId();
Map const* map=MapManager::Instance().GetBaseMap( mapid );
uint16 areaflag=map->GetAreaFlag(GetPositionX(),GetPositionY());
uint32 zoneid=Map::GetZoneId(areaflag,mapid);
std::string areaname= gossip->OptionText;
/*
uint16 pflag;
// use the action relate to creaturetemplate.trainer_type ?
result= WorldDatabase.PQuery("SELECT creature.position_x,creature.position_y FROM creature,creature_template WHERE creature.map = '%u' AND creature.id = creature_template.entry AND creature_template.trainer_type = '%u'", mapid, gossip->Action );
if(!result)
return;
do
{
fields = result->Fetch();
x=fields[0].GetFloat();
y=fields[1].GetFloat();
pflag=map->GetAreaFlag(GetPositionX(),GetPositionY());
if(pflag==areaflag)
{
findnpc=true;
break;
}
}while(result->NextRow());
delete result;
if(!findnpc)
{
player->PlayerTalkClass->SendTalking( "$NSorry", "Here no this person.");
return;
}*/
//need add more case.
switch(gossip->Action)
{
@ -983,8 +946,9 @@ void Creature::OnPoiSelect(Player* player, GossipOption const *gossip)
icon=ICON_POI_TOWER;
break;
}
uint32 textid=GetGossipTextId( gossip->Action, zoneid );
player->PlayerTalkClass->SendTalking( textid );
uint32 textid = GetGossipTextId( gossip->Action, GetZoneId() );
player->PlayerTalkClass->SendTalking(textid);
// std::string areaname= gossip->OptionText;
// how this could worked player->PlayerTalkClass->SendPointOfInterest( x, y, icon, 2, 15, areaname.c_str() );
}
}

View file

@ -234,25 +234,24 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
if (opcode == MSG_MOVE_FALL_LAND && !GetPlayer()->isInFlight())
{
// calculate total z distance of the fall
// it is currently only used for the achievement system. It might be used in a more correct falldamage formula later
float z_diff = GetPlayer()->m_fallMovementInfo.z - movementInfo.z;
sLog.outDebug("zDiff = %f, falltime = %u", z_diff, movementInfo.fallTime);
float z_diff = GetPlayer()->m_lastFallZ - movementInfo.z;
sLog.outDebug("zDiff = %f", z_diff);
Player *target = GetPlayer();
//Players with Feather Fall or low fall time, or physical immunity (charges used) are ignored
if (movementInfo.fallTime > 1300 && !target->isDead() && !target->isGameMaster() &&
//Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
// 14.57 can be calculated by resolving damageperc formular below to 0
if (z_diff >= 14.57f && !target->isDead() && !target->isGameMaster() &&
!target->HasAuraType(SPELL_AURA_HOVER) && !target->HasAuraType(SPELL_AURA_FEATHER_FALL) &&
!target->HasAuraType(SPELL_AURA_FLY) && !target->IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL,true) )
{
//Safe fall, fall time reduction
//Safe fall, fall height reduction
int32 safe_fall = target->GetTotalAuraModifier(SPELL_AURA_SAFE_FALL);
uint32 fall_time = (movementInfo.fallTime > (safe_fall*10)) ? movementInfo.fallTime - (safe_fall*10) : 0;
if(fall_time > 1300) //Prevent damage if fall time < 1300
float damageperc = 0.018f*(z_diff-safe_fall)-0.2426f;
if(damageperc >0 )
{
//Fall Damage calculation
float fallperc = float(fall_time)/1300;
uint32 damage = (uint32)(((fallperc*fallperc -1) / 9 * target->GetMaxHealth())*sWorld.getRate(RATE_DAMAGE_FALL));
uint32 damage = (uint32)(damageperc * target->GetMaxHealth()*sWorld.getRate(RATE_DAMAGE_FALL));
float height = movementInfo.z;
target->UpdateGroundPositionZ(movementInfo.x,movementInfo.y,height);
@ -286,8 +285,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
GetPlayer()->SetInWater( !GetPlayer()->IsInWater() || GetPlayer()->GetBaseMap()->IsUnderWater(movementInfo.x, movementInfo.y, movementInfo.z) );
}
if(opcode != MSG_MOVE_FALL_LAND && !(movementInfo.flags & MOVEMENTFLAG_FALLING))
_player->m_fallMovementInfo = movementInfo; // save data before any fall
/*----------------------*/
/* process position-change */
@ -320,8 +317,11 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
}
}
//if (GetPlayer()->m_fallMovementInfo.fallTime >= movementInfo.fallTime || GetPlayer()->m_fallMovementInfo.z <=movementInfo.z)
// GetPlayer()->m_fallMovementInfo = movementInfo;
if (GetPlayer()->m_lastFallTime >= movementInfo.fallTime || GetPlayer()->m_lastFallZ <=movementInfo.z)
{
GetPlayer()->m_lastFallTime = movementInfo.fallTime;
GetPlayer()->m_lastFallZ= movementInfo.z;
}
if(GetPlayer()->isMovingOrTurning())
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);

View file

@ -1977,7 +1977,8 @@ class MANGOS_DLL_SPEC Player : public Unit
/*** VARIOUS SYSTEMS ***/
/*********************************************************/
MovementInfo m_movementInfo;
MovementInfo m_fallMovementInfo;
uint32 m_lastFallTime;
float m_lastFallZ;
Unit *m_mover;
bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); }
bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); }

View file

@ -73,10 +73,8 @@ class MANGOS_DLL_SPEC WaypointMovementGenerator<Creature>
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
public PathMovementBase<Creature, WaypointPath*>
{
TimeTrackerSmall i_nextMoveTime;
std::vector<bool> i_hasDone;
public:
WaypointMovementGenerator(Creature &) : i_nextMoveTime(0) {}
WaypointMovementGenerator(Creature &) : i_nextMoveTime(0), b_StopedByPlayer(false) {}
~WaypointMovementGenerator() { ClearWaypoints(); }
void Initialize(Creature &u)
{
@ -85,7 +83,12 @@ public PathMovementBase<Creature, WaypointPath*>
LoadPath(u);
}
void Finalize(Creature &) {}
void Reset(Creature &u) { ReloadPath(u); }
void Reset(Creature &u)
{
ReloadPath(u);
b_StopedByPlayer = false;
i_nextMoveTime.Reset(0);
}
bool Update(Creature &u, const uint32 &diff);
void MovementInform(Creature &);
@ -104,6 +107,9 @@ public PathMovementBase<Creature, WaypointPath*>
static void Initialize(void);
private:
void ClearWaypoints();
TimeTrackerSmall i_nextMoveTime;
std::vector<bool> i_hasDone;
bool b_StopedByPlayer;
};

View file

@ -722,7 +722,7 @@ struct GlyphPropertiesEntry
uint32 Id;
uint32 SpellId;
uint32 TypeFlags;
uint32 Unk1;
uint32 Unk1; // GlyphIconId (SpellIcon.dbc)
};
struct GlyphSlotEntry

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6889"
#define REVISION_NR "6895"
#endif // __REVISION_NR_H__