public void OnEnter(L2Player player) { player.Clan = this; ClanMember member = Members.FirstOrDefault(m => m.ObjId == player.ObjId); if (member != null) { member.Online = 1; member.Level = player.Level; member.Target = player; } if (LeaderId == player.ObjId) { player.ClanPrivs = CpAll; } player.SendPacket(new PledgeShowMemberListAll(this, EClanType.ClanMain)); GetAllSubs().ForEach(sub => { player.SendPacket(new PledgeReceiveSubPledgeCreated(sub)); player.SendPacket(new PledgeShowMemberListAll(this, sub.Type)); }); }
public void Leave(L2Player player) { if (player.ObjId == LeaderId) { player.SendSystemMessage(SystemMessage.SystemMessageId.ClanLeaderCannotWithdraw); return; } EClanType type = IsSubLeader(player.ObjId, new[] { EClanType.ClanKnight1, EClanType.ClanKnight2, EClanType.ClanKnight3, EClanType.ClanKnight4, EClanType.ClanKnight5, EClanType.ClanKnight6 }); if (type != EClanType.None) { if (GetClanMemberCount(type, player.ObjId) > 0) { player.SendMessage("You are leader of clan sub unit, and while there some members - you cant leave them."); return; } } SystemMessage sm = new SystemMessage(SystemMessage.SystemMessageId.S1HasWithdrawnFromTheClan); sm.AddPlayerName(player.Name); BroadcastToOnline(sm); ClanMember cm = Members.FirstOrDefault(member => member.ObjId == player.ObjId); if (cm != null) { lock (Members) Members.Remove(cm); } player.Clan = null; player.ClanId = 0; player.ClanPrivs = 0; player.ClanType = 0; player.Title = string.Empty; player.SendSystemMessage(SystemMessage.SystemMessageId.YouHaveWithdrawnFromClan); player.SendPacket(new PledgeShowMemberListDeleteAll()); player.BroadcastUserInfo(); player.setPenalty_ClanJoin(DateTime.Now.AddHours(24), false); player.SendSystemMessage(SystemMessage.SystemMessageId.YouMustWaitBeforeJoiningAnotherClan); // player.updateDb(); }
public void AddMember(L2Player player, short type) { ClanMember cm = new ClanMember { ClassId = (byte)player.ActiveClass.ClassId.Id, Level = player.Level, Name = player.Name, ObjId = player.ObjId, SponsorId = 0, NickName = player.Title, ClanType = type, PledgeTypeName = Name, Target = player }; Members.Add(cm); player.Clan = this; player.ClanType = type; }