Exemple #1
0
        public void Send(uint UID)
        {
            var _db   = new PangyaEntities();
            var Query = $"EXEC [dbo].[ProcMailInsert] @UID = '{UID}',  @SENDER_MAIL = '{Sender}',  @SENDER_MSG_MAIL = '{Message}', @JSONData = '{GetSqlUpdateMailString()}'";

            _db.Database.SqlQuery <PangyaEntities>(Query).FirstOrDefault();
        }
Exemple #2
0
        public byte[] GetBuildServerInfo()
        {
            var _db        = new PangyaEntities();
            var GameServer = _db.ProcGetGameServer().ToList();

            using (var Response = new PangyaBinaryWriter())
            {
                Response.Write(new byte[] { 0x9F, 0x00, Convert.ToByte(GameServer.Count) });
                foreach (var server in GameServer)
                {
                    Response.WriteStr(server.Name, 40);
                    Response.WriteUInt32((uint)server.ServerID);    //server UID
                    Response.WriteUInt32((uint)server.MaxUser);     //suporte maximo de jogadores no servidor simultaneamente
                    Response.WriteUInt32((uint)server.UsersOnline); //Total de jogadores no servidor atualmente ou simultaneamente(limitador)
                    Response.WriteStr(server.IP, 18);
                    Response.WriteUInt32((uint)server.Port);
                    Response.WriteUInt32((uint)server.Property); //imagem do grand prix 2048, manto 16
                    Response.WriteUInt32(0);                     //Angelic Number Count
                    Response.WriteUInt16((ushort)server.ImgEvent);
                    Response.WriteUInt16(126);
                    Response.WriteUInt16(160);
                    Response.WriteUInt16(100);//rate pang
                    Response.WriteUInt16(server.ImgNo);
                }
                Response.Write(Build(false));
                return(Response.GetBytes());
            }
        }
Exemple #3
0
        public AuthClient(TcpClient client, AuthPacket packet)
        {
            Tcp = client;
            ServerSettings ClientData;

            ClientData = new ServerSettings()
            {
                UID             = packet.Message._data.UID,
                Type            = packet.Message._data.Type,
                AuthServer_Ip   = packet.Message._data.AuthServer_Ip,
                AuthServer_Port = packet.Message._data.AuthServer_Port,
                Port            = packet.Message._data.Port,
                MaxPlayers      = packet.Message._data.MaxPlayers,
                IP          = packet.Message._data.IP,
                Key         = packet.Message._data.Key,
                Name        = packet.Message._data.Name,
                BlockFunc   = packet.Message._data.BlockFunc,
                EventFlag   = packet.Message._data.EventFlag,
                GameVersion = packet.Message._data.GameVersion,
                ImgNo       = packet.Message._data.ImgNo,
                Property    = packet.Message._data.Property,
                Version     = packet.Message._data.Version,
            };
            Data = ClientData;

            using (var _db = new PangyaEntities())
            {
                if (_db.Pangya_Server.Where(c => c.ServerID == Data.UID).Any())
                {
                    var query = $"UPDATE [dbo].[Pangya_Server] Set Active = '{1}' where ServerID = '{Data.UID}'";
                    _db.Database.SqlQuery <PangyaEntities>(query).FirstOrDefault();
                }
            }
        }
