From b5548f9f12bc84fd1eda5b74342c9af6e72986c3 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Fri, 8 May 2009 18:08:39 +0400 Subject: [PATCH] Small fixes. --- .../2_characters_character_equipmentsets.sql | 4 +- src/game/AchievementMgr.cpp | 2 +- src/game/Level1.cpp | 2 +- src/game/MiscHandler.cpp | 2 +- src/game/Player.cpp | 103 +++++++++--------- src/game/Player.h | 2 +- 6 files changed, 60 insertions(+), 55 deletions(-) diff --git a/sql/310/2_characters_character_equipmentsets.sql b/sql/310/2_characters_character_equipmentsets.sql index 9bccebc7f..52676d4fd 100644 --- a/sql/310/2_characters_character_equipmentsets.sql +++ b/sql/310/2_characters_character_equipmentsets.sql @@ -2,8 +2,8 @@ CREATE TABLE `character_equipmentsets` ( `guid` int(11) NOT NULL default '0', `setguid` bigint(20) NOT NULL auto_increment, `setindex` tinyint(4) NOT NULL default '0', - `name` varchar(30) NOT NULL, - `iconname` varchar(30) NOT NULL, + `name` varchar(100) NOT NULL, + `iconname` varchar(100) NOT NULL, `item0` int(11) NOT NULL default '0', `item1` int(11) NOT NULL default '0', `item2` int(11) NOT NULL default '0', diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 12bca0ed5..853233971 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -1512,7 +1512,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) return; // titles - if(uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE?0:1]) + if(uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1]) { if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) GetPlayer()->SetTitle(titleEntry); diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 0d7e44510..2e288dc3a 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -696,7 +696,7 @@ bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args) uint64 titles2 = titles; - for(int i=1; i < sCharTitlesStore.GetNumRows(); ++i) + for(int i = 1; i < sCharTitlesStore.GetNumRows(); ++i) if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i)) titles2 &= ~(uint64(1) << tEntry->bit_index); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 95380e2e7..7af36a7c3 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1422,7 +1422,7 @@ void WorldSession::HandleChooseTitleOpcode( WorldPacket & recv_data ) recv_data >> title; // -1 at none - if(title > 0 && title < 128) + if(title > 0 && title < 192) { if(!GetPlayer()->HasTitle(title)) return; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e812b5acc..35c29956d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -593,6 +593,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, 0 ); // 0=disabled SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES1, 0 ); // 0=disabled + SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES2, 0 ); // 0=disabled SetUInt32Value( PLAYER_CHOSEN_TITLE, 0 ); SetUInt32Value( PLAYER_FIELD_KILLS, 0 ); SetUInt32Value( PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 0 ); @@ -14189,7 +14190,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if(uint32 curTitle = GetUInt32Value(PLAYER_CHOSEN_TITLE)) { if(!HasTitle(curTitle)) - SetUInt32Value(PLAYER_CHOSEN_TITLE,0); + SetUInt32Value(PLAYER_CHOSEN_TITLE, 0); } // Not finish taxi flight path @@ -19160,7 +19161,7 @@ void Player::EnterVehicle(Vehicle *vehicle) vehicle->setFaction(getFaction()); SetCharm(vehicle); // charm - SetFarSightGUID(vehicle->GetGUID()); // set view + SetFarSightGUID(vehicle->GetGUID()); // set view SetClientControl(vehicle, 1); // redirect controls to vehicle @@ -19252,19 +19253,19 @@ bool Player::isTotalImmune() bool Player::HasTitle(uint32 bitIndex) { - if (bitIndex > 128) + if (bitIndex > 192) return false; - uint32 fieldIndexOffset = bitIndex/32; - uint32 flag = 1 << (bitIndex%32); - return HasFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag); + uint32 fieldIndexOffset = bitIndex / 32; + uint32 flag = 1 << (bitIndex % 32); + return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); } void Player::SetTitle(CharTitlesEntry const* title) { - uint32 fieldIndexOffset = title->bit_index/32; - uint32 flag = 1 << (title->bit_index%32); - SetFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag); + uint32 fieldIndexOffset = title->bit_index / 32; + uint32 flag = 1 << (title->bit_index % 32); + SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); } void Player::ConvertRune(uint8 index, uint8 newType) @@ -19893,60 +19894,64 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data) { *data << uint32(GetFreeTalentPoints()); // unspentTalentPoints uint8 talentGroupCount = 1; - *data << uint8(talentGroupCount); // talent group count (1 or 2) + *data << uint8(talentGroupCount); // talent group count (0, 1 or 2) *data << uint8(0); // talent group index (0 or 1) if(talentGroupCount) { - uint8 talentIdCount = 0; - size_t pos = data->wpos(); - *data << uint8(talentIdCount); // [PH], talentIdCount - - // find class talent tabs (all players have 3 talent tabs) - uint32 const* talentTabIds = GetTalentTabPages(getClass()); - - for(uint32 i = 0; i < 3; ++i) + // loop through all specs (only 1 for now) + for(uint32 groups = 0; groups < talentGroupCount; ++groups) { - uint32 talentTabId = talentTabIds[i]; + uint8 talentIdCount = 0; + size_t pos = data->wpos(); + *data << uint8(talentIdCount); // [PH], talentIdCount - for(uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) + // find class talent tabs (all players have 3 talent tabs) + uint32 const* talentTabIds = GetTalentTabPages(getClass()); + + for(uint32 i = 0; i < 3; ++i) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); - if(!talentInfo) - continue; + uint32 talentTabId = talentTabIds[i]; - // skip another tab talents - if(talentInfo->TalentTab != talentTabId) - continue; - - // find max talent rank - int32 curtalent_maxrank = -1; - for(int32 k = 4; k > -1; --k) + for(uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) { - if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k])) + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); + if(!talentInfo) + continue; + + // skip another tab talents + if(talentInfo->TalentTab != talentTabId) + continue; + + // find max talent rank + int32 curtalent_maxrank = -1; + for(int32 k = 4; k > -1; --k) { - curtalent_maxrank = k; - break; + if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k])) + { + curtalent_maxrank = k; + break; + } } + + // not learned talent + if(curtalent_maxrank < 0) + continue; + + *data << uint32(talentInfo->TalentID); // Talent.dbc + *data << uint8(curtalent_maxrank); // talentMaxRank (0-4) + + ++talentIdCount; } - - // not learned talent - if(curtalent_maxrank < 0) - continue; - - *data << uint32(talentInfo->TalentID); // Talent.dbc - *data << uint8(curtalent_maxrank); // talentMaxRank (0-4) - - ++talentIdCount; } + + data->put(pos, talentIdCount); // put real count + + *data << uint8(MAX_GLYPH_SLOT_INDEX); // glyphs count + + for(uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) + *data << uint16(GetGlyph(i)); // GlyphProperties.dbc } - - data->put(pos, talentIdCount); // put real count - - *data << uint8(MAX_GLYPH_SLOT_INDEX); // glyphs count - - for(uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) - *data << uint16(GetGlyph(i)); // GlyphProperties.dbc } } diff --git a/src/game/Player.h b/src/game/Player.h index 4fcd662af..abfede30d 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1390,7 +1390,7 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 GetGlyph(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot); } uint32 GetFreePrimaryProffesionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); } - void SetFreePrimaryProffesions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2,profs); } + void SetFreePrimaryProffesions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); } void InitPrimaryProffesions(); PlayerSpellMap const& GetSpellMap() const { return m_spells; }