From 57ed6116c2f76419bc63bdd9b939bfc2f01aca1b Mon Sep 17 00:00:00 2001 From: mc_cameri Date: Sun, 21 Nov 2004 03:33:31 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@284 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 4 ++ npc/Changelog.txt | 1 + npc/other/devnpc.txt | 16 +++--- src/map/atcommand.c | 146 ++++++++++++++++++++++++++++++++++++++++----------- src/map/atcommand.h | 10 ++-- 5 files changed, 134 insertions(+), 43 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index d7874082d..81ce85c4c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Date Added 11/20 + * Added str_lower() function to atcommand.c (from OA). [MC Cameri] + * Simplified @charchangesex to @charchangesex [player], your sex is changed to the opposite one [MC Cameri] + * Added @refresh, which is like a @jumpto <>. [MC Cameri] + * Added @petid to find pet names, useful when you dont know which pets have eggs. [MC Cameri] * Added an effect_list in docs/ for descriptions, free to add onto that later. [spira] - Attempt to find new skill effects. * Added "nogo" mapflag to prevent the use of @go on a specified map. [Valaris] diff --git a/npc/Changelog.txt b/npc/Changelog.txt index 57bf19168..48d11e724 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -36,6 +36,7 @@ Date Added ====== 11/20 + * Fixed some typos in MC Cameri's Dev NPC, walking speed, etc. [MC Cameri] * Fixed spawns on umbala fields, Fixed spawn point of Amon Ra in morroc pyramids B2 [shadow] 11/21 * niflheim.txt: some typos in some variables fixed (thx 2 Dr.Evil) [Lupus] diff --git a/npc/other/devnpc.txt b/npc/other/devnpc.txt index 15cf4c502..3bfdc105b 100644 --- a/npc/other/devnpc.txt +++ b/npc/other/devnpc.txt @@ -65,16 +65,16 @@ OnInit: // MC Cameri =========================================================>\\ morocc.gat,160,97,4 script MC Cameri 706,{ - npcspeed 50; + npcspeed 100; mes "[MC Cameri]"; mes "I'm the @command guy from oA..."; - mes "^FF00FFReal Name^000000: Can't tell you my name"; - mes "^FF00FFAge^000000: 16 years"; - mes "^FF00FFWhere I live^000000: Dominican Republic, in the caribbean"; + mes "^FF8040Real Name^000000: Can't tell you my name"; + mes "^FF8040Age^000000: 16 years"; + mes "^FF8040Where I live^000000: Dominican Republic, in the caribbean"; next; mes "[MC Cameri]"; - mes "^FF00FFWhat I Do^000000: mostly working on @commands for GMs..."; - mes "^FF00FFWhy I'm here^000000: Because I like programming..."; + mes "^FF8040What I Do^000000: mostly working on @commands for GMs..."; + mes "^FF8040Why I'm here^000000: Because I like programming..."; next; mes "[MC Cameri]"; mes "I'm a senior student, programmer, body builder(yes, I lift weights), etc."; @@ -102,11 +102,11 @@ Lquote0: setnpctimer 0; break; Lquote1: - npctalk "160,95-I owns you all, under my commands. *lol*"; + npctalk "I owns you all, under my commands. *lol*"; setnpctimer 0; break; Lquote2: - npctalk "I forgot what my script, what do I have to say again? *_*U"; + npctalk "I forgot my script, what do I have to say again? *_*U"; setnpctimer 0; break; Lquote3: diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 265180932..d5f86d8ff 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -217,6 +217,9 @@ ATCOMMAND_FUNC(unmute); // [Valaris] 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); #ifndef TXT_ONLY ATCOMMAND_FUNC(checkmail); // [Valaris] @@ -467,10 +470,14 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_UnMute, "@unmute", 60, atcommand_unmute }, // [Valaris] { 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] - { AtCommand_Mute, "@red", 99, atcommand_mute }, // [celest] - { AtCommand_WhoZeny, "@whozeny", 20, atcommand_whozeny }, // [Valaris] - { AtCommand_HappyHappyJoyJoy, "@happyhappyjoyjoy", 40, atcommand_happyhappyjoyjoy }, // [Valaris] + { AtCommand_Mute, "@mute", 99, atcommand_mute }, // [celest] + { AtCommand_Mute, "@red", 99, atcommand_mute }, // [celest] + { AtCommand_WhoZeny, "@whozeny", 20, atcommand_whozeny }, // [Valaris] + { AtCommand_HappyHappyJoyJoy, "@happyhappyjoyjoy",40, atcommand_happyhappyjoyjoy }, // [Valaris] + { AtCommand_Refresh, "@refresh", 0, atcommand_refresh }, // by MC Cameri + { AtCommand_PetId, "@petid", 40, atcommand_petid }, // by MC Cameri + { AtCommand_Identify, "@identify", 40, atcommand_identify }, // by MC Cameri + #ifndef TXT_ONLY // sql-only commands { AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris] { AtCommand_ListMail, "@listmail", 1, atcommand_listmail }, // [Valaris] @@ -565,6 +572,20 @@ char * job_name(int class) { return "Unknown Job"; } +/*========================================== + * str_lower (replace strlwr, non ANSI function that doesn't exist in all C compilator) + *------------------------------------------ + */ +char *str_lower(char *str) +{ + int i; + + for (i=0; str[i]; i++) + if ((str[i] >= 65) && (str[i] <= 90)) + str[i] += 32; + return str; +} + // compare function for sorting high to lowest int hightolow_compare (const void * a, const void * b) { @@ -1096,7 +1117,7 @@ int atcommand_jumpto( memset(character, '\0', sizeof character); if (sscanf(message, "%99[^\n]", character) < 1) return -1; - if(strncmp(sd->status.name,character,24)==0) + if(strncmp(sd->status.name,character,24)==0) //Yourself mate? Tsk tsk tsk. return -1; intif_jumpto(sd->status.account_id,character); @@ -6600,7 +6621,7 @@ int atcommand_disguise( const int fd, struct map_session_data* sd, const char* command, const char* message) { - int mob_id; + int mob_id = 0; if (!message || !*message) { clif_displaymessage(fd, "Please, enter a Monster/NPC name/id (usage: @disguise )."); @@ -7046,7 +7067,7 @@ atcommand_character_storage_list( } } else { clif_displaymessage(fd, "This player has no storage."); - return -1; + return 0; } } else { clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. @@ -7859,31 +7880,7 @@ atcommand_changesex( const int fd, struct map_session_data* sd, const char* command, const char* message) { - -// char sex[200], output[200]; -// int isex = (sd->status.sex+1)%2; -/* - if (!message || !*message) - return -1; - memset(sex, '\0', sizeof(sex)); - if(sscanf(message, "%99[^\n]", sex) < 1) - return -1; - str_lower(sex); - if (strcmp(sex,"0") == 0 || strcmp(sex,"f") == 0 || strcmp(sex,"female") == 0) { - isex = 0; - } else if (strcmp(sex,"1") == 0 || strcmp(sex,"m") == 0 || strcmp(sex,"male") == 0) { - isex = 1; - } else { - clif_displaymessage(fd,msg_table[456]); - return 0; - } -*/ -// if (isex != sd->sex) { - chrif_changesex(sd->status.account_id, ((sd->status.sex+1)%2)); -// } else { -// sprintf(output,msg_table[460],(isex == 0)?"female":"male"); -// clif_displaymessage(fd,output); -// } + chrif_changesex(sd->status.account_id, ((sd->status.sex+1)%2)); return 0; } @@ -7917,6 +7914,91 @@ int atcommand_mute( return 0; } +/*========================================== + * @refresh (like @jumpto <>) + *------------------------------------------ + */ +int atcommand_refresh( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + + nullpo_retr(-1, sd); + pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3); + return 0; +} + +/*========================================== + * @petid + * => Displays a list of matching pets. + *------------------------------------------ + */ +int +atcommand_petid(const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char searchtext[100]; + char temp0[100]; + char temp1[100]; + int cnt = 0, i = 0; + + nullpo_retr(-1, sd); + + if (!message || !*message) + return -1; + if (sscanf(message, "%99s", searchtext) < 1) + return -1; + str_lower(searchtext); + snprintf(temp0, sizeof(temp0), "Search results for: %s", searchtext); + clif_displaymessage(fd,temp0); + while (i < MAX_PET_DB) { + strcpy(temp1,pet_db[i].name); + strcpy(temp1, str_lower(temp1)); + strcpy(temp0,pet_db[i].jname); + strcpy(temp0, str_lower(temp1)); + if (strstr(temp1, searchtext) || strstr(temp0, searchtext) ) { + snprintf(temp0, sizeof(temp0), "ID: %i -- Name: %s", pet_db[i].class, + pet_db[i].jname); + if (cnt >= 100) { // Only if there are custom pets + clif_displaymessage(fd, "Be more specific, can't send more than" + " 100 results."); + } else { + clif_displaymessage(fd, temp0); + } + cnt++; + } + i++; + } + snprintf(temp0, sizeof(temp0),"%i pets have '%s' in their name.", cnt, searchtext); + clif_displaymessage(fd, temp0); + return 0; +} + +/*========================================== + * @identify + * => GM's magnifier. + *------------------------------------------ + */ +int +atcommand_identify( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + nullpo_retr(-1, sd); + int i,num; + for(i=num=0;istatus.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){ + num++; + } + } + if (num > 0) { + clif_item_identify_list(sd); + } else { + clif_displaymessage(fd,"There are no items to appraise."); + } + return 0; +} + #ifndef TXT_ONLY /* Begin SQL-Only commands */ /*========================================== diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 60301515c..fc8cb84e6 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -193,11 +193,15 @@ enum AtCommandType { AtCommand_Send, AtCommand_SetBattleFlag, AtCommand_UnMute, - AtCommand_UpTime, - AtCommand_ChangeSex, + AtCommand_UpTime, // by MC Cameri + AtCommand_ChangeSex, // by MC Cameri AtCommand_Mute, // [celest] - AtCommand_WhoZeny, // [Valaris] + AtCommand_WhoZeny, // [Valaris] <-- LOL...(MC Cameri) worth it. AtCommand_HappyHappyJoyJoy, // [Valaris] + AtCommand_Refresh, // by MC Cameri + AtCommand_PetId, // by MC Cameri + AtCommand_Identify, // by MC Cameri + // SQL-only commands start #ifndef TXT_ONLY AtCommand_CheckMail, // [Valaris] -- cgit v1.2.3-70-g09d2