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 #2
0
        public void PlayerRemoveItem(GPlayer player, Packet packet)
        {
            uint TypeId, Quantity;

            TypeId   = packet.ReadUInt32();
            Quantity = packet.ReadUInt32();

            if (!(GetItemGroup(TypeId) == 6))
            {
                return;
            }


            var ItemAddedData = player.Inventory.Remove(TypeId, Quantity, false);

            if (!ItemAddedData.Status)
            {
                return;
            }

            try
            {
                packet.Write(new byte[] { 0xc5, 0x00, 0x01 });
                packet.WriteUInt32(ItemAddedData.ItemTypeID);
                packet.WriteUInt32(Quantity);
                packet.WriteUInt32(ItemAddedData.ItemIndex);
                player.SendResponse(packet.GetBytes());
            }
            finally
            {
                packet.Dispose();
            }
        }
        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();
            }
        }
        GUnit FindBestTarget()
        {
            if (target == null || ppather.IsBlacklisted(target))
                UpdateTimer.ForceReady();
            else
            {
                if (!target.IsValid || target.IsDead)
                    UpdateTimer.ForceReady();
            }

            if (UpdateTimer.IsReady)
            {
                GPlayer[] players = GObjectList.GetPlayers();

                float[] playerScore = new float[players.Length];

                float best_score = 0;
                GPlayer best_player = null;
                for (int i = 0; i < players.Length; i++)
                {
                    GPlayer player = players[i];
                    if (!player.IsSameFaction || ppather.IsBlacklisted(player) ||
                        player == GContext.Main.Me || player.Health < 0.05)
                    {
                        playerScore[i] = -100f;
                    }
                    else
                    {
                        for (int j = 0; j < players.Length; j++)
                        {
                            if (players[j].IsSameFaction && players[j] != GContext.Main.Me &&
                                players[j] != player && players[j].Health > 0.05)
                            {
                                double d = players[j].GetDistanceTo(player);
                                if (d < 30)
                                {
                                    playerScore[i] += 30f - (float)d;
                                }
                            }
                        }
                    }
                    if (playerScore[i] > best_score)
                    {
                        best_player = player;
                        best_score = playerScore[i];
                    }
                }
                if (best_score > 50)
                {
                    target = best_player;
                    if (target != null)
                        PPather.WriteLine("follow player " + target.Name + " score " + best_score);
                }
                else
                    target = null;
                UpdateTimer.Reset();
            }

            return target;
        }
        public void PlayerPutCard(GPlayer PL, Packet packet)
        {
            TCardData             Data;
            PlayerCardData        PLCard;
            PlayerCharacterData   PLCharacter;
            AddData               ItemData;
            PlayerTransactionData Transac;

            Data = (TCardData)packet.Read(new TCardData());

            PLCard      = PL.Inventory.ItemCard.GetCard(Data.CardIndex);
            PLCharacter = PL.Inventory.ItemCharacter.GetChar(Data.CharIndex, CharType.bIndex);


            if (PLCard == null || PLCharacter == null)
            {
                return;
            }

            if (!(PLCard.CardTypeID == Data.CardTypeID) || (!(PLCharacter.TypeID == Data.CharTypeID)))
            {
                return;
            }

            if (!(CardCheckPosition(Data.CardTypeID, Data.Position)))
            {
                return;
            }


            ItemData = PL.Inventory.Remove(Data.CardTypeID, 1, true);

            if (!ItemData.Status)
            {
                PL.SendResponse(new byte[] { 0x71, 0x02, 0xB3, 0xF9, 0x56, 0x00 });
                return;
            }
            if (PL.Inventory.ItemCharacter.Card.UpdateCard(PL.GetUID, PLCharacter.Index, PLCharacter.TypeID, ItemData.ItemTypeID, (byte)Data.Position, 0, 0).First().Key)
            {
                Transac = new PlayerTransactionData()
                {
                    Types        = 0xCB,
                    TypeID       = PLCharacter.TypeID,
                    Index        = PLCharacter.Index,
                    PreviousQuan = 0,
                    NewQuan      = 0,
                    UCC          = "",
                    CardTypeID   = Data.CardTypeID,
                    CharSlot     = (byte)Data.Position,
                };

                PL.Inventory.ItemTransaction.Add(Transac);

                PL.SendTransaction();

                PL.Response.Write(new byte[] { 0x71, 0x02, 0x00, 0x00, 0x00, 0x00 });
                PL.Response.Write(Data.CardTypeID);
                PL.SendResponse();
            }
        }
        public void HandleUserInfo(GPlayer player, Packet packet)
        {
            //Ler UID do player baseado no Login do Player, e a Sessão
            #region Leitura do packet
            var UID     = packet.ReadUInt32();
            var session = packet.ReadByte();
            if (UID > 0)
            {
                player.SearchUID = UID;
            }
            else
            {
                UID = player.SearchUID;
            }
            #endregion

            var Client = (GPlayer)player.Server.GetPlayerByUID(UID);

            //Check
            if (Client != null)
            {
                PlayerOnline(Client, player, session);
            }
            else
            {
                PlayerOffLine(player, (int)UID, session);
            }
        }
