Beispiel #1
0
 public void GetExtraBonus()
 {
     nextRewardNum     = GetExtraBonusRandom(out RewardType newRewardType);
     nextRewardType    = newRewardType;
     nextRewardMutiple = 1;
     panelManager.ShowPanel(PanelType.Reward);
 }
Beispiel #2
0
 public void set(BattleReward.RewardType rewardType, int amount, string rewardName = "")
 {
     this.rewardType = rewardType;
     this.amount     = amount;
     this.rewardName = rewardName;
     amountText.text = amount.ToString();
 }
        private void InitTypeSpecifics(RewardType value)
        {
            switch (reward.Type)
            {
            case RewardType.Gold:
                GuildSelectionVisible = true;
                CardSelectionVisible  = false;
                break;

            case RewardType.SoulGem:
                GuildSelectionVisible = false;
                CardSelectionVisible  = false;
                break;

            case RewardType.Pack:
                this.reward.Quantity  = 1;
                GuildSelectionVisible = false;
                CardSelectionVisible  = false;
                break;

            case RewardType.Card:
                this.reward.Quantity  = 1;
                Reward.CardInstance   = new CardInstance(this.trackerFactory);
                GuildSelectionVisible = false;
                CardSelectionVisible  = true;
                break;

            default:
                break;
            }
            RaisePropertyChangedEvent("Reward");
        }
Beispiel #4
0
        private void InitRewardsGrid()
        {
            this.rewardsGrid = base.GetElement <UXGrid>("GridRewards");
            this.rewardsGrid.SetTemplateItem("RewardItem");
            RewardVO rewardVO = Service.StaticDataController.Get <RewardVO>(this.meta.Reward);
            List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO);

            for (int i = 0; i < rewardComponents.Count; i++)
            {
                RewardComponentTag rewardComponentTag = rewardComponents[i];
                string             itemUid            = rewardVO.Uid + i;
                UXElement          uXElement          = this.rewardsGrid.CloneTemplateItem(itemUid);
                uXElement.Tag = rewardComponentTag;
                UXLabel subElement = this.rewardsGrid.GetSubElement <UXLabel>(itemUid, "LabelRewardCount");
                subElement.Text = rewardComponentTag.Quantity;
                RewardType type = rewardComponentTag.Type;
                UXSprite   subElement2;
                if (type != RewardType.Building && type != RewardType.Currency)
                {
                    subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteTroop");
                }
                else
                {
                    subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteReward");
                }
                RewardUtils.SetRewardIcon(subElement2, rewardComponentTag.RewardGeometryConfig, AnimationPreference.NoAnimation);
                this.rewardsGrid.AddItem(uXElement, rewardComponentTag.Order);
                this.rewardsGrid.RepositionItems();
                this.rewardsGrid.Scroll(0.5f);
            }
            this.rewardsGrid.RepositionItems();
            this.rewardsGrid.Scroll(0.5f);
        }
Beispiel #5
0
 public Level(int c, RewardType rt, int nextLevelCount, int val)
 {
     Id             = c;
     NextLevelCount = nextLevelCount;
     RewardType     = rt;
     RewardValue    = val;
 }
Beispiel #6
0
 public Reward(RewardType type, Item item, int amount)
 {
     Rewards.Add((short)0);
     Rewards.Add(type);
     Rewards.Add(item);
     Rewards.Add(amount);
 }
Beispiel #7
0
        public bool Deserialize(Stream stream)
        {
            BinaryReader input = new BinaryReader(stream);

            // type
            {
                int value = 0;
                if (Yippee.Net.Internal.Deserialize(input, out value) == false)
                {
                    return(false);
                }
                type_ = (RewardType)value;
            }
            // specificId
            if (Yippee.Net.Internal.Deserialize(input, out specificId_) == false)
            {
                return(false);
            }
            // quantity
            if (Yippee.Net.Internal.Deserialize(input, out quantity_) == false)
            {
                return(false);
            }

            return(true);
        }
 public void AddReward(RewardType type, Sprite overrideImage, int value)
 {
     rewardsTypes[numRewards]  = type;
     rewardsImages[numRewards] = overrideImage;
     rewardsValues[numRewards] = value;
     numRewards += 1;
 }
        private string HandleNewUser(ITweet tweet, string targetAddress, RewardType rewardType)
        {
            var canWithdraw = _withdrawalService.CanExecuteAsync(rewardType).GetAwaiter().GetResult();

            if (!canWithdraw)
            {
                _logger.Warning("Not enough funds for withdrawal.");
                return(string.Format(_appSettings.BotSettings.MessageFaucetDrained, tweet.CreatedBy.Name));
            }

            _withdrawalService.ExecuteAsync(rewardType, targetAddress).GetAwaiter().GetResult();
            _statService.AddStat(DateTime.UtcNow, _amountHelper.GetAmount(rewardType), true);

            var reward = new Reward
            {
                Id             = tweet.CreatedBy.Id,
                Followers      = tweet.CreatedBy.FollowersCount,
                LastRewardDate = DateTime.UtcNow,
                Withdrawals    = 1
            };

            _rewardCollection.Insert(reward);

            return(string.Format(_appSettings.BotSettings.MessageRewarded, tweet.CreatedBy.ScreenName,
                                 _amountHelper.GetAmount(rewardType)));
        }
Beispiel #10
0
    private int GetExtraBonusRandom(out RewardType rewardType)
    {
        int index = GetConfigIndex();
        ExtraBonusConfig tempConfig = config.ExtraBonusConfigs[index];
        float            totalRate  = tempConfig.cashBonusRate + tempConfig.goldBonusRate;
        float            rateResult = Random.Range(0, totalRate);

        if (rateResult >= tempConfig.cashBonusRate)
        {
            rewardType = RewardType.ExtraBonusGold;
        }
        else
        {
            rewardType = RewardType.ExtraBonusCash;
        }
        int result;

        if (rewardType == RewardType.ExtraBonusGold)
        {
            result  = Random.Range(tempConfig.minGoldBonus, tempConfig.maxGoldBonus + 1);
            result -= result % 10;
        }
        else
        {
            result = Random.Range(tempConfig.minCashBonus, tempConfig.maxCashBonus + 1);
        }
        return(result);
    }
Beispiel #11
0
        private void ProvideReward(GameSession session)
        {
            TrophyGradeMetadata grade = TrophyMetadataStorage.GetGrade(Id, NextGrade);
            RewardType          type  = (RewardType)grade.RewardType;

            switch (type)
            {
            case RewardType.Unknown:
            case RewardType.itemcoloring:
            case RewardType.shop_ride:
            case RewardType.title:
            case RewardType.beauty_hair:
            case RewardType.skillPoint:
            case RewardType.beauty_makeup:
            case RewardType.shop_build:
            case RewardType.item:
            case RewardType.shop_weapon:
            case RewardType.dynamicaction:
            case RewardType.etc:
            case RewardType.beauty_skin:
                break;

            case RewardType.statPoint:
                session.Player.StatPointDistribution.AddTotalStatPoints(grade.RewardValue, OtherStatsIndex.Trophy);
                session.Send(StatPointPacket.WriteTotalStatPoints(session.Player));
                break;

            default:
                break;
            }
        }
Beispiel #12
0
    // 유저 아이템 보상 및 저장
    public void UserItemReward(RewardType rewardType, int rewardItem, int rewardCount)
    {
        switch (rewardType)
        {
        case RewardType.Goods:
            switch (rewardItem)
            {
            case 1:
                UserInfo.instance.PutUserHeart(rewardCount);
                UserInfo.instance.SaveUserHeartInfo(() => { });
                break;

            case 2:
                UserInfo.instance.PutUserCrystal(rewardCount);
                UserInfo.instance.SaveUserCrystal(() => { });
                break;
            }
            break;

        case RewardType.Item:
            UserInfo.instance.PutUserItem(rewardItem, rewardCount);
            UserInfo.instance.SaveUserItemInfo(() => { });
            break;
        }
    }
Beispiel #13
0
 public Mission(string name, string description, int reward, RewardType rewardType)
 {
     Name        = name;
     Description = description;
     Reward      = reward;
     RewardType  = rewardType;
 }
Beispiel #14
0
    static public string getName(RewardType c) //this text and descriptions are also manually set in reward intro popups because f**k you
    {
        switch (c)                             //these are also set in Tutorial/Rewards/reward_***_intro
        {
        case RewardType.Modulator:
            return("Optimistic Child");

        case RewardType.Determined:
            return("Determined");

        case RewardType.HeroMobility:
            return("Indecisive");

        case RewardType.LaserFinisher:
            return("Confetti Pyromaniac");

        case RewardType.RapidFireFinisher:
            return("Interruptor");

        case RewardType.FearFinisher:
            return("Fearmongerer");

        case RewardType.SparklesFinisher:
            return("Perpetual Party Crasher");

        case RewardType.CriticalFinisher:
            return("Reality Distortion Master");

        case RewardType.TransformFinisher:
            return("Improbability Field Manipulator");

        default:
            return("Unknown reward name " + c.ToString());
        }
    }
Beispiel #15
0
    static public string getReward(RewardType c)
    {
        switch (c)
        {
        case RewardType.Modulator:
            return("Imagination wishes horses something something. Gain the modulator. Use it to change island color.");

        case RewardType.Determined:
            return("Have some extra (whatever). You earned it.");

        case RewardType.HeroMobility:
            return("Heroes can now be relocated to any other island on the map.");

        case RewardType.LaserFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Laser finisher enabled.");

        case RewardType.RapidFireFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " RapidFire finisher enabled.");

        case RewardType.FearFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Fear afflicted enemies spread fear to surrounding enemies.");

        case RewardType.SparklesFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Sparkles produce more sparkles when they hit their targets.");

        case RewardType.CriticalFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Critical attacks have a chance of killing their targets.");

        case RewardType.TransformFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Transform may turn the enemy into a giant whale.");

        default:
            return("Uknown reward " + c.ToString() + " it's probably something awesome though who knows.");
        }
    }
Beispiel #16
0
    static public string getLabel(RewardType c)
    {
        switch (c)
        {
        case RewardType.Modulator:
            return("Use <1> wishes. So far: <2>.");

        case RewardType.Determined:
            return("Play for <1> minutes. So far: <2>.");

        case RewardType.HeroMobility:
            return("Sell <1> toys. So far: <2>.");

        case RewardType.RapidFireFinisher:
            return("Use the RapidFire upgrade <1> times. So far: <2>.");

        case RewardType.LaserFinisher:
            return("Use the Laser upgrade <1> times. So far: <2>.");

        case RewardType.CriticalFinisher:
            return("Use the Critical upgrade <1> times. So far: <2>.");

        case RewardType.SparklesFinisher:
            return("Use the Sparkles upgrade <1> times. So far: <2>.");

        case RewardType.FearFinisher:
            return("Use the Fear upgrade <1> times. So far: <2>.");

        case RewardType.TransformFinisher:
            return("Use the Transform upgrade <1> times. So far: <2>.");

        default:
            return("Unknown reward label " + c.ToString());
        }
    }
