Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
emsy committed Mar 28, 2012
2 parents 8a51c78 + 6763c23 commit 75fef39
Show file tree
Hide file tree
Showing 27 changed files with 143 additions and 129 deletions.
3 changes: 3 additions & 0 deletions sql/updates/world/2012_03_27_04_world_misc.sql
@@ -0,0 +1,3 @@
ALTER TABLE `spell_dbc` CHANGE `StackAmount` `StackAmount` int(10) unsigned NOT NULL DEFAULT '0';
ALTER TABLE `waypoint_data` CHANGE `action_chance` `action_chance` smallint(6) NOT NULL DEFAULT '100';
ALTER TABLE `item_loot_template` CHANGE `maxcount` `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1';
2 changes: 2 additions & 0 deletions sql/updates/world/2012_03_28_01_world_spell_bonus_data.sql
@@ -0,0 +1,2 @@
-- Hunter Volley
UPDATE `spell_bonus_data` SET `ap_bonus`=0.0837 WHERE `entry`=42243;
5 changes: 5 additions & 0 deletions src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
Expand Up @@ -37,6 +37,11 @@ BattlegroundSA::BattlegroundSA()
SignaledRoundTwo = false;
SignaledRoundTwoHalfMin = false;
InitSecondRound = false;

//! This is here to prevent an uninitialised variable warning
//! The warning only occurs when SetUpBattleGround fails though.
//! In the future this function should be called BEFORE sending initial worldstates.
memset(&GraveyardStatus, 0, sizeof(GraveyardStatus));
}

BattlegroundSA::~BattlegroundSA()
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/DungeonFinding/LFGMgr.cpp
Expand Up @@ -1167,7 +1167,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
}

m_QueueInfoMap[gguid] = pqInfo;
if(GetState(gguid) != LFG_STATE_NONE)
if (GetState(gguid) != LFG_STATE_NONE)
{
LfgGuidList& currentQueue = m_currentQueue[team];
currentQueue.push_front(gguid);
Expand Down
5 changes: 4 additions & 1 deletion src/server/game/Entities/Player/Player.cpp
Expand Up @@ -858,6 +858,10 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep

isDebugAreaTriggers = false;

m_WeeklyQuestChanged = false;

m_SeasonalQuestChanged = false;

SetPendingBind(0, 0);
}

Expand Down Expand Up @@ -19540,7 +19544,6 @@ void Player::_SaveStats(SQLTransaction& trans)
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER));
stmt->setUInt32(index++, GetBaseSpellPowerBonus());
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL));
stmt->setUInt32(index++, GetMaxHealth());

trans->Append(stmt);
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Unit/Unit.cpp
Expand Up @@ -17009,7 +17009,7 @@ void Unit::ExitVehicle(Position const* /*exitPosition*/)
//! to specify exit coordinates and either store those per passenger, or we need to
//! init spline movement based on those coordinates in unapply handlers, and
//! relocate exiting passengers based on Unit::moveSpline data. Either way,
//! Coming Soon
//! Coming Soon(TM)
}

void Unit::_ExitVehicle(Position const* exitPosition)
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Events/GameEventMgr.cpp
Expand Up @@ -283,7 +283,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();

uint16 event_id = fields[0].GetUInt16();
uint16 event_id = fields[0].GetUInt8();

if (event_id >= mGameEvent.size())
{
Expand Down Expand Up @@ -469,7 +469,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();

uint32 guid = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16();
uint16 event_id = fields[1].GetUInt8();

if (event_id >= mGameEventModelEquip.size())
{
Expand Down Expand Up @@ -982,7 +982,7 @@ void GameEventMgr::Initialize()
{
Field* fields = result->Fetch();

uint32 maxEventId = fields[0].GetUInt16();
uint32 maxEventId = fields[0].GetUInt8();

// Id starts with 1 and vector with 0, thus increment
maxEventId++;
Expand Down
10 changes: 5 additions & 5 deletions src/server/game/Globals/ObjectMgr.cpp
Expand Up @@ -2820,7 +2820,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()

uint32 uiEntry = fields[0].GetUInt32();
uint32 uiAccessory = fields[1].GetUInt32();
int8 uiSeat = int8(fields[2].GetInt16());
int8 uiSeat = int8(fields[2].GetInt8());
bool bMinion = fields[3].GetBool();
uint8 uiSummonType = fields[4].GetUInt8();
uint32 uiSummonTimer= fields[5].GetUInt32();
Expand Down Expand Up @@ -7154,11 +7154,11 @@ void ObjectMgr::LoadNPCSpellClickSpells()
continue;
}

uint8 userType = fields[3].GetUInt8();
uint8 userType = fields[3].GetUInt16();
if (userType >= SPELL_CLICK_USER_MAX)
sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));

uint8 castFlags = fields[2].GetUInt16();
uint8 castFlags = fields[2].GetUInt8();
SpellClickInfo info;
info.spellId = spellid;
info.castFlags = castFlags;
Expand Down Expand Up @@ -8240,7 +8240,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
count += LoadReferenceVendor(vendor, -item_id, skip_vendors);
else
{
int32 maxcount = fields[1].GetUInt8(); // tinyint(3) unsigned
int32 maxcount = fields[1].GetUInt8();
uint32 incrtime = fields[2].GetUInt32();
uint32 ExtendedCost = fields[3].GetUInt32();

Expand Down Expand Up @@ -8290,7 +8290,7 @@ void ObjectMgr::LoadVendors()
count += LoadReferenceVendor(entry, -item_id, &skip_vendors);
else
{
int32 maxcount = fields[2].GetInt32();
uint32 maxcount = fields[2].GetUInt8();
uint32 incrtime = fields[3].GetUInt32();
uint32 ExtendedCost = fields[4].GetUInt32();

Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Grids/Cells/CellImpl.h
Expand Up @@ -91,7 +91,7 @@ inline void Cell::Visit(CellCoord const& standing_cell, TypeContainerVisitor<T,
//if radius is known to reach cell area more than 4x4 then we should call optimized VisitCircle
//currently this technique works with MAX_NUMBER_OF_CELLS 16 and higher, with lower values
//there are nothing to optimize because SIZE_OF_GRID_CELL is too big...
if (((area.high_bound.x_coord - area.low_bound.x_coord) > 4) && ((area.high_bound.y_coord - area.low_bound.y_coord) > 4))
if ((area.high_bound.x_coord > (area.low_bound.x_coord + 4)) && (area.high_bound.y_coord > (area.low_bound.y_coord + 4)))
{
VisitCircle(visitor, map, area.low_bound, area.high_bound);
return;
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Grids/GridDefines.h
Expand Up @@ -215,7 +215,8 @@ namespace Trinity

inline bool IsValidMapCoord(float c)
{
return finite(c) && (std::fabs(c) <= MAP_HALFSIZE - 0.5f);
//! Since we visit grids in circles, we cannot allow players to relocate to grids on the edge of a map - thus the use of CENTER_GRID_OFFSET
return finite(c) && (std::fabs(c) <= MAP_HALFSIZE - CENTER_GRID_OFFSET - 0.5f);
}

inline bool IsValidMapCoord(float x, float y)
Expand Down
7 changes: 5 additions & 2 deletions src/server/game/Grids/Notifiers/GridNotifiers.h
Expand Up @@ -927,21 +927,23 @@ namespace Trinity
{
public:
AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range)
: i_obj(obj), i_funit(funit), i_range(range)
: i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range)
{
Unit const* check = i_funit;
Unit const* owner = i_funit->GetOwner();
if (owner)
check = owner;
i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER);
if (i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT)
_spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId());
}
bool operator()(Unit* u)
{
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;

if (i_funit->IsValidAttackTarget(u) && i_obj->IsWithinDistInMap(u, i_range))
if (i_funit->_IsValidAttackTarget(u, _spellInfo) && i_obj->IsWithinDistInMap(u, i_range))
return true;

return false;
Expand All @@ -950,6 +952,7 @@ namespace Trinity
bool i_targetForPlayer;
WorldObject const* i_obj;
Unit const* i_funit;
SpellInfo const* _spellInfo;
float i_range;
};

Expand Down
26 changes: 13 additions & 13 deletions src/server/game/Groups/Group.cpp
Expand Up @@ -820,37 +820,37 @@ void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumb
}
}

void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
void Group::SendLootAllPassed(uint32 numberOfPlayers, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
data << uint64(r.itemGUID); // Guid of the item rolled
data << uint32(NumberOfPlayers); // The number of players rolling for it???
data << uint32(r.itemid); // The itemEntryId for the item that shall be rolled for
data << uint32(r.itemRandomPropId); // Item random property ID
data << uint32(r.itemRandomSuffix); // Item random suffix ID
data << uint64(roll.itemGUID); // Guid of the item rolled
data << uint32(numberOfPlayers); // The number of players rolling for it
data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
data << uint32(roll.itemRandomPropId); // Item random property ID
data << uint32(roll.itemRandomSuffix); // Item random suffix ID

for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayer(itr->first);
if (!p || !p->GetSession())
Player* player = ObjectAccessor::FindPlayer(itr->first);
if (!player || !player->GetSession())
continue;

if (itr->second != NOT_VALID)
p->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
}
}

// notify group members which player is the allowed looter for the given creature
void Group::SendLooter(Creature* creature, Player* pLooter)
void Group::SendLooter(Creature* creature, Player* groupLooter)
{
ASSERT(creature);

WorldPacket data(SMSG_LOOT_LIST, (8+8));
data << uint64(creature->GetGUID());
data << uint8(0); // unk1

if (pLooter)
data.append(pLooter->GetPackGUID());
if (groupLooter)
data.append(groupLooter->GetPackGUID());
else
data << uint8(0);

Expand Down
5 changes: 4 additions & 1 deletion src/server/game/Handlers/CharacterHandler.cpp
Expand Up @@ -1119,8 +1119,10 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
uint8 res = ObjectMgr::CheckPlayerName(newName, true);
if (res != CHAR_NAME_SUCCESS)
{
WorldPacket data(SMSG_CHAR_RENAME, 1);
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(res);
data << uint64(guid);
data << newName;
SendPacket(&data);
return;
}
Expand Down Expand Up @@ -1451,6 +1453,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
std::string oldname = result->Fetch()[0].GetString();
sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
}

Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);

stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_NAME_AT_LOGIN);
Expand Down
8 changes: 4 additions & 4 deletions src/server/game/Handlers/GuildHandler.cpp
Expand Up @@ -352,8 +352,8 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data)
uint64 GoGuid;
recv_data >> GoGuid;

uint8 unk;
recv_data >> unk;
uint8 fullSlotList;
recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated

if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
{
Expand All @@ -375,8 +375,8 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data)
uint8 tabId;
recv_data >> tabId;

uint8 unk1;
recv_data >> unk1;
uint8 fullSlotList;
recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated

if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = _GetPlayerGuild(this))
Expand Down
50 changes: 23 additions & 27 deletions src/server/game/Handlers/QueryHandler.cpp
Expand Up @@ -33,50 +33,46 @@

void WorldSession::SendNameQueryOpcode(uint64 guid)
{
Player* player = NULL;
const CharacterNameData* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
if (nameData)
player = ObjectAccessor::FindPlayer(guid);
Player* player = ObjectAccessor::FindPlayer(guid);
CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));

// guess size
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
data.appendPackGUID(guid);
data << uint8(0); // added in 3.1
if (nameData)
if (!player)
{
data << nameData->m_name; // played name
data << uint8(0); // realm name for cross realm BG usage
data << uint8(nameData->m_race);
data << uint8(nameData->m_gender);
data << uint8(nameData->m_class);
data << uint8(1); // player unknown
SendPacket(&data);
return;
}
else
if (!nameData)
{
data << std::string(GetTrinityString(LANG_NON_EXIST_CHARACTER));
data << uint32(0);
data << uint8(2); // name unknown
SendPacket(&data);
return;
}

if (player)
data << uint8(0); // name known
data << nameData->m_name; // played name
data << uint8(0); // realm name - only set for cross realm interaction (such as Battlegrounds)
data << uint8(nameData->m_race);
data << uint8(nameData->m_gender);
data << uint8(nameData->m_class);

if (DeclinedName const* names = player->GetDeclinedNames())
{
if (DeclinedName const* names = player->GetDeclinedNames())
{
data << uint8(1); // is declined
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << names->name[i];
}
else
data << uint8(0); // is not declined
data << uint8(1); // Name is declined
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << names->name[i];
}
else //TODO: decline names may also need to be stored in char name data
data << uint8(0);
else
data << uint8(0); // Name is not declined

SendPacket(&data);
}

void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data)
{
uint64 guid;

recv_data >> guid;

// This is disable by default to prevent lots of console spam
Expand Down
10 changes: 5 additions & 5 deletions src/server/game/Handlers/TicketHandler.cpp
Expand Up @@ -38,7 +38,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)
return;
}

GMTicketResponse response = GMTICKET_RESPONSE_FAILURE;
GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR;
// Player must not have ticket
if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
Expand All @@ -48,7 +48,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)

sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId());

response = GMTICKET_RESPONSE_SUCCESS;
response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}

WorldPacket data(SMSG_GMTICKET_CREATE, 4);
Expand All @@ -61,16 +61,16 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
std::string message;
recv_data >> message;

GMTicketResponse response = GMTICKET_RESPONSE_FAILURE;
if (GmTicket *ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
GMTicketResponse response = GMTICKET_RESPONSE_UPDATE_ERROR;
if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
SQLTransaction trans = SQLTransaction(NULL);
ticket->SetMessage(message);
ticket->SaveToDB(trans);

sWorld->SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName(), ticket->GetId());

response = GMTICKET_RESPONSE_SUCCESS;
response = GMTICKET_RESPONSE_UPDATE_SUCCESS;
}

WorldPacket data(SMSG_GMTICKET_UPDATETEXT, 4);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Instances/InstanceSaveMgr.cpp
Expand Up @@ -358,7 +358,7 @@ void InstanceSaveManager::LoadResetTimes()
{
Field* fields = result->Fetch();
uint32 mapid = fields[0].GetUInt16();
Difficulty difficulty = Difficulty(fields[1].GetUInt32());
Difficulty difficulty = Difficulty(fields[1].GetUInt8());
uint64 oldresettime = fields[2].GetUInt32();

MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Movement/Waypoints/WaypointManager.cpp
Expand Up @@ -79,7 +79,7 @@ void WaypointMgr::Load()
wp->run = fields[6].GetBool();
wp->delay = fields[7].GetUInt32();
wp->event_id = fields[8].GetUInt32();
wp->event_chance = fields[9].GetUInt8();
wp->event_chance = fields[9].GetInt16();

path.push_back(wp);
++count;
Expand Down

0 comments on commit 75fef39

Please sign in to comment.