Skip to content

Commit

Permalink
修復CMS Npc載入異常問題
Browse files Browse the repository at this point in the history
  • Loading branch information
Elem8100 committed Jun 27, 2021
1 parent c438d0a commit 1ee1fb6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
7 changes: 5 additions & 2 deletions MapleStoryDB2/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,22 +1006,25 @@ void LoadNpc()
var Row = -1;
var Links = new List<(string, int)>();
Bitmap Icon = null;
var Name = "";
foreach (var Img in Arc.NpcWz.Nodes())
{
Row += 1;
var ID = Img.ImgID();
var Entry = Arc.NpcWz.GetNode(Img.Text);
if (Entry.GetNode("stand/0") != null)
if (Entry.GetNode("stand/0") != null )
Icon = Entry.GetNode("stand/0").ExtractPng2();
if (Entry.GetNode("default/0") != null)
Icon = Entry.GetNode("default/0").ExtractPng2();
var Name = Arc.StringWz.GetNode("Npc.img/" + ID.IDString()).GetValue2("name", "");
if(Arc.StringWz.GetNode("Npc.img/"+ ID.IDString()) != null)
Name = Arc.StringWz.GetNode("Npc.img/" + ID.IDString()).GetValue2("name", "");
DumpData2(Arc.StringWz.GetNode("Npc.img/" + ID.IDString()));
Grid.Rows.Add(ID, Icon, Name, "");
var Link = Arc.NpcWz.GetNode(Img.Text + "/info/link");
if (Link != null)
Links.Add((Link.Value.ToString() + ".img", Row));
}

Wz_Node Child = null;
for (int i = 0; i < Links.Count; i++)
{
Expand Down
37 changes: 19 additions & 18 deletions MapleStoryDB2/WzUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Wz.Utils
public class Arc
{
public static Wz_Structure MobWz, Mob001Wz, Mob2Wz, MapWz, Map2Wz, Map001Wz, Map002Wz, SkillWz, Skill001Wz, Skill002Wz,
CharacterWz, ItemWz, NpcWz, MorphWz, StringWz, EtcWz, ReactorWz,UIWz,SoundWz,Sound001Wz,Sound2Wz,EffectWz,BaseWz;
CharacterWz, ItemWz, NpcWz, MorphWz, StringWz, EtcWz, ReactorWz, UIWz, SoundWz, Sound001Wz, Sound2Wz, EffectWz, BaseWz;
}

public static class WzUtils
Expand All @@ -26,15 +26,18 @@ public static string IDString(this string Str)

public static string GetPathD(this Wz_Node Node)
{
Stack<string> Path = new Stack<string>();
Wz_Node ThisNode = Node;
do
if (Node != null)
{
Path.Push(ThisNode.Text);
ThisNode = ThisNode.ParentNode;
} while (ThisNode != null);
return string.Join(".", Path.ToArray());

Stack<string> Path = new Stack<string>();
Wz_Node ThisNode = Node;
do
{
Path.Push(ThisNode.Text);
ThisNode = ThisNode.ParentNode;
} while (ThisNode != null);
return string.Join(".", Path.ToArray());
}
return null;
}

public static string GetPath(this Wz_Node Node)
Expand Down Expand Up @@ -77,7 +80,7 @@ public static Wz_Node FindNodeByPathA(this Wz_Node Node, string FullPath, bool E

public static Wz_Node GetNode(this Wz_Node Node, string Path)
{
// Wz_Node Result = null;

if (Node.FindNodeByPathA(Path, true) != null)
{
if (Node.FindNodeByPathA(Path, true).Value is Wz_Uol)
Expand Down Expand Up @@ -138,6 +141,7 @@ public static bool HasNode(this Wz_Node Node, string Path)

public static Bitmap ExtractPng2(this Wz_Node Node)
{

if (Node.HasNode("_outlink"))
{
var LinkData = Node.GetNode("_outlink").Value.ToString();
Expand Down Expand Up @@ -191,25 +195,22 @@ public static Bitmap ExtractPng2(this Wz_Node Node)
{
var LinkData = Node.GetNode("_inlink").Value.ToString();
return (Node.GetNodeWzImage().Node.GetNode(LinkData).Value as Wz_Png).ExtractPng();

}
else if (Node.HasNode("source"))
{
var LinkData = Node.GetNode("source").Value.ToString();
var DestPath = Regex.Replace(LinkData, Node.GetNodeWzFile().Type.ToString() + "/", "");
return (Node.GetNodeWzFile().WzStructure.GetNode(DestPath).Value as Wz_Png).ExtractPng();

if (Node.GetNodeWzFile().WzStructure.GetNode(DestPath) != null)
return (Node.GetNodeWzFile().WzStructure.GetNode(DestPath).Value as Wz_Png).ExtractPng();
}
else
{
if (Node.Value is Wz_Uol)
return (Node.ResolveUol().Value as Wz_Png).ExtractPng();
else
return (Node.Value as Wz_Png).ExtractPng();

}


return null;
}

Expand All @@ -234,7 +235,7 @@ public static string ValueToStr(this Wz_Node Node)
return Node.GetValueEx<string>("");

}

public static string RightStr(string s, int count)
{
if (count > s.Length)
Expand All @@ -243,7 +244,7 @@ public static string RightStr(string s, int count)
}




}

Expand All @@ -262,7 +263,7 @@ public static bool HasNode(this Wz_Structure Wz, string Path)

}
public static WzComparerR2.WzLib.Wz_Node.WzNodeCollection Nodes(this Wz_Structure Self)
{
{
return Self.WzNode.Nodes;

}
Expand Down

6 comments on commit 1ee1fb6

@a25296986
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

板組 請問我是V189 目前腳本NPC 問題

@a25296986
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

還有傳送 發送道具都無效只有幾個能

@a25296986
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

職業很多BUG新手任務 還有就是連線問 同一個頻道會斷線 是否你能幫個忙解決3X連線也怪怪的

@a25296986
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

寵物坐騎都無法正常 請求大師 幫忙

@a25296986
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有賴或是DC 再麻煩你留言給我
我的是sky28867賴

@Elem8100
Copy link
Owner Author

@Elem8100 Elem8100 commented on 1ee1fb6 Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我不搞私服的, 無法幫你

Please sign in to comment.