/// <summary> /// 发放时限性物品 /// </summary> /// <param name="client"></param> /// <param name="item"></param> /// <param name="type"></param> /// <returns></returns> public bool GiveEffectiveTimeAward(GameClient client, AwardItem item, ESevenDayActType type) { if (null == client || null == item) { return(false); } if (item.GoodsDataList != null) { for (int i = 0; i < item.GoodsDataList.Count; i++) { int nGoodsID = item.GoodsDataList[i].GoodsID; // 物品id if (Global.IsCanGiveRewardByOccupation(client, nGoodsID)) { //添加限时物品 Global.AddEffectiveTimeGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, item.GoodsDataList[i].GoodsID, item.GoodsDataList[i].GCount, item.GoodsDataList[i].Quality, "", item.GoodsDataList[i].Forge_level, item.GoodsDataList[i].Binding, 0, "", false, 1, GetActivityChineseName((ESevenDayActType)type), item.GoodsDataList[i].Starttime, item.GoodsDataList[i].Endtime, item.GoodsDataList[i].AddPropIndex, item.GoodsDataList[i].BornIndex, item.GoodsDataList[i].Lucky, item.GoodsDataList[i].Strong, item.GoodsDataList[i].ExcellenceInfo, item.GoodsDataList[i].AppendPropLev, item.GoodsDataList[i].ChangeLifeLevForEquip); } } } return(true); }
/// <summary> /// 获取某项七日活动数据 /// </summary> /// <param name="client"></param> /// <param name="actType"></param> /// <returns></returns> public Dictionary <int, SevenDayItemData> GetActivityData(GameClient client, ESevenDayActType actType) { // 如果1.8的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot8)) { return(null); } if (client == null) { return(null); } Dictionary <int, SevenDayItemData> resultDict = null; lock (client.ClientData.SevenDayActDict) { if (!client.ClientData.SevenDayActDict.TryGetValue((int)actType, out resultDict)) { resultDict = new Dictionary <int, SevenDayItemData>(); client.ClientData.SevenDayActDict[(int)actType] = resultDict; } } return(resultDict); }
public bool GiveAward(GameClient client, AwardItem item, ESevenDayActType type) { bool result; if (client == null || null == item) { result = false; } else { if (item.GoodsDataList != null) { for (int i = 0; i < item.GoodsDataList.Count; i++) { int nGoodsID = item.GoodsDataList[i].GoodsID; if (Global.IsCanGiveRewardByOccupation(client, nGoodsID)) { Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, item.GoodsDataList[i].GoodsID, item.GoodsDataList[i].GCount, item.GoodsDataList[i].Quality, "", item.GoodsDataList[i].Forge_level, item.GoodsDataList[i].Binding, 0, "", true, 1, this.GetActivityChineseName(type), "1900-01-01 12:00:00", item.GoodsDataList[i].AddPropIndex, item.GoodsDataList[i].BornIndex, item.GoodsDataList[i].Lucky, item.GoodsDataList[i].Strong, item.GoodsDataList[i].ExcellenceInfo, item.GoodsDataList[i].AppendPropLev, item.GoodsDataList[i].ChangeLifeLevForEquip, null, null, 0, true); } } } result = true; } return(result); }
/// <summary> /// 更新db /// </summary> public bool UpdateDb(int roleid, ESevenDayActType actType, int id, SevenDayItemData itemData, int serverId) { SevenDayUpdateDbData updateData = new SevenDayUpdateDbData(); updateData.RoleId = roleid; updateData.ActivityType = (int)actType; updateData.Id = id; updateData.Data = itemData; if (!Global.sendToDB <bool, SevenDayUpdateDbData>((int)TCPGameServerCmds.CMD_DB_UPDATE_SEVEN_DAY_ITEM_DATA, updateData, serverId)) { LogManager.WriteLog(LogTypes.Error, string.Format("七日活动更新玩家数据失败, roleid={0}, act={1}, id={2}", roleid, actType, id)); return(false); } return(true); }
public bool UpdateDb(int roleid, ESevenDayActType actType, int id, SevenDayItemData itemData, int serverId) { bool result; if (!Global.sendToDB <bool, SevenDayUpdateDbData>(13220, new SevenDayUpdateDbData { RoleId = roleid, ActivityType = (int)actType, Id = id, Data = itemData }, serverId)) { LogManager.WriteLog(LogTypes.Error, string.Format("七日活动更新玩家数据失败, roleid={0}, act={1}, id={2}", roleid, actType, id), null, true); result = false; } else { result = true; } return(result); }
public string GetActivityChineseName(ESevenDayActType type) { string name = type.ToString(); if (type == ESevenDayActType.Login) { name = "七日登录"; } else if (type == ESevenDayActType.Charge) { name = "七日充值"; } else if (type == ESevenDayActType.Goal) { name = "七日目标"; } else if (type == ESevenDayActType.Buy) { name = "七日抢购"; } return(name); }