Forráskód Böngészése

Merge branch 'master' into hotfix/issue6912

# Conflicts:
#	conf/battle/feature.conf
#	src/map/battle.cpp
#	src/map/battle.hpp
#	src/map/clif.cpp
#	src/map/clif.hpp
#	src/map/packets.hpp
Lemongrass3110 2 éve
szülő
commit
0ce73b3d5d
100 módosított fájl, 7346 hozzáadás és 2117 törlés
  1. 91 0
      .github/workflows/analysis_codeql.yml
  2. 6 2
      .github/workflows/build_servers_clang.yml
  3. 5 1
      .github/workflows/build_servers_cmake.yml
  4. 6 2
      .github/workflows/build_servers_gcc.yml
  5. 6 2
      .github/workflows/build_servers_modes.yml
  6. 4 0
      .github/workflows/build_servers_msbuild.yml
  7. 6 2
      .github/workflows/build_servers_packetversions.yml
  8. 6 2
      .github/workflows/build_servers_vip.yml
  9. 6 2
      .github/workflows/npc_db_validation.yml
  10. 11 0
      conf/battle/client.conf
  11. 8 0
      conf/battle/feature.conf
  12. 5 0
      conf/battle/monster.conf
  13. 4 2
      db/enchantgrade.yml
  14. 4 2
      db/import-tmpl/enchantgrade.yml
  15. 42 0
      db/pre-re/item_group_db.yml
  16. 0 1
      db/pre-re/status.yml
  17. 8 2
      db/re/enchantgrade.yml
  18. 337 73
      db/re/item_db_equip.yml
  19. 1670 43
      db/re/item_db_usable.yml
  20. 793 8
      db/re/item_group_db.yml
  21. 21 21
      db/re/laphine_synthesis.yml
  22. 2 5
      db/re/skill_db.yml
  23. 0 1
      db/re/status.yml
  24. 24 1
      doc/script_commands.txt
  25. 221 133
      npc/custom/warper.txt
  26. 0 125
      npc/merchants/cash_hair.txt
  27. 1 1
      npc/pre-re/mobs/dungeons/nyd_dun.txt
  28. 1 1
      npc/pre-re/mobs/dungeons/prt_maze.txt
  29. 5 0
      npc/re/mapflag/nobranch.txt
  30. 5 0
      npc/re/mapflag/nomemo.txt
  31. 5 0
      npc/re/mapflag/nopenalty.txt
  32. 5 0
      npc/re/mapflag/nopvp.txt
  33. 6 0
      npc/re/mapflag/noteleport.txt
  34. 1 0
      npc/re/merchants/barters.yml
  35. 1039 0
      npc/re/merchants/barters/cashmall.yml
  36. 331 0
      npc/re/merchants/cashmall.txt
  37. 2 1
      npc/re/merchants/enchan_upg.txt
  38. 3 1
      npc/re/merchants/shadow_refiner.txt
  39. 7 7
      npc/re/mobs/dungeons/glastheim.txt
  40. 20 20
      npc/re/mobs/verus.txt
  41. 6 4
      npc/re/other/item_merge.txt
  42. 2 1
      npc/re/scripts_athena.conf
  43. 0 1
      npc/scripts_athena.conf
  44. 6 6
      sql-files/README.md
  45. 10 10
      sql-files/item_db_re_equip.sql
  46. 809 0
      sql-files/upgrades/upgrade_20221218.sql
  47. 2 2
      src/common/ers.cpp
  48. 3 3
      src/common/mmo.hpp
  49. 15 15
      src/map/achievement.cpp
  50. 11 11
      src/map/achievement.hpp
  51. 79 101
      src/map/atcommand.cpp
  52. 3 3
      src/map/atcommand.hpp
  53. 175 175
      src/map/battle.cpp
  54. 11 4
      src/map/battle.hpp
  55. 27 27
      src/map/battleground.cpp
  56. 15 15
      src/map/battleground.hpp
  57. 14 14
      src/map/buyingstore.cpp
  58. 10 10
      src/map/buyingstore.hpp
  59. 2 2
      src/map/cashshop.cpp
  60. 3 3
      src/map/cashshop.hpp
  61. 29 29
      src/map/channel.cpp
  62. 23 23
      src/map/channel.hpp
  63. 7 7
      src/map/chat.cpp
  64. 8 8
      src/map/chat.hpp
  65. 32 30
      src/map/chrif.cpp
  66. 13 13
      src/map/chrif.hpp
  67. 6 6
      src/map/clan.cpp
  68. 7 7
      src/map/clan.hpp
  69. 124 129
      src/map/clif.cpp
  70. 320 311
      src/map/clif.hpp
  71. 13 13
      src/map/duel.cpp
  72. 8 8
      src/map/duel.hpp
  73. 1 1
      src/map/elemental.cpp
  74. 45 45
      src/map/guild.cpp
  75. 24 24
      src/map/guild.hpp
  76. 17 17
      src/map/homunculus.cpp
  77. 10 10
      src/map/homunculus.hpp
  78. 7 7
      src/map/instance.cpp
  79. 3 3
      src/map/instance.hpp
  80. 46 46
      src/map/intif.cpp
  81. 17 17
      src/map/intif.hpp
  82. 32 2
      src/map/itemdb.cpp
  83. 99 13
      src/map/itemdb.hpp
  84. 8 8
      src/map/log.cpp
  85. 9 9
      src/map/log.hpp
  86. 14 14
      src/map/mail.cpp
  87. 11 11
      src/map/mail.hpp
  88. 60 61
      src/map/map.cpp
  89. 9 9
      src/map/map.hpp
  90. 87 69
      src/map/mob.cpp
  91. 5 5
      src/map/mob.hpp
  92. 66 52
      src/map/npc.cpp
  93. 24 24
      src/map/npc.hpp
  94. 3 3
      src/map/npc_chat.cpp
  95. 12 0
      src/map/packets.hpp
  96. 40 40
      src/map/party.cpp
  97. 25 25
      src/map/party.hpp
  98. 8 0
      src/map/path.cpp
  99. 1 0
      src/map/path.hpp
  100. 153 150
      src/map/pc.cpp

+ 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: true
+
+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

+ 6 - 2
.github/workflows/build_servers_clang.yml

@@ -1,6 +1,10 @@
 name: Build servers with Clang
 # build_servers_clang.yml
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:
@@ -22,9 +26,9 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # The ubuntu-latest label currently points to ubuntu-22.04.
           # Available: ubuntu-22.04, ubuntu-20.04
-          os: [ubuntu-latest]
+          os: [ubuntu-20.04]
           # Version list can be found on https://github.com/marketplace/actions/install-clang
           clang: ['6.0', '7', '8', '9', '10', '11'] #, '12', '13']
 

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

@@ -1,6 +1,10 @@
 name: Build servers with CMake
 # build_servers_cmake.yml
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:
@@ -22,7 +26,7 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # The ubuntu-latest label currently points to ubuntu-22.04.
           # Available: ubuntu-22.04, ubuntu-20.04
           os: [ubuntu-latest]
 

+ 6 - 2
.github/workflows/build_servers_gcc.yml

@@ -1,6 +1,10 @@
 name: Build servers with GCC
 # build_servers_gcc.yml
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:
@@ -22,11 +26,11 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # The ubuntu-latest label currently points to ubuntu-22.04.
           # Available: ubuntu-22.04, ubuntu-20.04
           os: [ubuntu-latest]
           # Older versions of GCC are not available via unaltered aptitude repo lists.
-          gcc: ['7', '8', '9', '10']
+          gcc: ['9', '10', '11']
 
     steps:
       - uses: actions/checkout@v2

+ 6 - 2
.github/workflows/build_servers_modes.yml

@@ -1,6 +1,10 @@
 name: Build servers in Pre-Renewal and Renewal
 # build_servers_modes.yml
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:
@@ -22,11 +26,11 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # The ubuntu-latest label currently points to ubuntu-22.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']
+          gcc: ['11']
           # We run build checks for both Renewal and PRE-Renewal
           mode: ['PRE','RE']
 

+ 4 - 0
.github/workflows/build_servers_msbuild.yml

@@ -1,6 +1,10 @@
 name: Build servers with MSVS
 # build_servers_msbuild.yml
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:

+ 6 - 2
.github/workflows/build_servers_packetversions.yml

@@ -1,6 +1,10 @@
 name: Build servers with different packet versions
 # build_servers_packetversions.yml
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:
@@ -22,11 +26,11 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # The ubuntu-latest label currently points to ubuntu-22.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']
+          gcc: ['11']
           # We run build checks for both Renewal and PRE-Renewal
           mode: ['PRE','RE']
           # Check build success for different packet-versions

+ 6 - 2
.github/workflows/build_servers_vip.yml

@@ -1,6 +1,10 @@
 name: Build servers in VIP mode
 # build_servers_vip.yml
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:
@@ -22,11 +26,11 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # The ubuntu-latest label currently points to ubuntu-22.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']
+          gcc: ['11']
           # We run build checks for both Renewal and PRE-Renewal
           mode: ['PRE', 'RE']
 

+ 6 - 2
.github/workflows/npc_db_validation.yml

@@ -4,6 +4,10 @@ name: Validate NPC Scripts and DB Changes
 # For NPC and DB validation we only need two builds: one of Renewal and one for Pre-Renewal checks.
 # NPC scripts and database files are not platform dependent, so we can achieve this validation using only a simple linux setup.
 
+concurrency:
+  group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 on:
   push:
     branches:
@@ -25,11 +29,11 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-          # The ubuntu-latest label currently points to ubuntu-20.04.
+          # The ubuntu-latest label currently points to ubuntu-22.04.
           # Available: ubuntu-22.04, ubuntu-20.04
           os: [ubuntu-latest]
           # Only a single version of GCC is required for validating NPC scripts and database changes.
-          gcc: ['10']
+          gcc: ['11']
           # We run build checks for both Renewal and PRE-Renewal
           mode: ['PRE', 'RE']
 

+ 11 - 0
conf/battle/client.conf

@@ -158,3 +158,14 @@ macro_detection_retry: 3
 // Amount of time in milliseconds before the macro detection will fail and the user will be banned.
 // Official: 60000
 macro_detection_timeout: 60000
+
+// Macro Detector punishment type
+// 0 - Ban
+// 1 - Jail
+// Official: 0
+macro_detection_punishment: 0
+
+// Macro Detector punishment duration
+// Amount of time in minutes that the punishment type is active for. Use 0 for infinite.
+// Official: 0
+macro_detection_punishment_time: 0

+ 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
@@ -143,6 +147,10 @@ feature.dynamicnpc_direction: no
 // Requires: 2010-00-00RagexeRE or later
 feature.itemlink: on
 
+// Stylist UI (Note 1)
+// Requires: 2015-11-04 or later
+feature.stylist: on
+
 // Enable the Gold PC timer? (Note 1)
 // Default: yes
 feature.goldpc_active: yes

+ 5 - 0
conf/battle/monster.conf

@@ -297,3 +297,8 @@ achievement_mob_share: no
 // Should slaves teleport back to their master if they get too far during chase? (Note 1)
 // Default (Official): no
 slave_stick_with_master: no
+
+// Absolute minimum respawn time in milliseconds of a monster.
+// Also used in delaying the spawning of guardians when a guild is not loaded.
+// Default (Official): 1000
+mob_respawn_time: 1000

+ 4 - 2
db/enchantgrade.yml

@@ -30,7 +30,9 @@
 #           Refine                      Required refine level.
 #           Chance                      Base chance of success out of 0~10000.
 #           Bonus                       Enchantgrade bonus. (Default: 0)
-#           Announce                    Announce if someone tries to increase the enchantgrade. (Default: true)
+#           AnnounceSuccess             Announce on upgrade success. (Default: true)
+#           AnnounceFail                Announce on upgrade failure. (Default: false)
+#           Announce                    Announce on upgrade success and failure.
 #           Catalyst:                   Catalyst item to increase chance of success.
 #             Item                      The item that can be used.
 #             AmountPerStep             Amount of Item needed.
@@ -49,7 +51,7 @@
 
 Header:
   Type: ENCHANTGRADE_DB
-  Version: 1
+  Version: 2
 
 Footer:
   Imports:

+ 4 - 2
db/import-tmpl/enchantgrade.yml

@@ -30,7 +30,9 @@
 #           Refine                      Required refine level.
 #           Chance                      Base chance of success out of 0~10000.
 #           Bonus                       Enchantgrade bonus. (Default: 0)
-#           Announce                    Announce if someone tries to increase the enchantgrade. (Default: true)
+#           AnnounceSuccess             Announce on upgrade success. (Default: true)
+#           AnnounceFail                Announce on upgrade failure. (Default: false)
+#           Announce                    Announce on upgrade success and failure.
 #           Catalyst:                   Catalyst item to increase chance of success.
 #             Item                      The item that can be used.
 #             AmountPerStep             Amount of Item needed.
@@ -49,4 +51,4 @@
 
 Header:
   Type: ENCHANTGRADE_DB
-  Version: 1
+  Version: 2

+ 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

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

@@ -1987,7 +1987,6 @@ Body:
     Flags:
       NoRemoveOnDead: true
       NoClearbuff: true
-      NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
   - Status: Incmhprate

+ 8 - 2
db/re/enchantgrade.yml

@@ -30,7 +30,9 @@
 #           Refine                      Required refine level.
 #           Chance                      Base chance of success out of 0~10000.
 #           Bonus                       Enchantgrade bonus. (Default: 0)
-#           Announce                    Announce if someone tries to increase the enchantgrade. (Default: true)
+#           AnnounceSuccess             Announce on upgrade success. (Default: true)
+#           AnnounceFail                Announce on upgrade failure. (Default: false)
+#           Announce                    Announce on upgrade success and failure.
 #           Catalyst:                   Catalyst item to increase chance of success.
 #             Item                      The item that can be used.
 #             AmountPerStep             Amount of Item needed.
@@ -49,7 +51,7 @@
 
 Header:
   Type: ENCHANTGRADE_DB
-  Version: 1
+  Version: 2
 
 Body:
   - Type: Armor
@@ -98,6 +100,7 @@ Body:
             Refine: 11
             Chance: 5000
             Bonus: 50
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 5
@@ -117,6 +120,7 @@ Body:
             Refine: 11
             Chance: 4000
             Bonus: 100
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 7
@@ -178,6 +182,7 @@ Body:
             Refine: 11
             Chance: 5000
             Bonus: 50
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 5
@@ -197,6 +202,7 @@ Body:
             Refine: 11
             Chance: 4000
             Bonus: 100
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 7

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 337 - 73
db/re/item_db_equip.yml


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1670 - 43
db/re/item_db_usable.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

+ 21 - 21
db/re/laphine_synthesis.yml

@@ -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

+ 2 - 5
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
@@ -27608,8 +27605,8 @@ Body:
     DamageFlags:
       Splash: true
     Range: 9
-    Hit: Single
-    HitCount: -3
+    Hit: Multi_Hit
+    HitCount: 3
     Element: Wind
     SplashArea:
       - Level: 1

+ 0 - 1
db/re/status.yml

@@ -2101,7 +2101,6 @@ Body:
     Flags:
       NoRemoveOnDead: true
       NoClearbuff: true
-      NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
   - Status: Incmhprate

+ 24 - 1
doc/script_commands.txt

@@ -159,7 +159,8 @@ executed, it is affected by spawn rates in 'battle_athena.conf'.
 Delay1 and delay2 control monster respawn delays - the first one is the fixed
 base respawn time, and the second is random variance on top of the base time.
 Both values are given in milliseconds (1000 = 1 second).
-Note that the server also enforces a minimum respawn delay of 5 seconds.
+Note that the server also enforces a minimum respawn delay of 1 second (See
+/conf/battle/monster.conf::mob_respawn_time).
 
 Event is a script event to be executed when the mob is killed. The event must
 be in the form "NPCName::OnEventName" to execute, and the event name label
@@ -6579,6 +6580,28 @@ Examples:
 
 ---------------------------------------
 
+macro_detector({<account ID>});
+macro_detector({"<character name>"});
+
+This command will display the captcha UI challenge onto the invoking character or the given <account ID>/<character name>.
+
+Example:
+	// Use 'getareaunits' to gather an area of players to test.
+	// Build an int array of the account IDs.
+	.@num = getareaunits(BL_PC, "prontera", 150, 150, 160, 160, .@array[0]);
+
+	mes "The number of Players in Prontera in between 150x150 and 160x160 is " + .@num + " .";
+	mes "Players to challenge:";
+	freeloop(1); // If the list is too big
+	for(.@i = 0; .@i < getarraysize(.@array); .@i++) {
+		mes (.@i + 1) + " " + convertpcinfo(.@array[.@i], CPC_NAME);
+		macro_detector .@array[.@i];
+	}
+	freeloop(0);
+	end;
+
+---------------------------------------
+
 ==================================
 |5.- Mob / NPC -related commands.|
 ==================================

+ 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;
-}

+ 1 - 1
npc/pre-re/mobs/dungeons/nyd_dun.txt

@@ -14,7 +14,7 @@
 // nyd_dun01 - Yggdrasil Root Dungeon
 //==================================================
 nyd_dun01,0,0	monster	Draco	2013,40
-nyd_dun01,0,0	monster	Draco's Egg	2014,10,0,0,0
+nyd_dun01,0,0	monster	Draco's Egg	2014,10
 nyd_dun01,0,0	monster	Aqua Elemental	2016,20
 nyd_dun01,0,0	monster	Dark Pinguicula	2015,10
 nyd_dun01,0,0	monster	Rata	2017,2,900000

+ 1 - 1
npc/pre-re/mobs/dungeons/prt_maze.txt

