public static Guild CreateGuild(eRealm realm, string guildName, GamePlayer creator = null) { if (DoesGuildExist(guildName)) { if (creator != null) creator.Out.SendMessage(guildName + " already exists!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return null; } try { DBGuild dbGuild = new DBGuild(); dbGuild.GuildName = guildName; dbGuild.GuildID = System.Guid.NewGuid().ToString(); dbGuild.Realm = (byte)realm; Guild newguild = new Guild(dbGuild); if (newguild.AddToDatabase() == false) { if (creator != null) { creator.Out.SendMessage("Database error, unable to add a new guild!", eChatType.CT_System, eChatLoc.CL_SystemWindow); } return null; } AddGuild(newguild); CreateRanks(newguild); if (log.IsDebugEnabled) log.Debug("Create guild; guild name=\"" + guildName + "\" Realm=" + GlobalConstants.RealmToName(newguild.Realm)); return newguild; } catch (Exception e) { if (log.IsErrorEnabled) log.Error("CreateGuild", e); return null; } }
/// <summary> /// Creates an empty Guild. Don't use this, use /// GuildMgr.CreateGuild() to create a guild /// </summary> public Guild(DBGuild dbGuild) { this.m_DBguild = dbGuild; bannerStatus = "None"; }