Exemple #1
0
        public CmdCheatSendFBGift(string[] serialized)
        {
            this.m_inboxCmd = null;
            foreach (KeyValuePair <string, FbPlatformUser> pair in Service.Binder.FacebookAdapter.Friends)
            {
                UnityEngine.Debug.Log(string.Format("Friend id: {0} username: {1} imageUrl: {2}", pair.Key, pair.Value.userName, pair.Value.ImageUrl));
            }
            string targetPlayerFBid = !(serialized[0] != "D") ? GameLogic.Binder.GameState.Player.SocialData.FacebookId : serialized[0];
            string id = !(serialized[1] != "D") ? "PetBoxSmall" : serialized[1];

            if (ConfigShops.GetShopEntry(id) == null)
            {
                UnityEngine.Debug.LogError("Invalid shop entry id");
            }
            else
            {
                string facebookId = GameLogic.Binder.GameState.Player.SocialData.FacebookId;
                if (facebookId == null)
                {
                    UnityEngine.Debug.LogError("Cannot send facebook gift when not logged into Facebook");
                }
                else
                {
                    this.m_inboxCmd = SocialGift.CreateFacebookGiftCommand(facebookId, targetPlayerFBid, "PetBoxSmall");
                }
            }
        }
Exemple #2
0
        public HandleReceiveGift(Dictionary <string, object> parameters)
        {
            Reward reward = new Reward();

            reward.RewardSource   = RewardSourceType.FacebookFriend;
            reward.RewardSourceId = parameters["senderFBid"].ToString();
            this.m_reward         = reward;
            string id = parameters["shopEntryId"].ToString();

            if (ConfigShops.GetShopEntry(id) == null)
            {
                id = "PetBoxSmall";
            }
            this.m_reward.addShopEntryDrop(GameLogic.Binder.GameState.Player, id, false);
        }
Exemple #3
0
        public void addShopEntryDrop(Player player, string shopEntryId, [Optional, DefaultParameterValue(false)] bool applyMysteryChestDiminisher)
        {
            double            num;
            CharacterInstance activeCharacter = player.ActiveCharacter;
            ShopEntry         shopEntry       = ConfigShops.GetShopEntry(shopEntryId);

            this.ShopEntryDrops.Add(shopEntryId);
            if (string.IsNullOrEmpty(this.ShopEntryId))
            {
                this.ShopEntryId = shopEntryId;
            }
            switch (shopEntry.Type)
            {
            case ShopEntryType.CoinBundle:
            {
                if (!applyMysteryChestDiminisher)
                {
                    num = ConfigShops.CalculateCoinBundleSize(player, shopEntry.Id, 1);
                    break;
                }
                ConfigMeta configMeta  = App.Binder.ConfigMeta;
                double     numUpgrades = player.getMysteryCoinOfferMultiplier(shopEntryId);
                num = configMeta.CoinBundleSize(activeCharacter.HighestLevelItemOwnedAtFloorStart, player, shopEntryId, numUpgrades, 0.0);
                break;
            }

            case ShopEntryType.IapDiamonds:
            case ShopEntryType.IapStarterBundle:
            case ShopEntryType.SpecialChest:
            case ShopEntryType.RewardBox:
                return;

            case ShopEntryType.Boost:
                this.Boost = shopEntry.Boost;
                return;

            case ShopEntryType.MysteryItem:
            {
                ItemInstance item = ConfigShops.CreateNewMysteryItemInstance(player, shopEntry.Id);
                this.ItemDrops.Add(item);
                return;
            }

            case ShopEntryType.TokenBundle:
                MathUtil.DistributeValuesIntoChunksInt((int)ConfigShops.CalculateTokenBundleSize(player, shopEntry.Id), shopEntry.NumBursts, ref this.TokenDrops);
                return;

            case ShopEntryType.ReviveBundle:
                this.Revives = (int)ConfigShops.CalculateReviveBundleSize(shopEntry.Id);
                return;

            case ShopEntryType.FrenzyBundle:
                this.FrenzyPotions = (int)ConfigShops.CalculateFrenzyBundleSize(shopEntry.Id);
                return;

            case ShopEntryType.DustBundle:
                MathUtil.DistributeValuesIntoChunksInt((int)ConfigShops.CalculateDustBundleSize(activeCharacter, shopEntry.Id), shopEntry.NumBursts, ref this.DustDrops);
                return;

            case ShopEntryType.DiamondBundle:
                MathUtil.DistributeValuesIntoChunksInt((int)ConfigShops.CalculateDiamondBundleSize(player, shopEntry.Id), shopEntry.NumBursts, ref this.DiamondDrops);
                return;

            case ShopEntryType.XpBundle:
                this.XpPotions = (int)ConfigShops.CalculateXpBundleSize(shopEntry.Id);
                return;

            case ShopEntryType.BossBundle:
                this.BossPotions = (int)ConfigShops.CalculateBossBundleSize(shopEntry.Id);
                return;

            case ShopEntryType.PetBundle:
            {
                string    str     = CmdRollPetBundleLootTable.ExecuteStatic(App.Binder.ConfigLootTables.PetBundleLootTables[shopEntry.Id], player);
                int       num6    = ConfigShops.CalculatePetBundleSize(player, shopEntry.Id);
                PetReward reward3 = new PetReward();
                reward3.PetId  = str;
                reward3.Amount = num6;
                this.Pets.Add(reward3);
                return;
            }

            case ShopEntryType.PetBox:
            {
                this.ChestType = shopEntry.ChestType;
                Reward reward = new Reward();
                CmdRollChestLootTable.ExecuteStatic(shopEntry.ChestType, player, false, ref reward, null);
                this.Pets.AddRange(reward.Pets);
                return;
            }

            case ShopEntryType.MegaBoxBundle:
                this.MegaBoxes = (int)ConfigShops.CalculateMegaBoxBundleSize(shopEntry.Id);
                return;

            case ShopEntryType.LootBox:
            {
                Reward reward2 = new Reward();
                CmdRollChestLootTable.ExecuteStatic(shopEntry.ChestType, player, false, ref reward2, null);
                this.copyFrom(reward2);
                this.ChestType = shopEntry.ChestType;
                return;
            }

            default:
                return;
            }
            MathUtil.DistributeValuesIntoChunksDouble(num, shopEntry.NumBursts, ref this.CoinDrops);
        }
Exemple #4
0
 public void postDeserializeInitialization()
 {
     this.ShopEntry = ConfigShops.GetShopEntry(this.ShopEntryId);
 }