@@ -84,7 +84,7 @@ prt_maze03,50,150,70,70	monster	Vagabond Wolf	1092,1,1920000,150000
 prt_maze03,170,170,70,70	monster	Mantis	1139,30,60000,30000
 prt_maze03,170,170,70,70	monster	Eclipse	1093,1,1920000,150000
 prt_maze03,23,23,70,70	monster	Mastering	1090,1,1920000,150000
-prt_maze03,100,100,80,80	monster	Baphomet Jr.	1101,25,0,0,0
+prt_maze03,100,100,80,80	monster	Baphomet Jr.	1101,25
 prt_maze03,0,0,0,0	boss_monster	Baphomet	1039,1,7200000,600000,1
 prt_maze03,61,98,10,10	monster	Shining Plant	1083,1,1800000,900000
 prt_maze03,61,98,10,10	monster	Blue Plant	1079,1,1800000,900000

+ 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

+ 7 - 7
npc/re/mobs/dungeons/glastheim.txt

@@ -184,11 +184,11 @@ gl_step,0,0	monster	Mimic	1191,6,5000
 //==================================================
 // gl_cas02_ - Nightmare Mode 2f
 //==================================================
-gl_cas02_,0,0	monster	Evil Druid (Nightmare)	2480,4,0,0,0
-gl_cas02_,0,0	monster	Chimera (Nightmare)	2485,1,0,0,0
-gl_cas02_,0,0	monster	Mimic (Nightmare)	2479,19,0,0,0
-gl_cas02_,0,0	monster	Rideword (Nightmare)	2478,10,0,0,0
-gl_cas02_,0,0	monster	Wanderer (Nightmare)	2477,60,0,0,0
+gl_cas02_,0,0	monster	Evil Druid (Nightmare)	2480,4,5000
+gl_cas02_,0,0	monster	Chimera (Nightmare)	2485,1,5000
+gl_cas02_,0,0	monster	Mimic (Nightmare)	2479,19,5000
+gl_cas02_,0,0	monster	Rideword (Nightmare)	2478,10,5000
+gl_cas02_,0,0	monster	Wanderer (Nightmare)	2477,60,5000
 gl_cas02_,0,0	monster	Mysteltainn	1203,1,7200000,3600000
 gl_cas02_,0,0	monster	Alice	1275,1,5000
 gl_cas02_,102,180	monster	Whisper	1185,1,1800000,900000
@@ -197,8 +197,8 @@ gl_cas02_,0,0	monster	Baphomet (Nightmare)	2483,1,7200000,0,0
 //==================================================
 // gl_chyard_ - Nightmare Mode Churchyard
 //==================================================
-gl_chyard_,0,0	monster	Wraith Dead (Nightmare)	2481,91,0,0,0
-gl_chyard_,0,0	monster	Wraith Dead	1291,31,0,0,0
+gl_chyard_,0,0	monster	Wraith Dead (Nightmare)	2481,91,5000
+gl_chyard_,0,0	monster	Wraith Dead	1291,31,5000
 gl_chyard_,0,0	monster	Evil Druid (Nightmare)	2480,22,60000,0,0
 gl_chyard_,0,0	monster	Mimic (Nightmare)	2479,34,60000,0,0
 gl_chyard_,0,0,0,0	boss_monster	Dark Lord	1272,1,3600000,600000,1

+ 20 - 20
npc/re/mobs/verus.txt

@@ -10,28 +10,28 @@
 //============================================================
 
 // ver_eju
-ver_eju,0,0,0,0	monster	Recon Robot	3154,50,0,0,0
-ver_eju,0,0,0,0	monster	Excavator Robot	3153,10,0,0,0
+ver_eju,0,0,0,0	monster	Recon Robot	3154,50,5000
+ver_eju,0,0,0,0	monster	Excavator Robot	3153,10,5000
 // ver_tunn
-ver_tunn,0,0,0,0	monster	Recon Robot	3154,5,0,0,0
+ver_tunn,0,0,0,0	monster	Recon Robot	3154,5,30000
 // verus01
-verus01,0,0,0,0	monster	Green Cenere	3247,50,0,0,0
-verus01,0,0,0,0	monster	Explorer Robot Turbo	3249,25,0,0,0
-verus01,0,0,0,0	monster	Repair Robot Turbo	3248,25,0,0,0
+verus01,0,0,0,0	monster	Green Cenere	3247,50,5000
+verus01,0,0,0,0	monster	Explorer Robot Turbo	3249,25,5000
+verus01,0,0,0,0	monster	Repair Robot Turbo	3248,25,5000
 // verus02
-verus02,0,0,0,0	monster	Repair Robot Turbo	3248,50,0,0,0
-verus02,0,0,0,0	monster	Explorer Robot Turbo	3249,50,0,0,0
+verus02,0,0,0,0	monster	Repair Robot Turbo	3248,50,5000
+verus02,0,0,0,0	monster	Explorer Robot Turbo	3249,50,5000
 // verus03
-verus03,0,0,0,0	monster	Illegal Promotion	3159,40,0,0,0
-verus03,0,0,0,0	monster	Explorer Robot	3156,50,0,0,0
-verus03,0,0,0,0	monster	Repair Robot	3155,50,0,0,0
-verus03,0,0,0,0	monster	Ruin Grace Believer	3158,10,0,0,0
+verus03,0,0,0,0	monster	Illegal Promotion	3159,40,5000
+verus03,0,0,0,0	monster	Explorer Robot	3156,50,5000
+verus03,0,0,0,0	monster	Repair Robot	3155,50,5000
+verus03,0,0,0,0	monster	Ruin Grace Believer	3158,10,5000
 // un_bunker
-un_bunker,0,0,0,0	monster	Thief Bug	1051,6,0,0,0
-un_bunker,0,0,0,0	monster	Smelly Ghoul	3255,68,0,0,0
-un_bunker,0,0,0,0	monster	Smelly Zombie	3256,80,0,0,0
-un_bunker,0,0,0,0	monster	Machine Component	3250,28,0,0,0
-un_bunker,0,0,0,0	monster	DR815	3252,14,0,0,0
-un_bunker,0,0,0,0	monster	GC109	3251,10,0,0,0
-un_bunker,0,0,0,0	monster	Black Mushroom	1084,1,0,0,0
-un_bunker,0,0,0,0	monster	Chonchon	1011,2,0,0,0
+un_bunker,0,0,0,0	monster	Thief Bug	1051,6,5000
+un_bunker,0,0,0,0	monster	Smelly Ghoul	3255,68,5000
+un_bunker,0,0,0,0	monster	Smelly Zombie	3256,80,5000
+un_bunker,0,0,0,0	monster	Machine Component	3250,28,5000
+un_bunker,0,0,0,0	monster	DR815	3252,14,5000
+un_bunker,0,0,0,0	monster	GC109	3251,10,5000
+un_bunker,0,0,0,0	monster	Black Mushroom	1084,1,5000
+un_bunker,0,0,0,0	monster	Chonchon	1011,2,5000

+ 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
 

+ 6 - 6
sql-files/README.md

@@ -6,19 +6,19 @@ The files in this directory are basic SQL table building scripts. The contained
 
 ### New Install
 ---
-For a new install, the following needs to be imported into the 'ragnarok' schema:
+For a new install, the following needs to be imported into the main schema:
 Note: The schema name is defined in `conf/inter_athena.conf::map_server_db`.
 
 * main.sql - Contains tables for normal server usage.
 * web.sql - Contains tables for the web service
 * roulette_default_data.sql - Contains data for the client's roulette game.
 
-For a new install, the following needs to be imported into the 'log' schema:
+For a new install, the following can be imported into the main schema but is highly suggested to be imported into a separate schema for logs:
 Note: The schema name is defined in `conf/inter_athena.conf::log_db_db`.
 
 * logs.sql - Contains tables for logging of server events.
 
-If your server is setup to read SQL database data, import the following:
+If your server is setup to read SQL database data, import the following into the main schema:
 Note: If `conf/inter_athena.conf::use_sql_db` is set to yes continue with these imports else these can be skipped. Not all files have to be imported, only the ones that apply to the same mode as the server being ran.
 
 * item_cash_db.sql - Used for client's cash shop.
@@ -44,8 +44,8 @@ Note: If `conf/inter_athena.conf::use_sql_db` is set to yes continue with these
 
 ### Updates
 ---
-Over the course of time new features and optimizations will take place. This may require SQL changes to happen. In the `upgrades` folder will be upgrade files with an attached date.
-These imports only have to executed if an update has occurred after the initial installation. Many times a SQL error will be displayed on the server console stating the format differs from what is required.
+Over the course of time new features and optimizations will take place. This may require SQL changes to happen. In the `upgrades` folder will be SQL files with an attached date.
+These only have to executed one time if an update has occurred after the initial installation. It's possible to see when an update may be required when a SQL error will be displayed on the server console stating the format differs from what is required.
 
 ### Compatibility
 ---
@@ -76,4 +76,4 @@ To run these queries the user requires the [FILE](https://dev.mysql.com/doc/refm
 
 ### Notes
 ---
-The web-server must be able to read the `login` and `guild` tables from the `login-server` and `char-server`, respectively.
+The `web-server` must be able to read the `login` and `guild` tables from the `login-server` and `char-server`, respectively.

+ 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;');

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

@@ -0,0 +1,809 @@
+/**
+	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` ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+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
+	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` ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+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
+	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` ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+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
+	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` ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+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
+	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` ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+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
+	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` ) - 1 as `new_index`,
+	`old_index`,
+	`option_id`,
+	`option_val`,
+	`option_parm`
+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
+	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` ) - 1 as `new_index`,
+		`old_index`,
+		`option_id`,
+		`option_val`,
+		`option_parm`
+	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
+		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`;

+ 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

@@ -693,14 +693,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;
 };
@@ -1121,7 +1121,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;
 };

+ 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);

+ 79 - 101
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);
 
@@ -4021,7 +4021,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 +4066,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 +4128,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 +4276,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 +4356,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 +4910,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,9 +5217,8 @@ ACMD_FUNC(servertime)
  *------------------------------------------*/
 ACMD_FUNC(jail)
 {
-	struct map_session_data *pl_sd;
-	int x, y;
-	unsigned short m_index;
+	map_session_data *pl_sd;
+
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -5239,26 +5238,12 @@ ACMD_FUNC(jail)
 		return -1;
 	}
 
-	if (pl_sd->sc.data[SC_JAILED]) {
+	if (pl_sd->sc.getSCE(SC_JAILED)) {
 		clif_displaymessage(fd, msg_txt(sd,118)); // Player warped in jails.
 		return -1;
 	}
 
-	switch(rnd() % 2) { //Jail Locations
-	case 0:
-		m_index = mapindex_name2id(MAP_JAIL);
-		x = 24;
-		y = 75;
-		break;
-	default:
-		m_index = mapindex_name2id(MAP_JAIL);
-		x = 49;
-		y = 75;
-		break;
-	}
-
-	//Duration of INT_MAX to specify infinity.
-	sc_start4(NULL,&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000);
+	pc_jail(*pl_sd);
 	clif_displaymessage(pl_sd->fd, msg_txt(sd,117)); // GM has send you in jails.
 	clif_displaymessage(fd, msg_txt(sd,118)); // Player warped in jails.
 	return 0;
@@ -5270,7 +5255,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));
 
@@ -5290,23 +5275,23 @@ ACMD_FUNC(unjail)
 		return -1;
 	}
 
-	if (!pl_sd->sc.data[SC_JAILED]) {
+	if (!pl_sd->sc.getSCE(SC_JAILED)) {
 		clif_displaymessage(fd, msg_txt(sd,119)); // This player is not in jails.
 		return -1;
 	}
 
 	//Reset jail time to 1 sec.
-	sc_start(NULL,&pl_sd->bl,SC_JAILED,100,1,1000);
+	pc_jail(*pl_sd, 0);
 	clif_displaymessage(pl_sd->fd, msg_txt(sd,120)); // A GM has discharged you from jail.
 	clif_displaymessage(fd, msg_txt(sd,121)); // Player unjailed.
 	return 0;
 }
 
 ACMD_FUNC(jailfor) {
-	struct map_session_data *pl_sd = NULL;
+	map_session_data* pl_sd = nullptr;;
 	char * modif_p;
-	int jailtime = 0,x,y;
-	short m_index = 0;
+	int jailtime = 0;
+
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -5338,8 +5323,8 @@ ACMD_FUNC(jailfor) {
 	}
 
 	// Added by Coltaro
-	if(pl_sd->sc.data[SC_JAILED] && pl_sd->sc.data[SC_JAILED]->val1 != INT_MAX) { // Update the player's jail time
-		jailtime += pl_sd->sc.data[SC_JAILED]->val1;
+	if(pl_sd->sc.getSCE(SC_JAILED) && pl_sd->sc.getSCE(SC_JAILED)->val1 != INT_MAX) { // Update the player's jail time
+		jailtime += pl_sd->sc.getSCE(SC_JAILED)->val1;
 		if (jailtime <= 0) {
 			jailtime = 0;
 			clif_displaymessage(pl_sd->fd, msg_txt(sd,120)); // GM has discharge you.
@@ -5363,19 +5348,8 @@ ACMD_FUNC(jailfor) {
 		return -1;
 	}
 
-	// Jail locations, add more as you wish.
-	switch(rnd()%2) {
-		case 1: // Jail #1
-			m_index = mapindex_name2id(MAP_JAIL);
-			x = 49; y = 75;
-			break;
-		default: // Default Jail
-			m_index = mapindex_name2id(MAP_JAIL);
-			x = 24; y = 75;
-			break;
-	}
+	pc_jail(*pl_sd, jailtime);
 
-	sc_start4(NULL,&pl_sd->bl,SC_JAILED,100,jailtime,m_index,x,y,jailtime?60000:1000); //jailtime = 0: Time was reset to 0. Wait 1 second to warp player out (since it's done in status_change_timer).
 	return 0;
 }
 
@@ -5387,26 +5361,26 @@ ACMD_FUNC(jailtime){
 
 	nullpo_retr(-1, sd);
 
-	if (!sd->sc.data[SC_JAILED]) {
+	if (!sd->sc.getSCE(SC_JAILED)) {
 		clif_displaymessage(fd, msg_txt(sd,1139)); // You are not in jail.
 		return -1;
 	}
 
-	if (sd->sc.data[SC_JAILED]->val1 == INT_MAX) {
+	if (sd->sc.getSCE(SC_JAILED)->val1 == INT_MAX) {
 		clif_displaymessage(fd, msg_txt(sd,1140)); // You have been jailed indefinitely.
 		return 0;
 	}
 
-	if (sd->sc.data[SC_JAILED]->val1 <= 0) { // Was not jailed with @jailfor (maybe @jail? or warped there? or got recalled?)
+	if (sd->sc.getSCE(SC_JAILED)->val1 <= 0) { // Was not jailed with @jailfor (maybe @jail? or warped there? or got recalled?)
 		clif_displaymessage(fd, msg_txt(sd,1141)); // You have been jailed for an unknown amount of time.
 		return -1;
 	}
 
 	// Get remaining jail time
-	split_time(sd->sc.data[SC_JAILED]->val1*60,&year,&month,&day,&hour,&minute,&second);
+	split_time(sd->sc.getSCE(SC_JAILED)->val1*60,&year,&month,&day,&hour,&minute,&second);
 	sprintf(atcmd_output,msg_txt(sd,402),msg_txt(sd,1142),year,month,day,hour,minute); // You will remain in jail for %d years, %d months, %d days, %d hours and %d minutes
 	clif_displaymessage(fd, atcmd_output);
-	timestamp2string(timestr,20,now+sd->sc.data[SC_JAILED]->val1*60,"%Y-%m-%d %H:%M");
+	timestamp2string(timestr,20,now+sd->sc.getSCE(SC_JAILED)->val1*60,"%Y-%m-%d %H:%M");
 	sprintf(atcmd_output,"Release date is: %s",timestr);
 	clif_displaymessage(fd, atcmd_output);
 
@@ -5451,7 +5425,7 @@ ACMD_FUNC(disguise)
 		return -1;
 	}
 
-	if (sd->sc.data[SC_MONSTER_TRANSFORM] || sd->sc.data[SC_ACTIVE_MONSTER_TRANSFORM]) {
+	if (sd->sc.getSCE(SC_MONSTER_TRANSFORM) || sd->sc.getSCE(SC_ACTIVE_MONSTER_TRANSFORM)) {
 		clif_displaymessage(fd, msg_txt(sd,730)); // Character cannot be disguised while in monster transform.
 		return -1;
 	}
@@ -5468,7 +5442,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);
 
@@ -5534,7 +5508,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);
 	}
@@ -5566,7 +5540,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);
 
@@ -5604,7 +5578,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);
 	}
@@ -5875,7 +5849,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));
@@ -6143,7 +6117,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;
@@ -6280,7 +6254,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);
 
@@ -6327,7 +6301,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;
@@ -6353,7 +6327,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);
 
@@ -6483,7 +6457,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));
@@ -7245,7 +7219,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
 
@@ -7368,7 +7342,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));
@@ -7422,7 +7396,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));
@@ -7438,7 +7412,7 @@ ACMD_FUNC(unmute)
 		return -1;
 	}
 
-	if(!pl_sd->sc.data[SC_NOCHAT]) {
+	if(!pl_sd->sc.getSCE(SC_NOCHAT)) {
 		clif_displaymessage(sd->fd,msg_txt(sd,1235)); // Player is not muted.
 		return -1;
 	}
@@ -7520,7 +7494,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);
 
@@ -7571,7 +7545,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);
 
@@ -8426,7 +8400,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;
 
@@ -8560,7 +8534,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);
@@ -8591,7 +8565,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);
 
@@ -8824,7 +8798,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));
@@ -8896,7 +8870,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));
@@ -9053,7 +9027,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));
 