Exemple #7
0
        public override void PlayerShotInfo(GPlayer player, Packet packet)
        {
            var ShotType = packet.ReadUInt16();

            byte[] UN;
            var    resp = new PangyaBinaryWriter();

            resp.Write(new byte[] { 0x55, 0x00 });
            resp.Write(player.ConnectionID);
            switch (ShotType)
            {
            case 1:
            {
                packet.Skip(9);
                UN = packet.ReadBytes(61);
                resp.Write(UN);
            }
            break;

            default:
            {
                UN = packet.ReadBytes(61);
                resp.Write(UN);
            }
            break;
            }
            Send(resp);
        }
Exemple #8
0
 public void deplacement(ulong Guid, GPlayer who)
 {
     if (Guid != this.Guid)
     {
         move.FollowMain(Guid, DistanceDuMain, who);
     }
 }
Exemple #9
0
        public void PlayMemorialGacha(GPlayer player, Packet packet)
        {
            uint RandInt, TypeID;

            TypeID = packet.ReadUInt32();

            if (!IffEntry.MemorialCoin.IsExist(TypeID))
            {
                player.SendResponse(new byte[] { 0x64, 0x02, 0x85, 0x073, 0x55, 0x00 });
                WriteConsole.WriteLine("PlayerPlayerMemorialGacha: coin was not found", ConsoleColor.Red);
            }

            var RemoveData = player.Inventory.Remove(TypeID, 1);

            if (!RemoveData.Status)
            {
                player.SendResponse(new byte[] { 0x64, 0x02, 0x85, 0x073, 0x55, 0x00 });
                WriteConsole.WriteLine("PlayerPlayerMemorialGacha: Player don''t have that coin TypeID", ConsoleColor.Red);
            }
            RandInt = Rand.NextUInt(150);

            if (RandInt <= 20)
            {
                GetRareItem(player, TypeID);
            }
            else
            {
                GetNormalItem(player, TypeID);
            }
        }
Exemple #10
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 });
            }
        }
Exemple #11
0
        public void PlayerGetCutinInfo(GPlayer player, Packet packet)
        {
            var cutin = (CutinInfoData)packet.Read(new CutinInfoData());

            switch (cutin.Type)
            {
            case 0:
            {
                player.SendResponse(IffEntry.CutinInfo.GetCutinString(cutin.TypeID));
            }
            break;

            case 1:
            {
                var Char = player.Inventory.GetCharacter(cutin.TypeID);
                var Item = player.Inventory.ItemWarehouse.GetItem(Char.FCutinIndex);
                if (Item == null)
                {
                    return;
                }
                player.SendResponse(IffEntry.CutinInfo.GetCutinString(Item.ItemTypeID));
            }
            break;
            }
        }
