浏览代码

* Some serious code cleanups
- adjusted @reloadbattleconf to not depend on variable ordering
- changed all battle vars to 'int' (removes pointless duplicit coding)
- added min, max and default columns to battle config data structure
- added properly bounded values for these columns (or at least tried to)
- battle-conf loading will now complain if it finds unknown settings,
and will reject values that are outside of the allowed range
- added CHATROOM_TITLE_SIZE and CHATROOM_PASS_SIZE
- partially cleaned up chatroom manipulation code
* Fixed 'Job_Professer' typo in mage jobchange quest

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11017 54d463be-8e91-2dee-dedb-b68131a5f0ec

ultramage 18 年之前
父节点
当前提交
56d9a037a6

+ 10 - 0
Changelog-Trunk.txt

@@ -3,6 +3,16 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/08/15
+	* Some serious code cleanups
+	- adjusted @reloadbattleconf to not depend on variable ordering
+	- changed all battle vars to 'int' (removes pointless duplicit coding)
+	- added min, max and default columns to battle config data structure
+	- added properly bounded values for these columns (or at least tried to)
+	- battle-conf loading will now complain if it finds unknown settings,
+	  and will reject values that are outside of the allowed range
+	- added CHATROOM_TITLE_SIZE and CHATROOM_PASS_SIZE 
+	- partially cleaned up chatroom manipulation code
 2007/08/13
 	* Modified map_foreachinrange so that you can also specify the max length
 	  of the path to use. The max_count field in the skill_db is used to specify

+ 3 - 0
conf-tmpl/Changelog.txt

@@ -1,5 +1,8 @@
 Date	Added
 
+2007/08/15
+	* Removed useless 'party_skill_penalty' config option
+	* Removed 'Note 3' & 'Other information' since it doesn't apply anymore
 2007/07/28
 	* Removed useless refine_posword setting from script_athena.conf
 2007/07/25

+ 8 - 12
conf-tmpl/battle/battle.conf

@@ -17,21 +17,17 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: Value is a bit field. If no description is given,
+// Note 3: Value is a bit field. If no description is given,
 //         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
-// Who should have a baseatk value (makes str affect damage)? (Note 4)
+// Who should have a baseatk value (makes str affect damage)? (Note 3)
 enable_baseatk: 9
 
-// Who can have perfect flee? (Note 4)
+// Who can have perfect flee? (Note 3)
 enable_perfect_flee: 1
 
-// Who can have critical attacks? (Note 4)
+// Who can have critical attacks? (Note 3)
 // (Note that there are some skills that always do critical hit regardless of this)
 enable_critical: 1
 
@@ -83,7 +79,7 @@ max_hitrate: 100
 // 2 = agi_penalty_num is reduced from FLEE as an exact amount
 agi_penalty_type: 1
 
-// When agi penalty is enabled, to whom it should apply to? (Note 4)
+// When agi penalty is enabled, to whom it should apply to? (Note 3)
 // By default, only players get the penalty.
 agi_penalty_target: 1
 
@@ -99,7 +95,7 @@ agi_penalty_num: 10
 // 2 = vit_penalty_num is reduced from FLEE as an exact amount
 vit_penalty_type: 1
 
-// When vit penalty is enabled, to whom it should apply to? (Note 4)
+// When vit penalty is enabled, to whom it should apply to? (Note 3)
 // By default, only players get the penalty.
 vit_penalty_target: 1
 
@@ -132,11 +128,11 @@ agi_penalty_count_lv: 2
 // 4+: None of the above, count will always be 0
 vit_penalty_count_lv: 3
 
-// Change attacker's direction to face opponent on every attack? (Note 4)
+// Change attacker's direction to face opponent on every attack? (Note 3)
 attack_direction_change: 15
 
 // For those who is set, attacks of Neutral element will not get any elemental
-// adjustment (100% versus on all defense-elements) (Note 4)
+// adjustment (100% versus on all defense-elements) (Note 3)
 // NOTE: This is the setting that makes it so non-players can hit for full
 // damage against Ghost-type targets (eg: Ghostring wearing players).
 attack_attr_none: 14

+ 0 - 4
conf-tmpl/battle/client.conf

@@ -17,10 +17,6 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // Set here which client version do you accept. Add all values of clients:

+ 8 - 12
conf-tmpl/battle/drops.conf

@@ -17,41 +17,37 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // If an item is dropped, does it go stright into the users inventory? (Note 1)
 item_auto_get: no
 
-// How long does it take for an item to disappear from the floor after it is dropped? (in miliseconds) [Note 3]
+// How long does it take for an item to disappear from the floor after it is dropped? (in miliseconds)
 flooritem_lifetime: 60000
 
-// Grace time during which only the person who did the most damage to a monster can get the item? (in milliseconds) (Note 3)
+// Grace time during which only the person who did the most damage to a monster can get the item? (in milliseconds)
 item_first_get_time: 3000
 
-// Grace time during which only the first and second person who did the most damage to a monster can get the item? (in milliseconds) (Note 3)
+// Grace time during which only the first and second person who did the most damage to a monster can get the item? (in milliseconds)
 // (Takes effect after item_first_get_time elapses)
 item_second_get_time: 1000
 
-// Grace time during which only the first, second and third person who did the most damage to a monster can get the item? (in milliseconds) (Note 3)
+// Grace time during which only the first, second and third person who did the most damage to a monster can get the item? (in milliseconds)
 // (Takes effect after the item_second_get_time elapses)
 item_third_get_time: 1000
 
-// Grace time to apply to MvP reward items when the Most Valuable Player can't get the prize item and it drops on the ground? (in milliseconds) (Note 3)
+// Grace time to apply to MvP reward items when the Most Valuable Player can't get the prize item and it drops on the ground? (in milliseconds)
 mvp_item_first_get_time: 10000
 
-// Grace time for the first and second MvP so they can get the item? (in milliseconds) (Note 3)
+// Grace time for the first and second MvP so they can get the item? (in milliseconds)
 // (Takes effect after mvp_item_first_get_time elapses)
 mvp_item_second_get_time: 10000
 
-// Grace time for the first, second and third MvP so they can get the item? (in milliseconds) (Note 3)
+// Grace time for the first, second and third MvP so they can get the item? (in milliseconds)
 // (Takes effect after mvp_item_second_get_time elapses)
 mvp_item_third_get_time: 2000
 
-// Item drop rates (Note 2) (Note 3 applies to the rate settings only)
+// Item drop rates (Note 2)
 
 // The rate the common items are dropped (Items that are in the ETC tab, besides card)
 item_rate_common: 100

+ 5 - 10
conf-tmpl/battle/exp.conf

@@ -17,19 +17,14 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: The max level of classes is stored in the exp table.
+// Note 3: The max level of classes is stored in the exp table.
 //         See files db/exp.txt and db/exp2.txt to change them.
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
-//--------------------------------------------------------------
 //--------------------------------------------------------------
 
-// Rate at which exp. is given. (Note 2) (Note 3)
+// Rate at which exp. is given. (Note 2)
 base_exp_rate: 100
 
-// Rate at which job exp. is given. (Note 2) (Note 3)
+// Rate at which job exp. is given. (Note 2)
 job_exp_rate: 100
 
 // Turn this on to allow a player to level up more than once from a kill. (Note 1)
@@ -57,7 +52,7 @@ exp_bonus_attacker: 25
 // (eg: if set at 5, the max bonus is 4*bonus-per-char regardless of attackers)
 exp_bonus_max_attacker: 12
 
-// MVP bonus exp rate. (Note 2) (Note 3)
+// MVP bonus exp rate. (Note 2)
 mvp_exp_rate: 100
 
 // The rate of job exp. from using Heal skill (100 is the same as the heal amount, 200 is double.
@@ -89,7 +84,7 @@ death_penalty_base: 100
 // Job exp. penalty rate (Each 100 is 1% of their exp)
 death_penalty_job: 100
 
-// When a player dies, how much zeny should we penalize them with? (Note 3)
+// When a player dies, how much zeny should we penalize them with?
 // NOTE: It is a percentage of their zeny, so 100 = 1%
 zeny_penalty: 0
 

+ 3 - 8
conf-tmpl/battle/gm.conf

@@ -17,10 +17,6 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // The maximum quantity of monsters that can be summoned per GM command (0 denotes an unlimited quantity)
@@ -59,8 +55,7 @@ atcommand_gm_only: no
 hide_GM_session: no
 
 // Ban people that try trade dupe.
-// Duration of the ban, in minutes (default: 5). Value from 0 to 32767
-// to disable the ban, set 0
+// Duration of the ban, in minutes (default: 5). To disable the ban, set 0.
 ban_hack_trade: 5
 
 // Set here minimum level of a (online) GM that can receive all informations about any player that try to hack, spoof a name, etc.
@@ -76,14 +71,14 @@ hack_info_GM_level: 60
 // default: 20 (first level after normal player or super'normal' player)
 any_warp_GM_min_level: 20
 
-// The minimum level for a GM to be unable to distribyte items.
+// The minimum level for a GM to be unable to distribute items.
 // You should set this to the same level @item is set to in the atcommand.conf
 // NEVER SET THIS VALUE TO 0, or you will block drop/trade for normal players
 gm_cant_drop_min_lv: 1
 
 //The trust level for your GMs. Any GMs ABOVE this level will be able to distribute items
 //ie: Use Storage/Guild Storage, Drop Items, Use Vend, Trade items. 
-gm_cant_drop_max_lv: 98
+gm_cant_drop_max_lv: 0
 
 // Minimum GM level to see the hp of every player? (Default: 60)
 // no/0 can be used to disable it.

+ 1 - 5
conf-tmpl/battle/guild.conf

@@ -17,10 +17,6 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // When making a guild, an Emperium is consumed? (Note 1)
@@ -55,7 +51,7 @@ gvg_misc_attack_damage_rate: 60
 gvg_flee_penalty: 20
 
 // When the emperium is broken during WoE, how long before the removal
-// of monsters/players from the castle? (in miliseconds) (Note 3)
+// of monsters/players from the castle? (in miliseconds)
 gvg_eliminate_time: 7000
 
 // Can the 'Glory of Guild' skill be learnt in the Guild window,

+ 4 - 6
conf-tmpl/battle/homunc.conf

@@ -17,13 +17,11 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
+// Note 3: Value is a bit field. If no description is given,
+//         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
 //--------------------------------------------------------------
 
-// Homunculus setting [Note 4]
+// Homunculus setting (Note 3)
 // Activates various 'quirks' that makes them behave unlike normal characters.
 // 0x001: Can't be targetted by support skills (except for their master)
 // 0x002: Immunity to land skills
@@ -45,4 +43,4 @@ hom_rename: no
 hvan_explosion_intimate: 45000
 
 // Show stat growth to the owner when an Homunculus levels up
-homunculus_show_growth: 0
+homunculus_show_growth: no

+ 3 - 7
conf-tmpl/battle/items.conf

@@ -17,15 +17,11 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: Value is a bit field. If no description is given,
+// Note 3: Value is a bit field. If no description is given,
 //         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
-// The highest value at which an item can be sold via the merchant vend skill. (in zeny) (Note 3)
+// The highest value at which an item can be sold via the merchant vend skill. (in zeny)
 vending_max_value: 1000000000
 
 // Tax to apply to all vending transactions (eg: 10000 = 100%, 50 = 0.50%)
@@ -42,7 +38,7 @@ weapon_produce_rate: 100
 // Prepare Potion success rate. (Note 2)
 potion_produce_rate: 100
 
-// Do produced items have the maker's name on them? (Note 4)
+// Do produced items have the maker's name on them? (Note 3)
 // 0x01: Produced Weapons
 // 0x02: Produced Potions
 // 0x04: Produced Arrows

+ 5 - 9
conf-tmpl/battle/misc.conf

@@ -17,12 +17,8 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: Value is a bit field. If no description is given,
+// Note 3: Value is a bit field. If no description is given,
 //         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // PK Server Mode.  Turns entire server pvp(excluding towns). Experience loss is doubled if killed by another player.
@@ -59,8 +55,8 @@ pk_weapon_attack_damage_rate: 60
 pk_magic_attack_damage_rate: 60
 pk_misc_attack_damage_rate: 60
 
-// Display skill usage/errors in console? (for debug only) (default: off) (Note 4)
-skill_log: 0
+// Display skill usage/errors in console? (for debug only) (default: off) (Note 3)
+skill_log: off
 
 // Display battle log? (for debug only) (default: off) (Note 1)
 battle_log: off
@@ -84,12 +80,12 @@ night_at_start: no
 
 // Define duration in msec of the day (default: 7200000 = 2 hours)
 // Set to 0 to disable day cycle (but not @day GM command).
