Skip to content

Commit

Permalink
2.4.3.0支持导出link
Browse files Browse the repository at this point in the history
  • Loading branch information
247321453 committed May 11, 2017
1 parent 99d8163 commit 95965d1
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 24 deletions.
37 changes: 37 additions & 0 deletions DataEditorX/Core/Info/CardLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 由SharpDevelop创建。
* 用户: Administrator
* 日期: 2017/5/11
* 时间: 16:14
*
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/
using System;

namespace DataEditorX.Core.Info
{
public static class CardLink
{
/*
0x1 ↙
0x2 ↓
0x4 ↘
0x8 ←
0x20 →
0x40 ↖
0x80 ↑
0x100 ↗*/
public const int DownLeft=0x1;
public const int Down = 0x2;
public const int DownRight = 0x4;
public const int Left = 0x8;
public const int Right = 0x20;
public const int UpLeft = 0x40;
public const int Up = 0x80;
public const int UpRight = 0x100;

public static bool isLink(int marks, int mark){
return (marks & mark) == mark;
}
}
}
4 changes: 4 additions & 0 deletions DataEditorX/Core/Mse/MSECons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,9 @@ public class MseCardType
public const string CARD_SPELL = "spell card";
/// <summary>陷阱</summary>
public const string CARD_TRAP = "trap card";
/// <summary>
/// link
/// </summary>
public const string CARD_LINK = "link monster";
}
}
94 changes: 73 additions & 21 deletions DataEditorX/Core/Mse/MseMaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ public class MseMaker
public const int UNKNOWN_ATKDEF_VALUE = -2;
public const string TAG_REP_TEXT = "%text%";
public const string TAG_REP_PTEXT = "%ptext%";

public const string TAG_Link_Marker_Up = "Link Marker Up";
public const string TAG_Link_Marker_UL = "Link Marker UL";
public const string TAG_Link_Marker_UR = "Link Marker UR";
public const string TAG_Link_Marker_Down = "Link Marker Down";
public const string TAG_Link_Marker_DL = "Link Marker DL";
public const string TAG_Link_Marker_DR = "Link Marker DR";
public const string TAG_Link_Marker_Left = "Link Marker Left";
public const string TAG_Link_Marker_Right = "Link Marker Right";
public const string TAG_Link_Number = "link number";
#endregion

