public void Add( Character c, ushort droit ) { Member m = new Member( c ); m.Droits = droit; members.Add( m ); if ( Count == 1 ) groupLeader = m; else UpdateList(); }
public void Quit( Character c ) { if ( members == null ) return; ArrayList al = new ArrayList(); foreach( Member m in members ) { if ( m.Char == c ) { c.Send( OpCodes.SMSG_GROUP_DESTROYED, c.tempBuff, 4 ); } else { // Console.WriteLine("Stay in group {0}", m.Char.Name ); al.Add( m ); } } members = al; if ( Count > 1 ) { if ( groupLeader.Char == c ) groupLeader = (Member)al[ 0 ]; UpdateList(); } else if ( Count == 1 ) { ( members[ 0 ] as Member ).Char.Send( OpCodes.SMSG_GROUP_DESTROYED, c.tempBuff, 4 ); ( members[ 0 ] as Member ).Char.QuitGroup(); } }
public void PromoteLeader( Character c ) { foreach( Member to in Members ) { int offset = 4; Converter.ToBytes( to.Char.Name, groupLeader.Char.tempBuff, ref offset ); Converter.ToBytes( (byte)0, groupLeader.Char.tempBuff, ref offset ); to.Char.Send( OpCodes.SMSG_GROUP_SET_LEADER, groupLeader.Char.tempBuff, offset ); if ( c == to.Char ) groupLeader = to; } UpdateList(); }