diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index ca7c8ff3e..2fb8b5d09 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -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); diff --git a/src/game/Channel.h b/src/game/Channel.h index 31e196948..fc87efdd0 100644 --- a/src/game/Channel.h +++ b/src/game/Channel.h @@ -147,7 +147,7 @@ class Channel typedef std::map PlayerList; PlayerList players; - typedef std::list BannedList; + typedef std::set 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); } diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index f8ab3efcb..6056832e4 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -925,23 +925,8 @@ 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) - { - uint32 at_loginFlags; - Field *fields = result->Fetch(); - at_loginFlags = fields[0].GetUInt32(); - delete result; - - if (!(at_loginFlags & AT_LOGIN_RENAME)) - { - WorldPacket data(SMSG_CHAR_RENAME, 1); - data << (uint8)CHAR_CREATE_ERROR; - SendPacket( &data ); - return; - } - } - else + 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; @@ -949,10 +934,16 @@ void WorldSession::HandleChangePlayerNameOpcode(WorldPacket& recv_data) return; } - if(!objmgr.GetPlayerNameByGUID(guid, oldname)) // character not exist, because we have no name for this guid + uint32 at_loginFlags; + Field *fields = result->Fetch(); + at_loginFlags = fields[0].GetUInt32(); + oldname = fields[1].GetCppString(); + delete result; + + if (!(at_loginFlags & AT_LOGIN_RENAME)) { WorldPacket data(SMSG_CHAR_RENAME, 1); - data << (uint8)CHAR_LOGIN_NO_CHARACTER; + data << (uint8)CHAR_CREATE_ERROR; SendPacket( &data ); return; } diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index e60c84777..5c41bd477 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -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() ); } } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 9c5570563..63686583e 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -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); diff --git a/src/game/Player.h b/src/game/Player.h index d6bfe28b3..b302d64fc 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -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); } diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index bcd14d893..d6cb21752 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -73,10 +73,8 @@ class MANGOS_DLL_SPEC WaypointMovementGenerator : public MovementGeneratorMedium< Creature, WaypointMovementGenerator >, public PathMovementBase { - TimeTrackerSmall i_nextMoveTime; - std::vector 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 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 static void Initialize(void); private: void ClearWaypoints(); + + TimeTrackerSmall i_nextMoveTime; + std::vector i_hasDone; bool b_StopedByPlayer; }; diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h index 10fef5930..4f30eb11c 100644 --- a/src/shared/Database/DBCStructure.h +++ b/src/shared/Database/DBCStructure.h @@ -722,7 +722,7 @@ struct GlyphPropertiesEntry uint32 Id; uint32 SpellId; uint32 TypeFlags; - uint32 Unk1; + uint32 Unk1; // GlyphIconId (SpellIcon.dbc) }; struct GlyphSlotEntry diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 23ee369fe..6f471f5a9 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 "6889" + #define REVISION_NR "6895" #endif // __REVISION_NR_H__