Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base')
-rw-r--r--src/game/base/game.cc60
1 files changed, 56 insertions, 4 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index e34f9a3..a628440 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -104,9 +104,9 @@ void Game::func_join(core::Player *player, std::string const &args)
player->reputation().clear();
Faction::apply_default(player->reputation());
- // reset player timestamps
- player->set_time_wasted(0);
- player->set_time_joined();
+ // reset player timestamps
+ player->set_time_wasted(0);
+ player->set_time_joined();
}
player->set_dirty();
@@ -536,7 +536,7 @@ void Game::func_give(core::Player *player, const std::string &args)
sys::ConsoleInterface::instance()->rconbuf().pop_front();
}
- player->send("Unknown weapon type '" + labelstr + "'");
+ player->send("^WUnknown weapon type '" + labelstr + "'");
return;
} else {
int amount = 0;
@@ -607,9 +607,61 @@ void Game::func_give(core::Player *player, const std::string &args)
player->sound("game/buy");
}
+ } else if (str.compare("reputation") == 0) {
+ std::string labelstr;
+
+ Faction *faction= 0;
+ if (!(is >> labelstr)) {
+ player->send("Usage: give reputation [string] [int]");
+ return;
+ } else {
+ aux::to_label(labelstr);
+ faction = Faction::find(labelstr);
+ }
+
+ if (labelstr.compare("default") == 0) {
+
+ player->reputation().clear();
+ Faction::apply_default(player->reputation());
+ player->reputation().set_dirty();
+
+ player->send("Reputation reset to default");
+ return;
+
+ } else if (!faction) {
+ // enable rcon buffering
+ sys::ConsoleInterface::instance()->set_rcon(true);
+ Faction::list();
+ // disable rcon buffering
+ sys::ConsoleInterface::instance()->set_rcon(false);
+
+ while (sys::ConsoleInterface::instance()->rconbuf().size()) {
+ player->send((*sys::ConsoleInterface::instance()->rconbuf().begin()));
+ sys::ConsoleInterface::instance()->rconbuf().pop_front();
+ }
+
+ player->send("^WUnknown faction '" + labelstr + "'");
+ return;
+ }
+
+ float reputation;
+ if (!(is >> reputation)) {
+ player->send("Usage: give reputation [string] [int]");
+ return;
+ }
+
+ math::clamp(reputation, -100.0f, 100.0f);
+ player->reputation().set_reputation(faction, reputation);
+ player->reputation().set_dirty();
+
+ std::ostringstream msgstr;
+ msgstr << "Reputation for faction '" << faction->label() << "' set to " << reputation;
+ player->send(msgstr.str().c_str());
+
} else {
player->send("Usage: give cargo [string] [int]");
player->send(" give credits [int]");
+ player->send(" give reputation [string] [int]");
player->send(" give ship [string]");
player->send(" give weapon [string] [int]");
return;