viewing paste Unknown #17538 | Diff

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201
 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);
 
 
Viewed 1080 times, submitted by milk.