Sfoglia il codice sorgente

Merge branch 'master' into hotfix/issue4984

Aleos 2 anni fa
parent
commit
42eccbb1bf
100 ha cambiato i file con 8106 aggiunte e 2174 eliminazioni
  1. 91 0
      .github/workflows/analysis_codeql.yml
  2. 1 1
      .github/workflows/build_servers_clang.yml
  3. 1 1
      .github/workflows/build_servers_cmake.yml
  4. 1 1
      .github/workflows/build_servers_gcc.yml
  5. 1 1
      .github/workflows/build_servers_modes.yml
  6. 1 1
      .github/workflows/build_servers_msbuild.yml
  7. 1 1
      .github/workflows/build_servers_packetversions.yml
  8. 1 1
      .github/workflows/build_servers_vip.yml
  9. 1 1
      .github/workflows/npc_db_validation.yml
  10. 8 0
      conf/battle/feature.conf
  11. 2 1
      conf/inter_athena.conf
  12. 42 0
      db/pre-re/item_group_db.yml
  13. 94 0
      db/pre-re/status.yml
  14. 144 144
      db/re/item_combos.yml
  15. 739 71
      db/re/item_db_equip.yml
  16. 199 98
      db/re/item_db_etc.yml
  17. 1763 45
      db/re/item_db_usable.yml
  18. 86 174
      db/re/item_enchant.yml
  19. 793 8
      db/re/item_group_db.yml
  20. 23 23
      db/re/laphine_synthesis.yml
  21. 8 8
      db/re/laphine_upgrade.yml
  22. 0 3
      db/re/skill_db.yml
  23. 93 0
      db/re/status.yml
  24. 2 1
      doc/status.txt
  25. 221 133
      npc/custom/warper.txt
  26. 0 125
      npc/merchants/cash_hair.txt
  27. 5 0
      npc/re/mapflag/nobranch.txt
  28. 5 0
      npc/re/mapflag/nomemo.txt
  29. 5 0
      npc/re/mapflag/nopenalty.txt
  30. 5 0
      npc/re/mapflag/nopvp.txt
  31. 6 0
      npc/re/mapflag/noteleport.txt
  32. 1 0
      npc/re/merchants/barters.yml
  33. 1039 0
      npc/re/merchants/barters/cashmall.yml
  34. 331 0
      npc/re/merchants/cashmall.txt
  35. 2 1
      npc/re/merchants/enchan_upg.txt
  36. 3 1
      npc/re/merchants/shadow_refiner.txt
  37. 6 4
      npc/re/other/item_merge.txt
  38. 2 1
      npc/re/scripts_athena.conf
  39. 0 1
      npc/scripts_athena.conf
  40. 10 10
      sql-files/item_db_re_equip.sql
  41. 21 0
      sql-files/main.sql
  42. 823 0
      sql-files/upgrades/upgrade_20221218.sql
  43. 20 0
      sql-files/upgrades/upgrade_20221220.sql
  44. 20 44
      src/char/char.cpp
  45. 19 7
      src/char/char.hpp
  46. 2 2
      src/char/char_clif.cpp
  47. 1 1
      src/char/char_cnslif.cpp
  48. 0 12
      src/char/char_logif.cpp
  49. 4 4
      src/char/char_mapif.cpp
  50. 7 9
      src/common/cli.cpp
  51. 116 37
      src/common/core.cpp
  52. 79 32
      src/common/core.hpp
  53. 2 2
      src/common/ers.cpp
  54. 3 3
      src/common/mmo.hpp
  55. 0 11
      src/common/socket.cpp
  56. 0 1
      src/common/socket.hpp
  57. 16 47
      src/login/login.cpp
  58. 19 7
      src/login/login.hpp
  59. 1 1
      src/login/loginchrif.cpp
  60. 2 2
      src/login/loginclif.cpp
  61. 11 13
      src/login/logincnslif.cpp
  62. 15 15
      src/map/achievement.cpp
  63. 11 11
      src/map/achievement.hpp
  64. 59 54
      src/map/atcommand.cpp
  65. 3 3
      src/map/atcommand.hpp
  66. 110 100
      src/map/battle.cpp
  67. 7 4
      src/map/battle.hpp
  68. 23 23
      src/map/battleground.cpp
  69. 15 15
      src/map/battleground.hpp
  70. 12 12
      src/map/buyingstore.cpp
  71. 10 10
      src/map/buyingstore.hpp
  72. 2 2
      src/map/cashshop.cpp
  73. 3 3
      src/map/cashshop.hpp
  74. 34 30
      src/map/channel.cpp
  75. 23 23
      src/map/channel.hpp
  76. 7 7
      src/map/chat.cpp
  77. 8 8
      src/map/chat.hpp
  78. 27 48
      src/map/chrif.cpp
  79. 13 14
      src/map/chrif.hpp
  80. 6 6
      src/map/clan.cpp
  81. 7 7
      src/map/clan.hpp
  82. 124 129
      src/map/clif.cpp
  83. 320 311
      src/map/clif.hpp
  84. 5 0
      src/map/clif_packetdb.hpp
  85. 13 13
      src/map/duel.cpp
  86. 8 8
      src/map/duel.hpp
  87. 45 45
      src/map/guild.cpp
  88. 24 24
      src/map/guild.hpp
  89. 17 17
      src/map/homunculus.cpp
  90. 10 10
      src/map/homunculus.hpp
  91. 7 7
      src/map/instance.cpp
  92. 3 3
      src/map/instance.hpp
  93. 46 46
      src/map/intif.cpp
  94. 17 17
      src/map/intif.hpp
  95. 32 2
      src/map/itemdb.cpp
  96. 99 13
      src/map/itemdb.hpp
  97. 8 8
      src/map/log.cpp
  98. 9 9
      src/map/log.hpp
  99. 11 11
      src/map/mail.cpp
  100. 11 11
      src/map/mail.hpp

+ 91 - 0
.github/workflows/analysis_codeql.yml

@@ -0,0 +1,91 @@
+name: Analyse servers with CodeQL
+# analysis_codeql.yml
+
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
+
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    paths:
+      # Always trigger all Github Actions if an action or something CI related was changed
+      - '.github/workflows/**'
+      - 'tools/ci/**'
+      # This workflow should run when a file in a source directory has been modified.
+      - 'src/**'
+      - '3rdparty/**'
+
+jobs:
+  analyze:
+    # Github Actions checks for '[ci skip]', '[skip ci]', '[no ci]', '[skip actions]', or '[actions skip]' but not a hyphenated version.
+    # It's a catch-all incase a Pull Request has been opened and someone is on auto-pilot.
+    if: "!contains(github.event.head_commit.message, 'ci-skip')"
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # Available: ubuntu-22.04, ubuntu-20.04
+          os: [ubuntu-latest]
+          # Older versions of GCC are not available via unaltered aptitude repo lists.
+          gcc: ['10']
+          # We run build checks for both Renewal and PRE-Renewal
+          mode: ['PRE','RE']
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      # Initializes the CodeQL tools for scanning.
+      - name: Initialize CodeQL
+        uses: github/codeql-action/init@v2
+        with:
+           # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
+           # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
+           languages: cpp
+           # Trigger security and quality findings
+           # https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+           # TODO: Resolve the issues and then enable it again
+           #queries: +security-and-quality
+
+      # A simple 'yes' and 'no' can be confusing, so we use names to display in the current job then convert them for use in the compiler.
+      - name: Variable Parsing - PRE
+        if: ${{ matrix.mode == 'PRE' }} 
+        run: |
+          echo "PRERE=yes" >> $GITHUB_ENV
+      - name: Variable Parsing - RE
+        if: ${{ matrix.mode == 'RE' }} 
+        run: |
+          echo "PRERE=no" >> $GITHUB_ENV
+
+      - name: Update & Install packages
+        # Ubuntu runners already have most of the packages rAthena requires to build.
+        # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
+        run: |
+          sudo apt update
+          sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
+
+      # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
+      # If this step fails, then you should remove it and run the build manually (see below)
+      #- name: Autobuild
+      #  uses: github/codeql-action/autobuild@v2
+
+      # ✏️ If the Autobuild fails above, remove it and uncomment the following
+      #    three lines and modify them (or add more) to build your code if your
+      #    project uses a compiled language
+      - name: Command - configure
+        env:
+            CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }} --enable-prere=${{ env.PRERE }} --enable-buildbot=yes'
+        run: ./configure $CONFIGURE_FLAGS
+
+      - name: Command - make clean
+        run: make clean
+
+      - name: Command - make server
+        run: make server
+
+      - name: Perform CodeQL Analysis
+        uses: github/codeql-action/analyze@v2

+ 1 - 1
.github/workflows/build_servers_clang.yml

@@ -3,7 +3,7 @@ name: Build servers with Clang
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 1 - 1
.github/workflows/build_servers_cmake.yml

@@ -3,7 +3,7 @@ name: Build servers with CMake
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 1 - 1
.github/workflows/build_servers_gcc.yml

@@ -3,7 +3,7 @@ name: Build servers with GCC
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 1 - 1
.github/workflows/build_servers_modes.yml

@@ -3,7 +3,7 @@ name: Build servers in Pre-Renewal and Renewal
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 1 - 1
.github/workflows/build_servers_msbuild.yml

@@ -3,7 +3,7 @@ name: Build servers with MSVS
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 1 - 1
.github/workflows/build_servers_packetversions.yml

@@ -3,7 +3,7 @@ name: Build servers with different packet versions
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 1 - 1
.github/workflows/build_servers_vip.yml

@@ -3,7 +3,7 @@ name: Build servers in VIP mode
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 1 - 1
.github/workflows/npc_db_validation.yml

@@ -6,7 +6,7 @@ name: Validate NPC Scripts and DB Changes
 
 concurrency:
   group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
 
 on:
   push:

+ 8 - 0
conf/battle/feature.conf

@@ -67,6 +67,10 @@ feature.bgqueue: on
 // Requires: 2014-10-22bRagexe or later
 feature.roulette: on
 
+// Roulette bonus reward
+// Multiply amount by 2 if the reward item ID is the same as bonus item ID
+feature.roulette_bonus_reward: on
+
 // Achievement (Note 1)
 // Requires: 2015-05-13aRagexe or later
 feature.achievement: on
@@ -142,3 +146,7 @@ feature.dynamicnpc_direction: no
 // like from SHIFT+Click from player's inventory/cart/equipment window.
 // Requires: 2010-00-00RagexeRE or later
 feature.itemlink: on
+
+// Stylist UI (Note 1)
+// Requires: 2015-11-04 or later
+feature.stylist: on

+ 2 - 1
conf/inter_athena.conf

@@ -158,6 +158,7 @@ renewal-mob_skill_table: mob_skill_db_re
 mob_skill2_table: mob_skill_db2
 renewal-mob_skill2_table: mob_skill_db2_re
 mapreg_table: mapreg
+partybookings_table: party_bookings
 sales_table: sales
 vending_table: vendings
 vending_items_table: vending_items
@@ -166,7 +167,7 @@ roulette_table: db_roulette
 guild_storage_log: guild_storage_log
 
 // Web Database Tables
-// NOTE: The web server reads the login (login) and char (guild) tables, so it needs
+// NOTE: The web server reads the login (login) and char (party,guild) tables and map (party_bookings), so it needs
 //       the ability to connect to those databases.
 guild_emblems: guild_emblems
 user_configs: user_configs

+ 42 - 0
db/pre-re/item_group_db.yml

@@ -7433,3 +7433,45 @@ Body:
             Rate: 1
           - Item: Gold_Tiara_
             Rate: 1
+  - Group: MF_NOTELEPORT
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Wing_Of_Fly
+          - Item: Giant_Fly_Wing
+          - Item: N_Fly_Wing
+          - Item: E_Giant_Fly_Wing
+          - Item: F_Giant_Fly_Wing
+  - Group: MF_NORETURN
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Wing_Of_Butterfly
+          - Item: N_Butterfly_Wing
+          - Item: Dun_Tele_Scroll1
+          - Item: Dun_Tele_Scroll2
+          - Item: Dun_Tele_Scroll3
+          - Item: E_Dun_Tele_Scroll1
+          - Item: F_Dun_Tele_Scroll1
+          - Item: WOB_Rune
+          - Item: E_WOB_Rune
+          - Item: F_WOB_Rune
+          - Item: WOB_Schwaltz
+          - Item: E_WOB_Schwaltz
+          - Item: F_WOB_Schwaltz
+          - Item: WOB_Rachel
+          - Item: E_WOB_Rachel
+          - Item: F_WOB_Rachel
+          - Item: WOB_Local
+          - Item: E_WOB_Local
+          - Item: F_WOB_Local
+          - Item: Siege_Teleport_Scroll
+          - Item: Siege_Teleport_Scroll2
+          - Item: E_Siege_Teleport_Scroll
+  - Group: GIANT_FLY_WING
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Giant_Fly_Wing
+          - Item: E_Giant_Fly_Wing
+          - Item: F_Giant_Fly_Wing

+ 94 - 0
db/pre-re/status.yml

@@ -245,6 +245,7 @@ Body:
       BossResist: true
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     Fail:
       Refresh: true
       Inspiration: true
@@ -273,6 +274,7 @@ Body:
       BossResist: true
       Debuff: true
       NoSaveInfinite: true
+      RemoveOnHermode: true
     EndOnStart:
       Freeze: true
       Stone: true
@@ -296,6 +298,7 @@ Body:
       Quicken: true
     Flags:
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Decreaseagi: true
   - Status: Concentrate
@@ -306,6 +309,7 @@ Body:
       Dex: true
     Flags:
       FailedMado: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Hiding
@@ -356,6 +360,7 @@ Body:
       Atk_Ele: true
     Flags:
       RemoveOnUnequipWeapon: true
+      RemoveOnHermode: true
     EndOnStart:
       Aspersio: true
       Fireweapon: true
@@ -368,6 +373,8 @@ Body:
   - Status: Poisonreact
     Icon: EFST_POISONREACT
     DurationLookup: AS_POISONREACT
+    Flags:
+      RemoveOnHermode: true
   - Status: Quagmire
     Icon: EFST_QUAGMIRE
     DurationLookup: WZ_QUAGMIRE
@@ -380,6 +387,7 @@ Body:
       NoSave: true
       NoClearance: true
       Debuff: true
+      RemoveOnHermode: true
     Fail:
       Speedup1: true
     EndOnStart:
@@ -407,6 +415,7 @@ Body:
       Angelus: true
     Flags:
       SendOption: true
+      RemoveOnHermode: true
   - Status: Blessing
     Icon: EFST_BLESSING
     DurationLookup: AL_BLESSING
@@ -417,6 +426,7 @@ Body:
     Flags:
       BossResist: true
       TaekwonAngel: true
+      RemoveOnHermode: true
   - Status: Signumcrucis
     Icon: EFST_CRUCIS
     DurationLookup: AL_CRUCIS
@@ -436,6 +446,7 @@ Body:
     Flags:
       FailedMado: true
       TaekwonAngel: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
     EndOnStart:
@@ -451,6 +462,7 @@ Body:
       BossResist: true
       NoSave: true
       Debuff: true
+      RemoveOnHermode: true
     Fail:
       Speedup1: true
     EndOnStart:
@@ -469,6 +481,7 @@ Body:
     DurationLookup: PR_SLOWPOISON
     Flags:
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Impositio
     Icon: EFST_IMPOSITIO
     DurationLookup: PR_IMPOSITIO
@@ -476,6 +489,7 @@ Body:
       Watk: true
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
     EndOnStart:
       Impositio: true
   - Status: Suffragium
@@ -483,6 +497,7 @@ Body:
     DurationLookup: PR_SUFFRAGIUM
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
   - Status: Aspersio
     Icon: EFST_ASPERSIO
     DurationLookup: PR_ASPERSIO
@@ -490,6 +505,7 @@ Body:
       Atk_Ele: true
     Flags:
       RemoveOnUnequipWeapon: true
+      RemoveOnHermode: true
     EndOnStart:
       Encpoison: true
       Fireweapon: true
@@ -508,11 +524,13 @@ Body:
       NoSave: true
       NoClearance: true
       #RemoveOnUnequipArmor: true
+      RemoveOnHermode: true
   - Status: Kyrie
     Icon: EFST_KYRIE
     DurationLookup: PR_KYRIE
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
     EndOnStart:
       Assumptio: true
   - Status: Magnificat
@@ -524,6 +542,7 @@ Body:
       FailedMado: true
       NoSave: true
       SuperNoviceAngel: true
+      RemoveOnHermode: true
   - Status: Gloria
     Icon: EFST_GLORIA
     DurationLookup: PR_GLORIA
@@ -531,11 +550,13 @@ Body:
       Luk: true
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
   - Status: Aeterna
     Icon: EFST_LEXAETERNA
     DurationLookup: PR_LEXAETERNA
     Flags:
       NoSave: true
+      RemoveOnHermode: true
     Fail:
       Stone: true
       Freeze: true
@@ -547,6 +568,7 @@ Body:
     Flags:
       MadoCancel: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
       Decreaseagi: true
@@ -555,6 +577,7 @@ Body:
     DurationLookup: BS_WEAPONPERFECT
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
   - Status: Overthrust
     Icon: EFST_OVERTHRUST
     DurationLookup: BS_OVERTHRUST
@@ -562,6 +585,7 @@ Body:
       OverThrust: true
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
     Fail:
       Maxoverthrust: true
   - Status: Maximizepower
@@ -571,6 +595,7 @@ Body:
       Regen: true
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
   - Status: Trickdead
     Icon: EFST_TRICKDEAD
     DurationLookup: NV_TRICKDEAD
@@ -590,6 +615,7 @@ Body:
       NoSave: true
       NoClearance: true
       RemoveOnChangeMap: true
+      RemoveOnHermode: true
     EndOnStart:
       Dancing: true
   - Status: Loud
@@ -599,11 +625,14 @@ Body:
       Str: true
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
   - Status: Energycoat
     Icon: EFST_ENERGYCOAT
     DurationLookup: MG_ENERGYCOAT
     Opt3:
       EnergyCoat: true
+    Flags:
+      RemoveOnHermode: true
   - Status: Brokenarmor
     Icon: EFST_BROKENARMOR
     DurationLookup: NPC_ARMORBRAKE
@@ -655,12 +684,14 @@ Body:
     Flags:
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Aspdpotion2
     Icon: EFST_ATTHASTE_POTION3
     CalcFlags:
       Aspd: true
     Flags:
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Aspdpotion3
     Icon: EFST_ATTHASTE_INFINITY
     CalcFlags:
@@ -668,6 +699,7 @@ Body:
     Flags:
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Speedup0
     Icon: EFST_MOVHASTE_HORSE
     CalcFlags:
@@ -685,6 +717,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Atkpotion
     Icon: EFST_PLUSATTACKPOWER
     CalcFlags:
@@ -693,6 +726,7 @@ Body:
       NoRemoveOnDead: true
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Matkpotion
     Icon: EFST_PLUSMAGICPOWER
     CalcFlags:
@@ -701,6 +735,7 @@ Body:
       NoRemoveOnDead: true
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Wedding
     States:
       NoAttack: true
@@ -743,6 +778,8 @@ Body:
     CalcFlags:
       Mdef: true
       Def: true
+    Flags:
+      RemoveOnHermode: true
   - Status: Stripweapon
     Icon: EFST_NOEQUIPWEAPON
     DurationLookup: RG_STRIPWEAPON
@@ -755,6 +792,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Stripshield
     Icon: EFST_NOEQUIPSHIELD
     DurationLookup: RG_STRIPSHIELD
@@ -767,6 +805,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Striparmor
     Icon: EFST_NOEQUIPARMOR
     DurationLookup: RG_STRIPARMOR
@@ -779,6 +818,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Striphelm
     Icon: EFST_NOEQUIPHELM
     DurationLookup: RG_STRIPHELM
@@ -791,6 +831,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Cp_Weapon
     Icon: EFST_PROTECTWEAPON
     DurationLookup: AM_CP_WEAPON
@@ -800,6 +841,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Cp_Shield
     Icon: EFST_PROTECTSHIELD
     DurationLookup: AM_CP_SHIELD
@@ -809,6 +851,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Cp_Armor
     Icon: EFST_PROTECTARMOR
     DurationLookup: AM_CP_ARMOR
@@ -818,6 +861,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Cp_Helm
     Icon: EFST_PROTECTHELM
     DurationLookup: AM_CP_HELM
@@ -827,18 +871,21 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Autoguard
     Icon: EFST_AUTOGUARD
     DurationLookup: CR_AUTOGUARD
     Flags:
       NoClearance: true
       RequireShield: true
+      RemoveOnHermode: true
   - Status: Reflectshield
     Icon: EFST_REFLECTSHIELD
     DurationLookup: CR_REFLECTSHIELD
     Flags:
       NoClearance: true
       RequireShield: true
+      RemoveOnHermode: true
     EndOnStart:
       Reflectdamage: true
   - Status: Splasher
@@ -851,6 +898,7 @@ Body:
       All: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Defender
     Icon: EFST_DEFENDER
     DurationLookup: CR_DEFENDER
@@ -859,11 +907,13 @@ Body:
       Aspd: true
     Flags:
       RequireShield: true
+      RemoveOnHermode: true
   - Status: Magicrod
     Icon: EFST_MAGICROD
     DurationLookup: SA_MAGICROD
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Spellbreaker
     Flags:
       NoWarning: true
@@ -897,6 +947,7 @@ Body:
     Flags:
       FailedMado: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Autocounter
@@ -951,6 +1002,7 @@ Body:
       Debuff: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Combo
     Flags:
       NoClearbuff: true
@@ -981,6 +1033,7 @@ Body:
       NoSave: true
       NoClearance: true
       RemoveOnChangeMap: true
+      RemoveOnHermode: true
   - Status: Fireweapon
     Icon: EFST_PROPERTYFIRE
     DurationLookup: SA_FLAMELAUNCHER
@@ -1049,6 +1102,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Deluge
     Icon: EFST_GROUNDMAGIC
     DurationLookup: SA_DELUGE
@@ -1108,6 +1162,7 @@ Body:
     Flags:
       NoSave: true
       RequireWeapon: true
+      RemoveOnHermode: true
   - Status: Parrying
     Icon: EFST_PARRYING
     DurationLookup: LK_PARRYING
@@ -1115,6 +1170,7 @@ Body:
       NoSave: true
       NoClearance: true
       RequireWeapon: true
+      RemoveOnHermode: true
   - Status: Concentration
     Icon: EFST_LKCONCENTRATION
     DurationLookup: LK_CONCENTRATION
@@ -1128,6 +1184,7 @@ Body:
       Quicken: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Tensionrelax
     Icon: EFST_TENSIONRELAX
     DurationLookup: LK_TENSIONRELAX
@@ -1136,6 +1193,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Berserk
     Icon: EFST_BERSERK
     DurationLookup: LK_BERSERK
@@ -1176,6 +1234,7 @@ Body:
       Aspd: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Assumptio
     Icon: EFST_ASSUMPTIO
     DurationLookup: HP_ASSUMPTIO
@@ -1184,6 +1243,8 @@ Body:
     EndOnStart:
       Kyrie: true
       Kaite: true
+    Flags:
+      RemoveOnHermode: true
   - Status: Basilica
     DurationLookup: HP_BASILICA
     States:
@@ -1194,6 +1255,7 @@ Body:
       NoSave: true
       NoClearance: true
       RemoveOnChangeMap: true
+      RemoveOnHermode: true
   - Status: Guildaura
     Flags:
       NoDispell: true
@@ -1206,6 +1268,7 @@ Body:
       Matk: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
     EndOnStart:
       Magicpower: true
   - Status: Edp
@@ -1231,6 +1294,7 @@ Body:
     Flags:
       FailedMado: true
       NoSave: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Windwalk
@@ -1242,6 +1306,7 @@ Body:
     Flags:
       FailedMado: true
       NoSave: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Meltdown
@@ -1335,6 +1400,7 @@ Body:
       Debuff: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
     EndOnStart:
       Blessing: true
       Increaseagi: true
@@ -1350,6 +1416,7 @@ Body:
       NoSave: true
       NoClearance: true
       Debuff: true
+      RemoveOnHermode: true
   - Status: Mindbreaker
     Icon: EFST_MINDBREAKER
     DurationLookup: PF_MINDBREAKER
@@ -1359,6 +1426,7 @@ Body:
     Flags:
       NoSave: true
       Debuff: true
+      RemoveOnHermode: true
     EndOnStart:
       Freeze: true
       Stone: true
@@ -1368,6 +1436,7 @@ Body:
     DurationLookup: PF_MEMORIZE
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Fogwall
     Icon: EFST_FOGWALL
     DurationLookup: PF_FOGWALL
@@ -1375,6 +1444,7 @@ Body:
       BossResist: true
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Spiderweb
     Icon: EFST_SPIDERWEB
     DurationLookup: PF_SPIDERWEB
@@ -1397,6 +1467,7 @@ Body:
       NoSave: true
       RemoveOnChangeMap: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
     EndOnEnd:
       Autoguard: true
       Defender: true
@@ -1404,6 +1475,8 @@ Body:
       Endure: true
   - Status: Sacrifice
     DurationLookup: PA_SACRIFICE
+    Flags:
+      RemoveOnHermode: true
   - Status: Steelbody
     Icon: EFST_STEELBODY
     DurationLookup: MO_STEELBODY
@@ -1416,6 +1489,7 @@ Body:
       Speed: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
     Opt3:
       SteelBody: true
   - Status: Orcish
@@ -1480,6 +1554,7 @@ Body:
       NoSave: true
       NoClearance: true
       RemoveOnChangeMap: true
+      RemoveOnHermode: true
   - Status: Shadowweapon
     Icon: EFST_PROPERTYDARK
     DurationLookup: TK_SEVENWIND
@@ -1488,6 +1563,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Encpoison: true
       Aspersio: true
@@ -1505,6 +1581,7 @@ Body:
       MadoCancel: true
       NoSave: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
       Decreaseagi: true
@@ -1516,6 +1593,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Encpoison: true
       Aspersio: true
@@ -1533,6 +1611,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Kaahi: true
   - Status: Kaupe
@@ -1541,6 +1620,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Onehand
     Icon: EFST_ONEHANDQUICKEN
     DurationLookup: KN_ONEHAND
@@ -1552,6 +1632,7 @@ Body:
       NoSave: true
       NoClearance: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Decreaseagi: true
     EndOnStart:
@@ -1564,6 +1645,7 @@ Body:
     DurationLookup: ST_PRESERVE
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Battleorders
     Icon: EFST_GDSKILL_BATTLEORDER
     DurationLookup: GD_BATTLEORDER
@@ -1587,6 +1669,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Gravitation
     Icon: EFST_GRAVITATION
     DurationLookup: HW_GRAVITATION
@@ -1601,6 +1684,7 @@ Body:
       BossResist: true
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Maxoverthrust
     Icon: EFST_OVERTHRUSTMAX
     DurationLookup: WS_OVERTHRUSTMAX
@@ -1609,6 +1693,7 @@ Body:
     Flags:
       MadoCancel: true
       NoSave: true
+      RemoveOnHermode: true
     EndOnStart:
       Overthrust: true
   - Status: Longing
@@ -1855,6 +1940,7 @@ Body:
       NoClearance: true
       RemoveOnChangeMap: true
       Debuff: true
+      RemoveOnHermode: true
   - Status: Spurt
     Icon: EFST_STRUP
     DurationLookup: TK_RUN
@@ -1864,6 +1950,7 @@ Body:
       NoSave: true
       NoClearance: true
       RequireWeapon: true
+      RemoveOnHermode: true
   - Status: Spirit
     Icon: EFST_SOULLINK
     DurationLookup: SL_HIGH
@@ -1875,6 +1962,7 @@ Body:
       NoClearance: true
       NoSave: true
       NoBanishingBuster: true
+      RemoveOnHermode: true
   - Status: Coma
     DurationLookup: NPC_DARKBLESSING
     Flags:
@@ -2222,6 +2310,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Assumptio: true
   - Status: Swoo
@@ -2321,6 +2410,7 @@ Body:
       NoClearance: true
       NoBanishingBuster: true
       NoDispell: true
+      RemoveOnHermode: true
   - Status: Bunsinjyutsu
     Icon: EFST_NJ_BUNSINJYUTSU
     DurationLookup: NJ_BUNSINJYUTSU
@@ -2331,6 +2421,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Kaensin
     Flags:
       NoWarning: true
@@ -2445,6 +2536,7 @@ Body:
       SendVal1: true
       OverlapIgnoreLevel: true
       RemoveOnUnequipWeapon: true
+      RemoveOnHermode: true
     EndOnStart:
       Enchantarms: true
       Aspersio: true
@@ -5749,6 +5841,7 @@ Body:
       RemoveOnChangeMap: true
       NoBanishingBuster: true
       NoDispell: true
+      RemoveOnHermode: true
   - Status: Mtf_Aspd2
     Icon: EFST_MTF_ASPD2
     CalcFlags:
@@ -6353,6 +6446,7 @@ Body:
     Flags:
       NoRemoveOnDead: true
       NoClearbuff: true
+      RemoveOnHermode: true
   - Status: Geffen_Magic2
     Icon: EFST_GEFFEN_MAGIC2
     CalcFlags:

File diff suppressed because it is too large
+ 144 - 144
db/re/item_combos.yml


File diff suppressed because it is too large
+ 739 - 71
db/re/item_db_equip.yml


File diff suppressed because it is too large
+ 199 - 98
db/re/item_db_etc.yml


File diff suppressed because it is too large
+ 1763 - 45
db/re/item_db_usable.yml


File diff suppressed because it is too large
+ 86 - 174
db/re/item_enchant.yml


+ 793 - 8
db/re/item_group_db.yml

@@ -25723,7 +25723,7 @@ Body:
             Rate: 140
           - Item: C_Pig_Nose
             Rate: 140
-          - Item: C_Cat_Ears_Hat
+          - Item: C_Cat_Ear_Hat
             Rate: 140
           - Item: C_Valkyrie_Circlet
             Rate: 140
@@ -25996,7 +25996,7 @@ Body:
             Rate: 140
           - Item: C_Poring_On_Shoulder
             Rate: 140
-          - Item: Costume_Yawata_Seal
+          - Item: C_FortunetellinSealed
             Rate: 140
           - Item: C_Pretty_Bear_WH
             Rate: 140
@@ -26008,7 +26008,7 @@ Body:
             Rate: 140
           - Item: C_Dark_Snake_Lord_Stall
             Rate: 140
-          - Item: Costume_Twin_Cannon
+          - Item: C_Twin_Canon
             Rate: 140
           - Item: C_Picnic_Basket
             Rate: 140
@@ -26070,13 +26070,13 @@ Body:
             Rate: 140
           - Item: C_LittleGarden
             Rate: 140
-          - Item: Costume_Twinkling_Red_Eyes
+          - Item: C_Blinking_Eyes_RD
             Rate: 140
           - Item: C_Blink_Eyes_Sakura
             Rate: 140
-          - Item: Costume_Angola_Intention
+          - Item: C_Angola_Intention
             Rate: 140
-          - Item: C_Stole_Of_Dominion
+          - Item: C_Stall_Of_Dominions
             Rate: 140
           - Item: C_Flowery_Vision_TH
             Rate: 140
@@ -26100,7 +26100,7 @@ Body:
             Rate: 130
           - Item: C_Blessings_Of_Soul
             Rate: 130
-          - Item: C_Crow
+          - Item: C_Gossip_Raven
             Rate: 130
           - Item: C_Halloween_Hat
             Rate: 130
@@ -26118,7 +26118,7 @@ Body:
             Rate: 130
           - Item: C_Gift_Of_Snow
             Rate: 130
-          - Item: C_Large_Ribbon_Muffler_Red
+          - Item: C_L_RibbonMuff_Red
             Rate: 130
           - Item: C_Imperial_Glory
             Rate: 130
@@ -48211,3 +48211,788 @@ Body:
           - Item: Trans_Scroll_Gazeti
           - Item: Trans_Scroll_Kobold_Archer
           - Item: Trans_Scroll_Necromancer
+  - Group: S_W_BREATH_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_W_Breath_Armor
+          - Item: S_W_Breath_Shield
+          - Item: S_W_Breath_Shoes
+  - Group: S_F_BREATH_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_F_Breath_Weapon
+          - Item: S_F_Breath_Pendant
+          - Item: S_F_Breath_Earing
+  - Group: S_SONIC_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Sonic_Armor
+          - Item: S_Sonic_Shield
+          - Item: S_Sonic_Shoes
+  - Group: S_STRAIN_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Strain_Weapon
+          - Item: S_Strain_Pendant
+          - Item: S_Strain_Earing
+  - Group: S_JACK_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Jack_Armor
+          - Item: S_Jack_Shield
+          - Item: S_Jack_Shoes
+  - Group: S_CHAIN_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Chain_Weapon
+          - Item: S_Chain_Pendant
+          - Item: S_Chain_Earing
+  - Group: S_CRIMSON_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Crimson_Armor
+          - Item: S_Crimson_Shield
+          - Item: S_Crimson_Shoes
+  - Group: S_VULCAN_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Vulcan_Armor
+          - Item: S_Vulcan_Shield
+          - Item: S_Vulcan_Shoes
+  - Group: S_BOOMERANG_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Boomerang_Weapon
+          - Item: S_Boomerang_Pendant
+          - Item: S_Boomerang_Earing
+  - Group: S_ARMS_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Arms_Weapon
+          - Item: S_Arms_Pendant
+          - Item: S_Arms_Earing
+  - Group: S_TORNADO_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Tornado_Armor
+          - Item: S_Tornado_Shield
+          - Item: S_Tornado_Shoes
+  - Group: S_DUPLELIGHT_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Duplelight_Armor
+          - Item: S_Duplelight_Shield
+          - Item: S_Duplelight_Shoes
+  - Group: S_MAGNUS_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Magnus_Weapon
+          - Item: S_Magnus_Pendant
+          - Item: S_Magnus_Earing
+  - Group: S_ADORAMUS_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Adoramus_Weapon
+          - Item: S_Adoramus_Pendant
+          - Item: S_Adoramus_Earing
+  - Group: S_JUDEX_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Judex_Armor
+          - Item: S_Judex_Shield
+          - Item: S_Judex_Shoes
+  - Group: S_ROLLING_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Rolling_Armor
+          - Item: S_Rolling_Shield
+          - Item: S_Rolling_Shoes
+  - Group: S_RIPPER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Ripper_Weapon
+          - Item: S_Ripper_Pendant
+          - Item: S_Ripper_Earing
+  - Group: S_SLASH_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Slash_Armor
+          - Item: S_Slash_Shield
+          - Item: S_Slash_Shoes
+  - Group: S_KATAR_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Slash_Armor
+          - Item: S_Slash_Shield
+          - Item: S_Slash_Shoes
+  - Group: S_SHOOTING_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Shooting_Weapon
+          - Item: S_Shooting_Pendant
+          - Item: S_Shooting_Earing
+  - Group: S_ARROW_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Arrow_Armor
+          - Item: S_Arrow_Shield
+          - Item: S_Arrow_Shoes
+  - Group: S_AIMED_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Aimed_Weapon
+          - Item: S_Aimed_Pendant
+          - Item: S_Aimed_Earing
+  - Group: S_CLUSTER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Aimed_Weapon
+          - Item: S_Aimed_Pendant
+          - Item: S_Aimed_Earing
+  - Group: S_BANISH_CANNON_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Banish_Cannon_Armor
+          - Item: S_Banish_Cannon_Shield
+          - Item: S_Banish_Cannon_Shoes
+  - Group: S_BRAND_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Brand_Armor
+          - Item: S_Brand_Shield
+          - Item: S_Brand_Shoes
+  - Group: S_GENESIS_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Genesis_Weapon
+          - Item: S_Genesis_Pendant
+          - Item: S_Genesis_Earing
+  - Group: S_CHAIN_PRESS_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Chain_Press_Weapon
+          - Item: S_Chain_Press_Pendant
+          - Item: S_Chain_Press_Earing
+  - Group: S_GRAVE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Grave_Weapon
+          - Item: S_Grave_Pendant
+          - Item: S_Grave_Earing
+  - Group: S_DUST_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Dust_Armor
+          - Item: S_Dust_Shield
+          - Item: S_Dust_Shoes
+  - Group: S_VARETYR_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Varetyr_Weapon
+          - Item: S_Varetyr_Pendant
+          - Item: S_Varetyr_Earing
+  - Group: S_PSYCHIC_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Psychic_Armor
+          - Item: S_Psychic_Shield
+          - Item: S_Psychic_Shoes
+  - Group: S_SPORE_BOMB_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Spore_Bomb_Armor
+          - Item: S_Spore_Bomb_Shield
+          - Item: S_Spore_Bomb_Shoes
+  - Group: S_CANNON_CART_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Cannon_Cart_Weapon
+          - Item: S_Cannon_Cart_Pendant
+          - Item: S_Cannon_Cart_Earing
+  - Group: S_CRAZY_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Crazy_Weapon
+          - Item: S_Crazy_Pendant
+          - Item: S_Crazy_Earing
+  - Group: S_CART_TORNADO_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Cart_Tornado_Armor
+          - Item: S_Cart_Tornado_Shield
+          - Item: S_Cart_Tornado_Shoes
+  - Group: S_KNUCKLEARROW_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Knucklearrow_Armor
+          - Item: S_Knucklearrow_Shield
+          - Item: S_Knucklearrow_Shoes
+  - Group: S_SKYNETBLOW_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Skynetblow_Weapon
+          - Item: S_Skynetblow_Pendant
+          - Item: S_Skynetblow_Earing
+  - Group: S_RAMPAGE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Rampage_Armor
+          - Item: S_Rampage_Shield
+          - Item: S_Rampage_Shoes
+  - Group: S_TIGERCANNON_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_TigerCannon_Weapon
+          - Item: S_Tigercannon_Pendant
+          - Item: S_Tigercannon_Earing
+  - Group: S_MENACE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Menace_Armor
+          - Item: S_Menace_Shield
+          - Item: S_Menace_Shoes
+  - Group: S_SHADOWSPELL_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Shadowspell_Weapon
+          - Item: S_Shadowspell_Pendant
+          - Item: S_Shadowspell_Earing
+  - Group: S_TRIANGLE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Triangle_Armor
+          - Item: S_Triangle_Shield
+          - Item: S_Triangle_Shoes
+  - Group: S_PAINT_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Paint_Weapon
+          - Item: S_Paint_Pendant
+          - Item: S_Paint_Earing
+  - Group: S_RAINSTORM_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Rainstorm_Armor
+          - Item: S_Rainstorm_Shield
+          - Item: S_Rainstorm_Shoes
+  - Group: S_METALIC_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Metalic_Armor
+          - Item: S_Metalic_Shield
+          - Item: S_Metalic_Shoes
+  - Group: S_ARROWVULCAN_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Arrowvulcan_Weapon
+          - Item: S_Arrowvulcan_Pendant
+          - Item: S_Arrowvulcan_Earing
+  - Group: S_REVERBERATION_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Reverberation_Weapon
+          - Item: S_Reverberation_Pendant
+          - Item: S_Reverberation_Earing
+  - Group: S_MOONLIGHT_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Moonlight_Earring
+          - Item: S_Moonlight_Pendant
+          - Item: S_Moonlight_Shoes
+  - Group: S_SUNSHINE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Sunshine_Weapon
+          - Item: S_Sunshine_Shield
+          - Item: S_Sunshine_Armor
+  - Group: S_STARDUST_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Stardust_Weapon
+          - Item: S_Stardust_Shield
+          - Item: S_Stardust_Armor
+  - Group: S_S_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_S_Weapon
+          - Item: S_S_Shield
+          - Item: S_S_Armor
+  - Group: S_EVILCURSE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Evilcurse_Earring
+          - Item: S_Evilcurse_Pendant
+          - Item: S_Evilcurse_Shoes
+  - Group: S_SYURIKEN_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Syuriken_Earing
+          - Item: S_Syuriken_Pendant
+          - Item: S_Syuriken_Shoes
+  - Group: S_KUNAI_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Kunai_Weapon
+          - Item: S_Kunai_Shield
+          - Item: S_Kunai_Armor
+  - Group: S_HUUSOUKA_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Huusouka_Earing
+          - Item: S_Huusouka_Pendant
+          - Item: S_Huusouka_Shoes
+  - Group: S_KAMAENRAKU_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Kamaenraku_Weapon
+          - Item: S_Kamaenraku_Shield
+          - Item: S_Kamaenraku_Armor
+  - Group: S_GOD_HAMMER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_God_Hammer_Weapon
+          - Item: S_God_Hammer_Shield
+          - Item: S_God_Hammer_Armor
+  - Group: S_SHATTER_BUSTER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Shatter_Buster_Earing
+          - Item: S_Shatter_B_Pendant
+          - Item: S_Shatter_Buster_Shoes
+  - Group: S_TAIL_DRAGON_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Tail_Dragon_Weapon
+          - Item: S_Tail_Dragon_Shield
+          - Item: S_Tail_Dragon_Armor
+  - Group: S_TRIP_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Trip_Weapon
+          - Item: S_Trip_Shield
+          - Item: S_Trip_Armor
+  - Group: S_FLARE_DANCE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Flare_Dance_Earing
+          - Item: S_Flare_Dance_Pendant
+          - Item: S_Flare_Dance_Shoes
+  - Group: S_SUPER_MAGIC_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Super_Magic_Shield
+          - Item: S_Super_Magic_Armor
+          - Item: S_Super_Magic_Shoes
+  - Group: S_SUPER_POWER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Super_Power_Weapon
+          - Item: S_Super_Power_Pendant
+          - Item: S_Super_Power_Earing
+  - Group: S_SILVERVINE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Silvervine_Earing
+          - Item: S_Silvervine_Pendant
+          - Item: S_Silvervine_Shoes
+  - Group: S_CATNIP_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Catnip_Weapon
+          - Item: S_Catnip_Shield
+          - Item: S_Catnip_Armor
+  - Group: S_SAVAGERABBIT_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_SavageRabbit_Earing
+          - Item: S_SavageRabbit_Pendant
+          - Item: S_SavageRabbit_Shoes
+  - Group: S_PICKYRUSH_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Pickyrush_Weapon
+          - Item: S_Pickyrush_Shield
+          - Item: S_Pickyrush_Armor
+  - Group: S_RUNEKNIGHT_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Swordman_earring
+          - Item: S_Swordman_Pendant
+          - Item: S_Knight_Shoes
+          - Item: S_Knight_Armor
+          - Item: S_Runeknight_Weapon
+          - Item: S_Runeknight_Shield
+  - Group: S_ROYALGUARD_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Swordman_earring
+          - Item: S_Swordman_Pendant
+          - Item: S_Crusader_Shoes
+          - Item: S_Crusader_Armor
+          - Item: S_Royalguard_Weapon
+          - Item: S_Royalguard_Shield
+  - Group: S_WARLOCK_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Magician_earring
+          - Item: S_Magician_Pendant
+          - Item: S_Wizard_Shoes
+          - Item: S_Wizard_Armor
+          - Item: S_Warlock_Weapon
+          - Item: S_Warlock_Shield
+  - Group: S_SORCERER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Magician_earring
+          - Item: S_Magician_Pendant
+          - Item: S_Sage_Shoes
+          - Item: S_Sage_Armor
+          - Item: S_Sorcerer_Weapon
+          - Item: S_Sorcerer_Shield
+  - Group: S_MECHANIC_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Merchant_earring
+          - Item: S_Merchant_Pendant
+          - Item: S_Blacksmith_Shoes
+          - Item: S_Blacksmith_Armor
+          - Item: S_Mechanic_weapon
+          - Item: S_Mechanic_Shield
+  - Group: S_GENERIC_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Merchant_earring
+          - Item: S_Merchant_Pendant
+          - Item: S_Alchemist_Shoes
+          - Item: S_Alchemist_Armor
+          - Item: S_Genetic_Weapon
+          - Item: S_Genetic_Shield
+  - Group: S_ARCHBISHOP_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Acolyte_earring
+          - Item: S_Acolyte_Pendant
+          - Item: S_Priest_Shoes
+          - Item: S_Priest_Armor
+          - Item: S_Archbishop_Weapon
+          - Item: S_Archbishop_Shield
+  - Group: S_SURA_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Acolyte_earring
+          - Item: S_Acolyte_Pendant
+          - Item: S_Monk_Shoes
+          - Item: S_Monk_Armor
+          - Item: S_Sura_weapon
+          - Item: S_Sura_Shield
+  - Group: S_GUILLOTINECROSS_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Thief_Pendant
+          - Item: S_Assassin_Shoes
+          - Item: S_Assassin_Armor
+          - Item: S_Guillotine_Weapon
+          - Item: S_Guillotine_Shield
+          - Item: S_Thief_earring
+  - Group: S_SHADOWCHASER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Thief_Pendant
+          - Item: S_Rogue_Shoes
+          - Item: S_Rogue_Armor
+          - Item: S_Shadowchaser_Weapon
+          - Item: S_Shadowchaser_Shield
+          - Item: S_Thief_earring
+  - Group: S_RANGER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Archer_Pendant
+          - Item: S_Hunter_Shoes
+          - Item: S_Hunter_Armor
+          - Item: S_Ranger_Weapon
+          - Item: S_Ranger_Shield
+          - Item: S_Archer_earring
+  - Group: S_WANDERER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Archer_Pendant
+          - Item: S_Dancer_Shoes
+          - Item: S_Dancer_Armor
+          - Item: S_Wanderer_Weapon
+          - Item: S_Wanderer_Shield
+          - Item: S_Archer_earring
+  - Group: S_MINSTREL_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Archer_Pendant
+          - Item: S_Bard_Shoes
+          - Item: S_Bard_Armor
+          - Item: S_Minstrel_Weapon
+          - Item: S_Minstrel_Shield
+          - Item: S_Archer_earring
+  - Group: S_STAR_EMPEROR_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Taekwon_Weapon
+          - Item: S_Taekwon_Shield
+          - Item: S_Star_Emperor_Armor
+          - Item: S_Star_Emperor_Shoes
+  - Group: S_SOUL_REAPER_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Taekwon_Weapon
+          - Item: S_Taekwon_Shield
+          - Item: S_Soul_Reaper_Armor
+          - Item: S_Soul_Reaper_Shoes
+  - Group: S_KAGEROU_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Ninja_Weapon
+          - Item: S_Ninja_Shield
+          - Item: S_Kagerou_Armor
+          - Item: S_Kagerou_Shoes
+  - Group: S_OBORO_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Ninja_Weapon
+          - Item: S_Ninja_Shield
+          - Item: S_Oboro_Armor
+          - Item: S_Oboro_Shoes
+  - Group: S_REBELLION_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Gunslinger_Weapon
+          - Item: S_Gunslinger_Shield
+          - Item: S_Rebellion_Armor
+          - Item: S_Rebellion_Shoes
+  - Group: S_SUPERNOVICE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_SuperNovice_Weapon
+          - Item: S_SuperNovice_Shield
+  - Group: S_DORAM_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_DoramMagical_Weapon
+          - Item: S_DoramPhysical_Weapon
+          - Item: S_DoramPhysical_Shield
+          - Item: S_DoramMagical_Shield
+          - Item: S_DoramPhysical_Armor
+          - Item: S_DoramPhysical_Shoes
+          - Item: S_DoramMagical_Armor
+          - Item: S_DoramMagical_Shoes
+  - Group: S_MAMMOTH_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Mammoth_Armor
+          - Item: S_Mammoth_Shoes
+          - Item: S_Mammoth_Pendant
+          - Item: S_Mammoth_Earring
+          - Item: S_Mammoth_Weapon
+          - Item: S_Mammoth_Shield
+  - Group: S_GEMSTONE_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Gemstone_Armor
+          - Item: S_Gemstone_Shoes
+          - Item: S_Gemstone_Shield
+          - Item: S_Gemstone_Weapon
+          - Item: S_Gemstone_Earring
+          - Item: S_Gemstone_Pendent
+  - Group: S_PENE1_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Penetration_Earring
+          - Item: S_Penetration_Pendent
+          - Item: S_Exe_Ho_Weapon
+          - Item: S_Fis_In_Weapon
+          - Item: S_Sci_Hu_Weapon
+          - Item: S_Viv_Dr_Weapon
+          - Item: S_Exo_Co_Weapon
+  - Group: S_PENE2_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Penetration_Shoes
+          - Item: S_Penetration_Shield
+          - Item: S_ExeHoly_Armor
+          - Item: S_ExoCorrupt_Armor
+          - Item: S_DragonVib_Armor
+          - Item: S_SciHunting_Armor
+          - Item: S_FishInsect_Armor
+  - Group: S_TEMP1_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Tempest_Earring
+          - Item: S_Tempest_Pendent
+          - Item: S_M_Exo_Co_Weapon
+          - Item: S_M_Viv_Dr_Weapon
+          - Item: S_M_Sci_Hu_Weapon
+          - Item: S_M_Fis_In_Weapon
+          - Item: S_M_Exe_Ho_Weapon
+  - Group: S_TEMP2_CUBE
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: S_Tempest_Shield
+          - Item: S_Tempest_Shoes
+          - Item: S_M_ExeHoly_Armor
+          - Item: S_M_ExoCorrupt_Armor
+          - Item: S_M_DragonVib_Armor
+          - Item: S_M_SciHunting_Armor
+          - Item: S_M_FishInsect_Armor
+  - Group: BLACKSMITH_BLESS_BOX_3
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Blacksmith_Blessing
+            Amount: 3
+  - Group: SHADOW_HAMMER_BOX_3
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Shadow_Refine_Hammer
+            Amount: 3
+  - Group: EDP
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Poison_Bottle
+          - Item: Poison_Bottle_B
+  - Group: MF_NOTELEPORT
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Wing_Of_Fly
+          - Item: Giant_Fly_Wing
+          - Item: N_Fly_Wing
+          - Item: E_Giant_Fly_Wing
+          - Item: F_Giant_Fly_Wing
+          - Item: C_Wing_Of_Fly
+          - Item: N_Fly_Wing_
+          - Item: Compressed_Wing_Of_Fly
+          - Item: Comp_Wing_Of_Fly
+  - Group: MF_NORETURN
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Wing_Of_Butterfly
+          - Item: N_Butterfly_Wing
+          - Item: Dun_Tele_Scroll1
+          - Item: Dun_Tele_Scroll2
+          - Item: Dun_Tele_Scroll3
+          - Item: E_Dun_Tele_Scroll1
+          - Item: F_Dun_Tele_Scroll1
+          - Item: WOB_Rune
+          - Item: E_WOB_Rune
+          - Item: F_WOB_Rune
+          - Item: WOB_Schwaltz
+          - Item: E_WOB_Schwaltz
+          - Item: F_WOB_Schwaltz
+          - Item: WOB_Rachel
+          - Item: E_WOB_Rachel
+          - Item: F_WOB_Rachel
+          - Item: WOB_Local
+          - Item: E_WOB_Local
+          - Item: F_WOB_Local
+          - Item: Siege_Teleport_Scroll
+          - Item: Siege_Teleport_Scroll2
+          - Item: E_Siege_Teleport_Scroll
+  - Group: GIANT_FLY_WING
+    SubGroups:
+      - SubGroup: 0
+        List:
+          - Item: Giant_Fly_Wing
+          - Item: E_Giant_Fly_Wing
+          - Item: F_Giant_Fly_Wing

+ 23 - 23
db/re/laphine_synthesis.yml

@@ -1387,7 +1387,7 @@ Body:
         Amount: 10
       - Item: Frozen_Stone_Fragment
         Amount: 10
-      - Item: Spirit_Jewel
+      - Item: SpritJewel
         Amount: 10
       - Item: Snowball
         Amount: 10
@@ -1419,7 +1419,7 @@ Body:
         Amount: 10
       - Item: Fine_Old_Doll
         Amount: 10
-      - Item: Old_Shell
+      - Item: OldShell
         Amount: 10
       - Item: Ein_SOLIDDUST
         Amount: 10
@@ -1602,7 +1602,7 @@ Body:
       - Item: C_Charleston_Antenna
       - Item: C_Wings_of_Uriel
       - Item: C_Pig_Nose
-      - Item: C_Cat_Ears_Hat
+      - Item: C_Cat_Ear_Hat
       - Item: C_Valkyrie_Circlet
       - Item: C_Eremes_Scarf_Black
       - Item: C_Eleanor_Wig
@@ -1738,13 +1738,13 @@ Body:
       - Item: C_Big_Foxtail
       - Item: C_T_Bear_Bag
       - Item: C_Poring_On_Shoulder
-      - Item: Costume_Yawata_Seal
+      - Item: C_FortunetellinSealed
       - Item: C_Pretty_Bear_WH
       - Item: C_Bicolor_Cat_Witch_Hat
       - Item: C_Nifl_Bloom
       - Item: C_Floating_Ball_TW
       - Item: C_Dark_Snake_Lord_Stall
-      - Item: Costume_Twin_Cannon
+      - Item: C_Twin_Canon
       - Item: C_Picnic_Basket
       - Item: C_Magic_Helm
       - Item: C_ManyStars_TW
@@ -1773,13 +1773,13 @@ Body:
       - Item: C_Disapear_Time_TW
       - Item: C_Magic_Heir_TW
       - Item: C_Blink_Eyes_Sakura
-      - Item: Costume_Angola_Intention
-      - Item: C_Stole_Of_Dominion
+      - Item: C_Angola_Intention
+      - Item: C_Stall_Of_Dominions
       - Item: C_Flowery_Vision_TH
       - Item: C_Frill_Collar
       - Item: C_Rose_Gothic_Bonnet
       - Item: C_LittleGarden
-      - Item: Costume_Twinkling_Red_Eyes
+      - Item: C_Blinking_Eyes_RD
       - Item: C_P_Ulysses_Feather
       - Item: C_DancingButterfly_TW
       - Item: C_Blue_Pencil_In_Mouth
@@ -1790,7 +1790,7 @@ Body:
       - Item: C_Frog_Hood
       - Item: C_Lude_Hood
       - Item: C_Blessings_Of_Soul
-      - Item: C_Crow
+      - Item: C_Gossip_Raven
       - Item: C_Halloween_Hat
       - Item: C_Blessed_Veil
       - Item: C_Eyes_Of_Ifrit
@@ -1799,7 +1799,7 @@ Body:
       - Item: C_Wildcat_Knit_Cap
       - Item: C_Pink_Fur_Hat
       - Item: C_Gift_Of_Snow
-      - Item: C_Large_Ribbon_Muffler_Red
+      - Item: C_L_RibbonMuff_Red
       - Item: C_Imperial_Glory
       - Item: C_Black_Shiba_Inu_Hat
       - Item: C_Black_Glasses
@@ -3272,11 +3272,11 @@ Body:
 #    RewardGroup: ENCHANTSTONE_RECIPE_3M
 #    Requirements:
 #      - Item: C_Pretty_Bear_WH
-#      - Item: Costume_Yawata_Seal
+#      - Item: C_FortunetellinSealed
 #      - Item: C_Floating_Ball_TW
 #      - Item: C_Dark_Snake_Lord_Stall
 #      - Item: C_Bicolor_Cat_Witch_Hat
-#      - Item: Costume_Twin_Cannon
+#      - Item: C_Twin_Canon
 #      - Item: C_Picnic_Basket
 #      - Item: C_Magic_Helm
 #      - Item: C_Fawn_Ear
@@ -3291,7 +3291,7 @@ Body:
 #      - Item: C_Frill_Collar
 #      - Item: C_Rose_Gothic_Bonnet
 #      - Item: C_LittleGarden
-#      - Item: Costume_Twinkling_Red_Eyes
+#      - Item: C_Blinking_Eyes_RD
 #  - Item: Egirnion_Box
 #    RewardGroup: EGIRNION_BOX
 #    Requirements:
@@ -3700,11 +3700,11 @@ Body:
 #      - Item: S_AllMighty_Pendant
 #      - Item: S_Tempest_Shield
 #      - Item: S_Tempest_Shoes
-#      - Item: S_Magic_Executioner_Holy_Water_Armor
-#      - Item: S_Magic_Exorcist_Corrupted_Armor
-#      - Item: S_Magic_Vibration_Dragon_Killer_Armor
-#      - Item: S_Magic_Scissor_Hunting_Armor
-#      - Item: S_Magic_Fishing_Insect_Net_Armor
+#      - Item: S_M_ExeHoly_Armor
+#      - Item: S_M_ExoCorrupt_Armor
+#      - Item: S_M_DragonVib_Armor
+#      - Item: S_M_SciHunting_Armor
+#      - Item: S_M_FishInsect_Armor
 #      - Item: S_Plasterer's_Armor_II
 #      - Item: S_Insomniac_Shoes_II
 #      - Item: S_Peerless_Armor_II
@@ -3728,11 +3728,11 @@ Body:
 #      - Item: S_Mortal_Blow_Pendant
 #      - Item: S_Penetration_Shoes
 #      - Item: S_Penetration_Shield
-#      - Item: S_Executioner_Holy_Water_Armor
-#      - Item: S_Exorcist_Corrupted_Armor
-#      - Item: S_Vibration_Dragon_Killer_Armor
-#      - Item: S_Scissor_Hunting_Armor
-#      - Item: S_Fishing_Insect_Net_Armor
+#      - Item: S_ExeHoly_Armor
+#      - Item: S_ExoCorrupt_Armor
+#      - Item: S_DragonVib_Armor
+#      - Item: S_SciHunting_Armor
+#      - Item: S_FishInsect_Armor
 #      - Item: Sentimental_Weapone_S
 #      - Item: Sentimental_Earring_S
 #      - Item: Sentimental_Pendant_S

+ 8 - 8
db/re/laphine_upgrade.yml

@@ -60,7 +60,7 @@ Body:
 #      - Item: Ein_1HSWORD
 #      - Item: Ein_1HGUN
 #      - Item: Ein_1H_Foxtail
-  - Item: Metal_Smelting_Ticket
+  - Item: Metal_Rifine_Ticket
     ResultRefine: 7
     CardsAllowed: true
     TargetItems:
@@ -74,7 +74,7 @@ Body:
       - Item: Metal_Bow
       - Item: Metal_Two_Hand_Sword
       - Item: Metal_Revolver
-      - Item: Huuma_Metal_Shuriken
+      - Item: Metal_Huuma_Shuriken
       - Item: Metal_Foxtail
 #  - Item: Ein_Ddbox2
 #    TargetItems:
@@ -2657,21 +2657,21 @@ Body:
     TargetItems:
       - Item: Boost_TH_Sword
       - Item: Boost_Katar
-      - Item: Boost_Mace
+      - Item: Boost_Hall
       - Item: Boost_Staff
       - Item: Boost_Bow
       - Item: Boost_Spear
       - Item: Boost_Sword
       - Item: Boost_Dagger
-      - Item: Boost_Spellbook
+      - Item: Boost_Spl_Book
       - Item: Boost_Guitar
-      - Item: Boost_Knuckles
+      - Item: Boost_Knuckle
       - Item: Boost_Whip
       - Item: Boost_Nindo
       - Item: Boost_Gatling
       - Item: Boost_Axe
-      - Item: Boost_Book
-      - Item: Boost_Rod
+      - Item: Boost_Text
+      - Item: Boost_Soul_Rod
       - Item: Boost_Foxtail
   - Item: Metal_7_Ticket
     ResultRefine: 7
@@ -2689,7 +2689,7 @@ Body:
       - Item: Metal_Bow
       - Item: Metal_Foxtail
       - Item: Metal_Revolver
-      - Item: Huuma_Metal_Shuriken
+      - Item: Metal_Huuma_Shuriken
   - Item: Noblesse_Rifine_Ticket
     ResultRefine: 9
     CardsAllowed: true

+ 0 - 3
db/re/skill_db.yml

@@ -10516,9 +10516,6 @@ Body:
           Amount: 90
         - Level: 5
           Amount: 100
-      ItemCost:
-        - Item: Poison_Bottle
-          Amount: 1
     Status: Edp
   - Id: 379
     Name: ASC_BREAKER

+ 93 - 0
db/re/status.yml

@@ -254,6 +254,7 @@ Body:
       NoSave: true
       NoClearance: true
       SpreadEffect: true
+      RemoveOnHermode: true
     Fail:
       Refresh: true
       Inspiration: true
@@ -282,6 +283,7 @@ Body:
       BossResist: true
       Debuff: true
       NoSaveInfinite: true
+      RemoveOnHermode: true
     EndOnStart:
       Freeze: true
       Stone: true
@@ -307,6 +309,7 @@ Body:
       Quicken: true
     Flags:
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Decreaseagi: true
   - Status: Concentrate
@@ -317,6 +320,7 @@ Body:
       Dex: true
     Flags:
       FailedMado: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Hiding
@@ -367,6 +371,7 @@ Body:
       Atk_Ele: true
     Flags:
       RemoveOnUnequipWeapon: true
+      RemoveOnHermode: true
     EndOnStart:
       Aspersio: true
       Fireweapon: true
@@ -378,6 +383,8 @@ Body:
   - Status: Poisonreact
     Icon: EFST_POISONREACT
     DurationLookup: AS_POISONREACT
+    Flags:
+      RemoveOnHermode: true
   - Status: Quagmire
     Icon: EFST_QUAGMIRE
     DurationLookup: WZ_QUAGMIRE
@@ -390,6 +397,7 @@ Body:
       NoSave: true
       NoClearance: true
       Debuff: true
+      RemoveOnHermode: true
     Fail:
       Speedup1: true
     EndOnStart:
@@ -418,6 +426,7 @@ Body:
       Angelus: true
     Flags:
       SendOption: true
+      RemoveOnHermode: true
   - Status: Blessing
     Icon: EFST_BLESSING
     DurationLookup: AL_BLESSING
@@ -429,6 +438,7 @@ Body:
     Flags:
       BossResist: true
       TaekwonAngel: true
+      RemoveOnHermode: true
   - Status: Signumcrucis
     Icon: EFST_CRUCIS
     DurationLookup: AL_CRUCIS
@@ -449,6 +459,7 @@ Body:
     Flags:
       FailedMado: true
       TaekwonAngel: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
     EndOnStart:
@@ -464,6 +475,7 @@ Body:
       BossResist: true
       NoSave: true
       Debuff: true
+      RemoveOnHermode: true
     Fail:
       Speedup1: true
     EndOnStart:
@@ -482,6 +494,7 @@ Body:
     DurationLookup: PR_SLOWPOISON
     Flags:
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Impositio
     Icon: EFST_IMPOSITIO
     DurationLookup: PR_IMPOSITIO
@@ -490,6 +503,7 @@ Body:
       Matk: true
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
     EndOnStart:
       Impositio: true
   - Status: Suffragium
@@ -497,6 +511,7 @@ Body:
     DurationLookup: PR_SUFFRAGIUM
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
   - Status: Aspersio
     Icon: EFST_ASPERSIO
     DurationLookup: PR_ASPERSIO
@@ -504,6 +519,7 @@ Body:
       Atk_Ele: true
     Flags:
       RemoveOnUnequipWeapon: true
+      RemoveOnHermode: true
     EndOnStart:
       Encpoison: true
       Fireweapon: true
@@ -522,11 +538,13 @@ Body:
       NoSave: true
       NoClearance: true
       #RemoveOnUnequipArmor: true
+      RemoveOnHermode: true
   - Status: Kyrie
     Icon: EFST_KYRIE
     DurationLookup: PR_KYRIE
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
   - Status: Magnificat
     Icon: EFST_MAGNIFICAT
     DurationLookup: PR_MAGNIFICAT
@@ -536,6 +554,7 @@ Body:
       FailedMado: true
       NoSave: true
       SuperNoviceAngel: true
+      RemoveOnHermode: true
     EndOnStart:
       Offertorium: true
   - Status: Gloria
@@ -545,11 +564,13 @@ Body:
       Luk: true
     Flags:
       SuperNoviceAngel: true
+      RemoveOnHermode: true
   - Status: Aeterna
     Icon: EFST_LEXAETERNA
     DurationLookup: PR_LEXAETERNA
     Flags:
       NoSave: true
+      RemoveOnHermode: true
     Fail:
       Stone: true
       Freeze: true
@@ -562,6 +583,7 @@ Body:
     Flags:
       MadoCancel: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
       Decreaseagi: true
@@ -570,6 +592,7 @@ Body:
     DurationLookup: BS_WEAPONPERFECT
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
   - Status: Overthrust
     Icon: EFST_OVERTHRUST
     DurationLookup: BS_OVERTHRUST
@@ -577,6 +600,7 @@ Body:
       OverThrust: true
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
     Fail:
       Maxoverthrust: true
   - Status: Maximizepower
@@ -586,6 +610,7 @@ Body:
       Regen: true
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
   - Status: Trickdead
     Icon: EFST_TRICKDEAD
     DurationLookup: NV_TRICKDEAD
@@ -605,6 +630,7 @@ Body:
       NoSave: true
       NoClearance: true
       RemoveOnChangeMap: true
+      RemoveOnHermode: true
     EndOnStart:
       Dancing: true
   - Status: Loud
@@ -612,6 +638,7 @@ Body:
     DurationLookup: MC_LOUD
     Flags:
       MadoCancel: true
+      RemoveOnHermode: true
     CalcFlags:
       Str: true
       Batk: true
@@ -620,6 +647,8 @@ Body:
     DurationLookup: MG_ENERGYCOAT
     Opt3:
       EnergyCoat: true
+    Flags:
+      RemoveOnHermode: true
   - Status: Brokenarmor
     Icon: EFST_BROKENARMOR
     DurationLookup: NPC_ARMORBRAKE
@@ -672,12 +701,14 @@ Body:
     Flags:
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Aspdpotion2
     Icon: EFST_ATTHASTE_POTION3
     CalcFlags:
       Aspd: true
     Flags:
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Aspdpotion3
     Icon: EFST_ATTHASTE_INFINITY
     CalcFlags:
@@ -685,6 +716,7 @@ Body:
     Flags:
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Speedup0
     Icon: EFST_MOVHASTE_HORSE
     CalcFlags:
@@ -702,6 +734,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Atkpotion
     Icon: EFST_PLUSATTACKPOWER
     CalcFlags:
@@ -710,6 +743,7 @@ Body:
       NoRemoveOnDead: true
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Matkpotion
     Icon: EFST_PLUSMAGICPOWER
     CalcFlags:
@@ -718,6 +752,7 @@ Body:
       NoRemoveOnDead: true
       NoClearance: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
   - Status: Wedding
     States:
       NoAttack: true
@@ -760,6 +795,8 @@ Body:
     CalcFlags:
       Mdef: true
       Def: true
+    Flags:
+      RemoveOnHermode: true
   - Status: Stripweapon
     Icon: EFST_NOEQUIPWEAPON
     DurationLookup: RG_STRIPWEAPON
@@ -772,6 +809,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Stripshield
     Icon: EFST_NOEQUIPSHIELD
     DurationLookup: RG_STRIPSHIELD
@@ -784,6 +822,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Striparmor
     Icon: EFST_NOEQUIPARMOR
     DurationLookup: RG_STRIPARMOR
@@ -796,6 +835,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Striphelm
     Icon: EFST_NOEQUIPHELM
     DurationLookup: RG_STRIPHELM
@@ -808,6 +848,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Cp_Weapon
     Icon: EFST_PROTECTWEAPON
     DurationLookup: AM_CP_WEAPON
@@ -817,6 +858,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Cp_Shield
     Icon: EFST_PROTECTSHIELD
     DurationLookup: AM_CP_SHIELD
@@ -826,6 +868,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Cp_Armor
     Icon: EFST_PROTECTARMOR
     DurationLookup: AM_CP_ARMOR
@@ -835,6 +878,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Cp_Helm
     Icon: EFST_PROTECTHELM
     DurationLookup: AM_CP_HELM
@@ -844,18 +888,21 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       RemoveChemicalProtect: true
+      RemoveOnHermode: true
   - Status: Autoguard
     Icon: EFST_AUTOGUARD
     DurationLookup: CR_AUTOGUARD
     Flags:
       NoClearance: true
       RequireShield: true
+      RemoveOnHermode: true
   - Status: Reflectshield
     Icon: EFST_REFLECTSHIELD
     DurationLookup: CR_REFLECTSHIELD
     Flags:
       NoClearance: true
       RequireShield: true
+      RemoveOnHermode: true
     EndOnStart:
       Reflectdamage: true
   - Status: Splasher
@@ -868,6 +915,7 @@ Body:
       All: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Defender
     Icon: EFST_DEFENDER
     DurationLookup: CR_DEFENDER
@@ -876,11 +924,13 @@ Body:
       Aspd: true
     Flags:
       RequireShield: true
+      RemoveOnHermode: true
   - Status: Magicrod
     Icon: EFST_MAGICROD
     DurationLookup: SA_MAGICROD
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Spellbreaker
     Flags:
       NoWarning: true
@@ -914,6 +964,7 @@ Body:
     Flags:
       FailedMado: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Autocounter
@@ -968,6 +1019,7 @@ Body:
       Debuff: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
   - Status: Combo
     Flags:
       NoClearbuff: true
@@ -998,6 +1050,7 @@ Body:
       NoSave: true
       NoClearance: true
       RemoveOnChangeMap: true
+      RemoveOnHermode: true
   - Status: Fireweapon
     Icon: EFST_PROPERTYFIRE
     DurationLookup: SA_FLAMELAUNCHER
@@ -1067,6 +1120,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Deluge
     Icon: EFST_GROUNDMAGIC
     DurationLookup: SA_DELUGE
@@ -1126,6 +1180,7 @@ Body:
     Flags:
       NoSave: true
       RequireWeapon: true
+      RemoveOnHermode: true
   - Status: Parrying
     Icon: EFST_PARRYING
     DurationLookup: LK_PARRYING
@@ -1133,6 +1188,7 @@ Body:
       NoSave: true
       NoClearance: true
       RequireWeapon: true
+      RemoveOnHermode: true
   - Status: Concentration
     Icon: EFST_LKCONCENTRATION
     DurationLookup: LK_CONCENTRATION
@@ -1143,6 +1199,7 @@ Body:
       Quicken: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Tensionrelax
     Icon: EFST_TENSIONRELAX
     DurationLookup: LK_TENSIONRELAX
@@ -1151,6 +1208,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Berserk
     Icon: EFST_BERSERK
     DurationLookup: LK_BERSERK
@@ -1191,6 +1249,7 @@ Body:
       Aspd: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Assumptio
     Icon: EFST_ASSUMPTIO2
     DurationLookup: HP_ASSUMPTIO
@@ -1200,6 +1259,8 @@ Body:
       Assumptio: true
     EndOnStart:
       Kaite: true
+    Flags:
+      RemoveOnHermode: true
   - Status: Basilica
     Icon: EFST_BASILICA_BUFF
     DurationLookup: HP_BASILICA
@@ -1210,6 +1271,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Guildaura
     Flags:
       NoDispell: true
@@ -1222,6 +1284,7 @@ Body:
       Matk: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
     EndOnStart:
       Magicpower: true
   - Status: Edp
@@ -1248,6 +1311,7 @@ Body:
     Flags:
       FailedMado: true
       NoSave: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Windwalk
@@ -1259,6 +1323,7 @@ Body:
     Flags:
       FailedMado: true
       NoSave: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
   - Status: Meltdown
@@ -1351,6 +1416,7 @@ Body:
       Debuff: true
       NoClearance: true
       NoSave: true
+      RemoveOnHermode: true
     EndOnStart:
       Blessing: true
       Increaseagi: true
@@ -1366,6 +1432,7 @@ Body:
       NoSave: true
       NoClearance: true
       Debuff: true
+      RemoveOnHermode: true
   - Status: Mindbreaker
     Icon: EFST_MINDBREAKER
     DurationLookup: PF_MINDBREAKER
@@ -1375,6 +1442,7 @@ Body:
     Flags:
       NoSave: true
       Debuff: true
+      RemoveOnHermode: true
     EndOnStart:
       Freeze: true
       Stone: true
@@ -1384,6 +1452,7 @@ Body:
     DurationLookup: PF_MEMORIZE
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Fogwall
     Icon: EFST_FOGWALL
     DurationLookup: PF_FOGWALL
@@ -1391,6 +1460,7 @@ Body:
       BossResist: true
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Spiderweb
     Icon: EFST_SPIDERWEB
     DurationLookup: PF_SPIDERWEB
@@ -1413,6 +1483,7 @@ Body:
       NoSave: true
       RemoveOnChangeMap: true
       OverlapIgnoreLevel: true
+      RemoveOnHermode: true
     EndOnEnd:
       Autoguard: true
       Defender: true
@@ -1420,6 +1491,8 @@ Body:
       Endure: true
   - Status: Sacrifice
     DurationLookup: PA_SACRIFICE
+    Flags:
+      RemoveOnHermode: true
   - Status: Steelbody
     Icon: EFST_STEELBODY
     DurationLookup: MO_STEELBODY
@@ -1432,6 +1505,7 @@ Body:
       Speed: true
     Flags:
       NoSave: true
+      RemoveOnHermode: true
     Opt3:
       SteelBody: true
   - Status: Orcish
@@ -1496,6 +1570,7 @@ Body:
       NoSave: true
       NoClearance: true
       RemoveOnChangeMap: true
+      RemoveOnHermode: true
   - Status: Shadowweapon
     Icon: EFST_PROPERTYDARK
     DurationLookup: TK_SEVENWIND
@@ -1504,6 +1579,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Encpoison: true
       Aspersio: true
@@ -1521,6 +1597,7 @@ Body:
       MadoCancel: true
       NoSave: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Quagmire: true
       Decreaseagi: true
@@ -1532,6 +1609,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Encpoison: true
       Aspersio: true
@@ -1549,6 +1627,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Kaahi: true
   - Status: Kaupe
@@ -1557,6 +1636,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Onehand
     Icon: EFST_ONEHANDQUICKEN
     DurationLookup: KN_ONEHAND
@@ -1568,6 +1648,7 @@ Body:
       NoSave: true
       NoClearance: true
       RequireWeapon: true
+      RemoveOnHermode: true
     Fail:
       Decreaseagi: true
     EndOnStart:
@@ -1580,6 +1661,7 @@ Body:
     DurationLookup: ST_PRESERVE
     Flags:
       NoSave: true
+      RemoveOnHermode: true
   - Status: Battleorders
     Icon: EFST_GDSKILL_BATTLEORDER
     DurationLookup: GD_BATTLEORDER
@@ -1603,6 +1685,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Maxoverthrust
     Icon: EFST_OVERTHRUSTMAX
     DurationLookup: WS_OVERTHRUSTMAX
@@ -1612,6 +1695,7 @@ Body:
       MadoCancel: true
       NoSave: true
       RemoveOnUnequipWeapon: true
+      RemoveOnHermode: true
     EndOnStart:
       Overthrust: true
   - Status: Hermode
@@ -1964,6 +2048,7 @@ Body:
       NoClearance: true
       RemoveOnChangeMap: true
       Debuff: true
+      RemoveOnHermode: true
   - Status: Spurt
     Icon: EFST_STRUP
     DurationLookup: TK_RUN
@@ -1973,6 +2058,7 @@ Body:
       NoSave: true
       NoClearance: true
       RequireWeapon: true
+      RemoveOnHermode: true
   - Status: Spirit
     Icon: EFST_SOULLINK
     DurationLookup: SL_HIGH
@@ -1984,6 +2070,7 @@ Body:
       NoClearance: true
       NoSave: true
       NoBanishingBuster: true
+      RemoveOnHermode: true
     Fail:
       Soulgolem: true
       Soulshadow: true
@@ -2336,6 +2423,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
     EndOnStart:
       Assumptio: true
   - Status: Swoo
@@ -2433,6 +2521,7 @@ Body:
       NoClearance: true
       NoBanishingBuster: true
       NoDispell: true
+      RemoveOnHermode: true
   - Status: Bunsinjyutsu
     Icon: EFST_NJ_BUNSINJYUTSU
     DurationLookup: NJ_BUNSINJYUTSU
@@ -2443,6 +2532,7 @@ Body:
     Flags:
       NoSave: true
       NoClearance: true
+      RemoveOnHermode: true
   - Status: Kaensin
     Flags:
       NoWarning: true
@@ -2557,6 +2647,7 @@ Body:
       SendVal1: true
       OverlapIgnoreLevel: true
       RemoveOnUnequipWeapon: true
+      RemoveOnHermode: true
     EndOnStart:
       Enchantarms: true
       Aspersio: true
@@ -6022,6 +6113,7 @@ Body:
       RemoveOnChangeMap: true
       NoBanishingBuster: true
       NoDispell: true
+      RemoveOnHermode: true
   - Status: Extremityfist2
     Icon: EFST_EXTREMITYFIST
     DurationLookup: MO_EXTREMITYFIST
@@ -6668,6 +6760,7 @@ Body:
     Flags:
       NoRemoveOnDead: true
       NoClearbuff: true
+      RemoveOnHermode: true
   - Status: Geffen_Magic2
     Icon: EFST_GEFFEN_MAGIC2
     CalcFlags:

+ 2 - 1
doc/status.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= rAthena Dev Team
 //===== Last Updated: ========================================
-//= 20221013
+//= 20221216
 //===== Description: =========================================
 //= Explanation of the status.yml file and structure.
 //============================================================
@@ -232,6 +232,7 @@ Flags: Various status flags for specific status change events.
 	RemoveOnUnequip       - Removed when unequipping any type of equipment.
 	RemoveOnUnequipWeapon - Removed when unequipping a weapon.
 	RemoveOnUnequipArmor  - Removed when unequipping an armor.
+	RemoveOnHermode       - Removed by CG_HERMODE.
 
 	StopAttacking         - Makes the unit stop attacking.
 	StopCasting           - Makes the unit stop casting skills.

+ 221 - 133
npc/custom/warper.txt

@@ -127,13 +127,14 @@ function Restrict {
 	Towns:
 // --------------------------------------------------
 menu	"Prontera",T1, "Alberta",T2, "Aldebaran",T3, "Amatsu",T4, "Ayothaya",T5,
-    	"Brasilis",T6, "Comodo",T7, "Dewata",T8, "Eclage",T9, "Einbech",T10, 
-    	"Einbroch",T11, "El Dicastes",T12, "Geffen",T13, "Kunlun",T14, "Hugel",T15,
-    	"Izlude",T16, "Jawaii",T17, "Lasagna",T18, "Lighthalzen",T19, "Luoyang",T20,
-		"Lutie",T21, "Malangdo",T22, "Malaya",T23, "Manuk",T24,
-		"Midgarts Expedition Camp",T25, "Mora",T26, "Morocc",T27, "Moscovia",T28,
-		"Nameless Island",T29, "Niflheim",T30, "Payon",T31, "Rachel",T32, "Splendide",T33,
-		"Thor Camp",T34, "Umbala",T35, "Veins",T36, "Juno",T37;
+    	"Brasilis",T6, "Comodo",T7, "Dewata",T8, "Eclage",T9, "Einbech",T10,
+		"Einbroch",T11, "El Dicastes",T12, "Geffen",T13, "Hugel",T14, "Ice Castle",T15,
+		"Izlude",T16, "Jawaii",T17, "Juno",T18, "Kunlun",T19, "Lasagna",T20,
+		"Lighthalzen",T21, "Luoyang",T22, "Lutie",T23, "Malangdo",T24, "Malaya",T25,
+		"Manuk",T26, "Midgarts Expedition Camp",T27, "Mora",T28, "Morocc",T29, "Moscovia",T30,
+		"Nameless Island (Day)",T31, "Nameless Island (Night)",T32, "Niflheim",T33, "Payon",T34, "Rachel",T35,
+		"Rockridge",T36, "Special Security Area, Cor",T37, "Splendide",T38, "Thor Camp",T39, "Umbala",T40,
+		"Varmundt's Mansion",T41, "Veins",T42, "Verus Findspot",T43, "Wolf Village",T44;
 
 T1: Go("prontera",155,183);
 T2: Go("alberta",28,234);
@@ -152,34 +153,47 @@ T11: Go("einbroch",64,200);
 T12: Restrict("RE");
 	 Go("dicastes01",198,187);
 T13: Go("geffen",119,59);
-T14: Go("gonryun",160,120);
-T15: Go("hugel",96,145);
+T14: Go("hugel",96,145);
+T15: Restrict("RE");
+	 Go("icecastle",185,212);
 T16: Go("izlude",128,(checkre(3)?146:114));
 T17: Go("jawaii",251,132);
-T18: Restrict("RE");
+T18: Go("yuno",157,51);
+T19: Go("gonryun",160,120);
+T20: Restrict("RE");
 	 Go("lasagna",193,182);
-T19: Go("lighthalzen",158,92);
-T20: Go("louyang",217,100);
-T21: Go("xmas",147,134);
-T22: Restrict("RE");
+T21: Go("lighthalzen",158,92);
+T22: Go("louyang",217,100);
+T23: Go("xmas",147,134);
+T24: Restrict("RE");
 	 Go("malangdo",140,114);
-T23: Restrict("RE");
+T25: Restrict("RE");
 	 Go("malaya",231,200);
-T24: Go("manuk",282,138);
-T25: Go("mid_camp",210,288);
-T26: Restrict("RE");
+T26: Go("manuk",282,138);
+T27: Go("mid_camp",210,288);
+T28: Restrict("RE");
 	 Go("mora",55,146);
-T27: Go("morocc",156,93);
-T28: Go("moscovia",223,184);
-T29: Go("nameless_n",256,215);
-T30: Go("niflheim",202,174);
-T31: Go("payon",179,100);
-T32: Go("rachel",130,110);
-T33: Go("splendide",201,147);
-T34: Go("thor_camp",246,68);
-T35: Go("umbala",97,153);
-T36: Go("veins",216,123);
-T37: Go("yuno",157,51);
+T29: Go("morocc",156,93);
+T30: Go("moscovia",223,184);
+T31: Go("nameless_i",256,215);
+T32: Go("nameless_n",256,215);
+T33: Go("niflheim",202,174);
+T34: Go("payon",179,100);
+T35: Go("rachel",130,110);
+T36: Restrict("RE");
+	 Go("harboro1",298,206);
+T37: Restrict("RE");
+	 Go("sp_cor",160,166);
+T38: Go("splendide",201,147);
+T39: Go("thor_camp",246,68);
+T40: Go("umbala",97,153);
+T41: Restrict("RE");
+	Go("ba_maison",72,146);
+T42: Go("veins",216,123);
+T43: Restrict("RE");
+	 Go("verus04",123,250);
+T44: Restrict("RE");
+	 Go("wolfvill",144,144);
 
 // --------------------------------------------------
 	Fields:
@@ -188,13 +202,14 @@ T37: Go("yuno",157,51);
 menu	"Amatsu Fields",F1, "Ayothaya Fields",F2, "Bifrost Fields", F3,
     	"Brasilis Fields",F4, "Comodo Fields",F5, "Dewata Fields",F6,
     	"Eclage Fields",F7, "Einbroch Fields",F8, "El Dicastes Fields",F9,
-    	"Geffen Fields",F10, "Kunlun Fields",F11, "Hugel Fields",F12,
-		"Lasagna Fields",F13, "Lighthalzen Fields",F14, "Luoyang Field",F15, 
-		"Lutie Field",F16, "Malaya Fields",F17, "Manuk Fields",F18, 
-		"Mjolnir Fields",F19, "Moscovia Fields",F20, "Niflheim Fields",F21, 
-		"Payon Forests",F22, "Prontera Fields",F23, "Rachel Fields",F24, 
-		"Sograt Deserts",F25, "Splendide Fields",F26, "Umbala Fields",F27, 
-		"Veins Fields",F28, "Juno Fields",F29;
+    	"Frozen Scale Fields",F10, "Geffen Fields",F11, "Grey Wolf Forest",F12,
+		"Hugel Fields",F13, "Juno Fields",F14, "Kiwawa Desert",F15,
+		"Kunlun Fields",F16, "Lasagna Fields",F17, "Lighthalzen Fields",F18,
+		"Luoyang Field",F19, "Lutie Field",F20, "Malaya Fields",F21,
+		"Manuk Fields",F22, "Mjolnir Fields",F23, "Moscovia Fields",F24,
+		"Niflheim Fields",F25, "Payon Forests",F26, "Prontera Fields",F27,
+		"Rachel Fields",F28, "Sograt Deserts",F29, "Splendide Fields",F30,
+		"Umbala Fields",F31, "Veins Fields",F32;
 
 F1: setarray @c[2],190,197;
 	Disp("Amatsu Field",1,1); Pick("ama_fild");
@@ -221,43 +236,55 @@ F8: Restrict("Pre-RE",2,10);
 F9: Restrict("RE");
 	setarray @c[2],143,132,143,217;
 	Disp("El Dicastes Field",1,2); Pick("dic_fild");
-F10: Restrict("Pre-RE",13,15);
+F10: Restrict("RE");
+	 setarray @c[2],378,223,223,18,365,241,140,280;
+	 Disp("Frozen Scale Hill:Frozen Scale Plains:Frozen Scale Glacier:Frozen Tail"); Pick("","jor_back1","jor_back2","jor_back3","jor_tail");
+F11: Restrict("Pre-RE",13,15);
 	 setarray @c[0],46,199,213,204,195,212,257,192,188,171,166,263,248,158,195,191,186,183,221,117,178,218,136,328,240,181,235,235,211,185;
 	 Disp("Geffen Field",0,14); Pick("gef_fild",1);
-F11: setarray @c[2],220,227;
-	 Disp("Kunlun Field",1,1); Pick("gon_fild");
-F12: Restrict("Pre-RE",3,7);
+F12: Restrict("RE");
+	 setarray @c[2],22,315,122,388;
+	 Disp("Grey Wolf Forest",1,2); Pick("gw_fild");
+F13: Restrict("Pre-RE",3,7);
 	 setarray @c[2],268,101,222,193,232,185,252,189,196,106,216,220,227,197;
 	 Disp("Hugel Field",1,7); Pick("hu_fild");
-F13: Restrict("RE");
+F14: Restrict("Pre-RE",5,10);
+	 setarray @c[2],189,224,192,207,221,157,226,199,223,177,187,232,231,174,196,203,183,214,200,124,195,226,210,304;
+	 Disp("Juno Field",1,12); Pick("yuno_fild");
+F15: Restrict("RE");
+	 setarray @c[2],38,246,31,207;
+	 Disp("Kiwawa Desert",1,2); Pick("","rockrdg1","rockrdg2");
+F16: setarray @c[2],220,227;
+	 Disp("Kunlun Field",1,1); Pick("gon_fild");
+F17: Restrict("RE");
 	 setarray @c[2],344,371,20,98;
 	 Disp("Lasagna Field",1,2); Pick("lasa_fild");	 
-F14: setarray @c[2],240,179,185,235,240,226;
+F18: setarray @c[2],240,179,185,235,240,226;
 	 Disp("Lighthalzen Field",1,3); Pick("lhz_fild");
-F15: setarray @c[2],229,187;
+F19: setarray @c[2],229,187;
 	 Disp("Luoyang Field",1,1); Pick("lou_fild");
-F16: setarray @c[2],115,145;
+F20: setarray @c[2],115,145;
 	 Disp("Lutie Field",1,1); Pick("xmas_fild");
-F17: Restrict("RE");
+F21: Restrict("RE");
 	 setarray @c[2],40,272,207,180;
 	 Disp("Malaya Field",1,2); Pick("ma_fild");
-F18: setarray @c[2],35,236,35,262,84,365;
+F22: setarray @c[2],35,236,35,262,84,365;
 	 Disp("Manuk Field",1,3); Pick("man_fild");
-F19: setarray @c[2],204,120,175,193,208,213,179,180,181,240,195,270,235,202,188,215,205,144,245,223,180,206,196,208;
+F23: setarray @c[2],204,120,175,193,208,213,179,180,181,240,195,270,235,202,188,215,205,144,245,223,180,206,196,208;
 	 Disp("Mjolnir Field",1,12); Pick("mjolnir_");
-F20: setarray @c[2],82,104,131,147;
+F24: setarray @c[2],82,104,131,147;
 	 Disp("Moscovia Field",1,2); Pick("mosk_fild");
-F21: setarray @c[2],215,229,167,234;
+F25: setarray @c[2],215,229,167,234;
 	 Disp("Niflheim Field",1,2); Pick("nif_fild");
-F22: Restrict("Pre-RE",5,11);
+F26: Restrict("Pre-RE",5,11);
 	 setarray @c[2],158,206,151,219,205,148,186,247,134,204,193,235,200,177,137,189,201,224,160,205,194,150;
 	 Disp("Payon Forest",1,11); Pick("pay_fild");
-F23: setarray @c[0],208,227,190,206,240,206,190,143,307,252,239,213,185,188,193,194,187,218,210,183,195,149,198,164;
+F27: setarray @c[0],208,227,190,206,240,206,190,143,307,252,239,213,185,188,193,194,187,218,210,183,195,149,198,164;
 	 Disp("Prontera Field",0,11); Pick("prt_fild",1);
-F24: Restrict("Pre-RE",2,7,9,10,11,13);
+F28: Restrict("Pre-RE",2,7,9,10,11,13);
 	 setarray @c[2],192,162,235,166,202,206,202,208,225,202,202,214,263,196,217,201,87,121,277,181,221,185,175,200,174,197;
 	 Disp("Rachel Field",1,13); Pick("ra_fild");
-F25: if(.Satan_Morocc){
+F29: if(.Satan_Morocc){
 	 setarray @c[2],219,205,177,206,194,182,224,170,198,216,156,187,185,263,206,228,208,238,209,223,85,97,207,202,31,195,38,195;
 	 Disp("Sograt Desert 1:Sograt Desert 2:Sograt Desert 3:Sograt Desert 7:Sograt Desert 11:Sograt Desert 12:Sograt Desert 13:Sograt Desert 16:Sograt Desert 17:Sograt Desert 18:Sograt Desert 19:Sograt Desert 20:Sograt Desert 21:Sograt Desert 22");
 	 Pick("","moc_fild01","moc_fild02","moc_fild03","moc_fild07","moc_fild11","moc_fild12","moc_fild13","moc_fild16","moc_fild17","moc_fild18","moc_fild19","moc_fild20","moc_fild21","moc_fild22");
@@ -265,133 +292,194 @@ F25: if(.Satan_Morocc){
 	 setarray @c[2],219,205,177,206,194,182,146,297,204,197,275,302,224,170,139,123,101,110,341,39,198,216,156,187,185,263,223,222,170,257,206,228,208,238,209,223,85,97;
 	 Disp("Sograt Desert",1,19); Pick("moc_fild");
 	 }
-F26: setarray @c[2],175,186,236,184,188,204;
+F30: setarray @c[2],175,186,236,184,188,204;
 	 Disp("Splendide Field",1,3); Pick("spl_fild");
-F27: setarray @c[2],217,206,223,221,237,215,202,197;
+F31: setarray @c[2],217,206,223,221,237,215,202,197;
 	 Disp("Umbala Field",1,4); Pick("um_fild");
-F28: Restrict("Pre-RE",5);
+F32: Restrict("Pre-RE",5);
 	 setarray @c[2],186,175,196,370,222,45,51,250,202,324,150,223,149,307;
 	 Disp("Veins Field",1,7); Pick("ve_fild");
-F29: Restrict("Pre-RE",5,10);
-	 setarray @c[2],189,224,192,207,221,157,226,199,223,177,187,232,231,174,196,203,183,214,200,124,195,226,210,304;
-	 Disp("Juno Field",1,12); Pick("yuno_fild");
 
 // --------------------------------------------------
 	Dungeons:
 // --------------------------------------------------
 @d = true;
-menu	"Abyss Lakes",D1, "Amatsu Dungeon",D2, "Anthell",D3,
-    	"Ayothaya Dungeon",D4, "Beach Dungeon",D5, "Bifrost Tower",D42,
-    	"Bio Labs",D6, "Brasilis Dungeon",D7, "Byalan Dungeon",D8, "Clock Tower",D9,
-    	"Coal Mines",D10, "Culvert",D11, "Cursed Abbey",D12, "Dewata Dungeon",D13,
-    	"Einbroch Dungeon",D14, "Gefenia",D15, "Geffen Dungeon",D16,
-    	"Glast Heim",D17, "Kunlun Dungeon",D18, "Hidden Dungeon",D19,
-    	"Ice Dungeon",D20, "Juperos",D21, "Kiel Dungeon",D22, "Lasagna Dungeon",D23,
-		"Luoyang Dungeon",D24, "Magma Dungeon",D25, "Malangdo Dungeon",D26,
-		"Moscovia Dungeon",D27, "Nidhogg's Dungeon",D28, "Odin Temple",D29,
-		"Orc Dungeon",D30, "Payon Dungeon",D31, "Pyramids",D32, "Rachel Sanctuary",D33,
-    	"Scaraba Hole",D34, "Sphinx",D35, "Sunken Ship",D36, "Thanatos Tower",D37,
-    	"Thor Volcano",D38, "Toy Factory",D39, "Turtle Dungeon",D40, "Umbala Dungeon",D41;
-
-D1: setarray @c[2],261,272,275,270,116,27;
-	Disp("Abyss Lakes",1,3); Pick("abyss_");
-D2: setarray @c[2],228,11,34,41,119,14;
+menu	"Abandoned Lab Amicitia",D1, "Abyss Lakes",D2, "Amatsu Dungeon",D3,
+		"Anthell",D4, "Ayothaya Dungeon",D5, "Beach Dungeon",D6,
+		"Bifrost Tower",D7, "Bio Labs",D8, "Brasilis Dungeon",D9,
+		"Byalan Dungeon",D10, "Clock Tower",D11, "Coal Mines",D12,
+		"Culvert",D13, "Cursed Abbey",D14, "Dewata Dungeon",D15,
+		"Einbroch Dungeon",D16, "Flame Basin",D17, "Gefenia",D18,
+		"Geffen Dungeon",D19, "Glast Heim",D20, "Hidden Dungeon",D21,
+		"Ice Dungeon",D22, "Illusion Dungeon",D23, "Issgard Dungeon",D24,
+		"Juperos",D25, "Kiel Dungeon",D26, "Kunlun Dungeon",D27,
+		"Lasagna Dungeon",D28, "Luoyang Dungeon",D29, "Magma Dungeon",D30,
+		"Malangdo Dungeon",D31, "Moscovia Dungeon",D32, "Nidhogg's Dungeon",D33,
+		"Niflheim Dungeon",D34, "Odin Temple",D35, "Orc Dungeon",D36,
+		"Oz Labyrinth Dungeon",D37, "Payon Dungeon",D38, "Prontera Underground",D39,
+		"Pyramids",D40, "Rachel Sanctuary",D41, "Rock Ridge Dungeon",D42,
+		"Rudus Dungeon",D43, "Scaraba Hole",D44, "Sphinx",D45,
+		"Sunken Ship",D46, "Thanatos Tower",D47, "Thor Volcano",D48,
+		"Toy Factory",D49, "Turtle Dungeon",D50, "Umbala Dungeon",D51,
+		"Varmundt's Dungeon",D52, "Verus Area",D53;
+
+D1: Restrict("RE");
+	setarray @c[2],253,244,145,278;
+	Disp("1st Floor - Comprehensive Lab:2nd Floor - Intensive Culture Room"); Pick("","amicitia1","amicitia2");
+D2: Restrict("RE",4);
+	setarray @c[2],261,272,275,270,116,27,169,159;
+	Disp("Abyss Lakes",1,4); Pick("abyss_");
+D3: setarray @c[2],228,11,34,41,119,14;
 	Disp("Amatsu Dungeon",1,3); Pick("ama_dun");
-D3: setarray @c[2],35,262,168,170;
+D4: setarray @c[2],35,262,168,170;
 	Disp("Anthell",1,2); Pick("anthell");
-D4: setarray @c[2],275,19,24,26;
+D5: setarray @c[2],275,19,24,26;
 	Disp("Ancient Shrine Maze:Inside Ancient Shrine"); Pick("ayo_dun");
-D5: setarray @c[2],266,67,255,244,23,260;
+D6: setarray @c[2],266,67,255,244,23,260;
 	Disp("Beach Dungeon",1,3); Pick("","beach_dun","beach_dun2","beach_dun3");
-D6: Restrict("RE",4);
-	setarray @c[2],150,288,150,18,140,134,244,52;
-	Disp("Bio Lab",1,4); Pick("lhz_dun");
 D7: Restrict("RE");
+	setarray @c[2],57,13,64,88,45,14,26,23;
+	Disp("Bifrost Tower",1,4); Pick("ecl_tdun");
+D8: Restrict("RE",4,5);
+	setarray @c[2],150,288,150,18,140,134,244,52,100,202;
+	Disp("Bio Lab 1:Bio Lab 2:Bio Lab 3:Bio Lab 4:Tomb of the Fallen"); Pick("","lhz_dun01","lhz_dun02","lhz_dun03","lhz_dun04","lhz_dun_n");
+D9: Restrict("RE");
 	setarray @c[2],87,47,262,262;
-	Disp("Brasilis Dungeon",1,2); Pick("bra_dun");
-D8: Restrict("RE",6);
-	setarray @c[0],168,168,253,252,236,204,32,63,26,27,141,187;
-	Disp("Byalan Dungeon",1,6); Pick("iz_dun",1);
-D9: setarray @c[2],199,159,148,283,65,147,56,155,297,25,127,169,277,178,268,74;
-	Disp("Clock Tower 1:Clock Tower 2:Clock Tower 3:Clock Tower 4:Basement 1:Basement 2:Basement 3:Basement 4");
-	Pick("","c_tower1","c_tower2","c_tower3","c_tower4","alde_dun01","alde_dun02","alde_dun03","alde_dun04");
-D10: setarray @c[2],52,17,381,343,302,262;
+D10: Restrict("RE",6);
+	 setarray @c[0],168,168,253,252,236,204,32,63,26,27,141,187;
+	 Disp("Byalan Dungeon",1,6); Pick("iz_dun",1);
+D11: Restrict("RE",9,10,11);
+	 setarray @c[2],199,159,148,283,65,147,56,155,297,25,127,169,277,178,268,74,266,27,60,142,79,39;
+	 Disp("Clock Tower 1:Clock Tower 2:Clock Tower 3:Clock Tower 4:Basement 1:Basement 2:Basement 3:Basement 4:Nightmare Clock Tower, 2nd Floor:Nightmare Clock Tower, 3rd Floor:Unknown Basement");
+	 Pick("","c_tower1","c_tower2","c_tower3","c_tower4","alde_dun01","alde_dun02","alde_dun03","alde_dun04","c_tower2_","c_tower3_","clock_01");
+D12: setarray @c[2],52,17,381,343,302,262;
 	 Disp("Coal Mines",1,3); Pick("mjo_dun");
-D11: setarray @c[2],131,247,19,19,180,169,100,92;
+D13: setarray @c[2],131,247,19,19,180,169,100,92;
 	 Disp("Culvert",1,4); Pick("","prt_sewb1","prt_sewb2","prt_sewb3","prt_sewb4");
-D12: setarray @c[2],51,14,150,11,120,10;
+D14: setarray @c[2],51,14,150,11,120,10;
 	 Disp("Cursed Abbey",1,3); Pick("abbey");
-D13: Restrict("RE");
+D15: Restrict("RE");
 	 setarray @c[2],285,160,299,29;
 	 Disp("Dewata Dungeon",1,2); Pick("dew_dun");
-D14: setarray @c[2],22,14,292,290;
-	 Disp("Einbroch Dungeon",1,2); Pick("ein_dun");
-D15: setarray @c[2],40,103,203,34,266,168,130,272;
+D16: Restrict("RE",3);
+	 setarray @c[2],22,14,292,290,269,279;
+	 Disp("Einbroch Dungeon",1,3); Pick("ein_dun");
+D17: Restrict("RE");
+	 Go("moro_vol",97,107);
+D18: setarray @c[2],40,103,203,34,266,168,130,272;
 	 Disp("Gefenia",1,4); Pick("gefenia",0);
-D16: setarray @c[0],104,99,115,236,106,132,203,200;
+D19: setarray @c[0],104,99,115,236,106,132,203,200;
 	 Disp("Geffen Dungeon",1,4); Pick("gef_dun",1);
-D17: setarray @c[2],370,304,199,29,104,25,150,15,157,287,147,15,258,255,108,291,171,283,68,277,156,7,12,7,133,271,224,274,14,70,150,14;
-	 Disp("Entrance:Castle 1:Castle 2:Chivalry 1:Chivalry 2:Churchyard:Culvert 1:Culvert 2:Culvert 3:Culvert 4:St. Abbey:Staircase Dungeon:Underground Cave 1:Underground Cave 2:Underground Prison 1:Underground Prison 2");
-	 Pick("","glast_01","gl_cas01","gl_cas02","gl_knt01","gl_knt02","gl_chyard","gl_sew01","gl_sew02","gl_sew03","gl_sew04","gl_church","gl_step","gl_dun01","gl_dun02","gl_prison","gl_prison1");
-D18: setarray @c[2],153,53,28,113,68,16;
-	 Disp("Kunlun Dungeon",1,3); Pick("gon_dun");
-D19: setarray @c[2],176,7,93,20,23,8;
+D20: Restrict("RE",17,18,19);
+	 setarray @c[2],370,304,199,29,104,25,150,15,157,287,147,15,258,255,108,291,171,283,68,277,156,7,12,7,133,271,224,274,14,70,150,14,104,31,148,144,199,29;
+	 Disp("Entrance:Castle 1:Castle 2:Chivalry 1:Chivalry 2:Churchyard:Culvert 1:Culvert 2:Culvert 3:Culvert 4:St. Abbey:Staircase Dungeon:Underground Cave 1:Underground Cave 2:Underground Prison 1:Underground Prison 2:Castle 2 - Nightmare Mode:Churchyard - Nightmare Mode:Abyss Glastheim Castle F1");
+	 Pick("","glast_01","gl_cas01","gl_cas02","gl_knt01","gl_knt02","gl_chyard","gl_sew01","gl_sew02","gl_sew03","gl_sew04","gl_church","gl_step","gl_dun01","gl_dun02","gl_prison","gl_prison1","gl_cas02_","gl_chyard_","gl_cas01_");
+D21: setarray @c[2],99,31,93,20,182,88;
 	 Disp("Hidden Dungeon",1,3); Pick("prt_maze");
-D20: setarray @c[2],157,14,151,155,149,22,33,158;
+D22: setarray @c[2],157,14,151,155,149,22,33,158;
 	 Disp("Ice Dungeon",1,4); Pick("ice_dun");
-D21: setarray @c[2],140,51,53,247,37,63,150,285;
-	 Disp("Entrance:Juperos 1:Juperos 2:Core");
-	 Pick("","jupe_cave","juperos_01","juperos_02","jupe_core");
-D22: setarray @c[2],28,226,41,198;
+D23: menu	"Illusion of Abyss",SubD1, "Illusion of Frozen",SubD2, "Illusion of Labyrinth",SubD3,
+			"Illusion of Luanda",SubD4, "Illusion of Moonlight",SubD5, "Illusion of Teddy Bear",SubD6,
+			"Illusion of Twins",SubD7, "Illusion of Underwater",SubD8, "Illusion of Vampire",SubD9;
+	SubD1: Restrict("RE");
+		   setarray @c[2],132,189,100,192;
+		   Disp("Desolate Village:Bleak Turtle Palace"); Pick("","tur_d03_i","tur_d04_i");
+	SubD2: Restrict("RE");
+		   Go("ice_d03_i",149,22);
+	SubD3: Restrict("RE");
+		   Go("prt_mz03_i",100,100);
+	SubD4: Restrict("RE");
+		   Go("com_d02_i",250,245);
+	SubD5: Restrict("RE");
+		   Go("pay_d03_i",140,44);
+	SubD6: Restrict("RE");
+		   Go("ein_d02_i",164,184);
+	SubD7: Restrict("RE");
+		   Go("ant_d02_i",168,170);
+	SubD8: Restrict("RE");
+		   setarray @c[2],130,230,141,188;
+		   Disp("Deep Sea Cave",1,2); Pick("","iz_d04_i","iz_d05_i");
+	SubD9: Restrict("RE");
+		   Go("gef_d01_i",114,216);
+D24: Restrict("RE");
+	 setarray @c[2],112,15,280,87,112,12,274,85;
+	 Disp("Abandoned Pit Floor 1:Abandoned Pit Floor 2:Snake God's Warmth 1st Floor:Snake God's Warmth 2nd Floor"); Pick("","jor_ab01","jor_ab02","jor_dun01","jor_dun02");
+D25: Restrict("RE",5);
+	 setarray @c[2],140,51,53,247,37,63,150,285,146,215;
+	 Disp("Entrance:Juperos 1:Juperos 2:Core:Eastern Ruins of Juperos");
+	 Pick("","jupe_cave","juperos_01","juperos_02","jupe_core","ver_eju");
+D26: setarray @c[2],28,226,41,198;
 	 Disp("Kiel Dungeon",1,2); Pick("kh_dun");
-D23: Restrict("RE");
+D27: setarray @c[2],153,53,28,113,68,16;
+	 Disp("Kunlun Dungeon",1,3); Pick("gon_dun");
+D28: Restrict("RE");
 	 setarray @c[2],24,143,22,171,190,18;
 	 Disp("Lasagna Dungeon",1,3); Pick("lasa_dun");
-D24: setarray @c[2],218,196,282,20,165,38;
+D29: setarray @c[2],218,196,282,20,165,38;
 	 Disp("The Royal Tomb:Inside the Royal Tomb:Suei Long Gon"); Pick("lou_dun");
-D25: setarray @c[2],126,68,47,30;
-	 Disp("Magma Dungeon",1,2); Pick("mag_dun");
-D26: Restrict("RE");
+D30: Restrict("RE",3);
+	 setarray @c[2],126,68,47,30,118,113;
+	 Disp("Magma Dungeon",1,3); Pick("mag_dun");
+D31: Restrict("RE");
 	 setarray @c[2],33,230;
 	 Disp("Malangdo Dungeon",1,1); Pick("mal_dun");
-D27: setarray @c[2],189,48,165,30,32,135;
+D32: setarray @c[2],189,48,165,30,32,135;
 	 Disp("Moscovia Dungeon",1,3); Pick("mosk_dun");
-D28: setarray @c[2],61,239,60,271;
+D33: setarray @c[2],61,239,60,271;
 	 Disp("Nidhogg's Dungeon",1,2); Pick("nyd_dun");
-D29: setarray @c[2],298,167,224,149,266,280;
-	 Disp("Odin Temple",1,3); Pick("odin_tem");
-D30: setarray @c[2],32,170,21,185;
+D34: Restrict("RE");
+	 setarray @c[2],145,90,150,20;
+	 Disp("Niflheim Dungeon - 1st Floor:Niflheim Dungeon - 2nd Floor"); Pick("nif_dun");
+D35: Restrict("RE",4);
+	 setarray @c[2],298,167,224,149,266,280,276,236;
+	 Disp("Odin Temple 1:Odin Temple 2:Odin Temple 3:Odin Past"); Pick("","odin_tem01","odin_tem02","odin_tem03","odin_past");
+D36: setarray @c[2],32,170,21,185;
 	 Disp("Orc Dungeon",1,2); Pick("orcsdun");
-D31: setarray @c[0],21,183,19,33,19,63,155,159,201,204;
+D37: Restrict("RE");
+	 setarray @c[2],21,191,141,277;
+	 Disp("Oz Labyrinth Floor 1:Oz Labyrinth Floor 2"); Pick("oz_dun");
+D38: setarray @c[0],21,183,19,33,19,63,155,159,201,204;
 	 Disp("Payon Dungeon",1,5); Pick("pay_dun",1);
-D32: Restrict("RE",7,8);
+D39: Restrict("RE");
+	 setarray @c[2],159,289,155,353;
+	 Disp("Prontera Underground Prison:Prontera Invasion"); Pick("","prt_prison","prt_q");
+D40: Restrict("RE",7,8);
 	 setarray @c[2],192,9,10,192,100,92,181,11,94,96,192,8,94,96,192,8;
 	 Disp("Pyramids 1:Pyramids 2:Pyramids 3:Pyramids 4:Basement 1:Basement 2:Basement 1 - Nightmare Mode:Basement 2 - Nightmare Mode");
 	 Pick("","moc_pryd01","moc_pryd02","moc_pryd03","moc_pryd04","moc_pryd05","moc_pryd06","moc_prydn1","moc_prydn2");
-D33: setarray @c[2],140,11,32,21,8,149,204,218,150,9;
+D41: setarray @c[2],140,11,32,21,8,149,204,218,150,9;
 	 Disp("Rachel Sanctuary",1,5); Pick("ra_san");
-D34: Restrict("RE");
-	 setarray @c[2],364,44,101,141;
-	 Disp("Scaraba Hole",1,2); Pick("dic_dun");
-D35: setarray @c[2],288,9,149,81,210,54,10,222,100,99;
+D42: Restrict("RE");
+	 setarray @c[2],247,19,281,104;
+	 Disp("Rock Ridge Mine:Underground Waterway Culvert"); Pick("","rockmi1","harboro2");
+D43: Restrict("RE");
+	 setarray @c[2],200,377,185,258,366,207,378,178;
+	 Disp("Rudus Dungeon",1,4); Pick("","sp_rudus","sp_rudus2","sp_rudus3","sp_rudus4");
+D44: Restrict("RE");
+	 setarray @c[2],364,44,101,141,101,141;
+	 Disp("Scaraba Hole",1,3); Pick("dic_dun");
+D45: setarray @c[2],288,9,149,81,210,54,10,222,100,99;
 	 Disp("Sphinx",1,5); Pick("","in_sphinx1","in_sphinx2","in_sphinx3","in_sphinx4","in_sphinx5");
-D36: setarray @c[2],69,24,102,27;
+D46: setarray @c[2],69,24,102,27;
 	 Disp("Sunken Ship",1,2); Pick("treasure");
-D37: setarray @c[2],150,39,150,136,220,158,59,143,62,11,89,221,35,166,93,148,29,107,159,138,19,20,130,52;
+D47: setarray @c[2],150,39,150,136,220,158,59,143,62,11,89,221,35,166,93,148,29,107,159,138,19,20,130,52;
 	 Disp("Thanatos Tower",1,12); Pick("tha_t");
-D38: setarray @c[2],21,228,75,205,34,272;
+D48: setarray @c[2],21,228,75,205,34,272;
 	 Disp("Thor Volcano",1,3); Pick("thor_v");
-D39: setarray @c[2],205,15,129,133;
+D49: setarray @c[2],205,15,129,133;
 	 Disp("Toy Factory",1,2); Pick("xmas_dun");
-D40: setarray @c[2],154,49,148,261,132,189,100,192;
+D50: setarray @c[2],154,49,148,261,132,189,100,192;
 	 Disp("Entrance:Turtle Dungeon 1:Turtle Dungeon 2:Turtle Dungeon 3"); Pick("tur_dun");
-D41: Restrict("Pre-RE",1,2);
+D51: Restrict("Pre-RE",1,2);
 	 setarray @c[2],42,31,48,30,204,78;
 	 Disp("Carpenter's Shop in the Tree:Passage to a Foreign World:Hvergermil's Fountain");
 	 Pick("","um_dun01","um_dun02","yggdrasil01");
-D42: Restrict("RE");
-	 setarray @c[2],57,13,64,88,45,14,26,23;
-	 Disp("Bifrost Tower",1,4); Pick("ecl_tdun");
+D52: Restrict("RE");
+	 setarray @c[2],275,21,15,115,15,115,159,27,162,36,159,11,156,33,337,333,314,64,163,18,156,20,39,81;
+	 Disp("Sewage Treatment Plant:1st Power Plant:2nd Power Plant:Large Bath Meditathio:Lost Farm Valley:Library Memory Corridor:Upper Floor of Tartaros Storage:Lower Floor of Tartaros Storage:Death Rune:Fire Rune:Grass Rune:Ice Rune"); Pick("","ba_pw02","ba_pw01","ba_pw03","ba_bath","ba_lost","ba_lib","ba_2whs01","ba_2whs02","bl_death","bl_lava","bl_grass","bl_ice");
+D53: Restrict("RE");
+	 setarray @c[2],244,61,72,20,122,22;
+	 Disp("Lab-OPTATIO:R&D-WISH:Verus Center Square"); Pick("verus");
 
 // --------------------------------------------------
 	Castles:

+ 0 - 125
npc/merchants/cash_hair.txt

@@ -1,125 +0,0 @@
-//===== rAthena Script ======================================= 
-//= Cash Hair Stylist
-//===== By: ================================================== 
-//= Kisuka
-//===== Current Version: ===================================== 
-//= 1.0
-//===== Compatible With: ===================================== 
-//= rAthena Project
-//===== Description: ========================================= 
-//= Exchange cash item, New_Style_Coupon, for new hair styles.
-//===== Additional Comments: ================================= 
-//= 1.0 First Version. [Kisuka]
-//============================================================
-
-itemmall,19,74,5	script	Stylist#cash	91,{
-	mes "[Stylist]";
-	mes "Hey, I'm Kaniki.";
-	mes "I'm here to start a new";
-	mes "trend by introducing my";
-	mes "special new hairstyles!";
-	mes "Give me a ^FF0000New Style Coupon^000000,";
-	mes "and I'll change your hair~";
-	next;
-	if (Sex == SEX_MALE) {
-		mes "[Kaniki]";
-		mes "I have two special";
-		mes "hairstyles for men, the";
-		mes "Emergency Heal Perm";
-		mes "and the Aura Blade Cut.";
-		mes "and aura blade cut.";
-		next;
-		cutin "hair_m_24.bmp",4;
-		mes "[Kaniki]";
-		mes "This is the Emergency";
-		mes "Heal Perm. It's a brand";
-		mes "new style I invented recently.";
-		mes "What do you think? Cool, huh?";
-		next;
-		cutin "",255;
-		cutin "hair_m_25.bmp",4;
-		mes "[Kaniki]";
-		mes "Now this is the Aura";
-		mes "Blade Cut. You haven't";
-		mes "seen anything like it";
-		mes "before, haven't you?";
-		next;
-		cutin "",255;
-	}else{
-		mes "[Kaniki]";
-		mes "I have two new hairstyles for";
-		mes "women, the Assumptio Perm";
-		mes "and the Soul Changer Cut.";
-		mes "Do you want to see how";
-		mes "these styles look?";
-		next;
-		cutin "hair_f_24.bmp",4;
-		mes "[Kaniki]";
-		mes "This is the Assumptio";
-		mes "Perm. It'd really good";
-		mes "on you, wouldn't it?";
-		next;
-		cutin "",255;
-		cutin "hair_f_25.bmp",4;
-		mes "[Kaniki]";
-		mes "Next is the Soul";
-		mes "Changer Cut. What do";
-		mes "you think? Isn't it nice?";
-		next;
-		cutin "",255;
-	}
-	mes "[Kaniki]";
-	mes "Have you decided";
-	mes "if you'd like me to";
-	mes "change your hairstyle?";
-	next;
-	if(select("Change Hairstyle:Don't Change") == 1) {
-		if (countitem(7622) > 0) {
-			mes "[Kaniki]";
-			mes "Great, you brought";
-			mes "a New Style Coupon!";
-			mes "Alright, which hairstyle";
-			mes "did you want to have?";
-			next;
-			if (Sex == SEX_MALE) {
-				if(select("Emergency Heal Perm:Aura Blade Cut") == 1) {
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,24;
-				}else{
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,25;
-				}
-			}else{
-				if(select("Assumptio Perm:Soul Changer Cut") == 1) {
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,24;
-				}else{
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,25;
-				}
-			}
-			mes "[Kaniki]";
-			mes "There--! It's done!";
-			mes "How do you like your";
-			mes "new hair? Well, I hope";
-			mes "to see you again. Take care!";
-			close;
-		}else{
-			mes "[Kaniki]";
-			mes "I'm sorry, but I can";
-			mes "only provide my hairstyling";
-			mes "service if you bring a New";
-			mes "Style Coupon. Please come";
-			mes "back to me after you manage to";
-			mes "get one of those coupons, okay?";
-			close;
-		}
-	}
-	mes "[Kaniki]";
-	mes "Really? Oh, that's too bad.";
-	mes "Well, if you ever change your";
-	mes "mind about updating your";
-	mes "hairstyle, come back";
-	mes "and let me know, okay?";
-	close;
-}

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

@@ -391,3 +391,8 @@ que_thr	mapflag	nobranch
 // Sunken Tower
 //============================================================
 1@ch_u	mapflag	nobranch
+
+//============================================================
+// Cash Mall
+//============================================================
+itemmall	mapflag	nobranch

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

@@ -486,3 +486,8 @@ wolfvill	mapflag	nomemo
 // Illusion of Twins
 //============================================================
 ant_d02_i	mapflag	nomemo
+
+//============================================================
+// Cash Mall
+//============================================================
+itemmall	mapflag	nomemo

+ 5 - 0
npc/re/mapflag/nopenalty.txt

@@ -107,3 +107,8 @@ lasa_in01	mapflag	nopenalty
 conch_in	mapflag	nopenalty
 
 wolfvill	mapflag	nopenalty
+
+//============================================================
+// Cash Mall
+//============================================================
+itemmall	mapflag	nopenalty

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

@@ -122,3 +122,8 @@ ecl_hub01	mapflag	pvp	off
 que_avan01	mapflag	pvp	off
 dali	mapflag	pvp	off
 wolfvill	mapflag	pvp	off
+
+//============================================================
+// Cash Mall
+//============================================================
+itemmall	mapflag	pvp	off

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

@@ -446,3 +446,9 @@ que_thr	mapflag	noteleport
 1@ch_u	mapflag	noteleport
 1@ch_u	mapflag	monster_noteleport
 1@ch_u	mapflag	monster_noteleport
+
+//============================================================
+// Cash Mall
+//============================================================
+itemmall	mapflag	noteleport
+itemmall	mapflag	monster_noteleport

+ 1 - 0
npc/re/merchants/barters.yml

@@ -54,3 +54,4 @@ Footer:
   - Path: npc/re/merchants/barters/quests_17_1.yml
   - Path: npc/re/merchants/barters/refine.yml
   - Path: npc/re/merchants/barters/enchantgrade.yml
+  - Path: npc/re/merchants/barters/cashmall.yml

+ 1039 - 0
npc/re/merchants/barters/cashmall.yml

@@ -0,0 +1,1039 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2022 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Barter Database
+###########################################################################
+#
+# Barter Settings
+#
+###########################################################################
+#  - Name               NPC name.
+#    Map                Map name. (Default: not on a map)
+#    X                  Map x coordinate. (Default: 0)
+#    Y                  Map y coordinate. (Default: 0)
+#    Direction          Direction the NPC is looking. (Default: North)
+#    Sprite             Sprite name of the NPC. (Default: FakeNpc)
+#    Items:             List of sold items.
+#      - Index          Index of the item inside the shop. (0-...)
+#                       Maximum index depends on client.
+#        Item           Aegis name of the item.
+#        Stock          Amount of item in stock. 0 means unlimited. (Default: 0)
+#        Zeny           Cost of them item in Zeny. (Default: 0)
+#        RequiredItems: List of required items (Optional)
+#          - Index      Index of the required item. (0-4)
+#            Item       Aegis name of required item.
+#            Amount     Amount of required item. (Default: 1)
+#            Refine     Refine level of required item. (Default: 0)
+###########################################################################
+
+Header:
+  Type: BARTER_DB
+  Version: 1
+
+Body:
+###########################################################################
+##= Cachua Coupon Exchanges
+###########################################################################
+  - Name: CachuaCoupon01
+    Items:
+      - Index: 0
+        Item: S_Ignition_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 1
+        Item: S_W_Breath_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 2
+        Item: S_F_Breath_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 3
+        Item: S_Sonic_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 4
+        Item: S_Strain_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 5
+        Item: S_Jack_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 6
+        Item: S_Chain_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 7
+        Item: S_Crimson_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 8
+        Item: S_Vulcan_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 9
+        Item: S_Boomerang_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 10
+        Item: S_Arms_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 11
+        Item: S_Tornado_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 12
+        Item: S_Duplelight_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 13
+        Item: S_Magnus_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 14
+        Item: S_Adoramus_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 15
+        Item: S_Judex_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 16
+        Item: S_Rolling_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 17
+        Item: S_Ripper_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 18
+        Item: S_Slash_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 19
+        Item: S_Katar_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 20
+        Item: S_Shooting_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 21
+        Item: S_Arrow_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 22
+        Item: S_Aimed_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 23
+        Item: S_Cluster_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+  - Name: CachuaCoupon02
+    Items:
+      - Index: 0
+        Item: S_Banish_Cannon_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 1
+        Item: S_Brand_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 2
+        Item: S_Genesis_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 3
+        Item: S_Chain_Press_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 4
+        Item: S_Grave_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 5
+        Item: S_Dust_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 6
+        Item: S_Varetyr_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 7
+        Item: S_Psychic_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 8
+        Item: S_Spore_Bomb_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 9
+        Item: S_Cannon_Cart_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 10
+        Item: S_Crazy_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 11
+        Item: S_Cart_Tornado_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 12
+        Item: S_Knucklearrow_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 13
+        Item: S_Skynetblow_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 14
+        Item: S_Rampage_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 15
+        Item: S_TigerCannon_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 16
+        Item: S_Menace_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 17
+        Item: S_Shadowspell_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 18
+        Item: S_Triangle_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 19
+        Item: S_Paint_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 20
+        Item: S_Rainstorm_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 21
+        Item: S_Metalic_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 22
+        Item: S_Arrowvulcan_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 23
+        Item: S_Reverberation_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+  - Name: CachuaCoupon03
+    Items:
+      - Index: 0
+        Item: S_Moonlight_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 1
+        Item: S_Sunshine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 2
+        Item: S_Stardust_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 3
+        Item: S_S_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 4
+        Item: S_Evilcurse_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 5
+        Item: S_Syuriken_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 6
+        Item: S_Kunai_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 7
+        Item: S_Huusouka_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 8
+        Item: S_Kamaenraku_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 9
+        Item: S_God_Hammer_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 10
+        Item: S_Shatter_Buster_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 11
+        Item: S_Tail_Dragon_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 12
+        Item: S_Trip_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 13
+        Item: S_Flare_Dance_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 14
+        Item: S_Super_Magic_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 15
+        Item: S_Super_Power_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 16
+        Item: S_Silvervine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 17
+        Item: S_Catnip_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 18
+        Item: S_SavageRabbit_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+      - Index: 19
+        Item: S_Pickyrush_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 15
+  - Name: CachuaCoupon04
+    Items:
+      - Index: 0
+        Item: S_RuneKnight_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 1
+        Item: S_RoyalGuard_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 2
+        Item: S_Warlock_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 3
+        Item: S_Sorcerer_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 4
+        Item: S_Mechanic_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 5
+        Item: S_Generic_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 6
+        Item: S_ArchBishop_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 7
+        Item: S_Sura_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 8
+        Item: S_GuillotineCross_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 9
+        Item: S_ShadowChaser_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 10
+        Item: S_Ranger_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 11
+        Item: S_Wanderer_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 12
+        Item: S_Minstrel_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 13
+        Item: S_Star_Emperor_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 14
+        Item: S_Soul_Reaper_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 15
+        Item: S_Kagerou_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 16
+        Item: S_Oboro_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 17
+        Item: S_Rebellion_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 18
+        Item: S_SuperNovice_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 19
+        Item: S_Doram_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 40
+  - Name: CachuaCoupon05
+    Items:
+      - Index: 0
+        Item: S_Mammoth_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 40
+      - Index: 1
+        Item: S_Gemstone_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 40
+      - Index: 2
+        Item: S_Pene1_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 35
+      - Index: 3
+        Item: S_Pene2_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 35
+      - Index: 4
+        Item: S_Temp1_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 35
+      - Index: 5
+        Item: S_Temp2_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 35
+  - Name: CachuaCoupon06
+    Items:
+      - Index: 0
+        Item: Thanos_Refine_Hammer
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 1
+        Item: Thanos_Upgrade_Box
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 30
+      - Index: 2
+        Item: Hero_Weapon_Up_Box_1
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 100
+      - Index: 3
+        Item: Hero_Weapon_Up_Box_2
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 100
+      - Index: 4
+        Item: Hero_Weapon_Up_Box_3
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 100
+      - Index: 5
+        Item: Hero_Weapon_Up_Box_4
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 100
+      - Index: 6
+        Item: Hero_Weapon_Up_Box_5
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 100
+      - Index: 7
+        Item: Hero_Weapon_Up_Box_6
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 100
+      - Index: 8
+        Item: Adulter_Weapon_Up_Box
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 100
+      - Index: 9
+        Item: Hero_Weapon_Hammer_1
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 10
+        Item: Hero_Weapon_Hammer_2
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 11
+        Item: Hero_Weapon_Hammer_3
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 12
+        Item: Hero_Weapon_Hammer_4
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 13
+        Item: Hero_Weapon_Hammer_5
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 14
+        Item: Hero_Weapon_Hammer_6
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      # - Index: 15
+        # Item: OS_Helm_Hammer
+        # RequiredItems:
+          # - Index: 0
+            # Item: Cachua_Coupon
+            # Amount: 50
+      # - Index: 16
+        # Item: OS_Weapon_Hammer
+        # RequiredItems:
+          # - Index: 0
+            # Item: Cachua_Coupon
+            # Amount: 50
+      - Index: 17
+        Item: Poenitentia_Hammer
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 18
+        Item: Barmund_Hammer
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 19
+        Item: Special_Hat_Hammer
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 20
+        Item: Vivatus_Weapon_Hammer
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 21
+        Item: Bio_Helm_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 22
+        Item: Circlet_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 23
+        Item: Bio_Weapon_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 24
+        Item: Auto_Armor_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 25
+        Item: Old_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 26
+        Item: Geffen_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 27
+        Item: Temporal_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 28
+        Item: OS_Weapon_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 29
+        Item: Racecap_Refine_Cube
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 30
+        Item: Blacksmith_Bless_Box_3
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 31
+        Item: Shadow_Hammer_Box_3
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 20
+      - Index: 32
+        Item: Sillit_Pong_Box
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 200
+      - Index: 33
+        Item: Shadow_Exchange_Ticket
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      # - Index: 34
+        # Item: aegis_101399
+        # RequiredItems:
+          # - Index: 0
+            # Item: Cachua_Coupon
+            # Amount: 100
+  - Name: CachuaCoupon07
+    Items:
+      - Index: 0
+        Item: SLD_Card_Recipe
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 50
+      - Index: 1
+        Item: FullPeneShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 2
+        Item: FullTempShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 3
+        Item: Mammoth_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 4
+        Item: True_GemShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 5
+        Item: MajorAutoSpell_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 6
+        Item: Hasty_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 7
+        Item: PhysicalShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 8
+        Item: PerfectSize_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 9
+        Item: EXPShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 10
+        Item: MagicalShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 11
+        Item: InfinityShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 12
+        Item: R_BearersShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 13
+        Item: M_BlitzShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 14
+        Item: AbsorbShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 15
+        Item: ReloadShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+      - Index: 16
+        Item: SpellCasterShadow_Mix
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 75
+  - Name: CachuaCoupon08
+    Items:
+      - Index: 0
+        Item: MajorAutoSpell_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 1
+        Item: Hasty_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 2
+        Item: PhysicalShadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 3
+        Item: PerfectSize_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 4
+        Item: True_GemShadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 5
+        Item: EXPShadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 6
+        Item: MagicalShadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 7
+        Item: InfinityShadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 8
+        Item: R_Bearers_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 9
+        Item: M_Blitz_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 10
+        Item: Absorb_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 11
+        Item: Mammoth_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 12
+        Item: FullPenest_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 13
+        Item: Reload_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 14
+        Item: SpellCaster_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10
+      - Index: 15
+        Item: Ex_Status_Shadow_Up
+        RequiredItems:
+          - Index: 0
+            Item: Cachua_Coupon
+            Amount: 10

+ 331 - 0
npc/re/merchants/cashmall.txt

@@ -0,0 +1,331 @@
+//===== rAthena Script ======================================= 
+//= Cash Mall
+//===== Changelogs: ==========================================
+//= 1.0 Initial version from replays. [Lemongrass]
+//= 1.1 Cash Hair Stylist [Kisuka]
+//= 1.2 Updated Hair Stylist [Lemongrass]
+//============================================================
+
+prontera,137,125,4	script	Cash Sales Guide#prontera::cashmall_warper	4_M_HUMAN_02,{
+	mes "[Guide]";
+	mes "Hello~";
+	mes "This guide wants to be the one to take you to a special place.";
+	mes "What kind of place is that?";
+	next;
+	mes "[Guide]";
+	mes "It's a place full of mysterious items to collect and sell.";
+	mes "To buy stuff there you need special money.";
+	next;
+	mes "[Guide]";
+	mes "So, are you ready to go there?";
+	next;
+	if (select( "Yes", "No" ) == 2) {
+		mes "[Guide]";
+		mes "Okay~";
+		mes "But don't get frustrated.";
+		mes "There's always more chances~";
+		close;
+	}
+	mes "[Guide]";
+	mes "Yeah~ You're really ready.";
+	mes "Well then, get some good stuff~";
+	mes "Oops, I forgot. When you come out be sure to come back here.";
+	mes "Rember this~";
+	close2;
+	setarray .@maparray$[0], "prontera", "morocc", "moc_ruins", "geffen", "payon", "lighthalzen", "rachel";
+	.@return = inarray(.@maparray$[0], strcharinfo(3));
+
+	if (.@return > 0)
+		cashmall_return = .@return;
+	else // Default to Prontera if not found
+		cashmall_return = 0;
+
+	warp "itemmall",22,43;
+	end;
+}
+morocc,164,39,4	duplicate(cashmall_warper)	Cash Sales Guide#morocc	4_M_HUMAN_02
+moc_ruins,115,143,4	duplicate(cashmall_warper)	Cash Sales Guide#moc_ruins	4_M_HUMAN_02
+geffen,115,168,4	duplicate(cashmall_warper)	Cash Sales Guide#geffen	4_M_HUMAN_02
+payon,164,157,4	duplicate(cashmall_warper)	Cash Sales Guide#payon	4_M_HUMAN_02
+lighthalzen,206,144,4	duplicate(cashmall_warper)	Cash Sales Guide#lighthalzen	4_M_HUMAN_02
+rachel,128,144,4	duplicate(cashmall_warper)	Cash Sales Guide#rachel	4_M_HUMAN_02
+
+itemmall,21,45,4	script	Exit Guide#cashmall_exit	4_M_HUMAN_02,{
+	mes "[Guide]";
+	mes "Have you had a good time?";
+	mes "Thank you very much for using our item mall.";
+	mes "We will continue to bring you valuable items.";
+	next;
+	mes "[Guide]";
+	mes "Would you like to return from where you came from?";
+	next;
+	if (select( "Yes", "No" ) == 2) {
+		mes "[Guide]";
+		mes "There are still more things to see.";
+		mes "Have a good time.";
+		close;
+	}
+	mes "[Guide]";
+	mes "Thank you for coming.";
+	mes "I'll send you back from where you came from.";
+	close2;
+	switch(cashmall_return) {
+		default:
+		case 0:
+			.@returnmap$ = "prontera";
+			setarray .@xy[0],116,72;
+			break;
+		case 1:
+			.@returnmap$ = "morocc";
+			setarray .@xy[0],159,46;
+			break;
+		case 2:
+			.@returnmap$ = "moc_ruins";
+			setarray .@xy[0],109,137;
+			break;
+		case 3:
+			.@returnmap$ = "geffen";
+			setarray .@xy[0],120,38;
+			break;
+		case 4:
+			.@returnmap$ = "payon";
+			setarray .@xy[0],161,58;
+			break;
+		case 5:
+			.@returnmap$ = "lighthalzen";
+			setarray .@xy[0],159,95;
+			break;
+		case 6:
+			.@returnmap$ = "rachel";
+			setarray .@xy[0],115,125;
+			break;
+	}
+	cashmall_return = 0;
+	warp .@returnmap$,.@xy[0],.@xy[1];
+	end;
+}
+
+itemmall,41,53,3	script	Cat Hand Salesman Macaroon#cashmall	4_M_MERCAT1,{
+	mes "[Macaroon]";
+	mes "Welcome!";
+	mes "Today doesn't come every day!";
+	mes "Things to see today~ Voila!";
+	mes "You can only exchange with <ITEM>[[Kachua] Mileage Coupon]<INFO>1000274</INFO></ITEM>!";
+	mes "Feel free to choose!";
+	next;
+	switch( select( "3-1st Job Group Skill Shadow", "3-2nd Job Group Skill Shadow", "Extended Job Group Skill Shadow", "General Shadow by Occupation", "Shadow Cube", "Smelting, Modification, Useful Items", "Drop Box", "Spellbook" ) ){
+		case 1:
+			mes "[Macaroon]";
+			mes "^FF00663-1st Job Group Skill Shadow^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon01";
+			end;
+
+		case 2:
+			mes "[Macaroon]";
+			mes "^FF00663-2nd Job Group Skill Shadow^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon02";
+			end;
+
+		case 3:
+			mes "[Macaroon]";
+			mes "^FF0066Extended Job Group Skill Shadow^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon03";
+			end;
+
+		case 4:
+			mes "[Macaroon]";
+			mes "^FF0066General Shadow by Occupation^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon04";
+			end;
+
+		case 5:
+			mes "[Macaroon]";
+			mes "^FF0066Shadow Cube^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon05";
+			end;
+
+		case 6:
+			mes "[Macaroon]";
+			mes "^FF0066Smelting, Modification, Useful Items^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon06";
+			end;
+
+		case 7:
+			mes "[Macaroon]";
+			mes "^FF0066Drop Box^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon07";
+			end;
+
+		case 8:
+			mes "[Macaroon]";
+			mes "^FF0066Spellbook^000000 you say!";
+			mes "Here they are!";
+			close2;
+			callshop "CachuaCoupon08";
+			end;
+	}
+}
+
+itemmall,24,77,4	script	Blacksmith Basta#pr	4_M_DWARF,{
+	if( !getbattleflag( "feature.refineui" ) ){
+		end;
+	}
+
+	mes "[Blacksmith Basta]";
+	mes "I have taken over the work of Mighty Hammer, Brock and the Shadow Blacksmith. I will be busy from now on.";
+	close2;
+	refineui();
+	end;
+}
+
+itemmall,27,77,4	script	Mighty Hammer#im	4_M_DWARF,{
+	mes "[Blacksmith Mighty Hammer]";
+	mes "If it is about refining, ask Basta. I am retired.";
+	close;
+}
+
+itemmall,24,74,5	script	Blacksmith Brock#im	4_M_HUMAN_01,{
+	mes "[Blacksmith Brock]";
+	mes "I am retired now. If it is about refining, make a request to Basta over there.";
+	close;
+}
+
+itemmall,19,74,5	script	Stylist#cash	91,{
+	if( getbattleflag( "feature.stylist" ) ){
+		mes "[Jeremy]";
+		mes "Hello cutie~";
+		mes "I would like you to call me Head Stylist Jeremy.";
+		next;
+		if( select( "Change style:End conversation" ) == 2 ){
+			mes "[Jeremy]";
+			mes "My shop is always open, so please come back anytime.";
+			close;
+		}
+		close2;
+		openstylist();
+		end;
+	}
+
+	mes "[Stylist]";
+	mes "Hey, I'm Kaniki.";
+	mes "I'm here to start a new";
+	mes "trend by introducing my";
+	mes "special new hairstyles!";
+	mes "Give me a ^FF0000New Style Coupon^000000,";
+	mes "and I'll change your hair~";
+	next;
+	if (Sex == SEX_MALE) {
+		mes "[Kaniki]";
+		mes "I have two special";
+		mes "hairstyles for men, the";
+		mes "Emergency Heal Perm";
+		mes "and the Aura Blade Cut.";
+		mes "and aura blade cut.";
+		next;
+		cutin "hair_m_24.bmp",4;
+		mes "[Kaniki]";
+		mes "This is the Emergency";
+		mes "Heal Perm. It's a brand";
+		mes "new style I invented recently.";
+		mes "What do you think? Cool, huh?";
+		next;
+		cutin "",255;
+		cutin "hair_m_25.bmp",4;
+		mes "[Kaniki]";
+		mes "Now this is the Aura";
+		mes "Blade Cut. You haven't";
+		mes "seen anything like it";
+		mes "before, haven't you?";
+		next;
+		cutin "",255;
+	}else{
+		mes "[Kaniki]";
+		mes "I have two new hairstyles for";
+		mes "women, the Assumptio Perm";
+		mes "and the Soul Changer Cut.";
+		mes "Do you want to see how";
+		mes "these styles look?";
+		next;
+		cutin "hair_f_24.bmp",4;
+		mes "[Kaniki]";
+		mes "This is the Assumptio";
+		mes "Perm. It'd really good";
+		mes "on you, wouldn't it?";
+		next;
+		cutin "",255;
+		cutin "hair_f_25.bmp",4;
+		mes "[Kaniki]";
+		mes "Next is the Soul";
+		mes "Changer Cut. What do";
+		mes "you think? Isn't it nice?";
+		next;
+		cutin "",255;
+	}
+	mes "[Kaniki]";
+	mes "Have you decided";
+	mes "if you'd like me to";
+	mes "change your hairstyle?";
+	next;
+	if (select( "Change Hairstyle", "Don't Change" ) == 2) {
+		mes "[Kaniki]";
+		mes "Really? Oh, that's too bad.";
+		mes "Well, if you ever change your";
+		mes "mind about updating your";
+		mes "hairstyle, come back";
+		mes "and let me know, okay?";
+		close;
+	}
+	if (countitem(7622) < 1) {
+		mes "[Kaniki]";
+		mes "I'm sorry, but I can";
+		mes "only provide my hairstyling";
+		mes "service if you bring a New";
+		mes "Style Coupon. Please come";
+		mes "back to me after you manage to";
+		mes "get one of those coupons, okay?";
+		close;
+	}
+	mes "[Kaniki]";
+	mes "Great, you brought";
+	mes "a New Style Coupon!";
+	mes "Alright, which hairstyle";
+	mes "did you want to have?";
+	next;
+	if (Sex == SEX_MALE) {
+		if(select("Emergency Heal Perm", "Aura Blade Cut") == 1) {
+			delitem 7622,1;	// New_Style_Coupon
+			setlook 1,24;
+		}else{
+			delitem 7622,1;	// New_Style_Coupon
+			setlook 1,25;
+		}
+	}else{
+		if(select("Assumptio Perm", "Soul Changer Cut") == 1) {
+			delitem 7622,1;	// New_Style_Coupon
+			setlook 1,24;
+		}else{
+			delitem 7622,1;	// New_Style_Coupon
+			setlook 1,25;
+		}
+	}
+	mes "[Kaniki]";
+	mes "There--! It's done!";
+	mes "How do you like your";
+	mes "new hair? Well, I hope";
+	mes "to see you again. Take care!";
+	close;
+}

+ 2 - 1
npc/re/merchants/enchan_upg.txt

@@ -12,11 +12,12 @@
 //===== Additional Comments: =================================
 //= 1.0 First version.
 //= 1.1 Standardizing, grammar and bug fixes. [Euphy]
+//= 1.2 Moved to Cash Mall [Lemongrass]
 //============================================================
 
 // Main NPC :: 201105_luk_enc
 //============================================================
-prt_in,28,73,3	script	Devil Enchant Master#prq	63,{
+itemmall,29,71,3	script	Devil Enchant Master#prq	63,{
 	disable_items;
 	if (checkweight(1201,1) == 0) {
 		mes "You are carrying too many items, please reduce it and come back again!";

+ 3 - 1
npc/re/merchants/shadow_refiner.txt

@@ -8,6 +8,7 @@
 //= 1.1 Removed re-roll behavior and fetch materials from db
 //=     [Secret]
 //= 1.2 Added Refine UI [Atemo, Lemongrass]
+//= 1.3 Moved to Cash Mall [Lemongrass]
 //============================================================
 -	script	::ShadowBlacksmith	-1,{
 	if( getbattleflag( "feature.refineui" ) ){
@@ -163,4 +164,5 @@
 }
 
 //moc_paraup,45,185,5	duplicate(ShadowBlacksmith)	Shadow Blacksmith#eden1	4_F_JOB_BLACKSMITH // Commented out until it's added to the map index
-prt_in,61,54,3	duplicate(ShadowBlacksmith)	Shadow Blacksmith#itemmall	4_F_JOB_BLACKSMITH
+//prt_in,61,54,3	duplicate(ShadowBlacksmith)	Shadow Blacksmith#itemmall	4_F_JOB_BLACKSMITH
+itemmall,31,76,3	duplicate(ShadowBlacksmith)	Shadow Blacksmith#itemmall	4_F_JOB_BLACKSMITH

+ 6 - 4
npc/re/other/item_merge.txt

@@ -13,9 +13,11 @@
 //===== Additional Comments: =================================
 //= 1.0 First version, currently useless/disabled.
 //= 1.1 Implemented the 'mergeitem' script command. [Cydh]
+//= 1.2 Updated and moved to Cash Mall [Lemongrass]
 //============================================================
 
-prontera,146,95,3	script	Mergician#pron	64,{
+//prontera,146,95,3	script	Mergician#pron	1_M_WIZARD,{
+itemmall,35,75,3	script	Mergician#mall	1_M_WIZARD,{
 	if (checkweight(1301,1) == 0) {
 		mes "- Wait a second !! -";
 		mes "- You are carrying too many items -";
@@ -28,8 +30,8 @@ prontera,146,95,3	script	Mergician#pron	64,{
 	mes "Do you believe in the miracle of Merge god?? If so, repeat my spell loudly as I pronounce it!!!";
 	mes "Merge Merge, Merrrrge!!!";
 	next;
-	switch(select("What is the miracle of Merge?:Merrrrge!!!!:Abandon...")) {
-	case 1:
+	switch(select("Merrrrge!!!!:What is the miracle of Merge?:Abandon...")) {
+	case 2:
 		mes "[Mergician]";
 		mes "There is an order which rules the world and keeps the world to go well.";
 		next;
@@ -47,7 +49,7 @@ prontera,146,95,3	script	Mergician#pron	64,{
 		mes "Believe in Mergism. That is the truth.";
 		mes "Then I can help you be happy and content.";
 		close;
-	case 2:
+	case 1:
 		mes "[Mergician]";
 		mes "This is the total holy ritual to pray to the Great God, Merge! and I am borrowing the power for a while!!";
 		next;

+ 2 - 1
npc/re/scripts_athena.conf

@@ -115,6 +115,7 @@ npc: npc/re/merchants/bio4_reward.txt
 //npc: npc/re/merchants/blessed_refiner.txt
 //npc: npc/re/merchants/card_exchange.txt
 npc: npc/re/merchants/card_separation.txt
+npc: npc/re/merchants/cashmall.txt
 npc: npc/re/merchants/catalog.txt
 npc: npc/re/merchants/clothing_buff_removal.txt
 npc: npc/re/merchants/coin_exchange.txt
@@ -154,7 +155,7 @@ npc: npc/re/merchants/shops.txt
 npc: npc/re/merchants/Slot_Move_Card_Sales.txt
 npc: npc/re/merchants/socket_enchant2.txt
 //npc: npc/re/merchants/ticket_refiner.txt
-//npc: npc/re/merchants/enchan_upg.txt
+npc: npc/re/merchants/enchan_upg.txt
 //npc: npc/re/merchants/cash_trader-idRO.txt
 npc: npc/re/merchants/te_merchant.txt
 npc: npc/re/merchants/shadow_refiner.txt

+ 0 - 1
npc/scripts_athena.conf

@@ -155,7 +155,6 @@ npc: npc/merchants/wander_pet_food.txt
 // - Cash Shop
 //   See file before enabling, as you may wish to change the
 //   point value of items to suit your own needs.
-//npc: npc/merchants/cash_hair.txt
 //npc: npc/merchants/cash_trader.txt
 npc: npc/merchants/cashheadgear_dye.txt
 

+ 10 - 10
sql-files/item_db_re_equip.sql

@@ -5641,11 +5641,11 @@ REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_sha
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24344,'S_Blitz_Armor','Blitz Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,25+5*(.@r/2);\nif (.@r >= 7) {\n   bonus bAspd,1;\n   if (.@r >= 9) {\n      bonus bDelayrate,-1;\n   }\n}');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shield`,`equip_level_min`,`refineable`,`script`) VALUES (24345,'S_Tempest_Shield','Tempest Shadow Shield','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreMdefClassRate,Class_Normal,5+(.@r/2);');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shoes`,`equip_level_min`,`refineable`,`script`) VALUES (24346,'S_Tempest_Shoes','Tempest Shadow Shoes','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreMdefClassRate,Class_Normal,5+(.@r/2);');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24347,'S_Magic_Executioner_Holy_Water_Armor','Magic Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Undead,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24348,'S_Magic_Exorcist_Corrupted_Armor','Magic Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Angel,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24349,'S_Magic_Vibration_Dragon_Killer_Armor','Magic Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Dragon,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24350,'S_Magic_Scissor_Hunting_Armor','Magic Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Brute,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Player_Doram,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24351,'S_Magic_Fishing_Insect_Net_Armor','Magic Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Insect,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24347,'S_M_ExeHoly_Armor','Magic Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Undead,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24348,'S_M_ExoCorrupt_Armor','Magic Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Angel,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24349,'S_M_DragonVib_Armor','Magic Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Dragon,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24350,'S_M_SciHunting_Armor','Magic Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Brute,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Player_Doram,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24351,'S_M_FishInsect_Armor','Magic Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreMdefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreMdefRaceRate,RC_Insect,.@val;');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24352,'S_Plasterer\'s_Armor_II','Plasterer\'s Shadow Armor II','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,1;\nbonus2 bResEff,Eff_Stone,100*.@r;');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shoes`,`equip_level_min`,`refineable`,`script`) VALUES (24353,'S_Insomniac_Shoes_II','Insomniac Shadow Shoes II','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,1;\nbonus2 bResEff,Eff_Sleep,100*.@r;');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24354,'S_Peerless_Armor_II','Peerless Shadow Armor II','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bDef,1;\nbonus2 bResEff,Eff_Silence,100*.@r;');
@@ -5669,11 +5669,11 @@ REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_sha
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_left_accessory`,`equip_level_min`,`refineable`,`script`) VALUES (24372,'S_Mortal_Blow_Pendant','Mortal Blow Shadow Pendant','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nif (.@r >= 9) {\n   .@val = 3;\n} else if (.@r >= 7) {\n   .@val = 2;\n}\nelse {\n   .@val = 1;\n}\nbonus bCritAtkRate,.@val;');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shoes`,`equip_level_min`,`refineable`,`script`) VALUES (24373,'S_Penetration_Shoes','Penetration Shadow Shoes','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreDefClassRate,Class_Normal,5+(.@r/2);');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_shield`,`equip_level_min`,`refineable`,`script`) VALUES (24374,'S_Penetration_Shield','Penetration Shadow Shield','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus2 bIgnoreDefClassRate,Class_Normal,5+(.@r/2);');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24375,'S_Executioner_Holy_Water_Armor','Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Undead,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24376,'S_Exorcist_Corrupted_Armor','Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Angel,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24377,'S_Vibration_Dragon_Killer_Armor','Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Dragon,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24378,'S_Scissor_Hunting_Armor','Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Brute,.@val;');
-REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24379,'S_Fishing_Insect_Net_Armor','Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Insect,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24375,'S_ExeHoly_Armor','Executioner Holy Water Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_DemiHuman,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Undead,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24376,'S_ExoCorrupt_Armor','Exorcist Corrupted Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Demon,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Angel,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24377,'S_DragonVib_Armor','Vibration Dragon Killer Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Formless,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Dragon,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24378,'S_SciHunting_Armor','Scissor Hunting Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Plant,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Brute,.@val;');
+REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_armor`,`equip_level_min`,`refineable`,`script`) VALUES (24379,'S_FishInsect_Armor','Fishing Insect Net Shadow Armor','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\n.@val = 5 + (.@r/2);\nbonus2 bIgnoreDefRaceRate,RC_Fish,.@val;\nbonus2 bIgnoreDefRaceRate,RC_Insect,.@val;');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_weapon`,`equip_level_min`,`refineable`,`script`) VALUES (24380,'Sentimental_Weapone_S','Sentimental Shadow Weapon','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bBaseAtk,.@r;\nbonus bMatk,.@r;\nbonus bMaxSP,10+((.@r/2)*15);');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_right_accessory`,`equip_level_min`,`refineable`,`script`) VALUES (24381,'Sentimental_Earring_S','Sentimental Shadow Earring','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bMaxSP,(.@r/2)*5;\nbonus bMaxSPrate,1;\nbonus bBaseAtk,5;');
 REPLACE INTO `item_db_re` (`id`,`name_aegis`,`name_english`,`type`,`location_shadow_left_accessory`,`equip_level_min`,`refineable`,`script`) VALUES (24382,'Sentimental_Pendant_S','Sentimental Shadow Pendant','Shadowgear',true,1,true,'.@r = getrefine();\nbonus bMaxHP,.@r*10;\nbonus bSPrecovRate,2+.@r/3;\nbonus bBaseAtk,5;');

+ 21 - 0
sql-files/main.sql

@@ -975,6 +975,27 @@ CREATE TABLE IF NOT EXISTS `party` (
   PRIMARY KEY  (`party_id`)
 ) ENGINE=MyISAM;
 
+--
+-- Table structure for table `party_bookings`
+--
+
+CREATE TABLE IF NOT EXISTS `party_bookings` (
+  `world_name` varchar(32) NOT NULL,
+  `account_id` int(11) unsigned NOT NULL,
+  `char_id` int(11) unsigned NOT NULL,
+  `char_name` varchar(23) NOT NULL,
+  `purpose` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `assist` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `damagedealer` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `healer` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `tanker` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `minimum_level` smallint(5) unsigned NOT NULL,
+  `maximum_level` smallint(5) unsigned NOT NULL,
+  `comment` varchar(255) NOT NULL DEFAULT '',
+  `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`world_name`, `account_id`, `char_id`)
+) ENGINE=MyISAM;
+
 --
 -- Table structure for table `pet`
 --

+ 823 - 0
sql-files/upgrades/upgrade_20221218.sql

@@ -0,0 +1,823 @@
+/**
+	ATTENTION!!!
+	Please make sure to create a backup of your live data before running this update.
+	This update is rather complicated and although I have tried my best I cannot guarantee that I did not make any mistake. [Lemongrass]
+	We would also advise you to check the data in the temporary table after the insert statement and before the update statements.
+	You could do so by running
+		select * from `tmp_randomoptionfix` where `new_index` <> `old_index`;
+	to see where changes happen and options will be moved.
+	For executing this update your user needs create table and drop table permissions. Either run the update with another user [admin or root for example] or give your database user these permissions temporarily.
+	Do not forget to remove these permissions again, as they are usually not necessary and it is rather dangerous, if someone gets access to your database user.
+	Additionally if you have more than one storage table (see conf/inter_server.yml) make sure to also update those tables (see instructions at the bottom of this script).
+
+
+
+
+
+
+
+
+	Comment the line below to really run the script, this is a safeguard that you confirm you have read and understood what was written above.
+**/
+cancel;
+
+-- Create a temporary table to store the data for the update
+create table `tmp_randomoptionfix` (
+	`id` int(11) unsigned NOT NULL,
+	`new_index` smallint(5) NOT NULL,
+	`old_index` smallint(5) NOT NULL,
+	`option_id` smallint(5) NOT NULL,
+	`option_val` smallint(5) NOT NULL,
+	`option_parm` tinyint(3) NOT NULL,
+	PRIMARY KEY ( `id`, `old_index` )
+);
+
+-- Create auction data
+insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
+select
+	`id`,
+	row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+from (
+	select * from (
+		select
+				`auction_id` as `id`,
+				0 as `old_index`,
+				`option_id0` as `option_id`,
+				`option_val0` as `option_val`,
+				`option_parm0` as `option_parm`
+			from `auction`
+			where `option_id0` <> 0
+		union
+			select
+				`auction_id` as `id`,
+				1 as `old_index`,
+				`option_id1` as `option_id`,
+				`option_val1` as `option_val`,
+				`option_parm1` as `option_parm`
+			from `auction`
+			where `option_id1` <> 0
+		union
+			select
+				`auction_id` as `id`,
+				2 as `old_index`,
+				`option_id2` as `option_id`,
+				`option_val2` as `option_val`,
+				`option_parm2` as `option_parm`
+			from `auction`
+			where `option_id2` <> 0
+		union
+			select
+				`auction_id` as `id`,
+				3 as `old_index`,
+				`option_id3` as `option_id`,
+				`option_val3` as `option_val`,
+				`option_parm3` as `option_parm`
+			from `auction`
+			where `option_id3` <> 0
+		union
+			select
+				`auction_id` as `id`,
+				4 as `old_index`,
+				`option_id4` as `option_id`,
+				`option_val4` as `option_val`,
+				`option_parm4` as `option_parm`
+			from `auction`
+			where `option_id4` <> 0
+	) t2
+	order by `id`, `old_index`
+) t ;
+
+-- Fix option 0
+update `auction`
+left join `tmp_randomoptionfix`
+on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
+set
+	`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 1
+update `auction`
+left join `tmp_randomoptionfix`
+on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
+set
+	`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 2
+update `auction`
+left join `tmp_randomoptionfix`
+on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
+set
+	`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 3
+update `auction`
+left join `tmp_randomoptionfix`
+on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
+set
+	`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 4
+update `auction`
+left join `tmp_randomoptionfix`
+on `auction`.`auction_id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
+set
+	`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Delete the data to have a clean table for the next run
+delete from `tmp_randomoptionfix`;
+
+-- Create cart_inventory data
+insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
+select
+	`id`,
+	row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+from (
+	select * from (
+		select
+				`id`,
+				0 as `old_index`,
+				`option_id0` as `option_id`,
+				`option_val0` as `option_val`,
+				`option_parm0` as `option_parm`
+			from `cart_inventory`
+			where `option_id0` <> 0
+		union
+			select
+				`id`,
+				1 as `old_index`,
+				`option_id1` as `option_id`,
+				`option_val1` as `option_val`,
+				`option_parm1` as `option_parm`
+			from `cart_inventory`
+			where `option_id1` <> 0
+		union
+			select
+				`id`,
+				2 as `old_index`,
+				`option_id2` as `option_id`,
+				`option_val2` as `option_val`,
+				`option_parm2` as `option_parm`
+			from `cart_inventory`
+			where `option_id2` <> 0
+		union
+			select
+				`id`,
+				3 as `old_index`,
+				`option_id3` as `option_id`,
+				`option_val3` as `option_val`,
+				`option_parm3` as `option_parm`
+			from `cart_inventory`
+			where `option_id3` <> 0
+		union
+			select
+				`id`,
+				4 as `old_index`,
+				`option_id4` as `option_id`,
+				`option_val4` as `option_val`,
+				`option_parm4` as `option_parm`
+			from `cart_inventory`
+			where `option_id4` <> 0
+	) t2
+	order by `id`, `old_index`
+) t ;
+
+-- Fix option 0
+update `cart_inventory`
+left join `tmp_randomoptionfix`
+on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
+set
+	`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 1
+update `cart_inventory`
+left join `tmp_randomoptionfix`
+on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
+set
+	`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 2
+update `cart_inventory`
+left join `tmp_randomoptionfix`
+on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
+set
+	`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 3
+update `cart_inventory`
+left join `tmp_randomoptionfix`
+on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
+set
+	`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 4
+update `cart_inventory`
+left join `tmp_randomoptionfix`
+on `cart_inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
+set
+	`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Delete the data to have a clean table for the next run
+delete from `tmp_randomoptionfix`;
+
+-- Create guild_storage data
+insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
+select
+	`id`,
+	row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+from (
+	select * from (
+		select
+				`id`,
+				0 as `old_index`,
+				`option_id0` as `option_id`,
+				`option_val0` as `option_val`,
+				`option_parm0` as `option_parm`
+			from `guild_storage`
+			where `option_id0` <> 0
+		union
+			select
+				`id`,
+				1 as `old_index`,
+				`option_id1` as `option_id`,
+				`option_val1` as `option_val`,
+				`option_parm1` as `option_parm`
+			from `guild_storage`
+			where `option_id1` <> 0
+		union
+			select
+				`id`,
+				2 as `old_index`,
+				`option_id2` as `option_id`,
+				`option_val2` as `option_val`,
+				`option_parm2` as `option_parm`
+			from `guild_storage`
+			where `option_id2` <> 0
+		union
+			select
+				`id`,
+				3 as `old_index`,
+				`option_id3` as `option_id`,
+				`option_val3` as `option_val`,
+				`option_parm3` as `option_parm`
+			from `guild_storage`
+			where `option_id3` <> 0
+		union
+			select
+				`id`,
+				4 as `old_index`,
+				`option_id4` as `option_id`,
+				`option_val4` as `option_val`,
+				`option_parm4` as `option_parm`
+			from `guild_storage`
+			where `option_id4` <> 0
+	) t2
+	order by `id`, `old_index`
+) t ;
+
+-- Fix option 0
+update `guild_storage`
+left join `tmp_randomoptionfix`
+on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
+set
+	`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 1
+update `guild_storage`
+left join `tmp_randomoptionfix`
+on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
+set
+	`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 2
+update `guild_storage`
+left join `tmp_randomoptionfix`
+on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
+set
+	`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 3
+update `guild_storage`
+left join `tmp_randomoptionfix`
+on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
+set
+	`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 4
+update `guild_storage`
+left join `tmp_randomoptionfix`
+on `guild_storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
+set
+	`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Delete the data to have a clean table for the next run
+delete from `tmp_randomoptionfix`;
+
+-- Create inventory data
+insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
+select
+	`id`,
+	row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+from (
+	select * from (
+		select
+				`id`,
+				0 as `old_index`,
+				`option_id0` as `option_id`,
+				`option_val0` as `option_val`,
+				`option_parm0` as `option_parm`
+			from `inventory`
+			where `option_id0` <> 0
+		union
+			select
+				`id`,
+				1 as `old_index`,
+				`option_id1` as `option_id`,
+				`option_val1` as `option_val`,
+				`option_parm1` as `option_parm`
+			from `inventory`
+			where `option_id1` <> 0
+		union
+			select
+				`id`,
+				2 as `old_index`,
+				`option_id2` as `option_id`,
+				`option_val2` as `option_val`,
+				`option_parm2` as `option_parm`
+			from `inventory`
+			where `option_id2` <> 0
+		union
+			select
+				`id`,
+				3 as `old_index`,
+				`option_id3` as `option_id`,
+				`option_val3` as `option_val`,
+				`option_parm3` as `option_parm`
+			from `inventory`
+			where `option_id3` <> 0
+		union
+			select
+				`id`,
+				4 as `old_index`,
+				`option_id4` as `option_id`,
+				`option_val4` as `option_val`,
+				`option_parm4` as `option_parm`
+			from `inventory`
+			where `option_id4` <> 0
+	) t2
+	order by `id`, `old_index`
+) t ;
+
+-- Fix option 0
+update `inventory`
+left join `tmp_randomoptionfix`
+on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
+set
+	`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 1
+update `inventory`
+left join `tmp_randomoptionfix`
+on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
+set
+	`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 2
+update `inventory`
+left join `tmp_randomoptionfix`
+on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
+set
+	`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 3
+update `inventory`
+left join `tmp_randomoptionfix`
+on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
+set
+	`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 4
+update `inventory`
+left join `tmp_randomoptionfix`
+on `inventory`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
+set
+	`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Delete the data to have a clean table for the next run
+delete from `tmp_randomoptionfix`;
+
+-- Create mail_attachments data
+insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
+select
+	`id`,
+	row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+from (
+	select * from (
+		select
+				`id`,
+				0 as `old_index`,
+				`option_id0` as `option_id`,
+				`option_val0` as `option_val`,
+				`option_parm0` as `option_parm`
+			from `mail_attachments`
+			where `option_id0` <> 0
+		union
+			select
+				`id`,
+				1 as `old_index`,
+				`option_id1` as `option_id`,
+				`option_val1` as `option_val`,
+				`option_parm1` as `option_parm`
+			from `mail_attachments`
+			where `option_id1` <> 0
+		union
+			select
+				`id`,
+				2 as `old_index`,
+				`option_id2` as `option_id`,
+				`option_val2` as `option_val`,
+				`option_parm2` as `option_parm`
+			from `mail_attachments`
+			where `option_id2` <> 0
+		union
+			select
+				`id`,
+				3 as `old_index`,
+				`option_id3` as `option_id`,
+				`option_val3` as `option_val`,
+				`option_parm3` as `option_parm`
+			from `mail_attachments`
+			where `option_id3` <> 0
+		union
+			select
+				`id`,
+				4 as `old_index`,
+				`option_id4` as `option_id`,
+				`option_val4` as `option_val`,
+				`option_parm4` as `option_parm`
+			from `mail_attachments`
+			where `option_id4` <> 0
+	) t2
+	order by `id`, `old_index`
+) t ;
+
+-- Fix option 0
+update `mail_attachments`
+left join `tmp_randomoptionfix`
+on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
+set
+	`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 1
+update `mail_attachments`
+left join `tmp_randomoptionfix`
+on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
+set
+	`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 2
+update `mail_attachments`
+left join `tmp_randomoptionfix`
+on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
+set
+	`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 3
+update `mail_attachments`
+left join `tmp_randomoptionfix`
+on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
+set
+	`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 4
+update `mail_attachments`
+left join `tmp_randomoptionfix`
+on `mail_attachments`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
+set
+	`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Delete the data to have a clean table for the next run
+delete from `tmp_randomoptionfix`;
+
+-- Create storage data
+insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
+select
+	`id`,
+	row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+from (
+	select * from (
+		select
+				`id`,
+				0 as `old_index`,
+				`option_id0` as `option_id`,
+				`option_val0` as `option_val`,
+				`option_parm0` as `option_parm`
+			from `storage`
+			where `option_id0` <> 0
+		union
+			select
+				`id`,
+				1 as `old_index`,
+				`option_id1` as `option_id`,
+				`option_val1` as `option_val`,
+				`option_parm1` as `option_parm`
+			from `storage`
+			where `option_id1` <> 0
+		union
+			select
+				`id`,
+				2 as `old_index`,
+				`option_id2` as `option_id`,
+				`option_val2` as `option_val`,
+				`option_parm2` as `option_parm`
+			from `storage`
+			where `option_id2` <> 0
+		union
+			select
+				`id`,
+				3 as `old_index`,
+				`option_id3` as `option_id`,
+				`option_val3` as `option_val`,
+				`option_parm3` as `option_parm`
+			from `storage`
+			where `option_id3` <> 0
+		union
+			select
+				`id`,
+				4 as `old_index`,
+				`option_id4` as `option_id`,
+				`option_val4` as `option_val`,
+				`option_parm4` as `option_parm`
+			from `storage`
+			where `option_id4` <> 0
+	) t2
+	order by `id`, `old_index`
+) t ;
+
+-- Fix option 0
+update `storage`
+left join `tmp_randomoptionfix`
+on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
+set
+	`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 1
+update `storage`
+left join `tmp_randomoptionfix`
+on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
+set
+	`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 2
+update `storage`
+left join `tmp_randomoptionfix`
+on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
+set
+	`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 3
+update `storage`
+left join `tmp_randomoptionfix`
+on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
+set
+	`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Fix option 4
+update `storage`
+left join `tmp_randomoptionfix`
+on `storage`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
+set
+	`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+	`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+	`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+;
+
+-- Delete the data to have a clean table for the next run
+delete from `tmp_randomoptionfix`;
+
+-- Repeat this for any other storage tables that you have created (for example VIP)
+-- To do this copy paste the code below and replace ${other_storage} with the name of your table
+/**
+	-- Create ${other_storage} data
+	insert into `tmp_randomoptionfix` ( `id`, `new_index`, `old_index`, `option_id`, `option_val`, `option_parm` )
+	select
+		`id`,
+		row_number() over( partition by `id` order by `old_index` asc ) - 1 as `new_index`,
+		`old_index`,
+		`option_id`,
+		`option_val`,
+		`option_parm`
+	from (
+		select * from (
+			select
+					`id`,
+					0 as `old_index`,
+					`option_id0` as `option_id`,
+					`option_val0` as `option_val`,
+					`option_parm0` as `option_parm`
+				from `${other_storage}`
+				where `option_id0` <> 0
+			union
+				select
+					`id`,
+					1 as `old_index`,
+					`option_id1` as `option_id`,
+					`option_val1` as `option_val`,
+					`option_parm1` as `option_parm`
+				from `${other_storage}`
+				where `option_id1` <> 0
+			union
+				select
+					`id`,
+					2 as `old_index`,
+					`option_id2` as `option_id`,
+					`option_val2` as `option_val`,
+					`option_parm2` as `option_parm`
+				from `${other_storage}`
+				where `option_id2` <> 0
+			union
+				select
+					`id`,
+					3 as `old_index`,
+					`option_id3` as `option_id`,
+					`option_val3` as `option_val`,
+					`option_parm3` as `option_parm`
+				from `${other_storage}`
+				where `option_id3` <> 0
+			union
+				select
+					`id`,
+					4 as `old_index`,
+					`option_id4` as `option_id`,
+					`option_val4` as `option_val`,
+					`option_parm4` as `option_parm`
+				from `${other_storage}`
+				where `option_id4` <> 0
+		) t2
+		order by `id`, `old_index`
+	) t ;
+
+	-- Fix option 0
+	update `${other_storage}`
+	left join `tmp_randomoptionfix`
+	on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 0
+	set
+		`option_id0` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+		`option_val0` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+		`option_parm0` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+	;
+
+	-- Fix option 1
+	update `${other_storage}`
+	left join `tmp_randomoptionfix`
+	on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 1
+	set
+		`option_id1` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+		`option_val1` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+		`option_parm1` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+	;
+
+	-- Fix option 2
+	update `${other_storage}`
+	left join `tmp_randomoptionfix`
+	on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 2
+	set
+		`option_id2` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+		`option_val2` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+		`option_parm2` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+	;
+
+	-- Fix option 3
+	update `${other_storage}`
+	left join `tmp_randomoptionfix`
+	on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 3
+	set
+		`option_id3` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+		`option_val3` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+		`option_parm3` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+	;
+
+	-- Fix option 4
+	update `${other_storage}`
+	left join `tmp_randomoptionfix`
+	on `${other_storage}`.`id` = `tmp_randomoptionfix`.`id` and `tmp_randomoptionfix`.`new_index` = 4
+	set
+		`option_id4` = coalesce( `tmp_randomoptionfix`.`option_id`, 0 ),
+		`option_val4` = coalesce( `tmp_randomoptionfix`.`option_val`, 0 ),
+		`option_parm4` = coalesce( `tmp_randomoptionfix`.`option_parm`, 0 )
+	;
+
+	-- Delete the data to have a clean table for the next run
+	delete from `tmp_randomoptionfix`;
+**/
+
+drop table `tmp_randomoptionfix`;

+ 20 - 0
sql-files/upgrades/upgrade_20221220.sql

@@ -0,0 +1,20 @@
+--
+-- Table structure for table `party_bookings`
+--
+
+CREATE TABLE IF NOT EXISTS `party_bookings` (
+  `world_name` varchar(32) NOT NULL,
+  `account_id` int(11) unsigned NOT NULL,
+  `char_id` int(11) unsigned NOT NULL,
+  `char_name` varchar(23) NOT NULL,
+  `purpose` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `assist` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `damagedealer` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `healer` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `tanker` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `minimum_level` smallint(5) unsigned NOT NULL,
+  `maximum_level` smallint(5) unsigned NOT NULL,
+  `comment` varchar(255) NOT NULL DEFAULT '',
+  `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`world_name`, `account_id`, `char_id`)
+) ENGINE=MyISAM;

+ 20 - 44
src/char/char.cpp

@@ -37,6 +37,8 @@
 #include "int_storage.hpp"
 #include "packets.hpp"
 
+using namespace rathena::server_character;
+
 //definition of exported var declared in header
 int login_fd=-1; //login file descriptor
 int char_fd=-1; //char file descriptor
@@ -3142,9 +3144,7 @@ void char_do_final_msg(void){
 	_do_final_msg(CHAR_MAX_MSG,msg_table);
 }
 
-
-void do_final(void)
-{
+void CharacterServer::finalize(){
 	ShowStatus("Terminating...\n");
 
 	char_set_all_offline(-1);
@@ -3174,40 +3174,17 @@ void do_final(void)
 	ShowStatus("Finished.\n");
 }
 
-
-void set_server_type(void){
-	SERVER_TYPE = ATHENA_SERVER_CHAR;
-}
-
-//------------------------------
-// Function called when the server
-// has received a crash signal.
-//------------------------------
-void do_abort(void)
-{
-}
-
 /// Called when a terminate signal is received.
-void do_shutdown(void) {
-	if( runflag != CHARSERVER_ST_SHUTDOWN )
-	{
-		int id;
-		runflag = CHARSERVER_ST_SHUTDOWN;
-		ShowStatus("Shutting down...\n");
-		// TODO proper shutdown procedure; wait for acks?, kick all characters, ... [FlavoJS]
-		for( id = 0; id < ARRAYLENGTH(map_server); ++id )
-			chmapif_server_reset(id);
-		chlogif_check_shutdown();
-		flush_fifos();
-		runflag = CORE_ST_STOP;
-	}
+void CharacterServer::handle_shutdown(){
+	ShowStatus("Shutting down...\n");
+	// TODO proper shutdown procedure; wait for acks?, kick all characters, ... [FlavoJS]
+	for( int id = 0; id < ARRAYLENGTH(map_server); ++id )
+		chmapif_server_reset(id);
+	flush_fifos();
 }
 
-
-int do_init(int argc, char **argv)
-{
+bool CharacterServer::initialize( int argc, char *argv[] ){
 	//Read map indexes
-	runflag = CHARSERVER_ST_STARTING;
 	mapindex_init();
 
 	// Init default value
@@ -3227,12 +3204,13 @@ int do_init(int argc, char **argv)
 	char_sql_config_read(SQL_CONF_NAME);
 	msg_config_read(MSG_CONF_NAME_EN);
 
-	// Skip this check if the server is run with run-once flag
-	if (runflag!=CORE_ST_STOP && strcmp(charserv_config.userid, "s1")==0 && strcmp(charserv_config.passwd, "p1")==0) {
+#if !defined(BUILDBOT)
+	if (strcmp(charserv_config.userid, "s1")==0 && strcmp(charserv_config.passwd, "p1")==0) {
 		ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n");
 		ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n");
 		ShowNotice("And then change the user/password to use in conf/char_athena.conf (or conf/import/char_conf.txt)\n");
 	}
+#endif
 
 	inter_init_sql((argc > 2) ? argv[2] : SQL_CONF_NAME); // inter server configuration
 
@@ -3289,7 +3267,7 @@ int do_init(int argc, char **argv)
 	//check db tables
 	if(charserv_config.char_check_db && char_checkdb() == 0){
 		ShowFatalError("char : A tables is missing in sql-server, please fix it, see (sql-files main.sql for structure) \n");
-		exit(EXIT_FAILURE);
+		return false;
 	}
 	//Cleaning the tables for NULL entrys @ startup [Sirius]
 	//Chardb clean
@@ -3308,13 +3286,7 @@ int do_init(int argc, char **argv)
 
 	if( (char_fd = make_listen_bind(charserv_config.bind_ip,charserv_config.char_port)) == -1 ) {
 		ShowFatalError("Failed to bind to port '" CL_WHITE "%d" CL_RESET "'\n",charserv_config.char_port);
-		exit(EXIT_FAILURE);
-	}
-
-	if( runflag != CORE_ST_STOP )
-	{
-		shutdown_callback = do_shutdown;
-		runflag = CHARSERVER_ST_RUNNING;
+		return false;
 	}
 
 	do_init_chcnslif();
@@ -3323,5 +3295,9 @@ int do_init(int argc, char **argv)
 
 	ShowStatus("The char-server is " CL_GREEN "ready" CL_RESET " (Server is listening on the port %d).\n\n", charserv_config.char_port);
 
-	return 0;
+	return true;
+}
+
+int main( int argc, char *argv[] ){
+	return main_core<CharacterServer>( argc, argv );
 }

+ 19 - 7
src/char/char.hpp

@@ -14,19 +14,31 @@
 
 #include "packets.hpp"
 
+using rathena::server_core::Core;
+using rathena::server_core::e_core_type;
+
+namespace rathena{
+	namespace server_character{
+		class CharacterServer : public Core{
+			protected:
+				bool initialize( int argc, char* argv[] ) override;
+				void finalize() override;
+				void handle_shutdown() override;
+
+			public:
+				CharacterServer() : Core( e_core_type::CHARACTER ){
+
+				}
+		};
+	}
+}
+
 extern int login_fd; //login file descriptor
 extern int char_fd; //char file descriptor
 
 #define MAX_STARTPOINT 5
 #define MAX_STARTITEM 32
 
-enum E_CHARSERVER_ST {
-	CHARSERVER_ST_RUNNING = CORE_ST_LAST,
-	CHARSERVER_ST_STARTING,
-	CHARSERVER_ST_SHUTDOWN,
-	CHARSERVER_ST_LAST
-};
-
 enum e_char_delete {
 	CHAR_DEL_EMAIL = 1,
 	CHAR_DEL_BIRTHDATE

+ 2 - 2
src/char/char_clif.cpp

@@ -674,7 +674,7 @@ int chclif_parse_maplogin(int fd){
 		l_user[23] = '\0';
 		l_pass[23] = '\0';
 		ARR_FIND( 0, ARRAYLENGTH(map_server), i, map_server[i].fd <= 0 );
-		if( runflag != CHARSERVER_ST_RUNNING ||
+		if( !global_core->is_running() ||
 			i == ARRAYLENGTH(map_server) ||
 			strcmp(l_user, charserv_config.userid) != 0 ||
 			strcmp(l_pass, charserv_config.passwd) != 0 )
@@ -735,7 +735,7 @@ int chclif_parse_reqtoconnect(int fd, struct char_session_data* sd,uint32 ipl){
 		WFIFOL(fd,0) = account_id;
 		WFIFOSET(fd,4);
 
-		if( runflag != CHARSERVER_ST_RUNNING ) {
+		if( !global_core->is_running() ){
 			chclif_reject(fd, 0); // rejected from server
 			return 1;
 		}

+ 1 - 1
src/char/char_cnslif.cpp

@@ -74,7 +74,7 @@ int cnslif_parse(const char* buf)
 
 	if( n == 2 && strcmpi("server", type) == 0 ){
 		if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
-			runflag = 0;
+			global_core->signal_shutdown();
 		}
 		else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
 			ShowInfo(CL_CYAN "Console: " CL_BOLD "I'm Alive." CL_RESET "\n");

+ 0 - 12
src/char/char_logif.cpp

@@ -813,16 +813,6 @@ void chlogif_reset(void){
 	exit(EXIT_FAILURE);
 }
 
-/// Checks the conditions for the server to stop.
-/// Releases the cookie when all characters are saved.
-/// If all the conditions are met, it stops the core loop.
-void chlogif_check_shutdown(void)
-{
-	if( runflag != CHARSERVER_ST_SHUTDOWN )
-		return;
-	runflag = CORE_ST_STOP;
-}
-
 /// Called when the connection to Login Server is disconnected.
 void chlogif_on_disconnect(void){
 	ShowWarning("Connection to Login Server lost.\n\n");
@@ -833,8 +823,6 @@ void chlogif_on_ready(void)
 {
 	int i;
 
-	chlogif_check_shutdown();
-
 	//Send online accounts to login server.
 	chlogif_send_acc_tologin(INVALID_TIMER, gettick(), 0, 0);
 

+ 4 - 4
src/char/char_mapif.cpp

@@ -460,7 +460,7 @@ int chmapif_parse_authok(int fd){
 		uint32 ip = RFIFOL(fd,14);
 		RFIFOSKIP(fd,18);
 
-		if( runflag != CHARSERVER_ST_RUNNING ){
+		if( !global_core->is_running() ){
 			chmapif_charselres(fd,account_id,0);
 		}else{
 			struct auth_node* node;
@@ -612,7 +612,7 @@ int chmapif_parse_reqchangemapserv(int fd){
 			char_data = (struct mmo_charstatus*)uidb_get(char_db_,RFIFOL(fd,14));
 		}
 
-		if( runflag == CHARSERVER_ST_RUNNING &&
+		if( global_core->is_running() &&
 			session_isActive(map_fd) &&
 			char_data )
 		{	//Send the map server the auth of this player.
@@ -1013,7 +1013,7 @@ int chmapif_parse_reqauth(int fd, int id){
 				char_mmo_char_fromsql(char_id, &char_dat, true);
 				cd = (struct mmo_charstatus*)uidb_get(char_db_,char_id);
 		}
-		if( runflag == CHARSERVER_ST_RUNNING && autotrade && cd ){
+		if( global_core->is_running() && autotrade && cd ){
 			uint16 mmo_charstatus_len = sizeof(struct mmo_charstatus) + 25;
 
 			WFIFOHEAD(fd,mmo_charstatus_len);
@@ -1029,7 +1029,7 @@ int chmapif_parse_reqauth(int fd, int id){
 			WFIFOSET(fd, WFIFOW(fd,2));
 
 			char_set_char_online(id, char_id, account_id);
-		} else if( runflag == CHARSERVER_ST_RUNNING &&
+		} else if( global_core->is_running() &&
 			cd != NULL &&
 			node != NULL &&
 			node->account_id == account_id &&

+ 7 - 9
src/common/cli.cpp

@@ -18,6 +18,8 @@
 #include "showmsg.hpp"
 #include "timer.hpp"
 
+using namespace rathena::server_core;
+
 //map confs
 const char* MAP_CONF_NAME;
 const char* INTER_CONF_NAME;
@@ -110,14 +112,12 @@ int cli_get_options(int argc, char ** argv) {
 					MSG_CONF_NAME_EN = argv[++i];
 			}
 			else if (strcmp(arg, "run-once") == 0) { // close the map-server as soon as its done.. for testing [Celest]
-				runflag = CORE_ST_STOP;
-			}
-			else if (SERVER_TYPE & (ATHENA_SERVER_LOGIN | ATHENA_SERVER_CHAR)) { //login or char
+				global_core->set_run_once( true );
+			}else if( global_core->get_type() == e_core_type::LOGIN || global_core->get_type() == e_core_type::CHARACTER ){
 				if (strcmp(arg, "lan-config") == 0) {
 					if (opt_has_next_value(arg, i, argc))
 						LAN_CONF_NAME = argv[++i];
-				}
-				else if (SERVER_TYPE == ATHENA_SERVER_LOGIN) { //login
+				}else if( global_core->get_type() == e_core_type::LOGIN ){
 					if (strcmp(arg, "login-config") == 0) {
 						if (opt_has_next_value(arg, i, argc))
 							LOGIN_CONF_NAME = argv[++i];
@@ -126,8 +126,7 @@ int cli_get_options(int argc, char ** argv) {
 						ShowError("Unknown option '%s'.\n", argv[i]);
 						exit(EXIT_FAILURE);
 					}
-				}
-				else if (SERVER_TYPE == ATHENA_SERVER_CHAR) { //char
+				}else if( global_core->get_type() == e_core_type::CHARACTER ){
 					if (strcmp(arg, "char-config") == 0) {
 						if (opt_has_next_value(arg, i, argc))
 							CHAR_CONF_NAME = argv[++i];
@@ -141,8 +140,7 @@ int cli_get_options(int argc, char ** argv) {
 						exit(EXIT_FAILURE);
 					}
 				}
-			}
-			else if (SERVER_TYPE == ATHENA_SERVER_MAP) { //map
+			}else if( global_core->get_type() == e_core_type::MAP ){
 				if (strcmp(arg, "map-config") == 0) {
 					if (opt_has_next_value(arg, i, argc))
 						MAP_CONF_NAME = argv[++i];

+ 116 - 37
src/common/core.cpp

@@ -37,19 +37,18 @@
 	#endif
 #endif
 
-/// Called when a terminate signal is received.
-void (*shutdown_callback)(void) = NULL;
+using namespace rathena::server_core;
+
+Core* global_core = nullptr;
 
 #if defined(BUILDBOT)
 	int buildbotflag = 0;
 #endif
 
-int runflag = CORE_ST_RUN;
 char db_path[12] = "db"; /// relative path for db from server
 char conf_path[12] = "conf"; /// relative path for conf from server
 
 char *SERVER_NAME = NULL;
-char SERVER_TYPE = ATHENA_SERVER_NONE;
 
 #ifndef MINICORE	// minimalist Core
 // Added by Gabuzomeu
@@ -91,10 +90,9 @@ static BOOL WINAPI console_handler(DWORD c_event) {
     case CTRL_CLOSE_EVENT:
     case CTRL_LOGOFF_EVENT:
     case CTRL_SHUTDOWN_EVENT:
-		if( shutdown_callback != NULL )
-			shutdown_callback();
-		else
-			runflag = CORE_ST_STOP;// auto-shutdown
+		if( global_core != nullptr ){
+			global_core->signal_shutdown();
+		}
         break;
 	default:
 		return FALSE;
@@ -119,14 +117,15 @@ static void sig_proc(int sn) {
 	case SIGTERM:
 		if (++is_called > 3)
 			exit(EXIT_SUCCESS);
-		if( shutdown_callback != NULL )
-			shutdown_callback();
-		else
-			runflag = CORE_ST_STOP;// auto-shutdown
+		if( global_core != nullptr ){
+			global_core->signal_shutdown();
+		}
 		break;
 	case SIGSEGV:
 	case SIGFPE:
-		do_abort();
+		if( global_core != nullptr ){
+			global_core->signal_crash();
+		}
 		// Pass the signal to the system's default handler
 		compat_signal(sn, SIG_DFL);
 		raise(sn);
@@ -329,11 +328,14 @@ void usercheck(void)
 #endif
 }
 
-/*======================================
- *	CORE : MAINROUTINE
- *--------------------------------------*/
-int main (int argc, char **argv)
-{
+int Core::start( int argc, char **argv ){
+	if( this->get_status() != e_core_status::NOT_STARTED) {
+		ShowFatalError( "Core was already started and cannot be started again!\n" );
+		return EXIT_FAILURE;
+	}
+
+	this->set_status( e_core_status::CORE_INITIALIZING );
+
 	{// initialize program arguments
 		char *p1;
 		if((p1 = strrchr(argv[0], '/')) != NULL ||  (p1 = strrchr(argv[0], '\\')) != NULL ){
@@ -352,17 +354,10 @@ int main (int argc, char **argv)
 	}
 
 	malloc_init();// needed for Show* in display_title() [FlavioJS]
-
-#ifdef MINICORE // minimalist Core
-	display_title();
-	usercheck();
-	do_init(argc,argv);
-	do_final();
-#else// not MINICORE
-	set_server_type();
 	display_title();
 	usercheck();
 
+#ifndef MINICORE
 	Sql_Init();
 	db_init();
 	signals_init();
@@ -370,24 +365,41 @@ int main (int argc, char **argv)
 #ifdef _WIN32
 	cevents_init();
 #endif
-
 	timer_init();
 	socket_init();
+#endif
 
-	do_init(argc,argv);
+	this->set_status( e_core_status::CORE_INITIALIZED );
+
+	this->set_status( e_core_status::SERVER_INITIALIZING );
+	if( !this->initialize( argc, argv ) ){
+		return EXIT_FAILURE;
+	}
 
-	// Main runtime cycle
-	while (runflag != CORE_ST_STOP) { 
-		t_tick next = do_timer(gettick_nocache());
+	// If initialization did not trigger shutdown
+	if( this->status != e_core_status::STOPPING ){
+		this->set_status( e_core_status::SERVER_INITIALIZED );
 
-		if (SERVER_TYPE != ATHENA_SERVER_WEB)
-			do_sockets(next);
-		else
-			do_wait(next);
+		this->set_status( e_core_status::RUNNING );
+#ifndef MINICORE
+		if( !this->run_once ){
+			// Main runtime cycle
+			while( this->get_status() == e_core_status::RUNNING ){
+				t_tick next = do_timer( gettick_nocache() );
+
+				this->handle_main( next );
+			}
+		}
+#endif
+		this->set_status( e_core_status::STOPPING );
 	}
 
-	do_final();
+	this->set_status( e_core_status::SERVER_FINALIZING );
+	this->finalize();
+	this->set_status( e_core_status::SERVER_FINALIZED );
 
+	this->set_status( e_core_status::CORE_FINALIZING );
+#ifndef MINICORE
 	timer_final();
 	socket_final();
 	db_final();
@@ -395,6 +407,7 @@ int main (int argc, char **argv)
 #endif
 
 	malloc_final();
+	this->set_status( e_core_status::CORE_FINALIZED );
 
 #if defined(BUILDBOT)
 	if( buildbotflag ){
@@ -402,5 +415,71 @@ int main (int argc, char **argv)
 	}
 #endif
 
-	return 0;
+	this->set_status( e_core_status::STOPPED );
+
+	return EXIT_SUCCESS;
+}
+
+bool Core::initialize( int argc, char* argv[] ){
+	// Do nothing
+	return true;
+}
+
+void Core::handle_main( t_tick next ){
+#ifndef MINICORE
+	// By default we handle all socket packets
+	do_sockets( next );
+#endif
+}
+
+void Core::handle_crash(){
+	// Do nothing
+}
+
+void Core::handle_shutdown(){
+	// Do nothing
+}
+
+void Core::finalize(){
+	// Do nothing
+}
+
+void Core::set_status( e_core_status status ){
+	this->status = status;
+}
+
+e_core_status Core::get_status(){
+	return this->status;
+}
+
+e_core_type Core::get_type(){
+	return this->type;
+}
+
+bool Core::is_running(){
+	return this->get_status() == e_core_status::RUNNING;
+}
+
+void Core::set_run_once( bool run_once ){
+	this->run_once = run_once;
+}
+
+void Core::signal_crash(){
+	this->set_status( e_core_status::STOPPING );
+
+	if( this->crashed ){
+		ShowFatalError( "Received another crash signal, while trying to handle the last crash!\n" );
+	}else{
+		ShowFatalError( "Received a crash signal, trying to handle it as good as possible!\n" );
+		this->crashed = true;
+		this->handle_crash();
+	}
+
+	// Now stop the process
+	exit( EXIT_FAILURE );
+}
+
+void Core::signal_shutdown(){
+	this->set_status( e_core_status::STOPPING );
+	this->handle_shutdown();
 }

+ 79 - 32
src/common/core.hpp

@@ -4,55 +4,102 @@
 #ifndef CORE_HPP
 #define CORE_HPP
 
+#include <string>
+#include <vector>
+
+#include "timer.hpp"
+
+#ifdef _WIN32
+	#include "winapi.hpp" // Console close event handling
+#endif
+
 /* so that developers with --enable-debug can raise signals from any section of the code they'd like */
 #ifdef DEBUG
 	#include <signal.h>
 #endif
 
-extern int arg_c;
-extern char **arg_v;
-
 #if defined(BUILDBOT)
 	extern int buildbotflag;
 #endif
 
 #define UNKNOWN_VERSION '\x02'
 
-/// @see E_CORE_ST
-extern int runflag;
 extern char *SERVER_NAME;
 extern char db_path[12]; /// relative path for db from servers
 extern char conf_path[12]; /// relative path for conf from servers
 
-enum {
-	ATHENA_SERVER_NONE = 0,	// not defined
-	ATHENA_SERVER_LOGIN	= 1,	// login server
-	ATHENA_SERVER_CHAR = 2,	// char server
-	ATHENA_SERVER_INTER	= 4,	// inter server
-	ATHENA_SERVER_MAP = 8,	// map server
-	ATHENA_SERVER_WEB = 16, // web server
-};
-
-extern char SERVER_TYPE;
-
 extern int parse_console(const char* buf);
 const char *get_svn_revision(void);
 const char *get_git_hash(void);
-extern int do_init(int,char**);
-extern void set_server_type(void);
-extern void do_abort(void);
-extern void do_final(void);
-
-/// The main loop continues until runflag is CORE_ST_STOP
-enum E_CORE_ST
-{
-	CORE_ST_STOP = 0,
-	CORE_ST_RUN,
-	CORE_ST_LAST
-};
-
-/// Called when a terminate signal is received. (Ctrl+C pressed)
-/// If NULL, runflag is set to CORE_ST_STOP instead.
-extern void (*shutdown_callback)(void);
+
+namespace rathena{
+	namespace server_core{
+		enum class e_core_status{
+			NOT_STARTED,
+			CORE_INITIALIZING,
+			CORE_INITIALIZED,
+			SERVER_INITIALIZING,
+			SERVER_INITIALIZED,
+			RUNNING,
+			STOPPING,
+			SERVER_FINALIZING,
+			SERVER_FINALIZED,
+			CORE_FINALIZING,
+			CORE_FINALIZED,
+			STOPPED,
+		};
+
+		enum class e_core_type{
+			LOGIN,
+			CHARACTER,
+			MAP,
+			TOOL,
+			WEB
+		};
+
+		class Core{
+			private:
+				e_core_status status;
+				e_core_type type;
+				bool run_once;
+				bool crashed;
+
+			protected:
+				virtual bool initialize( int argc, char* argv[] );
+				virtual void handle_main( t_tick next );
+				virtual void finalize();
+				virtual void handle_crash();
+				virtual void handle_shutdown();
+				void set_status( e_core_status status );
+
+			public:
+				Core( e_core_type type ){
+					this->status = e_core_status::NOT_STARTED;
+					this->run_once = false;
+					this->crashed = false;
+					this->type = type;
+				}
+
+				e_core_status get_status();
+				e_core_type get_type();
+				bool is_running();
+				// TODO: refactor to protected
+				void set_run_once( bool run_once );
+				void signal_crash();
+				void signal_shutdown();
+				int start( int argc, char* argv[] );
+		};
+	}
+}
+
+extern rathena::server_core::Core* global_core;
+
+template <typename T> int main_core( int argc, char *argv[] ){
+	T server = {};
+
+	global_core = &server;
+
+	return server.start( argc, argv );
+}
 
 #endif /* CORE_HPP */

+ 2 - 2
src/common/ers.cpp

@@ -193,7 +193,7 @@ static void *ers_obj_alloc_entry(ERS *self)
 		instance->Cache->ReuseList = instance->Cache->ReuseList->Next;
 	} else if (instance->Cache->Free > 0) {
 		instance->Cache->Free--;
-		ret = &instance->Cache->Blocks[instance->Cache->Used - 1][instance->Cache->Free * instance->Cache->ObjectSize + sizeof(struct ers_list)];
+		ret = &instance->Cache->Blocks[instance->Cache->Used - 1][static_cast<size_t>( instance->Cache->Free ) * static_cast<size_t>( instance->Cache->ObjectSize ) + sizeof( struct ers_list )];
 	} else {
 		if (instance->Cache->Used == instance->Cache->Max) {
 			instance->Cache->Max = (instance->Cache->Max * 4) + 3;
@@ -204,7 +204,7 @@ static void *ers_obj_alloc_entry(ERS *self)
 		instance->Cache->Used++;
 
 		instance->Cache->Free = instance->Cache->ChunkSize -1;
-		ret = &instance->Cache->Blocks[instance->Cache->Used - 1][instance->Cache->Free * instance->Cache->ObjectSize + sizeof(struct ers_list)];
+		ret = &instance->Cache->Blocks[instance->Cache->Used - 1][static_cast<size_t>( instance->Cache->Free ) * static_cast<size_t>( instance->Cache->ObjectSize ) + sizeof( struct ers_list )];
 	}
 
 	instance->Count++;

+ 3 - 3
src/common/mmo.hpp

@@ -695,14 +695,14 @@ struct party {
 	struct party_member member[MAX_PARTY];
 };
 
-struct map_session_data;
+class map_session_data;
 struct guild_member {
 	uint32 account_id, char_id;
 	short hair,hair_color,gender,class_,lv;
 	t_exp exp;
 	short online,position;
 	char name[NAME_LENGTH];
-	struct map_session_data *sd;
+	map_session_data *sd;
 	unsigned char modified;
 	uint32 last_login;
 };
@@ -1123,7 +1123,7 @@ struct clan{
 	char master[NAME_LENGTH];
 	char map[MAP_NAME_LENGTH_EXT];
 	short max_member, connect_member;
-	struct map_session_data *members[MAX_CLAN];
+	map_session_data *members[MAX_CLAN];
 	struct clan_alliance alliance[MAX_CLANALLIANCE];
 	unsigned short instance_id;
 };

+ 0 - 11
src/common/socket.cpp

@@ -40,9 +40,6 @@
 	#endif
 #endif
 
-#include <chrono>
-#include <thread>
-
 #include "cbasetypes.hpp"
 #include "malloc.hpp"
 #include "mmo.hpp"
@@ -890,14 +887,6 @@ int WFIFOSET(int fd, size_t len)
 	return 0;
 }
 
-
-// replacement for do_sockets, where it does nothing
-int do_wait(t_tick next)
-{
-	std::this_thread::sleep_for(std::chrono::milliseconds(next));
-	return 0;
-}
-
 int do_sockets(t_tick next)
 {
 #ifndef SOCKET_EPOLL

+ 0 - 1
src/common/socket.hpp

@@ -133,7 +133,6 @@ int WFIFOSET(int fd, size_t len);
 int RFIFOSKIP(int fd, size_t len);
 
 int do_sockets(t_tick next);
-int do_wait(t_tick next);
 void do_close(int fd);
 void socket_init(void);
 void socket_final(void);

+ 16 - 47
src/login/login.cpp

@@ -32,6 +32,7 @@
 #include "loginlog.hpp"
 
 using namespace rathena;
+using namespace rathena::server_login;
 
 #define LOGIN_MAX_MSG 30				/// Max number predefined in msg_conf
 static char* msg_table[LOGIN_MAX_MSG];	/// Login Server messages_conf
@@ -780,7 +781,7 @@ void login_set_defaults() {
  * Login-serv destructor
  *  dealloc..., function called at exit of the login-serv
  */
-void do_final(void) {
+void LoginServer::finalize(){
 	struct client_hash_node *hn = login_config.client_hash_nodes;
 	AccountDB* db = accounts;
 
@@ -822,45 +823,14 @@ void do_final(void) {
 	ShowStatus("Finished.\n");
 }
 
-/**
- * Signal handler
- *  This function attempts to properly close the server when an interrupt signal is received.
- *  current signal catch : SIGTERM, SIGINT
- */
-void do_shutdown(void) {
-	if( runflag != LOGINSERVER_ST_SHUTDOWN ) {
-		runflag = LOGINSERVER_ST_SHUTDOWN;
-		ShowStatus("Shutting down...\n");
-		// TODO proper shutdown procedure; kick all characters, wait for acks, ...  [FlavioJS]
-		do_shutdown_loginchrif();
-		flush_fifos();
-		runflag = CORE_ST_STOP;
-	}
-}
-
-/**
- * Signal handler
- *  Function called when the server has received a crash signal.
- *  current signal catch : SIGSEGV, SIGFPE
- */
-void do_abort(void) {
+void LoginServer::handle_shutdown(){
+	ShowStatus("Shutting down...\n");
+	// TODO proper shutdown procedure; kick all characters, wait for acks, ...  [FlavioJS]
+	do_shutdown_loginchrif();
+	flush_fifos();
 }
 
-// Is this still used ??
-void set_server_type(void) {
-	SERVER_TYPE = ATHENA_SERVER_LOGIN;
-}
-
-/**
- * Login serv constructor
- *  Initialisation, function called at start of the login-serv.
- * @param argc : number of argument from main()
- * @param argv : arguments values from main()
- * @return 0 everything ok else stopping programme execution.
- */
-int do_init(int argc, char** argv) {
-	runflag = LOGINSERVER_ST_STARTING;
-
+bool LoginServer::initialize( int argc, char* argv[] ){
 	// Init default value
 	safestrncpy(console_log_filepath, "./log/login-msg_log.log", sizeof(console_log_filepath));
 
@@ -900,23 +870,18 @@ int do_init(int argc, char** argv) {
 	// Account database init
 	if( accounts == NULL ) {
 		ShowFatalError("do_init: account engine not found.\n");
-		exit(EXIT_FAILURE);
+		return false;
 	} else {
 		if(!accounts->init(accounts)) {
 			ShowFatalError("do_init: Failed to initialize account engine.\n");
-			exit(EXIT_FAILURE);
+			return false;
 		}
 	}
 
 	// server port open & binding
 	if( (login_fd = make_listen_bind(login_config.login_ip,login_config.login_port)) == -1 ) {
 		ShowFatalError("Failed to bind to port '" CL_WHITE "%d" CL_RESET "'\n",login_config.login_port);
-		exit(EXIT_FAILURE);
-	}
-
-	if( runflag != CORE_ST_STOP ) {
-		shutdown_callback = do_shutdown;
-		runflag = LOGINSERVER_ST_RUNNING;
+		return false;
 	}
 
 	do_init_logincnslif();
@@ -924,5 +889,9 @@ int do_init(int argc, char** argv) {
 	ShowStatus("The login-server is " CL_GREEN "ready" CL_RESET " (Server is listening on the port %u).\n\n", login_config.login_port);
 	login_log(0, "login server", 100, "login server started");
 
-	return 0;
+	return true;
+}
+
+int main( int argc, char *argv[] ){
+	return main_core<LoginServer>( argc, argv );
 }

+ 19 - 7
src/login/login.hpp

@@ -7,19 +7,31 @@
 #include <memory>
 
 #include "../common/cbasetypes.hpp"
-#include "../common/core.hpp" // CORE_ST_LAST
+#include "../common/core.hpp"
 #include "../common/mmo.hpp" // NAME_LENGTH,SEX_*
 #include "../common/timer.hpp"
 #include "../config/core.hpp"
 
 #include "account.hpp"
 
-enum E_LOGINSERVER_ST {
-	LOGINSERVER_ST_RUNNING = CORE_ST_LAST,
-	LOGINSERVER_ST_STARTING,
-	LOGINSERVER_ST_SHUTDOWN,
-	LOGINSERVER_ST_LAST
-};
+using rathena::server_core::Core;
+using rathena::server_core::e_core_type;
+
+namespace rathena{
+	namespace server_login{
+		class LoginServer : public Core{
+			protected:
+				bool initialize( int argc, char* argv[] ) override;
+				void finalize() override;
+				void handle_shutdown() override;
+
+			public:
+				LoginServer() : Core( e_core_type::LOGIN ){
+
+				}
+		};
+	}
+}
 
 /// supported encryption types: 1- passwordencrypt, 2- passwordencrypt2, 3- both
 #define PASSWORDENC 3

+ 1 - 1
src/login/loginchrif.cpp

@@ -83,7 +83,7 @@ int logchrif_parse_reqauth(int fd, int id,char* ip){
 
 		struct auth_node* node = login_get_auth_node( account_id );
 
-		if( runflag == LOGINSERVER_ST_RUNNING &&
+		if( global_core->is_running() &&
 			node != nullptr &&
 			node->account_id == account_id &&
 			node->login_id1  == login_id1 &&

+ 2 - 2
src/login/loginclif.cpp

@@ -59,7 +59,7 @@ static void logclif_auth_ok(struct login_session_data* sd) {
 	int size = 160;
 #endif
 
-	if( runflag != LOGINSERVER_ST_RUNNING ){
+	if( !global_core->is_running() ){
 		// players can only login while running
 		logclif_sent_auth_result(fd,1); // server closed
 		return;
@@ -420,7 +420,7 @@ static int logclif_parse_reqcharconnec(int fd, struct login_session_data *sd, ch
 		login_log(session[fd]->client_addr, sd->userid, 100, message);
 
 		result = login_mmo_auth(sd, true);
-		if( runflag == LOGINSERVER_ST_RUNNING &&
+		if( global_core->is_running() &&
 			result == -1 &&
 			sd->sex == 'S' &&
 			sd->account_id < ARRAYLENGTH(ch_server) &&

+ 11 - 13
src/login/logincnslif.cpp

@@ -57,18 +57,16 @@ int logcnslif_get_options(int argc, char ** argv) {
 			} else if (strcmp(arg, "version") == 0) {
 				display_versionscreen(true);
 			} else if (strcmp(arg, "run-once") == 0){ // close the map-server as soon as its done.. for testing [Celest]
-				runflag = CORE_ST_STOP;
-			} else if (SERVER_TYPE & (ATHENA_SERVER_LOGIN)) { //login
-				if (strcmp(arg, "lan-config") == 0) {
-					if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.lanconf_name, argv[++i], sizeof(login_config.lanconf_name));
-				} else if (strcmp(arg, "login-config") == 0) {
-					if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.loginconf_name, argv[++i], sizeof(login_config.loginconf_name));
-				} else if (strcmp(arg, "msg-config") == 0) {
-					if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.msgconf_name, argv[++i], sizeof(login_config.msgconf_name));
-				} else {
-					ShowError("Unknown option '%s'.\n", argv[i]);
-					exit(EXIT_FAILURE);
-				}
+				global_core->set_run_once( true );
+			} else if (strcmp(arg, "lan-config") == 0) {
+				if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.lanconf_name, argv[++i], sizeof(login_config.lanconf_name));
+			} else if (strcmp(arg, "login-config") == 0) {
+				if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.loginconf_name, argv[++i], sizeof(login_config.loginconf_name));
+			} else if (strcmp(arg, "msg-config") == 0) {
+				if (opt_has_next_value(arg, i, argc)) safestrncpy(login_config.msgconf_name, argv[++i], sizeof(login_config.msgconf_name));
+			} else {
+				ShowError("Unknown option '%s'.\n", argv[i]);
+				exit(EXIT_FAILURE);
 			}
 		} else switch (arg[0]) {// short option
 			case '?':
@@ -112,7 +110,7 @@ int cnslif_parse(const char* buf){
 	if( n == 2 ){
 		if(strcmpi("server", type) == 0 ){
 			if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
-				runflag = 0;
+				global_core->signal_shutdown();
 			}
 			else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
 				ShowInfo(CL_CYAN "Console: " CL_BOLD "I'm Alive." CL_RESET"\n");

+ 15 - 15
src/map/achievement.cpp

@@ -439,7 +439,7 @@ AchievementLevelDatabase achievement_level_db;
  * @param achievement_id: Achievement to add
  * @return NULL on failure, achievement data on success
  */
-struct achievement *achievement_add(struct map_session_data *sd, int achievement_id)
+struct achievement *achievement_add(map_session_data *sd, int achievement_id)
 {
 	int i, index;
 
@@ -485,7 +485,7 @@ struct achievement *achievement_add(struct map_session_data *sd, int achievement
  * @param achievement_id: Achievement to remove
  * @return True on success, false on failure
  */
-bool achievement_remove(struct map_session_data *sd, int achievement_id)
+bool achievement_remove(map_session_data *sd, int achievement_id)
 {
 	struct achievement dummy;
 	int i;
@@ -532,7 +532,7 @@ bool achievement_remove(struct map_session_data *sd, int achievement_id)
  * @param achievement_id: Achievement to check if it's complete
  * @return True on completed, false if not
  */
-static bool achievement_done(struct map_session_data *sd, int achievement_id) {
+static bool achievement_done(map_session_data *sd, int achievement_id) {
 	for (int i = 0; i < sd->achievement_data.count; i++) {
 		if (sd->achievement_data.achievements[i].achievement_id == achievement_id && sd->achievement_data.achievements[i].completed > 0)
 			return true;
@@ -547,7 +547,7 @@ static bool achievement_done(struct map_session_data *sd, int achievement_id) {
  * @param achievement_id: Achievement to check if it has a dependent
  * @return False on failure or not complete, true on complete or no dependents
  */
-bool achievement_check_dependent(struct map_session_data *sd, int achievement_id)
+bool achievement_check_dependent(map_session_data *sd, int achievement_id)
 {
 	nullpo_retr(false, sd);
 
@@ -573,7 +573,7 @@ bool achievement_check_dependent(struct map_session_data *sd, int achievement_id
  * @param sd: Achievement to compare for completed dependents
  * @return True if successful, false if not
  */
-static int achievement_check_groups(struct map_session_data *sd, struct s_achievement_db *ad)
+static int achievement_check_groups(map_session_data *sd, struct s_achievement_db *ad)
 {
 	int i;
 
@@ -604,7 +604,7 @@ static int achievement_check_groups(struct map_session_data *sd, struct s_achiev
  * @param complete: Complete state of an achievement
  * @return True if successful, false if not
  */
-bool achievement_update_achievement(struct map_session_data *sd, int achievement_id, bool complete)
+bool achievement_update_achievement(map_session_data *sd, int achievement_id, bool complete)
 {
 	int i;
 
@@ -658,7 +658,7 @@ bool achievement_update_achievement(struct map_session_data *sd, int achievement
  * @param sd: Player getting the reward
  * @param achievement_id: Achievement to get reward data
  */
-void achievement_get_reward(struct map_session_data *sd, int achievement_id, time_t rewarded)
+void achievement_get_reward(map_session_data *sd, int achievement_id, time_t rewarded)
 {
 	int i;
 
@@ -699,7 +699,7 @@ void achievement_get_reward(struct map_session_data *sd, int achievement_id, tim
  * @param sd: Player to get reward
  * @param achievement_id: Achievement to get reward data
  */
-void achievement_check_reward(struct map_session_data *sd, int achievement_id)
+void achievement_check_reward(map_session_data *sd, int achievement_id)
 {
 	int i;
 
@@ -735,7 +735,7 @@ void achievement_check_reward(struct map_session_data *sd, int achievement_id)
  */
 void achievement_get_titles(uint32 char_id)
 {
-	struct map_session_data *sd = map_charid2sd(char_id);
+	map_session_data *sd = map_charid2sd(char_id);
 
 	if (sd) {
 		sd->titles.clear();
@@ -757,7 +757,7 @@ void achievement_get_titles(uint32 char_id)
  * Frees the player's data for achievements
  * @param sd: Player's session
  */
-void achievement_free(struct map_session_data *sd)
+void achievement_free(map_session_data *sd)
 {
 	nullpo_retv(sd);
 
@@ -775,7 +775,7 @@ void achievement_free(struct map_session_data *sd)
  * @param type: Type to return
  * @return The type's data, -1 if player doesn't have achievement, -2 on failure/incorrect type
  */
-int achievement_check_progress(struct map_session_data *sd, int achievement_id, int type)
+int achievement_check_progress(map_session_data *sd, int achievement_id, int type)
 {
 	int i;
 
@@ -808,7 +808,7 @@ int achievement_check_progress(struct map_session_data *sd, int achievement_id,
  * @param flag: If the call should attempt to give the AG_GOAL_ACHIEVE achievement
  * @return Rollover and TNL EXP or 0 on failure
  */
-int *achievement_level(struct map_session_data *sd, bool flag)
+int *achievement_level(map_session_data *sd, bool flag)
 {
 	nullpo_retr(nullptr, sd);
 
@@ -872,7 +872,7 @@ int *achievement_level(struct map_session_data *sd, bool flag)
 	return info;
 }
 
-bool achievement_check_condition( struct script_code* condition, struct map_session_data* sd ){
+bool achievement_check_condition( struct script_code* condition, map_session_data* sd ){
 	// Save the old script the player was attached to
 	struct script_state* previous_st = sd->st;
 
@@ -927,7 +927,7 @@ static bool achievement_target_complete(std::shared_ptr<s_achievement_db> ad, st
  * @param update_count: Objective values from event
  * @return 1 on success and false on failure
  */
-static bool achievement_update_objectives(struct map_session_data *sd, std::shared_ptr<struct s_achievement_db> ad, enum e_achievement_group group, const std::array<int, MAX_ACHIEVEMENT_OBJECTIVES> &update_count)
+static bool achievement_update_objectives(map_session_data *sd, std::shared_ptr<struct s_achievement_db> ad, enum e_achievement_group group, const std::array<int, MAX_ACHIEVEMENT_OBJECTIVES> &update_count)
 {
 	if (!ad || !sd)
 		return false;
@@ -1087,7 +1087,7 @@ static bool achievement_update_objectives(struct map_session_data *sd, std::shar
  * @param sp_value: SP parameter value
  * @param arg_count: va_arg count
  */
-void achievement_update_objective(struct map_session_data *sd, enum e_achievement_group group, uint8 arg_count, ...)
+void achievement_update_objective(map_session_data *sd, enum e_achievement_group group, uint8 arg_count, ...)
 {
 	if (!battle_config.feature_achievement)
 		return;

+ 11 - 11
src/map/achievement.hpp

@@ -15,7 +15,7 @@
 #include "../common/database.hpp"
 #include "../common/db.hpp"
 
-struct map_session_data;
+class map_session_data;
 struct block_list;
 
 enum e_achievement_group {
@@ -134,17 +134,17 @@ public:
 
 extern AchievementLevelDatabase achievement_level_db;
 
-void achievement_get_reward(struct map_session_data *sd, int achievement_id, time_t rewarded);
-struct achievement *achievement_add(struct map_session_data *sd, int achievement_id);
-bool achievement_remove(struct map_session_data *sd, int achievement_id);
-bool achievement_update_achievement(struct map_session_data *sd, int achievement_id, bool complete);
-void achievement_check_reward(struct map_session_data *sd, int achievement_id);
-void achievement_free(struct map_session_data *sd);
-int achievement_check_progress(struct map_session_data *sd, int achievement_id, int type);
-int *achievement_level(struct map_session_data *sd, bool flag);
-bool achievement_check_condition(struct script_code* condition, struct map_session_data* sd);
+void achievement_get_reward(map_session_data *sd, int achievement_id, time_t rewarded);
+struct achievement *achievement_add(map_session_data *sd, int achievement_id);
+bool achievement_remove(map_session_data *sd, int achievement_id);
+bool achievement_update_achievement(map_session_data *sd, int achievement_id, bool complete);
+void achievement_check_reward(map_session_data *sd, int achievement_id);
+void achievement_free(map_session_data *sd);
+int achievement_check_progress(map_session_data *sd, int achievement_id, int type);
+int *achievement_level(map_session_data *sd, bool flag);
+bool achievement_check_condition(struct script_code* condition, map_session_data* sd);
 void achievement_get_titles(uint32 char_id);
-void achievement_update_objective(struct map_session_data *sd, enum e_achievement_group group, uint8 arg_count, ...);
+void achievement_update_objective(map_session_data *sd, enum e_achievement_group group, uint8 arg_count, ...);
 int achievement_update_objective_sub(block_list *bl, va_list ap);
 void achievement_read_db(void);
 void achievement_db_reload(void);

+ 59 - 54
src/map/atcommand.cpp

@@ -58,7 +58,7 @@
 using namespace rathena;
 
 #define ATCOMMAND_LENGTH 50
-#define ACMD_FUNC(x) static int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)
+#define ACMD_FUNC(x) static int atcommand_ ## x (const int fd, map_session_data* sd, const char* command, const char* message)
 
 typedef struct AtCommandInfo AtCommandInfo;
 
@@ -195,8 +195,8 @@ const char *parent_cmd;
 struct atcmd_binding_data** atcmd_binding;
 
 static AtCommandInfo* get_atcommandinfo_byname(const char *name); // @help
-static void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool atcommand); // @help
-static void warp_get_suggestions(struct map_session_data* sd, const char *name); // @rura, @warp, @mapmove
+static void atcommand_get_suggestions(map_session_data* sd, const char *name, bool atcommand); // @help
+static void warp_get_suggestions(map_session_data* sd, const char *name); // @rura, @warp, @mapmove
 
 // @commands (script-based)
 struct atcmd_binding_data* get_atcommandbind_byname(const char* name) {
@@ -478,7 +478,7 @@ ACMD_FUNC(send)
  *
  * @author Euphy
  */
-static void warp_get_suggestions(struct map_session_data* sd, const char *name) {
+static void warp_get_suggestions(map_session_data* sd, const char *name) {
 	// Minimum length for suggestions is 2 characters
 	if( strlen( name ) < 2 ){
 		return;
@@ -637,7 +637,7 @@ ACMD_FUNC(mapmove)
  *------------------------------------------*/
 ACMD_FUNC(where)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 
 	nullpo_retr(-1, sd);
 	memset(atcmd_player_name, '\0', sizeof atcmd_player_name);
@@ -667,7 +667,7 @@ ACMD_FUNC(where)
  *------------------------------------------*/
 ACMD_FUNC(jumpto)
 {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 
 	nullpo_retr(-1, sd);
 
@@ -751,7 +751,7 @@ ACMD_FUNC(jump)
  * various info.
  *------------------------------------------*/
 ACMD_FUNC(who) {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	struct s_mapiterator *iter = NULL;	
 	char player_name[NAME_LENGTH] = "";
 	int count = 0;
@@ -855,7 +855,7 @@ ACMD_FUNC(who) {
  *------------------------------------------*/
 ACMD_FUNC(whogm)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 	int j, count;
 	int level;
@@ -3249,7 +3249,7 @@ ACMD_FUNC(petrename)
  *
  *------------------------------------------*/
 ACMD_FUNC(recall) {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 
 	nullpo_retr(-1, sd);
 
@@ -3479,7 +3479,7 @@ ACMD_FUNC(day)
  *------------------------------------------*/
 ACMD_FUNC(doom)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 
 	nullpo_retr(-1, sd);
@@ -3506,7 +3506,7 @@ ACMD_FUNC(doom)
  *------------------------------------------*/
 ACMD_FUNC(doommap)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 
 	nullpo_retr(-1, sd);
@@ -3531,7 +3531,7 @@ ACMD_FUNC(doommap)
 /*==========================================
  *
  *------------------------------------------*/
-static void atcommand_raise_sub(struct map_session_data* sd) {
+static void atcommand_raise_sub(map_session_data* sd) {
 
 	status_revive(&sd->bl, 100, 100);
 
@@ -3544,7 +3544,7 @@ static void atcommand_raise_sub(struct map_session_data* sd) {
  *------------------------------------------*/
 ACMD_FUNC(raise)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 
 	nullpo_retr(-1, sd);
@@ -3565,7 +3565,7 @@ ACMD_FUNC(raise)
  *------------------------------------------*/
 ACMD_FUNC(raisemap)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 
 	nullpo_retr(-1, sd);
@@ -3586,7 +3586,7 @@ ACMD_FUNC(raisemap)
  *------------------------------------------*/
 ACMD_FUNC(kick)
 {
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -3618,7 +3618,7 @@ ACMD_FUNC(kick)
  *------------------------------------------*/
 ACMD_FUNC(kickall)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 	nullpo_retr(-1, sd);
 
@@ -3972,7 +3972,8 @@ ACMD_FUNC(mapexit)
 {
 	nullpo_retr(-1, sd);
 
-	do_shutdown();
+	global_core->signal_shutdown();
+
 	return 0;
 }
 
@@ -4021,7 +4022,7 @@ ACMD_FUNC(idsearch)
  *------------------------------------------*/
 ACMD_FUNC(recallall)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 	int count;
 	nullpo_retr(-1, sd);
@@ -4066,7 +4067,7 @@ ACMD_FUNC(recallall)
  *------------------------------------------*/
 ACMD_FUNC(guildrecall)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 	int count;
 	char guild_name[NAME_LENGTH];
@@ -4128,7 +4129,7 @@ ACMD_FUNC(guildrecall)
  *------------------------------------------*/
 ACMD_FUNC(partyrecall)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 	char party_name[NAME_LENGTH];
 	struct party_data *p;
@@ -4276,7 +4277,7 @@ ACMD_FUNC(reload) {
 		clif_displaymessage(fd, msg_txt(sd,268)); // Reloaded the Message of the Day.
 	} else if (strstr(command, "script") || strncmp(message, "script", 3) == 0) {
 		struct s_mapiterator* iter;
-		struct map_session_data* pl_sd;
+		map_session_data* pl_sd;
 		//atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
 		//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
 
@@ -4356,7 +4357,7 @@ ACMD_FUNC(partysharelvl) {
  * 3 = Shows the chats in that map
  *------------------------------------------*/
 ACMD_FUNC(mapinfo) {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 	struct s_mapiterator* iter;
 	struct chat_data *cd = NULL;
 	char direction[12];
@@ -4910,7 +4911,7 @@ ACMD_FUNC(repairall)
  *------------------------------------------*/
 ACMD_FUNC(nuke)
 {
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -5217,7 +5218,7 @@ ACMD_FUNC(servertime)
  *------------------------------------------*/
 ACMD_FUNC(jail)
 {
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 
 	nullpo_retr(-1, sd);
 
@@ -5255,7 +5256,7 @@ ACMD_FUNC(jail)
  *------------------------------------------*/
 ACMD_FUNC(unjail)
 {
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
 
@@ -5288,7 +5289,7 @@ ACMD_FUNC(unjail)
 }
 
 ACMD_FUNC(jailfor) {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	char * modif_p;
 	int jailtime = 0;
 
@@ -5442,7 +5443,7 @@ ACMD_FUNC(disguise)
 ACMD_FUNC(disguiseall)
 {
 	int mob_id=0;
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 	struct s_mapiterator* iter;
 	nullpo_retr(-1, sd);
 
@@ -5508,7 +5509,7 @@ ACMD_FUNC(disguiseguild)
 	}
 
 	for( i = 0; i < g->max_member; i++ ){
-		struct map_session_data *pl_sd;
+		map_session_data *pl_sd;
 		if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) )
 			pc_disguise(pl_sd, id);
 	}
@@ -5540,7 +5541,7 @@ ACMD_FUNC(undisguise)
  *------------------------------------------*/
 ACMD_FUNC(undisguiseall)
 {
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 	struct s_mapiterator* iter;
 	nullpo_retr(-1, sd);
 
@@ -5578,7 +5579,7 @@ ACMD_FUNC(undisguiseguild)
 	}
 
 	for(i = 0; i < g->max_member; i++){
-		struct map_session_data *pl_sd;
+		map_session_data *pl_sd;
 		if( (pl_sd = g->member[i].sd) && pl_sd->disguise )
 			pc_disguise(pl_sd, 0);
 	}
@@ -5849,7 +5850,7 @@ ACMD_FUNC(addwarp)
  *------------------------------------------*/
 ACMD_FUNC(follow)
 {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -6117,7 +6118,7 @@ ACMD_FUNC(skillid) {
  *------------------------------------------*/
 ACMD_FUNC(useskill)
 {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	struct block_list *bl;
 	uint16 skill_id;
 	uint16 skill_lv;
@@ -6254,7 +6255,7 @@ ACMD_FUNC(displayskillunit)
  *------------------------------------------*/
 ACMD_FUNC(skilltree)
 {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	uint16 skill_id;
 	nullpo_retr(-1, sd);
 
@@ -6301,7 +6302,7 @@ ACMD_FUNC(skilltree)
 }
 
 // Hand a ring with partners name on it to this char
-void getring (struct map_session_data* sd)
+void getring (map_session_data* sd)
 {
 	char flag = 0;
 	t_itemid item_id;
@@ -6327,7 +6328,7 @@ void getring (struct map_session_data* sd)
  *------------------------------------------*/
 ACMD_FUNC(marry)
 {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 
 	nullpo_retr(-1, sd);
 
@@ -6457,7 +6458,7 @@ ACMD_FUNC(autotrade) {
 ACMD_FUNC(changegm)
 {
 	struct guild *g;
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -7219,7 +7220,7 @@ ACMD_FUNC(users)
 	iter = mapit_getallusers();
 	for(;;)
 	{
-		struct map_session_data* sd2 = (struct map_session_data*)mapit_next(iter);
+		map_session_data* sd2 = (map_session_data*)mapit_next(iter);
 		if( sd2 == NULL )
 			break;// no more users
 
@@ -7342,7 +7343,7 @@ ACMD_FUNC(adjgroup)
  *------------------------------------------*/
 ACMD_FUNC(trade)
 {
-    struct map_session_data *pl_sd = NULL;
+    map_session_data* pl_sd = nullptr;;
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -7396,7 +7397,7 @@ ACMD_FUNC(setbattleflag)
  *------------------------------------------*/
 ACMD_FUNC(unmute)
 {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -7494,7 +7495,7 @@ ACMD_FUNC(changecharsex)
  *------------------------------------------------*/
 ACMD_FUNC(mute)
 {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	int manner;
 	nullpo_retr(-1, sd);
 
@@ -7545,7 +7546,7 @@ ACMD_FUNC(refresh)
 
 ACMD_FUNC(refreshall)
 {
-	struct map_session_data* iter_sd;
+	map_session_data* iter_sd;
 	struct s_mapiterator* iter;
 	nullpo_retr(-1, sd);
 
@@ -8400,7 +8401,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
 {
 
 	int time, id;
-	struct map_session_data *pl_sd = (struct map_session_data *)bl;
+	map_session_data *pl_sd = (map_session_data *)bl;
 	if (pl_sd == NULL)
 		return 0;
 
@@ -8534,7 +8535,7 @@ ACMD_FUNC(size)
 ACMD_FUNC(sizeall)
 {
 	int size;
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 	struct s_mapiterator* iter;
 
 	size = atoi(message);
@@ -8565,7 +8566,7 @@ ACMD_FUNC(sizeguild)
 {
 	int size = SZ_SMALL, i;
 	char guild[NAME_LENGTH];
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 	struct guild *g;
 	nullpo_retr(-1, sd);
 
@@ -8798,7 +8799,7 @@ ACMD_FUNC(showdelay)
 ACMD_FUNC(invite)
 {
 	unsigned int did = sd->duel_group;
-	struct map_session_data *target_sd = NULL;
+	map_session_data *target_sd = NULL;
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
 	memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -8870,7 +8871,7 @@ ACMD_FUNC(duel)
 			}
 			duel_create(sd, maxpl);
 		} else {
-			struct map_session_data *target_sd = NULL;
+			map_session_data *target_sd = NULL;
 
 			memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
 			memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -9027,7 +9028,7 @@ ACMD_FUNC(cash)
 ACMD_FUNC(clone)
 {
 	int x=0,y=0,flag=0,master=0,i=0;
-	struct map_session_data *pl_sd=NULL;
+	map_session_data *pl_sd=NULL;
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
 
@@ -9605,7 +9606,7 @@ ACMD_FUNC(font)
 /*==========================================
  * type: 1 = commands (@), 2 = charcommands (#)
  *------------------------------------------*/
-static void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommandType type)
+static void atcommand_commands_sub(map_session_data* sd, const int fd, AtCommandType type)
 {
 	char line_buff[CHATBOX_SIZE];
 	char* cur = line_buff;
@@ -9992,7 +9993,7 @@ ACMD_FUNC(join){
  * Display available option for @channel command
  * @command : the name of used command (for alias case)
  */
-static inline void atcmd_channel_help(struct map_session_data *sd, const char *command)
+static inline void atcmd_channel_help(map_session_data *sd, const char *command)
 {
 	int fd = sd->fd;
 	bool can_delete = pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN);
@@ -10194,7 +10195,7 @@ ACMD_FUNC(langtype)
 
 #ifdef VIP_ENABLE
 ACMD_FUNC(vip) {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	char * modif_p;
 	int32 vipdifftime = 0;
 	time_t now=time(NULL);
@@ -10383,7 +10384,7 @@ ACMD_FUNC(costume) {
 * @author [Cydh], [Antares]
 */
 ACMD_FUNC(cloneequip) {
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 
 	nullpo_retr(-1, sd);
 
@@ -10456,7 +10457,7 @@ ACMD_FUNC(cloneequip) {
 * @author [Cydh], [Antares]
 */
 ACMD_FUNC(clonestat) {
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 
 	nullpo_retr(-1, sd);
 
@@ -10737,6 +10738,10 @@ ACMD_FUNC( stylist ){
 	clif_displaymessage( fd, msg_txt( sd, 798 ) ); // This command requires packet version 2015-11-04 or newer.
 	return -1;
 #else
+	if( !battle_config.feature_stylist ){
+		clif_displaymessage( fd, msg_txt( sd, 774 ) ); // This command is disabled via configuration.
+		return -1;
+	}
 
 	if( sd->state.stylist_open ){
 		clif_displaymessage( fd, msg_txt( sd, 799 ) ); // You have already opened the stylist UI.
@@ -11172,7 +11177,7 @@ static AtCommandInfo* get_atcommandinfo_byname(const char *name)
 }
 
 /// AtCommand suggestion
-static void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool atcommand) {
+static void atcommand_get_suggestions(map_session_data* sd, const char *name, bool atcommand) {
 	DBIterator* atcommand_iter;
 	AtCommandInfo* command_info = NULL;
 	AtCommandType type = atcommand ? COMMAND_ATCOMMAND : COMMAND_CHARCOMMAND;
@@ -11259,7 +11264,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n
  *  2 : console (admin:@atcommand)
  *  3 : script call (useatcmd)
  */
-bool is_atcommand(const int fd, struct map_session_data* sd, const char* message, int type)
+bool is_atcommand(const int fd, map_session_data* sd, const char* message, int type)
 {
 	char command[CHAT_SIZE_MAX], params[CHAT_SIZE_MAX];
 	char output[CHAT_SIZE_MAX];

+ 3 - 3
src/map/atcommand.hpp

@@ -7,7 +7,7 @@
 #include "../common/cbasetypes.hpp"
 #include "../common/mmo.hpp"
 
-struct map_session_data;
+class map_session_data;
 
 //global var
 extern char atcommand_symbol;
@@ -19,9 +19,9 @@ enum AtCommandType : uint8 {
 	COMMAND_CHARCOMMAND = 2,
 } ;
 
-typedef int (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message);
+typedef int (*AtCommandFunc)(const int fd, map_session_data* sd, const char* command, const char* message);
 
-bool is_atcommand(const int fd, struct map_session_data* sd, const char* message, int type);
+bool is_atcommand(const int fd, map_session_data* sd, const char* message, int type);
 
 void do_init_atcommand(void);
 void do_final_atcommand(void);

+ 110 - 100
src/map/battle.cpp

@@ -123,7 +123,7 @@ int battle_gettarget(struct block_list* bl)
 {
 
 	switch (bl->type) {
-		case BL_PC:  return ((struct map_session_data*)bl)->ud.target;
+		case BL_PC:  return ((map_session_data*)bl)->ud.target;
 		case BL_MOB: return ((struct mob_data*)bl)->target_id;
 		case BL_PET: return ((struct pet_data*)bl)->target_id;
 		case BL_HOM: return ((struct homun_data*)bl)->ud.target;
@@ -334,7 +334,7 @@ TIMER_FUNC(battle_delay_damage_sub){
 			}
 		}
 
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
 
 		if (sd && --sd->delayed_damage == 0 && sd->state.hold_recalc) {
 			sd->state.hold_recalc = false;
@@ -348,7 +348,7 @@ TIMER_FUNC(battle_delay_damage_sub){
 int battle_delay_damage(t_tick tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, t_tick ddelay, bool additional_effects, bool isspdamage)
 {
 	struct delay_damage *dat;
-	struct status_change *sc;
+	status_change *sc;
 	struct block_list *d_tbl = NULL;
 	struct block_list *e_tbl = NULL;
 
@@ -370,7 +370,7 @@ int battle_delay_damage(t_tick tick, int amotion, struct block_list *src, struct
 		&& skill_id != PA_PRESSURE
 #endif
 		) {
-		struct map_session_data* tsd = BL_CAST( BL_PC, target );
+		map_session_data* tsd = BL_CAST( BL_PC, target );
 
 		if( tsd && pc_issit( tsd ) && battle_config.devotion_standup_fix ){
 			pc_setstand( tsd, true );
@@ -424,7 +424,7 @@ int battle_delay_damage(t_tick tick, int amotion, struct block_list *src, struct
  */
 int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv)
 {
-	struct status_change *sc = NULL, *tsc = NULL;
+	status_change *sc = NULL, *tsc = NULL;
 	int ratio;
 
 	if (src) sc = status_get_sc(src);
@@ -654,7 +654,7 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
  * @return damage Damage diff between original damage and after calculation
  */
 int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, std::bitset<NK_MAX> nk, int rh_ele, int lh_ele, int64 damage, int left, int flag){
-	struct map_session_data *sd, ///< Attacker session data if BL_PC
+	map_session_data *sd, ///< Attacker session data if BL_PC
 		*tsd; ///< Target session data if BL_PC
 	int cardfix = 1000;
 	int s_class, ///< Attacker class
@@ -1060,7 +1060,7 @@ static void battle_absorb_damage(struct block_list *bl, struct Damage *d) {
 	switch (bl->type) {
 		case BL_PC:
 			{
-				struct map_session_data *sd = BL_CAST(BL_PC, bl);
+				map_session_data *sd = BL_CAST(BL_PC, bl);
 				if (!sd)
 					return;
 				dmg_ori = dmg_new = d->damage + d->damage2;
@@ -1106,7 +1106,7 @@ static void battle_absorb_damage(struct block_list *bl, struct Damage *d) {
  * @param skill_lv: Skill level
  * @return True: Damage inflicted, False: Missed
  **/
-bool battle_status_block_damage(struct block_list *src, struct block_list *target, struct status_change *sc, struct Damage *d, int64 &damage, uint16 skill_id, uint16 skill_lv) {
+bool battle_status_block_damage(struct block_list *src, struct block_list *target, status_change *sc, struct Damage *d, int64 &damage, uint16 skill_id, uint16 skill_lv) {
 	if (!src || !target || !sc || !d)
 		return true;
 
@@ -1413,8 +1413,8 @@ bool battle_status_block_damage(struct block_list *src, struct block_list *targe
  */
 int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int64 damage,uint16 skill_id,uint16 skill_lv)
 {
-	struct map_session_data *sd = NULL, *tsd = BL_CAST(BL_PC, src);
-	struct status_change *sc;
+	map_session_data *sd = NULL, *tsd = BL_CAST(BL_PC, src);
+	status_change *sc;
 	struct status_change_entry *sce;
 	int div_ = d->div_, flag = d->flag;
 
@@ -1430,7 +1430,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
 		return 0;
 
 	if (bl->type == BL_PC) {
-		sd=(struct map_session_data *)bl;
+		sd=(map_session_data *)bl;
 		//Special no damage states
 		if(flag&BF_WEAPON && sd->special_state.no_weapon_damage)
 			damage -= damage * sd->special_state.no_weapon_damage / 100;
@@ -1868,7 +1868,7 @@ bool battle_can_hit_bg_target(struct block_list *src, struct block_list *bl, uin
 		if (status_bl_has_mode(bl, MD_SKILLIMMUNE) && flag&BF_SKILL) //Skill immunity.
 			return false;
 		if (src->type == BL_PC) {
-			struct map_session_data *sd = map_id2sd(src->id);
+			map_session_data *sd = map_id2sd(src->id);
 
 			if (sd && sd->bg_id == md->bg_id)
 				return false;
@@ -2059,7 +2059,7 @@ static int battle_calc_drain(int64 damage, int rate, int per)
  * @param type
  * @return damage
  */
-int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,int64 dmg,int type)
+int64 battle_addmastery(map_session_data *sd,struct block_list *target,int64 dmg,int type)
 {
 	int64 damage;
 	struct status_data *status = status_get_status_data(target);
@@ -2189,7 +2189,7 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
 * @param damage Current damage
 * @param lr_type EQI_HAND_L:left-hand weapon, EQI_HAND_R:right-hand weapon
 */
-static void battle_add_weapon_damage(struct map_session_data *sd, int64 *damage, int lr_type) {
+static void battle_add_weapon_damage(map_session_data *sd, int64 *damage, int lr_type) {
 	if (!sd)
 		return;
 	//rodatazone says that Overrefine bonuses are part of baseatk
@@ -2209,7 +2209,7 @@ static void battle_add_weapon_damage(struct map_session_data *sd, int64 *damage,
 }
 
 #ifdef RENEWAL
-static int battle_calc_sizefix(int64 damage, struct map_session_data *sd, unsigned char t_size, unsigned char weapon_type, short flag)
+static int battle_calc_sizefix(int64 damage, map_session_data *sd, unsigned char t_size, unsigned char weapon_type, short flag)
 {
 	if (sd && !sd->special_state.no_sizefix && !flag) // Size fix only for players
 		damage = damage * (weapon_type == EQI_HAND_L ? sd->left_weapon.atkmods[t_size] : sd->right_weapon.atkmods[t_size]) / 100;
@@ -2234,7 +2234,7 @@ static int battle_calc_status_attack(struct status_data *status, short hand)
  * @param sd Player
  * @return Base weapon damage
  */
-static int battle_calc_base_weapon_attack(struct block_list *src, struct status_data *tstatus, struct weapon_atk *wa, struct map_session_data *sd, bool critical)
+static int battle_calc_base_weapon_attack(struct block_list *src, struct status_data *tstatus, struct weapon_atk *wa, map_session_data *sd, bool critical)
 {
 	struct status_data *status = status_get_status_data(src);
 	uint8 type = (wa == &status->lhw)?EQI_HAND_L:EQI_HAND_R;
@@ -2242,7 +2242,7 @@ static int battle_calc_base_weapon_attack(struct block_list *src, struct status_
 	uint16 atkmax = atkmin;
 	int64 damage = atkmin;
 	bool weapon_perfection = false;
-	struct status_change *sc = status_get_sc(src);
+	status_change *sc = status_get_sc(src);
 
 	if (sd && sd->equip_index[type] >= 0 && sd->inventory_data[sd->equip_index[type]]) {
 		short base_stat;
@@ -2307,12 +2307,12 @@ static int battle_calc_base_weapon_attack(struct block_list *src, struct status_
  *	Initial refactoring by Baalberith
  *	Refined and optimized by helvetica
  */
-static int64 battle_calc_base_damage(struct block_list *src, struct status_data *status, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, int flag)
+static int64 battle_calc_base_damage(struct block_list *src, struct status_data *status, struct weapon_atk *wa, status_change *sc, unsigned short t_size, int flag)
 {
 	unsigned int atkmin = 0, atkmax = 0;
 	short type = 0;
 	int64 damage = 0;
-	struct map_session_data *sd = NULL;
+	map_session_data *sd = NULL;
 
 	nullpo_retr(damage, src);
 
@@ -2371,7 +2371,7 @@ static int64 battle_calc_base_damage(struct block_list *src, struct status_data
 		if (!(sd->special_state.no_sizefix || (flag&8)))
 			damage = damage * (type == EQI_HAND_L ? sd->left_weapon.atkmods[t_size] : sd->right_weapon.atkmods[t_size]) / 100;
 	} else if (src->type == BL_ELEM) {
-		struct status_change *ele_sc = status_get_sc(src);
+		status_change *ele_sc = status_get_sc(src);
 		int ele_class = status_get_class(src);
 
 		if (ele_sc) {
@@ -2434,7 +2434,7 @@ static int64 battle_calc_base_damage(struct block_list *src, struct status_data
  *	Initial refactoring by Baalberith
  *	Refined and optimized by helvetica
  */
-void battle_consume_ammo(struct map_session_data*sd, int skill, int lv)
+void battle_consume_ammo(map_session_data*sd, int skill, int lv)
 {
 	int qty = 1;
 
@@ -2505,7 +2505,7 @@ static int battle_range_type(struct block_list *src, struct block_list *target,
 	return BF_LONG;
 }
 
-static int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id)
+static int battle_blewcount_bonus(map_session_data *sd, uint16 skill_id)
 {
 	if (sd->skillblown.empty())
 		return 0;
@@ -2615,7 +2615,7 @@ static int battle_skill_damage(struct block_list *src, struct block_list *target
  * @param sd: Player who has Chorus skill active
  * @return Bonus value based on party count
  */
-int battle_calc_chorusbonus(struct map_session_data *sd) {
+int battle_calc_chorusbonus(map_session_data *sd) {
 #ifdef RENEWAL // No bonus in renewal
 	return 0;
 #endif
@@ -2681,7 +2681,7 @@ static bool is_skill_using_arrow(struct block_list *src, int skill_id)
 {
 	if(src != NULL) {
 		struct status_data *sstatus = status_get_status_data(src);
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
 
 		return ((sd && sd->state.arrow_atk) || (!sd && ((skill_id && skill_get_ammotype(skill_id)) || sstatus->rhw.range>3)) || (skill_id == HT_PHANTASMIC) || (skill_id == GS_GROUNDDRIFT));
 	} else
@@ -2699,7 +2699,7 @@ static bool is_skill_using_arrow(struct block_list *src, int skill_id)
 static bool is_attack_right_handed(struct block_list *src, int skill_id)
 {
 	if(src != NULL) {
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
 
 		//Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2)
 		if(!skill_id && sd && sd->weapontype1 == W_FIST && sd->weapontype2 != W_FIST)
@@ -2721,7 +2721,7 @@ static bool is_attack_left_handed(struct block_list *src, int skill_id)
 	if(src != NULL) {
 		//Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2)
 		if(!skill_id) {
-			struct map_session_data *sd = BL_CAST(BL_PC, src);
+			map_session_data *sd = BL_CAST(BL_PC, src);
 
 			if (sd) {
 				if (sd->weapontype1 == W_FIST && sd->weapontype2 != W_FIST)
@@ -2763,7 +2763,7 @@ static bool is_attack_critical(struct Damage* wd, struct block_list *src, struct
 
 	if( sstatus->cri )
 	{
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
 
 		if(wd->type == DMG_MULTI_HIT){	//Multiple Hit Attack Skills.
 			if(pc_checkskill(sd,GS_CHAINACTION) && !skill_get_nk(GS_CHAINACTION,NK_CRITICAL)) //Chain Action
@@ -2774,9 +2774,9 @@ static bool is_attack_critical(struct Damage* wd, struct block_list *src, struct
 		}
 
 		struct status_data *tstatus = status_get_status_data(target);
-		struct status_change *sc = status_get_sc(src);
-		struct status_change *tsc = status_get_sc(target);
-		struct map_session_data *tsd = BL_CAST(BL_PC, target);
+		status_change *sc = status_get_sc(src);
+		status_change *tsc = status_get_sc(target);
+		map_session_data *tsd = BL_CAST(BL_PC, target);
 		short cri = sstatus->cri;
 
 		if (sd) {
@@ -2856,7 +2856,7 @@ static int is_attack_piercing(struct Damage* wd, struct block_list *src, struct
 		return 2;
 
 	if(src != NULL) {
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
 		struct status_data *tstatus = status_get_status_data(target);
 
 		if( skill_id != PA_SACRIFICE && skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS && skill_id != PA_SHIELDCHAIN && skill_id != KO_HAPPOKUNAI
@@ -2917,9 +2917,9 @@ static bool is_attack_hitting(struct Damage* wd, struct block_list *src, struct
 {
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
-	struct status_change *sc = status_get_sc(src);
-	struct status_change *tsc = status_get_sc(target);
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
+	status_change *tsc = status_get_sc(target);
+	map_session_data *sd = BL_CAST(BL_PC, src);
 	std::bitset<NK_MAX> nk = battle_skill_get_damage_properties(skill_id, wd->miscflag);
 	short flee, hitrate;
 
@@ -3105,8 +3105,8 @@ static bool is_attack_hitting(struct Damage* wd, struct block_list *src, struct
 static bool attack_ignores_def(struct Damage* wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, short weapon_position)
 {
 	struct status_data *tstatus = status_get_status_data(target);
-	struct status_change *sc = status_get_sc(src);
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
 	std::bitset<NK_MAX> nk = battle_skill_get_damage_properties(skill_id, wd->miscflag);
 
 #ifndef RENEWAL
@@ -3175,7 +3175,7 @@ static int battle_calc_equip_attack(struct block_list *src, int skill_id)
 	if(src != NULL) {
 		int eatk = 0;
 		struct status_data *status = status_get_status_data(src);
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
 
 		if (sd) // add arrow atk if using an applicable skill
 			eatk += (is_skill_using_arrow(src, skill_id) ? sd->bonus.arrow_atk : 0);
@@ -3196,8 +3196,8 @@ static int battle_calc_equip_attack(struct block_list *src, int skill_id)
  */
 int battle_get_weapon_element(struct Damage* wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, short weapon_position, bool calc_for_damage_only)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct status_change *sc = status_get_sc(src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
 	struct status_data *sstatus = status_get_status_data(src);
 	int element = skill_get_ele(skill_id, skill_lv);
 
@@ -3290,8 +3290,8 @@ static void battle_calc_element_damage(struct Damage* wd, struct block_list *src
 
 	// Elemental attribute fix
 	if(!nk[NK_IGNOREELEMENT] && (wd->damage > 0 || wd->damage2 > 0)) {
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
-		struct status_change *sc = status_get_sc(src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
+		status_change *sc = status_get_sc(src);
 		struct status_data *sstatus = status_get_status_data(src);
 		struct status_data *tstatus = status_get_status_data(target);
 		int left_element = battle_get_weapon_element(wd, src, target, skill_id, skill_lv, EQI_HAND_L, true);
@@ -3391,8 +3391,8 @@ static void battle_calc_element_damage(struct Damage* wd, struct block_list *src
  */
 static void battle_calc_attack_masteries(struct Damage* wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct status_change *sc = status_get_sc(src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
 	struct status_data *sstatus = status_get_status_data(src);
 	int t_class = status_get_class(target);
 
@@ -3488,7 +3488,7 @@ static void battle_calc_damage_parts(struct Damage* wd, struct block_list *src,s
 {
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
 	bool critical = false;
 
 	int right_element = battle_get_weapon_element(wd, src, target, skill_id, skill_lv, EQI_HAND_R, false);
@@ -3557,11 +3557,11 @@ static void battle_calc_damage_parts(struct Damage* wd, struct block_list *src,s
  */
 static void battle_calc_skill_base_damage(struct Damage* wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
 {
-	struct status_change *sc = status_get_sc(src);
+	status_change *sc = status_get_sc(src);
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct map_session_data *tsd = BL_CAST(BL_PC, target);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	map_session_data *tsd = BL_CAST(BL_PC, target);
 
 	uint16 i;
 	std::bitset<NK_MAX> nk = battle_skill_get_damage_properties(skill_id, wd->miscflag);
@@ -3818,9 +3818,9 @@ static void battle_apply_div_fix(struct Damage* d, uint16 skill_id)
  */
 static void battle_calc_multi_attack(struct Damage* wd, struct block_list *src,struct block_list *target, uint16 skill_id, uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct status_change *sc = status_get_sc(src);
-	struct status_change *tsc = status_get_sc(target);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
+	status_change *tsc = status_get_sc(target);
 	struct status_data *tstatus = status_get_status_data(target);
 
 	if( sd && !skill_id ) {	// if no skill_id passed, check for double attack [helvetica]
@@ -3915,10 +3915,10 @@ static void battle_calc_multi_attack(struct Damage* wd, struct block_list *src,s
  */
 static int battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct map_session_data *tsd = BL_CAST(BL_PC, target);
-	struct status_change *sc = status_get_sc(src);
-	struct status_change *tsc = status_get_sc(target);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	map_session_data *tsd = BL_CAST(BL_PC, target);
+	status_change *sc = status_get_sc(src);
+	status_change *tsc = status_get_sc(target);
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
 	int skillratio = 100;
@@ -5386,8 +5386,8 @@ static int battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list *
  */
 static int64 battle_calc_skill_constant_addition(struct Damage* wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct map_session_data *tsd = BL_CAST(BL_PC, target);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	map_session_data *tsd = BL_CAST(BL_PC, target);
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
 	int64 atk = 0;
@@ -5441,8 +5441,8 @@ static int64 battle_calc_skill_constant_addition(struct Damage* wd, struct block
  */
 static void battle_attack_sc_bonus(struct Damage* wd, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct status_change *sc = status_get_sc(src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
 	uint8 anger_id = 0; // SLS Anger
@@ -5634,10 +5634,10 @@ static void battle_attack_sc_bonus(struct Damage* wd, struct block_list *src, st
  */
 static void battle_calc_defense_reduction(struct Damage* wd, struct block_list *src,struct block_list *target, uint16 skill_id, uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct map_session_data *tsd = BL_CAST(BL_PC, target);
-	struct status_change *sc = status_get_sc(src);
-	struct status_change *tsc = status_get_sc(target);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	map_session_data *tsd = BL_CAST(BL_PC, target);
+	status_change *sc = status_get_sc(src);
+	status_change *tsc = status_get_sc(target);
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
 
@@ -5814,8 +5814,8 @@ static void battle_calc_defense_reduction(struct Damage* wd, struct block_list *
  */
 static void battle_calc_attack_post_defense(struct Damage* wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct status_change *sc = status_get_sc(src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
 	struct status_data *sstatus = status_get_status_data(src);
 
 	// Post skill/vit reduction damage increases
@@ -5881,7 +5881,7 @@ static void battle_calc_attack_plant(struct Damage* wd, struct block_list *src,s
 	if( attack_hits || wd->damage > 0 )
 		wd->damage = 1; //In some cases, right hand no need to have a weapon to deal a damage
 	if( is_attack_left_handed(src, skill_id) && (attack_hits || wd->damage2 > 0) ) {
-		struct map_session_data *sd = BL_CAST(BL_PC, src);
+		map_session_data *sd = BL_CAST(BL_PC, src);
 
 		if (sd && sd->status.weapon == W_KATAR)
 			wd->damage2 = 0; //No backhand damage against plants
@@ -5890,7 +5890,7 @@ static void battle_calc_attack_plant(struct Damage* wd, struct block_list *src,s
 	}
 
 	if (attack_hits && target->type == BL_MOB) {
-		struct status_change *sc = status_get_sc(target);
+		status_change *sc = status_get_sc(target);
 		int64 damage_dummy = 1;
 
 		if (sc && !battle_status_block_damage(src, target, sc, wd, damage_dummy, skill_id, skill_lv)) { // Statuses that reduce damage to 0.
@@ -5938,7 +5938,7 @@ static void battle_calc_attack_plant(struct Damage* wd, struct block_list *src,s
  */
 static void battle_calc_attack_left_right_hands(struct Damage* wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
 
 	if (sd) {
 		int skill;
@@ -5997,7 +5997,7 @@ struct block_list *battle_check_devotion(struct block_list *bl) {
 	struct block_list *d_bl = NULL;
 
 	if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rnd() % 100) {
-		struct status_change *sc = status_get_sc(bl);
+		status_change *sc = status_get_sc(bl);
 		if (sc && sc->getSCE(SC_DEVOTION))
 			d_bl = map_id2bl(sc->getSCE(SC_DEVOTION)->val1);
 	}
@@ -6019,7 +6019,7 @@ static void battle_calc_attack_gvg_bg(struct Damage* wd, struct block_list *src,
 			(!skill_id || skill_id ||
 			(src->type == BL_SKILL && (skill_id == SG_SUN_WARM || skill_id == SG_MOON_WARM || skill_id == SG_STAR_WARM))) ) {
 				int64 damage = wd->damage + wd->damage2, rdamage = 0;
-				struct map_session_data *tsd = BL_CAST(BL_PC, target);
+				map_session_data *tsd = BL_CAST(BL_PC, target);
 				struct status_data *sstatus = status_get_status_data(src);
 				t_tick tick = gettick(), rdelay = 0;
 
@@ -6078,10 +6078,10 @@ static void battle_calc_attack_gvg_bg(struct Damage* wd, struct block_list *src,
  */
 static void battle_calc_weapon_final_atk_modifiers(struct Damage* wd, struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv)
 {
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
-	struct map_session_data *tsd = BL_CAST(BL_PC, target);
-	struct status_change *sc = status_get_sc(src);
-	struct status_change *tsc = status_get_sc(target);
+	map_session_data *sd = BL_CAST(BL_PC, src);
+	map_session_data *tsd = BL_CAST(BL_PC, target);
+	status_change *sc = status_get_sc(src);
+	status_change *tsc = status_get_sc(target);
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
 	int skill_damage = 0;
@@ -6179,8 +6179,8 @@ static struct Damage initialize_weapon_data(struct block_list *src, struct block
 {
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
-	struct status_change *sc = status_get_sc(src);
-	struct map_session_data *sd = BL_CAST(BL_PC, src);
+	status_change *sc = status_get_sc(src);
+	map_session_data *sd = BL_CAST(BL_PC, src);
 	struct Damage wd;
 
 	wd.type = DMG_NORMAL; //Normal attack
@@ -6348,8 +6348,8 @@ void battle_do_reflect(int attack_type, struct Damage *wd, struct block_list* sr
 		(src->type == BL_SKILL && (skill_id == SG_SUN_WARM || skill_id == SG_MOON_WARM || skill_id == SG_STAR_WARM ))))
 	{
 		int64 damage = wd->damage + wd->damage2, rdamage = 0;
-		struct map_session_data *tsd = BL_CAST(BL_PC, target);
-		struct status_change *tsc = status_get_sc(target);
+		map_session_data *tsd = BL_CAST(BL_PC, target);
+		status_change *tsc = status_get_sc(target);
 		struct status_data *sstatus = status_get_status_data(src);
 		struct unit_data *ud = unit_bl2ud(target);
 		t_tick tick = gettick(), rdelay = 0;
@@ -6397,10 +6397,10 @@ void battle_do_reflect(int attack_type, struct Damage *wd, struct block_list* sr
  */
 static struct Damage battle_calc_weapon_attack(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int wflag)
 {
-	struct map_session_data *sd, *tsd;
+	map_session_data *sd, *tsd;
 	struct Damage wd;
-	struct status_change *sc = status_get_sc(src);
-	struct status_change *tsc = status_get_sc(target);
+	status_change *sc = status_get_sc(src);
+	status_change *tsc = status_get_sc(target);
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
 	int right_element, left_element;
@@ -6794,7 +6794,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 
 	TBL_PC *sd;
 	TBL_PC *tsd;
-	struct status_change *sc, *tsc;
+	status_change *sc, *tsc;
 	struct Damage ad;
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
@@ -7017,7 +7017,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 				break;
 			case NPC_ICEMINE:
 			case NPC_FLAMECROSS:
-				ad.damage = sstatus->rhw.atk * 20 * skill_lv;
+				ad.damage = static_cast<int64>( sstatus->rhw.atk ) * static_cast<int64>( 20 ) * static_cast<int64>( skill_lv );
 				break;
 			default: {
 				if (sstatus->matk_max > sstatus->matk_min) {
@@ -7924,11 +7924,11 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 	int skill_damage = 0;
 	short i, s_ele;
 
-	struct map_session_data *sd, *tsd;
+	map_session_data *sd, *tsd;
 	struct Damage md; //DO NOT CONFUSE with md of mob_data!
 	struct status_data *sstatus = status_get_status_data(src);
 	struct status_data *tstatus = status_get_status_data(target);
-	struct status_change *ssc = status_get_sc(src);
+	status_change *ssc = status_get_sc(src);
 
 	memset(&md,0,sizeof(md));
 
@@ -8109,7 +8109,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 			{
 				short totaldef;
 				struct Damage atk = battle_calc_weapon_attack(src, target, skill_id, skill_lv, 0);
-				struct status_change *sc = status_get_sc(src);
+				status_change *sc = status_get_sc(src);
 
 				md.damage = (int64)sstatus->hp + (atk.damage * (int64)sstatus->hp * skill_lv) / (int64)sstatus->max_hp;
 
@@ -8188,7 +8188,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 	}
 
 	if (!nk[NK_IGNOREFLEE]) {
-		struct status_change *sc = status_get_sc(target);
+		status_change *sc = status_get_sc(target);
 
 		i = 0; //Temp for "hit or no hit"
 		if(sc && sc->opt1 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING)
@@ -8298,7 +8298,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
  * @param target: Target to vanish HP/SP
  * @param flag: Damage struct battle flag
  */
-void battle_vanish_damage(struct map_session_data *sd, struct block_list *target, int flag)
+void battle_vanish_damage(map_session_data *sd, struct block_list *target, int flag)
 {
 	nullpo_retv(sd);
 	nullpo_retv(target);
@@ -8378,7 +8378,7 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
 	else // Some skills like Weaponry Research will cause damage even if attack is dodged
 		d.dmg_lv = ATK_DEF;
 
-	struct map_session_data *sd = BL_CAST(BL_PC, bl);
+	map_session_data *sd = BL_CAST(BL_PC, bl);
 
 	if (sd && d.damage + d.damage2 > 1)
 		battle_vanish_damage(sd, target, d.flag);
@@ -8511,7 +8511,7 @@ int64 battle_calc_return_damage(struct block_list* tbl, struct block_list *src,
  * @param wd: Damage struct reference
  * @return True on damage done or false if not
  */
-bool battle_vellum_damage(struct map_session_data *sd, struct block_list *target, struct Damage *wd)
+bool battle_vellum_damage(map_session_data *sd, struct block_list *target, struct Damage *wd)
 {
 	nullpo_retr(false, sd);
 	nullpo_retr(false, target);
@@ -8543,7 +8543,7 @@ bool battle_vellum_damage(struct map_session_data *sd, struct block_list *target
 /*===========================================
  * Perform battle drain effects (HP/SP loss)
  *-------------------------------------------*/
-void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int class_)
+void battle_drain(map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int class_)
 {
 	struct weapon_data *wd;
 	int64 *damage;
@@ -8677,7 +8677,7 @@ void battle_autocast_aftercast(struct block_list* src, uint16 skill_id, uint16 s
  * @param tick: Server tick
  * @param flag: Special skill flags
  */
-void battle_autocast_elembuff_skill(struct map_session_data* sd, struct block_list* target, uint16 skill_id, t_tick tick, int flag)
+void battle_autocast_elembuff_skill(map_session_data* sd, struct block_list* target, uint16 skill_id, t_tick tick, int flag)
 {
 	uint16 skill_lv = pc_checkskill(sd, skill_id);
 
@@ -8695,9 +8695,9 @@ void battle_autocast_elembuff_skill(struct map_session_data* sd, struct block_li
  * Do a basic physical attack (call through unit_attack_timer)
  *------------------------------------------*/
 enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, t_tick tick, int flag) {
-	struct map_session_data *sd = NULL, *tsd = NULL;
+	map_session_data *sd = NULL, *tsd = NULL;
 	struct status_data *sstatus, *tstatus;
-	struct status_change *sc, *tsc;
+	status_change *sc, *tsc;
 	int64 damage;
 	int skillv;
 	struct Damage wd;
@@ -8981,10 +8981,10 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
 				// Only trigger if the devoted player was hit
 				if( damage > 0 ){
 					int64 devotion_damage = damage;
-					struct map_session_data* dsd = BL_CAST( BL_PC, d_bl );
+					map_session_data* dsd = BL_CAST( BL_PC, d_bl );
 
 					// Needed to check the devotion master for Rebound Shield status.
-					struct status_change *d_sc = status_get_sc(d_bl);
+					status_change *d_sc = status_get_sc(d_bl);
 
 					// The devoting player needs to stand up
 					if( dsd && pc_issit( dsd ) ){
@@ -9339,7 +9339,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 
 	switch( target->type ) { // Checks on actual target
 		case BL_PC: {
-				struct status_change* sc = status_get_sc(src);
+				status_change* sc = status_get_sc(src);
 
 				if (((TBL_PC*)target)->invincible_timer != INVALID_TIMER || pc_isinvisible((TBL_PC*)target))
 					return -1; //Cannot be targeted yet.
@@ -9430,8 +9430,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 
 	switch( t_bl->type ) { //Checks on target master
 		case BL_PC: {
-			struct map_session_data *sd;
-			struct status_change *sc = NULL;
+			map_session_data *sd;
+			status_change *sc = NULL;
 
 			if( t_bl == s_bl )
 				break;
@@ -9473,7 +9473,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 			break;
 		case BL_SKILL: {
 				struct skill_unit *su = (struct skill_unit *)src;
-				struct status_change* sc = status_get_sc(target);
+				status_change* sc = status_get_sc(target);
 				if (!su || !su->group)
 					return 0;
 
@@ -9502,7 +9502,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 	{	//Checks on source master
 		case BL_PC:
 		{
-			struct map_session_data *sd = BL_CAST(BL_PC, s_bl);
+			map_session_data *sd = BL_CAST(BL_PC, s_bl);
 			if( s_bl != t_bl )
 			{
 				if( sd->state.killer )
@@ -10174,6 +10174,7 @@ static const struct _battle_data {
 	{ "homunculus_evo_intimacy_reset",      &battle_config.homunculus_evo_intimacy_reset,   1000,   0,      INT_MAX,        },
 	{ "monster_loot_search_type",           &battle_config.monster_loot_search_type,        1,      0,      1,              },
 	{ "feature.roulette",                   &battle_config.feature_roulette,                1,      0,      1,              },
+	{ "feature.roulette_bonus_reward",      &battle_config.feature_roulette_bonus_reward,   1,      0,      1,              },
 	{ "monster_hp_bars_info",               &battle_config.monster_hp_bars_info,            1,      0,      1,              },
 	{ "min_body_style",                     &battle_config.min_body_style,                  0,      0,      SHRT_MAX,       },
 	{ "max_body_style",                     &battle_config.max_body_style,                  1,      0,      SHRT_MAX,       },
@@ -10285,6 +10286,8 @@ static const struct _battle_data {
 
 	{ "mob_respawn_time",                   &battle_config.mob_respawn_time,                1000,   1000,   INT_MAX,        },
 
+	{ "feature.stylist",                    &battle_config.feature_stylist,                 1,      0,      1,              },
+
 #include "../custom/battle_config_init.inc"
 };
 
@@ -10422,6 +10425,13 @@ void battle_adjust_conf()
 	}
 #endif
 
+#if PACKETVER < 20151104
+	if( battle_config.feature_stylist ){
+		ShowWarning("conf/battle/feature.conf stylist is enabled but it requires PACKETVER 2015-11-04 or newer, disabling...\n");
+		battle_config.feature_stylist = 0;
+	}
+#endif
+
 #if PACKETVER < 20141008
 	if (battle_config.feature_petevolution) {
 		ShowWarning("conf/battle/feature.conf petevolution is enabled but it requires PACKETVER 2014-10-08 or newer, disabling...\n");

+ 7 - 4
src/map/battle.hpp

@@ -14,7 +14,7 @@
 #include "skill.hpp"
 
 //fwd declaration
-struct map_session_data;
+class map_session_data;
 struct mob_data;
 struct block_list;
 enum e_damage_type : uint8;
@@ -93,7 +93,7 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
 
 int64 battle_calc_return_damage(struct block_list *bl, struct block_list *src, int64 *, int flag, uint16 skill_id, bool status_reflect);
 
-void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int class_);
+void battle_drain(map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int class_);
 
 int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv);
 int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, std::bitset<NK_MAX> nk, int s_ele, int s_ele_, int64 damage, int left, int flag);
@@ -107,7 +107,7 @@ int64 battle_calc_pk_damage(block_list &src, block_list &bl, int64 damage, uint1
 void battle_damage(struct block_list *src, struct block_list *target, int64 damage, t_tick delay, uint16 skill_lv, uint16 skill_id, enum damage_lv dmg_lv, unsigned short attack_type, bool additional_effects, t_tick tick, bool spdamage);
 int battle_delay_damage (t_tick tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, t_tick ddelay, bool additional_effects, bool spdamage);
 
-int battle_calc_chorusbonus(struct map_session_data *sd);
+int battle_calc_chorusbonus(map_session_data *sd);
 
 // Summary normal attack treatment (basic attack)
 enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,t_tick tick,int flag);
@@ -123,7 +123,7 @@ int battle_check_undead(int race,int element);
 int battle_check_target(struct block_list *src, struct block_list *target,int flag);
 bool battle_check_range(struct block_list *src,struct block_list *bl,int range);
 
-void battle_consume_ammo(struct map_session_data* sd, int skill, int lv);
+void battle_consume_ammo(map_session_data* sd, int skill, int lv);
 
 bool is_infinite_defense(struct block_list *target, int flag);
 
@@ -614,6 +614,7 @@ struct Battle_Config
 	int homunculus_evo_intimacy_reset;
 	int monster_loot_search_type;
 	int feature_roulette;
+	int feature_roulette_bonus_reward;
 	int monster_hp_bars_info;
 	int min_body_style;
 	int max_body_style;
@@ -724,6 +725,8 @@ struct Battle_Config
 
 	int mob_respawn_time;
 
+	int feature_stylist;
+
 #include "../custom/battle_config_struct.inc"
 };
 

+ 23 - 23
src/map/battleground.cpp

@@ -402,7 +402,7 @@ std::shared_ptr<s_battleground_queue> bg_search_queue(int queue_id)
  * @param bg: Battleground data
  * @return map_session_data
  */
-struct map_session_data* bg_getavailablesd(s_battleground_data *bg)
+map_session_data* bg_getavailablesd(s_battleground_data *bg)
 {
 	nullpo_retr(nullptr, bg);
 
@@ -463,7 +463,7 @@ bool bg_team_warp(int bg_id, unsigned short mapindex, short x, short y)
  * Remove a player's Battleground map marker
  * @param sd: Player data
  */
-void bg_send_dot_remove(struct map_session_data *sd)
+void bg_send_dot_remove(map_session_data *sd)
 {
 	nullpo_retv(sd);
 
@@ -479,7 +479,7 @@ void bg_send_dot_remove(struct map_session_data *sd)
  * @param is_queue: Joined from queue
  * @return True on success or false otherwise
  */
-bool bg_team_join(int bg_id, struct map_session_data *sd, bool is_queue)
+bool bg_team_join(int bg_id, map_session_data *sd, bool is_queue)
 {
 	if (!sd || sd->bg_id)
 		return false;
@@ -525,7 +525,7 @@ bool bg_team_join(int bg_id, struct map_session_data *sd, bool is_queue)
  * @param deserter: Whether to apply the deserter status or not
  * @return Remaining count in Battleground team or -1 on failure
  */
-int bg_team_leave(struct map_session_data *sd, bool quit, bool deserter)
+int bg_team_leave(map_session_data *sd, bool quit, bool deserter)
 {
 	if (!sd || !sd->bg_id)
 		return -1;
@@ -586,7 +586,7 @@ int bg_team_leave(struct map_session_data *sd, bool quit, bool deserter)
  * @param sd: Player data
  * @return True on success or false otherwise
  */
-bool bg_member_respawn(struct map_session_data *sd)
+bool bg_member_respawn(map_session_data *sd)
 {
 	if (!sd || !sd->bg_id || !pc_isdead(sd))
 		return false;
@@ -654,7 +654,7 @@ int bg_team_get_id(struct block_list *bl)
 				return ((TBL_PET*)bl)->master->bg_id;
 			break;
 		case BL_MOB: {
-			struct map_session_data *msd;
+			map_session_data *msd;
 			struct mob_data *md = (TBL_MOB*)bl;
 
 			if( md->special_state.ai && (msd = map_id2sd(md->master_id)) != nullptr )
@@ -683,7 +683,7 @@ int bg_team_get_id(struct block_list *bl)
  * @param mes: Message
  * @param len: Message length
  */
-void bg_send_message(struct map_session_data *sd, const char *mes, int len)
+void bg_send_message(map_session_data *sd, const char *mes, int len)
 {
 	nullpo_retv(sd);
 
@@ -704,7 +704,7 @@ void bg_send_message(struct map_session_data *sd, const char *mes, int len)
  */
 int bg_send_xy_timer_sub(std::shared_ptr<s_battleground_data> bg)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 
 	for (auto &pl_sd : bg->members) {
 		sd = pl_sd.sd;
@@ -823,7 +823,7 @@ static TIMER_FUNC(bg_on_ready_start)
  * @param sd: Player data
  * @return True if in a battleground or false otherwise
  */
-bool bg_player_is_in_bg_map(struct map_session_data *sd)
+bool bg_player_is_in_bg_map(map_session_data *sd)
 {
 	nullpo_retr(false, sd);
 
@@ -843,7 +843,7 @@ bool bg_player_is_in_bg_map(struct map_session_data *sd)
  * @param name: Battleground name
  * @return True if the player is good to join a queue or false otherwise
  */
-static bool bg_queue_check_status(struct map_session_data* sd, const char *name)
+static bool bg_queue_check_status(map_session_data* sd, const char *name)
 {
 	nullpo_retr(false, sd);
 
@@ -878,7 +878,7 @@ static bool bg_queue_check_status(struct map_session_data* sd, const char *name)
  * @param name: Battleground name
  * @return True on success or false otherwise
  */
-bool bg_queue_check_joinable(std::shared_ptr<s_battleground_type> bg, struct map_session_data *sd, const char *name)
+bool bg_queue_check_joinable(std::shared_ptr<s_battleground_type> bg, map_session_data *sd, const char *name)
 {
 	nullpo_retr(false, sd);
 
@@ -953,7 +953,7 @@ bool bg_queue_reservation(const char *name, bool state, bool ended)
  * @param name: Battleground name
  * @param sd: Player who requested to join the battlegrounds
  */
-void bg_queue_join_solo(const char *name, struct map_session_data *sd)
+void bg_queue_join_solo(const char *name, map_session_data *sd)
 {
 	if (!sd) {
 		ShowError("bg_queue_join_solo: Tried to join non-existent player\n.");
@@ -980,7 +980,7 @@ void bg_queue_join_solo(const char *name, struct map_session_data *sd)
  * @param name: Battleground name
  * @param sd: Player who requested to join the battlegrounds
  */
-void bg_queue_join_party(const char *name, struct map_session_data *sd)
+void bg_queue_join_party(const char *name, map_session_data *sd)
 {
 	if (!sd) {
 		ShowError("bg_queue_join_party: Tried to join non-existent player\n.");
@@ -1021,14 +1021,14 @@ void bg_queue_join_party(const char *name, struct map_session_data *sd)
 			return; // Too many party members online
 		}
 
-		std::vector<struct map_session_data *> list;
+		std::vector<map_session_data *> list;
 
 		for (const auto &it : p->party.member) {
 			if (list.size() == bg->max_players)
 				break;
 
 			if (it.online) {
-				struct map_session_data *pl_sd = map_charid2sd(it.char_id);
+				map_session_data *pl_sd = map_charid2sd(it.char_id);
 
 				if (pl_sd)
 					list.push_back(pl_sd);
@@ -1048,7 +1048,7 @@ void bg_queue_join_party(const char *name, struct map_session_data *sd)
  * @param name: Battleground name
  * @param sd: Player who requested to join the battlegrounds
  */
-void bg_queue_join_guild(const char *name, struct map_session_data *sd)
+void bg_queue_join_guild(const char *name, map_session_data *sd)
 {
 	if (!sd) {
 		ShowError("bg_queue_join_guild: Tried to join non-existent player\n.");
@@ -1080,14 +1080,14 @@ void bg_queue_join_guild(const char *name, struct map_session_data *sd)
 			return; // Too many guild members online
 		}
 
-		std::vector<struct map_session_data *> list;
+		std::vector<map_session_data *> list;
 
 		for (const auto &it : g->member) {
 			if (list.size() == bg->max_players)
 				break;
 
 			if (it.online) {
-				struct map_session_data *pl_sd = map_charid2sd(it.char_id);
+				map_session_data *pl_sd = map_charid2sd(it.char_id);
 
 				if (pl_sd)
 					list.push_back(pl_sd);
@@ -1108,7 +1108,7 @@ void bg_queue_join_guild(const char *name, struct map_session_data *sd)
  * @param sd: Player who requested to join the battlegrounds
  * @param list: Contains all players including the player who requested to join
  */
-void bg_queue_join_multi(const char *name, struct map_session_data *sd, std::vector <map_session_data *> list)
+void bg_queue_join_multi(const char *name, map_session_data *sd, std::vector <map_session_data *> list)
 {
 	if (!sd) {
 		ShowError("bg_queue_join_multi: Tried to join non-existent player\n.");
@@ -1151,7 +1151,7 @@ void bg_queue_join_multi(const char *name, struct map_session_data *sd, std::vec
 		}
 
 		while (!list.empty() && team->size() < bg->max_players) {
-			struct map_session_data *sd2 = list.back();
+			map_session_data *sd2 = list.back();
 
 			list.pop_back();
 
@@ -1238,7 +1238,7 @@ void bg_queue_clear(std::shared_ptr<s_battleground_queue> queue, bool ended)
  * @param apply_sc: Apply the SC_ENTRY_QUEUE_APPLY_DELAY status on queue leave (default: true)
  * @return True on success or false otherwise
  */
-static bool bg_queue_leave_sub(struct map_session_data *sd, std::vector<map_session_data *> &members, bool apply_sc)
+static bool bg_queue_leave_sub(map_session_data *sd, std::vector<map_session_data *> &members, bool apply_sc)
 {
 	if (!sd)
 		return false;
@@ -1268,7 +1268,7 @@ static bool bg_queue_leave_sub(struct map_session_data *sd, std::vector<map_sess
  * @param apply_sc: Apply the SC_ENTRY_QUEUE_APPLY_DELAY status on queue leave (default: true)
  * @return True on success or false otherwise
  */
-bool bg_queue_leave(struct map_session_data *sd, bool apply_sc)
+bool bg_queue_leave(map_session_data *sd, bool apply_sc)
 {
 	if (!sd || sd->bg_queue_id == 0)
 		return false;
@@ -1456,7 +1456,7 @@ bool bg_mapflag_check(std::shared_ptr<s_battleground_queue> queue) {
  * @param queue: Battleground queue
  * @param sd: Player data
  */
-void bg_queue_on_accept_invite(struct map_session_data *sd)
+void bg_queue_on_accept_invite(map_session_data *sd)
 {
 	nullpo_retv(sd);
 

+ 15 - 15
src/map/battleground.hpp

@@ -16,7 +16,7 @@
 
 struct s_battleground_member_data {
 	unsigned short x, y;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	unsigned afk : 1;
 	struct point entry_point; ///< Battleground queue entry point
 };
@@ -128,32 +128,32 @@ extern std::vector<std::shared_ptr<s_battleground_queue>> bg_queues;
 
 std::shared_ptr<s_battleground_type> bg_search_name(const char *name);
 std::shared_ptr<s_battleground_queue> bg_search_queue(int queue_id);
-void bg_send_dot_remove(struct map_session_data *sd);
+void bg_send_dot_remove(map_session_data *sd);
 int bg_team_get_id(struct block_list *bl);
-struct map_session_data *bg_getavailablesd(s_battleground_data *bg);
+map_session_data *bg_getavailablesd(s_battleground_data *bg);
 
 bool bg_queue_reservation(const char *name, bool state, bool ended);
 #define bg_queue_reserve(name, end) (bg_queue_reservation(name, true, end))
 #define bg_queue_unbook(name) (bg_queue_reservation(name, false, false))
 
 int bg_create(uint16 mapindex, s_battleground_team* team);
-bool bg_team_join(int bg_id, struct map_session_data *sd, bool is_queue);
+bool bg_team_join(int bg_id, map_session_data *sd, bool is_queue);
 bool bg_team_delete(int bg_id);
-int bg_team_leave(struct map_session_data *sd, bool quit, bool deserter);
+int bg_team_leave(map_session_data *sd, bool quit, bool deserter);
 bool bg_team_warp(int bg_id, unsigned short mapindex, short x, short y);
-bool bg_player_is_in_bg_map(struct map_session_data *sd);
-bool bg_queue_check_joinable(std::shared_ptr<s_battleground_type> bg, struct map_session_data *sd, const char *name);
-void bg_queue_join_solo(const char *name, struct map_session_data *sd);
-void bg_queue_join_party(const char *name, struct map_session_data *sd);
-void bg_queue_join_guild(const char *name, struct map_session_data *sd);
-void bg_queue_join_multi(const char *name, struct map_session_data *sd, std::vector<map_session_data *> list);
+bool bg_player_is_in_bg_map(map_session_data *sd);
+bool bg_queue_check_joinable(std::shared_ptr<s_battleground_type> bg, map_session_data *sd, const char *name);
+void bg_queue_join_solo(const char *name, map_session_data *sd);
+void bg_queue_join_party(const char *name, map_session_data *sd);
+void bg_queue_join_guild(const char *name, map_session_data *sd);
+void bg_queue_join_multi(const char *name, map_session_data *sd, std::vector<map_session_data *> list);
 void bg_queue_clear(std::shared_ptr<s_battleground_queue> queue, bool ended);
-bool bg_queue_leave(struct map_session_data *sd, bool apply_sc = true);
+bool bg_queue_leave(map_session_data *sd, bool apply_sc = true);
 bool bg_queue_on_ready(const char *name, std::shared_ptr<s_battleground_queue> queue);
-void bg_queue_on_accept_invite(struct map_session_data *sd);
+void bg_queue_on_accept_invite(map_session_data *sd);
 void bg_queue_start_battleground(std::shared_ptr<s_battleground_queue> queue);
-bool bg_member_respawn(struct map_session_data *sd);
-void bg_send_message(struct map_session_data *sd, const char *mes, int len);
+bool bg_member_respawn(map_session_data *sd);
+void bg_send_message(map_session_data *sd, const char *mes, int len);
 
 void do_init_battleground(void);
 void do_final_battleground(void);

+ 12 - 12
src/map/buyingstore.cpp

@@ -19,7 +19,7 @@
 #include "clif.hpp"  // clif_buyingstore_*
 #include "log.hpp"  // log_pick_pc, log_zeny
 #include "npc.hpp"
-#include "pc.hpp"  // struct map_session_data
+#include "pc.hpp"  // map_session_data
 
 //Autotrader
 static DBMap *buyingstore_autotrader_db; /// Holds autotrader info: char_id -> struct s_autotrader
@@ -66,7 +66,7 @@ static unsigned int buyingstore_getuid(void)
 * @param slots Number of item on the list
 * @return 0 If success, 1 - Cannot open, 2 - Manner penalty, 3 - Mapflag restiction, 4 - Cell restriction
 */
-int8 buyingstore_setup(struct map_session_data* sd, unsigned char slots){
+int8 buyingstore_setup(map_session_data* sd, unsigned char slots){
 	nullpo_retr(1, sd);
 
 	if (!battle_config.feature_buying_store || sd->state.vending || sd->state.buyingstore || sd->state.trading || slots == 0) {
@@ -113,7 +113,7 @@ int8 buyingstore_setup(struct map_session_data* sd, unsigned char slots){
 * @param at Autotrader info, or NULL if requetsed not from autotrade persistance
 * @return 0 If success, 1 - Cannot open, 2 - Manner penalty, 3 - Mapflag restiction, 4 - Cell restriction, 5 - Invalid count/result, 6 - Cannot give item, 7 - Will be overweight
 */
-int8 buyingstore_create( struct map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, unsigned int count, struct s_autotrader *at ){
+int8 buyingstore_create( map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, unsigned int count, struct s_autotrader *at ){
 	unsigned int i, weight, listidx;
 	char message_sql[MESSAGE_SIZE*2];
 	StringBuf buf;
@@ -259,7 +259,7 @@ int8 buyingstore_create( struct map_session_data* sd, int zenylimit, unsigned ch
 * Close buying store and clear buying store data from tables
 * @param sd
 */
-void buyingstore_close(struct map_session_data* sd) {
+void buyingstore_close(map_session_data* sd) {
 	nullpo_retv(sd);
 
 	if( sd->state.buyingstore ) {
@@ -285,9 +285,9 @@ void buyingstore_close(struct map_session_data* sd) {
 * @param sd Player
 * @param account_id Buyer account ID
 */
-void buyingstore_open(struct map_session_data* sd, uint32 account_id)
+void buyingstore_open(map_session_data* sd, uint32 account_id)
 {
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 
 	nullpo_retv(sd);
 
@@ -323,10 +323,10 @@ void buyingstore_open(struct map_session_data* sd, uint32 account_id)
 * @param *itemlist List of sold items { <index>.W, <nameid>.W, <amount>.W }*
 * @param count Number of item on the itemlist
 */
-void buyingstore_trade( struct map_session_data* sd, uint32 account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count ){
+void buyingstore_trade( map_session_data* sd, uint32 account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count ){
 	int zeny = 0;
 	unsigned int weight;
-	struct map_session_data* pl_sd;
+	map_session_data* pl_sd;
 
 	nullpo_retv(sd);
 
@@ -508,7 +508,7 @@ void buyingstore_trade( struct map_session_data* sd, uint32 account_id, unsigned
 
 
 /// Checks if an item is being bought in given player's buying store.
-bool buyingstore_search(struct map_session_data* sd, t_itemid nameid)
+bool buyingstore_search(map_session_data* sd, t_itemid nameid)
 {
 	unsigned int i;
 
@@ -531,7 +531,7 @@ bool buyingstore_search(struct map_session_data* sd, t_itemid nameid)
 
 /// Searches for all items in a buyingstore, that match given ids, price and possible cards.
 /// @return Whether or not the search should be continued.
-bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_store_search* s)
+bool buyingstore_searchall(map_session_data* sd, const struct s_search_store_search* s)
 {
 	unsigned int i, idx;
 	struct s_buyingstore_item* it;
@@ -596,7 +596,7 @@ bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_st
 * Open buyingstore for Autotrader
 * @param sd Player as autotrader
 */
-void buyingstore_reopen( struct map_session_data* sd ){
+void buyingstore_reopen( map_session_data* sd ){
 	struct s_autotrader *at = NULL;
 	int8 fail = -1;
 
@@ -702,7 +702,7 @@ void do_init_buyingstore_autotrade( void ) {
 					at->sit = battle_config.feature_autotrade_sit;
 
 				// initialize player
-				CREATE(at->sd, struct map_session_data, 1);
+				CREATE(at->sd, map_session_data, 1); // TODO: Dont use Memory Manager allocation anymore and rely on the C++ container
 				pc_setnewpc(at->sd, at->account_id, at->char_id, 0, gettick(), at->sex, 0);
 				at->sd->state.autotrade = 1|4;
 				if (battle_config.autotrade_monsterignore)

+ 10 - 10
src/map/buyingstore.hpp

@@ -9,7 +9,7 @@
 #include "map.hpp" //MESSAGE_SIZE
 
 struct s_search_store_search;
-struct map_session_data;
+class map_session_data;
 
 #define MAX_BUYINGSTORE_SLOTS 5
 
@@ -52,22 +52,22 @@ struct s_autotrader {
 	uint32 limit; ///< Maximum zeny to be spent (for buyingstore)
 	uint16 count; ///< Number of item in store
 	struct s_autotrade_entry **entries; ///< Store details
-	struct map_session_data *sd;
+	map_session_data *sd;
 };
 
-int8 buyingstore_setup(struct map_session_data* sd, unsigned char slots);
-int8 buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, unsigned int count, struct s_autotrader *at);
-void buyingstore_close(struct map_session_data* sd);
-void buyingstore_open(struct map_session_data* sd, uint32 account_id);
-void buyingstore_trade(struct map_session_data* sd, uint32 account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count);
-bool buyingstore_search(struct map_session_data* sd, t_itemid nameid);
-bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_store_search* s);
+int8 buyingstore_setup(map_session_data* sd, unsigned char slots);
+int8 buyingstore_create(map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, unsigned int count, struct s_autotrader *at);
+void buyingstore_close(map_session_data* sd);
+void buyingstore_open(map_session_data* sd, uint32 account_id);
+void buyingstore_trade(map_session_data* sd, uint32 account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count);
+bool buyingstore_search(map_session_data* sd, t_itemid nameid);
+bool buyingstore_searchall(map_session_data* sd, const struct s_search_store_search* s);
 DBMap *buyingstore_getdb(void);
 void do_final_buyingstore(void);
 void do_init_buyingstore(void);
 
 void do_init_buyingstore_autotrade( void );
-void buyingstore_reopen( struct map_session_data* sd );
+void buyingstore_reopen( map_session_data* sd );
 void buyingstore_update(map_session_data &sd);
 
 #endif /* BUYINGSTORE_HPP */

+ 2 - 2
src/map/cashshop.cpp

@@ -409,7 +409,7 @@ struct sale_item_data* sale_find_item( t_itemid nameid, bool onsale ){
 	return sale_items.item[i];
 }
 
-void sale_notify_login( struct map_session_data* sd ){
+void sale_notify_login( map_session_data* sd ){
 	int i;
 
 	for( i = 0; i < sale_items.count; i++ ){
@@ -467,7 +467,7 @@ static void cashshop_read_db( void ){
  * @param item_list Array of item ID
  * @return true: success, false: fail
  */
-bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub* item_list ){
+bool cashshop_buylist( map_session_data* sd, uint32 kafrapoints, int n, struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub* item_list ){
 	uint32 totalcash = 0;
 	uint32 totalweight = 0;
 	int i,new_;

+ 3 - 3
src/map/cashshop.hpp

@@ -10,12 +10,12 @@
 #include "../common/mmo.hpp" // t_itemid
 #include "../common/timer.hpp" // ShowWarning, ShowStatus
 
-struct map_session_data;
+class map_session_data;
 
 void do_init_cashshop( void );
 void do_final_cashshop( void );
 void cashshop_reloaddb( void );
-bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub* item_list );
+bool cashshop_buylist( map_session_data* sd, uint32 kafrapoints, int n, struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST_sub* item_list );
 
 // Taken from AEGIS
 enum CASH_SHOP_TAB_CODE
@@ -94,7 +94,7 @@ extern struct sale_item_db sale_items;
 struct sale_item_data* sale_find_item(t_itemid nameid, bool onsale);
 enum e_sale_add_result sale_add_item(t_itemid nameid, int32 count, time_t from, time_t to);
 bool sale_remove_item(t_itemid nameid);
-void sale_notify_login( struct map_session_data* sd );
+void sale_notify_login( map_session_data* sd );
 #endif
 
 #endif /* CASHSHOP_HPP */

+ 34 - 30
src/map/channel.cpp

@@ -143,12 +143,16 @@ struct Channel* channel_create_simple(char *name, char *pass, enum Channel_Type
 int channel_delete(struct Channel *channel, bool force) {
 	if(!channel)
 		return -1;
-	if(!force && channel->type == CHAN_TYPE_PUBLIC && runflag == MAPSERVER_ST_RUNNING) //only delete those serv stop
+
+	// only delete those serv stop
+	if( !force && channel->type == CHAN_TYPE_PUBLIC && global_core->is_running() ){
 		return -2;
+	}
+
 	if( db_size(channel->users)) {
-		struct map_session_data *sd;
+		map_session_data *sd;
 		DBIterator *iter = db_iterator(channel->users);
-		for( sd = (struct map_session_data *)dbi_first(iter); dbi_exists(iter); sd = (struct map_session_data *)dbi_next(iter) ) { //for all users
+		for( sd = (map_session_data *)dbi_first(iter); dbi_exists(iter); sd = (map_session_data *)dbi_next(iter) ) { //for all users
 			channel_clean(channel,sd,1); //make all quit
 		}
 		dbi_destroy(iter);
@@ -192,7 +196,7 @@ int channel_delete(struct Channel *channel, bool force) {
  *  -3: Player banned
  *  -4: Reached max limit
  */
-int channel_join(struct Channel *channel, struct map_session_data *sd) {
+int channel_join(struct Channel *channel, map_session_data *sd) {
 	if(!channel || !sd)
 		return -1;
 	if(sd->state.autotrade)
@@ -247,7 +251,7 @@ int channel_join(struct Channel *channel, struct map_session_data *sd) {
  *  -2: Player already in channel (channel_join)
  *  -3: Player banned (channel_join)
  */
-int channel_mjoin(struct map_session_data *sd) {
+int channel_mjoin(map_session_data *sd) {
 	char mout[60];
 	if(!sd) return -1;
 
@@ -275,7 +279,7 @@ int channel_mjoin(struct map_session_data *sd) {
  */
 int channel_ajoin(struct guild *g){
 	int i, j;
-	struct map_session_data *pl_sd;
+	map_session_data *pl_sd;
 
 	if(!g || !g->channel) return -1;
 	for (i = 0; i < MAX_GUILDALLIANCE; i++){
@@ -302,7 +306,7 @@ int channel_ajoin(struct guild *g){
  *  -1: Invalid player
  *  -2: Player has no guild attached
  */
-int channel_gjoin(struct map_session_data *sd, int flag){
+int channel_gjoin(map_session_data *sd, int flag){
 	struct Channel *channel;
 	struct guild *g;
 
@@ -341,7 +345,7 @@ int channel_gjoin(struct map_session_data *sd, int flag){
  *  0: Success
  * -1: Invalid player or channel
  */
-int channel_clean(struct Channel *channel, struct map_session_data *sd, int flag) {
+int channel_clean(struct Channel *channel, map_session_data *sd, int flag) {
 	unsigned char i;
 
 	if(!channel || !sd)
@@ -388,7 +392,7 @@ int channel_clean(struct Channel *channel, struct map_session_data *sd, int flag
  *  0: Success
  * -1: Invalid player
  */
-int channel_pcquit(struct map_session_data *sd, int type){
+int channel_pcquit(map_session_data *sd, int type){
 	int i;
 
 	//On closing state we could have clean all chan by sd but pcquit is more used to free unit when
@@ -438,7 +442,7 @@ int channel_pcquit(struct map_session_data *sd, int type){
  * -1: Invalid player, channel, or message
  * -2: Delay message from last message
  */
-int channel_send(struct Channel *channel, struct map_session_data *sd, const char *msg) {
+int channel_send(struct Channel *channel, map_session_data *sd, const char *msg) {
 	int idx = 0;
 
 	if(!channel || !sd || !msg || (idx = channel_pc_haschan(sd, channel)) < 0)
@@ -500,7 +504,7 @@ int channel_chk(char *chname, char *chpass, int type){
  * @param flag: Lookup types (1 - Create channel if it does not exist (map or ally only), 2 - Join the channel if not joined yet (map or ally only))
  * @return NULL on channel not found or channel data on success
  */
-struct Channel* channel_name2channel(char *chname, struct map_session_data *sd, int flag){
+struct Channel* channel_name2channel(char *chname, map_session_data *sd, int flag){
 	if(channel_chk(chname, NULL, 1))
 		return NULL;
 
@@ -533,7 +537,7 @@ struct Channel* channel_name2channel(char *chname, struct map_session_data *sd,
  *  0: Player not found or not banned
  *  1: Player is in channel
  */
-int channel_haspc(struct Channel *channel,struct map_session_data *sd){
+int channel_haspc(struct Channel *channel,map_session_data *sd){
 	if(!channel || !sd) return -1;
 	return (idb_exists(channel->users, sd->status.char_id))?1:0;
 }
@@ -545,7 +549,7 @@ int channel_haspc(struct Channel *channel,struct map_session_data *sd){
  *  0: Player not found or not banned
  *  1: Player is banned
  */
-int channel_haspcbanned(struct Channel *channel,struct map_session_data *sd){
+int channel_haspcbanned(struct Channel *channel,map_session_data *sd){
 	if(!channel || !sd) return -1;
 	return (idb_exists(channel->banned, sd->status.char_id))?1:0;
 }
@@ -560,7 +564,7 @@ int channel_haspcbanned(struct Channel *channel,struct map_session_data *sd){
  * -2: Player not found or not in channel
  * x > 0: has_channel at index x
  */
-int channel_pc_haschan(struct map_session_data *sd, struct Channel *channel){
+int channel_pc_haschan(map_session_data *sd, struct Channel *channel){
 	int k;
 	if(!channel || !sd) return -1; //channel or player doesn't exist
 	ARR_FIND(0, sd->channel_count, k, strcmpi(channel->name,sd->channels[k]->name) == 0);
@@ -577,7 +581,7 @@ int channel_pc_haschan(struct map_session_data *sd, struct Channel *channel){
  *   void: List of public channel and map and guild and number of users
  * @return 0 on success or -1 on failure
  */
-int channel_display_list(struct map_session_data *sd, const char *options){
+int channel_display_list(map_session_data *sd, const char *options){
 
 	if(!sd || !options)
 		return -1;
@@ -654,7 +658,7 @@ int channel_display_list(struct map_session_data *sd, const char *options){
  * @param chpass: Channel password
  * @return 0 on success or -1 on failure
  */
-int channel_pccreate(struct map_session_data *sd, char *chname, char *chpass){
+int channel_pccreate(map_session_data *sd, char *chname, char *chpass){
 	char output[CHAT_SIZE_MAX];
 	int8 res;
 
@@ -688,7 +692,7 @@ int channel_pccreate(struct map_session_data *sd, char *chname, char *chpass){
  * @param chname: Channel name
  * @return 0 on success or -1 on failure
  */
-int channel_pcdelete(struct map_session_data *sd, char *chname){
+int channel_pcdelete(map_session_data *sd, char *chname){
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
 
@@ -719,7 +723,7 @@ int channel_pcdelete(struct map_session_data *sd, char *chname){
  * @param chname: Channel name
  * @return 0 on success or -1 on failure
  */
-int channel_pcleave(struct map_session_data *sd, char *chname){
+int channel_pcleave(map_session_data *sd, char *chname){
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
 
@@ -767,7 +771,7 @@ int channel_pcleave(struct map_session_data *sd, char *chname){
  * @param pass: Channel password
  * @return 0 on success or -1 on failure
  */
-int channel_pcjoin(struct map_session_data *sd, char *chname, char *pass){
+int channel_pcjoin(map_session_data *sd, char *chname, char *pass){
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
 
@@ -832,7 +836,7 @@ int channel_pcjoin(struct map_session_data *sd, char *chname, char *pass){
  * @param color: New color
  * @return 0 on success or -1 on failure
  */
-int channel_pccolor(struct map_session_data *sd, char *chname, char *color){
+int channel_pccolor(map_session_data *sd, char *chname, char *color){
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
 	int k;
@@ -885,7 +889,7 @@ int channel_pccolor(struct map_session_data *sd, char *chname, char *color){
  * @param chname: Channel name
  * @return 0 on success, -1 on incorrect channel name, or -2 channel doesn't exist or player didn't join
  */
-int channel_pcbind(struct map_session_data *sd, char *chname){
+int channel_pcbind(map_session_data *sd, char *chname){
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
 
@@ -914,7 +918,7 @@ int channel_pcbind(struct map_session_data *sd, char *chname){
  * @param sd: Player data
  * @return 0 on success or -1 on failure
  */
-int channel_pcunbind(struct map_session_data *sd){
+int channel_pcunbind(map_session_data *sd){
 	char output[CHAT_SIZE_MAX];
 
 	if(!sd)
@@ -938,10 +942,10 @@ int channel_pcunbind(struct map_session_data *sd){
  * @param flag: Ban options (0 - Ban, 1 - Unban, 2 - Unban all, 3 - Ban list)
  * @return 0 on success or -1 on failure
  */
-int channel_pcban(struct map_session_data *sd, char *chname, char *pname, int flag){
+int channel_pcban(map_session_data *sd, char *chname, char *pname, int flag){
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
-	struct map_session_data *tsd = map_nick2sd(pname,false);
+	map_session_data *tsd = map_nick2sd(pname,false);
 
 	if( channel_chk(chname,NULL,1) ) {
 		clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'.
@@ -1047,10 +1051,10 @@ int channel_pcban(struct map_session_data *sd, char *chname, char *pname, int fl
  * @param pname: Player name to kick
  * @return 0 on success or -1 on failure
  */
-int channel_pckick(struct map_session_data *sd, char *chname, char *pname) {
+int channel_pckick(map_session_data *sd, char *chname, char *pname) {
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
-	struct map_session_data *tsd = map_nick2sd(pname,false);
+	map_session_data *tsd = map_nick2sd(pname,false);
 
 	if( channel_chk(chname,NULL,1) ) {
 		clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'.
@@ -1114,7 +1118,7 @@ int channel_pckick(struct map_session_data *sd, char *chname, char *pname) {
  * @param val: Option value
  * @return 0 on success or -1 on failure
  */
-int channel_pcsetopt(struct map_session_data *sd, char *chname, const char *option, const char *val){
+int channel_pcsetopt(map_session_data *sd, char *chname, const char *option, const char *val){
 	struct Channel *channel;
 	char output[CHAT_SIZE_MAX];
 	int k, s = 0, opt;
@@ -1266,11 +1270,11 @@ bool channel_pccheckgroup(struct Channel *channel, int group_id) {
  */
 int channel_pcautojoin_sub(DBKey key, DBData *data, va_list ap) {
 	struct Channel *channel = (struct Channel *)db_data2ptr(data);
-	struct map_session_data *sd = NULL;
+	map_session_data *sd = NULL;
 	char channame[CHAN_NAME_LENGTH+1];
 
 	nullpo_ret(channel);
-	nullpo_ret((sd = va_arg(ap, struct map_session_data *)));
+	nullpo_ret((sd = va_arg(ap, map_session_data *)));
 
 	if (channel->pass[0])
 		return 0;
@@ -1288,7 +1292,7 @@ int channel_pcautojoin_sub(DBKey key, DBData *data, va_list ap) {
  * Attempt to autojoin a player to a channel
  * @param sd: Player data
  */
-void channel_autojoin(struct map_session_data *sd) {
+void channel_autojoin(map_session_data *sd) {
 	nullpo_retv(sd);
 	if (sd->state.autotrade || !sd->fd)
 		return;

+ 23 - 23
src/map/channel.hpp

@@ -9,7 +9,7 @@
 
 //namespace rA {
 
-struct map_session_data;
+class map_session_data;
 struct guild;
 struct DBMap;
 
@@ -92,38 +92,38 @@ struct Channel* channel_create(struct Channel *tmp_chan);
 struct Channel* channel_create_simple(char *name, char *pass, enum Channel_Type chantype, unsigned int owner);
 int channel_delete(struct Channel *channel, bool force);
 
-int channel_join(struct Channel *channel, struct map_session_data *sd);
-int channel_mjoin(struct map_session_data *sd);
-int channel_gjoin(struct map_session_data *sd, int flag);
+int channel_join(struct Channel *channel, map_session_data *sd);
+int channel_mjoin(map_session_data *sd);
+int channel_gjoin(map_session_data *sd, int flag);
 int channel_ajoin(struct guild *g);
-int channel_clean(struct Channel *channel, struct map_session_data *sd, int flag);
-int channel_pcquit(struct map_session_data *sd, int type);
+int channel_clean(struct Channel *channel, map_session_data *sd, int flag);
+int channel_pcquit(map_session_data *sd, int type);
 
 unsigned long channel_getColor(const char *color_str);
 
-int channel_send(struct Channel *channel, struct map_session_data *sd, const char *msg);
+int channel_send(struct Channel *channel, map_session_data *sd, const char *msg);
 void channel_read_config(void);
 
 int channel_chk(char *name, char *pass, int type);
-struct Channel* channel_name2channel(char *chname, struct map_session_data *sd, int flag);
-int channel_haspc(struct Channel *channel,struct map_session_data *sd);
-int channel_haspcbanned(struct Channel *channel,struct map_session_data *sd);
-int channel_pc_haschan(struct map_session_data *sd, struct Channel *channel);
-int channel_display_list(struct map_session_data *sd, const char *option);
+struct Channel* channel_name2channel(char *chname, map_session_data *sd, int flag);
+int channel_haspc(struct Channel *channel,map_session_data *sd);
+int channel_haspcbanned(struct Channel *channel,map_session_data *sd);
+int channel_pc_haschan(map_session_data *sd, struct Channel *channel);
+int channel_display_list(map_session_data *sd, const char *option);
 
-void channel_autojoin(struct map_session_data *sd);
+void channel_autojoin(map_session_data *sd);
 bool channel_pccheckgroup(struct Channel *channel, int group_id);
 
-int channel_pccreate(struct map_session_data *sd, char *chname, char *pass);
-int channel_pcdelete(struct map_session_data *sd, char *chname);
-int channel_pcjoin(struct map_session_data *sd, char *chname, char *pass);
-int channel_pcleave(struct map_session_data *sd, char *chname);
-int channel_pccolor(struct map_session_data *sd, char *chname, char *color);
-int channel_pcbind(struct map_session_data *sd, char *chname);
-int channel_pcunbind(struct map_session_data *sd);
-int channel_pcban(struct map_session_data *sd, char *chname, char *pname, int flag);
-int channel_pckick(struct map_session_data *sd, char *chname, char *pname);
-int channel_pcsetopt(struct map_session_data *sd, char *chname, const char *option, const char *val);
+int channel_pccreate(map_session_data *sd, char *chname, char *pass);
+int channel_pcdelete(map_session_data *sd, char *chname);
+int channel_pcjoin(map_session_data *sd, char *chname, char *pass);
+int channel_pcleave(map_session_data *sd, char *chname);
+int channel_pccolor(map_session_data *sd, char *chname, char *color);
+int channel_pcbind(map_session_data *sd, char *chname);
+int channel_pcunbind(map_session_data *sd);
+int channel_pcban(map_session_data *sd, char *chname, char *pname, int flag);
+int channel_pckick(map_session_data *sd, char *chname, char *pname);
+int channel_pcsetopt(map_session_data *sd, char *chname, const char *option, const char *val);
 
 void do_init_channel(void);
 void do_final_channel(void);

+ 7 - 7
src/map/chat.cpp

@@ -74,7 +74,7 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
  * @param pub : public or private
  * @return 0
  */
-int chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
+int chat_createpcchat(map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
 {
 	struct chat_data* cd;
 
@@ -125,7 +125,7 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char
  * @param pass : password of chat room
  * @return 0
  */
-int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
+int chat_joinchat(map_session_data* sd, int chatid, const char* pass)
 {
 	struct chat_data* cd;
 
@@ -186,7 +186,7 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
  * @param kicked : for clif notification, kicked=1 or regular leave
  * @return 0:success, 1:failed
  */
-int chat_leavechat(struct map_session_data* sd, bool kicked)
+int chat_leavechat(map_session_data* sd, bool kicked)
 {
 	struct chat_data* cd;
 	int i;
@@ -257,10 +257,10 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
  * @param nextownername : string of new owner (name should be in chatroom)
  * @return 0:success, 1:failure
  */
-int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
+int chat_changechatowner(map_session_data* sd, const char* nextownername)
 {
 	struct chat_data* cd;
-	struct map_session_data* tmpsd;
+	map_session_data* tmpsd;
 	int i;
 
 	nullpo_retr(1, sd);
@@ -309,7 +309,7 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
  * @param pub : public or private
  * @return 1:success, 0:failure
  */
-int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
+int chat_changechatstatus(map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
 {
 	struct chat_data* cd;
 
@@ -355,7 +355,7 @@ int chat_npckickchat(struct chat_data* cd, const char* kickusername)
  * @param kickusername : player name to be kicked
  * @retur 1:success, 0:failure
  */
-int chat_kickchat(struct map_session_data* sd, const char* kickusername)
+int chat_kickchat(map_session_data* sd, const char* kickusername)
 {
 	struct chat_data* cd;
 	int i;

+ 8 - 8
src/map/chat.hpp

@@ -6,7 +6,7 @@
 
 #include "map.hpp" // struct block_list, CHATROOM_TITLE_SIZE
 
-struct map_session_data;
+class map_session_data;
 struct chat_data;
 
 #define MAX_CHAT_USERS 20
@@ -22,18 +22,18 @@ struct chat_data {
 	uint32 zeny;						 // required zeny to join
 	uint32 minLvl;					 // minimum base level to join
 	uint32 maxLvl;					 // maximum base level allowed to join
-	struct map_session_data* usersd[MAX_CHAT_USERS];
+	map_session_data* usersd[MAX_CHAT_USERS];
 	struct block_list* owner;
 	char npc_event[EVENT_NAME_LENGTH];
 	DBMap* kick_list;				//DBMap of users who were kicked from this chat
 };
 
-int chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
-int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass);
-int chat_leavechat(struct map_session_data* sd, bool kicked);
-int chat_changechatowner(struct map_session_data* sd, const char* nextownername);
-int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
-int chat_kickchat(struct map_session_data* sd, const char* kickusername);
+int chat_createpcchat(map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
+int chat_joinchat(map_session_data* sd, int chatid, const char* pass);
+int chat_leavechat(map_session_data* sd, bool kicked);
+int chat_changechatowner(map_session_data* sd, const char* nextownername);
+int chat_changechatstatus(map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
+int chat_kickchat(map_session_data* sd, const char* kickusername);
 
 int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl);
 int chat_deletenpcchat(struct npc_data* nd);

+ 27 - 48
src/map/chrif.cpp

@@ -123,25 +123,6 @@ char charserver_name[NAME_LENGTH];
 //This define should spare writing the check in every function. [Skotlex]
 #define chrif_check(a) { if(!chrif_isconnected()) return a; }
 
-
-/// Resets all the data.
-void chrif_reset(void) {
-	// TODO kick everyone out and reset everything [FlavioJS]
-	exit(EXIT_FAILURE);
-}
-
-
-/// Checks the conditions for the server to stop.
-/// Releases the cookie when all characters are saved.
-/// If all the conditions are met, it stops the core loop.
-void chrif_check_shutdown(void) {
-	if( runflag != MAPSERVER_ST_SHUTDOWN )
-		return;
-	if( auth_db->size(auth_db) > 0 )
-		return;
-	runflag = CORE_ST_STOP;
-}
-
 struct auth_node* chrif_search(uint32 account_id) {
 	return (struct auth_node*)idb_get(auth_db, account_id);
 }
@@ -223,7 +204,7 @@ static bool chrif_auth_logout(TBL_PC* sd, enum sd_state state) {
 	return chrif_sd_to_auth(sd, state);
 }
 
-bool chrif_auth_finished(struct map_session_data* sd) {
+bool chrif_auth_finished(map_session_data* sd) {
 	struct auth_node *node= chrif_search(sd->status.account_id);
 
 	if ( node && node->sd == sd && node->state == ST_LOGIN ) {
@@ -246,12 +227,13 @@ void chrif_setpasswd(char *pwd) {
 
 // security check, prints warning if using default password
 void chrif_checkdefaultlogin(void) {
-	// Skip this check if the server is run with run-once flag
-	if ( runflag != CORE_ST_STOP && strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
+#if !defined(BUILDBOT)
+	if( strcmp( userid, "s1" ) == 0 && strcmp( passwd, "p1" ) == 0 ){
 		ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n");
 		ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n");
 		ShowNotice("and then edit your user/password in conf/map_athena.conf (or conf/import/map_conf.txt)\n");
 	}
+#endif
 }
 
 // sets char-server's ip address
@@ -292,7 +274,7 @@ int chrif_isconnected(void) {
  *  CSAVE_INVENTORY: Character changed inventory data
  *  CSAVE_CART: Character changed cart data
  */
-int chrif_save(struct map_session_data *sd, int flag) {
+int chrif_save(map_session_data *sd, int flag) {
 	uint16 mmo_charstatus_len = 0;
 
 	nullpo_retr(-1, sd);
@@ -446,11 +428,10 @@ int chrif_removemap(int fd) {
 // received after a character has been "final saved" on the char-server
 static void chrif_save_ack(int fd) {
 	chrif_auth_delete(RFIFOL(fd,2), RFIFOL(fd,6), ST_LOGOUT);
-	chrif_check_shutdown();
 }
 
 // request to move a character between mapservers
-int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) {
+int chrif_changemapserver(map_session_data* sd, uint32 ip, uint16 port) {
 	nullpo_retr(-1, sd);
 
 	if (other_mapserver_count < 1) {//No other map servers are online!
@@ -549,7 +530,7 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
 			chrif_save(node->sd, CSAVE_QUIT|CSAVE_INVENTORY|CSAVE_CART);
 			break;
 		case ST_MAPCHANGE: { //Re-send map-change request.
-			struct map_session_data *sd = node->sd;
+			map_session_data *sd = node->sd;
 			uint32 ip;
 			uint16 port;
 
@@ -572,8 +553,6 @@ void chrif_on_ready(void) {
 
 	chrif_state = 2;
 
-	chrif_check_shutdown();
-
 	//If there are players online, send them to the char-server. [Skotlex]
 	send_users_tochar();
 
@@ -664,7 +643,7 @@ int chrif_skillcooldown_request(uint32 account_id, uint32 char_id) {
 /*==========================================
  * Request auth confirmation
  *------------------------------------------*/
-void chrif_authreq(struct map_session_data *sd, bool autotrade) {
+void chrif_authreq(map_session_data *sd, bool autotrade) {
 	struct auth_node *node= chrif_search(sd->bl.id);
 
 	if( node != NULL || !chrif_isconnected() ) {
@@ -733,7 +712,7 @@ void chrif_authok(int fd) {
 
 	sd = node->sd;
 
-	if( runflag == MAPSERVER_ST_RUNNING &&
+	if( global_core->is_running() &&
 		node->char_dat == NULL &&
 		node->account_id == account_id &&
 		node->char_id == char_id &&
@@ -812,7 +791,7 @@ TIMER_FUNC(auth_db_cleanup){
 /*==========================================
  *
  *------------------------------------------*/
-int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip) {
+int chrif_charselectreq(map_session_data* sd, uint32 s_ip) {
 	nullpo_retr(-1, sd);
 
 	if( !sd || !sd->bl.id || !sd->login_id1 )
@@ -905,7 +884,7 @@ int chrif_req_login_operation(int aid, const char* character_name, enum chrif_re
  * Send a sex change (for account or character) request to the login server (via char server).
  * @sd : Player requesting operation
  */
-int chrif_changesex(struct map_session_data *sd, bool change_account) {
+int chrif_changesex(map_session_data *sd, bool change_account) {
 	chrif_check(-1);
 
 	WFIFOHEAD(char_fd,44);
@@ -940,7 +919,7 @@ int chrif_changesex(struct map_session_data *sd, bool change_account) {
  *   3: login-server offline
  */
 static void chrif_ack_login_req(int aid, const char* player_name, uint16 type, uint16 answer) {
-	struct map_session_data* sd;
+	map_session_data* sd;
 	char action[25];
 	char output[256];
 
@@ -987,7 +966,7 @@ static void chrif_ack_login_req(int aid, const char* player_name, uint16 type, u
  *------------------------------------------*/
 int chrif_changedsex(int fd) {
 	int acc, sex;
-	struct map_session_data *sd;
+	map_session_data *sd;
 
 	acc = RFIFOL(fd,2);
 	sex = RFIFOL(fd,6);
@@ -1070,7 +1049,7 @@ int chrif_divorce(int partner_id1, int partner_id2) {
  * only used if 'partner_id' is offline
  *------------------------------------------*/
 int chrif_divorceack(uint32 char_id, int partner_id) {
-	struct map_session_data* sd;
+	map_session_data* sd;
 	int i;
 
 	if( !char_id || !partner_id )
@@ -1096,7 +1075,7 @@ int chrif_divorceack(uint32 char_id, int partner_id) {
  * Removes Baby from parents
  *------------------------------------------*/
 int chrif_deadopt(uint32 father_id, uint32 mother_id, uint32 child_id) {
-	struct map_session_data* sd;
+	map_session_data* sd;
 	uint16 idx = skill_get_index(WE_CALLBABY);
 
 	if( father_id && ( sd = map_charid2sd(father_id) ) != NULL && sd->status.child == child_id ) {
@@ -1123,7 +1102,7 @@ int chrif_deadopt(uint32 father_id, uint32 mother_id, uint32 child_id) {
  *------------------------------------------*/
 int chrif_ban(int fd) {
 	int id, res=0;
-	struct map_session_data *sd;
+	map_session_data *sd;
 
 	id = RFIFOL(fd,2);
 	res = RFIFOB(fd,6); // 0: change of statut, 1: ban, 2 charban
@@ -1189,7 +1168,7 @@ int chrif_req_charunban(int aid, const char* character_name){
 //Disconnect the player out of the game, simple packet
 //packet.w AID.L WHY.B 2+4+1 = 7byte
 int chrif_disconnectplayer(int fd) {
-	struct map_session_data* sd;
+	map_session_data* sd;
 	uint32 account_id = RFIFOL(fd, 2);
 
 	sd = map_id2sd(account_id);
@@ -1309,12 +1288,12 @@ int chrif_updatefamelist_ack(int fd) {
 	return 1;
 }
 
-int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex]
+int chrif_save_scdata(map_session_data *sd) { //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex]
 #ifdef ENABLE_SC_SAVING
 	int i, count=0;
 	t_tick tick;
 	struct status_change_data data;
-	struct status_change *sc = &sd->sc;
+	status_change *sc = &sd->sc;
 	const struct TimerData *timer;
 
 	chrif_check(-1);
@@ -1365,7 +1344,7 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
 	return 0;
 }
 
-int chrif_skillcooldown_save(struct map_session_data *sd) {
+int chrif_skillcooldown_save(map_session_data *sd) {
 	int i, count = 0;
 	struct skill_cooldown_data data;
 	t_tick tick;
@@ -1408,7 +1387,7 @@ int chrif_skillcooldown_save(struct map_session_data *sd) {
 int chrif_load_scdata(int fd) {
 
 #ifdef ENABLE_SC_SAVING
-	struct map_session_data *sd;
+	map_session_data *sd;
 	int aid, cid, i, count;
 
 	aid = RFIFOL(fd,4); //Player Account ID
@@ -1442,7 +1421,7 @@ int chrif_load_scdata(int fd) {
 //Retrieve and load skillcooldown for a player
 
 int chrif_skillcooldown_load(int fd) {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	int aid, cid, i, count;
 
 	aid = RFIFOL(fd, 4);
@@ -1468,7 +1447,7 @@ int chrif_skillcooldown_load(int fd) {
 /*=========================================
  * Tell char-server charcter disconnected [Wizputer]
  *-----------------------------------------*/
-int chrif_char_offline(struct map_session_data *sd) {
+int chrif_char_offline(map_session_data *sd) {
 	chrif_check(-1);
 
 	WFIFOHEAD(char_fd,10);
@@ -1521,7 +1500,7 @@ int chrif_char_reset_offline(void) {
  * Tell char-server charcter is online [Wizputer]
  *-----------------------------------------*/
 
-int chrif_char_online(struct map_session_data *sd) {
+int chrif_char_online(map_session_data *sd) {
 	chrif_check(-1);
 
 	WFIFOHEAD(char_fd,10);
@@ -1654,7 +1633,7 @@ int chrif_bsdata_request(uint32 char_id) {
  * @param sd
  * @author [Cydh]
  **/
-int chrif_bsdata_save(struct map_session_data *sd, bool quit) {
+int chrif_bsdata_save(map_session_data *sd, bool quit) {
 	uint8 i = 0;
 
 	chrif_check(-1);
@@ -1720,7 +1699,7 @@ int chrif_bsdata_save(struct map_session_data *sd, bool quit) {
  * @author [Cydh]
  **/
 int chrif_bsdata_received(int fd) {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	uint32 cid = RFIFOL(fd,4);
 	uint8 count = 0;
 
@@ -1862,7 +1841,7 @@ TIMER_FUNC(send_usercount_tochar){
  *------------------------------------------*/
 int send_users_tochar(void) {
 	int users = 0, i = 0;
-	struct map_session_data* sd;
+	map_session_data* sd;
 	struct s_mapiterator* iter;
 
 	chrif_check(-1);

+ 13 - 14
src/map/chrif.hpp

@@ -12,7 +12,7 @@
 #include "../common/socket.hpp" // enum chrif_req_op
 
 //fwd declaration
-struct map_session_data;
+class map_session_data;
 
 enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE };
 
@@ -30,7 +30,7 @@ struct auth_node {
 	uint32 account_id, char_id;
 	int login_id1, login_id2, sex, fd;
 	time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
-	struct map_session_data *sd;	//Data from logged on char.
+	map_session_data *sd;	//Data from logged on char.
 	struct mmo_charstatus *char_dat;	//Data from char server.
 	t_tick node_created; //timestamp for node timeouts
 	enum sd_state state; //To track whether player was login in/out or changing maps.
@@ -43,7 +43,6 @@ int chrif_setip(const char* ip);
 void chrif_setport(uint16 port);
 
 int chrif_isconnected(void);
-void chrif_check_shutdown(void);
 
 extern int chrif_connected;
 extern int other_mapserver_count;
@@ -52,31 +51,31 @@ extern char charserver_name[NAME_LENGTH];
 struct auth_node* chrif_search(uint32 account_id);
 struct auth_node* chrif_auth_check(uint32 account_id, uint32 char_id, enum sd_state state);
 bool chrif_auth_delete(uint32 account_id, uint32 char_id, enum sd_state state);
-bool chrif_auth_finished(struct map_session_data* sd);
+bool chrif_auth_finished(map_session_data* sd);
 
-void chrif_authreq(struct map_session_data* sd, bool autotrade);
+void chrif_authreq(map_session_data* sd, bool autotrade);
 void chrif_authok(int fd);
 int chrif_scdata_request(uint32 account_id, uint32 char_id);
 int chrif_skillcooldown_request(uint32 account_id, uint32 char_id);
-int chrif_skillcooldown_save(struct map_session_data *sd);
+int chrif_skillcooldown_save(map_session_data *sd);
 int chrif_skillcooldown_load(int fd);
 
-int chrif_save(struct map_session_data* sd, int flag);
-int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip);
-int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port);
+int chrif_save(map_session_data* sd, int flag);
+int chrif_charselectreq(map_session_data* sd, uint32 s_ip);
+int chrif_changemapserver(map_session_data* sd, uint32 ip, uint16 port);
 
 int chrif_searchcharid(uint32 char_id);
 int chrif_changeemail(int id, const char *actual_email, const char *new_email);
 int chrif_req_login_operation(int aid, const char* character_name, enum chrif_req_op operation_type, int32 timediff, int val1, int val2);
 int chrif_updatefamelist(map_session_data &sd, e_rank ranktype);
 int chrif_buildfamelist(void);
-int chrif_save_scdata(struct map_session_data *sd);
-int chrif_char_offline(struct map_session_data *sd);
+int chrif_save_scdata(map_session_data *sd);
+int chrif_char_offline(map_session_data *sd);
 int chrif_char_offline_nsd(uint32 account_id, uint32 char_id);
 int chrif_char_reset_offline(void);
 int send_users_tochar(void);
-int chrif_char_online(struct map_session_data *sd);
-int chrif_changesex(struct map_session_data *sd, bool change_account);
+int chrif_char_online(map_session_data *sd);
+int chrif_changesex(map_session_data *sd, bool change_account);
 int chrif_divorce(int partner_id1, int partner_id2);
 
 int chrif_removefriend(uint32 char_id, int friend_id);
@@ -87,7 +86,7 @@ int chrif_req_charban(int aid, const char* character_name, int32 timediff);
 int chrif_req_charunban(int aid, const char* character_name);
 
 int chrif_bsdata_request(uint32 char_id);
-int chrif_bsdata_save(struct map_session_data *sd, bool quit);
+int chrif_bsdata_save(map_session_data *sd, bool quit);
 
 void do_final_chrif(void);
 void do_init_chrif(void);

+ 6 - 6
src/map/clan.cpp

@@ -73,7 +73,7 @@ struct clan* clan_searchname( const char* name ){
 	return c;
 }
 
-struct map_session_data* clan_getavailablesd( struct clan* clan ){
+map_session_data* clan_getavailablesd( struct clan* clan ){
 	int i;
 
 	nullpo_retr(NULL, clan);
@@ -110,7 +110,7 @@ int clan_getNextFreeMemberIndex( struct clan* clan ){
 	}
 }
 
-void clan_member_joined( struct map_session_data* sd ){
+void clan_member_joined( map_session_data* sd ){
 	nullpo_retv(sd);
 
 	if( sd->clan != nullptr ){
@@ -136,7 +136,7 @@ void clan_member_joined( struct map_session_data* sd ){
 	}
 }
 
-void clan_member_left( struct map_session_data* sd ){
+void clan_member_left( map_session_data* sd ){
 	int index;
 	struct clan* clan;
 
@@ -152,7 +152,7 @@ void clan_member_left( struct map_session_data* sd ){
 	}
 }
 
-bool clan_member_join( struct map_session_data *sd, int clan_id, uint32 account_id, uint32 char_id ){
+bool clan_member_join( map_session_data *sd, int clan_id, uint32 account_id, uint32 char_id ){
 	struct clan *clan;
 
 	nullpo_ret(sd);
@@ -172,7 +172,7 @@ bool clan_member_join( struct map_session_data *sd, int clan_id, uint32 account_
 	return true;
 }
 
-bool clan_member_leave( struct map_session_data* sd, int clan_id, uint32 account_id, uint32 char_id ){
+bool clan_member_leave( map_session_data* sd, int clan_id, uint32 account_id, uint32 char_id ){
 	struct clan *clan;
 
 	nullpo_ret(sd);
@@ -199,7 +199,7 @@ void clan_recv_message(int clan_id,uint32 account_id,const char *mes,int len) {
 	clif_clan_message(clan,mes,len);
 }
 
-void clan_send_message( struct map_session_data *sd, const char *mes, int len ){
+void clan_send_message( map_session_data *sd, const char *mes, int len ){
 	nullpo_retv(sd);
 	nullpo_retv(sd->clan);
 

+ 7 - 7
src/map/clan.hpp

@@ -7,20 +7,20 @@
 #include "../common/mmo.hpp"
 
 struct clan;
-struct map_session_data;
+class map_session_data;
 
 void do_init_clan();
 void do_final_clan();
 struct clan* clan_search( int id );
 struct clan* clan_searchname( const char* name );
 void clan_load_clandata( int count, struct clan* clans );
-void clan_member_joined( struct map_session_data* sd );
-void clan_member_left( struct map_session_data* sd );
-bool clan_member_join( struct map_session_data *sd, int clan_id, uint32 account_id, uint32 char_id );
-bool clan_member_leave( struct map_session_data* sd, int clan_id, uint32 account_id, uint32 char_id );
-void clan_send_message( struct map_session_data *sd, const char *mes, int len );
+void clan_member_joined( map_session_data* sd );
+void clan_member_left( map_session_data* sd );
+bool clan_member_join( map_session_data *sd, int clan_id, uint32 account_id, uint32 char_id );
+bool clan_member_leave( map_session_data* sd, int clan_id, uint32 account_id, uint32 char_id );
+void clan_send_message( map_session_data *sd, const char *mes, int len );
 void clan_recv_message(int clan_id,uint32 account_id,const char *mes,int len);
-struct map_session_data* clan_getavailablesd( struct clan* clan );
+map_session_data* clan_getavailablesd( struct clan* clan );
 int clan_get_alliance_count( struct clan *clan, int flag );
 
 #endif /* CLAN_HPP */

File diff suppressed because it is too large
+ 124 - 129
src/map/clif.cpp


+ 320 - 311
src/map/clif.hpp

@@ -23,7 +23,7 @@ struct s_storage;
 //#include "map.hpp"
 struct block_list;
 struct unit_data;
-struct map_session_data;
+class map_session_data;
 struct homun_data;
 struct pet_data;
 struct mob_data;
@@ -61,7 +61,7 @@ enum e_PacketDBVersion { // packet DB
 
 struct s_packet_db {
 	short len;
-	void (*func)(int, struct map_session_data *);
+	void (*func)(int, map_session_data *);
 	short pos[MAX_PACKET_POS];
 };
 
@@ -542,7 +542,6 @@ enum clif_messages : uint16_t {
 	MSG_ATTENDANCE_DISABLED = 0xd92,
 
 	// Unofficial names
-	C_DYNAMICNPC_TWICE = 0xa47, /// <"Is already in service. Please try again in a few minutes."
 	C_ITEM_EQUIP_SWITCH = 0xbc7,
 	C_ITEM_NOEQUIP = 0x174,	/// <"You can't put this item on."
 	C_ENCHANT_OVERWEIGHT = 0xEFD,
@@ -604,6 +603,14 @@ enum e_exitem_add_result : uint8 {
 	EXITEM_ADD_FAILED_EACHITEM_OVERCOUNT,
 };
 
+enum e_dynamicnpc_result : int32{
+	DYNAMICNPC_RESULT_SUCCESS,
+	DYNAMICNPC_RESULT_UNKNOWN,
+	DYNAMICNPC_RESULT_UNKNOWNNPC,
+	DYNAMICNPC_RESULT_DUPLICATE,
+	DYNAMICNPC_RESULT_OUTOFTIME
+};
+
 int clif_setip(const char* ip);
 void clif_setbindip(const char* ip);
 void clif_setport(uint16 port);
@@ -612,7 +619,7 @@ uint32 clif_getip(void);
 uint32 clif_refresh_ip(void);
 uint16 clif_getport(void);
 
-void clif_authok(struct map_session_data *sd);
+void clif_authok(map_session_data *sd);
 void clif_authrefuse(int fd, uint8 error_code);
 void clif_authfail_fd(int fd, int type);
 void clif_charselectok(int id, uint8 ok);
@@ -623,34 +630,34 @@ void clif_clearunit_single(int id, clr_type type, int fd);
 void clif_clearunit_area(struct block_list* bl, clr_type type);
 void clif_clearunit_delayed(struct block_list* bl, clr_type type, t_tick tick);
 int clif_spawn(struct block_list *bl, bool walking = false);	//area
-void clif_walkok(struct map_session_data *sd);	// self
+void clif_walkok(map_session_data *sd);	// self
 void clif_move(struct unit_data *ud); //area
-void clif_changemap(struct map_session_data *sd, short m, int x, int y);	//self
-void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port);	//self
+void clif_changemap(map_session_data *sd, short m, int x, int y);	//self
+void clif_changemapserver(map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port);	//self
 void clif_blown(struct block_list *bl); // area
 void clif_slide(struct block_list *bl, int x, int y); // area
 void clif_fixpos(struct block_list *bl);	// area
-void clif_npcbuysell(struct map_session_data* sd, int id);	//self
-void clif_buylist(struct map_session_data *sd, struct npc_data *nd);	//self
-void clif_selllist(struct map_session_data *sd);	//self
-void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd);
-void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd);
-void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd);
-void clif_scriptmes( struct map_session_data& sd, uint32 npcid, const char *mes );
-void clif_scriptnext( struct map_session_data& sd, uint32 npcid );
-void clif_scriptclose(struct map_session_data *sd, int npcid);	//self
-void clif_scriptclear( struct map_session_data& sd, int npcid ); //self
-void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes);	//self
-void clif_scriptinput(struct map_session_data *sd, int npcid);	//self
-void clif_scriptinputstr(struct map_session_data *sd, int npcid);	// self
-void clif_cutin(struct map_session_data* sd, const char* image, int type);	//self
-void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color);	//self
-void clif_additem(struct map_session_data *sd, int n, int amount, unsigned char fail); // self
-void clif_dropitem(struct map_session_data *sd,int n,int amount);	//self
-void clif_delitem(struct map_session_data *sd,int n,int amount, short reason); //self
+void clif_npcbuysell(map_session_data* sd, int id);	//self
+void clif_buylist(map_session_data *sd, struct npc_data *nd);	//self
+void clif_selllist(map_session_data *sd);	//self
+void clif_npc_market_open(map_session_data *sd, struct npc_data *nd);
+void clif_parse_NPCMarketClosed(int fd, map_session_data *sd);
+void clif_parse_NPCMarketPurchase(int fd, map_session_data *sd);
+void clif_scriptmes( map_session_data& sd, uint32 npcid, const char *mes );
+void clif_scriptnext( map_session_data& sd, uint32 npcid );
+void clif_scriptclose(map_session_data *sd, int npcid);	//self
+void clif_scriptclear( map_session_data& sd, int npcid ); //self
+void clif_scriptmenu(map_session_data* sd, int npcid, const char* mes);	//self
+void clif_scriptinput(map_session_data *sd, int npcid);	//self
+void clif_scriptinputstr(map_session_data *sd, int npcid);	// self
+void clif_cutin(map_session_data* sd, const char* image, int type);	//self
+void clif_viewpoint(map_session_data *sd, int npc_id, int type, int x, int y, int id, int color);	//self
+void clif_additem(map_session_data *sd, int n, int amount, unsigned char fail); // self
+void clif_dropitem(map_session_data *sd,int n,int amount);	//self
+void clif_delitem(map_session_data *sd,int n,int amount, short reason); //self
 void clif_update_hp(map_session_data &sd);
-void clif_updatestatus(struct map_session_data *sd,int type);	//self
-void clif_changestatus(struct map_session_data* sd,int type,int val);	//area
+void clif_updatestatus(map_session_data *sd,int type);	//self
+void clif_changestatus(map_session_data* sd,int type,int val);	//area
 int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage);	// area
 void clif_takeitem(struct block_list* src, struct block_list* dst);
 void clif_sitting(struct block_list* bl);
@@ -659,87 +666,87 @@ void clif_sprite_change(struct block_list *bl, int id, int type, int val, int va
 void clif_changelook(struct block_list *bl,int type,int val);	// area
 void clif_changetraplook(struct block_list *bl,int val); // area
 void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target); //area specified in 'target'
-void clif_arrowequip(struct map_session_data *sd,int val); //self
-void clif_arrow_fail(struct map_session_data *sd,int type); //self
-void clif_arrow_create_list(struct map_session_data *sd);	//self
-void clif_statusupack(struct map_session_data *sd,int type,int ok,int val);	// self
-void clif_equipitemack( struct map_session_data& sd, uint8 flag, int index, int pos = 0 ); // self
-void clif_unequipitemack(struct map_session_data *sd,int n,int pos,int ok);	// self
+void clif_arrowequip(map_session_data *sd,int val); //self
+void clif_arrow_fail(map_session_data *sd,int type); //self
+void clif_arrow_create_list(map_session_data *sd);	//self
+void clif_statusupack(map_session_data *sd,int type,int ok,int val);	// self
+void clif_equipitemack( map_session_data& sd, uint8 flag, int index, int pos = 0 ); // self
+void clif_unequipitemack(map_session_data *sd,int n,int pos,int ok);	// self
 void clif_misceffect(struct block_list* bl,int type);	// area
 void clif_changeoption_target(struct block_list* bl, struct block_list* target);
 #define clif_changeoption(bl) clif_changeoption_target(bl, NULL)	// area
 void clif_changeoption2(struct block_list* bl);	// area
-void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok);	// self
+void clif_useitemack(map_session_data *sd,int index,int amount,bool ok);	// self
 void clif_GlobalMessage(struct block_list* bl, const char* message,enum send_target target);
-void clif_createchat(struct map_session_data* sd, int flag);	// self
+void clif_createchat(map_session_data* sd, int flag);	// self
 void clif_dispchat(struct chat_data* cd, int fd);	// area or fd
-void clif_joinchatfail(struct map_session_data *sd,int flag);	// self
-void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd);	// self
-void clif_addchat(struct chat_data* cd,struct map_session_data *sd);	// chat
-void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd);	// chat
+void clif_joinchatfail(map_session_data *sd,int flag);	// self
+void clif_joinchatok(map_session_data *sd,struct chat_data* cd);	// self
+void clif_addchat(struct chat_data* cd,map_session_data *sd);	// chat
+void clif_changechatowner(struct chat_data* cd, map_session_data* sd);	// chat
 void clif_clearchat(struct chat_data *cd,int fd);	// area or fd
-void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, bool flag);	// chat
+void clif_leavechat(struct chat_data* cd, map_session_data* sd, bool flag);	// chat
 void clif_changechatstatus(struct chat_data* cd);	// chat
-void clif_refresh_storagewindow(struct map_session_data *sd);
-void clif_refresh(struct map_session_data *sd);	// self
+void clif_refresh_storagewindow(map_session_data *sd);
+void clif_refresh(map_session_data *sd);	// self
 
 void clif_emotion(struct block_list *bl,int type);
 void clif_talkiebox(struct block_list* bl, const char* talkie);
 void clif_wedding_effect(struct block_list *bl);
-void clif_divorced(struct map_session_data* sd, const char* name);
-void clif_callpartner(struct map_session_data& sd);
-void clif_playBGM( struct map_session_data& sd, const char* name );
+void clif_divorced(map_session_data* sd, const char* name);
+void clif_callpartner(map_session_data& sd);
+void clif_playBGM( map_session_data& sd, const char* name );
 void clif_soundeffect( struct block_list& bl, const char* name, int type, enum send_target target );
-void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, t_tick tick);
-void clif_parse_LoadEndAck(int fd,struct map_session_data *sd);
-void clif_hotkeys_send(struct map_session_data *sd, int tab);
+void clif_parse_ActionRequest_sub(map_session_data *sd, int action_type, int target_id, t_tick tick);
+void clif_parse_LoadEndAck(int fd,map_session_data *sd);
+void clif_hotkeys_send(map_session_data *sd, int tab);
 
 // trade
-void clif_traderequest(struct map_session_data* sd, const char* name);
-void clif_tradestart(struct map_session_data* sd, uint8 type);
-void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount);
-void clif_tradeitemok(struct map_session_data& sd, int index, e_exitem_add_result result);
-void clif_tradedeal_lock(struct map_session_data* sd, int fail);
-void clif_tradecancelled(struct map_session_data* sd);
-void clif_tradecompleted(struct map_session_data* sd, int fail);
-void clif_tradeundo(struct map_session_data* sd);
+void clif_traderequest(map_session_data* sd, const char* name);
+void clif_tradestart(map_session_data* sd, uint8 type);
+void clif_tradeadditem(map_session_data* sd, map_session_data* tsd, int index, int amount);
+void clif_tradeitemok(map_session_data& sd, int index, e_exitem_add_result result);
+void clif_tradedeal_lock(map_session_data* sd, int fail);
+void clif_tradecancelled(map_session_data* sd);
+void clif_tradecompleted(map_session_data* sd, int fail);
+void clif_tradeundo(map_session_data* sd);
 
 // storage
-void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length, const char *storename);
-void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount);
-void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount);
-void clif_storageitemremoved(struct map_session_data* sd, int index, int amount);
-void clif_storageclose(struct map_session_data* sd);
+void clif_storagelist(map_session_data* sd, struct item* items, int items_length, const char *storename);
+void clif_updatestorageamount(map_session_data* sd, int amount, int max_amount);
+void clif_storageitemadded(map_session_data* sd, struct item* i, int index, int amount);
+void clif_storageitemremoved(map_session_data* sd, int index, int amount);
+void clif_storageclose(map_session_data* sd);
 
 int clif_insight(struct block_list *bl,va_list ap);	// map_forallinmovearea callback
 int clif_outsight(struct block_list *bl,va_list ap);	// map_forallinmovearea callback
 
-void clif_class_change_target(struct block_list *bl,int class_, int type, enum send_target target, struct map_session_data *sd);
+void clif_class_change_target(struct block_list *bl,int class_, int type, enum send_target target, map_session_data *sd);
 #define clif_class_change(bl, class_, type) clif_class_change_target(bl, class_, type, AREA, NULL)
 #define clif_mob_class_change(md, class_) clif_class_change(&md->bl, class_, 1)
 
-void clif_skillinfoblock(struct map_session_data *sd);
-void clif_skillup(struct map_session_data *sd, uint16 skill_id, int lv, int range, int upgradable);
-void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf);
-void clif_addskill(struct map_session_data *sd, int skill_id);
-void clif_deleteskill(struct map_session_data *sd, int skill_id);
+void clif_skillinfoblock(map_session_data *sd);
+void clif_skillup(map_session_data *sd, uint16 skill_id, int lv, int range, int upgradable);
+void clif_skillinfo(map_session_data *sd,int skill_id, int inf);
+void clif_addskill(map_session_data *sd, int skill_id);
+void clif_deleteskill(map_session_data *sd, int skill_id);
 
 void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int property, int casttime);
 void clif_skillcastcancel(struct block_list* bl);
-void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype, t_itemid itemId = 0);
-void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, t_tick tick);
+void clif_skill_fail(map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype, t_itemid itemId = 0);
+void clif_skill_cooldown(map_session_data *sd, uint16 skill_id, t_tick tick);
 int clif_skill_damage(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
 //int clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
 bool clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,t_tick tick);
 void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,t_tick tick);
-void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst);
-void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4);
-void clif_skill_memomessage(struct map_session_data* sd, int type);
-void clif_skill_teleportmessage(struct map_session_data *sd, int type);
-void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id, int trigger);
-void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type);
+void clif_skill_estimation(map_session_data *sd,struct block_list *dst);
+void clif_skill_warppoint(map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4);
+void clif_skill_memomessage(map_session_data* sd, int type);
+void clif_skill_teleportmessage(map_session_data *sd, int type);
+void clif_skill_produce_mix_list(map_session_data *sd, int skill_id, int trigger);
+void clif_cooking_list(map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type);
 
-void clif_produceeffect(struct map_session_data* sd,int flag, t_itemid nameid);
+void clif_produceeffect(map_session_data* sd,int flag, t_itemid nameid);
 
 void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *unit, enum send_target target, bool visible);
 void clif_skill_delunit(struct skill_unit *unit);
@@ -747,12 +754,12 @@ void clif_skillunit_update(struct block_list* bl);
 
 void clif_skill_unit_test(struct block_list *bl, short x, short y, int unit_id, short range, short skill_lv);
 
-void clif_autospell(struct map_session_data *sd,uint16 skill_lv);
-void clif_devotion(struct block_list *src, struct map_session_data *tsd);
+void clif_autospell(map_session_data *sd,uint16 skill_lv);
+void clif_devotion(struct block_list *src, map_session_data *tsd);
 void clif_spiritball( struct block_list *bl, struct block_list* target = nullptr, enum send_target send_target = AREA );
-void clif_soulball( struct map_session_data *sd, struct block_list* target = nullptr, enum send_target send_target = AREA );
-void clif_servantball( struct map_session_data& sd, struct block_list* target = nullptr, enum send_target send_target = AREA );
-void clif_abyssball( struct map_session_data& sd, struct block_list* target = nullptr, enum send_target send_target = AREA );
+void clif_soulball( map_session_data *sd, struct block_list* target = nullptr, enum send_target send_target = AREA );
+void clif_servantball( map_session_data& sd, struct block_list* target = nullptr, enum send_target send_target = AREA );
+void clif_abyssball( map_session_data& sd, struct block_list* target = nullptr, enum send_target send_target = AREA );
 void clif_combo_delay(struct block_list *bl,t_tick wait);
 void clif_bladestop(struct block_list *src, int dst_id, int active);
 void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target);
@@ -763,7 +770,7 @@ void clif_status_change_sub(struct block_list *bl, int id, int type, int flag, t
 void clif_efst_status_change(struct block_list *bl, int tid, enum send_target target, int type, t_tick tick_total, t_tick tick, int val1, int val2, int val3);
 void clif_efst_status_change_sub(struct block_list *tbl, struct block_list *bl, enum send_target target);
 
-void clif_wis_message(struct map_session_data* sd, const char* nick, const char* mes, int mes_len, int gmlvl);
+void clif_wis_message(map_session_data* sd, const char* nick, const char* mes, int mes_len, int gmlvl);
 void clif_wis_end(int fd, int result);
 
 void clif_solved_charname(int fd, int charid, const char* name);
@@ -771,107 +778,107 @@ void clif_name( struct block_list* src, struct block_list *bl, send_target targe
 #define clif_name_self(bl) clif_name( (bl), (bl), SELF )
 #define clif_name_area(bl) clif_name( (bl), (bl), AREA )
 
-void clif_use_card(struct map_session_data *sd,int idx);
-void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag);
+void clif_use_card(map_session_data *sd,int idx);
+void clif_insert_card(map_session_data *sd,int idx_equip,int idx_card,int flag);
 
-void clif_inventorylist(struct map_session_data *sd);
-void clif_equiplist(struct map_session_data *sd);
+void clif_inventorylist(map_session_data *sd);
+void clif_equiplist(map_session_data *sd);
 
-void clif_cart_additem(struct map_session_data *sd,int n,int amount);
-void clif_cart_additem_ack(struct map_session_data *sd, uint8 flag);
-void clif_cart_delitem(struct map_session_data *sd,int n,int amount);
-void clif_cartlist(struct map_session_data *sd);
+void clif_cart_additem(map_session_data *sd,int n,int amount);
+void clif_cart_additem_ack(map_session_data *sd, uint8 flag);
+void clif_cart_delitem(map_session_data *sd,int n,int amount);
+void clif_cartlist(map_session_data *sd);
 void clif_clearcart(int fd);
 
-void clif_item_identify_list(struct map_session_data *sd);
-void clif_item_identified(struct map_session_data *sd,int idx,int flag);
-void clif_item_repair_list(struct map_session_data *sd, struct map_session_data *dstsd, int lv);
-void clif_item_repaireffect(struct map_session_data *sd, int idx, int flag);
-void clif_item_damaged(struct map_session_data* sd, unsigned short position);
-void clif_item_refine_list(struct map_session_data *sd);
-void clif_hat_effects( struct map_session_data* sd, struct block_list* bl, enum send_target target );
-void clif_hat_effect_single( struct map_session_data* sd, uint16 effectId, bool enable );
-
-void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv);
-
-void clif_mvp_effect(struct map_session_data *sd);
-void clif_mvp_item(struct map_session_data *sd, t_itemid nameid);
-void clif_mvp_exp(struct map_session_data *sd, t_exp exp);
-void clif_mvp_noitem(struct map_session_data* sd);
+void clif_item_identify_list(map_session_data *sd);
+void clif_item_identified(map_session_data *sd,int idx,int flag);
+void clif_item_repair_list(map_session_data *sd, map_session_data *dstsd, int lv);
+void clif_item_repaireffect(map_session_data *sd, int idx, int flag);
+void clif_item_damaged(map_session_data* sd, unsigned short position);
+void clif_item_refine_list(map_session_data *sd);
+void clif_hat_effects( map_session_data* sd, struct block_list* bl, enum send_target target );
+void clif_hat_effect_single( map_session_data* sd, uint16 effectId, bool enable );
+
+void clif_item_skill(map_session_data *sd,uint16 skill_id,uint16 skill_lv);
+
+void clif_mvp_effect(map_session_data *sd);
+void clif_mvp_item(map_session_data *sd, t_itemid nameid);
+void clif_mvp_exp(map_session_data *sd, t_exp exp);
+void clif_mvp_noitem(map_session_data* sd);
 void clif_changed_dir(struct block_list *bl, enum send_target target);
 
 // vending
-void clif_openvendingreq(struct map_session_data* sd, int num);
-void clif_showvendingboard( struct map_session_data& sd, enum send_target target = AREA_WOS, struct block_list* tbl = nullptr );
+void clif_openvendingreq(map_session_data* sd, int num);
+void clif_showvendingboard( map_session_data& sd, enum send_target target = AREA_WOS, struct block_list* tbl = nullptr );
 void clif_closevendingboard(struct block_list* bl, int fd);
-void clif_vendinglist( struct map_session_data* sd, struct map_session_data* vsd );
-void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail);
-void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending);
-void clif_vendingreport(struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny);
+void clif_vendinglist( map_session_data* sd, map_session_data* vsd );
+void clif_buyvending(map_session_data* sd, int index, int amount, int fail);
+void clif_openvending(map_session_data* sd, int id, struct s_vending* vending);
+void clif_vendingreport(map_session_data* sd, int index, int amount, uint32 char_id, int zeny);
 
-void clif_movetoattack(struct map_session_data *sd,struct block_list *bl);
+void clif_movetoattack(map_session_data *sd,struct block_list *bl);
 
 // party
-void clif_party_created( struct map_session_data& sd, int result );
-void clif_party_member_info( struct party_data& party, struct map_session_data& sd );
-void clif_party_info( struct party_data& party, struct map_session_data *sd = nullptr );
-void clif_party_invite( struct map_session_data& sd, struct map_session_data& tsd );
-void clif_party_invite_reply( struct map_session_data& sd, const char* nick, enum e_party_invite_reply reply );
-void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag);
-void clif_party_withdraw( struct map_session_data& sd, uint32 account_id, const char* name, enum e_party_member_withdraw result, enum send_target target );
+void clif_party_created( map_session_data& sd, int result );
+void clif_party_member_info( struct party_data& party, map_session_data& sd );
+void clif_party_info( struct party_data& party, map_session_data *sd = nullptr );
+void clif_party_invite( map_session_data& sd, map_session_data& tsd );
+void clif_party_invite_reply( map_session_data& sd, const char* nick, enum e_party_invite_reply reply );
+void clif_party_option(struct party_data *p,map_session_data *sd,int flag);
+void clif_party_withdraw( map_session_data& sd, uint32 account_id, const char* name, enum e_party_member_withdraw result, enum send_target target );
 void clif_party_message( struct party_data& party, uint32 account_id, const char* mes, int len );
-void clif_party_xy( struct map_session_data& sd );
-void clif_party_xy_single( struct map_session_data& sd, struct map_session_data& tsd );
-void clif_party_hp( struct map_session_data& sd );
-void clif_hpmeter_single( struct map_session_data& sd, uint32 id, uint32 hp, uint32 maxhp );
-void clif_party_job_and_level( struct map_session_data& sd );
-void clif_party_dead( struct map_session_data& sd );
+void clif_party_xy( map_session_data& sd );
+void clif_party_xy_single( map_session_data& sd, map_session_data& tsd );
+void clif_party_hp( map_session_data& sd );
+void clif_hpmeter_single( map_session_data& sd, uint32 id, uint32 hp, uint32 maxhp );
+void clif_party_job_and_level( map_session_data& sd );
+void clif_party_dead( map_session_data& sd );
 
 // guild
-void clif_guild_created(struct map_session_data *sd,int flag);
-void clif_guild_belonginfo( struct map_session_data& sd );
-void clif_guild_masterormember(struct map_session_data *sd);
-void clif_guild_basicinfo( struct map_session_data& sd );
-void clif_guild_allianceinfo(struct map_session_data *sd);
-void clif_guild_memberlist( struct map_session_data& sd );
-void clif_guild_skillinfo(struct map_session_data* sd);
-void clif_guild_send_onlineinfo(struct map_session_data *sd); //[LuzZza]
+void clif_guild_created(map_session_data *sd,int flag);
+void clif_guild_belonginfo( map_session_data& sd );
+void clif_guild_masterormember(map_session_data *sd);
+void clif_guild_basicinfo( map_session_data& sd );
+void clif_guild_allianceinfo(map_session_data *sd);
+void clif_guild_memberlist( map_session_data& sd );
+void clif_guild_skillinfo(map_session_data* sd);
+void clif_guild_send_onlineinfo(map_session_data *sd); //[LuzZza]
 void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag);
-void clif_guild_invite(struct map_session_data *sd,struct guild *g);
-void clif_guild_inviteack(struct map_session_data *sd,int flag);
-void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes);
-void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, uint32 account_id);
+void clif_guild_invite(map_session_data *sd,struct guild *g);
+void clif_guild_inviteack(map_session_data *sd,int flag);
+void clif_guild_leave(map_session_data *sd,const char *name,const char *mes);
+void clif_guild_expulsion(map_session_data* sd, const char* name, const char* mes, uint32 account_id);
 void clif_guild_positionchanged(struct guild *g,int idx);
 void clif_guild_memberpositionchanged(struct guild *g,int idx);
-void clif_guild_emblem(struct map_session_data *sd,struct guild *g);
+void clif_guild_emblem(map_session_data *sd,struct guild *g);
 void clif_guild_emblem_area(struct block_list* bl);
-void clif_guild_notice(struct map_session_data* sd);
+void clif_guild_notice(map_session_data* sd);
 void clif_guild_message(struct guild *g,uint32 account_id,const char *mes,int len);
-void clif_guild_reqalliance(struct map_session_data *sd,uint32 account_id,const char *name);
-void clif_guild_allianceack(struct map_session_data *sd,int flag);
-void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag);
-void clif_guild_oppositionack(struct map_session_data *sd,int flag);
-void clif_guild_broken(struct map_session_data *sd,int flag);
-void clif_guild_xy(struct map_session_data *sd);
-void clif_guild_xy_single(int fd, struct map_session_data *sd);
-void clif_guild_xy_remove(struct map_session_data *sd);
+void clif_guild_reqalliance(map_session_data *sd,uint32 account_id,const char *name);
+void clif_guild_allianceack(map_session_data *sd,int flag);
+void clif_guild_delalliance(map_session_data *sd,int guild_id,int flag);
+void clif_guild_oppositionack(map_session_data *sd,int flag);
+void clif_guild_broken(map_session_data *sd,int flag);
+void clif_guild_xy(map_session_data *sd);
+void clif_guild_xy_single(int fd, map_session_data *sd);
+void clif_guild_xy_remove(map_session_data *sd);
 
 // Battleground
-void clif_bg_hp(struct map_session_data *sd);
-void clif_bg_xy(struct map_session_data *sd);
-void clif_bg_xy_remove(struct map_session_data *sd);
+void clif_bg_hp(map_session_data *sd);
+void clif_bg_xy(map_session_data *sd);
+void clif_bg_xy_remove(map_session_data *sd);
 void clif_bg_message(struct s_battleground_data *bg, int src_id, const char *name, const char *mes, int len);
 void clif_bg_updatescore(int16 m);
-void clif_bg_updatescore_single(struct map_session_data *sd);
-void clif_sendbgemblem_area(struct map_session_data *sd);
-void clif_sendbgemblem_single(int fd, struct map_session_data *sd);
+void clif_bg_updatescore_single(map_session_data *sd);
+void clif_sendbgemblem_area(map_session_data *sd);
+void clif_sendbgemblem_single(int fd, map_session_data *sd);
 
 // Battleground Queue
-void clif_bg_queue_apply_result(e_bg_queue_apply_ack result, const char *name, struct map_session_data *sd);
-void clif_bg_queue_apply_notify(const char *name, struct map_session_data *sd);
-void clif_bg_queue_entry_init(struct map_session_data *sd);
-void clif_bg_queue_lobby_notify(const char *name, struct map_session_data *sd);
-void clif_bg_queue_ack_lobby(bool result, const char *name, const char *lobbyname, struct map_session_data *sd);
+void clif_bg_queue_apply_result(e_bg_queue_apply_ack result, const char *name, map_session_data *sd);
+void clif_bg_queue_apply_notify(const char *name, map_session_data *sd);
+void clif_bg_queue_entry_init(map_session_data *sd);
+void clif_bg_queue_lobby_notify(const char *name, map_session_data *sd);
+void clif_bg_queue_ack_lobby(bool result, const char *name, const char *lobbyname, map_session_data *sd);
 
 // Instancing
 void clif_instance_create(int instance_id, int num);
@@ -879,10 +886,10 @@ void clif_instance_changewait(int instance_id, int num);
 void clif_instance_status(int instance_id, unsigned int limit1, unsigned int limit2);
 void clif_instance_changestatus(int instance_id, e_instance_notify type, unsigned int limit);
 void clif_parse_MemorialDungeonCommand(int fd, map_session_data *sd);
-void clif_instance_info( struct map_session_data& sd );
+void clif_instance_info( map_session_data& sd );
 
 // Custom Fonts
-void clif_font(struct map_session_data *sd);
+void clif_font(map_session_data *sd);
 
 // atcommand
 void clif_displaymessage(const int fd, const char* mes);
@@ -892,82 +899,82 @@ void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned l
 void clif_heal(int fd,int type,int val);
 void clif_resurrection(struct block_list *bl,int type);
 void clif_map_property(struct block_list *bl, enum map_property property, enum send_target t);
-void clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum,int type);
+void clif_pvpset(map_session_data *sd, int pvprank, int pvpnum,int type);
 void clif_map_property_mapall(int map, enum map_property property);
 void clif_refine(int fd, int fail, int index, int val);
-void clif_upgrademessage( struct map_session_data* sd, int result, t_itemid item_id );
+void clif_upgrademessage( map_session_data* sd, int result, t_itemid item_id );
 
 //petsystem
-void clif_catch_process(struct map_session_data *sd);
-void clif_pet_roulette(struct map_session_data *sd,int data);
-void clif_sendegg(struct map_session_data *sd);
-void clif_send_petstatus(struct map_session_data *sd);
-void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param);
+void clif_catch_process(map_session_data *sd);
+void clif_pet_roulette(map_session_data *sd,int data);
+void clif_sendegg(map_session_data *sd);
+void clif_send_petstatus(map_session_data *sd);
+void clif_send_petdata(map_session_data* sd, struct pet_data* pd, int type, int param);
 #define clif_pet_equip(sd, pd) clif_send_petdata(sd, pd, 3, (pd)->vd.head_bottom)
 #define clif_pet_equip_area(pd) clif_send_petdata(NULL, pd, 3, (pd)->vd.head_bottom)
 #define clif_pet_performance(pd, param) clif_send_petdata(NULL, pd, 4, param)
 void clif_pet_emotion(struct pet_data *pd,int param);
-void clif_pet_food(struct map_session_data *sd,int foodid,int fail);
-void clif_pet_autofeed_status(struct map_session_data* sd, bool force);
+void clif_pet_food(map_session_data *sd,int foodid,int fail);
+void clif_pet_autofeed_status(map_session_data* sd, bool force);
 
 //friends list
-int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap);
-void clif_friendslist_send( struct map_session_data& sd );
-void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type);
+int clif_friendslist_toggle_sub(map_session_data *sd,va_list ap);
+void clif_friendslist_send( map_session_data& sd );
+void clif_friendslist_reqack(map_session_data *sd, map_session_data *f_sd, int type);
 
 void clif_weather(int16 m); // [Valaris]
 void clif_specialeffect(struct block_list* bl, int type, enum send_target target); // special effects [Valaris]
 void clif_specialeffect_single(struct block_list* bl, int type, int fd);
 void clif_specialeffect_remove(struct block_list* bl_src, int effect, enum send_target e_target, struct block_list* bl_target);
-void clif_messagecolor_target(struct block_list *bl, unsigned long color, const char *msg, bool rgb2bgr, enum send_target type, struct map_session_data *sd);
+void clif_messagecolor_target(struct block_list *bl, unsigned long color, const char *msg, bool rgb2bgr, enum send_target type, map_session_data *sd);
 #define clif_messagecolor(bl, color, msg, rgb2bgr, type) clif_messagecolor_target(bl, color, msg, rgb2bgr, type, NULL) // Mob/Npc color talk [SnakeDrak]
 void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target);
 
-void clif_GM_kickack(struct map_session_data *sd, int id);
-void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd);
-void clif_manner_message(struct map_session_data* sd, uint32 type);
-void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type);
+void clif_GM_kickack(map_session_data *sd, int id);
+void clif_GM_kick(map_session_data *sd,map_session_data *tsd);
+void clif_manner_message(map_session_data* sd, uint32 type);
+void clif_GM_silence(map_session_data* sd, map_session_data* tsd, uint8 type);
 
 void clif_disp_overhead_(struct block_list *bl, const char* mes, enum send_target flag);
 #define clif_disp_overhead(bl, mes) clif_disp_overhead_(bl, mes, AREA)
 
-void clif_get_weapon_view(struct map_session_data* sd, t_itemid *rhand, t_itemid *lhand);
+void clif_get_weapon_view(map_session_data* sd, t_itemid *rhand, t_itemid *lhand);
 
-void clif_party_xy_remove(struct map_session_data *sd); //Fix for minimap [Kevin]
-void clif_gospel_info(struct map_session_data *sd, int type);
-void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv);
-void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result);
-void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type);
-void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type);
-void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress);
-void clif_feel_hate_reset(struct map_session_data *sd);
+void clif_party_xy_remove(map_session_data *sd); //Fix for minimap [Kevin]
+void clif_gospel_info(map_session_data *sd, int type);
+void clif_feel_req(int fd, map_session_data *sd, uint16 skill_lv);
+void clif_starskill(map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result);
+void clif_feel_info(map_session_data* sd, unsigned char feel_level, unsigned char type);
+void clif_hate_info(map_session_data *sd, unsigned char hate_level,int class_, unsigned char type);
+void clif_mission_info(map_session_data *sd, int mob_id, unsigned char progress);
+void clif_feel_hate_reset(map_session_data *sd);
 
 // [blackhole89]
-void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag);
-int clif_homskillinfoblock(struct map_session_data *sd);
-void clif_homskillup(struct map_session_data *sd, uint16 skill_id);	//[orn]
-void clif_hom_food(struct map_session_data *sd,int foodid,int fail);	//[orn]
-void clif_send_homdata(struct map_session_data *sd, int state, int param);	//[orn]
-
-void clif_configuration( struct map_session_data* sd, enum e_config_type type, bool enabled );
-void clif_partytickack(struct map_session_data* sd, bool flag);
-void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd);
-void clif_equipcheckbox(struct map_session_data* sd);
-
-void clif_msg(struct map_session_data* sd, unsigned short id);
-void clif_msg_value(struct map_session_data* sd, unsigned short id, int value);
-void clif_msg_skill(struct map_session_data* sd, uint16 skill_id, int msg_id);
-void clif_msg_color( struct map_session_data* sd, uint16 msg_id, uint32 color );
+void clif_hominfo(map_session_data *sd, struct homun_data *hd, int flag);
+int clif_homskillinfoblock(map_session_data *sd);
+void clif_homskillup(map_session_data *sd, uint16 skill_id);	//[orn]
+void clif_hom_food(map_session_data *sd,int foodid,int fail);	//[orn]
+void clif_send_homdata(map_session_data *sd, int state, int param);	//[orn]
+
+void clif_configuration( map_session_data* sd, enum e_config_type type, bool enabled );
+void clif_partytickack(map_session_data* sd, bool flag);
+void clif_viewequip_ack(map_session_data* sd, map_session_data* tsd);
+void clif_equipcheckbox(map_session_data* sd);
+
+void clif_msg(map_session_data* sd, unsigned short id);
+void clif_msg_value(map_session_data* sd, unsigned short id, int value);
+void clif_msg_skill(map_session_data* sd, uint16 skill_id, int msg_id);
+void clif_msg_color( map_session_data* sd, uint16 msg_id, uint32 color );
 
 //quest system [Kevin] [Inkfish]
-void clif_quest_send_list(struct map_session_data * sd);
-void clif_quest_send_mission(struct map_session_data * sd);
-void clif_quest_add(struct map_session_data * sd, struct quest * qd);
-void clif_quest_delete(struct map_session_data * sd, int quest_id);
-void clif_quest_update_status(struct map_session_data * sd, int quest_id, bool active);
-void clif_quest_update_objective(struct map_session_data * sd, struct quest * qd);
-void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, e_questinfo_types effect, e_questinfo_markcolor color);
-void clif_displayexp(struct map_session_data *sd, t_exp exp, char type, bool quest, bool lost);
+void clif_quest_send_list(map_session_data * sd);
+void clif_quest_send_mission(map_session_data * sd);
+void clif_quest_add(map_session_data * sd, struct quest * qd);
+void clif_quest_delete(map_session_data * sd, int quest_id);
+void clif_quest_update_status(map_session_data * sd, int quest_id, bool active);
+void clif_quest_update_objective(map_session_data * sd, struct quest * qd);
+void clif_quest_show_event(map_session_data *sd, struct block_list *bl, e_questinfo_types effect, e_questinfo_markcolor color);
+void clif_displayexp(map_session_data *sd, t_exp exp, char type, bool quest, bool lost);
 
 int clif_send(const void* buf, int len, struct block_list* bl, enum send_target type);
 void do_init_clif(void);
@@ -984,132 +991,132 @@ enum mail_send_result : uint8_t {
 };
 
 void clif_Mail_window(int fd, int flag);
-void clif_Mail_read(struct map_session_data *sd, int mail_id);
-void clif_mail_delete(struct map_session_data* sd, struct mail_message *msg, bool success);
+void clif_Mail_read(map_session_data *sd, int mail_id);
+void clif_mail_delete(map_session_data* sd, struct mail_message *msg, bool success);
 void clif_Mail_return(int fd, int mail_id, short fail);
-void clif_Mail_send(struct map_session_data* sd, enum mail_send_result result);
-void clif_Mail_new(struct map_session_data* sd, int mail_id, const char *sender, const char *title);
-void clif_Mail_refreshinbox(struct map_session_data *sd,enum mail_inbox_type type,int64 mailID);
-void clif_mail_getattachment(struct map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attachment_type type);
-void clif_Mail_Receiver_Ack(struct map_session_data* sd, uint32 char_id, short class_, uint32 level, const char* name);
-void clif_mail_removeitem(struct map_session_data* sd, bool success, int index, int amount);
+void clif_Mail_send(map_session_data* sd, enum mail_send_result result);
+void clif_Mail_new(map_session_data* sd, int mail_id, const char *sender, const char *title);
+void clif_Mail_refreshinbox(map_session_data *sd,enum mail_inbox_type type,int64 mailID);
+void clif_mail_getattachment(map_session_data* sd, struct mail_message *msg, uint8 result, enum mail_attachment_type type);
+void clif_Mail_Receiver_Ack(map_session_data* sd, uint32 char_id, short class_, uint32 level, const char* name);
+void clif_mail_removeitem(map_session_data* sd, bool success, int index, int amount);
 // AUCTION SYSTEM
-void clif_Auction_openwindow(struct map_session_data *sd);
-void clif_Auction_results(struct map_session_data *sd, short count, short pages, uint8 *buf);
+void clif_Auction_openwindow(map_session_data *sd);
+void clif_Auction_results(map_session_data *sd, short count, short pages, uint8 *buf);
 void clif_Auction_message(int fd, unsigned char flag);
 void clif_Auction_close(int fd, unsigned char flag);
-void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd);
+void clif_parse_Auction_cancelreg(int fd, map_session_data *sd);
 
-void clif_bossmapinfo(struct map_session_data *sd, struct mob_data *md, enum e_bossmap_info flag);
-void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd);
+void clif_bossmapinfo(map_session_data *sd, struct mob_data *md, enum e_bossmap_info flag);
+void clif_cashshop_show(map_session_data *sd, struct npc_data *nd);
 
 // ADOPTION
-void clif_Adopt_reply(struct map_session_data *sd, int type);
-void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id);
+void clif_Adopt_reply(map_session_data *sd, int type);
+void clif_Adopt_request(map_session_data *sd, map_session_data *src, int p_id);
 
 // MERCENARIES
-void clif_mercenary_info(struct map_session_data *sd);
-void clif_mercenary_skillblock(struct map_session_data *sd);
-void clif_mercenary_message(struct map_session_data* sd, int message);
-void clif_mercenary_updatestatus(struct map_session_data *sd, int type);
+void clif_mercenary_info(map_session_data *sd);
+void clif_mercenary_skillblock(map_session_data *sd);
+void clif_mercenary_message(map_session_data* sd, int message);
+void clif_mercenary_updatestatus(map_session_data *sd, int type);
 
 // RENTAL SYSTEM
-void clif_rental_time( struct map_session_data* sd, t_itemid nameid, int seconds );
-void clif_rental_expired( struct map_session_data* sd, int index, t_itemid nameid );
+void clif_rental_time( map_session_data* sd, t_itemid nameid, int seconds );
+void clif_rental_expired( map_session_data* sd, int index, t_itemid nameid );
 
 // BOOK READING
 void clif_readbook(int fd, int book_id, int page);
 
 // Show Picker
-void clif_party_show_picker(struct map_session_data * sd, struct item * item_data);
+void clif_party_show_picker(map_session_data * sd, struct item * item_data);
 
 // Progress Bar [Inkfish]
-void clif_progressbar(struct map_session_data * sd, unsigned long color, unsigned int second);
-void clif_progressbar_abort(struct map_session_data * sd);
-void clif_progressbar_npc(struct npc_data *nd, struct map_session_data* sd);
+void clif_progressbar(map_session_data * sd, unsigned long color, unsigned int second);
+void clif_progressbar_abort(map_session_data * sd);
+void clif_progressbar_npc(struct npc_data *nd, map_session_data* sd);
 #define clif_progressbar_npc_area(nd) clif_progressbar_npc((nd),NULL)
 
-void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag);
-void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag);
+void clif_PartyBookingRegisterAck(map_session_data *sd, int flag);
+void clif_PartyBookingDeleteAck(map_session_data* sd, int flag);
 void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, bool more_result);
-void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad);
-void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index);
-void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad);
+void clif_PartyBookingUpdateNotify(map_session_data* sd, struct party_booking_ad_info* pb_ad);
+void clif_PartyBookingDeleteNotify(map_session_data* sd, int index);
+void clif_PartyBookingInsertNotify(map_session_data* sd, struct party_booking_ad_info* pb_ad);
 
 /* Bank System [Yommy/Hercules] */
-void clif_parse_BankDeposit (int fd, struct map_session_data *sd);
-void clif_parse_BankWithdraw (int fd, struct map_session_data *sd);
-void clif_parse_BankCheck (int fd, struct map_session_data *sd);
-void clif_parse_BankOpen (int fd, struct map_session_data *sd);
-void clif_parse_BankClose (int fd, struct map_session_data *sd);
+void clif_parse_BankDeposit (int fd, map_session_data *sd);
+void clif_parse_BankWithdraw (int fd, map_session_data *sd);
+void clif_parse_BankCheck (int fd, map_session_data *sd);
+void clif_parse_BankOpen (int fd, map_session_data *sd);
+void clif_parse_BankClose (int fd, map_session_data *sd);
 
-void clif_showdigit(struct map_session_data* sd, unsigned char type, int value);
+void clif_showdigit(map_session_data* sd, unsigned char type, int value);
 
 /// Buying Store System
-void clif_buyingstore_open(struct map_session_data* sd);
-void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight);
-void clif_buyingstore_myitemlist(struct map_session_data* sd);
-void clif_buyingstore_entry( struct map_session_data& sd, struct block_list* tbl = nullptr );
-void clif_buyingstore_disappear_entry( struct map_session_data& sd, struct block_list* tbl = nullptr );
-void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd);
-void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result);
-void clif_buyingstore_update_item(struct map_session_data* sd, t_itemid nameid, unsigned short amount, uint32 char_id, int zeny);
-void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price);
-void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, t_itemid nameid);
+void clif_buyingstore_open(map_session_data* sd);
+void clif_buyingstore_open_failed(map_session_data* sd, unsigned short result, unsigned int weight);
+void clif_buyingstore_myitemlist(map_session_data* sd);
+void clif_buyingstore_entry( map_session_data& sd, struct block_list* tbl = nullptr );
+void clif_buyingstore_disappear_entry( map_session_data& sd, struct block_list* tbl = nullptr );
+void clif_buyingstore_itemlist(map_session_data* sd, map_session_data* pl_sd);
+void clif_buyingstore_trade_failed_buyer(map_session_data* sd, short result);
+void clif_buyingstore_update_item(map_session_data* sd, t_itemid nameid, unsigned short amount, uint32 char_id, int zeny);
+void clif_buyingstore_delete_item(map_session_data* sd, short index, unsigned short amount, int price);
+void clif_buyingstore_trade_failed_seller(map_session_data* sd, short result, t_itemid nameid);
 
 /// Search Store System
-void clif_search_store_info_ack(struct map_session_data* sd);
-void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason);
-void clif_open_search_store_info(struct map_session_data* sd);
-void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y);
+void clif_search_store_info_ack(map_session_data* sd);
+void clif_search_store_info_failed(map_session_data* sd, unsigned char reason);
+void clif_open_search_store_info(map_session_data* sd);
+void clif_search_store_info_click_ack(map_session_data* sd, short x, short y);
 
 /// Cash Shop
-void clif_cashshop_result( struct map_session_data* sd, t_itemid item_id, uint16 result );
-void clif_cashshop_open( struct map_session_data* sd, int tab );
+void clif_cashshop_result( map_session_data* sd, t_itemid item_id, uint16 result );
+void clif_cashshop_open( map_session_data* sd, int tab );
 
-void clif_display_pinfo( struct map_session_data& sd );
+void clif_display_pinfo( map_session_data& sd );
 
 /// Roulette
-void clif_roulette_open(struct map_session_data* sd);
-void clif_parse_roulette_open(int fd, struct map_session_data *sd);
-void clif_parse_roulette_info(int fd, struct map_session_data *sd);
-void clif_parse_roulette_close(int fd, struct map_session_data *sd);
-void clif_parse_roulette_generate(int fd, struct map_session_data *sd);
-void clif_parse_roulette_item(int fd, struct map_session_data *sd);
+void clif_roulette_open(map_session_data* sd);
+void clif_parse_roulette_open(int fd, map_session_data *sd);
+void clif_parse_roulette_info(int fd, map_session_data *sd);
+void clif_parse_roulette_close(int fd, map_session_data *sd);
+void clif_parse_roulette_generate(int fd, map_session_data *sd);
+void clif_parse_roulette_item(int fd, map_session_data *sd);
 
-void clif_elementalconverter_list(struct map_session_data *sd);
+void clif_elementalconverter_list(map_session_data *sd);
 
 void clif_millenniumshield(struct block_list *bl, short shields);
 
-void clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y);
+void clif_magicdecoy_list(map_session_data *sd, uint16 skill_lv, short x, short y);
 
-void clif_poison_list(struct map_session_data *sd, uint16 skill_lv);
+void clif_poison_list(map_session_data *sd, uint16 skill_lv);
 
-int clif_autoshadowspell_list(struct map_session_data *sd);
+int clif_autoshadowspell_list(map_session_data *sd);
 
-int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv );
-void clif_elemental_info(struct map_session_data *sd);
-void clif_elemental_updatestatus(struct map_session_data *sd, int type);
+int clif_skill_itemlistwindow( map_session_data *sd, uint16 skill_id, uint16 skill_lv );
+void clif_elemental_info(map_session_data *sd);
+void clif_elemental_updatestatus(map_session_data *sd, int type);
 
-void clif_spiritcharm(struct map_session_data *sd);
+void clif_spiritcharm(map_session_data *sd);
 
 void clif_snap( struct block_list *bl, short x, short y );
 void clif_monster_hp_bar( struct mob_data* md, int fd );
 
 // Clan System
-void clif_clan_basicinfo( struct map_session_data *sd );
+void clif_clan_basicinfo( map_session_data *sd );
 void clif_clan_message(struct clan *clan,const char *mes,int len);
 void clif_clan_onlinecount( struct clan* clan );
-void clif_clan_leave( struct map_session_data* sd );
+void clif_clan_leave( map_session_data* sd );
 
 // Bargain Tool
 void clif_sale_start(struct sale_item_data* sale_item, struct block_list* bl, enum send_target target);
 void clif_sale_end(struct sale_item_data* sale_item, struct block_list* bl, enum send_target target);
 void clif_sale_amount(struct sale_item_data* sale_item, struct block_list* bl, enum send_target target);
-void clif_sale_open(struct map_session_data* sd);
+void clif_sale_open(map_session_data* sd);
 
 // Refine UI
-void clif_refineui_open( struct map_session_data* sd );
+void clif_refineui_open( map_session_data* sd );
 
 /**
  * Color Table
@@ -1130,28 +1137,28 @@ void clif_channel_msg(struct Channel *channel, const char *msg, unsigned long co
 
 #define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0;
 
-void clif_ranklist(struct map_session_data *sd, int16 rankingType);
+void clif_ranklist(map_session_data *sd, int16 rankingType);
 void clif_update_rankingpoint(map_session_data &sd, int rankingtype, int point);
 
-void clif_crimson_marker( struct map_session_data& sd, struct block_list& bl, bool remove );
+void clif_crimson_marker( map_session_data& sd, struct block_list& bl, bool remove );
 
 void clif_showscript(struct block_list* bl, const char* message, enum send_target flag);
-void clif_party_leaderchanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid);
+void clif_party_leaderchanged(map_session_data *sd, int prev_leader_aid, int new_leader_aid);
 
 void clif_account_name(int fd, uint32 account_id, const char* accname);
-void clif_notify_bindOnEquip( struct map_session_data& sd, int16 index );
+void clif_notify_bindOnEquip( map_session_data& sd, int16 index );
 
-void clif_merge_item_open( struct map_session_data& sd );
+void clif_merge_item_open( map_session_data& sd );
 
 void clif_broadcast_obtain_special_item(const char *char_name, t_itemid nameid, t_itemid container, enum BROADCASTING_SPECIAL_ITEM_OBTAIN type);
 
-void clif_dressing_room(struct map_session_data *sd, int flag);
-void clif_navigateTo(struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id );
-void clif_SelectCart(struct map_session_data *sd);
+void clif_dressing_room(map_session_data *sd, int flag);
+void clif_navigateTo(map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id );
+void clif_SelectCart(map_session_data *sd);
 
 /// Achievement System
-void clif_achievement_list_all(struct map_session_data *sd);
-void clif_achievement_update(struct map_session_data *sd, struct achievement *ach, int count);
+void clif_achievement_list_all(map_session_data *sd);
+void clif_achievement_update(map_session_data *sd, struct achievement *ach, int count);
 void clif_achievement_reward_ack(int fd, unsigned char result, int ach_id);
 
 /// Attendance System
@@ -1172,53 +1179,53 @@ enum out_ui_type : int8 {
 	OUT_UI_ENCHANT = 10,
 };
 
-void clif_ui_open( struct map_session_data& sd, enum out_ui_type ui_type, int32 data );
-void clif_attendence_response( struct map_session_data *sd, int32 data );
+void clif_ui_open( map_session_data& sd, enum out_ui_type ui_type, int32 data );
+void clif_attendence_response( map_session_data *sd, int32 data );
 
-void clif_weight_limit( struct map_session_data* sd );
+void clif_weight_limit( map_session_data* sd );
 
-void clif_guild_storage_log( struct map_session_data* sd, std::vector<struct guild_log_entry>& log, enum e_guild_storage_log result );
+void clif_guild_storage_log( map_session_data* sd, std::vector<struct guild_log_entry>& log, enum e_guild_storage_log result );
 
-void clif_camerainfo( struct map_session_data* sd, bool show, float range = 0.0f, float rotation = 0.0f, float latitude = 0.0f );
+void clif_camerainfo( map_session_data* sd, bool show, float range = 0.0f, float rotation = 0.0f, float latitude = 0.0f );
 
 /// Equip Switch System
-void clif_equipswitch_list( struct map_session_data* sd );
-void clif_equipswitch_add( struct map_session_data* sd,uint16 index, uint32 pos, uint8 flag );
-void clif_equipswitch_remove( struct map_session_data* sd, uint16 index, uint32 pos, bool failed );
-void clif_equipswitch_reply( struct map_session_data* sd, bool failed );
+void clif_equipswitch_list( map_session_data* sd );
+void clif_equipswitch_add( map_session_data* sd,uint16 index, uint32 pos, uint8 flag );
+void clif_equipswitch_remove( map_session_data* sd, uint16 index, uint32 pos, bool failed );
+void clif_equipswitch_reply( map_session_data* sd, bool failed );
 
 /// Pet evolution
-void clif_pet_evolution_result( struct map_session_data* sd, e_pet_evolution_result result );
+void clif_pet_evolution_result( map_session_data* sd, e_pet_evolution_result result );
 
-void clif_parse_skill_toid( struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, int target_id );
+void clif_parse_skill_toid( map_session_data* sd, uint16 skill_id, uint16 skill_lv, int target_id );
 
-void clif_inventory_expansion_info( struct map_session_data* sd );
+void clif_inventory_expansion_info( map_session_data* sd );
 
 // Barter System
-void clif_barter_open( struct map_session_data& sd, struct npc_data& nd );
-void clif_barter_extended_open( struct map_session_data& sd, struct npc_data& nd );
+void clif_barter_open( map_session_data& sd, struct npc_data& nd );
+void clif_barter_extended_open( map_session_data& sd, struct npc_data& nd );
 
 void clif_summon_init(struct mob_data& md);
 void clif_summon_hp_bar(struct mob_data& md);
 
 // Laphine System
-void clif_laphine_synthesis_open( struct map_session_data *sd, std::shared_ptr<s_laphine_synthesis> synthesis );
-void clif_laphine_upgrade_open( struct map_session_data* sd, std::shared_ptr<s_laphine_upgrade> upgrade );
+void clif_laphine_synthesis_open( map_session_data *sd, std::shared_ptr<s_laphine_synthesis> synthesis );
+void clif_laphine_upgrade_open( map_session_data* sd, std::shared_ptr<s_laphine_upgrade> upgrade );
 
 // Reputation System
-void clif_reputation_type( struct map_session_data& sd, int64 type, int64 points );
-void clif_reputation_list( struct map_session_data& sd );
+void clif_reputation_type( map_session_data& sd, int64 type, int64 points );
+void clif_reputation_list( map_session_data& sd );
 
 // Item Reform UI
-void clif_item_reform_open( struct map_session_data& sd, t_itemid item );
+void clif_item_reform_open( map_session_data& sd, t_itemid item );
 
 // Item Enchant UI
-void clif_enchantwindow_open( struct map_session_data& sd, uint64 clientLuaIndex );
+void clif_enchantwindow_open( map_session_data& sd, uint64 clientLuaIndex );
 
 // Enchanting Shadow / Shadow Scar Spirit
 void clif_enchantingshadow_spirit(unit_data &ud);
 
-void clif_broadcast_refine_result(struct map_session_data& sd, t_itemid itemId, int8 level, bool success);
+void clif_broadcast_refine_result(map_session_data& sd, t_itemid itemId, int8 level, bool success);
 
 // Captcha Register
 void clif_captcha_upload_request(map_session_data &sd);
@@ -1236,4 +1243,6 @@ void clif_macro_detector_status(map_session_data &sd, e_macro_detect_status styp
 void clif_macro_reporter_select(map_session_data &sd, const std::vector<uint32> &aid_list);
 void clif_macro_reporter_status(map_session_data &sd, e_macro_report_status stype);
 
+void clif_dynamicnpc_result( map_session_data& sd, e_dynamicnpc_result result );
+
 #endif /* CLIF_HPP */

+ 5 - 0
src/map/clif_packetdb.hpp

@@ -2409,6 +2409,11 @@
 	parseable_packet( HEADER_CZ_REQ_ITEMREPAIR2, sizeof( struct PACKET_CZ_REQ_ITEMREPAIR2 ), clif_parse_RepairItem, 0 );
 #endif
 
+#if PACKETVER >= 20191204
+	parseable_packet( HEADER_CZ_PARTY_REQ_MASTER_TO_JOIN, sizeof( struct PACKET_CZ_PARTY_REQ_MASTER_TO_JOIN ), clif_parse_partybooking_join, 0 );
+	parseable_packet( HEADER_CZ_PARTY_REQ_ACK_MASTER_TO_JOIN, sizeof( struct PACKET_CZ_PARTY_REQ_ACK_MASTER_TO_JOIN ), clif_parse_partybooking_reply, 0 );
+#endif
+
 #if PACKETVER_MAIN_NUM >= 20200916 || PACKETVER_RE_NUM >= 20200724
 	parseable_packet( HEADER_CZ_UNCONFIRMED_TSTATUS_UP, sizeof( PACKET_CZ_UNCONFIRMED_TSTATUS_UP ), clif_parse_traitstatus_up, 0 );
 	parseable_packet( HEADER_CZ_GRADE_ENCHANT_SELECT_EQUIPMENT, sizeof( struct PACKET_CZ_GRADE_ENCHANT_SELECT_EQUIPMENT ), clif_parse_enchantgrade_add, 0 );

+ 13 - 13
src/map/duel.cpp

@@ -42,12 +42,12 @@ size_t duel_countactives()
 	return count; 
 } 
 
-static void duel_set(const size_t did, struct map_session_data* sd);
+static void duel_set(const size_t did, map_session_data* sd);
 
 /*
  * Save the current time of the duel in PC_LAST_DUEL_TIME
  */
-void duel_savetime(struct map_session_data* sd)
+void duel_savetime(map_session_data* sd)
 {
 	time_t timer;
 	struct tm *t;
@@ -61,7 +61,7 @@ void duel_savetime(struct map_session_data* sd)
 /*
  * Check if the time elapsed between last duel is enough to launch another.
  */
-bool duel_checktime(struct map_session_data* sd)
+bool duel_checktime(map_session_data* sd)
 {
 	int64 diff;
 	time_t timer;
@@ -90,9 +90,9 @@ bool duel_check_player_limit(struct duel& pDuel)
 /*
  * Display opponents name of sd
  */
-static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
+static int duel_showinfo_sub(map_session_data* sd, va_list va)
 {
-	struct map_session_data *ssd = va_arg(va, struct map_session_data*);
+	map_session_data *ssd = va_arg(va, map_session_data*);
 	int *p = va_arg(va, int*);
 
 	if (sd->duel_group != ssd->duel_group) 
@@ -108,7 +108,7 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
  * Display duel infos,
  * Number of duely...
  */
-void duel_showinfo(const size_t did, struct map_session_data* sd)
+void duel_showinfo(const size_t did, map_session_data* sd)
 {
 	//std::lock_guard<std::recursive_mutex> _(duel_list_mutex); //or shared_ptr	
 	if ( !duel_exist( did ) )
@@ -136,7 +136,7 @@ void duel_showinfo(const size_t did, struct map_session_data* sd)
 /*
 * Moves sd to duel
 */
-static void duel_set(const size_t did, struct map_session_data* sd) {
+static void duel_set(const size_t did, map_session_data* sd) {
 	sd->state.changemap = 1;
 	sd->state.warping = 1;
 
@@ -157,7 +157,7 @@ static void duel_set(const size_t did, struct map_session_data* sd) {
  * Create a new duel for sd
  * return new duel_id or 0 when fail
  */
-size_t duel_create(struct map_session_data* sd, const unsigned int maxpl)
+size_t duel_create(map_session_data* sd, const unsigned int maxpl)
 {
 	static size_t lastID=0;
 	lastID++;
@@ -184,7 +184,7 @@ size_t duel_create(struct map_session_data* sd, const unsigned int maxpl)
  * @sd = inviting player
  * @target_sd = invited player
  */
-bool duel_invite(const size_t did, struct map_session_data* sd, struct map_session_data* target_sd)
+bool duel_invite(const size_t did, map_session_data* sd, map_session_data* target_sd)
 {
 	//std::lock_guard<std::recursive_mutex> _(duel_list_mutex);
 	if ( !duel_exist( did ) )
@@ -208,7 +208,7 @@ bool duel_invite(const size_t did, struct map_session_data* sd, struct map_sessi
  * @sd = leaving player
  * @va = list(only contain duel_id atm)
  */
-static int duel_leave_sub(struct map_session_data* sd, va_list va)
+static int duel_leave_sub(map_session_data* sd, va_list va)
 {
 	size_t did = va_arg(va, size_t);
 	if (sd->duel_invite == did)
@@ -221,7 +221,7 @@ static int duel_leave_sub(struct map_session_data* sd, va_list va)
  * @did = duel id
  * @sd = leaving player
  */
-bool duel_leave(const size_t did, struct map_session_data* sd)
+bool duel_leave(const size_t did, map_session_data* sd)
 {
 	//std::lock_guard<std::recursive_mutex> _(duel_list_mutex);
 	if ( !duel_exist( did ) )
@@ -249,7 +249,7 @@ bool duel_leave(const size_t did, struct map_session_data* sd)
  * @did = duel id
  * @sd = player accepting duel
  */
-bool duel_accept(const size_t did, struct map_session_data* sd)
+bool duel_accept(const size_t did, map_session_data* sd)
 {
 	{ //mutex scope
 		//std::lock_guard<std::recursive_mutex> _(duel_list_mutex);
@@ -276,7 +276,7 @@ bool duel_accept(const size_t did, struct map_session_data* sd)
  * @did = duel id
  * @sd = player refusing duel
  */
-bool duel_reject(const size_t did, struct map_session_data* sd)
+bool duel_reject(const size_t did, map_session_data* sd)
 {
 	{
 		//std::lock_guard<std::recursive_mutex> _(duel_list_mutex);

+ 8 - 8
src/map/duel.hpp

@@ -5,7 +5,7 @@
 #define DUEL_HPP
 
 #include "../common/cbasetypes.hpp"
-
+class map_session_data;
 struct duel {
 	int members_count;
 	int invites_count;
@@ -18,13 +18,13 @@ size_t duel_counttotal();
 size_t duel_countactives();
 
 //Duel functions // [LuzZza]
-size_t duel_create(struct map_session_data* sd, const unsigned int maxpl);
-bool duel_invite(const size_t did, struct map_session_data* sd, struct map_session_data* target_sd);
-bool duel_accept(const size_t did, struct map_session_data* sd);
-bool duel_reject(const size_t did, struct map_session_data* sd);
-bool duel_leave(const size_t did, struct map_session_data* sd);
-void duel_showinfo(const size_t did, struct map_session_data* sd);
-bool duel_checktime(struct map_session_data* sd);
+size_t duel_create(map_session_data* sd, const unsigned int maxpl);
+bool duel_invite(const size_t did, map_session_data* sd, map_session_data* target_sd);
+bool duel_accept(const size_t did, map_session_data* sd);
+bool duel_reject(const size_t did, map_session_data* sd);
+bool duel_leave(const size_t did, map_session_data* sd);
+void duel_showinfo(const size_t did, map_session_data* sd);
+bool duel_checktime(map_session_data* sd);
 bool duel_check_player_limit( struct duel& pDuel );
 
 void do_init_duel(void);

+ 45 - 45
src/map/guild.cpp

@@ -369,7 +369,7 @@ std::shared_ptr<guild_castle> CastleDatabase::mapname2gc(const char* mapname) {
 	return castle_db.mapindex2gc(mapindex_name2id(mapname));
 }
 
-struct map_session_data* guild_getavailablesd(struct guild* g) {
+map_session_data* guild_getavailablesd(struct guild* g) {
 	int i;
 
 	nullpo_retr(NULL, g);
@@ -390,7 +390,7 @@ int guild_getindex(struct guild *g,uint32 account_id,uint32 char_id) {
 }
 
 /// lookup: player sd -> member position
-int guild_getposition(struct map_session_data* sd) {
+int guild_getposition(map_session_data* sd) {
 	int i;
 	struct guild *g;
 
@@ -401,7 +401,7 @@ int guild_getposition(struct map_session_data* sd) {
 }
 
 //Creation of member information
-void guild_makemember(struct guild_member *m,struct map_session_data *sd) {
+void guild_makemember(struct guild_member *m,map_session_data *sd) {
 	nullpo_retv(sd);
 
 	memset(m,0,sizeof(struct guild_member));
@@ -469,7 +469,7 @@ int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) {
 	}
 
 	for(i=0;i<g->max_member;i++){
-		struct map_session_data* sd = g->member[i].sd;
+		map_session_data* sd = g->member[i].sd;
 		if( sd != NULL && sd->fd && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id ) {
 			clif_guild_xy(sd);
 			sd->guild_x = sd->bl.x;
@@ -485,14 +485,14 @@ static TIMER_FUNC(guild_send_xy_timer){
 	return 0;
 }
 
-int guild_send_dot_remove(struct map_session_data *sd) {
+int guild_send_dot_remove(map_session_data *sd) {
 	if (sd->status.guild_id)
 		clif_guild_xy_remove(sd);
 	return 0;
 }
 //------------------------------------------------------------------------
 
-int guild_create(struct map_session_data *sd, const char *name) {
+int guild_create(map_session_data *sd, const char *name) {
 	char tname[NAME_LENGTH];
 	struct guild_member m;
 	nullpo_ret(sd);
@@ -522,7 +522,7 @@ int guild_create(struct map_session_data *sd, const char *name) {
 
 //Whether or not to create guild
 int guild_created(uint32 account_id,int guild_id) {
-	struct map_session_data *sd=map_id2sd(account_id);
+	map_session_data *sd=map_id2sd(account_id);
 
 	if(sd==NULL)
 		return 0;
@@ -573,7 +573,7 @@ int guild_npc_request_info(int guild_id,const char *event) {
  * Close trade window if party member is kicked when trade a party bound item
  * @param sd
  **/
-static void guild_trade_bound_cancel(struct map_session_data *sd) {
+static void guild_trade_bound_cancel(map_session_data *sd) {
 #ifdef BOUND_ITEMS
 	nullpo_retv(sd);
 	if (sd->state.isBoundTrading&(1<<BOUND_GUILD))
@@ -586,7 +586,7 @@ static void guild_trade_bound_cancel(struct map_session_data *sd) {
 //Confirmation of the character belongs to guild
 int guild_check_member(struct guild *g) {
 	int i;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct s_mapiterator* iter;
 
 	nullpo_ret(g);
@@ -611,7 +611,7 @@ int guild_check_member(struct guild *g) {
 
 //Delete association with guild_id for all characters
 int guild_recv_noinfo(int guild_id) {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct s_mapiterator* iter;
 
 	iter = mapit_getallusers();
@@ -629,7 +629,7 @@ int guild_recv_info(struct guild *sg) {
 	struct guild *g,before;
 	int i,bm,m;
 	DBData data;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	bool guild_new = false;
 
 	nullpo_ret(sg);
@@ -729,7 +729,7 @@ int guild_recv_info(struct guild *sg) {
 /*=============================================
  * Player sd send a guild invatation to player tsd to join his guild
  *--------------------------------------------*/
-int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
+int guild_invite(map_session_data *sd, map_session_data *tsd) {
 	struct guild *g;
 	int i;
 
@@ -779,8 +779,8 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
 
 /// Guild invitation reply.
 /// flag: 0:rejected, 1:accepted
-int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) {
-	struct map_session_data* tsd;
+int guild_reply_invite(map_session_data* sd, int guild_id, int flag) {
+	map_session_data* tsd;
 
 	nullpo_ret(sd);
 
@@ -832,7 +832,7 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) {
 //- If guild is not in memory, it is requested
 //- Otherwise sd pointer is set up.
 //- Player must be authed and must belong to a guild before invoking this method
-void guild_member_joined(struct map_session_data *sd) {
+void guild_member_joined(map_session_data *sd) {
 	struct guild* g;
 	int i;
 	g=guild_search(sd->status.guild_id);
@@ -865,7 +865,7 @@ void guild_member_joined(struct map_session_data *sd) {
  * Add a player to a given guild_id
  *----------------------------------------*/
 int guild_member_added(int guild_id,uint32 account_id,uint32 char_id,int flag) {
-	struct map_session_data *sd= map_id2sd(account_id),*sd2;
+	map_session_data *sd= map_id2sd(account_id),*sd2;
 	struct guild *g;
 
 	if( (g=guild_search(guild_id))==NULL )
@@ -914,7 +914,7 @@ int guild_member_added(int guild_id,uint32 account_id,uint32 char_id,int flag) {
 /*==========================================
  * Player request leaving a given guild_id
  *----------------------------------------*/
-int guild_leave(struct map_session_data* sd, int guild_id, uint32 account_id, uint32 char_id, const char* mes) {
+int guild_leave(map_session_data* sd, int guild_id, uint32 account_id, uint32 char_id, const char* mes) {
 	struct guild *g;
 
 	nullpo_ret(sd);
@@ -937,8 +937,8 @@ int guild_leave(struct map_session_data* sd, int guild_id, uint32 account_id, ui
 /*==========================================
  * Request remove a player to a given guild_id
  *----------------------------------------*/
-int guild_expulsion(struct map_session_data* sd, int guild_id, uint32 account_id, uint32 char_id, const char* mes) {
-	struct map_session_data *tsd;
+int guild_expulsion(map_session_data* sd, int guild_id, uint32 account_id, uint32 char_id, const char* mes) {
+	map_session_data *tsd;
 	struct guild *g;
 	int i,ps;
 
@@ -984,8 +984,8 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, uint32 account_id
 int guild_member_withdraw(int guild_id, uint32 account_id, uint32 char_id, int flag, const char* name, const char* mes) {
 	int i;
 	struct guild* g = guild_search(guild_id);
-	struct map_session_data* sd = map_charid2sd(char_id);
-	struct map_session_data* online_member_sd;
+	map_session_data* sd = map_charid2sd(char_id);
+	map_session_data* online_member_sd;
 
 	if(g == NULL)
 		return 0; // no such guild (error!)
@@ -1094,7 +1094,7 @@ void guild_retrieveitembound(uint32 char_id, uint32 account_id, int guild_id) {
 }
 #endif
 
-int guild_send_memberinfoshort(struct map_session_data *sd,int online) { // cleaned up [LuzZza]
+int guild_send_memberinfoshort(map_session_data *sd,int online) { // cleaned up [LuzZza]
 	struct guild *g;
 
 	nullpo_ret(sd);
@@ -1150,7 +1150,7 @@ int guild_recv_memberinfoshort(int guild_id,uint32 account_id,uint32 char_id,int
 
 	if(idx == -1 || c == 0) {
         //Treat char_id who doesn't match guild_id (not found as member)
-		struct map_session_data *sd = map_id2sd(account_id);
+		map_session_data *sd = map_id2sd(account_id);
 		if(sd && sd->status.char_id == char_id) {
 			sd->status.guild_id=0;
 			sd->guild_emblem_id=0;
@@ -1189,7 +1189,7 @@ int guild_recv_memberinfoshort(int guild_id,uint32 account_id,uint32 char_id,int
 /*====================================================
  * Send a message to whole guild
  *---------------------------------------------------*/
-int guild_send_message(struct map_session_data *sd,const char *mes,int len) {
+int guild_send_message(map_session_data *sd,const char *mes,int len) {
 	nullpo_ret(sd);
 
 	if(sd->status.guild_id==0)
@@ -1270,7 +1270,7 @@ int guild_position_changed(int guild_id,int idx,struct guild_position *p) {
 /*====================================================
  * Change guild notice
  *---------------------------------------------------*/
-int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2) {
+int guild_change_notice(map_session_data *sd,int guild_id,const char *mes1,const char *mes2) {
 	nullpo_ret(sd);
 
 	if(guild_id!=sd->status.guild_id)
@@ -1291,7 +1291,7 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2) {
 	memcpy(g->mes2,mes2,MAX_GUILDMES2);
 
 	for(i=0;i<g->max_member;i++){
-		struct map_session_data *sd = g->member[i].sd;
+		map_session_data *sd = g->member[i].sd;
 		if(sd != NULL)
 			clif_guild_notice(sd);
 	}
@@ -1317,7 +1317,7 @@ bool guild_check_emblem_change_condition(map_session_data *sd)
 /*====================================================
  * Change guild emblem
  *---------------------------------------------------*/
-int guild_change_emblem(struct map_session_data *sd,int len,const char *data) {
+int guild_change_emblem(map_session_data *sd,int len,const char *data) {
 	nullpo_ret(sd);
 
 	if (!guild_check_emblem_change_condition(sd)) {
@@ -1346,7 +1346,7 @@ int guild_change_emblem_version(map_session_data* sd, int version)
  *---------------------------------------------------*/
 int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) {
 	int i;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct guild *g=guild_search(guild_id);
 	if(g==NULL)
 		return 0;
@@ -1403,7 +1403,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) {
  */
 static DBData create_expcache(DBKey key, va_list args) {
 	struct guild_expcache *c;
-	struct map_session_data *sd = va_arg(args, struct map_session_data*);
+	map_session_data *sd = va_arg(args, map_session_data*);
 
 	c = ers_alloc(expcache_ers, struct guild_expcache);
 	c->guild_id = sd->status.guild_id;
@@ -1416,7 +1416,7 @@ static DBData create_expcache(DBKey key, va_list args) {
 /*====================================================
  * Return taxed experience from player sd to guild
  *---------------------------------------------------*/
-t_exp guild_payexp(struct map_session_data *sd,t_exp exp) {
+t_exp guild_payexp(map_session_data *sd,t_exp exp) {
 	struct guild *g;
 	struct guild_expcache *c;
 	int per;
@@ -1447,7 +1447,7 @@ t_exp guild_payexp(struct map_session_data *sd,t_exp exp) {
  * Add this experience to guild exp
  * [Celest]
  *---------------------------------------------------*/
-t_exp guild_getexp(struct map_session_data *sd,t_exp exp) {
+t_exp guild_getexp(map_session_data *sd,t_exp exp) {
 	struct guild_expcache *c;
 	nullpo_ret(sd);
 
@@ -1463,7 +1463,7 @@ t_exp guild_getexp(struct map_session_data *sd,t_exp exp) {
 /*====================================================
  * Ask to increase guildskill skill_id
  *---------------------------------------------------*/
-void guild_skillup(struct map_session_data* sd, uint16 skill_id) {
+void guild_skillup(map_session_data* sd, uint16 skill_id) {
 	struct guild* g;
 	short idx = guild_skill_get_index(skill_id);
 	short max = 0;
@@ -1489,7 +1489,7 @@ void guild_skillup(struct map_session_data* sd, uint16 skill_id) {
  * Notification of guildskill skill_id increase request
  *---------------------------------------------------*/
 int guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id) {
-	struct map_session_data *sd = map_id2sd(account_id);
+	map_session_data *sd = map_id2sd(account_id);
 	struct guild *g = guild_search(guild_id);
 	int i;
 	short idx = guild_skill_get_index(skill_id);
@@ -1520,7 +1520,7 @@ int guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id) {
 	return 0;
 }
 
-void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) {
+void guild_guildaura_refresh(map_session_data *sd, uint16 skill_id, uint16 skill_lv) {
 	if( !(battle_config.guild_aura&(is_agit_start()?2:1)) &&
 			!(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) )
 		return;
@@ -1561,7 +1561,7 @@ int guild_get_alliance_count(struct guild *g,int flag) {
 }
 
 // Blocks all guild skills which have a common delay time.
-void guild_block_skill(struct map_session_data *sd, int time) {
+void guild_block_skill(map_session_data *sd, int time) {
 	uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL };
 	int i;
 	for (i = 0; i < 4; i++)
@@ -1590,7 +1590,7 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag) {
 /*====================================================
  * Player sd, asking player tsd an alliance between their 2 guilds
  *---------------------------------------------------*/
-int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) {
+int guild_reqalliance(map_session_data *sd,map_session_data *tsd) {
 	struct guild *g[2];
 	int i;
 
@@ -1653,8 +1653,8 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
 /*====================================================
  * Player sd, answer to player tsd (account_id) for an alliance request
  *---------------------------------------------------*/
-int guild_reply_reqalliance(struct map_session_data *sd,uint32 account_id,int flag) {
-	struct map_session_data *tsd;
+int guild_reply_reqalliance(map_session_data *sd,uint32 account_id,int flag) {
+	map_session_data *tsd;
 
 	nullpo_ret(sd);
 	tsd= map_id2sd( account_id );
@@ -1713,7 +1713,7 @@ int guild_reply_reqalliance(struct map_session_data *sd,uint32 account_id,int fl
 /*====================================================
  * Player sd asking to break alliance with guild guild_id
  *---------------------------------------------------*/
-int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) {
+int guild_delalliance(map_session_data *sd,int guild_id,int flag) {
 	nullpo_ret(sd);
 
 	if(is_agit_start()) {	// Disable alliance breaking during woe [Valaris]
@@ -1728,7 +1728,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) {
 /*====================================================
  * Player sd, asking player tsd a formal enemy relation between their 2 guilds
  *---------------------------------------------------*/
-int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd) {
+int guild_opposition(map_session_data *sd,map_session_data *tsd) {
 	struct guild *g;
 	int i;
 
@@ -1775,7 +1775,7 @@ int guild_allianceack(int guild_id1,int guild_id2,uint32 account_id1,uint32 acco
 	struct guild *g[2];
 	int guild_id[2];
 	const char *guild_name[2];
-	struct map_session_data *sd[2];
+	map_session_data *sd[2];
 	int j,i;
 
 	guild_id[0] = guild_id1;
@@ -1836,7 +1836,7 @@ int guild_allianceack(int guild_id1,int guild_id2,uint32 account_id1,uint32 acco
 	for (i = 0; i < 2 - (flag & 1); i++) { // Retransmission of the relationship list to all members
 		if(g[i]!=NULL)
 			for(j=0;j<g[i]->max_member;j++) {
-				struct map_session_data *sd_mem = g[i]->member[j].sd;
+				map_session_data *sd_mem = g[i]->member[j].sd;
 				if( sd_mem!=NULL){
 					clif_guild_allianceinfo(sd_mem);
 
@@ -1858,7 +1858,7 @@ int guild_broken_sub(DBKey key, DBData *data, va_list ap) {
 	struct guild *g = (struct guild *)db_data2ptr(data);
 	int guild_id=va_arg(ap,int);
 	int i,j;
-	struct map_session_data *sd=NULL;
+	map_session_data *sd=NULL;
 
 	nullpo_ret(g);
 
@@ -1903,7 +1903,7 @@ int guild_broken(int guild_id,int flag) {
 		return 0;
 
 	for (i = 0; i < g->max_member; i++){	// Destroy all relationships
-		struct map_session_data *sd = g->member[i].sd;
+		map_session_data *sd = g->member[i].sd;
 		if(sd != NULL){
 			if(sd->state.storage_flag == 2)
 				storage_guild_storage_quit(sd,1);
@@ -2026,7 +2026,7 @@ int guild_gm_changed(int guild_id, uint32 account_id, uint32 char_id, time_t tim
 * @param sd Player who breaks the guild
 * @param name Guild name
 */
-int guild_break(struct map_session_data *sd,char *name) {
+int guild_break(map_session_data *sd,char *name) {
 	struct guild *g;
 	struct unit_data *ud;
 	int i;

+ 24 - 24
src/map/guild.hpp

@@ -14,7 +14,7 @@ struct guild;
 struct guild_member;
 struct guild_position;
 struct guild_castle;
-struct map_session_data;
+class map_session_data;
 struct mob_data;
 
 //For quick linking to a guardian's info. [Skotlex]
@@ -38,54 +38,54 @@ void do_init_guild(void);
 struct guild *guild_search(int guild_id);
 struct guild *guild_searchname(char *str);
 
-struct map_session_data *guild_getavailablesd(struct guild *g);
+map_session_data *guild_getavailablesd(struct guild *g);
 int guild_getindex(struct guild *g,uint32 account_id,uint32 char_id);
-int guild_getposition(struct map_session_data *sd);
-t_exp guild_payexp(struct map_session_data *sd,t_exp exp);
-t_exp guild_getexp(struct map_session_data *sd,t_exp exp); // [Celest]
+int guild_getposition(map_session_data *sd);
+t_exp guild_payexp(map_session_data *sd,t_exp exp);
+t_exp guild_getexp(map_session_data *sd,t_exp exp); // [Celest]
 
-int guild_create(struct map_session_data *sd, const char *name);
+int guild_create(map_session_data *sd, const char *name);
 int guild_created(uint32 account_id,int guild_id);
 int guild_request_info(int guild_id);
 int guild_recv_noinfo(int guild_id);
 int guild_recv_info(struct guild *sg);
 int guild_npc_request_info(int guild_id,const char *ev);
-int guild_invite(struct map_session_data *sd,struct map_session_data *tsd);
-int guild_reply_invite(struct map_session_data *sd,int guild_id,int flag);
-void guild_member_joined(struct map_session_data *sd);
+int guild_invite(map_session_data *sd,map_session_data *tsd);
+int guild_reply_invite(map_session_data *sd,int guild_id,int flag);
+void guild_member_joined(map_session_data *sd);
 int guild_member_added(int guild_id,uint32 account_id,uint32 char_id,int flag);
-int guild_leave(struct map_session_data *sd,int guild_id,
+int guild_leave(map_session_data *sd,int guild_id,
 	uint32 account_id,uint32 char_id,const char *mes);
 int guild_member_withdraw(int guild_id,uint32 account_id,uint32 char_id,int flag,
 	const char *name,const char *mes);
-int guild_expulsion(struct map_session_data *sd,int guild_id,
+int guild_expulsion(map_session_data *sd,int guild_id,
 	uint32 account_id,uint32 char_id,const char *mes);
-void guild_skillup(struct map_session_data* sd, uint16 skill_id);
-void guild_block_skill(struct map_session_data *sd, int time);
-int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd);
-int guild_reply_reqalliance(struct map_session_data *sd,uint32 account_id,int flag);
+void guild_skillup(map_session_data* sd, uint16 skill_id);
+void guild_block_skill(map_session_data *sd, int time);
+int guild_reqalliance(map_session_data *sd,map_session_data *tsd);
+int guild_reply_reqalliance(map_session_data *sd,uint32 account_id,int flag);
 int guild_allianceack(int guild_id1,int guild_id2,uint32 account_id1,uint32 account_id2,
 	int flag,const char *name1,const char *name2);
-int guild_delalliance(struct map_session_data *sd,int guild_id,int flag);
-int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd);
+int guild_delalliance(map_session_data *sd,int guild_id,int flag);
+int guild_opposition(map_session_data *sd,map_session_data *tsd);
 int guild_check_alliance(int guild_id1, int guild_id2, int flag);
 
-int guild_send_memberinfoshort(struct map_session_data *sd,int online);
+int guild_send_memberinfoshort(map_session_data *sd,int online);
 int guild_recv_memberinfoshort(int guild_id,uint32 account_id,uint32 char_id,int online,int lv,int class_);
 int guild_change_memberposition(int guild_id,uint32 account_id,uint32 char_id,short idx);
 int guild_memberposition_changed(struct guild *g,int idx,int pos);
 int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char *name);
 int guild_position_changed(int guild_id,int idx,struct guild_position *p);
-int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2);
+int guild_change_notice(map_session_data *sd,int guild_id,const char *mes1,const char *mes2);
 int guild_notice_changed(int guild_id,const char *mes1,const char *mes2);
-int guild_change_emblem(struct map_session_data *sd,int len,const char *data);
+int guild_change_emblem(map_session_data *sd,int len,const char *data);
 int guild_change_emblem_version(map_session_data* sd, int version);
 int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data);
-int guild_send_message(struct map_session_data *sd,const char *mes,int len);
+int guild_send_message(map_session_data *sd,const char *mes,int len);
 int guild_recv_message(int guild_id,uint32 account_id,const char *mes,int len);
-int guild_send_dot_remove(struct map_session_data *sd);
+int guild_send_dot_remove(map_session_data *sd);
 int guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id);
-int guild_break(struct map_session_data *sd,char *name);
+int guild_break(map_session_data *sd,char *name);
 int guild_broken(int guild_id,int flag);
 int guild_gm_change(int guild_id, uint32 char_id);
 int guild_gm_changed(int guild_id, uint32 account_id, uint32 char_id, time_t time);
@@ -109,7 +109,7 @@ void guild_flag_add(struct npc_data *nd);
 void guild_flag_remove(struct npc_data *nd);
 void guild_flags_clear(void);
 
-void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
+void guild_guildaura_refresh(map_session_data *sd, uint16 skill_id, uint16 skill_lv);
 #ifdef BOUND_ITEMS
 void guild_retrieveitembound(uint32 char_id,uint32 account_id,int guild_id);
 #endif

+ 17 - 17
src/map/homunculus.cpp

@@ -256,7 +256,7 @@ void hom_damage(struct homun_data *hd) {
 int hom_dead(struct homun_data *hd)
 {
 	//There's no intimacy penalties on death (from Tharis)
-	struct map_session_data *sd = hd->master;
+	map_session_data *sd = hd->master;
 
 	clif_emotion(&hd->bl, ET_KEK);
 
@@ -282,7 +282,7 @@ int hom_dead(struct homun_data *hd)
 * @param sd
 * @param flag 1: then HP needs to be 80% or above. 2: then set to morph state.
 */
-int hom_vaporize(struct map_session_data *sd, int flag)
+int hom_vaporize(map_session_data *sd, int flag)
 {
 	struct homun_data *hd;
 
@@ -324,7 +324,7 @@ int hom_vaporize(struct map_session_data *sd, int flag)
 */
 int hom_delete(struct homun_data *hd, int emote)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	nullpo_ret(hd);
 	sd = hd->master;
 
@@ -630,7 +630,7 @@ int hom_evolution(struct homun_data *hd)
 {
 	struct s_homunculus *hom;
 	struct h_stats *max, *min;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	nullpo_ret(hd);
 
 	if(!hd->homunculusDB->evo_class || hd->homunculus.class_ == hd->homunculusDB->evo_class) {
@@ -688,7 +688,7 @@ int hom_evolution(struct homun_data *hd)
 int hom_mutate(struct homun_data *hd, int homun_id)
 {
 	struct s_homunculus *hom;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	int m_class, m_id, prev_class = 0;
 	nullpo_ret(hd);
 
@@ -852,7 +852,7 @@ void hom_save(struct homun_data *hd)
 * @param sd
 * @param type
 */
-void hom_menu(struct map_session_data *sd, int type)
+void hom_menu(map_session_data *sd, int type)
 {
 	nullpo_retv(sd);
 	if (sd->hd == NULL)
@@ -878,7 +878,7 @@ void hom_menu(struct map_session_data *sd, int type)
 * @param sd
 * @param hd
 */
-int hom_food(struct map_session_data *sd, struct homun_data *hd)
+int hom_food(map_session_data *sd, struct homun_data *hd)
 {
 	int i, foodID, emotion;
 
@@ -935,7 +935,7 @@ int hom_food(struct map_session_data *sd, struct homun_data *hd)
 * Timer to reduce hunger level
 */
 static TIMER_FUNC(hom_hungry){
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct homun_data *hd;
 
 	sd = map_id2sd(id);
@@ -998,7 +998,7 @@ int hom_hungry_timer_delete(struct homun_data *hd)
 /**
 * Change homunculus name
 */
-int hom_change_name(struct map_session_data *sd,char *name)
+int hom_change_name(map_session_data *sd,char *name)
 {
 	int i;
 	struct homun_data *hd;
@@ -1024,7 +1024,7 @@ int hom_change_name(struct map_session_data *sd,char *name)
 * @param name
 * @param flag
 */
-void hom_change_name_ack(struct map_session_data *sd, char* name, int flag)
+void hom_change_name_ack(map_session_data *sd, char* name, int flag)
 {
 	struct homun_data *hd = sd->hd;
 	if (!hom_is_active(hd))
@@ -1077,7 +1077,7 @@ int hom_search(int key, int type)
 * @param sd
 * @param hom
 */
-void hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
+void hom_alloc(map_session_data *sd, struct s_homunculus *hom)
 {
 	struct homun_data *hd;
 	int i = 0;
@@ -1147,7 +1147,7 @@ void hom_init_timers(struct homun_data * hd)
  * @param sd
  * @return False:failure, True:sucess
  */
-bool hom_call(struct map_session_data *sd)
+bool hom_call(map_session_data *sd)
 {
 	struct homun_data *hd;
 
@@ -1203,7 +1203,7 @@ bool hom_call(struct map_session_data *sd)
  */
 int hom_recv_data(uint32 account_id, struct s_homunculus *sh, int flag)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct homun_data *hd;
 	bool created = false;
 
@@ -1260,7 +1260,7 @@ int hom_recv_data(uint32 account_id, struct s_homunculus *sh, int flag)
 * @param class_
 * @return True:Success; False:Failed
 */
-bool hom_create_request(struct map_session_data *sd, int class_)
+bool hom_create_request(map_session_data *sd, int class_)
 {
 	struct s_homunculus homun;
 	struct h_stats *base;
@@ -1305,7 +1305,7 @@ bool hom_create_request(struct map_session_data *sd, int class_)
  * @param y : Y map coordinate
  * @return 0:failure, 1:success
  */
-int hom_ressurect(struct map_session_data* sd, unsigned char per, short x, short y)
+int hom_ressurect(map_session_data* sd, unsigned char per, short x, short y)
 {
 	struct homun_data* hd;
 	nullpo_ret(sd);
@@ -1353,7 +1353,7 @@ int hom_ressurect(struct map_session_data* sd, unsigned char per, short x, short
 */
 void hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp)
 {
-	struct map_session_data *sd = hd->master;
+	map_session_data *sd = hd->master;
 	hd->homunculus.hp = hd->battle_status.hp;
 	if (!sd)
 		return;
@@ -1399,7 +1399,7 @@ void hom_reset_stats(struct homun_data *hd)
 */
 int hom_shuffle(struct homun_data *hd)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	int lv, i, skillpts;
 	struct s_skill b_skill[MAX_HOMUNSKILL];
 

+ 10 - 10
src/map/homunculus.hpp

@@ -77,13 +77,13 @@ struct homun_data {
 	struct unit_data  ud;
 	struct view_data *vd;
 	struct status_data base_status, battle_status;
-	struct status_change sc;
+	status_change sc;
 	struct regen_data regen;
 	struct s_homunculus_db *homunculusDB;	//[orn]
 	struct s_homunculus homunculus;	//[orn]
 
 	int masterteleport_timer;
-	struct map_session_data *master; //pointer back to its master
+	map_session_data *master; //pointer back to its master
 	int hungry_timer;	//[orn]
 	t_exp exp_next;
 	std::vector<uint16> blockskill;	// [orn]
@@ -178,20 +178,20 @@ int hom_levelup(struct homun_data *hd);
 int hom_evolution(struct homun_data *hd);
 int hom_mutate(struct homun_data *hd,int homun_id);
 void hom_heal(struct homun_data *hd);
-int hom_vaporize(struct map_session_data *sd, int flag);
-int hom_ressurect(struct map_session_data *sd, unsigned char per, short x, short y);
+int hom_vaporize(map_session_data *sd, int flag);
+int hom_ressurect(map_session_data *sd, unsigned char per, short x, short y);
 void hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp);
 void hom_reset_stats(struct homun_data *hd);
 int hom_shuffle(struct homun_data *hd); // [Zephyrus]
 void hom_save(struct homun_data *hd);
-bool hom_call(struct map_session_data *sd);
-bool hom_create_request(struct map_session_data *sd, int class_);
+bool hom_call(map_session_data *sd);
+bool hom_create_request(map_session_data *sd, int class_);
 int hom_search(int key,int type);
-void hom_menu(struct map_session_data *sd,int type);
-int hom_food(struct map_session_data *sd, struct homun_data *hd);
+void hom_menu(map_session_data *sd,int type);
+int hom_food(map_session_data *sd, struct homun_data *hd);
 int hom_hungry_timer_delete(struct homun_data *hd);
-int hom_change_name(struct map_session_data *sd,char *name);
-void hom_change_name_ack(struct map_session_data *sd, char* name, int flag);
+int hom_change_name(map_session_data *sd,char *name);
+void hom_change_name_ack(map_session_data *sd, char* name, int flag);
 #define hom_stop_walking(hd, type) unit_stop_walking(&(hd)->bl, type)
 #define hom_stop_attack(hd) unit_stop_attack(&(hd)->bl)
 int hom_increase_intimacy(struct homun_data * hd, unsigned int value);

+ 7 - 7
src/map/instance.cpp

@@ -256,7 +256,7 @@ std::shared_ptr<s_instance_db> instance_search_db_name(const char *instance_name
  * @param sd: Pointer to player data
  * @param target: Target display type
  */
-void instance_getsd(int instance_id, struct map_session_data *&sd, enum send_target *target) {
+void instance_getsd(int instance_id, map_session_data *&sd, enum send_target *target) {
 	std::shared_ptr<s_instance_data> idata = util::umap_find(instances, instance_id);
 
 	if (!idata) {
@@ -311,7 +311,7 @@ static TIMER_FUNC(instance_subscription_timer){
 	if (!idata)
 		return 0;
 
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct party_data *pd;
 	struct guild *gd;
 	struct clan *cd;
@@ -568,7 +568,7 @@ int instance_create(int owner_id, const char *name, e_instance_mode mode) {
 		return -1;
 	}
 
-	struct map_session_data *sd = nullptr;
+	map_session_data *sd = nullptr;
 	struct party_data *pd;
 	struct guild *gd;
 	struct clan* cd;
@@ -891,7 +891,7 @@ bool instance_destroy(int instance_id)
 	if (!idata)
 		return false;
 
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct party_data *pd;
 	struct guild *gd;
 	struct clan *cd;
@@ -1001,7 +1001,7 @@ bool instance_destroy(int instance_id)
  * @param y: Y coordinate
  * @return e_instance_enter value
  */
-e_instance_enter instance_enter(struct map_session_data *sd, int instance_id, const char *name, short x, short y)
+e_instance_enter instance_enter(map_session_data *sd, int instance_id, const char *name, short x, short y)
 {
 	nullpo_retr(IE_OTHER, sd);
 	
@@ -1096,7 +1096,7 @@ e_instance_enter instance_enter(struct map_session_data *sd, int instance_id, co
  * @param instance_id: Instance to request
  * @return True on success or false on failure
  */
-bool instance_reqinfo(struct map_session_data *sd, int instance_id)
+bool instance_reqinfo(map_session_data *sd, int instance_id)
 {
 	nullpo_retr(false, sd);
 
@@ -1197,7 +1197,7 @@ void do_reload_instance(void)
 
 	// Reset player to instance beginning
 	struct s_mapiterator *iter = mapit_getallusers();
-	struct map_session_data *sd;
+	map_session_data *sd;
 
 	for (sd = (TBL_PC *)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC *)mapit_next(iter)) {
 		struct map_data *mapdata = map_getmapdata(sd->bl.m);

+ 3 - 3
src/map/instance.hpp

@@ -113,13 +113,13 @@ extern InstanceDatabase instance_db;
 extern std::unordered_map<int, std::shared_ptr<s_instance_data>> instances;
 
 std::shared_ptr<s_instance_db> instance_search_db_name(const char* name);
-void instance_getsd(int instance_id, struct map_session_data *&sd, enum send_target *target);
+void instance_getsd(int instance_id, map_session_data *&sd, enum send_target *target);
 
 int instance_create(int owner_id, const char *name, e_instance_mode mode);
 bool instance_destroy(int instance_id);
 void instance_destroy_command(map_session_data *sd);
-e_instance_enter instance_enter(struct map_session_data *sd, int instance_id, const char *name, short x, short y);
-bool instance_reqinfo(struct map_session_data *sd, int instance_id);
+e_instance_enter instance_enter(map_session_data *sd, int instance_id, const char *name, short x, short y);
+bool instance_reqinfo(map_session_data *sd, int instance_id);
 bool instance_addusers(int instance_id);
 bool instance_delusers(int instance_id);
 void instance_generate_mapname(int map_id, int instance_id, char outname[MAP_NAME_LENGTH]);

+ 46 - 46
src/map/intif.cpp

@@ -69,9 +69,9 @@ int CheckForCharServer(void)
  * @param char_id
  * @return sd Found sd or NULL if not found
  */
-struct map_session_data *inter_search_sd(uint32 account_id, uint32 char_id)
+map_session_data *inter_search_sd(uint32 account_id, uint32 char_id)
 {
-	struct map_session_data *sd = NULL;
+	map_session_data *sd = NULL;
 	struct auth_node *node = chrif_auth_check(account_id, char_id, ST_LOGIN);
 	if (node)
 		sd = node->sd;
@@ -182,7 +182,7 @@ int intif_delete_petdata(int pet_id)
  * @param name
  * @return 
  */
-int intif_rename(struct map_session_data *sd, int type, char *name)
+int intif_rename(map_session_data *sd, int type, char *name)
 {
 	if (CheckForCharServer())
 		return 0;
@@ -283,7 +283,7 @@ int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fo
  * @param message : the message to sent
  * @return 
  */
-int intif_main_message(struct map_session_data* sd, const char* message)
+int intif_main_message(map_session_data* sd, const char* message)
 {
 	char output[256];
 
@@ -310,7 +310,7 @@ int intif_main_message(struct map_session_data* sd, const char* message)
  * @param mes_len : Size of message
  * @return 0=Message not send, 1=Message send
  */
-int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int mes_len)
+int intif_wis_message(map_session_data *sd, char *nick, char *mes, int mes_len)
 {
 	int headersize = 8 + 2 * NAME_LENGTH;
 
@@ -393,7 +393,7 @@ int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes)
  * @param sd : Player to save registry
  * @return 1=msg sent, -1=error
  */
-int intif_saveregistry(struct map_session_data *sd)
+int intif_saveregistry(map_session_data *sd)
 {
 	DBIterator *iter;
 	DBKey key;
@@ -521,7 +521,7 @@ int intif_saveregistry(struct map_session_data *sd)
  * @param flag : Type of registry to load, &1=acc (login-serv), &2=acc (char-serv), &4=char
  * @return 
  */
-int intif_request_registry(struct map_session_data *sd, int flag)
+int intif_request_registry(map_session_data *sd, int flag)
 {
 	nullpo_ret(sd);
 
@@ -690,7 +690,7 @@ int intif_party_leave(int party_id, uint32 account_id, uint32 char_id, const cha
  * @param online : If the player will stay online or no
  * @return 0=error, 1=msg sent
  */
-int intif_party_changemap(struct map_session_data *sd,int online)
+int intif_party_changemap(map_session_data *sd,int online)
 {
 	int16 m, mapindex;
 
@@ -1280,7 +1280,7 @@ int intif_homunculus_requestdelete(int homun_id)
  */
 int intif_parse_WisMessage(int fd)
 {
-	struct map_session_data* sd;
+	map_session_data* sd;
 	char *wisp_source;
 	char name[NAME_LENGTH];
 	int id, i, gmlvl;
@@ -1323,11 +1323,11 @@ int intif_parse_WisMessage(int fd)
  */
 int intif_parse_WisEnd(int fd)
 {
-	struct map_session_data* sd;
+	map_session_data* sd;
 
 	if (battle_config.etc_log)
 		ShowInfo("intif_parse_wisend: player: %s, flag: %d\n", RFIFOP(fd,2), RFIFOB(fd,26)); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
-	sd = (struct map_session_data *)map_nick2sd(RFIFOCP(fd,2),false);
+	sd = (map_session_data *)map_nick2sd(RFIFOCP(fd,2),false);
 	if (sd != NULL)
 		clif_wis_end(sd->fd, RFIFOB(fd,26));
 
@@ -1340,7 +1340,7 @@ int intif_parse_WisEnd(int fd)
  * @param va : list of arguments ( wisp_name, message, len)
  * @return 0=error, 1=msg sent
  */
-static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va)
+static int mapif_parse_WisToGM_sub(map_session_data* sd,va_list va)
 {
 	e_pc_permission permission = static_cast<e_pc_permission>(va_arg(va, uint32));
 	char *wisp_name;
@@ -1390,7 +1390,7 @@ int mapif_parse_WisToGM(int fd)
 void intif_parse_Registers(int fd)
 {
 	int flag;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	uint32 account_id = RFIFOL(fd,4), char_id = RFIFOL(fd,8);
 	struct auth_node *node = chrif_auth_check(account_id, char_id, ST_LOGIN);
 	char type = RFIFOB(fd, 13);
@@ -1489,7 +1489,7 @@ void intif_parse_Registers(int fd)
 int intif_parse_LoadGuildStorage(int fd)
 {
 	struct s_storage *gstor;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	int guild_id, flag;
 
 	guild_id = RFIFOL(fd,8);
@@ -1942,7 +1942,7 @@ int intif_parse_DeletePetOk(int fd)
  */
 int intif_parse_ChangeNameOk(int fd)
 {
-	struct map_session_data *sd = NULL;
+	map_session_data *sd = NULL;
 	if((sd=map_id2sd(RFIFOL(fd,2)))==NULL ||
 		sd->status.char_id != RFIFOL(fd,6))
 		return 0;
@@ -2037,7 +2037,7 @@ QUESTLOG SYSTEM FUNCTIONS
  * Requests a character's quest log entries to the inter server.
  * @param sd Character's data
  */
-void intif_request_questlog(struct map_session_data *sd)
+void intif_request_questlog(map_session_data *sd)
 {
 	if (CheckForCharServer())
 		return;
@@ -2120,7 +2120,7 @@ void intif_parse_questsave(int fd)
  * @param sd Character's data
  * @return 0 in case of success, nonzero otherwise
  */
-int intif_quest_save(struct map_session_data *sd)
+int intif_quest_save(map_session_data *sd)
 {
 	int len = sizeof(struct quest) * sd->num_quests + 8;
 
@@ -2164,7 +2164,7 @@ void intif_request_achievements(uint32 char_id)
 void intif_parse_achievements(int fd)
 {
 	uint32 char_id = RFIFOL(fd, 4), num_received = (RFIFOW(fd, 2) - 8) / sizeof(struct achievement);
-	struct map_session_data *sd = map_charid2sd(char_id);
+	map_session_data *sd = map_charid2sd(char_id);
 
 	if (!sd) // User not online anymore
 		return;
@@ -2229,7 +2229,7 @@ void intif_parse_achievements(int fd)
 void intif_parse_achievementsave(int fd)
 {
 	int cid = RFIFOL(fd, 2);
-	struct map_session_data *sd = map_charid2sd(cid);
+	map_session_data *sd = map_charid2sd(cid);
 
 	if (!sd) // User not online anymore
 		return;
@@ -2243,7 +2243,7 @@ void intif_parse_achievementsave(int fd)
  * @param sd: Character's data
  * @return 0 in case of success, nonzero otherwise
  */
-int intif_achievement_save(struct map_session_data *sd)
+int intif_achievement_save(map_session_data *sd)
 {
 	int len = sizeof(struct achievement) * sd->achievement_data.count + 8;
 
@@ -2269,7 +2269,7 @@ int intif_achievement_save(struct map_session_data *sd)
  * @param fd : char-serv link
  */
 void intif_parse_achievementreward(int fd){
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 
 	// User not online anymore
 	if( !sd ){
@@ -2282,7 +2282,7 @@ void intif_parse_achievementreward(int fd){
 /**
  * Request the achievement rewards from the inter server.
  */
-int intif_achievement_reward(struct map_session_data *sd, struct s_achievement_db *adb){
+int intif_achievement_reward(map_session_data *sd, struct s_achievement_db *adb){
 	if( CheckForCharServer() ){
 		return 0;
 	}
@@ -2334,7 +2334,7 @@ int intif_Mail_requestinbox(uint32 char_id, unsigned char flag, enum mail_inbox_
  */
 int intif_parse_Mail_inboxreceived(int fd)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	unsigned char flag = RFIFOB(fd,8);
 
 	sd = map_charid2sd(RFIFOL(fd,4));
@@ -2396,7 +2396,7 @@ int intif_Mail_read(int mail_id)
  * @param mail_id : Mail identification
  * @return 0=error, 1=msg sent
  */
-bool intif_mail_getattach( struct map_session_data* sd, struct mail_message *msg, enum mail_attachment_type type){
+bool intif_mail_getattach( map_session_data* sd, struct mail_message *msg, enum mail_attachment_type type){
 	if (CheckForCharServer())
 		return false;
 
@@ -2417,7 +2417,7 @@ bool intif_mail_getattach( struct map_session_data* sd, struct mail_message *msg
  */
 int intif_parse_Mail_getattach(int fd)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct item item[MAIL_MAX_ITEM];
 	int i, mail_id, zeny;
 
@@ -2480,7 +2480,7 @@ int intif_parse_Mail_delete(int fd)
 	int mail_id = RFIFOL(fd,6);
 	bool failed = RFIFOB(fd,10) > 0;
 
-	struct map_session_data *sd = map_charid2sd(char_id);
+	map_session_data *sd = map_charid2sd(char_id);
 	if (sd == NULL)
 	{
 		ShowError("intif_parse_Mail_delete: char not found %d\n", char_id);
@@ -2537,7 +2537,7 @@ int intif_Mail_return(uint32 char_id, int mail_id)
  */
 int intif_parse_Mail_return(int fd)
 {
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	int mail_id = RFIFOL(fd,6);
 	short fail = RFIFOB(fd,10);
 
@@ -2600,7 +2600,7 @@ int intif_Mail_send(uint32 account_id, struct mail_message *msg)
 static void intif_parse_Mail_send(int fd)
 {
 	struct mail_message msg;
-	struct map_session_data *sd;
+	map_session_data *sd;
 	bool fail;
 
 	if( RFIFOW(fd,2) - 4 != sizeof(struct mail_message) )
@@ -2633,7 +2633,7 @@ static void intif_parse_Mail_send(int fd)
  */
 static void intif_parse_Mail_new(int fd)
 {
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	int mail_id = RFIFOL(fd,6);
 	const char* sender_name = RFIFOCP(fd,10);
 	const char* title = RFIFOCP(fd,34);
@@ -2650,7 +2650,7 @@ static void intif_parse_Mail_new(int fd)
 }
 
 static void intif_parse_Mail_receiver( int fd ){
-	struct map_session_data *sd;
+	map_session_data *sd;
 
 	sd = map_charid2sd( RFIFOL( fd, 2 ) );
 
@@ -2660,8 +2660,8 @@ static void intif_parse_Mail_receiver( int fd ){
 	}
 }
 
-bool intif_mail_checkreceiver( struct map_session_data* sd, char* name ){
-	struct map_session_data *tsd;
+bool intif_mail_checkreceiver( map_session_data* sd, char* name ){
+	map_session_data *tsd;
 
 	tsd = map_nick2sd( name, false );
 
@@ -2723,7 +2723,7 @@ int intif_Auction_requestlist(uint32 char_id, short type, int price, const char*
  */
 static void intif_parse_Auction_results(int fd)
 {
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,4));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,4));
 	short count = RFIFOW(fd,8);
 	short pages = RFIFOW(fd,10);
 	uint8* data = RFIFOP(fd,12);
@@ -2761,7 +2761,7 @@ int intif_Auction_register(struct auction_data *auction)
  */
 static void intif_parse_Auction_register(int fd)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	struct auction_data auction;
 
 	if( RFIFOW(fd,2) - 4 != sizeof(struct auction_data) )
@@ -2817,7 +2817,7 @@ int intif_Auction_cancel(uint32 char_id, unsigned int auction_id)
  */
 static void intif_parse_Auction_cancel(int fd)
 {
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	int result = RFIFOB(fd,6);
 
 	if( sd == NULL )
@@ -2858,7 +2858,7 @@ int intif_Auction_close(uint32 char_id, unsigned int auction_id)
  */
 static void intif_parse_Auction_close(int fd)
 {
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	unsigned char result = RFIFOB(fd,6);
 
 	if( sd == NULL )
@@ -2907,7 +2907,7 @@ int intif_Auction_bid(uint32 char_id, const char* name, unsigned int auction_id,
  */
 static void intif_parse_Auction_bid(int fd)
 {
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	int bid = RFIFOL(fd,6);
 	unsigned char result = RFIFOB(fd,10);
 
@@ -2932,7 +2932,7 @@ static void intif_parse_Auction_bid(int fd)
  */
 static void intif_parse_Auction_message(int fd)
 {
-	struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+	map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
 	unsigned char result = RFIFOB(fd,6);
 
 	if( sd == NULL )
@@ -3239,7 +3239,7 @@ void intif_parse_MessageToFD(int fd) {
 
 	if( session[u_fd] && session[u_fd]->session_data ) { //check if the player still online
 		int aid = RFIFOL(fd,8);
-		struct map_session_data * sd = (struct map_session_data *)session[u_fd]->session_data;
+		map_session_data * sd = (map_session_data *)session[u_fd]->session_data;
 		/* matching e.g. previous fd owner didn't dc during request or is still the same */
 		if( sd->bl.id == aid ) {
 			char msg[512];
@@ -3263,7 +3263,7 @@ void intif_parse_MessageToFD(int fd) {
  * @param type Obtain type @see enum BROADCASTING_SPECIAL_ITEM_OBTAIN
  * @return
  **/
-int intif_broadcast_obtain_special_item(struct map_session_data *sd, t_itemid nameid, t_itemid sourceid, unsigned char type) {
+int intif_broadcast_obtain_special_item(map_session_data *sd, t_itemid nameid, t_itemid sourceid, unsigned char type) {
 	nullpo_retr(0, sd);
 
 	// Should not be here!
@@ -3302,7 +3302,7 @@ int intif_broadcast_obtain_special_item(struct map_session_data *sd, t_itemid na
  * @param srcname Source name
  * @return
  **/
-int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, t_itemid nameid) {
+int intif_broadcast_obtain_special_item_npc(map_session_data *sd, t_itemid nameid) {
 	nullpo_retr(0, sd);
 
 	// Send local
@@ -3424,7 +3424,7 @@ static bool intif_parse_StorageReceived(int fd)
 {
 	char type =  RFIFOB(fd,4);
 	uint32 account_id = RFIFOL(fd, 5);
-	struct map_session_data *sd = map_id2sd(account_id);
+	map_session_data *sd = map_id2sd(account_id);
 	struct s_storage *stor, *p; //storage
 	size_t sz_stor = sizeof(struct s_storage);
 
@@ -3547,7 +3547,7 @@ static void intif_parse_StorageSaved(int fd)
 				break;
 			case TABLE_STORAGE: //storage
 				{
-					struct map_session_data *sd = map_id2sd( RFIFOL( fd, 2 ) );
+					map_session_data *sd = map_id2sd( RFIFOL( fd, 2 ) );
 					struct s_storage* stor = nullptr;
 
 					if( RFIFOB( fd, 8 ) ){
@@ -3572,7 +3572,7 @@ static void intif_parse_StorageSaved(int fd)
 			case TABLE_CART: // cart
 				//ShowInfo("Cart has been saved (AID: %d).\n", RFIFOL(fd, 2));
 				{
-					struct map_session_data *sd = map_id2sd(RFIFOL(fd, 2));
+					map_session_data *sd = map_id2sd(RFIFOL(fd, 2));
 
 					if( sd && sd->state.prevend ){
 						intif_storage_request(sd,TABLE_CART,0,STOR_MODE_ALL);
@@ -3620,7 +3620,7 @@ void intif_parse_StorageInfo_recv(int fd) {
  * @param mode: Storage mode
  * @return false - error, true - message sent
  */
-bool intif_storage_request(struct map_session_data *sd, enum storage_type type, uint8 stor_id, uint8 mode)
+bool intif_storage_request(map_session_data *sd, enum storage_type type, uint8 stor_id, uint8 mode)
 {
 	if (CheckForCharServer())
 		return false;
@@ -3643,7 +3643,7 @@ bool intif_storage_request(struct map_session_data *sd, enum storage_type type,
  * @param stor: Storage data
  * @ return false - error, true - message sent
  */
-bool intif_storage_save(struct map_session_data *sd, struct s_storage *stor)
+bool intif_storage_save(map_session_data *sd, struct s_storage *stor)
 {
 	int stor_size = sizeof(struct s_storage);
 

+ 17 - 17
src/map/intif.hpp

@@ -19,21 +19,21 @@ struct s_elemental;
 struct mail_message;
 struct auction_data;
 struct s_achievement_db;
-struct map_session_data;
+class map_session_data;
 
 int intif_parse(int fd);
 
 int intif_broadcast(const char* mes, int len, int type);
 int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY);
-int intif_broadcast_obtain_special_item(struct map_session_data *sd, t_itemid nameid, unsigned int sourceid, unsigned char type);
-int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, t_itemid nameid);
-int intif_main_message(struct map_session_data* sd, const char* message);
+int intif_broadcast_obtain_special_item(map_session_data *sd, t_itemid nameid, unsigned int sourceid, unsigned char type);
+int intif_broadcast_obtain_special_item_npc(map_session_data *sd, t_itemid nameid);
+int intif_main_message(map_session_data* sd, const char* message);
 
-int intif_wis_message(struct map_session_data *sd,char *nick,char *mes,int mes_len);
+int intif_wis_message(map_session_data *sd,char *nick,char *mes,int mes_len);
 int intif_wis_message_to_gm(char *Wisp_name, int permission, char *mes);
 
-int intif_saveregistry(struct map_session_data *sd);
-int intif_request_registry(struct map_session_data *sd, int flag);
+int intif_saveregistry(map_session_data *sd);
+int intif_request_registry(map_session_data *sd, int flag);
 
 bool intif_request_guild_storage(uint32 account_id, int guild_id);
 bool intif_send_guild_storage(uint32 account_id, struct s_storage *gstor);
@@ -44,7 +44,7 @@ int intif_request_partyinfo(int party_id, uint32 char_id);
 int intif_party_addmember(int party_id,struct party_member *member);
 int intif_party_changeoption(int party_id, uint32 account_id, int exp, int item);
 int intif_party_leave(int party_id, uint32 account_id, uint32 char_id, const char *name, enum e_party_member_withdraw type);
-int intif_party_changemap(struct map_session_data *sd, int online);
+int intif_party_changemap(map_session_data *sd, int online);
 int intif_break_party(int party_id);
 int intif_party_message(int party_id, uint32 account_id, const char *mes,int len);
 int intif_party_leaderchange(int party_id,uint32 account_id,uint32 char_id);
@@ -76,7 +76,7 @@ int intif_create_pet(uint32 account_id, uint32 char_id, short pet_type, short pe
 int intif_request_petdata(uint32 account_id, uint32 char_id, int pet_id);
 int intif_save_petdata(uint32 account_id, struct s_pet *p);
 int intif_delete_petdata(int pet_id);
-int intif_rename(struct map_session_data *sd, int type, char *name);
+int intif_rename(map_session_data *sd, int type, char *name);
 #define intif_rename_pc(sd, name) intif_rename(sd, 0, name)
 #define intif_rename_pet(sd, name) intif_rename(sd, 1, name)
 #define intif_rename_hom(sd, name) intif_rename(sd, 2, name)
@@ -86,8 +86,8 @@ int intif_homunculus_requestsave(uint32 account_id, struct s_homunculus* sh);
 int intif_homunculus_requestdelete(int homun_id);
 
 /******QUEST SYTEM*******/
-void intif_request_questlog(struct map_session_data * sd);
-int intif_quest_save(struct map_session_data * sd);
+void intif_request_questlog(map_session_data * sd);
+int intif_quest_save(map_session_data * sd);
 
 // MERCENARY SYSTEM
 int intif_mercenary_create(struct s_mercenary *merc);
@@ -98,11 +98,11 @@ int intif_mercenary_save(struct s_mercenary *merc);
 // MAIL SYSTEM
 int intif_Mail_requestinbox(uint32 char_id, unsigned char flag, enum mail_inbox_type type);
 int intif_Mail_read(int mail_id);
-bool intif_mail_getattach( struct map_session_data* sd, struct mail_message *msg, enum mail_attachment_type type );
+bool intif_mail_getattach( map_session_data* sd, struct mail_message *msg, enum mail_attachment_type type );
 int intif_Mail_delete(uint32 char_id, int mail_id);
 int intif_Mail_return(uint32 char_id, int mail_id);
 int intif_Mail_send(uint32 account_id, struct mail_message *msg);
-bool intif_mail_checkreceiver(struct map_session_data* sd, char* name);
+bool intif_mail_checkreceiver(map_session_data* sd, char* name);
 // AUCTION SYSTEM
 int intif_Auction_requestlist(uint32 char_id, short type, int price, const char* searchtext, short page);
 int intif_Auction_register(struct auction_data *auction);
@@ -121,14 +121,14 @@ int intif_clan_member_joined( int clan_id );
 int intif_clan_member_left( int clan_id );
 // ACHIEVEMENT SYSTEM
 void intif_request_achievements(uint32 char_id);
-int intif_achievement_save(struct map_session_data *sd);
-int intif_achievement_reward(struct map_session_data *sd, struct s_achievement_db *adb);
+int intif_achievement_save(map_session_data *sd);
+int intif_achievement_reward(map_session_data *sd, struct s_achievement_db *adb);
 
 int intif_request_accinfo(int u_fd, int aid, int group_lv, char* query, char type);
 
 // STORAGE
-bool intif_storage_request(struct map_session_data *sd, enum storage_type type, uint8 stor_id, uint8 mode);
-bool intif_storage_save(struct map_session_data *sd, struct s_storage *stor);
+bool intif_storage_request(map_session_data *sd, enum storage_type type, uint8 stor_id, uint8 mode);
+bool intif_storage_save(map_session_data *sd, struct s_storage *stor);
 
 int CheckForCharServer(void);
 

+ 32 - 2
src/map/itemdb.cpp

@@ -4380,6 +4380,36 @@ void s_random_opt_group::apply( struct item& item ){
 			}
 		}
 	}
+
+	// Fix any gaps, the client cannot handle this
+	for( size_t i = 0; i < MAX_ITEM_RDM_OPT; i++ ){
+		// If an option is empty
+		if( item.option[i].id == 0 ){
+			// Check if any other options, after the empty option exist
+			size_t j;
+			for( j = i + 1; j < MAX_ITEM_RDM_OPT; j++ ){
+				if( item.option[j].id != 0 ){
+					break;
+				}
+			}
+
+			// Another option was found, after the empty option
+			if( j < MAX_ITEM_RDM_OPT ){
+				// Move the later option forward
+				item.option[i].id = item.option[j].id;
+				item.option[i].value = item.option[j].value;
+				item.option[i].param = item.option[j].param;
+
+				// Reset the option that was moved
+				item.option[j].id = 0;
+				item.option[j].value = 0;
+				item.option[j].param = 0;
+			}else{
+				// Cancel early
+				break;
+			}
+		}
+	}
 }
 
 /**
@@ -4629,7 +4659,7 @@ void itemdb_gen_itemmoveinfo()
 */
 void itemdb_reload(void) {
 	struct s_mapiterator* iter;
-	struct map_session_data* sd;
+	map_session_data* sd;
 
 	do_final_itemdb();
 
@@ -4641,7 +4671,7 @@ void itemdb_reload(void) {
 
 	// readjust itemdb pointer cache for each player
 	iter = mapit_geteachpc();
-	for( sd = (struct map_session_data*)mapit_first(iter); mapit_exists(iter); sd = (struct map_session_data*)mapit_next(iter) ) {
+	for( sd = (map_session_data*)mapit_first(iter); mapit_exists(iter); sd = (map_session_data*)mapit_next(iter) ) {
 		memset(sd->item_delay, 0, sizeof(sd->item_delay));  // reset item delays
 		sd->combos.clear(); // clear combo bonuses
 		pc_setinventorydata(sd);

+ 99 - 13
src/map/itemdb.hpp

@@ -51,8 +51,6 @@ enum item_itemid : t_itemid
 	ITEMID_RED_SLIM_POTION				= 545,
 	ITEMID_YELLOW_SLIM_POTION			= 546,
 	ITEMID_WHITE_SLIM_POTION			= 547,
-	ITEMID_WING_OF_FLY					= 601,
-	ITEMID_WING_OF_BUTTERFLY			= 602,
 	ITEMID_ANODYNE						= 605,
 	ITEMID_ALOEBERA						= 606,
 	ITEMID_MAGNIFIER					= 611,
@@ -101,28 +99,17 @@ enum item_itemid : t_itemid
 	ITEMID_COOKIE_BAT					= 11605,
 	ITEMID_MERCENARY_RED_POTION			= 12184,
 	ITEMID_MERCENARY_BLUE_POTION		= 12185,
-	ITEMID_GIANT_FLY_WING				= 12212,
 	ITEMID_NEURALIZER					= 12213,
 	ITEMID_M_CENTER_POTION				= 12241,
 	ITEMID_M_AWAKENING_POTION			= 12242,
 	ITEMID_M_BERSERK_POTION				= 12243,
-	ITEMID_N_FLY_WING					= 12323,
-	ITEMID_N_BUTTERFLY_WING				= 12324,
 	ITEMID_NOVICE_MAGNIFIER				= 12325,
 	ITEMID_ANCILLA						= 12333,
-	ITEMID_DUN_TELE_SCROLL3				= 12352,
 	ITEMID_REINS_OF_MOUNT				= 12622,
 	ITEMID_NOBLE_NAMEPLATE				= 12705,
 	ITEMID_SILVER_BULLET				= 13201,
 	ITEMID_PURIFICATION_BULLET			= 13220,
 	ITEMID_SILVER_BULLET_				= 13221,
-	ITEMID_DUN_TELE_SCROLL1				= 14527,
-	ITEMID_DUN_TELE_SCROLL2				= 14581,
-	ITEMID_WOB_RUNE						= 14582,
-	ITEMID_WOB_SCHWALTZ					= 14583,
-	ITEMID_WOB_RACHEL					= 14584,
-	ITEMID_WOB_LOCAL					= 14585,
-	ITEMID_SIEGE_TELEPORT_SCROLL		= 14591,
 	ITEMID_INVENTORY_EX_EVT				= 25791,
 	ITEMID_INVENTORY_EX_DIS				= 25792,
 	ITEMID_INVENTORY_EX					= 25793,
@@ -1740,6 +1727,105 @@ enum e_random_item_group {
 	IG_COSTUMEMILEAGE_PACKAGE3,
 	IG_COMP_TRANS_SCROLL,
 	IG_MINUS_STATUS_BOX,
+	IG_S_W_BREATH_CUBE,
+	IG_S_F_BREATH_CUBE,
+	IG_S_SONIC_CUBE,
+	IG_S_STRAIN_CUBE,
+	IG_S_JACK_CUBE,
+	IG_S_CHAIN_CUBE,
+	IG_S_CRIMSON_CUBE,
+	IG_S_VULCAN_CUBE,
+	IG_S_BOOMERANG_CUBE,
+	IG_S_ARMS_CUBE,
+	IG_S_TORNADO_CUBE,
+	IG_S_DUPLELIGHT_CUBE,
+	IG_S_MAGNUS_CUBE,
+	IG_S_ADORAMUS_CUBE,
+	IG_S_JUDEX_CUBE,
+	IG_S_ROLLING_CUBE,
+	IG_S_RIPPER_CUBE,
+	IG_S_SLASH_CUBE,
+	IG_S_KATAR_CUBE,
+	IG_S_SHOOTING_CUBE,
+	IG_S_ARROW_CUBE,
+	IG_S_AIMED_CUBE,
+	IG_S_CLUSTER_CUBE,
+	IG_S_BANISH_CANNON_CUBE,
+	IG_S_BRAND_CUBE,
+	IG_S_GENESIS_CUBE,
+	IG_S_CHAIN_PRESS_CUBE,
+	IG_S_GRAVE_CUBE,
+	IG_S_DUST_CUBE,
+	IG_S_VARETYR_CUBE,
+	IG_S_PSYCHIC_CUBE,
+	IG_S_SPORE_BOMB_CUBE,
+	IG_S_CANNON_CART_CUBE,
+	IG_S_CRAZY_CUBE,
+	IG_S_CART_TORNADO_CUBE,
+	IG_S_KNUCKLEARROW_CUBE,
+	IG_S_SKYNETBLOW_CUBE,
+	IG_S_RAMPAGE_CUBE,
+	IG_S_TIGERCANNON_CUBE,
+	IG_S_MENACE_CUBE,
+	IG_S_SHADOWSPELL_CUBE,
+	IG_S_TRIANGLE_CUBE,
+	IG_S_PAINT_CUBE,
+	IG_S_RAINSTORM_CUBE,
+	IG_S_METALIC_CUBE,
+	IG_S_ARROWVULCAN_CUBE,
+	IG_S_REVERBERATION_CUBE,
+	IG_S_MOONLIGHT_CUBE,
+	IG_S_SUNSHINE_CUBE,
+	IG_S_STARDUST_CUBE,
+	IG_S_S_CUBE,
+	IG_S_EVILCURSE_CUBE,
+	IG_S_SYURIKEN_CUBE,
+	IG_S_KUNAI_CUBE,
+	IG_S_HUUSOUKA_CUBE,
+	IG_S_KAMAENRAKU_CUBE,
+	IG_S_GOD_HAMMER_CUBE,
+	IG_S_SHATTER_BUSTER_CUBE,
+	IG_S_TAIL_DRAGON_CUBE,
+	IG_S_TRIP_CUBE,
+	IG_S_FLARE_DANCE_CUBE,
+	IG_S_SUPER_MAGIC_CUBE,
+	IG_S_SUPER_POWER_CUBE,
+	IG_S_SILVERVINE_CUBE,
+	IG_S_CATNIP_CUBE,
+	IG_S_SAVAGERABBIT_CUBE,
+	IG_S_PICKYRUSH_CUBE,
+	IG_S_RUNEKNIGHT_CUBE,
+	IG_S_ROYALGUARD_CUBE,
+	IG_S_WARLOCK_CUBE,
+	IG_S_SORCERER_CUBE,
+	IG_S_MECHANIC_CUBE,
+	IG_S_GENERIC_CUBE,
+	IG_S_ARCHBISHOP_CUBE,
+	IG_S_SURA_CUBE,
+	IG_S_GUILLOTINECROSS_CUBE,
+	IG_S_SHADOWCHASER_CUBE,
+	IG_S_RANGER_CUBE,
+	IG_S_WANDERER_CUBE,
+	IG_S_MINSTREL_CUBE,
+	IG_S_STAR_EMPEROR_CUBE,
+	IG_S_SOUL_REAPER_CUBE,
+	IG_S_KAGEROU_CUBE,
+	IG_S_OBORO_CUBE,
+	IG_S_REBELLION_CUBE,
+	IG_S_SUPERNOVICE_CUBE,
+	IG_S_DORAM_CUBE,
+	IG_S_MAMMOTH_CUBE,
+	IG_S_GEMSTONE_CUBE,
+	IG_S_PENE1_CUBE,
+	IG_S_PENE2_CUBE,
+	IG_S_TEMP1_CUBE,
+	IG_S_TEMP2_CUBE,
+	IG_BLACKSMITH_BLESS_BOX_3,
+	IG_SHADOW_HAMMER_BOX_3,
+	IG_EDP,
+	IG_MF_NOTELEPORT,
+	IG_MF_NORETURN,
+	IG_GIANT_FLY_WING,
 
 	IG_MAX,
 };

+ 8 - 8
src/map/log.cpp

@@ -170,7 +170,7 @@ static bool should_log_item(t_itemid nameid, int amount, int refine)
 
 
 /// logs items, that summon monsters
-void log_branch(struct map_session_data* sd)
+void log_branch(map_session_data* sd)
 {
 	nullpo_retv(sd);
 
@@ -263,7 +263,7 @@ void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* it
 }
 
 /// logs item transactions (players)
-void log_pick_pc(struct map_session_data* sd, e_log_pick_type type, int amount, struct item* itm)
+void log_pick_pc(map_session_data* sd, e_log_pick_type type, int amount, struct item* itm)
 {
 	nullpo_retv(sd);
 	log_pick(sd->status.char_id, sd->bl.m, type, amount, itm);
@@ -278,7 +278,7 @@ void log_pick_mob(struct mob_data* md, e_log_pick_type type, int amount, struct
 }
 
 /// logs zeny transactions
-void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_session_data* src_sd, int amount)
+void log_zeny(map_session_data* sd, e_log_pick_type type, map_session_data* src_sd, int amount)
 {
 	nullpo_retv(sd);
 
@@ -311,7 +311,7 @@ void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_sess
 
 
 /// logs MVP monster rewards
-void log_mvpdrop(struct map_session_data* sd, int monster_id, t_itemid nameid, t_exp exp )
+void log_mvpdrop(map_session_data* sd, int monster_id, t_itemid nameid, t_exp exp )
 {
 	nullpo_retv(sd);
 
@@ -344,7 +344,7 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, t_itemid nameid, t
 
 
 /// logs used atcommands
-void log_atcommand(struct map_session_data* sd, const char* message)
+void log_atcommand(map_session_data* sd, const char* message)
 {
 	nullpo_retv(sd);
 
@@ -421,7 +421,7 @@ void log_npc( struct npc_data* nd, const char* message ){
 }
 
 /// logs messages passed to script command 'logmes'
-void log_npc(struct map_session_data* sd, const char* message)
+void log_npc(map_session_data* sd, const char* message)
 {
 	nullpo_retv(sd);
 
@@ -507,7 +507,7 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
 }
 
 /// logs cash transactions
-void log_cash( struct map_session_data* sd, e_log_pick_type type, e_log_cash_type cash_type, int amount ){
+void log_cash( map_session_data* sd, e_log_pick_type type, e_log_cash_type cash_type, int amount ){
 	nullpo_retv( sd );
 
 	if( !log_config.cash )
@@ -540,7 +540,7 @@ void log_cash( struct map_session_data* sd, e_log_pick_type type, e_log_cash_typ
  * @param type Log type, @see e_log_feeding_type
  * @param nameid Item used as food
  **/
-void log_feeding(struct map_session_data *sd, e_log_feeding_type type, t_itemid nameid) {
+void log_feeding(map_session_data *sd, e_log_feeding_type type, t_itemid nameid) {
 	unsigned int target_id = 0, intimacy = 0;
 	unsigned short target_class = 0;
 

+ 9 - 9
src/map/log.hpp

@@ -8,7 +8,7 @@
 #include "../common/mmo.hpp"
 
 struct block_list;
-struct map_session_data;
+class map_session_data;
 struct mob_data;
 struct item;
 
@@ -76,19 +76,19 @@ enum e_log_feeding_type : uint8
 };
 
 /// new logs
-void log_pick_pc(struct map_session_data* sd, e_log_pick_type type, int amount, struct item* itm);
+void log_pick_pc(map_session_data* sd, e_log_pick_type type, int amount, struct item* itm);
 void log_pick_mob(struct mob_data* md, e_log_pick_type type, int amount, struct item* itm);
-void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_session_data* src_sd, int amount);
-void log_cash( struct map_session_data* sd, e_log_pick_type type, e_log_cash_type cash_type, int amount );
+void log_zeny(map_session_data* sd, e_log_pick_type type, map_session_data* src_sd, int amount);
+void log_cash( map_session_data* sd, e_log_pick_type type, e_log_cash_type cash_type, int amount );
 void log_npc( struct npc_data* nd, const char* message );
-void log_npc(struct map_session_data* sd, const char *message);
+void log_npc(map_session_data* sd, const char *message);
 void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message);
-void log_atcommand(struct map_session_data* sd, const char* message);
-void log_feeding(struct map_session_data *sd, e_log_feeding_type type, t_itemid nameid);
+void log_atcommand(map_session_data* sd, const char* message);
+void log_feeding(map_session_data *sd, e_log_feeding_type type, t_itemid nameid);
 
 /// old, but useful logs
-void log_branch(struct map_session_data* sd);
-void log_mvpdrop(struct map_session_data* sd, int monster_id, t_itemid nameid, t_exp exp);
+void log_branch(map_session_data* sd);
+void log_mvpdrop(map_session_data* sd, int monster_id, t_itemid nameid, t_exp exp);
 
 int log_config_read(const char* cfgName);
 

+ 11 - 11
src/map/mail.cpp

@@ -18,7 +18,7 @@
 #include "pc.hpp"
 #include "pet.hpp"
 
-void mail_clear(struct map_session_data *sd)
+void mail_clear(map_session_data *sd)
 {
 	int i;
 
@@ -32,7 +32,7 @@ void mail_clear(struct map_session_data *sd)
 	return;
 }
 
-int mail_removeitem(struct map_session_data *sd, short flag, int idx, int amount)
+int mail_removeitem(map_session_data *sd, short flag, int idx, int amount)
 {
 	int i;
 
@@ -99,7 +99,7 @@ int mail_removeitem(struct map_session_data *sd, short flag, int idx, int amount
 	return 1;
 }
 
-bool mail_removezeny( struct map_session_data *sd, bool flag ){
+bool mail_removezeny( map_session_data *sd, bool flag ){
 	nullpo_retr( false, sd );
 
 	if( sd->mail.zeny > 0 ){
@@ -126,7 +126,7 @@ bool mail_removezeny( struct map_session_data *sd, bool flag ){
 * @param amount : amout of zeny or number of item
 * @return see enum mail_attach_result in mail.hpp
 */
-enum mail_attach_result mail_setitem(struct map_session_data *sd, short idx, uint32 amount) {
+enum mail_attach_result mail_setitem(map_session_data *sd, short idx, uint32 amount) {
 	if( pc_istrading(sd) )
 		return MAIL_ATTACH_ERROR;
 
@@ -241,7 +241,7 @@ enum mail_attach_result mail_setitem(struct map_session_data *sd, short idx, uin
 	}
 }
 
-bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg)
+bool mail_setattachment(map_session_data *sd, struct mail_message *msg)
 {
 	int i, amount;
 
@@ -290,7 +290,7 @@ bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg)
 	return true;
 }
 
-void mail_getattachment(struct map_session_data* sd, struct mail_message* msg, int zeny, struct item* item){
+void mail_getattachment(map_session_data* sd, struct mail_message* msg, int zeny, struct item* item){
 	int i;
 	bool item_received = false;
 
@@ -360,7 +360,7 @@ void mail_getattachment(struct map_session_data* sd, struct mail_message* msg, i
 	}
 }
 
-int mail_openmail(struct map_session_data *sd)
+int mail_openmail(map_session_data *sd)
 {
 	nullpo_ret(sd);
 
@@ -372,7 +372,7 @@ int mail_openmail(struct map_session_data *sd)
 	return 1;
 }
 
-void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg){
+void mail_deliveryfail(map_session_data *sd, struct mail_message *msg){
 	int i, zeny = 0;
 
 	nullpo_retv(sd);
@@ -394,7 +394,7 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg){
 }
 
 // This function only check if the mail operations are valid
-bool mail_invalid_operation(struct map_session_data *sd)
+bool mail_invalid_operation(map_session_data *sd)
 {
 #if PACKETVER < 20150513
 	if( !map_getmapflag(sd->bl.m, MF_TOWN) && !pc_can_use_command(sd, "mail", COMMAND_ATCOMMAND) )
@@ -420,7 +420,7 @@ bool mail_invalid_operation(struct map_session_data *sd)
 * @param body_msg Mail message
 * @param body_len Message's length
 */
-void mail_send(struct map_session_data *sd, const char *dest_name, const char *title, const char *body_msg, int body_len) {
+void mail_send(map_session_data *sd, const char *dest_name, const char *title, const char *body_msg, int body_len) {
 	struct mail_message msg;
 
 	nullpo_retv(sd);
@@ -484,7 +484,7 @@ void mail_send(struct map_session_data *sd, const char *dest_name, const char *t
 	sd->cansendmail_tick = gettick() + battle_config.mail_delay; // Flood Protection
 }
 
-void mail_refresh_remaining_amount( struct map_session_data* sd ){
+void mail_refresh_remaining_amount( map_session_data* sd ){
 	int doy = date_get_dayofyear();
 
 	nullpo_retv(sd);

+ 11 - 11
src/map/mail.hpp

@@ -24,16 +24,16 @@ enum mail_attach_result {
 	MAIL_ATTACH_EQUIPSWITCH = 99,
 };
 
-void mail_clear(struct map_session_data *sd);
-int mail_removeitem(struct map_session_data *sd, short flag, int idx, int amount);
-bool mail_removezeny(struct map_session_data *sd, bool flag);
-enum mail_attach_result mail_setitem(struct map_session_data *sd, short idx, uint32 amount);
-bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg);
-void mail_getattachment(struct map_session_data* sd, struct mail_message* msg, int zeny, struct item* item);
-int mail_openmail(struct map_session_data *sd);
-void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg);
-bool mail_invalid_operation(struct map_session_data *sd);
-void mail_send(struct map_session_data *sd, const char *dest_name, const char *title, const char *body_msg, int body_len);
-void mail_refresh_remaining_amount( struct map_session_data* sd );
+void mail_clear(map_session_data *sd);
+int mail_removeitem(map_session_data *sd, short flag, int idx, int amount);
+bool mail_removezeny(map_session_data *sd, bool flag);
+enum mail_attach_result mail_setitem(map_session_data *sd, short idx, uint32 amount);
+bool mail_setattachment(map_session_data *sd, struct mail_message *msg);
+void mail_getattachment(map_session_data* sd, struct mail_message* msg, int zeny, struct item* item);
+int mail_openmail(map_session_data *sd);
+void mail_deliveryfail(map_session_data *sd, struct mail_message *msg);
+bool mail_invalid_operation(map_session_data *sd);
+void mail_send(map_session_data *sd, const char *dest_name, const char *title, const char *body_msg, int body_len);
+void mail_refresh_remaining_amount( map_session_data* sd );
 
 #endif /* MAIL_HPP */

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