/// <summary> /// Adds a new arena team member /// Calls ArenaTeamMgr.OnJoinTeam /// </summary> /// <param name="chr">character to add</param> /// <returns>ArenaTeamMember of new member</returns> public ArenaTeamMember AddMember(CharacterRecord chr) { ArenaTeamMember newMember; if (Members.Count >= Type * 2) { return(null); } SyncRoot.Enter(); try { if (Members.TryGetValue(chr.EntityLowId, out newMember)) { return(newMember); } newMember = new ArenaTeamMember(chr, this, false); newMember.Character.SetArenaTeamInfoField(Slot, ArenaTeamInfoType.ARENA_TEAM_ID, Id); newMember.Character.SetArenaTeamInfoField(Slot, ArenaTeamInfoType.ARENA_TEAM_MEMBER, 1); Members.Add(newMember.Id, newMember); newMember.Create(); Update(); } catch (Exception e) { LogUtil.ErrorException(e, string.Format("Could not add member {0} to arena team {1}", chr, this)); return(null); } finally { SyncRoot.Exit(); } ArenaMgr.RegisterArenaTeamMember(newMember); //ArenaTeamHandler.SendEventToTeam(this, ArenaTeamEvents.JOINED_SS, newMember); return(newMember); }
/// <summary> /// Adds a new arena team member /// Calls ArenaTeamMgr.OnJoinTeam /// </summary> /// <param name="chr">character to add</param> /// <returns>ArenaTeamMember of new member</returns> public ArenaTeamMember AddMember(CharacterRecord chr) { if ((long)this.Members.Count >= (long)(this.Type * 2U)) { return((ArenaTeamMember)null); } this.SyncRoot.Enter(); ArenaTeamMember atm; try { if (this.Members.TryGetValue(chr.EntityLowId, out atm)) { return(atm); } atm = new ArenaTeamMember(chr, this, false); atm.Character.SetArenaTeamInfoField(this.Slot, ArenaTeamInfoType.ARENA_TEAM_ID, this.Id); atm.Character.SetArenaTeamInfoField(this.Slot, ArenaTeamInfoType.ARENA_TEAM_MEMBER, 1U); this.Members.Add(atm.Id, atm); atm.Create(); this.Update(); } catch (Exception ex) { LogUtil.ErrorException(ex, string.Format("Could not add member {0} to arena team {1}", (object)chr, (object)this), new object[0]); return((ArenaTeamMember)null); } finally { this.SyncRoot.Exit(); } ArenaMgr.RegisterArenaTeamMember(atm); return(atm); }