conf/maps.conf | 23 ++++++
db/map_index.txt | 23 ++++++
npc/scripts.conf | 41 ++++++----
src/common/mmo.h | 2 +-
src/map/atcommand.c | 7 ++
src/map/battle.c | 20 ++++-
src/map/battle.h | 4 +
src/map/battleground.c | 155 +++++++++++++++++++++++++++++++++--
src/map/battleground.h | 52 ++++++++++++
src/map/chrif.c | 1 +
src/map/chrif.h | 1 +
src/map/clif.c | 151 +++++++++++++++++++++++++++++++---
src/map/clif.h | 9 ++-
src/map/guild.c | 6 +-
src/map/map.c | 7 ++
src/map/map.h | 13 ++-
src/map/mob.c | 5 ++
src/map/mob.h | 16 +++-
src/map/npc.c | 2 +
src/map/npc.h | 5 ++
src/map/pc.c | 27 ++++++-
src/map/pc.h | 18 ++++-
src/map/pc_groups.c | 2 +
src/map/script.c | 214 +++++++++++++++++++++++++++++++++++++++++++++----
src/map/skill.c | 21 ++++-
src/map/unit.c | 9 ++-
26 files changed, 774 insertions(+), 60 deletions(-)
diff --git a/conf/maps.conf b/conf/maps.conf
index 458c9fe..924bdb4 100644
--- a/conf/maps.conf
+++ b/conf/maps.conf
@@ -1223,3 +1223,26 @@ map: c_tower3_
//map: tank_test
//map: tank_test2
//map: test
+map: bat_a03
+map: bat_a04
+map: bat_a05
+map: bat_b03
+map: bat_b04
+map: bat_b05
+map: schg_cas06
+map: schg_cas07
+map: schg_cas08
+map: arug_cas06
+map: arug_cas07
+map: arug_cas08
+map: rush_cas01
+map: rush_cas02
+map: rush_cas03
+map: rush_cas04
+map: bat_c03
+map: bat_c04
+map: bat_c05
+map: bat_c06
+map: bat_c07
+map: bat_c08
+map: region_8
\ No newline at end of file
diff --git a/db/map_index.txt b/db/map_index.txt
index 7eafc7f..47687df 100644
--- a/db/map_index.txt
+++ b/db/map_index.txt
@@ -1003,3 +1003,26 @@ c_tower3_
//
//mymap 1250
//mymap-2
+bat_a03 1250
+bat_a04
+bat_a05
+bat_b03
+bat_b04
+bat_b05
+schg_cas06
+schg_cas07
+schg_cas08
+arug_cas06
+arug_cas07
+arug_cas08
+rush_cas01
+rush_cas02
+rush_cas03
+rush_cas04
+bat_c03
+bat_c04
+bat_c05
+bat_c06
+bat_c07
+bat_c08
+region_8
\ No newline at end of file
diff --git a/npc/scripts.conf b/npc/scripts.conf
index d81d76e..51c7b90 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -18,21 +18,34 @@ npc: npc/airports/yuno.txt
// --------------------- Battle Grounds -------------------------
// - Flavius ----------------------------------------------------
-npc: npc/battleground/flavius/flavius_enter.txt
-npc: npc/battleground/flavius/flavius01.txt
-npc: npc/battleground/flavius/flavius02.txt
-// - Kreiger Von Midgard ----------------------------------------
-npc: npc/battleground/kvm/kvm_enter.txt
-npc: npc/battleground/kvm/kvm_item_pay.txt
-npc: npc/battleground/kvm/kvm01.txt
-npc: npc/battleground/kvm/kvm02.txt
-npc: npc/battleground/kvm/kvm03.txt
-// - Tierra Gorge -----------------------------------------------
-npc: npc/battleground/tierra/tierra_enter.txt
-npc: npc/battleground/tierra/tierra01.txt
-npc: npc/battleground/tierra/tierra02.txt
-// --------------------------------------------------------------
+//npc: npc/battleground/flavius/flavius_enter.txt
+//npc: npc/battleground/flavius/flavius01.txt
+//npc: npc/battleground/flavius/flavius02.txt
+//// - Kreiger Von Midgard ----------------------------------------
+//npc: npc/battleground/kvm/kvm_enter.txt
+//npc: npc/battleground/kvm/kvm_item_pay.txt
+//npc: npc/battleground/kvm/kvm01.txt
+//npc: npc/battleground/kvm/kvm02.txt
+//npc: npc/battleground/kvm/kvm03.txt
+//// - Tierra Gorge -----------------------------------------------
+//npc: npc/battleground/tierra/tierra_enter.txt
+//npc: npc/battleground/tierra/tierra01.txt
+//npc: npc/battleground/tierra/tierra02.txt
+//// --------------------------------------------------------------
+//npc: npc/battleground/bg_common.txt
+
+// --------------------- Custom Battle Grounds -------------------------
npc: npc/battleground/bg_common.txt
+npc: npc/battleground/bg_conquest.txt
+npc: npc/battleground/bg_ffa.txt
+npc: npc/battleground/bg_flavius_ctf.txt
+npc: npc/battleground/bg_flavius_sc.txt
+npc: npc/battleground/bg_flavius_td.txt
+npc: npc/battleground/bg_rush.txt
+npc: npc/battleground/bg_tierra_boss.txt
+npc: npc/battleground/bg_tierra_dom.txt
+npc: npc/battleground/bg_tierra_eoe.txt
+npc: npc/battleground/bg_tierra_ti.txt
// --------------------------- Cities ---------------------------
npc: npc/cities/alberta.txt
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 597b251..fc5eb49 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -49,7 +49,7 @@
// 20120307 - 2012-03-07aRagexeRE+ - 0x970
#ifndef PACKETVER
- #define PACKETVER 20141022
+ #define PACKETVER 20130807
#endif // PACKETVER
//Uncomment the following line if your client is ragexeRE instead of ragexe (required because of conflicting packets in ragexe vs ragexeRE).
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index dac51d1..a02e65a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -56,6 +56,7 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
struct atcommand_interface atcommand_s;
static char atcmd_output[CHAT_SIZE_MAX];
@@ -154,6 +155,9 @@ static inline const char* atcommand_help_string(AtCommandInfo *info) {
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/atcommand_0.txt"
+#endif
/*==========================================
* @send (used for testing packet sends from the client)
@@ -9382,6 +9386,9 @@ void atcommand_basecommands(void) {
* Command reference list, place the base of your commands here
**/
AtCommandInfo atcommand_base[] = {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/atcommand_1.txt"
+#endif
ACMD_DEF2("warp", mapmove),
ACMD_DEF(where),
ACMD_DEF(jumpto),
diff --git a/src/map/battle.c b/src/map/battle.c
index 73b563d..8d13ed1 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -41,6 +41,7 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
struct Battle_Config battle_config;
struct battle_interface battle_s;
@@ -6349,24 +6350,38 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
}
if( flag&(BCT_PARTY|BCT_ENEMY) ) {
int s_party = status->get_party_id(s_bl);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battle_0.txt"
+#else
int s_guild = status->get_guild_id(s_bl);
-
+#endif
if( s_party && s_party == status->get_party_id(t_bl)
&& !(map->list[m].flag.pvp && map->list[m].flag.pvp_noparty)
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battle_1.txt"
+#else
&& !(map_flag_gvg(m) && map->list[m].flag.gvg_noparty && !( s_guild && s_guild == status->get_guild_id(t_bl) ))
&& (!map->list[m].flag.battleground || sbg_id == tbg_id) )
+#endif
state |= BCT_PARTY;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battle_2.txt"
+#endif
else
state |= BCT_ENEMY;
}
if( flag&(BCT_GUILD|BCT_ENEMY) ) {
int s_guild = status->get_guild_id(s_bl);
int t_guild = status->get_guild_id(t_bl);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battle_3.txt"
+#else
if( !(map->list[m].flag.pvp && map->list[m].flag.pvp_noguild)
&& s_guild && t_guild
&& (s_guild == t_guild || (!(flag&BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild)))
&& (!map->list[m].flag.battleground || sbg_id == tbg_id) )
state |= BCT_GUILD;
+#endif
else
state |= BCT_ENEMY;
}
@@ -6447,6 +6462,9 @@ bool battle_check_range(struct block_list *src, struct block_list *bl, int range
int min;
int max;
} battle_data[] = {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battle_4.txt"
+#endif
{ "warp_point_debug", &battle_config.warp_point_debug, 0, 0, 1, },
{ "enable_critical", &battle_config.enable_critical, BL_PC, BL_NUL, BL_ALL, },
{ "mob_critical_rate", &battle_config.mob_critical_rate, 100, 0, INT_MAX, },
diff --git a/src/map/battle.h b/src/map/battle.h
index c44e3e1..844c729 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -4,6 +4,7 @@
#ifndef MAP_BATTLE_H
#define MAP_BATTLE_H
+#include "../mods/config/luna.h"
#include "map.h" //ELE_MAX
#include "../common/cbasetypes.h"
@@ -436,6 +437,9 @@ struct Battle_Config {
int bg_update_interval;
int bg_flee_penalty;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleh_0.txt"
+#endif
// rAthena
int max_third_parameter;
int max_baby_third_parameter;
diff --git a/src/map/battleground.c b/src/map/battleground.c
index f713151..8a44802 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -16,12 +16,15 @@
#include "mapreg.h"
#include "mercenary.h"
#include "mob.h" // struct mob_data
+#include "elemental.h"
+#include "quest.h"
#include "npc.h"
#include "party.h"
#include "pc.h"
#include "pet.h"
#include "../common/cbasetypes.h"
#include "../common/conf.h"
+#include "../common/utils.h"
#include "../common/malloc.h"
#include "../common/nullpo.h"
#include "../common/showmsg.h"
@@ -31,6 +34,10 @@
struct battleground_interface bg_s;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_0.txt"
+#endif
+
/// Search a BG Team using bg_id
struct battleground_data* bg_team_search(int bg_id) {
if( !bg_id ) return NULL;
@@ -45,7 +52,11 @@ struct map_session_data* bg_getavailablesd(struct battleground_data *bgd) {
}
/// Deletes BG Team from db
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_1.txt"
+#else
bool bg_team_delete(int bg_id) {
+#endif
int i;
struct map_session_data *sd;
struct battleground_data *bgd = bg->team_search(bg_id);
@@ -57,8 +68,15 @@ bool bg_team_delete(int bg_id) {
bg->send_dot_remove(sd);
sd->bg_id = 0;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_2.txt"
+#endif
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_3.txt"
+#else
idb_remove(bg->team_db, bg_id);
+#endif
return true;
}
@@ -67,14 +85,25 @@ bool bg_team_warp(int bg_id, unsigned short map_index, short x, short y) {
int i;
struct battleground_data *bgd = bg->team_search(bg_id);
if( bgd == NULL ) return false;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_4.txt"
+#endif
for( i = 0; i < MAX_BG_MEMBERS; i++ )
if( bgd->members[i].sd != NULL ) pc->setpos(bgd->members[i].sd, map_index, x, y, CLR_TELEPORT);
return true;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_5.txt"
+#endif
+
void bg_send_dot_remove(struct map_session_data *sd) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_6.txt"
+#else
if( sd && sd->bg_id )
clif->bg_xy_remove(sd);
+#endif
}
/// Player joins team
@@ -87,8 +116,13 @@ bool bg_team_join(int bg_id, struct map_session_data *sd) {
ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd == NULL);
if( i == MAX_BG_MEMBERS ) return false; // No free slots
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_7.txt"
+#endif
sd->bg_id = bg_id;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_8.txt"
+#endif
bgd->members[i].sd = sd;
bgd->members[i].x = sd->bl.x;
bgd->members[i].y = sd->bl.y;
@@ -102,14 +136,26 @@ bool bg_team_join(int bg_id, struct map_session_data *sd) {
} else
memcpy(&bgd->members[i].source,&sd->status.last_point,sizeof(struct point));
bgd->count++;
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_9.txt"
+#endif
guild->send_dot_remove(sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/battleground_0.txt"
+#endif
for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/battleground_1.txt"
+#endif
if( (pl_sd = bgd->members[i].sd) != NULL && pl_sd != sd )
clif->hpmeter_single(sd->fd, pl_sd->bl.id, pl_sd->battle_status.hp, pl_sd->battle_status.max_hp);
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/battleground_2.txt"
+#endif
clif->bg_hp(sd);
clif->bg_xy(sd);
return true;
@@ -120,12 +166,27 @@ int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) {
int i, bg_id;
struct battleground_data *bgd;
char output[128];
-
+ struct guild *g;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_10.txt"
+#endif
if( sd == NULL || !sd->bg_id )
return 0;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/battleground_3.txt"
+#endif
bg->send_dot_remove(sd);
bg_id = sd->bg_id;
sd->bg_id = 0;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_11.txt"
+#endif
+
+
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/battleground_4.txt"
+#endif
if( (bgd = bg->team_search(bg_id)) == NULL )
return 0;
@@ -137,9 +198,15 @@ int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) {
pc->setpos(sd,bgd->members[i].source.map, bgd->members[i].source.x, bgd->members[i].source.y, CLR_OUTSIGHT);
}
memset(&bgd->members[i], 0, sizeof(bgd->members[0]));
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_12.txt"
+#endif
}
if( --bgd->count != 0 ) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_13.txt"
+#endif
switch( flag ) {
default:
case BGTL_QUIT:
@@ -149,9 +216,15 @@ int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) {
sprintf(output, "Server : %s is leaving the battlefield...", sd->status.name);
break;
case BGTL_AFK:
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_14.txt"
+#endif
sprintf(output, "Server : %s has been afk-kicked from the battlefield...", sd->status.name);
break;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/battleground_5.txt"
+#endif
clif->bg_message(bgd, 0, "Server", output, strlen(output) + 1);
}
@@ -177,14 +250,27 @@ bool bg_member_respawn(struct map_session_data *sd) {
return true; // Warped
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_15.txt"
+#else
int bg_create(unsigned short map_index, short rx, short ry, const char *ev, const char *dev) {
+#endif
struct battleground_data *bgd;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_16.txt"
+#else
bg->team_counter++;
+#endif
CREATE(bgd, struct battleground_data, 1);
bgd->bg_id = bg->team_counter;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_17.txt"
+#endif
bgd->count = 0;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_18.txt"
+#endif
bgd->mapindex = map_index;
bgd->x = rx;
bgd->y = ry;
@@ -192,6 +278,9 @@ int bg_create(unsigned short map_index, short rx, short ry, const char *ev, cons
safestrncpy(bgd->die_event, dev, sizeof(bgd->die_event));
memset(&bgd->members, 0, sizeof(bgd->members));
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_19.txt"
+#endif
idb_put(bg->team_db, bg->team_counter, bgd);
return bgd->bg_id;
@@ -199,6 +288,9 @@ int bg_create(unsigned short map_index, short rx, short ry, const char *ev, cons
int bg_team_get_id(struct block_list *bl) {
nullpo_ret(bl);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_20.txt"
+#endif
switch( bl->type ) {
case BL_PC:
return ((TBL_PC*)bl)->bg_id;
@@ -222,8 +314,14 @@ int bg_team_get_id(struct block_list *bl) {
if( ((TBL_MER*)bl)->master )
return ((TBL_MER*)bl)->master->bg_id;
break;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_21.txt"
+#endif
case BL_SKILL:
return ((TBL_SKILL*)bl)->group->bg_id;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_22.txt"
+#endif
}
return 0;
@@ -245,25 +343,45 @@ bool bg_send_message(struct map_session_data *sd, const char *mes, int len) {
int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) {
struct battleground_data *bgd = DB->data2ptr(data);
struct map_session_data *sd;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_23.txt"
+#else
int i;
+#endif
nullpo_ret(bgd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_24.txt"
+#endif
for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
if( (sd = bgd->members[i].sd) == NULL )
continue;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_25.txt"
+#endif
if( sd->bl.x != bgd->members[i].x || sd->bl.y != bgd->members[i].y ) { // xy update
bgd->members[i].x = sd->bl.x;
bgd->members[i].y = sd->bl.y;
clif->bg_xy(sd);
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_26.txt"
+#endif
}
return 0;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_27.txt"
+#else
int bg_send_xy_timer(int tid, int64 tick, int id, intptr_t data) {
+#endif
bg->team_db->foreach(bg->team_db, bg->send_xy_timer_sub, tick);
return 0;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_28.txt"
+#endif
+
enum bg_queue_types bg_str2teamtype (const char *str) {
char temp[200], *parse;
enum bg_queue_types type = BGQT_INVALID;
@@ -860,16 +978,28 @@ void do_init_battleground(bool minimal) {
return;
bg->team_db = idb_alloc(DB_OPT_RELEASE_DATA);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_29.txt"
+#endif
timer->add_func_list(bg->send_xy_timer, "bg_send_xy_timer");
timer->add_interval(timer->gettick() + battle_config.bg_update_interval, bg->send_xy_timer, 0, 0, battle_config.bg_update_interval);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_30.txt"
+#endif
bg->config_read();
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_31.txt"
+#endif
+
void do_final_battleground(void) {
int i;
db_destroy(bg->team_db);
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_32.txt"
+#endif
for( i = 0; i < bg->arenas; i++ ) {
if( bg->arena[i] )
aFree(bg->arena[i]);
@@ -907,8 +1037,15 @@ void battleground_defaults(void) {
bg->match_over = bg_match_over;
bg->queue_check = bg_queue_check;
bg->team_search = bg_team_search;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_33.txt"
+#endif
bg->getavailablesd = bg_getavailablesd;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_34.txt"
+#else
bg->team_delete = bg_team_delete;
+#endif
bg->team_warp = bg_team_warp;
bg->send_dot_remove = bg_send_dot_remove;
bg->team_join = bg_team_join;
@@ -917,9 +1054,15 @@ void battleground_defaults(void) {
bg->create = bg_create;
bg->team_get_id = bg_team_get_id;
bg->send_message = bg_send_message;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_35.txt"
+#endif
bg->send_xy_timer_sub = bg_send_xy_timer_sub;
bg->send_xy_timer = bg_send_xy_timer;
bg->afk_timer = bg_afk_timer;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battleground_36.txt"
+#endif
/* */
bg->str2teamtype = bg_str2teamtype;
/* */
diff --git a/src/map/battleground.h b/src/map/battleground.h
index c1d3be0..49d9195 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -12,7 +12,11 @@
/**
* Defines
**/
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_0.txt"
+#else
#define MAX_BG_MEMBERS 30
+#endif
#define BG_DELAY_VAR_LENGTH 30
/**
@@ -35,19 +39,40 @@ enum bg_team_leave_type {
struct battleground_member_data {
unsigned short x, y;
struct map_session_data *sd;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_1.txt"
+#else
unsigned afk : 1;
+#endif
struct point source;/* where did i come from before i join? */
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_2.txt"
+#endif
};
struct battleground_data {
unsigned int bg_id;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_3.txt"
+#else
unsigned char count;
+#endif
struct battleground_member_data members[MAX_BG_MEMBERS];
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_4.txt"
+#endif
// BG Cementery
unsigned short mapindex, x, y;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_5.txt"
+#else
// Logout Event
+#endif
char logout_event[EVENT_NAME_LENGTH];
char die_event[EVENT_NAME_LENGTH];
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_6.txt"
+#endif
};
struct bg_arena {
@@ -71,6 +96,10 @@ struct bg_arena {
enum bg_queue_types allowed_types;
};
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_7.txt"
+#endif
+
struct battleground_interface {
bool queue_on;
/* */
@@ -85,6 +114,7 @@ struct battleground_interface {
/* */
void (*init) (bool minimal);
void (*final) (void);
+ struct battleground_data* (*bg_team_search)(int bg_id);
/* */
struct bg_arena *(*name2arena) (char *name);
void (*queue_add) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
@@ -99,25 +129,47 @@ struct battleground_interface {
void (*match_over) (struct bg_arena *arena, bool canceled);
void (*queue_check) (struct bg_arena *arena);
struct battleground_data* (*team_search) (int bg_id);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_8.txt"
+#endif
struct map_session_data* (*getavailablesd) (struct battleground_data *bgd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_9.txt"
+#else
bool (*team_delete) (int bg_id);
+#endif
bool (*team_warp) (int bg_id, unsigned short map_index, short x, short y);
void (*send_dot_remove) (struct map_session_data *sd);
bool (*team_join) (int bg_id, struct map_session_data *sd);
int (*team_leave) (struct map_session_data *sd, enum bg_team_leave_type flag);
bool (*member_respawn) (struct map_session_data *sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_10.txt"
+#else
int (*create) (unsigned short map_index, short rx, short ry, const char *ev, const char *dev);
+#endif
int (*team_get_id) (struct block_list *bl);
bool (*send_message) (struct map_session_data *sd, const char *mes, int len);
int (*send_xy_timer_sub) (DBKey key, DBData *data, va_list ap);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_11.txt"
+#else
int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data);
+#endif
int (*afk_timer) (int tid, int64 tick, int id, intptr_t data);
/* */
enum bg_queue_types (*str2teamtype) (const char *str);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_12.txt"
+#endif
/* */
void (*config_read) (void);
};
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/battlegroundh_13.txt"
+#endif
+
struct battleground_interface *bg;
void battleground_defaults(void);
diff --git a/src/map/chrif.c b/src/map/chrif.c
index c78b343..cc5e9ac 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -38,6 +38,7 @@
#include "../common/strlib.h"
#include "../common/timer.h"
+#include "../mods/config/luna.h"
struct chrif_interface chrif_s;
//Used Packets:
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 11baaf5..90f64ad 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -5,6 +5,7 @@
#ifndef MAP_CHRIF_H
#define MAP_CHRIF_H
+#include "../mods/config/luna.h"
#include <time.h>
#include "map.h" //TBL_stuff
diff --git a/src/map/clif.c b/src/map/clif.c
index 7ca37fa..13680c9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -28,6 +28,7 @@
#include "log.h"
#include "mail.h"
#include "map.h"
+#include "../mods/config/luna.h"
#include "mercenary.h"
#include "mob.h"
#include "npc.h"
@@ -1352,8 +1353,12 @@ bool clif_spawn(struct block_list *bl)
clif->specialeffect(bl,423,AREA);
else if(sd->state.size==SZ_MEDIUM)
clif->specialeffect(bl,421,AREA);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_0.txt"
+#else
if( sd->bg_id && map->list[sd->bl.m].flag.battleground )
clif->sendbgemblem_area(sd);
+#endif
for( i = 0; i < sd->sc_display_count; i++ ) {
clif->sc_load(&sd->bl, sd->bl.id,AREA,status->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3);
}
@@ -4325,8 +4330,12 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
clif->specialeffect_single(bl,423,sd->fd);
else if(tsd->state.size==SZ_MEDIUM)
clif->specialeffect_single(bl,421,sd->fd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_1.txt"
+#else
if( tsd->bg_id && map->list[tsd->bl.m].flag.battleground )
clif->sendbgemblem_single(sd->fd,tsd);
+#endif
if ( tsd->status.robe )
clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF);
}
@@ -7315,6 +7324,10 @@ void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g)
nullpo_retv(sd);
nullpo_retv(g);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_2.txt"
+#endif
+
fd=sd->fd;
ps=guild->getposition(g,sd);
WFIFOHEAD(fd,packet_len(0x16c));
@@ -7432,12 +7445,23 @@ void clif_guild_masterormember(struct map_session_data *sd)
void clif_guild_basicinfo(struct map_session_data *sd) {
int fd;
struct guild *g;
+#ifdef BGLUNA_M // Judas BG
+#include "../mods/Brenth/BG/v_00/clif_3.txt"
+#endif
nullpo_retv(sd);
fd = sd->fd;
+#ifdef BGLUNA_M // Judas BG
+#include "../mods/Brenth/BG/v_00/clif_4.txt"
+#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_5.txt"
+#else
if( (g = sd->guild) == NULL )
return;
+#endif
WFIFOHEAD(fd,packet_len(0x1b6));
WFIFOW(fd, 0)=0x1b6;//0x150;
@@ -7470,8 +7494,16 @@ void clif_guild_allianceinfo(struct map_session_data *sd)
struct guild *g;
nullpo_retv(sd);
+#ifdef BGLUNA_M // Judas BG
+#include "../mods/Brenth/BG/v_00/clif_6.txt"
+#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_7.txt"
+#else
if( (g = sd->guild) == NULL )
return;
+#endif
fd = sd->fd;
WFIFOHEAD(fd, MAX_GUILDALLIANCE * 32 + 4);
@@ -7506,6 +7538,9 @@ void clif_guild_memberlist(struct map_session_data *sd)
if( (fd = sd->fd) == 0 )
return;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_8.txt"
+#endif
if( (g = sd->guild) == NULL )
return;
@@ -7541,8 +7576,16 @@ void clif_guild_positionnamelist(struct map_session_data *sd) {
struct guild *g;
nullpo_retv(sd);
+#ifdef BGLUNA_M // Judas BG
+#include "../mods/Brenth/BG/v_00/clif_9.txt"
+#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_10.txt"
+#else
if( (g = sd->guild) == NULL )
return;
+#endif
fd = sd->fd;
WFIFOHEAD(fd, MAX_GUILDPOSITION * 28 + 4);
@@ -7568,9 +7611,16 @@ void clif_guild_positioninfolist(struct map_session_data *sd) {
struct guild *g;
nullpo_retv(sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_11.txt"
+#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_12.txt"
+#else
if( (g = sd->guild) == NULL )
return;
-
+#endif
fd = sd->fd;
WFIFOHEAD(fd, MAX_GUILDPOSITION * 16 + 4);
WFIFOW(fd, 0)=0x160;
@@ -7690,8 +7740,16 @@ void clif_guild_skillinfo(struct map_session_data* sd)
int i,c;
nullpo_retv(sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_13.txt"
+#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_14.txt"
+#else
if( (g = sd->guild) == NULL )
return;
+#endif
fd = sd->fd;
WFIFOHEAD(fd, 6 + MAX_GUILDSKILL*37);
@@ -7833,8 +7891,16 @@ void clif_guild_expulsionlist(struct map_session_data* sd) {
nullpo_retv(sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_15.txt"
+#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_16.txt"
+#else
if( (g = sd->guild) == NULL )
return;
+#endif
fd = sd->fd;
@@ -8565,6 +8631,9 @@ void clif_charnameack (int fd, struct block_list *bl)
if( ssd->status.party_id ) {
p = party->search(ssd->status.party_id);
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_17.txt"
+#endif
if( ssd->status.guild_id ) {
if( ( g = ssd->guild ) != NULL ) {
ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id);
@@ -8692,13 +8761,16 @@ void clif_charnameupdate (struct map_session_data *ssd)
if (ssd->status.party_id > 0)
p = party->search(ssd->status.party_id);
}
-
- if( ssd->status.guild_id > 0 && (g = ssd->guild) != NULL )
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_18.txt"
+#else
+ if (ssd->status.guild_id > 0 && (g = ssd->guild) != NULL)
{
int i;
ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id);
- if( i < g->max_member ) ps = g->member[i].position;
+ if (i < g->max_member) ps = g->member[i].position;
}
+#endif
if( p )
memcpy(WBUFP(buf,30), p->party.name, NAME_LENGTH);
@@ -9534,7 +9606,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
if( map->list[sd->bl.m].flag.battleground ) {
clif->map_type(sd, MAPTYPE_BATTLEFIELD); // Battleground Mode
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_0.txt"
+#else
if( map->list[sd->bl.m].flag.battleground == 2 )
+#endif
clif->bg_updatescore_single(sd);
}
@@ -9771,7 +9847,11 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
//Set last idle time... [Skotlex]
if( battle_config.idletime_criteria & BCIDLE_WALK )
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_1.txt"
+#else
sd->idletime = sockt->last_tick;
+#endif
unit->walktoxy(&sd->bl, x, y, 4);
}
@@ -10168,7 +10248,11 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
pc->delinvincibletimer(sd);
if( battle_config.idletime_criteria & BCIDLE_ATTACK )
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_2.txt"
+#else
sd->idletime = sockt->last_tick;
+#endif
unit->attack(&sd->bl, target_id, action_type != 0);
break;
case 0x02: // sitdown
@@ -10195,7 +10279,9 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if( battle_config.idletime_criteria & BCIDLE_SIT )
sd->idletime = sockt->last_tick;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_3.txt"
+#endif
pc_setsit(sd);
skill->sit(sd,1);
clif->sitting(&sd->bl);
@@ -10209,7 +10295,9 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if( battle_config.idletime_criteria & BCIDLE_SIT )
sd->idletime = sockt->last_tick;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_4.txt"
+#endif
pc->setstand(sd);
skill->sit(sd,0);
clif->standing(&sd->bl);
@@ -10651,7 +10739,11 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
//Whether the item is used or not is irrelevant, the char ain't idle. [Skotlex]
if( battle_config.idletime_criteria & BCIDLE_USEITEM )
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_5.txt"
+#else
sd->idletime = sockt->last_tick;
+#endif
n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2;
if(n <0 || n >= MAX_INVENTORY)
@@ -11158,6 +11250,9 @@ void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) {
if (!pc_iscarton(sd))
return;
if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_6.txt"
+#endif
clif->dropitem(sd, RFIFOW(fd,2)-2,0);
clif->cart_additem_ack(sd,flag == 1?0x0:0x1);
}
@@ -11171,6 +11266,9 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd)
if (!pc_iscarton(sd))
return;
pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_7.txt"
+#endif
}
@@ -11483,8 +11581,11 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
//Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
if( battle_config.idletime_criteria & BCIDLE_USESKILLTOPOS )
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_8.txt"
+#else
sd->idletime = sockt->last_tick;
-
+#endif
if( skill->not_ok(skill_id, sd) )
return;
if( skillmoreinfo != -1 ) {
@@ -11939,6 +12040,9 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd)
storage->add(sd, item_index, item_amount);
else if (sd->state.storage_flag == 2)
gstorage->add(sd, item_index, item_amount);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_9.txt"
+#endif
}
@@ -11957,6 +12061,9 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd)
storage->get(sd, item_index, item_amount);
else if(sd->state.storage_flag == 2)
gstorage->get(sd, item_index, item_amount);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_10.txt"
+#endif
}
@@ -11973,6 +12080,9 @@ void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd)
storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
else if (sd->state.storage_flag == 2)
gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4));
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_11.txt"
+#endif
}
@@ -11989,6 +12099,9 @@ void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd)
storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
else if (sd->state.storage_flag == 2)
gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4));
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_12.txt"
+#endif
}
@@ -12000,6 +12113,9 @@ void clif_parse_CloseKafra(int fd, struct map_session_data *sd)
storage->close(sd);
else if( sd->state.storage_flag == 2 )
gstorage->close(sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_13.txt"
+#endif
}
@@ -16257,7 +16373,9 @@ void clif_bg_xy_remove(struct map_session_data *sd)
clif->send(buf, packet_len(0x2df), &sd->bl, BG_SAMEMAP_WOS);
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_19.txt"
+#endif
/// Notifies clients of a battleground message (ZC_BATTLEFIELD_CHAT).
/// 02dc <packet len>.W <account id>.L <name>.24B <message>.?B
@@ -16331,17 +16449,26 @@ void clif_bg_updatescore(int16 m) {
}
void clif_bg_updatescore_single(struct map_session_data *sd) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_14.txt"
+#endif
int fd;
nullpo_retv(sd);
fd = sd->fd;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_15.txt"
+#else
WFIFOHEAD(fd,packet_len(0x2de));
WFIFOW(fd,0) = 0x2de;
WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion;
WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle;
WFIFOSET(fd,packet_len(0x2de));
+#endif
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_16.txt"
+#endif
/// Battleground camp belong-information (ZC_BATTLEFIELD_NOTIFY_CAMPINFO).
/// 02dd <account id>.L <name>.24B <camp>.W
@@ -19252,9 +19379,15 @@ void clif_defaults(void) {
clif->bg_hp = clif_bg_hp;
clif->bg_xy = clif_bg_xy;
clif->bg_xy_remove = clif_bg_xy_remove;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_20.txt"
+#endif
clif->bg_message = clif_bg_message;
clif->bg_updatescore = clif_bg_updatescore;
clif->bg_updatescore_single = clif_bg_updatescore_single;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clif_17.txt"
+#endif
clif->sendbgemblem_area = clif_sendbgemblem_area;
clif->sendbgemblem_single = clif_sendbgemblem_single;
/* instance-related */
diff --git a/src/map/clif.h b/src/map/clif.h
index a56fbe4..da6cdc3 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -12,7 +12,7 @@
#include "../common/cbasetypes.h"
#include "../common/db.h"
#include "../common/mmo.h"
-
+#include "../mods/config/luna.h"
/**
* Declarations
**/
@@ -941,6 +941,13 @@ struct clif_interface {
void (*bg_message) (struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len);
void (*bg_updatescore) (int16 m);
void (*bg_updatescore_single) (struct map_session_data *sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_21.txt"
+#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/clifh_0.txt"
+#endif
void (*sendbgemblem_area) (struct map_session_data *sd);
void (*sendbgemblem_single) (int fd, struct map_session_data *sd);
/* instance-related */
diff --git a/src/map/guild.c b/src/map/guild.c
index 1d9cf03..d0f0707 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1860,11 +1860,15 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
// announce the change to all guild members
for( i = 0; i < g->max_member; i++ )
{
- if( g->member[i].sd && g->member[i].sd->fd )
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/v_00/clif_22.txt"
+#else
+ if (g->member[i].sd && g->member[i].sd->fd)
{
clif->guild_basicinfo(g->member[i].sd);
clif->guild_memberlist(g->member[i].sd);
}
+#endif
}
return 1;
diff --git a/src/map/map.c b/src/map/map.c
index 5c0f5d6..63703bc 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -62,6 +62,7 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
#ifndef _WIN32
#include <unistd.h>
#endif
@@ -1620,6 +1621,9 @@ int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,i
return fitem->bl.id;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/map_0.txt"
+#endif
/**
* @see DBCreateData
*/
@@ -6064,6 +6068,9 @@ void map_defaults(void) {
map->cache_buffer = NULL;
map->flooritem_ers = NULL;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/map_1.txt"
+#endif
/* */
map->bonus_id = SP_LAST_KNOWN;
/* funcs */
diff --git a/src/map/map.h b/src/map/map.h
index 1766220..ff11c8c 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -14,7 +14,7 @@
#include "../common/mapindex.h"
#include "../common/mmo.h"
#include "../common/sql.h"
-
+#include "../mods/config/luna.h"
struct mob_data;
struct npc_data;
struct hChSysCh;
@@ -594,7 +594,11 @@ struct map_data {
int16 m;
int16 xs,ys; // map dimensions (in cells)
int16 bxs,bys; // map dimensions (in blocks)
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/maph_0.txt"
+#else
int16 bgscore_lion, bgscore_eagle; // Battleground ScoreBoard
+#endif
int npc_num;
int users;
int users_pvp;
@@ -619,7 +623,11 @@ struct map_data {
unsigned gvg : 1; // Now it identifies gvg versus maps that are active 24/7
unsigned gvg_dungeon : 1; // Celest
unsigned gvg_noparty : 1;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/maph_1.txt"
+#else
unsigned battleground : 2; // [BattleGround System]
+#endif
unsigned nozenypenalty : 1;
unsigned notrade : 1;
unsigned noskill : 1;
@@ -932,6 +940,9 @@ struct map_interface {
int (*removemobs_timer) (int tid, int64 tick, int id, intptr_t data);
void (*clearflooritem) (struct block_list* bl);
int (*addflooritem) (struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/maph_2.txt"
+#endif
// player to map session
void (*addnickdb) (int charid, const char* nick);
void (*delnickdb) (int charid, const char* nick);
diff --git a/src/map/mob.c b/src/map/mob.c
index 5af3f99..c25106d 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -46,6 +46,7 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
struct mob_interface mob_s;
#define ACTIVE_AI_RANGE 2 //Distance added on top of 'AREA_SIZE' at which mobs enter active AI mode.
@@ -720,7 +721,11 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
/*==========================================
* Summoning BattleGround [Zephyrus]
*------------------------------------------*/
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/mob_0.txt"
+#else
int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, unsigned int bg_id)
+#endif
{
struct mob_data *md = NULL;
struct spawn_data data;
diff --git a/src/map/mob.h b/src/map/mob.h
index f3937c0..bd86dca 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -150,6 +150,9 @@ struct mob_data {
unsigned char steal_flag; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus]
unsigned char attacked_count; //For rude attacked.
int provoke_flag; // Celest
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/mobh_0.txt"
+#endif
} state;
struct guardian_data* guardian_data;
struct {
@@ -165,8 +168,11 @@ struct mob_data {
int level;
int target_id,attacked_id;
int areanpc_id; //Required in OnTouchNPC (to avoid multiple area touchs)
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/mobh_1.txt"
+#else
unsigned int bg_id; // BattleGround System
-
+#endif
int64 next_walktime, last_thinktime, last_linktime, last_pcneartime, dmgtick;
short move_fail_count;
short lootitem_count;
@@ -248,7 +254,11 @@ struct item_drop_list {
#define mob_stop_walking(md, type) (unit->stop_walking(&(md)->bl, (type)))
#define mob_stop_attack(md) (unit->stop_attack(&(md)->bl))
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/mobh_2.txt"
+#else
#define mob_is_battleground(md) ( map->list[(md)->bl.m].flag.battleground && ((md)->class_ == MOBID_BARRICADE2 || ((md)->class_ >= MOBID_FOOD_STOR && (md)->class_ <= MOBID_PINK_CRYST)) )
+#endif
#define mob_is_gvg(md) (map->list[(md)->bl.m].flag.gvg_castle && ( (md)->class_ == MOBID_EMPERIUM || (md)->class_ == MOBID_BARRICADE1 || (md)->class_ == MOBID_GUARIDAN_STONE1 || (md)->class_ == MOBID_GUARIDAN_STONE2) )
#define mob_is_treasure(md) (((md)->class_ >= MOBID_TREAS01 && (md)->class_ <= MOBID_TREAS40) || ((md)->class_ >= MOBID_TREAS41 && (md)->class_ <= MOBID_TREAS49))
@@ -287,7 +297,11 @@ struct mob_interface {
int (*once_spawn) (struct map_session_data *sd, int16 m, int16 x, int16 y, const char *mobname, int class_, int amount, const char *event, unsigned int size, unsigned int ai);
int (*once_spawn_area) (struct map_session_data *sd, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, const char *mobname, int class_, int amount, const char *event, unsigned int size, unsigned int ai);
int (*spawn_guardian) (const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/mobh_3.txt"
+#else
int (*spawn_bg) (const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id);
+#endif
int (*can_reach) (struct mob_data *md, struct block_list *bl, int range, int state);
int (*linksearch) (struct block_list *bl, va_list ap);
int (*delayspawn) (int tid, int64 tick, int id, intptr_t data);
diff --git a/src/map/npc.c b/src/map/npc.c
index 7378ac4..ca51589 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -41,6 +41,8 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
+
struct npc_interface npc_s;
static int npc_id=START_NPC_NUM;
diff --git a/src/map/npc.h b/src/map/npc.h
index 4c904e1..7fd4807 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -5,6 +5,7 @@
#ifndef MAP_NPC_H
#define MAP_NPC_H
+#include "../mods/config/luna.h"
#include "map.h" // struct block_list
#include "status.h" // struct status_change
#include "unit.h" // struct unit_data
@@ -76,7 +77,11 @@ struct npc_data {
struct {
struct script_code *script;
short xs,ys; // OnTouch area radius
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/npch_0.txt"
+#else
int guild_id;
+#endif
int timer,timerid,timeramount,rid;
int64 timertick;
struct npc_timerevent_list *timer_event;
diff --git a/src/map/pc.c b/src/map/pc.c
index 1e651b3..d7926df 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -55,6 +55,7 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
struct pc_interface pc_s;
//Converts a class to its array index for CLASS_COUNT defined arrays.
@@ -80,6 +81,10 @@ struct map_session_data* pc_get_dummy_sd(void)
return dummy_sd;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pc_0.txt"
+#endif
+
/**
* Sets player's group.
* Caller should handle error (preferably display message and disconnect).
@@ -1314,7 +1319,9 @@ int pc_reg_received(struct map_session_data *sd)
intif->Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
intif->request_questlog(sd);
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pc_1.txt"
+#endif
if (sd->state.connect_new == 0 && sd->fd) { //Character already loaded map! Gotta trigger LoadEndAck manually.
sd->state.connect_new = 1;
clif->pLoadEndAck(sd->fd, sd);
@@ -4412,7 +4419,9 @@ int pc_useitem(struct map_session_data *sd,int n) {
if( sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0 )
return 0;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pc_2.txt"
+#endif
if( !pc->isUseitem(sd,n) )
return 0;
@@ -4969,7 +4978,9 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int
if( sd->state.changemap ) { // Misc map-changing settings
int i;
sd->state.pmap = sd->bl.m;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pc_3.txt"
+#endif
for( i = 0; i < sd->queues_count; i++ ) {
struct hQueue *queue;
if( (queue = script->queue(sd->queues[i])) && queue->onMapChange[0] != '\0' ) {
@@ -5013,6 +5024,9 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int
party->send_dot_remove(sd); //minimap dot fix [Kevin]
guild->send_dot_remove(sd);
bg->send_dot_remove(sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pc_4.txt"
+#endif
if (sd->regen.state.gc)
sd->regen.state.gc = 0;
// make sure vending is allowed here
@@ -6947,8 +6961,12 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
if( sd->bg_id ) {/* TODO: purge when bgqueue is deemed ok */
struct battleground_data *bgd;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pc_5.txt"
+#else
if( (bgd = bg->team_search(sd->bg_id)) != NULL && bgd->die_event[0] )
npc->event(sd, bgd->die_event, 0);
+#endif
}
for( i = 0; i < sd->queues_count; i++ ) {
@@ -11171,4 +11189,7 @@ void pc_defaults(void) {
pc->autotrade_start = pc_autotrade_start;
pc->autotrade_prepare = pc_autotrade_prepare;
pc->autotrade_populate = pc_autotrade_populate;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pc_6.txt"
+#endif
}
diff --git a/src/map/pc.h b/src/map/pc.h
index b7a0b09..2e4ef73 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -22,7 +22,7 @@
#include "../common/cbasetypes.h"
#include "../common/ers.h" // struct eri
#include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus, NEW_CARTS
-
+#include "../mods/config/luna.h"
/**
* Defines
**/
@@ -188,6 +188,9 @@ struct map_session_data {
unsigned int itemcheck : 1;
unsigned int standalone : 1;/* [Ind/Hercules <3] */
unsigned int loggingout : 1;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pch_0.txt"
+#endif
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
@@ -450,14 +453,18 @@ struct map_session_data {
int avail_quests; ///< Number of Q_ACTIVE and Q_INACTIVE entries in quest log (index of the first Q_COMPLETE entry)
struct quest *quest_log; ///< Quest log entries (note: Q_COMPLETE quests follow the first <avail_quests>th enties
bool save_quest; ///< Whether the quest_log entries were modified and are waitin to be saved
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pch_1.txt"
+#endif
// temporary debug [flaviojs]
const char* debug_file;
int debug_line;
const char* debug_func;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pch_2.txt"
+#else
unsigned int bg_id;
-
+#endif
/**
* For the Secure NPC Timeout option (check config/Secure.h) [RR]
**/
@@ -1031,6 +1038,9 @@ struct pc_interface {
void (*autotrade_start) (struct map_session_data *sd);
void (*autotrade_prepare) (struct map_session_data *sd);
void (*autotrade_populate) (struct map_session_data *sd);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/pch_3.txt"
+#endif
};
struct pc_interface *pc;
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index 9cd478b..ed31c34 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -18,6 +18,8 @@
#include "../common/showmsg.h"
#include "../common/strlib.h" // strcmp
+#include "../mods/config/luna.h"
+
static GroupSettings dummy_group; ///< dummy group used in dummy map sessions @see pc_get_dummy_sd()
struct pc_groups_interface pcg_s;
diff --git a/src/map/script.c b/src/map/script.c
index 56bccbd..15c4ff4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -56,6 +56,7 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
#ifndef WIN32
#include <sys/time.h>
#endif
@@ -392,7 +393,11 @@ int script_search_str(const char* p)
int i;
for( i = script->str_hash[script->calc_hash(p)]; i != 0; i = script->str_data[i].next ) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_0.txt"
+#else
if( strcmp(script->get_str(i),p) == 0 ) {
+#endif
return i;
}
}
@@ -500,7 +505,11 @@ int script_add_str(const char* p)
script->str_hash[h] = script->str_num;
} else {// scan for end of list, or occurence of identical string
for( i = script->str_hash[h]; ; i = script->str_data[i].next ) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_1.txt"
+#else
if( strcmp(script->get_str(i),p) == 0 ) {
+#endif
return i; // string already in list
}
if( script->str_data[i].next == 0 )
@@ -2390,7 +2399,11 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
break;
case C_NAME:
j = (*(int*)(script->buf+i)&0xffffff);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_2.txt"
+#else
ShowMessage(" %s", ( j == 0xffffff ) ? "?? unknown ??" : script->get_str(j));
+#endif
i += 3;
break;
case C_STR:
@@ -4304,8 +4317,12 @@ void do_final_script(void) {
fprintf(fp,"num : hash : data_name\n");
fprintf(fp,"---------------------------------------------------------------\n");
for(i=LABEL_START; i<script->str_num; i++) {
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_3.txt"
+#else
unsigned int h = script->calc_hash(script->get_str(i));
fprintf(fp,"%04d : %4u : %s\n",i,h, script->get_str(i));
+#endif
++count[h];
}
fprintf(fp,"--------------------\n\n");
@@ -6626,6 +6643,9 @@ int script_array_index_cmp(const void *a, const void *b) {
return true;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_4.txt"
+#endif
/*==========================================
* rentitem <item id>,<seconds>
* rentitem "<item name>",<seconds>
@@ -11523,23 +11543,34 @@ int buildin_maprespawnguildid_sub_mob(struct block_list *bl,va_list ap)
return true;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_5.txt"
+#endif
+
/// Sets the guild_id of this npc.
///
/// flagemblem <guild_id>;
BUILDIN(flagemblem) {
TBL_NPC* nd;
int g_id = script_getnum(st,2);
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_6.txt"
+#else
if(g_id < 0) return true;
nd = (TBL_NPC*)map->id2nd(st->oid);
+#endif
if( nd == NULL ) {
ShowError("script:flagemblem: npc %d not found\n", st->oid);
} else if( nd->subtype != SCRIPT ) {
ShowError("script:flagemblem: unexpected subtype %d for npc %d '%s'\n", nd->subtype, st->oid, nd->exname);
} else {
bool changed = ( nd->u.scr.guild_id != g_id )?true:false;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_7.txt"
+#else
nd->u.scr.guild_id = g_id;
+#endif
clif->guild_emblem_area(&nd->bl);
/* guild flag caching */
if( g_id ) /* adding a id */
@@ -15561,25 +15592,45 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
}
return true;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_8.txt"
+#else
BUILDIN(pcblockmove) {
int id, flag;
+#endif
TBL_PC *sd = NULL;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_9.txt"
+#else
id = script_getnum(st,2);
+#endif
flag = script_getnum(st,3);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_10.txt"
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_11.txt"
+#else
if(id)
sd = map->id2sd(id);
+#endif
else
sd = script->rid2sd(st);
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_12.txt"
+#else
if(sd)
sd->state.blockedmove = flag > 0;
+#endif
return true;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_13.txt"
+#endif
+
BUILDIN(pcfollow) {
int id, targetid;
TBL_PC *sd = NULL;
@@ -16565,39 +16616,65 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
/*==========================================
* BattleGround System
*------------------------------------------*/
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_14.txt"
+#else
BUILDIN(waitingroom2bg) {
struct npc_data *nd;
struct chat_data *cd;
const char *map_name, *ev = "", *dev = "";
int x, y, i, map_index = 0, bg_id, n;
struct map_session_data *sd;
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_15.txt"
+#else
if( script_hasdata(st,7) )
nd = npc->name2id(script_getstr(st,7));
else
nd = (struct npc_data *)map->id2bl(st->oid);
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_16.txt"
+#else
if( nd == NULL || (cd = (struct chat_data *)map->id2bl(nd->chat_id)) == NULL ) {
script_pushint(st,0);
return true;
}
-
+#endif
map_name = script_getstr(st,2);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_17.txt"
+#else
if( strcmp(map_name,"-") != 0 )
+#endif
{
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_18.txt"
+#else
map_index = script->mapindexname2id(st,map_name);
if( map_index == 0 )
{ // Invalid Map
script_pushint(st,0);
return true;
}
+#endif
}
x = script_getnum(st,3);
y = script_getnum(st,4);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_19.txt"
+#else
ev = script_getstr(st,5); // Logout Event
dev = script_getstr(st,6); // Die Event
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_20.txt"
+#else
if( (bg_id = bg->create(map_index, x, y, ev, dev)) == 0 )
{ // Creation failed
script_pushint(st,0);
@@ -16612,12 +16689,20 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
else
mapreg->setreg(reference_uid(script->add_str("$@arenamembers"), i), 0);
}
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_21.txt"
+#else
mapreg->setreg(script->add_str("$@arenamembersnum"), i);
+#endif
script_pushint(st,bg_id);
return true;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_22.txt"
+#else
BUILDIN(waitingroom2bg_single) {
const char* map_name;
struct npc_data *nd;
@@ -16636,10 +16721,18 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
if( nd == NULL || (cd = (struct chat_data *)map->id2bl(nd->chat_id)) == NULL || cd->users <= 0 )
return true;
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_23.txt"
+#else
if( (sd = cd->usersd[0]) == NULL )
return true;
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_24.txt"
+#else
if( bg->team_join(bg_id, sd) )
{
pc->setpos(sd, map_index, x, y, CLR_TELEPORT);
@@ -16647,33 +16740,58 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
}
else
script_pushint(st,0);
-
+#endif
return true;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_25.txt"
+#else
BUILDIN(bg_team_setxy)
+#endif
{
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_26.txt"
+#else
struct battleground_data *bgd;
int bg_id;
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_27.txt"
+#else
bg_id = script_getnum(st,2);
if( (bgd = bg->team_search(bg_id)) == NULL )
+#endif
return true;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_28.txt"
+#else
bgd->x = script_getnum(st,3);
bgd->y = script_getnum(st,4);
+#endif
return true;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_29.txt"
+#else
BUILDIN(bg_warp)
+#endif
{
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_30.txt"
+#else
int x, y, map_index, bg_id;
const char* map_name;
+#endif
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_31.txt"
+#else
bg_id = script_getnum(st,2);
map_name = script_getstr(st,3);
if( (map_index = script->mapindexname2id(st,map_name)) == 0 )
return true; // Invalid Map
+#endif
x = script_getnum(st,4);
y = script_getnum(st,5);
bg->team_warp(bg_id, map_index, x, y);
@@ -16696,15 +16814,20 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
script_pushint(st, mob->spawn_bg(mapname,x,y,str,class_,evt,bg_id));
return true;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_32.txt"
+#endif
BUILDIN(bg_monster_set_team) {
struct mob_data *md;
struct block_list *mbl;
int id = script_getnum(st,2),
bg_id = script_getnum(st,3);
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_33.txt"
+#else
if( (mbl = map->id2bl(id)) == NULL || mbl->type != BL_MOB )
return true;
+#endif
md = (TBL_MOB *)mbl;
md->bg_id = bg_id;
@@ -16716,6 +16839,9 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
return true;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_34.txt"
+#endif
BUILDIN(bg_leave)
{
struct map_session_data *sd = script->rid2sd(st);
@@ -16725,11 +16851,17 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
bg->team_leave(sd,BGTL_LEFT);
return true;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_35.txt"
+#endif
BUILDIN(bg_destroy)
{
int bg_id = script_getnum(st,2);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_36.txt"
+#else
bg->team_delete(bg_id);
+#endif
return true;
}
@@ -16781,7 +16913,9 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
clif->bg_updatescore(m);
return true;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_37.txt"
+#endif
BUILDIN(bg_get_data)
{
struct battleground_data *bgd;
@@ -16797,6 +16931,9 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
switch( type )
{
case 0: script_pushint(st, bgd->count); break;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_38.txt"
+#endif
default:
ShowError("script:bg_get_data: unknown data identifier %d\n", type);
break;
@@ -16804,7 +16941,9 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
return true;
}
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_39.txt"
+#endif
/*==========================================
* Instancing Script Commands
*------------------------------------------*/
@@ -18467,8 +18606,11 @@ void script_hqueue_clear(int idx) {
x = script_getnum(st,3);
y = script_getnum(st,4);
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_40.txt"
+#else
if( (bg_id = bg->create(map_index, x, y, ev, dev)) == 0 ) { // Creation failed
+#endif
script_pushint(st,-1);
} else
script_pushint(st,bg_id);
@@ -19037,6 +19179,9 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getelementofarray,"ri"),
BUILDIN_DEF(getitem,"vi?"),
BUILDIN_DEF(rentitem,"vi"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_41.txt"
+#endif
BUILDIN_DEF(getitem2,"viiiiiiii?"),
BUILDIN_DEF(getnameditem,"vv"),
BUILDIN_DEF2(grouprandomitem,"groupranditem","i"),
@@ -19047,6 +19192,9 @@ void script_parse_builtin(void) {
BUILDIN_DEF2(disableitemuse,"disable_items",""),
BUILDIN_DEF(cutin,"si"),
BUILDIN_DEF(viewpoint,"iiiii"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_42.txt"
+#endif
BUILDIN_DEF(heal,"ii"),
BUILDIN_DEF(itemheal,"ii"),
BUILDIN_DEF(percentheal,"ii"),
@@ -19196,7 +19344,11 @@ void script_parse_builtin(void) {
BUILDIN_DEF(agitstart,""), // <Agit>
BUILDIN_DEF(agitend,""),
BUILDIN_DEF(agitcheck,""), // <Agitcheck>
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_43.txt"
+#else
BUILDIN_DEF(flagemblem,"i"), // Flag Emblem
+#endif
BUILDIN_DEF(getcastlename,"s"),
BUILDIN_DEF(getcastledata,"si"),
BUILDIN_DEF(setcastledata,"sii"),
@@ -19346,7 +19498,11 @@ void script_parse_builtin(void) {
BUILDIN_DEF(rid2name,"i"),
BUILDIN_DEF(pcfollow,"ii"),
BUILDIN_DEF(pcstopfollow,"i"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_44.txt"
+#else
BUILDIN_DEF(pcblockmove,"ii"),
+#endif
// <--- [zBuffer] List of player cont commands
// [zBuffer] List of mob control commands --->
BUILDIN_DEF(unitwalk,"ii?"),
@@ -19378,6 +19534,9 @@ void script_parse_builtin(void) {
BUILDIN_DEF(openauction,""),
BUILDIN_DEF(checkcell,"siii"),
BUILDIN_DEF(setcell,"siiiiii"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_45.txt"
+#endif
BUILDIN_DEF(setwall,"siiiiis"),
BUILDIN_DEF(delwall,"s"),
BUILDIN_DEF(searchitem,"rs"),
@@ -19401,19 +19560,42 @@ void script_parse_builtin(void) {
BUILDIN_DEF(agitend2,""),
BUILDIN_DEF(agitcheck2,""),
// BattleGround
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_46.txt"
+#endif
BUILDIN_DEF(waitingroom2bg,"siiss?"),
BUILDIN_DEF(waitingroom2bg_single,"isiis"),
BUILDIN_DEF(bg_team_setxy,"iii"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_47.txt"
+#endif
BUILDIN_DEF(bg_warp,"isii"),
BUILDIN_DEF(bg_monster,"isiisi?"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_48.txt"
+#endif
BUILDIN_DEF(bg_monster_set_team,"ii"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_49.txt"
+#endif
BUILDIN_DEF(bg_leave,""),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_50.txt"
+#endif
BUILDIN_DEF(bg_destroy,"i"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_51.txt"
+#endif
BUILDIN_DEF(areapercentheal,"siiiiii"),
BUILDIN_DEF(bg_get_data,"ii"),
BUILDIN_DEF(bg_getareausers,"isiiii"),
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_52.txt"
+#endif
BUILDIN_DEF(bg_updatescore,"sii"),
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/script_53.txt"
+#endif
// Instancing
BUILDIN_DEF(instance_create,"si?"),
BUILDIN_DEF(instance_destroy,"?"),
diff --git a/src/map/skill.c b/src/map/skill.c
index c9e6853..aab4893 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -45,6 +45,8 @@
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../mods/config/luna.h"
+
#define SKILLUNITTIMER_INTERVAL 100
// ranges reserved for mapping skill ids to skilldb offsets
@@ -5238,10 +5240,16 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if( skill_id == AB_HIGHNESSHEAL ) {
heal = heal * ( 17 + 3 * skill_lv ) / 10;
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/skill_0.txt"
+#else
if( status->isimmune(bl) ||
(dstmd && (dstmd->class_ == MOBID_EMPERIUM || mob_is_battleground(dstmd))) )
+#endif
heal=0;
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/skill_1.txt"
+#endif
if( sd && dstsd && sd->status.partner_id == dstsd->status.char_id && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.sex == 0 )
heal = heal*2;
@@ -6777,6 +6785,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
sp += sp / 10;
}
}
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/skill_2.txt"
+#endif
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
if( hp > 0 || (skill_id == AM_POTIONPITCHER && sp <= 0) )
clif->skill_nodamage(NULL,bl,AL_HEAL,(int)hp,1);
@@ -11626,10 +11637,18 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6
if( md && md->class_ == MOBID_EMPERIUM )
break;
#endif
+
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/skill_3.txt"
+#else
if( md && mob_is_battleground(md) )
break;
+#endif
if( tstatus->hp >= tstatus->max_hp )
break;
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/skill_4.txt"
+#endif
if( status->isimmune(bl) )
heal = 0;
clif->skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1);
diff --git a/src/map/unit.c b/src/map/unit.c
index 0eb6fdb..7080881 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -45,6 +45,8 @@
#include "../common/socket.h"
#include "../common/timer.h"
+#include "../mods/config/luna.h"
+
const short dirx[8]={0,-1,-1,-1,0,1,1,1};
const short diry[8]={1,1,0,-1,-1,-1,0,1};
@@ -2061,7 +2063,9 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
if( ud->skilltimer != INVALID_TIMER && !(sd && pc->checkskill(sd,SA_FREECAST) > 0) )
return 0; // can't attack while casting
-
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/unit_0.txt"
+#endif
if( !battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && pc->checkskill(sd,SA_FREECAST) > 0) )
{ // attacking when under cast delay has restrictions:
if( tid == INVALID_TIMER ) { //requested attack.
@@ -2599,6 +2603,9 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
pc->cleareventtimer(sd);
pc->inventory_rental_clear(sd);
pc->delspiritball(sd,sd->spiritball,1);
+#ifdef BGLUNA_M
+#include "../mods/Brenth/BG/unit_1.txt"
+#endif
for(i = 1; i < 5; i++)
pc->del_charm(sd, sd->charm[i], i);