コード例 #1
0
        static AddData AddItem(GPlayer PL, AddItem ItemData)
        {
            List <Dictionary <UInt32, UInt32> > ListSet;
            AddItem ItemAddData;
            AddData Result;

            // ## GROUP SET ITEM
            if (GetItemGroup(ItemData.ItemIffId) == 9)
            {
                ListSet = IffEntry.SetItem.SetList(ItemData.ItemIffId);

                if (ListSet.Count <= 0)
                {
                    // ## should not be happened
                    return(new AddData());
                }
                foreach (var _enum in ListSet)
                {
                    var data = _enum.First();

                    ItemAddData = new AddItem
                    {
                        ItemIffId   = data.Key,
                        Quantity    = data.Value,
                        Transaction = true,
                        Day         = 0
                    };
                    PL.AddItem(ItemAddData);
                }
                Result = new AddData
                {
                    Status      = true,
                    ItemIndex   = uint.MaxValue,
                    ItemTypeID  = ItemData.ItemIffId,
                    ItemOldQty  = 0,
                    ItemNewQty  = 1,
                    ItemUCCKey  = string.Empty,
                    ItemFlag    = 0,
                    ItemEndDate = DateTime.MinValue
                };
                return(Result);
            }
            else
            {
                return(PL.AddItem(ItemData));
            }
        }
コード例 #2
0
        void AddShopItem(GPlayer PL, ShopItemRequest shop)
        {
            var      ListSet = IffEntry.SetItem.SetList(shop.IffTypeId);
            AddData  ItemAddedData;
            AddItem  ItemAddData;
            TBuyItem DataBuy;

            //group set item
            if (GetItemGroup(shop.IffTypeId) == 9)
            {
                if (ListSet.Count <= 0)// ## should not be happened
                {
                    PL.SendResponse(ShowBuyItemSucceed(TGAME_SHOP.BUY_FAIL));
                    WriteConsole.WriteLine("Something strange happened (T.T)");
                    return;
                }
                else
                {
                    foreach (var datas in ListSet)
                    {
                        ItemAddData = new AddItem
                        {
                            ItemIffId   = datas.FirstOrDefault().Key,
                            Quantity    = datas.FirstOrDefault().Value,
                            Transaction = false,
                            Day         = 0
                        };
                        ItemAddedData = PL.AddItem(ItemAddData);
                        DataBuy       = CheckData(ItemAddedData);
                        PL.SendResponse(ShowBuyItem(ItemAddedData, DataBuy, PL.GetPang, PL.GetCookie));
                    }
                }
            }
            else
            {
                ItemAddData = new AddItem
                {
                    ItemIffId   = shop.IffTypeId,
                    Quantity    = IffEntry.GetRealQuantity(shop.IffTypeId, shop.IffQty),
                    Transaction = false,
                    Day         = shop.IffDay
                };
                ItemAddedData = PL.AddItem(ItemAddData);
                DataBuy       = CheckData(ItemAddedData);
                PL.SendResponse(ShowBuyItem(ItemAddedData, DataBuy, PL.GetPang, PL.GetCookie));
            }
        }
コード例 #3
0
        public void PlayerOpenAzectBox(GPlayer PL, Packet packet)
        {
            AddData ItemAddedData;
            AddItem ItemAddData;


            if (!packet.ReadUInt32(out uint BoxTypeID))
            {
            }

            if (!packet.ReadUInt32(out uint BallTypeID))
            {
            }

            if (!(BoxTypeID == 436207877))
            {
                return;
            }

            // CHECK IF USE HAVE ITEM
            if (PL.Inventory.IsExist(BoxTypeID) && PL.Inventory.IsExist(BallTypeID))
            {
                PL.Inventory.Remove(BoxTypeID, 1, false);

                ItemAddData = new AddItem()
                {
                    ItemIffId   = BallTypeID,
                    Quantity    = (uint)new Random().Next(15, 25),
                    Transaction = false,
                    Day         = 0,
                };

                ItemAddedData = PL.AddItem(ItemAddData);

                try
                {
                    packet.Write(new byte[] { 0x97, 0x01, 0x01 });
                    packet.WriteUInt32(BoxTypeID);
                    packet.WriteUInt32(BallTypeID);
                    packet.WriteUInt32(ItemAddedData.ItemNewQty);
                    PL.SendResponse(packet.GetBytes());
                }
                finally
                {
                    packet.Dispose();
                }
            }
            else
            {
                PL.SendResponse(new byte[] { 0x97, 0x01, });
            }
        }
