diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/ArenaTeam.cpp | 230 | ||||
-rw-r--r-- | src/game/ArenaTeam.h | 43 | ||||
-rw-r--r-- | src/game/BattleGround.cpp | 23 | ||||
-rw-r--r-- | src/game/CharacterHandler.cpp | 46 | ||||
-rw-r--r-- | src/game/Creature.cpp | 2 | ||||
-rw-r--r-- | src/game/Guild.cpp | 20 | ||||
-rw-r--r-- | src/game/MiscHandler.cpp | 18 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 59 | ||||
-rw-r--r-- | src/game/Player.h | 6 | ||||
-rw-r--r-- | src/game/Spell.cpp | 24 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 30 | ||||
-rw-r--r-- | src/game/WaypointMovementGenerator.cpp | 3 | ||||
-rw-r--r-- | src/game/World.cpp | 271 | ||||
-rw-r--r-- | src/game/World.h | 30 | ||||
-rw-r--r-- | src/game/WorldSession.cpp | 9 | ||||
-rw-r--r-- | src/game/WorldSession.h | 4 | ||||
-rw-r--r-- | src/shared/Database/DBCStores.cpp | 13 | ||||
-rw-r--r-- | src/shared/Database/DBCStores.h | 1 | ||||
-rw-r--r-- | src/trinitycore/CliRunnable.cpp | 4 | ||||
-rw-r--r-- | src/trinitycore/WorldRunnable.cpp | 1 | ||||
-rw-r--r-- | src/trinitycore/trinitycore.conf.dist | 340 |
22 files changed, 689 insertions, 490 deletions
diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index b108c98e1ec..40b75c047c7 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -24,21 +24,21 @@ ArenaTeam::ArenaTeam() { - Id = 0; - Type = 0; - Name = ""; - CaptainGuid = 0; - BackgroundColor = 0; // background - EmblemStyle = 0; // icon - EmblemColor = 0; // icon color - BorderStyle = 0; // border - BorderColor = 0; // border color - stats.games = 0; - stats.played = 0; - stats.rank = 0; - stats.rating = 1500; - stats.wins = 0; - stats.wins2 = 0; + Id = 0; + Type = 0; + Name = ""; + CaptainGuid = 0; + BackgroundColor = 0; // background + EmblemStyle = 0; // icon + EmblemColor = 0; // icon color + BorderStyle = 0; // border + BorderColor = 0; // border color + stats.games_week = 0; + stats.games_season = 0; + stats.rank = 0; + stats.rating = 1500; + stats.wins_week = 0; + stats.wins_season = 0; } ArenaTeam::~ArenaTeam() @@ -77,7 +77,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam "VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')", Id, ArenaTeamName.c_str(), GUID_LOPART(CaptainGuid), Type, BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor); CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games, wins, played, wins2, rank) VALUES " - "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", Id,stats.rating,stats.games,stats.wins,stats.played,stats.wins2,stats.rank); + "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", Id,stats.rating,stats.games_week,stats.wins_week,stats.games_season,stats.wins_season,stats.rank); CharacterDatabase.CommitTransaction(); @@ -130,13 +130,14 @@ bool ArenaTeam::AddMember(uint64 PlayerGuid) Player::RemovePetitionsAndSigns(PlayerGuid, GetType()); ArenaTeamMember newmember; - newmember.name = plName; - newmember.guid = PlayerGuid; - newmember.Class = plClass; - newmember.played_season = 0; - newmember.played_week = 0; - newmember.wons_season = 0; - newmember.wons_week = 0; + newmember.name = plName; + newmember.guid = PlayerGuid; + newmember.Class = plClass; + newmember.games_season = 0; + newmember.games_week = 0; + newmember.wins_season = 0; + newmember.wins_week = 0; + newmember.personal_rating = 1500; members.push_back(newmember); CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid,guid) VALUES ('%u', '%u')", Id, GUID_LOPART(newmember.guid)); @@ -145,43 +146,24 @@ bool ArenaTeam::AddMember(uint64 PlayerGuid) { pl->SetInArenaTeam(Id, GetSlot()); pl->SetArenaTeamIdInvited(0); - // personal rating - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + 5, 1500); - } - // hide promote/remove buttons - if(CaptainGuid != PlayerGuid) - { - if(pl) + // hide promote/remove buttons + if(CaptainGuid != PlayerGuid) pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1); } - - // setuint32valueindb is asynch, can't be used here - Tokens tokens; - if(!Player::LoadValuesArrayFromDB(tokens,PlayerGuid)) - return false; - - // arena team id - uint16 index = PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6); - char buf[11]; - snprintf(buf,11,"%u",Id); - tokens[index] = buf; - // pers rating - index = PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + 5; - buf[11]; - snprintf(buf,11,"%u",1500); - tokens[index] = buf; - // hide promote/remove buttons - if(CaptainGuid != PlayerGuid) + else { - index = PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6); - buf[11]; - snprintf(buf,11,"%u",1); - tokens[index] = buf; - } - - Player::SaveValuesArrayInDB(tokens,PlayerGuid); + Tokens tokens; + if(Player::LoadValuesArrayFromDB(tokens,PlayerGuid)) + { + Player::SetUInt32ValueInArray(tokens,PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6), Id); + // hide promote/remove buttons + if(CaptainGuid != PlayerGuid) + Player::SetUInt32ValueInArray(tokens,PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1); + Player::SaveValuesArrayInDB(tokens,PlayerGuid); + } + } return true; } @@ -235,12 +217,12 @@ void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId) Field *fields = result->Fetch(); - stats.rating = fields[0].GetUInt32(); - stats.games = fields[1].GetUInt32(); - stats.wins = fields[2].GetUInt32(); - stats.played = fields[3].GetUInt32(); - stats.wins2 = fields[4].GetUInt32(); - stats.rank = fields[5].GetUInt32(); + stats.rating = fields[0].GetUInt32(); + stats.games_week = fields[1].GetUInt32(); + stats.wins_week = fields[2].GetUInt32(); + stats.games_season = fields[3].GetUInt32(); + stats.wins_season = fields[4].GetUInt32(); + stats.rank = fields[5].GetUInt32(); delete result; } @@ -249,7 +231,7 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) { Field *fields; - QueryResult *result = CharacterDatabase.PQuery("SELECT guid,played_week,wons_week,played_season,wons_season,points_to_add FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId); + QueryResult *result = CharacterDatabase.PQuery("SELECT guid,games_week,wins_week,games_season,wins_season,points_to_add FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId); if(!result) return; @@ -267,10 +249,10 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) continue; } LoadPlayerStats(&newmember); - newmember.played_week = fields[1].GetUInt32(); - newmember.wons_week = fields[2].GetUInt32(); - newmember.played_season = fields[3].GetUInt32(); - newmember.wons_season = fields[4].GetUInt32(); + newmember.games_week = fields[1].GetUInt32(); + newmember.wins_week = fields[2].GetUInt32(); + newmember.games_season = fields[3].GetUInt32(); + newmember.wins_season = fields[4].GetUInt32(); members.push_back(newmember); }while( result->NextRow() ); delete result; @@ -408,11 +390,11 @@ void ArenaTeam::Roster(WorldSession *session) data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown data << uint8(pl->getLevel()); // unknown, probably level data << uint8(pl->getClass()); // class - data << uint32(itr->played_week); // played this week - data << uint32(itr->wons_week); // wins this week - data << uint32(itr->played_season); // played this season - data << uint32(itr->wons_season); // wins this season - data << uint32(pl->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + GetSlot() * 6 + 5)); // personal rating? + data << uint32(itr->games_week); // played this week + data << uint32(itr->wins_week); // wins this week + data << uint32(itr->games_season); // played this season + data << uint32(itr->wins_season); // wins this season + data << uint32(itr->personal_rating); // personal rating } else { @@ -422,11 +404,11 @@ void ArenaTeam::Roster(WorldSession *session) data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown data << uint8(0); // unknown, level? data << uint8(itr->Class); // class - data << uint32(itr->played_week); // played this week - data << uint32(itr->wons_week); // wins this week - data << uint32(itr->played_season); // played this season - data << uint32(itr->wons_season); // wins this season - data << uint32(Player::GetUInt32ValueFromDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + GetSlot() * 6 + 5, itr->guid)); // personal rating? + data << uint32(itr->games_week); // played this week + data << uint32(itr->wins_week); // wins this week + data << uint32(itr->games_season); // played this season + data << uint32(itr->wins_season); // wins this season + data << uint32(itr->personal_rating); // personal rating } } session->SendPacket(&data); @@ -453,10 +435,10 @@ void ArenaTeam::Stats(WorldSession *session) WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7); data << uint32(GetId()); // arena team id data << uint32(stats.rating); // rating - data << uint32(stats.games); // games - data << uint32(stats.wins); // wins - data << uint32(stats.played); // played - data << uint32(stats.wins2); // wins(again o_O) + data << uint32(stats.games_week); // games this week + data << uint32(stats.wins_week); // wins this week + data << uint32(stats.games_season); // played this season + data << uint32(stats.wins_season); // wins this season data << uint32(stats.rank); // rank session->SendPacket(&data); } @@ -475,25 +457,19 @@ void ArenaTeam::NotifyStatsChanged() void ArenaTeam::InspectStats(WorldSession *session, uint64 guid) { + ArenaTeamMember* member = GetMember(guid); + if(!member) + return; + WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); data << uint64(guid); // player guid data << uint8(GetSlot()); // slot (0...2) data << uint32(GetId()); // arena team id data << uint32(stats.rating); // rating - data << uint32(stats.played); // season played - data << uint32(stats.wins2); // season wins - uint32 participated = 0; - for(MemberList::iterator itr = members.begin(); itr!= members.end(); ++itr) - { - if(itr->guid == guid) - { - participated = itr->played_season; - break; - } - } - data << uint32(participated); // played (count of all games, that the inspected member participated...) - data << uint32(Player::GetUInt32ValueFromDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + GetSlot() * 6 + 5, guid)); // unk, 2.3.3 (personal rating?) - + data << uint32(stats.games_season); // season played + data << uint32(stats.wins_season); // season wins + data << member->games_season; // played (count of all games, that the inspected member participated...) + data << member->personal_rating; // personal rating session->SendPacket(&data); } @@ -516,20 +492,20 @@ void ArenaTeam::SetStats(uint32 stat_type, uint32 value) stats.rating = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_GAMES: - stats.games = value; + case STAT_TYPE_GAMES_WEEK: + stats.games_week = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET games = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_WINS: - stats.wins = value; + case STAT_TYPE_WINS_WEEK: + stats.wins_week = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_PLAYED: - stats.played = value; + case STAT_TYPE_GAMES_SEASON: + stats.games_season = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET played = '%u' WHERE arenateamid = '%u'", value, GetId()); break; - case STAT_TYPE_WINS2: - stats.wins2 = value; + case STAT_TYPE_WINS_SEASON: + stats.wins_season = value; CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins2 = '%u' WHERE arenateamid = '%u'", value, GetId()); break; case STAT_TYPE_RANK: @@ -625,10 +601,10 @@ int32 ArenaTeam::WonAgainstChance(float chance) int32 mod = (int32)floor(32.0f * (1.0f - chance)); // modify the team stats accordingly stats.rating += mod; - stats.games += 1; - stats.wins += 1; - stats.played += 1; - stats.wins2 += 1; + stats.games_week += 1; + stats.wins_week += 1; + stats.games_season += 1; + stats.wins_season += 1; /* this should be done in .flusharenapoints; not a breaker though. uint32 higher_rank = 0; QueryResult *result = CharacterDatabase.PQuery("SELECT DISTINCT COUNT(arenateamid) FROM arena_team_stats WHERE rating > '%u' AND arenateamid <> '%u'",stats.rating, Id); @@ -649,8 +625,8 @@ int32 ArenaTeam::LostAgainstChance(float chance) int32 mod = (int32)ceil(32.0f * (0.0f - chance)); // modify the team stats accordingly stats.rating += mod; - stats.games += 1; - stats.played += 1; + stats.games_week += 1; + stats.games_season += 1; /* uint32 higher_rank = 0; QueryResult *result = CharacterDatabase.PQuery("SELECT DISTINCT COUNT (arenateamid) FROM arena_team_stats WHERE rating > '%u' AND arenateamid <> '%u'",stats.rating, Id); if(result) @@ -679,11 +655,11 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstrating) personalrating = 0; plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot()*6) + 5, personalrating); // update personal played stats - itr->played_week +=1; - itr->played_season +=1; + itr->games_week +=1; + itr->games_season +=1; // update the unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 2, itr->played_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 3, itr->played_season); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 2, itr->games_week); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 3, itr->games_season); return; } } @@ -705,13 +681,13 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstrating) personalrating = 0; plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot()*6) + 5, personalrating); // update personal stats - itr->played_week +=1; - itr->played_season +=1; - itr->wons_season += 1; - itr->wons_week += 1; + itr->games_week +=1; + itr->games_season +=1; + itr->wins_season += 1; + itr->wins_week += 1; // update unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 2, itr->played_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 3, itr->played_season); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 2, itr->games_week); + plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 3, itr->games_season); return; } } @@ -722,14 +698,14 @@ void ArenaTeam::UpdateArenaPointsHelper() // called after a match has ended and the stats are already modified // helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons) // 10 played games per week is a minimum - if(stats.games < 10) + if(stats.games_week < 10) return; // to get points, a player has to participate in at least 30% of the matches - uint32 min_plays = (uint32)ceil(stats.games * 0.3); + uint32 min_plays = (uint32)ceil(stats.games_week * 0.3); for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) { // the player participated in enough games, update his points - if(itr->played_week >= min_plays) + if(itr->games_week >= min_plays) { // do it separately for online and offline players // online players might have modified personal rating in MemberLost/MemberWon, that's not already saved to DB because of asynch queries @@ -755,21 +731,21 @@ void ArenaTeam::SaveToDB() { // save team and member stats to db // called after a match has ended - CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u',games = '%u',played = '%u',rank = '%u',wins = '%u',wins2 = '%u' WHERE arenateamid = '%u'", stats.rating, stats.games, stats.played, stats.rank, stats.wins, stats.wins2, GetId()); + CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u',games = '%u',played = '%u',rank = '%u',wins = '%u',wins2 = '%u' WHERE arenateamid = '%u'", stats.rating, stats.games_week, stats.games_season, stats.rank, stats.wins_week, stats.wins_season, GetId()); for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) { - CharacterDatabase.PExecute("UPDATE arena_team_member SET played_week = '%u', wons_week = '%u', played_season = '%u', wons_season = '%u' WHERE arenateamid = '%u' AND guid = '%u'", itr->played_week, itr->wons_week, itr->played_season, itr->wons_season, Id, itr->guid); + CharacterDatabase.PExecute("UPDATE arena_team_member SET games_week = '%u', wins_week = '%u', games_season = '%u', wins_season = '%u' WHERE arenateamid = '%u' AND guid = '%u'", itr->games_week, itr->wins_week, itr->games_season, itr->wins_season, Id, itr->guid); } } void ArenaTeam::FinishWeek() { - stats.games = 0; // played this week - stats.wins = 0; // wins this week + stats.games_week = 0; // played this week + stats.wins_week = 0; // wins this week for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) { - itr->played_week = 0; - itr->wons_week = 0; + itr->games_week = 0; + itr->wins_week = 0; } } diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index 03cf5ccc7d4..2e6b3d5faee 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TRINITYCORE_ARENATEAM_H @@ -68,12 +68,12 @@ ERR_ARENA_TEAM_LEVEL_TOO_LOW_I enum ArenaTeamStatTypes { - STAT_TYPE_RATING = 0, - STAT_TYPE_GAMES = 1, - STAT_TYPE_WINS = 2, - STAT_TYPE_PLAYED = 3, - STAT_TYPE_WINS2 = 4, - STAT_TYPE_RANK = 5 + STAT_TYPE_RATING = 0, + STAT_TYPE_GAMES_WEEK = 1, + STAT_TYPE_WINS_WEEK = 2, + STAT_TYPE_GAMES_SEASON = 3, + STAT_TYPE_WINS_SEASON = 4, + STAT_TYPE_RANK = 5 }; enum ArenaTeamTypes @@ -90,19 +90,20 @@ struct ArenaTeamMember //uint32 unk2; //uint8 unk1; uint8 Class; - uint32 played_week; - uint32 wons_week; - uint32 played_season; - uint32 wons_season; + uint32 games_week; + uint32 wins_week; + uint32 games_season; + uint32 wins_season; + uint32 personal_rating; }; struct ArenaTeamStats { uint32 rating; - uint32 games; - uint32 wins; - uint32 played; - uint32 wins2; + uint32 games_week; + uint32 wins_week; + uint32 games_season; + uint32 wins_season; uint32 rank; }; @@ -125,7 +126,7 @@ class ArenaTeam static uint8 GetSlotByType(uint32 type); const uint64& GetCaptain() const { return CaptainGuid; } std::string GetName() const { return Name; } - ArenaTeamStats GetStats() const { return stats; } + const ArenaTeamStats& GetStats() const { return stats; } void SetStats(uint32 stat_type, uint32 value); uint32 GetRating() const { return stats.rating; } @@ -145,6 +146,14 @@ class ArenaTeam MemberList::iterator membersbegin(){ return members.begin(); } MemberList::iterator membersEnd(){ return members.end(); } bool HaveMember(uint64 guid) const; + ArenaTeamMember* GetMember(uint64 guid) + { + for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + if(itr->guid==guid) + return &(*itr); + + return NULL; + } bool LoadArenaTeamFromDB(uint32 ArenaTeamId); void LoadMembersFromDB(uint32 ArenaTeamId); diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 772368841d1..098b5a0d28e 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -946,14 +946,21 @@ void BattleGround::AddPlayer(Player *plr) plr->RemoveArenaAuras(); plr->RemoveArenaSpellCooldowns(); plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT); - if(team == ALLIANCE && plr->GetTeam() == ALLIANCE) - plr->CastSpell(plr,SPELL_ALLIANCE_GOLD_FLAG,true); - else if(team == HORDE && plr->GetTeam() == ALLIANCE) - plr->CastSpell(plr,SPELL_ALLIANCE_GREEN_FLAG,true); - else if(team == ALLIANCE && plr->GetTeam() == HORDE) - plr->CastSpell(plr,SPELL_HORDE_GOLD_FLAG,true); - else - plr->CastSpell(plr,SPELL_HORDE_GREEN_FLAG,true); + if(team == ALLIANCE) // gold + { + if(plr->GetTeam() == HORDE) + plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true); + else + plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG,true); + } + else // green + { + if(plr->GetTeam() == HORDE) + plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG,true); + else + plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true); + } + plr->DestroyConjuredItems(true); Pet* pet = plr->GetPet(); diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 42732a17d2b..40f3fb8e530 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -158,18 +158,20 @@ void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ ) // ------- Query Without Declined Names -------- // 0 1 2 3 4 5 6 7 8 "SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, " - // 9 10 11 12 - "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level " + // 9 10 11 12 13 + "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, guild_member.guildid " "FROM characters LEFT JOIN character_pet ON characters.guid=character_pet.owner AND character_pet.slot='0' " + "LEFT JOIN guild_member ON characters.guid = guild_member.guid " "WHERE characters.account = '%u' ORDER BY characters.guid" : // --------- Query With Declined Names --------- // 0 1 2 3 4 5 6 7 8 "SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, " - // 9 10 11 12 13 - "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, genitive " + // 9 10 11 12 13 14 + "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, guild_member.guildid, genitive " "FROM characters LEFT JOIN character_pet ON characters.guid = character_pet.owner AND character_pet.slot='0' " "LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid " + "LEFT JOIN guild_member ON characters.guid = guild_member.guid " "WHERE characters.account = '%u' ORDER BY characters.guid", GetAccountId()); } @@ -542,6 +544,22 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" ); } + //QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow()); + QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD); + + if(resultGuild) + { + Field *fields = resultGuild->Fetch(); + pCurrChar->SetInGuild(fields[0].GetUInt32()); + pCurrChar->SetRank(fields[1].GetUInt32()); + delete resultGuild; + } + else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership + { + pCurrChar->SetInGuild(0); + pCurrChar->SetRank(0); + } + if(pCurrChar->GetGuildId() != 0) { Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId()); @@ -569,8 +587,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) { // remove wrong guild data sLog.outError("Player %s (GUID: %u) marked as member not existed guild (id: %u), removing guild membership for player.",pCurrChar->GetName(),pCurrChar->GetGUIDLow(),pCurrChar->GetGuildId()); - pCurrChar->SetUInt32Value(PLAYER_GUILDID,0); - pCurrChar->SetUInt32ValueInDB(PLAYER_GUILDID,0,pCurrChar->GetGUID()); + pCurrChar->SetInGuild(0); } } @@ -593,22 +610,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) } } - //QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow()); - QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD); - - if(resultGuild) - { - Field *fields = resultGuild->Fetch(); - pCurrChar->SetInGuild(fields[0].GetUInt32()); - pCurrChar->SetRank(fields[1].GetUInt32()); - delete resultGuild; - } - else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership - { - pCurrChar->SetInGuild(0); - pCurrChar->SetRank(0); - } - if (!pCurrChar->GetMap()->Add(pCurrChar)) { AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId()); @@ -750,7 +751,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) if(sWorld.getConfig(CONFIG_START_ALL_TAXI)) pCurrChar->SetTaxiCheater(true); - if(pCurrChar->isGameMaster()) SendNotification(LANG_GM_ON); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index e02f48e6134..e23059de8fa 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1979,7 +1979,7 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const if(!pVictim->isInAccessiblePlaceFor(this)) return true; - if(sMapStore.LookupEntry(GetMapId())->Instanceable()) + if(sMapStore.LookupEntry(GetMapId())->IsDungeon()) return false; float length = pVictim->GetDistance(CombatStartX,CombatStartY,CombatStartZ); diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 2fe6b2108b2..a4ac81f3a40 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -151,17 +151,13 @@ bool Guild::AddMember(uint64 plGuid, uint32 plRank) CharacterDatabase.PExecute("INSERT INTO guild_member (guildid,guid,rank,pnote,offnote) VALUES ('%u', '%u', '%u','%s','%s')", Id, GUID_LOPART(plGuid), newmember.RankId, dbPnote.c_str(), dbOFFnote.c_str()); + // If player not in game data in data field will be loaded from guild tables, no need to update it!! if(pl) { pl->SetInGuild(Id); pl->SetRank(newmember.RankId); pl->SetGuildIdInvited(0); } - else - { - Player::SetUInt32ValueInDB(PLAYER_GUILDID, Id, plGuid); - Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, newmember.RankId, plGuid); - } return true; } @@ -460,16 +456,15 @@ void Guild::DelMember(uint64 guid, bool isDisbanding) this->SetLeader(newLeaderGUID); newLeader = objmgr.GetPlayer(newLeaderGUID); + + // If player not online data in data field will be loaded from guild tabs no need to update it !! if(newLeader) { newLeader->SetRank(GR_GUILDMASTER); newLeaderName = newLeader->GetName(); } else - { - Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, GR_GUILDMASTER, newLeaderGUID); objmgr.GetPlayerNameByGUID(newLeaderGUID, newLeaderName); - } // when leader non-exist (at guild load with deleted leader only) not send broadcasts if(objmgr.GetPlayerNameByGUID(guid, oldLeaderName)) @@ -500,16 +495,12 @@ void Guild::DelMember(uint64 guid, bool isDisbanding) members.erase(GUID_LOPART(guid)); Player *player = objmgr.GetPlayer(guid); + // If player not online data in data field will be loaded from guild tabs no need to update it !! if(player) { player->SetInGuild(0); player->SetRank(0); } - else - { - Player::SetUInt32ValueInDB(PLAYER_GUILDID, 0, guid); - Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, GR_GUILDMASTER, guid); - } CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", GUID_LOPART(guid)); } @@ -521,10 +512,9 @@ void Guild::ChangeRank(uint64 guid, uint32 newRank) itr->second.RankId = newRank; Player *player = objmgr.GetPlayer(guid); + // If player not online data in data field will be loaded from guild tabs no need to update it !! if(player) player->SetRank(newRank); - else - Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, newRank, guid); CharacterDatabase.PExecute( "UPDATE guild_member SET rank='%u' WHERE guid='%u'", newRank, GUID_LOPART(guid) ); } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 0da6e1b74e4..e63a92c27b1 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -279,13 +279,6 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ ) if (uint64 lguid = GetPlayer()->GetLootGUID()) DoLootRelease(lguid); - //instant logout for admins, gm's, mod's - if( GetSecurity() > SEC_PLAYER ) - { - LogoutPlayer(true); - return; - } - //Can not logout if... if( GetPlayer()->isInCombat() || //...is in combat GetPlayer()->duel || //...is in Duel @@ -302,8 +295,9 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ ) return; } - //instant logout in taverns/cities or on taxi or if its enabled in Trinityd.conf - if(GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() || sWorld.getConfig(CONFIG_INSTANT_LOGOUT)) + //instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in mangosd.conf + if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() || + GetSecurity() >= sWorld.getConfig(CONFIG_INSTANT_LOGOUT)) { LogoutPlayer(true); return; @@ -671,9 +665,9 @@ void WorldSession::HandleCorpseReclaimOpcode(WorldPacket &recv_data) if (GetPlayer()->isAlive()) return; - if (BattleGround * bg = _player->GetBattleGround()) - if(bg->isArena()) - return; + // do not allow corpse reclaim in arena + if (GetPlayer()->InArena()) + return; // body not released yet if(!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index bdf9e0328f2..75f5ab8273e 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7446,7 +7446,7 @@ void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids) if(itrM->second.dataint) { if(!GetTrinityStringLocale (itrM->second.dataint)) - sLog.outErrorDb( "Table `db_script_string` has not existed string id %u", *itrM); + sLog.outErrorDb( "Table `db_script_string` has not existed string id %u", itrM->first); if(ids.count(itrM->second.dataint)) ids.erase(itrM->second.dataint); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b1dfb911c2b..783172a89d4 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -593,18 +593,14 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, SetUInt32Value( PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0 ); // set starting level - if(GetSession()->GetSecurity() >= SEC_MODERATOR) - SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_GM_START_LEVEL) ); + if (GetSession()->GetSecurity() >= SEC_MODERATOR) + SetUInt32Value (UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_GM_LEVEL)); else - SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) ); - // set starting gold - SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_PLAYER_START_GOLD) ); + SetUInt32Value (UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL)); - // set starting honor - SetUInt32Value( PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_HONOR) ); - - // set starting arena pts - SetUInt32Value( PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_ARENAPTS) ); + SetUInt32Value (PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_START_PLAYER_MONEY)); + SetUInt32Value (PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_START_HONOR_POINTS)); + SetUInt32Value (PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_START_ARENA_POINTS)); // start with every map explored if(sWorld.getConfig(CONFIG_START_ALL_EXPLORED)) @@ -883,8 +879,8 @@ void Player::HandleDrowning() if(!m_isunderwater) return; - //if players is GM, have waterbreath, dead or breathing is disabled - if(sWorld.getConfig(CONFIG_DISABLE_BREATHING) || waterbreath || isGameMaster() || !isAlive()) + //if player is GM, have waterbreath, is dead or if breathing is disabled then return + if(waterbreath || isGameMaster() || !isAlive() || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_DISABLE_BREATHING)) { StopMirrorTimer(BREATH_TIMER); m_isunderwater = 0; @@ -1415,7 +1411,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) *p_data << GetPositionY(); *p_data << GetPositionZ(); - *p_data << GetUInt32Value(PLAYER_GUILDID); // guild id + *p_data << (result ? result->Fetch()[13].GetUInt32() : 0); uint32 char_flags = 0; if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) @@ -1428,7 +1424,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) char_flags |= CHARACTER_FLAG_RENAME; // always send the flag if declined names aren't used // to let the client select a default method of declining the name - if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[13].GetCppString() != "")) + if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[14].GetCppString() != "")) char_flags |= CHARACTER_FLAG_DECLINED; *p_data << (uint32)char_flags; // character flags @@ -2245,7 +2241,7 @@ void Player::GiveLevel(uint32 level) if(getLevel()!= level) m_Played_time[1] = 0; // Level Played Time reset SetLevel(level); - UpdateMaxSkills(); + UpdateSkillsForLevel (); // save base values (bonuses already included in stored stats for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) @@ -2321,7 +2317,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ); SetUInt32Value(PLAYER_NEXT_LEVEL_XP, Trinity::XP::xp_to_level(getLevel())); - UpdateMaxSkills (); + UpdateSkillsForLevel (); // set default cast time multiplier SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); @@ -3851,7 +3847,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) // some items limited to specific map DestroyZoneLimitedItem( true, GetZoneId()); - if(!applySickness || getLevel() <= 10) + if(!applySickness) return; //Characters from level 1-10 are not affected by resurrection sickness. @@ -4972,9 +4968,12 @@ void Player::ModifySkillBonus(uint32 skillid,int32 val, bool talent) } } -void Player::UpdateMaxSkills() +void Player::UpdateSkillsForLevel() { uint16 maxconfskill = sWorld.GetConfigMaxSkillValue(); + uint32 maxSkill = GetMaxSkillValueForLevel(); + + bool alwaysMaxSkill = sWorld.getConfig(CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL); for (uint16 i=0; i < PLAYER_MAX_SKILLS; i++) if (GetUInt32Value(PLAYER_SKILL_INDEX(i))) @@ -4992,11 +4991,15 @@ void Player::UpdateMaxSkills() uint32 max = SKILL_MAX(data); uint32 val = SKILL_VALUE(data); - // update only level dependent max skill values - if(max!=1 && max != maxconfskill) + /// update only level dependent max skill values + if(max!=1) { - uint32 max_Skill = GetMaxSkillValueForLevel(); - SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(val,max_Skill)); + /// miximize skill always + if(alwaysMaxSkill) + SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(maxSkill,maxSkill)); + /// update max skill value if current max skill not maximized + else if(max != maxconfskill) + SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(val,maxSkill)); } } } @@ -6019,6 +6022,18 @@ void Player::UpdateHonorFields() ///An exact honor value can also be given (overriding the calcs) bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvptoken) { + // do not reward honor in arenas, but enable onkill spellproc + if(InArena()) + { + if(!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER) + return false; + + if( GetBGTeam() == ((Player*)uVictim)->GetBGTeam() ) + return false; + + return true; + } + // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens if(GetDummyAura(SPELL_AURA_PLAYER_INACTIVE)) return false; diff --git a/src/game/Player.h b/src/game/Player.h index 0f2b9fc0dd5..6aa91c6dfb9 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1517,8 +1517,8 @@ class TRINITY_DLL_SPEC Player : public Unit void RemoveFromGroup() { RemoveFromGroup(GetGroup(),GetGUID()); } void SendUpdateToOutOfRangeGroupMembers(); - void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, GetGUID()); } - void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, GetGUID()); } + void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); } + void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); } void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); } static uint32 GetGuildIdFromDB(uint64 guid); @@ -1726,7 +1726,7 @@ class TRINITY_DLL_SPEC Player : public Unit void SetFactionVisible(FactionState* faction); void SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId); void SetFactionVisibleForFactionId(uint32 FactionId); - void UpdateMaxSkills(); + void UpdateSkillsForLevel(); void UpdateSkillsToMaxSkillsForLevel(); // for .levelup void ModifySkillBonus(uint32 skillid,int32 val, bool talent); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 1aa916f3f56..746336cdcce 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2991,13 +2991,23 @@ void Spell::SendCastResult(uint8 result) break; case SPELL_FAILED_REQUIRES_AREA: // hardcode areas limitation case - if( m_spellInfo->Id==41618 || m_spellInfo->Id==41620 ) - data << uint32(3842); - else if( m_spellInfo->Id==41617 || m_spellInfo->Id==41619 ) - data << uint32(3905); - // normal case - else - data << uint32(m_spellInfo->AreaId); + switch(m_spellInfo->Id) + { + case 41617: // Cenarion Mana Salve + case 41619: // Cenarion Healing Salve + data << uint32(3905); + break; + case 41618: // Bottled Nethergon Energy + case 41620: // Bottled Nethergon Vapor + data << uint32(3842); + break; + case 45373: // Bloodberry Elixir + data << uint32(4075); + break; + default: // default case + data << uint32(m_spellInfo->AreaId); + break; + } break; case SPELL_FAILED_TOTEMS: if(m_spellInfo->Totem[0]) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 1b6bd482468..8d17d94ec8e 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2034,6 +2034,11 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z { if(uint32 mask = spellmgr.GetSpellElixirMask(spellInfo->Id)) { + if(mask & ELIXIR_BATTLE_MASK) + { + if(spellInfo->Id==45373) // Bloodberry Elixir + return zone_id==4075; + } if(mask & ELIXIR_UNSTABLE_MASK) { // in the Blade's Edge Mountains Plateaus and Gruul's Lair. @@ -2041,9 +2046,8 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z } if(mask & ELIXIR_SHATTRATH_MASK) { - // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple - // TODO: and the Sunwell Plateau - if(zone_id ==3607 || map_id==534 || map_id==564) + // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple, Sunwell Plateau + if(zone_id ==3607 || map_id==534 || map_id==564 || zone_id==4075) return true; MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); @@ -2061,8 +2065,8 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z // special cases zone check (maps checked by multimap common id) switch(spellInfo->Id) { - case 41618: - case 41620: + case 41618: // Bottled Nethergon Energy + case 41620: // Bottled Nethergon Vapor { MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); if(!mapEntry) @@ -2070,9 +2074,8 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z return mapEntry->multimap_id==206; } - - case 41617: - case 41619: + case 41617: // Cenarion Mana Salve + case 41619: // Cenarion Healing Salve { MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); if(!mapEntry) @@ -2080,14 +2083,9 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z return mapEntry->multimap_id==207; } - // Dragonmaw Illusion - case 40216: - case 42016: - { - if ( area_id != 3759 && area_id != 3966 && area_id != 3939 ) - return false; - break; - } + case 40216: // Dragonmaw Illusion + case 42016: // Dragonmaw Illusion + return area_id == 3759 || area_id == 3966 || area_id == 3939; } return true; diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 7969c375e81..3dc3ddebf42 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -52,7 +52,8 @@ WaypointMovementGenerator<Creature>::LoadPath(Creature &c) i_path = WaypointMgr.GetPath(c.GetDBTableGUIDLow()); if(!i_path) { - sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s(%d) doesn't have waypoint path", c.GetName(), c.GetDBTableGUIDLow()); + sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %d) doesn't have waypoint path", + c.GetName(), c.GetEntry(), c.GetDBTableGUIDLow()); return; } diff --git a/src/game/World.cpp b/src/game/World.cpp index 11236caa59e..ce733a035ec 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -116,10 +116,12 @@ World::World() World::~World() { ///- Empty the kicked session set - for (std::set<WorldSession*>::iterator itr = m_kicked_sessions.begin(); itr != m_kicked_sessions.end(); ++itr) - delete *itr; - - m_kicked_sessions.clear(); + while (!m_sessions.empty()) + { + // not remove from queue, prevent loading new sessions + delete m_sessions.begin()->second; + m_sessions.erase(m_sessions.begin()); + } ///- Empty the WeatherMap for (WeatherMap::iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr) @@ -199,17 +201,26 @@ World::AddSession_ (WorldSession* s) if (!RemoveSession (s->GetAccountId ())) { s->KickPlayer (); - m_kicked_sessions.insert (s); + delete s; // session not added yet in session list, so not listed in queue return; } + // decrease session counts only at not reconnection case + bool decrease_session = true; + // if session already exist, prepare to it deleting at next world update // NOTE - KickPlayer() should be called on "old" in RemoveSession() { - SessionMap::const_iterator old = m_sessions.find(s->GetAccountId ()); + SessionMap::const_iterator old = m_sessions.find(s->GetAccountId ()); - if(old != m_sessions.end()) - m_kicked_sessions.insert (old->second); + if(old != m_sessions.end()) + { + // prevent decrease sessions count if session queued + if(RemoveQueuedPlayer(old->second)) + decrease_session = false; + // not remove replaced session form queue if listed + delete old->second; + } } m_sessions[s->GetAccountId ()] = s; @@ -217,10 +228,11 @@ World::AddSession_ (WorldSession* s) uint32 Sessions = GetActiveAndQueuedSessionCount (); uint32 pLimit = GetPlayerAmountLimit (); uint32 QueueSize = GetQueueSize (); //number of players in the queue - bool inQueue = false; + //so we don't count the user trying to //login as a session and queue the socket that we are using - --Sessions; + if(decrease_session) + --Sessions; if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity () == SEC_PLAYER ) { @@ -264,6 +276,7 @@ int32 World::GetQueuePos(WorldSession* sess) void World::AddQueuedPlayer(WorldSession* sess) { + sess->SetInQueue(true); m_QueuedPlayer.push_back (sess); // The 1st SMSG_AUTH_RESPONSE needs to contain other info too. @@ -279,7 +292,7 @@ void World::AddQueuedPlayer(WorldSession* sess) //sess->SendAuthWaitQue (GetQueuePos (sess)); } -void World::RemoveQueuedPlayer(WorldSession* sess) +bool World::RemoveQueuedPlayer(WorldSession* sess) { // sessions count including queued to remove (if removed_session set) uint32 sessions = GetActiveSessionCount(); @@ -287,16 +300,16 @@ void World::RemoveQueuedPlayer(WorldSession* sess) uint32 position = 1; Queue::iterator iter = m_QueuedPlayer.begin(); - // if session not queued then we need decrease sessions count (Remove socked callet before session removing from session list) - bool decrease_session = true; - // search to remove and count skipped positions + bool found = false; + for(;iter != m_QueuedPlayer.end(); ++iter, ++position) { if(*iter==sess) { + sess->SetInQueue(false); iter = m_QueuedPlayer.erase(iter); - decrease_session = false; // removing queued session + found = true; // removing queued session break; } } @@ -304,15 +317,16 @@ void World::RemoveQueuedPlayer(WorldSession* sess) // iter point to next socked after removed or end() // position store position of removed socket and then new position next socket after removed - // decrease for case session queued for removing - if(decrease_session && sessions) + // if session not queued then we need decrease sessions count + if(!found && sessions) --sessions; // accept first in queue if( (!m_playerLimit || sessions < m_playerLimit) && !m_QueuedPlayer.empty() ) { - WorldSession * socket = m_QueuedPlayer.front(); - socket->SendAuthWaitQue(0); + WorldSession* pop_sess = m_QueuedPlayer.front(); + pop_sess->SetInQueue(false); + pop_sess->SendAuthWaitQue(0); m_QueuedPlayer.pop_front(); // update iter to point first queued socket or end() if queue is empty now @@ -324,6 +338,8 @@ void World::RemoveQueuedPlayer(WorldSession* sess) // iter point to first not updated socket, position store new position for(; iter != m_QueuedPlayer.end(); ++iter, ++position) (*iter)->SendAuthWaitQue(position); + + return found; } /// Find a Weather object by the given zoneid @@ -581,8 +597,6 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_CHARACTERS_CREATING_DISABLED] = sConfig.GetIntDefault("CharactersCreatingDisabled", 0); - m_configs[CONFIG_MAX_WHO] = sConfig.GetIntDefault("MaxWhoListReturns", 49); - m_configs[CONFIG_CHARACTERS_PER_REALM] = sConfig.GetIntDefault("CharactersPerRealm", 10); if(m_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_configs[CONFIG_CHARACTERS_PER_REALM] > 10) { @@ -630,13 +644,70 @@ void World::LoadConfigSettings(bool reload) sLog.outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",m_configs[CONFIG_START_PLAYER_LEVEL],m_configs[CONFIG_MAX_PLAYER_LEVEL],m_configs[CONFIG_MAX_PLAYER_LEVEL]); m_configs[CONFIG_START_PLAYER_LEVEL] = m_configs[CONFIG_MAX_PLAYER_LEVEL]; } + + m_configs[CONFIG_START_PLAYER_MONEY] = sConfig.GetIntDefault("StartPlayerMoney", 0); + if(m_configs[CONFIG_START_PLAYER_MONEY] < 0) + { + sLog.outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",m_configs[CONFIG_START_PLAYER_MONEY],MAX_MONEY_AMOUNT,0); + m_configs[CONFIG_START_PLAYER_MONEY] = 0; + } + else if(m_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT) + { + sLog.outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", + m_configs[CONFIG_START_PLAYER_MONEY],MAX_MONEY_AMOUNT,MAX_MONEY_AMOUNT); + m_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT; + } + m_configs[CONFIG_MAX_HONOR_POINTS] = sConfig.GetIntDefault("MaxHonorPoints", 75000); + if(m_configs[CONFIG_MAX_HONOR_POINTS] < 0) + { + sLog.outError("MaxHonorPoints (%i) can't be negative. Set to 0.",m_configs[CONFIG_MAX_HONOR_POINTS]); + m_configs[CONFIG_MAX_HONOR_POINTS] = 0; + } + + m_configs[CONFIG_START_HONOR_POINTS] = sConfig.GetIntDefault("StartHonorPoints", 0); + if(m_configs[CONFIG_START_HONOR_POINTS] < 0) + { + sLog.outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + m_configs[CONFIG_START_HONOR_POINTS],m_configs[CONFIG_MAX_HONOR_POINTS],0); + m_configs[CONFIG_MAX_HONOR_POINTS] = 0; + } + else if(m_configs[CONFIG_START_HONOR_POINTS] > m_configs[CONFIG_MAX_HONOR_POINTS]) + { + sLog.outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + m_configs[CONFIG_START_HONOR_POINTS],m_configs[CONFIG_MAX_HONOR_POINTS],m_configs[CONFIG_MAX_HONOR_POINTS]); + m_configs[CONFIG_START_HONOR_POINTS] = m_configs[CONFIG_MAX_HONOR_POINTS]; + } + m_configs[CONFIG_MAX_ARENA_POINTS] = sConfig.GetIntDefault("MaxArenaPoints", 5000); + if(m_configs[CONFIG_MAX_ARENA_POINTS] < 0) + { + sLog.outError("MaxArenaPoints (%i) can't be negative. Set to 0.",m_configs[CONFIG_MAX_ARENA_POINTS]); + m_configs[CONFIG_MAX_ARENA_POINTS] = 0; + } + + m_configs[CONFIG_START_ARENA_POINTS] = sConfig.GetIntDefault("StartArenaPoints", 0); + if(m_configs[CONFIG_START_ARENA_POINTS] < 0) + { + sLog.outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + m_configs[CONFIG_START_ARENA_POINTS],m_configs[CONFIG_MAX_ARENA_POINTS],0); + m_configs[CONFIG_MAX_ARENA_POINTS] = 0; + } + else if(m_configs[CONFIG_START_ARENA_POINTS] > m_configs[CONFIG_MAX_ARENA_POINTS]) + { + sLog.outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + m_configs[CONFIG_START_ARENA_POINTS],m_configs[CONFIG_MAX_ARENA_POINTS],m_configs[CONFIG_MAX_ARENA_POINTS]); + m_configs[CONFIG_START_ARENA_POINTS] = m_configs[CONFIG_MAX_ARENA_POINTS]; + } + + m_configs[CONFIG_ALL_TAXI_PATHS] = sConfig.GetBoolDefault("AllFlightPaths", false); m_configs[CONFIG_INSTANCE_IGNORE_LEVEL] = sConfig.GetBoolDefault("Instance.IgnoreLevel", false); m_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfig.GetBoolDefault("Instance.IgnoreRaid", false); m_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfig.GetBoolDefault("Battleground.CastDeserter", true); + m_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfig.GetBoolDefault("Battleground.QueueAnnouncer.Enable", true); + m_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfig.GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false); m_configs[CONFIG_CAST_UNSTUCK] = sConfig.GetBoolDefault("CastUnstuck", true); m_configs[CONFIG_INSTANCE_RESET_TIME_HOUR] = sConfig.GetIntDefault("Instance.ResetTimeHour", 4); @@ -659,6 +730,19 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_GM_IN_WHO_LIST] = sConfig.GetBoolDefault("GM.InWhoList",false); m_configs[CONFIG_GM_LOG_TRADE] = sConfig.GetBoolDefault("GM.LogTrade", false); + m_configs[CONFIG_START_GM_LEVEL] = sConfig.GetIntDefault("GM.StartLevel", 1); + if(m_configs[CONFIG_START_GM_LEVEL] < m_configs[CONFIG_START_PLAYER_LEVEL]) + { + sLog.outError("GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..255. Set to %u.", + m_configs[CONFIG_START_GM_LEVEL],m_configs[CONFIG_START_PLAYER_LEVEL],m_configs[CONFIG_START_PLAYER_LEVEL]); + m_configs[CONFIG_START_GM_LEVEL] = m_configs[CONFIG_START_PLAYER_LEVEL]; + } + else if(m_configs[CONFIG_START_GM_LEVEL] > 255) + { + sLog.outError("GM.StartLevel (%i) must be in range 1..255. Set to %u.",m_configs[CONFIG_START_GM_LEVEL],255); + m_configs[CONFIG_START_GM_LEVEL] = 255; + } + m_configs[CONFIG_GROUP_VISIBILITY] = sConfig.GetIntDefault("Visibility.GroupMode",0); m_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfig.GetIntDefault("MailDeliveryDelay",HOUR); @@ -723,6 +807,10 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY] = sConfig.GetBoolDefault("SaveRespawnTimeImmediately",true); m_configs[CONFIG_WEATHER] = sConfig.GetBoolDefault("ActivateWeather",true); + m_configs[CONFIG_DISABLE_BREATHING] = sConfig.GetIntDefault("DisableWaterBreath", SEC_CONSOLE); + + m_configs[CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL] = sConfig.GetBoolDefault("AlwaysMaxSkillForLevel", false); + if(reload) { uint32 val = sConfig.GetIntDefault("Expansion",1); @@ -751,6 +839,8 @@ void World::LoadConfigSettings(bool reload) if(m_configs[CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF] > 255) m_configs[CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF] = 255; + m_configs[CONFIG_DETECT_POS_COLLISION] = sConfig.GetBoolDefault("DetectPosCollision", true); + m_configs[CONFIG_RESTRICTED_LFG_CHANNEL] = sConfig.GetBoolDefault("Channel.RestrictedLfg", true); m_configs[CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL] = sConfig.GetBoolDefault("Channel.SilentlyGMJoin", false); @@ -777,48 +867,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfig.GetIntDefault("ListenRange.TextEmote", 25); m_configs[CONFIG_LISTEN_RANGE_YELL] = sConfig.GetIntDefault("ListenRange.Yell", 300); - m_configs[CONFIG_PLAYER_START_GOLD] = (uint32)(sConfig.GetFloatDefault("PlayerStart.Gold", 0.0f) * 10000.0f); - - if(m_configs[CONFIG_PLAYER_START_GOLD] > MAX_MONEY_AMOUNT) - m_configs[CONFIG_PLAYER_START_GOLD] = MAX_MONEY_AMOUNT; - - m_configs[CONFIG_PLAYER_START_HONOR] = sConfig.GetIntDefault("PlayerStart.HonorPoints", 0); - if(m_configs[CONFIG_PLAYER_START_HONOR] < 0) - m_configs[CONFIG_PLAYER_START_HONOR] = 0; - - m_configs[CONFIG_PLAYER_START_ARENAPTS] = sConfig.GetIntDefault("PlayerStart.ArenaPoints", 0); - if(m_configs[CONFIG_PLAYER_START_ARENAPTS] < 0) - m_configs[CONFIG_PLAYER_START_ARENAPTS] = 0; - - m_configs[CONFIG_GM_START_LEVEL] = sConfig.GetIntDefault("GamemasterStartLevel", 1); - if(m_configs[CONFIG_GM_START_LEVEL] < 1) - m_configs[CONFIG_GM_START_LEVEL] = 1; - - m_configs[CONFIG_INSTANT_LOGOUT] = sConfig.GetBoolDefault("PlayerInstantLogout", false); - m_configs[CONFIG_BG_START_MUSIC] = sConfig.GetBoolDefault("MusicInBattleground", false); - m_configs[CONFIG_START_ALL_SPELLS] = sConfig.GetBoolDefault("PlayerStart.AllSpells", false); - m_configs[CONFIG_HONOR_AFTER_DUEL] = sConfig.GetIntDefault("HonorPointsAfterDuel", 0); - if(m_configs[CONFIG_HONOR_AFTER_DUEL] < 0) - m_configs[CONFIG_HONOR_AFTER_DUEL]= 0; - m_configs[CONFIG_START_ALL_EXPLORED] = sConfig.GetBoolDefault("PlayerStart.MapsExplored", false); - m_configs[CONFIG_DISABLE_BREATHING] = sConfig.GetBoolDefault("DisableWaterBreath", false); - m_configs[CONFIG_START_ALL_REP] = sConfig.GetBoolDefault("PlayerStart.AllReputation", false); - m_configs[CONFIG_ALWAYS_MAXSKILL] = sConfig.GetBoolDefault("AlwaysMaxWeaponSkill", false); - m_configs[CONFIG_START_ALL_TAXI] = sConfig.GetBoolDefault("PlayerStart.AllFlightPaths", false); - m_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfig.GetBoolDefault("PvPToken.Enable", false); - m_configs[CONFIG_PVP_TOKEN_MAP_TYPE] = sConfig.GetIntDefault("PvPToken.MapAllowType", 4); - m_configs[CONFIG_PVP_TOKEN_ID] = sConfig.GetIntDefault("PvPToken.ItemID", 29434); - m_configs[CONFIG_PVP_TOKEN_COUNT] = sConfig.GetIntDefault("PvPToken.ItemCount", 1); - if(m_configs[CONFIG_PVP_TOKEN_COUNT] < 1) - m_configs[CONFIG_PVP_TOKEN_COUNT] = 1; - m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false); - - m_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfig.GetIntDefault("Arena.MaxRatingDifference", 0); - m_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfig.GetIntDefault("Arena.RatingDiscardTimer",300000); - m_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS] = sConfig.GetBoolDefault("Arena.AutoDistributePoints", false); - m_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS] = sConfig.GetIntDefault("Arena.AutoDistributeInterval", 7); - - m_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfig.GetIntDefault("BattleGround.PrematureFinishTimer", 0); + m_configs[CONFIG_INSTANT_LOGOUT] = sConfig.GetIntDefault("InstantLogout", SEC_MODERATOR); m_VisibleUnitGreyDistance = sConfig.GetFloatDefault("Visibility.Distance.Grey.Unit", 1); if(m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE) @@ -889,6 +938,63 @@ void World::LoadConfigSettings(bool reload) sLog.outString("Using DataDir %s",m_dataPath.c_str()); } + bool enableLOS = sConfig.GetBoolDefault("vmap.enableLOS", false); + bool enableHeight = sConfig.GetBoolDefault("vmap.enableHeight", false); + std::string ignoreMapIds = sConfig.GetStringDefault("vmap.ignoreMapIds", ""); + std::string ignoreSpellIds = sConfig.GetStringDefault("vmap.ignoreSpellIds", ""); + VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS); + VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight); + VMAP::VMapFactory::createOrGetVMapManager()->preventMapsFromBeingUsed(ignoreMapIds.c_str()); + VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str()); + sLog.outString( "WORLD: VMap support included. LineOfSight:%i, getHeight:%i",enableLOS, enableHeight); + sLog.outString( "WORLD: VMap data directory is: %svmaps",m_dataPath.c_str()); + sLog.outString( "WORLD: VMap config keys are: vmap.enableLOS, vmap.enableHeight, vmap.ignoreMapIds, vmap.ignoreSpellIds"); + + + m_configs[CONFIG_MAX_WHO] = sConfig.GetIntDefault("MaxWhoListReturns", 49); + + m_configs[CONFIG_PLAYER_START_GOLD] = (uint32)(sConfig.GetFloatDefault("PlayerStart.Gold", 0.0f) * 10000.0f); + + if(m_configs[CONFIG_PLAYER_START_GOLD] > MAX_MONEY_AMOUNT) + m_configs[CONFIG_PLAYER_START_GOLD] = MAX_MONEY_AMOUNT; + + m_configs[CONFIG_PLAYER_START_HONOR] = sConfig.GetIntDefault("PlayerStart.HonorPoints", 0); + if(m_configs[CONFIG_PLAYER_START_HONOR] < 0) + m_configs[CONFIG_PLAYER_START_HONOR] = 0; + + m_configs[CONFIG_PLAYER_START_ARENAPTS] = sConfig.GetIntDefault("PlayerStart.ArenaPoints", 0); + if(m_configs[CONFIG_PLAYER_START_ARENAPTS] < 0) + m_configs[CONFIG_PLAYER_START_ARENAPTS] = 0; + + m_configs[CONFIG_GM_START_LEVEL] = sConfig.GetIntDefault("GamemasterStartLevel", 1); + if(m_configs[CONFIG_GM_START_LEVEL] < 1) + m_configs[CONFIG_GM_START_LEVEL] = 1; + + m_configs[CONFIG_BG_START_MUSIC] = sConfig.GetBoolDefault("MusicInBattleground", false); + m_configs[CONFIG_START_ALL_SPELLS] = sConfig.GetBoolDefault("PlayerStart.AllSpells", false); + m_configs[CONFIG_HONOR_AFTER_DUEL] = sConfig.GetIntDefault("HonorPointsAfterDuel", 0); + if(m_configs[CONFIG_HONOR_AFTER_DUEL] < 0) + m_configs[CONFIG_HONOR_AFTER_DUEL]= 0; + m_configs[CONFIG_START_ALL_EXPLORED] = sConfig.GetBoolDefault("PlayerStart.MapsExplored", false); + m_configs[CONFIG_DISABLE_BREATHING] = sConfig.GetBoolDefault("DisableWaterBreath", false); + m_configs[CONFIG_START_ALL_REP] = sConfig.GetBoolDefault("PlayerStart.AllReputation", false); + m_configs[CONFIG_ALWAYS_MAXSKILL] = sConfig.GetBoolDefault("AlwaysMaxWeaponSkill", false); + m_configs[CONFIG_START_ALL_TAXI] = sConfig.GetBoolDefault("PlayerStart.AllFlightPaths", false); + m_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfig.GetBoolDefault("PvPToken.Enable", false); + m_configs[CONFIG_PVP_TOKEN_MAP_TYPE] = sConfig.GetIntDefault("PvPToken.MapAllowType", 4); + m_configs[CONFIG_PVP_TOKEN_ID] = sConfig.GetIntDefault("PvPToken.ItemID", 29434); + m_configs[CONFIG_PVP_TOKEN_COUNT] = sConfig.GetIntDefault("PvPToken.ItemCount", 1); + if(m_configs[CONFIG_PVP_TOKEN_COUNT] < 1) + m_configs[CONFIG_PVP_TOKEN_COUNT] = 1; + m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false); + + m_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfig.GetIntDefault("Arena.MaxRatingDifference", 0); + m_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfig.GetIntDefault("Arena.RatingDiscardTimer",300000); + m_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS] = sConfig.GetBoolDefault("Arena.AutoDistributePoints", false); + m_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS] = sConfig.GetIntDefault("Arena.AutoDistributeInterval", 7); + + m_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfig.GetIntDefault("BattleGround.PrematureFinishTimer", 0); + std::string forbiddenmaps = sConfig.GetStringDefault("ForbiddenMaps", ""); char * forbiddenMaps = new char[forbiddenmaps.length() + 1]; forbiddenMaps[forbiddenmaps.length()] = 0; @@ -902,18 +1008,6 @@ void World::LoadConfigSettings(bool reload) token = strtok(NULL,delim); } delete[] forbiddenMaps; - - bool enableLOS = sConfig.GetBoolDefault("vmap.enableLOS", false); - bool enableHeight = sConfig.GetBoolDefault("vmap.enableHeight", false); - std::string ignoreMapIds = sConfig.GetStringDefault("vmap.ignoreMapIds", ""); - std::string ignoreSpellIds = sConfig.GetStringDefault("vmap.ignoreSpellIds", ""); - VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS); - VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight); - VMAP::VMapFactory::createOrGetVMapManager()->preventMapsFromBeingUsed(ignoreMapIds.c_str()); - VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str()); - sLog.outString( "WORLD: VMap support included. LineOfSight:%i, getHeight:%i",enableLOS, enableHeight); - sLog.outString( "WORLD: VMap data directory is: %svmaps",m_dataPath.c_str()); - sLog.outString( "WORLD: VMap config keys are: vmap.enableLOS, vmap.enableHeight, vmap.ignoreMapIds, vmap.ignoreSpellIds"); } /// Initialize the World @@ -2238,6 +2332,8 @@ void World::SendZoneText(uint32 zone, const char* text, WorldSession *self, uint /// Kick (and save) all players void World::KickAll() { + m_QueuedPlayer.clear(); // prevent send queue update packet and login queued sessions + // session not removed at kick and will removed in next update tick for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) itr->second->KickPlayer(); @@ -2252,18 +2348,6 @@ void World::KickAllLess(AccountTypes sec) itr->second->KickPlayer(); } -/// Kick all queued players -void World::KickAllQueued() -{ - // session not removed at kick and will removed in next update tick - //TODO here -// for (Queue::iterator itr = m_QueuedPlayer.begin(); itr != m_QueuedPlayer.end(); ++itr) -// if(WorldSession* session = (*itr)->GetSession()) -// session->KickPlayer(); - - m_QueuedPlayer.empty(); -} - /// Kick (and save) the designated player bool World::KickPlayer(std::string playerName) { @@ -2494,19 +2578,12 @@ void World::SendServerMessage(uint32 type, const char *text, Player* player) void World::UpdateSessions( time_t diff ) { + ///- Add new sessions while(!addSessQueue.empty()) { - WorldSession* sess = addSessQueue.next (); - AddSession_ (sess); - } - - ///- Delete kicked sessions at add new session - for (std::set<WorldSession*>::iterator itr = m_kicked_sessions.begin(); itr != m_kicked_sessions.end(); ++itr) - { - RemoveQueuedPlayer (*itr); - delete *itr; + WorldSession* sess = addSessQueue.next (); + AddSession_ (sess); } - m_kicked_sessions.clear(); ///- Then send an update signal to remaining ones for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next) diff --git a/src/game/World.h b/src/game/World.h index 2be2360728d..3784f0a3cf0 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -100,14 +100,16 @@ enum WorldConfigs CONFIG_STRICT_CHARTER_NAMES, CONFIG_STRICT_PET_NAMES, CONFIG_CHARACTERS_CREATING_DISABLED, - CONFIG_MAX_WHO, CONFIG_CHARACTERS_PER_ACCOUNT, CONFIG_CHARACTERS_PER_REALM, CONFIG_SKIP_CINEMATICS, CONFIG_MAX_PLAYER_LEVEL, CONFIG_START_PLAYER_LEVEL, + CONFIG_START_PLAYER_MONEY, CONFIG_MAX_HONOR_POINTS, + CONFIG_START_HONOR_POINTS, CONFIG_MAX_ARENA_POINTS, + CONFIG_START_ARENA_POINTS, CONFIG_INSTANCE_IGNORE_LEVEL, CONFIG_INSTANCE_IGNORE_RAID, CONFIG_BATTLEGROUND_CAST_DESERTER, @@ -125,6 +127,7 @@ enum WorldConfigs CONFIG_GM_IN_GM_LIST, CONFIG_GM_IN_WHO_LIST, CONFIG_GM_LOG_TRADE, + CONFIG_START_GM_LEVEL, CONFIG_GROUP_VISIBILITY, CONFIG_MAIL_DELIVERY_DELAY, CONFIG_UPTIME_UPDATE, @@ -141,6 +144,7 @@ enum WorldConfigs CONFIG_SKILL_GAIN_WEAPON, CONFIG_MAX_OVERSPEED_PINGS, CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY, + CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL, CONFIG_WEATHER, CONFIG_EXPANSION, CONFIG_CHATFLOOD_MESSAGE_COUNT, @@ -166,17 +170,27 @@ enum WorldConfigs CONFIG_DEATH_SICKNESS_LEVEL, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, + CONFIG_THREAT_RADIUS, + CONFIG_INSTANT_LOGOUT, + CONFIG_DISABLE_BREATHING, + CONFIG_ALL_TAXI_PATHS, + CONFIG_DECLINED_NAMES_USED, + CONFIG_LISTEN_RANGE_SAY, + CONFIG_LISTEN_RANGE_TEXTEMOTE, + CONFIG_LISTEN_RANGE_YELL, + CONFIG_VALUE_COUNT, + CONFIG_MAX_WHO, CONFIG_PLAYER_START_GOLD, CONFIG_PLAYER_START_HONOR, CONFIG_PLAYER_START_ARENAPTS, CONFIG_GM_START_LEVEL, - CONFIG_INSTANT_LOGOUT, + CONFIG_BG_START_MUSIC, CONFIG_START_ALL_SPELLS, CONFIG_HONOR_AFTER_DUEL, CONFIG_START_ALL_EXPLORED, - CONFIG_DISABLE_BREATHING, + CONFIG_START_ALL_REP, CONFIG_ALWAYS_MAXSKILL, CONFIG_START_ALL_TAXI, @@ -186,17 +200,11 @@ enum WorldConfigs CONFIG_PVP_TOKEN_COUNT, CONFIG_NO_RESET_TALENT_COST, - CONFIG_THREAT_RADIUS, - CONFIG_DECLINED_NAMES_USED, - CONFIG_LISTEN_RANGE_SAY, - CONFIG_LISTEN_RANGE_TEXTEMOTE, - CONFIG_LISTEN_RANGE_YELL, CONFIG_ARENA_MAX_RATING_DIFFERENCE, CONFIG_ARENA_RATING_DISCARD_TIMER, CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS, CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS, CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER, - CONFIG_VALUE_COUNT }; /// Server rates @@ -378,7 +386,7 @@ class World //player Queue typedef std::list<WorldSession*> Queue; void AddQueuedPlayer(WorldSession*); - void RemoveQueuedPlayer(WorldSession*); + bool RemoveQueuedPlayer(WorldSession* session); int32 GetQueuePos(WorldSession*); uint32 GetQueueSize() const { return m_QueuedPlayer.size(); } @@ -461,7 +469,6 @@ class World bool KickPlayer(std::string playerName); void KickAll(); void KickAllLess(AccountTypes sec); - void KickAllQueued(); BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); bool RemoveBanAccount(BanMode mode, std::string nameOrIP); @@ -523,7 +530,6 @@ class World WeatherMap m_weathers; typedef UNORDERED_MAP<uint32, WorldSession*> SessionMap; SessionMap m_sessions; - std::set<WorldSession*> m_kicked_sessions; uint32 m_maxActiveSessionCount; uint32 m_maxQueuedSessionCount; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 69f1598d743..eeb7d41efb6 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -48,7 +48,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expan LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)), -_logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0) +_logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0) { if (sock) { @@ -208,6 +208,13 @@ bool WorldSession::Update(uint32 /*diff*/) (this->*opHandle.handler)(*packet); break; case STATUS_AUTHED: + // prevent cheating with skip queue wait + if(m_inQueue) + { + logUnexpectedOpcode(packet, "the player not pass queue yet"); + break; + } + m_playerRecentlyLogout = false; (this->*opHandle.handler)(*packet); break; diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 27391ae9618..c9f98765092 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -98,6 +98,9 @@ class TRINITY_DLL_SPEC WorldSession void SetPlayer(Player *plr) { _player = plr; } uint8 Expansion() const { return m_expansion; } + /// Session in auth.queue currently + void SetInQueue(bool state) { m_inQueue = state; } + /// Is the user engaged in a log out process? bool isLogingOut() const { return _logoutTime || m_playerLogout; } @@ -639,6 +642,7 @@ class TRINITY_DLL_SPEC WorldSession uint8 m_expansion; time_t _logoutTime; + bool m_inQueue; // session wait in auth.queue bool m_playerLoading; // code processed in LoginPlayer bool m_playerLogout; // code processed in LogoutPlayer bool m_playerRecentlyLogout; diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp index b337acb1bd7..03536daf738 100644 --- a/src/shared/Database/DBCStores.cpp +++ b/src/shared/Database/DBCStores.cpp @@ -497,13 +497,22 @@ uint32 GetTalentSpellCost(uint32 spellId) return 0; } -AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id) +int32 GetAreaFlagByAreaID(uint32 area_id) { AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id); if(i == sAreaFlagByAreaID.end()) + return -1; + + return i->second; +} + +AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id) +{ + int32 areaflag = GetAreaFlagByAreaID(area_id); + if(areaflag < 0) return NULL; - return sAreaStore.LookupEntry(i->second); + return sAreaStore.LookupEntry(areaflag ); } AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id) diff --git a/src/shared/Database/DBCStores.h b/src/shared/Database/DBCStores.h index eb824e331cc..399b94213fe 100644 --- a/src/shared/Database/DBCStores.h +++ b/src/shared/Database/DBCStores.h @@ -35,6 +35,7 @@ char* GetPetName(uint32 petfamily, uint32 dbclang); uint32 GetTalentSpellCost(uint32 spellId); TalentSpellPos const* GetTalentSpellPos(uint32 spellId); +int32 GetAreaFlagByAreaID(uint32 area_id); // -1 if not found AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id); AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id); uint32 GetAreaFlagByMapId(uint32 mapid); diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp index 0af892819b6..7fe2ab784a6 100644 --- a/src/trinitycore/CliRunnable.cpp +++ b/src/trinitycore/CliRunnable.cpp @@ -29,7 +29,6 @@ #include "ScriptCalls.h" #include "ObjectMgr.h" #include "WorldSession.h" -#include "SystemConfig.h" #include "Config/ConfigEnv.h" #include "Util.h" #include "AccountMgr.h" @@ -41,8 +40,7 @@ void utf8print(const char* str) { #if PLATFORM == PLATFORM_WINDOWS -#define UTF8ZPRINTF utf8printf - wchar_t wtemp_buf[6000]; + wchar_t wtemp_buf[6000]; size_t wtemp_len = 6000-1; if(!Utf8toWStr(str,strlen(str),wtemp_buf,wtemp_len)) return; diff --git a/src/trinitycore/WorldRunnable.cpp b/src/trinitycore/WorldRunnable.cpp index 5592b1d2064..b57dbc6bce2 100644 --- a/src/trinitycore/WorldRunnable.cpp +++ b/src/trinitycore/WorldRunnable.cpp @@ -74,7 +74,6 @@ void WorldRunnable::run() prevSleepTime = 0; } - sWorld.KickAllQueued(); // kick all queued players (and prevent its login at kick in game players) sWorld.KickAll(); // save and kick all players sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist index f9233dff65e..c957b894d97 100644 --- a/src/trinitycore/trinitycore.conf.dist +++ b/src/trinitycore/trinitycore.conf.dist @@ -17,7 +17,7 @@ ConfVersion=2008080101 # LogsDir # Logs directory setting. # Important: Logs dir must exists, or all logs need to be disabled -# Default: "" - no log directory prefix, if used log names isn't absolute path +# Default: "" - no log directory prefix, if used log names isn't absolute path # then logs will be stored in current directory for run program. # # @@ -82,7 +82,7 @@ EAIErrorLevel = 2 # # Compression # Compression level for update packages sent to client (1..9) -# Default: 1 (speed) +# Default: 1 (speed) # 9 (best compression) # # PlayerLimit @@ -143,15 +143,20 @@ EAIErrorLevel = 2 # These spells are ignored for LoS calculation # List of ids with delimiter ',' # +# DetectPosCollision +# Check final move position, summon position, etc for visible collision with other objects or +# wall (wall only if vmaps are enabled) +# Default: 1 (enable, required more CPU power usage) +# 0 (disable, less nice position selection but will less CPU power usage) # # TargetPosRecalculateRange -# Max distance from movement target point (+moving unit size) and targeted object (+size) +# Max distance from movement target point (+moving unit size) and targeted object (+size) # after that new target movmeent point calculated. Max: melee attack range (5), min: contact range (0.5) # More distance let have better performence, less distance let have more sensitive reaction at target move. # Default: 1.5 # # UpdateUptimeInterval -# Update realm uptime period in minutes (for save data in 'uptime' table). Must be > 0 +# Update realm uptime period in minutes (for save data in 'uptime' table). Must be > 0 # Default: 10 (minutes) # # MaxCoreStuckTime @@ -183,6 +188,7 @@ vmap.enableLOS = 0 vmap.enableHeight = 0 vmap.ignoreMapIds = "369" vmap.ignoreSpellIds = "7720" +DetectPosCollision = 1 TargetPosRecalculateRange = 1.5 UpdateUptimeInterval = 10 MaxCoreStuckTime = 0 @@ -215,7 +221,7 @@ AddonChannel = 1 # # LogFile # Logfile name -# Default: "server.log" +# Default: "Server.log" # "" - Empty name disable creating log file # # LogTimestamp @@ -237,15 +243,15 @@ AddonChannel = 1 # # WorldLogFile # Packet logging file for the worldserver -# Default: "" +# Default: "world.log" # # DBErrorLogFile # Log file of DB errors detected at server run -# Default: "db_errors.log" +# Default: "DBErrors.log" # # CharLogFile # Character operations logfile name -# Default: "characters.log" +# Default: "Char.log" # "" - Empty name disable creating log file # # CharLogTimestamp @@ -255,10 +261,10 @@ AddonChannel = 1 # # CharLogDump # Write character dump before deleting in Char.log -# For restoration, cut character data from log starting from +# For restoration, cut character data from log starting from # line == START DUMP == to line == END DUMP == (without its) in file and load it using loadpdump command # Default: 0 - don't include dumping chars to log -# 1 - include dumping chars to log +# 1 - include dumping chars to log # # GmLogFile # Log file of gm commands @@ -266,18 +272,25 @@ AddonChannel = 1 # "" - Empty name for disable # # GmLogTimestamp -# Logfile with timestamp of server start in name +# GM Logfile with timestamp of server start in name # Default: 0 - no timestamp in name # 1 - add timestamp in name in form Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext # +# GmLogPerAccount +# GM Logfiles with GM account id (Note: logs not created if GmLogFile not set) +# Default: 0 - add gm log data to single log file +# 1 - add gm log data to account specific log files with name +# in form Logname_#ID_YYYY-MM-DD_HH-MM-SS.Ext +# or form Logname_#ID.Ext +# # RaLogFile # Log file of RA commands -# Default: "ra_commands.log" +# Default: "Ra.log" # "" - Empty name for disable # # LogColors -# Color for messages (format "normal_color details_color debug_color error_color) -# Colors: 0 - BLACK, 1 - RED, 2 - GREEN, 3 - BROWN, 4 - BLUE, 5 - MAGENTA, 6 - CYAN, 7 - GREY, +# Color for messages (format "normal_color details_color debug_color error_color") +# Colors: 0 - BLACK, 1 - RED, 2 - GREEN, 3 - BROWN, 4 - BLUE, 5 - MAGENTA, 6 - CYAN, 7 - GREY, # 8 - YELLOW, 9 - LRED, 10 - LGREEN, 11 - LBLUE, 12 - LMAGENTA, 13 - LCYAN, 14 - WHITE # Default: "" - none colors # Example: "13 7 11 9" @@ -288,7 +301,7 @@ LogSQL = 1 PidFile = "" LogLevel = 1 LogTime = 0 -LogFile = "server.log" +LogFile = "Server.log" LogTimestamp = 0 LogFileLevel = 0 LogFilter_TransportMoves = 1 @@ -301,6 +314,7 @@ CharLogTimestamp = 0 CharLogDump = 0 GmLogFile = "gm_commands.log" GmLogTimestamp = 0 +GmLogPerAccount = 0 RaLogFile = "ra_commands.log" LogColors = "" @@ -310,47 +324,47 @@ LogColors = "" # GameType # Server realm style # 0 = NORMAL;1 = PVP; 4 = NORMAL; 6 = RP; 8 = RPPVP -# also custom type: 16 FFA_PVP (free for all pvp mode like arena PvP in all zones except rest +# also custom type: 16 FFA_PVP (free for all pvp mode like arena PvP in all zones except rest # activated places and sanctuaries) # # RealmZone # Server realm zone (set allowed alphabet in character names/etc). See also Strict*Names options. # -# 1 Development - any language (Default) -# 2 United States - extended-Latin -# 3 Oceanic - extended-Latin -# 4 Latin America - extended-Latin -# 5 Tournament - basic-Latin at create, any at login -# 6 Korea - East-Asian -# 7 Tournament - basic-Latin at create, any at login -# 8 English - extended-Latin -# 9 German - extended-Latin -# 10 French - extended-Latin -# 11 Spanish - extended-Latin -# 12 Russian - Cyrillic -# 13 Tournament - basic-Latin at create, any at login -# 14 Taiwan - East-Asian -# 15 Tournament - basic-Latin at create, any at login -# 16 China - East-Asian -# 17 CN1 - basic-Latin at create, any at login -# 18 CN2 - basic-Latin at create, any at login -# 19 CN3 - basic-Latin at create, any at login -# 20 CN4 - basic-Latin at create, any at login -# 21 CN5 - basic-Latin at create, any at login -# 22 CN6 - basic-Latin at create, any at login -# 23 CN7 - basic-Latin at create, any at login -# 24 CN8 - basic-Latin at create, any at login -# 25 Tournament - basic-Latin at create, any at login -# 26 Test Server - any language -# 27 Tournament - basic-Latin at create, any at login -# 28 QA Server - any language -# 29 CN9 - basic-Latin at create, any at login +# 1 Development - any language (Default) +# 2 United States - extended-Latin +# 3 Oceanic - extended-Latin +# 4 Latin America - extended-Latin +# 5 Tournament - basic-Latin at create, any at login +# 6 Korea - East-Asian +# 7 Tournament - basic-Latin at create, any at login +# 8 English - extended-Latin +# 9 German - extended-Latin +# 10 French - extended-Latin +# 11 Spanish - extended-Latin +# 12 Russian - Cyrillic +# 13 Tournament - basic-Latin at create, any at login +# 14 Taiwan - East-Asian +# 15 Tournament - basic-Latin at create, any at login +# 16 China - East-Asian +# 17 CN1 - basic-Latin at create, any at login +# 18 CN2 - basic-Latin at create, any at login +# 19 CN3 - basic-Latin at create, any at login +# 20 CN4 - basic-Latin at create, any at login +# 21 CN5 - basic-Latin at create, any at login +# 22 CN6 - basic-Latin at create, any at login +# 23 CN7 - basic-Latin at create, any at login +# 24 CN8 - basic-Latin at create, any at login +# 25 Tournament - basic-Latin at create, any at login +# 26 Test Server - any language +# 27 Tournament - basic-Latin at create, any at login +# 28 QA Server - any language +# 29 CN9 - basic-Latin at create, any at login # # Expansion -# Allow server use content from expansion -# 2 - check expansion 2 maps existence, and if client support expansion 2 and account have +# Allow server use content from expansion +# 2 - check expansion 2 maps existence, and if client support expansion 2 and account have # expansion 2 setting then allow visit expansion 2 maps, allow create new class character) -# Default: 1 - check expansion 1 maps existence, and if client support expansion 1 and account have +# Default: 1 - check expansion 1 maps existence, and if client support expansion 1 and account have # expansion 1 setting then allow visit expansion 1 maps, allow create new races character) # 0 - not check expansion maps existence, not allow wisit its, not allow create new race or new class # characters, ignore account expansion setting) @@ -361,16 +375,16 @@ LogColors = "" # 8 = Russian; 255 = Auto Detect (Default) # # DeclinedNames -# Allow russian clients to set and use declined names -# Default: 0 - do not use declined names, except when the Russian RealmZone is set -# 1 - use declined names +# Allow russian clients to set and use declined names +# Default: 0 - do not use declined names, except when the Russian RealmZone is set +# 1 - use declined names # # StrictPlayerNames # Limit player name to language specific symbols set, not allow create characters, and set rename request and disconnect at not allowed symbols name # Default: 0 disable (but limited server timezone dependent client check) # 1 basic latin characters (strict) -# 2 realm zone specific (strict). See RealmZone setting. -# Note: In any case if you want correctly see character name at client this client must have apporopriate fonts +# 2 realm zone specific (strict). See RealmZone setting. +# Note: In any case if you want correctly see character name at client this client must have apporopriate fonts # (included in client by default, with active official localization or custom localization fonts in clientdir/Fonts). # 3 basic latin characters + server timezone specific # @@ -378,8 +392,8 @@ LogColors = "" # Limit guild/arena team charter names to language specific symbols set, not allow create charters with allowed symbols in name # Default: 0 disable # 1 basic latin characters (strict) -# 2 realm zone specific (strict). See RealmZone setting. -# Note: In any case if you want correctly see character name at client this client must have apporopriate fonts +# 2 realm zone specific (strict). See RealmZone setting. +# Note: In any case if you want correctly see character name at client this client must have apporopriate fonts # (included in client by default, with active official localization or custom localization fonts in clientdir/Fonts). # 3 basic latin characters + server timezone specific # @@ -387,8 +401,8 @@ LogColors = "" # Limit pet names to language specific symbols set # Default: 0 disable # 1 basic latin characters (strict) -# 2 realm zone specific (strict). See RealmZone setting. -# Note: In any case if you want correctly see character name at client this client must have apporopriate fonts +# 2 realm zone specific (strict). See RealmZone setting. +# Note: In any case if you want correctly see character name at client this client must have apporopriate fonts # (included in client by default, with active official localization or custom localization fonts in clientdir/Fonts). # 3 basic latin characters + server timezone specific # @@ -406,7 +420,7 @@ LogColors = "" # CharactersPerAccount # Limit numbers of characters per account (at all realms). # Note: this setting limit character creating at _current_ realm base at characters amount at all realms -# Default: 50 +# Default: 50 # The number must be >= CharactersPerRealm # # CharactersPerRealm @@ -425,17 +439,48 @@ LogColors = "" # Change not recommended # Default: 70 # +# StartPlayerLevel +# Staring level that have character at creating (in range 1 to MaxPlayerLevel) +# Default: 1 +# +# StartPlayerMoney +# Amount of money that new players will start with. +# If you want to start with silver, use for example 100 (100 copper = 1 silver) +# Default: 0 +# # MaxHonorPoints # Max honor points that player can have. # Default: 75000 # +# StartHonorPoints +# Amount of honor that new players will start with +# Default: 0 +# # MaxArenaPoints # Max arena points that player can have. # Default: 5000 # -# StartPlayerLevel -# Staring level that have character at creating (in range 1 to MaxPlayerLevel) -# Default: 1 +# StartArenaPoints +# Amount of arena points that new players will start with +# Default: 0 +# +# InstantLogout +# Enable or disable instant logout for security level (0..4) or high (NOT in combat/while dueling/while falling) +# Default: 1 (Mods/GMs/Admins) +# +# DisableWaterBreath +# Disable/enable waterbreathing for security level (0..4) or high +# Default: 4 (None) +# +# AllFlightPaths +# Players will start with all flight paths (Note: ALL flight paths, not only player's team) +# Default: 0 (true) +# 1 (false) +# +# AlwaysMaxSkillForLevel +# Players will automatically gain max level dependent (weapon/defense) skill when logging in, leveling up etc. +# Default: 0 (true) +# 1 (false) # # ActivateWeather # Activate weather system @@ -447,6 +492,16 @@ LogColors = "" # Default: 1 (true) # 0 (false) # +# Battleground.QueueAnnouncer.Enable +# Enable queue announcer posting to chat +# Default: 1 (true) +# 0 (false) +# +# Battleground.QueueAnnouncer.PlayerOnly +# Enable queue announcer posting to chat +# Default: 0 (false) +# 1 (true) +# # CastUnstuck # Allow cast or not Unstuck spell at .start or client Help option use # Default: 1 (true) @@ -472,16 +527,16 @@ LogColors = "" # 0 (instance maps are kept in memory until they are reset) # # Quests.LowLevelHideDiff -# Quest level difference to hide for player low level quests: +# Quest level difference to hide for player low level quests: # if player_level > quest_level + LowLevelQuestsHideDiff then quest "!" mark not show for quest giver # Default: 4 -# -1 (show all available quests marks) +# -1 (show all available quests marks) # # Quests.HighLevelHideDiff -# Quest level difference to hide for player high level quests: +# Quest level difference to hide for player high level quests: # if player_level < quest_min_level - HighLevelQuestsHideDiff then quest "!" mark not show for quest giver # Default: 7 -# -1 (show all available quests marks) +# -1 (show all available quests marks) # # MaxPrimaryTradeSkill # Max count that player can learn the primary trade skill. @@ -533,11 +588,20 @@ CharactersPerAccount = 50 CharactersPerRealm = 10 SkipCinematics = 0 MaxPlayerLevel = 70 +StartPlayerLevel = 1 +StartPlayerMoney = 0 MaxHonorPoints = 75000 +StartHonorPoints = 0 MaxArenaPoints = 5000 -StartPlayerLevel = 1 +StartArenaPoints = 0 +InstantLogout = 1 +DisableWaterBreath = 4 +AllFlightPaths = 0 +AlwaysMaxSkillForLevel = 0 ActivateWeather = 1 Battleground.CastDeserter = 1 +Battleground.QueueAnnouncer.Enable = 1 +Battleground.QueueAnnouncer.PlayerOnly = 0 CastUnstuck = 1 Instance.IgnoreLevel = 0 Instance.IgnoreRaid = 0 @@ -568,7 +632,7 @@ Motd = "Welcome to a Trinity Core server." # AllowTwoSide.Interaction.Guild # AllowTwoSide.Interaction.Auction # AllowTwoSide.Interaction.Mail -# Allow or not common :chat(say,yell);channel(chat)group(join)guild(join);merge all auction houses for players from +# Allow or not common :chat(say,yell);channel(chat)group(join)guild(join);merge all auction houses for players from # different teams, send mail to different team. # Default: 0 (Not allowed) # 1 (Allowed) @@ -584,7 +648,7 @@ Motd = "Welcome to a Trinity Core server." # 1 (Allowed) # # TalentsInspecting -# Allow other players see character talents in inspect dialog (Characters in Gamemaster mode can +# Allow other players see character talents in inspect dialog (Characters in Gamemaster mode can # inspect talents always) # Default: 1 (allow) # 0 (not allow) @@ -616,8 +680,8 @@ TalentsInspecting = 1 # 1.5 - 150% # 0 - off (0%) # -# CreatureFamilyAssistenceRadius -# Creature family assistence radius +# CreatureFamilyAssistanceRadius +# Creature family assistance radius # Default: 10 # 0 - off # @@ -665,11 +729,23 @@ TalentsInspecting = 1 # Creature Health Ammount Modifier. # Examples: 2 - creatures have 2x health, 1.7 - 1.7x. # +# ListenRange.Say +# Distance from player to listen text that creature (or other world object) say +# Default: 25 +# +# ListenRange.TextEmote +# Distance from player to listen textemote that creature (or other world object) say +# Default: 25 +# +# ListenRange.Yell +# Distance from player to listen text that creature (or other world object) yell +# Default: 300 +# ################################################################################################################### ThreatRadius = 100 Rate.Creature.Aggro = 1 -CreatureFamilyAssistenceRadius = 10 +CreatureFamilyAssistanceRadius = 10 CreatureFamilyAssistanceDelay = 1500 WorldBossLevelDiff = 3 Corpse.Decay.NORMAL = 60 @@ -693,13 +769,16 @@ Rate.Creature.Elite.Elite.HP = 1 Rate.Creature.Elite.RAREELITE.HP = 1 Rate.Creature.Elite.WORLDBOSS.HP = 1 Rate.Creature.Elite.RARE.HP = 1 +ListenRange.Say = 40 +ListenRange.TextEmote = 40 +ListenRange.Yell = 300 ################################################################################################################### # CHAT SETTINGS # # ChatFakeMessagePreventing # Chat protection from creating fake messages using a lot spaces (other invisible symbols), -# not applied to addon language messages, but can prevent working old addons +# not applied to addon language messages, but can prevent working old addons # that use normal languages for sending data to another clients. # Default: 0 (disible fake messages preventing) # 1 (enabled fake messages preventing) @@ -739,10 +818,29 @@ Channel.SilentlyGMJoin = 0 ################################################################################################################### # GAME MASTER SETTINGS # +# GM.LoginState +# GM mode at login +# Default: 2 (last save state) +# 0 (disable) +# 1 (enable) +# +# GM.AcceptTickets +# Is GM accepting tickets from player by default or not. +# Default: 2 (last save state) +# 0 (disable) +# 1 (enable) +# +# GM.Chat +# GM chat mode at login +# Default: 2 (last save state) +# 0 (disable) +# 1 (enable) +# # GM.WhisperingTo # Is GM accepting whispers from player by default or not. -# Default: 0 (false) -# 1 (true) +# Default: 2 (last save state) +# 0 (disable) +# 1 (enable) # # GM.InGMList # Is GM showed in GM list (if visible) in non-GM state (.gmoff) @@ -754,24 +852,25 @@ Channel.SilentlyGMJoin = 0 # Default: 0 (false) # 1 (true) # -# GM.LoginState -# GM mode at login -# Default: 2 (last save state) -# 0 (disable) -# 1 (enable) -# # GM.LogTrade # Include GM trade and trade slot enchanting operations in GM log if it enable # Default: 1 (include) # 0 (not include) # +# GM.StartLevel +# GM starting level (1-255) +# Default: 1 +# ################################################################################################################### -GM.WhisperingTo = 0 -GM.InGMList = 0 -GM.InWhoList = 0 -GM.LoginState = 2 -GM.LogTrade = 1 +GM.LoginState = 2 +GM.AcceptTickets = 2 +GM.Chat = 2 +GM.WhisperingTo = 2 +GM.InGMList = 0 +GM.InWhoList = 0 +GM.LogTrade = 1 +GM.StartLevel = 1 ################################################################################################################### # VISIBILITY AND RADIUSES @@ -784,7 +883,7 @@ GM.LogTrade = 1 # # Visibility.Distance.Creature # Visibility.Distance.Player -# Visibility distance for different in game object +# Visibility distance for different in game object # Max limited by active player zone: ~ 166 # Min limit dependent from objects # Default: 66 (cell size) @@ -801,7 +900,7 @@ GM.LogTrade = 1 # Visibility.Distance.Grey.Unit # Visibility grey distance for creatures/players (fast changing objects) # addition to appropriate object type Visibility.Distance.* use in case visibility removing to -# object (except corpse around distences) If ? is distance and G is grey distance then object +# object (except corpse around distences) If � is distance and G is grey distance then object # make visible if distance to it <= D but make non visible if distance > D+G # Default: 1 (yard) # @@ -824,7 +923,7 @@ Visibility.Distance.Grey.Object = 10 # SERVER RATES # # Rate.Health -# Rate.Mana +# Rate.Mana # Rate.Rage.Income # Rate.Rage.Loss # Rate.Focus @@ -880,7 +979,7 @@ Visibility.Distance.Grey.Object = 10 # # Rate.Mining.Amount # Rate.Mining.Next -# Mining Rates (Mining.Amount changes minimum/maximum usetimes of a deposit, +# Mining Rates (Mining.Amount changes minimum/maximum usetimes of a deposit, # Mining.Next changes chance to have next use of a deposit) # # Rate.Talent @@ -906,12 +1005,12 @@ Visibility.Distance.Grey.Object = 10 # SkillChance.Yellow # SkillChance.Green # SkillChance.Grey -# Skill chance values (0..100) +# Skill chance values (0..100) # Default: 100-75-25-0 # # SkillChance.MiningSteps # SkillChance.SkinningSteps -# For skinning and Mining chance decrease with skill level. +# For skinning and Mining chance decrease with skill level. # Default: 0 - no decrease # 75 - in 2 times each 75 skill points # @@ -939,7 +1038,7 @@ Visibility.Distance.Grey.Object = 10 # # Death.CorpseReclaimDelay.PvP # Death.CorpseReclaimDelay.PvE -# Enabled/disabled increase corpse reclaim delay at often PvP/PvE deaths +# Enabled/disabled increase corpse reclaim delay at often PvP/PvE deaths # Default: 1 (enabled) # 0 (disabled) # @@ -997,6 +1096,34 @@ Death.CorpseReclaimDelay.PvP = 1 Death.CorpseReclaimDelay.PvE = 1 ################################################################################################################### +# +# NETWORK CONFIG +# +# Network.Threads +# Number of threads for network, recommend 1 thread per 1000 connections. +# Default: 1 +# +# Network.OutKBuff +# The size of the output kernel buffer used ( SO_SNDBUF socket option, tcp manual ). +# Default: -1 (Use system default setting) +# +# Network.OutUBuff +# Userspace buffer for output. This is amount of memory reserved per each connection. +# Default: 65536 +# +# Network.TcpNoDelay: +# TCP Nagle algorithm setting +# Default: 0 (enable Nagle algorithm, less traffic, more latency) +# 1 (TCP_NO_DELAY, disable Nagle algorithm, more traffic but less latency) +# +################################################################################################################### + +Network.Threads = 1 +Network.OutKBuff = -1 +Network.OutUBuff = 65536 +Network.TcpNodelay = 1 + +################################################################################################################### # CONSOLE AND REMOTE ACCESS # # Console.Enable @@ -1071,31 +1198,6 @@ Arena.AutoDistributeInterval = 7 BattleGround.PrematureFinishTimer = 0 ################################################################################################################### -# -# Network config -# -# Threads: number of threads for network ,recommend 1 thread per 1000 players. -# Default: 1 -# -# OutKBuff: the output kernel buffer used ( SO_SNDBUF socket option ) , -1 means use system default. Refer to tcp manual for explanation. -# Default: -1 -# -# OutUBuff: userspace buffer for output -# Default: 65536 -# -# TcpNodelay: enable ( 1 ) , disable ( 0 ) ,TCP_NODELAY socket option. Refer to tcp manual for explanation. -# Default: 1 -# -# -# -################################################################################################################### - -Network.Threads = 1 -Network.OutKBuff = -1 -Network.OutUBuff = 65536 -Network.TcpNodelay = 1 - -################################################################################################################### # CUSTOM SERVER OPTIONS # # PlayerStart.Gold @@ -1143,9 +1245,6 @@ Network.TcpNodelay = 1 # The amount of honor points the duel winner will get after a duel. # Default: 0 - disable # -# DisableWaterBreath -# Disable/enable waterbreathing for players -# # AlwaysMaxWeaponSkill # Players will automatically gain max weapon/defense skill when logging in, leveling up etc. # @@ -1188,7 +1287,6 @@ GamemasterStartLevel = 70 PlayerInstantLogout = 0 MusicInBattleground = 0 HonorPointsAfterDuel = 0 -DisableWaterBreath = 0 AlwaysMaxWeaponSkill = 0 PvPToken.Enable = 0 PvPToken.MapAllowType = 4 |