Exemple #12
0
    void OnCollisionEnter2D(Collision2D CollisionInfo)
    {
        GameObject OtherObj = CollisionInfo.collider.gameObject;

        if (OtherObj != Owner)
        {
            if (OtherObj.tag == "Player")
            {
                GPlayer     PlayerScript = OtherObj.GetComponent <GPlayer>();
                FPlayerInfo PlayerInfo   = PlayerScript.GetPlayerInfo();

                float TotalDamage = PlayerInfo.Health * 0.65f;

                FDamageInfo DamageInfo = new FDamageInfo();
                DamageInfo.DamageDone = TotalDamage;

                PlayerScript.SendMessage("TakeDamage", DamageInfo);

                Destroy(this.gameObject);
            }
            else if (OtherObj.tag == "Environment")
            {
                //TODO::Splash damage
                Destroy(this.gameObject);
            }
        }
    }
        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, });
            }
        }
        public void PlayerUpgradeClubCancel(GPlayer player)
        {
            void SendCode(byte[] Code)
            {
                player.Response.Write(new byte[] { 0x3F, 0x02 });
                player.Response.Write(Code);
                player.SendResponse();
            }

            if ((player.ClubTemporary.PClub == null))
            {
                SendCode(CLUBSET_NOT_FOUND_OR_NOT_EXIST);
                return;
            }
            if (((PlayerItemData)player.ClubTemporary.PClub).ItemClubSlotCancelledCount >= 5)
            {
                SendCode(CLUBSET_CANNOT_CANCEL);
                return;
            }
            if (!(((PlayerItemData)player.ClubTemporary.PClub).ClubRemoveStatus((TCLUB_STATUS)player.ClubTemporary.UpgradeType)))
            {
                SendCode(CLUBSET_FAIL_CANCEL);
                return;
            }
            // ## add transaction
            player.Inventory.ItemTransaction.AddClubSystem((PlayerItemData)player.ClubTemporary.PClub);
            player.SendTransaction();

            player.Response.Write(new byte[] { 0x3F, 0x02 });
            player.Response.Write(0);
            player.Response.WriteUInt32(((PlayerItemData)player.ClubTemporary.PClub).ItemIndex);
            player.SendResponse();
        }
        public void PlayerUpgradeClubAccept(GPlayer player)
        {
            void SendCode(byte[] Code)
            {
                player.Response.Write(new byte[] { 0x3E, 0x02 });
                player.Response.Write(Code);
                player.SendResponse();
            }

            if ((player.ClubTemporary.PClub == null))
            {
                SendCode(CLUBSET_NOT_FOUND_OR_NOT_EXIST);
                return;
            }
            // ## add transaction
            player.Inventory.ItemTransaction.AddClubSystem(player.ClubTemporary.PClub);
            player.SendTransaction();

            player.Response.Write(new byte[] { 0x3E, 0x02 });
            player.Response.WriteUInt32(0);
            player.Response.WriteUInt32((uint)player.ClubTemporary.UpgradeType);
            player.Response.WriteUInt32(((PlayerItemData)player.ClubTemporary.PClub).ItemIndex);
            player.SendResponse();

            player.Inventory.ItemWarehouse.Update(((PlayerItemData)player.ClubTemporary.PClub));
            //Limpar
            player.ClubTemporary.Clear();
        }
Exemple #16
0
        public override void SendPlayerOnJoin(GPlayer player)
        {
            if (player.GetCapability == 4 || player.GetCapability == 15)
            {
                player.Visible = 4;
            }
            var packet = new PangyaBinaryWriter();

            packet.Write(new byte[] { 0x48, 0x00 });
            packet.Write((byte)0);
            packet.Write(new byte[] { 0xFF, 0xFF });
            packet.WriteByte(Players.Count);
            foreach (var P in Players)
            {
                packet.Write(P.GetGameInfomations(2));
            }
            packet.Write((byte)0);
            Send(packet.GetBytes());

            packet = new PangyaBinaryWriter();
            packet.Write(new byte[] { 0x48, 0x00 });
            packet.Write((byte)1);
            packet.Write(new byte[] { 0xFF, 0xFF });
            packet.Write(player.GetGameInfomations(2));
            Send(packet.GetBytes());

            packet.Dispose();
        }