-// Except 0, minimum is 60000 (1 minute) (Note 3)
+// Except 0, minimum is 60000 (1 minute)
 day_duration: 0
 
 // Define duration in msec of the night (default: 1800000 = 30 min)
 // Set to 0 to disable night cycle (but not @night GM command).
-// Except 0, minimum is 60000 (1 minute) (Note 3)
+// Except 0, minimum is 60000 (1 minute)
 night_duration: 0
 
 // Using duel on pvp-maps

+ 2 - 6
conf-tmpl/battle/monster.conf

@@ -17,12 +17,8 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: Value is a bit field. If no description is given,
+// Note 3: Value is a bit field. If no description is given,
 //         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // [MVP] Summoned monsters HP rate, that is, monsters summoned by an MVP will have this much HP. (Note 2)
@@ -34,7 +30,7 @@ monster_hp_rate: 100
 // The maximum attack speed of a monster
 monster_max_aspd: 199
 
-// Defines various mob AI related settings. [Note 4]
+// Defines various mob AI related settings. (Note 3)
 // 0x001: When enabled mobs will update their target cell every few iterations
 //        (normally they never update their target cell until they reach it while
 //        chasing)

+ 1 - 8
conf-tmpl/battle/party.conf

@@ -17,10 +17,6 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // If someone steals (gank/steal skills), show name in party? (Note 1)
@@ -46,7 +42,7 @@ show_party_share_picker: no
 // 3: 1+2
 party_item_share_type: 0
 
-// Is exp sharing disabled for idle members in the party?
+// Is exp/item sharing disabled for idle members in the party?
 // Set to no, or the amount of seconds (NOT milliseconds) that need to pass before considering
 // a character idle.
 // Characters in a chat/vending are always considered idle.
@@ -56,6 +52,3 @@ idle_no_share: no
 // Give additional experience bonus per party-member involved on even-share parties?
 // (eg: If set to 10, a even-share party of 5 people will receive +40% exp)
 party_even_share_bonus: 0
-
-// If a party uses a skill with penalties do they apply? (Note 1)
-party_skill_penalty: yes

+ 1 - 5
conf-tmpl/battle/pet.conf

@@ -17,12 +17,8 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: Value is a bit field. If no description is given,
+// Note 3: Value is a bit field. If no description is given,
 //         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // Rate for catching pets (Note 2)

+ 7 - 13
conf-tmpl/battle/player.conf

@@ -17,10 +17,6 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // Players' maximum HP rate? (Default is 100)
@@ -46,7 +42,6 @@ player_skillfree: no
 
 // When set to yes, forces skill points gained from 1st class to be put into 1st class
 // skills, and forces novice skill points to be put into the basic skill. (Note 1)
-// Default: yes [Kevin]
 player_skillup_limit: yes
 
 // Quest skills can be learned? (Note 1)
@@ -66,13 +61,13 @@ basic_skill_check: yes
 // If you attack a monster, it will attack you back regaurdless of this setting. (I think)
 player_invincible_time: 5000
 
-// The time interval for HP to restore naturally. (in milliseconds) (Note 3)
+// The time interval for HP to restore naturally. (in milliseconds)
 natural_healhp_interval: 6000
 
-// The time interval for SP to restore naturally. (in milliseconds) (Note 3)
+// The time interval for SP to restore naturally. (in milliseconds)
 natural_healsp_interval: 8000
 
-// Automatic healing skill's time interval. (in milliseconds) (Note 3)
+// Automatic healing skill's time interval. (in milliseconds)
 natural_heal_skill_interval: 10000
 
 // The maximum weight for a character to carry when the character stops healing naturally. (in %)
@@ -84,10 +79,10 @@ max_aspd: 190
 // Maximum walk speed rate (200 would be capped to twice the normal speed)
 max_walk_speed: 300
 
-// Maximum HP. (Default is 1000000) (Note 3)
+// Maximum HP. (Default is 1000000)
 max_hp: 1000000
 
-// Maximum SP. (Default is 1000000) (Note 3)
+// Maximum SP. (Default is 1000000)
 max_sp: 1000000
 
 // Max limit of char stats. (agi, str, etc.)
@@ -107,7 +102,7 @@ max_def: 99
 // (eg: if set to 10, every armor point above the max becomes 10 vit defense points)
 over_def_bonus: 0
 
-// Max weight carts can hold. (Note 3)
+// Max weight carts can hold.
 max_cart_weight: 8000
 
 // Prevent logout of players after being hit for how long (in ms, 0 disables)?
@@ -124,8 +119,7 @@ show_hp_sp_gain: yes
 // NOTE: this setting only enables friend auto-adding; auto-deletion does not work yet
 friend_auto_add: yes
 
-// Are other requests accepted during [various things[party,guild]] a request or not?
-// It does not accept by no accepted by yes.
+// Are simultaneous trade/party/guild invite requests automatically rejected?
 invite_request_check: yes
 
 // Players' will drop a 'Skull' when killed?

+ 16 - 20
conf-tmpl/battle/skill.conf

@@ -17,12 +17,8 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: Value is a bit field. If no description is given,
+// Note 3: Value is a bit field. If no description is given,
 //         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
 // The rate of time it takes to cast a spell (Note 2, 0 = No casting time)
@@ -47,7 +43,7 @@ min_skill_delay_limit: 100
 // appear to "teleport" afterwards.
 default_skill_delay: 300
 
-//Completely disable skill delay of the following types (Note 4)
+//Completely disable skill delay of the following types (Note 3)
 //NOTE: By default mobs don't have the skill delay as specified in the skill
 //  database, but follow their own 'reuse' skill delay which is specified on
 //  the mob skill db. When set, the delay for all skills become
@@ -68,13 +64,13 @@ skill_add_range: 0
 // If the target moves out of range while casting, do we take the items and SP for the skill anyway? (Note 1)
 skill_out_range_consume: no
 
-// Does the distance between caster and target define if the skill is a ranged skill? (Note 4)
+// Does the distance between caster and target define if the skill is a ranged skill? (Note 3)
 // If set, when the distance between caster and target is greater than 3 the skill is considered long-range, otherwise it's a melee range.
 // If not set, then the range is determined by the skill's range (if it is above 5, the skill is ranged).
 // Default 14 (mobs + pets + homun)
 skillrange_by_distance: 14
 
-// Should the equipped weapon's range override the skill's range defined in the skill_db for most weapon-based skills? (Note 4)
+// Should the equipped weapon's range override the skill's range defined in the skill_db for most weapon-based skills? (Note 3)
 // NOTE: Skills affected by this option are those whose range in the skill_db are negative. Note that unless monster_ai&0x400 is
 // set, the range of all skills is 9 for monsters.
 skillrange_from_weapon: 14
@@ -84,10 +80,10 @@ skillrange_from_weapon: 14
 // no effect while the caster is unable to fight (eg: stunned).
 skill_caster_check: yes
 
-// Should ground placed skills be removed as soon as the caster dies? [Note 4]
+// Should ground placed skills be removed as soon as the caster dies? (Note 3)
 clear_skills_on_death: 0
 
-// Should ground placed skills be removed when the caster changes maps? [Note 4]
+// Should ground placed skills be removed when the caster changes maps? (Note 3)
 clear_skills_on_warp: 15
 
 //Setting this to YES will override the target mode of ground-based skills with the flag 0x01 to "No Enemies"
@@ -103,21 +99,21 @@ skill_min_damage: 6
 // The delay rate of monk's combo (Note 2)
 combo_delay_rate: 100
 
-// Use alternate auto Counter Attack Skill Type? (Note 4)
+// Use alternate auto Counter Attack Skill Type? (Note 3)
 // For those characters on which it is set, 100% Critical,
 // Otherwise it disregard DEF and HIT+20, CRI*2
 auto_counter_type: 15
 
-// Can ground skills be placed on top of each other? (Note 4)
+// Can ground skills be placed on top of each other? (Note 3)
 // By default, skills with UF_NOREITERATION set cannot be stacked on top of 
 // other skills, this setting will override that. (skill_unit_db)
 skill_reiteration: 0
 
-// Can ground skills NOT be placed underneath/near players/monsters? (Note 4)
+// Can ground skills NOT be placed underneath/near players/monsters? (Note 3)
 // If set, only skills with UF_NOFOOTSET set will be affected (skill_unit_db)
 skill_nofootset: 1
 
-// Should traps (hunter traps + quagmire) change their target to "all" inside gvg/pvp grounds? (Note 4)
+// Should traps (hunter traps + quagmire) change their target to "all" inside gvg/pvp grounds? (Note 3)
 // Default on official servers: yes for player-traps
 gvg_traps_target_all: 1
 
@@ -149,7 +145,7 @@ skill_wall_check: yes
 player_cloak_check_type: 1
 monster_cloak_check_type: 4
 
-// Can't place unlimited land skills at the same time (Note 4)
+// Can't place unlimited land skills at the same time (Note 3)
 land_skill_limit: 1
 
 //Determines which kind of skill-failed messages should be sent:
@@ -169,9 +165,9 @@ chat_warpportal: no
 // 3: Both (the addition of both) [default]
 sense_type: 3
 
-// Which finger offensive style can be used?
-// 0 = Aegis style
-// 1 = Athena style
+// Which finger offensive style will be used?
+// 0 = Aegis style (single multi-hit attack)
+// 1 = Athena style (multiple consecutive attacks)
 finger_offensive_type: 0
 
 // Number of hits at a time that undead/fire elemental enemies receive from firewall.
@@ -198,13 +194,13 @@ player_skill_partner_check: yes
 
 // Remove trap type
 // 0 = Aegis system : Returns 1 'Trap' item
-// 1 = Athena system : Allows the returned item and amount to be defined
+// 1 = Athena system : Returns all items used to deploy the trap
 skill_removetrap_type: 0
 
 // Does using bow to do a backstab give a 50% damage penalty? (Note 1)
 backstab_bow_penalty: yes
 
-// Use kRO new steal formula?
+// Use kRO new steal formula? (favors skillv more than dex difference) (Note 1)
 skill_steal_type: yes
 
 // How many times you could try to steal from a mob.

+ 2 - 6
conf-tmpl/battle/status.conf

@@ -17,15 +17,11 @@
 //--------------------------------------------------------------
 // Note 1: Value is a config switch (on/off, yes/no or 1/0)
 // Note 2: Value is in percents (100 means 100%)
-// Note 3: Value is not limited to 60k (see below)
-// Note 4: Value is a bit field. If no description is given,
+// Note 3: Value is a bit field. If no description is given,
 //         assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun)
-// Other Information:
-// All values are limited to a number between 0 and 60k
-// (60000, 600%, 60secs, ...), unless otherwise specified.
 //--------------------------------------------------------------
 
-// Should skill casting be cancelled when inflicted by curse/stun/sleep/etc (includes silence) [Note 4]?
+// Should skill casting be cancelled when inflicted by curse/stun/sleep/etc (includes silence) (Note 3)?
 status_cast_cancel: 0
 
 // Will certain skill status-changes be removed on logout?

+ 1 - 1
db/item_db.txt

@@ -2809,7 +2809,7 @@
 9027,Alice_Egg,Alice Egg,7,,10,0,,,,,,,,,,,,,{},{},{}
 9028,Rice_Cake_Egg,Rice Cake Egg,7,,10,0,,,,,,,,,,,,,{},{},{}
 9029,Gobline_Xmas_Egg,Christmas Goblin Egg,7,,10,0,,,,,,,,,,,,,{},{},{}
-9030,Chung_E_Egg,Green maiden Egg,7,,10,0,,,,,,,,,,,,,{},{},{}
+9030,Chung_E_Egg,Green Maiden Egg,7,,10,0,,,,,,,,,,,,,{},{},{}
 9031,Eclipse_Egg,Eclipse Egg,7,,10,0,,,,,,,,,,,,,{},{},{}
 // Pet Accessories
 //===================================================================

+ 1 - 0
npc/Changelog.txt

@@ -1,6 +1,7 @@
 Date		Added
 ======
 2007/08/15
+	* Fixed 'Job_Professer' typo in mage jobchange quest [ultramage]
 	* Rev. 11016 Corrected a few bugs in the Acolyte Job Quest. (Crashy) [L0ne_W0lf]
 2007/08/14
 	* Deleted an Unnecessary "next;" on Rachel Guide. [Samuray22]

+ 1 - 1
npc/jobs/1-1/mage.txt

