private FileInfo CreateGameDatabaseFiles(Game game, DirectoryInfo dir) { FileInfo gameFile = GameTableFile(game); var db = CreateSQLLiteConnection.Create(gameFile); db.CreateTable <GameTable>(); db.CreateTable <PlayersTable>(); db.CreateTable <PlayerTable>(); GameTable gametable = new GameTable(); gametable.ID = game.ID; int turnID = 0; foreach (Player player in game.Players) { PlayerTable playerTable = new PlayerTable(); playerTable.ID = player.ID; playerTable.Name = player.Name; playerTable.Email = player.EMail; PlayersTable playersTable = new PlayersTable(); playersTable.GameID = game.ID; playersTable.PlayerID = player.ID; playersTable.Turn = turnID; turnID++; } return(gameFile); }
public override void RunImpl() { //меджик формула : itemid - 30 + 1000000000 Item item = getClient().getPlayer().getItemById(ID); Player player = getClient().getPlayer(); int oldID = item.Id; ItemsTable.DelItem(oldID); int NewID = oldID - 30 + 1000000000; int CouponTime = Convert.ToInt32(DateTime.Now.ToString("yyMMddHHmm") + "0000070000");//актуальное время + 7 дней(для теста) ItemsTable.AddItem(getClient().getPlayer().PlayerID, NewID, 10, 3, CouponTime); switch (NewID) // Need help for get ItemID { case 100040001: player.setEffect2(player.getEffect2() + 32); // Mega HP 5% PlayersTable.UpdateEffect2(player.AccountID, player.getEffect2() + 32); break; } if ( NewID != 100040001) { getClient().SendPacket((SendPacket)new PROTOCOL_INVENTORY_DELET_ITEM_ACK(ID)); // Verify for me? } getClient().SendPacket((SendPacket)new PROTOCOL_INVENTORY_ADD_ITEM_ACK(NewID)); }
public async Task SyncAsync() { if (!IsOnline) { return; } ReadOnlyCollection <MobileServiceTableOperationError> syncErrors = null; try { await App.MobileService.SyncContext.PushAsync().ConfigureAwait(false); await GamesTable.PullAsync("AllGames", this.GamesTable.CreateQuery()).ConfigureAwait(false); await PlayersTable.PullAsync("AllPlayers", this.PlayersTable.CreateQuery()).ConfigureAwait(false); await VenuesTable.PullAsync("AllVenues", this.PlayersTable.CreateQuery()).ConfigureAwait(false); await GamePlayersTable.PullAsync("AllGamePlayers", this.GamePlayersTable.CreateQuery()).ConfigureAwait(false); await TeesTable.PullAsync("AllTees", this.TeesTable.CreateQuery()).ConfigureAwait(false); await ScoresTable.PullAsync("AllScores", this.ScoresTable.CreateQuery()).ConfigureAwait(false); } catch (MobileServicePushFailedException exc) { if (exc.PushResult != null) { syncErrors = exc.PushResult.Errors; } } // Simple error/conflict handling. if (syncErrors != null) { foreach (var error in syncErrors) { if (error.OperationKind == MobileServiceTableOperationKind.Update && error.Result != null) { //Update failed, reverting to server's copy. await error.CancelAndUpdateItemAsync(error.Result).ConfigureAwait(false); } else { // Discard local change. await error.CancelAndDiscardItemAsync().ConfigureAwait(false); } Debug.WriteLine(@"Error executing sync operation. Item: {0} ({1}). Operation discarded.", error.TableName, error.Item["id"]); } } }
public override void RunImpl() { checkPlayer = PlayersTable.checkPlayer[Name]; if (checkPlayer == null) { PlayersTable.CreatePlayer(getClient().getAccount().AccountID, Name); getClient().SendPacket(new PROTOCOL_LOBBY_CREATE_PLAYER_ACK(0x4a100080)); } else { getClient().SendPacket(new PROTOCOL_LOBBY_CREATE_PLAYER_ACK(0x80000113));//занято! } }
private void AddPlayer(long id, long gameId, long userId, string name, Color color, Rank rank) { if (id >= UserDatabase.START_FOR_NEXT_IDS) { throw new InvalidOperationException("START_FOR_NEXT_IDS too low!"); } var now = SystemClock.Instance.UtcNow(); PlayersTable.Add(new DbPlayer { Id = id, UserId = userId, Username = name, GameId = gameId, Color = color == Color.White, Rank = rank.Name, CreatedAt = now }); }
public override void ReadImpl() { //ReadH(); loginLength = ReadC(); login = ReadS(loginLength); AccountTable.LoadTable(); getClient().setAccount(AccountTable.accounts[login]); /* Загружаем всю базу данных крч */ ClansTable.LoadTable(); ItemsTable.LoadTable(); PlayersTable.LoadTable(); QuestsTable.LoadTable(); TitlesTable.LoadTable(); PlayersConfigTable.LoadTable(); PlayersStatsTable.LoadTable(); TitlesTable.LoadTable(); PlayerEquipTable.LoadTable(); PlayersMedalsTable.LoadTable(); getClient().setPlayer(PlayersTable.players[getClient().getAccount().AccountID]); getClient().getPlayer().setClient(getClient()); getClient().getPlayer().setAddress(((IPEndPoint)getClient()._address).Address.ToString()); }
static void Main(string[] args) { Console.Title = "Point Blank Auth Server"; Logger.Info("==============================================================================="); Logger.Info("Point Blank Auth Server"); Logger.Info("Develop OZ-Network.RU - 2016"); Logger.Info("==============================================================================="); ConfigModel.Load(); Logger.Warn("Load XML======================================================================="); TutorialParser.Load(); GameServersParser.Load(); Logger.Warn("Load DataBase=================================================================="); Connector.Connect(); ClansTable.LoadTable(); AccountTable.LoadTable(); ItemsTable.LoadTable(); PlayersTable.LoadTable(); QuestsTable.LoadTable(); PlayersConfigTable.LoadTable(); PlayersStatsTable.LoadTable(); TitlesTable.LoadTable(); PlayerEquipTable.LoadTable(); PlayersMedalsTable.LoadTable(); FriendsTable.LoadTable(); Logger.Warn("Load Protection================================================================"); ProtectionService.Initialization(); Logger.Warn("Load Network==================================================================="); NetworkS.Load(); int Mask = 0; Mask |= 1 << (int)Maps.StageId.TD_PORTAKABA; Mask |= 1 << (int)Maps.StageId.TD_REDROCK; Console.WriteLine(Mask); }
static void Main(string[] args) { try { Console.Title = "Point Blank Game Server"; Logger.Info("==============================================================================="); Logger.Info("Point Blank Game Server"); Logger.Info("Develop OZ-Network.RU - 2016"); Logger.Info("==============================================================================="); ConfigModel.Load(); Logger.Warn("Load XML======================================================================="); ChannelsParser.Load(); GoodsParser.Load(); LevelUpParser.Load(); TutorialParser.Load(); Logger.Warn("Load DataBase=================================================================="); Connector.Connect(); ClansTable.LoadTable(); AccountTable.LoadTable(); ItemsTable.LoadTable(); PlayersTable.LoadTable(); QuestsTable.LoadTable(); TitlesTable.LoadTable(); PlayersConfigTable.LoadTable(); PlayersStatsTable.LoadTable(); TitlesTable.LoadTable(); PlayerEquipTable.LoadTable(); PlayersMedalsTable.LoadTable(); Logger.Warn("Load Network==================================================================="); NetworkS.Load(); } catch (Exception e) { Logger.Error("[FATAL ERROR] " + e); } }
public PlayerService() { Access = new Access(); PlayersTable = new PlayersTable(Helper.DbPath); }
public override void WriteImpl() { Logger.Warn("Item Type: " + Slot); WriteH(0x213); if (error == 0) { WriteD(1); WriteD(Convert.ToInt32(DateTime.Now.ToString("yyMMddHHmm"))); //DateTimeUtil.getDateTime() Logger.Warn("TIME: " + Convert.ToInt32(DateTime.Now.ToString("yyMMddHHmm"))); if (item.ItemType >= 0) { if (item.ItemType < 5) { WriteD(0); WriteD(1); WriteD(0); //Добавляем итем в базу данных ItemsTable.AddItem(item.OwnerId, item.ItemId, item.ItemType, item.Type, item.Count); } else if (item.ItemType > 4 & item.ItemType < 10) { WriteD(1); WriteD(0); WriteD(0); //Добавляем итем в базу данных ItemsTable.AddItem(item.OwnerId, item.ItemId, item.ItemType, item.Type, item.Count); } else if (item.ItemType >= 10) { WriteD(0); WriteD(0); WriteD(1); int newID = item.ItemId + 30 - 1000000000; ItemsTable.AddItem(item.OwnerId, newID, item.ItemType, item.Type, item.Count); } } Money = player.getMoney(); GP = player.getGp(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); if (item.ItemType == 3) { WriteQ(0); } else { WriteQ(item.ItemId); } WriteD(item.ItemId); //id WriteC((byte)item.Type); //settings weapon - type WriteD(item.Count); //settings weapon - count WriteD(player.getGp()); WriteD(player.getMoney()); } else { WriteD((int)error); } }
public async Task <PlayerDto> GetPlayer(string myPlayerId) { return(Mapper.Map <PlayerDto>(await PlayersTable.LookupAsync(myPlayerId).ConfigureAwait(false))); }
/// <summary> /// /// </summary> /// <param name="line"></param> /// <param name="e"></param> /// <param name="payload"></param> private void ProcessRequest(string line, Exception e, object payload) { // Make sure socket hasn't closed or thrown an exception if (ReferenceEquals(line, null) && ReferenceEquals(e, null) || !ReferenceEquals(e, null)) { return; } // The StringSocket to talk to this client. StringSocket ss = (StringSocket)payload; // Lowercase the line so we can process requests case-insensitively line = line.ToLower(); // Remove whitespace from the end of the string that browsers seem to tack on and I can't seem to do a match for line = line.Trim(); // Send valid HTTP connection message ss.BeginSend("HTTP/1.1 200 OK\r\n", (ee, pp) => { }, null); ss.BeginSend("Connection: close\r\n", (ee, pp) => { }, null); ss.BeginSend("Content-Type: text/html; charset=UTF-8\r\n", (ee, pp) => { }, null); ss.BeginSend("\r\n", (ee, pp) => { }, null); // Upon receiving "GET /players HTTP/1.1" the server will send back an HTML web page containing a table of information // reporting all games played. The table should have one row for each player in the database and four columns. // Each row should consist of the player's name, the number of games won by the player, the number of games lost by the player, // and the number of games tied by the player. if (line == "get /players http/1.1" || line == "get /players/ http/1.1") { PlayersTable pt = new PlayersTable(); // Connect to the DB using (MySqlConnection conn = new MySqlConnection(connectionString)) { try { // Open a connection conn.Open(); // Create a command MySqlCommand command = conn.CreateCommand(); command.CommandText = "SELECT * from Players"; // Execute the command and cycle through the DataReader object using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { pt.name.Add(reader["Name"].ToString()); pt.won.Add((int)reader["Won"]); pt.tied.Add((int)reader["Tied"]); pt.lost.Add((int)reader["Lost"]); } } } catch (Exception f) { Console.WriteLine(f.Message); } } // Start sending data back to web page as HTML table ss.BeginSend("All Games Played: " + "<table width=\"100%\" border=\"2\">" + "<tr>" + "<td>Player Name</td>" + "<td>Games Won</td>" + "<td>Games Tied</td>" + "<td>Games Lost</td>" + "</tr>" + "<tr>", (ee, pp) => { }, null); for (int i = 0; i < pt.name.Count; i++) { ss.BeginSend("<tr>" + string.Format("<td><a href=\"/games?player={0}\">{0}</a></td>", pt.name[i]) + string.Format("<td>{0}</td>", pt.won[i]) + string.Format("<td>{0}</td>", pt.tied[i]) + string.Format("<td>{0}</td>", pt.lost[i]) + "</tr>", (ee, pp) => { }, null); } // Link to all Players and all Games ss.BeginSend("</table>" + "<p>" + "<a href=\"/players\">List of all Players</a>" + "</p>" + "<p>" + "<a href=\"/games\">List of all Games</a>" + "</p>", (ee, pp) => { }, null); } // Upon receiving "GET /games?player=Joe HTTP/1.1" the server will send back an HTML web page containing // a table of information reporting all games by the player "Joe". There should be one row for each // game played by the player named in the line of text (e.g., "Joe" in the example above) and six columns. // Each row should consist of a number that uniquely identifies the game (see the next paragraph for how that number will be used), // the date and time when the game was played, the name of the opponent, the score for the named player, and the score for the opponent. else if (Regex.IsMatch(line, @"^get /games\?player=[a-z0-9_]{1,20} http/1\.1")) // Player names are capped at 20 max (see Player class) { GamesTable gt = new GamesTable(); bool player1 = false; // Extract the player's name from the line string playerName = line.Substring(18, line.Length - 27); // Connect to the DB using (MySqlConnection conn = new MySqlConnection(connectionString)) { try { // Open a connection conn.Open(); // Create a command MySqlCommand command = conn.CreateCommand(); // Check to see if player exists in Player1 field or Player2 field command.CommandText = "SELECT Player1 from Games WHERE Player1 = '" + playerName + "'"; using (MySqlDataReader reader = command.ExecuteReader()) { if (reader.Read()) { player1 = true; } } // If player exists in Player1 field, get opponents data if (player1) { command.CommandText = "SELECT GameID, DateTime, Player2, Player1Score, Player2Score from Games WHERE Player1 = '" + playerName + "'"; using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { gt.gameID.Add((int)reader["GameID"]); gt.dateTime.Add(reader["DateTime"].ToString()); gt.player2.Add(reader["Player2"].ToString()); gt.player1Score.Add((int)reader["Player1Score"]); gt.player2Score.Add((int)reader["Player2Score"]); } } } // Player must be in Player2 field else { command.CommandText = "SELECT GameID, DateTime, Player1, Player1Score, Player2Score from Games WHERE Player2 = '" + playerName + "'"; using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { gt.gameID.Add((int)reader["GameID"]); gt.dateTime.Add(reader["DateTime"].ToString()); gt.player1.Add(reader["Player1"].ToString()); gt.player1Score.Add((int)reader["Player1Score"]); gt.player2Score.Add((int)reader["Player2Score"]); } } } } catch (Exception f) { Console.WriteLine(f.Message); } } ss.BeginSend(string.Format("<p>Player {0} Stats:</p>", playerName) + "<table width=\"100%\" border=\"2\">" + "<tr>"+ "<td>Game ID</td>" + "<td>Date & Time</td>" + "<td>Opponent Name</td>" + "<td>Your Score</td>" + "<td>Opponent Score</td>" + "</tr>" , (ee, pp) => { }, null); // If the player is in Player1 field, post data on Player2 as opponent if (player1) { for (int i = 0; i < gt.gameID.Count; i++) { ss.BeginSend("<tr>" + string.Format("<td><a href=\"/game?id={0}\">{0}</a></td>", gt.gameID[i]) + string.Format("<td>{0}</td>", gt.dateTime[i]) + string.Format("<td><a href=\"/games?player={0}\">{0}</a></td>", gt.player2[i]) + string.Format("<td>{0}</td>", gt.player1Score[i]) + string.Format("<td>{0}</td>", gt.player2Score[i]) + "</tr>", (ee, pp) => { }, null); } } // Player is in Player2 field, post data on Player1 as opponent else { for (int i = 0; i < gt.gameID.Count; i++) { ss.BeginSend("<tr>" + string.Format("<td><a href=\"/game?id={0}\">{0}</a></td>", gt.gameID[i]) + string.Format("<td>{0}</td>", gt.dateTime[i]) + string.Format("<td><a href=\"/games?player={0}\">{0}</a></td>", gt.player1[i]) + string.Format("<td>{0}</td>", gt.player2Score[i]) + string.Format("<td>{0}</td>", gt.player1Score[i]) + "</tr>", (ee, pp) => { }, null); } } // Link to all Players and all Games ss.BeginSend("</table>" + "<p>" + "<a href=\"/players\">List of all Players</a>" + "</p>" + "<p>" + "<a href=\"/games\">List of all Games</a>" + "</p>", (ee, pp) => { }, null); } // Upon receiving "GET /game?id=35 HTTP/1.1" the server should send back an HTML page containing information // about the specified game (e.g., 35 in this example). The page should contain the names and scores of // the two players involved, the date and time when the game was played, a 4x4 table containing the Boggle board that was used, // the time limit that was used for the game, and the five-part word summary. else if (Regex.IsMatch(line, @"get /game\?id=[1-9][0-9]{0,11} http/1\.1")) // Put a cap on game numbers (11 integers long) { GamesTable gt = new GamesTable(); WordsTable wt = new WordsTable(); // Extract the gameID from the line string gameIDAsString = line.Substring(13, line.Length-22); int gameID; int.TryParse(gameIDAsString, out gameID); // This cannot fail because of the Regex above (0-11 ints long) // Connect to the DB using (MySqlConnection conn = new MySqlConnection(connectionString)) { try { // Open a connection conn.Open(); // Create a command MySqlCommand command = conn.CreateCommand(); command.CommandText = "SELECT Player1, Player2, Player1Score, Player2Score, DateTime, Board, TimeLimit, Word, Status " + "FROM Games, Words WHERE Games.GameID = " + gameID + " AND Words.Game = " + gameID; gt.gameID.Add(gameID); // Execute the command and cycle through the DataReader object using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { gt.player1.Add(reader["Player1"].ToString()); gt.player2.Add(reader["Player2"].ToString()); gt.player1Score.Add((int)reader["Player1Score"]); gt.player2Score.Add((int)reader["Player2Score"]); gt.dateTime.Add(reader["DateTime"].ToString()); gt.board = reader["Board"].ToString(); gt.timeLimit = (int)reader["TimeLimit"]; wt.word.Add(reader["Word"].ToString()); wt.status.Add(reader["Status"].ToString()); } } } catch (Exception f) { Console.WriteLine(f.Message); } } // Send game stats ss.BeginSend(string.Format("<p>Game {0} Stats:</p>", gameID) + "<table width=\"100%\" border=\"2\">" + "<tr>" + "<td>Player 1 Name</td>" + "<td>Player 2 Name</td>" + "<td>Player 1 Score</td>" + "<td>Player 2 Score</td>" + "<td>Date & Time</td>" + "<td>Time Limit</td>" + "</tr>", (ee, pp) => { }, null); ss.BeginSend("<tr>" + string.Format("<td><a href=\"/games?player={0}\">{0}</a></td>", gt.player1[0]) + string.Format("<td><a href=\"/games?player={0}\">{0}</a></td>", gt.player2[0]) + string.Format("<td>{0}</td>", gt.player1Score[0]) + string.Format("<td>{0}</td>", gt.player2Score[0]) + string.Format("<td>{0}</td>", gt.dateTime[0]) + string.Format("<td>{0}</td>", gt.timeLimit) + "</tr>" + "</table>", (ee, pp) => { }, null); // Send board configuration as a 4x4 table ss.BeginSend("<p>Board Configuration:</p>" + "<table width=\"10%\" border=\"2\">", (ee, pp) => { }, null); // first row string board1 = gt.board.Substring(0, 4); ss.BeginSend("<tr>", (ee, pp) => { }, null); for(int i = 0; i < 4; i++) { ss.BeginSend(string.Format("<td>{0}</td>", board1[i]), (ee, pp) => { }, null); } ss.BeginSend("</tr>", (ee, pp) => { }, null); // second row string board2 = gt.board.Substring(4, 4); ss.BeginSend("<tr>", (ee, pp) => { }, null); for (int i = 0; i < 4; i++) { ss.BeginSend(string.Format("<td>{0}</td>", board2[i]), (ee, pp) => { }, null); } ss.BeginSend("</tr>", (ee, pp) => { }, null); // third row string board3 = gt.board.Substring(8, 4); ss.BeginSend("<tr>", (ee, pp) => { }, null); for (int i = 0; i < 4; i++) { ss.BeginSend(string.Format("<td>{0}</td>", board3[i]), (ee, pp) => { }, null); } ss.BeginSend("</tr>", (ee, pp) => { }, null); // fourth row string board4 = gt.board.Substring(12, 4); ss.BeginSend("<tr>", (ee, pp) => { }, null); for (int i = 0; i < 4; i++) { ss.BeginSend(string.Format("<td>{0}</td>", board4[i]), (ee, pp) => { }, null); } ss.BeginSend("</tr>", (ee, pp) => { }, null); ss.BeginSend("</table>", (ee, pp) => { }, null); // Send word summary ss.BeginSend("<p>Word Summary</p>" + "<table width=\"15%\" border=\"2\">", (ee, pp) => { }, null); for (int i = 0; i < wt.word.Count; i++) { ss.BeginSend("<tr>"+ string.Format("<td>{0}</td>", wt.word[i]) + string.Format("<td>{0}</td>", wt.status[i]) , (ee, pp) => { }, null); } // Link to all Players and all Games ss.BeginSend("</table>" + "<p>" + "<a href=\"/players\">List of all Players</a>" + "</p>"+ "<p>" + "<a href=\"/games\">List of all Games</a>" + "</p>", (ee, pp) => { }, null); } else if (line == "get /games http/1.1" || line == "get /games/ http/1.1") { GamesTable gt = new GamesTable(); // Connect to the DB using (MySqlConnection conn = new MySqlConnection(connectionString)) { try { // Open a connection conn.Open(); // Create a command MySqlCommand command = conn.CreateCommand(); command.CommandText = "SELECT GameID, Player1, Player2, DateTime FROM Games"; // Execute the command and cycle through the DataReader object using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { gt.gameID.Add((int)reader["GameID"]); gt.player1.Add(reader["Player1"].ToString()); gt.player2.Add(reader["Player2"].ToString()); gt.dateTime.Add(reader["DateTime"].ToString()); } } } catch (Exception f) { Console.WriteLine(f.Message); } } // Send game stats ss.BeginSend("<p>List of all Games in Database:</p>" + "<table width=\"50%\" border=\"2\">" + "<tr>" + "<td>Game ID</td>" + "<td>Player 1 Name</td>" + "<td>Player 2 Name</td>" + "<td>Date & Time</td>" + "</tr>", (ee, pp) => { }, null); for (int i = 0; i < gt.player1.Count; i++) { ss.BeginSend("<tr>" + string.Format("<td><a href=\"/game?id={0}\">{0}</a></td>", gt.gameID[i]) + string.Format("<td><a href=\"/games?player={0}\">{0}</a></td>", gt.player1[i]) + string.Format("<td><a href=\"/games?player={0}\">{0}</a></td>", gt.player2[i]) + string.Format("<td>{0}</td>", gt.dateTime[i]) + "</tr>", (ee, pp) => { }, null); } // Link to all Players and all Games ss.BeginSend("</table>" + "<p>" + "<a href=\"/players\">List of all Players</a>" + "</p>", (ee, pp) => { }, null); } // If the first line of text sent by the browser to the server is anything else, the server should send back an HTML page // containing an error message. The error message should be meaningful and contain a summary of valid options. else { // The line below this one is a generic placeholder for what needs to be sent ss.BeginSend(string.Format("<p>ERROR, you sent: [{0}]</p><p>The only valid commands are /players, /games?player=[player name], and /game?id=[integer]</p>", line), (ee, pp) => { }, null); } // Close the StringSocket ss.Close(); }
public override void RunImpl() { if (getClient() == null) { return; } Player player = getClient().getPlayer(); //PlayersTable.UpdateMission(player.PlayerID, missionID, 0); switch (missionID) { case 1: //Tutorial Mission Card break; case 2: //Dino Tutorial Mission Card break; case 3: //Infantry Card Set break; case 5: // player.setGp(player.getGp() - 5000); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 6: // player.setGp(player.getGp() - 5000); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 7: // player.setGp(player.getGp() - 5000); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 8: // player.setGp(player.getGp() - 5400); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 9: // player.setGp(player.getGp() - 5800); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 10: // player.setGp(player.getGp() - 8300); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 11: // player.setGp(player.getGp() - 11000); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 12: // break; case 14: // player.setGp(player.getGp() - 5500); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 15: // player.setGp(player.getGp() - 5000); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 16: player.setGp(player.getGp() - 9500); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; case 17: player.setGp(player.getGp() - 9000); //вычитаем цену сета Money = player.getGp(); GP = player.getMoney(); //Обновляем кол-во средств на аккаунте PlayersTable.UpdateMoney(player.PlayerID, GP, Money); break; } getClient().SendPacket(new PROTOCOL_BASE_MISSION_BUY_ACK(missionID, player)); }
public override void WriteImpl() { SLOT slotByPlayer = room.getRoomSlotByPlayer(player); clan = player.Clan; level = LevelUpParser._levels[player.getRank()]; stats = PlayersStatsTable.statistics[player.PlayerID]; /* Левел ап */ if (player.getRank() < 52) { if (player.getExp() >= level.getOnAllExp()) { player.setRank(player.getRank() + 1); PlayersTable.UpdateRank(player.PlayerID,player.getRank()); player.setGp(player.getGp() + LevelUpParser._levels[player.getRank()].getOnGPUp()); PlayersTable.UpdateGP_Exp(player.PlayerID,player.getGp() + level.getOnGPUp(),player.getExp()); player.getClient().SendPacket(new PACKET_LEVEL_UP_ACK(player.getRank())); } } WriteH(0xD08); if (room.getType() == 1) { if (room.getBlueKills() > room.getRedKills()) { WriteC(1); } if (room.getRedKills() > room.getBlueKills()) { WriteC(0); } if (room.getRedKills() == room.getBlueKills()) { WriteC(2); } } if (room.getType() == 2) { if (room.getBlueWinRounds() > room.getRedWinRounds()) { WriteC(1); } if (room.getRedWinRounds() > room.getBlueWinRounds()) { WriteC(0); } if (room.getRedWinRounds() == room.getBlueWinRounds()) { WriteC(2); } } if (room.getType() == 4) { if (room.getBlueWinRounds() > room.getRedWinRounds()) { WriteC(1); } if (room.getRedWinRounds() > room.getBlueWinRounds()) { WriteC(0); } if (room.getRedWinRounds() == room.getBlueWinRounds()) { WriteC(2); } } WriteH(3); // что это??? WriteH(2); // что это??? int GP,Exp; // Опыт for (int i = 0; i < 16; i++) { SLOT slot = room.getRoomSlot(i); if (room.getSpecial() == 6) { WriteH((short)slot.getAllExp()); player.setExp(player.getExp() + slot.getAllExp()); } else { WriteH((short)slot.getAllExp()); player.setExp(player.getExp() + slot.getAllExp()); } } // Очки for (int i = 0; i < 16; i++) { SLOT slot = room.getRoomSlot(i); if (room.getSpecial() == 6) { WriteH((short)slot.getAllGp()); player.setExp(player.getExp() + slot.getAllExp()); } else { WriteH((short)slot.getAllGp()); player.setExp(player.getExp() + slot.getAllExp()); } } /* Записываем в базу данных */ Exp = player.getExp(); GP = player.getGp(); PlayersTable.UpdateGP_Exp(player.PlayerID,GP,Exp); //Очки за ботов for (int i = 0; i < 16; i++) { WriteH(0); } WriteB(new byte[] { //Рейты по 2 байта на слот //В скобках|Иконка 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, 0x08,0x00, }); WriteB(new byte[] { //Иконки Ivent/PC_Cafe/Item 0xFF,0x00, 0xFF,0x00, 0xFF,0x00, 0xFF,0x00, 0xFF,0x00, 0xFF,0x00, 0xFF,0x00, 0xFF,0x00, }); WriteS(player.getName(),Player.MAX_NAME_SIZE); // Имя перса WriteD(player.getExp()); // опыт WriteD(player.getRank()); // ранк (0-54) WriteD(player.getRank()); // фейк-ранг для купона скрытия ранга WriteD(player.getGp()); // ГП WriteD(player.getMoney()); // Рублики WriteD(player == null ? (int)clan.Id : (int)0); // ClanID WriteD(player == null ? (int)clan.Color : (int)0); // ClanNameColor WriteD(0); // Unk WriteC(0); // Unk WriteD(player.getPCCafe()); //pc cafe WriteH((short)player.getEmblem()); //Лычка поидеи WriteS("",17); WriteC(0); //unk WriteH(clan != null ? (short)clan.Rank : (short)0); WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo1())); WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo2())); WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo3())); WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo4())); WriteH(0); WriteD(0); // Непонятно разделитель WriteB(new byte[8] { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 }); /* Статистика */ WriteD(stats.getFights()); //всего боев WriteD(stats.getWins()); //всего побед WriteD(stats.getLosts()); //всего поражений WriteD(0); // unk WriteD(stats.getKills()); //кол-во убийств WriteD(stats.getHeadshots()); //кол-во хедшотов WriteD(stats.getDeaths()); //кол-во смертей WriteD(0); // unk WriteD(stats.getKills()); //опять килы о.о WriteD(stats.getEscapes()); //всего ливнул WriteD(stats.getSeasonFights()); //всего боев за сезон WriteD(stats.getSeasonWins()); //всего побед за сезон WriteD(stats.getSeasonLosts()); //всего поражений за сезон WriteD(0); // unk WriteD(stats.getSeasonKills()); //киллы сезон по идее WriteD(stats.getSeasonHeadshots()); //хеды сезон по идее WriteD(stats.getSeasonDeaths()); //смерти сезон по идее WriteD(0); // unk WriteD(stats.getSeasonKills()); //опять килы,хз зачем WriteD(stats.getSeasonEscapes()); //сколько ливнул за сезон WriteH((short)room.getRedWinRounds()); WriteH((short)room.getBlueWinRounds()); WriteB(new byte[49]); }