public GameInfo( PlayerInfo pOwner, PlayerInfo pOpponent, int pOwnerScore, int pOpponentScore) { owner = pOwner; opponent = pOpponent; ownerScore = pOwnerScore; opponentScore = pOpponentScore; }
static void doRequestPlayers(BaseProtocolVO baseVO) { var vo = (RequestPlayers)baseVO; var players = new PlayerInfo[3]; for (int i = 1; i <= 3; i++) { players[i - 1] = new PlayerInfo() { uid = i + 20000, name = "qqq" + i, status = i % 2 == 0, type = (PlayerType)i, maxResetTimes = i, fff = i * 100 + i * 0.11111f, createTime = DateTime.Now, items = new[] { 111, 222, 777 }, }; } var response = new ResponsePlayers() { status = true, players = players, }; server.Send(response, baseVO.customData); }
//public Texture texture; // Use this for initialization void Start() { energyBarLength = Screen.width / 2; playerEnergy = this.transform.GetComponent<PlayerInfo>(); maxEnergy = playerEnergy.MaxEnergy; currentEnergy = playerEnergy.energy; }
public PlayerInfo Load() { PlayerInfo loadedPlayer = new PlayerInfo(); loadedPlayer.Name = PlayerPrefs.GetString("name"); loadedPlayer.id = PlayerPrefs.GetInt("id"); loadedPlayer.diamonds = PlayerPrefs.GetInt("diamonds"); loadedPlayer.helmet = PlayerPrefs.GetInt("helmet"); loadedPlayer.armor = PlayerPrefs.GetInt("armor"); loadedPlayer.pants = PlayerPrefs.GetInt("pants"); loadedPlayer.shoes = PlayerPrefs.GetInt("shoes"); for (int i = 1; i <= PlayerPrefs.GetInt("c_index"); i++) { loadedPlayer.Characters.Add(PlayerPrefs.GetInt("c" + i.ToString())); } for (int i = 1; i <= PlayerPrefs.GetInt("e_index"); i++) { loadedPlayer.Equipments.Add(PlayerPrefs.GetInt("e" + i.ToString())); } for (int i = 1; i <= 6; i++) { loadedPlayer.Status.Add(PlayerPrefs.GetInt("s" + i.ToString())); } return loadedPlayer; }
void Start() { ColorIndicator = GetComponent<Image>(); Player = GameSettings.CURRENT_SESSION.PlayingPlayers[PlayerId]; Player.SelectedColor = GameSettings.AvailableColors[CurrentColorIndex]; ColorIndicator.color = Player.SelectedColor; }
public void GetInput(PlayerInfo.MovementDirection current, PlayerInfo.MovementDirection previous) { if(this.isMoving) return; this._canUndo = false; this.GetCurrentBlock(); this.CheckCurrentBlock(); AIMovement.instance.ResetMovement(); AIMovement.instance.UndoPosition = this.transform.position; if(current == PlayerInfo.MovementDirection.FORWARD) { this._currentDirection = PlayerInfo.MovementDirection.BACKWARD; AIMovement.instance.RotateToMovement(180.0f); AIMovement.instance.MoveVector = new Vector3(0, 0, -1); } else if(current == PlayerInfo.MovementDirection.RIGHT) { this._currentDirection = PlayerInfo.MovementDirection.LEFT; AIMovement.instance.RotateToMovement(270.0f); AIMovement.instance.MoveVector = new Vector3(-1, 0, 0); } else if(current == PlayerInfo.MovementDirection.BACKWARD) { this._currentDirection = PlayerInfo.MovementDirection.FORWARD; AIMovement.instance.RotateToMovement(0.0f); AIMovement.instance.MoveVector = new Vector3(0, 0, 1); } else if(current == PlayerInfo.MovementDirection.LEFT) { this._currentDirection = PlayerInfo.MovementDirection.RIGHT; AIMovement.instance.RotateToMovement(90.0f); AIMovement.instance.MoveVector = new Vector3(1, 0, 0); } this.CheckCurrentBlock(); //AIAudio.instance.PlayMovement(); this.isMoving = true; this.previousPos = this.currentPos; this.currentPos = new Vector2(this.transform.position.x, this.transform.position.z); }
public void Process(SocketModel model) { if (model.returnCode == ReturnCode.Success) { //服务器正常返回 PlayerInfoDTO data = JsonCoding<PlayerInfoDTO>.decode(model.message); PlayerInfo playerInfo = new PlayerInfo(); playerInfo.UUID = data.UUID; playerInfo.uid = data.uid; playerInfo.playerName = data.playerName; playerInfo.level = data.level; playerInfo.coin = data.coin; playerInfo.gem = data.gem; playerInfo.vipExpire = data.vipExpire; //UDP返回的数据不提交给全局 Global.Instance.playerInfo = playerInfo; if (Global.Instance.scene == SceneType.MenuScene) { //更新UI数据 GameObject.FindGameObjectWithTag(Tags.SceneController).GetComponent<MenuScene>().UpdatePlayerInfo(); } } }
// Use this for initialization void Awake () { Debug.Log ("battle sights start "); this._npc = new NpcAttributes(); this._npc._name = this._name; this._npc._hp = this._hp; this._npc._attack_power = this._attack_power; this._npc._defense_power = this._defense_power; this._npc.init(); StartCoroutine("sp_BattleSight"); this._playerInfo = new PlayerInfo(); this._hudActionsMapper = new List<Animator>(); this._hudActionsMapper.Add (GameObject.Find ("Attack_ScaryFace").GetComponent<Animator>()); this._hudActionsMapper.Add (GameObject.Find ("Attack_Food").GetComponent<Animator>()); this._hudActionsMapper.Add (GameObject.Find ("Attack_Pose").GetComponent<Animator>()); this._hudActionsMapper.Add (GameObject.Find ("Attack_Fart").GetComponent<Animator>()); this._leroyAnimationMapper = new List<string>(); this._leroyAnimationMapper.Add ("attack_scaryface"); this._leroyAnimationMapper.Add ("attack_food"); this._leroyAnimationMapper.Add ("attack_pose"); this._leroyAnimationMapper.Add ("attack_fart"); BattleActionsController battleActionController = Pick.Instance.getBattleActionsController(); this._hudActionSoundMapper = new List<AudioSource>(); this._hudActionSoundMapper.Add (battleActionController._AttackScaryFace); this._hudActionSoundMapper.Add (battleActionController._AttackFood); this._hudActionSoundMapper.Add (battleActionController._AttackPose); this._hudActionSoundMapper.Add (battleActionController._AttackFart); }
void Start() { // get variables we need networkVariables nvs = GetComponent("networkVariables") as networkVariables; myName = nvs.myInfo.name; myInfo = nvs.myInfo; }
//use to get the local player info public static PlayerInfo GetLocalPlayerInfo() { if( mLocalPlayer == null) mLocalPlayer = new PlayerInfo( "lcl", "Local Player", false); return mLocalPlayer; }
public void MaskPlayer(PlayerInfo player) { UnitPiece[] pieces = new UnitPiece[player.Pieces.Count]; player.Pieces.CopyTo(pieces, 0); for (int i = 0; i < pieces.Length; i++) { BoardPosition boardPosition = UnitManager.GetPositionForUnitPiece(pieces[i]); Transform transform = BoardManager.GetTransformForPosition(boardPosition); Vector3 coverPosition = transform.position; coverPosition.z = GOLayer.COVER_LAYER; GameObject cover = covers[i]; if (cover.activeInHierarchy) { for (int j = i + 1; j < covers.Count; j++) { cover = covers[j]; if (!cover.activeInHierarchy) { break; } } } cover.transform.position = coverPosition; cover.SetActive(true); coverBoardPositions.Add(boardPosition, cover); } }
public virtual void Initialize() { //can't do anything else if we don't have PlayerInfo resources loaded! m_myPlayerInfo = m_nvs.myInfo; if (m_myPlayerInfo.cartGameObject == null || m_myPlayerInfo.ballGameObject == null) return; //also make sure we can get the player camera m_myCamera = Camera.main; if (m_myCamera == null) return; //get info from all players m_players = new List<PlayerInfo>(); //we don't want to use foreachs, for collection iteration errors on disconnect scenarios for (int i = 0; i < m_nvs.players.Count; i++) { PlayerInfo player = (PlayerInfo)m_nvs.players[i]; if (player != null) { // do NOT want to include the player himself if (player != m_myPlayerInfo) { m_players.Add(player); } } } m_initialized = true; }
public static ServerPlayers Parse(byte[] data) { var parser = new ResponseParser(data); parser.CurrentPosition += 5; //Header var result = new ServerPlayers(); result.PlayerCount = parser.GetByte(); result.Players = new PlayerInfo[result.PlayerCount]; for (var i = 0; i < result.PlayerCount; i++) { var p = new PlayerInfo(); p.N = parser.GetByte(); p.Name = parser.GetStringToTermination(); p.Score = parser.GetLong(); p.Time = TimeSpan.FromSeconds(parser.GetDouble()); //parser.CurrentPosition+=4; result.Players[i] = p; //break; } return result; }
public static PlayerInfo Parse(string playerString) { PlayerInfo res = new PlayerInfo(); try { // "[IP] %s [Port] %u [Flags] %u [Guid] %u [EditorId] %u [Version] %d [Id] %s" Regex r = new Regex("\\[IP\\] (?<ip>.*) \\[Port\\] (?<port>.*) \\[Flags\\] (?<flags>.*)" + " \\[Guid\\] (?<guid>.*) \\[EditorId\\] (?<editorid>.*) \\[Version\\] (?<version>.*) \\[Id\\] (?<id>.*) \\[Debug\\] (?<debug>.*)"); MatchCollection matches = r.Matches(playerString); if (matches.Count != 1) { throw new Exception(string.Format("Player string not recognised {0}", playerString)); } string ip = matches[0].Groups["ip"].Value; res.m_IPEndPoint = new IPEndPoint(IPAddress.Parse(ip), UInt16.Parse (matches[0].Groups["port"].Value)); res.m_Flags = UInt32.Parse(matches[0].Groups["flags"].Value); res.m_Guid = UInt32.Parse(matches[0].Groups["guid"].Value); res.m_EditorGuid = UInt32.Parse(matches[0].Groups["guid"].Value); res.m_Version = Int32.Parse (matches[0].Groups["version"].Value); res.m_Id = matches[0].Groups["id"].Value; res.m_AllowDebugging= (0 != int.Parse (matches[0].Groups["debug"].Value)); System.Console.WriteLine(res.ToString()); } catch (Exception e) { throw new ArgumentException ("Unable to parse player string", e); } return res; }
public void AllowUserToPlace5Ships(GameBoard gameBoard, PlayerInfo playerInfo) { Console.WriteLine("Hello, {0}! Let's place your ships \n", playerInfo.UserName); //places ship int counter = 0; //iterates through for all 5 placements while (counter < 5) { Console.WriteLine("\n-- Place Ship #{0}", counter+1); ShipSetUp setUpYourShip = new ShipSetUp(); // acces UI Ship Placement PlaceShipRequest shipRequest = new PlaceShipRequest(); // initiates placeship request business logic //assigns user entered ship placeemnt biz logic request using the associated board dictionary shipRequest = setUpYourShip.SetUpShip(gameBoard.BoardDictionary,counter); //assigns ship request to player1's board //PlaceShip method on the Board(biz logic) checks if the PlaceShip is valid ShipPlacement placeShipResult = playerInfo.MyBoard.PlaceShip(shipRequest); if (placeShipResult != ShipPlacement.Ok ) { Console.WriteLine("\n\t\t****ERROR -- INVALID SHIP PLACEMENT****\n"); counter--; } ; counter++; } Console.WriteLine("Thank you for your input {0}! Press enter to clear the console so the other player cannot cheat!", playerInfo.UserName); Console.ReadLine(); Console.Clear(); }
public PlayerInfo NextPlayersTurn(PlayerInfo player1, PlayerInfo player2, int userTurn) { if (userTurn == 1) return player2; else return player1; }
protected override void InitSimulation(int seed, LevelInfo level, PlayerInfo[] players, Slot[] slots) { simulation = new SecureSimulation(extensionPaths); // Settings aufbauen Setup settings = new Setup(); settings.Seed = seed; settings.Level = level.Type; settings.Player = new TypeInfo[AntMe.Level.MAX_SLOTS]; settings.Colors = new PlayerColor[AntMe.Level.MAX_SLOTS]; for (int i = 0; i < AntMe.Level.MAX_SLOTS; i++) { // Farben übertragen settings.Colors[i] = slots[i].ColorKey; // KIs einladen if (players[i] != null) { settings.Player[i] = players[i].Type; } } simulation.Start(settings); }
public void PlayTheGame(PlayerInfo player1, PlayerInfo player2, GameBoard gameBoard) { FireShotResponse response = new FireShotResponse(); int userTurn = 1; //sets to player2 to start PlayerInfo opponentsTurn = NextPlayersTurn(player1, player2, userTurn); PlayerInfo currentTurn = NextPlayersTurn(player1, player2, opponentsTurn.UserTurn); while (response.ShotStatus != ShotStatus.Victory) { //assigns currentTurn to player1 Console.WriteLine("\n\t--- {0}'s TURN ---", currentTurn.UserName.ToUpper()); //get X & Y Console.WriteLine("\n**Currently Displaying {0}'s Board**\n", opponentsTurn.UserName); DisplayBoardDuringGamePlay(opponentsTurn); Console.Write("\nPlayer {0}, Please enter the X & Y coordinate you would like to hit(Ex: A1): ", currentTurn.UserName); response = opponentsTurn.MyBoard.FireShot(ConvertX.AcceptUserCoordinate(opponentsTurn, gameBoard)); Responses(response); opponentsTurn = NextPlayersTurn(player1, player2, opponentsTurn.UserTurn); currentTurn = NextPlayersTurn(player1, player2, currentTurn.UserTurn); Console.WriteLine("It's now {0}'s turn. Press enter to continue", currentTurn.UserName); Console.ReadLine(); Console.Clear(); } }
// Use this for initialization void Start() { cc = GetComponent<CharacterController>(); pi = GetComponent<PlayerInfo>(); mass = pi.mass; }
void Start() { jumpVFX = transform.Find ("character/Dust_2").GetComponent<ParticleSystem>(); jumpVFX.Stop(); pi = gameObject.GetComponent<PlayerInfo>(); accelerationRate = pi.accelerationRate; decelerationRate = pi.decelerationRate; accelerationGravity = pi.accelerationGravity; maxSpeed = pi.maxSpeed; jumpHeight = pi.jumpHeight; numberOfJumps = pi.numberOfJumps; terminalVelocity = pi.terminalVelocity; cc = GetComponent<CharacterController>(); velocity = new Vector3(0,0,0); gravityDirection = Vector3.Normalize(accelerationGravity); rayLength = 0.9f; //stop acceleration rate from being more than max speed accelerationRate = accelerationRate > maxSpeed ? maxSpeed : accelerationRate; animator = gameObject.transform.FindChild("character").GetComponent<Animator>(); mesh = transform; gameObject.GetComponent<AudioSource>().Pause(); gameObject.GetComponent<AudioSource>().loop = false; gameObject.GetComponent<AudioSource>().volume = 1000.0f; }
//public Texture texture; // Use this for initialization void Start() { healthBarLength = Screen.width / 2; playerHealth = this.transform.GetComponent<PlayerInfo>(); maxHealth = playerHealth.MaxHealth; currentHealth = playerHealth.health; }
public bool AddPlayerToPlayerManager(int photonPlayerID, int index) { bool succes = false; // find player in connected clinets list and write playerInfo to the list of playerinfo's PhotonPlayer[] players = PhotonNetwork.playerList; for (int i = 0; i < players.Length; i++) { if (players[i].ID == photonPlayerID) { PhotonPlayer photonPlayer = players[i]; PlayerInfo pInfo = new PlayerInfo(); pInfo.PhotonPlayer = photonPlayer; pInfo.PlayerObject = null; pInfo.SlotID = index; // add playerInfo to players List m_PlayerInfoList[index] = (pInfo); // Assign player to Scoreboard slot ScoreBoard.GetInstance().AssignPlayerToSlot(photonPlayer, index); // Log message to players string coloredPlayerName = ColorUtility.ColorRichtText(m_SlotColorList[index], photonPlayer.name); EventLog.GetInstance().LogMessage( "<b>" + coloredPlayerName + "</b> has connected!"); succes = true; } } return succes; }
void JoinedRoom() { Debug.Log("Connected to Room"); PhotonNetwork.Instantiate(respawner.name,Vector3.zero,Quaternion.identity,0); PlayerInfo newPlayer = new PlayerInfo(_MainController.playerName); neutPlayers.Add(newPlayer); Debug.Log("PhotonNetwork.playerList.Length "+PhotonNetwork.playerList.Length); if (neutPlayers.Count <= 1){ for (int i = 0; i < PhotonNetwork.playerList.Length - 1; i++){ newPlayer = new PlayerInfo("blank_name"); neutPlayers.Add(newPlayer); } } //-1 so don't count us //for (int i = 0; i < PhotonNetwork.playerList.Length - 1; i++){ // newPlayer = new PlayerInfo("blank_name"); // neutPlayers.Add(newPlayer); //} Map_TerrainController tc = Terrain.activeTerrain.GetComponent<Map_TerrainController>(); tc.SetTerrainHeightMap(); tc.SetFreezeMap(); tc.SetClampMap (); Debug.Log ("hm reset"); if (firstPlayer){ Debug.Log("Host Joined"); firstPlayer = false; //mapController.GetComponent<Level_MapController>().SetLevelObjects(false); //tc.SetTerrainTexture (0, 0, tc.terrain.terrainData.alphamapWidth, tc.terrain.terrainData.alphamapHeight); } }
public IEnumerable<PlayerInfo> Parse(byte[] data) { var players = new List<PlayerInfo>(); var reader = new PacketReader(data); var header = reader.ReadByte(); var chard = Convert.ToChar(header); var numberOfPlayers = reader.ReadByte(); for (byte i = 1; i <= numberOfPlayers; i++) { var player = new PlayerInfo(); if (!reader.IsEnd) { player.Index = reader.ReadByte(); // always returns 0 player.Index = i; player.Name = reader.ReadUTFString(); player.Score = reader.ReadLong(); player.Duration = reader.ReadFloat(); } players.Add(player); } return players; }
void GiveMeACart(string cartModel, string ballModel, string characterModel, NetworkMessageInfo info) { // create new buggy for the new guy - his must be done on the server otherwise collisions wont work! Vector3 spawnLocation = new Vector3(0,5,0); Vector3 velocity = new Vector3(0,0,0); // instantiate the prefabs GameObject cartContainerObject = (Instantiate(Resources.Load(cartModel), spawnLocation, Quaternion.identity) as GameObject); GameObject ballGameObject = Instantiate(Resources.Load(ballModel), spawnLocation + new Vector3(3,0,0), Quaternion.identity) as GameObject; GameObject characterGameObject = Instantiate(Resources.Load(characterModel), spawnLocation + new Vector3(0,-1,0), Quaternion.identity) as GameObject; GameObject cartGameObject = cartContainerObject.transform.FindChild ("buggy").gameObject; // set buggy as characters parent characterGameObject.transform.parent = cartGameObject.transform; // create and set viewIDs NetworkViewID cartViewIDTransform = Network.AllocateViewID(); NetworkView cgt = cartContainerObject.AddComponent("NetworkView") as NetworkView; cgt.observed = cartContainerObject.transform; cgt.viewID = cartViewIDTransform; cgt.stateSynchronization = NetworkStateSynchronization.Unreliable; NetworkViewID cartViewIDRigidbody = Network.AllocateViewID(); NetworkView cgr = cartGameObject.AddComponent("NetworkView") as NetworkView; cgr.observed = cartGameObject.rigidbody; cgr.viewID = cartViewIDRigidbody; cgr.stateSynchronization = NetworkStateSynchronization.Unreliable; NetworkViewID ballViewID = Network.AllocateViewID(); ballGameObject.networkView.viewID = ballViewID; NetworkViewID characterViewID = Network.AllocateViewID(); characterGameObject.networkView.viewID = characterViewID; // tell everyone else about it networkView.RPC("SpawnPrefab", RPCMode.Others, cartViewIDTransform, spawnLocation, velocity, cartModel); networkView.RPC("SpawnPrefab", RPCMode.Others, ballViewID, spawnLocation, velocity, ballModel); networkView.RPC("SpawnPrefab", RPCMode.Others, characterViewID, spawnLocation, velocity, characterModel); // tell all players this is a player and not some random objects networkView.RPC("SpawnPlayer", RPCMode.Others, cartViewIDTransform, cartViewIDRigidbody, ballViewID, characterViewID, 0, info.sender); // tell the player it's theirs networkView.RPC("ThisOnesYours", info.sender, cartViewIDTransform, ballViewID, characterViewID); // create a PlayerInfo for it PlayerInfo newGuy = new PlayerInfo(); newGuy.cartModel = cartModel; newGuy.cartContainerObject = cartContainerObject; newGuy.cartGameObject = cartGameObject; newGuy.cartViewIDTransform = cartViewIDTransform; newGuy.cartViewIDRigidbody = cartViewIDRigidbody; newGuy.ballModel = ballModel; newGuy.ballGameObject = ballGameObject; newGuy.ballViewID = ballViewID; newGuy.characterModel = characterModel; newGuy.characterGameObject = characterGameObject; newGuy.characterViewID = characterViewID; newGuy.currentMode = 0; // set them in buggy newGuy.player = info.sender; // add it to the lists nvs.players.Add(newGuy); }
public void OnPlayerGUID(PlayerInfo player) { if (Program.IsAdmin(player)) // bypass f**k yeah return; using (DatabaseClient dbClient = Program.DBManager.GetGlobalClient()) { dbClient.AddParameter("guid", player.GUID); DataRow row = dbClient.ReadDataRow("SELECT code,confirmed FROM whitelist_awa WHERE guid = @guid"); if (row == null) { // Not in whitelist, generate code and kick. string code = GetRandomString().ToLower().Replace("o", "").Replace("0", "").Replace("l", "").Replace("1", ""); dbClient.AddParameter("ip", player.IP); dbClient.AddParameter("code", code); dbClient.AddParameter("name", player.Name); dbClient.AddParameter("id", 0); dbClient.ExecuteQuery("INSERT INTO whitelist_awa(ip,code,guid,unique_id,name) VALUES(@ip,@code,@guid,@id,@name)"); _server.GetBattlEyeClient().SendCommand(BattlEyeCommand.Kick, string.Format("{0} Whitelist code: \"{1}\"! Go to awkack.org to register", player.ID, code)); Logging.WriteServerLine(String.Format("Kicking player \"{0}\" (not on whitelist).", player.Name), _server.serverID.ToString(), ConsoleColor.Gray); } else if ((bool)row["confirmed"] == false) // not confirmed.. { _server.GetBattlEyeClient().SendCommand(BattlEyeCommand.Kick, string.Format("{0} Whitelist code: \"{1}\"! Go to awkack.org to register", player.ID, row["code"])); Logging.WriteServerLine(String.Format("Kicking player \"{0}\" (not confirmed in whitelist).", player.Name), _server.serverID.ToString(), ConsoleColor.Gray); } } }
public SkinViewer( fCraft.PlayerInfo player_ ) { InitializeComponent(); player = player_; PlayerInfo info = player; GetSetSkin(); SetPlayerInfoText( info ); }
void NotifyOnScore(PlayerInfo info) { fasterText.fontSize = fasterDefaultFontSize; if (info.score >= scoreToWin) { // end game EndGame(info); } }
//private Color originalColor = Color.grey; void Start() { //originalColor = ball.renderer.material.GetColor("_ColorTint"); nvs = GetComponent ("networkVariables") as networkVariables; myInfo = nvs.myInfo; ball = nvs.myInfo.ballGameObject; cart = nvs.myInfo.cartGameObject; }
public void GameStartUp() { UICore = (GameObject.Instantiate(Resources.Load("Prefabs/GUI/UIRoot")) as GameObject).GetComponent<UICore>(); GameState = new GameStateHandler(); GameState.Initialize(); PlayerInfo = new PlayerInfo(); }
private async Task <bool> ExecTeleportPlayer(GlobalStructureList aGlobalStructureList, PlayerInfo aPlayer, int aPlayerId) { var FoundRoute = TeleporterDB.SearchRoute(aGlobalStructureList, aPlayer); if (FoundRoute == null) { InformPlayer(aPlayerId, "No teleporter position here :-( wait 2min for structure update and try it again please."); Log($"EmpyrionTeleporter: Exec: {aPlayer.playerName}/{aPlayer.entityId}/{aPlayer.clientId} -> no route found for pos={GetVector3(aPlayer.pos).String()} on '{aPlayer.playfield}'", LogLevel.Error); return(false); } if (TeleporterDB.Settings.Current.ForbiddenPlayfields.Contains(aPlayer.playfield) || TeleporterDB.Settings.Current.ForbiddenPlayfields.Contains(FoundRoute.Playfield)) { InformPlayer(aPlayerId, "No teleport allowed here ;-)"); Log($"EmpyrionTeleporter: Exec: {aPlayer.playerName}/{aPlayer.entityId}/{aPlayer.clientId} -> no teleport allowed for pos={GetVector3(aPlayer.pos).String()} on '{aPlayer.playfield}'", LogLevel.Error); return(false); } Log($"EmpyrionTeleporter: Exec: {aPlayer.playerName}/{aPlayer.entityId}-> {FoundRoute.Id} on '{FoundRoute.Playfield}' pos={FoundRoute.Position.String()} rot={FoundRoute.Rotation.String()}", LogLevel.Message); if (!PlayerLastGoodPosition.ContainsKey(aPlayer.entityId)) { PlayerLastGoodPosition.Add(aPlayer.entityId, null); } PlayerLastGoodPosition[aPlayer.entityId] = new IdPlayfieldPositionRotation(aPlayer.entityId, aPlayer.playfield, aPlayer.pos, aPlayer.rot); Action <PlayerInfo> ActionTeleportPlayer = async(P) => { if (FoundRoute.Playfield == P.playfield) { try { await Request_Entity_Teleport(new IdPositionRotation(aPlayer.entityId, GetVector3(FoundRoute.Position), GetVector3(FoundRoute.Rotation))); } catch (Exception error) { Log($"Entity_Teleport [{aPlayerId} {P.playerName}]: {error}", LogLevel.Error); InformPlayer(aPlayerId, $"Entity_Teleport: {error.Message}"); } } else { try { await Request_Player_ChangePlayerfield(new IdPlayfieldPositionRotation(aPlayer.entityId, FoundRoute.Playfield, GetVector3(FoundRoute.Position), GetVector3(FoundRoute.Rotation))); } catch (Exception error) { Log($"Player_ChangePlayerfield [{aPlayerId} {P.playerName}]: {error}", LogLevel.Error); InformPlayer(aPlayerId, $"Player_ChangePlayerfield: {error.Message}"); } } }; try { await Request_Player_SetPlayerInfo(new PlayerInfoSet() { entityId = aPlayer.entityId, health = (int)aPlayer.healthMax }); } catch (Exception error) { Log($"Player_SetHealth [{aPlayerId} {aPlayer.playerName}]: {error}", LogLevel.Error); InformPlayer(aPlayerId, $"Player_SetHealth: {error.Message}"); } new Thread(new ThreadStart(() => { var TryTimer = new Stopwatch(); TryTimer.Start(); while (TryTimer.ElapsedMilliseconds < (TeleporterDB.Settings.Current.PreparePlayerForTeleport * 1000)) { var WaitTime = TeleporterDB.Settings.Current.PreparePlayerForTeleport - (int)(TryTimer.ElapsedMilliseconds / 1000); InformPlayer(aPlayerId, WaitTime > 1 ? $"Prepare for teleport in {WaitTime} sec." : $"Prepare for teleport now."); if (WaitTime > 0) { Thread.Sleep(2000); } } ActionTeleportPlayer(aPlayer); CheckPlayerStableTargetPos(aPlayerId, aPlayer, ActionTeleportPlayer, FoundRoute.Position); })).Start(); return(true); }
/// <summary> /// Updates all moving entities in the game /// </summary> /// <param name="elapsedTime"> /// The time between this and the previous frame. /// </param> public void Update(float elapsedTime) { // Update all entities that have a movement component foreach (Movement movement in game.MovementComponent.All) { // Update the entity's position in the world Position position = game.PositionComponent[movement.EntityID]; // Place player off-screen if dead, easy player-death solution if (game.PlayerComponent.Contains(movement.EntityID)) { Player player = game.PlayerComponent[movement.EntityID]; PlayerInfo info = game.PlayerInfoComponent[player.EntityID]; if (info.Health <= 0) { //Don't know how to handle death, just move off screen Position pos = game.PositionComponent[player.EntityID]; pos.Center.X = -999; game.PositionComponent[player.EntityID] = pos; continue; } } if (position.RoomID != game.CurrentRoomEid) { continue; } if (movement.Speed > 0) //We need this so slow effects don't end up making people move backwards { position.Center += elapsedTime * movement.Speed * movement.Direction; } // Player clamping based on the size of the walls, the tile sizes, and the room dimensions. Room currentRoom = DungeonCrawlerGame.LevelManager.getCurrentRoom(); bool clamped = false; if (position.Center.X - position.Radius < 0) { position.Center.X = position.Radius; clamped = true; } if (position.Center.Y - position.Radius < 0) { position.Center.Y = position.Radius; clamped = true; } if (position.Center.X + position.Radius > currentRoom.Width * currentRoom.TileWidth) { position.Center.X = (currentRoom.Width * currentRoom.TileWidth) - position.Radius; clamped = true; } if (position.Center.Y + position.Radius > currentRoom.Height * currentRoom.TileHeight) { position.Center.Y = (currentRoom.Height * currentRoom.TileHeight) - position.Radius; clamped = true; } //Remove if it's a bullet. (Took out for collision test demonstration) if (clamped && game.BulletComponent.Contains(position.EntityID)) { game.GarbagemanSystem.ScheduleVisit(position.EntityID, GarbagemanSystem.ComponentType.Bullet); } game.PositionComponent[movement.EntityID] = position; /* * // Update the entity's movement sprite * if(game.MovementSpriteComponent.Contains(movement.EntityID)) * { * MovementSprite movementSprite = game.MovementSpriteComponent[movement.EntityID]; * * // Set the direction of movement * float angle = (float)Math.Atan2(movement.Direction.Y, movement.Direction.X); * if (movement.Direction.X == 0 && movement.Direction.Y == 0) * { * // He's not moving, so update the sprite bounds with the idle animation * movementSprite.SpriteBounds.X = 64; * movementSprite.SpriteBounds.Y = 64 * (int)movementSprite.Facing; * } * else * { * if (angle > -MathHelper.PiOver4 && angle < MathHelper.PiOver4) * movementSprite.Facing = Facing.East; * else if (angle >= MathHelper.PiOver4 && angle <= 3f * MathHelper.PiOver4) * movementSprite.Facing = Facing.South; * else if (angle >= -3 * MathHelper.PiOver4 && angle <= -MathHelper.PiOver4) * movementSprite.Facing = Facing.North; * else * movementSprite.Facing = Facing.West; * * // Update the timing * movementSprite.Timer += elapsedTime; * if (movementSprite.Timer > 0.1f) * { * movementSprite.Frame += 1; * if (movementSprite.Frame > 2) movementSprite.Frame = 0; * movementSprite.Timer -= 0.1f; * } * * // Update the sprite bounds * movementSprite.SpriteBounds.X = 64 * movementSprite.Frame; * movementSprite.SpriteBounds.Y = 64 * (int)movementSprite.Facing; * } * // Apply our updates * game.MovementSpriteComponent[movement.EntityID] = movementSprite; * } */ //Update the collision bounds if it has one if (game.CollisionComponent.Contains(movement.EntityID)) { game.CollisionComponent[movement.EntityID].Bounds.UpdatePosition( game.PositionComponent[movement.EntityID].Center); } } }
public async Task <IActionResult> ProfileAsync(int id) { var client = await Manager.GetClientService().Get(id); var clientDto = new PlayerInfo() { Name = client.Name, Level = client.Level.ToString(), LevelInt = (int)client.Level, ClientId = client.ClientId, IPAddress = client.IPAddressString, NetworkId = client.NetworkId, ConnectionCount = client.Connections, FirstSeen = Utilities.GetTimePassed(client.FirstConnection, false), LastSeen = Utilities.GetTimePassed(client.LastConnection, false), TimePlayed = Math.Round(client.TotalConnectionTime / 3600.0, 1).ToString("#,##0"), Meta = new List <ProfileMeta>(), Aliases = client.AliasLink.Children .Where(a => a.Name != client.Name) .Select(a => a.Name) .Distinct() .OrderBy(a => a) .ToList(), IPs = client.AliasLink.Children .Select(i => i.IPAddress.ConvertIPtoString()) .Distinct() .OrderBy(i => i) .ToList(), Online = Manager.GetActiveClients().FirstOrDefault(c => c.ClientId == client.ClientId) != null, TimeOnline = (DateTime.UtcNow - client.LastConnection).TimeSpanText() }; var meta = await MetaService.GetMeta(client.ClientId); var penaltyMeta = await Manager.GetPenaltyService() .ReadGetClientPenaltiesAsync(client.ClientId); var administeredPenaltiesMeta = await Manager.GetPenaltyService() .ReadGetClientPenaltiesAsync(client.ClientId, false); if (Authorized && client.Level > SharedLibraryCore.Objects.Player.Permission.Trusted) { clientDto.Meta.Add(new ProfileMeta() { Key = "Masked", Value = client.Masked ? "Is" : "Is not", Sensitive = true, When = DateTime.MinValue }); } if (Authorized) { clientDto.Meta.AddRange(client.AliasLink.Children .GroupBy(a => a.Name) .Select(a => a.First()) .Select(a => new ProfileMeta() { Key = "AliasEvent", Value = $"Joined with alias {a.Name}", Sensitive = true, When = a.DateAdded })); } clientDto.Meta.AddRange(Authorized ? meta : meta.Where(m => !m.Sensitive)); clientDto.Meta.AddRange(Authorized ? penaltyMeta : penaltyMeta.Where(m => !m.Sensitive)); clientDto.Meta.AddRange(Authorized ? administeredPenaltiesMeta : administeredPenaltiesMeta.Where(m => !m.Sensitive)); clientDto.Meta = clientDto.Meta .OrderByDescending(m => m.When) .ToList(); ViewBag.Title = clientDto.Name.Substring(clientDto.Name.Length - 1).ToLower()[0] == 's' ? clientDto.Name + "'" : clientDto.Name + "'s"; ViewBag.Title += " Profile"; ViewBag.Description = $"Client information for {clientDto.Name}"; ViewBag.Keywords = $"IW4MAdmin, client, profile, {clientDto.Name}"; return(View("Profile/Index", clientDto)); }
protected override void OnPlayerDied(PlayerInfo player) { }
public void OnGet() { String SearchString = HttpContext.Request.Query["SearchString"]; String TeamString = HttpContext.Request.Query["TeamString"]; using (var webClient = new WebClient()) { string InfoString = webClient.DownloadString("https://api.sportsdata.io/v3/soccer/stats/json/PlayerSeasonStats/383?key=bc49021bad1943008414c5a75e665961"); JSchema InfoSchema = JSchema.Parse(System.IO.File.ReadAllText("PlayerInfoSchema.json")); JArray InfoArray = JArray.Parse(InfoString); IList <string> validationInfo = new List <string>(); if (InfoArray.IsValid(InfoSchema, out validationInfo)) { var playerInfo = PlayerInfo.FromJson(InfoString); ViewData["PlayerInfo"] = playerInfo; var players = from m in playerInfo select m; if (!string.IsNullOrEmpty(TeamString)) { var seachple = players.Where(s => s.Team.Contains(TeamString)); ViewData["PlayerInfo"] = seachple.ToArray(); } } else { foreach (string evtInfo in validationInfo) { Console.WriteLine(evtInfo); } ViewData["PlayerInfo"] = new List <PlayerInfo>(); } string positionString = webClient.DownloadString("https://raw.githubusercontent.com/ShukiSaito/GroupProject/master/GroupProject/PlayersTeamAndSalary.json"); //JObject jsonObject = JObject.Parse(playerPositionJson); // var myDeserializedClass = JsonConvert.DeserializeObject<Root>(jsonObject); JSchema PositionSchema = JSchema.Parse(System.IO.File.ReadAllText("PlayerPositionSchema.json")); JArray PositionArray = JArray.Parse(positionString); IList <string> validationPosition = new List <string>(); if (PositionArray.IsValid(PositionSchema, out validationPosition)) { var playerPosition = PlayerPosition.FromJson(positionString); ViewData["PlayerPosition"] = playerPosition; var players = from m in playerPosition select m; if (!string.IsNullOrEmpty(SearchString)) { var seachple = players.Where(s => s.CommonName.Contains(SearchString)); ViewData["PlayerPosition"] = seachple.ToArray(); } } else { foreach (string evtPosition in validationPosition) { Console.WriteLine(evtPosition); } ViewData["PlayerPosition"] = new List <PlayerPosition>(); } } }
static void LoadZones([NotNull] Map mapFile, [NotNull] OpticraftDataStore dataStore) { if (mapFile == null) { throw new ArgumentNullException("mapFile"); } if (dataStore == null) { throw new ArgumentNullException("dataStore"); } if (dataStore.Zones.Length == 0) { return; } // TODO: investigate side effects PlayerInfo conversionPlayer = new PlayerInfo("OpticraftConversion", RankManager.HighestRank, true, RankChangeType.AutoPromoted); foreach (OpticraftZone optiZone in dataStore.Zones) { // Make zone Zone fZone = new Zone { Name = optiZone.Name, }; BoundingBox bBox = new BoundingBox(optiZone.X1, optiZone.Y1, optiZone.Z1, optiZone.X2, optiZone.X2, optiZone.Z2); fZone.Create(bBox, conversionPlayer); // Min rank Rank minRank = Rank.Parse(optiZone.MinimumRank); if (minRank != null) { fZone.Controller.MinRank = minRank; } foreach (string playerName in optiZone.Builders) { // These are all lower case names if (!Player.IsValidName(playerName)) { continue; } PlayerInfo pInfo = PlayerDB.FindPlayerInfoExact(playerName); if (pInfo != null) { fZone.Controller.Include(pInfo); } } // Excluded names are not as of yet implemented in opticraft, but will be soon // So add compatibility for them when they arrive. if (optiZone.Excluded != null) { foreach (string playerName in optiZone.Excluded) { // These are all lower case names if (!Player.IsValidName(playerName)) { continue; } PlayerInfo pInfo = PlayerDB.FindPlayerInfoExact(playerName); if (pInfo != null) { fZone.Controller.Exclude(pInfo); } } } mapFile.Zones.Add(fZone); } }
void OnValidate() { playerInfo = GetComponent <PlayerInfo>(); }
private void HandleTurnChange(PlayerInfo player) { currentCharacter = player.thisCharacter; }
public abstract bool Eval(PlayerInfo info);
/// <summary> /// Handlers the borrow infor.处理可以借款的信息 /// </summary> /// <param name="borrowInfor">Borrow infor.</param> public static void HandlerBorrowInfor(PlayerInfo player, JsonData borrowBarodInfor = null) { if (null != borrowBarodInfor) { /* * "bankCanLoan": 27500, * "bankTotalInterest": 0, * "bankTotalLoan": 0, * "bankLoanLimit": 27500, * "creditCanLoan": 8250, * "creditLoanLimit": 8250, * "creditTotalInterest": 0, * "creditTotalLoan": 0, * "totalCanLoan": 35750, * "totalLoan": 0, * "totalLoanLimit": 35750 */ var boInfor = borrowBarodInfor["roleLoanInfo"]; player.netBorrowBoardBankCanBorrow = int.Parse(boInfor ["bankCanLoan"].ToString()); //: 33700,银行可贷款 player.netBorrowBoardBankTotalBorrow = int.Parse(boInfor["bankTotalLoan"].ToString()); //: 212,银行累计利息 player.netBorrowBoradBankTotalDebt = int.Parse(boInfor["bankTotalInterest"].ToString()); //: 2121,银行累计贷款 player.netBorrowBoardBankLoanLimit = int.Parse(boInfor["bankLoanLimit"].ToString()); player.netBorrowBoardCardCanBorrow = int.Parse(boInfor["creditCanLoan"].ToString()); //: 10110,信用卡可贷款 player.netBorrowBoardCardTotalDebt = int.Parse(boInfor["creditTotalInterest"].ToString()); //: 0,信用卡累计利息 player.netBorrowBoardCardTotalBorrow = int.Parse(boInfor["creditTotalLoan"].ToString()); //: 信用卡累计贷款 player.netBorrowBoardCardLoanLimit = int.Parse(boInfor["creditLoanLimit"].ToString()); player.netRecordAlreadyBorrow = int.Parse(boInfor["totalLoan"].ToString()); player.netRecordCanBorrow = int.Parse(boInfor["totalCanLoan"].ToString()); player.netRecordLimitBorrow = int.Parse(boInfor["totalLoanLimit"].ToString()); if (((IDictionary)borrowBarodInfor).Contains("roleBasicDebtInfo")) { var basicDebt = borrowBarodInfor["roleBasicDebtInfo"]; //basicLoanList if (basicDebt.IsArray) { player.basePayList.Clear(); if (player.isEnterInner == false) { for (var i = 0; i < basicDebt.Count; i++) { var tmpdata = basicDebt[i]; var tmpvo = new PaybackVo(); tmpvo.title = tmpdata["debtName"].ToString(); tmpvo.borrow = int.Parse(tmpdata["debtMoney"].ToString()); tmpvo.debt = int.Parse(tmpdata["debtInterest"].ToString()); tmpvo.netType = 0; player.basePayList.Add(tmpvo); } } } } if (((IDictionary)borrowBarodInfor).Contains("roleAddNewDebtInfo")) { player.paybackList.Clear(); var bankloanList = borrowBarodInfor["roleAddNewDebtInfo"]; if (bankloanList.IsArray) { for (var i = 0; i < bankloanList.Count; i++) { var tmpdata = bankloanList[i]; var tmpvo = new PaybackVo(); tmpvo.title = tmpdata["debtName"].ToString(); tmpvo.borrow = int.Parse(tmpdata["debtMoney"].ToString()); tmpvo.debt = int.Parse(tmpdata["debtInterest"].ToString()); tmpvo.netType = 1; player.paybackList.Add(tmpvo); } } } if (((IDictionary)borrowBarodInfor).Contains("roleLoanRecordInfo")) { var baordInfor = borrowBarodInfor["roleLoanRecordInfo"]; var borrowRecord = baordInfor["loanRecords"]; if (borrowRecord.IsArray) { player.borrowList.Clear(); for (var i = 0; i < borrowRecord.Count; i++) { var tmpdata = borrowRecord[i]; var tmpvo = new BorrowVo(); tmpvo.times = i + 1; tmpvo.bankborrow = int.Parse(tmpdata["bankLoan"].ToString()); tmpvo.bankdebt = int.Parse(tmpdata["bankInterest"].ToString()); tmpvo.bankRate = tmpdata ["bankInterestRate"].ToString(); tmpvo.cardborrow = int.Parse(tmpdata["creditLoan"].ToString()); tmpvo.carddebt = int.Parse(tmpdata["creditInterest"].ToString()); tmpvo.cardRate = tmpdata["creditInterestRate"].ToString(); player.borrowList.Add(tmpvo); } } } } }
private static void GenerateIndependentRace( Random random, StarSystemInfo system, OrbitalObjectInfo orbit, GameDatabase gamedb, AssetDatabase assetdb) { List <Faction> list = assetdb.Factions.Where <Faction>((Func <Faction, bool>)(x => x.IsIndependent())).ToList <Faction>(); List <PlayerInfo> players = gamedb.GetPlayerInfos().ToList <PlayerInfo>(); players.RemoveAll((Predicate <PlayerInfo>)(x => { if (!x.isStandardPlayer) { return(!x.includeInDiplomacy); } return(true); })); list.RemoveAll((Predicate <Faction>)(x => { if (x.IndyDescrition != null) { return(players.Any <PlayerInfo>((Func <PlayerInfo, bool>)(y => y.Name == x.Name))); } return(true); })); if (list.Count == 0) { return; } Faction faction1 = random.Choose <Faction>((IList <Faction>)list); IndyDesc indyDescrition = faction1.IndyDescrition; double num1 = indyDescrition.TechLevel != 1 ? (indyDescrition.TechLevel != 2 ? (indyDescrition.TechLevel != 3 ? (double)random.NextInclusive(1750, 10000) * (double)indyDescrition.BasePopulationMod * 1000000.0 : (double)random.NextInclusive(750, 2000) * (double)indyDescrition.BasePopulationMod * 1000000.0) : (double)random.NextInclusive(1, 750) * (double)indyDescrition.BasePopulationMod * 1000000.0) : (double)random.NextInclusive(30, 200) * (double)indyDescrition.BasePopulationMod * 1000.0; FactionInfo factionInfo = gamedb.GetFactionInfo(faction1.ID); factionInfo.IdealSuitability = gamedb.GetFactionSuitability(indyDescrition.BaseFactionSuitability) + random.NextInclusive(-indyDescrition.Suitability, indyDescrition.Suitability); gamedb.UpdateFaction(factionInfo); gamedb.RemoveOrbitalObject(orbit.ID); PlanetOrbit planetOrbit = new PlanetOrbit(); if (indyDescrition.MinPlanetSize != 0 && indyDescrition.MaxPlanetSize != 0) { planetOrbit.Size = new int?(random.NextInclusive(indyDescrition.MinPlanetSize, indyDescrition.MaxPlanetSize)); } PlanetInfo pi1 = StarSystemHelper.InferPlanetInfo((Kerberos.Sots.Data.StarMapFramework.Orbit)planetOrbit); pi1.Suitability = factionInfo.IdealSuitability; pi1.Biosphere = (int)((double)pi1.Biosphere * (double)indyDescrition.BiosphereMod); pi1.ID = gamedb.InsertPlanet(orbit.ParentID, orbit.StarSystemID, orbit.OrbitalPath, orbit.Name, indyDescrition.StellarBodyType, new int?(), pi1.Suitability, pi1.Biosphere, pi1.Resources, pi1.Size); double num2 = Math.Min(num1 + (double)(1000 * pi1.Biosphere), Colony.GetMaxCivilianPop(gamedb, pi1)); string avatarPath = ""; if (((IEnumerable <string>)faction1.AvatarTexturePaths).Count <string>() > 0) { avatarPath = faction1.AvatarTexturePaths[0]; } int insertIndyPlayerId = gamedb.GetOrInsertIndyPlayerId(gamedb, faction1.ID, faction1.Name, avatarPath); players = gamedb.GetPlayerInfos().ToList <PlayerInfo>(); foreach (PlayerInfo playerInfo in players) { PlayerInfo pi = playerInfo; Faction faction2 = assetdb.Factions.FirstOrDefault <Faction>((Func <Faction, bool>)(x => x.ID == pi.FactionID)); gamedb.InsertDiplomaticState(insertIndyPlayerId, pi.ID, pi.isStandardPlayer || pi.includeInDiplomacy ? DiplomacyState.NEUTRAL : DiplomacyState.WAR, faction1.GetDefaultReactionToFaction(faction2), false, true); } gamedb.InsertColony(pi1.ID, insertIndyPlayerId, num2 / 2.0, 0.5f, 0, 1f, true); gamedb.InsertColonyFaction(pi1.ID, faction1.ID, num2 / 2.0, 1f, 0); if (indyDescrition.TechLevel < 4) { return; } foreach (PlanetInfo systemPlanetInfo in gamedb.GetStarSystemPlanetInfos(system.ID)) { if (systemPlanetInfo.ID != pi1.ID) { PlanetInfo planetInfo = gamedb.GetPlanetInfo(systemPlanetInfo.ID); float num3 = Math.Abs(factionInfo.IdealSuitability - planetInfo.Suitability); if ((double)num3 < 200.0) { double impPop = (double)(random.NextInclusive(100, 200) * 100) * (double)indyDescrition.BasePopulationMod; gamedb.InsertColony(pi1.ID, insertIndyPlayerId, impPop, 0.5f, 0, 1f, true); gamedb.InsertColonyFaction(pi1.ID, faction1.ID, impPop / 2.0, 1f, 0); } else if ((double)num3 < 600.0 && (double)planetInfo.Suitability != 0.0) { float num4 = 100f + (float)random.Next(150); if (random.Next(2) == 0) { num4 *= -1f; } planetInfo.Suitability = factionInfo.IdealSuitability + num4; gamedb.UpdatePlanet(planetInfo); double num5 = (double)(random.NextInclusive(50, 100) * 100) * (double)indyDescrition.BasePopulationMod; gamedb.InsertColony(pi1.ID, insertIndyPlayerId, num5 / 2.0, 0.5f, 0, 1f, true); gamedb.InsertColonyFaction(pi1.ID, faction1.ID, num5 / 2.0, 1f, 0); } } } }
public override void Use(Player p, string message) { // /move name map // /move x y z // /move name x y z string[] param = message.Split(' '); if (param.Length < 1 || param.Length > 4) { Help(p); return; } // /move name if (param.Length == 1) { // Use main world by default // Add the world name to the 2nd param so that the IF block below is used param = new string[] { param[0], Server.mainLevel.name }; } if (param.Length == 2) // /move name map { Player who = PlayerInfo.FindOrShowMatches(p, param[0]); Level where = LevelInfo.Find(param[1]); if (who == null) { return; } if (where == null) { Player.SendMessage(p, "Could not find level specified"); return; } if (p != null && who.group.Permission > p.group.Permission) { MessageTooHighRank(p, "move", true); return; } Command.all.Find("goto").Use(who, where.name); if (who.level == where) { Player.SendMessage(p, "Sent " + who.ColoredName + " %Sto " + where.name); } else { Player.SendMessage(p, where.name + " is not loaded"); } } else { // /move name x y z // /move x y z Player who; if (param.Length == 4) { who = PlayerInfo.FindOrShowMatches(p, param[0]); if (who == null) { return; } if (p != null && who.group.Permission > p.group.Permission) { MessageTooHighRank(p, "move", true); return; } message = message.Substring(message.IndexOf(' ') + 1); } else { who = p; } try { ushort x = System.Convert.ToUInt16(message.Split(' ')[0]); ushort y = System.Convert.ToUInt16(message.Split(' ')[1]); ushort z = System.Convert.ToUInt16(message.Split(' ')[2]); x *= 32; x += 16; y *= 32; y += 32; z *= 32; z += 16; who.SendPos(0xFF, x, y, z, p.rot[0], p.rot[1]); if (p != who) { Player.SendMessage(p, "Moved " + who.color + who.name); } } catch { Player.SendMessage(p, "Invalid co-ordinates"); } } }
public static void LoadFile() { List <UserXp> XpList = new List <UserXp>(); if (File.Exists(@"File")) { var lines = File.ReadLines(@"File"); //deserialize each line and add to list foreach (var line in lines) { XpList.Add(JsonConvert.DeserializeObject <UserXp>(line)); } } DateTime date = XpList.First().LastUpdate; long LastXp = XpList.First().Player.Overall.Experience; PlayerInfo LastPlayerInfo = XpList.First().Player; DateTime LastDate = date; int i = 0; int CurrentStreak = 0; //fills in the blanks where there is no data for the day which presumes he has not gained xp for that day. while (i != XpList.Count) { //handle a double entry - changes the last entry to be the highest xp on that day if (LastDate.Month == XpList[i].LastUpdate.Month && LastDate.Day == XpList[i].LastUpdate.Day && i != 0) { long prevXPDeff = XPDiff.Last(); XPDiff.RemoveAt(XPDiff.Count - 1); XP.RemoveAt(XP.Count - 1); PlayerInfos.RemoveAt(PlayerInfos.Count - 1); long NewXp = XpList[i].Player.Overall.Experience; XPDiff.Add((NewXp - LastXp) + prevXPDeff); LastXp = NewXp; XP.Add(LastXp); LastPlayerInfo = XpList[i].Player; PlayerInfos.Add(LastPlayerInfo); i++; } else { long XpDiff = 0; //if the date and month of the incrementing date match the current data selection add in the new xp and increment i. if (date.Month == XpList[i].LastUpdate.Month && date.Day == XpList[i].LastUpdate.Day) { long NewXp = XpList[i].Player.Overall.Experience; XpDiff = NewXp - LastXp; LastXp = NewXp; LastPlayerInfo = XpList[i].Player; i++; CurrentStreak = 0; } if (XpDiff == 0) { CurrentStreak++; LongestStreak = CurrentStreak > LongestStreak ? CurrentStreak : LongestStreak; TotalDaysWasted++; } //add values to the lists LastDate = date; XP.Add(LastXp); XPDiff.Add(XpDiff); Date.Add(date); PlayerInfos.Add(LastPlayerInfo); //add one more day onto the incrementer if it isnt the last i so that the next while loop will add a day date = i == XpList.Count ? date : date.AddDays(1); } } //for days between last update and now while (!(date.Month == DateTime.Now.Month && date.Day == DateTime.Now.Day)) { //handle skipping the check due to double entry on day thing -> this will break if it goes over the year LUL. if (date.Month > DateTime.Now.Month || (date.Month == DateTime.Now.Month && date.Day > DateTime.Now.Day)) { break; } //add one more day onto the incrementer date = date.AddDays(1); XP.Add(LastXp); XPDiff.Add(0); Date.Add(date); PlayerInfos.Add(LastPlayerInfo); CurrentStreak++; LongestStreak = CurrentStreak > LongestStreak ? CurrentStreak : LongestStreak; TotalDaysWasted++; } }
private void OnUserStatusResp(Packet packet) { int dataStruct = Marshal.SizeOf(typeof(CMD_GR_UserStatus)); if (packet.DataSize < dataStruct) { Debug.LogWarning("data error!"); return; } CMD_GR_UserStatus status = GameConvert.ByteToStruct <CMD_GR_UserStatus>(packet.Data); PlayerInfo player = GameApp.GameSrv.FindPlayer(status.dwUserID); if (player == null) { return; } if (status.UserStatus == (byte)UserState.US_NULL) { GameApp.GameSrv.CallUserLeftEvent(status.dwUserID); GameApp.GameSrv.RemovePlayer(status.dwUserID); } else { ushort wLastTableID = player.DeskNO; ushort wLastChairID = player.DeskStation; byte cbLastStatus = player.UserState; ushort wNowTableID = status.TableID; ushort wNowChairID = status.ChairID; byte cbNowStatus = status.UserStatus; GameApp.GameSrv.SetPlayerState( status.dwUserID, status.TableID, status.ChairID, status.UserStatus); //判断发送 bool bNotifyGame = false; if (status.dwUserID == GameApp.GameData.UserInfo.UserID) { //自己的状态 bNotifyGame = true; } else if ((GameApp.GameData.UserInfo.DeskNO != CommonDefine.INVALID_TABLE) && (GameApp.GameData.UserInfo.DeskNO == wNowTableID)) { //新来同桌的状态 bNotifyGame = true; } else if ((GameApp.GameData.UserInfo.DeskNO != CommonDefine.INVALID_TABLE) && (GameApp.GameData.UserInfo.DeskNO == wLastTableID)) { //原来同桌的状态 bNotifyGame = true; } //if (bNotifyGame == true) { //站起 if (cbNowStatus == (byte)UserState.US_FREE) { GameApp.GameSrv.CallUserStandUpEvent(status.dwUserID); } //坐下 //服务器结算后会从Play转为SIT,所以这里需要排除 if (cbLastStatus != (byte)UserState.US_PLAY && cbNowStatus == (byte)UserState.US_SIT) { GameApp.GameSrv.CallUserSitDownEvent(status.dwUserID, status.TableID, status.ChairID); } //继续服务器状态会从free直接跳到ready if (cbNowStatus == (byte)UserState.US_READY) { if (cbLastStatus == (byte)UserState.US_FREE) { GameApp.GameSrv.CallUserSitDownEvent(status.dwUserID, status.TableID, status.ChairID); } GameApp.GameSrv.CallUserAgreeEvent(status.TableID, status.ChairID, 0); } if (cbNowStatus == (byte)UserState.US_OFFLINE) { GameApp.GameSrv.CallUserOfflineEvent(status.UserStatus, status.TableID, status.ChairID); } if (cbNowStatus == (byte)UserState.US_LOOKON) { } if (cbNowStatus == (byte)UserState.US_PLAY) { } } //加入处理 /*if ((wNowTableID != CommonDefine.INVALID_TABLE) && ((wNowTableID != wLastTableID) || (wNowChairID != wLastChairID))) * { * bool isSelf = (status.dwUserID == GameApp.GameData.UserInfo.UserID); * if (isSelf) * { * if (UserSitDownEvent != null) * { * UserSitDownEvent(status.dwUserID, status.TableID, status.ChairID); * } * } * }*/ } }
public override bool Eval(PlayerInfo info) { throw new NotImplementedException(); }
public void SetOwner(int playerId) { owner = GameManager.instance.players[playerId - 1]; }
public JoinLobbyMessageable(string lobbyId, PlayerInfo playerInfo) : base(lobbyId) { this.playerInfo = playerInfo; }
// Use this for initialization void Start() { playerInfo = GetComponent <PlayerInfo>(); }
public GroupsDatabase() { WriteLog.Info("Reading Groups."); Directory.CreateDirectory(ConfigValues.ConfigPath + @"Groups"); if (!File.Exists(ConfigValues.ConfigPath + @"Groups\groups.txt")) { WriteLog.Warning("Groups file not found, creating new one..."); File.WriteAllLines(ConfigValues.ConfigPath + @"Groups\groups.txt", new string[] { "default::pm,admins,guid,version,ga,rules,afk,credits,hidebombicon,help,rage,maps,time,amsg,ft,hwid,r_distortion,r_detail,r_dlightlimit,snaps,fov,r_fog,fx", "member::scream,receiveamsg,whois,changeteam,yell,gametype,mode,login,map,status,kick,tmpban,ban,warn,unwarn,getwarns,res,setafk,setteam,balance,clanvsall,clanvsallspectate:^0[^1M^0]^7", "family::kickhacker,kill,mute,unmute,end,tmpbantime,cdvar,getplayerinfo,say,sayto,resetwarns,setgroup,scream,receiveamsg,whois,changeteam,yell,gametype,mode,login,map,status,kick,tmpban,ban,warn,unwarn,getwarns,res,setafk,setteam,balance,clanvsall,clanvsallspectate:^0[^3F^0]^7", "elder::*ALL*:^0[^4E^0]^7", "developer::*ALL*:^0[^;D^0]^;" }); } if (!File.Exists(ConfigValues.ConfigPath + @"Groups\players.txt")) { WriteLog.Warning("Players file not found, creating new one..."); File.WriteAllLines(ConfigValues.ConfigPath + @"Groups\players.txt", new string[0]); } if (!File.Exists(ConfigValues.ConfigPath + @"Groups\immuneplayers.txt")) { WriteLog.Warning("Immuneplayers file not found, creating new one..."); File.WriteAllLines(ConfigValues.ConfigPath + @"Groups\immuneplayers.txt", new string[0]); } try { foreach (string line in File.ReadAllLines(ConfigValues.ConfigPath + @"Groups\groups.txt")) { string[] parts = line.Split(':'); string[] permissions = parts[2].ToLowerInvariant().Split(','); if (parts.Length == 3) { Groups.Add(new Group(parts[0].ToLowerInvariant(), parts[1], permissions.ToList())); } else if (parts.Length == 4) { Groups.Add(new Group(parts[0].ToLowerInvariant(), parts[1], permissions.ToList(), parts[3])); } else { Groups.Add(new Group(parts[0].ToLowerInvariant(), parts[1], permissions.ToList(), string.Join(":", parts.Skip(3).ToList()))); } } } catch (Exception ex) { WriteLog.Error("Could not set up groups."); WriteLog.Error(ex.Message); } try { foreach (string line in File.ReadAllLines(ConfigValues.ConfigPath + @"Groups\players.txt")) { string[] parts = line.ToLowerInvariant().Split(':'); Players.Add(PlayerInfo.Parse(parts[0]), parts[1].ToLowerInvariant()); } } catch (Exception ex) { WriteLog.Error("Could not set up playergroups."); WriteLog.Error(ex.Message); } try { foreach (string line in File.ReadAllLines(ConfigValues.ConfigPath + @"Groups\immuneplayers.txt")) { ImmunePlayers.Add(PlayerInfo.Parse(line)); } } catch (Exception ex) { WriteLog.Error("Could not set up immuneplayers"); WriteLog.Error(ex.Message); } if (ConfigValues.DEBUG) { foreach (string message in GetGroupScheme()) { WriteLog.Debug(message); } } if (!Directory.Exists(ConfigValues.ConfigPath + @"Groups\internal")) { Directory.CreateDirectory(ConfigValues.ConfigPath + @"Groups\internal"); } if (!File.Exists(ConfigValues.ConfigPath + @"Groups\internal\loggedinplayers.txt")) { File.WriteAllLines(ConfigValues.ConfigPath + @"Groups\internal\loggedinplayers.txt", new string[0]); } WriteLog.Info("Succesfully loaded groups."); }
// Use this for initialization void Start() { playerInfo = GameObject.FindGameObjectWithTag("PlayerInfo").GetComponent <PlayerInfo>(); f_maxHealth = f_health; f_previousHealth = f_health; }
public ActionResult Delete(int?id) { PlayerInfo player = _db.PlayerInfoes.Find(id); return(View(player)); }
/// <summary> /// Вычисляет срок заключения /// </summary> private static int CalculateJailTime(PlayerInfo info) { var result = Math.Round(info.Wanted.WantedLevel * 0.5f); return((int)result); }
public override void Use(Player p, string message) { Player who = message == "" ? p : PlayerInfo.Find(message); if (message == "") { message = p.name; } if (who == null || !Entities.CanSee(p, who)) { Player.SendMessage(p, "\"" + message + "\" is offline! Using /whowas instead."); Command.all.Find("whowas").Use(p, message); return; } Player.SendMessage(p, who.color + who.name + " %S(" + who.DisplayName + ") %Sis on &b" + who.level.name); Player.SendMessage(p, who.FullName + " %Shas :"); Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name); if (Economy.Enabled) { Player.SendMessage(p, "> > &a" + who.money + " %S" + Server.moneys); } Player.SendMessage(p, "> > &cdied &a" + who.overallDeath + Server.DefaultColor + " times"); Player.SendMessage(p, "> > &bmodified &a" + who.overallBlocks + " &eblocks &eand &a" + who.loginBlocks + " &ewere changed &9since logging in&e."); string storedTime = Convert.ToDateTime(DateTime.Now.Subtract(who.timeLogged).ToString()).ToString("HH:mm:ss"); TimeSpan time = who.time; Player.SendMessage(p, "> > time spent on server: " + time.Days + " Days, " + time.Hours + " Hours, " + time.Minutes + " Minutes, " + time.Seconds + " Seconds."); Player.SendMessage(p, "> > been logged in for &a" + storedTime); Player.SendMessage(p, "> > first logged into the server on &a" + who.firstLogin.ToString("yyyy-MM-dd") + " at " + who.firstLogin.ToString("HH:mm:ss")); Player.SendMessage(p, "> > logged in &a" + who.totalLogins + " %Stimes, &c" + who.totalKicked + " %Sof which ended in a kick."); Player.SendMessage(p, "> > " + Awards.AwardAmount(who.name) + " awards"); string[] data = Ban.GetBanData(who.name); if (data != null) { Player.SendMessage(p, "> > is banned for " + data[1] + " by " + data[0]); } if (who.isDev) { Player.SendMessage(p, "> > Player is a &9Developer"); } else if (who.isMod) { Player.SendMessage(p, "> > Player is a &9MCGalaxy Moderator"); } if (!CheckAdditionalPerm(p)) { return; } string givenIP; if (Server.bannedIP.Contains(who.ip)) { givenIP = "&8" + who.ip + ", which is banned"; } else { givenIP = who.ip; } Player.SendMessage(p, "> > the IP of " + givenIP); if (Server.useWhitelist && Server.whiteList.Contains(who.name)) { Player.SendMessage(p, "> > Player is &fWhitelisted"); } }
protected override bool OnPlayerChatHooked(PlayerInfo playerInfo, string message) { if (message == QueryListCmd) { List <GoodsDto> dtos = _goodsService.GetAll("Price ASC"); if (dtos.Count == 0) { SdtdConsole.Instance.SendMessageToPlayer(playerInfo.SteamID, "[00FF00]暂无商品信息"); } else { SdtdConsole.Instance.SendMessageToPlayer(playerInfo.SteamID, "[00FF00]商品列表:"); StringBuilder returnCmd = new StringBuilder(); int index = 1; foreach (var item in dtos) { returnCmd.Append(string.Format("pm {0} \"[00FF00]{1}: {2}\"\r\n", playerInfo.SteamID, index, FormatCmd(playerInfo, QueryListTips, item))); ++index; } SdtdConsole.Instance.SendCmd(returnCmd.ToString()); } } else { GoodsDto goodsDto = _goodsService.GetDataByID(message); if (goodsDto == null) { return(false); } else { int playerScore = _scoreInfoService.GetPlayerScore(playerInfo.SteamID); if (playerScore < goodsDto.Price)// 积分不足 { SdtdConsole.Instance.SendMessageToPlayer(playerInfo.SteamID, FormatCmd(playerInfo, BuyFailTips, goodsDto)); } else { _scoreInfoService.DeductPlayerScore(playerInfo.SteamID, goodsDto.Price); string cmdPrefix = "give"; switch (goodsDto.GoodsType) { case "物品": if (GiveItemBlockToBackpack) { cmdPrefix = "gi"; } SdtdConsole.Instance.SendCmd(string.Format("{0} {1} {2} {3} {4}", cmdPrefix, playerInfo.EntityID, goodsDto.Content, goodsDto.Amount, goodsDto.Quality)); break; case "方块": if (GiveItemBlockToBackpack) { cmdPrefix = "gb"; } SdtdConsole.Instance.SendCmd(string.Format("{0} {1} {2} {3}", cmdPrefix, playerInfo.EntityID, goodsDto.Content, goodsDto.Amount)); break; case "实体": for (int i = 0; i < goodsDto.Amount; ++i) { SdtdConsole.Instance.SendCmd(string.Format("se {0} {1}", playerInfo.EntityID, goodsDto.Content)); } break; case "指令": for (int i = 0; i < goodsDto.Amount; ++i) { SdtdConsole.Instance.SendCmd(FormatCmd(playerInfo, goodsDto.Content, goodsDto)); } break; default: throw new Exception("无效商品类型"); } SdtdConsole.Instance.SendGlobalMessage(FormatCmd(playerInfo, BuySucceedTips, goodsDto)); // 记录购买 Log.Info(string.Format("玩家: {0} SteamID: {1} 购买了: {2}", playerInfo.PlayerName, playerInfo.SteamID, goodsDto.GoodsName)); } } } return(true); }
public static void ParseData(CloudConnectorCore.QueryType query, List <string> objTypeNames, List <string> jsonData) { for (int i = 0; i < objTypeNames.Count; i++) { Debug.Log("Data type/table: " + objTypeNames [i]); } // First check the type of answer. if (query == CloudConnectorCore.QueryType.getObjects) { // In the example we will use only the first, thus '[0]', // but may return several objects depending the query parameters. // Check if the type is correct. if (string.Compare(objTypeNames [0], PLAYER) == 0) { // Parse from json to the desired object type. PlayerInfo[] players = GSFUJsonHelper.JsonArray <PlayerInfo> (jsonData [0]); player = players [0]; playerloaded = true; } } // First check the type of answer. else if (query == CloudConnectorCore.QueryType.getTable) { // Check if the type is correct. if (string.Compare(objTypeNames [0], ABILITIES) == 0) { // Parse from json to the desired object type. abilities = GSFUJsonHelper.JsonArray <AbilityInfo> (jsonData [0]); } else if (string.Compare(objTypeNames [0], TOWERS) == 0) { // Parse from json to the desired object type. towers = GSFUJsonHelper.JsonArray <EntityInfo> (jsonData [0]); } else if (string.Compare(objTypeNames [0], ENEMIES) == 0) { // Parse from json to the desired object type. enemies = GSFUJsonHelper.JsonArray <EntityInfo> (jsonData [0]); } } // First check the type of answer. else if (query == CloudConnectorCore.QueryType.getAllTables) { // Just dump all content to the console, sorted by table name. string logMsg = "<color=yellow>All data tables retrieved from the cloud.\n</color>"; for (int i = 0; i < objTypeNames.Count; i++) { logMsg += "<color=blue>Table Name: " + objTypeNames [i] + "</color>\n" + jsonData [i] + "\n"; } Debug.Log(logMsg); } loadVal = true; }
public static PlayerInfo LoadPlayerWin() { PlayerInfo loadinfo = new PlayerInfo(); //人物信息读取路径 string filePath = Application.persistentDataPath + "/JsonPlayer.json"; Debug.Log(filePath); //如果存在存档 if (File.Exists(filePath)) { StreamReader sr = new StreamReader(filePath); //string jsonStr = Encryption.Decrypt(sr.ReadToEnd()); string jsonStr = sr.ReadToEnd(); sr.Close(); JsonData jsdata3 = JsonMapper.ToObject(jsonStr); for (int i = 0; i < jsdata3.Count; i++) { Debug.Log(jsdata3[i]); if (i == 0) { loadinfo.PlayerID = int.Parse(jsdata3[i].ToString()); } else if (i == 1) { loadinfo.PlayerName = jsdata3[i].ToString(); } else if (i == 2) { loadinfo.Level = int.Parse(jsdata3[i].ToString()); } else if (i == 3) { loadinfo.HP = int.Parse(jsdata3[i].ToString()); } else if (i == 4) { loadinfo.Starvation = int.Parse(jsdata3[i].ToString()); } else if (i == 5) { loadinfo.Thirsty = int.Parse(jsdata3[i].ToString()); } else if (i == 6) { loadinfo.Attack = int.Parse(jsdata3[i].ToString()); } else if (i == 7) { loadinfo.Defenses = int.Parse(jsdata3[i].ToString()); } else if (i == 8) { loadinfo.Pos_X = float.Parse(jsdata3[i].ToString()); } else if (i == 9) { loadinfo.Pos_Y = float.Parse(jsdata3[i].ToString()); } } Debug.Log(jsonStr); return(loadinfo); } //如果存档不存在 else { Debug.Log("存档读取失败"); return(null); } }
private PlayerInfo GetPlayerInfo() { PlayerInfo result = new PlayerInfo(); if (!this.CanGetPlayerInfo() || !this._memoryHandler.IsAttached) { return(result); } IntPtr playerInfoAddress = this._memoryHandler.Scanner.Locations[Signatures.PLAYERINFO_KEY]; if (playerInfoAddress.ToInt64() <= 6496) { return(result); } byte[] playerMap = this._memoryHandler.BufferPool.Rent(this._memoryHandler.Structures.PlayerInfo.SourceSize); try { this._memoryHandler.GetByteArray(playerInfoAddress, playerMap); try { result = this._playerInfoResolver.ResolvePlayerFromBytes(playerMap); } catch (Exception ex) { this._memoryHandler.RaiseException(Logger, ex); } if (this.CanGetAgroEntities()) { short agroCount = this._memoryHandler.GetInt16(this._memoryHandler.Scanner.Locations[Signatures.AGRO_COUNT_KEY]); IntPtr agroStructure = (IntPtr)this._memoryHandler.Scanner.Locations[Signatures.AGROMAP_KEY]; if (agroCount > 0 && agroCount < 32 && agroStructure.ToInt64() > 0) { int agroSourceSize = this._memoryHandler.Structures.EnmityItem.SourceSize; for (uint i = 0; i < agroCount; i++) { IntPtr address = new IntPtr(agroStructure.ToInt64() + i * agroSourceSize); EnmityItem agroEntry = new EnmityItem { ID = this._memoryHandler.GetUInt32(address, this._memoryHandler.Structures.EnmityItem.ID), Name = this._memoryHandler.GetString(address + this._memoryHandler.Structures.EnmityItem.Name), Enmity = this._memoryHandler.GetUInt32(address + this._memoryHandler.Structures.EnmityItem.Enmity), }; if (agroEntry.ID > 0) { result.EnmityItems.Add(agroEntry); } } } } } catch (Exception ex) { this._memoryHandler.RaiseException(Logger, ex); } finally { this._memoryHandler.BufferPool.Return(playerMap); } return(result); }
private static bool smartEquip(Item equip, PlayerInfo info, BackpackInventoryUI invUI) { if (equip is BackpackItem) { BackpackItem backpack = equip as BackpackItem; if (info.backpack == null) { info.backpack = backpack; if (invUI != null) { invUI.loadInventory(info.backpack.inventory); } return(true); } return(false); } else if (equip is HelmetItem) { HelmetItem helmet = equip as HelmetItem; if (info.helmet == null) { info.helmet = helmet; return(true); } return(false); } else if (equip is UpperBodyItem) { UpperBodyItem upperBody = equip as UpperBodyItem; if (info.upperBody == null) { info.upperBody = upperBody; return(true); } return(false); } else if (equip is LowerBodyItem) { LowerBodyItem lowerBody = equip as LowerBodyItem; if (info.lowerBody == null) { info.lowerBody = lowerBody; return(true); } return(false); } else if (equip is BootsItem) { BootsItem boots = equip as BootsItem; if (info.boots == null) { info.boots = boots; return(true); } return(false); } else if (equip is ClawItem) { ClawItem claw = equip as ClawItem; if (info.rightClaw == null) { info.rightClaw = claw; return(true); } else if (info.leftClaw == null) { info.leftClaw = claw; } else { return(false); } } return(false); }
public static void SavePlayer(PlayerInfo _player) { string jsonPlayer = JsonUtility.ToJson(_player); CloudConnectorCore.CreateObject(jsonPlayer, PLAYER, true); }
public PlayerViewer(fCraft.PlayerInfo player_) { InitializeComponent(); player = player_; //PlayerInfo info = player; PlayerInfo info = player_; textBox1.Text = ""; if (info.LastIP.Equals(System.Net.IPAddress.None)) { textBox1.Text += String.Format("About {0}: \r\n Never seen before.", info.ClassyName); } else { if (info != null) { TimeSpan idle = info.PlayerObject.IdleTime; if (info.IsHidden) { if (idle.TotalMinutes > 2) { if (player.Can(Permission.ViewPlayerIPs)) { textBox1.Text += String.Format("About {0}: HIDDEN from {1} (idle {2})\r\n", info.Name, info.LastIP, idle.ToMiniString()); } else { textBox1.Text += String.Format("About {0}:\r\n HIDDEN (idle {1})\r\n", info.Name, idle.ToMiniString()); } } else { if (player.Can(Permission.ViewPlayerIPs)) { textBox1.Text += String.Format("About {0}:\r\n HIDDEN. Online from {1}\r\n", info.Name, info.LastIP); } else { textBox1.Text += String.Format("About {0}: HIDDEN.\r\n", info.Name); } } } else { if (idle.TotalMinutes > 1) { if (player.Can(Permission.ViewPlayerIPs)) { textBox1.Text += String.Format("About {0}:\r\n Online now from {1} (idle {2})\r\n", info.Name, info.LastIP, idle.ToMiniString()); } else { textBox1.Text += String.Format("About {0}:\r\n Online now (idle {1})\r\n", info.Name, idle.ToMiniString()); } } else { if (player.Can(Permission.ViewPlayerIPs)) { textBox1.Text += String.Format("About {0}:\r\n Online now from {1}\r\n", info.Name, info.LastIP); } else { textBox1.Text += String.Format("About {0}:\r\n Online now.\r\n", info.Name); } } } } else { if (player.Can(Permission.ViewPlayerIPs)) { if (info.LeaveReason != LeaveReason.Unknown) { textBox1.Text += String.Format("About {0}:\r\n Last seen {1} ago from {2} ({3}).\r\n", info.Name, info.TimeSinceLastSeen.ToMiniString(), info.LastIP, info.LeaveReason); } else { textBox1.Text += String.Format("About {0}:\r\n Last seen {1} ago from {2}.\r\n", info.Name, info.TimeSinceLastSeen.ToMiniString(), info.LastIP); } } else { if (info.LeaveReason != LeaveReason.Unknown) { textBox1.Text += String.Format("About {0}:\r\n Last seen {1} ago ({2}).\r\n", info.Name, info.TimeSinceLastSeen.ToMiniString(), info.LeaveReason); } else { textBox1.Text += String.Format("About {0}:\r\n Last seen {1} ago.\r\n", info.Name, info.TimeSinceLastSeen.ToMiniString()); } } } // Show login information textBox1.Text += String.Format(" Logged in {0} time(s) since {1:d MMM yyyy}.\r\n", info.TimesVisited, info.FirstLoginDate); } if (info.IsFrozen) { textBox1.Text += String.Format(" Frozen {0} ago by {1}\r\n", info.TimeSinceFrozen.ToMiniString(), info.FrozenByClassy); } if (info.IsMuted) { textBox1.Text += String.Format(" Muted for {0} by {1}\r\n", info.TimeMutedLeft.ToMiniString(), info.MutedByClassy); float blocks = ((info.BlocksBuilt + info.BlocksDrawn) - info.BlocksDeleted); if (blocks < 0) { textBox1.Text += String.Format(" &CWARNING! {0} has deleted more than built!\r\n", info.ClassyName);//<---- LinkLoftWing, lul } } // Show ban information IPBanInfo ipBan = IPBanList.Get(info.LastIP); switch (info.BanStatus) { case BanStatus.Banned: if (ipBan != null) { textBox1.Text += String.Format(" Account and IP are BANNED. See /BanInfo\r\n"); } else { textBox1.Text += String.Format(" Account is BANNED. See /BanInfo\r\n"); } break; case BanStatus.IPBanExempt: if (ipBan != null) { textBox1.Text += String.Format(" IP is BANNED, but account is exempt. See /BanInfo\r\n"); } else { textBox1.Text += String.Format(" IP is not banned, and account is exempt. See /BanInfo\r\n"); } break; case BanStatus.NotBanned: if (ipBan != null) { textBox1.Text += String.Format(" IP is BANNED. See /BanInfo\r\n"); } break; } if (!info.LastIP.Equals(System.Net.IPAddress.None)) { // Show alts List <PlayerInfo> altNames = new List <PlayerInfo>(); int bannedAltCount = 0; foreach (PlayerInfo playerFromSameIP in PlayerDB.FindPlayers(info.LastIP)) { if (playerFromSameIP == info) { continue; } altNames.Add(playerFromSameIP); if (playerFromSameIP.IsBanned) { bannedAltCount++; } } // Stats if (info.BlocksDrawn > 500000000) { textBox1.Text += String.Format(" Built {0} and deleted {1} blocks, drew {2}M blocks, wrote {3} messages.\r\n", info.BlocksBuilt, info.BlocksDeleted, info.BlocksDrawn / 1000000, info.MessagesWritten); } else if (info.BlocksDrawn > 500000) { textBox1.Text += String.Format(" Built {0} and deleted {1} blocks, drew {2}K blocks, wrote {3} messages.\r\n", info.BlocksBuilt, info.BlocksDeleted, info.BlocksDrawn / 1000, info.MessagesWritten); } else if (info.BlocksDrawn > 0) { textBox1.Text += String.Format(" Built {0} and deleted {1} blocks, drew {2} blocks, wrote {3} messages.\r\n", info.BlocksBuilt, info.BlocksDeleted, info.BlocksDrawn, info.MessagesWritten); } else { textBox1.Text += String.Format(" Built {0} and deleted {1} blocks, wrote {2} messages.\r\n", info.BlocksBuilt, info.BlocksDeleted, info.MessagesWritten); } // More stats if (info.TimesBannedOthers > 0 || info.TimesKickedOthers > 0 || info.PromoCount > 0) { textBox1.Text += String.Format(" Kicked {0}, Promoted {1} and banned {2} players.\r\n", info.TimesKickedOthers, info.PromoCount, info.TimesBannedOthers); } if (info.TimesKicked > 0) { if (info.LastKickDate != DateTime.MinValue) { textBox1.Text += String.Format(" Got kicked {0} times. Last kick {1} ago by {2}\r\n", info.TimesKicked, info.TimeSinceLastKick.ToMiniString(), info.LastKickByClassy); } else { textBox1.Text += String.Format(" Got kicked {0} times.\r\n", info.TimesKicked); } if (info.LastKickReason != null) { textBox1.Text += String.Format(" Kick reason: {0}\r\n", info.LastKickReason); } } // Promotion/demotion if (info.PreviousRank == null) { if (info.RankChangedBy == null) { textBox1.Text += String.Format(" Rank is {0} (default).\r\n", info.Rank.Name); } else { textBox1.Text += String.Format(" Promoted to {0} by {1} {2} ago.\r\n", info.Rank.Name, info.RankChangedByClassy, info.TimeSinceRankChange.ToMiniString()); if (info.RankChangeReason != null) { textBox1.Text += String.Format(" Promotion reason: {0}\r\n", info.RankChangeReason); } } } else if (info.PreviousRank <= info.Rank) { textBox1.Text += String.Format(" Promoted from {0} to {1} by {2} {3} ago.\r\n", info.PreviousRank.Name, info.Rank.Name, info.RankChangedByClassy, info.TimeSinceRankChange.ToMiniString()); if (info.RankChangeReason != null) { textBox1.Text += String.Format(" Promotion reason: {0}\r\n", info.RankChangeReason); } } else { textBox1.Text += String.Format(" Demoted from {0} to {1} by {2} {3} ago.\r\n", info.PreviousRank.Name, info.Rank.Name, info.RankChangedByClassy, info.TimeSinceRankChange.ToMiniString()); if (info.RankChangeReason != null) { textBox1.Text += String.Format(" Demotion reason: {0}\r\n", info.RankChangeReason); } } if (!info.LastIP.Equals(System.Net.IPAddress.None)) { // Time on the server TimeSpan totalTime = info.TotalTime; if (info != null) { totalTime = totalTime.Add(info.TimeSinceLastLogin); } textBox1.Text += String.Format(" Spent a total of {0:F1} hours ({1:F1} minutes) here.\r\n", totalTime.TotalHours, totalTime.TotalMinutes); } } }