Atrinik Server 2.5
types/gravestone.c
Go to the documentation of this file.
00001 /************************************************************************
00002 *            Atrinik, a Multiplayer Online Role Playing Game            *
00003 *                                                                       *
00004 *    Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team    *
00005 *                                                                       *
00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game)     *
00007 * and Crossfire (Multiplayer game for X-windows).                       *
00008 *                                                                       *
00009 * This program is free software; you can redistribute it and/or modify  *
00010 * it under the terms of the GNU General Public License as published by  *
00011 * the Free Software Foundation; either version 2 of the License, or     *
00012 * (at your option) any later version.                                   *
00013 *                                                                       *
00014 * This program is distributed in the hope that it will be useful,       *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00017 * GNU General Public License for more details.                          *
00018 *                                                                       *
00019 * You should have received a copy of the GNU General Public License     *
00020 * along with this program; if not, write to the Free Software           *
00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             *
00022 *                                                                       *
00023 * The author can be reached at admin@atrinik.org                        *
00024 ************************************************************************/
00025 
00030 #include <global.h>
00031 
00036 const char *gravestone_text(object *op)
00037 {
00038     static char buf2[MAX_BUF];
00039     char buf[MAX_BUF], race[MAX_BUF];
00040     time_t now = time(NULL);
00041 
00042     strcpy(buf2, "R.I.P.\n\n");
00043 
00044     if (op->type == PLAYER)
00045     {
00046         snprintf(buf, sizeof(buf), "Here rests the hero %s the %s\n", op->name, player_get_race_class(op, race, sizeof(race)));
00047     }
00048     else
00049     {
00050         snprintf(buf, sizeof(buf), "%s\n", op->name);
00051     }
00052 
00053     strncat(buf2, buf, sizeof(buf2) - strlen(buf2) - 1);
00054 
00055     if (op->type == PLAYER)
00056     {
00057         snprintf(buf, sizeof(buf), "who was killed at level %d\nby %s.", op->level, strcmp(CONTR(op)->killer, "") ? CONTR(op)->killer : "something nasty");
00058     }
00059     else
00060     {
00061         snprintf(buf, sizeof(buf), "who died at level %d.", op->level);
00062     }
00063 
00064     strncat(buf2, buf, sizeof(buf2) - strlen(buf2) - 1);
00065 
00066     strftime(buf, sizeof(buf), "\n\n%b %d %Y", localtime(&now));
00067     strncat(buf2, buf, sizeof(buf2) - strlen(buf2) - 1);
00068 
00069     return buf2;
00070 }