IN-GAMEINTERFACE
Gameplay
Referral System
Turn an invitation into a head start.
Price on request—views
Small details.
Better systems.
#include <algorithm>
#include <cstddef>
#include <chrono>
#include <cstdint>
#include <expected>
#include <span>
#include <vector>
namespace DynCast::Research {
using Clock = std::chrono::steady_clock;
using namespace std::chrono_literals;
enum class PlayerId : std::uint64_t {};
enum class TimerError : std::uint8_t { InvalidDuration };
struct Cooldown final {
PlayerId Player;
Clock::time_point Deadline;
[[nodiscard]] constexpr auto Ready(Clock::time_point Now) const noexcept -> bool {
return Now >= Deadline;
}
};
[[nodiscard]] constexpr auto Validate(std::chrono::seconds Delay) noexcept -> std::expected<std::chrono::seconds, TimerError> {
if (Delay <= 0s || Delay > 24h)
return std::unexpected{TimerError::InvalidDuration};
return Delay;
}
[[nodiscard]] auto Schedule(PlayerId Player, std::chrono::seconds Delay, Clock::time_point Now = Clock::now()) -> std::expected<Cooldown, TimerError> {
return Validate(Delay).transform([Player, Now](auto Duration) noexcept {
return Cooldown{.Player = Player, .Deadline = Now + Duration};
});
}
[[nodiscard]] auto CollectReady(std::span<const Cooldown> Timers, Clock::time_point Now) -> std::vector<PlayerId> {
const auto Count = std::ranges::count_if(Timers, [Now](const auto& Timer) {
return Timer.Ready(Now);
});
std::vector<PlayerId> Result;
Result.reserve(static_cast<std::size_t>(Count));
for (const auto& Timer : Timers) {
if (Timer.Ready(Now))
Result.push_back(Timer.Player);
}
return Result;
}
}Distinctive Metin2 systems. Built to be played.
Find the next thing your players won't want to play without.
IN-GAMETurn an invitation into a head start.
A better way into the next run.
Keep the economy moving.
Give every season a purpose.
Turn a session into insight.
Ready for whatever comes next.
Make progression worth crafting.
A clear path through every research.
Less sorting. More playing.
Build something together.
Referral System includes original in-game media. Other listings and prices are illustrative.