Ver código fonte

* Added some of eAIRC bot code, written by me and LittleWolf. It is disabled and has no configuration options yet, as it is not finished. [Valaris]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5201 54d463be-8e91-2dee-dedb-b68131a5f0ec
Valaris 19 anos atrás
pai
commit
8e410ec582
7 arquivos alterados com 45 adições e 17 exclusões
  1. 2 0
      Changelog-Trunk.txt
  2. 13 11
      src/map/Makefile
  3. 5 0
      src/map/clif.c
  4. 3 0
      src/map/map.c
  5. 6 0
      src/map/mob.c
  6. 6 1
      src/map/script.c
  7. 10 5
      src/map/vending.c

+ 2 - 0
Changelog-Trunk.txt

@@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EV
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 
 2006/02/05
+	* Added some of eAIRC bot code, written by me and LittleWolf.
+	  It is disabled and has no configuration options yet, as it is not finished. [Valaris]
 	* Fixed and documented script command "callshop". [Skotlex]
 	* Updated sq;-files/mob_db.sql with current mob_db. [Skotlex]
 	* Updated sql-files/item_db.sql with current item_db. [Skotlex]

+ 13 - 11
src/map/Makefile

@@ -24,7 +24,7 @@ OBJECTS = obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/status.o obj/npc.o \
 	obj/npc_chat.o obj/chat.o obj/path.o obj/itemdb.o obj/mob.o obj/script.o \
 	obj/storage.o obj/skill.o obj/atcommand.o obj/charcommand.o obj/battle.o \
 	obj/intif.o obj/trade.o obj/party.o obj/vending.o obj/guild.o obj/pet.o \
-	obj/log.o obj/mail.o obj/charsave.o obj/date.o $(COMMON_OBJ)
+	obj/log.o obj/mail.o obj/charsave.o obj/date.o obj/irc.o $(COMMON_OBJ)
 
 map-server: $(OBJECTS:obj/%=txtobj/%)
 	$(CC) -o ../../$@ $> $(LIBS) $(LIB_S)
@@ -43,9 +43,9 @@ clean:
 
 # DO NOT DELETE
 
-txtobj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h pet.h atcommand.h $(COMMON_H)
+txtobj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h pet.h atcommand.h irc.h $(COMMON_H)
 txtobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h $(COMMON_H)
-txtobj/clif.o: clif.c map.h chrif.h clif.h mob.h intif.h pc.h npc.h itemdb.h chat.h script.h storage.h party.h guild.h atcommand.h pet.h charcommand.h $(COMMON_H)
+txtobj/clif.o: clif.c map.h chrif.h clif.h mob.h intif.h pc.h npc.h itemdb.h chat.h script.h storage.h party.h guild.h atcommand.h pet.h charcommand.h irc.h $(COMMON_H)
 txtobj/pc.o: pc.c map.h clif.h intif.h pc.h npc.h mob.h itemdb.h battle.h skill.h script.h party.h guild.h pet.h trade.h storage.h chat.h vending.h $(COMMON_H)
 txtobj/status.o: status.c pc.h map.h clif.h status.h mob.h itemdb.h battle.h skill.h script.h pet.h guild.h $(COMMON_H)
 txtobj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h $(COMMON_H)
@@ -53,8 +53,8 @@ txtobj/npc_chat.o: npc_chat.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h ba
 txtobj/chat.o: chat.c map.h clif.h pc.h chat.h $(COMMON_H)
 txtobj/path.o: path.c map.h battle.h $(COMMON_H)
 txtobj/itemdb.o: itemdb.c map.h battle.h itemdb.h $(COMMON_H)
-txtobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h date.h $(COMMON_H)
-txtobj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h pet.h battle.h log.h $(COMMON_H)
+txtobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h date.h irc.h $(COMMON_H)
+txtobj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h pet.h battle.h log.h irc.h $(COMMON_H)
 txtobj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h $(COMMON_H)
 txtobj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h date.h $(COMMON_H)
 txtobj/atcommand.o: atcommand.c atcommand.h itemdb.h pc.h map.h skill.h clif.h mob.h intif.h battle.h storage.h guild.h pet.h log.h $(COMMON_H)
