Atrinik Server  4.0
statistics.c
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
32 #include <global.h>
33 #include <toolkit/string.h>
34 #include <arch.h>
35 #include <player.h>
36 #include <object.h>
37 #include <exp.h>
38 
40 void command_statistics(object *op, const char *command, char *params)
41 {
42  size_t i;
43 
44  draw_info_format(COLOR_WHITE, op, "Experience: %s", string_format_number_comma(op->stats.exp));
45 
46  if (op->level < MAXLEVEL) {
47  char *cp;
48 
49  cp = estrdup(string_format_number_comma(level_exp(op->level + 1, 1.0)));
50  draw_info_format(COLOR_WHITE, op, "Next Level: %s (%s)", cp, string_format_number_comma(level_exp(op->level + 1, 1.0) - op->stats.exp));
51  efree(cp);
52  }
53 
54  draw_info(COLOR_WHITE, op, "\nStat: Natural (Real)");
55 
56  for (i = 0; i < NUM_STATS; i++) {
57  draw_info_format(COLOR_WHITE, op, "[green]%s:[/green] %d (%d)", short_stat_name[i], get_attr_value(&op->arch->clone.stats, i), get_attr_value(&op->stats, i));
58  }
59 
60  draw_info_format(COLOR_WHITE, op, "\nYour equipped item power is %d out of %d.", CONTR(op)->item_power, op->level);
61 }
uint64_t level_exp(int level, double expmul)
Definition: exp.c:284
int64_t exp
Definition: living.h:69
int8_t get_attr_value(const living *stats, int attr)
Definition: living.c:305
struct archetype * arch
Definition: object.h:225
void command_statistics(object *op, const char *command, char *params)
Definition: statistics.c:40
#define MAXLEVEL
Definition: global.h:221
#define NUM_STATS
Definition: living.h:49
living stats
Definition: object.h:481
const char *const short_stat_name[NUM_STATS]
Definition: living.c:221
int8_t level
Definition: object.h:347
object clone
An object from which to do object_copy().
Definition: arch.h:47