コード例 #4
0
        protected void GetNormalItem(GPlayer player, uint TypeID)
        {
            try
            {
                var NormalItem = Items.GetNormalItem(TypeID);
                // ## add to item list
                foreach (var PNormal in NormalItem)
                {
                    var NormalAddItem = new AddItem
                    {
                        ItemIffId   = PNormal.TypeID,
                        Quantity    = PNormal.Quantity,
                        Transaction = true,
                        Day         = 0
                    };
                    // ## add to warehouse
                    player.AddItem(NormalAddItem);
                }
                // ## send transaction
                player.SendTransaction();

                // 0 = ITEM COMUM
                // 1 = ITEM NORMAL ASA FECHADA
                // 2 = ITEM NORMAL ASA ABERTA
                // 3 = ITEM RARO ASA FECHADA
                // 4 = ITEM RARO ASA ABERTA

                player.Response.Write(new byte[] { 0x64, 0x02 });
                player.Response.Write(0);
                player.Response.Write(NormalItem.Count);
                foreach (var PNormal in NormalItem)
                {
                    player.Response.WriteUInt32(PNormal.RareType); // ALTERAR AQUI  TIPO DE ITEM
                    player.Response.WriteUInt32(PNormal.TypeID);
                    player.Response.WriteUInt32(PNormal.Quantity);
                }
                player.SendResponse();
            }
            catch
            {
                player.Close();
            }
        }
コード例 #5
0
        public void PlayerControlAssist(GPlayer PL)
        {
            uint    AssistItem;
            AddItem Item;

            AssistItem = 467664918;

            switch (PL.Inventory.GetQuantity(AssistItem))
            {
            case 1:     // TO CLOSE {plus item 1]
            {
                Item = new AddItem()
                {
                    ItemIffId   = AssistItem,
                    Quantity    = 1,
                    Transaction = true,
                    Day         = 0
                };
                PL.AddItem(Item);
                PL.Assist = 0x00;
            }
            break;

            case 2:     // TO OPEN {minus item 1}
            {
                PL.Inventory.Remove(AssistItem, 1, true);
                PL.Assist = 0x01;
            }
            break;

            default:
            {
                return;
            }
            }

            PL.SendTransaction();

            PL.SendResponse(new byte[] { 0x6A, 0x02, 0x00, 0x00, 0x00, 0x00 });
        }
コード例 #6
0
        protected void GetRareItem(GPlayer player, uint TypeID)
        {
            AddItem AddItem;
            //For normal item
            //Form Rare item
            ItemRandomClass RareItem;
            ItemRandom      PRare;
            List <Dictionary <uint, uint> > ListSet;

            try
            {
                RareItem = Items.GetRareItem(IffEntry.MemorialCoin.GetPool(TypeID));
                while (true)
                {
                    PRare = null;
                    if (RareItem.GetLeft() <= 0)
                    {
                        break;
                    }

                    PRare = RareItem.GetItems();

                    if (!player.Inventory.IsExist(PRare.TypeId))
                    {
                        break;
                    }
                }

                if (PRare == null)
                {
                    player.SendResponse(new byte[] { 0x64, 0x02, 0xAD, 0x0F9, 0x56, 0x00 });
                    WriteConsole.WriteLine("PlayerPlayerMemorialGacha: object is Null", ConsoleColor.Red);
                }

                if (GetItemGroup(PRare.TypeId) == 9)
                {
                    ListSet = IffEntry.SetItem.SetList(PRare.TypeId);

                    if (ListSet.Count <= 0)
                    {
                        player.SendResponse(new byte[] { 0x64, 0x02, 0xAD, 0x0F9, 0x56, 0x00 });
                        WriteConsole.WriteLine("PlayerPlayerMemorialGacha: Failed", ConsoleColor.Red);
                        // ## should not be happened
                        return;
                    }
                    foreach (var data in ListSet)
                    {
                        AddItem = new AddItem()
                        {
                            ItemIffId   = data.Keys.FirstOrDefault(),
                            Quantity    = data.Values.FirstOrDefault(),
                            Transaction = true,
                            Day         = 0// ## set should not be limited time in their set
                        };
                        player.AddItem(AddItem);
                    }
                }
                else
                {
                    AddItem = new AddItem
                    {
                        ItemIffId   = PRare.TypeId,
                        Quantity    = PRare.MaxQuantity,
                        Transaction = true,
                        Day         = 0,
                    };
                    player.AddItem(AddItem);
                }

                // ## send transaction
                player.SendTransaction();

                // 0 = ITEM COMUM
                // 1 = ITEM NORMAL ASA FECHADA
                // 2 = ITEM NORMAL ASA ABERTA
                // 3 = ITEM RARO ASA FECHADA
                // 4 = ITEM RARO ASA ABERTA
                player.Response.Write(new byte[] { 0x64, 0x02 });
                player.Response.Write(0);
                player.Response.Write(1);
                player.Response.Write(PRare.RareType);
                player.Response.WriteUInt32(PRare.TypeId);
                player.Response.WriteUInt32(PRare.MaxQuantity);
                player.SendResponse();
            }
            catch
            {
                player.Close();
            }
        }
