public Alliance(AllianceRecord record) { this.Record = record; this.Emblem = new AllianceEmblem(this.Record); foreach (var item in Singleton <GuildManager> .Instance.GetGuildsByAlliance(this.Record)) { item.SetAlliance(this); this.m_guilds.Add(item.Id, item); if (this.Record.Owner == item.Id) { this.SetBoss(item); } } if (this.Boss == null) { if (this.m_guilds.Count == 0) { } else { this.SetBoss(this.m_guilds.First().Value); } } }
private static void BuildDB() { UserRecord u = new UserRecord(); u.Drop(); u.Create(); AllianceRecord a = new AllianceRecord(); a.Drop(); a.Create(); PlanetRecord p = new PlanetRecord(); p.Drop(); p.Create(); ReportRecord r = new ReportRecord(); r.Drop(); r.Create(); ResourceRecord res = new ResourceRecord(); res.Drop(); res.Create(); BuildingRecord b = new BuildingRecord(); b.Drop(); b.Create(); ResearchRecord re = new ResearchRecord(); re.Drop(); re.Create(); FleetRecord f = new FleetRecord(); f.Drop(); f.Create(); DefenceRecord d = new DefenceRecord(); d.Drop(); d.Create(); }
public static void HandleAllianceKickRequest(AllianceKickRequestMessage message, WorldClient client) { if (client.Character.HasAlliance && AllianceProvider.GetLeader(client.Character.AllianceId).Id == client.Character.GuildId && GuildProvider.GetLeader(client.Character.GuildId).CharacterId == client.Character.Id) { AllianceRecord.GetAlliance(client.Character.AllianceId).KickFromAlliance((int)message.kickedId, client); } }
public static void HandleGetAllianceInformations(AllianceInsiderInfoRequestMessage message, WorldClient client) { AllianceRecord Alliance = client.Character.GetAlliance(); AllianceInsiderInfoMessage msg = AllianceProvider.GetAllianceInsiderInfoMessage(Alliance); client.Send(msg); }
public static bool CanCreateAlliance(WorldClient client, AllianceCreationValidMessage message) { if (!client.Character.HasGuild) { client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_LEAVE)); return(false); } if (client.Character.HasAlliance) { client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_ALREADY_IN_GUILD)); return(false); } if (message.allianceTag.Length < 3 || message.allianceTag.Length > 5) { client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET)); return(false); } if (AllianceRecord.NameTaked(message.allianceName) || AllianceRecord.TagTaked(message.allianceTag)) { client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_NAME_ALREADY_EXISTS)); return(false); } if (GuildRecord.GetGuild(client.Character.GuildId).GetLeader().CharacterId != client.Character.Id) { client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET)); return(false); } return(true); }
// CONSTRUCTORS public AllianceEmblem(AllianceRecord record) { this.Record = record; if (this.SymbolShape != 0) { this.Template = Singleton <AllianceManager> .Instance.TryGetEmblem((int)this.SymbolShape); } }
public IEnumerable <Guild> GetGuildsByAlliance(AllianceRecord alliance) { lock (this.m_lock) { return(this.m_guilds.Values .Where(entry => entry.Record.AllianceId == alliance.Id)); } }
public static AllianceRecord CreateAlliance(GuildRecord creator, string tag, string name, GuildEmblem emblem) { AllianceRecord Alliance = new AllianceRecord(AllianceRecord.PopNextId(), name, tag, emblem.symbolColor, emblem.symbolShape, emblem.backgroundShape, emblem.backgroundColor, creator.Id); Alliance.AddElement(); JoinAlliance(creator, Alliance, null); return(Alliance); }
public void LeaveGuild(Character character) { CharacterGuildRecord.GetCharacterGuild(character.Id).RemoveElement(); character.HumanOptions.RemoveAll(x => x is HumanOptionGuild); character.Client.Send(new GuildLeftMessage()); AllianceRecord.OnCharacterLeftAlliance(character); character.RefreshOnMapInstance(); character.ForgetEmote(GuildProvider.EMOTE_ID); }
public static void LeaveAlliance(int guildId) { GuildAllianceRecord AllianceMember = GuildAllianceRecord.GuildsAlliances.Find(x => x.GuildId == guildId); List <CharacterGuildRecord> guildMembers = CharacterGuildRecord.CharactersGuilds.FindAll(x => x.GuildId == guildId); foreach (CharacterGuildRecord guildMember in guildMembers) { Character record = WorldServer.Instance.GetOnlineClient(guildMember.CharacterId).Character; AllianceRecord.OnCharacterLeftAlliance(record); } AllianceMember.RemoveElement(); }
public static void DeleteAlliance(int id) { AllianceRecord Alliance = AllianceProvider.GetAlliance(id); List <GuildAllianceRecord> AllianceMembers = GuildAllianceRecord.GuildsAlliances.FindAll(x => x.AllianceId == id); foreach (GuildAllianceRecord member in AllianceMembers) { LeaveAlliance(member.GuildId); member.RemoveElement(); } Alliance.RemoveElement(); }
public static void JoinAlliance(GuildRecord Guild, AllianceRecord Alliance, WorldClient Inviter = null) { GuildAllianceRecord Gmember = new GuildAllianceRecord(Guild.Id, Alliance.Id); Gmember.AddElement(); if (Inviter != null) { Inviter.Send(new AllianceInvitationAnswerMessage(true)); } foreach (CharacterGuildRecord member in CharacterGuildRecord.CharactersGuilds.FindAll(x => x.GuildId == Guild.Id)) { AllianceRecord.OnCharacterJoinAlliance(CharacterRecord.GetCharacterRecordById(member.CharacterId), Alliance); } }
public static void HandleGetGuildInFactRequest(GuildFactsRequestMessage message, WorldClient client) { GuildRecord guild = GuildRecord.GetGuild((int)message.guildId); if (guild == null) { return; } AllianceRecord alliance = AllianceProvider.GetAllianceFromGuild(guild.Id); List <CharacterMinimalInformations> membersMinimalInfos = new List <CharacterMinimalInformations>(); foreach (GuildMember member in CharacterGuildRecord.GetMembers(guild.Id)) { membersMinimalInfos.Add(new CharacterMinimalInformations(member.id, member.level, member.name)); } if (alliance == null) { client.Send(new GuildFactsMessage(new GuildFactSheetInformations((uint)guild.Id, guild.Name, guild.GetEmblemObject(), (uint)GuildProvider.GetLeader(guild.Id).CharacterId, (byte)guild.Level, (ushort)CharacterGuildRecord.GetMembers(guild.Id).Count()), 0, 0, true, (IEnumerable <CharacterMinimalInformations>)membersMinimalInfos)); } else { client.Send(new GuildInAllianceFactsMessage(new GuildFactSheetInformations((uint)guild.Id, guild.Name, guild.GetEmblemObject(), (uint)GuildProvider.GetLeader(guild.Id).CharacterId, (byte)guild.Level, (ushort)CharacterGuildRecord.GetMembers(guild.Id).Count()), 0, 0, true, (IEnumerable <CharacterMinimalInformations>)membersMinimalInfos, new BasicNamedAllianceInformations((uint)alliance.Id, alliance.Tag, alliance.Name))); } }
public AllianceRecord GetAlliance() { return(HasAlliance ? AllianceRecord.GetAlliance(AllianceId) : null); }
public static AllianceInsiderInfoMessage GetAllianceInsiderInfoMessage(AllianceRecord alliance) { return(new AllianceInsiderInfoMessage(new DofusProtocol.Types.AllianceFactSheetInformations((uint)alliance.Id, alliance.Tag, alliance.Name, new DofusProtocol.Types.GuildEmblem(alliance.SymbolShape, alliance.SymbolColor, alliance.BackgroundShape, alliance.BackgroundColor), DateTime.Now.Second), AllianceProvider.GetGuildsInsiderFactSheetInformations(alliance.Id), (IEnumerable <PrismSubareaEmptyInfo>) new List <PrismSubareaEmptyInfo>())); }
public static GuildRecord GetLeader(int allianceId) { AllianceRecord alliance = GetAlliance(allianceId); return(GuildRecord.GetGuild(alliance.LeaderGuildId)); }