@@ -62,15 +62,16 @@ txtobj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h pet.h guild.h $(COMM
 txtobj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h pet.h $(COMMON_H)
 txtobj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h $(COMMON_H)
 txtobj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h $(COMMON_H)
-txtobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h $(COMMON_H)
+txtobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h irc.h $(COMMON_H)
 txtobj/guild.o: guild.c guild.h storage.h battle.h clif.h intif.h pc.h npc.h map.h $(COMMON_H)
 txtobj/pet.o: pet.c pet.h map.h clif.h chrif.h intif.h pc.h itemdb.h battle.h mob.h npc.h script.h $(COMMON_H)
 txtobj/log.o: log.c log.h map.h $(COMMON_H)
 txtobj/charcommand.o: charcommand.c charcommand.h itemdb.h pc.h map.h skill.h clif.h mob.h intif.h battle.h storage.h guild.h pet.h log.h $(COMMON_H)
 txtobj/date.o: date.c date.h $(COMMON_H)
+txtobj/irc.o: irc.c irc.h map.h pc.h $(COMMON_H)
 
 
-sqlobj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h pet.h atcommand.h log.h $(COMMON_H)
+sqlobj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h pet.h atcommand.h log.h irc.h $(COMMON_H)
 sqlobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h $(COMMON_H)
 sqlobj/clif.o: clif.c map.h chrif.h clif.h mob.h intif.h pc.h npc.h itemdb.h chat.h script.h storage.h party.h guild.h atcommand.h pet.h charcommand.h $(COMMON_H)
 sqlobj/pc.o: pc.c map.h clif.h intif.h pc.h npc.h mob.h itemdb.h battle.h skill.h script.h party.h guild.h pet.h trade.h storage.h chat.h vending.h log.h $(COMMON_H)
@@ -80,8 +81,8 @@ sqlobj/npc_chat.o: npc_chat.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h ba
 sqlobj/chat.o: chat.c map.h clif.h pc.h chat.h $(COMMON_H)
 sqlobj/path.o: path.c map.h battle.h $(COMMON_H)
 sqlobj/itemdb.o: itemdb.c map.h battle.h itemdb.h $(COMMON_H)
-sqlobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h  log.h date.h $(COMMON_H)
-sqlobj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h pet.h battle.h log.h $(COMMON_H)
+sqlobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h log.h date.h irc.h $(COMMON_H)
+sqlobj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h pet.h battle.h log.h irc.h $(COMMON_H)
 sqlobj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h $(COMMON_H)
 sqlobj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h log.h date.h $(COMMON_H)
 sqlobj/atcommand.o: atcommand.c atcommand.h itemdb.h pc.h map.h skill.h clif.h mob.h intif.h battle.h storage.h guild.h pet.h log.h $(COMMON_H)
@@ -89,11 +90,12 @@ sqlobj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h pet.h guild.h $(COMM
 sqlobj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h pet.h $(COMMON_H)
 sqlobj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h log.h $(COMMON_H)
 sqlobj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h $(COMMON_H)
-sqlobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h log.h $(COMMON_H)
-sqlobj/guild.o: guild.c guild.h storage.h battle.h clif.h intif.h pc.h npc.h map.h $(COMMON_H)
+sqlobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h log.h irc.h $(COMMON_H)
+sqlobj/guild.o: guild.c guild.h storage.h battle.h clif.h intif.h pc.h npc.h map.h irc.h $(COMMON_H)
 sqlobj/pet.o: pet.c pet.h map.h clif.h chrif.h intif.h pc.h itemdb.h battle.h mob.h npc.h script.h $(COMMON_H)
 sqlobj/mail.o: mail.c mail.h $(COMMON_H)
 sqlobj/log.o: log.c log.h map.h $(COMMON_H)
 sqlobj/charcommand.o: charcommand.c charcommand.h itemdb.h pc.h map.h skill.h clif.h mob.h intif.h battle.h storage.h guild.h pet.h log.h $(COMMON_H)
 sqlobj/charsave.o: charsave.c charsave.h $(COMMON_H)
 sqlobj/date.o: date.c date.h $(COMMON_H)
+sqlobj/irc.o: irc.c irc.h map.h pc.h $(COMMON_H)

+ 5 - 0
src/map/clif.c

@@ -51,6 +51,8 @@
 #include "pet.h"
 #include "log.h"
 
+#include "irc.h"
+
 struct Clif_Config {
 	int packet_db_ver;	//Preferred packet version.
 	int connect_cmd[MAX_PACKET_VER + 1]; //Store the connect command for all versions. [Skotlex]
@@ -5542,6 +5544,9 @@ int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag)
 	          ALL_CLIENT);
 	if(buf) aFree(buf);
 
+	if(use_irc && irc_announce_flag && !flag)
+		irc_announce(mes);
+
 	return 0;
 }
 

