将一些非初始化的属性移出角色复制方法;OfferItems SQL 优化

This commit is contained in:
milimoe 2025-07-07 21:52:15 +08:00
parent 8b3d4aa0d7
commit 72d29cff5f
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
2 changed files with 37 additions and 17 deletions

View File

@ -1939,7 +1939,7 @@ namespace Milimoe.FunGame.Core.Entity
/// [ 推荐从模组中复制后使用对象 ]
/// </summary>
/// <returns></returns>
public Character Copy(bool copyEx = false)
public Character Copy(bool copyEx = false, bool copyMagic = false, bool copyItem = false)
{
Character c = new()
{
@ -1949,13 +1949,11 @@ namespace Milimoe.FunGame.Core.Entity
FirstName = FirstName,
NickName = NickName,
Profile = Profile.Copy(),
MagicType = MagicType,
FirstRoleType = FirstRoleType,
SecondRoleType = SecondRoleType,
ThirdRoleType = ThirdRoleType,
Promotion = Promotion,
PrimaryAttribute = PrimaryAttribute,
ImmuneType = ImmuneType,
Level = Level,
LevelBreak = LevelBreak,
EXP = EXP,
@ -1964,9 +1962,6 @@ namespace Milimoe.FunGame.Core.Entity
EP = EP,
InitialATK = InitialATK,
InitialDEF = InitialDEF,
MDF = MDF.Copy(),
PhysicalPenetration = PhysicalPenetration,
MagicalPenetration = MagicalPenetration,
InitialHR = InitialHR,
InitialMR = InitialMR,
ER = ER,
@ -1976,10 +1971,7 @@ namespace Milimoe.FunGame.Core.Entity
STRGrowth = STRGrowth,
AGIGrowth = AGIGrowth,
INTGrowth = INTGrowth,
InitialSPD = InitialSPD,
ATR = ATR,
Lifesteal = Lifesteal,
Shield = Shield.Copy()
InitialSPD = InitialSPD
};
if (copyEx)
{
@ -2006,18 +1998,32 @@ namespace Milimoe.FunGame.Core.Entity
c.ExCritRate = ExCritRate;
c.ExCritDMG = ExCritDMG;
c.ExEvadeRate = ExEvadeRate;
c.PhysicalPenetration = PhysicalPenetration;
c.MagicalPenetration = MagicalPenetration;
c.MDF = MDF.Copy();
c.Lifesteal = Lifesteal;
c.Shield = Shield.Copy();
c.ATR = ATR;
c.MagicType = MagicType;
c.ImmuneType = ImmuneType;
}
foreach (Skill skill in Skills)
{
Skill newskill = skill.Copy();
newskill.Character = c;
c.Skills.Add(newskill);
if (skill.SkillType != SkillType.Magic || copyMagic)
{
Skill newskill = skill.Copy();
newskill.Character = c;
c.Skills.Add(newskill);
}
}
foreach (Item item in Items)
if (copyItem)
{
Item newitem = item.Copy();
newitem.Character = c;
c.Items.Add(newitem);
foreach (Item item in Items)
{
Item newitem = item.Copy();
newitem.Character = c;
c.Items.Add(newitem);
}
}
c.Recovery();
return c;

View File

@ -65,5 +65,19 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
SQLHelper.Parameters["@OfferId"] = OfferId;
return $"{Command_Delete} {Command_From} {TableName_Backup} {Command_Where} {Column_OfferId} = @OfferId";
}
public static string Delete_OfferItemsByOfferIdAndItemGuid(SQLHelper SQLHelper, long OfferId, Guid ItemGuid)
{
SQLHelper.Parameters["@OfferId"] = OfferId;
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
return $"{Command_Delete} {Command_From} {TableName} {Command_Where} {Column_OfferId} = @OfferId {Command_And} {Column_ItemGuid} = @ItemGuid";
}
public static string Delete_OfferItemsBackupByOfferIdAndItemGuid(SQLHelper SQLHelper, long OfferId, Guid ItemGuid)
{
SQLHelper.Parameters["@OfferId"] = OfferId;
SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString();
return $"{Command_Delete} {Command_From} {TableName_Backup} {Command_Where} {Column_OfferId} = @OfferId {Command_And} {Column_ItemGuid} = @ItemGuid";
}
}
}