[svn] * Avoid access to bag item prototype for getting bag size, use related item update field instead as more fast source.

* Better check client inventory pos data received in some client packets to skip invalid cases.
* Removed some unnecessary database queries.
* Make guid lookup for adding ignore async.
* Added two parameter versions of the AsyncQuery function
* Make queries for adding friends async. - Hunuza
* Replace some PQuery() calls with more simple Query() - Hunuza
* Mark spell as executed instead of deleteable to solve crash.
*** Source mangos.

**Its a big commit. so test with care... or without care.... whatever floats your boat.

--HG--
branch : trunk
This commit is contained in:
KingPin
2008-11-05 20:10:19 -06:00
parent 404f72c7a2
commit 8d331f2b10
27 changed files with 394 additions and 280 deletions

View File

@@ -112,8 +112,17 @@ bool Guild::create(uint64 lGuid, std::string gname)
bool Guild::AddMember(uint64 plGuid, uint32 plRank)
{
if(Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild
Player* pl = objmgr.GetPlayer(plGuid);
if(pl)
{
if(pl->GetGuildId() != 0)
return false;
}
else
{
if(Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild
return false;
}
// remove all player signs from another petitions
// this will be prevent attempt joining player to many guilds and corrupt guild data integrity
@@ -142,7 +151,6 @@ 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());
Player* pl = objmgr.GetPlayer(plGuid);
if(pl)
{
pl->SetInGuild(Id);
@@ -676,6 +684,15 @@ void Guild::SetRankRights(uint32 rankId, uint32 rights)
CharacterDatabase.PExecute("UPDATE guild_rank SET rights='%u' WHERE rid='%u' AND guildid='%u'", rights, (rankId+1), Id);
}
int32 Guild::GetRank(uint32 LowGuid)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr==members.end())
return -1;
return itr->second.RankId;
}
void Guild::Disband()
{
WorldPacket data(SMSG_GUILD_EVENT, 1);