|
nanoMMO 0.97.8
Building an MMO: The Engineering Series
|
#include <world.h>
Public Member Functions | |
| World (uint32_t seed=std::mt19937::default_seed, Terrain terrain=Terrain(), std::shared_ptr< const Content > content=std::make_shared< Content >(), std::shared_ptr< Paths > paths=nullptr) | |
| void | Join (uint32_t id, Player player) |
| void | Leave (uint32_t id) |
| void | SetInput (uint32_t id, float x, float z, bool run, bool attack=false) |
| void | Pick (uint32_t id, uint32_t monster, uint32_t player=0) |
| void | SetBehind (uint32_t id, std::chrono::nanoseconds behind) |
| void | Respawn (uint32_t id) |
| void | WalkTo (uint32_t id, Place to) |
| void | UseSkill (uint32_t id, uint32_t skill) |
| absl::Status | Learn (uint32_t id, uint32_t npc, uint32_t skill) |
| absl::Status | TakeQuest (uint32_t id, uint32_t npc, uint32_t quest) |
| absl::Status | TurnIn (uint32_t id, uint32_t npc, uint32_t quest) |
| absl::Status | Enlist (uint32_t id, uint32_t npc) |
| absl::Status | GiveUp (uint32_t id, uint32_t quest) |
| absl::Status | MoveItem (uint32_t id, const protocol::Place &from, const protocol::Place &to, uint32_t count=0) |
| absl::Status | DestroyItem (uint32_t id, const protocol::Place &place) |
| Throws away all of what's at the place, unless they offer it in a trade. | |
| absl::Status | Craft (uint32_t id, uint32_t recipe) |
| void | StopCrafting (uint32_t id) |
| Stops what the player's making, if anything, and they lose nothing. | |
| absl::Status | UseItem (uint32_t id, uint32_t slot) |
| absl::Status | AskToTrade (uint32_t id, std::string_view name) |
| absl::Status | OfferToTrade (uint32_t id, const protocol::TradeOffer &offer) |
| What the player offers in their trade, as Trades::Offer has it. | |
| absl::StatusOr< uint32_t > | ReadyToTrade (uint32_t id, bool ready, uint32_t revision) |
| void | CancelTrade (uint32_t id) |
| Calls the player's trade off, for both of them. | |
| protocol::Trade | TradeOf (uint32_t id) const |
| std::set< uint32_t > | TakeTradeNews () |
| absl::Status | AskToDuel (uint32_t id, std::string_view name) |
| absl::Status | AnswerDuel (uint32_t id, bool yes) |
| absl::Status | Yield (uint32_t id) |
| uint32_t | CallOffDuel (uint32_t id) |
| protocol::Duel | DuelOf (uint32_t id) const |
| std::set< uint32_t > | TakeDuelNews () |
| void | SetGuild (uint32_t id, uint32_t guild) |
| The player's guild, by its id, or 0 for none. | |
| void | SetWars (const std::vector< War > &wars) |
| bool | Hostile (uint32_t id, uint32_t other) const |
| std::vector< WarKill > | TakeWarKills () |
| uint32_t | Spawn (Monster monster) |
| uint32_t | Spawn (Npc npc) |
| NPCs have ids of their own, apart from the monsters'. | |
| void | Step (std::chrono::nanoseconds time) |
| std::vector< Notice > | TakeNotices () |
| The lines for players since the last time, which it hands over. | |
| std::vector< Event > | TakeEvents () |
| What's happened since the last time, which it hands over. | |
| const std::map< uint32_t, Player > & | players () const |
| const std::map< uint32_t, Monster > & | monsters () const |
| const std::map< uint32_t, Npc > & | npcs () const |
| const Terrain & | terrain () const |
Static Public Attributes | |
| static constexpr float | kWalkSpeed = nanommo::kWalkSpeed |
| As walking.h has them, which the monsters go at too. | |
| static constexpr float | kRunSpeed = nanommo::kRunSpeed |
| static constexpr float | kCloseIn = 0.8f |
| static constexpr std::chrono::seconds | kRespawnTime {10} |
| static constexpr float | kAddsAround = 3.0f |
| How far from a boss its adds come, in metres. | |
| static constexpr int | kEnoughHelp = 5 |
| static constexpr std::chrono::seconds | kRisesSoon {30} |
| How long before a boss comes back to life its land hears that it will. | |
| static constexpr float | kTalkReach = nanommo::kTalkReach |
| static constexpr float | kTradeReach = kTalkReach |
| Two players trade within talking reach, as close as they'd stand to talk. | |
|
explicit |
| absl::Status nanommo::World::AnswerDuel | ( | uint32_t | id, |
| bool | yes ) |
| absl::Status nanommo::World::AskToDuel | ( | uint32_t | id, |
| std::string_view | name ) |
The player asks the one of that name here, whatever its case, within Duels::kReach, to duel, or says yes to them asking first. Or the error says why not, in words for the player.
| absl::Status nanommo::World::AskToTrade | ( | uint32_t | id, |
| std::string_view | name ) |
| uint32_t nanommo::World::CallOffDuel | ( | uint32_t | id | ) |
| void nanommo::World::CancelTrade | ( | uint32_t | id | ) |
| absl::Status nanommo::World::Craft | ( | uint32_t | id, |
| uint32_t | recipe ) |
The player starts making the recipe, wherever they are, which takes its seconds, if they're of its level and their bag has all it takes, outside what they offer in a trade, and room for what it makes. Or the error says why not, in words for the player. Moving, a swing or a skill, a blow, a trade or a duel stops it, and they lose nothing.
| absl::Status nanommo::World::DestroyItem | ( | uint32_t | id, |
| const protocol::Place & | place ) |
| protocol::Duel nanommo::World::DuelOf | ( | uint32_t | id | ) | const |
| absl::Status nanommo::World::Enlist | ( | uint32_t | id, |
| uint32_t | npc ) |
| absl::Status nanommo::World::GiveUp | ( | uint32_t | id, |
| uint32_t | quest ) |
| bool nanommo::World::Hostile | ( | uint32_t | id, |
| uint32_t | other ) const |
| absl::Status nanommo::World::Learn | ( | uint32_t | id, |
| uint32_t | npc, | ||
| uint32_t | skill ) |
|
inline |
| absl::Status nanommo::World::MoveItem | ( | uint32_t | id, |
| const protocol::Place & | from, | ||
| const protocol::Place & | to, | ||
| uint32_t | count = 0 ) |
Moves the player's items around, as Inventory::Move does, wearing them and taking them off, or the error says why not, in words for the player. Nothing goes to or from a place they offer in a trade.
|
inline |
| absl::Status nanommo::World::OfferToTrade | ( | uint32_t | id, |
| const protocol::TradeOffer & | offer ) |
What the player offers in their trade, as Trades::Offer has it.
| void nanommo::World::Pick | ( | uint32_t | id, |
| uint32_t | monster, | ||
| uint32_t | player = 0 ) |
|
inline |
| absl::StatusOr< uint32_t > nanommo::World::ReadyToTrade | ( | uint32_t | id, |
| bool | ready, | ||
| uint32_t | revision ) |
| void nanommo::World::Respawn | ( | uint32_t | id | ) |
| void nanommo::World::SetBehind | ( | uint32_t | id, |
| std::chrono::nanoseconds | behind ) |
The player's client draws everyone else this long ago, so their blows on another player are checked against where that player was then. Inputs believes Inputs::kMostRewind of what a client says, at most.
| void nanommo::World::SetGuild | ( | uint32_t | id, |
| uint32_t | guild ) |
| void nanommo::World::SetInput | ( | uint32_t | id, |
| float | x, | ||
| float | z, | ||
| bool | run, | ||
| bool | attack = false ) |
| void nanommo::World::SetWars | ( | const std::vector< War > & | wars | ) |
| uint32_t nanommo::World::Spawn | ( | Npc | npc | ) |
| void nanommo::World::StopCrafting | ( | uint32_t | id | ) |
| std::set< uint32_t > nanommo::World::TakeDuelNews | ( | ) |
| std::vector< Event > nanommo::World::TakeEvents | ( | ) |
| std::vector< Notice > nanommo::World::TakeNotices | ( | ) |
| absl::Status nanommo::World::TakeQuest | ( | uint32_t | id, |
| uint32_t | npc, | ||
| uint32_t | quest ) |
| std::set< uint32_t > nanommo::World::TakeTradeNews | ( | ) |
| std::vector< WarKill > nanommo::World::TakeWarKills | ( | ) |
| protocol::Trade nanommo::World::TradeOf | ( | uint32_t | id | ) | const |
| absl::Status nanommo::World::TurnIn | ( | uint32_t | id, |
| uint32_t | npc, | ||
| uint32_t | quest ) |
| absl::Status nanommo::World::UseItem | ( | uint32_t | id, |
| uint32_t | slot ) |
| void nanommo::World::UseSkill | ( | uint32_t | id, |
| uint32_t | skill ) |
| void nanommo::World::WalkTo | ( | uint32_t | id, |
| Place | to ) |
| absl::Status nanommo::World::Yield | ( | uint32_t | id | ) |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |