diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index fc9951d82..ef9fdfb5a 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -772,30 +772,34 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask; } -void Zone2MapCoordinates(float& x,float& y,uint32 zone) +bool Zone2MapCoordinates(float& x,float& y,uint32 zone) { WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); // if not listed then map coordinates (instance) - if(!maEntry) - return; + if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) + return false; std::swap(x,y); // at client map coords swapped x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1; y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down + + return true; } -void Map2ZoneCoordinates(float& x,float& y,uint32 zone) +bool Map2ZoneCoordinates(float& x,float& y,uint32 zone) { WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); // if not listed then map coordinates (instance) - if(!maEntry) - return; + if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) + return false; x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100); y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100); // client y coord from top to down std::swap(x,y); // client have map coords swapped + + return true; } MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index 2313bc756..b82d34382 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -55,8 +55,8 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id); bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId); -void Zone2MapCoordinates(float& x,float& y,uint32 zone); -void Map2ZoneCoordinates(float& x,float& y,uint32 zone); +bool Zone2MapCoordinates(float& x,float& y,uint32 zone); +bool Map2ZoneCoordinates(float& x,float& y,uint32 zone); typedef std::map MapDifficultyMap; MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty); diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 29516d54f..b2529aecf 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -294,7 +294,11 @@ bool ChatHandler::HandleGPSCommand(const char* args) float zone_x = obj->GetPositionX(); float zone_y = obj->GetPositionY(); - Map2ZoneCoordinates(zone_x,zone_y,zone_id); + if (Map2ZoneCoordinates(zone_x,zone_y,zone_id)) + { + zone_x = 0; + zone_y = 0; + } Map const *map = obj->GetMap(); float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); @@ -2409,7 +2413,12 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args) return false; } - Zone2MapCoordinates(x,y,zoneEntry->ID); + if (!Zone2MapCoordinates(x,y,zoneEntry->ID)) + { + PSendSysMessage(LANG_INVALID_ZONE_MAP,areaEntry->ID,areaEntry->area_name[GetSessionDbcLocale()],map->GetId(),map->GetMapName()); + SetSentErrorMessage(true); + return false; + } if(!MapManager::IsValidMapCoord(zoneEntry->mapid,x,y)) { diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1ad94970f..c08a2d450 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4179,7 +4179,7 @@ void Spell::EffectAddHonor(SpellEffectIndex /*eff_idx*/) { float honor_reward = MaNGOS::Honor::hk_honor_at_level(unitTarget->getLevel(), damage); ((Player*)unitTarget)->RewardHonor(NULL, 1, honor_reward); - sLog.outDebug("SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, ((Player*)unitTarget)->GetGUIDLow()); + sLog.outDebug("SpellEffect::AddHonor (spell_id %u) rewards %f honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, ((Player*)unitTarget)->GetGUIDLow()); } else { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 578e06b7a..097032cef 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 "9421" + #define REVISION_NR "9422" #endif // __REVISION_NR_H__