public bool Leave(Character chr) { lock (this.JoinLock) { if (chr.Asda2FactionId == (short)0) { if (!this.LightTeam.ContainsValue(chr)) { return(false); } this.LightTeam.Remove(chr.CurrentBattleGroundId); this.FreeLightIds.Add(chr.CurrentBattleGroundId); chr.CurrentBattleGround = (Asda2Battleground)null; chr.Map.CallDelayed(1, (Action)(() => { Asda2BattlegroundHandler.SendHowManyPeopleInWarTeamsResponse(this, (Character)null); Asda2BattlegroundHandler.SendCharacterHasLeftWarResponse(this, (int)chr.AccId, chr.CurrentBattleGroundId, chr.Name, (int)chr.Asda2FactionId); })); if (chr.MapId == MapId.BatleField) { chr.TeleportTo((IWorldLocation)chr.LocatonBeforeOnEnterWar); } if (chr.IsStunned) { --chr.Stunned; } return(true); } if (chr.Asda2FactionId != (short)1 || !this.DarkTeam.ContainsValue(chr)) { return(false); } this.DarkTeam.Remove(chr.CurrentBattleGroundId); this.FreeDarkIds.Add(chr.CurrentBattleGroundId); chr.CurrentBattleGround = (Asda2Battleground)null; chr.Map.CallDelayed(1, (Action)(() => { Asda2BattlegroundHandler.SendHowManyPeopleInWarTeamsResponse(this, (Character)null); Asda2BattlegroundHandler.SendCharacterHasLeftWarResponse(this, (int)chr.AccId, chr.CurrentBattleGroundId, chr.Name, (int)chr.Asda2FactionId); })); if (chr.MapId == MapId.BatleField) { chr.TeleportTo((IWorldLocation)chr.LocatonBeforeOnEnterWar); } if (chr.IsStunned) { --chr.Stunned; } return(true); } }
public bool Leave(Character chr) { lock (JoinLock) { chr.IsOnWar = false; if (chr.Asda2FactionId == 0) //light { if (!LightTeam.ContainsValue(chr)) { return(false); } LightTeam.Remove(chr.CurrentBattleGroundId); FreeLightIds.Add(chr.CurrentBattleGroundId); chr.CurrentBattleGround = null; chr.Map.CallDelayed(1, () => { Asda2BattlegroundHandler.SendHowManyPeopleInWarTeamsResponse(this); Asda2BattlegroundHandler.SendCharacterHasLeftWarResponse(this, (int) chr.AccId, chr. CurrentBattleGroundId, chr.Name, chr. Asda2FactionId); }); if (chr.MapId == MapId.BatleField) { chr.TeleportTo(chr.LocatonBeforeOnEnterWar); } if (chr.IsStunned) { chr.Stunned--; } return(true); } if (chr.Asda2FactionId == 1) //Dark { if (!DarkTeam.ContainsValue(chr)) { return(false); } DarkTeam.Remove(chr.CurrentBattleGroundId); FreeDarkIds.Add(chr.CurrentBattleGroundId); chr.CurrentBattleGround = null; chr.Map.CallDelayed(1, () => { Asda2BattlegroundHandler.SendHowManyPeopleInWarTeamsResponse(this); Asda2BattlegroundHandler.SendCharacterHasLeftWarResponse(this, (int) chr.AccId, chr. CurrentBattleGroundId, chr.Name, chr. Asda2FactionId); }); if (chr.MapId == MapId.BatleField) { chr.TeleportTo(chr.LocatonBeforeOnEnterWar); } if (chr.IsStunned) { chr.Stunned--; } return(true); } return(false); } }