Crossfire Server, Branch 1.12
R12190
|
00001 /* 00002 * static char *rcsid_info_c = 00003 * "$Id: info.c 11578 2009-02-23 22:02:27Z lalo $"; 00004 */ 00005 00006 /* 00007 CrossFire, A Multiplayer game for X-windows 00008 00009 Copyright (C) 2006 Mark Wedel & Crossfire Development Team 00010 Copyright (C) 1992 Frank Tore Johansen 00011 00012 This program is free software; you can redistribute it and/or modify 00013 it under the terms of the GNU General Public License as published by 00014 the Free Software Foundation; either version 2 of the License, or 00015 (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with this program; if not, write to the Free Software 00024 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00025 00026 The authors can be reached via e-mail at crossfire-devel@real-time.com 00027 */ 00028 00029 #include <global.h> 00030 00040 void dump_abilities(void) { 00041 archetype *at; 00042 char name[VERY_BIG_BUF]; 00043 00044 for (at = first_archetype; at; at = at->next) { 00045 const char *gen_name = ""; 00046 archetype *gen; 00047 00048 if (!QUERY_FLAG(&at->clone, FLAG_MONSTER)) 00049 continue; 00050 00051 /* Get rid of e.g. multiple black puddings */ 00052 if (QUERY_FLAG(&at->clone, FLAG_CHANGING)) 00053 continue; 00054 00055 for (gen = first_archetype; gen; gen = gen->next) { 00056 if (gen->clone.other_arch && gen->clone.other_arch == at) { 00057 gen_name = gen->name; 00058 break; 00059 } 00060 } 00061 00062 describe_item(&at->clone, NULL, name, VERY_BIG_BUF); 00063 printf("%-16s|%6"FMT64"|%4d|%3d|%s|%s|%s\n", at->clone.name, at->clone.stats.exp, 00064 at->clone.stats.hp, at->clone.stats.ac, name, at->name, gen_name); 00065 } 00066 } 00067 00071 void print_monsters(void) { 00072 archetype *at; 00073 object *op; 00074 char attbuf[34]; 00075 int i; 00076 00077 printf(" | | | | | attack | resistances |\n"); 00078 printf("monster | hp |dam| ac | wc |pmf ecw adw gpd ptf|phy mag fir ele cld cfs acd drn wmg ght poi slo par tud fer cnc dep dth chs csp gpw hwd bln int | exp | new exp |\n"); 00079 printf("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); 00080 for (at = first_archetype; at != NULL; at = at->next) { 00081 op = arch_to_object(at); 00082 if (QUERY_FLAG(op, FLAG_MONSTER)) { 00083 bitstostring((long)op->attacktype, NROFATTACKS, attbuf); 00084 printf("%-15s|%5d|%3d|%4d|%4d|%s|", 00085 op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, 00086 op->stats.wc, attbuf); 00087 for (i = 0; i < NROFATTACKS; i++) 00088 printf("%4d", op->resist[i]); 00089 printf("|%8"FMT64"|%9"FMT64"|\n", op->stats.exp, new_exp(op)); 00090 } 00091 free_object(op); 00092 } 00093 } 00094 00110 void bitstostring(long bits, int num, char *str) { 00111 int i, j = 0; 00112 00113 if (num > 32) 00114 num = 32; 00115 00116 for (i = 0; i < num; i++) { 00117 if (i && (i%3) == 0) { 00118 str[i+j] = ' '; 00119 j++; 00120 } 00121 if (bits&1) 00122 str[i+j] = '1'; 00123 else 00124 str[i+j] = '0'; 00125 bits >>= 1; 00126 } 00127 str[i+j] = '\0'; 00128 return; 00129 }