#pragma once // ast/npc.hpp - Structure of non-player characters (including mobs). // // Copyright © 2014 Ben Longbons // // This file is part of The Mana World (Athena server) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "fwd.hpp" #include "../compat/result.hpp" #include "../io/span.hpp" #include "../net/timer.t.hpp" #include "../sexpr/variant.hpp" #include "../mmo/clif.t.hpp" #include "../mmo/ids.hpp" #include "../mmo/strs.hpp" #include "script.hpp" #include namespace tmwa { namespace ast { namespace npc { using io::Spanned; struct Comment { RString comment; }; struct Warp { Spanned m; Spanned x, y; io::LineSpan key_span; Spanned name; Spanned xs, ys; Spanned to_m; Spanned to_x, to_y; }; struct ShopItem { Spanned name; bool value_multiply; Spanned value; }; struct Shop { Spanned m; Spanned x, y; Spanned d; io::LineSpan key_span; Spanned name; Spanned npc_class; Spanned>> items; }; struct Monster { Spanned m; Spanned x, y; Spanned xs, ys; io::LineSpan key_span; Spanned name; Spanned mob_class; Spanned num; Spanned delay1, delay2; Spanned event; }; struct MapFlag { Spanned m; io::LineSpan key_span; Spanned name; Spanned>> vec_extra; }; struct ScriptFunction { io::LineSpan key1_span; Spanned name; }; struct ScriptNone { io::LineSpan key1_span; Spanned name; io::LineSpan key4_span; }; struct ScriptMap { Spanned m; Spanned x, y; Spanned d; Spanned name; Spanned npc_class; Spanned xs, ys; }; using ScriptBase = Variant; struct Script : ScriptBase { Script() = default; Script(ScriptFunction s) : ScriptBase(std::move(s)) {} Script(ScriptNone s) : ScriptBase(std::move(s)) {} Script(ScriptMap s) : ScriptBase(std::move(s)) {} io::LineSpan key_span; ast::script::ScriptBody body; }; using TopLevelBase = Variant; struct TopLevel : TopLevelBase { TopLevel() = default; TopLevel(Comment t) : TopLevelBase(std::move(t)) {} TopLevel(Warp t) : TopLevelBase(std::move(t)) {} TopLevel(Shop t) : TopLevelBase(std::move(t)) {} TopLevel(Monster t) : TopLevelBase(std::move(t)) {} TopLevel(MapFlag t) : TopLevelBase(std::move(t)) {} TopLevel(Script t) : TopLevelBase(std::move(t)) {} io::LineSpan span; }; Option> parse_top(io::LineCharReader& in); } // namespace npc } // namespace ast } // namespace tmwa