Exemple #4
0
        // PlayerSave
        public void Save(PangyaEntities _db)
        {
            // # PLAYER TOOLBAR UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_TOOLBAR  @UID = '{UID}', @ITEMSTR = '{GetSqlUpdateToolbar()}'").FirstOrDefault();

            // #PLAYER ITEM UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_ITEM  @UID = '{UID}', @ITEMSTR = '{ItemWarehouse.GetSqlUpdateItems()}'").FirstOrDefault();

            // #PLAYER CADDIE UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CADDIE  @UID = '{UID}', @ITEMSTR = '{ItemCaddie.GetSqlUpdateCaddie()}'").FirstOrDefault();

            // #PLAYER CHARACTER AND EQUIP UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CHARACTER_EQUIP  @UID = '{UID}', @EQUIPSTR = '{ItemCharacter.GetSqlUpdateCharacter()}'").FirstOrDefault();

            // #PLAYER CARD UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CARD  @UID = '{UID}', @ITEMSTR = '{ItemCard.GetSqlUpdateCard()}'").FirstOrDefault();

            // #PLAYER CARD EQUIP UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CARD_EQUIP  @UID = '{UID}', @ITEMSTR = '{ItemCardEquip.GetSqlUpdateCardEquip()}'").FirstOrDefault();

            // #PLAYER MASCOT UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_MASCOT  @UID = '{UID}', @ITEMSTR = '{ItemMascot.GetSqlUpdateMascots()}'").FirstOrDefault();

            _db.Dispose();
        }
        public void PlayerChangeLockerPwd(GPlayer player, Packet packet)
        {
            var OLDPWD = packet.ReadPStr();
            var NEWPWD = packet.ReadPStr();

            // forem diferentes
            if (player.LockerPWD != OLDPWD)
            {
                player.SendResponse(new byte[] { 0x6C, 0x01, 0x75, 0x00, 0x00, 0x00 });
            }
            if (NEWPWD.Length >= 4)
            {
                var _db    = new PangyaEntities();
                var change = _db.ProcSetLockerPwd((int)player.GetUID, NEWPWD).FirstOrDefault();

                if (change != 1)
                {
                    return;
                }

                player.LockerPWD = NEWPWD;


                player.SendResponse(new byte[] { 0x74, 0x01, 0x00, 0x00, 0x00, 0x00, });
            }
        }
