public static void HandleChallengeAnswer(GameRolePlayPlayerFightFriendlyAnswerMessage message, WorldClient client)
        {
            if (client.Character.IsFighting)
            {
                return;
            }
            FightDual fight    = FightProvider.Instance.GetFight(message.fightId) as FightDual;
            var       sMessage = new GameRolePlayPlayerFightFriendlyAnsweredMessage(message.fightId, (uint)client.Character.Id, (uint)fight.InitiatorId, false);

            if (client.Character.Id == fight.InitiatorId)
            {
                var acceptor = WorldServer.Instance.GetOnlineClient(fight.AcceptorId);
                acceptor.Send(sMessage);
                return;
            }
            WorldClient target = WorldServer.Instance.GetOnlineClient((fight.InitiatorId));

            if (message.accept)
            {
                sMessage.accept = true;
                target.Send(sMessage);
                fight.BlueTeam.AddFighter(client.Character.CreateFighter(fight.BlueTeam));
                fight.RedTeam.AddFighter(target.Character.CreateFighter(fight.RedTeam));
                fight.StartPlacement();
            }
            else
            {
                target.Send(sMessage);
                FightProvider.Instance.RemoveFight(message.fightId);
            }
        }
Esempio n. 2
0
        public FightDual CreateFightGvG(MapRecord record)
        {
            FightTeam blueteam = new FightTeam((sbyte)TeamEnum.TEAM_DEFENDER, record.BlueCells, AlignmentSideEnum.ALIGNMENT_WITHOUT, TeamTypeEnum.TEAM_TYPE_PLAYER);
            FightTeam redteam  = new FightTeam((sbyte)TeamEnum.TEAM_CHALLENGER, record.RedCells, AlignmentSideEnum.ALIGNMENT_WITHOUT, TeamTypeEnum.TEAM_TYPE_PLAYER);
            var       fight    = new FightDual(record, blueteam, redteam, 0);

            Fights.Add(fight);
            return(fight);
        }
Esempio n. 3
0
        public FightDual CreateFightDual(Character source, Character target, short cellId)
        {
            FightTeam blueteam = new FightTeam((sbyte)TeamEnum.TEAM_DEFENDER, source.Map.BlueCells, AlignmentSideEnum.ALIGNMENT_WITHOUT, TeamTypeEnum.TEAM_TYPE_PLAYER);
            FightTeam redteam  = new FightTeam((sbyte)TeamEnum.TEAM_CHALLENGER, source.Map.RedCells, AlignmentSideEnum.ALIGNMENT_WITHOUT, TeamTypeEnum.TEAM_TYPE_PLAYER);
            var       fight    = new FightDual(source.Map, blueteam, redteam, cellId);

            Fights.Add(fight);
            return(fight);
        }
Esempio n. 4
0
        public FightDual CreateDualFight(MapRecord map, short fightcellid, short secondplayercellid)
        {
            FightTeam blueteam = new FightTeam(0, map.BlueCells, TeamColorEnum.BLUE_TEAM, TeamTypeEnum.TEAM_TYPE_PLAYER);
            FightTeam redteam  = new FightTeam(1, map.RedCells, TeamColorEnum.RED_TEAM, TeamTypeEnum.TEAM_TYPE_PLAYER);
            var       fight    = new FightDual(PopNextFightId(), map, blueteam, redteam, fightcellid, secondplayercellid);

            m_worldFights.Add(fight);
            return(fight);
        }
Esempio n. 5
0
        protected override void OnAccept()
        {
            Source.Client.Send(new GameRolePlayPlayerFightFriendlyAnsweredMessage((int)base.Target.Id, (ulong)base.Source.Id,
                                                                                  (ulong)base.Target.Id, true));

            FightDual fight = FightProvider.Instance.CreateFightDual(Source, Target, (short)Source.CellId);

            fight.RedTeam.AddFighter(Target.CreateFighter(fight.RedTeam));

            fight.BlueTeam.AddFighter(Source.CreateFighter(fight.BlueTeam));

            fight.StartPlacement();
        }
        public static void HandleChallengeRequest(GameRolePlayPlayerFightRequestMessage message, WorldClient client)
        {
            if (client.Character.Map != null && client.Character.Map.HaveZaap)
            {
                client.Character.Reply("Action impossible sur cette carte.");
                return;
            }
            WorldClient target = WorldServer.Instance.GetOnlineClient((int)message.targetId);

            if (target.Character.Busy)
            {
                client.Character.Reply("Impossible car le joueur est occupé.");
                return;
            }
            if (message.friendly)
            {
                FightDual fight = FightProvider.Instance.CreateDualFight(client.Character.Map, client.Character.Record.CellId, message.targetCellId);
                fight.InitiatorId = client.Character.Id;
                fight.AcceptorId  = target.Character.Id;
                Message sMessage = new GameRolePlayPlayerFightFriendlyRequestedMessage(fight.Id, (uint)client.Character.Id, message.targetId);
                client.Send(sMessage);
                target.Send(sMessage);
            }
        }