Ejemplo n.º 1
0
        private void GiveRewards()
        {
            var playersIn = _players
                            .Where(x => x.Eventer);

            PlayerEventInfo winner = null;

            if (playersIn.Count() != 0)
            {
                winner = playersIn.OrderByDescending(x => x.Score/100*2+x.Score%100).First();
                var wXP = ChaosCastles.MonsterKillExp[Index - 1] * (winner.Score / 100);
                wXP += ChaosCastles.PlayerKillExp[Index - 1] * (winner.Score % 100);
                winner.Player.Session.SendAsync(new SBloodCastleReward()
                {
                    Winner = 1,
                    Type = 0xFE,
                    ScoreTable = new BCScore[] {
                                    new BCScore {
                                     Name = winner.Player.Character.Name,
                                     Score = winner.Score/100,
                                     Experience = wXP,
                                     Zen = winner.Score%100,
                                    }
                                }
                })
                    .Wait();

                winner.Player.Character.Experience += (ulong)wXP;
                winner.Player.Session.SendAsync(new SKillPlayer(0xffff, (ushort)wXP, 0)).Wait();
                winner.Player.Character.Money += (uint)(_recaudation * 0.8f);
            }

            var losers = _players.Where(x => x != winner);
            foreach (var l in losers)
            {
                if (l.Eventer)
                {
                    l.Player.Character
                        .WarpTo(22)
                        .Wait();
                }

                var XP = ChaosCastles.MonsterKillExp[Index - 1] * (winner.Score / 100);
                XP += ChaosCastles.PlayerKillExp[Index - 1] * (winner.Score % 100);

                l.Player.Session.SendAsync(new SBloodCastleReward()
                {
                    Winner = 0,
                    Type = 0xFE,
                    ScoreTable = new BCScore[] {
                                    new BCScore {
                                     Name = winner.Player.Character.Name,
                                     Score = winner.Score/100,
                                     Experience = XP,
                                     Zen = winner.Score%100,
                                    }
                                }
                })
                .Wait();

                l.Player.Character.Experience += (ulong)XP;
            }

            foreach (var mob in _ccMonsters)
                mob.Active = false;

            SendSatus(7);
            
            _recaudation = 0;
            Trigger(EventState.Closed, TimeSpan.FromMinutes(1));
        }