Exemple #6
0
        public void PlayerGetMatchHistory(GPlayer player)
        {
            var _db   = new PangyaEntities();
            var check = _db.ProcGetMatchHistory((int)player.GetUID).ToList();

            player.Response.Write(new byte[] { 0x0E, 0x01 });
            if (check.Count == 0)
            {
                player.Response.WriteZero(260); //260 bytes
            }
            else
            {
                foreach (var data in check)
                {
                    player.Response.Write(data.SEX.Value);
                    player.Response.WriteStr(data.NICKNAME, 22);
                    player.Response.WriteStr(data.USERID, 22);
                    player.Response.Write(data.UID.Value);
                }
            }
            player.SendResponse();

            if (player.GameID == ushort.MaxValue)
            {
                player.SendResponse(new byte[] { 0x2E, 0x02, 0x00, 0x00, 0x00, 0x00 });
                player.SendResponse(new byte[] { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
            }
        }
        public void PlayerDeleteMail(GPlayer PL, Packet packet)
        {
            var _db = new PangyaEntities();
            int Ret = 0;

            if (!packet.ReadUInt32(out uint Count))
            {
                return;
            }

            try
            {
                for (var I = 0; I <= Count - 1; I++)
                {
                    if (!packet.ReadUInt32(out uint MailIndex))
                    {
                        return;
                    }
                    Ret = (int)_db.ProcDelMail((int)PL.GetUID, (int)MailIndex).FirstOrDefault();
                }

                if (Ret == 0)
                {
                    PL.SendResponse(new byte[] { 0x14, 0x02, 0xFA, 0x16, 0x2D, 0x00 });//still have an item in email so cannot be deleted
                    return;
                }

                PlayerGetMailList(PL, packet, true);
            }
            catch
            {
                PL.Close();
            }
        }
Exemple #8
0
        public void UpdateServer()
        {
            var db    = new PangyaEntities();
            var query = $"UPDATE [dbo].[Pangya_Server] Set UsersOnline = '{Players.Count}' where ServerID = '{Data.UID}'";

            db.Database.SqlQuery <PangyaEntities>(query).FirstOrDefault();
        }
        /// <summary>
        /// Construtor
        /// </summary>
        /// <param name="ip">IP do servidor (Local ou Global)</param>
        /// <param name="port">Porta</param>
        /// <param name="maxConnections">
        /// Número máximo de conexões
        /// Quando o Player se conecta ao Game-server, automaticamente ele é desconectado do LoginServer pois não necessita mais desta comunicação
        /// </param>
        public AuthServer()
        {
            try
            {
                var Ini = new IniFile(ConfigurationManager.AppSettings["Config"]);

                Data = new ServerSettings()
                {
                    Name       = Ini.ReadString("Config", "Name", "AuthServer"),
                    Version    = Ini.ReadString("Config", "Version", "SV_AT_Release_2.0"),
                    UID        = Ini.ReadUInt32("Config", "UID", 7997),
                    MaxPlayers = Ini.ReadUInt32("Config", "MaxPlayers", 3000),
                    Port       = Ini.ReadUInt32("Config", "Port", 7997),
                    IP         = Ini.ReadString("Config", "IP", "127.0.0.1"),
                    Type       = AuthClientTypeEnum.AuthServer
                };
                _server = new TcpListener(IPAddress.Parse(Data.IP), (int)Data.Port);

                db = new PangyaEntities();
            }
            catch (Exception erro)
            {
                WriteConsole.WriteLine($"ERRO_START: {erro.Message}");
                Console.ReadKey();
                Environment.Exit(0);
            }
        }
        public void PlayerShowMailPopUp(GPlayer PL)
        {
            var _db = new PangyaEntities();
            PangyaBinaryWriter Reply;

            Reply = new PangyaBinaryWriter();

            var QueryList = _db.ProcGetMail((int)PL.GetUID, 1, 5, 1).ToList();

            Reply.Write(new byte[] { 0x10, 0x02 });
            Reply.Write(0);
            Reply.Write(QueryList.Count);//count
            foreach (var mail in QueryList)
            {
                var type = Convert.ToUInt32(mail.SETTYPEID > 0 ? mail.SETTYPEID : mail.TYPEID);

                Reply.WriteInt32(mail.Mail_Index);      //Mail_Index
                Reply.WriteStr(mail.Sender, 10);        //Sender
                Reply.WriteZero(123);
                Reply.Write(mail.Mail_Item_Count ?? 0); //Mail_Total COunt
                Reply.Write(uint.MaxValue);             //FF FF FF FF
                Reply.WriteUInt32(type);                //typeID
                Reply.Write((byte)0);                   //time
                Reply.WriteInt32(mail.QTY ?? 0);        //quantidade
                Reply.WriteZero(20);
                Reply.WriteUInt32(uint.MaxValue);       //FF FF FF FF
                Reply.WriteUInt32(0);
                Reply.WriteStr(IsUCCNull(mail.UCC_UNIQUE), 14);
            }
            PL.SendResponse(Reply.GetBytes());
        }
Exemple #11
0
        protected override void ServerExpection(Player Client, Exception Ex)
        {
            var player = (GPlayer)Client;
            var _db    = new PangyaEntities();

            try
            {
                var query = $" exec dbo.ProcSaveExceptionLog @UID = '{player.GetUID}', @USER =  '******', @EXCEPTIONMESSAGE= '{Ex.Message}', @SERVER = '{Data.Name}'";

                _db.Database.SqlQuery <PangyaEntities>(query);

                System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(Ex, true);
                var FileWrite = new StreamWriter("GameLog.txt", true);
                FileWrite.WriteLine($"--------------------------- PLAYER_EXCEPTION ------------------------------------------");
                FileWrite.WriteLine($"Date: {DateTime.Now}");
                FileWrite.WriteLine($"Server_Info: NAME {Data.Name}, ID {Data.UID}, PORT {Data.Port}");
                FileWrite.WriteLine(trace.GetFrame(0).GetMethod().ReflectedType.FullName);
                FileWrite.WriteLine("Method: " + Ex.TargetSite);
                FileWrite.WriteLine("Line: " + trace.GetFrame(0).GetFileLineNumber());
                FileWrite.WriteLine("Column: " + trace.GetFrame(0).GetFileColumnNumber());
                FileWrite.WriteLine($"--------------------------- END ------------------------------------------");
                FileWrite.Dispose();
                if (player.Connected)
                {
                    DisconnectPlayer(player);
                }
            }
            finally
            {
                _db.Dispose();
            }
            new GameTools.ClearMemory().FlushMemory();
        }
Exemple #12
0
        public void PlayerDailyLoginItem(GPlayer player)
        {
            PangyaBinaryWriter Packet;

            Packet = new PangyaBinaryWriter();
            try
            {
                var _db        = new PangyaEntities();
                var DailyLogin = _db.ProcAlterDaily((int)player.GetUID).FirstOrDefault();

                Packet.Write(new byte[] { 0x49, 0x02 });
                Packet.WriteUInt32(0);
                Packet.WriteByte(1);
                Packet.WriteInt32(DailyLogin.Item_TypeID);
                Packet.WriteInt32(DailyLogin.Item_Quantity);
                Packet.WriteInt32(DailyLogin.Item_TypeID_Next);
                Packet.WriteInt32(DailyLogin.Item_Quantity_Next);
                Packet.WriteInt32(DailyLogin.counter);
                player.SendResponse(Packet);
            }
            catch
            {
                player.Close();
            }
            finally
            {
                if (Packet != null)
                {
                    Packet.Dispose();
                }
            }
        }
        void Build(int UID)
        {
            var _db = new PangyaEntities();

            foreach (var info in _db.ProcGetCaddies(UID))
            {
                if (info.DAY_LEFT == null)
                {
                    info.DAY_LEFT = 0;
                }

                var SkinHour = (info.SKIN_HOUR_LEFT == null ? (ushort)0 : (ushort)info.SKIN_HOUR_LEFT);
                var caddie   = new PlayerCaddieData()
                {
                    CaddieIdx         = (uint)info.CID,
                    CaddieTypeId      = (uint)info.TYPEID,
                    CaddieSkin        = (uint)info.SKIN_TYPEID,
                    CaddieSkinEndDate = GameTools.TCompare.IfCompare(info.SKIN_END_DATE == null, DateTime.MinValue, info.SKIN_END_DATE),
                    CaddieLevel       = info.cLevel,
                    CaddieExp         = (uint)info.EXP,
                    CaddieType        = (byte)info.RentFlag,
                    CaddieDay         = (ushort)info.DAY_LEFT,//DIAS RESTANTES
                    CaddieSkinDay     = SkinHour,
                    CaddieAutoPay     = (ushort)info.TriggerPay,
                    CaddieDateEnd     = (DateTime)info.END_DATE,
                    CaddieNeedUpdate  = false
                };
                CadieAdd(caddie);
            }
        }
        public void PlayerConnectMessengerServer(GPlayer PL)
        {
            var db = new PangyaEntities();

            try
            {
                var server = db.ProcGetMessengerServer().ToList();
                PL.Response.Write(new byte[] { 0xFC, 0x00 });
                PL.Response.Write((byte)server.Count);
                foreach (var servidor in server)
                {
                    PL.Response.WriteStr(servidor.Name, 40);
                    PL.Response.Write(servidor.ServerID);
                    PL.Response.Write(servidor.MaxUser);        //Max Users
                    PL.Response.Write(PL.Server.Players.Count); //total de players conectados
                    PL.Response.WriteStr(servidor.IP, 18);
                    PL.Response.Write(servidor.Port);
                    PL.Response.Write(4096);//propriedade
                    PL.Response.WriteZero(13);
                }
                PL.SendResponse();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                db.Dispose();
            }
        }
Exemple #15
0
        public void UpdateClient(AuthClient Client)
        {
            var db = new PangyaEntities();

            var query = $"UPDATE [dbo].[Pangya_Server] Set UsersOnline = '{0}', Active = '{0}' where ServerID = '{Client.Data.UID}'";

            db.Database.SqlQuery <PangyaEntities>(query).FirstOrDefault();
        }
 public void Update()
 {
     using (var _db = new PangyaEntities())
     {
         if (_db.Pangya_Server.Where(c => c.ServerID == UID).Any())
         {
             var query = $"UPDATE [dbo].[Pangya_Server] Set Name = '{Name}', IP = '{IP}', Port =  '{Port}',MaxUser = '******', Property = '{Property}', BlockFunc = '{BlockFunc}', ImgNo = '{ImgNo}',ImgEvent = '{EventFlag}', UsersOnline =  '{0}', Active = '{1}' where ServerID = '{UID}'";
             _db.Database.SqlQuery <PangyaEntities>(query).FirstOrDefault();
         }
     }
 }
 static PlayerConnector()
 {
     try
     {
         DB = new PangyaEntities();
     }
     catch
     {
         MessageBox.Show("failed To Connect DB", "Pang.SqlConnector");
     }
 }
        public void PlayerReadMail(GPlayer PL, Packet packet)
        {
            var _db = new PangyaEntities();
            PangyaBinaryWriter Reply;


            if (!packet.ReadUInt32(out uint MailIndex))
            {
                return;
            }

            Reply = new PangyaBinaryWriter();

            var QueryList = _db.ProcReadMail((int)PL.GetUID, (int)MailIndex).ToList();

            try
            {
                if (QueryList.Count > 0)
                {
                    Reply.Write(new byte[] { 0x12, 0x02 });
                    Reply.Write((uint)0);
                    Reply.Write(QueryList.First().Mail_Index);             //Select Page
                    Reply.WritePStr(QueryList.First().Sender);             //Sender
                    Reply.WritePStr(QueryList.First().RegDate.ToString()); //IsRead
                    Reply.WritePStr(QueryList.First().Msg);
                    Reply.Write((byte)1);
                    Reply.Write(QueryList.Count);//FF FF FF FF
                    foreach (var data in QueryList)
                    {
                        Reply.Write(uint.MaxValue);
                        Reply.Write(data.TYPEID);                       //typeID
                        Reply.Write(Convert.ToByte(data.IsTime));
                        Reply.Write(data.QTY ?? 0);                     //quantidade
                        Reply.Write(Convert.ToUInt32(data.DAY ?? 0));   //dias
                        Reply.WriteZero(16);
                        Reply.Write(4294967295);                        //FF FF FF FF
                        Reply.Write(0);
                        Reply.WriteStr(IsUCCNull(data.UCC_UNIQUE), 14); //UCC_UNIQUE
                    }
                    PL.SendResponse(Reply.GetBytes());
                }
                else
                {
                    Reply.Write(new byte[] { 0x12, 0x02 });
                    Reply.Write((uint)2);
                    PL.SendResponse(Reply.GetBytes());
                }
            }
            catch
            {
                PL.Close();
            }
        }
Exemple #19
0
        public void PlayerSaveMacro(GPlayer player, Packet Reader)
        {
            var Macro = new string[8];

            for (int i = 0; i < 8; i++)
            {
                Reader.ReadPStr(out Macro[i], 64);
            }

            var _db   = new PangyaEntities();
            var query = $"exec ProcSaveMacro @UID = {player.GetUID}, @Macro1 = {Macro[0]}, @Macro2 = {Macro[1]}, @Macro3 = {Macro[2]}, @Macro4 = {Macro[3]}, @Macro5 = {Macro[4]}, @Macro6 = {Macro[5]}, @Macro7 = {Macro[6]}, @Macro8 = {Macro[7]}";

            _db.Database.SqlQuery <PangyaEntities>(query);
        }
Exemple #20
0
 public void InsertServer()
 {
     using (var _db = new PangyaEntities())
     {
         if (_db.Pangya_Server.Where(c => c.ServerID == UID).Any())
         {
             var query = $"UPDATE [dbo].[Pangya_Server] Set Name = '{Name}', IP = '{IP}', Port =  '{Port}',MaxUser = '******', Property = '{Property}', BlockFunc = '{BlockFunc}', ImgNo = '{ImgNo}',ImgEvent = '{EventFlag}', UsersOnline =  '{0}', Active = '{1}' where ServerID = '{UID}'";
             _db.Database.SqlQuery <PangyaEntities>(query).FirstOrDefault();
         }
         else
         {
             var query = $"INSERT INTO [dbo].[Pangya_Server](ServerID, Name ,IP ,Port ,MaxUser, UsersOnline ,Property ,BlockFunc ,ImgNo ,ImgEvent ,ServerType ,Active) VALUES( '{UID}','{Name}', '{IP}', '{Port}','{MaxPlayers}', '{0}','{Property}', '{BlockFunc}','{ImgNo}', '{EventFlag}', '{Convert.ToInt32(Type)}', '{1}')";
             _db.Database.SqlQuery <PangyaEntities>(query).FirstOrDefault();
         }
     }
 }
        /// <summary>
        /// Construtor
        /// </summary>
        public PlayerConnector(Player player)
        {
            _player = player;
            _db     = new PangyaEntities();

            Member = _db.Pangya_Member.FirstOrDefault(p => p.Username == _player.Username);

            if (Member != null)
            {
                User_Statistics = _db.Pangya_User_Statistics.FirstOrDefault(p => p.UID == Member.UID);

                var guild = $"Exec [dbo].[ProcGuildGetPlayerData] @UID = '{Member.UID}'";

                GuilData = _db.Database.SqlQuery <ProcGuildGetPlayerData_Result>(guild).FirstOrDefault();
            }
        }
Exemple #22
0
        public PlayerInventory(UInt32 TUID)
        {
            UID               = TUID;
            ItemCardEquip     = new CardEquipCollection((int)UID);
            ItemCharacter     = new CharacterCollection((int)UID);
            ItemMascot        = new MascotCollection((int)UID);
            ItemWarehouse     = new WarehouseCollection((int)UID);
            ItemCaddie        = new CaddieCollection((int)UID);
            ItemCard          = new CardCollection((int)UID);
            ItemTransaction   = new TransactionsCollection();
            ItemRoom          = new FurnitureCollection((int)UID);
            ItemSlot          = new ItemSlotData();
            ItemDecoration    = new ItemDecorationData();
            ItemTrophies      = new TrophyCollection();
            ItemTrophyGP      = new TrophyGPCollection();
            ItemTrophySpecial = new TrophySpecialCollection();
            ItemSlotData Items;
            var          _db = new PangyaEntities();

            foreach (var info in _db.ProcGetToolbar((int)UID))
            {
                Items = new ItemSlotData
                {
                    Slot1  = (uint)info.ITEM_SLOT_1,
                    Slot2  = (uint)info.ITEM_SLOT_2,
                    Slot3  = (uint)info.ITEM_SLOT_3,
                    Slot4  = (uint)info.ITEM_SLOT_4,
                    Slot5  = (uint)info.ITEM_SLOT_5,
                    Slot6  = (uint)info.ITEM_SLOT_6,
                    Slot7  = (uint)info.ITEM_SLOT_7,
                    Slot8  = (uint)info.ITEM_SLOT_8,
                    Slot9  = (uint)info.ITEM_SLOT_9,
                    Slot10 = (uint)info.ITEM_SLOT_10,
                };

                ItemSlot.SetItemSlot(Items);
                SetTitleIndex((uint)info.Skin_1);
                SetCharIndex((uint)info.CHARACTER_ID);
                SetCaddieIndex((uint)info.CADDIE);
                SetBallTypeID((uint)info.BALL_ID);
                SetClubSetIndex((uint)info.CLUB_ID);
                SetMascotIndex((uint)info.MASCOT_ID);
                SetPoster((uint)info.POSTER_1, (uint)info.POSTER_2);
            }

            ItemCharacter.Card = ItemCardEquip;
        }
Exemple #23
0
        void Build(int UID)
        {
            var _db = new PangyaEntities();

            foreach (var info in _db.ProcGetCard(UID))
            {
                var card = new PlayerCardData()
                {
                    CardIndex      = (uint)info.CARD_IDX,
                    CardTypeID     = (uint)info.CARD_TYPEID,
                    CardQuantity   = (uint)info.QTY,
                    CardIsValid    = (byte)info.VALID,
                    CardNeedUpdate = false
                };
                this.Add(card);
            }
        }
        public void PlayerGetLockerItem(GPlayer player, Packet packet)
        {
            List <LockerItem> item;


            item = new List <LockerItem>();


            var TotalPage = (ushort)Math.Ceiling(a: 20 * 1.0);

            //dados não utilizados
            uint Unknown = packet.ReadUInt32();
            int  Pages   = packet.ReadUInt16();
            var  _db     = new PangyaEntities();

            item = _db.Database.SqlQuery <LockerItem>($"EXEC [dbo].[ProcGetLockerItem] @UID = '{player.GetUID}', @PAGE = '{Pages}', @PAGE_TOTAL = '{20}'").ToList();

            player.Response.Write(new byte[] { 0x6D, 0x01 });
            if (item.Count == 0)
            {
                player.Response.WriteZero(5);
            }
            else
            {
                player.Response.Write(TotalPage);     // total page
                player.Response.Write((ushort)Pages); //page current
                player.Response.Write((byte)item.Count);
                foreach (var data in item)
                {
                    player.Response.Write((uint)data.INVEN_ID);
                    player.Response.Write((uint)0);
                    player.Response.Write((uint)data.TypeID);
                    player.Response.Write((uint)0);
                    player.Response.Write(player.GetUID);//??
                    player.Response.WriteZero(0x1B);
                    player.Response.WriteStr(data.UCC_UNIQE, 9);
                    player.Response.Write((ushort?)data.UCC_COPY_COUNT ?? 0);
                    player.Response.Write(data.UCC_STATUS);
                    player.Response.WriteZero(0x36);
                    player.Response.WriteStr(data.UCC_NAME, 16);
                    player.Response.WriteZero(0x19);
                    player.Response.WriteStr(data.NICKNAME, 0x16);
                }
            }
            player.SendResponse();
        }
Exemple #25
0
        public AddItemData AddRent(uint TypeID, ushort Day = 7)
        {
            object      PRent;
            AddItemData Result;

            Result = new AddItemData()
            {
                Status = false
            };

            if (!(TypeID.GetItemGroup() == IffGroupFlag.ITEM_TYPE_PART))
            {
                return(Result);
            }
            var _db = new PangyaEntities();
            var Add = _db.ProcAddRent((int)UID, (int)TypeID, Day).ToList();

            if (Add.Count <= 0)
            {
                return(Result);
            }
            foreach (var data in Add)
            {
                PRent = new WarehouseData();

                ((WarehouseData)(PRent)).ItemIndex     = (uint)data.ITEM_INDEX;
                ((WarehouseData)(PRent)).ItemTypeID    = (uint)data.ITEM_TYPEID;
                ((WarehouseData)(PRent)).ItemC0        = 0;
                ((WarehouseData)(PRent)).ItemUCCUnique = string.Empty;
                ((WarehouseData)(PRent)).CreateNewItem();
                ((WarehouseData)(PRent)).ItemFlag    = (byte)data.ITEM_FLAG;
                ((WarehouseData)(PRent)).ItemEndDate = data.ITEM_DATE_END;
                ItemWarehouse.ItemAdd((WarehouseData)(PRent));

                Result.Status      = true;
                Result.ItemIndex   = ((WarehouseData)(PRent)).ItemIndex;
                Result.ItemTypeID  = ((WarehouseData)(PRent)).ItemTypeID;
                Result.ItemOldQty  = 0;
                Result.ItemNewQty  = 1;
                Result.ItemUCCKey  = ((WarehouseData)(PRent)).ItemUCCUnique;
                Result.ItemFlag    = (byte)((WarehouseData)(PRent)).ItemFlag;
                Result.ItemEndDate = ((WarehouseData)(PRent)).ItemEndDate;
            }

            return(Result);
        }
Exemple #26
0
        void AddShopRentItem(GPlayer PL, ShopItemRequest ShopItem)
        {
            AddData  ItemAddedData;
            TBuyItem DataBuy;

            ItemAddedData = PL.Inventory.AddRent(ShopItem.IffTypeId);

            DataBuy = new TBuyItem
            {
                Flag     = 0x6,
                DayTotal = 0x7,
                EndDate  = null
            };
            var _db = new PangyaEntities();

            PL.SendResponse(ShowBuyItem(ItemAddedData, DataBuy, PL.GetPang, PL.GetCookie));
        }
Exemple #27
0
        public Player(TcpClient tcp)
        {
            Tcp = tcp;

            //Gera uma chave dinâmica
            Key = Convert.ToByte(new Random().Next(1, 15));

            //Max Value hexadecimal value: FF (255)

            ////Chave Fixa
            Key = (byte)(new Random().Next(1, 14) + 1); //chave 10

            Response = new PangyaBinaryWriter(new MemoryStream());

            Connected = true;

            _db = new PangyaEntities();
        }
Exemple #28
0
 public GPlayer(TcpClient tcp) : base(tcp)
 {
     Db                 = new PangyaEntities();
     Achievements       = new List <TAchievement>();
     AchievemetCounters = new Dictionary <uint, TAchievementCounter>();
     AchievementQuests  = new List <TAchievementQuest>();
     InLobby            = false;
     InGame             = false;
     Visible            = 0;
     LockerPWD          = "0";
     GameID             = 0xFFFF;
     LockerPang         = 0;
     Lobby              = null;
     Game               = null;
     GameInfo           = new GamePlay();
     GetSex             = 0x0080;
     ClubTemporary      = new TClubUpgradeTemporary();
 }
        void Build(int UID)
        {
            var _db = new PangyaEntities();

            foreach (var info in _db.ProcGetMascot(UID))
            {
                var mascot = new PlayerMascotData()
                {
                    MascotIndex      = (uint)info.MID,
                    MascotTypeID     = (uint)info.MASCOT_TYPEID,
                    MascotMessage    = info.MESSAGE,
                    MascotEndDate    = (DateTime)info.DateEnd,
                    MascotDayToEnd   = (ushort)info.END_DATE_INT,//DIAS PARA FINALIZAR O MASCOT
                    MascotIsValid    = 1,
                    MascotNeedUpdate = false
                };
                this.MascotAdd(mascot);
            }
        }
        void Build(int UID)
        {
            var _db = new PangyaEntities();

            foreach (var info in _db.ProcGetRoomData(UID))
            {
                var Furniture = new PlayerFurnitureData()
                {
                    Index  = (uint)info.IDX,
                    TypeID = (uint)info.TYPEID,
                    PosX   = (float)info.POS_X,
                    PosY   = (float)info.POS_Y,
                    PosZ   = (float)info.POS_Z,
                    PosR   = (float)info.POS_R,
                    Valid  = 1
                };
                Add(Furniture);
            }
        }