コード例 #1
0
        internal void PlayerJoin(Player player)
        {
            var id   = player.whoAmI.ToString();
            var name = player.name.Sanitize();

            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                record.Name    = name;
                playerData[id] = record;
                allPlayers.Remove(id);
                allPlayers.Add(id, new TerrariaPlayer(player));
            }
            else
            {
                record = new PlayerRecord {
                    Id = id, Name = name
                };
                playerData.Add(id, record);
                allPlayers.Add(id, new TerrariaPlayer(player));
            }

            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #2
0
    public PlayerRecord GetPlayer(int id, int?user_id = default(int?))
    {
        int num = -1;

        if (user_id.HasValue)
        {
            num = user_id.Value;
        }
        PlayerRecord playerRecord = null;

        if (num > 0)
        {
            playerRecord = GetPlayerByUserId(num);
        }
        if (playerRecord != null)
        {
            CoopClient coopClient = MonoBehaviourSingleton <CoopManager> .I.coopRoom.clients.FindByUserId(num);

            if (coopClient != null)
            {
                playerRecord.id = coopClient.playerId;
            }
        }
        else
        {
            playerRecord = players.Find((PlayerRecord o) => o.id == id);
            if (playerRecord == null)
            {
                playerRecord    = new PlayerRecord();
                playerRecord.id = id;
                players.Add(playerRecord);
            }
        }
        return(playerRecord);
    }