@@ -9631,7 +9605,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;
@@ -9733,7 +9707,7 @@ ACMD_FUNC(charcommands) {
 /* for new mounts */
 ACMD_FUNC(mount2) {
 	clif_displaymessage(sd->fd,msg_txt(sd,1362)); // NOTICE: If you crash with mount your LUA is outdated.
-	if (!sd->sc.data[SC_ALL_RIDING]) {
+	if (!sd->sc.getSCE(SC_ALL_RIDING)) {
 		clif_displaymessage(sd->fd,msg_txt(sd,1363)); // You have mounted.
 		sc_start(NULL, &sd->bl, SC_ALL_RIDING, 10000, 1, INFINITE_TICK);
 	} else {
@@ -10018,7 +9992,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);
@@ -10220,7 +10194,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);
@@ -10332,7 +10306,7 @@ ACMD_FUNC(changedress){
 	};
 
 	for( sc_type type : name2id ) {
-		if( sd->sc.data[type] ) {
+		if( sd->sc.getSCE(type) ) {
 			status_change_end( &sd->bl, type );
 			// You should only be able to have one - so we cancel here
 			break;
@@ -10363,7 +10337,7 @@ ACMD_FUNC(costume) {
 
 	if( !message || !*message ) {
 		for( k = 0; k < len; k++ ) {
-			if( sd->sc.data[name2id[k]] ) {
+			if( sd->sc.getSCE(name2id[k]) ) {
 				sprintf(atcmd_output, msg_txt(sd, 727), names[k]); // '%s' Costume removed.
 				clif_displaymessage(sd->fd, atcmd_output);
 				status_change_end(&sd->bl, (sc_type)name2id[k]);
@@ -10380,7 +10354,7 @@ ACMD_FUNC(costume) {
 	}
 
 	for( k = 0; k < len; k++ ) {
-		if( sd->sc.data[name2id[k]] ) {
+		if( sd->sc.getSCE(name2id[k]) ) {
 			sprintf(atcmd_output, msg_txt(sd, 724), names[k]); // You're already wearing a(n) '%s' costume, type '@costume' to remove it.
 			clif_displaymessage(sd->fd, atcmd_output);
 			return -1;
@@ -10409,7 +10383,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);
 
@@ -10482,7 +10456,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);
 
@@ -10763,6 +10737,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.
@@ -11198,7 +11176,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;
@@ -11285,7 +11263,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];
@@ -11309,7 +11287,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
 		return false;
 
 	//Block NOCHAT but do not display it as a normal message
-	if ( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCOMMAND )
+	if ( sd->sc.getSCE(SC_NOCHAT) && sd->sc.getSCE(SC_NOCHAT)->val1&MANNER_NOCOMMAND )
 		return true;
 
 	// skip 10/11-langtype's codepage indicator, if detected

+ 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);

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 175 - 175
src/map/battle.cpp


+ 11 - 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;
@@ -714,12 +715,18 @@ struct Battle_Config
 	int break_mob_equip;
 	int macro_detection_retry;
 	int macro_detection_timeout;
+	int macro_detection_punishment;
+	int macro_detection_punishment_time;
 
 	int feature_dynamicnpc_timeout;
 	int feature_dynamicnpc_rangex;
 	int feature_dynamicnpc_rangey;
 	int feature_dynamicnpc_direction;
 
+	int mob_respawn_time;
+
+	int feature_stylist;
+
 	int feature_goldpc_active;
 	int feature_goldpc_time;
 	int feature_goldpc_max_points;

+ 27 - 27
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,23 +843,23 @@ 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);
 
 	if (sd->sc.count) {
-		if (sd->sc.data[SC_ENTRY_QUEUE_APPLY_DELAY]) { // Exclude any player who's recently left a battleground queue
+		if (sd->sc.getSCE(SC_ENTRY_QUEUE_APPLY_DELAY)) { // Exclude any player who's recently left a battleground queue
 			char buf[CHAT_SIZE_MAX];
 
-			sprintf(buf, msg_txt(sd, 339), static_cast<int32>((get_timer(sd->sc.data[SC_ENTRY_QUEUE_APPLY_DELAY]->timer)->tick - gettick()) / 1000)); // You can't apply to a battleground queue for %d seconds due to recently leaving one.
+			sprintf(buf, msg_txt(sd, 339), static_cast<int32>((get_timer(sd->sc.getSCE(SC_ENTRY_QUEUE_APPLY_DELAY)->timer)->tick - gettick()) / 1000)); // You can't apply to a battleground queue for %d seconds due to recently leaving one.
 			clif_bg_queue_apply_result(BG_APPLY_NONE, name, sd);
 			clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], buf, false, SELF);
 			return false;
 		}
 
-		if (sd->sc.data[SC_ENTRY_QUEUE_NOTIFY_ADMISSION_TIME_OUT]) { // Exclude any player who's recently deserted a battleground
+		if (sd->sc.getSCE(SC_ENTRY_QUEUE_NOTIFY_ADMISSION_TIME_OUT)) { // Exclude any player who's recently deserted a battleground
 			char buf[CHAT_SIZE_MAX];
-			int32 status_tick = static_cast<int32>(DIFF_TICK(get_timer(sd->sc.data[SC_ENTRY_QUEUE_NOTIFY_ADMISSION_TIME_OUT]->timer)->tick, gettick()) / 1000);
+			int32 status_tick = static_cast<int32>(DIFF_TICK(get_timer(sd->sc.getSCE(SC_ENTRY_QUEUE_NOTIFY_ADMISSION_TIME_OUT)->timer)->tick, gettick()) / 1000);
 
 			sprintf(buf, msg_txt(sd, 338), status_tick / 60, status_tick % 60); // You can't apply to a battleground queue due to recently deserting a battleground. Time remaining: %d minutes and %d seconds.
 			clif_bg_queue_apply_result(BG_APPLY_NONE, name, 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);

+ 14 - 14
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,14 +66,14 @@ 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) {
 		return 1;
 	}
 
-	if( sd->sc.data[SC_NOCHAT] && (sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) )
+	if( sd->sc.getSCE(SC_NOCHAT) && (sd->sc.getSCE(SC_NOCHAT)->val1&MANNER_NOROOM) )
 	{// custom: mute limitation
 		return 2;
 	}
@@ -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;
@@ -140,7 +140,7 @@ int8 buyingstore_create( struct map_session_data* sd, int zenylimit, unsigned ch
 		return 6;
 	}
 
-	if( sd->sc.data[SC_NOCHAT] && (sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) )
+	if( sd->sc.getSCE(SC_NOCHAT) && (sd->sc.getSCE(SC_NOCHAT)->val1&MANNER_NOROOM) )
 	{// custom: mute limitation
 		return 2;
 	}
@@ -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 */

+ 29 - 29
src/map/channel.cpp

@@ -146,9 +146,9 @@ int channel_delete(struct Channel *channel, bool force) {
 	if(!force && channel->type == CHAN_TYPE_PUBLIC && runflag == MAPSERVER_ST_RUNNING) //only delete those serv stop
 		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 +192,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 +247,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 +275,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 +302,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 +341,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 +388,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 +438,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 +500,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 +533,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 +545,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 +560,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 +577,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 +654,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 +688,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 +719,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 +767,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 +832,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 +885,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 +914,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 +938,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 +1047,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 +1114,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 +1266,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 +1288,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);

+ 32 - 30
src/map/chrif.cpp

@@ -171,6 +171,7 @@ bool chrif_auth_delete(uint32 account_id, uint32 char_id, enum sd_state state) {
 			if (node->sd->regs.arrays)
 				node->sd->regs.arrays->destroy(node->sd->regs.arrays, script_free_array_db);
 
+			node->sd->~map_session_data();
 			aFree(node->sd);
 		}
 
@@ -222,7 +223,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 ) {
@@ -291,7 +292,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);
@@ -472,7 +473,7 @@ static void chrif_save_ack(int fd) {
 }
 
 // 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!
@@ -571,7 +572,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;
 
@@ -686,7 +687,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() ) {
@@ -834,7 +835,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 )
@@ -927,7 +928,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);
@@ -962,7 +963,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];
 
@@ -1009,7 +1010,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);
@@ -1092,7 +1093,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 )
@@ -1118,7 +1119,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 ) {
@@ -1145,7 +1146,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
@@ -1211,7 +1212,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);
@@ -1331,12 +1332,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);
@@ -1348,10 +1349,11 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
 	WFIFOL(char_fd,8) = sd->status.char_id;
 
 	for (i = 0; i < SC_MAX; i++) {
-		if (!sc->data[i])
+		auto sce = sc->getSCE(static_cast<sc_type>(i));
+		if (!sce)
 			continue;
-		if (sc->data[i]->timer != INVALID_TIMER) {
-			timer = get_timer(sc->data[i]->timer);
+		if (sce->timer != INVALID_TIMER) {
+			timer = get_timer(sce->timer);
 			if (timer == NULL || timer->func != status_change_timer)
 				continue;
 			if (DIFF_TICK(timer->tick,tick) > 0)
@@ -1361,10 +1363,10 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
 		} else
 			data.tick = INFINITE_TICK; //Infinite duration
 		data.type = i;
-		data.val1 = sc->data[i]->val1;
-		data.val2 = sc->data[i]->val2;
-		data.val3 = sc->data[i]->val3;
-		data.val4 = sc->data[i]->val4;
+		data.val1 = sce->val1;
+		data.val2 = sce->val2;
+		data.val3 = sce->val3;
+		data.val4 = sce->val4;
 		memcpy(WFIFOP(char_fd,14 +count*sizeof(struct status_change_data)),
 			&data, sizeof(struct status_change_data));
 		count++;
@@ -1377,7 +1379,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;
@@ -1420,7 +1422,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
@@ -1454,7 +1456,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);
@@ -1480,7 +1482,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);
@@ -1533,7 +1535,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);
@@ -1669,7 +1671,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);
@@ -1735,7 +1737,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;
 
@@ -1877,7 +1879,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 - 13
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.
@@ -52,31 +52,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 +87,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 */

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 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);
@@ -762,7 +769,7 @@ void clif_status_change(struct block_list *bl, int type, int flag, t_tick tick,
 void clif_efst_status_change(struct block_list *bl, int tid, enum send_target target, int type, 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);
@@ -770,107 +777,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);
@@ -878,10 +885,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);
@@ -891,82 +898,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);
@@ -983,132 +990,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
@@ -1129,28 +1136,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
@@ -1171,53 +1178,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);
@@ -1235,6 +1242,8 @@ 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 );
+
 void clif_goldpc_info( struct map_session_data& sd );
 
 #endif /* CLIF_HPP */

+ 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);

+ 1 - 1
src/map/elemental.cpp

@@ -583,7 +583,7 @@ static int elemental_ai_sub_timer(s_elemental_data *ed, map_session_data *sd, t_
 
 	int master_dist, view_range;
 
-	if( ed->sc.count && ed->sc.data[SC_BLIND] )
+	if( ed->sc.count && ed->sc.getSCE(SC_BLIND) )
 		view_range = 3;
 	else
 		view_range = ed->db->range2;

+ 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);
 

+ 14 - 14
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);
@@ -438,11 +438,11 @@ void mail_send(struct map_session_data *sd, const char *dest_name, const char *t
 		mail_refresh_remaining_amount(sd);
 
 		// After calling mail_refresh_remaining_amount the status should always be there
-		if( sd->sc.data[SC_DAILYSENDMAILCNT] == NULL || sd->sc.data[SC_DAILYSENDMAILCNT]->val2 >= battle_config.mail_daily_count ){
+		if( sd->sc.getSCE(SC_DAILYSENDMAILCNT) == NULL || sd->sc.getSCE(SC_DAILYSENDMAILCNT)->val2 >= battle_config.mail_daily_count ){
 			clif_Mail_send(sd, WRITE_MAIL_FAILED_CNT);
 			return;
 		}else{
-			sc_start2( &sd->bl, &sd->bl, SC_DAILYSENDMAILCNT, 100, date_get_dayofyear(), sd->sc.data[SC_DAILYSENDMAILCNT]->val2 + 1, INFINITE_TICK );
+			sc_start2( &sd->bl, &sd->bl, SC_DAILYSENDMAILCNT, 100, date_get_dayofyear(), sd->sc.getSCE(SC_DAILYSENDMAILCNT)->val2 + 1, INFINITE_TICK );
 		}
 	}
 
@@ -484,13 +484,13 @@ 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);
 
 	// If it was not yet started or it was started on another day
-	if( sd->sc.data[SC_DAILYSENDMAILCNT] == NULL || sd->sc.data[SC_DAILYSENDMAILCNT]->val1 != doy ){
+	if( sd->sc.getSCE(SC_DAILYSENDMAILCNT) == NULL || sd->sc.getSCE(SC_DAILYSENDMAILCNT)->val1 != doy ){
 		sc_start2( &sd->bl, &sd->bl, SC_DAILYSENDMAILCNT, 100, doy, 0, INFINITE_TICK );
 	}
 }

+ 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 */

+ 60 - 61
src/map/map.cpp

@@ -106,12 +106,12 @@ struct inter_conf inter_config {};
 
 // DBMap declaration
 static DBMap* id_db=NULL; /// int id -> struct block_list*
-static DBMap* pc_db=NULL; /// int id -> struct map_session_data*
+static DBMap* pc_db=NULL; /// int id -> map_session_data*
 static DBMap* mobid_db=NULL; /// int id -> struct mob_data*
 static DBMap* bossid_db=NULL; /// int id -> struct mob_data* (MVP db)
 static DBMap* map_db=NULL; /// unsigned int mapindex -> struct map_data*
 static DBMap* nick_db=NULL; /// uint32 char_id -> struct charid2nick* (requested names of offline characters)
-static DBMap* charid_db=NULL; /// uint32 char_id -> struct map_session_data*
+static DBMap* charid_db=NULL; /// uint32 char_id -> map_session_data*
 static DBMap* regen_db=NULL; /// int id -> struct block_list* (status_natural_heal processing)
 static DBMap* map_msg_db=NULL;
 
@@ -437,7 +437,7 @@ int map_delblock(struct block_list* bl)
 int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick)
 {
 	int x0 = bl->x, y0 = bl->y;
-	struct status_change *sc = NULL;
+	status_change *sc = NULL;
 	int moveblock = ( x0/BLOCK_SIZE != x1/BLOCK_SIZE || y0/BLOCK_SIZE != y1/BLOCK_SIZE);
 
 	if (!bl->prev) {
@@ -462,8 +462,8 @@ int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick)
 			status_change_end(bl, SC_TATAMIGAESHI);
 			status_change_end(bl, SC_MAGICROD);
 			status_change_end(bl, SC_SU_STOOP);
-			if (sc->data[SC_PROPERTYWALK] &&
-				sc->data[SC_PROPERTYWALK]->val3 >= skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) )
+			if (sc->getSCE(SC_PROPERTYWALK) &&
+				sc->getSCE(SC_PROPERTYWALK)->val3 >= skill_get_maxcount(sc->getSCE(SC_PROPERTYWALK)->val1,sc->getSCE(SC_PROPERTYWALK)->val2) )
 				status_change_end(bl,SC_PROPERTYWALK);
 		}
 	} else
@@ -498,49 +498,49 @@ int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick)
 		}
 
 		if (sc && sc->count) {
-			if (sc->data[SC_DANCING])
-				skill_unit_move_unit_group(skill_id2group(sc->data[SC_DANCING]->val2), bl->m, x1-x0, y1-y0);
+			if (sc->getSCE(SC_DANCING))
+				skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_DANCING)->val2), bl->m, x1-x0, y1-y0);
 			else {
-				if (sc->data[SC_CLOAKING] && sc->data[SC_CLOAKING]->val1 < 3 && !skill_check_cloaking(bl, NULL))
+				if (sc->getSCE(SC_CLOAKING) && sc->getSCE(SC_CLOAKING)->val1 < 3 && !skill_check_cloaking(bl, NULL))
 					status_change_end(bl, SC_CLOAKING);
-				if (sc->data[SC_WARM])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_WARM]->val4), bl->m, x1-x0, y1-y0);
-				if (sc->data[SC_BANDING])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_BANDING]->val4), bl->m, x1-x0, y1-y0);
+				if (sc->getSCE(SC_WARM))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_WARM)->val4), bl->m, x1-x0, y1-y0);
+				if (sc->getSCE(SC_BANDING))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_BANDING)->val4), bl->m, x1-x0, y1-y0);
 
-				if (sc->data[SC_NEUTRALBARRIER_MASTER])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_NEUTRALBARRIER_MASTER]->val2), bl->m, x1-x0, y1-y0);
-				else if (sc->data[SC_STEALTHFIELD_MASTER])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_STEALTHFIELD_MASTER]->val2), bl->m, x1-x0, y1-y0);
+				if (sc->getSCE(SC_NEUTRALBARRIER_MASTER))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_NEUTRALBARRIER_MASTER)->val2), bl->m, x1-x0, y1-y0);
+				else if (sc->getSCE(SC_STEALTHFIELD_MASTER))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_STEALTHFIELD_MASTER)->val2), bl->m, x1-x0, y1-y0);
 