Beispiel #17
0
 void Start()
 {
     myIndex           = transform.GetSiblingIndex();
     rewardType        = SpinWheelSetup.Instance.rewarItem[myIndex].rewardType;
     iconSpRend.sprite = SpinWheelSetup.Instance.rewarItem[myIndex].rewardSprite;
     valueText.text    = SpinWheelSetup.Instance.rewarItem[myIndex].rewardQuantity.ToString();
 }
        private void ChangeImage()
        {
            RewardType rewardToSet = rewardCollection.GetHighestReward(rewardName);

            switch (rewardCollection.GetHighestReward(rewardName))
            {
            case RewardType.Bronze:
                originalImage.sprite = bronzeReward;
                break;

            case RewardType.Silver:
                originalImage.sprite = SilverReward;
                break;

            case RewardType.Gold:
                originalImage.sprite = goldReward;
                break;

            default:
                originalImage.sprite = shadowReward;
                break;
            }

            var tempColor = originalImage.color;

            tempColor.a         = 1f;
            originalImage.color = tempColor;
        }
Beispiel #19
0
    private string GetRewardTypeName(RewardType type)
    {
        //NvLocalizationManager m_Localization = Singlton.getInstance("NvLocalizationManager")as NvLocalizationManager;

        string ret = "";

        switch (type)
        {
        case RewardType.EXP:
        {
            //ret = m_Localization.GetValue("Exp");
        }
        break;

        case RewardType.GOLD:
        {
            //ret = m_Localization.GetValue("Gold");
        }
        break;

        case RewardType.MATURITY:
        {
            //ret = m_Localization.GetValue("Maturity");
        }
        break;
        }
        return(ret);
    }
Beispiel #20
0
 public Reward(string name, RewardType type, short id = -1, int quantity = 1)
 {
     Name     = name;
     Type     = type;
     ID       = id;
     Quantity = quantity;
 }
        /// <summary>
        /// Gets the reward user.
        /// </summary>
        /// <param name="rewardType">Type of the reward.</param>
        private async Task <Guid> GetRewardUser(RewardType rewardType)
        {
            try
            {
                Log.Message(LogLevel.Debug, "[GetRewardUser] - Fetching reward user, RewardType: {0}", rewardType);
                using (var context = ExchangeDataContextFactory.CreateContext())
                {
                    var result = await context.Database.SqlQuery <RewardResult>("GetRewardUser @p0", rewardType.ToString()).ToListAsync();

                    if (result.IsNullOrEmpty())
                    {
                        Log.Message(LogLevel.Debug, "[GetRewardUser] - No user found for reward.");
                        return(Guid.Empty);
                    }

                    var item = result.FirstOrDefault();
                    if (_lastValues[rewardType].LastItemId == item.LastItemId || _lastValues[rewardType].UserId == item.UserId)
                    {
                        Log.Message(LogLevel.Debug, "[GetRewardUser] - User already awarded for this prize, LastItemId: {0}", item.LastItemId);
                        return(Guid.Empty);
                    }

                    _lastValues[rewardType] = item;
                    Log.Message(LogLevel.Debug, "[GetRewardUser] - User found for reward, UserId: {0}, ItemId: {1}", item.UserId, item.LastItemId);
                    return(item.UserId);
                }
            }
            catch (Exception ex)
            {
                Log.Exception("[GetRewardUser] - An exception occured getting reward user, RewardType: {0}", ex, rewardType);
            }
            return(Guid.Empty);
        }
        private RewardType getRewardType(int itemTypeId)
        {
            RewardTypeEnum rewardTypeId = Utilities.ToEnum <RewardTypeEnum>(itemTypeId).Value;
            RewardType     rewardType   = new RewardType(rewardTypeId);

            return(rewardType);
        }
Beispiel #23
0
    public int GetJackpotRandom(out RewardType rewardType)
    {
        int                index             = GetConfigIndex();
        JackpotConfig      tempJackpotConfig = config.JackpotConfigConfigs[index];
        SpecialPropsConfig tempSPConfig      = config.SpecialPropsConfigs[index];
        float              totalRate         = tempJackpotConfig.noRewardRate + tempJackpotConfig.goldRewardRate + tempJackpotConfig.cashRewardRate;
        float              rateResult        = Random.Range(0, totalRate);

        if (rateResult < tempJackpotConfig.noRewardRate)
        {
            rewardType = RewardType.Null;
            return(0);
        }
        else if (rateResult >= tempJackpotConfig.noRewardRate && rateResult < tempJackpotConfig.noRewardRate + tempJackpotConfig.goldRewardRate)
        {
            rewardType = RewardType.Gold;
            int baseNum = tempJackpotConfig.goldPool[Random.Range(0, tempJackpotConfig.goldPool.Count)];
            nextRewardMutiple = tempSPConfig.goldMutiple[Random.Range(0, tempSPConfig.goldMutiple.Count)];
            nextRewardType    = RewardType.Gold;
            nextRewardNum     = baseNum;
            return(baseNum);
        }
        else
        {
            rewardType = RewardType.Cash;
            int baseNum = tempJackpotConfig.cashPool[Random.Range(0, tempJackpotConfig.cashPool.Count)];
            nextRewardMutiple = tempSPConfig.cashMutiple[Random.Range(0, tempSPConfig.cashMutiple.Count)];
            nextRewardType    = RewardType.Cash;
            nextRewardNum     = baseNum;
            return(baseNum);
        }
    }
        private void InitTypeSpecifics(RewardType value)
        {
            switch (reward.Type)
            {
            case RewardType.Gold:
                CardSelectionVisible = false;
                break;

            case RewardType.SoulGem:
                CardSelectionVisible = false;
                break;

            case RewardType.Pack:
                CardSelectionVisible = false;
                break;

            case RewardType.Card:
                if (Reward.CardInstance == null)
                {
                    Reward.CardInstance = new CardInstance(this.trackerFactory);
                    Reward.CardInstance.PropertyChanged += Reward_PropertyChanged;
                }
                CardSelectionVisible = true;
                break;

            default:
                break;
            }
            RaisePropertyChangedEvent("Reward");
        }