+ 3 - 0
src/map/map.c

@@ -47,6 +47,7 @@
 
 #include "charsave.h"
 
+#include "irc.h"
 
 // maybe put basic macros to somewhere else
 #define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b)))
@@ -3676,6 +3677,7 @@ void do_final(void) {
 	do_final_pet();
 	do_final_mob();
 	do_final_msg();
+	do_final_irc();
 
 	map_getallusers(NULL); //Clear the memory allocated for this array.
 	
@@ -3872,6 +3874,7 @@ int do_init(int argc, char *argv[]) {
 	add_timer_func_list(map_removemobs_timer, "map_removemobs_timer");
 	add_timer_interval(gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
 
+	do_init_irc();
 	do_init_atcommand();
 	do_init_battle();
 	do_init_chrif();

+ 6 - 0
src/map/mob.c

@@ -30,6 +30,8 @@
 #include "atcommand.h"
 #include "date.h"
 
+#include "irc.h"
+
 #define MIN_MOBTHINKTIME 100
 #define MIN_MOBLINKTIME 1000
 
@@ -2657,6 +2659,10 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 		//end added [Lorky] 
 
 		if(mexp < 1) mexp = 1;
+
+		if(use_irc && irc_announce_mvp_flag)
+			irc_announce_mvp(mvp_sd,md);
+
 		clif_mvp_effect(mvp_sd);					// ƒGƒtƒFƒNƒg
 		clif_mvp_exp(mvp_sd,mexp);
 		pc_gainexp(mvp_sd,mexp,0);

+ 6 - 1
src/map/script.c

@@ -48,6 +48,8 @@
 #include "strlib.h"
 #endif
 
+#include "irc.h"
+
 #define SCRIPT_BLOCK_SIZE 256
 
 #define FETCH(n, t) \
@@ -3158,8 +3160,11 @@ int buildin_jobchange(struct script_state *st)
 	if( st->end>st->start+3 )
 		upper=conv_num(st,& (st->stack->stack_data[st->start+3]));
 
-	if ((job >= 0 && job < MAX_PC_CLASS))
+	if ((job >= 0 && job < MAX_PC_CLASS)){
 		pc_jobchange(script_rid2sd(st),job, upper);
+		if(use_irc && irc_announce_jobchange_flag)
+			irc_announce_jobchange(script_rid2sd(st));
+	}
 
 	return 0;
 }

+ 10 - 5
src/map/vending.c

@@ -16,17 +16,20 @@
 #include "battle.h"
 #include "log.h"
 
+#include "irc.h"
+
 /*==========================================
  * ˜I“X•Â�½
  *------------------------------------------
 */
 void vending_closevending(struct map_session_data *sd)
 {
-
 	nullpo_retv(sd);
 
 	sd->vender_id=0;
 	clif_closevendingboard(&sd->bl,0);
+	if(use_irc && irc_announce_shop_flag)
+		irc_announce_shop(sd,0);
 }
 
 /*==========================================
@@ -105,11 +108,11 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha
 		z += ((double)vsd->vending[j].value * (double)amount);
 		if (z > (double)sd->status.zeny || z < 0. || z > (double)MAX_ZENY) { // fix positiv overflow (buyer)
 			clif_buyvending(sd, idx, amount, 1); // you don't have enough zeny
-			return; // zenys'<
+			return; // zeny s'<
 		}
 		if (z + (double)vsd->status.zeny > (double)MAX_ZENY) { // fix positiv overflow (merchand)
 			clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // too much zeny = overflow
-			return; // zenys'<
+			return; // zeny s'<
 		}
 		w += itemdb_weight(vsd->status.cart[idx].nameid) * amount;
 		if (w + sd->weight > sd->max_weight) {
@@ -252,9 +255,11 @@ void vending_openvending(struct map_session_data *sd,int len,char *message,int f
 		sd->vender_id = sd->bl.id;
 		sd->vend_num = i;
 		memcpy(sd->message,message, MESSAGE_SIZE-1);
-		if (clif_openvending(sd,sd->vender_id,sd->vending) > 0)
+		if (clif_openvending(sd,sd->vender_id,sd->vending) > 0){
 			clif_showvendingboard(&sd->bl,message,0);
-		else
+			if(use_irc && irc_announce_shop_flag)
+				irc_announce_shop(sd,1);
+		} else
 			sd->vender_id = 0;
 	}
 }