-				if( sc->data[SC__SHADOWFORM] ) {//Shadow Form Caster Moving
+				if( sc->getSCE(SC__SHADOWFORM) ) {//Shadow Form Caster Moving
 					struct block_list *d_bl;
-					if( (d_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || !check_distance_bl(bl,d_bl,10) )
+					if( (d_bl = map_id2bl(sc->getSCE(SC__SHADOWFORM)->val2)) == NULL || !check_distance_bl(bl,d_bl,10) )
 						status_change_end(bl,SC__SHADOWFORM);
 				}
 
-				if (sc->data[SC_PROPERTYWALK]
-					&& sc->data[SC_PROPERTYWALK]->val3 < skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2)
+				if (sc->getSCE(SC_PROPERTYWALK)
+					&& sc->getSCE(SC_PROPERTYWALK)->val3 < skill_get_maxcount(sc->getSCE(SC_PROPERTYWALK)->val1,sc->getSCE(SC_PROPERTYWALK)->val2)
 					&& map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL
 					&& map_find_skill_unit_oncell(bl,bl->x,bl->y,NPC_ELECTRICWALK,NULL,0) == NULL
 					&& map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,NULL,0) == NULL
 					&& map_find_skill_unit_oncell(bl,bl->x,bl->y,NPC_FIREWALK,NULL,0) == NULL
-					&& skill_unitsetting(bl,sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2,x0, y0,0)) {
-						sc->data[SC_PROPERTYWALK]->val3++;
+					&& skill_unitsetting(bl,sc->getSCE(SC_PROPERTYWALK)->val1,sc->getSCE(SC_PROPERTYWALK)->val2,x0, y0,0)) {
+						sc->getSCE(SC_PROPERTYWALK)->val3++;
 				}
 
 
 			}
 			/* Guild Aura Moving */
 			if( bl->type == BL_PC && ((TBL_PC*)bl)->state.gmaster_flag ) {
-				if (sc->data[SC_LEADERSHIP])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_LEADERSHIP]->val4), bl->m, x1-x0, y1-y0);
-				if (sc->data[SC_GLORYWOUNDS])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_GLORYWOUNDS]->val4), bl->m, x1-x0, y1-y0);
-				if (sc->data[SC_SOULCOLD])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_SOULCOLD]->val4), bl->m, x1-x0, y1-y0);
-				if (sc->data[SC_HAWKEYES])
-					skill_unit_move_unit_group(skill_id2group(sc->data[SC_HAWKEYES]->val4), bl->m, x1-x0, y1-y0);
+				if (sc->getSCE(SC_LEADERSHIP))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_LEADERSHIP)->val4), bl->m, x1-x0, y1-y0);
+				if (sc->getSCE(SC_GLORYWOUNDS))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_GLORYWOUNDS)->val4), bl->m, x1-x0, y1-y0);
+				if (sc->getSCE(SC_SOULCOLD))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_SOULCOLD)->val4), bl->m, x1-x0, y1-y0);
+				if (sc->getSCE(SC_HAWKEYES))
+					skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_HAWKEYES)->val4), bl->m, x1-x0, y1-y0);
 			}
 		}
 	} else
@@ -1931,7 +1931,7 @@ void map_addnickdb(int charid, const char* nick)
 	safestrncpy(p->nick, nick, sizeof(p->nick));
 
 	while( p->requests ) {
-		struct map_session_data* sd;
+		map_session_data* sd;
 		struct charid_request* req;
 		req = p->requests;
 		p->requests = req->next;
@@ -1954,7 +1954,7 @@ void map_delnickdb(int charid, const char* name)
 
 	while( p->requests ) {
 		struct charid_request* req;
-		struct map_session_data* sd;
+		map_session_data* sd;
 		req = p->requests;
 		p->requests = req->next;
 		sd = map_charid2sd(req->charid);
@@ -1968,11 +1968,11 @@ void map_delnickdb(int charid, const char* name)
 /// Notifies sd of the nick of charid.
 /// Uses the name in the character if online.
 /// Uses the name in nick_db if offline.
-void map_reqnickdb(struct map_session_data * sd, int charid)
+void map_reqnickdb(map_session_data * sd, int charid)
 {
 	struct charid2nick* p;
 	struct charid_request* req;
-	struct map_session_data* tsd;
+	map_session_data* tsd;
 
 	nullpo_retv(sd);
 
@@ -2052,7 +2052,7 @@ void map_deliddb(struct block_list *bl)
 /*==========================================
  * Standard call when a player connection is closed.
  *------------------------------------------*/
-int map_quit(struct map_session_data *sd) {
+int map_quit(map_session_data *sd) {
 	int i;
 
 	if (sd->state.keepshop == false) { // Close vending/buyingstore
@@ -2105,7 +2105,7 @@ int map_quit(struct map_session_data *sd) {
 			std::bitset<SCF_MAX> &flag = it.second->flag;
 
 			//No need to save infinite status
-			if (flag[SCF_NOSAVEINFINITE] && sd->sc.data[it.first] && sd->sc.data[it.first]->val4 > 0) {
+			if (flag[SCF_NOSAVEINFINITE] && sd->sc.getSCE(it.first) && sd->sc.getSCE(it.first)->val4 > 0) {
 				status_change_end(&sd->bl, static_cast<sc_type>(it.first));
 				continue;
 			}
@@ -2183,9 +2183,9 @@ int map_quit(struct map_session_data *sd) {
 /*==========================================
  * Lookup, id to session (player,mob,npc,homon,merc..)
  *------------------------------------------*/
-struct map_session_data * map_id2sd(int id){
+map_session_data * map_id2sd(int id){
 	if (id <= 0) return NULL;
-	return (struct map_session_data*)idb_get(pc_db,id);
+	return (map_session_data*)idb_get(pc_db,id);
 }
 
 struct mob_data * map_id2md(int id){
@@ -2227,7 +2227,7 @@ struct chat_data* map_id2cd(int id){
 const char* map_charid2nick(int charid)
 {
 	struct charid2nick *p;
-	struct map_session_data* sd;
+	map_session_data* sd;
 
 	sd = map_charid2sd(charid);
 	if( sd )
@@ -2241,10 +2241,10 @@ const char* map_charid2nick(int charid)
 	return NULL;
 }
 
-/// Returns the struct map_session_data of the charid or NULL if the char is not online.
-struct map_session_data* map_charid2sd(int charid)
+/// Returns the map_session_data of the charid or NULL if the char is not online.
+map_session_data* map_charid2sd(int charid)
 {
-	return (struct map_session_data*)uidb_get(charid_db, charid);
+	return (map_session_data*)uidb_get(charid_db, charid);
 }
 
 /*==========================================
@@ -2252,10 +2252,10 @@ struct map_session_data* map_charid2sd(int charid)
  * (without sensitive case if necessary)
  * return map_session_data pointer or NULL
  *------------------------------------------*/
-struct map_session_data * map_nick2sd(const char *nick, bool allow_partial)
+map_session_data * map_nick2sd(const char *nick, bool allow_partial)
 {
-	struct map_session_data* sd;
-	struct map_session_data* found_sd;
+	map_session_data* sd;
+	map_session_data* found_sd;
 	struct s_mapiterator* iter;
 	size_t nicklen;
 	int qty = 0;
@@ -2344,13 +2344,13 @@ struct mob_data * map_id2boss(int id)
 
 /// Applies func to all the players in the db.
 /// Stops iterating if func returns -1.
-void map_foreachpc(int (*func)(struct map_session_data* sd, va_list args), ...)
+void map_foreachpc(int (*func)(map_session_data* sd, va_list args), ...)
 {
 	DBIterator* iter;
-	struct map_session_data* sd;
+	map_session_data* sd;
 
 	iter = db_iterator(pc_db);
-	for( sd = (struct map_session_data*)dbi_first(iter); dbi_exists(iter); sd = (struct map_session_data*)dbi_next(iter) )
+	for( sd = (map_session_data*)dbi_first(iter); dbi_exists(iter); sd = (map_session_data*)dbi_next(iter) )
 	{
 		va_list args;
 		int ret;
@@ -2746,10 +2746,10 @@ int map_addinstancemap(int src_m, int instance_id, bool no_mapflag)
  *------------------------------------------*/
 static int map_instancemap_leave(struct block_list *bl, va_list ap)
 {
-	struct map_session_data* sd;
+	map_session_data* sd;
 
 	nullpo_retr(0, bl);
-	nullpo_retr(0, sd = (struct map_session_data *)bl);
+	nullpo_retr(0, sd = (map_session_data *)bl);
 
 	pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
 
@@ -2765,7 +2765,7 @@ static int map_instancemap_clean(struct block_list *bl, va_list ap)
 	switch(bl->type) {
 		/*case BL_PC:
 		// BL_PET, BL_HOM, BL_MER, and BL_ELEM are moved when BL_PC warped out in map_instancemap_leave
-			map_quit((struct map_session_data *) bl);
+			map_quit((map_session_data *) bl);
 			break;*/
 		case BL_NPC:
 			npc_unload((struct npc_data *)bl,true);
@@ -3366,7 +3366,7 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable
 	return true;
 }
 
-void map_iwall_get(struct map_session_data *sd) {
+void map_iwall_get(map_session_data *sd) {
 	struct iwall_data *iwall;
 	DBIterator* iter;
 	int16 x1, y1;
@@ -3893,9 +3893,8 @@ int parse_console(const char* buf){
 	int16 x = 0;
 	int16 y = 0;
 	int n;
-	struct map_session_data sd;
+	map_session_data sd;
 
-	memset(&sd, 0, sizeof(struct map_session_data));
 	strcpy(sd.status.name, "console");
 
 	if( ( n = sscanf(buf, "%63[^:]:%63[^:]:%11s %6hd %6hd[^\n]", type, command, mapname, &x, &y) ) < 5 ){
@@ -4373,7 +4372,7 @@ int cleanup_sub(struct block_list *bl, va_list ap)
 
 	switch(bl->type) {
 		case BL_PC:
-			map_quit((struct map_session_data *) bl);
+			map_quit((map_session_data *) bl);
 			break;
 		case BL_NPC:
 			npc_unload((struct npc_data *)bl,false);
@@ -4437,7 +4436,7 @@ void map_skill_duration_add(struct map_data *mapd, uint16 skill_id, uint16 per)
  */
 static int map_mapflag_pvp_start_sub(struct block_list *bl, va_list ap)
 {
-	struct map_session_data *sd = map_id2sd(bl->id);
+	map_session_data *sd = map_id2sd(bl->id);
 
 	nullpo_retr(0, sd);
 
@@ -4462,7 +4461,7 @@ static int map_mapflag_pvp_start_sub(struct block_list *bl, va_list ap)
  */
 static int map_mapflag_pvp_stop_sub(struct block_list *bl, va_list ap)
 {
-	struct map_session_data* sd = map_id2sd(bl->id);
+	map_session_data* sd = map_id2sd(bl->id);
 
 	clif_pvpset(sd, 0, 0, 2);
 
@@ -4851,7 +4850,7 @@ void do_final(void){
 
 	//Ladies and babies first.
 	struct s_mapiterator* iter = mapit_getallusers();
-	for( struct map_session_data* sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
+	for( map_session_data* sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
 		map_quit(sd);
 	mapit_free(iter);
 
@@ -4945,7 +4944,7 @@ void do_final(void){
 	ShowStatus("Finished.\n");
 }
 
-static int map_abort_sub(struct map_session_data* sd, va_list ap)
+static int map_abort_sub(map_session_data* sd, va_list ap)
 {
 	chrif_save(sd, CSAVE_QUIT|CSAVE_INVENTORY|CSAVE_CART);
 	return 1;
@@ -5070,7 +5069,7 @@ int map_msg_config_read(const char *cfgName, int lang){
 	}
 	return 0;
 }
-const char* map_msg_txt(struct map_session_data *sd, int msg_number){
+const char* map_msg_txt(map_session_data *sd, int msg_number){
 	struct msg_data *mdb;
 	uint8 lang = 0; //default
 	if(sd && sd->langtype) lang = sd->langtype;
@@ -5136,7 +5135,7 @@ void do_shutdown(void)
 		runflag = MAPSERVER_ST_SHUTDOWN;
 		ShowStatus("Shutting down...\n");
 		{
-			struct map_session_data* sd;
+			map_session_data* sd;
 			struct s_mapiterator* iter = mapit_getallusers();
 			for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
 				clif_GM_kick(NULL, sd);

+ 9 - 9
src/map/map.hpp

@@ -38,7 +38,7 @@ struct map_data *map_getmapdata(int16 m);
 #define msg_txt(sd,msg_number) map_msg_txt(sd,msg_number)
 #define do_final_msg() map_do_final_msg()
 int map_msg_config_read(const char *cfgName,int lang);
-const char* map_msg_txt(struct map_session_data *sd,int msg_number);
+const char* map_msg_txt(map_session_data *sd,int msg_number);
 void map_do_final_msg(void);
 void map_msg_reload(void);
 
@@ -1095,7 +1095,7 @@ int map_get_new_object_id(void);
 int map_search_freecell(struct block_list *src, int16 m, int16 *x, int16 *y, int16 rx, int16 ry, int flag);
 bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag);
 //
-int map_quit(struct map_session_data *);
+int map_quit(map_session_data *);
 // npc
 bool map_addnpc(int16 m,struct npc_data *);
 
@@ -1114,11 +1114,11 @@ void map_data_copy(struct map_data *dst_map, struct map_data *src_map);
 // player to map session
 void map_addnickdb(int charid, const char* nick);
 void map_delnickdb(int charid, const char* nick);
-void map_reqnickdb(struct map_session_data* sd,int charid);
+void map_reqnickdb(map_session_data* sd,int charid);
 const char* map_charid2nick(int charid);
-struct map_session_data* map_charid2sd(int charid);
+map_session_data* map_charid2sd(int charid);
 
-struct map_session_data * map_id2sd(int id);
+map_session_data * map_id2sd(int id);
 struct mob_data * map_id2md(int id);
 struct npc_data * map_id2nd(int id);
 struct homun_data* map_id2hd(int id);
@@ -1139,12 +1139,12 @@ int map_eraseipport(unsigned short map, uint32 ip, uint16 port);
 int map_eraseallipport(void);
 void map_addiddb(struct block_list *);
 void map_deliddb(struct block_list *bl);
-void map_foreachpc(int (*func)(struct map_session_data* sd, va_list args), ...);
+void map_foreachpc(int (*func)(map_session_data* sd, va_list args), ...);
 void map_foreachmob(int (*func)(struct mob_data* md, va_list args), ...);
 void map_foreachnpc(int (*func)(struct npc_data* nd, va_list args), ...);
 void map_foreachregen(int (*func)(struct block_list* bl, va_list args), ...);
 void map_foreachiddb(int (*func)(struct block_list* bl, va_list args), ...);
-struct map_session_data * map_nick2sd(const char* nick, bool allow_partial);
+map_session_data * map_nick2sd(const char* nick, bool allow_partial);
 struct mob_data * map_getmob_boss(int16 m);
 struct mob_data * map_id2boss(int id);
 
@@ -1185,7 +1185,7 @@ void map_flags_init(void);
 
 bool map_iwall_exist(const char* wall_name);
 bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name);
-void map_iwall_get(struct map_session_data *sd);
+void map_iwall_get(map_session_data *sd);
 bool map_iwall_remove(const char *wall_name);
 
 int map_addmobtolist(unsigned short m, struct spawn_data *spawn);	// [Wizputer]
@@ -1222,7 +1222,7 @@ extern const char*MSG_CONF_NAME_POR;
 extern const char*MSG_CONF_NAME_THA;
 
 //Useful typedefs from jA [Skotlex]
-typedef struct map_session_data TBL_PC;
+typedef map_session_data TBL_PC;
 typedef struct npc_data         TBL_NPC;
 typedef struct mob_data         TBL_MOB;
 typedef struct flooritem_data   TBL_ITEM;

+ 87 - 69
src/map/mob.cpp

@@ -537,7 +537,7 @@ int mob_get_random_id(int type, enum e_random_monster_flags flag, int lv)
 bool mob_ksprotected (struct block_list *src, struct block_list *target)
 {
 	struct block_list *s_bl, *t_bl;
-	struct map_session_data
+	map_session_data
 		*sd,    // Source
 		*t_sd;  // Mob Target
 	struct mob_data *md;
@@ -563,7 +563,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
 
 	do {
 		struct status_change_entry *sce;
-		struct map_session_data *pl_sd; // Owner
+		map_session_data *pl_sd; // Owner
 		struct map_data *mapdata = map_getmapdata(md->bl.m);
 		char output[128];
 		
@@ -573,7 +573,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
 		if( md->get_bosstype() == BOSSTYPE_MVP || md->master_id )
 			return false; // MVP, Slaves mobs ignores KS
 
-		if( (sce = md->sc.data[SC_KSPROTECTED]) == nullptr )
+		if( (sce = md->sc.getSCE(SC_KSPROTECTED)) == nullptr )
 			break; // No KS Protected
 
 		if( sd->bl.id == sce->val1 || // Same Owner
@@ -662,7 +662,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int
 /*==========================================
  * Spawn a single mob on the specified coordinates.
  *------------------------------------------*/
-int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int mob_id, int amount, const char* event, unsigned int size, enum mob_ai ai)
+int mob_once_spawn(map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int mob_id, int amount, const char* event, unsigned int size, enum mob_ai ai)
 {
 	struct mob_data* md = nullptr;
 	int count, lv;
@@ -695,8 +695,8 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
 					md->guardian_data->emblem_id = g->emblem_id;
 					memcpy(md->guardian_data->guild_name, g->name, NAME_LENGTH);
 				}
-				else if (gc->guild_id) //Guild not yet available, retry in 5.
-					add_timer(gettick()+5000,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
+				else if (gc->guild_id) // Guild is not yet available, retry after the configured timespan.
+					add_timer(gettick() + battle_config.mob_respawn_time,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
 			}
 		}	// end addition [Valaris]
 
@@ -714,7 +714,7 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
 /*==========================================
  * Spawn mobs in the specified area.
  *------------------------------------------*/
-int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, const char* mobname, int mob_id, int amount, const char* event, unsigned int size, enum mob_ai ai)
+int mob_once_spawn_area(map_session_data* sd, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, const char* mobname, int mob_id, int amount, const char* event, unsigned int size, enum mob_ai ai)
 {
 	int i, max, id = 0;
 	int lx = -1, ly = -1;
@@ -914,7 +914,7 @@ int mob_spawn_guardian(const char* mapname, int16 x, int16 y, const char* mobnam
 		memcpy (md->guardian_data->guild_name, g->name, NAME_LENGTH);
 		md->guardian_data->guardup_lv = guild_checkskill(g,GD_GUARDUP);
 	} else if (md->guardian_data->guild_id)
-		add_timer(gettick()+5000,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
+		add_timer(gettick() + battle_config.mob_respawn_time,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
 	mob_spawn(md);
 
 	return md->bl.id;
@@ -1073,8 +1073,7 @@ int mob_setdelayspawn(struct mob_data *md)
 		spawntime = spawntime/100*battle_config.mob_spawn_delay;
 	}
 
-	if (spawntime < 5000) //Monsters should never respawn faster than within 5 seconds
-		spawntime = 5000;
+	spawntime = u32max(1000, spawntime); //Monsters should never respawn faster than 1 second
 
 	if( md->spawn_timer != INVALID_TIMER )
 		delete_timer(md->spawn_timer, mob_delayspawn);
@@ -1126,7 +1125,7 @@ int mob_spawn (struct mob_data *md)
 			{ // retry again later
 				if( md->spawn_timer != INVALID_TIMER )
 					delete_timer(md->spawn_timer, mob_delayspawn);
-				md->spawn_timer = add_timer(tick+5000,mob_delayspawn,md->bl.id,0);
+				md->spawn_timer = add_timer(tick + battle_config.mob_respawn_time,mob_delayspawn,md->bl.id,0);
 				return 1;
 			}
 		}
@@ -1134,7 +1133,7 @@ int mob_spawn (struct mob_data *md)
 		{ // retry again later (players on sight)
 			if( md->spawn_timer != INVALID_TIMER )
 				delete_timer(md->spawn_timer, mob_delayspawn);
-			md->spawn_timer = add_timer(tick+5000,mob_delayspawn,md->bl.id,0);
+			md->spawn_timer = add_timer(tick + battle_config.mob_respawn_time,mob_delayspawn,md->bl.id,0);
 			return 1;
 		}
 	}
@@ -1709,7 +1708,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, t_tick tick)
 		return false;
 	}
 
-	if (md->sc.count && md->sc.data[SC_BLIND])
+	if (md->sc.count && md->sc.getSCE(SC_BLIND))
 		view_range = 3;
 	else
 		view_range = md->db->range2;
@@ -1744,9 +1743,9 @@ static bool mob_ai_sub_hard(struct mob_data *md, t_tick tick)
 		{	//Rude attacked check.
 			if( !battle_check_range(&md->bl, tbl, md->status.rhw.range)
 			&&  ( //Can't attack back and can't reach back.
-					(!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || md->sc.data[SC_SPIDERWEB]
-						|| md->sc.data[SC_BITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNSTRAP]
-						|| md->sc.data[SC__MANHOLE] // Not yet confirmed if boss will teleport once it can't reach target.
+					(!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || md->sc.getSCE(SC_SPIDERWEB)
+						|| md->sc.getSCE(SC_BITE) || md->sc.getSCE(SC_VACUUM_EXTREME) || md->sc.getSCE(SC_THORNSTRAP)
+						|| md->sc.getSCE(SC__MANHOLE) // Not yet confirmed if boss will teleport once it can't reach target.
 						|| md->walktoxy_fail_count > 0)
 					)
 					|| !mob_can_reach(md, tbl, md->min_chase)
@@ -1769,9 +1768,9 @@ static bool mob_ai_sub_hard(struct mob_data *md, t_tick tick)
 				|| (battle_config.mob_ai&0x2 && !status_check_skilluse(&md->bl, abl, 0, 0)) // Cannot normal attack back to Attacker
 				|| (!battle_check_range(&md->bl, abl, md->status.rhw.range) // Not on Melee Range and ...
 				&& ( // Reach check
-					(!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || md->sc.data[SC_SPIDERWEB]
-						|| md->sc.data[SC_BITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNSTRAP]
-						|| md->sc.data[SC__MANHOLE] // Not yet confirmed if boss will teleport once it can't reach target.
+					(!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || md->sc.getSCE(SC_SPIDERWEB)
+						|| md->sc.getSCE(SC_BITE) || md->sc.getSCE(SC_VACUUM_EXTREME) || md->sc.getSCE(SC_THORNSTRAP)
+						|| md->sc.getSCE(SC__MANHOLE) // Not yet confirmed if boss will teleport once it can't reach target.
 						|| md->walktoxy_fail_count > 0)
 					)
 					|| !mob_can_reach(md, abl, dist+md->db->range3)
@@ -1995,7 +1994,7 @@ static int mob_ai_sub_hard_timer(struct block_list *bl,va_list ap)
 /*==========================================
  * Serious processing for mob in PC field of view (foreachclient)
  *------------------------------------------*/
-static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
+static int mob_ai_sub_foreachclient(map_session_data *sd,va_list ap)
 {
 	t_tick tick=va_arg(ap,t_tick);
 	map_foreachinallrange(mob_ai_sub_hard_timer,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB, sd->status.char_id, tick);
@@ -2297,7 +2296,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage)
 	{
 		case BL_PC:
 		{
-			struct map_session_data *sd = (TBL_PC*)src;
+			map_session_data *sd = (TBL_PC*)src;
 			char_id = sd->status.char_id;
 			if( damage )
 				md->attacked_id = src->id;
@@ -2339,7 +2338,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage)
 			struct mob_data* md2 = (TBL_MOB*)src;
 			if( md2->special_state.ai && md2->master_id )
 			{
-				struct map_session_data* msd = map_id2sd(md2->master_id);
+				map_session_data* msd = map_id2sd(md2->master_id);
 				if( msd )
 					char_id = msd->status.char_id;
 			}
@@ -2440,7 +2439,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage)
 			clif_summon_hp_bar(*md);
 		}
 		for(i = 0; i < DAMAGELOG_SIZE; i++){ // must show hp bar to all char who already hit the mob.
-			struct map_session_data *sd = map_charid2sd(md->dmglog[i].id);
+			map_session_data *sd = map_charid2sd(md->dmglog[i].id);
 			if( sd && check_distance_bl(&md->bl, &sd->bl, AREA_SIZE) ) // check if in range
 				clif_monster_hp_bar(md, sd->fd);
 		}
@@ -2456,14 +2455,15 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage)
  * @param drop_modifier: RENEWAL_DROP level modifier
  * @return Modified drop rate
  */
-int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier)
+int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md)
 {
 	int drop_rate = base_rate;
 
-	if (battle_config.mob_size_influence) { // Change drops depending on monsters size [Valaris]
-		if (mob->status.size == SZ_MEDIUM && drop_rate >= 2)
+	if (md && battle_config.mob_size_influence) {  // Change drops depending on monsters size [Valaris]
+		unsigned int mob_size = md->special_state.size;
+		if (mob_size == SZ_MEDIUM && drop_rate >= 2)
 			drop_rate /= 2; // SZ_MEDIUM actually is small size modification... this is not a bug!
-		else if (mob->status.size == SZ_BIG)
+		else if (mob_size == SZ_BIG)
 			drop_rate *= 2;
 	}
 
@@ -2474,7 +2474,7 @@ int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int b
 			drop_rate += (int)(0.5 + drop_rate * status_get_luk(src) * battle_config.drops_by_luk2 / 10000.);
 
 		if (src->type == BL_PC) { // Player specific drop rate adjustments
-			struct map_session_data *sd = (struct map_session_data*)src;
+			map_session_data *sd = (map_session_data*)src;
 			int drop_rate_bonus = 100;
 
 			// In PK mode players get an additional drop chance bonus of 25% if there is a 20 level difference
@@ -2486,8 +2486,8 @@ int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int b
 			drop_rate_bonus += sd->indexed_bonus.dropaddclass[mob->status.class_] + sd->indexed_bonus.dropaddclass[CLASS_ALL];
 			drop_rate_bonus += sd->indexed_bonus.dropaddrace[mob->status.race] + sd->indexed_bonus.dropaddrace[RC_ALL];
 
-			if (sd->sc.data[SC_ITEMBOOST])
-				drop_rate_bonus += sd->sc.data[SC_ITEMBOOST]->val1;
+			if (sd->sc.getSCE(SC_ITEMBOOST))
+				drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;
 
 			int cap;
 
@@ -2532,8 +2532,8 @@ int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int b
 int mob_dead(struct mob_data *md, struct block_list *src, int type)
 {
 	struct status_data *status;
-	struct map_session_data *sd = NULL, *tmpsd[DAMAGELOG_SIZE];
-	struct map_session_data *mvp_sd = NULL, *second_sd = NULL, *third_sd = NULL;
+	map_session_data *sd = NULL, *tmpsd[DAMAGELOG_SIZE];
+	map_session_data *mvp_sd = NULL, *second_sd = NULL, *third_sd = NULL;
 
 	struct {
 		struct party_data *p;
@@ -2550,7 +2550,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 	status = &md->status;
 
 	if( src && src->type == BL_PC ) {
-		sd = (struct map_session_data *)src;
+		sd = (map_session_data *)src;
 		mvp_sd = sd;
 	}
 
@@ -2574,7 +2574,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 	// filter out entries not eligible for exp distribution
 	memset(tmpsd,0,sizeof(tmpsd));
 	for(i = 0, count = 0, mvp_damage = 0; i < DAMAGELOG_SIZE && md->dmglog[i].id; i++) {
-		struct map_session_data* tsd = NULL;
+		map_session_data* tsd = NULL;
 		if (md->dmglog[i].flag == MDLF_SELF) {
 			//Self damage counts as exp tap
 			count++;
@@ -2633,15 +2633,15 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		int bonus = 100; //Bonus on top of your share (common to all attackers).
 		int pnum = 0;
 #ifndef RENEWAL
-		if (md->sc.data[SC_RICHMANKIM])
-			bonus += md->sc.data[SC_RICHMANKIM]->val2;
+		if (md->sc.getSCE(SC_RICHMANKIM))
+			bonus += md->sc.getSCE(SC_RICHMANKIM)->val2;
 #else
-		if (sd && sd->sc.data[SC_RICHMANKIM])
-			bonus += sd->sc.data[SC_RICHMANKIM]->val2;
+		if (sd && sd->sc.getSCE(SC_RICHMANKIM))
+			bonus += sd->sc.getSCE(SC_RICHMANKIM)->val2;
 #endif
 		if(sd) {
 			temp = status_get_class(&md->bl);
-			if(sd->sc.data[SC_MIRACLE]) i = 2; //All mobs are Star Targets
+			if(sd->sc.getSCE(SC_MIRACLE)) i = 2; //All mobs are Star Targets
 			else
 			ARR_FIND(0, MAX_PC_FEELHATE, i, temp == sd->hate_mob[i] &&
 				(battle_config.allow_skill_without_day || sg_info[i].day_func()));
@@ -2809,7 +2809,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			if ( it == nullptr )
 				continue;
 			
-			drop_rate = mob_getdroprate(src, md->db, md->db->dropitem[i].rate, drop_modifier);
+			drop_rate = mob_getdroprate(src, md->db, md->db->dropitem[i].rate, drop_modifier, md);
 
 			// attempt to drop the item
 			if (rnd() % 10000 >= drop_rate)
@@ -3058,7 +3058,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		//Emperium destroyed by script. Discard mvp character. [Skotlex]
 		mvp_sd = NULL;
 
-	rebirth =  ( md->sc.data[SC_KAIZEL] || md->sc.data[SC_ULTIMATE_S] || (md->sc.data[SC_REBIRTH] && !md->state.rebirth) );
+	rebirth =  ( md->sc.getSCE(SC_KAIZEL) || md->sc.getSCE(SC_ULTIMATE_S) || (md->sc.getSCE(SC_REBIRTH) && !md->state.rebirth) );
 	if( !rebirth ) { // Only trigger event on final kill
 		if( src ) {
 			switch( src->type ) { //allowed type
@@ -3405,7 +3405,7 @@ void mob_heal(struct mob_data *md,unsigned int heal)
 		}
 		for(i = 0; i < DAMAGELOG_SIZE; i++)// must show hp bar to all char who already hit the mob.
 			if( md->dmglog[i].id ) {
-				struct map_session_data *sd = map_charid2sd(md->dmglog[i].id);
+				map_session_data *sd = map_charid2sd(md->dmglog[i].id);
 				if( sd && check_distance_bl(&md->bl, &sd->bl, AREA_SIZE) ) // check if in range
 					clif_monster_hp_bar(md, sd->fd);
 			}
@@ -3631,14 +3631,39 @@ struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int64 rate)
 
 	return NULL;
 }
+
+bool mob_getstatus_sub( struct mob_data& md, e_mob_skill_condition condition, sc_type type ){
+	bool found = false;
+
+	if( type == SC_NONE ){
+		for( int i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++ ){
+			if( md.sc.getSCE( i ) != nullptr ){
+				// Once an effect was found, break out. [Skotlex]
+				found = true;
+				break;
+			}
+		}
+	}else{
+		found = md.sc.getSCE( type ) != nullptr;
+	}
+
+	switch( condition ){
+		case MSC_MYSTATUSON:
+		case MSC_FRIENDSTATUSON:
+			return found;
+		case MSC_MYSTATUSOFF:
+		case MSC_FRIENDSTATUSOFF:
+			return !found;
+		default:
+			return false;
+	}
+}
+
 /*==========================================
  * What a status state suits by nearby MOB is looked for.
  *------------------------------------------*/
-int mob_getfriendstatus_sub(struct block_list *bl,va_list ap)
-{
-	int64 cond1,cond2;
-	struct mob_data **fr, *md, *mmd;
-	int flag=0;
+int mob_getfriendstatus_sub( struct block_list *bl, va_list ap ){
+	struct mob_data *md, *mmd;
 
 	nullpo_ret(bl);
 	nullpo_ret(md=(struct mob_data *)bl);
@@ -3649,19 +3674,14 @@ int mob_getfriendstatus_sub(struct block_list *bl,va_list ap)
 
 	if (battle_check_target(&mmd->bl,bl,BCT_ENEMY)>0)
 		return 0;
-	cond1=va_arg(ap,int64);
-	cond2=va_arg(ap,int64);
-	fr=va_arg(ap,struct mob_data **);
-	if( cond2==-1 ){
-		int j;
-		for(j=SC_COMMON_MIN;j<=SC_COMMON_MAX && !flag;j++){
-			if ((flag=(md->sc.data[j] != NULL))) //Once an effect was found, break out. [Skotlex]
-				break;
-		}
-	}else
-		flag=( md->sc.data[cond2] != NULL );
-	if( flag^( cond1==MSC_FRIENDSTATUSOFF ) )
-		(*fr)=md;
+
+	int64 cond1 = va_arg( ap, int64 );
+	int64 cond2 = va_arg( ap, int64 );
+	struct mob_data** fr = va_arg( ap, struct mob_data** );
+
+	if( mob_getstatus_sub( *md, static_cast<e_mob_skill_condition>( cond1 ), static_cast<sc_type>( cond2 ) ) ){
+		*fr = md;
+	}
 
 	return 0;
 }
@@ -3763,16 +3783,14 @@ int mobskill_use(struct mob_data *md, t_tick tick, int event, int64 damage)
 					break;
 				case MSC_MYSTATUSON:		// status[num] on
 				case MSC_MYSTATUSOFF:		// status[num] off
-					if (!md->sc.count) {
+					if( !md->sc.count ){
+						flag = 0;
+					}else if( mob_getstatus_sub( *md, static_cast<e_mob_skill_condition>( ms[i]->cond1 ), static_cast<sc_type>( ms[i]->cond2 ) ) ){
+						flag = 1;
+					}else{
 						flag = 0;
-					} else if (ms[i]->cond2 == -1) {
-						for (j = SC_COMMON_MIN; j <= SC_COMMON_MAX; j++)
-							if ((flag = (md->sc.data[j]!=NULL)) != 0)
-								break;
-					} else {
-						flag = (md->sc.data[ms[i]->cond2]!=NULL);
 					}
-					flag ^= (ms[i]->cond1 == MSC_MYSTATUSOFF); break;
+					break;
 				case MSC_FRIENDHPLTMAXRATE:	// friend HP < maxhp%
 					flag = ((fbl = mob_getfriendhprate(md, 0, ms[i]->cond2)) != NULL); break;
 				case MSC_FRIENDHPINRATE	:
@@ -3994,7 +4012,7 @@ static bool mob_clone_disabled_skills(uint16 skill_id) {
 //If mode is not passed, a default aggressive mode is used.
 //If master_id is passed, clone is attached to him.
 //Returns: ID of newly crafted copy.
-int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, enum e_mode mode, int flag, unsigned int duration)
+int mob_clone_spawn(map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, enum e_mode mode, int flag, unsigned int duration)
 {
 	int mob_id;
 	int inf, fd;

+ 5 - 5
src/map/mob.hpp

@@ -319,7 +319,7 @@ struct mob_data {
 	struct view_data *vd;
 	bool vd_changed;
 	struct status_data status, *base_status; //Second one is in case of leveling up mobs, or tiny/large mobs.
-	struct status_change sc;
+	status_change sc;
 	std::shared_ptr<s_mob_db> db;	//For quick data access (saves doing mob_db(md->mob_id) all the time) [Skotlex]
 	char name[NAME_LENGTH];
 	struct s_specialState {
@@ -486,10 +486,10 @@ void mob_free_dynamic_viewdata( struct mob_data* md );
 
 struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int mob_id, const char *event, unsigned int size, enum mob_ai ai);
 
-int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y,
+int mob_once_spawn(map_session_data* sd, int16 m, int16 x, int16 y,
 	const char* mobname, int mob_id, int amount, const char* event, unsigned int size, enum mob_ai ai);
 
-int mob_once_spawn_area(struct map_session_data* sd, int16 m,
+int mob_once_spawn_area(map_session_data* sd, int16 m,
 	int16 x0, int16 y0, int16 x1, int16 y1, const char* mobname, int mob_id, int amount, const char* event, unsigned int size, enum mob_ai ai);
 
 bool mob_ksprotected (struct block_list *src, struct block_list *target);
@@ -538,7 +538,7 @@ int mob_count_sub(struct block_list *bl, va_list ap);
 
 int mob_is_clone(int mob_id);
 
-int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, enum e_mode mode, int flag, unsigned int duration);
+int mob_clone_spawn(map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, enum e_mode mode, int flag, unsigned int duration);
 int mob_clone_delete(struct mob_data *md);
 
 void mob_reload_itemmob_data(void);
@@ -547,7 +547,7 @@ void mob_add_spawn(uint16 mob_id, const struct spawn_info& new_spawn);
 const std::vector<spawn_info> mob_get_spawns(uint16 mob_id);
 bool mob_has_spawn(uint16 mob_id);
 
-int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier);
+int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md = nullptr);
 
 // MvP Tomb System
 int mvptomb_setdelayspawn(struct npc_data *nd);

+ 66 - 52
src/map/npc.cpp

@@ -900,7 +900,7 @@ bool npc_isnear(struct block_list * bl) {
     return false;
 }
 
-int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd)
+int npc_ontouch_event(map_session_data *sd, struct npc_data *nd)
 {
 	char name[EVENT_NAME_LENGTH];
 
@@ -922,7 +922,7 @@ int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd)
 	return npc_event(sd,name,1);
 }
 
-int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd)
+int npc_ontouch2_event(map_session_data *sd, struct npc_data *nd)
 {
 	char name[EVENT_NAME_LENGTH];
 
@@ -933,7 +933,7 @@ int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd)
 	return npc_event(sd,name,2);
 }
 
-int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y, struct npc_data *nd);
+int npc_touch_areanpc(map_session_data* sd, int16 m, int16 x, int16 y, struct npc_data *nd);
 
 /*==========================================
  * Sub-function of npc_enable, runs OnTouch event when enabled
@@ -952,7 +952,7 @@ int npc_enable_sub(struct block_list *bl, va_list ap)
 	return 0;
 }
 
-bool npc_is_cloaked(struct npc_data* nd, struct map_session_data* sd) {
+bool npc_is_cloaked(struct npc_data* nd, map_session_data* sd) {
 	bool npc_cloaked = (nd->sc.option & OPTION_CLOAK) ? true : false;
 
 	if (std::find(sd->cloaked_npc.begin(), sd->cloaked_npc.end(), nd->bl.id) != sd->cloaked_npc.end())
@@ -960,17 +960,17 @@ bool npc_is_cloaked(struct npc_data* nd, struct map_session_data* sd) {
 	return npc_cloaked;
 }
 
-bool npc_is_hidden_dynamicnpc( struct npc_data& nd, struct map_session_data& tsd ){
+bool npc_is_hidden_dynamicnpc( struct npc_data& nd, map_session_data& tsd ){
 	// If the NPC is dynamic and the target character is not the owner of the dynamic NPC
 	return nd.dynamicnpc.owner_char_id != 0 && nd.dynamicnpc.owner_char_id != tsd.status.char_id;
 }
 
 static int npc_cloaked_sub(struct block_list *bl, va_list ap)
 {
-	struct map_session_data* sd;
+	map_session_data* sd;
 
 	nullpo_ret(bl);
-	nullpo_ret(sd = (struct map_session_data *)bl);
+	nullpo_ret(sd = (map_session_data *)bl);
 	int id = va_arg(ap, int);
 
 	auto it = std::find(sd->cloaked_npc.begin(), sd->cloaked_npc.end(), id);
@@ -1080,7 +1080,7 @@ struct npc_data* npc_name2id(const char* name)
  * Timer to check for idle time and timeout the dialog if necessary
  **/
 TIMER_FUNC(npc_secure_timeout_timer){
-	struct map_session_data* sd = NULL;
+	map_session_data* sd = NULL;
 	unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT;
 	t_tick cur_tick = gettick(); //ensure we are on last tick
 
@@ -1120,7 +1120,7 @@ TIMER_FUNC(npc_secure_timeout_timer){
 /*==========================================
  * Dequeue event and add timer for execution (100ms)
  *------------------------------------------*/
-int npc_event_dequeue(struct map_session_data* sd,bool free_script_stack)
+int npc_event_dequeue(map_session_data* sd,bool free_script_stack)
 {
 	nullpo_ret(sd);
 
@@ -1192,7 +1192,7 @@ static int npc_event_export(struct npc_data *nd, int i)
 	return 0;
 }
 
-int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char* eventname); //[Lance]
+int npc_event_sub(map_session_data* sd, struct event_data* ev, const char* eventname); //[Lance]
 
 /**
  * Exec name (NPC events) on player or global
@@ -1421,7 +1421,7 @@ TIMER_FUNC(npc_timerevent){
 	struct npc_data* nd=(struct npc_data *)map_id2bl(id);
 	struct npc_timerevent_list *te;
 	struct timer_event_data *ted = (struct timer_event_data*)data;
-	struct map_session_data *sd=NULL;
+	map_session_data *sd=NULL;
 
 	if( nd == NULL )
 	{
@@ -1490,7 +1490,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
 {
 	int j;
 	t_tick tick = gettick();
-	struct map_session_data *sd = NULL; //Player to whom script is attached.
+	map_session_data *sd = NULL; //Player to whom script is attached.
 
 	nullpo_ret(nd);
 
@@ -1545,7 +1545,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
  *------------------------------------------*/
 int npc_timerevent_stop(struct npc_data* nd)
 {
-	struct map_session_data *sd = NULL;
+	map_session_data *sd = NULL;
 	int *tid;
 
 	nullpo_ret(nd);
@@ -1583,7 +1583,7 @@ int npc_timerevent_stop(struct npc_data* nd)
 /*==========================================
  * Aborts a running NPC timer that is attached to a player.
  *------------------------------------------*/
-void npc_timerevent_quit(struct map_session_data* sd)
+void npc_timerevent_quit(map_session_data* sd)
 {
 	const struct TimerData *td;
 	struct npc_data* nd;
@@ -1669,7 +1669,7 @@ int npc_settimerevent_tick(struct npc_data* nd, int newtimer)
 {
 	bool flag;
 	int old_rid;
-	//struct map_session_data *sd = NULL;
+	//map_session_data *sd = NULL;
 
 	nullpo_ret(nd);
 
@@ -1689,7 +1689,7 @@ int npc_settimerevent_tick(struct npc_data* nd, int newtimer)
 	return 0;
 }
 
-int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char* eventname)
+int npc_event_sub(map_session_data* sd, struct event_data* ev, const char* eventname)
 {
 	if ( sd->npc_id != 0 )
 	{
@@ -1738,7 +1738,7 @@ int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char
 /*==========================================
  * NPC processing event type
  *------------------------------------------*/
-int npc_event(struct map_session_data* sd, const char* eventname, int ontouch)
+int npc_event(map_session_data* sd, const char* eventname, int ontouch)
 {
 	struct event_data* ev = (struct event_data*)strdb_get(ev_db, eventname);
 	struct npc_data *nd;
@@ -1774,7 +1774,7 @@ int npc_event(struct map_session_data* sd, const char* eventname, int ontouch)
  *------------------------------------------*/
 int npc_touch_areanpc_sub(struct block_list *bl, va_list ap)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	int pc_id;
 	char *name;
 
@@ -1802,7 +1802,7 @@ int npc_touch_areanpc_sub(struct block_list *bl, va_list ap)
  * Chk if sd is still touching his assigned npc.
  * If not, it unsets it and searches for another player in range.
  *------------------------------------------*/
-int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap)
+int npc_touchnext_areanpc(map_session_data* sd, bool leavemap)
 {
 	if (sd->npc_ontouch_.empty())
 		return 0;
@@ -1840,7 +1840,7 @@ int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap)
 	return found;
 }
 
-int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y, struct npc_data *nd)
+int npc_touch_areanpc(map_session_data* sd, int16 m, int16 x, int16 y, struct npc_data *nd)
 {
 	nullpo_retr(0, sd);
 	nullpo_retr(0, nd);
@@ -1874,7 +1874,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y, st
 
 	switch (nd->subtype) {
 	case NPCTYPE_WARP:
-		if ((!nd->trigger_on_hidden && (pc_ishiding(sd) || (sd->sc.count && sd->sc.data[SC_CAMOUFLAGE]))) || pc_isdead(sd))
+		if ((!nd->trigger_on_hidden && (pc_ishiding(sd) || (sd->sc.count && sd->sc.getSCE(SC_CAMOUFLAGE)))) || pc_isdead(sd))
 			break; // hidden or dead chars cannot use warps
 		if (!pc_job_can_entermap((enum e_job)sd->status.class_, map_mapindex2mapid(nd->u.warp.mapindex), pc_get_group_level(sd)))
 			break;
@@ -1902,7 +1902,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y, st
 /*==========================================
  * Exec OnTouch for player if in range of area event
  *------------------------------------------*/
-int npc_touch_area_allnpc(struct map_session_data* sd, int16 m, int16 x, int16 y)
+int npc_touch_area_allnpc(map_session_data* sd, int16 m, int16 x, int16 y)
 {
 	nullpo_retr(1, sd);
 
@@ -2087,7 +2087,7 @@ int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range)
  * Chk if player not too far to access the npc.
  * Returns npc_data (success) or NULL (fail).
  *------------------------------------------*/
-struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl)
+struct npc_data* npc_checknear(map_session_data* sd, struct block_list* bl)
 {
 	struct npc_data *nd;
 
@@ -2128,7 +2128,7 @@ int npc_globalmessage(const char* name, const char* mes)
 }
 
 // MvP tomb [GreenBox]
-void run_tomb(struct map_session_data* sd, struct npc_data* nd)
+void run_tomb(map_session_data* sd, struct npc_data* nd)
 {
 	char buffer[200];
 	char time[10];
@@ -2156,7 +2156,7 @@ void run_tomb(struct map_session_data* sd, struct npc_data* nd)
  * NPC 1st call when clicking on npc
  * Do specific action for NPC type (openshop, run scripts...)
  *------------------------------------------*/
-int npc_click(struct map_session_data* sd, struct npc_data* nd)
+int npc_click(map_session_data* sd, struct npc_data* nd)
 {
 	nullpo_retr(1, sd);
 
@@ -2236,7 +2236,7 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
 /*==========================================
  *
  *------------------------------------------*/
-bool npc_scriptcont(struct map_session_data* sd, int id, bool closing){
+bool npc_scriptcont(map_session_data* sd, int id, bool closing){
 	struct block_list *target = map_id2bl(id);
 	struct npc_data* nd = BL_CAST( BL_NPC, target );
 
@@ -2331,7 +2331,7 @@ bool npc_scriptcont(struct map_session_data* sd, int id, bool closing){
  * @param type: 0 - Buy, 1 - Sell
  * @return 0 on success or 1 on failure
  */
-int npc_buysellsel(struct map_session_data* sd, int id, int type)
+int npc_buysellsel(map_session_data* sd, int id, int type)
 {
 	struct npc_data *nd;
 
@@ -2370,7 +2370,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
  * @param sd Player data
  * @return e_CASHSHOP_ACK
  **/
-static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int price, int points, struct map_session_data *sd) {
+static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int price, int points, map_session_data *sd) {
 	int cost[2] = { 0, 0 };
 
 	npc_shop_currency_type(sd, nd, cost, false);
@@ -2455,7 +2455,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int
  * @param item_list: List of items to purchase
  * @return clif_cashshop_ack value to display
  */
-int npc_cashshop_buylist( struct map_session_data *sd, int points, std::vector<s_npc_buy_list>& item_list ){
+int npc_cashshop_buylist( map_session_data *sd, int points, std::vector<s_npc_buy_list>& item_list ){
 	int i, j, amount, new_, w, vt;
 	t_itemid nameid;
 	struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
@@ -2553,7 +2553,7 @@ int npc_cashshop_buylist( struct map_session_data *sd, int points, std::vector<s
  * @param cost: Reference to cost variable
  * @param display: Display cost type to player?
  */
-void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, int cost[2], bool display)
+void npc_shop_currency_type(map_session_data *sd, struct npc_data *nd, int cost[2], bool display)
 {
 	nullpo_retv(sd);
 
@@ -2615,7 +2615,7 @@ void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, in
  * @param points: Cost of total items
  * @return clif_cashshop_ack value to display
  */
-int npc_cashshop_buy(struct map_session_data *sd, t_itemid nameid, int amount, int points)
+int npc_cashshop_buy(map_session_data *sd, t_itemid nameid, int amount, int points)
 {
 	struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
 	int i, price, w;
@@ -2707,7 +2707,7 @@ int npc_cashshop_buy(struct map_session_data *sd, t_itemid nameid, int amount, i
  * @param item_list: List of items
  * @param nd: Attached NPC
  */
-static int npc_buylist_sub(struct map_session_data* sd, std::vector<s_npc_buy_list>& item_list, struct npc_data* nd) {
+static int npc_buylist_sub(map_session_data* sd, std::vector<s_npc_buy_list>& item_list, struct npc_data* nd) {
 	char npc_ev[EVENT_NAME_LENGTH];
 	int key_nameid = 0, key_amount = 0;
 
@@ -2735,7 +2735,7 @@ static int npc_buylist_sub(struct map_session_data* sd, std::vector<s_npc_buy_li
  * @param item_list: List of items
  * @return result code for clif_parse_NpcBuyListSend/clif_npc_market_purchase_ack
  */
-e_purchase_result npc_buylist( struct map_session_data* sd, std::vector<s_npc_buy_list>& item_list ){
+e_purchase_result npc_buylist( map_session_data* sd, std::vector<s_npc_buy_list>& item_list ){
 	struct npc_data* nd;
 	struct npc_item_list *shop = NULL;
 	double z;
@@ -2890,7 +2890,7 @@ e_purchase_result npc_buylist( struct map_session_data* sd, std::vector<s_npc_bu
 }
 
 /// npc_selllist for script-controlled shops
-static int npc_selllist_sub(struct map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list, struct npc_data* nd)
+static int npc_selllist_sub(map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list, struct npc_data* nd)
 {
 	char npc_ev[EVENT_NAME_LENGTH];
 	char card_slot[NAME_LENGTH];
@@ -2974,7 +2974,7 @@ static int npc_selllist_sub(struct map_session_data* sd, int list_length, PACKET
 ///
 /// @param item_list 'n' pairs <index,amount>
 /// @return result code for clif_parse_NpcSellListSend
-uint8 npc_selllist(struct map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list)
+uint8 npc_selllist(map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list)
 {
 	double z;
 	int i,skill;
@@ -3083,7 +3083,7 @@ uint8 npc_selllist(struct map_session_data* sd, int list_length, PACKET_CZ_PC_SE
 	return 0;
 }
 
-e_purchase_result npc_barter_purchase( struct map_session_data& sd, std::shared_ptr<s_npc_barter> barter, std::vector<s_barter_purchase>& purchases ){
+e_purchase_result npc_barter_purchase( map_session_data& sd, std::shared_ptr<s_npc_barter> barter, std::vector<s_barter_purchase>& purchases ){
 	uint64 requiredZeny = 0;
 	uint32 requiredWeight = 0;
 	uint32 reducedWeight = 0;
@@ -3467,7 +3467,7 @@ int npc_unload(struct npc_data* nd, bool single) {
 
 		iter = mapit_geteachpc();
 		for( bl = (struct block_list*)mapit_first(iter); mapit_exists(iter); bl = (struct block_list*)mapit_next(iter) ) {
-			struct map_session_data *sd = ((TBL_PC*)bl);
+			map_session_data *sd = ((TBL_PC*)bl);
 			if( sd && sd->npc_timer_id != INVALID_TIMER ) {
 				const struct TimerData *td = get_timer(sd->npc_timer_id);
 
@@ -3525,10 +3525,10 @@ int npc_unload(struct npc_data* nd, bool single) {
 	}
 
 	if( nd->dynamicnpc.owner_char_id != 0 ){
-		struct map_session_data* owner = map_charid2sd( nd->dynamicnpc.owner_char_id );
+		map_session_data* owner = map_charid2sd( nd->dynamicnpc.owner_char_id );
 
 		if( owner != nullptr ){
-			owner->npc_id_dynamic = 0;
+			util::vector_erase_if_exists(owner->npc_id_dynamic, nd->bl.id);
 		}
 	}
 
@@ -4446,7 +4446,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
 /// shop/cashshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>
 /// npc: -%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
 /// npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
-const char* npc_parse_duplicate( char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, struct map_session_data* owner = nullptr ){
+const char* npc_parse_duplicate( char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, map_session_data* owner = nullptr ){
 	short x, y, m, xs = -1, ys = -1;
 	int16 dir;
 	char srcname[128];
@@ -4515,7 +4515,7 @@ const char* npc_parse_duplicate( char* w1, char* w2, char* w3, char* w4, const c
 
 	if( owner != nullptr ){
 		nd->dynamicnpc.owner_char_id = owner->status.char_id;
-		owner->npc_id_dynamic = nd->bl.id;
+		owner->npc_id_dynamic.push_back(nd->bl.id);
 	}
 
 	switch( type ) {
@@ -4995,7 +4995,7 @@ void npc_setclass(struct npc_data* nd, short class_)
 }
 
 // @commands (script based)
-int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const char* message, const char* eventname)
+int npc_do_atcmd_event(map_session_data* sd, const char* command, const char* message, const char* eventname)
 {
 	struct event_data* ev = (struct event_data*)strdb_get(ev_db, eventname);
 	struct npc_data *nd;
@@ -5118,7 +5118,7 @@ void npc_parse_mob2(struct spawn_data* mob)
 
 static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 {
-	int num, mob_id, mob_lv = -1, size = -1, w1count;
+	int num, mob_id, mob_lv = -1, delay = 5000, size = -1, w1count, w4count;
 	short m, x = 0, y = 0, xs = -1, ys = -1;
 	char mapname[MAP_NAME_LENGTH_EXT], mobname[NAME_LENGTH], sprite[NAME_LENGTH];
 	struct spawn_data mob, *data;
@@ -5133,7 +5133,7 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
 	// w4=<mob id>,<amount>{,<delay1>{,<delay2>{,<event>{,<mob size>{,<mob ai>}}}}}
 	if( ( w1count = sscanf(w1, "%15[^,],%6hd,%6hd,%6hd,%6hd", mapname, &x, &y, &xs, &ys) ) < 1
 	||	sscanf(w3, "%23[^,],%11d", mobname, &mob_lv) < 1
-	||	sscanf(w4, "%23[^,],%11d,%11u,%11u,%77[^,],%11d,%11d[^\t\r\n]", sprite, &num, &mob.delay1, &mob.delay2, mob.eventname, &size, &ai) < 2 )
+	||	( w4count = sscanf(w4, "%23[^,],%11d,%11u,%11u,%77[^,],%11d,%11d[^\t\r\n]", sprite, &num, &delay, &mob.delay2, mob.eventname, &size, &ai) ) < 2 )
 	{
 		ShowError("npc_parse_mob: Invalid mob definition in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
 		return strchr(start,'\n');// skip and continue
@@ -5181,6 +5181,12 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
 		return strchr(start,'\n');// skip and continue
 	}
 
+	if (w4count > 2 && delay != 5000 && delay < battle_config.mob_respawn_time) {
+		ShowWarning("npc_parse_mob: Invalid delay %u for mob ID %d (file '%s', line '%d'), defaulting to 5 seconds.\n", delay, mob_id, filepath, strline(buffer, start - buffer));
+		mob.delay1 = 5000;
+	} else
+		mob.delay1 = delay;
+
 	if( mob.state.size > SZ_BIG && size != -1 )
 	{
 		ShowError("npc_parse_mob: Invalid size number %d for mob ID %d (file '%s', line '%d').\n", mob.state.size, mob_id, filepath, strline(buffer, start - buffer));
@@ -5692,7 +5698,7 @@ int npc_parsesrcfile(const char* filepath)
 	return 1;
 }
 
-int npc_script_event(struct map_session_data* sd, enum npce_event type){
+int npc_script_event(map_session_data* sd, enum npce_event type){
 	if (type == NPCE_MAX)
 		return 0;
 	if (!sd) {
@@ -5720,7 +5726,7 @@ int npc_script_event(struct map_session_data* sd, enum npce_event type){
  * dir: Facing direction of duplicate NPC
  * Returns duplicate NPC data on success
  */
-npc_data* npc_duplicate_npc( npc_data& nd, char name[NPC_NAME_LENGTH + 1], int16 mapid, int16 x, int16 y, int class_, uint8 dir, int16 xs, int16 ys, struct map_session_data* owner ){
+npc_data* npc_duplicate_npc( npc_data& nd, char name[NPC_NAME_LENGTH + 1], int16 mapid, int16 x, int16 y, int class_, uint8 dir, int16 xs, int16 ys, map_session_data* owner ){
 	static char w1[128], w2[128], w3[128], w4[128];
 	const char* stat_buf = "- call from duplicate subsystem -\n";
 	char exname[NPC_NAME_LENGTH + 1];
@@ -5772,7 +5778,7 @@ TIMER_FUNC(npc_dynamicnpc_removal_timer){
 
 	nd->dynamicnpc.removal_tid = INVALID_TIMER;
 
-	struct map_session_data* sd = map_charid2sd( nd->dynamicnpc.owner_char_id );
+	map_session_data* sd = map_charid2sd( nd->dynamicnpc.owner_char_id );
 
 	if( sd != nullptr ){
 		// Still talking to the NPC
@@ -5790,7 +5796,7 @@ TIMER_FUNC(npc_dynamicnpc_removal_timer){
 			return 0;
 		}
 
-		sd->npc_id_dynamic = 0;
+		// npc id from sd->npc_id_dynamic is removed in npc_unload
 	}
 
 	// Delete the NPC
@@ -5801,10 +5807,18 @@ TIMER_FUNC(npc_dynamicnpc_removal_timer){
 	return 0;
 }
 
-struct npc_data* npc_duplicate_npc_for_player( struct npc_data& nd, struct map_session_data& sd ){
-	if( sd.npc_id_dynamic != 0 ){
-		clif_msg_color( &sd, C_DYNAMICNPC_TWICE, color_table[COLOR_LIGHT_YELLOW] );
-		return nullptr;
+struct npc_data* npc_duplicate_npc_for_player( struct npc_data& nd, map_session_data& sd ){
+	// A duplicate of a duplicate is still a duplicate of the same NPC
+	int src_id = nd.src_id > 0 ? nd.src_id : nd.bl.id;
+
+	for (const auto &it : sd.npc_id_dynamic) {
+		struct npc_data* src_nd = map_id2nd( it );
+
+		// Check if the source NPC id of currently active duplicates already exists.
+		if( src_nd != nullptr && src_nd->src_id == src_id ){
+			clif_dynamicnpc_result( sd, DYNAMICNPC_RESULT_DUPLICATE );
+			return nullptr;
+		}
 	}
 
 	if( map_getmapflag( sd.bl.m, MF_NODYNAMICNPC ) ){

+ 24 - 24
src/map/npc.hpp

@@ -141,7 +141,7 @@ struct npc_data {
 	struct block_list bl;
 	struct unit_data ud; //Because they need to be able to move....
 	struct view_data vd;
-	struct status_change sc; //They can't have status changes, but.. they want the visual opt values.
+	status_change sc; //They can't have status changes, but.. they want the visual opt values.
 	struct npc_data *master_nd;
 	short class_,speed;
 	char name[NPC_NAME_LENGTH+1];// display name
@@ -1481,33 +1481,33 @@ enum e_npcv_status : uint8 {
 };
 struct view_data* npc_get_viewdata(int class_);
 int npc_chat_sub(struct block_list* bl, va_list ap);
-int npc_event_dequeue(struct map_session_data* sd,bool free_script_stack=true);
-int npc_event(struct map_session_data* sd, const char* eventname, int ontouch);
-int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y, struct npc_data* nd);
-int npc_touch_area_allnpc(struct map_session_data* sd, int16 m, int16 x, int16 y);
+int npc_event_dequeue(map_session_data* sd,bool free_script_stack=true);
+int npc_event(map_session_data* sd, const char* eventname, int ontouch);
+int npc_touch_areanpc(map_session_data* sd, int16 m, int16 x, int16 y, struct npc_data* nd);
+int npc_touch_area_allnpc(map_session_data* sd, int16 m, int16 x, int16 y);
 int npc_touch_areanpc2(struct mob_data *md); // [Skotlex]
 int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range);
-int npc_touchnext_areanpc(struct map_session_data* sd,bool leavemap);
-int npc_click(struct map_session_data* sd, struct npc_data* nd);
-bool npc_scriptcont(struct map_session_data* sd, int id, bool closing);
-struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl);
-int npc_buysellsel(struct map_session_data* sd, int id, int type);
-e_purchase_result npc_buylist(struct map_session_data* sd, std::vector<s_npc_buy_list>& item_list);
-static int npc_buylist_sub(struct map_session_data* sd, std::vector<s_npc_buy_list>& item_list, struct npc_data* nd);
-uint8 npc_selllist(struct map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list);
-e_purchase_result npc_barter_purchase( struct map_session_data& sd, std::shared_ptr<s_npc_barter> barter, std::vector<s_barter_purchase>& purchases );
+int npc_touchnext_areanpc(map_session_data* sd,bool leavemap);
+int npc_click(map_session_data* sd, struct npc_data* nd);
+bool npc_scriptcont(map_session_data* sd, int id, bool closing);
+struct npc_data* npc_checknear(map_session_data* sd, struct block_list* bl);
+int npc_buysellsel(map_session_data* sd, int id, int type);
+e_purchase_result npc_buylist(map_session_data* sd, std::vector<s_npc_buy_list>& item_list);
+static int npc_buylist_sub(map_session_data* sd, std::vector<s_npc_buy_list>& item_list, struct npc_data* nd);
+uint8 npc_selllist(map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEMLIST_sub* item_list);
+e_purchase_result npc_barter_purchase( map_session_data& sd, std::shared_ptr<s_npc_barter> barter, std::vector<s_barter_purchase>& purchases );
 void npc_parse_mob2(struct spawn_data* mob);
 struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y);
 int npc_globalmessage(const char* name,const char* mes);
 const char *npc_get_script_event_name(int npce_index);
-npc_data* npc_duplicate_npc( npc_data& nd, char name[NPC_NAME_LENGTH + 1], int16 mapid, int16 x, int16 y, int class_, uint8 dir, int16 xs, int16 ys, struct map_session_data* owner = nullptr );
-struct npc_data* npc_duplicate_npc_for_player( struct npc_data& nd, struct map_session_data& sd );
+npc_data* npc_duplicate_npc( npc_data& nd, char name[NPC_NAME_LENGTH + 1], int16 mapid, int16 x, int16 y, int class_, uint8 dir, int16 xs, int16 ys, map_session_data* owner = nullptr );
+struct npc_data* npc_duplicate_npc_for_player( struct npc_data& nd, map_session_data& sd );
 
 void npc_setcells(struct npc_data* nd);
 void npc_unsetcells(struct npc_data* nd);
 bool npc_movenpc(struct npc_data* nd, int16 x, int16 y);
-bool npc_is_cloaked(struct npc_data* nd, struct map_session_data* sd);
-bool npc_is_hidden_dynamicnpc( struct npc_data& nd, struct map_session_data& tsd );
+bool npc_is_cloaked(struct npc_data* nd, map_session_data* sd);
+bool npc_is_hidden_dynamicnpc( struct npc_data& nd, map_session_data& tsd );
 bool npc_enable_target(npc_data& nd, uint32 char_id, e_npcv_status flag);
 #define npc_enable(nd, flag) npc_enable_target(nd, 0, flag)
 void npc_setdisplayname(struct npc_data* nd, const char* newname);
@@ -1535,7 +1535,7 @@ int npc_event_doall_path(const char* event_name, const char* path);
 
 int npc_timerevent_start(struct npc_data* nd, int rid);
 int npc_timerevent_stop(struct npc_data* nd);
-void npc_timerevent_quit(struct map_session_data* sd);
+void npc_timerevent_quit(map_session_data* sd);
 t_tick npc_gettimerevent_tick(struct npc_data* nd);
 int npc_settimerevent_tick(struct npc_data* nd, int newtimer);
 int npc_remove_map(struct npc_data* nd);
@@ -1543,18 +1543,18 @@ void npc_unload_duplicates (struct npc_data* nd);
 int npc_unload(struct npc_data* nd, bool single);
 int npc_reload(void);
 void npc_read_event_script(void);
-int npc_script_event(struct map_session_data* sd, enum npce_event type);
+int npc_script_event(map_session_data* sd, enum npce_event type);
 
 int npc_duplicate4instance(struct npc_data *snd, int16 m);
 int npc_instanceinit(struct npc_data* nd);
 int npc_instancedestroy(struct npc_data* nd);
-int npc_cashshop_buy(struct map_session_data *sd, t_itemid nameid, int amount, int points);
+int npc_cashshop_buy(map_session_data *sd, t_itemid nameid, int amount, int points);
 
-void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, int cost[2], bool display);
+void npc_shop_currency_type(map_session_data *sd, struct npc_data *nd, int cost[2], bool display);
 
 extern struct npc_data* fake_nd;
 
-int npc_cashshop_buylist( struct map_session_data *sd, int points, std::vector<s_npc_buy_list>& item_list );
+int npc_cashshop_buylist( map_session_data *sd, int points, std::vector<s_npc_buy_list>& item_list );
 bool npc_shop_discount(struct npc_data* nd);
 
 #if PACKETVER >= 20131223
@@ -1567,7 +1567,7 @@ void npc_market_delfromsql_(const char *exname, t_itemid nameid, bool clear);
 #endif
 
 // @commands (script-based)
-int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const char* message, const char* eventname);
+int npc_do_atcmd_event(map_session_data* sd, const char* command, const char* message, const char* eventname);
 
 bool npc_unloadfile( const char* path );
 

+ 3 - 3
src/map/npc_chat.cpp

@@ -13,7 +13,7 @@
 #include "../common/timer.hpp"
 
 #include "mob.hpp" // struct mob_data
-#include "pc.hpp" // struct map_session_data
+#include "pc.hpp" // map_session_data
 
 /**
  *  Written by MouseJstr in a vision... (2/21/2005)
@@ -344,7 +344,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
 	struct npc_parse* npcParse = (struct npc_parse *) nd->chatdb;
 	char* msg;
 	int len, i;
-	struct map_session_data* sd;
+	map_session_data* sd;
 	struct npc_label_list* lst;
 	struct pcrematch_set* pcreset;
 	struct pcrematch_entry* e;
@@ -355,7 +355,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
 	
 	msg = va_arg(ap,char*);
 	len = va_arg(ap,int);
-	sd = va_arg(ap,struct map_session_data *);
+	sd = va_arg(ap,map_session_data *);
 	
 	// iterate across all active sets
 	for (pcreset = npcParse->active; pcreset != NULL; pcreset = pcreset->next)

+ 12 - 0
src/map/packets.hpp

@@ -413,6 +413,16 @@ struct PACKET_ZC_ACK_ADD_EXCHANGE_ITEM {
 	uint8 result;
 } __attribute__((packed));
 
+struct PACKET_ZC_COUPLENAME {
+	int16 packetType;
+	char name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct PACKET_ZC_DYNAMICNPC_CREATE_RESULT{
+	int16 packetType;
+	int32 result;
+} __attribute__((packed));
+
 #if PACKETVER_MAIN_NUM >= 20140508 || PACKETVER_RE_NUM >= 20140508 || defined(PACKETVER_ZERO)
 struct PACKET_ZC_GOLDPCCAFE_POINT{
 	int16 packetType;
@@ -456,6 +466,7 @@ DEFINE_PACKET_HEADER(ZC_BROADCAST2, 0x1c3)
 #else
 	DEFINE_PACKET_HEADER(ZC_CHANGE_GUILD, 0x1b4)
 #endif
+DEFINE_PACKET_HEADER(ZC_COUPLENAME, 0x1e6);
 DEFINE_PACKET_HEADER(ZC_FRIENDS_LIST, 0x201)
 DEFINE_PACKET_HEADER(ZC_NOTIFY_WEAPONITEMLIST, 0x221)
 DEFINE_PACKET_HEADER(ZC_ACK_WEAPONREFINE, 0x223)
@@ -482,6 +493,7 @@ DEFINE_PACKET_HEADER(ZC_ACK_COUNT_BARGAIN_SALE_ITEM, 0x9c4)
 DEFINE_PACKET_HEADER(ZC_ACK_GUILDSTORAGE_LOG, 0x9da)
 DEFINE_PACKET_HEADER(ZC_GOLDPCCAFE_POINT, 0xa15)
 DEFINE_PACKET_HEADER(CZ_DYNAMICNPC_CREATE_REQUEST, 0xa16)
+DEFINE_PACKET_HEADER(ZC_DYNAMICNPC_CREATE_RESULT, 0xa17)
 DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM2, 0xa3d)
 DEFINE_PACKET_HEADER(CZ_REQ_STYLE_CHANGE, 0xa46)
 DEFINE_PACKET_HEADER(ZC_STYLE_CHANGE_RES, 0xa47)

+ 40 - 40
src/map/party.cpp

@@ -39,7 +39,7 @@ int party_create_byscript;
  * Fills the given party_member structure according to the sd provided.
  * Used when creating/adding people to a party. [Skotlex]
  *------------------------------------------*/
-static void party_fill_member(struct party_member* member, struct map_session_data* sd, unsigned int leader)
+static void party_fill_member(struct party_member* member, map_session_data* sd, unsigned int leader)
 {
   	member->account_id = sd->status.account_id;
 	member->char_id    = sd->status.char_id;
@@ -53,7 +53,7 @@ static void party_fill_member(struct party_member* member, struct map_session_da
 
 /// Get the member_id of a party member.
 /// Return -1 if not in party.
-int party_getmemberid(struct party_data* p, struct map_session_data* sd)
+int party_getmemberid(struct party_data* p, map_session_data* sd)
 {
 	int member_id;
 	nullpo_retr(-1, p);
@@ -70,7 +70,7 @@ int party_getmemberid(struct party_data* p, struct map_session_data* sd)
 /*==========================================
  * Request an available sd of this party
  *------------------------------------------*/
-struct map_session_data* party_getavailablesd(struct party_data *p)
+map_session_data* party_getavailablesd(struct party_data *p)
 {
 	int i;
 	nullpo_retr(NULL, p);
@@ -141,7 +141,7 @@ struct party_data* party_searchname(const char* str)
 	return p;
 }
 
-int party_create(struct map_session_data *sd,char *name,int item,int item2)
+int party_create(map_session_data *sd,char *name,int item,int item2)
 {
 	struct party_member leader;
 	char tname[NAME_LENGTH];
@@ -165,7 +165,7 @@ int party_create(struct map_session_data *sd,char *name,int item,int item2)
 
 void party_created(uint32 account_id,uint32 char_id,int fail,int party_id,char *name)
 {
-	struct map_session_data *sd;
+	map_session_data *sd;
 
 	sd = map_id2sd(account_id);
 
@@ -201,7 +201,7 @@ int party_request_info(int party_id, uint32 char_id)
  * Close trade window if party member is kicked when trade a party bound item
  * @param sd
  **/
-static void party_trade_bound_cancel(struct map_session_data *sd) {
+static void party_trade_bound_cancel(map_session_data *sd) {
 #ifdef BOUND_ITEMS
 	nullpo_retv(sd);
 	if (sd->state.isBoundTrading&(1<<BOUND_PARTY))
@@ -216,7 +216,7 @@ int party_recv_noinfo(int party_id, uint32 char_id)
 {
 	party_broken(party_id);
 	if( char_id != 0 ) { // requester
-		struct map_session_data* sd;
+		map_session_data* sd;
 
 		sd = map_charid2sd(char_id);
 
@@ -271,7 +271,7 @@ int party_recv_info(struct party* sp, uint32 char_id)
 {
 	struct party_data* p;
 	struct party_member* member;
-	struct map_session_data* sd;
+	map_session_data* sd;
 	int removed[MAX_PARTY];// member_id in old data
 	int removed_count = 0;
 	int added[MAX_PARTY];// member_id in new data
@@ -382,7 +382,7 @@ int party_recv_info(struct party* sp, uint32 char_id)
 }
 
 ///! TODO: Party invitation cross map-server through inter-server, so does with the reply.
-int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
+int party_invite(map_session_data *sd,map_session_data *tsd)
 {
 	struct party_data *p;
 	int i;
@@ -452,9 +452,9 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
 	return 1;
 }
 
-int party_reply_invite(struct map_session_data *sd,int party_id,int flag)
+int party_reply_invite(map_session_data *sd,int party_id,int flag)
 {
-	struct map_session_data* tsd;
+	map_session_data* tsd;
 	struct party_member member;
 
 	if( sd->party_invite != party_id ) { // forged
@@ -493,7 +493,7 @@ int party_reply_invite(struct map_session_data *sd,int party_id,int flag)
 //- Loads up party data if not in server
 //- Sets up the pointer to him
 //- Player must be authed/active and belong to a party before calling this method
-void party_member_joined(struct map_session_data *sd)
+void party_member_joined(map_session_data *sd)
 {
 	struct party_data* p = party_search(sd->status.party_id);
 	int i;
@@ -515,7 +515,7 @@ void party_member_joined(struct map_session_data *sd)
 /// flag: 0-success, 1-failure
 int party_member_added(int party_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 party_data *p = party_search(party_id);
 	int i;
 
@@ -570,7 +570,7 @@ int party_member_added(int party_id,uint32 account_id,uint32 char_id, int flag)
 }
 
 /// Party member 'sd' requesting kick of member with <account_id, name>.
-int party_removemember(struct map_session_data* sd, uint32 account_id, char* name)
+int party_removemember(map_session_data* sd, uint32 account_id, char* name)
 {
 	struct party_data *p;
 	int i;
@@ -597,7 +597,7 @@ int party_removemember(struct map_session_data* sd, uint32 account_id, char* nam
 	return 1;
 }
 
-int party_removemember2(struct map_session_data *sd,uint32 char_id,int party_id)
+int party_removemember2(map_session_data *sd,uint32 char_id,int party_id)
 {
 	if( sd ) {
 		if( !sd->status.party_id )
@@ -622,7 +622,7 @@ int party_removemember2(struct map_session_data *sd,uint32 char_id,int party_id)
 }
 
 /// Party member 'sd' requesting exit from party.
-int party_leave(struct map_session_data *sd)
+int party_leave(map_session_data *sd)
 {
 	struct party_data *p;
 	int i;
@@ -644,11 +644,11 @@ int party_leave(struct map_session_data *sd)
 /// Invoked (from char-server) when a party member leaves the party.
 int party_member_withdraw(int party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type)
 {
-	struct map_session_data* sd = map_charid2sd(char_id);
+	map_session_data* sd = map_charid2sd(char_id);
 	struct party_data* p = party_search(party_id);
 
 	if( p ) {
-		struct map_session_data* party_sd = party_getavailablesd( p );
+		map_session_data* party_sd = party_getavailablesd( p );
 
 		if( party_sd != nullptr ){
 			clif_party_withdraw( *party_sd, account_id, name, type, PARTY );
@@ -721,7 +721,7 @@ int party_broken(int party_id)
 	return 1;
 }
 
-int party_changeoption(struct map_session_data *sd,int exp,int item)
+int party_changeoption(map_session_data *sd,int exp,int item)
 {
 	nullpo_ret(sd);
 
@@ -767,7 +767,7 @@ int party_setoption(struct party_data *party, int option, int flag)
 int party_optionchanged(int party_id,uint32 account_id,int exp,int item,int flag)
 {
 	struct party_data *p;
-	struct map_session_data *sd=map_id2sd(account_id);
+	map_session_data *sd=map_id2sd(account_id);
 
 	if( (p = party_search(party_id)) == NULL)
 		return 0;
@@ -784,7 +784,7 @@ int party_optionchanged(int party_id,uint32 account_id,int exp,int item,int flag
 	return 0;
 }
 
-int party_changeleader(struct map_session_data *sd, struct map_session_data *tsd, struct party_data *p)
+int party_changeleader(map_session_data *sd, map_session_data *tsd, struct party_data *p)
 {
 	int mi, tmi;
 
@@ -882,7 +882,7 @@ int party_recv_movemap(int party_id,uint32 account_id,uint32 char_id, unsigned s
 	return 0;
 }
 
-void party_send_movemap(struct map_session_data *sd)
+void party_send_movemap(map_session_data *sd)
 {
 	struct party_data *p;
 
@@ -916,12 +916,12 @@ void party_send_movemap(struct map_session_data *sd)
 	return;
 }
 
-void party_send_levelup(struct map_session_data *sd)
+void party_send_levelup(map_session_data *sd)
 {
 	intif_party_changemap(sd,1);
 }
 
-int party_send_logout(struct map_session_data *sd)
+int party_send_logout(map_session_data *sd)
 {
 	struct party_data *p;
 	int i;
@@ -942,7 +942,7 @@ int party_send_logout(struct map_session_data *sd)
 	return 1;
 }
 
-int party_send_message(struct map_session_data *sd,const char *mes,int len)
+int party_send_message(map_session_data *sd,const char *mes,int len)
 {
 	if(sd->status.party_id == 0)
 		return 0;
@@ -964,10 +964,10 @@ int party_recv_message(int party_id,uint32 account_id,const char *mes,int len)
 	return 0;
 }
 
-int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv)
+int party_skill_check(map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv)
 {
 	struct party_data *p;
-	struct map_session_data *p_sd;
+	map_session_data *p_sd;
 	int i;
 
 	if(!party_id || (p = party_search(party_id)) == NULL)
@@ -1006,7 +1006,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
 				break;
 			case MO_COMBOFINISH: //Increase Counter rate of Star Gladiators
 				if((p_sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR
-					&& p_sd->sc.data[SC_READYCOUNTER]
+					&& p_sd->sc.getSCE(SC_READYCOUNTER)
 					&& pc_checkskill(p_sd,SG_FRIEND)) {
 					sc_start4(&p_sd->bl,&p_sd->bl,SC_SKILLRATE_UP,100,TK_COUNTER,
 						50+50*pc_checkskill(p_sd,SG_FRIEND), //+100/150/200% rate
@@ -1033,7 +1033,7 @@ TIMER_FUNC(party_send_xy_timer){
 
 		// for each member of this party
 		for( i = 0; i < MAX_PARTY; i++ ) {
-			struct map_session_data* sd = p->data[i].sd;
+			map_session_data* sd = p->data[i].sd;
 
 			if( !sd )
 				continue;
@@ -1082,7 +1082,7 @@ int party_send_xy_clear(struct party_data *p)
  **/
 void party_exp_share(struct party_data* p, struct block_list* src, t_exp base_exp, t_exp job_exp, int zeny)
 {
-	struct map_session_data* sd[MAX_PARTY];
+	map_session_data* sd[MAX_PARTY];
 	unsigned int i, c;
 #ifdef RENEWAL_EXP
 	TBL_MOB *md = BL_CAST(BL_MOB, src);
@@ -1140,7 +1140,7 @@ void party_exp_share(struct party_data* p, struct block_list* src, t_exp base_ex
 }
 
 //Does party loot. first_charid holds the charid of the player who has time priority to take the item.
-int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item, int first_charid)
+int party_share_loot(struct party_data* p, map_session_data* sd, struct item* item, int first_charid)
 {
 	TBL_PC* target = NULL;
 	int i;
@@ -1207,7 +1207,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
 	return 0;
 }
 
-int party_send_dot_remove(struct map_session_data *sd)
+int party_send_dot_remove(map_session_data *sd)
 {
 	if (sd->status.party_id)
 		clif_party_xy_remove(sd);
@@ -1223,7 +1223,7 @@ int party_send_dot_remove(struct map_session_data *sd)
  */
 int party_sub_count(struct block_list *bl, va_list ap)
 {
-	struct map_session_data *sd = (TBL_PC *)bl;
+	map_session_data *sd = (TBL_PC *)bl;
 
 	if (sd->state.autotrade)
 		return 0;
@@ -1242,7 +1242,7 @@ int party_sub_count(struct block_list *bl, va_list ap)
  */
 int party_sub_count_class(struct block_list *bl, va_list ap)
 {
-	struct map_session_data *sd = (TBL_PC *)bl;
+	map_session_data *sd = (TBL_PC *)bl;
 	unsigned int mask = va_arg(ap, unsigned int);
 	unsigned int mapid_class = va_arg(ap, unsigned int);
 
@@ -1256,7 +1256,7 @@ int party_sub_count_class(struct block_list *bl, va_list ap)
 }
 
 /// Executes 'func' for each party member on the same map and in range (0:whole map)
-int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_session_data *sd,int range,...)
+int party_foreachsamemap(int (*func)(struct block_list*,va_list),map_session_data *sd,int range,...)
 {
 	struct party_data *p;
 	int i;
@@ -1276,7 +1276,7 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_sess
 	y1 = sd->bl.y+range;
 
 	for(i = 0; i < MAX_PARTY; i++) {
-		struct map_session_data *psd = p->data[i].sd;
+		map_session_data *psd = p->data[i].sd;
 
 		if(!psd)
 			continue;
@@ -1319,7 +1319,7 @@ static struct party_booking_ad_info* create_party_booking_data(void)
 	return pb_ad;
 }
 
-void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job)
+void party_booking_register(map_session_data *sd, short level, short mapid, short* job)
 {
 	struct party_booking_ad_info *pb_ad;
 	int i;
@@ -1348,7 +1348,7 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi
 	clif_PartyBookingInsertNotify(sd, pb_ad); // Notice
 }
 
-void party_booking_update(struct map_session_data *sd, short* job)
+void party_booking_update(map_session_data *sd, short* job)
 {
 	int i;
 	struct party_booking_ad_info *pb_ad;
@@ -1369,7 +1369,7 @@ void party_booking_update(struct map_session_data *sd, short* job)
 	clif_PartyBookingUpdateNotify(sd, pb_ad);
 }
 
-void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount)
+void party_booking_search(map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount)
 {
 	struct party_booking_ad_info *pb_ad;
 	int i, count=0;
@@ -1407,7 +1407,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
 	clif_PartyBookingSearchAck(sd->fd, result_list, count, more_result);
 }
 
-bool party_booking_delete(struct map_session_data *sd)
+bool party_booking_delete(map_session_data *sd)
 {
 	struct party_booking_ad_info* pb_ad;
 

+ 25 - 25
src/map/party.hpp

@@ -9,7 +9,7 @@
 #include "../common/mmo.hpp" // struct party
 
 struct block_list;
-struct map_session_data;
+class map_session_data;
 struct party;
 struct item;
 
@@ -17,7 +17,7 @@ struct item;
 #define MAX_PARTY_BOOKING_RESULTS 10
 
 struct party_member_data {
-	struct map_session_data *sd;
+	map_session_data *sd;
 	unsigned int hp; //For HP,x,y refreshing.
 	unsigned short x, y;
 };
@@ -54,49 +54,49 @@ void do_init_party(void);
 void do_final_party(void);
 struct party_data* party_search(int party_id);
 struct party_data* party_searchname(const char* str);
-int party_getmemberid(struct party_data* p, struct map_session_data* sd);
-struct map_session_data* party_getavailablesd(struct party_data *p);
+int party_getmemberid(struct party_data* p, map_session_data* sd);
+map_session_data* party_getavailablesd(struct party_data *p);
 
-int party_create(struct map_session_data *sd,char *name, int item, int item2);
+int party_create(map_session_data *sd,char *name, int item, int item2);
 void party_created(uint32 account_id,uint32 char_id,int fail,int party_id,char *name);
 int party_request_info(int party_id, uint32 char_id);
-int party_invite(struct map_session_data *sd,struct map_session_data *tsd);
-void party_member_joined(struct map_session_data *sd);
+int party_invite(map_session_data *sd,map_session_data *tsd);
+void party_member_joined(map_session_data *sd);
 int party_member_added(int party_id,uint32 account_id,uint32 char_id,int flag);
-int party_leave(struct map_session_data *sd);
-int party_removemember(struct map_session_data *sd,uint32 account_id,char *name);
-int party_removemember2(struct map_session_data *sd,uint32 char_id,int party_id);
+int party_leave(map_session_data *sd);
+int party_removemember(map_session_data *sd,uint32 account_id,char *name);
+int party_removemember2(map_session_data *sd,uint32 char_id,int party_id);
 int party_member_withdraw(int party_id, uint32 account_id, uint32 char_id, char *name, enum e_party_member_withdraw type);
-int party_reply_invite(struct map_session_data *sd,int party_id,int flag);
+int party_reply_invite(map_session_data *sd,int party_id,int flag);
 #define party_add_member(party_id,sd) party_reply_invite(sd,party_id,1)
 int party_recv_noinfo(int party_id, uint32 char_id);
 int party_recv_info(struct party* sp, uint32 char_id);
 int party_recv_movemap(int party_id,uint32 account_id,uint32 char_id, unsigned short map,int online,int lv);
 int party_broken(int party_id);
 int party_optionchanged(int party_id,uint32 account_id,int exp,int item,int flag);
-int party_changeoption(struct map_session_data *sd,int exp,int item);
+int party_changeoption(map_session_data *sd,int exp,int item);
 int party_setoption(struct party_data *party, int option, int flag);
-int party_changeleader(struct map_session_data *sd, struct map_session_data *t_sd, struct party_data *p);
-void party_send_movemap(struct map_session_data *sd);
-void party_send_levelup(struct map_session_data *sd);
-int party_send_logout(struct map_session_data *sd);
-int party_send_message(struct map_session_data *sd,const char *mes,int len);
+int party_changeleader(map_session_data *sd, map_session_data *t_sd, struct party_data *p);
+void party_send_movemap(map_session_data *sd);
+void party_send_levelup(map_session_data *sd);
+int party_send_logout(map_session_data *sd);
+int party_send_message(map_session_data *sd,const char *mes,int len);
 int party_recv_message(int party_id,uint32 account_id,const char *mes,int len);
-int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv);
+int party_skill_check(map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv);
 int party_send_xy_clear(struct party_data *p);
 void party_exp_share(struct party_data *p,struct block_list *src,t_exp base_exp,t_exp job_exp,int zeny);
-int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item, int first_charid);
-int party_send_dot_remove(struct map_session_data *sd);
+int party_share_loot(struct party_data* p, map_session_data* sd, struct item* item, int first_charid);
+int party_send_dot_remove(map_session_data *sd);
 int party_sub_count(struct block_list *bl, va_list ap);
 int party_sub_count_class(struct block_list *bl, va_list ap);
-int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int range,...);
+int party_foreachsamemap(int (*func)(struct block_list *,va_list),map_session_data *sd,int range,...);
 
 /*==========================================
  * Party Booking in KRO [Spiria]
  *------------------------------------------*/
-void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job);
-void party_booking_update(struct map_session_data *sd, short* job);
-void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount);
-bool party_booking_delete(struct map_session_data *sd);
+void party_booking_register(map_session_data *sd, short level, short mapid, short* job);
+void party_booking_update(map_session_data *sd, short* job);
+void party_booking_search(map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount);
+bool party_booking_delete(map_session_data *sd);
 
 #endif /* PARTY_HPP */

+ 8 - 0
src/map/path.cpp

@@ -514,3 +514,11 @@ int distance_client(int dx, int dy)
 bool direction_diagonal( enum directions direction ){
 	return direction == DIR_NORTHWEST || direction == DIR_SOUTHWEST || direction == DIR_SOUTHEAST || direction == DIR_NORTHEAST;
 }
+
+bool direction_opposite( enum directions direction ){
+	if( direction == DIR_CENTER || direction == DIR_MAX ){
+		return direction;
+	}else{
+		return static_cast<enum directions>( ( direction + DIR_MAX / 2 ) % DIR_MAX );
+	}
+}

+ 1 - 0
src/map/path.hpp

@@ -69,6 +69,7 @@ bool check_distance_client(int dx, int dy, int distance);
 int distance_client(int dx, int dy);
 
 bool direction_diagonal( enum directions direction );
+bool direction_opposite( enum directions direction );
 
 //
 void do_init_path();

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 153 - 150
src/map/pc.cpp


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott