diff options
Diffstat (limited to 'src/map/map.hpp')
-rw-r--r-- | src/map/map.hpp | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/src/map/map.hpp b/src/map/map.hpp index 47eef57..7732af9 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -77,6 +77,13 @@ struct block_list short bl_x, bl_y; BL bl_type; + // register keys are ints (interned) + // Not anymore! Well, sort of. + DMap<SIR, int> regm; + // can't be DMap because we want predictable .c_str()s + // TODO this can change now + Map<SIR, RString> regstrm; + // This deletes the copy-ctor also // TODO give proper ctors. block_list& operator = (block_list&&) = delete; @@ -89,13 +96,11 @@ private: dumb_ptr<npc_data> as_npc(); dumb_ptr<mob_data> as_mob(); dumb_ptr<flooritem_data> as_item(); - dumb_ptr<magic::invocation> as_spell(); public: dumb_ptr<map_session_data> is_player(); dumb_ptr<npc_data> is_npc(); dumb_ptr<mob_data> is_mob(); dumb_ptr<flooritem_data> is_item(); - dumb_ptr<magic::invocation> is_spell(); }; struct walkpath_data @@ -107,7 +112,6 @@ struct status_change { Timer timer; int val1; - BlockId spell_invocation; /* [Fate] If triggered by a spell, record here */ }; struct quick_regeneration @@ -141,9 +145,9 @@ struct map_session_data : block_list, SessionData unsigned shroud_hides_name_talking:1; unsigned shroud_disappears_on_pickup:1; unsigned shroud_disappears_on_talk:1; - unsigned seen_motd:1; unsigned pvpchannel; unsigned pvp_rank; + unsigned npc_dialog_mes:1; } state; struct { @@ -205,9 +209,9 @@ struct map_session_data : block_list, SessionData // used by @hugo and @linus BlockId followtarget; - tick_t cast_tick; // [Fate] Next tick at which spellcasting is allowed - dumb_ptr<magic::invocation> active_spells; // [Fate] Singly-linked list of active spells linked to this PC + //tick_t cast_tick; // [Fate] Next tick at which spellcasting is allowed BlockId attack_spell_override; // [Fate] When an attack spell is active for this player, they trigger it + NpcEvent magic_attack; // like a weapon. Check pc_attack_timer() for details. // Weapon equipment slot (slot 4) item override StatusChange attack_spell_icon_override; @@ -254,13 +258,6 @@ struct map_session_data : block_list, SessionData int die_counter; - // register keys are ints (interned) - // Not anymore! Well, sort of. - DMap<SIR, int> regm; - // can't be DMap because we want predictable .c_str()s - // TODO this can change now - Map<SIR, RString> regstrm; - earray<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; AccountId trade_partner; @@ -343,12 +340,10 @@ private: dumb_ptr<npc_data_script> as_script(); dumb_ptr<npc_data_shop> as_shop(); dumb_ptr<npc_data_warp> as_warp(); - dumb_ptr<npc_data_message> as_message(); public: dumb_ptr<npc_data_script> is_script(); dumb_ptr<npc_data_shop> is_shop(); dumb_ptr<npc_data_warp> is_warp(); - dumb_ptr<npc_data_message> is_message(); }; class npc_data_script : public npc_data @@ -362,6 +357,9 @@ public: short xs, ys; bool event_needs_map; + // the npc containing the actual script + BlockId parent; + // Whether the timer advances if not beyond end. bool timer_active; // Tick counter through the timers. @@ -400,12 +398,6 @@ public: } warp; }; -class npc_data_message : public npc_data -{ -public: - RString message; -}; - constexpr int MOB_XP_BONUS_BASE = 1024; constexpr int MOB_XP_BONUS_SHIFT = 10; @@ -479,6 +471,9 @@ struct mob_data : block_list // [Fate] mob-specific stats earray<unsigned short, mob_stat, mob_stat::LAST> stats; short size; + // Npc Runscripts + std::list<RString> eventqueuel; + Array<Timer, MAX_EVENTTIMER> eventtimer; }; struct BlockLists @@ -635,13 +630,6 @@ dumb_ptr<flooritem_data> map_id_is_item(BlockId id) dumb_ptr<block_list> bl = map_id2bl(id); return bl ? bl->is_item() : nullptr; } -inline -dumb_ptr<magic::invocation> map_id_is_spell(BlockId id) -{ - dumb_ptr<block_list> bl = map_id2bl(id); - return bl ? bl->is_spell() : nullptr; -} - Option<Borrowed<map_local>> map_mapname2mapid(MapName); int map_mapname2ipport(MapName, Borrowed<IP4Address>, Borrowed<int>); @@ -675,25 +663,21 @@ inline dumb_ptr<map_session_data> block_list::as_player() { return dumb_ptr<map_ inline dumb_ptr<npc_data> block_list::as_npc() { return dumb_ptr<npc_data>(static_cast<npc_data *>(this)) ; } inline dumb_ptr<mob_data> block_list::as_mob() { return dumb_ptr<mob_data>(static_cast<mob_data *>(this)) ; } inline dumb_ptr<flooritem_data> block_list::as_item() { return dumb_ptr<flooritem_data>(static_cast<flooritem_data *>(this)) ; } -//inline dumb_ptr<invocation> block_list::as_spell() { return dumb_ptr<invocation>(static_cast<invocation *>(this)) ; } inline dumb_ptr<map_session_data> block_list::is_player() { return bl_type == BL::PC ? as_player() : nullptr; } inline dumb_ptr<npc_data> block_list::is_npc() { return bl_type == BL::NPC ? as_npc() : nullptr; } inline dumb_ptr<mob_data> block_list::is_mob() { return bl_type == BL::MOB ? as_mob() : nullptr; } inline dumb_ptr<flooritem_data> block_list::is_item() { return bl_type == BL::ITEM ? as_item() : nullptr; } -//inline dumb_ptr<invocation> block_list::is_spell() { return bl_type == BL::SPELL ? as_spell() : nullptr; } // struct invocation is defined in another header inline dumb_ptr<npc_data_script> npc_data::as_script() { return dumb_ptr<npc_data_script>(static_cast<npc_data_script *>(this)) ; } inline dumb_ptr<npc_data_shop> npc_data::as_shop() { return dumb_ptr<npc_data_shop>(static_cast<npc_data_shop *>(this)) ; } inline dumb_ptr<npc_data_warp> npc_data::as_warp() { return dumb_ptr<npc_data_warp>(static_cast<npc_data_warp *>(this)) ; } -inline dumb_ptr<npc_data_message> npc_data::as_message() { return dumb_ptr<npc_data_message>(static_cast<npc_data_message *>(this)) ; } inline dumb_ptr<npc_data_script> npc_data::is_script() { return npc_subtype == NpcSubtype::SCRIPT ? as_script() : nullptr ; } inline dumb_ptr<npc_data_shop> npc_data::is_shop() { return npc_subtype == NpcSubtype::SHOP ? as_shop() : nullptr ; } inline dumb_ptr<npc_data_warp> npc_data::is_warp() { return npc_subtype == NpcSubtype::WARP ? as_warp() : nullptr ; } -inline dumb_ptr<npc_data_message> npc_data::is_message() { return npc_subtype == NpcSubtype::MESSAGE ? as_message() : nullptr ; } void map_addmap(MapName mapname); void map_delmap(MapName mapname); |