From 4a2c014e4eb9229ff61c3ff762c44d3bd21b7f7c Mon Sep 17 00:00:00 2001 From: amber Date: Sun, 28 Nov 2004 19:58:22 +0000 Subject: Fix some file types git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@404 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/charcommand.h | 100 +++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 8fb17fb64..11babb816 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -1,50 +1,50 @@ -#ifndef _CHARCOMMAND_H_ -#define _CHARCOMMAND_H_ - -enum CharCommandType { - CharCommand_None = -1, - CharCommandJobChange, - CharCommandPetRename, - CharCommandPetFriendly, - CharCommandReset, - CharCommandStats, - CharCommandOption, - CharCommandSave, - CharCommandStatsAll, - -#ifdef TXT_ONLY -/* TXT_ONLY */ - -/* TXT_ONLY */ -#else -/* SQL-only */ - -/* SQL Only */ -#endif - - // End. No more commans after this line. - CharCommand_Unknown, - CharCommand_MAX -}; - -typedef enum CharCommandType CharCommandType; - -typedef struct CharCommandInfo { - CharCommandType type; - const char* command; - int level; - int (*proc)(const int, struct map_session_data*, - const char* command, const char* message); -} CharCommandInfo; - -CharCommandType -is_charcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl); - -CharCommandType charcommand( - const int level, const char* message, CharCommandInfo* info); -int get_charcommand_level(const CharCommandType type); - -int charcommand_config_read(const char *cfgName); - -#endif - +#ifndef _CHARCOMMAND_H_ +#define _CHARCOMMAND_H_ + +enum CharCommandType { + CharCommand_None = -1, + CharCommandJobChange, + CharCommandPetRename, + CharCommandPetFriendly, + CharCommandReset, + CharCommandStats, + CharCommandOption, + CharCommandSave, + CharCommandStatsAll, + +#ifdef TXT_ONLY +/* TXT_ONLY */ + +/* TXT_ONLY */ +#else +/* SQL-only */ + +/* SQL Only */ +#endif + + // End. No more commans after this line. + CharCommand_Unknown, + CharCommand_MAX +}; + +typedef enum CharCommandType CharCommandType; + +typedef struct CharCommandInfo { + CharCommandType type; + const char* command; + int level; + int (*proc)(const int, struct map_session_data*, + const char* command, const char* message); +} CharCommandInfo; + +CharCommandType +is_charcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl); + +CharCommandType charcommand( + const int level, const char* message, CharCommandInfo* info); +int get_charcommand_level(const CharCommandType type); + +int charcommand_config_read(const char *cfgName); + +#endif + -- cgit v1.2.3-70-g09d2 From ae6aa7431d176f3defab07234cdd7677523f0c4d Mon Sep 17 00:00:00 2001 From: codemaster Date: Mon, 13 Dec 2004 22:15:58 +0000 Subject: * common/mmo.h: changed base_level and job_level to unsigned int to increase max levels * char/char.c: added a NULL check for the file in parse_friend_txt * map/atcommand.c/.h: added @clearweather (thanks to Dexity) * map/charcommand.c/.h: added #spiritball * map/mob.c: fixed a compiler warning (ln was an int and was supposed to be an unsigned long int) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@563 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 5 +++++ src/char/char.c | 3 +++ src/common/mmo.h | 2 +- src/map/atcommand.c | 23 +++++++++++++++++++++++ src/map/atcommand.h | 1 + src/map/charcommand.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- src/map/charcommand.h | 1 + src/map/mob.c | 3 ++- 8 files changed, 81 insertions(+), 4 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog.txt b/Changelog.txt index 6f9f872ed..ba2e5eca3 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,10 @@ Date Added 12/14 + * common/mmo.h: changed base_level and job_level to unsigned int to increase max levels [Codemaster] + * char/char.c: added a NULL check for the file in parse_friend_txt [Codemaster] + * map/atcommand.c/.h: added @clearweather (thanks to Dexity) [Codemaster] + * map/charcommand.c/.h: added #spiritball [Codemaster] + * map/mob.c: fixed a compiler warning (ln was an int and was supposed to be an unsigned long int) [Codemaster] * Added nullpo_retb to nullpo.c - does a break; if null [celest] * Replaced some parts in skill.c with nullpo checks [celest] * Corrected some typos - penaly -> penalty [celest] diff --git a/src/char/char.c b/src/char/char.c index 2d5c5ba7d..50e1c4f0a 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -577,6 +577,9 @@ int parse_friend_txt(struct mmo_charstatus *p) // Open the file and look for the ID fp = fopen(friends_txt, "r"); + + if(fp == NULL) + return 1; while(fgets(line, sizeof(line)-1, fp)) { diff --git a/src/common/mmo.h b/src/common/mmo.h index 3504b00e4..378f324a1 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -129,7 +129,7 @@ struct mmo_charstatus { short head_top,head_mid,head_bottom; char name[24]; - unsigned char base_level,job_level; + unsigned int base_level,job_level; short str,agi,vit,int_,dex,luk; unsigned char char_num,sex; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d460bfa2d..ff7ff00da 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -206,6 +206,7 @@ ATCOMMAND_FUNC(trade); // by MouseJstr ATCOMMAND_FUNC(send); // by davidsiaw ATCOMMAND_FUNC(setbattleflag); // by MouseJstr ATCOMMAND_FUNC(unmute); // [Valaris] +ATCOMMAND_FUNC(clearweather); // Dexity ATCOMMAND_FUNC(uptime); // by MC Cameri ATCOMMAND_FUNC(changesex); // by MC Cameri ATCOMMAND_FUNC(mute); // celest @@ -455,6 +456,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Send, "@send", 60, atcommand_send }, { AtCommand_SetBattleFlag, "@setbattleflag", 60, atcommand_setbattleflag }, { AtCommand_UnMute, "@unmute", 60, atcommand_unmute }, // [Valaris] + { AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity { AtCommand_UpTime, "@uptime", 0, atcommand_uptime }, // by MC Cameri { AtCommand_ChangeSex, "@changesex", 1, atcommand_changesex }, // by MC Cameri { AtCommand_Mute, "@mute", 99, atcommand_mute }, // [celest] @@ -7686,6 +7688,27 @@ atcommand_leaves( clif_specialeffect(&sd->bl,effno,2); return 0; } + +/*========================================== + * Clearing Weather Effects by Dexity + *------------------------------------------ + */ +int +atcommand_clearweather( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int effno = 0; + nullpo_retr(-1, sd); + map[sd->bl.m].flag.rain=0; + map[sd->bl.m].flag.snow=0; + map[sd->bl.m].flag.sakura=0; + map[sd->bl.m].flag.fog=0; + map[sd->bl.m].flag.leaves=0; + clif_specialeffect(&sd->bl,effno,2); + return 0; +} + /*========================================== * *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index ce8fc2359..5cb40b433 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -187,6 +187,7 @@ enum AtCommandType { AtCommand_Send, AtCommand_SetBattleFlag, AtCommand_UnMute, + AtCommand_Clearweather, // by Dexity AtCommand_UpTime, // by MC Cameri AtCommand_ChangeSex, // by MC Cameri AtCommand_Mute, // [celest] diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 4c22ecbcc..56cf6b316 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -42,6 +42,7 @@ CCMD_FUNC(option); CCMD_FUNC(save); CCMD_FUNC(stats_all); CCMD_FUNC(reset); +CCMD_FUNC(spiritball); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -70,6 +71,7 @@ static CharCommandInfo charcommand_info[] = { { CharCommandReset, "#reset", 60, charcommand_reset }, { CharCommandSave, "#save", 60, charcommand_save }, { CharCommandStatsAll, "#statsall", 40, charcommand_stats_all }, + { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -248,8 +250,8 @@ int charcommand_config_read(const char *cfgName) { charcommand_config_read(w2); else if (strcmpi(w1, "command_symbol") == 0 && w2[0] > 31 && w2[0] != '/' && // symbol of standard ragnarok GM commands - w2[0] != '%' && // symbol of party chat speaking - w2[0] != '@') // symbol for @commands + w2[0] != '%' // symbol of party chat speaking + ) command_symbol = w2[0]; } fclose(fp); @@ -701,3 +703,44 @@ int charcommand_stats_all(const int fd, struct map_session_data* sd, const char* return 0; } +/*========================================== + * CharSpiritBall Function by PalasX + *------------------------------------------ + */ +int charcommand_spiritball(const int fd, struct map_session_data* sd,const char* command, const char* message) +{ + struct map_session_data *pl_sd; + char character[100]; + int spirit = 0; + + memset(character, '\0', sizeof(character)); + + if(!message || !*message || sscanf(message, "%d %99[^\n]", &spirit, character) < 2 || spirit < 0 || spirit > 1000) { + clif_displaymessage(fd, "Usage: @spiritball ) ."); + return -1; + } + + if((pl_sd = map_nick2sd(character)) != NULL) { + if (spirit >= 0 && spirit <= 0x7FFF) { + if (pl_sd->spiritball != spirit || spirit > 999) { + if (pl_sd->spiritball > 0) + pc_delspiritball(pl_sd, pl_sd->spiritball, 1); + pl_sd->spiritball = spirit; + clif_spiritball(pl_sd); + // no message, player can look the difference + if (spirit > 1000) + clif_displaymessage(fd, msg_table[204]); // WARNING: more than 1000 spiritballs can CRASH your server and/or client! + } else { + clif_displaymessage(fd, msg_table[205]); // You already have this number of spiritballs. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 11babb816..27629d9b7 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -11,6 +11,7 @@ enum CharCommandType { CharCommandOption, CharCommandSave, CharCommandStatsAll, + CharCommandSpiritball, #ifdef TXT_ONLY /* TXT_ONLY */ diff --git a/src/map/mob.c b/src/map/mob.c index d773de1ec..a7516c784 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4185,7 +4185,8 @@ void mob_reload(void) static int mob_read_sqldb(void) { char line[1024]; - int i,class,ln=0; + int i,class; + long unsigned int ln=0; char *str[55],*p,*np; memset(mob_db,0,sizeof(mob_db)); -- cgit v1.2.3-70-g09d2 From eb14b67a9e71407702d69498b88eff1b6ef85c6c Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Thu, 16 Dec 2004 01:53:35 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@577 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 2 + conf-tmpl/atcommand_athena.conf | 3 - conf-tmpl/charcommand_athena.conf | 3 +- src/map/atcommand.c | 495 +++++++++++++++----------------------- src/map/atcommand.h | 1 - src/map/charcommand.c | 122 +++++++++- src/map/charcommand.h | 1 + src/map/map.c | 5 +- 8 files changed, 319 insertions(+), 313 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog.txt b/Changelog.txt index dd81c3ec0..4543951a6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,7 @@ Date Added 12/16 + * Added #itemlist, removed @charitemlist [MC Cameri] + * Changed @job and #job so that when it's used it unequips all the items, to prevent sprite errors [MC Cameri] * Updated Forging and Potion making formulas by DracoRPG [celest] * Changes to the guild skills - Dropped using sc_data and use flag values instead diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf index 6cc60da24..14be12248 100644 --- a/conf-tmpl/atcommand_athena.conf +++ b/conf-tmpl/atcommand_athena.conf @@ -260,9 +260,6 @@ save: 40 // Do some visual effect on your character effect: 40 -// Display all items of a player -charitemlist: 40 - // Display all items of a player's storage charstoragelist: 40 diff --git a/conf-tmpl/charcommand_athena.conf b/conf-tmpl/charcommand_athena.conf index d95f6a1c0..064a79327 100644 --- a/conf-tmpl/charcommand_athena.conf +++ b/conf-tmpl/charcommand_athena.conf @@ -16,4 +16,5 @@ stats: 40 option: 60 save: 60 statsall: 40 -spiritball: 60 \ No newline at end of file +spiritball: 60 +itemlist: 40 \ No newline at end of file diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9ee2bdb14..353aae044 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -38,201 +38,200 @@ static char command_symbol = '@'; // first char of the commands (by [Yor]) char msg_table[1000][256]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others) -#define ATCOMMAND_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) -ATCOMMAND_FUNC(broadcast); -ATCOMMAND_FUNC(localbroadcast); -ATCOMMAND_FUNC(rurap); -ATCOMMAND_FUNC(rura); -ATCOMMAND_FUNC(where); -ATCOMMAND_FUNC(jumpto); -ATCOMMAND_FUNC(jump); -ATCOMMAND_FUNC(who); -ATCOMMAND_FUNC(who2); -ATCOMMAND_FUNC(who3); -ATCOMMAND_FUNC(whomap); -ATCOMMAND_FUNC(whomap2); -ATCOMMAND_FUNC(whomap3); -ATCOMMAND_FUNC(whogm); // by Yor -ATCOMMAND_FUNC(whozeny); // [Valaris] -ATCOMMAND_FUNC(happyhappyjoyjoy); // [Valaris] -ATCOMMAND_FUNC(save); -ATCOMMAND_FUNC(load); -ATCOMMAND_FUNC(speed); -ATCOMMAND_FUNC(storage); -ATCOMMAND_FUNC(guildstorage); -ATCOMMAND_FUNC(option); -ATCOMMAND_FUNC(hide); -ATCOMMAND_FUNC(jobchange); -ATCOMMAND_FUNC(die); -ATCOMMAND_FUNC(kill); -ATCOMMAND_FUNC(alive); -ATCOMMAND_FUNC(kami); -ATCOMMAND_FUNC(heal); -ATCOMMAND_FUNC(item); -ATCOMMAND_FUNC(item2); -ATCOMMAND_FUNC(itemreset); -ATCOMMAND_FUNC(itemcheck); -ATCOMMAND_FUNC(baselevelup); -ATCOMMAND_FUNC(joblevelup); -ATCOMMAND_FUNC(help); -ATCOMMAND_FUNC(gm); -ATCOMMAND_FUNC(pvpoff); -ATCOMMAND_FUNC(pvpon); -ATCOMMAND_FUNC(gvgoff); -ATCOMMAND_FUNC(gvgon); -ATCOMMAND_FUNC(model); -ATCOMMAND_FUNC(go); -ATCOMMAND_FUNC(monster); -ATCOMMAND_FUNC(monstersmall); -ATCOMMAND_FUNC(monsterbig); -ATCOMMAND_FUNC(spawn); -ATCOMMAND_FUNC(killmonster); -ATCOMMAND_FUNC(killmonster2); -ATCOMMAND_FUNC(refine); -ATCOMMAND_FUNC(produce); -ATCOMMAND_FUNC(memo); -ATCOMMAND_FUNC(gat); -ATCOMMAND_FUNC(packet); -ATCOMMAND_FUNC(statuspoint); -ATCOMMAND_FUNC(skillpoint); -ATCOMMAND_FUNC(zeny); -ATCOMMAND_FUNC(param); -ATCOMMAND_FUNC(guildlevelup); -ATCOMMAND_FUNC(makeegg); -ATCOMMAND_FUNC(hatch); -ATCOMMAND_FUNC(petfriendly); -ATCOMMAND_FUNC(pethungry); -ATCOMMAND_FUNC(petrename); -ATCOMMAND_FUNC(recall); -ATCOMMAND_FUNC(recallall); -ATCOMMAND_FUNC(revive); -ATCOMMAND_FUNC(character_stats_all); -ATCOMMAND_FUNC(character_save); -ATCOMMAND_FUNC(night); -ATCOMMAND_FUNC(day); -ATCOMMAND_FUNC(doom); -ATCOMMAND_FUNC(doommap); -ATCOMMAND_FUNC(raise); -ATCOMMAND_FUNC(raisemap); -ATCOMMAND_FUNC(character_baselevel); -ATCOMMAND_FUNC(character_joblevel); -ATCOMMAND_FUNC(kick); -ATCOMMAND_FUNC(kickall); -ATCOMMAND_FUNC(allskill); -ATCOMMAND_FUNC(questskill); -ATCOMMAND_FUNC(charquestskill); -ATCOMMAND_FUNC(lostskill); -ATCOMMAND_FUNC(charlostskill); -ATCOMMAND_FUNC(spiritball); -ATCOMMAND_FUNC(party); -ATCOMMAND_FUNC(guild); -ATCOMMAND_FUNC(charskreset); -ATCOMMAND_FUNC(charstreset); -ATCOMMAND_FUNC(charreset); -ATCOMMAND_FUNC(charstpoint); -ATCOMMAND_FUNC(charmodel); -ATCOMMAND_FUNC(charskpoint); -ATCOMMAND_FUNC(charzeny); -ATCOMMAND_FUNC(agitstart); -ATCOMMAND_FUNC(agitend); -ATCOMMAND_FUNC(reloaditemdb); -ATCOMMAND_FUNC(reloadmobdb); -ATCOMMAND_FUNC(reloadskilldb); +#define ACMD_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) +ACMD_FUNC(broadcast); +ACMD_FUNC(localbroadcast); +ACMD_FUNC(rurap); +ACMD_FUNC(rura); +ACMD_FUNC(where); +ACMD_FUNC(jumpto); +ACMD_FUNC(jump); +ACMD_FUNC(who); +ACMD_FUNC(who2); +ACMD_FUNC(who3); +ACMD_FUNC(whomap); +ACMD_FUNC(whomap2); +ACMD_FUNC(whomap3); +ACMD_FUNC(whogm); // by Yor +ACMD_FUNC(whozeny); // [Valaris] +ACMD_FUNC(happyhappyjoyjoy); // [Valaris] +ACMD_FUNC(save); +ACMD_FUNC(load); +ACMD_FUNC(speed); +ACMD_FUNC(storage); +ACMD_FUNC(guildstorage); +ACMD_FUNC(option); +ACMD_FUNC(hide); +ACMD_FUNC(jobchange); +ACMD_FUNC(die); +ACMD_FUNC(kill); +ACMD_FUNC(alive); +ACMD_FUNC(kami); +ACMD_FUNC(heal); +ACMD_FUNC(item); +ACMD_FUNC(item2); +ACMD_FUNC(itemreset); +ACMD_FUNC(itemcheck); +ACMD_FUNC(baselevelup); +ACMD_FUNC(joblevelup); +ACMD_FUNC(help); +ACMD_FUNC(gm); +ACMD_FUNC(pvpoff); +ACMD_FUNC(pvpon); +ACMD_FUNC(gvgoff); +ACMD_FUNC(gvgon); +ACMD_FUNC(model); +ACMD_FUNC(go); +ACMD_FUNC(monster); +ACMD_FUNC(monstersmall); +ACMD_FUNC(monsterbig); +ACMD_FUNC(spawn); +ACMD_FUNC(killmonster); +ACMD_FUNC(killmonster2); +ACMD_FUNC(refine); +ACMD_FUNC(produce); +ACMD_FUNC(memo); +ACMD_FUNC(gat); +ACMD_FUNC(packet); +ACMD_FUNC(statuspoint); +ACMD_FUNC(skillpoint); +ACMD_FUNC(zeny); +ACMD_FUNC(param); +ACMD_FUNC(guildlevelup); +ACMD_FUNC(makeegg); +ACMD_FUNC(hatch); +ACMD_FUNC(petfriendly); +ACMD_FUNC(pethungry); +ACMD_FUNC(petrename); +ACMD_FUNC(recall); +ACMD_FUNC(recallall); +ACMD_FUNC(revive); +ACMD_FUNC(character_stats_all); +ACMD_FUNC(character_save); +ACMD_FUNC(night); +ACMD_FUNC(day); +ACMD_FUNC(doom); +ACMD_FUNC(doommap); +ACMD_FUNC(raise); +ACMD_FUNC(raisemap); +ACMD_FUNC(character_baselevel); +ACMD_FUNC(character_joblevel); +ACMD_FUNC(kick); +ACMD_FUNC(kickall); +ACMD_FUNC(allskill); +ACMD_FUNC(questskill); +ACMD_FUNC(charquestskill); +ACMD_FUNC(lostskill); +ACMD_FUNC(charlostskill); +ACMD_FUNC(spiritball); +ACMD_FUNC(party); +ACMD_FUNC(guild); +ACMD_FUNC(charskreset); +ACMD_FUNC(charstreset); +ACMD_FUNC(charreset); +ACMD_FUNC(charstpoint); +ACMD_FUNC(charmodel); +ACMD_FUNC(charskpoint); +ACMD_FUNC(charzeny); +ACMD_FUNC(agitstart); +ACMD_FUNC(agitend); +ACMD_FUNC(reloaditemdb); +ACMD_FUNC(reloadmobdb); +ACMD_FUNC(reloadskilldb); #ifndef TXT_ONLY -ATCOMMAND_FUNC(rehash);// by Fr3DBr +ACMD_FUNC(rehash);// by Fr3DBr #else /* TXT_ONLY */ -ATCOMMAND_FUNC(reloadscript); +ACMD_FUNC(reloadscript); #endif /* TXT_ONLY */ -ATCOMMAND_FUNC(reloadgmdb); // by Yor -ATCOMMAND_FUNC(mapexit); -ATCOMMAND_FUNC(idsearch); -ATCOMMAND_FUNC(mapinfo); -ATCOMMAND_FUNC(dye); //** by fritz -ATCOMMAND_FUNC(hair_style); //** by fritz -ATCOMMAND_FUNC(hair_color); //** by fritz -ATCOMMAND_FUNC(stat_all); //** by fritz -ATCOMMAND_FUNC(char_change_sex); // by Yor -ATCOMMAND_FUNC(char_block); // by Yor -ATCOMMAND_FUNC(char_ban); // by Yor -ATCOMMAND_FUNC(char_unblock); // by Yor -ATCOMMAND_FUNC(char_unban); // by Yor -ATCOMMAND_FUNC(mount_peco); // by Valaris -ATCOMMAND_FUNC(char_mount_peco); // by Yor -ATCOMMAND_FUNC(guildspy); // [Syrus22] -ATCOMMAND_FUNC(partyspy); // [Syrus22] -ATCOMMAND_FUNC(repairall); // [Valaris] -ATCOMMAND_FUNC(guildrecall); // by Yor -ATCOMMAND_FUNC(partyrecall); // by Yor -//ATCOMMAND_FUNC(nuke); // [Valaris] -ATCOMMAND_FUNC(enablenpc); -ATCOMMAND_FUNC(disablenpc); -ATCOMMAND_FUNC(servertime); // by Yor -ATCOMMAND_FUNC(chardelitem); // by Yor -ATCOMMAND_FUNC(jail); // by Yor -ATCOMMAND_FUNC(unjail); // by Yor -ATCOMMAND_FUNC(disguise); // [Valaris] -ATCOMMAND_FUNC(undisguise); // by Yor -ATCOMMAND_FUNC(chardisguise); // Kalaspuff -ATCOMMAND_FUNC(charundisguise); // Kalaspuff -ATCOMMAND_FUNC(email); // by Yor -ATCOMMAND_FUNC(effect);//by Apple -ATCOMMAND_FUNC(character_item_list); // by Yor -ATCOMMAND_FUNC(character_storage_list); // by Yor -ATCOMMAND_FUNC(character_cart_list); // by Yor -ATCOMMAND_FUNC(addwarp); // by MouseJstr -ATCOMMAND_FUNC(follow); // by MouseJstr -ATCOMMAND_FUNC(skillon); // by MouseJstr -ATCOMMAND_FUNC(skilloff); // by MouseJstr -ATCOMMAND_FUNC(killer); // by MouseJstr -ATCOMMAND_FUNC(npcmove); // by MouseJstr -ATCOMMAND_FUNC(killable); // by MouseJstr -ATCOMMAND_FUNC(charkillable); // by MouseJstr -ATCOMMAND_FUNC(chareffect); // by MouseJstr -ATCOMMAND_FUNC(dropall); // by MouseJstr -ATCOMMAND_FUNC(chardropall); // by MouseJstr -ATCOMMAND_FUNC(storeall); // by MouseJstr -ATCOMMAND_FUNC(charstoreall); // by MouseJstr -ATCOMMAND_FUNC(skillid); // by MouseJstr -ATCOMMAND_FUNC(useskill); // by MouseJstr -ATCOMMAND_FUNC(summon); -ATCOMMAND_FUNC(rain); -ATCOMMAND_FUNC(snow); -ATCOMMAND_FUNC(sakura); -ATCOMMAND_FUNC(fog); -ATCOMMAND_FUNC(leaves); -ATCOMMAND_FUNC(adjgmlvl); // by MouseJstr -ATCOMMAND_FUNC(adjcmdlvl); // by MouseJstr -ATCOMMAND_FUNC(trade); // by MouseJstr -ATCOMMAND_FUNC(send); // by davidsiaw -ATCOMMAND_FUNC(setbattleflag); // by MouseJstr -ATCOMMAND_FUNC(unmute); // [Valaris] -ATCOMMAND_FUNC(clearweather); // Dexity -ATCOMMAND_FUNC(uptime); // by MC Cameri -ATCOMMAND_FUNC(changesex); // by MC Cameri -ATCOMMAND_FUNC(mute); // celest -ATCOMMAND_FUNC(refresh); // by MC Cameri -ATCOMMAND_FUNC(petid); // by MC Cameri -ATCOMMAND_FUNC(identify); // by MC Cameri -ATCOMMAND_FUNC(gmotd); // Added by MC Cameri, created by davidsiaw -ATCOMMAND_FUNC(misceffect); // by MC Cameri +ACMD_FUNC(reloadgmdb); // by Yor +ACMD_FUNC(mapexit); +ACMD_FUNC(idsearch); +ACMD_FUNC(mapinfo); +ACMD_FUNC(dye); //** by fritz +ACMD_FUNC(hair_style); //** by fritz +ACMD_FUNC(hair_color); //** by fritz +ACMD_FUNC(stat_all); //** by fritz +ACMD_FUNC(char_change_sex); // by Yor +ACMD_FUNC(char_block); // by Yor +ACMD_FUNC(char_ban); // by Yor +ACMD_FUNC(char_unblock); // by Yor +ACMD_FUNC(char_unban); // by Yor +ACMD_FUNC(mount_peco); // by Valaris +ACMD_FUNC(char_mount_peco); // by Yor +ACMD_FUNC(guildspy); // [Syrus22] +ACMD_FUNC(partyspy); // [Syrus22] +ACMD_FUNC(repairall); // [Valaris] +ACMD_FUNC(guildrecall); // by Yor +ACMD_FUNC(partyrecall); // by Yor +//ACMD_FUNC(nuke); // [Valaris] +ACMD_FUNC(enablenpc); +ACMD_FUNC(disablenpc); +ACMD_FUNC(servertime); // by Yor +ACMD_FUNC(chardelitem); // by Yor +ACMD_FUNC(jail); // by Yor +ACMD_FUNC(unjail); // by Yor +ACMD_FUNC(disguise); // [Valaris] +ACMD_FUNC(undisguise); // by Yor +ACMD_FUNC(chardisguise); // Kalaspuff +ACMD_FUNC(charundisguise); // Kalaspuff +ACMD_FUNC(email); // by Yor +ACMD_FUNC(effect);//by Apple +ACMD_FUNC(character_storage_list); // by Yor +ACMD_FUNC(character_cart_list); // by Yor +ACMD_FUNC(addwarp); // by MouseJstr +ACMD_FUNC(follow); // by MouseJstr +ACMD_FUNC(skillon); // by MouseJstr +ACMD_FUNC(skilloff); // by MouseJstr +ACMD_FUNC(killer); // by MouseJstr +ACMD_FUNC(npcmove); // by MouseJstr +ACMD_FUNC(killable); // by MouseJstr +ACMD_FUNC(charkillable); // by MouseJstr +ACMD_FUNC(chareffect); // by MouseJstr +ACMD_FUNC(dropall); // by MouseJstr +ACMD_FUNC(chardropall); // by MouseJstr +ACMD_FUNC(storeall); // by MouseJstr +ACMD_FUNC(charstoreall); // by MouseJstr +ACMD_FUNC(skillid); // by MouseJstr +ACMD_FUNC(useskill); // by MouseJstr +ACMD_FUNC(summon); +ACMD_FUNC(rain); +ACMD_FUNC(snow); +ACMD_FUNC(sakura); +ACMD_FUNC(fog); +ACMD_FUNC(leaves); +ACMD_FUNC(adjgmlvl); // by MouseJstr +ACMD_FUNC(adjcmdlvl); // by MouseJstr +ACMD_FUNC(trade); // by MouseJstr +ACMD_FUNC(send); // by davidsiaw +ACMD_FUNC(setbattleflag); // by MouseJstr +ACMD_FUNC(unmute); // [Valaris] +ACMD_FUNC(clearweather); // Dexity +ACMD_FUNC(uptime); // by MC Cameri +ACMD_FUNC(changesex); // by MC Cameri +ACMD_FUNC(mute); // celest +ACMD_FUNC(refresh); // by MC Cameri +ACMD_FUNC(petid); // by MC Cameri +ACMD_FUNC(identify); // by MC Cameri +ACMD_FUNC(gmotd); // Added by MC Cameri, created by davidsiaw +ACMD_FUNC(misceffect); // by MC Cameri #ifndef TXT_ONLY -ATCOMMAND_FUNC(checkmail); // [Valaris] -ATCOMMAND_FUNC(listmail); // [Valaris] -ATCOMMAND_FUNC(listnewmail); // [Valaris] -ATCOMMAND_FUNC(readmail); // [Valaris] -ATCOMMAND_FUNC(sendmail); // [Valaris] -ATCOMMAND_FUNC(sendprioritymail); // [Valaris] -ATCOMMAND_FUNC(deletemail); // [Valaris] -ATCOMMAND_FUNC(sound); // [Valaris] -ATCOMMAND_FUNC(refreshonline); // [Valaris] +ACMD_FUNC(checkmail); // [Valaris] +ACMD_FUNC(listmail); // [Valaris] +ACMD_FUNC(listnewmail); // [Valaris] +ACMD_FUNC(readmail); // [Valaris] +ACMD_FUNC(sendmail); // [Valaris] +ACMD_FUNC(sendprioritymail); // [Valaris] +ACMD_FUNC(deletemail); // [Valaris] +ACMD_FUNC(sound); // [Valaris] +ACMD_FUNC(refreshonline); // [Valaris] #endif /* TXT_ONLY */ -ATCOMMAND_FUNC(skilltree); // by MouseJstr +ACMD_FUNC(skilltree); // by MouseJstr -ATCOMMAND_FUNC(marry); // by MouseJstr -ATCOMMAND_FUNC(divorce); // by MouseJstr -ATCOMMAND_FUNC(rings); // by MouseJstr +ACMD_FUNC(marry); // by MouseJstr +ACMD_FUNC(divorce); // by MouseJstr +ACMD_FUNC(rings); // by MouseJstr /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 @@ -421,7 +420,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_CharUnDisguise, "@charundisguise", 60, atcommand_charundisguise }, // Kalaspuff { AtCommand_EMail, "@email", 0, atcommand_email }, // by Yor { AtCommand_Effect, "@effect", 40, atcommand_effect }, // by Apple - { AtCommand_Char_Item_List, "@charitemlist", 40, atcommand_character_item_list }, // by Yor +// { AtCommand_Char_Item_List, "@charitemlist", 40, atcommand_character_item_list }, // by Yor, now #itemlist { AtCommand_Char_Storage_List, "@charstoragelist", 40, atcommand_character_storage_list }, // by Yor { AtCommand_Char_Cart_List, "@charcartlist", 40, atcommand_character_cart_list }, // by Yor { AtCommand_Follow, "@follow", 10, atcommand_follow }, // by MouseJstr @@ -2068,7 +2067,11 @@ int atcommand_jobchange( job = 4015; } } - + int j; + for (j=0; j < MAX_INVENTORY; j++) { + if(sd->status.inventory[j].nameid>0 && sd->status.inventory[j].equip!=0) + pc_unequipitem(sd, j, 3); + } if (pc_jobchange(sd, job, upper) == 0) clif_displaymessage(fd, msg_table[12]); // Your job has been changed. else { @@ -6724,120 +6727,6 @@ int atcommand_effect( return 0; } -/*========================================== - * @charitemlist : Displays the list of a player's items. - *------------------------------------------ - */ -int -atcommand_character_item_list( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - struct map_session_data *pl_sd; - struct item_data *item_data, *item_temp; - int i, j, equip, count, counter, counter2; - char character[100], output[200], equipstr[100], outputtmp[200]; - nullpo_retr(-1, sd); - - memset(character, '\0', sizeof(character)); - memset(output, '\0', sizeof(output)); - memset(equipstr, '\0', sizeof(equipstr)); - memset(outputtmp, '\0', sizeof(outputtmp)); - - if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @charitemlist )."); - return -1; - } - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level - counter = 0; - count = 0; - for (i = 0; i < MAX_INVENTORY; i++) { - if (pl_sd->status.inventory[i].nameid > 0 && (item_data = itemdb_search(pl_sd->status.inventory[i].nameid)) != NULL) { - counter = counter + pl_sd->status.inventory[i].amount; - count++; - if (count == 1) { - sprintf(output, "------ Items list of '%s' ------", pl_sd->status.name); - clif_displaymessage(fd, output); - } - if ((equip = pl_sd->status.inventory[i].equip)) { - strcpy(equipstr, "| equiped: "); - if (equip & 4) - strcat(equipstr, "robe/gargment, "); - if (equip & 8) - strcat(equipstr, "left accessory, "); - if (equip & 16) - strcat(equipstr, "body/armor, "); - if ((equip & 34) == 2) - strcat(equipstr, "right hand, "); - if ((equip & 34) == 32) - strcat(equipstr, "left hand, "); - if ((equip & 34) == 34) - strcat(equipstr, "both hands, "); - if (equip & 64) - strcat(equipstr, "feet, "); - if (equip & 128) - strcat(equipstr, "right accessory, "); - if ((equip & 769) == 1) - strcat(equipstr, "lower head, "); - if ((equip & 769) == 256) - strcat(equipstr, "top head, "); - if ((equip & 769) == 257) - strcat(equipstr, "lower/top head, "); - if ((equip & 769) == 512) - strcat(equipstr, "mid head, "); - if ((equip & 769) == 512) - strcat(equipstr, "lower/mid head, "); - if ((equip & 769) == 769) - strcat(equipstr, "lower/mid/top head, "); - // remove final ', ' - equipstr[strlen(equipstr) - 2] = '\0'; - } else - memset(equipstr, '\0', sizeof(equipstr)); - if (sd->status.inventory[i].refine) - sprintf(output, "%d %s %+d (%s %+d, id: %d) %s", pl_sd->status.inventory[i].amount, item_data->name, pl_sd->status.inventory[i].refine, item_data->jname, pl_sd->status.inventory[i].refine, pl_sd->status.inventory[i].nameid, equipstr); - else - sprintf(output, "%d %s (%s, id: %d) %s", pl_sd->status.inventory[i].amount, item_data->name, item_data->jname, pl_sd->status.inventory[i].nameid, equipstr); - clif_displaymessage(fd, output); - memset(output, '\0', sizeof(output)); - counter2 = 0; - for (j = 0; j < item_data->slot; j++) { - if (pl_sd->status.inventory[i].card[j]) { - if ((item_temp = itemdb_search(pl_sd->status.inventory[i].card[j])) != NULL) { - if (output[0] == '\0') - sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - else - sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - strcat(output, outputtmp); - } - } - } - if (output[0] != '\0') { - output[strlen(output) - 2] = ')'; - output[strlen(output) - 1] = '\0'; - clif_displaymessage(fd, output); - } - } - } - if (count == 0) - clif_displaymessage(fd, "No item found on this player."); - else { - sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); - clif_displaymessage(fd, output); - } - } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; - } - - return 0; -} - /*========================================== * @charstoragelist : Displays the items list of a player's storage. *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 5cb40b433..60564491b 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -157,7 +157,6 @@ enum AtCommandType { AtCommand_EMail, // by Yor AtCommand_Hatch, AtCommand_Effect, // by Apple - AtCommand_Char_Item_List, // by Yor AtCommand_Char_Storage_List, // by Yor AtCommand_Char_Cart_List, // by Yor AtCommand_AddWarp, // by MouseJstr diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 56cf6b316..d792d337a 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -43,6 +43,7 @@ CCMD_FUNC(save); CCMD_FUNC(stats_all); CCMD_FUNC(reset); CCMD_FUNC(spiritball); +CCMD_FUNC(itemlist); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -72,6 +73,7 @@ static CharCommandInfo charcommand_info[] = { { CharCommandSave, "#save", 60, charcommand_save }, { CharCommandStatsAll, "#statsall", 40, charcommand_stats_all }, { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball }, + { CharCommandItemList, "#itemlist", 40, charcommand_itemlist }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -317,7 +319,11 @@ int charcommand_jobchange( job = 4015; } } - + int j; + for (j=0; j < MAX_INVENTORY; j++) { + if(pl_sd->status.inventory[j].nameid>0 && pl_sd->status.inventory[j].equip!=0) + pc_unequipitem(pl_sd, j, 3); + } if (pc_jobchange(pl_sd, job, upper) == 0) clif_displaymessage(fd, msg_table[48]); // Character's job changed. else { @@ -744,3 +750,117 @@ int charcommand_spiritball(const int fd, struct map_session_data* sd,const char* } return 0; } + +/*========================================== + * #itemlist : Displays the list of a player's items. + *------------------------------------------ + */ +int +charcommand_itemlist( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct map_session_data *pl_sd; + struct item_data *item_data, *item_temp; + int i, j, equip, count, counter, counter2; + char character[100], output[200], equipstr[100], outputtmp[200]; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + memset(output, '\0', sizeof(output)); + memset(equipstr, '\0', sizeof(equipstr)); + memset(outputtmp, '\0', sizeof(outputtmp)); + + if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist )."); + return -1; + } + + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level + counter = 0; + count = 0; + for (i = 0; i < MAX_INVENTORY; i++) { + if (pl_sd->status.inventory[i].nameid > 0 && (item_data = itemdb_search(pl_sd->status.inventory[i].nameid)) != NULL) { + counter = counter + pl_sd->status.inventory[i].amount; + count++; + if (count == 1) { + sprintf(output, "------ Items list of '%s' ------", pl_sd->status.name); + clif_displaymessage(fd, output); + } + if ((equip = pl_sd->status.inventory[i].equip)) { + strcpy(equipstr, "| equiped: "); + if (equip & 4) + strcat(equipstr, "robe/gargment, "); + if (equip & 8) + strcat(equipstr, "left accessory, "); + if (equip & 16) + strcat(equipstr, "body/armor, "); + if ((equip & 34) == 2) + strcat(equipstr, "right hand, "); + if ((equip & 34) == 32) + strcat(equipstr, "left hand, "); + if ((equip & 34) == 34) + strcat(equipstr, "both hands, "); + if (equip & 64) + strcat(equipstr, "feet, "); + if (equip & 128) + strcat(equipstr, "right accessory, "); + if ((equip & 769) == 1) + strcat(equipstr, "lower head, "); + if ((equip & 769) == 256) + strcat(equipstr, "top head, "); + if ((equip & 769) == 257) + strcat(equipstr, "lower/top head, "); + if ((equip & 769) == 512) + strcat(equipstr, "mid head, "); + if ((equip & 769) == 512) + strcat(equipstr, "lower/mid head, "); + if ((equip & 769) == 769) + strcat(equipstr, "lower/mid/top head, "); + // remove final ', ' + equipstr[strlen(equipstr) - 2] = '\0'; + } else + memset(equipstr, '\0', sizeof(equipstr)); + if (sd->status.inventory[i].refine) + sprintf(output, "%d %s %+d (%s %+d, id: %d) %s", pl_sd->status.inventory[i].amount, item_data->name, pl_sd->status.inventory[i].refine, item_data->jname, pl_sd->status.inventory[i].refine, pl_sd->status.inventory[i].nameid, equipstr); + else + sprintf(output, "%d %s (%s, id: %d) %s", pl_sd->status.inventory[i].amount, item_data->name, item_data->jname, pl_sd->status.inventory[i].nameid, equipstr); + clif_displaymessage(fd, output); + memset(output, '\0', sizeof(output)); + counter2 = 0; + for (j = 0; j < item_data->slot; j++) { + if (pl_sd->status.inventory[i].card[j]) { + if ((item_temp = itemdb_search(pl_sd->status.inventory[i].card[j])) != NULL) { + if (output[0] == '\0') + sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + else + sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + strcat(output, outputtmp); + } + } + } + if (output[0] != '\0') { + output[strlen(output) - 2] = ')'; + output[strlen(output) - 1] = '\0'; + clif_displaymessage(fd, output); + } + } + } + if (count == 0) + clif_displaymessage(fd, "No item found on this player."); + else { + sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); + clif_displaymessage(fd, output); + } + } else { + clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 27629d9b7..f95fb631c 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -12,6 +12,7 @@ enum CharCommandType { CharCommandSave, CharCommandStatsAll, CharCommandSpiritball, + CharCommandItemList, #ifdef TXT_ONLY /* TXT_ONLY */ diff --git a/src/map/map.c b/src/map/map.c index 9e50b2f01..31bb76370 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2309,7 +2309,6 @@ int do_init(int argc, char *argv[]) { srand(gettick()); for (i = 1; i < argc ; i++) { - if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "--h") == 0 || strcmp(argv[i], "--?") == 0 || strcmp(argv[i], "/?") == 0) map_helpscreen(1); if (strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "--v") == 0 || strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "/v") == 0) @@ -2405,9 +2404,7 @@ int do_init(int argc, char *argv[]) { //Added by Mugendai for GUI support if (flush_on) - { add_timer_interval(gettick()+10, flush_timer,0,0,flush_time); - } #ifndef TXT_ONLY // online status timer, checks every hour [Valaris] add_timer_func_list(online_timer, "online_timer"); @@ -2447,7 +2444,7 @@ int do_init(int argc, char *argv[]) { } if (battle_config.pk_mode == 1) - printf("The server is running in \033[1;31mPK Mode\033[0m.\n"); + ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n"); //Added for Mugendais I'm Alive mod if (imalive_on) -- cgit v1.2.3-70-g09d2 From c2ab3377eafb9f941344a388f038ecec45f87f9c Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Fri, 17 Dec 2004 10:53:38 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@595 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 2 ++ conf-tmpl/charcommand_athena.conf | 3 ++- src/common/db.c | 2 +- src/map/atcommand.c | 30 ------------------------------ src/map/atcommand.h | 2 +- src/map/charcommand.c | 31 +++++++++++++++++++++++++++++++ src/map/charcommand.h | 1 + 7 files changed, 38 insertions(+), 33 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog.txt b/Changelog.txt index 69884439d..647006597 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,7 @@ Date Added 12/17 + * Fixed warning message in db.c line 445 [MC Cameri] + * Added #effect, removed @chareffect [MC Cameri] * Reverted a change in map.c causing problems, sorry >.< [celest] * Updated Sphere Mine - it'll now move in the opposite direction if being hit by its master [celest] diff --git a/conf-tmpl/charcommand_athena.conf b/conf-tmpl/charcommand_athena.conf index 064a79327..9815f669b 100644 --- a/conf-tmpl/charcommand_athena.conf +++ b/conf-tmpl/charcommand_athena.conf @@ -17,4 +17,5 @@ option: 60 save: 60 statsall: 40 spiritball: 60 -itemlist: 40 \ No newline at end of file +itemlist: 40 +effect: 40 \ No newline at end of file diff --git a/src/common/db.c b/src/common/db.c index 304165fc2..95a9b3578 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -442,7 +442,7 @@ void db_foreach(struct dbt *table,int (*func)(void*,void*,va_list),...) sp=0; while(1){ if (!p->data) { - printf("Warning: no data for key %d in db_foreach (db.c) !\n",p->key); + printf("Warning: no data for key %d in db_foreach (db.c) !\n",(int)p->key); } else { func(p->key, p->data, ap); } diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d1f645d9c..fcd6812f6 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -186,7 +186,6 @@ ACMD_FUNC(killer); // by MouseJstr ACMD_FUNC(npcmove); // by MouseJstr ACMD_FUNC(killable); // by MouseJstr ACMD_FUNC(charkillable); // by MouseJstr -ACMD_FUNC(chareffect); // by MouseJstr ACMD_FUNC(dropall); // by MouseJstr ACMD_FUNC(chardropall); // by MouseJstr ACMD_FUNC(storeall); // by MouseJstr @@ -433,7 +432,6 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_NpcMove, "@npcmove", 20, atcommand_npcmove }, // by MouseJstr { AtCommand_Killable, "@killable", 40, atcommand_killable }, // by MouseJstr { AtCommand_CharKillable, "@charkillable", 40, atcommand_charkillable }, // by MouseJstr - { AtCommand_Chareffect, "@chareffect", 40, atcommand_chareffect }, // MouseJstr { AtCommand_Dropall, "@dropall", 40, atcommand_dropall }, // MouseJstr { AtCommand_Chardropall, "@chardropall", 40, atcommand_chardropall }, // MouseJstr { AtCommand_Storeall, "@storeall", 40, atcommand_storeall }, // MouseJstr @@ -7097,34 +7095,6 @@ atcommand_follow(const int fd, struct map_session_data* sd, } -/*========================================== - * @chareffect by [MouseJstr] - * - * Create a effect localized on another character - *------------------------------------------ - */ -int -atcommand_chareffect(const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - struct map_session_data *pl_sd = NULL; - char target[255]; - int type = 0; - nullpo_retr(-1, sd); - - if (!message || !*message || sscanf(message, "%d %s", &type, target) != 2) { - clif_displaymessage(fd, "usage: @chareffect ."); - return -1; - } - - if((pl_sd=map_nick2sd((char *) target)) == NULL) - return -1; - - clif_specialeffect(&pl_sd->bl, type, 0); - clif_displaymessage(fd, msg_table[229]); // Your effect has changed. - - return 0; -} /*========================================== * @dropall by [MouseJstr] * diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 96838b7ae..c1fede0ba 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -168,7 +168,7 @@ enum AtCommandType { AtCommand_NpcMove, // by MouseJstr AtCommand_Killable, // by MouseJstr AtCommand_CharKillable, // by MouseJstr - AtCommand_Chareffect, // by MouseJstr +// AtCommand_Chareffect, // by MouseJstr, now #effect AtCommand_Dropall, // by MouseJstr AtCommand_Chardropall, // by MouseJstr AtCommand_Storeall, // by MouseJstr diff --git a/src/map/charcommand.c b/src/map/charcommand.c index f38914553..277c9ebfd 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -44,6 +44,7 @@ CCMD_FUNC(stats_all); CCMD_FUNC(reset); CCMD_FUNC(spiritball); CCMD_FUNC(itemlist); +CCMD_FUNC(effect); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -74,6 +75,7 @@ static CharCommandInfo charcommand_info[] = { { CharCommandStatsAll, "#statsall", 40, charcommand_stats_all }, { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball }, { CharCommandItemList, "#itemlist", 40, charcommand_itemlist }, + { CharCommandEffect, "#effect", 40, charcommand_effect }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -864,3 +866,32 @@ charcommand_itemlist( return 0; } + +/*========================================== + * #effect by [MouseJstr] + * + * Create a effect localized on another character + *------------------------------------------ + */ +int +charcommand_effect(const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct map_session_data *pl_sd = NULL; + char target[255]; + int type = 0; + nullpo_retr(-1, sd); + + if (!message || !*message || sscanf(message, "%d %s", &type, target) != 2) { + clif_displaymessage(fd, "usage: #effect ."); + return -1; + } + + if((pl_sd=map_nick2sd((char *) target)) == NULL) + return -1; + + clif_specialeffect(&pl_sd->bl, type, 0); + clif_displaymessage(fd, msg_table[229]); // Your effect has changed. + + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index f95fb631c..215e13e05 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -13,6 +13,7 @@ enum CharCommandType { CharCommandStatsAll, CharCommandSpiritball, CharCommandItemList, + CharCommandEffect, #ifdef TXT_ONLY /* TXT_ONLY */ -- cgit v1.2.3-70-g09d2 From f70528b42e8781b3c50613c2de0204be890a5bb1 Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Fri, 17 Dec 2004 22:18:01 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@598 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 1 + conf-tmpl/atcommand_athena.conf | 3 -- conf-tmpl/charcommand_athena.conf | 3 +- src/map/atcommand.c | 88 +-------------------------------------- src/map/atcommand.h | 2 +- src/map/charcommand.c | 87 ++++++++++++++++++++++++++++++++++++++ src/map/charcommand.h | 1 + 7 files changed, 93 insertions(+), 92 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog.txt b/Changelog.txt index 135de68d0..22ea619b4 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Date Added 12/17 + * Added #storagelist, removed @charstoragelist [MC Cameri] * db.c: Fixed probs with OnInit, OnTime, and etc NPC probs Just reverted it back. [Lupus] * Fixed warning message in db.c line 445 [MC Cameri] diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf index cb2121245..149c1fac5 100644 --- a/conf-tmpl/atcommand_athena.conf +++ b/conf-tmpl/atcommand_athena.conf @@ -260,9 +260,6 @@ save: 40 // Do some visual effect on your character effect: 40 -// Display all items of a player's storage -charstoragelist: 40 - // Display all items of a player's cart charcartlist: 40 diff --git a/conf-tmpl/charcommand_athena.conf b/conf-tmpl/charcommand_athena.conf index 9815f669b..4fd8a7c20 100644 --- a/conf-tmpl/charcommand_athena.conf +++ b/conf-tmpl/charcommand_athena.conf @@ -18,4 +18,5 @@ save: 60 statsall: 40 spiritball: 60 itemlist: 40 -effect: 40 \ No newline at end of file +effect: 40 +storagelist: 40 \ No newline at end of file diff --git a/src/map/atcommand.c b/src/map/atcommand.c index fcd6812f6..aa4577891 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -176,7 +176,6 @@ ACMD_FUNC(chardisguise); // Kalaspuff ACMD_FUNC(charundisguise); // Kalaspuff ACMD_FUNC(email); // by Yor ACMD_FUNC(effect);//by Apple -ACMD_FUNC(character_storage_list); // by Yor ACMD_FUNC(character_cart_list); // by Yor ACMD_FUNC(addwarp); // by MouseJstr ACMD_FUNC(follow); // by MouseJstr @@ -422,7 +421,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_EMail, "@email", 0, atcommand_email }, // by Yor { AtCommand_Effect, "@effect", 40, atcommand_effect }, // by Apple // { AtCommand_Char_Item_List, "@charitemlist", 40, atcommand_character_item_list }, // by Yor, now #itemlist - { AtCommand_Char_Storage_List, "@charstoragelist", 40, atcommand_character_storage_list }, // by Yor +// { AtCommand_Char_Storage_List, "@charstoragelist", 40, atcommand_character_storage_list }, // by Yor, now #storagelist { AtCommand_Char_Cart_List, "@charcartlist", 40, atcommand_character_cart_list }, // by Yor { AtCommand_Follow, "@follow", 10, atcommand_follow }, // by MouseJstr { AtCommand_AddWarp, "@addwarp", 20, atcommand_addwarp }, // by MouseJstr @@ -6734,91 +6733,6 @@ int atcommand_effect( return 0; } -/*========================================== - * @charstoragelist : Displays the items list of a player's storage. - *------------------------------------------ - */ -int -atcommand_character_storage_list( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - struct storage *stor; - struct map_session_data *pl_sd; - struct item_data *item_data, *item_temp; - int i, j, count, counter, counter2; - char character[100], output[200], outputtmp[200]; - nullpo_retr(-1, sd); - - memset(character, '\0', sizeof(character)); - memset(output, '\0', sizeof(output)); - memset(outputtmp, '\0', sizeof(outputtmp)); - - if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @charitemlist )."); - return -1; - } - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level - if((stor = account2storage2(pl_sd->status.account_id)) != NULL) { - counter = 0; - count = 0; - for (i = 0; i < MAX_STORAGE; i++) { - if (stor->storage[i].nameid > 0 && (item_data = itemdb_search(stor->storage[i].nameid)) != NULL) { - counter = counter + stor->storage[i].amount; - count++; - if (count == 1) { - sprintf(output, "------ Storage items list of '%s' ------", pl_sd->status.name); - clif_displaymessage(fd, output); - } - if (stor->storage[i].refine) - sprintf(output, "%d %s %+d (%s %+d, id: %d)", stor->storage[i].amount, item_data->name, stor->storage[i].refine, item_data->jname, stor->storage[i].refine, stor->storage[i].nameid); - else - sprintf(output, "%d %s (%s, id: %d)", stor->storage[i].amount, item_data->name, item_data->jname, stor->storage[i].nameid); - clif_displaymessage(fd, output); - memset(output, '\0', sizeof(output)); - counter2 = 0; - for (j = 0; j < item_data->slot; j++) { - if (stor->storage[i].card[j]) { - if ((item_temp = itemdb_search(stor->storage[i].card[j])) != NULL) { - if (output[0] == '\0') - sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - else - sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - strcat(output, outputtmp); - } - } - } - if (output[0] != '\0') { - output[strlen(output) - 2] = ')'; - output[strlen(output) - 1] = '\0'; - clif_displaymessage(fd, output); - } - } - } - if (count == 0) - clif_displaymessage(fd, "No item found in the storage of this player."); - else { - sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); - clif_displaymessage(fd, output); - } - } else { - clif_displaymessage(fd, "This player has no storage."); - return 0; - } - } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; - } - - return 0; -} - /*========================================== * @charcartlist : Displays the items list of a player's cart. *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index c1fede0ba..696e391e6 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -158,7 +158,7 @@ enum AtCommandType { AtCommand_Hatch, AtCommand_Effect, // by Apple // AtCommand_Char_Item_List, // by Yor, now #itemlist - AtCommand_Char_Storage_List, // by Yor +// AtCommand_Char_Storage_List, // by Yor, now #storagelist AtCommand_Char_Cart_List, // by Yor AtCommand_AddWarp, // by MouseJstr AtCommand_Follow, // by MouseJstr diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 277c9ebfd..7ed86b299 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -45,6 +45,7 @@ CCMD_FUNC(reset); CCMD_FUNC(spiritball); CCMD_FUNC(itemlist); CCMD_FUNC(effect); +CCMD_FUNC(storagelist); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -76,6 +77,7 @@ static CharCommandInfo charcommand_info[] = { { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball }, { CharCommandItemList, "#itemlist", 40, charcommand_itemlist }, { CharCommandEffect, "#effect", 40, charcommand_effect }, + { CharCommandStorageList, "#storagelist", 40, charcommand_storagelist }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -895,3 +897,88 @@ charcommand_effect(const int fd, struct map_session_data* sd, return 0; } + +/*========================================== + * #storagelist : Displays the items list of a player's storage. + *------------------------------------------ + */ +int +charcommand_storage_list( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct storage *stor; + struct map_session_data *pl_sd; + struct item_data *item_data, *item_temp; + int i, j, count, counter, counter2; + char character[100], output[200], outputtmp[200]; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + memset(output, '\0', sizeof(output)); + memset(outputtmp, '\0', sizeof(outputtmp)); + + if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist )."); + return -1; + } + + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level + if((stor = account2storage2(pl_sd->status.account_id)) != NULL) { + counter = 0; + count = 0; + for (i = 0; i < MAX_STORAGE; i++) { + if (stor->storage[i].nameid > 0 && (item_data = itemdb_search(stor->storage[i].nameid)) != NULL) { + counter = counter + stor->storage[i].amount; + count++; + if (count == 1) { + sprintf(output, "------ Storage items list of '%s' ------", pl_sd->status.name); + clif_displaymessage(fd, output); + } + if (stor->storage[i].refine) + sprintf(output, "%d %s %+d (%s %+d, id: %d)", stor->storage[i].amount, item_data->name, stor->storage[i].refine, item_data->jname, stor->storage[i].refine, stor->storage[i].nameid); + else + sprintf(output, "%d %s (%s, id: %d)", stor->storage[i].amount, item_data->name, item_data->jname, stor->storage[i].nameid); + clif_displaymessage(fd, output); + memset(output, '\0', sizeof(output)); + counter2 = 0; + for (j = 0; j < item_data->slot; j++) { + if (stor->storage[i].card[j]) { + if ((item_temp = itemdb_search(stor->storage[i].card[j])) != NULL) { + if (output[0] == '\0') + sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + else + sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + strcat(output, outputtmp); + } + } + } + if (output[0] != '\0') { + output[strlen(output) - 2] = ')'; + output[strlen(output) - 1] = '\0'; + clif_displaymessage(fd, output); + } + } + } + if (count == 0) + clif_displaymessage(fd, "No item found in the storage of this player."); + else { + sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); + clif_displaymessage(fd, output); + } + } else { + clif_displaymessage(fd, "This player has no storage."); + return 0; + } + } else { + clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 215e13e05..b83f2b6e6 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -14,6 +14,7 @@ enum CharCommandType { CharCommandSpiritball, CharCommandItemList, CharCommandEffect, + CharCommandStorageList, #ifdef TXT_ONLY /* TXT_ONLY */ -- cgit v1.2.3-70-g09d2 From b1688563811b869b03e77b9b40424c7f1a06532f Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Fri, 17 Dec 2004 22:45:15 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@600 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 1 + conf-tmpl/charcommand_athena.conf | 3 +- src/map/charcommand.c | 79 +++++++++++++++++++++++++++++++++++++++ src/map/charcommand.h | 1 + 4 files changed, 83 insertions(+), 1 deletion(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog.txt b/Changelog.txt index 22ea619b4..53d018e1a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Date Added 12/17 + * Added #item [MC Cameri] * Added #storagelist, removed @charstoragelist [MC Cameri] * db.c: Fixed probs with OnInit, OnTime, and etc NPC probs Just reverted it back. [Lupus] diff --git a/conf-tmpl/charcommand_athena.conf b/conf-tmpl/charcommand_athena.conf index 4fd8a7c20..01c6d451d 100644 --- a/conf-tmpl/charcommand_athena.conf +++ b/conf-tmpl/charcommand_athena.conf @@ -19,4 +19,5 @@ statsall: 40 spiritball: 60 itemlist: 40 effect: 40 -storagelist: 40 \ No newline at end of file +storagelist: 40 +item: 60 \ No newline at end of file diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 9ae469b0d..2db2c8e84 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -46,6 +46,7 @@ CCMD_FUNC(spiritball); CCMD_FUNC(itemlist); CCMD_FUNC(effect); CCMD_FUNC(storagelist); +CCMD_FUNC(item); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -78,6 +79,7 @@ static CharCommandInfo charcommand_info[] = { { CharCommandItemList, "#itemlist", 40, charcommand_itemlist }, { CharCommandEffect, "#effect", 40, charcommand_effect }, { CharCommandStorageList, "#storagelist", 40, charcommand_storagelist }, + { CharCommandItem, "#item", 60, charcommand_item }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -982,3 +984,80 @@ charcommand_storagelist( return 0; } + +/*========================================== + * #item command (usage: #item ) + * by MC Cameri + *------------------------------------------ + */ +int charcommand_item( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char item_name[100]; + char character[100]; + struct map_session_data *pl_sd; + int number = 0, item_id, flag; + struct item item_tmp; + struct item_data *item_data; + int get_count, i, pet_id; + nullpo_retr(-1, sd); + + memset(item_name, '\0', sizeof(item_name)); + + if (!message || !*message || sscanf(message, "%99s %d %99[^\n]", item_name, &number, character) < 3) { + clif_displaymessage(fd, "Please, enter an item name/id (usage: #item )."); + return -1; + } + + if (number <= 0) + number = 1; + + item_id = 0; + if ((item_data = itemdb_searchname(item_name)) != NULL || + (item_data = itemdb_exists(atoi(item_name))) != NULL) + item_id = item_data->nameid; + + if (item_id >= 500) { + get_count = number; + // check pet egg + pet_id = search_petDB_index(item_id, PET_EGG); + if (item_data->type == 4 || item_data->type == 5 || + item_data->type == 7 || item_data->type == 8) { + get_count = 1; + } + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level + for (i = 0; i < number; i += get_count) { + // if pet egg + if (pet_id >= 0) { + sd->catch_target_class = pet_db[pet_id].class; + intif_create_pet(sd->status.account_id, sd->status.char_id, + pet_db[pet_id].class, mob_db[pet_db[pet_id].class].lv, + pet_db[pet_id].EggID, 0, pet_db[pet_id].intimate, + 100, 0, 1, pet_db[pet_id].jname); + // if not pet egg + } else { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = item_id; + item_tmp.identify = 1; + if ((flag = pc_additem((struct map_session_data*)sd, &item_tmp, get_count))) + clif_additem((struct map_session_data*)sd, 0, 0, flag); + } + } + clif_displaymessage(fd, msg_table[18]); // Item created. + } else { + clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[19]); // Invalid item ID or name. + return -1; + } + + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index b83f2b6e6..0e4992c84 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -15,6 +15,7 @@ enum CharCommandType { CharCommandItemList, CharCommandEffect, CharCommandStorageList, + CharCommandItem, // by MC Cameri #ifdef TXT_ONLY /* TXT_ONLY */ -- cgit v1.2.3-70-g09d2 From 39e8b5c44689ba92303be9b36a30d0ad08ddde45 Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Tue, 21 Dec 2004 20:52:27 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@708 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 6 +++++ npc/other/devnpc.txt | 5 +++- src/map/atcommand.c | 69 -------------------------------------------------- src/map/charcommand.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/map/charcommand.h | 1 + src/map/npc.c | 7 +++++- src/map/npc.h | 2 ++ src/map/script.c | 2 +- 8 files changed, 90 insertions(+), 72 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog.txt b/Changelog.txt index cca6b003d..6dc3c65b3 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,11 @@ Date Added 12/21 + * Added variable 'current_file' which tells the filename of the script while loading npcs [MC Cameri] + -the variable its set in do_init_npc() or something like that, so you can only access it + after the use of do_init_npc(). + * Fixed the display of a warning saying that a right curly brace was missing [MC Cameri] + * Removed @charwarp and @rura+ and added #warp, #rura, #rura+ [MC Cameri] + * Removed conf/npcs_list.txt, and placed it in npc/npcs_athena.conf [MC Cameri] * Moved some code in pc_break_equip that was causing compile errors [celest] * guild skills vanished due to incorrect placement of a check for quest skills in the calc_skilltree code [MouseJstr] diff --git a/npc/other/devnpc.txt b/npc/other/devnpc.txt index 5aa8b6ae2..f9890143d 100644 --- a/npc/other/devnpc.txt +++ b/npc/other/devnpc.txt @@ -228,10 +228,13 @@ Lariatalk: Lquote0: npctalk "OMGWTFBBQ"; - + break; Lquote1: npctalk "So its u -> 0"; npctalk "... That did not look right"; + break; +Lquote2: + npc Lquote2: diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7948b3c27..afc752d2e 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -41,7 +41,6 @@ char msg_table[1000][256]; // Server messages (0-499 reserved for GM commands, 5 #define ACMD_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) ACMD_FUNC(broadcast); ACMD_FUNC(localbroadcast); -ACMD_FUNC(rurap); ACMD_FUNC(rura); ACMD_FUNC(where); ACMD_FUNC(jumpto); @@ -254,8 +253,6 @@ ACMD_FUNC(charkillableid2); // by Dino9021 // First char of commands is configured in atcommand_athena.conf. Leave @ in this list for default value. // to set default level, read atcommand_athena.conf first please. static AtCommandInfo atcommand_info[] = { - { AtCommand_RuraP, "@rura+", 60, atcommand_rurap }, - { AtCommand_RuraP, "@charwarp", 60, atcommand_rurap }, { AtCommand_Rura, "@rura", 40, atcommand_rura }, { AtCommand_Warp, "@warp", 40, atcommand_rura }, { AtCommand_Where, "@where", 1, atcommand_where }, @@ -973,72 +970,6 @@ int atcommand_send( return 0; } -/*========================================== - * @rura+ - *------------------------------------------ - */ -int atcommand_rurap( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - char map_name[100]; - char character[100]; - int x = 0, y = 0; - struct map_session_data *pl_sd; - int m; - - nullpo_retr(-1, sd); - - memset(map_name, '\0', sizeof(map_name)); - memset(character, '\0', sizeof(character)); - - if (!message || !*message || sscanf(message, "%99s %d %d %99[^\n]", map_name, &x, &y, character) < 4) { - clif_displaymessage(fd, "Usage: @charwarp/@rura+ "); - return -1; - } - - if (x <= 0) - x = rand() % 399 + 1; - if (y <= 0) - y = rand() % 399 + 1; - if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) - strcat(map_name, ".gat"); - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level - if (x > 0 && x < 400 && y > 0 && y < 400) { - m = map_mapname2mapid(map_name); - if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp someone to this map."); - return -1; - } - if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp this player from its actual map."); - return -1; - } - if (pc_setpos(pl_sd, map_name, x, y, 3) == 0) { - clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped. - clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too). - } else { - clif_displaymessage(fd, msg_table[1]); // Map not found. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[2]); // Coordinates out of range. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; - } - - return 0; -} - // @rura /*========================================== * diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 2db2c8e84..893266396 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -47,6 +47,7 @@ CCMD_FUNC(itemlist); CCMD_FUNC(effect); CCMD_FUNC(storagelist); CCMD_FUNC(item); +CCMD_FUNC(warp); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -80,6 +81,9 @@ static CharCommandInfo charcommand_info[] = { { CharCommandEffect, "#effect", 40, charcommand_effect }, { CharCommandStorageList, "#storagelist", 40, charcommand_storagelist }, { CharCommandItem, "#item", 60, charcommand_item }, + { CharCommandWarp, "#warp", 60, charcommand_warp }, + { CharCommandWarp, "#rura", 60, charcommand_warp }, + { CharCommandWarp, "#rura+", 60, charcommand_warp }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -1061,3 +1065,69 @@ int charcommand_item( return 0; } + +/*========================================== + * #warp/#rura/#rura+ + *------------------------------------------ + */ +int charcommand_warp( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char map_name[100]; + char character[100]; + int x = 0, y = 0; + struct map_session_data *pl_sd; + int m; + + nullpo_retr(-1, sd); + + memset(map_name, '\0', sizeof(map_name)); + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%99s %d %d %99[^\n]", map_name, &x, &y, character) < 4) { + clif_displaymessage(fd, "Usage: #warp/#rura/#rura+ "); + return -1; + } + + if (x <= 0) + x = rand() % 399 + 1; + if (y <= 0) + y = rand() % 399 + 1; + if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) + strcat(map_name, ".gat"); + + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level + if (x > 0 && x < 400 && y > 0 && y < 400) { + m = map_mapname2mapid(map_name); + if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, "You are not authorised to warp someone to this map."); + return -1; + } + if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, "You are not authorised to warp this player from its actual map."); + return -1; + } + if (pc_setpos(pl_sd, map_name, x, y, 3) == 0) { + clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped. + clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too). + } else { + clif_displaymessage(fd, msg_table[1]); // Map not found. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[2]); // Coordinates out of range. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 0e4992c84..de7e83680 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -16,6 +16,7 @@ enum CharCommandType { CharCommandEffect, CharCommandStorageList, CharCommandItem, // by MC Cameri + CharCommandWarp, #ifdef TXT_ONLY /* TXT_ONLY */ diff --git a/src/map/npc.c b/src/map/npc.c index bb6b9138c..45e698676 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1674,7 +1674,11 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line } } if(curly_count > 0) { - printf("warning: Missing right curly at line %d\n",*lines); + printf("\n"); + snprintf(tmp_output,sizeof(tmp_output),"Script skipped. Missing rig" + "ht curly brace at line '"CL_WHITE"%d"CL_RESET"' of file \n\t'" + CL_WHITE"%s"CL_RESET"'.\n",*lines,current_file); + ShowWarning(tmp_output); script=NULL; //exit(1); //Wtf? We do we exit? } else { @@ -2319,6 +2323,7 @@ int do_init_npc(void) free(nsl->prev); nsl->prev = NULL; } + strcpy(current_file,nsl->name); fp=fopen(nsl->name,"r"); if (fp==NULL) { printf("file not found : %s\n",nsl->name); diff --git a/src/map/npc.h b/src/map/npc.h index 4f0c43cba..b3b38e5e0 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -48,5 +48,7 @@ int npc_gettimerevent_tick(struct npc_data *nd); int npc_settimerevent_tick(struct npc_data *nd,int newtimer); int npc_delete(struct npc_data *nd); +char current_file[1024]; + #endif diff --git a/src/map/script.c b/src/map/script.c index 5d9d60385..1bcb118ee 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1517,7 +1517,7 @@ int buildin_goto(struct script_state *st) int pos; if( st->stack->stack_data[st->start+2].type!=C_POS ){ - printf("script: goto: not label !\n"); + printf("script: goto: not label!\n"); st->state=END; return 0; } -- cgit v1.2.3-70-g09d2 From 98c2c3c621f32fdf36f23cfd09565f8af7753e7d Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Tue, 21 Dec 2004 22:44:37 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@714 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 1 + conf-tmpl/atcommand_athena.conf | 3 --- conf-tmpl/charcommand_athena.conf | 1 + npc/events/custom/uneasy_cemetery.txt | 6 ++--- npc/jobs/2-1/knight.txt | 4 +-- npc/other/devnpc.txt | 5 ++-- src/map/atcommand.c | 47 ----------------------------------- src/map/atcommand.h | 2 +- src/map/charcommand.c | 47 +++++++++++++++++++++++++++++++++++ src/map/charcommand.h | 1 + src/map/npc.c | 9 +++++-- 11 files changed, 63 insertions(+), 63 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog.txt b/Changelog.txt index 8c89ad9cb..f64ed5caa 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Date Added 12/21 + * Added #zeny, removed @charzeny [MC Cameri] * Since conf/maps_list.txt was removed, added conf/maps_athena.conf [Ajarn] * Fixed a few NPCs that were giving curly errors. It seems to be caused by a bug that the NPCs' last line isn't read or something [Codemaster] * Fixed a tiny compile warning in npc.c [Codemaster] diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf index 10e5440c0..5c4333fc4 100644 --- a/conf-tmpl/atcommand_athena.conf +++ b/conf-tmpl/atcommand_athena.conf @@ -386,9 +386,6 @@ charskreset: 60 // Saves the respawn point of another character. charsave: 60 -// Changes another character's zenny -charzeny: 60 - // Levels your guild to specified level (2 same commands). guildlvup: 60 guildlvlup: 60 diff --git a/conf-tmpl/charcommand_athena.conf b/conf-tmpl/charcommand_athena.conf index b2549f02b..9ef9a988a 100644 --- a/conf-tmpl/charcommand_athena.conf +++ b/conf-tmpl/charcommand_athena.conf @@ -22,5 +22,6 @@ spiritball: 60 item: 60 job: 60 jobchange: 60 +charzeny: 60 import: conf/import/charcommand_conf.txt diff --git a/npc/events/custom/uneasy_cemetery.txt b/npc/events/custom/uneasy_cemetery.txt index f9e9fe5d9..39bd9d762 100644 --- a/npc/events/custom/uneasy_cemetery.txt +++ b/npc/events/custom/uneasy_cemetery.txt @@ -19,8 +19,7 @@ //============================================================ -prontera.gat,3,3,3 script Uneasy_Check -1, -{ +prontera.gat,3,3,3 script Uneasy_Check -1,{ end; OnHour00: @@ -67,8 +66,7 @@ L_Start_Undead: mapannounce "prontera.gat","[Mother Mathana]: The cememtery has became restless! In the name of Odin, hurry to the Sanctuary! Save the city of Prontera!",0; } -prontera.gat,257,313,5 script Mother Mathana 79, -{ +prontera.gat,257,313,5 script Mother Mathana 79,{ mes "[Mother Mathana]"; if ($UNEASY_DL <= 0) goto L_Undead_Walk; mes "I'm afraid there's something wrong with our old cemetery..."; diff --git a/npc/jobs/2-1/knight.txt b/npc/jobs/2-1/knight.txt index a316be98f..70391767b 100644 --- a/npc/jobs/2-1/knight.txt +++ b/npc/jobs/2-1/knight.txt @@ -1504,8 +1504,7 @@ OnTimerWarp: //<------------------------------------------------------------------------------------------ Sir Grey (Final Test) ------------------------------------------------------------------------------------------------------>\\ -prt_in.gat,87,90,3 script Sir Grey 119, -{ +prt_in.gat,87,90,3 script Sir Grey 119,{ mes "[Sir Grey]"; if (class == Job_Knight) goto L_Knight; if (class == Job_Novice) goto L_Novice; @@ -1854,5 +1853,4 @@ M_Menu: M_End: close; - } diff --git a/npc/other/devnpc.txt b/npc/other/devnpc.txt index f9890143d..ec196fe6e 100644 --- a/npc/other/devnpc.txt +++ b/npc/other/devnpc.txt @@ -234,9 +234,8 @@ Lquote1: npctalk "... That did not look right"; break; Lquote2: - npc - -Lquote2: + npctalk "????"; + break; Lquote3: npctalk "OMGITSJEEBUS!#!@%!"; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index afc752d2e..b530376a1 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -131,7 +131,6 @@ ACMD_FUNC(charreset); ACMD_FUNC(charstpoint); ACMD_FUNC(charmodel); ACMD_FUNC(charskpoint); -ACMD_FUNC(charzeny); ACMD_FUNC(agitstart); ACMD_FUNC(agitend); ACMD_FUNC(reloaditemdb); @@ -379,7 +378,6 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_CharModel, "@charmodel", 50, atcommand_charmodel }, { AtCommand_CharSKPoint, "@charskpoint", 60, atcommand_charskpoint }, { AtCommand_CharSTPoint, "@charstpoint", 60, atcommand_charstpoint }, - { AtCommand_CharZeny, "@charzeny", 60, atcommand_charzeny }, { AtCommand_MapInfo, "@mapinfo", 99, atcommand_mapinfo }, { AtCommand_Dye, "@dye", 40, atcommand_dye }, // by fritz { AtCommand_Dye, "@ccolor", 40, atcommand_dye }, // by fritz @@ -5390,51 +5388,6 @@ int atcommand_charstpoint( return 0; } -/*========================================== - * Character Zeny Point (Rewritten by [Yor]) - *------------------------------------------ - */ -int atcommand_charzeny( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - struct map_session_data *pl_sd; - char character[100]; - int zeny = 0, new_zeny; - nullpo_retr(-1, sd); - - memset(character, '\0', sizeof(character)); - - if (!message || !*message || sscanf(message, "%d %99[^\n]", &zeny, character) < 2 || zeny == 0) { - clif_displaymessage(fd, "Please, enter a number and a player name (usage: @charzeny )."); - return -1; - } - - if ((pl_sd = map_nick2sd(character)) != NULL) { - new_zeny = pl_sd->status.zeny + zeny; - if (zeny > 0 && (zeny > MAX_ZENY || new_zeny > MAX_ZENY)) // fix positiv overflow - new_zeny = MAX_ZENY; - else if (zeny < 0 && (zeny < -MAX_ZENY || new_zeny < 0)) // fix negativ overflow - new_zeny = 0; - if (new_zeny != pl_sd->status.zeny) { - pl_sd->status.zeny = new_zeny; - clif_updatestatus(pl_sd, SP_ZENY); - clif_displaymessage(fd, msg_table[211]); // Character's number of zenys changed! - } else { - if (zeny < 0) - clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. - else - clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; - } - - return 0; -} - /*========================================== * Recall All Characters Online To Your Location *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index a6c0a5e9e..0458c8ae1 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -115,7 +115,7 @@ enum AtCommandType { AtCommand_CharModel, AtCommand_CharSKPoint, AtCommand_CharSTPoint, - AtCommand_CharZeny, +// AtCommand_CharZeny, //now #zeny AtCommand_RecallAll, AtCommand_ReloadItemDB, AtCommand_ReloadMobDB, diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 893266396..b5a3ba2f1 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -48,6 +48,7 @@ CCMD_FUNC(effect); CCMD_FUNC(storagelist); CCMD_FUNC(item); CCMD_FUNC(warp); +CCMD_FUNC(zeny); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -84,6 +85,7 @@ static CharCommandInfo charcommand_info[] = { { CharCommandWarp, "#warp", 60, charcommand_warp }, { CharCommandWarp, "#rura", 60, charcommand_warp }, { CharCommandWarp, "#rura+", 60, charcommand_warp }, + { CharCommandZeny, "#zeny", 60, charcommand_zeny }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -1131,3 +1133,48 @@ int charcommand_warp( return 0; } + +/*========================================== + * #zeny + *------------------------------------------ + */ +int charcommand_zeny( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct map_session_data *pl_sd; + char character[100]; + int zeny = 0, new_zeny; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%d %99[^\n]", &zeny, character) < 2 || zeny == 0) { + clif_displaymessage(fd, "Please, enter a number and a player name (usage: #zeny )."); + return -1; + } + + if ((pl_sd = map_nick2sd(character)) != NULL) { + new_zeny = pl_sd->status.zeny + zeny; + if (zeny > 0 && (zeny > MAX_ZENY || new_zeny > MAX_ZENY)) // fix positiv overflow + new_zeny = MAX_ZENY; + else if (zeny < 0 && (zeny < -MAX_ZENY || new_zeny < 0)) // fix negativ overflow + new_zeny = 0; + if (new_zeny != pl_sd->status.zeny) { + pl_sd->status.zeny = new_zeny; + clif_updatestatus(pl_sd, SP_ZENY); + clif_displaymessage(fd, msg_table[211]); // Character's number of zenys changed! + } else { + if (zeny < 0) + clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. + else + clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index de7e83680..0bc3b3f8a 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -17,6 +17,7 @@ enum CharCommandType { CharCommandStorageList, CharCommandItem, // by MC Cameri CharCommandWarp, + CharCommandZeny, #ifdef TXT_ONLY /* TXT_ONLY */ diff --git a/src/map/npc.c b/src/map/npc.c index 43b97b055..4a7704740 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1605,7 +1605,12 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line // 引数の個数チェック if (sscanf(w1,"%[^,],%d,%d,%d",mapname,&x,&y,&dir) != 4 || ( strcmp(w2,"script")==0 && strchr(w4,',')==NULL) ) { - printf("bad script line : %s\n",w3); + if (strlen(current_file)) { + printf("\n"); + sprintf(tmp_output,"Bad script on line '"CL_WHITE"%s"CL_RESET"' fro" + "m file '"CL_WHITE"%s"CL_RESET"'.\n",w3,current_file); + ShowError(tmp_output); + } return 1; } m = map_mapname2mapid(mapname); @@ -2411,7 +2416,7 @@ int do_init_npc(void) add_timer_func_list(npc_event_timer,"npc_event_timer"); add_timer_func_list(npc_event_do_clock,"npc_event_do_clock"); add_timer_func_list(npc_timerevent,"npc_timerevent"); - + memset(current_file,'\0',sizeof(current_file)); //exit(1); return 0; -- cgit v1.2.3-70-g09d2 From cb44aff61ed172eb338535078d772090b124d465 Mon Sep 17 00:00:00 2001 From: veider Date: Mon, 28 Mar 2005 21:25:11 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1316 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 10 +++++++ src/char_sql/char.c | 70 ++++++++++++++++++++++++++++++++++++++++++++---- src/char_sql/char.h | 4 +++ src/char_sql/int_party.c | 36 ++++++++++++++++++------- src/common/mmo.h | 3 +++ src/map/atcommand.c | 62 ++++++++++++++++++++++++++++++++++++++++++ src/map/atcommand.h | 1 + src/map/charcommand.c | 42 +++++++++++++++++++++++++++++ src/map/charcommand.h | 2 ++ src/map/clif.c | 2 +- src/map/map.h | 3 +++ src/map/pc.c | 43 ++++++++++++++++++++++++++--- src/map/pc.h | 1 + src/map/pet.c | 5 ++-- src/map/script.c | 2 +- src/map/skill.c | 4 +-- 16 files changed, 264 insertions(+), 26 deletions(-) (limited to 'src/map/charcommand.h') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 71262554f..9289fdbdb 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,5 +1,15 @@ Date Added +03/29 * Added three fields to mmo_charstatus - father/mother/child + needed for adoption system [veider] + * Added adoption support to charserver SQL version [veider] + * Added atcommand_adopt - create a family of three [veider] + * Added to char_commands showexp/showdelay so that + players could remove some messages [veider] + * Added percent to "Experience Gained" message [veider] + * Added adoption system support to party_check_exp_share() + so that parents can share exp with child [veider] + 03/28 * Fixed Auto Berserk activating by itself when changing maps [celest] * Re-fixed the SQL syntax crash in logging [celest] diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 6b122974f..0d3fc3d35 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -415,7 +415,8 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ (p->clothes_color != cp->clothes_color) || (p->weapon != cp->weapon) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || - (p->partner_id != cp->partner_id)) { + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child)) { //}//---------------------------test count------------------------------ //check party_exist @@ -457,7 +458,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," "`option`='%d',`karma`='%d',`manner`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d'," "`hair`='%d',`hair_color`='%d',`clothes_color`='%d',`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," - "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d',`partner_id`='%d' WHERE `account_id`='%d' AND `char_id` = '%d'", + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d',`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d' WHERE `account_id`='%d' AND `char_id` = '%d'", char_db, p->class_, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, @@ -466,7 +467,8 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ p->hair, p->hair_color, p->clothes_color, p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, p->last_point.map, p->last_point.x, p->last_point.y, - p->save_point.map, p->save_point.x, p->save_point.y, p->partner_id, p->account_id, p->char_id + p->save_point.map, p->save_point.x, p->save_point.y, p->partner_id, p->father, p->mother, + p->child, p->account_id, p->char_id ); if(mysql_query(&mysql_handle, tmp_sql)) { @@ -799,7 +801,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){ sprintf(tmp_sql, "SELECT `option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`hair`,`hair_color`," "`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`," - "`last_map`,`last_x`,`last_y`,`save_map`,`save_x`,`save_y`, `partner_id` FROM `%s` WHERE `char_id` = '%d'",char_db, char_id); // TBR + "`last_map`,`last_x`,`last_y`,`save_map`,`save_x`,`save_y`, `partner_id`, `father`, `mother`, `child` FROM `%s` WHERE `char_id` = '%d'",char_db, char_id); // TBR if (mysql_query(&mysql_handle, tmp_sql)) { printf("DB server Error (select `char2`)- %s\n", mysql_error(&mysql_handle)); } @@ -817,7 +819,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){ p->head_top = atoi(sql_row[11]); p->head_mid = atoi(sql_row[12]); p->head_bottom = atoi(sql_row[13]); strcpy(p->last_point.map,sql_row[14]); p->last_point.x = atoi(sql_row[15]); p->last_point.y = atoi(sql_row[16]); strcpy(p->save_point.map,sql_row[17]); p->save_point.x = atoi(sql_row[18]); p->save_point.y = atoi(sql_row[19]); - p->partner_id = atoi(sql_row[20]); + p->partner_id = atoi(sql_row[20]); p->father = atoi(sql_row[21]); p->mother = atoi(sql_row[22]); p->child = atoi(sql_row[23]); //free mysql result. mysql_free_result(sql_res); @@ -3564,3 +3566,61 @@ int debug_mysql_query(char *file, int line, void *mysql, const char *q) { #endif return mysql_query((MYSQL *) mysql, q); } + +int char_child(int parent_id, int child_id) { + int tmp_id = 0; + sprintf (tmp_sql, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id); + if (mysql_query (&mysql_handle, tmp_sql)) { + printf ("DB server Error (select `char2`)- %s\n", mysql_error (&mysql_handle)); + } + sql_res = mysql_store_result (&mysql_handle); + if (sql_res) { + sql_row = mysql_fetch_row (sql_res); + tmp_id = atoi (sql_row[0]); + mysql_free_result (sql_res); + } + else + printf("CHAR: child Failed!\n"); + if ( tmp_id == child_id ) + return 1; + else + return 0; +} + +int char_married(int pl1,int pl2) { + int tmp_id = 0; + sprintf (tmp_sql, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1); + if (mysql_query (&mysql_handle, tmp_sql)) { + printf ("DB server Error (select `char2`)- %s\n", mysql_error (&mysql_handle)); + } + sql_res = mysql_store_result (&mysql_handle); + if (sql_res) { + sql_row = mysql_fetch_row (sql_res); + tmp_id = atoi (sql_row[0]); + mysql_free_result (sql_res); + } + else + printf("CHAR: married Failed!\n"); + if ( tmp_id == pl2 ) + return 1; + else + return 0; +} + +int char_nick2id (char *name) { + int char_id = 0; + sprintf (tmp_sql, "SELECT `char_id` FROM `%s` WHERE `name` = '%s'", char_db, name); + if (mysql_query (&mysql_handle, tmp_sql)) { + printf ("DB server Error (select `char2`)- %s\n", mysql_error (&mysql_handle)); + } + sql_res = mysql_store_result (&mysql_handle); + if (sql_res) { + sql_row = mysql_fetch_row (sql_res); + char_id = atoi (sql_row[0]); + mysql_free_result (sql_res); + } + else + printf ("CHAR: nick2id Failed!\n"); + return char_id; +} + diff --git a/src/char_sql/char.h b/src/char_sql/char.h index 81ce65b8e..74bb28cf1 100644 --- a/src/char_sql/char.h +++ b/src/char_sql/char.h @@ -45,6 +45,10 @@ int mapif_sendall(unsigned char *buf,unsigned int len); int mapif_sendallwos(int fd,unsigned char *buf,unsigned int len); int mapif_send(int fd,unsigned char *buf,unsigned int len); +int char_nick2id (char *name); +int char_married(int pl1,int pl2); +int char_child(int parent_id, int child_id); + extern int autosave_interval; extern char db_path[]; extern char char_db[256]; diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c index 03392feb6..430385110 100644 --- a/src/char_sql/int_party.c +++ b/src/char_sql/int_party.c @@ -293,16 +293,32 @@ struct party* search_partyname(char *str) // EXP公平分配できるかチェック int party_check_exp_share(struct party *p) { - int i; - int maxlv=0,minlv=0x7fffffff; - for(i=0;imember[i].lv; - if( p->member[i].online ){ - if( lv < minlv ) minlv=lv; - if( maxlv < lv ) maxlv=lv; - } - } - return (maxlv==0 || maxlv-minlv<=party_share_level); + int i, dudes=0; + int pl1=0,pl2=0,pl3=0; + int maxlv=0,minlv=0x7fffffff; + for(i=0;imember[i].lv; + if (!lv) continue; + if( p->member[i].online ){ + if( lv < minlv ) minlv=lv; + if( maxlv < lv ) maxlv=lv; + if( lv >= 70 ) dudes+=1000; + dudes++; + } + } + if((dudes/1000 >= 2) && (dudes%1000 == 3) && (!strcmp(p->member[0].map,p->member[1].map)) && (!strcmp(p->member[1].map,p->member[2].map))) { + pl1=char_nick2id(p->member[0].name); + pl2=char_nick2id(p->member[1].name); + pl3=char_nick2id(p->member[2].name); + printf("PARTY: group of 3 Id1 %d lv %d name %s Id2 %d lv %d name %s Id3 %d lv %d name %s\n",pl1,p->member[0].lv,p->member[0].name,pl2,p->member[1].lv,p->member[1].name,pl3,p->member[2].lv,p->member[2].name); + if (char_married(pl1,pl2) && char_child(pl1,pl3)) + return 1; + if (char_married(pl1,pl3) && char_child(pl1,pl2)) + return 1; + if (char_married(pl2,pl3) && char_child(pl2,pl1)) + return 1; + } + return (maxlv==0 || maxlv-minlv<=party_share_level); } // Is there any member in the party? int party_check_empty(struct party *p) diff --git a/src/common/mmo.h b/src/common/mmo.h index 9cb9477d8..b61af6658 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -129,6 +129,9 @@ struct mmo_charstatus { int char_id; int account_id; int partner_id; + int father; + int mother; + int child; int base_exp,job_exp,zeny; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index bc11123b9..55a08873c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -260,6 +260,7 @@ ACMD_FUNC(undisguiseall); ACMD_FUNC(disguiseall); ACMD_FUNC(changelook); ACMD_FUNC(mobinfo); //by Lupus +ACMD_FUNC(adopt); // by Veider /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 @@ -541,6 +542,8 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_MobInfo, "@mobinfo", 1, atcommand_mobinfo }, // [Lupus] { AtCommand_MobInfo, "@monsterinfo", 1, atcommand_mobinfo }, // [Lupus] { AtCommand_MobInfo, "@mi", 1, atcommand_mobinfo }, // [Lupus] + { AtCommand_Adopt, "@adopt", 40, atcommand_adopt }, // [Veider] + // add new commands before this line { AtCommand_Unknown, NULL, 1, NULL } }; @@ -9069,3 +9072,62 @@ int atcommand_mobinfo( return 0; } + +/*========================================== + * @adopt by [Veider] + * + * adopt a novice + *------------------------------------------ + */ +int +atcommand_adopt(const int fd, struct map_session_data* sd, +const char* command, const char* message) +{ + struct map_session_data *pl_sd1 = NULL; + struct map_session_data *pl_sd2 = NULL; + struct map_session_data *pl_sd3 = NULL; + char player1[255], player2[255], player3[255]; + + nullpo_retr(-1, sd); + + if (!message || !*message) + return -1; + + if (sscanf(message, "%[^,],%[^,],%[^\r\n]", player1, player2, player3) != 3) { + clif_displaymessage(fd, "usage: @adopt ."); + return -1; + } + + printf("Adopting: --%s--%s--%s--\n",player1,player2,player3); + + if((pl_sd1=map_nick2sd((char *) player1)) == NULL) { + sprintf(player2, "Cannot find player %s online", player1); + clif_displaymessage(fd, player2); + return -1; + } + + if((pl_sd2=map_nick2sd((char *) player2)) == NULL) { + sprintf(player1, "Cannot find player %s online", player2); + clif_displaymessage(fd, player1); + return -1; + } + + if((pl_sd3=map_nick2sd((char *) player3)) == NULL) { + sprintf(player1, "Cannot find player %s online", player3); + clif_displaymessage(fd, player1); + return -1; + } + + if((pl_sd1->status.base_level < 70) || (pl_sd2->status.base_level < 70)){ + clif_displaymessage(fd, "They are too young to be parents!"); + return -1; + } + + if (pc_adoption(pl_sd1, pl_sd2, pl_sd3) == 0) { + clif_displaymessage(fd, "They are family.. wish them luck"); + return 0; + } + else + return -1; +} + diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 14a912ab1..f74ebeef3 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -241,6 +241,7 @@ enum AtCommandType { AtCommand_ChangeLook, AtCommand_AutoLoot, //by Upa-Kun AtCommand_MobInfo, //by Lupus + AtCommand_Adopt, // by Veider // end AtCommand_Unknown, diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 40961f39e..ab57a6b39 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -51,6 +51,8 @@ CCMD_FUNC(storagelist); CCMD_FUNC(item); CCMD_FUNC(warp); CCMD_FUNC(zeny); +CCMD_FUNC(showexp); +CCMD_FUNC(showdelay); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -88,6 +90,9 @@ static CharCommandInfo charcommand_info[] = { { CharCommandWarp, "#rura", 60, charcommand_warp }, { CharCommandWarp, "#rura+", 60, charcommand_warp }, { CharCommandZeny, "#zeny", 60, charcommand_zeny }, + { CharCommandShowExp, "#showexp", 0, charcommand_showexp}, + { CharCommandShowDelay, "#showdelay", 0, charcommand_showdelay}, + #ifdef TXT_ONLY /* TXT_ONLY */ @@ -1213,3 +1218,40 @@ int charcommand_zeny( return 0; } + +/*=================================== + * Remove some messages + *----------------------------------- + */ +int charcommand_showexp( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + if (sd->noexp) { + sd->noexp = 0; + clif_displaymessage(fd, "Gained exp is now shown"); + return 0; + } + else { + sd->noexp = 1; + clif_displaymessage(fd, "Gained exp is now NOT shown"); + return 0; + } +} + +int charcommand_showdelay( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + if (sd->nodelay) { + sd->nodelay = 0; + clif_displaymessage(fd, "Skill delay failure is now shown"); + return 0; + } + else { + sd->nodelay = 1; + clif_displaymessage(fd, "Skill delay failure is NOT now shown"); + return 0; + } +} + diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 0bc3b3f8a..7c1618cca 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -18,6 +18,8 @@ enum CharCommandType { CharCommandItem, // by MC Cameri CharCommandWarp, CharCommandZeny, + CharCommandShowDelay, + CharCommandShowExp, #ifdef TXT_ONLY /* TXT_ONLY */ diff --git a/src/map/clif.c b/src/map/clif.c index a3dea154f..5d34e0f64 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4333,7 +4333,7 @@ int clif_skill_fail(struct map_session_data *sd,int skill_id,int type,int btype) sd->skillid = sd->skilllv = -1; sd->skillitem = sd->skillitemlv = -1; - if(type==0x4 && battle_config.display_delay_skill_fail==0){ + if(type==0x4 && (battle_config.display_delay_skill_fail==0 || sd->nodelay)){ return 0; } diff --git a/src/map/map.h b/src/map/map.h index 2af4b9b4d..b25e6f05a 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -360,6 +360,9 @@ struct map_session_data { unsigned char change_level; // [celest] int autoloot; //by Upa-Kun + unsigned nodelay :1; + unsigned noexp :1; + unsigned detach :1; #ifndef TXT_ONLY int mail_counter; // mail counter for mail system [Valaris] diff --git a/src/map/pc.c b/src/map/pc.c index 7fb2bb42b..c9b8755de 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -47,6 +47,8 @@ static int exp_table[14][MAX_LEVEL]; static short statp[MAX_LEVEL]; +extern char msg_table[1000][256]; + // h-files are for declarations, not for implementations... [Shinomori] struct skill_tree_entry skill_tree[3][25][MAX_SKILL_TREE]; // timer for night.day implementation @@ -1153,6 +1155,7 @@ int pc_checkweighticon(struct map_session_data *sd) */ int pc_bonus(struct map_session_data *sd,int type,int val) { + int i; nullpo_retr(0, sd); switch(type){ @@ -1588,7 +1591,6 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_DAMAGE_WHEN_UNEQUIP: if(!sd->state.lr_flag) { - int i; for (i=0; i<11; i++) { if (sd->inventory_data[current_equip_item_index]->equip & equip_pos[i]) { sd->unequip_losehp[i] += val; @@ -1599,7 +1601,6 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_LOSESP_WHEN_UNEQUIP: if(!sd->state.lr_flag) { - int i; for (i=0; i<11; i++) { if (sd->inventory_data[current_equip_item_index]->equip & equip_pos[i]) { sd->unequip_losesp[i] += val; @@ -3968,6 +3969,8 @@ int pc_checkjoblevelup(struct map_session_data *sd) int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp) { char output[256]; + float nextbp=0, nextjp=0; + int nextb=0, nextj=0; nullpo_retr(0, sd); if(sd->bl.prev == NULL || pc_isdead(sd)) @@ -3992,6 +3995,12 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp) if (base_exp < 0) base_exp = 0; } + nextb = pc_nextbaseexp(sd); + nextj = pc_nextjobexp(sd); + if (nextb > 0) + nextbp = (float) base_exp / (float) nextb; + if (nextj > 0) + nextjp = (float) job_exp / (float) nextj; sd->status.base_exp += base_exp; if(sd->status.base_exp < 0) @@ -4014,9 +4023,9 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp) clif_updatestatus(sd,SP_JOBEXP); - if(battle_config.disp_experience){ + if(battle_config.disp_experience && !sd->noexp){ sprintf(output, - "Experienced Gained Base:%d Job:%d",base_exp,job_exp); + "Experienced Gained Base:%d (%.2f%%) Job:%d (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100); clif_disp_onlyself(sd,output,strlen(output)); } @@ -7300,3 +7309,29 @@ int do_init_pc(void) { return 0; } + +/*========================================== + * sd - father dstsd - mother jasd - child + */ +int pc_adoption(struct map_session_data *sd,struct map_session_data *dstsd, struct map_session_data *jasd) +{ + int j; + if(sd == NULL || dstsd == NULL || jasd == NULL || sd->status.partner_id <= 0 || dstsd->status.partner_id <= 0 || sd->status.partner_id != dstsd->status.char_id || dstsd->status.partner_id != sd->status.char_id || sd->status.child > 0 || dstsd->status.child || jasd->status.father > 0 || jasd->status.mother > 0) + return -1; + jasd->status.father=sd->status.char_id; + jasd->status.mother=dstsd->status.char_id; + sd->status.child=jasd->status.char_id; + dstsd->status.child=jasd->status.char_id; + for (j=0; j < MAX_INVENTORY; j++) { + if(jasd->status.inventory[j].nameid>0 && jasd->status.inventory[j].equip!=0) + pc_unequipitem(jasd, j, 3); + } + if (pc_jobchange(jasd, 4023, 0) == 0) + clif_displaymessage(jasd->fd, msg_table[12]); // Your job has been changed. + else { + clif_displaymessage(jasd->fd, msg_table[155]); // Impossible to change your job. + return -1; + } + return 0; +} + diff --git a/src/map/pc.h b/src/map/pc.h index 8c4f96529..1e5b3408f 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -166,6 +166,7 @@ int pc_calc_pvprank_timer(int tid,unsigned int tick,int id,int data); int pc_ismarried(struct map_session_data *sd); int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd); int pc_divorce(struct map_session_data *sd); +int pc_adoption(struct map_session_data *sd,struct map_session_data *dstsd,struct map_session_data *jasd); struct map_session_data *pc_get_partner(struct map_session_data *sd); int pc_set_gm_level(int account_id, int level); void pc_setstand(struct map_session_data *sd); diff --git a/src/map/pet.c b/src/map/pet.c index 553f64044..0a8a44e10 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1587,10 +1587,11 @@ int read_petdb() { FILE *fp; char line[1024]; - int i; + int nameid,i; int j=0; int lines; char *filename[]={"db/pet_db.txt","db/pet_db2.txt"}; + char *str[32],*p,*np; memset(pet_db,0,sizeof(pet_db)); for(i=0;i<2;i++){ @@ -1604,8 +1605,6 @@ int read_petdb() lines = 0; while(fgets(line,1020,fp)){ lines++; - int nameid,i; - char *str[32],*p,*np; if(line[0] == '/' && line[1] == '/') continue; diff --git a/src/map/script.c b/src/map/script.c index a732f7bc4..d7d5f433e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6980,6 +6980,7 @@ int buildin_cardscnt(struct script_state *st) struct map_session_data *sd; int i, k, id = 1; int ret = 0; + int index, type; sd = script_rid2sd(st); @@ -6988,7 +6989,6 @@ int buildin_cardscnt(struct script_state *st) if (id <= 0) continue; - int index, type; index = current_equip_item_index; //we get CURRENT WEAPON inventory index from status.c [Lupus] if(index < 0) continue; diff --git a/src/map/skill.c b/src/map/skill.c index 131e8324b..a6b7887f4 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1909,7 +1909,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data ) case BA_FROSTJOKE: /* 寒いジョ?ク */ case DC_SCREAM: /* スクリ?ム */ - range=15; //視界全? + range=battle_config.area_size; //視界全? map_foreachinarea(skill_frostjoke_scream,src->m,src->x-range,src->y-range, src->x+range,src->y+range,0,src,skl->skill_id,skl->skill_lv,tick); break; @@ -5205,7 +5205,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, case DC_DONTFORGETME: /* 私を忘れないで… */ if(src->type == BL_PC) val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1; - val2 = ((status_get_str(src)/20)&0xffff)<<16; + val2 = ((status_get_dex(src)/20)&0xffff)<<16; val2 |= (status_get_agi(src)/10)&0xffff; break; case BA_POEMBRAGI: /* ブラギの詩 */ -- cgit v1.2.3-70-g09d2