aboutsummaryrefslogtreecommitdiffstats
path: root/inc/messages.inc
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-05-09 22:06:30 +0200
committerpiernov <piernov@piernov.org>2016-05-09 22:06:30 +0200
commitf10c51f07a755d75a583f85316efbcd3bd1e4b6d (patch)
tree87419a11e12f5b7433459fcb5cb9da5211dcbd9e /inc/messages.inc
parent54635d17eef27eb2546d69599e4107b242509ced (diff)
parent2f32bc3153b7f2c2561e4603f912573921e6449f (diff)
downloadcandybox-f10c51f07a755d75a583f85316efbcd3bd1e4b6d.tar.gz
candybox-f10c51f07a755d75a583f85316efbcd3bd1e4b6d.tar.bz2
candybox-f10c51f07a755d75a583f85316efbcd3bd1e4b6d.tar.xz
candybox-f10c51f07a755d75a583f85316efbcd3bd1e4b6d.zip
Merge branch 'alexichi' of ssh://piernov.org/srv/git/candybox into alexichi
Diffstat (limited to 'inc/messages.inc')
-rw-r--r--inc/messages.inc25
1 files changed, 22 insertions, 3 deletions
diff --git a/inc/messages.inc b/inc/messages.inc
index d6ea87e..3a7d9b1 100644
--- a/inc/messages.inc
+++ b/inc/messages.inc
@@ -5,13 +5,32 @@ $messages = array(
"gold_insufficient" => "You don't have enough gold.",
"shop_missing_item" => "This item does not exist.",
"guild_not_yet_created" => "You need to create a guild first.",
- "guild_already_built" => "You have aready built a guild."
+ "guild_already_built" => "You have aready built a guild.",
+ "dungeon_already_available" => "You can already access the dungeon",
+
+ "gamesave_ok" => "Game saved.",
+ "gamesave_error" => "An error occured when trying to save the game.",
+ "gamesave_not_found" => "Couldn't find the specified save file.",
+ "gamesave_delete_fail" => "Couldn't delete the specified save file.",
+ "gamesave_delete_success" => "Game save successfully removed from server",
+
+ "upload_fail" => "Could not upload save file.",
+ "upload_success" => "Save file uploaded successfully: %s",
);
-function sendError($msg) {
+function sendMessage($type, $msg, $fmt = null) {
global $messages;
$text = $messages[$msg];
- echo json_encode(array("error" => $text));
+ if($fmt) $text = vsprintf($text, $fmt);
+ echo json_encode(array($type => $text));
+}
+
+function sendError($msg, $fmt = null) {
+ sendMessage("error", $msg, $fmt);
+}
+
+function sendInfo($msg, $fmt = null) {
+ sendMessage("info", $msg, $fmt);
}
?>