diff options
31 files changed, 164 insertions, 79 deletions
diff --git a/sql/updates/238_world.sql b/sql/updates/238_world.sql new file mode 100644 index 00000000000..c1180ca0abd --- /dev/null +++ b/sql/updates/238_world.sql @@ -0,0 +1 @@ +DELETE FROM trinity_string WHERE entry IN (453);
\ No newline at end of file diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 1b215730652..67261b6ff20 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1284,7 +1284,7 @@ bool BattleGround::DelCreature(uint32 type) Creature *cr = HashMapHolder<Creature>::Find(m_BgCreatures[type]); if(!cr) { - sLog.outError("Can't find creature guid: %u",m_BgCreatures[type]); + sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type])); return false; } cr->CleanupsBeforeDelete(); @@ -1298,7 +1298,7 @@ bool BattleGround::DelObject(uint32 type) GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]); if(!obj) { - sLog.outError("Can't find gobject guid: %u",m_BgObjects[type]); + sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type])); return false; } obj->SetRespawnTime(0); // not save respawn time diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index 1c8e813a896..6f4ac89c64e 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -120,7 +120,7 @@ void BattleGroundBE::AddPlayer(Player *plr) UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); } -void BattleGroundBE::RemovePlayer(Player *plr, uint64 guid) +void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) { if(GetStatus() == STATUS_WAIT_LEAVE) return; diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 9a8cc226745..d828d626ad2 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -574,7 +574,7 @@ void BattleGroundEY::RespawnFlagAfterDrop() if(obj) obj->Delete(); else - sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GetDroppedFlagGUID()); + sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID())); SetDroppedFlagGUID(0); } @@ -769,7 +769,8 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) WorldSafeLocsEntry const *sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); if(!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team)) - sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: u, graveyard_id: %u", Point, Team, m_CapturingPointTypes[Point].GraveYardId); + sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", + Point, Team, m_CapturingPointTypes[Point].GraveYardId); UpdatePointsIcons(Team, Point); UpdatePointsCount(Team); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 88eadd3cb2f..d9426240799 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -866,7 +866,7 @@ void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype /*** BATTLEGROUND QUEUE EVENTS ***/ /*********************************************************/ -bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 p_time) +bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { Player* plr = objmgr.GetPlayer( m_PlayerGuid ); diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index 5cfd27b7728..193578e88b0 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -118,7 +118,7 @@ void BattleGroundRL::AddPlayer(Player *plr) UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); } -void BattleGroundRL::RemovePlayer(Player *plr, uint64 guid) +void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) { if(GetStatus() == STATUS_WAIT_LEAVE) return; diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 60dc027ae71..221fa6b291e 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -229,7 +229,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) if(obj) obj->Delete(); else - sLog.outError("unknown droped flag bg, guid: %u",GetDroppedFlagGUID(team)); + sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team))); SetDroppedFlagGUID(0,team); } diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 4c295892b3e..7a61a33fd4f 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -753,7 +753,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)",GetAccountId(),IP_str.c_str(),pCurrChar->GetName() ,pCurrChar->GetGUID()); + sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)", + GetAccountId(),IP_str.c_str(),pCurrChar->GetName() ,pCurrChar->GetGUIDLow()); m_playerLoading = false; delete holder; diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 71f62d81d01..63e6933cc56 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -81,7 +81,8 @@ bool Corpse::Create( uint32 guidlow, Player *owner, uint32 mapid, float x, float if(!IsPositionValid()) { - sLog.outError("ERROR: Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %d Y: ^%d)",guidlow,owner->GetName(),x,y); + sLog.outError("ERROR: Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + guidlow,owner->GetName(),x,y); return false; } @@ -198,7 +199,8 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields) if(!IsPositionValid()) { - sLog.outError("ERROR: Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %d Y: ^%d)",GetGUIDLow(),GUID_LOPART(GetOwnerGUID()),GetPositionX(),GetPositionY()); + sLog.outError("ERROR: Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + GetGUIDLow(),GUID_LOPART(GetOwnerGUID()),GetPositionX(),GetPositionY()); return false; } diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 9f3422dbc28..5e3d3ac9f8e 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2182,3 +2182,19 @@ TrainerSpellData const* Creature::GetTrainerSpells() const { return objmgr.GetNpcTrainerSpells(GetEntry()); } + +// overwrite WorldObject function for proper name localization +const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const +{ + if (loc_idx >= 0) + { + CreatureLocale const *cl = objmgr.GetCreatureLocale(GetEntry()); + if (cl) + { + if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty()) + return cl->Name[loc_idx].c_str(); + } + } + + return GetName(); +} diff --git a/src/game/Creature.h b/src/game/Creature.h index fcc614eb2f9..be421f26ad2 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -522,6 +522,9 @@ class TRINITY_DLL_SPEC Creature : public Unit void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); } void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); } + // overwrite WorldObject function for proper name localization + const char* GetNameForLocaleIdx(int32 locale_idx) const; + void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState bool LoadFromDB(uint32 guid, Map *map); diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index f725e8063c8..75a1f9be985 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1285,3 +1285,19 @@ void GameObject::CastSpell(Unit* target, uint32 spell) //trigger->setDeathState(JUST_DIED); //trigger->RemoveCorpse(); } + +// overwrite WorldObject function for proper name localization +const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const +{ + if (loc_idx >= 0) + { + GameObjectLocale const *cl = objmgr.GetGameObjectLocale(GetEntry()); + if (cl) + { + if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty()) + return cl->Name[loc_idx].c_str(); + } + } + + return GetName(); +} diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 5ed3cfd1e6e..7dc5a879913 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -445,6 +445,9 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); } + // overwrite WorldObject function for proper name localization + const char* GetNameForLocaleIdx(int32 locale_idx) const; + void SaveToDB(); void SaveToDB(uint32 mapid, uint8 spawnMask); bool LoadFromDB(uint32 guid, Map *map); diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 3e1e4fe1919..42607095e65 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -538,6 +538,7 @@ struct ItemPrototype { case INVTYPE_RELIC: case INVTYPE_SHIELD: + case INVTYPE_HOLDABLE: return true; } diff --git a/src/game/Language.h b/src/game/Language.h index 86c66c546d6..fb44f37dda5 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -388,7 +388,7 @@ enum TrinityStrings LANG_COMMAND_GRAVEYARDALRLINKED = 450, LANG_COMMAND_GRAVEYARDLINKED = 451, LANG_COMMAND_GRAVEYARDWRONGZONE = 452, - LANG_COMMAND_GRAVEYARDWRONGTEAM = 453, + // = 453, LANG_COMMAND_GRAVEYARDERROR = 454, LANG_COMMAND_GRAVEYARD_NOTEAM = 455, LANG_COMMAND_GRAVEYARD_ANY = 456, diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 62b68a04cc8..643a5b6f819 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -2822,12 +2822,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) std::string show = show_str; uint32 Maxpoint; - sLog.outDebug("DEBUG: HandleWpShowCommand: lowguid: %u", lowguid); - - sLog.outDebug("DEBUG: HandleWpShowCommand: Habe creature: %ld", target ); - - sLog.outDebug("DEBUG: HandleWpShowCommand: wpshow - show: %s", show_str); - //PSendSysMessage("wpshow - show: %s", show); + sLog.outDebug("DEBUG: HandleWpShowCommand: lowguid: %u show: %s", lowguid, show_str); // Show info for the selected waypoint if(show == "info") @@ -2848,7 +2843,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) QueryResult *result = WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, text1, text2, text3, text4, text5, model1, model2 FROM creature_movement WHERE wpguid = %u", - target->GetGUID() ); + target->GetGUIDLow() ); if(!result) { // Since we compare float values, we have to deal with diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index a2f37d02480..9b2e8fb8800 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -3580,13 +3580,6 @@ bool ChatHandler::HandleLinkGraveCommand(const char* args) return false; } - if(graveyard->map_id != areaEntry->mapid && g_team != 0) - { - SendSysMessage(LANG_COMMAND_GRAVEYARDWRONGTEAM); - SetSentErrorMessage(true); - return false; - } - if(objmgr.AddGraveYardLink(g_id,player->GetZoneId(),g_team)) PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id,zoneId); else diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 436774d4218..c985a7c8318 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -271,7 +271,8 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const if( chance != 0 && chance < 0.000001f ) // loot with low chance { - sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%d) - skipped", store.GetName(), entry, itemid, chance); + sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped", + store.GetName(), entry, itemid, chance); return false; } } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 9e810e4baec..7fc4b59a9ee 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -136,7 +136,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) wstrToLower(str[i]); - sLog.outDebug("String %u: %s", i, str[i].c_str()); + sLog.outDebug("String %u: %s", i, temp.c_str()); } std::wstring wplayer_name; diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index d08e94d4431..d3167e180a0 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -188,6 +188,7 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle) if(i_owner->GetTypeId()==TYPEID_PLAYER) { DEBUG_LOG("Player (GUID: %u) chase to %s (GUID: %u)", + i_owner->GetGUIDLow(), target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature", target->GetTypeId()==TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() ); Mutate(new TargetedMovementGenerator<Player>(*target,dist,angle)); diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 10958ebb8a7..15a77c6c01e 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -139,14 +139,15 @@ void WorldSession::SendTrainerList( uint64 guid,std::string strTitle ) if (!ci) { - sLog.outDebug( "WORLD: SendTrainerList - (%u) NO CREATUREINFO! (GUID: %u)", uint32(GUID_LOPART(guid)), guid ); + sLog.outDebug( "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!",GUID_LOPART(guid) ); return; } TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); if(!trainer_spells) { - sLog.outDebug( "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", guid, unit->GetEntry()); + sLog.outDebug( "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", + GUID_LOPART(guid), unit->GetEntry()); return; } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 0ceb71367ca..ea59a448f7f 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1280,7 +1280,7 @@ namespace Trinity data = new WorldPacket(SMSG_MESSAGECHAT, 200); // TODO: i_object.GetName() also must be localized? - i_object.BuildMonsterChat(data,i_msgtype,text,i_language,i_object.GetName(),i_targetGUID); + i_object.BuildMonsterChat(data,i_msgtype,text,i_language,i_object.GetNameForLocaleIdx(loc_idx),i_targetGUID); i_data_cache[cache_idx] = data; } @@ -1545,4 +1545,4 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, z = GetPositionZ(); UpdateGroundPositionZ(x,y,z); -}
\ No newline at end of file +} diff --git a/src/game/Object.h b/src/game/Object.h index 52eacf0bc23..2d8f3a134e6 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -399,6 +399,8 @@ class TRINITY_DLL_SPEC WorldObject : public Object const char* GetName() const { return m_name.c_str(); } void SetName(std::string newname) { m_name=newname; } + virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); } + float GetDistance( const WorldObject* obj ) const; float GetDistance(const float x, const float y, const float z) const; float GetDistance2d(const WorldObject* obj) const; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 446971968e0..43d867d779d 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4827,12 +4827,6 @@ void ObjectMgr::LoadGraveyardZones() continue; } - if(entry->map_id != areaEntry->mapid && team != 0) - { - sLog.outErrorDb("Table `game_graveyard_zone` has record for ghost zone (%u) at map %u and graveyard (%u) at map %u for team %u, but in case maps are different, player faction setting is ignored. Use faction 0 instead.",zoneId,areaEntry->mapid, safeLocId, entry->map_id, team); - team = 0; - } - if(!AddGraveYardLink(safeLocId,zoneId,team,false)) sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId); } while( result->NextRow() ); @@ -4854,7 +4848,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float // if mapId == graveyard.mapId (ghost in plain zone or city or battleground) and search graveyard at same map // then check faction // if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated - // then skip check faction + // then check faction GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId); GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId); if(graveLow==graveUp) @@ -4863,11 +4857,21 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float return NULL; } + // at corpse map bool foundNear = false; float distNear; WorldSafeLocsEntry const* entryNear = NULL; + + // at entrance map for corpse map + bool foundEntr = false; + float distEntr; + WorldSafeLocsEntry const* entryEntr = NULL; + + // some where other WorldSafeLocsEntry const* entryFar = NULL; + MapEntry const* mapEntry = sMapStore.LookupEntry(MapId); + for(GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr) { GraveYardData const& data = itr->second; @@ -4879,40 +4883,69 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float continue; } - // remember first graveyard at another map and ignore other - if(MapId != entry->map_id) - { - if(!entryFar) - entryFar = entry; - continue; - } - - // skip enemy faction graveyard at same map (normal area, city, or battleground) + // skip enemy faction graveyard // team == 0 case can be at call from .neargrave if(data.team != 0 && team != 0 && data.team != team) continue; - // find now nearest graveyard at same map - float dist2 = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y)+(entry->z - z)*(entry->z - z); - if(foundNear) + // find now nearest graveyard at other map + if(MapId != entry->map_id) { - if(dist2 < distNear) + // if find graveyard at different map from where entrance placed (or no entrance data), use any first + if (!mapEntry || mapEntry->entrance_map < 0 || mapEntry->entrance_map != entry->map_id || + mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0) { - distNear = dist2; - entryNear = entry; + // not have any corrdinates for check distance anyway + entryFar = entry; + continue; + } + + // at entrance map calculate distance (2D); + float dist2 = (entry->x - mapEntry->entrance_x)*(entry->x - mapEntry->entrance_x) + +(entry->y - mapEntry->entrance_y)*(entry->y - mapEntry->entrance_y); + if(foundEntr) + { + if(dist2 < distEntr) + { + distEntr = dist2; + entryEntr = entry; + } + } + else + { + foundEntr = true; + distEntr = dist2; + entryEntr = entry; } } + // find now nearest graveyard at same map else { - foundNear = true; - distNear = dist2; - entryNear = entry; + float dist2 = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y)+(entry->z - z)*(entry->z - z); + if(foundNear) + { + if(dist2 < distNear) + { + distNear = dist2; + entryNear = entry; + } + } + else + { + foundNear = true; + distNear = dist2; + entryNear = entry; + } } } + // find now nearest graveyard at same map if(entryNear) return entryNear; + if(entryEntr) + return entryEntr; + return entryFar; } @@ -5131,7 +5164,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const if(!mapEntry) return NULL; for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); itr++) { - if(itr->second.target_mapId == mapEntry->parent_map) + if(itr->second.target_mapId == mapEntry->entrance_map) { AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first); if(atEntry && atEntry->mapid == Map) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8ec5b2fb52b..0d7c035711c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -10256,9 +10256,26 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0) { - m_weaponChangeTimer = DEFAULT_SWITCH_WEAPON; + uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; + if (getClass() == CLASS_ROGUE) - m_weaponChangeTimer = ROGUE_SWITCH_WEAPON; + cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; + + SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell); + + if (!spellProto) + sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); + else + { + m_weaponChangeTimer = spellProto->StartRecoveryTime; + + WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); + data << uint64(GetGUID()); + data << uint8(1); + data << uint32(cooldownSpell); + data << uint32(0); + GetSession()->SendPacket(&data); + } } } diff --git a/src/game/Player.h b/src/game/Player.h index e7d72ab8162..8df59a3cece 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -680,12 +680,6 @@ struct ItemPosCount }; typedef std::vector<ItemPosCount> ItemPosCountVec; -enum SwitchWeapon -{ - DEFAULT_SWITCH_WEAPON = 1500, //cooldown in ms - ROGUE_SWITCH_WEAPON = 1000 -}; - enum TradeSlots { TRADE_SLOT_COUNT = 7, diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 13a02d52841..481598f71ea 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1903,6 +1903,8 @@ enum CorpseDynFlags #define SPELL_ID_GENERIC_LEARN 483 #define SPELL_ID_PASSIVE_BATTLE_STANCE 2457 #define SPELL_ID_PASSIVE_RESURRECTION_SICKNESS 15007 +#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s 6119 +#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s 6123 enum WeatherType { diff --git a/src/game/World.cpp b/src/game/World.cpp index ab7b6fe04fa..d6017ac0669 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -202,13 +202,16 @@ World::AddSession_ (WorldSession* s) return; } - WorldSession* old = m_sessions[s->GetAccountId ()]; - m_sessions[s->GetAccountId ()] = s; - // if session already exist, prepare to it deleting at next world update // NOTE - KickPlayer() should be called on "old" in RemoveSession() - if (old) - m_kicked_sessions.insert (old); + { + SessionMap::const_iterator old = m_sessions.find(s->GetAccountId ()); + + if(old != m_sessions.end()) + m_kicked_sessions.insert (old->second); + } + + m_sessions[s->GetAccountId ()] = s; uint32 Sessions = GetActiveAndQueuedSessionCount (); uint32 pLimit = GetPlayerAmountLimit (); @@ -291,9 +294,7 @@ void World::RemoveQueuedPlayer(WorldSession* sess) { if(*iter==sess) { - Queue::iterator iter2 = iter; - ++iter; - m_QueuedPlayer.erase(iter2); + iter = m_QueuedPlayer.erase(iter); decrease_session = false; // removing queued session break; } diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h index 6f3bb63835f..b57b031ef55 100644 --- a/src/shared/Database/DBCStructure.h +++ b/src/shared/Database/DBCStructure.h @@ -464,9 +464,9 @@ struct MapEntry // 99 text flags //chat* unknownText2 // 100-115 unknown empty text fields // 116 text flags - int32 parent_map; // 117 map_id of parent map - //float start_x // 118 enter x coordinate (if exist single entry) - //float start_y // 119 enter y coordinate (if exist single entry) + int32 entrance_map; // 117 map_id of entrance map + float entrance_x; // 118 entrance x coordinate (if exist single entry) + float entrance_y; // 119 entrance y coordinate (if exist single entry) uint32 resetTimeRaid; // 120 uint32 resetTimeHeroic; // 121 // 122-123 diff --git a/src/shared/Database/DBCfmt.cpp b/src/shared/Database/DBCfmt.cpp index 2f4df58e6a1..64163664b49 100644 --- a/src/shared/Database/DBCfmt.cpp +++ b/src/shared/Database/DBCfmt.cpp @@ -55,7 +55,7 @@ const char ItemRandomSuffixfmt[]="nxxxxxxxxxxxxxxxxxxiiiiii"; const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; const char LockEntryfmt[]="niiiiixxxiiiiixxxiixxxxxxxxxxxxxx"; const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; -const char MapEntryfmt[]="nxixssssssssssssssssxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxiixxi"; +const char MapEntryfmt[]="nxixssssssssssssssssxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiffiixxi"; const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxi"; diff --git a/src/shared/Database/SqlOperations.cpp b/src/shared/Database/SqlOperations.cpp index c5b96680a5a..12eb5585c21 100644 --- a/src/shared/Database/SqlOperations.cpp +++ b/src/shared/Database/SqlOperations.cpp @@ -102,7 +102,8 @@ bool SqlQueryHolder::SetQuery(size_t index, const char *sql) if(m_queries[index].first != NULL) { - sLog.outError("Attempt assign query to holder index (%u) where other query stored (Old: [%s] New: [%s])",index,m_queries.size(),m_queries[index].first,sql); + sLog.outError("Attempt assign query to holder index (%u) where other query stored (Old: [%s] New: [%s])", + index,m_queries[index].first,sql); return false; } |