Exemple #17
0
        public override void PlayerLoadSuccess(GPlayer client)
        {
            byte numberOfPlayerRdy = 0;

            client.GameInfo.Versus.LoadComplete   = true;
            client.GameInfo.GameData.HoleComplete = false;
            client.GameInfo.Versus.HoleDistance   = 99999999;
            foreach (var player in Players)
            {
                if (player.GameInfo.Versus.LoadComplete)
                {
                    numberOfPlayerRdy++;
                }
            }

            if (!(numberOfPlayerRdy == Players.Count))
            {
                return;
            }


            HoleComplete = false;
            SendWind();
            SendWeather();
            Send(ShowWhoPlay(Players.First().ConnectionID));//o primeiro há tacar

            //W_BIGBONGDARI
            Send(new byte[] { 0x15, 0x01, 0x0D, 0x00, 0x57, 0x5F, 0x42, 0x49, 0x47, 0x42, 0x4F, 0x4E, 0x47, 0x44, 0x41, 0x52, 0x49, 0x00, 0x02, 0x01, 0x03, 0x00, 0x03, 0x01, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x00, 0x03, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x03, 0x02, 0x03, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x03, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x03, 0x00, 0x02, 0x03, 0x01, 0x03, 0x03, 0x01, 0x03, 0x02, 0x03, 0x03, 0x02, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00 });

            //R_BIGBONGDARI
            Send(new byte[] { 0x15, 0x01, 0x0D, 0x00, 0x52, 0x5F, 0x42, 0x49, 0x47, 0x42, 0x4F, 0x4E, 0x47, 0x44, 0x41, 0x52, 0x49, 0x00, 0x02, 0x02, 0x01, 0x03, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x02, 0x02, 0x02, 0x01, 0x02, 0x03, 0x01, 0x01, 0x00, 0x03, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x00, 0x03, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x00, 0x03, 0x02, 0x02, 0x00, 0x01, 0x01, 0x02, 0x03, 0x01, 0x03, 0x03, 0x00, 0x03, 0x02, 0x03, 0x03, 0x00, 0x01, 0x00, 0x02, 0x01, 0x01, 0x03, 0x03, 0x02, 0x02, 0x03, 0x00, 0x03, 0x02, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01 });

            //CLUBSET_MIRACLE
            Send(new byte[] { 0x15, 0x01, 0x0F, 0x00, 0x43, 0x4C, 0x55, 0x42, 0x53, 0x45, 0x54, 0x5F, 0x4D, 0x49, 0x52, 0x41, 0x43, 0x4C, 0x45, 0x00, 0x03, 0x02, 0x02, 0x03, 0x00, 0x02, 0x03, 0x01, 0x02, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x02, 0x02, 0x02, 0x01, 0x02, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x01, 0x01, 0x03, 0x01, 0x02, 0x01, 0x00, 0x01, 0x02, 0x02, 0x03, 0x03, 0x02, 0x01, 0x01, 0x03, 0x02, 0x03, 0x01, 0x01, 0x01, 0x02, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 0x01, 0x01, 0x02, 0x00, 0x02, 0x00, 0x03, 0x03, 0x00, 0x02, 0x03, 0x03, 0x01, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x02, 0x01, 0x00, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, 0x03, 0x03, 0x00, 0x01, 0x00, 0x00 });
        }
Exemple #18
0
        public override void PlayerSyncShot(GPlayer client, Packet packet)
        {
            Send(ShowDropItem(client.ConnectionID));
            var Succeed = client.GameInfo.GameCompleted;

            if (Succeed)
            {
                client.SendResponse(new byte[] { 0x99, 0x01 });
            }
            // { Show Treasure Gauge }
            client.SendResponse(ShowTreasureGuage());
            //{ Show Name,Score,Pang when client finish their game }
            if (Succeed)
            {
                Send(ShowNameScore(client.GetNickname, client.GameInfo.GameData.Score, client.GameInfo.GameData.Pang));

                Send(ShowHoleData(client.ConnectionID, client.GameInfo.HolePos, (byte)client.GameInfo.GameData.TotalShot, (uint)client.GameInfo.GameData.Score, (uint)client.GameInfo.GameData.Pang, (uint)client.GameInfo.GameData.BonusPang));
            }
            else if (client.GameInfo.GameData.HoleComplete)
            {
                Send(ShowHoleData(client.ConnectionID, client.GameInfo.HolePos, (byte)client.GameInfo.GameData.TotalShot, (uint)client.GameInfo.GameData.Score, (uint)client.GameInfo.GameData.Pang, (uint)client.GameInfo.GameData.BonusPang));
            }
            //Send(ShowHoleData(client.ConnectionID, client.GameInfo.HolePos, (byte)client.GameInfo.GameData.TotalShot, (uint)client.GameInfo.GameData.Score, (uint)client.GameInfo.GameData.Pang, (uint)client.GameInfo.GameData.BonusPang));

            if (Succeed)
            {
                Send(ShowLeaveMatch(client.ConnectionID, 2));
            }

            if (_allFinished())
            {
                OnAllPlayerFinished();
            }
        }
