mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-23 12:39:35 +08:00
与库存相关的表都使用橘色和物品的 Guid (#124)
This commit is contained in:
parent
2827c53d14
commit
b01c705187
@ -1,4 +1,5 @@
|
||||
using Milimoe.FunGame.Core.Interface.Entity;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
@ -19,6 +20,11 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// </summary>
|
||||
public virtual string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 实体的当前状态(关联数据库操作)
|
||||
/// </summary>
|
||||
public EntityState EntityState { get; set; } = EntityState.Unchanged;
|
||||
|
||||
/// <summary>
|
||||
/// 比较两个实体是否相同
|
||||
/// </summary>
|
||||
|
@ -11,6 +11,11 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// </summary>
|
||||
public class Character : BaseEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一标识符
|
||||
/// </summary>
|
||||
public override Guid Guid { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// 角色的姓
|
||||
/// </summary>
|
||||
|
@ -20,6 +20,9 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
case nameof(Character.Id):
|
||||
result.Id = reader.GetInt64();
|
||||
break;
|
||||
case nameof(Character.Guid):
|
||||
result.Guid = reader.GetGuid();
|
||||
break;
|
||||
case nameof(Character.Name):
|
||||
result.Name = reader.GetString() ?? "";
|
||||
break;
|
||||
@ -230,6 +233,8 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
writer.WriteNumber(nameof(Character.Id), value.Id);
|
||||
writer.WritePropertyName(nameof(Character.Guid));
|
||||
JsonSerializer.Serialize(writer, value.Guid, options);
|
||||
writer.WriteString(nameof(Character.Name), value.Name);
|
||||
writer.WriteString(nameof(Character.FirstName), value.FirstName);
|
||||
writer.WriteString(nameof(Character.NickName), value.NickName);
|
||||
|
@ -3,6 +3,14 @@
|
||||
*/
|
||||
namespace Milimoe.FunGame.Core.Library.Constant
|
||||
{
|
||||
public enum EntityState
|
||||
{
|
||||
Unchanged,
|
||||
Added,
|
||||
Modified,
|
||||
Deleted
|
||||
}
|
||||
|
||||
public enum StartMatchState
|
||||
{
|
||||
Matching,
|
||||
|
@ -17,13 +17,7 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
|
||||
public const string Select_MarketItems = $"{Command_Select} {Command_All} {Command_From} {TableName}";
|
||||
|
||||
public static string Select_MarketItemById(SQLHelper SQLHelper, long Id)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
return $"{Select_MarketItems} {Command_Where} {Column_Id} = @Id";
|
||||
}
|
||||
|
||||
public static string Select_MarketItemsByItemId(SQLHelper SQLHelper, Guid ItemGuid)
|
||||
public static string Select_MarketItemsByItemGuid(SQLHelper SQLHelper, Guid ItemGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
return $"{Select_MarketItems} {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
@ -51,45 +45,45 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
return $"{Command_Insert} {Command_Into} {TableName} ({Column_ItemGuid}, {Column_UserId}, {Column_Price}, {Column_Status}) {Command_Values} (@ItemId, @UserId, @Price, @Status)";
|
||||
}
|
||||
|
||||
public static string Update_MarketItemPrice(SQLHelper SQLHelper, long Id, double Price)
|
||||
public static string Update_MarketItemPrice(SQLHelper SQLHelper, Guid ItemGuid, double Price)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
SQLHelper.Parameters["@Price"] = Price;
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_Price} = @Price {Command_Where} {Column_Id} = @Id";
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_Price} = @Price {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Update_MarketItemState(SQLHelper SQLHelper, long Id, MarketItemState state)
|
||||
public static string Update_MarketItemState(SQLHelper SQLHelper, Guid ItemGuid, MarketItemState state)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
SQLHelper.Parameters["@Status"] = (int)state;
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_Status} = @Status {Command_Where} {Column_Id} = @Id";
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_Status} = @Status {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Update_MarketItemBuyer(SQLHelper SQLHelper, long Id, long Buyer)
|
||||
public static string Update_Buy(SQLHelper SQLHelper, Guid ItemGuid, long Buyer)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
SQLHelper.Parameters["@Buyer"] = Buyer;
|
||||
SQLHelper.Parameters["@Status"] = (int)MarketItemState.Purchased;
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_Buyer} = @Buyer, {Column_Status} = @Status {Command_Where} {Column_Id} = @Id";
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_Buyer} = @Buyer, {Column_Status} = @Status {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Update_MarketItemFinishTime(SQLHelper SQLHelper, long Id, DateTime FinishTime)
|
||||
public static string Update_MarketItemFinishTime(SQLHelper SQLHelper, Guid ItemGuid, DateTime FinishTime)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
SQLHelper.Parameters["@FinishTime"] = FinishTime;
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_FinishTime} = @FinishTime {Command_Where} {Column_Id} = @Id";
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_FinishTime} = @FinishTime {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Delete_MarketItem(SQLHelper SQLHelper, long Id)
|
||||
public static string Delete_MarketItem(SQLHelper SQLHelper, Guid ItemGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_Id} = @Id";
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Delete_MarketItemByUserId(SQLHelper SQLHelper, long UserId)
|
||||
{
|
||||
SQLHelper.Parameters["@UserId"] = UserId;
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_Id} = @UserId";
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_UserId} = @UserId";
|
||||
}
|
||||
|
||||
public static string Select_AllMarketItems(SQLHelper SQLHelper, long UserId = 0, MarketItemState? state = null)
|
||||
|
@ -8,6 +8,7 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
public const string TableName = "UserCharacters";
|
||||
public const string Column_Id = "Id";
|
||||
public const string Column_CharacterId = "CharacterId";
|
||||
public const string Column_CharacterGuid = "CharacterGuid";
|
||||
public const string Column_UserId = "UserId";
|
||||
public const string Column_Name = "Name";
|
||||
public const string Column_FirstName = "FirstName";
|
||||
@ -30,16 +31,10 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
|
||||
public const string Select_UserCharacters = $"{Command_Select} {Command_All} {Command_From} {TableName}";
|
||||
|
||||
public static string Select_UserCharacterById(SQLHelper SQLHelper, long Id)
|
||||
public static string Select_UserCharacterByGuid(SQLHelper SQLHelper, Guid CharacterGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
return $"{Select_UserCharacters} {Command_Where} {Column_Id} = @Id";
|
||||
}
|
||||
|
||||
public static string Select_UserCharactersByCharacterId(SQLHelper SQLHelper, long CharacterId)
|
||||
{
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
return $"{Select_UserCharacters} {Command_Where} {Column_CharacterId} = @CharacterId";
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
return $"{Select_UserCharacters} {Command_Where} {Column_CharacterGuid} = @CharacterGuid";
|
||||
}
|
||||
|
||||
public static string Select_UserCharactersByUserId(SQLHelper SQLHelper, long UserId)
|
||||
@ -48,11 +43,12 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
return $"{Select_UserCharacters} {Command_Where} {Column_UserId} = @UserId";
|
||||
}
|
||||
|
||||
public static string Insert_UserCharacter(SQLHelper SQLHelper, long CharacterId, long UserId, string Name, string FirstName, string NickName,
|
||||
public static string Insert_UserCharacter(SQLHelper SQLHelper, long CharacterId, Guid CharacterGuid, long UserId, string Name, string FirstName, string NickName,
|
||||
PrimaryAttribute PrimaryAttribute, double InitialATK, double InitialDEF, double InitialHP, double InitialMP, double InitialSTR, double InitialAGI, double InitialINT,
|
||||
double InitialSPD, double InitialHR, double InitialMR, int Level, int LevelBreak, bool InSquad, DateTime? TrainingTime = null)
|
||||
{
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
SQLHelper.Parameters["@UserId"] = UserId;
|
||||
SQLHelper.Parameters["@Name"] = Name;
|
||||
SQLHelper.Parameters["@FirstName"] = FirstName;
|
||||
@ -74,24 +70,24 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
if (TrainingTime.HasValue) SQLHelper.Parameters["@TrainingTime"] = TrainingTime;
|
||||
|
||||
string sql = $"{Command_Insert} {Command_Into} {TableName} (" +
|
||||
$"{Column_CharacterId}, {Column_UserId}, {Column_Name}, {Column_FirstName}, {Column_NickName}, {Column_PrimaryAttribute}, " +
|
||||
$"{Column_CharacterId}, {Column_CharacterGuid}, {Column_UserId}, {Column_Name}, {Column_FirstName}, {Column_NickName}, {Column_PrimaryAttribute}, " +
|
||||
$"{Column_InitialATK}, {Column_InitialDEF}, {Column_InitialHP}, {Column_InitialMP}, {Column_InitialSTR}, {Column_InitialAGI}, " +
|
||||
$"{Column_InitialINT}, {Column_InitialSPD}, {Column_InitialHR}, {Column_InitialMR}, {Column_Level}, {Column_LevelBreak}, {Column_InSquad}" +
|
||||
$"{(TrainingTime.HasValue ? $", {Column_TrainingTime}" : "")}) " +
|
||||
$"{Command_Values} (" +
|
||||
$"@CharacterId, @UserId, @Name, @FirstName, @NickName, @PrimaryAttribute, " +
|
||||
$"@CharacterId, @CharacterGuid, @UserId, @Name, @FirstName, @NickName, @PrimaryAttribute, " +
|
||||
$"@InitialATK, @InitialDEF, @InitialHP, @InitialMP, @InitialSTR, @InitialAGI, " +
|
||||
$"@InitialINT, @InitialSPD, @InitialHR, @InitialMR, @Level, @LevelBreak, @InSquad" +
|
||||
$"{(TrainingTime.HasValue ? ", @TrainingTime" : "")})";
|
||||
return sql;
|
||||
}
|
||||
|
||||
public static string Update_UserCharacter(SQLHelper SQLHelper, long Id, long CharacterId, long UserId, string Name, string FirstName, string NickName,
|
||||
public static string Update_UserCharacter(SQLHelper SQLHelper, long CharacterId, Guid CharacterGuid, long UserId, string Name, string FirstName, string NickName,
|
||||
PrimaryAttribute PrimaryAttribute, double InitialATK, double InitialDEF, double InitialHP, double InitialMP, double InitialSTR, double InitialAGI, double InitialINT,
|
||||
double InitialSPD, double InitialHR, double InitialMR, int Level, int LevelBreak, bool InSquad, DateTime? TrainingTime = null)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
SQLHelper.Parameters["@UserId"] = UserId;
|
||||
SQLHelper.Parameters["@Name"] = Name;
|
||||
SQLHelper.Parameters["@FirstName"] = FirstName;
|
||||
@ -118,21 +114,21 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
$"{Column_InitialMP} = @InitialMP, {Column_InitialSTR} = @InitialSTR, {Column_InitialAGI} = @InitialAGI, {Column_InitialINT} = @InitialINT, {Column_InitialSPD} = @InitialSPD, " +
|
||||
$"{Column_InitialHR} = @InitialHR, {Column_InitialMR} = @InitialMR, {Column_Level} = @Level, {Column_LevelBreak} = @LevelBreak, {Column_InSquad} = @InSquad" +
|
||||
$"{(TrainingTime.HasValue ? $", {Column_TrainingTime} = @TrainingTime" : "")} " +
|
||||
$"{Command_Where} {Column_Id} = @Id";
|
||||
$"{Command_Where} {Column_CharacterGuid} = @CharacterGuid";
|
||||
return sql;
|
||||
}
|
||||
|
||||
public static string Update_UserCharacterSquadState(SQLHelper SQLHelper, long Id, int InSquad)
|
||||
public static string Update_UserCharacterSquadState(SQLHelper SQLHelper, Guid CharacterGuid, int InSquad)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
SQLHelper.Parameters["@InSquad"] = InSquad;
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_InSquad} = @InSquad {Command_Where} {Column_Id} = @Id";
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_InSquad} = @InSquad {Command_Where} {Column_CharacterGuid} = @CharacterGuid";
|
||||
}
|
||||
|
||||
public static string Delete_UserCharacter(SQLHelper SQLHelper, long Id)
|
||||
public static string Delete_UserCharacter(SQLHelper SQLHelper, Guid CharacterGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_Id} = @Id";
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_CharacterGuid} = @CharacterGuid";
|
||||
}
|
||||
|
||||
public static string Delete_UserCharactersByUserId(SQLHelper SQLHelper, long UserId)
|
||||
@ -141,10 +137,10 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_UserId} = @UserId";
|
||||
}
|
||||
|
||||
public static string Delete_UserCharacterByCharacterId(SQLHelper SQLHelper, long CharacterId)
|
||||
public static string Delete_UserCharacterByCharacterGuid(SQLHelper SQLHelper, Guid CharacterGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_CharacterId} = @CharacterId";
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_CharacterGuid} = @CharacterGuid";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
public const string TableName = "UserItems";
|
||||
public const string Column_Id = "Id";
|
||||
public const string Column_ItemId = "ItemId";
|
||||
public const string Column_Guid = "Guid";
|
||||
public const string Column_ItemGuid = "ItemGuid";
|
||||
public const string Column_UserId = "UserId";
|
||||
public const string Column_CharacterId = "CharacterId";
|
||||
public const string Column_CharacterGuid = "CharacterGuid";
|
||||
public const string Column_ItemName = "ItemName";
|
||||
public const string Column_IsLock = "IsLock";
|
||||
public const string Column_Equipable = "Equipable";
|
||||
@ -27,16 +27,10 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
|
||||
public const string Select_UserItems = $"{Command_Select} {Command_All} {Command_From} {TableName}";
|
||||
|
||||
public static string Select_UserItemById(SQLHelper SQLHelper, long Id)
|
||||
public static string Select_UserItemByItemGuid(SQLHelper SQLHelper, Guid ItemGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
return $"{Select_UserItems} {Command_Where} {Column_Id} = @Id";
|
||||
}
|
||||
|
||||
public static string Select_UserItemByGuid(SQLHelper SQLHelper, Guid Guid)
|
||||
{
|
||||
SQLHelper.Parameters["@Guid"] = Guid;
|
||||
return $"{Select_UserItems} {Command_Where} {Column_Guid} = @Guid";
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
return $"{Select_UserItems} {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Select_UserItemsByItemId(SQLHelper SQLHelper, long ItemId)
|
||||
@ -51,20 +45,20 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
return $"{Select_UserItems} {Command_Where} {Column_UserId} = @UserId";
|
||||
}
|
||||
|
||||
public static string Select_UserItemsByCharacterId(SQLHelper SQLHelper, long CharacterId)
|
||||
public static string Select_UserItemsByCharacterGuid(SQLHelper SQLHelper, Guid CharacterGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
return $"{Select_UserItems} {Command_Where} {Column_CharacterId} = @CharacterId";
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
return $"{Select_UserItems} {Command_Where} {Column_CharacterGuid} = @CharacterGuid";
|
||||
}
|
||||
|
||||
public static string Insert_UserItem(SQLHelper SQLHelper, long ItemId, Guid Guid, long UserId, long CharacterId, string ItemName,
|
||||
public static string Insert_UserItem(SQLHelper SQLHelper, long ItemId, Guid ItemGuid, long UserId, Guid CharacterGuid, string ItemName,
|
||||
bool IsLock, bool Equipable, bool Unequipable, EquipSlotType EquipSlotType, int Key, bool Enable, double Price, bool IsSellable, bool IsTradable,
|
||||
DateTime? NextSellableTime, DateTime? NextTradableTime, int RemainUseTimes)
|
||||
{
|
||||
SQLHelper.Parameters["@ItemId"] = ItemId;
|
||||
SQLHelper.Parameters["@Guid"] = Guid.ToString();
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
SQLHelper.Parameters["@UserId"] = UserId;
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
SQLHelper.Parameters["@ItemName"] = ItemName;
|
||||
SQLHelper.Parameters["@IsLock"] = IsLock ? 1 : 0;
|
||||
SQLHelper.Parameters["@Equipable"] = Equipable ? 1 : 0;
|
||||
@ -80,23 +74,23 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
SQLHelper.Parameters["@RemainUseTimes"] = RemainUseTimes;
|
||||
|
||||
string sql = $"{Command_Insert} {Command_Into} {TableName} " +
|
||||
$"({Column_ItemId}, {Column_Guid}, {Column_UserId}, {Column_CharacterId}, {Column_ItemName}, {Column_IsLock}, {Column_Equipable}, {Column_Unequipable}, {Column_EquipSlotType}, {Column_Key}, {Column_Enable}, {Column_Price}, {Column_IsSellable}, {Column_IsTradable}, {Column_RemainUseTimes}" +
|
||||
$"({Column_ItemId}, {Column_ItemGuid}, {Column_UserId}, {Column_CharacterGuid}, {Column_ItemName}, {Column_IsLock}, {Column_Equipable}, {Column_Unequipable}, {Column_EquipSlotType}, {Column_Key}, {Column_Enable}, {Column_Price}, {Column_IsSellable}, {Column_IsTradable}, {Column_RemainUseTimes}" +
|
||||
$"{(NextSellableTime.HasValue ? $", {Column_NextSellableTime}" : "")}" +
|
||||
$"{(NextTradableTime.HasValue ? $", {Column_NextTradableTime}" : "")}) " +
|
||||
$"{Command_Values} (@ItemId, @Guid, @UserId, @CharacterId, @ItemName, @IsLock, @Equipable, @Unequipable, @EquipSlotType, @Key, @Enable, @Price, @IsSellable, @IsTradable, @RemainUseTimes" +
|
||||
$"{Command_Values} (@ItemId, @ItemGuid, @UserId, @CharacterGuid, @ItemName, @IsLock, @Equipable, @Unequipable, @EquipSlotType, @Key, @Enable, @Price, @IsSellable, @IsTradable, @RemainUseTimes" +
|
||||
$"{(NextSellableTime.HasValue ? ", @NextSellableTime" : "")}" +
|
||||
$"{(NextTradableTime.HasValue ? ", @NextTradableTime" : "")})";
|
||||
return sql;
|
||||
}
|
||||
|
||||
public static string Update_UserItem(SQLHelper SQLHelper, long Id, long ItemId, long UserId, long CharacterId, string ItemName,
|
||||
public static string Update_UserItem(SQLHelper SQLHelper, long ItemId, Guid ItemGuid, long UserId, Guid CharacterGuid, string ItemName,
|
||||
bool IsLock, bool Equipable, bool Unequipable, EquipSlotType EquipSlotType, int Key, bool Enable, double Price, bool IsSellable, bool IsTradable,
|
||||
DateTime? NextSellableTime, DateTime? NextTradableTime, int RemainUseTimes)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@ItemId"] = ItemId;
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
SQLHelper.Parameters["@UserId"] = UserId;
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
SQLHelper.Parameters["@ItemName"] = ItemName;
|
||||
SQLHelper.Parameters["@IsLock"] = IsLock ? 1 : 0;
|
||||
SQLHelper.Parameters["@Equipable"] = Equipable ? 1 : 0;
|
||||
@ -112,64 +106,26 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
SQLHelper.Parameters["@RemainUseTimes"] = RemainUseTimes;
|
||||
|
||||
string sql = $"{Command_Update} {TableName} {Command_Set} " +
|
||||
$"{Column_ItemId} = @ItemId, {Column_UserId} = @UserId, {Column_CharacterId} = @CharacterId, {Column_ItemName} = @ItemName, " +
|
||||
$"{Column_ItemId} = @ItemId, {Column_UserId} = @UserId, {Column_CharacterGuid} = @CharacterGuid, {Column_ItemName} = @ItemName, " +
|
||||
$"{Column_IsLock} = @IsLock, {Column_Equipable} = @Equipable, {Column_Unequipable} = @Unequipable, {Column_EquipSlotType} = @EquipSlotType, " +
|
||||
$"{Column_Key} = @Key, {Column_Enable} = @Enable, {Column_Price} = @Price, {Column_IsSellable} = @IsSellable, {Column_IsTradable} = @IsTradable, {Column_RemainUseTimes} = @RemainUseTimes" +
|
||||
$"{(NextSellableTime.HasValue ? $", {Column_NextSellableTime} = @NextSellableTime" : "")}" +
|
||||
$"{(NextTradableTime.HasValue ? $", {Column_NextTradableTime} = @NextTradableTime" : "")} " +
|
||||
$"{Command_Where} {Column_Id} = @Id";
|
||||
$"{Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
return sql;
|
||||
}
|
||||
|
||||
public static string Update_UserItem(SQLHelper SQLHelper, Guid Guid, long ItemId, long UserId, long CharacterId, string ItemName,
|
||||
bool IsLock, bool Equipable, bool Unequipable, EquipSlotType EquipSlotType, int Key, bool Enable, double Price, bool IsSellable, bool IsTradable,
|
||||
DateTime? NextSellableTime, DateTime? NextTradableTime, int RemainUseTimes)
|
||||
public static string Update_UserItemLockState(SQLHelper SQLHelper, Guid ItemGuid, int IsLock)
|
||||
{
|
||||
SQLHelper.Parameters["@Guid"] = Guid.ToString();
|
||||
SQLHelper.Parameters["@ItemId"] = ItemId;
|
||||
SQLHelper.Parameters["@UserId"] = UserId;
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
SQLHelper.Parameters["@ItemName"] = ItemName;
|
||||
SQLHelper.Parameters["@IsLock"] = IsLock ? 1 : 0;
|
||||
SQLHelper.Parameters["@Equipable"] = Equipable ? 1 : 0;
|
||||
SQLHelper.Parameters["@Unequipable"] = Unequipable ? 1 : 0;
|
||||
SQLHelper.Parameters["@EquipSlotType"] = (int)EquipSlotType;
|
||||
SQLHelper.Parameters["@Key"] = Key;
|
||||
SQLHelper.Parameters["@Enable"] = Enable ? 1 : 0;
|
||||
SQLHelper.Parameters["@Price"] = Price;
|
||||
SQLHelper.Parameters["@IsSellable"] = IsSellable ? 1 : 0;
|
||||
SQLHelper.Parameters["@IsTradable"] = IsTradable ? 1 : 0;
|
||||
if (NextSellableTime.HasValue) SQLHelper.Parameters["@NextSellableTime"] = NextSellableTime;
|
||||
if (NextTradableTime.HasValue) SQLHelper.Parameters["@NextTradableTime"] = NextTradableTime;
|
||||
SQLHelper.Parameters["@RemainUseTimes"] = RemainUseTimes;
|
||||
|
||||
string sql = $"{Command_Update} {TableName} {Command_Set} " +
|
||||
$"{Column_ItemId} = @ItemId, {Column_UserId} = @UserId, {Column_CharacterId} = @CharacterId, {Column_ItemName} = @ItemName, " +
|
||||
$"{Column_IsLock} = @IsLock, {Column_Equipable} = @Equipable, {Column_Unequipable} = @Unequipable, {Column_EquipSlotType} = @EquipSlotType, " +
|
||||
$"{Column_Key} = @Key, {Column_Enable} = @Enable, {Column_Price} = @Price, {Column_IsSellable} = @IsSellable, {Column_IsTradable} = @IsTradable, {Column_RemainUseTimes} = @RemainUseTimes" +
|
||||
$"{(NextSellableTime.HasValue ? $", {Column_NextSellableTime} = @NextSellableTime" : "")}" +
|
||||
$"{(NextTradableTime.HasValue ? $", {Column_NextTradableTime} = @NextTradableTime" : "")} " +
|
||||
$"{Command_Where} {Column_Guid} = @Guid";
|
||||
return sql;
|
||||
}
|
||||
|
||||
public static string Update_UserItemLockState(SQLHelper SQLHelper, long Id, int IsLock)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
SQLHelper.Parameters["@IsLock"] = IsLock;
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_IsLock} = @IsLock {Command_Where} {Column_Id} = @Id";
|
||||
return $"{Command_Update} {TableName} {Command_Set} {Column_IsLock} = @IsLock {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Delete_UserItem(SQLHelper SQLHelper, long Id)
|
||||
public static string Delete_UserItem(SQLHelper SQLHelper, Guid ItemGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@Id"] = Id;
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_Id} = @Id";
|
||||
}
|
||||
|
||||
public static string Delete_UserItem(SQLHelper SQLHelper, Guid Guid)
|
||||
{
|
||||
SQLHelper.Parameters["@Guid"] = Guid;
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_Guid} = @Guid";
|
||||
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_ItemGuid} = @ItemGuid";
|
||||
}
|
||||
|
||||
public static string Delete_UserItemsByUserId(SQLHelper SQLHelper, long UserId)
|
||||
@ -178,10 +134,10 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_UserId} = @UserId";
|
||||
}
|
||||
|
||||
public static string Delete_UserItemByCharacterId(SQLHelper SQLHelper, long CharacterId)
|
||||
public static string Delete_UserItemByCharacterGuid(SQLHelper SQLHelper, Guid CharacterGuid)
|
||||
{
|
||||
SQLHelper.Parameters["@CharacterId"] = CharacterId;
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_CharacterId} = @CharacterId";
|
||||
SQLHelper.Parameters["@CharacterGuid"] = CharacterGuid.ToString();
|
||||
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_CharacterGuid} = @CharacterGuid";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ CREATE TABLE `MarketItems` (
|
||||
`FinishTime` datetime DEFAULT NULL,
|
||||
`Status` int(10) NOT NULL DEFAULT '0',
|
||||
`Buyer` bigint(20) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`Id`,`ItemId`,`UserId`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
@ -107,7 +107,7 @@ CREATE TABLE `OfferItems` (
|
||||
`Id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`OfferId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`UserId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`ItemGuid` varchar(255) NOT NULL DEFAULT '0',
|
||||
`ItemGuid` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
@ -119,7 +119,7 @@ CREATE TABLE `OfferItemsBackup` (
|
||||
`Id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`OfferId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`UserId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`ItemGuid` varchar(255) NOT NULL DEFAULT '0',
|
||||
`ItemGuid` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
@ -166,7 +166,7 @@ CREATE TABLE `Rooms` (
|
||||
`HasPass` int(1) NOT NULL DEFAULT '0',
|
||||
`Password` varchar(255) NOT NULL DEFAULT '',
|
||||
`MaxUsers` int(8) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`Id`,`Roomid`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
@ -209,6 +209,7 @@ DROP TABLE IF EXISTS `UserCharacters`;
|
||||
CREATE TABLE `UserCharacters` (
|
||||
`Id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`CharacterId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`CharacterGuid` varchar(255) NOT NULL DEFAULT '',
|
||||
`UserId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`Name` varchar(255) NOT NULL DEFAULT '',
|
||||
`FirstName` varchar(255) NOT NULL DEFAULT '',
|
||||
@ -228,7 +229,7 @@ CREATE TABLE `UserCharacters` (
|
||||
`LevelBreak` int(10) NOT NULL DEFAULT '0',
|
||||
`InSquad` int(1) NOT NULL DEFAULT '0',
|
||||
`TrainingTime` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`Id`,`CharacterId`,`UserId`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
@ -238,9 +239,9 @@ DROP TABLE IF EXISTS `UserItems`;
|
||||
CREATE TABLE `UserItems` (
|
||||
`Id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`ItemId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`Guid` varchar(255) NOT NULL DEFAULT '',
|
||||
`ItemGuid` varchar(255) NOT NULL DEFAULT '',
|
||||
`UserId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`CharacterId` bigint(20) NOT NULL DEFAULT '0',
|
||||
`CharacterGuid` varchar(255) NOT NULL DEFAULT '',
|
||||
`ItemName` varchar(255) NOT NULL DEFAULT '',
|
||||
`IsLock` int(1) NOT NULL DEFAULT '0',
|
||||
`Equipable` int(1) NOT NULL DEFAULT '0',
|
||||
@ -289,7 +290,7 @@ CREATE TABLE `Users` (
|
||||
`IsEnable` int(1) NOT NULL DEFAULT '1',
|
||||
`GameTime` double(20,0) NOT NULL DEFAULT '0',
|
||||
`AutoKey` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Id`,`Username`,`Email`)
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -199,6 +199,7 @@ DROP TABLE IF EXISTS "main"."UserCharacters";
|
||||
CREATE TABLE UserCharacters (
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
CharacterId INTEGER NOT NULL DEFAULT 0,
|
||||
CharacterGuid TEXT NOT NULL DEFAULT '',
|
||||
UserId INTEGER NOT NULL DEFAULT 0,
|
||||
Name TEXT NOT NULL DEFAULT '',
|
||||
FirstName TEXT NOT NULL DEFAULT '',
|
||||
@ -227,9 +228,9 @@ DROP TABLE IF EXISTS "main"."UserItems";
|
||||
CREATE TABLE UserItems (
|
||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ItemId INTEGER NOT NULL DEFAULT 0,
|
||||
Guid TEXT NOT NULL DEFAULT '',
|
||||
ItemGuid TEXT NOT NULL DEFAULT '',
|
||||
UserId INTEGER NOT NULL DEFAULT 0,
|
||||
CharacterId INTEGER NOT NULL DEFAULT 0,
|
||||
CharacterGuid TEXT NOT NULL DEFAULT '',
|
||||
ItemName TEXT NOT NULL DEFAULT '',
|
||||
IsLock INTEGER NOT NULL DEFAULT 0,
|
||||
Equipable INTEGER NOT NULL DEFAULT 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user