예제 #1
0
        void ExportGoals(BinaryWriter w)
        {
            w.Write(0);

            foreach (var kvp in m_Goals)
            {
                var goal_list = kvp.Value;
                for (int i = 0; i < goal_list.Count; ++i)
                {
                    MissionGoal goal = goal_list.Values[i];
                    if (goal is MissionGoal_Bool)
                    {
                        MissionGoal_Bool _goal = goal as MissionGoal_Bool;
                        w.Write(1);
                        w.Write(_goal.id);
                        w.Write(_goal.missionId);
                        w.Write(_goal.text);
                        w.Write(_goal.achieved);
                    }
                    else if (goal is MissionGoal_Item)
                    {
                        MissionGoal_Item _goal = goal as MissionGoal_Item;
                        w.Write(2);
                        w.Write(_goal.id);
                        w.Write(_goal.missionId);
                        w.Write(_goal.text);
                        w.Write((int)(_goal.item.type));
                        w.Write(_goal.item.Group);
                        w.Write(_goal.item.Id);
                        w.Write((int)_goal.compare);
                        w.Write(_goal.target);
                    }
                    else if (goal is MissionGoal_Kill)
                    {
                        MissionGoal_Kill _goal = goal as MissionGoal_Kill;
                        w.Write(3);
                        w.Write(_goal.id);
                        w.Write(_goal.missionId);
                        w.Write(_goal.text);
                        w.Write((int)(_goal.monster.type));
                        w.Write(_goal.monster.Group);
                        w.Write(_goal.monster.Id);
                        w.Write((int)_goal.compare);
                        w.Write(_goal.target);
                        w.Write(_goal.current);
                    }
                    else
                    {
                        w.Write(0);
                    }
                }
            }
            w.Write(-1);
        }
예제 #2
0
        void ImportGoals(BinaryReader r)
        {
            r.ReadInt32();

            FreeGoals();
            InitGoals();
            int count = 0;

            while (true)
            {
                int gcls = r.ReadInt32();
                if (gcls == 1)
                {
                    int    id        = r.ReadInt32();
                    int    missionId = r.ReadInt32();
                    string text      = r.ReadString();
                    bool   achieved  = r.ReadBoolean();
                    SetBoolGoal(id, text, missionId, achieved);
                }
                else if (gcls == 2)
                {
                    int    id        = r.ReadInt32();
                    int    missionId = r.ReadInt32();
                    string text      = r.ReadString();
                    OBJECT obj;
                    obj.type  = (OBJECT.OBJECTTYPE)r.ReadInt32();
                    obj.Group = r.ReadInt32();
                    obj.Id    = r.ReadInt32();
                    ECompare compare = (ECompare)r.ReadInt32();
                    int      target  = r.ReadInt32();
                    SetItemGoal(id, text, missionId, obj, compare, target);
                }
                else if (gcls == 3)
                {
                    int    id        = r.ReadInt32();
                    int    missionId = r.ReadInt32();
                    string text      = r.ReadString();
                    OBJECT obj;
                    obj.type  = (OBJECT.OBJECTTYPE)r.ReadInt32();
                    obj.Group = r.ReadInt32();
                    obj.Id    = r.ReadInt32();
                    ECompare compare = (ECompare)r.ReadInt32();
                    int      target  = r.ReadInt32();
                    SetKillGoal(id, text, missionId, obj, compare, target);
                    int current = r.ReadInt32();
                    if (m_Goals.ContainsKey(missionId) && m_Goals[missionId].ContainsKey(id))
                    {
                        MissionGoal g = m_Goals[missionId][id];
                        if (g != null && g as MissionGoal_Kill != null)
                        {
                            (g as MissionGoal_Kill).current = current;
                        }
                    }
                }

                if (gcls == -1)
                {
                    break;
                }
                if (++count > 1024)
                {
                    break;
                }
            }
        }