Пример #1
0
        public void getJobName(int source, dynamic value)
        {
            PlayerJob job  = PlayerJobHolder.getPlayerJob(source);
            var       args = new List <object>()
            {
                job.getJobName().ToString(), job.getJobGrade().ToString()
            };

            value(args);
        }
Пример #2
0
        public static void playerDisconnectFromGame([FromSource] Player player, string reason)
        {
            var licenseIdentifier = player.Identifiers["steam"];
            //=====================
            PlayerJob job = PlayerJobHolder.getPlayerJob(player);

            if (job != null)
            {
                MYSQL.execute($"UPDATE playerjob " +
                              $"SET name = '{job.getJobName()}'," +
                              $"grade = '{job.getJobGrade()}' " +
                              $"WHERE steamid = '{licenseIdentifier}'; ");

                PlayerJobHolder.removePlayerFromJobList(player);
            }
            //=====================
            PlayerMoney money = PlayerMoneyHolder.getPlayerMoney(player);

            if (money != null)
            {
                MYSQL.execute($"UPDATE playermoney " +
                              $"SET money = '{money.getMoney()}'," +
                              $"bank = '{money.getBankMoney()}'," +
                              $"dirty_money='{money.getDirtyMoney()}'" +
                              $"WHERE steamid = '{licenseIdentifier}'; ");

                PlayerMoneyHolder.removePlayerFromMoneyList(player);
            }
            //=====================
            PlayerGroup group = PlayerGroupHolder.getPlayerGroup(player);

            if (group != null)
            {
                List <string> gp = group.playerGroups();
                StringBuilder sb = new StringBuilder();
                if (gp.Count != 0)
                {
                    for (int i = 0; i < gp.Count; i++)
                    {
                        sb.Append($"('{licenseIdentifier}', '{gp[i]}'),");
                    }


                    MYSQL.execute($"DELETE FROM `groupusers` WHERE steamid = '{licenseIdentifier}';" +
                                  $"INSERT INTO `groupusers` (`steamid`, `group`) VALUES {sb.ToString().Remove(sb.Length - 1)}");
                }
                PlayerGroupHolder.removePlayerFromGroupList(player);
            }
            //=====================

            //=====================

            //=====================
            Debug.WriteLine($"Player {player.Name} has disconnected! ================================== :(");
        }
Пример #3
0
        public static async Task SaveMarkers()
        {
            while (true)
            {
                await Delay(500);

                show.Clear();
                playerPos = Game.Player.Character.Position;

                for (int i = 0; i < MarkerHolder.MarkerList.Count; i++)
                {
                    mark = MarkerHolder.MarkerList[i];
                    if (mark.getJobList().Count != 0)
                    {
                        if (!mark.getJobs(PlayerJob.getJobName(), PlayerJob.getJobGrade()))
                        {
                            continue;
                        }
                    }
                    if (World.GetDistance(playerPos, mark.getPosition()) < mark.getDistance())
                    {
                        show.Add(mark);
                    }
                    if (World.GetDistance(playerPos, mark.getPosition()) < (mark.getScale().X + 0.3f))
                    {
                        if (!callbacks.Contains(mark))
                        {
                            callbacks.Add(mark);
                            mark.onEnterDelegate().DynamicInvoke();
                        }
                    }
                }

                for (int i = 0; i < callbacks.Count; i++)
                {
                    mark = callbacks[i];
                    if (!(World.GetDistance(playerPos, mark.getPosition()) < (mark.getScale().X + 0.3f)))
                    {
                        if (callbacks.Contains(mark))
                        {
                            callbacks.Remove(mark);
                            mark.onExitDelegate().DynamicInvoke();
                        }
                    }
                }
            }
        }