コード例 #1
0
        private static void HandlePurchaseMembership(GameSession session, PacketReader packet)
        {
            int vipId = packet.ReadInt();

            if (!PremiumClubPackageMetadataStorage.IsValid(vipId))
            {
                return;
            }

            PremiumClubPackageMetadata vipPackage = PremiumClubPackageMetadataStorage.GetMetadata(vipId);

            if (!session.Player.Wallet.RemoveMerets(vipPackage.Price))
            {
                return;
            }

            session.Send(PremiumClubPacket.PurchaseMembership(vipId));

            foreach (BonusItem item in vipPackage.BonusItem)
            {
                Item bonusItem = new(item.Id)
                {
                    Rarity = item.Rarity,
                    Amount = item.Amount
                };
                InventoryController.Add(session, bonusItem, true);
            }

            int vipTime = vipPackage.VipPeriod * 3600; // Convert to seconds, as vipPeriod is given as hours

            ActivatePremium(session, vipTime);
        }
コード例 #2
0
        private void HandlePurchaseMembership(GameSession session, PacketReader packet)
        {
            int packageId = packet.ReadInt();

            session.Send(PremiumClubPacket.PurchaseMembership(packageId));
            // TODO grab data from \table\vipgoodstable.xml for pricing, buff duration, and bonus items
            long expiration = 2592847227; // temporarilyy plugging in expiration time

            session.Send(PremiumClubPacket.ActivatePremium(session.FieldPlayer, expiration));
        }