Exemple #1
0
        public ActionResult Index(PlayerDetail obj)

        {
            //var errors = ModelState.Values.SelectMany(v => v.Errors);
            if (ModelState.IsValid)
            {
                try
                {
                    HPLEntities db = new HPLEntities();

                    if (db.PlayerDetails.Any(pd => pd.EmployeeId == obj.EmployeeId))
                    {
                        return(Redirect("/AlreadyRegistered.html"));
                    }
                    string _FileName  = Path.GetFileNameWithoutExtension(obj.UploadedImage.FileName);
                    string _Extension = Path.GetExtension(obj.UploadedImage.FileName);
                    _FileName    = _FileName + "_" + DateTime.Now.ToString("mmddyyyy") + _Extension;
                    obj.ImageUrl = "~/UploadedImages/" + _FileName;
                    _FileName    = Path.Combine(Server.MapPath("~/UploadedImages"), _FileName);
                    obj.UploadedImage.SaveAs(_FileName);

                    db.PlayerDetails.Add(obj);
                    db.SaveChanges();
                    ModelState.Clear();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            //return View(obj);

            return(Redirect("/RegistrationComplete.html"));
        }
        internal void Trigger_OnPlayerChange(PlayerDetail playerDetail, string userToken)
        {
            PlayerSession session = (PlayerSession)PlayerRegistry.GetClientSession(userToken);

            if (session != null)
            {
                IGameServerController_Callback callback = session.CallbackChannel;
                if (callback != null)
                {
                    try
                    {
                        callback.GameServer_OnPlayerChange(playerDetail);
                    } catch (CommunicationException ex) {
                        Console.WriteLine("> Failed trigger event: OnPlayerChange\n" + ex.Message);
                    } catch (TimeoutException ex) {
                        Console.WriteLine("> Failed trigger event: OnPlayerChange\n" + ex.Message);
                    }
                }
                else
                {
                    Console.WriteLine("> Failed trigger event: OnPlayerChange\n" + "callback object null!");
                }
            }
            else
            {
                Console.WriteLine("> Failed trigger event: OnPlayerChange\n" + "PlayerSession not found!");
            }
        }
        public void Delete(int Id)
        {
            PlayerDetail user = db.PlayerDetails.Find(Id);

            db.PlayerDetails.Remove(user);
            Save();
        }
Exemple #4
0
    public void BuffUpdate()
    {
        PlayerDetail BuffsDetail = new PlayerDetail();

        for (int i = 0; i < Buffs.Count; i++)
        {
            if (!Buffs[i].isStart)
            {
                Buffs[i].Enter();
            }
            if (Buffs[i].lifeTime <= 0)
            {
                Buffs[i].Exit();
                Buffs.Remove(Buffs[i]);
            }
            else
            {
                Buffs[i].lifeTime -= Time.deltaTime;
                Buffs[i].Update();
            }

            BuffsDetail += Buffs[i].buffDetail;
        }

        player.Detail = player.DefaultDetail + BuffsDetail;
        player.Detail.Clamp(0, Mathf.Infinity);
    }
Exemple #5
0
        public PlayerDetail GetPlayerDetail(string fullName)
        {
            var result = new PlayerDetail();
            var series = SeriesManager.GetSerieInfos();

            var events = RoundRespository.GetRoundInformations(series);

            //Add
            foreach (var ev in events)
            {
                var r     = RoundManager.GetRound(ev);
                var score = r.Results.FirstOrDefault(x => x.FullName == fullName);

                if (score != null)
                {
                    result.Events.Add(new Event
                    {
                        EventName   = r.EventName,
                        Time        = r.RoundTime,
                        HcpScore    = score.HcpScore,
                        Hcp         = score.Hcp,
                        Place       = score.Place,
                        RoundPoints = score.Points,
                        Score       = score.Score
                    });

                    if (result.FirstName == null && score.FirstName != null)
                    {
                        result.FirstName = score.FirstName;
                    }
                    if (result.LastName == null && score.LastName != null)
                    {
                        result.LastName = score.LastName;
                    }
                    if (result.PDGANumber == null && score.PDGANumber != null)
                    {
                        result.PDGANumber = score.PDGANumber;
                    }
                }
            }

            //Update
            result.Events.OrderByDescending(x => x.Time).Take(Rule.TotalRounds).ToList().ForEach(x => x.InHcpCalculation = true);
            result.Events.OrderByDescending(x => x.Time).Take(Rule.TotalRounds).OrderBy(x => x.Score).Take(Rule.TakeCountForAvg(result.Events.Count)).ToList().ForEach(x => x.InHcpAvgCalculation = true);

            result.Events = result.Events.OrderByDescending(x => x.Time).ToList();

            double lastHcp = Rule.CalculateHcp(result.Events.Where(x => x.InHcpAvgCalculation).Average(x => x.Score));

            for (int i = 0; i < result.Events.Count; i++)
            {
                result.Events[i].HcpAfterEvent = lastHcp;
                lastHcp = result.Events[i].Hcp;
            }

            return(result);
        }
    public static PlayerDetail operator +(PlayerDetail a, PlayerDetail b)
    {
        PlayerDetail result = new PlayerDetail();

        result.addSpeed   = a.addSpeed + b.addSpeed;
        result.speed      = a.speed + b.speed;
        result.throwPower = a.throwPower + b.throwPower;
        result.handLength = a.handLength + b.handLength;
        return(result);
    }
Exemple #7
0
    public void AddPlayer(int playerId, GameObject player)
    {
        PlayerDetail newPlayer = new PlayerDetail(playerId, player, new RaceStartInput());

        playerDictionary.Add(playerId, newPlayer);
        if (observer != null)
        {
            observer(newPlayer, PlayerDetail.PlayerEvent.NewPlayer);
        }
    }
Exemple #8
0
        public bool Shoot(int x, int y, int force, int angle)
        {
            if (m_shootCount > 0)
            {
                EffectTrigger = false;
                OnPlayerShoot();
                if (EffectTrigger)
                {
                    Game.SendMessage(PlayerDetail, LanguageMgr.GetTranslation("PlayerEquipEffect.Success"), LanguageMgr.GetTranslation("PlayerEquipEffect.Success1", PlayerDetail.PlayerCharacter.NickName), 3);
                }

                if (ShootImp(m_currentBall.ID, x, y, force, angle, m_ballCount))
                {
                    m_shootCount--;

                    if (m_shootCount <= 0 || IsLiving == false)
                    {
                        StopAttacking();

                        AddDelay(m_currentBall.Delay + m_weapon.Property8);
                        AddDander(20);
                        if (CanGetProp)
                        {
                            int             gold       = 0;
                            int             money      = 0;
                            int             giftToken  = 0;
                            int             templateID = 0;
                            List <ItemInfo> infos      = null;
                            if (DropInventory.FireDrop(m_game.RoomType, ref infos))
                            {
                                if (infos != null)
                                {
                                    foreach (ItemInfo info in infos)
                                    {
                                        ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken);
                                        if (info != null)
                                        {
                                            templateID = info.TemplateID;
                                            PlayerDetail.AddTemplate(info, eBageType.FightBag, info.Count);
                                        }
                                    }
                                    PlayerDetail.AddGold(gold);
                                    PlayerDetail.AddMoney(money);
                                    PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_Shoot, PlayerDetail.PlayerCharacter.ID, money, PlayerDetail.PlayerCharacter.Money);
                                    PlayerDetail.AddGiftToken(giftToken);
                                }
                            }
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
        public IHttpActionResult GetPlayerDetail(int id)
        {
            PlayerDetail playerDetail = db.PlayerDetails.Find(id);

            if (playerDetail == null)
            {
                return(NotFound());
            }

            return(Ok(playerDetail));
        }
        public IHttpActionResult PostPlayerDetail(PlayerDetail playerDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PlayerDetails.Add(playerDetail);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = playerDetail.Id }, playerDetail));
        }
Exemple #11
0
 private void ReadyPlayer(PlayerDetail player)
 {
     if (playerReadyState[player.playerId] == true)
     {
         return;
     }
     playerReadyState[player.playerId] = true;
     if (AllPlayersReady())
     {
         startTime = Time.time;
     }
 }
Exemple #12
0
        public override void Reset()
        {
            m_maxBlood = (int)((950 + m_player.PlayerCharacter.Grade * 50 + LevelPlusBlood + m_player.PlayerCharacter.Defence / 10) * m_player.GetBaseBlood());
            if (m_game.RoomType == eRoomType.Treasure || m_game.RoomType == eRoomType.Boss)
            {
                m_game.Cards = new int[21];
            }
            else
            {
                m_game.Cards = new int[8];
            }

            Dander         = 0;
            m_energy       = (m_player.PlayerCharacter.Agility / 30 + 240);
            IsLiving       = true;
            FinishTakeCard = false;
            m_weapon       = m_player.MainWeapon;
            //m_mainBallId = m_weapon.Property1;
            //m_spBallId = m_weapon.Property2;
            var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID);

            m_mainBallId = ballConfig.Common;
            m_spBallId   = ballConfig.Special;
            BaseDamage   = m_player.GetBaseAttack();
            BaseGuard    = m_player.GetBaseDefence();

            Attack  = m_player.PlayerCharacter.Attack;
            Defence = m_player.PlayerCharacter.Defence;
            Agility = m_player.PlayerCharacter.Agility;
            Lucky   = m_player.PlayerCharacter.Luck;

            m_currentBall = BallMgr.FindBall(m_mainBallId);
            m_shootCount  = 1;
            m_ballCount   = 1;

            CurrentIsHitTarget = false;

            TotalCure           = 0;
            TotalHitTargetCount = 0;
            TotalHurt           = 0;
            TotalKill           = 0;
            TotalShootCount     = 0;
            LockDirection       = false;
            GainGP    = 0;
            GainOffer = 0;
            Ready     = false;
            PlayerDetail.ClearTempBag();

            LoadingProcess = 0;

            base.Reset();
        }
Exemple #13
0
    private void EventObserver(PlayerDetail player, PlayerDetail.PlayerEvent playerEvent)
    {
        switch (playerEvent)
        {
        case PlayerDetail.PlayerEvent.NewPlayer:
            AddPlayer(player);
            break;

        case PlayerDetail.PlayerEvent.IsReadyForRace:
            ReadyPlayer(player);
            break;
        }
    }
Exemple #14
0
        public async Task <IEnumerable <PlayerDetail> > GetAll()
        {
            var results = new List <PlayerDetail>();

            // Has to be a better way than to re-calculate the game/player score
            var allPlayers = _gameDataRepository.GetAll <Player>();
            var allScores  = _gameDataRepository.GetAll <Score>();

            foreach (var player in allPlayers)
            {
                var playerScore = allScores
                                  .Where(x => x.PlayerId == player.Id)
                                  .Sum(x => x.Points);

                var playerFantasy = allScores
                                    .Where(x => x.PlayerId == player.Id)
                                    .Sum(x =>
                {
                    // Assume that a fantasy point is incremented by 1 for every score
                    if (x.Points >= 3)
                    {
                        return(5);
                    }
                    else if (x.Points >= 2)
                    {
                        return(2);
                    }
                    else
                    {
                        // Free throws are worth nothing
                        return(0);
                    }
                });

                var playerDetail = new PlayerDetail
                {
                    Id       = player.Id,
                    Name     = player.Name,
                    Position = player.Position,
                    TeamId   = player.TeamId,

                    TotalPoints = playerScore,

                    FantasyPoints = playerFantasy,
                };

                results.Add(playerDetail);
            }

            return(await Task.FromResult(results));
        }
        public IHttpActionResult DeletePlayerDetail(int id)
        {
            PlayerDetail playerDetail = db.PlayerDetails.Find(id);

            if (playerDetail == null)
            {
                return(NotFound());
            }

            db.PlayerDetails.Remove(playerDetail);
            db.SaveChanges();

            return(Ok(playerDetail));
        }
        static async Task RunAsync(object e)
        {
            PlayerDetail      playerDetail     = new PlayerDetail();
            JournalItem       journalItem      = new JournalItem();
            DummyNotification notificationItem = new DummyNotification();

            try
            {
                using (var context = new DummyEntities())
                {
                    if (e is PlayerDetail)
                    {
                        playerDetail     = (PlayerDetail)e;
                        journalItem      = null;
                        notificationItem = null;
                    }
                    else if (e is JournalItem)
                    {
                        journalItem      = (JournalItem)e;
                        playerDetail     = null;
                        notificationItem = null;
                    }
                    else if (e is DummyNotification)
                    {
                        notificationItem = (DummyNotification)e;
                        playerDetail     = null;
                        journalItem      = null;
                    }

                    // TODO: Add UserEventNotification changes here as well. On insert we will call the CheckforOTWNotifications under D:\Qasir Data\Dummy\DummyAPI\Dummy.NotificationServices\Helpers\DummyNotificationProcessor.cs
                    // TODO: Add MatchStateNotification changes here as well. On insert we will call the CheckforMatchStateNotifications under D:\Qasir Data\Dummy\DummyAPI\Dummy.NotificationServices\Helpers\DummyNotificationProcessor.cs

                    List <PlayerJournalDTO> PlayerJournalDTOList = new List <PlayerJournalDTO>();
                    PlayerJournalDTOList.Add(new PlayerJournalDTO()
                    {
                        PlayerDetail = playerDetail, JournalItem = journalItem, DummyNotification = notificationItem
                    });

                    var url = await PostsAsync(PlayerJournalDTOList);


                    Console.WriteLine($"Created at {url}");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        internal void BroadcastToPlayers_PlayerStatus(string userToken)
        {
            Console.WriteLine("> Broadcasting to Players: @userToken:{" + userToken + "} status change");
            PlayerDetail  pd = null;
            PlayerSession ps = (PlayerSession)PlayerRegistry.GetClientSession(userToken);

            if (ps != null)
            {
                pd = ps.ExportToPlayerDetail();
            }

            foreach (KeyValuePair <string, ClientSession> kvp in PlayerRegistry)
            {
                Trigger_OnPlayerChange(pd, kvp.Key);
            }
        }
        public string Insert(PlayerDetail user)
        {
            var errorMessage = String.Empty;

            try
            {
                db.PlayerDetails.Add(user);
                db.SaveChanges();
                return(errorMessage);
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
                return(errorMessage);
            }
        }
Exemple #19
0
        public void GameServer_OnPlayerChange(PlayerDetail playerDetail)
        {
            if (playerDetail != null)
            {
                PlayerList.PlayerDetailList.Add(playerDetail);
            }

            if (WinLobby != null)
            {
                WinLobby.TriggerRefresh();
            }
            if (WinGame != null)
            {
                WinGame.TriggerRefresh();
            }
        }
        public void Handle(ISecurityContext securityContext, ScoreChangeEvent eventInstance)
        {
            // Whenever a score changes, this effects other calculations
            // Using the event-driven framework - ensure that each calculation(aggregate) is updated as well

            var playerDetail = _readCacheDataRepository.FirstOrDefault <PlayerDetail>(x => x.Id == eventInstance.PlayerId);

            if (playerDetail.IsNull())
            {
                playerDetail = new PlayerDetail
                {
                    Id          = eventInstance.PlayerId.GetValueOrDefault(),
                    Name        = eventInstance.PlayerName,
                    TeamId      = eventInstance.TeamId.GetValueOrDefault(),
                    Position    = eventInstance.PlayerPosition,
                    TotalPoints = 0,
                };
                using (var writeContext = _readCacheDataRepository.BeginWrite())
                {
                    writeContext.Insert(playerDetail);
                }
            }

            // For each score, increment the total points

            playerDetail.TotalPoints += eventInstance.Points.GetValueOrDefault();

            // Save in local repository

            using (var writeContext = _readCacheDataRepository.BeginWrite())
            {
                writeContext.Update(playerDetail);
            }

            // Publish new event of player detail update

            _eventPublisher.Publish(
                new PlayerDetailChangeEvent
            {
                Id          = playerDetail.Id,
                Name        = playerDetail.Name,
                TeamId      = playerDetail.TeamId,
                Position    = playerDetail.Position,
                TotalPoints = playerDetail.TotalPoints,
            }
                );
        }
    public override string doQuery(object param)
    {
        ParamQueryPlayer p    = (ParamQueryPlayer)param;
        bool             cres = createGMUser(p);

        if (!cres)
        {
            return(Helper.genJsonStr(m_retData));
        }
        if (!p.checkSign(m_gmUser))
        {
            m_retData.Add("result", RetCode.RET_SIGN_ERROR);
            return(Helper.genJsonStr(m_retData));
        }

        PlayerDetail player = new PlayerDetail(p.m_playerAcc, m_gmUser);

        if (!player.m_isExists)
        {
            m_retData.Add("result", RetCode.RET_NO_PLAYER);
            return(Helper.genJsonStr(m_retData));
        }

        if (!player.isOwner(m_gmUser.m_acc))
        {
            m_retData.Add("result", RetCode.RET_NO_RIGHT);
            return(Helper.genJsonStr(m_retData));
        }

        m_retData.Add("result", RetCode.RET_SUCCESS);
        m_retData.Add("playerAcc", p.m_playerAcc);

        double remainMoney = Helper.showMoneyValue(player.isInGame() ? player.m_moneyOnline : player.m_money);

        m_retData.Add("money", remainMoney);
        //m_retData.Add("moneyType", player.m_moneyType);
        m_retData.Add("state", player.m_state);
        m_retData.Add("createTime", player.m_createTime);

        return(Helper.genJsonStr(m_retData));
    }
        public async Task SearchPlayerAsync([Remainder] string player_tag)
        {
            PlayerDetail selectedPlayer = null;

            try
            {
                selectedPlayer = await _clashClient.Players.GetAsync(player_tag);
            } catch (ClashOfClansException ex)
            {
                Console.WriteLine(ex.Error);
            }

            if (selectedPlayer == null)
            {
                await ReplyAsync($"Clan with tag {player_tag} could not be found");

                return;
            }

            _playerInfo.Player = selectedPlayer;
            await ReplyAsync("", false, _playerInfo.BuildPlayerInfo());
        }
Exemple #23
0
 public override void Execute(PlayerDetail player)
 {
     playerMovement = player.body.GetComponent<PlayerMovement>();
     bool ready = player.input.leftButton && player.input.rightButton;
     if (ready)
     {
         Hover();
         player.observer(player, PlayerDetail.PlayerEvent.IsReadyForRace);
     }
     else
     {
         if (player.input.rightButton)
         {
             playerMovement.JumpRight();
         }
         else if (player.input.leftButton)
         {
             playerMovement.JumpLeft();
         }
         player.input.leftButton = player.input.rightButton = false;
     }
 }
Exemple #24
0
 public async Task <List <Model.ViewModel.Player> > GetAllPlayers()
 {
     return(mapper.Map <List <Model.ViewModel.Player> >(await PlayerDetail.GetAllAsync()));
 }
 private void Start()
 {
     Init();
     Detail = DefaultDetail;
 }
Exemple #26
0
 PlayerDetail ToPlayerDetail(XmlNode node, ref string errorString)
 {
     try
     {
         PlayerDetail player = null;
         if (node != null)
         {
             player = new PlayerDetail();
             player.UserName = node["UserName"].InnerText;
             player.FirstName = node["FirstName"].InnerText;
             player.MiddleName = node["MiddleName"].InnerText;
             player.LastName = node["LastName"].InnerText;
             player.Active = ToBooleanResult(node["Active"].InnerText, ref errorString);
             return player;
         }
     }
     catch (Exception ex)
     {
         errorString = ex.Message;
     }
     return null;
 }
Exemple #27
0
 public abstract void Execute(PlayerDetail player);
Exemple #28
0
        public bool Shoot(int x, int y, int force, int angle)
        {
            if (m_shootCount > 0)
            {
                EffectTrigger = false;
                OnPlayerShoot();
                if (EffectTrigger)
                {
                    Game.SendMessage(PlayerDetail, LanguageMgr.GetTranslation("PlayerEquipEffect.Success"), LanguageMgr.GetTranslation("PlayerEquipEffect.Success1", PlayerDetail.PlayerCharacter.NickName), 3);
                }

                //trminhpc +2=110; +50=85; +40=80; +30=70; +20=55; +10=50
                int max_energy     = m_player.PlayerCharacter.Agility / 30 + 240;
                int energy_use     = (max_energy - Energy);
                int currentBall_id = m_currentBall.ID;
                if (m_ballCount == 1 && !IsSpecialSkill &&
                    (energy_use == 220 || energy_use == 270 || energy_use == 275 || energy_use == 290 || energy_use == 300 || energy_use == 305) &&
                    (ShootCount > 3 || (m_shootCountUp > 2 && ShootCount == 3) ||
                     (m_shootCountUp > 3 && ShootCount == 2) ||
                     (m_shootCountUp > 4 && ShootCount == 1)))
                {
                    currentBall_id = m_MultiBallId;
                }
                else if (m_ballCount == 1 && !IsSpecialSkill && ShootCount == 1 && m_shootCountUp == 1 &&
                         (energy_use == 170 || energy_use == 220 || energy_use == 225 || energy_use == 240 || energy_use == 250 || energy_use == 255 || energy_use == 305))
                {
                    currentBall_id = m_AddWoundBallId;
                }
                //End Special Effect ^^

                if (ShootImp(currentBall_id, x, y, force, angle, m_ballCount, ShootCount))
                {
                    m_shootCount--;
                    m_shootCountUp++;
                    if (m_shootCount <= 0 || IsLiving == false)
                    {
                        StopAttacking();
                        m_shootCountUp = 1;
                        AddDelay(m_currentBall.Delay + m_weapon.Property8);
                        AddDander(20);
                        if (CanGetProp)
                        {
                            int             gold      = 0;
                            int             money     = 0;
                            int             giftToken = 0;
                            int             medal     = 0;
                            List <ItemInfo> infos     = null;
                            if (DropInventory.FireDrop(m_game.RoomType, ref infos))
                            {
                                if (infos != null)
                                {
                                    foreach (ItemInfo info in infos)
                                    {
                                        ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken, ref medal);
                                        if (info != null)
                                        {
                                            //medal = info.TemplateID;
                                            PlayerDetail.AddTemplate(info, eBageType.FightBag, info.Count);
                                        }
                                    }
                                    PlayerDetail.AddGold(gold);
                                    PlayerDetail.AddMoney(money);
                                    PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_Shoot, PlayerDetail.PlayerCharacter.ID, money, PlayerDetail.PlayerCharacter.Money);
                                    PlayerDetail.AddGiftToken(giftToken);
                                    PlayerDetail.AddMedal(medal); //trminhpc
                                }
                            }
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemple #29
0
 public string Insert(PlayerDetail url)
 {
     return(playerDetails.Insert(url));
 }
Exemple #30
0
 public async Task <Model.ViewModel.Player> GetPlayerById(int Id)
 {
     return(mapper.Map <Model.ViewModel.Player>(await PlayerDetail.GetByIdAsync(Id)));
 }
Exemple #31
0
 protected IBuff(float _lifeTime)
 {
     buffDetail = new PlayerDetail();
     lifeTime   = _lifeTime;
 }