コード例 #7
0
        public void PlayerLoloCardDeck(GPlayer PL, Packet packet)
        {
            TCardDataChange CardData;
            PlayerCardData  PlayerCard;
            PlayerCardData  PlayerCard2;
            PlayerCardData  PlayerCard3;


            CardData = (TCardDataChange)packet.Read(new TCardDataChange());


            //// ## get card
            PlayerCard  = PL.Inventory.ItemCard.GetCard(CardData.CardTypeID, 1);
            PlayerCard2 = PL.Inventory.ItemCard.GetCard(CardData.CardTypeID2, 1);
            PlayerCard3 = PL.Inventory.ItemCard.GetCard(CardData.CardTypeID3, 1);

            try
            {
                //Check is Card Exist
                if (PlayerCard == null || PlayerCard2 == null || PlayerCard3 == null)
                {
                    PL.SendResponse(new byte[] { 0x2A, 0x02, 0x01, 0x00, 0x00, 0x00, });
                    WriteConsole.WriteLine("HandlePlayerLoloDeck: is null", ConsoleColor.Red);
                    return;
                }
                // ## delete PL card
                if (!PL.Inventory.Remove(PlayerCard.CardTypeID, 1, true).Status || !PL.Inventory.Remove(PlayerCard2.CardTypeID, 1, true).Status || !PL.Inventory.Remove(PlayerCard3.CardTypeID, 1, true).Status)
                {
                    PL.SendResponse(new byte[] { 0x2A, 0x02, 0x01, 0x00, 0x00, 0x00, });
                    WriteConsole.WriteLine("HandlePlayerLoloDeck: Card No Found", ConsoleColor.Red);
                    return;
                }
                if (!PL.RemovePang((uint)CardData.PangSum))
                {
                    PL.SendResponse(new byte[] { 0x2A, 0x02, 0x01, 0x00, 0x00, 0x00, });
                    WriteConsole.WriteLine("HandlePlayerLoloDeck: Pangs null", ConsoleColor.Red);
                    return;
                }

                // ## get random card
                var Card = Items.GetCard(PlayerCard.CardTypeID, PlayerCard2.CardTypeID, PlayerCard3.CardTypeID);
                if (Card.TypeID > 0)
                {
                    var result = new byte[] { 0x2E, 0x02, 0x00, 0x00, 0x00, 0x00 };
                    PL.SendResponse(result);

                    result = new byte[] { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                    PL.SendResponse(result);

                    result = new byte[] { 0x29, 0x02, 0x02, 0x00, 0x00, 0x00 };
                    PL.SendResponse(result);

                    PL.SendPang();

                    PL.AddItem(new AddItem()
                    {
                        ItemIffId   = Card.TypeID,
                        Quantity    = 1,
                        Day         = 0,
                        Transaction = true
                    });
                    PL.SendTransaction();

                    PL.Response.Write(new byte[] { 0x2A, 0x02 });
                    PL.Response.Write(0);
                    PL.Response.Write(Card.TypeID);
                    PL.SendResponse();
                }
                else
                {
                    PL.SendResponse(new byte[] { 0x2A, 0x02, 0x00, 0x00, 0x00, 0x00 });
                    WriteConsole.WriteLine("HandlePlayerLoloDeck: Fatal Error", ConsoleColor.Red);
                    return;
                }
            }
            catch
            {
                PL.Close();
            }
        }
コード例 #8
0
        public void PlayerOpenCardPack(GPlayer PL, Packet packet)
        {
            TPData         CardData;
            PlayerCardData PlayerCard;
            List <Dictionary <UInt32, byte> > CardList;

            bool CheckCard(uint ID)
            {
                switch (ID)
                {
                case 0x7CC00000:
                case 0x7CC00001:
                case 0x7CC00002:
                case 0x7CC00003:
                case 0x7CC00004:
                case 0x7CC00005:
                case 0x7CC00007:
                case 0x7CC00008:
                case 0x7CC0000A:
                {
                    return(true);
                }

                default:
                { return(false); }
                }
            }

            CardData = (TPData)packet.Read(new TPData());

            // ## get card
            PlayerCard = PL.Inventory.ItemCard.GetCard(CardData.CardIndex);
            // ## if card can't be open
            if (PlayerCard == null)
            {
                PL.SendResponse(new byte[] { 0x54, 0x01, 0x01, 0x00, 0x00, 0x00, });
                WriteConsole.WriteLine("PlayerOpenCardPack: is null");
                return;
            }

            if (!CheckCard(PlayerCard.CardTypeID))
            {
                PL.SendResponse(new byte[] { 0x54, 0x01, 0x01, 0x00, 0x00, 0x00, });
                WriteConsole.WriteLine("PlayerOpenCardPack: CardType No Found");
                return;
            }
            // ## delete PL card
            if (!PL.Inventory.Remove(CardData.TypeID, 1, false).Status)
            {
                PL.SendResponse(new byte[] { 0x54, 0x01, 0x01, 0x00, 0x00, 0x00, });
                WriteConsole.WriteLine("PlayerOpenCardPack: card No Found");
                return;
            }
            // ## get random card
            CardList = Items.GetCard(PlayerCard.CardTypeID);
            try
            {
                packet.Write(new byte[] { 0x54, 0x01 });
                packet.WriteUInt32(0); // ## 0 = success
                packet.WriteUInt32(PlayerCard.CardIndex);
                packet.WriteUInt32(PlayerCard.CardTypeID);
                packet.WriteZero(0xC);
                packet.WriteUInt32(1);
                packet.WriteZero(0x20);
                packet.WriteUInt16(1);
                packet.WriteByte((byte)CardList.Count);
                foreach (var data in CardList)
                {
                    var AddData = new AddItem
                    {
                        ItemIffId   = data.FirstOrDefault().Key,
                        Transaction = false,
                        Quantity    = 1,
                        Day         = 0
                    };
                    // ## add item
                    var ResultAdd = PL.AddItem(AddData);

                    packet.WriteUInt32(ResultAdd.ItemIndex);
                    packet.WriteUInt32(ResultAdd.ItemTypeID);
                    packet.WriteZero(0xC);
                    packet.WriteUInt32(ResultAdd.ItemNewQty);
                    packet.WriteZero(0x20);
                    packet.WriteUInt16(1);
                    packet.WriteUInt32(1);
                }
                PL.SendResponse(packet.GetBytes());
            }
            finally
            {
                packet.Dispose();
                CardList.Clear();
            }
        }
コード例 #9
0
        public void PlayerOpenBox(GPlayer player, Packet packet)
        {
            TRewardInfo   Reward;
            TBoxInfo      BoxInfo;
            AddData       RemoveItemData;
            AddData       AddItemData;
            AddItem       Item;
            string        Param = "";
            List <object> Lists;
            object        APoint;
            MailSender    MailSender;

            Lists = new List <object>();
            try
            {
                if (!packet.ReadUInt32(out uint BoxIffTypeID))
                {
                    return;
                }

                AddItemData = new AddData();

                BoxInfo = BoxItem.GetBoxInfo(BoxIffTypeID);
                // # Box doens't exist
                if ((BoxInfo == null))
                {
                    player.Write(OPEN_BOX_NULL);
                    WriteConsole.WriteLine($"HandlePlayerOpenBox: Cannot find system\'s box to open { BoxIffTypeID }", ConsoleColor.Red);
                    return;
                }
                // # Player does not have this box
                if (!player.Inventory.IsExist(BoxInfo.BoxTypeID))
                {
                    player.Write(OPEN_BOX_NULL);
                    WriteConsole.WriteLine($"HandlePlayerOpenBox: Player hasn\'t had this box { BoxIffTypeID }", ConsoleColor.Red);
                    return;
                }
                // # Special item to delete # use for openned cube
                if ((BoxInfo.SupplyTypeID > 0))
                {
                    if (!player.Inventory.IsExist(BoxInfo.SupplyTypeID))
                    {
                        player.Write(OPEN_BOX_NULL);
                        WriteConsole.WriteLine($"HandlePlayerOpenBox: Can\'t find player\'s supply { BoxInfo.SupplyTypeID }", ConsoleColor.Red);
                        return;
                    }
                }
                // # delete box
                RemoveItemData = player.Inventory.Remove(BoxInfo.BoxTypeID, BoxInfo.BoxQuantity, false);
                // # add to list
                APoint = new TItemData();
                ((TItemData)APoint).TypeID       = RemoveItemData.ItemTypeID;
                ((TItemData)APoint).ItemIndex    = RemoveItemData.ItemIndex;
                ((TItemData)APoint).ItemQuantity = RemoveItemData.ItemNewQty;
                Lists.Add((TItemData)APoint);
                // # end
                // # if supply typeid is specified
                if (BoxInfo.SupplyTypeID > 0)
                {
                    // # delete supplyment # use for key's spin cube
                    RemoveItemData = player.Inventory.Remove(BoxInfo.SupplyTypeID, BoxInfo.SupplyQuantity, false);
                    // # add to list
                    APoint = new TItemData();
                    ((TItemData)APoint).TypeID       = RemoveItemData.ItemTypeID;
                    ((TItemData)APoint).ItemIndex    = RemoveItemData.ItemIndex;
                    ((TItemData)APoint).ItemQuantity = RemoveItemData.ItemNewQty;
                    Lists.Add((TItemData)APoint);
                    // # end
                }
                // # if special reward is specified
                if ((BoxInfo.SpecialRewardTypeID > 0))
                {
                    Item = new AddItem()
                    {
                        ItemIffId   = BoxInfo.SpecialRewardTypeID,
                        Quantity    = BoxInfo.SpecialRewardQuantity,
                        Transaction = false,
                        Day         = 0
                    };
                    AddItemData = player.AddItem(Item);
                    if ((AddItemData.ItemNewQty > 1))
                    {
                        // # add to list
                        APoint = new TItemData();

                        ((TItemData)APoint).TypeID       = AddItemData.ItemTypeID;
                        ((TItemData)APoint).ItemIndex    = AddItemData.ItemIndex;
                        ((TItemData)APoint).ItemQuantity = AddItemData.ItemNewQty;
                        Lists.Add((TItemData)APoint);
                        // # end
                    }
                }
                // # send data to player
                player.Write(ShowBoxItem(Lists));
                // # clear
                Lists.Clear();
                // # send #$AA
                if ((AddItemData.ItemNewQty == 1))
                {
                    APoint = new TItemData();
                    ((TItemData)(APoint)).TypeID       = AddItemData.ItemTypeID;
                    ((TItemData)(APoint)).ItemIndex    = AddItemData.ItemIndex;
                    ((TItemData)(APoint)).ItemQuantity = AddItemData.ItemNewQty;
                    Lists.Add((TItemData)APoint);
                }
                // send result
                player.Write(ShowBoxNewItem(Lists, player.GetPang, player.GetCookie));
                while (true)
                {
                    Reward = BoxItem.GetItemBox(BoxIffTypeID);
                    if (!Reward.Duplicated)
                    {
                        // if this item can have only one ea
                        if (!player.Inventory.IsExist(Reward.TypeId))
                        {
                            break;
                        }
                    }
                    else if (Reward.Duplicated)
                    {
                        break;
                    }
                }
                if (Reward.TypeId <= 0)
                {
                    player.Write(BOX_REWARD_NIL);
                    WriteConsole.WriteLine($"HandlePlayerOpenBox: Reward is nil with box typeid: { BoxIffTypeID }");
                    return;
                }
                if (Reward.Announce)
                {
                    // generate param
                    Param = string.Format(" You got items from !! BoxAnnounce = <PARAMS> <BOX_TYPEID> {0} </ BOX_TYPEID> <NICKNAME> {1} </ NICKNAME> <TYPEID> {2}</ TYPEID> <QTY> {3} </ QTY>", new object[] { BoxIffTypeID, player.GetNickname, Reward.TypeId, Reward.Quantity });

                    var Auth = MainServer.Program._server.AuthServer;

                    if (Auth != null)
                    {
                        Auth.Send(new AuthPacket()
                        {
                            ID = AuthPacketEnum.SERVER_RELEASE_BOXRANDOM, Message = new { GetMessage = Param }
                        });
                    }
                    else
                    {
                        player.Server.Notice(Param);
                    }
                }
                try
                {
                    MailSender = new MailSender
                    {
                        Sender = "@BoxSystem"
                    };
                    MailSender.AddText(BoxInfo.BoxParam);
                    MailSender.AddItem(Reward.TypeId, Reward.Quantity);
                    MailSender.Send(player.GetUID);
                    player.SendMailPopup();
                }
                finally
                {
                    MailSender = null;
                }
                player.Write(ShowBoxItem(BoxIffTypeID, Reward.TypeId, Reward.Quantity));
            }
            catch
            {
                player.Close();
            }
            finally
            {
                Lists.Clear();
            }
        }
コード例 #10
0
        public static void PlayerPlayScratchCard(GPlayer player)
        {
            uint               Count, I, IQuantity = 0;
            AddData            ItemData;
            ItemRandom         Reward;
            AddItem            AddItemData;
            PangyaBinaryWriter Packet;
            Random             rnd;

            try
            {
                Packet   = new PangyaBinaryWriter();
                ItemData = new AddData();
                rnd      = new Random();
                foreach (var Supply in RandomWeight.FSupplies)
                {
                    ItemData = player.Inventory.Remove(Supply.TypeId, Supply.DelQuantity);
                    if (ItemData.Status)
                    {
                        break;
                    }
                }
                if (!ItemData.Status)// ## item can't be deleted
                {
                    player.SendResponse(new byte[] { 0xDD, 0x00, 0xE4, 0xC6, 0x2D, 0x00, });
                    return;
                }

                if (new Random(0x64).Next() < 10)
                {
                    Count = 2;
                }
                else
                {
                    Count = 1;
                }

                Packet.WriteUInt32(Count);
                for (I = 1; I <= Count; I++)
                {
                    Reward = RandomWeight.GetItems();
                    if (rnd.Next(0x64) < 10)
                    {
                        IQuantity = Reward.MaxQuantity;
                    }
                    else
                    {
                        IQuantity = 1;
                    }
                    AddItemData = new AddItem
                    {
                        ItemIffId   = Reward.TypeId,
                        Quantity    = IQuantity,
                        Transaction = true,
                        Day         = 0
                    };
                    ItemData = player.AddItem(AddItemData);

                    if (ItemData.ItemTypeID == 0)
                    {
                        player.SendResponse(new byte[] { 0xDD, 0x00, 0x05, 0x00, 0x00, 0x00, });
                        return;
                    }
                    Packet.Write(0);
                    Packet.WriteUInt32(ItemData.ItemTypeID);
                    Packet.WriteUInt32(ItemData.ItemIndex);
                    Packet.WriteUInt32(IQuantity);
                    Packet.Write(1);//rare item?
                }

                player.SendTransaction();

                player.SendResponse(new byte[] { 0xDD, 0x00, 0x00, 0x00, 0x00, 0x00 }, Packet.GetBytes());

                RandomWeight.Restore();
            }
            catch
            {
                player.Close();
            }
        }
コード例 #11
0
        public static void PlayNormalPapel(GPlayer player)
        {
            var                rnd = new Random();
            byte               Count, IQuantity;
            uint               Stuff;
            AddData            ItemData;
            PangyaBinaryWriter packet;


            packet = new PangyaBinaryWriter();
            try
            {
                ItemData = new AddData();
                Stuff    = 0;
                foreach (var Supply in RandomWeight.FSupplies)
                {
                    ItemData = player.Inventory.Remove(Supply.TypeId, Supply.DelQuantity);
                    if (ItemData.Status)
                    {
                        Stuff = ItemData.ItemIndex;
                        break;
                    }
                }

                if (!ItemData.Status)
                {
                    if (!player.RemovePang(900))
                    {
                        player.SendResponse(new byte[] { 0x1B, 0x02, 0x7A, 0x73, 0x28, 0x00 });
                        return;
                    }
                    Stuff = 0;
                }

                if (rnd.Next(0, 21) + 1 >= 20)
                {
                    // 3 4 5
                    Count = (byte)rnd.Next(3, 6);
                }
                else
                {
                    Count = (byte)rnd.Next(2, 4);
                }
                // 2 3
                packet.WriteUInt32(Stuff);
                packet.WriteUInt32(Count);
                for (var I = 1; I <= Count; I++)
                {
                    var Reward = RandomWeight.GetItems();

                    if (Reward == null)
                    {
                        player.SendResponse(new byte[] { 0x6C, 0x02, 0x7A, 0x73, 0x28, 0x00 });
                        WriteConsole.WriteLine($" Error");
                        break;
                    }

                    if (new Random(0x64).Next() <= 20)
                    {
                        var QNT = rnd.Next((int)Reward.MaxQuantity) + 1;
                        IQuantity = (byte)QNT;
                    }
                    else
                    {
                        IQuantity = 1;
                    }
                    var Item = new AddItem
                    {
                        ItemIffId   = Reward.TypeId,
                        Quantity    = IQuantity,
                        Transaction = true,
                        Day         = 0
                    };
                    ItemData = player.AddItem(Item);

                    packet.WriteInt32(rnd.Next(3));
                    packet.WriteUInt32(ItemData.ItemTypeID);
                    packet.WriteUInt32(ItemData.ItemIndex);
                    packet.WriteUInt32(IQuantity);
                    packet.WriteUInt32(Reward.RareType);
                }
                packet.WriteUInt64(player.GetPang);
                packet.WriteUInt64(player.GetCookie);

                player.SendTransaction();

                player.SendResponse(new byte[] { 0x1B, 0x02, 0x00, 0x00, 0x00, 0x00 }, packet.GetBytes());

                RandomWeight.Restore();

                //{ **Achievement * * }
                //{ **Add Papel Counter ** }
                //player.AddAchivementQuest(1816133706, 1);
                //player.SendAchievement();
            }
            finally
            {
                packet.Dispose();
            }
        }
コード例 #12
0
        public static void PlayBigPapel(GPlayer player)
        {
            var                rnd = new Random();
            byte               Count, IQuantity;
            AddData            ItemData;
            PangyaBinaryWriter packet;


            packet = new PangyaBinaryWriter();
            try
            {
                ItemData = new AddData();
                if (!player.RemovePang(10000))
                {
                    player.SendResponse(new byte[] { 0x6C, 0x02, 0x7A, 0x73, 0x28, 0x00 });
                    WriteConsole.WriteLine($" {player.GetLogin} esta sem pangs");
                    return;
                }

                player.SendPang();


                Count = (byte)rnd.Next(4, 10);

                packet.WriteUInt32(Count);

                for (var I = 1; I <= Count; I++)
                {
                    var Reward = RandomWeight.GetItems();
                    if (rnd.Next(0x64) <= 20)
                    {
                        // 3 4 5
                        IQuantity = (byte)rnd.Next(3, 6);
                    }
                    else
                    { // 5 6 7 8 9
                        IQuantity = (byte)rnd.Next(5, 10);
                    }

                    if ((Reward.RareType == 1) || (Reward.RareType == 2))
                    {
                        IQuantity = 1;
                    }
                    var Item = new AddItem
                    {
                        ItemIffId   = Reward.TypeId,
                        Quantity    = IQuantity,
                        Transaction = true,
                        Day         = 0
                    };

                    ItemData = player.AddItem(Item);
                    packet.WriteInt32(rnd.Next(3));
                    packet.WriteUInt32(ItemData.ItemTypeID);
                    packet.WriteUInt32(ItemData.ItemIndex);
                    packet.WriteUInt32(IQuantity);
                    packet.WriteUInt32(Reward.RareType);
                }
                packet.WriteUInt64(player.GetPang);
                packet.WriteUInt64(player.GetCookie);

                player.SendTransaction();

                player.SendResponse(new byte[] { 0x6C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, packet.GetBytes());

                RandomWeight.Restore();
            }
            finally
            {
                packet.Dispose();
            }
        }
コード例 #13
0
        public void PlayerReleaseItem(GPlayer PL, Packet packet)
        {
            UInt32        FTypeID;
            UInt32        FQuantity;
            UInt32        ItemMailIndex;
            AddData       ItemAddedData;
            AddItem       ItemData;
            StringBuilder SQLString;

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

            var _db = new PangyaEntities();

            var Query = _db.ProcMailItem((int)PL.GetUID, (int)MailIndex).ToList();

            if (!(Query.Count >= 1))
            {
                PL.SendResponse(new byte[] { 0x14, 0x02, 0x98, 0x26, 0x2D, 0x00 });
                return;
            }

            SQLString = new StringBuilder();
            for (int i = 0; i < Query.Count; i++)
            {
                FTypeID   = (uint)Query[i].TYPEID;
                FQuantity = (uint)Query[i].QTY;
                // EXP POCKET
                if (FTypeID == 436207965)
                {
                }
                // PANG POCKET
                if (FTypeID == 436207632)
                {
                    if ((PL.GetPang + FQuantity) > uint.MaxValue)
                    {
                        PL.SendResponse(new byte[] { 0x14, 0x02, 0x98, 0x26, 0x2D, 0x00 });
                        break;
                    }
                }
                // OTHERS ITEM
                if (!PL.Inventory.Available(FTypeID, FQuantity))
                {
                    PL.SendResponse(new byte[] { 0x14, 0x02, 0x98, 0x26, 0x2D, 0x00 });//item invalido
                    break;
                }
            }

            for (int i = 0; i < Query.Count; i++)
            {
                FTypeID       = (uint)Query[i].TYPEID;
                FQuantity     = (uint)Query[i].QTY;
                ItemMailIndex = (uint)Query[i].Mail_Index;
                // EXP POCKET
                if (FTypeID == 436207965)
                {
                    PL.AddExp(FQuantity);
                    SQLString.Append('^');
                    SQLString.Append(ItemMailIndex);
                    SQLString.Append('^');
                    SQLString.Append(436207965);
                    SQLString.Append('^');
                    SQLString.Append(0);
                    SQLString.Append(',');
                }
                else if (FTypeID == 436207632)
                {
                    PL.AddPang(FQuantity);
                    PL.SendPang();
                    SQLString.Append('^');
                    SQLString.Append(ItemMailIndex);
                    SQLString.Append('^');
                    SQLString.Append(436207632);
                    SQLString.Append('^');
                    SQLString.Append(0);
                    SQLString.Append(',');
                }
                else
                {
                    // OTHER ITEM
                    ItemData = new AddItem
                    {
                        ItemIffId   = FTypeID,
                        Quantity    = FQuantity,
                        Transaction = true,
                        Day         = 0
                    };
                    ItemAddedData = PL.AddItem(ItemData);

                    SQLString.Append('^');
                    SQLString.Append(ItemMailIndex);
                    SQLString.Append('^');
                    SQLString.Append(FTypeID);
                    SQLString.Append('^');
                    SQLString.Append(ItemAddedData.ItemIndex);
                    SQLString.Append(',');
                }
                PL.SendTransaction();
                var Table = $"Exec dbo.USP_MAIL_UPDATE @UID = '{(int)PL.GetUID}', @ITEMSTR = '{SQLString.ToString()}'";
                _db.Database.SqlQuery <PangyaEntities>(Table).FirstOrDefault();
            }
            // update mail items
            PL.SendResponse(new byte[] { 0x14, 0x02, 0x00, 0x00, 0x00, 0x00 });
        }