Files
brandling-safari/shared/Roster.h
Gabe 238cd9c6c3 Brandling Safari: LAN safari-zone creature catching on the HD-2D engine
- Authoritative 30 Hz server (ENet, SQLite): accounts, characters, wild AI, tall grass /
  water / wandering spawns, fishing, captures, follower chains, clock + weather, LAN beacon
- Client: title / join / character creator / play screens, prediction + reconciliation,
  interpolated players and parties, HD-2D UI (dialogue with Professor Henry, HUD, collection)
- Shared deterministic zone generator, movement, protocol, roster, appearance
- Paper-doll character art pipeline (PixelLab base walk + per-item animation edits)
- Brandling roster from the company list (logo colors, jev types), Blender safari props
- Headless test bot
2026-10-02 15:20:27 -05:00

42 lines
1.3 KiB
C++

#pragma once
// Creature species, loaded from assets/creatures/roster.json (written by
// tools/build_roster.py from the company list).
#include <cstdint>
#include <string>
#include <vector>
namespace bs {
enum class Rarity : uint8_t { Common = 0, Uncommon, Rare, Legendary };
enum class Habitat : uint8_t { Grass = 0, Water, Both };
struct Species {
uint16_t id = 0;
std::string slug, name, domain, type, type2, body;
Rarity rarity = Rarity::Common;
Habitat habitat = Habitat::Grass;
float catchRate = 0.5f, fleeRate = 0.1f;
uint32_t mainColor = 0x888888, accentColor = 0xcccccc;
std::string sprite; // relative to assets/creatures/
int anchorRow = 63;
bool retired = false; // company left the list: id and catches stay valid, it no longer spawns
};
class Roster {
public:
bool load(const std::string& path, std::string* error = nullptr);
size_t size() const { return species_.size(); }
const Species* get(uint16_t id) const { return id < species_.size() ? &species_[id] : nullptr; }
const std::vector<Species>& all() const { return species_; }
private:
std::vector<Species> species_;
};
const char* rarityName(Rarity r);
// Display color of a type (for UI chips).
uint32_t typeColor(const std::string& type);
} // namespace bs