public void removeGuild(Guild guild) { string sql=String.Format("DELETE FROM {0} WHERE ID = '{0}';", GUILDS_TBL_NAME, guild.getId()); mDb.ExecuteNonQuery(sql); }
public Guild createGuild(string name, int playerId) { Guild guild=new Guild(name); // Add guild to db Program.storage.addGuild(guild); // Add guild, and add owner mGuilds.Add(guild); mOwners.Add(playerId); // put the owner in the guild addGuildMember(guild, playerId); // Set and save the member rights Program.storage.setMemberRights(guild.getId(), playerId, (int)GuildAccessLevel.GAL_OWNER); guild.setOwner(playerId); return guild; }
void setUserRights(Guild guild, int playerId, int rights) { // Set and save the member rights Program.storage.setMemberRights(guild.getId(), playerId, rights); // Set with guild guild.setUserPermissions(playerId, rights); }
public void addGuildMember(Guild guild, int playerId) { Program.storage.addGuildMember(guild.getId(), playerId); guild.addMember(playerId, (int)GuildAccessLevel.GAL_NONE); }
public void removeGuildMember(Guild guild, int playerId) { // remove the user from the guild Program.storage.removeGuildMember(guild.getId(), playerId); guild.removeMember(playerId); // if theres no more members left delete the guild if (guild.memberCount() == 0) removeGuild(guild); // remove the user from owners list mOwners.Remove(playerId); }