Advertisement
Guest User

Player

a guest
Nov 12th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.68 KB | None | 0 0
  1. using PangyaAPI.BinaryModels;
  2. using System;
  3. using System.IO;
  4. using System.Net;
  5. using System.Net.Sockets;
  6.  
  7. namespace PangyaAPI
  8. {
  9.     public partial class Player
  10.     {
  11.         #region private Fields
  12.         private static PangyaCryptographyOld.Pang _pang;
  13.         #endregion
  14.  
  15.         #region Delegates
  16.         public delegate void PacketChangedEvent();
  17.         #endregion
  18.  
  19.         #region Events
  20.         public event PacketChangedEvent OnPacketChanged;
  21.         #endregion
  22.  
  23.         #region Public Fields
  24.  
  25.         public PangyaBinaryWriter Response;
  26.  
  27.         //Conexão
  28.         public TcpClient Tcp;
  29.  
  30.         public Socket socket;
  31.  
  32.         /// <summary>
  33.         /// Packet Atual
  34.         /// </summary>
  35.         private Packet _currentPacket;
  36.  
  37.         public Packet CurrentPacket
  38.         {
  39.             get { return _currentPacket; }
  40.             set
  41.             {
  42.                 _currentPacket = value;
  43.                 OnPacketChanged?.Invoke();
  44.             }
  45.         }
  46.  
  47.  
  48.         /// <summary>
  49.         /// Packet Anterior
  50.         /// </summary>
  51.         public Packet PreviousPacket { get; set; }
  52.  
  53.         //Teste
  54.         public UInt16 GameID { get; set; }
  55.  
  56.  
  57.         public UInt32 Title_TypeID = 0;
  58.  
  59.         public byte TypeChat = 0x00;
  60.  
  61.         public byte Game_Role { get; set; } //game_role diz ser admin da sala byte 8 , quem entra apos ser criada a sala é byte 1
  62.  
  63.         public byte Game_Slot = 0x01; //
  64.  
  65.         public byte Game_ready = 0x00; //coloco 0,
  66.  
  67.         public UInt16 ID_ROM { get; set; } = 1;
  68.  
  69.         public int ConnectionId { get; set; }
  70.  
  71.         public byte CountList {get; set;}
  72.  
  73.         //Identificador da conta no banco de dados
  74.         public PlayerMemberInfo UserInfo { get; set; }
  75.  
  76.         //estatica do player
  77.         public PlayerStaticInfo InfoStatistic { get; set; }
  78.  
  79.         public PlayerMemberMacro Macro { get; set; }
  80.  
  81.         //Chave de criptografia e decriptografia
  82.         public byte Key { get; private set; }
  83.  
  84.         #endregion
  85.  
  86. //        private ProjectG _projectG { get; set; }
  87.         public Player(TcpClient tcp)
  88.         {
  89.             _pang = new PangyaCryptographyOld.Pang();
  90.  
  91.  
  92.             Tcp = tcp;
  93.  
  94.             //Gera uma chave dinâmica
  95.             Key = Convert.ToByte(new Random().Next(1, 17));
  96.  
  97.             //Maximo hexadecimal value: FF (255)
  98.  
  99.             ////Chave Fixa
  100.             Key = 0x0A; //chave 10
  101.  
  102.             //_responseStream = new MemoryStream();
  103.             Response = new PangyaBinaryWriter(new MemoryStream());
  104.         }
  105.  
  106.         public string GetIpAdress()
  107.         {
  108.             return ((IPEndPoint)Tcp.Client.RemoteEndPoint).Address.ToString();
  109.         }
  110.  
  111.         public void Disconnect()
  112.         {
  113.             Tcp.Close();
  114.         }        
  115.     }
  116.  
  117.     public class PlayerMemberInfo
  118.     {
  119.         public int UID { get; set; }
  120.  
  121.         public byte? IDState { get; set; }
  122.  
  123.         public byte? Logon { get; set; }
  124.  
  125.         public byte? FirstSet { get; set; }
  126.  
  127.         public string Username { get; set; }
  128.  
  129.         public string Password { get; set; }
  130.  
  131.         public string Nickname { get; set; }
  132.  
  133.         public string AuthKey_Login { get; set; }
  134.         public string AuthKey_Game { get; set; }
  135.         public int? Cookie { get; set; }
  136.         public int Pang { get; set; }
  137.         public byte? Sex { get; set; }
  138.         public byte? Capabilities { get; set; }
  139.  
  140.         public int? DailyLoginCount { get; set; }
  141.         public DateTime? LastLogonTime { get; set; }
  142.         public UInt32 CHARACTER_ID { get; set; }
  143.  
  144.     }
  145.     public class PlayerMemberMacro
  146.     {
  147.         public string Macro1 { get; set; }
  148.         public string Macro2 { get; set; }
  149.         public string Macro3 { get; set; }
  150.         public string Macro4 { get; set; }
  151.         public string Macro5 { get; set; }
  152.         public string Macro6 { get; set; }
  153.         public string Macro7 { get; set; }
  154.         public string Macro8 { get; set; }
  155.         public string Macro9 { get; set; }
  156.         public string Macro10 { get; set; }
  157.     }
  158.     public class PlayerStaticInfo
  159.     {
  160.         public int UID { get; set; }
  161.         public int Drive { get; set; }
  162.         public int Putt { get; set; }
  163.         public int Playtime { get; set; }
  164.         public float Longest { get; set; }
  165.         public int Distance { get; set; }
  166.         public int Pangya { get; set; }
  167.         public int Hole { get; set; }
  168.         public int TeamHole { get; set; }
  169.         public int Holeinone { get; set; }
  170.         public int OB { get; set; }
  171.         public int Bunker { get; set; }
  172.         public int Fairway { get; set; }
  173.         public int Albatross { get; set; }
  174.         public int Holein { get; set; }
  175.         public int Pang { get; set; }
  176.         public int Timeout { get; set; }
  177.         public short Game_Level { get; set; }
  178.         public int Game_Point { get; set; }
  179.         public int PuttIn { get; set; }
  180.         public float LongestPuttIn { get; set; }
  181.         public float LongestChipIn { get; set; }
  182.         public int NoMannerGameCount { get; set; }
  183.         public int ShotTime { get; set; }
  184.         public int GameCount { get; set; }
  185.         public int DisconnectGames { get; set; }
  186.         public int wTeamWin { get; set; }
  187.         public int wTeamGames { get; set; }
  188.         public short LadderPoint { get; set; }
  189.         public short LadderWin { get; set; }
  190.         public short LadderLose { get; set; }
  191.         public short LadderDraw { get; set; }
  192.         public int ComboCount { get; set; }
  193.         public int MaxComboCount { get; set; }
  194.         public int TotalScore { get; set; }
  195.         public short BestScore0 { get; set; }
  196.         public short BestScore1 { get; set; }
  197.         public short BestScore2 { get; set; }
  198.         public short BestScore3 { get; set; }
  199.         public short BESTSCORE4 { get; set; }
  200.         public int MaxPang0 { get; set; }
  201.         public int MaxPang1 { get; set; }
  202.         public int MaxPang2 { get; set; }
  203.         public int MaxPang3 { get; set; }
  204.         public int MAXPANG4 { get; set; }
  205.         public int SumPang { get; set; }
  206.         public short LadderHole { get; set; }
  207.         public int GameCountSeason { get; set; }
  208.         public long SkinsPang { get; set; }
  209.         public int SkinsWin { get; set; }
  210.         public int SkinsLose { get; set; }
  211.         public int SkinsRunHoles { get; set; }
  212.         public int SkinsStrikePoint { get; set; }
  213.         public int SkinsAllinCount { get; set; }
  214.         public int EventValue { get; set; }
  215.         public int EventFlag { get; set; }
  216.  
  217.         public byte Unknow = 0x00;
  218.  
  219.         public byte[] Unknow2 { get; set; } = new byte[6];//5 ou 6?
  220.  
  221.         public byte[] Unknow3 { get; set; } = new byte[8];
  222.  
  223.     }
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement