6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
128 lines
4.1 KiB
C#
128 lines
4.1 KiB
C#
/* ==============================================================================
|
||
* 功能描述:DaoJu
|
||
* 创 建 者:徐高庆
|
||
* 创建日期:2023/4/20 15:24:28
|
||
* CLR Version :4.0.30319.42000
|
||
* ==============================================================================*/
|
||
using Newtonsoft.Json;
|
||
using System.Text;
|
||
|
||
namespace ObjectModel.User
|
||
{
|
||
/// <summary>
|
||
/// 玩家的道具 2023
|
||
/// </summary>
|
||
public class DaoJu
|
||
{
|
||
public DaoJu() { }
|
||
|
||
public DaoJu(int uid) {
|
||
this.userid=uid;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 玩家Id
|
||
/// </summary>
|
||
public int userid = 0;
|
||
/// <summary>
|
||
/// 参赛卷
|
||
/// </summary>
|
||
public int cansaij = 0;
|
||
/// <summary>
|
||
/// 门票
|
||
/// </summary>
|
||
public int menpiao = 0;
|
||
/// <summary>
|
||
/// 复活卡
|
||
/// </summary>
|
||
public int fuhuoka = 0;
|
||
/// <summary>
|
||
/// 公会令
|
||
/// </summary>
|
||
public int clubtoken = 0;
|
||
/// <summary>
|
||
/// 总公会令
|
||
/// </summary>
|
||
public int clubsupertoken = 0;
|
||
/// <summary>
|
||
/// 数据版本,暂时没有用上
|
||
/// </summary>
|
||
public int ver = 0;
|
||
|
||
/// <summary>
|
||
/// 变化值
|
||
/// </summary>
|
||
[JsonIgnore]
|
||
public int cansaijChange = 0;
|
||
[JsonIgnore]
|
||
public int menpiaoChange = 0;
|
||
[JsonIgnore]
|
||
public int fuhuokaChange = 0;
|
||
[JsonIgnore]
|
||
public int clubtokenChange = 0;
|
||
[JsonIgnore]
|
||
public int clubsupertokenChange = 0;
|
||
|
||
/// <summary>
|
||
/// 是否有数据需要保存
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public bool IsHaveSaveData()
|
||
{
|
||
return this.cansaijChange != 0 || this.fuhuokaChange != 0
|
||
|| this.clubtokenChange != 0 || this.clubsupertokenChange != 0 || this.menpiaoChange != 0;
|
||
}
|
||
|
||
public override string ToString()
|
||
{
|
||
return $"userid:{userid} canSaiJuan:{cansaij} fuhuoka:{fuhuoka} clubtoken:{clubtoken} clubsupertoken:{clubsupertoken}";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取更新SQL
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string GetUpdateSql()
|
||
{
|
||
if (!IsHaveSaveData()) return null;
|
||
StringBuilder bf = new StringBuilder();
|
||
bf.Append("update tbDaoju2023 set ");
|
||
if (this.cansaijChange != 0)
|
||
{
|
||
bf.Append($" cansaij=cansaij+{this.cansaijChange},");
|
||
}
|
||
//todo 旧门票 下个版本弃用
|
||
if (this.menpiaoChange != 0)
|
||
{
|
||
bf.Append($" menpiao=menpiao+{this.menpiaoChange},");
|
||
}
|
||
if (this.fuhuokaChange != 0)
|
||
{
|
||
bf.Append($" fuhuoka=fuhuoka+{this.fuhuokaChange},");
|
||
}
|
||
if (this.clubtokenChange != 0)
|
||
{
|
||
bf.Append($" clubtoken=clubtoken+{this.clubtokenChange},");
|
||
}
|
||
if (this.clubsupertokenChange != 0)
|
||
{
|
||
bf.Append($" clubsupertoken=clubsupertoken+{this.clubsupertokenChange},");
|
||
}
|
||
bf.Remove(bf.Length - 1, 1);
|
||
bf.Append($" where userid={this.userid}");
|
||
return bf.ToString();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取插入Sql
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string GetSaveSql()
|
||
{
|
||
//return $"insert into tbDaoju2023(userid,cansaij,fuhuoka,clubtoken,clubsupertoken) values({userid},{cansaijChange},{fuhuokaChange},{clubtokenChange},{clubsupertokenChange})";
|
||
//todo 旧门票 下个版本弃用
|
||
return $"insert into tbDaoju2023(userid,cansaij,fuhuoka,menpiao,clubtoken,clubsupertoken) values({userid},{cansaijChange},{fuhuokaChange},{menpiaoChange},{clubtokenChange},{clubsupertokenChange})";
|
||
}
|
||
}
|
||
}
|