Exemple #19
0
        public void PlayerDowngradeCharacter(GPlayer player, Packet packet)
        {
            TCharacterStatus Data;

            Data = (TCharacterStatus)packet.Read(new TCharacterStatus());

            if (Data.CharIndex == 0)
            {
                player.SendResponse(new byte[] { 0x70, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
                return;
            }


            var Char = player.Inventory.ItemCharacter.GetChar(Data.CharTypeID, CharType.bTypeID);

            if (Char == null)
            {
                player.SendResponse(new byte[] { 0x70, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
                return;
            }
            else
            {
                if (Char.DowngradeSlot((byte)Data.Slot))
                {
                    player.Inventory.ItemTransaction.AddCharStatus(0xC9, Char);

                    player.SendTransaction();

                    player.Response.Write(new byte[] { 0x70, 0x02, });
                    player.Response.Write(0);
                    player.Response.Write(Data.Slot);
                    player.SendResponse();
                }
            }
        }
        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();
            }
        }
        public void PlayerJoinGame(GPlayer player, Packet packet)
        {
            packet.ReadUInt16(out ushort GameID);
            packet.ReadPStr(out string Pass);

            GameBase GameHandle = this[GameID];

            if (GameHandle == null)
            {
                player.SendResponse(TGAME_CREATE_RESULT.CREATE_GAME_ROOM_DONT_EXISTS.ShowRoomError());
                return;
            }

            if (GameHandle.Password.Length > 0 && player.GetCapability < 4)
            {
                if (GameHandle.Password != Pass)
                {
                    player.SendResponse(TGAME_CREATE_RESULT.CREATE_GAME_INCORRECT_PASSWORD.ShowRoomError());
                    return;
                }
            }

            if (GameHandle.Count == 0 && GameHandle.GameType == GAME_TYPE.GM_EVENT)
            {
                GameHandle.AddPlayerInEvent(player);
            }
            else
            {
                GameHandle.AddPlayer(player);
            }
        }
Exemple #22
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();
                }
            }
        }
        public override void SendPlayerOnJoin(GPlayer player)
        {
            PangyaBinaryWriter packet;

            packet = new PangyaBinaryWriter();
            try
            {
                player.GameInfo.GameReady = true;
                foreach (GPlayer P in Players)
                {
                    packet.Clear();
                    packet.Write(new byte[] { 0x48, 0x00 });
                    packet.Write((byte)7);//List
                    packet.Write(new byte[] { 0xFF, 0xFF });
                    packet.Write(Count);
                    packet.Write(P.GetGameInfomations(2));
                    packet.Write((byte)0);
                    player.SendResponse(packet.GetBytes());
                }

                packet.Clear();
                packet.Write(new byte[] { 0x48, 0x00 });
                packet.Write((byte)1);
                packet.Write(new byte[] { 0xFF, 0xFF });
                packet.Write(player.GetGameInfomations(2));
                packet.Write((byte)0);
                Send(packet.GetBytes());
            }
            finally
            {
                packet.Dispose();
            }
        }
        public override void PlayerGameDisconnect(GPlayer player)
        {
            if (Count == 0)
            {
                player.SetGameID(0xFFFF);
                player.SendResponse(ShowLeaveGame());
                PlayerLeave(this, player);
                this.Destroy(this);
                player.Game = null;
            }
            else
            {
                player.SetGameID(0xFFFF);
                PlayerLeave(this, player);
                OnPlayerLeave();
                Send(ShowGameLeave(player.ConnectionID, 2));
                //{ Find New Master }
                if (player.GetUID == Owner && Players.Count >= 1)
                {
                    FindNewMaster();
                }

                //{ Room Update }
                Update(this);

                player.SendResponse(ShowLeaveGame());

                player.Game = null;
            }
        }
 public static void OpenRareShop(GPlayer player)
 {
     player.Response.Write(new byte[] { 0x0B, 0x01 }); //01 = ativado, 00 = desativo
     player.Response.Write(uint.MaxValue);
     player.Response.Write(uint.MaxValue);
     player.Response.Write(0);
     player.SendResponse();
 }
 public void UpdatePlayerLobbyInfo(GPlayer player)
 {
     if (player.InLobby)
     {
         Send(ShowPlayerAction(player, TLOBBY_ACTION.UPDATE));
         player.SendResponse(new byte[] { 0x0F, 0x00 });
     }
 }
 public void PlayerLeaveGameEvent(GameBase GameHandle, GPlayer player)
 {
     if (GameHandle == null || GameHandle.GameType == GAME_TYPE.HOLE_REPEAT)
     {
         return;
     }
     Send(ShowPlayerAction(player, TLOBBY_ACTION.UPDATE));
 }
 public void PlayerCallMessengerServer(GPlayer PL)
 {
     if (Program._server.Messenger_Active)
     {
         PL.SendResponse(new byte[] { 0xF1, 0x00, 0x00 });
         PL.SendResponse(new byte[] { 0x35, 0x01 });
     }
 }
 public void LeaveMultiplayerGamesList(GPlayer player)
 {
     if (player.InLobby)
     {
         player.InLobby = false; // Set Current User To Lobby
         // Send to All player
         Send(ShowPlayerAction(player, TLOBBY_ACTION.DESTROY));
     }
 }
 protected void PlayerOpenShop(GPlayer player, Packet packet)
 {
     Send(ShowOpenShop(player.GetNickname, player.GetUID));
     player.GameInfo.GameShop.ShopOwnerID = (uint)new Random().Next();
     GameShopData.Add(new ShopItemData()
     {
         UID = player.GetUID, Name = "", ShopOwnerID = player.GameInfo.GameShop.ShopOwnerID, NickName = player.GetNickname
     });
 }