Esempio n. 1
0
        public override void PostParse()
        {
            //Get script node using raw offset
            //This happens in post parse so that all scripts have been parsed already

            MovesetNode node = (MovesetNode)_root;

            SakuraiEntryNode e     = _root.GetEntry(RawOffset);
            bool             exist = e != null && e is Event;

            _offsetInfo = node.GetScriptLocation(RawOffset);

            Script a;

            if (_offsetInfo._list == ListValue.Null && !exist)
            {
                node.SubRoutines.Add(a = Parse <Script>(RawOffset));
            }
            else if (_offsetInfo._list != ListValue.References)
            {
                a = node.GetScript(_offsetInfo);
            }
            else
            {
                if (_externalEntry == null && _offsetInfo._index >= 0 && _offsetInfo._index < _root.ReferenceList.Count)
                {
                    _externalEntry = _root.ReferenceList[_offsetInfo._index];
                    _externalEntry.References.Add(this);
                }
                return;
            }

            if (a == null)
            {
                a = GetScript();
            }

            if (a != null)
            {
                a._actionRefs.Add(this);
            }
            else
            {
                throw new Exception("Script not found.");
            }

            _script = a;
        }
Esempio n. 2
0
        internal void LinkScript()
        {
            MovesetNode node = (MovesetNode)_root;

            SakuraiEntryNode e     = _root.GetEntry(RawOffset);
            bool             exist = e != null && e is Event;

            _offsetInfo = node.GetScriptLocation(RawOffset);

            Script a;

            if (_offsetInfo.list == ListValue.Null && !exist)
            {
                node.SubRoutines.Add(a = Parse <Script>(RawOffset));
            }
            else if (_offsetInfo.list != ListValue.References)
            {
                a = node.GetScript(_offsetInfo);
            }
            else
            {
                if (_externalEntry == null && _offsetInfo.index >= 0 && _offsetInfo.index < _root.ReferenceList.Count)
                {
                    _externalEntry = _root.ReferenceList[_offsetInfo.index];
                    _externalEntry.References.Add(this);
                }
                return;
            }

            if (a == null)
            {
                a = GetScript();
            }

            if (a != null)
            {
                a._actionRefs.Add(this);
            }
            else
            {
                throw new Exception("Script not found.");
            }

            _script = a;
        }