public static void GiveBuChang(GameClient client) { if (!BuChangManager.CanGiveBuChang()) { GameManager.LuaMgr.Error(client, GLang.GetLang(24, new object[0]), 0); } else { BuChangItem buChangItem = BuChangManager.GetBuChangItem(Global.GetUnionLevel(client, false)); if (null == buChangItem) { GameManager.LuaMgr.Error(client, GLang.GetLang(25, new object[0]), 0); } else if (!BuChangManager.HasEnoughBagSpaceForAwardGoods(client, buChangItem)) { GameManager.LuaMgr.Error(client, GLang.GetLang(26, new object[0]), 0); } else { DateTime buChangDateTime = Global.GetBuChangStartDay(); int buChangFlag = Global.GetRoleParamsInt32FromDB(client, "BuChangFlag"); if (buChangDateTime.DayOfYear == buChangFlag) { GameManager.LuaMgr.Error(client, GLang.GetLang(27, new object[0]), 0); } else { Global.SaveRoleParamsInt32ValueToDB(client, "BuChangFlag", buChangDateTime.DayOfYear, true); for (int i = 0; i < buChangItem.GoodsDataList.Count; i++) { Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, buChangItem.GoodsDataList[i].GoodsID, buChangItem.GoodsDataList[i].GCount, buChangItem.GoodsDataList[i].Quality, "", buChangItem.GoodsDataList[i].Forge_level, buChangItem.GoodsDataList[i].Binding, 0, "", true, 1, "系统补偿物品", "1900-01-01 12:00:00", buChangItem.GoodsDataList[i].AddPropIndex, buChangItem.GoodsDataList[i].BornIndex, buChangItem.GoodsDataList[i].Lucky, buChangItem.GoodsDataList[i].Strong, 0, 0, 0, null, null, 0, true); } if (buChangItem.MoJing > 0) { GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, buChangItem.MoJing, "系统补偿", false, true, false); } if (buChangItem.Experience > 0L) { GameManager.ClientMgr.ProcessRoleExperience(client, buChangItem.Experience, false, true, false, "none"); } client._IconStateMgr.CheckBuChangState(client); client._IconStateMgr.SendIconStateToClient(client); } } } }
public static bool CheckGiveBuChang(GameClient client) { bool result; if (!BuChangManager.CanGiveBuChang()) { result = false; } else { BuChangItem buChangItem = BuChangManager.GetBuChangItem(Global.GetUnionLevel(client, false)); if (null == buChangItem) { result = false; } else { DateTime buChangDateTime = Global.GetBuChangStartDay(); int buChangFlag = Global.GetRoleParamsInt32FromDB(client, "BuChangFlag"); result = (buChangDateTime.DayOfYear != buChangFlag); } } return(result); }