@@ -23,7 +23,7 @@
 
 geffen_in,164,124,4	script	Mage Guildsman	123,{
 	if (Upper == 1) {
-		if (ADVJOB == Job_High_Wizard || ADVJOB == Job_Professer) {
+		if (ADVJOB == Job_High_Wizard || ADVJOB == Job_Professor) {
 			if (Class == Job_Novice_High) {
 				mes "[Mage Guildsman]";
 				mes "Whoa, long time no see! But weren't you supposed to be dead?";

+ 1 - 1
npc/jobs/novice/novice.txt

@@ -2083,7 +2083,7 @@ new_zone02,17,182,6	script	Helper#2	84,{
 			mes "Field Combat Training can be";
 			mes "actually pretty dangerous for";
 			mes "new adventurers. Let me give you";
-			mes "a little more strenght through the";
+			mes "a little more strength through the";
 			mes "power of my magic.";
 			next;
 			mes "[Elmeen]";

+ 2 - 2
npc/quests/skills/monk_skills.txt

@@ -411,9 +411,9 @@ prt_monk,129,263,3	script	Monk	823,{
 			mes "and you're good.";
 			next;
 			mes "[Monk]";
-			mes "If you have enough strenght";
+			mes "If you have enough strength";
 			mes "to kill Mandoragoras, it means";
-			mes "you have heart and strenght";
+			mes "you have heart and strength";
 			mes "to defeat other monsters";
 			mes "that pester the innocent";
 			mes "travelers.";

+ 0 - 0
npc/sample/monster_controller.cpp → npc/sample/monster_controller.txt


+ 1 - 2
src/common/plugins.c

@@ -348,8 +348,7 @@ void plugins_init(void)
 	export_symbol(addr_,            SYMBOL_ADDR);
 	// timers
 	export_symbol(get_uptime,              SYMBOL_GET_UPTIME);
-//	export_symbol(delete_timer,            SYMBOL_DELETE_TIMER);
-	export_symbol(delete_timer_sub,        SYMBOL_DELETE_TIMER);
+	export_symbol(delete_timer,            SYMBOL_DELETE_TIMER);
 	export_symbol(add_timer_func_list,     SYMBOL_ADD_TIMER_FUNC_LIST);
 	export_symbol(add_timer_interval,      SYMBOL_ADD_TIMER_INTERVAL);
 	export_symbol(add_timer,               SYMBOL_ADD_TIMER);

+ 2 - 4
src/common/timer.c

@@ -269,12 +269,10 @@ int add_timer_interval(unsigned int tick, TimerFunc func, int id, int data, int
 	return tid;
 }
 
-//int delete_timer(int id, TimerFunc func)
-int delete_timer_sub(int id, TimerFunc func, const char* file, int line)
+int delete_timer(int id, TimerFunc func)
 {
 	if (id <= 0 || id >= timer_data_num) {
-		//ShowError("delete_timer error : no such timer %d (%08x(%s))\n", id, (int)func, search_timer_func_list(func));
-		ShowError("delete_timer error : no such timer %d (%08x(%s)), invoked from %s:%d\n", id, (int)func, search_timer_func_list(func), file, line);
+		ShowError("delete_timer error : no such timer %d (%08x(%s))\n", id, (int)func, search_timer_func_list(func));
 		return -1;
 	}
 	if (timer_data[id].func != func) {

+ 1 - 3
src/common/timer.h

@@ -46,9 +46,7 @@ unsigned int gettick(void);
 
 int add_timer(unsigned int,TimerFunc f,int,int);
 int add_timer_interval(unsigned int tick, TimerFunc func, int id, int data, int interval);
-//int delete_timer(int,TimerFunc f);
-int delete_timer_sub(int,TimerFunc f, const char* file, int line);
-#define delete_timer(id, f) delete_timer_sub(id, f, __FILE__, __LINE__)
+int delete_timer(int,TimerFunc f);
 
 int addtick_timer(int tid,unsigned int tick);
 int settick_timer(int tid,unsigned int tick);

+ 37 - 48
src/map/atcommand.c

@@ -1977,23 +1977,13 @@ int atcommand_speed(const int fd, struct map_session_data* sd, const char* comma
 
 	memset(atcmd_output, '\0', sizeof(atcmd_output));
 
-	if (!message || !*message) {
+	if (!message || !*message || sscanf(message, "%d", &speed) < 1) {
 		sprintf(atcmd_output, "Please, enter a speed value (usage: @speed <%d-%d>).", MIN_WALK_SPEED, MAX_WALK_SPEED);
 		clif_displaymessage(fd, atcmd_output);
 		return -1;
 	}
 
-	speed = atoi(message);
-	if (speed < MIN_WALK_SPEED)
-	{
-		speed = MIN_WALK_SPEED;
-	}
-	else if (speed > MAX_WALK_SPEED)
-	{
-		speed = MAX_WALK_SPEED;
-	}
-	
-	sd->base_status.speed = speed;
+	sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
 	status_calc_bl(&sd->bl, SCB_SPEED);
 	clif_displaymessage(fd, msg_txt(8)); // Speed changed.
 	return 0;
@@ -2101,11 +2091,12 @@ int atcommand_hide(const int fd, struct map_session_data* sd, const char* comman
  *------------------------------------------*/
 int atcommand_jobchange(const int fd, struct map_session_data* sd, const char* command, const char* message)
 {
+        //FIXME: redundancy, potentially wrong code, should use job_name() or similar instead of hardcoding the table
 	int job = 0, upper = 0;
 	nullpo_retr(-1, sd);
 
-	if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) {
-
+	if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1)
+	{
 		int i, found = 0;
 		const struct { char name[16]; int id; } jobs[] = {
 			{ "novice",		0 },
@@ -5073,37 +5064,35 @@ int atcommand_reloadbattleconf(const int fd, struct map_session_data* sd, const
 
 	battle_config_read(BATTLE_CONF_FILENAME);
 
-	if (memcmp(&prev_config.item_rate_mvp,
-		&battle_config.item_rate_mvp,
-		sizeof(battle_config.item_rate_mvp)+
-		sizeof(battle_config.item_rate_common)+
-		sizeof(battle_config.item_rate_common_boss)+
-		sizeof(battle_config.item_rate_card)+
-		sizeof(battle_config.item_rate_card_boss)+
-		sizeof(battle_config.item_rate_equip)+
-		sizeof(battle_config.item_rate_equip_boss)+
-		sizeof(battle_config.item_rate_heal)+
-		sizeof(battle_config.item_rate_heal_boss)+
-		sizeof(battle_config.item_rate_use)+
-		sizeof(battle_config.item_rate_use_boss)+
-		sizeof(battle_config.item_rate_treasure)+
-		sizeof(battle_config.item_rate_adddrop)+
-		sizeof(battle_config.logarithmic_drops)+
-		sizeof(battle_config.item_drop_common_min)+
-		sizeof(battle_config.item_drop_common_max)+
-		sizeof(battle_config.item_drop_card_min)+
-		sizeof(battle_config.item_drop_card_max)+
-		sizeof(battle_config.item_drop_equip_min)+
-		sizeof(battle_config.item_drop_equip_max)+
-		sizeof(battle_config.item_drop_mvp_min)+
-		sizeof(battle_config.item_drop_mvp_max)+
-		sizeof(battle_config.item_drop_heal_min)+
-		sizeof(battle_config.item_drop_heal_max)+
-		sizeof(battle_config.item_drop_use_min)+
-		sizeof(battle_config.item_drop_use_max)+
-		sizeof(battle_config.item_drop_treasure_min)+
-		sizeof(battle_config.item_drop_treasure_max)
-	) != 0)
+	if( prev_config.item_rate_mvp          != battle_config.item_rate_mvp
+	||  prev_config.item_rate_common       != battle_config.item_rate_common
+	||  prev_config.item_rate_common_boss  != battle_config.item_rate_common_boss
+	||  prev_config.item_rate_card         != battle_config.item_rate_card
+	||  prev_config.item_rate_card_boss    != battle_config.item_rate_card_boss
+	||  prev_config.item_rate_equip        != battle_config.item_rate_equip
+	||  prev_config.item_rate_equip_boss   != battle_config.item_rate_equip_boss
+	||  prev_config.item_rate_heal         != battle_config.item_rate_heal
+	||  prev_config.item_rate_heal_boss    != battle_config.item_rate_heal_boss
+	||  prev_config.item_rate_use          != battle_config.item_rate_use
+	||  prev_config.item_rate_use_boss     != battle_config.item_rate_use_boss
+	||  prev_config.item_rate_treasure     != battle_config.item_rate_treasure
+	||  prev_config.item_rate_adddrop      != battle_config.item_rate_adddrop
+	||  prev_config.logarithmic_drops      != battle_config.logarithmic_drops
+	||  prev_config.item_drop_common_min   != battle_config.item_drop_common_min
+	||  prev_config.item_drop_common_max   != battle_config.item_drop_common_max
+	||  prev_config.item_drop_card_min     != battle_config.item_drop_card_min
+	||  prev_config.item_drop_card_max     != battle_config.item_drop_card_max
+	||  prev_config.item_drop_equip_min    != battle_config.item_drop_equip_min
+	||  prev_config.item_drop_equip_max    != battle_config.item_drop_equip_max
+	||  prev_config.item_drop_mvp_min      != battle_config.item_drop_mvp_min
+	||  prev_config.item_drop_mvp_max      != battle_config.item_drop_mvp_max
+	||  prev_config.item_drop_heal_min     != battle_config.item_drop_heal_min
+	||  prev_config.item_drop_heal_max     != battle_config.item_drop_heal_max
+	||  prev_config.item_drop_use_min      != battle_config.item_drop_use_min
+	||  prev_config.item_drop_use_max      != battle_config.item_drop_use_max
+	||  prev_config.item_drop_treasure_min != battle_config.item_drop_treasure_min
+	||  prev_config.item_drop_treasure_max != battle_config.item_drop_treasure_max
+	)
   	{	//Drop rates changed.
 		mob_reload(); //Needed as well so rate changes take effect.
 #ifndef TXT_ONLY
@@ -7372,7 +7361,7 @@ int atcommand_pettalk(const int fd, struct map_session_data* sd, const char* com
 		}
 	}
 
-	snprintf(temp, sizeof temp ,"%s: %s",pd->pet.name,mes);
+	snprintf(temp, sizeof temp ,"%s : %s", pd->pet.name, mes);
 	clif_message(&pd->bl, temp);
 
 	return 0;
@@ -8324,7 +8313,7 @@ int atcommand_homevolution(const int fd, struct map_session_data* sd, const char
 		return 0;
 	}
 	
-	clif_displaymessage(fd, "Your homunculus doesn't evove.");
+	clif_displaymessage(fd, "Your homunculus doesn't evolve.");
 	return -1;
 }
 
@@ -8441,7 +8430,7 @@ int atcommand_homtalk(const int fd, struct map_session_data* sd, const char* com
 		return -1;
 	}
 
-	snprintf(temp, sizeof temp ,"%s: %s",sd->hd->homunculus.name,mes);
+	snprintf(temp, sizeof temp ,"%s : %s", sd->hd->homunculus.name, mes);
 	clif_message(&sd->hd->bl, temp);
 
 	return 0;

文件差异内容过多而无法显示
+ 391 - 928
src/map/battle.c


+ 311 - 311
src/map/battle.h

@@ -87,31 +87,32 @@ int 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);
 // �Ý’è
 
-extern struct Battle_Config {
-	unsigned short warp_point_debug;
-	unsigned short enable_critical;
-	unsigned short mob_critical_rate;
-	unsigned short critical_rate;
-	unsigned short enable_baseatk;
-	unsigned short enable_perfect_flee;
-	unsigned short cast_rate, delay_rate;
-	unsigned short delay_dependon_dex, delay_dependon_agi;
-	unsigned short sdelay_attack_enable;
-	unsigned short left_cardfix_to_right;
-	unsigned short skill_add_range;
-	unsigned short skill_out_range_consume;
-	unsigned short skillrange_by_distance; //[Skotlex]
-	unsigned short use_weapon_skill_range; //[Skotlex]
-	unsigned short pc_damage_delay_rate;
-	unsigned short defnotenemy;
-	unsigned short vs_traps_bctall;	
-	unsigned short traps_setting;
-	unsigned short summon_flora; //[Skotlex]	
-	unsigned short clear_unit_ondeath; //[Skotlex]
-	unsigned short clear_unit_onwarp; //[Skotlex]
-	unsigned short random_monster_checklv;
-	unsigned short attr_recover;
-	unsigned short item_auto_get;
+extern struct Battle_Config
+{
+	int warp_point_debug;
+	int enable_critical;
+	int mob_critical_rate;
+	int critical_rate;
+	int enable_baseatk;
+	int enable_perfect_flee;
+	int cast_rate, delay_rate;
+	int delay_dependon_dex, delay_dependon_agi;
+	int sdelay_attack_enable;
+	int left_cardfix_to_right;
+	int skill_add_range;
+	int skill_out_range_consume;
+	int skillrange_by_distance; //[Skotlex]
+	int use_weapon_skill_range; //[Skotlex]
+	int pc_damage_delay_rate;
+	int defnotenemy;
+	int vs_traps_bctall;	
+	int traps_setting;
+	int summon_flora; //[Skotlex]	
+	int clear_unit_ondeath; //[Skotlex]
+	int clear_unit_onwarp; //[Skotlex]
+	int random_monster_checklv;
+	int attr_recover;
+	int item_auto_get;
 	int flooritem_lifetime;
 	int item_first_get_time;
 	int item_second_get_time;
@@ -120,321 +121,320 @@ extern struct Battle_Config {
 	int mvp_item_second_get_time;
 	int mvp_item_third_get_time;
 	int base_exp_rate,job_exp_rate;
-	unsigned short drop_rate0item;
-	unsigned short death_penalty_type;
-	unsigned short death_penalty_base,death_penalty_job;
-	unsigned short pvp_exp;  // [MouseJstr]
-	unsigned short gtb_sc_immunity;
+	int drop_rate0item;
+	int death_penalty_type;
+	int death_penalty_base,death_penalty_job;
+	int pvp_exp;  // [MouseJstr]
+	int gtb_sc_immunity;
 	int zeny_penalty;
-	unsigned short restart_hp_rate;
-	unsigned short restart_sp_rate;
+	int restart_hp_rate;
+	int restart_sp_rate;
 	int mvp_exp_rate;
-	unsigned short mvp_hp_rate;
-	unsigned short monster_hp_rate;
-	unsigned short monster_max_aspd;
-	unsigned short view_range_rate;
-	unsigned short chase_range_rate;
-	unsigned short atc_gmonly;
-	unsigned short atc_spawn_quantity_limit;
-	unsigned short atc_slave_clone_limit;
-	unsigned short partial_name_scan;
-	unsigned short gm_allskill;
-	unsigned short gm_allequip;
-	unsigned short gm_skilluncond;
-	unsigned short gm_join_chat;
-	unsigned short gm_kick_chat;
-	unsigned short skillfree;
-	unsigned short skillup_limit;
-	unsigned short wp_rate;
-	unsigned short pp_rate;
-	unsigned short monster_active_enable;
-	unsigned short monster_damage_delay_rate;
-	unsigned short monster_loot_type;
-	unsigned short mob_skill_rate;	//[Skotlex]
-	unsigned short mob_skill_delay;	//[Skotlex]
-	unsigned short mob_count_rate;
-	unsigned short no_spawn_on_player; //[Skotlex]
-	unsigned short force_random_spawn; //[Skotlex]
-	unsigned short mob_spawn_delay, plant_spawn_delay, boss_spawn_delay;	// [Skotlex]
-	unsigned short slaves_inherit_mode;
-	unsigned short slaves_inherit_speed;
-	unsigned short summons_trigger_autospells;
-	unsigned short pc_walk_delay_rate; //Adjusts can't walk delay after being hit for players. [Skotlex]
-	unsigned short walk_delay_rate; //Adjusts can't walk delay after being hit. [Skotlex]
-	unsigned short multihit_delay;  //Adjusts can't walk delay per hit on multi-hitting skills. [Skotlex]
-	unsigned short quest_skill_learn;
-	unsigned short quest_skill_reset;
-	unsigned short basic_skill_check;
-	unsigned short guild_emperium_check;
-	unsigned short guild_exp_limit;
-	unsigned short guild_max_castles;
-	unsigned short emergency_call;
-	unsigned short guild_aura;
-	unsigned short pc_invincible_time;
-	unsigned short pet_catch_rate;
-	unsigned short pet_rename;
-	unsigned short pet_friendly_rate;
-	unsigned short pet_hungry_delay_rate;
-	unsigned short pet_hungry_friendly_decrease;
-	unsigned short pet_status_support;
-	unsigned short pet_attack_support;
-	unsigned short pet_damage_support;
-	unsigned short pet_support_min_friendly;	//[Skotlex]
-	unsigned short pet_support_rate;
-	unsigned short pet_attack_exp_to_master;
-	unsigned short pet_attack_exp_rate;
-	unsigned short pet_lv_rate; //[Skotlex]
-	unsigned short pet_max_stats; //[Skotlex]
-	unsigned short pet_max_atk1; //[Skotlex]
-	unsigned short pet_max_atk2; //[Skotlex]
-	unsigned short pet_no_gvg; //Disables pets in gvg. [Skotlex]
-	unsigned short skill_min_damage;
-	unsigned short finger_offensive_type;
-	unsigned short heal_exp;
-	unsigned short max_heal_lv;
+	int mvp_hp_rate;
+	int monster_hp_rate;
+	int monster_max_aspd;
+	int view_range_rate;
+	int chase_range_rate;
+	int atc_gmonly;
+	int atc_spawn_quantity_limit;
+	int atc_slave_clone_limit;
+	int partial_name_scan;
+	int gm_allskill;
+	int gm_allequip;
+	int gm_skilluncond;
+	int gm_join_chat;
+	int gm_kick_chat;
+	int skillfree;
+	int skillup_limit;
+	int wp_rate;
+	int pp_rate;
+	int monster_active_enable;
+	int monster_damage_delay_rate;
+	int monster_loot_type;
+	int mob_skill_rate;	//[Skotlex]
+	int mob_skill_delay;	//[Skotlex]
+	int mob_count_rate;
+	int no_spawn_on_player; //[Skotlex]
+	int force_random_spawn; //[Skotlex]
+	int mob_spawn_delay, plant_spawn_delay, boss_spawn_delay;	// [Skotlex]
+	int slaves_inherit_mode;
+	int slaves_inherit_speed;
+	int summons_trigger_autospells;
+	int pc_walk_delay_rate; //Adjusts can't walk delay after being hit for players. [Skotlex]
+	int walk_delay_rate; //Adjusts can't walk delay after being hit. [Skotlex]
+	int multihit_delay;  //Adjusts can't walk delay per hit on multi-hitting skills. [Skotlex]
+	int quest_skill_learn;
+	int quest_skill_reset;
+	int basic_skill_check;
+	int guild_emperium_check;
+	int guild_exp_limit;
+	int guild_max_castles;
+	int emergency_call;
+	int guild_aura;
+	int pc_invincible_time;
+	int pet_catch_rate;
+	int pet_rename;
+	int pet_friendly_rate;
+	int pet_hungry_delay_rate;
+	int pet_hungry_friendly_decrease;
+	int pet_status_support;
+	int pet_attack_support;
+	int pet_damage_support;
+	int pet_support_min_friendly;	//[Skotlex]
+	int pet_support_rate;
+	int pet_attack_exp_to_master;
+	int pet_attack_exp_rate;
+	int pet_lv_rate; //[Skotlex]
+	int pet_max_stats; //[Skotlex]
+	int pet_max_atk1; //[Skotlex]
+	int pet_max_atk2; //[Skotlex]
+	int pet_no_gvg; //Disables pets in gvg. [Skotlex]
+	int skill_min_damage;
+	int finger_offensive_type;
+	int heal_exp;
+	int max_heal_lv;
 	int max_heal; //Mitternacht
-	unsigned short resurrection_exp;
-	unsigned short shop_exp;
-	unsigned short combo_delay_rate;
-	unsigned short item_check;
-	unsigned short item_use_interval;	//[Skotlex]
-	unsigned short wedding_modifydisplay;
-	unsigned short wedding_ignorepalette;	//[Skotlex]
-	unsigned short xmas_ignorepalette;	// [Valaris]
+	int resurrection_exp;
+	int shop_exp;
+	int combo_delay_rate;
+	int item_check;
+	int item_use_interval;	//[Skotlex]
+	int wedding_modifydisplay;
+	int wedding_ignorepalette;	//[Skotlex]
+	int xmas_ignorepalette;	// [Valaris]
 	int natural_healhp_interval;
 	int natural_healsp_interval;
 	int natural_heal_skill_interval;
-	unsigned short natural_heal_weight_rate;
-	unsigned short arrow_decrement;
-	unsigned short max_aspd;
-	unsigned short max_walk_speed;	//Maximum walking speed after buffs [Skotlex]
+	int natural_heal_weight_rate;
+	int arrow_decrement;
+	int max_aspd;
+	int max_walk_speed;	//Maximum walking speed after buffs [Skotlex]
 	int max_hp;
 	int max_sp;
-	unsigned short max_lv, aura_lv;
-	unsigned short max_parameter, max_baby_parameter;
+	int max_lv, aura_lv;
+	int max_parameter, max_baby_parameter;
 	int max_cart_weight;
-	unsigned short skill_log;
-	unsigned short battle_log;
-	unsigned short save_log;
-	unsigned short error_log;
-	unsigned short etc_log;
-	unsigned short save_clothcolor;
-	unsigned short undead_detect_type;
-	unsigned short auto_counter_type;
-	unsigned short min_hitrate;	//[Skotlex]
-	unsigned short max_hitrate;	//[Skotlex]
-	unsigned short agi_penalty_target;
-	unsigned short agi_penalty_type;
-	unsigned short agi_penalty_count;
-	unsigned short agi_penalty_num;
-	unsigned short vit_penalty_target;
-	unsigned short vit_penalty_type;
-	unsigned short vit_penalty_count;
-	unsigned short vit_penalty_num;
-	unsigned short weapon_defense_type;
-	unsigned short magic_defense_type;
-	unsigned short skill_reiteration;
-	unsigned short skill_nofootset;
-	unsigned short pc_cloak_check_type;
-	unsigned short monster_cloak_check_type;
-	unsigned short estimation_type;
-	unsigned short gvg_short_damage_rate;
-	unsigned short gvg_long_damage_rate;
-	unsigned short gvg_weapon_damage_rate;
-	unsigned short gvg_magic_damage_rate;
-	unsigned short gvg_misc_damage_rate;
-	unsigned short gvg_flee_penalty;
+	int skill_log;
+	int battle_log;
+	int save_log;
+	int error_log;
+	int etc_log;
+	int save_clothcolor;
+	int undead_detect_type;
+	int auto_counter_type;
+	int min_hitrate;	//[Skotlex]
+	int max_hitrate;	//[Skotlex]
+	int agi_penalty_target;
+	int agi_penalty_type;
+	int agi_penalty_count;
+	int agi_penalty_num;
+	int vit_penalty_target;
+	int vit_penalty_type;
+	int vit_penalty_count;
+	int vit_penalty_num;
+	int weapon_defense_type;
+	int magic_defense_type;
+	int skill_reiteration;
+	int skill_nofootset;
+	int pc_cloak_check_type;
+	int monster_cloak_check_type;
+	int estimation_type;
+	int gvg_short_damage_rate;
+	int gvg_long_damage_rate;
+	int gvg_weapon_damage_rate;
+	int gvg_magic_damage_rate;
+	int gvg_misc_damage_rate;
+	int gvg_flee_penalty;
 	int gvg_eliminate_time;
-	unsigned short pk_short_damage_rate;
-	unsigned short pk_long_damage_rate;
-	unsigned short pk_weapon_damage_rate;
-	unsigned short pk_magic_damage_rate;
-	unsigned short pk_misc_damage_rate;
-	unsigned short mob_changetarget_byskill;
-	unsigned short attack_direction_change;
-	unsigned short land_skill_limit;
-	unsigned short party_skill_penalty;
-	unsigned short monster_class_change_full_recover;
-	unsigned short produce_item_name_input;
-	unsigned short display_skill_fail;
-	unsigned short chat_warpportal;
-	unsigned short mob_warp;
-	unsigned short dead_branch_active;
+	int pk_short_damage_rate;
+	int pk_long_damage_rate;
+	int pk_weapon_damage_rate;
+	int pk_magic_damage_rate;
+	int pk_misc_damage_rate;
+	int mob_changetarget_byskill;
+	int attack_direction_change;
+	int land_skill_limit;
+	int party_skill_penalty;
+	int monster_class_change_recover;
+	int produce_item_name_input;
+	int display_skill_fail;
+	int chat_warpportal;
+	int mob_warp;
+	int dead_branch_active;
 	int vending_max_value;
-	unsigned short vending_tax;
-	unsigned short show_steal_in_same_party;
-	unsigned short party_share_type;
-	unsigned short party_hp_mode;
-	unsigned short party_show_share_picker;
-	unsigned short attack_attr_none;
-	int item_rate_mvp, item_rate_common, item_rate_common_boss, item_rate_card, item_rate_card_boss,	// added support for MVP drops [Reddozen]
+	int vending_tax;
+	int show_steal_in_same_party;
+	int party_share_type;
+	int party_hp_mode;
+	int party_show_share_picker;
+	int attack_attr_none;
+	int item_rate_mvp, item_rate_common, item_rate_common_boss, item_rate_card, item_rate_card_boss,
 		item_rate_equip, item_rate_equip_boss, item_rate_heal, item_rate_heal_boss, item_rate_use,
-		item_rate_use_boss, item_rate_treasure,	// Added by RoVeRT, Additional Heal and Usable item rate by Val
-		item_rate_adddrop;
+		item_rate_use_boss, item_rate_treasure, item_rate_adddrop;
 	
-	unsigned short logarithmic_drops;
-	unsigned short item_drop_common_min,item_drop_common_max;	// Added by TyrNemesis^
-	unsigned short item_drop_card_min,item_drop_card_max;
-	unsigned short item_drop_equip_min,item_drop_equip_max;
-	unsigned short item_drop_mvp_min,item_drop_mvp_max;	// End Addition
-	unsigned short item_drop_heal_min,item_drop_heal_max;	// Added by Valatris
-	unsigned short item_drop_use_min,item_drop_use_max;	//End
-	unsigned short item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex]
-	unsigned short item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex]
-	unsigned short prevent_logout;	// Added by RoVeRT
-
-	unsigned short alchemist_summon_reward;	// [Valaris]
-	unsigned short drops_by_luk;
-	unsigned short drops_by_luk2;
-	unsigned short equip_natural_break_rate;	//Base Natural break rate for attacks.
-	unsigned short equip_self_break_rate; //Natural & Penalty skills break rate
-	unsigned short equip_skill_break_rate; //Offensive skills break rate
-	unsigned short pet_equip_required;
-	unsigned short multi_level_up;
-	unsigned short max_exp_gain_rate; //Max amount of exp bar % you can get in one go.
-	unsigned short pk_mode;
-	unsigned short pk_level_range;
-
-	unsigned short manner_system; // end additions [Valaris]
-	unsigned short show_mob_info; 
-
-	unsigned short agi_penalty_count_lv;
-	unsigned short vit_penalty_count_lv;
-
-	unsigned short gx_allhit;
-	unsigned short gx_disptype;
-	unsigned short devotion_level_difference;
-	unsigned short player_skill_partner_check;
-	unsigned short hide_GM_session;
-	unsigned short invite_request_check;
-	unsigned short skill_removetrap_type;
-	unsigned short disp_experience;
-	unsigned short disp_zeny;
-	unsigned short castle_defense_rate;
-	unsigned short backstab_bow_penalty;
-	unsigned short hp_rate;
-	unsigned short sp_rate;
-	unsigned short gm_cant_drop_min_lv;
-	unsigned short gm_cant_drop_max_lv;
-	unsigned short disp_hpmeter;
-	unsigned short bone_drop;
-	unsigned short buyer_name;
+	int logarithmic_drops;
+	int item_drop_common_min,item_drop_common_max;	// Added by TyrNemesis^
+	int item_drop_card_min,item_drop_card_max;
+	int item_drop_equip_min,item_drop_equip_max;
+	int item_drop_mvp_min,item_drop_mvp_max;	// End Addition
+	int item_drop_heal_min,item_drop_heal_max;	// Added by Valatris
+	int item_drop_use_min,item_drop_use_max;	//End
+	int item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex]
+	int item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex]
+	int prevent_logout;	// Added by RoVeRT
+
+	int alchemist_summon_reward;	// [Valaris]
+	int drops_by_luk;
+	int drops_by_luk2;
+	int equip_natural_break_rate;	//Base Natural break rate for attacks.
+	int equip_self_break_rate; //Natural & Penalty skills break rate
+	int equip_skill_break_rate; //Offensive skills break rate
+	int pet_equip_required;
+	int multi_level_up;
+	int max_exp_gain_rate; //Max amount of exp bar % you can get in one go.
+	int pk_mode;
+	int pk_level_range;
+
+	int manner_system; // end additions [Valaris]
+	int show_mob_info; 
+
+	int agi_penalty_count_lv;
+	int vit_penalty_count_lv;
+
+	int gx_allhit;
+	int gx_disptype;
+	int devotion_level_difference;
+	int player_skill_partner_check;
+	int hide_GM_session;
+	int invite_request_check;
+	int skill_removetrap_type;
+	int disp_experience;
+	int disp_zeny;
+	int castle_defense_rate;
+	int backstab_bow_penalty;
+	int hp_rate;
+	int sp_rate;
+	int gm_cant_drop_min_lv;
+	int gm_cant_drop_max_lv;
+	int disp_hpmeter;
+	int bone_drop;
+	int buyer_name;
 
 // eAthena additions
-	unsigned short night_at_start; // added by [Yor]
+	int night_at_start; // added by [Yor]
 	int day_duration; // added by [Yor]
 	int night_duration; // added by [Yor]
-	short ban_hack_trade; // added by [Yor]
-	unsigned short hack_info_GM_level; // added by [Yor]
-	unsigned short any_warp_GM_min_level; // added by [Yor]
-	unsigned short packet_ver_flag; // added by [Yor]
+	int ban_hack_trade; // added by [Yor]
+	int hack_info_GM_level; // added by [Yor]
+	int any_warp_GM_min_level; // added by [Yor]
+	int packet_ver_flag; // added by [Yor]
 	
-	unsigned short min_hair_style; // added by [MouseJstr]
-	unsigned short max_hair_style; // added by [MouseJstr]
-	unsigned short min_hair_color; // added by [MouseJstr]
-	unsigned short max_hair_color; // added by [MouseJstr]
-	unsigned short min_cloth_color; // added by [MouseJstr]
-	unsigned short max_cloth_color; // added by [MouseJstr]
-	unsigned short pet_hair_style; // added by [Skotlex]
-
-	unsigned short castrate_dex_scale; // added by [MouseJstr]
-	unsigned short area_size; // added by [MouseJstr]
-
-	unsigned short max_def, over_def_bonus; //added by [Skotlex]
+	int min_hair_style; // added by [MouseJstr]
+	int max_hair_style; // added by [MouseJstr]
+	int min_hair_color; // added by [MouseJstr]
+	int max_hair_color; // added by [MouseJstr]
+	int min_cloth_color; // added by [MouseJstr]
+	int max_cloth_color; // added by [MouseJstr]
+	int pet_hair_style; // added by [Skotlex]
+
+	int castrate_dex_scale; // added by [MouseJstr]
+	int area_size; // added by [MouseJstr]
+
+	int max_def, over_def_bonus; //added by [Skotlex]
 	
-	unsigned short zeny_from_mobs; // [Valaris]
-	unsigned short mobs_level_up; // [Valaris]
-	unsigned short mobs_level_up_exp_rate; // [Valaris]
-	unsigned short pk_min_level; // [celest]
-	unsigned short skill_steal_type; // [celest]
-	unsigned short skill_steal_rate; // [celest]
-	unsigned short skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus]
-	unsigned short motd_type; // [celest]
-	unsigned short finding_ore_rate; // orn
-	unsigned short exp_calc_type;
-	unsigned short exp_bonus_attacker;
-	unsigned short exp_bonus_max_attacker;
-	unsigned short min_skill_delay_limit;
-	unsigned short default_skill_delay;
-	unsigned short no_skill_delay;
-	unsigned short attack_walk_delay;
-	unsigned short require_glory_guild;
-	unsigned short idle_no_share;
-	unsigned short party_update_interval;
-	unsigned short party_even_share_bonus;
-	unsigned short delay_battle_damage;
-	unsigned short hide_woe_damage;
-	unsigned short display_version;
-	unsigned short who_display_aid;
-
-	unsigned short display_hallucination;	// [Skotlex]
-	unsigned short use_statpoint_table;	// [Skotlex]
-
-	unsigned short ignore_items_gender; //[Lupus]
-
-	unsigned short copyskill_restrict; // [Aru]
-	unsigned short berserk_cancels_buffs; // [Aru]
-	unsigned short debuff_on_logout; // Removes a few "official" negative Scs on logout. [Skotlex]
-	unsigned short mob_ai; //Configures various mob_ai settings to make them smarter or dumber(official). [Skotlex]
-	unsigned short hom_setting; //Configures various homunc settings which make them behave unlike normal characters.. [Skotlex]
-	unsigned short dynamic_mobs; // Dynamic Mobs [Wizputer] - battle_athena flag implemented by [random]
-	unsigned short mob_remove_damaged; // Dynamic Mobs - Remove mobs even if damaged [Wizputer]
+	int zeny_from_mobs; // [Valaris]
+	int mobs_level_up; // [Valaris]
+	int mobs_level_up_exp_rate; // [Valaris]
+	int pk_min_level; // [celest]
+	int skill_steal_type; // [celest]
+	int skill_steal_rate; // [celest]
+	int skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus]
+	int motd_type; // [celest]
+	int finding_ore_rate; // orn
+	int exp_calc_type;
+	int exp_bonus_attacker;
+	int exp_bonus_max_attacker;
+	int min_skill_delay_limit;
+	int default_skill_delay;
+	int no_skill_delay;
+	int attack_walk_delay;
+	int require_glory_guild;
+	int idle_no_share;
+	int party_update_interval;
+	int party_even_share_bonus;
+	int delay_battle_damage;
+	int hide_woe_damage;
+	int display_version;
+	int who_display_aid;
+
+	int display_hallucination;	// [Skotlex]
+	int use_statpoint_table;	// [Skotlex]
+
+	int ignore_items_gender; //[Lupus]
+
+	int copyskill_restrict; // [Aru]
+	int berserk_cancels_buffs; // [Aru]
+	int debuff_on_logout; // Removes a few "official" negative Scs on logout. [Skotlex]
+	int mob_ai; //Configures various mob_ai settings to make them smarter or dumber(official). [Skotlex]
+	int hom_setting; //Configures various homunc settings which make them behave unlike normal characters.. [Skotlex]
+	int dynamic_mobs; // Dynamic Mobs [Wizputer] - battle_athena flag implemented by [random]
+	int mob_remove_damaged; // Dynamic Mobs - Remove mobs even if damaged [Wizputer]
 	int mob_remove_delay; // Dynamic Mobs - delay before removing mobs from a map [Skotlex]
 
-	unsigned short show_hp_sp_drain, show_hp_sp_gain;	//[Skotlex]
+	int show_hp_sp_drain, show_hp_sp_gain;	//[Skotlex]
 
-	unsigned short mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex]
-	unsigned short mob_clear_delay; // [Valaris]
+	int mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex]
+	int mob_clear_delay; // [Valaris]
 
-	unsigned short character_size; // if riders have size=2, and baby class riders size=1 [Lupus]
-	unsigned short mob_max_skilllvl; // Max possible skill level [Lupus]
-	unsigned short rare_drop_announce; // chance <= to show rare drops global announces
+	int character_size; // if riders have size=2, and baby class riders size=1 [Lupus]
+	int mob_max_skilllvl; // Max possible skill level [Lupus]
+	int rare_drop_announce; // chance <= to show rare drops global announces
 
-	unsigned short retaliate_to_master;	//Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex]
-	unsigned short firewall_hits_on_undead; //Number of hits firewall does at a time on undead. [Skotlex]
+	int retaliate_to_master;	//Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex]
+	int firewall_hits_on_undead; //Number of hits firewall does at a time on undead. [Skotlex]
 
-	unsigned short title_lvl1; // Players titles [Lupus]
-	unsigned short title_lvl2; // Players titles [Lupus]
-	unsigned short title_lvl3; // Players titles [Lupus]
-	unsigned short title_lvl4; // Players titles [Lupus]
-	unsigned short title_lvl5; // Players titles [Lupus]
-	unsigned short title_lvl6; // Players titles [Lupus]
-	unsigned short title_lvl7; // Players titles [Lupus]
-	unsigned short title_lvl8; // Players titles [Lupus]
+	int title_lvl1; // Players titles [Lupus]
+	int title_lvl2; // Players titles [Lupus]
+	int title_lvl3; // Players titles [Lupus]
+	int title_lvl4; // Players titles [Lupus]
+	int title_lvl5; // Players titles [Lupus]
+	int title_lvl6; // Players titles [Lupus]
+	int title_lvl7; // Players titles [Lupus]
+	int title_lvl8; // Players titles [Lupus]
 	
-	unsigned short duel_allow_pvp; // [LuzZza]
-	unsigned short duel_allow_gvg; // [LuzZza]
-	unsigned short duel_allow_teleport; // [LuzZza]
-	unsigned short duel_autoleave_when_die; // [LuzZza]
-	unsigned short duel_time_interval; // [LuzZza]
-	unsigned short duel_only_on_same_map; // [Toms]
+	int duel_allow_pvp; // [LuzZza]
+	int duel_allow_gvg; // [LuzZza]
+	int duel_allow_teleport; // [LuzZza]
+	int duel_autoleave_when_die; // [LuzZza]
+	int duel_time_interval; // [LuzZza]
+	int duel_only_on_same_map; // [Toms]
 	
-	unsigned short skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza]
-
-	unsigned short allow_skill_without_day; // [Komurka]
-	unsigned short allow_es_magic_pc; // [Skotlex]
-	unsigned short skill_wall_check; // [Skotlex]
-	unsigned short cell_stack_limit; // [Skotlex]
-	unsigned short skill_caster_check; // [Skotlex]
-	unsigned short sc_castcancel; // [Skotlex]
-	unsigned short pc_sc_def_rate; // [Skotlex]
-	unsigned short mob_sc_def_rate;
-	unsigned short pc_luk_sc_def;
-	unsigned short mob_luk_sc_def;
-	unsigned short pc_max_sc_def;
-	unsigned short mob_max_sc_def;
-
-	unsigned short sg_angel_skill_ratio;
-	unsigned short sg_miracle_skill_ratio;
+	int skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza]
+
+	int allow_skill_without_day; // [Komurka]
+	int allow_es_magic_pc; // [Skotlex]
+	int skill_wall_check; // [Skotlex]
+	int cell_stack_limit; // [Skotlex]
+	int skill_caster_check; // [Skotlex]
+	int sc_castcancel; // [Skotlex]
+	int pc_sc_def_rate; // [Skotlex]
+	int mob_sc_def_rate;
+	int pc_luk_sc_def;
+	int mob_luk_sc_def;
+	int pc_max_sc_def;
+	int mob_max_sc_def;
+
+	int sg_angel_skill_ratio;
+	int sg_miracle_skill_ratio;
 	int sg_miracle_skill_duration;
-	unsigned short autospell_stacking; //Enables autospell cards to stack. [Skotlex]
-	unsigned short override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex]
-	unsigned short min_chat_delay; //Minimum time between client messages. [Skotlex]
-	unsigned short friend_auto_add; //When accepting friends, both get friended. [Skotlex]
+	int autospell_stacking; //Enables autospell cards to stack. [Skotlex]
+	int override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex]
+	int min_chat_delay; //Minimum time between client messages. [Skotlex]
+	int friend_auto_add; //When accepting friends, both get friended. [Skotlex]
 	int hvan_explosion_intimate;	// fix [albator]
-	unsigned short hom_rename;
-	unsigned short homunculus_show_growth ;	//[orn]
-	unsigned short homunculus_friendly_rate;
+	int hom_rename;
+	int homunculus_show_growth ;	//[orn]
+	int homunculus_friendly_rate;
 } battle_config;
 
 void do_init_battle(void);

+ 1 - 10
src/map/charcommand.c

@@ -1950,16 +1950,7 @@ int charcommand_speed(const int fd, struct map_session_data* sd, const char* com
 		return -1;
 	}
 	
-	if (speed < MIN_WALK_SPEED)
-	{
-		speed = MIN_WALK_SPEED;
-	}
-	else if (speed > MAX_WALK_SPEED)
-	{
-		speed = MAX_WALK_SPEED;
-	}
-	
-	pl_sd->base_status.speed = speed;
+	pl_sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
 	status_calc_bl(&pl_sd->bl, SCB_SPEED);
 	clif_displaymessage(pl_sd->fd, msg_txt(8)); // Speed changed.
 	if (pl_sd->fd != fd)

+ 21 - 28
src/map/chat.c

@@ -2,14 +2,15 @@
 // For more information, see LICENCE in the main folder
 
 #include "../common/cbasetypes.h"
-#include "../common/nullpo.h"
 #include "../common/malloc.h"
-#include "battle.h"
-#include "map.h"
+#include "../common/nullpo.h"
+#include "../common/strlib.h"
+#include "atcommand.h" // msg_txt()
+#include "battle.h" // struct battle_config
 #include "clif.h"
+#include "map.h"
+#include "npc.h" // npc_event_do()
 #include "pc.h"
-#include "npc.h"
-#include "atcommand.h"
 #include "chat.h"
 
 #include <stdio.h>
@@ -20,7 +21,7 @@ int chat_triggerevent(struct chat_data *cd);
 /*==========================================
  * chatroom creation
  *------------------------------------------*/
-int chat_createchat(struct map_session_data* sd,int limit, int pub, char* pass, char* title, int titlelen)
+int chat_createchat(struct map_session_data* sd, int limit, bool pub, char* pass, char* title, int titlelen)
 {
 	struct chat_data *cd;
 
@@ -40,9 +41,9 @@ int chat_createchat(struct map_session_data* sd,int limit, int pub, char* pass,
 	cd->pub = pub;
 	cd->users = 1;
 	titlelen = cap_value(titlelen, 0, sizeof(cd->title)-1); // empty string achievable by using custom client
-	// the following two input strings aren't zero terminated, have to handle it manually
-	memcpy(cd->pass, pass, 8); cd->pass[8]= '\0';
-	memcpy(cd->title, title, titlelen); cd->title[titlelen] = '\0';
+	// the following two input strings aren't zero terminated and need to be handled carefully
+	safestrncpy(cd->title, title, min(titlelen+1,CHATROOM_TITLE_SIZE));
+	safestrncpy(cd->pass, pass, CHATROOM_PASS_SIZE);
 
 	cd->owner = (struct block_list **)(&cd->usersd[0]);
 	cd->usersd[0] = sd;
@@ -84,7 +85,7 @@ int chat_joinchat(struct map_session_data* sd, int chatid, char* pass)
 		return 0;
 	}
 	//Allows Gm access to protected room with any password they want by valaris
-	if ((cd->pub == 0 && strncmp(pass, (char *)cd->pass, 8) && (pc_isGM(sd) < battle_config.gm_join_chat || !battle_config.gm_join_chat)) ||
+	if ((!cd->pub && strncmp(pass, (char *)cd->pass, 8) && (pc_isGM(sd) < battle_config.gm_join_chat || !battle_config.gm_join_chat)) ||
 		chatid == (int)sd->chatID) //Double Chat fix by Alex14, thx CHaNGeTe
 	{
 		clif_joinchatfail(sd,1);
@@ -172,7 +173,7 @@ int chat_leavechat(struct map_session_data* sd)
 /*==========================================
  * チャットルームの持ち主を譲る
  *------------------------------------------*/
-int chat_changechatowner(struct map_session_data *sd,char *nextownername)
+int chat_changechatowner(struct map_session_data* sd, char* nextownername)
 {
 	struct chat_data *cd;
 	struct map_session_data *tmp_sd;
@@ -217,7 +218,7 @@ int chat_changechatowner(struct map_session_data *sd,char *nextownername)
 /*==========================================
  * チャットの状態(タイトル等)を変更
  *------------------------------------------*/
-int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pass,char* title,int titlelen)
+int chat_changechatstatus(struct map_session_data* sd, char* title, char* pass, int limit, bool pub)
 {
 	struct chat_data *cd;
 
@@ -227,13 +228,10 @@ int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pa
 	if(cd==NULL || (struct block_list *)sd != (*cd->owner))
 		return 1;
 
+	safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE);
+	safestrncpy(cd->pass, pass, CHATROOM_PASS_SIZE);
 	cd->limit = limit;
 	cd->pub = pub;
-	memcpy(cd->pass,pass,8);
-	cd->pass[7]= '\0'; //Overflow check... [Skotlex]
-	if(titlelen>=sizeof(cd->title)-1) titlelen=sizeof(cd->title)-1;
-	memcpy(cd->title,title,titlelen);
-	cd->title[titlelen]=0;
 
 	clif_changechatstatus(cd);
 	clif_dispchat(cd,0);
@@ -244,7 +242,7 @@ int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pa
 /*==========================================
  * チャットルームから蹴り出す
  *------------------------------------------*/
-int chat_kickchat(struct map_session_data *sd,char *kickusername)
+int chat_kickchat(struct map_session_data* sd,char* kickusername)
 {
 	struct chat_data *cd;
 	int i;
@@ -270,7 +268,7 @@ int chat_kickchat(struct map_session_data *sd,char *kickusername)
 }
 
 /// Creates a chat room for the npc.
-int chat_createnpcchat(struct npc_data* nd,int limit,int pub,int trigger,const char* title,int titlelen,const char *ev)
+int chat_createnpcchat(struct npc_data* nd, int limit, bool pub, int trigger, const char* title, const char* ev)
 {
 	struct chat_data *cd;
 
@@ -283,21 +281,16 @@ int chat_createnpcchat(struct npc_data* nd,int limit,int pub,int trigger,const c
 		cd->trigger = trigger;
 	cd->pub = pub;
 	cd->users = 0;
-	cd->pass[0] = '\0';
-	if( titlelen > sizeof(cd->title) - 1 )
-		titlelen = sizeof(cd->title) - 1;
-	memcpy(cd->title, title, titlelen);
-	cd->title[titlelen] = '\0';
 
+	safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE);
+	memset(cd->pass, '\0', CHATROOM_PASS_SIZE);
 	cd->bl.m    = nd->bl.m;
 	cd->bl.x    = nd->bl.x;
 	cd->bl.y    = nd->bl.y;
 	cd->bl.type = BL_CHAT;
 	cd->bl.prev = cd->bl.next = NULL;
-	cd->owner_  = (struct block_list *)nd;
-	cd->owner   = &cd->owner_;
-	strncpy(cd->npc_event, ev, ARRAYLENGTH(cd->npc_event));
-	cd->npc_event[ARRAYLENGTH(cd->npc_event)-1] = '\0';
+	cd->owner   = &(struct block_list *)nd;
+	safestrncpy(cd->npc_event, ev, ARRAYLENGTH(cd->npc_event));
 	cd->bl.id = map_addobject(&cd->bl);	
 	if( cd->bl.id == 0)
 	{

+ 14 - 12
src/map/chat.h

@@ -4,19 +4,21 @@
 #ifndef _CHAT_H_
 #define _CHAT_H_
 
-#include "map.h"
+//#include "map.h"
+struct map_session_data;
+struct chat_data;
 
-int chat_createchat(struct map_session_data *,int,int,char*,char*,int);
-int chat_joinchat(struct map_session_data *,int,char*);
-int chat_leavechat(struct map_session_data* );
-int chat_changechatowner(struct map_session_data *,char *);
-int chat_changechatstatus(struct map_session_data *,int,int,char*,char*,int);
-int chat_kickchat(struct map_session_data *,char *);
+int chat_createchat(struct map_session_data* sd, int limit, bool pub, char* pass, char* title, int titlelen);
+int chat_joinchat(struct map_session_data* sd, int chatid, char* pass);
+int chat_leavechat(struct map_session_data* sd);
+int chat_changechatowner(struct map_session_data* sd, char* nextownername);
+int chat_changechatstatus(struct map_session_data* sd, char* title, char* pass, int limit, bool pub);
+int chat_kickchat(struct map_session_data* sd, char* kickusername);
 
-int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,const char* title,int titlelen,const char *ev);
-int chat_deletenpcchat(struct npc_data *nd);
-int chat_enableevent(struct chat_data *cd);
-int chat_disableevent(struct chat_data *cd);
-int chat_npckickall(struct chat_data *cd);
+int chat_createnpcchat(struct npc_data* nd, int limit, bool pub, int trigger, const char* title, const char* ev);
+int chat_deletenpcchat(struct npc_data* nd);
+int chat_enableevent(struct chat_data* cd);
+int chat_disableevent(struct chat_data* cd);
+int chat_npckickall(struct chat_data* cd);
 
 #endif /* _CHAT_H_ */

+ 14 - 3
src/map/clif.c

@@ -9236,11 +9236,22 @@ void clif_parse_ChatAddMember(int fd,struct map_session_data *sd)
 }
 
 /*==========================================
- *
+ * S 00de <len>.w <limit>.w <pub>.B <passwd>.8B <title>.?B
  *------------------------------------------*/
-void clif_parse_ChatRoomStatusChange(int fd,struct map_session_data *sd)
+void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd)
 {
-	chat_changechatstatus(sd,RFIFOW(fd,4),RFIFOB(fd,6),(char*)RFIFOP(fd,7),(char*)RFIFOP(fd,15),RFIFOW(fd,2)-15);
+	int len = RFIFOW(fd,2)-15;
+	int limit = RFIFOW(fd,4);
+	bool public = (bool)RFIFOB(fd,6);
+	const char* password = (char*)RFIFOP(fd,7); //not zero-terminated
+	const char* title = (char*)RFIFOP(fd,15); // not zero-terminated
+
+	char s_title[CHATROOM_TITLE_SIZE];
+	char s_password[CHATROOM_PASS_SIZE];
+	safestrncpy(s_title, title, min(len+1,CHATROOM_TITLE_SIZE));
+	safestrncpy(s_password, password, CHATROOM_PASS_SIZE);
+
+	chat_changechatstatus(sd, s_title, s_password, limit, public);
 }
 
 /*==========================================

+ 2 - 2
src/map/map.c

@@ -2505,10 +2505,10 @@ int map_waterheight(char* mapname)
  	char *rsw, *found;
 
 	//Look up for the rsw
-	sprintf(fn,"data\\%s.rsw", mapname);
+	sprintf(fn, "data\\%s.rsw", mapname);
 
 	found = grfio_find_file(fn);
-	if (found) strcpy(fn, found);
+	if (found) strcpy(fn, found); // replace with real name
 	
 	// read & convert fn
 	rsw = (char *) grfio_read (fn);

+ 22 - 20
src/map/map.h

@@ -35,7 +35,6 @@
 #define MAX_NPC_PER_MAP 512
 #define BLOCK_SIZE 8
 #define AREA_SIZE battle_config.area_size
-#define LIFETIME_FLOORITEM 60
 #define DAMAGELOG_SIZE 30
 #define LOOTITEM_SIZE 10
 //Quick defines to know which are the min-max common ailments. [Skotlex]
@@ -169,7 +168,10 @@ enum {
 //String length you can write in the 'talking box'
 #define CHATBOX_SIZE 70
 //Talk max size: <name> : <message of 70> [Skotlex]
-#define CHAT_SIZE	(NAME_LENGTH + 3 + CHATBOX_SIZE)
+#define CHAT_SIZE (NAME_LENGTH + 3 + CHATBOX_SIZE)
+//Chatroom-related string sizes
+#define CHATROOM_TITLE_SIZE (36 + 1)
+#define CHATROOM_PASS_SIZE (8 + 1)
 
 #define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
 
@@ -188,7 +190,7 @@ enum bl_type {
 	BL_PC = 0x001,
 	BL_MOB = 0x002,
 	BL_PET = 0x004,
-	BL_HOM = 0x008,	//[blackhole89]
+	BL_HOM = 0x008,
 	BL_ITEM = 0x010,
 	BL_SKILL = 0x020,
 	BL_NPC = 0x040,
@@ -1108,16 +1110,18 @@ struct map_data {
 
 	struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer]
 	int mob_delete_timer;	// [Skotlex]
-	int zone;	// [Komurka]
+	int zone;	// zone number (for item/skill restrictions)
 	int jexp;	// map experience multiplicator
 	int bexp;	// map experience multiplicator
 	int nocommand; //Blocks @/# commands for non-gms. [Skotlex]
 };
 
+/// Stores information about a remote map (for multi-mapserver setups).
+/// Beginning of data structure matches 'map_data', to allow typecasting.
 struct map_data_other_server {
 	char name[MAP_NAME_LENGTH];
 	unsigned short index; //Index is the map index used by the mapindex* functions.
-	unsigned char *gat;	// NULLŒÅ’è‚É‚µ‚Ä”»’f
+	unsigned char *gat; // If this is NULL‚ the map is not on this map-server
 	uint32 ip;
 	uint16 port;
 };
@@ -1131,6 +1135,19 @@ struct flooritem_data {
 	struct item item_data;
 };
 
+struct chat_data {
+	struct block_list bl;            // data for this map object
+	char title[CHATROOM_TITLE_SIZE]; // room title 
+	char pass[CHATROOM_PASS_SIZE];   // password
+	bool pub;                        // private/public flag
+	unsigned char users;             // current users
+	unsigned char limit;             // join limit
+	unsigned char trigger;           // number of users needed to trigger event
+	struct map_session_data *usersd[20];
+	struct block_list **owner;
+	char npc_event[50];
+};
+
 enum _sp {
 	SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP,	// 0-7
 	SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT,	// 8-15
@@ -1249,21 +1266,6 @@ enum {
 	CELL_CLRICEWALL,
 };
 
-struct chat_data {
-	struct block_list bl;
-
-	char pass[8+1];   /* password */
-	char title[60+1]; /* room title */
-	unsigned char limit;     /* join limit */
-	unsigned char trigger;
-	unsigned char users;     /* current users */
-	unsigned char pub;       /* room attribute */
-	struct map_session_data *usersd[20];
-	struct block_list *owner_;
-	struct block_list **owner;
-	char npc_event[50];
-};
-
 extern struct map_data map[];
 extern int map_num;
 extern int autosave_interval;

+ 4 - 7
src/map/mob.c

@@ -1495,11 +1495,8 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
 		&& check_distance_blxy(&dlist->first_sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE)
 #endif
 	) {	//Autoloot.
-		if (party_share_loot(
-			dlist->first_sd->status.party_id?
-				party_search(dlist->first_sd->status.party_id):
-				NULL,
-			dlist->first_sd,&ditem->item_data,dlist->first_sd->bl.id) == 0
+		if (party_share_loot(party_search(dlist->first_sd->status.party_id),
+			dlist->first_sd, &ditem->item_data, dlist->first_sd->bl.id) == 0
 		) {
 			ers_free(item_drop_ers, ditem);
 			return;
@@ -2344,7 +2341,7 @@ int mob_class_change (struct mob_data *md, int class_)
 	clif_mob_class_change(md,class_);
 	status_calc_mob(md, 3);
 
-	if (battle_config.monster_class_change_full_recover) {
+	if (battle_config.monster_class_change_recover) {
 		memset(md->dmglog, 0, sizeof(md->dmglog));
 		md->tdmg = 0;
 	} else {
@@ -2465,7 +2462,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id)
 		amount+=k; //Increase final value by same amount to preserve total number to summon.
 	}
 	
-	if (!battle_config.monster_class_change_full_recover &&
+	if (!battle_config.monster_class_change_recover &&
 		(skill_id == NPC_TRANSFORMATION || skill_id == NPC_METAMORPHOSIS))
 		hp_rate = 100*md2->status.hp/md2->status.max_hp;
 

+ 69 - 106
src/map/npc.c

@@ -2227,6 +2227,19 @@ void npc_movenpc(struct npc_data* nd, int x, int y)
 	map_foreachinrange(clif_insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
 	npc_setcells(nd);
 }
+
+int npc_changename(const char* name, const char* newname, short look)
+{
+	struct npc_data* nd = (struct npc_data *) strdb_remove(npcname_db, name);
+	if (nd == NULL)
+		return 0;
+	npc_enable(name, 0);
+	strcpy(nd->name, newname);
+	nd->class_ = look;
+	npc_enable(newname, 1);
+	return 0;
+}
+
 /*==========================================
  * function�s‰ð�Í
  *------------------------------------------*/
@@ -2472,16 +2485,15 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4)
 	m = map_mapname2mapid(mapname);
 	if (m < 0)
 		return 1;
-	if (w4 && strcmpi(w4, "off") == 0)
+	if (w4 && !strcmpi(w4, "off"))
 		state = 0;	//Disable mapflag rather than enable it. [Skotlex]
 	
-//ƒ}ƒbƒvƒtƒ‰ƒO
-	if (strcmpi(w3, "nosave") == 0) {
+	if (!strcmpi(w3, "nosave")) {
 		char savemap[MAP_NAME_LENGTH_EXT];
 		int savex, savey;
 		if (state == 0)
 			; //Map flag disabled.
-		else if (strcmp(w4, "SavePoint") == 0) {
+		else if (!strcmpi(w4, "SavePoint")) {
 			map[m].save.map = 0;
 			map[m].save.x = -1;
 			map[m].save.y = -1;
@@ -2497,32 +2509,25 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4)
 		}
 		map[m].flag.nosave = state;
 	}
-	else if (strcmpi(w3,"nomemo")==0) {
+	else if (!strcmpi(w3,"nomemo"))
 		map[m].flag.nomemo=state;
-	}
-	else if (strcmpi(w3,"noteleport")==0) {
+	else if (!strcmpi(w3,"noteleport"))
 		map[m].flag.noteleport=state;
-	}
-	else if (strcmpi(w3,"nowarp")==0) {
+	else if (!strcmpi(w3,"nowarp"))
 		map[m].flag.nowarp=state;
-	}
-	else if (strcmpi(w3,"nowarpto")==0) {
+	else if (!strcmpi(w3,"nowarpto"))
 		map[m].flag.nowarpto=state;
-	}
-	else if (strcmpi(w3,"noreturn")==0) {
+	else if (!strcmpi(w3,"noreturn"))
 		map[m].flag.noreturn=state;
-	}
-	else if (strcmpi(w3,"monster_noteleport")==0) {
+	else if (!strcmpi(w3,"monster_noteleport"))
 		map[m].flag.monster_noteleport=state;
-	}
-	else if (strcmpi(w3,"nobranch")==0) {
+	else if (!strcmpi(w3,"nobranch"))
 		map[m].flag.nobranch=state;
-	}
-	else if (strcmpi(w3,"nopenalty")==0) {
+	else if (!strcmpi(w3,"nopenalty")) {
 		map[m].flag.noexppenalty=state;
 		map[m].flag.nozenypenalty=state;
 	}
-	else if (strcmpi(w3,"pvp")==0) {
+	else if (!strcmpi(w3,"pvp")) {
 		map[m].flag.pvp=state;
 		if (state) {
 			if (map[m].flag.gvg || map[m].flag.gvg_dungeon || map[m].flag.gvg_castle)
@@ -2532,26 +2537,24 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4)
 			map[m].flag.gvg_castle=0;
 		}
 	}
-	else if (strcmpi(w3,"pvp_noparty")==0) {
+	else if (!strcmpi(w3,"pvp_noparty"))
 		map[m].flag.pvp_noparty=state;
-	}
-	else if (strcmpi(w3,"pvp_noguild")==0) {
+	else if (!strcmpi(w3,"pvp_noguild"))
 		map[m].flag.pvp_noguild=state;
-	}
-	else if (strcmpi(w3, "pvp_nightmaredrop") == 0) {
+	else if (!strcmpi(w3, "pvp_nightmaredrop")) {
 		char drop_arg1[16], drop_arg2[16];
 		int drop_id = 0, drop_type = 0, drop_per = 0;
 		if (sscanf(w4, "%[^,],%[^,],%d", drop_arg1, drop_arg2, &drop_per) == 3) {
 			int i;
-			if (strcmp(drop_arg1, "random") == 0)
+			if (!strcmpi(drop_arg1, "random"))
 				drop_id = -1;
 			else if (itemdb_exists((drop_id = atoi(drop_arg1))) == NULL)
 				drop_id = 0;
-			if (strcmp(drop_arg2, "inventory") == 0)
+			if (!strcmpi(drop_arg2, "inventory"))
 				drop_type = 1;
-			else if (strcmp(drop_arg2,"equip") == 0)
+			else if (!strcmpi(drop_arg2,"equip"))
 				drop_type = 2;
-			else if (strcmp(drop_arg2,"all") == 0)
+			else if (!strcmpi(drop_arg2,"all"))
 				drop_type = 3;
 
 			if (drop_id != 0){
@@ -2568,10 +2571,9 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4)
 		} else if (!state) //Disable
 			map[m].flag.pvp_nightmaredrop = 0;
 	}
-	else if (strcmpi(w3,"pvp_nocalcrank")==0) {
+	else if (!strcmpi(w3,"pvp_nocalcrank"))
 		map[m].flag.pvp_nocalcrank=state;
-	}
-	else if (strcmpi(w3,"gvg")==0) {
+	else if (!strcmpi(w3,"gvg")) {
 		map[m].flag.gvg=state;
 		if (state && map[m].flag.pvp)
 		{
@@ -2579,92 +2581,69 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4)
 			ShowWarning("You can't set PvP and GvG flags for the same map! Removing PvP flag from %s\n", map[m].name);
 		}
 	}
-	else if (strcmpi(w3,"gvg_noparty")==0) {
+	else if (!strcmpi(w3,"gvg_noparty"))
 		map[m].flag.gvg_noparty=state;
-	}
-	else if (strcmpi(w3,"gvg_dungeon")==0) {
+	else if (!strcmpi(w3,"gvg_dungeon")) {
 		map[m].flag.gvg_dungeon=state;
 		if (state) map[m].flag.pvp=0;
 	}
-	else if (strcmpi(w3,"gvg_castle")==0) {
+	else if (!strcmpi(w3,"gvg_castle")) {
 		map[m].flag.gvg_castle=state;
 		if (state) map[m].flag.pvp=0;
 	}
-	else if (strcmpi(w3,"noexppenalty")==0) {
+	else if (!strcmpi(w3,"noexppenalty"))
 		map[m].flag.noexppenalty=state;
-	}
-	else if (strcmpi(w3,"nozenypenalty")==0) {
+	else if (!strcmpi(w3,"nozenypenalty"))
 		map[m].flag.nozenypenalty=state;
-	}
-	else if (strcmpi(w3,"notrade")==0) {
+	else if (!strcmpi(w3,"notrade"))
 		map[m].flag.notrade=state;
-	}
-	else if (strcmpi(w3,"novending")==0) {
+	else if (!strcmpi(w3,"novending"))
 		map[m].flag.novending=state;
-	}
-	else if (strcmpi(w3,"nodrop")==0) {
+	else if (!strcmpi(w3,"nodrop"))
 		map[m].flag.nodrop=state;
-	}
-	else if (strcmpi(w3,"noskill")==0) {
+	else if (!strcmpi(w3,"noskill"))
 		map[m].flag.noskill=state;
-	}
-	else if (strcmpi(w3,"noicewall")==0) { // noicewall [Valaris]
+	else if (!strcmpi(w3,"noicewall"))
 		map[m].flag.noicewall=state;
-	}
-	else if (strcmpi(w3,"snow")==0) { // snow [Valaris]
+	else if (!strcmpi(w3,"snow"))
 		map[m].flag.snow=state;
-	}
-	else if (strcmpi(w3,"clouds")==0) {
+	else if (!strcmpi(w3,"clouds"))
 		map[m].flag.clouds=state;
-	}
-	else if (strcmpi(w3,"clouds2")==0) { // clouds2 [Valaris]
+	else if (!strcmpi(w3,"clouds2"))
 		map[m].flag.clouds2=state;
-	}
-	else if (strcmpi(w3,"fog")==0) { // fog [Valaris]
+	else if (!strcmpi(w3,"fog"))
 		map[m].flag.fog=state;
-	}
-	else if (strcmpi(w3,"fireworks")==0) {
+	else if (!strcmpi(w3,"fireworks"))
 		map[m].flag.fireworks=state;
-	}
-	else if (strcmpi(w3,"sakura")==0) { // sakura [Valaris]
+	else if (!strcmpi(w3,"sakura"))
 		map[m].flag.sakura=state;
-	}
-	else if (strcmpi(w3,"leaves")==0) { // leaves [Valaris]
+	else if (!strcmpi(w3,"leaves"))
 		map[m].flag.leaves=state;
-	}
-	else if (strcmpi(w3,"rain")==0) { // rain [Valaris]
+	else if (!strcmpi(w3,"rain"))
 		map[m].flag.rain=state;
-	}
-	else if (strcmpi(w3,"indoors")==0) { // celest
+	else if (!strcmpi(w3,"indoors"))
 		map[m].flag.indoors=state;
-	}
-	else if (strcmpi(w3,"nightenabled")==0) { // Skotlex
+	else if (!strcmpi(w3,"nightenabled"))
 		map[m].flag.nightenabled=state;
-	}
-	else if (strcmpi(w3,"nogo")==0) { // celest
+	else if (!strcmpi(w3,"nogo"))
 		map[m].flag.nogo=state;
-	}
-	else if (strcmpi(w3,"noexp")==0) { // Lorky
+	else if (!strcmpi(w3,"noexp")) {
 		map[m].flag.nobaseexp=state;
 		map[m].flag.nojobexp=state;
 	}
-	else if (strcmpi(w3,"nobaseexp")==0) { // Lorky
+	else if (!strcmpi(w3,"nobaseexp"))
 		map[m].flag.nobaseexp=state;
-	}
-	else if (strcmpi(w3,"nojobexp")==0) { // Lorky
+	else if (!strcmpi(w3,"nojobexp"))
 		map[m].flag.nojobexp=state;
-	}
-	else if (strcmpi(w3,"noloot")==0) { // Lorky
+	else if (!strcmpi(w3,"noloot")) {
 		map[m].flag.nomobloot=state;
 		map[m].flag.nomvploot=state;
 	}
-	else if (strcmpi(w3,"nomobloot")==0) { // Lorky
+	else if (!strcmpi(w3,"nomobloot"))
 		map[m].flag.nomobloot=state;
-	}
-	else if (strcmpi(w3,"nomvploot")==0) { // Lorky
+	else if (!strcmpi(w3,"nomvploot"))
 		map[m].flag.nomvploot=state;
-	}
-	else if (strcmpi(w3,"nocommand")==0) { // Skotlex
+	else if (!strcmpi(w3,"nocommand")) {
 		if (state) {
 			if (sscanf(w4, "%d", &state) == 1)
 				map[m].nocommand =state;
@@ -2673,7 +2652,7 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4)
 		} else
 			map[m].nocommand=0;
 	}
-	else if (strcmpi(w3,"restricted")==0) { // Komurka
+	else if (!strcmpi(w3,"restricted")) {
 		if (state) {
 			map[m].flag.restricted=1;
 			sscanf(w4, "%d", &state);
@@ -2683,28 +2662,24 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4)
 			map[m].zone = 0;
 		}
 	}
-	else if (strcmpi(w3,"jexp")==0) {
+	else if (!strcmpi(w3,"jexp")) {
 		map[m].jexp = (state) ? atoi(w4) : 100;
 		if( map[m].jexp < 0 ) map[m].jexp = 100;
 		map[m].flag.nojobexp = (map[m].jexp==0)?1:0;
 	}
-	else if (strcmpi(w3,"bexp")==0) {
+	else if (!strcmpi(w3,"bexp")) {
 		map[m].bexp = (state) ? atoi(w4) : 100;
 		if( map[m].bexp < 0 ) map[m].bexp = 100;
 		 map[m].flag.nobaseexp = (map[m].bexp==0)?1:0;
 	}
-	else if (strcmpi(w3,"loadevent")==0) { // Skotlex
+	else if (!strcmpi(w3,"loadevent"))
 		map[m].flag.loadevent=state;
-	}
-	else if (strcmpi(w3,"nochat")==0) { // Skotlex
+	else if (!strcmpi(w3,"nochat"))
 		map[m].flag.nochat=state;
-	}
-	else if (strcmpi(w3,"partylock")==0) { // Skotlex
+	else if (!strcmpi(w3,"partylock"))
 		map[m].flag.partylock=state;
-	}
-	else if (strcmpi(w3,"guildlock")==0) { // Skotlex
+	else if (!strcmpi(w3,"guildlock"))
 		map[m].flag.guildlock=state;
-	}
 
 	return 0;
 }
@@ -3167,15 +3142,3 @@ int do_init_npc(void)
 
 	return 0;
 }
-// [Lance]
-int npc_changename(const char* name, const char* newname, short look)
-{
-	struct npc_data* nd = (struct npc_data *) strdb_remove(npcname_db, name);
-	if (nd == NULL)
-		return 0;
-	npc_enable(name, 0);
-	strcpy(nd->name, newname);
-	nd->class_ = look;
-	npc_enable(newname, 1);
-	return 0;
-}

+ 18 - 35
src/map/party.c

@@ -702,20 +702,20 @@ int party_send_xy_clear(struct party_data *p)
 }
 
 // exp share and added zeny share [Valaris]
-int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny)
+int party_exp_share(struct party_data* p, struct block_list* src, unsigned int base_exp, unsigned int job_exp, int zeny)
 {
 	struct map_session_data* sd[MAX_PARTY];
-	int i;
-	unsigned short c;
+	unsigned int i, c;
 
 	nullpo_retr(0, p);
 
-	for (i = c = 0; i < MAX_PARTY; i++)
-		if ((sd[c] = p->data[i].sd)!=NULL && sd[c]->bl.m == src->m && !pc_isdead(sd[c])) {
-			if (battle_config.idle_no_share && (sd[c]->chatID || sd[c]->vender_id || (sd[c]->idletime < (last_tick - battle_config.idle_no_share))))
-				continue;
-			c++;
-		}
+	// count the number of players eligible for exp sharing
+	for (i = c = 0; i < MAX_PARTY; i++) {
+		if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) ||
+		    battle_config.idle_no_share && (sd[c]->chatID || sd[c]->vender_id || sd[c]->idletime < last_tick - battle_config.idle_no_share) )
+			continue;
+		c++;
+	}
 	if (c < 1)
 		return 0;
 
@@ -723,32 +723,15 @@ int party_exp_share(struct party_data *p,struct block_list *src,unsigned int bas
 	job_exp/=c;
 	zeny/=c;
 
-	if (battle_config.party_even_share_bonus && c > 1) {
-		unsigned short bonus =100 + battle_config.party_even_share_bonus*(c-1);
-		if (base_exp) {
-			if (base_exp/100 > UINT_MAX/bonus)
-				base_exp= UINT_MAX; //Exp overflow
-			else if (base_exp > 10000)
-				base_exp = (base_exp/100)*bonus; //Calculation overflow protection
-			else
-				base_exp = base_exp*bonus/100;
-		}
-		if (job_exp) {
-			if (job_exp/100 > UINT_MAX/bonus)
-				job_exp = UINT_MAX;
-			else if (job_exp > 10000)
-				job_exp = (job_exp/100)*bonus;
-			else
-				job_exp = job_exp*bonus/100;
-		}
-		if (zeny) {
-			if (zeny/100 > INT_MAX/bonus)
-				zeny = INT_MAX;
-			else if (zeny > 10000)
-				zeny = (zeny/100)*bonus;
-			else
-				zeny = zeny*bonus/100;
-		}
+	if (battle_config.party_even_share_bonus && c > 1)
+	{
+		double bonus = 100 + battle_config.party_even_share_bonus*(c-1);
+		if (base_exp)
+			base_exp = (unsigned int) cap_value(base_exp * bonus/100, 0, UINT_MAX);
+		if (job_exp)
+			job_exp = (unsigned int) cap_value(job_exp * bonus/100, 0, UINT_MAX);
+		if (zeny)
+			zeny = (unsigned int) cap_value(zeny * bonus/100, INT_MIN, INT_MAX);
 	}
 
 	for (i = 0; i < c; i++)

+ 1 - 1
src/map/party.h

@@ -41,7 +41,7 @@ int party_check_conflict(struct map_session_data *sd);
 int party_skill_check(struct map_session_data *sd, int party_id, int skillid, int skilllv);
 int party_send_xy_clear(struct party_data *p);
 int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny);
-int party_share_loot(struct party_data *p, TBL_PC *sd, struct item *item_data, int type);
+int party_share_loot(struct party_data* p, TBL_PC* sd, struct item* item_data, int first);
 int party_send_dot_remove(struct map_session_data *sd);
 int party_sub_count(struct block_list *bl, va_list ap);
 int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int type,...);

+ 1 - 1
src/map/script.c

@@ -8965,7 +8965,7 @@ BUILDIN_FUNC(waitingroom)
 		ev = script_getstr(st, 4);
 	}
 	if( (nd=(struct npc_data *)map_id2bl(st->oid)) != NULL )
-		chat_createnpcchat(nd, limit, pub, trigger, title, (int)strlen(title), ev);
+		chat_createnpcchat(nd, limit, pub, trigger, title, ev);
 	return 0;
 }
 

+ 1 - 1
src/map/skill.c

@@ -8680,7 +8680,7 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
 		}
 		break;
 	case ST_RECOV_WEIGHT_RATE:
-		if(battle_config.natural_heal_weight_rate <= 100 && sd->weight*100/sd->max_weight >= battle_config.natural_heal_weight_rate) {
+		if(battle_config.natural_heal_weight_rate <= 100 && sd->weight*100/sd->max_weight >= (unsigned int)battle_config.natural_heal_weight_rate) {
 			clif_skill_fail(sd,skill,0,0);
 			return 0;
 		}

+ 1 - 4
src/map/status.c

@@ -5640,10 +5640,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 			break;
 		case SC_ADRENALINE2:
 		case SC_ADRENALINE:
-			if (val2 || !battle_config.party_skill_penalty)
-				val3 = 300;
-			else
-				val3 = 200;
+			val3 = (val2) ? 300 : 200; // aspd increase
 		case SC_WEAPONPERFECTION:
 		case SC_OVERTHRUST:
 			if(sd && pc_checkskill(sd,BS_HILTBINDING)>0)

部分文件因为文件数量过多而无法显示