Browse Source

Merge branch 'master' into hotfix/issue2173

aleos89 7 years ago
parent
commit
6d9b175a21
100 changed files with 4098 additions and 1707 deletions
  1. 1 0
      3rdparty/CMakeLists.txt
  2. 54 0
      3rdparty/cmake/GetGitVersion.cmake
  3. 44 0
      3rdparty/cmake/GetSvnVersion.cmake
  4. 8 3
      3rdparty/libconfig/grammar.h
  5. 2 0
      3rdparty/libconfig/libconfig.h
  6. 2 0
      3rdparty/libconfig/parsectx.h
  7. 10 0
      3rdparty/libconfig/scanctx.h
  8. 2 0
      3rdparty/libconfig/scanner.h
  9. 10 0
      3rdparty/libconfig/strbuf.h
  10. 2 0
      3rdparty/libconfig/wincompat.h
  11. 10 0
      3rdparty/mt19937ar/mt19937ar.h
  12. 83 0
      3rdparty/yaml-cpp/CMakeLists.txt
  13. 35 55
      CMakeLists.txt
  14. 5 4
      conf/battle/items.conf
  15. 1 1
      conf/char_athena.conf
  16. 1 1
      conf/msg_conf/map_msg.conf
  17. 1 1
      conf/msg_conf/map_msg_chn.conf
  18. 1 1
      conf/msg_conf/map_msg_frn.conf
  19. 1 1
      conf/msg_conf/map_msg_idn.conf
  20. 1 1
      conf/msg_conf/map_msg_por.conf
  21. 1 1
      conf/msg_conf/map_msg_rus.conf
  22. 1 1
      conf/msg_conf/map_msg_spn.conf
  23. 1 1
      conf/msg_conf/map_msg_tha.conf
  24. 140 548
      configure
  25. 2 1
      configure.in
  26. 1 0
      db/re/instance_db.txt
  27. 4 4
      db/re/item_db.txt
  28. 1 0
      db/re/item_delay.txt
  29. BIN
      db/re/map_cache.dat
  30. 103 15
      db/re/mob_db.txt
  31. 5 0
      db/re/mob_skill_db.txt
  32. 16 10
      db/re/quest_db.txt
  33. 3 98
      npc/custom/jobmaster.txt
  34. 8 95
      npc/custom/platinum_skills.txt
  35. 96 6
      npc/other/Global_Functions.txt
  36. 3 3
      npc/other/arena/arena_point.txt
  37. 2 2
      npc/other/arena/arena_room.txt
  38. 1 1
      npc/other/turbo_track.txt
  39. 2322 0
      npc/re/instances/SarahAndFenrir.txt
  40. 351 135
      npc/re/jobs/novice/academy.txt
  41. 1 0
      npc/re/mapflag/nobranch.txt
  42. 1 0
      npc/re/mapflag/noicewall.txt
  43. 1 0
      npc/re/mapflag/nomemo.txt
  44. 1 0
      npc/re/mapflag/nopvp.txt
  45. 1 0
      npc/re/mapflag/nosave.txt
  46. 2 0
      npc/re/mapflag/noteleport.txt
  47. 14 0
      npc/re/mapflag/nowarpto.txt
  48. 1 0
      npc/re/mapflag/partylock.txt
  49. 1 0
      npc/re/mapflag/restricted.txt
  50. 12 0
      npc/re/mobs/int_land.txt
  51. 1 0
      npc/re/scripts_athena.conf
  52. 1 0
      npc/re/scripts_monsters.conf
  53. 57 14
      npc/re/warps/cities/izlude.txt
  54. 3 0
      npc/re/warps/other/dimensional_gap.txt
  55. 4 4
      sql-files/item_db_re.sql
  56. 103 15
      sql-files/mob_db_re.sql
  57. 8 39
      src/char/CMakeLists.txt
  58. 26 7
      src/common/CMakeLists.txt
  59. 2 1
      src/common/cbasetypes.h
  60. 8 0
      src/common/conf.h
  61. 1 1
      src/common/db.c
  62. 12 12
      src/common/db.h
  63. 38 1
      src/common/mmo.h
  64. 9 4
      src/common/msg_conf.h
  65. 6 18
      src/login/CMakeLists.txt
  66. 0 45
      src/login/server/CMakeLists.txt
  67. 5 86
      src/map/CMakeLists.txt
  68. 3 2
      src/map/Makefile.in
  69. 19 16
      src/map/achievement.cpp
  70. 3 11
      src/map/achievement.hpp
  71. 42 34
      src/map/atcommand.cpp
  72. 6 14
      src/map/atcommand.hpp
  73. 32 33
      src/map/battle.cpp
  74. 22 23
      src/map/battle.hpp
  75. 11 8
      src/map/battleground.cpp
  76. 4 12
      src/map/battleground.hpp
  77. 15 11
      src/map/buyingstore.cpp
  78. 7 10
      src/map/buyingstore.hpp
  79. 18 11
      src/map/cashshop.cpp
  80. 8 12
      src/map/cashshop.hpp
  81. 16 10
      src/map/channel.cpp
  82. 11 11
      src/map/channel.hpp
  83. 12 8
      src/map/chat.cpp
  84. 4 12
      src/map/chat.hpp
  85. 29 24
      src/map/chrif.cpp
  86. 7 11
      src/map/chrif.hpp
  87. 11 7
      src/map/clan.cpp
  88. 0 32
      src/map/clan.h
  89. 26 0
      src/map/clan.hpp
  90. 48 50
      src/map/clif.cpp
  91. 35 46
      src/map/clif.hpp
  92. 3 3
      src/map/clif_obfuscation.hpp
  93. 3 3
      src/map/clif_packetdb.hpp
  94. 3 3
      src/map/clif_shuffle.hpp
  95. 2 1
      src/map/date.cpp
  96. 3 10
      src/map/date.hpp
  97. 10 6
      src/map/duel.cpp
  98. 4 9
      src/map/duel.hpp
  99. 19 14
      src/map/elemental.cpp
  100. 8 14
      src/map/elemental.hpp

+ 1 - 0
3rdparty/CMakeLists.txt

@@ -53,3 +53,4 @@ add_subdirectory( mt19937ar )
 add_subdirectory( mysql )
 add_subdirectory( pcre )
 add_subdirectory( zlib )
+add_subdirectory( yaml-cpp )

+ 54 - 0
3rdparty/cmake/GetGitVersion.cmake

@@ -0,0 +1,54 @@
+# - Returns a version string from Git tags
+#
+# This function inspects the annotated git tags for the project and returns a string
+# into a CMake variable
+# higly adapted from https://raw.githubusercontent.com/google/benchmark/master/cmake/GetGitVersion.cmake
+# lighta
+#
+#  get_git_version()
+#
+# - Example
+#
+# include(GetGitVersion)
+# get_git_version(GIT_VERSION)
+# return 
+#     - GIT_VERSION : remote tracking sha of master
+#     - GIT_HEAD_VERSION : current sha of current branch
+#
+# Requires CMake 2.8.11+
+find_package(Git)
+
+if(__get_git_version)
+  return()
+endif()
+set(__get_git_version INCLUDED)
+
+function(get_git_version)
+  if(GIT_EXECUTABLE)
+      #determine remote tracking master sha
+      execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse origin/master
+          RESULT_VARIABLE status
+          OUTPUT_VARIABLE GIT_VERSION
+          ERROR_QUIET)
+      if(${status})
+        set(GIT_VERSION "unknow")
+      else()
+        string(STRIP ${GIT_VERSION} GIT_VERSION)
+      endif()
+    
+      #determine current head sha
+      execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
+          RESULT_VARIABLE status
+          OUTPUT_VARIABLE GIT_HEAD_VERSION
+          ERROR_QUIET)
+      if(${status})
+        set(GIT_HEAD_VERSION "unknow")
+      else()
+        string(STRIP ${GIT_HEAD_VERSION} GIT_HEAD_VERSION)
+      endif()   
+
+  endif()
+  message("-- git Version: ${GIT_VERSION}, ${GIT_HEAD_VERSION}")
+  set(GIT_VERSION ${GIT_VERSION} PARENT_SCOPE)
+  set(GIT_HEAD_VERSION ${GIT_HEAD_VERSION} PARENT_SCOPE)
+endfunction()

+ 44 - 0
3rdparty/cmake/GetSvnVersion.cmake

@@ -0,0 +1,44 @@
+#
+# Find svnversion
+#
+function(get_svn_version)
+  message( STATUS "Detecting svnversion" )
+  find_program( SVNVERSION_EXECUTABLE svnversion )
+  mark_as_advanced( SVNVERSION_EXECUTABLE )
+  if( SVNVERSION_EXECUTABLE )
+    message( STATUS "Found svnversion: ${SVNVERSION_EXECUTABLE}" )
+  endif()
+  message( STATUS "Detecting svnversion - done" )
+  #
+  # Find Subversion
+  #
+  message( STATUS "Detecting Subversion" )
+  find_package( Subversion )
+  message( STATUS "Detecting Subversion - done" )
+  #
+  # SVNVERSION
+  #
+  if( SVNVERSION_EXECUTABLE )
+    message( STATUS "Getting svn version" )
+    execute_process( COMMAND ${SVNVERSION_EXECUTABLE} ${PROJECT_SOURCE_DIR}
+      OUTPUT_VARIABLE SVNVERSION
+      OUTPUT_STRIP_TRAILING_WHITESPACE )
+    if( SVNVERSION MATCHES "^Unversioned" )
+      set( SVNVERSION )
+    endif()
+    string( REGEX REPLACE "[^1234567890MSexported]" "_" SVNVERSION "${SVNVERSION}" )
+    message( STATUS "Found SVNversion: ${SVNVERSION}" )
+    message( STATUS "Getting svn version - done" )
+  endif()
+  if( Subversion_FOUND AND SVNVERSION )
+    message( STATUS "Getting svn branch" )
+    Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} rAthena )
+    if( rAthena_WC_URL )
+      string( REGEX MATCH "[^/]+$" BRANCH ${rAthena_WC_URL} )
+      set( SVNVERSION "${BRANCH}-${SVNVERSION}" )
+      message( STATUS "Found branch: ${BRANCH}" )
+    endif()
+    message( STATUS "Getting svn branch - done" )
+  endif()
+  set(SVNVERSION ${SVNVERSION} PARENT_SCOPE)
+endfunction()

+ 8 - 3
3rdparty/libconfig/grammar.h

@@ -1,4 +1,4 @@
-
+#pragma once
 /* A Bison parser, made by GNU Bison 2.4.1.  */
 
 /* Skeleton interface for Bison's Yacc-like parsers in C
@@ -32,7 +32,10 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
-
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+    
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
@@ -109,5 +112,7 @@ typedef union YYSTYPE
 #endif
 
 
-
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
 

+ 2 - 0
3rdparty/libconfig/libconfig.h

@@ -20,6 +20,8 @@
    ----------------------------------------------------------------------------
 */
 
+#pragma once
+
 #ifndef __libconfig_h
 #define __libconfig_h
 

+ 2 - 0
3rdparty/libconfig/parsectx.h

@@ -1,3 +1,5 @@
+#pragma once
+
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
    Copyright (C) 2005-2010  Mark A Lindner

+ 10 - 0
3rdparty/libconfig/scanctx.h

@@ -1,3 +1,5 @@
+#pragma once
+
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
    Copyright (C) 2005-2010  Mark A Lindner
@@ -31,6 +33,10 @@
 
 #define MAX_INCLUDE_DEPTH 10
 
+#ifdef	__cplusplus
+extern "C" {
+#endif
+    
 struct scan_context
 {
   config_t *config;
@@ -59,4 +65,8 @@ extern char *scanctx_take_string(struct scan_context *ctx);
 
 extern const char *scanctx_current_filename(struct scan_context *ctx);
 
+#ifdef	__cplusplus
+}
+#endif
+    
 #endif /* __libconfig_scanctx_h */

+ 2 - 0
3rdparty/libconfig/scanner.h

@@ -1,3 +1,5 @@
+#pragma once
+
 #ifndef libconfig_yyHEADER_H
 #define libconfig_yyHEADER_H 1
 #define libconfig_yyIN_HEADER 1

+ 10 - 0
3rdparty/libconfig/strbuf.h

@@ -1,3 +1,5 @@
+#pragma once
+
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
    Copyright (C) 2005-2010  Mark A Lindner
@@ -26,6 +28,10 @@
 #include <string.h>
 #include <sys/types.h>
 
+#ifdef	__cplusplus
+extern "C" {
+#endif
+    
 typedef struct
 {
   char *string;
@@ -37,4 +43,8 @@ char *strbuf_release(strbuf_t *buf);
 
 void strbuf_append(strbuf_t *buf, const char *text);
 
+#ifdef	__cplusplus
+}
+#endif
+    
 #endif /* __libconfig_strbuf_h */

+ 2 - 0
3rdparty/libconfig/wincompat.h

@@ -1,3 +1,5 @@
+#pragma once
+
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
    Copyright (C) 2005-2010  Mark A Lindner

+ 10 - 0
3rdparty/mt19937ar/mt19937ar.h

@@ -1,3 +1,5 @@
+#pragma once
+
 /* 
    A C-program for MT19937, with initialization improved 2002/1/26.
    Coded by Takuji Nishimura and Makoto Matsumoto.
@@ -43,6 +45,10 @@
    email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
 */
 
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
 /* initializes mt[N] with a seed */
 void init_genrand(unsigned long s);
 
@@ -70,3 +76,7 @@ double genrand_real3(void);
 
 /* generates a random number on [0,1) with 53-bit resolution*/
 double genrand_res53(void);
+
+#ifdef	__cplusplus
+}
+#endif

+ 83 - 0
3rdparty/yaml-cpp/CMakeLists.txt

@@ -0,0 +1,83 @@
+cmake_minimum_required(VERSION 2.8)
+
+## start setting
+SET (this_target yaml-cpp)
+PROJECT(${this_target})
+
+find_path( YAML_INCLUDE_DIRS "yaml-cpp/yaml.h"
+	PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
+	NO_DEFAULT_PATH )
+find_path( YAML_SOURCE_DIR "regex_yaml.cpp"
+	PATHS "${CMAKE_CURRENT_SOURCE_DIR}/src"
+	NO_DEFAULT_PATH )
+mark_as_advanced( YAML_INCLUDE_DIRS )
+mark_as_advanced( YAML_SOURCE_DIR )
+
+set( YAML_HEADERS
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/yaml.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/traits.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/stlemitter.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/parser.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/ostream_wrapper.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/null.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/noncopyable.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/mark.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/exceptions.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/eventhandler.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/emitterstyle.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/emittermanip.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/emitter.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/emitterdef.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/emitfromevents.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/dll.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/binary.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/anchor.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/type.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/ptr.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/parse.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/node.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/iterator.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/impl.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/emit.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/node/convert.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/contrib/graphbuilder.h"
+    "${YAML_INCLUDE_DIRS}/yaml-cpp/contrib/anchordict.h"
+    CACHE INTERNAL "yaml headers" )
+set( YAML_SOURCES
+	"${YAML_SOURCE_DIR}/binary.cpp"
+  "${YAML_SOURCE_DIR}/convert.cpp"
+  "${YAML_SOURCE_DIR}/directives.cpp"
+  "${YAML_SOURCE_DIR}/emit.cpp"
+  "${YAML_SOURCE_DIR}/emitfromevents.cpp"
+  "${YAML_SOURCE_DIR}/emitter.cpp"
+  "${YAML_SOURCE_DIR}/emitterstate.cpp"
+  "${YAML_SOURCE_DIR}/emitterutils.cpp"
+  "${YAML_SOURCE_DIR}/exceptions.cpp"
+  "${YAML_SOURCE_DIR}/exp.cpp"
+  "${YAML_SOURCE_DIR}/memory.cpp"
+  "${YAML_SOURCE_DIR}/nodebuilder.cpp"
+  "${YAML_SOURCE_DIR}/node.cpp"
+  "${YAML_SOURCE_DIR}/node_data.cpp"
+  "${YAML_SOURCE_DIR}/nodeevents.cpp"
+  "${YAML_SOURCE_DIR}/null.cpp"
+  "${YAML_SOURCE_DIR}/ostream_wrapper.cpp"
+  "${YAML_SOURCE_DIR}/parse.cpp"
+  "${YAML_SOURCE_DIR}/parser.cpp"
+  "${YAML_SOURCE_DIR}/regex_yaml.cpp"
+  "${YAML_SOURCE_DIR}/scanner.cpp"
+  "${YAML_SOURCE_DIR}/scanscalar.cpp"
+  "${YAML_SOURCE_DIR}/scantag.cpp"
+  "${YAML_SOURCE_DIR}/scantoken.cpp"
+  "${YAML_SOURCE_DIR}/simplekey.cpp"
+  "${YAML_SOURCE_DIR}/singledocparser.cpp"
+  "${YAML_SOURCE_DIR}/stream.cpp"
+  "${YAML_SOURCE_DIR}/tag.cpp"
+  "${YAML_SOURCE_DIR}/contrib/graphbuilderadapter.cpp"
+  "${YAML_SOURCE_DIR}/contrib/graphbuilder.cpp"
+	CACHE INTERNAL "yaml sources" )
+set( YAML_DEFINITIONS
+	"-std=c++11"
+	CACHE INTERNAL "yaml definitions" )
+include_directories(${YAML_INCLUDE_DIRS} ${YAML_SOURCE_DIR})
+message(STATUS "YAML_INCLUDE_DIRS : ${YAML_INCLUDE_DIRS}, YAML_SOURCE_DIR=${YAML_SOURCE_DIR}")
+ADD_LIBRARY(${this_target} STATIC ${YAML_SOURCES} )

+ 35 - 55
CMakeLists.txt

@@ -28,20 +28,39 @@
 #   changes to some CPack generators
 #   CYGWIN no longer defines WIN32
 #   CMP0017: Prefer files from the CMake module directory when including from there.
+# Update to 3.1 for CMAKE_CXX_STANDARD cross support definition
 set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
-cmake_minimum_required( VERSION 2.8.8 )
-project( rAthena C )
+cmake_minimum_required( VERSION 3.1 )
+project( rAthena )
 if( CYGWIN )
 	unset( WIN32 )
 endif()
+set(CMAKE_CXX_STANDARD 11) # C++11...
+set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
+#set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
 
+#actually this might be misleading for arm...
+if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
+	set(architecture x86)
+elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+	set(architecture x64)
+else()
+	message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P})" )
+endif()
 
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
+set(CMAKE_C_CREATE_SHARED_LIBRARY)
+set(CMAKE_CXX_CREATE_SHARED_LIBRARY)
+set(CMAKE_DEBUG_POSTFIX "d")
+set(CMAKE_RELEASE_POSTFIX "r")
 #
 # Prevent building in the source directory by default
 #
+option( ALLOW_SAME_DIRECTORY "Allow CMake to build in the source directory." OFF )
 if( ALLOW_SAME_DIRECTORY )
 elseif( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" )
-	option( ALLOW_SAME_DIRECTORY "Allow CMake to build in the source directory." OFF )
 	message( FATAL_ERROR
 		"Do not use the source directory to build your files, instead delete CMakeCache.txt, create a separate folder and build there.\n"
 		"Example: (build in subdir 'build' and install to source dir)\n"
@@ -105,47 +124,12 @@ if(GIT_FOUND)
 	endif()
 endif()
 
-#
-# Find svnversion
-#
-message( STATUS "Detecting svnversion" )
-find_program( SVNVERSION_EXECUTABLE svnversion )
-mark_as_advanced( SVNVERSION_EXECUTABLE )
-if( SVNVERSION_EXECUTABLE )
-	message( STATUS "Found svnversion: ${SVNVERSION_EXECUTABLE}" )
-endif()
-message( STATUS "Detecting svnversion - done" )
-#
-# Find Subversion
-#
-message( STATUS "Detecting Subversion" )
-find_package( Subversion )
-message( STATUS "Detecting Subversion - done" )
-#
-# SVNVERSION
-#
-if( SVNVERSION_EXECUTABLE )
-	message( STATUS "Getting svn version" )
-	execute_process( COMMAND ${SVNVERSION_EXECUTABLE} ${PROJECT_SOURCE_DIR}
-		OUTPUT_VARIABLE SVNVERSION
-		OUTPUT_STRIP_TRAILING_WHITESPACE )
-	if( SVNVERSION MATCHES "^Unversioned" )
-		set( SVNVERSION )
-	endif()
-	string( REGEX REPLACE "[^1234567890MSexported]" "_" SVNVERSION "${SVNVERSION}" )
-	message( STATUS "Found SVNversion: ${SVNVERSION}" )
-	message( STATUS "Getting svn version - done" )
-endif()
-if( Subversion_FOUND AND SVNVERSION )
-	message( STATUS "Getting svn branch" )
-	Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} rAthena )
-	if( rAthena_WC_URL )
-		string( REGEX MATCH "[^/]+$" BRANCH ${rAthena_WC_URL} )
-		set( SVNVERSION "${BRANCH}-${SVNVERSION}" )
-		message( STATUS "Found branch: ${BRANCH}" )
-	endif()
-	message( STATUS "Getting svn branch - done" )
-endif()
+include(GetGitVersion)
+get_git_version()
+
+#include(GetSvnVersion)
+#get_svn_version(SVN_VERSION)
+#message( STATUS "SVN_VERSION: ${SVN_VERSION}" )
 
 
 #
@@ -198,12 +182,12 @@ endif()
 #
 if( NOT MSVC )
 message( STATUS "Detecting networking library (socket/nsl/ws2_32)" )
-set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
-find_function_library( bind FUNCTION_BIND_LIBRARIES socket ws2_32 )
-if( FUNCTION_BIND_LIBRARIES )
-	message( STATUS "Adding global library: ${FUNCTION_BIND_LIBRARIES}" )
-	set_property( CACHE GLOBAL_LIBRARIES  PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_BIND_LIBRARIES} )
-endif()
+#set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
+#find_function_library( bind FUNCTION_BIND_LIBRARIES socket ws2_32 )
+#if( FUNCTION_BIND_LIBRARIES )
+#	message( STATUS "Adding global library: ${FUNCTION_BIND_LIBRARIES}" )
+#	set_property( CACHE GLOBAL_LIBRARIES  PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_BIND_LIBRARIES} )
+#endif()
 set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
 find_function_library( gethostbyname FUNCTION_GETHOSTBYNAME_LIBRARIES nsl )
 if( FUNCTION_GETHOSTBYNAME_LIBRARIES )
@@ -590,11 +574,7 @@ add_subdirectory( src )
 #####################################################################
 # final checks and warnings
 #
-if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-	message( WARNING "64bit should work, but is not recommended." )
-elseif( NOT CMAKE_SIZEOF_VOID_P EQUAL 4 )
-	message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P})" )
-endif()
+
 list( LENGTH  TARGET_LIST  _LEN )
 if( _LEN EQUAL 0 )
 	message( FATAL_ERROR "no targets available" )

+ 5 - 4
conf/battle/items.conf

@@ -106,10 +106,11 @@ item_flooritem_check: yes
 // 4 - Character
 default_bind_on_equip: 4
 
-// Allow selling of bound items as Itemshop currency?
-// no = Bound items are unable to be sold at Itemshops
-// yes = Bound items are able to be sold at Itemshops
-allow_bound_sell: no
+// Allow selling of bound/sell restricted items as Itemshop currency? (Note 3)
+// 0x0 = Bound/sell restricted items are unable to be sold at Itemshops
+// 0x1 = Bound items are able to be sold at Itemshops
+// 0x2 = Sell restricted items are able to be sold at Itemshops
+allow_bound_sell: 0x0
 
 // Turn on event refine chance (see db/{pre-}re/refine_db.yml)
 // no = normal refine chances in effect (official/default value)

+ 1 - 1
conf/char_athena.conf

@@ -112,7 +112,7 @@ save_log: yes
 // Max number of start points is MAX_STARTPOINT in char.h (default 5)
 // Location is randomly picked on character creation.
 // NOTE: For Doram, this requires client 20151001 or newer.
-start_point: iz_int,97,90:iz_int01,97,90:iz_int02,97,90:iz_int03,97,90:iz_int04,97,90
+start_point: iz_int,18,26:iz_int01,18,26:iz_int02,18,26:iz_int03,18,26:iz_int04,18,26
 start_point_pre: new_1-1,53,111:new_2-1,53,111:new_3-1,53,111:new_4-1,53,111:new_5-1,53,111
 start_point_doram: lasa_fild01,48,297
 

+ 1 - 1
conf/msg_conf/map_msg.conf

@@ -1668,4 +1668,4 @@
 1504: You've entered a PK Zone (safe until level %d).
 
 //Custom translations
-//import: conf/msg_conf/import/map_msg_eng_conf.txt
+import: conf/msg_conf/import/map_msg_eng_conf.txt

+ 1 - 1
conf/msg_conf/map_msg_chn.conf

@@ -1498,4 +1498,4 @@
 1498: You cannot create a guild because you are in a clan.
 
 //Custom translations
-//import: conf/msg_conf/import/map_msg_chn_conf.txt
+import: conf/msg_conf/import/map_msg_chn_conf.txt

+ 1 - 1
conf/msg_conf/map_msg_frn.conf

@@ -1490,4 +1490,4 @@
 1498: You cannot create a guild because you are in a clan.
 
 //Custom translations
-//import: conf/msg_conf/import/map_msg_frn_conf.txt
+import: conf/msg_conf/import/map_msg_frn_conf.txt

+ 1 - 1
conf/msg_conf/map_msg_idn.conf

@@ -1606,4 +1606,4 @@
 1498: You cannot create a guild because you are in a clan.
 
 //Bila ada terjemahan lain
-//import: conf/msg_conf/import/map_msg_idn_conf.txt
+import: conf/msg_conf/import/map_msg_idn_conf.txt

+ 1 - 1
conf/msg_conf/map_msg_por.conf

@@ -1467,4 +1467,4 @@
 1498: You cannot create a guild because you are in a clan.
 
 //Custom translations
-//import: conf/msg_conf/import/map_msg_por_conf.txt
+import: conf/msg_conf/import/map_msg_por_conf.txt

+ 1 - 1
conf/msg_conf/map_msg_rus.conf

@@ -1490,4 +1490,4 @@
 1498: You cannot create a guild because you are in a clan.
 
 // Ďîëüçîâŕňĺëüńęčé ďĺđĺâîä
-//import: conf/msg_conf/import/map_msg_rus_conf.txt
+import: conf/msg_conf/import/map_msg_rus_conf.txt

+ 1 - 1
conf/msg_conf/map_msg_spn.conf

@@ -1470,4 +1470,4 @@
 1498: You cannot create a guild because you are in a clan.
 
 //Traducciones personalizadas
-//import: conf/msg_conf/import/map_msg_spn_conf.txt
+import: conf/msg_conf/import/map_msg_spn_conf.txt

+ 1 - 1
conf/msg_conf/map_msg_tha.conf

@@ -1509,4 +1509,4 @@
 1498: You cannot create a guild because you are in a clan.
 
 //Custom translations
-//import: conf/msg_conf/import/map_msg_tha_conf.txt
+import: conf/msg_conf/import/map_msg_tha_conf.txt

File diff suppressed because it is too large
+ 140 - 548
configure


+ 2 - 1
configure.in

@@ -4,6 +4,8 @@
 AC_INIT(rAthena)
 AC_REVISION($Revision$)
 AC_PREREQ([2.59])
+AC_LANG([C++])
+AC_LANG_COMPILER_REQUIRE
 AC_CONFIG_SRCDIR([src/common/cbasetypes.h])
 AC_CONFIG_FILES([Makefile src/common/Makefile])
 AC_CONFIG_FILES([3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile 3rdparty/yaml-cpp/Makefile])
@@ -437,7 +439,6 @@ AC_PROG_CXX
 AC_PATH_PROG(AR, ar)
 AC_LANG([C++])
 
-
 CFLAGS="$CFLAGS -pipe -ffast-math -Wall"
 CPPFLAGS="$CPPFLAGS -I../common"
 CXXFLAGS="$CXXFLAGS -std=c++11"

+ 1 - 0
db/re/instance_db.txt

@@ -23,3 +23,4 @@
 16,Horror Toy Factory,3600,300,1@xm_d,111,22
 17,Faceworm's Nest,3600,300,1@face,112,374
 18,Ghost Palace,3600,300,1@spa,42,196
+21,Fenrir and Sarah,3600,300,1@glast,367,304

+ 4 - 4
db/re/item_db.txt

@@ -7471,7 +7471,7 @@
 13450,Saber__,Saber,5,10,,1000,115,,,2,0x000654E2,63,2,2,3,27,1,0,{},{},{}
 13451,Ru_Blue_Sword,Blue Sword,5,10,,1200,190,,1,1,0x00000080,56,2,2,3,100,1,2,{ bonus bStr,5; bonus bAgi,5; },{},{}
 13452,Ru_Gold_Sword,Ru Gold Sword,5,0,,1200,190,,1,2,0x00000080,56,2,2,3,120,1,2,{ bonus bStr,8; bonus bAgi,8; },{},{}
-13454,Crimson_Saber,Crimson Saber,5,20,,850,85,,1,2,0x000654E3,56,2,2,3,70,1,2,{ .@r = getrefine(); bonus bBaseAtk,((BaseLevel/10)*5)+(.@r<=15?pow(.@r,2):225); },{},{}
+13454,Crimson_Saber,Crimson Saber,5,20,,850,85,,1,2,0x000654E3,63,2,2,3,70,1,2,{ .@r = getrefine(); bonus bBaseAtk,((BaseLevel/10)*5)+(.@r<=15?pow(.@r,2):225); },{},{}
 13455,Saber_of_Vicious_Mind,Saber of Vicious Mind,5,20,,1350,135,,1,1,0x000654E3,63,2,2,4,160,1,2,{ bonus bAtk,pow(min(getrefine(),15),2); },{},{}
 13456,Unity_Sword,Unity Sword,5,20,,420,80,,1,1,0x000654E3,56,2,2,3,1,1,2,{ bonus bBaseAtk,pow(getrefine(),2)*125/100; },{},{}
 13457,Unity_Dagger,Unity Dagger,5,20,,270,52,,1,1,0x028F5EEF,63,2,2,3,1,1,1,{ bonus bBaseAtk,pow(getrefine(),2)*125/100; },{},{}
@@ -9515,7 +9515,7 @@
 18562,Bone_Hat,Bone Hat,4,20,,200,,3,,1,0xFFFFFFFF,63,2,256,,10,1,732,{ bonus bMdef,3; },{},{}
 18563,Heart_Wing_Hairband,Heart Wing Hairband,4,20,,300,,0,,1,0xFFFFFFFF,63,2,256,,50,1,733,{ bonus bUseSPrate,-10; bonus bDelayrate,-5; .@r = getrefine()/3; if(.@r>0){ bonus bUseSPrate,.@r*3; bonus bDelayrate,.@r*3; } },{},{}
 18564,Love_Piece,Love Piece,4,20,,200,,0,,0,0xFFFFFFFF,63,2,1,,50,0,734,{ bonus bNoCastCancel,1; bonus bUseSPrate,15; },{},{}
-18565,Leprechaun_Hat,St Patrick's Hat,4,20,,300,,8,,1,0xFFFFFFFF,63,2,256,,40,1,735,{ bonus bStr,1; bonus bInt,1; bonus bMdef,4; if(getrefine()>6){ bonus2 bAddMonsterDropItem,12135,50; } },{},{}
+18565,Leprechaun_Hat,St Patrick's Hat,4,20,,300,,8,,1,0xFFFFFFFF,63,2,256,,40,1,735,{ bonus bStr,1; bonus bInt,1; bonus bMdef,4; if(getrefine()>7){ bonus2 bAddMonsterDropItem,12135,50; } },{},{}
 18566,Nut_Donut_In_Mouth,Nut Donut In Mouth,4,20,,0,,1,,0,0xFFFFFFFF,63,2,1,,0,0,736,{ bonus bBaseAtk,5; bonus bMatk,5; },{},{}
 18567,Stretched_Nose,Stretched Nose,4,20,,100,,0,,0,0xFFFFFFFF,63,2,1,,0,0,737,{},{},{}
 18568,Humming_Bird,Humming Bird,4,20,,100,,3,,0,0xFFFFFFFF,63,2,256,,10,0,702,{ bonus bMdef,6; },{},{}
@@ -11479,8 +11479,8 @@
 28316,RCC2013_ARMLET_,RCC2013_ARMLET_,4,200,,200,,,,1,0xFFFFFFFF,63,2,136,,1,0,,{ bonus2 bAddClass,Class_All,1; },{},{}
 28317,RCC2013_RING,RCC2013_RING,4,200,,200,,,,0,0xFFFFFFFF,63,2,136,,1,0,,{ bonus2 bAddClass,Class_All,1; },{},{}
 28318,RCC2013_RING_,RCC2013_RING_,4,200,,200,,,,1,0xFFFFFFFF,63,2,136,,1,0,,{ bonus2 bAddClass,Class_All,1; },{},{}
-28310,Earring_Of_Sarah_L,Sarah's Left Earring,4,10,,100,,,,0,0xFFFFFFFF,63,2,128,,145,0,,{ skill "AL_HEAL",1; },{},{}
-28311,Earring_Of_Sarah_R,Sarah's Right Earring,4,10,,100,,,,0,0xFFFFFFFF,63,2,8,,145,0,,{ skill "AL_TELEPORT",1; },{},{}
+28310,Earring_Of_Sarah_L,Sarah's Left Earring,4,10,,100,,,,0,0xFFFFFFFF,63,2,136,,145,0,,{ skill "AL_HEAL",1; },{},{}
+28311,Earring_Of_Sarah_R,Sarah's Right Earring,4,10,,100,,,,0,0xFFFFFFFF,63,2,136,,145,0,,{ skill "AL_TELEPORT",1; },{},{}
 28321,Falconer_Claw,Falconer Claw,4,0,,100,,5,,1,0x00000800,63,2,136,,80,0,,{ bonus bDex,1; bonus2 bSkillAtk,"HT_BLITZBEAT",getskilllv("HT_STEELCROW")*10; },{},{}
 28322,Falconer_Glove,Falconer Glove,4,0,,100,,5,,1,0x00000800,63,2,136,,80,0,,{ bonus bDex,1; bonus bUseSPrate,-5; },{},{}
 28326,Broken_Chip_1,Broken Chips 01,4,10,,100,,,,1,0xFFFFFFFF,63,2,136,,100,0,,{ bonus bStr,4; },{},{}

+ 1 - 0
db/re/item_delay.txt

@@ -85,6 +85,7 @@
 12970,300000,SC_REUSE_LIMIT_RECALL	//Emergency_Scroll3
 
 // Misc
+12135,10000	//Green_Ale
 //12202,60000	//Str_Dish10_
 //12203,60000	//Agi_Dish10_
 //12204,60000	//Int_Dish10_

BIN
db/re/map_cache.dat


+ 103 - 15
db/re/mob_db.txt

@@ -2344,17 +2344,17 @@
 //3187,E2_G_S_NYDHOG
 //3188,E2_FELOCK
 //3189,WOLF_MOON
-//3190,MM_SARAH
-//3191,MM_M_GIGAN1
-//3192,MM_M_GIGAN2
-//3193,MM_M_GIGAN3
-//3194,MM_L_GIGAN1
-//3195,MM_L_GIGAN2
-//3196,MM_L_GIGAN3
-//3197,MM_M_GARGOYLE
-//3198,MM_M_GALION
-//3199,MM_M_MUTANT_DRAGON
-//3200,MM_M_CHIMERA
+3190,MM_SARAH,Sarah,Sarah Irene,160,100000000,1,0,0,12,1090,2755,276,255,43,161,6,188,225,136,10,12,0,0,20,0x87700A4,2000,500,500,0,0,0,0,0,0,0,0,15121,1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4610,1
+3191,MM_M_GIGAN1,Gigantes,Gigantes,160,6653400,1,0,1,2,4635,4755,64,112,156,151,30,62,265,21,10,12,1,6,47,0x62D3885,250,500,500,600,0,0,0,0,0,0,0,15121,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3192,MM_M_GIGAN2,Gigantes,Gigantes,160,9870000,1,0,0,2,5128,5217,89,175,212,138,43,21,227,15,10,12,1,6,47,0x62A3885,250,500,500,600,0,0,0,0,0,0,0,15121,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3193,MM_M_GIGAN3,Ancient Medium Gigantes,Ancient Medium Gigantes,160,1126300,1,0,0,2,3967,4132,113,155,121,125,45,35,271,15,10,12,1,6,47,0x6283885,300,500,500,600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3194,MM_L_GIGAN1,Large Gigantes,Large Gigantes,160,2482000,1,0,0,2,4172,4254,55,177,135,135,12,72,220,91,10,12,2,6,47,0x62D3885,200,500,500,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3195,MM_L_GIGAN2,Large Gigantes,Large Gigantes,160,2784175,1,0,0,2,3641,3757,71,140,102,119,18,45,275,71,10,12,2,6,47,0x62A3885,200,500,500,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3196,MM_L_GIGAN3,Ancient Gigantes,Ancient Gigantes,160,12063464,1,0,0,2,8957,9018,48,190,203,141,1,66,355,103,10,12,2,6,47,0x6283885,330,800,800,500,0,0,0,0,0,0,0,6803,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3197,MM_M_GARGOYLE,Gargoyle,Mutant Gargoyle,150,256780,1,0,0,9,712,801,124,43,147,110,66,57,191,70,10,12,1,6,64,0x2002085,200,1020,720,384,0,0,0,0,0,0,0,912,1940,1039,250,1746,3,0,0,2619,1,1769,1000,757,119,0,0,0,0,0,0
+3198,MM_M_GALION,Galion,Mutant Galion,150,293165,1,0,0,1,801,878,166,71,133,142,71,45,166,45,10,12,1,2,44,0x020108F,150,864,624,360,0,0,0,0,0,0,0,7564,1500,919,1500,996,5,2531,3,0,0,0,0,0,0,0,0,0,0,0,0
+3199,MM_M_MUTANT_DRAGON,Mutant Dragon,Wicked Mutant Dragon,150,324891,1,0,0,4,1176,1274,185,86,175,161,66,68,201,35,10,12,2,9,43,0x0203695,250,1280,1080,240,0,0,0,0,0,0,0,7054,2425,1035,250,1036,250,930,250,1559,50,7296,750,2527,25,0,0,0,0,0,0
+3200,MM_M_CHIMERA,Wicked Chimera,Wicked Chimera,150,301158,1,0,0,1,1029,1177,199,10,166,175,110,88,188,85,10,12,2,2,63,0x0203695,200,772,672,360,0,0,0,0,0,0,0,7054,2668,1048,1250,568,500,1306,1,7295,750,1364,1,984,80,0,0,0,0,0,0
 //3201,LUCKYCASE,Poring,Poring,1,60,1,27,20,1,8,9,2,5,6,1,1,0,6,5,10,12,1,3,21,0x83,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 3202,ORGANIC_JAKK,Organic Pumpkin,Organic Pumpkin,10,40,1,20,13,1,100,100,160,99,1,1,1,1,999,1,0,0,0,3,21,0x4370001,200,0,0,0,0,0,0,0,0,0,0,6804,5000,6804,5000,6804,1000,2267,100,1062,1000,664,100,546,1000,12192,100,0,0,0,0
 3203,INORGANIC_JAKK,Inorganic Pumpkin,Inorganic Pumpkin,10,40,1,20,13,1,100,100,160,99,1,1,1,1,999,1,0,0,0,3,21,0x4370001,200,0,0,0,0,0,0,0,0,0,0,6805,5000,6805,5000,6805,1000,2267,100,1062,1000,664,100,546,1000,12192,100,0,0,0,0
@@ -3061,7 +3061,12 @@
 //3901,MD_ORK_HERO
 //3902,MD_ORC_LORD
 //3903,MD_ORC_FLOWER
-
+//3904,DUCKLING
+//3905,BIG_DUCKLING
+//3906,IA_LOLI_RURI
+//3907,IA_TEDDY_BEAR
+//3908,IA_MIYABI_NINGYO
+//3909,IA_MARIONETTE
 //3910,E_EMPEL_1
 //3911,E_GIBBET
 //3912,E_LOLI_RURI
@@ -3100,14 +3105,34 @@
 //3945,JP_E_MONSTER_103
 //3946,JP_E_MONSTER_104
 //3947,JP_E_MONSTER_105
-
+//3948,ORC_WARRIOR_MJ
+//3949,ORC_LADY_MJ
+//3950,ORC_BABY_MJ
+//3951,HIGH_ORC_MJ
+//3952,ORC_ARCHER_MJ
+//3953,ORC_HERO_MJ
+//3954,ORC_LORD_MJ
 //3955,E_SAVAGE
 //3956,E_ELDER_WILOW
-
+//3957,HORNET_MJ
+//3958,MANTIS_MJ
+//3959,ARGOS_MJ
+//3960,MISTRESS_MJ
+//3961,BIGFOOT_MJ
+//3962,SNAKE_MJ
+//3963,WOLF_MJ
+//3964,EDDGA_MJ
+//3965,FRILLDORA_MJ
+//3966,SANDMAN_MJ
+//3967,HODE_MJ
+//3968,PHREEONI_MJ
 //3969,MD_RED_MUSHROOM
 //3970,MD_BLACK_MUSHROOM
 //3971,SKELION
-
+//3972,MD_THIEF_BUG__
+//3973,MD_THIEF_BUG
+//3974,MD_THIEF_BUG_EGG
+//3975,MD_GOLDEN_BUG
 //3976,EIRA_BRZ
 //3977,AB_MOB_051
 //3978,AB_MOB_052
@@ -3137,3 +3162,66 @@
 //20022,AB_MOB_074
 //20023,AB_MOB_075
 //20024,AB_MOB_076
+//20025,JP_CM_MOB_001
+//20026,JP_CM_MOB_002
+//20027,JP_CM_MOB_003
+//20028,JP_CM_MOB_004
+//20029,JP_CM_MOB_005
+//20030,JP_CM_MOB_006
+//20031,JP_CM_MOB_007
+//20032,JP_CM_MOB_008
+//20033,JP_CM_MOB_009
+//20034,JP_CM_MOB_010
+//20035,JP_CM_MOB_011
+//20036,JP_CM_MOB_012
+//20037,JP_CM_MOB_013
+//20038,JP_CM_MOB_014
+//20039,JP_CM_MOB_015
+//20040,JP_CM_MOB_016
+//20041,JP_CM_MOB_017
+//20042,JP_CM_MOB_018
+//20043,JP_CM_MOB_019
+//20044,JP_CM_MOB_020
+//20045,JP_CM_MOB_021
+//20046,JP_CM_MOB_022
+//20047,JP_CM_MOB_023
+//20048,JP_CM_MOB_024
+//20049,JP_CM_MOB_025
+//20050,JP_CM_MOB_026
+//20051,JP_CM_MOB_027
+//20052,JP_CM_MOB_028
+//20053,JP_CM_MOB_029
+//20054,JP_CM_MOB_030
+//20055,JP_CM_MOB_031
+//20056,JP_CM_MOB_032
+//20057,JP_CM_MOB_033
+//20058,JP_CM_MOB_034
+//20059,JP_CM_MOB_035
+//20060,JP_CM_MOB_036
+//20061,EVT_BAPHOMET
+//20062,EVT_BAPHO_JR
+//20063,EVT_V_WOLF
+//20064,EVT_ECLIPSE
+//20065,EVT_VOCAL
+//20066,EVT_UNGOLIANT
+//20067,EVT_GEOGRAPHER
+//20068,EVT_MANTIS
+//20069,EVT_GRIZZLY
+//20070,EVT_KINDOFBEETLE
+//20071,EVT_BIGFOOT
+//20072,EVT_COCO
+//20073,E_SIROMA
+//20074,E_MYSTCASE
+//20075,E_X_PORING
+//20076,MD_MAYA
+//20077,MD_DENIRO
+//20078,MD_VITATA
+//20079,MD_ANDRE
+//20080,MD_PIERE
+//20081,MD_IZ_COELACANTH
+//20082,MD_IZ_MARSE
+//20083,MD_IZ_MERMAN
+//20084,MD_IZ_OBEAUNE
+//20085,MD_IZ_CORNUTUS
+//20086,RED_ERUMA_MJ
+//20087,SIORAVA_MJ

+ 5 - 0
db/re/mob_skill_db.txt

@@ -11054,3 +11054,8 @@
 3074,Time Holder@NPC_PULSESTRIKE,attack,661,5,2000,0,30000,yes,self,always,0,,,,,,,
 3074,Time Holder@NPC_SUMMONSLAVE,attack,196,5,1000,700,10000,no,self,slavele,0,2917,,,,,,
 3074,Time Holder@NPC_SUMMONSLAVE,idle,196,5,1000,700,10000,no,self,slavele,0,2917,,,,,,
+
+3200,Wicked Chimera@WZ_HEAVENDRIVE,attack,91,5,500,1200,5000,yes,target,always,0,,,,,,6,
+3200,Wicked Chimera@WZ_HEAVENDRIVE,chase,91,5,500,1200,5000,yes,target,always,0,,,,,,6,
+3200,Wicked Chimera@CR_AUTOGUARD,attack,249,5,500,0,300000,yes,self,always,0,,,,,,,
+3200,Wicked Chimera@CR_AUTOGUARD,chase,249,5,2000,0,300000,yes,self,longrangeattacked,,,,,,,,

+ 16 - 10
db/re/quest_db.txt

@@ -1847,6 +1847,15 @@
 9260,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Survey investigation notes"
 9262,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Mystery Robbery Incident 16"
 
+// Academy 14.2
+9264,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Job change to Mage"
+9265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Job change to Mage"
+9266,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Job change to Mage"
+9267,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 1"
+9268,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 2"
+9269,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 3"
+9270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 4"
+
 //Geffen Magic Tournament
 9284,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Geffen"
 9285,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Geffen"
@@ -1882,15 +1891,6 @@
 9315,82800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Geffen"
 9316,82800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Geffen"
 
-// Academy 14.2
-9264,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Job change to Mage"
-9265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Job change to Mage"
-9266,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Job change to Mage"
-9267,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 1"
-9268,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 2"
-9269,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 3"
-9270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The way to be a strong Mage - 4"
-
 //9327,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""
 //9328,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""
 //9329,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""
@@ -1900,6 +1900,11 @@
 //9333,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""
 //9334,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""
 
+// Sarah Fenrir memorial
+9335,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Search for shards of Gigantes"
+9336,604800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Go back to Professor Bernhard"
+9337,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Wrapping up the Adventure"
+
 10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"To the Prontera Royal Court"
 10001,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Qualification Test"
 10002,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Qualification Review"
@@ -3348,7 +3353,8 @@
 19129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The Eye of Hellion"
 
 21001,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Escape the Wreck"
-21002,0,0,0,0,0,0,0,1002,6008,10000,0,0,0,0,0,0,"The first battle"
+21002,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"The first battle"
+21008,0,0,0,0,0,0,0,2401,6008,10000,0,0,0,0,0,0,"The first battle"
 
 50000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Pirate Dagger materials"
 50001,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Weather Beaten Old Man"

+ 3 - 98
npc/custom/jobmaster.txt

@@ -1,15 +1,9 @@
 //===== rAthena Script =======================================
 //= Job Master
-//===== By: ==================================================
-//= Euphy
-//===== Current Version: =====================================
-//= 1.7
-//===== Compatible With: ===================================== 
-//= rAthena Project
 //===== Description: =========================================
 //= A fully functional job changer.
 //===== Additional Comments: =================================
-//= 1.0 Initial script.
+//= 1.0 Initial script. [Euphy]
 //= 1.1 Fixed reset on Baby job change.
 //= 1.2 Added Expanded Super Novice support and initial Kagerou/Oboro support.
 //= 1.3 Kagerou/Oboro added.
@@ -18,6 +12,7 @@
 //= 1.6 Added option to get job related equipment on change. [Braniff]
 //= 1.7 Readability changes. Also added BabyExpanded and BabySummoner classes. [Jey]
 //= 1.8 Added option to disable Baby Novice Only but Baby Class can be Enabled [mazvi]
+//= 1.9 Migrate/Integrate to Global Functions Platinum Skills. [mazvi]
 //============================================================
 
 prontera,153,193,6	script	Job Master	123,{
@@ -305,7 +300,6 @@ function	Job_Menu	{
 
 // Executes the actual jobchange and closes.
 function	Job_Change	{
-	function Get_Platinum;
 	.@to_cls = getarg(0);
 	next;
 	mes .NPCName$;
@@ -323,7 +317,7 @@ function	Job_Change	{
 	specialeffect2 EF_ANGEL2;
 	specialeffect2 EF_ELECTRIC;
 	if (.Platinum)
-		Get_Platinum();
+		callfunc "F_GetPlatinumSkills";
 	if (.GetJobEquip)
 		Get_Job_Equip();
 	close; // Always closes after the change
@@ -351,95 +345,6 @@ function	Confirm_Change	{
 	return;
 }
 
-function	Get_Platinum	{
-	skill "NV_FIRSTAID",1,SKILL_PERM;
-	switch (BaseClass) {
-	case Job_Novice:
-		if (Class != Job_Super_Novice)
-			skill "NV_TRICKDEAD",1,SKILL_PERM;
-		break;
-	case Job_Swordman:
-		skill "SM_MOVINGRECOVERY",1,SKILL_PERM;
-		skill "SM_FATALBLOW",1,SKILL_PERM;
-		skill "SM_AUTOBERSERK",1,SKILL_PERM;
-		break;
-	case Job_Mage:
-		skill "MG_ENERGYCOAT",1,SKILL_PERM;
-		break;
-	case Job_Archer:
-		skill "AC_MAKINGARROW",1,SKILL_PERM;
-		skill "AC_CHARGEARROW",1,SKILL_PERM;
-		break;
-	case Job_Acolyte:
-		skill "AL_HOLYLIGHT",1,SKILL_PERM;
-		break;
-	case Job_Merchant:
-		skill "MC_CARTREVOLUTION",1,SKILL_PERM;
-		skill "MC_CHANGECART",1,SKILL_PERM;
-		skill "MC_LOUD",1,SKILL_PERM;
-		break;
-	case Job_Thief:
-		skill "TF_SPRINKLESAND",1,SKILL_PERM;
-		skill "TF_BACKSLIDING",1,SKILL_PERM;
-		skill "TF_PICKSTONE",1,SKILL_PERM;
-		skill "TF_THROWSTONE",1,SKILL_PERM;
-		break;
-	default:
-		break;
-	}
-	switch (BaseJob) {
-	case Job_Knight:
-		skill "KN_CHARGEATK",1,SKILL_PERM;
-		break;
-	case Job_Priest:
-		skill "PR_REDEMPTIO",1,SKILL_PERM;
-		break;
-	case Job_Wizard:
-		skill "WZ_SIGHTBLASTER",1,SKILL_PERM;
-		break;
-	case Job_Blacksmith:
-		skill "BS_UNFAIRLYTRICK",1,SKILL_PERM;
-		skill "BS_GREED",1,SKILL_PERM;
-		break;
-	case Job_Hunter:
-		skill "HT_PHANTASMIC",1,SKILL_PERM;
-		break;
-	case Job_Assassin:
-		skill "AS_SONICACCEL",1,SKILL_PERM;
-		skill "AS_VENOMKNIFE",1,SKILL_PERM;
-		break;
-	case Job_Crusader:
-		skill "CR_SHRINK",1,SKILL_PERM;
-		break;
-	case Job_Monk:
-		skill "MO_KITRANSLATION",1,SKILL_PERM;
-		skill "MO_BALKYOUNG",1,SKILL_PERM;
-		break;
-	case Job_Sage:
-		skill "SA_CREATECON",1,SKILL_PERM;
-		skill "SA_ELEMENTWATER",1,SKILL_PERM;
-		skill "SA_ELEMENTGROUND",1,SKILL_PERM;
-		skill "SA_ELEMENTFIRE",1,SKILL_PERM;
-		skill "SA_ELEMENTWIND",1,SKILL_PERM;
-		break;
-	case Job_Rogue:
-		skill "RG_CLOSECONFINE",1,SKILL_PERM;
-		break;
-	case Job_Alchemist:
-		skill "AM_BIOETHICS",1,SKILL_PERM;
-		break;
-	case Job_Bard:
-		skill "BA_PANGVOICE",1,SKILL_PERM;
-		break;
-	case Job_Dancer:
-		skill "DC_WINKCHARM",1,SKILL_PERM;
-		break;
-	default:
-		break;
-	}
-	return;
-}
-
 // Function which gives a job related item to the player
 // the items are the rewards from the original job change quests
 function	Get_Job_Equip	{

+ 8 - 95
npc/custom/platinum_skills.txt

@@ -1,23 +1,20 @@
 //===== rAthena Script =======================================
 //= Platinum Skills
-//===== By: ==================================================
-//= Keichii, DarkChild
-//===== Current Version: =====================================
-//= 2.8
-//===== Compatible With: =====================================
-//= rAthena Project
 //===== Description: =========================================
 //= Single NPC that assigns quests skills for all classes
 //===== Additional Comments: =================================
-//= 2.0 Added advanced classes by ShadowLady.
-//= 2.1 Added baby clases by Midas
-//= 2.2 Simplified Job Checks [Silentdragon]
-//= 2.3 Thehell? Cleaned up script removed the nastiness. Also added rebirth skills. [Spre]
+//= 1.0 Initial release. [Keichii] [DarkChild]
+//= 2.0 Added advanced classes. [ShadowLady]
+//= 2.1 Added baby classes. [Midas]
+//= 2.2 Simplified Job Checks. [Silentdragon]
+//= 2.3 Thehell? Cleaned up script, removed the nastiness. Also added rebirth skills. [Spre]
 //= 2.4 Added Advanced skills. [Spre]
 //= 2.5 Added dialog for if the user is none of the listed jobs. [Kisuka]
 //= 2.6 Fixed 2nd advanced classes not being able to get their advanced skills. [Ancyker]
 //= 2.7 Rewrote to give all correct skills to all proper classes. [Paradox924X]
 //= 2.8 Clustered conditionals replaced with switch to include all Upper types. [Euphy]
+//= 2.9 Added MC_CARTDECORATE for Merchant class. [mazvi]
+//= 3.0 Migrate/Integrate to Global Functions. [mazvi]
 //============================================================
 
 prontera,128,200,6	script	Platinum Skill NPC	94,{
@@ -30,91 +27,7 @@ prontera,128,200,6	script	Platinum Skill NPC	94,{
 		mes "Have a nice day... >.>";
 		close;
 	}
-	skill "NV_FIRSTAID",1,SKILL_PERM;
-	switch (BaseClass) {
-	case Job_Novice:
-		if (Class != Job_Super_Novice)
-			skill "NV_TRICKDEAD",1,SKILL_PERM;
-		break;
-	case Job_Swordman:
-		skill "SM_MOVINGRECOVERY",1,SKILL_PERM;
-		skill "SM_FATALBLOW",1,SKILL_PERM;
-		skill "SM_AUTOBERSERK",1,SKILL_PERM;
-		break;
-	case Job_Mage:
-		skill "MG_ENERGYCOAT",1,SKILL_PERM;
-		break;
-	case Job_Archer:
-		skill "AC_MAKINGARROW",1,SKILL_PERM;
-		skill "AC_CHARGEARROW",1,SKILL_PERM;
-		break;
-	case Job_Acolyte:
-		skill "AL_HOLYLIGHT",1,SKILL_PERM;
-		break;
-	case Job_Merchant:
-		skill "MC_CARTREVOLUTION",1,SKILL_PERM;
-		skill "MC_CHANGECART",1,SKILL_PERM;
-		skill "MC_LOUD",1,SKILL_PERM;
-		break;
-	case Job_Thief:
-		skill "TF_SPRINKLESAND",1,SKILL_PERM;
-		skill "TF_BACKSLIDING",1,SKILL_PERM;
-		skill "TF_PICKSTONE",1,SKILL_PERM;
-		skill "TF_THROWSTONE",1,SKILL_PERM;
-		break;
-	default:
-		break;
-	}
-	switch (BaseJob) {
-	case Job_Knight:
-		skill "KN_CHARGEATK",1,SKILL_PERM;
-		break;
-	case Job_Priest:
-		skill "PR_REDEMPTIO",1,SKILL_PERM;
-		break;
-	case Job_Wizard:
-		skill "WZ_SIGHTBLASTER",1,SKILL_PERM;
-		break;
-	case Job_Blacksmith:
-		skill "BS_UNFAIRLYTRICK",1,SKILL_PERM;
-		skill "BS_GREED",1,SKILL_PERM;
-		break;
-	case Job_Hunter:
-		skill "HT_PHANTASMIC",1,SKILL_PERM;
-		break;
-	case Job_Assassin:
-		skill "AS_SONICACCEL",1,SKILL_PERM;
-		skill "AS_VENOMKNIFE",1,SKILL_PERM;
-		break;
-	case Job_Crusader:
-		skill "CR_SHRINK",1,SKILL_PERM;
-		break;
-	case Job_Monk:
-		skill "MO_KITRANSLATION",1,SKILL_PERM;
-		skill "MO_BALKYOUNG",1,SKILL_PERM;
-		break;
-	case Job_Sage:
-		skill "SA_CREATECON",1,SKILL_PERM;
-		skill "SA_ELEMENTWATER",1,SKILL_PERM;
-		skill "SA_ELEMENTGROUND",1,SKILL_PERM;
-		skill "SA_ELEMENTFIRE",1,SKILL_PERM;
-		skill "SA_ELEMENTWIND",1,SKILL_PERM;
-		break;
-	case Job_Rogue:
-		skill "RG_CLOSECONFINE",1,SKILL_PERM;
-		break;
-	case Job_Alchemist:
-		skill "AM_BIOETHICS",1,SKILL_PERM;
-		break;
-	case Job_Bard:
-		skill "BA_PANGVOICE",1,SKILL_PERM;
-		break;
-	case Job_Dancer:
-		skill "DC_WINKCHARM",1,SKILL_PERM;
-		break;
-	default:
-		break;
-	}
+	callfunc "F_GetPlatinumSkills";
 	mes "[Platinum Skill NPC]";
 	mes "There you go!";
 	close;

+ 96 - 6
npc/other/Global_Functions.txt

@@ -1,14 +1,9 @@
 //===== rAthena Script ======================================= 
 //= Global Functions
-//===== By: ================================================== 
-//= Lupus, kobra_k88
-//===== Current Version: ===================================== 
-//= 2.25
-//===== Compatible With: ===================================== 
-//= rAthena Project
 //===== Description: ========================================= 
 //= General script functions.
 //===== Additional Comments: ================================= 
+//= 1.0 Initial script. [Lupus] [kobra_k88]
 //= Added F_ClearJobVar - on getting a new job it clears all Job Quest variables
 //= Removed individual job check functions as they were redundant [kobra_k88]
 //= 1.3 Added Job Change Function for Baby/Normal Classes
@@ -49,6 +44,7 @@
 //= 2.24 Added functions to check for equipment swap hacks. [Euphy]
 //= 2.25 Added "F_CanOpenStorage" and "F_CanChangeJob". [secretdataz]
 //= 2.26 Added "F_getpositionname". [Capuche]
+//= 2.27 Added "F_GetPlatinumSkills". [mazvi]
 //============================================================ 
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -659,3 +655,97 @@ function	script	F_getpositionname	{
 			return "Unknown";
 	}
 }
+
+//////////////////////////////////////////////////////////////////////////////////
+// Gives attached player their Platinum Skill based on their class.
+//////////////////////////////////////////////////////////////////////////////////
+function	script	F_GetPlatinumSkills	{
+	skill "NV_FIRSTAID",1,SKILL_PERM;
+	switch (BaseClass) {
+	case Job_Novice:
+		if (Class != Job_Super_Novice)
+			skill "NV_TRICKDEAD",1,SKILL_PERM;
+		break;
+	case Job_Swordman:
+		skill "SM_MOVINGRECOVERY",1,SKILL_PERM;
+		skill "SM_FATALBLOW",1,SKILL_PERM;
+		skill "SM_AUTOBERSERK",1,SKILL_PERM;
+		break;
+	case Job_Mage:
+		skill "MG_ENERGYCOAT",1,SKILL_PERM;
+		break;
+	case Job_Archer:
+		skill "AC_MAKINGARROW",1,SKILL_PERM;
+		skill "AC_CHARGEARROW",1,SKILL_PERM;
+		break;
+	case Job_Acolyte:
+		skill "AL_HOLYLIGHT",1,SKILL_PERM;
+		break;
+	case Job_Merchant:
+		skill "MC_CARTREVOLUTION",1,SKILL_PERM;
+		skill "MC_CHANGECART",1,SKILL_PERM;
+		skill "MC_LOUD",1,SKILL_PERM;
+		if(PACKETVER >= 20150826)
+			skill "MC_CARTDECORATE",1,SKILL_PERM;
+		break;
+	case Job_Thief:
+		skill "TF_SPRINKLESAND",1,SKILL_PERM;
+		skill "TF_BACKSLIDING",1,SKILL_PERM;
+		skill "TF_PICKSTONE",1,SKILL_PERM;
+		skill "TF_THROWSTONE",1,SKILL_PERM;
+		break;
+	default:
+		break;
+	}
+	switch (BaseJob) {
+	case Job_Knight:
+		skill "KN_CHARGEATK",1,SKILL_PERM;
+		break;
+	case Job_Priest:
+		skill "PR_REDEMPTIO",1,SKILL_PERM;
+		break;
+	case Job_Wizard:
+		skill "WZ_SIGHTBLASTER",1,SKILL_PERM;
+		break;
+	case Job_Blacksmith:
+		skill "BS_UNFAIRLYTRICK",1,SKILL_PERM;
+		skill "BS_GREED",1,SKILL_PERM;
+		break;
+	case Job_Hunter:
+		skill "HT_PHANTASMIC",1,SKILL_PERM;
+		break;
+	case Job_Assassin:
+		skill "AS_SONICACCEL",1,SKILL_PERM;
+		skill "AS_VENOMKNIFE",1,SKILL_PERM;
+		break;
+	case Job_Crusader:
+		skill "CR_SHRINK",1,SKILL_PERM;
+		break;
+	case Job_Monk:
+		skill "MO_KITRANSLATION",1,SKILL_PERM;
+		skill "MO_BALKYOUNG",1,SKILL_PERM;
+		break;
+	case Job_Sage:
+		skill "SA_CREATECON",1,SKILL_PERM;
+		skill "SA_ELEMENTWATER",1,SKILL_PERM;
+		skill "SA_ELEMENTGROUND",1,SKILL_PERM;
+		skill "SA_ELEMENTFIRE",1,SKILL_PERM;
+		skill "SA_ELEMENTWIND",1,SKILL_PERM;
+		break;
+	case Job_Rogue:
+		skill "RG_CLOSECONFINE",1,SKILL_PERM;
+		break;
+	case Job_Alchemist:
+		skill "AM_BIOETHICS",1,SKILL_PERM;
+		break;
+	case Job_Bard:
+		skill "BA_PANGVOICE",1,SKILL_PERM;
+		break;
+	case Job_Dancer:
+		skill "DC_WINKCHARM",1,SKILL_PERM;
+		break;
+	default:
+		break;
+	}
+	return;
+}

+ 3 - 3
npc/other/arena/arena_point.txt

@@ -62,7 +62,7 @@ prt_are_in,103,11,3	script	Arena Point Manager	732,{
 			mes "To cancel, enter ''^3355FF0^000000.''";
 			next;
 			input .@input;
-			if (.@input == 0) {
+			if (.@input <= 0) {
 				mes "[Arena Point Manager]";
 				mes "You have";
 				mes "canceled";
@@ -113,8 +113,8 @@ prt_are_in,103,11,3	script	Arena Point Manager	732,{
 					mes "into 5 Arena Points " + .@input + " times.";
 					mes "A total of " + .@want_point1 + " Turbo Track Points were converted into";
 					mes "" + .@want_point +" Arena Points.";
-					set tt_point,tt_point - .@want_point1;
-					set arena_point,arena_point+.@want_point;
+					set tt_point, .@my_turbo_all;
+					set arena_point, .@my_arena_all;
 					next;
 					mes "[Arena Point Manager]";
 					mes "" + strcharinfo(0) + ",";

+ 2 - 2
npc/other/arena/arena_room.txt

@@ -999,7 +999,7 @@ function	script	Func_Are_Rew	{
 	mes "If you wish to cancel, please enter 0. If you don't, please enter how many ^3131FFtimes^000000 of arena points you wish to spend.";
 	next;
 	input .@reward;
-	if (.@reward == 0) {
+	if (.@reward <= 0) {
 		mes "[Givu]";
 		mes "You have canceled your request.";
 		close;
@@ -1008,7 +1008,7 @@ function	script	Func_Are_Rew	{
 		mes "You have exceeded the maximum capacity.";
 		close;
 	}
-	if (arena_point < .@reward * .@arena_point) {
+	if (arena_point < (.@reward * .@arena_point)) {
 		mes "[Givu]";
 		mes "You do not have enough arena points.";
 		mes "Please check the total amount of arena points you have.";

+ 1 - 1
npc/other/turbo_track.txt

@@ -4492,7 +4492,7 @@ turbo_room,106,117,3	script	Point Manager#tt	833,{
 			mes "is 20. To cancel, enter '^3355FF0^000000.'";
 			next;
 			input .@input;
-			if (.@input == 0) {
+			if (.@input <= 0) {
 				mes "[Turbo Track Point Manager]";
 				mes "You have";
 				mes "canceled";

+ 2322 - 0
npc/re/instances/SarahAndFenrir.txt

@@ -0,0 +1,2322 @@
+//===== rAthena Script =======================================
+//= Sarah and Fenrir
+//===== Description: =========================================
+//= [Walkthrough Conversion]
+//= Sarah and Fenrir Instance
+//===== Changelogs: ==========================================
+//= 1.0 First version. [Capuche]
+//============================================================
+
+dali02,97,142,3	script	Professor Bernhard#a1	4_LGTSCIENCE,{
+	if (BaseLevel < 145) {
+		mes "- You may proceed after reaching level 145 or over -";
+		close;
+	}
+	switch( checkquest(9336,PLAYTIME) ) {
+	case -1:
+		switch( isbegin_quest(9335) ) {
+		case 0:// First time doing instance
+			mes "[Professor Bernhard]";
+			mes "I would say I am Professor Bernhard, the best weapons researcher in Schwaltzvalt.";
+			next;
+			mes "[Professor Bernhard]";
+			mes "After endless research I have created various weapons, but I felt something was missing so I found the ancient texts.";
+			mes "I found out about the Dimensional Device during my research.";
+			next;
+			mes "[Professor Bernhard]";
+			mes "I also realized that relics from the glorious past were also needed to create more powerful and superior weapons.";
+			mes "That is why..I need you..";
+			next;
+			mes "[Professor Bernhard]";
+			if (getpartyleader(getcharid(1),2) != getcharid(0)) {
+				mes "A longing for accomplishing a powerful weapon as a genuine professor!";
+				mes "In order to accomplish that, we need shards of Gigantes that once appeared in the past battle of Fenrir and Sarah.";
+				next;
+				mes "[Professor Bernhard]";
+				mes "I cannot leave my post.";
+				mes "I need a warrior who can bring me the shards instead..";
+				mes "You seem capable.";
+				next;
+				mes "[Professor Bernhard]";
+				mes "I will continue discussing this further with your party leader rather than with you.";
+				close;
+			}
+			mes "I need a warrior who can bring me the shard of Gigantes instead..";
+			mes "You seem capable.";
+			next;
+			mes "[Professor Bernhard]";
+			mes "What do you think?";
+			mes "Would you go to the past and bring me back the shards of Gigantes?";
+			mes "I will make sure to compensate you sufficiently.";
+			next;
+			if (select( "No", "Yes" ) == 1) {
+				mes "[Professor Bernhard]";
+				mes "Visit me again if you change your mind.";
+				close;
+			}
+			mes "[Professor Bernhard]";
+			mes "I set the Dimensional Device to Glast Heim of the past, where Fenrir and Sarah once fought.";
+			mes "The operating time isn't long so hurry up and come back.";
+			instance_create("Fenrir and Sarah");
+			close;
+		case 1:
+			mes "[Professor Bernhard]";
+			mes "Did you successfully bring back the shards of Gigantes?";
+			mes "You probably faced a lot of danger so thank you for the effort.";
+			next;
+			mes "[Professor Bernhard]";
+			mes "I don't expect to receive the shards for nothing when you have risked your life for them!";
+			if (sarah_fenrir == 0) {
+				mes "I will give you a useful looking earring from the relics I have happened to have obtained during my previous research.";
+				next;
+				mes "- The left earring of Sarah -";
+				mes "Usable for Heal 1Lv";
+				mes "- The right earring of Sarah -";
+				mes "Usable for Teleport 1Lv";
+				next;
+				.@s = select( "The left earring of Sarah", "The right earring of Sarah" ) - 1;
+			}
+			mes "[Professor Bernhard]";
+			mes "If you hand the shards of Gigantes to my chief assistant, I will make sure the earrings will be correspondingly great through an enchantment.";
+			next;
+			mes "[Professor Bernhard]";
+			mes "The more shards of Gigantes are collected, the better.";
+			mes "However, there isn't a stable supply of energy needed to work the Dimensional Device.";
+			next;
+			mes "[Professor Bernhard]";
+			mes "Come back and find me after one week has passed for the supply of Dimensional Device energy.";
+			mes "I need you to find shards of Gigantes again.";
+			erasequest 9335;// Search for shards of Gigantes
+			setquest 9336;// Go back to Professor Bernhard
+			if (isbegin_quest(9337) > 0)
+				erasequest 9337;// Wrapping up the Adventure
+			if (sarah_fenrir == 0) {
+				sarah_fenrir = 1;
+				getitem (28310+.@s),1;
+			}
+			close;
+		case 2:
+			end;
+		}
+	case 0:
+	case 1:
+		mes "[Professor Bernhard]";
+		mes "We lack the shards of Gigantes in order to make powerful weapons.";
+		mes "Because a lot of energy is needed to open a dimension device, come back and find me when the energy has accumulated.";
+		close;
+	case 2:
+		mes "[Professor Bernhard]";
+		mes "I have been waiting.";
+		mes "How is everything going?";
+		mes "While you were gone I have succeeded in accumulating dimensional energy.";
+		mes "We can open the dimension device again.";
+		next;
+		mes "[Professor Bernhard]";
+		mes "A longing for accomplishing a powerful weapon as a genuine professor!";
+		mes "In order to accomplish that, we need shards of Gigantes that once appeared in the past battle of Fenrir and Sarah.";
+		next;
+		mes "[Professor Bernhard]";
+		mes "Because I cannot leave my post, ";
+		mes "I need a warrior who can bring me the shards instead.";
+		mes "I think you can assist me once again..";
+		next;
+		mes "[Professor Bernhard]";
+		mes "There, all the preparations are finished.";
+		mes "Can you go back in time again and bring me the shards of Gigantes?";
+		mes "I will make sure to compensate you sufficiently.";
+		if (getpartyleader(getcharid(1),2) == getcharid(0)) {
+			next;
+			if (select( "No", "Yes" ) == 1) {
+				mes "[Professor Bernhard]";
+				mes "I set the Dimensional Device to Glast Heim of the past, where Fenrir and Sarah once were.";
+				mes "It won't last long so hurry up and come back.";
+				close;
+			}
+			instance_create("Fenrir and Sarah");
+		}
+		close;
+	}
+}
+
+dali02,99,148,3	script	Dimensional Device#XX1	PORTAL,{
+	if (BaseLevel < 145) {
+		mes "- You must be level 145 or over";
+		mes "It seems entry is possible. -";
+		close;
+	}
+	switch( checkquest(9336,PLAYTIME) ) {
+	case -1:
+		break;
+	case 0:
+	case 1:
+		mes "- The Dimensional Device has closed.";
+		mes "It seems entry is not possible. -";
+		close;
+	case 2:
+		break;
+	}
+	if (isbegin_quest(9335) > 0) {
+		mes "- The Dimensional Device has closed.";
+		mes "It seems entry is not possible. -";
+		close;
+	}
+	if (select( "Do not enter the device.", "Enter the time device" ) == 1) {
+		if (getcharid(1) > 0) {
+			mes "- It seems the Dimensional Device ";
+			mes "will contort space time -";
+			close;
+		}
+		mes "- There is a damp presence. -";
+		close;
+	}
+	.@md_name$ = "Fenrir and Sarah";
+	switch( instance_enter(.@md_name$) ) {
+	case IE_OTHER:
+		mes "An unknown error occurred.";
+		close;
+	case IE_NOINSTANCE:
+		mes "Memorial Dungeon " + .@md_name$ + " does not exist.";
+		mes "The party leader has not created the Memorial Dungeon.";
+		close;
+	case IE_NOMEMBER:
+		mes "Only party members can enter the Memorial Dungeon.";
+		close;
+	case IE_OK:
+		mapannounce "dali02", "Party member " + strcharinfo(0) + " of party's " + getpartyname( getcharid(1) ) + " enters Room " + .@md_name$ + "", bc_map,0xFF99,FW_NORMAL,12;
+		setquest 9335;// Search for shards of Gigantes
+		if (isbegin_quest(9336) > 0)
+			erasequest 9336;
+		// warp "1@glast",367,304;
+		end;
+	}
+}
+
+dali02,93,146,6	script	Assistant Professor#a1	4_M_REPAIR,{
+	if (sarah_fenrir == 0)
+		end;
+	disable_items;
+	mes "[Chief Assistant]";
+	mes "I've heard about you from the professor.";
+	mes "The professor has told me to sufficiently compensate you for risking your life and bringing the shards of Gigantes.";
+	next;
+	switch( select( "Enchant earring.", "Purchase earring", "Exit conversation" ) ) {
+	case 1:
+		mes "[Chief Assistant]";
+		mes "Sarah's earrings we have discovered at the archaeological site must certainly have great potential.";
+		next;
+		switch( select( "Enchant Sarah's earrings", "Initialize enchantment on Sarah's earrings", "Exit conversation" ) ) {
+		case 1:
+			mes "[Chief Assistant]";
+			mes "2 enchantments are possible on one earring.";
+			mes "Which earring do you wish to enchant?";
+			next;
+			switch( select( "The left earring of Sarah", "The right earring of Sarah", "Quit" ) ) {
+			case 1:
+				.@sarah_item_id = 28310;
+				.@sarah_earring$ = "left";
+				break;
+			case 2:
+				.@sarah_item_id = 28311;
+				.@sarah_earring$ = "right";
+				break;
+			case 3:
+				mes "[Chief Assistant]";
+				mes "If you want an enchantment ";
+				mes "on Sarah's earrings, ";
+				mes "come and find me again.";
+				close;
+			}
+			mes "[Chief Assistant]";
+			mes "You must equip the item to make enchantment possible.";
+			mes "Which column do you wish to enchant?";
+			next;
+			if (select( "Left column", "Right column" ) == 1) {
+				.@part = EQI_ACC_L;
+				.@column$ = "left";
+				.@bonus_size = 4;		// 4 possibilities
+				.@bonus_chance = 20;	// 20% per possibility
+			}
+			else {
+				.@part = EQI_ACC_R;
+				.@column$ = "right";
+				.@bonus_size = 6;		// 6 possibilities
+				.@bonus_chance = 10;	// 10% per possibility
+			}
+			.@equip_id = getequipid(.@part);
+			if (.@equip_id != .@sarah_item_id) {
+				mes "[Chief Assistant]";
+				mes "If you wish to enchant, you must equip Sarah's " + .@sarah_earring$ + " earring.";
+				close;
+			}
+			setarray .@card[0], getequipcardid(.@part,3), getequipcardid(.@part,2);
+			if (.@card[1] > 0) {// 2 enchants
+				mes "[Chief Assistant]";
+				mes "A fully enchanted earring of Sarah cannot be enchanted any further.";
+				close;
+			}
+			if (.@card[0] < 1) {// none enchant
+				mes "[Chief Assistant]";
+				mes "Sarah's Earring is currently in a state without enchantment.";
+				.@slot = 0;
+			}
+			else {// 1 enchant
+				mes "[Chief Assistant]";
+				mes "Sarah's Earring is currently in a state of enchantment in slot 4.";
+				.@slot = 1;
+			}
+			next;
+			mes "[Chief Assistant]";
+			mes "Which ability do you want as an enchantment on slot " + (4-.@slot) + "?";
+			next;
+			switch( select( "CRI or Critical", "Expert archer or Bleed", "Conservation or MATK", "Delay Attack or Delay Skill" ) ) {
+			case 1:
+				setarray .@bonus[0],
+					4863,	// Fatal1
+					4864,	// Fatal2
+					4939,	// Critical2
+					4940,	// Critical3
+					4941,	// Critical4
+					4865;	// Fatal3
+				mes "[Chief Assistant]";
+				mes "Selected for CRI or Critical Enchantment slot " + (4-.@slot) + ".";
+				break;
+			case 2:
+				setarray .@bonus[0],
+					4832,	// Expert_Archer1
+					4833,	// Expert_Archer2
+					4942,	// Dodge1
+					4943,	// Dodge2
+					4944,	// Dodge3
+					4834;	// Expert_Archer3
+				mes "[Chief Assistant]";
+				mes "Selected for Expert Archer or Bleed Enchantment slot " + (4-.@slot) + ".";
+				break;
+			case 3:
+				setarray .@bonus[0],
+					4945,	// Thrift1
+					4946,	// Thrift2
+					4897,	// Matk3p
+					4898,	// Matk4p
+					4947,	// Thrift3
+					4899;	// Matk5p
+				mes "[Chief Assistant]";
+				mes "Selected for Conservation or MATK Enchantment slot " + (4-.@slot) + ".";
+				break;
+			case 4:
+				setarray .@bonus[0],
+					4869,	// Attack_Delay_1
+					4872,	// Attack_Delay_2
+					4948,	// Skill_Delay1
+					4949,	// Skill_Delay2
+					4950,	// Skill_Delay3
+					4873;	// Attack_Delay_3
+				mes "[Chief Assistant]";
+				mes "Selected for Delay Attack or Delay Skill Enchantment slot " + (4-.@slot) + ".";
+				break;
+			}
+			next;
+			mes "[Chief Assistant]";
+			mes "4 shards of Gigantes is required for one enchantment.";
+			next;
+			mes "[Chief Assistant]";
+			mes "Because enchantment is a high risk process, there is risk of Sarah's earring being destroyed.";
+			mes "Do you still want to do it?";
+			next;
+			if (select( "No", "Yes" ) == 1) {
+				mes "[Chief Assistant]";
+				mes "Please speak to me again after making a clear decision!";
+				close;
+			}
+			if (countitem(6803) < 4) {
+				mes "[Chief Assistant]";
+				mes "There are not enough shards of Gigantes.";
+				mes "4 shards of Gigantes is required to do one enchantment.";
+				close;
+			}
+			mes "[Chief Assistant]";
+			mes "Good. I will start the enchantment!";
+			mes "I wish you luck~!";
+			next;
+			mes "[Chief Assistant]";
+			mes "Aahhhh!!";
+			next;
+			progressbar "000000",5;
+			specialeffect2 EF_MAGICALATTHIT;
+			specialeffect2 EF_POTION2;
+			delitem 6803,4;// Shard of Gigantes
+			delequip .@part;
+			.@r = rand(100);
+			for ( .@i = 0; .@i < .@bonus_size && (.@bonus_chance * (.@i+1)) < .@r; .@i++ );
+			if (.@i == .@bonus_size) {
+				specialeffect2 EF_CRASHEARTH;
+				specialeffect2 EF_MAXPOWER;
+				mes "[Chief Assistant]";
+				mes "Sadly... it is..";
+				mes "destroyed...";
+				mes "Whew.. ";
+				mes "enchantment is not an easy task..";
+				close;
+			}
+			.@card[.@slot] = .@bonus[.@i];
+			specialeffect2 EF_ANGEL2;
+			getitem2 .@sarah_item_id,1,1,0,0,0,0,.@card[1],.@card[0];
+			mes "[Chief Assistant]";
+			mes "Enchantment completed!";
+			close;
+		case 2:
+			mes "[Chief Assistant]";
+			mes "Which earring do you wish to initialize?";
+			next;
+			switch( select( "The left earring of Sarah", "The right earring of Sarah", "Quit" ) ) {
+			case 1:
+				.@sarah_item_id = 28310;
+				.@sarah_earring$ = "left";
+				break;
+			case 2:
+				.@sarah_item_id = 28311;
+				.@sarah_earring$ = "right";
+				break;
+			case 3:
+				mes "[Chief Assistant]";
+				mes "If you want to initialize an enchantment on Sarah's earrings, come and find me again.";
+				close;
+			}
+			mes "[Chief Assistant]";
+			mes "On Sarah's earring. 1 shard of Gigantes is required to initialize the enchantment..";
+			next;
+			if (countitem(6803) < 1) {
+				mes "[Chief Assistant]";
+				mes "There are not enough shards of Gigantes.";
+				mes "You will need them in order for initialization to take place.";
+				close;
+			}
+			mes "[Chief Assistant]";
+			mes "You must equip the item to make initialization possible.";
+			mes "Which column's earring do you wish to initialize?";
+			next;
+			if (select( "Left column", "Right column" ) == 1) {
+				.@part = EQI_ACC_L;
+				.@column$ = "left";
+			}
+			else {
+				.@part = EQI_ACC_R;
+				.@column$ = "right";
+			}
+			.@equip_id = getequipid(.@part);
+			if (.@equip_id == -1) {
+				mes "[Chief Assistant]";
+				mes "To initialize an enchantment, the relevant column must be equipped with gear.";
+				close;
+			}
+			if (.@equip_id != .@sarah_item_id) {
+				mes "[Chief Assistant]";
+				mes "To initialize an enchantment, the relevant column must be equipped with Sarah's earring.";
+				close;
+			}
+			if (getequipcardid(.@part,3) < 1) {
+				mes "[Chief Assistant]";
+				mes "Sarah's earring without an enchantment cannot be initialized.";
+				close;
+			}
+			mes "[Chief Assistant]";
+			mes "You have selected Sarah's " + .@sarah_earring$ + " earring on the " + .@column$ + " column.";
+			mes "It is impossible to restore abilities that are gone after initialization.";
+			mes "Do you still want to proceed?";
+			next;
+			if (select( "No", "Yes" ) == 2) {
+				mes "[Chief Assistant]";
+				mes "Yes sir. Initialization will start.";
+				next;
+				progressbar "000000",5;
+				specialeffect2 EF_MAGICALATTHIT;
+				specialeffect2 EF_POTION2;
+				specialeffect2 EF_ANGEL2;
+				delitem 6803,1;// Shard of Gigantes
+				delequip .@part;
+				getitem .@sarah_item_id,1;
+				mes "[Chief Assistant]";
+				mes "Initialization completed.";
+				mes "Please find me if you need me.";
+			}
+			close;
+		case 3:
+			mes "[Chief Assistant]";
+			mes "If you want an enchantment on Sarah's earrings, come and find me again.";
+			close;
+		}
+	case 2:
+		mes "[Chief Assistant]";
+		mes "Related to Glast Heim, this is an unique and rare earring found during an excavation with the professor.";
+		next;
+		mes "[Chief Assistant]";
+		mes "I think this has been worn by Sarah in the past and seems to have a great ability to draw out potential strength.";
+		next;
+		mes "[Chief Assistant]";
+		mes "I will specially trade it for 1 shard since you are the warrior who brought shards of Gigantes for the professor's work.";
+		next;
+		mes "[Chief Assistant]";
+		mes "- The left earring of Sarah -";
+		mes "Usable for Heal 1Lv";
+		mes "- The right earring of Sarah -";
+		mes "Usable for Teleport 1Lv";
+		mes "-----------------------";
+		mes "Which one do you wish?";
+		next;
+		.@s = select( "The left earring of Sarah", "The right earring of Sarah", "Exit conversation" ) - 1;
+		if (.@s < 2) {
+			if (countitem(6803) < 1) {
+				mes "[Chief Assistant]";
+				mes "There are not enough shards of Gigantes.";
+				mes "You will need them for me to trade with you.";
+				close;
+			}
+			delitem 6803,1;// Shard of Gigantes
+			getitem (28310+.@s),1;
+		}
+		mes "[Chief Assistant]";
+		mes "Professor Bernhard is the professor I respect the most.";
+		mes "Do you have someone you respect?";
+		close;
+	case 3:
+		mes "[Chief Assistant]";
+		mes "I've heard about you from the professor.";
+		mes "The professor has told me to sufficiently compensate you for risking your life and bringing the shards of Gigantes.";
+		close;
+	}
+}
+
+1@glast,360,295,0	script	#glast_event_1	HIDDEN_WARP_NPC,8,8,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_event_1");
+	mes "";
+	specialeffect2 EF_HIT2;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : Huh? Somebody there? Hello~ You must be a traveler.";
+	sleep2 3000;
+	cutin "fenrir_a.bmp",2;
+	npctalk "Fenrith Fenrir: This is strange.. I don't recall Glast Heim castle being filled with such a dark presence..", 'fenrir_1$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Greetings can come later! Careful! It seems somebody has summoned a monster!", 'fenrir_1$;
+	sleep2 3000;
+	cutin "",255;
+	specialeffect EF_LOCKON, AREA, 'fenrir_1$;
+	.@label$ = instance_npcname("#glast_event_1") + "::OnMobDead";
+	monster 'map_glast$,355,300, "Mutant Galion",3198,1, .@label$;	// MM_M_GALION
+	monster 'map_glast$,358,300, "Mutant Galion",3198,1, .@label$;
+	monster 'map_glast$,361,300, "Mutant Galion",3198,1, .@label$;
+	monster 'map_glast$,355,289, "Mutant Galion",3198,1, .@label$;
+	monster 'map_glast$,358,289, "Mutant Galion",3198,1, .@label$;
+	monster 'map_glast$,364,294, "Mutant Galion",3198,1, .@label$;
+	monster 'map_glast$,364,297, "Mutant Galion",3198,1, .@label$;
+	monster 'map_glast$,364,291, "Mutant Galion",3198,1, .@label$;
+	monster 'map_glast$,353,290, "Mutant Galion",3198,1, .@label$;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : What are these things?";
+	npctalk "Fenrith Fenrir: Buy me some time while I cast magic! I will handle this!", 'fenrir_1$;
+	donpcevent instance_npcname("#glast_event_1") + "::OnBar";
+	donpcevent instance_npcname("#glast_event_1") + "::OnEvent";
+	end;
+OnBar:
+	progressbar_npc "000000",10, 'fenrir_1$;
+	end;
+
+OnEvent:
+	// npctalk "Fenrith Fenrir: Buy me some time while I cast magic! I will handle this!", 'fenrir_1$;// double on official
+	sleep 3000;
+	npctalk "Fenrith Fenrir: Wrath of the true sky.", 'fenrir_1$;
+	sleep 3000;
+	npctalk "Fenrith Fenrir: Thunderbolt that may split the earth!", 'fenrir_1$;
+	sleep 3000;
+	npctalk "Fenrith Fenrir: Fall before me now!", 'fenrir_1$;
+	sleep 3000;
+	npctalk "Fenrith Fenrir: Aaah!! Thunder Storm!!!!!", 'fenrir_1$;
+	for ( .@i = 1; .@i < 8; .@i++ )
+		specialeffect EF_THUNDERSTORM, AREA, instance_npcname( "#effect_glast_event01_" + .@i );
+	killmonster 'map_glast$, instance_npcname("#glast_event_1") + "::OnMobDead";
+	sleep 4000;
+	npctalk "Fenrith Fenrir: Glast Heim, once the cathedral for the Asgard gods..", 'fenrir_1$;
+	sleep 3000;
+	npctalk "Fenrith Fenrir: Now it has completely become a habitat for monsters..", 'fenrir_1$;
+	sleep 3000;
+	npctalk "Fenrith Fenrir: Wait.. Come to think of it, something is strange..", 'fenrir_1$;
+	sleep 3000;
+	npctalk "Fenrith Fenrir: Galions are the monsters that habit this vicinity..", 'fenrir_1$;
+	sleep 3000;
+	enablenpc instance_npcname("#glast_event_3");
+	end;
+
+OnMobDead:
+	end;
+}
+
+1@glast,360,295,0	script	#glast_event_3	HIDDEN_WARP_NPC,8,8,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_event_3");
+	mes "";
+	cutin "fenrir_a.bmp",2;
+	npctalk "Fenrith Fenrir: By the way, I know it was sudden but thank you for helping.", 'fenrir_1$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: Anyway, who are you?", 'fenrir_1$;
+	sleep2 2000;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : Ah.. that is....";
+	sleep2 2000;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : .. I am a traveler who wanders around the world!";
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: Is that so..? I see.. I guess it does not matter.", 'fenrir_1$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: This place seems quite dangerous now. It is not too late to turn back.", 'fenrir_1$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: There is an object I need to find. I need to hurry before it is too late.", 'fenrir_1$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: Perhaps you can help me...", 'fenrir_1$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: No.. Then thank you! I hope we can meet again later!", 'fenrir_1$;
+	sleep2 3000;
+	cutin "",255;
+	specialeffect EF_LOCKON, AREA, 'fenrir_1$;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : Did that.. person.. really happen to be.. the.. Fenrir..? No way.. probably not..";
+
+	disablenpc 'fenrir_1$;
+	for ( .@i = 1; .@i < 8; .@i++ )
+		disablenpc instance_npcname("#effect_glast_event01_" + .@i);
+	enablenpc instance_npcname("#glast_move_01");
+	enablenpc instance_npcname("#glast_event_5");
+	enablenpc 'fenrir_2$;
+	end;
+}
+
+1@glast,359,296,4	script	#effect_glast_event01_1	CLEAR_NPC,{ end; }
+1@glast,353,294,4	duplicate(#effect_glast_event01_1)	#effect_glast_event01_2	CLEAR_NPC
+1@glast,360,304,4	duplicate(#effect_glast_event01_1)	#effect_glast_event01_3	CLEAR_NPC
+1@glast,366,295,4	duplicate(#effect_glast_event01_1)	#effect_glast_event01_4	CLEAR_NPC
+1@glast,352,304,4	duplicate(#effect_glast_event01_1)	#effect_glast_event01_5	CLEAR_NPC
+1@glast,356,284,4	duplicate(#effect_glast_event01_1)	#effect_glast_event01_6	CLEAR_NPC
+1@glast,345,283,4	duplicate(#effect_glast_event01_1)	#effect_glast_event01_7	CLEAR_NPC
+
+1@glast,359,294,4	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_01	4_F_FENRIR
+
+// Warps
+// From entrance
+1@glast,352,279,0	script	#glast_move_01	WARPNPC,4,4,{
+	end;
+OnTouch:
+	if ('back_to_entrance == 0)
+		warp 'map_glast$,347,265;
+	else {
+		disablenpc instance_npcname("#glast_move_01");
+		initnpctimer;
+	}
+	end;
+
+OnTimer1500:
+	specialeffect EF_FIREPILLARON2, AREA, 'sarah_ego$;
+	end;
+OnTimer2000:
+	hideoffnpc 'sarah_ego$;
+	specialeffect EF_WHITEBODY, AREA, 'sarah_ego$;
+	end;
+OnTimer3000:
+	npctalk "Sarah Irene: Impressive Fenrith Fenrir, you cleverly escaped", 'sarah_ego$;
+	end;
+OnTimer7500:
+	npctalk "Sarah Irene: Mm.. today I will make you stand down", 'sarah_ego$;
+	end;
+OnTimer8000:
+	npctalk "Fenrith Fenrir: Today I hope to end our ill fated relationship.", 'fenrir_11$;
+	end;
+OnTimer11000:
+	npctalk "Sarah Irene: However, do not think this is the end", 'sarah_ego$;
+	end;
+OnTimer14000:
+	npctalk "Sarah Irene: You will surely see me again!!!", 'sarah_ego$;
+	end;
+OnTimer14500:
+	npctalk "Fenrith Fenrir: Mm... I look forward to it Sarah Irene..", 'fenrir_11$;
+	specialeffect EF_FIREPILLARON2, AREA, 'sarah_ego$;
+	end;
+OnTimer15500:
+	stopnpctimer;
+	disablenpc 'sarah_ego$;
+	end;
+}
+
+// Fenrir left side
+// 1@glast,42,350,0	warp2	#glast_event_warp_1	10,10,1@glast,105,369
+// 1@glast,52,346,0	warp2	#glast_event_warp_2	10,10,1@glast,105,369
+// 1@glast,35,364,0	warp2	#glast_event_warp_3	10,10,1@glast,105,369
+// 1@glast,41,364,0	warp2	#glast_event_warp_4	10,10,1@glast,105,369
+// 1@glast,44,371,0	warp2	#glast_event_warp_5	10,10,1@glast,105,369
+// 1@glast,54,362,0	warp2	#glast_event_warp_6	10,10,1@glast,105,369
+// 1@glast,44,358,0	warp2	#glast_event_warp_7	10,10,1@glast,105,369
+
+// To stairs final room
+1@glast,199,237,0	script	#glast_move_03	WARPNPC,2,2,{
+	end;
+OnTouch:
+	if (getcharid(0) == getpartyleader(getcharid(1),2))
+		warpparty 'map_glast$,197,263, getcharid(1), 'map_glast$,1,1;
+	end;
+}
+
+// To final room
+1@glast,199,294,0	script	#glast_move_03a	WARPNPC,3,3,{
+	end;
+OnTouch:
+	if (getcharid(0) == getpartyleader(getcharid(1),2))
+		warpparty 'map_glast$,188,334, getcharid(1), 'map_glast$,1,1;
+	end;
+}
+
+// Exit final room
+//1@glast,189,331,0	warp2	#glast_event_warp_11	10,10,1@glast,197,221
+//1@glast,206,337,0	warp2	#glast_event_warp_12	10,10,1@glast,197,221
+//1@glast,205,330,0	warp2	#glast_event_warp_13	10,10,1@glast,197,221
+//1@glast,193,337,0	warp2	#glast_event_warp_14	10,10,1@glast,197,221
+//1@glast,210,331,0	warp2	#glast_event_warp_15	10,10,1@glast,197,221
+//1@glast,194,330,0	warp2	#glast_event_warp_16	10,10,1@glast,197,221
+
+// Back to entrance
+1@glast,351,269,0	script	#glast_move_04	WARPNPC,3,3,{
+	end;
+OnTouch:
+	if (getcharid(0) == getpartyleader(getcharid(1),2)) {
+		donpcevent instance_npcname("#sarah_wrath") + "::OnStop";
+		warpparty 'map_glast$,349,282, getcharid(1), 'map_glast$,1,1;
+	}
+	end;
+}
+
+// Exit
+1@glast,376,303,0	warp2	#glast_move_05	2,2,dali02,91,140
+
+// Fenrir bottom
+1@glast,216,48,0	script	#glast_event_5	HIDDEN_WARP_NPC,6,6,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_event_5");
+	mes "";
+	cutin "fenrir_a.bmp",2;
+	npctalk "Fenrith Fenrir: You are still in Glast Heim? Why aren't you leaving this dangerous place?", 'fenrir_2$;
+	sleep2 2000;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : I know it's dangerous but I thought it would be fun so I couldn't help myself..";
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: Hm.. Adventurers..", 'fenrir_2$;
+	sleep2 2000;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : You don't have to worry~! I am fairly strong myself!";
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: Oh.. really? Do you think you can assist me then?", 'fenrir_2$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: The object I am looking for is located somewhere in Glast Heim!", 'fenrir_2$;
+	viewpoint 1,47,270,1,0xFF0000;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: But others looking for the object will arrive there soon!", 'fenrir_2$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: This is urgent because there isn't enough time. We have to arrive there soon. 5 minutes at the latest!", 'fenrir_2$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: I will be waiting! If you are late I will have to go by myself!", 'fenrir_2$;
+	sleep2 2000;
+	npctalk "Fenrith Fenrir: Alright, I will go on ahead and you decide if you are going to assist me!", 'fenrir_2$;
+	sleep2 3000;
+	cutin "",255;
+	disablenpc 'fenrir_2$;
+	sleep2 1000;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : Hm.. what should I do..? I need shards of Gigantes as requested by Professor Bernhard..";
+	sleep2 2000;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : Should I help that person.. Or should I look for Gigantes to take the shards as requested by Professor Bernhard..?";
+	sleep2 2000;
+	donpcevent instance_npcname("#fenrir_left_final_2") + "::OnStart";// timer (5 mins)
+	for ( .@i = 1; .@i < 7; .@i++ )
+		enablenpc instance_npcname("Ancient Gigantes#glast_" + .@i);
+	enablenpc 'fenrir_3$;
+	enablenpc instance_npcname("#glast_event_7");
+	disablenpc instance_npcname("#glast_move_01");	// officially player can be stucked in entrance
+	end;
+}
+
+1@glast,216,52,6	script	Fenrith Fenrir#glast_02	4_F_FENRIR,{ end; }
+
+// Fenrir left side, entrance
+1@glast,47,270,0	script	#glast_event_7	HIDDEN_WARP_NPC,5,5,{
+	end;
+OnTouch:
+	if (getcharid(0) != getpartyleader(getcharid(1),2))
+		npctalk "Fenrith Fenrir: I would like your party leader to come and help me!", 'fenrir_3$;
+	else {
+		mes "";
+		disablenpc instance_npcname("#glast_event_7");
+		npctalk "Fenrith Fenrir: You came! I was waiting!", 'fenrir_3$;
+		sleep2 2000;
+		npctalk "Fenrith Fenrir: We don't have much time! We have to go search for it now! Let's go in!", 'fenrir_3$;
+		sleep2 2000;
+		if ('skip_left_part == 0) {// 5 mins have passed?
+			donpcevent instance_npcname("#fenrir_left_final_2") + "::OnStop";
+			disablenpc 'fenrir_3$;
+			enablenpc 'fenrir_4$;
+			enablenpc instance_npcname("#glast_event_9");
+			warpparty 'map_glast$,41,348, getcharid(1), 'map_glast$,1,1;
+		}
+	}
+	end;
+}
+
+1@glast,47,270,4	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_03	4_F_FENRIR
+
+// Fenrir left side, inside
+1@glast,44,357,0	script	#glast_event_9	HIDDEN_WARP_NPC,3,3,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_event_9");
+	mes "";
+	cutin "fenrir_a.bmp",2;
+	npctalk "Fenrith Fenrir: The sword of Baldur, Sentinel Breeze... even after 1000 years..", 'fenrir_4$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: I can feel the evil of monsters in this place.. as if they are being controlled by someone..", 'fenrir_4$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Then there is someone else here other than me?", 'fenrir_4$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: That will do.. Now all I have to do is use Sentinel Breeze to find Baldur's whereabouts..", 'fenrir_4$;
+	sleep2 3000;
+	enablenpc 'sarah_10$;
+	enablenpc instance_npcname("Gigantes#semi1");
+	enablenpc instance_npcname("Gigantes#semi2");
+	sleep2 1000;
+	cutin "sarah_hero3.bmp",0;
+	npctalk "Sarah Irene: Hehe.. I see... just as I expected.", 'sarah_10$;
+	sleep2 3000;
+	npctalk "Sarah Irene: Was that blade the clue?", 'sarah_10$;
+	sleep2 3000;
+	npctalk "Sarah Irene: Then, Fenrith Fenrir, that means a 1000 year old seal can be broken with it?", 'sarah_10$;
+	sleep2 3500;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : Could it be he was the real Fenrir?";
+	npctalk "Fenrith Fenrir: Could this be.. Valkyrie! Now it is not fun anymore", 'fenrir_4$;
+	cutin "fenrir_b.bmp",2;
+	sleep2 5000;
+	npctalk "Sarah Irene: Belated salutations, my name is Sarah Irene, one of the 12 Valkyries of Valhalla.", 'sarah_10$;
+	cutin "sarah_hero3.bmp",0;
+	sleep2 3000;
+	npctalk "Sarah Irene: Anyway, also to achieve Freyja's will.. hehe..", 'sarah_10$;
+	npctalk "Fenrith Fenrir: Two Gigantes! This will not be an easy fight. Help me and defeat the Gigantes!", 'fenrir_4$;
+	cutin "fenrir_b.bmp",2;
+	sleep2 3000;
+	npctalk "Sarah Irene: Go forth! Gigantes! And my loyal monsters!", 'sarah_10$;
+	npctalk "Fenrith Fenrir: Sarah will hide and continuously summon monsters! I will take care of that monster, you face the Gigantes!", 'fenrir_4$;
+	cutin "fenrir_b.bmp",255;
+	sleep2 2000;
+	disablenpc 'sarah_10$;
+	disablenpc instance_npcname("Gigantes#semi1");
+	disablenpc instance_npcname("Gigantes#semi2");
+	enablenpc instance_npcname("#fenrir_left_final_1");
+	monster 'map_glast$,49,363, "Gigantes#semi1", 3191,1, instance_npcname("#fenrir_left_final_1") + "::OnMobDead";// MM_M_GIGAN1
+	monster 'map_glast$,41,363, "Gigantes#semi2", 3192,1, instance_npcname("#fenrir_left_final_1") + "::OnMobDead";// MM_M_GIGAN2
+	donpcevent instance_npcname("#glast_event_9") + "::OnEvent";
+	end;
+OnEvent:
+	sleep 15000;
+	'timer_left_side = 0;
+	donpcevent instance_npcname("#glast_event_9") + "::OnStart";
+	end;
+
+OnStart:
+	initnpctimer;
+	npctalk "Fenrith Fenrir: Currents vibrating in the atmosphere! Show me your strength!", 'fenrir_4$;
+	callsub S_Spawn,1,3198;// MM_M_GALION
+
+	progressbar_npc "000000",5, 'fenrir_4$;	// note: display effect after dead of Gigantes
+	npctalk "Fenrith Fenrir: Light Bolt!!!", 'fenrir_4$;
+	for ( .@i = 1; .@i < 9; .@i++ )
+		specialeffect EF_LIGHTBOLT, AREA, instance_npcname("#effect_glast_event02_" + .@i);
+	end;
+OnTimer6000:
+	killmonster 'map_glast$, instance_npcname("#glast_event_9") + "::OnMobDead";
+	end;
+OnTimer15000:
+	npctalk "Fenrith Fenrir: Devour this evil presence with the fire pit of the universe!", 'fenrir_4$;
+	callsub S_Spawn,2,3198;// MM_M_GALION
+	progressbar_npc "000000",5, 'fenrir_4$;
+	npctalk "Fenrith Fenrir: Hell fire that can swallow even space! Meteor storm~!!!!!", 'fenrir_4$;
+	for ( .@i = 1; .@i < 9; .@i++ )
+		specialeffect EF_METEORSTORM, AREA, instance_npcname("#effect_glast_event02_" + .@i);
+	end;
+OnTimer21000:
+	killmonster 'map_glast$, instance_npcname("#glast_event_9") + "::OnMobDead";
+	end;
+OnTimer30000:
+	npctalk "Fenrith Fenrir: Currents vibrating in the atmosphere! Show me your strength!", 'fenrir_4$;
+	callsub S_Spawn,1,3199;// MM_M_MUTANT_DRAGON
+	progressbar_npc "000000",5, 'fenrir_4$;
+	npctalk "Fenrith Fenrir: Light Bolt!!!", 'fenrir_4$;
+	for ( .@i = 1; .@i < 9; .@i++ )
+		specialeffect EF_LIGHTBOLT, AREA, instance_npcname("#effect_glast_event02_" + .@i);
+	end;
+OnTimer36000:
+	killmonster 'map_glast$, instance_npcname("#glast_event_9") + "::OnMobDead";
+	end;
+OnTimer45000:
+	npctalk "Fenrith Fenrir: Freeze the evil presence with frost wind!!!", 'fenrir_4$;
+	callsub S_Spawn,2,3199;// MM_M_MUTANT_DRAGON
+	progressbar_npc "000000",5, 'fenrir_4$;
+	npctalk "Fenrith Fenrir: A storm that can freeze even the soul!! Storm gust~!!!!!", 'fenrir_4$;
+	for ( .@i = 1; .@i < 9; .@i++ )
+		specialeffect EF_STORMGUST, AREA, instance_npcname("#effect_glast_event02_" + .@i);
+	end;
+OnTimer51000:
+	killmonster 'map_glast$, instance_npcname("#glast_event_9") + "::OnMobDead";
+	end;
+OnTimer55000:
+	'timer_left_side++;
+	if ('timer_left_side == 5) {
+		stopnpctimer;
+		donpcevent instance_npcname("#fenrir_left_vermilion") + "::OnEvent";
+	}
+	end;
+OnTimer60000:
+	donpcevent instance_npcname("#glast_event_9") + "::OnStart";
+	end;
+
+OnStop:
+	stopnpctimer;
+	end;
+
+OnMobDead:
+	end;
+
+S_Spawn:
+	.@mob_id = getarg(1);
+	.@label$ = instance_npcname("#glast_event_9") + "::OnMobDead";
+	if (getarg(0) == 1) {
+		monster 'map_glast$,43,355, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,39,361, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,48,361, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,43,363, "--ja--", .@mob_id,1, .@label$;
+	}
+	else {
+		monster 'map_glast$,37,360, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,37,362, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,37,364, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,37,366, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,37,368, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,41,371, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,50,360, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,50,362, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,50,364, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,50,366, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,50,368, "--ja--", .@mob_id,1, .@label$;
+		monster 'map_glast$,46,371, "--ja--", .@mob_id,1, .@label$;
+	}
+	return;
+}
+
+1@glast,1,1,0	script	#fenrir_left_vermilion	HIDDEN_WARP_NPC,{
+	end;
+OnEvent:
+	enablenpc instance_npcname("#fenrir_left_vermilion");
+	initnpctimer;
+	npctalk "Fenrith Fenrir: They are endless. I should finish this absolutely.", 'fenrir_4$;
+	progressbar_npc "000000",10, 'fenrir_4$;
+	end;
+OnTimer2000:
+	npctalk "Fenrith Fenrir: Limitlessly distant monarch with the beautiful scarlet breath!!", 'fenrir_4$;
+	end;
+OnTimer4000:
+	npctalk "Fenrith Fenrir: Where you have passed will only be filled with nothingness.", 'fenrir_4$;
+	end;
+OnTimer7000:
+	npctalk "Fenrith Fenrir: Power to shake the earth's axis! Show your grace right here and now!!!", 'fenrir_4$;
+	end;
+OnTimer10000:
+	stopnpctimer;
+	npctalk "Fenrith Fenrir: Road of Vermilion!!!!", 'fenrir_4$;
+	for ( .@i = 1; .@i < 9; .@i++ )
+		specialeffect EF_LORD, AREA, instance_npcname("#effect_glast_event02_" + .@i);
+	killmonster 'map_glast$, instance_npcname("#fenrir_left_final_1") + "::OnMobDead";
+	donpcevent instance_npcname("#fenrir_left_final_1") + "::OnStart";
+	disablenpc instance_npcname("#fenrir_left_vermilion");
+	end;
+OnStop:
+	stopnpctimer;
+	disablenpc instance_npcname("#fenrir_left_vermilion");
+	end;
+}
+
+1@glast,1,1,0	script	#fenrir_left_final_1	HIDDEN_WARP_NPC,{
+	end;
+OnStart:
+	initnpctimer;
+	end;
+OnTimer2000:
+	npctalk "Fenrith Fenrir: Alright! We have defeated a Gigantes!", 'fenrir_4$;
+	enablenpc 'sarah_10$;
+	end;
+OnTimer4000:
+	npctalk "Sarah Irene: As expected, Fenrith Fenrir, you do not yield easily!", 'sarah_10$;
+	end;
+OnTimer7000:
+	npctalk "Fenrith Fenrir: Get away from the Sentinel Breeze immediately!", 'fenrir_4$;
+	end;
+OnTimer9000:
+	npctalk "Sarah Irene: Hehe.. I can't do that!", 'sarah_10$;
+	specialeffect EF_WL_TELEKINESIS_INTENSE, AREA, instance_npcname("#effect_glast_event02_bis");
+	end;
+OnTimer11000:
+	npctalk "Sarah Irene: If you want it back come to Glast Heim Castle! I shall be waiting!", 'sarah_10$;
+	end;
+OnTimer13000:
+	specialeffect EF_FIREPILLARON2, AREA, 'sarah_10$;
+	end;
+OnTimer14000:
+	disablenpc 'sarah_10$;
+	end;
+OnTimer16000:
+	npctalk "Fenrith Fenrir: We must follow quickly to retrieve the sword! I shall use a group space movement spell!", 'fenrir_4$;
+	end;
+OnTimer19000:
+	npctalk "Fenrith Fenrir: Simultaneous large scale warp!", 'fenrir_4$;
+	end;
+OnTimer20000:
+	stopnpctimer;
+	//for ( .@i = 1; .@i < 8; .@i++ )
+	//	enablenpc instance_npcname("#glast_event_warp_" + .@i);	// warp to 105,369
+	areawarp 'map_glast$,26,338,59,375, 'map_glast$,105,369;
+	for ( .@i = 1; .@i < 9; .@i++ )
+		disablenpc instance_npcname("#effect_glast_event02_" + .@i);
+	disablenpc instance_npcname("#effect_glast_event02_bis");
+	disablenpc instance_npcname("#fenrir_left_final_1");
+	disablenpc 'fenrir_4$;
+	enablenpc instance_npcname("#glast_event_13");
+	enablenpc 'fenrir_5$;
+	end;
+
+OnMobDead:
+	if (mobcount( 'map_glast$, instance_npcname("#fenrir_left_final_1") + "::OnMobDead" ) < 1) {
+		donpcevent instance_npcname("#glast_event_9") + "::OnStop";
+		donpcevent instance_npcname("#fenrir_left_vermilion") + "::OnStop";
+		donpcevent instance_npcname("#fenrir_left_final_1") + "::OnStart";
+	}
+	end;
+}
+
+1@glast,44,357,8	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_04	4_F_FENRIR
+1@glast,49,363,4	duplicate(#effect_glast_event01_1)	Gigantes#semi1	4_GIGANTES_SMALL
+1@glast,41,363,4	duplicate(#effect_glast_event01_1)	Gigantes#semi2	4_GIGANTES_SMALL
+1@glast,46,364,4	duplicate(#effect_glast_event01_1)	Sarah Irene#glast_10	4_F_SARAH
+
+1@glast,52,345,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_1	CLEAR_NPC
+1@glast,44,350,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_2	CLEAR_NPC
+1@glast,35,360,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_3	CLEAR_NPC
+1@glast,44,360,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_4	CLEAR_NPC
+1@glast,52,360,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_5	CLEAR_NPC
+1@glast,35,368,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_6	CLEAR_NPC
+1@glast,53,368,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_7	CLEAR_NPC
+1@glast,44,371,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_8	CLEAR_NPC
+1@glast,44,366,4	duplicate(#effect_glast_event01_1)	#effect_glast_event02_bis	CLEAR_NPC
+
+// Event top side
+1@glast,133,365,0	script	#glast_event_13	HIDDEN_WARP_NPC,8,8,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_event_13");
+	//for ( .@i = 1; .@i < 8; .@i++ )
+	//	disablenpc instance_npcname("#glast_event_warp_" + .@i);
+	mes "";
+	cutin "fenrir_a.bmp",2;
+	sleep2 1000;
+	npctalk "Fenrith Fenrir: I need to go to Glast Heim Castle to retrieve the sword of Baldur.", 'fenrir_5$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: It could be difficult alone, I would gratefully accept your help.", 'fenrir_5$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Since there isn't enough time, we can't wait long.", 'fenrir_5$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: I will wait in the central castle of Glast Heim for about 5 minutes.", 'fenrir_5$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Since it is dangerous you do not have to feel obligated to help me. I will try by myself if I have to.", 'fenrir_5$;
+	viewpoint 1,199,237,1,0xFF0000;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Then I will go on ahead! Warp!", 'fenrir_5$;
+	cutin "",255;
+	donpcevent instance_npcname("#glast_event_13") + "::OnBar";
+	end;
+OnBar:
+	progressbar_npc "000000",3, 'fenrir_5$;
+	disablenpc 'fenrir_5$;
+	donpcevent instance_npcname("#fenrir_boss_final_2") + "::OnStart";// timer (5 mins)
+	enablenpc instance_npcname("#glast_move_03");
+	enablenpc instance_npcname("#glast_event_15");
+	enablenpc 'fenrir_6$;
+	end;
+}
+
+1@glast,133,365,4	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_05	4_F_FENRIR
+
+// Skipped left side
+1@glast,1,1,0	script	#fenrir_left_final_2	HIDDEN_WARP_NPC,{
+	end;
+OnStart:
+	enablenpc instance_npcname("#fenrir_left_final_2");
+	initnpctimer;
+	end;
+OnTimer300000:
+	'skip_left_part = 1;
+	disablenpc instance_npcname("#glast_event_7");
+	disablenpc 'fenrir_3$;
+	mapannounce 'map_glast$, "Fenrith Fenrir: Alright! We have defeated a Gigantes!", bc_map,0xEBFF;
+	end;
+OnTimer302000:
+	mapannounce 'map_glast$, "Sarah Irene: As expected, Fenrith Fenrir, you do not yield easily!", bc_map,0xEBFF;
+	end;
+OnTimer305000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: Get away from the Sentinel Breeze immediately!", bc_map,0xEBFF;
+	end;
+OnTimer307000:
+	mapannounce 'map_glast$, "Sarah Irene: Hehe.. I can't do that!", bc_map,0xEBFF;
+	end;
+OnTimer309000:
+	mapannounce 'map_glast$, "Sarah Irene: If you want it back come to Glast Heim Castle! I shall be waiting!", bc_map,0xEBFF;
+	end;
+OnTimer311000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: I need to go to Glast Heim Castle to retrieve the sword of Baldur", bc_map,0xEBFF;
+	end;
+OnTimer313000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: It may be difficult alone. If you are listening I will gratefully accept your help.", bc_map,0xEBFF;
+	end;
+OnTimer315000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: Since there isn't enough time, we can't wait long.", bc_map,0xEBFF;
+	end;
+OnTimer317000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: I will wait in the central castle of Glast Heim for about 5 minutes.", bc_map,0xEBFF;
+	end;
+OnTimer319000:
+	stopnpctimer;
+	mapannounce 'map_glast$, "Fenrith Fenrir: Since it is dangerous you do not have to feel obligated to help me. I will try by myself if I have to.", bc_map,0xEBFF;
+	enablenpc instance_npcname("#glast_move_03");
+	enablenpc 'fenrir_6$;
+	enablenpc instance_npcname("#glast_event_15");
+	disablenpc instance_npcname("#fenrir_left_final_2");
+	donpcevent instance_npcname("#fenrir_boss_final_2") + "::OnStart";// timer (5 mins)
+	end;
+OnStop:
+	stopnpctimer;
+	disablenpc instance_npcname("#fenrir_left_final_2");
+	end;
+}
+
+// Stairs final room
+1@glast,200,268,0	script	#glast_event_15	HIDDEN_WARP_NPC,7,7,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_move_03");
+	disablenpc instance_npcname("#glast_event_15");
+	donpcevent instance_npcname("#fenrir_boss_final_2") + "::OnStop";
+	mes "";
+	sleep2 1000;
+	npctalk "Fenrith Fenrir: I was waiting. Thank you for not being late.", 'fenrir_6$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Let us climb the castle to retrieve Sentinel Breeze! Sarah will be waiting!", 'fenrir_6$;
+	sleep2 3000;
+	disablenpc 'fenrir_6$;
+	enablenpc instance_npcname("#glast_move_03a");
+	enablenpc instance_npcname("#glast_event_18");
+	enablenpc instance_npcname("Sarah Irene#glast_17");
+	enablenpc 'fenrir_7$;
+	end;
+}
+
+1@glast,200,268,4	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_06	4_F_FENRIR
+
+// Final room
+1@glast,199,336,0	script	#glast_event_18	HIDDEN_WARP_NPC,10,10,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_event_18");
+	mes "";
+	cutin "sarah_hero3.bmp",0;
+	sleep2 1000;
+	npctalk "Sarah Irene: It seemed like forever waiting for you~ Fenrith Fenrir.", 'sarah_17$;
+	sleep2 3000;
+	cutin "fenrir_b.bmp",2;
+	npctalk "Fenrith Fenrir: No need for useless words, hand over the Sentinel Breeze now!", 'fenrir_7$;
+	sleep2 3000;
+	cutin "sarah_hero3.bmp",0;
+	npctalk "Sarah Irene: Try if you can.", 'sarah_17$;
+	sleep2 3000;
+	cutin "fenrir_b.bmp",2;
+	npctalk "Fenrith Fenrir: Sarah may be too difficult for you to face alone. I must face her!", 'fenrir_7$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Pure white shackles, eternal prison, make a deal with me now!", 'fenrir_7$;
+	donpcevent instance_npcname("#glast_event_18") + "::OnBar";
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: White Imprison!!", 'fenrir_7$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	sleep2 3000;
+	npctalk "Sarah Irene: Hurk.... he..", 'sarah_17$;
+	npctalk "Fenrith Fenrir: I will weaken Sarah with white imprison and face her while she's shackled,", 'fenrir_7$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: you take care of the monsters she summons. I'm counting on you.", 'fenrir_7$;
+	sleep2 3000;
+	unittalk getcharid(3), "" + strcharinfo(0) + " : Will do. Powerful enemies make my blood boil.";
+	sleep2 6000;
+	npctalk "Fenrith Fenrir: This is a strategy to attack at once and finish Sarah off while she is in critical condition. Remember, our opponent is strong.", 'fenrir_7$;
+	sleep2 3000;
+	cutin "sarah_hero3_2.bmp",0;
+	npctalk "Sarah Irene: So your plan was to tie me up with this sort of trick?", 'sarah_17$;
+	sleep2 3000;
+	npctalk "Sarah Irene: Furthermore you borrow the assistance of such rookie adventurers...", 'sarah_17$;
+	sleep2 3000;
+	npctalk "Sarah Irene: You need to disappear from here along with that worn out blade!!", 'sarah_17$;
+	sleep2 3000;
+	cutin "",255;
+	hideonnpc 'sarah_17$;
+	donpcevent instance_npcname("#glast_event_19") + "::OnEvent";
+	monster 'map_glast$,200,336, "Sarah Irene#1",3190,1, instance_npcname("#fenrir_boss_final_1") + "::OnBossDead";	// MM_SARAH
+	'boss_id = $@mobid[0];
+	end;
+OnBar:
+	progressbar_npc "000000",3, 'fenrir_7$;
+	end;
+}
+
+1@glast,200,336,4	duplicate(#effect_glast_event01_1)	Sarah Irene#glast_17	4_F_SARAH
+
+1@glast,197,330,8	script	Fenrith Fenrir#glast_07	4_F_FENRIR,{
+	end;
+OnStart:
+	initnpctimer;
+	end;
+OnTimer1000:
+	specialeffect EF_TETRACASTING;
+	initnpctimer;
+	end;
+OnStop:
+	stopnpctimer;
+	end;
+}
+
+1@glast,212,350,0	script	#glast_event_19	HIDDEN_WARP_NPC,{
+	end;
+OnEvent:
+	enablenpc instance_npcname("#glast_event_19");
+	enablenpc instance_npcname("#fenrir_boss_final_1");
+	initnpctimer;
+	specialeffect EF_PRIMECHARGE4, AREA, 'fenrir_7$;
+	npctalk "Fenrith Fenrir: Lethal poison, Dark clouds, appear before me and show a most painful death!", 'fenrir_7$;
+	monster 'map_glast$,190,341, "Large Gigantes#a1", 3194,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN1
+	monster 'map_glast$,214,331, "Large Gigantes#b2", 3195,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN2
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer1000:
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer10000:
+	callsub S_Hit,1;
+	npctalk "Fenrith Fenrir: Go! Cloud Kill!!!!!", 'fenrir_7$;
+	specialeffect EF_POISONSMOKE, AREA, 'sarah_17$;
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		specialeffect EF_POISONSMOKE, AREA, instance_npcname("#effect_glast_event03_" + .@i);
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer10500:
+	unittalk 'boss_id, "Sarah Irene: That was sudden Fenrir. Is that all you've got?";
+	end;
+OnTimer11000:
+	specialeffect EF_POISONSMOKE2, AREA, 'sarah_17$;
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_1");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_2");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_3");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_4");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_5");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_6");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_7");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_8");
+	end;
+OnTimer13000:
+	npctalk "Fenrith Fenrir: Lethal poison, Dark clouds, appear before me and show a most painful death!", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE4, AREA, 'fenrir_7$;
+	specialeffect EF_POISONSMOKE2, AREA, 'sarah_17$;
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_1");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_2");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_3");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_4");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_5");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_6");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_7");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_8");
+	end;
+OnTimer20000:
+	callsub S_Hit,2;
+	npctalk "Fenrith Fenrir: Go! Cloud Kill!!!!!", 'fenrir_7$;
+	specialeffect EF_POISONSMOKE, AREA, 'sarah_17$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		specialeffect EF_POISONSMOKE, AREA, instance_npcname("#effect_glast_event03_" + .@i);
+	progressbar_npc "000000",30, 'fenrir_7$;
+	end;
+OnTimer20500:
+	unittalk 'boss_id, "Sarah Irene: Try to entertain me a little more!!";
+	end;
+OnTimer21000:
+	specialeffect EF_POISONSMOKE2, AREA, 'sarah_17$;
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_1");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_2");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_3");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_4");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_5");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_6");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_7");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_8");
+	end;
+OnTimer23000:
+	npctalk "Fenrith Fenrir: I speak to you who controls fire, I Fenrith, desire a fire that does not go out...", 'fenrir_7$;
+	specialeffect EF_BEGINSPELL_YB, AREA, 'fenrir_7$;
+	specialeffect EF_POISONSMOKE2, AREA, 'sarah_17$;
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_1");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_2");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_3");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_4");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_5");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_6");
+	specialeffect EF_POISONSMOKE2, AREA, instance_npcname("#effect_glast_event03_7");
+	specialeffect EF_ENCHANTPOISON, AREA, instance_npcname("#effect_glast_event03_8");
+	end;
+OnTimer36000:
+	npctalk "Fenrith Fenrir: Endlessly burning conflagration, a fire that can scorch even the soul!! Appear before me now!!", 'fenrir_7$;
+	specialeffect EF_BEGINSPELL_YB, AREA, 'fenrir_7$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer50000:
+	callsub S_Hit,3;
+	npctalk "Fenrith Fenrir: Emerge!! Fire Insignia!!!!", 'fenrir_7$;
+	specialeffect EF_DEMONICFIRE, AREA, 'sarah_17$;
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer50500:
+	unittalk 'boss_id, "Sarah Irene: Oh... not bad? But not good enough!!";
+	end;
+OnTimer51000:
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer53000:
+	npctalk "Fenrith Fenrir: The root of earthshaking power!! Fear the power of the earth!!!", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE4, AREA, 'fenrir_7$;
+	end;
+OnTimer60000:
+	callsub S_Hit,4;
+	npctalk "Fenrith Fenrir: Go forth!! Heaven's Drive!!!", 'fenrir_7$;
+	specialeffect EF_HEAVENSDRIVE, AREA, 'sarah_17$;
+	monster 'map_glast$,190,341, "Large Gigantes#a1", 3194,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN1
+	monster 'map_glast$,214,331, "Large Gigantes#b2", 3195,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN2
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer60500:
+	unittalk 'boss_id, "Sarah Irene: Why don't you stop your childish magic, Fenrir?";
+	end;
+OnTimer63000:
+	specialeffect EF_PRIMECHARGE4, AREA, 'fenrir_7$;
+	npctalk "Fenrith Fenrir: The root of earthshaking power!! Fear the power of the earth!!!", 'fenrir_7$;
+	end;
+OnTimer70000:
+	callsub S_Hit,5;
+	npctalk "Fenrith Fenrir: Go forth!! Heaven's Drive!!!", 'fenrir_7$;
+	specialeffect EF_HEAVENSDRIVE, AREA, 'sarah_17$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	progressbar_npc "000000",30, 'fenrir_7$;
+	end;
+OnTimer70500:
+	unittalk 'boss_id, "Sarah Irene: Do you think that is enough to beat me?";
+	end;
+OnTimer73000:
+	npctalk "Fenrith Fenrir: The mercilessly cold breath of the Northern winds,", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE2, AREA, 'fenrir_7$;
+	end;
+OnTimer85000:
+	npctalk "Fenrith Fenrir: Come like the silent dawn mist and freeze everything!!", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE2, AREA, 'fenrir_7$;
+	end;
+OnTimer100000:
+	callsub S_Hit,6;
+	npctalk "Fenrith Fenrir: Appear!!! Frost Misty!!!!!", 'fenrir_7$;
+	specialeffect EF_FROSTMYSTY, AREA, 'sarah_17$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	specialeffect EF_FROSTMYSTY, AREA, 'sarah_17$;
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer100500:
+	unittalk 'boss_id, "Sarah Irene: Not bad but.. not even close!";
+	end;
+OnTimer103000:
+	npctalk "Fenrith Fenrir: The power of doubt, a powerful force, the power of deeply hidden secrets in the mind!!!", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE, AREA, 'fenrir_7$;
+	end;
+OnTimer110000:
+	callsub S_Hit,7;
+	npctalk "Fenrith Fenrir: Now!!! Psychic Wave!!!!", 'fenrir_7$;
+	specialeffect EF_SPR_PLANT10, AREA, 'sarah_17$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer110500:
+	unittalk 'boss_id, "Sarah Irene: Ugh... that is no use Fenrir!";
+	end;
+OnTimer113000:
+	npctalk "Fenrith Fenrir: The power of doubt, a powerful force, the power of deeply hidden secrets in the mind!!!", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE, AREA, 'fenrir_7$;
+	end;
+OnTimer120000:
+	callsub S_Hit,8;
+	npctalk "Fenrith Fenrir: Now!!! Psychic Wave!!!!", 'fenrir_7$;
+	specialeffect EF_SPR_PLANT10, AREA, 'sarah_17$;
+	monster 'map_glast$,190,341, "Large Gigantes#a1", 3194,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN1
+	monster 'map_glast$,214,331, "Large Gigantes#b2", 3195,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN2
+	progressbar_npc "000000",30, 'fenrir_7$;
+	end;
+OnTimer120500:
+	unittalk 'boss_id, "Sarah Irene: Hurk.. such an annoying magic bombardment!!";
+	end;
+OnTimer123000:
+	npctalk "Fenrith Fenrir: I speak to you who controls fire, I Fenrith, desire a fire that does not go out...", 'fenrir_7$;
+	specialeffect EF_BEGINSPELL_YB, AREA, 'fenrir_7$;
+	end;
+OnTimer135000:
+	npctalk "Fenrith Fenrir: Endlessly burning conflagration, a fire that can scorch even the soul!! Appear before me now!!", 'fenrir_7$;
+	specialeffect EF_BEGINSPELL_YB, AREA, 'fenrir_7$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer150000:
+	callsub S_Hit,9;
+	npctalk "Fenrith Fenrir: Emerge!! Fire Insignia!!!!", 'fenrir_7$;
+	specialeffect EF_DEMONICFIRE, AREA, 'sarah_17$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer150500:
+	unittalk 'boss_id, "Sarah Irene: I am Sarah Irene! I will not fall so easily!!!";
+	end;
+OnTimer153000:
+	npctalk "Fenrith Fenrir: True wrath of the sky, thunderbolt that may split the earth... Fall before me now!!", 'fenrir_7$;
+	specialeffect EF_DQ9_CHARGE3, AREA, 'fenrir_7$;
+	end;
+OnTimer160000:
+	callsub S_Hit,10;
+	npctalk "Fenrith Fenrir: Come now!! Thunder Storm!!!!!", 'fenrir_7$;
+	specialeffect EF_THUNDERSTORM2, AREA, 'sarah_17$;
+	unittalk 'boss_id, "Sarah Irene: Ugh...you are.. stronger than I predicted Fenrir...";
+	progressbar_npc "000000",10, 'fenrir_7$;
+	end;
+OnTimer160500:
+	unittalk 'boss_id, "Sarah Irene: Ugh...you are.. stronger than I predicted Fenrir...";
+	end;
+OnTimer163000:
+	npctalk "Fenrith Fenrir: True wrath of the sky, thunderbolt that may split the earth... Fall before me now!!", 'fenrir_7$;
+	specialeffect EF_DQ9_CHARGE3, AREA, 'fenrir_7$;
+	end;
+OnTimer170000:
+	callsub S_Hit,11;
+	npctalk "Fenrith Fenrir: Come now!! Thunder Storm!!!!!", 'fenrir_7$;
+	specialeffect EF_THUNDERSTORM2, AREA, 'sarah_17$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	progressbar_npc "000000",30, 'fenrir_7$;
+	end;
+OnTimer170500:
+	unittalk 'boss_id, "Sarah Irene: Argh!!!!!! Ahhh!!!!!";
+	end;
+OnTimer173000:
+	npctalk "Fenrith Fenrir: The mercilessly cold breath of the Northern winds,", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE2, AREA, 'fenrir_7$;
+	end;
+OnTimer180000:
+	monster 'map_glast$,190,341, "Large Gigantes#a1", 3194,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN1
+	monster 'map_glast$,185,331, "Large Gigantes#a2", 3194,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN1
+	monster 'map_glast$,209,341, "Large Gigantes#b1", 3195,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN2
+	monster 'map_glast$,214,331, "Large Gigantes#b2", 3195,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN2
+	end;
+OnTimer185000:
+	npctalk "Fenrith Fenrir: Come like the silent dawn mist and freeze everything!!", 'fenrir_7$;
+	specialeffect EF_PRIMECHARGE2, AREA, 'fenrir_7$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer200000:
+	callsub S_Hit,12;
+	npctalk "Fenrith Fenrir: Appear!!! Frost Misty!!!!!", 'fenrir_7$;
+	specialeffect EF_FROSTMYSTY, AREA, 'sarah_17$;
+	donpcevent 'fenrir_7$ + "::OnStart";
+	progressbar_npc "000000",50, 'fenrir_7$;
+	end;
+OnTimer200500:
+	unittalk 'boss_id, "Sarah Irene: Argh!!! I will kill you all!!!!!!";
+	specialeffect EF_FROSTMYSTY, AREA, 'sarah_17$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer203000:
+	npctalk "Fenrith Fenrir: Heaven's sword piercing the sky", 'fenrir_7$;
+	specialeffect EF_BLACKBODY, AREA, 'fenrir_7$;
+	specialeffect EF_RECOGNIZED, AREA, 'fenrir_7$;
+	end;
+OnTimer216000:
+	npctalk "Fenrith Fenrir: I wish to borrow your strength for a moment!!", 'fenrir_7$;
+	end;
+OnTimer230000:
+	npctalk "Fenrith Fenrir: Let fall here your extreme strength that can tear even the vacuum!!", 'fenrir_7$;
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer239000:
+	monster 'map_glast$,190,341, "Large Gigantes#a1", 3194,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN1
+	monster 'map_glast$,185,331, "Large Gigantes#a2", 3194,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN1
+	monster 'map_glast$,209,341, "Large Gigantes#b1", 3195,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN2
+	monster 'map_glast$,214,331, "Large Gigantes#b2", 3195,1, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";// MM_L_GIGAN2
+	end;
+OnTimer240000:
+	npctalk "Fenrith Fenrir: Sword that can control life and death, and pierce space time!!!", 'fenrir_7$;
+	end;
+OnTimer250000:
+	npctalk "Fenrith Fenrir: Come out Baretis Spear!!!!!!", 'fenrir_7$;
+	specialeffect EF_PRESSURE3, AREA, 'sarah_17$;
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		specialeffect EF_PRESSURE3, AREA, instance_npcname("#effect_glast_event03_" + .@i);
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	end;
+OnTimer253000:
+	setunitdata 'boss_id, UMOB_HP, 100;
+	specialeffect EF_PRESSURE3, AREA, 'sarah_17$;
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		specialeffect EF_PRESSURE3, AREA, instance_npcname("#effect_glast_event03_" + .@i);
+	npctalk "Fenrith Fenrir: Now! I put Sarah in critical condition! You have to finish her off! Attack her quickly! Sarah is strong!", 'fenrir_7$;
+	mapannounce 'map_glast$, "Fenrith Fenrir: Now! I put Sarah in critical condition! You have to finish her off!! Attack her quickly! Sarah is strong!", bc_map,0xEBFF;
+	npctalk "Sarah Irene: Hurk...this.. cannot happen!!! I cannot lose!!!!!", 'sarah_17$;
+	end;
+OnTimer263000:
+	npctalk "Fenrith Fenrir: Since you may not be able to finish her off alone, I will prepare one final spell!!", 'fenrir_7$;
+	progressbar_npc "000000",50, 'fenrir_7$;
+	end;
+OnTimer273000:
+	specialeffect EF_BOTTOM_BASILICA2, AREA, 'sarah_17$;
+	npctalk "Fenrith Fenrir: Heaven's sword piercing the sky", 'fenrir_7$;
+	specialeffect EF_RECOGNIZED, AREA, 'fenrir_7$;
+	specialeffect EF_BLACKBODY, AREA, 'fenrir_7$;
+	end;
+OnTimer283000:
+	npctalk "Fenrith Fenrir: I wish to borrow your strength for a moment!!", 'fenrir_7$;
+	end;
+OnTimer293000:
+	npctalk "Fenrith Fenrir: Let fall here your extreme strength that can tear even the vacuum!!";
+	end;
+OnTimer303000:
+	npctalk "Fenrith Fenrir: Sword that can control life and death, and pierce space time!!!";
+	end;
+OnTimer313000:
+	npctalk "Fenrith Fenrir: Come out Baretis Spear!!!!!!";
+	specialeffect EF_PRESSURE3, AREA, 'sarah_17$;
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		specialeffect EF_PRESSURE3, AREA, instance_npcname("#effect_glast_event03_" + .@i);
+	donpcevent 'fenrir_7$ + "::OnStop";
+	end;
+OnTimer316000:
+	specialeffect EF_PRESSURE3, AREA, 'sarah_17$;
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		specialeffect EF_PRESSURE3, AREA, instance_npcname("#effect_glast_event03_" + .@i);
+	killmonster 'map_glast$, instance_npcname("#fenrir_boss_final_1") + "::OnBossDead";
+	donpcevent instance_npcname("#fenrir_boss_final_1") + "::OnBossDead";
+	end;
+
+OnStop:
+	stopnpctimer;
+	disablenpc instance_npcname("#glast_event_19");
+	end;
+
+S_Hit:
+	getunitdata 'boss_id, .@data;
+	.@hp = .@data[UMOB_MAXHP] - ((.@data[UMOB_MAXHP] * getarg(0)) / 13);
+	setunitdata 'boss_id, UMOB_HP, .@hp;
+	return;
+}
+
+1@glast,1,1,0	script	#fenrir_boss_final_1	HIDDEN_WARP_NPC,{
+	end;
+OnBossDead:
+	donpcevent instance_npcname("#glast_event_19") + "::OnStop";
+	initnpctimer;
+	end;
+OnTimer1000:
+	killmonster 'map_glast$, instance_npcname("#fenrir_boss_final_1") + "::OnMobDead";
+	end;
+OnTimer6000:
+	disablenpc 'sarah_17$;
+	disablenpc 'fenrir_7$;
+	enablenpc 'fenrir_8$;
+	enablenpc 'sarah_20$;
+	end;
+OnTimer9000:
+	npctalk "Fenrith Fenrir: Sentinel Breeze! I have it in my hand!", 'fenrir_8$;
+	end;
+OnTimer12000:
+	npctalk "Sarah Irene: Hurk....", 'sarah_20$;
+	end;
+OnTimer15000:
+	npctalk "Fenrith Fenrir: I can find Baldur with this!", 'fenrir_8$;
+	end;
+OnTimer18000:
+	npctalk "Sarah Irene: Not yet!!", 'sarah_20$;
+	progressbar_npc "000000",2, 'sarah_20$;
+	end;
+OnTimer21000:
+	specialeffect EF_FIREPILLARON, AREA, 'fenrir_8$;
+	disablenpc 'fenrir_8$;
+	enablenpc 'fenrir_9$;
+	end;
+OnTimer24000:
+	npctalk "Sarah Irene: Hehe... You evade well like a rat.", 'sarah_20$;
+	end;
+OnTimer27000:
+	npctalk "Sarah Irene: However, I cannot let you leave with that.", 'sarah_20$;
+	end;
+OnTimer30000:
+	npctalk "Sarah Irene: I will blow this entire castle away! Yaah!", 'sarah_20$;
+	progressbar_npc "000000",15, 'sarah_20$;
+	end;
+OnTimer33000:
+	npctalk "Fenrith Fenrir: She is planning to collapse this place! I must perform a large scale teleportation!!!", 'fenrir_9$;
+	progressbar_npc "000000",6, 'fenrir_9$;
+	end;
+OnTimer36000:
+	npctalk "Fenrith Fenrir: Farewell Valkyrie!! I shall take the Sentinel Breeze! So long!", 'fenrir_9$;
+	end;
+OnTimer39000:
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		specialeffect EF_LORD, AREA, instance_npcname("#effect_glast_event03_" + .@i);
+	disablenpc 'fenrir_9$;
+	end;
+OnTimer40000:
+	stopnpctimer;
+	enablenpc instance_npcname("#glast_event_24");
+	enablenpc instance_npcname("Fenrith Fenrir#glast_10");
+	//for ( .@i = 11; .@i <= 16; .@i++ )
+	//	enablenpc instance_npcname("#glast_event_warp_" + .@i);// warp to 197,221
+	areawarp 'map_glast$,181,326,218,352, 'map_glast$,197,221;
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		disablenpc instance_npcname("#effect_glast_event03_" + .@i);
+	disablenpc 'sarah_20$;
+	disablenpc instance_npcname("#fenrir_boss_final_1");
+	end;
+
+OnMobDead:
+	end;
+}
+
+1@glast,199,348,8	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_08	4_F_FENRIR
+1@glast,201,346,4	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_09	4_F_FENRIR
+1@glast,197,339,8	duplicate(#effect_glast_event01_1)	Sarah Irene#glast_20	4_F_SARAH
+
+1@glast,201,336,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_1	CLEAR_NPC
+1@glast,201,337,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_2	CLEAR_NPC
+1@glast,200,337,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_3	CLEAR_NPC
+1@glast,199,337,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_4	CLEAR_NPC
+1@glast,199,336,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_5	CLEAR_NPC
+1@glast,199,335,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_6	CLEAR_NPC
+1@glast,200,335,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_7	CLEAR_NPC
+1@glast,201,335,4	duplicate(#effect_glast_event01_1)	#effect_glast_event03_8	CLEAR_NPC
+
+// Outside final room
+1@glast,200,224,0	script	#glast_event_24	HIDDEN_WARP_NPC,7,7,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("#glast_event_24");
+	mes "";
+	sleep2 1500;
+	cutin "fenrir_b.bmp",2;
+	npctalk "Fenrith Fenrir: Hehe.. You are certainly skilled but I think you have underestimated me, Valkyrie.", 'fenrir_10$;
+	sleep2 3000;
+	mapannounce 'map_glast$, "Sarah Irene: You rather entertain me Fenrith...", bc_map,0xEBFF;
+	sleep2 3000;
+	mapannounce 'map_glast$, "Sarah Irene: Did you think you can escape that easily?", bc_map,0xEBFF;
+	sleep2 3000;
+	mapannounce 'map_glast$, "Sarah Irene: I shall turn Glast Heim into hell!!", bc_map,0xEBFF;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: If we don't escape now we will suffer a gruesome fate by Sarah's monsters and magic!", 'fenrir_10$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: Let's meet at Glast Heim entrance where we first met! If we flee that far it should be safe!", 'fenrir_10$;
+	sleep2 3000;
+	npctalk "Fenrith Fenrir: There is no time! Hurry!", 'fenrir_10$;
+	sleep2 3000;
+	cutin "",255;
+	disablenpc 'fenrir_10$;
+	donpcevent instance_npcname("#sarah_wrath") + "::OnStart";
+	end;
+}
+
+1@glast,200,224,4	duplicate(#effect_glast_event01_1)	Fenrith Fenrir#glast_10	4_F_FENRIR
+
+// Skipped final room
+1@glast,1,1,0	script	#fenrir_boss_final_2	HIDDEN_WARP_NPC,{
+	end;
+OnStart:
+	enablenpc instance_npcname("#fenrir_boss_final_2");
+	initnpctimer;
+	end;
+OnTimer300000:
+	disablenpc instance_npcname("#glast_move_03");
+	disablenpc instance_npcname("#glast_event_15");
+	disablenpc 'fenrir_6$;
+	end;
+OnTimer305000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: Sentinel Breeze! I have it in my hand!", bc_map,0xEBFF;
+	end;
+OnTimer308000:
+	mapannounce 'map_glast$, "Sarah Irene: Hurk....", bc_map,0xEBFF;
+	end;
+OnTimer311000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: Hehe.. You are certainly skilled but I think you have underestimated me, Valkyrie.", bc_map,0xEBFF;
+	end;
+OnTimer314000:
+	mapannounce 'map_glast$, "Sarah Irene: You rather entertain me Fenrith...", bc_map,0xEBFF;
+	end;
+OnTimer317000:
+	mapannounce 'map_glast$, "Sarah Irene: Did you think you can escape that easily?", bc_map,0xEBFF;
+	end;
+OnTimer320000:
+	mapannounce 'map_glast$, "Sarah Irene: I shall turn Glast Heim into hell!!", bc_map,0xEBFF;
+	end;
+OnTimer323000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: If we don't escape now we will suffer a gruesome fate by Sarah's monsters and magic!", bc_map,0xEBFF;
+	end;
+OnTimer326000:
+	mapannounce 'map_glast$, "Fenrith Fenrir: Let's meet at Glast Heim entrance where we first met! If we flee that far it should be safe!", bc_map,0xEBFF;
+	end;
+OnTimer329000:
+	stopnpctimer;
+	mapannounce 'map_glast$, "Fenrith Fenrir: There is no time! Hurry!", bc_map,0xEBFF;
+	donpcevent instance_npcname("#sarah_wrath") + "::OnStart";
+	end;
+OnStop:
+	stopnpctimer;
+	disablenpc instance_npcname("#fenrir_boss_final_2");
+	end;
+}
+
+// Bombs
+1@glast,1,1,0	script	#sarah_wrath	HIDDEN_WARP_NPC,{
+	end;
+OnStart:
+	enablenpc instance_npcname("#sarah_wrath");
+	enablenpc instance_npcname("#glast_move_04");
+	enablenpc 'fenrir_11$;
+	enablenpc 'sarah_ego$;
+	hideonnpc 'sarah_ego$;
+	'back_to_entrance = 1;
+	enablenpc instance_npcname("#glast_move_01");
+	hideonnpc instance_npcname("#glast_move_01");
+	enablenpc instance_npcname("#glast_move_05");
+	initnpctimer;
+	end;
+OnTimer10000:
+	mapannounce 'map_glast$, "Sarah Irene: Absurd little thing, you think you can escape that easily?", bc_map,0xEBFF;
+	callsub S_Spawn,0;
+	end;
+OnTimer50000:
+	mapannounce 'map_glast$, "Sarah Irene: My minions will make sure to kill you!!!", bc_map,0xEBFF;
+	callsub S_Spawn,1;
+	end;
+OnTimer80000:
+	mapannounce 'map_glast$, "Sarah Irene: I cannot let you escape!!", bc_map,0xEBFF;
+	callsub S_Spawn,2;
+	end;
+OnTimer110000:
+	mapannounce 'map_glast$, "Sarah Irene: Fenrith Fenrir.... Did you think I couldn't track you because you fled?", bc_map,0xEBFF;
+	callsub S_Spawn,3;
+	end;
+OnTimer150000:
+	mapannounce 'map_glast$, "Sarah Irene: Absurd little thing, you think you can escape that easily?", bc_map,0xEBFF;
+	callsub S_Spawn,4;
+	end;
+OnTimer300000:
+	stopnpctimer;
+	mapannounce 'map_glast$, "Sarah Irene: Bwahahahahahaha!! Glast Heim is being filled with my wrath!!", bc_map,0xEBFF;
+	for ( .@i = 1; .@i <= 14; .@i++ )
+		enablenpc instance_npcname("#glast_bomb_" + (.@i < 10 ? ("0"+.@i) : .@i));
+	end;
+OnStop:
+	stopnpctimer;
+	end;
+
+S_Spawn:
+	// inaccurate
+	switch( getarg(0) ) {
+	case 0:
+		monster 'map_glast$,204,52,"Large Gigantes#aa1",3194,1;
+		monster 'map_glast$,201,55,"Large Gigantes#aa1",3194,1;
+		monster 'map_glast$,196,53,"Large Gigantes#aa1",3194,1;
+		monster 'map_glast$,205,80,"Large Gigantes#aa2",3195,1;
+		monster 'map_glast$,210,77,"Large Gigantes#aa2",3195,1;
+		monster 'map_glast$,205,73,"Large Gigantes#aa2",3195,1;
+		monster 'map_glast$,236,96,"Large Gigantes#aa5",3194,1;
+		monster 'map_glast$,234,96,"Large Gigantes#aa5",3194,1;
+		monster 'map_glast$,234,96,"Large Gigantes#aa5",3194,1;
+		monster 'map_glast$,185,79,"Large Gigantes#bb3",3194,1;
+		monster 'map_glast$,189,78,"Large Gigantes#bb3",3194,1;
+		monster 'map_glast$,194,85,"Large Gigantes#bb3",3194,1;
+		monster 'map_glast$,168,113,"Large Gigantes#bb4",3195,1;
+		monster 'map_glast$,174,122,"Large Gigantes#bb4",3195,1;
+		break;
+	case 1:
+		monster 'map_glast$,131,182,"Large Gigantes#bb11",3194,1;
+		monster 'map_glast$,133,174,"Large Gigantes#bb11",3194,1;
+		monster 'map_glast$,134,187,"Large Gigantes#bb11",3194,1;
+		monster 'map_glast$,202,196,"Large Gigantes#aa9",3194,1;
+		monster 'map_glast$,196,194,"Large Gigantes#aa9",3194,1;
+		monster 'map_glast$,199,190,"Large Gigantes#aa9",3194,1;
+		monster 'map_glast$,233,198,"Large Gigantes#bb8",3195,1;
+		monster 'map_glast$,231,193,"Large Gigantes#bb8",3195,1;
+		monster 'map_glast$,232,196,"Large Gigantes#bb8",3195,1;
+		monster 'map_glast$,258,196,"Large Gigantes#bb7",3194,1;
+		monster 'map_glast$,265,187,"Large Gigantes#bb7",3194,1;
+		monster 'map_glast$,263,195,"Large Gigantes#bb7",3194,1;
+		monster 'map_glast$,271,106,"Large Gigantes#aa6",3195,1;
+		monster 'map_glast$,266,107,"Large Gigantes#aa6",3195,1;
+		monster 'map_glast$,272,109,"Large Gigantes#aa6",3195,1;
+		break;
+	case 2:
+		monster 'map_glast$,127,204,"Large Gigantes#bb12",3195,1;
+		monster 'map_glast$,130,205,"Large Gigantes#bb12",3195,1;
+		monster 'map_glast$,130,213,"Large Gigantes#bb12",3195,1;
+		monster 'map_glast$,139,243,"Large Gigantes#bb19",3194,1;
+		monster 'map_glast$,143,241,"Large Gigantes#bb19",3194,1;
+		monster 'map_glast$,146,234,"Large Gigantes#bb19",3194,1;
+		monster 'map_glast$,199,218,"Large Gigantes#aa14",3195,1;
+		monster 'map_glast$,201,219,"Large Gigantes#aa14",3195,1;
+		monster 'map_glast$,193,212,"Large Gigantes#aa14",3195,1;
+		monster 'map_glast$,261,251,"Large Gigantes#aa18",3195,1;
+		monster 'map_glast$,257,254,"Large Gigantes#aa18",3195,1;
+		monster 'map_glast$,257,250,"Large Gigantes#aa18",3195,1;
+		monster 'map_glast$,146,45,"Large Gigantes#bb35",3194,1;
+		monster 'map_glast$,145,49,"Large Gigantes#bb35",3194,1;
+		monster 'map_glast$,144,44,"Large Gigantes#bb35",3194,1;
+		break;
+	case 3:
+		monster 'map_glast$,67,259,"Large Gigantes#aa29",3194,1;
+		monster 'map_glast$,68,261,"Large Gigantes#aa29",3194,1;
+		monster 'map_glast$,61,260,"Large Gigantes#aa29",3194,1;
+		monster 'map_glast$,64,208,"Large Gigantes#aa30",3195,1;
+		monster 'map_glast$,67,210,"Large Gigantes#aa30",3195,1;
+		monster 'map_glast$,63,204,"Large Gigantes#aa30",3195,1;
+		monster 'map_glast$,87,57,"Large Gigantes#aa33",3194,1;
+		monster 'map_glast$,81,64,"Large Gigantes#aa33",3194,1;
+		monster 'map_glast$,83,58,"Large Gigantes#aa33",3194,1;
+		monster 'map_glast$,107,47,"Large Gigantes#aa34",3195,1;
+		monster 'map_glast$,105,45,"Large Gigantes#aa34",3195,1;
+		monster 'map_glast$,102,48,"Large Gigantes#aa34",3195,1;
+		monster 'map_glast$,80,152,"Large Gigantes#bb31",3194,1;
+		monster 'map_glast$,82,149,"Large Gigantes#bb31",3194,1;
+		monster 'map_glast$,75,156,"Large Gigantes#bb31",3194,1;
+		monster 'map_glast$,85,106,"Large Gigantes#bb32",3195,1;
+		monster 'map_glast$,82,111,"Large Gigantes#bb32",3195,1;
+		monster 'map_glast$,78,112,"Large Gigantes#bb32",3195,1;
+		monster 'map_glast$,55,149,"Large Gigantes#bb36",3195,1;
+		monster 'map_glast$,56,143,"Large Gigantes#bb36",3195,1;
+		monster 'map_glast$,49,142,"Large Gigantes#bb36",3195,1;
+		break;
+	case 4:
+		monster 'map_glast$,262,215,"Large Gigantes#aa17",3194,1;
+		monster 'map_glast$,266,212,"Large Gigantes#aa17",3194,1;
+		monster 'map_glast$,260,219,"Large Gigantes#aa17",3194,1;
+		monster 'map_glast$,253,47,"Large Gigantes#aa26",3195,1;
+		monster 'map_glast$,263,42,"Large Gigantes#aa26",3195,1;
+		monster 'map_glast$,255,39,"Large Gigantes#aa26",3195,1;
+		monster 'map_glast$,202,219,"Large Gigantes#bb15",3194,1;
+		monster 'map_glast$,201,222,"Large Gigantes#bb15",3194,1;
+		monster 'map_glast$,201,220,"Large Gigantes#bb15",3194,1;
+		monster 'map_glast$,231,210,"Large Gigantes#bb16",3195,1;
+		monster 'map_glast$,345,117,"Large Gigantes#bb27",3194,1;
+		monster 'map_glast$,341,115,"Large Gigantes#bb27",3194,1;
+		monster 'map_glast$,351,121,"Large Gigantes#bb27",3194,1;
+		monster 'map_glast$,346,252,"Large Gigantes#bb28",3195,1;
+		monster 'map_glast$,351,256,"Large Gigantes#bb28",3195,1;
+		monster 'map_glast$,345,254,"Large Gigantes#bb28",3195,1;
+		break;
+	}
+	end;
+}
+
+1@glast,290,43,0	script	#glast_bomb_01	HIDDEN_WARP_NPC,10,10,{
+	end;
+OnTouch:
+	unitkill 0;
+	mapannounce 'map_glast$, "Sarah Irene: Bwahahahahahaha!! Glast Heim is being filled with my wrath!!", bc_map,0xEBFF;
+	specialeffect2 EF_LORD;
+	sleep2 1000;
+	specialeffect2 EF_LORD;
+	end;
+}
+
+1@glast,234,47,0	duplicate(#glast_bomb_01)	#glast_bomb_02	HIDDEN_WARP_NPC,10,10
+1@glast,265,175,0	duplicate(#glast_bomb_01)	#glast_bomb_03	HIDDEN_WARP_NPC,10,10
+1@glast,135,176,0	duplicate(#glast_bomb_01)	#glast_bomb_04	HIDDEN_WARP_NPC,10,10
+1@glast,146,238,0	duplicate(#glast_bomb_01)	#glast_bomb_05	HIDDEN_WARP_NPC,10,10
+1@glast,165,212,0	duplicate(#glast_bomb_01)	#glast_bomb_06	HIDDEN_WARP_NPC,10,10
+1@glast,232,212,0	duplicate(#glast_bomb_01)	#glast_bomb_07	HIDDEN_WARP_NPC,10,10
+1@glast,253,241,0	duplicate(#glast_bomb_01)	#glast_bomb_08	HIDDEN_WARP_NPC,10,10
+1@glast,268,290,0	duplicate(#glast_bomb_01)	#glast_bomb_09	HIDDEN_WARP_NPC,10,10
+1@glast,132,289,0	duplicate(#glast_bomb_01)	#glast_bomb_10	HIDDEN_WARP_NPC,10,10
+1@glast,199,115,0	duplicate(#glast_bomb_01)	#glast_bomb_11	HIDDEN_WARP_NPC,10,10
+1@glast,139,46,0	duplicate(#glast_bomb_01)	#glast_bomb_12	HIDDEN_WARP_NPC,10,10
+1@glast,82,86,0	duplicate(#glast_bomb_01)	#glast_bomb_13	HIDDEN_WARP_NPC,10,10
+1@glast,68,226,0	duplicate(#glast_bomb_01)	#glast_bomb_14	HIDDEN_WARP_NPC,10,10
+
+// Back to entrance
+// event in #glast_move_01
+1@glast,359,294,4	script	Fenrith Fenrir#glast_11	4_F_FENRIR,{
+	if (isbegin_quest(9337) == 0) {
+		cutin "fenrir_a.bmp",2;
+		mes "[Fenrith Fenrir]";
+		mes "You arrived safely!";
+		mes "The dangerous situation";
+		mes "had me worried.";
+		mes "It was difficult and dangerous work";
+		mes "so I am grateful for your help.";
+		next;
+		mes "[Fenrir]";
+		mes "I feel we will meet again";
+		mes "but perhaps it is just my imagination?";
+		mes "Mm.. that would be nice.";
+		next;
+		mes "[Fenrir]";
+		mes "We worked well together";
+		mes "so I hope we will meet again.";
+		mes "And watch for Sarah,";
+		mes "harm can come your way as well.";
+		setquest 9337;// Wrapping up the Adventure
+		getitem 607,1;// Yggdrasilberry
+		getitem 608,1;// Seed_Of_Yggdrasil
+		close2;
+		cutin "",255;
+		end;
+	}
+	mes "[Fenrir]";
+	mes "We worked well together";
+	mes "so I hope we will meet again.";
+	close;
+}
+
+1@glast,353,290,8	duplicate(#effect_glast_event01_1)	Sarah Irene's alter ego	4_F_SARAH
+
+// Shards Events
+1@glast,290,147,4	script	Ancient Gigantes#glast_1	4_GIGANTES_BIG,6,6,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("Ancient Gigantes#glast_1");
+	.@label$ = instance_npcname("Ancient Gigantes#glast_1") + "::OnMobDead";
+	monster 'map_glast$,290,147, "Ancient Gigantes#X1",3196,1, .@label$;		// MM_L_GIGAN3
+	monster 'map_glast$,290,146, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	monster 'map_glast$,288,147, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	unittalk getcharid(3), "" + strcharinfo(0) + " : The Ancient Gigantes that Professor Bernhard spoke of!!";
+	enablenpc instance_npcname("Stone Gargoyle#glast_01");
+	enablenpc instance_npcname("Stone Gargoyle#glast_02");
+	enablenpc instance_npcname("Stone Gargoyle#glast_03");
+	enablenpc instance_npcname("Stone Gargoyle#glast_04");
+	enablenpc instance_npcname("Stone Gargoyle#glast_05");
+	enablenpc instance_npcname("Stone Gargoyle#glast_06");
+	end;
+OnMobDead:
+	end;
+}
+
+1@glast,300,248,4	script	Ancient Gigantes#glast_2	4_GIGANTES_BIG,4,4,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("Ancient Gigantes#glast_2");
+	.@label$ = instance_npcname("Ancient Gigantes#glast_2") + "::OnMobDead";
+	monster 'map_glast$,300,248, "Ancient Gigantes#X2",3196,1, .@label$;		// MM_L_GIGAN3
+	monster 'map_glast$,299,250, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	monster 'map_glast$,302,246, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	unittalk getcharid(3), "" + strcharinfo(0) + " : The Ancient Gigantes that Professor Bernhard spoke of!!";
+	enablenpc instance_npcname("Stone Gargoyle#glast_07");
+	enablenpc instance_npcname("Stone Gargoyle#glast_08");
+	enablenpc instance_npcname("Stone Gargoyle#glast_09");
+	enablenpc instance_npcname("Stone Gargoyle#glast_10");
+	enablenpc instance_npcname("Stone Gargoyle#glast_11");
+	end;
+OnMobDead:
+	end;
+}
+
+1@glast,292,344,4	script	Ancient Gigantes#glast_3	4_GIGANTES_BIG,6,6,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("Ancient Gigantes#glast_3");
+	.@label$ = instance_npcname("Ancient Gigantes#glast_3") + "::OnMobDead";
+	monster 'map_glast$,292,344, "Ancient Gigantes#X3",3196,1, .@label$;		// MM_L_GIGAN3
+	monster 'map_glast$,290,346, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	monster 'map_glast$,291,344, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	unittalk getcharid(3), "" + strcharinfo(0) + " : The Ancient Gigantes that Professor Bernhard spoke of!!";
+	enablenpc instance_npcname("Stone Gargoyle#glast_12");
+	enablenpc instance_npcname("Stone Gargoyle#glast_13");
+	enablenpc instance_npcname("Stone Gargoyle#glast_14");
+	end;
+OnMobDead:
+	end;
+}
+
+1@glast,107,147,6	script	Ancient Gigantes#glast_4	4_GIGANTES_BIG,6,6,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("Ancient Gigantes#glast_4");
+	.@label$ = instance_npcname("Ancient Gigantes#glast_4") + "::OnMobDead";
+	monster 'map_glast$,107,147, "Ancient Gigantes#X4",3196,1, .@label$;		// MM_L_GIGAN3
+	monster 'map_glast$,107,145, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	monster 'map_glast$,106,148, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	unittalk getcharid(3), "" + strcharinfo(0) + " : The Ancient Gigantes that Professor Bernhard spoke of!!";
+	enablenpc instance_npcname("Stone Gargoyle#glast_15");
+	enablenpc instance_npcname("Stone Gargoyle#glast_16");
+	enablenpc instance_npcname("Stone Gargoyle#glast_17");
+	enablenpc instance_npcname("Stone Gargoyle#glast_18");
+	enablenpc instance_npcname("Stone Gargoyle#glast_19");
+	enablenpc instance_npcname("Stone Gargoyle#glast_20");
+	end;
+OnMobDead:
+	end;
+}
+
+1@glast,98,248,6	script	Ancient Gigantes#glast_5	4_GIGANTES_BIG,4,4,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("Ancient Gigantes#glast_5");
+	.@label$ = instance_npcname("Ancient Gigantes#glast_5") + "::OnMobDead";
+	monster 'map_glast$,98,248, "Ancient Gigantes#X5",3196,1, .@label$;		// MM_L_GIGAN3
+	monster 'map_glast$,96,250, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	monster 'map_glast$,98,247, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	unittalk getcharid(3), "" + strcharinfo(0) + " : The Ancient Gigantes that Professor Bernhard spoke of!!";
+	enablenpc instance_npcname("Stone Gargoyle#glast_21");
+	enablenpc instance_npcname("Stone Gargoyle#glast_22");
+	enablenpc instance_npcname("Stone Gargoyle#glast_23");
+	enablenpc instance_npcname("Stone Gargoyle#glast_24");
+	enablenpc instance_npcname("Stone Gargoyle#glast_25");
+	end;
+OnMobDead:
+	end;
+}
+
+1@glast,107,344,6	script	Ancient Gigantes#glast_6	4_GIGANTES_BIG,6,6,{
+	end;
+OnTouch:
+	disablenpc instance_npcname("Ancient Gigantes#glast_6");
+	.@label$ = instance_npcname("Ancient Gigantes#glast_6") + "::OnMobDead";
+	monster 'map_glast$,107,344, "Ancient Gigantes#X6",3196,1, .@label$;		// MM_L_GIGAN3
+	monster 'map_glast$,107,344, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	monster 'map_glast$,109,346, "Ancient Medium Gigantes",3193,1, .@label$;	// MM_M_GIGAN3
+	unittalk getcharid(3), "" + strcharinfo(0) + " : The Ancient Gigantes that Professor Bernhard spoke of!!";
+	enablenpc instance_npcname("Stone Gargoyle#glast_26");
+	enablenpc instance_npcname("Stone Gargoyle#glast_27");
+	enablenpc instance_npcname("Stone Gargoyle#glast_28");
+	end;
+OnMobDead:
+	end;
+}
+
+1@glast,277,130,8	script	Stone Gargoyle#glast_01	4_GARGOYLE_STATUE,2,2,{
+	end;
+OnTouch:
+	getmapxy .@map$,.@x,.@y, UNITTYPE_NPC;
+	monster .@map$,.@x,.@y, "Mutant Gargoyle",3197,1, instance_npcname( strnpcinfo(0) ) + "::OnMobDead";	// MM_M_GARGOYLE
+	disablenpc instance_npcname( strnpcinfo(0) );
+	end;
+OnMobDead:
+	end;
+}
+
+1@glast,279,130,8	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_02	4_GARGOYLE_STATUE,2,2
+1@glast,281,130,8	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_03	4_GARGOYLE_STATUE,2,2
+1@glast,277,161,6	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_04	4_GARGOYLE_STATUE,2,2
+1@glast,279,161,6	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_05	4_GARGOYLE_STATUE,2,2
+1@glast,281,161,6	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_06	4_GARGOYLE_STATUE,2,2
+1@glast,277,250,6	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_07	4_GARGOYLE_STATUE,2,2
+1@glast,277,245,8	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_08	4_GARGOYLE_STATUE,2,2
+1@glast,272,248,6	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_09	4_GARGOYLE_STATUE,2,2
+1@glast,273,260,4	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_10	4_GARGOYLE_STATUE,2,2
+1@glast,273,235,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_11	4_GARGOYLE_STATUE,2,2
+1@glast,277,328,8	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_12	4_GARGOYLE_STATUE,2,2
+1@glast,279,328,8	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_13	4_GARGOYLE_STATUE,2,2
+1@glast,281,328,8	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_14	4_GARGOYLE_STATUE,2,2
+1@glast,122,132,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_15	4_GARGOYLE_STATUE,2,2
+1@glast,120,132,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_16	4_GARGOYLE_STATUE,2,2
+1@glast,118,132,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_17	4_GARGOYLE_STATUE,2,2
+1@glast,118,163,4	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_18	4_GARGOYLE_STATUE,2,2
+1@glast,120,163,4	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_19	4_GARGOYLE_STATUE,2,2
+1@glast,118,163,4	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_20	4_GARGOYLE_STATUE,2,2
+1@glast,122,250,4	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_21	4_GARGOYLE_STATUE,2,2
+1@glast,122,245,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_22	4_GARGOYLE_STATUE,2,2
+1@glast,126,248,4	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_23	4_GARGOYLE_STATUE,2,2
+1@glast,126,260,6	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_24	4_GARGOYLE_STATUE,2,2
+1@glast,126,235,8	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_25	4_GARGOYLE_STATUE,2,2
+1@glast,117,328,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_26	4_GARGOYLE_STATUE,2,2
+1@glast,119,328,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_27	4_GARGOYLE_STATUE,2,2
+1@glast,121,328,2	duplicate(Stone Gargoyle#glast_01)	Stone Gargoyle#glast_28	4_GARGOYLE_STATUE,2,2
+
+
+1@glast,1,1,0	script	#fenrir_spawn_chimera	HIDDEN_WARP_NPC,{
+	end;
+OnSpawn:
+	// Right side
+	monster 'map_glast$,351,259,"Wicked Chimera#bb28",3200,1;
+	monster 'map_glast$,353,250,"Wicked Chimera#bb28",3200,1;
+	monster 'map_glast$,351,243,"Wicked Chimera#bb28",3200,1;
+	monster 'map_glast$,351,246,"Wicked Chimera#bb28",3200,1;
+	monster 'map_glast$,355,248,"Wicked Chimera#bb28",3200,1;
+	monster 'map_glast$,360,245,"Wicked Chimera#bb28",3200,1;
+
+	monster 'map_glast$,298,209,"Wicked Chimera#aa14",3200,1;
+	monster 'map_glast$,303,199,"Wicked Chimera#aa14",3200,1;
+	monster 'map_glast$,298,198,"Wicked Chimera#aa14",3200,1;
+	monster 'map_glast$,295,211,"Wicked Chimera#aa14",3200,1;
+
+	monster 'map_glast$,307,163,"Wicked Chimera#bb15",3200,1;
+	monster 'map_glast$,315,158,"Wicked Chimera#bb15",3200,1;
+	monster 'map_glast$,318,163,"Wicked Chimera#bb15",3200,1;
+	monster 'map_glast$,318,169,"Wicked Chimera#bb15",3200,1;
+
+	monster 'map_glast$,337,119,"Wicked Chimera#bb27",3200,1;
+	monster 'map_glast$,344,115,"Wicked Chimera#bb27",3200,1;
+	monster 'map_glast$,353,117,"Wicked Chimera#bb27",3200,1;
+	monster 'map_glast$,352,121,"Wicked Chimera#bb27",3200,1;
+	monster 'map_glast$,345,114,"Wicked Chimera#bb27",3200,1;
+	monster 'map_glast$,346,115,"Wicked Chimera#bb27",3200,1;
+
+	monster 'map_glast$,264,36,"Wicked Chimera#aa26",3200,1;
+	monster 'map_glast$,257,46,"Wicked Chimera#aa26",3200,1;
+	monster 'map_glast$,253,44,"Wicked Chimera#aa26",3200,1;
+	monster 'map_glast$,256,39,"Wicked Chimera#aa26",3200,1;
+
+	// Bottom, left
+	monster 'map_glast$,207,46,"Wicked Chimera#aa1",3200,1;
+	monster 'map_glast$,197,49,"Wicked Chimera#aa1",3200,1;
+	monster 'map_glast$,190,52,"Wicked Chimera#aa1",3200,1;
+	monster 'map_glast$,200,64,"Wicked Chimera#aa1",3200,1;
+	monster 'map_glast$,206,76,"Wicked Chimera#aa2",3200,1;
+	monster 'map_glast$,207,83,"Wicked Chimera#aa2",3200,1;
+	monster 'map_glast$,186,82,"Wicked Chimera#bb3",3200,1;
+	monster 'map_glast$,200,87,"Wicked Chimera#aa2",3200,1;
+	monster 'map_glast$,188,86,"Wicked Chimera#bb3",3200,1;
+	monster 'map_glast$,215,77,"Wicked Chimera#aa2",3200,1;
+	monster 'map_glast$,183,90,"Wicked Chimera#bb3",3200,1;
+	monster 'map_glast$,192,85,"Wicked Chimera#bb3",3200,1;
+	monster 'map_glast$,154,36,"Wicked Chimera#bb35",3200,1;
+	monster 'map_glast$,150,47,"Wicked Chimera#bb35",3200,1;
+	monster 'map_glast$,138,52,"Wicked Chimera#bb35",3200,1;
+	monster 'map_glast$,152,36,"Wicked Chimera#bb35",3200,1;
+	monster 'map_glast$,105,50,"Wicked Chimera#aa34",3200,1;
+	monster 'map_glast$,100,48,"Wicked Chimera#aa34",3200,1;
+	monster 'map_glast$,106,52,"Wicked Chimera#aa34",3200,1;
+	monster 'map_glast$,82,52,"Wicked Chimera#aa33",3200,1;
+	monster 'map_glast$,85,51,"Wicked Chimera#aa33",3200,1;
+	monster 'map_glast$,80,65,"Wicked Chimera#aa33",3200,1;
+	monster 'map_glast$,79,58,"Wicked Chimera#aa33",3200,1;
+	monster 'map_glast$,82,69,"Wicked Chimera#aa33",3200,1;
+	monster 'map_glast$,97,41,"Wicked Chimera#aa34",3200,1;
+	monster 'map_glast$,86,103,"Wicked Chimera#bb32",3200,1;
+	monster 'map_glast$,82,102,"Wicked Chimera#bb32",3200,1;
+	monster 'map_glast$,78,108,"Wicked Chimera#bb32",3200,1;
+	monster 'map_glast$,85,109,"Wicked Chimera#bb32",3200,1;
+	monster 'map_glast$,82,111,"Wicked Chimera#bb32",3200,1;
+	monster 'map_glast$,80,144,"Wicked Chimera#bb31",3200,1;
+	monster 'map_glast$,72,152,"Wicked Chimera#bb31",3200,1;
+	monster 'map_glast$,88,159,"Wicked Chimera#bb31",3200,1;
+	monster 'map_glast$,73,152,"Wicked Chimera#bb31",3200,1;
+	monster 'map_glast$,83,160,"Wicked Chimera#bb31",3200,1;
+	monster 'map_glast$,77,150,"Wicked Chimera#bb31",3200,1;
+	monster 'map_glast$,62,207,"Wicked Chimera#aa30",3200,1;
+	monster 'map_glast$,70,215,"Wicked Chimera#aa30",3200,1;
+	monster 'map_glast$,58,209,"Wicked Chimera#aa30",3200,1;
+	monster 'map_glast$,68,204,"Wicked Chimera#aa30",3200,1;
+	monster 'map_glast$,67,214,"Wicked Chimera#aa30",3200,1;
+	monster 'map_glast$,58,250,"Wicked Chimera#aa29",3200,1;
+	monster 'map_glast$,64,257,"Wicked Chimera#aa29",3200,1;
+	monster 'map_glast$,70,251,"Wicked Chimera#aa29",3200,1;
+	monster 'map_glast$,65,247,"Wicked Chimera#aa29",3200,1;
+	monster 'map_glast$,65,256,"Wicked Chimera#aa29",3200,1;
+	monster 'map_glast$,60,255,"Wicked Chimera#aa29",3200,1;
+	monster 'map_glast$,50,144,"Wicked Chimera#bb36",3200,1;
+	monster 'map_glast$,52,143,"Wicked Chimera#bb36",3200,1;
+	monster 'map_glast$,54,146,"Wicked Chimera#bb36",3200,1;
+	monster 'map_glast$,55,140,"Wicked Chimera#bb36",3200,1;
+
+	// Left inside
+	monster 'map_glast$,177,88,"Wicked Chimera#bb4",3200,1;
+	monster 'map_glast$,163,108,"Wicked Chimera#bb4",3200,1;
+	monster 'map_glast$,147,113,"Wicked Chimera#bb4",3200,1;
+	monster 'map_glast$,136,179,"Wicked Chimera#bb11",3200,1;
+	monster 'map_glast$,136,181,"Wicked Chimera#bb11",3200,1;
+	monster 'map_glast$,125,190,"Wicked Chimera#bb11",3200,1;
+	monster 'map_glast$,134,200,"Wicked Chimera#bb12",3200,1;
+	monster 'map_glast$,134,190,"Wicked Chimera#bb11",3200,1;
+	monster 'map_glast$,127,203,"Wicked Chimera#bb12",3200,1;
+	monster 'map_glast$,151,206,"Wicked Chimera#aa13",3200,1;
+	monster 'map_glast$,125,209,"Wicked Chimera#bb12",3200,1;
+	monster 'map_glast$,134,204,"Wicked Chimera#bb12",3200,1;
+	monster 'map_glast$,135,244,"Wicked Chimera#bb19",3200,1;
+	monster 'map_glast$,149,250,"Wicked Chimera#bb19",3200,1;
+	monster 'map_glast$,138,249,"Wicked Chimera#bb19",3200,1;
+	monster 'map_glast$,136,251,"Wicked Chimera#bb19",3200,1;
+	monster 'map_glast$,127,291,"Wicked Chimera#bb20",3200,1;
+	monster 'map_glast$,126,288,"Wicked Chimera#bb20",3200,1;
+	monster 'map_glast$,124,291,"Wicked Chimera#bb20",3200,1;
+	monster 'map_glast$,135,309,"Wicked Chimera#aa21",3200,1;
+	monster 'map_glast$,138,316,"Wicked Chimera#aa21",3200,1;
+	monster 'map_glast$,139,324,"Wicked Chimera#aa22",3200,1;
+	monster 'map_glast$,132,331,"Wicked Chimera#aa22",3200,1;
+	monster 'map_glast$,129,315,"Wicked Chimera#aa21",3200,1;
+	monster 'map_glast$,127,338,"Wicked Chimera#aa22",3200,1;
+	monster 'map_glast$,126,327,"Wicked Chimera#aa22",3200,1;
+	monster 'map_glast$,132,288,"Wicked Chimera#bb20",3200,1;
+	monster 'map_glast$,138,309,"Wicked Chimera#aa21",3200,1;
+
+	// Center and right side
+	monster 'map_glast$,158,214,"Wicked Chimera#aa13",3200,1;
+	monster 'map_glast$,162,208,"Wicked Chimera#aa13",3200,1;
+	monster 'map_glast$,166,215,"Wicked Chimera#aa13",3200,1;
+	monster 'map_glast$,168,191,"Wicked Chimera#aa10",3200,1;
+	monster 'map_glast$,164,186,"Wicked Chimera#aa10",3200,1;
+	monster 'map_glast$,165,191,"Wicked Chimera#aa10",3200,1;
+	monster 'map_glast$,177,189,"Wicked Chimera#aa10",3200,1;
+	monster 'map_glast$,199,200,"Wicked Chimera#aa9",3200,1;
+	monster 'map_glast$,205,195,"Wicked Chimera#aa9",3200,1;
+	monster 'map_glast$,191,200,"Wicked Chimera#aa9",3200,1;
+	monster 'map_glast$,196,192,"Wicked Chimera#aa9",3200,1;
+	monster 'map_glast$,224,196,"Wicked Chimera#bb8",3200,1;
+	monster 'map_glast$,233,196,"Wicked Chimera#bb8",3200,1;
+	monster 'map_glast$,239,192,"Wicked Chimera#bb8",3200,1;
+	monster 'map_glast$,231,193,"Wicked Chimera#bb8",3200,1;
+	monster 'map_glast$,239,214,"Wicked Chimera#bb16",3200,1;
+	monster 'map_glast$,232,213,"Wicked Chimera#bb16",3200,1;
+	monster 'map_glast$,238,209,"Wicked Chimera#bb16",3200,1;
+	monster 'map_glast$,244,220,"Wicked Chimera#bb16",3200,1;
+	monster 'map_glast$,252,249,"Wicked Chimera#aa18",3200,1;
+	monster 'map_glast$,268,221,"Wicked Chimera#aa17",3200,1;
+	monster 'map_glast$,261,219,"Wicked Chimera#aa17",3200,1;
+	monster 'map_glast$,261,248,"Wicked Chimera#aa18",3200,1;
+	monster 'map_glast$,264,211,"Wicked Chimera#aa17",3200,1;
+	monster 'map_glast$,267,210,"Wicked Chimera#aa17",3200,1;
+	monster 'map_glast$,258,193,"Wicked Chimera#bb7",3200,1;
+	monster 'map_glast$,258,192,"Wicked Chimera#bb7",3200,1;
+	monster 'map_glast$,258,190,"Wicked Chimera#bb7",3200,1;
+	monster 'map_glast$,269,192,"Wicked Chimera#bb7",3200,1;
+	monster 'map_glast$,269,110,"Wicked Chimera#aa6",3200,1;
+	monster 'map_glast$,266,105,"Wicked Chimera#aa6",3200,1;
+	monster 'map_glast$,277,103,"Wicked Chimera#aa6",3200,1;
+	monster 'map_glast$,263,107,"Wicked Chimera#aa6",3200,1;
+	monster 'map_glast$,249,101,"Wicked Chimera#aa5",3200,1;
+	monster 'map_glast$,237,93,"Wicked Chimera#aa5",3200,1;
+	monster 'map_glast$,242,107,"Wicked Chimera#aa5",3200,1;
+	monster 'map_glast$,237,105,"Wicked Chimera#aa5",3200,1;
+	monster 'map_glast$,264,235,"Wicked Chimera#aa18",3200,1;
+	monster 'map_glast$,260,255,"Wicked Chimera#aa18",3200,1;
+	monster 'map_glast$,261,282,"Wicked Chimera#bb23",3200,1;
+	monster 'map_glast$,260,284,"Wicked Chimera#bb23",3200,1;
+	monster 'map_glast$,264,289,"Wicked Chimera#bb23",3200,1;
+	monster 'map_glast$,268,301,"Wicked Chimera#bb24",3200,1;
+	monster 'map_glast$,262,308,"Wicked Chimera#bb24",3200,1;
+	monster 'map_glast$,273,306,"Wicked Chimera#bb24",3200,1;
+	monster 'map_glast$,259,307,"Wicked Chimera#bb24",3200,1;
+	monster 'map_glast$,269,283,"Wicked Chimera#bb23",3200,1;
+	monster 'map_glast$,257,350,"Wicked Chimera#aa25",3200,1;
+	monster 'map_glast$,268,350,"Wicked Chimera#aa25",3200,1;
+	monster 'map_glast$,268,357,"Wicked Chimera#aa25",3200,1;
+	monster 'map_glast$,271,358,"Wicked Chimera#aa25",3200,1;
+	end;
+
+OnInstanceInit:
+	'skip_left_part = 0;
+	'back_to_entrance = 0;
+	'map_glast$ = instance_mapname("1@glast");
+	'fenrir_1$ = instance_npcname("Fenrith Fenrir#glast_01");
+	'fenrir_2$ = instance_npcname("Fenrith Fenrir#glast_02");
+	'fenrir_3$ = instance_npcname("Fenrith Fenrir#glast_03");
+	'fenrir_4$ = instance_npcname("Fenrith Fenrir#glast_04");
+	'fenrir_5$ = instance_npcname("Fenrith Fenrir#glast_05");
+	'fenrir_6$ = instance_npcname("Fenrith Fenrir#glast_06");
+	'fenrir_7$ = instance_npcname("Fenrith Fenrir#glast_07");
+	'fenrir_8$ = instance_npcname("Fenrith Fenrir#glast_08");
+	'fenrir_9$ = instance_npcname("Fenrith Fenrir#glast_09");
+	'fenrir_10$ = instance_npcname("Fenrith Fenrir#glast_10");
+	'fenrir_11$ = instance_npcname("Fenrith Fenrir#glast_11");
+	'sarah_10$ = instance_npcname("Sarah Irene#glast_10");
+	'sarah_17$ = instance_npcname("Sarah Irene#glast_17");
+	'sarah_20$ = instance_npcname("Sarah Irene#glast_20");
+	'sarah_ego$ = instance_npcname("Sarah Irene's alter ego");
+
+	// Entrance
+	disablenpc instance_npcname("#glast_event_3");
+	for ( .@i = 1; .@i < 8; .@i++ )
+		hideonnpc instance_npcname("#effect_glast_event01_" + .@i);
+	disablenpc instance_npcname("#glast_move_01");
+
+	// Fenrir bottom
+	disablenpc instance_npcname("#glast_event_5");
+	disablenpc 'fenrir_2$;
+
+	// Fenrir left side, entrance
+	disablenpc instance_npcname("#glast_event_7");
+	disablenpc 'fenrir_3$;
+
+	// Fenrir left side, inside
+	disablenpc 'fenrir_4$;
+	disablenpc 'sarah_10$;
+	disablenpc instance_npcname("Gigantes#semi1");
+	disablenpc instance_npcname("Gigantes#semi2");
+	disablenpc instance_npcname("#glast_event_9");
+	for ( .@i = 1; .@i < 9; .@i++ )
+		hideonnpc instance_npcname("#effect_glast_event02_" + .@i);
+	hideonnpc instance_npcname("#effect_glast_event02_bis");
+	//for ( .@i = 1; .@i < 8; .@i++ )
+	//	disablenpc instance_npcname("#glast_event_warp_" + .@i);
+	disablenpc instance_npcname("#fenrir_left_vermilion");
+	disablenpc instance_npcname("#fenrir_left_final_1");
+
+	// Event top side
+	disablenpc instance_npcname("#glast_event_13");
+	disablenpc 'fenrir_5$;
+
+	// Skipped left side
+	disablenpc instance_npcname("#fenrir_left_final_2");
+
+	// Stairs final room
+	disablenpc instance_npcname("#glast_move_03");
+	disablenpc instance_npcname("#glast_event_15");
+	disablenpc 'fenrir_6$;
+
+	// Final room
+	disablenpc instance_npcname("#glast_move_03a");
+	disablenpc instance_npcname("#glast_event_18");
+	disablenpc instance_npcname("Sarah Irene#glast_17");
+	disablenpc 'sarah_20$;
+	disablenpc 'fenrir_7$;
+	disablenpc 'fenrir_8$;
+	disablenpc 'fenrir_9$;
+	//for ( .@i = 11; .@i <= 16; .@i++ )
+	//	disablenpc instance_npcname("#glast_event_warp_" + .@i);
+	for ( .@i = 1; .@i <= 8; .@i++ )
+		hideonnpc instance_npcname("#effect_glast_event03_" + .@i);
+	disablenpc instance_npcname("#glast_event_19");
+	disablenpc instance_npcname("#fenrir_boss_final_1");
+
+	// Outside final room
+	disablenpc instance_npcname("#glast_event_24");
+	disablenpc 'fenrir_10$;
+
+	// Skipped final room
+	disablenpc instance_npcname("#fenrir_boss_final_2");
+
+	// Bombs
+	disablenpc instance_npcname("#sarah_wrath");
+	for ( .@i = 1; .@i <= 14; .@i++ )
+		disablenpc instance_npcname("#glast_bomb_" + (.@i < 10 ? ("0"+.@i) : .@i));
+
+	// Back to entrance
+	disablenpc instance_npcname("Sarah Irene's alter ego");
+	disablenpc 'fenrir_11$;
+	disablenpc instance_npcname("#glast_move_04");
+	disablenpc instance_npcname("#glast_move_05");
+
+	// Shards
+	for ( .@i = 1; .@i < 7; .@i++ )
+		disablenpc instance_npcname("Ancient Gigantes#glast_" + .@i);
+	for ( .@i = 1; .@i < 29; .@i++ )
+		disablenpc instance_npcname( "Stone Gargoyle#glast_" + (.@i < 10 ? ("0"+.@i) : .@i) );
+
+	// Spawn chimera
+	donpcevent instance_npcname("#fenrir_spawn_chimera") + "::OnSpawn";
+	end;
+}

+ 351 - 135
npc/re/jobs/novice/academy.txt

@@ -13,166 +13,382 @@
 //= 1.0.0 Initial Release. [Kisuka]
 //= 1.0.1 Converted item constants to IDs and added hair coupon. [Kisuka]
 //= 2.0.0 Converted from Hercules Script to rAthena Script. [Capuche]
+//= 2.0.1 Add new Intro Renewal based on Hercules [Jenkijo]
 //==============================================================================
 
+//== Starting Point  (iz_int) =================================
+iz_int,18,30,0	script	iz_int#intro_start	HIDDEN_WARP_NPC,6,6,{
+	end;
+OnTouch:
+	navigateto("iz_int", 52, 30, NAV_NONE, 1); // Individual map name not required
+	if (getd(".start" + strnpcinfo(1)) == 0) {
+		setd ".start" + strnpcinfo(1), 1;
+		initnpctimer;
+		mapannounce strnpcinfo(4), "[Tip] You can move to the desired point by clicking the ground with the left mouse button.", bc_map,0xFF0000;
+	}
+	end;
+OnTimer9000:
+	mapannounce strnpcinfo(4), "[Tip] While holding down the right mouse button, drag to rotate the screen.", bc_map,0xFF0000;
+	end;
+OnTimer18000:
+	mapannounce strnpcinfo(4), "[Tip] You can leave through the bluish warp gate.", bc_map,0xFF0000;
+	emotion 0,0, "#room_out" + replacestr( strnpcinfo(4), "iz_int", "" );
+	end;
+OnTimer21000:
+	emotion 0,0, "#room_out" + replacestr( strnpcinfo(4), "iz_int", "" );
+	end;
+OnTimer24000:
+	emotion 0,0, "#room_out" + replacestr( strnpcinfo(4), "iz_int", "" );
+	end;
+OnTimer27000:
+	mapannounce strnpcinfo(4), "[Tip] Leave this area to continue.", bc_map,0xFF0000;
+	stopnpctimer;
+	setd ".start" + strnpcinfo(1), 0;
+	end;
+}
+iz_int01,18,30,0	duplicate(iz_int#intro_start)	iz_int01#intro_start	HIDDEN_WARP_NPC,6,6
+iz_int02,18,30,0	duplicate(iz_int#intro_start)	iz_int02#intro_start	HIDDEN_WARP_NPC,6,6
+iz_int03,18,30,0	duplicate(iz_int#intro_start)	iz_int03#intro_start	HIDDEN_WARP_NPC,6,6
+iz_int04,18,30,0	duplicate(iz_int#intro_start)	iz_int04#intro_start	HIDDEN_WARP_NPC,6,6
+
+iz_int,51,30,0	script	iz_int#intro_evt02	HIDDEN_WARP_NPC,1,1,{
+	end;
+OnTouch:
+	navigateto("int_land", 75, 100, NAV_NONE, 1);
+	end;
+}
+iz_int01,51,30,0	duplicate(iz_int#intro_evt02)	iz_int01#intro_evt02	HIDDEN_WARP_NPC,1,1
+iz_int02,51,30,0	duplicate(iz_int#intro_evt02)	iz_int02#intro_evt02	HIDDEN_WARP_NPC,1,1
+iz_int03,51,30,0	duplicate(iz_int#intro_evt02)	iz_int03#intro_evt02	HIDDEN_WARP_NPC,1,1
+iz_int04,51,30,0	duplicate(iz_int#intro_evt02)	iz_int04#intro_evt02	HIDDEN_WARP_NPC,1,1
+
+//== Wounded Swordsman (iz_int) =================================
+iz_int,56,32,3	script	Wounded Swordsman#intro_npc01_iz_int	4_TOWER_01,5,5,{
+	@intro_npc01 = 1;
+	npctalk "Oh...", "", bc_self;
+	classchange HIDDEN_WARP_NPC, "", bc_self;// todo: classchange self remain on map
+	classchange 4_TOWER_02, "Wounded Swordsman#intro_npc02_" + strnpcinfo(4), bc_self;
+	end;
+
+OnTouch:
+	if (@intro_npc01 == 0) {
+		npctalk "Urgh... please... help me...", "", bc_self;
+		sleep2 500;
+		npctalk "In order to talk with me.. click my body..", "", bc_self;
+	}
+	else {// debug
+		classchange HIDDEN_WARP_NPC, "", bc_self;
+		classchange 4_TOWER_02, "Wounded Swordsman#intro_npc02_" + strnpcinfo(4), bc_self;
+	}
+	end;
+
+OnInit:
+	questinfo 21001, QTYPE_QUEST, 1, Job_Novice;
+	end;
+}
+iz_int01,56,32,3	duplicate(Wounded Swordsman#intro_npc01_iz_int)	Wounded Swordsman#intro_npc01_iz_int01	4_TOWER_01,5,5
+iz_int02,56,32,3	duplicate(Wounded Swordsman#intro_npc01_iz_int)	Wounded Swordsman#intro_npc01_iz_int02	4_TOWER_01,5,5
+iz_int03,56,32,3	duplicate(Wounded Swordsman#intro_npc01_iz_int)	Wounded Swordsman#intro_npc01_iz_int03	4_TOWER_01,5,5
+iz_int04,56,32,3	duplicate(Wounded Swordsman#intro_npc01_iz_int)	Wounded Swordsman#intro_npc01_iz_int04	4_TOWER_01,5,5
+
+iz_int,56,32,3	script	Wounded Swordsman#intro_npc02_iz_int	HIDDEN_WARP_NPC,{
+	if (isbegin_quest(21001) == 0) {
+		mes "[Wounded]";
+		mes "Wow! Thanks a lot!";
+		mes "I don't know how this happened to our ship";
+		mes "but we should go to see the captain.";
+		next;
+		mes "[Wounded]";
+		mes "... ohh, it seems my body is too injured.";
+		mes "Maybe you can go without me?";
+		setquest 21001;
+		next;
+		cutin "tutorial02",4;
+		mes "^4d4dff!- Information -!^000000";
+		mes "NPC Quest Received.";
+	}
+	else {
+		mes "[Wounded]";
+		mes "Luckily the water has not entered the ship.";
+		mes "I will wait here, you should go see the captain.";
+		next;
+		mes "[Wounded]";
+		mes "I'm fine! I'm fine!";
+		mes "Don't worry about me, you should really go to the captain!";
+		next;
+		mes "^4d4dff!- Information -!^000000";
+	}
+	mes "^4d4dffQuestinfo Shortcut is Alt + U^000000";
+	mes "You can check your quest status there anytime.";
+	close2;
+	cutin "",255;
+	end;
+
+OnInit:
+	questinfo 21001, QTYPE_QUEST, 1, Job_Novice;
+	end;
+}
+iz_int01,56,32,3	duplicate(Wounded Swordsman#intro_npc02_iz_int)	Wounded Swordsman#intro_npc02_iz_int01	HIDDEN_WARP_NPC
+iz_int02,56,32,3	duplicate(Wounded Swordsman#intro_npc02_iz_int)	Wounded Swordsman#intro_npc02_iz_int02	HIDDEN_WARP_NPC
+iz_int03,56,32,3	duplicate(Wounded Swordsman#intro_npc02_iz_int)	Wounded Swordsman#intro_npc02_iz_int03	HIDDEN_WARP_NPC
+iz_int04,56,32,3	duplicate(Wounded Swordsman#intro_npc02_iz_int)	Wounded Swordsman#intro_npc02_iz_int04	HIDDEN_WARP_NPC
+
 // - Captain Carocc (Ship)
 // -----------------------------------------------------------------------------
-iz_int,100,91,3	script	Captain Carocc#iz_int	4_M_REINDEER,{
-	if (Class == Job_Novice) {
-		cutin "fly_trock", 2;
-		if (!isbegin_quest(7471)) {
-			mes "[Captain Carocc]";
-			mes "Had a good dream?";
-			mes "Soon, we will get to ^4d4fffIzlude^000000.";
-			next;
-			mes "[Captain Carocc]";
-			mes "And you can talk to other people like you just talked to me.";
-			next;
-			cutin "tutorial01",3;
-			mes "!- Information -!";
-			mes "^4d4fffLeft mouse click allows basic game controls.";
-			mes "Such as conversation with NPC, movement, and attacks.^000000";
-			next;
-			cutin "fly_trock",2;
-			mes "[Captain Carocc]";
-			mes "Many youngsters visit the ^4d4fffRune Midgard Kingdom^000000 to chase their dreams.";
-			mes "Izlude is a satellite city of Prontera, the capital of the Rune Midgard Kingdom.";
-			next;
-			mes "[Captain Carocc]";
-			mes "Izlude always welcomes young adventurers like you who have just started their journey to the World.";
-			mes "You are one of them of course.";
-			next;
-			mes "[Captain Carocc]";
-			mes "I would like to tell you more stories, but it's time to get ready for arrival.";
-			mes "There is an academy in Izlude for newcomers like yourself.";
-			next;
+int_land,78,103,5	script	Captain Carocc#intro_npc03	4_M_REINDEER,{
+	switch( isbegin_quest(21008) ) {
+	case 0:
+		mes "[Captain Carocc]";
+		mes "There are still people in the cabins?!";
+		mes "At least you are safe.";
+		mes "Are you alright?";
+		next;
+		if (select("I'm alright, but others need help.", "I think I am the last?") == 1) {
 			mes "[Captain Carocc]";
-			mes "Let me give you more details later.";
-			mes "See you back at the harbor deck.";
-			next;
+			mes "There are more people left?";
+			mes "I will send a rescue team to them.";
+			mes "Thank you for your report.";
+		} else {
 			mes "[Captain Carocc]";
-			mes "To get off this ship, you should enter the ^4d4fffShining Portal^000000 over there.";
-			mes "All transportation is made through the portals.";
-			setquest 7471;
-			completequest 7471;
-			close2;
-			cutin "", 255;
-			end;
+			mes "Alright, that's good.";
+			mes "The storm came unexpectedly but I never thought it would hit us that hard.";
 		}
+		next;
 		mes "[Captain Carocc]";
-		mes "Now, we are here in Izlude~";
-		mes "Go through that ^4d4fffShining Portal^000000 and exit outside.";
+		mes "At least most people made it to safety.";
 		next;
 		mes "[Captain Carocc]";
-		mes "Let's talk more when we get off to the deck.";
-		mes "There are lots of things I want to teach you.";
-		close2;
-		cutin "", 255;
-		end;
+		mes "Look at the trees there, ^4d4dfffollow them to the southwest^000000 to find a new ship.";
+		mes "The ship will take you to ^4d4dffIzlude^000000, our original destination.";
+		next;
+		mes "[Captain Carocc]";
+		mes "Ah! Speaking of it, those ^4d4dffPorings^000000 on this island drop several materials we could use for repairs.";
+		next;
+		mes "[Captain Carocc]";
+		mes "^4d4dffKill the Porings and bring 2 Lumbers to the southern crew^000000.";
+		next;
+		mes "[Captain Carocc]";
+		mes "It is a hard task, but you look tough enough.";
+		specialeffect2 EF_HEAL2;
+		heal 9999,0;
+		skilleffect 34,0;
+		sc_start SC_BLESSING,240000,10;
+		skilleffect 29,0;
+		sc_start SC_INCREASEAGI,240000,10;
+		if (isbegin_quest(21001) == 1) {
+			completequest 21001;
+			getexp 600,600;
+		}
+		setquest 21008;
+		next;
+		mes "[Captain Carocc]";
+		mes "Speaking of Porings, you have to equip your gears.";
+		mes "You should have a ^4d4dffweapon and an armor^000000 equipped.";
+		next;
+		cutin "tutorial03",4;
+		mes "!- Information -!";
+		mes "^4d4dffYou can equip gear or use items by simply double clicking them.";
+		mes "The item window can be opened by pressing Alt + E or using the menu button.^000000";
+		next;
+		mes "!- Information -!";
+		mes "^4d4dffEquipped Items can be seen by pressing Alt + Q.";
+		mes "Either double click or drag & drop to equip or unequip them.^000000";
+		next;
+		cutin "",255;
+		mes "[Captain Carlock]";
+		mes "Did you check all your equipment?";
+		mes "^4d4dffSkill distribution^000000 should be done.";
+		next;
+		mes "[Captain Carlock]";
+		mes "For a smooth battle, you have to distribute your abilities properly.";
+		mes "^4d4dffIf you want to increase your strength, you need to raise Str^000000. ^4d4dffIf you want to increase your hit, you must raise Dex^000000.";
+		break;
+	case 1:
+		mes "[Captain Carocc]";
+		specialeffect2 EF_HEAL2;
+		heal 9999, 0;
+		skilleffect 34,0;
+		sc_start SC_BLESSING,240000,10;
+		skilleffect 29,0;
+		sc_start SC_INCREASEAGI,240000,10;
+		mes "^4d4dffThe Ship^000000 is anchored in the southwest. It will take you to Izlude.";
+		mes "Don't forget to ^4d4dffget some Lumber^000000 for the ship.";
+		next;
+		mes "[Captain Carocc]";
+		mes "Don't forget to raise your ^4d4dffskills^000000.";
+		break;
+	case 2:
+		mes "[Captain Carocc]";
+		mes "Everything is ready to sail over to Izlude.";
+		mes "The ship is located at the south-western part of the island.";
+		close;
 	}
+	next;
+	mes "! - Information -!";
+	mes "^4d4dffYou get a stats bonus for every level you raise.";
+	mes "The status window can be opened and closed with the shortcut Alt + A^000000.";
+	next;
+	mes "! - Information -!";
+	mes "^4d4dffPlease properly allocate the stats you need to battle^000000.";
+	next;
+	mes "[Captain Carocc]";
+	mes "Kill Porings and bring the Lumber to the crew.";
+	mes "Good luck!";
+	close;
+
+OnInit:
+	questinfo 21008, QTYPE_QUEST, 1, Job_Novice;
+	end;
 }
 
-iz_int01,100,91,3	duplicate(Captain Carocc#iz_int)	Captain Carocc#iz_int01	4_M_REINDEER
-iz_int02,100,91,3	duplicate(Captain Carocc#iz_int)	Captain Carocc#iz_int02	4_M_REINDEER
-iz_int03,100,91,3	duplicate(Captain Carocc#iz_int)	Captain Carocc#iz_int03	4_M_REINDEER
-iz_int04,100,91,3	duplicate(Captain Carocc#iz_int)	Captain Carocc#iz_int04	4_M_REINDEER
+int_land01,78,103,5	duplicate(Captain Carocc#intro_npc03)	Captain Carocc#intro_npc03_01	4_M_REINDEER
+int_land02,78,103,5	duplicate(Captain Carocc#intro_npc03)	Captain Carocc#intro_npc03_02	4_M_REINDEER
+int_land03,78,103,5	duplicate(Captain Carocc#intro_npc03)	Captain Carocc#intro_npc03_03	4_M_REINDEER
+int_land04,78,103,5	duplicate(Captain Carocc#intro_npc03)	Captain Carocc#intro_npc03_04	4_M_REINDEER
 
-// - Lumin (Ship)
-// -----------------------------------------------------------------------------
-iz_int,91,81,3	script	Lumin#iz_int	4_M_NOV_RUMIN,{
-	if (Class == Job_Novice) {
-		if (!isbegin_quest(7471)) {
-			mes "[Lumin]";
-			mes "............";
-			mes "...?";
-			next;
-			cutin "fly_trock",2;
-			mes "[Captain Carocc]";
-			mes "Hey, you awake now?";
-			mes "That fella without much talk, I rescued him from the ocean.";
-			next;
-			mes "[Captain Carocc]";
-			mes "Think he lost his memory.";
-			mes "I gave him a new name 'Lumin'. But, just call him Lu...";
-			next;
-			mes "[Captain Carocc]";
-			mes "And you can talk to other people like you just talked to me.";
-			next;
-			cutin "tutorial01",3;
-			mes "!- Information -!";
-			mes "^4d4fffLeft mouse click allows basic game control.";
-			mes "Such as conversation with NPC, movement, and attacks.^000000";
-			next;
-			cutin "fly_trock",2;
-			mes "[Captain Carocc]";
-			mes "Many youngsters visit the ^4d4fffRune Midgard Kingdom^000000 to chase their dreams.";
-			mes "Izlude is a satellite city of Prontera, the capital of the Rune Midgard Kingdom.";
-			next;
-			mes "[Captain Carocc]";
-			mes "Izlude always welcomes young adventurers like you who have just started their journey to the World.";
-			mes "You are one of them of course.";
-			next;
-			mes "[Captain Carocc]";
-			mes "I would like to tell you more stories, but it's time to get ready for arrival.";
-			mes "There is an academy in Izlude for newcomers like yourself.";
-			next;
-			mes "[Captain Carocc]";
-			mes "Let me give you more detail later.";
-			mes "See you back at the harbor deck.";
-			next;
-			mes "[Captain Carocc]";
-			mes "To get off this ship, you should enter the ^4d4fffShining Portal^000000 over there.";
-			mes "All transportation is made through those portals.";
-			setquest 7471;
-			completequest 7471;
-			next;
-			cutin "nov_lumin01",0;
-			mes "[Lumin]";
-			mes "Yes.";
-			next;
-			cutin "fly_trock",2;
-			mes "[Carocc]";
-			mes "Oh, boy.";
-			mes "What cute reaction.";
-			close2;
-			cutin "", 255;
-			end;
-		}
-		cutin "nov_lumin01",0;
+//== Lumin (int_land) ==========================================
+int_land,73,100,3	script	Lumin#new_ship	4_M_NOV_RUMIN,{
+	if (isbegin_quest(7471) == 0) {
+		cutin "nov_lumin01.bmp",0;
 		mes "[Lumin]";
-		mes ".....";
+		mes ".............";
+		mes "..?";
 		next;
-		select("Should I introduce myself?", "My name is ~!");
-		mes "["+strcharinfo(0)+"]";
-		mes "I am "+strcharinfo(0)+"!";
+		cutin "fly_trock.bmp",2;
+		mes "[Captain Carocc]";
+		mes "Had a good dream?";
+		mes "Soon, we will get to Izlude. And you can talk to other people like you just talked to me.";
+		next;
+		mes "[Captain Carocc]";
+		mes "I think that guy over there lost his memory. I gave him a new name.";
+		mes "Lumin.";
+		next;
+		mes "[Captain Carocc]";
+		mes "Many youngsters visit the ^4d4dffRune-Midgarts Kingdom^000000 to chase their dreams.";
+		mes "Izlude is a satellite city of Prontera, the capital of the Rune-Midgarts Kingdom.";
 		next;
-		mes "[Lu]";
-		mes ".....";
+		mes "[Captain Carocc]";
+		mes "Izlude always welcomes young adventurers like you who have just started their journey through the world.";
+		mes "You are one of them, of course.";
 		next;
-		mes "[Lu]";
-		mes ".....";
-		mes "....So?";
+		mes "[Captain Carocc]";
+		mes "I would like to tell you more stories, but it's time to get ready for arrival.";
+		mes "There is an academy in Izlude for newcomers like yourself.";
 		next;
-		mes "- Lu just walked away with a cynical look on his face.";
+		mes "[Captain Carocc]";
+		mes "Let me give you more details later. See you back at the harbor deck.";
 		next;
-		cutin "fly_trock",2;
-		mes "[Carocc]";
-		mes "He's just shy, you know.";
-		mes "You will see him again in Izlude, be good to him please.";
+		mes "[Captain Carocc]";
+		mes "To get off this ship, you should enter the ^4d4dffShining Portal^000000 over there.";
+		mes "All transportation is made through the portals.";
+		setquest 7471;
+		completequest 7471;
 		next;
-		mes "[Carocc]";
-		mes "From now on, I'll be driving this ship around Izlude.";
-		mes "Let's go, shall we?";
+		cutin "nov_lumin01.bmp", 0;
+		mes "[Lumin]";
+		mes "Yes.";
+		next;
+		classchange HIDDEN_WARP_NPC, "", bc_self;// todo: classchange self remain on map
+		cutin "fly_trock.bmp",2;
+		mes "[Captain Carocc]";
+		mes "Oh boy.";
+		mes "What a cute reaction.";
 		close2;
-		cutin "", 255;
+		cutin "",255;
 		end;
 	}
+	cutin "nov_lumin01.bmp",0;
+	mes "[Lumin]";
+	mes ".....";
+	next;
+	select("Should I introduce myself?", "My name is ~!");
+	mes "[" + strcharinfo(0) + "]";
+	mes "I am " + strcharinfo(0) + "!";
+	next;
+	mes "[Lu]";
+	mes ".....";
+	next;
+	mes "[Lu]";
+	mes ".....";
+	mes "....So?";
+	next;
+	classchange HIDDEN_WARP_NPC, "", bc_self;// todo: classchange self remain on map
+	mes "- Lu just walked away with a cynical look on his face.";
+	next;
+	cutin "fly_trock.bmp",2;
+	mes "[Captain Carocc]";
+	mes "Looks like... he has a shy personality.";
+	mes "When you go to Izlude, will you check on him?";
+	next;
+	mes "[Captain Carocc]";
+	mes "From now on I'll be sailing the ship around the island.";
+	mes "Let's go, shall we?";
+	close2;
+	cutin "",255;
+	end;
+
+OnInit:
+	questinfo 7471, QTYPE_QUEST, 1, Job_Novice;
+	setquestinfo_req 7471,21008,1;
+	end;
+}
+int_land01,73,100,3	duplicate(Lumin#new_ship)	Lumin#new_ship01	4_M_NOV_RUMIN
+int_land02,73,100,3	duplicate(Lumin#new_ship)	Lumin#new_ship02	4_M_NOV_RUMIN
+int_land03,73,100,3	duplicate(Lumin#new_ship)	Lumin#new_ship03	4_M_NOV_RUMIN
+int_land04,73,100,3	duplicate(Lumin#new_ship)	Lumin#new_ship04	4_M_NOV_RUMIN
+
+int_land,58,69,5	script	Sailor#intro_npc04	4W_SAILOR,{
+	if (isbegin_quest(21008) == 1) {
+		if (countitem(6008) < 2) {
+			mes "[Sailor]";
+			mes "These Porings stole my materials to repair the ship. Can you help me to get them back?";
+			mes "There are plenty of Porings on this island.";
+			next;
+			mes "[Sailor]";
+			mes "I would really appreciate it if you help me.";
+			mes "I am not allowed to set foot on this island.";
+			mes "That's why I ask for your help~";
+			close;
+		}
+		mes "[Sailor]";
+		mes "Unbelievable, perfect! Any chance you want to join my crew?";
+		mes "Enough talking!!";
+		mes "Come on, we're ready to set sail!";
+		mes "Thank you so much!";
+		next;
+		mes "[Sailor]";
+		mes "If you want to sail with us to Izlude, jump on board!";
+		delitem 6008,2;
+		getexp 100,100;
+		getitem 611,5;
+		completequest 21008;
+		next;
+		mes "[Sailor]";
+		mes "Oh, and take these ^4d4dffMagnifiers^000000.";
+		mes "When you hunt monsters you can find ^4d4dffunidentified items^000000.";
+		next;
+		mes "[Sailor]";
+		mes "Using a Magnifier will identify the item.";
+		next;
+		mes "[Sailor]";
+		mes "Maybe you already have some unidentified items from your fights with those Porings?";
+		close;
+	}
+	mes "[Sailor]";
+	mes "The ship is heading to Izlude soon~!";
+	mes "I'll let you know when we set sail~!";
+	close;
+
+OnInit:
+	questinfo 21002, QTYPE_QUEST, 1, Job_Novice;
+	setquestinfo_req 21002,21008,1;
+	end;
 }
 
-iz_int01,91,81,3	duplicate(Lumin#iz_int)	Lumin#iz_int01	4_M_NOV_RUMIN
-iz_int02,91,81,3	duplicate(Lumin#iz_int)	Lumin#iz_int02	4_M_NOV_RUMIN
-iz_int03,91,81,3	duplicate(Lumin#iz_int)	Lumin#iz_int03	4_M_NOV_RUMIN
-iz_int04,91,81,3	duplicate(Lumin#iz_int)	Lumin#iz_int04	4_M_NOV_RUMIN
+int_land01,58,69,5	duplicate(Sailor#intro_npc04)	Sailor#intro_npc04_01	4W_SAILOR
+int_land02,58,69,5	duplicate(Sailor#intro_npc04)	Sailor#intro_npc04_02	4W_SAILOR
+int_land03,58,69,5	duplicate(Sailor#intro_npc04)	Sailor#intro_npc04_03	4W_SAILOR
+int_land04,58,69,5	duplicate(Sailor#intro_npc04)	Sailor#intro_npc04_04	4W_SAILOR
 
 // - Captain Carocc
 // -----------------------------------------------------------------------------
@@ -4900,7 +5116,7 @@ new_1-3,99,169,3	script	Friendly Poring#ac	4_PORING,{
 		mes "[Poring]";
 		mes "Dear oh dear...what do we have 'ere?";
 		next;
-		if (select("What happend?", "Ignore him/it?") == 2) {
+		if (select("What happened?", "Ignore him/it?") == 2) {
 			mes "[Poring]";
 			mes "Oh dear, oh dear...";
 			close;

+ 1 - 0
npc/re/mapflag/nobranch.txt

@@ -102,6 +102,7 @@ izlude_d	mapflag	nobranch
 1@gef	mapflag	nobranch
 1@gef_in	mapflag	nobranch
 1@ge_st	mapflag	nobranch
+1@glast	mapflag	nobranch
 dali	mapflag	nobranch
 dali02	mapflag	nobranch
 

+ 1 - 0
npc/re/mapflag/noicewall.txt

@@ -38,6 +38,7 @@
 // Heroes' Trail Part 1 =======
 1@sara	mapflag	noicewall
 1@face	mapflag	noicewall
+1@glast	mapflag	noicewall
 
 // WOE:TE Maps ===================
 te_prtcas01	mapflag	noicewall

+ 1 - 0
npc/re/mapflag/nomemo.txt

@@ -130,6 +130,7 @@ gl_cas02_	mapflag	nomemo
 1@face	mapflag	nomemo
 1@sara	mapflag	nomemo
 1@gef_in	mapflag	nomemo
+1@glast	mapflag	nomemo
 dali	mapflag	nomemo
 dali02	mapflag	nomemo
 

+ 1 - 0
npc/re/mapflag/nopvp.txt

@@ -33,6 +33,7 @@
 1@sara	mapflag	pvp	off
 1@gef_in	mapflag	pvp	off
 1@xm_d	mapflag	pvp	off
+1@glast	mapflag	pvp	off
 
 // Cities ========================
 moc_para01	mapflag	pvp	off

+ 1 - 0
npc/re/mapflag/nosave.txt

@@ -109,4 +109,5 @@ que_avan01	mapflag	nosave	SavePoint
 1@face	mapflag	nosave	SavePoint
 1@sara	mapflag	nosave	SavePoint
 1@gef_in	mapflag	nosave	SavePoint
+1@glast	mapflag	nosave	SavePoint
 dali	mapflag	nosave	SavePoint

+ 2 - 0
npc/re/mapflag/noteleport.txt

@@ -94,6 +94,8 @@ gl_cas02_	mapflag	noteleport
 1@sara	mapflag	monster_noteleport
 1@gef_in	mapflag	noteleport
 1@gef_in	mapflag	monster_noteleport
+1@glast	mapflag	noteleport
+1@glast	mapflag	monster_noteleport
 dali	mapflag	noteleport
 dali02	mapflag	noteleport
 

+ 14 - 0
npc/re/mapflag/nowarpto.txt

@@ -8,8 +8,21 @@
 //===== Changelogs: ==========================================
 //= 1.0 Renewal split. [Euphy]
 //= 1.1 Added WOE:TE maps [Cydh]
+//= 1.2 Added Novice Island RE Maps. [mazvi]
 //============================================================
 
+// Novice Island ===================
+int_land	mapflag	nowarpto
+int_land01	mapflag	nowarpto
+int_land02	mapflag	nowarpto
+int_land03	mapflag	nowarpto
+int_land04	mapflag	nowarpto
+iz_int	mapflag	nowarpto
+iz_int01	mapflag	nowarpto
+iz_int02	mapflag	nowarpto
+iz_int03	mapflag	nowarpto
+iz_int04	mapflag	nowarpto
+
 // 14.1 Bifrost ==================
 1@mist	mapflag	nowarpto
 que_house_s	mapflag	nowarpto
@@ -53,6 +66,7 @@ gl_cas02_	mapflag	nowarpto
 1@face	mapflag	nowarpto
 1@sara	mapflag	nowarpto
 1@gef_in	mapflag	nowarpto
+1@glast	mapflag	nowarpto
 
 // WOE:TE Maps ===================
 te_prtcas01	mapflag	nowarpto

+ 1 - 0
npc/re/mapflag/partylock.txt

@@ -52,6 +52,7 @@
 1@face	mapflag	partylock
 1@sara	mapflag	partylock
 1@gef_in	mapflag	partylock
+1@glast	mapflag	partylock
 
 // Horror Toy Factory
 1@xm_d	mapflag	partylock

+ 1 - 0
npc/re/mapflag/restricted.txt

@@ -21,6 +21,7 @@
 1@ecl	mapflag	restricted	6
 1@xm_d	mapflag	restricted	6
 1@face	mapflag	restricted	6
+1@glast	mapflag	restricted	6
 
 // Towns =========================
 brasilis	mapflag	restricted	7

+ 12 - 0
npc/re/mobs/int_land.txt

@@ -0,0 +1,12 @@
+//===== rAthena Script =======================================
+//= Beginner Area Monster Spawn Script
+//===== Changelogs: ==========================================
+//= 1.0 First version. [Ridley]
+//= 1.1 Export from Hercules to rAthena. [Jenkijo]
+//============================================================
+
+int_land,0,0	monster	Poring	2401,30,5000
+int_land01,0,0	monster	Poring	2401,30,5000
+int_land02,0,0	monster	Poring	2401,30,5000
+int_land03,0,0	monster	Poring	2401,30,5000
+int_land04,0,0	monster	Poring	2401,30,5000

+ 1 - 0
npc/re/scripts_athena.conf

@@ -63,6 +63,7 @@ npc: npc/re/instances/OctopusCave.txt
 npc: npc/re/instances/OldGlastHeim.txt
 npc: npc/re/instances/WolfchevLaboratory.txt
 npc: npc/re/instances/EclageInterior.txt
+npc: npc/re/instances/SarahAndFenrir.txt
 npc: npc/re/instances/SaraMemory.txt
 //npc: npc/custom/official/GeffenMagicTournament.txt
 

+ 1 - 0
npc/re/scripts_monsters.conf

@@ -5,6 +5,7 @@
 //npc: npc/re/mobs/academy.txt
 npc: npc/re/mobs/championmobs.txt
 npc: npc/re/mobs/citycleaners.txt
+npc: npc/re/mobs/int_land.txt
 npc: npc/re/mobs/towns.txt
 
 // -------------------------- Dungeons --------------------------

+ 57 - 14
npc/re/warps/cities/izlude.txt

@@ -52,6 +52,63 @@ izlude_b,52,172,0	warp	iz04_b	2,2,izlude_in,74,161
 izlude_c,52,172,0	warp	iz04_c	2,2,izlude_in,74,161
 izlude_d,52,172,0	warp	iz04_d	2,2,izlude_in,74,161
 
+//= iz_int(Intro) & int_land(Secluded Island) ================
+iz_int,27,30,0	warp	#room_out	1,1,iz_int,51,30
+iz_int01,27,30,0	warp	#room_out01	1,1,iz_int01,51,30
+iz_int02,27,30,0	warp	#room_out02	1,1,iz_int02,51,30
+iz_int03,27,30,0	warp	#room_out03	1,1,iz_int03,51,30
+iz_int04,27,30,0	warp	#room_out04	1,1,iz_int04,51,30
+
+iz_int,47,30,0	warp	#room_in	1,1,iz_int,22,30
+iz_int01,47,30,0	warp	#room_in01	1,1,iz_int01,22,30
+iz_int02,47,30,0	warp	#room_in02	1,1,iz_int02,22,30
+iz_int03,47,30,0	warp	#room_in03	1,1,iz_int03,22,30
+iz_int04,47,30,0	warp	#room_in04	1,1,iz_int04,22,30
+
+iz_int,56,15,0	script	#ship_out	WARPNPC,1,1,{
+	end;
+OnTouch:
+	.@num$ = replacestr( strnpcinfo(2), "ship_out", "" );
+	.@map$ = "int_land" + .@num$;
+	savepoint .@map$,77,101;
+	warp .@map$,85,107;
+	end;
+}
+iz_int01,56,15,0	duplicate(#ship_out)	#ship_out01	WARPNPC,1,1
+iz_int02,56,15,0	duplicate(#ship_out)	#ship_out02	WARPNPC,1,1
+iz_int03,56,15,0	duplicate(#ship_out)	#ship_out03	WARPNPC,1,1
+iz_int04,56,15,0	duplicate(#ship_out)	#ship_out04	WARPNPC,1,1
+
+int_land,49,57,0	script	#intro_to_izlude	WARPNPC,2,2,{
+	end;
+OnTouch:
+	if (isbegin_quest(21008) == 1) {
+		mes "^4d4dffOnce you leave this island there is no way back.";
+		mes "Are you sure you want to go directly to Izlude?^000000";
+		next;
+		mes "^4d4dffIf you do, the quest will be deleted from your Quest Log.^000000";
+		next;
+		if (select("Do not go to Izlude yet", "Sail to Izlude!") == 1) {
+			mes "[Sailor]";
+			mes "You want to stay here longer?";
+			mes "Good, then I'll wait until you're ready~";
+			close;
+		}
+		completequest 21008;
+	}
+	mes "[Sailor]";
+	mes "Let's head towards Izlude!";
+	close2;
+	if (isbegin_quest(21001) == 1)
+		completequest 21001;
+	warp "izlude" + replacestr( strnpcinfo(2), "intro_to_izlude", "" ),196,209;
+	end;
+}
+int_land01,49,57,0	duplicate(#intro_to_izlude)	#intro_to_izlude_a	WARPNPC,2,2
+int_land02,49,57,0	duplicate(#intro_to_izlude)	#intro_to_izlude_b	WARPNPC,2,2
+int_land03,49,57,0	duplicate(#intro_to_izlude)	#intro_to_izlude_c	WARPNPC,2,2
+int_land04,49,57,0	duplicate(#intro_to_izlude)	#intro_to_izlude_d	WARPNPC,2,2
+
 //= Izlude Academy ===========================================
 izlude,125,257,0	warp	#to_ac01	2,2,iz_ac01,99,29
 izlude,130,257,0	warp	#to_ac02	2,2,iz_ac01,99,29
@@ -62,20 +119,6 @@ iz_ac02,94,27,0	warp	#to_ac1f01	2,2,iz_ac01,78,28
 iz_ac02,113,27,0	warp	#to_ac1f02	2,2,iz_ac01,122,28
 new_1-3,96,176,0	warp	#to_ac01-2	1,1,iz_ac01,49,73
 
-iz_int,96,73,0	script	iz_int_iz	WARPNPC,2,2,{
-	end;
-
-OnTouch:
-	savepoint "izlude",128,98,1,1;
-	warp "izlude"+strnpcinfo(2)+"", 195, 209;
-	end;
-}
-
-iz_int01,96,73,0	duplicate(iz_int_iz)	iz_int_iz#_a	WARPNPC,2,2
-iz_int02,96,73,0	duplicate(iz_int_iz)	iz_int_iz#_b	WARPNPC,2,2
-iz_int03,96,73,0	duplicate(iz_int_iz)	iz_int_iz#_c	WARPNPC,2,2
-iz_int04,96,73,0	duplicate(iz_int_iz)	iz_int_iz#_d	WARPNPC,2,2
-
 //= Izlude Academy Duplicates ================================
 izlude_a,125,257,0	warp	#to_ac01_a	2,2,iz_ac01_a,99,29
 izlude_b,125,257,0	warp	#to_bc01_b	2,2,iz_ac01_b,99,29

+ 3 - 0
npc/re/warps/other/dimensional_gap.txt

@@ -62,3 +62,6 @@ dali,149,82,0	warp	dg001	2,2,mid_camp,210,289
 dali,122,48,0	warp	dg002	2,2,moc_fild22b,227,200
 dali,38,87,0	warp	dg003	2,2,bif_fild01,318,155
 dali,34,139,0	warp	dg004	2,2,dic_fild02,237,32
+
+dali,64,129,0	warp	#dali_to_dali02	1,1,dali02,66,101
+dali02,66,97,0	warp	#dali02_to_dali	1,1,dali,64,125

+ 4 - 4
sql-files/item_db_re.sql

@@ -7503,7 +7503,7 @@ REPLACE INTO `item_db_re` VALUES (13449,'Gladius_Daemonicus','Gladius Daemonicus
 REPLACE INTO `item_db_re` VALUES (13450,'Saber__','Saber',5,10,NULL,1000,'115',NULL,NULL,2,0x000654E2,63,2,2,3,'27',1,0,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (13451,'Ru_Blue_Sword','Blue Sword',5,10,NULL,1200,'190',NULL,1,1,0x00000080,56,2,2,3,'100',1,2,'bonus bStr,5; bonus bAgi,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (13452,'Ru_Gold_Sword','Ru Gold Sword',5,0,NULL,1200,'190',NULL,1,2,0x00000080,56,2,2,3,'120',1,2,'bonus bStr,8; bonus bAgi,8;',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (13454,'Crimson_Saber','Crimson Saber',5,20,NULL,850,'85',NULL,1,2,0x000654E3,56,2,2,3,'70',1,2,'.@r = getrefine(); bonus bBaseAtk,((BaseLevel/10)*5)+(.@r<=15?pow(.@r,2):225);',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (13454,'Crimson_Saber','Crimson Saber',5,20,NULL,850,'85',NULL,1,2,0x000654E3,63,2,2,3,'70',1,2,'.@r = getrefine(); bonus bBaseAtk,((BaseLevel/10)*5)+(.@r<=15?pow(.@r,2):225);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (13455,'Saber_of_Vicious_Mind','Saber of Vicious Mind',5,20,NULL,1350,'135',NULL,1,1,0x000654E3,63,2,2,4,'160',1,2,'bonus bAtk,pow(min(getrefine(),15),2);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (13456,'Unity_Sword','Unity Sword',5,20,NULL,420,'80',NULL,1,1,0x000654E3,56,2,2,3,'1',1,2,'bonus bBaseAtk,pow(getrefine(),2)*125/100;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (13457,'Unity_Dagger','Unity Dagger',5,20,NULL,270,'52',NULL,1,1,0x028F5EEF,63,2,2,3,'1',1,1,'bonus bBaseAtk,pow(getrefine(),2)*125/100;',NULL,NULL);
@@ -9547,7 +9547,7 @@ REPLACE INTO `item_db_re` VALUES (18561,'B_Feather_Beret','B Feather Beret',4,20
 REPLACE INTO `item_db_re` VALUES (18562,'Bone_Hat','Bone Hat',4,20,NULL,200,NULL,3,NULL,1,0xFFFFFFFF,63,2,256,NULL,'10',1,732,'bonus bMdef,3;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18563,'Heart_Wing_Hairband','Heart Wing Hairband',4,20,NULL,300,NULL,0,NULL,1,0xFFFFFFFF,63,2,256,NULL,'50',1,733,'bonus bUseSPrate,-10; bonus bDelayrate,-5; .@r = getrefine()/3; if(.@r>0){ bonus bUseSPrate,.@r*3; bonus bDelayrate,.@r*3; }',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18564,'Love_Piece','Love Piece',4,20,NULL,200,NULL,0,NULL,0,0xFFFFFFFF,63,2,1,NULL,'50',0,734,'bonus bNoCastCancel,1; bonus bUseSPrate,15;',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (18565,'Leprechaun_Hat','St Patrick\'s Hat',4,20,NULL,300,NULL,8,NULL,1,0xFFFFFFFF,63,2,256,NULL,'40',1,735,'bonus bStr,1; bonus bInt,1; bonus bMdef,4; if(getrefine()>6){ bonus2 bAddMonsterDropItem,12135,50; }',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (18565,'Leprechaun_Hat','St Patrick\'s Hat',4,20,NULL,300,NULL,8,NULL,1,0xFFFFFFFF,63,2,256,NULL,'40',1,735,'bonus bStr,1; bonus bInt,1; bonus bMdef,4; if(getrefine()>7){ bonus2 bAddMonsterDropItem,12135,50; }',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18566,'Nut_Donut_In_Mouth','Nut Donut In Mouth',4,20,NULL,0,NULL,1,NULL,0,0xFFFFFFFF,63,2,1,NULL,'0',0,736,'bonus bBaseAtk,5; bonus bMatk,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18567,'Stretched_Nose','Stretched Nose',4,20,NULL,100,NULL,0,NULL,0,0xFFFFFFFF,63,2,1,NULL,'0',0,737,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18568,'Humming_Bird','Humming Bird',4,20,NULL,100,NULL,3,NULL,0,0xFFFFFFFF,63,2,256,NULL,'10',0,702,'bonus bMdef,6;',NULL,NULL);
@@ -11511,8 +11511,8 @@ REPLACE INTO `item_db_re` VALUES (28315,'RCC2013_ARMLET','RCC2013_ARMLET',4,200,
 REPLACE INTO `item_db_re` VALUES (28316,'RCC2013_ARMLET_','RCC2013_ARMLET_',4,200,NULL,200,NULL,NULL,NULL,1,0xFFFFFFFF,63,2,136,NULL,'1',0,NULL,'bonus2 bAddClass,Class_All,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (28317,'RCC2013_RING','RCC2013_RING',4,200,NULL,200,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,136,NULL,'1',0,NULL,'bonus2 bAddClass,Class_All,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (28318,'RCC2013_RING_','RCC2013_RING_',4,200,NULL,200,NULL,NULL,NULL,1,0xFFFFFFFF,63,2,136,NULL,'1',0,NULL,'bonus2 bAddClass,Class_All,1;',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (28310,'Earring_Of_Sarah_L','Sarah\'s Left Earring',4,10,NULL,100,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,128,NULL,'145',0,NULL,'skill "AL_HEAL",1;',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (28311,'Earring_Of_Sarah_R','Sarah\'s Right Earring',4,10,NULL,100,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,8,NULL,'145',0,NULL,'skill "AL_TELEPORT",1;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (28310,'Earring_Of_Sarah_L','Sarah\'s Left Earring',4,10,NULL,100,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,136,NULL,'145',0,NULL,'skill "AL_HEAL",1;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (28311,'Earring_Of_Sarah_R','Sarah\'s Right Earring',4,10,NULL,100,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,136,NULL,'145',0,NULL,'skill "AL_TELEPORT",1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (28321,'Falconer_Claw','Falconer Claw',4,0,NULL,100,NULL,5,NULL,1,0x00000800,63,2,136,NULL,'80',0,NULL,'bonus bDex,1; bonus2 bSkillAtk,"HT_BLITZBEAT",getskilllv("HT_STEELCROW")*10;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (28322,'Falconer_Glove','Falconer Glove',4,0,NULL,100,NULL,5,NULL,1,0x00000800,63,2,136,NULL,'80',0,NULL,'bonus bDex,1; bonus bUseSPrate,-5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (28326,'Broken_Chip_1','Broken Chips 01',4,10,NULL,100,NULL,NULL,NULL,1,0xFFFFFFFF,63,2,136,NULL,'100',0,NULL,'bonus bStr,4;',NULL,NULL);

+ 103 - 15
sql-files/mob_db_re.sql

@@ -2410,17 +2410,17 @@ REPLACE INTO `mob_db_re` VALUES (3170,'J_REB_SHECIL2','Shooting Target','Shootin
 #3187,E2_G_S_NYDHOG
 #3188,E2_FELOCK
 #3189,WOLF_MOON
-#3190,MM_SARAH
-#3191,MM_M_GIGAN1
-#3192,MM_M_GIGAN2
-#3193,MM_M_GIGAN3
-#3194,MM_L_GIGAN1
-#3195,MM_L_GIGAN2
-#3196,MM_L_GIGAN3
-#3197,MM_M_GARGOYLE
-#3198,MM_M_GALION
-#3199,MM_M_MUTANT_DRAGON
-#3200,MM_M_CHIMERA
+REPLACE INTO `mob_db_re` VALUES (3190,'MM_SARAH','Sarah','Sarah Irene',160,100000000,1,0,0,12,1090,2755,276,255,43,161,6,188,225,136,10,12,0,0,20,0x87700A4,2000,500,500,0,0,0,0,0,0,0,0,15121,1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4610,1);
+REPLACE INTO `mob_db_re` VALUES (3191,'MM_M_GIGAN1','Gigantes','Gigantes',160,6653400,1,0,1,2,4635,4755,64,112,156,151,30,62,265,21,10,12,1,6,47,0x62D3885,250,500,500,600,0,0,0,0,0,0,0,15121,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3192,'MM_M_GIGAN2','Gigantes','Gigantes',160,9870000,1,0,0,2,5128,5217,89,175,212,138,43,21,227,15,10,12,1,6,47,0x62A3885,250,500,500,600,0,0,0,0,0,0,0,15121,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3193,'MM_M_GIGAN3','Ancient Medium Gigantes','Ancient Medium Gigantes',160,1126300,1,0,0,2,3967,4132,113,155,121,125,45,35,271,15,10,12,1,6,47,0x6283885,300,500,500,600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3194,'MM_L_GIGAN1','Large Gigantes','Large Gigantes',160,2482000,1,0,0,2,4172,4254,55,177,135,135,12,72,220,91,10,12,2,6,47,0x62D3885,200,500,500,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3195,'MM_L_GIGAN2','Large Gigantes','Large Gigantes',160,2784175,1,0,0,2,3641,3757,71,140,102,119,18,45,275,71,10,12,2,6,47,0x62A3885,200,500,500,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3196,'MM_L_GIGAN3','Ancient Gigantes','Ancient Gigantes',160,12063464,1,0,0,2,8957,9018,48,190,203,141,1,66,355,103,10,12,2,6,47,0x6283885,330,800,800,500,0,0,0,0,0,0,0,6803,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3197,'MM_M_GARGOYLE','Gargoyle','Mutant Gargoyle',150,256780,1,0,0,9,712,801,124,43,147,110,66,57,191,70,10,12,1,6,64,0x2002085,200,1020,720,384,0,0,0,0,0,0,0,912,1940,1039,250,1746,3,0,0,2619,1,1769,1000,757,119,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3198,'MM_M_GALION','Galion','Mutant Galion',150,293165,1,0,0,1,801,878,166,71,133,142,71,45,166,45,10,12,1,2,44,0x020108F,150,864,624,360,0,0,0,0,0,0,0,7564,1500,919,1500,996,5,2531,3,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3199,'MM_M_MUTANT_DRAGON','Mutant Dragon','Wicked Mutant Dragon',150,324891,1,0,0,4,1176,1274,185,86,175,161,66,68,201,35,10,12,2,9,43,0x0203695,250,1280,1080,240,0,0,0,0,0,0,0,7054,2425,1035,250,1036,250,930,250,1559,50,7296,750,2527,25,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3200,'MM_M_CHIMERA','Wicked Chimera','Wicked Chimera',150,301158,1,0,0,1,1029,1177,199,10,166,175,110,88,188,85,10,12,2,2,63,0x0203695,200,772,672,360,0,0,0,0,0,0,0,7054,2668,1048,1250,568,500,1306,1,7295,750,1364,1,984,80,0,0,0,0,0,0);
 #REPLACE INTO `mob_db_re` VALUES (3201,'LUCKYCASE','Poring','Poring',1,60,1,27,20,1,8,9,2,5,6,1,1,0,6,5,10,12,1,3,21,0x83,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 REPLACE INTO `mob_db_re` VALUES (3202,'ORGANIC_JAKK','Organic Pumpkin','Organic Pumpkin',10,40,1,20,13,1,100,100,160,99,1,1,1,1,999,1,0,0,0,3,21,0x4370001,200,0,0,0,0,0,0,0,0,0,0,6804,5000,6804,5000,6804,1000,2267,100,1062,1000,664,100,546,1000,12192,100,0,0,0,0);
 REPLACE INTO `mob_db_re` VALUES (3203,'INORGANIC_JAKK','Inorganic Pumpkin','Inorganic Pumpkin',10,40,1,20,13,1,100,100,160,99,1,1,1,1,999,1,0,0,0,3,21,0x4370001,200,0,0,0,0,0,0,0,0,0,0,6805,5000,6805,5000,6805,1000,2267,100,1062,1000,664,100,546,1000,12192,100,0,0,0,0);
@@ -3127,7 +3127,12 @@ REPLACE INTO `mob_db_re` VALUES (3508,'DR_EGGRING_G','Eggring','Eggring',20,220,
 #3901,MD_ORK_HERO
 #3902,MD_ORC_LORD
 #3903,MD_ORC_FLOWER
-
+#3904,DUCKLING
+#3905,BIG_DUCKLING
+#3906,IA_LOLI_RURI
+#3907,IA_TEDDY_BEAR
+#3908,IA_MIYABI_NINGYO
+#3909,IA_MARIONETTE
 #3910,E_EMPEL_1
 #3911,E_GIBBET
 #3912,E_LOLI_RURI
@@ -3166,14 +3171,34 @@ REPLACE INTO `mob_db_re` VALUES (3508,'DR_EGGRING_G','Eggring','Eggring',20,220,
 #3945,JP_E_MONSTER_103
 #3946,JP_E_MONSTER_104
 #3947,JP_E_MONSTER_105
-
+#3948,ORC_WARRIOR_MJ
+#3949,ORC_LADY_MJ
+#3950,ORC_BABY_MJ
+#3951,HIGH_ORC_MJ
+#3952,ORC_ARCHER_MJ
+#3953,ORC_HERO_MJ
+#3954,ORC_LORD_MJ
 #3955,E_SAVAGE
 #3956,E_ELDER_WILOW
-
+#3957,HORNET_MJ
+#3958,MANTIS_MJ
+#3959,ARGOS_MJ
+#3960,MISTRESS_MJ
+#3961,BIGFOOT_MJ
+#3962,SNAKE_MJ
+#3963,WOLF_MJ
+#3964,EDDGA_MJ
+#3965,FRILLDORA_MJ
+#3966,SANDMAN_MJ
+#3967,HODE_MJ
+#3968,PHREEONI_MJ
 #3969,MD_RED_MUSHROOM
 #3970,MD_BLACK_MUSHROOM
 #3971,SKELION
-
+#3972,MD_THIEF_BUG__
+#3973,MD_THIEF_BUG
+#3974,MD_THIEF_BUG_EGG
+#3975,MD_GOLDEN_BUG
 #3976,EIRA_BRZ
 #3977,AB_MOB_051
 #3978,AB_MOB_052
@@ -3203,4 +3228,67 @@ REPLACE INTO `mob_db_re` VALUES (3508,'DR_EGGRING_G','Eggring','Eggring',20,220,
 #20022,AB_MOB_074
 #20023,AB_MOB_075
 #20024,AB_MOB_076
+#20025,JP_CM_MOB_001
+#20026,JP_CM_MOB_002
+#20027,JP_CM_MOB_003
+#20028,JP_CM_MOB_004
+#20029,JP_CM_MOB_005
+#20030,JP_CM_MOB_006
+#20031,JP_CM_MOB_007
+#20032,JP_CM_MOB_008
+#20033,JP_CM_MOB_009
+#20034,JP_CM_MOB_010
+#20035,JP_CM_MOB_011
+#20036,JP_CM_MOB_012
+#20037,JP_CM_MOB_013
+#20038,JP_CM_MOB_014
+#20039,JP_CM_MOB_015
+#20040,JP_CM_MOB_016
+#20041,JP_CM_MOB_017
+#20042,JP_CM_MOB_018
+#20043,JP_CM_MOB_019
+#20044,JP_CM_MOB_020
+#20045,JP_CM_MOB_021
+#20046,JP_CM_MOB_022
+#20047,JP_CM_MOB_023
+#20048,JP_CM_MOB_024
+#20049,JP_CM_MOB_025
+#20050,JP_CM_MOB_026
+#20051,JP_CM_MOB_027
+#20052,JP_CM_MOB_028
+#20053,JP_CM_MOB_029
+#20054,JP_CM_MOB_030
+#20055,JP_CM_MOB_031
+#20056,JP_CM_MOB_032
+#20057,JP_CM_MOB_033
+#20058,JP_CM_MOB_034
+#20059,JP_CM_MOB_035
+#20060,JP_CM_MOB_036
+#20061,EVT_BAPHOMET
+#20062,EVT_BAPHO_JR
+#20063,EVT_V_WOLF
+#20064,EVT_ECLIPSE
+#20065,EVT_VOCAL
+#20066,EVT_UNGOLIANT
+#20067,EVT_GEOGRAPHER
+#20068,EVT_MANTIS
+#20069,EVT_GRIZZLY
+#20070,EVT_KINDOFBEETLE
+#20071,EVT_BIGFOOT
+#20072,EVT_COCO
+#20073,E_SIROMA
+#20074,E_MYSTCASE
+#20075,E_X_PORING
+#20076,MD_MAYA
+#20077,MD_DENIRO
+#20078,MD_VITATA
+#20079,MD_ANDRE
+#20080,MD_PIERE
+#20081,MD_IZ_COELACANTH
+#20082,MD_IZ_MARSE
+#20083,MD_IZ_MERMAN
+#20084,MD_IZ_OBEAUNE
+#20085,MD_IZ_CORNUTUS
+#20086,RED_ERUMA_MJ
+#20087,SIORAVA_MJ
 

+ 8 - 39
src/char/CMakeLists.txt

@@ -1,7 +1,7 @@
 #
 # setup
 #
-set( SERVER_CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}  CACHE INTERNAL "" )
+set( CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}  CACHE INTERNAL "" )
 
 
 #
@@ -9,44 +9,11 @@ set( SERVER_CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}  CACHE INTERNAL "" )
 #
 if( BUILD_SERVERS )
 message( STATUS "Creating target char-server" )
-set( CHAR_HEADERS
-	"${SERVER_CHAR_SOURCE_DIR}/char.h"
-	"${SERVER_CHAR_SOURCE_DIR}/char_clif.h"
-	"${SERVER_CHAR_SOURCE_DIR}/char_cnslif.h"
-	"${SERVER_CHAR_SOURCE_DIR}/char_logif.h"
-	"${SERVER_CHAR_SOURCE_DIR}/char_mapif.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_auction.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_clan.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_elemental.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_guild.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_homun.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_mail.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_mercenary.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_party.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_pet.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_quest.h"
-	"${SERVER_CHAR_SOURCE_DIR}/int_storage.h"
-	"${SERVER_CHAR_SOURCE_DIR}/inter.h"
-	)
-set( CHAR_SOURCES
-	"${SERVER_CHAR_SOURCE_DIR}/char.c"
-	"${SERVER_CHAR_SOURCE_DIR}/char_clif.c"
-	"${SERVER_CHAR_SOURCE_DIR}/char_cnslif.c"
-	"${SERVER_CHAR_SOURCE_DIR}/char_logif.c"
-	"${SERVER_CHAR_SOURCE_DIR}/char_mapif.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_auction.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_clan.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_elemental.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_guild.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_homun.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_mail.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_mercenary.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_party.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_pet.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_quest.c"
-	"${SERVER_CHAR_SOURCE_DIR}/int_storage.c"
-	"${SERVER_CHAR_SOURCE_DIR}/inter.c"
-	)
+file(GLOB CHAR_HEADERS ${CHAR_SOURCE_DIR}/*.h)
+file(GLOB CHAR_SOURCES_C ${CHAR_SOURCE_DIR}/*.c)
+file(GLOB CHAR_SOURCES_CXX ${CHAR_SOURCE_DIR}/*.cpp)
+set(CHAR_SOURCES ${CHAR_SOURCES_C} ${CHAR_SOURCES_CXX})
+#message( STATUS "CHAR_SOURCES="${CHAR_SOURCES})
 set( DEPENDENCIES common )
 set( LIBRARIES ${GLOBAL_LIBRARIES} )
 set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
@@ -55,10 +22,12 @@ set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${CHAR_HEADERS} ${CHA
 source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
 source_group( char FILES ${CHAR_HEADERS} ${CHAR_SOURCES} )
 include_directories( ${INCLUDE_DIRS} )
+
 add_executable( char-server ${SOURCE_FILES} )
 add_dependencies( char-server ${DEPENDENCIES} )
 target_link_libraries( char-server ${LIBRARIES} ${DEPENDENCIES} )
 set_target_properties( char-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
+
 if( INSTALL_COMPONENT_RUNTIME )
 	cpack_add_component( Runtime_charserver DESCRIPTION "char-server" DISPLAY_NAME "char-server" GROUP Runtime )
 	install( TARGETS char-server

+ 26 - 7
src/common/CMakeLists.txt

@@ -1,9 +1,20 @@
 
 #
 # Create svnversion.h
+# tbd, could be rename version.h
 #
 message( STATUS "Creating svnversion.h" )
-if( SVNVERSION )
+if(GIT_VERSION)
+	# those 2 was done in parent to produce this
+	#include(GetGitVersion)
+	#get_git_version()
+	string(SUBSTRING ${GIT_VERSION} 0 10 SHORT_GIT_VERSION)
+	string(SUBSTRING ${GIT_HEAD_VERSION} 0 10 SHORT_GIT_HEAD_VERSION)
+	string(CONCAT GIT_STR_VERSIONS ${SHORT_GIT_VERSION} "_" ${SHORT_GIT_HEAD_VERSION})
+	#message( STATUS "git version=${GIT_STR_VERSIONS}" )
+	file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
+		"#ifndef SVNVERSION\n#define SVNVERSION ${GIT_STR_VERSIONS}\n#endif\n" )
+elseif( SVNVERSION )
 	file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
 		"#ifndef SVNVERSION\n#define SVNVERSION ${SVNVERSION}\n#endif\n" )
 else()
@@ -25,6 +36,7 @@ message( STATUS "Creating svnversion.h - done" )
 #
 set( COMMON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
 	CACHE PATH "common source directory" )
+#message( STATUS "DEBUG COMMON_SOURCE_DIR=${COMMON_SOURCE_DIR}" )
 mark_as_advanced( COMMON_SOURCE_DIR )
 
 set( COMMON_ALL_HEADERS
@@ -42,7 +54,7 @@ set( COMMON_MINI_HEADERS
 	${LIBCONFIG_HEADERS} # needed by showmsg.h
 	CACHE INTERNAL "" )
 set( COMMON_MINI_SOURCES
-	"${COMMON_SOURCE_DIR}/core.c"
+	"${COMMON_SOURCE_DIR}/core.cpp"
 	"${COMMON_SOURCE_DIR}/malloc.c"
 	"${COMMON_SOURCE_DIR}/showmsg.c"
 	"${COMMON_SOURCE_DIR}/strlib.c"
@@ -83,11 +95,12 @@ set( COMMON_BASE_HEADERS
 	"${COMMON_SOURCE_DIR}/mempool.h"
 	"${COMMON_SOURCE_DIR}/msg_conf.h"
 	"${COMMON_SOURCE_DIR}/cli.h"
+	"${COMMON_SOURCE_DIR}/yamlwrapper.h"
 	${LIBCONFIG_HEADERS} # needed by conf.h/showmsg.h
 	CACHE INTERNAL "common_base headers" )
 set( COMMON_BASE_SOURCES
 	"${COMMON_SOURCE_DIR}/conf.c"
-	"${COMMON_SOURCE_DIR}/core.c"
+	"${COMMON_SOURCE_DIR}/core.cpp"
 	"${COMMON_SOURCE_DIR}/db.c"
 	"${COMMON_SOURCE_DIR}/des.c"
 	"${COMMON_SOURCE_DIR}/ers.c"
@@ -108,24 +121,28 @@ set( COMMON_BASE_SOURCES
 	"${COMMON_SOURCE_DIR}/raconf.c"
 	"${COMMON_SOURCE_DIR}/msg_conf.c"
 	"${COMMON_SOURCE_DIR}/cli.c"
+	"${COMMON_SOURCE_DIR}/yamlwrapper.cpp"
 	${LIBCONFIG_SOURCES} # needed by conf.c/showmsg.c
 	CACHE INTERNAL "common_base sources" )
 set( COMMON_BASE_INCLUDE_DIRS
 	${LIBCONFIG_INCLUDE_DIRS}
+  ${YAML_INCLUDE_DIRS}
 	CACHE INTERNAL "common_base include dirs" )
 set( COMMON_BASE_DEFINITIONS
 	${LIBCONFIG_DEFINITIONS}
 	CACHE INTERNAL "common_base definitions" )
-set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
-set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
+set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} yaml-cpp )
+set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS}} )
 set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
 set( SOURCE_FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
 source_group( mt19937ar FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} )
 source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
+
 add_library( common_base ${SOURCE_FILES} )
 target_link_libraries( common_base ${LIBRARIES} )
 set_target_properties( common_base PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
 include_directories( ${INCLUDE_DIRS} )
+
 set( HAVE_common_base ON  CACHE INTERNAL "" )
 set( TARGET_LIST ${TARGET_LIST} common_base  CACHE INTERNAL "" )
 message( STATUS "Creating target common_base - done" )
@@ -147,17 +164,19 @@ set( COMMON_HEADERS
 set( COMMON_SOURCES
 	"${CMAKE_CURRENT_SOURCE_DIR}/sql.c"
 	CACHE INTERNAL "common sources" )
-set( DEPENDENCIES common_base )
+set( DEPENDENCIES common_base yaml-cpp )
 set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} )
 set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} )
 set( DEFINITIONS "${GLOBAL_DEFINITIONS}" )
 set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
 source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
+
 add_library( common ${SOURCE_FILES} )
 add_dependencies( common ${DEPENDENCIES} )
 target_link_libraries( common ${LIBRARIES} ${DEPENDENCIES} )
 set_target_properties( common PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
-include_directories( ${INCLUDE_DIRS} )
+include_directories( ${INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} )
+
 set( HAVE_common ON  CACHE INTERNAL "" )
 set( TARGET_LIST ${TARGET_LIST} common  CACHE INTERNAL "" )
 message( STATUS "Creating target common - done" )

+ 2 - 1
src/common/cbasetypes.h

@@ -288,7 +288,8 @@ typedef char bool;
 //#define SWAP(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b)))
 // Avoid "value computed is not used" warning and generates the same assembly code
 #define SWAP(a,b) if (a != b) ((a ^= b), (b ^= a), (a ^= b))
-#define swap_ptr(a,b) if ((a) != (b)) ((a) = (void*)((intptr_t)(a) ^ (intptr_t)(b)), (b) = (void*)((intptr_t)(a) ^ (intptr_t)(b)), (a) = (void*)((intptr_t)(a) ^ (intptr_t)(b)))
+#define swap_ptrcast(c,a,b) if ((a) != (b)) ((a) = static_cast<c>((void*)((intptr_t)(a) ^ (intptr_t)(b))), (b) = static_cast<c>((void*)((intptr_t)(a) ^ (intptr_t)(b))), (a) = static_cast<c>((void*)((intptr_t)(a) ^ (intptr_t)(b))) )
+#define swap_ptr(a,b) swap_ptrcast(void*,a,b)
 
 //////////////////////////////////////////////////////////////////////////
 // should not happen

+ 8 - 0
src/common/conf.h

@@ -4,10 +4,18 @@
 #ifndef _CONF_H_
 #define _CONF_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "cbasetypes.h"
 #include "../../3rdparty/libconfig/libconfig.h"
 
 int conf_read_file(config_t *config, const char *config_filename);
 int config_setting_copy(config_setting_t *parent, const config_setting_t *src);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // _CONF_H_

+ 1 - 1
src/common/db.c

@@ -2920,7 +2920,7 @@ void* linkdb_search( struct linkdb_node** head, void *key)
 		if( node->key == key ) {
 			if( node->prev && n > 5 ) {
 				//Moving the head in order to improve processing efficiency
-				if(node->prev) node->prev->next = node->next;
+				node->prev->next = node->next;
 				if(node->next) node->next->prev = node->prev;
 				node->next = *head;
 				node->prev = (*head)->prev;

+ 12 - 12
src/common/db.h

@@ -42,13 +42,13 @@
 #ifndef _DB_H_
 #define _DB_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <stdarg.h>
 
 #include "cbasetypes.h"
 
-#include <stdarg.h>
+#ifdef	__cplusplus
+extern "C" {
+#endif
 
 /*****************************************************************************\
  *  (1) Section with public typedefs, enums, unions, structures and defines. *
@@ -1133,12 +1133,12 @@ void  linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...);
 ///
 /// @param __vec Vector
 /// @param __n Size
-#define VECTOR_RESIZE(__vec,__n) \
+#define VECTOR_RESIZE(__vec,__n,__cast) \
 	do{ \
 		if( (__n) > VECTOR_CAPACITY(__vec) ) \
 		{ /* increase size */ \
-			if( VECTOR_CAPACITY(__vec) == 0 ) VECTOR_DATA(__vec) = aMalloc((__n)*sizeof(VECTOR_FIRST(__vec))); /* allocate new */ \
-			else VECTOR_DATA(__vec) = aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec))); /* reallocate */ \
+			if( VECTOR_CAPACITY(__vec) == 0 ) VECTOR_DATA(__vec) = (__cast)(aMalloc((__n)*sizeof(VECTOR_FIRST(__vec))) ); /* allocate new */ \
+			else VECTOR_DATA(__vec) = (__cast)(aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec))) ); /* reallocate */ \
 			memset(VECTOR_DATA(__vec)+VECTOR_LENGTH(__vec), 0, (VECTOR_CAPACITY(__vec)-VECTOR_LENGTH(__vec))*sizeof(VECTOR_FIRST(__vec))); /* clear new data */ \
 			VECTOR_CAPACITY(__vec) = (__n); /* update capacity */ \
 		} \
@@ -1150,7 +1150,7 @@ void  linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...);
 		} \
 		else if( (__n) < VECTOR_CAPACITY(__vec) ) \
 		{ /* reduce size */ \
-			VECTOR_DATA(__vec) = aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec))); /* reallocate */ \
+			VECTOR_DATA(__vec) = (__cast)(aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec))) ); /* reallocate */ \
 			VECTOR_CAPACITY(__vec) = (__n); /* update capacity */ \
 			if( VECTOR_LENGTH(__vec) > (__n) ) VECTOR_LENGTH(__vec) = (__n); /* update length */ \
 		} \
@@ -1164,15 +1164,15 @@ void  linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...);
 /// @param __vec Vector
 /// @param __n Empty positions
 /// @param __step Increase
-#define VECTOR_ENSURE(__vec,__n,__step) \
+#define VECTOR_ENSURE2(__vec,__n,__step,__cast) \
 	do{ \
 		size_t _empty_ = VECTOR_CAPACITY(__vec)-VECTOR_LENGTH(__vec); \
 		if( (__n) > _empty_ ) { \
 			while( (__n) > _empty_ ) _empty_ += (__step); \
-			VECTOR_RESIZE(__vec,_empty_+VECTOR_LENGTH(__vec)); \
+			VECTOR_RESIZE(__vec,_empty_+VECTOR_LENGTH(__vec),__cast); \
 		} \
 	}while(0)
-
+#define VECTOR_ENSURE(__vec,__n,__step) VECTOR_ENSURE2(__vec,__n,__step,int*)
 
 
 /// Inserts a zeroed value in the target index.
@@ -1428,7 +1428,7 @@ void  linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...);
 /// @param __n Empty positions
 /// @param __step Increase
 #define BHEAP_ENSURE(__heap,__n,__step) VECTOR_ENSURE(__heap,__n,__step)
-
+#define BHEAP_ENSURE2(__heap,__n,__step,__cast) VECTOR_ENSURE2(__heap,__n,__step,__cast)
 
 
 /// Returns the top value of the heap.

+ 38 - 1
src/common/mmo.h

@@ -167,6 +167,43 @@ enum item_types {
 	IT_MAX
 };
 
+/// Monster mode definitions to clear up code reading. [Skotlex]
+enum e_mode {
+	MD_NONE					= 0x0000000,
+	MD_CANMOVE				= 0x0000001,
+	MD_LOOTER				= 0x0000002,
+	MD_AGGRESSIVE			= 0x0000004,
+	MD_ASSIST				= 0x0000008,
+	MD_CASTSENSOR_IDLE		= 0x0000010,
+	MD_NORANDOM_WALK		= 0x0000020,
+	MD_NOCAST_SKILL			= 0x0000040,
+	MD_CANATTACK			= 0x0000080,
+	//FREE					= 0x0000100,
+	MD_CASTSENSOR_CHASE		= 0x0000200,
+	MD_CHANGECHASE			= 0x0000400,
+	MD_ANGRY				= 0x0000800,
+	MD_CHANGETARGET_MELEE	= 0x0001000,
+	MD_CHANGETARGET_CHASE	= 0x0002000,
+	MD_TARGETWEAK			= 0x0004000,
+	MD_RANDOMTARGET			= 0x0008000,
+	MD_IGNOREMELEE			= 0x0010000,
+	MD_IGNOREMAGIC			= 0x0020000,
+	MD_IGNORERANGED			= 0x0040000,
+	MD_MVP					= 0x0080000,
+	MD_IGNOREMISC			= 0x0100000,
+	MD_KNOCKBACK_IMMUNE		= 0x0200000,
+	MD_TELEPORT_BLOCK		= 0x0400000,
+	//FREE					= 0x0800000,
+	MD_FIXED_ITEMDROP		= 0x1000000,
+	MD_DETECTOR				= 0x2000000,
+	MD_STATUS_IMMUNE		= 0x4000000,
+	MD_SKILL_IMMUNE			= 0x8000000,
+};
+
+#define MD_MASK 0x000FFFF
+#define ATR_MASK 0x0FF0000
+#define CL_MASK 0xF000000
+
 // Questlog states
 enum quest_state {
 	Q_INACTIVE, ///< Inactive quest (the user can toggle between active and inactive quests)
@@ -407,7 +444,7 @@ struct s_elemental {
 	int elemental_id;
 	uint32 char_id;
 	short class_;
-	int mode;
+	enum e_mode mode;
 	int hp, sp, max_hp, max_sp, matk, atk, atk2;
 	short hit, flee, amotion, def, mdef;
 	int life_time;

+ 9 - 4
src/common/msg_conf.h

@@ -4,6 +4,8 @@
 #ifndef MSG_CONF_H
 #define	MSG_CONF_H
 
+#include "../config/core.h"
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -20,10 +22,13 @@ enum lang_types {
 	LANG_THA = 0x100,
 	LANG_MAX
 };
-// Multilanguage System.
-// Define which languages to enable (bitmask).
-// 0xFFF will enable all, while 0x000 will enable English only.
-#define LANG_ENABLE 0x000
+
+#ifndef LANG_ENABLE
+	// Multilanguage System.
+	// Define which languages to enable (bitmask).
+	// 0xFFF will enable all, while 0x000 will enable English only.
+	#define LANG_ENABLE 0x000
+#endif
 
 //read msg in table
 const char* _msg_txt(int msg_number,int size, char ** msg_table);

+ 6 - 18
src/login/CMakeLists.txt

@@ -7,24 +7,11 @@ set( LOGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}  CACHE INTERNAL "" )
 #
 if( BUILD_SERVERS )
 message( STATUS "Creating target login-server" )
-set( LOGIN_HEADERS
-	"${LOGIN_SOURCE_DIR}/account.h"
-	"${LOGIN_SOURCE_DIR}/ipban.h"
-	"${LOGIN_SOURCE_DIR}/login.h"
-	"${LOGIN_SOURCE_DIR}/loginclif.h"
-	"${LOGIN_SOURCE_DIR}/loginchrif.h"
-	"${LOGIN_SOURCE_DIR}/logincnslif.h"
-	"${LOGIN_SOURCE_DIR}/loginlog.h"
-	)
-set( LOGIN_SOURCES
-	"${LOGIN_SOURCE_DIR}/account.c"
-	"${LOGIN_SOURCE_DIR}/ipban.c"
-	"${LOGIN_SOURCE_DIR}/login.c"
-	"${LOGIN_SOURCE_DIR}/loginclif.c"
-	"${LOGIN_SOURCE_DIR}/loginchrif.c"
-	"${LOGIN_SOURCE_DIR}/logincnslif.c"
-	"${LOGIN_SOURCE_DIR}/loginlog.c"
-	)
+file(GLOB LOGIN_HEADERS ${LOGIN_SOURCE_DIR}/*.h)
+file(GLOB LOGIN_SOURCES_C ${LOGIN_SOURCE_DIR}/*.c)
+file(GLOB LOGIN_SOURCES_CXX ${LOGIN_SOURCE_DIR}/*.cpp)
+set(LOGIN_SOURCES ${LOGIN_SOURCES_C} ${LOGIN_SOURCES_CXX})
+#message( STATUS "LOGIN_SOURCES="${LOGIN_SOURCES})
 set( DEPENDENCIES common )
 set( LIBRARIES ${GLOBAL_LIBRARIES} )
 set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
@@ -33,6 +20,7 @@ set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${LOGIN_HEADERS} ${LO
 source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
 source_group( login FILES ${LOGIN_HEADERS} ${LOGIN_SOURCES} )
 include_directories( ${INCLUDE_DIRS} )
+
 add_executable( login-server ${SOURCE_FILES} )
 add_dependencies( login-server ${DEPENDENCIES} )
 target_link_libraries( login-server ${LIBRARIES} ${DEPENDENCIES} )

+ 0 - 45
src/login/server/CMakeLists.txt

@@ -1,45 +0,0 @@
-
-#
-# login server
-#
-if( BUILD_SERVERS )
-message( STATUS "Creating target login-server" )
-set( LOGIN_HEADERS
-	"${SERVER_LOGIN_SOURCE_DIR}/account.h"
-	"${SERVER_LOGIN_SOURCE_DIR}/ipban.h"
-	"${SERVER_LOGIN_SOURCE_DIR}/login.h"
-	"${SERVER_LOGIN_SOURCE_DIR}/loginclif.h"
-	"${SERVER_LOGIN_SOURCE_DIR}/loginchrif.h"
-	"${SERVER_LOGIN_SOURCE_DIR}/logincnslif.h"
-	"${SERVER_LOGIN_SOURCE_DIR}/loginlog.h"
-	)
-set( LOGIN_SOURCES
-	"${SERVER_LOGIN_SOURCE_DIR}/account.c"
-	"${SERVER_LOGIN_SOURCE_DIR}/ipban.c"
-	"${SERVER_LOGIN_SOURCE_DIR}/login.c"
-	"${SERVER_LOGIN_SOURCE_DIR}/loginclif.c"
-	"${SERVER_LOGIN_SOURCE_DIR}/loginchrif.c"
-	"${SERVER_LOGIN_SOURCE_DIR}/logincnslif.c"
-	"${SERVER_LOGIN_SOURCE_DIR}/loginlog.c"
-	)
-set( DEPENDENCIES common )
-set( LIBRARIES ${GLOBAL_LIBRARIES} )
-set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
-set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS} -DWITH_SQL" )
-set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${LOGIN_HEADERS} ${LOGIN_SOURCES} )
-source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
-source_group( login FILES ${LOGIN_HEADERS} ${LOGIN_SOURCES} )
-include_directories( ${INCLUDE_DIRS} )
-add_executable( login-server ${SOURCE_FILES} )
-add_dependencies( login-server ${DEPENDENCIES} )
-target_link_libraries( login-server ${LIBRARIES} ${DEPENDENCIES} )
-set_target_properties( login-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
-if( INSTALL_COMPONENT_RUNTIME )
-	cpack_add_component( Runtime_loginserver DESCRIPTION "login-server" DISPLAY_NAME "login-server" GROUP Runtime )
-	install( TARGETS login-server
-		DESTINATION "."
-		COMPONENT Runtime_loginserver )
-endif( INSTALL_COMPONENT_RUNTIME )
-set( TARGET_LIST ${TARGET_LIST} login-server  CACHE INTERNAL "" )
-message( STATUS "Creating target login-server - done" )
-endif( BUILD_SERVERS )

+ 5 - 86
src/map/CMakeLists.txt

@@ -9,92 +9,10 @@ set( MAP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}  CACHE INTERNAL "" )
 #
 if( BUILD_SERVERS )
 message( STATUS "Creating target map-server" )
-set( MAP_HEADERS
-	"${MAP_SOURCE_DIR}/atcommand.h"
-	"${MAP_SOURCE_DIR}/battle.h"
-	"${MAP_SOURCE_DIR}/battleground.h"
-	"${MAP_SOURCE_DIR}/buyingstore.h"
-	"${MAP_SOURCE_DIR}/chat.h"
-	"${MAP_SOURCE_DIR}/chrif.h"
-	"${MAP_SOURCE_DIR}/clan.h"
-	"${MAP_SOURCE_DIR}/clif.h"
-	"${MAP_SOURCE_DIR}/date.h"
-	"${MAP_SOURCE_DIR}/duel.h"
-	"${MAP_SOURCE_DIR}/elemental.h"
-	"${MAP_SOURCE_DIR}/guild.h"
-	"${MAP_SOURCE_DIR}/homunculus.h"
-	"${MAP_SOURCE_DIR}/instance.h"
-	"${MAP_SOURCE_DIR}/intif.h"
-	"${MAP_SOURCE_DIR}/itemdb.h"
-	"${MAP_SOURCE_DIR}/log.h"
-	"${MAP_SOURCE_DIR}/mail.h"
-	"${MAP_SOURCE_DIR}/map.h"
-	"${MAP_SOURCE_DIR}/mapreg.h"
-	"${MAP_SOURCE_DIR}/mercenary.h"
-	"${MAP_SOURCE_DIR}/mob.h"
-	"${MAP_SOURCE_DIR}/npc.h"
-	"${MAP_SOURCE_DIR}/party.h"
-	"${MAP_SOURCE_DIR}/path.h"
-	"${MAP_SOURCE_DIR}/pc.h"
-	"${MAP_SOURCE_DIR}/pc_groups.h"
-	"${MAP_SOURCE_DIR}/pet.h"
-	"${MAP_SOURCE_DIR}/quest.h"
-	"${MAP_SOURCE_DIR}/script.h"
-	"${MAP_SOURCE_DIR}/script_constants.h"
-	"${MAP_SOURCE_DIR}/searchstore.h"
-	"${MAP_SOURCE_DIR}/skill.h"
-	"${MAP_SOURCE_DIR}/status.h"
-	"${MAP_SOURCE_DIR}/storage.h"
-	"${MAP_SOURCE_DIR}/trade.h"
-	"${MAP_SOURCE_DIR}/unit.h"
-	"${MAP_SOURCE_DIR}/vending.h"
-	"${MAP_SOURCE_DIR}/cashshop.h"
-	"${MAP_SOURCE_DIR}/channel.h"
-	)
-set( MAP_SOURCES
-	"${MAP_SOURCE_DIR}/atcommand.c"
-	"${MAP_SOURCE_DIR}/battle.c"
-	"${MAP_SOURCE_DIR}/battleground.c"
-	"${MAP_SOURCE_DIR}/buyingstore.c"
-	"${MAP_SOURCE_DIR}/chat.c"
-	"${MAP_SOURCE_DIR}/chrif.c"
-	"${MAP_SOURCE_DIR}/clan.c"
-	"${MAP_SOURCE_DIR}/clif.c"
-	"${MAP_SOURCE_DIR}/date.c"
-	"${MAP_SOURCE_DIR}/duel.c"
-	"${MAP_SOURCE_DIR}/elemental.c"
-	"${MAP_SOURCE_DIR}/guild.c"
-	"${MAP_SOURCE_DIR}/homunculus.c"
-	"${MAP_SOURCE_DIR}/instance.c"
-	"${MAP_SOURCE_DIR}/intif.c"
-	"${MAP_SOURCE_DIR}/itemdb.c"
-	"${MAP_SOURCE_DIR}/log.c"
-	"${MAP_SOURCE_DIR}/mail.c"
-	"${MAP_SOURCE_DIR}/map.c"
-	"${MAP_SOURCE_DIR}/mapreg.c"
-	"${MAP_SOURCE_DIR}/mercenary.c"
-	"${MAP_SOURCE_DIR}/mob.c"
-	"${MAP_SOURCE_DIR}/npc.c"
-	"${MAP_SOURCE_DIR}/npc_chat.c"
-	"${MAP_SOURCE_DIR}/party.c"
-	"${MAP_SOURCE_DIR}/path.c"
-	"${MAP_SOURCE_DIR}/pc.c"
-	"${MAP_SOURCE_DIR}/pc_groups.c"
-	"${MAP_SOURCE_DIR}/pet.c"
-	"${MAP_SOURCE_DIR}/quest.c"
-	"${MAP_SOURCE_DIR}/script.c"
-	"${MAP_SOURCE_DIR}/searchstore.c"
-	"${MAP_SOURCE_DIR}/skill.c"
-	"${MAP_SOURCE_DIR}/status.c"
-	"${MAP_SOURCE_DIR}/storage.c"
-	"${MAP_SOURCE_DIR}/trade.c"
-	"${MAP_SOURCE_DIR}/unit.c"
-	"${MAP_SOURCE_DIR}/vending.c"
-	"${MAP_SOURCE_DIR}/cashshop.c"
-	"${MAP_SOURCE_DIR}/channel.c"
-	)
-set( DEPENDENCIES common )
-set( LIBRARIES ${GLOBAL_LIBRARIES} )
+file(GLOB MAP_HEADERS ${MAP_SOURCE_DIR}/*.hpp)
+file(GLOB MAP_SOURCES ${MAP_SOURCE_DIR}/*.cpp)
+set( DEPENDENCIES common yaml-cpp)
+set( LIBRARIES ${GLOBAL_LIBRARIES} yaml-cpp)
 set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
 set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
 if( WITH_PCRE )
@@ -109,6 +27,7 @@ set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${MAP_HEADERS} ${MAP_
 source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
 source_group( map FILES ${MAP_HEADERS} ${MAP_SOURCES} )
 include_directories( ${INCLUDE_DIRS} )
+
 add_executable( map-server ${SOURCE_FILES} )
 add_dependencies( map-server ${DEPENDENCIES} )
 target_link_libraries( map-server ${LIBRARIES} ${DEPENDENCIES} )

+ 3 - 2
src/map/Makefile.in

@@ -17,9 +17,10 @@ YAML_CPP_AR = ../../3rdparty/yaml-cpp/obj/yaml-cpp.a
 YAML_CPP_H = $(shell find ../../3rdparty/yaml-cpp/ -type f -name "*.h")
 YAML_CPP_INCLUDE = -I../../3rdparty/yaml-cpp/include
 
-MAP_OBJ = $(shell ls *.c | sed -e "s/\.c/\.o/g") $(shell ls *.cpp | sed -e "s/\.cpp/\.o/g")
+MAP_OBJ = $(shell ls *.cpp | sed -e "s/\.cpp/\.o/g")
+#MAP_OBJ += $(shell ls *.c | sed -e "s/\.c/\.o/g")
 MAP_DIR_OBJ = $(MAP_OBJ:%=obj/%)
-MAP_H = $(shell ls ../map/*.h) \
+MAP_H = $(shell ls ../map/*.hpp) \
 	$(shell ls ../config/*.h) 
 
 HAVE_MYSQL=@HAVE_MYSQL@

+ 19 - 16
src/map/achievement.c → src/map/achievement.cpp

@@ -1,6 +1,13 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "achievement.hpp"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+
 #include "../common/cbasetypes.h"
 #include "../common/malloc.h"
 #include "../common/nullpo.h"
@@ -9,20 +16,16 @@
 #include "../common/utils.h"
 #include "../common/yamlwrapper.h"
 
-#include "achievement.h"
-#include "chrif.h"
-#include "clif.h"
-#include "intif.h"
-#include "itemdb.h"
-#include "map.h"
-#include "pc.h"
-#include "script.h"
-#include "status.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <setjmp.h>
+#include "battle.hpp"
+#include "chrif.hpp"
+#include "clif.hpp"
+#include "intif.hpp"
+#include "itemdb.hpp"
+#include "map.hpp"
+#include "pc.hpp"
+#include "script.hpp"
+#include "status.hpp"
+#include "npc.hpp"
 
 static jmp_buf     av_error_jump;
 static char*       av_error_msg;
@@ -1120,7 +1123,7 @@ void achievement_read_db(void)
 	int i = 0;
 	const char *dbsubpath[] = {
 		"",
-		"/"DBIMPORT"/",
+		"/" DBIMPORT "/",
 		//add other path here
 	};
 
@@ -1169,7 +1172,7 @@ void achievement_read_db(void)
 		yaml_destroy_wrapper(adb_sub);
 		yaml_iterator_destroy(it);
 
-		ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filepath);
+		ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", count, filepath);
 	}
 
 	return;

+ 3 - 11
src/map/achievement.h → src/map/achievement.hpp

@@ -1,12 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef MAP_ACHIEVEMENTS_H
-#define MAP_ACHIEVEMENTS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef ACHIEVEMENT_HPP_
+#define ACHIEVEMENT_HPP_
 
 #include "../common/mmo.h"
 #include "../common/db.h"
@@ -126,8 +122,4 @@ const char *av_parse_simpleexpr(const char *p, struct av_condition *parent);
 long long achievement_check_condition(struct av_condition *condition, struct map_session_data *sd, int *count);
 void achievement_script_free(struct av_condition *condition);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MAP_ACHIEVEMENTS_H */
+#endif /* ACHIEVEMENT_HPP_ */

+ 42 - 34
src/map/atcommand.c → src/map/atcommand.cpp

@@ -1,6 +1,11 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "atcommand.hpp"
+
+#include <stdlib.h>
+#include <math.h>
+
 #include "../common/cbasetypes.h"
 #include "../common/mmo.h"
 #include "../common/timer.h"
@@ -13,32 +18,35 @@
 #include "../common/utils.h"
 #include "../common/conf.h"
 
-#include "map.h"
-#include "atcommand.h"
-#include "battle.h"
-#include "chat.h"
-#include "channel.h"
-#include "chrif.h"
-#include "duel.h"
-#include "instance.h"
-#include "intif.h"
-#include "pet.h"
-#include "homunculus.h"
-#include "mail.h"
-#include "mercenary.h"
-#include "elemental.h"
-#include "party.h"
-#include "script.h"
-#include "storage.h"
-#include "trade.h"
-#include "mapreg.h"
-#include "quest.h"
-#include "pc.h"
-#include "achievement.h"
-
-#include <stdlib.h>
-#include <math.h>
-
+#include "map.hpp"
+#include "battle.hpp"
+#include "chat.hpp"
+#include "channel.hpp"
+#include "chrif.hpp"
+#include "duel.hpp"
+#include "instance.hpp"
+#include "intif.hpp"
+#include "pet.hpp"
+#include "homunculus.hpp"
+#include "mail.hpp"
+#include "mercenary.hpp"
+#include "elemental.hpp"
+#include "party.hpp"
+#include "script.hpp"
+#include "storage.hpp"
+#include "trade.hpp"
+#include "mapreg.hpp"
+#include "quest.hpp"
+#include "pc.hpp"
+#include "pc_groups.hpp"
+#include "npc.hpp"
+#include "guild.hpp"
+#include "clif.hpp"
+#include "log.hpp"
+#include "itemdb.hpp" // MAX_ITEMGROUP
+#include "mob.hpp"
+#include "achievement.hpp"
+#include "clan.hpp"
 
 #define ATCOMMAND_LENGTH 50
 #define ACMD_FUNC(x) static int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)
@@ -1529,7 +1537,7 @@ ACMD_FUNC(help)
 	config_setting_t *help;
 	const char *text = NULL;
 	const char *command_name = NULL;
-	char *default_command = "help";
+	const char *default_command = "help";
 
 	nullpo_retr(-1, sd);
 
@@ -1900,7 +1908,7 @@ ACMD_FUNC(go)
 		{ MAP_NIFLHEIM,     21, 153 }, // 13=Niflheim
 		{ MAP_LOUYANG,     217,  40 }, // 14=Louyang
 #ifdef RENEWAL
-		{ MAP_NOVICE,       97, 90  }, // 15=Training Grounds (Renewal)
+		{ MAP_NOVICE,       18, 26  }, // 15=Training Grounds (Renewal)
 #else
 		{ MAP_NOVICE,       53, 111 }, // 15=Training Grounds
 #endif
@@ -6240,7 +6248,7 @@ ACMD_FUNC(autolootitem)
 ACMD_FUNC(autoloottype)
 {
 	uint8 action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset
-	enum item_types type = -1;
+	enum item_types type= IT_UNKNOWN;
 	int ITEM_MAX = 1533;
 
 	nullpo_retr(-1, sd);
@@ -6317,7 +6325,7 @@ ACMD_FUNC(autoloottype)
 				clif_displaymessage(fd, msg_txt(sd,1490)); // Item types on your autoloottype list:
 				while (i < IT_MAX) {
 					if (sd->state.autoloottype&(1<<i)) {
-						sprintf(atcmd_output, "  '%s' {%d}", itemdb_typename(i), i);
+						sprintf(atcmd_output, "  '%s' {%d}", itemdb_typename(static_cast<item_types>(i)), i);
 						clif_displaymessage(fd, atcmd_output);
 					}
 					i++;
@@ -8554,7 +8562,7 @@ ACMD_FUNC(clone)
 		y = sd->bl.y;
 	}
 
-	if((x = mob_clone_spawn(pl_sd, sd->bl.m, x, y, "", master, 0, flag?1:0, 0)) > 0) {
+	if((x = mob_clone_spawn(pl_sd, sd->bl.m, x, y, "", master, MD_NONE, flag?1:0, 0)) > 0) {
 		clif_displaymessage(fd, msg_txt(sd,128+flag*2));	// Evil Clone spawned. Clone spawned. Slave clone spawned.
 		return 0;
 	}
@@ -10649,7 +10657,7 @@ static void atcommand_config_read(const char* config_filename)
 		}
 	}
 
-	ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' command aliases in '"CL_WHITE"%s"CL_RESET"'.\n", num_aliases, config_filename);
+	ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' command aliases in '" CL_WHITE "%s" CL_RESET "'.\n", num_aliases, config_filename);
 	return;
 }
 void atcommand_db_load_groups(int* group_ids) {
@@ -10699,8 +10707,8 @@ void atcommand_db_clear(void) {
 
 void atcommand_doload(void) {
 	atcommand_db_clear();
-	atcommand_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
-	atcommand_alias_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
+	atcommand_db = stridb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA), ATCOMMAND_LENGTH);
+	atcommand_alias_db = stridb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA), ATCOMMAND_LENGTH);
 	atcommand_basecommands(); //fills initial atcommand_db with known commands
 	atcommand_config_read(ATCOMMAND_CONF_FILENAME);
 }

+ 6 - 14
src/map/atcommand.h → src/map/atcommand.hpp

@@ -1,13 +1,10 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _ATCOMMAND_H_
-#define _ATCOMMAND_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef _ATCOMMAND_HPP_
+#define _ATCOMMAND_HPP_
 
+#include "../common/cbasetypes.h"
 #include "../common/mmo.h"
 
 struct map_session_data;
@@ -23,10 +20,10 @@ extern char atcommand_symbol;
 extern char charcommand_symbol;
 extern int atcmd_binding_count;
 
-typedef enum {
+enum AtCommandType : uint8 {
 	COMMAND_ATCOMMAND = 1,
 	COMMAND_CHARCOMMAND = 2,
-} AtCommandType;
+} ;
 
 typedef int (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message);
 
@@ -47,9 +44,4 @@ struct atcmd_binding_data {
 };
 extern struct atcmd_binding_data** atcmd_binding;
 struct atcmd_binding_data* get_atcommandbind_byname(const char* name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ATCOMMAND_H_ */
+#endif /* _ATCOMMAND_HPP_ */

+ 32 - 33
src/map/battle.c → src/map/battle.cpp

@@ -1,6 +1,11 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "battle.hpp"
+
+#include <stdlib.h>
+#include <math.h>
+
 #include "../common/cbasetypes.h"
 #include "../common/timer.h"
 #include "../common/nullpo.h"
@@ -12,19 +17,21 @@
 #include "../common/strlib.h"
 #include "../common/utils.h"
 
-#include "map.h"
-#include "path.h"
-#include "pc.h"
-#include "homunculus.h"
-#include "mercenary.h"
-#include "elemental.h"
-#include "pet.h"
-#include "party.h"
-#include "battleground.h"
-#include "chrif.h"
-
-#include <stdlib.h>
-#include <math.h>
+#include "map.hpp"
+#include "path.hpp"
+#include "pc.hpp"
+#include "homunculus.hpp"
+#include "mercenary.hpp"
+#include "elemental.hpp"
+#include "pet.hpp"
+#include "party.hpp"
+#include "battleground.hpp"
+#include "chrif.hpp"
+#include "guild.hpp"
+#include "clif.hpp"
+#include "mob.hpp"
+#include "log.hpp"
+#include "pc_groups.hpp"
 
 int attr_fix_table[4][ELE_MAX][ELE_MAX];
 
@@ -1319,7 +1326,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
 		if (sc->data[SC_SU_STOOP])
 			damage -= damage * 90 / 100;
 
-		// Compressed code, fixed by map.h [Epoque]
+		// Compressed code, fixed by map.hpp [Epoque]
 		if (src->type == BL_MOB) {
 			if( sc->data[SC_MANU_DEF] && status_get_race2(src) == RC2_MANUK ){
 				damage -= damage * sc->data[SC_MANU_DEF]->val1 / 100;
@@ -2446,7 +2453,7 @@ static bool battle_skill_get_damage_properties(uint16 skill_id, int is_splash)
 	int nk = skill_get_nk(skill_id);
 	if( !skill_id && is_splash ) //If flag, this is splash damage from Baphomet Card and it always hits.
 		nk |= NK_NO_CARDFIX_ATK|NK_IGNORE_FLEE;
-	return nk;
+	return nk > 0;
 }
 
 /*=============================
@@ -2660,7 +2667,7 @@ static bool attack_ignores_def(struct Damage wd, struct block_list *src, struct
 		}
 	}
 
-	return (nk&NK_IGNORE_DEF);
+	return (nk&NK_IGNORE_DEF) > 0;
 }
 
 /*================================================
@@ -6673,11 +6680,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 		}
 	}
 
-	switch(skill_id) {
-		default:
-			md.damage += battle_calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
-			break;
-	}
+	md.damage += battle_calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
 
 	if (sd && (i = pc_skillatk_bonus(sd, skill_id)))
 		md.damage += (int64)md.damage*i/100;
@@ -6719,15 +6722,11 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 			break;
 	}
 
-	switch(skill_id) {
-		default:
-			md.damage = battle_calc_damage(src,target,&md,md.damage,skill_id,skill_lv);
-			if(map_flag_gvg2(target->m))
-				md.damage = battle_calc_gvg_damage(src,target,md.damage,skill_id,md.flag);
-			else if(map[target->m].flag.battleground)
-				md.damage = battle_calc_bg_damage(src,target,md.damage,skill_id,md.flag);
-			break;
-	}
+	md.damage = battle_calc_damage(src,target,&md,md.damage,skill_id,skill_lv);
+	if(map_flag_gvg2(target->m))
+		md.damage = battle_calc_gvg_damage(src,target,md.damage,skill_id,md.flag);
+	else if(map[target->m].flag.battleground)
+		md.damage = battle_calc_bg_damage(src,target,md.damage,skill_id,md.flag);
 
 	// Skill damage adjustment
 #ifdef ADJUST_SKILL_DAMAGE
@@ -7556,7 +7555,7 @@ struct block_list* battle_get_master(struct block_list *src)
  * (enemy, friend, party, guild, etc)
  *------------------------------------------
  * Usage:
- * See battle.h for possible values/combinations
+ * See battle.hpp for possible values/combinations
  * to be used here (BCT_* constants)
  * Return value is:
  * 1: flag holds true (is enemy, party, etc)
@@ -8441,7 +8440,7 @@ static const struct _battle_data {
 	{ "guild_leaderchange_woe",				&battle_config.guild_leaderchange_woe,			0,		0,		1,				},
 	{ "guild_alliance_onlygm",              &battle_config.guild_alliance_onlygm,           0,      0,      1, },
 	{ "feature.achievement",                &battle_config.feature_achievement,             1,      0,      1,              },
-	{ "allow_bound_sell",                   &battle_config.allow_bound_sell,                1,      0,      1,              },
+	{ "allow_bound_sell",                   &battle_config.allow_bound_sell,                0,      0,      0x3,            },
 	{ "event_refine_chance",                &battle_config.event_refine_chance,             0,      0,      1,              },
 
 #include "../custom/battle_config_init.inc"
@@ -8626,7 +8625,7 @@ int battle_config_read(const char* cfgName)
  *--------------------------*/
 void do_init_battle(void)
 {
-	delay_damage_ers = ers_new(sizeof(struct delay_damage),"battle.c::delay_damage_ers",ERS_OPT_CLEAR);
+	delay_damage_ers = ers_new(sizeof(struct delay_damage),"battle.cpp::delay_damage_ers",ERS_OPT_CLEAR);
 	add_timer_func_list(battle_delay_damage_sub, "battle_delay_damage_sub");
 }
 

+ 22 - 23
src/map/battle.h → src/map/battle.hpp

@@ -1,30 +1,35 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _BATTLE_H_
-#define _BATTLE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef _BATTLE_HPP_
+#define _BATTLE_HPP_
 
+#include "../common/cbasetypes.h"
 #include "../common/mmo.h"
+
 #include "../config/core.h"
-#include "clif.h" // e_damage_type
-#include "map.h" //ELE_MAX
+
+#include "map.hpp" //ELE_MAX
+
+//fwd declaration
+struct map_session_data;
+struct mob_data;
+struct block_list;
+enum e_damage_type : uint8;
+
 
 /// State of a single attack attempt; used in flee/def penalty calculations when mobbed
-typedef enum damage_lv {
+enum damage_lv : uint8 {
 	ATK_NONE,    /// Not an attack
 	ATK_LUCKY,   /// Attack was lucky-dodged
 	ATK_FLEE,    /// Attack was dodged
 	ATK_MISS,    /// Attack missed because of element/race modifier.
 	ATK_BLOCK,   /// Attack was blocked by some skills.
 	ATK_DEF      /// Attack connected
-} damage_lv;
+};
 
 /// Flag of the final calculation
-enum e_battle_flag {
+enum e_battle_flag : uint16 {
 	BF_WEAPON	= 0x0001, /// Weapon attack
 	BF_MAGIC	= 0x0002, /// Magic attack
 	BF_MISC		= 0x0004, /// Misc attack
@@ -41,7 +46,7 @@ enum e_battle_flag {
 };
 
 /// Battle check target [Skotlex]
-enum e_battle_check_target {
+enum e_battle_check_target : uint32 {
 	BCT_NOONE		= 0x000000, ///< No one
 	BCT_SELF		= 0x010000, ///< Self
 	BCT_ENEMY		= 0x020000, ///< Enemy
@@ -80,10 +85,6 @@ struct Damage {
 //(Used in read pc.c,) attribute table (battle_attr_fix)
 extern int attr_fix_table[4][ELE_MAX][ELE_MAX];
 
-struct map_session_data;
-struct mob_data;
-struct block_list;
-
 // Damage Calculation
 
 struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int flag);
@@ -137,7 +138,7 @@ bool is_infinite_defense(struct block_list *target, int flag);
 #define MIN_BODY_STYLE battle_config.min_body_style
 #define MAX_BODY_STYLE battle_config.max_body_style
 
-extern struct Battle_Config
+struct Battle_Config
 {
 	int warp_point_debug;
 	int enable_critical;
@@ -636,7 +637,9 @@ extern struct Battle_Config
 	int event_refine_chance;
 
 #include "../custom/battle_config_struct.inc"
-} battle_config;
+};
+
+extern struct Battle_Config battle_config;
 
 void do_init_battle(void);
 void do_final_battle(void);
@@ -652,8 +655,4 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int
  **/
 int battle_damage_area( struct block_list *bl, va_list ap);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BATTLE_H_ */
+#endif /* _BATTLE_HPP_ */

+ 11 - 8
src/map/battleground.c → src/map/battleground.cpp

@@ -1,6 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "battleground.hpp"
+
 #include "../common/cbasetypes.h"
 #include "../common/timer.h"
 #include "../common/malloc.h"
@@ -8,14 +10,15 @@
 #include "../common/showmsg.h"
 #include "../common/strlib.h"
 
-#include "battleground.h"
-#include "battle.h"
-#include "clif.h"
-#include "npc.h"
-#include "pc.h"
-#include "pet.h"
-#include "homunculus.h"
-#include "mercenary.h"
+#include "battle.hpp"
+#include "clif.hpp"
+#include "npc.hpp"
+#include "pc.hpp"
+#include "pet.hpp"
+#include "homunculus.hpp"
+#include "mercenary.hpp"
+#include "guild.hpp"
+#include "mob.hpp"
 
 static DBMap* bg_team_db; // int bg_id -> struct battleground_data*
 static unsigned int bg_team_counter = 0; // Next bg_id

+ 4 - 12
src/map/battleground.h → src/map/battleground.hpp

@@ -1,15 +1,11 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _BATTLEGROUND_H_
-#define _BATTLEGROUND_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef _BATTLEGROUND_HPP_
+#define _BATTLEGROUND_HPP_
 
+#include "../common/cbasetypes.h"
 #include "../common/mmo.h" // struct party
-#include "guild.h"
 
 #define MAX_BG_MEMBERS 30
 
@@ -46,8 +42,4 @@ int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y);
 int bg_member_respawn(struct map_session_data *sd);
 int bg_send_message(struct map_session_data *sd, const char *mes, int len);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BATTLEGROUND_H_ */
+#endif /* _BATTLEGROUND_HPP_ */

+ 15 - 11
src/map/buyingstore.c → src/map/buyingstore.cpp

@@ -1,21 +1,25 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "buyingstore.hpp"  // struct s_buyingstore
+
+#include <stdlib.h> // atoi
+
 #include "../common/nullpo.h"
 #include "../common/db.h"  // ARR_FIND
 #include "../common/malloc.h" // aMalloc, aFree
 #include "../common/showmsg.h"  // ShowWarning
 #include "../common/socket.h"  // RBUF*
 #include "../common/strlib.h"  // safestrncpy
-#include "atcommand.h"  // msg_txt
-#include "battle.h"  // battle_config.*
-#include "buyingstore.h"  // struct s_buyingstore
-#include "clif.h"  // clif_buyingstore_*
-#include "log.h"  // log_pick_pc, log_zeny
-#include "pc.h"  // struct map_session_data
-#include "chrif.h"
+#include "../common/timer.h"  // gettick
 
-#include <stdlib.h> // atoi
+#include "atcommand.hpp"  // msg_txt
+#include "battle.hpp"  // battle_config.*
+#include "clif.hpp"  // clif_buyingstore_*
+#include "log.hpp"  // log_pick_pc, log_zeny
+#include "pc.hpp"  // struct map_session_data
+#include "chrif.hpp"
+#include "npc.hpp"
 
 //Autotrader
 static DBMap *buyingstore_autotrader_db; /// Holds autotrader info: char_id -> struct s_autotrader
@@ -628,7 +632,7 @@ void buyingstore_reopen( struct map_session_data* sd ){
 			// Immediate save
 			chrif_save(sd, CSAVE_AUTOTRADE);
 
-			ShowInfo("Buyingstore loaded for '"CL_WHITE"%s"CL_RESET"' with '"CL_WHITE"%d"CL_RESET"' items at "CL_WHITE"%s (%d,%d)"CL_RESET"\n",
+			ShowInfo("Buyingstore loaded for '" CL_WHITE "%s" CL_RESET "' with '" CL_WHITE "%d" CL_RESET "' items at " CL_WHITE "%s (%d,%d)" CL_RESET "\n",
 				sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
 		}
 		aFree(data);
@@ -641,7 +645,7 @@ void buyingstore_reopen( struct map_session_data* sd ){
 	}
 
 	if (fail != 0) {
-		ShowError("buyingstore_reopen: (Error:%d) Load failed for autotrader '"CL_WHITE"%s"CL_RESET"' (CID=%/AID=%d)\n", fail, sd->status.name, sd->status.char_id, sd->status.account_id);
+		ShowError("buyingstore_reopen: (Error:%d) Load failed for autotrader '" CL_WHITE "%s" CL_RESET "' (CID=%/AID=%d)\n", fail, sd->status.name, sd->status.char_id, sd->status.account_id);
 		map_quit(sd);
 	}
 }
@@ -742,7 +746,7 @@ void do_init_buyingstore_autotrade( void ) {
 			}
 			dbi_destroy(iter);
 
-			ShowStatus("Done loading '"CL_WHITE"%d"CL_RESET"' buyingstore autotraders with '"CL_WHITE"%d"CL_RESET"' items.\n", db_size(buyingstore_autotrader_db), items);
+			ShowStatus("Done loading '" CL_WHITE "%d" CL_RESET "' buyingstore autotraders with '" CL_WHITE "%d" CL_RESET "' items.\n", db_size(buyingstore_autotrader_db), items);
 		}
 	}
 

+ 7 - 10
src/map/buyingstore.h → src/map/buyingstore.hpp

@@ -1,14 +1,15 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _BUYINGSTORE_H_
-#define _BUYINGSTORE_H_
+#ifndef _BUYINGSTORE_HPP_
+#define _BUYINGSTORE_HPP_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "../common/cbasetypes.h"
+
+#include "map.hpp" //MESSAGE_SIZE
 
 struct s_search_store_search;
+struct map_session_data;
 
 #define MAX_BUYINGSTORE_SLOTS 5
 
@@ -68,8 +69,4 @@ void do_init_buyingstore(void);
 void do_init_buyingstore_autotrade( void );
 void buyingstore_reopen( struct map_session_data* sd );
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // _BUYINGSTORE_H_
+#endif  // _BUYINGSTORE_HPP_

+ 18 - 11
src/map/cashshop.c → src/map/cashshop.cpp

@@ -1,15 +1,19 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "cashshop.hpp"
+
+#include <string.h> // memset
+#include <stdlib.h> // atoi
+
 #include "../common/cbasetypes.h" // uint16, uint32
 #include "../common/malloc.h" // CREATE, RECREATE, aFree
 #include "../common/showmsg.h" // ShowWarning, ShowStatus
 
-#include "cashshop.h"
-#include "pet.h" // pet_create_egg
-
-#include <string.h> // memset
-#include <stdlib.h> // atoi
+#include "pc.hpp" // s_map_session_data
+#include "pet.hpp" // pet_create_egg
+#include "clif.hpp"
+#include "log.hpp"
 
 struct cash_item_db cash_shop_items[CASHSHOP_TAB_MAX];
 #if PACKETVER_SUPPORTS_SALES
@@ -71,7 +75,7 @@ static bool cashshop_parse_dbrow(char* fields[], int columns, int current) {
 static void cashshop_read_db_txt( void ){
 	const char* dbsubpath[] = {
 		"",
-		"/"DBIMPORT,
+		"/" DBIMPORT,
 	};
 	int fi;
 
@@ -90,7 +94,7 @@ static void cashshop_read_db_txt( void ){
 			safesnprintf(dbsubpath2,n1,"%s%s",db_path,dbsubpath[fi]);
 		}
 
-		sv_readdb(dbsubpath2, "item_cash_db.txt",          ',', 3, 3, -1, &cashshop_parse_dbrow, fi);
+		sv_readdb(dbsubpath2, "item_cash_db.txt", ',', 3, 3, -1, &cashshop_parse_dbrow, fi > 0);
 
 		aFree(dbsubpath1);
 		aFree(dbsubpath2);
@@ -113,8 +117,10 @@ static int cashshop_read_db_sql( void ){
 			continue;
 		}
 
+
 		while( SQL_SUCCESS == Sql_NextRow( mmysql_handle ) ){
 			char* str[3];
+			char dummy[256] = "";
 			int i;
 
 			++lines;
@@ -123,7 +129,7 @@ static int cashshop_read_db_sql( void ){
 				Sql_GetData( mmysql_handle, i, &str[i], NULL );
 
 				if( str[i] == NULL ){
-					str[i] = "";
+					str[i] = dummy;
 				}
 			}
 
@@ -137,7 +143,7 @@ static int cashshop_read_db_sql( void ){
 
 		Sql_FreeResult( mmysql_handle );
 
-		ShowStatus( "Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, cash_db_name[fi] );
+		ShowStatus( "Done reading '" CL_WHITE "%lu" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", count, cash_db_name[fi] );
 	}
 
 	return 0;
@@ -203,6 +209,7 @@ static void sale_read_db_sql( void ){
 
 	while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ){
 		char* str[4];
+		char dummy[256] = "";
 		int i;
 
 		lines++;
@@ -211,7 +218,7 @@ static void sale_read_db_sql( void ){
 			Sql_GetData( mmysql_handle, i, &str[i], NULL );
 
 			if( str[i] == NULL ){
-				str[i] = "";
+				str[i] = dummy;
 			}
 		}
 
@@ -225,7 +232,7 @@ static void sale_read_db_sql( void ){
 
 	Sql_FreeResult(mmysql_handle);
 
-	ShowStatus( "Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, sales_table );
+	ShowStatus( "Done reading '" CL_WHITE "%lu" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", count, sales_table );
 }
 
 static int sale_end_timer( int tid, unsigned int tick, int id, intptr_t data ){

+ 8 - 12
src/map/cashshop.h → src/map/cashshop.hpp

@@ -1,15 +1,15 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _CASHSHOP_H_
-#define _CASHSHOP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef _CASHSHOP_HPP_
+#define _CASHSHOP_HPP_
 
 #include "../common/cbasetypes.h" // uint16, uint32
-#include "pc.h" // struct map_session_data
+#include "../common/timer.h" // ShowWarning, ShowStatus
+
+#include "../config/packets.h"
+
+struct map_session_data;
 
 void do_init_cashshop( void );
 void do_final_cashshop( void );
@@ -96,8 +96,4 @@ bool sale_remove_item(uint16 nameid);
 void sale_notify_login( struct map_session_data* sd );
 #endif
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CASHSHOP_H_ */
+#endif /* _CASHSHOP_HPP_ */

+ 16 - 10
src/map/channel.c → src/map/channel.cpp

@@ -1,19 +1,25 @@
 // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "channel.hpp"
+
+#include <stdlib.h>
+
 #include "../common/cbasetypes.h"
 #include "../common/malloc.h"
 #include "../common/conf.h" //libconfig
 #include "../common/showmsg.h"
-#include "../common/nullpo.h"
 #include "../common/strlib.h" //safestrncpy
 #include "../common/socket.h" //set_eof
+#include "../common/timer.h"  // DIFF_TICK
+#include "../common/nullpo.h"
 
-#include "map.h" //msg_conf
-#include "clif.h" //clif_chsys_msg
-#include "channel.h"
-
-#include <stdlib.h>
+#include "map.hpp" //msg_conf
+#include "clif.hpp" //clif_chsys_msg
+#include "pc.hpp"
+#include "guild.hpp"
+#include "pc_groups.hpp"
+#include "battle.hpp"
 
 static DBMap* channel_db; // channels
 
@@ -39,7 +45,7 @@ struct Channel* channel_create(struct Channel *tmp_chan) {
 	CREATE(channel, struct Channel, 1); //will exit on fail allocation
 	//channel->id = tmp_chan->id;
 	channel->users = idb_alloc(DB_OPT_BASE);
-	channel->banned = idb_alloc(DB_OPT_BASE|DB_OPT_RELEASE_DATA);
+	channel->banned = idb_alloc(static_cast<DBOptions>(DB_OPT_BASE|DB_OPT_RELEASE_DATA) );
 	channel->opt = tmp_chan->opt;
 	channel->type = tmp_chan->type;
 	channel->color = tmp_chan->color;
@@ -563,7 +569,7 @@ int channel_pc_haschan(struct map_session_data *sd, struct Channel *channel){
  *   void: List of public channel and map and guild and number of users
  * @return 0 on success or -1 on failure
  */
-int channel_display_list(struct map_session_data *sd, char *options){
+int channel_display_list(struct map_session_data *sd, const char *options){
 
 	if(!sd || !options)
 		return -1;
@@ -1461,7 +1467,7 @@ void channel_read_config(void) {
 			}
 		}
 
-		ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel_db), channel_conf);
+		ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' channels in '" CL_WHITE "%s" CL_RESET "'.\n", db_size(channel_db), channel_conf);
 		config_destroy(&channels_conf);
 	}
 }
@@ -1470,7 +1476,7 @@ void channel_read_config(void) {
  * Initialise db and read configuration
  */
 void do_init_channel(void) {
-	channel_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, CHAN_NAME_LENGTH);
+	channel_db = stridb_alloc(static_cast<DBOptions>(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA), CHAN_NAME_LENGTH);
 	memset(&channel_config.private_channel, 0, sizeof(struct Channel));
 	memset(&channel_config.ally_tmpl, 0, sizeof(struct Channel));
 	memset(&channel_config.map_tmpl, 0, sizeof(struct Channel));

+ 11 - 11
src/map/channel.h → src/map/channel.hpp

@@ -4,11 +4,14 @@
 #ifndef CHANNEL_H
 #define	CHANNEL_H
 
-#include "pc.h"
+#include "../common/cbasetypes.h"
+#include "../common/mmo.h"
 
-#ifdef	__cplusplus
-extern "C" {
-#endif
+//namespace rA {
+
+struct map_session_data;
+struct guild;
+struct DBMap;
 
 #define CHAN_NAME_LENGTH 20
 #define CHAN_MSG_LENGTH 150
@@ -52,10 +55,11 @@ struct Channel {
 	unsigned short *groups;		  ///< List of group id, only these groups can join the channel
 };
 
-extern struct chan_banentry {
+struct chan_banentry {
 	uint32 char_id;
 	char char_name[NAME_LENGTH];
-} chan_banentry;
+};
+extern chan_banentry chan_banentry;
 
 struct Channel_Config {
 	unsigned long *colors;		///< List of available colors
@@ -105,7 +109,7 @@ struct Channel* channel_name2channel(char *chname, struct map_session_data *sd,
 int channel_haspc(struct Channel *channel,struct map_session_data *sd);
 int channel_haspcbanned(struct Channel *channel,struct map_session_data *sd);
 int channel_pc_haschan(struct map_session_data *sd, struct Channel *channel);
-int channel_display_list(struct map_session_data *sd, char *option);
+int channel_display_list(struct map_session_data *sd, const char *option);
 
 void channel_autojoin(struct map_session_data *sd);
 bool channel_pccheckgroup(struct Channel *channel, int group_id);
@@ -124,8 +128,4 @@ int channel_pcsetopt(struct map_session_data *sd, char *chname, const char *opti
 void do_init_channel(void);
 void do_final_channel(void);
 
-#ifdef	__cplusplus
-}
-#endif
-
 #endif	/* CHANNEL_H */

+ 12 - 8
src/map/chat.c → src/map/chat.cpp

@@ -1,21 +1,25 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "chat.hpp"
+
+#include <cstring>
+
 #include "../common/cbasetypes.h"
 #include "../common/malloc.h"
 #include "../common/nullpo.h"
 #include "../common/showmsg.h"
 #include "../common/strlib.h"
 #include "../common/mmo.h"
-#include "map.h"
-#include "atcommand.h" // msg_txt()
-#include "battle.h" // struct battle_config
-#include "clif.h"
-#include "npc.h" // npc_event_do()
-#include "pc.h"
-#include "chat.h"
-#include "achievement.h"
 
+#include "map.hpp"
+#include "atcommand.hpp" // msg_txt()
+#include "battle.hpp" // struct battle_config
+#include "clif.hpp"
+#include "npc.hpp" // npc_event_do()
+#include "pc.hpp"
+#include "pc_groups.hpp"
+#include "achievement.hpp"
 
 int chat_triggerevent(struct chat_data *cd); // forward declaration
 

+ 4 - 12
src/map/chat.h → src/map/chat.hpp

@@ -1,14 +1,10 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _CHAT_H_
-#define _CHAT_H_
+#ifndef _CHAT_HPP_
+#define _CHAT_HPP_
 
-#include "map.h" // struct block_list, CHATROOM_TITLE_SIZE
-
-#ifdef	__cplusplus
-extern "C" {
-#endif
+#include "map.hpp" // struct block_list, CHATROOM_TITLE_SIZE
 
 struct map_session_data;
 struct chat_data;
@@ -47,8 +43,4 @@ int chat_npckickall(struct chat_data* cd);
 
 int chat_npckickchat(struct chat_data* cd, const char* kickusername);
 
-#ifdef	__cplusplus
-}
-#endif
-
-#endif /* _CHAT_H_ */
+#endif /* _CHAT_HPP_ */

+ 29 - 24
src/map/chrif.c → src/map/chrif.cpp

@@ -1,6 +1,11 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "chrif.hpp"
+
+#include <cstdlib>
+#include <cstring>
+
 #include "../common/cbasetypes.h"
 #include "../common/malloc.h"
 #include "../common/socket.h"
@@ -10,23 +15,23 @@
 #include "../common/strlib.h"
 #include "../common/ers.h"
 
-#include "map.h"
-#include "battle.h"
-#include "clan.h"
-#include "clif.h"
-#include "intif.h"
-#include "npc.h"
-#include "pc.h"
-#include "pet.h"
-#include "homunculus.h"
-#include "instance.h"
-#include "mercenary.h"
-#include "elemental.h"
-#include "chrif.h"
-#include "script.h" // script_config
-#include "storage.h"
-
-#include <stdlib.h>
+#include "map.hpp"
+#include "battle.hpp"
+#include "clan.hpp"
+#include "clif.hpp"
+#include "intif.hpp"
+#include "npc.hpp"
+#include "pc.hpp"
+#include "pc_groups.hpp"
+#include "pet.hpp"
+#include "homunculus.hpp"
+#include "instance.hpp"
+#include "mercenary.hpp"
+#include "elemental.hpp"
+#include "script.hpp" // script_config
+#include "storage.hpp"
+#include "guild.hpp"
+#include "log.hpp"
 
 static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_t data);
 
@@ -261,7 +266,7 @@ int chrif_setip(const char* ip) {
 
 	safestrncpy(char_ip_str, ip, sizeof(char_ip_str));
 
-	ShowInfo("Char Server IP Address : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%s"CL_RESET"'.\n", ip, ip2str(char_ip, ip_str));
+	ShowInfo("Char Server IP Address : '" CL_WHITE "%s" CL_RESET "' -> '" CL_WHITE "%s" CL_RESET "'.\n", ip, ip2str(char_ip, ip_str));
 
 	return 1;
 }
@@ -510,7 +515,7 @@ int chrif_connectack(int fd) {
 		exit(EXIT_FAILURE);
 	}
 
-	ShowStatus("Successfully logged on to Char Server (Connection: '"CL_WHITE"%d"CL_RESET"').\n",fd);
+	ShowStatus("Successfully logged on to Char Server (Connection: '" CL_WHITE "%d" CL_RESET "').\n",fd);
 	chrif_state = 1;
 	chrif_connected = 1;
 
@@ -608,14 +613,14 @@ int chrif_sendmapack(int fd) {
 
 	// Server name
 	memcpy(wisp_server_name, RFIFOP(fd,5), NAME_LENGTH);
-	ShowStatus("Map-server connected to char-server '"CL_WHITE"%s"CL_RESET"'.\n", wisp_server_name);
+	ShowStatus("Map-server connected to char-server '" CL_WHITE "%s" CL_RESET "'.\n", wisp_server_name);
 
 	// Default map
 	memcpy(map_default.mapname, RFIFOP(fd, (offs+=NAME_LENGTH)), MAP_NAME_LENGTH);
 	map_default.x = RFIFOW(fd, (offs+=MAP_NAME_LENGTH));
 	map_default.y = RFIFOW(fd, (offs+=2));
 	if (battle_config.etc_log)
-		ShowInfo("Received default map from char-server '"CL_WHITE"%s %d,%d"CL_RESET"'.\n", map_default.mapname, map_default.x, map_default.y);
+		ShowInfo("Received default map from char-server '" CL_WHITE "%s %d,%d" CL_RESET "'.\n", map_default.mapname, map_default.x, map_default.y);
 
 	chrif_on_ready();
 
@@ -698,7 +703,7 @@ void chrif_authok(int fd) {
 	login_id2 = RFIFOL(fd,12);
 	expiration_time = (time_t)(int32)RFIFOL(fd,16);
 	group_id = RFIFOL(fd,20);
-	changing_mapservers = (RFIFOB(fd,24));
+	changing_mapservers = (RFIFOB(fd,24)) > 0;
 	status = (struct mmo_charstatus*)RFIFOP(fd,25);
 	char_id = status->char_id;
 
@@ -1271,7 +1276,7 @@ int chrif_recvfamelist(int fd) {
 
 	total += num;
 
-	ShowInfo("Received Fame List of '"CL_WHITE"%d"CL_RESET"' characters.\n", total);
+	ShowInfo("Received Fame List of '" CL_WHITE "%d" CL_RESET "' characters.\n", total);
 
 	return 0;
 }
@@ -2000,7 +2005,7 @@ void do_init_chrif(void) {
 	}
 
 	auth_db = idb_alloc(DB_OPT_BASE);
-	auth_db_ers = ers_new(sizeof(struct auth_node),"chrif.c::auth_db_ers",ERS_OPT_NONE);
+	auth_db_ers = ers_new(sizeof(struct auth_node),"chrif.cpp::auth_db_ers",ERS_OPT_NONE);
 
 	add_timer_func_list(check_connect_char_server, "check_connect_char_server");
 	add_timer_func_list(auth_db_cleanup, "auth_db_cleanup");

+ 7 - 11
src/map/chrif.h → src/map/chrif.hpp

@@ -1,16 +1,16 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _CHRIF_H_
-#define _CHRIF_H_
+#ifndef _CHRIF_HPP_
+#define _CHRIF_HPP_
+
+#include <time.h>
 
 #include "../common/cbasetypes.h"
 #include "../common/socket.h" // enum chrif_req_op
-#include <time.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+//fwd declaration
+struct map_session_data;
 
 enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE };
 
@@ -92,8 +92,4 @@ void do_init_chrif(void);
 
 int chrif_flush_fifo(void);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CHRIF_H_ */
+#endif /* _CHRIF_HPP_ */

+ 11 - 7
src/map/clan.c → src/map/clan.cpp

@@ -1,18 +1,22 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "clan.hpp"
+
+#include <string.h> //memset
+
 #include "../common/cbasetypes.h"
 #include "../common/mmo.h"
 #include "../common/malloc.h"
 #include "../common/nullpo.h"
 #include "../common/showmsg.h"
 
-#include "clan.h"
-#include "clif.h"
-#include "intif.h"
-#include "pc.h"
-#include "script.h"
-#include "status.h"
+#include "clif.hpp"
+#include "intif.hpp"
+#include "pc.hpp"
+#include "script.hpp"
+#include "status.hpp"
+#include "log.hpp"
 
 static DBMap* clan_db; // int clan_id -> struct clan*
 
@@ -47,7 +51,7 @@ void clan_load_clandata( int count, struct clan* clans ){
 		j++;
 	}
 
-	ShowStatus( "Received '"CL_WHITE"%d"CL_RESET"' clans from char-server.\n", j );
+	ShowStatus( "Received '" CL_WHITE "%d" CL_RESET "' clans from char-server.\n", j );
 }
 
 struct clan* clan_search( int id ){

+ 0 - 32
src/map/clan.h

@@ -1,32 +0,0 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#ifndef _CLAN_H_
-	#define _CLAN_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-	#include "../common/mmo.h"
-	#include "status.h"
-
-	void do_init_clan();
-	void do_final_clan();
-	struct clan* clan_search( int id );
-	struct clan* clan_searchname( const char* name );
-	void clan_load_clandata( int count, struct clan* clans );
-	void clan_member_joined( struct map_session_data* sd );
-	void clan_member_left( struct map_session_data* sd );
-	bool clan_member_join( struct map_session_data *sd, int clan_id, uint32 account_id, uint32 char_id );
-	bool clan_member_leave( struct map_session_data* sd, int clan_id, uint32 account_id, uint32 char_id );
-	void clan_send_message( struct map_session_data *sd, const char *mes, int len );
-	void clan_recv_message(int clan_id,uint32 account_id,const char *mes,int len);
-	struct map_session_data* clan_getavailablesd( struct clan* clan );
-	int clan_get_alliance_count( struct clan *clan, int flag );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif

+ 26 - 0
src/map/clan.hpp

@@ -0,0 +1,26 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#ifndef _CLAN_HPP_
+#define _CLAN_HPP_
+
+#include "../common/mmo.h"
+
+struct clan;
+struct map_session_data;
+
+void do_init_clan();
+void do_final_clan();
+struct clan* clan_search( int id );
+struct clan* clan_searchname( const char* name );
+void clan_load_clandata( int count, struct clan* clans );
+void clan_member_joined( struct map_session_data* sd );
+void clan_member_left( struct map_session_data* sd );
+bool clan_member_join( struct map_session_data *sd, int clan_id, uint32 account_id, uint32 char_id );
+bool clan_member_leave( struct map_session_data* sd, int clan_id, uint32 account_id, uint32 char_id );
+void clan_send_message( struct map_session_data *sd, const char *mes, int len );
+void clan_recv_message(int clan_id,uint32 account_id,const char *mes,int len);
+struct map_session_data* clan_getavailablesd( struct clan* clan );
+int clan_get_alliance_count( struct clan *clan, int flag );
+
+#endif /* CLAN_H */

+ 48 - 50
src/map/clif.cpp

@@ -1,6 +1,14 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "clif.hpp"
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <cstdarg>
+#include <ctime>
+
 #include "../common/cbasetypes.h"
 #include "../common/socket.h"
 #include "../common/timer.h"
@@ -14,48 +22,40 @@
 #include "../common/ers.h"
 #include "../common/conf.h"
 
-#include "map.h"
-#include "chrif.h"
-#include "pc.h"
-#include "status.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 "intif.h"
-#include "battle.h"
-#include "battleground.h"
-#include "mob.h"
-#include "party.h"
-#include "unit.h"
-#include "guild.h"
-#include "vending.h"
-#include "pet.h"
-#include "homunculus.h"
-#include "instance.h"
-#include "mercenary.h"
-#include "elemental.h"
-#include "log.h"
-#include "clif.h"
-#include "mail.h"
-#include "quest.h"
-#include "cashshop.h"
-#include "channel.h"
-#include "achievement.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "map.hpp"
+#include "chrif.hpp"
+#include "pc.hpp"
+#include "pc_groups.hpp"
+#include "status.hpp"
+#include "npc.hpp"
+#include "itemdb.hpp"
+#include "chat.hpp"
+#include "trade.hpp"
+#include "storage.hpp"
+#include "script.hpp"
+#include "skill.hpp"
+#include "atcommand.hpp"
+#include "intif.hpp"
+#include "battle.hpp"
+#include "battleground.hpp"
+#include "mob.hpp"
+#include "party.hpp"
+#include "unit.hpp"
+#include "guild.hpp"
+#include "vending.hpp"
+#include "pet.hpp"
+#include "homunculus.hpp"
+#include "instance.hpp"
+#include "mercenary.hpp"
+#include "elemental.hpp"
+#include "log.hpp"
+#include "clif.hpp"
+#include "mail.hpp"
+#include "quest.hpp"
+#include "cashshop.hpp"
+#include "channel.hpp"
+#include "achievement.hpp"
+#include "clan.hpp"
 
 /* for clif_clearunit_delayed */
 static struct eri *delay_clearunit_ers;
@@ -64,7 +64,7 @@ struct s_packet_db packet_db[MAX_PACKET_DB + 1];
 int packet_db_ack[MAX_ACK_FUNC + 1];
 unsigned long color_table[COLOR_MAX];
 
-#include "clif_obfuscation.h"
+#include "clif_obfuscation.hpp"
 static bool clif_session_isValid(struct map_session_data *sd);
 
 #if PACKETVER >= 20150513
@@ -16238,10 +16238,11 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
 	nullpo_retv(sd);
 	nullpo_retv(nd);
 
-	npc_shop_currency_type(sd, nd, cost, true);
-
 	fd = sd->fd;
 	sd->npc_shopid = nd->bl.id;
+
+	npc_shop_currency_type(sd, nd, cost, true);
+
 	WFIFOHEAD(fd,offset+nd->u.shop.count*11);
 	WFIFOW(fd,0) = 0x287;
 	WFIFOW(fd,2) = offset+nd->u.shop.count*11;
@@ -20251,8 +20252,8 @@ void packetdb_readdb(){
 	memset(packet_db,0,sizeof(packet_db));
 	memset(packet_db_ack,0,sizeof(packet_db_ack));
 
-#include "clif_packetdb.h"
-#include "clif_shuffle.h"
+#include "clif_packetdb.hpp"
+#include "clif_shuffle.hpp"
 
 	ShowStatus("Using packet version: " CL_WHITE "%d" CL_RESET ".\n", PACKETVER);
 
@@ -20302,6 +20303,3 @@ void do_final_clif(void) {
 	ers_destroy(delay_clearunit_ers);
 }
 
-#ifdef __cplusplus
-}
-#endif

+ 35 - 46
src/map/clif.h → src/map/clif.hpp

@@ -1,22 +1,18 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _CLIF_H_
-#define _CLIF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef _CLIF_HPP_
+#define _CLIF_HPP_
 
 #include "../common/cbasetypes.h"
 #include "../common/db.h" //dbmap
-//#include "../common/mmo.h"
+#include "../common/mmo.h"
 
 struct Channel;
 struct clan;
 struct item;
 struct s_storage;
-//#include "map.h"
+//#include "map.hpp"
 struct block_list;
 struct unit_data;
 struct map_session_data;
@@ -34,21 +30,18 @@ struct guild;
 struct battleground_data;
 struct quest;
 struct party_booking_ad_info;
-enum e_party_member_withdraw;
 struct sale_item_data;
-enum mail_inbox_type;
 struct mail_message;
-enum mail_attachment_type;
 struct achievement;
 #include <stdarg.h>
 
-enum { // packet DB
+enum e_PacketDBVersion { // packet DB
 	MIN_PACKET_DB  = 0x064,
 	MAX_PACKET_DB  = 0xAFF,
 	MAX_PACKET_POS = 20,
 };
 
-enum e_packet_ack {
+enum e_packet_ack : uint8_t{
 	ZC_ACK_OPEN_BANKING = 0,
 	ZC_ACK_CLOSE_BANKING,
 	ZC_ACK_BANKING_DEPOSIT,
@@ -80,7 +73,7 @@ struct s_packet_keys {
 };
 #endif
 
-enum e_CASHSHOP_ACK {
+enum e_CASHSHOP_ACK : uint8_t{
 	ERROR_TYPE_NONE             = 0, ///< The deal has successfully completed.
 	ERROR_TYPE_NPC              = 1, ///< The Purchase has failed because the NPC does not exist.
 	ERROR_TYPE_SYSTEM           = 2, ///< The Purchase has failed because the Kafra Shop System is not working correctly.
@@ -92,67 +85,67 @@ enum e_CASHSHOP_ACK {
 	ERROR_TYPE_PURCHASE_FAIL    = 8, ///< Some items could not be purchased.
 };
 
-enum e_BANKING_DEPOSIT_ACK {
+enum e_BANKING_DEPOSIT_ACK : uint8_t {
 	BDA_SUCCESS  = 0x0,
 	BDA_ERROR    = 0x1,
 	BDA_NO_MONEY = 0x2,
 	BDA_OVERFLOW = 0x3,
 };
 
-enum e_BANKING_WITHDRAW_ACK {
+enum e_BANKING_WITHDRAW_ACK : uint8_t {
 	BWA_SUCCESS       = 0x0,
 	BWA_NO_MONEY      = 0x1,
 	BWA_UNKNOWN_ERROR = 0x2,
 };
 
-enum RECV_ROULETTE_ITEM_REQ {
+enum RECV_ROULETTE_ITEM_REQ : uint8_t {
 	RECV_ITEM_SUCCESS    = 0x0,
 	RECV_ITEM_FAILED     = 0x1,
 	RECV_ITEM_OVERCOUNT  = 0x2,
 	RECV_ITEM_OVERWEIGHT = 0x3,
 };
 
-enum RECV_ROULETTE_ITEM_ACK {
+enum RECV_ROULETTE_ITEM_ACK : uint8_t {
 	RECV_ITEM_NORMAL =  0x0,
 	RECV_ITEM_LOSING =  0x1,
 };
 
-enum GENERATE_ROULETTE_ACK {
+enum GENERATE_ROULETTE_ACK : uint8_t {
 	GENERATE_ROULETTE_SUCCESS         = 0x0,
 	GENERATE_ROULETTE_FAILED          = 0x1,
 	GENERATE_ROULETTE_NO_ENOUGH_POINT = 0x2,
 	GENERATE_ROULETTE_LOSING          = 0x3,
 };
 
-enum OPEN_ROULETTE_ACK {
+enum OPEN_ROULETTE_ACK : uint8_t {
 	OPEN_ROULETTE_SUCCESS = 0x0,
 	OPEN_ROULETTE_FAILED  = 0x1,
 };
 
-enum CLOSE_ROULETTE_ACK {
+enum CLOSE_ROULETTE_ACK : uint8_t {
 	CLOSE_ROULETTE_SUCCESS = 0x0,
 	CLOSE_ROULETTE_FAILED  = 0x1,
 };
 
-enum MERGE_ITEM_ACK {
+enum MERGE_ITEM_ACK : uint8_t {
 	MERGE_ITEM_SUCCESS = 0x0,
 	MERGE_ITEM_FAILED_NOT_MERGE = 0x1,
 	MERGE_ITEM_FAILED_MAX_COUNT = 0x2,
 };
 
-enum BROADCASTING_SPECIAL_ITEM_OBTAIN {
+enum BROADCASTING_SPECIAL_ITEM_OBTAIN : uint8_t {
 	ITEMOBTAIN_TYPE_BOXITEM =  0x0,
 	ITEMOBTAIN_TYPE_MONSTER_ITEM =  0x1,
 	ITEMOBTAIN_TYPE_NPC =  0x2,
 };
 
-enum e_adopt_reply {
+enum e_adopt_reply : uint8_t {
 	ADOPT_REPLY_MORE_CHILDREN = 0,
 	ADOPT_REPLY_LEVEL_70,
 	ADOPT_REPLY_MARRIED,
 };
 
-enum e_wip_block {
+enum e_wip_block : uint8_t {
 	WIP_DISABLE_NONE = 0x0,
 	WIP_DISABLE_SKILLITEM = 0x1,
 	WIP_DISABLE_NPC = 0x2,
@@ -185,8 +178,8 @@ extern struct s_packet_db packet_db[MAX_PACKET_DB+1];
 extern int packet_db_ack[MAX_ACK_FUNC + 1];
 
 // local define
-typedef enum send_target {
-	ALL_CLIENT,
+enum send_target : uint8_t {
+	ALL_CLIENT = 0,
 	ALL_SAMEMAP,
 	AREA,				// area
 	AREA_WOS,			// area, without self
@@ -220,9 +213,9 @@ typedef enum send_target {
 	BG_AREA_WOS,
 
 	CLAN,				// Clan System
-} send_target;
+};
 
-typedef enum broadcast_flags {
+enum broadcast_flags : uint8_t {
 	BC_ALL			= 0,
 	BC_MAP			= 1,
 	BC_AREA			= 2,
@@ -239,9 +232,9 @@ typedef enum broadcast_flags {
 	BC_COLOR_MASK	= 0x30, // BC_YELLOW|BC_BLUE|BC_WOE
 
 	BC_DEFAULT		= BC_ALL|BC_PC|BC_YELLOW
-} broadcast_flags;
+};
 
-typedef enum emotion_type {
+enum emotion_type {
 	E_GASP = 0,     // /!
 	E_WHAT,         // /?
 	E_HO,
@@ -332,18 +325,18 @@ typedef enum emotion_type {
 	E_YUT7,
 	//
 	E_MAX
-} emotion_type;
+};
 
-typedef enum clr_type
+enum clr_type : uint8_t 
 {
 	CLR_OUTSIGHT = 0,
 	CLR_DEAD,
 	CLR_RESPAWN,
 	CLR_TELEPORT,
 	CLR_TRICKDEAD,
-} clr_type;
+};
 
-enum map_property
+enum map_property : uint8_t 
 {// clif_map_property
 	MAPPROPERTY_NOTHING       = 0,
 	MAPPROPERTY_FREEPVPZONE   = 1,
@@ -354,7 +347,7 @@ enum map_property
 	MAPPROPERTY_DENYSKILLZONE = 6,
 };
 
-enum map_type
+enum map_type : uint8_t 
 {// clif_map_type
 	MAPTYPE_VILLAGE              = 0,
 	MAPTYPE_VILLAGE_IN           = 1,
@@ -383,7 +376,7 @@ enum map_type
 	MAPTYPE_UNUSED               = 29,
 };
 
-enum useskill_fail_cause
+enum useskill_fail_cause : uint8_t 
 {// clif_skill_fail
 	USESKILL_FAIL_LEVEL = 0,
 	USESKILL_FAIL_SP_INSUFFICIENT = 1,
@@ -476,7 +469,7 @@ enum useskill_fail_cause
 	USESKILL_FAIL_MAX
 };
 
-enum clif_messages {
+enum clif_messages : uint16_t {
 	/* Constant values */
 	// clif_cart_additem_ack flags
 	ADDITEM_TO_CART_FAIL_WEIGHT = 0x0,
@@ -518,7 +511,7 @@ enum clif_messages {
 	SKILL_NEED_GRENADE = 0xa01,
 };
 
-enum e_personalinfo {
+enum e_personalinfo : uint8_t {
 	PINFO_BASIC = 0,
 	PINFO_PREMIUM,
 	PINFO_SERVER,
@@ -526,7 +519,7 @@ enum e_personalinfo {
 	PINFO_MAX,
 };
 
-enum e_damage_type {
+enum e_damage_type : uint8_t {
 	DMG_NORMAL = 0,			/// damage [ damage: total damage, div: amount of hits, damage2: assassin dual-wield damage ]
 	DMG_PICKUP_ITEM,		/// pick up item
 	DMG_SIT_DOWN,			/// sit down
@@ -892,7 +885,7 @@ void do_init_clif(void);
 void do_final_clif(void);
 
 // MAIL SYSTEM
-enum mail_send_result{
+enum mail_send_result : uint8_t {
 	WRITE_MAIL_SUCCESS = 0x0,
 	WRITE_MAIL_FAILED = 0x1,
 	WRITE_MAIL_FAILED_CNT = 0x2,
@@ -1074,8 +1067,4 @@ void clif_achievement_update(struct map_session_data *sd, struct achievement *ac
 void clif_pAchievementCheckReward(int fd, struct map_session_data *sd);
 void clif_achievement_reward_ack(int fd, unsigned char result, int ach_id);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CLIF_H_ */
+#endif /* _CLIF_HPP_ */

+ 3 - 3
src/map/clif_obfuscation.h → src/map/clif_obfuscation.hpp

@@ -1,8 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _CLIF_OBFUSCATION_H_
-#define _CLIF_OBFUSCATION_H_
+#ifndef _CLIF_OBFUSCATION_HPP_
+#define _CLIF_OBFUSCATION_HPP_
 
 #if defined(PACKET_OBFUSCATION) || defined(PACKET_OBFUSCATION_WARN)
 	#define packet_keys(a,b,c) static unsigned int clif_cryptKey[] = { a, b, c };
@@ -391,4 +391,4 @@
 	#undef packet_keys
 #endif
 
-#endif /* _CLIF_OBFUSCATION_H_ */
+#endif /* _CLIF_OBFUSCATION_HPP_ */

+ 3 - 3
src/map/clif_packetdb.h → src/map/clif_packetdb.hpp

@@ -1,8 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _CLIF_PACKETDB_H_
-#define _CLIF_PACKETDB_H_
+#ifndef _CLIF_PACKETDB_HPP_
+#define _CLIF_PACKETDB_HPP_
 
 	#define packet(cmd,length) packetdb_addpacket(cmd,length,NULL,0)
 	#define parseable_packet(cmd,length,func,...) packetdb_addpacket(cmd,length,func,__VA_ARGS__,0)
@@ -2352,4 +2352,4 @@
 	packet(0x0ACC,18);
 #endif
 
-#endif /* _CLIF_PACKETDB_H_ */
+#endif /* _CLIF_PACKETDB_HPP_ */

+ 3 - 3
src/map/clif_shuffle.h → src/map/clif_shuffle.hpp

@@ -1,8 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _CLIF_SHUFFLE_H_
-#define _CLIF_SHUFFLE_H_
+#ifndef _CLIF_SHUFFLE_HPP_
+#define _CLIF_SHUFFLE_HPP_
 
 // 2013-05-15aRagexe
 #if PACKETVER == 20130515
@@ -4193,4 +4193,4 @@
 	parseable_packet(0x096A,6,clif_parse_GetCharNameRequest,2);
 #endif
 
-#endif /* _CLIF_SHUFFLE_H_ */
+#endif /* _CLIF_SHUFFLE_HPP_ */

+ 2 - 1
src/map/date.c → src/map/date.cpp

@@ -1,7 +1,8 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#include "date.h"
+#include "date.hpp"
+
 #include <time.h>
 
 /*

+ 3 - 10
src/map/date.h → src/map/date.hpp

@@ -1,15 +1,11 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _DATE_H_
-#define _DATE_H_
+#ifndef _DATE_HPP_
+#define _DATE_HPP_
 
 #include "../common/cbasetypes.h"
 
-#ifdef	__cplusplus
-extern "C" {
-#endif
-
 enum e_month{
 	JANUARY = 1,
 	FEBRUARY,
@@ -64,7 +60,4 @@ bool is_day_of_sun(void);
 bool is_day_of_moon(void);
 bool is_day_of_star(void);
 
-#ifdef	__cplusplus
-}
-#endif
-#endif /* _DATE_H_ */
+#endif /* _DATE_HPP_ */

+ 10 - 6
src/map/duel.c → src/map/duel.cpp

@@ -2,16 +2,19 @@
 // For more information, see LICENCE in the main folder
 // Duel organizing functions [LuzZza]
 
-#include "../common/cbasetypes.h"
-
-#include "atcommand.h"  // msg_txt
-#include "clif.h"
-#include "duel.h"
-#include "pc.h"
+#include "duel.hpp"
 
 #include <stdio.h>
 #include <string.h>
 
+#include "../common/cbasetypes.h"
+#include "../common/timer.h"
+
+#include "atcommand.hpp"  // msg_txt
+#include "clif.hpp"
+#include "pc.hpp"
+#include "battle.hpp"
+
 //global var (extern)
 struct duel duel_list[MAX_DUEL]; //list of current duel
 int duel_count = 0; //number of duel active
@@ -112,6 +115,7 @@ static void duel_set(const unsigned int did, struct map_session_data* sd) {
 
 /*
  * Create a new duel for sd
+ * return duel_id or 0 when fail
  */
 int duel_create(struct map_session_data* sd, const unsigned int maxpl)
 {

+ 4 - 9
src/map/duel.h → src/map/duel.hpp

@@ -1,12 +1,10 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _DUEL_H_
-#define _DUEL_H_
+#ifndef _DUEL_HPP_
+#define _DUEL_HPP_
 
-#ifdef	__cplusplus
-extern "C" {
-#endif
+#include "../common/cbasetypes.h"
 
 struct duel {
 	int members_count;
@@ -30,8 +28,5 @@ int duel_checktime(struct map_session_data* sd);
 void do_init_duel(void);
 void do_final_duel(void);
 
-#ifdef	__cplusplus
-}
-#endif
 
-#endif /* _DUEL_H_ */
+#endif /* _DUEL_HPP_ */

+ 19 - 14
src/map/elemental.c → src/map/elemental.cpp

@@ -1,6 +1,13 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
+#include "elemental.hpp"
+
+#include <stdlib.h>
+#include <math.h>
+#include <ctgmath> //floor
+#include <cstring>
+
 #include "../common/cbasetypes.h"
 #include "../common/malloc.h"
 #include "../common/timer.h"
@@ -11,17 +18,15 @@
 #include "../common/strlib.h"
 #include "../common/utils.h"
 
-#include "log.h"
-#include "clif.h"
-#include "intif.h"
-#include "itemdb.h"
-#include "pc.h"
-#include "party.h"
-#include "trade.h"
-#include "elemental.h"
-
-#include <stdlib.h>
-#include <math.h>
+#include "log.hpp"
+#include "clif.hpp"
+#include "intif.hpp"
+#include "itemdb.hpp"
+#include "pc.hpp"
+#include "party.hpp"
+#include "trade.hpp"
+#include "npc.hpp"
+#include "battle.hpp"
 
 struct s_elemental_db elemental_db[MAX_ELEMENTAL_CLASS]; // Elemental Database
 static uint16 elemental_count;
@@ -306,7 +311,7 @@ int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id) {
 			case SC_CIRCLE_OF_FIRE_OPTION:
 			case SC_TIDAL_WEAPON_OPTION:
 				if( bl ) status_change_end(bl,type,INVALID_TIMER);	// Master
-				status_change_end(&ed->bl,type-1,INVALID_TIMER);	// Elemental Spirit
+				status_change_end(&ed->bl,static_cast<sc_type>(type-1),INVALID_TIMER);	// Elemental Spirit
 				break;
 			case SC_ZEPHYR:
 				if( bl ) status_change_end(bl,type,INVALID_TIMER);
@@ -823,7 +828,7 @@ void read_elementaldb(void) {
 	elemental_count = 0;
 	memset(elemental_db, 0, sizeof(elemental_db));
 	for(i = 0; i<ARRAYLENGTH(filename); i++){
-		sv_readdb(db_path, filename[i], ',', 26, 26, -1, &read_elementaldb_sub, i);
+		sv_readdb(db_path, filename[i], ',', 26, 26, -1, &read_elementaldb_sub, i > 0);
 	}
 }
 
@@ -871,7 +876,7 @@ void read_elemental_skilldb(void) {
 	const char *filename[] = { "elemental_skill_db.txt", DBIMPORT"/elemental_skill_db.txt" };
 	uint8 i;
 	for(i = 0; i<ARRAYLENGTH(filename); i++){
-		sv_readdb(db_path, filename[i], ',', 4, 4, -1, &read_elemental_skilldb_sub, i);
+		sv_readdb(db_path, filename[i], ',', 4, 4, -1, &read_elemental_skilldb_sub, i > 0);
 	}
 }
 

+ 8 - 14
src/map/elemental.h → src/map/elemental.hpp

@@ -1,15 +1,13 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#ifndef _ELEMENTAL_H_
-#define _ELEMENTAL_H_
+#ifndef _ELEMENTAL_HPP_
+#define _ELEMENTAL_HPP_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "../common/mmo.h"
 
-#include "status.h" // struct status_data, struct status_change
-#include "unit.h" // struct unit_data
+#include "status.hpp" // struct status_data, struct status_change
+#include "unit.hpp" // struct unit_data
 
 #define MIN_ELETHINKTIME 100
 #define MIN_ELEDISTANCE 2
@@ -20,14 +18,14 @@ extern "C" {
 #define EL_MODE_PASSIVE MD_CANMOVE
 
 ///Enum of Elemental Skill Mode
-enum elemental_skillmode {
+enum elemental_skillmode : uint8 {
 	EL_SKILLMODE_PASSIVE    = 0x1,
 	EL_SKILLMODE_ASSIST     = 0x2,
 	EL_SKILLMODE_AGGRESSIVE = 0x4,
 };
 
 ///Enum of Elemental ID
-enum elemental_elementalid {
+enum elemental_elementalid  : uint16 {
 	ELEMENTALID_AGNI_S = 2114,
 	ELEMENTALID_AGNI_M,
 	ELEMENTALID_AGNI_L,
@@ -115,8 +113,4 @@ void reload_elemental_skilldb(void);
 void do_init_elemental(void);
 void do_final_elemental(void);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ELEMENTAL_H_ */
+#endif /* _ELEMENTAL_HPP_ */

Some files were not shown because too many files changed in this diff