Beispiel #25
0
        public void Reward(Player player)
        {
            if (player == null)
            {
                return;
            }
            var        random            = new System.Random();
            var        randomRewardIndex = random.Next(0, BonusBox.REWARDS.Count - 1);
            var        rewardListIndex   = BonusBox.REWARDS[randomRewardIndex];
            var        lootId            = rewardListIndex.Item1;
            var        amount            = rewardListIndex.Item2;
            RewardType type;
            Reward     reward;

            if (RewardType.TryParse(lootId, true, out type))
            {
                reward = new Reward(type, amount);
            }
            else
            {
                if (lootId.Contains("ammunition"))
                {
                    type = RewardType.AMMO;
                }
                reward = new Reward(type, new Item(-1, lootId, amount), amount);
            }
            reward.ParseRewards(player);
        }
Beispiel #26
0
 public bool Deserialize(JSON_VersusRankRewardRewardParam json)
 {
     this.mType  = (RewardType)json.item_type;
     this.mIName = json.item_iname;
     this.mNum   = json.item_num;
     return(true);
 }
Beispiel #27
0
        private void SetDataSourcebySearchKey(String SearchPhrase)
        {
            ods.TypeName     = typeof(CustomerDAC).FullName;
            ods.EnablePaging = true;
            ods.SelectParameters.Clear();

            ods.SelectParameters.Add("providerID", ProviderID.ToString());
            ods.SelectParameters.Add("searchKey", SearchPhrase);


            ods.SelectParameters.Add("ageFrom", AgeFrom.ToString());
            ods.SelectParameters.Add("ageTo", AgeTo.ToString());

            ods.SelectParameters.Add("RewardType", RewardType.ToString());
            ods.SelectParameters.Add("categoryID", CategoryID.ToString());

            ods.SelectMethod               = "RetrieveAdminRewardsbySearchPhrase";
            ods.SelectCountMethod          = "RetrieveAdminRewardsbySearchPhraseCount";
            ods.MaximumRowsParameterName   = "amount";
            ods.StartRowIndexParameterName = "startIndex";
            ods.SortParameterName          = "sortExpression";

            ListViewRewards.DataSourceID = "ods";

            SortProducts();
        }
Beispiel #28
0
 private static bool RewardTypeRequiresClaim(RewardType type)
 {
     return(type switch
     {
         RewardType.item or RewardType.title => true,
         _ => false
     });
Beispiel #29
0
        public void RewardPlayer(Player player, RewardType type, Item item, int amount)
        {
            switch (type)
            {
            case RewardType.AMMO:
                // BAT / ROK
                if (item.LootId.Contains("ammunition_laser"))
                {
                    amount = RewardMultiplyer(type, amount, player);
                    player.Information.Ammunitions[item.LootId].Add(amount);
                    //Packet.Builder.LegacyModule(World.StorageManager.GetGameSession(player.Id),
                    //    "0|LM|ST|BAT|" + Converter.GetLootAmmoId(item.LootId) + "|" + amount);
                }
                else if (item.LootId.Contains("ammunition_rocket"))
                {
                    amount = RewardMultiplyer(type, amount, player);
                    player.Information.Ammunitions[item.LootId].Add(amount);
                    //Packet.Builder.LegacyModule(World.StorageManager.GetGameSession(player.Id),
                    //    "0|LM|ST|ROK|" + Converter.GetLootAmmoId(item.LootId) + "|" + amount);
                }                    //todo: fix

                break;

            case RewardType.ITEM:
                break;
            }
        }
Beispiel #30
0
        internal Reward AddNewReward(RewardType rt)
        {
            var indexToInsert = -1;

            indexToInsert = FindIndexToInsert(rt);

            var newReward = new Reward(trackerFactory)
            {
                Type = rt, Reason = rewardReason.Value
            };

            if ((indexToInsert > -1) &&
                (indexToInsert < RewardsEditor.Count))
            {
                rewards.Add(newReward);
                RewardsEditor.Insert(indexToInsert, new AddSingleRewardViewModel(trackerFactory)
                {
                    Reward = newReward, ParentRewardViewModel = this
                });
            }
            else
            {
                rewards.Add(newReward);
                RewardsEditor.Add(new AddSingleRewardViewModel(trackerFactory)
                {
                    Reward = newReward, ParentRewardViewModel = this
                });
            }

            RaisePropertyChangedEvent(nameof(RewardsEditor));

            return(newReward);
        }
	public static Color GetColourForRewardType(RewardType type) {
		switch (type) {
			case RewardType.GOLD : return GOLD;
			case RewardType.RESOURCE :	return RESOURCE;
			case RewardType.CUSTOM_RESOURCE : return CUSTOM_RESOURCE;

		}
		return Color.white;
	}
        public EventRewardInfo(RewardType rtype, string name, string info, int price, int itemid, int incrid, int x, int y)
        {
            RType = rtype;
            Name = name;
            Info = info;
            Price = price;
            ItemID = itemid;
            IncrID = incrid;
            X = x;
            Y = y;

            EventRewardSystem.GetList((int)rtype).Add(this);
        }
 public static RewardStrategy CreateStrategy(RewardType strategyType, RewardModel model)
 {
     switch (strategyType)
     {
         case RewardType.SingleWinner:
             return new SingleWinner();
         case RewardType.TopNWinners:
             // ReSharper disable once PossibleInvalidOperationException
             byte winnersCount = (byte)model.WinnersCount;
             return new TopNWinners(winnersCount);
         default:
             throw new ArgumentException();
     }
 }
Beispiel #34
0
 /// <summary>
 /// 通用活动奖励
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="reward"></param>
 /// <param name="num"></param>
 public static string GameUserUniversalNocite(string userID, RewardType reward, int itemID, int num, string systemContent)
 {
     string content = string.Empty;
     GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
     if (userInfo != null)
     {
         if (reward == RewardType.GameGoin)
         {
             userInfo.GameCoin = MathUtils.Addition(userInfo.GameCoin, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, string.Format(LanguageManager.GetLang().St_GameCoin, num));
         }
         else if (reward == RewardType.Obtion)
         {
             userInfo.ObtainNum = MathUtils.Addition(userInfo.ObtainNum, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, string.Format(LanguageManager.GetLang().St_ObtionNum, num));
         }
         else if (reward == RewardType.EnergyNum)
         {
             userInfo.EnergyNum = MathUtils.Addition(userInfo.EnergyNum, (short)num, short.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, string.Format(LanguageManager.GetLang().St_EnergyNum, num));
         }
         else if (reward == RewardType.ExpNum)
         {
             userInfo.ExpNum = MathUtils.Addition(userInfo.ExpNum, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, string.Format(LanguageManager.GetLang().St_ExpNum, num));
         }
         else if (reward == RewardType.Gold)
         {
             userInfo.ItemGold = MathUtils.Addition(userInfo.ItemGold, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, string.Format(LanguageManager.GetLang().St_GiftGoldNum, num));
         }
         else if (reward == RewardType.Experience)
         {
             UserHelper.UserGeneralExp(userID, num);
             content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, string.Format(LanguageManager.GetLang().St_Experience, num));
         }
         else if (reward == RewardType.Item)
         {
             UserItemHelper.AddUserItem(userID, itemID, num);
             ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemID);
             if (itemInfo != null)
             {
                 string itemcontent = string.Format(LanguageManager.GetLang().St_Item, itemInfo.ItemName, 1, num);
                 content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, itemcontent);
             }
         }
         else if (reward == RewardType.CrystalType)
         {
             CrystalQualityType qualityType = CrystalQualityType.PurPle;
             content = UserUserUniversalCrystal(userInfo, qualityType, systemContent);
             //GetUserCrystal(userInfo, qualityType);
         }
         else if (reward == RewardType.CrystalId)
         {
             var packageCrystal = UserCrystalPackage.Get(userID);
             UserCrystalInfo userCrystal = new UserCrystalInfo()
             {
                 UserCrystalID = Guid.NewGuid().ToString(),
                 CrystalID = itemID,
                 CrystalLv = 1,
                 CurrExprience = 0,
                 GeneralID = 0,
                 IsSale = 2,
                 CreateDate = DateTime.Now
             };
             packageCrystal.SaveCrystal(userCrystal);
             CrystalInfo info = new ConfigCacheSet<CrystalInfo>().FindKey(itemID);
             if (info != null)
             {
                 content = string.Format(LanguageManager.GetLang().st_FestivalInfoReward, systemContent, string.Format(LanguageManager.GetLang().St_Crystal, info.CrystalQuality, info.CrystalName));
             }
         }
     }
     return content;
 }
Beispiel #35
0
 /// <summary>
 /// 活动奖励
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="reward"></param>
 /// <param name="num"></param>
 public static string GameUserRewardNocite(string userID, RewardType reward, int itemID, int num, CrystalQualityType qualityType)
 {
     string content = string.Empty;
     GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
     if (userInfo != null)
     {
         if (reward == RewardType.GameGoin)
         {
             userInfo.GameCoin = MathUtils.Addition(userInfo.GameCoin, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().St_SummerThreeGameCoinNotice, num);
         }
         else if (reward == RewardType.Obtion)
         {
             userInfo.ObtainNum = MathUtils.Addition(userInfo.ObtainNum, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().St_SummerThreeObtionNotice, num);
         }
         else if (reward == RewardType.EnergyNum)
         {
             userInfo.EnergyNum = MathUtils.Addition(userInfo.EnergyNum, (short)num, short.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().St_SummerThreeEnergyNotice, num);
         }
         else if (reward == RewardType.ExpNum)
         {
             userInfo.ExpNum = MathUtils.Addition(userInfo.ExpNum, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().St_SummerThreeExpNumNotice, num);
         }
         else if (reward == RewardType.Gold)
         {
             userInfo.ItemGold = MathUtils.Addition(userInfo.ItemGold, num, int.MaxValue);
             //userInfo.Update();
             content = string.Format(LanguageManager.GetLang().St_SummerThreeGoldNotice, num);
         }
         else if (reward == RewardType.Experience)
         {
             UserHelper.UserGeneralExp(userID, num);
             content = string.Format(LanguageManager.GetLang().St_SummerThreeExperienceNotice, num);
         }
         else if (reward == RewardType.Item)
         {
             UserItemHelper.AddUserItem(userID, itemID, num);
             ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemID);
             if (itemInfo != null)
             {
                 content = string.Format(LanguageManager.GetLang().St_SummerThreeItemNotice, num, itemInfo.ItemName);
             }
         }
         else if (reward == RewardType.CrystalType)
         {
             GetUserCrystal(userInfo, qualityType);
         }
         else if (reward == RewardType.CrystalId)
         {
             UserHelper.CrystalAppend(userID, itemID, 2);
             CrystalInfo info = new ConfigCacheSet<CrystalInfo>().FindKey(itemID);
             if (info != null)
             {
                 content = string.Format(LanguageManager.GetLang().St_SummerCrystalNotice, info.CrystalName);
             }
         }
     }
     return content;
 }
Beispiel #36
0
 /// <summary>
 /// 活动奖励
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="reward"></param>
 /// <param name="num"></param>
 public static void GameUserReward(string userID, RewardType reward, int itemID, int num)
 {
     GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
     if (userInfo != null)
     {
         if (reward == RewardType.GameGoin)
         {
             userInfo.GameCoin = MathUtils.Addition(userInfo.GameCoin, num, int.MaxValue);
             //userInfo.Update();
         }
         else if (reward == RewardType.Obtion)
         {
             userInfo.ObtainNum = MathUtils.Addition(userInfo.ObtainNum, num, int.MaxValue);
             //userInfo.Update();
         }
         else if (reward == RewardType.EnergyNum)
         {
             userInfo.EnergyNum = MathUtils.Addition(userInfo.EnergyNum, (short)num, short.MaxValue);
             //userInfo.Update();
         }
         else if (reward == RewardType.ExpNum)
         {
             userInfo.ExpNum = MathUtils.Addition(userInfo.ExpNum, num, int.MaxValue);
             //userInfo.Update();
         }
         else if (reward == RewardType.Gold)
         {
             userInfo.ItemGold = MathUtils.Addition(userInfo.ItemGold, num, int.MaxValue);
             //userInfo.Update();
         }
         else if (reward == RewardType.Experience)
         {
             UserHelper.UserGeneralExp(userID, num);
         }
         else if (reward == RewardType.Item)
         {
             UserItemHelper.AddUserItem(userID, itemID, num);
         }
         else if (reward == RewardType.CrystalType)
         {
             CrystalQualityType qualityType = CrystalQualityType.PurPle;
             GetUserCrystal(userInfo, qualityType);
         }
         else if (reward == RewardType.CrystalId)
         {
             UserHelper.CrystalAppend(userID, itemID, 2);
         }
     }
 }
Beispiel #37
0
        public void SetVerify(Area area, string entName, RewardType targetType, EnterpriseType entType, out string errMsg)
        {
            errMsg = string.Empty;
            IList<DJ_TourEnterprise> ents = GetDJS8name(entName);
            DJ_TourEnterprise ent = new DJ_TourEnterprise();
            if (ents.Count > 0)
            {
                if (ents.Count > 1)
                {
                    TourLog.LogError(this.GetType() + ":" + ents.Count + "个企业重名:" + entName);
                }
                ent = ents[0];
                ;

            }
            else if (ents.Count == 0)
            {

                ent.Name = entName;
                ent.Area = area;
                ent.Type = entType;
                Save(ent);

            }
            SetVerify(ent, targetType);
        }
Beispiel #38
0
        /// <summary>
        /// 根据原有认证状态和目标状�计算 应该设置的状�
        /// </summary>
        /// <param name="original"></param>
        /// <param name="target"></param>
        private RewardType GetFinalVeryfyState(RewardType original, RewardType target)
        {
            RewardType finalType = RewardType.从未纳入;
            switch (original)
            {
                case 0:
                    finalType = target;
                    break;
                case RewardType.从未纳入:
                    switch (target)
                    {
                        case RewardType.从未纳入:
                        case RewardType.纳入后移除:
                            break;
                        case RewardType.已纳入:
                            finalType = RewardType.已纳入;
                            break;
                    }
                    break;

                case RewardType.纳入后移除:
                    switch (target)
                    {
                        case RewardType.从未纳入:
                        case RewardType.纳入后移除:
                            break;
                        case RewardType.已纳入:
                            finalType = RewardType.已纳入;
                            break;
                    }
                    break;
                case RewardType.已纳入:
                    switch (target)
                    {
                        case RewardType.从未纳入:
                        case RewardType.纳入后移除:
                            finalType = RewardType.纳入后移除;
                            break;
                        case RewardType.已纳入:
                            break;
                    }
                    break;
            }
            return finalType;
        }
Beispiel #39
0
 public Prize(PrizeType type)
 {
     open = true;
     m_type = type;
     if (m_type == PrizeType.CHEST)
         open = false;
     if (m_type != PrizeType.KEY) {
         m_reward = (RewardType)((int)(Random.value * (float)RewardType.NUM_REWARD_TYPES) % (int)RewardType.NUM_REWARD_TYPES);
     }
 }
    private string GetRewardTypeName(RewardType type)
    {
        //NvLocalizationManager m_Localization = Singlton.getInstance("NvLocalizationManager")as NvLocalizationManager;

            string ret = "";

            switch(type)
            {
                case RewardType.EXP:
                {
                    //ret = m_Localization.GetValue("Exp");
                }
                break;
                case RewardType.GOLD:
                {
                    //ret = m_Localization.GetValue("Gold");
                }
                break;
                case RewardType.MATURITY:
                {
                    //ret = m_Localization.GetValue("Maturity");
                }
                break;

            }
            return ret;
    }
