diff options
author | KingPin <none@none> | 2008-11-05 20:10:19 -0600 |
---|---|---|
committer | KingPin <none@none> | 2008-11-05 20:10:19 -0600 |
commit | 8d331f2b10cff29ee0571f7056ad353df6a3eabd (patch) | |
tree | 36ef334fec8d6a55f151d40ca5e709880346c219 /src/game/Guild.cpp | |
parent | 404f72c7a2e9c230156e51f8013993b3c8f03d93 (diff) |
[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
Diffstat (limited to 'src/game/Guild.cpp')
-rw-r--r-- | src/game/Guild.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 9d17b175abc..2fafd68bb8c 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -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); |