コード例 #3
0
 public BattleSendData(string attacker, string target, string backGround, string attackerTile, string targetTile, bool isPlayerAttack, bool isHeal, bool isCounter, bool isDirect, int attackerDefensRate, int targetDefensRate, int attackerMaxHP, int attackerHP, int damageByAttacker, int targetMaxHP, int targetHP, int damageByTarget, string getItem, int playerExp, int getExp, int level, string playerClass, PlayerRecord playerData, PlayerRecord lvUpData)
 {
     this.attacker           = attacker;
     this.target             = target;
     this.m_BackGround       = backGround;
     this.attackerTile       = attackerTile;
     this.targetTile         = targetTile;
     this.m_IsPlayerAttack   = isPlayerAttack;
     this.m_IsHeal           = isHeal;
     this.m_IsCounter        = isCounter;
     this.m_IsDirect         = isDirect;
     this.attackerDefensRate = attackerDefensRate;
     this.targetDefensRate   = targetDefensRate;
     this.attackerMaxHP      = attackerMaxHP;
     this.attackerHP         = attackerHP;
     this.damageByAttacker   = damageByAttacker;
     this.targetMaxHP        = targetMaxHP;
     this.targetHP           = targetHP;
     this.damageByTarget     = damageByTarget;
     this.m_GetItem          = getItem;
     this.playerExp          = playerExp;
     this.m_GetExp           = getExp;
     this.level         = level;
     this.m_PlayerClass = playerClass;
     this.m_PlayerData  = playerData;
     this.m_LvUpData    = lvUpData;
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: hubigabi/Black_lamp
    void Start()
    {
        rb       = GetComponent <Rigidbody2D>();
        animator = GetComponent <Animator>();

        /*
         * //Camera
         * float screenAspect = (float)Screen.width / (float)Screen.height;
         * float cameraHeight = Camera.main.orthographicSize * 2;
         * Bounds bounds = new Bounds(Camera.main.transform.position,
         *  new Vector3(cameraHeight * screenAspect, cameraHeight, 0));
         * leftCameraBorder = bounds.center.x - bounds.extents.x;
         * rightCameraBorder = bounds.center.x + bounds.extents.x;
         * Debug.Log("Bounds: " + bounds);
         * Debug.Log("Left camera border:" + leftCameraBorder);
         * Debug.Log("Right camera border:" + rightCameraBorder);*/

        scoreToDisplay.setScoreText(PlayerRecord.getScore());
        PlayerRecord.setPreviousScore(PlayerRecord.getScore());

        healthBar.SetMaxHealth(PlayerRecord.maxHealth);
        healthBar.SetHealth(PlayerRecord.health);
        PlayerRecord.previousHealth = PlayerRecord.health;

        heartManager.changeVisibleHeartsNumber(PlayerRecord.numberOfLifes);
        PlayerRecord.previousNumberOfLifes = PlayerRecord.numberOfLifes;

        /*
         * height = GameObject.Find("Player").GetComponent<Player>().GetComponent<SpriteRenderer>().bounds.size.y;
         * width = GameObject.Find("Player").GetComponent<Player>().GetComponent<SpriteRenderer>().bounds.size.x;*/

        //Free rotatation along Z-axis
        rb.constraints = RigidbodyConstraints2D.FreezeRotation;
        soundManager   = GameObject.Find("SoundManager").GetComponent <SoundManager>();
    }
コード例 #5
0
        private void NotifyPlayerJoin(ulong steamid, string nickname)
        {
            var uniqueId = steamid.ToString();

            // Do they exist?
            PlayerRecord record;
            if (playerData.TryGetValue(uniqueId, out record))
            {
                // Update
                record.Nickname = nickname;
                playerData[uniqueId] = record;

                // Swap out Rust player
                players.Remove(uniqueId);
                players.Add(uniqueId, new HurtworldPlayer(steamid, nickname));
            }
            else
            {
                // Insert
                record = new PlayerRecord {SteamId = steamid, Nickname = nickname};
                playerData.Add(uniqueId, record);

                // Create Rust player
                players.Add(uniqueId, new HurtworldPlayer(steamid, nickname));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence.playerdata");
        }
コード例 #6
0
    private void ActivateRecord(PlayerRecord record)
    {
        var go = Instantiate(Resources.Load("PlayerReplay")) as GameObject;

        go.GetComponent <PlayerReplay>().TimePositions = record.TimePositions;
        this.playerReplayObjects.Add(go);
    }
コード例 #7
0
ファイル: Stage.cs プロジェクト: SESch93/UFrameIT
    public Stage(Stage get, string category, int number, string name, string description, string scene, bool local = true)
    {
        InitOOP();
        Stage cpy = new Stage();

        // "DeepCopy" of ref-types, 'cause screw c# and ICloneable
        load(ref cpy, get.name, null, get.use_install_folder);
        this.hierarchie    = cpy.hierarchie;
        this.solution      = cpy.solution;
        this.player_record = cpy.player_record;

        InitFields(category, number, name, description, scene, local);

        hierarchie ??= new List <Directories>();
        hierarchie.AddRange(hierStage.AsEnumerable());

        player_record.load(hierarchie);
        player_record.name = player_record.name.Replace(get.record_name, record_name);
        player_record.store(hierarchie, false);

        //this.player_record_list = cpy.player_record_list;
        foreach (var record in cpy.player_record_list.Values)
        {
            record.load(hierarchie);
            record.name = record.name.Replace(get.record_name, record_name);
            record.store(hierarchie, false);
            player_record_list.Add(record.name, record);
        }

        hierarchie.RemoveRange(hierarchie.Count - hierStage.Count, hierStage.Count);
        store(false);
    }
コード例 #8
0
    /// <summary>
    /// Querys the Backendless table for a specific player by object ID
    /// </summary>
    /// <param name="OnCompleteCallback">This delegate will be called when the <see cref="PlayerRecord"/> has been succesfully fetched. The <see cref="string"/> parameter will contain any errors</param>
    /// <returns></returns>
    /// <remarks>Designed to run as a <see cref="Coroutine"/></remarks>
    public static IEnumerator GetRecord(string uri, Action <PlayerRecord, string> OnCompleteCallback)
    {
        using UnityWebRequest request = UnityWebRequest.Get(uri);
        LogRequest(request);
        yield return(request.SendWebRequest());

        if (request.result != UnityWebRequest.Result.Success)
        {
            Debug.LogWarning(request.error);
        }
        //Debug.Log(request.downloadHandler.text);


        PlayerRecord record = null;
        string       error  = "";

        if (request.result == UnityWebRequest.Result.ConnectionError)
        {
            error = request.error;
            Debug.Log(request.error);
        }
        else
        {
            TableData records = JsonUtility.FromJson <TableData>("{\"data\":" + request.downloadHandler.text + "}");
            if (records.data.Length > 0)
            {
                record = records.data[0];
            }
        }

        OnCompleteCallback.Invoke(record, error);
    }
コード例 #9
0
    public IEnumerator SendRecord()
    {
        GameSystem.Instance.PlayerInControl.GetComponent <PlayerController>().ControlRecord.ForEach(action =>
        {
            Debug.Log($"{action.Tick} {action.Action}");
        });
        var snapShots = GameSystem.Instance.PlayerInControl.GetComponent <PlayerController>().ControlRecord
                        .Select(playback => new PlayerSnapShot()
        {
            ID      = PlayerID,
            Tick    = playback.Tick,
            Control = new PlayerControl()
            {
                Action    = (int)playback.Action,
                Direction = playback.Direction
            },
            Position = new double[] { 0, 0 },
            Velocity = new double[] { 0, 0 }
        })
                        .ToArray();
        var record = new PlayerRecord()
        {
            ID           = PlayerID,
            Name         = PlayerName,
            LeaveMessage = "",
            Records      = snapShots
        };

        yield return(SendRecord(record));
    }
コード例 #10
0
 private PlayerModel ConvertToPlayerModel(PlayerRecord player)
 {
     return(new PlayerModel
     {
         Id = player.Id,
         Username = player.Username,
         ExternalId = player.ExternalId,
         IpAddress = player.IpAddress,
         Tag = player.Tag,
         CultureCode = player.CultureCode,
         DefaultWalletId = player.DefaultWalletId,
         Currency = player.DefaultWalletCurrencyName,
         Balance = player.DefaultWalletBalance ?? 0,
         BrandId = player.BrandId,
         BrandName = player.BrandName,
         BrandStatusId = player.BrandStatusId,
         BrandStatus = player.BrandStatusId.ToString(),
         LicenseeName = player.LicenseeName,
         LicenseeStatusId = player.LicenseeStatusId,
         LicenseeStatus = player.LicenseeStatusId.ToString(),
         StatusId = player.Status,
         Status = player.Status.ToString(),
         BetLimitGroupId = player.BetLimitGroupId,
         BetLimitGroupName = player.BetLimitGroupName,
         IsTestPlayer = player.IsTestPlayer,
         LastLoginUrl = player.LastLoginUrl,
         LastCashierUrl = player.LastCashierUrl,
         LastHelpUrl = player.LastHelpUrl,
         LastTermsUrl = player.LastTermsUrl,
         CreatedOn = player.CreatedOn
     });
 }
コード例 #11
0
        public void CreateDatabase()
        {
            //  Create database for the first time
            Players = new List <Player>();
            for (int c = 0; c < model.TableModels[EditorModel.PLAYER_TABLE].RecordCount; c++)
            {
                PlayerRecord pr = model.PlayerModel.GetPlayerRecord(c);
                if (pr.Deleted || pr.FirstName == "New")
                {
                    continue;
                }
                Players.Add(new Player(pr, model));

                Players[Players.Count - 1].UpdateCareerStats(model);

                if (Players[Players.Count - 1].PlayerCareerStats.GAMES_PLAYED > 0)
                {
                    Players[Players.Count - 1].UpdateSeasonStats(model);
                }
            }

            Coaches = new List <Coach>();
            for (int c = 0; c < model.TableModels[EditorModel.COACH_TABLE].RecordCount; c++)
            {
                Coaches.Add(new Coach(model.CoachModel.GetCoachRecord(c)));
            }
        }
コード例 #12
0
ファイル: PlayerController.cs プロジェクト: kimx/Examples
 private PlayerModel ConvertToPlayerModel(PlayerRecord player)
 {
     return new PlayerModel
     {
         Id = player.Id,
         Username = player.Username,
         ExternalId = player.ExternalId,
         IpAddress = player.IpAddress,
         Tag = player.Tag,
         CultureCode = player.CultureCode,
         DefaultWalletId = player.DefaultWalletId,
         Currency = player.DefaultWalletCurrencyName,
         Balance = player.DefaultWalletBalance ?? 0,
         BrandId = player.BrandId,
         BrandName = player.BrandName,
         BrandStatusId = player.BrandStatusId,
         BrandStatus = player.BrandStatusId.ToString(),
         LicenseeName = player.LicenseeName,
         LicenseeStatusId = player.LicenseeStatusId,
         LicenseeStatus = player.LicenseeStatusId.ToString(),
         StatusId = player.Status,
         Status = player.Status.ToString(),
         BetLimitGroupId = player.BetLimitGroupId,
         BetLimitGroupName = player.BetLimitGroupName,
         IsTestPlayer = player.IsTestPlayer,
         LastLoginUrl = player.LastLoginUrl,
         LastCashierUrl = player.LastCashierUrl,
         LastHelpUrl = player.LastHelpUrl,
         LastTermsUrl = player.LastTermsUrl,
         CreatedOn = player.CreatedOn
     };
 }
コード例 #13
0
        internal void PlayerJoin(PlayerSession session)
        {
            var id   = session.SteamId.ToString();
            var name = session.Identity.Name.Sanitize();

            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                record.Name    = name;
                playerData[id] = record;
                allPlayers.Remove(id);
                allPlayers.Add(id, new HurtworldPlayer(session));
            }
            else
            {
                record = new PlayerRecord {
                    Id = (ulong)session.SteamId, Name = name
                };
                playerData.Add(id, record);
                allPlayers.Add(id, new HurtworldPlayer(session));
            }

            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #14
0
        public void GetRecordHistory()
        {
            // Arrange
            Player player = new Player();

            player.PlayerId = 1;
            Mock <User>        userMock    = new Mock <User>();
            Mock <GameManager> managerMock = new Mock <GameManager>(userMock.Object);

            managerMock.Expect(m => m.CurrentPlayer)
            .Returns(player).AtMostOnce().Verifiable();
            PlayerRecord[] records = new PlayerRecord[] { new PlayerRecord() };
            managerMock.Expect(m => m.GetPlayerRecords(1))
            .Returns(records).AtMostOnce().Verifiable();
            PlayerRecordController controller = new PlayerRecordController(managerMock.Object);

            // Act
            ActionResult result = controller.GetRecordHistory(Player.RecordType.NetWorth);

            // Assert
            Assert.That(result, Is.TypeOf(typeof(JsonResult)), "Should return a JSON result");
            Assert.That(controller.ModelState.IsValid, "No errors should be returned");

            managerMock.Verify();
        }
コード例 #15
0
        private void NotifyPlayerJoin(BasePlayer player)
        {
            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(player.UserIDString, out record))
            {
                // Update
                record.Name = player.displayName;
                playerData[player.UserIDString] = record;

                // Swap out Rust player
                allPlayers.Remove(player.UserIDString);
                allPlayers.Add(player.UserIDString, new RustPlayer(player));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = player.userID, Name = player.displayName
                };
                playerData.Add(player.UserIDString, record);

                // Create Rust player
                allPlayers.Add(player.UserIDString, new RustPlayer(player));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #16
0
        private void NotifyPlayerJoin(PlayerSession session)
        {
            var id = session.SteamId.ToString();

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = session.Name;
                playerData[id] = record;

                // Swap out Rust player
                allPlayers.Remove(id);
                allPlayers.Add(id, new HurtworldPlayer(session));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = (ulong)session.SteamId, Name = session.Name
                };
                playerData.Add(id, record);

                // Create Rust player
                allPlayers.Add(id, new HurtworldPlayer(session));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #17
0
        internal void PlayerJoin(ulong userId, string name)
        {
            var id = userId.ToString();

            name = name.Sanitize();

            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                record.Name    = name;
                playerData[id] = record;
                allPlayers.Remove(id);
                allPlayers.Add(id, new ReignOfKingsPlayer(userId, name));
            }
            else
            {
                record = new PlayerRecord {
                    Id = userId, Name = name
                };
                playerData.Add(id, record);
                allPlayers.Add(id, new ReignOfKingsPlayer(userId, name));
            }

            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #18
0
        private void NotifyPlayerJoin(PlayerInfos player)
        {
            var id = player.account_id;

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = player.Nickname;
                playerData[id] = record;

                // Swap out Rust player
                allPlayers.Remove(id);
                allPlayers.Add(id, new HideHoldOutPlayer(player));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = Convert.ToUInt64(id), Name = player.Nickname
                };
                playerData.Add(id, record);

                // Create Rust player
                allPlayers.Add(id, new HideHoldOutPlayer(player));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #19
0
ファイル: Stage.cs プロジェクト: SESch93/UFrameIT
    public bool set_record(PlayerRecord record)
    {
        hierarchie ??= new List <Directories>();
        hierarchie.AddRange(hierStage.AsEnumerable());

        if (record != null)
        {
            if (!player_record_list.ContainsKey(record.name))
            {
                return(false);
            }
            else if (!record.load(hierarchie))
            {
                deletet_record(record);
                hierarchie.RemoveRange(hierarchie.Count - hierStage.Count, hierStage.Count);
                return(false);
            }
        }

        player_record      = record == null ? new PlayerRecord(record_name) : record.Clone(hierarchie);
        player_record.name = record_name;

        hierarchie.RemoveRange(hierarchie.Count - hierStage.Count, hierStage.Count);

        store(false);

        return(true);
    }
コード例 #20
0
        internal void PlayerJoin(NetUser netUser)
        {
            var id   = netUser.userID.ToString();
            var name = netUser.displayName.Sanitize();

            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                record.Name    = name;
                playerData[id] = record;
                allPlayers.Remove(id);
                allPlayers.Add(id, new RustLegacyPlayer(netUser));
            }
            else
            {
                record = new PlayerRecord {
                    Id = netUser.userID, Name = name
                };
                playerData.Add(id, record);
                allPlayers.Add(id, new RustLegacyPlayer(netUser));
            }

            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #21
0
        private void NotifyPlayerJoin(BoltEntity entity)
        {
            var steamId = entity.source.RemoteEndPoint.SteamId.Id;
            var id      = entity.source.RemoteEndPoint.SteamId.Id.ToString();
            var name    = SteamFriends.GetFriendPersonaName(new CSteamID(entity.source.RemoteEndPoint.SteamId.Id));

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = SteamFriends.GetFriendPersonaName(new CSteamID(entity.source.RemoteEndPoint.SteamId.Id));
                playerData[id] = record;

                // Swap out Rust player
                allPlayers.Remove(id);
                allPlayers.Add(id, new TheForestPlayer(entity));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = steamId, Name = name
                };
                playerData.Add(id, record);

                // Create Rust player
                allPlayers.Add(id, new TheForestPlayer(steamId, name));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #22
0
 public void ReadAdmins()
 {
     try
     {
         // Setup the admins array
         Admins = new AdminList();
         OleDbDataReader drAdmins = DB.GetData("select * from haloce_server_admins");
         if (drAdmins.HasRows)
         {
             while (drAdmins.Read())
             {
                 string       name    = drAdmins.GetString(drAdmins.GetOrdinal("name"));
                 string       keyhash = drAdmins.GetString(drAdmins.GetOrdinal("key_hash"));
                 int          id      = drAdmins.GetInt32(drAdmins.GetOrdinal("id"));
                 PlayerRecord pr      = new PlayerRecord();
                 pr.id = id; pr.keyhash = keyhash; pr.name = name;
                 if (!Admins.Contains(keyhash))
                 {
                     Admins.Add(keyhash, pr);
                 }
             }
         }
         drAdmins.Close();
     }
     catch
     {
         Admins = new AdminList();
         Trace.WriteLine("ERROR: Failed to load admins!");
     }
 }
コード例 #23
0
        private void NotifyPlayerJoin(Player player)
        {
            var id = player.Id.ToString();

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = player.Name;
                playerData[id] = record;

                // Swap out Rust player
                allPlayers.Remove(id);
                allPlayers.Add(id, new ReignOfKingsPlayer(player));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = player.Id, Name = player.Name
                };
                playerData.Add(id, record);

                // Create Rust player
                allPlayers.Add(id, new ReignOfKingsPlayer(player));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #24
0
        private void NotifyPlayerJoin(ulong steamid, string nickname)
        {
            var id = steamid.ToString();

            // Do they exist?
            PlayerRecord record;
            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name = nickname;
                playerData[id] = record;

                // Swap out Rust player
                players.Remove(id);
                players.Add(id, new TheForestPlayer(steamid, nickname));
            }
            else
            {
                // Insert
                record = new PlayerRecord {Id = steamid, Name = nickname};
                playerData.Add(id, record);

                // Create Rust player
                players.Add(id, new TheForestPlayer(steamid, nickname));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #25
0
        public void TestMaxNumberOfRecords()
        {
            FileStorage  storage    = new FileStorage(3);
            ScoreBoard   scoreBoard = new ScoreBoard(storage);
            PlayerRecord record1    = new PlayerRecord("Player1", "5");

            scoreBoard.AddResult(record1);
            PlayerRecord record2 = new PlayerRecord("Player2", "3");

            scoreBoard.AddResult(record2);
            PlayerRecord record3 = new PlayerRecord("Player3", "4");

            scoreBoard.AddResult(record3);
            PlayerRecord record4 = new PlayerRecord("Player4", "6");

            scoreBoard.AddResult(record4);
            IEnumerable <IRecord> result = scoreBoard.GetAll();
            int numberOfRecords          = 0;

            foreach (var item in result)
            {
                numberOfRecords++;
            }

            Assert.AreEqual(numberOfRecords, 3);
        }
コード例 #26
0
        private void NotifyPlayerJoin(ClientInfo client)
        {
            var id = client.playerId;

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = client.playerName;
                playerData[id] = record;

                // Swap out Rust player
                allPlayers.Remove(id);
                allPlayers.Add(id, new SevenDaysPlayer(client));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = Convert.ToUInt64(id), Name = client.playerName
                };
                playerData.Add(id, record);

                // Create Rust player
                allPlayers.Add(id, new SevenDaysPlayer(client));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #27
0
        private void NotifyPlayerJoin(ulong steamid, string nickname)
        {
            var id = steamid.ToString();

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = nickname;
                playerData[id] = record;

                // Swap out Rust player
                players.Remove(id);
                players.Add(id, new RustPlayer(steamid, nickname));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = steamid, Name = nickname
                };
                playerData.Add(id, record);

                // Create Rust player
                players.Add(id, new RustPlayer(steamid, nickname));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #28
0
        internal void PlayerJoin(IMyPlayer player)
        {
            var id   = player.SteamUserId.ToString();
            var name = player.DisplayName.Sanitize();

            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                record.Name    = name;
                playerData[id] = record;
                allPlayers.Remove(id);
                allPlayers.Add(id, new MedievalEngineersPlayer(player));
            }
            else
            {
                record = new PlayerRecord {
                    Id = player.SteamUserId, Name = name
                };
                playerData.Add(id, record);
                allPlayers.Add(id, new MedievalEngineersPlayer(player));
            }

            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #29
0
    public PlayerRecord Clone()
    {
        PlayerRecord playerRecord = new PlayerRecord();

        playerRecord.id                      = id;
        playerRecord.isEnemy                 = isEnemy;
        playerRecord.isNewPlayer             = isNewPlayer;
        playerRecord.locX                    = locX;
        playerRecord.locY                    = locY;
        playerRecord.characterId             = characterId;
        playerRecord.levelId                 = levelId;
        playerRecord.level                   = level;
        playerRecord.exp                     = exp;
        playerRecord.hp                      = hp;
        playerRecord.currentHp               = currentHp;
        playerRecord.atk                     = atk;
        playerRecord.def                     = def;
        playerRecord.wis                     = wis;
        playerRecord.dex                     = dex;
        playerRecord.mdef                    = mdef;
        playerRecord.equipWeapon             = equipWeapon;
        playerRecord.scenarionActorPivotType = scenarionActorPivotType;
        playerRecord.isActable               = isActable;
        playerRecord.aiType                  = aiType;
        playerRecord.searchRange             = searchRange;
        return(playerRecord);
    }
コード例 #30
0
ファイル: Overall.cs プロジェクト: maddeninthehouse/maddenAMP
        public double GetOverall(PlayerRecord rec)
        {
            double total = 50;

            double str = GetPerc((int)Rating.STR, rec.GetRating((int)Rating.STR));
            double agi = GetPerc((int)Rating.AGI, rec.GetRating((int)Rating.AGI));
            double spd = GetPerc((int)Rating.SPD, rec.GetRating((int)Rating.SPD));
            double acc = GetPerc((int)Rating.ACC, rec.GetRating((int)Rating.ACC));
            double awr = GetPerc((int)Rating.AWR, rec.GetRating((int)Rating.AWR));
            double cth = GetPerc((int)Rating.CTH, rec.GetRating((int)Rating.CTH));
            double car = GetPerc((int)Rating.CAR, rec.GetRating((int)Rating.CAR));
            double thp = GetPerc((int)Rating.THP, rec.GetRating((int)Rating.THP));
            double tha = GetPerc((int)Rating.THA, rec.GetRating((int)Rating.THA));
            double kpw = GetPerc((int)Rating.KPW, rec.GetRating((int)Rating.KPW));
            double kac = GetPerc((int)Rating.KAC, rec.GetRating((int)Rating.KAC));
            double btk = GetPerc((int)Rating.BTK, rec.GetRating((int)Rating.BTK));
            double tak = GetPerc((int)Rating.TAK, rec.GetRating((int)Rating.TAK));
            double pbk = GetPerc((int)Rating.PBK, rec.GetRating((int)Rating.PBK));
            double rbk = GetPerc((int)Rating.RBK, rec.GetRating((int)Rating.RBK));
            double jmp = GetPerc((int)Rating.JMP, rec.GetRating((int)Rating.JMP));

            double physical = str + agi + spd + acc + thp + jmp + kpw;

            //physical = Math.Truncate(physical);


            total += physical + awr + cth + car + btk + tak + pbk + rbk + kac + tha;
            //double round = total - Math.Truncate(total);
            //total = Math.Truncate(total);
            //if (round > .50)
            //    total++;
            return(total);
        }
コード例 #31
0
ファイル: UnturnedPlayerManager.cs プロジェクト: SaddYT/Oxide
        private void NotifyPlayerJoin(SteamPlayer steamPlayer)
        {
            var id = steamPlayer.playerID.steamID.ToString();

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = steamPlayer.player.name;
                playerData[id] = record;

                // Swap out Rust player
                allPlayers.Remove(id);
                allPlayers.Add(id, new UnturnedPlayer(steamPlayer));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = steamPlayer.playerID.steamID.m_SteamID, Name = steamPlayer.player.name
                };
                playerData.Add(id, record);

                // Create Rust player
                allPlayers.Add(id, new UnturnedPlayer(steamPlayer));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #32
0
        private void NotifyPlayerJoin(NetUser netUser)
        {
            var id = netUser.userID.ToString();

            // Do they exist?
            PlayerRecord record;

            if (playerData.TryGetValue(id, out record))
            {
                // Update
                record.Name    = netUser.displayName;
                playerData[id] = record;

                // Swap out Rust player
                allPlayers.Remove(id);
                allPlayers.Add(id, new RustLegacyPlayer(netUser));
            }
            else
            {
                // Insert
                record = new PlayerRecord {
                    Id = netUser.userID, Name = netUser.displayName
                };
                playerData.Add(id, record);

                // Create Rust player
                allPlayers.Add(id, new RustLegacyPlayer(netUser));
            }

            // Save
            ProtoStorage.Save(playerData, "oxide.covalence");
        }
コード例 #33
0
        public double pointboost(PlayerRecord player, double con, double retireAge)
        {
            double conReverse = 5 - con;

            return(theta(5 - player.YearsPro) * (1.0 - 0.2 * (double)player.YearsPro) * (0.5 * conReverse + 0.1875 * Math.Pow(conReverse, 2.0)) -
                   theta(player.Age + 5.0 - retireAge) * 0.2 * Math.Min((double)player.Age + 5.0 - retireAge, 5.0) * (0.5 * conReverse + 0.1875 * Math.Pow(conReverse, 2.0)));
        }
コード例 #34
0
    internal static GameObject GenerateServer(string username, NetworkViewID interpolationViewID, NetworkViewID animationViewID, PlayerRecord record)
    {
        var gameObject = GameObject.Instantiate(Resources.Load("Player/PlayerPrefabMelee01")) as GameObject;
        gameObject.transform.position = PlayerManager.Main.GetClosestRespawnPoint(Vector3.zero, record.team).transform.position;
        record.gameObject = gameObject;
        NetworkView masterView = gameObject.GetComponents<NetworkView>()[0];
        masterView.viewID = interpolationViewID;
        masterView.observed = gameObject.AddComponent<MasterNetworkSerializer>();

        gameObject.name = username;
        BuildCharacter("server", gameObject);

        return gameObject;
    }
コード例 #35
0
    /// <summary>
    /// Generates a new Client character, assigns it NetworkViewIDs.
    /// </summary>
    /// <param name="username"></param>
    /// <param name="interpolationViewID"></param>
    /// <param name="animationViewID"></param>
    /// <returns></returns>
    internal static GameObject GenerateClient(string username, NetworkViewID interpolationViewID, NetworkViewID animationViewID, PlayerRecord record)
    {
        var gameObject = GameObject.Instantiate(Resources.Load("Player/PlayerPrefabMelee01")) as GameObject;
        if (record != null) record.gameObject = gameObject;

        NetworkView masterView = gameObject.GetComponents<NetworkView>()[0];
        masterView.viewID = interpolationViewID;
        masterView.observed = gameObject.AddComponent<MasterNetworkSerializer>();

        gameObject.name = username;
        BuildCharacter("client", gameObject);

        Debug.Log("Setting networkViewIDs to  " + username + ". transform ID = " + interpolationViewID + " , animation ID = " + animationViewID);

        return gameObject;
    }
コード例 #36
0
        private void NotifyPlayerJoin(ulong steamid, string nickname)
        {
            string uniqueID = steamid.ToString();

            // Do they exist?
            PlayerRecord record;
            if (playerData.TryGetValue(uniqueID, out record))
            {
                // Update
                record.Nickname = nickname;
                playerData[uniqueID] = record;

                // Swap out Rust player
                players.Remove(uniqueID);
                players.Add(uniqueID, new ReignOfKingsPlayer(steamid, nickname));
            }
            else
            {
                // Insert
                record = new PlayerRecord
                {
                    SteamID = steamid,
                    Nickname = nickname
                };
                playerData.Add(uniqueID, record);

                // Create Rust player
                players.Add(uniqueID, new ReignOfKingsPlayer(steamid, nickname));
            }

            // Save
            Interface.Oxide.DataFileSystem.WriteObject("oxide.covalence.playerdata", playerData);
        }