#region 成员,初始化
Expand Down Expand Up @@ -271,7 +281,9 @@ public string[] GetTypes(Card c)
MseCardType.CARD_NORMAL, "", "", "", "" };
if (c.IsType(CardType.TYPE_MONSTER))
{//卡片类型和第1效果
if (c.IsType(CardType.TYPE_XYZ))
if(c.IsType(CardType.TYPE_LINK)){
types[0] = MseCardType.CARD_LINK;
}else if (c.IsType(CardType.TYPE_XYZ))
{
types[0] = MseCardType.CARD_XYZ;
types[1] = GetType(CardType.TYPE_XYZ);
Expand Down Expand Up @@ -393,16 +405,27 @@ public Dictionary<Card, string> WriteSet(string file, Card[] cards,string cardpa
if (c.IsType(CardType.TYPE_SPELL) || c.IsType(CardType.TYPE_TRAP))
sw.WriteLine(getSpellTrap(c, jpg, c.IsType(CardType.TYPE_SPELL), cardpack,rarity));
else
sw.WriteLine(getMonster(c, jpg, c.IsType(CardType.TYPE_PENDULUM),cardpack,rarity));
sw.WriteLine(getMonster(c, jpg, cardpack,rarity));
}
sw.WriteLine(cfg.end);
sw.Close();
}

return list;
}
int getLinkNumber(long link){
string str = Convert.ToString(link, 2);
char[] cs = str.ToCharArray();
int i = 0;
foreach(char c in cs){
if(c == '1'){
i++;
}
}
return i;
}
//怪兽,pendulum怪兽
string getMonster(Card c, string img, bool isPendulum,CardPack cardpack=null,bool rarity=true)
string getMonster(Card c, string img,CardPack cardpack=null,bool rarity=true)
{
StringBuilder sb = new StringBuilder();
string[] types = GetTypes(c);
Expand All @@ -424,27 +447,56 @@ string getMonster(Card c, string img, bool isPendulum,CardPack cardpack=null,boo
sb.AppendLine(GetLine(TAG_RARITY, cardpack.getMseRarity()));
}
}
if (isPendulum)//P怪兽
{
string text = GetDesc(c.desc, cfg.regx_monster);
if (string.IsNullOrEmpty(text))
text = c.desc;
sb.AppendLine(" " + TAG_TEXT + ":");
//sb.AppendLine(cfg.regx_monster + ":" + cfg.regx_pendulum);
sb.AppendLine(" " + ReText(reItalic(text)));
sb.AppendLine(GetLine(TAG_PENDULUM, "medium"));
sb.AppendLine(GetLine(TAG_PSCALE1, ((c.level >> 0x18) & 0xff).ToString()));
sb.AppendLine(GetLine(TAG_PSCALE2, ((c.level >> 0x10) & 0xff).ToString()));
sb.AppendLine(" " + TAG_PEND_TEXT + ":");
sb.AppendLine(" " + ReText(reItalic(GetDesc(c.desc, cfg.regx_pendulum))));
}
else//一般怪兽
{
if(c.IsType(CardType.TYPE_LINK)){
if(CardLink.isLink(c.def, CardLink.DownLeft)){
sb.AppendLine(GetLine(TAG_Link_Marker_DL, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Down)){
sb.AppendLine(GetLine(TAG_Link_Marker_Down, "yes"));
}
if(CardLink.isLink(c.def, CardLink.DownRight)){
sb.AppendLine(GetLine(TAG_Link_Marker_DR, "yes"));
}
if(CardLink.isLink(c.def, CardLink.UpLeft)){
sb.AppendLine(GetLine(TAG_Link_Marker_UL, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Up)){
sb.AppendLine(GetLine(TAG_Link_Marker_Up, "yes"));
}
if(CardLink.isLink(c.def, CardLink.UpRight)){
sb.AppendLine(GetLine(TAG_Link_Marker_UR, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Left)){
sb.AppendLine(GetLine(TAG_Link_Marker_Left, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Right)){
sb.AppendLine(GetLine(TAG_Link_Marker_Right, "yes"));
}
sb.AppendLine(GetLine(TAG_Link_Number, ""+getLinkNumber(c.def)));
sb.AppendLine(" " + TAG_TEXT + ":");
sb.AppendLine(" " + ReText(reItalic(c.desc)));
}else{
if (c.IsType(CardType.TYPE_PENDULUM))//P怪兽
{
string text = GetDesc(c.desc, cfg.regx_monster);
if (string.IsNullOrEmpty(text))
text = c.desc;
sb.AppendLine(" " + TAG_TEXT + ":");
//sb.AppendLine(cfg.regx_monster + ":" + cfg.regx_pendulum);
sb.AppendLine(" " + ReText(reItalic(text)));
sb.AppendLine(GetLine(TAG_PENDULUM, "medium"));
sb.AppendLine(GetLine(TAG_PSCALE1, ((c.level >> 0x18) & 0xff).ToString()));
sb.AppendLine(GetLine(TAG_PSCALE2, ((c.level >> 0x10) & 0xff).ToString()));
sb.AppendLine(" " + TAG_PEND_TEXT + ":");
sb.AppendLine(" " + ReText(reItalic(GetDesc(c.desc, cfg.regx_pendulum))));
}else//一般怪兽
{
sb.AppendLine(" " + TAG_TEXT + ":");
sb.AppendLine(" " + ReText(reItalic(c.desc)));
}
sb.AppendLine(GetLine(TAG_DEF, (c.def < 0) ? UNKNOWN_ATKDEF : c.def.ToString()));
}
sb.AppendLine(GetLine(TAG_ATK, (c.atk < 0) ? UNKNOWN_ATKDEF : c.atk.ToString()));
sb.AppendLine(GetLine(TAG_DEF, (c.def < 0) ? UNKNOWN_ATKDEF : c.def.ToString()));

sb.AppendLine(GetLine(TAG_CODE, c.idString));
return sb.ToString();
Expand Down Expand Up @@ -651,7 +703,7 @@ public Card ReadCard(string content, out string img)
GetValue(content, TAG_TYPE2),
GetValue(content, TAG_TYPE3),
GetValue(content, TAG_TYPE4),
GetValue(content, TAG_TYPE5));
GetValue(content, TAG_TYPE5));
long t = GetSpellTrapType(GetValue(content, TAG_LEVEL));
//不是魔法,陷阱卡片的星数
if (!(c.IsType(CardType.TYPE_SPELL)
Expand Down
1 change: 1 addition & 0 deletions DataEditorX/DataEditorX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<Compile Include="Core\Card.cs" />
<Compile Include="Core\Info\CardAttribute.cs" />
<Compile Include="Core\CardEdit.cs" />
<Compile Include="Core\Info\CardLink.cs" />
<Compile Include="Core\Info\CardRace.cs" />
<Compile Include="Core\Info\CardRule.cs" />
<Compile Include="Core\Info\CardType.cs" />
Expand Down
2 changes: 1 addition & 1 deletion DataEditorX/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("2.4.2.5")]
[assembly: AssemblyVersion("2.4.3.0")]
2 changes: 2 additions & 0 deletions DataEditorX/changed.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
★更新历史
2.4.3.0
导出link的MSE存档
2.4.2.5
link的箭头控件
2.4.2.4
Expand Down
1 change: 1 addition & 0 deletions DataEditorX/data/mse_Chinese-Simplified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ race 0x100000 念动力族
race 0x200000 幻神兽族
race 0x400000 创造神族
race 0x800000 幻龙族
race 0x1000000 电子界族
###########################
##type
type 0x1 怪兽
Expand Down
1 change: 1 addition & 0 deletions DataEditorX/data/mse_Chinese-Traditional.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ race 0x100000 念動力族
race 0x200000 幻神獸族
race 0x400000 創造神族
race 0x800000 幻龍族
race 0x1000000 電子界族
###########################
##type
type 0x1 怪獸
Expand Down
1 change: 1 addition & 0 deletions DataEditorX/data/mse_English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ race 0x100000 Psychic
race 0x200000 Divine-Beast
race 0x400000 Creator God
race 0x800000 Wyrm
race 0x1000000 Charisma
###########################
##type
type 0x1 Monster
Expand Down
1 change: 1 addition & 0 deletions DataEditorX/data/mse_Japanese.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ race 0x100000 サイキック族
race 0x200000 幻神獣族
race 0x400000 創造神族
race 0x800000 幻竜族
race 0x1000000 電子界族
###########################
##type
type 0x1 モンスター
Expand Down
2 changes: 1 addition & 1 deletion DataEditorX/readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[DataEditorX]2.4.2.5[DataEditorX]
[DataEditorX]2.4.3.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]

★运行环境(Environment)
Expand Down
2 changes: 2 additions & 0 deletions win32/changed.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
★更新历史
2.4.3.0
导出link的MSE存档
2.4.2.5
link的箭头控件
2.4.2.4
Expand Down
2 changes: 1 addition & 1 deletion win32/readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[DataEditorX]2.4.2.5[DataEditorX]
[DataEditorX]2.4.3.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]

★运行环境(Environment)
Expand Down
Binary file modified win32/win32.zip
Binary file not shown.

0 comments on commit 95965d1

Please sign in to comment.