public void Load(PangyaBinaryReader reader, byte[] roomKey) { //var result = reader.ReadBytes(56); var decrypted = DecryptShot( reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position)) , roomKey); ResponseShot = decrypted.Take(38).ToArray(); var readerDecripted = new PangyaBinaryReader(new MemoryStream(decrypted)); ConnectionId = readerDecripted.ReadInt32(); X = readerDecripted.ReadInt32(); Y = readerDecripted.ReadInt32(); Z = readerDecripted.ReadInt32(); ShotType = (ShotTypeEnum)readerDecripted.ReadByte(); Unknown1 = readerDecripted.ReadInt16(); Pang = readerDecripted.ReadUInt32(); BonusPang = readerDecripted.ReadUInt32(); Unknown2 = readerDecripted.ReadInt32(); MatchData = readerDecripted.ReadBytes(6); Unknown3 = readerDecripted.ReadBytes(17); }
public static bool LoginResult(this LPlayer session, Packet packet) { if (!packet.ReadPStr(out session.UserInfo.GetLogin)) { return(false); } if (!packet.ReadPStr(out session.UserInfo.GetPass)) { return(false); } Console.WriteLine($"Login packet: {session.UserInfo.GetLogin}:{session.UserInfo.GetPass}"); var count = Directory.GetFiles(@"Packets", "*.*", SearchOption.TopDirectoryOnly).Count(); if (count >= 7) { if (File.Exists("Packets\\Login.hex")) { var reader = new PangyaBinaryReader(new MemoryStream(File.ReadAllBytes("Packets\\Login.hex"))); reader.Skip(3); var GetLogin = reader.ReadPStr(); session.UserInfo.GetUID = reader.ReadUInt32(); session.UserInfo.GetCapability = (byte)reader.ReadUInt32(); session.UserInfo.GetLevel = (byte)reader.ReadUInt32(); reader.Skip(6); var GetNickname = reader.ReadPStr(); if (string.IsNullOrEmpty(GetNickname)) { session.Response.Write(new byte[] { 0x01, 0x00 }); session.Response.WriteByte((byte)0xD8);//Call Create NickName session.Response.WriteInt32(0); session.SavePacket("PlayerCallCreateNickName"); session.SendResponse(); return(false); } else { session.UserInfo.GetNickname = GetNickname; return(true); } } } if (string.IsNullOrEmpty(session.UserInfo.GetNickname)) { session.Response.Write(new byte[] { 0x01, 0x00 }); session.Response.WriteByte((byte)0xD8);//Call Create NickName session.Response.WriteInt32(0); session.SavePacket("PlayerCallCreateNickName"); session.SendResponse(); return(false); } return(true); }
//Constructor public GrandPrixDataCollection() { MemoryStream Buffer; IffGrandPrixData GrandPrix; FGPData = new Dictionary <uint, IffGrandPrixData>(); PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "GrandPrixData.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\GrandPrixData.iff is not loaded"); return; } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { GrandPrix = new IffGrandPrixData(); GrandPrix = (IffGrandPrixData)Reader.Read(GrandPrix); FGPData.Add(GrandPrix.TypeID, GrandPrix); } } finally { Reader.Dispose(); Buffer.Dispose(); } }
//Constructor public void Load() { MemoryStream Buffer; Desc Desc; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_jp.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Desc.iff"); //verifica se existe o arquivo if (FileZip == null) { Console.WriteLine(" data\\Desc.iff is not loaded"); return; } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new NotSupportedException("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { Desc = new Desc(); Desc = (Desc)Reader.Read(new Desc()); Add(Desc); } } finally { Reader.Dispose(); Buffer.Dispose(); } }
public override void Load(PangyaBinaryReader reader) { this.Username = reader.ReadPStr(); this.UID = reader.ReadInt32(); reader.Skip(6); this.AuthKeyLogin = reader.ReadPStr(); this.ServerVersion = reader.ReadPStr(); this.Check = reader.ReadUInt32(); reader.Skip(4); this.AuthKeyGame = reader.ReadPStr(); }
public void Load() { MemoryStream Buffer = null; Card Card; PangyaBinaryReader Reader = null; ListCard = new List <Card>(); using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Card.iff"); //verifica se existe o arquivo if (FileZip == null) { throw new Exception("data\\Card.iff is not loaded"); } Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = (Reader.GetSize() - 8L) / recordCount; Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { var Count = Marshal.SizeOf(new Card()); Card = (Card)Reader.Read(new Card()); Add(Card.Base.TypeID, Card); } } catch (Exception ex) { MessageBox.Show(ex.Message); Console.ReadKey(); } finally { Reader.Dispose(); } }
//Constructor public MemorialShopRareItemCollection() { MemoryStream Buffer; IffMemorialRareItemData Rare; SpecialItemData = new List <SpecialItem>(); PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "MemorialShopRareItem.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\MemorialShopRareItem.iff is not loaded"); return; } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { Rare = (IffMemorialRareItemData)Reader.Read(new IffMemorialRareItemData()); this.Add(Rare); } this.AddSPList(); } finally { Reader.Dispose(); Buffer.Dispose(); } }
public CardCollection() { MemoryStream Buffer; IffCardData Card; PangyaBinaryReader Reader = null; ListCard = new List <IffCardData>(); Cards = new ItemRandomClass(); PackData = new Dictionary <uint, CardPack>(); using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Card.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\Card.iff is not loaded"); return; } Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { Card = (IffCardData)Reader.Read(new IffCardData()); Add(Card.Base.TypeID, Card); } CreateCardPack(); CreateCardItem(); } finally { Reader.Dispose(); } }
public override void Load(PangyaBinaryReader reader) { Game = new Game() { Un = reader.ReadByte(), TimeSec = reader.ReadUInt32(), TimeMin = reader.ReadUInt32(), MaxPlayers = reader.ReadByte(), Mode = (GameTypeEnum)reader.ReadByte(), //ok Holes = reader.ReadByte(), // Course = (GameMapTypeEnum)reader.ReadByte(), HoleOrder = (GameModeTypeEnum)reader.ReadByte(), NaturalMode = reader.ReadUInt32(), RoomTitle = reader.ReadPStr(), Password = reader.ReadPStr(), Artifact = reader.ReadUInt32() }; Game.BuildCreateHole(); }
//Constructor public void Load() { MemoryStream Buffer; Character Character; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_th.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Character.iff"); //verifica se existe o arquivo if (FileZip == null) { throw new Exception(" data\\Character.iff is not loaded"); } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { var Count = Marshal.SizeOf(new Character()); Character = (Character)Reader.Read(new Character()); Add(Character.Base.TypeID, Character); } } finally { Reader.Dispose(); Buffer.Dispose(); } }
public void Load() { MemoryStream Buffer; GrandPrixRankReward GP; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_jp.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "GrandPrixRankReward.iff"); //verifica se existe o arquivo if (FileZip == null) { throw new Exception(" data\\GrandPrixRankReward.iff is not loaded"); } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { GP = (GrandPrixRankReward)Reader.Read(new GrandPrixRankReward()); if (this.Where(c => c.Key == GP.TypeID).Any() == false) { this.Add(GP.TypeID, GP); } } } finally { Reader.Dispose(); } }
//Constructor public CadieMagicCollection() { MemoryStream Buffer; IffCadieMagicBoxData item; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "CadieMagicBox.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\CadieMagicBox.iff is not loaded"); return; } Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { item = (IffCadieMagicBoxData)Reader.Read(new IffCadieMagicBoxData()); this.Add(item); } AddMagicBox(); } finally { Buffer.Dispose(); } }