Commit 5bdb2bd3 authored by 神楽坂玲奈's avatar 神楽坂玲奈

default card info

parent 3af06c9b
...@@ -19,19 +19,19 @@ namespace YGOSharp ...@@ -19,19 +19,19 @@ namespace YGOSharp
internal static void initialize(string databaseFullPath) internal static void initialize(string databaseFullPath)
{ {
nullName = InterString.Get("未知卡片"); nullName = InterString.Get("未知卡片");
nullString = ""; nullString = @"欢迎使用 YGOPro2
nullString += "欢迎使用 YGOPro2";
nullString += "\r\n\r\n"; 玩家社区:
nullString += "官方网站:"; [url=https://ygobbs.com/][u]https://ygobbs.com/[/u][/url]
nullString += "\r\n";
nullString += "[url=https://ygopro2.lofter.com/][u]https://ygopro2.lofter.com/[/u][/url]"; 玩家交流群:
nullString += "\r\n\r\n"; 214167219";
nullString += "公测玩家交流群:\r\n[url=https://jq.qq.com/?_wv=1027&k=O1xapcRQ][u]966380039[/u][/url]";
using (SqliteConnection connection = new SqliteConnection("Data Source=" + databaseFullPath)) using (SqliteConnection connection = new SqliteConnection("Data Source=" + databaseFullPath))
{ {
connection.Open(); connection.Open();
using (IDbCommand command = new SqliteCommand("SELECT datas.*, texts.* FROM datas,texts WHERE datas.id=texts.id;", connection)) using (IDbCommand command =
new SqliteCommand("SELECT datas.*, texts.* FROM datas,texts WHERE datas.id=texts.id;", connection))
{ {
using (IDataReader reader = command.ExecuteReader()) using (IDataReader reader = command.ExecuteReader())
{ {
...@@ -71,11 +71,13 @@ namespace YGOSharp ...@@ -71,11 +71,13 @@ namespace YGOSharp
break; break;
} }
} }
if (returnValue == null) if (returnValue == null)
{ {
returnValue = new Card(); returnValue = new Card();
} }
} }
return returnValue; return returnValue;
} }
...@@ -124,10 +126,10 @@ namespace YGOSharp ...@@ -124,10 +126,10 @@ namespace YGOSharp
foreach (var item in _cards) foreach (var item in _cards)
{ {
Card card = item.Value; Card card = item.Value;
if ((card.Type & (uint)CardType.Token) == 0) if ((card.Type & (uint) CardType.Token) == 0)
{ {
if (getName == "" if (getName == ""
|| Regex.Replace(card.Name, getName,"miaowu", RegexOptions.IgnoreCase) != card.Name || Regex.Replace(card.Name, getName, "miaowu", RegexOptions.IgnoreCase) != card.Name
|| Regex.Replace(card.Desc, getName, "miaowu", RegexOptions.IgnoreCase) != card.Desc || Regex.Replace(card.Desc, getName, "miaowu", RegexOptions.IgnoreCase) != card.Desc
|| Regex.Replace(card.strSetName, getName, "miaowu", RegexOptions.IgnoreCase) != card.strSetName || Regex.Replace(card.strSetName, getName, "miaowu", RegexOptions.IgnoreCase) != card.strSetName
|| card.Id.ToString() == getName || card.Id.ToString() == getName
...@@ -135,14 +137,16 @@ namespace YGOSharp ...@@ -135,14 +137,16 @@ namespace YGOSharp
{ {
if (((card.Type & getTypeFilter) == getTypeFilter || getTypeFilter == 0) if (((card.Type & getTypeFilter) == getTypeFilter || getTypeFilter == 0)
&& ((card.Type == getTypeFilter2 && ((card.Type == getTypeFilter2
|| getTypeFilter == (UInt32)CardType.Monster) && (card.Type & getTypeFilter2) == getTypeFilter2 || getTypeFilter == (UInt32) CardType.Monster) &&
(card.Type & getTypeFilter2) == getTypeFilter2
|| getTypeFilter2 == 0)) || getTypeFilter2 == 0))
{ {
if ((card.Race & getRaceFilter) >0 || getRaceFilter == 0) if ((card.Race & getRaceFilter) > 0 || getRaceFilter == 0)
{ {
if ((card.Attribute & getAttributeFilter) > 0 || getAttributeFilter == 0) if ((card.Attribute & getAttributeFilter) > 0 || getAttributeFilter == 0)
{ {
if (((card.Category & getCatagoryFilter))== getCatagoryFilter || getCatagoryFilter == 0) if (((card.Category & getCatagoryFilter)) == getCatagoryFilter ||
getCatagoryFilter == 0)
{ {
if (judgeint(getAttack, getAttack_UP, card.Attack)) if (judgeint(getAttack, getAttack_UP, card.Attack))
{ {
...@@ -154,7 +158,8 @@ namespace YGOSharp ...@@ -154,7 +158,8 @@ namespace YGOSharp
{ {
if (judgeint(getYear, getYear_UP, card.year)) if (judgeint(getYear, getYear_UP, card.year))
{ {
if (getBAN == -233 || banlist == null || banlist.GetQuantity(card.Id) == getBAN) if (getBAN == -233 || banlist == null ||
banlist.GetQuantity(card.Id) == getBAN)
{ {
if (getOT == -233 || getOT == card.Ot) if (getOT == -233 || getOT == card.Ot)
{ {
...@@ -176,6 +181,7 @@ namespace YGOSharp ...@@ -176,6 +181,7 @@ namespace YGOSharp
} }
} }
} }
nameInSearch = getName; nameInSearch = getName;
returnValue.Sort(comparisonOfCard()); returnValue.Sort(comparisonOfCard());
nameInSearch = ""; nameInSearch = "";
...@@ -191,18 +197,22 @@ namespace YGOSharp ...@@ -191,18 +197,22 @@ namespace YGOSharp
{ {
re = true; re = true;
} }
if (min == -233 && max != -233) if (min == -233 && max != -233)
{ {
re = max == raw; re = max == raw;
} }
if (min != -233 && max == -233) if (min != -233 && max == -233)
{ {
re = min == raw; re = min == raw;
} }
if (min != -233 && max != -233) if (min != -233 && max != -233)
{ {
re = min <= raw && raw <= max; re = min <= raw && raw <= max;
} }
return re; return re;
} }
...@@ -222,12 +232,13 @@ namespace YGOSharp ...@@ -222,12 +232,13 @@ namespace YGOSharp
|| card.Id.ToString() == getName || card.Id.ToString() == getName
) )
{ {
if (getsearchCode.Count == 0|| is_declarable(card, getsearchCode)) if (getsearchCode.Count == 0 || is_declarable(card, getsearchCode))
{ {
returnValue.Add(card); returnValue.Add(card);
} }
} }
} }
nameInSearch = getName; nameInSearch = getName;
returnValue.Sort(comparisonOfCard()); returnValue.Sort(comparisonOfCard());
nameInSearch = ""; nameInSearch = "";
...@@ -241,39 +252,43 @@ namespace YGOSharp ...@@ -241,39 +252,43 @@ namespace YGOSharp
{ {
switch (getsearchCode[i]) switch (getsearchCode[i])
{ {
case (int)searchCode.OPCODE_ADD: case (int) searchCode.OPCODE_ADD:
if (stack.Count >= 2) if (stack.Count >= 2)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
int lhs = stack.Pop(); int lhs = stack.Pop();
stack.Push(lhs + rhs); stack.Push(lhs + rhs);
} }
break; break;
case (int)searchCode.OPCODE_SUB: case (int) searchCode.OPCODE_SUB:
if (stack.Count >= 2) if (stack.Count >= 2)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
int lhs = stack.Pop(); int lhs = stack.Pop();
stack.Push(lhs - rhs); stack.Push(lhs - rhs);
} }
break; break;
case (int)searchCode.OPCODE_MUL: case (int) searchCode.OPCODE_MUL:
if (stack.Count >= 2) if (stack.Count >= 2)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
int lhs = stack.Pop(); int lhs = stack.Pop();
stack.Push(lhs * rhs); stack.Push(lhs * rhs);
} }
break; break;
case (int)searchCode.OPCODE_DIV: case (int) searchCode.OPCODE_DIV:
if (stack.Count >= 2) if (stack.Count >= 2)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
int lhs = stack.Pop(); int lhs = stack.Pop();
stack.Push(lhs / rhs); stack.Push(lhs / rhs);
} }
break; break;
case (int)searchCode.OPCODE_AND: case (int) searchCode.OPCODE_AND:
if (stack.Count >= 2) if (stack.Count >= 2)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
...@@ -289,8 +304,9 @@ namespace YGOSharp ...@@ -289,8 +304,9 @@ namespace YGOSharp
stack.Push(0); stack.Push(0);
} }
} }
break; break;
case (int)searchCode.OPCODE_OR: case (int) searchCode.OPCODE_OR:
if (stack.Count >= 2) if (stack.Count >= 2)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
...@@ -306,15 +322,17 @@ namespace YGOSharp ...@@ -306,15 +322,17 @@ namespace YGOSharp
stack.Push(0); stack.Push(0);
} }
} }
break; break;
case (int)searchCode.OPCODE_NEG: case (int) searchCode.OPCODE_NEG:
if (stack.Count >= 1) if (stack.Count >= 1)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
stack.Push(-rhs); stack.Push(-rhs);
} }
break; break;
case (int)searchCode.OPCODE_NOT: case (int) searchCode.OPCODE_NOT:
if (stack.Count >= 1) if (stack.Count >= 1)
{ {
int rhs = stack.Pop(); int rhs = stack.Pop();
...@@ -328,8 +346,9 @@ namespace YGOSharp ...@@ -328,8 +346,9 @@ namespace YGOSharp
stack.Push(1); stack.Push(1);
} }
} }
break; break;
case (int)searchCode.OPCODE_ISCODE: case (int) searchCode.OPCODE_ISCODE:
if (stack.Count >= 1) if (stack.Count >= 1)
{ {
int code = stack.Pop(); int code = stack.Pop();
...@@ -343,8 +362,9 @@ namespace YGOSharp ...@@ -343,8 +362,9 @@ namespace YGOSharp
stack.Push(0); stack.Push(0);
} }
} }
break; break;
case (int)searchCode.OPCODE_ISSETCARD: case (int) searchCode.OPCODE_ISSETCARD:
if (stack.Count >= 1) if (stack.Count >= 1)
{ {
if (IfSetCard(stack.Pop(), card.Setcode)) if (IfSetCard(stack.Pop(), card.Setcode))
...@@ -356,8 +376,9 @@ namespace YGOSharp ...@@ -356,8 +376,9 @@ namespace YGOSharp
stack.Push(0); stack.Push(0);
} }
} }
break; break;
case (int)searchCode.OPCODE_ISTYPE: case (int) searchCode.OPCODE_ISTYPE:
if (stack.Count >= 1) if (stack.Count >= 1)
{ {
if ((stack.Pop() & card.Type) > 0) if ((stack.Pop() & card.Type) > 0)
...@@ -369,8 +390,9 @@ namespace YGOSharp ...@@ -369,8 +390,9 @@ namespace YGOSharp
stack.Push(0); stack.Push(0);
} }
} }
break; break;
case (int)searchCode.OPCODE_ISRACE: case (int) searchCode.OPCODE_ISRACE:
if (stack.Count >= 1) if (stack.Count >= 1)
{ {
if ((stack.Pop() & card.Race) > 0) if ((stack.Pop() & card.Race) > 0)
...@@ -382,8 +404,9 @@ namespace YGOSharp ...@@ -382,8 +404,9 @@ namespace YGOSharp
stack.Push(0); stack.Push(0);
} }
} }
break; break;
case (int)searchCode.OPCODE_ISATTRIBUTE: case (int) searchCode.OPCODE_ISATTRIBUTE:
if (stack.Count >= 1) if (stack.Count >= 1)
{ {
if ((stack.Pop() & card.Attribute) > 0) if ((stack.Pop() & card.Attribute) > 0)
...@@ -395,22 +418,24 @@ namespace YGOSharp ...@@ -395,22 +418,24 @@ namespace YGOSharp
stack.Push(0); stack.Push(0);
} }
} }
break; break;
default: default:
stack.Push(getsearchCode[i]); stack.Push(getsearchCode[i]);
break; break;
} }
} }
if (stack.Count != 1 || stack.Pop() == 0) if (stack.Count != 1 || stack.Pop() == 0)
return false; return false;
return return
card.Id == (int)TwoNameCards.CARD_MARINE_DOLPHIN card.Id == (int) TwoNameCards.CARD_MARINE_DOLPHIN
|| ||
card.Id == (int)TwoNameCards.CARD_TWINKLE_MOSS card.Id == (int) TwoNameCards.CARD_TWINKLE_MOSS
|| ||
(!(card.Alias != 0) (!(card.Alias != 0)
&& ((card.Type & ((int)CardType.Monster + (int)CardType.Token))) && ((card.Type & ((int) CardType.Monster + (int) CardType.Token)))
!= ((int)CardType.Monster + (int)CardType.Token)); != ((int) CardType.Monster + (int) CardType.Token));
} }
public static bool IfSetCard(int setCodeToAnalyse, long setCodeFromCard) public static bool IfSetCard(int setCodeToAnalyse, long setCodeFromCard)
...@@ -530,10 +555,10 @@ namespace YGOSharp ...@@ -530,10 +555,10 @@ namespace YGOSharp
} }
} }
} }
return a; return a;
}; };
} }
} }
internal static class PacksManager internal static class PacksManager
...@@ -564,7 +589,7 @@ namespace YGOSharp ...@@ -564,7 +589,7 @@ namespace YGOSharp
{ {
try try
{ {
int Id = (int)reader.GetInt64(0); int Id = (int) reader.GetInt64(0);
Card c = CardsManager.GetCardRaw(Id); Card c = CardsManager.GetCardRaw(Id);
if (c != null) if (c != null)
{ {
...@@ -579,6 +604,7 @@ namespace YGOSharp ...@@ -579,6 +604,7 @@ namespace YGOSharp
c.day = int.Parse(mats[1]); c.day = int.Parse(mats[1]);
c.year = int.Parse(mats[2]); c.year = int.Parse(mats[2]);
} }
if (!pacDic.ContainsKey(c.packFullName)) if (!pacDic.ContainsKey(c.packFullName))
{ {
pacDic.Add(c.packFullName, c.packShortNam); pacDic.Add(c.packFullName, c.packShortNam);
...@@ -594,7 +620,6 @@ namespace YGOSharp ...@@ -594,7 +620,6 @@ namespace YGOSharp
} }
catch (Exception) catch (Exception)
{ {
} }
} }
} }
...@@ -604,34 +629,40 @@ namespace YGOSharp ...@@ -604,34 +629,40 @@ namespace YGOSharp
internal static void initializeSec() internal static void initializeSec()
{ {
packs.Sort((left, right) => { packs.Sort((left, right) =>
{
if (left.year > right.year) if (left.year > right.year)
{ {
return -1; return -1;
} }
if (left.year < right.year) if (left.year < right.year)
{ {
return 1; return 1;
} }
if (left.month > right.month) if (left.month > right.month)
{ {
return -1; return -1;
} }
if (left.month < right.month) if (left.month < right.month)
{ {
return 1; return 1;
} }
if (left.day > right.day) if (left.day > right.day)
{ {
return -1; return -1;
} }
if (left.day < right.day) if (left.day < right.day)
{ {
return 1; return 1;
} }
return 1; return 1;
}); });
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment