本文整理汇总了C#中Guild.AddMember方法的典型用法代码示例。如果您正苦于以下问题:C# Guild.AddMember方法的具体用法?C# Guild.AddMember怎么用?C# Guild.AddMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild.AddMember方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGuild
/// <summary>
/// Creates new guild with the members from the party.
/// </summary>
/// <param name="party"></param>
/// <exception cref="ArgumentException">
/// Thrown if one of the party members already is in a guild.
/// </exception>
public void CreateGuild(Party party, string name, GuildType type, GuildVisibility visibility)
{
var partyMembers = party.GetMembers();
if (partyMembers.Any(a => a.GuildId != 0))
throw new ArgumentException("One of the party members is in a guild already.");
var leader = party.Leader;
lock (_syncLock)
{
// Add guild
var guild = new Guild();
guild.Name = name;
guild.LeaderName = leader.Name;
guild.Title = "";
guild.EstablishedDate = DateTime.Now;
guild.Server = ChannelServer.Instance.Conf.Channel.ChannelServer;
guild.Type = type;
guild.Visibility = visibility;
guild.IntroMessage = string.Format(Localization.Get("Guild stone for the {0} guild."), guild.Name);
guild.WelcomeMessage = string.Format(Localization.Get("Welcome to the {0} guild!"), guild.Name);
guild.LeavingMessage = string.Format(Localization.Get("You have left the {0} guild."), guild.Name);
guild.RejectionMessage = string.Format(Localization.Get("You have been denied admission to the {0} guild."), guild.Name);
ChannelServer.Instance.Database.AddGuild(guild);
this.LoadGuild(guild);
// Add members
foreach (var creature in partyMembers)
{
var guildMember = new GuildMember();
guildMember.GuildId = guild.Id;
guildMember.CharacterId = creature.EntityId;
guildMember.JoinedDate = DateTime.Now;
guildMember.Application = "";
if (creature != leader)
guildMember.Rank = GuildMemberRank.Member;
ChannelServer.Instance.Database.AddGuildMember(guildMember);
guild.AddMember(guildMember);
creature.Guild = guild;
creature.GuildMember = guildMember;
Send.GuildUpdateMember(creature, guild, guildMember);
}
}
}
示例2: HandlePetitionTurnIn
public static void HandlePetitionTurnIn(IRealmClient client, RealmPacketIn packet)
{
var petitionGuid = packet.ReadEntityId();
var petition = client.ActiveCharacter.Inventory.GetItem(petitionGuid) as PetitionCharter;
var name = petition.Petition.Name;
var type = petition.Petition.Type;
if (petition.Petition.SignedIds.Count < ((uint)type - 1))
{
SendPetitionTurnInResults(client, PetitionTurns.NEED_MORE_SIGNATURES);
return;
}
if (type == PetitionType.Guild && client.ActiveCharacter.IsInGuild)
{
SendPetitionTurnInResults(client, PetitionTurns.ALREADY_IN_GUILD);
return;
}
else if (client.ActiveCharacter.ArenaTeamMember[(uint)ArenaTeamMgr.GetSlotByType((uint)type)] != null)
{
ArenaTeamHandler.SendResult(client, ArenaTeamCommandId.CREATE, name, string.Empty, ArenaTeamResult.ALREADY_IN_ARENA_TEAM);
return;
}
else if (type == PetitionType.Guild && GuildMgr.DoesGuildExist(name))
{
GuildHandler.SendResult(client, GuildCommandId.CREATE, name, GuildResult.NAME_EXISTS);
return;
}
else if (ArenaTeamMgr.DoesArenaTeamExist(name))
{
ArenaTeamHandler.SendResult(client, ArenaTeamCommandId.CREATE, name, string.Empty, ArenaTeamResult.NAME_EXISTS);
return;
}
else
{
petition.Destroy();
if (type == PetitionType.Guild)
{
var guild = new Guild(client.ActiveCharacter.Record, name);
foreach (var chr in petition.Petition.SignedIds)
{
if(chr == 0)
continue;
else
{
var character = World.GetCharacter(chr);
guild.AddMember(character);
}
}
}
else
{
var team = new ArenaTeam(client.ActiveCharacter.Record, name, (uint)type);
foreach (var chr in petition.Petition.SignedIds)
{
if(chr == 0)
continue;
else
{
var character = World.GetCharacter(chr);
team.AddMember(character);
}
}
}
SendPetitionTurnInResults(client, PetitionTurns.OK);
}
}
示例3: Apply
/// <summary>
/// Adds creature to the guild as applicant.
/// </summary>
/// <param name="creature"></param>
/// <param name="guild"></param>
public void Apply(Creature creature, Guild guild, string application)
{
if (guild.HasMember(creature.EntityId))
throw new ArgumentException("Character is already a member of this guild. (" + creature.Name + ", " + guild.Name + ")");
var member = new GuildMember();
member.GuildId = guild.Id;
member.CharacterId = creature.EntityId;
member.Rank = GuildMemberRank.Applied;
member.JoinedDate = DateTime.Now;
member.Application = application;
creature.Guild = guild;
creature.GuildMember = member;
guild.AddMember(member);
ChannelServer.Instance.Database.AddGuildMember(member);
}