From 30210c583785263a964dee242b5a7efdfdb7e89a Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 8 Mar 2009 13:52:09 -0600 Subject: Remove pet and vending systems --- src/map/GNUmakefile | 96 +-- src/map/Makefile | 96 +-- src/map/atcommand.c | 482 +------------ src/map/atcommand.h | 50 +- src/map/battle.c | 566 +-------------- src/map/battle.h | 18 - src/map/clif.c | 807 +-------------------- src/map/clif.h | 25 - src/map/intif.c | 116 +-- src/map/intif.h | 6 - src/map/itemdb.c | 4 - src/map/magic-expr.c | 2 - src/map/magic-interpreter.h | 24 +- src/map/mail.c | 324 --------- src/map/mail.h | 9 - src/map/map.c | 20 - src/map/map.h | 47 +- src/map/mob.c | 37 +- src/map/npc.c | 24 +- src/map/pc.c | 129 +--- src/map/pet.c | 1651 ------------------------------------------- src/map/pet.h | 69 -- src/map/script.c | 274 +------ src/map/skill.c | 113 +-- src/map/vending.c | 163 ----- src/map/vending.h | 12 - 26 files changed, 216 insertions(+), 4948 deletions(-) delete mode 100644 src/map/mail.c delete mode 100644 src/map/mail.h delete mode 100644 src/map/pet.c delete mode 100644 src/map/pet.h delete mode 100644 src/map/vending.c delete mode 100644 src/map/vending.h diff --git a/src/map/GNUmakefile b/src/map/GNUmakefile index a2bbb63..73bc071 100644 --- a/src/map/GNUmakefile +++ b/src/map/GNUmakefile @@ -1,87 +1,51 @@ LEX=flex BISON=bison -all: txt sql +all: txt -txt: txtobj map-server +txt: obj map-server -sql: sqlobj map-server_sql - -txtobj: - mkdir txtobj - -sqlobj: - mkdir sqlobj +obj: + mkdir obj COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/malloc.o LIBS = -lz -lm -map-server: txtobj/magic-interpreter-lexer.o txtobj/magic-interpreter-parser.o txtobj/magic-interpreter-base.o txtobj/magic-expr.o txtobj/magic-stmt.o txtobj/magic.o txtobj/map.o txtobj/chrif.o txtobj/clif.o txtobj/pc.o txtobj/npc.o txtobj/chat.o txtobj/path.o txtobj/itemdb.o txtobj/mob.o txtobj/script.o txtobj/storage.o txtobj/skill.o txtobj/atcommand.o txtobj/battle.o txtobj/intif.o txtobj/trade.o txtobj/party.o txtobj/vending.o txtobj/guild.o txtobj/pet.o $(COMMON_OBJ) +map-server: obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/magic-interpreter-base.o obj/magic-expr.o obj/magic-stmt.o obj/magic.o obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/npc.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/battle.o obj/intif.o obj/trade.o obj/party.o obj/guild.o $(COMMON_OBJ) $(CC) -o ../../$@ $^ $(LIBS) -map-server_sql: sqlobj/map.o sqlobj/chrif.o sqlobj/clif.o sqlobj/pc.o sqlobj/npc.o sqlobj/chat.o sqlobj/path.o sqlobj/itemdb.o sqlobj/mob.o sqlobj/script.o sqlobj/storage.o sqlobj/skill.o sqlobj/atcommand.o sqlobj/battle.o sqlobj/intif.o sqlobj/trade.o sqlobj/party.o sqlobj/vending.o sqlobj/guild.o sqlobj/pet.o sqlobj/mail.o $(COMMON_OBJ) - $(CC) -o ../../$@ $^ $(LIB_S) - -txtobj/%.o: %.c +obj/%.o: %.c $(COMPILE.c) -DTXT_ONLY $(OUTPUT_OPTION) $< -sqlobj/%.o: %.c - $(COMPILE.c) $(OUTPUT_OPTION) $< - magic-interpreter-lexer.c: magic-interpreter.l $(LEX) -o magic-interpreter-lexer.c magic-interpreter.l magic-interpreter-parser.c: magic-interpreter-parser.y $(BISON) -v -d -o magic-interpreter-parser.c magic-interpreter-parser.y -txtobj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.c magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-interpreter-parser.o: magic-interpreter-parser.c magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-interpreter-base.o: magic-interpreter-base.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-expr.o: magic-expr.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-stmt.o: magic-stmt.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic.o: magic.c magic.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.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 ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h -txtobj/clif.o: magic.h 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 atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.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/timer.h ../common/mmo.h ../common/db.h -txtobj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h -txtobj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h -txtobj/path.o: path.c map.h battle.h ../common/mmo.h -txtobj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.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 ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h -txtobj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h -txtobj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.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 ../common/socket.h ../common/timer.h ../common/mmo.h -txtobj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h pet.h guild.h ../common/timer.h ../common/mmo.h -txtobj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h pet.h ../common/socket.h ../common/mmo.h -txtobj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h -txtobj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h -txtobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h ../common/mmo.h -txtobj/guild.o: guild.c guild.h storage.h battle.h clif.h intif.h pc.h npc.h map.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.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/db.h ../common/socket.h ../common/timer.h ../common/mmo.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 ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -sqlobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.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 atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.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 ../common/timer.h ../common/mmo.h ../common/db.h -sqlobj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h -sqlobj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h -sqlobj/path.o: path.c map.h battle.h ../common/mmo.h -sqlobj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h -sqlobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.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 ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h -sqlobj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h -sqlobj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.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 ../common/socket.h ../common/timer.h ../common/mmo.h -sqlobj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h pet.h guild.h ../common/timer.h ../common/mmo.h -sqlobj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h pet.h ../common/socket.h ../common/mmo.h -sqlobj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h -sqlobj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h -sqlobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h ../common/mmo.h -sqlobj/guild.o: guild.c guild.h storage.h battle.h clif.h intif.h pc.h npc.h map.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.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/db.h ../common/socket.h ../common/timer.h ../common/mmo.h -sqlobj/mail.o: mail.c mail.h +obj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-interpreter-parser.o: magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-interpreter-base.o: magic-interpreter-base.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-expr.o: magic-expr.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-stmt.o: magic-stmt.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic.o: magic.c magic.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/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 atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h +obj/clif.o: magic.h 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 atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h +obj/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 trade.h storage.h chat.h ../common/timer.h ../common/mmo.h ../common/db.h +obj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h +obj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h +obj/path.o: path.c map.h battle.h ../common/mmo.h +obj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.h +obj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h battle.h ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h +obj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h +obj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.h +obj/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 ../common/socket.h ../common/timer.h ../common/mmo.h +obj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h guild.h ../common/timer.h ../common/mmo.h +obj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h ../common/socket.h ../common/mmo.h +obj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h +obj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h clean: - rm -rf *.o ../../map-server ../../map-server_sql sqlobj txtobj + rm -rf *.o ../../map-server obj diff --git a/src/map/Makefile b/src/map/Makefile index 89ef2c2..effb407 100644 --- a/src/map/Makefile +++ b/src/map/Makefile @@ -1,87 +1,51 @@ LEX=flex BISON=bison -all: txt sql +all: txt -txt: txtobj map-server +txt: obj map-server -sql: sqlobj map-server_sql - -txtobj: - mkdir txtobj - -sqlobj: - mkdir sqlobj +obj: + mkdir obj COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/malloc.o LIBS = -lz -lm -map-server: txtobj/magic-interpreter-lexer.o txtobj/magic-interpreter-parser.o txtobj/magic-interpreter-base.o txtobj/magic-expr.o txtobj/magic-stmt.o txtobj/magic.o txtobj/map.o txtobj/chrif.o txtobj/clif.o txtobj/pc.o txtobj/npc.o txtobj/chat.o txtobj/path.o txtobj/itemdb.o txtobj/mob.o txtobj/script.o txtobj/storage.o txtobj/skill.o txtobj/atcommand.o txtobj/battle.o txtobj/intif.o txtobj/trade.o txtobj/party.o txtobj/vending.o txtobj/guild.o txtobj/pet.o $(COMMON_OBJ) +map-server: obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/magic-interpreter-base.o obj/magic-expr.o obj/magic-stmt.o obj/magic.o obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/npc.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/battle.o obj/intif.o obj/trade.o obj/party.o obj/guild.o $(COMMON_OBJ) $(CC) -o ../../$@ $> $(LIBS) -map-server_sql: sqlobj/map.o sqlobj/chrif.o sqlobj/clif.o sqlobj/pc.o sqlobj/npc.o sqlobj/chat.o sqlobj/path.o sqlobj/itemdb.o sqlobj/mob.o sqlobj/script.o sqlobj/storage.o sqlobj/skill.o sqlobj/atcommand.o sqlobj/battle.o sqlobj/intif.o sqlobj/trade.o sqlobj/party.o sqlobj/vending.o sqlobj/guild.o sqlobj/pet.o sqlobj/mail.o $(COMMON_OBJ) - $(CC) -o ../../$@ $> $(LIB_S) - -txtobj/%.o: %.c +obj/%.o: %.c $(COMPILE.c) -DTXT_ONLY $(OUTPUT_OPTION) $< -sqlobj/%.o: %.c - $(COMPILE.c) $(OUTPUT_OPTION) $< - magic-interpreter-lexer.c: magic-interpreter.l $(LEX) -o magic-interpreter-lexer.c magic-interpreter.l magic-interpreter-parser.c: magic-interpreter-parser.y $(BISON) -v -d -o magic-interpreter-parser.c magic-interpreter-parser.y -txtobj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.c magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-interpreter-parser.o: magic-interpreter-parser.c magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-interpreter-base.o: magic-interpreter-base.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-expr.o: magic-expr.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic-stmt.o: magic-stmt.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/magic.o: magic.c magic.h magic-expr.h magic-interpreter.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/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.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 ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h -txtobj/clif.o: magic.h 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 atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.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/timer.h ../common/mmo.h ../common/db.h -txtobj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h -txtobj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h -txtobj/path.o: path.c map.h battle.h ../common/mmo.h -txtobj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h -txtobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.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 ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h -txtobj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h -txtobj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.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 ../common/socket.h ../common/timer.h ../common/mmo.h -txtobj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h pet.h guild.h ../common/timer.h ../common/mmo.h -txtobj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h pet.h ../common/socket.h ../common/mmo.h -txtobj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h -txtobj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h -txtobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h ../common/mmo.h -txtobj/guild.o: guild.c guild.h storage.h battle.h clif.h intif.h pc.h npc.h map.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.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/db.h ../common/socket.h ../common/timer.h ../common/mmo.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 ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h -sqlobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.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 atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.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 ../common/timer.h ../common/mmo.h ../common/db.h -sqlobj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h -sqlobj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h -sqlobj/path.o: path.c map.h battle.h ../common/mmo.h -sqlobj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h -sqlobj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.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 ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h -sqlobj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h -sqlobj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.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 ../common/socket.h ../common/timer.h ../common/mmo.h -sqlobj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h pet.h guild.h ../common/timer.h ../common/mmo.h -sqlobj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h pet.h ../common/socket.h ../common/mmo.h -sqlobj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h -sqlobj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h -sqlobj/vending.o: vending.c vending.h clif.h itemdb.h map.h pc.h ../common/mmo.h -sqlobj/guild.o: guild.c guild.h storage.h battle.h clif.h intif.h pc.h npc.h map.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.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/db.h ../common/socket.h ../common/timer.h ../common/mmo.h -sqlobj/mail.o: mail.c mail.h +obj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-interpreter-parser.o: magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-interpreter-base.o: magic-interpreter-base.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-expr.o: magic-expr.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic-stmt.o: magic-stmt.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/magic.o: magic.c magic.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/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 atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h +obj/clif.o: magic.h 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 atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h +obj/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 trade.h storage.h chat.h ../common/timer.h ../common/mmo.h ../common/db.h +obj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h +obj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h +obj/path.o: path.c map.h battle.h ../common/mmo.h +obj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h +obj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.h +obj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h battle.h ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h +obj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h +obj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.h +obj/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 ../common/socket.h ../common/timer.h ../common/mmo.h +obj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h guild.h ../common/timer.h ../common/mmo.h +obj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h ../common/socket.h ../common/mmo.h +obj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h +obj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h clean: - rm -rf *.o ../../map-server ../../map-server_sql sqlobj txtobj + rm -rf *.o ../../map-server obj diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 37ba1e6..cf26775 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -14,22 +14,22 @@ #include "timer.h" #include "nullpo.h" +#include "atcommand.h" +#include "battle.h" #include "clif.h" #include "chrif.h" +#include "guild.h" #include "intif.h" #include "itemdb.h" #include "map.h" -#include "pc.h" -#include "skill.h" #include "mob.h" -#include "pet.h" -#include "battle.h" +#include "npc.h" +#include "pc.h" #include "party.h" -#include "guild.h" -#include "atcommand.h" #include "script.h" -#include "npc.h" +#include "skill.h" #include "trade.h" + #include "core.h" #ifndef TXT_ONLY @@ -45,17 +45,15 @@ static char msg_table[1000][1024]; // Server messages (0-499 reserved for GM com #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(charwarp); +ATCOMMAND_FUNC(warp); ATCOMMAND_FUNC(where); ATCOMMAND_FUNC(jumpto); ATCOMMAND_FUNC(jump); ATCOMMAND_FUNC(who); -ATCOMMAND_FUNC(who2); -ATCOMMAND_FUNC(who3); +ATCOMMAND_FUNC(whogroup); ATCOMMAND_FUNC(whomap); -ATCOMMAND_FUNC(whomap2); -ATCOMMAND_FUNC(whomap3); +ATCOMMAND_FUNC(whomapgroup); ATCOMMAND_FUNC(whogm); // by Yor ATCOMMAND_FUNC(save); ATCOMMAND_FUNC(load); @@ -98,12 +96,6 @@ 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(charpetrename); // by Yor ATCOMMAND_FUNC(recall); ATCOMMAND_FUNC(recallall); ATCOMMAND_FUNC(character_job); @@ -142,11 +134,7 @@ ATCOMMAND_FUNC(agitend); ATCOMMAND_FUNC(reloaditemdb); ATCOMMAND_FUNC(reloadmobdb); ATCOMMAND_FUNC(reloadskilldb); -#ifndef TXT_ONLY -ATCOMMAND_FUNC(rehash);// by Fr3DBr -#else /* TXT_ONLY */ ATCOMMAND_FUNC(reloadscript); -#endif /* TXT_ONLY */ ATCOMMAND_FUNC(reloadgmdb); // by Yor ATCOMMAND_FUNC(mapexit); ATCOMMAND_FUNC(idsearch); @@ -167,7 +155,6 @@ 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 @@ -225,18 +212,6 @@ ATCOMMAND_FUNC(visible); // [Fate] ATCOMMAND_FUNC(iterate_forward_over_players); // [Fate] ATCOMMAND_FUNC(iterate_backwards_over_players); // [Fate] -#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] -#endif /* TXT_ONLY */ - /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 *------------------------------------------ @@ -245,22 +220,17 @@ ATCOMMAND_FUNC(refreshonline); // [Valaris] // 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_CharWarp, "@charwarp", 60, atcommand_charwarp }, + { AtCommand_Warp, "@warp", 40, atcommand_warp }, { AtCommand_Where, "@where", 1, atcommand_where }, { AtCommand_JumpTo, "@jumpto", 20, atcommand_jumpto }, // + /shift { AtCommand_JumpTo, "@warpto", 20, atcommand_jumpto }, { AtCommand_JumpTo, "@goto", 20, atcommand_jumpto }, { AtCommand_Jump, "@jump", 40, atcommand_jump }, { AtCommand_Who, "@who", 20, atcommand_who }, - { AtCommand_Who, "@whois", 20, atcommand_who }, - { AtCommand_Who2, "@who2", 20, atcommand_who2 }, - { AtCommand_Who3, "@who3", 20, atcommand_who3 }, + { AtCommand_WhoGroup, "@whogroup", 20, atcommand_whogroup }, { AtCommand_WhoMap, "@whomap", 20, atcommand_whomap }, - { AtCommand_WhoMap2, "@whomap2", 20, atcommand_whomap2 }, - { AtCommand_WhoMap3, "@whomap3", 20, atcommand_whomap3 }, + { AtCommand_WhoMapGroup, "@whomapgroup", 20, atcommand_whomapgroup }, { AtCommand_WhoGM, "@whogm", 20, atcommand_whogm }, // by Yor { AtCommand_Save, "@save", 40, atcommand_save }, { AtCommand_Load, "@return", 40, atcommand_load }, @@ -321,12 +291,6 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Luck, "@luk", 60, atcommand_param }, { AtCommand_GuildLevelUp, "@guildlvup", 60, atcommand_guildlevelup }, { AtCommand_GuildLevelUp, "@guildlvlup", 60, atcommand_guildlevelup }, - { AtCommand_MakeEgg, "@makeegg", 60, atcommand_makeegg }, - { AtCommand_Hatch, "@hatch", 60, atcommand_hatch }, - { AtCommand_PetFriendly, "@petfriendly", 40, atcommand_petfriendly }, - { AtCommand_PetHungry, "@pethungry", 40, atcommand_pethungry }, - { AtCommand_PetRename, "@petrename", 1, atcommand_petrename }, - { AtCommand_CharPetRename, "@charpetrename", 50, atcommand_charpetrename }, // by Yor { AtCommand_Recall, "@recall", 60, atcommand_recall }, // + /recall { AtCommand_CharacterJob, "@charjob", 60, atcommand_character_job }, { AtCommand_CharacterJob, "@charjobchange", 60, atcommand_character_job }, @@ -360,7 +324,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_AgitEnd, "@agitend", 60, atcommand_agitend }, { AtCommand_MapExit, "@mapexit", 99, atcommand_mapexit }, { AtCommand_IDSearch, "@idsearch", 60, atcommand_idsearch }, - { AtCommand_MapMove, "@mapmove", 40, atcommand_rura }, // /mm command + { AtCommand_MapMove, "@mapmove", 40, atcommand_warp }, // /mm command { AtCommand_Broadcast, "@broadcast", 40, atcommand_broadcast }, // /b and /nb command { AtCommand_LocalBroadcast, "@localbroadcast", 40, atcommand_localbroadcast }, // /lb and /nlb command { AtCommand_RecallAll, "@recallall", 80, atcommand_recallall }, @@ -383,10 +347,8 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_MapInfo, "@mapinfo", 99, atcommand_mapinfo }, { AtCommand_Dye, "@dye", 40, atcommand_dye }, // by fritz { AtCommand_Dye, "@ccolor", 40, atcommand_dye }, // by fritz - { AtCommand_Hstyle, "@hairstyle", 40, atcommand_hair_style }, // by fritz - { AtCommand_Hstyle, "@hstyle", 40, atcommand_hair_style }, // by fritz - { AtCommand_Hcolor, "@haircolor", 40, atcommand_hair_color }, // by fritz - { AtCommand_Hcolor, "@hcolor", 40, atcommand_hair_color }, // by fritz + { AtCommand_HairStyle, "@hairstyle", 40, atcommand_hair_style }, // by fritz + { AtCommand_HairColor, "@haircolor", 40, atcommand_hair_color }, // by fritz { AtCommand_StatAll, "@statall", 60, atcommand_stat_all }, // by fritz { AtCommand_StatAll, "@statsall", 60, atcommand_stat_all }, { AtCommand_StatAll, "@allstats", 60, atcommand_stat_all }, // by fritz @@ -411,7 +373,6 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_RepairAll, "@repairall", 60, atcommand_repairall }, // [Valaris] { AtCommand_GuildRecall, "@guildrecall", 60, atcommand_guildrecall }, // by Yor { AtCommand_PartyRecall, "@partyrecall", 60, atcommand_partyrecall }, // by Yor -// { AtCommand_Nuke, "@nuke", 60, atcommand_nuke }, // [Valaris] { AtCommand_Enablenpc, "@enablenpc", 80, atcommand_enablenpc }, // [] { AtCommand_Disablenpc, "@disablenpc", 80, atcommand_disablenpc }, // [] { AtCommand_ServerTime, "@time", 0, atcommand_servertime }, // by Yor @@ -942,7 +903,7 @@ int atcommand_config_read(const char *cfgName) { * @rura+ *------------------------------------------ */ -int atcommand_rurap( +int atcommand_charwarp( const int fd, struct map_session_data* sd, const char* command, const char* message) { @@ -1002,14 +963,11 @@ int atcommand_rurap( return 0; } -// @rura /*========================================== * *------------------------------------------ */ -int atcommand_rura( - const int fd, struct map_session_data* sd, - const char* command, const char* message) +int atcommand_warp(const int fd, struct map_session_data* sd, const char* command, const char* message) { char map_name[100]; int x = 0, y = 0; @@ -1058,9 +1016,7 @@ int atcommand_rura( * *------------------------------------------ */ -int atcommand_where( - const int fd, struct map_session_data* sd, - const char* command, const char* message) +int atcommand_where(const int fd, struct map_session_data* sd, const char* command, const char* message) { char character[100]; char output[200]; @@ -1088,9 +1044,7 @@ int atcommand_where( * *------------------------------------------ */ -int atcommand_jumpto( - const int fd, struct map_session_data* sd, - const char* command, const char* message) +int atcommand_jumpto(const int fd, struct map_session_data* sd, const char* command, const char* message) { char character[100]; char output[200]; @@ -1128,9 +1082,7 @@ int atcommand_jumpto( * *------------------------------------------ */ -int atcommand_jump( - const int fd, struct map_session_data* sd, - const char* command, const char* message) +int atcommand_jump(const int fd, struct map_session_data* sd, const char* command, const char* message) { char output[200]; int x = 0, y = 0; @@ -1224,64 +1176,7 @@ int atcommand_who( * *------------------------------------------ */ -int atcommand_who2( - 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; - int pl_GM_level, GM_level; - char match_text[100]; - char player_name[24]; - - 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; - GM_level = pc_isGM(sd); - for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) { - pl_GM_level = pc_isGM(pl_sd); - if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_HIDE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level - 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 - if (pl_GM_level > 0) - sprintf(output, "Name: %s (GM:%d) | BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.name, pl_GM_level, pl_sd->status.base_level, job_name(pl_sd->status.class), pl_sd->status.job_level); - else - sprintf(output, "Name: %s | BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.name, pl_sd->status.base_level, job_name(pl_sd->status.class), pl_sd->status.job_level); - clif_displaymessage(fd, output); - count++; - } - } - } - } - - 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_who3( +int atcommand_whogroup( const int fd, struct map_session_data* sd, const char* command, const char* message) { @@ -1412,65 +1307,7 @@ int atcommand_whomap( * *------------------------------------------ */ -int atcommand_whomap2( - 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, count; - int pl_GM_level, GM_level; - int map_id = 0; - char map_name[100]; - - memset(output, '\0', sizeof(output)); - memset(map_name, '\0', sizeof(map_name)); - - if (!message || !*message) - map_id = sd->bl.m; - else { - sscanf(message, "%99s", map_name); - if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) - strcat(map_name, ".gat"); - if ((map_id = map_mapname2mapid(map_name)) < 0) - map_id = sd->bl.m; - } - - count = 0; - GM_level = pc_isGM(sd); - for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) { - pl_GM_level = pc_isGM(pl_sd); - if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_HIDE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level - if (pl_sd->bl.m == map_id) { - if (pl_GM_level > 0) - sprintf(output, "Name: %s (GM:%d) | BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.name, pl_GM_level, pl_sd->status.base_level, job_name(pl_sd->status.class), pl_sd->status.job_level); - else - sprintf(output, "Name: %s | BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.name, pl_sd->status.base_level, job_name(pl_sd->status.class), pl_sd->status.job_level); - clif_displaymessage(fd, output); - count++; - } - } - } - } - - if (count == 0) - sprintf(output, msg_table[54], map[map_id].name); // No player found in map '%s'. - else if (count == 1) - sprintf(output, msg_table[55], map[map_id].name); // 1 player found in map '%s'. - else { - sprintf(output, msg_table[56], count, map[map_id].name); // %d players found in map '%s'. - } - clif_displaymessage(fd, output); - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_whomap3( +int atcommand_whomapgroup( const int fd, struct map_session_data* sd, const char* command, const char* message) { @@ -1625,8 +1462,6 @@ int atcommand_save( const char* command, const char* message) { pc_setsavepoint(sd, sd->mapname, sd->bl.x, sd->bl.y); - if (sd->status.pet_id > 0 && sd->pd) - intif_save_petdata(sd->status.account_id, &sd->pet); pc_makesavestatus(sd); chrif_save(sd); storage_storage_save(sd); @@ -2006,7 +1841,7 @@ int atcommand_heal( } /*========================================== - * @item command (usage: @item ) (modified by [Yor] for pet_egg) + * @item command (usage: @item ) *------------------------------------------ */ int atcommand_item( @@ -2017,7 +1852,7 @@ int atcommand_item( int number = 0, item_id, flag; struct item item_tmp; struct item_data *item_data; - int get_count, i, pet_id; + int get_count, i; memset(item_name, '\0', sizeof(item_name)); @@ -2036,28 +1871,16 @@ int atcommand_item( 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; } 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); - } + 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 { @@ -3533,215 +3356,6 @@ int atcommand_guildlevelup( return 0; } -/*========================================== - * - *------------------------------------------ - */ -int atcommand_makeegg( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - struct item_data *item_data; - int id, pet_id; - - if (!message || !*message) { - clif_displaymessage(fd, "Please, enter a monter/egg name/id (usage: @makeegg )."); - return -1; - } - - if ((item_data = itemdb_searchname(message)) != NULL) // for egg name - id = item_data->nameid; - else if ((id = mobdb_searchname(message)) == 0) // for monster name - id = atoi(message); - - pet_id = search_petDB_index(id, PET_CLASS); - if (pet_id < 0) - pet_id = search_petDB_index(id, 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); - } else { - clif_displaymessage(fd, msg_table[180]); // The monter/egg name/id doesn't exist. - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_hatch( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - if (sd->status.pet_id <= 0) - clif_sendegg(sd); - else { - clif_displaymessage(fd, msg_table[181]); // You already have a pet. - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_petfriendly( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - int friendly; - int t; - - if (!message || !*message || (friendly = atoi(message)) < 0) { - clif_displaymessage(fd, "Please, enter a valid value (usage: @petfriendly <0-1000>)."); - return -1; - } - - if (sd->status.pet_id > 0 && sd->pd) { - if (friendly >= 0 && friendly <= 1000) { - if (friendly != sd->pet.intimate) { - t = sd->pet.intimate; - sd->pet.intimate = friendly; - clif_send_petstatus(sd); - if (battle_config.pet_status_support) { - if ((sd->pet.intimate > 0 && t <= 0) || - (sd->pet.intimate <= 0 && t > 0)) { - if (sd->bl.prev != NULL) - pc_calcstatus(sd, 0); - else - pc_calcstatus(sd, 2); - } - } - clif_displaymessage(fd, msg_table[182]); // Pet friendly value changed! - } else { - clif_displaymessage(fd, msg_table[183]); // Pet friendly is already the good value. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[184]); // Sorry, but you have no pet. - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_pethungry( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - int hungry; - - if (!message || !*message || (hungry = atoi(message)) < 0) { - clif_displaymessage(fd, "Please, enter a valid number (usage: @pethungry <0-100>)."); - return -1; - } - - if (sd->status.pet_id > 0 && sd->pd) { - if (hungry >= 0 && hungry <= 100) { - if (hungry != sd->pet.hungry) { - sd->pet.hungry = hungry; - clif_send_petstatus(sd); - clif_displaymessage(fd, msg_table[185]); // Pet hungry value changed! - } else { - clif_displaymessage(fd, msg_table[186]); // Pet hungry is already the good value. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[184]); // Sorry, but you have no pet. - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_petrename( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - if (sd->status.pet_id > 0 && sd->pd) { - if (sd->pet.rename_flag != 0) { - sd->pet.rename_flag = 0; - intif_save_petdata(sd->status.account_id, &sd->pet); - clif_send_petstatus(sd); - clif_displaymessage(fd, msg_table[187]); // You can now rename your pet. - } else { - clif_displaymessage(fd, msg_table[188]); // You can already rename your pet. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[184]); // Sorry, but you have no pet. - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_charpetrename( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - char character[100]; - struct map_session_data *pl_sd; - - memset(character, '\0', sizeof(character)); - - if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @charpetrename )."); - return -1; - } - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pl_sd->status.pet_id > 0 && pl_sd->pd) { - if (pl_sd->pet.rename_flag != 0) { - pl_sd->pet.rename_flag = 0; - intif_save_petdata(pl_sd->status.account_id, &pl_sd->pet); - clif_send_petstatus(pl_sd); - clif_displaymessage(fd, msg_table[189]); // This player can now rename his/her pet. - } else { - clif_displaymessage(fd, msg_table[190]); // This player can already rename his/her pet. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; - } - - return 0; -} - /*========================================== * *------------------------------------------ @@ -6053,38 +5667,6 @@ int atcommand_repairall( return 0; } -/* Removed @nuke for now in favor of alchemist marine sphere skill [Valaris] -int atcommand_nuke( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - char character[100]; - struct map_session_data *pl_sd; - - memset(character, '\0', sizeof(character)); - - if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @nuke )."); - return -1; - } - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can kill only lower or same GM level - skill_castend_damage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0); - clif_displaymessage(fd, msg_table[109]); // Player has been nuked! - } 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/atcommand.h b/src/map/atcommand.h index 80101b9..b90690e 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -2,24 +2,23 @@ #ifndef _ATCOMMAND_H_ #define _ATCOMMAND_H_ +#include "map.h" + enum AtCommandType { AtCommand_None = -1, AtCommand_Broadcast = 0, AtCommand_LocalBroadcast, AtCommand_MapMove, AtCommand_ResetState, - AtCommand_RuraP, - AtCommand_Rura, + AtCommand_CharWarp, AtCommand_Warp, AtCommand_Where, AtCommand_JumpTo, AtCommand_Jump, AtCommand_Who, - AtCommand_Who2, - AtCommand_Who3, + AtCommand_WhoGroup, AtCommand_WhoMap, - AtCommand_WhoMap2, - AtCommand_WhoMap3, + AtCommand_WhoMapGroup, AtCommand_WhoGM, AtCommand_Save, AtCommand_Load, @@ -72,11 +71,6 @@ enum AtCommandType { AtCommand_Dexterity, AtCommand_Luck, AtCommand_GuildLevelUp, - AtCommand_MakeEgg, - AtCommand_PetFriendly, - AtCommand_PetHungry, - AtCommand_PetRename, - AtCommand_CharPetRename, // by Yor AtCommand_Recall, AtCommand_CharacterJob, AtCommand_CharacterJob2, @@ -121,16 +115,12 @@ enum AtCommandType { AtCommand_ReloadItemDB, AtCommand_ReloadMobDB, AtCommand_ReloadSkillDB, -#ifndef TXT_ONLY - AtCommand_Rehash, -#else /* TXT_ONLY */ AtCommand_ReloadScript, -#endif /* TXT_ONLY */ AtCommand_ReloadGMDB, AtCommand_MapInfo, AtCommand_Dye, - AtCommand_Hstyle, - AtCommand_Hcolor, + AtCommand_HairStyle, + AtCommand_HairColor, AtCommand_StatAll, AtCommand_CharChangeSex, // by Yor AtCommand_CharBlock, // by Yor @@ -144,7 +134,6 @@ enum AtCommandType { AtCommand_RepairAll, // [Valaris] AtCommand_GuildRecall, // by Yor AtCommand_PartyRecall, // by Yor -// AtCommand_Nuke, // [Valaris] AtCommand_Enablenpc, AtCommand_Disablenpc, AtCommand_ServerTime, // by Yor @@ -194,21 +183,6 @@ enum AtCommandType { AtCommand_Trade, AtCommand_UnMute, AtCommand_CharWipe, - - // SQL-only commands start -#ifndef TXT_ONLY - AtCommand_CheckMail, // [Valaris] - AtCommand_ListMail, // [Valaris] - AtCommand_ListNewMail, // [Valaris] - AtCommand_ReadMail, // [Valaris] - AtCommand_SendMail, // [Valaris] - AtCommand_DeleteMail, // [Valaris] - AtCommand_SendPriorityMail, // [Valaris] - AtCommand_Sound, // [Valaris] - AtCommand_RefreshOnline, // [Valaris] - // SQL-only commands end -#endif - AtCommand_SetMagic, AtCommand_MagicInfo, AtCommand_Log, @@ -232,17 +206,15 @@ typedef struct AtCommandInfo { const char* command, const char* message); } AtCommandInfo; -AtCommandType -is_atcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl); +AtCommandType is_atcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl); -AtCommandType atcommand( - const int level, const char* message, AtCommandInfo* info); +AtCommandType atcommand(const int level, const char* message, AtCommandInfo* info); int get_atcommand_level(const AtCommandType type); char * msg_txt(int msg_number); // [Yor] -int atcommand_item(const int fd, struct map_session_data* sd,const char* command, const char* message); // [Valaris] -int atcommand_rura(const int fd, struct map_session_data* sd,const char* command, const char* message); // [Yor] +int atcommand_item(const int fd, struct map_session_data* sd, const char* command, const char* message); // [Valaris] +int atcommand_warp(const int fd, struct map_session_data* sd, const char* command, const char* message); // [Yor] int atcommand_spawn(const int fd, struct map_session_data* sd, const char* command, const char* message); // [Valaris] int atcommand_jumpto(const int fd, struct map_session_data* sd, const char* command, const char* message); // [Yor] int atcommand_recall(const int fd, struct map_session_data* sd, const char* command, const char* message); // [Yor] diff --git a/src/map/battle.c b/src/map/battle.c index 918853b..40306b7 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -10,14 +10,13 @@ #include "nullpo.h" #include "malloc.h" +#include "clif.h" +#include "guild.h" +#include "itemdb.h" #include "map.h" +#include "mob.h" #include "pc.h" #include "skill.h" -#include "mob.h" -#include "itemdb.h" -#include "clif.h" -#include "pet.h" -#include "guild.h" #ifdef MEMWATCH #include "memwatch.h" @@ -67,8 +66,6 @@ int battle_get_class(struct block_list *bl) return ((struct mob_data *)bl)->class; else if(bl->type==BL_PC && (struct map_session_data *)bl) return ((struct map_session_data *)bl)->status.class; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return ((struct pet_data *)bl)->class; else return 0; } @@ -84,8 +81,6 @@ int battle_get_dir(struct block_list *bl) return ((struct mob_data *)bl)->dir; else if(bl->type==BL_PC && (struct map_session_data *)bl) return ((struct map_session_data *)bl)->dir; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return ((struct pet_data *)bl)->dir; else return 0; } @@ -101,8 +96,6 @@ int battle_get_lv(struct block_list *bl) return ((struct mob_data *)bl)->stats[MOB_LV]; else if(bl->type==BL_PC && (struct map_session_data *)bl) return ((struct map_session_data *)bl)->status.base_level; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return ((struct pet_data *)bl)->msd->pet.level; else return 0; } @@ -118,8 +111,6 @@ int battle_get_range(struct block_list *bl) return mob_db[((struct mob_data *)bl)->class].range; else if(bl->type==BL_PC && (struct map_session_data *)bl) return ((struct map_session_data *)bl)->attackrange; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class].range; else return 0; } @@ -162,17 +153,6 @@ int battle_get_max_hp(struct block_list *bl) max_hp = (max_hp * battle_config.monster_hp_rate)/100; } } - else if(bl->type==BL_PET && ((struct pet_data*)bl)) { - max_hp = mob_db[((struct pet_data*)bl)->class].max_hp; - if(mob_db[((struct pet_data*)bl)->class].mexp > 0) { - if(battle_config.mvp_hp_rate != 100) - max_hp = (max_hp * battle_config.mvp_hp_rate)/100; - } - else { - if(battle_config.monster_hp_rate != 100) - max_hp = (max_hp * battle_config.monster_hp_rate)/100; - } - } if(sc_data) { if(sc_data[SC_APPLEIDUN].timer!=-1) max_hp += ((5+sc_data[SC_APPLEIDUN].val1*2+((sc_data[SC_APPLEIDUN].val2+1)>>1) @@ -199,8 +179,6 @@ int battle_get_str(struct block_list *bl) str = ((struct mob_data *)bl)->stats[MOB_STR]; else if(bl->type==BL_PC && ((struct map_session_data *)bl)) return ((struct map_session_data *)bl)->paramc[0]; - else if(bl->type==BL_PET && ((struct pet_data *)bl)) - str = mob_db[((struct pet_data *)bl)->class].str; if(sc_data) { if(sc_data[SC_LOUD].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) @@ -233,8 +211,6 @@ int battle_get_agi(struct block_list *bl) agi=((struct mob_data *)bl)->stats[MOB_AGI]; else if(bl->type==BL_PC && (struct map_session_data *)bl) agi=((struct map_session_data *)bl)->paramc[1]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - agi=mob_db[((struct pet_data *)bl)->class].agi; if(sc_data) { if( sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1 && @@ -271,8 +247,6 @@ int battle_get_vit(struct block_list *bl) vit=((struct mob_data *)bl)->stats[MOB_VIT]; else if(bl->type==BL_PC && (struct map_session_data *)bl) vit=((struct map_session_data *)bl)->paramc[2]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - vit=mob_db[((struct pet_data *)bl)->class].vit; if(sc_data) { if(sc_data[SC_STRIPARMOR].timer != -1 && bl->type!=BL_PC) vit = vit*60/100; @@ -299,8 +273,6 @@ int battle_get_int(struct block_list *bl) int_=((struct mob_data *)bl)->stats[MOB_INT]; else if(bl->type==BL_PC && (struct map_session_data *)bl) int_=((struct map_session_data *)bl)->paramc[3]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - int_=mob_db[((struct pet_data *)bl)->class].int_; if(sc_data) { if( sc_data[SC_BLESSING].timer != -1 && bl->type != BL_PC){ // ブレッシング @@ -332,8 +304,6 @@ int battle_get_dex(struct block_list *bl) dex=((struct mob_data *)bl)->stats[MOB_DEX]; else if(bl->type==BL_PC && (struct map_session_data *)bl) dex=((struct map_session_data *)bl)->paramc[4]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - dex=mob_db[((struct pet_data *)bl)->class].dex; if(sc_data) { if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) @@ -369,8 +339,6 @@ int battle_get_luk(struct block_list *bl) luk=((struct mob_data *)bl)->stats[MOB_LUK]; else if(bl->type==BL_PC && (struct map_session_data *)bl) luk=((struct map_session_data *)bl)->paramc[5]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - luk=mob_db[((struct pet_data *)bl)->class].luk; if(sc_data) { if(sc_data[SC_GLORIA].timer!=-1 && bl->type != BL_PC) // グロリア(PCはpc.cで) @@ -551,8 +519,6 @@ int battle_get_atk(struct block_list *bl) atk = ((struct map_session_data*)bl)->watk; else if(bl->type==BL_MOB && (struct mob_data *)bl) atk = ((struct mob_data*)bl)->stats[MOB_ATK1]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - atk = mob_db[((struct pet_data*)bl)->class].atk1; if(sc_data) { if(sc_data[SC_PROVOKE].timer!=-1 && bl->type != BL_PC) @@ -598,8 +564,6 @@ int battle_get_atk2(struct block_list *bl) int atk2=0; if(bl->type==BL_MOB && (struct mob_data *)bl) atk2 = ((struct mob_data*)bl)->stats[MOB_ATK2]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - atk2 = mob_db[((struct pet_data*)bl)->class].atk2; if(sc_data) { if( sc_data[SC_IMPOSITIO].timer!=-1) atk2 += sc_data[SC_IMPOSITIO].val1*5; @@ -655,15 +619,6 @@ int battle_get_matk1(struct block_list *bl) } else if(bl->type==BL_PC && (struct map_session_data *)bl) return ((struct map_session_data *)bl)->matk1; - else if(bl->type==BL_PET){ - int matk,int_=battle_get_int(bl); - matk = int_+(int_/5)*(int_/5); - - if(sc_data) - if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; - return matk; - } else return 0; } @@ -687,14 +642,6 @@ int battle_get_matk2(struct block_list *bl) } else if(bl->type==BL_PC && (struct map_session_data *)bl) return ((struct map_session_data *)bl)->matk2; - else if(bl->type==BL_PET){ - int matk,int_=battle_get_int(bl); - matk = int_+(int_/7)*(int_/7); - if(sc_data) - if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; - return matk; - } else return 0; } @@ -720,8 +667,6 @@ int battle_get_def(struct block_list *bl) skilltimer = ((struct mob_data *)bl)->skilltimer; skillid = ((struct mob_data *)bl)->skillid; } - else if(bl->type==BL_PET && (struct pet_data *)bl) - def = mob_db[((struct pet_data *)bl)->class].def; if(def < 1000000) { if(sc_data) { @@ -779,8 +724,6 @@ int battle_get_mdef(struct block_list *bl) mdef = ((struct map_session_data *)bl)->mdef; else if(bl->type==BL_MOB && (struct mob_data *)bl) mdef = ((struct mob_data *)bl)->stats[MOB_MDEF]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - mdef = mob_db[((struct pet_data *)bl)->class].mdef; if(mdef < 1000000) { if(sc_data) { @@ -818,8 +761,6 @@ int battle_get_def2(struct block_list *bl) def2 = ((struct map_session_data *)bl)->def2; else if(bl->type==BL_MOB) def2 = ((struct mob_data *)bl)->stats[MOB_VIT]; - else if(bl->type==BL_PET) - def2 = mob_db[((struct pet_data *)bl)->class].vit; if(sc_data) { if( sc_data[SC_ANGELUS].timer!=-1 && bl->type != BL_PC) @@ -850,8 +791,6 @@ int battle_get_mdef2(struct block_list *bl) mdef2 = ((struct mob_data *)bl)->stats[MOB_INT] + (((struct mob_data *)bl)->stats[MOB_VIT]>>1); else if(bl->type==BL_PC) mdef2 = ((struct map_session_data *)bl)->mdef2 + (((struct map_session_data *)bl)->paramc[2]>>1); - else if(bl->type==BL_PET) - mdef2 = mob_db[((struct pet_data *)bl)->class].int_ + (mob_db[((struct pet_data *)bl)->class].vit>>1); if(sc_data) { if( sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) mdef2 -= (mdef2*6*sc_data[SC_MINDBREAKER].val1)/100; @@ -875,8 +814,6 @@ int battle_get_speed(struct block_list *bl) int speed = 1000; if(bl->type==BL_MOB && (struct mob_data *)bl) speed = ((struct mob_data *)bl)->stats[MOB_SPEED]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - speed = ((struct pet_data *)bl)->msd->petDB->speed; if(sc_data) { //速度増加時は25%減算 @@ -928,8 +865,6 @@ int battle_get_adelay(struct block_list *bl) int adelay=4000,aspd_rate = 100,i; if(bl->type==BL_MOB && (struct mob_data *)bl) adelay = ((struct mob_data *)bl)->stats[MOB_ADELAY]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - adelay = mob_db[((struct pet_data *)bl)->class].adelay; if(sc_data) { //ツーハンドクイッケン使用時でクァグマイアでも私を忘れないで…でもない時は3割減算 @@ -988,8 +923,6 @@ int battle_get_amotion(struct block_list *bl) int amotion=2000,aspd_rate = 100,i; if(bl->type==BL_MOB && (struct mob_data *)bl) amotion = mob_db[((struct mob_data *)bl)->class].amotion; - else if(bl->type==BL_PET && (struct pet_data *)bl) - amotion = mob_db[((struct pet_data *)bl)->class].amotion; if(sc_data) { if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // 2HQ @@ -1044,8 +977,6 @@ int battle_get_dmotion(struct block_list *bl) if(battle_config.pc_damage_delay_rate != 100) ret = ret*battle_config.pc_damage_delay_rate/400; } - else if(bl->type==BL_PET && (struct pet_data *)bl) - ret=mob_db[((struct pet_data *)bl)->class].dmotion; else return 2000; @@ -1066,8 +997,6 @@ int battle_get_element(struct block_list *bl) ret=((struct mob_data *)bl)->def_ele; else if(bl->type==BL_PC && (struct map_session_data *)bl) ret=20+((struct map_session_data *)bl)->def_ele; // 防御属性Lv1 - else if(bl->type==BL_PET && (struct pet_data *)bl) - ret = mob_db[((struct pet_data *)bl)->class].element; if(sc_data) { if( sc_data[SC_BENEDICTIO].timer!=-1 ) // 聖体降福 @@ -1090,8 +1019,6 @@ int battle_get_attack_element(struct block_list *bl) ret=0; else if(bl->type==BL_PC && (struct map_session_data *)bl) ret=((struct map_session_data *)bl)->atk_ele; - else if(bl->type==BL_PET && (struct pet_data *)bl) - ret=0; if(sc_data) { if( sc_data[SC_FROSTWEAPON].timer!=-1) // フロストウェポン @@ -1170,8 +1097,6 @@ int battle_get_race(struct block_list *bl) return mob_db[((struct mob_data *)bl)->class].race; else if(bl->type==BL_PC && (struct map_session_data *)bl) return 7; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class].race; else return 0; } @@ -1182,8 +1107,6 @@ int battle_get_size(struct block_list *bl) return mob_db[((struct mob_data *)bl)->class].size; else if(bl->type==BL_PC && (struct map_session_data *)bl) return 1; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class].size; else return 1; } @@ -1192,8 +1115,6 @@ int battle_get_mode(struct block_list *bl) nullpo_retr(0x01, bl); if(bl->type==BL_MOB && (struct mob_data *)bl) return mob_db[((struct mob_data *)bl)->class].mode; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class].mode; else return 0x01; // とりあえず動くということで1 } @@ -1207,8 +1128,6 @@ int battle_get_mexp(struct block_list *bl) fprintf(stderr, "Modifier of %x: -> %d\n", mob->stats[MOB_XP_BONUS], retval); return retval; } - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class].mexp; else return 0; } @@ -1319,7 +1238,7 @@ int battle_damage(struct block_list *bl,struct block_list *target,int damage,int nullpo_retr(0, target); //blはNULLで呼ばれることがあるので他でチェック - if(damage==0 || target->type == BL_PET) + if(damage==0) return 0; if(target->prev == NULL) @@ -1390,8 +1309,6 @@ int battle_heal(struct block_list *bl,struct block_list *target,int hp,int sp,in { nullpo_retr(0, target); //blはNULLで呼ばれることがあるので他でチェック - if(target->type == BL_PET) - return 0; if( target->type ==BL_PC && pc_isdead((struct map_session_data *)target) ) return 0; if(hp==0 && sp==0) @@ -1415,8 +1332,6 @@ int battle_stopattack(struct block_list *bl) return mob_stopattack((struct mob_data*)bl); else if(bl->type==BL_PC) return pc_stopattack((struct map_session_data*)bl); - else if(bl->type==BL_PET) - return pet_stopattack((struct pet_data*)bl); return 0; } // 移動停止 @@ -1427,8 +1342,6 @@ int battle_stopwalking(struct block_list *bl,int type) return mob_stop_walking((struct mob_data*)bl,type); else if(bl->type==BL_PC) return pc_stop_walking((struct map_session_data*)bl,type); - else if(bl->type==BL_PET) - return pet_stop_walking((struct pet_data*)bl,type); return 0; } @@ -1783,422 +1696,6 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int return (damage); } -static struct Damage battle_calc_pet_weapon_attack( - struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int wflag) -{ - struct pet_data *pd = (struct pet_data *)src; - struct mob_data *tmd=NULL; - int hitrate,flee,cri = 0,atkmin,atkmax; - int luk,target_count = 1; - int def1 = battle_get_def(target); - int def2 = battle_get_def2(target); - int t_vit = battle_get_vit(target); - struct Damage wd; - int damage,damage2=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); - int flag,dmg_lv=0; - int t_mode=0,t_race=0,t_size=1,s_race=0,s_ele=0; - struct status_change *t_sc_data; - - //return前の処理があるので情報出力部のみ変更 - if( target == NULL || pd == NULL ){ //srcは内容に直接触れていないのでスルーしてみる - nullpo_info(NLP_MARK); - memset(&wd,0,sizeof(wd)); - return wd; - } - - s_race=battle_get_race(src); - s_ele=battle_get_attack_element(src); - - // ターゲット - if(target->type == BL_MOB) - tmd=(struct mob_data *)target; - else { - memset(&wd,0,sizeof(wd)); - return wd; - } - t_race=battle_get_race( target ); - t_size=battle_get_size( target ); - t_mode=battle_get_mode( target ); - t_sc_data=battle_get_sc_data( target ); - - flag=BF_SHORT|BF_WEAPON|BF_NORMAL; // 攻撃の種類の設定 - - // 回避率計算、回避判定は後で - flee = battle_get_flee(target); - if(battle_config.agi_penaly_type > 0 || battle_config.vit_penaly_type > 0) - target_count += battle_counttargeted(target,src,battle_config.agi_penaly_count_lv); - if(battle_config.agi_penaly_type > 0) { - if(target_count >= battle_config.agi_penaly_count) { - if(battle_config.agi_penaly_type == 1) - flee = (flee * (100 - (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num))/100; - else if(battle_config.agi_penaly_type == 2) - flee -= (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num; - if(flee < 1) flee = 1; - } - } - hitrate=battle_get_hit(src) - flee + 80; - - type=0; // normal - div_ = 1; // single attack - - luk=battle_get_luk(src); - - if(battle_config.pet_str) - damage = battle_get_baseatk(src); - else - damage = 0; - - if(skill_num==HW_MAGICCRASHER){ /* マジッククラッシャーはMATKで殴る */ - atkmin = battle_get_matk1(src); - atkmax = battle_get_matk2(src); - }else{ - atkmin = battle_get_atk(src); - atkmax = battle_get_atk2(src); - } - if(mob_db[pd->class].range>3 ) - flag=(flag&~BF_RANGEMASK)|BF_LONG; - - if(atkmin > atkmax) atkmin = atkmax; - - cri = battle_get_critical(src); - cri -= battle_get_luk(target) * 2; // luk/5*10 => target_luk*2 not target_luk*3 - if(battle_config.enemy_critical_rate != 100) { - cri = cri*battle_config.enemy_critical_rate/100; - if(cri < 1) - cri = 1; - } - if(t_sc_data != NULL && t_sc_data[SC_SLEEP].timer!=-1 ) - cri <<=1; - - if(skill_num == 0 && skill_lv >= 0 && battle_config.enemy_critical && (MRAND(1000)) < cri) - { - damage += atkmax; - type = 0x0a; - } - else { - int vitbonusmax; - - if(atkmax > atkmin) - damage += atkmin + MRAND((atkmax-atkmin + 1)); - else - damage += atkmin ; - // スキル修正1(攻撃力倍化系) - // オーバートラスト(+5% 〜 +25%),他攻撃系スキルの場合ここで補正 - // バッシュ,マグナムブレイク, - // ボーリングバッシュ,スピアブーメラン,ブランディッシュスピア,スピアスタッブ, - // メマーナイト,カートレボリューション - // ダブルストレイフィング,アローシャワー,チャージアロー, - // ソニックブロー - if(skill_num>0){ - int i; - if( (i=skill_get_pl(skill_num))>0 ) - s_ele=i; - - flag=(flag&~BF_SKILLMASK)|BF_SKILL; - switch( skill_num ){ - case SM_BASH: // バッシュ - damage = damage*(100+ 30*skill_lv)/100; - hitrate = (hitrate*(100+5*skill_lv))/100; - break; - case SM_MAGNUM: // マグナムブレイク - damage = damage*(5*skill_lv +(wflag)?65:115 )/100; - break; - case MC_MAMMONITE: // メマーナイト - damage = damage*(100+ 50*skill_lv)/100; - break; - case AC_DOUBLE: // ダブルストレイフィング - damage = damage*(180+ 20*skill_lv)/100; - div_=2; - flag=(flag&~BF_RANGEMASK)|BF_LONG; - break; - case AC_SHOWER: // アローシャワー - damage = damage*(75 + 5*skill_lv)/100; - flag=(flag&~BF_RANGEMASK)|BF_LONG; - break; - case AC_CHARGEARROW: // チャージアロー - damage = damage*150/100; - flag=(flag&~BF_RANGEMASK)|BF_LONG; - break; - case KN_PIERCE: // ピアース - damage = damage*(100+ 10*skill_lv)/100; - hitrate = hitrate*(100+5*skill_lv)/100; - div_=t_size+1; - damage*=div_; - break; - case KN_SPEARSTAB: // スピアスタブ - damage = damage*(100+ 15*skill_lv)/100; - break; - case KN_SPEARBOOMERANG: // スピアブーメラン - damage = damage*(100+ 50*skill_lv)/100; - flag=(flag&~BF_RANGEMASK)|BF_LONG; - break; - case KN_BRANDISHSPEAR: // ブランディッシュスピア - damage = damage*(100+ 20*skill_lv)/100; - if(skill_lv>3 && wflag==1) damage2+=damage/2; - if(skill_lv>6 && wflag==1) damage2+=damage/4; - if(skill_lv>9 && wflag==1) damage2+=damage/8; - if(skill_lv>6 && wflag==2) damage2+=damage/2; - if(skill_lv>9 && wflag==2) damage2+=damage/4; - if(skill_lv>9 && wflag==3) damage2+=damage/2; - damage +=damage2; - blewcount=0; - break; - case KN_BOWLINGBASH: // ボウリングバッシュ - damage = damage*(100+ 50*skill_lv)/100; - blewcount=0; - break; - case AS_SONICBLOW: // ソニックブロウ - damage = damage*(300+ 50*skill_lv)/100; - div_=8; - break; - case TF_SPRINKLESAND: // 砂まき - damage = damage*125/100; - break; - case MC_CARTREVOLUTION: // カートレボリューション - damage = (damage*150)/100; - break; - // 以下MOB - case NPC_COMBOATTACK: // 多段攻撃 - div_=skill_get_num(skill_num,skill_lv); - damage *= div_; - break; - case NPC_RANDOMATTACK: // ランダムATK攻撃 - damage = damage*(MPRAND(50, 150))/100; - break; - // 属性攻撃(適当) - case NPC_WATERATTACK: - case NPC_GROUNDATTACK: - case NPC_FIREATTACK: - case NPC_WINDATTACK: - case NPC_POISONATTACK: - case NPC_HOLYATTACK: - case NPC_DARKNESSATTACK: - case NPC_TELEKINESISATTACK: - div_= pd->skillduration; // [Valaris] - break; - case NPC_GUIDEDATTACK: - hitrate = 1000000; - break; - case NPC_RANGEATTACK: - flag=(flag&~BF_RANGEMASK)|BF_LONG; - break; - case NPC_PIERCINGATT: - flag=(flag&~BF_RANGEMASK)|BF_SHORT; - break; - case RG_BACKSTAP: // バックスタブ - damage = damage*(300+ 40*skill_lv)/100; - hitrate = 1000000; - break; - case RG_RAID: // サプライズアタック - damage = damage*(100+ 40*skill_lv)/100; - break; - case RG_INTIMIDATE: // インティミデイト - damage = damage*(100+ 30*skill_lv)/100; - break; - case CR_SHIELDCHARGE: // シールドチャージ - damage = damage*(100+ 20*skill_lv)/100; - flag=(flag&~BF_RANGEMASK)|BF_SHORT; - s_ele = 0; - break; - case CR_SHIELDBOOMERANG: // シールドブーメラン - damage = damage*(100+ 30*skill_lv)/100; - flag=(flag&~BF_RANGEMASK)|BF_LONG; - s_ele = 0; - break; - case CR_HOLYCROSS: // ホーリークロス - damage = damage*(100+ 35*skill_lv)/100; - div_=2; - break; - case CR_GRANDCROSS: - hitrate= 1000000; - break; - case AM_DEMONSTRATION: // デモンストレーション - damage = damage*(100+ 20*skill_lv)/100; - damage2 = damage2*(100+ 20*skill_lv)/100; - break; - case AM_ACIDTERROR: // アシッドテラー - damage = damage*(100+ 40*skill_lv)/100; - damage2 = damage2*(100+ 40*skill_lv)/100; - break; - case MO_FINGEROFFENSIVE: //指弾 - damage = damage * (100 + 50 * skill_lv) / 100; - div_ = 1; - break; - case MO_INVESTIGATE: // 発 勁 - if(def1 < 1000000) - damage = damage*(100+ 75*skill_lv)/100 * (def1 + def2)/100; - hitrate = 1000000; - s_ele = 0; - break; - case MO_EXTREMITYFIST: // 阿修羅覇鳳拳 - damage = damage * 8 + 250 + (skill_lv * 150); - hitrate = 1000000; - s_ele = 0; - break; - case MO_CHAINCOMBO: // 連打掌 - damage = damage*(150+ 50*skill_lv)/100; - div_=4; - break; - case MO_COMBOFINISH: // 猛龍拳 - damage = damage*(240+ 60*skill_lv)/100; - break; - case DC_THROWARROW: // 矢撃ち - damage = damage*(100+ 50 * skill_lv)/100; - flag=(flag&~BF_RANGEMASK)|BF_LONG; - break; - case BA_MUSICALSTRIKE: // ミュージカルストライク - damage = damage*(100+ 50 * skill_lv)/100; - flag=(flag&~BF_RANGEMASK)|BF_LONG; - break; - case CH_TIGERFIST: // 伏虎拳 - damage = damage*(100+ 20*skill_lv)/100; - break; - case CH_CHAINCRUSH: // 連柱崩撃 - damage = damage*(100+ 20*skill_lv)/100; - div_=skill_get_num(skill_num,skill_lv); - break; - case CH_PALMSTRIKE: // 猛虎硬派山 - damage = damage*(50+ 100*skill_lv)/100; - break; - case LK_SPIRALPIERCE: /* スパイラルピアース */ - damage = damage*(100+ 50*skill_lv)/100; //増加量が分からないので適当に - div_=5; - if(target->type == BL_PC) - ((struct map_session_data *)target)->canmove_tick = gettick() + 1000; - else if(target->type == BL_MOB) - ((struct mob_data *)target)->canmove_tick = gettick() + 1000; - break; - case LK_HEADCRUSH: /* ヘッドクラッシュ */ - damage = damage*(100+ 20*skill_lv)/100; - break; - case LK_JOINTBEAT: /* ジョイントビート */ - damage = damage*(50+ 10*skill_lv)/100; - break; - case ASC_METEORASSAULT: /* メテオアサルト */ - damage = damage*(40+ 40*skill_lv)/100; - break; - case SN_SHARPSHOOTING: /* シャープシューティング */ - damage += damage*(30*skill_lv)/100; - break; - case CG_ARROWVULCAN: /* アローバルカン */ - damage = damage*(160+40*skill_lv)/100; - div_=9; - break; - case AS_SPLASHER: /* ベナムスプラッシャー */ - damage = damage*(200+20*skill_lv)/100; - break; - } - } - - if( skill_num!=NPC_CRITICALSLASH ){ - // 対 象の防御力によるダメージの減少 - // ディバインプロテクション(ここでいいのかな?) - if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && def1 < 1000000 ) { //DEF, VIT無視 - int t_def; - target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penaly_count_lv); - if(battle_config.vit_penaly_type > 0) { - if(target_count >= battle_config.vit_penaly_count) { - if(battle_config.vit_penaly_type == 1) { - def1 = (def1 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - def2 = (def2 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - t_vit = (t_vit * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - } - else if(battle_config.vit_penaly_type == 2) { - def1 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - def2 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - t_vit -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - } - if(def1 < 0) def1 = 0; - if(def2 < 1) def2 = 1; - if(t_vit < 1) t_vit = 1; - } - } - t_def = def2*8/10; - vitbonusmax = (t_vit/20)*(t_vit/20)-1; - if(battle_config.pet_defense_type) { - damage = damage - (def1 * battle_config.pet_defense_type) - t_def - ((vitbonusmax < 1)?0: MRAND((vitbonusmax+1)) ); - } - else{ - damage = damage * (100 - def1) /100 - t_def - ((vitbonusmax < 1)?0: MRAND((vitbonusmax+1)) ); - } - } - } - } - - // 0未満だった場合1に補正 - if(damage<1) damage=1; - - // 回避修正 - if(hitrate < 1000000) - hitrate = ( (hitrate>95)?95: ((hitrate<5)?5:hitrate) ); - if( hitrate < 1000000 && // 必中攻撃 - (t_sc_data != NULL && (t_sc_data[SC_SLEEP].timer!=-1 || // 睡眠は必中 - t_sc_data[SC_STAN].timer!=-1 || // スタンは必中 - t_sc_data[SC_FREEZE].timer!=-1 || (t_sc_data[SC_STONE].timer!=-1 && t_sc_data[SC_STONE].val2==0) ) ) ) // 凍結は必中 - hitrate = 1000000; - if(type == 0 && MRAND(100) >= hitrate) { - damage = damage2 = 0; - dmg_lv = ATK_FLEE; - } else { - dmg_lv = ATK_DEF; - } - - - if(t_sc_data) { - int cardfix=100; - if(t_sc_data[SC_DEFENDER].timer != -1 && flag&BF_LONG) - cardfix=cardfix*(100-t_sc_data[SC_DEFENDER].val2)/100; - if(cardfix != 100) - damage=damage*cardfix/100; - } - if(damage < 0) damage = 0; - - // 属 性の適用 - if(skill_num != 0 || s_ele != 0 || !battle_config.pet_attack_attr_none) - damage=battle_attr_fix(damage, s_ele, battle_get_element(target) ); - - if(skill_num==PA_PRESSURE) /* プレッシャー 必中? */ - damage = 700+100*skill_lv; - - // インベナム修正 - if(skill_num==TF_POISON){ - damage = battle_attr_fix(damage + 15*skill_lv, s_ele, battle_get_element(target) ); - } - if(skill_num==MC_CARTREVOLUTION){ - damage = battle_attr_fix(damage, 0, battle_get_element(target) ); - } - - // 完全回避の判定 - if(battle_config.enemy_perfect_flee) { - if(skill_num == 0 && skill_lv >= 0 && tmd!=NULL && MRAND(1000) < battle_get_flee2(target) ){ - damage=0; - type=0x0b; - dmg_lv = ATK_LUCKY; - } - } - -// if(def1 >= 1000000 && damage > 0) - if(t_mode&0x40 && damage > 0) - damage = 1; - - if(skill_num != CR_GRANDCROSS) - damage=battle_calc_damage(src,target,damage,div_,skill_num,skill_lv,flag); - - wd.damage=damage; - wd.damage2=0; - wd.type=type; - wd.div_=div_; - wd.amotion=battle_get_amotion(src); - if(skill_num == KN_AUTOCOUNTER) - wd.amotion >>= 1; - wd.dmotion=battle_get_dmotion(target); - wd.blewcount=blewcount; - wd.flag=flag; - wd.dmg_lv=dmg_lv; - - return wd; -} - static struct Damage battle_calc_mob_weapon_attack( struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int wflag) { @@ -3827,15 +3324,10 @@ struct Damage battle_calc_weapon_attack( return wd; } - if(target->type == BL_PET) - memset(&wd,0,sizeof(wd)); - else if(src->type == BL_PC) wd = battle_calc_pc_weapon_attack(src,target,skill_num,skill_lv,wflag); // weapon breaking [Valaris] else if(src->type == BL_MOB) wd = battle_calc_mob_weapon_attack(src,target,skill_num,skill_lv,wflag); - else if(src->type == BL_PET) - wd = battle_calc_pet_weapon_attack(src,target,skill_num,skill_lv,wflag); else memset(&wd,0,sizeof(wd)); @@ -3897,11 +3389,6 @@ struct Damage battle_calc_magic_attack( return md; } - if(target->type == BL_PET) { - memset(&md,0,sizeof(md)); - return md; - } - matk1=battle_get_matk1(bl); matk2=battle_get_matk2(bl); ele = skill_get_pl(skill_num); @@ -4189,11 +3676,6 @@ struct Damage battle_calc_misc_attack( return md; } - if(target->type == BL_PET) { - memset(&md,0,sizeof(md)); - return md; - } - if( bl->type == BL_PC && (sd=(struct map_session_data *)bl) ) { sd->state.attack_type = BF_MISC; sd->state.arrow_atk = 0; @@ -4655,9 +4137,6 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f } } - if(target->type == BL_PET) - return -1; - // スキルユニットの場合、親を求める if( src->type==BL_SKILL) { int inf2 = skill_get_inf2(((struct skill_unit *)src)->group->skill_id); @@ -4716,9 +4195,6 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f (ss->type == BL_MOB && target->type==BL_PC) ) return 0; // PCvsMOBなら否定 - if(ss->type == BL_PET && target->type==BL_MOB) - return 0; - s_p=battle_get_party_id(ss); s_g=battle_get_guild_id(ss); @@ -4909,18 +4385,6 @@ int battle_config_read(const char *cfgName) battle_config.guild_emperium_check=1; battle_config.guild_exp_limit=50; battle_config.pc_invincible_time = 5000; - battle_config.pet_catch_rate=100; - battle_config.pet_rename=0; - battle_config.pet_friendly_rate=100; - battle_config.pet_hungry_delay_rate=100; - battle_config.pet_hungry_friendly_decrease=5; - battle_config.pet_str=1; - battle_config.pet_status_support=0; - battle_config.pet_attack_support=0; - battle_config.pet_damage_support=0; - battle_config.pet_support_rate=100; - battle_config.pet_attack_exp_to_master=0; - battle_config.pet_attack_exp_rate=100; battle_config.skill_min_damage=0; battle_config.finger_offensive_type=0; battle_config.heal_exp=0; @@ -4962,7 +4426,6 @@ int battle_config_read(const char *cfgName) battle_config.vit_penaly_count_lv = ATK_DEF; battle_config.player_defense_type = 0; battle_config.monster_defense_type = 0; - battle_config.pet_defense_type = 0; battle_config.magic_defense_type = 0; battle_config.pc_skill_reiteration = 0; battle_config.monster_skill_reiteration = 0; @@ -4991,10 +4454,8 @@ int battle_config_read(const char *cfgName) battle_config.chat_warpportal = 0; battle_config.mob_warpportal = 0; battle_config.dead_branch_active = 0; - battle_config.vending_max_value = 10000000; battle_config.show_steal_in_same_party = 0; battle_config.enable_upper_class = 0; - battle_config.pet_attack_attr_none = 0; battle_config.pc_attack_attr_none = 0; battle_config.mob_attack_attr_none = 1; battle_config.mob_ghostring_fix = 0; @@ -5031,7 +4492,6 @@ int battle_config_read(const char *cfgName) battle_config.equipment_breaking = 0; // [Valaris] battle_config.equipment_break_rate = 100; // [Valaris] battle_config.pk_mode = 0; // [Valaris] - battle_config.pet_equip_required = 0; // [Valaris] battle_config.multi_level_up = 0; // [Valaris] battle_config.backstab_bow_penalty = 0; // Akaru battle_config.night_at_start = 0; // added by [Yor] @@ -5142,18 +4602,6 @@ int battle_config_read(const char *cfgName) { "guild_emperium_check", &battle_config.guild_emperium_check }, { "guild_exp_limit", &battle_config.guild_exp_limit }, { "player_invincible_time", &battle_config.pc_invincible_time }, - { "pet_catch_rate", &battle_config.pet_catch_rate }, - { "pet_rename", &battle_config.pet_rename }, - { "pet_friendly_rate", &battle_config.pet_friendly_rate }, - { "pet_hungry_delay_rate", &battle_config.pet_hungry_delay_rate }, - { "pet_hungry_friendly_decrease", &battle_config.pet_hungry_friendly_decrease}, - { "pet_str", &battle_config.pet_str }, - { "pet_status_support", &battle_config.pet_status_support }, - { "pet_attack_support", &battle_config.pet_attack_support }, - { "pet_damage_support", &battle_config.pet_damage_support }, - { "pet_support_rate", &battle_config.pet_support_rate }, - { "pet_attack_exp_to_master", &battle_config.pet_attack_exp_to_master }, - { "pet_attack_exp_rate", &battle_config.pet_attack_exp_rate }, { "skill_min_damage", &battle_config.skill_min_damage }, { "finger_offensive_type", &battle_config.finger_offensive_type }, { "heal_exp", &battle_config.heal_exp }, @@ -5195,7 +4643,6 @@ int battle_config_read(const char *cfgName) { "vit_penaly_count_lv", &battle_config.vit_penaly_count_lv }, { "player_defense_type", &battle_config.player_defense_type }, { "monster_defense_type", &battle_config.monster_defense_type }, - { "pet_defense_type", &battle_config.pet_defense_type }, { "magic_defense_type", &battle_config.magic_defense_type }, { "player_skill_reiteration", &battle_config.pc_skill_reiteration }, { "monster_skill_reiteration", &battle_config.monster_skill_reiteration}, @@ -5223,10 +4670,8 @@ int battle_config_read(const char *cfgName) { "chat_warpportal", &battle_config.chat_warpportal }, { "mob_warpportal", &battle_config.mob_warpportal }, { "dead_branch_active", &battle_config.dead_branch_active }, - { "vending_max_value", &battle_config.vending_max_value }, { "show_steal_in_same_party", &battle_config.show_steal_in_same_party }, { "enable_upper_class", &battle_config.enable_upper_class }, - { "pet_attack_attr_none", &battle_config.pet_attack_attr_none }, { "mob_attack_attr_none", &battle_config.mob_attack_attr_none }, { "mob_ghostring_fix", &battle_config.mob_ghostring_fix }, { "pc_attack_attr_none", &battle_config.pc_attack_attr_none }, @@ -5263,7 +4708,6 @@ int battle_config_read(const char *cfgName) { "equipment_breaking", &battle_config.equipment_breaking }, // [Valaris] { "equipment_break_rate", &battle_config.equipment_break_rate }, // [Valaris] { "pk_mode", &battle_config.pk_mode }, // [Valaris] - { "pet_equip_required", &battle_config.pet_equip_required }, // [Valaris] { "multi_level_up", &battle_config.multi_level_up }, // [Valaris] { "backstab_bow_penalty", &battle_config.backstab_bow_penalty }, { "night_at_start", &battle_config.night_at_start }, // added by [Yor] diff --git a/src/map/battle.h b/src/map/battle.h index f8a3205..27b837b 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -186,18 +186,6 @@ extern struct Battle_Config { int guild_exp_limit; int guild_max_castles; int pc_invincible_time; - int pet_catch_rate; - int pet_rename; - int pet_friendly_rate; - int pet_hungry_delay_rate; - int pet_hungry_friendly_decrease; - int pet_str; - int pet_status_support; - int pet_attack_support; - int pet_damage_support; - int pet_support_rate; - int pet_attack_exp_to_master; - int pet_attack_exp_rate; int skill_min_damage; int finger_offensive_type; int heal_exp; @@ -236,7 +224,6 @@ extern struct Battle_Config { int vit_penaly_num; int player_defense_type; int monster_defense_type; - int pet_defense_type; int magic_defense_type; int pc_skill_reiteration; int monster_skill_reiteration; @@ -265,12 +252,8 @@ extern struct Battle_Config { int chat_warpportal; int mob_warpportal; int dead_branch_active; - int vending_max_value; -// int pet_lootitem; // removed [Valaris] -// int pet_weight; // removed [Valaris] int show_steal_in_same_party; int enable_upper_class; - int pet_attack_attr_none; int mob_attack_attr_none; int mob_ghostring_fix; int pc_attack_attr_none; @@ -290,7 +273,6 @@ extern struct Battle_Config { int monsters_ignore_gm; int equipment_breaking; int equipment_break_rate; - int pet_equip_required; int multi_level_up; int pk_mode; int show_mob_hp; // end additions [Valaris] diff --git a/src/map/clif.c b/src/map/clif.c index 211b4f3..c070659 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -24,26 +24,24 @@ #include "version.h" #include "nullpo.h" -#include "map.h" +#include "atcommand.h" +#include "battle.h" +#include "chat.h" #include "chrif.h" #include "clif.h" -#include "pc.h" -#include "npc.h" -#include "itemdb.h" -#include "chat.h" -#include "trade.h" -#include "storage.h" -#include "script.h" -#include "skill.h" -#include "atcommand.h" +#include "guild.h" #include "intif.h" -#include "battle.h" +#include "itemdb.h" +#include "magic.h" +#include "map.h" #include "mob.h" +#include "npc.h" #include "party.h" -#include "guild.h" -#include "vending.h" -#include "pet.h" -#include "magic.h" +#include "pc.h" +#include "script.h" +#include "skill.h" +#include "storage.h" +#include "trade.h" #ifdef MEMWATCH #include "memwatch.h" @@ -1034,91 +1032,6 @@ static int clif_npc0078(struct npc_data *nd, unsigned char *buf) { return packet_len_table[0x78]; } -/*========================================== - * - *------------------------------------------ - */ -static int clif_pet0078(struct pet_data *pd, unsigned char *buf) { - int view,level; - - nullpo_retr(0, pd); - - memset(buf,0,packet_len_table[0x78]); - - WBUFW(buf,0)=0x78; - WBUFL(buf,2)=pd->bl.id; - WBUFW(buf,6)=pd->speed; - WBUFW(buf,14)=mob_get_viewclass(pd->class); - if((mob_get_viewclass(pd->class) < 24) || (mob_get_viewclass(pd->class) > 4000)) { - WBUFW(buf,12)=mob_db[pd->class].option; - WBUFW(buf,16)=mob_get_hair(pd->class); - WBUFW(buf,18)=mob_get_weapon(pd->class); - WBUFW(buf,20)=mob_get_head_buttom(pd->class); - WBUFW(buf,22)=mob_get_shield(pd->class); - WBUFW(buf,24)=mob_get_head_top(pd->class); - WBUFW(buf,26)=mob_get_head_mid(pd->class); - WBUFW(buf,28)=mob_get_hair_color(pd->class); - WBUFW(buf,30)=mob_get_clothes_color(pd->class); //Add for player pet dye - Valaris - WBUFB(buf,45)=mob_get_sex(pd->class); - } else { - WBUFW(buf,16)=0x14; - if((view = itemdb_viewid(pd->equip)) > 0) - WBUFW(buf,20)=view; - else - WBUFW(buf,20)=pd->equip; - } - WBUFPOS(buf,46,pd->bl.x,pd->bl.y); - WBUFB(buf,48)|=pd->dir&0x0f; - WBUFB(buf,49)=0; - WBUFB(buf,50)=0; - WBUFW(buf,52)=((level = battle_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level; - - return packet_len_table[0x78]; -} - -/*========================================== - * - *------------------------------------------ - */ -static int clif_pet007b(struct pet_data *pd, unsigned char *buf) { - int view,level; - - nullpo_retr(0, pd); - - memset(buf,0,packet_len_table[0x7b]); - - WBUFW(buf,0)=0x7b; - WBUFL(buf,2)=pd->bl.id; - WBUFW(buf,6)=pd->speed; - WBUFW(buf,14)=mob_get_viewclass(pd->class); - if((mob_get_viewclass(pd->class) < 24) || (mob_get_viewclass(pd->class) > 4000)) { - WBUFW(buf,12)=mob_db[pd->class].option; - WBUFW(buf,16)=mob_get_hair(pd->class); - WBUFW(buf,18)=mob_get_weapon(pd->class); - WBUFW(buf,20)=mob_get_head_buttom(pd->class); - WBUFL(buf,22)=gettick(); - WBUFW(buf,26)=mob_get_shield(pd->class); - WBUFW(buf,28)=mob_get_head_top(pd->class); - WBUFW(buf,30)=mob_get_head_mid(pd->class); - WBUFW(buf,32)=mob_get_hair_color(pd->class); - WBUFW(buf,34)=mob_get_clothes_color(pd->class); //Add for player pet dye - Valaris - WBUFB(buf,49)=mob_get_sex(pd->class); - } else { - WBUFW(buf,16)=0x14; - if ((view = itemdb_viewid(pd->equip)) > 0) - WBUFW(buf,20)=view; - else - WBUFW(buf,20)=pd->equip; - WBUFL(buf,22)=gettick(); - } - WBUFPOS2(buf,50,pd->bl.x,pd->bl.y,pd->to_x,pd->to_y); - WBUFB(buf,56)=0; - WBUFB(buf,57)=0; - WBUFW(buf,58)=((level = battle_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level; - - return packet_len_table[0x7b]; -} - /*========================================== * *------------------------------------------ @@ -1344,53 +1257,6 @@ int clif_spawnmob(struct mob_data *md) return 0; } -// pet - -/*========================================== - * - *------------------------------------------ - */ -int clif_spawnpet(struct pet_data *pd) -{ - unsigned char buf[64]; - int len; - - nullpo_retr(0, pd); - - if (mob_get_viewclass(pd->class) >= MAX_PC_CLASS) { - memset(buf,0,packet_len_table[0x7c]); - - WBUFW(buf,0)=0x7c; - WBUFL(buf,2)=pd->bl.id; - WBUFW(buf,6)=pd->speed; - WBUFW(buf,20)=mob_get_viewclass(pd->class); - WBUFPOS(buf,36,pd->bl.x,pd->bl.y); - - clif_send(buf,packet_len_table[0x7c],&pd->bl,AREA); - } - - len = clif_pet0078(pd,buf); - clif_send(buf,len,&pd->bl,AREA); - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int clif_movepet(struct pet_data *pd) { - unsigned char buf[256]; - int len; - - nullpo_retr(0, pd); - - len = clif_pet007b(pd,buf); - clif_send(buf,len,&pd->bl,AREA); - - return 0; -} - /*========================================== * *------------------------------------------ @@ -3393,9 +3259,6 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds if(cd->usersd[0]==dstsd) clif_dispchat(cd,sd->fd); } - if(dstsd->vender_id){ - clif_showvendingboard(&dstsd->bl,dstsd->message,sd->fd); - } if(dstsd->spiritball > 0) { clif_set01e1(dstsd,WFIFOP(sd->fd,0)); WFIFOSET(sd->fd,packet_len_table[0x1e1]); @@ -3498,28 +3361,6 @@ int clif_fixpcpos(struct map_session_data *sd) return 0; } -/*========================================== - * - *------------------------------------------ - */ -int clif_fixpetpos(struct pet_data *pd) -{ - unsigned char buf[256]; - int len; - - nullpo_retr(0, pd); - - if(pd->state.state == MS_WALK){ - len = clif_pet007b(pd,buf); - clif_send(buf,len,&pd->bl,AREA); - } else { - len = clif_pet0078(pd,buf); - clif_send(buf,len,&pd->bl,AREA); - } - - return 0; -} - /*========================================== * 通常攻撃エフェクト&ダメージ *------------------------------------------ @@ -3584,26 +3425,6 @@ void clif_getareachar_mob(struct map_session_data* sd,struct mob_data* md) clif_mob_equip(md,mob_get_equip(md->class)); } -/*========================================== - * - *------------------------------------------ - */ -void clif_getareachar_pet(struct map_session_data* sd,struct pet_data* pd) -{ - int len; - - nullpo_retv(sd); - nullpo_retv(pd); - - if(pd->state.state == MS_WALK){ - len = clif_pet007b(pd,WFIFOP(sd->fd,0)); - WFIFOSET(sd->fd,len); - } else { - len = clif_pet0078(pd,WFIFOP(sd->fd,0)); - WFIFOSET(sd->fd,len); - } -} - /*========================================== * *------------------------------------------ @@ -3748,9 +3569,6 @@ int clif_01ac(struct block_list *bl) case BL_MOB: clif_getareachar_mob(sd,(struct mob_data*) bl); break; - case BL_PET: - clif_getareachar_pet(sd,(struct pet_data*) bl); - break; case BL_ITEM: clif_getareachar_item(sd,(struct flooritem_data*) bl); break; @@ -3789,9 +3607,6 @@ int clif_pcoutsight(struct block_list *bl,va_list ap) if(cd->usersd[0]==dstsd) clif_dispchat(cd,sd->fd); } - if(dstsd->vender_id){ - clif_closevendingboard(&dstsd->bl,sd->fd); - } } break; case BL_NPC: @@ -3799,7 +3614,6 @@ int clif_pcoutsight(struct block_list *bl,va_list ap) clif_clearchar_id(bl->id,0,sd->fd); break; case BL_MOB: - case BL_PET: clif_clearchar_id(bl->id,0,sd->fd); break; case BL_ITEM: @@ -3838,9 +3652,6 @@ int clif_pcinsight(struct block_list *bl,va_list ap) case BL_MOB: clif_getareachar_mob(sd,(struct mob_data*)bl); break; - case BL_PET: - clif_getareachar_pet(sd,(struct pet_data*)bl); - break; case BL_ITEM: clif_getareachar_item(sd,(struct flooritem_data*)bl); break; @@ -3892,46 +3703,6 @@ int clif_mobinsight(struct block_list *bl,va_list ap) return 0; } -/*========================================== - * - *------------------------------------------ - */ -int clif_petoutsight(struct block_list *bl,va_list ap) -{ - struct map_session_data *sd; - struct pet_data *pd; - - nullpo_retr(0, bl); - nullpo_retr(0, ap); - nullpo_retr(0, pd=va_arg(ap,struct pet_data*)); - - if(bl->type==BL_PC && (sd = (struct map_session_data*) bl)){ - clif_clearchar_id(pd->bl.id,0,sd->fd); - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int clif_petinsight(struct block_list *bl,va_list ap) -{ - struct map_session_data *sd; - struct pet_data *pd; - - nullpo_retr(0, bl); - nullpo_retr(0, ap); - - pd=va_arg(ap,struct pet_data*); - if(bl->type==BL_PC && (sd = (struct map_session_data *)bl)){ - clif_getareachar_pet(sd,pd); - } - - return 0; -} - /*========================================== * *------------------------------------------ @@ -4979,248 +4750,6 @@ int clif_cart_equiplist(struct map_session_data *sd) return 0; } -/*========================================== - * 露店開設 - *------------------------------------------ - */ -int clif_openvendingreq(struct map_session_data *sd,int num) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x12d; - WFIFOW(fd,2)=num; - WFIFOSET(fd,packet_len_table[0x12d]); - - return 0; -} - -/*========================================== - * 露店看板表示 - *------------------------------------------ - */ -int clif_showvendingboard(struct block_list* bl,char *message,int fd) -{ - unsigned char buf[128]; - - nullpo_retr(0, bl); - - WBUFW(buf,0)=0x131; - WBUFL(buf,2)=bl->id; - strncpy(WBUFP(buf,6),message,80); - if(fd){ - memcpy(WFIFOP(fd,0),buf,packet_len_table[0x131]); - WFIFOSET(fd,packet_len_table[0x131]); - }else{ - clif_send(buf,packet_len_table[0x131],bl,AREA_WOS); - } - return 0; -} - -/*========================================== - * 露店看板消去 - *------------------------------------------ - */ -int clif_closevendingboard(struct block_list* bl,int fd) -{ - unsigned char buf[16]; - - nullpo_retr(0, bl); - - WBUFW(buf,0)=0x132; - WBUFL(buf,2)=bl->id; - if(fd){ - memcpy(WFIFOP(fd,0),buf,packet_len_table[0x132]); - WFIFOSET(fd,packet_len_table[0x132]); - }else{ - clif_send(buf,packet_len_table[0x132],bl,AREA_WOS); - } - - return 0; -} -/*========================================== - * 露店アイテムリスト - *------------------------------------------ - */ -int clif_vendinglist(struct map_session_data *sd,int id,struct vending *vending) -{ - struct item_data *data; - int i,j,n,index,fd; - struct map_session_data *vsd; - unsigned char *buf; - - nullpo_retr(0, sd); - nullpo_retr(0, vending); - nullpo_retr(0, vsd=map_id2sd(id)); - - fd=sd->fd; - buf = WFIFOP(fd,0); - WBUFW(buf,0)=0x133; - WBUFL(buf,4)=id; - for(i=0,n=0;ivend_num;i++){ - if(vending[i].amount<=0) - continue; - WBUFL(buf,8+n*22)=vending[i].value; - WBUFW(buf,12+n*22)=vending[i].amount; - WBUFW(buf,14+n*22)=(index=vending[i].index)+2; - if(vsd->status.cart[index].nameid <= 0 || vsd->status.cart[index].amount <= 0) - continue; - data = itemdb_search(vsd->status.cart[index].nameid); - WBUFB(buf,16+n*22)=data->type; - if(data->view_id > 0) - WBUFW(buf,17+n*22)=data->view_id; - else - WBUFW(buf,17+n*22)=vsd->status.cart[index].nameid; - WBUFB(buf,19+n*22)=vsd->status.cart[index].identify; - if(vsd->status.cart[index].broken==1) - WBUFB(buf,20+n*22)=1; //is weapon broken [Valaris] - else - WBUFB(buf,20+n*22)=vsd->status.cart[index].attribute; - WBUFB(buf,21+n*22)=vsd->status.cart[index].refine; - if(vsd->status.cart[index].card[0]==0x00ff || vsd->status.cart[index].card[0]==0x00fe || vsd->status.cart[index].card[0]==(short)0xff00) { - WBUFW(buf,22+n*22)=vsd->status.cart[index].card[0]; - WBUFW(buf,24+n*22)=vsd->status.cart[index].card[1]; - WBUFW(buf,26+n*22)=vsd->status.cart[index].card[2]; - WBUFW(buf,28+n*22)=vsd->status.cart[index].card[3]; - } else { - if(vsd->status.cart[index].card[0] > 0 && (j=itemdb_viewid(vsd->status.cart[index].card[0])) > 0) - WBUFW(buf,22+n*22)= j; - else - WBUFW(buf,22+n*22)= vsd->status.cart[index].card[0]; - if(vsd->status.cart[index].card[1] > 0 && (j=itemdb_viewid(vsd->status.cart[index].card[1])) > 0) - WBUFW(buf,24+n*22)= j; - else - WBUFW(buf,24+n*22)= vsd->status.cart[index].card[1]; - if(vsd->status.cart[index].card[2] > 0 && (j=itemdb_viewid(vsd->status.cart[index].card[2])) > 0) - WBUFW(buf,26+n*22)= j; - else - WBUFW(buf,26+n*22)= vsd->status.cart[index].card[2]; - if(vsd->status.cart[index].card[3] > 0 && (j=itemdb_viewid(vsd->status.cart[index].card[3])) > 0) - WBUFW(buf,28+n*22)= j; - else - WBUFW(buf,28+n*22)= vsd->status.cart[index].card[3]; - } - n++; - } - if(n > 0){ - WBUFW(buf,2)=8+n*22; - WFIFOSET(fd,WFIFOW(fd,2)); - } - - return 0; -} - -/*========================================== - * 露店アイテム購入失敗 - *------------------------------------------ -*/ -int clif_buyvending(struct map_session_data *sd,int index,int amount,int fail) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x135; - WFIFOW(fd,2)=index+2; - WFIFOW(fd,4)=amount; - WFIFOB(fd,6)=fail; - WFIFOSET(fd,packet_len_table[0x135]); - - return 0; -} - -/*========================================== - * 露店開設成功 - *------------------------------------------ -*/ -int clif_openvending(struct map_session_data *sd,int id,struct vending *vending) -{ - struct item_data *data; - int i,j,n,index,fd; - unsigned char *buf; - - nullpo_retr(0, sd); - - fd=sd->fd; - buf = WFIFOP(fd,0); - - WBUFW(buf,0)=0x136; - WBUFL(buf,4)=id; - for(i=0,n=0;ivend_num;i++){ - if (sd->vend_num > 2+pc_checkskill(sd,MC_VENDING)) return 0; - WBUFL(buf,8+n*22)=vending[i].value; - WBUFW(buf,12+n*22)=(index=vending[i].index)+2; - WBUFW(buf,14+n*22)=vending[i].amount; - if(sd->status.cart[index].nameid <= 0 || sd->status.cart[index].amount <= 0 || sd->status.cart[index].identify==0 || - sd->status.cart[index].broken==1) // Prevent unidentified and broken items from being sold [Valaris] - continue; - data = itemdb_search(sd->status.cart[index].nameid); - WBUFB(buf,16+n*22)=data->type; - if(data->view_id > 0) - WBUFW(buf,17+n*22)=data->view_id; - else - WBUFW(buf,17+n*22)=sd->status.cart[index].nameid; - WBUFB(buf,19+n*22)=sd->status.cart[index].identify; - if(sd->status.cart[index].broken==1) - WBUFB(buf,20+n*22)=1; // is weapon broken [Valaris] - else - WBUFB(buf,20+n*22)=sd->status.cart[index].attribute; - WBUFB(buf,21+n*22)=sd->status.cart[index].refine; - if(sd->status.cart[index].card[0]==0x00ff || sd->status.cart[index].card[0]==0x00fe || sd->status.cart[index].card[0]==(short)0xff00) { - WBUFW(buf,22+n*22)=sd->status.cart[index].card[0]; - WBUFW(buf,24+n*22)=sd->status.cart[index].card[1]; - WBUFW(buf,26+n*22)=sd->status.cart[index].card[2]; - WBUFW(buf,28+n*22)=sd->status.cart[index].card[3]; - } else { - if(sd->status.cart[index].card[0] > 0 && (j=itemdb_viewid(sd->status.cart[index].card[0])) > 0) - WBUFW(buf,22+n*22)= j; - else - WBUFW(buf,22+n*22)= sd->status.cart[index].card[0]; - if(sd->status.cart[index].card[1] > 0 && (j=itemdb_viewid(sd->status.cart[index].card[1])) > 0) - WBUFW(buf,24+n*22)= j; - else - WBUFW(buf,24+n*22)= sd->status.cart[index].card[1]; - if(sd->status.cart[index].card[2] > 0 && (j=itemdb_viewid(sd->status.cart[index].card[2])) > 0) - WBUFW(buf,26+n*22)= j; - else - WBUFW(buf,26+n*22)= sd->status.cart[index].card[2]; - if(sd->status.cart[index].card[3] > 0 && (j=itemdb_viewid(sd->status.cart[index].card[3])) > 0) - WBUFW(buf,28+n*22)= j; - else - WBUFW(buf,28+n*22)= sd->status.cart[index].card[3]; - } - n++; - } - if(n > 0){ - WBUFW(buf,2)=8+n*22; - WFIFOSET(fd,WFIFOW(fd,2)); - } - - return n; -} - -/*========================================== - * 露店アイテム販売報告 - *------------------------------------------ -*/ -int clif_vendingreport(struct map_session_data *sd,int index,int amount) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x137; - WFIFOW(fd,2)=index+2; - WFIFOW(fd,4)=amount; - WFIFOSET(fd,packet_len_table[0x137]); - - return 0; -} - /*========================================== * パーティ作成完了 *------------------------------------------ @@ -5512,184 +5041,6 @@ int clif_produceeffect(struct map_session_data *sd,int flag,int nameid) return 0; } -// pet -int clif_catch_process(struct map_session_data *sd) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x19e; - WFIFOSET(fd,packet_len_table[0x19e]); - - return 0; -} - -int clif_pet_rulet(struct map_session_data *sd,int data) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x1a0; - WFIFOB(fd,2)=data; - WFIFOSET(fd,packet_len_table[0x1a0]); - - return 0; -} - -/*========================================== - * pet卵リスト作成 - *------------------------------------------ - */ -int clif_sendegg(struct map_session_data *sd) -{ - //R 01a6 .w .w* - int i,n=0,fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x1a6; - if(sd->status.pet_id <= 0) { - for(i=0,n=0;istatus.inventory[i].nameid<=0 || sd->inventory_data[i] == NULL || - sd->inventory_data[i]->type!=7 || - sd->status.inventory[i].amount<=0) - continue; - WFIFOW(fd,n*2+4)=i+2; - n++; - } - } - WFIFOW(fd,2)=4+n*2; - WFIFOSET(fd,WFIFOW(fd,2)); - - return 0; -} - -int clif_send_petdata(struct map_session_data *sd,int type,int param) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x1a4; - WFIFOB(fd,2)=type; - WFIFOL(fd,3)=sd->pd->bl.id; - WFIFOL(fd,7)=param; - WFIFOSET(fd,packet_len_table[0x1a4]); - - return 0; -} - -int clif_send_petstatus(struct map_session_data *sd) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x1a2; - memcpy(WFIFOP(fd,2),sd->pet.name,24); - WFIFOB(fd,26)=(battle_config.pet_rename == 1)? 0:sd->pet.rename_flag; - WFIFOW(fd,27)=sd->pet.level; - WFIFOW(fd,29)=sd->pet.hungry; - WFIFOW(fd,31)=sd->pet.intimate; - WFIFOW(fd,33)=sd->pet.equip; - WFIFOSET(fd,packet_len_table[0x1a2]); - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int clif_pet_emotion(struct pet_data *pd,int param) -{ - unsigned char buf[16]; - struct map_session_data *sd; - - nullpo_retr(0, pd); - nullpo_retr(0, sd = pd->msd); - - memset(buf,0,packet_len_table[0x1aa]); - - WBUFW(buf,0)=0x1aa; - WBUFL(buf,2)=pd->bl.id; - if(param >= 100 && sd->petDB->talk_convert_class) { - if(sd->petDB->talk_convert_class < 0) - return 0; - else if(sd->petDB->talk_convert_class > 0) { - param -= (pd->class - 100)*100; - param += (sd->petDB->talk_convert_class - 100)*100; - } - } - WBUFL(buf,6)=param; - - clif_send(buf,packet_len_table[0x1aa],&pd->bl,AREA); - - return 0; -} - -int clif_pet_performance(struct block_list *bl,int param) -{ - unsigned char buf[16]; - - nullpo_retr(0, bl); - - memset(buf,0,packet_len_table[0x1a4]); - - WBUFW(buf,0)=0x1a4; - WBUFB(buf,2)=4; - WBUFL(buf,3)=bl->id; - WBUFL(buf,7)=param; - - clif_send(buf,packet_len_table[0x1a4],bl,AREA); - - return 0; -} - -int clif_pet_equip(struct pet_data *pd,int nameid) -{ - unsigned char buf[16]; - int view; - - nullpo_retr(0, pd); - - memset(buf,0,packet_len_table[0x1a4]); - - WBUFW(buf,0)=0x1a4; - WBUFB(buf,2)=3; - WBUFL(buf,3)=pd->bl.id; - if((view = itemdb_viewid(nameid)) > 0) - WBUFL(buf,7)=view; - else - WBUFL(buf,7)=nameid; - - clif_send(buf,packet_len_table[0x1a4],&pd->bl,AREA); - - return 0; -} - -int clif_pet_food(struct map_session_data *sd,int foodid,int fail) -{ - int fd; - - nullpo_retr(0, sd); - - fd=sd->fd; - WFIFOW(fd,0)=0x1a3; - WFIFOB(fd,2)=fail; - WFIFOW(fd,3)=foodid; - WFIFOSET(fd,packet_len_table[0x1a3]); - - return 0; -} - /*========================================== * オートスペル リスト送信 *------------------------------------------ @@ -6877,21 +6228,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_set0199(sd->fd,3); } - // pet - if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) { - map_addblock(&sd->pd->bl); - clif_spawnpet(sd->pd); - clif_send_petdata(sd,0,0); - clif_send_petdata(sd,5,0x14); - clif_send_petstatus(sd); - } - if(sd->state.connect_new) { sd->state.connect_new = 0; if(sd->status.class != sd->view_class) clif_changelook(&sd->bl,LOOK_BASE,sd->view_class); - if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 900) - clif_pet_emotion(sd->pd,(sd->pd->class - 100)*100 + 50 + pet_hungry_val(sd)); /* Stop players from spawning inside castles [Valaris] */ @@ -6967,7 +6307,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { return; } - if (sd->npc_id != 0 || sd->vender_id != 0) + if (sd->npc_id != 0) return; if (sd->skilltimer != -1 && pc_checkskill(sd, SA_FREECAST) <= 0) // フリーキャスト @@ -7086,10 +6426,6 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { WFIFOSET(fd,packet_len_table[0x95]); } break; - case BL_PET: - memcpy(WFIFOP(fd,6), ((struct pet_data*)bl)->name, 24); - WFIFOSET(fd,packet_len_table[0x95]); - break; case BL_NPC: memcpy(WFIFOP(fd,6), ((struct npc_data*)bl)->name, 24); { @@ -7310,7 +6646,7 @@ void clif_parse_MapMove(int fd, struct map_session_data *sd) { (pc_isGM(sd) >= get_atcommand_level(AtCommand_MapMove))) { memcpy(map_name, RFIFOP(fd,2), 16); sprintf(output, "%s %d %d", map_name, RFIFOW(fd,18), RFIFOW(fd,20)); - atcommand_rura(fd, sd, "@rura", output); + atcommand_warp(fd, sd, "@rura", output); } return; @@ -7405,8 +6741,6 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) { case 0x07: // continuous attack if(sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class==22) return; - if (sd->vender_id != 0) - return; if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) { if (DIFF_TICK(tick, sd->canact_tick) < 0) { clif_skill_fail(sd, 1, 4, 0); @@ -7573,7 +6907,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) { return; } - if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 || + if( sd->npc_id!=0 || sd->opt1 > 0 || (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク @@ -7606,7 +6940,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) { clif_clearchar_area(&sd->bl, 1); return; } - if (sd->npc_id != 0 || sd->vender_id != 0 || sd->opt1 > 0 || + if (sd->npc_id != 0 || sd->opt1 > 0 || (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り sd->sc_data[SC_BERSERK].timer != -1)) ) //バーサーク @@ -7629,7 +6963,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) { clif_clearchar_area(&sd->bl, 1); return; } - if (sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 || + if (sd->npc_id!=0 || sd->opt1 > 0 || (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク @@ -7657,7 +6991,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) return; } index = RFIFOW(fd,2)-2; - if(sd->npc_id!=0 || sd->vender_id != 0) return; + if(sd->npc_id!=0) return; if(sd->sc_data && ( sd->sc_data[SC_BLADESTOP].timer!=-1 || sd->sc_data[SC_BERSERK].timer!=-1 )) return; if(sd->status.inventory[index].identify != 1) { // 未鑑定 @@ -7669,12 +7003,9 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) } //ペット用装備であるかないか if(sd->inventory_data[index]) { - if(sd->inventory_data[index]->type != 8){ - if(sd->inventory_data[index]->type == 10) - RFIFOW(fd,4)=0x8000; // 矢を無理やり装備できるように(−−; - pc_equipitem(sd,index,RFIFOW(fd,4)); - } else - pet_equipitem(sd,index); + if(sd->inventory_data[index]->type == 10) + RFIFOW(fd,4)=0x8000; // 矢を無理やり装備できるように(−−; + pc_equipitem(sd,index,RFIFOW(fd,4)); } } @@ -7700,7 +7031,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd) if(sd->sc_data && ( sd->sc_data[SC_BLADESTOP].timer!=-1 || sd->sc_data[SC_BERSERK].timer!=-1 )) return; - if(sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0) + if(sd->npc_id!=0 || sd->opt1 > 0) return; pc_unequipitem(sd,index,0); } @@ -7717,7 +7048,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) clif_clearchar_area(&sd->bl,1); return; } - if(sd->npc_id!=0 || sd->vender_id != 0) + if(sd->npc_id!=0) return; npc_click(sd,RFIFOL(fd,2)); } @@ -7906,7 +7237,7 @@ void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { nullpo_retv(sd); - if(sd->npc_id!=0 || sd->vender_id != 0) + if(sd->npc_id!=0) return; pc_putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); } @@ -7918,7 +7249,7 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) { nullpo_retv(sd); - if(sd->npc_id!=0 || sd->vender_id != 0) return; + if(sd->npc_id!=0) return; pc_getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); } @@ -7983,7 +7314,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { nullpo_retv(sd); if(map[sd->bl.m].flag.noskill) return; - if (sd->chatID || sd->npc_id != 0 || sd->vender_id != 0) + if (sd->chatID || sd->npc_id != 0) return; skilllv = RFIFOW(fd,2); @@ -8044,7 +7375,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) { nullpo_retv(sd); if(map[sd->bl.m].flag.noskill) return; - if (sd->npc_id != 0 || sd->vender_id != 0) return; + if (sd->npc_id != 0) return; if(sd->chatID) return; skillmoreinfo = -1; @@ -8101,7 +7432,7 @@ void clif_parse_UseSkillMap(int fd,struct map_session_data *sd) if(map[sd->bl.m].flag.noskill) return; if(sd->chatID) return; - if(sd->npc_id!=0 || sd->vender_id != 0 || (sd->sc_data && + if(sd->npc_id!=0 || (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || sd->sc_data[SC_BERSERK].timer!=-1 || sd->sc_data[SC_NOCHAT].timer!=-1 || @@ -8285,7 +7616,7 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) { item_index = RFIFOW(fd,2) - 2; item_amount = RFIFOL(fd,4); - if (sd->npc_id != 0 || sd->vender_id != 0) + if (sd->npc_id != 0) return; if (sd->state.storage_flag) @@ -8306,7 +7637,7 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) { item_index = RFIFOW(fd,2) - 1; item_amount = RFIFOL(fd,4); - if (sd->npc_id != 0 || sd->vender_id != 0) + if (sd->npc_id != 0) return; if (sd->state.storage_flag) @@ -8322,7 +7653,7 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) { void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) { nullpo_retv(sd); - if (sd->npc_id != 0 || sd->vender_id != 0) + if (sd->npc_id != 0) return; if (sd->state.storage_flag) storage_guild_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); @@ -8337,7 +7668,7 @@ void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) { void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) { nullpo_retv(sd); - if (sd->npc_id != 0 || sd->vender_id != 0) + if (sd->npc_id != 0) return; if (sd->state.storage_flag) storage_guild_storagegettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); @@ -8442,42 +7773,6 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd) { party_send_message(sd, RFIFOP(fd,4), RFIFOW(fd,2)-4); } -/*========================================== - * 露店閉鎖 - *------------------------------------------ - */ -void clif_parse_CloseVending(int fd, struct map_session_data *sd) { - vending_closevending(sd); -} - -/*========================================== - * 露店アイテムリスト要求 - *------------------------------------------ - */ -void clif_parse_VendingListReq(int fd, struct map_session_data *sd) { - nullpo_retv(sd); - - vending_vendinglistreq(sd,RFIFOL(fd,2)); - if(sd->npc_id) - npc_event_dequeue(sd); -} - -/*========================================== - * 露店アイテム購入 - *------------------------------------------ - */ -void clif_parse_PurchaseReq(int fd, struct map_session_data *sd) { - vending_purchasereq(sd, RFIFOW(fd,2), RFIFOL(fd,4), RFIFOP(fd,8)); -} - -/*========================================== - * 露店開設 - *------------------------------------------ - */ -void clif_parse_OpenVending(int fd,struct map_session_data *sd) { - vending_openvending(sd, RFIFOW(fd,2), RFIFOP(fd,4), RFIFOB(fd,84), RFIFOP(fd,85)); -} - /*========================================== * /monster /item rewriten by [Yor] *------------------------------------------ @@ -8692,30 +7987,6 @@ void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { guild_break(sd,RFIFOP(fd,2)); } -// pet -void clif_parse_PetMenu(int fd, struct map_session_data *sd) { - pet_menu(sd,RFIFOB(fd,2)); -} - -void clif_parse_CatchPet(int fd, struct map_session_data *sd) { - pet_catch_process2(sd,RFIFOL(fd,2)); -} - -void clif_parse_SelectEgg(int fd, struct map_session_data *sd) { - pet_select_egg(sd,RFIFOW(fd,2)-2); -} - -void clif_parse_SendEmotion(int fd, struct map_session_data *sd) { - nullpo_retv(sd); - - if(sd->pd) - clif_pet_emotion(sd->pd,RFIFOL(fd,2)); -} - -void clif_parse_ChangePetName(int fd, struct map_session_data *sd) { - pet_change_name(sd,RFIFOP(fd,2)); -} - // Kick (right click menu for GM "(name) force to quit") void clif_parse_GMKick(int fd, struct map_session_data *sd) { struct block_list *target; @@ -9081,9 +8352,9 @@ static void (*clif_parse_func_table[0x220])() = { clif_parse_StopAttack, NULL, NULL, clif_parse_UseSkillMap, NULL, clif_parse_RequestMemo, NULL, NULL, // 120 NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_PutItemToCart, clif_parse_GetItemFromCart, - clif_parse_MoveFromKafraToCart, clif_parse_MoveToKafraFromCart, clif_parse_RemoveOption, NULL, NULL, NULL, clif_parse_CloseVending, NULL, + clif_parse_MoveFromKafraToCart, clif_parse_MoveToKafraFromCart, clif_parse_RemoveOption, NULL, NULL, NULL, NULL, NULL, // 130 - clif_parse_VendingListReq, NULL, NULL, NULL, clif_parse_PurchaseReq, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_GM_Monster_Item, // 140 @@ -9104,12 +8375,12 @@ static void (*clif_parse_func_table[0x220])() = { NULL, NULL, clif_parse_QuitGame, NULL, NULL, NULL, NULL, NULL, // 190 clif_parse_UseSkillToPos, NULL, NULL, clif_parse_SolveCharName, NULL, NULL, NULL, clif_parse_ResetChar, - NULL, NULL, NULL, NULL, clif_parse_LGMmessage, clif_parse_GMHide, NULL, clif_parse_CatchPet, + NULL, NULL, NULL, NULL, clif_parse_LGMmessage, clif_parse_GMHide, NULL, NULL, // 1a0 - NULL, clif_parse_PetMenu, NULL, NULL, NULL, clif_parse_ChangePetName, NULL, clif_parse_SelectEgg, - NULL, clif_parse_SendEmotion, NULL, NULL, NULL, NULL, NULL, clif_parse_ChangeCart, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_ChangeCart, // 1b0 - NULL, NULL, clif_parse_OpenVending, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, clif_parse_Shift, clif_parse_Shift, clif_parse_Recall, clif_parse_Recall, NULL, NULL, // 1c0 diff --git a/src/map/clif.h b/src/map/clif.h index 4fed687..078d1a6 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -36,17 +36,14 @@ int clif_spawnpc(struct map_session_data*); //area int clif_spawnnpc(struct npc_data*); // area int clif_spawn_fake_npc_for_player(struct map_session_data *sd, int fake_npc_id); int clif_spawnmob(struct mob_data*); // area -int clif_spawnpet(struct pet_data*); // area int clif_walkok(struct map_session_data*); // self int clif_movechar(struct map_session_data*); // area int clif_movemob(struct mob_data*); //area -int clif_movepet(struct pet_data *pd); //area int clif_changemap(struct map_session_data*,char*,int,int); //self int clif_changemapserver(struct map_session_data*,char*,int,int,int,int); //self int clif_fixpos(struct block_list *); // area int clif_fixmobpos(struct mob_data *md); int clif_fixpcpos(struct map_session_data *sd); -int clif_fixpetpos(struct pet_data *pd); int clif_npcbuysell(struct map_session_data*,int); //self int clif_buylist(struct map_session_data*,struct npc_data*); //self int clif_selllist(struct map_session_data*); //self @@ -121,8 +118,6 @@ int clif_pcinsight(struct block_list *,va_list); // map_forallinmovearea callbac int clif_pcoutsight(struct block_list *,va_list); // map_forallinmovearea callback int clif_mobinsight(struct block_list *,va_list); // map_forallinmovearea callback int clif_moboutsight(struct block_list *,va_list); // map_forallinmovearea callback -int clif_petoutsight(struct block_list *bl,va_list ap); -int clif_petinsight(struct block_list *bl,va_list ap); int clif_class_change(struct block_list *bl,int class,int type); int clif_mob_class_change(struct mob_data *md,int class); @@ -194,15 +189,6 @@ int clif_mvp_effect(struct map_session_data *sd); int clif_mvp_item(struct map_session_data *sd,int nameid); int clif_mvp_exp(struct map_session_data *sd,int exp); -// vending -int clif_openvendingreq(struct map_session_data *sd,int num); -int clif_showvendingboard(struct block_list* bl,char *message,int fd); -int clif_closevendingboard(struct block_list* bl,int fd); -int clif_vendinglist(struct map_session_data *sd,int id,struct vending *vending); -int clif_buyvending(struct map_session_data *sd,int index,int amount,int fail); -int clif_openvending(struct map_session_data *sd,int id,struct vending *vending); -int clif_vendingreport(struct map_session_data *sd,int index,int amount); - int clif_movetoattack(struct map_session_data *sd,struct block_list *bl); // party @@ -254,17 +240,6 @@ int clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum,int type); int clif_send0199(int map,int type); int clif_refine(int fd,struct map_session_data *sd,int fail,int index,int val); -//petsystem -int clif_catch_process(struct map_session_data *sd); -int clif_pet_rulet(struct map_session_data *sd,int data); -int clif_sendegg(struct map_session_data *sd); -int clif_send_petdata(struct map_session_data *sd,int type,int param); -int clif_send_petstatus(struct map_session_data *sd); -int clif_pet_emotion(struct pet_data *pd,int param); -int clif_pet_performance(struct block_list *bl,int param); -int clif_pet_equip(struct pet_data *pd,int nameid); -int clif_pet_food(struct map_session_data *sd,int foodid,int fail); - int clif_specialeffect(struct block_list *bl,int type, int flag); // special effects [Valaris] int clif_message(struct block_list *bl, char* msg); // messages (from mobs/npcs) [Valaris] diff --git a/src/map/intif.c b/src/map/intif.c index a973121..ae8e906 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -18,19 +18,19 @@ #include #include +#include "nullpo.h" #include "socket.h" #include "timer.h" -#include "map.h" + #include "battle.h" #include "chrif.h" #include "clif.h" -#include "pc.h" +#include "guild.h" #include "intif.h" -#include "storage.h" +#include "map.h" #include "party.h" -#include "guild.h" -#include "pet.h" -#include "nullpo.h" +#include "pc.h" +#include "storage.h" #ifdef MEMWATCH #include "memwatch.h" @@ -54,59 +54,7 @@ extern int char_fd; // inter server //----------------------------------------------------------------- // inter serverへの送信 -// pet -int intif_create_pet(int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id, - short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name) -{ - WFIFOW(inter_fd,0) = 0x3080; - WFIFOL(inter_fd,2) = account_id; - WFIFOL(inter_fd,6) = char_id; - WFIFOW(inter_fd,10) = pet_class; - WFIFOW(inter_fd,12) = pet_lv; - WFIFOW(inter_fd,14) = pet_egg_id; - WFIFOW(inter_fd,16) = pet_equip; - WFIFOW(inter_fd,18) = intimate; - WFIFOW(inter_fd,20) = hungry; - WFIFOB(inter_fd,22) = rename_flag; - WFIFOB(inter_fd,23) = incuvate; - memcpy(WFIFOP(inter_fd,24),pet_name,24); - WFIFOSET(inter_fd,48); - - return 0; -} - -int intif_request_petdata(int account_id,int char_id,int pet_id) -{ - WFIFOW(inter_fd,0) = 0x3081; - WFIFOL(inter_fd,2) = account_id; - WFIFOL(inter_fd,6) = char_id; - WFIFOL(inter_fd,10) = pet_id; - WFIFOSET(inter_fd,14); - - return 0; -} - -int intif_save_petdata(int account_id,struct s_pet *p) -{ - WFIFOW(inter_fd,0) = 0x3082; - WFIFOW(inter_fd,2) = sizeof(struct s_pet) + 8; - WFIFOL(inter_fd,4) = account_id; - memcpy(WFIFOP(inter_fd,8),p,sizeof(struct s_pet)); - WFIFOSET(inter_fd,WFIFOW(inter_fd,2)); - - return 0; -} - -int intif_delete_petdata(int pet_id) -{ - WFIFOW(inter_fd,0) = 0x3083; - WFIFOL(inter_fd,2) = pet_id; - WFIFOSET(inter_fd,6); - - return 0; -} - -// GMメッセージを送信 +// Message for all GMs on all map servers int intif_GMmessage(char* mes,int len,int flag) { int lp = (flag&0x10) ? 8 : 4; @@ -929,48 +877,6 @@ int intif_parse_GuildCastleAllDataLoad(int fd) return guild_castlealldataload(RFIFOW(fd,2),(struct guild_castle *)RFIFOP(fd,4)); } -// pet -int intif_parse_CreatePet(int fd) -{ - pet_get_egg(RFIFOL(fd,2),RFIFOL(fd,7),RFIFOB(fd,6)); - - return 0; -} - -int intif_parse_RecvPetData(int fd) -{ - struct s_pet p; - int len=RFIFOW(fd,2); - if(sizeof(struct s_pet)!=len-9) { - if(battle_config.etc_log) - printf("intif: pet data: data size error %d %d\n",sizeof(struct s_pet),len-9); - } - else{ - memcpy(&p,RFIFOP(fd,9),sizeof(struct s_pet)); - pet_recv_petdata(RFIFOL(fd,4),&p,RFIFOB(fd,8)); - } - - return 0; -} -int intif_parse_SavePetOk(int fd) -{ - if(RFIFOB(fd,6) == 1) { - if(battle_config.error_log) - printf("pet data save failure\n"); - } - - return 0; -} - -int intif_parse_DeletePetOk(int fd) -{ - if(RFIFOB(fd,2) == 1) { - if(battle_config.error_log) - printf("pet data delete failure\n"); - } - - return 0; -} //----------------------------------------------------------------- // inter serverからの通信 // エラーがあれば0(false)を返すこと @@ -1032,10 +938,10 @@ int intif_parse(int fd) case 0x3840: intif_parse_GuildCastleDataLoad(fd); break; case 0x3841: intif_parse_GuildCastleDataSave(fd); break; case 0x3842: intif_parse_GuildCastleAllDataLoad(fd); break; - case 0x3880: intif_parse_CreatePet(fd); break; - case 0x3881: intif_parse_RecvPetData(fd); break; - case 0x3882: intif_parse_SavePetOk(fd); break; - case 0x3883: intif_parse_DeletePetOk(fd); break; + //case 0x3880: intif_parse_CreateP.et(fd); break; + //case 0x3881: intif_parse_RecvP.etData(fd); break; + //case 0x3882: intif_parse_SaveP.etOk(fd); break; + //case 0x3883: intif_parse_DeleteP.etOk(fd); break; default: if(battle_config.error_log) printf("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0)); diff --git a/src/map/intif.h b/src/map/intif.h index 85e1914..6f8a342 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -47,10 +47,4 @@ int intif_guild_emblem(int guild_id, int len, const char *data); int intif_guild_castle_dataload(int castle_id, int index); int intif_guild_castle_datasave(int castle_id, int index, int value); -int intif_create_pet(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name); -int intif_request_petdata(int account_id, int char_id, int pet_id); -int intif_save_petdata(int account_id, struct s_pet *p); -int intif_delete_petdata(int pet_id); - #endif diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 6105279..7b3f157 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -175,10 +175,6 @@ struct item_data* itemdb_search(int nameid) id->type=5; //armor else if(nameid>4000 && nameid<5000) id->type=6; //card - else if(nameid>9000 && nameid<10000) - id->type=7; //egg - else if(nameid>10000) - id->type=8; //petequip return id; } diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c index 31abe13..1f7f408 100644 --- a/src/map/magic-expr.c +++ b/src/map/magic-expr.c @@ -89,8 +89,6 @@ show_entity(entity_t *entity) return ((struct item_data *)(&((struct flooritem_data *)entity)->item_data))->name; case BL_SKILL: return "%skill"; - case BL_PET: - return ((struct pet_data *)entity)->name; case BL_SPELL: return "%invocation(ERROR:this-should-not-be-an-entity)"; default: diff --git a/src/map/magic-interpreter.h b/src/map/magic-interpreter.h index bef759a..515b120 100644 --- a/src/map/magic-interpreter.h +++ b/src/map/magic-interpreter.h @@ -8,27 +8,25 @@ #include #include -#include "magic.h" #include "malloc.h" -#include "map.h" +#include "nullpo.h" + +#include "battle.h" +#include "chat.h" #include "chrif.h" #include "clif.h" #include "intif.h" -#include "pc.h" -#include "npc.h" -#include "mob.h" -#include "pet.h" #include "itemdb.h" +#include "magic.h" +#include "map.h" +#include "mob.h" +#include "npc.h" +#include "pc.h" +#include "party.h" #include "script.h" -#include "battle.h" #include "skill.h" -#include "party.h" -#include "guild.h" -#include "chat.h" -#include "trade.h" #include "storage.h" -#include "vending.h" -#include "nullpo.h" +#include "trade.h" #include "../common/timer.h" diff --git a/src/map/mail.c b/src/map/mail.c deleted file mode 100644 index e50b1ba..0000000 --- a/src/map/mail.c +++ /dev/null @@ -1,324 +0,0 @@ -// Mail System for eAthena SQL -// Created by Valaris - -#include -#include -#include - -#include "socket.h" -#include "timer.h" -#include "nullpo.h" - -#include "map.h" -#include "clif.h" -#include "chrif.h" -#include "intif.h" -#include "pc.h" -#include "mail.h" - -char mail_db[32] = "mail"; - -int MAIL_CHECK_TIME = 120000; -int mail_timer; - -#ifdef MEMWATCH -#include "memwatch.h" -#endif - -int mail_check(struct map_session_data *sd,int type) -{ - int i=0,new=0,priority=0; - char message[50]; - - if(sd==NULL) - return 0; - - sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`from_char_name`,`read_flag`,`priority`,`check_flag` FROM `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id`", mail_db, sd->status.account_id); - - if (mysql_query(&mail_handle, tmp_msql)) { - printf("Database server error (executing query for %s): %s\n", mail_db, mysql_error(&mail_handle)); - return 0; - } - - mail_res = mysql_store_result(&mail_handle); - if(mail_res) { - if (mysql_num_rows(mail_res) == 0) { - clif_displaymessage(sd->fd,"You have no messages."); - mysql_free_result(mail_res); - return 0; - } - - while ((mail_row = mysql_fetch_row(mail_res))) { - i++; - - if(!atoi(mail_row[5])) { - sprintf(tmp_msql,"UPDATE `%s` SET `check_flag`='1' WHERE `message_id`= \"%d\"", mail_db, atoi(mail_row[0])); - if(mysql_query(&mail_handle, tmp_msql) ) { - printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) ); - } - } - - if(!atoi(mail_row[3])) { - new++; - if(atoi(mail_row[4])) - priority++; - if(type==2 || type==3) { - if(atoi(mail_row[4])) { - sprintf(message, "%d - From : %s (New - Priority)", i, mail_row[2]); - clif_displaymessage(sd->fd, message); - } - - else { - sprintf(message, "%d - From : %s (New)", i, mail_row[2]); - clif_displaymessage(sd->fd, message); - } - } - } - - else if(type==2){ - sprintf(message, "%d - From : %s", i, mail_row[2]); - clif_displaymessage(sd->fd, message); - } - - } - - mysql_free_result(mail_res); - - } else { - printf("MySQL error (storing query result for %s): %s\n", mail_db, mysql_error(&mail_handle)); - return 0; - } - - if(i>0 && new>0 && type==1) { - sprintf(message, "You have %d new messages.", new); - clif_displaymessage(sd->fd, message); - } - if(i>0 && new>0 && priority>0 && type==1) { - sprintf(message, "You have %d unread priority messages.", priority); - clif_displaymessage(sd->fd, message); - } - if(!new) { - clif_displaymessage(sd->fd, "You have no new messages."); - } - - return 0; -} - -int mail_read(struct map_session_data *sd, int message_id) -{ - - char message[80]; - - if(sd==NULL) - return 0; - - sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`from_char_name`,`message`,`read_flag`,`priority`,`check_flag` from `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id` LIMIT %d, 1",mail_db,sd->status.account_id,message_id-1); - - if (mysql_query(&mail_handle, tmp_msql)) { - printf("Database server error (executing query for %s): %s\n", mail_db, mysql_error(&mail_handle)); - return 0; - } - - mail_res = mysql_store_result(&mail_handle); - if(mail_res) { - if (mysql_num_rows(mail_res) == 0) { - mysql_free_result(mail_res); - clif_displaymessage(sd->fd, "Message not found."); - return 0; - } - - if ((mail_row = mysql_fetch_row(mail_res))) { - - if(!atoi(mail_row[6])) { - sprintf(tmp_msql,"UPDATE `%s` SET `check_flag`='1' WHERE `message_id`= \"%d\"", mail_db, atoi(mail_row[0])); - if(mysql_query(&mail_handle, tmp_msql) ) { - printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) ); - } - } - - sprintf(message, "Reading message from %s", mail_row[2]); - clif_displaymessage(sd->fd, message); - - sprintf(message, "%s", mail_row[3]); - clif_displaymessage(sd->fd, message); - - sprintf(tmp_msql,"UPDATE `%s` SET `read_flag`='1' WHERE `message_id`= \"%d\"", mail_db, atoi(mail_row[0])); - if(mysql_query(&mail_handle, tmp_msql) ) { - printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) ); - } - } - - mysql_free_result(mail_res); - - } else { - printf("MySQL error (storing query result for %s): %s\n", mail_db, mysql_error(&mail_handle)); - return 0; - } - - return 0; -} - -int mail_delete(struct map_session_data *sd, int message_id) -{ - if(sd==NULL) - return 0; - - sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`read_flag`,`priority`,`check_flag` from `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id` LIMIT %d, 1",mail_db,sd->status.account_id,message_id-1); - - if (mysql_query(&mail_handle, tmp_msql)) { - printf("Database server error (executing query for %s): %s\n", mail_db, mysql_error(&mail_handle)); - return 0; - } - - mail_res = mysql_store_result(&mail_handle); - if(mail_res) { - if (mysql_num_rows(mail_res) == 0) { - mysql_free_result(mail_res); - clif_displaymessage(sd->fd, "Message not found."); - return 0; - } - - if ((mail_row = mysql_fetch_row(mail_res))) { - if(!atoi(mail_row[2]) && atoi(mail_row[3])) { - mysql_free_result(mail_res); - clif_displaymessage(sd->fd,"Cannot delete unread priority mail."); - return 0; - } - if(!atoi(mail_row[4])) { - mysql_free_result(mail_res); - clif_displaymessage(sd->fd,"You have recieved new mail, use @listmail before deleting."); - return 0; - } - sprintf(tmp_msql,"DELETE FROM `%s` WHERE `message_id` = \"%d\"", mail_db, atoi(mail_row[0])); - if(mysql_query(&mail_handle, tmp_msql) ) { - mysql_free_result(mail_res); - printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) ); - return 0; - } - else clif_displaymessage(sd->fd,"Message deleted."); - } - - mysql_free_result(mail_res); - - } else { - printf("MySQL error (delete query result for %s): %s\n", mail_db, mysql_error(&mail_handle)); - return 0; - } - - return 0; -} - -int mail_send(struct map_session_data *sd, char *name, char *message, int flag) -{ - if(sd==NULL) - return 0; - - if(pc_isGM(sd) < 80 && sd->mail_counter > 0) { - clif_displaymessage(sd->fd,"You must wait 10 minutes before sending another message"); - return 0; - } - - if(strcmp(name,"*")==0) { - if(pc_isGM(sd) < 80) { - clif_displaymessage(sd->fd, "Access Denied."); - return 0; - } - else - sprintf(tmp_msql,"SELECT DISTINCT `account_id` FROM `%s` WHERE `account_id` <> '%d' ORDER BY `account_id`", char_db, sd->status.account_id); - } - else - sprintf(tmp_msql,"SELECT `account_id`,`name` FROM `%s` WHERE `name` = \"%s\"", char_db, name); - - if (mysql_query(&mail_handle, tmp_msql)) { - printf("Database server error (executing query for %s): %s\n", char_db, mysql_error(&mail_handle)); - return 0; - } - - mail_res = mysql_store_result(&mail_handle); - if(mail_res) { - if (mysql_num_rows(mail_res) == 0) { - mysql_free_result(mail_res); - clif_displaymessage(sd->fd,"Character does not exist."); - return 0; - } - - while ((mail_row = mysql_fetch_row(mail_res))) { - if(strcmp(name,"*")==0) { - sprintf(tmp_msql, "INSERT INTO `%s` (`to_account_id`,`from_account_id`,`from_char_name`,`message`,`priority`)" - " VALUES ('%d', '%d', '%s', '%s', '%d')",mail_db, atoi(mail_row[0]), sd->status.account_id, sd->status.name, message, flag); - } - else { - sprintf(tmp_msql, "INSERT INTO `%s` (`to_account_id`,`to_char_name`,`from_account_id`,`from_char_name`,`message`,`priority`)" - " VALUES ('%d', '%s', '%d', '%s', '%s', '%d')",mail_db, atoi(mail_row[0]), mail_row[1], sd->status.account_id, sd->status.name, message, flag); - if(pc_isGM(sd) < 80) - sd->mail_counter=5; - } - - if(mysql_query(&mail_handle, tmp_msql) ) { - mysql_free_result(mail_res); - printf("DB server Error (insert `mail_db`)- %s\n", mysql_error(&mail_handle) ); - return 0; - } - - } - } - - clif_displaymessage(sd->fd,"Mail has been sent."); - - return 0; -} - -int mail_check_timer(int tid,unsigned int tick,int id,int data) -{ - if(mail_timer != tid) - return 0; - - sprintf(tmp_msql,"SELECT DISTINCT `to_account_id` FROM `%s` WHERE `read_flag` = '0' AND `check_flag` = '0'", mail_db); - - if (mysql_query(&mail_handle, tmp_msql)) { - printf("Database server error (executing query for %s): %s\n", char_db, mysql_error(&mail_handle)); - mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0); - return 0; - } - - struct map_session_data *sd = NULL; - int i; - - mail_res = mysql_store_result(&mail_handle); - - if (mail_res) { - - if (mysql_num_rows(mail_res) == 0) { - mysql_free_result(mail_res); - mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0); - return 0; - } - - while ((mail_row = mysql_fetch_row(mail_res))) { - for (i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->state.auth){ - if(pc_isGM(sd) < 80 && sd->mail_counter > 0) - sd->mail_counter--; - if(sd->status.account_id==atoi(mail_row[0])) - clif_displaymessage(sd->fd, "You have new mail."); - } - } - } - } - - sprintf(tmp_msql,"UPDATE `%s` SET `check_flag`='1' WHERE `check_flag`= '0' ", mail_db); - if(mysql_query(&mail_handle, tmp_msql) ) { - printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) ); - } - - mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0); - return 0; -} - -int do_init_mail(void) -{ - add_timer_func_list(mail_check_timer,"mail_check_timer"); - mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0); - return 0; -} - diff --git a/src/map/mail.h b/src/map/mail.h deleted file mode 100644 index 6bd8e51..0000000 --- a/src/map/mail.h +++ /dev/null @@ -1,9 +0,0 @@ -// Mail System for eAthena -// Created by Valaris - -int mail_check(struct map_session_data *sd, int type); -int mail_read(struct map_session_data *sd, int message_id); -int mail_delete(struct map_session_data *sd, int message_id); -int mail_send(struct map_session_data *sd, char *name, char *message, int flag); - -int do_init_mail(void); diff --git a/src/map/map.c b/src/map/map.c index 6ca1bd4..a9120f0 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -31,7 +31,6 @@ #include "battle.h" #include "script.h" #include "guild.h" -#include "pet.h" #include "atcommand.h" #include "nullpo.h" #include "socket.h" @@ -724,8 +723,6 @@ int map_clearflooritem_timer(int tid,unsigned int tick,int id,int data) { } if(data) delete_timer(fitem->cleartimer,map_clearflooritem_timer); - else if(fitem->item_data.card[0] == (short)0xff00) - intif_delete_petdata(*((long *)(&fitem->item_data.card[1]))); clif_clearflooritem(fitem,0); map_delobject(fitem->bl.id); @@ -1059,19 +1056,6 @@ int map_quit(struct map_session_data *sd) { clif_clearchar_area(&sd->bl,2); - if(sd->status.pet_id && sd->pd) { - pet_lootitem_drop(sd->pd,sd); - pet_remove_map(sd); - if(sd->pet.intimate <= 0) { - intif_delete_petdata(sd->status.pet_id); - sd->status.pet_id = 0; - sd->pd = NULL; - sd->petDB = NULL; - } - else - intif_save_petdata(sd->status.account_id,&sd->pet); - } - if(pc_isdead(sd)) pc_setrestartvalue(sd,2); pc_makesavestatus(sd); @@ -2009,9 +1993,6 @@ static int cleanup_sub(struct block_list *bl, va_list ap) { case BL_MOB: mob_delete((struct mob_data *)bl); break; - case BL_PET: - pet_remove_map((struct map_session_data *)bl); - break; case BL_ITEM: map_clearflooritem(bl->id); break; @@ -2149,7 +2130,6 @@ int do_init(int argc, char *argv[]) { do_init_guild(); do_init_storage(); do_init_skill(); - do_init_pet(); do_init_magic(); #ifndef TXT_ONLY /* mail system [Valaris] */ diff --git a/src/map/map.h b/src/map/map.h index 7889485..fa2d583 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -58,7 +58,7 @@ #define CLIF_OPTION_SC_INVISIBILITY (CLIF_OPTION_SC_BASE) #define CLIF_OPTION_SC_SCRIBE (CLIF_OPTION_SC_BASE + 1) -enum { BL_NUL, BL_PC, BL_NPC, BL_MOB, BL_ITEM, BL_CHAT, BL_SKILL, BL_PET, BL_SPELL }; +enum { BL_NUL, BL_PC, BL_NPC, BL_MOB, BL_ITEM, BL_CHAT, BL_SKILL, BL_SPELL }; enum { WARP, SHOP, SCRIPT, MONS, MESSAGE }; struct block_list { struct block_list *next,*prev; @@ -85,11 +85,6 @@ struct status_change { int val1,val2,val3,val4; int spell_invocation; /* [Fate] If triggered by a spell, record here */ }; -struct vending { - short index; - short amount; - int value; -}; struct invocation; @@ -136,7 +131,6 @@ struct skill_timerskill { }; struct npc_data; -struct pet_db; struct item_data; struct square; @@ -340,16 +334,9 @@ struct map_session_data { int guildspy; // [Syrus22] int partyspy; // [Syrus22] - int vender_id; - int vend_num; char message[80]; - struct vending vending[12]; int catch_target_class; - struct s_pet pet; - struct pet_db *petDB; - struct pet_data *pd; - int pet_hungry_timer; int pvp_point,pvp_rank,pvp_timer,pvp_lastusers; @@ -502,38 +489,6 @@ struct mob_data { unsigned short stats[MOB_LAST]; // [Fate] mob-specific stats short size; }; -struct pet_data { - struct block_list bl; - short n; - short class,dir; - short speed; - char name[24]; - struct { - unsigned state : 8 ; - unsigned skillstate : 8 ; - unsigned change_walk_target : 1 ; - } state; - int timer; - short to_x,to_y; - short equip; - struct walkpath_data walkpath; - int target_id; - short target_lv; - int move_fail_count; - unsigned int attackabletime,next_walktime,last_thinktime; - int skilltype,skillval,skilltimer,skillduration; // [Valaris] - int skillbonustype,skillbonusval,skillbonustimer,skillbonusduration; // [Valaris] - struct item *lootitem; - short loot; // [Valaris] - short lootmax; // [Valaris] - short lootitem_count; - short lootitem_weight; - int lootitem_timer; - struct skill_timerskill skilltimerskill[MAX_MOBSKILLTIMERSKILL]; // [Valaris] - struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP]; // [Valaris] - struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; // [Valaris] - struct map_session_data *msd; -}; enum { MS_IDLE,MS_WALK,MS_ATTACK,MS_DEAD,MS_DELAY }; diff --git a/src/map/mob.c b/src/map/mob.c index 719cc78..8f83c94 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1914,8 +1914,6 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) return 0; } else { - if(md->lootitem[0].card[0] == (short)0xff00) - intif_delete_petdata(*((long *)(&md->lootitem[0].card[1]))); for(i=0;ilootitem[i],&md->lootitem[i+1],sizeof(md->lootitem[0])); memcpy(&md->lootitem[LOOTITEM_SIZE-1],&fitem->item_data,sizeof(md->lootitem[0])); @@ -2313,28 +2311,6 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(md->attacked_id <= 0 && md->state.special_mob_ai==0) md->attacked_id = sd->bl.id; } - if(src && src->type == BL_PET && battle_config.pet_attack_exp_to_master==1) { - struct pet_data *pd = (struct pet_data *)src; - nullpo_retr(0, pd); - for(i=0,minpos=0,mindmg=0x7fffffff;idmglog[i].id==pd->msd->bl.id) - break; - if(md->dmglog[i].id==0){ - minpos=i; - mindmg=0; - } - else if(md->dmglog[i].dmgdmglog[i].dmg; - } - } - if(idmglog[i].dmg+=(damage*battle_config.pet_attack_exp_rate)/100; - else { - md->dmglog[minpos].id=pd->msd->bl.id; - md->dmglog[minpos].dmg=(damage*battle_config.pet_attack_exp_rate)/100; - } - } if(src && src->type == BL_MOB && ((struct mob_data*)src)->state.special_mob_ai){ struct mob_data *md2 = (struct mob_data *)src; nullpo_retr(0, md2); @@ -2692,10 +2668,6 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) // SCRIPT実行 if(md->npc_event[0]){ -// if(battle_config.battle_log==1) -// printf("mob_damage : run event : %s\n",md->npc_event); - if(src && src->type == BL_PET) - sd = ((struct pet_data *)src)->msd; if(sd == NULL) { if(mvp_sd != NULL) sd = mvp_sd; @@ -3062,11 +3034,6 @@ static int mob_counttargeted_sub(struct block_list *bl,va_list ap) if(md && md->target_id == id && md->timer != -1 && md->state.state == MS_ATTACK && md->target_lv >= target_lv) (*c)++; } - else if(bl->type == BL_PET) { - struct pet_data *pd = (struct pet_data *)bl; - if(pd->target_id == id && pd->timer != -1 && pd->state.state == MS_ATTACK && pd->target_lv >= target_lv) - (*c)++; - } return 0; } /*========================================== @@ -3955,7 +3922,7 @@ static int mob_readdb(void) ratemin = battle_config.item_drop_use_min; ratemax = battle_config.item_drop_use_max; // End } - else if (type == 4 || type == 5 || type == 8) { // Changed to include Pet Equip + else if (type == 4 || type == 5 || type == 8) { rate = battle_config.item_rate_equip; ratemin = battle_config.item_drop_equip_min; ratemax = battle_config.item_drop_equip_max; @@ -4380,7 +4347,7 @@ static int mob_read_sqldb(void) ratemin = battle_config.item_drop_use_min; ratemax = battle_config.item_drop_use_max; // End } - else if (type == 4 || type == 5 || type == 8) { // Changed to include Pet Equip + else if (type == 4 || type == 5 || type == 8) { rate = battle_config.item_rate_equip; ratemin = battle_config.item_drop_equip_min; ratemax = battle_config.item_drop_equip_max; diff --git a/src/map/npc.c b/src/map/npc.c index d484483..2d23283 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -6,20 +6,20 @@ #include #include -#include "db.h" -#include "timer.h" -#include "nullpo.h" #include "malloc.h" -#include "map.h" -#include "npc.h" +#include "nullpo.h" +#include "timer.h" + +#include "battle.h" #include "clif.h" +#include "db.h" #include "intif.h" -#include "pc.h" #include "itemdb.h" -#include "script.h" +#include "map.h" #include "mob.h" -#include "pet.h" -#include "battle.h" +#include "npc.h" +#include "pc.h" +#include "script.h" #include "skill.h" #ifdef MEMWATCH @@ -1039,8 +1039,6 @@ int npc_selllist(struct map_session_data *sd,int n,unsigned short *item_list) if( sd->status.inventory[item_id].nameid>0 && sd->inventory_data[item_id] != NULL && sd->inventory_data[item_id]->type==7 && sd->status.inventory[item_id].amount>0 && sd->status.inventory[item_id].card[0] == (short)0xff00) - if(search_petDB_index(sd->status.inventory[item_id].nameid, PET_EGG) >= 0) - intif_delete_petdata((*(long *)(&sd->status.inventory[item_id].card[1]))); pc_delitem(sd,item_id,item_list[i*2+1],0); } @@ -1958,7 +1956,6 @@ int do_final_npc(void) struct block_list *bl; struct npc_data *nd; struct mob_data *md; - struct pet_data *pd; if(ev_db) strdb_final(ev_db,ev_db_final); @@ -1976,9 +1973,6 @@ int do_final_npc(void) } free(md); md = NULL; - }else if(bl->type == BL_PET && (pd = (struct pet_data *)bl)){ - free(pd); - pd = NULL; } } } diff --git a/src/map/pc.c b/src/map/pc.c index a4f0662..8fd1a72 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -10,26 +10,24 @@ #include "db.h" #include "malloc.h" -#include "map.h" +#include "nullpo.h" + +#include "atcommand.h" +#include "battle.h" +#include "chat.h" #include "chrif.h" #include "clif.h" #include "intif.h" -#include "pc.h" -#include "npc.h" -#include "mob.h" -#include "pet.h" #include "itemdb.h" +#include "map.h" +#include "mob.h" +#include "npc.h" +#include "party.h" +#include "pc.h" #include "script.h" -#include "battle.h" #include "skill.h" -#include "party.h" -#include "guild.h" -#include "chat.h" -#include "trade.h" #include "storage.h" -#include "vending.h" -#include "nullpo.h" -#include "atcommand.h" +#include "trade.h" #ifndef TXT_ONLY // mail system [Valaris] #include "mail.h" @@ -738,12 +736,6 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio pc_setinventorydata(sd); pc_checkitem(sd); - // pet - sd->petDB = NULL; - sd->pd = NULL; - sd->pet_hungry_timer = -1; - memset(&sd->pet, 0, sizeof(struct s_pet)); - // ステータス異常の初期化 for(i = 0; i < MAX_STATUSCHANGE; i++) { sd->sc_data[i].timer=-1; @@ -783,10 +775,6 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio // 位置の設定 pc_setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, 0); - // pet - if (sd->status.pet_id > 0) - intif_request_petdata(sd->status.account_id, sd->status.char_id, sd->status.pet_id); - // パーティ、ギルドデータの要求 if (sd->status.party_id > 0 && (p = party_search(sd->status.party_id)) == NULL) party_request_info(sd->status.party_id); @@ -1326,16 +1314,6 @@ int pc_calcstatus(struct map_session_data* sd,int first) wele = sd->atk_ele; wele_ = sd->atk_ele_; def_ele = sd->def_ele; - if(sd->status.pet_id > 0) { - struct pet_data *pd=sd->pd; - if((pd && battle_config.pet_status_support==1) && (battle_config.pet_equip_required==0 || (battle_config.pet_equip_required && pd->equip > 0))) { - if(sd->status.pet_id > 0 && sd->petDB && sd->pet.intimate > 0) - run_script(sd->petDB->script,0,sd->bl.id,0); - pele = sd->atk_ele; - pdef_ele = sd->def_ele; - sd->atk_ele = sd->def_ele = 0; - } - } memcpy(sd->paramcard,sd->parame,sizeof(sd->paramcard)); // 装備品によるステータス変化はここで実行 @@ -1416,12 +1394,6 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->atk_ele_ = wele_; if(def_ele > 0) sd->def_ele = def_ele; - if(battle_config.pet_status_support) { - if(pele > 0 && !sd->atk_ele) - sd->atk_ele = pele; - if(pdef_ele > 0 && !sd->def_ele) - sd->def_ele = pdef_ele; - } sd->double_rate += sd->double_add_rate; sd->perfect_hit += sd->perfect_hit_add; sd->get_zeny_num += sd->get_zeny_add_num; @@ -3004,7 +2976,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) if (sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount < amount || - sd->trade_partner != 0 || sd->vender_id != 0 || + sd->trade_partner != 0 || sd->status.inventory[n].amount <= 0) return 1; map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, NULL, NULL, NULL, 0); @@ -3261,7 +3233,7 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) { nullpo_retr(0, sd); nullpo_retr(0, item_data = &sd->status.inventory[idx]); - if (item_data->nameid==0 || item_data->amountvender_id) + if (item_data->nameid==0 || item_data->amountstatus.cart[idx]); - if( item_data->nameid==0 || item_data->amountvender_id ) + if( item_data->nameid==0 || item_data->amountsc_data[SC_DANCING].timer!=-1) // clear dance effect when warping [Valaris] skill_stop_dancing(&sd->bl,0); - if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) { - pet_stopattack(sd->pd); - pet_changestate(sd->pd,MS_IDLE,0); - } - if(sd->disguise) { // clear disguises when warping [Valaris] clif_clearchar(&sd->bl, 9); disguise=sd->disguise; @@ -3523,30 +3490,11 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt clif_clearchar_area(&sd->bl,clrtype&0xffff); skill_gangsterparadise(sd,0); map_delblock(&sd->bl); - if(sd->status.pet_id > 0 && sd->pd) { - if(sd->pd->bl.m != m && sd->pet.intimate <= 0) { - pet_remove_map(sd); - intif_delete_petdata(sd->status.pet_id); - sd->status.pet_id = 0; - sd->pd = NULL; - sd->petDB = NULL; - if(battle_config.pet_status_support) - pc_calcstatus(sd,2); - } - else if(sd->pet.intimate > 0) { - pet_stopattack(sd->pd); - pet_changestate(sd->pd,MS_IDLE,0); - clif_clearchar_area(&sd->pd->bl,clrtype&0xffff); - map_delblock(&sd->pd->bl); - } - } memcpy(sd->mapname,mapname,24); sd->bl.x=x; sd->bl.y=y; sd->state.waitingdisconnect=1; pc_makesavestatus(sd); - if(sd->status.pet_id > 0 && sd->pd) - intif_save_petdata(sd->status.account_id,&sd->pet); chrif_save(sd); storage_storage_save(sd); chrif_changemapserver(sd, mapname, x, y, ip, port); @@ -3578,27 +3526,6 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt clif_clearchar_area(&sd->bl,clrtype&0xffff); skill_gangsterparadise(sd,0); map_delblock(&sd->bl); - // pet - if(sd->status.pet_id > 0 && sd->pd) { - if(sd->pd->bl.m != m && sd->pet.intimate <= 0) { - pet_remove_map(sd); - intif_delete_petdata(sd->status.pet_id); - sd->status.pet_id = 0; - sd->pd = NULL; - sd->petDB = NULL; - if(battle_config.pet_status_support) - pc_calcstatus(sd,2); - pc_makesavestatus(sd); - chrif_save(sd); - storage_storage_save(sd); - } - else if(sd->pet.intimate > 0) { - pet_stopattack(sd->pd); - pet_changestate(sd->pd,MS_IDLE,0); - clif_clearchar_area(&sd->pd->bl,clrtype&0xffff); - map_delblock(&sd->pd->bl); - } - } clif_changemap(sd,map[m].name,x,y); // [MouseJstr] } @@ -3615,13 +3542,6 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt sd->bl.x = x; sd->bl.y = y; - if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) { - sd->pd->bl.m = m; - sd->pd->bl.x = sd->pd->to_x = x; - sd->pd->bl.y = sd->pd->to_y = y; - sd->pd->dir = sd->dir; - } - // map_addblock(&sd->bl); /// ブロック登録とspawnは // clif_spawnpc(sd); @@ -4234,8 +4154,6 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data) sd->attacktarget_lv = battle_weapon_attack(&sd->bl,bl,tick,0); if(!(battle_config.pc_cloak_check_type&2) && sd->sc_data[SC_CLOAKING].timer != -1) skill_status_change_end(&sd->bl,SC_CLOAKING,-1); - if(sd->status.pet_id > 0 && sd->pd && sd->petDB && battle_config.pet_attack_support) - pet_target_check(sd,bl,0); map_freeblock_unlock(); if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0 ) // フリーキャスト sd->attackabletime = tick + ((sd->aspd<<1)*(150 - skill*5)/100); @@ -5064,8 +4982,6 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) skill_stop_dancing(&sd->bl,0); sd->status.hp-=damage; - if(sd->status.pet_id > 0 && sd->pd && sd->petDB && battle_config.pet_damage_support) - pet_target_check(sd,src,1); if (sd->sc_data[SC_TRICKDEAD].timer != -1) skill_status_change_end(&sd->bl, SC_TRICKDEAD, -1); @@ -5103,17 +5019,6 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) sd->quick_regeneration_sp.amount = 0; pc_setdead(sd); - if(sd->vender_id) - vending_closevending(sd); - - if(sd->status.pet_id > 0 && sd->pd) { - if(sd->petDB) { - sd->pet.intimate -= sd->petDB->die; - if(sd->pet.intimate < 0) - sd->pet.intimate = 0; - clif_send_petdata(sd,1,sd->pet.intimate); - } - } pc_stop_walking(sd,0); skill_castcancel(&sd->bl,0); // 詠唱の中止 @@ -7263,11 +7168,7 @@ static int pc_autosave_sub(struct map_session_data *sd,va_list ap) if(save_flag==0 && sd->fd>last_save_fd){ struct guild_castle *gc=NULL; int i; -// if(battle_config.save_log) -// printf("autosave %d\n",sd->fd); - // pet - if(sd->status.pet_id > 0 && sd->pd) - intif_save_petdata(sd->status.account_id,&sd->pet); + pc_makesavestatus(sd); chrif_save(sd); storage_storage_save(sd); diff --git a/src/map/pet.c b/src/map/pet.c deleted file mode 100644 index 22d2af7..0000000 --- a/src/map/pet.c +++ /dev/null @@ -1,1651 +0,0 @@ -// $Id: pet.c,v 1.4 2004/09/25 05:32:18 MouseJstr Exp $ -#include -#include -#include - -#include "db.h" -#include "timer.h" -#include "socket.h" -#include "nullpo.h" -#include "malloc.h" -#include "pc.h" -#include "map.h" -#include "intif.h" -#include "clif.h" -#include "chrif.h" -#include "pet.h" -#include "itemdb.h" -#include "battle.h" -#include "mob.h" -#include "npc.h" -#include "script.h" -#include "skill.h" - -#ifdef MEMWATCH -#include "memwatch.h" -#endif - -#define MIN_PETTHINKTIME 100 - -struct pet_db pet_db[MAX_PET_DB]; - -static int dirx[8]={0,-1,-1,-1,0,1,1,1}; -static int diry[8]={1,1,0,-1,-1,-1,0,1}; - -static int pet_timer(int tid,unsigned int tick,int id,int data); -static int pet_walktoxy_sub(struct pet_data *pd); - -static int distance(int x0,int y0,int x1,int y1) -{ - int dx,dy; - - dx=abs(x0-x1); - dy=abs(y0-y1); - return dx>dy ? dx : dy; -} - -static int calc_next_walk_step(struct pet_data *pd) -{ - nullpo_retr(0, pd); - - if(pd->walkpath.path_pos>=pd->walkpath.path_len) - return -1; - if(pd->walkpath.path[pd->walkpath.path_pos]&1) - return pd->speed*14/10; - return pd->speed; -} - -static int pet_performance_val(struct map_session_data *sd) -{ - nullpo_retr(0, sd); - - if(sd->pet.intimate > 900) - return (sd->petDB->s_perfor > 0)? 4:3; - else if(sd->pet.intimate > 750) - return 2; - else - return 1; -} - -int pet_hungry_val(struct map_session_data *sd) -{ - nullpo_retr(0, sd); - - if(sd->pet.hungry > 90) - return 4; - else if(sd->pet.hungry > 75) - return 3; - else if(sd->pet.hungry > 25) - return 2; - else if(sd->pet.hungry > 10) - return 1; - else - return 0; -} - -static int pet_can_reach(struct pet_data *pd,int x,int y) -{ - struct walkpath_data wpd; - - nullpo_retr(0, pd); - - if( pd->bl.x==x && pd->bl.y==y ) // 同じマス - return 1; - - // 障害物判定 - wpd.path_len=0; - wpd.path_pos=0; - wpd.path_half=0; - return (path_search(&wpd,pd->bl.m,pd->bl.x,pd->bl.y,x,y,0)!=-1)?1:0; -} - -static int pet_calc_pos(struct pet_data *pd,int tx,int ty,int dir) -{ - int x,y,dx,dy; - int i,j=0,k; - - nullpo_retr(0, pd); - - pd->to_x = tx; - pd->to_y = ty; - - if(dir >= 0 && dir < 8) { - dx = -dirx[dir]*2; - dy = -diry[dir]*2; - x = tx + dx; - y = ty + dy; - if(!(j=pet_can_reach(pd,x,y))) { - if(dx > 0) x--; - else if(dx < 0) x++; - if(dy > 0) y--; - else if(dy < 0) y++; - if(!(j=pet_can_reach(pd,x,y))) { - for(i=0;i<12;i++) { - k = rand()%8; - dx = -dirx[k]*2; - dy = -diry[k]*2; - x = tx + dx; - y = ty + dy; - if((j=pet_can_reach(pd,x,y))) - break; - else { - if(dx > 0) x--; - else if(dx < 0) x++; - if(dy > 0) y--; - else if(dy < 0) y++; - if((j=pet_can_reach(pd,x,y))) - break; - } - } - if(!j) { - x = tx; - y = ty; - if(!pet_can_reach(pd,x,y)) - return 1; - } - } - } - } - else - return 1; - - pd->to_x = x; - pd->to_y = y; - return 0; -} - -static int pet_attack(struct pet_data *pd,unsigned int tick,int data) -{ - struct mob_data *md; - int mode,race,range; - - nullpo_retr(0, pd); - - pd->state.state=MS_IDLE; - - md=(struct mob_data *)map_id2bl(pd->target_id); - if(md == NULL || md->bl.type != BL_MOB || pd->bl.m != md->bl.m || md->bl.prev == NULL || - distance(pd->bl.x,pd->bl.y,md->bl.x,md->bl.y) > 13) { - pd->target_id=0; - return 0; - } - - mode=mob_db[pd->class].mode; - race=mob_db[pd->class].race; - if(mob_db[pd->class].mexp <= 0 && !(mode&0x20) && (md->option & 0x06 && race != 4 && race != 6) ) { - pd->target_id=0; - return 0; - } - - range = mob_db[pd->class].range + 1; - if(distance(pd->bl.x,pd->bl.y,md->bl.x,md->bl.y) > range) - return 0; - if(battle_config.monster_attack_direction_change) - pd->dir=map_calc_dir(&pd->bl, md->bl.x,md->bl.y ); - - clif_fixpetpos(pd); - - pd->target_lv = battle_weapon_attack(&pd->bl,&md->bl,tick,0); - - pd->attackabletime = tick + battle_get_adelay(&pd->bl); - - pd->timer=add_timer(pd->attackabletime,pet_timer,pd->bl.id,0); - pd->state.state=MS_ATTACK; - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -static int pet_walk(struct pet_data *pd,unsigned int tick,int data) -{ - int moveblock; - int i,ctype; - int x,y,dx,dy; - - nullpo_retr(0, pd); - - pd->state.state=MS_IDLE; - if(pd->walkpath.path_pos >= pd->walkpath.path_len || pd->walkpath.path_pos != data) - return 0; - - pd->walkpath.path_half ^= 1; - if(pd->walkpath.path_half==0){ - pd->walkpath.path_pos++; - if(pd->state.change_walk_target){ - pet_walktoxy_sub(pd); - return 0; - } - } - else { - if(pd->walkpath.path[pd->walkpath.path_pos] >= 8) - return 1; - - x = pd->bl.x; - y = pd->bl.y; -/* ctype = map_getcell(pd->bl.m,x,y); - if(ctype == 1 || ctype == 5) { - pet_stop_walking(pd,1); - return 0; - }*/ - pd->dir=pd->walkpath.path[pd->walkpath.path_pos]; - dx = dirx[pd->dir]; - dy = diry[pd->dir]; - - ctype = map_getcell(pd->bl.m,x+dx,y+dy); - if(ctype == 1 || ctype == 5) { - pet_walktoxy_sub(pd); - return 0; - } - - moveblock = ( x/BLOCK_SIZE != (x+dx)/BLOCK_SIZE || y/BLOCK_SIZE != (y+dy)/BLOCK_SIZE); - - pd->state.state=MS_WALK; - map_foreachinmovearea(clif_petoutsight,pd->bl.m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,BL_PC,pd); - - x += dx; - y += dy; - - if(moveblock) map_delblock(&pd->bl); - pd->bl.x = x; - pd->bl.y = y; - if(moveblock) map_addblock(&pd->bl); - - map_foreachinmovearea(clif_petinsight,pd->bl.m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,-dx,-dy,BL_PC,pd); - pd->state.state=MS_IDLE; - } - if((i=calc_next_walk_step(pd))>0){ - i = i>>1; - if(i < 1 && pd->walkpath.path_half == 0) - i = 1; - pd->timer=add_timer(tick+i,pet_timer,pd->bl.id,pd->walkpath.path_pos); - pd->state.state=MS_WALK; - - if(pd->walkpath.path_pos >= pd->walkpath.path_len) - clif_fixpetpos(pd); - } - return 0; -} - -int pet_stopattack(struct pet_data *pd) -{ - nullpo_retr(0, pd); - - pd->target_id=0; - if(pd->state.state == MS_ATTACK) - pet_changestate(pd,MS_IDLE,0); - - return 0; -} - -int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) -{ - struct pet_data *pd; - struct mob_data *md; - int rate,mode,race; - - nullpo_retr(0, sd); - - pd = sd->pd; - - if(bl && pd && bl->type == BL_MOB && sd->pet.intimate > 900 && sd->pet.hungry > 0 && pd->class != battle_get_class(bl) - && pd->state.state != MS_DELAY) { - mode=mob_db[pd->class].mode; - race=mob_db[pd->class].race; - md=(struct mob_data *)bl; - if(md->bl.type != BL_MOB || pd->bl.m != md->bl.m || md->bl.prev == NULL || - distance(pd->bl.x,pd->bl.y,md->bl.x,md->bl.y) > 13) - return 0; - if(mob_db[pd->class].mexp <= 0 && !(mode&0x20) && (md->option & 0x06 && race!=4 && race!=6) ) - return 0; - if(!type) { - rate = sd->petDB->attack_rate; - rate = rate * (150 - (sd->pet.intimate - 1000))/100; - if(battle_config.pet_support_rate != 100) - rate = rate*battle_config.pet_support_rate/100; - if(sd->petDB->attack_rate > 0 && rate <= 0) - rate = 1; - } - else { - rate = sd->petDB->defence_attack_rate; - rate = rate * (150 - (sd->pet.intimate - 1000))/100; - if(battle_config.pet_support_rate != 100) - rate = rate*battle_config.pet_support_rate/100; - if(sd->petDB->defence_attack_rate > 0 && rate <= 0) - rate = 1; - } - if(rand()%10000 < rate) { - if(pd->target_id == 0 || rand()%10000 < sd->petDB->change_target_rate) - pd->target_id = bl->id; - } - } - return 0; -} - -int pet_changestate(struct pet_data *pd,int state,int type) -{ - unsigned int tick; - int i; - - nullpo_retr(0, pd); - - if(pd->timer != -1) - delete_timer(pd->timer,pet_timer); - pd->timer=-1; - pd->state.state=state; - - switch(state) { - case MS_WALK: - if((i=calc_next_walk_step(pd)) > 0){ - i = i>>2; - pd->timer=add_timer(gettick()+i,pet_timer,pd->bl.id,0); - } else - pd->state.state=MS_IDLE; - break; - case MS_ATTACK: - tick = gettick(); - i=DIFF_TICK(pd->attackabletime,tick); - if(i>0 && i<2000) - pd->timer=add_timer(pd->attackabletime,pet_timer,pd->bl.id,0); - else - pd->timer=add_timer(tick+1,pet_timer,pd->bl.id,0); - break; - case MS_DELAY: - pd->timer=add_timer(gettick()+type,pet_timer,pd->bl.id,0); - break; - } - - return 0; -} - -static int pet_timer(int tid,unsigned int tick,int id,int data) -{ - struct pet_data *pd; - - pd=(struct pet_data*)map_id2bl(id); - if(pd == NULL || pd->bl.type != BL_PET) - return 1; - - if(pd->timer != tid){ - if(battle_config.error_log) - printf("pet_timer %d != %d\n",pd->timer,tid); - return 0; - } - pd->timer=-1; - - if(pd->bl.prev == NULL) - return 1; - - switch(pd->state.state){ - case MS_WALK: - pet_walk(pd,tick,data); - break; - case MS_ATTACK: - pet_attack(pd,tick,data); - break; - case MS_DELAY: - pet_changestate(pd,MS_IDLE,0); - break; - default: - if(battle_config.error_log) - printf("pet_timer : %d ?\n",pd->state.state); - break; - } - - return 0; -} - -static int pet_walktoxy_sub(struct pet_data *pd) -{ - struct walkpath_data wpd; - - nullpo_retr(0, pd); - - if(path_search(&wpd,pd->bl.m,pd->bl.x,pd->bl.y,pd->to_x,pd->to_y,0)) - return 1; - memcpy(&pd->walkpath,&wpd,sizeof(wpd)); - - pd->state.change_walk_target=0; - pet_changestate(pd,MS_WALK,0); - clif_movepet(pd); -// if(battle_config.etc_log) -// printf("walkstart\n"); - - return 0; -} - -int pet_walktoxy(struct pet_data *pd,int x,int y) -{ - struct walkpath_data wpd; - - nullpo_retr(0, pd); - - if(pd->state.state == MS_WALK && path_search(&wpd,pd->bl.m,pd->bl.x,pd->bl.y,x,y,0)) - return 1; - - pd->to_x=x; - pd->to_y=y; - - if(pd->state.state == MS_WALK) { - pd->state.change_walk_target=1; - } else { - return pet_walktoxy_sub(pd); - } - - return 0; -} - -int pet_stop_walking(struct pet_data *pd,int type) -{ - nullpo_retr(0, pd); - - if(pd->state.state == MS_WALK || pd->state.state == MS_IDLE) { - pd->walkpath.path_len=0; - pd->to_x=pd->bl.x; - pd->to_y=pd->bl.y; - } - if(type&0x01) - clif_fixpetpos(pd); - if(type&~0xff) - pet_changestate(pd,MS_DELAY,type>>8); - else - pet_changestate(pd,MS_IDLE,0); - - return 0; -} - -static int pet_hungry(int tid,unsigned int tick,int id,int data) -{ - struct map_session_data *sd; - int interval,t; - - sd=map_id2sd(id); - if(sd==NULL) - return 1; - - if(sd->pet_hungry_timer != tid){ - if(battle_config.error_log) - printf("pet_hungry_timer %d != %d\n",sd->pet_hungry_timer,tid); - return 0; - } - sd->pet_hungry_timer = -1; - if(!sd->status.pet_id || !sd->pd || !sd->petDB) - return 1; - - sd->pet.hungry--; - t = sd->pet.intimate; - if(sd->pet.hungry < 0) { - if(sd->pd->target_id > 0) - pet_stopattack(sd->pd); - sd->pet.hungry = 0; - sd->pet.intimate -= battle_config.pet_hungry_friendly_decrease; - if(sd->pet.intimate <= 0) { - sd->pet.intimate = 0; - if(battle_config.pet_status_support && t > 0) { - if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); - else - pc_calcstatus(sd,2); - } - } - clif_send_petdata(sd,1,sd->pet.intimate); - } - clif_send_petdata(sd,2,sd->pet.hungry); - - if(battle_config.pet_hungry_delay_rate != 100) - interval = (sd->petDB->hungry_delay*battle_config.pet_hungry_delay_rate)/100; - else - interval = sd->petDB->hungry_delay; - if(interval <= 0) - interval = 1; - sd->pet_hungry_timer = add_timer(tick+interval,pet_hungry,sd->bl.id,0); - - return 0; -} - -int search_petDB_index(int key,int type) -{ - int i; - - for(i=0;ipet_hungry_timer != -1) { - delete_timer(sd->pet_hungry_timer,pet_hungry); - sd->pet_hungry_timer = -1; - } - - return 0; -} - -int pet_remove_map(struct map_session_data *sd) -{ - nullpo_retr(0, sd); - - if(sd->status.pet_id && sd->pd) { - - struct pet_data *pd=sd->pd; // [Valaris] - if(pd->skillbonustimer!=-1) pd->skillbonustimer=-1; - if(pd->skillbonusduration!=-1) pd->skillbonusduration=-1; - if(pd->skilltype !=-1) pd->skilltype=-1; - if(pd->skillval !=-1) pd->skillval=-1; - if(pd->skilltimer!=-1) pd->skilltimer=-1; - if(pd->skillduration!=-1) pd->skillduration=-1; - if(pd->skillbonustype!=-1) pd->skillbonustype=-1; - if(pd->skillbonusval!=-1) pd->skillbonusval=-1; - if(sd->perfect_hiding==1) sd->perfect_hiding=0; // end additions - - pet_changestate(sd->pd,MS_IDLE,0); - if(sd->pet_hungry_timer != -1) - pet_hungry_timer_delete(sd); - clif_clearchar_area(&sd->pd->bl,0); - map_delblock(&sd->pd->bl); - map_deliddb(&sd->pd->bl); - map_freeblock(sd->pd); - } - return 0; -} -struct delay_item_drop { - int m,x,y; - int nameid,amount; - struct map_session_data *first_sd,*second_sd,*third_sd; -}; - -struct delay_item_drop2 { - int m,x,y; - struct item item_data; - struct map_session_data *first_sd,*second_sd,*third_sd; -}; - -int pet_performance(struct map_session_data *sd) -{ - struct pet_data *pd; - - nullpo_retr(0, sd); - nullpo_retr(0, pd=sd->pd); - - pet_stop_walking(pd,2000<<8); - clif_pet_performance(&pd->bl,rand()%pet_performance_val(sd) + 1); - // ルートしたItemを落とさせる - pet_lootitem_drop(pd,NULL); - - return 0; -} - -int pet_return_egg(struct map_session_data *sd) -{ - struct item tmp_item; - int flag; - - nullpo_retr(0, sd); - - if(sd->status.pet_id && sd->pd) { - struct pet_data *pd=sd->pd; - pet_remove_map(sd); - sd->status.pet_id = 0; - sd->pd = NULL; - - if(sd->petDB == NULL) - return 1; - sd->pet.incuvate = 1; - memset(&tmp_item,0,sizeof(tmp_item)); - tmp_item.nameid = sd->petDB->EggID; - tmp_item.identify = 1; - tmp_item.card[0] = 0xff00; - *((long *)(&tmp_item.card[1])) = sd->pet.pet_id; - tmp_item.card[3] = sd->pet.rename_flag; - if((flag = pc_additem(sd,&tmp_item,1))) { - clif_additem(sd,0,0,flag); - map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); - } - if(battle_config.pet_status_support && sd->pet.intimate > 0) { - if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); - else - pc_calcstatus(sd,2); - } - // ルートしたItemを落とさせる - pet_lootitem_drop(pd,sd); - - intif_save_petdata(sd->status.account_id,&sd->pet); - pc_makesavestatus(sd); - chrif_save(sd); - storage_storage_save(sd); - - sd->petDB = NULL; - } - - return 0; -} - -int pet_data_init(struct map_session_data *sd) -{ - struct pet_data *pd; - int i=0,interval=0; - - nullpo_retr(1, sd); - - if(sd->status.account_id != sd->pet.account_id || sd->status.char_id != sd->pet.char_id || - sd->status.pet_id != sd->pet.pet_id) { - sd->status.pet_id = 0; - return 1; - } - - i = search_petDB_index(sd->pet.class,PET_CLASS); - if(i < 0) { - sd->status.pet_id = 0; - return 1; - } - sd->petDB = &pet_db[i]; - sd->pd = pd = (struct pet_data *)aCalloc(1,sizeof(struct pet_data)); - - pd->bl.m = sd->bl.m; - pd->bl.prev = pd->bl.next = NULL; - pd->bl.x = pd->to_x = sd->bl.x; - pd->bl.y = pd->to_y = sd->bl.y; - pet_calc_pos(pd,sd->bl.x,sd->bl.y,sd->dir); - pd->bl.x = pd->to_x; - pd->bl.y = pd->to_y; - pd->bl.id = npc_get_new_npc_id(); - memcpy(pd->name,sd->pet.name,24); - pd->class = sd->pet.class; - pd->equip = sd->pet.equip; - pd->dir = sd->dir; - pd->speed = sd->petDB->speed; - pd->bl.subtype = MONS; - pd->bl.type = BL_PET; - memset(&pd->state,0,sizeof(pd->state)); - pd->state.state = MS_IDLE; - pd->state.change_walk_target = 0; - pd->timer = -1; - pd->target_id = 0; - pd->move_fail_count = 0; - pd->next_walktime = pd->attackabletime = pd->last_thinktime = gettick(); - pd->msd = sd; - - map_addiddb(&pd->bl); - - if(sd->pet_hungry_timer != -1) - pet_hungry_timer_delete(sd); - if(battle_config.pet_hungry_delay_rate != 100) - interval = (sd->petDB->hungry_delay*battle_config.pet_hungry_delay_rate)/100; - else - interval = sd->petDB->hungry_delay; - if(interval <= 0) - interval = 1; - sd->pet_hungry_timer = add_timer(gettick()+interval,pet_hungry,sd->bl.id,0); - pd->lootitem=(struct item *)aCalloc(PETLOOT_SIZE,sizeof(struct item)); - pd->lootitem_count = 0; - pd->lootitem_weight = 0; - pd->lootitem_timer = gettick(); - return 0; -} - -int pet_birth_process(struct map_session_data *sd) -{ - nullpo_retr(1, sd); - - if(sd->status.pet_id && sd->pet.incuvate == 1) { - sd->status.pet_id = 0; - return 1; - } - - sd->pet.incuvate = 0; - sd->pet.account_id = sd->status.account_id; - sd->pet.char_id = sd->status.char_id; - sd->status.pet_id = sd->pet.pet_id; - if(pet_data_init(sd)) { - sd->status.pet_id = 0; - sd->pet.incuvate = 1; - sd->pet.account_id = 0; - sd->pet.char_id = 0; - return 1; - } - - intif_save_petdata(sd->status.account_id,&sd->pet); - pc_makesavestatus(sd); - chrif_save(sd); - storage_storage_save(sd); - map_addblock(&sd->pd->bl); - clif_spawnpet(sd->pd); - clif_send_petdata(sd,0,0); - clif_send_petdata(sd,5,0x14); - clif_pet_equip(sd->pd,sd->pet.equip); - clif_send_petstatus(sd); - - return 0; -} - -int pet_recv_petdata(int account_id,struct s_pet *p,int flag) -{ - struct map_session_data *sd; - - sd = map_id2sd(account_id); - if(sd == NULL) - return 1; - if(flag == 1) { - sd->status.pet_id = 0; - return 1; - } - memcpy(&sd->pet,p,sizeof(struct s_pet)); - if(sd->pet.incuvate == 1) - pet_birth_process(sd); - else { - pet_data_init(sd); - if(sd->bl.prev != NULL) { - map_addblock(&sd->pd->bl); - clif_spawnpet(sd->pd); - clif_send_petdata(sd,0,0); - clif_send_petdata(sd,5,0x14); -// clif_pet_equip(sd->pd,sd->pet.equip); - clif_send_petstatus(sd); - } - } - if(battle_config.pet_status_support && sd->pet.intimate > 0) { - if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); - else - pc_calcstatus(sd,2); - } - - return 0; -} - -int pet_select_egg(struct map_session_data *sd,short egg_index) -{ - nullpo_retr(0, sd); - - if(sd->status.inventory[egg_index].card[0] == (short)0xff00) - intif_request_petdata(sd->status.account_id,sd->status.char_id,*((long *)&sd->status.inventory[egg_index].card[1])); - else { - if(battle_config.error_log) - printf("wrong egg item inventory %d\n",egg_index); - } - pc_delitem(sd,egg_index,1,0); - - return 0; -} - -int pet_catch_process1(struct map_session_data *sd,int target_class) -{ - nullpo_retr(0, sd); - - sd->catch_target_class = target_class; - clif_catch_process(sd); - - return 0; -} - -int pet_catch_process2(struct map_session_data *sd,int target_id) -{ - struct mob_data *md; - int i=0,pet_catch_rate=0; - - nullpo_retr(1, sd); - - md=(struct mob_data*)map_id2bl(target_id); - if(!md){ - clif_pet_rulet(sd,0); - return 1; - } - - i = search_petDB_index(md->class,PET_CLASS); - if(md == NULL || md->bl.type != BL_MOB || md->bl.prev == NULL || i < 0 || sd->catch_target_class != md->class) { - clif_pet_rulet(sd,0); - return 1; - } - - //target_idによる敵→卵判定 -// if(battle_config.etc_log) -// printf("mob_id = %d, mob_class = %d\n",md->bl.id,md->class); - //成功の場合 - pet_catch_rate = (pet_db[i].capture + (sd->status.base_level - mob_db[md->class].lv)*30 + sd->paramc[5]*20)*(200 - md->hp*100/mob_db[md->class].max_hp)/100; - if(pet_catch_rate < 1) pet_catch_rate = 1; - if(battle_config.pet_catch_rate != 100) - pet_catch_rate = (pet_catch_rate*battle_config.pet_catch_rate)/100; - - if(rand()%10000 < pet_catch_rate) { - mob_catch_delete(md,0); - clif_pet_rulet(sd,1); -// if(battle_config.etc_log) -// printf("rulet success %d\n",target_id); - intif_create_pet(sd->status.account_id,sd->status.char_id,pet_db[i].class,mob_db[pet_db[i].class].lv, - pet_db[i].EggID,0,pet_db[i].intimate,100,0,1,pet_db[i].jname); - } - else - clif_pet_rulet(sd,0); - - return 0; -} - -int pet_get_egg(int account_id,int pet_id,int flag) -{ - struct map_session_data *sd; - struct item tmp_item; - int i=0,ret=0; - - if(!flag) { - sd = map_id2sd(account_id); - if(sd == NULL) - return 1; - - i = search_petDB_index(sd->catch_target_class,PET_CLASS); - if(i >= 0) { - memset(&tmp_item,0,sizeof(tmp_item)); - tmp_item.nameid = pet_db[i].EggID; - tmp_item.identify = 1; - tmp_item.card[0] = 0xff00; - *((long *)(&tmp_item.card[1])) = pet_id; - tmp_item.card[3] = sd->pet.rename_flag; - if((ret = pc_additem(sd,&tmp_item,1))) { - clif_additem(sd,0,0,ret); - map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); - } - } - else - intif_delete_petdata(pet_id); - } - - return 0; -} - -int pet_menu(struct map_session_data *sd,int menunum) -{ - nullpo_retr(0, sd); - - switch(menunum) { - case 0: - clif_send_petstatus(sd); - break; - case 1: - pet_food(sd); - break; - case 2: - pet_performance(sd); - break; - case 3: - pet_return_egg(sd); - break; - case 4: - pet_unequipitem(sd); - break; - } - return 0; -} - -int pet_change_name(struct map_session_data *sd,char *name) -{ - int i; - - nullpo_retr(1, sd); - - if(sd->pet.rename_flag == 1 && battle_config.pet_rename == 0) - return 1; - - for(i=0;i<24 && name[i];i++){ - if( !(name[i]&0xe0) || name[i]==0x7f) - return 1; - } - - pet_stop_walking(sd->pd,1); - memcpy(sd->pet.name,name,24); - memcpy(sd->pd->name,name,24); - clif_clearchar_area(&sd->pd->bl,0); - clif_spawnpet(sd->pd); - clif_send_petdata(sd,0,0); - clif_send_petdata(sd,5,0x14); - sd->pet.rename_flag = 1; - clif_pet_equip(sd->pd,sd->pet.equip); - clif_send_petstatus(sd); - - return 0; -} - -int pet_equipitem(struct map_session_data *sd,int index) -{ - int nameid; - - nullpo_retr(1, sd); - - nameid = sd->status.inventory[index].nameid; - if(sd->petDB == NULL) - return 1; - if(sd->petDB->AcceID == 0 || nameid != sd->petDB->AcceID || sd->pet.equip != 0) { - clif_equipitemack(sd,0,0,0); - return 1; - } - else { - pc_delitem(sd,index,1,0); - sd->pet.equip = sd->pd->equip = nameid; - pc_calcstatus(sd,0); - clif_pet_equip(sd->pd,nameid); - } - - return 0; -} - -int pet_unequipitem(struct map_session_data *sd) -{ - struct item tmp_item; - int nameid,flag; - - nullpo_retr(1, sd); - - if(sd->petDB == NULL) - return 1; - if(sd->pet.equip == 0) - return 1; - - nameid = sd->pet.equip; - sd->pet.equip = sd->pd->equip = 0; - pc_calcstatus(sd,0); - clif_pet_equip(sd->pd,0); - memset(&tmp_item,0,sizeof(tmp_item)); - tmp_item.nameid = nameid; - tmp_item.identify = 1; - if((flag = pc_additem(sd,&tmp_item,1))) { - clif_additem(sd,0,0,flag); - map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); - } - - return 0; -} - -int pet_food(struct map_session_data *sd) -{ - int i,k,t; - - nullpo_retr(1, sd); - - if(sd->petDB == NULL) - return 1; - i=pc_search_inventory(sd,sd->petDB->FoodID); - if(i < 0) { - clif_pet_food(sd,sd->petDB->FoodID,0); - return 1; - } - pc_delitem(sd,i,1,0); - t = sd->pet.intimate; - if(sd->pet.hungry > 90) - sd->pet.intimate -= sd->petDB->r_full; - else if(sd->pet.hungry > 75) { - if(battle_config.pet_friendly_rate != 100) - k = (sd->petDB->r_hungry * battle_config.pet_friendly_rate)/100; - else - k = sd->petDB->r_hungry; - k = k >> 1; - if(k <= 0) - k = 1; - sd->pet.intimate += k; - } - else { - if(battle_config.pet_friendly_rate != 100) - k = (sd->petDB->r_hungry * battle_config.pet_friendly_rate)/100; - else - k = sd->petDB->r_hungry; - sd->pet.intimate += k; - } - if(sd->pet.intimate <= 0) { - sd->pet.intimate = 0; - if(battle_config.pet_status_support && t > 0) { - if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); - else - pc_calcstatus(sd,2); - } - } - else if(sd->pet.intimate > 1000) - sd->pet.intimate = 1000; - sd->pet.hungry += sd->petDB->fullness; - if(sd->pet.hungry > 100) - sd->pet.hungry = 100; - - clif_send_petdata(sd,2,sd->pet.hungry); - clif_send_petdata(sd,1,sd->pet.intimate); - clif_pet_food(sd,sd->petDB->FoodID,1); - - return 0; -} - -static int pet_randomwalk(struct pet_data *pd,int tick) -{ - const int retrycount=20; - int speed; - - nullpo_retr(0, pd); - - speed = battle_get_speed(&pd->bl); - - if(DIFF_TICK(pd->next_walktime,tick) < 0){ - int i,x,y,c,d=12-pd->move_fail_count; - if(d<5) d=5; - for(i=0;ibl.x+r%(d*2+1)-d; - y=pd->bl.y+r/(d*2+1)%(d*2+1)-d; - if((c=map_getcell(pd->bl.m,x,y))!=1 && c!=5 && pet_walktoxy(pd,x,y)==0){ - pd->move_fail_count=0; - break; - } - if(i+1>=retrycount){ - pd->move_fail_count++; - if(pd->move_fail_count>1000){ - if(battle_config.error_log) - printf("PET cant move. hold position %d, class = %d\n",pd->bl.id,pd->class); - pd->move_fail_count=0; - pet_changestate(pd,MS_DELAY,60000); - return 0; - } - } - } - for(i=c=0;iwalkpath.path_len;i++){ - if(pd->walkpath.path[i]&1) - c+=speed*14/10; - else - c+=speed; - } - pd->next_walktime = tick+rand()%3000+3000+c; - - return 1; - } - return 0; -} - -static int pet_unlocktarget(struct pet_data *pd) -{ - nullpo_retr(0, pd); - - pd->target_id=0; - - return 0; -} - -static int pet_ai_sub_hard(struct pet_data *pd,unsigned int tick) -{ - struct map_session_data *sd = pd->msd; - struct mob_data *md = NULL; - int dist,i=0,dx,dy,ret; - int mode,race; - - nullpo_retr(0, pd); - - sd = pd->msd; - - if(pd->bl.prev == NULL || sd == NULL || sd->bl.prev == NULL) - return 0; - - if(DIFF_TICK(tick,pd->last_thinktime) < MIN_PETTHINKTIME) - return 0; - pd->last_thinktime=tick; - - if(pd->state.state == MS_DELAY || pd->bl.m != sd->bl.m) - return 0; - // ペットによるルート - if(!pd->target_id && pd->lootitem_count < PETLOOT_SIZE && pd->lootitem_count < pd->lootmax && pd->loot==1 && DIFF_TICK(gettick(),pd->lootitem_timer)>0) - map_foreachinarea(pet_ai_sub_hard_lootsearch,pd->bl.m, - pd->bl.x-AREA_SIZE*2,pd->bl.y-AREA_SIZE*2, - pd->bl.x+AREA_SIZE*2,pd->bl.y+AREA_SIZE*2, - BL_ITEM,pd,&i); - - if(sd->pet.intimate > 0) { - dist = distance(sd->bl.x,sd->bl.y,pd->bl.x,pd->bl.y); - if(dist > 12) { - if(pd->target_id > 0) - pet_unlocktarget(pd); - if(pd->timer != -1 && pd->state.state == MS_WALK && distance(pd->to_x,pd->to_y,sd->bl.x,sd->bl.y) < 3) - return 0; - pd->speed = (sd->speed>>1); - if(pd->speed <= 0) - pd->speed = 1; - pet_calc_pos(pd,sd->bl.x,sd->bl.y,sd->dir); - if(pet_walktoxy(pd,pd->to_x,pd->to_y)) - pet_randomwalk(pd,tick); - } - else if(pd->target_id - MAX_FLOORITEM > 0) { - mode=mob_db[pd->class].mode; - race=mob_db[pd->class].race; - md=(struct mob_data *)map_id2bl(pd->target_id); - if(md == NULL || md->bl.type != BL_MOB || pd->bl.m != md->bl.m || md->bl.prev == NULL || - distance(pd->bl.x,pd->bl.y,md->bl.x,md->bl.y) > 13) - pet_unlocktarget(pd); - else if(mob_db[pd->class].mexp <= 0 && !(mode&0x20) && (md->option & 0x06 && race!=4 && race!=6) ) - pet_unlocktarget(pd); - else if(!battle_check_range(&pd->bl,&md->bl,mob_db[pd->class].range)){ - if(pd->timer != -1 && pd->state.state == MS_WALK && distance(pd->to_x,pd->to_y,md->bl.x,md->bl.y) < 2) - return 0; - if( !pet_can_reach(pd,md->bl.x,md->bl.y)) - pet_unlocktarget(pd); - else { - i=0; - pd->speed = battle_get_speed(&pd->bl); - do { - if(i==0) { // 最初はAEGISと同じ方法で検索 - dx=md->bl.x - pd->bl.x; - dy=md->bl.y - pd->bl.y; - if(dx<0) dx++; - else if(dx>0) dx--; - if(dy<0) dy++; - else if(dy>0) dy--; - } - else { // だめならAthena式(ランダム) - dx=md->bl.x - pd->bl.x + rand()%3 - 1; - dy=md->bl.y - pd->bl.y + rand()%3 - 1; - } - ret=pet_walktoxy(pd,pd->bl.x+dx,pd->bl.y+dy); - i++; - } while(ret && i<5); - - if(ret) { // 移動不可能な所からの攻撃なら2歩下る - if(dx<0) dx=2; - else if(dx>0) dx=-2; - if(dy<0) dy=2; - else if(dy>0) dy=-2; - pet_walktoxy(pd,pd->bl.x+dx,pd->bl.y+dy); - } - } - } - else { - if(pd->state.state==MS_WALK) - pet_stop_walking(pd,1); - if(pd->state.state==MS_ATTACK) - return 0; - pet_changestate(pd,MS_ATTACK,0); - } - } - else if(pd->target_id > 0){ // ルート処理 - struct block_list *bl_item; - struct flooritem_data *fitem; - - bl_item = map_id2bl(pd->target_id); - if(bl_item == NULL || bl_item->type != BL_ITEM ||bl_item->m != pd->bl.m || - (dist=distance(pd->bl.x,pd->bl.y,bl_item->x,bl_item->y))>=5){ - // 遠すぎるかアイテムがなくなった - pet_unlocktarget(pd); - } - else if(dist){ - if(pd->timer != -1 && pd->state.state!=MS_ATTACK && (DIFF_TICK(pd->next_walktime,tick)<0 || distance(pd->to_x,pd->to_y,bl_item->x,bl_item->y) <= 0)) - return 0; // 既に移動中 - - pd->next_walktime=tick+500; - dx=bl_item->x - pd->bl.x; - dy=bl_item->y - pd->bl.y; - - ret=pet_walktoxy(pd,pd->bl.x+dx,pd->bl.y+dy); - } - else{ // アイテムまでたどり着いた - fitem = (struct flooritem_data *)bl_item; - if(pd->state.state==MS_ATTACK) - return 0; // 攻撃中 - if(pd->state.state==MS_WALK){ // 歩行中なら停止 - pet_stop_walking(pd,1); - } - if(pd->lootitem_count < PETLOOT_SIZE && pd->lootitem_count < pd->lootmax){ - memcpy(&pd->lootitem[pd->lootitem_count++],&fitem->item_data,sizeof(pd->lootitem[0])); - pd->lootitem_weight += itemdb_search(fitem->item_data.nameid)->weight*fitem->item_data.amount; - } - else if(pd->lootitem_count >= PETLOOT_SIZE || pd->lootitem_count >=pd->lootmax) { - pet_unlocktarget(pd); - return 0; - } - else { - if(pd->lootitem[0].card[0] == (short)0xff00) - intif_delete_petdata(*((long *)(&pd->lootitem[0].card[1]))); - for(i=0;ilootitem[i],&pd->lootitem[i+1],sizeof(pd->lootitem[0])); - memcpy(&pd->lootitem[PETLOOT_SIZE-1],&fitem->item_data,sizeof(pd->lootitem[0])); - } - map_clearflooritem(bl_item->id); - pet_unlocktarget(pd); - } - } - else { - if(dist <= 3 || (pd->timer != -1 && pd->state.state == MS_WALK && distance(pd->to_x,pd->to_y,sd->bl.x,sd->bl.y) < 3) ) - return 0; - pd->speed = battle_get_speed(&pd->bl); - pet_calc_pos(pd,sd->bl.x,sd->bl.y,sd->dir); - if(pet_walktoxy(pd,pd->to_x,pd->to_y)) - pet_randomwalk(pd,tick); - } - } - else { - pd->speed = battle_get_speed(&pd->bl); - if(pd->state.state == MS_ATTACK) - pet_stopattack(pd); - pet_randomwalk(pd,tick); - } - - return 0; -} - -static int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) -{ - unsigned int tick; - - nullpo_retr(0, sd); - nullpo_retr(0, ap); - - tick=va_arg(ap,unsigned int); - if(sd->status.pet_id && sd->pd && sd->petDB) - pet_ai_sub_hard(sd->pd,tick); - - return 0; -} - -static int pet_ai_hard(int tid,unsigned int tick,int id,int data) -{ - clif_foreachclient(pet_ai_sub_foreachclient,tick); - - return 0; -} - -int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) -{ - struct pet_data* pd; - int dist,*itc; - - nullpo_retr(0, bl); - nullpo_retr(0, ap); - nullpo_retr(0, pd=va_arg(ap,struct pet_data *)); - nullpo_retr(0, itc=va_arg(ap,int *)); - - if(!pd->target_id){ - struct flooritem_data *fitem = (struct flooritem_data *)bl; - struct map_session_data *sd = NULL; - // ルート権無し - if(fitem && fitem->first_get_id>0) - sd = map_id2sd(fitem->first_get_id); - // Removed [Valaris] - //if((pd->lootitem_weight + (itemdb_search(fitem->item_data.))->weight * fitem->item_data.amount) > battle_config.pet_weight) - // return 0; - - if(!pd->lootitem || (pd->lootitem_count >= PETLOOT_SIZE) || (pd->lootitem_count >= pd->lootmax) || (sd && sd->pd != pd)) - return 0; - if(bl->m == pd->bl.m && (dist=distance(pd->bl.x,pd->bl.y,bl->x,bl->y))<5){ - if( pet_can_reach(pd,bl->x,bl->y) // 到達可能性判定 - && rand()%1000<1000/(++(*itc)) ){ // 範囲内PCで等確率にする - pd->target_id=bl->id; - } - } - } - return 0; -} -int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd) -{ - int i,flag=0; - - if(pd){ - if(pd->lootitem) { - for(i=0;ilootitem_count;i++) { - struct delay_item_drop2 *ditem; - - ditem=(struct delay_item_drop2 *)aCalloc(1,sizeof(struct delay_item_drop2)); - memcpy(&ditem->item_data,&pd->lootitem[i],sizeof(pd->lootitem[0])); - ditem->m = pd->bl.m; - ditem->x = pd->bl.x; - ditem->y = pd->bl.y; - ditem->first_sd = 0; - ditem->second_sd = 0; - ditem->third_sd = 0; - // 落とさないで直接PCのItem欄へ - if(sd){ - if((flag = pc_additem(sd,&ditem->item_data,ditem->item_data.amount))){ - clif_additem(sd,0,0,flag); - map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); - } - free(ditem); - } - else - add_timer(gettick()+540+i,pet_delay_item_drop2,(int)ditem,0); - } - pd->lootitem=NULL; - pd->lootitem=(struct item *)aCalloc(PETLOOT_SIZE,sizeof(struct item)); - pd->lootitem_count = 0; - pd->lootitem_weight = 0; - pd->lootitem_timer = gettick()+10000; // 10*1000msの間拾わない - } - } - return 1; -} - -int pet_delay_item_drop2(int tid,unsigned int tick,int id,int data) -{ - struct delay_item_drop2 *ditem; - - ditem=(struct delay_item_drop2 *)id; - - map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); - - free(ditem); - return 0; -} - -/*========================================== - * pet bonus giving skills [Valaris] - *------------------------------------------ - */ - -int pet_skill_bonus(struct map_session_data *sd,struct pet_data *pd,int type,int val,int duration,int timer,int data) -{ - if(pd==NULL || sd==NULL) - return 1; - - pd->skillbonustype=type; - pd->skillbonusval=val; - pd->skillduration=duration; - pd->skilltimer=timer; - - pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_skill_bonus_timer,sd->bl.id,0); - - return 0; - -} - -int pet_skill_bonus_timer(int tid,unsigned int tick,int id,int data) -{ - struct map_session_data *sd=(struct map_session_data*)map_id2bl(id); - struct pet_data *pd; - - if(sd==NULL || sd->bl.type!=BL_PC) - return 1; - - pd=sd->pd; - - if(pd==NULL || pd->bl.type!=BL_PET) - return 1; - - if(pd->skillbonustimer != tid) - return 0; - - pd->skillbonustimer=-1; - - pc_bonus(sd,pd->skillbonustype,pd->skillbonusval); - if(pd->skillbonustype < 56) clif_updatestatus(sd,pd->skillbonustype); - pd->skillbonusduration=add_timer(gettick()+pd->skillduration*1000,pet_skill_bonus_duration,sd->bl.id,0); - - return 0; -} - -int pet_skill_bonus_duration(int tid,unsigned int tick,int id,int data) -{ - struct map_session_data *sd=(struct map_session_data*)map_id2bl(id); - struct pet_data *pd; - - if(sd==NULL || sd->bl.type!=BL_PC) - return 1; - - pd=sd->pd; - - if(pd==NULL || pd->bl.type!=BL_PET) - return 1; - - if(pd->skillbonusduration != tid) - return 0; - - pd->skillbonusduration=-1; - - pc_bonus(sd,pd->skillbonustype,-pd->skillbonusval); - if(pd->skillbonustype < 56) clif_updatestatus(sd,pd->skillbonustype); - - pet_skill_bonus(sd,pd,pd->skillbonustype,pd->skillbonusval,pd->skillduration,pd->skilltimer,0); - - return 0; -} - -int pet_recovery_timer(int tid,unsigned int tick,int id,int data) -{ - struct map_session_data *sd=(struct map_session_data*)map_id2bl(id); - struct pet_data *pd; - - if(sd==NULL || sd->bl.type!=BL_PC) - return 1; - - pd=sd->pd; - - if(pd==NULL || pd->bl.type!=BL_PET) - return 1; - - if(pd->skillbonustimer != tid) - return 0; - - if(sd->sc_data[pd->skilltype].timer != -1) - skill_status_change_end(&sd->bl,pd->skilltype,-1); - - pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_recovery_timer,sd->bl.id,0); - - return 0; -} - -int pet_heal_timer(int tid,unsigned int tick,int id,int data) -{ - struct map_session_data *sd=(struct map_session_data*)map_id2bl(id); - struct pet_data *pd; - - if(sd==NULL || sd->bl.type!=BL_PC) - return 1; - - pd=sd->pd; - - if(pd==NULL || pd->bl.type!=BL_PET) - return 1; - - if(pd->skillbonustimer != tid) - return 0; - - if(sd->status.hp < sd->status.max_hp * pd->skilltype/100) { - clif_skill_nodamage(&pd->bl,&sd->bl,AL_HEAL,pd->skillval,1); - pc_heal(sd,pd->skillval,0); - } - - pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_heal_timer,sd->bl.id,0); - - return 0; -} - -int pet_mag_timer(int tid,unsigned int tick,int id,int data) -{ - struct pet_data *pd; - struct map_session_data *sd=(struct map_session_data*)map_id2bl(id); - - if(sd==NULL || sd->bl.type!=BL_PC) - return 1; - - pd=sd->pd; - - if(pd==NULL || pd->bl.type!=BL_PET) - return 1; - - if(pd->skillbonustimer != tid) - return 0; - - if(sd->status.hp < sd->status.max_hp * pd->skilltype/100 && sd->status.sp < sd->status.max_sp * pd->skillduration/100) { - clif_skill_nodamage(&pd->bl,&sd->bl,PR_MAGNIFICAT,pd->skillval,1); - skill_status_change_start(&sd->bl,SkillStatusChangeTable[PR_MAGNIFICAT],pd->skillval,0,0,0,skill_get_time(PR_MAGNIFICAT,pd->skillval),0 ); - } - - pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_mag_timer,sd->bl.id,0); - - return 0; -} - -int pet_skillattack_timer(int tid,unsigned int tick,int id,int data) -{ - struct mob_data *md; - struct map_session_data *sd=(struct map_session_data*)map_id2bl(id); - struct pet_data *pd; - - if(sd==NULL || sd->bl.type!=BL_PC) - return 1; - - pd=sd->pd; - - if(pd==NULL || pd->bl.type!=BL_PET) - return 1; - - if(pd->skillbonustimer != tid) - return 0; - - md=(struct mob_data *)map_id2bl(sd->attacktarget); - if(md == NULL || md->bl.type != BL_MOB || pd->bl.m != md->bl.m || md->bl.prev == NULL || - distance(pd->bl.x,pd->bl.y,md->bl.x,md->bl.y) > 6) { - pd->target_id=0; - pd->skillbonustimer=add_timer(gettick()+100,pet_skillattack_timer,sd->bl.id,pd->skillduration); - return 0; - } - - if(md && rand()%100 < sd->pet.intimate*pd->skilltimer/100 ) { - if(pd->skilltype==6 || pd->skilltype==176) { - skill_castend_nodamage_id(&pd->bl,&md->bl,pd->skilltype,pd->skillval,tick,0); - } - - else if(pd->skilltype==110){ - skill_castend_pos2(&pd->bl,md->bl.x,md->bl.y,pd->skilltype,pd->skillval,tick,0); - } - - else if(pd->skilltype==91) { - skill_castend_pos2(&pd->bl,md->bl.x,md->bl.y,pd->skilltype,pd->skillval+rand()%100,tick,0); - } - else - skill_castend_damage_id(&pd->bl,&md->bl,pd->skilltype,pd->skillval,tick,0); - pd->skillbonustimer=add_timer(gettick()+1000,pet_skillattack_timer,sd->bl.id,0); - return 0; - } - - pd->skillbonustimer=add_timer(gettick()+100,pet_skillattack_timer,sd->bl.id,0); - - return 0; -} - -/*========================================== - *ペットデータ読み込み - *------------------------------------------ - */ -int read_petdb() -{ - FILE *fp; - char line[1024]; - int i; - int j=0; - char *filename[]={"db/pet_db.txt","db/pet_db2.txt"}; - - memset(pet_db,0,sizeof(pet_db)); - for(i=0;i<2;i++){ - fp=fopen(filename[i],"r"); - if(fp==NULL){ - if(i>0) - continue; - printf("can't read %s\n",filename[i]); - return -1; - } - while(fgets(line,1020,fp)){ - int nameid,i; - char *str[32],*p,*np; - - if(line[0] == '/' && line[1] == '/') - continue; - - for(i=0,p=line;i<20;i++){ - if((np=strchr(p,','))!=NULL){ - str[i]=p; - *np=0; - p=np+1; - } else { - str[i]=p; - p+=strlen(p); - } - } - - nameid=atoi(str[0]); - if(nameid<=0 || nameid>2000) - continue; - - //MobID,Name,JName,ItemID,EggID,AcceID,FoodID,"Fullness (1回の餌での満腹度増加率%)","HungryDeray (/min)","R_Hungry (空腹時餌やり親密度増加率%)","R_Full (とても満腹時餌やり親密度減少率%)","Intimate (捕獲時親密度%)","Die (死亡時親密度減少率%)","Capture (捕獲率%)",(Name) - pet_db[j].class = nameid; - memcpy(pet_db[j].name,str[1],24); - memcpy(pet_db[j].jname,str[2],24); - pet_db[j].itemID=atoi(str[3]); - pet_db[j].EggID=atoi(str[4]); - pet_db[j].AcceID=atoi(str[5]); - pet_db[j].FoodID=atoi(str[6]); - pet_db[j].fullness=atoi(str[7]); - pet_db[j].hungry_delay=atoi(str[8])*1000; - pet_db[j].r_hungry=atoi(str[9]); - if(pet_db[j].r_hungry <= 0) - pet_db[j].r_hungry=1; - pet_db[j].r_full=atoi(str[10]); - pet_db[j].intimate=atoi(str[11]); - pet_db[j].die=atoi(str[12]); - pet_db[j].capture=atoi(str[13]); - pet_db[j].speed=atoi(str[14]); - pet_db[j].s_perfor=(char)atoi(str[15]); - pet_db[j].talk_convert_class=atoi(str[16]); - pet_db[j].attack_rate=atoi(str[17]); - pet_db[j].defence_attack_rate=atoi(str[18]); - pet_db[j].change_target_rate=atoi(str[19]); - pet_db[j].script = NULL; - if((np=strchr(p,'{'))==NULL) - continue; - pet_db[j].script = parse_script(np,0); - j++; - } - fclose(fp); - printf("read %s done (count=%d)\n",filename[i],j); - } - return 0; -} - -/*========================================== - * スキル関係初期化処理 - *------------------------------------------ - */ -int do_init_pet(void) -{ - read_petdb(); - - add_timer_func_list(pet_timer,"pet_timer"); - add_timer_func_list(pet_hungry,"pet_hungry"); - add_timer_func_list(pet_ai_hard,"pet_ai_hard"); - add_timer_func_list(pet_skill_bonus_timer,"pet_skill_bonus_timer"); // [Valaris] - add_timer_func_list(pet_skill_bonus_duration,"pet_skill_bonus_duration"); // [Valaris] - add_timer_func_list(pet_recovery_timer,"pet_recovery_timer"); // [Valaris] - add_timer_func_list(pet_mag_timer,"pet_mag_timer"); // [Valaris] - add_timer_func_list(pet_heal_timer,"pet_heal_timer"); // [Valaris] - add_timer_func_list(pet_skillattack_timer,"pet_skillattack_timer"); // [Valaris] - add_timer_interval(gettick()+MIN_PETTHINKTIME,pet_ai_hard,0,0,MIN_PETTHINKTIME); - - return 0; -} - diff --git a/src/map/pet.h b/src/map/pet.h deleted file mode 100644 index 365a449..0000000 --- a/src/map/pet.h +++ /dev/null @@ -1,69 +0,0 @@ -// $Id: pet.h,v 1.2 2004/09/25 05:32:18 MouseJstr Exp $ -#ifndef _PET_H_ -#define _PET_H_ - -#define MAX_PET_DB 100 -#define PETLOOT_SIZE 20 // [Valaris] - -struct pet_db { - int class; - char name[24],jname[24]; - int itemID; - int EggID; - int AcceID; - int FoodID; - int fullness; - int hungry_delay; - int r_hungry; - int r_full; - int intimate; - int die; - int capture; - int speed; - char s_perfor; - int talk_convert_class; - int attack_rate; - int defence_attack_rate; - int change_target_rate; - char *script; -}; -extern struct pet_db pet_db[MAX_PET_DB]; - -enum { PET_CLASS,PET_CATCH,PET_EGG,PET_EQUIP,PET_FOOD }; - -int pet_hungry_val(struct map_session_data *sd); -int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type); -int pet_stopattack(struct pet_data *pd); -int pet_changestate(struct pet_data *pd,int state,int type); -int pet_walktoxy(struct pet_data *pd,int x,int y); -int pet_stop_walking(struct pet_data *pd,int type); -int search_petDB_index(int key,int type); -int pet_hungry_timer_delete(struct map_session_data *sd); -int pet_remove_map(struct map_session_data *sd); -int pet_data_init(struct map_session_data *sd); -int pet_birth_process(struct map_session_data *sd); -int pet_recv_petdata(int account_id,struct s_pet *p,int flag); -int pet_select_egg(struct map_session_data *sd,short egg_index); -int pet_catch_process1(struct map_session_data *sd,int target_class); -int pet_catch_process2(struct map_session_data *sd,int target_id); -int pet_get_egg(int account_id,int pet_id,int flag); -int pet_menu(struct map_session_data *sd,int menunum); -int pet_change_name(struct map_session_data *sd,char *name); -int pet_equipitem(struct map_session_data *sd,int index); -int pet_unequipitem(struct map_session_data *sd); -int pet_food(struct map_session_data *sd); -int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd); -int pet_delay_item_drop2(int tid,unsigned int tick,int id,int data); -int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap); -int pet_skill_bonus(struct map_session_data *sd,struct pet_data *pd,int type,int val,int duration,int timer,int data); -int pet_skill_bonus_timer(int tid,unsigned int tick,int id,int data); // [Valaris] -int pet_skill_bonus_duration(int tid,unsigned int tick,int id,int data); // [Valaris] -int pet_recovery_timer(int tid,unsigned int tick,int id,int data); // [Valaris] -int pet_mag_timer(int tid,unsigned int tick,int id,int data); // [Valaris] -int pet_heal_timer(int tid,unsigned int tick,int id,int data); // [Valaris] -int pet_skillattack_timer(int tid,unsigned int tick,int id,int data); // [Valaris] - -int do_init_pet(void); - -#endif - diff --git a/src/map/script.c b/src/map/script.c index 19557c7..ae7bd8f 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -19,25 +19,23 @@ #include "malloc.h" #include "lock.h" -#include "map.h" -#include "clif.h" +#include "atcommand.h" +#include "battle.h" +#include "chat.h" #include "chrif.h" +#include "clif.h" +#include "db.h" +#include "intif.h" #include "itemdb.h" -#include "pc.h" -#include "script.h" -#include "storage.h" +#include "lock.h" +#include "map.h" #include "mob.h" #include "npc.h" -#include "pet.h" -#include "intif.h" -#include "db.h" -#include "skill.h" -#include "chat.h" -#include "battle.h" #include "party.h" -#include "guild.h" -#include "lock.h" -#include "atcommand.h" +#include "pc.h" +#include "script.h" +#include "skill.h" +#include "storage.h" #ifdef MEMWATCH #include "memwatch.h" @@ -211,8 +209,6 @@ int buildin_sc_start2(struct script_state *st); int buildin_sc_end(struct script_state *st); int buildin_getscrate(struct script_state *st); int buildin_debugmes(struct script_state *st); -int buildin_catchpet(struct script_state *st); -int buildin_birthpet(struct script_state *st); int buildin_resetlvl(struct script_state *st); int buildin_resetstatus(struct script_state *st); int buildin_resetskill(struct script_state *st); @@ -253,7 +249,6 @@ int buildin_divorce(struct script_state *st); int buildin_getitemname(struct script_state *st); int buildin_getspellinvocation(struct script_state *st); // [Fate] int buildin_getanchorinvocation(struct script_state *st); // [Fate] -int buildin_makepet(struct script_state *st); int buildin_getexp(struct script_state *st); int buildin_getinventorylist(struct script_state *st); int buildin_getskilllist(struct script_state *st); @@ -270,12 +265,6 @@ int buildin_mobcount(struct script_state *st); int buildin_strmobinfo(struct script_state *st); // Script for displaying mob info [Valaris] int buildin_guardian(struct script_state *st); // Script for displaying mob info [Valaris] int buildin_guardianinfo(struct script_state *st); // Script for displaying mob info [Valaris] -int buildin_petskillbonus(struct script_state *st); // petskillbonus [Valaris] -int buildin_petrecovery(struct script_state *st); // pet skill for curing status [Valaris] -int buildin_petloot(struct script_state *st); // pet looting [Valaris] -int buildin_petheal(struct script_state *st); // pet healing [Valaris] -int buildin_petmag(struct script_state *st); // pet magnificat [Valaris] -int buildin_petskillattack(struct script_state *st); // pet skill attacks [Valaris] int buildin_npcskilleffect(struct script_state *st); // skill effects for npcs [Valaris] int buildin_specialeffect(struct script_state *st); // special effect script [Valaris] int buildin_specialeffect2(struct script_state *st); // special effect script [Valaris] @@ -422,8 +411,6 @@ struct { {buildin_sc_end,"sc_end","i"}, {buildin_getscrate,"getscrate","ii*"}, {buildin_debugmes,"debugmes","s"}, - {buildin_catchpet,"pet","i"}, - {buildin_birthpet,"bpet",""}, {buildin_resetlvl,"resetlvl","i"}, {buildin_resetstatus,"resetstatus",""}, {buildin_resetskill,"resetskill",""}, @@ -466,7 +453,6 @@ struct { {buildin_getspellinvocation,"getspellinvocation","s"}, {buildin_getanchorinvocation,"getanchorinvocation","s"}, {buildin_getpartnerid,"getpartnerid2","i"}, - {buildin_makepet,"makepet","i"}, {buildin_getexp,"getexp","ii"}, {buildin_getinventorylist,"getinventorylist",""}, {buildin_getskilllist,"getskilllist",""}, @@ -477,12 +463,6 @@ struct { {buildin_strmobinfo,"strmobinfo","ii"}, // display mob data [Valaris] {buildin_guardian,"guardian","siisii*i"}, // summon guardians {buildin_guardianinfo,"guardianinfo","i"}, // display guardian data [Valaris] - {buildin_petskillbonus,"petskillbonus","iiii"}, // [Valaris] - {buildin_petrecovery,"petrecovery","ii"}, // [Valaris] - {buildin_petloot,"petloot","i"}, // [Valaris] - {buildin_petheal,"petheal","iii"}, // [Valaris] - {buildin_petmag,"petmag","iiii"}, // [Valaris] - {buildin_petskillattack,"petskillattack","iiii"}, // [Valaris] {buildin_npcskilleffect,"npcskilleffect","iiii"}, // npc skill effect [Valaris] {buildin_specialeffect,"specialeffect","i"}, // npc skill effect [Valaris] {buildin_specialeffect2,"specialeffect2","i"}, // skill effect on players[Valaris] @@ -2531,14 +2511,6 @@ int buildin_delitem(struct script_state *st) sd->inventory_data[i]->type!=7 || sd->status.inventory[i].amount<=0) continue; - if(sd->status.inventory[i].nameid == nameid){ - if(sd->status.inventory[i].card[0] == (short)0xff00){ - if(search_petDB_index(nameid, PET_EGG) >= 0){ - intif_delete_petdata(*((long *)(&sd->status.inventory[i].card[1]))); - break; - } - } - } } for(i=0;istatus.inventory[i].nameid==nameid){ @@ -3586,36 +3558,7 @@ int buildin_itemskill(struct script_state *st) clif_item_skill(sd,id,lv,str); return 0; } -/*========================================== - * NPCでペット作る - *------------------------------------------ - */ -int buildin_makepet(struct script_state *st) -{ - struct map_session_data *sd = script_rid2sd(st); - struct script_data *data; - int id,pet_id; - - data=&(st->stack->stack_data[st->start+2]); - get_val(st,data); - - id=conv_num(st,data); - - pet_id = search_petDB_index(id, PET_CLASS); - - if (pet_id < 0) - pet_id = search_petDB_index(id, PET_EGG); - if (pet_id >= 0 && sd) { - 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); - } - return 0; -} /*========================================== * NPCで経験値上げる *------------------------------------------ @@ -4240,32 +4183,6 @@ int buildin_debugmes(struct script_state *st) return 0; } -/*========================================== - *捕獲アイテム使用 - *------------------------------------------ - */ -int buildin_catchpet(struct script_state *st) -{ - int pet_id; - struct map_session_data *sd; - pet_id= conv_num(st,& (st->stack->stack_data[st->start+2])); - sd=script_rid2sd(st); - pet_catch_process1(sd,pet_id); - return 0; -} - -/*========================================== - *携帯卵孵化機使用 - *------------------------------------------ - */ -int buildin_birthpet(struct script_state *st) -{ - struct map_session_data *sd; - sd=script_rid2sd(st); - clif_sendegg(sd); - return 0; -} - /*========================================== * Added - AppleGirl For Advanced Classes, (Updated for Cleaner Script Purposes) *------------------------------------------ @@ -5500,68 +5417,6 @@ int buildin_getpartnerid(struct script_state *st) return 0; } - -/*========================================== - * petskillbonus [Valaris] - *------------------------------------------ - */ - -int buildin_petskillbonus(struct script_state *st) -{ - int type,val,duration,timer; - struct pet_data *pd; - - struct map_session_data *sd=script_rid2sd(st); - - if(sd==NULL || sd->pd==NULL) - return 0; - - pd=sd->pd; - - if(pd==NULL) - return 0; - - type=conv_num(st,& (st->stack->stack_data[st->start+2])); - val=conv_num(st,& (st->stack->stack_data[st->start+3])); - duration=conv_num(st,& (st->stack->stack_data[st->start+4])); - timer=conv_num(st,& (st->stack->stack_data[st->start+5])); - - pd->skillbonusduration=-1; - pd->skillbonustimer=-1; - - pet_skill_bonus(sd,pd,type,val,duration,timer,0); - - return 0; -} - -/*========================================== - * pet looting [Valaris] - *------------------------------------------ - */ -int buildin_petloot(struct script_state *st) -{ - int max; - struct pet_data *pd; - - struct map_session_data *sd=script_rid2sd(st); - if(sd==NULL || sd->pd==NULL) - return 0; - - pd=sd->pd; - - if(pd==NULL) - return 0; - - max=conv_num(st,& (st->stack->stack_data[st->start+2])); - - if(!max) - return 0; - - pd->loot=1; - pd->lootmax=max; - - return 0; -} /*========================================== * PCの所持品情報読み取り *------------------------------------------ @@ -5678,112 +5533,7 @@ int buildin_soundeffect(struct script_state *st) } return 0; } -/*========================================== - * pet status recovery [Valaris] - *------------------------------------------ - */ -int buildin_petrecovery(struct script_state *st) -{ - struct pet_data *pd; - - struct map_session_data *sd=script_rid2sd(st); - - if(sd==NULL || sd->pd==NULL) - return 0; - - pd=sd->pd; - - if(pd==NULL) - return 0; - - pd->skilltype=conv_num(st,& (st->stack->stack_data[st->start+2])); - pd->skilltimer=conv_num(st,& (st->stack->stack_data[st->start+3])); - - pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_recovery_timer,sd->bl.id,0); - - return 0; -} - -/*========================================== - * pet healing [Valaris] - *------------------------------------------ - */ -int buildin_petheal(struct script_state *st) - -{ - struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); - if(sd==NULL || sd->pd==NULL) - return 0; - - pd=sd->pd; - - if(pd==NULL) - return 0; - - pd->skilltype=conv_num(st,& (st->stack->stack_data[st->start+2])); - pd->skillval=conv_num(st,& (st->stack->stack_data[st->start+3])); - pd->skilltimer=conv_num(st,& (st->stack->stack_data[st->start+4])); - - pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_heal_timer,sd->bl.id,0); - - return 0; -} - -/*========================================== - * pet magnificat [Valaris] - *------------------------------------------ - */ -int buildin_petmag(struct script_state *st) -{ - struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); - - if(sd==NULL || sd->pd==NULL) - return 0; - - pd=sd->pd; - - if(pd==NULL) - return 0; - - pd->skilltype=conv_num(st,& (st->stack->stack_data[st->start+2])); - pd->skillduration=conv_num(st,& (st->stack->stack_data[st->start+3])); - pd->skillval=conv_num(st,& (st->stack->stack_data[st->start+4])); - pd->skilltimer=conv_num(st,& (st->stack->stack_data[st->start+5])); - - pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_mag_timer,sd->bl.id,0); - - return 0; -} - -/*========================================== - * pet attack skills [Valaris] - *------------------------------------------ - */ -int buildin_petskillattack(struct script_state *st) -{ - struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); - - if(sd==NULL || sd->pd==NULL) - return 0; - - pd=sd->pd; - - if(pd==NULL) - return 0; - - pd->skilltype=conv_num(st,& (st->stack->stack_data[st->start+2])); - pd->skillval=conv_num(st,& (st->stack->stack_data[st->start+3])); - pd->skillduration=conv_num(st,& (st->stack->stack_data[st->start+4])); - pd->skilltimer=conv_num(st,& (st->stack->stack_data[st->start+5])); - - pd->skillbonustimer=add_timer(gettick()+100,pet_skillattack_timer,sd->bl.id,0); - - return 0; -} /*========================================== * NPC skill effects [Valaris] *------------------------------------------ diff --git a/src/map/skill.c b/src/map/skill.c index e04a7b7..4e5f9de 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -11,17 +11,16 @@ #include "malloc.h" #include "magic.h" -#include "skill.h" -#include "map.h" +#include "battle.h" #include "clif.h" -#include "pc.h" -#include "pet.h" +#include "intif.h" +#include "itemdb.h" +#include "map.h" #include "mob.h" -#include "battle.h" #include "party.h" -#include "itemdb.h" +#include "pc.h" #include "script.h" -#include "intif.h" +#include "skill.h" #ifdef MEMWATCH #include "memwatch.h" @@ -442,7 +441,6 @@ struct skill_name_db skill_names[] = { { MC_MAMMONITE, "MAMMONITE", "Mammonite" } , { MC_OVERCHARGE, "OVERCHARGE", "Overcharge" } , { MC_PUSHCART, "PUSHCART", "Pushcart" } , - { MC_VENDING, "VENDING", "Vending" } , { MG_COLDBOLT, "COLDBOLT", "Cold_Bolt" } , { MG_ENERGYCOAT, "ENERGYCOAT", "Energy_Coat" } , { MG_FIREBALL, "FIREBALL", "Fire_Ball" } , @@ -508,7 +506,6 @@ struct skill_name_db skill_names[] = { { NPC_PIERCINGATT, "PIERCINGATT", "NPC_PIERCINGATT" } , { NPC_POISON, "POISON", "NPC_POISON" } , { NPC_POISONATTACK, "POISONATTACK", "NPC_POISONATTACK" } , - { NPC_PROVOCATION, "PROVOCATION", "NPC_PROVOCATION" } , { NPC_RANDOMATTACK, "RANDOMATTACK", "NPC_RANDOMATTACK" } , { NPC_RANGEATTACK, "RANGEATTACK", "NPC_RANGEATTACK" } , { NPC_REBIRTH, "REBIRTH", "NPC_REBIRTH" } , @@ -597,7 +594,6 @@ struct skill_name_db skill_names[] = { { SA_SEISMICWEAPON, "SEISMICWEAPON", "Seismic_Weapon" } , { SA_SPELLBREAKER, "SPELLBREAKER", "Break_Spell" } , { SA_SUMMONMONSTER, "SUMMONMONSTER", "Summon_Monster" } , - { SA_TAMINGMONSTER, "TAMINGMONSTER", "Taming_Monster" } , { SA_VIOLENTGALE, "VIOLENTGALE", "Violent_Gale" } , { SA_VOLCANO, "VOLCANO", "Volcano" } , { SG_DEVIL, "DEVIL", "Devil" } , @@ -766,7 +762,6 @@ static int skillnotok(int skillid, struct map_session_data *sd) { switch (skillid) { case AL_WARP: case AL_TELEPORT: - case MC_VENDING: case MC_IDENTIFY: return 0; // always allowed default: @@ -888,7 +883,6 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s struct map_session_data *dstsd=NULL; struct mob_data *md=NULL; struct mob_data *dstmd=NULL; - struct pet_data *pd=NULL; int skill,skill2; int rate,luk; @@ -905,8 +899,6 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s nullpo_retr(0, sd=(struct map_session_data *)src); }else if(src->type==BL_MOB){ nullpo_retr(0, md=(struct mob_data *)src); //未使用? - }else if(src->type==BL_PET){ - nullpo_retr(0, pd=(struct pet_data *)src); // [Valaris] } //対象の耐性 @@ -1082,10 +1074,8 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s case NPC_POISON: case NPC_SILENCEATTACK: case NPC_STUNATTACK: - if(rand()%100 < sc_def_vit && src->type!=BL_PET) + if(rand()%100 < sc_def_vit) skill_status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); - if(src->type==BL_PET) - skill_status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skilllv*1000,0); break; case NPC_CURSEATTACK: if(rand()%100 < sc_def_luk) @@ -1236,7 +1226,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) int moveblock; struct map_session_data *sd=NULL; struct mob_data *md=NULL; - struct pet_data *pd=NULL; struct skill_unit *su=NULL; nullpo_retr(0, src); @@ -1246,13 +1235,11 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) nullpo_retr(0, sd=(struct map_session_data *)target); }else if(target->type==BL_MOB){ nullpo_retr(0, md=(struct mob_data *)target); - }else if(target->type==BL_PET){ - nullpo_retr(0, pd=(struct pet_data *)target); }else if(target->type==BL_SKILL){ nullpo_retr(0, su=(struct skill_unit *)target); }else return 0; - if(!(count&0x10000 && (sd||md||pd||su))){ /* 指定なしなら位置関係から方向を求める */ + if(!(count&0x10000 && (sd||md||su))){ /* 指定なしなら位置関係から方向を求める */ dx=target->x-src->x; dx=(dx>0)?1:((dx<0)?-1: 0); dy=target->y-src->y; dy=(dy>0)?1:((dy<0)?-1: 0); } @@ -1285,13 +1272,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) md->state.state = MS_WALK; clif_fixmobpos(md); } - else if(pd) { - pd->to_x=nx; - pd->to_y=ny; - prev_state = pd->state.state; - pd->state.state = MS_WALK; - clif_fixpetpos(pd); - } } else battle_stopwalking(target,2); @@ -1303,8 +1283,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) map_foreachinmovearea(clif_pcoutsight,target->m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,0,sd); else if(md) map_foreachinmovearea(clif_moboutsight,target->m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,BL_PC,md); - else if(pd) - map_foreachinmovearea(clif_petoutsight,target->m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,BL_PC,pd); if(su){ skill_unit_move_unit_group(su->group,target->m,dx,dy); @@ -1333,11 +1311,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) if(count&0x20000) md->state.state = prev_state; } - else if(pd) { - map_foreachinmovearea(clif_petinsight,target->m,nx-AREA_SIZE,ny-AREA_SIZE,nx+AREA_SIZE,ny+AREA_SIZE,-dx,-dy,BL_PC,pd); - if(count&0x20000) - pd->state.state = prev_state; - } skill_unit_move(target,gettick(),(count&0xffff)+7); /* スキルユニットの判定 */ @@ -1432,11 +1405,6 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds } //マジックロッド処理ここまで - if(src->type==BL_PET) { // [Valaris] - dmg.damage=battle_attr_fix(skilllv, skill_get_pl(skillid), battle_get_element(bl) ); - dmg.damage2=0; - } - damage = dmg.damage + dmg.damage2; if(lv==15) @@ -1578,8 +1546,6 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds skill_blown(dsrc,bl,dmg.blewcount); if(bl->type == BL_MOB) clif_fixmobpos((struct mob_data *)bl); - else if(bl->type == BL_PET) - clif_fixpetpos((struct pet_data *)bl); else clif_fixpos(bl); } @@ -1838,7 +1804,6 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data ) { struct map_session_data *sd = NULL; struct mob_data *md = NULL; - struct pet_data *pd = NULL; struct block_list *src = map_id2bl(id),*target; struct skill_timerskill *skl = NULL; int range; @@ -1856,10 +1821,6 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data ) nullpo_retr(0, md = (struct mob_data *)src); skl = &md->skilltimerskill[data]; } - else if(src->type == BL_PET) { // [Valaris] - nullpo_retr(0, pd = (struct pet_data *)src); - skl = &pd->skilltimerskill[data]; - } else return 0; @@ -2020,27 +1981,7 @@ int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int } return 1; } - else if(src->type == BL_PET) { // [Valaris] - struct pet_data *pd = (struct pet_data *)src; - nullpo_retr(1, pd); - for(i=0;iskilltimerskill[i].timer == -1) { - pd->skilltimerskill[i].timer = add_timer(tick, skill_timerskill, src->id, i); - pd->skilltimerskill[i].src_id = src->id; - pd->skilltimerskill[i].target_id = target; - pd->skilltimerskill[i].skill_id = skill_id; - pd->skilltimerskill[i].skill_lv = skill_lv; - pd->skilltimerskill[i].map = src->m; - pd->skilltimerskill[i].x = x; - pd->skilltimerskill[i].y = y; - pd->skilltimerskill[i].type = type; - pd->skilltimerskill[i].flag = flag; - return 0; - } - } - return 1; - } return 1; } @@ -2193,8 +2134,6 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s skill_blown(src,bl,skill_get_blewcount(skillid,skilllv)); if(bl->type == BL_MOB) clif_fixmobpos((struct mob_data *)bl); - else if(bl->type == BL_PET) - clif_fixpetpos((struct pet_data *)bl); else clif_fixpos(bl); } @@ -2359,8 +2298,6 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s skill_blown(src,bl,1); if(bl->type == BL_MOB) clif_fixmobpos((struct mob_data *)bl); - else if(bl->type == BL_PET) - clif_fixpetpos((struct pet_data *)bl); else clif_fixpos(bl); skill_area_temp[0]=0; @@ -2848,17 +2785,6 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_nodamage(src,bl,skillid,skilllv,1); if(sd) pc_getzeny(sd,battle_get_lv(bl)*100); break; - case SA_TAMINGMONSTER: - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if (dstmd){ - for(i=0;iclass == pet_db[i].class){ - pet_catch_process1(sd,dstmd->class); - break; - } - } - } - break; case AL_INCAGI: /* 速度増加 */ case AL_BLESSING: /* ブレッシング */ case PR_SLOWPOISON: @@ -3458,11 +3384,6 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int // clif_item_repair_list(sd); break; - case MC_VENDING: /* 露店開設 */ - if(sd) - clif_openvendingreq(sd,2+sd->skilllv); - break; - case AL_TELEPORT: /* テレポート */ if( sd ){ if(map[sd->bl.m].flag.noteleport){ /* テレポ禁止 */ @@ -3737,8 +3658,6 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skill_blown(src,bl,skill_get_blewcount(skillid,skilllv)|0x10000); if(src->type == BL_MOB) clif_fixmobpos((struct mob_data *)src); - else if(src->type == BL_PET) - clif_fixpetpos((struct pet_data *)src); else if(src->type == BL_PC) clif_fixpos(src); skill_addtimerskill(src,tick + 200,src->id,0,0,skillid,skilllv,0,flag); @@ -3877,12 +3796,6 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } break; - case NPC_PROVOCATION: - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(md) - clif_pet_performance(src,mob_db[md->class].skill[md->skillidx].val[0]); - break; - case NPC_HALLUCINATION: clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) @@ -5309,8 +5222,6 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int if(moveblock) map_addblock(bl); if(bl->type == BL_MOB) clif_fixmobpos((struct mob_data *)bl); - else if(bl->type == BL_PET) - clif_fixpetpos((struct pet_data *)bl); else clif_fixpos(bl); clif_01ac(&src->bl); @@ -5464,8 +5375,6 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int if(moveblock) map_addblock(bl); if(bl->type == BL_MOB) clif_fixmobpos((struct mob_data *)bl); - else if(bl->type == BL_PET) - clif_fixpetpos((struct pet_data *)bl); else clif_fixpos(bl); clif_01ac(&src->bl); @@ -9275,9 +9184,6 @@ struct skill_unit_group *skill_initunitgroup(struct block_list *src, }else if(src->type==BL_MOB){ list=((struct mob_data *)src)->skillunit; maxsug=MAX_MOBSKILLUNITGROUP; - }else if(src->type==BL_PET){ - list=((struct pet_data *)src)->skillunit; - maxsug=MAX_MOBSKILLUNITGROUP; } if(list){ for(i=0;itype==BL_MOB){ group=((struct mob_data *)src)->skillunit; maxsug=MAX_MOBSKILLUNITGROUP; - }else if(src->type==BL_PET){ // [Valaris] - group=((struct pet_data *)src)->skillunit; - maxsug=MAX_MOBSKILLUNITGROUP; } if(group){ int i; diff --git a/src/map/vending.c b/src/map/vending.c deleted file mode 100644 index 189584d..0000000 --- a/src/map/vending.c +++ /dev/null @@ -1,163 +0,0 @@ -// $Id: vending.c,v 1.2 2004/09/25 05:32:19 MouseJstr Exp $ -#include -#include - -#include "clif.h" -#include "itemdb.h" -#include "map.h" -#include "vending.h" -#include "pc.h" -#include "skill.h" -#include "battle.h" -#include "nullpo.h" - -/*========================================== - * 露店閉鎖 - *------------------------------------------ -*/ -void vending_closevending(struct map_session_data *sd) -{ - - nullpo_retv(sd); - - sd->vender_id=0; - clif_closevendingboard(&sd->bl,0); -} - -/*========================================== - * 露店アイテムリスト要求 - *------------------------------------------ - */ -void vending_vendinglistreq(struct map_session_data *sd,int id) -{ - struct map_session_data *vsd; - - nullpo_retv(sd); - - if( (vsd=map_id2sd(id)) == NULL ) - return; - if(vsd->vender_id==0) - return; - clif_vendinglist(sd,id,vsd->vending); -} - -/*========================================== - * 露店アイテム購入 - *------------------------------------------ - */ -void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned char *p) -{ - int i,j,w,z,new=0,blank,vend_list[12]; - short amount,index; - struct map_session_data *vsd=map_id2sd(id); - - nullpo_retv(sd); - - blank=pc_inventoryblank(sd); - - if(vsd==NULL) - return; - if(vsd->vender_id==0) - return; - if(vsd->vender_id==sd->bl.id) - return; - for(i=0,w=z=0;8+4*ivend_num;j++) - if(0vending[j].amount && amount<=vsd->vending[j].amount && vsd->vending[j].index==index) - break; -*/ -//ADD_start - for(j=0;j < vsd->vend_num;j++) { - if(0 < vsd->vending[j].amount && vsd->vending[j].index==index) { - if(amount > vsd->vending[j].amount || amount <= 0) { - clif_buyvending(sd,index,vsd->vending[j].amount,4); - return; - } - if(amount <= vsd->vending[j].amount) break; - } - } -//ADD_end - if(j==vsd->vend_num) - return; // 売り切れ - vend_list[i]=j; - z+=vsd->vending[j].value*amount; - if(z > sd->status.zeny){ - clif_buyvending(sd,index,amount,1); - return; // zeny不足 - } - w+=itemdb_weight(vsd->status.cart[index].nameid)*amount; - if(w+sd->weight > sd->max_weight){ - clif_buyvending(sd,index,amount,2); - return; // 重量超過 - } - switch(pc_checkadditem(sd,vsd->status.cart[index].nameid,amount)){ - case ADDITEM_EXIST: - break; - case ADDITEM_NEW: - new++; - if(new > blank) - return; // 種類数超過 - break; - case ADDITEM_OVERAMOUNT: - return; // アイテム数超過 - } - } - if(z < 0 || z > MAX_ZENY){ //Zeny Bug Fixed by Darkchild - clif_tradecancelled(sd); - clif_tradecancelled(vsd); - return; - } - pc_payzeny(sd,z); - pc_getzeny(vsd,z); - for(i=0;8+4*istatus.cart[index],amount); - vsd->vending[vend_list[i]].amount-=amount; - pc_cart_delitem(vsd,index,amount,0); - clif_vendingreport(vsd,index,amount); - } -} - -/*========================================== - * 露店開設 - *------------------------------------------ - */ -void vending_openvending(struct map_session_data *sd,int len,char *message,int flag,unsigned char *p) -{ - int i; - - nullpo_retv(sd); - - if(!pc_checkskill(sd,MC_VENDING) || !pc_iscarton(sd)) { // cart skill and cart check [Valaris] - clif_skill_fail(sd,MC_VENDING,0,0); - return; - } - - if(flag){ - for(i=0;85+8*ivending[i].index=*(short*)(p+8*i)-2; - sd->vending[i].amount=*(short*)(p+2+8*i); - sd->vending[i].value=*(int*)(p+4+8*i); - if(sd->vending[i].value>battle_config.vending_max_value)sd->vending[i].value=battle_config.vending_max_value; - // カート内のアイテム数と販売するアイテム数に相違があったら中止 - if(pc_cartitem_amount(sd,sd->vending[i].index,sd->vending[i].amount)<0 || sd->vending[i].value < 0) { // fixes by Valaris and fritz - clif_skill_fail(sd,MC_VENDING,0,0); - return; - } - } - sd->vender_id=sd->bl.id; - sd->vend_num=i; - strcpy(sd->message,message); - if(clif_openvending(sd,sd->vender_id,sd->vending) > 0) - clif_showvendingboard(&sd->bl,message,0); - else - sd->vender_id=0; - } -} - diff --git a/src/map/vending.h b/src/map/vending.h deleted file mode 100644 index 41aa731..0000000 --- a/src/map/vending.h +++ /dev/null @@ -1,12 +0,0 @@ -// $Id: vending.h,v 1.2 2004/09/25 05:32:19 MouseJstr Exp $ -#ifndef _VENDING_H_ -#define _VENDING_H_ - -#include "map.h" - -void vending_closevending(struct map_session_data *sd); -void vending_openvending(struct map_session_data *sd,int len,char *message,int flag,unsigned char *p); -void vending_vendinglistreq(struct map_session_data *sd,int id); -void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned char *p); - -#endif // _VENDING_H_ -- cgit v1.2.3-60-g2f50