/*public FightInstancePvM CreateCloneFightPvM(Character source, short cellId) * { * * * * * * * * * FightTeam blueTeam = new FightTeam((sbyte)TeamEnum.TEAM_DEFENDER, source.Map.BlueCells, AlignmentSideEnum.ALIGNMENT_WITHOUT, TeamTypeEnum.TEAM_TYPE_MONSTER); * FightTeam redTeam = new FightTeam((sbyte)TeamEnum.TEAM_CHALLENGER, source.Map.RedCells, AlignmentSideEnum.ALIGNMENT_WITHOUT, TeamTypeEnum.TEAM_TYPE_PLAYER); * FreeFightInstancePvM fight = new FreeFightInstancePvM(source.Map, blueTeam, redTeam, new MonsterRecord[0]); * * * var owner = source.CreateFighter(fight.RedTeam); * fight.RedTeam.AddFighter(owner); * fight.BlueTeam.AddFighter(new Symbioz.World.Models.Fights.Fighters.DoubleFighter(owner as Symbioz.World.Models.Fights.Fighters.CharacterFighter, fight.BlueTeam,cellId)); * Fights.Add(fight); * return fight; * } */ public FightAgression CreateFightAgression(Character source, Character target, short cellId) { FightTeam blueteam = new FightTeam((sbyte)TeamEnum.TEAM_DEFENDER, source.Map.BlueCells, source.Record.Alignment.Side, TeamTypeEnum.TEAM_TYPE_PLAYER); FightTeam redteam = new FightTeam((sbyte)TeamEnum.TEAM_CHALLENGER, source.Map.RedCells, target.Record.Alignment.Side, TeamTypeEnum.TEAM_TYPE_PLAYER); var fight = new FightAgression(source.Map, blueteam, redteam, cellId); Fights.Add(fight); return(fight); }
public static void HandleGameRolePlayPlayerFightRequest(GameRolePlayPlayerFightRequestMessage message, WorldClient client) { Character target = client.Character.Map.Instance.GetEntity <Character>((long)message.targetId); if (target != null) { if (message.friendly) { FighterRefusedReasonEnum fighterRefusedReasonEnum = client.Character.CanRequestFight(target); if (fighterRefusedReasonEnum != FighterRefusedReasonEnum.FIGHTER_ACCEPTED) { client.Send(new ChallengeFightJoinRefusedMessage((ulong)client.Character.Id, (sbyte)fighterRefusedReasonEnum)); } else { target.OpenRequestBox(new DualRequest(client.Character, target)); } } else { FighterRefusedReasonEnum fighterRefusedReasonEnum = client.Character.CanAgress(target); if (fighterRefusedReasonEnum != FighterRefusedReasonEnum.FIGHTER_ACCEPTED) { client.Send(new ChallengeFightJoinRefusedMessage((ulong)client.Character.Id, (sbyte)fighterRefusedReasonEnum)); } else { FightAgression fight = FightProvider.Instance.CreateFightAgression(client.Character, target, (short)client.Character.CellId); fight.RedTeam.AddFighter(target.CreateFighter(fight.RedTeam)); fight.BlueTeam.AddFighter(client.Character.CreateFighter(fight.BlueTeam)); fight.StartPlacement(); } } } }