Merge branch 'master' into 303

Conflicts:
	src/game/Player.cpp
	src/mangosd/mangosd.conf.dist.in
This commit is contained in:
tomrus88 2008-11-30 14:05:56 +03:00
commit ee7f7a0a08
25 changed files with 419 additions and 199 deletions

View file

@ -22,7 +22,7 @@
DROP TABLE IF EXISTS `db_version`; DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` ( CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`required_2008_11_27_01_mangos_playercreateinfo_item` bit(1) default NULL `required_2008_11_29_02_mangos_spell_elixir` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@ -13741,6 +13741,7 @@ INSERT INTO `spell_elixir` VALUES
(41610,0xB), (41610,0xB),
(41611,0xB), (41611,0xB),
(42735,0x3), (42735,0x3),
(45373,0x1),
(46837,0xB), (46837,0xB),
(46839,0xB); (46839,0xB);
/*!40000 ALTER TABLE `spell_elixir` ENABLE KEYS */; /*!40000 ALTER TABLE `spell_elixir` ENABLE KEYS */;
@ -14731,7 +14732,7 @@ INSERT INTO `spell_proc_event` VALUES
(34950,0,0,0,0,0x0000000000000000,0x00400000,0,0), (34950,0,0,0,0,0x0000000000000000,0x00400000,0,0),
(34954,0,0,0,0,0x0000000000000000,0x00400000,0,0), (34954,0,0,0,0,0x0000000000000000,0x00400000,0,0),
(35077,0,0,0,0,0x0000000000000000,0x00008000,0,60), (35077,0,0,0,0,0x0000000000000000,0x00008000,0,60),
(35080,0,0,0,0,0x0000000000000000,0x00000001,0,60), (35080,0,0,0,0,0x0000000000000000,0x00080001,0,60),
(35083,0,0,0,0,0x0000000000000000,0x00020000,0,60), (35083,0,0,0,0,0x0000000000000000,0x00020000,0,60),
(35086,0,0,0,0,0x0000000000000000,0x08020000,0,60), (35086,0,0,0,0,0x0000000000000000,0x08020000,0,60),
(35100,0,0,0,0,0x0000000000000000,0x00080000,0,0), (35100,0,0,0,0,0x0000000000000000,0x00080000,0,0),

View file

@ -0,0 +1,5 @@
ALTER TABLE db_version CHANGE COLUMN required_2008_11_27_01_mangos_playercreateinfo_item required_2008_11_29_01_mangos_spell_proc_event bit;
DELETE FROM spell_proc_event where entry = 35080;
INSERT INTO spell_proc_event (entry, SchoolMask, Category, SkillID, SpellFamilyName, SpellFamilyMask, procFlags, ppmRate, cooldown) VALUES
(35080,0,0,0,0,0x0000000000000000,0x00080001,0,60);

View file

@ -0,0 +1,5 @@
ALTER TABLE db_version CHANGE COLUMN required_2008_11_29_01_mangos_spell_proc_event required_2008_11_29_02_mangos_spell_elixir bit;
DELETE FROM `spell_elixir` WHERE `entry` = 45373;
INSERT INTO `spell_elixir` VALUES
(45373,0x1);

View file

@ -138,6 +138,8 @@ pkgdata_DATA = \
2008_11_18_01_mangos_creature_movement.sql \ 2008_11_18_01_mangos_creature_movement.sql \
2008_11_18_02_mangos_mangos_string.sql \ 2008_11_18_02_mangos_mangos_string.sql \
2008_11_27_01_mangos_playercreateinfo_item.sql \ 2008_11_27_01_mangos_playercreateinfo_item.sql \
2008_11_29_01_mangos_spell_proc_event.sql \
2008_11_29_02_mangos_spell_elixir.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -257,4 +259,6 @@ EXTRA_DIST = \
2008_11_18_01_mangos_creature_movement.sql \ 2008_11_18_01_mangos_creature_movement.sql \
2008_11_18_02_mangos_mangos_string.sql \ 2008_11_18_02_mangos_mangos_string.sql \
2008_11_27_01_mangos_playercreateinfo_item.sql \ 2008_11_27_01_mangos_playercreateinfo_item.sql \
2008_11_29_01_mangos_spell_proc_event.sql \
2008_11_29_02_mangos_spell_elixir.sql \
README README

View file

@ -22,21 +22,21 @@
ArenaTeam::ArenaTeam() ArenaTeam::ArenaTeam()
{ {
Id = 0; Id = 0;
Type = 0; Type = 0;
Name = ""; Name = "";
CaptainGuid = 0; CaptainGuid = 0;
BackgroundColor = 0; // background BackgroundColor = 0; // background
EmblemStyle = 0; // icon EmblemStyle = 0; // icon
EmblemColor = 0; // icon color EmblemColor = 0; // icon color
BorderStyle = 0; // border BorderStyle = 0; // border
BorderColor = 0; // border color BorderColor = 0; // border color
stats.games = 0; stats.games_week = 0;
stats.played = 0; stats.games_season = 0;
stats.rank = 0; stats.rank = 0;
stats.rating = 1500; stats.rating = 1500;
stats.wins = 0; stats.wins_week = 0;
stats.wins2 = 0; stats.wins_season = 0;
} }
ArenaTeam::~ArenaTeam() ArenaTeam::~ArenaTeam()
@ -51,7 +51,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam
if(objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist if(objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist
return false; return false;
sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(CaptainGuid)); sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(captainGuid));
CaptainGuid = captainGuid; CaptainGuid = captainGuid;
Name = ArenaTeamName; Name = ArenaTeamName;
@ -69,7 +69,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam
"VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')", "VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')",
Id, ArenaTeamName.c_str(), GUID_LOPART(CaptainGuid), Type, BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor); 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 " 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(); CharacterDatabase.CommitTransaction();
@ -122,13 +122,14 @@ bool ArenaTeam::AddMember(uint64 PlayerGuid)
Player::RemovePetitionsAndSigns(PlayerGuid, GetType()); Player::RemovePetitionsAndSigns(PlayerGuid, GetType());
ArenaTeamMember newmember; ArenaTeamMember newmember;
newmember.name = plName; newmember.name = plName;
newmember.guid = PlayerGuid; newmember.guid = PlayerGuid;
newmember.Class = plClass; newmember.Class = plClass;
newmember.played_season = 0; newmember.games_season = 0;
newmember.played_week = 0; newmember.games_week = 0;
newmember.wons_season = 0; newmember.wins_season = 0;
newmember.wons_week = 0; newmember.wins_week = 0;
newmember.personal_rating = 1500;
members.push_back(newmember); members.push_back(newmember);
CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid,guid) VALUES ('%u', '%u')", Id, GUID_LOPART(newmember.guid)); CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid,guid) VALUES ('%u', '%u')", Id, GUID_LOPART(newmember.guid));
@ -192,12 +193,12 @@ void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId)
Field *fields = result->Fetch(); Field *fields = result->Fetch();
stats.rating = fields[0].GetUInt32(); stats.rating = fields[0].GetUInt32();
stats.games = fields[1].GetUInt32(); stats.games_week = fields[1].GetUInt32();
stats.wins = fields[2].GetUInt32(); stats.wins_week = fields[2].GetUInt32();
stats.played = fields[3].GetUInt32(); stats.games_season = fields[3].GetUInt32();
stats.wins2 = fields[4].GetUInt32(); stats.wins_season = fields[4].GetUInt32();
stats.rank = fields[5].GetUInt32(); stats.rank = fields[5].GetUInt32();
delete result; delete result;
} }
@ -206,7 +207,7 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId)
{ {
Field *fields; Field *fields;
QueryResult *result = CharacterDatabase.PQuery("SELECT guid,played_week,wons_week,played_season,wons_season FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId); QueryResult *result = CharacterDatabase.PQuery("SELECT guid,games_week,wins_week,games_season,wins_season FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId);
if(!result) if(!result)
return; return;
@ -216,10 +217,10 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId)
ArenaTeamMember newmember; ArenaTeamMember newmember;
newmember.guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); newmember.guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
LoadPlayerStats(&newmember); LoadPlayerStats(&newmember);
newmember.played_week = fields[1].GetUInt32(); newmember.games_week = fields[1].GetUInt32();
newmember.wons_week = fields[2].GetUInt32(); newmember.wins_week = fields[2].GetUInt32();
newmember.played_season = fields[3].GetUInt32(); newmember.games_season = fields[3].GetUInt32();
newmember.wons_season = fields[4].GetUInt32(); newmember.wins_season = fields[4].GetUInt32();
members.push_back(newmember); members.push_back(newmember);
}while( result->NextRow() ); }while( result->NextRow() );
delete result; delete result;
@ -337,11 +338,11 @@ void ArenaTeam::Roster(WorldSession *session)
data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown
data << uint8(pl->getLevel()); // unknown, probably level data << uint8(pl->getLevel()); // unknown, probably level
data << uint8(pl->getClass()); // class data << uint8(pl->getClass()); // class
data << uint32(itr->played_week); // played this week data << uint32(itr->games_week); // played this week
data << uint32(itr->wons_week); // wins this week data << uint32(itr->wins_week); // wins this week
data << uint32(itr->played_season); // played this season data << uint32(itr->games_season); // played this season
data << uint32(itr->wons_season); // wins this season data << uint32(itr->wins_season); // wins this season
data << uint32(0); // personal rating? data << uint32(itr->personal_rating); // personal rating
} }
else else
{ {
@ -351,11 +352,11 @@ void ArenaTeam::Roster(WorldSession *session)
data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown
data << uint8(0); // unknown, level? data << uint8(0); // unknown, level?
data << uint8(itr->Class); // class data << uint8(itr->Class); // class
data << uint32(itr->played_week); // played this week data << uint32(itr->games_week); // played this week
data << uint32(itr->wons_week); // wins this week data << uint32(itr->wins_week); // wins this week
data << uint32(itr->played_season); // played this season data << uint32(itr->games_season); // played this season
data << uint32(itr->wons_season); // wins this season data << uint32(itr->wins_season); // wins this season
data << uint32(0); // personal rating? data << uint32(itr->personal_rating); // personal rating
} }
} }
session->SendPacket(&data); session->SendPacket(&data);
@ -382,25 +383,29 @@ void ArenaTeam::Stats(WorldSession *session)
WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7); WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7);
data << uint32(GetId()); // arena team id data << uint32(GetId()); // arena team id
data << uint32(stats.rating); // rating data << uint32(stats.rating); // rating
data << uint32(stats.games); // games data << uint32(stats.games_week); // games this week
data << uint32(stats.wins); // wins data << uint32(stats.wins_week); // wins this week
data << uint32(stats.played); // played data << uint32(stats.games_season); // played this season
data << uint32(stats.wins2); // wins(again o_O) data << uint32(stats.wins_season); // wins this season
data << uint32(stats.rank); // rank data << uint32(stats.rank); // rank
session->SendPacket(&data); session->SendPacket(&data);
} }
void ArenaTeam::InspectStats(WorldSession *session, uint64 guid) void ArenaTeam::InspectStats(WorldSession *session, uint64 guid)
{ {
ArenaTeamMember* member = GetMember(guid);
if(!member)
return;
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6);
data << uint64(guid); // player guid data << uint64(guid); // player guid
data << uint8(GetSlot()); // slot (0...2) data << uint8(GetSlot()); // slot (0...2)
data << uint32(GetId()); // arena team id data << uint32(GetId()); // arena team id
data << uint32(stats.rating); // rating data << uint32(stats.rating); // rating
data << uint32(stats.games); // games data << uint32(stats.games_season); // season played
data << uint32(stats.wins); // wins data << uint32(stats.wins_season); // season wins
data << uint32(stats.played); // played (count of all games, that played...) data << member->games_season; // played (count of all games, that the inspected member participated...)
data << uint32(0); // 2.3.3 personal rating? data << member->personal_rating; // personal rating
session->SendPacket(&data); session->SendPacket(&data);
} }
@ -423,20 +428,20 @@ void ArenaTeam::SetStats(uint32 stat_type, uint32 value)
stats.rating = value; stats.rating = value;
CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u' WHERE arenateamid = '%u'", value, GetId()); CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u' WHERE arenateamid = '%u'", value, GetId());
break; break;
case STAT_TYPE_GAMES: case STAT_TYPE_GAMES_WEEK:
stats.games = value; stats.games_week = value;
CharacterDatabase.PExecute("UPDATE arena_team_stats SET games = '%u' WHERE arenateamid = '%u'", value, GetId()); CharacterDatabase.PExecute("UPDATE arena_team_stats SET games = '%u' WHERE arenateamid = '%u'", value, GetId());
break; break;
case STAT_TYPE_WINS: case STAT_TYPE_WINS_WEEK:
stats.wins = value; stats.wins_week = value;
CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins = '%u' WHERE arenateamid = '%u'", value, GetId()); CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins = '%u' WHERE arenateamid = '%u'", value, GetId());
break; break;
case STAT_TYPE_PLAYED: case STAT_TYPE_GAMES_SEASON:
stats.played = value; stats.games_season = value;
CharacterDatabase.PExecute("UPDATE arena_team_stats SET played = '%u' WHERE arenateamid = '%u'", value, GetId()); CharacterDatabase.PExecute("UPDATE arena_team_stats SET played = '%u' WHERE arenateamid = '%u'", value, GetId());
break; break;
case STAT_TYPE_WINS2: case STAT_TYPE_WINS_SEASON:
stats.wins2 = value; stats.wins_season = value;
CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins2 = '%u' WHERE arenateamid = '%u'", value, GetId()); CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins2 = '%u' WHERE arenateamid = '%u'", value, GetId());
break; break;
case STAT_TYPE_RANK: case STAT_TYPE_RANK:
@ -493,24 +498,35 @@ bool ArenaTeam::HaveMember( uint64 guid ) const
return false; return false;
} }
void ArenaTeam::FinishWeek()
{
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->games_week = 0;
itr->wins_week = 0;
}
}
/* /*
arenateam fields (id from 2.3.3 client): arenateam fields (id from 2.3.3 client):
1414 - arena team id 2v2 1414 - arena team id 2v2
1415 - 0=captain, 1=member 1415 - 0=captain, 1=member
1416 - played this season 1416 - played this week
1417 - played this week 1417 - played this season
1418 - unk 1418 - unk
1419 - unk 1419 - personal arena rating
1420 - arena team id 3v3 1420 - arena team id 3v3
1421 - 0=captain, 1=member 1421 - 0=captain, 1=member
1422 - played this season 1422 - played this week
1423 - played this week 1423 - played this season
1424 - unk 1424 - unk
1425 - unk 1425 - personal arena rating
1426 - arena team id 5v5 1426 - arena team id 5v5
1427 - 0=captain, 1=member 1427 - 0=captain, 1=member
1428 - played this season 1428 - played this week
1429 - played this week 1429 - played this season
1430 - unk 1430 - unk
1431 - unk 1431 - personal arena rating
*/ */

View file

@ -66,12 +66,12 @@ ERR_ARENA_TEAM_LEVEL_TOO_LOW_I
enum ArenaTeamStatTypes enum ArenaTeamStatTypes
{ {
STAT_TYPE_RATING = 0, STAT_TYPE_RATING = 0,
STAT_TYPE_GAMES = 1, STAT_TYPE_GAMES_WEEK = 1,
STAT_TYPE_WINS = 2, STAT_TYPE_WINS_WEEK = 2,
STAT_TYPE_PLAYED = 3, STAT_TYPE_GAMES_SEASON = 3,
STAT_TYPE_WINS2 = 4, STAT_TYPE_WINS_SEASON = 4,
STAT_TYPE_RANK = 5 STAT_TYPE_RANK = 5
}; };
enum ArenaTeamTypes enum ArenaTeamTypes
@ -88,19 +88,20 @@ struct ArenaTeamMember
//uint32 unk2; //uint32 unk2;
//uint8 unk1; //uint8 unk1;
uint8 Class; uint8 Class;
uint32 played_week; uint32 games_week;
uint32 wons_week; uint32 wins_week;
uint32 played_season; uint32 games_season;
uint32 wons_season; uint32 wins_season;
uint32 personal_rating;
}; };
struct ArenaTeamStats struct ArenaTeamStats
{ {
uint32 rating; uint32 rating;
uint32 games; uint32 games_week;
uint32 wins; uint32 wins_week;
uint32 played; uint32 games_season;
uint32 wins2; uint32 wins_season;
uint32 rank; uint32 rank;
}; };
@ -123,7 +124,7 @@ class ArenaTeam
static uint8 GetSlotByType(uint32 type); static uint8 GetSlotByType(uint32 type);
const uint64& GetCaptain() const { return CaptainGuid; } const uint64& GetCaptain() const { return CaptainGuid; }
std::string GetName() const { return Name; } std::string GetName() const { return Name; }
ArenaTeamStats GetStats() const { return stats; } const ArenaTeamStats& GetStats() const { return stats; }
void SetStats(uint32 stat_type, uint32 value); void SetStats(uint32 stat_type, uint32 value);
uint32 GetRating() const { return stats.rating; } uint32 GetRating() const { return stats.rating; }
@ -143,6 +144,14 @@ class ArenaTeam
MemberList::iterator membersbegin(){ return members.begin(); } MemberList::iterator membersbegin(){ return members.begin(); }
MemberList::iterator membersEnd(){ return members.end(); } MemberList::iterator membersEnd(){ return members.end(); }
bool HaveMember(uint64 guid) const; 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); bool LoadArenaTeamFromDB(uint32 ArenaTeamId);
void LoadMembersFromDB(uint32 ArenaTeamId); void LoadMembersFromDB(uint32 ArenaTeamId);
@ -156,6 +165,8 @@ class ArenaTeam
void Stats(WorldSession *session); void Stats(WorldSession *session);
void InspectStats(WorldSession *session, uint64 guid); void InspectStats(WorldSession *session, uint64 guid);
void FinishWeek();
protected: protected:
uint32 Id; uint32 Id;

View file

@ -710,14 +710,21 @@ void BattleGround::AddPlayer(Player *plr)
plr->RemoveArenaSpellCooldowns(); plr->RemoveArenaSpellCooldowns();
//plr->RemoveArenaAuras(); //plr->RemoveArenaAuras();
plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT); plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT);
if(team == ALLIANCE && plr->GetTeam() == ALLIANCE) if(team == ALLIANCE) // gold
plr->CastSpell(plr,SPELL_ALLIANCE_GOLD_FLAG,true); {
else if(team == HORDE && plr->GetTeam() == ALLIANCE) if(plr->GetTeam() == HORDE)
plr->CastSpell(plr,SPELL_ALLIANCE_GREEN_FLAG,true); plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true);
else if(team == ALLIANCE && plr->GetTeam() == HORDE) else
plr->CastSpell(plr,SPELL_HORDE_GOLD_FLAG,true); plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG,true);
}
else else
plr->CastSpell(plr,SPELL_HORDE_GREEN_FLAG,true); {
if(plr->GetTeam() == HORDE) // green
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG,true);
else
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true);
}
plr->DestroyConjuredItems(true); plr->DestroyConjuredItems(true);
if(GetStatus() == STATUS_WAIT_JOIN) // not started yet if(GetStatus() == STATUS_WAIT_JOIN) // not started yet

View file

@ -765,6 +765,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if(sWorld.IsShutdowning()) if(sWorld.IsShutdowning())
sWorld.ShutdownMsg(true,pCurrChar); sWorld.ShutdownMsg(true,pCurrChar);
if(sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
pCurrChar->SetTaxiCheater(true);
if(pCurrChar->isGameMaster()) if(pCurrChar->isGameMaster())
SendNotification(LANG_GM_ON); SendNotification(LANG_GM_ON);

View file

@ -39,6 +39,6 @@ class MapRefManager : public RefManager<Map, Player>
iterator rbegin() { return iterator(getLast()); } iterator rbegin() { return iterator(getLast()); }
iterator rend() { return iterator(NULL); } iterator rend() { return iterator(NULL); }
const_iterator begin() const { return const_iterator(getFirst()); } const_iterator begin() const { return const_iterator(getFirst()); }
const_iterator end() const { return const_iterator(getLast()); } const_iterator end() const { return const_iterator(NULL); }
}; };
#endif #endif

View file

@ -275,13 +275,6 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
if (uint64 lguid = GetPlayer()->GetLootGUID()) if (uint64 lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid); DoLootRelease(lguid);
//instant logout for admins, gm's, mod's
if( GetSecurity() > SEC_PLAYER )
{
LogoutPlayer(true);
return;
}
//Can not logout if... //Can not logout if...
if( GetPlayer()->isInCombat() || //...is in combat if( GetPlayer()->isInCombat() || //...is in combat
GetPlayer()->duel || //...is in Duel GetPlayer()->duel || //...is in Duel
@ -297,8 +290,9 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
return; return;
} }
//instant logout in taverns/cities or on taxi //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()) if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() ||
GetSecurity() >= sWorld.getConfig(CONFIG_INSTANT_LOGOUT))
{ {
LogoutPlayer(true); LogoutPlayer(true);
return; return;
@ -664,6 +658,10 @@ void WorldSession::HandleCorpseReclaimOpcode(WorldPacket &recv_data)
if (GetPlayer()->isAlive()) if (GetPlayer()->isAlive())
return; return;
// do not allow corpse reclaim in arena
if (GetPlayer()->InArena())
return;
// body not released yet // body not released yet
if(!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if(!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return; return;

View file

@ -7336,7 +7336,7 @@ void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids)
if(itrM->second.dataint) if(itrM->second.dataint)
{ {
if(!GetMangosStringLocale (itrM->second.dataint)) if(!GetMangosStringLocale (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)) if(ids.count(itrM->second.dataint))
ids.erase(itrM->second.dataint); ids.erase(itrM->second.dataint);

View file

@ -596,13 +596,22 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_,
} }
// set starting level // set starting level
if(getClass() == CLASS_DEATH_KNIGHT) if (GetSession()->GetSecurity() >= SEC_MODERATOR)
SetUInt32Value(UNIT_FIELD_LEVEL, 55); SetUInt32Value(UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_GM_LEVEL));
else else
SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) ); {
if(getClass() == CLASS_DEATH_KNIGHT)
SetUInt32Value(UNIT_FIELD_LEVEL, 55);
else
SetUInt32Value(UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL));
}
InitRunes(); InitRunes();
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));
// Played time // Played time
m_Last_tick = time(NULL); m_Last_tick = time(NULL);
m_Played_time[0] = 0; m_Played_time[0] = 0;
@ -838,8 +847,8 @@ void Player::HandleDrowning()
if(!m_isunderwater) if(!m_isunderwater)
return; return;
//if have water breath , then remove bar //if player is GM, have waterbreath, is dead or if breathing is disabled then return
if(waterbreath || isGameMaster() || !isAlive()) if(waterbreath || isGameMaster() || !isAlive() || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_DISABLE_BREATHING))
{ {
StopMirrorTimer(BREATH_TIMER); StopMirrorTimer(BREATH_TIMER);
m_isunderwater = 0; m_isunderwater = 0;
@ -2197,7 +2206,7 @@ void Player::GiveLevel(uint32 level)
if(getLevel()!= level) if(getLevel()!= level)
m_Played_time[1] = 0; // Level Played Time reset m_Played_time[1] = 0; // Level Played Time reset
SetLevel(level); SetLevel(level);
UpdateMaxSkills(); UpdateSkillsForLevel ();
// save base values (bonuses already included in stored stats // save base values (bonuses already included in stored stats
for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) for(int i = STAT_STRENGTH; i < MAX_STATS; ++i)
@ -2272,7 +2281,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ); SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) );
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, MaNGOS::XP::xp_to_level(getLevel())); SetUInt32Value(PLAYER_NEXT_LEVEL_XP, MaNGOS::XP::xp_to_level(getLevel()));
UpdateMaxSkills (); UpdateSkillsForLevel ();
// set default cast time multiplier // set default cast time multiplier
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
@ -3783,7 +3792,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
// some items limited to specific map // some items limited to specific map
DestroyZoneLimitedItem( true, GetZoneId()); DestroyZoneLimitedItem( true, GetZoneId());
if(!applySickness || getLevel() <= 10) if(!applySickness)
return; return;
//Characters from level 1-10 are not affected by resurrection sickness. //Characters from level 1-10 are not affected by resurrection sickness.
@ -4906,9 +4915,12 @@ void Player::ModifySkillBonus(uint32 skillid,int32 val, bool talent)
} }
} }
void Player::UpdateMaxSkills() void Player::UpdateSkillsForLevel()
{ {
uint16 maxconfskill = sWorld.GetConfigMaxSkillValue(); 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++) for (uint16 i=0; i < PLAYER_MAX_SKILLS; i++)
if (GetUInt32Value(PLAYER_SKILL_INDEX(i))) if (GetUInt32Value(PLAYER_SKILL_INDEX(i)))
@ -4926,11 +4938,15 @@ void Player::UpdateMaxSkills()
uint32 max = SKILL_MAX(data); uint32 max = SKILL_MAX(data);
uint32 val = SKILL_VALUE(data); uint32 val = SKILL_VALUE(data);
// update only level dependent max skill values /// update only level dependent max skill values
if(max!=1 && max != maxconfskill) if(max!=1)
{ {
uint32 max_Skill = GetMaxSkillValueForLevel(); /// miximize skill always
SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(val,max_Skill)); 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));
} }
} }
} }
@ -5963,6 +5979,18 @@ void Player::UpdateHonorFields()
///An exact honor value can also be given (overriding the calcs) ///An exact honor value can also be given (overriding the calcs)
bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor) bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
{ {
// 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 // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
if(GetDummyAura(SPELL_AURA_PLAYER_INACTIVE)) if(GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
return false; return false;

View file

@ -1771,7 +1771,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void SetFactionVisible(FactionState* faction); void SetFactionVisible(FactionState* faction);
void SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId); void SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId);
void SetFactionVisibleForFactionId(uint32 FactionId); void SetFactionVisibleForFactionId(uint32 FactionId);
void UpdateMaxSkills(); void UpdateSkillsForLevel();
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
void ModifySkillBonus(uint32 skillid,int32 val, bool talent); void ModifySkillBonus(uint32 skillid,int32 val, bool talent);

View file

@ -2594,13 +2594,23 @@ void Spell::SendCastResult(uint8 result)
break; break;
case SPELL_FAILED_REQUIRES_AREA: case SPELL_FAILED_REQUIRES_AREA:
// hardcode areas limitation case // hardcode areas limitation case
if( m_spellInfo->Id==41618 || m_spellInfo->Id==41620 ) switch(m_spellInfo->Id)
data << uint32(3842); {
else if( m_spellInfo->Id==41617 || m_spellInfo->Id==41619 ) case 41617: // Cenarion Mana Salve
data << uint32(3905); case 41619: // Cenarion Healing Salve
// normal case data << uint32(3905);
else break;
data << uint32(m_spellInfo->AreaId); 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; break;
case SPELL_FAILED_TOTEMS: case SPELL_FAILED_TOTEMS:
if(m_spellInfo->Totem[0]) if(m_spellInfo->Totem[0])

View file

@ -2233,6 +2233,11 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z
{ {
if(uint32 mask = spellmgr.GetSpellElixirMask(spellInfo->Id)) 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) if(mask & ELIXIR_UNSTABLE_MASK)
{ {
// in the Blade's Edge Mountains Plateaus and Gruul's Lair. // in the Blade's Edge Mountains Plateaus and Gruul's Lair.
@ -2240,9 +2245,8 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z
} }
if(mask & ELIXIR_SHATTRATH_MASK) if(mask & ELIXIR_SHATTRATH_MASK)
{ {
// in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple, Sunwell Plateau
// TODO: and the Sunwell Plateau if(zone_id ==3607 || map_id==534 || map_id==564 || zone_id==4075)
if(zone_id ==3607 || map_id==534 || map_id==564)
return true; return true;
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
@ -2260,8 +2264,8 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z
// special cases zone check (maps checked by multimap common id) // special cases zone check (maps checked by multimap common id)
switch(spellInfo->Id) switch(spellInfo->Id)
{ {
case 41618: case 41618: // Bottled Nethergon Energy
case 41620: case 41620: // Bottled Nethergon Vapor
{ {
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
if(!mapEntry) if(!mapEntry)
@ -2269,9 +2273,8 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z
return mapEntry->multimap_id==206; return mapEntry->multimap_id==206;
} }
case 41617: // Cenarion Mana Salve
case 41617: case 41619: // Cenarion Healing Salve
case 41619:
{ {
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
if(!mapEntry) if(!mapEntry)
@ -2279,14 +2282,9 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z
return mapEntry->multimap_id==207; return mapEntry->multimap_id==207;
} }
// Dragonmaw Illusion case 40216: // Dragonmaw Illusion
case 40216: case 42016: // Dragonmaw Illusion
case 42016: return area_id == 3759 || area_id == 3966 || area_id == 3939;
{
if ( area_id != 3759 && area_id != 3966 && area_id != 3939 )
return false;
break;
}
} }
return true; return true;

View file

@ -49,7 +49,8 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature &c)
i_path = WaypointMgr.GetPath(c.GetDBTableGUIDLow()); i_path = WaypointMgr.GetPath(c.GetDBTableGUIDLow());
if(!i_path) 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; return;
} }

View file

@ -112,10 +112,12 @@ World::World()
World::~World() World::~World()
{ {
///- Empty the kicked session set ///- Empty the kicked session set
for (std::set<WorldSession*>::iterator itr = m_kicked_sessions.begin(); itr != m_kicked_sessions.end(); ++itr) while (!m_sessions.empty())
delete *itr; {
// not remove from queue, prevent loading new sessions
m_kicked_sessions.clear(); delete m_sessions.begin()->second;
m_sessions.erase(m_sessions.begin());
}
///- Empty the WeatherMap ///- Empty the WeatherMap
for (WeatherMap::iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr) for (WeatherMap::iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr)
@ -195,17 +197,26 @@ World::AddSession_ (WorldSession* s)
if (!RemoveSession (s->GetAccountId ())) if (!RemoveSession (s->GetAccountId ()))
{ {
s->KickPlayer (); s->KickPlayer ();
m_kicked_sessions.insert (s); delete s; // session not added yet in session list, so not listed in queue
return; 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 // if session already exist, prepare to it deleting at next world update
// NOTE - KickPlayer() should be called on "old" in RemoveSession() // 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()) if(old != m_sessions.end())
m_kicked_sessions.insert (old->second); {
// 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; m_sessions[s->GetAccountId ()] = s;
@ -213,9 +224,11 @@ World::AddSession_ (WorldSession* s)
uint32 Sessions = GetActiveAndQueuedSessionCount (); uint32 Sessions = GetActiveAndQueuedSessionCount ();
uint32 pLimit = GetPlayerAmountLimit (); uint32 pLimit = GetPlayerAmountLimit ();
uint32 QueueSize = GetQueueSize (); //number of players in the queue uint32 QueueSize = GetQueueSize (); //number of players in the queue
//so we don't count the user trying to //so we don't count the user trying to
//login as a session and queue the socket that we are using //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 ) if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity () == SEC_PLAYER )
{ {
@ -259,6 +272,7 @@ int32 World::GetQueuePos(WorldSession* sess)
void World::AddQueuedPlayer(WorldSession* sess) void World::AddQueuedPlayer(WorldSession* sess)
{ {
sess->SetInQueue(true);
m_QueuedPlayer.push_back (sess); m_QueuedPlayer.push_back (sess);
// The 1st SMSG_AUTH_RESPONSE needs to contain other info too. // The 1st SMSG_AUTH_RESPONSE needs to contain other info too.
@ -274,7 +288,7 @@ void World::AddQueuedPlayer(WorldSession* sess)
//sess->SendAuthWaitQue (GetQueuePos (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) // sessions count including queued to remove (if removed_session set)
uint32 sessions = GetActiveSessionCount(); uint32 sessions = GetActiveSessionCount();
@ -282,16 +296,16 @@ void World::RemoveQueuedPlayer(WorldSession* sess)
uint32 position = 1; uint32 position = 1;
Queue::iterator iter = m_QueuedPlayer.begin(); 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 // search to remove and count skipped positions
bool found = false;
for(;iter != m_QueuedPlayer.end(); ++iter, ++position) for(;iter != m_QueuedPlayer.end(); ++iter, ++position)
{ {
if(*iter==sess) if(*iter==sess)
{ {
sess->SetInQueue(false);
iter = m_QueuedPlayer.erase(iter); iter = m_QueuedPlayer.erase(iter);
decrease_session = false; // removing queued session found = true; // removing queued session
break; break;
} }
} }
@ -299,15 +313,16 @@ void World::RemoveQueuedPlayer(WorldSession* sess)
// iter point to next socked after removed or end() // iter point to next socked after removed or end()
// position store position of removed socket and then new position next socket after removed // position store position of removed socket and then new position next socket after removed
// decrease for case session queued for removing // if session not queued then we need decrease sessions count
if(decrease_session && sessions) if(!found && sessions)
--sessions; --sessions;
// accept first in queue // accept first in queue
if( (!m_playerLimit || sessions < m_playerLimit) && !m_QueuedPlayer.empty() ) if( (!m_playerLimit || sessions < m_playerLimit) && !m_QueuedPlayer.empty() )
{ {
WorldSession * socket = m_QueuedPlayer.front(); WorldSession* pop_sess = m_QueuedPlayer.front();
socket->SendAuthWaitQue(0); pop_sess->SetInQueue(false);
pop_sess->SendAuthWaitQue(0);
m_QueuedPlayer.pop_front(); m_QueuedPlayer.pop_front();
// update iter to point first queued socket or end() if queue is empty now // update iter to point first queued socket or end() if queue is empty now
@ -319,6 +334,8 @@ void World::RemoveQueuedPlayer(WorldSession* sess)
// iter point to first not updated socket, position store new position // iter point to first not updated socket, position store new position
for(; iter != m_QueuedPlayer.end(); ++iter, ++position) for(; iter != m_QueuedPlayer.end(); ++iter, ++position)
(*iter)->SendAuthWaitQue(position); (*iter)->SendAuthWaitQue(position);
return found;
} }
/// Find a Weather object by the given zoneid /// Find a Weather object by the given zoneid
@ -654,8 +671,63 @@ 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]); 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_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); 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); 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_LEVEL] = sConfig.GetBoolDefault("Instance.IgnoreLevel", false);
m_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfig.GetBoolDefault("Instance.IgnoreRaid", false); m_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfig.GetBoolDefault("Instance.IgnoreRaid", false);
@ -685,6 +757,19 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_GM_IN_WHO_LIST] = sConfig.GetBoolDefault("GM.InWhoList",false); 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_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_GROUP_VISIBILITY] = sConfig.GetIntDefault("Visibility.GroupMode",0);
m_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfig.GetIntDefault("MailDeliveryDelay",HOUR); m_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfig.GetIntDefault("MailDeliveryDelay",HOUR);
@ -750,6 +835,10 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY] = sConfig.GetBoolDefault("SaveRespawnTimeImmediately",true); m_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY] = sConfig.GetBoolDefault("SaveRespawnTimeImmediately",true);
m_configs[CONFIG_WEATHER] = sConfig.GetBoolDefault("ActivateWeather",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) if(reload)
{ {
uint32 val = sConfig.GetIntDefault("Expansion",1); uint32 val = sConfig.GetIntDefault("Expansion",1);
@ -806,6 +895,8 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfig.GetIntDefault("ListenRange.TextEmote", 25); 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_LISTEN_RANGE_YELL] = sConfig.GetIntDefault("ListenRange.Yell", 300);
m_configs[CONFIG_INSTANT_LOGOUT] = sConfig.GetIntDefault("InstantLogout", SEC_MODERATOR);
m_VisibleUnitGreyDistance = sConfig.GetFloatDefault("Visibility.Distance.Grey.Unit", 1); m_VisibleUnitGreyDistance = sConfig.GetFloatDefault("Visibility.Distance.Grey.Unit", 1);
if(m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE) if(m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
{ {
@ -2193,6 +2284,8 @@ void World::SendZoneText(uint32 zone, const char* text, WorldSession *self, uint
/// Kick (and save) all players /// Kick (and save) all players
void World::KickAll() 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 // session not removed at kick and will removed in next update tick
for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
itr->second->KickPlayer(); itr->second->KickPlayer();
@ -2207,18 +2300,6 @@ void World::KickAllLess(AccountTypes sec)
itr->second->KickPlayer(); 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 /// Kick (and save) the designated player
bool World::KickPlayer(std::string playerName) bool World::KickPlayer(std::string playerName)
{ {
@ -2449,20 +2530,13 @@ void World::SendServerMessage(uint32 type, const char *text, Player* player)
void World::UpdateSessions( time_t diff ) void World::UpdateSessions( time_t diff )
{ {
///- Add new sessions
while(!addSessQueue.empty()) while(!addSessQueue.empty())
{ {
WorldSession* sess = addSessQueue.next (); WorldSession* sess = addSessQueue.next ();
AddSession_ (sess); 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;
}
m_kicked_sessions.clear();
///- Then send an update signal to remaining ones ///- Then send an update signal to remaining ones
for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next) for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
{ {

View file

@ -103,8 +103,11 @@ enum WorldConfigs
CONFIG_SKIP_CINEMATICS, CONFIG_SKIP_CINEMATICS,
CONFIG_MAX_PLAYER_LEVEL, CONFIG_MAX_PLAYER_LEVEL,
CONFIG_START_PLAYER_LEVEL, CONFIG_START_PLAYER_LEVEL,
CONFIG_START_PLAYER_MONEY,
CONFIG_MAX_HONOR_POINTS, CONFIG_MAX_HONOR_POINTS,
CONFIG_START_HONOR_POINTS,
CONFIG_MAX_ARENA_POINTS, CONFIG_MAX_ARENA_POINTS,
CONFIG_START_ARENA_POINTS,
CONFIG_INSTANCE_IGNORE_LEVEL, CONFIG_INSTANCE_IGNORE_LEVEL,
CONFIG_INSTANCE_IGNORE_RAID, CONFIG_INSTANCE_IGNORE_RAID,
CONFIG_BATTLEGROUND_CAST_DESERTER, CONFIG_BATTLEGROUND_CAST_DESERTER,
@ -122,6 +125,7 @@ enum WorldConfigs
CONFIG_GM_IN_GM_LIST, CONFIG_GM_IN_GM_LIST,
CONFIG_GM_IN_WHO_LIST, CONFIG_GM_IN_WHO_LIST,
CONFIG_GM_LOG_TRADE, CONFIG_GM_LOG_TRADE,
CONFIG_START_GM_LEVEL,
CONFIG_GROUP_VISIBILITY, CONFIG_GROUP_VISIBILITY,
CONFIG_MAIL_DELIVERY_DELAY, CONFIG_MAIL_DELIVERY_DELAY,
CONFIG_UPTIME_UPDATE, CONFIG_UPTIME_UPDATE,
@ -138,6 +142,7 @@ enum WorldConfigs
CONFIG_SKILL_GAIN_WEAPON, CONFIG_SKILL_GAIN_WEAPON,
CONFIG_MAX_OVERSPEED_PINGS, CONFIG_MAX_OVERSPEED_PINGS,
CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY, CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY,
CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL,
CONFIG_WEATHER, CONFIG_WEATHER,
CONFIG_EXPANSION, CONFIG_EXPANSION,
CONFIG_CHATFLOOD_MESSAGE_COUNT, CONFIG_CHATFLOOD_MESSAGE_COUNT,
@ -164,6 +169,9 @@ enum WorldConfigs
CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP,
CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE,
CONFIG_THREAT_RADIUS, CONFIG_THREAT_RADIUS,
CONFIG_INSTANT_LOGOUT,
CONFIG_DISABLE_BREATHING,
CONFIG_ALL_TAXI_PATHS,
CONFIG_DECLINED_NAMES_USED, CONFIG_DECLINED_NAMES_USED,
CONFIG_LISTEN_RANGE_SAY, CONFIG_LISTEN_RANGE_SAY,
CONFIG_LISTEN_RANGE_TEXTEMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE,
@ -352,7 +360,7 @@ class World
//player Queue //player Queue
typedef std::list<WorldSession*> Queue; typedef std::list<WorldSession*> Queue;
void AddQueuedPlayer(WorldSession*); void AddQueuedPlayer(WorldSession*);
void RemoveQueuedPlayer(WorldSession*); bool RemoveQueuedPlayer(WorldSession* session);
int32 GetQueuePos(WorldSession*); int32 GetQueuePos(WorldSession*);
uint32 GetQueueSize() const { return m_QueuedPlayer.size(); } uint32 GetQueueSize() const { return m_QueuedPlayer.size(); }
@ -435,7 +443,6 @@ class World
bool KickPlayer(std::string playerName); bool KickPlayer(std::string playerName);
void KickAll(); void KickAll();
void KickAllLess(AccountTypes sec); void KickAllLess(AccountTypes sec);
void KickAllQueued();
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
bool RemoveBanAccount(BanMode mode, std::string nameOrIP); bool RemoveBanAccount(BanMode mode, std::string nameOrIP);
@ -493,7 +500,6 @@ class World
WeatherMap m_weathers; WeatherMap m_weathers;
typedef UNORDERED_MAP<uint32, WorldSession*> SessionMap; typedef UNORDERED_MAP<uint32, WorldSession*> SessionMap;
SessionMap m_sessions; SessionMap m_sessions;
std::set<WorldSession*> m_kicked_sessions;
uint32 m_maxActiveSessionCount; uint32 m_maxActiveSessionCount;
uint32 m_maxQueuedSessionCount; uint32 m_maxQueuedSessionCount;

View file

@ -45,7 +45,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expan
LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time),
_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)), 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) if (sock)
{ {
@ -205,6 +205,13 @@ bool WorldSession::Update(uint32 /*diff*/)
(this->*opHandle.handler)(*packet); (this->*opHandle.handler)(*packet);
break; break;
case STATUS_AUTHED: case STATUS_AUTHED:
// prevent cheating with skip queue wait
if(m_inQueue)
{
logUnexpectedOpcode(packet, "the player not pass queue yet");
break;
}
m_playerRecentlyLogout = false; m_playerRecentlyLogout = false;
(this->*opHandle.handler)(*packet); (this->*opHandle.handler)(*packet);
break; break;

View file

@ -108,6 +108,9 @@ class MANGOS_DLL_SPEC WorldSession
void SetPlayer(Player *plr) { _player = plr; } void SetPlayer(Player *plr) { _player = plr; }
uint8 Expansion() const { return m_expansion; } 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? /// Is the user engaged in a log out process?
bool isLogingOut() const { return _logoutTime || m_playerLogout; } bool isLogingOut() const { return _logoutTime || m_playerLogout; }
@ -678,6 +681,7 @@ class MANGOS_DLL_SPEC WorldSession
uint8 m_expansion; uint8 m_expansion;
time_t _logoutTime; time_t _logoutTime;
bool m_inQueue; // session wait in auth.queue
bool m_playerLoading; // code processed in LoginPlayer bool m_playerLoading; // code processed in LoginPlayer
bool m_playerLogout; // code processed in LogoutPlayer bool m_playerLogout; // code processed in LogoutPlayer
bool m_playerRecentlyLogout; bool m_playerRecentlyLogout;

View file

@ -72,7 +72,6 @@ void WorldRunnable::run()
prevSleepTime = 0; 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.KickAll(); // save and kick all players
sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call

View file

@ -419,17 +419,48 @@ LogColors = ""
# Change not recommended # Change not recommended
# Default: 70 # 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 # MaxHonorPoints
# Max honor points that player can have. # Max honor points that player can have.
# Default: 75000 # Default: 75000
# #
# StartHonorPoints
# Amount of honor that new players will start with
# Default: 0
#
# MaxArenaPoints # MaxArenaPoints
# Max arena points that player can have. # Max arena points that player can have.
# Default: 5000 # Default: 5000
# #
# StartPlayerLevel # StartArenaPoints
# Staring level that have character at creating (in range 1 to MaxPlayerLevel) # Amount of arena points that new players will start with
# Default: 1 # 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 # ActivateWeather
# Activate weather system # Activate weather system
@ -541,9 +572,16 @@ CharactersPerAccount = 50
CharactersPerRealm = 10 CharactersPerRealm = 10
SkipCinematics = 0 SkipCinematics = 0
MaxPlayerLevel = 80 MaxPlayerLevel = 80
MaxHonorPoints = 75000
MaxArenaPoints = 5000
StartPlayerLevel = 1 StartPlayerLevel = 1
StartPlayerMoney = 0
MaxHonorPoints = 75000
StartHonorPoints = 0
MaxArenaPoints = 5000
StartArenaPoints = 0
InstantLogout = 1
DisableWaterBreath = 4
AllFlightPaths = 0
AlwaysMaxSkillForLevel = 0
ActivateWeather = 1 ActivateWeather = 1
Battleground.CastDeserter = 1 Battleground.CastDeserter = 1
Battleground.QueueAnnouncer.Enable = 1 Battleground.QueueAnnouncer.Enable = 1
@ -804,15 +842,20 @@ Channel.SilentlyGMJoin = 0
# Default: 1 (include) # Default: 1 (include)
# 0 (not include) # 0 (not include)
# #
# GM.StartLevel
# GM starting level (1-255)
# Default: 1
#
################################################################################################################### ###################################################################################################################
GM.LoginState = 2 GM.LoginState = 2
GM.AcceptTickets = 2 GM.AcceptTickets = 2
GM.Chat = 2 GM.Chat = 2
GM.WhisperingTo = 2 GM.WhisperingTo = 2
GM.InGMList = 0 GM.InGMList = 0
GM.InWhoList = 0 GM.InWhoList = 0
GM.LogTrade = 1 GM.LogTrade = 1
GM.StartLevel = 1
################################################################################################################### ###################################################################################################################
# VISIBILITY AND RADIUSES # VISIBILITY AND RADIUSES

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "6856" #define REVISION_NR "6863"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -422,7 +422,7 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\game\LinkedList.h" RelativePath="..\..\src\framework\Utilities\LinkedList.h"
> >
</File> </File>
<File <File

View file

@ -424,7 +424,7 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\game\LinkedList.h" RelativePath="..\..\src\framework\Utilities\LinkedList.h"
> >
</File> </File>
<File <File