private string SpreadSign(GameClient client) { lock (client.ClientData.LockSpread) { string result = "{0}:{1}"; SpreadData data = GetSpreadInfo(client); if (!data.IsOpen) { return(string.Format(result, (int)ESpreadState.ENoOpen, "")); } if (!string.IsNullOrEmpty(data.SpreadCode)) { return(string.Format(result, (int)ESpreadState.ESpreadIsSign, "")); } string spreadCode = GetSpreadCode(client); bool isCheck = HSpreadSign(client); if (!isCheck) { return(string.Format(result, (int)ESpreadState.ESpreadIsSign, "")); } else { data.SpreadCode = spreadCode; Global.UpdateRoleParamByName(client, RoleParamName.SpreadCode, spreadCode, true); } return(string.Format(result, (int)ESpreadState.Success, spreadCode)); } }
public void SpreadSetCount(GameClient client, int[] counts) { SpreadData data = GetSpreadInfo(client); data.CountRole = counts[0]; data.CountVip = Math.Min(counts[1], _vipCountMax); data.CountLevel = Math.Min(counts[2], _levelCountMax); client.ClientData.MySpreadData = data; }
private SpreadData GetSpreadInfo(GameClient client) { lock (client.ClientData.LockSpread) { SpreadData data = client.ClientData.MySpreadData; if (data != null) { data.State = 0; } if (IsSpreadOpen() != data.IsOpen) { initRoleSpreadData(client); } return(client.ClientData.MySpreadData); } }
private SpreadData SpreadAward(GameClient client, int awardType) { lock (client.ClientData.LockSpread) { SpreadData data = GetSpreadInfo(client); if (!data.IsOpen) { data.State = (int)ESpreadState.ENoOpen; return(data); } ESpreadState resultType = ESpreadState.Default; switch (awardType) { case (int)ESpreadAward.Vip: resultType = AwardOne(client, data, awardType, _awardVipInfo, data.CountVip); break; case (int)ESpreadAward.Level: resultType = AwardOne(client, data, awardType, _awardLevelInfo, data.CountLevel); break; case (int)ESpreadAward.Count: resultType = AwardCount(client, data); break; case (int)ESpreadAward.Verify: resultType = AwardOne(client, data, awardType, _awardVerifyInfo, 1); break; } if (resultType != ESpreadState.Success) { data.State = (int)resultType; } return(client.ClientData.MySpreadData); } }
public bool ProcessSpreadAwardCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams) { try { bool isCheck = CheckHelper.CheckCmdLength(client, nID, cmdParams, 1); if (!isCheck) { return(false); } int awardType = Convert.ToInt32(cmdParams[0]); SpreadData data = SpreadAward(client, awardType); client.sendCmd(nID, data); return(true); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false); } return(false); }