Beispiel #41
0
 public int GetExpRewardNum(RewardType rewardType, int BaseNum, int userLv)
 {
     int rewardNum = 0;
     if (rewardType == RewardType.Experience)
     {
         rewardNum = BaseNum * userLv;
     }
     else if (rewardType == RewardType.GameGoin)
     {
         rewardNum = BaseNum * userLv;
     }
     else
     {
         rewardNum = BaseNum;
     }
     return rewardNum;
 }
		private async Task<bool> BehaviorRoutine()
		{
			//Refresh Active Quests and Check that we are still in the reward step..
			FunkyGame.Bounty.RefreshActiveQuests();
			if (!FunkyGame.Bounty.ActiveQuests.ContainsKey(337492) || FunkyGame.Bounty.ActiveQuests[337492].Step != 34)
			{
				Logger.DBLog.Info("Active Quest no longer valid for reward!");
				m_IsDone = true;
				return true;
			}

			//Check if the rift key upgrade continue button is visible
			if (UI.ValidateUIElement(UI.Game.RiftReward_UpgradeKey_ContinueButton))
			{
				UI.Game.RiftReward_UpgradeKey_ContinueButton.Click();
				await Coroutine.Sleep(250);
				await Coroutine.Yield();
			}

			if (!delayer.Test(5))
			{
				await Coroutine.Sleep(250);
				await Coroutine.Yield();
			}

			//Check if the NPC dialog is still valid
			if (!UI.ValidateUIElement(UI.Game.SalvageMainPage))
			{
				Logger.DBLog.Info("Rift Reward Dialog not valid.");
				m_IsDone = true;
				return true;
			}

			//Upgrading Gems?
			if (UI.Game.RiftReward_gemUpgradePane_UpgradeButton.IsVisible)
			{
				if (!delayer.Test(10))
				{
					await Coroutine.Sleep(250);
					await Coroutine.Yield();
				}

				Logger.DBLog.Info("Upgrading Gems..");

				//Update our variables (UIElements of gems, number of gems, and the gem ACDItems)
				if (SelectableGems.Count == 0)
				{
					GRiftLevel = GetTieredLootLevel();
					SelectableUIGemElements = GetGemUIElements();
					int totalGemUIElements = SelectableUIGemElements.Count;
					SelectableUIGemElementIndexs = GetGemACDGuids(totalGemUIElements);
					SelectableGems = GetGemCacheACDItems(SelectableUIGemElementIndexs).OrderByDescending(i => i.LegendaryGemRank).ToList();

					Logger.DBLog.DebugFormat("Total number of possible gems to upgrade {0}", SelectableGems.Count);

					double minSucessChance = FunkyBaseExtension.Settings.AdventureMode.GemUpgradingMinimumSuccessRate;
					if (FunkyBaseExtension.Settings.AdventureMode.GemUpgradeType == SettingAdventureMode.GemUpgradingType.HighestRank)
					{
						if (SelectableGems.Any(i => ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance))
						{
							SelectableGems=SelectableGems.Where(i => ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance).OrderByDescending(i => i.LegendaryGemRank).ToList();
						}
						else
							SelectableGems = SelectableGems.OrderByDescending(i => i.LegendaryGemRank).ToList();
					}
					else if (FunkyBaseExtension.Settings.AdventureMode.GemUpgradeType == SettingAdventureMode.GemUpgradingType.LowestRank)
					{
						if (SelectableGems.Any(i => ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance))
						{
							SelectableGems = SelectableGems.Where(i => ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance).OrderBy(i => i.LegendaryGemRank).ToList();
						}
						else
							SelectableGems = SelectableGems.OrderBy(i => i.LegendaryGemRank).ToList();
					}
					else if (FunkyBaseExtension.Settings.AdventureMode.GemUpgradeType == SettingAdventureMode.GemUpgradingType.Priority && FunkyBaseExtension.Settings.AdventureMode.GemUpgradePriorityList.Count > 0)
					{
						if (SelectableGems.Any(i => FunkyBaseExtension.Settings.AdventureMode.GemUpgradePriorityList.Contains(i.LegendaryGemType) && ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance))
						{
							//Select only Prioritized Gems
							SelectableGems = SelectableGems.Where(i => FunkyBaseExtension.Settings.AdventureMode.GemUpgradePriorityList.Contains(i.LegendaryGemType) && ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance).ToList();

							//Create new list with priority order
							List<CacheACDItem> PrioritizedList = new List<CacheACDItem>();
							for (int i = 0; i < FunkyBaseExtension.Settings.AdventureMode.GemUpgradePriorityList.Count - 1; i++)
							{
								var LegenadryEnumValue = FunkyBaseExtension.Settings.AdventureMode.GemUpgradePriorityList[i];
								if (SelectableGems.Any(item =>item.LegendaryGemType==LegenadryEnumValue && ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, item.LegendaryGemRank) >= minSucessChance))
								{
									var acditem = SelectableGems.First(item => item.LegendaryGemType == LegenadryEnumValue && ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, item.LegendaryGemRank) >= minSucessChance);
									PrioritizedList.Add(acditem);
								}
							}

							if (PrioritizedList.Count>0)
								SelectableGems = PrioritizedList;
						}
					}
					else
					{
						if (SelectableGems.Any(i => ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance))
						{
							SelectableGems = SelectableGems.Where(i => ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, i.LegendaryGemRank) >= minSucessChance).ToList();
						}
					}

					Logger.DBLog.InfoFormat("Number of Gems capable of upgrading {0}", SelectableGems.Count);
					foreach (var gem in SelectableGems)
					{
						double successChance = ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, gem.LegendaryGemRank);
						Logger.DBLog.DebugFormat("Upgrade Capable Gem {0} with Chance {1}%", gem.LegendaryGemType, (successChance*100).ToString());
					}
				}

				//Check if the upgrade button is enabled.. if not we select our gem!
				if (!UI.Game.RiftReward_gemUpgradePane_UpgradeButton.IsEnabled)
				{
					//Set our default upgrade to our highest ranked (thats not 0%)
					var upgradingGem = SelectableGems.FirstOrDefault();
					int selectIndex = SelectableUIGemElementIndexs.IndexOf(upgradingGem.ACDGUID);
					string GemName = upgradingGem.ThisRealName + 
						" Rank " + upgradingGem.LegendaryGemRank + 
						" Chance " + ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, upgradingGem.LegendaryGemRank);

					Logger.DBLog.InfoFormat("Upgrading Gem {0}", GemName);
					
					//Select the Gem UIElement
					UI.Game.RiftReward_gemUpgradePane_List.ItemsListSetSelectedItemByIndex(selectIndex);
					await Coroutine.Sleep(250);
					await Coroutine.Yield();
				}
				else
				{
					UI.Game.RiftReward_gemUpgradePane_UpgradeButton.Click();
					await Coroutine.Sleep(250);
					await Coroutine.Yield();
				}

			}
			else
			{
				Logger.DBLog.Info("Reward Selection..");

				//Click continue after selecting a reward (not used currently)
				if (UI.ValidateUIElement(UI.Game.RiftReward_UpgradeContinue))
				{
					UI.Game.RiftReward_UpgradeContinue.Click();
					await Coroutine.Sleep(250);
					await Coroutine.Yield();
				}

				//Validate that upgrade key is enabled.. then attempt to upgrade!
				if (Reward == RewardType.Key && UI.Game.RiftReward_Choice_UpgradeKey.IsEnabled && ZetaDia.Me.AttemptUpgradeKeystone())
				{
					Logger.DBLog.Info("Keystone Upgraded");
					UIManager.CloseAllOpenFrames();
					await Coroutine.Sleep(250);
					await Coroutine.Yield();
				}
				else 
				{
					//Doing Gem Upgrade..
					GRiftLevel = GetTieredLootLevel();
					var Gems = GetGemCacheACDItems().OrderByDescending(i => i.LegendaryGemRank).ToList();
					if (Gems.Count>0)
					{
						//Logger.DBLog.InfoFormat("Upgrading Gem {0}", Gems[0].ThisRealName);
						await CommonCoroutines.AttemptUpgradeGem(Gems[0].ACDItem);
						await Coroutine.Sleep(250);
						await Coroutine.Yield();
					}
					else
					{
						Reward= RewardType.Key;
						await Coroutine.Sleep(250);
						await Coroutine.Yield();
					}
				}
			}

			

			return true;
		}
