summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvalaris <valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-20 14:13:23 +0000
committervalaris <valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-20 14:13:23 +0000
commitb22297197f06ac00eecf38fe98d7b9fdb5478a8a (patch)
tree953859912630948e0a5ca9c83b823b22a1bb690e
parent531ae6ff24ed1164ba08dc61c47ad642597591dc (diff)
downloadhercules-b22297197f06ac00eecf38fe98d7b9fdb5478a8a.tar.gz
hercules-b22297197f06ac00eecf38fe98d7b9fdb5478a8a.tar.bz2
hercules-b22297197f06ac00eecf38fe98d7b9fdb5478a8a.tar.xz
hercules-b22297197f06ac00eecf38fe98d7b9fdb5478a8a.zip
* Initialized "day" variable in npc.c. [Valaris]
* Added @whozeny. Shows list of top 50 online players and their zeny sorted from highest to lowest. [Valaris] * Added @happyhappyjoyjoy. Makes all players on server do a random emote. [Valaris] * Removed -fu git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@269 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog.txt7
-rw-r--r--Makefile2
-rw-r--r--conf-tmpl/atcommand_athena.conf6
-rw-r--r--src/map/atcommand.c91
-rw-r--r--src/map/atcommand.h2
-rw-r--r--src/map/npc.c2
6 files changed, 106 insertions, 4 deletions
diff --git a/Changelog.txt b/Changelog.txt
index 133b50eff..a299675fd 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,5 +1,10 @@
Date Added
-11/20
+11/20
+ * Initialized "day" variable in npc.c. [Valaris]
+ * Added @whozeny. Shows list of top 50 online players and their zeny sorted from highest to lowest. [Valaris]
+ * Added @happyhappyjoyjoy. Makes all players on server do a random emote. [Valaris]
+ * Removed -funroll-loops from compile. (Do not re-add!) [Valaris]
+ * Skill updates [celest]
* Added check for max vending_max_value when reading config [kobra_k88]
* Skill updates [celest]
- Napalm vulcan, Enchant Deadly Poison, Slow Poison (based on jAthena 1066)
diff --git a/Makefile b/Makefile
index 2c99331dc..9317bdcf8 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ else
MAKE = make
endif
-OPT = -g -O2 -ffast-math -funroll-loops
+OPT = -g -O2 -ffast-math
ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN)
OS_TYPE = -DCYGWIN
diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf
index e65219fa4..de6937ed8 100644
--- a/conf-tmpl/atcommand_athena.conf
+++ b/conf-tmpl/atcommand_athena.conf
@@ -119,6 +119,9 @@ mountpeco: 20
who: 20
whois: 20
+// Returns list of top 50 logged in characters and their zeny based on zeny sorted from highest amount to lowest.
+whozeny: 20
+
// Returns list of logged in characters with their job.
who2: 20
@@ -291,6 +294,9 @@ useskill: 40
// make another player killable
charkillable: 40
+// makes everyone on server do a random emote
+happyhappyjoyjoy:40
+
//---------------------
// 50: Sub-GM+ commands
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index fedde3ad0..b93fc3c34 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5,6 +5,7 @@
#include <ctype.h>
#include <math.h>
+
#include "../common/socket.h"
#include "../common/timer.h"
#include "../common/nullpo.h"
@@ -53,6 +54,8 @@ 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);
@@ -466,7 +469,8 @@ static AtCommandInfo atcommand_info[] = {
{ 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]
#ifndef TXT_ONLY // sql-only commands
{ AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris]
{ AtCommand_ListMail, "@listmail", 1, atcommand_listmail }, // [Valaris]
@@ -1596,6 +1600,91 @@ int atcommand_whogm(
return 0;
}
+int compare (const void * a, const void * b)
+{
+ return ( *(int*)b - *(int*)a );
+}
+
+int atcommand_whozeny(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ char output[200];
+ struct map_session_data *pl_sd;
+ int i, j, count,c;
+ char match_text[100];
+ char player_name[24];
+ int zeny[clif_countusers()];
+ char counted[clif_countusers()];
+
+ memset(output, '\0', sizeof(output));
+ memset(match_text, '\0', sizeof(match_text));
+ memset(player_name, '\0', sizeof(player_name));
+
+ if (sscanf(message, "%99[^\n]", match_text) < 1)
+ strcpy(match_text, "");
+ for (j = 0; match_text[j]; j++)
+ match_text[j] = tolower(match_text[j]);
+
+ count = 0;
+ for (i = 0; i < fd_max; i++) {
+ if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) {
+ memcpy(player_name, pl_sd->status.name, 24);
+ for (j = 0; player_name[j]; j++)
+ player_name[j] = tolower(player_name[j]);
+ if (strstr(player_name, match_text) != NULL) { // search with no case sensitive
+ zeny[count]=pl_sd->status.zeny;
+ count++;
+ }
+ }
+ }
+
+ qsort(zeny, count, sizeof(int), compare);
+ for (c = 0; c < count && c < 50; c++) {
+ if(!zeny[c])
+ continue;
+ for (i = 0; i < fd_max; i++) {
+ if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth && !counted[i] && zeny[c]) {
+ if(pl_sd->status.zeny==zeny[c]) {
+ sprintf(output, "Name: %s | Zeny: %d", pl_sd->status.name, pl_sd->status.zeny);
+ clif_displaymessage(fd, output);
+ zeny[c]=0;
+ counted[i]=1;
+ }
+ }
+ }
+ }
+
+ if (count == 0)
+ clif_displaymessage(fd, msg_table[28]); // No player found.
+ else if (count == 1)
+ clif_displaymessage(fd, msg_table[29]); // 1 player found.
+ else {
+ sprintf(output, msg_table[30], count); // %d players found.
+ clif_displaymessage(fd, output);
+ }
+
+ return 0;
+}
+
+int atcommand_happyhappyjoyjoy(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+
+ struct map_session_data *pl_sd;
+ int i,e;
+
+ for (i = 0; i < fd_max; i++) {
+ if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) {
+ e=rand()%40;
+ clif_emotion(&pl_sd->bl,e);
+ }
+ }
+
+ return 0;
+}
+
/*==========================================
*
*------------------------------------------
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index acab72531..60301515c 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -196,6 +196,8 @@ enum AtCommandType {
AtCommand_UpTime,
AtCommand_ChangeSex,
AtCommand_Mute, // [celest]
+ AtCommand_WhoZeny, // [Valaris]
+ AtCommand_HappyHappyJoyJoy, // [Valaris]
// SQL-only commands start
#ifndef TXT_ONLY
AtCommand_CheckMail, // [Valaris]
diff --git a/src/map/npc.c b/src/map/npc.c
index 72daea571..eea869aa5 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -392,7 +392,7 @@ int npc_event_do_clock(int tid,unsigned int tick,int id,int data)
time_t timer;
struct tm *t;
char buf[64];
- char *day;
+ char *day="";
int c=0;
time(&timer);