Initial work for char server to C++ (#2567)

* Initial work for char server to C++

* Changes suggested from @Lemongrass3110

* Removes unwanted beginning white spaces.
This commit is contained in:
lighta 2017-11-06 22:40:35 -04:00 committed by GitHub
parent 6decf6c6d0
commit 24b3509e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 403 additions and 449 deletions

View File

@ -9,8 +9,7 @@ set( CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
# #
if( BUILD_SERVERS ) if( BUILD_SERVERS )
message( STATUS "Creating target char-server" ) message( STATUS "Creating target char-server" )
file(GLOB CHAR_HEADERS ${CHAR_SOURCE_DIR}/*.h) file(GLOB CHAR_HEADERS ${CHAR_SOURCE_DIR}/*.hpp)
file(GLOB CHAR_SOURCES_C ${CHAR_SOURCE_DIR}/*.c)
file(GLOB CHAR_SOURCES_CXX ${CHAR_SOURCE_DIR}/*.cpp) file(GLOB CHAR_SOURCES_CXX ${CHAR_SOURCE_DIR}/*.cpp)
set(CHAR_SOURCES ${CHAR_SOURCES_C} ${CHAR_SOURCES_CXX}) set(CHAR_SOURCES ${CHAR_SOURCES_C} ${CHAR_SOURCES_CXX})
#message( STATUS "CHAR_SOURCES="${CHAR_SOURCES}) #message( STATUS "CHAR_SOURCES="${CHAR_SOURCES})

View File

@ -14,9 +14,9 @@ LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
COMMON_OBJ = ../common/obj/sql.o COMMON_OBJ = ../common/obj/sql.o
COMMON_H = ../common/sql.h COMMON_H = ../common/sql.h
CHAR_OBJ = $(shell ls *.c | sed -e "s/\.c/\.o/g") $(shell ls *.cpp | sed -e "s/\.cpp/\.o/g") CHAR_OBJ = $(shell ls *.cpp | sed -e "s/\.cpp/\.o/g")
CHAR_DIR_OBJ = $(CHAR_OBJ:%=obj/%) CHAR_DIR_OBJ = $(CHAR_OBJ:%=obj/%)
CHAR_H = $(shell ls ../char/*.h) CHAR_H = $(shell ls ../char/*.hpp)
YAML_CPP_OBJ = $(shell find ../../3rdparty/yaml-cpp/ -type f -name "*.cpp" | sed -e "s/\.cpp/\.o/g" ) YAML_CPP_OBJ = $(shell find ../../3rdparty/yaml-cpp/ -type f -name "*.cpp" | sed -e "s/\.cpp/\.o/g" )
YAML_CPP_DIR_OBJ = $(YAML_CPP_OBJ:%=obj/%) YAML_CPP_DIR_OBJ = $(YAML_CPP_OBJ:%=obj/%)

View File

@ -159,45 +159,43 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="char.h" /> <ClInclude Include="char.hpp" />
<ClInclude Include="char_clif.h" /> <ClInclude Include="char_clif.hpp" />
<ClInclude Include="char_cnslif.h" /> <ClInclude Include="char_cnslif.hpp" />
<ClInclude Include="char_logif.h" /> <ClInclude Include="char_logif.hpp" />
<ClInclude Include="char_mapif.h" /> <ClInclude Include="char_mapif.hpp" />
<ClInclude Include="inter.h" /> <ClInclude Include="inter.hpp" />
<ClInclude Include="int_achievement.h" /> <ClInclude Include="int_achievement.hpp" />
<ClInclude Include="int_auction.h" /> <ClInclude Include="int_auction.hpp" />
<ClInclude Include="int_clan.h" /> <ClInclude Include="int_clan.hpp" />
<ClInclude Include="int_elemental.h" /> <ClInclude Include="int_elemental.hpp" />
<ClInclude Include="int_guild.h" /> <ClInclude Include="int_guild.hpp" />
<ClInclude Include="int_homun.h" /> <ClInclude Include="int_homun.hpp" />
<ClInclude Include="int_mail.h" /> <ClInclude Include="int_mail.hpp" />
<ClInclude Include="int_mercenary.h" /> <ClInclude Include="int_mercenary.hpp" />
<ClInclude Include="int_party.h" /> <ClInclude Include="int_party.hpp" />
<ClInclude Include="int_pet.h" /> <ClInclude Include="int_pet.hpp" />
<ClInclude Include="int_quest.h" /> <ClInclude Include="int_quest.hpp" />
<ClInclude Include="int_storage.h" /> <ClInclude Include="int_storage.hpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="char.cpp"> <ClCompile Include="char.cpp" />
<CompileAs>CompileAsCpp</CompileAs> <ClCompile Include="char_clif.cpp" />
</ClCompile> <ClCompile Include="char_cnslif.cpp" />
<ClCompile Include="char_clif.c" /> <ClCompile Include="char_logif.cpp" />
<ClCompile Include="char_cnslif.c" /> <ClCompile Include="char_mapif.cpp" />
<ClCompile Include="char_logif.c" />
<ClCompile Include="char_mapif.c" />
<ClCompile Include="inter.cpp" /> <ClCompile Include="inter.cpp" />
<ClCompile Include="int_achievement.c" /> <ClCompile Include="int_achievement.cpp" />
<ClCompile Include="int_auction.c" /> <ClCompile Include="int_auction.cpp" />
<ClCompile Include="int_clan.c" /> <ClCompile Include="int_clan.cpp" />
<ClCompile Include="int_elemental.c" /> <ClCompile Include="int_elemental.cpp" />
<ClCompile Include="int_guild.c" /> <ClCompile Include="int_guild.cpp" />
<ClCompile Include="int_homun.c" /> <ClCompile Include="int_homun.cpp" />
<ClCompile Include="int_mail.c" /> <ClCompile Include="int_mail.cpp" />
<ClCompile Include="int_mercenary.c" /> <ClCompile Include="int_mercenary.cpp" />
<ClCompile Include="int_party.c" /> <ClCompile Include="int_party.cpp" />
<ClCompile Include="int_pet.c" /> <ClCompile Include="int_pet.cpp" />
<ClCompile Include="int_quest.c" /> <ClCompile Include="int_quest.cpp" />
<ClCompile Include="int_storage.cpp" /> <ClCompile Include="int_storage.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -11,58 +11,58 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="char.h"> <ClInclude Include="char.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="char_clif.h"> <ClInclude Include="char_clif.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="char_cnslif.h"> <ClInclude Include="char_cnslif.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="char_logif.h"> <ClInclude Include="char_logif.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="char_mapif.h"> <ClInclude Include="char_mapif.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_achievement.h"> <ClInclude Include="int_achievement.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_auction.h"> <ClInclude Include="int_auction.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_elemental.h"> <ClInclude Include="int_elemental.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_guild.h"> <ClInclude Include="int_guild.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_homun.h"> <ClInclude Include="int_homun.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_mail.h"> <ClInclude Include="int_mail.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_mercenary.h"> <ClInclude Include="int_mercenary.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_party.h"> <ClInclude Include="int_party.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_pet.h"> <ClInclude Include="int_pet.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_quest.h"> <ClInclude Include="int_quest.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_storage.h"> <ClInclude Include="int_storage.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="inter.h"> <ClInclude Include="inter.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="int_clan.h"> <ClInclude Include="int_clan.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
@ -70,46 +70,46 @@
<ClCompile Include="char.cpp"> <ClCompile Include="char.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="char_clif.c"> <ClCompile Include="char_clif.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="char_cnslif.c"> <ClCompile Include="char_cnslif.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="char_logif.c"> <ClCompile Include="char_logif.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="char_mapif.c"> <ClCompile Include="char_mapif.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_achievement.c"> <ClCompile Include="int_achievement.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_auction.c"> <ClCompile Include="int_auction.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_elemental.c"> <ClCompile Include="int_elemental.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_guild.c"> <ClCompile Include="int_guild.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_homun.c"> <ClCompile Include="int_homun.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_mail.c"> <ClCompile Include="int_mail.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_mercenary.c"> <ClCompile Include="int_mercenary.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_party.c"> <ClCompile Include="int_party.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_pet.c"> <ClCompile Include="int_pet.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_quest.c"> <ClCompile Include="int_quest.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_storage.cpp"> <ClCompile Include="int_storage.cpp">
@ -118,7 +118,7 @@
<ClCompile Include="inter.cpp"> <ClCompile Include="inter.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="int_clan.c"> <ClCompile Include="int_clan.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -2,6 +2,7 @@
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#pragma warning(disable:4800) #pragma warning(disable:4800)
#include "char.hpp"
#include <time.h> #include <time.h>
#include <stdarg.h> #include <stdarg.h>
@ -21,18 +22,19 @@
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/timer.h" #include "../common/timer.h"
#include "../common/cli.h" #include "../common/cli.h"
#include "int_guild.h"
#include "int_homun.h" #include "int_guild.hpp"
#include "int_mail.h" #include "int_homun.hpp"
#include "int_mercenary.h" #include "int_mail.hpp"
#include "int_elemental.h" #include "int_mercenary.hpp"
#include "int_party.h" #include "int_elemental.hpp"
#include "int_storage.h" #include "int_party.hpp"
#include "inter.h" #include "int_storage.hpp"
#include "char_logif.h" #include "inter.hpp"
#include "char_mapif.h" #include "char_logif.hpp"
#include "char_cnslif.h" #include "char_mapif.hpp"
#include "char_clif.h" #include "char_cnslif.hpp"
#include "char_clif.hpp"
//definition of exported var declared in .h //definition of exported var declared in .h
int login_fd=-1; //login file descriptor int login_fd=-1; //login file descriptor
@ -215,7 +217,7 @@ int char_db_setoffline(DBKey key, DBData *data, va_list ap) {
/** /**
* @see DBApply * @see DBApply
*/ */
static int char_db_kickoffline(DBKey key, DBData *data, va_list ap){ int char_db_kickoffline(DBKey key, DBData *data, va_list ap){
struct online_char_data* character = (struct online_char_data*)db_data2ptr(data); struct online_char_data* character = (struct online_char_data*)db_data2ptr(data);
int server_id = va_arg(ap, int); int server_id = va_arg(ap, int);
@ -259,7 +261,7 @@ void char_set_all_offline_sql(void){
/** /**
* @see DBCreateData * @see DBCreateData
*/ */
static DBData char_create_charstatus(DBKey key, va_list args) { DBData char_create_charstatus(DBKey key, va_list args) {
struct mmo_charstatus *cp; struct mmo_charstatus *cp;
cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus)); cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus));
cp->char_id = key.i; cp->char_id = key.i;
@ -2178,7 +2180,7 @@ int char_chardb_waiting_disconnect(int tid, unsigned int tick, int id, intptr_t
/** /**
* @see DBApply * @see DBApply
*/ */
static int char_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap) int char_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{ {
struct online_char_data *character= (struct online_char_data *)db_data2ptr(data); struct online_char_data *character= (struct online_char_data *)db_data2ptr(data);
if (character->fd != -1) if (character->fd != -1)
@ -2191,12 +2193,12 @@ static int char_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
return 0; return 0;
} }
static int char_online_data_cleanup(int tid, unsigned int tick, int id, intptr_t data){ int char_online_data_cleanup(int tid, unsigned int tick, int id, intptr_t data){
online_char_db->foreach(online_char_db, char_online_data_cleanup_sub); online_char_db->foreach(online_char_db, char_online_data_cleanup_sub);
return 0; return 0;
} }
static int char_clan_member_cleanup( int tid, unsigned int tick, int id, intptr_t data ){ int char_clan_member_cleanup( int tid, unsigned int tick, int id, intptr_t data ){
// Auto removal is disabled // Auto removal is disabled
if( charserv_config.clan_remove_inactive_days <= 0 ){ if( charserv_config.clan_remove_inactive_days <= 0 ){
return 0; return 0;
@ -2782,7 +2784,7 @@ void char_set_defaults(){
* @param start: Start point reference * @param start: Start point reference
* @param count: Start point count reference * @param count: Start point count reference
*/ */
static void char_config_split_startpoint(char *w1_value, char *w2_value, struct point start_point[MAX_STARTPOINT], short *count) void char_config_split_startpoint(char *w1_value, char *w2_value, struct point start_point[MAX_STARTPOINT], short *count)
{ {
char *lineitem, **fields; char *lineitem, **fields;
int i = 0, fields_length = 3 + 1; int i = 0, fields_length = 3 + 1;
@ -2827,7 +2829,7 @@ static void char_config_split_startpoint(char *w1_value, char *w2_value, struct
* @param w2_value: Value from w2 * @param w2_value: Value from w2
* @param start: Start item reference * @param start: Start item reference
*/ */
static void char_config_split_startitem(char *w1_value, char *w2_value, struct startitem start_items[MAX_STARTITEM]) void char_config_split_startitem(char *w1_value, char *w2_value, struct startitem start_items[MAX_STARTITEM])
{ {
char *lineitem, **fields; char *lineitem, **fields;
int i = 0, fields_length = 3 + 1; int i = 0, fields_length = 3 + 1;
@ -3064,7 +3066,7 @@ bool char_config_read(const char* cfgName, bool normal){
/** /**
* Checks for values out of range. * Checks for values out of range.
*/ */
static void char_config_adjust() { void char_config_adjust() {
#if PACKETVER < 20100803 #if PACKETVER < 20100803
if (charserv_config.char_config.char_del_option&CHAR_DEL_BIRTHDATE) { if (charserv_config.char_config.char_del_option&CHAR_DEL_BIRTHDATE) {
ShowWarning("conf/char_athena.conf:char_del_option birthdate is enabled but it requires PACKETVER 2010-08-03 or newer, defaulting to email...\n"); ShowWarning("conf/char_athena.conf:char_del_option birthdate is enabled but it requires PACKETVER 2010-08-03 or newer, defaulting to email...\n");

View File

@ -4,10 +4,6 @@
#ifndef _CHAR_SQL_H_ #ifndef _CHAR_SQL_H_
#define _CHAR_SQL_H_ #define _CHAR_SQL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "../config/core.h" #include "../config/core.h"
#include "../common/core.h" // CORE_ST_LAST #include "../common/core.h" // CORE_ST_LAST
#include "../common/msg_conf.h" #include "../common/msg_conf.h"
@ -96,7 +92,7 @@ extern struct Schema_Config schema_config;
#if PACKETVER_SUPPORTS_PINCODE #if PACKETVER_SUPPORTS_PINCODE
/// Pincode system /// Pincode system
enum pincode_state { enum pincode_state : uint8 {
PINCODE_OK = 0, PINCODE_OK = 0,
PINCODE_ASK = 1, PINCODE_ASK = 1,
PINCODE_NOTSET = 2, PINCODE_NOTSET = 2,
@ -320,13 +316,10 @@ void char_set_session_flag_(int account_id, int val, bool set);
#define msg_config_read(cfgName) char_msg_config_read(cfgName) #define msg_config_read(cfgName) char_msg_config_read(cfgName)
#define msg_txt(msg_number) char_msg_txt(msg_number) #define msg_txt(msg_number) char_msg_txt(msg_number)
#define do_final_msg() char_do_final_msg() #define do_final_msg() char_do_final_msg()
int char_msg_config_read(char *cfgName); int char_msg_config_read(const char *cfgName);
const char* char_msg_txt(int msg_number); const char* char_msg_txt(int msg_number);
void char_do_final_msg(void); void char_do_final_msg(void);
bool char_config_read(const char* cfgName, bool normal); bool char_config_read(const char* cfgName, bool normal);
#ifdef __cplusplus
}
#endif
#endif /* _CHAR_SQL_H_ */ #endif /* _CHAR_SQL_H_ */

View File

@ -1,6 +1,11 @@
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "char_clif.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/sql.h" #include "../common/sql.h"
@ -11,13 +16,11 @@
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/utils.h" #include "../common/utils.h"
#include "../common/timer.h" #include "../common/timer.h"
#include "inter.h" #include "inter.hpp"
#include "char.h" #include "char.hpp"
#include "char_logif.h" #include "char_logif.hpp"
#include "char_mapif.h" #include "char_mapif.hpp"
#include "char_clif.h"
#include <stdlib.h>
#if PACKETVER_SUPPORTS_PINCODE #if PACKETVER_SUPPORTS_PINCODE
bool pincode_allowed( char* pincode ); bool pincode_allowed( char* pincode );
@ -444,7 +447,7 @@ void chclif_char_delete2_ack(int fd, uint32 char_id, uint32 result, time_t delet
void chclif_char_delete2_accept_ack(int fd, uint32 char_id, uint32 result) { void chclif_char_delete2_accept_ack(int fd, uint32 char_id, uint32 result) {
#if PACKETVER >= 20130000 #if PACKETVER >= 20130000
if(result == 1 ){ if(result == 1 ){
chclif_mmo_char_send(fd, session[fd]->session_data); chclif_mmo_char_send(fd, (char_session_data*)session[fd]->session_data);
} }
#endif #endif
@ -536,7 +539,7 @@ int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) {
* @param flag Delete flag * @param flag Delete flag
* @return true:Success, false:Failure * @return true:Success, false:Failure
**/ **/
static bool chclif_delchar_check(struct char_session_data *sd, char *delcode, uint8 flag) { bool chclif_delchar_check(struct char_session_data *sd, char *delcode, uint8 flag) {
// E-Mail check // E-Mail check
if (flag&CHAR_DEL_EMAIL && ( if (flag&CHAR_DEL_EMAIL && (
!stricmp(delcode, sd->email) || //email does not match or !stricmp(delcode, sd->email) || //email does not match or

View File

@ -1,18 +1,15 @@
/* // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
* File: char_clif.h // For more information, see LICENCE in the main folder
* Author: lighta
*
* Created on June 15, 2013, 12:06 PM
*/
#ifndef CHAR_CLIF_H #ifndef CHAR_CLIF_H
#define CHAR_CLIF_H #define CHAR_CLIF_H
#include "char.h" //#include "char.h"
#include "../common/cbasetypes.h"
#ifdef __cplusplus #include "../common/timer.h" //time_t
extern "C" { struct char_session_data;
#endif enum pincode_state : uint8;
void chclif_moveCharSlotReply( int fd, struct char_session_data* sd, unsigned short index, short reason ); void chclif_moveCharSlotReply( int fd, struct char_session_data* sd, unsigned short index, short reason );
int chclif_parse_moveCharSlot( int fd, struct char_session_data* sd); int chclif_parse_moveCharSlot( int fd, struct char_session_data* sd);
@ -57,9 +54,5 @@ void chclif_block_character( int fd, struct char_session_data* sd);
int chclif_parse(int fd); int chclif_parse(int fd);
#ifdef __cplusplus
}
#endif
#endif /* CHAR_CLIF_H */ #endif /* CHAR_CLIF_H */

View File

@ -1,16 +1,16 @@
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "char_cnslif.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/timer.h" #include "../common/timer.h"
#include "../common/ers.h" #include "../common/ers.h"
#include "../common/cli.h" #include "../common/cli.h"
#include "char.h" #include "char.hpp"
#include "char_cnslif.h"
#include <stdlib.h>
#include <string.h>
/*====================================================== /*======================================================
* Login-Server help option info * Login-Server help option info

View File

@ -1,22 +1,17 @@
/* // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
* File: char_cnslif.h // For more information, see LICENCE in the main folder
* Author: lighta
*
* Created on June 15, 2013, 12:07 PM
*/
#ifndef CHAR_CNSLIF_H #ifndef CHAR_CNSLIF_H
#define CHAR_CNSLIF_H #define CHAR_CNSLIF_H
int cnslif_parse(const char* buf);
void do_init_chcnslif(void);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void display_helpscreen(bool do_exit); void display_helpscreen(bool do_exit);
int cnslif_parse(const char* buf);
void do_init_chcnslif(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,5 +1,9 @@
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "char_logif.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/timer.h" #include "../common/timer.h"
@ -7,14 +11,13 @@
#include "../common/sql.h" #include "../common/sql.h"
#include "../common/utils.h" #include "../common/utils.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "inter.h"
#include "int_guild.h"
#include "char.h"
#include "char_clif.h"
#include "char_mapif.h"
#include "char_logif.h"
#include <stdlib.h> #include "inter.hpp"
#include "int_guild.hpp"
#include "char.hpp"
#include "char_clif.hpp"
#include "char_mapif.hpp"
//early declaration //early declaration
void chlogif_on_ready(void); void chlogif_on_ready(void);
@ -83,7 +86,7 @@ void chlogif_pincode_start(int fd, struct char_session_data* sd){
* Load this character's account id into the 'online accounts' packet * Load this character's account id into the 'online accounts' packet
* @see DBApply * @see DBApply
*/ */
static int chlogif_send_acc_tologin_sub(DBKey key, DBData *data, va_list ap) { int chlogif_send_acc_tologin_sub(DBKey key, DBData *data, va_list ap) {
struct online_char_data* character = (struct online_char_data*)db_data2ptr(data); struct online_char_data* character = (struct online_char_data*)db_data2ptr(data);
int* i = va_arg(ap, int*); int* i = va_arg(ap, int*);
if(character->server > -1) { if(character->server > -1) {
@ -396,7 +399,7 @@ int chlogif_parse_keepalive(int fd, struct char_session_data* sd){
*/ */
void chlogif_parse_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) void chlogif_parse_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id)
{ {
// job modification // job modification //@TODO switch would be faster
if (class_ == JOB_BARD || class_ == JOB_DANCER) if (class_ == JOB_BARD || class_ == JOB_DANCER)
class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER);
else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY)

View File

@ -1,18 +1,13 @@
/* // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
* File: char_logif.h // For more information, see LICENCE in the main folder
* Author: lighta
*
* Created on June 15, 2013, 12:05 PM
*/
#ifndef CHAR_LOGIF_H #ifndef CHAR_LOGIF_H
#define CHAR_LOGIF_H #define CHAR_LOGIF_H
#include "char.h" #include "../common/cbasetypes.h"
//#include "char.hpp"
#ifdef __cplusplus struct char_session_data;
extern "C" {
#endif
#if PACKETVER_SUPPORTS_PINCODE #if PACKETVER_SUPPORTS_PINCODE
void chlogif_pincode_notifyLoginPinError( uint32 account_id ); void chlogif_pincode_notifyLoginPinError( uint32 account_id );
@ -61,9 +56,6 @@ void do_final_chlogif(void);
#define loginif_check(a) { if(!chlogif_isconnected()) return a; } #define loginif_check(a) { if(!chlogif_isconnected()) return a; }
#ifdef __cplusplus
}
#endif
#endif /* CHAR_LOGIF_H */ #endif /* CHAR_LOGIF_H */

View File

@ -6,18 +6,19 @@
* @author Athena Dev Teams originally in login.c * @author Athena Dev Teams originally in login.c
* @author rAthena Dev Team * @author rAthena Dev Team
*/ */
#include "char_mapif.hpp"
#include <stdlib.h>
#include <string.h> //memcpy
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "inter.h" #include "inter.hpp"
#include "char.h" #include "char.hpp"
#include "char_logif.h" #include "char_logif.hpp"
#include "char_mapif.h"
#include <stdlib.h>
/** /**
* Packet send to all map-servers, attach to ourself * Packet send to all map-servers, attach to ourself
@ -167,7 +168,7 @@ void chmapif_sendall_playercount(int users){
* HZ 0x2afb <size>.W <status>.B <name>.24B <mapname>.11B <map_x>.W <map_y>.W * HZ 0x2afb <size>.W <status>.B <name>.24B <mapname>.11B <map_x>.W <map_y>.W
* @param fd * @param fd
**/ **/
static void chmapif_send_misc(int fd) { void chmapif_send_misc(int fd) {
uint16 offs = 5; uint16 offs = 5;
unsigned char buf[45]; unsigned char buf[45];
@ -195,7 +196,7 @@ static void chmapif_send_misc(int fd) {
* @param map_id * @param map_id
* @param count Number of map from new map-server has * @param count Number of map from new map-server has
**/ **/
static void chmapif_send_maps(int fd, int map_id, int count, unsigned char *mapbuf) { void chmapif_send_maps(int fd, int map_id, int count, unsigned char *mapbuf) {
uint16 x; uint16 x;
if (count == 0) { if (count == 0) {

View File

@ -10,9 +10,7 @@
#ifndef CHAR_MAPIF_H #ifndef CHAR_MAPIF_H
#define CHAR_MAPIF_H #define CHAR_MAPIF_H
#ifdef __cplusplus #include "../common/cbasetypes.h"
extern "C" {
#endif
int chmapif_sendall(unsigned char *buf, unsigned int len); int chmapif_sendall(unsigned char *buf, unsigned int len);
int chmapif_sendallwos(int sfd, unsigned char *buf, unsigned int len); int chmapif_sendallwos(int sfd, unsigned char *buf, unsigned int len);
@ -66,9 +64,5 @@ void chmapif_on_disconnect(int id);
void do_final_chmapif(void); void do_final_chmapif(void);
#ifdef __cplusplus
}
#endif
#endif /* CHAR_MAPIF_H */ #endif /* CHAR_MAPIF_H */

View File

@ -1,6 +1,12 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_achievement.hpp"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../common/db.h" #include "../common/db.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/mmo.h" #include "../common/mmo.h"
@ -9,14 +15,9 @@
#include "../common/sql.h" #include "../common/sql.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "char.h" #include "char.hpp"
#include "inter.h" #include "inter.hpp"
#include "int_achievement.h" #include "int_mail.hpp"
#include "int_mail.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/** /**
* Load achievements for a character. * Load achievements for a character.

View File

@ -4,13 +4,8 @@
#ifndef _INT_ACHIEVEMENT_SQL_H_ #ifndef _INT_ACHIEVEMENT_SQL_H_
#define _INT_ACHIEVEMENT_SQL_H_ #define _INT_ACHIEVEMENT_SQL_H_
#ifdef __cplusplus
extern "C" {
#endif
int inter_achievement_parse_frommap(int fd); int inter_achievement_parse_frommap(int fd);
#ifdef __cplusplus
}
#endif
#endif /* _INT_ACHIEVEMENT_SQL_H_ */ #endif /* _INT_ACHIEVEMENT_SQL_H_ */

View File

@ -1,6 +1,12 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_auction.hpp"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
@ -8,20 +14,19 @@
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "../common/timer.h" #include "../common/timer.h"
#include "char.h"
#include "char_mapif.h"
#include "inter.h"
#include "int_mail.h"
#include "int_auction.h"
#include <stdlib.h> #include "char.hpp"
#include "char_mapif.hpp"
#include "inter.hpp"
#include "int_mail.hpp"
static DBMap* auction_db_ = NULL; // int auction_id -> struct auction_data* static DBMap* auction_db_ = NULL; // int auction_id -> struct auction_data*
void auction_delete(struct auction_data *auction); void auction_delete(struct auction_data *auction);
static int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data); int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data);
static int auction_count(uint32 char_id, bool buy) int auction_count(uint32 char_id, bool buy)
{ {
int i = 0; int i = 0;
struct auction_data *auction; struct auction_data *auction;
@ -137,7 +142,7 @@ unsigned int auction_create(struct auction_data *auction)
return auction->auction_id; return auction->auction_id;
} }
static void mapif_Auction_message(uint32 char_id, unsigned char result) void mapif_Auction_message(uint32 char_id, unsigned char result)
{ {
unsigned char buf[74]; unsigned char buf[74];
@ -147,7 +152,7 @@ static void mapif_Auction_message(uint32 char_id, unsigned char result)
chmapif_sendall(buf,7); chmapif_sendall(buf,7);
} }
static int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data) int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data)
{ {
struct auction_data *auction; struct auction_data *auction;
if( (auction = (struct auction_data *)idb_get(auction_db_, id)) != NULL ) if( (auction = (struct auction_data *)idb_get(auction_db_, id)) != NULL )
@ -263,7 +268,7 @@ void inter_auctions_fromsql(void)
Sql_FreeResult(sql_handle); Sql_FreeResult(sql_handle);
} }
static void mapif_Auction_sendlist(int fd, uint32 char_id, short count, short pages, unsigned char *buf) void mapif_Auction_sendlist(int fd, uint32 char_id, short count, short pages, unsigned char *buf)
{ {
int len = (sizeof(struct auction_data) * count) + 12; int len = (sizeof(struct auction_data) * count) + 12;
@ -277,7 +282,7 @@ static void mapif_Auction_sendlist(int fd, uint32 char_id, short count, short pa
WFIFOSET(fd,len); WFIFOSET(fd,len);
} }
static void mapif_parse_Auction_requestlist(int fd) void mapif_parse_Auction_requestlist(int fd)
{ {
char searchtext[NAME_LENGTH]; char searchtext[NAME_LENGTH];
uint32 char_id = RFIFOL(fd,4), len = sizeof(struct auction_data); uint32 char_id = RFIFOL(fd,4), len = sizeof(struct auction_data);
@ -290,7 +295,7 @@ static void mapif_parse_Auction_requestlist(int fd)
memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH); memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH);
for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) ) for( auction = static_cast<auction_data *>(dbi_first(iter)); dbi_exists(iter); auction = static_cast<auction_data *>(dbi_next(iter)) )
{ {
if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) || if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) ||
(type == 1 && auction->type != IT_WEAPON) || (type == 1 && auction->type != IT_WEAPON) ||
@ -320,7 +325,7 @@ static void mapif_parse_Auction_requestlist(int fd)
mapif_Auction_sendlist(fd, char_id, j, pages, buf); mapif_Auction_sendlist(fd, char_id, j, pages, buf);
} }
static void mapif_Auction_register(int fd, struct auction_data *auction) void mapif_Auction_register(int fd, struct auction_data *auction)
{ {
int len = sizeof(struct auction_data) + 4; int len = sizeof(struct auction_data) + 4;
@ -331,7 +336,7 @@ static void mapif_Auction_register(int fd, struct auction_data *auction)
WFIFOSET(fd,len); WFIFOSET(fd,len);
} }
static void mapif_parse_Auction_register(int fd) void mapif_parse_Auction_register(int fd)
{ {
struct auction_data auction; struct auction_data auction;
if( RFIFOW(fd,2) != sizeof(struct auction_data) + 4 ) if( RFIFOW(fd,2) != sizeof(struct auction_data) + 4 )
@ -344,7 +349,7 @@ static void mapif_parse_Auction_register(int fd)
mapif_Auction_register(fd, &auction); mapif_Auction_register(fd, &auction);
} }
static void mapif_Auction_cancel(int fd, uint32 char_id, unsigned char result) void mapif_Auction_cancel(int fd, uint32 char_id, unsigned char result)
{ {
WFIFOHEAD(fd,7); WFIFOHEAD(fd,7);
WFIFOW(fd,0) = 0x3852; WFIFOW(fd,0) = 0x3852;
@ -353,7 +358,7 @@ static void mapif_Auction_cancel(int fd, uint32 char_id, unsigned char result)
WFIFOSET(fd,7); WFIFOSET(fd,7);
} }
static void mapif_parse_Auction_cancel(int fd) void mapif_parse_Auction_cancel(int fd)
{ {
uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6); uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
struct auction_data *auction; struct auction_data *auction;
@ -382,7 +387,7 @@ static void mapif_parse_Auction_cancel(int fd)
mapif_Auction_cancel(fd, char_id, 0); // The auction has been canceled mapif_Auction_cancel(fd, char_id, 0); // The auction has been canceled
} }
static void mapif_Auction_close(int fd, uint32 char_id, unsigned char result) void mapif_Auction_close(int fd, uint32 char_id, unsigned char result)
{ {
WFIFOHEAD(fd,7); WFIFOHEAD(fd,7);
WFIFOW(fd,0) = 0x3853; WFIFOW(fd,0) = 0x3853;
@ -391,7 +396,7 @@ static void mapif_Auction_close(int fd, uint32 char_id, unsigned char result)
WFIFOSET(fd,7); WFIFOSET(fd,7);
} }
static void mapif_parse_Auction_close(int fd) void mapif_parse_Auction_close(int fd)
{ {
uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6); uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
struct auction_data *auction; struct auction_data *auction;
@ -424,7 +429,7 @@ static void mapif_parse_Auction_close(int fd)
mapif_Auction_close(fd, char_id, 0); // You have ended the auction mapif_Auction_close(fd, char_id, 0); // You have ended the auction
} }
static void mapif_Auction_bid(int fd, uint32 char_id, int bid, unsigned char result) void mapif_Auction_bid(int fd, uint32 char_id, int bid, unsigned char result)
{ {
WFIFOHEAD(fd,11); WFIFOHEAD(fd,11);
WFIFOW(fd,0) = 0x3855; WFIFOW(fd,0) = 0x3855;
@ -434,7 +439,7 @@ static void mapif_Auction_bid(int fd, uint32 char_id, int bid, unsigned char res
WFIFOSET(fd,11); WFIFOSET(fd,11);
} }
static void mapif_parse_Auction_bid(int fd) void mapif_parse_Auction_bid(int fd)
{ {
uint32 char_id = RFIFOL(fd,4), auction_id = RFIFOL(fd,8); uint32 char_id = RFIFOL(fd,4), auction_id = RFIFOL(fd,8);
int bid = RFIFOL(fd,12); int bid = RFIFOL(fd,12);

View File

@ -4,17 +4,11 @@
#ifndef _INT_AUCTION_SQL_H_ #ifndef _INT_AUCTION_SQL_H_
#define _INT_AUCTION_SQL_H_ #define _INT_AUCTION_SQL_H_
#ifdef __cplusplus
extern "C" {
#endif
int inter_auction_parse_frommap(int fd); int inter_auction_parse_frommap(int fd);
int inter_auction_sql_init(void); int inter_auction_sql_init(void);
void inter_auction_sql_final(void); void inter_auction_sql_final(void);
#ifdef __cplusplus
}
#endif
#endif /* _INT_AUCTION_SQL_H_ */ #endif /* _INT_AUCTION_SQL_H_ */

View File

@ -1,6 +1,11 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_clan.hpp"
#include <stdlib.h>
#include <string.h> //memset
#include "../common/cbasetypes.h" #include "../common/cbasetypes.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/mmo.h" #include "../common/mmo.h"
@ -8,11 +13,10 @@
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "char.h" #include "char.hpp"
#include "char_mapif.h" #include "char_mapif.hpp"
#include "inter.h" #include "inter.hpp"
#include <stdlib.h>
//clan cache //clan cache
static DBMap* clan_db; // int clan_id -> struct clan* static DBMap* clan_db; // int clan_id -> struct clan*

View File

@ -4,16 +4,8 @@
#ifndef _INT_CLAN_H_ #ifndef _INT_CLAN_H_
#define _INT_CLAN_H_ #define _INT_CLAN_H_
#ifdef __cplusplus
extern "C" {
#endif
int inter_clan_parse_frommap( int fd ); int inter_clan_parse_frommap( int fd );
int inter_clan_init(void); int inter_clan_init(void);
void inter_clan_final(void); void inter_clan_final(void);
#ifdef __cplusplus
}
#endif
#endif /* _INT_CLAN_H_ */ #endif /* _INT_CLAN_H_ */

View File

@ -1,15 +1,20 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_elemental.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h"
#include "inter.h"
#include <stdlib.h> #include "char.hpp"
#include "inter.hpp"
bool mapif_elemental_save(struct s_elemental* ele) { bool mapif_elemental_save(struct s_elemental* ele) {
bool flag = true; bool flag = true;
@ -58,7 +63,7 @@ bool mapif_elemental_load(int ele_id, uint32 char_id, struct s_elemental *ele) {
} }
Sql_GetData(sql_handle, 0, &data, NULL); ele->class_ = atoi(data); Sql_GetData(sql_handle, 0, &data, NULL); ele->class_ = atoi(data);
Sql_GetData(sql_handle, 1, &data, NULL); ele->mode = atoi(data); Sql_GetData(sql_handle, 1, &data, NULL); ele->mode = (e_mode)atoi(data);
Sql_GetData(sql_handle, 2, &data, NULL); ele->hp = atoi(data); Sql_GetData(sql_handle, 2, &data, NULL); ele->hp = atoi(data);
Sql_GetData(sql_handle, 3, &data, NULL); ele->sp = atoi(data); Sql_GetData(sql_handle, 3, &data, NULL); ele->sp = atoi(data);
Sql_GetData(sql_handle, 4, &data, NULL); ele->max_hp = atoi(data); Sql_GetData(sql_handle, 4, &data, NULL); ele->max_hp = atoi(data);
@ -88,7 +93,7 @@ bool mapif_elemental_delete(int ele_id) {
return true; return true;
} }
static void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) { void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) {
int size = sizeof(struct s_elemental) + 5; int size = sizeof(struct s_elemental) + 5;
WFIFOHEAD(fd,size); WFIFOHEAD(fd,size);
@ -99,37 +104,37 @@ static void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char
WFIFOSET(fd,size); WFIFOSET(fd,size);
} }
static void mapif_parse_elemental_create(int fd, struct s_elemental* ele) { void mapif_parse_elemental_create(int fd, struct s_elemental* ele) {
bool result = mapif_elemental_save(ele); bool result = mapif_elemental_save(ele);
mapif_elemental_send(fd, ele, result); mapif_elemental_send(fd, ele, result);
} }
static void mapif_parse_elemental_load(int fd, int ele_id, uint32 char_id) { void mapif_parse_elemental_load(int fd, int ele_id, uint32 char_id) {
struct s_elemental ele; struct s_elemental ele;
bool result = mapif_elemental_load(ele_id, char_id, &ele); bool result = mapif_elemental_load(ele_id, char_id, &ele);
mapif_elemental_send(fd, &ele, result); mapif_elemental_send(fd, &ele, result);
} }
static void mapif_elemental_deleted(int fd, unsigned char flag) { void mapif_elemental_deleted(int fd, unsigned char flag) {
WFIFOHEAD(fd,3); WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x387d; WFIFOW(fd,0) = 0x387d;
WFIFOB(fd,2) = flag; WFIFOB(fd,2) = flag;
WFIFOSET(fd,3); WFIFOSET(fd,3);
} }
static void mapif_parse_elemental_delete(int fd, int ele_id) { void mapif_parse_elemental_delete(int fd, int ele_id) {
bool result = mapif_elemental_delete(ele_id); bool result = mapif_elemental_delete(ele_id);
mapif_elemental_deleted(fd, result); mapif_elemental_deleted(fd, result);
} }
static void mapif_elemental_saved(int fd, unsigned char flag) { void mapif_elemental_saved(int fd, unsigned char flag) {
WFIFOHEAD(fd,3); WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x387e; WFIFOW(fd,0) = 0x387e;
WFIFOB(fd,2) = flag; WFIFOB(fd,2) = flag;
WFIFOSET(fd,3); WFIFOSET(fd,3);
} }
static void mapif_parse_elemental_save(int fd, struct s_elemental* ele) { void mapif_parse_elemental_save(int fd, struct s_elemental* ele) {
bool result = mapif_elemental_save(ele); bool result = mapif_elemental_save(ele);
mapif_elemental_saved(fd, result); mapif_elemental_saved(fd, result);
} }

View File

@ -4,9 +4,6 @@
#ifndef _INT_ELEMENTAL_SQL_H_ #ifndef _INT_ELEMENTAL_SQL_H_
#define _INT_ELEMENTAL_SQL_H_ #define _INT_ELEMENTAL_SQL_H_
#ifdef __cplusplus
extern "C" {
#endif
struct s_elemental; struct s_elemental;
@ -16,8 +13,5 @@ int inter_elemental_parse_frommap(int fd);
bool mapif_elemental_delete(int ele_id); bool mapif_elemental_delete(int ele_id);
#ifdef __cplusplus
}
#endif
#endif /* _INT_ELEMENTAL_SQL_H_ */ #endif /* _INT_ELEMENTAL_SQL_H_ */

View File

@ -1,6 +1,12 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_guild.hpp"
#include <stdlib.h>
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
#include "../common/cbasetypes.h" #include "../common/cbasetypes.h"
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/malloc.h" #include "../common/malloc.h"
@ -8,12 +14,11 @@
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/timer.h" #include "../common/timer.h"
#include "char.h"
#include "char_mapif.h"
#include "inter.h"
#include "int_guild.h"
#include <stdlib.h> #include "char.hpp"
#include "char_mapif.hpp"
#include "inter.hpp"
#define GS_MEMBER_UNMODIFIED 0x00 #define GS_MEMBER_UNMODIFIED 0x00
#define GS_MEMBER_MODIFIED 0x01 #define GS_MEMBER_MODIFIED 0x01
@ -36,14 +41,14 @@ static unsigned int guild_exp[100];
int mapif_parse_GuildLeave(int fd,int guild_id,uint32 account_id,uint32 char_id,int flag,const char *mes); int mapif_parse_GuildLeave(int fd,int guild_id,uint32 account_id,uint32 char_id,int flag,const char *mes);
int mapif_guild_broken(int guild_id,int flag); int mapif_guild_broken(int guild_id,int flag);
static bool guild_check_empty(struct guild *g); bool guild_check_empty(struct guild *g);
int guild_calcinfo(struct guild *g); int guild_calcinfo(struct guild *g);
int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len); int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len);
int mapif_guild_info(int fd,struct guild *g); int mapif_guild_info(int fd,struct guild *g);
int guild_break_sub(int key,void *data,va_list ap); int guild_break_sub(int key,void *data,va_list ap);
int inter_guild_tosql(struct guild *g,int flag); int inter_guild_tosql(struct guild *g,int flag);
static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data) int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
{ {
static int last_id = 0; //To know in which guild we were. static int last_id = 0; //To know in which guild we were.
int state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving. int state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving.
@ -546,7 +551,7 @@ int inter_guildcastle_tosql(struct guild_castle *gc)
} }
// Read guild_castle from SQL // Read guild_castle from SQL
static struct guild_castle* inter_guildcastle_fromsql(int castle_id) struct guild_castle* inter_guildcastle_fromsql(int castle_id)
{ {
char *data; char *data;
int i; int i;
@ -598,7 +603,7 @@ static struct guild_castle* inter_guildcastle_fromsql(int castle_id)
// Read exp_guild.txt // Read exp_guild.txt
static bool exp_guild_parse_row(char* split[], int column, int current) bool exp_guild_parse_row(char* split[], int column, int current)
{ {
unsigned int exp = (unsigned int)atol(split[0]); unsigned int exp = (unsigned int)atol(split[0]);
@ -739,7 +744,7 @@ int inter_guild_sql_init(void)
/** /**
* @see DBApply * @see DBApply
*/ */
static int guild_db_final(DBKey key, DBData *data, va_list ap) int guild_db_final(DBKey key, DBData *data, va_list ap)
{ {
struct guild *g = (struct guild*)db_data2ptr(data); struct guild *g = (struct guild*)db_data2ptr(data);
if (g->save_flag&GS_MASK) { if (g->save_flag&GS_MASK) {
@ -786,7 +791,7 @@ int search_guildname(char *str)
} }
// Check if guild is empty // Check if guild is empty
static bool guild_check_empty(struct guild *g) bool guild_check_empty(struct guild *g)
{ {
int i; int i;
ARR_FIND( 0, g->max_member, i, g->member[i].account_id > 0 ); ARR_FIND( 0, g->max_member, i, g->member[i].account_id > 0 );
@ -1647,7 +1652,7 @@ int mapif_parse_GuildSkillUp(int fd,int guild_id,uint16 skill_id,uint32 account_
} }
//Manual deletion of an alliance when partnering guild does not exists. [Skotlex] //Manual deletion of an alliance when partnering guild does not exists. [Skotlex]
static int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, uint32 account_id1, uint32 account_id2, int flag) int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, uint32 account_id1, uint32 account_id2, int flag)
{ {
int i; int i;
char name[NAME_LENGTH]; char name[NAME_LENGTH];

View File

@ -4,13 +4,9 @@
#ifndef _INT_GUILD_SQL_H_ #ifndef _INT_GUILD_SQL_H_
#define _INT_GUILD_SQL_H_ #define _INT_GUILD_SQL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "../common/cbasetypes.h" #include "../common/cbasetypes.h"
enum { enum e_guild_action : uint32 {
GS_BASIC = 0x0001, GS_BASIC = 0x0001,
GS_MEMBER = 0x0002, GS_MEMBER = 0x0002,
GS_POSITION = 0x0004, GS_POSITION = 0x0004,
@ -40,8 +36,4 @@ int inter_guild_charname_changed(int guild_id,uint32 account_id, uint32 char_id,
int inter_guild_CharOnline(uint32 char_id, int guild_id); int inter_guild_CharOnline(uint32 char_id, int guild_id);
int inter_guild_CharOffline(uint32 char_id, int guild_id); int inter_guild_CharOffline(uint32 char_id, int guild_id);
#ifdef __cplusplus
}
#endif
#endif /* _INT_GUILD_SQL_H_ */ #endif /* _INT_GUILD_SQL_H_ */

View File

@ -1,16 +1,20 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_homun.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/utils.h" #include "../common/utils.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h"
#include "inter.h"
#include <stdlib.h> #include "char.hpp"
#include "inter.hpp"
int inter_homunculus_sql_init(void) int inter_homunculus_sql_init(void)
@ -22,7 +26,7 @@ void inter_homunculus_sql_final(void)
return; return;
} }
static void mapif_homunculus_created(int fd, uint32 account_id, struct s_homunculus *sh, unsigned char flag) void mapif_homunculus_created(int fd, uint32 account_id, struct s_homunculus *sh, unsigned char flag)
{ {
WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
WFIFOW(fd,0) = 0x3890; WFIFOW(fd,0) = 0x3890;
@ -33,7 +37,7 @@ static void mapif_homunculus_created(int fd, uint32 account_id, struct s_homuncu
WFIFOSET(fd, WFIFOW(fd,2)); WFIFOSET(fd, WFIFOW(fd,2));
} }
static void mapif_homunculus_deleted(int fd, int flag) void mapif_homunculus_deleted(int fd, int flag)
{ {
WFIFOHEAD(fd, 3); WFIFOHEAD(fd, 3);
WFIFOW(fd, 0) = 0x3893; WFIFOW(fd, 0) = 0x3893;
@ -41,7 +45,7 @@ static void mapif_homunculus_deleted(int fd, int flag)
WFIFOSET(fd, 3); WFIFOSET(fd, 3);
} }
static void mapif_homunculus_loaded(int fd, uint32 account_id, struct s_homunculus *hd) void mapif_homunculus_loaded(int fd, uint32 account_id, struct s_homunculus *hd)
{ {
WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
WFIFOW(fd,0) = 0x3891; WFIFOW(fd,0) = 0x3891;
@ -60,7 +64,7 @@ static void mapif_homunculus_loaded(int fd, uint32 account_id, struct s_homuncul
WFIFOSET(fd, sizeof(struct s_homunculus)+9); WFIFOSET(fd, sizeof(struct s_homunculus)+9);
} }
static void mapif_homunculus_saved(int fd, uint32 account_id, bool flag) void mapif_homunculus_saved(int fd, uint32 account_id, bool flag)
{ {
WFIFOHEAD(fd, 7); WFIFOHEAD(fd, 7);
WFIFOW(fd,0) = 0x3892; WFIFOW(fd,0) = 0x3892;
@ -69,7 +73,7 @@ static void mapif_homunculus_saved(int fd, uint32 account_id, bool flag)
WFIFOSET(fd, 7); WFIFOSET(fd, 7);
} }
static void mapif_homunculus_renamed(int fd, uint32 account_id, uint32 char_id, unsigned char flag, char* name) void mapif_homunculus_renamed(int fd, uint32 account_id, uint32 char_id, unsigned char flag, char* name)
{ {
WFIFOHEAD(fd, NAME_LENGTH+12); WFIFOHEAD(fd, NAME_LENGTH+12);
WFIFOW(fd, 0) = 0x3894; WFIFOW(fd, 0) = 0x3894;
@ -261,32 +265,32 @@ bool mapif_homunculus_rename(char *name)
} }
static void mapif_parse_homunculus_create(int fd, int len, uint32 account_id, struct s_homunculus* phd) void mapif_parse_homunculus_create(int fd, int len, uint32 account_id, struct s_homunculus* phd)
{ {
bool result = mapif_homunculus_save(phd); bool result = mapif_homunculus_save(phd);
mapif_homunculus_created(fd, account_id, phd, result); mapif_homunculus_created(fd, account_id, phd, result);
} }
static void mapif_parse_homunculus_delete(int fd, int homun_id) void mapif_parse_homunculus_delete(int fd, int homun_id)
{ {
bool result = mapif_homunculus_delete(homun_id); bool result = mapif_homunculus_delete(homun_id);
mapif_homunculus_deleted(fd, result); mapif_homunculus_deleted(fd, result);
} }
static void mapif_parse_homunculus_load(int fd, uint32 account_id, int homun_id) void mapif_parse_homunculus_load(int fd, uint32 account_id, int homun_id)
{ {
struct s_homunculus hd; struct s_homunculus hd;
bool result = mapif_homunculus_load(homun_id, &hd); bool result = mapif_homunculus_load(homun_id, &hd);
mapif_homunculus_loaded(fd, account_id, ( result ? &hd : NULL )); mapif_homunculus_loaded(fd, account_id, ( result ? &hd : NULL ));
} }
static void mapif_parse_homunculus_save(int fd, int len, uint32 account_id, struct s_homunculus* phd) void mapif_parse_homunculus_save(int fd, int len, uint32 account_id, struct s_homunculus* phd)
{ {
bool result = mapif_homunculus_save(phd); bool result = mapif_homunculus_save(phd);
mapif_homunculus_saved(fd, account_id, result); mapif_homunculus_saved(fd, account_id, result);
} }
static void mapif_parse_homunculus_rename(int fd, uint32 account_id, uint32 char_id, char* name) void mapif_parse_homunculus_rename(int fd, uint32 account_id, uint32 char_id, char* name)
{ {
bool result = mapif_homunculus_rename(name); bool result = mapif_homunculus_rename(name);
mapif_homunculus_renamed(fd, account_id, char_id, result, name); mapif_homunculus_renamed(fd, account_id, char_id, result, name);

View File

@ -4,10 +4,7 @@
#ifndef _INT_HOMUN_SQL_H_ #ifndef _INT_HOMUN_SQL_H_
#define _INT_HOMUN_SQL_H_ #define _INT_HOMUN_SQL_H_
#ifdef __cplusplus #include "../common/cbasetypes.h"
extern "C" {
#endif
struct s_homunculus; struct s_homunculus;
int inter_homunculus_sql_init(void); int inter_homunculus_sql_init(void);
@ -19,8 +16,5 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd);
bool mapif_homunculus_delete(int homun_id); bool mapif_homunculus_delete(int homun_id);
bool mapif_homunculus_rename(char *name); bool mapif_homunculus_rename(char *name);
#ifdef __cplusplus
}
#endif
#endif /* _INT_HOMUN_SQL_H_ */ #endif /* _INT_HOMUN_SQL_H_ */

View File

@ -1,22 +1,26 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_mail.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h"
#include "char_mapif.h"
#include "inter.h"
#include <stdlib.h> #include "char.hpp"
#include "char_mapif.hpp"
#include "inter.hpp"
static bool mail_loadmessage(int mail_id, struct mail_message* msg); bool mail_loadmessage(int mail_id, struct mail_message* msg);
static void mapif_Mail_return(int fd, uint32 char_id, int mail_id); void mapif_Mail_return(int fd, uint32 char_id, int mail_id);
static void mapif_Mail_delete(int fd, uint32 char_id, int mail_id, bool deleted); void mapif_Mail_delete(int fd, uint32 char_id, int mail_id, bool deleted);
static int mail_fromsql(uint32 char_id, struct mail_data* md) int mail_fromsql(uint32 char_id, struct mail_data* md)
{ {
int i; int i;
char *data; char *data;
@ -145,7 +149,7 @@ int mail_savemessage(struct mail_message* msg)
/// Retrieves a single message from the database. /// Retrieves a single message from the database.
/// Returns true if the operation succeeds (or false if it fails). /// Returns true if the operation succeeds (or false if it fails).
static bool mail_loadmessage(int mail_id, struct mail_message* msg) bool mail_loadmessage(int mail_id, struct mail_message* msg)
{ {
int i, j; int i, j;
StringBuf buf; StringBuf buf;
@ -167,7 +171,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg)
Sql_GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data); Sql_GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data);
Sql_GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data); Sql_GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data);
Sql_GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data); Sql_GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data);
Sql_GetData(sql_handle,10, &data, NULL); msg->type = atoi(data); Sql_GetData(sql_handle,10, &data, NULL); msg->type = (mail_inbox_type)atoi(data);
if( msg->type == MAIL_INBOX_NORMAL && charserv_config.mail_return_days > 0 ){ if( msg->type == MAIL_INBOX_NORMAL && charserv_config.mail_return_days > 0 ){
msg->scheduled_deletion = msg->timestamp + charserv_config.mail_return_days * 24 * 60 * 60; msg->scheduled_deletion = msg->timestamp + charserv_config.mail_return_days * 24 * 60 * 60;
@ -230,7 +234,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg)
return true; return true;
} }
static int mail_timer_sub( int limit, enum mail_inbox_type type ){ int mail_timer_sub( int limit, enum mail_inbox_type type ){
struct{ struct{
int mail_id; int mail_id;
int char_id; int char_id;
@ -300,7 +304,7 @@ int mail_delete_timer( int tid, unsigned int tick, int id, intptr_t data ){
/*========================================== /*==========================================
* Client Inbox Request * Client Inbox Request
*------------------------------------------*/ *------------------------------------------*/
static void mapif_Mail_sendinbox(int fd, uint32 char_id, unsigned char flag, enum mail_inbox_type type) void mapif_Mail_sendinbox(int fd, uint32 char_id, unsigned char flag, enum mail_inbox_type type)
{ {
struct mail_data md; struct mail_data md;
mail_fromsql(char_id, &md); mail_fromsql(char_id, &md);
@ -316,15 +320,15 @@ static void mapif_Mail_sendinbox(int fd, uint32 char_id, unsigned char flag, enu
WFIFOSET(fd,WFIFOW(fd,2)); WFIFOSET(fd,WFIFOW(fd,2));
} }
static void mapif_parse_Mail_requestinbox(int fd) void mapif_parse_Mail_requestinbox(int fd)
{ {
mapif_Mail_sendinbox(fd, RFIFOL(fd,2), RFIFOB(fd,6), RFIFOB(fd,7)); mapif_Mail_sendinbox(fd, RFIFOL(fd,2), RFIFOB(fd,6), (mail_inbox_type)RFIFOB(fd,7));
} }
/*========================================== /*==========================================
* Mark mail as 'Read' * Mark mail as 'Read'
*------------------------------------------*/ *------------------------------------------*/
static void mapif_parse_Mail_read(int fd) void mapif_parse_Mail_read(int fd)
{ {
int mail_id = RFIFOL(fd,2); int mail_id = RFIFOL(fd,2);
if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", schema_config.mail_db, MAIL_READ, mail_id) ) if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", schema_config.mail_db, MAIL_READ, mail_id) )
@ -334,7 +338,7 @@ static void mapif_parse_Mail_read(int fd)
/*========================================== /*==========================================
* Client Attachment Request * Client Attachment Request
*------------------------------------------*/ *------------------------------------------*/
static bool mail_DeleteAttach(int mail_id){ bool mail_DeleteAttach(int mail_id){
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", schema_config.mail_attachment_db, mail_id ) ){ if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", schema_config.mail_attachment_db, mail_id ) ){
Sql_ShowDebug(sql_handle); Sql_ShowDebug(sql_handle);
return false; return false;
@ -343,7 +347,7 @@ static bool mail_DeleteAttach(int mail_id){
return true; return true;
} }
static void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type) void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type)
{ {
struct mail_message msg; struct mail_message msg;
@ -407,7 +411,7 @@ static void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id, int type)
WFIFOSET(fd,WFIFOW(fd,2)); WFIFOSET(fd,WFIFOW(fd,2));
} }
static void mapif_parse_Mail_getattach(int fd) void mapif_parse_Mail_getattach(int fd)
{ {
mapif_Mail_getattach(fd, RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10)); mapif_Mail_getattach(fd, RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10));
} }
@ -415,7 +419,7 @@ static void mapif_parse_Mail_getattach(int fd)
/*========================================== /*==========================================
* Delete Mail * Delete Mail
*------------------------------------------*/ *------------------------------------------*/
static void mapif_Mail_delete(int fd, uint32 char_id, int mail_id, bool deleted) void mapif_Mail_delete(int fd, uint32 char_id, int mail_id, bool deleted)
{ {
bool failed = false; bool failed = false;
@ -441,7 +445,7 @@ static void mapif_Mail_delete(int fd, uint32 char_id, int mail_id, bool deleted)
WFIFOSET(fd,11); WFIFOSET(fd,11);
} }
static void mapif_parse_Mail_delete(int fd) void mapif_parse_Mail_delete(int fd)
{ {
mapif_Mail_delete(fd, RFIFOL(fd,2), RFIFOL(fd,6), false); mapif_Mail_delete(fd, RFIFOL(fd,2), RFIFOL(fd,6), false);
} }
@ -468,7 +472,7 @@ void mapif_Mail_new(struct mail_message *msg)
/*========================================== /*==========================================
* Return Mail * Return Mail
*------------------------------------------*/ *------------------------------------------*/
static void mapif_Mail_return(int fd, uint32 char_id, int mail_id) void mapif_Mail_return(int fd, uint32 char_id, int mail_id)
{ {
struct mail_message msg; struct mail_message msg;
int new_mail = 0; int new_mail = 0;
@ -516,7 +520,7 @@ static void mapif_Mail_return(int fd, uint32 char_id, int mail_id)
WFIFOSET(fd,11); WFIFOSET(fd,11);
} }
static void mapif_parse_Mail_return(int fd) void mapif_parse_Mail_return(int fd)
{ {
mapif_Mail_return(fd, RFIFOL(fd,2), RFIFOL(fd,6)); mapif_Mail_return(fd, RFIFOL(fd,2), RFIFOL(fd,6));
} }
@ -524,7 +528,7 @@ static void mapif_parse_Mail_return(int fd)
/*========================================== /*==========================================
* Send Mail * Send Mail
*------------------------------------------*/ *------------------------------------------*/
static void mapif_Mail_send(int fd, struct mail_message* msg) void mapif_Mail_send(int fd, struct mail_message* msg)
{ {
int len = sizeof(struct mail_message) + 4; int len = sizeof(struct mail_message) + 4;
@ -535,7 +539,7 @@ static void mapif_Mail_send(int fd, struct mail_message* msg)
WFIFOSET(fd,len); WFIFOSET(fd,len);
} }
static void mapif_parse_Mail_send(int fd) void mapif_parse_Mail_send(int fd)
{ {
struct mail_message msg; struct mail_message msg;
char esc_name[NAME_LENGTH*2+1]; char esc_name[NAME_LENGTH*2+1];
@ -609,7 +613,7 @@ bool mail_sendmail(int send_id, const char* send_name, int dest_id, const char*
return true; return true;
} }
static void mapif_Mail_receiver_send( int fd, int requesting_char_id, int char_id, int class_, int base_level, const char* name ){ void mapif_Mail_receiver_send( int fd, int requesting_char_id, int char_id, int class_, int base_level, const char* name ){
WFIFOHEAD(fd,38); WFIFOHEAD(fd,38);
WFIFOW(fd,0) = 0x384e; WFIFOW(fd,0) = 0x384e;
WFIFOL(fd,2) = requesting_char_id; WFIFOL(fd,2) = requesting_char_id;
@ -620,7 +624,7 @@ static void mapif_Mail_receiver_send( int fd, int requesting_char_id, int char_i
WFIFOSET(fd,38); WFIFOSET(fd,38);
} }
static void mapif_parse_Mail_receiver_check( int fd ){ void mapif_parse_Mail_receiver_check( int fd ){
char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1]; char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1];
uint32 char_id = 0; uint32 char_id = 0;
uint16 class_ = 0, base_level = 0; uint16 class_ = 0, base_level = 0;

View File

@ -4,9 +4,9 @@
#ifndef _INT_MAIL_SQL_H_ #ifndef _INT_MAIL_SQL_H_
#define _INT_MAIL_SQL_H_ #define _INT_MAIL_SQL_H_
#ifdef __cplusplus #include "../common/cbasetypes.h"
extern "C" { struct mail_message;
#endif
int mail_return_timer( int tid, unsigned int tick, int id, intptr_t data ); int mail_return_timer( int tid, unsigned int tick, int id, intptr_t data );
int mail_delete_timer( int tid, unsigned int tick, int id, intptr_t data ); int mail_delete_timer( int tid, unsigned int tick, int id, intptr_t data );
@ -20,8 +20,6 @@ void inter_mail_sql_final(void);
int mail_savemessage(struct mail_message* msg); int mail_savemessage(struct mail_message* msg);
void mapif_Mail_new(struct mail_message *msg); void mapif_Mail_new(struct mail_message *msg);
#ifdef __cplusplus
}
#endif
#endif /* _INT_MAIL_SQL_H_ */ #endif /* _INT_MAIL_SQL_H_ */

View File

@ -1,15 +1,19 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_mercenary.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h"
#include "inter.h"
#include <stdlib.h> #include "char.hpp"
#include "inter.hpp"
bool mercenary_owner_fromsql(uint32 char_id, struct mmo_charstatus *status) bool mercenary_owner_fromsql(uint32 char_id, struct mmo_charstatus *status)
{ {
@ -132,7 +136,7 @@ bool mapif_mercenary_delete(int merc_id)
return true; return true;
} }
static void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag)
{ {
int size = sizeof(struct s_mercenary) + 5; int size = sizeof(struct s_mercenary) + 5;
@ -144,20 +148,20 @@ static void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char
WFIFOSET(fd,size); WFIFOSET(fd,size);
} }
static void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc) void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc)
{ {
bool result = mapif_mercenary_save(merc); bool result = mapif_mercenary_save(merc);
mapif_mercenary_send(fd, merc, result); mapif_mercenary_send(fd, merc, result);
} }
static void mapif_parse_mercenary_load(int fd, int merc_id, uint32 char_id) void mapif_parse_mercenary_load(int fd, int merc_id, uint32 char_id)
{ {
struct s_mercenary merc; struct s_mercenary merc;
bool result = mapif_mercenary_load(merc_id, char_id, &merc); bool result = mapif_mercenary_load(merc_id, char_id, &merc);
mapif_mercenary_send(fd, &merc, result); mapif_mercenary_send(fd, &merc, result);
} }
static void mapif_mercenary_deleted(int fd, unsigned char flag) void mapif_mercenary_deleted(int fd, unsigned char flag)
{ {
WFIFOHEAD(fd,3); WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x3871; WFIFOW(fd,0) = 0x3871;
@ -165,13 +169,13 @@ static void mapif_mercenary_deleted(int fd, unsigned char flag)
WFIFOSET(fd,3); WFIFOSET(fd,3);
} }
static void mapif_parse_mercenary_delete(int fd, int merc_id) void mapif_parse_mercenary_delete(int fd, int merc_id)
{ {
bool result = mapif_mercenary_delete(merc_id); bool result = mapif_mercenary_delete(merc_id);
mapif_mercenary_deleted(fd, result); mapif_mercenary_deleted(fd, result);
} }
static void mapif_mercenary_saved(int fd, unsigned char flag) void mapif_mercenary_saved(int fd, unsigned char flag)
{ {
WFIFOHEAD(fd,3); WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x3872; WFIFOW(fd,0) = 0x3872;
@ -179,7 +183,7 @@ static void mapif_mercenary_saved(int fd, unsigned char flag)
WFIFOSET(fd,3); WFIFOSET(fd,3);
} }
static void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc) void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc)
{ {
bool result = mapif_mercenary_save(merc); bool result = mapif_mercenary_save(merc);
mapif_mercenary_saved(fd, result); mapif_mercenary_saved(fd, result);

View File

@ -4,11 +4,9 @@
#ifndef _INT_MERCENARY_SQL_H_ #ifndef _INT_MERCENARY_SQL_H_
#define _INT_MERCENARY_SQL_H_ #define _INT_MERCENARY_SQL_H_
#ifdef __cplusplus #include "../common/cbasetypes.h"
extern "C" {
#endif
struct s_mercenary; // struct s_mercenary;
int inter_mercenary_sql_init(void); int inter_mercenary_sql_init(void);
void inter_mercenary_sql_final(void); void inter_mercenary_sql_final(void);
@ -21,8 +19,5 @@ bool mercenary_owner_delete(uint32 char_id);
bool mapif_mercenary_delete(int merc_id); bool mapif_mercenary_delete(int merc_id);
#ifdef __cplusplus
}
#endif
#endif /* _INT_MERCENARY_SQL_H_ */ #endif /* _INT_MERCENARY_SQL_H_ */

View File

@ -1,6 +1,11 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_party.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/cbasetypes.h" #include "../common/cbasetypes.h"
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/malloc.h" #include "../common/malloc.h"
@ -9,12 +14,11 @@
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/mapindex.h" #include "../common/mapindex.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h"
#include "char_mapif.h"
#include "inter.h"
#include "int_party.h"
#include <stdlib.h> #include "char.hpp"
#include "char_mapif.hpp"
#include "inter.hpp"
struct party_data { struct party_data {
struct party party; struct party party;
@ -59,7 +63,7 @@ static int int_party_check_lv(struct party_data *p) {
return 1; return 1;
} }
//Calculates the state of a party. //Calculates the state of a party.
static void int_party_calc_state(struct party_data *p) void int_party_calc_state(struct party_data *p)
{ {
int i; int i;
p->min_lv = UINT_MAX; p->min_lv = UINT_MAX;
@ -382,7 +386,7 @@ int mapif_party_created(int fd,uint32 account_id,uint32 char_id,struct party *p)
} }
//Party information not found //Party information not found
static void mapif_party_noinfo(int fd, int party_id, uint32 char_id) void mapif_party_noinfo(int fd, int party_id, uint32 char_id)
{ {
WFIFOHEAD(fd, 12); WFIFOHEAD(fd, 12);
WFIFOW(fd,0) = 0x3821; WFIFOW(fd,0) = 0x3821;
@ -394,7 +398,7 @@ static void mapif_party_noinfo(int fd, int party_id, uint32 char_id)
} }
//Digest party information //Digest party information
static void mapif_party_info(int fd, struct party* p, uint32 char_id) void mapif_party_info(int fd, struct party* p, uint32 char_id)
{ {
unsigned char buf[8 + sizeof(struct party)]; unsigned char buf[8 + sizeof(struct party)];
WBUFW(buf,0) = 0x3821; WBUFW(buf,0) = 0x3821;
@ -552,7 +556,7 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
} }
// Party information request // Party information request
static void mapif_parse_PartyInfo(int fd, int party_id, uint32 char_id) void mapif_parse_PartyInfo(int fd, int party_id, uint32 char_id)
{ {
struct party_data *p; struct party_data *p;
p = inter_party_fromsql(party_id); p = inter_party_fromsql(party_id);

View File

@ -4,12 +4,10 @@
#ifndef _INT_PARTY_SQL_H_ #ifndef _INT_PARTY_SQL_H_
#define _INT_PARTY_SQL_H_ #define _INT_PARTY_SQL_H_
#ifdef __cplusplus #include "../common/cbasetypes.h"
extern "C" {
#endif
//Party Flags on what to save/delete. //Party Flags on what to save/delete.
enum { enum e_PartySaveWhatFlag {
PS_CREATE = 0x01, //Create a new party entry (index holds leader's info) PS_CREATE = 0x01, //Create a new party entry (index holds leader's info)
PS_BASIC = 0x02, //Update basic party info. PS_BASIC = 0x02, //Update basic party info.
PS_LEADER = 0x04, //Update party's leader PS_LEADER = 0x04, //Update party's leader
@ -18,7 +16,7 @@ enum {
PS_BREAK = 0x20, //Specify that this party must be deleted. PS_BREAK = 0x20, //Specify that this party must be deleted.
}; };
struct party; //struct party;
int inter_party_parse_frommap(int fd); int inter_party_parse_frommap(int fd);
int inter_party_sql_init(void); int inter_party_sql_init(void);
@ -28,8 +26,4 @@ int inter_party_charname_changed(int party_id, uint32 char_id, char *name);
int inter_party_CharOnline(uint32 char_id, int party_id); int inter_party_CharOnline(uint32 char_id, int party_id);
int inter_party_CharOffline(uint32 char_id, int party_id); int inter_party_CharOffline(uint32 char_id, int party_id);
#ifdef __cplusplus
}
#endif
#endif /* _INT_PARTY_SQL_H_ */ #endif /* _INT_PARTY_SQL_H_ */

View File

@ -1,6 +1,11 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_pet.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/socket.h" #include "../common/socket.h"
@ -8,10 +13,10 @@
#include "../common/showmsg.h" #include "../common/showmsg.h"
#include "../common/utils.h" #include "../common/utils.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h"
#include "inter.h"
#include <stdlib.h> #include "char.hpp"
#include "inter.hpp"
struct s_pet *pet_pt; struct s_pet *pet_pt;

View File

@ -4,13 +4,13 @@
#ifndef _INT_PET_SQL_H_ #ifndef _INT_PET_SQL_H_
#define _INT_PET_SQL_H_ #define _INT_PET_SQL_H_
#ifdef __cplusplus #include "../common/cbasetypes.h"
extern "C" {
#endif
struct s_pet; struct s_pet;
int inter_pet_init(void);
void inter_pet_sql_final(void); void inter_pet_sql_final(void);
int inter_pet_save(void);
int inter_pet_delete(int pet_id); int inter_pet_delete(int pet_id);
int inter_pet_parse_frommap(int fd); int inter_pet_parse_frommap(int fd);
@ -19,8 +19,6 @@ int inter_pet_sql_init(void);
int inter_pet_tosql(int pet_id, struct s_pet *p); int inter_pet_tosql(int pet_id, struct s_pet *p);
#ifdef __cplusplus
}
#endif
#endif /* _INT_PET_SQL_H_ */ #endif /* _INT_PET_SQL_H_ */

View File

@ -1,17 +1,19 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "int_quest.hpp"
#include <stdlib.h>
#include <string.h>
#include "../common/mmo.h" #include "../common/mmo.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/strlib.h" #include "../common/strlib.h"
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h" #include "char.hpp"
#include "inter.h" #include "inter.hpp"
#include "int_quest.h"
#include <stdlib.h>
/** /**
* Loads the entire questlog for a character. * Loads the entire questlog for a character.

View File

@ -4,15 +4,11 @@
#ifndef _QUEST_H_ #ifndef _QUEST_H_
#define _QUEST_H_ #define _QUEST_H_
#ifdef __cplusplus
extern "C" {
#endif
int inter_quest_parse_frommap(int fd); int inter_quest_parse_frommap(int fd);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -1,9 +1,14 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#pragma warning(disable:4800) #pragma warning(disable:4800) //forcing value to bool
#include "int_storage.hpp"
#include <stdlib.h>
#include <string.h>
//#include <string>
#include "int_storage.h"
#include "../common/malloc.h" #include "../common/malloc.h"
#include "../common/mmo.h" #include "../common/mmo.h"
@ -11,10 +16,8 @@
#include "../common/socket.h" #include "../common/socket.h"
#include "../common/strlib.h" // StringBuf #include "../common/strlib.h" // StringBuf
#include "../common/sql.h" #include "../common/sql.h"
#include "char.h" #include "char.hpp"
#include "inter.h" #include "inter.hpp"
#include <stdlib.h>
/** /**
* Check if storage ID is valid * Check if storage ID is valid
@ -64,7 +67,7 @@ const char *inter_premiumStorage_getPrintableName(uint8 id) {
* @param p: Inventory entries * @param p: Inventory entries
* @return 0 if success, or error count * @return 0 if success, or error count
*/ */
static int inventory_tosql(uint32 char_id, struct s_storage* p) int inventory_tosql(uint32 char_id, struct s_storage* p)
{ {
return char_memitemdata_to_sql(p->u.items_inventory, MAX_INVENTORY, char_id, TABLE_INVENTORY, p->stor_id); return char_memitemdata_to_sql(p->u.items_inventory, MAX_INVENTORY, char_id, TABLE_INVENTORY, p->stor_id);
} }
@ -75,7 +78,7 @@ static int inventory_tosql(uint32 char_id, struct s_storage* p)
* @param p: Storage entries * @param p: Storage entries
* @return 0 if success, or error count * @return 0 if success, or error count
*/ */
static int storage_tosql(uint32 account_id, struct s_storage* p) int storage_tosql(uint32 account_id, struct s_storage* p)
{ {
return char_memitemdata_to_sql(p->u.items_storage, MAX_STORAGE, account_id, TABLE_STORAGE, p->stor_id); return char_memitemdata_to_sql(p->u.items_storage, MAX_STORAGE, account_id, TABLE_STORAGE, p->stor_id);
} }
@ -86,7 +89,7 @@ static int storage_tosql(uint32 account_id, struct s_storage* p)
* @param p: Cart entries * @param p: Cart entries
* @return 0 if success, or error count * @return 0 if success, or error count
*/ */
static int cart_tosql(uint32 char_id, struct s_storage* p) int cart_tosql(uint32 char_id, struct s_storage* p)
{ {
return char_memitemdata_to_sql(p->u.items_cart, MAX_CART, char_id, TABLE_CART, p->stor_id); return char_memitemdata_to_sql(p->u.items_cart, MAX_CART, char_id, TABLE_CART, p->stor_id);
} }
@ -97,7 +100,7 @@ static int cart_tosql(uint32 char_id, struct s_storage* p)
* @param p: Inventory list to save the entries * @param p: Inventory list to save the entries
* @return True if success, False if failed * @return True if success, False if failed
*/ */
static bool inventory_fromsql(uint32 char_id, struct s_storage* p) bool inventory_fromsql(uint32 char_id, struct s_storage* p)
{ {
return char_memitemdata_from_sql( p, MAX_INVENTORY, char_id, TABLE_INVENTORY, p->stor_id ); return char_memitemdata_from_sql( p, MAX_INVENTORY, char_id, TABLE_INVENTORY, p->stor_id );
} }
@ -108,7 +111,7 @@ static bool inventory_fromsql(uint32 char_id, struct s_storage* p)
* @param p: Cart list to save the entries * @param p: Cart list to save the entries
* @return True if success, False if failed * @return True if success, False if failed
*/ */
static bool cart_fromsql(uint32 char_id, struct s_storage* p) bool cart_fromsql(uint32 char_id, struct s_storage* p)
{ {
return char_memitemdata_from_sql( p, MAX_CART, char_id, TABLE_CART, p->stor_id ); return char_memitemdata_from_sql( p, MAX_CART, char_id, TABLE_CART, p->stor_id );
} }
@ -120,7 +123,7 @@ static bool cart_fromsql(uint32 char_id, struct s_storage* p)
* @param stor_id: Storage ID * @param stor_id: Storage ID
* @return True if success, False if failed * @return True if success, False if failed
*/ */
static bool storage_fromsql(uint32 account_id, struct s_storage* p) bool storage_fromsql(uint32 account_id, struct s_storage* p)
{ {
return char_memitemdata_from_sql( p, MAX_STORAGE, account_id, TABLE_STORAGE, p->stor_id ); return char_memitemdata_from_sql( p, MAX_STORAGE, account_id, TABLE_STORAGE, p->stor_id );
} }
@ -148,7 +151,7 @@ bool guild_storage_fromsql(int guild_id, struct s_storage* p)
return char_memitemdata_from_sql( p, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE, p->stor_id ); return char_memitemdata_from_sql( p, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE, p->stor_id );
} }
static void inter_storage_checkDB(void) { void inter_storage_checkDB(void) {
// Checking storage tables // Checking storage tables
for (auto storage_table : interserv_config.storages) { for (auto storage_table : interserv_config.storages) {
if (SQL_ERROR == Sql_Query(sql_handle, "SELECT `id`,`account_id`,`nameid`,`amount`,`equip`,`identify`,`refine`," if (SQL_ERROR == Sql_Query(sql_handle, "SELECT `id`,`account_id`,`nameid`,`amount`,`equip`,`identify`,`refine`,"
@ -261,7 +264,7 @@ bool mapif_parse_SaveGuildStorage(int fd)
* IZ 0x3856 <account_id>.L <guild_id>.W * IZ 0x3856 <account_id>.L <guild_id>.W
* Tells map-server if the process if complete, unlock the guild storage * Tells map-server if the process if complete, unlock the guild storage
*/ */
static void mapif_itembound_ack(int fd, int account_id, int guild_id) void mapif_itembound_ack(int fd, int account_id, int guild_id)
{ {
WFIFOHEAD(fd,8); WFIFOHEAD(fd,8);
WFIFOW(fd,0) = 0x3856; WFIFOW(fd,0) = 0x3856;
@ -283,7 +286,7 @@ static void mapif_itembound_ack(int fd, int account_id, int guild_id)
* @param count * @param count
* @author [Cydh] * @author [Cydh]
*/ */
static void mapif_itembound_store2gstorage(int fd, int guild_id, struct item items[], unsigned short count) { void mapif_itembound_store2gstorage(int fd, int guild_id, struct item items[], unsigned short count) {
int size = 8 + sizeof(struct item) * MAX_INVENTORY, i; int size = 8 + sizeof(struct item) * MAX_INVENTORY, i;
WFIFOHEAD(fd, size); WFIFOHEAD(fd, size);
@ -450,7 +453,7 @@ bool mapif_parse_itembound_retrieve(int fd)
* @param entries Inventory/cart/storage entries * @param entries Inventory/cart/storage entries
* @param result * @param result
*/ */
static void mapif_storage_data_loaded(int fd, uint32 account_id, char type, struct s_storage entries, bool result) { void mapif_storage_data_loaded(int fd, uint32 account_id, char type, struct s_storage entries, bool result) {
uint16 size = sizeof(struct s_storage) + 10; uint16 size = sizeof(struct s_storage) + 10;
WFIFOHEAD(fd, size); WFIFOHEAD(fd, size);

View File

@ -6,9 +6,6 @@
#include "../common/cbasetypes.h" #include "../common/cbasetypes.h"
#ifdef __cplusplus
extern "C" {
#endif
struct s_storage; struct s_storage;
@ -24,8 +21,5 @@ bool inter_storage_parse_frommap(int fd);
bool guild_storage_tosql(int guild_id, struct s_storage *p); bool guild_storage_tosql(int guild_id, struct s_storage *p);
#ifdef __cplusplus
}
#endif
#endif /* _INT_STORAGE_SQL_H_ */ #endif /* _INT_STORAGE_SQL_H_ */

View File

@ -1,37 +1,41 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "../common/mmo.h" #include "inter.hpp"
#include "../common/cbasetypes.h"
#include "../common/malloc.h"
#include "../common/strlib.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/timer.h"
#include "char.h"
#include "char_logif.h"
#include "char_mapif.h"
#include "inter.h"
#include "int_party.h"
#include "int_guild.h"
#include "int_storage.h"
#include "int_pet.h"
#include "int_homun.h"
#include "int_mercenary.h"
#include "int_mail.h"
#include "int_auction.h"
#include "int_quest.h"
#include "int_elemental.h"
#include "int_clan.h"
#include "int_achievement.h"
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h> // for stat/lstat/fstat - [Dekamaster/Ultimate GM Tool]
#include <yaml-cpp/yaml.h> #include <yaml-cpp/yaml.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> // for stat/lstat/fstat - [Dekamaster/Ultimate GM Tool] #include "../common/cbasetypes.h"
#include "../common/malloc.h"
#include "../common/strlib.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/timer.h"
#include "char.hpp"
#include "char_logif.hpp"
#include "char_mapif.hpp"
#include "inter.hpp"
#include "int_party.hpp"
#include "int_guild.hpp"
#include "int_storage.hpp"
#include "int_pet.hpp"
#include "int_homun.hpp"
#include "int_mercenary.hpp"
#include "int_mail.hpp"
#include "int_auction.hpp"
#include "int_quest.hpp"
#include "int_elemental.hpp"
#include "int_clan.hpp"
#include "int_achievement.hpp"
#define WISDATA_TTL (60*1000) //Wis data Time To Live (60 seconds) #define WISDATA_TTL (60*1000) //Wis data Time To Live (60 seconds)
@ -412,7 +416,7 @@ void inter_to_fd(int fd, int u_fd, int aid, char* msg, ...) {
* @param acc_id : id of player found * @param acc_id : id of player found
* @param acc_name : name of player found * @param acc_name : name of player found
*/ */
static void mapif_acc_info_ack(int fd, int u_fd, int acc_id, const char* acc_name){ void mapif_acc_info_ack(int fd, int u_fd, int acc_id, const char* acc_name){
WFIFOHEAD(fd,10 + NAME_LENGTH); WFIFOHEAD(fd,10 + NAME_LENGTH);
WFIFOW(fd,0) = 0x3808; WFIFOW(fd,0) = 0x3808;
WFIFOL(fd,2) = u_fd; WFIFOL(fd,2) = u_fd;
@ -772,7 +776,7 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type)
/*========================================== /*==========================================
* read config file * read config file
*------------------------------------------*/ *------------------------------------------*/
static int inter_config_read(const char* cfgName) int inter_config_read(const char* cfgName)
{ {
char line[1024]; char line[1024];
FILE* fp; FILE* fp;
@ -838,7 +842,7 @@ int inter_log(char* fmt, ...)
return 0; return 0;
} }
static void yaml_invalid_warning(const char* fmt, YAML::Node &node, std::string &file) { void yaml_invalid_warning(const char* fmt, YAML::Node &node, std::string &file) {
YAML::Emitter out; YAML::Emitter out;
out << node; out << node;
ShowWarning(fmt, file.c_str()); ShowWarning(fmt, file.c_str());
@ -848,7 +852,7 @@ static void yaml_invalid_warning(const char* fmt, YAML::Node &node, std::string
/** /**
* Read inter config file * Read inter config file
**/ **/
static void inter_config_readConf(void) { void inter_config_readConf(void) {
std::vector<std::string> directories = { "conf/", "conf/import/" }; std::vector<std::string> directories = { "conf/", "conf/import/" };
static const std::string file_name(interserv_config.cfgFile); static const std::string file_name(interserv_config.cfgFile);
@ -927,7 +931,7 @@ void inter_config_finalConf(void) {
} }
static void inter_config_defaults(void) { void inter_config_defaults(void) {
interserv_config.cfgFile = "inter_server.yml"; interserv_config.cfgFile = "inter_server.yml";
} }
@ -1328,7 +1332,7 @@ int mapif_parse_RegistryRequest(int fd)
return 1; return 1;
} }
static void mapif_namechange_ack(int fd, uint32 account_id, uint32 char_id, int type, int flag, char *name) void mapif_namechange_ack(int fd, uint32 account_id, uint32 char_id, int type, int flag, char *name)
{ {
WFIFOHEAD(fd, NAME_LENGTH+13); WFIFOHEAD(fd, NAME_LENGTH+13);
WFIFOW(fd, 0) = 0x3806; WFIFOW(fd, 0) = 0x3806;

View File

@ -5,22 +5,20 @@
#define _INTER_SQL_H_ #define _INTER_SQL_H_
#include "../common/cbasetypes.h" #include "../common/cbasetypes.h"
#include "../common/conf.h" //#include "../common/conf.h"
#include "../common/mmo.h" //#include "../common/mmo.h"
#include "../common/sql.h" #include "../common/sql.h"
#ifdef __cplusplus // C codes can't see this
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
extern "C" {
struct s_storage_table;
struct Inter_Config { struct Inter_Config {
std::string cfgFile; ///< Inter-Config file std::string cfgFile; ///< Inter-Config file
std::unordered_map< uint8, std::shared_ptr<s_storage_table> > storages; ///< Storage name & table information std::unordered_map< uint8, std::shared_ptr<s_storage_table> > storages; ///< Storage name & table information
}; };
#endif
extern struct Inter_Config interserv_config; extern struct Inter_Config interserv_config;
@ -45,8 +43,5 @@ extern Sql* lsql_handle;
void inter_savereg(uint32 account_id, uint32 char_id, const char *key, unsigned int index, intptr_t val, bool is_string); void inter_savereg(uint32 account_id, uint32 char_id, const char *key, unsigned int index, intptr_t val, bool is_string);
int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type); int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type);
#ifdef __cplusplus
}
#endif
#endif /* _INTER_SQL_H_ */ #endif /* _INTER_SQL_H_ */