Beispiel #43
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="govLevel">设置的级�省市�/param>
        /// <param name="ent">需要设置的企业</param>
        /// <param name="targetType">目标�/param>
        public void SetVerify(DJ_TourEnterprise ent, RewardType targetType)
        {
            AreaLevel level = ent.Area.Level;
            switch (level)
            {
                case AreaLevel.区县:
                    ent.CountryVeryfyState =targetType;// GetFinalVeryfyState(ent.CountryVeryfyState, targetType);

                    break;

                case AreaLevel.市:
                    ent.CityVeryfyState =targetType;// GetFinalVeryfyState(ent.CityVeryfyState, targetType);

                    break;
                case AreaLevel.省:
                    ent.ProvinceVeryfyState =targetType;// GetFinalVeryfyState(ent.ProvinceVeryfyState, targetType);

                    break;
            }
            ent.LastUpdateTime = DateTime.Now;
            dalEnt.Save(ent);
        }
Beispiel #44
0
 protected override object this[string index]
 {
     get
     {
         #region
         switch (index)
         {
             case "ID": return ID;
             case "GroupID": return GroupID;
             case "DialType": return DialType;
             case "RewardType": return RewardType;
             case "ItemID": return ItemID;
             case "ItemNum": return ItemNum;
             case "HeadID": return HeadID;
             case "Probability": return Probability;
             case "IsBroadcast": return IsBroadcast;
             case "BroadContent": return BroadContent;
             case "IsShow": return IsShow;
             case "ItemDesc": return ItemDesc;
             default: throw new ArgumentException(string.Format("DialInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
     set
     {
         #region
         switch (index)
         {
             case "ID":
                 _ID = value.ToInt();
                 break;
             case "GroupID":
                 _GroupID = value.ToInt();
                 break;
             case "DialType":
                 _DialType = value.ToShort();
                 break;
             case "RewardType":
                 _RewardType = value.ToEnum<RewardType>();
                 break;
             case "ItemID":
                 _ItemID = value.ToInt();
                 break;
             case "ItemNum":
                 _ItemNum = value.ToDecimal();
                 break;
             case "HeadID":
                 _HeadID = value.ToNotNullString();
                 break;
             case "Probability":
                 _Probability = value.ToDecimal();
                 break;
             case "IsBroadcast":
                 _IsBroadcast = value.ToBool();
                 break;
             case "BroadContent":
                 _BroadContent = value.ToNotNullString();
                 break;
             case "IsShow":
                 _IsShow = value.ToBool();
                 break;
             case "ItemDesc":
                 _ItemDesc = value.ToNotNullString();
                 break;
             default: throw new ArgumentException(string.Format("DialInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
 }
 public void clear()
 {
     m_rewardType = RewardType.Credits;
     m_value = "";
     m_flag = "";
 }
Beispiel #46
0
        /// <summary>
        /// 管理部门辖区的纳�已移�企业列表
        /// </summary>
        /// <param name="gov"></param>
        /// <returns></returns>
        public IList<DJ_TourEnterprise> GetRewardEntList(string entName,DJ_GovManageDepartment gov, EnterpriseType? entType, RewardType rewardType)
        {
            IList<DJ_TourEnterprise> entList = dalEnt.GetList(entName,true,gov.Area.Code, entType, rewardType);

            return entList;
        }
Beispiel #47
0
 public QuestReward(RewardType type, uint context)
 {
     _type = type;
     _context = context;
 }
 public void setRewardType(RewardType rewardType)
 {
     m_rewardType = rewardType;
 }