本文整理汇总了C#中GameDataCacheSet.FindAll方法的典型用法代码示例。如果您正苦于以下问题:C# GameDataCacheSet.FindAll方法的具体用法?C# GameDataCacheSet.FindAll怎么用?C# GameDataCacheSet.FindAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameDataCacheSet
的用法示例。
在下文中一共展示了GameDataCacheSet.FindAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TakeAction
public override bool TakeAction()
{
var cacheSet = new GameDataCacheSet<UserQueue>();
List<UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);
foreach (UserQueue queue in userQueueList)
{
if (queue != null)
{
int npcCount = new ConfigCacheSet<PlotNPCInfo>().FindAll(m => m.PlotID == plotID).Count;
//战斗次数
int totalBattleNum = (int)Math.Floor((double)(queue.TotalColdTime - queue.DoRefresh()) / PlotInfo.BattleSpeedNum);
int turnsNum = totalBattleNum / npcCount;
int battleNum = totalBattleNum % npcCount;
//没发生战斗或上未通关都返还精力
//if (turnsNum == 0 || battleNum > 0)
//{
// ContextUser.EnergyNum = ContextUser.EnergyNum.Addition(PlotInfo.BattleEnergyNum, short.MaxValue);
//}
cacheSet.Delete(queue);
}
}
if (ContextUser.UserStatus == UserStatus.SaoDang)
{
ContextUser.ResetSweepPool(0);
ContextUser.UserStatus = UserStatus.Normal;
//ContextUser.Update();
}
return true;
}
示例2: SendAllowTask
/// <summary>
/// 下发任务
/// </summary>
/// <param name="user"></param>
/// <param name="taskID"></param>
public static List<UserTask> SendAllowTask(GameUser user, int taskID)
{
List<UserTask> userTaskList = new List<UserTask>();
var cacheSet = new GameDataCacheSet<UserTask>();
UserTask preTask = cacheSet.FindKey(user.UserID, taskID);
if (taskID > 0 && preTask != null && (preTask.TaskState != TaskState.Close || preTask.TaskType == TaskType.Offset))
{
return userTaskList;
}
if (taskID == 0 && cacheSet.FindAll(user.UserID, m => m.TaskType < TaskType.Daily).Count > 0)
{
return userTaskList;
}
IList<StoryTaskInfo> taskList = StoryTaskInfo.GetNextTask(taskID);
bool isSend = true;
foreach (StoryTaskInfo taskInfo in taskList)
{
if (taskInfo.CountryID != CountryType.None && user.CountryID != taskInfo.CountryID)
{
continue;
}
UserTask userTask = cacheSet.FindKey(user.UserID, taskInfo.TaskID);
if (userTask == null)
{
userTask = new UserTask
{
TaskID = taskInfo.TaskID,
UserID = user.UserID,
TaskType = taskInfo.TaskType,
TaskState = taskInfo.TaskLv <= user.UserLv ? TaskState.AllowTake : TaskState.NoTake,
CompleteNum = 0,
CreateDate = DateTime.Now
};
cacheSet.Add(userTask);
userTask = cacheSet.FindKey(user.UserID, taskInfo.TaskID);
userTaskList.Add(userTask);
}
else
{
//判断是否已下发过
isSend = false;
break;
}
}
if (isSend)
{
return userTaskList;
}
return new List<UserTask>();
}
示例3: RemovePack
/// <summary>
/// //删除不是本周,本月已领取的数据
/// </summary>
/// <param name="userID"></param>
public static void RemovePack(string userID)
{
var cacheSet = new GameDataCacheSet<PackageReceive>();
List<PackageReceive> packageReceiveArray = cacheSet.FindAll(userID, u => u.PacksType == 3 || u.PacksType == 4);
foreach (PackageReceive packageReceive in packageReceiveArray)
{
if (!PaymentService.IsCurrentWeek(packageReceive.ReceiveDate) && packageReceive.PacksType == 3)
{
cacheSet.Delete(packageReceive);
}
if (packageReceive.ReceiveDate.Month != DateTime.Now.Month && packageReceive.PacksType == 4)
{
cacheSet.Delete(packageReceive);
}
}
}
示例4: TakeAction
public override bool TakeAction()
{
var cacheSet = new GameDataCacheSet<UserQueue>();
List<UserQueue> userQueueArray = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.JingJiTiaoZhan);
if (userQueueArray.Count > 0)
{
UserQueue userQueue = userQueueArray[0];
int queueColdTime = userQueue.DoRefresh();
queueColdTime = queueColdTime < 0 ? 0 : queueColdTime;
if (ops == 1)
{
this.ErrorCode = ops;
this.ErrorInfo = GetPrice().ToString();
return false;
}
else if (ops == 2)
{
if (ContextUser.GoldNum >= GetPrice())
{
this.ErrorCode = ops;
ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GetPrice(), int.MaxValue);
//ContextUser.Update();
cacheSet.Delete(userQueue);
}
else
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
return false;
}
}
else
{
this.ErrorCode = LanguageManager.GetLang().ErrorCode;
return false;
}
}
return true;
}
示例5: GetAbility
/// <summary>
/// 佣兵属性集合
/// </summary>
/// <param name="userID"></param>
/// <param name="generalID"></param>
/// <returns></returns>
public static List<GeneralProperty> GetAbility(string userID, int generalID,UserGeneral userGeneral)
{
List<GeneralProperty> gPropertyList = new List<GeneralProperty>();
var cacheSetUserEmbattle = new GameDataCacheSet<UserEmbattle>();
GeneralProperty generalProperty = new GeneralProperty();
var userMagic = new GameDataCacheSet<UserMagic>().Find(userID, s => s.IsEnabled);
CombatGeneral combatGeneral = new CombatGeneral()
{
UserID = userID,
GeneralID = generalID,
ExtraAttack = new CombatProperty(),
ExtraDefense = new CombatProperty(),
LifeNum = userGeneral.LifeNum,
LifeMaxNum = userGeneral.LifeMaxNum
};
var userEmbattleList = cacheSetUserEmbattle.FindAll(userID,
s =>
s.MagicID == (userMagic != null ? userMagic.MagicID : 0));
UserEmbattleQueue.embattleList = userEmbattleList;
UserEmbattleQueue.KarmaAddition(userID, combatGeneral);
userGeneral.TLifeNum = combatGeneral.LifeNum;
userGeneral.TLifeMaxNun = combatGeneral.LifeMaxNum;
//int LifeReply = 0; // 生命回复
//物理攻击
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiGongJi);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue*combatGeneral.ExtraAttack.AdditionWuliNum);
gPropertyList.Add(generalProperty);
//物理防御
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiFangYu);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionWuliNum);
gPropertyList.Add(generalProperty);
//魂技攻击
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiGongJi);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionHunjiNum);
gPropertyList.Add(generalProperty);
//魂技防御
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiFangYu);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionHunjiNum);
gPropertyList.Add(generalProperty);
//魔法攻击
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaGongJi);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionMofaNum);
gPropertyList.Add(generalProperty);
//魔法防御
generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaFangYu);
generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionMofaNum);
gPropertyList.Add(generalProperty);
//暴击
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BaoJi));
//命中
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.MingZhong));
//破击
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.PoJi));
//韧性
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.RenXing));
//闪避
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.ShanBi));
//格挡
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.GeDang));
//必杀
gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BiSha));
//先攻
gPropertyList.Add(new GeneralProperty() { AbilityType = AbilityType.FirstStrike, AbilityValue = (decimal)TotalPriorityNum(userID, generalID) });
return gPropertyList;
}
示例6: UseProps
private static bool UseProps(string userID, ItemBaseInfo itemInfo)
{
var cacheSet = new GameDataCacheSet<UserProps>();
List<UserProps> propsArray = cacheSet.FindAll(userID, u => u.PropType == itemInfo.PropType);
if (itemInfo.PropType == 9 && propsArray.Count > 0)
{
int refreshNum = propsArray[0].DoRefresh();
if (refreshNum > 0)
{
return false;
}
}
bool isUsed = false;
foreach (UserProps propse in propsArray)
{
if (propse.ItemID == 7003 || propse.ItemID == 5200)
{
continue;
}
if (!isUsed && propse.ItemID == itemInfo.ItemID)
{
isUsed = true;
propse.SurplusNum += itemInfo.EffectNum;
propse.ChangeTime = DateTime.Now;
//propse.Update();
}
else
{
cacheSet.Delete(propse);
}
}
//List<UserProps> propsArray1 = new GameDataCacheSet<UserProps>().FindAll(UserProps.Index_UserID, u => u.PropType == itemInfo.PropType && u.ItemID == itemInfo.ItemID, userID);
if (!isUsed)
{
UserProps uProps = new UserProps(userID, itemInfo.ItemID)
{
SurplusNum = itemInfo.EffectNum,
ChangeTime = DateTime.Now
};
new GameDataCacheSet<UserProps>().Add(uProps, GameEnvironment.CacheUserPeriod);
}
return true;
}
示例7: TriggerWeekPack
public static void TriggerWeekPack(string userID, int gameCoin)
{
int packType = 3;
List<RechargePacks> rechargePackseArray = new ConfigCacheSet<RechargePacks>().FindAll(m => m.PacksType == packType);
foreach (RechargePacks rechargePackse in rechargePackseArray)
{
if (rechargePackse.RechargeNum <= gameCoin)
{
var packCacheSet = new GameDataCacheSet<PackageReceive>();
List<PackageReceive> packageReceivess = packCacheSet.FindAll(userID, m => m.PacksID == rechargePackse.PacksID);
if (packageReceivess.Count == 0)
{
PackageReceive receive = new PackageReceive();
receive.ReceiveID = Guid.NewGuid().ToString();
receive.PacksID = rechargePackse.PacksID;
receive.UserID = userID;
receive.IsReceive = false;
receive.ReceiveDate = DateTime.Now;
packCacheSet.Add(receive, GameEnvironment.CacheUserPeriod);
}
else if (!IsHaveWeek(packageReceivess))
{
PackageReceive receive = packageReceivess[0];
if (receive.IsReceive)
{
receive.IsReceive = false;
receive.ReceiveDate = DateTime.Now;
//receive.Update();
}
for (int i = 1; i <= packageReceivess.Count - 1; i++)
{
packCacheSet.Delete(packageReceivess[i]);
}
}
}
}
}
示例8: RemoveCharge
/// <summary>
/// 删除累计充值礼包多个,只余一个
/// </summary>
/// <param name="userID"></param>
/// <param name="packID"></param>
/// <returns></returns>
public static void RemoveCharge(string userID, int packID)
{
List<PackageReceive> packageReceiveArray = new GameDataCacheSet<PackageReceive>().FindAll(userID, m => m.PacksID == packID);
if (packageReceiveArray.Count > 1)
{
var packCacheSet = new GameDataCacheSet<PackageReceive>();
packageReceiveArray = packCacheSet.FindAll(userID, u => u.IsReceive && u.PacksID == packID);
if (packageReceiveArray.Count > 0)
{
packageReceiveArray = packCacheSet.FindAll(userID, u => !u.IsReceive && u.PacksID == packID);
foreach (PackageReceive packageReceive in packageReceiveArray)
{
packCacheSet.Delete(packageReceive);
}
}
else
{
packageReceiveArray = packCacheSet.FindAll(userID, u => !u.IsReceive && u.PacksID == packID);
for (int i = 1; i <= packageReceiveArray.Count - 1; i++)
{
packCacheSet.Delete(packageReceiveArray[i]);
}
}
}
}
示例9: GetUserLightOpen
/// <summary>
/// 命运水晶开启点亮人物
/// </summary>
public static void GetUserLightOpen(string userID)
{
var cacheSet = new GameDataCacheSet<UserLight>();
var userLightArray = cacheSet.FindAll(userID);
if (userLightArray.Count == 0)
{
AddUserLight(cacheSet, userID, 1001, 1);
AddUserLight(cacheSet, userID, 1002, 2);
AddUserLight(cacheSet, userID, 1003, 2);
AddUserLight(cacheSet, userID, 1004, 2);
AddUserLight(cacheSet, userID, 1005, 2);
}
else
{
foreach (UserLight light in userLightArray)
{
UserLight uLight = new GameDataCacheSet<UserLight>().FindKey(userID, light.HuntingID);
if (uLight == null || uLight.IsLight == 0)
{
if (uLight != null && uLight.HuntingID == 1001)
{
AddUserLight(cacheSet, userID, light.HuntingID, 1);
}
else if (uLight != null && uLight.IsLight == 0)
{
uLight.IsLight = 2;
}
else
{
AddUserLight(cacheSet, userID, light.HuntingID, 2);
}
}
}
}
}
示例10: UserGeneralPromptBlood
/// <summary>
/// 佣兵自动使用绷带补血
/// </summary>
public static void UserGeneralPromptBlood(GameUser user)
{
int subLifeNum = 0;
if (IsPromptBlood(user.UserID))
{
var userItemArray = UserItemHelper.GetItems(user.UserID).FindAll(u => u.ItemType == ItemType.BengDai && u.ItemStatus != ItemStatus.Sell);
if (userItemArray.Count > 0)
{
int itemID = userItemArray[0].ItemID;
ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemID);
var propsCacheSet = new GameDataCacheSet<UserProps>();
List<UserProps> propsArray = propsCacheSet.FindAll(user.UserID, u => u.PropType == 1);
if (propsArray.Count > 0 && propsArray[0].SurplusNum == 0)
{
foreach (UserProps userPropse in propsArray)
{
if (userPropse.SurplusNum == 0)
{
propsCacheSet.Delete(userPropse);
}
}
}
//给佣兵补血
List<UserGeneral> userGeneralArray = new GameDataCacheSet<UserGeneral>().FindAll(user.UserID, u => u.GeneralStatus == GeneralStatus.DuiWuZhong);
int effectNum = itemInfo.EffectNum;
foreach (var userGeneral in userGeneralArray)
{
int maxLifeNum = GetMaxLife(user.UserID, userGeneral.GeneralID);
if (userGeneral.LifeNum < maxLifeNum)
{
subLifeNum = MathUtils.Subtraction(maxLifeNum, userGeneral.LifeNum, 0);
userGeneral.LifeNum = MathUtils.Addition(userGeneral.LifeNum, effectNum, maxLifeNum);
//userGeneral.Update();
effectNum = MathUtils.Subtraction(effectNum, subLifeNum, 0);
}
}
UserProps props = new UserProps(user.UserID, itemInfo.ItemID)
{
SurplusNum = effectNum
};
propsCacheSet.Add(props, GameEnvironment.CacheUserPeriod);
user.IsUseupItem = false;
UserItemHelper.UseUserItem(user.UserID, itemInfo.ItemID, 1);
}
}
}
示例11: TakeAction
public override bool TakeAction()
{
List<PlotNPCInfo> plotNPCInfoList = new ConfigCacheSet<PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
npcCount = (short)plotNPCInfoList.Count;
var cacheSet = new GameDataCacheSet<UserQueue>();
List<UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);
if (userQueueList.Count > 0)
{
UserQueue userQueue = userQueueList[0];
coldTime = userQueue.DoRefresh();
if (coldTime == 0)
{
cacheSet.Delete(userQueue);
ContextUser.ResetSweepPool(0);
ContextUser.UserStatus = UserStatus.Normal;
//ContextUser.Update();
}
int tempNum = PlotHelper.GetBattleNum(userQueue.GetTiming()) + 1;
if (npcCount > 0)
{
turnsNum = PlotHelper.GetTurnsNum(npcCount, tempNum);
timesNum = PlotHelper.GetTimesNum(npcCount, tempNum);
}
//PlotHelper.CheckSweepCount(npcCount, userQueue.GetTiming(), out turnsNum, out battleNum);
//if (battleNum >= npcCount)
//{
// turnsNum = turnsNum + 1;
//}
//else
//{
// battleNum = battleNum + 1;
//}
}
userItemCount = (short)UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao).Count;
plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(plotID);
if (plotInfo == null)
{
return false;
}
foreach (PlotNPCInfo npcInfo in plotNPCInfoList)
{
if (npcInfo == null)
{
continue;
}
List<PlotEmbattleInfo> embattleInfoList = new ConfigCacheSet<PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == npcInfo.PlotNpcID);
foreach (PlotEmbattleInfo embattleInfo in embattleInfoList)
{
if (monsterDict.ContainsKey(embattleInfo.MonsterID))
{
if (monsterNumDict.ContainsKey(embattleInfo.MonsterID))
{
monsterNumDict[embattleInfo.MonsterID] = monsterNumDict[embattleInfo.MonsterID] + 1;
}
}
else
{
MonsterInfo monsterInfo = new ConfigCacheSet<MonsterInfo>().FindKey(embattleInfo.MonsterID);
if (monsterInfo != null)
{
monsterDict.Add(embattleInfo.MonsterID, monsterInfo);
monsterNumDict.Add(embattleInfo.MonsterID, 1);
}
}
}
}
return true;
}
示例12: TakeAction
public override bool TakeAction()
{
equMaxNum = ConfigEnvSet.GetInt("UserQueue.EquStrengMaxNum");
_magicMaxNum = ConfigEnvSet.GetInt("UserQueue.MagicStrengMaxNum");
equCount = ContextUser.QueueNum;
List<UserLand> landArray = new GameDataCacheSet<UserLand>().FindAll(ContextUser.UserID, u => u.IsGain == 1 || u.DoRefresh() > 0);
currPlantNum = landArray.Count;
UserPlant plant = new GameDataCacheSet<UserPlant>().FindKey(ContextUser.UserID);
if (plant != null)
{
maxPlantNum = plant.LandNum;
}
else
{
maxPlantNum = 0;
}
UserExpedition expedition = new GameDataCacheSet<UserExpedition>().FindKey(ContextUser.UserID);
if (expedition != null && DateTime.Now.Date == expedition.InsertDate.Date)
{
currExploreNum = expedition.ExpeditionNum;
}
else
{
currExploreNum = 0;
}
UserFunction function = new GameDataCacheSet<UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Meiritanxian);
if (function != null)
{
maxExploreNum = 10;
}
else
{
maxExploreNum = 0;
}
var cacheSet = new GameDataCacheSet<UserQueue>();
List<UserQueue> uQueueArray = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.EquipmentStrong);
if (uQueueArray.Count > 3)
{
for (int i = 0; i < uQueueArray.Count - 3; i++)
{
cacheSet.Delete(uQueueArray[i]);
}
}
queueArray = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, u => u.QueueType == QueueType.EquipmentStrong || u.QueueType == QueueType.MagicStrong || u.QueueType == QueueType.TianXianStrong);
queueArray.QuickSort((x, y) =>
{
if (x == null && y == null) return 0;
if (x != null && y == null) return 1;
if (x == null) return -1;
return y.Timing.CompareTo(x.Timing);
});
equOpenCount = EquStrongQueue(ContextUser.UserID);
return true;
}
示例13: TakeAction
public override bool TakeAction()
{
var cacheSet = new GameDataCacheSet<UserPlant>();
UserPlant plant = cacheSet.FindKey(ContextUser.UserID);
var landCacheSet = new GameDataCacheSet<UserLand>();
List<UserLand> landArray = landCacheSet.FindAll(ContextUser.UserID);
if (plant == null)
{
UserPlant uPlant = new UserPlant()
{
UserID = ContextUser.UserID,
LandNum = 1,
DewNum = ConfigEnvSet.GetInt("UserQueue.ShengShuiMaxNum"),
PayDewTime = 0,
};
cacheSet.Add(uPlant);
}
if (landArray.Count == 0)
{
UserLand userLand = new UserLand()
{
UserID = ContextUser.UserID,
PlantType = PlantType.Experience,
LandPositon = 1,
IsRedLand = 2,
IsBlackLand = 2,
IsGain = 2
};
landCacheSet.Add(userLand);
}
if (new GameDataCacheSet<UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.Zhongzhijingqianshu) == null)
{
isShow = 2;
}
else
{
isShow = 1;
}
userPlant = new GameDataCacheSet<UserPlant>().FindKey(ContextUser.UserID);
userLandArray = new GameDataCacheSet<UserLand>().FindAll(ContextUser.UserID);
//圣水恢复
var queueCacheSet = new GameDataCacheSet<UserQueue>();
List<UserQueue> ShengShuiQueueArray = queueCacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.ShengShuiHuiFu);
if (ShengShuiQueueArray.Count > 0)
{
UserQueue shengShuiQueue = ShengShuiQueueArray[0];
if (userPlant != null)
{
int shengshuiMaxNum = ConfigEnvSet.GetInt("UserQueue.ShengShuiMaxNum");
int restorationDate = ConfigEnvSet.GetInt("UserQueue.ShengShuiRestorationDate"); //三小时
int restorationNum = ConfigEnvSet.GetInt("UserQueue.ShengShuiRestorationNum"); //恢复1点
int timeCount = (int)(DateTime.Now - shengShuiQueue.Timing).TotalSeconds / restorationDate;
if (userPlant.DewNum < shengshuiMaxNum && timeCount > 0)
{
userPlant.DewNum = MathUtils.Addition(userPlant.DewNum, (timeCount * restorationNum), shengshuiMaxNum);
//userPlant.Update();
shengShuiQueue.Timing = DateTime.Now;
//shengShuiQueue.Update();
}
}
}
else
{
UserQueue queue = new UserQueue()
{
QueueID = Guid.NewGuid().ToString(),
UserID = ContextUser.UserID,
QueueType = QueueType.ShengShuiHuiFu,
QueueName = QueueType.ShengShuiHuiFu.ToString(),
Timing = DateTime.Now,
ColdTime = 0,
TotalColdTime = 0,
IsSuspend = false,
StrengNum = 0
};
queueCacheSet.Add(queue);
}
return true;
}
示例14: TakeAction
public override bool TakeAction()
{
ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(medicineID);
if (itemInfo == null)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
return false;
}
if (ops == 1)
{
ErrorCode = 1;
ErrorInfo = string.Format(LanguageManager.GetLang().St11415_ClearMedicine, itemInfo.ItemName, itemInfo.MedicineLv, itemInfo.EffectNum);
return false;
}
UserGeneral general = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, generalID);
if (general == null)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St10006_DoesNotExistTheGeneral;
return false;
}
var cacheSet = new GameDataCacheSet<GeneralMedicine>();
List<GeneralMedicine> generalMedicineArray = cacheSet.FindAll(ContextUser.UserID, g => g.MedicineID.Equals(medicineID) && g.GeneralID == generalID);
generalMedicineArray.QuickSort((x, y) =>
{
if (x == null && y == null) return 0;
if (x != null && y == null) return 1;
if (x == null) return -1;
return x.BaseNum.CompareTo(y.BaseNum);
});
if (generalMedicineArray.Count <= 0)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
return false;
}
if (UserHelper.IsBeiBaoFull(ContextUser))
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1415_GridNumNotEnough;
return false;
}
//UserItem[] userItemArray = UserItem.FindAll(UserItem.Index_UserID, u => (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu) && u.ItemID == itemID, ContextUser.UserID);
var package = UserItemPackage.Get(Uid);
List<UserItemInfo> userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemID == itemID);
//药剂摘除道不足
int Num = itemInfo.MedicineLv;
if (userItemArray.Count <= 0 || UserItemMedicineNum(userItemArray) < Num)
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
return false;
}
UserItemHelper.UseUserItem(ContextUser.UserID, itemID, Num);
if (RandomUtils.GetRandom() <= itemInfo.EffectNum)
{
short propertyNum = MedicinePropertyNum(ContextUser.UserID, medicineID, generalID);
switch (itemInfo.MedicineType)
{
case 1:
general.PowerNum = MathUtils.Subtraction(general.PowerNum, propertyNum);
break;
case 2:
general.SoulNum = MathUtils.Subtraction(general.SoulNum, propertyNum);
break;
case 3:
general.IntellectNum = MathUtils.Subtraction(general.IntellectNum, propertyNum);
break;
default:
general.PowerNum = general.PowerNum; ;
break;
}
//general.Update();
cacheSet.Delete(generalMedicineArray[0]);
ErrorCode = 2;
UserItemHelper.AddUserItem(ContextUser.UserID, medicineID, 1);
}
else
{
ErrorCode = LanguageManager.GetLang().ErrorCode;
ErrorInfo = LanguageManager.GetLang().St11415_Clearfail;
return false;
}
return true;
}
示例15: GetSelfAbilityEffectList
/// <summary>
/// 被动魂技效果
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static List<SelfAbilityEffect> GetSelfAbilityEffectList(string userId, short role)
{
List<SelfAbilityEffect> selfAbilityEffectList = new List<SelfAbilityEffect>();
var cacheSetUserAbility = new GameDataCacheSet<UserAbility>();
var cacheSetUserEmbattle = new GameDataCacheSet<UserEmbattle>();
var cacheSetAbilityInfo = new ConfigCacheSet<AbilityInfo>();
var userAbility = cacheSetUserAbility.FindKey(userId);
var userMagic = new GameDataCacheSet<UserMagic>().Find(userId, s => s.IsEnabled);
if (userAbility != null && userAbility.AbilityList != null)
{
var userEmbattleList = cacheSetUserEmbattle.FindAll(userId, s => s.MagicID == userMagic.MagicID);
userEmbattleList.ForEach(obj =>
{
if (obj.GeneralID > 0)
{
var abilityList =
userAbility.AbilityList.FindAll(s => s.GeneralID == obj.GeneralID);
abilityList.ForEach(ability =>
{
var abilityInfo = cacheSetAbilityInfo.FindKey(ability.AbilityID);
if (abilityInfo != null && abilityInfo.IsActive == 1)
{
SelfAbilityEffect selfAbilityEffect = new SelfAbilityEffect();
selfAbilityEffect.GeneralID = obj.GeneralID;
selfAbilityEffect.EffectID1 = abilityInfo.EffectID1;
selfAbilityEffect.FntHeadID = abilityInfo.FntHeadID;
selfAbilityEffect.IsIncrease = abilityInfo.IsIncrease;
selfAbilityEffect.Position = obj.Position;
selfAbilityEffect.Role = role;
selfAbilityEffectList.Add(selfAbilityEffect);
}
});
}
});
}
return selfAbilityEffectList;
}