public override bool TakeAction() { DialHelper.CheckDialNum(ContextUser.UserID); var userDial = new GameDataCacheSet <UserDial>().FindKey(ContextUser.UserID); if (userDial != null && userDial.Treasure.Count > 0) { treasureList = (userDial.Treasure.Reverse()).ToList(); } return(true); }
public override bool TakeAction() { DialHelper.CheckDialNum(ContextUser.UserID); var serverEnvSet = new ShareCacheStruct <ServerEnvSet>().FindKey(ServerEnvKey.UserTreasure); if (serverEnvSet != null) { var tempList = JsonUtils.Deserialize <CacheList <TreasureInfo> >(serverEnvSet.EnvValue); treasureList = tempList.Reverse().ToList(); } return(true); }
public override bool TakeAction() { DialHelper.CheckDialNum(ContextUser.UserID); //freeNum = GameConfigSet.FreeSweepstakes; UserDial userDial = new GameDataCacheSet <UserDial>().FindKey(ContextUser.UserID); if (userDial == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; return(false); } //string content = LanguageManager.GetLang().St_SummerThreeGameCoinNotice.Substring(0, 5); //itemHead = userDial.HeadID; //if (userDial.PrizeInfo != null && !string.IsNullOrEmpty(userDial.PrizeInfo.UserID)) //{ // if (userDial.PrizeInfo.Type == RewardType.Again || userDial.PrizeInfo.Type == RewardType.Recharge || userDial.PrizeInfo.Type == RewardType.Mood) // { // itemContent = DialHelper.PrizeItemName(userDial.PrizeInfo); // } // else // { // itemContent = content + DialHelper.PrizeItemName(userDial.PrizeInfo); // } //} //if (userDial.RefreshDate.Date == DateTime.Now.Date) //{ // freeNum = MathUtils.Subtraction(freeNum, userDial.DialNum); // if (userDial.DialNum >= freeNum) // { // isFree = 1; // } //} //} int itemID = UserItemHelper.GetUserItemInfoID(ContextUser.UserID, userItemID); var itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(itemID); if (itemInfo == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; return(false); } int groupID = DialHelper.ChestDialGroupID(ContextUser.UserID, itemID); freeNum = UserItemHelper.UserItemNum(ContextUser.UserID, itemID); dialList = new ConfigCacheSet <DialInfo>().FindAll(m => m.GroupID == groupID); dialList.QuickSort((x, y) => { if (x == null && y == null) { return(0); } if (x != null && y == null) { return(1); } if (x == null) { return(-1); } return(x.ID.CompareTo(y.ID)); }); userDial.UserItemID = userItemID; return(true); }
public override bool TakeAction() { DialHelper.CheckDialNum(ContextUser.UserID); UserDial userDial = new PersonalCacheStruct <UserDial>().FindKey(ContextUser.UserID); if (userDial == null || string.IsNullOrEmpty(userDial.UserItemID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; return(false); } if (ops == 1) { string errContent = string.Empty; if (UserPackHelper.PackIsFull(ContextUser, BackpackType.BeiBao, 0, out errContent)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = errContent; return(false); } int itemid = UserItemHelper.GetUserItemInfoID(ContextUser.UserID, userDial.UserItemID); var itemInfo = new ShareCacheStruct <ItemBaseInfo>().FindKey(itemid); if (itemInfo == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough; return(false); } // 根据宝箱取得该宝箱对应的钥匙ID int itemNum = UserItemHelper.CheckItemNum(ContextUser.UserID, itemInfo.EffectNum); if (itemNum <= 0) { ItemBaseInfo itemKey = new ShareCacheStruct <ItemBaseInfo>().FindKey(itemInfo.EffectNum); if (itemKey == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1107_UserItemNotEnough; return(false); } ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = string.Format(LanguageManager.GetLang().St12004_ChestKeyNotEnough, itemKey.ItemName); return(false); } UserItemHelper.UseUserItem(ContextUser.UserID, itemid, 1); UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.EffectNum, 1); postion = DialHelper.ChestDialPrizePostion(ContextUser); postion = MathUtils.Addition(postion, (short)1); // 是否还可以继续使用 //var package = UserItemPackage.Get(ContextUser.UserID); bool hasBox = UserItemHelper.IsEnoughBeiBaoItem(ContextUser.UserID, itemid, 1); bool hasKey = UserItemHelper.IsEnoughBeiBaoItem(ContextUser.UserID, itemInfo.EffectNum, 1); // 如果钥匙和宝箱的数各 >= 1 if (hasBox && hasKey) { hasNextBox = 1; } } //int useGold = 0; //if (ops == 1) //{ // //if (!DialHelper.IsDialFree(ContextUser.UserID)) // //{ // // ErrorCode = LanguageManager.GetLang().ErrorCode; // // ErrorInfo = LanguageManager.GetLang().St12004_FreeNotEnough; // // return false; // //} //} //else if (ops == 2) //{ // useGold = GameConfigSet.SweepstakesRequiredGold; // ErrorCode = ops; // ErrorInfo = string.Format(LanguageManager.GetLang().St12004_SpendSparDraw, useGold, 1); // return false; //} //else if (ops == 3) //{ // if (DialHelper.IsDialFree(ContextUser.UserID)) // { // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St12004_FreeNumEnough; // return false; // } // useGold = GameConfigSet.SweepstakesRequiredGold; // if (ContextUser.GoldNum < useGold) // { // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; // return false; // } // ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold); //} //else if (ops == 4) //{ // useGold = GameConfigSet.FiveRequiredGold; // ErrorCode = ops; // ErrorInfo = string.Format(LanguageManager.GetLang().St12004_SpendSparDraw, useGold, 5); // return false; //} //else if (ops == 5) //{ // if (DialHelper.IsDialFree(ContextUser.UserID)) // { // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St12004_FreeNumEnough; // return false; // } // useGold = GameConfigSet.FiveRequiredGold; // if (ContextUser.GoldNum < useGold) // { // ErrorCode = LanguageManager.GetLang().ErrorCode; // ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; // return false; // } // ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold); //} //ErrorCode = ops; //postion = DialHelper.DialPrizePostion(ContextUser.UserID, ops); //postion = MathUtils.Addition(postion, (short)1); return(true); }